@runtypelabs/persona 4.33.0 → 4.34.0

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 (186) hide show
  1. package/dist/activity-ui.d.cts +3 -15
  2. package/dist/activity-ui.d.ts +3 -15
  3. package/dist/animations/glyph-cycle.d.cts +1 -3
  4. package/dist/animations/glyph-cycle.d.ts +1 -3
  5. package/dist/animations/wipe.d.cts +1 -3
  6. package/dist/animations/wipe.d.ts +1 -3
  7. package/dist/approval-ui.cjs +2 -2
  8. package/dist/approval-ui.d.cts +3 -15
  9. package/dist/approval-ui.d.ts +3 -15
  10. package/dist/approval-ui.js +1 -1
  11. package/dist/artifacts-ui.cjs +1 -1
  12. package/dist/artifacts-ui.d.cts +3 -21
  13. package/dist/artifacts-ui.d.ts +3 -21
  14. package/dist/background-runtime.d.cts +2 -3
  15. package/dist/background-runtime.d.ts +2 -3
  16. package/dist/{chunk-gu34lr-P.js → chunk-Brdx4NCz.js} +1 -1
  17. package/dist/{chunk-dLJWKfOb.js → chunk-C-rux8Q9.js} +1 -1
  18. package/dist/{chunk-Ds_twaZn.js → chunk-C4v-HNhS.js} +1 -1
  19. package/dist/{chunk-Bkma5hIU.js → chunk-CE4seJxF.js} +1 -1
  20. package/dist/{chunk-D6U0E82p.js → chunk-CV8EPIhT.js} +1 -1
  21. package/dist/{chunk-ql5N2I_t.js → chunk-CWzHNuVK.js} +1 -1
  22. package/dist/{chunk-DbGLjU2P.js → chunk-CYpt7PsO.js} +1 -1
  23. package/dist/{chunk-DOZmcve8.js → chunk-Csr59G5V.js} +1 -1
  24. package/dist/{chunk-DW7Vg_l2.js → chunk-CxNPSY-b.js} +1 -1
  25. package/dist/chunk-Dqa_GOcj.js +1 -0
  26. package/dist/chunk-DsWv3EGF.js +1 -0
  27. package/dist/{chunk-C7-m0EmI.js → chunk-NUNdcnAZ.js} +1 -1
  28. package/dist/{chunk-CXQJG7pb.js → chunk-YMkMvAsa.js} +2 -2
  29. package/dist/{chunk-C-EHtpbB.js → chunk-h5aOI_Pa.js} +1 -1
  30. package/dist/chunk-kizhspe5.js +1 -0
  31. package/dist/client-dispatch.js +1 -1
  32. package/dist/client-history.js +1 -1
  33. package/dist/client-stream.js +1 -1
  34. package/dist/{code-generators-DqauYyfX.d.cts → code-generators-DPAqTcAz.d.cts} +0 -2
  35. package/dist/{code-generators-DqauYyfX.d.ts → code-generators-DPAqTcAz.d.ts} +0 -2
  36. package/dist/codegen.cjs +1 -1
  37. package/dist/codegen.d.cts +1 -1
  38. package/dist/codegen.d.ts +1 -1
  39. package/dist/codegen.js +1 -1
  40. package/dist/composer-actions-runtime.cjs +1 -1
  41. package/dist/composer-actions-runtime.d.cts +4 -20
  42. package/dist/composer-actions-runtime.d.ts +4 -20
  43. package/dist/composer-actions-runtime.js +1 -1
  44. package/dist/{composer-input-DnqGCXZz.d.ts → composer-input-i_FiUp6J.d.cts} +1 -7
  45. package/dist/{composer-input-DnqGCXZz.d.cts → composer-input-i_FiUp6J.d.ts} +1 -7
  46. package/dist/{composer-store-6Iwy6WLI.d.ts → composer-store-DhGNgG7Z.d.cts} +1 -3
  47. package/dist/{composer-store-6Iwy6WLI.d.cts → composer-store-DhGNgG7Z.d.ts} +1 -3
  48. package/dist/config-diagnostics.d.cts +0 -2
  49. package/dist/config-diagnostics.d.ts +0 -2
  50. package/dist/{context-mention-manager-B-rHF98n.d.ts → context-mention-manager-DL-xwGfL.d.cts} +2 -6
  51. package/dist/{context-mention-manager-B-rHF98n.d.cts → context-mention-manager-DL-xwGfL.d.ts} +2 -6
  52. package/dist/context-mentions-inline.cjs +1 -1
  53. package/dist/context-mentions-inline.d.cts +2 -4
  54. package/dist/context-mentions-inline.d.ts +2 -4
  55. package/dist/context-mentions-inline.js +1 -1
  56. package/dist/context-mentions.cjs +1 -1
  57. package/dist/context-mentions.d.cts +3 -9
  58. package/dist/context-mentions.d.ts +3 -9
  59. package/dist/{defaults-BuOjqUAG.d.ts → defaults-Bga2Xrsp.d.cts} +1 -5
  60. package/dist/{defaults-BuOjqUAG.d.cts → defaults-Bga2Xrsp.d.ts} +1 -5
  61. package/dist/dictation-runtime.cjs +1 -1
  62. package/dist/dictation-runtime.d.cts +4 -13
  63. package/dist/dictation-runtime.d.ts +4 -13
  64. package/dist/dictation-runtime.js +1 -1
  65. package/dist/{dom-context-DHTabIn7.d.cts → dom-context-Bw-_9Evh.d.cts} +0 -2
  66. package/dist/{dom-context-DHTabIn7.d.ts → dom-context-Bw-_9Evh.d.ts} +0 -2
  67. package/dist/event-stream-view.cjs +1 -1
  68. package/dist/event-stream-view.d.cts +3 -16
  69. package/dist/event-stream-view.d.ts +3 -16
  70. package/dist/{fallback-speech-engine-SqEfkGda.d.ts → fallback-speech-engine-kLdyPcmk.d.cts} +1 -3
  71. package/dist/{fallback-speech-engine-SqEfkGda.d.cts → fallback-speech-engine-kLdyPcmk.d.ts} +1 -3
  72. package/dist/{feature-preferences-DqAmje-2.d.ts → feature-preferences-CmwZGKrf.d.cts} +1 -5
  73. package/dist/{feature-preferences-DqAmje-2.d.cts → feature-preferences-CmwZGKrf.d.ts} +1 -5
  74. package/dist/forms-ui.d.cts +2 -4
  75. package/dist/forms-ui.d.ts +2 -4
  76. package/dist/{history-confirm-dialog-B3L7QNcO.d.cts → history-confirm-dialog-i46-lPN_.d.cts} +2 -14
  77. package/dist/{history-confirm-dialog-B3L7QNcO.d.ts → history-confirm-dialog-i46-lPN_.d.ts} +2 -14
  78. package/dist/history-shell.cjs +1 -1
  79. package/dist/history-shell.d.cts +8 -27
  80. package/dist/history-shell.d.ts +8 -27
  81. package/dist/history-shell.js +1 -1
  82. package/dist/history-view.d.cts +1 -1
  83. package/dist/history-view.d.ts +1 -1
  84. package/dist/icons-extra.cjs +1 -1
  85. package/dist/icons-extra.d.cts +0 -2
  86. package/dist/icons-extra.d.ts +0 -2
  87. package/dist/index.cjs +45 -45
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.cts +10 -10
  90. package/dist/index.d.ts +10 -10
  91. package/dist/index.global.js +1 -1
  92. package/dist/index.global.js.map +1 -1
  93. package/dist/index.js +49 -49
  94. package/dist/index.js.map +1 -1
  95. package/dist/install.global.js +1 -1
  96. package/dist/install.global.js.map +1 -1
  97. package/dist/launcher.global.js +2 -2
  98. package/dist/launcher.global.js.map +1 -1
  99. package/dist/{loading-label-runtime-loader-JecjOfJS.d.ts → loading-label-runtime-loader-Ccr3ETd3.d.cts} +1 -3
  100. package/dist/{loading-label-runtime-loader-JecjOfJS.d.cts → loading-label-runtime-loader-Ccr3ETd3.d.ts} +1 -3
  101. package/dist/loading-label-runtime.cjs +1 -1
  102. package/dist/loading-label-runtime.d.cts +1 -1
  103. package/dist/loading-label-runtime.d.ts +1 -1
  104. package/dist/loading-label-runtime.js +1 -1
  105. package/dist/markdown-parsers.js +1 -1
  106. package/dist/{message-bubble-CBYtpDsT.d.ts → message-bubble-C6AVaH7f.d.cts} +20 -3
  107. package/dist/{message-bubble-CBYtpDsT.d.cts → message-bubble-C6AVaH7f.d.ts} +20 -3
  108. package/dist/{plugin-kit-C1mRjLgW.d.cts → plugin-kit-BVggqE3C.d.cts} +0 -2
  109. package/dist/{plugin-kit-C1mRjLgW.d.ts → plugin-kit-BVggqE3C.d.ts} +0 -2
  110. package/dist/plugin-kit.d.cts +1 -1
  111. package/dist/plugin-kit.d.ts +1 -1
  112. package/dist/preferences-runtime.cjs +1 -1
  113. package/dist/preferences-runtime.d.cts +1 -1
  114. package/dist/preferences-runtime.d.ts +1 -1
  115. package/dist/preferences-runtime.js +1 -1
  116. package/dist/{preview-_UJwwt2L.d.cts → preview-BMdRffo4.d.cts} +2 -6
  117. package/dist/{preview-_UJwwt2L.d.ts → preview-BMdRffo4.d.ts} +2 -6
  118. package/dist/{registry-B5ZV3K-h.d.ts → registry-B16l8s1b.d.cts} +1 -8
  119. package/dist/{registry-B5ZV3K-h.d.cts → registry-B16l8s1b.d.ts} +1 -8
  120. package/dist/{session-Bys8_XuB.d.cts → session-CtZHe7fc.d.cts} +8 -92
  121. package/dist/{session-Bys8_XuB.d.ts → session-CtZHe7fc.d.ts} +8 -92
  122. package/dist/session-reconnect.d.cts +2 -4
  123. package/dist/session-reconnect.d.ts +2 -4
  124. package/dist/smart-dom-reader.d.cts +2 -8
  125. package/dist/smart-dom-reader.d.ts +2 -8
  126. package/dist/testing.d.cts +0 -2
  127. package/dist/testing.d.ts +0 -2
  128. package/dist/theme-editor-preview.cjs +42 -42
  129. package/dist/theme-editor-preview.d.cts +1 -1
  130. package/dist/theme-editor-preview.d.ts +1 -1
  131. package/dist/theme-editor-preview.js +25 -25
  132. package/dist/theme-editor.cjs +25 -5
  133. package/dist/theme-editor.d.cts +2 -22
  134. package/dist/theme-editor.d.ts +2 -22
  135. package/dist/theme-editor.js +1 -1
  136. package/dist/theme-reference.cjs +1 -1
  137. package/dist/theme-reference.d.cts +2 -4
  138. package/dist/theme-reference.d.ts +2 -4
  139. package/dist/theme-reference.js +1 -1
  140. package/dist/{tool-loading-animation-d5qAQcwv.d.ts → tool-loading-animation-D2cyFvmM.d.cts} +1 -7
  141. package/dist/{tool-loading-animation-d5qAQcwv.d.cts → tool-loading-animation-D2cyFvmM.d.ts} +1 -7
  142. package/dist/{tooltip-BkW-8MnD.d.cts → tooltip-DbXkAuJL.d.cts} +0 -2
  143. package/dist/{tooltip-BkW-8MnD.d.ts → tooltip-DbXkAuJL.d.ts} +0 -2
  144. package/dist/{turn-activity-ui-q6fHVnx-.d.cts → turn-activity-ui-Do1Nd-Ow.d.cts} +2 -12
  145. package/dist/{turn-activity-ui-q6fHVnx-.d.ts → turn-activity-ui-Do1Nd-Ow.d.ts} +2 -12
  146. package/dist/turn-activity-ui.d.cts +1 -1
  147. package/dist/turn-activity-ui.d.ts +1 -1
  148. package/dist/{types-B_mj21jg.d.cts → types-BC7MRxO5.d.cts} +76 -29
  149. package/dist/{types-B_mj21jg.d.ts → types-BC7MRxO5.d.ts} +76 -29
  150. package/dist/ui-extras.js +3 -3
  151. package/dist/voice-client-tools.d.cts +1 -3
  152. package/dist/voice-client-tools.d.ts +1 -3
  153. package/dist/voice-runtime.cjs +1 -1
  154. package/dist/voice-runtime.d.cts +2 -12
  155. package/dist/voice-runtime.d.ts +2 -12
  156. package/dist/voice-runtime.js +2 -2
  157. package/dist/voice-worklet-player.d.cts +2 -6
  158. package/dist/voice-worklet-player.d.ts +2 -6
  159. package/dist/{webmcp-runtime-entry-ClEO3qdI.d.ts → webmcp-runtime-entry-B8g46vS0.d.cts} +1 -5
  160. package/dist/{webmcp-runtime-entry-ClEO3qdI.d.cts → webmcp-runtime-entry-B8g46vS0.d.ts} +1 -5
  161. package/dist/webmcp-runtime.d.cts +1 -1
  162. package/dist/webmcp-runtime.d.ts +1 -1
  163. package/dist/widget.css +1 -1
  164. package/package.json +4 -4
  165. package/src/components/event-stream-view.test.ts +5 -0
  166. package/src/components/message-bubble.ts +26 -6
  167. package/src/components/scroll-to-bottom.test.ts +135 -0
  168. package/src/components/scroll-to-bottom.ts +50 -13
  169. package/src/components/user-message-collapse.ts +117 -0
  170. package/src/defaults.ts +6 -0
  171. package/src/styles/widget.css +56 -0
  172. package/src/theme-reference.ts +2 -2
  173. package/src/types/theme.ts +29 -0
  174. package/src/types.ts +49 -5
  175. package/src/ui.scroll-additive.test.ts +219 -117
  176. package/src/ui.scroll.test.ts +176 -13
  177. package/src/ui.ts +230 -107
  178. package/src/ui.turn-activity.test.ts +7 -7
  179. package/src/ui.user-message-collapse.test.ts +540 -0
  180. package/src/utils/auto-follow.test.ts +0 -38
  181. package/src/utils/auto-follow.ts +0 -35
  182. package/src/utils/theme.test.ts +23 -0
  183. package/src/utils/tokens.ts +16 -0
  184. package/dist/chunk-CVMIncEY.js +0 -1
  185. package/dist/chunk-DVgzoVCB.js +0 -1
  186. package/dist/chunk-d54BJdKd.js +0 -1
