import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import'../../utility/live-region/live-region.class.js';export type PushToTalkMode='hold'|'toggle';export type PushToTalkState='idle'|'requesting'|'denied'|'recording'|'error';export type PushToTalkAudioConstraints=Omit &{readonly deviceId?:never;};export interface LyraPushToTalkEventMap{'lr-record-start':CustomEvent<{stream:MediaStream;}>;'lr-record-chunk':CustomEvent<{blob:Blob;}>;'lr-record-stop':CustomEvent<{blob:Blob;durationMs:number;}>;'lr-record-cancel':CustomEvent;'lr-record-error':CustomEvent<{error:DOMException|Error;}>;'lr-level':CustomEvent<{level:number;}>;'lr-record-state-change':CustomEvent<{state:PushToTalkState;}>;} /** * `` — a mic capture button owning the full `getUserMedia` + `MediaRecorder` * lifecycle: permission request, recording, optional chunked streaming, teardown. The one place in * this library that touches the microphone — no SDK, no LiveKit/ElevenLabs import, native browser * APIs only. * * `mode="hold"` (the default) is a press-and-hold gesture: pointerdown/Enter-or-Space-keydown starts, * pointerup/keyup/blur stops. `mode="toggle"` is click-to-start/click-to-stop with `aria-pressed`. * Escape cancels the in-progress take in either mode (discarding it — `lr-record-cancel`, never * `lr-record-stop`). `state` is a read-only lifecycle reflected to the `data-state` attribute (not * `state`, avoiding any ambiguity with a native form-control `state`): `'idle' | 'requesting' | * 'denied' | 'recording' | 'error'`. A host-level `aria-label` (set on `` itself) * overrides the computed trigger label by attribute presence, including an explicit empty value. * * @customElement lr-push-to-talk * @slot microphone-icon - Replaces the default mic glyph. Decorative: assigned content is inert * and hidden from accessibility APIs because it is rendered inside the named trigger button. * @slot recording-icon - Replaces the default recording-state pulse glyph. Decorative and inert. * @event lr-record-start - Capture began. `detail: { stream: MediaStream }` — the same object the * `stream` getter then returns for the duration of the take. * @event lr-record-chunk - A `timeslice-ms` slice was produced (only fires when `timeslice-ms > 0`, * in order). `detail: { blob: Blob }` — a container fragment, decodable only once concatenated from * the first chunk of the take. * @event lr-record-stop - The take finished normally. `detail: { blob: Blob; durationMs: number }` * — `durationMs` excludes the `requesting` phase. * @event lr-record-cancel - The take was discarded via `cancel()`/Escape — no detail, and * `lr-record-stop` never fires for this take. * @event lr-record-error - A permission request, recorder construction/start, or active recorder * failed. `detail: { error: DOMException | Error }` — `NotAllowedError` transitions `state` to * `'denied'`, anything else to `'error'`. * @event lr-level - `detail: { level: number }` (0-1 RMS amplitude), opt-in via `level-events`, * rAF-throttled, only while `state === 'recording'`. * @event lr-record-state-change - `detail: { state: PushToTalkState }` — fires on every recording * lifecycle transition. * @csspart trigger - The capture button. * @csspart icon - Wrapper around the `microphone-icon` slot and default mic glyph. * @csspart pulse - Wrapper around the `recording-icon` slot / default pulse glyph, rendered only * while recording. * @csspart timer - The localized `M:SS` elapsed-time readout, rendered only while recording and * `show-timer`. * @csspart status - Visible status text for the `requesting`/`denied`/`error`/unsupported states. * @cssprop [--lr-push-to-talk-size=var(--lr-size-3rem)] - Preferred inline and block size of the * circular `trigger` button; `--lr-icon-button-size` remains its minimum hit-area floor. * @cssprop [--lr-push-to-talk-recording-color=var(--lr-color-danger)] - Established aggregate * fallback for the recording trigger border, trigger foreground, and pulse border. The three * more-specific recording properties below win independently when set. * @cssprop [--lr-push-to-talk-trigger-recording-border-color=var(--lr-push-to-talk-recording-color, var(--lr-color-danger))] - Trigger border color while recording. * @cssprop [--lr-push-to-talk-trigger-recording-color=var(--lr-push-to-talk-recording-color, var(--lr-color-danger))] - Trigger foreground, including the default mic glyph, while recording. * @cssprop [--lr-push-to-talk-pulse-recording-border-color=var(--lr-push-to-talk-recording-color, var(--lr-color-danger))] - Recording pulse-ring border color. * @status stable * @since 4.0.0 */ export declare class LyraPushToTalk extends LyraElement{static styles:import("lit").CSSResultGroup[];private _mode;get mode():PushToTalkMode;set mode(next:PushToTalkMode); /** `> 0` requests periodic `lr-record-chunk` slices from `MediaRecorder` every this-many * milliseconds; `0` (the default) requests one slice at stop. Clamped to * `[1, MAX_TIMEOUT_MS]` at the point it's handed to `MediaRecorder.start()` -- see `start()` -- * so a non-finite/oversized value can't reach that native API unsanitized. */ timesliceMs:number;mimeType:string;deviceId:string; /** Additional audio constraints (`echoCancellation`, …). `deviceId` has one authority: the * top-level `deviceId` property. */ audioConstraints?:PushToTalkAudioConstraints; /** Enables `lr-level` sampling. Changes take effect immediately during an active recording. */ levelEvents:boolean; /** `> 0` auto-stops the take at this many milliseconds (a stuck-key guard); `0` (the default) * never auto-stops. Clamped to `[1, MAX_TIMEOUT_MS]` at the point it's handed to `setTimeout()` * -- see `start()` -- the browser timer ceiling, matching * `lr-sequence-playback`'s `interval-ms` * handling of its own duration-like property. Changes during recording reschedule the deadline * relative to the original recording start; setting `0` cancels it. */ maxDurationMs:number; /** Shows and samples the elapsed timer. Changes take effect immediately while recording. */ showTimer:boolean;disabled:boolean;private elapsedMs; /** The server-safe first-render answer is unsupported. A browser-only mount seeds its owner * realm before rendering; hydration keeps the server answer for one update, then corrects it. */ private captureSupported;private _state; /** Read-only recording lifecycle, reflected to the `data-state` attribute. Drive it via * `start()`/`stop()`/`cancel()`, never by assignment. */ get state():PushToTalkState;private _stream; /** The active `MediaStream` — the same object `lr-record-start` carries. `null` outside an * active take. */ get stream():MediaStream|null;private liveRegion?;private trigger?;private recorder?;private chunks;private recordingStartedAt; /** Window that granted the active capture. Native objects and scheduled work for a take stay * bound to this realm even if the custom element is adopted before the recorder stops. */ private captureWindow?;private activeCapture?;private pendingRequest?;private captureIntent?;private queuedIntent?;private lifecycleGeneration;private captureSequence;private intentSequence;private cancelRequested;private recorderStopRequested;private recorderFailed;private holdGesture?;private tickTimer?;private maxDurationTimer?;private audioCtx?;private analyser?;private levelData?;private levelFrame?; /** Lit's server DOM intentionally gives custom elements no browser-owned document. */ private get ownerWindow();private get captureOwner();private ownsCurrentLifecycle;private isCurrentRealm;private rebaseCurrentRealmOwner;private createIntent;private isLiveIntent;private clearIntent; /** Makes a request incapable of mutating a later lifecycle. A native permission prompt cannot * be aborted, so its eventual stream is stopped in its own continuation rather than being * allowed to re-enter the component's current state. */ private retirePendingRequest; /** Disconnect, adoption, and disablement revoke both the physical intent and request authority * before any release handler can turn an involuntary teardown into a normal `lr-record-stop`. */ private invalidateLifecycle;private canAdoptRequest;private canStartRequest;private notifyCancellation; /** A physical B press can land after A has requested recorder stop but before `onstop` runs. * Queue only that still-held intent, so B cannot be lost or create a concurrent recorder. */ private resumeQueuedIntent;private finishRetiredRequest;private finishUnusableRequest;private syncCaptureSupport;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected willUpdate(changed:PropertyValues):void;focus(options?:FocusOptions):void;blur():void; /** Programmatically starts/stops a take using the component's configured interaction mode. */ click():void;private resolveMimeType;private setState;private announce; /** Begins a take. A public call creates a programmatic intent; a same-owner physical B press * can instead attach its live intent to A's one pending browser permission request. */ start():Promise;private startForIntent;private captureConstraints;private requestPermission;private startRecorder; /** Stops the active take, finalizing it via `lr-record-stop`. No-op unless `state === 'recording'`. */ stop():void; /** Discards the active or pending take: fires `lr-record-cancel`, never `lr-record-stop`. */ cancel():void;private requestRecorderStop;private finalizeStop;private failRecorder;private teardownStream;private stopRuntimeLoops;private syncElapsedTimer;private syncMaxDurationTimer;private syncLevelMeter;private startLevelMeter;private sampleLevel;private stopLevelMeter;private formatElapsed;private onPointerDown;private onPointerUp;private onPointerCancel; /** Releasing A only clears A's physical intent. Its browser permission prompt stays available * for a same-owner B press; an explicit mode/lifecycle change retires it instead. */ private releaseHoldGesture;private onKeyDown;private onKeyUp;private onBlur;private onClick;private get triggerLabel();private get statusText();render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-push-to-talk':LyraPushToTalk;}}