{"version":3,"sources":["node_modules/@angular/cdk/fesm2022/clipboard.mjs"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport * as i0 from '@angular/core';\nimport { Injectable, Inject, InjectionToken, EventEmitter, Directive, Optional, Input, Output, NgModule } from '@angular/core';\n\n/**\n * A pending copy-to-clipboard operation.\n *\n * The implementation of copying text to the clipboard modifies the DOM and\n * forces a re-layout. This re-layout can take too long if the string is large,\n * causing the execCommand('copy') to happen too long after the user clicked.\n * This results in the browser refusing to copy. This object lets the\n * re-layout happen in a separate tick from copying by providing a copy function\n * that can be called later.\n *\n * Destroy must be called when no longer in use, regardless of whether `copy` is\n * called.\n */\nclass PendingCopy {\n constructor(text, _document) {\n this._document = _document;\n const textarea = this._textarea = this._document.createElement('textarea');\n const styles = textarea.style;\n // Hide the element for display and accessibility. Set a fixed position so the page layout\n // isn't affected. We use `fixed` with `top: 0`, because focus is moved into the textarea\n // for a split second and if it's off-screen, some browsers will attempt to scroll it into view.\n styles.position = 'fixed';\n styles.top = styles.opacity = '0';\n styles.left = '-999em';\n textarea.setAttribute('aria-hidden', 'true');\n textarea.value = text;\n // Making the textarea `readonly` prevents the screen from jumping on iOS Safari (see #25169).\n textarea.readOnly = true;\n // The element needs to be inserted into the fullscreen container, if the page\n // is in fullscreen mode, otherwise the browser won't execute the copy command.\n (this._document.fullscreenElement || this._document.body).appendChild(textarea);\n }\n /** Finishes copying the text. */\n copy() {\n const textarea = this._textarea;\n let successful = false;\n try {\n // Older browsers could throw if copy is not supported.\n if (textarea) {\n const currentFocus = this._document.activeElement;\n textarea.select();\n textarea.setSelectionRange(0, textarea.value.length);\n successful = this._document.execCommand('copy');\n if (currentFocus) {\n currentFocus.focus();\n }\n }\n } catch {\n // Discard error.\n // Initial setting of {@code successful} will represent failure here.\n }\n return successful;\n }\n /** Cleans up DOM changes used to perform the copy operation. */\n destroy() {\n const textarea = this._textarea;\n if (textarea) {\n textarea.remove();\n this._textarea = undefined;\n }\n }\n}\n\n/**\n * A service for copying text to the clipboard.\n */\nlet Clipboard = /*#__PURE__*/(() => {\n class Clipboard {\n constructor(document) {\n this._document = document;\n }\n /**\n * Copies the provided text into the user's clipboard.\n *\n * @param text The string to copy.\n * @returns Whether the operation was successful.\n */\n copy(text) {\n const pendingCopy = this.beginCopy(text);\n const successful = pendingCopy.copy();\n pendingCopy.destroy();\n return successful;\n }\n /**\n * Prepares a string to be copied later. This is useful for large strings\n * which take too long to successfully render and be copied in the same tick.\n *\n * The caller must call `destroy` on the returned `PendingCopy`.\n *\n * @param text The string to copy.\n * @returns the pending copy operation.\n */\n beginCopy(text) {\n return new PendingCopy(text, this._document);\n }\n static {\n this.ɵfac = function Clipboard_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || Clipboard)(i0.ɵɵinject(DOCUMENT));\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Clipboard,\n factory: Clipboard.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return Clipboard;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/** Injection token that can be used to provide the default options to `CdkCopyToClipboard`. */\nconst CDK_COPY_TO_CLIPBOARD_CONFIG = /*#__PURE__*/new InjectionToken('CDK_COPY_TO_CLIPBOARD_CONFIG');\n/**\n * Provides behavior for a button that when clicked copies content into user's\n * clipboard.\n */\nlet CdkCopyToClipboard = /*#__PURE__*/(() => {\n class CdkCopyToClipboard {\n constructor(_clipboard, _ngZone, config) {\n this._clipboard = _clipboard;\n this._ngZone = _ngZone;\n /** Content to be copied. */\n this.text = '';\n /**\n * How many times to attempt to copy the text. This may be necessary for longer text, because\n * the browser needs time to fill an intermediate textarea element and copy the content.\n */\n this.attempts = 1;\n /**\n * Emits when some text is copied to the clipboard. The\n * emitted value indicates whether copying was successful.\n */\n this.copied = new EventEmitter();\n /** Copies that are currently being attempted. */\n this._pending = new Set();\n if (config && config.attempts != null) {\n this.attempts = config.attempts;\n }\n }\n /** Copies the current text to the clipboard. */\n copy(attempts = this.attempts) {\n if (attempts > 1) {\n let remainingAttempts = attempts;\n const pending = this._clipboard.beginCopy(this.text);\n this._pending.add(pending);\n const attempt = () => {\n const successful = pending.copy();\n if (!successful && --remainingAttempts && !this._destroyed) {\n // We use 1 for the timeout since it's more predictable when flushing in unit tests.\n this._currentTimeout = this._ngZone.runOutsideAngular(() => setTimeout(attempt, 1));\n } else {\n this._currentTimeout = null;\n this._pending.delete(pending);\n pending.destroy();\n this.copied.emit(successful);\n }\n };\n attempt();\n } else {\n this.copied.emit(this._clipboard.copy(this.text));\n }\n }\n ngOnDestroy() {\n if (this._currentTimeout) {\n clearTimeout(this._currentTimeout);\n }\n this._pending.forEach(copy => copy.destroy());\n this._pending.clear();\n this._destroyed = true;\n }\n static {\n this.ɵfac = function CdkCopyToClipboard_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || CdkCopyToClipboard)(i0.ɵɵdirectiveInject(Clipboard), i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(CDK_COPY_TO_CLIPBOARD_CONFIG, 8));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: CdkCopyToClipboard,\n selectors: [[\"\", \"cdkCopyToClipboard\", \"\"]],\n hostBindings: function CdkCopyToClipboard_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"click\", function CdkCopyToClipboard_click_HostBindingHandler() {\n return ctx.copy();\n });\n }\n },\n inputs: {\n text: [0, \"cdkCopyToClipboard\", \"text\"],\n attempts: [0, \"cdkCopyToClipboardAttempts\", \"attempts\"]\n },\n outputs: {\n copied: \"cdkCopyToClipboardCopied\"\n },\n standalone: true\n });\n }\n }\n return CdkCopyToClipboard;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ClipboardModule = /*#__PURE__*/(() => {\n class ClipboardModule {\n static {\n this.ɵfac = function ClipboardModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ClipboardModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: ClipboardModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n }\n return ClipboardModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { CDK_COPY_TO_CLIPBOARD_CONFIG, CdkCopyToClipboard, Clipboard, ClipboardModule, PendingCopy };\n"],"mappings":"yHAiBA,IAAMA,EAAN,KAAkB,CAChB,YAAYC,EAAMC,EAAW,CAC3B,KAAK,UAAYA,EACjB,IAAMC,EAAW,KAAK,UAAY,KAAK,UAAU,cAAc,UAAU,EACnEC,EAASD,EAAS,MAIxBC,EAAO,SAAW,QAClBA,EAAO,IAAMA,EAAO,QAAU,IAC9BA,EAAO,KAAO,SACdD,EAAS,aAAa,cAAe,MAAM,EAC3CA,EAAS,MAAQF,EAEjBE,EAAS,SAAW,IAGnB,KAAK,UAAU,mBAAqB,KAAK,UAAU,MAAM,YAAYA,CAAQ,CAChF,CAEA,MAAO,CACL,IAAMA,EAAW,KAAK,UAClBE,EAAa,GACjB,GAAI,CAEF,GAAIF,EAAU,CACZ,IAAMG,EAAe,KAAK,UAAU,cACpCH,EAAS,OAAO,EAChBA,EAAS,kBAAkB,EAAGA,EAAS,MAAM,MAAM,EACnDE,EAAa,KAAK,UAAU,YAAY,MAAM,EAC1CC,GACFA,EAAa,MAAM,CAEvB,CACF,MAAQ,CAGR,CACA,OAAOD,CACT,CAEA,SAAU,CACR,IAAMF,EAAW,KAAK,UAClBA,IACFA,EAAS,OAAO,EAChB,KAAK,UAAY,OAErB,CACF,EAKII,GAA0B,IAAM,CAClC,IAAMC,EAAN,MAAMA,CAAU,CACd,YAAYC,EAAU,CACpB,KAAK,UAAYA,CACnB,CAOA,KA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AK,KAAK,IAAI,CAAC,CAEpD,CACA,aAAc,CACR,KAAK,iBACP,aAAa,KAAK,eAAe,EAEnC,KAAK,SAAS,QAAQC,GAAQA,EAAK,QAAQ,CAAC,EAC5C,KAAK,SAAS,MAAM,EACpB,KAAK,WAAa,EACpB,CA2BF,EAzBIT,EAAK,UAAO,SAAoCP,EAAmB,CACjE,OAAO,IAAKA,GAAqBO,GAAuBU,EAAkBrB,CAAS,EAAMqB,EAAqBC,CAAM,EAAMD,EAAkBb,EAA8B,CAAC,CAAC,CAC9K,EAGAG,EAAK,UAAyBY,EAAkB,CAC9C,KAAMZ,EACN,UAAW,CAAC,CAAC,GAAI,qBAAsB,EAAE,CAAC,EAC1C,aAAc,SAAyCa,EAAIC,EAAK,CAC1DD,EAAK,GACJE,EAAW,QAAS,UAAuD,CAC5E,OAAOD,EAAI,KAAK,CAClB,CAAC,CAEL,EACA,OAAQ,CACN,KAAM,CAAC,EAAG,qBAAsB,MAAM,EACtC,SAAU,CAAC,EAAG,6BAA8B,UAAU,CACxD,EACA,QAAS,CACP,OAAQ,0BACV,EACA,WAAY,EACd,CAAC,EA7EL,IAAMf,EAANC,EAgFA,OAAOD,CACT,GAAG,EAICiB,GAAgC,IAAM,CACxC,IAAMC,EAAN,MAAMA,CAAgB,CActB,EAZIA,EAAK,UAAO,SAAiCxB,EAAmB,CAC9D,OAAO,IAAKA,GAAqBwB,EACnC,EAGAA,EAAK,UAAyBC,EAAiB,CAC7C,KAAMD,CACR,CAAC,EAGDA,EAAK,UAAyBE,EAAiB,CAAC,CAAC,EAZrD,IAAMH,EAANC,EAeA,OAAOD,CACT,GAAG","names":["PendingCopy","text","_document","textarea","styles","successful","currentFocus","Clipboard","_Clipboard","document","pendingCopy","__ngFactoryType__","ɵɵinject","DOCUMENT","ɵɵdefineInjectable","CDK_COPY_TO_CLIPBOARD_CONFIG","InjectionToken","CdkCopyToClipboard","_CdkCopyToClipboard","_clipboard","_ngZone","config","EventEmitter","attempts","remainingAttempts","pending","attempt","copy","ɵɵdirectiveInject","NgZone","ɵɵdefineDirective","rf","ctx","ɵɵlistener","ClipboardModule","_ClipboardModule","ɵɵdefineNgModule","ɵɵdefineInjector"],"x_google_ignoreList":[0]}