@@ -1341,6 +1341,13 @@ export function themeToCssVariables(theme: PersonaTheme): Record<string, string>
1341
1341
  ['fontSize', 'font-size'],
1342
1342
  ['fontWeight', 'font-weight'],
1343
1343
  ], '--persona-components-scrollToBottom-countBadge-');
1344
+ // The approval state falls back to the pill's own colors in CSS.
1345
+ emitTruthy(cssVars, 'scroll-to-bottom-approval-', [
1346
+ ['background', 'bg'],
1347
+ ['foreground', 'fg'],
1348
+ ['border', 'border'],
1349
+ ['fontWeight', 'font-weight'],
1350
+ ], '--persona-components-scrollToBottom-approval-');
1344
1351
 
1345
1352
  // V5 materializes message-action defaults in the theme; V4 retains the CSS
1346
1353
  // fallbacks. References follow ghost/semantic overrides in either scheme.
@@ -1352,6 +1359,15 @@ export function themeToCssVariables(theme: PersonaTheme): Record<string, string>
1352
1359
  ['borderRadius', 'radius'],
1353
1360
  ], '--persona-components-messageActions-');
1354
1361
 
1362
+ // Long user message collapse. widget.css carries the defaults in its var()
1363
+ // fallbacks (the fade and toggle follow the bubble text), so unset stays unset.
1364
+ emitTruthy(cssVars, 'user-collapse-', [
1365
+ ['fadeHeight', 'fade-height'],
1366
+ ['toggleForeground', 'toggle-fg'],
1367
+ ['toggleFontSize', 'toggle-font-size'],
1368
+ ['toggleFontWeight', 'toggle-font-weight'],
1369
+ ], '--persona-components-userMessageCollapse-');
1370
+
1355
1371
  // Intro card aliases: short names the panel inline-styles read directly.
