{"version":3,"file":"ng-web-apis-common.mjs","sources":["../../../libs/common/src/tokens/window.ts","../../../libs/common/src/tokens/animation-frame.ts","../../../libs/common/src/tokens/caches.ts","../../../libs/common/src/tokens/crypto.ts","../../../libs/common/src/tokens/css.ts","../../../libs/common/src/tokens/history.ts","../../../libs/common/src/tokens/local-storage.ts","../../../libs/common/src/tokens/location.ts","../../../libs/common/src/tokens/navigator.ts","../../../libs/common/src/tokens/media-devices.ts","../../../libs/common/src/tokens/network-information.ts","../../../libs/common/src/tokens/page-visibility.ts","../../../libs/common/src/tokens/performance.ts","../../../libs/common/src/tokens/screen.ts","../../../libs/common/src/tokens/session-storage.ts","../../../libs/common/src/tokens/speech-recognition.ts","../../../libs/common/src/tokens/speech-synthesis.ts","../../../libs/common/src/tokens/user-agent.ts","../../../libs/common/src/ng-web-apis-common.ts"],"sourcesContent":["import {DOCUMENT} from '@angular/common';\nimport {inject, InjectionToken} from '@angular/core';\n\nexport const WA_WINDOW = new InjectionToken<Window>('[WA_WINDOW]', {\n    factory: () => {\n        const {defaultView} = inject(DOCUMENT);\n\n        if (!defaultView) {\n            throw new Error('Window is not available');\n        }\n\n        return defaultView;\n    },\n});\n","import {inject, InjectionToken} from '@angular/core';\nimport {Observable, share} from 'rxjs';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_ANIMATION_FRAME = new InjectionToken<Observable<DOMHighResTimeStamp>>(\n    '[WA_ANIMATION_FRAME]',\n    {\n        factory: () => {\n            const {requestAnimationFrame, cancelAnimationFrame} = inject(WA_WINDOW);\n            const animationFrame$ = new Observable<DOMHighResTimeStamp>((subscriber) => {\n                let id = NaN;\n                const callback = (timestamp: DOMHighResTimeStamp): void => {\n                    subscriber.next(timestamp);\n                    id = requestAnimationFrame(callback);\n                };\n\n                id = requestAnimationFrame(callback);\n\n                return () => {\n                    cancelAnimationFrame(id);\n                };\n            });\n\n            return animationFrame$.pipe(share());\n        },\n    },\n);\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_CACHES = new InjectionToken<CacheStorage>('[WA_CACHES]', {\n    factory: () => inject(WA_WINDOW).caches,\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_CRYPTO = new InjectionToken<Crypto>('[WA_CRYPTO]', {\n    factory: () => inject(WA_WINDOW).crypto,\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\ndeclare global {\n    interface Window {\n        CSS: typeof CSS | null;\n    }\n}\n\nexport const WA_CSS = new InjectionToken<typeof CSS>('[WA_CSS]', {\n    factory: () =>\n        inject(WA_WINDOW).CSS ??\n        ({\n            escape: (v: string) => v,\n            supports: () => false,\n        } as unknown as typeof CSS),\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_HISTORY = new InjectionToken<History>('[WA_HISTORY]', {\n    factory: () => inject(WA_WINDOW).history,\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_LOCAL_STORAGE = new InjectionToken<Storage | null>('[WA_LOCAL_STORAGE]', {\n    factory: () => inject(WA_WINDOW).localStorage,\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_LOCATION = new InjectionToken<Location>('[WA_LOCATION]', {\n    factory: () => inject(WA_WINDOW).location,\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_NAVIGATOR = new InjectionToken<Navigator>('[WA_NAVIGATOR]', {\n    factory: () => inject(WA_WINDOW).navigator,\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_NAVIGATOR} from './navigator';\n\nexport const WA_MEDIA_DEVICES = new InjectionToken<MediaDevices>('[WA_MEDIA_DEVICES]', {\n    factory: () => inject(WA_NAVIGATOR).mediaDevices,\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_NAVIGATOR} from './navigator';\n\n// http://wicg.github.io/netinfo/#navigatornetworkinformation-interface\ndeclare interface NavigatorNetworkInformation {\n    readonly connection?: NetworkInformation;\n}\n\n// http://wicg.github.io/netinfo/#connection-types\ntype ConnectionType =\n    | 'bluetooth'\n    | 'cellular'\n    | 'ethernet'\n    | 'mixed'\n    | 'none'\n    | 'other'\n    | 'unknown'\n    | 'wifi'\n    | 'wimax';\n\n// http://wicg.github.io/netinfo/#effectiveconnectiontype-enum\ntype EffectiveConnectionType = '2g' | '3g' | '4g' | 'slow-2g';\n\n// http://wicg.github.io/netinfo/#dom-megabit\ntype Megabit = number;\n\n// http://wicg.github.io/netinfo/#dom-millisecond\ntype Millisecond = number;\n\n// http://wicg.github.io/netinfo/#networkinformation-interface\ninterface NetworkInformation extends EventTarget {\n    // http://wicg.github.io/netinfo/#type-attribute\n    readonly type?: ConnectionType;\n    // http://wicg.github.io/netinfo/#effectivetype-attribute\n    readonly effectiveType?: EffectiveConnectionType;\n    // http://wicg.github.io/netinfo/#downlinkmax-attribute\n    readonly downlinkMax?: Megabit;\n    // http://wicg.github.io/netinfo/#downlink-attribute\n    readonly downlink?: Megabit;\n    // http://wicg.github.io/netinfo/#rtt-attribute\n    readonly rtt?: Millisecond;\n    // http://wicg.github.io/netinfo/#savedata-attribute\n    readonly saveData?: boolean;\n    // http://wicg.github.io/netinfo/#handling-changes-to-the-underlying-connection\n    onchange?: EventListener;\n}\n\nexport const WA_NETWORK_INFORMATION = new InjectionToken<NetworkInformation | null>(\n    '[WA_NETWORK_INFORMATION]',\n    {\n        factory: () =>\n            inject<NavigatorNetworkInformation>(WA_NAVIGATOR).connection || null,\n    },\n);\n","import {DOCUMENT} from '@angular/common';\nimport {inject, InjectionToken} from '@angular/core';\nimport {\n    distinctUntilChanged,\n    fromEvent,\n    map,\n    type Observable,\n    shareReplay,\n    startWith,\n} from 'rxjs';\n\nexport const WA_PAGE_VISIBILITY = new InjectionToken<Observable<boolean>>(\n    '[WA_PAGE_VISIBILITY]',\n    {\n        factory: () => {\n            const documentRef = inject(DOCUMENT);\n\n            return fromEvent(documentRef, 'visibilitychange').pipe(\n                startWith(0),\n                map(() => documentRef.visibilityState !== 'hidden'),\n                distinctUntilChanged(),\n                shareReplay({refCount: false, bufferSize: 1}),\n            );\n        },\n    },\n);\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_PERFORMANCE = new InjectionToken<Performance>('[WA_PERFORMANCE]', {\n    factory: () => inject(WA_WINDOW).performance,\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_SCREEN = new InjectionToken<Screen>('[WA_SCREEN]', {\n    factory: () => inject(WA_WINDOW).screen,\n});\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_SESSION_STORAGE = new InjectionToken<Storage | null>(\n    '[WA_SESSION_STORAGE]',\n    {factory: () => inject(WA_WINDOW).sessionStorage},\n);\n","import {inject, InjectionToken, type Type} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\ndeclare global {\n    /**\n     * Workaround:\n     * This empty interface prevents TS errors when a consumer has\n     * `skipLibCheck: false` and did not include `dom-speech-recognition`\n     * in `tsconfig.types`.\n     *\n     * The real `SpeechRecognition` interface is provided by\n     * `@types/dom-speech-recognition` when it is present.\n     */\n    // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n    interface SpeechRecognition {}\n}\n\nexport const WA_SPEECH_RECOGNITION = new InjectionToken<Type<SpeechRecognition> | null>(\n    '[WA_SPEECH_RECOGNITION]: [WA_SPEECH_RECOGNITION]',\n    {\n        factory: () => {\n            const windowRef: any = inject(WA_WINDOW);\n\n            return (\n                windowRef.speechRecognition || windowRef.webkitSpeechRecognition || null\n            );\n        },\n    },\n);\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_WINDOW} from './window';\n\nexport const WA_SPEECH_SYNTHESIS = new InjectionToken<SpeechSynthesis>(\n    '[WA_SPEECH_SYNTHESIS]',\n    {factory: () => inject(WA_WINDOW).speechSynthesis},\n);\n","import {inject, InjectionToken} from '@angular/core';\n\nimport {WA_NAVIGATOR} from './navigator';\n\nexport const WA_USER_AGENT = new InjectionToken<string>('[WA_USER_AGENT]', {\n    factory: () => inject(WA_NAVIGATOR).userAgent,\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAGa,SAAS,GAAG,IAAI,cAAc,CAAS,aAAa,EAAE;IAC/D,OAAO,EAAE,MAAK;QACV,MAAM,EAAC,WAAW,EAAC,GAAG,MAAM,CAAC,QAAQ,CAAC;QAEtC,IAAI,CAAC,WAAW,EAAE;AACd,YAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;QAC9C;AAEA,QAAA,OAAO,WAAW;IACtB,CAAC;AACJ,CAAA;;MCRY,kBAAkB,GAAG,IAAI,cAAc,CAChD,sBAAsB,EACtB;IACI,OAAO,EAAE,MAAK;QACV,MAAM,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,GAAG,MAAM,CAAC,SAAS,CAAC;QACvE,MAAM,eAAe,GAAG,IAAI,UAAU,CAAsB,CAAC,UAAU,KAAI;YACvE,IAAI,EAAE,GAAG,GAAG;AACZ,YAAA,MAAM,QAAQ,GAAG,CAAC,SAA8B,KAAU;AACtD,gBAAA,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC;AAC1B,gBAAA,EAAE,GAAG,qBAAqB,CAAC,QAAQ,CAAC;AACxC,YAAA,CAAC;AAED,YAAA,EAAE,GAAG,qBAAqB,CAAC,QAAQ,CAAC;AAEpC,YAAA,OAAO,MAAK;gBACR,oBAAoB,CAAC,EAAE,CAAC;AAC5B,YAAA,CAAC;AACL,QAAA,CAAC,CAAC;AAEF,QAAA,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACxC,CAAC;AACJ,CAAA;;MCtBQ,SAAS,GAAG,IAAI,cAAc,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