{"version":3,"file":"_dispose-view-repeater-strategy-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/cdk/collections/dispose-view-repeater-strategy.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n  EmbeddedViewRef,\n  IterableChangeRecord,\n  IterableChanges,\n  ViewContainerRef,\n} from '@angular/core';\nimport {\n  _ViewRepeater,\n  _ViewRepeaterItemChanged,\n  _ViewRepeaterItemContext,\n  _ViewRepeaterItemContextFactory,\n  _ViewRepeaterItemValueResolver,\n  _ViewRepeaterOperation,\n} from './view-repeater';\n\n/**\n * A repeater that destroys views when they are removed from a\n * `ViewContainerRef`. When new items are inserted into the container,\n * the repeater will always construct a new embedded view for each item.\n *\n * @template T The type for the embedded view's $implicit property.\n * @template R The type for the item in each IterableDiffer change record.\n * @template C The type for the context passed to each embedded view.\n */\nexport class _DisposeViewRepeaterStrategy<\n  T,\n  R,\n  C extends _ViewRepeaterItemContext<T>,\n> implements _ViewRepeater<T, R, C> {\n  applyChanges(\n    changes: IterableChanges<R>,\n    viewContainerRef: ViewContainerRef,\n    itemContextFactory: _ViewRepeaterItemContextFactory<T, R, C>,\n    itemValueResolver: _ViewRepeaterItemValueResolver<T, R>,\n    itemViewChanged?: _ViewRepeaterItemChanged<R, C>,\n  ) {\n    changes.forEachOperation(\n      (\n        record: IterableChangeRecord<R>,\n        adjustedPreviousIndex: number | null,\n        currentIndex: number | null,\n      ) => {\n        let view: EmbeddedViewRef<C> | undefined;\n        let operation: _ViewRepeaterOperation;\n        if (record.previousIndex == null) {\n          const insertContext = itemContextFactory(record, adjustedPreviousIndex, currentIndex);\n          view = viewContainerRef.createEmbeddedView(\n            insertContext.templateRef,\n            insertContext.context,\n            insertContext.index,\n          );\n          operation = _ViewRepeaterOperation.INSERTED;\n        } else if (currentIndex == null) {\n          viewContainerRef.remove(adjustedPreviousIndex!);\n          operation = _ViewRepeaterOperation.REMOVED;\n        } else {\n          view = viewContainerRef.get(adjustedPreviousIndex!) as EmbeddedViewRef<C>;\n          viewContainerRef.move(view!, currentIndex);\n          operation = _ViewRepeaterOperation.MOVED;\n        }\n\n        if (itemViewChanged) {\n          itemViewChanged({\n            context: view?.context,\n            operation,\n            record,\n          });\n        }\n      },\n    );\n  }\n\n  detach() {}\n}\n"],"names":["_DisposeViewRepeaterStrategy","applyChanges","changes","viewContainerRef","itemContextFactory","itemValueResolver","itemViewChanged","forEachOperation","record","adjustedPreviousIndex","currentIndex","view","operation","previousIndex","insertContext","createEmbeddedView","templateRef","context","index","_ViewRepeaterOperation","INSERTED","remove","REMOVED","get","move","MOVED","detach"],"mappings":";;MAgCaA,4BAA4B,CAAA;EAKvCC,YAAYA,CACVC,OAA2B,EAC3BC,gBAAkC,EAClCC,kBAA4D,EAC5DC,iBAAuD,EACvDC,eAAgD,EAAA;IAEhDJ,OAAO,CAACK,gBAAgB,CACtB,CACEC,MAA+B,EAC/BC,qBAAoC,EACpCC,YAA2B,KACzB;AACF,MAAA,IAAIC,IAAoC;AACxC,MAAA,IAAIC,SAAiC;AACrC,MAAA,IAAIJ,MAAM,CAACK,aAAa,IAAI,IAAI,EAAE;QAChC,MAAMC,aAAa,GAAGV,kBAAkB,CAACI,MAAM,EAAEC,qBAAqB,EAAEC,YAAY,CAAC;AACrFC,QAAAA,IAAI,GAAGR,gBAAgB,CAACY,kBAAkB,CACxCD,aAAa,CAACE,WAAW,EACzBF,aAAa,CAACG,OAAO,EACrBH,aAAa,CAACI,KAAK,CACpB;QACDN,SAAS,GAAGO,sBAAsB,CAACC,QAAQ;AAC7C,MAAA,CAAA,MAAO,IAAIV,YAAY,IAAI,IAAI,EAAE;AAC/BP,QAAAA,gBAAgB,CAACkB,MAAM,CAACZ,qBAAsB,CAAC;QAC/CG,SAAS,GAAGO,sBAAsB,CAACG,OAAO;AAC5C,MAAA,CAAA,MAAO;AACLX,QAAAA,IAAI,GAAGR,gBAAgB,CAACoB,GAAG,CAACd,qBAAsB,CAAuB;AACzEN,QAAAA,gBAAgB,CAACqB,IAAI,CAACb,IAAK,EAAED,YAAY,CAAC;QAC1CE,SAAS,GAAGO,sBAAsB,CAACM,KAAK;AAC1C,MAAA;AAEA,MAAA,IAAInB,eAAe,EAAE;AACnBA,QAAAA,eAAe,CAAC;UACdW,OAAO,EAAEN,IAAI,EAAEM,OAAO;UACtBL,SAAS;AACTJ,UAAAA;AACD,SAAA,CAAC;AACJ,MAAA;AACF,IAAA,CAAC,CACF;AACH,EAAA;EAEAkB,MAAMA,IAAI;AACX;;;;"}