// node_modules/zone.js/fesm2015/zone.js var global = globalThis; function __symbol__(name) { const symbolPrefix = global["__Zone_symbol_prefix"] || "__zone_symbol__"; return symbolPrefix + name; } function initZone() { const performance = global["performance"]; function mark(name) { performance && performance["mark"] && performance["mark"](name); } function performanceMeasure(name, label) { performance && performance["measure"] && performance["measure"](name, label); } mark("Zone"); class ZoneImpl { static { this.__symbol__ = __symbol__; } static assertZonePatched() { if (global["Promise"] !== patches["ZoneAwarePromise"]) { throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)"); } } static get root() { let zone = ZoneImpl.current; while (zone.parent) { zone = zone.parent; } return zone; } static get current() { return _currentZoneFrame.zone; } static get currentTask() { return _currentTask; } // tslint:disable-next-line:require-internal-with-underscore static __load_patch(name, fn, ignoreDuplicate = false) { if (patches.hasOwnProperty(name)) { const checkDuplicate = global[__symbol__("forceDuplicateZoneCheck")] === true; if (!ignoreDuplicate && checkDuplicate) { throw Error("Already loaded patch: " + name); } } else if (!global["__Zone_disable_" + name]) { const perfName = "Zone:" + name; mark(perfName); patches[name] = fn(global, ZoneImpl, _api); performanceMeasure(perfName, perfName); } } get parent() { return this._parent; } get name() { return this._name; } constructor(parent, zoneSpec) { this._parent = parent; this._name = zoneSpec ? zoneSpec.name || "unnamed" : ""; this._properties = zoneSpec && zoneSpec.properties || {}; this._zoneDelegate = new _ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec); } get(key) { const zone = this.getZoneWith(key); if (zone) return zone._properties[key]; } getZoneWith(key) { let current = this; while (current) { if (current._properties.hasOwnProperty(key)) { return current; } current = current._parent; } return null; } fork(zoneSpec) { if (!zoneSpec) throw new Error("ZoneSpec required!"); return this._zoneDelegate.fork(this, zoneSpec); } wrap(callback, source) { if (typeof callback !== "function") { throw new Error("Expecting function got: " + callback); } const _callback = this._zoneDelegate.intercept(this, callback, source); const zone = this; return function() { return zone.runGuarded(_callback, this, arguments, source); }; } run(callback, applyThis, applyArgs, source) { _currentZoneFrame = { parent: _currentZoneFrame, zone: this }; try { return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source); } finally { _currentZoneFrame = _currentZoneFrame.parent; } } runGuarded(callback, applyThis = null, applyArgs, source) { _currentZoneFrame = { parent: _currentZoneFrame, zone: this }; try { try { return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source); } catch (error) { if (this._zoneDelegate.handleError(this, error)) { throw error; } } } finally { _currentZoneFrame = _currentZoneFrame.parent; } } runTask(task, applyThis, applyArgs) { if (task.zone != this) { throw new Error("A task can only be run in the zone of creation! (Creation: " + (task.zone || NO_ZONE).name + "; Execution: " + this.name + ")"); } const zoneTask = task; const { type, data: { isPeriodic = false, isRefreshable = false } = {} } = task; if (task.state === notScheduled && (type === eventTask || type === macroTask)) { return; } const reEntryGuard = task.state != running; reEntryGuard && zoneTask._transitionTo(running, scheduled); const previousTask = _currentTask; _currentTask = zoneTask; _currentZoneFrame = { parent: _currentZoneFrame, zone: this }; try { if (type == macroTask && task.data && !isPeriodic && !isRefreshable) { task.cancelFn = void 0; } try { return this._zoneDelegate.invokeTask(this, zoneTask, applyThis, applyArgs); } catch (error) { if (this._zoneDelegate.handleError(this, error)) { throw error; } } } finally { const state = task.state; if (state !== notScheduled && state !== unknown) { if (type == eventTask || isPeriodic || isRefreshable && state === scheduling) { reEntryGuard && zoneTask._transitionTo(scheduled, running, scheduling); } else { const zoneDelegates = zoneTask._zoneDelegates; this._updateTaskCount(zoneTask, -1); reEntryGuard && zoneTask._transitionTo(notScheduled, running, notScheduled); if (isRefreshable) { zoneTask._zoneDelegates = zoneDelegates; } } } _currentZoneFrame = _currentZoneFrame.parent; _currentTask = previousTask; } } scheduleTask(task) { if (task.zone && task.zone !== this) { let newZone = this; while (newZone) { if (newZone === task.zone) { throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${task.zone.name}`); } newZone = newZone.parent; } } task._transitionTo(scheduling, notScheduled); const zoneDelegates = []; task._zoneDelegates = zoneDelegates; task._zone = this; try { task = this._zoneDelegate.scheduleTask(this, task); } catch (err) { task._transitionTo(unknown, scheduling, notScheduled); this._zoneDelegate.handleError(this, err); throw err; } if (task._zoneDelegates === zoneDelegates) { this._updateTaskCount(task, 1); } if (task.state == scheduling) { task._transitionTo(scheduled, scheduling); } return task; } scheduleMicroTask(source, callback, data, customSchedule) { return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, void 0)); } scheduleMacroTask(source, callback, data, customSchedule, customCancel) { return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel)); } scheduleEventTask(source, callback, data, customSchedule, customCancel) { return this.scheduleTask(new ZoneTask(eventTask, source, callback, data, customSchedule, customCancel)); } cancelTask(task) { if (task.zone != this) throw new Error("A task can only be cancelled in the zone of creation! (Creation: " + (task.zone || NO_ZONE).name + "; Execution: " + this.name + ")"); if (task.state !== scheduled && task.state !== running) { return; } task._transitionTo(canceling, scheduled, running); try { this._zoneDelegate.cancelTask(this, task); } catch (err) { task._transitionTo(unknown, canceling); this._zoneDelegate.handleError(this, err); throw err; } this._updateTaskCount(task, -1); task._transitionTo(notScheduled, canceling); task.runCount = -1; return task; } _updateTaskCount(task, count) { const zoneDelegates = task._zoneDelegates; if (count == -1) { task._zoneDelegates = null; } for (let i = 0; i < zoneDelegates.length; i++) { zoneDelegates[i]._updateTaskCount(task.type, count); } } } const DELEGATE_ZS = { name: "", onHasTask: (delegate, _, target, hasTaskState) => delegate.hasTask(target, hasTaskState), onScheduleTask: (delegate, _, target, task) => delegate.scheduleTask(target, task), onInvokeTask: (delegate, _, target, task, applyThis, applyArgs) => delegate.invokeTask(target, task, applyThis, applyArgs), onCancelTask: (delegate, _, target, task) => delegate.cancelTask(target, task) }; class _ZoneDelegate { get zone() { return this._zone; } constructor(zone, parentDelegate, zoneSpec) { this._taskCounts = { "microTask": 0, "macroTask": 0, "eventTask": 0 }; this._zone = zone; this._parentDelegate = parentDelegate; this._forkZS = zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS); this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt); this._forkCurrZone = zoneSpec && (zoneSpec.onFork ? this._zone : parentDelegate._forkCurrZone); this._interceptZS = zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS); this._interceptDlgt = zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt); this._interceptCurrZone = zoneSpec && (zoneSpec.onIntercept ? this._zone : parentDelegate._interceptCurrZone); this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS); this._invokeDlgt = zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt); this._invokeCurrZone = zoneSpec && (zoneSpec.onInvoke ? this._zone : parentDelegate._invokeCurrZone); this._handleErrorZS = zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS); this._handleErrorDlgt = zoneSpec && (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt); this._handleErrorCurrZone = zoneSpec && (zoneSpec.onHandleError ? this._zone : parentDelegate._handleErrorCurrZone); this._scheduleTaskZS = zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS); this._scheduleTaskDlgt = zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt); this._scheduleTaskCurrZone = zoneSpec && (zoneSpec.onScheduleTask ? this._zone : parentDelegate._scheduleTaskCurrZone); this._invokeTaskZS = zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS); this._invokeTaskDlgt = zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt); this._invokeTaskCurrZone = zoneSpec && (zoneSpec.onInvokeTask ? this._zone : parentDelegate._invokeTaskCurrZone); this._cancelTaskZS = zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS); this._cancelTaskDlgt = zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt); this._cancelTaskCurrZone = zoneSpec && (zoneSpec.onCancelTask ? this._zone : parentDelegate._cancelTaskCurrZone); this._hasTaskZS = null; this._hasTaskDlgt = null; this._hasTaskDlgtOwner = null; this._hasTaskCurrZone = null; const zoneSpecHasTask = zoneSpec && zoneSpec.onHasTask; const parentHasTask = parentDelegate && parentDelegate._hasTaskZS; if (zoneSpecHasTask || parentHasTask) { this._hasTaskZS = zoneSpecHasTask ? zoneSpec : DELEGATE_ZS; this._hasTaskDlgt = parentDelegate; this._hasTaskDlgtOwner = this; this._hasTaskCurrZone = this._zone; if (!zoneSpec.onScheduleTask) { this._scheduleTaskZS = DELEGATE_ZS; this._scheduleTaskDlgt = parentDelegate; this._scheduleTaskCurrZone = this._zone; } if (!zoneSpec.onInvokeTask) { this._invokeTaskZS = DELEGATE_ZS; this._invokeTaskDlgt = parentDelegate; this._invokeTaskCurrZone = this._zone; } if (!zoneSpec.onCancelTask) { this._cancelTaskZS = DELEGATE_ZS; this._cancelTaskDlgt = parentDelegate; this._cancelTaskCurrZone = this._zone; } } } fork(targetZone, zoneSpec) { return this._forkZS ? this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec) : new ZoneImpl(targetZone, zoneSpec); } intercept(targetZone, callback, source) { return this._interceptZS ? this._interceptZS.onIntercept(this._interceptDlgt, this._interceptCurrZone, targetZone, callback, source) : callback; } invoke(targetZone, callback, applyThis, applyArgs, source) { return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) : callback.apply(applyThis, applyArgs); } handleError(targetZone, error) { return this._handleErrorZS ? this._handleErrorZS.onHandleError(this._handleErrorDlgt, this._handleErrorCurrZone, targetZone, error) : true; } scheduleTask(targetZone, task) { let returnTask = task; if (this._scheduleTaskZS) { if (this._hasTaskZS) { returnTask._zoneDelegates.push(this._hasTaskDlgtOwner); } returnTask = this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this._scheduleTaskCurrZone, targetZone, task); if (!returnTask) returnTask = task; } else { if (task.scheduleFn) { task.scheduleFn(task); } else if (task.type == microTask) { scheduleMicroTask(task); } else { throw new Error("Task is missing scheduleFn."); } } return returnTask; } invokeTask(targetZone, task, applyThis, applyArgs) { return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) : task.callback.apply(applyThis, applyArgs); } cancelTask(targetZone, task) { let value; if (this._cancelTaskZS) { value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this._cancelTaskCurrZone, targetZone, task); } else { if (!task.cancelFn) { throw Error("Task is not cancelable"); } value = task.cancelFn(task); } return value; } hasTask(targetZone, isEmpty) { try { this._hasTaskZS && this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty); } catch (err) { this.handleError(targetZone, err); } } // tslint:disable-next-line:require-internal-with-underscore _updateTaskCount(type, count) { const counts = this._taskCounts; const prev = counts[type]; const next = counts[type] = prev + count; if (next < 0) { throw new Error("More tasks executed then were scheduled."); } if (prev == 0 || next == 0) { const isEmpty = { microTask: counts["microTask"] > 0, macroTask: counts["macroTask"] > 0, eventTask: counts["eventTask"] > 0, change: type }; this.hasTask(this._zone, isEmpty); } } } class ZoneTask { constructor(type, source, callback, options, scheduleFn, cancelFn) { this._zone = null; this.runCount = 0; this._zoneDelegates = null; this._state = "notScheduled"; this.type = type; this.source = source; this.data = options; this.scheduleFn = scheduleFn; this.cancelFn = cancelFn; if (!callback) { throw new Error("callback is not defined"); } this.callback = callback; const self2 = this; if (type === eventTask && options && options.useG) { this.invoke = ZoneTask.invokeTask; } else { this.invoke = function() { return ZoneTask.invokeTask.call(global, self2, this, arguments); }; } } static invokeTask(task, target, args) { if (!task) { task = this; } _numberOfNestedTaskFrames++; try { task.runCount++; return task.zone.runTask(task, target, args); } finally { if (_numberOfNestedTaskFrames == 1) { drainMicroTaskQueue(); } _numberOfNestedTaskFrames--; } } get zone() { return this._zone; } get state() { return this._state; } cancelScheduleRequest() { this._transitionTo(notScheduled, scheduling); } // tslint:disable-next-line:require-internal-with-underscore _transitionTo(toState, fromState1, fromState2) { if (this._state === fromState1 || this._state === fromState2) { this._state = toState; if (toState == notScheduled) { this._zoneDelegates = null; } } else { throw new Error(`${this.type} '${this.source}': can not transition to '${toState}', expecting state '${fromState1}'${fromState2 ? " or '" + fromState2 + "'" : ""}, was '${this._state}'.`); } } toString() { if (this.data && typeof this.data.handleId !== "undefined") { return this.data.handleId.toString(); } else { return Object.prototype.toString.call(this); } } // add toJSON method to prevent cyclic error when // call JSON.stringify(zoneTask) toJSON() { return { type: this.type, state: this.state, source: this.source, zone: this.zone.name, runCount: this.runCount }; } } const symbolSetTimeout = __symbol__("setTimeout"); const symbolPromise = __symbol__("Promise"); const symbolThen = __symbol__("then"); let _microTaskQueue = []; let _isDrainingMicrotaskQueue = false; let nativeMicroTaskQueuePromise; function nativeScheduleMicroTask(func) { if (!nativeMicroTaskQueuePromise) { if (global[symbolPromise]) { nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0); } } if (nativeMicroTaskQueuePromise) { let nativeThen = nativeMicroTaskQueuePromise[symbolThen]; if (!nativeThen) { nativeThen = nativeMicroTaskQueuePromise["then"]; } nativeThen.call(nativeMicroTaskQueuePromise, func); } else { global[symbolSetTimeout](func, 0); } } function scheduleMicroTask(task) { if (_numberOfNestedTaskFrames === 0 && _microTaskQueue.length === 0) { nativeScheduleMicroTask(drainMicroTaskQueue); } task && _microTaskQueue.push(task); } function drainMicroTaskQueue() { if (!_isDrainingMicrotaskQueue) { _isDrainingMicrotaskQueue = true; while (_microTaskQueue.length) { const queue = _microTaskQueue; _microTaskQueue = []; for (let i = 0; i < queue.length; i++) { const task = queue[i]; try { task.zone.runTask(task, null, null); } catch (error) { _api.onUnhandledError(error); } } } _api.microtaskDrainDone(); _isDrainingMicrotaskQueue = false; } } const NO_ZONE = { name: "NO ZONE" }; const notScheduled = "notScheduled", scheduling = "scheduling", scheduled = "scheduled", running = "running", canceling = "canceling", unknown = "unknown"; const microTask = "microTask", macroTask = "macroTask", eventTask = "eventTask"; const patches = {}; const _api = { symbol: __symbol__, currentZoneFrame: () => _currentZoneFrame, onUnhandledError: noop, microtaskDrainDone: noop, scheduleMicroTask, showUncaughtError: () => !ZoneImpl[__symbol__("ignoreConsoleErrorUncaughtError")], patchEventTarget: () => [], patchOnProperties: noop, patchMethod: () => noop, bindArguments: () => [], patchThen: () => noop, patchMacroTask: () => noop, patchEventPrototype: () => noop, isIEOrEdge: () => false, getGlobalObjects: () => void 0, ObjectDefineProperty: () => noop, ObjectGetOwnPropertyDescriptor: () => void 0, ObjectCreate: () => void 0, ArraySlice: () => [], patchClass: () => noop, wrapWithCurrentZone: () => noop, filterProperties: () => [], attachOriginToPatched: () => noop, _redefineProperty: () => noop, patchCallbacks: () => noop, nativeScheduleMicroTask }; let _currentZoneFrame = { parent: null, zone: new ZoneImpl(null, null) }; let _currentTask = null; let _numberOfNestedTaskFrames = 0; function noop() { } performanceMeasure("Zone", "Zone"); return ZoneImpl; } function loadZone() { const global2 = globalThis; const checkDuplicate = global2[__symbol__("forceDuplicateZoneCheck")] === true; if (global2["Zone"] && (checkDuplicate || typeof global2["Zone"].__symbol__ !== "function")) { throw new Error("Zone already loaded."); } global2["Zone"] ??= initZone(); return global2["Zone"]; } var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var ObjectDefineProperty = Object.defineProperty; var ObjectGetPrototypeOf = Object.getPrototypeOf; var ObjectCreate = Object.create; var ArraySlice = Array.prototype.slice; var ADD_EVENT_LISTENER_STR = "addEventListener"; var REMOVE_EVENT_LISTENER_STR = "removeEventListener"; var ZONE_SYMBOL_ADD_EVENT_LISTENER = __symbol__(ADD_EVENT_LISTENER_STR); var ZONE_SYMBOL_REMOVE_EVENT_LISTENER = __symbol__(REMOVE_EVENT_LISTENER_STR); var TRUE_STR = "true"; var FALSE_STR = "false"; var ZONE_SYMBOL_PREFIX = __symbol__(""); function wrapWithCurrentZone(callback, source) { return Zone.current.wrap(callback, source); } function scheduleMacroTaskWithCurrentZone(source, callback, data, customSchedule, customCancel) { return Zone.current.scheduleMacroTask(source, callback, data, customSchedule, customCancel); } var zoneSymbol = __symbol__; var isWindowExists = typeof window !== "undefined"; var internalWindow = isWindowExists ? window : void 0; var _global = isWindowExists && internalWindow || globalThis; var REMOVE_ATTRIBUTE = "removeAttribute"; function bindArguments(args, source) { for (let i = args.length - 1; i >= 0; i--) { if (typeof args[i] === "function") { args[i] = wrapWithCurrentZone(args[i], source + "_" + i); } } return args; } function patchPrototype(prototype, fnNames) { const source = prototype.constructor["name"]; for (let i = 0; i < fnNames.length; i++) { const name = fnNames[i]; const delegate = prototype[name]; if (delegate) { const prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, name); if (!isPropertyWritable(prototypeDesc)) { continue; } prototype[name] = ((delegate2) => { const patched = function() { return delegate2.apply(this, bindArguments(arguments, source + "." + name)); }; attachOriginToPatched(patched, delegate2); return patched; })(delegate); } } } function isPropertyWritable(propertyDesc) { if (!propertyDesc) { return true; } if (propertyDesc.writable === false) { return false; } return !(typeof propertyDesc.get === "function" && typeof propertyDesc.set === "undefined"); } var isWebWorker = typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope; var isNode = !("nw" in _global) && typeof _global.process !== "undefined" && _global.process.toString() === "[object process]"; var isBrowser = !isNode && !isWebWorker && !!(isWindowExists && internalWindow["HTMLElement"]); var isMix = typeof _global.process !== "undefined" && _global.process.toString() === "[object process]" && !isWebWorker && !!(isWindowExists && internalWindow["HTMLElement"]); var zoneSymbolEventNames$1 = {}; var enableBeforeunloadSymbol = zoneSymbol("enable_beforeunload"); var wrapFn = function(event) { event = event || _global.event; if (!event) { return; } let eventNameSymbol = zoneSymbolEventNames$1[event.type]; if (!eventNameSymbol) { eventNameSymbol = zoneSymbolEventNames$1[event.type] = zoneSymbol("ON_PROPERTY" + event.type); } const target = this || event.target || _global; const listener = target[eventNameSymbol]; let result; if (isBrowser && target === internalWindow && event.type === "error") { const errorEvent = event; result = listener && listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error); if (result === true) { event.preventDefault(); } } else { result = listener && listener.apply(this, arguments); if ( // https://github.com/angular/angular/issues/47579 // https://www.w3.org/TR/2011/WD-html5-20110525/history.html#beforeunloadevent // This is the only specific case we should check for. The spec defines that the // `returnValue` attribute represents the message to show the user. When the event // is created, this attribute must be set to the empty string. event.type === "beforeunload" && // To prevent any breaking changes resulting from this change, given that // it was already causing a significant number of failures in G3, we have hidden // that behavior behind a global configuration flag. Consumers can enable this // flag explicitly if they want the `beforeunload` event to be handled as defined // in the specification. _global[enableBeforeunloadSymbol] && // The IDL event definition is `attribute DOMString returnValue`, so we check whether // `typeof result` is a string. typeof result === "string" ) { event.returnValue = result; } else if (result != void 0 && !result) { event.preventDefault(); } } return result; }; function patchProperty(obj, prop, prototype) { let desc = ObjectGetOwnPropertyDescriptor(obj, prop); if (!desc && prototype) { const prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, prop); if (prototypeDesc) { desc = { enumerable: true, configurable: true }; } } if (!desc || !desc.configurable) { return; } const onPropPatchedSymbol = zoneSymbol("on" + prop + "patched"); if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) { return; } delete desc.writable; delete desc.value; const originalDescGet = desc.get; const originalDescSet = desc.set; const eventName = prop.slice(2); let eventNameSymbol = zoneSymbolEventNames$1[eventName]; if (!eventNameSymbol) { eventNameSymbol = zoneSymbolEventNames$1[eventName] = zoneSymbol("ON_PROPERTY" + eventName); } desc.set = function(newValue) { let target = this; if (!target && obj === _global) { target = _global; } if (!target) { return; } const previousValue = target[eventNameSymbol]; if (typeof previousValue === "function") { target.removeEventListener(eventName, wrapFn); } originalDescSet && originalDescSet.call(target, null); target[eventNameSymbol] = newValue; if (typeof newValue === "function") { target.addEventListener(eventName, wrapFn, false); } }; desc.get = function() { let target = this; if (!target && obj === _global) { target = _global; } if (!target) { return null; } const listener = target[eventNameSymbol]; if (listener) { return listener; } else if (originalDescGet) { let value = originalDescGet.call(this); if (value) { desc.set.call(this, value); if (typeof target[REMOVE_ATTRIBUTE] === "function") { target.removeAttribute(prop); } return value; } } return null; }; ObjectDefineProperty(obj, prop, desc); obj[onPropPatchedSymbol] = true; } function patchOnProperties(obj, properties, prototype) { if (properties) { for (let i = 0; i < properties.length; i++) { patchProperty(obj, "on" + properties[i], prototype); } } else { const onProperties = []; for (const prop in obj) { if (prop.slice(0, 2) == "on") { onProperties.push(prop); } } for (let j = 0; j < onProperties.length; j++) { patchProperty(obj, onProperties[j], prototype); } } } var originalInstanceKey = zoneSymbol("originalInstance"); function patchClass(className) { const OriginalClass = _global[className]; if (!OriginalClass) return; _global[zoneSymbol(className)] = OriginalClass; _global[className] = function() { const a = bindArguments(arguments, className); switch (a.length) { case 0: this[originalInstanceKey] = new OriginalClass(); break; case 1: this[originalInstanceKey] = new OriginalClass(a[0]); break; case 2: this[originalInstanceKey] = new OriginalClass(a[0], a[1]); break; case 3: this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]); break; case 4: this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]); break; default: throw new Error("Arg list too long."); } }; attachOriginToPatched(_global[className], OriginalClass); const instance = new OriginalClass(function() { }); let prop; for (prop in instance) { if (className === "XMLHttpRequest" && prop === "responseBlob") continue; (function(prop2) { if (typeof instance[prop2] === "function") { _global[className].prototype[prop2] = function() { return this[originalInstanceKey][prop2].apply(this[originalInstanceKey], arguments); }; } else { ObjectDefineProperty(_global[className].prototype, prop2, { set: function(fn) { if (typeof fn === "function") { this[originalInstanceKey][prop2] = wrapWithCurrentZone(fn, className + "." + prop2); attachOriginToPatched(this[originalInstanceKey][prop2], fn); } else { this[originalInstanceKey][prop2] = fn; } }, get: function() { return this[originalInstanceKey][prop2]; } }); } })(prop); } for (prop in OriginalClass) { if (prop !== "prototype" && OriginalClass.hasOwnProperty(prop)) { _global[className][prop] = OriginalClass[prop]; } } } function patchMethod(target, name, patchFn) { let proto = target; while (proto && !proto.hasOwnProperty(name)) { proto = ObjectGetPrototypeOf(proto); } if (!proto && target[name]) { proto = target; } const delegateName = zoneSymbol(name); let delegate = null; if (proto && (!(delegate = proto[delegateName]) || !proto.hasOwnProperty(delegateName))) { delegate = proto[delegateName] = proto[name]; const desc = proto && ObjectGetOwnPropertyDescriptor(proto, name); if (isPropertyWritable(desc)) { const patchDelegate = patchFn(delegate, delegateName, name); proto[name] = function() { return patchDelegate(this, arguments); }; attachOriginToPatched(proto[name], delegate); } } return delegate; } function patchMacroTask(obj, funcName, metaCreator) { let setNative = null; function scheduleTask(task) { const data = task.data; data.args[data.cbIdx] = function() { task.invoke.apply(this, arguments); }; setNative.apply(data.target, data.args); return task; } setNative = patchMethod(obj, funcName, (delegate) => function(self2, args) { const meta = metaCreator(self2, args); if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === "function") { return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask); } else { return delegate.apply(self2, args); } }); } function attachOriginToPatched(patched, original) { patched[zoneSymbol("OriginalDelegate")] = original; } var isDetectedIEOrEdge = false; var ieOrEdge = false; function isIE() { try { const ua = internalWindow.navigator.userAgent; if (ua.indexOf("MSIE ") !== -1 || ua.indexOf("Trident/") !== -1) { return true; } } catch (error) { } return false; } function isIEOrEdge() { if (isDetectedIEOrEdge) { return ieOrEdge; } isDetectedIEOrEdge = true; try { const ua = internalWindow.navigator.userAgent; if (ua.indexOf("MSIE ") !== -1 || ua.indexOf("Trident/") !== -1 || ua.indexOf("Edge/") !== -1) { ieOrEdge = true; } } catch (error) { } return ieOrEdge; } function isFunction(value) { return typeof value === "function"; } function isNumber(value) { return typeof value === "number"; } var passiveSupported = false; if (typeof window !== "undefined") { try { const options = Object.defineProperty({}, "passive", { get: function() { passiveSupported = true; } }); window.addEventListener("test", options, options); window.removeEventListener("test", options, options); } catch (err) { passiveSupported = false; } } var OPTIMIZED_ZONE_EVENT_TASK_DATA = { useG: true }; var zoneSymbolEventNames = {}; var globalSources = {}; var EVENT_NAME_SYMBOL_REGX = new RegExp("^" + ZONE_SYMBOL_PREFIX + "(\\w+)(true|false)$"); var IMMEDIATE_PROPAGATION_SYMBOL = zoneSymbol("propagationStopped"); function prepareEventNames(eventName, eventNameToString) { const falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR; const trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR; const symbol = ZONE_SYMBOL_PREFIX + falseEventName; const symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName; zoneSymbolEventNames[eventName] = {}; zoneSymbolEventNames[eventName][FALSE_STR] = symbol; zoneSymbolEventNames[eventName][TRUE_STR] = symbolCapture; } function patchEventTarget(_global2, api, apis, patchOptions) { const ADD_EVENT_LISTENER = patchOptions && patchOptions.add || ADD_EVENT_LISTENER_STR; const REMOVE_EVENT_LISTENER = patchOptions && patchOptions.rm || REMOVE_EVENT_LISTENER_STR; const LISTENERS_EVENT_LISTENER = patchOptions && patchOptions.listeners || "eventListeners"; const REMOVE_ALL_LISTENERS_EVENT_LISTENER = patchOptions && patchOptions.rmAll || "removeAllListeners"; const zoneSymbolAddEventListener = zoneSymbol(ADD_EVENT_LISTENER); const ADD_EVENT_LISTENER_SOURCE = "." + ADD_EVENT_LISTENER + ":"; const PREPEND_EVENT_LISTENER = "prependListener"; const PREPEND_EVENT_LISTENER_SOURCE = "." + PREPEND_EVENT_LISTENER + ":"; const invokeTask = function(task, target, event) { if (task.isRemoved) { return; } const delegate = task.callback; if (typeof delegate === "object" && delegate.handleEvent) { task.callback = (event2) => delegate.handleEvent(event2); task.originalDelegate = delegate; } let error; try { task.invoke(task, target, [event]); } catch (err) { error = err; } const options = task.options; if (options && typeof options === "object" && options.once) { const delegate2 = task.originalDelegate ? task.originalDelegate : task.callback; target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate2, options); } return error; }; function globalCallback(context, event, isCapture) { event = event || _global2.event; if (!event) { return; } const target = context || event.target || _global2; const tasks = target[zoneSymbolEventNames[event.type][isCapture ? TRUE_STR : FALSE_STR]]; if (tasks) { const errors = []; if (tasks.length === 1) { const err = invokeTask(tasks[0], target, event); err && errors.push(err); } else { const copyTasks = tasks.slice(); for (let i = 0; i < copyTasks.length; i++) { if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) { break; } const err = invokeTask(copyTasks[i], target, event); err && errors.push(err); } } if (errors.length === 1) { throw errors[0]; } else { for (let i = 0; i < errors.length; i++) { const err = errors[i]; api.nativeScheduleMicroTask(() => { throw err; }); } } } } const globalZoneAwareCallback = function(event) { return globalCallback(this, event, false); }; const globalZoneAwareCaptureCallback = function(event) { return globalCallback(this, event, true); }; function patchEventTargetMethods(obj, patchOptions2) { if (!obj) { return false; } let useGlobalCallback = true; if (patchOptions2 && patchOptions2.useG !== void 0) { useGlobalCallback = patchOptions2.useG; } const validateHandler = patchOptions2 && patchOptions2.vh; let checkDuplicate = true; if (patchOptions2 && patchOptions2.chkDup !== void 0) { checkDuplicate = patchOptions2.chkDup; } let returnTarget = false; if (patchOptions2 && patchOptions2.rt !== void 0) { returnTarget = patchOptions2.rt; } let proto = obj; while (proto && !proto.hasOwnProperty(ADD_EVENT_LISTENER)) { proto = ObjectGetPrototypeOf(proto); } if (!proto && obj[ADD_EVENT_LISTENER]) { proto = obj; } if (!proto) { return false; } if (proto[zoneSymbolAddEventListener]) { return false; } const eventNameToString = patchOptions2 && patchOptions2.eventNameToString; const taskData = {}; const nativeAddEventListener = proto[zoneSymbolAddEventListener] = proto[ADD_EVENT_LISTENER]; const nativeRemoveEventListener = proto[zoneSymbol(REMOVE_EVENT_LISTENER)] = proto[REMOVE_EVENT_LISTENER]; const nativeListeners = proto[zoneSymbol(LISTENERS_EVENT_LISTENER)] = proto[LISTENERS_EVENT_LISTENER]; const nativeRemoveAllListeners = proto[zoneSymbol(REMOVE_ALL_LISTENERS_EVENT_LISTENER)] = proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER]; let nativePrependEventListener; if (patchOptions2 && patchOptions2.prepend) { nativePrependEventListener = proto[zoneSymbol(patchOptions2.prepend)] = proto[patchOptions2.prepend]; } function buildEventListenerOptions(options, passive) { if (!passiveSupported && typeof options === "object" && options) { return !!options.capture; } if (!passiveSupported || !passive) { return options; } if (typeof options === "boolean") { return { capture: options, passive: true }; } if (!options) { return { passive: true }; } if (typeof options === "object" && options.passive !== false) { return { ...options, passive: true }; } return options; } const customScheduleGlobal = function(task) { if (taskData.isExisting) { return; } return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options); }; const customCancelGlobal = function(task) { if (!task.isRemoved) { const symbolEventNames = zoneSymbolEventNames[task.eventName]; let symbolEventName; if (symbolEventNames) { symbolEventName = symbolEventNames[task.capture ? TRUE_STR : FALSE_STR]; } const existingTasks = symbolEventName && task.target[symbolEventName]; if (existingTasks) { for (let i = 0; i < existingTasks.length; i++) { const existingTask = existingTasks[i]; if (existingTask === task) { existingTasks.splice(i, 1); task.isRemoved = true; if (task.removeAbortListener) { task.removeAbortListener(); task.removeAbortListener = null; } if (existingTasks.length === 0) { task.allRemoved = true; task.target[symbolEventName] = null; } break; } } } } if (!task.allRemoved) { return; } return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options); }; const customScheduleNonGlobal = function(task) { return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options); }; const customSchedulePrepend = function(task) { return nativePrependEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options); }; const customCancelNonGlobal = function(task) { return nativeRemoveEventListener.call(task.target, task.eventName, task.invoke, task.options); }; const customSchedule = useGlobalCallback ? customScheduleGlobal : customScheduleNonGlobal; const customCancel = useGlobalCallback ? customCancelGlobal : customCancelNonGlobal; const compareTaskCallbackVsDelegate = function(task, delegate) { const typeOfDelegate = typeof delegate; return typeOfDelegate === "function" && task.callback === delegate || typeOfDelegate === "object" && task.originalDelegate === delegate; }; const compare = patchOptions2 && patchOptions2.diff ? patchOptions2.diff : compareTaskCallbackVsDelegate; const unpatchedEvents = Zone[zoneSymbol("UNPATCHED_EVENTS")]; const passiveEvents = _global2[zoneSymbol("PASSIVE_EVENTS")]; function copyEventListenerOptions(options) { if (typeof options === "object" && options !== null) { const newOptions = { ...options }; if (options.signal) { newOptions.signal = options.signal; } return newOptions; } return options; } const makeAddListener = function(nativeListener, addSource, customScheduleFn, customCancelFn, returnTarget2 = false, prepend = false) { return function() { const target = this || _global2; let eventName = arguments[0]; if (patchOptions2 && patchOptions2.transferEventName) { eventName = patchOptions2.transferEventName(eventName); } let delegate = arguments[1]; if (!delegate) { return nativeListener.apply(this, arguments); } if (isNode && eventName === "uncaughtException") { return nativeListener.apply(this, arguments); } let isHandleEvent = false; if (typeof delegate !== "function") { if (!delegate.handleEvent) { return nativeListener.apply(this, arguments); } isHandleEvent = true; } if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) { return; } const passive = passiveSupported && !!passiveEvents && passiveEvents.indexOf(eventName) !== -1; const options = copyEventListenerOptions(buildEventListenerOptions(arguments[2], passive)); const signal = options?.signal; if (signal?.aborted) { return; } if (unpatchedEvents) { for (let i = 0; i < unpatchedEvents.length; i++) { if (eventName === unpatchedEvents[i]) { if (passive) { return nativeListener.call(target, eventName, delegate, options); } else { return nativeListener.apply(this, arguments); } } } } const capture = !options ? false : typeof options === "boolean" ? true : options.capture; const once = options && typeof options === "object" ? options.once : false; const zone = Zone.current; let symbolEventNames = zoneSymbolEventNames[eventName]; if (!symbolEventNames) { prepareEventNames(eventName, eventNameToString); symbolEventNames = zoneSymbolEventNames[eventName]; } const symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR]; let existingTasks = target[symbolEventName]; let isExisting = false; if (existingTasks) { isExisting = true; if (checkDuplicate) { for (let i = 0; i < existingTasks.length; i++) { if (compare(existingTasks[i], delegate)) { return; } } } } else { existingTasks = target[symbolEventName] = []; } let source; const constructorName = target.constructor["name"]; const targetSource = globalSources[constructorName]; if (targetSource) { source = targetSource[eventName]; } if (!source) { source = constructorName + addSource + (eventNameToString ? eventNameToString(eventName) : eventName); } taskData.options = options; if (once) { taskData.options.once = false; } taskData.target = target; taskData.capture = capture; taskData.eventName = eventName; taskData.isExisting = isExisting; const data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : void 0; if (data) { data.taskData = taskData; } if (signal) { taskData.options.signal = void 0; } const task = zone.scheduleEventTask(source, delegate, data, customScheduleFn, customCancelFn); if (signal) { taskData.options.signal = signal; const onAbort = () => task.zone.cancelTask(task); nativeListener.call(signal, "abort", onAbort, { once: true }); task.removeAbortListener = () => signal.removeEventListener("abort", onAbort); } taskData.target = null; if (data) { data.taskData = null; } if (once) { taskData.options.once = true; } if (!(!passiveSupported && typeof task.options === "boolean")) { task.options = options; } task.target = target; task.capture = capture; task.eventName = eventName; if (isHandleEvent) { task.originalDelegate = delegate; } if (!prepend) { existingTasks.push(task); } else { existingTasks.unshift(task); } if (returnTarget2) { return target; } }; }; proto[ADD_EVENT_LISTENER] = makeAddListener(nativeAddEventListener, ADD_EVENT_LISTENER_SOURCE, customSchedule, customCancel, returnTarget); if (nativePrependEventListener) { proto[PREPEND_EVENT_LISTENER] = makeAddListener(nativePrependEventListener, PREPEND_EVENT_LISTENER_SOURCE, customSchedulePrepend, customCancel, returnTarget, true); } proto[REMOVE_EVENT_LISTENER] = function() { const target = this || _global2; let eventName = arguments[0]; if (patchOptions2 && patchOptions2.transferEventName) { eventName = patchOptions2.transferEventName(eventName); } const options = arguments[2]; const capture = !options ? false : typeof options === "boolean" ? true : options.capture; const delegate = arguments[1]; if (!delegate) { return nativeRemoveEventListener.apply(this, arguments); } if (validateHandler && !validateHandler(nativeRemoveEventListener, delegate, target, arguments)) { return; } const symbolEventNames = zoneSymbolEventNames[eventName]; let symbolEventName; if (symbolEventNames) { symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR]; } const existingTasks = symbolEventName && target[symbolEventName]; if (existingTasks) { for (let i = 0; i < existingTasks.length; i++) { const existingTask = existingTasks[i]; if (compare(existingTask, delegate)) { existingTasks.splice(i, 1); existingTask.isRemoved = true; if (existingTasks.length === 0) { existingTask.allRemoved = true; target[symbolEventName] = null; if (!capture && typeof eventName === "string") { const onPropertySymbol = ZONE_SYMBOL_PREFIX + "ON_PROPERTY" + eventName; target[onPropertySymbol] = null; } } existingTask.zone.cancelTask(existingTask); if (returnTarget) { return target; } return; } } } return nativeRemoveEventListener.apply(this, arguments); }; proto[LISTENERS_EVENT_LISTENER] = function() { const target = this || _global2; let eventName = arguments[0]; if (patchOptions2 && patchOptions2.transferEventName) { eventName = patchOptions2.transferEventName(eventName); } const listeners = []; const tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName); for (let i = 0; i < tasks.length; i++) { const task = tasks[i]; let delegate = task.originalDelegate ? task.originalDelegate : task.callback; listeners.push(delegate); } return listeners; }; proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER] = function() { const target = this || _global2; let eventName = arguments[0]; if (!eventName) { const keys = Object.keys(target); for (let i = 0; i < keys.length; i++) { const prop = keys[i]; const match = EVENT_NAME_SYMBOL_REGX.exec(prop); let evtName = match && match[1]; if (evtName && evtName !== "removeListener") { this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, evtName); } } this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, "removeListener"); } else { if (patchOptions2 && patchOptions2.transferEventName) { eventName = patchOptions2.transferEventName(eventName); } const symbolEventNames = zoneSymbolEventNames[eventName]; if (symbolEventNames) { const symbolEventName = symbolEventNames[FALSE_STR]; const symbolCaptureEventName = symbolEventNames[TRUE_STR]; const tasks = target[symbolEventName]; const captureTasks = target[symbolCaptureEventName]; if (tasks) { const removeTasks = tasks.slice(); for (let i = 0; i < removeTasks.length; i++) { const task = removeTasks[i]; let delegate = task.originalDelegate ? task.originalDelegate : task.callback; this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options); } } if (captureTasks) { const removeTasks = captureTasks.slice(); for (let i = 0; i < removeTasks.length; i++) { const task = removeTasks[i]; let delegate = task.originalDelegate ? task.originalDelegate : task.callback; this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options); } } } } if (returnTarget) { return this; } }; attachOriginToPatched(proto[ADD_EVENT_LISTENER], nativeAddEventListener); attachOriginToPatched(proto[REMOVE_EVENT_LISTENER], nativeRemoveEventListener); if (nativeRemoveAllListeners) { attachOriginToPatched(proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER], nativeRemoveAllListeners); } if (nativeListeners) { attachOriginToPatched(proto[LISTENERS_EVENT_LISTENER], nativeListeners); } return true; } let results = []; for (let i = 0; i < apis.length; i++) { results[i] = patchEventTargetMethods(apis[i], patchOptions); } return results; } function findEventTasks(target, eventName) { if (!eventName) { const foundTasks = []; for (let prop in target) { const match = EVENT_NAME_SYMBOL_REGX.exec(prop); let evtName = match && match[1]; if (evtName && (!eventName || evtName === eventName)) { const tasks = target[prop]; if (tasks) { for (let i = 0; i < tasks.length; i++) { foundTasks.push(tasks[i]); } } } } return foundTasks; } let symbolEventName = zoneSymbolEventNames[eventName]; if (!symbolEventName) { prepareEventNames(eventName); symbolEventName = zoneSymbolEventNames[eventName]; } const captureFalseTasks = target[symbolEventName[FALSE_STR]]; const captureTrueTasks = target[symbolEventName[TRUE_STR]]; if (!captureFalseTasks) { return captureTrueTasks ? captureTrueTasks.slice() : []; } else { return captureTrueTasks ? captureFalseTasks.concat(captureTrueTasks) : captureFalseTasks.slice(); } } function patchEventPrototype(global2, api) { const Event = global2["Event"]; if (Event && Event.prototype) { api.patchMethod(Event.prototype, "stopImmediatePropagation", (delegate) => function(self2, args) { self2[IMMEDIATE_PROPAGATION_SYMBOL] = true; delegate && delegate.apply(self2, args); }); } } function patchQueueMicrotask(global2, api) { api.patchMethod(global2, "queueMicrotask", (delegate) => { return function(self2, args) { Zone.current.scheduleMicroTask("queueMicrotask", args[0]); }; }); } var taskSymbol = zoneSymbol("zoneTask"); function patchTimer(window2, setName, cancelName, nameSuffix) { let setNative = null; let clearNative = null; setName += nameSuffix; cancelName += nameSuffix; const tasksByHandleId = {}; function scheduleTask(task) { const data = task.data; data.args[0] = function() { return task.invoke.apply(this, arguments); }; const handleOrId = setNative.apply(window2, data.args); if (isNumber(handleOrId)) { data.handleId = handleOrId; } else { data.handle = handleOrId; data.isRefreshable = isFunction(handleOrId.refresh); } return task; } function clearTask(task) { const { handle, handleId } = task.data; return clearNative.call(window2, handle ?? handleId); } setNative = patchMethod(window2, setName, (delegate) => function(self2, args) { if (isFunction(args[0])) { const options = { isRefreshable: false, isPeriodic: nameSuffix === "Interval", delay: nameSuffix === "Timeout" || nameSuffix === "Interval" ? args[1] || 0 : void 0, args }; const callback = args[0]; args[0] = function timer() { try { return callback.apply(this, arguments); } finally { const { handle: handle2, handleId: handleId2, isPeriodic: isPeriodic2, isRefreshable: isRefreshable2 } = options; if (!isPeriodic2 && !isRefreshable2) { if (handleId2) { delete tasksByHandleId[handleId2]; } else if (handle2) { handle2[taskSymbol] = null; } } } }; const task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask); if (!task) { return task; } const { handleId, handle, isRefreshable, isPeriodic } = task.data; if (handleId) { tasksByHandleId[handleId] = task; } else if (handle) { handle[taskSymbol] = task; if (isRefreshable && !isPeriodic) { const originalRefresh = handle.refresh; handle.refresh = function() { const { zone, state } = task; if (state === "notScheduled") { task._state = "scheduled"; zone._updateTaskCount(task, 1); } else if (state === "running") { task._state = "scheduling"; } return originalRefresh.call(this); }; } } return handle ?? handleId ?? task; } else { return delegate.apply(window2, args); } }); clearNative = patchMethod(window2, cancelName, (delegate) => function(self2, args) { const id = args[0]; let task; if (isNumber(id)) { task = tasksByHandleId[id]; delete tasksByHandleId[id]; } else { task = id?.[taskSymbol]; if (task) { id[taskSymbol] = null; } else { task = id; } } if (task?.type) { if (task.cancelFn) { task.zone.cancelTask(task); } } else { delegate.apply(window2, args); } }); } function patchCustomElements(_global2, api) { const { isBrowser: isBrowser2, isMix: isMix2 } = api.getGlobalObjects(); if (!isBrowser2 && !isMix2 || !_global2["customElements"] || !("customElements" in _global2)) { return; } const callbacks = [ "connectedCallback", "disconnectedCallback", "adoptedCallback", "attributeChangedCallback", "formAssociatedCallback", "formDisabledCallback", "formResetCallback", "formStateRestoreCallback" ]; api.patchCallbacks(api, _global2.customElements, "customElements", "define", callbacks); } function eventTargetPatch(_global2, api) { if (Zone[api.symbol("patchEventTarget")]) { return; } const { eventNames, zoneSymbolEventNames: zoneSymbolEventNames2, TRUE_STR: TRUE_STR2, FALSE_STR: FALSE_STR2, ZONE_SYMBOL_PREFIX: ZONE_SYMBOL_PREFIX2 } = api.getGlobalObjects(); for (let i = 0; i < eventNames.length; i++) { const eventName = eventNames[i]; const falseEventName = eventName + FALSE_STR2; const trueEventName = eventName + TRUE_STR2; const symbol = ZONE_SYMBOL_PREFIX2 + falseEventName; const symbolCapture = ZONE_SYMBOL_PREFIX2 + trueEventName; zoneSymbolEventNames2[eventName] = {}; zoneSymbolEventNames2[eventName][FALSE_STR2] = symbol; zoneSymbolEventNames2[eventName][TRUE_STR2] = symbolCapture; } const EVENT_TARGET = _global2["EventTarget"]; if (!EVENT_TARGET || !EVENT_TARGET.prototype) { return; } api.patchEventTarget(_global2, api, [EVENT_TARGET && EVENT_TARGET.prototype]); return true; } function patchEvent(global2, api) { api.patchEventPrototype(global2, api); } function filterProperties(target, onProperties, ignoreProperties) { if (!ignoreProperties || ignoreProperties.length === 0) { return onProperties; } const tip = ignoreProperties.filter((ip) => ip.target === target); if (!tip || tip.length === 0) { return onProperties; } const targetIgnoreProperties = tip[0].ignoreProperties; return onProperties.filter((op) => targetIgnoreProperties.indexOf(op) === -1); } function patchFilteredProperties(target, onProperties, ignoreProperties, prototype) { if (!target) { return; } const filteredProperties = filterProperties(target, onProperties, ignoreProperties); patchOnProperties(target, filteredProperties, prototype); } function getOnEventNames(target) { return Object.getOwnPropertyNames(target).filter((name) => name.startsWith("on") && name.length > 2).map((name) => name.substring(2)); } function propertyDescriptorPatch(api, _global2) { if (isNode && !isMix) { return; } if (Zone[api.symbol("patchEvents")]) { return; } const ignoreProperties = _global2["__Zone_ignore_on_properties"]; let patchTargets = []; if (isBrowser) { const internalWindow2 = window; patchTargets = patchTargets.concat([ "Document", "SVGElement", "Element", "HTMLElement", "HTMLBodyElement", "HTMLMediaElement", "HTMLFrameSetElement", "HTMLFrameElement", "HTMLIFrameElement", "HTMLMarqueeElement", "Worker" ]); const ignoreErrorProperties = isIE() ? [{ target: internalWindow2, ignoreProperties: ["error"] }] : []; patchFilteredProperties(internalWindow2, getOnEventNames(internalWindow2), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow2)); } patchTargets = patchTargets.concat([ "XMLHttpRequest", "XMLHttpRequestEventTarget", "IDBIndex", "IDBRequest", "IDBOpenDBRequest", "IDBDatabase", "IDBTransaction", "IDBCursor", "WebSocket" ]); for (let i = 0; i < patchTargets.length; i++) { const target = _global2[patchTargets[i]]; target && target.prototype && patchFilteredProperties(target.prototype, getOnEventNames(target.prototype), ignoreProperties); } } function patchBrowser(Zone2) { Zone2.__load_patch("legacy", (global2) => { const legacyPatch = global2[Zone2.__symbol__("legacyPatch")]; if (legacyPatch) { legacyPatch(); } }); Zone2.__load_patch("timers", (global2) => { const set = "set"; const clear = "clear"; patchTimer(global2, set, clear, "Timeout"); patchTimer(global2, set, clear, "Interval"); patchTimer(global2, set, clear, "Immediate"); }); Zone2.__load_patch("requestAnimationFrame", (global2) => { patchTimer(global2, "request", "cancel", "AnimationFrame"); patchTimer(global2, "mozRequest", "mozCancel", "AnimationFrame"); patchTimer(global2, "webkitRequest", "webkitCancel", "AnimationFrame"); }); Zone2.__load_patch("blocking", (global2, Zone3) => { const blockingMethods = ["alert", "prompt", "confirm"]; for (let i = 0; i < blockingMethods.length; i++) { const name = blockingMethods[i]; patchMethod(global2, name, (delegate, symbol, name2) => { return function(s, args) { return Zone3.current.run(delegate, global2, args, name2); }; }); } }); Zone2.__load_patch("EventTarget", (global2, Zone3, api) => { patchEvent(global2, api); eventTargetPatch(global2, api); const XMLHttpRequestEventTarget = global2["XMLHttpRequestEventTarget"]; if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) { api.patchEventTarget(global2, api, [XMLHttpRequestEventTarget.prototype]); } }); Zone2.__load_patch("MutationObserver", (global2, Zone3, api) => { patchClass("MutationObserver"); patchClass("WebKitMutationObserver"); }); Zone2.__load_patch("IntersectionObserver", (global2, Zone3, api) => { patchClass("IntersectionObserver"); }); Zone2.__load_patch("FileReader", (global2, Zone3, api) => { patchClass("FileReader"); }); Zone2.__load_patch("on_property", (global2, Zone3, api) => { propertyDescriptorPatch(api, global2); }); Zone2.__load_patch("customElements", (global2, Zone3, api) => { patchCustomElements(global2, api); }); Zone2.__load_patch("XHR", (global2, Zone3) => { patchXHR(global2); const XHR_TASK = zoneSymbol("xhrTask"); const XHR_SYNC = zoneSymbol("xhrSync"); const XHR_LISTENER = zoneSymbol("xhrListener"); const XHR_SCHEDULED = zoneSymbol("xhrScheduled"); const XHR_URL = zoneSymbol("xhrURL"); const XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol("xhrErrorBeforeScheduled"); function patchXHR(window2) { const XMLHttpRequest = window2["XMLHttpRequest"]; if (!XMLHttpRequest) { return; } const XMLHttpRequestPrototype = XMLHttpRequest.prototype; function findPendingTask(target) { return target[XHR_TASK]; } let oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER]; let oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER]; if (!oriAddListener) { const XMLHttpRequestEventTarget = window2["XMLHttpRequestEventTarget"]; if (XMLHttpRequestEventTarget) { const XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget.prototype; oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER]; oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER]; } } const READY_STATE_CHANGE = "readystatechange"; const SCHEDULED = "scheduled"; function scheduleTask(task) { const data = task.data; const target = data.target; target[XHR_SCHEDULED] = false; target[XHR_ERROR_BEFORE_SCHEDULED] = false; const listener = target[XHR_LISTENER]; if (!oriAddListener) { oriAddListener = target[ZONE_SYMBOL_ADD_EVENT_LISTENER]; oriRemoveListener = target[ZONE_SYMBOL_REMOVE_EVENT_LISTENER]; } if (listener) { oriRemoveListener.call(target, READY_STATE_CHANGE, listener); } const newListener = target[XHR_LISTENER] = () => { if (target.readyState === target.DONE) { if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) { const loadTasks = target[Zone3.__symbol__("loadfalse")]; if (target.status !== 0 && loadTasks && loadTasks.length > 0) { const oriInvoke = task.invoke; task.invoke = function() { const loadTasks2 = target[Zone3.__symbol__("loadfalse")]; for (let i = 0; i < loadTasks2.length; i++) { if (loadTasks2[i] === task) { loadTasks2.splice(i, 1); } } if (!data.aborted && task.state === SCHEDULED) { oriInvoke.call(task); } }; loadTasks.push(task); } else { task.invoke(); } } else if (!data.aborted && target[XHR_SCHEDULED] === false) { target[XHR_ERROR_BEFORE_SCHEDULED] = true; } } }; oriAddListener.call(target, READY_STATE_CHANGE, newListener); const storedTask = target[XHR_TASK]; if (!storedTask) { target[XHR_TASK] = task; } sendNative.apply(target, data.args); target[XHR_SCHEDULED] = true; return task; } function placeholderCallback() { } function clearTask(task) { const data = task.data; data.aborted = true; return abortNative.apply(data.target, data.args); } const openNative = patchMethod(XMLHttpRequestPrototype, "open", () => function(self2, args) { self2[XHR_SYNC] = args[2] == false; self2[XHR_URL] = args[1]; return openNative.apply(self2, args); }); const XMLHTTPREQUEST_SOURCE = "XMLHttpRequest.send"; const fetchTaskAborting = zoneSymbol("fetchTaskAborting"); const fetchTaskScheduling = zoneSymbol("fetchTaskScheduling"); const sendNative = patchMethod(XMLHttpRequestPrototype, "send", () => function(self2, args) { if (Zone3.current[fetchTaskScheduling] === true) { return sendNative.apply(self2, args); } if (self2[XHR_SYNC]) { return sendNative.apply(self2, args); } else { const options = { target: self2, url: self2[XHR_URL], isPeriodic: false, args, aborted: false }; const task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask); if (self2 && self2[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted && task.state === SCHEDULED) { task.invoke(); } } }); const abortNative = patchMethod(XMLHttpRequestPrototype, "abort", () => function(self2, args) { const task = findPendingTask(self2); if (task && typeof task.type == "string") { if (task.cancelFn == null || task.data && task.data.aborted) { return; } task.zone.cancelTask(task); } else if (Zone3.current[fetchTaskAborting] === true) { return abortNative.apply(self2, args); } }); } }); Zone2.__load_patch("geolocation", (global2) => { if (global2["navigator"] && global2["navigator"].geolocation) { patchPrototype(global2["navigator"].geolocation, ["getCurrentPosition", "watchPosition"]); } }); Zone2.__load_patch("PromiseRejectionEvent", (global2, Zone3) => { function findPromiseRejectionHandler(evtName) { return function(e) { const eventTasks = findEventTasks(global2, evtName); eventTasks.forEach((eventTask) => { const PromiseRejectionEvent = global2["PromiseRejectionEvent"]; if (PromiseRejectionEvent) { const evt = new PromiseRejectionEvent(evtName, { promise: e.promise, reason: e.rejection }); eventTask.invoke(evt); } }); }; } if (global2["PromiseRejectionEvent"]) { Zone3[zoneSymbol("unhandledPromiseRejectionHandler")] = findPromiseRejectionHandler("unhandledrejection"); Zone3[zoneSymbol("rejectionHandledHandler")] = findPromiseRejectionHandler("rejectionhandled"); } }); Zone2.__load_patch("queueMicrotask", (global2, Zone3, api) => { patchQueueMicrotask(global2, api); }); } function patchPromise(Zone2) { Zone2.__load_patch("ZoneAwarePromise", (global2, Zone3, api) => { const ObjectGetOwnPropertyDescriptor2 = Object.getOwnPropertyDescriptor; const ObjectDefineProperty2 = Object.defineProperty; function readableObjectToString(obj) { if (obj && obj.toString === Object.prototype.toString) { const className = obj.constructor && obj.constructor.name; return (className ? className : "") + ": " + JSON.stringify(obj); } return obj ? obj.toString() : Object.prototype.toString.call(obj); } const __symbol__2 = api.symbol; const _uncaughtPromiseErrors = []; const isDisableWrappingUncaughtPromiseRejection = global2[__symbol__2("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")] !== false; const symbolPromise = __symbol__2("Promise"); const symbolThen = __symbol__2("then"); const creationTrace = "__creationTrace__"; api.onUnhandledError = (e) => { if (api.showUncaughtError()) { const rejection = e && e.rejection; if (rejection) { console.error("Unhandled Promise rejection:", rejection instanceof Error ? rejection.message : rejection, "; Zone:", e.zone.name, "; Task:", e.task && e.task.source, "; Value:", rejection, rejection instanceof Error ? rejection.stack : void 0); } else { console.error(e); } } }; api.microtaskDrainDone = () => { while (_uncaughtPromiseErrors.length) { const uncaughtPromiseError = _uncaughtPromiseErrors.shift(); try { uncaughtPromiseError.zone.runGuarded(() => { if (uncaughtPromiseError.throwOriginal) { throw uncaughtPromiseError.rejection; } throw uncaughtPromiseError; }); } catch (error) { handleUnhandledRejection(error); } } }; const UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__2("unhandledPromiseRejectionHandler"); function handleUnhandledRejection(e) { api.onUnhandledError(e); try { const handler = Zone3[UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL]; if (typeof handler === "function") { handler.call(this, e); } } catch (err) { } } function isThenable(value) { return value && value.then; } function forwardResolution(value) { return value; } function forwardRejection(rejection) { return ZoneAwarePromise.reject(rejection); } const symbolState = __symbol__2("state"); const symbolValue = __symbol__2("value"); const symbolFinally = __symbol__2("finally"); const symbolParentPromiseValue = __symbol__2("parentPromiseValue"); const symbolParentPromiseState = __symbol__2("parentPromiseState"); const source = "Promise.then"; const UNRESOLVED = null; const RESOLVED = true; const REJECTED = false; const REJECTED_NO_CATCH = 0; function makeResolver(promise, state) { return (v) => { try { resolvePromise(promise, state, v); } catch (err) { resolvePromise(promise, false, err); } }; } const once = function() { let wasCalled = false; return function wrapper(wrappedFunction) { return function() { if (wasCalled) { return; } wasCalled = true; wrappedFunction.apply(null, arguments); }; }; }; const TYPE_ERROR = "Promise resolved with itself"; const CURRENT_TASK_TRACE_SYMBOL = __symbol__2("currentTaskTrace"); function resolvePromise(promise, state, value) { const onceWrapper = once(); if (promise === value) { throw new TypeError(TYPE_ERROR); } if (promise[symbolState] === UNRESOLVED) { let then = null; try { if (typeof value === "object" || typeof value === "function") { then = value && value.then; } } catch (err) { onceWrapper(() => { resolvePromise(promise, false, err); })(); return promise; } if (state !== REJECTED && value instanceof ZoneAwarePromise && value.hasOwnProperty(symbolState) && value.hasOwnProperty(symbolValue) && value[symbolState] !== UNRESOLVED) { clearRejectedNoCatch(value); resolvePromise(promise, value[symbolState], value[symbolValue]); } else if (state !== REJECTED && typeof then === "function") { try { then.call(value, onceWrapper(makeResolver(promise, state)), onceWrapper(makeResolver(promise, false))); } catch (err) { onceWrapper(() => { resolvePromise(promise, false, err); })(); } } else { promise[symbolState] = state; const queue = promise[symbolValue]; promise[symbolValue] = value; if (promise[symbolFinally] === symbolFinally) { if (state === RESOLVED) { promise[symbolState] = promise[symbolParentPromiseState]; promise[symbolValue] = promise[symbolParentPromiseValue]; } } if (state === REJECTED && value instanceof Error) { const trace = Zone3.currentTask && Zone3.currentTask.data && Zone3.currentTask.data[creationTrace]; if (trace) { ObjectDefineProperty2(value, CURRENT_TASK_TRACE_SYMBOL, { configurable: true, enumerable: false, writable: true, value: trace }); } } for (let i = 0; i < queue.length; ) { scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]); } if (queue.length == 0 && state == REJECTED) { promise[symbolState] = REJECTED_NO_CATCH; let uncaughtPromiseError = value; try { throw new Error("Uncaught (in promise): " + readableObjectToString(value) + (value && value.stack ? "\n" + value.stack : "")); } catch (err) { uncaughtPromiseError = err; } if (isDisableWrappingUncaughtPromiseRejection) { uncaughtPromiseError.throwOriginal = true; } uncaughtPromiseError.rejection = value; uncaughtPromiseError.promise = promise; uncaughtPromiseError.zone = Zone3.current; uncaughtPromiseError.task = Zone3.currentTask; _uncaughtPromiseErrors.push(uncaughtPromiseError); api.scheduleMicroTask(); } } } return promise; } const REJECTION_HANDLED_HANDLER = __symbol__2("rejectionHandledHandler"); function clearRejectedNoCatch(promise) { if (promise[symbolState] === REJECTED_NO_CATCH) { try { const handler = Zone3[REJECTION_HANDLED_HANDLER]; if (handler && typeof handler === "function") { handler.call(this, { rejection: promise[symbolValue], promise }); } } catch (err) { } promise[symbolState] = REJECTED; for (let i = 0; i < _uncaughtPromiseErrors.length; i++) { if (promise === _uncaughtPromiseErrors[i].promise) { _uncaughtPromiseErrors.splice(i, 1); } } } } function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) { clearRejectedNoCatch(promise); const promiseState = promise[symbolState]; const delegate = promiseState ? typeof onFulfilled === "function" ? onFulfilled : forwardResolution : typeof onRejected === "function" ? onRejected : forwardRejection; zone.scheduleMicroTask(source, () => { try { const parentPromiseValue = promise[symbolValue]; const isFinallyPromise = !!chainPromise && symbolFinally === chainPromise[symbolFinally]; if (isFinallyPromise) { chainPromise[symbolParentPromiseValue] = parentPromiseValue; chainPromise[symbolParentPromiseState] = promiseState; } const value = zone.run(delegate, void 0, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ? [] : [parentPromiseValue]); resolvePromise(chainPromise, true, value); } catch (error) { resolvePromise(chainPromise, false, error); } }, chainPromise); } const ZONE_AWARE_PROMISE_TO_STRING = "function ZoneAwarePromise() { [native code] }"; const noop = function() { }; const AggregateError = global2.AggregateError; class ZoneAwarePromise { static toString() { return ZONE_AWARE_PROMISE_TO_STRING; } static resolve(value) { if (value instanceof ZoneAwarePromise) { return value; } return resolvePromise(new this(null), RESOLVED, value); } static reject(error) { return resolvePromise(new this(null), REJECTED, error); } static withResolvers() { const result = {}; result.promise = new ZoneAwarePromise((res, rej) => { result.resolve = res; result.reject = rej; }); return result; } static any(values) { if (!values || typeof values[Symbol.iterator] !== "function") { return Promise.reject(new AggregateError([], "All promises were rejected")); } const promises = []; let count = 0; try { for (let v of values) { count++; promises.push(ZoneAwarePromise.resolve(v)); } } catch (err) { return Promise.reject(new AggregateError([], "All promises were rejected")); } if (count === 0) { return Promise.reject(new AggregateError([], "All promises were rejected")); } let finished = false; const errors = []; return new ZoneAwarePromise((resolve, reject) => { for (let i = 0; i < promises.length; i++) { promises[i].then((v) => { if (finished) { return; } finished = true; resolve(v); }, (err) => { errors.push(err); count--; if (count === 0) { finished = true; reject(new AggregateError(errors, "All promises were rejected")); } }); } }); } static race(values) { let resolve; let reject; let promise = new this((res, rej) => { resolve = res; reject = rej; }); function onResolve(value) { resolve(value); } function onReject(error) { reject(error); } for (let value of values) { if (!isThenable(value)) { value = this.resolve(value); } value.then(onResolve, onReject); } return promise; } static all(values) { return ZoneAwarePromise.allWithCallback(values); } static allSettled(values) { const P = this && this.prototype instanceof ZoneAwarePromise ? this : ZoneAwarePromise; return P.allWithCallback(values, { thenCallback: (value) => ({ status: "fulfilled", value }), errorCallback: (err) => ({ status: "rejected", reason: err }) }); } static allWithCallback(values, callback) { let resolve; let reject; let promise = new this((res, rej) => { resolve = res; reject = rej; }); let unresolvedCount = 2; let valueIndex = 0; const resolvedValues = []; for (let value of values) { if (!isThenable(value)) { value = this.resolve(value); } const curValueIndex = valueIndex; try { value.then((value2) => { resolvedValues[curValueIndex] = callback ? callback.thenCallback(value2) : value2; unresolvedCount--; if (unresolvedCount === 0) { resolve(resolvedValues); } }, (err) => { if (!callback) { reject(err); } else { resolvedValues[curValueIndex] = callback.errorCallback(err); unresolvedCount--; if (unresolvedCount === 0) { resolve(resolvedValues); } } }); } catch (thenErr) { reject(thenErr); } unresolvedCount++; valueIndex++; } unresolvedCount -= 2; if (unresolvedCount === 0) { resolve(resolvedValues); } return promise; } constructor(executor) { const promise = this; if (!(promise instanceof ZoneAwarePromise)) { throw new Error("Must be an instanceof Promise."); } promise[symbolState] = UNRESOLVED; promise[symbolValue] = []; try { const onceWrapper = once(); executor && executor(onceWrapper(makeResolver(promise, RESOLVED)), onceWrapper(makeResolver(promise, REJECTED))); } catch (error) { resolvePromise(promise, false, error); } } get [Symbol.toStringTag]() { return "Promise"; } get [Symbol.species]() { return ZoneAwarePromise; } then(onFulfilled, onRejected) { let C = this.constructor?.[Symbol.species]; if (!C || typeof C !== "function") { C = this.constructor || ZoneAwarePromise; } const chainPromise = new C(noop); const zone = Zone3.current; if (this[symbolState] == UNRESOLVED) { this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected); } else { scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected); } return chainPromise; } catch(onRejected) { return this.then(null, onRejected); } finally(onFinally) { let C = this.constructor?.[Symbol.species]; if (!C || typeof C !== "function") { C = ZoneAwarePromise; } const chainPromise = new C(noop); chainPromise[symbolFinally] = symbolFinally; const zone = Zone3.current; if (this[symbolState] == UNRESOLVED) { this[symbolValue].push(zone, chainPromise, onFinally, onFinally); } else { scheduleResolveOrReject(this, zone, chainPromise, onFinally, onFinally); } return chainPromise; } } ZoneAwarePromise["resolve"] = ZoneAwarePromise.resolve; ZoneAwarePromise["reject"] = ZoneAwarePromise.reject; ZoneAwarePromise["race"] = ZoneAwarePromise.race; ZoneAwarePromise["all"] = ZoneAwarePromise.all; const NativePromise = global2[symbolPromise] = global2["Promise"]; global2["Promise"] = ZoneAwarePromise; const symbolThenPatched = __symbol__2("thenPatched"); function patchThen(Ctor) { const proto = Ctor.prototype; const prop = ObjectGetOwnPropertyDescriptor2(proto, "then"); if (prop && (prop.writable === false || !prop.configurable)) { return; } const originalThen = proto.then; proto[symbolThen] = originalThen; Ctor.prototype.then = function(onResolve, onReject) { const wrapped = new ZoneAwarePromise((resolve, reject) => { originalThen.call(this, resolve, reject); }); return wrapped.then(onResolve, onReject); }; Ctor[symbolThenPatched] = true; } api.patchThen = patchThen; function zoneify(fn) { return function(self2, args) { let resultPromise = fn.apply(self2, args); if (resultPromise instanceof ZoneAwarePromise) { return resultPromise; } let ctor = resultPromise.constructor; if (!ctor[symbolThenPatched]) { patchThen(ctor); } return resultPromise; }; } if (NativePromise) { patchThen(NativePromise); patchMethod(global2, "fetch", (delegate) => zoneify(delegate)); } Promise[Zone3.__symbol__("uncaughtPromiseErrors")] = _uncaughtPromiseErrors; return ZoneAwarePromise; }); } function patchToString(Zone2) { Zone2.__load_patch("toString", (global2) => { const originalFunctionToString = Function.prototype.toString; const ORIGINAL_DELEGATE_SYMBOL = zoneSymbol("OriginalDelegate"); const PROMISE_SYMBOL = zoneSymbol("Promise"); const ERROR_SYMBOL = zoneSymbol("Error"); const newFunctionToString = function toString() { if (typeof this === "function") { const originalDelegate = this[ORIGINAL_DELEGATE_SYMBOL]; if (originalDelegate) { if (typeof originalDelegate === "function") { return originalFunctionToString.call(originalDelegate); } else { return Object.prototype.toString.call(originalDelegate); } } if (this === Promise) { const nativePromise = global2[PROMISE_SYMBOL]; if (nativePromise) { return originalFunctionToString.call(nativePromise); } } if (this === Error) { const nativeError = global2[ERROR_SYMBOL]; if (nativeError) { return originalFunctionToString.call(nativeError); } } } return originalFunctionToString.call(this); }; newFunctionToString[ORIGINAL_DELEGATE_SYMBOL] = originalFunctionToString; Function.prototype.toString = newFunctionToString; const originalObjectToString = Object.prototype.toString; const PROMISE_OBJECT_TO_STRING = "[object Promise]"; Object.prototype.toString = function() { if (typeof Promise === "function" && this instanceof Promise) { return PROMISE_OBJECT_TO_STRING; } return originalObjectToString.call(this); }; }); } function patchCallbacks(api, target, targetName, method, callbacks) { const symbol = Zone.__symbol__(method); if (target[symbol]) { return; } const nativeDelegate = target[symbol] = target[method]; target[method] = function(name, opts, options) { if (opts && opts.prototype) { callbacks.forEach(function(callback) { const source = `${targetName}.${method}::` + callback; const prototype = opts.prototype; try { if (prototype.hasOwnProperty(callback)) { const descriptor = api.ObjectGetOwnPropertyDescriptor(prototype, callback); if (descriptor && descriptor.value) { descriptor.value = api.wrapWithCurrentZone(descriptor.value, source); api._redefineProperty(opts.prototype, callback, descriptor); } else if (prototype[callback]) { prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source); } } else if (prototype[callback]) { prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source); } } catch { } }); } return nativeDelegate.call(target, name, opts, options); }; api.attachOriginToPatched(target[method], nativeDelegate); } function patchUtil(Zone2) { Zone2.__load_patch("util", (global2, Zone3, api) => { const eventNames = getOnEventNames(global2); api.patchOnProperties = patchOnProperties; api.patchMethod = patchMethod; api.bindArguments = bindArguments; api.patchMacroTask = patchMacroTask; const SYMBOL_BLACK_LISTED_EVENTS = Zone3.__symbol__("BLACK_LISTED_EVENTS"); const SYMBOL_UNPATCHED_EVENTS = Zone3.__symbol__("UNPATCHED_EVENTS"); if (global2[SYMBOL_UNPATCHED_EVENTS]) { global2[SYMBOL_BLACK_LISTED_EVENTS] = global2[SYMBOL_UNPATCHED_EVENTS]; } if (global2[SYMBOL_BLACK_LISTED_EVENTS]) { Zone3[SYMBOL_BLACK_LISTED_EVENTS] = Zone3[SYMBOL_UNPATCHED_EVENTS] = global2[SYMBOL_BLACK_LISTED_EVENTS]; } api.patchEventPrototype = patchEventPrototype; api.patchEventTarget = patchEventTarget; api.isIEOrEdge = isIEOrEdge; api.ObjectDefineProperty = ObjectDefineProperty; api.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor; api.ObjectCreate = ObjectCreate; api.ArraySlice = ArraySlice; api.patchClass = patchClass; api.wrapWithCurrentZone = wrapWithCurrentZone; api.filterProperties = filterProperties; api.attachOriginToPatched = attachOriginToPatched; api._redefineProperty = Object.defineProperty; api.patchCallbacks = patchCallbacks; api.getGlobalObjects = () => ({ globalSources, zoneSymbolEventNames, eventNames, isBrowser, isMix, isNode, TRUE_STR, FALSE_STR, ZONE_SYMBOL_PREFIX, ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR }); }); } function patchCommon(Zone2) { patchPromise(Zone2); patchToString(Zone2); patchUtil(Zone2); } var Zone$1 = loadZone(); patchCommon(Zone$1); patchBrowser(Zone$1); var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b ||= {}) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; // node_modules/@angular/core/fesm2022/primitives/signals.mjs function defaultEquals(a, b) { return Object.is(a, b); } var activeConsumer = null; var inNotificationPhase = false; var epoch = 1; var SIGNAL = /* @__PURE__ */ Symbol("SIGNAL"); function setActiveConsumer(consumer) { const prev = activeConsumer; activeConsumer = consumer; return prev; } function getActiveConsumer() { return activeConsumer; } var REACTIVE_NODE = { version: 0, lastCleanEpoch: 0, dirty: false, producerNode: void 0, producerLastReadVersion: void 0, producerIndexOfThis: void 0, nextProducerIndex: 0, liveConsumerNode: void 0, liveConsumerIndexOfThis: void 0, consumerAllowSignalWrites: false, consumerIsAlwaysLive: false, producerMustRecompute: () => false, producerRecomputeValue: () => { }, consumerMarkedDirty: () => { }, consumerOnSignalRead: () => { } }; function producerAccessed(node) { if (inNotificationPhase) { throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : ""); } if (activeConsumer === null) { return; } activeConsumer.consumerOnSignalRead(node); const idx = activeConsumer.nextProducerIndex++; assertConsumerNode(activeConsumer); if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) { if (consumerIsLive(activeConsumer)) { const staleProducer = activeConsumer.producerNode[idx]; producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]); } } if (activeConsumer.producerNode[idx] !== node) { activeConsumer.producerNode[idx] = node; activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0; } activeConsumer.producerLastReadVersion[idx] = node.version; } function producerIncrementEpoch() { epoch++; } function producerUpdateValueVersion(node) { if (consumerIsLive(node) && !node.dirty) { return; } if (!node.dirty && node.lastCleanEpoch === epoch) { return; } if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) { node.dirty = false; node.lastCleanEpoch = epoch; return; } node.producerRecomputeValue(node); node.dirty = false; node.lastCleanEpoch = epoch; } function producerNotifyConsumers(node) { if (node.liveConsumerNode === void 0) { return; } const prev = inNotificationPhase; inNotificationPhase = true; try { for (const consumer of node.liveConsumerNode) { if (!consumer.dirty) { consumerMarkDirty(consumer); } } } finally { inNotificationPhase = prev; } } function producerUpdatesAllowed() { return activeConsumer?.consumerAllowSignalWrites !== false; } function consumerMarkDirty(node) { node.dirty = true; producerNotifyConsumers(node); node.consumerMarkedDirty?.(node); } function consumerBeforeComputation(node) { node && (node.nextProducerIndex = 0); return setActiveConsumer(node); } function consumerAfterComputation(node, prevConsumer) { setActiveConsumer(prevConsumer); if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) { return; } if (consumerIsLive(node)) { for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) { producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]); } } while (node.producerNode.length > node.nextProducerIndex) { node.producerNode.pop(); node.producerLastReadVersion.pop(); node.producerIndexOfThis.pop(); } } function consumerPollProducersForChange(node) { assertConsumerNode(node); for (let i = 0; i < node.producerNode.length; i++) { const producer = node.producerNode[i]; const seenVersion = node.producerLastReadVersion[i]; if (seenVersion !== producer.version) { return true; } producerUpdateValueVersion(producer); if (seenVersion !== producer.version) { return true; } } return false; } function consumerDestroy(node) { assertConsumerNode(node); if (consumerIsLive(node)) { for (let i = 0; i < node.producerNode.length; i++) { producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]); } } node.producerNode.length = node.producerLastReadVersion.length = node.producerIndexOfThis.length = 0; if (node.liveConsumerNode) { node.liveConsumerNode.length = node.liveConsumerIndexOfThis.length = 0; } } function producerAddLiveConsumer(node, consumer, indexOfThis) { assertProducerNode(node); if (node.liveConsumerNode.length === 0 && isConsumerNode(node)) { for (let i = 0; i < node.producerNode.length; i++) { node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i); } } node.liveConsumerIndexOfThis.push(indexOfThis); return node.liveConsumerNode.push(consumer) - 1; } function producerRemoveLiveConsumerAtIndex(node, idx) { assertProducerNode(node); if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) { throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`); } if (node.liveConsumerNode.length === 1 && isConsumerNode(node)) { for (let i = 0; i < node.producerNode.length; i++) { producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]); } } const lastIdx = node.liveConsumerNode.length - 1; node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx]; node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx]; node.liveConsumerNode.length--; node.liveConsumerIndexOfThis.length--; if (idx < node.liveConsumerNode.length) { const idxProducer = node.liveConsumerIndexOfThis[idx]; const consumer = node.liveConsumerNode[idx]; assertConsumerNode(consumer); consumer.producerIndexOfThis[idxProducer] = idx; } } function consumerIsLive(node) { return node.consumerIsAlwaysLive || (node?.liveConsumerNode?.length ?? 0) > 0; } function assertConsumerNode(node) { node.producerNode ??= []; node.producerIndexOfThis ??= []; node.producerLastReadVersion ??= []; } function assertProducerNode(node) { node.liveConsumerNode ??= []; node.liveConsumerIndexOfThis ??= []; } function isConsumerNode(node) { return node.producerNode !== void 0; } function createComputed(computation) { const node = Object.create(COMPUTED_NODE); node.computation = computation; const computed2 = () => { producerUpdateValueVersion(node); producerAccessed(node); if (node.value === ERRORED) { throw node.error; } return node.value; }; computed2[SIGNAL] = node; return computed2; } var UNSET = /* @__PURE__ */ Symbol("UNSET"); var COMPUTING = /* @__PURE__ */ Symbol("COMPUTING"); var ERRORED = /* @__PURE__ */ Symbol("ERRORED"); var COMPUTED_NODE = /* @__PURE__ */ (() => { return __spreadProps(__spreadValues({}, REACTIVE_NODE), { value: UNSET, dirty: true, error: null, equal: defaultEquals, producerMustRecompute(node) { return node.value === UNSET || node.value === COMPUTING; }, producerRecomputeValue(node) { if (node.value === COMPUTING) { throw new Error("Detected cycle in computations."); } const oldValue = node.value; node.value = COMPUTING; const prevConsumer = consumerBeforeComputation(node); let newValue; try { newValue = node.computation(); } catch (err) { newValue = ERRORED; node.error = err; } finally { consumerAfterComputation(node, prevConsumer); } if (oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED && node.equal(oldValue, newValue)) { node.value = oldValue; return; } node.value = newValue; node.version++; } }); })(); function defaultThrowError() { throw new Error(); } var throwInvalidWriteToSignalErrorFn = defaultThrowError; function throwInvalidWriteToSignalError() { throwInvalidWriteToSignalErrorFn(); } function setThrowInvalidWriteToSignalError(fn) { throwInvalidWriteToSignalErrorFn = fn; } var postSignalSetFn = null; function createSignal(initialValue) { const node = Object.create(SIGNAL_NODE); node.value = initialValue; const getter = () => { producerAccessed(node); return node.value; }; getter[SIGNAL] = node; return getter; } function signalSetFn(node, newValue) { if (!producerUpdatesAllowed()) { throwInvalidWriteToSignalError(); } if (!node.equal(node.value, newValue)) { node.value = newValue; signalValueChanged(node); } } function signalUpdateFn(node, updater) { if (!producerUpdatesAllowed()) { throwInvalidWriteToSignalError(); } signalSetFn(node, updater(node.value)); } var SIGNAL_NODE = /* @__PURE__ */ (() => { return __spreadProps(__spreadValues({}, REACTIVE_NODE), { equal: defaultEquals, value: void 0 }); })(); function signalValueChanged(node) { node.version++; producerIncrementEpoch(); producerNotifyConsumers(node); postSignalSetFn?.(); } // node_modules/rxjs/dist/esm/internal/util/isFunction.js function isFunction(value) { return typeof value === "function"; } // node_modules/rxjs/dist/esm/internal/util/createErrorClass.js function createErrorClass(createImpl) { const _super = (instance) => { Error.call(instance); instance.stack = new Error().stack; }; const ctorFunc = createImpl(_super); ctorFunc.prototype = Object.create(Error.prototype); ctorFunc.prototype.constructor = ctorFunc; return ctorFunc; } // node_modules/rxjs/dist/esm/internal/util/UnsubscriptionError.js var UnsubscriptionError = createErrorClass((_super) => function UnsubscriptionErrorImpl(errors) { _super(this); this.message = errors ? `${errors.length} errors occurred during unsubscription: ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join("\n ")}` : ""; this.name = "UnsubscriptionError"; this.errors = errors; }); // node_modules/rxjs/dist/esm/internal/util/arrRemove.js function arrRemove(arr, item) { if (arr) { const index = arr.indexOf(item); 0 <= index && arr.splice(index, 1); } } // node_modules/rxjs/dist/esm/internal/Subscription.js var Subscription = class _Subscription { constructor(initialTeardown) { this.initialTeardown = initialTeardown; this.closed = false; this._parentage = null; this._finalizers = null; } unsubscribe() { let errors; if (!this.closed) { this.closed = true; const { _parentage } = this; if (_parentage) { this._parentage = null; if (Array.isArray(_parentage)) { for (const parent of _parentage) { parent.remove(this); } } else { _parentage.remove(this); } } const { initialTeardown: initialFinalizer } = this; if (isFunction(initialFinalizer)) { try { initialFinalizer(); } catch (e) { errors = e instanceof UnsubscriptionError ? e.errors : [e]; } } const { _finalizers } = this; if (_finalizers) { this._finalizers = null; for (const finalizer of _finalizers) { try { execFinalizer(finalizer); } catch (err) { errors = errors !== null && errors !== void 0 ? errors : []; if (err instanceof UnsubscriptionError) { errors = [...errors, ...err.errors]; } else { errors.push(err); } } } } if (errors) { throw new UnsubscriptionError(errors); } } } add(teardown) { var _a; if (teardown && teardown !== this) { if (this.closed) { execFinalizer(teardown); } else { if (teardown instanceof _Subscription) { if (teardown.closed || teardown._hasParent(this)) { return; } teardown._addParent(this); } (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown); } } } _hasParent(parent) { const { _parentage } = this; return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent); } _addParent(parent) { const { _parentage } = this; this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent; } _removeParent(parent) { const { _parentage } = this; if (_parentage === parent) { this._parentage = null; } else if (Array.isArray(_parentage)) { arrRemove(_parentage, parent); } } remove(teardown) { const { _finalizers } = this; _finalizers && arrRemove(_finalizers, teardown); if (teardown instanceof _Subscription) { teardown._removeParent(this); } } }; Subscription.EMPTY = (() => { const empty = new Subscription(); empty.closed = true; return empty; })(); var EMPTY_SUBSCRIPTION = Subscription.EMPTY; function isSubscription(value) { return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe); } function execFinalizer(finalizer) { if (isFunction(finalizer)) { finalizer(); } else { finalizer.unsubscribe(); } } // node_modules/rxjs/dist/esm/internal/config.js var config = { onUnhandledError: null, onStoppedNotification: null, Promise: void 0, useDeprecatedSynchronousErrorHandling: false, useDeprecatedNextContext: false }; // node_modules/rxjs/dist/esm/internal/scheduler/timeoutProvider.js var timeoutProvider = { setTimeout(handler, timeout, ...args) { const { delegate } = timeoutProvider; if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) { return delegate.setTimeout(handler, timeout, ...args); } return setTimeout(handler, timeout, ...args); }, clearTimeout(handle) { const { delegate } = timeoutProvider; return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle); }, delegate: void 0 }; // node_modules/rxjs/dist/esm/internal/util/reportUnhandledError.js function reportUnhandledError(err) { timeoutProvider.setTimeout(() => { const { onUnhandledError } = config; if (onUnhandledError) { onUnhandledError(err); } else { throw err; } }); } // node_modules/rxjs/dist/esm/internal/util/noop.js function noop() { } // node_modules/rxjs/dist/esm/internal/NotificationFactories.js var COMPLETE_NOTIFICATION = (() => createNotification("C", void 0, void 0))(); function errorNotification(error) { return createNotification("E", void 0, error); } function nextNotification(value) { return createNotification("N", value, void 0); } function createNotification(kind, value, error) { return { kind, value, error }; } // node_modules/rxjs/dist/esm/internal/util/errorContext.js var context = null; function errorContext(cb) { if (config.useDeprecatedSynchronousErrorHandling) { const isRoot = !context; if (isRoot) { context = { errorThrown: false, error: null }; } cb(); if (isRoot) { const { errorThrown, error } = context; context = null; if (errorThrown) { throw error; } } } else { cb(); } } function captureError(err) { if (config.useDeprecatedSynchronousErrorHandling && context) { context.errorThrown = true; context.error = err; } } // node_modules/rxjs/dist/esm/internal/Subscriber.js var Subscriber = class extends Subscription { constructor(destination) { super(); this.isStopped = false; if (destination) { this.destination = destination; if (isSubscription(destination)) { destination.add(this); } } else { this.destination = EMPTY_OBSERVER; } } static create(next, error, complete) { return new SafeSubscriber(next, error, complete); } next(value) { if (this.isStopped) { handleStoppedNotification(nextNotification(value), this); } else { this._next(value); } } error(err) { if (this.isStopped) { handleStoppedNotification(errorNotification(err), this); } else { this.isStopped = true; this._error(err); } } complete() { if (this.isStopped) { handleStoppedNotification(COMPLETE_NOTIFICATION, this); } else { this.isStopped = true; this._complete(); } } unsubscribe() { if (!this.closed) { this.isStopped = true; super.unsubscribe(); this.destination = null; } } _next(value) { this.destination.next(value); } _error(err) { try { this.destination.error(err); } finally { this.unsubscribe(); } } _complete() { try { this.destination.complete(); } finally { this.unsubscribe(); } } }; var _bind = Function.prototype.bind; function bind(fn, thisArg) { return _bind.call(fn, thisArg); } var ConsumerObserver = class { constructor(partialObserver) { this.partialObserver = partialObserver; } next(value) { const { partialObserver } = this; if (partialObserver.next) { try { partialObserver.next(value); } catch (error) { handleUnhandledError(error); } } } error(err) { const { partialObserver } = this; if (partialObserver.error) { try { partialObserver.error(err); } catch (error) { handleUnhandledError(error); } } else { handleUnhandledError(err); } } complete() { const { partialObserver } = this; if (partialObserver.complete) { try { partialObserver.complete(); } catch (error) { handleUnhandledError(error); } } } }; var SafeSubscriber = class extends Subscriber { constructor(observerOrNext, error, complete) { super(); let partialObserver; if (isFunction(observerOrNext) || !observerOrNext) { partialObserver = { next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0, error: error !== null && error !== void 0 ? error : void 0, complete: complete !== null && complete !== void 0 ? complete : void 0 }; } else { let context2; if (this && config.useDeprecatedNextContext) { context2 = Object.create(observerOrNext); context2.unsubscribe = () => this.unsubscribe(); partialObserver = { next: observerOrNext.next && bind(observerOrNext.next, context2), error: observerOrNext.error && bind(observerOrNext.error, context2), complete: observerOrNext.complete && bind(observerOrNext.complete, context2) }; } else { partialObserver = observerOrNext; } } this.destination = new ConsumerObserver(partialObserver); } }; function handleUnhandledError(error) { if (config.useDeprecatedSynchronousErrorHandling) { captureError(error); } else { reportUnhandledError(error); } } function defaultErrorHandler(err) { throw err; } function handleStoppedNotification(notification, subscriber) { const { onStoppedNotification } = config; onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber)); } var EMPTY_OBSERVER = { closed: true, next: noop, error: defaultErrorHandler, complete: noop }; // node_modules/rxjs/dist/esm/internal/symbol/observable.js var observable = (() => typeof Symbol === "function" && Symbol.observable || "@@observable")(); // node_modules/rxjs/dist/esm/internal/util/identity.js function identity(x) { return x; } // node_modules/rxjs/dist/esm/internal/util/pipe.js function pipeFromArray(fns) { if (fns.length === 0) { return identity; } if (fns.length === 1) { return fns[0]; } return function piped(input2) { return fns.reduce((prev, fn) => fn(prev), input2); }; } // node_modules/rxjs/dist/esm/internal/Observable.js var Observable = class _Observable { constructor(subscribe) { if (subscribe) { this._subscribe = subscribe; } } lift(operator) { const observable2 = new _Observable(); observable2.source = this; observable2.operator = operator; return observable2; } subscribe(observerOrNext, error, complete) { const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete); errorContext(() => { const { operator, source } = this; subscriber.add(operator ? operator.call(subscriber, source) : source ? this._subscribe(subscriber) : this._trySubscribe(subscriber)); }); return subscriber; } _trySubscribe(sink) { try { return this._subscribe(sink); } catch (err) { sink.error(err); } } forEach(next, promiseCtor) { promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor((resolve, reject) => { const subscriber = new SafeSubscriber({ next: (value) => { try { next(value); } catch (err) { reject(err); subscriber.unsubscribe(); } }, error: reject, complete: resolve }); this.subscribe(subscriber); }); } _subscribe(subscriber) { var _a; return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber); } [observable]() { return this; } pipe(...operations) { return pipeFromArray(operations)(this); } toPromise(promiseCtor) { promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor((resolve, reject) => { let value; this.subscribe((x) => value = x, (err) => reject(err), () => resolve(value)); }); } }; Observable.create = (subscribe) => { return new Observable(subscribe); }; function getPromiseCtor(promiseCtor) { var _a; return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise; } function isObserver(value) { return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete); } function isSubscriber(value) { return value && value instanceof Subscriber || isObserver(value) && isSubscription(value); } // node_modules/rxjs/dist/esm/internal/util/lift.js function hasLift(source) { return isFunction(source === null || source === void 0 ? void 0 : source.lift); } function operate(init) { return (source) => { if (hasLift(source)) { return source.lift(function(liftedSource) { try { return init(liftedSource, this); } catch (err) { this.error(err); } }); } throw new TypeError("Unable to lift unknown Observable type"); }; } // node_modules/rxjs/dist/esm/internal/operators/OperatorSubscriber.js function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) { return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize); } var OperatorSubscriber = class extends Subscriber { constructor(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) { super(destination); this.onFinalize = onFinalize; this.shouldUnsubscribe = shouldUnsubscribe; this._next = onNext ? function(value) { try { onNext(value); } catch (err) { destination.error(err); } } : super._next; this._error = onError ? function(err) { try { onError(err); } catch (err2) { destination.error(err2); } finally { this.unsubscribe(); } } : super._error; this._complete = onComplete ? function() { try { onComplete(); } catch (err) { destination.error(err); } finally { this.unsubscribe(); } } : super._complete; } unsubscribe() { var _a; if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { const { closed } = this; super.unsubscribe(); !closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this)); } } }; // node_modules/rxjs/dist/esm/internal/util/ObjectUnsubscribedError.js var ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() { _super(this); this.name = "ObjectUnsubscribedError"; this.message = "object unsubscribed"; }); // node_modules/rxjs/dist/esm/internal/Subject.js var Subject = class extends Observable { constructor() { super(); this.closed = false; this.currentObservers = null; this.observers = []; this.isStopped = false; this.hasError = false; this.thrownError = null; } lift(operator) { const subject = new AnonymousSubject(this, this); subject.operator = operator; return subject; } _throwIfClosed() { if (this.closed) { throw new ObjectUnsubscribedError(); } } next(value) { errorContext(() => { this._throwIfClosed(); if (!this.isStopped) { if (!this.currentObservers) { this.currentObservers = Array.from(this.observers); } for (const observer of this.currentObservers) { observer.next(value); } } }); } error(err) { errorContext(() => { this._throwIfClosed(); if (!this.isStopped) { this.hasError = this.isStopped = true; this.thrownError = err; const { observers } = this; while (observers.length) { observers.shift().error(err); } } }); } complete() { errorContext(() => { this._throwIfClosed(); if (!this.isStopped) { this.isStopped = true; const { observers } = this; while (observers.length) { observers.shift().complete(); } } }); } unsubscribe() { this.isStopped = this.closed = true; this.observers = this.currentObservers = null; } get observed() { var _a; return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0; } _trySubscribe(subscriber) { this._throwIfClosed(); return super._trySubscribe(subscriber); } _subscribe(subscriber) { this._throwIfClosed(); this._checkFinalizedStatuses(subscriber); return this._innerSubscribe(subscriber); } _innerSubscribe(subscriber) { const { hasError, isStopped, observers } = this; if (hasError || isStopped) { return EMPTY_SUBSCRIPTION; } this.currentObservers = null; observers.push(subscriber); return new Subscription(() => { this.currentObservers = null; arrRemove(observers, subscriber); }); } _checkFinalizedStatuses(subscriber) { const { hasError, thrownError, isStopped } = this; if (hasError) { subscriber.error(thrownError); } else if (isStopped) { subscriber.complete(); } } asObservable() { const observable2 = new Observable(); observable2.source = this; return observable2; } }; Subject.create = (destination, source) => { return new AnonymousSubject(destination, source); }; var AnonymousSubject = class extends Subject { constructor(destination, source) { super(); this.destination = destination; this.source = source; } next(value) { var _a, _b; (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value); } error(err) { var _a, _b; (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err); } complete() { var _a, _b; (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a); } _subscribe(subscriber) { var _a, _b; return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION; } }; // node_modules/rxjs/dist/esm/internal/BehaviorSubject.js var BehaviorSubject = class extends Subject { constructor(_value) { super(); this._value = _value; } get value() { return this.getValue(); } _subscribe(subscriber) { const subscription = super._subscribe(subscriber); !subscription.closed && subscriber.next(this._value); return subscription; } getValue() { const { hasError, thrownError, _value } = this; if (hasError) { throw thrownError; } this._throwIfClosed(); return _value; } next(value) { super.next(this._value = value); } }; // node_modules/rxjs/dist/esm/internal/scheduler/dateTimestampProvider.js var dateTimestampProvider = { now() { return (dateTimestampProvider.delegate || Date).now(); }, delegate: void 0 }; // node_modules/rxjs/dist/esm/internal/ReplaySubject.js var ReplaySubject = class extends Subject { constructor(_bufferSize = Infinity, _windowTime = Infinity, _timestampProvider = dateTimestampProvider) { super(); this._bufferSize = _bufferSize; this._windowTime = _windowTime; this._timestampProvider = _timestampProvider; this._buffer = []; this._infiniteTimeWindow = true; this._infiniteTimeWindow = _windowTime === Infinity; this._bufferSize = Math.max(1, _bufferSize); this._windowTime = Math.max(1, _windowTime); } next(value) { const { isStopped, _buffer, _infiniteTimeWindow, _timestampProvider, _windowTime } = this; if (!isStopped) { _buffer.push(value); !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime); } this._trimBuffer(); super.next(value); } _subscribe(subscriber) { this._throwIfClosed(); this._trimBuffer(); const subscription = this._innerSubscribe(subscriber); const { _infiniteTimeWindow, _buffer } = this; const copy = _buffer.slice(); for (let i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) { subscriber.next(copy[i]); } this._checkFinalizedStatuses(subscriber); return subscription; } _trimBuffer() { const { _bufferSize, _timestampProvider, _buffer, _infiniteTimeWindow } = this; const adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize; _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize); if (!_infiniteTimeWindow) { const now = _timestampProvider.now(); let last2 = 0; for (let i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) { last2 = i; } last2 && _buffer.splice(0, last2 + 1); } } }; // node_modules/rxjs/dist/esm/internal/observable/empty.js var EMPTY = new Observable((subscriber) => subscriber.complete()); // node_modules/rxjs/dist/esm/internal/util/isScheduler.js function isScheduler(value) { return value && isFunction(value.schedule); } // node_modules/rxjs/dist/esm/internal/util/args.js function last(arr) { return arr[arr.length - 1]; } function popResultSelector(args) { return isFunction(last(args)) ? args.pop() : void 0; } function popScheduler(args) { return isScheduler(last(args)) ? args.pop() : void 0; } function popNumber(args, defaultValue) { return typeof last(args) === "number" ? args.pop() : defaultValue; } // node_modules/tslib/tslib.es6.mjs function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function(resolve) { resolve(value); }); } return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function() { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { return this; }, i; function awaitReturn(f) { return function(v) { return Promise.resolve(v).then(f, reject); }; } function verb(n, f) { if (g[n]) { i[n] = function(v) { return new Promise(function(a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { return this; }, i); function verb(n) { i[n] = o[n] && function(v) { return new Promise(function(resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v2) { resolve({ value: v2, done: d }); }, reject); } } // node_modules/rxjs/dist/esm/internal/util/isArrayLike.js var isArrayLike = (x) => x && typeof x.length === "number" && typeof x !== "function"; // node_modules/rxjs/dist/esm/internal/util/isPromise.js function isPromise(value) { return isFunction(value === null || value === void 0 ? void 0 : value.then); } // node_modules/rxjs/dist/esm/internal/util/isInteropObservable.js function isInteropObservable(input2) { return isFunction(input2[observable]); } // node_modules/rxjs/dist/esm/internal/util/isAsyncIterable.js function isAsyncIterable(obj) { return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]); } // node_modules/rxjs/dist/esm/internal/util/throwUnobservableError.js function createInvalidObservableTypeError(input2) { return new TypeError(`You provided ${input2 !== null && typeof input2 === "object" ? "an invalid object" : `'${input2}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`); } // node_modules/rxjs/dist/esm/internal/symbol/iterator.js function getSymbolIterator() { if (typeof Symbol !== "function" || !Symbol.iterator) { return "@@iterator"; } return Symbol.iterator; } var iterator = getSymbolIterator(); // node_modules/rxjs/dist/esm/internal/util/isIterable.js function isIterable(input2) { return isFunction(input2 === null || input2 === void 0 ? void 0 : input2[iterator]); } // node_modules/rxjs/dist/esm/internal/util/isReadableStreamLike.js function readableStreamLikeToAsyncGenerator(readableStream) { return __asyncGenerator(this, arguments, function* readableStreamLikeToAsyncGenerator_1() { const reader = readableStream.getReader(); try { while (true) { const { value, done } = yield __await(reader.read()); if (done) { return yield __await(void 0); } yield yield __await(value); } } finally { reader.releaseLock(); } }); } function isReadableStreamLike(obj) { return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader); } // node_modules/rxjs/dist/esm/internal/observable/innerFrom.js function innerFrom(input2) { if (input2 instanceof Observable) { return input2; } if (input2 != null) { if (isInteropObservable(input2)) { return fromInteropObservable(input2); } if (isArrayLike(input2)) { return fromArrayLike(input2); } if (isPromise(input2)) { return fromPromise(input2); } if (isAsyncIterable(input2)) { return fromAsyncIterable(input2); } if (isIterable(input2)) { return fromIterable(input2); } if (isReadableStreamLike(input2)) { return fromReadableStreamLike(input2); } } throw createInvalidObservableTypeError(input2); } function fromInteropObservable(obj) { return new Observable((subscriber) => { const obs = obj[observable](); if (isFunction(obs.subscribe)) { return obs.subscribe(subscriber); } throw new TypeError("Provided object does not correctly implement Symbol.observable"); }); } function fromArrayLike(array) { return new Observable((subscriber) => { for (let i = 0; i < array.length && !subscriber.closed; i++) { subscriber.next(array[i]); } subscriber.complete(); }); } function fromPromise(promise) { return new Observable((subscriber) => { promise.then((value) => { if (!subscriber.closed) { subscriber.next(value); subscriber.complete(); } }, (err) => subscriber.error(err)).then(null, reportUnhandledError); }); } function fromIterable(iterable) { return new Observable((subscriber) => { for (const value of iterable) { subscriber.next(value); if (subscriber.closed) { return; } } subscriber.complete(); }); } function fromAsyncIterable(asyncIterable) { return new Observable((subscriber) => { process(asyncIterable, subscriber).catch((err) => subscriber.error(err)); }); } function fromReadableStreamLike(readableStream) { return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream)); } function process(asyncIterable, subscriber) { var asyncIterable_1, asyncIterable_1_1; var e_1, _a; return __awaiter(this, void 0, void 0, function* () { try { for (asyncIterable_1 = __asyncValues(asyncIterable); asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done; ) { const value = asyncIterable_1_1.value; subscriber.next(value); if (subscriber.closed) { return; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)) yield _a.call(asyncIterable_1); } finally { if (e_1) throw e_1.error; } } subscriber.complete(); }); } // node_modules/rxjs/dist/esm/internal/util/executeSchedule.js function executeSchedule(parentSubscription, scheduler2, work, delay = 0, repeat = false) { const scheduleSubscription = scheduler2.schedule(function() { work(); if (repeat) { parentSubscription.add(this.schedule(null, delay)); } else { this.unsubscribe(); } }, delay); parentSubscription.add(scheduleSubscription); if (!repeat) { return scheduleSubscription; } } // node_modules/rxjs/dist/esm/internal/operators/observeOn.js function observeOn(scheduler2, delay = 0) { return operate((source, subscriber) => { source.subscribe(createOperatorSubscriber(subscriber, (value) => executeSchedule(subscriber, scheduler2, () => subscriber.next(value), delay), () => executeSchedule(subscriber, scheduler2, () => subscriber.complete(), delay), (err) => executeSchedule(subscriber, scheduler2, () => subscriber.error(err), delay))); }); } // node_modules/rxjs/dist/esm/internal/operators/subscribeOn.js function subscribeOn(scheduler2, delay = 0) { return operate((source, subscriber) => { subscriber.add(scheduler2.schedule(() => source.subscribe(subscriber), delay)); }); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduleObservable.js function scheduleObservable(input2, scheduler2) { return innerFrom(input2).pipe(subscribeOn(scheduler2), observeOn(scheduler2)); } // node_modules/rxjs/dist/esm/internal/scheduled/schedulePromise.js function schedulePromise(input2, scheduler2) { return innerFrom(input2).pipe(subscribeOn(scheduler2), observeOn(scheduler2)); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduleArray.js function scheduleArray(input2, scheduler2) { return new Observable((subscriber) => { let i = 0; return scheduler2.schedule(function() { if (i === input2.length) { subscriber.complete(); } else { subscriber.next(input2[i++]); if (!subscriber.closed) { this.schedule(); } } }); }); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduleIterable.js function scheduleIterable(input2, scheduler2) { return new Observable((subscriber) => { let iterator2; executeSchedule(subscriber, scheduler2, () => { iterator2 = input2[iterator](); executeSchedule(subscriber, scheduler2, () => { let value; let done; try { ({ value, done } = iterator2.next()); } catch (err) { subscriber.error(err); return; } if (done) { subscriber.complete(); } else { subscriber.next(value); } }, 0, true); }); return () => isFunction(iterator2 === null || iterator2 === void 0 ? void 0 : iterator2.return) && iterator2.return(); }); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduleAsyncIterable.js function scheduleAsyncIterable(input2, scheduler2) { if (!input2) { throw new Error("Iterable cannot be null"); } return new Observable((subscriber) => { executeSchedule(subscriber, scheduler2, () => { const iterator2 = input2[Symbol.asyncIterator](); executeSchedule(subscriber, scheduler2, () => { iterator2.next().then((result) => { if (result.done) { subscriber.complete(); } else { subscriber.next(result.value); } }); }, 0, true); }); }); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduleReadableStreamLike.js function scheduleReadableStreamLike(input2, scheduler2) { return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input2), scheduler2); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduled.js function scheduled(input2, scheduler2) { if (input2 != null) { if (isInteropObservable(input2)) { return scheduleObservable(input2, scheduler2); } if (isArrayLike(input2)) { return scheduleArray(input2, scheduler2); } if (isPromise(input2)) { return schedulePromise(input2, scheduler2); } if (isAsyncIterable(input2)) { return scheduleAsyncIterable(input2, scheduler2); } if (isIterable(input2)) { return scheduleIterable(input2, scheduler2); } if (isReadableStreamLike(input2)) { return scheduleReadableStreamLike(input2, scheduler2); } } throw createInvalidObservableTypeError(input2); } // node_modules/rxjs/dist/esm/internal/observable/from.js function from(input2, scheduler2) { return scheduler2 ? scheduled(input2, scheduler2) : innerFrom(input2); } // node_modules/rxjs/dist/esm/internal/observable/of.js function of(...args) { const scheduler2 = popScheduler(args); return from(args, scheduler2); } // node_modules/rxjs/dist/esm/internal/util/EmptyError.js var EmptyError = createErrorClass((_super) => function EmptyErrorImpl() { _super(this); this.name = "EmptyError"; this.message = "no elements in sequence"; }); // node_modules/rxjs/dist/esm/internal/operators/map.js function map(project, thisArg) { return operate((source, subscriber) => { let index = 0; source.subscribe(createOperatorSubscriber(subscriber, (value) => { subscriber.next(project.call(thisArg, value, index++)); })); }); } // node_modules/rxjs/dist/esm/internal/util/mapOneOrManyArgs.js var { isArray } = Array; function callOrApply(fn, args) { return isArray(args) ? fn(...args) : fn(args); } function mapOneOrManyArgs(fn) { return map((args) => callOrApply(fn, args)); } // node_modules/rxjs/dist/esm/internal/util/argsArgArrayOrObject.js var { isArray: isArray2 } = Array; var { getPrototypeOf, prototype: objectProto, keys: getKeys } = Object; function argsArgArrayOrObject(args) { if (args.length === 1) { const first2 = args[0]; if (isArray2(first2)) { return { args: first2, keys: null }; } if (isPOJO(first2)) { const keys = getKeys(first2); return { args: keys.map((key) => first2[key]), keys }; } } return { args, keys: null }; } function isPOJO(obj) { return obj && typeof obj === "object" && getPrototypeOf(obj) === objectProto; } // node_modules/rxjs/dist/esm/internal/util/createObject.js function createObject(keys, values) { return keys.reduce((result, key, i) => (result[key] = values[i], result), {}); } // node_modules/rxjs/dist/esm/internal/operators/mergeInternals.js function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) { const buffer = []; let active = 0; let index = 0; let isComplete = false; const checkComplete = () => { if (isComplete && !buffer.length && !active) { subscriber.complete(); } }; const outerNext = (value) => active < concurrent ? doInnerSub(value) : buffer.push(value); const doInnerSub = (value) => { expand && subscriber.next(value); active++; let innerComplete = false; innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, (innerValue) => { onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue); if (expand) { outerNext(innerValue); } else { subscriber.next(innerValue); } }, () => { innerComplete = true; }, void 0, () => { if (innerComplete) { try { active--; while (buffer.length && active < concurrent) { const bufferedValue = buffer.shift(); if (innerSubScheduler) { executeSchedule(subscriber, innerSubScheduler, () => doInnerSub(bufferedValue)); } else { doInnerSub(bufferedValue); } } checkComplete(); } catch (err) { subscriber.error(err); } } })); }; source.subscribe(createOperatorSubscriber(subscriber, outerNext, () => { isComplete = true; checkComplete(); })); return () => { additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer(); }; } // node_modules/rxjs/dist/esm/internal/operators/mergeMap.js function mergeMap(project, resultSelector, concurrent = Infinity) { if (isFunction(resultSelector)) { return mergeMap((a, i) => map((b, ii) => resultSelector(a, b, i, ii))(innerFrom(project(a, i))), concurrent); } else if (typeof resultSelector === "number") { concurrent = resultSelector; } return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent)); } // node_modules/rxjs/dist/esm/internal/operators/mergeAll.js function mergeAll(concurrent = Infinity) { return mergeMap(identity, concurrent); } // node_modules/rxjs/dist/esm/internal/observable/forkJoin.js function forkJoin(...args) { const resultSelector = popResultSelector(args); const { args: sources, keys } = argsArgArrayOrObject(args); const result = new Observable((subscriber) => { const { length } = sources; if (!length) { subscriber.complete(); return; } const values = new Array(length); let remainingCompletions = length; let remainingEmissions = length; for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) { let hasValue = false; innerFrom(sources[sourceIndex]).subscribe(createOperatorSubscriber(subscriber, (value) => { if (!hasValue) { hasValue = true; remainingEmissions--; } values[sourceIndex] = value; }, () => remainingCompletions--, void 0, () => { if (!remainingCompletions || !hasValue) { if (!remainingEmissions) { subscriber.next(keys ? createObject(keys, values) : values); } subscriber.complete(); } })); } }); return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result; } // node_modules/rxjs/dist/esm/internal/observable/merge.js function merge(...args) { const scheduler2 = popScheduler(args); const concurrent = popNumber(args, Infinity); const sources = args; return !sources.length ? EMPTY : sources.length === 1 ? innerFrom(sources[0]) : mergeAll(concurrent)(from(sources, scheduler2)); } // node_modules/rxjs/dist/esm/internal/operators/filter.js function filter(predicate, thisArg) { return operate((source, subscriber) => { let index = 0; source.subscribe(createOperatorSubscriber(subscriber, (value) => predicate.call(thisArg, value, index++) && subscriber.next(value))); }); } // node_modules/rxjs/dist/esm/internal/operators/concatMap.js function concatMap(project, resultSelector) { return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1); } // node_modules/rxjs/dist/esm/internal/operators/defaultIfEmpty.js function defaultIfEmpty(defaultValue) { return operate((source, subscriber) => { let hasValue = false; source.subscribe(createOperatorSubscriber(subscriber, (value) => { hasValue = true; subscriber.next(value); }, () => { if (!hasValue) { subscriber.next(defaultValue); } subscriber.complete(); })); }); } // node_modules/rxjs/dist/esm/internal/operators/take.js function take(count) { return count <= 0 ? () => EMPTY : operate((source, subscriber) => { let seen = 0; source.subscribe(createOperatorSubscriber(subscriber, (value) => { if (++seen <= count) { subscriber.next(value); if (count <= seen) { subscriber.complete(); } } })); }); } // node_modules/rxjs/dist/esm/internal/operators/throwIfEmpty.js function throwIfEmpty(errorFactory = defaultErrorFactory) { return operate((source, subscriber) => { let hasValue = false; source.subscribe(createOperatorSubscriber(subscriber, (value) => { hasValue = true; subscriber.next(value); }, () => hasValue ? subscriber.complete() : subscriber.error(errorFactory()))); }); } function defaultErrorFactory() { return new EmptyError(); } // node_modules/rxjs/dist/esm/internal/operators/finalize.js function finalize(callback) { return operate((source, subscriber) => { try { source.subscribe(subscriber); } finally { subscriber.add(callback); } }); } // node_modules/rxjs/dist/esm/internal/operators/first.js function first(predicate, defaultValue) { const hasDefaultValue = arguments.length >= 2; return (source) => source.pipe(predicate ? filter((v, i) => predicate(v, i, source)) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError())); } // node_modules/rxjs/dist/esm/internal/operators/switchMap.js function switchMap(project, resultSelector) { return operate((source, subscriber) => { let innerSubscriber = null; let index = 0; let isComplete = false; const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete(); source.subscribe(createOperatorSubscriber(subscriber, (value) => { innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe(); let innerIndex = 0; const outerIndex = index++; innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, (innerValue) => subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue), () => { innerSubscriber = null; checkComplete(); })); }, () => { isComplete = true; checkComplete(); })); }); } // node_modules/@angular/core/fesm2022/core.mjs var ERROR_DETAILS_PAGE_BASE_URL = "https://angular.dev/errors"; var XSS_SECURITY_URL = "https://g.co/ng/security#xss"; var RuntimeError = class extends Error { constructor(code, message) { super(formatRuntimeError(code, message)); this.code = code; } }; function formatRuntimeError(code, message) { const fullCode = `NG0${Math.abs(code)}`; let errorMessage = `${fullCode}${message ? ": " + message : ""}`; if (ngDevMode && code < 0) { const addPeriodSeparator = !errorMessage.match(/[.,;!?\n]$/); const separator = addPeriodSeparator ? "." : ""; errorMessage = `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`; } return errorMessage; } var REQUIRED_UNSET_VALUE = /* @__PURE__ */ Symbol("InputSignalNode#UNSET"); var INPUT_SIGNAL_NODE = /* @__PURE__ */ (() => { return __spreadProps(__spreadValues({}, SIGNAL_NODE), { transformFn: void 0, applyValueToInputSignal(node, value) { signalSetFn(node, value); } }); })(); function createInputSignal(initialValue, options) { const node = Object.create(INPUT_SIGNAL_NODE); node.value = initialValue; node.transformFn = options?.transform; function inputValueFn() { producerAccessed(node); if (node.value === REQUIRED_UNSET_VALUE) { throw new RuntimeError(-950, ngDevMode && "Input is required but no value is available yet."); } return node.value; } inputValueFn[SIGNAL] = node; if (ngDevMode) { inputValueFn.toString = () => `[Input Signal: ${inputValueFn()}]`; } return inputValueFn; } function noSideEffects(fn) { return { toString: fn }.toString(); } var ANNOTATIONS = "__annotations__"; var PARAMETERS = "__parameters__"; var PROP_METADATA = "__prop__metadata__"; function makeDecorator(name, props, parentClass, additionalProcessing, typeFn) { return noSideEffects(() => { const metaCtor = makeMetadataCtor(props); function DecoratorFactory(...args) { if (this instanceof DecoratorFactory) { metaCtor.call(this, ...args); return this; } const annotationInstance = new DecoratorFactory(...args); return function TypeDecorator(cls) { if (typeFn) typeFn(cls, ...args); const annotations = cls.hasOwnProperty(ANNOTATIONS) ? cls[ANNOTATIONS] : Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS]; annotations.push(annotationInstance); if (additionalProcessing) additionalProcessing(cls); return cls; }; } if (parentClass) { DecoratorFactory.prototype = Object.create(parentClass.prototype); } DecoratorFactory.prototype.ngMetadataName = name; DecoratorFactory.annotationCls = DecoratorFactory; return DecoratorFactory; }); } function makeMetadataCtor(props) { return function ctor(...args) { if (props) { const values = props(...args); for (const propName in values) { this[propName] = values[propName]; } } }; } function makeParamDecorator(name, props, parentClass) { return noSideEffects(() => { const metaCtor = makeMetadataCtor(props); function ParamDecoratorFactory(...args) { if (this instanceof ParamDecoratorFactory) { metaCtor.apply(this, args); return this; } const annotationInstance = new ParamDecoratorFactory(...args); ParamDecorator.annotation = annotationInstance; return ParamDecorator; function ParamDecorator(cls, unusedKey, index) { const parameters = cls.hasOwnProperty(PARAMETERS) ? cls[PARAMETERS] : Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS]; while (parameters.length <= index) { parameters.push(null); } (parameters[index] = parameters[index] || []).push(annotationInstance); return cls; } } if (parentClass) { ParamDecoratorFactory.prototype = Object.create(parentClass.prototype); } ParamDecoratorFactory.prototype.ngMetadataName = name; ParamDecoratorFactory.annotationCls = ParamDecoratorFactory; return ParamDecoratorFactory; }); } function makePropDecorator(name, props, parentClass, additionalProcessing) { return noSideEffects(() => { const metaCtor = makeMetadataCtor(props); function PropDecoratorFactory(...args) { if (this instanceof PropDecoratorFactory) { metaCtor.apply(this, args); return this; } const decoratorInstance = new PropDecoratorFactory(...args); function PropDecorator(target, name2) { if (target === void 0) { throw new Error("Standard Angular field decorators are not supported in JIT mode."); } const constructor = target.constructor; const meta = constructor.hasOwnProperty(PROP_METADATA) ? constructor[PROP_METADATA] : Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA]; meta[name2] = meta.hasOwnProperty(name2) && meta[name2] || []; meta[name2].unshift(decoratorInstance); if (additionalProcessing) additionalProcessing(target, name2, ...args); } return PropDecorator; } if (parentClass) { PropDecoratorFactory.prototype = Object.create(parentClass.prototype); } PropDecoratorFactory.prototype.ngMetadataName = name; PropDecoratorFactory.annotationCls = PropDecoratorFactory; return PropDecoratorFactory; }); } var _global = globalThis; function ngDevModeResetPerfCounters() { const locationString = typeof location !== "undefined" ? location.toString() : ""; const newCounters = { namedConstructors: locationString.indexOf("ngDevMode=namedConstructors") != -1, firstCreatePass: 0, tNode: 0, tView: 0, rendererCreateTextNode: 0, rendererSetText: 0, rendererCreateElement: 0, rendererAddEventListener: 0, rendererSetAttribute: 0, rendererRemoveAttribute: 0, rendererSetProperty: 0, rendererSetClassName: 0, rendererAddClass: 0, rendererRemoveClass: 0, rendererSetStyle: 0, rendererRemoveStyle: 0, rendererDestroy: 0, rendererDestroyNode: 0, rendererMoveNode: 0, rendererRemoveNode: 0, rendererAppendChild: 0, rendererInsertBefore: 0, rendererCreateComment: 0, hydratedNodes: 0, hydratedComponents: 0, dehydratedViewsRemoved: 0, dehydratedViewsCleanupRuns: 0, componentsSkippedHydration: 0 }; const allowNgDevModeTrue = locationString.indexOf("ngDevMode=false") === -1; if (!allowNgDevModeTrue) { _global["ngDevMode"] = false; } else { if (typeof _global["ngDevMode"] !== "object") { _global["ngDevMode"] = {}; } Object.assign(_global["ngDevMode"], newCounters); } return newCounters; } function initNgDevMode() { if (typeof ngDevMode === "undefined" || ngDevMode) { if (typeof ngDevMode !== "object" || Object.keys(ngDevMode).length === 0) { ngDevModeResetPerfCounters(); } return typeof ngDevMode !== "undefined" && !!ngDevMode; } return false; } function getClosureSafeProperty(objWithPropertyToExtract) { for (let key in objWithPropertyToExtract) { if (objWithPropertyToExtract[key] === getClosureSafeProperty) { return key; } } throw Error("Could not find renamed property on target object."); } function fillProperties(target, source) { for (const key in source) { if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) { target[key] = source[key]; } } } function stringify(token) { if (typeof token === "string") { return token; } if (Array.isArray(token)) { return "[" + token.map(stringify).join(", ") + "]"; } if (token == null) { return "" + token; } if (token.overriddenName) { return `${token.overriddenName}`; } if (token.name) { return `${token.name}`; } const res = token.toString(); if (res == null) { return "" + res; } const newLineIndex = res.indexOf("\n"); return newLineIndex === -1 ? res : res.substring(0, newLineIndex); } function concatStringsWithSpace(before, after) { return before == null || before === "" ? after === null ? "" : after : after == null || after === "" ? before : before + " " + after; } var __forward_ref__ = getClosureSafeProperty({ __forward_ref__: getClosureSafeProperty }); function forwardRef(forwardRefFn) { forwardRefFn.__forward_ref__ = forwardRef; forwardRefFn.toString = function() { return stringify(this()); }; return forwardRefFn; } function resolveForwardRef(type) { return isForwardRef(type) ? type() : type; } function isForwardRef(fn) { return typeof fn === "function" && fn.hasOwnProperty(__forward_ref__) && fn.__forward_ref__ === forwardRef; } function assertNumber(actual, msg) { if (!(typeof actual === "number")) { throwError(msg, typeof actual, "number", "==="); } } function assertNumberInRange(actual, minInclusive, maxInclusive) { assertNumber(actual, "Expected a number"); assertLessThanOrEqual(actual, maxInclusive, "Expected number to be less than or equal to"); assertGreaterThanOrEqual(actual, minInclusive, "Expected number to be greater than or equal to"); } function assertString(actual, msg) { if (!(typeof actual === "string")) { throwError(msg, actual === null ? "null" : typeof actual, "string", "==="); } } function assertFunction(actual, msg) { if (!(typeof actual === "function")) { throwError(msg, actual === null ? "null" : typeof actual, "function", "==="); } } function assertEqual(actual, expected, msg) { if (!(actual == expected)) { throwError(msg, actual, expected, "=="); } } function assertNotEqual(actual, expected, msg) { if (!(actual != expected)) { throwError(msg, actual, expected, "!="); } } function assertSame(actual, expected, msg) { if (!(actual === expected)) { throwError(msg, actual, expected, "==="); } } function assertNotSame(actual, expected, msg) { if (!(actual !== expected)) { throwError(msg, actual, expected, "!=="); } } function assertLessThan(actual, expected, msg) { if (!(actual < expected)) { throwError(msg, actual, expected, "<"); } } function assertLessThanOrEqual(actual, expected, msg) { if (!(actual <= expected)) { throwError(msg, actual, expected, "<="); } } function assertGreaterThan(actual, expected, msg) { if (!(actual > expected)) { throwError(msg, actual, expected, ">"); } } function assertGreaterThanOrEqual(actual, expected, msg) { if (!(actual >= expected)) { throwError(msg, actual, expected, ">="); } } function assertDefined(actual, msg) { if (actual == null) { throwError(msg, actual, null, "!="); } } function throwError(msg, actual, expected, comparison) { throw new Error(`ASSERTION ERROR: ${msg}` + (comparison == null ? "" : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`)); } function assertDomNode(node) { if (!(node instanceof Node)) { throwError(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`); } } function assertElement(node) { if (!(node instanceof Element)) { throwError(`The provided value must be an element but got ${stringify(node)}`); } } function assertIndexInRange(arr, index) { assertDefined(arr, "Array must be defined."); const maxLen = arr.length; if (index < 0 || index >= maxLen) { throwError(`Index expected to be less than ${maxLen} but got ${index}`); } } function assertOneOf(value, ...validValues) { if (validValues.indexOf(value) !== -1) return true; throwError(`Expected value to be one of ${JSON.stringify(validValues)} but was ${JSON.stringify(value)}.`); } function assertNotReactive(fn) { if (getActiveConsumer() !== null) { throwError(`${fn}() should never be called in a reactive context.`); } } function \u0275\u0275defineInjectable(opts) { return { token: opts.token, providedIn: opts.providedIn || null, factory: opts.factory, value: void 0 }; } function \u0275\u0275defineInjector(options) { return { providers: options.providers || [], imports: options.imports || [] }; } function getInjectableDef(type) { return getOwnDefinition(type, NG_PROV_DEF) || getOwnDefinition(type, NG_INJECTABLE_DEF); } function getOwnDefinition(type, field) { return type.hasOwnProperty(field) ? type[field] : null; } function getInheritedInjectableDef(type) { const def = type && (type[NG_PROV_DEF] || type[NG_INJECTABLE_DEF]); if (def) { ngDevMode && console.warn(`DEPRECATED: DI is instantiating a token "${type.name}" that inherits its @Injectable decorator but does not provide one itself. This will become an error in a future version of Angular. Please add @Injectable() to the "${type.name}" class.`); return def; } else { return null; } } function getInjectorDef(type) { return type && (type.hasOwnProperty(NG_INJ_DEF) || type.hasOwnProperty(NG_INJECTOR_DEF)) ? type[NG_INJ_DEF] : null; } var NG_PROV_DEF = getClosureSafeProperty({ \u0275prov: getClosureSafeProperty }); var NG_INJ_DEF = getClosureSafeProperty({ \u0275inj: getClosureSafeProperty }); var NG_INJECTABLE_DEF = getClosureSafeProperty({ ngInjectableDef: getClosureSafeProperty }); var NG_INJECTOR_DEF = getClosureSafeProperty({ ngInjectorDef: getClosureSafeProperty }); var InjectionToken = class { /** * @param _desc Description for the token, * used only for debugging purposes, * it should but does not need to be unique * @param options Options for the token's usage, as described above */ constructor(_desc, options) { this._desc = _desc; this.ngMetadataName = "InjectionToken"; this.\u0275prov = void 0; if (typeof options == "number") { (typeof ngDevMode === "undefined" || ngDevMode) && assertLessThan(options, 0, "Only negative numbers are supported here"); this.__NG_ELEMENT_ID__ = options; } else if (options !== void 0) { this.\u0275prov = \u0275\u0275defineInjectable({ token: this, providedIn: options.providedIn || "root", factory: options.factory }); } } /** * @internal */ get multi() { return this; } toString() { return `InjectionToken ${this._desc}`; } }; var _injectorProfilerContext; function getInjectorProfilerContext() { !ngDevMode && throwError("getInjectorProfilerContext should never be called in production mode"); return _injectorProfilerContext; } function setInjectorProfilerContext(context2) { !ngDevMode && throwError("setInjectorProfilerContext should never be called in production mode"); const previous = _injectorProfilerContext; _injectorProfilerContext = context2; return previous; } var injectorProfilerCallback = null; var setInjectorProfiler = (injectorProfiler2) => { !ngDevMode && throwError("setInjectorProfiler should never be called in production mode"); injectorProfilerCallback = injectorProfiler2; }; function injectorProfiler(event) { !ngDevMode && throwError("Injector profiler should never be called in production mode"); if (injectorProfilerCallback != null) { injectorProfilerCallback(event); } } function emitProviderConfiguredEvent(eventProvider, isViewProvider = false) { !ngDevMode && throwError("Injector profiler should never be called in production mode"); let token; if (typeof eventProvider === "function") { token = eventProvider; } else if (eventProvider instanceof InjectionToken) { token = eventProvider; } else { token = resolveForwardRef(eventProvider.provide); } let provider = eventProvider; if (eventProvider instanceof InjectionToken) { provider = eventProvider.\u0275prov || eventProvider; } injectorProfiler({ type: 2, context: getInjectorProfilerContext(), providerRecord: { token, provider, isViewProvider } }); } function emitInstanceCreatedByInjectorEvent(instance) { !ngDevMode && throwError("Injector profiler should never be called in production mode"); injectorProfiler({ type: 1, context: getInjectorProfilerContext(), instance: { value: instance } }); } function emitInjectEvent(token, value, flags) { !ngDevMode && throwError("Injector profiler should never be called in production mode"); injectorProfiler({ type: 0, context: getInjectorProfilerContext(), service: { token, value, flags } }); } function runInInjectorProfilerContext(injector, token, callback) { !ngDevMode && throwError("runInInjectorProfilerContext should never be called in production mode"); const prevInjectContext = setInjectorProfilerContext({ injector, token }); try { callback(); } finally { setInjectorProfilerContext(prevInjectContext); } } function isEnvironmentProviders(value) { return value && !!value.\u0275providers; } var NG_COMP_DEF = getClosureSafeProperty({ \u0275cmp: getClosureSafeProperty }); var NG_DIR_DEF = getClosureSafeProperty({ \u0275dir: getClosureSafeProperty }); var NG_PIPE_DEF = getClosureSafeProperty({ \u0275pipe: getClosureSafeProperty }); var NG_MOD_DEF = getClosureSafeProperty({ \u0275mod: getClosureSafeProperty }); var NG_FACTORY_DEF = getClosureSafeProperty({ \u0275fac: getClosureSafeProperty }); var NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafeProperty }); var NG_ENV_ID = getClosureSafeProperty({ __NG_ENV_ID__: getClosureSafeProperty }); function renderStringify(value) { if (typeof value === "string") return value; if (value == null) return ""; return String(value); } function stringifyForError(value) { if (typeof value === "function") return value.name || value.toString(); if (typeof value === "object" && value != null && typeof value.type === "function") { return value.type.name || value.type.toString(); } return renderStringify(value); } function throwCyclicDependencyError(token, path) { const depPath = path ? `. Dependency path: ${path.join(" > ")} > ${token}` : ""; throw new RuntimeError(-200, ngDevMode ? `Circular dependency in DI detected for ${token}${depPath}` : token); } function throwMixedMultiProviderError() { throw new Error(`Cannot mix multi providers and regular providers`); } function throwInvalidProviderError(ngModuleType, providers, provider) { if (ngModuleType && providers) { const providerDetail = providers.map((v) => v == provider ? "?" + provider + "?" : "..."); throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}' - only instances of Provider and Type are allowed, got: [${providerDetail.join(", ")}]`); } else if (isEnvironmentProviders(provider)) { if (provider.\u0275fromNgModule) { throw new RuntimeError(207, `Invalid providers from 'importProvidersFrom' present in a non-environment injector. 'importProvidersFrom' can't be used for component providers.`); } else { throw new RuntimeError(207, `Invalid providers present in a non-environment injector. 'EnvironmentProviders' can't be used for component providers.`); } } else { throw new Error("Invalid provider"); } } function throwProviderNotFoundError(token, injectorName) { const errorMessage = ngDevMode && `No provider for ${stringifyForError(token)} found${injectorName ? ` in ${injectorName}` : ""}`; throw new RuntimeError(-201, errorMessage); } var InjectFlags; (function(InjectFlags2) { InjectFlags2[InjectFlags2["Default"] = 0] = "Default"; InjectFlags2[InjectFlags2["Host"] = 1] = "Host"; InjectFlags2[InjectFlags2["Self"] = 2] = "Self"; InjectFlags2[InjectFlags2["SkipSelf"] = 4] = "SkipSelf"; InjectFlags2[InjectFlags2["Optional"] = 8] = "Optional"; })(InjectFlags || (InjectFlags = {})); var _injectImplementation; function getInjectImplementation() { return _injectImplementation; } function setInjectImplementation(impl) { const previous = _injectImplementation; _injectImplementation = impl; return previous; } function injectRootLimpMode(token, notFoundValue, flags) { const injectableDef = getInjectableDef(token); if (injectableDef && injectableDef.providedIn == "root") { return injectableDef.value === void 0 ? injectableDef.value = injectableDef.factory() : injectableDef.value; } if (flags & InjectFlags.Optional) return null; if (notFoundValue !== void 0) return notFoundValue; throwProviderNotFoundError(token, "Injector"); } function assertInjectImplementationNotEqual(fn) { ngDevMode && assertNotEqual(_injectImplementation, fn, "Calling \u0275\u0275inject would cause infinite recursion"); } var _THROW_IF_NOT_FOUND = {}; var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; var DI_DECORATOR_FLAG = "__NG_DI_FLAG__"; var NG_TEMP_TOKEN_PATH = "ngTempTokenPath"; var NG_TOKEN_PATH = "ngTokenPath"; var NEW_LINE = /\n/gm; var NO_NEW_LINE = "\u0275"; var SOURCE = "__source"; var _currentInjector = void 0; function getCurrentInjector() { return _currentInjector; } function setCurrentInjector(injector) { const former = _currentInjector; _currentInjector = injector; return former; } function injectInjectorOnly(token, flags = InjectFlags.Default) { if (_currentInjector === void 0) { throw new RuntimeError(-203, ngDevMode && `inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`runInInjectionContext\`.`); } else if (_currentInjector === null) { return injectRootLimpMode(token, void 0, flags); } else { const value = _currentInjector.get(token, flags & InjectFlags.Optional ? null : void 0, flags); ngDevMode && emitInjectEvent(token, value, flags); return value; } } function \u0275\u0275inject(token, flags = InjectFlags.Default) { return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags); } function \u0275\u0275invalidFactoryDep(index) { throw new RuntimeError(202, ngDevMode && `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid. This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator. Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`); } function inject(token, flags = InjectFlags.Default) { return \u0275\u0275inject(token, convertToBitFlags(flags)); } function convertToBitFlags(flags) { if (typeof flags === "undefined" || typeof flags === "number") { return flags; } return 0 | // comment to force a line break in the formatter (flags.optional && 8) | (flags.host && 1) | (flags.self && 2) | (flags.skipSelf && 4); } function injectArgs(types) { const args = []; for (let i = 0; i < types.length; i++) { const arg = resolveForwardRef(types[i]); if (Array.isArray(arg)) { if (arg.length === 0) { throw new RuntimeError(900, ngDevMode && "Arguments array must have arguments."); } let type = void 0; let flags = InjectFlags.Default; for (let j = 0; j < arg.length; j++) { const meta = arg[j]; const flag = getInjectFlag(meta); if (typeof flag === "number") { if (flag === -1) { type = meta.token; } else { flags |= flag; } } else { type = meta; } } args.push(\u0275\u0275inject(type, flags)); } else { args.push(\u0275\u0275inject(arg)); } } return args; } function attachInjectFlag(decorator, flag) { decorator[DI_DECORATOR_FLAG] = flag; decorator.prototype[DI_DECORATOR_FLAG] = flag; return decorator; } function getInjectFlag(token) { return token[DI_DECORATOR_FLAG]; } function catchInjectorError(e, token, injectorErrorName, source) { const tokenPath = e[NG_TEMP_TOKEN_PATH]; if (token[SOURCE]) { tokenPath.unshift(token[SOURCE]); } e.message = formatError("\n" + e.message, tokenPath, injectorErrorName, source); e[NG_TOKEN_PATH] = tokenPath; e[NG_TEMP_TOKEN_PATH] = null; throw e; } function formatError(text, obj, injectorErrorName, source = null) { text = text && text.charAt(0) === "\n" && text.charAt(1) == NO_NEW_LINE ? text.slice(2) : text; let context2 = stringify(obj); if (Array.isArray(obj)) { context2 = obj.map(stringify).join(" -> "); } else if (typeof obj === "object") { let parts = []; for (let key in obj) { if (obj.hasOwnProperty(key)) { let value = obj[key]; parts.push(key + ":" + (typeof value === "string" ? JSON.stringify(value) : stringify(value))); } } context2 = `{${parts.join(", ")}}`; } return `${injectorErrorName}${source ? "(" + source + ")" : ""}[${context2}]: ${text.replace(NEW_LINE, "\n ")}`; } var Inject = attachInjectFlag( // Disable tslint because `DecoratorFlags` is a const enum which gets inlined. makeParamDecorator("Inject", (token) => ({ token })), -1 /* DecoratorFlags.Inject */ ); var Optional = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("Optional"), 8 /* InternalInjectFlags.Optional */ ) ); var Self = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("Self"), 2 /* InternalInjectFlags.Self */ ) ); var SkipSelf = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("SkipSelf"), 4 /* InternalInjectFlags.SkipSelf */ ) ); var Host = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("Host"), 1 /* InternalInjectFlags.Host */ ) ); function getFactoryDef(type, throwNotFound) { const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF); if (!hasFactoryDef && throwNotFound === true && ngDevMode) { throw new Error(`Type ${stringify(type)} does not have '\u0275fac' property.`); } return hasFactoryDef ? type[NG_FACTORY_DEF] : null; } function arrayEquals(a, b, identityAccessor) { if (a.length !== b.length) return false; for (let i = 0; i < a.length; i++) { let valueA = a[i]; let valueB = b[i]; if (identityAccessor) { valueA = identityAccessor(valueA); valueB = identityAccessor(valueB); } if (valueB !== valueA) { return false; } } return true; } function flatten(list) { return list.flat(Number.POSITIVE_INFINITY); } function deepForEach(input2, fn) { input2.forEach((value) => Array.isArray(value) ? deepForEach(value, fn) : fn(value)); } function addToArray(arr, index, value) { if (index >= arr.length) { arr.push(value); } else { arr.splice(index, 0, value); } } function removeFromArray(arr, index) { if (index >= arr.length - 1) { return arr.pop(); } else { return arr.splice(index, 1)[0]; } } function newArray(size, value) { const list = []; for (let i = 0; i < size; i++) { list.push(value); } return list; } function arraySplice(array, index, count) { const length = array.length - count; while (index < length) { array[index] = array[index + count]; index++; } while (count--) { array.pop(); } } function arrayInsert2(array, index, value1, value2) { ngDevMode && assertLessThanOrEqual(index, array.length, "Can't insert past array end."); let end = array.length; if (end == index) { array.push(value1, value2); } else if (end === 1) { array.push(value2, array[0]); array[0] = value1; } else { end--; array.push(array[end - 1], array[end]); while (end > index) { const previousEnd = end - 2; array[end] = array[previousEnd]; end--; } array[index] = value1; array[index + 1] = value2; } } function keyValueArraySet(keyValueArray, key, value) { let index = keyValueArrayIndexOf(keyValueArray, key); if (index >= 0) { keyValueArray[index | 1] = value; } else { index = ~index; arrayInsert2(keyValueArray, index, key, value); } return index; } function keyValueArrayGet(keyValueArray, key) { const index = keyValueArrayIndexOf(keyValueArray, key); if (index >= 0) { return keyValueArray[index | 1]; } return void 0; } function keyValueArrayIndexOf(keyValueArray, key) { return _arrayIndexOfSorted(keyValueArray, key, 1); } function _arrayIndexOfSorted(array, value, shift) { ngDevMode && assertEqual(Array.isArray(array), true, "Expecting an array"); let start = 0; let end = array.length >> shift; while (end !== start) { const middle = start + (end - start >> 1); const current = array[middle << shift]; if (value === current) { return middle << shift; } else if (current > value) { end = middle; } else { start = middle + 1; } } return ~(end << shift); } var EMPTY_OBJ = {}; var EMPTY_ARRAY = []; if ((typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode()) { Object.freeze(EMPTY_OBJ); Object.freeze(EMPTY_ARRAY); } var ENVIRONMENT_INITIALIZER = new InjectionToken(ngDevMode ? "ENVIRONMENT_INITIALIZER" : ""); var INJECTOR$1 = new InjectionToken( ngDevMode ? "INJECTOR" : "", // Disable tslint because this is const enum which gets inlined not top level prop access. // tslint:disable-next-line: no-toplevel-property-access -1 /* InjectorMarkers.Injector */ ); var INJECTOR_DEF_TYPES = new InjectionToken(ngDevMode ? "INJECTOR_DEF_TYPES" : ""); var NullInjector = class { get(token, notFoundValue = THROW_IF_NOT_FOUND) { if (notFoundValue === THROW_IF_NOT_FOUND) { const error = new Error(`NullInjectorError: No provider for ${stringify(token)}!`); error.name = "NullInjectorError"; throw error; } return notFoundValue; } }; var ChangeDetectionStrategy; (function(ChangeDetectionStrategy2) { ChangeDetectionStrategy2[ChangeDetectionStrategy2["OnPush"] = 0] = "OnPush"; ChangeDetectionStrategy2[ChangeDetectionStrategy2["Default"] = 1] = "Default"; })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {})); var ViewEncapsulation$1; (function(ViewEncapsulation2) { ViewEncapsulation2[ViewEncapsulation2["Emulated"] = 0] = "Emulated"; ViewEncapsulation2[ViewEncapsulation2["None"] = 2] = "None"; ViewEncapsulation2[ViewEncapsulation2["ShadowDom"] = 3] = "ShadowDom"; })(ViewEncapsulation$1 || (ViewEncapsulation$1 = {})); var InputFlags; (function(InputFlags2) { InputFlags2[InputFlags2["None"] = 0] = "None"; InputFlags2[InputFlags2["SignalBased"] = 1] = "SignalBased"; InputFlags2[InputFlags2["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform"; })(InputFlags || (InputFlags = {})); function classIndexOf(className, classToSearch, startingIndex) { ngDevMode && assertNotEqual(classToSearch, "", 'can not look for "" string.'); let end = className.length; while (true) { const foundIndex = className.indexOf(classToSearch, startingIndex); if (foundIndex === -1) return foundIndex; if (foundIndex === 0 || className.charCodeAt(foundIndex - 1) <= 32) { const length = classToSearch.length; if (foundIndex + length === end || className.charCodeAt(foundIndex + length) <= 32) { return foundIndex; } } startingIndex = foundIndex + 1; } } function setUpAttributes(renderer, native, attrs) { let i = 0; while (i < attrs.length) { const value = attrs[i]; if (typeof value === "number") { if (value !== 0) { break; } i++; const namespaceURI = attrs[i++]; const attrName = attrs[i++]; const attrVal = attrs[i++]; ngDevMode && ngDevMode.rendererSetAttribute++; renderer.setAttribute(native, attrName, attrVal, namespaceURI); } else { const attrName = value; const attrVal = attrs[++i]; ngDevMode && ngDevMode.rendererSetAttribute++; if (isAnimationProp(attrName)) { renderer.setProperty(native, attrName, attrVal); } else { renderer.setAttribute(native, attrName, attrVal); } i++; } } return i; } function isNameOnlyAttributeMarker(marker) { return marker === 3 || marker === 4 || marker === 6; } function isAnimationProp(name) { return name.charCodeAt(0) === 64; } function mergeHostAttrs(dst, src) { if (src === null || src.length === 0) { } else if (dst === null || dst.length === 0) { dst = src.slice(); } else { let srcMarker = -1; for (let i = 0; i < src.length; i++) { const item = src[i]; if (typeof item === "number") { srcMarker = item; } else { if (srcMarker === 0) { } else if (srcMarker === -1 || srcMarker === 2) { mergeHostAttribute(dst, srcMarker, item, null, src[++i]); } else { mergeHostAttribute(dst, srcMarker, item, null, null); } } } } return dst; } function mergeHostAttribute(dst, marker, key1, key2, value) { let i = 0; let markerInsertPosition = dst.length; if (marker === -1) { markerInsertPosition = -1; } else { while (i < dst.length) { const dstValue = dst[i++]; if (typeof dstValue === "number") { if (dstValue === marker) { markerInsertPosition = -1; break; } else if (dstValue > marker) { markerInsertPosition = i - 1; break; } } } } while (i < dst.length) { const item = dst[i]; if (typeof item === "number") { break; } else if (item === key1) { if (key2 === null) { if (value !== null) { dst[i + 1] = value; } return; } else if (key2 === dst[i + 1]) { dst[i + 2] = value; return; } } i++; if (key2 !== null) i++; if (value !== null) i++; } if (markerInsertPosition !== -1) { dst.splice(markerInsertPosition, 0, marker); i = markerInsertPosition + 1; } dst.splice(i++, 0, key1); if (key2 !== null) { dst.splice(i++, 0, key2); } if (value !== null) { dst.splice(i++, 0, value); } } var NG_TEMPLATE_SELECTOR = "ng-template"; function isCssClassMatching(tNode, attrs, cssClassToMatch, isProjectionMode) { ngDevMode && assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), "Class name expected to be lowercase."); let i = 0; if (isProjectionMode) { for (; i < attrs.length && typeof attrs[i] === "string"; i += 2) { if (attrs[i] === "class" && classIndexOf(attrs[i + 1].toLowerCase(), cssClassToMatch, 0) !== -1) { return true; } } } else if (isInlineTemplate(tNode)) { return false; } i = attrs.indexOf(1, i); if (i > -1) { let item; while (++i < attrs.length && typeof (item = attrs[i]) === "string") { if (item.toLowerCase() === cssClassToMatch) { return true; } } } return false; } function isInlineTemplate(tNode) { return tNode.type === 4 && tNode.value !== NG_TEMPLATE_SELECTOR; } function hasTagAndTypeMatch(tNode, currentSelector, isProjectionMode) { const tagNameToCompare = tNode.type === 4 && !isProjectionMode ? NG_TEMPLATE_SELECTOR : tNode.value; return currentSelector === tagNameToCompare; } function isNodeMatchingSelector(tNode, selector, isProjectionMode) { ngDevMode && assertDefined(selector[0], "Selector should have a tag name"); let mode = 4; const nodeAttrs = tNode.attrs; const nameOnlyMarkerIdx = nodeAttrs !== null ? getNameOnlyMarkerIndex(nodeAttrs) : 0; let skipToNextSelector = false; for (let i = 0; i < selector.length; i++) { const current = selector[i]; if (typeof current === "number") { if (!skipToNextSelector && !isPositive(mode) && !isPositive(current)) { return false; } if (skipToNextSelector && isPositive(current)) continue; skipToNextSelector = false; mode = current | mode & 1; continue; } if (skipToNextSelector) continue; if (mode & 4) { mode = 2 | mode & 1; if (current !== "" && !hasTagAndTypeMatch(tNode, current, isProjectionMode) || current === "" && selector.length === 1) { if (isPositive(mode)) return false; skipToNextSelector = true; } } else if (mode & 8) { if (nodeAttrs === null || !isCssClassMatching(tNode, nodeAttrs, current, isProjectionMode)) { if (isPositive(mode)) return false; skipToNextSelector = true; } } else { const selectorAttrValue = selector[++i]; const attrIndexInNode = findAttrIndexInNode(current, nodeAttrs, isInlineTemplate(tNode), isProjectionMode); if (attrIndexInNode === -1) { if (isPositive(mode)) return false; skipToNextSelector = true; continue; } if (selectorAttrValue !== "") { let nodeAttrValue; if (attrIndexInNode > nameOnlyMarkerIdx) { nodeAttrValue = ""; } else { ngDevMode && assertNotEqual(nodeAttrs[attrIndexInNode], 0, "We do not match directives on namespaced attributes"); nodeAttrValue = nodeAttrs[attrIndexInNode + 1].toLowerCase(); } if (mode & 2 && selectorAttrValue !== nodeAttrValue) { if (isPositive(mode)) return false; skipToNextSelector = true; } } } } return isPositive(mode) || skipToNextSelector; } function isPositive(mode) { return (mode & 1) === 0; } function findAttrIndexInNode(name, attrs, isInlineTemplate2, isProjectionMode) { if (attrs === null) return -1; let i = 0; if (isProjectionMode || !isInlineTemplate2) { let bindingsMode = false; while (i < attrs.length) { const maybeAttrName = attrs[i]; if (maybeAttrName === name) { return i; } else if (maybeAttrName === 3 || maybeAttrName === 6) { bindingsMode = true; } else if (maybeAttrName === 1 || maybeAttrName === 2) { let value = attrs[++i]; while (typeof value === "string") { value = attrs[++i]; } continue; } else if (maybeAttrName === 4) { break; } else if (maybeAttrName === 0) { i += 4; continue; } i += bindingsMode ? 1 : 2; } return -1; } else { return matchTemplateAttribute(attrs, name); } } function isNodeMatchingSelectorList(tNode, selector, isProjectionMode = false) { for (let i = 0; i < selector.length; i++) { if (isNodeMatchingSelector(tNode, selector[i], isProjectionMode)) { return true; } } return false; } function getProjectAsAttrValue(tNode) { const nodeAttrs = tNode.attrs; if (nodeAttrs != null) { const ngProjectAsAttrIdx = nodeAttrs.indexOf( 5 /* AttributeMarker.ProjectAs */ ); if ((ngProjectAsAttrIdx & 1) === 0) { return nodeAttrs[ngProjectAsAttrIdx + 1]; } } return null; } function getNameOnlyMarkerIndex(nodeAttrs) { for (let i = 0; i < nodeAttrs.length; i++) { const nodeAttr = nodeAttrs[i]; if (isNameOnlyAttributeMarker(nodeAttr)) { return i; } } return nodeAttrs.length; } function matchTemplateAttribute(attrs, name) { let i = attrs.indexOf( 4 /* AttributeMarker.Template */ ); if (i > -1) { i++; while (i < attrs.length) { const attr = attrs[i]; if (typeof attr === "number") return -1; if (attr === name) return i; i++; } } return -1; } function isSelectorInSelectorList(selector, list) { selectorListLoop: for (let i = 0; i < list.length; i++) { const currentSelectorInList = list[i]; if (selector.length !== currentSelectorInList.length) { continue; } for (let j = 0; j < selector.length; j++) { if (selector[j] !== currentSelectorInList[j]) { continue selectorListLoop; } } return true; } return false; } function maybeWrapInNotSelector(isNegativeMode, chunk) { return isNegativeMode ? ":not(" + chunk.trim() + ")" : chunk; } function stringifyCSSSelector(selector) { let result = selector[0]; let i = 1; let mode = 2; let currentChunk = ""; let isNegativeMode = false; while (i < selector.length) { let valueOrMarker = selector[i]; if (typeof valueOrMarker === "string") { if (mode & 2) { const attrValue = selector[++i]; currentChunk += "[" + valueOrMarker + (attrValue.length > 0 ? '="' + attrValue + '"' : "") + "]"; } else if (mode & 8) { currentChunk += "." + valueOrMarker; } else if (mode & 4) { currentChunk += " " + valueOrMarker; } } else { if (currentChunk !== "" && !isPositive(valueOrMarker)) { result += maybeWrapInNotSelector(isNegativeMode, currentChunk); currentChunk = ""; } mode = valueOrMarker; isNegativeMode = isNegativeMode || !isPositive(mode); } i++; } if (currentChunk !== "") { result += maybeWrapInNotSelector(isNegativeMode, currentChunk); } return result; } function stringifyCSSSelectorList(selectorList) { return selectorList.map(stringifyCSSSelector).join(","); } function extractAttrsAndClassesFromSelector(selector) { const attrs = []; const classes = []; let i = 1; let mode = 2; while (i < selector.length) { let valueOrMarker = selector[i]; if (typeof valueOrMarker === "string") { if (mode === 2) { if (valueOrMarker !== "") { attrs.push(valueOrMarker, selector[++i]); } } else if (mode === 8) { classes.push(valueOrMarker); } } else { if (!isPositive(mode)) break; mode = valueOrMarker; } i++; } return { attrs, classes }; } function \u0275\u0275defineComponent(componentDefinition) { return noSideEffects(() => { (typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode(); const baseDef = getNgDirectiveDef(componentDefinition); const def = __spreadProps(__spreadValues({}, baseDef), { decls: componentDefinition.decls, vars: componentDefinition.vars, template: componentDefinition.template, consts: componentDefinition.consts || null, ngContentSelectors: componentDefinition.ngContentSelectors, onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush, directiveDefs: null, // assigned in noSideEffects pipeDefs: null, // assigned in noSideEffects dependencies: baseDef.standalone && componentDefinition.dependencies || null, getStandaloneInjector: null, signals: componentDefinition.signals ?? false, data: componentDefinition.data || {}, encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated, styles: componentDefinition.styles || EMPTY_ARRAY, _: null, schemas: componentDefinition.schemas || null, tView: null, id: "" }); initFeatures(def); const dependencies = componentDefinition.dependencies; def.directiveDefs = extractDefListOrFactory( dependencies, /* pipeDef */ false ); def.pipeDefs = extractDefListOrFactory( dependencies, /* pipeDef */ true ); def.id = getComponentId(def); return def; }); } function extractDirectiveDef(type) { return getComponentDef(type) || getDirectiveDef(type); } function nonNull(value) { return value !== null; } function \u0275\u0275defineNgModule(def) { return noSideEffects(() => { const res = { type: def.type, bootstrap: def.bootstrap || EMPTY_ARRAY, declarations: def.declarations || EMPTY_ARRAY, imports: def.imports || EMPTY_ARRAY, exports: def.exports || EMPTY_ARRAY, transitiveCompileScopes: null, schemas: def.schemas || null, id: def.id || null }; return res; }); } function parseAndConvertBindingsForDefinition(obj, declaredInputs) { if (obj == null) return EMPTY_OBJ; const newLookup = {}; for (const minifiedKey in obj) { if (obj.hasOwnProperty(minifiedKey)) { const value = obj[minifiedKey]; let publicName; let declaredName; let inputFlags = InputFlags.None; if (Array.isArray(value)) { inputFlags = value[0]; publicName = value[1]; declaredName = value[2] ?? publicName; } else { publicName = value; declaredName = value; } if (declaredInputs) { newLookup[publicName] = inputFlags !== InputFlags.None ? [minifiedKey, inputFlags] : minifiedKey; declaredInputs[publicName] = declaredName; } else { newLookup[publicName] = minifiedKey; } } } return newLookup; } function \u0275\u0275defineDirective(directiveDefinition) { return noSideEffects(() => { const def = getNgDirectiveDef(directiveDefinition); initFeatures(def); return def; }); } function \u0275\u0275definePipe(pipeDef) { return { type: pipeDef.type, name: pipeDef.name, factory: null, pure: pipeDef.pure !== false, standalone: pipeDef.standalone === true, onDestroy: pipeDef.type.prototype.ngOnDestroy || null }; } function getComponentDef(type) { return type[NG_COMP_DEF] || null; } function getDirectiveDef(type) { return type[NG_DIR_DEF] || null; } function getPipeDef$1(type) { return type[NG_PIPE_DEF] || null; } function isStandalone(type) { const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type); return def !== null ? def.standalone : false; } function getNgModuleDef(type, throwNotFound) { const ngModuleDef = type[NG_MOD_DEF] || null; if (!ngModuleDef && throwNotFound === true) { throw new Error(`Type ${stringify(type)} does not have '\u0275mod' property.`); } return ngModuleDef; } function getNgDirectiveDef(directiveDefinition) { const declaredInputs = {}; return { type: directiveDefinition.type, providersResolver: null, factory: null, hostBindings: directiveDefinition.hostBindings || null, hostVars: directiveDefinition.hostVars || 0, hostAttrs: directiveDefinition.hostAttrs || null, contentQueries: directiveDefinition.contentQueries || null, declaredInputs, inputTransforms: null, inputConfig: directiveDefinition.inputs || EMPTY_OBJ, exportAs: directiveDefinition.exportAs || null, standalone: directiveDefinition.standalone === true, signals: directiveDefinition.signals === true, selectors: directiveDefinition.selectors || EMPTY_ARRAY, viewQuery: directiveDefinition.viewQuery || null, features: directiveDefinition.features || null, setInput: null, findHostDirectiveDefs: null, hostDirectives: null, inputs: parseAndConvertBindingsForDefinition(directiveDefinition.inputs, declaredInputs), outputs: parseAndConvertBindingsForDefinition(directiveDefinition.outputs), debugInfo: null }; } function initFeatures(definition) { definition.features?.forEach((fn) => fn(definition)); } function extractDefListOrFactory(dependencies, pipeDef) { if (!dependencies) { return null; } const defExtractor = pipeDef ? getPipeDef$1 : extractDirectiveDef; return () => (typeof dependencies === "function" ? dependencies() : dependencies).map((dep) => defExtractor(dep)).filter(nonNull); } var GENERATED_COMP_IDS = /* @__PURE__ */ new Map(); function getComponentId(componentDef) { let hash = 0; const hashSelectors = [ componentDef.selectors, componentDef.ngContentSelectors, componentDef.hostVars, componentDef.hostAttrs, componentDef.consts, componentDef.vars, componentDef.decls, componentDef.encapsulation, componentDef.standalone, componentDef.signals, componentDef.exportAs, JSON.stringify(componentDef.inputs), JSON.stringify(componentDef.outputs), // We cannot use 'componentDef.type.name' as the name of the symbol will change and will not // match in the server and browser bundles. Object.getOwnPropertyNames(componentDef.type.prototype), !!componentDef.contentQueries, !!componentDef.viewQuery ].join("|"); for (const char of hashSelectors) { hash = Math.imul(31, hash) + char.charCodeAt(0) << 0; } hash += 2147483647 + 1; const compId = "c" + hash; if (typeof ngDevMode === "undefined" || ngDevMode) { if (GENERATED_COMP_IDS.has(compId)) { const previousCompDefType = GENERATED_COMP_IDS.get(compId); if (previousCompDefType !== componentDef.type) { console.warn(formatRuntimeError(-912, `Component ID generation collision detected. Components '${previousCompDefType.name}' and '${componentDef.type.name}' with selector '${stringifyCSSSelectorList(componentDef.selectors)}' generated the same component ID. To fix this, you can change the selector of one of those components or add an extra host attribute to force a different ID.`)); } } else { GENERATED_COMP_IDS.set(compId, componentDef.type); } } return compId; } function makeEnvironmentProviders(providers) { return { \u0275providers: providers }; } function importProvidersFrom(...sources) { return { \u0275providers: internalImportProvidersFrom(true, sources), \u0275fromNgModule: true }; } function internalImportProvidersFrom(checkForStandaloneCmp, ...sources) { const providersOut = []; const dedup = /* @__PURE__ */ new Set(); let injectorTypesWithProviders; const collectProviders = (provider) => { providersOut.push(provider); }; deepForEach(sources, (source) => { if ((typeof ngDevMode === "undefined" || ngDevMode) && checkForStandaloneCmp) { const cmpDef = getComponentDef(source); if (cmpDef?.standalone) { throw new RuntimeError(800, `Importing providers supports NgModule or ModuleWithProviders but got a standalone component "${stringifyForError(source)}"`); } } const internalSource = source; if (walkProviderTree(internalSource, collectProviders, [], dedup)) { injectorTypesWithProviders ||= []; injectorTypesWithProviders.push(internalSource); } }); if (injectorTypesWithProviders !== void 0) { processInjectorTypesWithProviders(injectorTypesWithProviders, collectProviders); } return providersOut; } function processInjectorTypesWithProviders(typesWithProviders, visitor) { for (let i = 0; i < typesWithProviders.length; i++) { const { ngModule, providers } = typesWithProviders[i]; deepForEachProvider(providers, (provider) => { ngDevMode && validateProvider(provider, providers || EMPTY_ARRAY, ngModule); visitor(provider, ngModule); }); } } function walkProviderTree(container, visitor, parents, dedup) { container = resolveForwardRef(container); if (!container) return false; let defType = null; let injDef = getInjectorDef(container); const cmpDef = !injDef && getComponentDef(container); if (!injDef && !cmpDef) { const ngModule = container.ngModule; injDef = getInjectorDef(ngModule); if (injDef) { defType = ngModule; } else { return false; } } else if (cmpDef && !cmpDef.standalone) { return false; } else { defType = container; } if (ngDevMode && parents.indexOf(defType) !== -1) { const defName = stringify(defType); const path = parents.map(stringify); throwCyclicDependencyError(defName, path); } const isDuplicate = dedup.has(defType); if (cmpDef) { if (isDuplicate) { return false; } dedup.add(defType); if (cmpDef.dependencies) { const deps = typeof cmpDef.dependencies === "function" ? cmpDef.dependencies() : cmpDef.dependencies; for (const dep of deps) { walkProviderTree(dep, visitor, parents, dedup); } } } else if (injDef) { if (injDef.imports != null && !isDuplicate) { ngDevMode && parents.push(defType); dedup.add(defType); let importTypesWithProviders; try { deepForEach(injDef.imports, (imported) => { if (walkProviderTree(imported, visitor, parents, dedup)) { importTypesWithProviders ||= []; importTypesWithProviders.push(imported); } }); } finally { ngDevMode && parents.pop(); } if (importTypesWithProviders !== void 0) { processInjectorTypesWithProviders(importTypesWithProviders, visitor); } } if (!isDuplicate) { const factory = getFactoryDef(defType) || (() => new defType()); visitor({ provide: defType, useFactory: factory, deps: EMPTY_ARRAY }, defType); visitor({ provide: INJECTOR_DEF_TYPES, useValue: defType, multi: true }, defType); visitor({ provide: ENVIRONMENT_INITIALIZER, useValue: () => \u0275\u0275inject(defType), multi: true }, defType); } const defProviders = injDef.providers; if (defProviders != null && !isDuplicate) { const injectorType = container; deepForEachProvider(defProviders, (provider) => { ngDevMode && validateProvider(provider, defProviders, injectorType); visitor(provider, injectorType); }); } } else { return false; } return defType !== container && container.providers !== void 0; } function validateProvider(provider, providers, containerType) { if (isTypeProvider(provider) || isValueProvider(provider) || isFactoryProvider(provider) || isExistingProvider(provider)) { return; } const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide)); if (!classRef) { throwInvalidProviderError(containerType, providers, provider); } } function deepForEachProvider(providers, fn) { for (let provider of providers) { if (isEnvironmentProviders(provider)) { provider = provider.\u0275providers; } if (Array.isArray(provider)) { deepForEachProvider(provider, fn); } else { fn(provider); } } } var USE_VALUE$1 = getClosureSafeProperty({ provide: String, useValue: getClosureSafeProperty }); function isValueProvider(value) { return value !== null && typeof value == "object" && USE_VALUE$1 in value; } function isExistingProvider(value) { return !!(value && value.useExisting); } function isFactoryProvider(value) { return !!(value && value.useFactory); } function isTypeProvider(value) { return typeof value === "function"; } function isClassProvider(value) { return !!value.useClass; } var INJECTOR_SCOPE = new InjectionToken(ngDevMode ? "Set Injector scope." : ""); var NOT_YET = {}; var CIRCULAR = {}; var NULL_INJECTOR = void 0; function getNullInjector() { if (NULL_INJECTOR === void 0) { NULL_INJECTOR = new NullInjector(); } return NULL_INJECTOR; } var EnvironmentInjector = class { }; var R3Injector = class extends EnvironmentInjector { /** * Flag indicating that this injector was previously destroyed. */ get destroyed() { return this._destroyed; } constructor(providers, parent, source, scopes) { super(); this.parent = parent; this.source = source; this.scopes = scopes; this.records = /* @__PURE__ */ new Map(); this._ngOnDestroyHooks = /* @__PURE__ */ new Set(); this._onDestroyHooks = []; this._destroyed = false; forEachSingleProvider(providers, (provider) => this.processProvider(provider)); this.records.set(INJECTOR$1, makeRecord(void 0, this)); if (scopes.has("environment")) { this.records.set(EnvironmentInjector, makeRecord(void 0, this)); } const record = this.records.get(INJECTOR_SCOPE); if (record != null && typeof record.value === "string") { this.scopes.add(record.value); } this.injectorDefTypes = new Set(this.get(INJECTOR_DEF_TYPES, EMPTY_ARRAY, InjectFlags.Self)); } /** * Destroy the injector and release references to every instance or provider associated with it. * * Also calls the `OnDestroy` lifecycle hooks of every instance that was created for which a * hook was found. */ destroy() { this.assertNotDestroyed(); this._destroyed = true; const prevConsumer = setActiveConsumer(null); try { for (const service of this._ngOnDestroyHooks) { service.ngOnDestroy(); } const onDestroyHooks = this._onDestroyHooks; this._onDestroyHooks = []; for (const hook of onDestroyHooks) { hook(); } } finally { this.records.clear(); this._ngOnDestroyHooks.clear(); this.injectorDefTypes.clear(); setActiveConsumer(prevConsumer); } } onDestroy(callback) { this.assertNotDestroyed(); this._onDestroyHooks.push(callback); return () => this.removeOnDestroy(callback); } runInContext(fn) { this.assertNotDestroyed(); const previousInjector = setCurrentInjector(this); const previousInjectImplementation = setInjectImplementation(void 0); let prevInjectContext; if (ngDevMode) { prevInjectContext = setInjectorProfilerContext({ injector: this, token: null }); } try { return fn(); } finally { setCurrentInjector(previousInjector); setInjectImplementation(previousInjectImplementation); ngDevMode && setInjectorProfilerContext(prevInjectContext); } } get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) { this.assertNotDestroyed(); if (token.hasOwnProperty(NG_ENV_ID)) { return token[NG_ENV_ID](this); } flags = convertToBitFlags(flags); let prevInjectContext; if (ngDevMode) { prevInjectContext = setInjectorProfilerContext({ injector: this, token }); } const previousInjector = setCurrentInjector(this); const previousInjectImplementation = setInjectImplementation(void 0); try { if (!(flags & InjectFlags.SkipSelf)) { let record = this.records.get(token); if (record === void 0) { const def = couldBeInjectableType(token) && getInjectableDef(token); if (def && this.injectableDefInScope(def)) { if (ngDevMode) { runInInjectorProfilerContext(this, token, () => { emitProviderConfiguredEvent(token); }); } record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET); } else { record = null; } this.records.set(token, record); } if (record != null) { return this.hydrate(token, record); } } const nextInjector = !(flags & InjectFlags.Self) ? this.parent : getNullInjector(); notFoundValue = flags & InjectFlags.Optional && notFoundValue === THROW_IF_NOT_FOUND ? null : notFoundValue; return nextInjector.get(token, notFoundValue); } catch (e) { if (e.name === "NullInjectorError") { const path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || []; path.unshift(stringify(token)); if (previousInjector) { throw e; } else { return catchInjectorError(e, token, "R3InjectorError", this.source); } } else { throw e; } } finally { setInjectImplementation(previousInjectImplementation); setCurrentInjector(previousInjector); ngDevMode && setInjectorProfilerContext(prevInjectContext); } } /** @internal */ resolveInjectorInitializers() { const prevConsumer = setActiveConsumer(null); const previousInjector = setCurrentInjector(this); const previousInjectImplementation = setInjectImplementation(void 0); let prevInjectContext; if (ngDevMode) { prevInjectContext = setInjectorProfilerContext({ injector: this, token: null }); } try { const initializers = this.get(ENVIRONMENT_INITIALIZER, EMPTY_ARRAY, InjectFlags.Self); if (ngDevMode && !Array.isArray(initializers)) { throw new RuntimeError(-209, `Unexpected type of the \`ENVIRONMENT_INITIALIZER\` token value (expected an array, but got ${typeof initializers}). Please check that the \`ENVIRONMENT_INITIALIZER\` token is configured as a \`multi: true\` provider.`); } for (const initializer of initializers) { initializer(); } } finally { setCurrentInjector(previousInjector); setInjectImplementation(previousInjectImplementation); ngDevMode && setInjectorProfilerContext(prevInjectContext); setActiveConsumer(prevConsumer); } } toString() { const tokens = []; const records = this.records; for (const token of records.keys()) { tokens.push(stringify(token)); } return `R3Injector[${tokens.join(", ")}]`; } assertNotDestroyed() { if (this._destroyed) { throw new RuntimeError(205, ngDevMode && "Injector has already been destroyed."); } } /** * Process a `SingleProvider` and add it. */ processProvider(provider) { provider = resolveForwardRef(provider); let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide); const record = providerToRecord(provider); if (ngDevMode) { runInInjectorProfilerContext(this, token, () => { if (isValueProvider(provider)) { emitInstanceCreatedByInjectorEvent(provider.useValue); } emitProviderConfiguredEvent(provider); }); } if (!isTypeProvider(provider) && provider.multi === true) { let multiRecord = this.records.get(token); if (multiRecord) { if (ngDevMode && multiRecord.multi === void 0) { throwMixedMultiProviderError(); } } else { multiRecord = makeRecord(void 0, NOT_YET, true); multiRecord.factory = () => injectArgs(multiRecord.multi); this.records.set(token, multiRecord); } token = provider; multiRecord.multi.push(provider); } else { if (ngDevMode) { const existing = this.records.get(token); if (existing && existing.multi !== void 0) { throwMixedMultiProviderError(); } } } this.records.set(token, record); } hydrate(token, record) { const prevConsumer = setActiveConsumer(null); try { if (ngDevMode && record.value === CIRCULAR) { throwCyclicDependencyError(stringify(token)); } else if (record.value === NOT_YET) { record.value = CIRCULAR; if (ngDevMode) { runInInjectorProfilerContext(this, token, () => { record.value = record.factory(); emitInstanceCreatedByInjectorEvent(record.value); }); } else { record.value = record.factory(); } } if (typeof record.value === "object" && record.value && hasOnDestroy(record.value)) { this._ngOnDestroyHooks.add(record.value); } return record.value; } finally { setActiveConsumer(prevConsumer); } } injectableDefInScope(def) { if (!def.providedIn) { return false; } const providedIn = resolveForwardRef(def.providedIn); if (typeof providedIn === "string") { return providedIn === "any" || this.scopes.has(providedIn); } else { return this.injectorDefTypes.has(providedIn); } } removeOnDestroy(callback) { const destroyCBIdx = this._onDestroyHooks.indexOf(callback); if (destroyCBIdx !== -1) { this._onDestroyHooks.splice(destroyCBIdx, 1); } } }; function injectableDefOrInjectorDefFactory(token) { const injectableDef = getInjectableDef(token); const factory = injectableDef !== null ? injectableDef.factory : getFactoryDef(token); if (factory !== null) { return factory; } if (token instanceof InjectionToken) { throw new RuntimeError(204, ngDevMode && `Token ${stringify(token)} is missing a \u0275prov definition.`); } if (token instanceof Function) { return getUndecoratedInjectableFactory(token); } throw new RuntimeError(204, ngDevMode && "unreachable"); } function getUndecoratedInjectableFactory(token) { const paramLength = token.length; if (paramLength > 0) { throw new RuntimeError(204, ngDevMode && `Can't resolve all parameters for ${stringify(token)}: (${newArray(paramLength, "?").join(", ")}).`); } const inheritedInjectableDef = getInheritedInjectableDef(token); if (inheritedInjectableDef !== null) { return () => inheritedInjectableDef.factory(token); } else { return () => new token(); } } function providerToRecord(provider) { if (isValueProvider(provider)) { return makeRecord(void 0, provider.useValue); } else { const factory = providerToFactory(provider); return makeRecord(factory, NOT_YET); } } function providerToFactory(provider, ngModuleType, providers) { let factory = void 0; if (ngDevMode && isEnvironmentProviders(provider)) { throwInvalidProviderError(void 0, providers, provider); } if (isTypeProvider(provider)) { const unwrappedProvider = resolveForwardRef(provider); return getFactoryDef(unwrappedProvider) || injectableDefOrInjectorDefFactory(unwrappedProvider); } else { if (isValueProvider(provider)) { factory = () => resolveForwardRef(provider.useValue); } else if (isFactoryProvider(provider)) { factory = () => provider.useFactory(...injectArgs(provider.deps || [])); } else if (isExistingProvider(provider)) { factory = () => \u0275\u0275inject(resolveForwardRef(provider.useExisting)); } else { const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide)); if (ngDevMode && !classRef) { throwInvalidProviderError(ngModuleType, providers, provider); } if (hasDeps(provider)) { factory = () => new classRef(...injectArgs(provider.deps)); } else { return getFactoryDef(classRef) || injectableDefOrInjectorDefFactory(classRef); } } } return factory; } function makeRecord(factory, value, multi = false) { return { factory, value, multi: multi ? [] : void 0 }; } function hasDeps(value) { return !!value.deps; } function hasOnDestroy(value) { return value !== null && typeof value === "object" && typeof value.ngOnDestroy === "function"; } function couldBeInjectableType(value) { return typeof value === "function" || typeof value === "object" && value instanceof InjectionToken; } function forEachSingleProvider(providers, fn) { for (const provider of providers) { if (Array.isArray(provider)) { forEachSingleProvider(provider, fn); } else if (provider && isEnvironmentProviders(provider)) { forEachSingleProvider(provider.\u0275providers, fn); } else { fn(provider); } } } function runInInjectionContext(injector, fn) { if (injector instanceof R3Injector) { injector.assertNotDestroyed(); } let prevInjectorProfilerContext; if (ngDevMode) { prevInjectorProfilerContext = setInjectorProfilerContext({ injector, token: null }); } const prevInjector = setCurrentInjector(injector); const previousInjectImplementation = setInjectImplementation(void 0); try { return fn(); } finally { setCurrentInjector(prevInjector); ngDevMode && setInjectorProfilerContext(prevInjectorProfilerContext); setInjectImplementation(previousInjectImplementation); } } function isInInjectionContext() { return getInjectImplementation() !== void 0 || getCurrentInjector() != null; } function assertInInjectionContext(debugFn) { if (!isInInjectionContext()) { throw new RuntimeError(-203, ngDevMode && debugFn.name + "() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`"); } } var FactoryTarget; (function(FactoryTarget2) { FactoryTarget2[FactoryTarget2["Directive"] = 0] = "Directive"; FactoryTarget2[FactoryTarget2["Component"] = 1] = "Component"; FactoryTarget2[FactoryTarget2["Injectable"] = 2] = "Injectable"; FactoryTarget2[FactoryTarget2["Pipe"] = 3] = "Pipe"; FactoryTarget2[FactoryTarget2["NgModule"] = 4] = "NgModule"; })(FactoryTarget || (FactoryTarget = {})); var R3TemplateDependencyKind; (function(R3TemplateDependencyKind2) { R3TemplateDependencyKind2[R3TemplateDependencyKind2["Directive"] = 0] = "Directive"; R3TemplateDependencyKind2[R3TemplateDependencyKind2["Pipe"] = 1] = "Pipe"; R3TemplateDependencyKind2[R3TemplateDependencyKind2["NgModule"] = 2] = "NgModule"; })(R3TemplateDependencyKind || (R3TemplateDependencyKind = {})); var ViewEncapsulation; (function(ViewEncapsulation2) { ViewEncapsulation2[ViewEncapsulation2["Emulated"] = 0] = "Emulated"; ViewEncapsulation2[ViewEncapsulation2["None"] = 2] = "None"; ViewEncapsulation2[ViewEncapsulation2["ShadowDom"] = 3] = "ShadowDom"; })(ViewEncapsulation || (ViewEncapsulation = {})); function getCompilerFacade(request) { const globalNg = _global["ng"]; if (globalNg && globalNg.\u0275compilerFacade) { return globalNg.\u0275compilerFacade; } if (typeof ngDevMode === "undefined" || ngDevMode) { console.error(`JIT compilation failed for ${request.kind}`, request.type); let message = `The ${request.kind} '${request.type.name}' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available. `; if (request.usage === 1) { message += `The ${request.kind} is part of a library that has been partially compiled. `; message += `However, the Angular Linker has not processed the library such that JIT compilation is used as fallback. `; message += "\n"; message += `Ideally, the library is processed using the Angular Linker to become fully AOT compiled. `; } else { message += `JIT compilation is discouraged for production use-cases! Consider using AOT mode instead. `; } message += `Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server', `; message += `or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.`; throw new Error(message); } else { throw new Error("JIT compiler unavailable"); } } var angularCoreDiEnv = { "\u0275\u0275defineInjectable": \u0275\u0275defineInjectable, "\u0275\u0275defineInjector": \u0275\u0275defineInjector, "\u0275\u0275inject": \u0275\u0275inject, "\u0275\u0275invalidFactoryDep": \u0275\u0275invalidFactoryDep, "resolveForwardRef": resolveForwardRef }; var Type = Function; function isType(v) { return typeof v === "function"; } var ES5_DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*(arguments|(?:[^()]+\(\[\],)?[^()]+\(arguments\).*)\)/; var ES2015_INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{/; var ES2015_INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(/; var ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{[^}]*super\(\.\.\.arguments\)/; function isDelegateCtor(typeStr) { return ES5_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr); } var ReflectionCapabilities = class { constructor(reflect) { this._reflect = reflect || _global["Reflect"]; } factory(t) { return (...args) => new t(...args); } /** @internal */ _zipTypesAndAnnotations(paramTypes, paramAnnotations) { let result; if (typeof paramTypes === "undefined") { result = newArray(paramAnnotations.length); } else { result = newArray(paramTypes.length); } for (let i = 0; i < result.length; i++) { if (typeof paramTypes === "undefined") { result[i] = []; } else if (paramTypes[i] && paramTypes[i] != Object) { result[i] = [paramTypes[i]]; } else { result[i] = []; } if (paramAnnotations && paramAnnotations[i] != null) { result[i] = result[i].concat(paramAnnotations[i]); } } return result; } _ownParameters(type, parentCtor) { const typeStr = type.toString(); if (isDelegateCtor(typeStr)) { return null; } if (type.parameters && type.parameters !== parentCtor.parameters) { return type.parameters; } const tsickleCtorParams = type.ctorParameters; if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) { const ctorParameters = typeof tsickleCtorParams === "function" ? tsickleCtorParams() : tsickleCtorParams; const paramTypes2 = ctorParameters.map((ctorParam) => ctorParam && ctorParam.type); const paramAnnotations2 = ctorParameters.map((ctorParam) => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators)); return this._zipTypesAndAnnotations(paramTypes2, paramAnnotations2); } const paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS]; const paramTypes = this._reflect && this._reflect.getOwnMetadata && this._reflect.getOwnMetadata("design:paramtypes", type); if (paramTypes || paramAnnotations) { return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); } return newArray(type.length); } parameters(type) { if (!isType(type)) { return []; } const parentCtor = getParentCtor(type); let parameters = this._ownParameters(type, parentCtor); if (!parameters && parentCtor !== Object) { parameters = this.parameters(parentCtor); } return parameters || []; } _ownAnnotations(typeOrFunc, parentCtor) { if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) { let annotations = typeOrFunc.annotations; if (typeof annotations === "function" && annotations.annotations) { annotations = annotations.annotations; } return annotations; } if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) { return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators); } if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) { return typeOrFunc[ANNOTATIONS]; } return null; } annotations(typeOrFunc) { if (!isType(typeOrFunc)) { return []; } const parentCtor = getParentCtor(typeOrFunc); const ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || []; const parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : []; return parentAnnotations.concat(ownAnnotations); } _ownPropMetadata(typeOrFunc, parentCtor) { if (typeOrFunc.propMetadata && typeOrFunc.propMetadata !== parentCtor.propMetadata) { let propMetadata = typeOrFunc.propMetadata; if (typeof propMetadata === "function" && propMetadata.propMetadata) { propMetadata = propMetadata.propMetadata; } return propMetadata; } if (typeOrFunc.propDecorators && typeOrFunc.propDecorators !== parentCtor.propDecorators) { const propDecorators = typeOrFunc.propDecorators; const propMetadata = {}; Object.keys(propDecorators).forEach((prop) => { propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]); }); return propMetadata; } if (typeOrFunc.hasOwnProperty(PROP_METADATA)) { return typeOrFunc[PROP_METADATA]; } return null; } propMetadata(typeOrFunc) { if (!isType(typeOrFunc)) { return {}; } const parentCtor = getParentCtor(typeOrFunc); const propMetadata = {}; if (parentCtor !== Object) { const parentPropMetadata = this.propMetadata(parentCtor); Object.keys(parentPropMetadata).forEach((propName) => { propMetadata[propName] = parentPropMetadata[propName]; }); } const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor); if (ownPropMetadata) { Object.keys(ownPropMetadata).forEach((propName) => { const decorators = []; if (propMetadata.hasOwnProperty(propName)) { decorators.push(...propMetadata[propName]); } decorators.push(...ownPropMetadata[propName]); propMetadata[propName] = decorators; }); } return propMetadata; } ownPropMetadata(typeOrFunc) { if (!isType(typeOrFunc)) { return {}; } return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {}; } hasLifecycleHook(type, lcProperty) { return type instanceof Type && lcProperty in type.prototype; } }; function convertTsickleDecoratorIntoMetadata(decoratorInvocations) { if (!decoratorInvocations) { return []; } return decoratorInvocations.map((decoratorInvocation) => { const decoratorType = decoratorInvocation.type; const annotationCls = decoratorType.annotationCls; const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : []; return new annotationCls(...annotationArgs); }); } function getParentCtor(ctor) { const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null; const parentCtor = parentProto ? parentProto.constructor : null; return parentCtor || Object; } var HOST = 0; var TVIEW = 1; var FLAGS = 2; var PARENT = 3; var NEXT = 4; var T_HOST = 5; var HYDRATION = 6; var CLEANUP = 7; var CONTEXT = 8; var INJECTOR = 9; var ENVIRONMENT = 10; var RENDERER = 11; var CHILD_HEAD = 12; var CHILD_TAIL = 13; var DECLARATION_VIEW = 14; var DECLARATION_COMPONENT_VIEW = 15; var DECLARATION_LCONTAINER = 16; var PREORDER_HOOK_FLAGS = 17; var QUERIES = 18; var ID = 19; var EMBEDDED_VIEW_INJECTOR = 20; var ON_DESTROY_HOOKS = 21; var EFFECTS_TO_SCHEDULE = 22; var REACTIVE_TEMPLATE_CONSUMER = 23; var HEADER_OFFSET = 25; var TYPE = 1; var NATIVE = 7; var VIEW_REFS = 8; var MOVED_VIEWS = 9; var CONTAINER_HEADER_OFFSET = 10; var LContainerFlags; (function(LContainerFlags2) { LContainerFlags2[LContainerFlags2["None"] = 0] = "None"; LContainerFlags2[LContainerFlags2["HasTransplantedViews"] = 2] = "HasTransplantedViews"; })(LContainerFlags || (LContainerFlags = {})); function isLView(value) { return Array.isArray(value) && typeof value[TYPE] === "object"; } function isLContainer(value) { return Array.isArray(value) && value[TYPE] === true; } function isContentQueryHost(tNode) { return (tNode.flags & 4) !== 0; } function isComponentHost(tNode) { return tNode.componentOffset > -1; } function isDirectiveHost(tNode) { return (tNode.flags & 1) === 1; } function isComponentDef(def) { return !!def.template; } function isRootView(target) { return (target[FLAGS] & 512) !== 0; } function isDestroyed(lView) { return (lView[FLAGS] & 256) === 256; } function assertTNodeForLView(tNode, lView) { assertTNodeForTView(tNode, lView[TVIEW]); } function assertTNodeForTView(tNode, tView) { assertTNode(tNode); const tData = tView.data; for (let i = HEADER_OFFSET; i < tData.length; i++) { if (tData[i] === tNode) { return; } } throwError("This TNode does not belong to this TView."); } function assertTNode(tNode) { assertDefined(tNode, "TNode must be defined"); if (!(tNode && typeof tNode === "object" && tNode.hasOwnProperty("directiveStylingLast"))) { throwError("Not of type TNode, got: " + tNode); } } function assertTIcu(tIcu) { assertDefined(tIcu, "Expected TIcu to be defined"); if (!(typeof tIcu.currentCaseLViewIndex === "number")) { throwError("Object is not of TIcu type."); } } function assertComponentType(actual, msg = "Type passed in is not ComponentType, it does not have '\u0275cmp' property.") { if (!getComponentDef(actual)) { throwError(msg); } } function assertNgModuleType(actual, msg = "Type passed in is not NgModuleType, it does not have '\u0275mod' property.") { if (!getNgModuleDef(actual)) { throwError(msg); } } function assertHasParent(tNode) { assertDefined(tNode, "currentTNode should exist!"); assertDefined(tNode.parent, "currentTNode should have a parent"); } function assertLContainer(value) { assertDefined(value, "LContainer must be defined"); assertEqual(isLContainer(value), true, "Expecting LContainer"); } function assertLViewOrUndefined(value) { value && assertEqual(isLView(value), true, "Expecting LView or undefined or null"); } function assertLView(value) { assertDefined(value, "LView must be defined"); assertEqual(isLView(value), true, "Expecting LView"); } function assertFirstCreatePass(tView, errMessage) { assertEqual(tView.firstCreatePass, true, errMessage || "Should only be called in first create pass."); } function assertFirstUpdatePass(tView, errMessage) { assertEqual(tView.firstUpdatePass, true, errMessage || "Should only be called in first update pass."); } function assertDirectiveDef(obj) { if (obj.type === void 0 || obj.selectors == void 0 || obj.inputs === void 0) { throwError(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`); } } function assertIndexInDeclRange(tView, index) { assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index); } function assertIndexInExpandoRange(lView, index) { const tView = lView[1]; assertBetween(tView.expandoStartIndex, lView.length, index); } function assertBetween(lower, upper, index) { if (!(lower <= index && index < upper)) { throwError(`Index out of range (expecting ${lower} <= ${index} < ${upper})`); } } function assertProjectionSlots(lView, errMessage) { assertDefined(lView[DECLARATION_COMPONENT_VIEW], "Component views should exist."); assertDefined(lView[DECLARATION_COMPONENT_VIEW][T_HOST].projection, errMessage || "Components with projection nodes () must have projection slots defined."); } function assertParentView(lView, errMessage) { assertDefined(lView, errMessage || "Component views should always have a parent view (component's host view)"); } function assertNoDuplicateDirectives(directives) { if (directives.length < 2) { return; } const seenDirectives = /* @__PURE__ */ new Set(); for (const current of directives) { if (seenDirectives.has(current)) { throw new RuntimeError(309, `Directive ${current.type.name} matches multiple times on the same element. Directives can only match an element once.`); } seenDirectives.add(current); } } function assertNodeInjector(lView, injectorIndex) { assertIndexInExpandoRange(lView, injectorIndex); assertIndexInExpandoRange( lView, injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ); assertNumber(lView[injectorIndex + 0], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 1], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 2], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 3], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 4], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 5], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 6], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 7], "injectorIndex should point to a bloom filter"); assertNumber(lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ], "injectorIndex should point to parent injector"); } var SimpleChange = class { constructor(previousValue, currentValue, firstChange) { this.previousValue = previousValue; this.currentValue = currentValue; this.firstChange = firstChange; } /** * Check whether the new value is the first value assigned. */ isFirstChange() { return this.firstChange; } }; function applyValueToInputField(instance, inputSignalNode, privateName, value) { if (inputSignalNode !== null) { inputSignalNode.applyValueToInputSignal(inputSignalNode, value); } else { instance[privateName] = value; } } function \u0275\u0275NgOnChangesFeature() { return NgOnChangesFeatureImpl; } function NgOnChangesFeatureImpl(definition) { if (definition.type.prototype.ngOnChanges) { definition.setInput = ngOnChangesSetInput; } return rememberChangeHistoryAndInvokeOnChangesHook; } \u0275\u0275NgOnChangesFeature.ngInherit = true; function rememberChangeHistoryAndInvokeOnChangesHook() { const simpleChangesStore = getSimpleChangesStore(this); const current = simpleChangesStore?.current; if (current) { const previous = simpleChangesStore.previous; if (previous === EMPTY_OBJ) { simpleChangesStore.previous = current; } else { for (let key in current) { previous[key] = current[key]; } } simpleChangesStore.current = null; this.ngOnChanges(current); } } function ngOnChangesSetInput(instance, inputSignalNode, value, publicName, privateName) { const declaredName = this.declaredInputs[publicName]; ngDevMode && assertString(declaredName, "Name of input in ngOnChanges has to be a string"); const simpleChangesStore = getSimpleChangesStore(instance) || setSimpleChangesStore(instance, { previous: EMPTY_OBJ, current: null }); const current = simpleChangesStore.current || (simpleChangesStore.current = {}); const previous = simpleChangesStore.previous; const previousChange = previous[declaredName]; current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ); applyValueToInputField(instance, inputSignalNode, privateName, value); } var SIMPLE_CHANGES_STORE = "__ngSimpleChanges__"; function getSimpleChangesStore(instance) { return instance[SIMPLE_CHANGES_STORE] || null; } function setSimpleChangesStore(instance, store2) { return instance[SIMPLE_CHANGES_STORE] = store2; } var profilerCallback = null; var setProfiler = (profiler2) => { profilerCallback = profiler2; }; var profiler = function(event, instance, hookOrListener) { if (profilerCallback != null) { profilerCallback(event, instance, hookOrListener); } }; var SVG_NAMESPACE = "svg"; var MATH_ML_NAMESPACE = "math"; function unwrapRNode(value) { while (Array.isArray(value)) { value = value[HOST]; } return value; } function unwrapLView(value) { while (Array.isArray(value)) { if (typeof value[TYPE] === "object") return value; value = value[HOST]; } return null; } function getNativeByIndex(index, lView) { ngDevMode && assertIndexInRange(lView, index); ngDevMode && assertGreaterThanOrEqual(index, HEADER_OFFSET, "Expected to be past HEADER_OFFSET"); return unwrapRNode(lView[index]); } function getNativeByTNode(tNode, lView) { ngDevMode && assertTNodeForLView(tNode, lView); ngDevMode && assertIndexInRange(lView, tNode.index); const node = unwrapRNode(lView[tNode.index]); return node; } function getTNode(tView, index) { ngDevMode && assertGreaterThan(index, -1, "wrong index for TNode"); ngDevMode && assertLessThan(index, tView.data.length, "wrong index for TNode"); const tNode = tView.data[index]; ngDevMode && tNode !== null && assertTNode(tNode); return tNode; } function load(view, index) { ngDevMode && assertIndexInRange(view, index); return view[index]; } function getComponentLViewByIndex(nodeIndex, hostView) { ngDevMode && assertIndexInRange(hostView, nodeIndex); const slotValue = hostView[nodeIndex]; const lView = isLView(slotValue) ? slotValue : slotValue[HOST]; return lView; } function isCreationMode(view) { return (view[FLAGS] & 4) === 4; } function viewAttachedToChangeDetector(view) { return (view[FLAGS] & 128) === 128; } function viewAttachedToContainer(view) { return isLContainer(view[PARENT]); } function getConstant(consts, index) { if (index === null || index === void 0) return null; ngDevMode && assertIndexInRange(consts, index); return consts[index]; } function resetPreOrderHookFlags(lView) { lView[PREORDER_HOOK_FLAGS] = 0; } function markViewForRefresh(lView) { if (lView[FLAGS] & 1024) { return; } lView[FLAGS] |= 1024; if (viewAttachedToChangeDetector(lView)) { markAncestorsForTraversal(lView); } } function walkUpViews(nestingLevel, currentView) { while (nestingLevel > 0) { ngDevMode && assertDefined(currentView[DECLARATION_VIEW], "Declaration view should be defined if nesting level is greater than 0."); currentView = currentView[DECLARATION_VIEW]; nestingLevel--; } return currentView; } function requiresRefreshOrTraversal(lView) { return !!(lView[FLAGS] & (1024 | 8192) || lView[REACTIVE_TEMPLATE_CONSUMER]?.dirty); } function updateAncestorTraversalFlagsOnAttach(lView) { lView[ENVIRONMENT].changeDetectionScheduler?.notify( 8 /* NotificationSource.ViewAttached */ ); if (lView[FLAGS] & 64) { lView[FLAGS] |= 1024; } if (requiresRefreshOrTraversal(lView)) { markAncestorsForTraversal(lView); } } function markAncestorsForTraversal(lView) { lView[ENVIRONMENT].changeDetectionScheduler?.notify( 0 /* NotificationSource.MarkAncestorsForTraversal */ ); let parent = getLViewParent(lView); while (parent !== null) { if (parent[FLAGS] & 8192) { break; } parent[FLAGS] |= 8192; if (!viewAttachedToChangeDetector(parent)) { break; } parent = getLViewParent(parent); } } function storeLViewOnDestroy(lView, onDestroyCallback) { if ((lView[FLAGS] & 256) === 256) { throw new RuntimeError(911, ngDevMode && "View has already been destroyed."); } if (lView[ON_DESTROY_HOOKS] === null) { lView[ON_DESTROY_HOOKS] = []; } lView[ON_DESTROY_HOOKS].push(onDestroyCallback); } function removeLViewOnDestroy(lView, onDestroyCallback) { if (lView[ON_DESTROY_HOOKS] === null) return; const destroyCBIdx = lView[ON_DESTROY_HOOKS].indexOf(onDestroyCallback); if (destroyCBIdx !== -1) { lView[ON_DESTROY_HOOKS].splice(destroyCBIdx, 1); } } function getLViewParent(lView) { ngDevMode && assertLView(lView); const parent = lView[PARENT]; return isLContainer(parent) ? parent[PARENT] : parent; } var instructionState = { lFrame: createLFrame(null), bindingsEnabled: true, skipHydrationRootTNode: null }; var CheckNoChangesMode; (function(CheckNoChangesMode2) { CheckNoChangesMode2[CheckNoChangesMode2["Off"] = 0] = "Off"; CheckNoChangesMode2[CheckNoChangesMode2["Exhaustive"] = 1] = "Exhaustive"; CheckNoChangesMode2[CheckNoChangesMode2["OnlyDirtyViews"] = 2] = "OnlyDirtyViews"; })(CheckNoChangesMode || (CheckNoChangesMode = {})); var _checkNoChangesMode = 0; var _isRefreshingViews = false; function getElementDepthCount() { return instructionState.lFrame.elementDepthCount; } function increaseElementDepthCount() { instructionState.lFrame.elementDepthCount++; } function decreaseElementDepthCount() { instructionState.lFrame.elementDepthCount--; } function getBindingsEnabled() { return instructionState.bindingsEnabled; } function isInSkipHydrationBlock$1() { return instructionState.skipHydrationRootTNode !== null; } function isSkipHydrationRootTNode(tNode) { return instructionState.skipHydrationRootTNode === tNode; } function \u0275\u0275enableBindings() { instructionState.bindingsEnabled = true; } function \u0275\u0275disableBindings() { instructionState.bindingsEnabled = false; } function leaveSkipHydrationBlock() { instructionState.skipHydrationRootTNode = null; } function getLView() { return instructionState.lFrame.lView; } function getTView() { return instructionState.lFrame.tView; } function \u0275\u0275restoreView(viewToRestore) { instructionState.lFrame.contextLView = viewToRestore; return viewToRestore[CONTEXT]; } function \u0275\u0275resetView(value) { instructionState.lFrame.contextLView = null; return value; } function getCurrentTNode() { let currentTNode = getCurrentTNodePlaceholderOk(); while (currentTNode !== null && currentTNode.type === 64) { currentTNode = currentTNode.parent; } return currentTNode; } function getCurrentTNodePlaceholderOk() { return instructionState.lFrame.currentTNode; } function getCurrentParentTNode() { const lFrame = instructionState.lFrame; const currentTNode = lFrame.currentTNode; return lFrame.isParent ? currentTNode : currentTNode.parent; } function setCurrentTNode(tNode, isParent) { ngDevMode && tNode && assertTNodeForTView(tNode, instructionState.lFrame.tView); const lFrame = instructionState.lFrame; lFrame.currentTNode = tNode; lFrame.isParent = isParent; } function isCurrentTNodeParent() { return instructionState.lFrame.isParent; } function setCurrentTNodeAsNotParent() { instructionState.lFrame.isParent = false; } function getContextLView() { const contextLView = instructionState.lFrame.contextLView; ngDevMode && assertDefined(contextLView, "contextLView must be defined."); return contextLView; } function isInCheckNoChangesMode() { !ngDevMode && throwError("Must never be called in production mode"); return _checkNoChangesMode !== CheckNoChangesMode.Off; } function isExhaustiveCheckNoChanges() { !ngDevMode && throwError("Must never be called in production mode"); return _checkNoChangesMode === CheckNoChangesMode.Exhaustive; } function setIsInCheckNoChangesMode(mode) { !ngDevMode && throwError("Must never be called in production mode"); _checkNoChangesMode = mode; } function isRefreshingViews() { return _isRefreshingViews; } function setIsRefreshingViews(mode) { _isRefreshingViews = mode; } function getBindingRoot() { const lFrame = instructionState.lFrame; let index = lFrame.bindingRootIndex; if (index === -1) { index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex; } return index; } function getBindingIndex() { return instructionState.lFrame.bindingIndex; } function setBindingIndex(value) { return instructionState.lFrame.bindingIndex = value; } function nextBindingIndex() { return instructionState.lFrame.bindingIndex++; } function incrementBindingIndex(count) { const lFrame = instructionState.lFrame; const index = lFrame.bindingIndex; lFrame.bindingIndex = lFrame.bindingIndex + count; return index; } function isInI18nBlock() { return instructionState.lFrame.inI18n; } function setInI18nBlock(isInI18nBlock2) { instructionState.lFrame.inI18n = isInI18nBlock2; } function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) { const lFrame = instructionState.lFrame; lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex; setCurrentDirectiveIndex(currentDirectiveIndex); } function getCurrentDirectiveIndex() { return instructionState.lFrame.currentDirectiveIndex; } function setCurrentDirectiveIndex(currentDirectiveIndex) { instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex; } function getCurrentDirectiveDef(tData) { const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex; return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex]; } function getCurrentQueryIndex() { return instructionState.lFrame.currentQueryIndex; } function setCurrentQueryIndex(value) { instructionState.lFrame.currentQueryIndex = value; } function getDeclarationTNode(lView) { const tView = lView[TVIEW]; if (tView.type === 2) { ngDevMode && assertDefined(tView.declTNode, "Embedded TNodes should have declaration parents."); return tView.declTNode; } if (tView.type === 1) { return lView[T_HOST]; } return null; } function enterDI(lView, tNode, flags) { ngDevMode && assertLViewOrUndefined(lView); if (flags & InjectFlags.SkipSelf) { ngDevMode && assertTNodeForTView(tNode, lView[TVIEW]); let parentTNode = tNode; let parentLView = lView; while (true) { ngDevMode && assertDefined(parentTNode, "Parent TNode should be defined"); parentTNode = parentTNode.parent; if (parentTNode === null && !(flags & InjectFlags.Host)) { parentTNode = getDeclarationTNode(parentLView); if (parentTNode === null) break; ngDevMode && assertDefined(parentLView, "Parent LView should be defined"); parentLView = parentLView[DECLARATION_VIEW]; if (parentTNode.type & (2 | 8)) { break; } } else { break; } } if (parentTNode === null) { return false; } else { tNode = parentTNode; lView = parentLView; } } ngDevMode && assertTNodeForLView(tNode, lView); const lFrame = instructionState.lFrame = allocLFrame(); lFrame.currentTNode = tNode; lFrame.lView = lView; return true; } function enterView(newView) { ngDevMode && assertNotEqual(newView[0], newView[1], "????"); ngDevMode && assertLViewOrUndefined(newView); const newLFrame = allocLFrame(); if (ngDevMode) { assertEqual(newLFrame.isParent, true, "Expected clean LFrame"); assertEqual(newLFrame.lView, null, "Expected clean LFrame"); assertEqual(newLFrame.tView, null, "Expected clean LFrame"); assertEqual(newLFrame.selectedIndex, -1, "Expected clean LFrame"); assertEqual(newLFrame.elementDepthCount, 0, "Expected clean LFrame"); assertEqual(newLFrame.currentDirectiveIndex, -1, "Expected clean LFrame"); assertEqual(newLFrame.currentNamespace, null, "Expected clean LFrame"); assertEqual(newLFrame.bindingRootIndex, -1, "Expected clean LFrame"); assertEqual(newLFrame.currentQueryIndex, 0, "Expected clean LFrame"); } const tView = newView[TVIEW]; instructionState.lFrame = newLFrame; ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView); newLFrame.currentTNode = tView.firstChild; newLFrame.lView = newView; newLFrame.tView = tView; newLFrame.contextLView = newView; newLFrame.bindingIndex = tView.bindingStartIndex; newLFrame.inI18n = false; } function allocLFrame() { const currentLFrame = instructionState.lFrame; const childLFrame = currentLFrame === null ? null : currentLFrame.child; const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame; return newLFrame; } function createLFrame(parent) { const lFrame = { currentTNode: null, isParent: true, lView: null, tView: null, selectedIndex: -1, contextLView: null, elementDepthCount: 0, currentNamespace: null, currentDirectiveIndex: -1, bindingRootIndex: -1, bindingIndex: -1, currentQueryIndex: 0, parent, child: null, inI18n: false }; parent !== null && (parent.child = lFrame); return lFrame; } function leaveViewLight() { const oldLFrame = instructionState.lFrame; instructionState.lFrame = oldLFrame.parent; oldLFrame.currentTNode = null; oldLFrame.lView = null; return oldLFrame; } var leaveDI = leaveViewLight; function leaveView() { const oldLFrame = leaveViewLight(); oldLFrame.isParent = true; oldLFrame.tView = null; oldLFrame.selectedIndex = -1; oldLFrame.contextLView = null; oldLFrame.elementDepthCount = 0; oldLFrame.currentDirectiveIndex = -1; oldLFrame.currentNamespace = null; oldLFrame.bindingRootIndex = -1; oldLFrame.bindingIndex = -1; oldLFrame.currentQueryIndex = 0; } function nextContextImpl(level) { const contextLView = instructionState.lFrame.contextLView = walkUpViews(level, instructionState.lFrame.contextLView); return contextLView[CONTEXT]; } function getSelectedIndex() { return instructionState.lFrame.selectedIndex; } function setSelectedIndex(index) { ngDevMode && index !== -1 && assertGreaterThanOrEqual(index, HEADER_OFFSET, "Index must be past HEADER_OFFSET (or -1)."); ngDevMode && assertLessThan(index, instructionState.lFrame.lView.length, "Can't set index passed end of LView"); instructionState.lFrame.selectedIndex = index; } function getSelectedTNode() { const lFrame = instructionState.lFrame; return getTNode(lFrame.tView, lFrame.selectedIndex); } function \u0275\u0275namespaceSVG() { instructionState.lFrame.currentNamespace = SVG_NAMESPACE; } function \u0275\u0275namespaceMathML() { instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE; } function \u0275\u0275namespaceHTML() { namespaceHTMLInternal(); } function namespaceHTMLInternal() { instructionState.lFrame.currentNamespace = null; } function getNamespace$1() { return instructionState.lFrame.currentNamespace; } var _wasLastNodeCreated = true; function wasLastNodeCreated() { return _wasLastNodeCreated; } function lastNodeWasCreated(flag) { _wasLastNodeCreated = flag; } function registerPreOrderHooks(directiveIndex, directiveDef, tView) { ngDevMode && assertFirstCreatePass(tView); const { ngOnChanges, ngOnInit, ngDoCheck } = directiveDef.type.prototype; if (ngOnChanges) { const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef); (tView.preOrderHooks ??= []).push(directiveIndex, wrappedOnChanges); (tView.preOrderCheckHooks ??= []).push(directiveIndex, wrappedOnChanges); } if (ngOnInit) { (tView.preOrderHooks ??= []).push(0 - directiveIndex, ngOnInit); } if (ngDoCheck) { (tView.preOrderHooks ??= []).push(directiveIndex, ngDoCheck); (tView.preOrderCheckHooks ??= []).push(directiveIndex, ngDoCheck); } } function registerPostOrderHooks(tView, tNode) { ngDevMode && assertFirstCreatePass(tView); for (let i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) { const directiveDef = tView.data[i]; ngDevMode && assertDefined(directiveDef, "Expecting DirectiveDef"); const lifecycleHooks = directiveDef.type.prototype; const { ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy } = lifecycleHooks; if (ngAfterContentInit) { (tView.contentHooks ??= []).push(-i, ngAfterContentInit); } if (ngAfterContentChecked) { (tView.contentHooks ??= []).push(i, ngAfterContentChecked); (tView.contentCheckHooks ??= []).push(i, ngAfterContentChecked); } if (ngAfterViewInit) { (tView.viewHooks ??= []).push(-i, ngAfterViewInit); } if (ngAfterViewChecked) { (tView.viewHooks ??= []).push(i, ngAfterViewChecked); (tView.viewCheckHooks ??= []).push(i, ngAfterViewChecked); } if (ngOnDestroy != null) { (tView.destroyHooks ??= []).push(i, ngOnDestroy); } } } function executeCheckHooks(lView, hooks, nodeIndex) { callHooks(lView, hooks, 3, nodeIndex); } function executeInitAndCheckHooks(lView, hooks, initPhase, nodeIndex) { ngDevMode && assertNotEqual(initPhase, 3, "Init pre-order hooks should not be called more than once"); if ((lView[FLAGS] & 3) === initPhase) { callHooks(lView, hooks, initPhase, nodeIndex); } } function incrementInitPhaseFlags(lView, initPhase) { ngDevMode && assertNotEqual(initPhase, 3, "Init hooks phase should not be incremented after all init hooks have been run."); let flags = lView[FLAGS]; if ((flags & 3) === initPhase) { flags &= 16383; flags += 1; lView[FLAGS] = flags; } } function callHooks(currentView, arr, initPhase, currentNodeIndex) { ngDevMode && assertEqual(isInCheckNoChangesMode(), false, "Hooks should never be run when in check no changes mode."); const startIndex = currentNodeIndex !== void 0 ? currentView[PREORDER_HOOK_FLAGS] & 65535 : 0; const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1; const max = arr.length - 1; let lastNodeIndexFound = 0; for (let i = startIndex; i < max; i++) { const hook = arr[i + 1]; if (typeof hook === "number") { lastNodeIndexFound = arr[i]; if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) { break; } } else { const isInitHook = arr[i] < 0; if (isInitHook) { currentView[PREORDER_HOOK_FLAGS] += 65536; } if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) { callHook(currentView, initPhase, arr, i); currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760) + i + 2; } i++; } } } function callHookInternal(directive, hook) { profiler(4, directive, hook); const prevConsumer = setActiveConsumer(null); try { hook.call(directive); } finally { setActiveConsumer(prevConsumer); profiler(5, directive, hook); } } function callHook(currentView, initPhase, arr, i) { const isInitHook = arr[i] < 0; const hook = arr[i + 1]; const directiveIndex = isInitHook ? -arr[i] : arr[i]; const directive = currentView[directiveIndex]; if (isInitHook) { const indexWithintInitPhase = currentView[FLAGS] >> 14; if (indexWithintInitPhase < currentView[PREORDER_HOOK_FLAGS] >> 16 && (currentView[FLAGS] & 3) === initPhase) { currentView[FLAGS] += 16384; callHookInternal(directive, hook); } } else { callHookInternal(directive, hook); } } var NO_PARENT_INJECTOR = -1; var NodeInjectorFactory = class { constructor(factory, isViewProvider, injectImplementation) { this.factory = factory; this.resolving = false; ngDevMode && assertDefined(factory, "Factory not specified"); ngDevMode && assertEqual(typeof factory, "function", "Expected factory function."); this.canSeeViewProviders = isViewProvider; this.injectImpl = injectImplementation; } }; function isFactory(obj) { return obj instanceof NodeInjectorFactory; } function toTNodeTypeAsString(tNodeType) { let text = ""; tNodeType & 1 && (text += "|Text"); tNodeType & 2 && (text += "|Element"); tNodeType & 4 && (text += "|Container"); tNodeType & 8 && (text += "|ElementContainer"); tNodeType & 16 && (text += "|Projection"); tNodeType & 32 && (text += "|IcuContainer"); tNodeType & 64 && (text += "|Placeholder"); tNodeType & 128 && (text += "|LetDeclaration"); return text.length > 0 ? text.substring(1) : text; } function hasClassInput(tNode) { return (tNode.flags & 8) !== 0; } function hasStyleInput(tNode) { return (tNode.flags & 16) !== 0; } function assertTNodeType(tNode, expectedTypes, message) { assertDefined(tNode, "should be called with a TNode"); if ((tNode.type & expectedTypes) === 0) { throwError(message || `Expected [${toTNodeTypeAsString(expectedTypes)}] but got ${toTNodeTypeAsString(tNode.type)}.`); } } function assertPureTNodeType(type) { if (!(type === 2 || type === 1 || type === 4 || type === 8 || type === 32 || type === 16 || type === 64 || type === 128)) { throwError(`Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString(type)}.`); } } var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {}; var ChainedInjector = class { constructor(injector, parentInjector) { this.injector = injector; this.parentInjector = parentInjector; } get(token, notFoundValue, flags) { flags = convertToBitFlags(flags); const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags); if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) { return value; } return this.parentInjector.get(token, notFoundValue, flags); } }; function hasParentInjector(parentLocation) { return parentLocation !== NO_PARENT_INJECTOR; } function getParentInjectorIndex(parentLocation) { if (ngDevMode) { assertNumber(parentLocation, "Number expected"); assertNotEqual(parentLocation, -1, "Not a valid state."); const parentInjectorIndex = parentLocation & 32767; assertGreaterThan(parentInjectorIndex, HEADER_OFFSET, "Parent injector must be pointing past HEADER_OFFSET."); } return parentLocation & 32767; } function getParentInjectorViewOffset(parentLocation) { return parentLocation >> 16; } function getParentInjectorView(location2, startView) { let viewOffset = getParentInjectorViewOffset(location2); let parentView = startView; while (viewOffset > 0) { parentView = parentView[DECLARATION_VIEW]; viewOffset--; } return parentView; } function isRouterOutletInjector(currentInjector) { return currentInjector instanceof ChainedInjector && typeof currentInjector.injector.__ngOutletInjector === "function"; } var includeViewProviders = true; function setIncludeViewProviders(v) { const oldValue = includeViewProviders; includeViewProviders = v; return oldValue; } var BLOOM_SIZE = 256; var BLOOM_MASK = BLOOM_SIZE - 1; var BLOOM_BUCKET_BITS = 5; var nextNgElementId = 0; var NOT_FOUND = {}; function bloomAdd(injectorIndex, tView, type) { ngDevMode && assertEqual(tView.firstCreatePass, true, "expected firstCreatePass to be true"); let id; if (typeof type === "string") { id = type.charCodeAt(0) || 0; } else if (type.hasOwnProperty(NG_ELEMENT_ID)) { id = type[NG_ELEMENT_ID]; } if (id == null) { id = type[NG_ELEMENT_ID] = nextNgElementId++; } const bloomHash = id & BLOOM_MASK; const mask = 1 << bloomHash; tView.data[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)] |= mask; } function getOrCreateNodeInjectorForNode(tNode, lView) { const existingInjectorIndex = getInjectorIndex(tNode, lView); if (existingInjectorIndex !== -1) { return existingInjectorIndex; } const tView = lView[TVIEW]; if (tView.firstCreatePass) { tNode.injectorIndex = lView.length; insertBloom(tView.data, tNode); insertBloom(lView, null); insertBloom(tView.blueprint, null); } const parentLoc = getParentInjectorLocation(tNode, lView); const injectorIndex = tNode.injectorIndex; if (hasParentInjector(parentLoc)) { const parentIndex = getParentInjectorIndex(parentLoc); const parentLView = getParentInjectorView(parentLoc, lView); const parentData = parentLView[TVIEW].data; for (let i = 0; i < 8; i++) { lView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i]; } } lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ] = parentLoc; return injectorIndex; } function insertBloom(arr, footer) { arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer); } function getInjectorIndex(tNode, lView) { if (tNode.injectorIndex === -1 || // If the injector index is the same as its parent's injector index, then the index has been // copied down from the parent node. No injector has been created yet on this node. tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex || // After the first template pass, the injector index might exist but the parent values // might not have been calculated yet for this instance lView[ tNode.injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ] === null) { return -1; } else { ngDevMode && assertIndexInRange(lView, tNode.injectorIndex); return tNode.injectorIndex; } } function getParentInjectorLocation(tNode, lView) { if (tNode.parent && tNode.parent.injectorIndex !== -1) { return tNode.parent.injectorIndex; } let declarationViewOffset = 0; let parentTNode = null; let lViewCursor = lView; while (lViewCursor !== null) { parentTNode = getTNodeFromLView(lViewCursor); if (parentTNode === null) { return NO_PARENT_INJECTOR; } ngDevMode && parentTNode && assertTNodeForLView(parentTNode, lViewCursor[DECLARATION_VIEW]); declarationViewOffset++; lViewCursor = lViewCursor[DECLARATION_VIEW]; if (parentTNode.injectorIndex !== -1) { return parentTNode.injectorIndex | declarationViewOffset << 16; } } return NO_PARENT_INJECTOR; } function diPublicInInjector(injectorIndex, tView, token) { bloomAdd(injectorIndex, tView, token); } function injectAttributeImpl(tNode, attrNameToInject) { ngDevMode && assertTNodeType( tNode, 12 | 3 /* TNodeType.AnyRNode */ ); ngDevMode && assertDefined(tNode, "expecting tNode"); if (attrNameToInject === "class") { return tNode.classes; } if (attrNameToInject === "style") { return tNode.styles; } const attrs = tNode.attrs; if (attrs) { const attrsLength = attrs.length; let i = 0; while (i < attrsLength) { const value = attrs[i]; if (isNameOnlyAttributeMarker(value)) break; if (value === 0) { i = i + 2; } else if (typeof value === "number") { i++; while (i < attrsLength && typeof attrs[i] === "string") { i++; } } else if (value === attrNameToInject) { return attrs[i + 1]; } else { i = i + 2; } } } return null; } function notFoundValueOrThrow(notFoundValue, token, flags) { if (flags & InjectFlags.Optional || notFoundValue !== void 0) { return notFoundValue; } else { throwProviderNotFoundError(token, "NodeInjector"); } } function lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) { if (flags & InjectFlags.Optional && notFoundValue === void 0) { notFoundValue = null; } if ((flags & (InjectFlags.Self | InjectFlags.Host)) === 0) { const moduleInjector = lView[INJECTOR]; const previousInjectImplementation = setInjectImplementation(void 0); try { if (moduleInjector) { return moduleInjector.get(token, notFoundValue, flags & InjectFlags.Optional); } else { return injectRootLimpMode(token, notFoundValue, flags & InjectFlags.Optional); } } finally { setInjectImplementation(previousInjectImplementation); } } return notFoundValueOrThrow(notFoundValue, token, flags); } function getOrCreateInjectable(tNode, lView, token, flags = InjectFlags.Default, notFoundValue) { if (tNode !== null) { if (lView[FLAGS] & 2048 && // The token must be present on the current node injector when the `Self` // flag is set, so the lookup on embedded view injector(s) can be skipped. !(flags & InjectFlags.Self)) { const embeddedInjectorValue = lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, NOT_FOUND); if (embeddedInjectorValue !== NOT_FOUND) { return embeddedInjectorValue; } } const value = lookupTokenUsingNodeInjector(tNode, lView, token, flags, NOT_FOUND); if (value !== NOT_FOUND) { return value; } } return lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue); } function lookupTokenUsingNodeInjector(tNode, lView, token, flags, notFoundValue) { const bloomHash = bloomHashBitOrFactory(token); if (typeof bloomHash === "function") { if (!enterDI(lView, tNode, flags)) { return flags & InjectFlags.Host ? notFoundValueOrThrow(notFoundValue, token, flags) : lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue); } try { let value; if (ngDevMode) { runInInjectorProfilerContext(new NodeInjector(getCurrentTNode(), getLView()), token, () => { value = bloomHash(flags); if (value != null) { emitInstanceCreatedByInjectorEvent(value); } }); } else { value = bloomHash(flags); } if (value == null && !(flags & InjectFlags.Optional)) { throwProviderNotFoundError(token); } else { return value; } } finally { leaveDI(); } } else if (typeof bloomHash === "number") { let previousTView = null; let injectorIndex = getInjectorIndex(tNode, lView); let parentLocation = NO_PARENT_INJECTOR; let hostTElementNode = flags & InjectFlags.Host ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null; if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) { parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) : lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ]; if (parentLocation === NO_PARENT_INJECTOR || !shouldSearchParent(flags, false)) { injectorIndex = -1; } else { previousTView = lView[TVIEW]; injectorIndex = getParentInjectorIndex(parentLocation); lView = getParentInjectorView(parentLocation, lView); } } while (injectorIndex !== -1) { ngDevMode && assertNodeInjector(lView, injectorIndex); const tView = lView[TVIEW]; ngDevMode && assertTNodeForLView(tView.data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ], lView); if (bloomHasToken(bloomHash, injectorIndex, tView.data)) { const instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode); if (instance !== NOT_FOUND) { return instance; } } parentLocation = lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ]; if (parentLocation !== NO_PARENT_INJECTOR && shouldSearchParent(flags, lView[TVIEW].data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ] === hostTElementNode) && bloomHasToken(bloomHash, injectorIndex, lView)) { previousTView = tView; injectorIndex = getParentInjectorIndex(parentLocation); lView = getParentInjectorView(parentLocation, lView); } else { injectorIndex = -1; } } } return notFoundValue; } function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) { const currentTView = lView[TVIEW]; const tNode = currentTView.data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ]; const canAccessViewProviders = previousTView == null ? ( // 1) This is the first invocation `previousTView == null` which means that we are at the // `TNode` of where injector is starting to look. In such a case the only time we are allowed // to look into the ViewProviders is if: // - we are on a component // - AND the injector set `includeViewProviders` to true (implying that the token can see // ViewProviders because it is the Component or a Service which itself was declared in // ViewProviders) isComponentHost(tNode) && includeViewProviders ) : ( // 2) `previousTView != null` which means that we are now walking across the parent nodes. // In such a case we are only allowed to look into the ViewProviders if: // - We just crossed from child View to Parent View `previousTView != currentTView` // - AND the parent TNode is an Element. // This means that we just came from the Component's View and therefore are allowed to see // into the ViewProviders. previousTView != currentTView && (tNode.type & 3) !== 0 ); const isHostSpecialCase = flags & InjectFlags.Host && hostTElementNode === tNode; const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase); if (injectableIdx !== null) { return getNodeInjectable(lView, currentTView, injectableIdx, tNode); } else { return NOT_FOUND; } } function locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) { const nodeProviderIndexes = tNode.providerIndexes; const tInjectables = tView.data; const injectablesStart = nodeProviderIndexes & 1048575; const directivesStart = tNode.directiveStart; const directiveEnd = tNode.directiveEnd; const cptViewProvidersCount = nodeProviderIndexes >> 20; const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount; const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd; for (let i = startingIndex; i < endIndex; i++) { const providerTokenOrDef = tInjectables[i]; if (i < directivesStart && token === providerTokenOrDef || i >= directivesStart && providerTokenOrDef.type === token) { return i; } } if (isHostSpecialCase) { const dirDef = tInjectables[directivesStart]; if (dirDef && isComponentDef(dirDef) && dirDef.type === token) { return directivesStart; } } return null; } function getNodeInjectable(lView, tView, index, tNode) { let value = lView[index]; const tData = tView.data; if (isFactory(value)) { const factory = value; if (factory.resolving) { throwCyclicDependencyError(stringifyForError(tData[index])); } const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders); factory.resolving = true; let prevInjectContext; if (ngDevMode) { const token = tData[index].type || tData[index]; const injector = new NodeInjector(tNode, lView); prevInjectContext = setInjectorProfilerContext({ injector, token }); } const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null; const success = enterDI(lView, tNode, InjectFlags.Default); ngDevMode && assertEqual(success, true, "Because flags do not contain `SkipSelf' we expect this to always succeed."); try { value = lView[index] = factory.factory(void 0, tData, lView, tNode); ngDevMode && emitInstanceCreatedByInjectorEvent(value); if (tView.firstCreatePass && index >= tNode.directiveStart) { ngDevMode && assertDirectiveDef(tData[index]); registerPreOrderHooks(index, tData[index], tView); } } finally { ngDevMode && setInjectorProfilerContext(prevInjectContext); previousInjectImplementation !== null && setInjectImplementation(previousInjectImplementation); setIncludeViewProviders(previousIncludeViewProviders); factory.resolving = false; leaveDI(); } } return value; } function bloomHashBitOrFactory(token) { ngDevMode && assertDefined(token, "token must be defined"); if (typeof token === "string") { return token.charCodeAt(0) || 0; } const tokenId = ( // First check with `hasOwnProperty` so we don't get an inherited ID. token.hasOwnProperty(NG_ELEMENT_ID) ? token[NG_ELEMENT_ID] : void 0 ); if (typeof tokenId === "number") { if (tokenId >= 0) { return tokenId & BLOOM_MASK; } else { ngDevMode && assertEqual(tokenId, -1, "Expecting to get Special Injector Id"); return createNodeInjector; } } else { return tokenId; } } function bloomHasToken(bloomHash, injectorIndex, injectorView) { const mask = 1 << bloomHash; const value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)]; return !!(value & mask); } function shouldSearchParent(flags, isFirstHostTNode) { return !(flags & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode); } function getNodeInjectorLView(nodeInjector) { return nodeInjector._lView; } function getNodeInjectorTNode(nodeInjector) { return nodeInjector._tNode; } var NodeInjector = class { constructor(_tNode, _lView) { this._tNode = _tNode; this._lView = _lView; } get(token, notFoundValue, flags) { return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue); } }; function createNodeInjector() { return new NodeInjector(getCurrentTNode(), getLView()); } function \u0275\u0275getInheritedFactory(type) { return noSideEffects(() => { const ownConstructor = type.prototype.constructor; const ownFactory = ownConstructor[NG_FACTORY_DEF] || getFactoryOf(ownConstructor); const objectPrototype = Object.prototype; let parent = Object.getPrototypeOf(type.prototype).constructor; while (parent && parent !== objectPrototype) { const factory = parent[NG_FACTORY_DEF] || getFactoryOf(parent); if (factory && factory !== ownFactory) { return factory; } parent = Object.getPrototypeOf(parent); } return (t) => new t(); }); } function getFactoryOf(type) { if (isForwardRef(type)) { return () => { const factory = getFactoryOf(resolveForwardRef(type)); return factory && factory(); }; } return getFactoryDef(type); } function lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundValue) { let currentTNode = tNode; let currentLView = lView; while (currentTNode !== null && currentLView !== null && currentLView[FLAGS] & 2048 && !(currentLView[FLAGS] & 512)) { ngDevMode && assertTNodeForLView(currentTNode, currentLView); const nodeInjectorValue = lookupTokenUsingNodeInjector(currentTNode, currentLView, token, flags | InjectFlags.Self, NOT_FOUND); if (nodeInjectorValue !== NOT_FOUND) { return nodeInjectorValue; } let parentTNode = currentTNode.parent; if (!parentTNode) { const embeddedViewInjector = currentLView[EMBEDDED_VIEW_INJECTOR]; if (embeddedViewInjector) { const embeddedViewInjectorValue = embeddedViewInjector.get(token, NOT_FOUND, flags); if (embeddedViewInjectorValue !== NOT_FOUND) { return embeddedViewInjectorValue; } } parentTNode = getTNodeFromLView(currentLView); currentLView = currentLView[DECLARATION_VIEW]; } currentTNode = parentTNode; } return notFoundValue; } function getTNodeFromLView(lView) { const tView = lView[TVIEW]; const tViewType = tView.type; if (tViewType === 2) { ngDevMode && assertDefined(tView.declTNode, "Embedded TNodes should have declaration parents."); return tView.declTNode; } else if (tViewType === 1) { return lView[T_HOST]; } return null; } function \u0275\u0275injectAttribute(attrNameToInject) { return injectAttributeImpl(getCurrentTNode(), attrNameToInject); } var Attribute = makeParamDecorator("Attribute", (attributeName) => ({ attributeName, __NG_ELEMENT_ID__: () => \u0275\u0275injectAttribute(attributeName) })); var _reflect = null; function getReflect() { return _reflect = _reflect || new ReflectionCapabilities(); } function reflectDependencies(type) { return convertDependencies(getReflect().parameters(type)); } function convertDependencies(deps) { return deps.map((dep) => reflectDependency(dep)); } function reflectDependency(dep) { const meta = { token: null, attribute: null, host: false, optional: false, self: false, skipSelf: false }; if (Array.isArray(dep) && dep.length > 0) { for (let j = 0; j < dep.length; j++) { const param = dep[j]; if (param === void 0) { continue; } const proto = Object.getPrototypeOf(param); if (param instanceof Optional || proto.ngMetadataName === "Optional") { meta.optional = true; } else if (param instanceof SkipSelf || proto.ngMetadataName === "SkipSelf") { meta.skipSelf = true; } else if (param instanceof Self || proto.ngMetadataName === "Self") { meta.self = true; } else if (param instanceof Host || proto.ngMetadataName === "Host") { meta.host = true; } else if (param instanceof Inject) { meta.token = param.token; } else if (param instanceof Attribute) { if (param.attributeName === void 0) { throw new RuntimeError(204, ngDevMode && `Attribute name must be defined.`); } meta.attribute = param.attributeName; } else { meta.token = param; } } } else if (dep === void 0 || Array.isArray(dep) && dep.length === 0) { meta.token = null; } else { meta.token = dep; } return meta; } function compileInjectable(type, meta) { let ngInjectableDef = null; let ngFactoryDef = null; if (!type.hasOwnProperty(NG_PROV_DEF)) { Object.defineProperty(type, NG_PROV_DEF, { get: () => { if (ngInjectableDef === null) { const compiler = getCompilerFacade({ usage: 0, kind: "injectable", type }); ngInjectableDef = compiler.compileInjectable(angularCoreDiEnv, `ng:///${type.name}/\u0275prov.js`, getInjectableMetadata(type, meta)); } return ngInjectableDef; } }); } if (!type.hasOwnProperty(NG_FACTORY_DEF)) { Object.defineProperty(type, NG_FACTORY_DEF, { get: () => { if (ngFactoryDef === null) { const compiler = getCompilerFacade({ usage: 0, kind: "injectable", type }); ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, `ng:///${type.name}/\u0275fac.js`, { name: type.name, type, typeArgumentCount: 0, // In JIT mode types are not available nor used. deps: reflectDependencies(type), target: compiler.FactoryTarget.Injectable }); } return ngFactoryDef; }, // Leave this configurable so that the factories from directives or pipes can take precedence. configurable: true }); } } var USE_VALUE = getClosureSafeProperty({ provide: String, useValue: getClosureSafeProperty }); function isUseClassProvider(meta) { return meta.useClass !== void 0; } function isUseValueProvider(meta) { return USE_VALUE in meta; } function isUseFactoryProvider(meta) { return meta.useFactory !== void 0; } function isUseExistingProvider(meta) { return meta.useExisting !== void 0; } function getInjectableMetadata(type, srcMeta) { const meta = srcMeta || { providedIn: null }; const compilerMeta = { name: type.name, type, typeArgumentCount: 0, providedIn: meta.providedIn }; if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== void 0) { compilerMeta.deps = convertDependencies(meta.deps); } if (isUseClassProvider(meta)) { compilerMeta.useClass = meta.useClass; } else if (isUseValueProvider(meta)) { compilerMeta.useValue = meta.useValue; } else if (isUseFactoryProvider(meta)) { compilerMeta.useFactory = meta.useFactory; } else if (isUseExistingProvider(meta)) { compilerMeta.useExisting = meta.useExisting; } return compilerMeta; } var Injectable = makeDecorator("Injectable", void 0, void 0, void 0, (type, meta) => compileInjectable(type, meta)); function createInjector(defType, parent = null, additionalProviders = null, name) { const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name); injector.resolveInjectorInitializers(); return injector; } function createInjectorWithoutInjectorInstances(defType, parent = null, additionalProviders = null, name, scopes = /* @__PURE__ */ new Set()) { const providers = [additionalProviders || EMPTY_ARRAY, importProvidersFrom(defType)]; name = name || (typeof defType === "object" ? void 0 : stringify(defType)); return new R3Injector(providers, parent || getNullInjector(), name || null, scopes); } var Injector = class _Injector { static { this.THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND; } static { this.NULL = new NullInjector(); } static create(options, parent) { if (Array.isArray(options)) { return createInjector({ name: "" }, parent, options, ""); } else { const name = options.name ?? ""; return createInjector({ name }, options.parent, options.providers, name); } } static { this.\u0275prov = \u0275\u0275defineInjectable({ token: _Injector, providedIn: "any", factory: () => \u0275\u0275inject(INJECTOR$1) }); } static { this.__NG_ELEMENT_ID__ = -1; } }; var HOST_TAG_NAME = new InjectionToken(ngDevMode ? "HOST_TAG_NAME" : ""); HOST_TAG_NAME.__NG_ELEMENT_ID__ = (flags) => { const tNode = getCurrentTNode(); if (tNode === null) { throw new RuntimeError(204, ngDevMode && "HOST_TAG_NAME can only be injected in directives and components during construction time (in a class constructor or as a class field initializer)"); } if (tNode.type & 2) { return tNode.value; } if (flags & InjectFlags.Optional) { return null; } throw new RuntimeError(204, ngDevMode && `HOST_TAG_NAME was used on ${getDevModeNodeName(tNode)} which doesn't have an underlying element in the DOM. This is invalid, and so the dependency should be marked as optional.`); }; function getDevModeNodeName(tNode) { if (tNode.type & 8) { return "an "; } else if (tNode.type & 4) { return "an "; } else if (tNode.type & 128) { return "an @let declaration"; } else { return "a node"; } } var ERROR_ORIGINAL_ERROR = "ngOriginalError"; function getOriginalError(error) { return error[ERROR_ORIGINAL_ERROR]; } var SCHEDULE_IN_ROOT_ZONE_DEFAULT = true; var DestroyRef = class { static { this.__NG_ELEMENT_ID__ = injectDestroyRef; } static { this.__NG_ENV_ID__ = (injector) => injector; } }; var NodeInjectorDestroyRef = class extends DestroyRef { constructor(_lView) { super(); this._lView = _lView; } onDestroy(callback) { storeLViewOnDestroy(this._lView, callback); return () => removeLViewOnDestroy(this._lView, callback); } }; function injectDestroyRef() { return new NodeInjectorDestroyRef(getLView()); } var PendingTasks = class _PendingTasks { constructor() { this.taskId = 0; this.pendingTasks = /* @__PURE__ */ new Set(); this.hasPendingTasks = new BehaviorSubject(false); } get _hasPendingTasks() { return this.hasPendingTasks.value; } add() { if (!this._hasPendingTasks) { this.hasPendingTasks.next(true); } const taskId = this.taskId++; this.pendingTasks.add(taskId); return taskId; } remove(taskId) { this.pendingTasks.delete(taskId); if (this.pendingTasks.size === 0 && this._hasPendingTasks) { this.hasPendingTasks.next(false); } } ngOnDestroy() { this.pendingTasks.clear(); if (this._hasPendingTasks) { this.hasPendingTasks.next(false); } } static { this.\u0275prov = \u0275\u0275defineInjectable({ token: _PendingTasks, providedIn: "root", factory: () => new _PendingTasks() }); } }; var ExperimentalPendingTasks = class _ExperimentalPendingTasks { constructor() { this.internalPendingTasks = inject(PendingTasks); } /** * Adds a new task that should block application's stability. * @returns A cleanup function that removes a task when called. */ add() { const taskId = this.internalPendingTasks.add(); return () => this.internalPendingTasks.remove(taskId); } static { this.\u0275prov = \u0275\u0275defineInjectable({ token: _ExperimentalPendingTasks, providedIn: "root", factory: () => new _ExperimentalPendingTasks() }); } }; var EventEmitter_ = class extends Subject { constructor(isAsync = false) { super(); this.destroyRef = void 0; this.pendingTasks = void 0; this.__isAsync = isAsync; if (isInInjectionContext()) { this.destroyRef = inject(DestroyRef, { optional: true }) ?? void 0; this.pendingTasks = inject(PendingTasks, { optional: true }) ?? void 0; } } emit(value) { const prevConsumer = setActiveConsumer(null); try { super.next(value); } finally { setActiveConsumer(prevConsumer); } } subscribe(observerOrNext, error, complete) { let nextFn = observerOrNext; let errorFn = error || (() => null); let completeFn = complete; if (observerOrNext && typeof observerOrNext === "object") { const observer = observerOrNext; nextFn = observer.next?.bind(observer); errorFn = observer.error?.bind(observer); completeFn = observer.complete?.bind(observer); } if (this.__isAsync) { errorFn = this.wrapInTimeout(errorFn); if (nextFn) { nextFn = this.wrapInTimeout(nextFn); } if (completeFn) { completeFn = this.wrapInTimeout(completeFn); } } const sink = super.subscribe({ next: nextFn, error: errorFn, complete: completeFn }); if (observerOrNext instanceof Subscription) { observerOrNext.add(sink); } return sink; } wrapInTimeout(fn) { return (value) => { const taskId = this.pendingTasks?.add(); setTimeout(() => { fn(value); if (taskId !== void 0) { this.pendingTasks?.remove(taskId); } }); }; } }; var EventEmitter = EventEmitter_; function noop2(...args) { } function scheduleCallbackWithRafRace(callback) { let timeoutId; let animationFrameId; function cleanup() { callback = noop2; try { if (animationFrameId !== void 0 && typeof cancelAnimationFrame === "function") { cancelAnimationFrame(animationFrameId); } if (timeoutId !== void 0) { clearTimeout(timeoutId); } } catch { } } timeoutId = setTimeout(() => { callback(); cleanup(); }); if (typeof requestAnimationFrame === "function") { animationFrameId = requestAnimationFrame(() => { callback(); cleanup(); }); } return () => cleanup(); } function scheduleCallbackWithMicrotask(callback) { queueMicrotask(() => callback()); return () => { callback = noop2; }; } var AsyncStackTaggingZoneSpec = class { constructor(namePrefix, consoleAsyncStackTaggingImpl = console) { this.name = "asyncStackTagging for " + namePrefix; this.createTask = consoleAsyncStackTaggingImpl?.createTask ?? (() => null); } onScheduleTask(delegate, _current, target, task) { task.consoleTask = this.createTask(`Zone - ${task.source || task.type}`); return delegate.scheduleTask(target, task); } onInvokeTask(delegate, _currentZone, targetZone, task, applyThis, applyArgs) { let ret; if (task.consoleTask) { ret = task.consoleTask.run(() => delegate.invokeTask(targetZone, task, applyThis, applyArgs)); } else { ret = delegate.invokeTask(targetZone, task, applyThis, applyArgs); } return ret; } }; var isAngularZoneProperty = "isAngularZone"; var angularZoneInstanceIdProperty = isAngularZoneProperty + "_ID"; var ngZoneInstanceId = 0; var NgZone = class _NgZone { constructor(options) { this.hasPendingMacrotasks = false; this.hasPendingMicrotasks = false; this.isStable = true; this.onUnstable = new EventEmitter(false); this.onMicrotaskEmpty = new EventEmitter(false); this.onStable = new EventEmitter(false); this.onError = new EventEmitter(false); const { enableLongStackTrace = false, shouldCoalesceEventChangeDetection = false, shouldCoalesceRunChangeDetection = false, scheduleInRootZone = SCHEDULE_IN_ROOT_ZONE_DEFAULT } = options; if (typeof Zone == "undefined") { throw new RuntimeError(908, ngDevMode && `In this configuration Angular requires Zone.js`); } Zone.assertZonePatched(); const self = this; self._nesting = 0; self._outer = self._inner = Zone.current; if (ngDevMode) { self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec("Angular")); } if (Zone["TaskTrackingZoneSpec"]) { self._inner = self._inner.fork(new Zone["TaskTrackingZoneSpec"]()); } if (enableLongStackTrace && Zone["longStackTraceZoneSpec"]) { self._inner = self._inner.fork(Zone["longStackTraceZoneSpec"]); } self.shouldCoalesceEventChangeDetection = !shouldCoalesceRunChangeDetection && shouldCoalesceEventChangeDetection; self.shouldCoalesceRunChangeDetection = shouldCoalesceRunChangeDetection; self.callbackScheduled = false; self.scheduleInRootZone = scheduleInRootZone; forkInnerZoneWithAngularBehavior(self); } /** This method checks whether the method call happens within an Angular Zone instance. */ static isInAngularZone() { return typeof Zone !== "undefined" && Zone.current.get(isAngularZoneProperty) === true; } /** Assures that the method is called within the Angular Zone, otherwise throws an error. */ static assertInAngularZone() { if (!_NgZone.isInAngularZone()) { throw new RuntimeError(909, ngDevMode && "Expected to be in Angular Zone, but it is not!"); } } /** Assures that the method is called outside of the Angular Zone, otherwise throws an error. */ static assertNotInAngularZone() { if (_NgZone.isInAngularZone()) { throw new RuntimeError(909, ngDevMode && "Expected to not be in Angular Zone, but it is!"); } } /** * Executes the `fn` function synchronously within the Angular zone and returns value returned by * the function. * * Running functions via `run` allows you to reenter Angular zone from a task that was executed * outside of the Angular zone (typically started via {@link #runOutsideAngular}). * * Any future tasks or microtasks scheduled from within this function will continue executing from * within the Angular zone. * * If a synchronous error happens it will be rethrown and not reported via `onError`. */ run(fn, applyThis, applyArgs) { return this._inner.run(fn, applyThis, applyArgs); } /** * Executes the `fn` function synchronously within the Angular zone as a task and returns value * returned by the function. * * Running functions via `run` allows you to reenter Angular zone from a task that was executed * outside of the Angular zone (typically started via {@link #runOutsideAngular}). * * Any future tasks or microtasks scheduled from within this function will continue executing from * within the Angular zone. * * If a synchronous error happens it will be rethrown and not reported via `onError`. */ runTask(fn, applyThis, applyArgs, name) { const zone = this._inner; const task = zone.scheduleEventTask("NgZoneEvent: " + name, fn, EMPTY_PAYLOAD, noop2, noop2); try { return zone.runTask(task, applyThis, applyArgs); } finally { zone.cancelTask(task); } } /** * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not * rethrown. */ runGuarded(fn, applyThis, applyArgs) { return this._inner.runGuarded(fn, applyThis, applyArgs); } /** * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by * the function. * * Running functions via {@link #runOutsideAngular} allows you to escape Angular's zone and do * work that * doesn't trigger Angular change-detection or is subject to Angular's error handling. * * Any future tasks or microtasks scheduled from within this function will continue executing from * outside of the Angular zone. * * Use {@link #run} to reenter the Angular zone and do work that updates the application model. */ runOutsideAngular(fn) { return this._outer.run(fn); } }; var EMPTY_PAYLOAD = {}; function checkStable(zone) { if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) { try { zone._nesting++; zone.onMicrotaskEmpty.emit(null); } finally { zone._nesting--; if (!zone.hasPendingMicrotasks) { try { zone.runOutsideAngular(() => zone.onStable.emit(null)); } finally { zone.isStable = true; } } } } } function delayChangeDetectionForEvents(zone) { if (zone.isCheckStableRunning || zone.callbackScheduled) { return; } zone.callbackScheduled = true; function scheduleCheckStable() { scheduleCallbackWithRafRace(() => { zone.callbackScheduled = false; updateMicroTaskStatus(zone); zone.isCheckStableRunning = true; checkStable(zone); zone.isCheckStableRunning = false; }); } if (zone.scheduleInRootZone) { Zone.root.run(() => { scheduleCheckStable(); }); } else { zone._outer.run(() => { scheduleCheckStable(); }); } updateMicroTaskStatus(zone); } function forkInnerZoneWithAngularBehavior(zone) { const delayChangeDetectionForEventsDelegate = () => { delayChangeDetectionForEvents(zone); }; const instanceId = ngZoneInstanceId++; zone._inner = zone._inner.fork({ name: "angular", properties: { [isAngularZoneProperty]: true, [angularZoneInstanceIdProperty]: instanceId, [angularZoneInstanceIdProperty + instanceId]: true }, onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => { if (shouldBeIgnoredByZone(applyArgs)) { return delegate.invokeTask(target, task, applyThis, applyArgs); } try { onEnter(zone); return delegate.invokeTask(target, task, applyThis, applyArgs); } finally { if (zone.shouldCoalesceEventChangeDetection && task.type === "eventTask" || zone.shouldCoalesceRunChangeDetection) { delayChangeDetectionForEventsDelegate(); } onLeave(zone); } }, onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => { try { onEnter(zone); return delegate.invoke(target, callback, applyThis, applyArgs, source); } finally { if (zone.shouldCoalesceRunChangeDetection && // Do not delay change detection when the task is the scheduler's tick. // We need to synchronously trigger the stability logic so that the // zone-based scheduler can prevent a duplicate ApplicationRef.tick // by first checking if the scheduler tick is running. This does seem a bit roundabout, // but we _do_ still want to trigger all the correct events when we exit the zone.run // (`onMicrotaskEmpty` and `onStable` _should_ emit; developers can have code which // relies on these events happening after change detection runs). // Note: `zone.callbackScheduled` is already in delayChangeDetectionForEventsDelegate // but is added here as well to prevent reads of applyArgs when not necessary !zone.callbackScheduled && !isSchedulerTick(applyArgs)) { delayChangeDetectionForEventsDelegate(); } onLeave(zone); } }, onHasTask: (delegate, current, target, hasTaskState) => { delegate.hasTask(target, hasTaskState); if (current === target) { if (hasTaskState.change == "microTask") { zone._hasPendingMicrotasks = hasTaskState.microTask; updateMicroTaskStatus(zone); checkStable(zone); } else if (hasTaskState.change == "macroTask") { zone.hasPendingMacrotasks = hasTaskState.macroTask; } } }, onHandleError: (delegate, current, target, error) => { delegate.handleError(target, error); zone.runOutsideAngular(() => zone.onError.emit(error)); return false; } }); } function updateMicroTaskStatus(zone) { if (zone._hasPendingMicrotasks || (zone.shouldCoalesceEventChangeDetection || zone.shouldCoalesceRunChangeDetection) && zone.callbackScheduled === true) { zone.hasPendingMicrotasks = true; } else { zone.hasPendingMicrotasks = false; } } function onEnter(zone) { zone._nesting++; if (zone.isStable) { zone.isStable = false; zone.onUnstable.emit(null); } } function onLeave(zone) { zone._nesting--; checkStable(zone); } var NoopNgZone = class { constructor() { this.hasPendingMicrotasks = false; this.hasPendingMacrotasks = false; this.isStable = true; this.onUnstable = new EventEmitter(); this.onMicrotaskEmpty = new EventEmitter(); this.onStable = new EventEmitter(); this.onError = new EventEmitter(); } run(fn, applyThis, applyArgs) { return fn.apply(applyThis, applyArgs); } runGuarded(fn, applyThis, applyArgs) { return fn.apply(applyThis, applyArgs); } runOutsideAngular(fn) { return fn(); } runTask(fn, applyThis, applyArgs, name) { return fn.apply(applyThis, applyArgs); } }; function shouldBeIgnoredByZone(applyArgs) { return hasApplyArgsData(applyArgs, "__ignore_ng_zone__"); } function isSchedulerTick(applyArgs) { return hasApplyArgsData(applyArgs, "__scheduler_tick__"); } function hasApplyArgsData(applyArgs, key) { if (!Array.isArray(applyArgs)) { return false; } if (applyArgs.length !== 1) { return false; } return applyArgs[0]?.data?.[key] === true; } function getNgZone(ngZoneToUse = "zone.js", options) { if (ngZoneToUse === "noop") { return new NoopNgZone(); } if (ngZoneToUse === "zone.js") { return new NgZone(options); } return ngZoneToUse; } var ErrorHandler = class { constructor() { this._console = console; } handleError(error) { const originalError = this._findOriginalError(error); this._console.error("ERROR", error); if (originalError) { this._console.error("ORIGINAL ERROR", originalError); } } /** @internal */ _findOriginalError(error) { let e = error && getOriginalError(error); while (e && getOriginalError(e)) { e = getOriginalError(e); } return e || null; } }; var INTERNAL_APPLICATION_ERROR_HANDLER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "internal error handler" : "", { providedIn: "root", factory: () => { const zone = inject(NgZone); const userErrorHandler = inject(ErrorHandler); return (e) => zone.runOutsideAngular(() => userErrorHandler.handleError(e)); } }); var OutputEmitterRef = class { constructor() { this.destroyed = false; this.listeners = null; this.errorHandler = inject(ErrorHandler, { optional: true }); this.destroyRef = inject(DestroyRef); this.destroyRef.onDestroy(() => { this.destroyed = true; this.listeners = null; }); } subscribe(callback) { if (this.destroyed) { throw new RuntimeError(953, ngDevMode && "Unexpected subscription to destroyed `OutputRef`. The owning directive/component is destroyed."); } (this.listeners ??= []).push(callback); return { unsubscribe: () => { const idx = this.listeners?.indexOf(callback); if (idx !== void 0 && idx !== -1) { this.listeners?.splice(idx, 1); } } }; } /** Emits a new value to the output. */ emit(value) { if (this.destroyed) { throw new RuntimeError(953, ngDevMode && "Unexpected emit for destroyed `OutputRef`. The owning directive/component is destroyed."); } if (this.listeners === null) { return; } const previousConsumer = setActiveConsumer(null); try { for (const listenerFn of this.listeners) { try { listenerFn(value); } catch (err) { this.errorHandler?.handleError(err); } } } finally { setActiveConsumer(previousConsumer); } } }; function inputFunction(initialValue, opts) { ngDevMode && assertInInjectionContext(input); return createInputSignal(initialValue, opts); } function inputRequiredFunction(opts) { ngDevMode && assertInInjectionContext(input); return createInputSignal(REQUIRED_UNSET_VALUE, opts); } var input = (() => { inputFunction.required = inputRequiredFunction; return inputFunction; })(); function injectElementRef() { return createElementRef(getCurrentTNode(), getLView()); } function createElementRef(tNode, lView) { return new ElementRef(getNativeByTNode(tNode, lView)); } var ElementRef = class { constructor(nativeElement) { this.nativeElement = nativeElement; } static { this.__NG_ELEMENT_ID__ = injectElementRef; } }; function unwrapElementRef(value) { return value instanceof ElementRef ? value.nativeElement : value; } function symbolIterator() { return this._results[Symbol.iterator](); } var QueryList = class _QueryList { static { Symbol.iterator; } /** * Returns `Observable` of `QueryList` notifying the subscriber of changes. */ get changes() { return this._changes ??= new EventEmitter(); } /** * @param emitDistinctChangesOnly Whether `QueryList.changes` should fire only when actual change * has occurred. Or if it should fire when query is recomputed. (recomputing could resolve in * the same result) */ constructor(_emitDistinctChangesOnly = false) { this._emitDistinctChangesOnly = _emitDistinctChangesOnly; this.dirty = true; this._onDirty = void 0; this._results = []; this._changesDetected = false; this._changes = void 0; this.length = 0; this.first = void 0; this.last = void 0; const proto = _QueryList.prototype; if (!proto[Symbol.iterator]) proto[Symbol.iterator] = symbolIterator; } /** * Returns the QueryList entry at `index`. */ get(index) { return this._results[index]; } /** * See * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) */ map(fn) { return this._results.map(fn); } filter(fn) { return this._results.filter(fn); } /** * See * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) */ find(fn) { return this._results.find(fn); } /** * See * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) */ reduce(fn, init) { return this._results.reduce(fn, init); } /** * See * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) */ forEach(fn) { this._results.forEach(fn); } /** * See * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) */ some(fn) { return this._results.some(fn); } /** * Returns a copy of the internal results list as an Array. */ toArray() { return this._results.slice(); } toString() { return this._results.toString(); } /** * Updates the stored data of the query list, and resets the `dirty` flag to `false`, so that * on change detection, it will not notify of changes to the queries, unless a new change * occurs. * * @param resultsTree The query results to store * @param identityAccessor Optional function for extracting stable object identity from a value * in the array. This function is executed for each element of the query result list while * comparing current query list with the new one (provided as a first argument of the `reset` * function) to detect if the lists are different. If the function is not provided, elements * are compared as is (without any pre-processing). */ reset(resultsTree, identityAccessor) { this.dirty = false; const newResultFlat = flatten(resultsTree); if (this._changesDetected = !arrayEquals(this._results, newResultFlat, identityAccessor)) { this._results = newResultFlat; this.length = newResultFlat.length; this.last = newResultFlat[this.length - 1]; this.first = newResultFlat[0]; } } /** * Triggers a change event by emitting on the `changes` {@link EventEmitter}. */ notifyOnChanges() { if (this._changes !== void 0 && (this._changesDetected || !this._emitDistinctChangesOnly)) this._changes.emit(this); } /** @internal */ onDirty(cb) { this._onDirty = cb; } /** internal */ setDirty() { this.dirty = true; this._onDirty?.(); } /** internal */ destroy() { if (this._changes !== void 0) { this._changes.complete(); this._changes.unsubscribe(); } } }; function hasInSkipHydrationBlockFlag(tNode) { return (tNode.flags & 128) === 128; } var TRACKED_LVIEWS = /* @__PURE__ */ new Map(); var uniqueIdCounter = 0; function getUniqueLViewId() { return uniqueIdCounter++; } function registerLView(lView) { ngDevMode && assertNumber(lView[ID], "LView must have an ID in order to be registered"); TRACKED_LVIEWS.set(lView[ID], lView); } function getLViewById(id) { ngDevMode && assertNumber(id, "ID used for LView lookup must be a number"); return TRACKED_LVIEWS.get(id) || null; } function unregisterLView(lView) { ngDevMode && assertNumber(lView[ID], "Cannot stop tracking an LView that does not have an ID"); TRACKED_LVIEWS.delete(lView[ID]); } var LContext = class { /** Component's parent view data. */ get lView() { return getLViewById(this.lViewId); } constructor(lViewId, nodeIndex, native) { this.lViewId = lViewId; this.nodeIndex = nodeIndex; this.native = native; } }; function getLContext(target) { let mpValue = readPatchedData(target); if (mpValue) { if (isLView(mpValue)) { const lView = mpValue; let nodeIndex; let component = void 0; let directives = void 0; if (isComponentInstance(target)) { nodeIndex = findViaComponent(lView, target); if (nodeIndex == -1) { throw new Error("The provided component was not found in the application"); } component = target; } else if (isDirectiveInstance(target)) { nodeIndex = findViaDirective(lView, target); if (nodeIndex == -1) { throw new Error("The provided directive was not found in the application"); } directives = getDirectivesAtNodeIndex(nodeIndex, lView); } else { nodeIndex = findViaNativeElement(lView, target); if (nodeIndex == -1) { return null; } } const native = unwrapRNode(lView[nodeIndex]); const existingCtx = readPatchedData(native); const context2 = existingCtx && !Array.isArray(existingCtx) ? existingCtx : createLContext(lView, nodeIndex, native); if (component && context2.component === void 0) { context2.component = component; attachPatchData(context2.component, context2); } if (directives && context2.directives === void 0) { context2.directives = directives; for (let i = 0; i < directives.length; i++) { attachPatchData(directives[i], context2); } } attachPatchData(context2.native, context2); mpValue = context2; } } else { const rElement = target; ngDevMode && assertDomNode(rElement); let parent = rElement; while (parent = parent.parentNode) { const parentContext = readPatchedData(parent); if (parentContext) { const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView; if (!lView) { return null; } const index = findViaNativeElement(lView, rElement); if (index >= 0) { const native = unwrapRNode(lView[index]); const context2 = createLContext(lView, index, native); attachPatchData(native, context2); mpValue = context2; break; } } } } return mpValue || null; } function createLContext(lView, nodeIndex, native) { return new LContext(lView[ID], nodeIndex, native); } function getComponentViewByInstance(componentInstance) { let patchedData = readPatchedData(componentInstance); let lView; if (isLView(patchedData)) { const contextLView = patchedData; const nodeIndex = findViaComponent(contextLView, componentInstance); lView = getComponentLViewByIndex(nodeIndex, contextLView); const context2 = createLContext(contextLView, nodeIndex, lView[HOST]); context2.component = componentInstance; attachPatchData(componentInstance, context2); attachPatchData(context2.native, context2); } else { const context2 = patchedData; const contextLView = context2.lView; ngDevMode && assertLView(contextLView); lView = getComponentLViewByIndex(context2.nodeIndex, contextLView); } return lView; } var MONKEY_PATCH_KEY_NAME = "__ngContext__"; function attachPatchData(target, data) { ngDevMode && assertDefined(target, "Target expected"); if (isLView(data)) { target[MONKEY_PATCH_KEY_NAME] = data[ID]; registerLView(data); } else { target[MONKEY_PATCH_KEY_NAME] = data; } } function readPatchedData(target) { ngDevMode && assertDefined(target, "Target expected"); const data = target[MONKEY_PATCH_KEY_NAME]; return typeof data === "number" ? getLViewById(data) : data || null; } function readPatchedLView(target) { const value = readPatchedData(target); if (value) { return isLView(value) ? value : value.lView; } return null; } function isComponentInstance(instance) { return instance && instance.constructor && instance.constructor.\u0275cmp; } function isDirectiveInstance(instance) { return instance && instance.constructor && instance.constructor.\u0275dir; } function findViaNativeElement(lView, target) { const tView = lView[TVIEW]; for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) { if (unwrapRNode(lView[i]) === target) { return i; } } return -1; } function traverseNextElement(tNode) { if (tNode.child) { return tNode.child; } else if (tNode.next) { return tNode.next; } else { while (tNode.parent && !tNode.parent.next) { tNode = tNode.parent; } return tNode.parent && tNode.parent.next; } } function findViaComponent(lView, componentInstance) { const componentIndices = lView[TVIEW].components; if (componentIndices) { for (let i = 0; i < componentIndices.length; i++) { const elementComponentIndex = componentIndices[i]; const componentView = getComponentLViewByIndex(elementComponentIndex, lView); if (componentView[CONTEXT] === componentInstance) { return elementComponentIndex; } } } else { const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView); const rootComponent = rootComponentView[CONTEXT]; if (rootComponent === componentInstance) { return HEADER_OFFSET; } } return -1; } function findViaDirective(lView, directiveInstance) { let tNode = lView[TVIEW].firstChild; while (tNode) { const directiveIndexStart = tNode.directiveStart; const directiveIndexEnd = tNode.directiveEnd; for (let i = directiveIndexStart; i < directiveIndexEnd; i++) { if (lView[i] === directiveInstance) { return tNode.index; } } tNode = traverseNextElement(tNode); } return -1; } function getDirectivesAtNodeIndex(nodeIndex, lView) { const tNode = lView[TVIEW].data[nodeIndex]; if (tNode.directiveStart === 0) return EMPTY_ARRAY; const results = []; for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) { const directiveInstance = lView[i]; if (!isComponentInstance(directiveInstance)) { results.push(directiveInstance); } } return results; } function getComponentAtNodeIndex(nodeIndex, lView) { const tNode = lView[TVIEW].data[nodeIndex]; const { directiveStart, componentOffset } = tNode; return componentOffset > -1 ? lView[directiveStart + componentOffset] : null; } function getRootView(componentOrLView) { ngDevMode && assertDefined(componentOrLView, "component"); let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView); while (lView && !(lView[FLAGS] & 512)) { lView = getLViewParent(lView); } ngDevMode && assertLView(lView); return lView; } function getRootContext(viewOrComponent) { const rootView = getRootView(viewOrComponent); ngDevMode && assertDefined(rootView[CONTEXT], "Root view has no context. Perhaps it is disconnected?"); return rootView[CONTEXT]; } function getFirstLContainer(lView) { return getNearestLContainer(lView[CHILD_HEAD]); } function getNextLContainer(container) { return getNearestLContainer(container[NEXT]); } function getNearestLContainer(viewOrContainer) { while (viewOrContainer !== null && !isLContainer(viewOrContainer)) { viewOrContainer = viewOrContainer[NEXT]; } return viewOrContainer; } function getComponent$1(element) { ngDevMode && assertDomElement(element); const context2 = getLContext(element); if (context2 === null) return null; if (context2.component === void 0) { const lView = context2.lView; if (lView === null) { return null; } context2.component = getComponentAtNodeIndex(context2.nodeIndex, lView); } return context2.component; } function getContext(element) { assertDomElement(element); const context2 = getLContext(element); const lView = context2 ? context2.lView : null; return lView === null ? null : lView[CONTEXT]; } function getOwningComponent(elementOrDir) { const context2 = getLContext(elementOrDir); let lView = context2 ? context2.lView : null; if (lView === null) return null; let parent; while (lView[TVIEW].type === 2 && (parent = getLViewParent(lView))) { lView = parent; } return lView[FLAGS] & 512 ? null : lView[CONTEXT]; } function getRootComponents(elementOrDir) { const lView = readPatchedLView(elementOrDir); return lView !== null ? [getRootContext(lView)] : []; } function getInjector(elementOrDir) { const context2 = getLContext(elementOrDir); const lView = context2 ? context2.lView : null; if (lView === null) return Injector.NULL; const tNode = lView[TVIEW].data[context2.nodeIndex]; return new NodeInjector(tNode, lView); } function getDirectives(node) { if (node instanceof Text) { return []; } const context2 = getLContext(node); const lView = context2 ? context2.lView : null; if (lView === null) { return []; } const tView = lView[TVIEW]; const nodeIndex = context2.nodeIndex; if (!tView?.data[nodeIndex]) { return []; } if (context2.directives === void 0) { context2.directives = getDirectivesAtNodeIndex(nodeIndex, lView); } return context2.directives === null ? [] : [...context2.directives]; } function getDirectiveMetadata$1(directiveOrComponentInstance) { const { constructor } = directiveOrComponentInstance; if (!constructor) { throw new Error("Unable to find the instance constructor"); } const componentDef = getComponentDef(constructor); if (componentDef) { const inputs = extractInputDebugMetadata(componentDef.inputs); return { inputs, outputs: componentDef.outputs, encapsulation: componentDef.encapsulation, changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush : ChangeDetectionStrategy.Default }; } const directiveDef = getDirectiveDef(constructor); if (directiveDef) { const inputs = extractInputDebugMetadata(directiveDef.inputs); return { inputs, outputs: directiveDef.outputs }; } return null; } function getHostElement(componentOrDirective) { return getLContext(componentOrDirective).native; } function getListeners(element) { ngDevMode && assertDomElement(element); const lContext = getLContext(element); const lView = lContext === null ? null : lContext.lView; if (lView === null) return []; const tView = lView[TVIEW]; const lCleanup = lView[CLEANUP]; const tCleanup = tView.cleanup; const listeners = []; if (tCleanup && lCleanup) { for (let i = 0; i < tCleanup.length; ) { const firstParam = tCleanup[i++]; const secondParam = tCleanup[i++]; if (typeof firstParam === "string") { const name = firstParam; const listenerElement = unwrapRNode(lView[secondParam]); const callback = lCleanup[tCleanup[i++]]; const useCaptureOrIndx = tCleanup[i++]; const type = typeof useCaptureOrIndx === "boolean" || useCaptureOrIndx >= 0 ? "dom" : "output"; const useCapture = typeof useCaptureOrIndx === "boolean" ? useCaptureOrIndx : false; if (element == listenerElement) { listeners.push({ element, name, callback, useCapture, type }); } } } } listeners.sort(sortListeners); return listeners; } function sortListeners(a, b) { if (a.name == b.name) return 0; return a.name < b.name ? -1 : 1; } function assertDomElement(value) { if (typeof Element !== "undefined" && !(value instanceof Element)) { throw new Error("Expecting instance of DOM Element"); } } function extractInputDebugMetadata(inputs) { const res = {}; for (const key in inputs) { if (!inputs.hasOwnProperty(key)) { continue; } const value = inputs[key]; if (value === void 0) { continue; } let minifiedName; if (Array.isArray(value)) { minifiedName = value[0]; } else { minifiedName = value; } res[key] = minifiedName; } return res; } var DOCUMENT = void 0; function setDocument(document2) { DOCUMENT = document2; } function getDocument() { if (DOCUMENT !== void 0) { return DOCUMENT; } else if (typeof document !== "undefined") { return document; } throw new RuntimeError(210, (typeof ngDevMode === "undefined" || ngDevMode) && `The document object is not available in this context. Make sure the DOCUMENT injection token is provided.`); } var APP_ID = new InjectionToken(ngDevMode ? "AppId" : "", { providedIn: "root", factory: () => DEFAULT_APP_ID }); var DEFAULT_APP_ID = "ng"; var PLATFORM_INITIALIZER = new InjectionToken(ngDevMode ? "Platform Initializer" : ""); var PLATFORM_ID = new InjectionToken(ngDevMode ? "Platform ID" : "", { providedIn: "platform", factory: () => "unknown" // set a default platform name, when none set explicitly }); var PACKAGE_ROOT_URL = new InjectionToken(ngDevMode ? "Application Packages Root URL" : ""); var ANIMATION_MODULE_TYPE = new InjectionToken(ngDevMode ? "AnimationModuleType" : ""); var CSP_NONCE = new InjectionToken(ngDevMode ? "CSP nonce" : "", { providedIn: "root", factory: () => { return getDocument().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce") || null; } }); var IMAGE_CONFIG_DEFAULTS = { breakpoints: [16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840], placeholderResolution: 30, disableImageSizeWarning: false, disableImageLazyLoadWarning: false }; var IMAGE_CONFIG = new InjectionToken(ngDevMode ? "ImageConfig" : "", { providedIn: "root", factory: () => IMAGE_CONFIG_DEFAULTS }); function makeStateKey(key) { return key; } function initTransferState() { const transferState = new TransferState(); if (inject(PLATFORM_ID) === "browser") { transferState.store = retrieveTransferredState(getDocument(), inject(APP_ID)); } return transferState; } var TransferState = class _TransferState { constructor() { this.store = {}; this.onSerializeCallbacks = {}; } static { this.\u0275prov = \u0275\u0275defineInjectable({ token: _TransferState, providedIn: "root", factory: initTransferState }); } /** * Get the value corresponding to a key. Return `defaultValue` if key is not found. */ get(key, defaultValue) { return this.store[key] !== void 0 ? this.store[key] : defaultValue; } /** * Set the value corresponding to a key. */ set(key, value) { this.store[key] = value; } /** * Remove a key from the store. */ remove(key) { delete this.store[key]; } /** * Test whether a key exists in the store. */ hasKey(key) { return this.store.hasOwnProperty(key); } /** * Indicates whether the state is empty. */ get isEmpty() { return Object.keys(this.store).length === 0; } /** * Register a callback to provide the value for a key when `toJson` is called. */ onSerialize(key, callback) { this.onSerializeCallbacks[key] = callback; } /** * Serialize the current state of the store to JSON. */ toJson() { for (const key in this.onSerializeCallbacks) { if (this.onSerializeCallbacks.hasOwnProperty(key)) { try { this.store[key] = this.onSerializeCallbacks[key](); } catch (e) { console.warn("Exception in onSerialize callback: ", e); } } } return JSON.stringify(this.store).replace(/ null; function retrieveHydrationInfo(rNode, injector, isRootView2 = false) { return _retrieveHydrationInfoImpl(rNode, injector, isRootView2); } var HydrationStatus; (function(HydrationStatus2) { HydrationStatus2["Hydrated"] = "hydrated"; HydrationStatus2["Skipped"] = "skipped"; HydrationStatus2["Mismatched"] = "mismatched"; })(HydrationStatus || (HydrationStatus = {})); var IS_HYDRATION_DOM_REUSE_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_HYDRATION_DOM_REUSE_ENABLED" : ""); var PRESERVE_HOST_CONTENT_DEFAULT = false; var PRESERVE_HOST_CONTENT = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "PRESERVE_HOST_CONTENT" : "", { providedIn: "root", factory: () => PRESERVE_HOST_CONTENT_DEFAULT }); var IS_I18N_HYDRATION_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_I18N_HYDRATION_ENABLED" : ""); var IS_EVENT_REPLAY_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_EVENT_REPLAY_ENABLED" : ""); var policy$1; function getPolicy$1() { if (policy$1 === void 0) { policy$1 = null; if (_global.trustedTypes) { try { policy$1 = _global.trustedTypes.createPolicy("angular", { createHTML: (s) => s, createScript: (s) => s, createScriptURL: (s) => s }); } catch { } } } return policy$1; } function trustedHTMLFromString(html) { return getPolicy$1()?.createHTML(html) || html; } function trustedScriptURLFromString(url) { return getPolicy$1()?.createScriptURL(url) || url; } var policy; function getPolicy() { if (policy === void 0) { policy = null; if (_global.trustedTypes) { try { policy = _global.trustedTypes.createPolicy("angular#unsafe-bypass", { createHTML: (s) => s, createScript: (s) => s, createScriptURL: (s) => s }); } catch { } } } return policy; } function trustedHTMLFromStringBypass(html) { return getPolicy()?.createHTML(html) || html; } function trustedScriptFromStringBypass(script) { return getPolicy()?.createScript(script) || script; } function trustedScriptURLFromStringBypass(url) { return getPolicy()?.createScriptURL(url) || url; } var SafeValueImpl = class { constructor(changingThisBreaksApplicationSecurity) { this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity; } toString() { return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${XSS_SECURITY_URL})`; } }; var SafeHtmlImpl = class extends SafeValueImpl { getTypeName() { return "HTML"; } }; var SafeStyleImpl = class extends SafeValueImpl { getTypeName() { return "Style"; } }; var SafeScriptImpl = class extends SafeValueImpl { getTypeName() { return "Script"; } }; var SafeUrlImpl = class extends SafeValueImpl { getTypeName() { return "URL"; } }; var SafeResourceUrlImpl = class extends SafeValueImpl { getTypeName() { return "ResourceURL"; } }; function unwrapSafeValue(value) { return value instanceof SafeValueImpl ? value.changingThisBreaksApplicationSecurity : value; } function allowSanitizationBypassAndThrow(value, type) { const actualType = getSanitizationBypassType(value); if (actualType != null && actualType !== type) { if (actualType === "ResourceURL" && type === "URL") return true; throw new Error(`Required a safe ${type}, got a ${actualType} (see ${XSS_SECURITY_URL})`); } return actualType === type; } function getSanitizationBypassType(value) { return value instanceof SafeValueImpl && value.getTypeName() || null; } function bypassSanitizationTrustHtml(trustedHtml) { return new SafeHtmlImpl(trustedHtml); } function bypassSanitizationTrustStyle(trustedStyle) { return new SafeStyleImpl(trustedStyle); } function bypassSanitizationTrustScript(trustedScript) { return new SafeScriptImpl(trustedScript); } function bypassSanitizationTrustUrl(trustedUrl) { return new SafeUrlImpl(trustedUrl); } function bypassSanitizationTrustResourceUrl(trustedResourceUrl) { return new SafeResourceUrlImpl(trustedResourceUrl); } function getInertBodyHelper(defaultDoc) { const inertDocumentHelper = new InertDocumentHelper(defaultDoc); return isDOMParserAvailable() ? new DOMParserHelper(inertDocumentHelper) : inertDocumentHelper; } var DOMParserHelper = class { constructor(inertDocumentHelper) { this.inertDocumentHelper = inertDocumentHelper; } getInertBodyElement(html) { html = "" + html; try { const body = new window.DOMParser().parseFromString(trustedHTMLFromString(html), "text/html").body; if (body === null) { return this.inertDocumentHelper.getInertBodyElement(html); } body.firstChild?.remove(); return body; } catch { return null; } } }; var InertDocumentHelper = class { constructor(defaultDoc) { this.defaultDoc = defaultDoc; this.inertDocument = this.defaultDoc.implementation.createHTMLDocument("sanitization-inert"); } getInertBodyElement(html) { const templateEl = this.inertDocument.createElement("template"); templateEl.innerHTML = trustedHTMLFromString(html); return templateEl; } }; function isDOMParserAvailable() { try { return !!new window.DOMParser().parseFromString(trustedHTMLFromString(""), "text/html"); } catch { return false; } } var SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i; function _sanitizeUrl(url) { url = String(url); if (url.match(SAFE_URL_PATTERN)) return url; if (typeof ngDevMode === "undefined" || ngDevMode) { console.warn(`WARNING: sanitizing unsafe URL value ${url} (see ${XSS_SECURITY_URL})`); } return "unsafe:" + url; } function tagSet(tags) { const res = {}; for (const t of tags.split(",")) res[t] = true; return res; } function merge2(...sets) { const res = {}; for (const s of sets) { for (const v in s) { if (s.hasOwnProperty(v)) res[v] = true; } } return res; } var VOID_ELEMENTS = tagSet("area,br,col,hr,img,wbr"); var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"); var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet("rp,rt"); var OPTIONAL_END_TAG_ELEMENTS = merge2(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS); var BLOCK_ELEMENTS = merge2(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet("address,article,aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul")); var INLINE_ELEMENTS = merge2(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet("a,abbr,acronym,audio,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video")); var VALID_ELEMENTS = merge2(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS); var URI_ATTRS = tagSet("background,cite,href,itemtype,longdesc,poster,src,xlink:href"); var HTML_ATTRS = tagSet("abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,valign,value,vspace,width"); var ARIA_ATTRS = tagSet("aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext"); var VALID_ATTRS = merge2(URI_ATTRS, HTML_ATTRS, ARIA_ATTRS); var SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS = tagSet("script,style,template"); var SanitizingHtmlSerializer = class { constructor() { this.sanitizedSomething = false; this.buf = []; } sanitizeChildren(el) { let current = el.firstChild; let traverseContent = true; let parentNodes = []; while (current) { if (current.nodeType === Node.ELEMENT_NODE) { traverseContent = this.startElement(current); } else if (current.nodeType === Node.TEXT_NODE) { this.chars(current.nodeValue); } else { this.sanitizedSomething = true; } if (traverseContent && current.firstChild) { parentNodes.push(current); current = getFirstChild(current); continue; } while (current) { if (current.nodeType === Node.ELEMENT_NODE) { this.endElement(current); } let next = getNextSibling(current); if (next) { current = next; break; } current = parentNodes.pop(); } } return this.buf.join(""); } /** * Sanitizes an opening element tag (if valid) and returns whether the element's contents should * be traversed. Element content must always be traversed (even if the element itself is not * valid/safe), unless the element is one of `SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS`. * * @param element The element to sanitize. * @return True if the element's contents should be traversed. */ startElement(element) { const tagName = getNodeName(element).toLowerCase(); if (!VALID_ELEMENTS.hasOwnProperty(tagName)) { this.sanitizedSomething = true; return !SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS.hasOwnProperty(tagName); } this.buf.push("<"); this.buf.push(tagName); const elAttrs = element.attributes; for (let i = 0; i < elAttrs.length; i++) { const elAttr = elAttrs.item(i); const attrName = elAttr.name; const lower = attrName.toLowerCase(); if (!VALID_ATTRS.hasOwnProperty(lower)) { this.sanitizedSomething = true; continue; } let value = elAttr.value; if (URI_ATTRS[lower]) value = _sanitizeUrl(value); this.buf.push(" ", attrName, '="', encodeEntities(value), '"'); } this.buf.push(">"); return true; } endElement(current) { const tagName = getNodeName(current).toLowerCase(); if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) { this.buf.push(""); } } chars(chars) { this.buf.push(encodeEntities(chars)); } }; function isClobberedElement(parentNode, childNode) { return (parentNode.compareDocumentPosition(childNode) & Node.DOCUMENT_POSITION_CONTAINED_BY) !== Node.DOCUMENT_POSITION_CONTAINED_BY; } function getNextSibling(node) { const nextSibling = node.nextSibling; if (nextSibling && node !== nextSibling.previousSibling) { throw clobberedElementError(nextSibling); } return nextSibling; } function getFirstChild(node) { const firstChild = node.firstChild; if (firstChild && isClobberedElement(node, firstChild)) { throw clobberedElementError(firstChild); } return firstChild; } function getNodeName(node) { const nodeName = node.nodeName; return typeof nodeName === "string" ? nodeName : "FORM"; } function clobberedElementError(node) { return new Error(`Failed to sanitize html because the element is clobbered: ${node.outerHTML}`); } var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g; function encodeEntities(value) { return value.replace(/&/g, "&").replace(SURROGATE_PAIR_REGEXP, function(match) { const hi = match.charCodeAt(0); const low = match.charCodeAt(1); return "&#" + ((hi - 55296) * 1024 + (low - 56320) + 65536) + ";"; }).replace(NON_ALPHANUMERIC_REGEXP, function(match) { return "&#" + match.charCodeAt(0) + ";"; }).replace(//g, ">"); } var inertBodyHelper; function _sanitizeHtml(defaultDoc, unsafeHtmlInput) { let inertBodyElement = null; try { inertBodyHelper = inertBodyHelper || getInertBodyHelper(defaultDoc); let unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : ""; inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); let mXSSAttempts = 5; let parsedHtml = unsafeHtml; do { if (mXSSAttempts === 0) { throw new Error("Failed to sanitize html because the input is unstable"); } mXSSAttempts--; unsafeHtml = parsedHtml; parsedHtml = inertBodyElement.innerHTML; inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); } while (unsafeHtml !== parsedHtml); const sanitizer = new SanitizingHtmlSerializer(); const safeHtml = sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement) || inertBodyElement); if ((typeof ngDevMode === "undefined" || ngDevMode) && sanitizer.sanitizedSomething) { console.warn(`WARNING: sanitizing HTML stripped some content, see ${XSS_SECURITY_URL}`); } return trustedHTMLFromString(safeHtml); } finally { if (inertBodyElement) { const parent = getTemplateContent(inertBodyElement) || inertBodyElement; while (parent.firstChild) { parent.firstChild.remove(); } } } } function getTemplateContent(el) { return "content" in el && isTemplateElement(el) ? el.content : null; } function isTemplateElement(el) { return el.nodeType === Node.ELEMENT_NODE && el.nodeName === "TEMPLATE"; } var SecurityContext; (function(SecurityContext2) { SecurityContext2[SecurityContext2["NONE"] = 0] = "NONE"; SecurityContext2[SecurityContext2["HTML"] = 1] = "HTML"; SecurityContext2[SecurityContext2["STYLE"] = 2] = "STYLE"; SecurityContext2[SecurityContext2["SCRIPT"] = 3] = "SCRIPT"; SecurityContext2[SecurityContext2["URL"] = 4] = "URL"; SecurityContext2[SecurityContext2["RESOURCE_URL"] = 5] = "RESOURCE_URL"; })(SecurityContext || (SecurityContext = {})); function \u0275\u0275sanitizeHtml(unsafeHtml) { const sanitizer = getSanitizer(); if (sanitizer) { return trustedHTMLFromStringBypass(sanitizer.sanitize(SecurityContext.HTML, unsafeHtml) || ""); } if (allowSanitizationBypassAndThrow( unsafeHtml, "HTML" /* BypassType.Html */ )) { return trustedHTMLFromStringBypass(unwrapSafeValue(unsafeHtml)); } return _sanitizeHtml(getDocument(), renderStringify(unsafeHtml)); } function \u0275\u0275sanitizeStyle(unsafeStyle) { const sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.STYLE, unsafeStyle) || ""; } if (allowSanitizationBypassAndThrow( unsafeStyle, "Style" /* BypassType.Style */ )) { return unwrapSafeValue(unsafeStyle); } return renderStringify(unsafeStyle); } function \u0275\u0275sanitizeUrl(unsafeUrl) { const sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.URL, unsafeUrl) || ""; } if (allowSanitizationBypassAndThrow( unsafeUrl, "URL" /* BypassType.Url */ )) { return unwrapSafeValue(unsafeUrl); } return _sanitizeUrl(renderStringify(unsafeUrl)); } function \u0275\u0275sanitizeResourceUrl(unsafeResourceUrl) { const sanitizer = getSanitizer(); if (sanitizer) { return trustedScriptURLFromStringBypass(sanitizer.sanitize(SecurityContext.RESOURCE_URL, unsafeResourceUrl) || ""); } if (allowSanitizationBypassAndThrow( unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */ )) { return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl)); } throw new RuntimeError(904, ngDevMode && `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`); } function \u0275\u0275sanitizeScript(unsafeScript) { const sanitizer = getSanitizer(); if (sanitizer) { return trustedScriptFromStringBypass(sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || ""); } if (allowSanitizationBypassAndThrow( unsafeScript, "Script" /* BypassType.Script */ )) { return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript)); } throw new RuntimeError(905, ngDevMode && "unsafe value used in a script context"); } function \u0275\u0275trustConstantHtml(html) { if (ngDevMode && (!Array.isArray(html) || !Array.isArray(html.raw) || html.length !== 1)) { throw new Error(`Unexpected interpolation in trusted HTML constant: ${html.join("?")}`); } return trustedHTMLFromString(html[0]); } function \u0275\u0275trustConstantResourceUrl(url) { if (ngDevMode && (!Array.isArray(url) || !Array.isArray(url.raw) || url.length !== 1)) { throw new Error(`Unexpected interpolation in trusted URL constant: ${url.join("?")}`); } return trustedScriptURLFromString(url[0]); } function getUrlSanitizer(tag, prop) { if (prop === "src" && (tag === "embed" || tag === "frame" || tag === "iframe" || tag === "media" || tag === "script") || prop === "href" && (tag === "base" || tag === "link")) { return \u0275\u0275sanitizeResourceUrl; } return \u0275\u0275sanitizeUrl; } function \u0275\u0275sanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) { return getUrlSanitizer(tag, prop)(unsafeUrl); } function validateAgainstEventProperties(name) { if (name.toLowerCase().startsWith("on")) { const errorMessage = `Binding to event property '${name}' is disallowed for security reasons, please use (${name.slice(2)})=... If '${name}' is a directive input, make sure the directive is imported by the current module.`; throw new RuntimeError(306, errorMessage); } } function validateAgainstEventAttributes(name) { if (name.toLowerCase().startsWith("on")) { const errorMessage = `Binding to event attribute '${name}' is disallowed for security reasons, please use (${name.slice(2)})=...`; throw new RuntimeError(306, errorMessage); } } function getSanitizer() { const lView = getLView(); return lView && lView[ENVIRONMENT].sanitizer; } var COMMENT_DISALLOWED = /^>|^->||--!>|)/g; var COMMENT_DELIMITER_ESCAPED = "\u200B$1\u200B"; function escapeCommentText(value) { return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED)); } function normalizeDebugBindingName(name) { name = camelCaseToDashCase(name.replace(/[$@]/g, "_")); return `ng-reflect-${name}`; } var CAMEL_CASE_REGEXP = /([A-Z])/g; function camelCaseToDashCase(input2) { return input2.replace(CAMEL_CASE_REGEXP, (...m) => "-" + m[1].toLowerCase()); } function normalizeDebugBindingValue(value) { try { return value != null ? value.toString().slice(0, 30) : value; } catch (e) { return "[ERROR] Exception while trying to serialize the value"; } } var CUSTOM_ELEMENTS_SCHEMA = { name: "custom-elements" }; var NO_ERRORS_SCHEMA = { name: "no-errors-schema" }; var shouldThrowErrorOnUnknownElement = false; var shouldThrowErrorOnUnknownProperty = false; function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) { if (schemas === null) return; if (!hasDirectives && tagName !== null) { const isUnknown = ( // Note that we can't check for `typeof HTMLUnknownElement === 'function'` because // Domino doesn't expose HTMLUnknownElement globally. typeof HTMLUnknownElement !== "undefined" && HTMLUnknownElement && element instanceof HTMLUnknownElement || typeof customElements !== "undefined" && tagName.indexOf("-") > -1 && !customElements.get(tagName) ); if (isUnknown && !matchingSchemas(schemas, tagName)) { const isHostStandalone = isHostComponentStandalone(lView); const templateLocation = getTemplateLocationDetails(lView); const schemas2 = `'${isHostStandalone ? "@Component" : "@NgModule"}.schemas'`; let message = `'${tagName}' is not a known element${templateLocation}: `; message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? "included in the '@Component.imports' of this component" : "a part of an @NgModule where this component is declared"}. `; if (tagName && tagName.indexOf("-") > -1) { message += `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.`; } else { message += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`; } if (shouldThrowErrorOnUnknownElement) { throw new RuntimeError(304, message); } else { console.error(formatRuntimeError(304, message)); } } } } function isPropertyValid(element, propName, tagName, schemas) { if (schemas === null) return true; if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) { return true; } return typeof Node === "undefined" || Node === null || !(element instanceof Node); } function handleUnknownPropertyError(propName, tagName, nodeType, lView) { if (!tagName && nodeType === 4) { tagName = "ng-template"; } const isHostStandalone = isHostComponentStandalone(lView); const templateLocation = getTemplateLocationDetails(lView); let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`; const schemas = `'${isHostStandalone ? "@Component" : "@NgModule"}.schemas'`; const importLocation = isHostStandalone ? "included in the '@Component.imports' of this component" : "a part of an @NgModule where this component is declared"; if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) { const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName); message += ` If the '${propName}' is an Angular control flow directive, please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`; } else { message += ` 1. If '${tagName}' is an Angular component and it has the '${propName}' input, then verify that it is ${importLocation}.`; if (tagName && tagName.indexOf("-") > -1) { message += ` 2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`; message += ` 3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`; } else { message += ` 2. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`; } } reportUnknownPropertyError(message); } function reportUnknownPropertyError(message) { if (shouldThrowErrorOnUnknownProperty) { throw new RuntimeError(303, message); } else { console.error(formatRuntimeError(303, message)); } } function getDeclarationComponentDef(lView) { !ngDevMode && throwError("Must never be called in production mode"); const declarationLView = lView[DECLARATION_COMPONENT_VIEW]; const context2 = declarationLView[CONTEXT]; if (!context2) return null; return context2.constructor ? getComponentDef(context2.constructor) : null; } function isHostComponentStandalone(lView) { !ngDevMode && throwError("Must never be called in production mode"); const componentDef = getDeclarationComponentDef(lView); return !!componentDef?.standalone; } function getTemplateLocationDetails(lView) { !ngDevMode && throwError("Must never be called in production mode"); const hostComponentDef = getDeclarationComponentDef(lView); const componentClassName = hostComponentDef?.type?.name; return componentClassName ? ` (used in the '${componentClassName}' component template)` : ""; } var KNOWN_CONTROL_FLOW_DIRECTIVES = /* @__PURE__ */ new Map([["ngIf", "NgIf"], ["ngFor", "NgFor"], ["ngSwitchCase", "NgSwitchCase"], ["ngSwitchDefault", "NgSwitchDefault"]]); function matchingSchemas(schemas, tagName) { if (schemas !== null) { for (let i = 0; i < schemas.length; i++) { const schema = schemas[i]; if (schema === NO_ERRORS_SCHEMA || schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf("-") > -1) { return true; } } } return false; } function \u0275\u0275resolveWindow(element) { return element.ownerDocument.defaultView; } function \u0275\u0275resolveDocument(element) { return element.ownerDocument; } function \u0275\u0275resolveBody(element) { return element.ownerDocument.body; } var INTERPOLATION_DELIMITER = `\uFFFD`; function maybeUnwrapFn(value) { if (value instanceof Function) { return value(); } else { return value; } } function isPlatformBrowser(injector) { return (injector ?? inject(Injector)).get(PLATFORM_ID) === "browser"; } var VALUE_STRING_LENGTH_LIMIT = 200; function throwMultipleComponentError(tNode, first2, second) { throw new RuntimeError(-300, `Multiple components match node with tagname ${tNode.value}: ${stringifyForError(first2)} and ${stringifyForError(second)}`); } function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName, lView) { const hostComponentDef = getDeclarationComponentDef(lView); const componentClassName = hostComponentDef?.type?.name; const field = propName ? ` for '${propName}'` : ""; let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value${field}: '${formatValue(oldValue)}'. Current value: '${formatValue(currValue)}'.${componentClassName ? ` Expression location: ${componentClassName} component` : ""}`; if (creationMode) { msg += ` It seems like the view has been created after its parent and its children have been dirty checked. Has it been created in a change detection hook?`; } throw new RuntimeError(-100, msg); } function formatValue(value) { let strValue = String(value); try { if (Array.isArray(value) || strValue === "[object Object]") { strValue = JSON.stringify(value); } } catch (error) { } return strValue.length > VALUE_STRING_LENGTH_LIMIT ? strValue.substring(0, VALUE_STRING_LENGTH_LIMIT) + "\u2026" : strValue; } function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) { const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER); let oldValue = prefix, newValue = prefix; for (let i = 0; i < chunks.length; i++) { const slotIdx = rootIndex + i; oldValue += `${lView[slotIdx]}${chunks[i]}`; newValue += `${slotIdx === expressionIndex ? changedValue : lView[slotIdx]}${chunks[i]}`; } return { propName, oldValue, newValue }; } function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValue) { const tData = lView[TVIEW].data; const metadata = tData[bindingIndex]; if (typeof metadata === "string") { if (metadata.indexOf(INTERPOLATION_DELIMITER) > -1) { return constructDetailsForInterpolation(lView, bindingIndex, bindingIndex, metadata, newValue); } return { propName: metadata, oldValue, newValue }; } if (metadata === null) { let idx = bindingIndex - 1; while (typeof tData[idx] !== "string" && tData[idx + 1] === null) { idx--; } const meta = tData[idx]; if (typeof meta === "string") { const matches = meta.match(new RegExp(INTERPOLATION_DELIMITER, "g")); if (matches && matches.length - 1 > bindingIndex - idx) { return constructDetailsForInterpolation(lView, idx, bindingIndex, meta, newValue); } } } return { propName: void 0, oldValue, newValue }; } var RendererStyleFlags2; (function(RendererStyleFlags22) { RendererStyleFlags22[RendererStyleFlags22["Important"] = 1] = "Important"; RendererStyleFlags22[RendererStyleFlags22["DashCase"] = 2] = "DashCase"; })(RendererStyleFlags2 || (RendererStyleFlags2 = {})); var _icuContainerIterate; function icuContainerIterate(tIcuContainerNode, lView) { return _icuContainerIterate(tIcuContainerNode, lView); } function ensureIcuContainerVisitorLoaded(loader2) { if (_icuContainerIterate === void 0) { _icuContainerIterate = loader2(); } } function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, beforeNode) { if (lNodeToHandle != null) { let lContainer; let isComponent2 = false; if (isLContainer(lNodeToHandle)) { lContainer = lNodeToHandle; } else if (isLView(lNodeToHandle)) { isComponent2 = true; ngDevMode && assertDefined(lNodeToHandle[HOST], "HOST must be defined for a component LView"); lNodeToHandle = lNodeToHandle[HOST]; } const rNode = unwrapRNode(lNodeToHandle); if (action === 0 && parent !== null) { if (beforeNode == null) { nativeAppendChild(renderer, parent, rNode); } else { nativeInsertBefore(renderer, parent, rNode, beforeNode || null, true); } } else if (action === 1 && parent !== null) { nativeInsertBefore(renderer, parent, rNode, beforeNode || null, true); } else if (action === 2) { nativeRemoveNode(renderer, rNode, isComponent2); } else if (action === 3) { ngDevMode && ngDevMode.rendererDestroyNode++; renderer.destroyNode(rNode); } if (lContainer != null) { applyContainer(renderer, action, lContainer, parent, beforeNode); } } } function createTextNode(renderer, value) { ngDevMode && ngDevMode.rendererCreateTextNode++; ngDevMode && ngDevMode.rendererSetText++; return renderer.createText(value); } function updateTextNode(renderer, rNode, value) { ngDevMode && ngDevMode.rendererSetText++; renderer.setValue(rNode, value); } function createCommentNode(renderer, value) { ngDevMode && ngDevMode.rendererCreateComment++; return renderer.createComment(escapeCommentText(value)); } function createElementNode(renderer, name, namespace) { ngDevMode && ngDevMode.rendererCreateElement++; return renderer.createElement(name, namespace); } function removeViewFromDOM(tView, lView) { detachViewFromDOM(tView, lView); lView[HOST] = null; lView[T_HOST] = null; } function addViewToDOM(tView, parentTNode, renderer, lView, parentNativeNode, beforeNode) { lView[HOST] = parentNativeNode; lView[T_HOST] = parentTNode; applyView(tView, lView, renderer, 1, parentNativeNode, beforeNode); } function detachViewFromDOM(tView, lView) { lView[ENVIRONMENT].changeDetectionScheduler?.notify( 9 /* NotificationSource.ViewDetachedFromDOM */ ); applyView(tView, lView, lView[RENDERER], 2, null, null); } function destroyViewTree(rootView) { let lViewOrLContainer = rootView[CHILD_HEAD]; if (!lViewOrLContainer) { return cleanUpView(rootView[TVIEW], rootView); } while (lViewOrLContainer) { let next = null; if (isLView(lViewOrLContainer)) { next = lViewOrLContainer[CHILD_HEAD]; } else { ngDevMode && assertLContainer(lViewOrLContainer); const firstView = lViewOrLContainer[CONTAINER_HEADER_OFFSET]; if (firstView) next = firstView; } if (!next) { while (lViewOrLContainer && !lViewOrLContainer[NEXT] && lViewOrLContainer !== rootView) { if (isLView(lViewOrLContainer)) { cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer); } lViewOrLContainer = lViewOrLContainer[PARENT]; } if (lViewOrLContainer === null) lViewOrLContainer = rootView; if (isLView(lViewOrLContainer)) { cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer); } next = lViewOrLContainer && lViewOrLContainer[NEXT]; } lViewOrLContainer = next; } } function insertView(tView, lView, lContainer, index) { ngDevMode && assertLView(lView); ngDevMode && assertLContainer(lContainer); const indexInContainer = CONTAINER_HEADER_OFFSET + index; const containerLength = lContainer.length; if (index > 0) { lContainer[indexInContainer - 1][NEXT] = lView; } if (index < containerLength - CONTAINER_HEADER_OFFSET) { lView[NEXT] = lContainer[indexInContainer]; addToArray(lContainer, CONTAINER_HEADER_OFFSET + index, lView); } else { lContainer.push(lView); lView[NEXT] = null; } lView[PARENT] = lContainer; const declarationLContainer = lView[DECLARATION_LCONTAINER]; if (declarationLContainer !== null && lContainer !== declarationLContainer) { trackMovedView(declarationLContainer, lView); } const lQueries = lView[QUERIES]; if (lQueries !== null) { lQueries.insertView(tView); } updateAncestorTraversalFlagsOnAttach(lView); lView[FLAGS] |= 128; } function trackMovedView(declarationContainer, lView) { ngDevMode && assertDefined(lView, "LView required"); ngDevMode && assertLContainer(declarationContainer); const movedViews = declarationContainer[MOVED_VIEWS]; const parent = lView[PARENT]; ngDevMode && assertDefined(parent, "missing parent"); if (isLView(parent)) { declarationContainer[FLAGS] |= LContainerFlags.HasTransplantedViews; } else { const insertedComponentLView = parent[PARENT][DECLARATION_COMPONENT_VIEW]; ngDevMode && assertDefined(insertedComponentLView, "Missing insertedComponentLView"); const declaredComponentLView = lView[DECLARATION_COMPONENT_VIEW]; ngDevMode && assertDefined(declaredComponentLView, "Missing declaredComponentLView"); if (declaredComponentLView !== insertedComponentLView) { declarationContainer[FLAGS] |= LContainerFlags.HasTransplantedViews; } } if (movedViews === null) { declarationContainer[MOVED_VIEWS] = [lView]; } else { movedViews.push(lView); } } function detachMovedView(declarationContainer, lView) { ngDevMode && assertLContainer(declarationContainer); ngDevMode && assertDefined(declarationContainer[MOVED_VIEWS], "A projected view should belong to a non-empty projected views collection"); const movedViews = declarationContainer[MOVED_VIEWS]; const declarationViewIndex = movedViews.indexOf(lView); movedViews.splice(declarationViewIndex, 1); } function detachView(lContainer, removeIndex) { if (lContainer.length <= CONTAINER_HEADER_OFFSET) return; const indexInContainer = CONTAINER_HEADER_OFFSET + removeIndex; const viewToDetach = lContainer[indexInContainer]; if (viewToDetach) { const declarationLContainer = viewToDetach[DECLARATION_LCONTAINER]; if (declarationLContainer !== null && declarationLContainer !== lContainer) { detachMovedView(declarationLContainer, viewToDetach); } if (removeIndex > 0) { lContainer[indexInContainer - 1][NEXT] = viewToDetach[NEXT]; } const removedLView = removeFromArray(lContainer, CONTAINER_HEADER_OFFSET + removeIndex); removeViewFromDOM(viewToDetach[TVIEW], viewToDetach); const lQueries = removedLView[QUERIES]; if (lQueries !== null) { lQueries.detachView(removedLView[TVIEW]); } viewToDetach[PARENT] = null; viewToDetach[NEXT] = null; viewToDetach[FLAGS] &= ~128; } return viewToDetach; } function destroyLView(tView, lView) { if (!(lView[FLAGS] & 256)) { const renderer = lView[RENDERER]; if (renderer.destroyNode) { applyView(tView, lView, renderer, 3, null, null); } destroyViewTree(lView); } } function cleanUpView(tView, lView) { if (lView[FLAGS] & 256) { return; } const prevConsumer = setActiveConsumer(null); try { lView[FLAGS] &= ~128; lView[FLAGS] |= 256; lView[REACTIVE_TEMPLATE_CONSUMER] && consumerDestroy(lView[REACTIVE_TEMPLATE_CONSUMER]); executeOnDestroys(tView, lView); processCleanups(tView, lView); if (lView[TVIEW].type === 1) { ngDevMode && ngDevMode.rendererDestroy++; lView[RENDERER].destroy(); } const declarationContainer = lView[DECLARATION_LCONTAINER]; if (declarationContainer !== null && isLContainer(lView[PARENT])) { if (declarationContainer !== lView[PARENT]) { detachMovedView(declarationContainer, lView); } const lQueries = lView[QUERIES]; if (lQueries !== null) { lQueries.detachView(tView); } } unregisterLView(lView); } finally { setActiveConsumer(prevConsumer); } } function processCleanups(tView, lView) { ngDevMode && assertNotReactive(processCleanups.name); const tCleanup = tView.cleanup; const lCleanup = lView[CLEANUP]; if (tCleanup !== null) { for (let i = 0; i < tCleanup.length - 1; i += 2) { if (typeof tCleanup[i] === "string") { const targetIdx = tCleanup[i + 3]; ngDevMode && assertNumber(targetIdx, "cleanup target must be a number"); if (targetIdx >= 0) { lCleanup[targetIdx](); } else { lCleanup[-targetIdx].unsubscribe(); } i += 2; } else { const context2 = lCleanup[tCleanup[i + 1]]; tCleanup[i].call(context2); } } } if (lCleanup !== null) { lView[CLEANUP] = null; } const destroyHooks = lView[ON_DESTROY_HOOKS]; if (destroyHooks !== null) { lView[ON_DESTROY_HOOKS] = null; for (let i = 0; i < destroyHooks.length; i++) { const destroyHooksFn = destroyHooks[i]; ngDevMode && assertFunction(destroyHooksFn, "Expecting destroy hook to be a function."); destroyHooksFn(); } } } function executeOnDestroys(tView, lView) { ngDevMode && assertNotReactive(executeOnDestroys.name); let destroyHooks; if (tView != null && (destroyHooks = tView.destroyHooks) != null) { for (let i = 0; i < destroyHooks.length; i += 2) { const context2 = lView[destroyHooks[i]]; if (!(context2 instanceof NodeInjectorFactory)) { const toCall = destroyHooks[i + 1]; if (Array.isArray(toCall)) { for (let j = 0; j < toCall.length; j += 2) { const callContext = context2[toCall[j]]; const hook = toCall[j + 1]; profiler(4, callContext, hook); try { hook.call(callContext); } finally { profiler(5, callContext, hook); } } } else { profiler(4, context2, toCall); try { toCall.call(context2); } finally { profiler(5, context2, toCall); } } } } } } function getParentRElement(tView, tNode, lView) { return getClosestRElement(tView, tNode.parent, lView); } function getClosestRElement(tView, tNode, lView) { let parentTNode = tNode; while (parentTNode !== null && parentTNode.type & (8 | 32 | 128)) { tNode = parentTNode; parentTNode = tNode.parent; } if (parentTNode === null) { return lView[HOST]; } else { ngDevMode && assertTNodeType( parentTNode, 3 | 4 /* TNodeType.Container */ ); const { componentOffset } = parentTNode; if (componentOffset > -1) { ngDevMode && assertTNodeForLView(parentTNode, lView); const { encapsulation } = tView.data[parentTNode.directiveStart + componentOffset]; if (encapsulation === ViewEncapsulation$1.None || encapsulation === ViewEncapsulation$1.Emulated) { return null; } } return getNativeByTNode(parentTNode, lView); } } function nativeInsertBefore(renderer, parent, child, beforeNode, isMove) { ngDevMode && ngDevMode.rendererInsertBefore++; renderer.insertBefore(parent, child, beforeNode, isMove); } function nativeAppendChild(renderer, parent, child) { ngDevMode && ngDevMode.rendererAppendChild++; ngDevMode && assertDefined(parent, "parent node must be defined"); renderer.appendChild(parent, child); } function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove) { if (beforeNode !== null) { nativeInsertBefore(renderer, parent, child, beforeNode, isMove); } else { nativeAppendChild(renderer, parent, child); } } function nativeParentNode(renderer, node) { return renderer.parentNode(node); } function nativeNextSibling(renderer, node) { return renderer.nextSibling(node); } function getInsertInFrontOfRNode(parentTNode, currentTNode, lView) { return _getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView); } function getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView) { if (parentTNode.type & (8 | 32)) { return getNativeByTNode(parentTNode, lView); } return null; } var _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithNoI18n; var _processI18nInsertBefore; function setI18nHandling(getInsertInFrontOfRNodeWithI18n2, processI18nInsertBefore2) { _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithI18n2; _processI18nInsertBefore = processI18nInsertBefore2; } function appendChild(tView, lView, childRNode, childTNode) { const parentRNode = getParentRElement(tView, childTNode, lView); const renderer = lView[RENDERER]; const parentTNode = childTNode.parent || lView[T_HOST]; const anchorNode = getInsertInFrontOfRNode(parentTNode, childTNode, lView); if (parentRNode != null) { if (Array.isArray(childRNode)) { for (let i = 0; i < childRNode.length; i++) { nativeAppendOrInsertBefore(renderer, parentRNode, childRNode[i], anchorNode, false); } } else { nativeAppendOrInsertBefore(renderer, parentRNode, childRNode, anchorNode, false); } } _processI18nInsertBefore !== void 0 && _processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRNode); } function getFirstNativeNode(lView, tNode) { if (tNode !== null) { ngDevMode && assertTNodeType( tNode, 3 | 12 | 32 | 16 | 128 /* TNodeType.LetDeclaration */ ); const tNodeType = tNode.type; if (tNodeType & 3) { return getNativeByTNode(tNode, lView); } else if (tNodeType & 4) { return getBeforeNodeForView(-1, lView[tNode.index]); } else if (tNodeType & 8) { const elIcuContainerChild = tNode.child; if (elIcuContainerChild !== null) { return getFirstNativeNode(lView, elIcuContainerChild); } else { const rNodeOrLContainer = lView[tNode.index]; if (isLContainer(rNodeOrLContainer)) { return getBeforeNodeForView(-1, rNodeOrLContainer); } else { return unwrapRNode(rNodeOrLContainer); } } } else if (tNodeType & 128) { return getFirstNativeNode(lView, tNode.next); } else if (tNodeType & 32) { let nextRNode = icuContainerIterate(tNode, lView); let rNode = nextRNode(); return rNode || unwrapRNode(lView[tNode.index]); } else { const projectionNodes = getProjectionNodes(lView, tNode); if (projectionNodes !== null) { if (Array.isArray(projectionNodes)) { return projectionNodes[0]; } const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]); ngDevMode && assertParentView(parentView); return getFirstNativeNode(parentView, projectionNodes); } else { return getFirstNativeNode(lView, tNode.next); } } } return null; } function getProjectionNodes(lView, tNode) { if (tNode !== null) { const componentView = lView[DECLARATION_COMPONENT_VIEW]; const componentHost = componentView[T_HOST]; const slotIdx = tNode.projection; ngDevMode && assertProjectionSlots(lView); return componentHost.projection[slotIdx]; } return null; } function getBeforeNodeForView(viewIndexInContainer, lContainer) { const nextViewIndex = CONTAINER_HEADER_OFFSET + viewIndexInContainer + 1; if (nextViewIndex < lContainer.length) { const lView = lContainer[nextViewIndex]; const firstTNodeOfView = lView[TVIEW].firstChild; if (firstTNodeOfView !== null) { return getFirstNativeNode(lView, firstTNodeOfView); } } return lContainer[NATIVE]; } function nativeRemoveNode(renderer, rNode, isHostElement) { ngDevMode && ngDevMode.rendererRemoveNode++; renderer.removeChild(null, rNode, isHostElement); } function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode, isProjection) { while (tNode != null) { ngDevMode && assertTNodeForLView(tNode, lView); if (tNode.type === 128) { tNode = tNode.next; continue; } ngDevMode && assertTNodeType( tNode, 3 | 12 | 16 | 32 /* TNodeType.Icu */ ); const rawSlotValue = lView[tNode.index]; const tNodeType = tNode.type; if (isProjection) { if (action === 0) { rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView); tNode.flags |= 2; } } if ((tNode.flags & 32) !== 32) { if (tNodeType & 8) { applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false); applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode); } else if (tNodeType & 32) { const nextRNode = icuContainerIterate(tNode, lView); let rNode; while (rNode = nextRNode()) { applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode); } applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode); } else if (tNodeType & 16) { applyProjectionRecursive(renderer, action, lView, tNode, parentRElement, beforeNode); } else { ngDevMode && assertTNodeType( tNode, 3 | 4 /* TNodeType.Container */ ); applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode); } } tNode = isProjection ? tNode.projectionNext : tNode.next; } } function applyView(tView, lView, renderer, action, parentRElement, beforeNode) { applyNodes(renderer, action, tView.firstChild, lView, parentRElement, beforeNode, false); } function applyProjection(tView, lView, tProjectionNode) { const renderer = lView[RENDERER]; const parentRNode = getParentRElement(tView, tProjectionNode, lView); const parentTNode = tProjectionNode.parent || lView[T_HOST]; let beforeNode = getInsertInFrontOfRNode(parentTNode, tProjectionNode, lView); applyProjectionRecursive(renderer, 0, lView, tProjectionNode, parentRNode, beforeNode); } function applyProjectionRecursive(renderer, action, lView, tProjectionNode, parentRElement, beforeNode) { const componentLView = lView[DECLARATION_COMPONENT_VIEW]; const componentNode = componentLView[T_HOST]; ngDevMode && assertEqual(typeof tProjectionNode.projection, "number", "expecting projection index"); const nodeToProjectOrRNodes = componentNode.projection[tProjectionNode.projection]; if (Array.isArray(nodeToProjectOrRNodes)) { for (let i = 0; i < nodeToProjectOrRNodes.length; i++) { const rNode = nodeToProjectOrRNodes[i]; applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode); } } else { let nodeToProject = nodeToProjectOrRNodes; const projectedComponentLView = componentLView[PARENT]; if (hasInSkipHydrationBlockFlag(tProjectionNode)) { nodeToProject.flags |= 128; } applyNodes(renderer, action, nodeToProject, projectedComponentLView, parentRElement, beforeNode, true); } } function applyContainer(renderer, action, lContainer, parentRElement, beforeNode) { ngDevMode && assertLContainer(lContainer); const anchor = lContainer[NATIVE]; const native = unwrapRNode(lContainer); if (anchor !== native) { applyToElementOrContainer(action, renderer, parentRElement, anchor, beforeNode); } for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) { const lView = lContainer[i]; applyView(lView[TVIEW], lView, renderer, action, parentRElement, anchor); } } function applyStyling(renderer, isClassBased, rNode, prop, value) { if (isClassBased) { if (!value) { ngDevMode && ngDevMode.rendererRemoveClass++; renderer.removeClass(rNode, prop); } else { ngDevMode && ngDevMode.rendererAddClass++; renderer.addClass(rNode, prop); } } else { let flags = prop.indexOf("-") === -1 ? void 0 : RendererStyleFlags2.DashCase; if (value == null) { ngDevMode && ngDevMode.rendererRemoveStyle++; renderer.removeStyle(rNode, prop, flags); } else { const isImportant = typeof value === "string" ? value.endsWith("!important") : false; if (isImportant) { value = value.slice(0, -10); flags |= RendererStyleFlags2.Important; } ngDevMode && ngDevMode.rendererSetStyle++; renderer.setStyle(rNode, prop, value, flags); } } } function writeDirectStyle(renderer, element, newValue) { ngDevMode && assertString(newValue, "'newValue' should be a string"); renderer.setAttribute(element, "style", newValue); ngDevMode && ngDevMode.rendererSetStyle++; } function writeDirectClass(renderer, element, newValue) { ngDevMode && assertString(newValue, "'newValue' should be a string"); if (newValue === "") { renderer.removeAttribute(element, "class"); } else { renderer.setAttribute(element, "class", newValue); } ngDevMode && ngDevMode.rendererSetClassName++; } function setupStaticAttributes(renderer, element, tNode) { const { mergedAttrs, classes, styles } = tNode; if (mergedAttrs !== null) { setUpAttributes(renderer, element, mergedAttrs); } if (classes !== null) { writeDirectClass(renderer, element, classes); } if (styles !== null) { writeDirectStyle(renderer, element, styles); } } var NO_CHANGE = typeof ngDevMode === "undefined" || ngDevMode ? { __brand__: "NO_CHANGE" } : {}; function \u0275\u0275advance(delta = 1) { ngDevMode && assertGreaterThan(delta, 0, "Can only advance forward"); selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, !!ngDevMode && isInCheckNoChangesMode()); } function selectIndexInternal(tView, lView, index, checkNoChangesMode) { ngDevMode && assertIndexInDeclRange(lView[TVIEW], index); if (!checkNoChangesMode) { const hooksInitPhaseCompleted = (lView[FLAGS] & 3) === 3; if (hooksInitPhaseCompleted) { const preOrderCheckHooks = tView.preOrderCheckHooks; if (preOrderCheckHooks !== null) { executeCheckHooks(lView, preOrderCheckHooks, index); } } else { const preOrderHooks = tView.preOrderHooks; if (preOrderHooks !== null) { executeInitAndCheckHooks(lView, preOrderHooks, 0, index); } } } setSelectedIndex(index); } function \u0275\u0275directiveInject(token, flags = InjectFlags.Default) { const lView = getLView(); if (lView === null) { ngDevMode && assertInjectImplementationNotEqual(\u0275\u0275directiveInject); return \u0275\u0275inject(token, flags); } const tNode = getCurrentTNode(); const value = getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags); ngDevMode && emitInjectEvent(token, value, flags); return value; } function \u0275\u0275invalidFactory() { const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : "invalid"; throw new Error(msg); } function writeToDirectiveInput(def, instance, publicName, privateName, flags, value) { const prevConsumer = setActiveConsumer(null); try { let inputSignalNode = null; if ((flags & InputFlags.SignalBased) !== 0) { const field = instance[privateName]; inputSignalNode = field[SIGNAL]; } if (inputSignalNode !== null && inputSignalNode.transformFn !== void 0) { value = inputSignalNode.transformFn(value); } if ((flags & InputFlags.HasDecoratorInputTransform) !== 0) { value = def.inputTransforms[privateName].call(instance, value); } if (def.setInput !== null) { def.setInput(instance, inputSignalNode, value, publicName, privateName); } else { applyValueToInputField(instance, inputSignalNode, privateName, value); } } finally { setActiveConsumer(prevConsumer); } } function processHostBindingOpCodes(tView, lView) { const hostBindingOpCodes = tView.hostBindingOpCodes; if (hostBindingOpCodes === null) return; try { for (let i = 0; i < hostBindingOpCodes.length; i++) { const opCode = hostBindingOpCodes[i]; if (opCode < 0) { setSelectedIndex(~opCode); } else { const directiveIdx = opCode; const bindingRootIndx = hostBindingOpCodes[++i]; const hostBindingFn = hostBindingOpCodes[++i]; setBindingRootForHostBindings(bindingRootIndx, directiveIdx); const context2 = lView[directiveIdx]; hostBindingFn(2, context2); } } } finally { setSelectedIndex(-1); } } function createLView(parentLView, tView, context2, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) { const lView = tView.blueprint.slice(); lView[HOST] = host; lView[FLAGS] = flags | 4 | 128 | 8 | 64; if (embeddedViewInjector !== null || parentLView && parentLView[FLAGS] & 2048) { lView[FLAGS] |= 2048; } resetPreOrderHookFlags(lView); ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView); lView[PARENT] = lView[DECLARATION_VIEW] = parentLView; lView[CONTEXT] = context2; lView[ENVIRONMENT] = environment || parentLView && parentLView[ENVIRONMENT]; ngDevMode && assertDefined(lView[ENVIRONMENT], "LViewEnvironment is required"); lView[RENDERER] = renderer || parentLView && parentLView[RENDERER]; ngDevMode && assertDefined(lView[RENDERER], "Renderer is required"); lView[INJECTOR] = injector || parentLView && parentLView[INJECTOR] || null; lView[T_HOST] = tHostNode; lView[ID] = getUniqueLViewId(); lView[HYDRATION] = hydrationInfo; lView[EMBEDDED_VIEW_INJECTOR] = embeddedViewInjector; ngDevMode && assertEqual(tView.type == 2 ? parentLView !== null : true, true, "Embedded views must have parentLView"); lView[DECLARATION_COMPONENT_VIEW] = tView.type == 2 ? parentLView[DECLARATION_COMPONENT_VIEW] : lView; return lView; } function getOrCreateTNode(tView, index, type, name, attrs) { ngDevMode && index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in // `view_engine_compatibility` for additional context. assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header."); ngDevMode && assertPureTNodeType(type); let tNode = tView.data[index]; if (tNode === null) { tNode = createTNodeAtIndex(tView, index, type, name, attrs); if (isInI18nBlock()) { tNode.flags |= 32; } } else if (tNode.type & 64) { tNode.type = type; tNode.value = name; tNode.attrs = attrs; const parent = getCurrentParentTNode(); tNode.injectorIndex = parent === null ? -1 : parent.injectorIndex; ngDevMode && assertTNodeForTView(tNode, tView); ngDevMode && assertEqual(index, tNode.index, "Expecting same index"); } setCurrentTNode(tNode, true); return tNode; } function createTNodeAtIndex(tView, index, type, name, attrs) { const currentTNode = getCurrentTNodePlaceholderOk(); const isParent = isCurrentTNodeParent(); const parent = isParent ? currentTNode : currentTNode && currentTNode.parent; const tNode = tView.data[index] = createTNode(tView, parent, type, index, name, attrs); if (tView.firstChild === null) { tView.firstChild = tNode; } if (currentTNode !== null) { if (isParent) { if (currentTNode.child == null && tNode.parent !== null) { currentTNode.child = tNode; } } else { if (currentTNode.next === null) { currentTNode.next = tNode; tNode.prev = currentTNode; } } } return tNode; } function allocExpando(tView, lView, numSlotsToAlloc, initialValue) { if (numSlotsToAlloc === 0) return -1; if (ngDevMode) { assertFirstCreatePass(tView); assertSame(tView, lView[TVIEW], "`LView` must be associated with `TView`!"); assertEqual(tView.data.length, lView.length, "Expecting LView to be same size as TView"); assertEqual(tView.data.length, tView.blueprint.length, "Expecting Blueprint to be same size as TView"); assertFirstUpdatePass(tView); } const allocIdx = lView.length; for (let i = 0; i < numSlotsToAlloc; i++) { lView.push(initialValue); tView.blueprint.push(initialValue); tView.data.push(null); } return allocIdx; } function executeTemplate(tView, lView, templateFn, rf, context2) { const prevSelectedIndex = getSelectedIndex(); const isUpdatePhase = rf & 2; try { setSelectedIndex(-1); if (isUpdatePhase && lView.length > HEADER_OFFSET) { selectIndexInternal(tView, lView, HEADER_OFFSET, !!ngDevMode && isInCheckNoChangesMode()); } const preHookType = isUpdatePhase ? 2 : 0; profiler(preHookType, context2); templateFn(rf, context2); } finally { setSelectedIndex(prevSelectedIndex); const postHookType = isUpdatePhase ? 3 : 1; profiler(postHookType, context2); } } function executeContentQueries(tView, tNode, lView) { if (isContentQueryHost(tNode)) { const prevConsumer = setActiveConsumer(null); try { const start = tNode.directiveStart; const end = tNode.directiveEnd; for (let directiveIndex = start; directiveIndex < end; directiveIndex++) { const def = tView.data[directiveIndex]; if (def.contentQueries) { const directiveInstance = lView[directiveIndex]; ngDevMode && assertDefined(directiveIndex, "Incorrect reference to a directive defining a content query"); def.contentQueries(1, directiveInstance, directiveIndex); } } } finally { setActiveConsumer(prevConsumer); } } } function createDirectivesInstances(tView, lView, tNode) { if (!getBindingsEnabled()) return; instantiateAllDirectives(tView, lView, tNode, getNativeByTNode(tNode, lView)); if ((tNode.flags & 64) === 64) { invokeDirectivesHostBindings(tView, lView, tNode); } } function saveResolvedLocalsInData(viewData, tNode, localRefExtractor = getNativeByTNode) { const localNames = tNode.localNames; if (localNames !== null) { let localIndex = tNode.index + 1; for (let i = 0; i < localNames.length; i += 2) { const index = localNames[i + 1]; const value = index === -1 ? localRefExtractor(tNode, viewData) : viewData[index]; viewData[localIndex++] = value; } } } function getOrCreateComponentTView(def) { const tView = def.tView; if (tView === null || tView.incompleteFirstPass) { const declTNode = null; return def.tView = createTView(1, declTNode, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts, def.id); } return tView; } function createTView(type, declTNode, templateFn, decls, vars, directives, pipes, viewQuery, schemas, constsOrFactory, ssrId) { ngDevMode && ngDevMode.tView++; const bindingStartIndex = HEADER_OFFSET + decls; const initialViewLength = bindingStartIndex + vars; const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength); const consts = typeof constsOrFactory === "function" ? constsOrFactory() : constsOrFactory; const tView = blueprint[TVIEW] = { type, blueprint, template: templateFn, queries: null, viewQuery, declTNode, data: blueprint.slice().fill(null, bindingStartIndex), bindingStartIndex, expandoStartIndex: initialViewLength, hostBindingOpCodes: null, firstCreatePass: true, firstUpdatePass: true, staticViewQueries: false, staticContentQueries: false, preOrderHooks: null, preOrderCheckHooks: null, contentHooks: null, contentCheckHooks: null, viewHooks: null, viewCheckHooks: null, destroyHooks: null, cleanup: null, contentQueries: null, components: null, directiveRegistry: typeof directives === "function" ? directives() : directives, pipeRegistry: typeof pipes === "function" ? pipes() : pipes, firstChild: null, schemas, consts, incompleteFirstPass: false, ssrId }; if (ngDevMode) { Object.seal(tView); } return tView; } function createViewBlueprint(bindingStartIndex, initialViewLength) { const blueprint = []; for (let i = 0; i < initialViewLength; i++) { blueprint.push(i < bindingStartIndex ? null : NO_CHANGE); } return blueprint; } function locateHostElement(renderer, elementOrSelector, encapsulation, injector) { const preserveHostContent = injector.get(PRESERVE_HOST_CONTENT, PRESERVE_HOST_CONTENT_DEFAULT); const preserveContent = preserveHostContent || encapsulation === ViewEncapsulation$1.ShadowDom; const rootElement = renderer.selectRootElement(elementOrSelector, preserveContent); applyRootElementTransform(rootElement); return rootElement; } function applyRootElementTransform(rootElement) { _applyRootElementTransformImpl(rootElement); } var _applyRootElementTransformImpl = () => null; function storeCleanupWithContext(tView, lView, context2, cleanupFn) { const lCleanup = getOrCreateLViewCleanup(lView); ngDevMode && assertDefined(context2, "Cleanup context is mandatory when registering framework-level destroy hooks"); lCleanup.push(context2); if (tView.firstCreatePass) { getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1); } else { if (ngDevMode) { Object.freeze(getOrCreateTViewCleanup(tView)); } } } function createTNode(tView, tParent, type, index, value, attrs) { ngDevMode && index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in // `view_engine_compatibility` for additional context. assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header."); ngDevMode && assertNotSame(attrs, void 0, "'undefined' is not valid value for 'attrs'"); ngDevMode && ngDevMode.tNode++; ngDevMode && tParent && assertTNodeForTView(tParent, tView); let injectorIndex = tParent ? tParent.injectorIndex : -1; let flags = 0; if (isInSkipHydrationBlock$1()) { flags |= 128; } const tNode = { type, index, insertBeforeIndex: null, injectorIndex, directiveStart: -1, directiveEnd: -1, directiveStylingLast: -1, componentOffset: -1, propertyBindings: null, flags, providerIndexes: 0, value, attrs, mergedAttrs: null, localNames: null, initialInputs: void 0, inputs: null, outputs: null, tView: null, next: null, prev: null, projectionNext: null, child: null, parent: tParent, projection: null, styles: null, stylesWithoutHost: null, residualStyles: void 0, classes: null, classesWithoutHost: null, residualClasses: void 0, classBindings: 0, styleBindings: 0 }; if (ngDevMode) { Object.seal(tNode); } return tNode; } function captureNodeBindings(mode, aliasMap, directiveIndex, bindingsResult, hostDirectiveAliasMap) { for (let publicName in aliasMap) { if (!aliasMap.hasOwnProperty(publicName)) { continue; } const value = aliasMap[publicName]; if (value === void 0) { continue; } bindingsResult ??= {}; let internalName; let inputFlags = InputFlags.None; if (Array.isArray(value)) { internalName = value[0]; inputFlags = value[1]; } else { internalName = value; } let finalPublicName = publicName; if (hostDirectiveAliasMap !== null) { if (!hostDirectiveAliasMap.hasOwnProperty(publicName)) { continue; } finalPublicName = hostDirectiveAliasMap[publicName]; } if (mode === 0) { addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName, inputFlags); } else { addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName); } } return bindingsResult; } function addPropertyBinding(bindings, directiveIndex, publicName, internalName, inputFlags) { let values; if (bindings.hasOwnProperty(publicName)) { (values = bindings[publicName]).push(directiveIndex, internalName); } else { values = bindings[publicName] = [directiveIndex, internalName]; } if (inputFlags !== void 0) { values.push(inputFlags); } } function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefinitionMap) { ngDevMode && assertFirstCreatePass(tView); const start = tNode.directiveStart; const end = tNode.directiveEnd; const tViewData = tView.data; const tNodeAttrs = tNode.attrs; const inputsFromAttrs = []; let inputsStore = null; let outputsStore = null; for (let directiveIndex = start; directiveIndex < end; directiveIndex++) { const directiveDef = tViewData[directiveIndex]; const aliasData = hostDirectiveDefinitionMap ? hostDirectiveDefinitionMap.get(directiveDef) : null; const aliasedInputs = aliasData ? aliasData.inputs : null; const aliasedOutputs = aliasData ? aliasData.outputs : null; inputsStore = captureNodeBindings(0, directiveDef.inputs, directiveIndex, inputsStore, aliasedInputs); outputsStore = captureNodeBindings(1, directiveDef.outputs, directiveIndex, outputsStore, aliasedOutputs); const initialInputs = inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode) ? generateInitialInputs(inputsStore, directiveIndex, tNodeAttrs) : null; inputsFromAttrs.push(initialInputs); } if (inputsStore !== null) { if (inputsStore.hasOwnProperty("class")) { tNode.flags |= 8; } if (inputsStore.hasOwnProperty("style")) { tNode.flags |= 16; } } tNode.initialInputs = inputsFromAttrs; tNode.inputs = inputsStore; tNode.outputs = outputsStore; } function mapPropName(name) { if (name === "class") return "className"; if (name === "for") return "htmlFor"; if (name === "formaction") return "formAction"; if (name === "innerHtml") return "innerHTML"; if (name === "readonly") return "readOnly"; if (name === "tabindex") return "tabIndex"; return name; } function elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, nativeOnly) { ngDevMode && assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE."); const element = getNativeByTNode(tNode, lView); let inputData = tNode.inputs; let dataValue; if (!nativeOnly && inputData != null && (dataValue = inputData[propName])) { setInputsForProperty(tView, lView, dataValue, propName, value); if (isComponentHost(tNode)) markDirtyIfOnPush(lView, tNode.index); if (ngDevMode) { setNgReflectProperties(lView, element, tNode.type, dataValue, value); } } else if (tNode.type & 3) { propName = mapPropName(propName); if (ngDevMode) { validateAgainstEventProperties(propName); if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) { handleUnknownPropertyError(propName, tNode.value, tNode.type, lView); } ngDevMode.rendererSetProperty++; } value = sanitizer != null ? sanitizer(value, tNode.value || "", propName) : value; renderer.setProperty(element, propName, value); } else if (tNode.type & 12) { if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) { handleUnknownPropertyError(propName, tNode.value, tNode.type, lView); } } } function markDirtyIfOnPush(lView, viewIndex) { ngDevMode && assertLView(lView); const childComponentLView = getComponentLViewByIndex(viewIndex, lView); if (!(childComponentLView[FLAGS] & 16)) { childComponentLView[FLAGS] |= 64; } } function setNgReflectProperty(lView, element, type, attrName, value) { const renderer = lView[RENDERER]; attrName = normalizeDebugBindingName(attrName); const debugValue = normalizeDebugBindingValue(value); if (type & 3) { if (value == null) { renderer.removeAttribute(element, attrName); } else { renderer.setAttribute(element, attrName, debugValue); } } else { const textContent = escapeCommentText(`bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`); renderer.setValue(element, textContent); } } function setNgReflectProperties(lView, element, type, dataValue, value) { if (type & (3 | 4)) { for (let i = 0; i < dataValue.length; i += 3) { setNgReflectProperty(lView, element, type, dataValue[i + 1], value); } } } function resolveDirectives(tView, lView, tNode, localRefs) { ngDevMode && assertFirstCreatePass(tView); if (getBindingsEnabled()) { const exportsMap = localRefs === null ? null : { "": -1 }; const matchResult = findDirectiveDefMatches(tView, tNode); let directiveDefs; let hostDirectiveDefs; if (matchResult === null) { directiveDefs = hostDirectiveDefs = null; } else { [directiveDefs, hostDirectiveDefs] = matchResult; } if (directiveDefs !== null) { initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs); } if (exportsMap) cacheMatchingLocalNames(tNode, localRefs, exportsMap); } tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs); } function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs) { ngDevMode && assertFirstCreatePass(tView); for (let i = 0; i < directives.length; i++) { diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, directives[i].type); } initTNodeFlags(tNode, tView.data.length, directives.length); for (let i = 0; i < directives.length; i++) { const def = directives[i]; if (def.providersResolver) def.providersResolver(def); } let preOrderHooksFound = false; let preOrderCheckHooksFound = false; let directiveIdx = allocExpando(tView, lView, directives.length, null); ngDevMode && assertSame(directiveIdx, tNode.directiveStart, "TNode.directiveStart should point to just allocated space"); for (let i = 0; i < directives.length; i++) { const def = directives[i]; tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs); configureViewWithDirective(tView, tNode, lView, directiveIdx, def); saveNameToExportMap(directiveIdx, def, exportsMap); if (def.contentQueries !== null) tNode.flags |= 4; if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0) tNode.flags |= 64; const lifeCycleHooks = def.type.prototype; if (!preOrderHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) { (tView.preOrderHooks ??= []).push(tNode.index); preOrderHooksFound = true; } if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) { (tView.preOrderCheckHooks ??= []).push(tNode.index); preOrderCheckHooksFound = true; } directiveIdx++; } initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs); } function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) { ngDevMode && assertFirstCreatePass(tView); const hostBindings = def.hostBindings; if (hostBindings) { let hostBindingOpCodes = tView.hostBindingOpCodes; if (hostBindingOpCodes === null) { hostBindingOpCodes = tView.hostBindingOpCodes = []; } const elementIndx = ~tNode.index; if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) { hostBindingOpCodes.push(elementIndx); } hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings); } } function lastSelectedElementIdx(hostBindingOpCodes) { let i = hostBindingOpCodes.length; while (i > 0) { const value = hostBindingOpCodes[--i]; if (typeof value === "number" && value < 0) { return value; } } return 0; } function instantiateAllDirectives(tView, lView, tNode, native) { const start = tNode.directiveStart; const end = tNode.directiveEnd; if (isComponentHost(tNode)) { ngDevMode && assertTNodeType( tNode, 3 /* TNodeType.AnyRNode */ ); addComponentLogic(lView, tNode, tView.data[start + tNode.componentOffset]); } if (!tView.firstCreatePass) { getOrCreateNodeInjectorForNode(tNode, lView); } attachPatchData(native, lView); const initialInputs = tNode.initialInputs; for (let i = start; i < end; i++) { const def = tView.data[i]; const directive = getNodeInjectable(lView, tView, i, tNode); attachPatchData(directive, lView); if (initialInputs !== null) { setInputsFromAttrs(lView, i - start, directive, def, tNode, initialInputs); } if (isComponentDef(def)) { const componentView = getComponentLViewByIndex(tNode.index, lView); componentView[CONTEXT] = getNodeInjectable(lView, tView, i, tNode); } } } function invokeDirectivesHostBindings(tView, lView, tNode) { const start = tNode.directiveStart; const end = tNode.directiveEnd; const elementIndex = tNode.index; const currentDirectiveIndex = getCurrentDirectiveIndex(); try { setSelectedIndex(elementIndex); for (let dirIndex = start; dirIndex < end; dirIndex++) { const def = tView.data[dirIndex]; const directive = lView[dirIndex]; setCurrentDirectiveIndex(dirIndex); if (def.hostBindings !== null || def.hostVars !== 0 || def.hostAttrs !== null) { invokeHostBindingsInCreationMode(def, directive); } } } finally { setSelectedIndex(-1); setCurrentDirectiveIndex(currentDirectiveIndex); } } function invokeHostBindingsInCreationMode(def, directive) { if (def.hostBindings !== null) { def.hostBindings(1, directive); } } function findDirectiveDefMatches(tView, tNode) { ngDevMode && assertFirstCreatePass(tView); ngDevMode && assertTNodeType( tNode, 3 | 12 /* TNodeType.AnyContainer */ ); const registry = tView.directiveRegistry; let matches = null; let hostDirectiveDefs = null; if (registry) { for (let i = 0; i < registry.length; i++) { const def = registry[i]; if (isNodeMatchingSelectorList( tNode, def.selectors, /* isProjectionMode */ false )) { matches || (matches = []); if (isComponentDef(def)) { if (ngDevMode) { assertTNodeType(tNode, 2, `"${tNode.value}" tags cannot be used as component hosts. Please use a different tag to activate the ${stringify(def.type)} component.`); if (isComponentHost(tNode)) { throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type); } } if (def.findHostDirectiveDefs !== null) { const hostDirectiveMatches = []; hostDirectiveDefs = hostDirectiveDefs || /* @__PURE__ */ new Map(); def.findHostDirectiveDefs(def, hostDirectiveMatches, hostDirectiveDefs); matches.unshift(...hostDirectiveMatches, def); const componentOffset = hostDirectiveMatches.length; markAsComponentHost(tView, tNode, componentOffset); } else { matches.unshift(def); markAsComponentHost(tView, tNode, 0); } } else { hostDirectiveDefs = hostDirectiveDefs || /* @__PURE__ */ new Map(); def.findHostDirectiveDefs?.(def, matches, hostDirectiveDefs); matches.push(def); } } } } ngDevMode && matches !== null && assertNoDuplicateDirectives(matches); return matches === null ? null : [matches, hostDirectiveDefs]; } function markAsComponentHost(tView, hostTNode, componentOffset) { ngDevMode && assertFirstCreatePass(tView); ngDevMode && assertGreaterThan(componentOffset, -1, "componentOffset must be great than -1"); hostTNode.componentOffset = componentOffset; (tView.components ??= []).push(hostTNode.index); } function cacheMatchingLocalNames(tNode, localRefs, exportsMap) { if (localRefs) { const localNames = tNode.localNames = []; for (let i = 0; i < localRefs.length; i += 2) { const index = exportsMap[localRefs[i + 1]]; if (index == null) throw new RuntimeError(-301, ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`); localNames.push(localRefs[i], index); } } } function saveNameToExportMap(directiveIdx, def, exportsMap) { if (exportsMap) { if (def.exportAs) { for (let i = 0; i < def.exportAs.length; i++) { exportsMap[def.exportAs[i]] = directiveIdx; } } if (isComponentDef(def)) exportsMap[""] = directiveIdx; } } function initTNodeFlags(tNode, index, numberOfDirectives) { ngDevMode && assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, "Reached the max number of directives"); tNode.flags |= 1; tNode.directiveStart = index; tNode.directiveEnd = index + numberOfDirectives; tNode.providerIndexes = index; } function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) { ngDevMode && assertGreaterThanOrEqual(directiveIndex, HEADER_OFFSET, "Must be in Expando section"); tView.data[directiveIndex] = def; const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true)); const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), \u0275\u0275directiveInject); tView.blueprint[directiveIndex] = nodeInjectorFactory; lView[directiveIndex] = nodeInjectorFactory; registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def); } function addComponentLogic(lView, hostTNode, def) { const native = getNativeByTNode(hostTNode, lView); const tView = getOrCreateComponentTView(def); const rendererFactory = lView[ENVIRONMENT].rendererFactory; let lViewFlags = 16; if (def.signals) { lViewFlags = 4096; } else if (def.onPush) { lViewFlags = 64; } const componentView = addToViewTree(lView, createLView(lView, tView, null, lViewFlags, native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null)); lView[hostTNode.index] = componentView; } function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace) { if (ngDevMode) { assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE."); validateAgainstEventAttributes(name); assertTNodeType(tNode, 2, `Attempted to set attribute \`${name}\` on a container node. Host bindings are not valid on ng-container or ng-template.`); } const element = getNativeByTNode(tNode, lView); setElementAttribute(lView[RENDERER], element, namespace, tNode.value, name, value, sanitizer); } function setElementAttribute(renderer, element, namespace, tagName, name, value, sanitizer) { if (value == null) { ngDevMode && ngDevMode.rendererRemoveAttribute++; renderer.removeAttribute(element, name, namespace); } else { ngDevMode && ngDevMode.rendererSetAttribute++; const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tagName || "", name); renderer.setAttribute(element, name, strValue, namespace); } } function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initialInputData) { const initialInputs = initialInputData[directiveIndex]; if (initialInputs !== null) { for (let i = 0; i < initialInputs.length; ) { const publicName = initialInputs[i++]; const privateName = initialInputs[i++]; const flags = initialInputs[i++]; const value = initialInputs[i++]; writeToDirectiveInput(def, instance, publicName, privateName, flags, value); if (ngDevMode) { const nativeElement = getNativeByTNode(tNode, lView); setNgReflectProperty(lView, nativeElement, tNode.type, privateName, value); } } } } function generateInitialInputs(inputs, directiveIndex, attrs) { let inputsToStore = null; let i = 0; while (i < attrs.length) { const attrName = attrs[i]; if (attrName === 0) { i += 4; continue; } else if (attrName === 5) { i += 2; continue; } if (typeof attrName === "number") break; if (inputs.hasOwnProperty(attrName)) { if (inputsToStore === null) inputsToStore = []; const inputConfig = inputs[attrName]; for (let j = 0; j < inputConfig.length; j += 3) { if (inputConfig[j] === directiveIndex) { inputsToStore.push(attrName, inputConfig[j + 1], inputConfig[j + 2], attrs[i + 1]); break; } } } i += 2; } return inputsToStore; } function createLContainer(hostNative, currentView, native, tNode) { ngDevMode && assertLView(currentView); const lContainer = [ hostNative, // host native true, // Boolean `true` in this position signifies that this is an `LContainer` 0, // flags currentView, // parent null, // next tNode, // t_host null, // dehydrated views native, // native, null, // view refs null // moved views ]; ngDevMode && assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, "Should allocate correct number of slots for LContainer header."); return lContainer; } function refreshContentQueries(tView, lView) { const contentQueries = tView.contentQueries; if (contentQueries !== null) { const prevConsumer = setActiveConsumer(null); try { for (let i = 0; i < contentQueries.length; i += 2) { const queryStartIdx = contentQueries[i]; const directiveDefIdx = contentQueries[i + 1]; if (directiveDefIdx !== -1) { const directiveDef = tView.data[directiveDefIdx]; ngDevMode && assertDefined(directiveDef, "DirectiveDef not found."); ngDevMode && assertDefined(directiveDef.contentQueries, "contentQueries function should be defined"); setCurrentQueryIndex(queryStartIdx); directiveDef.contentQueries(2, lView[directiveDefIdx], directiveDefIdx); } } } finally { setActiveConsumer(prevConsumer); } } } function addToViewTree(lView, lViewOrLContainer) { if (lView[CHILD_HEAD]) { lView[CHILD_TAIL][NEXT] = lViewOrLContainer; } else { lView[CHILD_HEAD] = lViewOrLContainer; } lView[CHILD_TAIL] = lViewOrLContainer; return lViewOrLContainer; } function executeViewQueryFn(flags, viewQueryFn, component) { ngDevMode && assertDefined(viewQueryFn, "View queries function to execute must be defined."); setCurrentQueryIndex(0); const prevConsumer = setActiveConsumer(null); try { viewQueryFn(flags, component); } finally { setActiveConsumer(prevConsumer); } } function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex, ...interpolationParts) { if (tData[bindingIndex] === null) { if (tNode.inputs == null || !tNode.inputs[propertyName]) { const propBindingIdxs = tNode.propertyBindings || (tNode.propertyBindings = []); propBindingIdxs.push(bindingIndex); let bindingMetadata = propertyName; if (interpolationParts.length > 0) { bindingMetadata += INTERPOLATION_DELIMITER + interpolationParts.join(INTERPOLATION_DELIMITER); } tData[bindingIndex] = bindingMetadata; } } } function getOrCreateLViewCleanup(view) { return view[CLEANUP] ??= []; } function getOrCreateTViewCleanup(tView) { return tView.cleanup ??= []; } function loadComponentRenderer(currentDef, tNode, lView) { if (currentDef === null || isComponentDef(currentDef)) { lView = unwrapLView(lView[tNode.index]); } return lView[RENDERER]; } function handleError(lView, error) { const injector = lView[INJECTOR]; const errorHandler2 = injector ? injector.get(ErrorHandler, null) : null; errorHandler2 && errorHandler2.handleError(error); } function setInputsForProperty(tView, lView, inputs, publicName, value) { for (let i = 0; i < inputs.length; ) { const index = inputs[i++]; const privateName = inputs[i++]; const flags = inputs[i++]; const instance = lView[index]; ngDevMode && assertIndexInRange(lView, index); const def = tView.data[index]; writeToDirectiveInput(def, instance, publicName, privateName, flags, value); } } function textBindingInternal(lView, index, value) { ngDevMode && assertString(value, "Value should be a string"); ngDevMode && assertNotSame(value, NO_CHANGE, "value should not be NO_CHANGE"); ngDevMode && assertIndexInRange(lView, index); const element = getNativeByIndex(index, lView); ngDevMode && assertDefined(element, "native element should exist"); updateTextNode(lView[RENDERER], element, value); } function renderComponent(hostLView, componentHostIdx) { ngDevMode && assertEqual(isCreationMode(hostLView), true, "Should be run in creation mode"); const componentView = getComponentLViewByIndex(componentHostIdx, hostLView); const componentTView = componentView[TVIEW]; syncViewWithBlueprint(componentTView, componentView); const hostRNode = componentView[HOST]; if (hostRNode !== null && componentView[HYDRATION] === null) { componentView[HYDRATION] = retrieveHydrationInfo(hostRNode, componentView[INJECTOR]); } renderView(componentTView, componentView, componentView[CONTEXT]); } function syncViewWithBlueprint(tView, lView) { for (let i = lView.length; i < tView.blueprint.length; i++) { lView.push(tView.blueprint[i]); } } function renderView(tView, lView, context2) { ngDevMode && assertEqual(isCreationMode(lView), true, "Should be run in creation mode"); ngDevMode && assertNotReactive(renderView.name); enterView(lView); try { const viewQuery = tView.viewQuery; if (viewQuery !== null) { executeViewQueryFn(1, viewQuery, context2); } const templateFn = tView.template; if (templateFn !== null) { executeTemplate(tView, lView, templateFn, 1, context2); } if (tView.firstCreatePass) { tView.firstCreatePass = false; } lView[QUERIES]?.finishViewCreation(tView); if (tView.staticContentQueries) { refreshContentQueries(tView, lView); } if (tView.staticViewQueries) { executeViewQueryFn(2, tView.viewQuery, context2); } const components = tView.components; if (components !== null) { renderChildComponents(lView, components); } } catch (error) { if (tView.firstCreatePass) { tView.incompleteFirstPass = true; tView.firstCreatePass = false; } throw error; } finally { lView[FLAGS] &= ~4; leaveView(); } } function renderChildComponents(hostLView, components) { for (let i = 0; i < components.length; i++) { renderComponent(hostLView, components[i]); } } function createAndRenderEmbeddedLView(declarationLView, templateTNode, context2, options) { const prevConsumer = setActiveConsumer(null); try { const embeddedTView = templateTNode.tView; ngDevMode && assertDefined(embeddedTView, "TView must be defined for a template node."); ngDevMode && assertTNodeForLView(templateTNode, declarationLView); const isSignalView = declarationLView[FLAGS] & 4096; const viewFlags = isSignalView ? 4096 : 16; const embeddedLView = createLView(declarationLView, embeddedTView, context2, viewFlags, null, templateTNode, null, null, options?.injector ?? null, options?.embeddedViewInjector ?? null, options?.dehydratedView ?? null); const declarationLContainer = declarationLView[templateTNode.index]; ngDevMode && assertLContainer(declarationLContainer); embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer; const declarationViewLQueries = declarationLView[QUERIES]; if (declarationViewLQueries !== null) { embeddedLView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView); } renderView(embeddedTView, embeddedLView, context2); return embeddedLView; } finally { setActiveConsumer(prevConsumer); } } function getLViewFromLContainer(lContainer, index) { const adjustedIndex = CONTAINER_HEADER_OFFSET + index; if (adjustedIndex < lContainer.length) { const lView = lContainer[adjustedIndex]; ngDevMode && assertLView(lView); return lView; } return void 0; } function shouldAddViewToDom(tNode, dehydratedView) { return !dehydratedView || dehydratedView.firstChild === null || hasInSkipHydrationBlockFlag(tNode); } function addLViewToLContainer(lContainer, lView, index, addToDOM = true) { const tView = lView[TVIEW]; insertView(tView, lView, lContainer, index); if (addToDOM) { const beforeNode = getBeforeNodeForView(index, lContainer); const renderer = lView[RENDERER]; const parentRNode = nativeParentNode(renderer, lContainer[NATIVE]); if (parentRNode !== null) { addViewToDOM(tView, lContainer[T_HOST], renderer, lView, parentRNode, beforeNode); } } const hydrationInfo = lView[HYDRATION]; if (hydrationInfo !== null && hydrationInfo.firstChild !== null) { hydrationInfo.firstChild = null; } } function removeLViewFromLContainer(lContainer, index) { const lView = detachView(lContainer, index); if (lView !== void 0) { destroyLView(lView[TVIEW], lView); } return lView; } function collectNativeNodes(tView, lView, tNode, result, isProjection = false) { while (tNode !== null) { if (tNode.type === 128) { tNode = isProjection ? tNode.projectionNext : tNode.next; continue; } ngDevMode && assertTNodeType( tNode, 3 | 12 | 16 | 32 /* TNodeType.Icu */ ); const lNode = lView[tNode.index]; if (lNode !== null) { result.push(unwrapRNode(lNode)); } if (isLContainer(lNode)) { collectNativeNodesInLContainer(lNode, result); } const tNodeType = tNode.type; if (tNodeType & 8) { collectNativeNodes(tView, lView, tNode.child, result); } else if (tNodeType & 32) { const nextRNode = icuContainerIterate(tNode, lView); let rNode; while (rNode = nextRNode()) { result.push(rNode); } } else if (tNodeType & 16) { const nodesInSlot = getProjectionNodes(lView, tNode); if (Array.isArray(nodesInSlot)) { result.push(...nodesInSlot); } else { const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]); ngDevMode && assertParentView(parentView); collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true); } } tNode = isProjection ? tNode.projectionNext : tNode.next; } return result; } function collectNativeNodesInLContainer(lContainer, result) { for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) { const lViewInAContainer = lContainer[i]; const lViewFirstChildTNode = lViewInAContainer[TVIEW].firstChild; if (lViewFirstChildTNode !== null) { collectNativeNodes(lViewInAContainer[TVIEW], lViewInAContainer, lViewFirstChildTNode, result); } } if (lContainer[NATIVE] !== lContainer[HOST]) { result.push(lContainer[NATIVE]); } } var freeConsumers = []; function getOrBorrowReactiveLViewConsumer(lView) { return lView[REACTIVE_TEMPLATE_CONSUMER] ?? borrowReactiveLViewConsumer(lView); } function borrowReactiveLViewConsumer(lView) { const consumer = freeConsumers.pop() ?? Object.create(REACTIVE_LVIEW_CONSUMER_NODE); consumer.lView = lView; return consumer; } function maybeReturnReactiveLViewConsumer(consumer) { if (consumer.lView[REACTIVE_TEMPLATE_CONSUMER] === consumer) { return; } consumer.lView = null; freeConsumers.push(consumer); } var REACTIVE_LVIEW_CONSUMER_NODE = __spreadProps(__spreadValues({}, REACTIVE_NODE), { consumerIsAlwaysLive: true, consumerMarkedDirty: (node) => { markAncestorsForTraversal(node.lView); }, consumerOnSignalRead() { this.lView[REACTIVE_TEMPLATE_CONSUMER] = this; } }); function getOrCreateTemporaryConsumer(lView) { const consumer = lView[REACTIVE_TEMPLATE_CONSUMER] ?? Object.create(TEMPORARY_CONSUMER_NODE); consumer.lView = lView; return consumer; } var TEMPORARY_CONSUMER_NODE = __spreadProps(__spreadValues({}, REACTIVE_NODE), { consumerIsAlwaysLive: true, consumerMarkedDirty: (node) => { let parent = getLViewParent(node.lView); while (parent && !viewShouldHaveReactiveConsumer(parent[TVIEW])) { parent = getLViewParent(parent); } if (!parent) { return; } markViewForRefresh(parent); }, consumerOnSignalRead() { this.lView[REACTIVE_TEMPLATE_CONSUMER] = this; } }); function viewShouldHaveReactiveConsumer(tView) { return tView.type !== 2; } var MAXIMUM_REFRESH_RERUNS$1 = 100; function detectChangesInternal(lView, notifyErrorHandler = true, mode = 0) { const environment = lView[ENVIRONMENT]; const rendererFactory = environment.rendererFactory; const checkNoChangesMode = !!ngDevMode && isInCheckNoChangesMode(); if (!checkNoChangesMode) { rendererFactory.begin?.(); } try { detectChangesInViewWhileDirty(lView, mode); } catch (error) { if (notifyErrorHandler) { handleError(lView, error); } throw error; } finally { if (!checkNoChangesMode) { rendererFactory.end?.(); environment.inlineEffectRunner?.flush(); } } } function detectChangesInViewWhileDirty(lView, mode) { const lastIsRefreshingViewsValue = isRefreshingViews(); try { setIsRefreshingViews(true); detectChangesInView(lView, mode); if (ngDevMode && isExhaustiveCheckNoChanges()) { return; } let retries = 0; while (requiresRefreshOrTraversal(lView)) { if (retries === MAXIMUM_REFRESH_RERUNS$1) { throw new RuntimeError(103, ngDevMode && "Infinite change detection while trying to refresh views. There may be components which each cause the other to require a refresh, causing an infinite loop."); } retries++; detectChangesInView( lView, 1 /* ChangeDetectionMode.Targeted */ ); } } finally { setIsRefreshingViews(lastIsRefreshingViewsValue); } } function checkNoChangesInternal(lView, mode, notifyErrorHandler = true) { setIsInCheckNoChangesMode(mode); try { detectChangesInternal(lView, notifyErrorHandler); } finally { setIsInCheckNoChangesMode(CheckNoChangesMode.Off); } } function refreshView(tView, lView, templateFn, context2) { ngDevMode && assertEqual(isCreationMode(lView), false, "Should be run in update mode"); const flags = lView[FLAGS]; if ((flags & 256) === 256) return; const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode(); const isInExhaustiveCheckNoChangesPass = ngDevMode && isExhaustiveCheckNoChanges(); !isInCheckNoChangesPass && lView[ENVIRONMENT].inlineEffectRunner?.flush(); enterView(lView); let returnConsumerToPool = true; let prevConsumer = null; let currentConsumer = null; if (!isInCheckNoChangesPass) { if (viewShouldHaveReactiveConsumer(tView)) { currentConsumer = getOrBorrowReactiveLViewConsumer(lView); prevConsumer = consumerBeforeComputation(currentConsumer); } else if (getActiveConsumer() === null) { returnConsumerToPool = false; currentConsumer = getOrCreateTemporaryConsumer(lView); prevConsumer = consumerBeforeComputation(currentConsumer); } else if (lView[REACTIVE_TEMPLATE_CONSUMER]) { consumerDestroy(lView[REACTIVE_TEMPLATE_CONSUMER]); lView[REACTIVE_TEMPLATE_CONSUMER] = null; } } try { resetPreOrderHookFlags(lView); setBindingIndex(tView.bindingStartIndex); if (templateFn !== null) { executeTemplate(tView, lView, templateFn, 2, context2); } const hooksInitPhaseCompleted = (flags & 3) === 3; if (!isInCheckNoChangesPass) { if (hooksInitPhaseCompleted) { const preOrderCheckHooks = tView.preOrderCheckHooks; if (preOrderCheckHooks !== null) { executeCheckHooks(lView, preOrderCheckHooks, null); } } else { const preOrderHooks = tView.preOrderHooks; if (preOrderHooks !== null) { executeInitAndCheckHooks(lView, preOrderHooks, 0, null); } incrementInitPhaseFlags( lView, 0 /* InitPhaseState.OnInitHooksToBeRun */ ); } } if (!isInExhaustiveCheckNoChangesPass) { markTransplantedViewsForRefresh(lView); } detectChangesInEmbeddedViews( lView, 0 /* ChangeDetectionMode.Global */ ); if (tView.contentQueries !== null) { refreshContentQueries(tView, lView); } if (!isInCheckNoChangesPass) { if (hooksInitPhaseCompleted) { const contentCheckHooks = tView.contentCheckHooks; if (contentCheckHooks !== null) { executeCheckHooks(lView, contentCheckHooks); } } else { const contentHooks = tView.contentHooks; if (contentHooks !== null) { executeInitAndCheckHooks( lView, contentHooks, 1 /* InitPhaseState.AfterContentInitHooksToBeRun */ ); } incrementInitPhaseFlags( lView, 1 /* InitPhaseState.AfterContentInitHooksToBeRun */ ); } } processHostBindingOpCodes(tView, lView); const components = tView.components; if (components !== null) { detectChangesInChildComponents( lView, components, 0 /* ChangeDetectionMode.Global */ ); } const viewQuery = tView.viewQuery; if (viewQuery !== null) { executeViewQueryFn(2, viewQuery, context2); } if (!isInCheckNoChangesPass) { if (hooksInitPhaseCompleted) { const viewCheckHooks = tView.viewCheckHooks; if (viewCheckHooks !== null) { executeCheckHooks(lView, viewCheckHooks); } } else { const viewHooks = tView.viewHooks; if (viewHooks !== null) { executeInitAndCheckHooks( lView, viewHooks, 2 /* InitPhaseState.AfterViewInitHooksToBeRun */ ); } incrementInitPhaseFlags( lView, 2 /* InitPhaseState.AfterViewInitHooksToBeRun */ ); } } if (tView.firstUpdatePass === true) { tView.firstUpdatePass = false; } if (lView[EFFECTS_TO_SCHEDULE]) { for (const notifyEffect of lView[EFFECTS_TO_SCHEDULE]) { notifyEffect(); } lView[EFFECTS_TO_SCHEDULE] = null; } if (!isInCheckNoChangesPass) { lView[FLAGS] &= ~(64 | 8); } } catch (e) { if (!isInCheckNoChangesPass) { markAncestorsForTraversal(lView); } throw e; } finally { if (currentConsumer !== null) { consumerAfterComputation(currentConsumer, prevConsumer); if (returnConsumerToPool) { maybeReturnReactiveLViewConsumer(currentConsumer); } } leaveView(); } } function detectChangesInEmbeddedViews(lView, mode) { for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) { for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) { const embeddedLView = lContainer[i]; detectChangesInViewIfAttached(embeddedLView, mode); } } } function markTransplantedViewsForRefresh(lView) { for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) { if (!(lContainer[FLAGS] & LContainerFlags.HasTransplantedViews)) continue; const movedViews = lContainer[MOVED_VIEWS]; ngDevMode && assertDefined(movedViews, "Transplanted View flags set but missing MOVED_VIEWS"); for (let i = 0; i < movedViews.length; i++) { const movedLView = movedViews[i]; markViewForRefresh(movedLView); } } } function detectChangesInComponent(hostLView, componentHostIdx, mode) { ngDevMode && assertEqual(isCreationMode(hostLView), false, "Should be run in update mode"); const componentView = getComponentLViewByIndex(componentHostIdx, hostLView); detectChangesInViewIfAttached(componentView, mode); } function detectChangesInViewIfAttached(lView, mode) { if (!viewAttachedToChangeDetector(lView)) { return; } detectChangesInView(lView, mode); } function detectChangesInView(lView, mode) { const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode(); const tView = lView[TVIEW]; const flags = lView[FLAGS]; const consumer = lView[REACTIVE_TEMPLATE_CONSUMER]; let shouldRefreshView = !!(mode === 0 && flags & 16); shouldRefreshView ||= !!(flags & 64 && mode === 0 && !isInCheckNoChangesPass); shouldRefreshView ||= !!(flags & 1024); shouldRefreshView ||= !!(consumer?.dirty && consumerPollProducersForChange(consumer)); shouldRefreshView ||= !!(ngDevMode && isExhaustiveCheckNoChanges()); if (consumer) { consumer.dirty = false; } lView[FLAGS] &= ~(8192 | 1024); if (shouldRefreshView) { refreshView(tView, lView, tView.template, lView[CONTEXT]); } else if (flags & 8192) { detectChangesInEmbeddedViews( lView, 1 /* ChangeDetectionMode.Targeted */ ); const components = tView.components; if (components !== null) { detectChangesInChildComponents( lView, components, 1 /* ChangeDetectionMode.Targeted */ ); } } } function detectChangesInChildComponents(hostLView, components, mode) { for (let i = 0; i < components.length; i++) { detectChangesInComponent(hostLView, components[i], mode); } } function markViewDirty(lView, source) { const dirtyBitsToUse = isRefreshingViews() ? ( // When we are actively refreshing views, we only use the `Dirty` bit to mark a view 64 ) : ( // When we are not actively refreshing a view tree, it is absolutely // valid to update state and mark views dirty. We use the `RefreshView` flag in this // case to allow synchronously rerunning change detection. This applies today to // afterRender hooks as well as animation listeners which execute after detecting // changes in a view when the render factory flushes. 1024 | 64 ); lView[ENVIRONMENT].changeDetectionScheduler?.notify(source); while (lView) { lView[FLAGS] |= dirtyBitsToUse; const parent = getLViewParent(lView); if (isRootView(lView) && !parent) { return lView; } lView = parent; } return null; } var ViewRef$1 = class { get rootNodes() { const lView = this._lView; const tView = lView[TVIEW]; return collectNativeNodes(tView, lView, tView.firstChild, []); } constructor(_lView, _cdRefInjectingView, notifyErrorHandler = true) { this._lView = _lView; this._cdRefInjectingView = _cdRefInjectingView; this.notifyErrorHandler = notifyErrorHandler; this._appRef = null; this._attachedToViewContainer = false; } get context() { return this._lView[CONTEXT]; } /** * @deprecated Replacing the full context object is not supported. Modify the context * directly, or consider using a `Proxy` if you need to replace the full object. * // TODO(devversion): Remove this. */ set context(value) { if (ngDevMode) { console.warn("Angular: Replacing the `context` object of an `EmbeddedViewRef` is deprecated."); } this._lView[CONTEXT] = value; } get destroyed() { return (this._lView[FLAGS] & 256) === 256; } destroy() { if (this._appRef) { this._appRef.detachView(this); } else if (this._attachedToViewContainer) { const parent = this._lView[PARENT]; if (isLContainer(parent)) { const viewRefs = parent[VIEW_REFS]; const index = viewRefs ? viewRefs.indexOf(this) : -1; if (index > -1) { ngDevMode && assertEqual(index, parent.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, "An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array."); detachView(parent, index); removeFromArray(viewRefs, index); } } this._attachedToViewContainer = false; } destroyLView(this._lView[TVIEW], this._lView); } onDestroy(callback) { storeLViewOnDestroy(this._lView, callback); } /** * Marks a view and all of its ancestors dirty. * * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush} component is * checked when it needs to be re-rendered but the two normal triggers haven't marked it * dirty (i.e. inputs haven't changed and events haven't fired in the view). * * * * @usageNotes * ### Example * * ```typescript * @Component({ * selector: 'app-root', * template: `Number of ticks: {{numberOfTicks}}` * changeDetection: ChangeDetectionStrategy.OnPush, * }) * class AppComponent { * numberOfTicks = 0; * * constructor(private ref: ChangeDetectorRef) { * setInterval(() => { * this.numberOfTicks++; * // the following is required, otherwise the view will not be updated * this.ref.markForCheck(); * }, 1000); * } * } * ``` */ markForCheck() { markViewDirty( this._cdRefInjectingView || this._lView, 4 /* NotificationSource.MarkForCheck */ ); } /** * Detaches the view from the change detection tree. * * Detached views will not be checked during change detection runs until they are * re-attached, even if they are dirty. `detach` can be used in combination with * {@link ChangeDetectorRef#detectChanges} to implement local change * detection checks. * * * * * @usageNotes * ### Example * * The following example defines a component with a large list of readonly data. * Imagine the data changes constantly, many times per second. For performance reasons, * we want to check and update the list every five seconds. We can do that by detaching * the component's change detector and doing a local check every five seconds. * * ```typescript * class DataProvider { * // in a real application the returned data will be different every time * get data() { * return [1,2,3,4,5]; * } * } * * @Component({ * selector: 'giant-list', * template: ` *
  • Data {{d}}
  • * `, * }) * class GiantList { * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) { * ref.detach(); * setInterval(() => { * this.ref.detectChanges(); * }, 5000); * } * } * * @Component({ * selector: 'app', * providers: [DataProvider], * template: ` * * `, * }) * class App { * } * ``` */ detach() { this._lView[FLAGS] &= ~128; } /** * Re-attaches a view to the change detection tree. * * This can be used to re-attach views that were previously detached from the tree * using {@link ChangeDetectorRef#detach}. Views are attached to the tree by default. * * * * @usageNotes * ### Example * * The following example creates a component displaying `live` data. The component will detach * its change detector from the main change detector tree when the component's live property * is set to false. * * ```typescript * class DataProvider { * data = 1; * * constructor() { * setInterval(() => { * this.data = this.data * 2; * }, 500); * } * } * * @Component({ * selector: 'live-data', * inputs: ['live'], * template: 'Data: {{dataProvider.data}}' * }) * class LiveData { * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {} * * set live(value) { * if (value) { * this.ref.reattach(); * } else { * this.ref.detach(); * } * } * } * * @Component({ * selector: 'app-root', * providers: [DataProvider], * template: ` * Live Update: * * `, * }) * class AppComponent { * live = true; * } * ``` */ reattach() { updateAncestorTraversalFlagsOnAttach(this._lView); this._lView[FLAGS] |= 128; } /** * Checks the view and its children. * * This can also be used in combination with {@link ChangeDetectorRef#detach} to implement * local change detection checks. * * * * * @usageNotes * ### Example * * The following example defines a component with a large list of readonly data. * Imagine, the data changes constantly, many times per second. For performance reasons, * we want to check and update the list every five seconds. * * We can do that by detaching the component's change detector and doing a local change detection * check every five seconds. * * See {@link ChangeDetectorRef#detach} for more information. */ detectChanges() { this._lView[FLAGS] |= 1024; detectChangesInternal(this._lView, this.notifyErrorHandler); } /** * Checks the change detector and its children, and throws if any changes are detected. * * This is used in development mode to verify that running change detection doesn't * introduce other changes. */ checkNoChanges() { if (ngDevMode) { checkNoChangesInternal(this._lView, CheckNoChangesMode.OnlyDirtyViews, this.notifyErrorHandler); } } attachToViewContainerRef() { if (this._appRef) { throw new RuntimeError(902, ngDevMode && "This view is already attached directly to the ApplicationRef!"); } this._attachedToViewContainer = true; } detachFromAppRef() { this._appRef = null; const isRoot = isRootView(this._lView); const declarationContainer = this._lView[DECLARATION_LCONTAINER]; if (declarationContainer !== null && !isRoot) { detachMovedView(declarationContainer, this._lView); } detachViewFromDOM(this._lView[TVIEW], this._lView); } attachToAppRef(appRef) { if (this._attachedToViewContainer) { throw new RuntimeError(902, ngDevMode && "This view is already attached to a ViewContainer!"); } this._appRef = appRef; const isRoot = isRootView(this._lView); const declarationContainer = this._lView[DECLARATION_LCONTAINER]; if (declarationContainer !== null && !isRoot) { trackMovedView(declarationContainer, this._lView); } updateAncestorTraversalFlagsOnAttach(this._lView); } }; var TemplateRef = class { static { this.__NG_ELEMENT_ID__ = injectTemplateRef; } }; var ViewEngineTemplateRef = TemplateRef; var R3TemplateRef = class TemplateRef2 extends ViewEngineTemplateRef { constructor(_declarationLView, _declarationTContainer, elementRef) { super(); this._declarationLView = _declarationLView; this._declarationTContainer = _declarationTContainer; this.elementRef = elementRef; } /** * Returns an `ssrId` associated with a TView, which was used to * create this instance of the `TemplateRef`. * * @internal */ get ssrId() { return this._declarationTContainer.tView?.ssrId || null; } createEmbeddedView(context2, injector) { return this.createEmbeddedViewImpl(context2, injector); } /** * @internal */ createEmbeddedViewImpl(context2, injector, dehydratedView) { const embeddedLView = createAndRenderEmbeddedLView(this._declarationLView, this._declarationTContainer, context2, { embeddedViewInjector: injector, dehydratedView }); return new ViewRef$1(embeddedLView); } }; function injectTemplateRef() { return createTemplateRef(getCurrentTNode(), getLView()); } function createTemplateRef(hostTNode, hostLView) { if (hostTNode.type & 4) { ngDevMode && assertDefined(hostTNode.tView, "TView must be allocated"); return new R3TemplateRef(hostLView, hostTNode, createElementRef(hostTNode, hostLView)); } return null; } function getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView) { const tNodeInsertBeforeIndex = currentTNode.insertBeforeIndex; const insertBeforeIndex = Array.isArray(tNodeInsertBeforeIndex) ? tNodeInsertBeforeIndex[0] : tNodeInsertBeforeIndex; if (insertBeforeIndex === null) { return getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView); } else { ngDevMode && assertIndexInRange(lView, insertBeforeIndex); return unwrapRNode(lView[insertBeforeIndex]); } } function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRElement) { const tNodeInsertBeforeIndex = childTNode.insertBeforeIndex; if (Array.isArray(tNodeInsertBeforeIndex)) { ngDevMode && assertDomNode(childRNode); let i18nParent = childRNode; let anchorRNode = null; if (!(childTNode.type & 3)) { anchorRNode = i18nParent; i18nParent = parentRElement; } if (i18nParent !== null && childTNode.componentOffset === -1) { for (let i = 1; i < tNodeInsertBeforeIndex.length; i++) { const i18nChild = lView[tNodeInsertBeforeIndex[i]]; nativeInsertBefore(renderer, i18nParent, i18nChild, anchorRNode, false); } } } } function addTNodeAndUpdateInsertBeforeIndex(previousTNodes, newTNode) { ngDevMode && assertEqual(newTNode.insertBeforeIndex, null, "We expect that insertBeforeIndex is not set"); previousTNodes.push(newTNode); if (previousTNodes.length > 1) { for (let i = previousTNodes.length - 2; i >= 0; i--) { const existingTNode = previousTNodes[i]; if (!isI18nText(existingTNode)) { if (isNewTNodeCreatedBefore(existingTNode, newTNode) && getInsertBeforeIndex(existingTNode) === null) { setInsertBeforeIndex(existingTNode, newTNode.index); } } } } } function isI18nText(tNode) { return !(tNode.type & 64); } function isNewTNodeCreatedBefore(existingTNode, newTNode) { return isI18nText(newTNode) || existingTNode.index > newTNode.index; } function getInsertBeforeIndex(tNode) { const index = tNode.insertBeforeIndex; return Array.isArray(index) ? index[0] : index; } function setInsertBeforeIndex(tNode, value) { const index = tNode.insertBeforeIndex; if (Array.isArray(index)) { index[0] = value; } else { setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore); tNode.insertBeforeIndex = value; } } function getTIcu(tView, index) { const value = tView.data[index]; if (value === null || typeof value === "string") return null; if (ngDevMode && !(value.hasOwnProperty("tView") || value.hasOwnProperty("currentCaseLViewIndex"))) { throwError("We expect to get 'null'|'TIcu'|'TIcuContainer', but got: " + value); } const tIcu = value.hasOwnProperty("currentCaseLViewIndex") ? value : value.value; ngDevMode && assertTIcu(tIcu); return tIcu; } function setTIcu(tView, index, tIcu) { const tNode = tView.data[index]; ngDevMode && assertEqual(tNode === null || tNode.hasOwnProperty("tView"), true, "We expect to get 'null'|'TIcuContainer'"); if (tNode === null) { tView.data[index] = tIcu; } else { ngDevMode && assertTNodeType( tNode, 32 /* TNodeType.Icu */ ); tNode.value = tIcu; } } function setTNodeInsertBeforeIndex(tNode, index) { ngDevMode && assertTNode(tNode); let insertBeforeIndex = tNode.insertBeforeIndex; if (insertBeforeIndex === null) { setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore); insertBeforeIndex = tNode.insertBeforeIndex = [null, index]; } else { assertEqual(Array.isArray(insertBeforeIndex), true, "Expecting array here"); insertBeforeIndex.push(index); } } function createTNodePlaceholder(tView, previousTNodes, index) { const tNode = createTNodeAtIndex(tView, index, 64, null, null); addTNodeAndUpdateInsertBeforeIndex(previousTNodes, tNode); return tNode; } function getCurrentICUCaseIndex(tIcu, lView) { const currentCase = lView[tIcu.currentCaseLViewIndex]; return currentCase === null ? currentCase : currentCase < 0 ? ~currentCase : currentCase; } function getParentFromIcuCreateOpCode(mergedCode) { return mergedCode >>> 17; } function getRefFromIcuCreateOpCode(mergedCode) { return (mergedCode & 131070) >>> 1; } function getInstructionFromIcuCreateOpCode(mergedCode) { return mergedCode & 1; } function icuCreateOpCode(opCode, parentIdx, refIdx) { ngDevMode && assertGreaterThanOrEqual(parentIdx, 0, "Missing parent index"); ngDevMode && assertGreaterThan(refIdx, 0, "Missing ref index"); return opCode | parentIdx << 17 | refIdx << 1; } function isRootTemplateMessage(subTemplateIndex) { return subTemplateIndex === -1; } function enterIcu(state, tIcu, lView) { state.index = 0; const currentCase = getCurrentICUCaseIndex(tIcu, lView); if (currentCase !== null) { ngDevMode && assertNumberInRange(currentCase, 0, tIcu.cases.length - 1); state.removes = tIcu.remove[currentCase]; } else { state.removes = EMPTY_ARRAY; } } function icuContainerIteratorNext(state) { if (state.index < state.removes.length) { const removeOpCode = state.removes[state.index++]; ngDevMode && assertNumber(removeOpCode, "Expecting OpCode number"); if (removeOpCode > 0) { const rNode = state.lView[removeOpCode]; ngDevMode && assertDomNode(rNode); return rNode; } else { state.stack.push(state.index, state.removes); const tIcuIndex = ~removeOpCode; const tIcu = state.lView[TVIEW].data[tIcuIndex]; ngDevMode && assertTIcu(tIcu); enterIcu(state, tIcu, state.lView); return icuContainerIteratorNext(state); } } else { if (state.stack.length === 0) { return null; } else { state.removes = state.stack.pop(); state.index = state.stack.pop(); return icuContainerIteratorNext(state); } } } function loadIcuContainerVisitor() { const _state = { stack: [], index: -1 }; function icuContainerIteratorStart(tIcuContainerNode, lView) { _state.lView = lView; while (_state.stack.length) _state.stack.pop(); ngDevMode && assertTNodeForLView(tIcuContainerNode, lView); enterIcu(_state, tIcuContainerNode.value, lView); return icuContainerIteratorNext.bind(null, _state); } return icuContainerIteratorStart; } var REF_EXTRACTOR_REGEXP = new RegExp(`^(\\d+)*(${REFERENCE_NODE_BODY}|${REFERENCE_NODE_HOST})*(.*)`); var _prepareI18nBlockForHydrationImpl = () => { }; function prepareI18nBlockForHydration(lView, index, parentTNode, subTemplateIndex) { _prepareI18nBlockForHydrationImpl(lView, index, parentTNode, subTemplateIndex); } var _claimDehydratedIcuCaseImpl = () => { }; function claimDehydratedIcuCase(lView, icuIndex, caseIndex) { _claimDehydratedIcuCaseImpl(lView, icuIndex, caseIndex); } var _findMatchingDehydratedViewImpl = () => null; function findMatchingDehydratedView(lContainer, template) { return _findMatchingDehydratedViewImpl(lContainer, template); } var ChangeDetectionScheduler = class { }; var ZONELESS_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "Zoneless enabled" : "", { providedIn: "root", factory: () => false }); var PROVIDED_ZONELESS = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "Zoneless provided" : "", { providedIn: "root", factory: () => false }); var ZONELESS_SCHEDULER_DISABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "scheduler disabled" : ""); var SCHEDULE_IN_ROOT_ZONE = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "run changes outside zone in root" : ""); var ComponentRef$1 = class { }; var ComponentFactory$1 = class { }; function noComponentFactoryError(component) { const error = Error(`No component factory found for ${stringify(component)}.`); error[ERROR_COMPONENT] = component; return error; } var ERROR_COMPONENT = "ngComponent"; var _NullComponentFactoryResolver = class { resolveComponentFactory(component) { throw noComponentFactoryError(component); } }; var ComponentFactoryResolver$1 = class { static { this.NULL = new _NullComponentFactoryResolver(); } }; var RendererFactory2 = class { }; var Renderer2 = class { constructor() { this.destroyNode = null; } static { this.__NG_ELEMENT_ID__ = () => injectRenderer2(); } }; function injectRenderer2() { const lView = getLView(); const tNode = getCurrentTNode(); const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView); return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER]; } var Sanitizer = class _Sanitizer { static { this.\u0275prov = \u0275\u0275defineInjectable({ token: _Sanitizer, providedIn: "root", factory: () => null }); } }; function isModuleWithProviders(value) { return value.ngModule !== void 0; } function isNgModule(value) { return !!getNgModuleDef(value); } function isPipe(value) { return !!getPipeDef$1(value); } function isDirective(value) { return !!getDirectiveDef(value); } function isComponent(value) { return !!getComponentDef(value); } function getDependencyTypeForError(type) { if (getComponentDef(type)) return "component"; if (getDirectiveDef(type)) return "directive"; if (getPipeDef$1(type)) return "pipe"; return "type"; } function verifyStandaloneImport(depType, importingType) { if (isForwardRef(depType)) { depType = resolveForwardRef(depType); if (!depType) { throw new Error(`Expected forwardRef function, imported from "${stringifyForError(importingType)}", to return a standalone entity or NgModule but got "${stringifyForError(depType) || depType}".`); } } if (getNgModuleDef(depType) == null) { const def = getComponentDef(depType) || getDirectiveDef(depType) || getPipeDef$1(depType); if (def != null) { if (!def.standalone) { throw new Error(`The "${stringifyForError(depType)}" ${getDependencyTypeForError(depType)}, imported from "${stringifyForError(importingType)}", is not standalone. Did you forget to add the standalone: true flag?`); } } else { if (isModuleWithProviders(depType)) { throw new Error(`A module with providers was imported from "${stringifyForError(importingType)}". Modules with providers are not supported in standalone components imports.`); } else { throw new Error(`The "${stringifyForError(depType)}" type, imported from "${stringifyForError(importingType)}", must be a standalone component / directive / pipe or an NgModule. Did you forget to add the required @Component / @Directive / @Pipe or @NgModule annotation?`); } } } } var USE_RUNTIME_DEPS_TRACKER_FOR_JIT = true; var DepsTracker = class { constructor() { this.ownerNgModule = /* @__PURE__ */ new Map(); this.ngModulesWithSomeUnresolvedDecls = /* @__PURE__ */ new Set(); this.ngModulesScopeCache = /* @__PURE__ */ new Map(); this.standaloneComponentsScopeCache = /* @__PURE__ */ new Map(); } /** * Attempts to resolve ng module's forward ref declarations as much as possible and add them to * the `ownerNgModule` map. This method normally should be called after the initial parsing when * all the forward refs are resolved (e.g., when trying to render a component) */ resolveNgModulesDecls() { if (this.ngModulesWithSomeUnresolvedDecls.size === 0) { return; } for (const moduleType of this.ngModulesWithSomeUnresolvedDecls) { const def = getNgModuleDef(moduleType); if (def?.declarations) { for (const decl of maybeUnwrapFn(def.declarations)) { if (isComponent(decl)) { this.ownerNgModule.set(decl, moduleType); } } } } this.ngModulesWithSomeUnresolvedDecls.clear(); } /** @override */ getComponentDependencies(type, rawImports) { this.resolveNgModulesDecls(); const def = getComponentDef(type); if (def === null) { throw new Error(`Attempting to get component dependencies for a type that is not a component: ${type}`); } if (def.standalone) { const scope = this.getStandaloneComponentScope(type, rawImports); if (scope.compilation.isPoisoned) { return { dependencies: [] }; } return { dependencies: [...scope.compilation.directives, ...scope.compilation.pipes, ...scope.compilation.ngModules] }; } else { if (!this.ownerNgModule.has(type)) { return { dependencies: [] }; } const scope = this.getNgModuleScope(this.ownerNgModule.get(type)); if (scope.compilation.isPoisoned) { return { dependencies: [] }; } return { dependencies: [...scope.compilation.directives, ...scope.compilation.pipes] }; } } /** * @override * This implementation does not make use of param scopeInfo since it assumes the scope info is * already added to the type itself through methods like {@link ɵɵsetNgModuleScope} */ registerNgModule(type, scopeInfo) { if (!isNgModule(type)) { throw new Error(`Attempting to register a Type which is not NgModule as NgModule: ${type}`); } this.ngModulesWithSomeUnresolvedDecls.add(type); } /** @override */ clearScopeCacheFor(type) { this.ngModulesScopeCache.delete(type); this.standaloneComponentsScopeCache.delete(type); } /** @override */ getNgModuleScope(type) { if (this.ngModulesScopeCache.has(type)) { return this.ngModulesScopeCache.get(type); } const scope = this.computeNgModuleScope(type); this.ngModulesScopeCache.set(type, scope); return scope; } /** Compute NgModule scope afresh. */ computeNgModuleScope(type) { const def = getNgModuleDef(type, true); const scope = { exported: { directives: /* @__PURE__ */ new Set(), pipes: /* @__PURE__ */ new Set() }, compilation: { directives: /* @__PURE__ */ new Set(), pipes: /* @__PURE__ */ new Set() } }; for (const imported of maybeUnwrapFn(def.imports)) { if (isNgModule(imported)) { const importedScope = this.getNgModuleScope(imported); addSet(importedScope.exported.directives, scope.compilation.directives); addSet(importedScope.exported.pipes, scope.compilation.pipes); } else if (isStandalone(imported)) { if (isDirective(imported) || isComponent(imported)) { scope.compilation.directives.add(imported); } else if (isPipe(imported)) { scope.compilation.pipes.add(imported); } else { throw new RuntimeError(1e3, "The standalone imported type is neither a component nor a directive nor a pipe"); } } else { scope.compilation.isPoisoned = true; break; } } if (!scope.compilation.isPoisoned) { for (const decl of maybeUnwrapFn(def.declarations)) { if (isNgModule(decl) || isStandalone(decl)) { scope.compilation.isPoisoned = true; break; } if (isPipe(decl)) { scope.compilation.pipes.add(decl); } else { scope.compilation.directives.add(decl); } } } for (const exported of maybeUnwrapFn(def.exports)) { if (isNgModule(exported)) { const exportedScope = this.getNgModuleScope(exported); addSet(exportedScope.exported.directives, scope.exported.directives); addSet(exportedScope.exported.pipes, scope.exported.pipes); addSet(exportedScope.exported.directives, scope.compilation.directives); addSet(exportedScope.exported.pipes, scope.compilation.pipes); } else if (isPipe(exported)) { scope.exported.pipes.add(exported); } else { scope.exported.directives.add(exported); } } return scope; } /** @override */ getStandaloneComponentScope(type, rawImports) { if (this.standaloneComponentsScopeCache.has(type)) { return this.standaloneComponentsScopeCache.get(type); } const ans = this.computeStandaloneComponentScope(type, rawImports); this.standaloneComponentsScopeCache.set(type, ans); return ans; } computeStandaloneComponentScope(type, rawImports) { const ans = { compilation: { // Standalone components are always able to self-reference. directives: /* @__PURE__ */ new Set([type]), pipes: /* @__PURE__ */ new Set(), ngModules: /* @__PURE__ */ new Set() } }; for (const rawImport of flatten(rawImports ?? [])) { const imported = resolveForwardRef(rawImport); try { verifyStandaloneImport(imported, type); } catch (e) { ans.compilation.isPoisoned = true; return ans; } if (isNgModule(imported)) { ans.compilation.ngModules.add(imported); const importedScope = this.getNgModuleScope(imported); if (importedScope.exported.isPoisoned) { ans.compilation.isPoisoned = true; return ans; } addSet(importedScope.exported.directives, ans.compilation.directives); addSet(importedScope.exported.pipes, ans.compilation.pipes); } else if (isPipe(imported)) { ans.compilation.pipes.add(imported); } else if (isDirective(imported) || isComponent(imported)) { ans.compilation.directives.add(imported); } else { ans.compilation.isPoisoned = true; return ans; } } return ans; } /** @override */ isOrphanComponent(cmp) { const def = getComponentDef(cmp); if (!def || def.standalone) { return false; } this.resolveNgModulesDecls(); return !this.ownerNgModule.has(cmp); } }; function addSet(sourceSet, targetSet) { for (const m of sourceSet) { targetSet.add(m); } } var depsTracker = new DepsTracker(); function computeStaticStyling(tNode, attrs, writeToHost) { ngDevMode && assertFirstCreatePass(getTView(), "Expecting to be called in first template pass only"); let styles = writeToHost ? tNode.styles : null; let classes = writeToHost ? tNode.classes : null; let mode = 0; if (attrs !== null) { for (let i = 0; i < attrs.length; i++) { const value = attrs[i]; if (typeof value === "number") { mode = value; } else if (mode == 1) { classes = concatStringsWithSpace(classes, value); } else if (mode == 2) { const style = value; const styleValue = attrs[++i]; styles = concatStringsWithSpace(styles, style + ": " + styleValue + ";"); } } } writeToHost ? tNode.styles = styles : tNode.stylesWithoutHost = styles; writeToHost ? tNode.classes = classes : tNode.classesWithoutHost = classes; } var ComponentFactoryResolver = class extends ComponentFactoryResolver$1 { /** * @param ngModule The NgModuleRef to which all resolved factories are bound. */ constructor(ngModule) { super(); this.ngModule = ngModule; } resolveComponentFactory(component) { ngDevMode && assertComponentType(component); const componentDef = getComponentDef(component); return new ComponentFactory(componentDef, this.ngModule); } }; function toRefArray(map2, isInputMap) { const array = []; for (const publicName in map2) { if (!map2.hasOwnProperty(publicName)) { continue; } const value = map2[publicName]; if (value === void 0) { continue; } const isArray3 = Array.isArray(value); const propName = isArray3 ? value[0] : value; const flags = isArray3 ? value[1] : InputFlags.None; if (isInputMap) { array.push({ propName, templateName: publicName, isSignal: (flags & InputFlags.SignalBased) !== 0 }); } else { array.push({ propName, templateName: publicName }); } } return array; } function getNamespace(elementName) { const name = elementName.toLowerCase(); return name === "svg" ? SVG_NAMESPACE : name === "math" ? MATH_ML_NAMESPACE : null; } var ComponentFactory = class extends ComponentFactory$1 { get inputs() { const componentDef = this.componentDef; const inputTransforms = componentDef.inputTransforms; const refArray = toRefArray(componentDef.inputs, true); if (inputTransforms !== null) { for (const input2 of refArray) { if (inputTransforms.hasOwnProperty(input2.propName)) { input2.transform = inputTransforms[input2.propName]; } } } return refArray; } get outputs() { return toRefArray(this.componentDef.outputs, false); } /** * @param componentDef The component definition. * @param ngModule The NgModuleRef to which the factory is bound. */ constructor(componentDef, ngModule) { super(); this.componentDef = componentDef; this.ngModule = ngModule; this.componentType = componentDef.type; this.selector = stringifyCSSSelectorList(componentDef.selectors); this.ngContentSelectors = componentDef.ngContentSelectors ? componentDef.ngContentSelectors : []; this.isBoundToModule = !!ngModule; } create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) { const prevConsumer = setActiveConsumer(null); try { if (ngDevMode && false) { if (depsTracker.isOrphanComponent(this.componentType)) { throw new RuntimeError(1001, `Orphan component found! Trying to render the component ${debugStringifyTypeForError(this.componentType)} without first loading the NgModule that declares it. It is recommended to make this component standalone in order to avoid this error. If this is not possible now, import the component's NgModule in the appropriate NgModule, or the standalone component in which you are trying to render this component. If this is a lazy import, load the NgModule lazily as well and use its module injector.`); } } environmentInjector = environmentInjector || this.ngModule; let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ? environmentInjector : environmentInjector?.injector; if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) { realEnvironmentInjector = this.componentDef.getStandaloneInjector(realEnvironmentInjector) || realEnvironmentInjector; } const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector; const rendererFactory = rootViewInjector.get(RendererFactory2, null); if (rendererFactory === null) { throw new RuntimeError(407, ngDevMode && "Angular was not able to inject a renderer (RendererFactory2). Likely this is due to a broken DI hierarchy. Make sure that any injector used to create this component has a correct parent."); } const sanitizer = rootViewInjector.get(Sanitizer, null); const changeDetectionScheduler = rootViewInjector.get(ChangeDetectionScheduler, null); const environment = { rendererFactory, sanitizer, // We don't use inline effects (yet). inlineEffectRunner: null, changeDetectionScheduler }; const hostRenderer = rendererFactory.createRenderer(null, this.componentDef); const elementName = this.componentDef.selectors[0][0] || "div"; const hostRNode = rootSelectorOrNode ? locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation, rootViewInjector) : createElementNode(hostRenderer, elementName, getNamespace(elementName)); let rootFlags = 512; if (this.componentDef.signals) { rootFlags |= 4096; } else if (!this.componentDef.onPush) { rootFlags |= 16; } let hydrationInfo = null; if (hostRNode !== null) { hydrationInfo = retrieveHydrationInfo( hostRNode, rootViewInjector, true /* isRootView */ ); } const rootTView = createTView(0, null, null, 1, 0, null, null, null, null, null, null); const rootLView = createLView(null, rootTView, null, rootFlags, null, null, environment, hostRenderer, rootViewInjector, null, hydrationInfo); enterView(rootLView); let component; let tElementNode; let componentView = null; try { const rootComponentDef = this.componentDef; let rootDirectives; let hostDirectiveDefs = null; if (rootComponentDef.findHostDirectiveDefs) { rootDirectives = []; hostDirectiveDefs = /* @__PURE__ */ new Map(); rootComponentDef.findHostDirectiveDefs(rootComponentDef, rootDirectives, hostDirectiveDefs); rootDirectives.push(rootComponentDef); ngDevMode && assertNoDuplicateDirectives(rootDirectives); } else { rootDirectives = [rootComponentDef]; } const hostTNode = createRootComponentTNode(rootLView, hostRNode); componentView = createRootComponentView(hostTNode, hostRNode, rootComponentDef, rootDirectives, rootLView, environment, hostRenderer); tElementNode = getTNode(rootTView, HEADER_OFFSET); if (hostRNode) { setRootNodeAttributes(hostRenderer, rootComponentDef, hostRNode, rootSelectorOrNode); } if (projectableNodes !== void 0) { projectNodes(tElementNode, this.ngContentSelectors, projectableNodes); } component = createRootComponent(componentView, rootComponentDef, rootDirectives, hostDirectiveDefs, rootLView, [LifecycleHooksFeature]); renderView(rootTView, rootLView, null); } catch (e) { if (componentView !== null) { unregisterLView(componentView); } unregisterLView(rootLView); throw e; } finally { leaveView(); } return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode); } finally { setActiveConsumer(prevConsumer); } } }; var ComponentRef = class extends ComponentRef$1 { constructor(componentType, instance, location2, _rootLView, _tNode) { super(); this.location = location2; this._rootLView = _rootLView; this._tNode = _tNode; this.previousInputValues = null; this.instance = instance; this.hostView = this.changeDetectorRef = new ViewRef$1( _rootLView, void 0, false /* notifyErrorHandler */ ); this.componentType = componentType; } setInput(name, value) { const inputData = this._tNode.inputs; let dataValue; if (inputData !== null && (dataValue = inputData[name])) { this.previousInputValues ??= /* @__PURE__ */ new Map(); if (this.previousInputValues.has(name) && Object.is(this.previousInputValues.get(name), value)) { return; } const lView = this._rootLView; setInputsForProperty(lView[TVIEW], lView, dataValue, name, value); this.previousInputValues.set(name, value); const childComponentLView = getComponentLViewByIndex(this._tNode.index, lView); markViewDirty( childComponentLView, 1 /* NotificationSource.SetInput */ ); } else { if (ngDevMode) { const cmpNameForError = stringifyForError(this.componentType); let message = `Can't set value of the '${name}' input on the '${cmpNameForError}' component. `; message += `Make sure that the '${name}' property is annotated with @Input() or a mapped @Input('${name}') exists.`; reportUnknownPropertyError(message); } } } get injector() { return new NodeInjector(this._tNode, this._rootLView); } destroy() { this.hostView.destroy(); } onDestroy(callback) { this.hostView.onDestroy(callback); } }; function createRootComponentTNode(lView, rNode) { const tView = lView[TVIEW]; const index = HEADER_OFFSET; ngDevMode && assertIndexInRange(lView, index); lView[index] = rNode; return getOrCreateTNode(tView, index, 2, "#host", null); } function createRootComponentView(tNode, hostRNode, rootComponentDef, rootDirectives, rootView, environment, hostRenderer) { const tView = rootView[TVIEW]; applyRootComponentStyling(rootDirectives, tNode, hostRNode, hostRenderer); let hydrationInfo = null; if (hostRNode !== null) { hydrationInfo = retrieveHydrationInfo(hostRNode, rootView[INJECTOR]); } const viewRenderer = environment.rendererFactory.createRenderer(hostRNode, rootComponentDef); let lViewFlags = 16; if (rootComponentDef.signals) { lViewFlags = 4096; } else if (rootComponentDef.onPush) { lViewFlags = 64; } const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, lViewFlags, rootView[tNode.index], tNode, environment, viewRenderer, null, null, hydrationInfo); if (tView.firstCreatePass) { markAsComponentHost(tView, tNode, rootDirectives.length - 1); } addToViewTree(rootView, componentView); return rootView[tNode.index] = componentView; } function applyRootComponentStyling(rootDirectives, tNode, rNode, hostRenderer) { for (const def of rootDirectives) { tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs); } if (tNode.mergedAttrs !== null) { computeStaticStyling(tNode, tNode.mergedAttrs, true); if (rNode !== null) { setupStaticAttributes(hostRenderer, rNode, tNode); } } } function createRootComponent(componentView, rootComponentDef, rootDirectives, hostDirectiveDefs, rootLView, hostFeatures) { const rootTNode = getCurrentTNode(); ngDevMode && assertDefined(rootTNode, "tNode should have been already created"); const tView = rootLView[TVIEW]; const native = getNativeByTNode(rootTNode, rootLView); initializeDirectives(tView, rootLView, rootTNode, rootDirectives, null, hostDirectiveDefs); for (let i = 0; i < rootDirectives.length; i++) { const directiveIndex = rootTNode.directiveStart + i; const directiveInstance = getNodeInjectable(rootLView, tView, directiveIndex, rootTNode); attachPatchData(directiveInstance, rootLView); } invokeDirectivesHostBindings(tView, rootLView, rootTNode); if (native) { attachPatchData(native, rootLView); } ngDevMode && assertGreaterThan(rootTNode.componentOffset, -1, "componentOffset must be great than -1"); const component = getNodeInjectable(rootLView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode); componentView[CONTEXT] = rootLView[CONTEXT] = component; if (hostFeatures !== null) { for (const feature of hostFeatures) { feature(component, rootComponentDef); } } executeContentQueries(tView, rootTNode, rootLView); return component; } function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) { if (rootSelectorOrNode) { setUpAttributes(hostRenderer, hostRNode, ["ng-version", "18.2.13"]); } else { const { attrs, classes } = extractAttrsAndClassesFromSelector(componentDef.selectors[0]); if (attrs) { setUpAttributes(hostRenderer, hostRNode, attrs); } if (classes && classes.length > 0) { writeDirectClass(hostRenderer, hostRNode, classes.join(" ")); } } } function projectNodes(tNode, ngContentSelectors, projectableNodes) { const projection = tNode.projection = []; for (let i = 0; i < ngContentSelectors.length; i++) { const nodesforSlot = projectableNodes[i]; projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null); } } function LifecycleHooksFeature() { const tNode = getCurrentTNode(); ngDevMode && assertDefined(tNode, "TNode is required"); registerPostOrderHooks(getLView()[TVIEW], tNode); } var ViewContainerRef = class { static { this.__NG_ELEMENT_ID__ = injectViewContainerRef; } }; function injectViewContainerRef() { const previousTNode = getCurrentTNode(); return createContainerRef(previousTNode, getLView()); } var VE_ViewContainerRef = ViewContainerRef; var R3ViewContainerRef = class ViewContainerRef2 extends VE_ViewContainerRef { constructor(_lContainer, _hostTNode, _hostLView) { super(); this._lContainer = _lContainer; this._hostTNode = _hostTNode; this._hostLView = _hostLView; } get element() { return createElementRef(this._hostTNode, this._hostLView); } get injector() { return new NodeInjector(this._hostTNode, this._hostLView); } /** @deprecated No replacement */ get parentInjector() { const parentLocation = getParentInjectorLocation(this._hostTNode, this._hostLView); if (hasParentInjector(parentLocation)) { const parentView = getParentInjectorView(parentLocation, this._hostLView); const injectorIndex = getParentInjectorIndex(parentLocation); ngDevMode && assertNodeInjector(parentView, injectorIndex); const parentTNode = parentView[TVIEW].data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ]; return new NodeInjector(parentTNode, parentView); } else { return new NodeInjector(null, this._hostLView); } } clear() { while (this.length > 0) { this.remove(this.length - 1); } } get(index) { const viewRefs = getViewRefs(this._lContainer); return viewRefs !== null && viewRefs[index] || null; } get length() { return this._lContainer.length - CONTAINER_HEADER_OFFSET; } createEmbeddedView(templateRef, context2, indexOrOptions) { let index; let injector; if (typeof indexOrOptions === "number") { index = indexOrOptions; } else if (indexOrOptions != null) { index = indexOrOptions.index; injector = indexOrOptions.injector; } const dehydratedView = findMatchingDehydratedView(this._lContainer, templateRef.ssrId); const viewRef = templateRef.createEmbeddedViewImpl(context2 || {}, injector, dehydratedView); this.insertImpl(viewRef, index, shouldAddViewToDom(this._hostTNode, dehydratedView)); return viewRef; } createComponent(componentFactoryOrType, indexOrOptions, injector, projectableNodes, environmentInjector) { const isComponentFactory = componentFactoryOrType && !isType(componentFactoryOrType); let index; if (isComponentFactory) { if (ngDevMode) { assertEqual(typeof indexOrOptions !== "object", true, "It looks like Component factory was provided as the first argument and an options object as the second argument. This combination of arguments is incompatible. You can either change the first argument to provide Component type or change the second argument to be a number (representing an index at which to insert the new component's host view into this container)"); } index = indexOrOptions; } else { if (ngDevMode) { assertDefined(getComponentDef(componentFactoryOrType), `Provided Component class doesn't contain Component definition. Please check whether provided class has @Component decorator.`); assertEqual(typeof indexOrOptions !== "number", true, "It looks like Component type was provided as the first argument and a number (representing an index at which to insert the new component's host view into this container as the second argument. This combination of arguments is incompatible. Please use an object as the second argument instead."); } const options = indexOrOptions || {}; if (ngDevMode && options.environmentInjector && options.ngModuleRef) { throwError(`Cannot pass both environmentInjector and ngModuleRef options to createComponent().`); } index = options.index; injector = options.injector; projectableNodes = options.projectableNodes; environmentInjector = options.environmentInjector || options.ngModuleRef; } const componentFactory = isComponentFactory ? componentFactoryOrType : new ComponentFactory(getComponentDef(componentFactoryOrType)); const contextInjector = injector || this.parentInjector; if (!environmentInjector && componentFactory.ngModule == null) { const _injector = isComponentFactory ? contextInjector : this.parentInjector; const result = _injector.get(EnvironmentInjector, null); if (result) { environmentInjector = result; } } const componentDef = getComponentDef(componentFactory.componentType ?? {}); const dehydratedView = findMatchingDehydratedView(this._lContainer, componentDef?.id ?? null); const rNode = dehydratedView?.firstChild ?? null; const componentRef = componentFactory.create(contextInjector, projectableNodes, rNode, environmentInjector); this.insertImpl(componentRef.hostView, index, shouldAddViewToDom(this._hostTNode, dehydratedView)); return componentRef; } insert(viewRef, index) { return this.insertImpl(viewRef, index, true); } insertImpl(viewRef, index, addToDOM) { const lView = viewRef._lView; if (ngDevMode && viewRef.destroyed) { throw new Error("Cannot insert a destroyed View in a ViewContainer!"); } if (viewAttachedToContainer(lView)) { const prevIdx = this.indexOf(viewRef); if (prevIdx !== -1) { this.detach(prevIdx); } else { const prevLContainer = lView[PARENT]; ngDevMode && assertEqual(isLContainer(prevLContainer), true, "An attached view should have its PARENT point to a container."); const prevVCRef = new R3ViewContainerRef(prevLContainer, prevLContainer[T_HOST], prevLContainer[PARENT]); prevVCRef.detach(prevVCRef.indexOf(viewRef)); } } const adjustedIdx = this._adjustIndex(index); const lContainer = this._lContainer; addLViewToLContainer(lContainer, lView, adjustedIdx, addToDOM); viewRef.attachToViewContainerRef(); addToArray(getOrCreateViewRefs(lContainer), adjustedIdx, viewRef); return viewRef; } move(viewRef, newIndex) { if (ngDevMode && viewRef.destroyed) { throw new Error("Cannot move a destroyed View in a ViewContainer!"); } return this.insert(viewRef, newIndex); } indexOf(viewRef) { const viewRefsArr = getViewRefs(this._lContainer); return viewRefsArr !== null ? viewRefsArr.indexOf(viewRef) : -1; } remove(index) { const adjustedIdx = this._adjustIndex(index, -1); const detachedView = detachView(this._lContainer, adjustedIdx); if (detachedView) { removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx); destroyLView(detachedView[TVIEW], detachedView); } } detach(index) { const adjustedIdx = this._adjustIndex(index, -1); const view = detachView(this._lContainer, adjustedIdx); const wasDetached = view && removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx) != null; return wasDetached ? new ViewRef$1(view) : null; } _adjustIndex(index, shift = 0) { if (index == null) { return this.length + shift; } if (ngDevMode) { assertGreaterThan(index, -1, `ViewRef index must be positive, got ${index}`); assertLessThan(index, this.length + 1 + shift, "index"); } return index; } }; function getViewRefs(lContainer) { return lContainer[VIEW_REFS]; } function getOrCreateViewRefs(lContainer) { return lContainer[VIEW_REFS] || (lContainer[VIEW_REFS] = []); } function createContainerRef(hostTNode, hostLView) { ngDevMode && assertTNodeType( hostTNode, 12 | 3 /* TNodeType.AnyRNode */ ); let lContainer; const slotValue = hostLView[hostTNode.index]; if (isLContainer(slotValue)) { lContainer = slotValue; } else { lContainer = createLContainer(slotValue, hostLView, null, hostTNode); hostLView[hostTNode.index] = lContainer; addToViewTree(hostLView, lContainer); } _locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue); return new R3ViewContainerRef(lContainer, hostTNode, hostLView); } function insertAnchorNode(hostLView, hostTNode) { const renderer = hostLView[RENDERER]; ngDevMode && ngDevMode.rendererCreateComment++; const commentNode = renderer.createComment(ngDevMode ? "container" : ""); const hostNative = getNativeByTNode(hostTNode, hostLView); const parentOfHostNative = nativeParentNode(renderer, hostNative); nativeInsertBefore(renderer, parentOfHostNative, commentNode, nativeNextSibling(renderer, hostNative), false); return commentNode; } var _locateOrCreateAnchorNode = createAnchorNode; var _populateDehydratedViewsInLContainer = () => false; function populateDehydratedViewsInLContainer(lContainer, tNode, hostLView) { return _populateDehydratedViewsInLContainer(lContainer, tNode, hostLView); } function createAnchorNode(lContainer, hostLView, hostTNode, slotValue) { if (lContainer[NATIVE]) return; let commentNode; if (hostTNode.type & 8) { commentNode = unwrapRNode(slotValue); } else { commentNode = insertAnchorNode(hostLView, hostTNode); } lContainer[NATIVE] = commentNode; } var LQuery_ = class _LQuery_ { constructor(queryList) { this.queryList = queryList; this.matches = null; } clone() { return new _LQuery_(this.queryList); } setDirty() { this.queryList.setDirty(); } }; var LQueries_ = class _LQueries_ { constructor(queries = []) { this.queries = queries; } createEmbeddedView(tView) { const tQueries = tView.queries; if (tQueries !== null) { const noOfInheritedQueries = tView.contentQueries !== null ? tView.contentQueries[0] : tQueries.length; const viewLQueries = []; for (let i = 0; i < noOfInheritedQueries; i++) { const tQuery = tQueries.getByIndex(i); const parentLQuery = this.queries[tQuery.indexInDeclarationView]; viewLQueries.push(parentLQuery.clone()); } return new _LQueries_(viewLQueries); } return null; } insertView(tView) { this.dirtyQueriesWithMatches(tView); } detachView(tView) { this.dirtyQueriesWithMatches(tView); } finishViewCreation(tView) { this.dirtyQueriesWithMatches(tView); } dirtyQueriesWithMatches(tView) { for (let i = 0; i < this.queries.length; i++) { if (getTQuery(tView, i).matches !== null) { this.queries[i].setDirty(); } } } }; var TQueryMetadata_ = class { constructor(predicate, flags, read = null) { this.flags = flags; this.read = read; if (typeof predicate === "string") { this.predicate = splitQueryMultiSelectors(predicate); } else { this.predicate = predicate; } } }; var TQueries_ = class _TQueries_ { constructor(queries = []) { this.queries = queries; } elementStart(tView, tNode) { ngDevMode && assertFirstCreatePass(tView, "Queries should collect results on the first template pass only"); for (let i = 0; i < this.queries.length; i++) { this.queries[i].elementStart(tView, tNode); } } elementEnd(tNode) { for (let i = 0; i < this.queries.length; i++) { this.queries[i].elementEnd(tNode); } } embeddedTView(tNode) { let queriesForTemplateRef = null; for (let i = 0; i < this.length; i++) { const childQueryIndex = queriesForTemplateRef !== null ? queriesForTemplateRef.length : 0; const tqueryClone = this.getByIndex(i).embeddedTView(tNode, childQueryIndex); if (tqueryClone) { tqueryClone.indexInDeclarationView = i; if (queriesForTemplateRef !== null) { queriesForTemplateRef.push(tqueryClone); } else { queriesForTemplateRef = [tqueryClone]; } } } return queriesForTemplateRef !== null ? new _TQueries_(queriesForTemplateRef) : null; } template(tView, tNode) { ngDevMode && assertFirstCreatePass(tView, "Queries should collect results on the first template pass only"); for (let i = 0; i < this.queries.length; i++) { this.queries[i].template(tView, tNode); } } getByIndex(index) { ngDevMode && assertIndexInRange(this.queries, index); return this.queries[index]; } get length() { return this.queries.length; } track(tquery) { this.queries.push(tquery); } }; var TQuery_ = class _TQuery_ { constructor(metadata, nodeIndex = -1) { this.metadata = metadata; this.matches = null; this.indexInDeclarationView = -1; this.crossesNgTemplate = false; this._appliesToNextNode = true; this._declarationNodeIndex = nodeIndex; } elementStart(tView, tNode) { if (this.isApplyingToNode(tNode)) { this.matchTNode(tView, tNode); } } elementEnd(tNode) { if (this._declarationNodeIndex === tNode.index) { this._appliesToNextNode = false; } } template(tView, tNode) { this.elementStart(tView, tNode); } embeddedTView(tNode, childQueryIndex) { if (this.isApplyingToNode(tNode)) { this.crossesNgTemplate = true; this.addMatch(-tNode.index, childQueryIndex); return new _TQuery_(this.metadata); } return null; } isApplyingToNode(tNode) { if (this._appliesToNextNode && (this.metadata.flags & 1) !== 1) { const declarationNodeIdx = this._declarationNodeIndex; let parent = tNode.parent; while (parent !== null && parent.type & 8 && parent.index !== declarationNodeIdx) { parent = parent.parent; } return declarationNodeIdx === (parent !== null ? parent.index : -1); } return this._appliesToNextNode; } matchTNode(tView, tNode) { const predicate = this.metadata.predicate; if (Array.isArray(predicate)) { for (let i = 0; i < predicate.length; i++) { const name = predicate[i]; this.matchTNodeWithReadOption(tView, tNode, getIdxOfMatchingSelector(tNode, name)); this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, name, false, false)); } } else { if (predicate === TemplateRef) { if (tNode.type & 4) { this.matchTNodeWithReadOption(tView, tNode, -1); } } else { this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, predicate, false, false)); } } } matchTNodeWithReadOption(tView, tNode, nodeMatchIdx) { if (nodeMatchIdx !== null) { const read = this.metadata.read; if (read !== null) { if (read === ElementRef || read === ViewContainerRef || read === TemplateRef && tNode.type & 4) { this.addMatch(tNode.index, -2); } else { const directiveOrProviderIdx = locateDirectiveOrProvider(tNode, tView, read, false, false); if (directiveOrProviderIdx !== null) { this.addMatch(tNode.index, directiveOrProviderIdx); } } } else { this.addMatch(tNode.index, nodeMatchIdx); } } } addMatch(tNodeIdx, matchIdx) { if (this.matches === null) { this.matches = [tNodeIdx, matchIdx]; } else { this.matches.push(tNodeIdx, matchIdx); } } }; function getIdxOfMatchingSelector(tNode, selector) { const localNames = tNode.localNames; if (localNames !== null) { for (let i = 0; i < localNames.length; i += 2) { if (localNames[i] === selector) { return localNames[i + 1]; } } } return null; } function createResultByTNodeType(tNode, currentView) { if (tNode.type & (3 | 8)) { return createElementRef(tNode, currentView); } else if (tNode.type & 4) { return createTemplateRef(tNode, currentView); } return null; } function createResultForNode(lView, tNode, matchingIdx, read) { if (matchingIdx === -1) { return createResultByTNodeType(tNode, lView); } else if (matchingIdx === -2) { return createSpecialToken(lView, tNode, read); } else { return getNodeInjectable(lView, lView[TVIEW], matchingIdx, tNode); } } function createSpecialToken(lView, tNode, read) { if (read === ElementRef) { return createElementRef(tNode, lView); } else if (read === TemplateRef) { return createTemplateRef(tNode, lView); } else if (read === ViewContainerRef) { ngDevMode && assertTNodeType( tNode, 3 | 12 /* TNodeType.AnyContainer */ ); return createContainerRef(tNode, lView); } else { ngDevMode && throwError(`Special token to read should be one of ElementRef, TemplateRef or ViewContainerRef but got ${stringify(read)}.`); } } function materializeViewResults(tView, lView, tQuery, queryIndex) { const lQuery = lView[QUERIES].queries[queryIndex]; if (lQuery.matches === null) { const tViewData = tView.data; const tQueryMatches = tQuery.matches; const result = []; for (let i = 0; tQueryMatches !== null && i < tQueryMatches.length; i += 2) { const matchedNodeIdx = tQueryMatches[i]; if (matchedNodeIdx < 0) { result.push(null); } else { ngDevMode && assertIndexInRange(tViewData, matchedNodeIdx); const tNode = tViewData[matchedNodeIdx]; result.push(createResultForNode(lView, tNode, tQueryMatches[i + 1], tQuery.metadata.read)); } } lQuery.matches = result; } return lQuery.matches; } function collectQueryResults(tView, lView, queryIndex, result) { const tQuery = tView.queries.getByIndex(queryIndex); const tQueryMatches = tQuery.matches; if (tQueryMatches !== null) { const lViewResults = materializeViewResults(tView, lView, tQuery, queryIndex); for (let i = 0; i < tQueryMatches.length; i += 2) { const tNodeIdx = tQueryMatches[i]; if (tNodeIdx > 0) { result.push(lViewResults[i / 2]); } else { const childQueryIndex = tQueryMatches[i + 1]; const declarationLContainer = lView[-tNodeIdx]; ngDevMode && assertLContainer(declarationLContainer); for (let i2 = CONTAINER_HEADER_OFFSET; i2 < declarationLContainer.length; i2++) { const embeddedLView = declarationLContainer[i2]; if (embeddedLView[DECLARATION_LCONTAINER] === embeddedLView[PARENT]) { collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result); } } if (declarationLContainer[MOVED_VIEWS] !== null) { const embeddedLViews = declarationLContainer[MOVED_VIEWS]; for (let i2 = 0; i2 < embeddedLViews.length; i2++) { const embeddedLView = embeddedLViews[i2]; collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result); } } } } } return result; } function loadQueryInternal(lView, queryIndex) { ngDevMode && assertDefined(lView[QUERIES], "LQueries should be defined when trying to load a query"); ngDevMode && assertIndexInRange(lView[QUERIES].queries, queryIndex); return lView[QUERIES].queries[queryIndex].queryList; } function createLQuery(tView, lView, flags) { const queryList = new QueryList( (flags & 4) === 4 /* QueryFlags.emitDistinctChangesOnly */ ); storeCleanupWithContext(tView, lView, queryList, queryList.destroy); const lQueries = (lView[QUERIES] ??= new LQueries_()).queries; return lQueries.push(new LQuery_(queryList)) - 1; } function createViewQuery(predicate, flags, read) { ngDevMode && assertNumber(flags, "Expecting flags"); const tView = getTView(); if (tView.firstCreatePass) { createTQuery(tView, new TQueryMetadata_(predicate, flags, read), -1); if ((flags & 2) === 2) { tView.staticViewQueries = true; } } return createLQuery(tView, getLView(), flags); } function createContentQuery(directiveIndex, predicate, flags, read) { ngDevMode && assertNumber(flags, "Expecting flags"); const tView = getTView(); if (tView.firstCreatePass) { const tNode = getCurrentTNode(); createTQuery(tView, new TQueryMetadata_(predicate, flags, read), tNode.index); saveContentQueryAndDirectiveIndex(tView, directiveIndex); if ((flags & 2) === 2) { tView.staticContentQueries = true; } } return createLQuery(tView, getLView(), flags); } function splitQueryMultiSelectors(locator) { return locator.split(",").map((s) => s.trim()); } function createTQuery(tView, metadata, nodeIndex) { if (tView.queries === null) tView.queries = new TQueries_(); tView.queries.track(new TQuery_(metadata, nodeIndex)); } function saveContentQueryAndDirectiveIndex(tView, directiveIndex) { const tViewContentQueries = tView.contentQueries || (tView.contentQueries = []); const lastSavedDirectiveIndex = tViewContentQueries.length ? tViewContentQueries[tViewContentQueries.length - 1] : -1; if (directiveIndex !== lastSavedDirectiveIndex) { tViewContentQueries.push(tView.queries.length - 1, directiveIndex); } } function getTQuery(tView, index) { ngDevMode && assertDefined(tView.queries, "TQueries must be defined to retrieve a TQuery"); return tView.queries.getByIndex(index); } function getQueryResults(lView, queryIndex) { const tView = lView[TVIEW]; const tQuery = getTQuery(tView, queryIndex); return tQuery.crossesNgTemplate ? collectQueryResults(tView, lView, queryIndex, []) : materializeViewResults(tView, lView, tQuery, queryIndex); } var markedFeatures = /* @__PURE__ */ new Set(); function performanceMarkFeature(feature) { if (markedFeatures.has(feature)) { return; } markedFeatures.add(feature); performance?.mark?.("mark_feature_usage", { detail: { feature } }); } function isSignal(value) { return typeof value === "function" && value[SIGNAL] !== void 0; } function signal(initialValue, options) { performanceMarkFeature("NgSignals"); const signalFn = createSignal(initialValue); const node = signalFn[SIGNAL]; if (options?.equal) { node.equal = options.equal; } signalFn.set = (newValue) => signalSetFn(node, newValue); signalFn.update = (updateFn) => signalUpdateFn(node, updateFn); signalFn.asReadonly = signalAsReadonlyFn.bind(signalFn); if (ngDevMode) { signalFn.toString = () => `[Signal: ${signalFn()}]`; } return signalFn; } function signalAsReadonlyFn() { const node = this[SIGNAL]; if (node.readonlyFn === void 0) { const readonlyFn = () => this(); readonlyFn[SIGNAL] = node; node.readonlyFn = readonlyFn; } return node.readonlyFn; } function isWritableSignal(value) { return isSignal(value) && typeof value.set === "function"; } function createQuerySignalFn(firstOnly, required) { let node; const signalFn = createComputed(() => { node._dirtyCounter(); const value = refreshSignalQuery(node, firstOnly); if (required && value === void 0) { throw new RuntimeError(-951, ngDevMode && "Child query result is required but no value is available."); } return value; }); node = signalFn[SIGNAL]; node._dirtyCounter = signal(0); node._flatValue = void 0; if (ngDevMode) { signalFn.toString = () => `[Query Signal]`; } return signalFn; } function createSingleResultOptionalQuerySignalFn() { return createQuerySignalFn( /* firstOnly */ true, /* required */ false ); } function createSingleResultRequiredQuerySignalFn() { return createQuerySignalFn( /* firstOnly */ true, /* required */ true ); } function createMultiResultQuerySignalFn() { return createQuerySignalFn( /* firstOnly */ false, /* required */ false ); } function bindQueryToSignal(target, queryIndex) { const node = target[SIGNAL]; node._lView = getLView(); node._queryIndex = queryIndex; node._queryList = loadQueryInternal(node._lView, queryIndex); node._queryList.onDirty(() => node._dirtyCounter.update((v) => v + 1)); } function refreshSignalQuery(node, firstOnly) { const lView = node._lView; const queryIndex = node._queryIndex; if (lView === void 0 || queryIndex === void 0 || lView[FLAGS] & 4) { return firstOnly ? void 0 : EMPTY_ARRAY; } const queryList = loadQueryInternal(lView, queryIndex); const results = getQueryResults(lView, queryIndex); queryList.reset(results, unwrapElementRef); if (firstOnly) { return queryList.first; } else { const resultChanged = queryList._changesDetected; if (resultChanged || node._flatValue === void 0) { return node._flatValue = queryList.toArray(); } return node._flatValue; } } function viewChildFn(locator, opts) { ngDevMode && assertInInjectionContext(viewChild); return createSingleResultOptionalQuerySignalFn(); } function viewChildRequiredFn(locator, opts) { ngDevMode && assertInInjectionContext(viewChild); return createSingleResultRequiredQuerySignalFn(); } var viewChild = (() => { viewChildFn.required = viewChildRequiredFn; return viewChildFn; })(); function contentChildFn(locator, opts) { ngDevMode && assertInInjectionContext(contentChild); return createSingleResultOptionalQuerySignalFn(); } function contentChildRequiredFn(locator, opts) { ngDevMode && assertInInjectionContext(contentChildren); return createSingleResultRequiredQuerySignalFn(); } var contentChild = (() => { contentChildFn.required = contentChildRequiredFn; return contentChildFn; })(); function contentChildren(locator, opts) { return createMultiResultQuerySignalFn(); } function createModelSignal(initialValue) { const node = Object.create(INPUT_SIGNAL_NODE); const emitterRef = new OutputEmitterRef(); node.value = initialValue; function getter() { producerAccessed(node); assertModelSet(node.value); return node.value; } getter[SIGNAL] = node; getter.asReadonly = signalAsReadonlyFn.bind(getter); getter.set = (newValue) => { if (!node.equal(node.value, newValue)) { signalSetFn(node, newValue); emitterRef.emit(newValue); } }; getter.update = (updateFn) => { assertModelSet(node.value); getter.set(updateFn(node.value)); }; getter.subscribe = emitterRef.subscribe.bind(emitterRef); getter.destroyRef = emitterRef.destroyRef; if (ngDevMode) { getter.toString = () => `[Model Signal: ${getter()}]`; } return getter; } function assertModelSet(value) { if (value === REQUIRED_UNSET_VALUE) { throw new RuntimeError(952, ngDevMode && "Model is required but no value is available yet."); } } function modelFunction(initialValue) { ngDevMode && assertInInjectionContext(model); return createModelSignal(initialValue); } function modelRequiredFunction() { ngDevMode && assertInInjectionContext(model); return createModelSignal(REQUIRED_UNSET_VALUE); } var model = (() => { modelFunction.required = modelRequiredFunction; return modelFunction; })(); var emitDistinctChangesOnlyDefaultValue = true; var Query = class { }; var ContentChildren = makePropDecorator("ContentChildren", (selector, opts = {}) => __spreadValues({ selector, first: false, isViewQuery: false, descendants: false, emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue }, opts), Query); var ContentChild = makePropDecorator("ContentChild", (selector, opts = {}) => __spreadValues({ selector, first: true, isViewQuery: false, descendants: true }, opts), Query); var ViewChildren = makePropDecorator("ViewChildren", (selector, opts = {}) => __spreadValues({ selector, first: false, isViewQuery: true, descendants: true, emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue }, opts), Query); var ViewChild = makePropDecorator("ViewChild", (selector, opts) => __spreadValues({ selector, first: true, isViewQuery: true, descendants: true }, opts), Query); function resolveComponentResources(resourceResolver) { const componentResolved = []; const urlMap = /* @__PURE__ */ new Map(); function cachedResourceResolve(url) { let promise = urlMap.get(url); if (!promise) { const resp = resourceResolver(url); urlMap.set(url, promise = resp.then(unwrapResponse)); } return promise; } componentResourceResolutionQueue.forEach((component, type) => { const promises = []; if (component.templateUrl) { promises.push(cachedResourceResolve(component.templateUrl).then((template) => { component.template = template; })); } const styles = typeof component.styles === "string" ? [component.styles] : component.styles || []; component.styles = styles; if (component.styleUrl && component.styleUrls?.length) { throw new Error("@Component cannot define both `styleUrl` and `styleUrls`. Use `styleUrl` if the component has one stylesheet, or `styleUrls` if it has multiple"); } else if (component.styleUrls?.length) { const styleOffset = component.styles.length; const styleUrls = component.styleUrls; component.styleUrls.forEach((styleUrl, index) => { styles.push(""); promises.push(cachedResourceResolve(styleUrl).then((style) => { styles[styleOffset + index] = style; styleUrls.splice(styleUrls.indexOf(styleUrl), 1); if (styleUrls.length == 0) { component.styleUrls = void 0; } })); }); } else if (component.styleUrl) { promises.push(cachedResourceResolve(component.styleUrl).then((style) => { styles.push(style); component.styleUrl = void 0; })); } const fullyResolved = Promise.all(promises).then(() => componentDefResolved(type)); componentResolved.push(fullyResolved); }); clearResolutionOfComponentResourcesQueue(); return Promise.all(componentResolved).then(() => void 0); } var componentResourceResolutionQueue = /* @__PURE__ */ new Map(); var componentDefPendingResolution = /* @__PURE__ */ new Set(); function maybeQueueResolutionOfComponentResources(type, metadata) { if (componentNeedsResolution(metadata)) { componentResourceResolutionQueue.set(type, metadata); componentDefPendingResolution.add(type); } } function componentNeedsResolution(component) { return !!(component.templateUrl && !component.hasOwnProperty("template") || component.styleUrls && component.styleUrls.length || component.styleUrl); } function clearResolutionOfComponentResourcesQueue() { const old = componentResourceResolutionQueue; componentResourceResolutionQueue = /* @__PURE__ */ new Map(); return old; } function isComponentResourceResolutionQueueEmpty() { return componentResourceResolutionQueue.size === 0; } function unwrapResponse(response) { return typeof response == "string" ? response : response.text(); } function componentDefResolved(type) { componentDefPendingResolution.delete(type); } var modules = /* @__PURE__ */ new Map(); var checkForDuplicateNgModules = true; function assertSameOrNotExisting(id, type, incoming) { if (type && type !== incoming && checkForDuplicateNgModules) { throw new Error(`Duplicate module registered for ${id} - ${stringify(type)} vs ${stringify(type.name)}`); } } function registerNgModuleType(ngModuleType, id) { const existing = modules.get(id) || null; assertSameOrNotExisting(id, existing, ngModuleType); modules.set(id, ngModuleType); } function \u0275\u0275validateIframeAttribute(attrValue, tagName, attrName) { const lView = getLView(); const tNode = getSelectedTNode(); const element = getNativeByTNode(tNode, lView); if (tNode.type === 2 && tagName.toLowerCase() === "iframe") { const iframe = element; iframe.src = ""; iframe.srcdoc = trustedHTMLFromString(""); nativeRemoveNode(lView[RENDERER], iframe); const errorMessage = ngDevMode && `Angular has detected that the \`${attrName}\` was applied as a binding to an