{"version":3,"sources":["src/sdk/SpeechSynthesisRequestInputStream.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,UAAU,sCAAsC;IAC5C,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,mBAAmB,IAAI,IAAI,CAAC;CAC/B;AAED;;;;GAIG;AACH,qBAAa,iCAAiC;IAC1C,OAAO,CAAC,UAAU,CAAyC;IAC3D,OAAO,CAAC,UAAU,CAAkB;IAEpC;;;OAGG;gBACgB,MAAM,EAAE,sCAAsC;IAIjE;;;OAGG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOhC;;OAEG;IACI,KAAK,IAAI,IAAI;IAOpB;;OAEG;IACH,IAAW,QAAQ,IAAI,OAAO,CAE7B;CACJ","file":"SpeechSynthesisRequestInputStream.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * @internal\r\n * Interface for the parent request that the input stream delegates to.\r\n */\r\ninterface ISpeechSynthesisRequestInputStreamHost {\r\n    onTextPieceReceived(text: string): void;\r\n    onInputStreamClosed(): void;\r\n}\r\n\r\n/**\r\n * Represents an input stream for speech synthesis request text streaming.\r\n * Note: This class is in preview and may be subject to change in future versions.\r\n * @class SpeechSynthesisRequestInputStream\r\n */\r\nexport class SpeechSynthesisRequestInputStream {\r\n    private privParent: ISpeechSynthesisRequestInputStreamHost;\r\n    private privClosed: boolean = false;\r\n\r\n    /**\r\n     * Constructor for internal use.\r\n     * @param parent The parent SpeechSynthesisRequest.\r\n     */\r\n    public constructor(parent: ISpeechSynthesisRequestInputStreamHost) {\r\n        this.privParent = parent;\r\n    }\r\n\r\n    /**\r\n     * Writes the specified text to the input stream.\r\n     * @param text The text to be written to the input stream.\r\n     */\r\n    public write(text: string): void {\r\n        if (this.privClosed) {\r\n            throw new Error(\"Cannot write to a closed input stream.\");\r\n        }\r\n        this.privParent.onTextPieceReceived(text);\r\n    }\r\n\r\n    /**\r\n     * Closes the input stream, signaling that no more text will be written.\r\n     */\r\n    public close(): void {\r\n        if (!this.privClosed) {\r\n            this.privClosed = true;\r\n            this.privParent.onInputStreamClosed();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Gets whether the input stream is closed.\r\n     */\r\n    public get isClosed(): boolean {\r\n        return this.privClosed;\r\n    }\r\n}\r\n"]}