@aceshooting/lyra-ui 31.0.0 → 31.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/dist/autoloader-cdn.js +1 -1
  3. package/dist/components/agent-tools/budget-meter/budget-meter.class.d.ts +12 -1
  4. package/dist/components/agent-tools/budget-meter/budget-meter.class.js +4 -4
  5. package/dist/components/charts/chart/lite-chart.class.js +1 -1
  6. package/dist/components/conversation/chat-composer/chat-composer.class.d.ts +18 -8
  7. package/dist/components/conversation/chat-composer/chat-composer.class.js +11 -9
  8. package/dist/components/conversation/chat-composer/chat-composer.styles.js +1 -1
  9. package/dist/components/conversation/message-feedback/message-feedback.class.d.ts +11 -3
  10. package/dist/components/conversation/message-feedback/message-feedback.class.js +12 -6
  11. package/dist/components/conversation/message-feedback/message-feedback.styles.js +1 -1
  12. package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +6 -3
  13. package/dist/components/conversation/prompt-input/prompt-input.class.js +3 -2
  14. package/dist/components/conversation/push-to-talk/push-to-talk.class.js +1 -1
  15. package/dist/components/conversation/thread-list/thread-list.class.d.ts +1 -1
  16. package/dist/components/conversation/thread-list/thread-list.class.js +2 -2
  17. package/dist/components/data/document-library/document-library-cursor.js +1 -0
  18. package/dist/components/data/document-library/document-library-types.d.ts +20 -0
  19. package/dist/components/data/document-library/document-library.class.d.ts +37 -26
  20. package/dist/components/data/document-library/document-library.class.js +20 -11
  21. package/dist/components/data/document-library/document-library.styles.js +1 -1
  22. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +1 -1
  23. package/dist/components/data/flow-canvas/flow-canvas.class.js +1 -1
  24. package/dist/components/data/timeline/timeline.class.js +1 -1
  25. package/dist/components/forms/combobox/combobox.class.d.ts +20 -12
  26. package/dist/components/forms/combobox/combobox.class.js +2 -2
  27. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +1 -1
  28. package/dist/components/layout/dock-panel/dock-panel.class.js +1 -1
  29. package/dist/components/layout/page/page.class.d.ts +3 -3
  30. package/dist/components/layout/page/page.class.js +1 -1
  31. package/dist/components/layout/segmented/segmented.class.d.ts +20 -7
  32. package/dist/components/layout/segmented/segmented.class.js +34 -24
  33. package/dist/components/layout/segmented/segmented.styles.js +1 -1
  34. package/dist/components/layout/stepper/stepper.styles.js +1 -1
  35. package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
  36. package/dist/components/media/map/map-anchor-controller.js +1 -1
  37. package/dist/components/media/map/map-canvas-target.js +1 -0
  38. package/dist/components/media/map/map.class.d.ts +10 -1
  39. package/dist/components/media/map/map.class.js +4 -4
  40. package/dist/components/media/map/map.styles.js +1 -1
  41. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +21 -9
  42. package/dist/components/media/sequence-playback/sequence-playback.class.js +7 -6
  43. package/dist/components/media/sequence-playback/sequence-playback.styles.js +1 -1
  44. package/dist/components/overlays/overlay/overlay.styles.js +1 -1
  45. package/dist/components/retrieval/graph/graph-spatial-controller.js +1 -1
  46. package/dist/components/retrieval/graph/graph.class.js +1 -1
  47. package/dist/components/retrieval/ingestion-queue/ingestion-queue-presentation.d.ts +11 -0
  48. package/dist/components/retrieval/ingestion-queue/ingestion-queue-presentation.js +1 -0
  49. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +18 -7
  50. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +13 -26
  51. package/dist/components/retrieval/ingestion-queue/ingestion-queue.styles.js +1 -1
  52. package/dist/components/utility/diff-view/diff-view.class.d.ts +5 -5
  53. package/dist/components/utility/diff-view/diff-view.class.js +1 -1
  54. package/dist/components/utility/icon/icon.class.js +1 -1
  55. package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
  56. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
  57. package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
  58. package/dist/components/viewers/document-preview/document-preview.class.js +2 -2
  59. package/dist/components/viewers/docx-viewer/docx-viewer.class.d.ts +1 -1
  60. package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
  61. package/dist/components/viewers/email-viewer/email-viewer.class.d.ts +1 -1
  62. package/dist/components/viewers/email-viewer/email-viewer.class.js +2 -2
  63. package/dist/components/viewers/html-viewer/html-viewer.class.js +1 -1
  64. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +2 -2
  65. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +1 -1
  66. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +1 -1
  67. package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +1 -1
  68. package/dist/components/viewers/svg-viewer/svg-viewer.class.js +1 -1
  69. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +2 -2
  70. package/dist/data-sources.d.ts +10 -0
  71. package/dist/events.d.ts +9 -4
  72. package/dist/framework-types.d.ts +1 -1
  73. package/dist/internal/default-strings/conversation.generated.js +1 -1
  74. package/dist/internal/default-strings/data.generated.js +1 -1
  75. package/dist/internal/default-strings/retrieval.generated.js +1 -1
  76. package/dist/internal/localization-types.d.ts +1 -1
  77. package/dist/internal/localization.js +1 -1
  78. package/dist/internal/lyra-element.js +2 -2
  79. package/dist/internal/native-modal-context.js +1 -1
  80. package/dist/internal/overlay-manager.js +1 -1
  81. package/dist/internal/overlay-order.js +1 -1
  82. package/dist/internal/overlay-stack.js +1 -1
  83. package/dist/internal/package-metadata.js +1 -1
  84. package/dist/internal/runtime-diagnostics.js +1 -0
  85. package/dist/internal/source-cursor-controller.js +1 -0
  86. package/dist/internal/source-cursor-projection.js +1 -0
  87. package/dist/internal/source-page-scope.js +1 -1
  88. package/dist/lyra.d.ts +1 -1
  89. package/dist/theme/theme-bootstrap.js +1 -1
  90. package/dist/theme/theme.js +1 -1
  91. package/dist/utilities/overlay-manager.d.ts +2 -0
  92. package/llms/components/lr-budget-meter.md +31 -0
  93. package/llms/components/lr-chat-composer.md +13 -2
  94. package/llms/components/lr-combobox.md +27 -1
  95. package/llms/components/lr-diff-view.md +6 -0
  96. package/llms/components/lr-document-library.md +90 -6
  97. package/llms/components/lr-graph.md +5 -0
  98. package/llms/components/lr-ingestion-queue.md +76 -8
  99. package/llms/components/lr-json-viewer.md +34 -0
  100. package/llms/components/lr-lite-chart.md +2 -1
  101. package/llms/components/lr-map.md +33 -0
  102. package/llms/components/lr-message-feedback.md +38 -3
  103. package/llms/components/lr-page.md +4 -2
  104. package/llms/components/lr-prompt-input.md +5 -2
  105. package/llms/components/lr-segmented.md +30 -10
  106. package/llms/components/lr-sequence-playback.md +47 -12
  107. package/llms/components/lr-virtual-list.md +3 -1
  108. package/llms/peers.md +2 -2
  109. package/llms/shared/events-and-types.md +61 -2
  110. package/llms/shared/forms-and-accessibility.md +25 -0
  111. package/llms/shared/imports-and-registration.md +154 -110
  112. package/llms/shared/testing-and-utilities.md +5 -1
  113. package/llms/shared.md +245 -113
  114. package/locales.json +1 -1
  115. package/package.json +8 -8
  116. package/registrations.json +1 -1
@@ -1,4 +1,11 @@
1
- import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyDeclaration,type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraTextWrap}from'../../../internal/shared-unions.js';import type{LyraToolbarAction}from'../message-actions/toolbar-actions.js';export interface MessageFeedbackReason{readonly id:string;readonly label:string;}export type MessageFeedbackRating='up'|'down';export type MessageFeedbackValue=MessageFeedbackRating|null;export type MessageFeedbackDetailFor='none'|'up'|'down'|'both';export interface MessageFeedbackDetailConfiguration{readonly reasons?:readonly MessageFeedbackReason[];readonly commentable?:boolean;}
1
+ import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyDeclaration,type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraTextWrap}from'../../../internal/shared-unions.js';import type{LyraToolbarAction}from'../message-actions/toolbar-actions.js';export interface MessageFeedbackReason{readonly id:string;readonly label:string;}export type MessageFeedbackRating='up'|'down';export type MessageFeedbackValue=MessageFeedbackRating|null;export type MessageFeedbackDetailFor='none'|'up'|'down'|'both';
2
+ /** Optional toggle-chip cardinality; single mode still permits no selected reason.*/
3
+ export type MessageFeedbackReasonSelection='multiple'|'single';export interface MessageFeedbackDetailConfiguration{readonly reasons?:readonly MessageFeedbackReason[];readonly commentable?:boolean;
4
+ /** Defaults to multiple; single keeps the latest selected reason and permits clearing it.*/
5
+ readonly reasonSelection?:MessageFeedbackReasonSelection;
6
+ /** Raw UTF-16 draft limit, normalized to a nonnegative integer. Invalid/omitted is unbounded.
7
+ * Oversized drafts survive policy changes and must be corrected before submitting. */
8
+ readonly commentMaxLength?:number;}
2
9
  /** Native `<textarea wrap>` values accepted by the optional comment field.*/