1356
1372
  // The full-path `--persona-components-introCard-*` variables auto-emit above.
1357
1373
  // Default is flat (transparent, no shadow): the greeting renders as plain
@@ -1 +0,0 @@
1
- function e(e){return e.role!==`assistant`||e.variant===`tool`||e.variant===`reasoning`?!1:e.variant===`approval`||!!(e.content?.trim()||e.rawContent?.trim()||e.contentParts?.length)}function t(e=!0){let t=e;return{isFollowing:()=>t,pause:()=>t?(t=!1,!0):!1,resume:()=>!t&&(t=!0,!0)}}function n(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function r(e,t){return n(e)-e.scrollTop<=t}function i(e){let{following:t,currentScrollTop:n,lastScrollTop:r,nearBottom:i,userScrollThreshold:a,isAutoScrolling:o=!1,pauseOnUpwardScroll:s=!1,pauseWhenAwayFromBottom:c=!0,resumeRequiresDownwardScroll:l=!1}=e,u=n-r;return o||Math.abs(u)<a?{action:`none`,delta:u,nextLastScrollTop:n}:!t&&i&&(!l||u>0)?{action:`resume`,delta:u,nextLastScrollTop:n}:t&&s&&u<0||t&&c&&!i?{action:`pause`,delta:u,nextLastScrollTop:n}:{action:`none`,delta:u,nextLastScrollTop:n}}function a(e){let{following:t,deltaY:n,nearBottom:r=!1,resumeWhenNearBottom:i=!1}=e;return t&&n<0?`pause`:!t&&i&&n>0&&r?`resume`:`none`}function o(e,t){return!e||e.isCollapsed?!1:t.contains(e.anchorNode)||t.contains(e.focusNode)}function s(e){let t=Math.max(0,e.anchorOffsetTop-e.topOffset);return{targetScrollTop:t,spacerHeight:Math.max(0,t+e.viewportHeight-e.contentHeight+(e.slack??0))}}function c(e){let t=Math.max(0,e.currentContentHeight-e.contentHeightAtAnchor);return Math.max(0,e.initialSpacerHeight-t)}export{o as a,i as c,n as i,a as l,c as n,e as o,t as r,r as s,s as t};
@@ -1 +0,0 @@
1
- const e=`4.33.0`;export{e as t};
@@ -1 +0,0 @@
1
- import{f as e,m as t,p as n,r,s as i}from"./chunk-CEPM3FOp.js";import{r as a,t as o}from"./chunk-BnfM7-qg.js";import{t as s}from"./chunk-CnxIZOzx.js";import{i as c,r as l,t as u}from"./chunk-D5BxWOFB.js";import{r as d}from"./chunk-Bb41bKyp.js";import{t as f}from"./chunk-BlTD-Wgn.js";import{n as p,t as m}from"./chunk-BAkaTZpd.js";import{i as h,n as g,r as _,t as v}from"./chunk-BGPPJ_ui.js";import{t as y}from"./chunk-Bj8Hnh10.js";import{r as b}from"./chunk-Cy1A8vbF.js";import{Activity as x,ArrowDown as S,ArrowLeft as C,ArrowRight as w,ArrowUp as T,ArrowUpRight as E,AtSign as ee,Bot as D,Check as O,ChevronDown as k,ChevronLeft as A,ChevronRight as j,ChevronUp as M,Clipboard as N,ClipboardCopy as P,CodeXml as te,Copy as ne,Download as re,Ellipsis as ie,ExternalLink as ae,Eye as oe,File as se,FileCode as ce,FileSpreadsheet as le,FileText as ue,History as de,ImagePlus as fe,Loader as pe,LoaderCircle as me,Maximize as he,Menu as ge,MessageSquare as _e,Mic as ve,Minimize as ye,Minus as be,PanelLeft as xe,Paperclip as Se,Pencil as Ce,Plus as we,Quote as Te,RefreshCw as Ee,Search as De,Send as Oe,ShieldAlert as ke,ShieldCheck as Ae,ShieldX as je,Square as Me,Star as Ne,ThumbsDown as Pe,ThumbsUp as Fe,Trash as Ie,Trash2 as Le,Upload as Re,Volume2 as ze,X as Be}from"lucide";const Ve={activity:x,"arrow-down":S,"arrow-up":T,"arrow-up-right":E,bot:D,"chevron-down":k,"chevron-up":M,"chevron-right":j,"chevron-left":A,check:O,clipboard:N,"clipboard-copy":P,"code-xml":te,copy:ne,file:se,"file-code":ce,"file-spreadsheet":le,"file-text":ue,"image-plus":fe,loader:pe,"loader-circle":me,mic:ve,paperclip:Se,quote:Te,"refresh-cw":Ee,search:De,send:Oe,"shield-alert":ke,"shield-check":Ae,"shield-x":je,square:Me,"square-text":[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M7 8h10M7 12h10M7 16h6`}]],"thumbs-down":Pe,"thumbs-up":Fe,upload:Re,"volume-2":ze,"voice-bars":[[`path`,{d:`M4 10v4`}],[`path`,{d:`M8 6v12`}],[`path`,{d:`M12 3v18`}],[`path`,{d:`M16 7v10`}],[`path`,{d:`M20 10v4`}]],x:Be,"at-sign":ee,"arrow-left":C,"arrow-right":w,"external-link":ae,ellipsis:ie,menu:ge,"panel-left":xe,plus:we,minus:be,pencil:Ce,trash:Ie,"trash-2":Le,download:re,maximize:he,minimize:ye,"message-square":_e,star:Ne,eye:oe,history:de},He=/* @__PURE__ */ `brain.toolbox.wrench.circle.database.terminal.user.mail.phone.calendar.clock.building.map-pin.lock.key.credit-card.hash.globe.link.circle-check.circle-x.triangle-alert.info.ban.shield.ellipsis-vertical.house.pen-line.save.share.funnel.settings.rotate-cw.shopping-cart.shopping-bag.package.truck.tag.gift.receipt.wallet.store.dollar-sign.percent.play.pause.volume-x.camera.image.film.headphones.message-circle.bell.heart.eye-off.bookmark.calendar-days.timer.folder.folder-open.files.chart-column.sparkles.zap.sun.moon.flag.lightbulb.monitor.smartphone`.split(`.`),F=new Map(Object.entries(Ve)),I=/* @__PURE__ */ new Map;let L=!1;const Ue=/* @__PURE__ */ new Set,We=e=>{let t=[...Ue];e&&Ue.clear();for(let e of t)try{e()}catch{}},Ge=()=>{let e=0;for(let[t,n]of I){let r=F.get(n);if(!r)continue;I.delete(t),e++;let i=s(r);if(i)for(t.removeAttribute(`data-persona-icon-pending`);i.firstChild;)t.appendChild(i.firstChild)}return e},Ke=e=>{if(!L){for(let[t,n]of Object.entries(e))F.has(t)||F.set(t,n);L=!0,Ge(),We(!0)}},qe=()=>L?null:o().then(e=>Ke(e.EXTRA_LUCIDE_ICONS)),Je=()=>{qe()?.catch(e=>{console.warn(`[Persona] Failed to load the icons-extra chunk`,e)})},Ye=(e,t,n)=>{let r=s([],e,t,n);return r.setAttribute(`data-persona-icon-pending`,`true`),r},R=(e,t=24,n=`currentColor`,r=2)=>{let i=F.get(e);if(i)return s(i,t,n,r);if(He.includes(e)){let i=Ye(t,n,r);return I.size>=500&&I.delete(I.keys().next().value),I.set(i,e),Je(),i}return console.warn(`Unknown Persona icon "${e}". Use registerIcons().`),null},Xe=(e,t)=>e.visible!==!1&&(e.mode!==`transient`||t===`connecting`||t===`paused`||t===`resuming`||t===`error`),Ze=(e,t,n)=>{let r=t.mode===`transient`,i=e.hasAttribute(`data-persona-composer-reason`)||e.hasAttribute(`data-persona-composer-notice`);e.style.display=Xe(t,n)||r&&i&&t.visible!==!1?``:`none`,e.classList.toggle(`persona-mt-2`,!r),e.classList.toggle(`persona-mb-2`,r)},Qe=(e,t,n)=>{t.parentElement&&e.parentElement===t.parentElement&&(n.mode===`transient`?e.nextElementSibling!==t&&t.before(e):t.nextElementSibling!==e&&t.after(e))};function $e(e){let t=e.ownerDocument?.defaultView;if(!t?.getComputedStyle)return 20;let n=t.getComputedStyle(e).lineHeight;if(!n||!n.trim().endsWith(`px`))return 20;let r=parseFloat(n);return Number.isFinite(r)&&r>0?r:20}function et(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:e>0?e:t}function tt(e,t){e.style.maxHeight=`${t*$e(e)}px`,e.style.overflowY=`auto`}function nt(e){let t=e?.ownerDocument?.defaultView??(typeof window<`u`?window:null);if(!t||typeof t.matchMedia!=`function`)return!1;try{return t.matchMedia(`(pointer: coarse)`).matches===!0}catch{return!1}}function rt(e){return e.insertNewlineOnTouchEnter===!0&&e.coarsePointer===!0}function it(e,t){if(e.key!==`Enter`||e.shiftKey||e.isComposing)return!1;let n=e.metaKey===!0||e.ctrlKey===!0,r=t.submitKey??`enter`;return r===`none`?!1:r===`mod-enter`?n:n||!rt(t)}function at(e){return(e.submitKey??`enter`)===`enter`?rt(e)?`enter`:`send`:`enter`}function ot(e,t){e.setAttribute(`enterkeyhint`,at(t))}function z(e,t){let n=t?.autocomplete;e.setAttribute(`autocomplete`,typeof n==`string`&&n?n:`off`);let r=(t,n)=>{n===void 0?e.removeAttribute(t):e.setAttribute(t,n)};r(`autocapitalize`,typeof t?.autocapitalize==`string`?t.autocapitalize:void 0),r(`spellcheck`,typeof t?.spellcheck==`boolean`?String(t.spellcheck):void 0),r(`inputmode`,typeof t?.inputmode==`string`&&t.inputmode?t.inputmode:void 0),r(`aria-label`,typeof t?.ariaLabel==`string`&&t.ariaLabel?t.ariaLabel:void 0)}function st(e){return e===!0?{disabled:!0}:!e||typeof e!=`object`?{disabled:!1}:{disabled:!0,reason:typeof e.reason==`string`&&e.reason?e.reason:void 0}}const{setLoader:ct,load:lt}=a({fallbackImport:()=>import(`./chunk-Co3VVwGe.js`)}),ut=lt,{setLoader:dt,load:ft}=a({fallbackImport:()=>import(`./chunk-Bkma5hIU.js`),resetOnSetLoader:!0}),pt=ft;let B=400,V=300,H=0;const U=e=>Math.max(0,e);function mt(e){e.delayMs!==void 0&&(B=U(e.delayMs)),e.skipDelayMs!==void 0&&(V=U(e.skipDelayMs))}const ht=()=>Date.now()<H,gt=e=>{H=e>0?Date.now()+e:0},W=/* @__PURE__ */ new WeakMap,_t=e=>typeof e.closest==`function`&&e.closest(`[data-persona-tooltip-suppressed]`)!==null;function vt(e){W.get(e)?.hide()}const yt=e=>e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e,bt=e=>{let t=e.getRootNode?.();return yt(t)?t:e.closest(`dialog[open]`)??e.ownerDocument.body},G=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n)),xt=[...[`background`,`foreground`,`hint-fg`,`radius`,`font-size`,`padding`,`max-width`,`shadow`,`arrow-display`].map(e=>`--persona-tooltip-${e}`),`--persona-font-family`,`--persona-radius-sm`];function K(e){W.get(e.anchor)?.destroy();let{anchor:t,trigger:n=t,text:r,hint:i,enabled:a=!0,gap:o=8,viewportPadding:s=8}=e,c=()=>t.ownerDocument,l=()=>c().defaultView??window,u=null,f=null,p=null,m=null,h,g=!1,_=!1,v=!1,y=()=>(typeof r==`function`?r():r).trim(),b=()=>(typeof i==`function`?i():i??``).trim(),x=()=>U(e.delayMs??B),S=()=>U(e.skipDelayMs??V),C=()=>{h!==void 0&&(l().clearTimeout(h),h=void 0)},w=()=>{C();let e=u!==null;m?.(),m=null,u?.remove(),u=null,f=null,p=null,e&&gt(S())},T=()=>{if(!u)return;let e=c(),n=l(),r=t.getBoundingClientRect(),i=u.getBoundingClientRect(),a=e.documentElement.clientWidth||n.innerWidth,d=e.documentElement.clientHeight||n.innerHeight,f=a-s-i.width,p=r.left+r.width/2-i.width/2,m=G(p,s,f),h=r.top-s,g=d-s-r.bottom,_=h>=i.height+o||h>=g?`top`:`bottom`,v=_===`top`?r.top-o-i.height:r.bottom+o,y=d-s-i.height,b=G(v,s,y),x=r.left+r.width/2,S=Math.max(10,i.width-10),C=G(x-m,10,S);u.dataset.placement=_,u.style.left=`${m}px`,u.style.top=`${b}px`,u.style.setProperty(`--persona-tooltip-arrow-x`,`${C}px`)},E=()=>{if(v||!a||u||!t.isConnected||_t(t))return;let e=y(),n=bt(t);if(!e||!n)return;let r=c(),i=l();u=r.createElement(`div`),u.className=`persona-control-tooltip`,u.setAttribute(`role`,`tooltip`),u.dataset.state=`measuring`,u.style.zIndex=String(d);let o=i.getComputedStyle?.(t);if(o){for(let e of xt){let t=o.getPropertyValue(e).trim();t&&u.style.setProperty(e,t)}o.fontFamily&&(u.style.fontFamily=o.fontFamily)}f=r.createElement(`span`),f.className=`persona-control-tooltip__label`,f.textContent=e,u.appendChild(f);let s=b();s&&(p=r.createElement(`span`),p.className=`persona-control-tooltip__hint`,p.textContent=s,u.appendChild(p));let h=r.createElement(`span`);h.className=`persona-control-tooltip__arrow`,u.appendChild(h),n.appendChild(u),T(),u.dataset.state=`open`;let g=()=>{if(!t.isConnected){w();return}f&&(f.textContent=y()),p&&(p.textContent=b());let e=bt(t);u&&e&&u.parentNode!==e&&e.appendChild(u),T()};i.addEventListener(`scroll`,g,!0),i.addEventListener(`resize`,g);let _=t.closest(`[data-persona-root]`);_?.addEventListener(`persona:internal:host-moved`,g);let x=t.getRootNode(),S=yt(x)?x:r.documentElement,C=typeof MutationObserver>`u`?null:new MutationObserver(()=>{t.isConnected||w()});C?.observe(S,{childList:!0,subtree:!0}),m=()=>{i.removeEventListener(`scroll`,g,!0),i.removeEventListener(`resize`,g),_?.removeEventListener(`persona:internal:host-moved`,g),C?.disconnect()}},ee=e=>{v||u||(C(),e||x()<=0||ht()?E():h=l().setTimeout(()=>{h=void 0,E()},x()))},D=()=>{g||_?ee(_):w()},O=()=>{let e=l();e.matchMedia&&e.matchMedia(`(hover: none)`).matches||(g=!0,D())},k=()=>{g=!1,D()},A=()=>{try{_=t.matches(`:focus-visible`)}catch{_=!0}D()},j=()=>{_=!1,D()},M=()=>{g=!1,_=!1,w()},N=e=>{e.key===`Escape`&&M()};n.addEventListener(`mouseenter`,O),n.addEventListener(`mouseleave`,k),t.addEventListener(`focus`,A),t.addEventListener(`blur`,j),t.addEventListener(`keydown`,N),t.addEventListener(`click`,M);let P={get isOpen(){return u!==null},show:E,hide:w,reposition:T,destroy:()=>{v||(v=!0,w(),n.removeEventListener(`mouseenter`,O),n.removeEventListener(`mouseleave`,k),t.removeEventListener(`focus`,A),t.removeEventListener(`blur`,j),t.removeEventListener(`keydown`,N),t.removeEventListener(`click`,M),W.delete(t))}};return W.set(t,P),P}const q=(e,t,n,r)=>{let[i,a]=t.split(`.`);return[e?.theme,e?.darkTheme].some(e=>e?.components?.[i]?.[a]?.[n]!==void 0)?`var(--persona-components-${t.replace(`.`,`-`)}-${n}, ${r})`:r},J=(e,t)=>{let n=e&&r(e,t);return typeof n==`string`&&n?n:void 0},Y=(e,t,n,r)=>{let i=t.startsWith(`var(`);e.classList.toggle(`persona-theme-padding`,i),e.style.padding=i?``:t,i?e.style.setProperty(`--persona-theme-padding`,t):e.style.removeProperty(`--persona-theme-padding`),n&&(e.style.paddingLeft=e.style.paddingRight=n),r&&(e.style.paddingTop=e.style.paddingBottom=r)},X=(e,t,n)=>{let r=t.startsWith(`var(`)&&t.includes(`--persona-components-`);e.classList.toggle(`persona-control-size`,r),r?e.style.setProperty(`--persona-control-size`,t):e.style.removeProperty(`--persona-control-size`),e.style.width=e.style.height=t,e.style.minWidth=e.style.minHeight=n??``},St=`min(440px, calc(100vw - 24px))`,Ct=`40px`,wt={apiUrl:`https://api.runtype.com/api/chat/dispatch`,clientToken:void 0,agentId:void 0,target:void 0,theme:void 0,darkTheme:void 0,colorScheme:`light`,tooltip:{delayMs:400,skipDelayMs:300},launcher:{enabled:!0,mountMode:`floating`,dock:{side:`right`,width:`420px`},title:`Chat Assistant`,subtitle:`Here to help you get answers fast`,agentIconText:`💬`,agentIconName:`bot`,headerIconName:`bot`,position:`bottom-right`,width:St,heightOffset:0,autoExpand:!1,callToActionIconHidden:!1,agentIconSize:`40px`,headerIconSize:Ct,closeButtonPaddingX:`0px`,closeButtonPaddingY:`0px`,callToActionIconName:`arrow-up-right`,callToActionIconText:``,callToActionIconSize:`32px`,callToActionIconPadding:`5px`,callToActionIconColor:void 0,callToActionIconBackgroundColor:void 0,closeButtonBackgroundColor:`transparent`,clearChat:{backgroundColor:`transparent`,borderColor:`transparent`,enabled:!0,placement:`inline`,iconName:`refresh-cw`,showTooltip:!0,tooltipText:`Clear chat`,paddingX:`0px`,paddingY:`0px`},headerIconHidden:!1,border:void 0,shadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)`},copy:{inputPlaceholder:`How can I help...`,sendButtonLabel:`Send`},sendButton:{borderWidth:`0px`,paddingX:`12px`,paddingY:`10px`,borderColor:void 0,useIcon:!0,iconText:`↑`,showTooltip:!0,tooltipText:`Send message`,iconName:`send`},statusIndicator:{visible:!0,idleText:`Online`,connectingText:`Connecting…`,connectedText:`Streaming…`,errorText:`Offline`},voiceRecognition:{enabled:!0,pauseDuration:2e3,iconName:`mic`,borderWidth:`0px`,iconColor:void 0,backgroundColor:`transparent`,borderColor:`transparent`,recordingIconColor:void 0,recordingBackgroundColor:void 0,recordingBorderColor:`transparent`,showTooltip:!0,tooltipText:`Start voice recognition`},features:{showReasoning:!0,showToolCalls:!0,scrollToBottom:{enabled:!0,iconName:`arrow-down`,label:``,streamingIndicator:`arrow`,scrollBehavior:`instant`,scrollDurationMs:220,transition:`none`},scrollBehavior:{mode:`anchor-top`,anchorTopOffset:16,showActivityWhilePinned:!0},toolCallDisplay:_,reasoningDisplay:v,streamAnimation:{type:`none`,placeholder:`none`,speed:120,duration:1800},askUserQuestion:{enabled:!0,slideInMs:180,freeTextLabel:`Other…`,freeTextPlaceholder:`Type your answer…`,submitLabel:`Send`},history:{enabled:!1,presentation:`panel`,showScopeStatus:!0,showDelete:!0,showDeleteAll:!0}},suggestionChips:[`Show me what you can help with`,`Walk me through getting started`,`Answer a question about this page`],suggestionChipsConfig:{fontFamily:`sans-serif`,fontWeight:`500`,paddingX:`12px`,paddingY:`6px`},layout:{header:{layout:`default`,showIcon:!0,showTitle:!0,showSubtitle:!0,showCloseButton:!0,showClearChat:!0},messages:{layout:`bubble`,avatar:{show:!1,position:`left`},timestamp:{show:!1,position:`below`},groupConsecutive:!1},slots:{}},markdown:{options:{gfm:!0,breaks:!0},disableDefaultStyles:!1},messageActions:{enabled:!0,showCopy:!0,showUpvote:!1,showDownvote:!1,visibility:`hover`,align:`right`,layout:`pill-inside`},debug:!1},Tt={},Z={colorScheme:`light`,errorDisplay:`block`,messageActions:{visibility:void 0},suggestionChipsConfig:{fontWeight:void 0},approval:y,loadingIndicator:{variant:`label`},launcher:{variant:`circle`,width:`min(400px, calc(100vw - 24px))`,headerIconSize:`20px`},features:{artifacts:{enabled:!0},scrollToBottom:{streamingIndicator:`dots`,transition:`fade`,scrollBehavior:`smooth`},toolCallDisplay:h,reasoningDisplay:g},composer:{layout:`single-row`,placement:`overlay`},sendButton:{iconName:`arrow-up`},statusIndicator:{mode:`transient`},layout:{contentMaxWidth:`768px`,topFade:!0,header:{showSubtitle:!1},messages:{assistant:{width:`full`}}}};function Et(e){return e?.future?.v5Defaults===!0?`v5`:`v4`}function Q(t){let n=Et(t)===`v5`?Z:Tt;return e(wt,n)}Q();function Dt(t,n){if(t||n)return t?n?e(t,n):t:n}function Ot(e){let r=Q(e);return e?i(t(b({...r,...e,colorScheme:n(e,[`colorScheme`]).includes(`colorScheme`)?e.colorScheme:e.brand?void 0:r.colorScheme,...r.approval||e.approval!==void 0?{approval:e.approval!==!1&&{...r.approval||{},...e.approval}}:{},theme:Dt(r.theme,e.theme),darkTheme:Dt(r.darkTheme,e.darkTheme),launcher:{...r.launcher,...e.launcher,dock:{...r.launcher?.dock,...e.launcher?.dock},clearChat:{...r.launcher?.clearChat,...e.launcher?.clearChat}},...r.composer||e.composer?{composer:{...r.composer,...e.composer}}:{},tooltip:{...r.tooltip,...e.tooltip},copy:{...r.copy,...e.copy},sendButton:{...r.sendButton,...e.sendButton},statusIndicator:{...r.statusIndicator,...e.statusIndicator},voiceRecognition:{...r.voiceRecognition,...e.voiceRecognition},features:(()=>{let t=r.features?.artifacts,n=e.features?.artifacts,i=r.features?.scrollToBottom,a=e.features?.scrollToBottom,o=r.features?.scrollBehavior,s=e.features?.scrollBehavior,c=r.features?.streamAnimation,l=e.features?.streamAnimation,u=r.features?.askUserQuestion,d=e.features?.askUserQuestion,f=r.features?.history,p=e.features?.history,m=t===void 0&&n===void 0?void 0:{...t,...n,layout:{...t?.layout,...n?.layout}},h=i===void 0&&a===void 0?void 0:{...i,...a},g=o===void 0&&s===void 0?void 0:{...o,...s},_=c===void 0&&l===void 0?void 0:{...c,...l},v=u===void 0&&d===void 0?void 0:{...u,...d,styles:{...u?.styles,...d?.styles}},y=f===void 0&&p===void 0?void 0:{...f,...p,copy:{...f?.copy,...p?.copy}};return{...r.features,...e.features,toolCallDisplay:{...r.features?.toolCallDisplay,...e.features?.toolCallDisplay,...e.features?.toolCallDisplay?.layout===void 0&&e.features?.toolCallDisplay?.variant!==void 0?{layout:e.features.toolCallDisplay.variant}:{}},reasoningDisplay:{...r.features?.reasoningDisplay,...e.features?.reasoningDisplay,...e.features?.reasoningDisplay?.layout===void 0&&e.features?.reasoningDisplay?.variant!==void 0?{layout:e.features.reasoningDisplay.variant}:{}},...h===void 0?{}:{scrollToBottom:h},...g===void 0?{}:{scrollBehavior:g},...m===void 0?{}:{artifacts:m},..._===void 0?{}:{streamAnimation:_},...v===void 0?{}:{askUserQuestion:v},...y===void 0?{}:{history:y}}})(),suggestionChips:e.suggestionChips??r.suggestionChips,suggestionChipsConfig:{...r.suggestionChipsConfig,...e.suggestionChipsConfig},layout:{...r.layout,...e.layout,header:{...r.layout?.header,...e.layout?.header},messages:{...r.layout?.messages,...e.layout?.messages,...r.layout?.messages?.user||e.layout?.messages?.user?{user:{...r.layout?.messages?.user,...e.layout?.messages?.user}}:{},...r.layout?.messages?.assistant||e.layout?.messages?.assistant?{assistant:{...r.layout?.messages?.assistant,...e.layout?.messages?.assistant}}:{},avatar:{...r.layout?.messages?.avatar,...e.layout?.messages?.avatar},timestamp:{...r.layout?.messages?.timestamp,...e.layout?.messages?.timestamp}},slots:{...r.layout?.slots,...e.layout?.slots}},markdown:{...r.markdown,...e.markdown,options:{...r.markdown?.options,...e.markdown?.options}},messageActions:{...r.messageActions,...e.messageActions}},e),e,Z),e):i(t(b(r),void 0,Z))}const kt=(e,t)=>{let n=u(`textarea`);n.setAttribute(`data-persona-composer-input`,``),n.placeholder=e?.copy?.inputPlaceholder??`How can I help...`,n.dir=`auto`,ot(n,{submitKey:e?.composer?.submitKey,insertNewlineOnTouchEnter:e?.composer?.insertNewlineOnTouchEnter,coarsePointer:nt(n)}),z(n,e?.composer?.inputAttributes),n.className=`persona-w-full persona-min-h-[24px] persona-resize-none persona-border-none persona-bg-transparent persona-text-sm persona-text-persona-text focus:persona-outline-none focus:persona-border-none persona-composer-textarea`,n.rows=1,n.style.fontFamily=`var(--persona-input-font-family, var(--persona-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif))`,n.style.fontWeight=`var(--persona-input-font-weight, var(--persona-font-weight, 400))`;let r=et(e?.composer?.maxLines,t?.defaultMaxLines??3),i=`${r*20}px`;n.style.maxHeight=i,n.style.overflowY=`auto`;let a=()=>{let e=n.style.maxHeight;if(e!==i){let t=parseFloat(e);if(Number.isFinite(t)&&t>0)return t}let t=r*$e(n);return i=`${t}px`,n.style.maxHeight=i,t},o=()=>{n.addEventListener(`input`,()=>{n.style.height=`auto`;let e=Math.min(n.scrollHeight,a());n.style.height=`${e}px`})};return n.style.border=`none`,n.style.outline=`none`,n.style.borderWidth=`0`,n.style.borderStyle=`none`,n.style.borderColor=`transparent`,n.addEventListener(`focus`,()=>{n.style.border=`none`,n.style.outline=`none`,n.style.borderWidth=`0`,n.style.borderStyle=`none`,n.style.borderColor=`transparent`,n.style.boxShadow=`none`}),n.addEventListener(`blur`,()=>{n.style.border=`none`,n.style.outline=`none`}),{textarea:n,attachAutoResize:o}},At=`[data-persona-glyph-stack]`,jt=(e,t,n=`send`)=>{let r=l(`span`,{className:`persona-composer-glyph-stack`,attrs:{"data-mode":n,"data-persona-glyph-stack":``}});return e.setAttribute(`data-glyph`,`send`),t.setAttribute(`data-glyph`,`stop`),r.append(e,t),r},Mt=/* @__PURE__ */ new WeakMap,$=(e,t,n=!0)=>{Mt.set(e,t);let r=t?.sendButton??{},i=r.useIcon??!1,a=e.getAttribute(`data-persona-send-mode`)===`stop`?`stop`:`send`,o=e=>J(t,`sendButton.${e}`),s=(e,n)=>q(t,`composer.send`,e,n),l=o(`size`)||r.size;e.style.fontSize=i?`18px`:``,e.style.lineHeight=i?`1`:``,e.className=c(`persona-rounded-button disabled:persona-opacity-50 persona-cursor-pointer`,i?`persona-flex persona-items-center persona-justify-center ${m}`:`persona-bg-persona-accent persona-px-4 persona-py-2 persona-text-sm persona-font-semibold`,i&&!o(`backgroundColor`)&&`persona-bg-persona-primary`,!i&&!o(`textColor`)&&`persona-text-white`),X(e,i?l||(s(`size`,``)?s(`size`,`var(--persona-composer-control-size, 40px)`):``):``,i?l:void 0);let u=s(`foreground`,i?`var(--persona-send-button-fg, var(--persona-button-primary-fg, #ffffff))`:`#ffffff`),d=s(`background`,i?`var(--persona-button-primary-bg, var(--persona-primary, #111827))`:`var(--persona-accent, #0f0f0f)`);e.style.color=o(`textColor`)||(a===`stop`&&s(`foreground`,``)?`var(--persona-button-stop-fg, ${u})`:s(`foreground`,``)||(i?u:``)),e.style.backgroundColor=(i?o(`backgroundColor`):void 0)||(s(`background`,``)?a===`stop`?`var(--persona-button-stop-bg, ${d})`:d:``);let f=o(`borderWidth`)||(s(`borderWidth`,``)?s(`borderWidth`,r.borderWidth||`0px`):r.borderWidth||``);e.style.borderWidth=f,e.style.borderStyle=f?`solid`:``,e.style.borderColor=o(`borderColor`)||(s(`borderColor`,``)?s(`borderColor`,r.borderColor||`transparent`):r.borderColor||``),e.style.borderRadius=s(`borderRadius`,``)?s(`borderRadius`,`var(--persona-components-composer-sendButtonRadius, var(--persona-button-radius))`):``,Y(e,s(`padding`,i?`0`:`8px 16px`),i?void 0:o(`paddingX`)||(s(`padding`,``)?void 0:r.paddingX),i?void 0:o(`paddingY`)||(s(`padding`,``)?void 0:r.paddingY));let p=parseFloat(r.iconSize??``)||Math.round((parseFloat(r.size??``)||40)*.5);if(n){if(e.replaceChildren(),i){let t=r.iconStrokeWidth??2,n=r.iconName?R(r.iconName,p,`currentColor`,t):null,i=R(r.stopIconName??`square`,p,`currentColor`,t);n&&i?e.appendChild(jt(n,i,a)):n?e.appendChild(n):e.textContent=r.iconText??`↑`}else e.textContent=a===`stop`?t?.copy?.stopButtonLabel??`Stop`:t?.copy?.sendButtonLabel??`Send`}for(let n of Array.from(e.querySelectorAll(`svg`))){n.style.width=n.style.height=o(`iconSize`)?``:s(`iconSize`,`var(--persona-components-composer-sendIconSize, ${p}px)`);let e=t?.sendButton?.iconStrokeWidth;n.style.strokeWidth=e===void 0?s(`iconStrokeWidth`,``):String(e)}},Nt=e=>{let t=e?.sendButton,n=u(`div`,`persona-send-button-wrapper`),r=l(`button`,{attrs:{type:`submit`,"data-persona-composer-submit":``,"data-persona-send-mode":`send`}});return $(r,e),r.setAttribute(`aria-label`,t?.tooltipText??`Send message`),n.appendChild(r),K({anchor:r,trigger:n,text:()=>r.getAttribute(`aria-label`)??``,enabled:t?.showTooltip??!1}),{button:r,wrapper:n,setMode:e=>{if(r.getAttribute(`data-persona-send-mode`)===e)return;r.setAttribute(`data-persona-send-mode`,e),r.setAttribute(`aria-label`,e===`stop`?t?.stopTooltipText??`Stop generating`:t?.tooltipText??`Send message`);let n=Mt.get(r);$(r,n,!1),r.querySelector(At)?.setAttribute(`data-mode`,e),(n?.sendButton?.useIcon??!1)||(r.textContent=e===`stop`?n?.copy?.stopButtonLabel??`Stop`:n?.copy?.sendButtonLabel??`Send`)},glyphStack:r.querySelector(At)}},Pt=(e,t,n=`idle`,r=`none`)=>{let i=t?.voiceRecognition??{},a=e=>J(t,`voiceRecognition.${e}`),o=(e,n)=>q(t,`voice.control`,e,n),s=a(`iconSize`)||i.iconSize;X(e,s||(o(`size`,``)?o(`size`,`var(--persona-composer-control-size, 40px)`):``),s),e.classList.add(m),e.classList.toggle(p,!s&&!o(`size`,``)),e.style.fontSize=`18px`,e.style.lineHeight=`1`;let c=a(`iconColor`)||J(t,`sendButton.textColor`)||o(`foreground`,`var(--persona-text, #111827)`),l=a(`backgroundColor`)||J(t,`sendButton.backgroundColor`)||o(`background`,i.backgroundColor||`transparent`),u=a(`borderColor`)||o(`borderColor`,i.borderColor||`transparent`),d=a(`borderWidth`)||o(`borderWidth`,i.borderWidth||``);e.style.borderWidth=d,e.style.borderStyle=d?`solid`:``,e.style.borderRadius=o(`borderRadius`,``)?o(`borderRadius`,`var(--persona-button-radius)`):``,Y(e,o(`padding`,``)?o(`padding`,`0px`):``,a(`paddingX`)||(o(`padding`,``)?void 0:i.paddingX),a(`paddingY`)||(o(`padding`,``)?void 0:i.paddingY));let f=a(`recordingBackgroundColor`)||`var(--persona-voice-recording-bg, #ef4444)`,h=a(`recordingIconColor`)||`var(--persona-voice-recording-indicator, #ffffff)`,g=a(`recordingBorderColor`)||`var(--persona-consumer-voice-recording-border, ${i.recordingBorderColor||u})`,_=c,v=l,y=u,b=i.iconName??`mic`;if(n===`recording`)_=h,v=f,y=g;else if(n===`processing`)_=a(`processingIconColor`)||`var(--persona-consumer-voice-processing-icon, ${c})`,v=a(`processingBackgroundColor`)||`var(--persona-consumer-voice-processing-background, ${l})`,y=a(`processingBorderColor`)||`var(--persona-components-voice-processing-border, ${u})`,b=i.processingIconName??`loader`;else if(n===`speaking`){let e=r===`barge-in`;_=a(`speakingIconColor`)||`var(--persona-consumer-voice-speaking-icon, ${e&&a(`recordingIconColor`)||c})`,v=a(`speakingBackgroundColor`)||`var(--persona-components-voice-speaking-background, ${e?f:l})`,y=a(`speakingBorderColor`)||`var(--persona-components-voice-speaking-border, ${e?g:u})`,b=i.speakingIconName??(r===`cancel`?`square`:e?`mic`:`volume-2`)}e.style.color=_,e.style.backgroundColor=v,e.style.borderColor=y,e.setAttribute(`data-state`,n);let x=parseFloat(i.iconSize??``)||24,S=R(b,x,`currentColor`,1.5);if(e.replaceChildren(),S){let t=s||(o(`iconSize`,``)?o(`iconSize`,`var(--persona-composer-control-icon-size, 24px)`):``);S.style.width=S.style.height=t,!s&&o(`iconSize`,``)&&(S.style.flexBasis=t),S.style.strokeWidth=o(`iconStrokeWidth`,`1.5`),e.appendChild(S)}else e.textContent=`🎤`},Ft=e=>{let t=e?.voiceRecognition??{};if(t.enabled!==!0||t.showButton===!1)return null;let n=typeof window<`u`&&(window.webkitSpeechRecognition!==void 0||window.SpeechRecognition!==void 0),r=t.provider?.type===`runtype`,i=t.provider?.type===`custom`||t.dictation?.provider?.type===`custom`;if(!(n||r||i))return null;let a=u(`div`,`persona-send-button-wrapper`),o=l(`button`,{className:`persona-rounded-button persona-flex persona-items-center persona-justify-center disabled:persona-opacity-50 persona-cursor-pointer persona-composer-control`,attrs:{type:`button`,"data-persona-composer-mic":``,"data-state":`idle`,"aria-label":t.tooltipText??`Start voice recognition`}});Pt(o,e),a.appendChild(o);let s=t.tooltipText??`Start voice recognition`;return K({anchor:o,trigger:a,text:()=>o.getAttribute(`aria-label`)??s,enabled:t.showTooltip??!1}),{button:o,wrapper:a}},It=e=>{let t=e?.attachments??{};if(t.enabled!==!0)return null;let n=u(`div`,`persona-attachment-previews persona-flex persona-flex-wrap persona-gap-2 persona-mb-2`);n.setAttribute(`data-persona-composer-attachment-previews`,``),n.style.display=`none`;let r=u(`input`);r.type=`file`,r.setAttribute(`data-persona-composer-attachment-input`,``),r.accept=(t.allowedTypes??f).join(`,`),r.multiple=(t.maxFiles??4)>1,r.style.display=`none`,r.setAttribute(`aria-label`,`Attach files`);let i=t.buttonIconName??`paperclip`,a=u(`div`,`persona-send-button-wrapper`),o=l(`button`,{className:`persona-rounded-button persona-flex persona-items-center persona-justify-center disabled:persona-opacity-50 persona-cursor-pointer persona-attachment-button ${m} ${p}`,attrs:{type:`button`,"data-persona-composer-attachment-button":``,"aria-label":t.buttonTooltipText??`Attach file`},style:{fontSize:`18px`,lineHeight:`1`}}),s=R(i,24,`currentColor`,1.5);s?o.appendChild(s):o.textContent=`📎`,o.addEventListener(`click`,e=>{e.preventDefault(),r.click()}),a.appendChild(o);let c=t.buttonTooltipText??`Attach file`;return K({anchor:o,trigger:a,text:()=>o.getAttribute(`aria-label`)??c}),{button:o,wrapper:a,input:r,previewsContainer:n}},Lt=e=>{let t=e?.statusIndicator??{},n=t.align===`left`?`persona-text-left`:t.align===`center`?`persona-text-center`:`persona-text-right`,r=u(`div`,`persona-mt-2 ${n} persona-text-xs persona-text-persona-muted`);r.setAttribute(`data-persona-composer-status`,``),Ze(r,t,`idle`);let i=t.idleText??`Online`;if(t.idleLink){let e=u(`a`);e.href=t.idleLink,e.target=`_blank`,e.rel=`noopener noreferrer`,e.textContent=i,e.style.color=`inherit`,e.style.textDecoration=`none`,r.appendChild(e)}else r.textContent=i;return r},Rt=()=>l(`div`,{className:`persona-mb-3 persona-flex persona-flex-wrap persona-gap-2`,attrs:{"data-persona-composer-suggestions":``}});function zt(e){let{config:t,onOpen:n}=e,r=t.buttonIconName??`plus`,i=t.buttonTooltipText??`Add context`,a=u(`div`,`persona-send-button-wrapper`),o=l(`button`,{className:`persona-rounded-button persona-flex persona-items-center persona-justify-center disabled:persona-opacity-50 persona-cursor-pointer persona-mention-button ${m} ${p}`,attrs:{type:`button`,"data-persona-composer-mention-button":``,"aria-label":i,"aria-haspopup":`listbox`,"aria-expanded":`false`},style:{fontSize:`18px`,lineHeight:`1`}}),s=R(r,24,`currentColor`,1.5);return s?o.appendChild(s):o.textContent=`+`,o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),n()}),a.appendChild(o),K({anchor:o,trigger:a,text:()=>o.getAttribute(`aria-label`)??i}),{button:o,wrapper:a}}function Bt(e,t={}){if(t.render)return t.render({ref:e,readonly:!!t.readonly});let n=l(`span`,{className:c(`persona-mention-token`,t.readonly&&`persona-mention-token-readonly`),attrs:{"data-mention-source":e.sourceId,title:e.label,role:`img`,"aria-label":`${e.label} mention`}});e.color&&n.style.setProperty(`--persona-mention-token-accent`,e.color);let r=R(e.iconName??`at-sign`,13,`currentColor`,2);if(r){let e=u(`span`,`persona-mention-token-icon`);e.appendChild(r),n.appendChild(e)}return n.appendChild(l(`span`,{className:`persona-mention-token-label`,text:`@${e.label}`})),n}export{it as A,vt as C,z as D,ot as E,qe as F,R as I,et as M,Ze as N,tt as O,Qe as P,mt as S,ut as T,Y as _,It as a,J as b,Nt as c,Z as d,St as f,Et as g,Q as h,$ as i,st as j,nt as k,Lt as l,Ot as m,zt as n,kt as o,Ct as p,Pt as r,Ft as s,Bt as t,Rt as u,X as v,pt as w,K as x,q as y};