1import{Wa as b,a as l,da as f,g as i,ja as d,k as a,n as p,qa as D,v as c}from"./chunk-QZGI63L7.js";var P=D;function S(e){return!!e[P]}var w=Symbol("__destroy"),g=Symbol("__decoratorApplied");function v(e){return typeof e=="string"?Symbol(`__destroy__${e}`):w}function x(e){e.prototype[g]=!0}function O(e,t){e[t]||(e[t]=new i)}function _(e,t){e[t]&&(e[t].next(),e[t].complete(),e[t]=null)}function C(e){e instanceof l&&e.unsubscribe()}function j(e){Array.isArray(e)&&e.forEach(C)}function E(e,t){return function(){if(e&&e.call(this),_(this,v()),t.arrayName&&j(this[t.arrayName]),t.checkProperties)for(let o in this)t.blackList?.includes(o)||C(this[o])}}function k(e,t){e.prototype.ngOnDestroy=E(e.prototype.ngOnDestroy,t)}function A(e,t){let o=e.\u0275pipe;o.onDestroy=E(o.onDestroy,t)}function G(e={}){return t=>{S(t)?A(t,e):k(t,e),x(t)}}var m=7,y=Symbol("CheckerHasBeenSet");function B(e,t){e[y]||I()||(h(()=>p(Promise.resolve()).pipe(c(()=>{let o;try{o=b(e)}catch{o=null}let n=o?.lView;if(n==null)return a;let r=n[m]||(n[m]=[]),s=new i;return r.push(function(){h(()=>{s.next(),s.complete()})}),s}),c(()=>Promise.resolve())).subscribe(()=>{(t.observed??t.observers.length>0)&&console.warn(T(e))})),e[y]=!0)}function I(){return typeof __karma__<"u"&&!!__karma__||typeof jasmine<"u"&&!!jasmine||typeof jest<"u"&&!!jest||typeof Mocha<"u"&&!!Mocha||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"}function h(e){let t=d.Zone;return!!t&&typeof t.root?.run=="function"?t.root.run(e):e()}function T(e){return` 2 The ${e.constructor.name} still has subscriptions that haven't been unsubscribed. 3 This may happen if the class extends another class decorated with @UntilDestroy(). 4 The child class implements its own ngOnDestroy() method but doesn't call super.ngOnDestroy(). 5 Let's look at the following example: 6 @UntilDestroy() 7 @Directive() 8 export abstract class BaseDirective {} 9 @Component({ template: '' }) 10 export class ConcreteComponent extends BaseDirective implements OnDestroy { 11 constructor() { 12 super(); 13 someObservable$.pipe(untilDestroyed(this)).subscribe(); 14 } 15 ngOnDestroy(): void { 16 // Some logic here... 17 } 18 } 19 The BaseDirective.ngOnDestroy() will not be called since Angular will call ngOnDestroy() 20 on the ConcreteComponent, but not on the BaseDirective. 21 One of the solutions is to declare an empty ngOnDestroy method on the BaseDirective: 22 @UntilDestroy() 23 @Directive() 24 export abstract class BaseDirective { 25 ngOnDestroy(): void {} 26 } 27 @Component({ template: '' }) 28 export class ConcreteComponent extends BaseDirective implements OnDestroy { 29 constructor() { 30 super(); 31 someObservable$.pipe(untilDestroyed(this)).subscribe(); 32 } 33 ngOnDestroy(): void { 34 // Some logic here... 35 super.ngOnDestroy(); 36 } 37 } 38 `}var u=!1;function U(e,t,o){let n=e[t];if(u&&typeof n!="function")throw new Error(`${e.constructor.name} is using untilDestroyed but doesn't implement ${t}`);O(e,o),e[t]=function(){n.apply(this,arguments),_(this,o),e[t]=n}}function H(e,t){return o=>{let n=v(t);typeof t=="string"?U(e,t,n):(u&&L(e),O(e,n));let r=e[n];return u&&B(e,r),o.pipe(f(r))}}function L(e){let t=Object.getPrototypeOf(e);if(!(g in t))throw new Error("untilDestroyed operator cannot be used inside directives or components or providers that are not decorated with UntilDestroy decorator")}export{G as a,H as b};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.