{"version":3,"file":"odx-angular-rxjs.mjs","sources":["../../../../libs/angular/rxjs/src/lib/delay-until.ts","../../../../libs/angular/rxjs/src/lib/from-element-mutation.ts","../../../../libs/angular/rxjs/src/lib/from-element-resize.ts","../../../../libs/angular/rxjs/src/lib/from-events.ts","../../../../libs/angular/rxjs/src/lib/from-query-list.ts","../../../../libs/angular/rxjs/src/odx-angular-rxjs.ts"],"sourcesContent":["import { map, MonoTypeOperatorFunction, Observable, switchMap, takeUntil, timer } from 'rxjs';\n\n/**\n * Delays the emission of each value from the source Observable by a time span determined by the `delay` function.\n * If the `notifier` Observable emits before the delay expires, the delayed emission is cancelled.\n *\n * This operator is useful for postponing the observable emissions until certain conditions are met,\n * represented by the passage of time defined by `delay`. It also allows for a way to preemptively\n * cancel the delay in response to another observable's emission.\n *\n * @template T The type of items emitted by the source Observable.\n * @param {() => number} delay A function that returns the delay (in milliseconds) before the source Observable's values are emitted.\n * @param {Observable<unknown>} notifier An Observable that cancels the delay when it emits.\n * @returns {MonoTypeOperatorFunction<T>} An Observable that emits the source Observable's items with a delay if not cancelled.\n * @example\n * ```ts\n * // Delay each number emission by 1 second, unless the 'cancel' button is clicked.\n * const delayedNumbers$ = of(1, 2, 3).pipe(\n *   delayUntil(() => 1000, fromEvent(cancelButton, 'click'))\n * );\n *\n * delayedNumbers$.subscribe(console.log);\n * ```\n */\nexport function delayUntil<T>(delay: () => number, notifier: Observable<unknown>): MonoTypeOperatorFunction<T> {\n  return (source$: Observable<T>) =>\n    source$.pipe(\n      switchMap((value: T) =>\n        timer(delay()).pipe(\n          map(() => value),\n          takeUntil(notifier),\n        ),\n      ),\n    );\n}\n","import { createMutationObserver } from '@odx/angular/utils';\nimport { Observable } from 'rxjs';\n\n/**\n * Creates an RxJS Observable that emits mutation records for changes in a DOM element's attributes,\n * child list, and subtree. It uses the `MutationObserver` Web API to observe mutations on the specified\n * element according to the options provided.\n *\n * @param {Element} element The DOM element to observe for mutations.\n * @param {MutationObserverInit} options An object that specifies which DOM mutations should be reported.\n * Options include attributes, childList, subtree, attributeOldValue, characterData, characterDataOldValue,\n * and attributeFilter.\n * @returns {Observable<MutationRecord>} An Observable that emits a `MutationRecord` each time a mutation\n * matching the specified options occurs in the observed element.\n * @example\n * ```ts\n * // Observing changes to the child list of an element\n * const element = document.getElementById('my-element');\n * const mutationOptions = { childList: true };\n *\n * fromElementMutation$(element, mutationOptions).subscribe((mutation) => console.log('Mutation detected:', mutation));\n * ```\n * Note: Always remember to unsubscribe from the observable to prevent memory leaks.\n */\nexport function fromElementMutation$(element: Element, options: MutationObserverInit): Observable<MutationRecord> {\n  return new Observable<MutationRecord>((observer) => {\n    const mutationObserver = createMutationObserver(observer, (events) => events.length > 0);\n    observer.add(() => mutationObserver.disconnect());\n    mutationObserver.observe(element, options);\n  });\n}\n","import { createResizeObserver } from '@odx/angular/utils';\nimport { debounceTime, Observable } from 'rxjs';\n\n/**\n * Creates an RxJS Observable that emits an array of `ResizeObserverEntry` objects whenever\n * the target element's size changes. This function provides a reactive way to observe\n * and respond to changes in an element's dimensions, using the `ResizeObserver` Web API.\n *\n * The observable debounces the emitted values to improve performance and reduce the frequency\n * of change detection runs in Angular applications. The debounce time can be adjusted via\n * the `debounceDuration` parameter.\n *\n * @param {Element} element The DOM element to observe for size changes.\n * @param {number} [debounceDuration=50] The time, in milliseconds, to debounce the emitted\n * values. Defaults to 50ms.\n * @returns {Observable<ResizeObserverEntry[]>} An Observable that emits the resize events\n * for the observed element. Each emission is an array of `ResizeObserverEntry` objects, one\n * for each observed element that experienced a resize.\n * @example\n * ```ts\n * // Observing resize events of an element with a 100ms debounce duration\n * const element = document.getElementById('resizable-element');\n * fromElementResize$(element, 100).subscribe((entries) => console.log('Element resized:', entries));\n * ```\n *\n * Always unsubscribe from the observable to clean up resources and prevent memory leaks.\n */\nexport function fromElementResize$(element: Element, debounceDuration = 50): Observable<ResizeObserverEntry[]> {\n  return new Observable<ResizeObserverEntry[]>((observer) => {\n    const resizeObserver = createResizeObserver((events) => {\n      if (events.length > 0) {\n        observer.next(events);\n      }\n    });\n    observer.add(() => resizeObserver.disconnect());\n    resizeObserver.observe(element);\n  }).pipe(debounceTime(debounceDuration));\n}\n","import { fromEvent, merge, Observable } from 'rxjs';\nimport { HasEventTargetAddRemove } from 'rxjs/internal/observable/fromEvent';\n\n/**\n * Creates an Observable that emits events of a specific type from one or multiple event targets.\n * It listens to multiple event types on the given target(s) and emits the events through a single\n * Observable stream, simplifying the handling of related event types.\n *\n * @template T The event object type that the Observable will emit.\n * @param {HasEventTargetAddRemove<T> | HasEventTargetAddRemove<T>[]} target The DOM element(s) or event target(s) to listen on.\n * @param {...string[]} events The names of the events to listen for on the target(s).\n * @returns {Observable<T>} An Observable that emits an event each time one of the specified events occurs on the given target(s).\n *\n * @example\n * ```ts\n * // Listen to both 'click' and 'keyup' events on document\n * fromEvents(document, 'click', 'keyup').subscribe(event => {\n *   console.log('Event occurred:', event);\n * });\n *\n * // Listen to 'mousemove' event on multiple elements\n * const elements = [document.getElementById('first'), document.getElementById('second')];\n * fromEvents(elements, 'mousemove').subscribe(event => {\n *   console.log('Mouse moved over:', event.target);\n * });\n * ```\n */\nexport function fromEvents<T>(target: HasEventTargetAddRemove<T> | HasEventTargetAddRemove<T>[], ...events: string[]): Observable<T> {\n  return merge(...events.map((event) => fromEvent(target, event)));\n}\n","import { QueryList } from '@angular/core';\nimport { Observable, startWith } from 'rxjs';\n\n/**\n * Creates an Observable from an Angular QueryList. The Observable emits the initial state\n * of the QueryList and continues to emit updates every time the QueryList changes.\n * This utility function is useful for integrating Angular's QueryList changes into\n * the RxJS reactive data flow, allowing developers to apply RxJS operators and\n * subscriptions to respond to QueryList updates.\n *\n * @template T The type of elements contained within the QueryList.\n * @param {QueryList<T>} queryList The QueryList instance to observe.\n * @returns {Observable<QueryList<T>>} An Observable that emits the current state of the QueryList\n * and updates whenever the QueryList changes.\n * @example\n * ```ts\n * // Assuming 'items' is a QueryList of component instances or DOM elements\n * fromQueryList(items).subscribe(queryList => {\n *   console.log('QueryList changed:', queryList);\n * });\n * ```\n */\nexport function fromQueryList<T>(queryList: QueryList<T>): Observable<QueryList<T>> {\n  return queryList.changes.pipe(startWith(queryList));\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACG,SAAU,UAAU,CAAI,KAAmB,EAAE,QAA6B,EAAA;AAC9E,IAAA,OAAO,CAAC,OAAsB,KAC5B,OAAO,CAAC,IAAI,CACV,SAAS,CAAC,CAAC,KAAQ,KACjB,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CACjB,GAAG,CAAC,MAAM,KAAK,CAAC,EAChB,SAAS,CAAC,QAAQ,CAAC,CACpB,CACF,CACF;AACL;;AC/BA;;;;;;;;;;;;;;;;;;;;AAoBG;AACG,SAAU,oBAAoB,CAAC,OAAgB,EAAE,OAA6B,EAAA;AAClF,IAAA,OAAO,IAAI,UAAU,CAAiB,CAAC,QAAQ,KAAI;AACjD,QAAA,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,QAAQ,EAAE,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACxF,QAAQ,CAAC,GAAG,CAAC,MAAM,gBAAgB,CAAC,UAAU,EAAE,CAAC;AACjD,QAAA,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;AAC5C,IAAA,CAAC,CAAC;AACJ;;AC3BA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;SACa,kBAAkB,CAAC,OAAgB,EAAE,gBAAgB,GAAG,EAAE,EAAA;AACxE,IAAA,OAAO,IAAI,UAAU,CAAwB,CAAC,QAAQ,KAAI;AACxD,QAAA,MAAM,cAAc,GAAG,oBAAoB,CAAC,CAAC,MAAM,KAAI;AACrD,YAAA,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;AACrB,gBAAA,QAAQ,CAAC,IAAI,C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