3
10
  export type MessageFeedbackWrap=LyraTextWrap;export interface MessageFeedbackSubmitDetail{rating:MessageFeedbackValue;reasonIds:string[];comment:string;
4
11
  /** Opaque, nonblank correlation identity for this one feedback persistence transaction.*/
@@ -48,6 +55,7 @@ readonly submissionId:string;}export interface LyraMessageFeedbackEventMap{'lr-f
48
55
  * @csspart panel - The inline detail disclosure. Only rendered for a non-empty `detail`.
49
56
  * @csspart reasons - The reason-chip group. Only rendered when `detail.reasons` is non-empty.
50
57
  * @csspart comment - The comment `<textarea>`. Only rendered when `detail.commentable` is true.
58
+ * @csspart comment-error - The localized oversized-comment error.
51
59
  * @csspart submit-button - The panel's submit button.
52
60
  *
53
61
  * @cssprop [--lr-message-feedback-up-active-color=var(--lr-color-success)] - Glyph color of the
@@ -89,7 +97,7 @@ autocapitalize:string;private autocorrectValue;
89
97
  * accept the legacy `'off'` and `'false'` string forms. */
90
98
  get autocorrect():boolean;set autocorrect(next:boolean|string);
91
99
  /** Native wrapping mode for the optional comment textarea. Removing `wrap` restores `'soft'`.*/
92
- wrap:MessageFeedbackWrap;private panelOpen;private selectedReasonIds;private commentDraft;private detailProjectionSource;private detailProjection;private pendingInternalRating;private submissionSequence;private submissionCount;private legacyNoArgumentSettlementInvalidated;private lifecycleGeneration;private focusGeneration;private settingPending;private dispatchingSubmission?;private pendingSubmission?;private upButtonEl?;private downButtonEl?;private submitButtonEl?;private sink?;private readonly panelId;private readonly upToolbarAction;private readonly downToolbarAction;private createToolbarAction;
100
+ wrap:MessageFeedbackWrap;private panelOpen;private selectedReasonIds;private commentDraft;private commentLengthError;private detailProjectionSource;private detailProjection;private pendingInternalRating;private submissionSequence;private submissionCount;private legacyNoArgumentSettlementInvalidated;private lifecycleGeneration;private focusGeneration;private settingPending;private dispatchingSubmission?;private pendingSubmission?;private upButtonEl?;private downButtonEl?;private submitButtonEl?;private sink?;private readonly panelId;private readonly reasonDescriptionId;private readonly commentErrorId;private readonly upToolbarAction;private readonly downToolbarAction;private createToolbarAction;
93
101
  /** Ordered logical actions exposed to an enclosing toolbar without exposing shadow nodes.
94
102
  * A parent releases its optional lease when this provider leaves, restoring an untouched
95
103
  * authored thumb tabindex without replacing a later consumer value. */
@@ -99,7 +107,7 @@ getToolbarActions():readonly LyraToolbarAction[];
99
107
  * arrow-key stop. */
100
108
  focus(options?:FocusOptions):void;blur():void;
101
109
  /** Activates the thumb matching the current rating (the up thumb when unset).*/
102
- click():void;private get detailReasons();private get detailCommentable();private get currentDetailProjection();private get hasDetailContent();private detailApplies;requestUpdate(name?:PropertyKey,oldValue?:unknown,options?:PropertyDeclaration):void;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected willUpdate(changed:PropertyValues<this>):void;protected updated(changed:PropertyValues<this>):void;private setRatingFromInteraction;private activateThumb;private focusActiveThumb;private closePanel;private onPanelKeyDown;private stopChipAliasEvent;private toggleReason;private onCommentInput;private onCommentFocus;private onCommentBlur;private setPending;private invalidatePendingSubmission;private isCurrentPendingSubmission;private canSettleWithoutSubmissionId;private scheduleSettlementFocus;private ownsSettlementFocus;private settlePendingSubmission;private commitSettlement;
110
+ click():void;private get detailReasons();private get detailCommentable();private get currentDetailProjection();private get hasDetailContent();private detailApplies;requestUpdate(name?:PropertyKey,oldValue?:unknown,options?:PropertyDeclaration):void;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected willUpdate(changed:PropertyValues<this>):void;protected updated(changed:PropertyValues<this>):void;private setRatingFromInteraction;private activateThumb;private focusActiveThumb;private closePanel;private onPanelKeyDown;private stopChipAliasEvent;private toggleReason;private reconcileReasons;private get commentExceedsLimit();private get commentErrorText();private onCommentInput;private onCommentFocus;private onCommentBlur;private setPending;private invalidatePendingSubmission;private isCurrentPendingSubmission;private canSettleWithoutSubmissionId;private scheduleSettlementFocus;private ownsSettlementFocus;private settlePendingSubmission;private commitSettlement;
103
111
  /** Completes a live held submit. Pass its event `submissionId`; a no-argument call is retained
104
112
  * only for this instance's never-invalidated first transaction. Returns whether this call won. */
105
113
  finalizePendingSubmit(submissionId?:string):boolean;
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{thumbIcon}from"../../../internal/icons.js";import{nextId}from"../../../internal/a11y.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{composedContains}from"../../../internal/overlay-stack.js";import{getOwnDataDescriptor,isObjectValue,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{autocorrectConverter,declaredDefaultConverter,normalizeAutocorrect,omittedEmptyStringConverter,trueDefaultSpellcheckConverter}from"../../../internal/converters.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{styles}from"./message-feedback.styles.js";import{leaseTabIndex}from"../../../internal/roving-toolbar.js";import{LYRA_DEFAULT_feedbackCommentLabel,LYRA_DEFAULT_feedbackCommentPlaceholder,LYRA_DEFAULT_feedbackNegative,LYRA_DEFAULT_feedbackPositive,LYRA_DEFAULT_feedbackReasonsLabel,LYRA_DEFAULT_feedbackSubmit,LYRA_DEFAULT_feedbackSubmitted}from"../../../internal/default-strings/conversation.generated.js";const MAX_PROJECTED_FEEDBACK_REASONS=1e4,EMPTY_FEEDBACK_DETAIL_PROJECTION=Object.freeze({reasons:Object.freeze([]),commentable:!1});function isArrayValue(value){try{return Array.isArray(value)}catch{return!1}}function projectFeedbackDetail(detail){if(!isObjectValue(detail))return EMPTY_FEEDBACK_DETAIL_PROJECTION;const reasonsDescriptor=getOwnDataDescriptor(detail,"reasons"),commentableDescriptor=getOwnDataDescriptor(detail,"commentable"),commentable=commentableDescriptor!==MISSING_OWN_DATA_DESCRIPTOR&&commentableDescriptor!==UNSAFE_OWN_DATA_DESCRIPTOR&&commentableDescriptor.value===!0,reasonsValue=reasonsDescriptor!==MISSING_OWN_DATA_DESCRIPTOR&&reasonsDescriptor!==UNSAFE_OWN_DATA_DESCRIPTOR?reasonsDescriptor.value:void 0;if(!isArrayValue(reasonsValue))return commentable?Object.freeze({reasons:Object.freeze([]),commentable}):EMPTY_FEEDBACK_DETAIL_PROJECTION;const lengthDescriptor=getOwnDataDescriptor(reasonsValue,"length");if(lengthDescriptor===MISSING_OWN_DATA_DESCRIPTOR||lengthDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof lengthDescriptor.value!="number"||!Number.isSafeInteger(lengthDescriptor.value)||lengthDescriptor.value<0)return commentable?Object.freeze({reasons:Object.freeze([]),commentable}):EMPTY_FEEDBACK_DETAIL_PROJECTION;const reasons=[],seen=new Set,length=Math.min(lengthDescriptor.value,MAX_PROJECTED_FEEDBACK_REASONS);for(let index=0;index<length;index+=1){const rowDescriptor=getOwnDataDescriptor(reasonsValue,String(index));if(rowDescriptor===MISSING_OWN_DATA_DESCRIPTOR||rowDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!isObjectValue(rowDescriptor.value))continue;const row=rowDescriptor.value,idDescriptor=getOwnDataDescriptor(row,"id"),labelDescriptor=getOwnDataDescriptor(row,"label");if(idDescriptor===MISSING_OWN_DATA_DESCRIPTOR||idDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||labelDescriptor===MISSING_OWN_DATA_DESCRIPTOR||labelDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof idDescriptor.value!="string"||typeof labelDescriptor.value!="string")continue;const id=idDescriptor.value,label=labelDescriptor.value;id.trim().length===0||seen.has(id)||(seen.add(id),reasons.push(Object.freeze({id,label})))}return Object.freeze({reasons:Object.freeze(reasons),commentable})}class LyraMessageFeedback extends LyraElement{constructor(){super(...arguments),this.rating=null,this.detailFor="down",this.disabled=!1,this.pending=!1,this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.wrap="soft",this.panelOpen=!1,this.selectedReasonIds=[],this.commentDraft="",this.detailProjectionSource=Symbol("unprojected-feedback-detail"),this.detailProjection=EMPTY_FEEDBACK_DETAIL_PROJECTION,this.submissionSequence=0,this.submissionCount=0,this.legacyNoArgumentSettlementInvalidated=!1,this.lifecycleGeneration=0,this.focusGeneration=0,this.settingPending=!1,this.panelId=nextId("message-feedback-panel"),this.upToolbarAction=this.createToolbarAction("up"),this.downToolbarAction=this.createToolbarAction("down"),this.onPanelKeyDown=e=>{e.key==="Escape"&&(e.stopPropagation(),this.closePanel())},this.stopChipAliasEvent=event=>{event.stopPropagation()},this.onCommentInput=e=>{this.commentDraft=e.target.value},this.onCommentFocus=event=>{relayNativeEvent(this,event)},this.onCommentBlur=event=>{relayNativeEvent(this,event)},this.submissionRequestDispatching=!1,this.onSubmit=()=>{if(this.disabled||this.pending||!this.rating||!this.panelOpen)return;const validReasonIds=new Set(this.detailReasons.map(reason=>reason.id));this.requestSubmission({rating:this.rating,reasonIds:this.selectedReasonIds.filter(id=>validReasonIds.has(id)),comment:this.detailCommentable?this.commentDraft.trim():""},this.rating,!0)}}static{this.defaultStrings={...super.defaultStrings,feedbackCommentLabel:LYRA_DEFAULT_feedbackCommentLabel,feedbackCommentPlaceholder:LYRA_DEFAULT_feedbackCommentPlaceholder,feedbackNegative:LYRA_DEFAULT_feedbackNegative,feedbackPositive:LYRA_DEFAULT_feedbackPositive,feedbackReasonsLabel:LYRA_DEFAULT_feedbackReasonsLabel,feedbackSubmit:LYRA_DEFAULT_feedbackSubmit,feedbackSubmitted:LYRA_DEFAULT_feedbackSubmitted}}emitFeedbackSubmitRequest(detail){return this.emit("lr-feedback-submit-request",Object.freeze(detail),{cancelable:!0})}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["detail"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-feedback-submit-request"])}get autocorrect(){return this.autocorrectValue}set autocorrect(next){const previous=this.autocorrectValue;this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate("autocorrect",previous)}createToolbarAction(direction){const host=this,button=()=>direction==="up"?host.upButtonEl:host.downButtonEl,tabIndexLease=leaseTabIndex();return{id:direction,get disabled(){return!button()||button().disabled},focus(options){button()?.focus(options)},setTabIndex(tabIndex){tabIndexLease.set(button(),tabIndex)},releaseTabIndex:()=>tabIndexLease.release(),matchesEventPath(path){const target=button();return target!==void 0&&path.includes(target)}}}getToolbarActions(){return[this.upToolbarAction,this.downToolbarAction]}focus(options){(this.rating==="down"?this.downButtonEl:this.upButtonEl)?.focus(options)}blur(){this.upButtonEl?.blur(),this.downButtonEl?.blur()}click(){this.disabled||this.pending||(this.rating==="down"?this.downButtonEl:this.upButtonEl)?.click()}get detailReasons(){return this.currentDetailProjection.reasons}get detailCommentable(){return this.currentDetailProjection.commentable}get currentDetailProjection(){const detail=this.detail;return detail!==this.detailProjectionSource&&(this.detailProjectionSource=detail,this.detailProjection=projectFeedbackDetail(detail)),this.detailProjection}get hasDetailContent(){return this.detailReasons.length>0||this.detailCommentable}detailApplies(direction){return this.detailFor==="both"||this.detailFor===direction}requestUpdate(name,oldValue,options){const currentValue=name==="rating"?this.rating:name==="detail"?this.detail:name==="detailFor"?this.detailFor:name==="pending"?this.pending:void 0,changed=oldValue!==currentValue,internalRatingWrite=name==="rating"&&this.pendingInternalRating?.rating===this.rating;changed&&(name==="rating"||name==="detail"||name==="detailFor"||name==="pending")&&!(name==="rating"&&internalRatingWrite)&&(this.focusGeneration=(this.focusGeneration??0)+1,this.pendingSubmission&&(name!=="pending"||!this.settingPending&&this.pending===!1)&&this.invalidatePendingSubmission()),super.requestUpdate(name,oldValue,options)}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})}disconnectedCallback(){this.sink?.release(),this.sink=void 0,this.lifecycleGeneration+=1,this.invalidatePendingSubmission(),this.upToolbarAction.releaseTabIndex?.(),this.downToolbarAction.releaseTabIndex?.(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.lifecycleGeneration+=1,this.invalidatePendingSubmission(),this.upToolbarAction.releaseTabIndex?.(),this.downToolbarAction.releaseTabIndex?.()}willUpdate(changed){if(super.willUpdate(changed),changed.has("rating")){const internal=this.pendingInternalRating?.rating===this.rating;this.pendingInternalRating=void 0,internal||(this.invalidatePendingSubmission(),this.setPending(!1),this.panelOpen=!1,this.selectedReasonIds=[],this.commentDraft="")}if(changed.has("detail")){const validIds=new Set(this.detailReasons.map(reason=>reason.id));this.selectedReasonIds=this.selectedReasonIds.filter(id=>validIds.has(id)),this.detailCommentable||(this.commentDraft="")}this.panelOpen&&(!this.rating||!this.detailApplies(this.rating)||!this.hasDetailContent)&&(this.invalidatePendingSubmission(),this.setPending(!1),this.panelOpen=!1,changed.has("detailFor")&&(this.selectedReasonIds=[],this.commentDraft=""))}updated(changed){super.updated(changed),(changed.has("disabled")||changed.has("pending"))&&this.emit("lr-toolbar-actions-change")}setRatingFromInteraction(rating){this.pendingInternalRating={rating},this.rating=rating}activateThumb(next){if(this.disabled||this.pending)return;const previousRating=this.rating;if(this.rating===next){if(this.panelOpen){this.setRatingFromInteraction(null),this.panelOpen=!1,this.selectedReasonIds=[],this.commentDraft="",this.emit("lr-feedback-change",{rating:null}),this.requestSubmission({rating:null,reasonIds:[],comment:""},previousRating,!0);return}if(this.detailApplies(next)&&this.hasDetailContent){this.panelOpen=!0;return}this.setRatingFromInteraction(null),this.emit("lr-feedback-change",{rating:null}),this.requestSubmission({rating:null,reasonIds:[],comment:""},previousRating,!1);return}this.selectedReasonIds=[],this.commentDraft="",this.setRatingFromInteraction(next),this.panelOpen=this.detailApplies(next)&&this.hasDetailContent,this.emit("lr-feedback-change",{rating:next}),this.panelOpen||this.requestSubmission({rating:next,reasonIds:[],comment:""},previousRating,!1)}focusActiveThumb(){(this.rating==="down"?this.downButtonEl:this.upButtonEl)?.focus()}closePanel(){this.panelOpen&&(this.panelOpen=!1,this.focusActiveThumb())}toggleReason(id,event){if(this.disabled||this.pending||event.defaultPrevented){event.preventDefault();return}this.selectedReasonIds=this.selectedReasonIds.includes(id)?this.selectedReasonIds.filter(r=>r!==id):[...this.selectedReasonIds,id]}setPending(pending){this.settingPending=!0,this.pending=pending,this.settingPending=!1}invalidatePendingSubmission(){const transaction=this.pendingSubmission;transaction&&(this.pendingSubmission=void 0,this.dispatchingSubmission===transaction&&(this.dispatchingSubmission=void 0),this.legacyNoArgumentSettlementInvalidated=!0,this.focusGeneration+=1,this.setPending(!1))}isCurrentPendingSubmission(transaction){return this.pendingSubmission===transaction&&this.pending&&this.isConnected&&transaction.lifecycleGeneration===this.lifecycleGeneration&&transaction.rating===this.rating&&transaction.detail===this.detail&&transaction.detailFor===this.detailFor?!0:(this.pendingSubmission===transaction&&this.invalidatePendingSubmission(),!1)}canSettleWithoutSubmissionId(transaction){return!this.legacyNoArgumentSettlementInvalidated&&this.submissionCount===1&&transaction.sequence===1}scheduleSettlementFocus(transaction,destination){const focusGeneration=++this.focusGeneration,lifecycleGeneration=transaction.lifecycleGeneration;this.ownsSettlementFocus()&&this.updateComplete.then(()=>{focusGeneration!==this.focusGeneration||lifecycleGeneration!==this.lifecycleGeneration||!this.isConnected||this.pending||this.pendingSubmission||!this.ownsSettlementFocus()||(destination==="submit"&&this.panelOpen?this.submitButtonEl?.focus():this.focusActiveThumb())})}ownsSettlementFocus(){const doc=this.ownerDocument,active=deepActiveElementIn(doc);return active===null||active===doc.body||active===doc.documentElement||composedContains(this,active)}settlePendingSubmission(settlement,submissionId){const transaction=this.pendingSubmission;if(!transaction||!this.isCurrentPendingSubmission(transaction))return!1;if(submissionId===void 0){if(!this.canSettleWithoutSubmissionId(transaction))return!1}else if(submissionId!==transaction.submissionId)return!1;return transaction.settlement?!1:this.dispatchingSubmission===transaction?(transaction.settlement=settlement,!0):(this.commitSettlement(transaction,settlement),!0)}commitSettlement(transaction,settlement){if(this.isCurrentPendingSubmission(transaction)){if(this.pendingSubmission=void 0,this.dispatchingSubmission===transaction&&(this.dispatchingSubmission=void 0),this.setPending(!1),settlement==="finalize"){this.panelOpen=!1,this.sink?.announce(this.localize("feedbackSubmitted")),this.scheduleSettlementFocus(transaction,"thumb");return}this.setRatingFromInteraction(transaction.previousRating),this.panelOpen=transaction.panelWasOpen,this.scheduleSettlementFocus(transaction,transaction.panelWasOpen?"submit":"thumb")}}finalizePendingSubmit(submissionId){return this.settlePendingSubmission("finalize",submissionId)}revertPendingSubmit(submissionId){return this.settlePendingSubmission("revert",submissionId)}requestSubmission(detail,previousRating,panelWasOpen){if(!this.submissionRequestDispatching){this.submissionRequestDispatching=!0;try{this.focusGeneration+=1;const sequence=++this.submissionSequence;this.submissionCount+=1;const transaction={submissionId:nextId("message-feedback-submission"),sequence,lifecycleGeneration:this.lifecycleGeneration,rating:this.rating,detail:this.detail,detailFor:this.detailFor,previousRating,panelWasOpen};this.pendingSubmission=transaction,this.setPending(!0),this.dispatchingSubmission=transaction;const event=this.emitFeedbackSubmitRequest({...detail,submissionId:transaction.submissionId});if(this.dispatchingSubmission===transaction&&(this.dispatchingSubmission=void 0),!this.isCurrentPendingSubmission(transaction))return;if(transaction.settlement){this.commitSettlement(transaction,transaction.settlement);return}event.defaultPrevented||this.commitSettlement(transaction,"finalize")}finally{this.submissionRequestDispatching=!1}}}renderThumb(direction){const pressed=this.rating===direction,canExpand=this.detailApplies(direction)&&this.hasDetailContent;return html`
1
+ import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{normalizeLengthLimit}from"../../../internal/length-constraints.js";import{nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{thumbIcon}from"../../../internal/icons.js";import{nextId}from"../../../internal/a11y.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{composedContains}from"../../../internal/overlay-stack.js";import{getOwnDataDescriptor,isObjectValue,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{autocorrectConverter,declaredDefaultConverter,normalizeAutocorrect,omittedEmptyStringConverter,trueDefaultSpellcheckConverter}from"../../../internal/converters.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{styles}from"./message-feedback.styles.js";import{leaseTabIndex}from"../../../internal/roving-toolbar.js";import{LYRA_DEFAULT_feedbackCommentLabel,LYRA_DEFAULT_feedbackCommentPlaceholder,LYRA_DEFAULT_feedbackCommentTooLong,LYRA_DEFAULT_feedbackNegative,LYRA_DEFAULT_feedbackPositive,LYRA_DEFAULT_feedbackReasonsLabel,LYRA_DEFAULT_feedbackSingleReasonDescription,LYRA_DEFAULT_feedbackSubmit,LYRA_DEFAULT_feedbackSubmitted}from"../../../internal/default-strings/conversation.generated.js";const MAX_PROJECTED_FEEDBACK_REASONS=1e4,EMPTY_FEEDBACK_DETAIL_PROJECTION=Object.freeze({reasons:Object.freeze([]),commentable:!1,reasonSelection:"multiple",commentMaxLength:void 0});function isArrayValue(value){try{return Array.isArray(value)}catch{return!1}}function projectFeedbackDetail(detail){if(!isObjectValue(detail))return EMPTY_FEEDBACK_DETAIL_PROJECTION;const selectionDescriptor=getOwnDataDescriptor(detail,"reasonSelection"),limitDescriptor=getOwnDataDescriptor(detail,"commentMaxLength"),reasonSelection=selectionDescriptor!==MISSING_OWN_DATA_DESCRIPTOR&&selectionDescriptor!==UNSAFE_OWN_DATA_DESCRIPTOR&&selectionDescriptor.value==="single"?"single":"multiple",commentMaxLength=limitDescriptor!==MISSING_OWN_DATA_DESCRIPTOR&&limitDescriptor!==UNSAFE_OWN_DATA_DESCRIPTOR?normalizeLengthLimit(limitDescriptor.value):void 0,reasonsDescriptor=getOwnDataDescriptor(detail,"reasons"),commentableDescriptor=getOwnDataDescriptor(detail,"commentable"),commentable=commentableDescriptor!==MISSING_OWN_DATA_DESCRIPTOR&&commentableDescriptor!==UNSAFE_OWN_DATA_DESCRIPTOR&&commentableDescriptor.value===!0,reasonsValue=reasonsDescriptor!==MISSING_OWN_DATA_DESCRIPTOR&&reasonsDescriptor!==UNSAFE_OWN_DATA_DESCRIPTOR?reasonsDescriptor.value:void 0;if(!isArrayValue(reasonsValue))return Object.freeze({reasons:Object.freeze([]),commentable,reasonSelection,commentMaxLength});const lengthDescriptor=getOwnDataDescriptor(reasonsValue,"length");if(lengthDescriptor===MISSING_OWN_DATA_DESCRIPTOR||lengthDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof lengthDescriptor.value!="number"||!Number.isSafeInteger(lengthDescriptor.value)||lengthDescriptor.value<0)return Object.freeze({reasons:Object.freeze([]),commentable,reasonSelection,commentMaxLength});const reasons=[],seen=new Set,length=Math.min(lengthDescriptor.value,MAX_PROJECTED_FEEDBACK_REASONS);for(let index=0;index<length;index+=1){const rowDescriptor=getOwnDataDescriptor(reasonsValue,String(index));if(rowDescriptor===MISSING_OWN_DATA_DESCRIPTOR||rowDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||!isObjectValue(rowDescriptor.value))continue;const row=rowDescriptor.value,idDescriptor=getOwnDataDescriptor(row,"id"),labelDescriptor=getOwnDataDescriptor(row,"label");if(idDescriptor===MISSING_OWN_DATA_DESCRIPTOR||idDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||labelDescriptor===MISSING_OWN_DATA_DESCRIPTOR||labelDescriptor===UNSAFE_OWN_DATA_DESCRIPTOR||typeof idDescriptor.value!="string"||typeof labelDescriptor.value!="string")continue;const id=idDescriptor.value,label=labelDescriptor.value;id.trim().length===0||seen.has(id)||(seen.add(id),reasons.push(Object.freeze({id,label})))}return Object.freeze({reasons:Object.freeze(reasons),commentable,reasonSelection,commentMaxLength})}class LyraMessageFeedback extends LyraElement{constructor(){super(...arguments),this.rating=null,this.detailFor="down",this.disabled=!1,this.pending=!1,this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.wrap="soft",this.panelOpen=!1,this.selectedReasonIds=[],this.commentDraft="",this.commentLengthError=!1,this.detailProjectionSource=Symbol("unprojected-feedback-detail"),this.detailProjection=EMPTY_FEEDBACK_DETAIL_PROJECTION,this.submissionSequence=0,this.submissionCount=0,this.legacyNoArgumentSettlementInvalidated=!1,this.lifecycleGeneration=0,this.focusGeneration=0,this.settingPending=!1,this.panelId=nextId("message-feedback-panel"),this.reasonDescriptionId=nextId("message-feedback-reason-description"),this.commentErrorId=nextId("message-feedback-comment-error"),this.upToolbarAction=this.createToolbarAction("up"),this.downToolbarAction=this.createToolbarAction("down"),this.onPanelKeyDown=e=>{e.key==="Escape"&&(e.stopPropagation(),this.closePanel())},this.stopChipAliasEvent=event=>{event.stopPropagation()},this.onCommentInput=e=>{this.disabled||this.pending||!this.panelOpen||!this.detailCommentable||(this.commentDraft=e.target.value,this.commentExceedsLimit||(this.commentLengthError=!1))},this.onCommentFocus=event=>{relayNativeEvent(this,event)},this.onCommentBlur=event=>{relayNativeEvent(this,event)},this.submissionRequestDispatching=!1,this.onSubmit=()=>{if(this.disabled||this.pending||!this.rating||!this.panelOpen)return;if(this.commentExceedsLimit){this.commentLengthError=!0,this.sink?.announce(this.commentErrorText);return}this.reconcileReasons();const validReasonIds=new Set(this.detailReasons.map(reason=>reason.id));this.requestSubmission({rating:this.rating,reasonIds:this.selectedReasonIds.filter(id=>validReasonIds.has(id)),comment:this.detailCommentable?this.commentDraft.trim():""},this.rating,!0)}}static{this.defaultStrings={...super.defaultStrings,feedbackCommentLabel:LYRA_DEFAULT_feedbackCommentLabel,feedbackCommentPlaceholder:LYRA_DEFAULT_feedbackCommentPlaceholder,feedbackCommentTooLong:LYRA_DEFAULT_feedbackCommentTooLong,feedbackNegative:LYRA_DEFAULT_feedbackNegative,feedbackPositive:LYRA_DEFAULT_feedbackPositive,feedbackReasonsLabel:LYRA_DEFAULT_feedbackReasonsLabel,feedbackSingleReasonDescription:LYRA_DEFAULT_feedbackSingleReasonDescription,feedbackSubmit:LYRA_DEFAULT_feedbackSubmit,feedbackSubmitted:LYRA_DEFAULT_feedbackSubmitted}}emitFeedbackSubmitRequest(detail){return this.emit("lr-feedback-submit-request",Object.freeze(detail),{cancelable:!0})}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["detail"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-feedback-submit-request"])}get autocorrect(){return this.autocorrectValue}set autocorrect(next){const previous=this.autocorrectValue;this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate("autocorrect",previous)}createToolbarAction(direction){const host=this,button=()=>direction==="up"?host.upButtonEl:host.downButtonEl,tabIndexLease=leaseTabIndex();return{id:direction,get disabled(){return!button()||button().disabled},focus(options){button()?.focus(options)},setTabIndex(tabIndex){tabIndexLease.set(button(),tabIndex)},releaseTabIndex:()=>tabIndexLease.release(),matchesEventPath(path){const target=button();return target!==void 0&&path.includes(target)}}}getToolbarActions(){return[this.upToolbarAction,this.downToolbarAction]}focus(options){(this.rating==="down"?this.downButtonEl:this.upButtonEl)?.focus(options)}blur(){this.upButtonEl?.blur(),this.downButtonEl?.blur()}click(){this.disabled||this.pending||(this.rating==="down"?this.downButtonEl:this.upButtonEl)?.click()}get detailReasons(){return this.currentDetailProjection.reasons}get detailCommentable(){return this.currentDetailProjection.commentable}get currentDetailProjection(){const detail=this.detail;return detail!==this.detailProjectionSource&&(this.detailProjectionSource=detail,this.detailProjection=projectFeedbackDetail(detail)),this.detailProjection}get hasDetailContent(){return this.detailReasons.length>0||this.detailCommentable}detailApplies(direction){return this.detailFor==="both"||this.detailFor===direction}requestUpdate(name,oldValue,options){const currentValue=name==="rating"?this.rating:name==="detail"?this.detail:name==="detailFor"?this.detailFor:name==="pending"?this.pending:void 0,changed=oldValue!==currentValue,internalRatingWrite=name==="rating"&&this.pendingInternalRating?.rating===this.rating;changed&&(name==="rating"||name==="detail"||name==="detailFor"||name==="pending")&&!(name==="rating"&&internalRatingWrite)&&(this.focusGeneration=(this.focusGeneration??0)+1,this.pendingSubmission&&(name!=="pending"||!this.settingPending&&this.pending===!1)&&this.invalidatePendingSubmission()),super.requestUpdate(name,oldValue,options)}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})}disconnectedCallback(){this.sink?.release(),this.sink=void 0,this.lifecycleGeneration+=1,this.invalidatePendingSubmission(),this.upToolbarAction.releaseTabIndex?.(),this.downToolbarAction.releaseTabIndex?.(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.lifecycleGeneration+=1,this.invalidatePendingSubmission(),this.upToolbarAction.releaseTabIndex?.(),this.downToolbarAction.releaseTabIndex?.()}willUpdate(changed){if(super.willUpdate(changed),changed.has("rating")){const internal=this.pendingInternalRating?.rating===this.rating;this.pendingInternalRating=void 0,internal||(this.invalidatePendingSubmission(),this.setPending(!1),this.panelOpen=!1,this.selectedReasonIds=[],this.commentDraft="")}if(changed.has("detail")){const validIds=new Set(this.detailReasons.map(reason=>reason.id));this.selectedReasonIds=this.selectedReasonIds.filter(id=>validIds.has(id)),this.currentDetailProjection.reasonSelection==="single"&&(this.selectedReasonIds=this.selectedReasonIds.slice(-1)),this.detailCommentable||(this.commentDraft="")}this.commentExceedsLimit||(this.commentLengthError=!1),this.panelOpen&&(!this.rating||!this.detailApplies(this.rating)||!this.hasDetailContent)&&(this.invalidatePendingSubmission(),this.setPending(!1),this.panelOpen=!1,changed.has("detailFor")&&(this.selectedReasonIds=[],this.commentDraft=""))}updated(changed){super.updated(changed),(changed.has("disabled")||changed.has("pending"))&&this.emit("lr-toolbar-actions-change")}setRatingFromInteraction(rating){this.pendingInternalRating={rating},this.rating=rating}activateThumb(next){if(this.disabled||this.pending)return;const previousRating=this.rating;if(this.rating===next){if(this.panelOpen){this.setRatingFromInteraction(null),this.panelOpen=!1,this.selectedReasonIds=[],this.commentDraft="",this.emit("lr-feedback-change",{rating:null}),this.requestSubmission({rating:null,reasonIds:[],comment:""},previousRating,!0);return}if(this.detailApplies(next)&&this.hasDetailContent){this.panelOpen=!0;return}this.setRatingFromInteraction(null),this.emit("lr-feedback-change",{rating:null}),this.requestSubmission({rating:null,reasonIds:[],comment:""},previousRating,!1);return}this.selectedReasonIds=[],this.commentDraft="",this.setRatingFromInteraction(next),this.panelOpen=this.detailApplies(next)&&this.hasDetailContent,this.emit("lr-feedback-change",{rating:next}),this.panelOpen||this.requestSubmission({rating:next,reasonIds:[],comment:""},previousRating,!1)}focusActiveThumb(){(this.rating==="down"?this.downButtonEl:this.upButtonEl)?.focus()}closePanel(){this.panelOpen&&(this.panelOpen=!1,this.focusActiveThumb())}toggleReason(id,event,detail){if(this.disabled||this.pending||event.defaultPrevented||detail!==this.detail||!this.panelOpen||!this.detailReasons.some(reason=>reason.id===id)){event.preventDefault();return}this.reconcileReasons(),this.selectedReasonIds=this.selectedReasonIds.includes(id)?this.selectedReasonIds.filter(r=>r!==id):this.currentDetailProjection.reasonSelection==="single"?[id]:[...this.selectedReasonIds,id]}reconcileReasons(){const validIds=new Set(this.detailReasons.map(reason=>reason.id)),selected=this.selectedReasonIds.filter(id=>validIds.has(id));this.selectedReasonIds=this.currentDetailProjection.reasonSelection==="single"?selected.slice(-1):selected}get commentExceedsLimit(){const limit=this.currentDetailProjection.commentMaxLength;return this.detailCommentable&&limit!==void 0&&this.commentDraft.length>limit}get commentErrorText(){return this.localize("feedbackCommentTooLong",void 0,{max:this.currentDetailProjection.commentMaxLength??0})}setPending(pending){this.settingPending=!0,this.pending=pending,this.settingPending=!1}invalidatePendingSubmission(){const transaction=this.pendingSubmission;transaction&&(this.pendingSubmission=void 0,this.dispatchingSubmission===transaction&&(this.dispatchingSubmission=void 0),this.legacyNoArgumentSettlementInvalidated=!0,this.focusGeneration+=1,this.setPending(!1))}isCurrentPendingSubmission(transaction){return this.pendingSubmission===transaction&&this.pending&&this.isConnected&&transaction.lifecycleGeneration===this.lifecycleGeneration&&transaction.rating===this.rating&&transaction.detail===this.detail&&transaction.detailFor===this.detailFor?!0:(this.pendingSubmission===transaction&&this.invalidatePendingSubmission(),!1)}canSettleWithoutSubmissionId(transaction){return!this.legacyNoArgumentSettlementInvalidated&&this.submissionCount===1&&transaction.sequence===1}scheduleSettlementFocus(transaction,destination){const focusGeneration=++this.focusGeneration,lifecycleGeneration=transaction.lifecycleGeneration;this.ownsSettlementFocus()&&this.updateComplete.then(()=>{focusGeneration!==this.focusGeneration||lifecycleGeneration!==this.lifecycleGeneration||!this.isConnected||this.pending||this.pendingSubmission||!this.ownsSettlementFocus()||(destination==="submit"&&this.panelOpen?this.submitButtonEl?.focus():this.focusActiveThumb())})}ownsSettlementFocus(){const doc=this.ownerDocument,active=deepActiveElementIn(doc);return active===null||active===doc.body||active===doc.documentElement||composedContains(this,active)}settlePendingSubmission(settlement,submissionId){const transaction=this.pendingSubmission;if(!transaction||!this.isCurrentPendingSubmission(transaction))return!1;if(submissionId===void 0){if(!this.canSettleWithoutSubmissionId(transaction))return!1}else if(submissionId!==transaction.submissionId)return!1;return transaction.settlement?!1:this.dispatchingSubmission===transaction?(transaction.settlement=settlement,!0):(this.commitSettlement(transaction,settlement),!0)}commitSettlement(transaction,settlement){if(this.isCurrentPendingSubmission(transaction)){if(this.pendingSubmission=void 0,this.dispatchingSubmission===transaction&&(this.dispatchingSubmission=void 0),this.setPending(!1),settlement==="finalize"){this.panelOpen=!1,this.sink?.announce(this.localize("feedbackSubmitted")),this.scheduleSettlementFocus(transaction,"thumb");return}this.setRatingFromInteraction(transaction.previousRating),this.panelOpen=transaction.panelWasOpen,this.scheduleSettlementFocus(transaction,transaction.panelWasOpen?"submit":"thumb")}}finalizePendingSubmit(submissionId){return this.settlePendingSubmission("finalize",submissionId)}revertPendingSubmit(submissionId){return this.settlePendingSubmission("revert",submissionId)}requestSubmission(detail,previousRating,panelWasOpen){if(!this.submissionRequestDispatching){this.submissionRequestDispatching=!0;try{this.focusGeneration+=1;const sequence=++this.submissionSequence;this.submissionCount+=1;const transaction={submissionId:nextId("message-feedback-submission"),sequence,lifecycleGeneration:this.lifecycleGeneration,rating:this.rating,detail:this.detail,detailFor:this.detailFor,previousRating,panelWasOpen};this.pendingSubmission=transaction,this.setPending(!0),this.dispatchingSubmission=transaction;const event=this.emitFeedbackSubmitRequest({...detail,submissionId:transaction.submissionId});if(this.dispatchingSubmission===transaction&&(this.dispatchingSubmission=void 0),!this.isCurrentPendingSubmission(transaction))return;if(transaction.settlement){this.commitSettlement(transaction,transaction.settlement);return}event.defaultPrevented||this.commitSettlement(transaction,"finalize")}finally{this.submissionRequestDispatching=!1}}}renderThumb(direction){const pressed=this.rating===direction,canExpand=this.detailApplies(direction)&&this.hasDetailContent;return html`
2
2
  <button
3
3
  part=${direction==="up"?"up-button":"down-button"}
4
4
  type="button"
@@ -11,7 +11,7 @@ import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/nat
11
11
  >
12
12
  ${thumbIcon(direction,pressed)}
13
13
  </button>
14
- `}render(){const selectedReasons=new Set(this.selectedReasonIds);return html`
14
+ `}render(){const selectedReasons=new Set(this.selectedReasonIds),renderedDetail=this.detail,singleReason=this.currentDetailProjection.reasonSelection==="single";return html`
15
15
  <div part="base">
16
16
  <div part="thumbs">${this.renderThumb("up")}${this.renderThumb("down")}</div>
17
17
  ${this.hasDetailContent?html`
@@ -26,13 +26,15 @@ import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/nat
26
26
  >
27
27
  <div class="panel-inner">
28
28
  ${this.detailReasons.length>0?html`
29
- <div part="reasons" role="group" aria-label=${this.localize("feedbackReasonsLabel")}>
29
+ ${singleReason?html`<span id=${this.reasonDescriptionId} class="reason-description">${this.localize("feedbackSingleReasonDescription")}</span>`:nothing}
30
+ <div part="reasons" role="group" aria-label=${this.localize("feedbackReasonsLabel")}
31
+ aria-describedby=${singleReason?this.reasonDescriptionId:nothing}>
30
32
  ${this.detailReasons.map(reason=>html`
31
33
  <lr-chip
32
34
  toggleable
33
- ?selected=${selectedReasons.has(reason.id)}
35
+ .selected=${selectedReasons.has(reason.id)}
34
36
  .disabled=${this.disabled||this.pending}
35
- @lr-chip-toggle-request=${event=>{event.stopPropagation(),this.toggleReason(reason.id,event)}}
37
+ @lr-chip-toggle-request=${event=>{event.stopPropagation(),this.toggleReason(reason.id,event,renderedDetail)}}
36
38
  @lr-chip-select=${this.stopChipAliasEvent}
37
39
  >${reason.label}</lr-chip
38
40
  >
@@ -48,12 +50,16 @@ import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/nat
48
50
  autocapitalize=${this.autocapitalize||nothing}
49
51
  autocorrect=${nativeAutocorrectAttribute(this,this.autocorrect)}
50
52
  wrap=${this.wrap}
53
+ maxlength=${this.currentDetailProjection.commentMaxLength??nothing}
54
+ aria-invalid=${this.commentLengthError?"true":"false"}
55
+ aria-describedby=${this.commentLengthError?this.commentErrorId:nothing}
51
56
  .value=${this.commentDraft}
52
57
  ?disabled=${this.disabled||this.pending}
53
58
  @input=${this.onCommentInput}
54
59
  @focus=${this.onCommentFocus}
55
60
  @blur=${this.onCommentBlur}
56
61
  ></textarea>
62
+ ${this.commentLengthError?html`<div part="comment-error" id=${this.commentErrorId}>${this.commentErrorText}</div>`:nothing}
57
63
  `:nothing}
58
64
  <button
59
65
  part="submit-button"
@@ -67,4 +73,4 @@ import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/nat
67
73
  </div>
68
74
  `:nothing}
69
75
  </div>
70
- `}}__decorate([property({reflect:!0})],LyraMessageFeedback.prototype,"rating",void 0),__decorate([property({attribute:!1})],LyraMessageFeedback.prototype,"detail",void 0),__decorate([property({attribute:"detail-for"})],LyraMessageFeedback.prototype,"detailFor",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMessageFeedback.prototype,"disabled",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMessageFeedback.prototype,"pending",void 0),__decorate([property({converter:trueDefaultSpellcheckConverter})],LyraMessageFeedback.prototype,"spellcheck",void 0),__decorate([property({converter:omittedEmptyStringConverter})],LyraMessageFeedback.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraMessageFeedback.prototype,"autocorrect",null),__decorate([property({converter:declaredDefaultConverter("soft")})],LyraMessageFeedback.prototype,"wrap",void 0),__decorate([state()],LyraMessageFeedback.prototype,"panelOpen",void 0),__decorate([state()],LyraMessageFeedback.prototype,"selectedReasonIds",void 0),__decorate([state()],LyraMessageFeedback.prototype,"commentDraft",void 0),__decorate([query('[part="up-button"]')],LyraMessageFeedback.prototype,"upButtonEl",void 0),__decorate([query('[part="down-button"]')],LyraMessageFeedback.prototype,"downButtonEl",void 0),__decorate([query('[part="submit-button"]')],LyraMessageFeedback.prototype,"submitButtonEl",void 0);export{LyraMessageFeedback};
76
+ `}}__decorate([property({reflect:!0})],LyraMessageFeedback.prototype,"rating",void 0),__decorate([property({attribute:!1})],LyraMessageFeedback.prototype,"detail",void 0),__decorate([property({attribute:"detail-for"})],LyraMessageFeedback.prototype,"detailFor",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMessageFeedback.prototype,"disabled",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraMessageFeedback.prototype,"pending",void 0),__decorate([property({converter:trueDefaultSpellcheckConverter})],LyraMessageFeedback.prototype,"spellcheck",void 0),__decorate([property({converter:omittedEmptyStringConverter})],LyraMessageFeedback.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraMessageFeedback.prototype,"autocorrect",null),__decorate([property({converter:declaredDefaultConverter("soft")})],LyraMessageFeedback.prototype,"wrap",void 0),__decorate([state()],LyraMessageFeedback.prototype,"panelOpen",void 0),__decorate([state()],LyraMessageFeedback.prototype,"selectedReasonIds",void 0),__decorate([state()],LyraMessageFeedback.prototype,"commentDraft",void 0),__decorate([state()],LyraMessageFeedback.prototype,"commentLengthError",void 0),__decorate([query('[part="up-button"]')],LyraMessageFeedback.prototype,"upButtonEl",void 0),__decorate([query('[part="down-button"]')],LyraMessageFeedback.prototype,"downButtonEl",void 0),__decorate([query('[part="submit-button"]')],LyraMessageFeedback.prototype,"submitButtonEl",void 0);export{LyraMessageFeedback};
@@ -1 +1 @@
1
- import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; max-inline-size: 100%; } [part="base"] { display: flex; flex-direction: column; gap: var(--lr-space-xs); } [part="thumbs"] { display: flex; gap: var(--lr-space-2xs); } [part="up-button"], [part="down-button"] { display: inline-flex; align-items: center; justify-content: center; inline-size: var(--lr-size-1-75rem); block-size: var(--lr-size-1-75rem); ${iconHitTarget} padding: 0; font: inherit; border: var(--lr-border-width-thin) solid transparent; border-radius: var(--lr-icon-button-radius, var(--lr-radius)); background: var(--lr-icon-button-bg, transparent); color: var(--lr-icon-button-color, var(--lr-color-text-quiet)); cursor: pointer; } :where([part="up-button"]):hover:where(:not(:disabled)), :where([part="down-button"]):hover:where(:not(:disabled)) { background: var(--lr-icon-button-bg-hover, var(--lr-color-surface-raised)); color: var(--lr-icon-button-color-hover, var(--lr-color-text)); } :where([part="up-button"]):active:where(:not(:disabled)), :where([part="down-button"]):active:where(:not(:disabled)) { background: var( --lr-icon-button-bg-active, color-mix( in oklab, var(--lr-icon-button-bg-hover, var(--lr-color-surface-raised)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); color: var(--lr-icon-button-color-active, var(--lr-icon-button-color-hover, var(--lr-color-text))); } [part="up-button"]:focus-visible, [part="down-button"]:focus-visible { ${focusRing} } [part="up-button"][aria-pressed="true"] { color: var(--lr-message-feedback-up-active-color, var(--lr-color-success)); background: var( --lr-message-feedback-up-active-bg, var(--lr-color-success-quiet) ); border-color: var( --lr-message-feedback-up-active-border, var(--lr-color-success) ); } [part="down-button"][aria-pressed="true"] { color: var(--lr-message-feedback-down-active-color, var(--lr-color-danger)); background: var( --lr-message-feedback-down-active-bg, var(--lr-color-danger-quiet) ); border-color: var( --lr-message-feedback-down-active-border, var(--lr-color-danger) ); } [part="up-button"]:disabled, [part="down-button"]:disabled { cursor: not-allowed; opacity: var(--lr-opacity-disabled); } [part="panel"] { display: grid; grid-template-rows: 0fr; overflow: hidden; border: 0 solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface); transition: grid-template-rows var(--lr-transition-base), border-width var(--lr-transition-base); } [part="panel"]:where([data-open]) { grid-template-rows: 1fr; border-width: var(--lr-border-width-thin); } [part="panel"] .panel-inner { overflow: hidden; min-block-size: 0; display: flex; flex-direction: column; gap: var(--lr-space-s); padding: 0 var(--lr-space-m); transition: padding-block var(--lr-transition-base); } [part="panel"]:where([data-open]) .panel-inner { padding-block: var(--lr-space-m); } @media (prefers-reduced-motion: reduce) { [part="panel"], [part="panel"] .panel-inner { transition: none; } } [part="reasons"] { display: flex; flex-wrap: wrap; gap: var(--lr-space-2xs); } [part="comment"] { box-sizing: border-box; inline-size: 100%; min-block-size: var(--lr-size-2-5rem); padding: var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; resize: vertical; } [part="comment"]:focus-visible { ${focusRing} } :where([part="comment"]):hover:where(:not(:disabled)) { border-color: var(--lr-color-brand); } [part="comment"]::placeholder { color: var(--lr-color-text-quiet); } [part="submit-button"] { box-sizing: border-box; align-self: flex-end; max-inline-size: 100%; padding-inline: var(--lr-space-m); padding-block: var(--lr-space-xs); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-brand); color: var(--lr-color-on-brand); font: inherit; white-space: normal; overflow-wrap: anywhere; cursor: pointer; } :where([part="submit-button"]):hover:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } :where([part="submit-button"]):active:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="submit-button"]:disabled { cursor: not-allowed; opacity: var(--lr-opacity-disabled); } [part="comment"]:disabled { cursor: not-allowed; opacity: var(--lr-opacity-disabled); } [part="submit-button"]:focus-visible { ${focusRing} } `;export{styles};
1
+ import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; max-inline-size: 100%; } [part="base"] { display: flex; flex-direction: column; gap: var(--lr-space-xs); } [part="thumbs"] { display: flex; gap: var(--lr-space-2xs); } [part="up-button"], [part="down-button"] { display: inline-flex; align-items: center; justify-content: center; inline-size: var(--lr-size-1-75rem); block-size: var(--lr-size-1-75rem); ${iconHitTarget} padding: 0; font: inherit; border: var(--lr-border-width-thin) solid transparent; border-radius: var(--lr-icon-button-radius, var(--lr-radius)); background: var(--lr-icon-button-bg, transparent); color: var(--lr-icon-button-color, var(--lr-color-text-quiet)); cursor: pointer; } :where([part="up-button"]):hover:where(:not(:disabled)), :where([part="down-button"]):hover:where(:not(:disabled)) { background: var(--lr-icon-button-bg-hover, var(--lr-color-surface-raised)); color: var(--lr-icon-button-color-hover, var(--lr-color-text)); } :where([part="up-button"]):active:where(:not(:disabled)), :where([part="down-button"]):active:where(:not(:disabled)) { background: var( --lr-icon-button-bg-active, color-mix( in oklab, var(--lr-icon-button-bg-hover, var(--lr-color-surface-raised)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) ); color: var(--lr-icon-button-color-active, var(--lr-icon-button-color-hover, var(--lr-color-text))); } [part="up-button"]:focus-visible, [part="down-button"]:focus-visible { ${focusRing} } [part="up-button"][aria-pressed="true"] { color: var(--lr-message-feedback-up-active-color, var(--lr-color-success)); background: var( --lr-message-feedback-up-active-bg, var(--lr-color-success-quiet) ); border-color: var( --lr-message-feedback-up-active-border, var(--lr-color-success) ); } [part="down-button"][aria-pressed="true"] { color: var(--lr-message-feedback-down-active-color, var(--lr-color-danger)); background: var( --lr-message-feedback-down-active-bg, var(--lr-color-danger-quiet) ); border-color: var( --lr-message-feedback-down-active-border, var(--lr-color-danger) ); } [part="up-button"]:disabled, [part="down-button"]:disabled { cursor: not-allowed; opacity: var(--lr-opacity-disabled); } [part="panel"] { display: grid; grid-template-rows: 0fr; overflow: hidden; border: 0 solid var(--lr-color-border-subtle); border-radius: var(--lr-radius); background: var(--lr-color-surface); transition: grid-template-rows var(--lr-transition-base), border-width var(--lr-transition-base); } [part="panel"]:where([data-open]) { grid-template-rows: 1fr; border-width: var(--lr-border-width-thin); } [part="panel"] .panel-inner { overflow: hidden; min-block-size: 0; display: flex; flex-direction: column; gap: var(--lr-space-s); padding: 0 var(--lr-space-m); transition: padding-block var(--lr-transition-base); } [part="panel"]:where([data-open]) .panel-inner { padding-block: var(--lr-space-m); } @media (prefers-reduced-motion: reduce) { [part="panel"], [part="panel"] .panel-inner { transition: none; } } [part="reasons"] { display: flex; flex-wrap: wrap; gap: var(--lr-space-2xs); } .reason-description, [part="comment-error"] { font-size: var(--lr-font-size-sm); overflow-wrap: anywhere; } .reason-description { color: var(--lr-color-text-quiet); } [part="comment-error"] { color: var(--lr-color-danger); } [part="comment"] { box-sizing: border-box; inline-size: 100%; min-block-size: var(--lr-size-2-5rem); padding: var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; resize: vertical; } [part="comment"]:focus-visible { ${focusRing} } :where([part="comment"]):hover:where(:not(:disabled)) { border-color: var(--lr-color-brand); } [part="comment"]::placeholder { color: var(--lr-color-text-quiet); } [part="submit-button"] { box-sizing: border-box; align-self: flex-end; max-inline-size: 100%; padding-inline: var(--lr-space-m); padding-block: var(--lr-space-xs); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius); background: var(--lr-color-brand); color: var(--lr-color-on-brand); font: inherit; white-space: normal; overflow-wrap: anywhere; cursor: pointer; } :where([part="submit-button"]):hover:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } :where([part="submit-button"]):active:where(:not(:disabled)) { background: color-mix( in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="submit-button"]:disabled { cursor: not-allowed; opacity: var(--lr-opacity-disabled); } [part="comment"]:disabled { cursor: not-allowed; opacity: var(--lr-opacity-disabled); } [part="submit-button"]:focus-visible { ${focusRing} } `;export{styles};
@@ -1,4 +1,4 @@
1
- import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import type{DocumentRef}from'../../../ai/types.js';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraAttachmentCapability,LyraAttachmentFilesDetail}from'../../media/attachment-trigger/attachment-trigger.class.js';import type{LyraSourceEntry}from'../../retrieval/source-picker/source-picker.class.js';export type{LyraSourceEntry}from'../../retrieval/source-picker/source-picker.class.js';import type{LyraMentionItem}from'../../utility/mention-popover/mention-popover.class.js';import type{ChatComposerActionsLayout,ChatComposerFrame,ChatComposerSelectionDirection,ChatComposerStatus,ChatComposerWrap}from'../chat-composer/chat-composer.class.js';import type{LyraCatalog,LyraModelCatalogEntry}from'../model-select/model-select.class.js';import type{PromptQueueItem}from'../prompt-queue/prompt-queue.class.js';export type{PromptQueueItem}from'../prompt-queue/prompt-queue.class.js';import type{PromptQueueChangeDetail}from'../prompt-queue/prompt-queue.class.js';import type{LyraAttachmentIdDetail,LyraAttachmentPreviewRequestDetail,LyraAttachmentUploadStatus}from'../../media/attachment-chip/attachment-chip.class.js';import type{LyraVoiceCatalogEntry}from'../voice-picker/voice-picker.class.js';export type{LyraVoiceCatalogEntry}from'../voice-picker/voice-picker.class.js';export interface LyraPromptSuggestion extends LyraMentionItem{
1
+ import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import type{DocumentRef}from'../../../ai/types.js';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraAttachmentCapability,LyraAttachmentFilesDetail}from'../../media/attachment-trigger/attachment-trigger.class.js';import type{LyraSourceEntry}from'../../retrieval/source-picker/source-picker.class.js';export type{LyraSourceEntry}from'../../retrieval/source-picker/source-picker.class.js';import type{LyraMentionItem}from'../../utility/mention-popover/mention-popover.class.js';import type{ChatComposerActionsLayout,ChatComposerToolbarPlacement,ChatComposerFrame,ChatComposerSelectionDirection,ChatComposerStatus,ChatComposerWrap}from'../chat-composer/chat-composer.class.js';import type{LyraCatalog,LyraModelCatalogEntry}from'../model-select/model-select.class.js';import type{PromptQueueItem}from'../prompt-queue/prompt-queue.class.js';export type{PromptQueueItem}from'../prompt-queue/prompt-queue.class.js';import type{PromptQueueChangeDetail}from'../prompt-queue/prompt-queue.class.js';import type{LyraAttachmentIdDetail,LyraAttachmentPreviewRequestDetail,LyraAttachmentUploadStatus}from'../../media/attachment-chip/attachment-chip.class.js';import type{LyraVoiceCatalogEntry}from'../voice-picker/voice-picker.class.js';export type{LyraVoiceCatalogEntry}from'../voice-picker/voice-picker.class.js';export interface LyraPromptSuggestion extends LyraMentionItem{
2
2
  /** Inserted after the trigger. Defaults to `label`.*/
3
3
  insertText?:string;}export interface LyraPromptInputAttachment extends Omit<DocumentRef,'id'>{attachmentId:string;file?:File;
4
4
  /** File size in bytes, forwarded to the rendered attachment chip.*/
@@ -27,7 +27,8 @@ bytes?:number;status?:LyraAttachmentUploadStatus;progress?:number;}export interf
27
27
  * @slot controls - Replaces the data-driven model, voice, and source controls.
28
28
  * @slot start - Attachment-control content rendered before the textarea. Replaces the default
29
29
  * attachment trigger.
30
- * @slot toolbar - Content above the textarea, forwarded to the composed composer's `toolbar` slot.
30
+ * @slot toolbar - Auxiliary controls forwarded to the composed composer; toolbarPlacement selects
31
+ * the upper toolbar or, with actionsLayout below, the bottom action row.
31
32
  * @slot chips - Replaces the data-driven attachment chips.
32
33
  * @slot end - Custom send/stop action replacing the built-in composer action.
33
34
  * @slot footer - Content below the composer.
@@ -87,7 +88,9 @@ withoutStop:boolean;
87
88
  frame:ChatComposerFrame;
88
89
  /** Forwarded to the composed composer: `'stacked'` arranges `start` above `end` beside the textarea;
89
90
  * `'below'` puts both on one row under a full-width textarea. */
90
- actionsLayout:ChatComposerActionsLayout;minRows:number;maxRows:number;
91
+ actionsLayout:ChatComposerActionsLayout;
92
+ /** Forwarded toolbar position; data-driven model/voice/source controls remain above the composer.*/
93
+ toolbarPlacement:ChatComposerToolbarPlacement;minRows:number;maxRows:number;
91
94
  /** Forwarded to the composed native textarea. `spellcheck="false"` parses as `false`, matching
92
95
  * the textarea's true default while remaining usable from plain HTML. */
93
96
  spellcheck:boolean;
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{repeat}from"lit/directives/repeat.js";import{autocorrectConverter,normalizeAutocorrect,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LyraElement}from"../../../internal/lyra-element.js";import{lengthLimitConverter}from"../../../internal/length-constraints.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{normalizeCatalog}from"../../../internal/catalog-picker.js";import{composedContains}from"../../../internal/overlay-manager.js";import{canonicalIdentityList,firstByRetrievalIdentity as firstByPromptIdentity}from"../../retrieval/retrieval-identity.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{normalizeChatComposerStatus}from"../chat-composer/chat-composer.class.js";import{styles}from"./prompt-input.styles.js";import{LYRA_DEFAULT_promptInputAttachments,LYRA_DEFAULT_promptInputControls,LYRA_DEFAULT_promptInputInputLimit,LYRA_DEFAULT_promptInputLabel,LYRA_DEFAULT_promptInputSources}from"../../../internal/default-strings/conversation.generated.js";import{LYRA_DEFAULT_fieldRequired}from"../../../internal/default-strings/shared.generated.js";class LyraPromptInput extends LyraElement{constructor(){super(...arguments),this.inputLimitAnnouncements=new AnnouncementSinkController(this),this.suggestionCaretGeneration=0,this._value="",this.statusValue="idle",this.placeholder="",this.disabled=!1,this.readOnly=!1,this.withoutEnterSubmit=!1,this.submitDisabled=!1,this.withoutStop=!1,this.frame="card",this.actionsLayout="inline",this.minRows=1,this.maxRows=8,this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.wrap="soft",this.autocomplete="",this.inputMode="",this.enterKeyHint="",this.attachments=[],this.attachmentCapabilities=["files","image","audio"],this.mentionItems=[],this.commandItems=[],this.model="",this.voice="",this.sources=[],this.selectedSourceIds=[],this.queue=[],this.accessibleLabel=null,this.activeSuggestion=null,this.slotPresence=new SlotPresenceController(this),this.suggestionNavigationGeneration=0,this.syncDescription=()=>{const target=this.composer?.input;this.isConnected&&target&&!this.descriptionLease&&(this.descriptionLease=acquireResolvedAriaRelationship(this,target,"aria-describedby"))},this.onCompositeKeyDown=event=>{event.composedPath()[0]===this.composer?.input&&this.onKeyDown(event)},this.onCompositeFocusOut=event=>{const popover=this.suggestionPopover;if(!popover||!this.activeSuggestion||!popover.open)return;const relatedTarget=isHtmlElement(event.relatedTarget)?event.relatedTarget:null;this.suggestionFocusIsOwned(popover,relatedTarget)||(this.suggestionNavigationGeneration+=1);const generation=this.suggestionNavigationGeneration;queueMicrotask(()=>{if(!this.isConnected||generation!==this.suggestionNavigationGeneration)return;const currentPopover=this.suggestionPopover;(!currentPopover||!this.suggestionFocusIsOwned(currentPopover))&&this.closeSuggestions()})},this.onNativeInput=event=>{if(this.disabled||this.readOnly||!this.composer||!event.composedPath().includes(this.composer)){event.stopPropagation();return}relayNativeEvent(this,event)},this.onNativeChange=event=>{if(this.disabled||this.readOnly||!this.composer||!event.composedPath().includes(this.composer)){event.stopPropagation();return}relayNativeEvent(this,event)},this.onNativeFocus=event=>{if(event.target!==this.composer){event.stopPropagation();return}relayNativeEvent(this,event)},this.onNativeBlur=event=>{if(event.target!==this.composer){event.stopPropagation();return}relayNativeEvent(this,event)},this.firstByIdentity=new WeakMap}static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,promptInputAttachments:LYRA_DEFAULT_promptInputAttachments,promptInputControls:LYRA_DEFAULT_promptInputControls,promptInputInputLimit:LYRA_DEFAULT_promptInputInputLimit,promptInputLabel:LYRA_DEFAULT_promptInputLabel,promptInputSources:LYRA_DEFAULT_promptInputSources}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["attachments","attachmentCapabilities","mentionItems","commandItems","modelCatalog","voiceCatalog","sources","selectedSourceIds","queue"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-attachments-add","lr-sources-change","lr-queue-change","lr-send-now"])}static{this.identityEventDetailProperties=Object.freeze({"lr-send-now":Object.freeze(["item"])})}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-queue-change":Object.freeze(["items"])})}get inputLosses(){return["modelCatalog","voiceCatalog","mentionItems","commandItems"].map(name=>publicCollectionTruncation(this,name))}get inputLimitMessage(){return this.inputLosses.some(Boolean)?this.localize("promptInputInputLimit"):""}syncInputLimitAnnouncement(){this.inputLimitAnnouncements.transition("input-limit",this.inputLosses.map(loss=>loss?`${loss.source}:${loss.retained}:${loss.kept}`:"").join("|"),this.inputLimitMessage,"polite")}get value(){return this._value}set value(next){if(next===this._value)return;const old=this._value;this._value=next,this.suggestionCaretGeneration+=1,this.requestUpdate("value",old)}get status(){return this.statusValue}set status(value){const previous=this.statusValue;this.statusValue=normalizeChatComposerStatus(value),this.requestUpdate("status",previous)}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}focus(options){this.composer?.focus(options)}blur(){this.composer?.blur()}click(){this.disabled||this.composer?.click()}get input(){return this.composer?.input??null}get selectionStart(){return this.composer?.selectionStart??null}set selectionStart(value){this.suggestionCaretGeneration+=1,this.composer&&(this.composer.selectionStart=value)}get selectionEnd(){return this.composer?.selectionEnd??null}set selectionEnd(value){this.suggestionCaretGeneration+=1,this.composer&&(this.composer.selectionEnd=value)}get selectionDirection(){return this.composer?.selectionDirection??null}set selectionDirection(value){this.suggestionCaretGeneration+=1,this.composer&&(this.composer.selectionDirection=value)}select(){this.suggestionCaretGeneration+=1,this.composer?.select()}setSelectionRange(start,end,direction){this.suggestionCaretGeneration+=1,this.composer?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const composer=this.composer;composer&&(setNativeRangeText(composer,replacement,start,end,selectMode),this.value=composer.value)}willUpdate(changed){super.willUpdate(changed);let invalidate=changed.has("mentionItems")||changed.has("commandItems")||changed.has("disabled")||changed.has("readOnly");if(changed.has("value")){const internal=this.pendingSuggestionValue===this.value;this.pendingSuggestionValue=void 0,invalidate||=!internal}invalidate&&(this.suggestionNavigationGeneration+=1,this.activeSuggestion=null,this.suggestionAnchor=void 0)}adoptedCallback(){super.adoptedCallback(),this.inputLimitAnnouncements.adopted()}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.onCompositeKeyDown,!0),this.hasUpdated&&(this.syncInputLimitAnnouncement(),this.syncDescription())}disconnectedCallback(){this.removeEventListener("keydown",this.onCompositeKeyDown,!0),this.suggestionCaretGeneration+=1,this.closeSuggestions(),this.descriptionLease?.release(),this.descriptionLease=void 0,super.disconnectedCallback()}firstUpdated(changed){super.firstUpdated(changed),this.composer?.updateComplete.then(this.syncDescription)}updated(_changed){super.updated(_changed),this.syncInputLimitAnnouncement();const popover=this.suggestionPopover;popover&&this.suggestionAnchor&&(popover.anchor=this.suggestionAnchor)}suggestions(){return this.activeSuggestion?.trigger==="/"?this.commandItems:this.mentionItems}detectSuggestion(value){const caret=this.composer?.selectionStart??value.length,prefix=value.slice(0,caret),match=/(?:^|\s)([@/])([^\s@/]*)$/.exec(prefix);if(!match||match[1]!=="@"&&match[1]!=="/"){this.activeSuggestion=null;return}const start=caret-match[2].length-1,items=match[1]==="@"?this.mentionItems:this.commandItems;this.activeSuggestion=items.length?{trigger:match[1],start,query:match[2]??""}:null}onInput(event){if(event.stopPropagation(),this.disabled||this.readOnly)return;const composer=event.currentTarget;this.suggestionAnchor=composer?.input??this.composer?.input??void 0,this.pendingSuggestionValue=event.detail.value,this.value=event.detail.value,this.detectSuggestion(this.value),this.emit("lr-input",{value:this.value})}onChange(event){event.stopPropagation(),!(this.disabled||this.readOnly)&&(this.value=event.detail.value,this.emit("lr-change",{value:this.value}))}onSubmit(event){event.stopPropagation(),!this.disabled&&this.emit("lr-submit",event.detail)}onStop(event){event.stopPropagation(),!this.disabled&&this.emit("lr-stop",null)}onKeyDown(event){if(event.defaultPrevented)return;const popover=this.suggestionPopover;if(!(this.disabled||this.readOnly||!this.activeSuggestion||!popover?.open)&&popover.handleKeyDown(event)){const shouldMoveFocus=event.key==="ArrowDown"||event.key==="ArrowUp",generation=++this.suggestionNavigationGeneration;popover.updateComplete.then(async()=>{shouldMoveFocus&&generation===this.suggestionNavigationGeneration&&this.isConnected&&!this.disabled&&!this.readOnly&&this.suggestionPopover===popover&&this.activeSuggestion&&popover.open&&this.suggestionFocusIsOwned(popover)&&await popover.focusActiveOption({ownsFocus:()=>generation===this.suggestionNavigationGeneration&&this.isConnected&&!this.disabled&&!this.readOnly&&this.suggestionPopover===popover&&this.activeSuggestion!==null&&popover.open&&this.suggestionFocusIsOwned(popover)})})}}suggestionFocusIsOwned(popover,focused=deepActiveElementIn(this.ownerDocument)){return focused===this.composer?.input||focused===this.composer||focused!==null&&composedContains(popover,focused)}closeSuggestions(){this.suggestionNavigationGeneration+=1,this.activeSuggestion=null,this.suggestionAnchor=void 0}onSuggestionSelect(event){if(event.stopPropagation(),this.disabled||this.readOnly)return;const active=this.activeSuggestion;if(!active)return;const occurrence=this.suggestions()[event.detail.index];if(!occurrence||occurrence.suggestionId!==event.detail.suggestionId)return;const item=occurrence,composer=this.composer,caret=composer?.selectionStart??this.value.length,inserted=`${active.trigger}${item?.insertText??event.detail.label} `;this.value=this.value.slice(0,active.start)+inserted+this.value.slice(caret);const caretGeneration=this.suggestionCaretGeneration,nextCaret=active.start+inserted.length;this.closeSuggestions(),this.emit("lr-input",{value:this.value}),this.emit("lr-mention-select",{suggestionId:event.detail.suggestionId,index:event.detail.index,label:event.detail.label,trigger:active.trigger}),this.updateComplete.then(()=>{caretGeneration===this.suggestionCaretGeneration&&this.isConnected&&this.composer===composer&&composer?.setSelectionRange(nextCaret,nextCaret)})}onFiles(event){event.stopPropagation(),!this.disabled&&this.emit("lr-attachments-add",event.detail)}get effectiveAttachments(){const seen=new Set;return this.attachments.filter(attachment=>{const id=attachment?.attachmentId;return typeof id!="string"||id.trim()===""||seen.has(id)?!1:(seen.add(id),!0)})}firstById(values,identity){let retained=this.firstByIdentity.get(values);return retained||this.firstByIdentity.set(values,retained=firstByPromptIdentity(values,identity)),retained}get effectiveSources(){return this.firstById(this.sources,source=>source.id)}get effectiveSelectedSourceIds(){return canonicalIdentityList(this.selectedSourceIds)}get effectiveQueue(){return this.firstById(this.queue,item=>item.id)}renderDefaultAttachmentTrigger(){return html`<lr-attachment-trigger multiple
1
+ import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribute}from"../../../internal/native-text-control.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{repeat}from"lit/directives/repeat.js";import{autocorrectConverter,normalizeAutocorrect,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LyraElement}from"../../../internal/lyra-element.js";import{lengthLimitConverter}from"../../../internal/length-constraints.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{SlotPresenceController}from"../../../internal/slot-presence-controller.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{normalizeCatalog}from"../../../internal/catalog-picker.js";import{composedContains}from"../../../internal/overlay-manager.js";import{canonicalIdentityList,firstByRetrievalIdentity as firstByPromptIdentity}from"../../retrieval/retrieval-identity.js";import{acquireResolvedAriaRelationship}from"../../../internal/aria-controls.js";import{normalizeChatComposerStatus}from"../chat-composer/chat-composer.class.js";import{styles}from"./prompt-input.styles.js";import{LYRA_DEFAULT_promptInputAttachments,LYRA_DEFAULT_promptInputControls,LYRA_DEFAULT_promptInputInputLimit,LYRA_DEFAULT_promptInputLabel,LYRA_DEFAULT_promptInputSources}from"../../../internal/default-strings/conversation.generated.js";import{LYRA_DEFAULT_fieldRequired}from"../../../internal/default-strings/shared.generated.js";class LyraPromptInput extends LyraElement{constructor(){super(...arguments),this.inputLimitAnnouncements=new AnnouncementSinkController(this),this.suggestionCaretGeneration=0,this._value="",this.statusValue="idle",this.placeholder="",this.disabled=!1,this.readOnly=!1,this.withoutEnterSubmit=!1,this.submitDisabled=!1,this.withoutStop=!1,this.frame="card",this.actionsLayout="inline",this.toolbarPlacement="above",this.minRows=1,this.maxRows=8,this.spellcheck=!0,this.autocapitalize="",this.autocorrectValue=!0,this.wrap="soft",this.autocomplete="",this.inputMode="",this.enterKeyHint="",this.attachments=[],this.attachmentCapabilities=["files","image","audio"],this.mentionItems=[],this.commandItems=[],this.model="",this.voice="",this.sources=[],this.selectedSourceIds=[],this.queue=[],this.accessibleLabel=null,this.activeSuggestion=null,this.slotPresence=new SlotPresenceController(this),this.suggestionNavigationGeneration=0,this.syncDescription=()=>{const target=this.composer?.input;this.isConnected&&target&&!this.descriptionLease&&(this.descriptionLease=acquireResolvedAriaRelationship(this,target,"aria-describedby"))},this.onCompositeKeyDown=event=>{event.composedPath()[0]===this.composer?.input&&this.onKeyDown(event)},this.onCompositeFocusOut=event=>{const popover=this.suggestionPopover;if(!popover||!this.activeSuggestion||!popover.open)return;const relatedTarget=isHtmlElement(event.relatedTarget)?event.relatedTarget:null;this.suggestionFocusIsOwned(popover,relatedTarget)||(this.suggestionNavigationGeneration+=1);const generation=this.suggestionNavigationGeneration;queueMicrotask(()=>{if(!this.isConnected||generation!==this.suggestionNavigationGeneration)return;const currentPopover=this.suggestionPopover;(!currentPopover||!this.suggestionFocusIsOwned(currentPopover))&&this.closeSuggestions()})},this.onNativeInput=event=>{if(this.disabled||this.readOnly||!this.composer||!event.composedPath().includes(this.composer)){event.stopPropagation();return}relayNativeEvent(this,event)},this.onNativeChange=event=>{if(this.disabled||this.readOnly||!this.composer||!event.composedPath().includes(this.composer)){event.stopPropagation();return}relayNativeEvent(this,event)},this.onNativeFocus=event=>{if(event.target!==this.composer){event.stopPropagation();return}relayNativeEvent(this,event)},this.onNativeBlur=event=>{if(event.target!==this.composer){event.stopPropagation();return}relayNativeEvent(this,event)},this.firstByIdentity=new WeakMap}static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,promptInputAttachments:LYRA_DEFAULT_promptInputAttachments,promptInputControls:LYRA_DEFAULT_promptInputControls,promptInputInputLimit:LYRA_DEFAULT_promptInputInputLimit,promptInputLabel:LYRA_DEFAULT_promptInputLabel,promptInputSources:LYRA_DEFAULT_promptInputSources}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["attachments","attachmentCapabilities","mentionItems","commandItems","modelCatalog","voiceCatalog","sources","selectedSourceIds","queue"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-attachments-add","lr-sources-change","lr-queue-change","lr-send-now"])}static{this.identityEventDetailProperties=Object.freeze({"lr-send-now":Object.freeze(["item"])})}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-queue-change":Object.freeze(["items"])})}get inputLosses(){return["modelCatalog","voiceCatalog","mentionItems","commandItems"].map(name=>publicCollectionTruncation(this,name))}get inputLimitMessage(){return this.inputLosses.some(Boolean)?this.localize("promptInputInputLimit"):""}syncInputLimitAnnouncement(){this.inputLimitAnnouncements.transition("input-limit",this.inputLosses.map(loss=>loss?`${loss.source}:${loss.retained}:${loss.kept}`:"").join("|"),this.inputLimitMessage,"polite")}get value(){return this._value}set value(next){if(next===this._value)return;const old=this._value;this._value=next,this.suggestionCaretGeneration+=1,this.requestUpdate("value",old)}get status(){return this.statusValue}set status(value){const previous=this.statusValue;this.statusValue=normalizeChatComposerStatus(value),this.requestUpdate("status",previous)}get autocorrect(){return this.autocorrectValue}set autocorrect(next){this.autocorrectValue=normalizeAutocorrect(next),this.requestUpdate()}focus(options){this.composer?.focus(options)}blur(){this.composer?.blur()}click(){this.disabled||this.composer?.click()}get input(){return this.composer?.input??null}get selectionStart(){return this.composer?.selectionStart??null}set selectionStart(value){this.suggestionCaretGeneration+=1,this.composer&&(this.composer.selectionStart=value)}get selectionEnd(){return this.composer?.selectionEnd??null}set selectionEnd(value){this.suggestionCaretGeneration+=1,this.composer&&(this.composer.selectionEnd=value)}get selectionDirection(){return this.composer?.selectionDirection??null}set selectionDirection(value){this.suggestionCaretGeneration+=1,this.composer&&(this.composer.selectionDirection=value)}select(){this.suggestionCaretGeneration+=1,this.composer?.select()}setSelectionRange(start,end,direction){this.suggestionCaretGeneration+=1,this.composer?.setSelectionRange(start,end,direction)}setRangeText(replacement,start,end,selectMode){const composer=this.composer;composer&&(setNativeRangeText(composer,replacement,start,end,selectMode),this.value=composer.value)}willUpdate(changed){super.willUpdate(changed);let invalidate=changed.has("mentionItems")||changed.has("commandItems")||changed.has("disabled")||changed.has("readOnly");if(changed.has("value")){const internal=this.pendingSuggestionValue===this.value;this.pendingSuggestionValue=void 0,invalidate||=!internal}invalidate&&(this.suggestionNavigationGeneration+=1,this.activeSuggestion=null,this.suggestionAnchor=void 0)}adoptedCallback(){super.adoptedCallback(),this.inputLimitAnnouncements.adopted()}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.onCompositeKeyDown,!0),this.hasUpdated&&(this.syncInputLimitAnnouncement(),this.syncDescription())}disconnectedCallback(){this.removeEventListener("keydown",this.onCompositeKeyDown,!0),this.suggestionCaretGeneration+=1,this.closeSuggestions(),this.descriptionLease?.release(),this.descriptionLease=void 0,super.disconnectedCallback()}firstUpdated(changed){super.firstUpdated(changed),this.composer?.updateComplete.then(this.syncDescription)}updated(_changed){super.updated(_changed),this.syncInputLimitAnnouncement();const popover=this.suggestionPopover;popover&&this.suggestionAnchor&&(popover.anchor=this.suggestionAnchor)}suggestions(){return this.activeSuggestion?.trigger==="/"?this.commandItems:this.mentionItems}detectSuggestion(value){const caret=this.composer?.selectionStart??value.length,prefix=value.slice(0,caret),match=/(?:^|\s)([@/])([^\s@/]*)$/.exec(prefix);if(!match||match[1]!=="@"&&match[1]!=="/"){this.activeSuggestion=null;return}const start=caret-match[2].length-1,items=match[1]==="@"?this.mentionItems:this.commandItems;this.activeSuggestion=items.length?{trigger:match[1],start,query:match[2]??""}:null}onInput(event){if(event.stopPropagation(),this.disabled||this.readOnly)return;const composer=event.currentTarget;this.suggestionAnchor=composer?.input??this.composer?.input??void 0,this.pendingSuggestionValue=event.detail.value,this.value=event.detail.value,this.detectSuggestion(this.value),this.emit("lr-input",{value:this.value})}onChange(event){event.stopPropagation(),!(this.disabled||this.readOnly)&&(this.value=event.detail.value,this.emit("lr-change",{value:this.value}))}onSubmit(event){event.stopPropagation(),!this.disabled&&this.emit("lr-submit",event.detail)}onStop(event){event.stopPropagation(),!this.disabled&&this.emit("lr-stop",null)}onKeyDown(event){if(event.defaultPrevented)return;const popover=this.suggestionPopover;if(!(this.disabled||this.readOnly||!this.activeSuggestion||!popover?.open)&&popover.handleKeyDown(event)){const shouldMoveFocus=event.key==="ArrowDown"||event.key==="ArrowUp",generation=++this.suggestionNavigationGeneration;popover.updateComplete.then(async()=>{shouldMoveFocus&&generation===this.suggestionNavigationGeneration&&this.isConnected&&!this.disabled&&!this.readOnly&&this.suggestionPopover===popover&&this.activeSuggestion&&popover.open&&this.suggestionFocusIsOwned(popover)&&await popover.focusActiveOption({ownsFocus:()=>generation===this.suggestionNavigationGeneration&&this.isConnected&&!this.disabled&&!this.readOnly&&this.suggestionPopover===popover&&this.activeSuggestion!==null&&popover.open&&this.suggestionFocusIsOwned(popover)})})}}suggestionFocusIsOwned(popover,focused=deepActiveElementIn(this.ownerDocument)){return focused===this.composer?.input||focused===this.composer||focused!==null&&composedContains(popover,focused)}closeSuggestions(){this.suggestionNavigationGeneration+=1,this.activeSuggestion=null,this.suggestionAnchor=void 0}onSuggestionSelect(event){if(event.stopPropagation(),this.disabled||this.readOnly)return;const active=this.activeSuggestion;if(!active)return;const occurrence=this.suggestions()[event.detail.index];if(!occurrence||occurrence.suggestionId!==event.detail.suggestionId)return;const item=occurrence,composer=this.composer,caret=composer?.selectionStart??this.value.length,inserted=`${active.trigger}${item?.insertText??event.detail.label} `;this.value=this.value.slice(0,active.start)+inserted+this.value.slice(caret);const caretGeneration=this.suggestionCaretGeneration,nextCaret=active.start+inserted.length;this.closeSuggestions(),this.emit("lr-input",{value:this.value}),this.emit("lr-mention-select",{suggestionId:event.detail.suggestionId,index:event.detail.index,label:event.detail.label,trigger:active.trigger}),this.updateComplete.then(()=>{caretGeneration===this.suggestionCaretGeneration&&this.isConnected&&this.composer===composer&&composer?.setSelectionRange(nextCaret,nextCaret)})}onFiles(event){event.stopPropagation(),!this.disabled&&this.emit("lr-attachments-add",event.detail)}get effectiveAttachments(){const seen=new Set;return this.attachments.filter(attachment=>{const id=attachment?.attachmentId;return typeof id!="string"||id.trim()===""||seen.has(id)?!1:(seen.add(id),!0)})}firstById(values,identity){let retained=this.firstByIdentity.get(values);return retained||this.firstByIdentity.set(values,retained=firstByPromptIdentity(values,identity)),retained}get effectiveSources(){return this.firstById(this.sources,source=>source.id)}get effectiveSelectedSourceIds(){return canonicalIdentityList(this.selectedSourceIds)}get effectiveQueue(){return this.firstById(this.queue,item=>item.id)}renderDefaultAttachmentTrigger(){return html`<lr-attachment-trigger multiple
2
2
  .capabilities=${this.attachmentCapabilities}
3
3
  .disabled=${this.disabled}
4
4
  @lr-files=${this.onFiles}
@@ -92,6 +92,7 @@ import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribu
92
92
  .maxRows=${this.maxRows}
93
93
  .frame=${this.frame}
94
94
  .actionsLayout=${this.actionsLayout}
95
+ .toolbarPlacement=${this.toolbarPlacement}
95
96
  aria-label=${label}
96
97
  @lr-input=${this.onInput}
97
98
  @lr-change=${this.onChange}
@@ -123,4 +124,4 @@ import{__decorate}from"tslib";import{setNativeRangeText,nativeAutocorrectAttribu
123
124
  @lr-mention-close=${event=>{event.stopPropagation(),this.closeSuggestions()}}
124
125
  ></lr-mention-popover>
125
126
  ${this.slotPresence.has("footer")?html`<div part="footer"><slot name="footer"></slot></div>`:html`<slot name="footer" hidden aria-hidden="true"></slot>`}
126
- </section>`}}__decorate([property()],LyraPromptInput.prototype,"value",null),__decorate([property()],LyraPromptInput.prototype,"status",null),__decorate([property()],LyraPromptInput.prototype,"placeholder",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraPromptInput.prototype,"disabled",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"readonly"})],LyraPromptInput.prototype,"readOnly",void 0),__decorate([property({converter:lengthLimitConverter,attribute:"minlength"})],LyraPromptInput.prototype,"minLength",void 0),__decorate([property({converter:lengthLimitConverter,attribute:"maxlength"})],LyraPromptInput.prototype,"maxLength",void 0),__decorate([property({type:Boolean,attribute:"without-enter-submit"})],LyraPromptInput.prototype,"withoutEnterSubmit",void 0),__decorate([property({type:Boolean,attribute:"submit-disabled"})],LyraPromptInput.prototype,"submitDisabled",void 0),__decorate([property({type:Boolean,attribute:"without-stop"})],LyraPromptInput.prototype,"withoutStop",void 0),__decorate([property()],LyraPromptInput.prototype,"frame",void 0),__decorate([property({attribute:"actions-layout"})],LyraPromptInput.prototype,"actionsLayout",void 0),__decorate([property({type:Number,attribute:"min-rows"})],LyraPromptInput.prototype,"minRows",void 0),__decorate([property({type:Number,attribute:"max-rows"})],LyraPromptInput.prototype,"maxRows",void 0),__decorate([property({converter:trueDefaultBooleanConverter})],LyraPromptInput.prototype,"spellcheck",void 0),__decorate([property()],LyraPromptInput.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraPromptInput.prototype,"autocorrect",null),__decorate([property()],LyraPromptInput.prototype,"wrap",void 0),__decorate([property()],LyraPromptInput.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraPromptInput.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraPromptInput.prototype,"enterKeyHint",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"attachments",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"attachmentCapabilities",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"mentionItems",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"commandItems",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"modelCatalog",void 0),__decorate([property()],LyraPromptInput.prototype,"model",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"voiceCatalog",void 0),__decorate([property()],LyraPromptInput.prototype,"voice",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"sources",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"selectedSourceIds",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"queue",void 0),__decorate([property()],LyraPromptInput.prototype,"label",void 0),__decorate([property({attribute:"aria-label"})],LyraPromptInput.prototype,"accessibleLabel",void 0),__decorate([state()],LyraPromptInput.prototype,"activeSuggestion",void 0),__decorate([query("lr-chat-composer")],LyraPromptInput.prototype,"composer",void 0),__decorate([query("lr-mention-popover")],LyraPromptInput.prototype,"suggestionPopover",void 0);export{LyraPromptInput};
127
+ </section>`}}__decorate([property()],LyraPromptInput.prototype,"value",null),__decorate([property()],LyraPromptInput.prototype,"status",null),__decorate([property()],LyraPromptInput.prototype,"placeholder",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraPromptInput.prototype,"disabled",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"readonly"})],LyraPromptInput.prototype,"readOnly",void 0),__decorate([property({converter:lengthLimitConverter,attribute:"minlength"})],LyraPromptInput.prototype,"minLength",void 0),__decorate([property({converter:lengthLimitConverter,attribute:"maxlength"})],LyraPromptInput.prototype,"maxLength",void 0),__decorate([property({type:Boolean,attribute:"without-enter-submit"})],LyraPromptInput.prototype,"withoutEnterSubmit",void 0),__decorate([property({type:Boolean,attribute:"submit-disabled"})],LyraPromptInput.prototype,"submitDisabled",void 0),__decorate([property({type:Boolean,attribute:"without-stop"})],LyraPromptInput.prototype,"withoutStop",void 0),__decorate([property()],LyraPromptInput.prototype,"frame",void 0),__decorate([property({attribute:"actions-layout"})],LyraPromptInput.prototype,"actionsLayout",void 0),__decorate([property({attribute:"toolbar-placement"})],LyraPromptInput.prototype,"toolbarPlacement",void 0),__decorate([property({type:Number,attribute:"min-rows"})],LyraPromptInput.prototype,"minRows",void 0),__decorate([property({type:Number,attribute:"max-rows"})],LyraPromptInput.prototype,"maxRows",void 0),__decorate([property({converter:trueDefaultBooleanConverter})],LyraPromptInput.prototype,"spellcheck",void 0),__decorate([property()],LyraPromptInput.prototype,"autocapitalize",void 0),__decorate([property({converter:autocorrectConverter})],LyraPromptInput.prototype,"autocorrect",null),__decorate([property()],LyraPromptInput.prototype,"wrap",void 0),__decorate([property()],LyraPromptInput.prototype,"autocomplete",void 0),__decorate([property({attribute:"inputmode"})],LyraPromptInput.prototype,"inputMode",void 0),__decorate([property({attribute:"enterkeyhint"})],LyraPromptInput.prototype,"enterKeyHint",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"attachments",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"attachmentCapabilities",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"mentionItems",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"commandItems",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"modelCatalog",void 0),__decorate([property()],LyraPromptInput.prototype,"model",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"voiceCatalog",void 0),__decorate([property()],LyraPromptInput.prototype,"voice",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"sources",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"selectedSourceIds",void 0),__decorate([property({attribute:!1})],LyraPromptInput.prototype,"queue",void 0),__decorate([property()],LyraPromptInput.prototype,"label",void 0),__decorate([property({attribute:"aria-label"})],LyraPromptInput.prototype,"accessibleLabel",void 0),__decorate([state()],LyraPromptInput.prototype,"activeSuggestion",void 0),__decorate([query("lr-chat-composer")],LyraPromptInput.prototype,"composer",void 0),__decorate([query("lr-mention-popover")],LyraPromptInput.prototype,"suggestionPopover",void 0);export{LyraPromptInput};
@@ -7,7 +7,7 @@ import{__decorate}from"tslib";import{html,nothing,svg}from"lit";import{property,
7
7
  <path d="M19 10v2a7 7 0 0 1-14 0v-2"></path>
8
8
  <line x1="12" y1="19" x2="12" y2="23"></line>
9
9
  <line x1="8" y1="23" x2="16" y2="23"></line>
10
- `)}function pulseGlyph(){return icon(svg`<circle cx="12" cy="12" r="6"></circle>`)}class LyraPushToTalk extends LyraElement{constructor(){super(...arguments),this._mode="hold",this.timesliceMs=0,this.mimeType="",this.deviceId="",this.levelEvents=!1,this.maxDurationMs=0,this.withoutTimer=!1,this.disabled=!1,this.elapsedMs=0,this.captureSupported=!1,this._state="idle",this._stream=null,this.describedByReflected=!1,this.chunks=[],this.recordingStartedAt=0,this.lifecycleGeneration=0,this.captureSequence=0,this.intentSequence=0,this.cancelRequested=!1,this.recorderStopRequested=!1,this.recorderFailed=!1,this.tickTimer=new OwnedInterval(this),this.maxDurationTimer=new OwnedTimeout(this),this.levelFrame=new OwnedFrame(this),this.onPointerDown=e=>{if(this.mode!=="hold"||this.disabled)return;e.preventDefault();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}if(this.holdGesture)return;const intent=this.createIntent("hold",{source:"pointer",pointerId:e.pointerId});intent&&(this.holdGesture=intent,this.startForIntent(intent))},this.onPointerUp=event=>{this.holdGesture?.source!=="pointer"||this.holdGesture.pointerId!==event.pointerId||this.releaseHoldGesture()},this.onPointerCancel=event=>{this.holdGesture?.source!=="pointer"||this.holdGesture.pointerId!==event.pointerId||this.releaseHoldGesture()},this.onKeyDown=e=>{if(this.disabled)return;if(e.key==="Escape"){if(this._state!=="requesting"&&this._state!=="recording")return;e.preventDefault(),this.cancel();return}if(e.key!=="Enter"&&e.key!==" "||this.mode!=="hold"||e.repeat||(e.preventDefault(),this.holdGesture))return;const intent=this.createIntent("hold",{source:"keyboard",key:e.key});intent&&(this.holdGesture=intent,this.startForIntent(intent))},this.onKeyUp=e=>{e.key!=="Enter"&&e.key!==" "||this.holdGesture?.source!=="keyboard"||this.holdGesture.key!==e.key||this.releaseHoldGesture()},this.onBlur=()=>{this.releaseHoldGesture()},this.onClick=()=>{this.mode!=="toggle"||this.disabled||(this._state==="recording"?this.stop():this.start())}}static{this.defaultStrings={...super.defaultStrings,pushToTalkCancelled:LYRA_DEFAULT_pushToTalkCancelled,pushToTalkDenied:LYRA_DEFAULT_pushToTalkDenied,pushToTalkError:LYRA_DEFAULT_pushToTalkError,pushToTalkHold:LYRA_DEFAULT_pushToTalkHold,pushToTalkRequesting:LYRA_DEFAULT_pushToTalkRequesting,pushToTalkStart:LYRA_DEFAULT_pushToTalkStart,pushToTalkStarted:LYRA_DEFAULT_pushToTalkStarted,pushToTalkStop:LYRA_DEFAULT_pushToTalkStop,pushToTalkStopped:LYRA_DEFAULT_pushToTalkStopped,pushToTalkUnsupported:LYRA_DEFAULT_pushToTalkUnsupported}}static{this.styles=[LyraElement.styles,styles]}get mode(){return this._mode}set mode(next){const normalized=PUSH_TO_TALK_MODE.normalize(next),old=this._mode;old!==normalized&&(this._mode=normalized,this.requestUpdate("mode",old))}get state(){return this._state}get stream(){return this._stream}get ownerWindow(){return this.ownerDocument?.defaultView??null}get captureOwner(){const owner=this.ownerWindow;if(isPushToTalkSupported(owner))return{document:this.ownerDocument,window:owner,generation:this.lifecycleGeneration}}ownsCurrentLifecycle(owner){return this.isConnected&&this.isCurrentRealm(owner)&&this.lifecycleGeneration===owner.generation}isCurrentRealm(owner){return this.ownerDocument===owner.document&&this.ownerWindow===owner.window}rebaseCurrentRealmOwner(owner){this.isCurrentRealm(owner)&&(owner.generation=this.lifecycleGeneration)}createIntent(kind,details={}){const owner=this.captureOwner;if(!owner)return;const intent={id:++this.intentSequence,owner,kind,...details};return this.captureIntent=intent,intent}isLiveIntent(intent){return this.captureIntent===intent&&!this.disabled&&this.ownsCurrentLifecycle(intent.owner)&&(intent.kind!=="hold"||this.holdGesture===intent)}clearIntent(intent){this.captureIntent===intent&&(this.captureIntent=void 0),this.holdGesture===intent&&(this.holdGesture=void 0),this.queuedIntent===intent&&(this.queuedIntent=void 0)}retirePendingRequest(request,notifyCancellation){request.invalidated=!0,request.notifyCancellation||=notifyCancellation,request.retiredAtIntentId=this.intentSequence,request.retiredAtGeneration=this.lifecycleGeneration,this.pendingRequest===request&&(this.pendingRequest=void 0),this.clearIntent(request.intent),this._state==="requesting"&&!this.activeCapture&&this.setState("idle")}invalidateLifecycle(notifyCancellation,retainCurrentRealmIntents=!1){this.lifecycleGeneration+=1,this.captureIntent&&retainCurrentRealmIntents&&this.isCurrentRealm(this.captureIntent.owner)?this.rebaseCurrentRealmOwner(this.captureIntent.owner):this.captureIntent=void 0,this.holdGesture&&retainCurrentRealmIntents&&this.isCurrentRealm(this.holdGesture.owner)?this.rebaseCurrentRealmOwner(this.holdGesture.owner):this.holdGesture=void 0,this.queuedIntent&&retainCurrentRealmIntents&&this.isCurrentRealm(this.queuedIntent.owner)?this.rebaseCurrentRealmOwner(this.queuedIntent.owner):this.queuedIntent=void 0;const request=this.pendingRequest;request&&this.retirePendingRequest(request,notifyCancellation);const active=this.activeCapture;active&&(active.notifyCancellation&&=notifyCancellation,this.requestRecorderStop(!0))}canAdoptRequest(request,intent){return this.pendingRequest===request&&!request.invalidated&&this._state==="requesting"&&this.ownsCurrentLifecycle(request.owner)&&this.isLiveIntent(intent)&&request.owner.document===intent.owner.document&&request.owner.window===intent.owner.window&&request.owner.generation===intent.owner.generation}canStartRequest(request){return this.canAdoptRequest(request,request.intent)}notifyCancellation(){this.emit("lr-record-cancel",null),this.isConnected&&this.announce(this.localize("pushToTalkCancelled"))}resumeQueuedIntent(){const intent=this.queuedIntent;this.queuedIntent=void 0,!(!intent||!this.isLiveIntent(intent))&&this.startForIntent(intent)}finishRetiredRequest(request){request.notifyCancellation&&!request.cancellationNotified&&request.retiredAtIntentId===this.intentSequence&&request.retiredAtGeneration===this.lifecycleGeneration&&!this.pendingRequest&&!this.activeCapture&&!this.captureIntent&&(request.cancellationNotified=!0,this.notifyCancellation())}finishUnusableRequest(request){if(request.invalidated){this.finishRetiredRequest(request);return}this.pendingRequest===request&&(this.pendingRequest=void 0),this.clearIntent(request.intent),this._state==="requesting"&&!this.activeCapture&&this.setState("idle"),this.notifyCancellation()}syncCaptureSupport(){this.captureSupported=isPushToTalkSupported(this.ownerWindow)}connectedCallback(){super.connectedCallback(),this.requestUpdate("mode",void 0),this.hasAttribute("data-state")||this.setAttribute("data-state",this._state)}disconnectedCallback(){const previousOwner=this.activeCapture?.owner??this.pendingRequest?.owner;this.invalidateLifecycle(!1,!!previousOwner&&!this.isCurrentRealm(previousOwner)),super.disconnectedCallback()}adoptedCallback(){this.invalidateLifecycle(!1,!0),super.adoptedCallback(),this.syncCaptureSupport()}willUpdate(changed){super.willUpdate(changed),this.hasUpdated?this.syncCaptureSupport():this.seedFirstRenderState(()=>this.syncCaptureSupport()),changed.has("mode")&&changed.get("mode")!==void 0&&this.holdGesture&&this.releaseHoldGesture(!0),changed.has("disabled")&&this.disabled&&this.invalidateLifecycle(!0);const owner=this.captureWindow;this._state!=="recording"||!owner||(changed.has("withoutTimer")&&this.syncElapsedTimer(owner),changed.has("maxDurationMs")&&this.syncMaxDurationTimer(owner),changed.has("levelEvents")&&this.syncLevelMeter(owner))}updated(changed){super.updated(changed);const describedBy=this.getAttribute("aria-describedby");(describedBy||this.describedByReflected)&&(this.describedByReflected=syncAriaDescribedByElements(this,this.trigger,describedBy))}focus(options){this.trigger?.focus(options)}blur(){this.trigger?.blur()}click(){this.disabled||!isPushToTalkSupported(this.ownerWindow)||(this.mode==="toggle"?this.trigger?.click():this._state==="recording"?this.stop():this.start())}resolveMimeType(owner){if(this.mimeType)return this.mimeType;for(const candidate of CANDIDATE_MIME_TYPES)if(owner.MediaRecorder.isTypeSupported?.(candidate))return candidate;return""}setState(next){if(this._state===next)return;const old=this._state;this._state=next,this.setAttribute("data-state",next),this.requestUpdate("state",old),this.emit("lr-record-state-change",{state:next})}announce(text){const region=this.liveRegion;region&&(region.mode="polite",region.announce(text,{force:!0}))}async start(){if(this.disabled||this._state==="recording")return!1;const intent=this.createIntent("programmatic");return intent?this.startForIntent(intent):!1}startForIntent(intent){const pending=this.pendingRequest;if(pending)return pending.intent=intent,pending.completion??Promise.resolve(!1);if(this._state==="recording")return intent.kind==="hold"&&this.activeCapture&&this.recorderStopRequested&&this.isLiveIntent(intent)?(this.queuedIntent=intent,Promise.resolve(!1)):(this.clearIntent(intent),Promise.resolve(!1));if(!this.isLiveIntent(intent))return this.clearIntent(intent),Promise.resolve(!1);const request={id:++this.captureSequence,owner:intent.owner,intent,invalidated:!1,notifyCancellation:!1,cancellationNotified:!1};this.pendingRequest=request,this.setState("requesting");const completion=this.requestPermission(request);return request.completion=completion,completion}captureConstraints(){const additionalConstraints={...this.audioConstraints??{}};return delete additionalConstraints.deviceId,{audio:{...additionalConstraints,...this.deviceId?{deviceId:{exact:this.deviceId}}:{}}}}async requestPermission(request){try{const stream=await request.owner.window.navigator.mediaDevices.getUserMedia(this.captureConstraints());if(!this.canStartRequest(request)){for(const track of stream.getTracks())track.stop();return this.finishUnusableRequest(request),!1}return this.pendingRequest=void 0,this.startRecorder(request,stream)}catch(error){if(!this.canStartRequest(request))return this.finishUnusableRequest(request),!1;this.pendingRequest=void 0,this.clearIntent(request.intent);const denied=typeof error=="object"&&error!==null&&"name"in error&&error.name==="NotAllowedError";return this.setState(denied?"denied":"error"),this.emit("lr-record-error",{error}),this.announce(this.localize(denied?"pushToTalkDenied":"pushToTalkError")),!1}}startRecorder(request,stream){const owner=request.owner.window,active={id:request.id,owner:request.owner,intent:request.intent,notifyCancellation:!0};this.activeCapture=active,this.captureWindow=owner,this._stream=stream,this.cancelRequested=!1,this.recorderStopRequested=!1,this.recorderFailed=!1,this.chunks=[];try{const mimeType=this.resolveMimeType(owner),recorder=new owner.MediaRecorder(stream,mimeType?{mimeType}:void 0);this.recorder=recorder;const timeslice=this.timesliceMs>0?finiteDuration(this.timesliceMs,MAX_TIMEOUT_MS,1,MAX_TIMEOUT_MS):void 0,emitChunksForTake=timeslice!==void 0;return recorder.ondataavailable=event=>{this.recorder!==recorder||this.activeCapture!==active||!event.data||event.data.size===0||(this.chunks.push(event.data),emitChunksForTake&&this.emit("lr-record-chunk",{blob:event.data}))},recorder.onstop=()=>this.finalizeStop(recorder,active),recorder.onerror=event=>this.failRecorder(recorder,active,event.error??new Error("MediaRecorder failed")),recorder.start(timeslice),this.recordingStartedAt=owner.performance.now(),this.elapsedMs=0,this.setState("recording"),this.emit("lr-record-start",{stream}),this.announce(this.localize("pushToTalkStarted")),this.syncLevelMeter(owner),this.syncMaxDurationTimer(owner,!0),this.syncElapsedTimer(owner,!0),!0}catch(error){if(this.activeCapture!==active){for(const track of stream.getTracks())track.stop();return!1}return this.teardownStream(active),this.clearIntent(active.intent),this.setState("error"),this.emit("lr-record-error",{error}),this.announce(this.localize("pushToTalkError")),!1}}stop(){this.requestRecorderStop(!1)}cancel(){const pending=this.pendingRequest;if(pending&&this._state==="requesting"){this.retirePendingRequest(pending,!0);return}this._state==="recording"&&this.requestRecorderStop(!0)}requestRecorderStop(cancelled){const active=this.activeCapture;if(this._state!=="recording"||!active||(cancelled&&(this.cancelRequested=!0),this.recorderStopRequested))return;this.recorderStopRequested=!0,this.stopRuntimeLoops();const recorder=this.recorder;recorder&&recorder.state!=="inactive"&&recorder.stop()}finalizeStop(recorder,active){if(this.recorder!==recorder||this.activeCapture!==active||this.recorderFailed)return;const owner=active.owner.window,cancelled=this.cancelRequested,durationMs=Math.round(owner.performance.now()-this.recordingStartedAt),mimeType=recorder.mimeType||this.resolveMimeType(owner)||"audio/webm",blob=new owner.Blob(this.chunks,{type:mimeType});this.teardownStream(active),this.clearIntent(active.intent),this.setState("idle"),cancelled?active.notifyCancellation&&this.notifyCancellation():(this.emit("lr-record-stop",{blob,durationMs}),this.announce(this.localize("pushToTalkStopped"))),this.cancelRequested=!1,this.resumeQueuedIntent()}failRecorder(recorder,active,error){this.recorder!==recorder||this.activeCapture!==active||this.recorderFailed||this.cancelRequested||(this.recorderFailed=!0,this.cancelRequested=!1,this.teardownStream(active),this.clearIntent(active.intent),this.setState("error"),this.emit("lr-record-error",{error}),this.announce(this.localize("pushToTalkError")),this.resumeQueuedIntent())}teardownStream(active=this.activeCapture){if(!(!active||this.activeCapture!==active)){for(const track of this._stream?.getTracks()??[])track.stop();this._stream=null,this.recorder&&(this.recorder.ondataavailable=null,this.recorder.onstop=null,this.recorder.onerror=null),this.recorder=void 0,this.recorderStopRequested=!1,this.chunks=[],this.stopRuntimeLoops(),this.captureWindow=void 0,this.activeCapture=void 0}}stopRuntimeLoops(){this.tickTimer.cancel(),this.maxDurationTimer.cancel(),this.stopLevelMeter()}syncElapsedTimer(owner,initial=!1){this.tickTimer.cancel();const active=this.activeCapture;this.withoutTimer||this._state!=="recording"||!active||active.owner.window!==owner||!this.ownsCurrentLifecycle(active.owner)||(initial||(this.elapsedMs=owner.performance.now()-this.recordingStartedAt),this.tickTimer.schedule(1e3,()=>{this.activeCapture!==active||this._state!=="recording"||!this.ownsCurrentLifecycle(active.owner)||(this.elapsedMs=owner.performance.now()-this.recordingStartedAt)}))}syncMaxDurationTimer(owner,initial=!1){this.maxDurationTimer.cancel();const active=this.activeCapture;if(this.maxDurationMs<=0||this._state!=="recording"||!active||active.owner.window!==owner||!this.ownsCurrentLifecycle(active.owner))return;const duration=finiteDuration(this.maxDurationMs,MAX_TIMEOUT_MS,1,MAX_TIMEOUT_MS),elapsed=initial?0:Math.max(0,owner.performance.now()-this.recordingStartedAt);this.maxDurationTimer.schedule(Math.max(0,duration-elapsed),()=>{this.activeCapture!==active||!this.ownsCurrentLifecycle(active.owner)||this.stop()})}syncLevelMeter(owner){const active=this.activeCapture;if(!this.levelEvents||this._state!=="recording"||!active||active.owner.window!==owner||!this.ownsCurrentLifecycle(active.owner)||!this._stream){this.stopLevelMeter();return}this.audioCtx||this.startLevelMeter(this._stream,owner)}startLevelMeter(stream,owner){const AudioCtxCtor=owner.AudioContext??owner.webkitAudioContext;if(AudioCtxCtor)try{const audioCtx=new AudioCtxCtor;this.audioCtx=audioCtx,audioCtx.resume().catch(()=>{});const source=audioCtx.createMediaStreamSource(stream),analyser=audioCtx.createAnalyser();this.analyser=analyser,analyser.fftSize=256,source.connect(analyser),this.levelData=new owner.Uint8Array(analyser.frequencyBinCount),this.sampleLevel(owner)}catch{this.stopLevelMeter()}}sampleLevel(owner){const active=this.activeCapture;if(!this.analyser||!this.levelData||this._state!=="recording"||!active||active.owner.window!==owner||!this.ownsCurrentLifecycle(active.owner))return;this.analyser.getByteTimeDomainData(this.levelData);let sumSquares=0;for(const v of this.levelData){const norm=(v-128)/128;sumSquares+=norm*norm}const rms=Math.sqrt(sumSquares/this.levelData.length);this.emit("lr-level",{level:Math.min(1,rms)}),this.levelFrame.schedule(()=>{this.activeCapture===active&&this.ownsCurrentLifecycle(active.owner)&&this.sampleLevel(owner)})}stopLevelMeter(){this.levelFrame.cancel(),this.analyser=void 0,this.levelData=void 0,this.audioCtx&&(this.audioCtx.close().catch(()=>{}),this.audioCtx=void 0)}formatElapsed(ms){return formatMediaTime(ms/1e3,this.effectiveLocale)}releaseHoldGesture(retirePending=!1){const intent=this.holdGesture;if(!intent)return;this.holdGesture=void 0,this.captureIntent===intent&&(this.captureIntent=void 0),this.queuedIntent===intent&&(this.queuedIntent=void 0);const pending=this.pendingRequest;if(pending?.intent===intent){retirePending&&this.retirePendingRequest(pending,!0);return}this.activeCapture?.intent===intent&&this.requestRecorderStop(!1)}get triggerLabel(){const override=this.getAttribute("aria-label");return override!==null?override:this.mode==="hold"?this.localize("pushToTalkHold"):this._state==="recording"?this.localize("pushToTalkStop"):this.localize("pushToTalkStart")}get statusText(){if(!this.captureSupported)return this.localize("pushToTalkUnsupported");switch(this._state){case"requesting":return this.localize("pushToTalkRequesting");case"denied":return this.localize("pushToTalkDenied");case"error":return this.localize("pushToTalkError");default:return""}}render(){const supported=this.captureSupported,recording=this._state==="recording",status=this.statusText;return html`
10
+ `)}function pulseGlyph(){return icon(svg`<circle cx="12" cy="12" r="6"></circle>`)}class LyraPushToTalk extends LyraElement{constructor(){super(...arguments),this._mode="hold",this.timesliceMs=0,this.mimeType="",this.deviceId="",this.levelEvents=!1,this.maxDurationMs=0,this.withoutTimer=!1,this.disabled=!1,this.elapsedMs=0,this.captureSupported=!1,this._state="idle",this._stream=null,this.describedByReflected=!1,this.chunks=[],this.recordingStartedAt=0,this.lifecycleGeneration=0,this.captureSequence=0,this.intentSequence=0,this.cancelRequested=!1,this.recorderStopRequested=!1,this.recorderFailed=!1,this.tickTimer=new OwnedInterval(this),this.maxDurationTimer=new OwnedTimeout(this),this.levelFrame=new OwnedFrame(this),this.onPointerDown=e=>{if(this.mode!=="hold"||this.disabled)return;e.preventDefault();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}if(this.holdGesture)return;const intent=this.createIntent("hold",{source:"pointer",pointerId:e.pointerId});intent&&(this.holdGesture=intent,this.startForIntent(intent))},this.onPointerUp=event=>{this.holdGesture?.source!=="pointer"||this.holdGesture.pointerId!==event.pointerId||this.releaseHoldGesture()},this.onPointerCancel=event=>{this.holdGesture?.source!=="pointer"||this.holdGesture.pointerId!==event.pointerId||this.releaseHoldGesture()},this.onKeyDown=e=>{if(this.disabled)return;if(e.key==="Escape"){if(this._state!=="requesting"&&this._state!=="recording")return;e.preventDefault(),this.cancel();return}if(e.key!=="Enter"&&e.key!==" "||this.mode!=="hold"||e.repeat||(e.preventDefault(),this.holdGesture))return;const intent=this.createIntent("hold",{source:"keyboard",key:e.key});intent&&(this.holdGesture=intent,this.startForIntent(intent))},this.onKeyUp=e=>{e.key!=="Enter"&&e.key!==" "||this.holdGesture?.source!=="keyboard"||this.holdGesture.key!==e.key||this.releaseHoldGesture()},this.onBlur=()=>{this.releaseHoldGesture()},this.onClick=()=>{this.mode!=="toggle"||this.disabled||(this._state==="recording"?this.stop():this.start())}}static{this.defaultStrings={...super.defaultStrings,pushToTalkCancelled:LYRA_DEFAULT_pushToTalkCancelled,pushToTalkDenied:LYRA_DEFAULT_pushToTalkDenied,pushToTalkError:LYRA_DEFAULT_pushToTalkError,pushToTalkHold:LYRA_DEFAULT_pushToTalkHold,pushToTalkRequesting:LYRA_DEFAULT_pushToTalkRequesting,pushToTalkStart:LYRA_DEFAULT_pushToTalkStart,pushToTalkStarted:LYRA_DEFAULT_pushToTalkStarted,pushToTalkStop:LYRA_DEFAULT_pushToTalkStop,pushToTalkStopped:LYRA_DEFAULT_pushToTalkStopped,pushToTalkUnsupported:LYRA_DEFAULT_pushToTalkUnsupported}}static{this.styles=[LyraElement.styles,styles]}get mode(){return this._mode}set mode(next){const normalized=PUSH_TO_TALK_MODE.normalize(next),old=this._mode;old!==normalized&&(this._mode=normalized,this.requestUpdate("mode",old))}get state(){return this._state}get stream(){return this._stream}get ownerWindow(){return this.ownerDocument?.defaultView??null}get captureOwner(){const owner=this.ownerWindow;if(isPushToTalkSupported(owner))return{document:this.ownerDocument,window:owner,generation:this.lifecycleGeneration}}ownsCurrentLifecycle(owner){return this.isConnected&&this.isCurrentRealm(owner)&&this.lifecycleGeneration===owner.generation}isCurrentRealm(owner){return this.ownerDocument===owner.document&&this.ownerWindow===owner.window}rebaseCurrentRealmOwner(owner){this.isCurrentRealm(owner)&&(owner.generation=this.lifecycleGeneration)}createIntent(kind,details={}){const owner=this.captureOwner;if(!owner)return;const intent={id:++this.intentSequence,owner,kind,...details};return this.captureIntent=intent,intent}isLiveIntent(intent){return this.captureIntent===intent&&!this.disabled&&this.ownsCurrentLifecycle(intent.owner)&&(intent.kind!=="hold"||this.holdGesture===intent)}clearIntent(intent){this.captureIntent===intent&&(this.captureIntent=void 0),this.holdGesture===intent&&(this.holdGesture=void 0),this.queuedIntent===intent&&(this.queuedIntent=void 0)}retirePendingRequest(request,notifyCancellation){request.invalidated=!0,request.notifyCancellation||=notifyCancellation,request.retiredAtIntentId=this.intentSequence,request.retiredAtGeneration=this.lifecycleGeneration,this.pendingRequest===request&&(this.pendingRequest=void 0),this.clearIntent(request.intent),this._state==="requesting"&&!this.activeCapture&&this.setState("idle")}invalidateLifecycle(notifyCancellation,retainCurrentRealmIntents=!1){this.lifecycleGeneration+=1,this.captureIntent&&retainCurrentRealmIntents&&this.isCurrentRealm(this.captureIntent.owner)?this.rebaseCurrentRealmOwner(this.captureIntent.owner):this.captureIntent=void 0,this.holdGesture&&retainCurrentRealmIntents&&this.isCurrentRealm(this.holdGesture.owner)?this.rebaseCurrentRealmOwner(this.holdGesture.owner):this.holdGesture=void 0,this.queuedIntent&&retainCurrentRealmIntents&&this.isCurrentRealm(this.queuedIntent.owner)?this.rebaseCurrentRealmOwner(this.queuedIntent.owner):this.queuedIntent=void 0;const request=this.pendingRequest;request&&this.retirePendingRequest(request,notifyCancellation);const active=this.activeCapture;active&&(active.notifyCancellation&&=notifyCancellation,this.requestRecorderStop(!0))}canAdoptRequest(request,intent){return this.pendingRequest===request&&!request.invalidated&&this._state==="requesting"&&this.ownsCurrentLifecycle(request.owner)&&this.isLiveIntent(intent)&&request.owner.document===intent.owner.document&&request.owner.window===intent.owner.window&&request.owner.generation===intent.owner.generation}canStartRequest(request){return this.canAdoptRequest(request,request.intent)}notifyCancellation(){this.emit("lr-record-cancel",null),this.isConnected&&this.announce(this.localize("pushToTalkCancelled"))}resumeQueuedIntent(){const intent=this.queuedIntent;this.queuedIntent=void 0,!(!intent||!this.isLiveIntent(intent))&&this.startForIntent(intent)}finishRetiredRequest(request){request.notifyCancellation&&!request.cancellationNotified&&request.retiredAtIntentId===this.intentSequence&&request.retiredAtGeneration===this.lifecycleGeneration&&!this.pendingRequest&&!this.activeCapture&&!this.captureIntent&&(request.cancellationNotified=!0,this.notifyCancellation())}finishUnusableRequest(request){if(request.invalidated){this.finishRetiredRequest(request);return}this.pendingRequest===request&&(this.pendingRequest=void 0),this.clearIntent(request.intent),this._state==="requesting"&&!this.activeCapture&&this.setState("idle"),this.notifyCancellation()}syncCaptureSupport(){this.captureSupported=isPushToTalkSupported(this.ownerWindow)}connectedCallback(){super.connectedCallback(),this.requestUpdate("mode",void 0),this.hasAttribute("data-state")||this.setAttribute("data-state",this._state)}disconnectedCallback(){const previousOwner=this.activeCapture?.owner??this.pendingRequest?.owner;this.invalidateLifecycle(!1,!!previousOwner&&!this.isCurrentRealm(previousOwner)),super.disconnectedCallback()}adoptedCallback(){this.invalidateLifecycle(!1,!0),super.adoptedCallback(),this.syncCaptureSupport()}willUpdate(changed){super.willUpdate(changed),this.hasUpdated?this.syncCaptureSupport():this.seedFirstRenderState(()=>this.syncCaptureSupport()),changed.has("mode")&&changed.get("mode")!==void 0&&this.holdGesture&&this.releaseHoldGesture(!0),changed.has("disabled")&&this.disabled&&this.invalidateLifecycle(!0);const owner=this.captureWindow;this._state!=="recording"||!owner||(changed.has("withoutTimer")&&this.syncElapsedTimer(owner),changed.has("maxDurationMs")&&this.syncMaxDurationTimer(owner),changed.has("levelEvents")&&this.syncLevelMeter(owner))}updated(changed){super.updated(changed);const describedBy=this.getAttribute("aria-describedby");(describedBy||this.describedByReflected)&&(this.describedByReflected=syncAriaDescribedByElements(this,this.trigger,describedBy))}focus(options){this.trigger?.focus(options)}blur(){this.trigger?.blur()}click(){this.disabled||!isPushToTalkSupported(this.ownerWindow)||(this.mode==="toggle"?this.trigger?.click():this._state==="recording"?this.stop():this.start())}resolveMimeType(owner){if(this.mimeType)return this.mimeType;for(const candidate of CANDIDATE_MIME_TYPES)if(owner.MediaRecorder.isTypeSupported?.(candidate))return candidate;return""}setState(next){if(this._state===next)return;const old=this._state;this._state=next,this.setAttribute("data-state",next),this.requestUpdate("state",old),this.emit("lr-record-state-change",{state:next})}announce(text){const region=this.liveRegion;region&&(region.mode="polite",region.announce(text,{force:!0}))}async start(){if(this.disabled||this._state==="recording")return!1;const intent=this.createIntent("programmatic");return intent?this.startForIntent(intent):!1}startForIntent(intent){const pending=this.pendingRequest;if(pending)return pending.intent=intent,pending.completion??Promise.resolve(!1);if(this._state==="recording")return intent.kind==="hold"&&this.activeCapture&&this.recorderStopRequested&&this.isLiveIntent(intent)?(this.queuedIntent=intent,Promise.resolve(!1)):(this.clearIntent(intent),Promise.resolve(!1));if(!this.isLiveIntent(intent))return this.clearIntent(intent),Promise.resolve(!1);const request={id:++this.captureSequence,owner:intent.owner,intent,invalidated:!1,notifyCancellation:!1,cancellationNotified:!1};this.pendingRequest=request,this.setState("requesting");const completion=this.requestPermission(request);return request.completion=completion,completion}captureConstraints(){const additionalConstraints={...this.audioConstraints??{}};return delete additionalConstraints.deviceId,{audio:{...additionalConstraints,...this.deviceId?{deviceId:{exact:this.deviceId}}:{}}}}async requestPermission(request){if(!this.canStartRequest(request))return this.finishUnusableRequest(request),!1;try{const stream=await request.owner.window.navigator.mediaDevices.getUserMedia(this.captureConstraints());if(!this.canStartRequest(request)){for(const track of stream.getTracks())track.stop();return this.finishUnusableRequest(request),!1}return this.pendingRequest=void 0,this.startRecorder(request,stream)}catch(error){if(!this.canStartRequest(request))return this.finishUnusableRequest(request),!1;this.pendingRequest=void 0,this.clearIntent(request.intent);const denied=typeof error=="object"&&error!==null&&"name"in error&&error.name==="NotAllowedError";return this.setState(denied?"denied":"error"),this.emit("lr-record-error",{error}),this.announce(this.localize(denied?"pushToTalkDenied":"pushToTalkError")),!1}}startRecorder(request,stream){const owner=request.owner.window,active={id:request.id,owner:request.owner,intent:request.intent,notifyCancellation:!0};this.activeCapture=active,this.captureWindow=owner,this._stream=stream,this.cancelRequested=!1,this.recorderStopRequested=!1,this.recorderFailed=!1,this.chunks=[];try{const mimeType=this.resolveMimeType(owner),recorder=new owner.MediaRecorder(stream,mimeType?{mimeType}:void 0);this.recorder=recorder;const timeslice=this.timesliceMs>0?finiteDuration(this.timesliceMs,MAX_TIMEOUT_MS,1,MAX_TIMEOUT_MS):void 0,emitChunksForTake=timeslice!==void 0;return recorder.ondataavailable=event=>{this.recorder!==recorder||this.activeCapture!==active||!event.data||event.data.size===0||(this.chunks.push(event.data),emitChunksForTake&&this.emit("lr-record-chunk",{blob:event.data}))},recorder.onstop=()=>this.finalizeStop(recorder,active),recorder.onerror=event=>this.failRecorder(recorder,active,event.error??new Error("MediaRecorder failed")),recorder.start(timeslice),this.recordingStartedAt=owner.performance.now(),this.elapsedMs=0,this.setState("recording"),this.activeCapture!==active||!this.ownsCurrentLifecycle(active.owner)||this.recorderStopRequested||(this.emit("lr-record-start",{stream}),this.announce(this.localize("pushToTalkStarted")),this.syncLevelMeter(owner),this.syncMaxDurationTimer(owner,!0),this.syncElapsedTimer(owner,!0)),!0}catch(error){if(this.activeCapture!==active){for(const track of stream.getTracks())track.stop();return!1}return this.teardownStream(active),this.clearIntent(active.intent),this.setState("error"),this.emit("lr-record-error",{error}),this.announce(this.localize("pushToTalkError")),!1}}stop(){this.requestRecorderStop(!1)}cancel(){const pending=this.pendingRequest;if(pending&&this._state==="requesting"){this.retirePendingRequest(pending,!0);return}this._state==="recording"&&this.requestRecorderStop(!0)}requestRecorderStop(cancelled){const active=this.activeCapture;if(this._state!=="recording"||!active||(cancelled&&(this.cancelRequested=!0),this.recorderStopRequested))return;this.recorderStopRequested=!0,this.stopRuntimeLoops();const recorder=this.recorder;recorder&&recorder.state!=="inactive"&&recorder.stop()}finalizeStop(recorder,active){if(this.recorder!==recorder||this.activeCapture!==active||this.recorderFailed)return;const owner=active.owner.window,cancelled=this.cancelRequested,durationMs=Math.round(owner.performance.now()-this.recordingStartedAt),mimeType=recorder.mimeType||this.resolveMimeType(owner)||"audio/webm",blob=new owner.Blob(this.chunks,{type:mimeType});this.teardownStream(active),this.clearIntent(active.intent),this.setState("idle"),cancelled?active.notifyCancellation&&this.notifyCancellation():(this.emit("lr-record-stop",{blob,durationMs}),this.announce(this.localize("pushToTalkStopped"))),this.cancelRequested=!1,this.resumeQueuedIntent()}failRecorder(recorder,active,error){this.recorder!==recorder||this.activeCapture!==active||this.recorderFailed||this.cancelRequested||(this.recorderFailed=!0,this.cancelRequested=!1,this.teardownStream(active),this.clearIntent(active.intent),this.setState("error"),this.emit("lr-record-error",{error}),this.announce(this.localize("pushToTalkError")),this.resumeQueuedIntent())}teardownStream(active=this.activeCapture){if(!(!active||this.activeCapture!==active)){for(const track of this._stream?.getTracks()??[])track.stop();this._stream=null,this.recorder&&(this.recorder.ondataavailable=null,this.recorder.onstop=null,this.recorder.onerror=null),this.recorder=void 0,this.recorderStopRequested=!1,this.chunks=[],this.stopRuntimeLoops(),this.captureWindow=void 0,this.activeCapture=void 0}}stopRuntimeLoops(){this.tickTimer.cancel(),this.maxDurationTimer.cancel(),this.stopLevelMeter()}syncElapsedTimer(owner,initial=!1){this.tickTimer.cancel();const active=this.activeCapture;this.withoutTimer||this._state!=="recording"||!active||active.owner.window!==owner||!this.ownsCurrentLifecycle(active.owner)||(initial||(this.elapsedMs=owner.performance.now()-this.recordingStartedAt),this.tickTimer.schedule(1e3,()=>{this.activeCapture!==active||this._state!=="recording"||!this.ownsCurrentLifecycle(active.owner)||(this.elapsedMs=owner.performance.now()-this.recordingStartedAt)}))}syncMaxDurationTimer(owner,initial=!1){this.maxDurationTimer.cancel();const active=this.activeCapture;if(this.maxDurationMs<=0||this._state!=="recording"||!active||active.owner.window!==owner||!this.ownsCurrentLifecycle(active.owner))return;const duration=finiteDuration(this.maxDurationMs,MAX_TIMEOUT_MS,1,MAX_TIMEOUT_MS),elapsed=initial?0:Math.max(0,owner.performance.now()-this.recordingStartedAt);this.maxDurationTimer.schedule(Math.max(0,duration-elapsed),()=>{this.activeCapture!==active||!this.ownsCurrentLifecycle(active.owner)||this.stop()})}syncLevelMeter(owner){const active=this.activeCapture;if(!this.levelEvents||this._state!=="recording"||!active||active.owner.window!==owner||!this.ownsCurrentLifecycle(active.owner)||!this._stream){this.stopLevelMeter();return}this.audioCtx||this.startLevelMeter(this._stream,owner)}startLevelMeter(stream,owner){const AudioCtxCtor=owner.AudioContext??owner.webkitAudioContext;if(AudioCtxCtor)try{const audioCtx=new AudioCtxCtor;this.audioCtx=audioCtx,audioCtx.resume().catch(()=>{});const source=audioCtx.createMediaStreamSource(stream),analyser=audioCtx.createAnalyser();this.analyser=analyser,analyser.fftSize=256,source.connect(analyser),this.levelData=new owner.Uint8Array(analyser.frequencyBinCount),this.sampleLevel(owner)}catch{this.stopLevelMeter()}}sampleLevel(owner){const active=this.activeCapture;if(!this.analyser||!this.levelData||this._state!=="recording"||!active||active.owner.window!==owner||!this.ownsCurrentLifecycle(active.owner))return;this.analyser.getByteTimeDomainData(this.levelData);let sumSquares=0;for(const v of this.levelData){const norm=(v-128)/128;sumSquares+=norm*norm}const rms=Math.sqrt(sumSquares/this.levelData.length);this.emit("lr-level",{level:Math.min(1,rms)}),this.levelFrame.schedule(()=>{this.activeCapture===active&&this.ownsCurrentLifecycle(active.owner)&&this.sampleLevel(owner)})}stopLevelMeter(){this.levelFrame.cancel(),this.analyser=void 0,this.levelData=void 0,this.audioCtx&&(this.audioCtx.close().catch(()=>{}),this.audioCtx=void 0)}formatElapsed(ms){return formatMediaTime(ms/1e3,this.effectiveLocale)}releaseHoldGesture(retirePending=!1){const intent=this.holdGesture;if(!intent)return;this.holdGesture=void 0,this.captureIntent===intent&&(this.captureIntent=void 0),this.queuedIntent===intent&&(this.queuedIntent=void 0);const pending=this.pendingRequest;if(pending?.intent===intent){retirePending&&this.retirePendingRequest(pending,!0);return}this.activeCapture?.intent===intent&&this.requestRecorderStop(!1)}get triggerLabel(){const override=this.getAttribute("aria-label");return override!==null?override:this.mode==="hold"?this.localize("pushToTalkHold"):this._state==="recording"?this.localize("pushToTalkStop"):this.localize("pushToTalkStart")}get statusText(){if(!this.captureSupported)return this.localize("pushToTalkUnsupported");switch(this._state){case"requesting":return this.localize("pushToTalkRequesting");case"denied":return this.localize("pushToTalkDenied");case"error":return this.localize("pushToTalkError");default:return""}}render(){const supported=this.captureSupported,recording=this._state==="recording",status=this.statusText;return html`
11
11
  <button
12
12
  part="trigger"
13
13
  type="button"
@@ -341,7 +341,7 @@ errorDescription:string;
341
341
  * `[part="row"]` one level up, and an unstyled block box contributes exactly its child's height
342
342
  * to it, so adding it leaves every measured row height unchanged. Applies to rows only -- group
343
343
  * headers never pass through `wrapRow` and never carry `row-wrapper`. */
344
- wrapRow?:(thread:LyraChatThread,row:TemplateResult)=>TemplateResult;private readonly stickyGroupItems;private dataModel?;private searchText;private hasEmptySlot;private hasDefaultSlotContent;private virtualListEl?;private liveRegion?;private searchInputEl?;private focusTaskGeneration;private readonly injectedListItemRoles;private get dataMode();connectedCallback():void;private contentRefreshPending;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;protected willUpdate(changed:PropertyValues):void;private sourceStatusInitialized;private previousSourceStatus;protected updated(changed:PropertyValues):void;private defaultSlottedElements;private markAsListItems;private restoreInjectedListItemRoles;disconnectedCallback():void;private get normalizedThreads();private sourceThread;private sourceThreads;private readonly titleHaystacks;private readonly excerptHaystacks;private get visibleThreads();private bucketFor;private bucketLabel;private dateForBucket;private orderedCustomGroupIds;private groupedItems;private buildItems;private setSearchText;private onSearchInput;private onClearSearch;private announceMatchCount;private onSearchKeyDown;private onSearchFocus;private onSearchBlur;
344
+ wrapRow?:(thread:LyraChatThread,row:TemplateResult)=>TemplateResult;private readonly stickyGroupItems;private dataModel?;private searchText;private hasEmptySlot;private hasDefaultSlotContent;private virtualListEl?;private liveRegion?;private searchInputEl?;private focusTaskGeneration;private stopPendingFocus?;private excerptObserver?;private excerptRoot?;private excerptObservationGeneration;private readonly injectedListItemRoles;private get dataMode();connectedCallback():void;private contentRefreshPending;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;protected willUpdate(changed:PropertyValues):void;private sourceStatusInitialized;private previousSourceStatus;protected updated(changed:PropertyValues):void;private observeRenderedExcerpts;private syncRenderedExcerpts;private defaultSlottedElements;private markAsListItems;private restoreInjectedListItemRoles;disconnectedCallback():void;private get normalizedThreads();private sourceThread;private sourceThreads;private readonly titleHaystacks;private readonly excerptHaystacks;private get visibleThreads();private bucketFor;private bucketLabel;private dateForBucket;private orderedCustomGroupIds;private groupedItems;private buildItems;private setSearchText;private onSearchInput;private onClearSearch;private announceMatchCount;private onSearchKeyDown;private onSearchFocus;private onSearchBlur;
345
345
  /** The rendered `<lr-conversation-item>` for one thread's `conversationId` -- a data-mode
346
346
  * thread's own `id`, or a slotted item's own `conversation-id` -- or `null` when it is not
347
347
  * currently rendered: filtered out by `withArchived`/search, windowed out of the virtualized