@marketrix.ai/widget 3.2.176 → 3.2.177
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/MessageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ5D,UAAU,mBAAmB;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/MessageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ5D,UAAU,mBAAmB;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqFxD,CAAC"}
|
package/dist/widget.mjs
CHANGED
|
@@ -15,7 +15,7 @@ return f(ku,{className:"fixed",style:{zIndex:b,maxWidth:"420px",opacity:l?0:1,tr
|
|
|
15
15
|
return g(ku,{ref:A,className:`${H} ${W?"":G} ${E?"":"transition-transform duration-300 ease-in-out"}`,style:{zIndex:w,pointerEvents:e?"none":"auto",...Z,...W},children:[/* @__PURE__ */g(ku,{className:`\n group relative w-14 h-14 overflow-visible transition-all duration-300 ease-in-out\n ${e?"scale-0 opacity-0 pointer-events-none":"scale-100 opacity-100 hover:scale-110"}\n `,children:[k&&/* @__PURE__ */f(ku,{className:S,"aria-hidden":!0}),_&&!E&&/* @__PURE__ */f(lp,{type:"button",variant:"secondary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),a?.()},className:"absolute top-1/2 z-20 -translate-y-1/2 rounded-full border border-white/25 bg-gray-900 px-2.5 py-1 text-[11px] font-semibold uppercase tracking-wide text-white shadow-lg opacity-0 transition-opacity duration-150 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto group-focus-within:opacity-100 group-focus-within:pointer-events-auto "+(b.includes("left")?"left-full ml-2":"right-full mr-2"),style:{border:"1px solid rgba(255,255,255,0.25)"},"aria-label":"Stop running task",children:"Stop"}),
|
|
16
16
|
/* @__PURE__ */f(lp,{type:"button",variant:"bare",onClick:()=>{Date.now()<L.current||s()},onDragStart:e=>e.preventDefault(),onPointerDown:t=>{e||(N.current={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,dragging:!1,lastX:0,lastY:0},t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove:e=>{const t=N.current;if(t?.pointerId!==e.pointerId)return;const n=e.clientX-t.startX,r=e.clientY-t.startY;if(!t.dragging&&Math.hypot(n,r)>5&&(t.dragging=!0,T(!0),D.current=[],$.current=0,A.current&&(A.current.style.willChange="transform",A.current.style.transition="none")),!t.dragging)return;t.lastX=n,t.lastY=r;const i=Date.now();i-$.current>=10&&($.current=i,D.current=[...D.current.slice(-5),{x:e.clientX,y:e.clientY,t:i}]),null===P.current&&(P.current=window.requestAnimationFrame(()=>{P.current=null;const e=N.current,t=A.current;t&&e&&(t.style.transform=`translate3d(${e.lastX}px, ${e.lastY}px, 0)`)}))},onPointerUp:e=>{const t=N.current;if(t?.pointerId===e.pointerId){if(t.dragging){const n=(()=>{const e=D.current;if(e.length<2)return{x:0,y:0};const t=e[e.length-1].t-e[0].t;return t<=0?{x:0,y:0}:{x:(e[e.length-1].x-e[0].x)/t*1e3,y:(e[e.length-1].y-e[0].y)/t*1e3}})(),r=V(n.x),i=V(n.y),o={dx:t.lastX+r,dy:t.lastY+i};let s;if("undefined"!=typeof window&&A.current){const e=A.current.getBoundingClientRect();s=((e,t,n,r,i,o)=>{const s=["top_left","top_right","bottom_left","bottom_right"];let a=t,l=1/0;for(const c of s){const s=Cp(t,c,n,r,i,o),d=Math.hypot(e.dx-s.dx,e.dy-s.dy);d<l&&(l=d,a=c)}return a})(o,b,window.innerWidth,window.innerHeight,e.width,e.height)}else s=b;return((e,t,n)=>{if(!A.current||!W)return q(),v(e),void T(!1);null!==P.current&&(window.cancelAnimationFrame(P.current),P.current=null);const r=A.current,i=Sp(b,F,U,M.w,M.h),o=Sp(e,F,U,M.w,M.h);r.style.transition="none",r.style.transform="none",r.style.willChange="left, top",r.style.left=`${i.x+t}px`,r.style.top=`${i.y+n}px`,requestAnimationFrame(()=>{r.style.transition=`left 600ms ${Ip}, top 600ms ${Ip}`,r.style.left=`${o.x}px`,r.style.top=`${o.y}px`}),J(e,r)})(s,t.lastX,t.lastY),L.current=Date.now()+600,N.current=null,void e.currentTarget.releasePointerCapture(e.pointerId)}q(),N.current=null,T(!1),e.currentTarget.releasePointerCapture(e.pointerId)}},onPointerCancel:e=>{N.current?.pointerId===e.pointerId&&(q(),N.current=null,T(!1),e.currentTarget.releasePointerCapture(e.pointerId))},className:"relative z-10 w-14 h-14 min-w-14",style:{touchAction:"none",cursor:E?"grabbing":"grab",userSelect:"none",WebkitUserSelect:"none"},"aria-label":e?"Close":"Open","aria-live":"polite",children:/* @__PURE__ */f(cp,{className:"w-full h-full items-center justify-center relative",children:/* @__PURE__ */g(ku,{className:"\n relative w-12 h-12 overflow-hidden transition-[transform,opacity,background-color] duration-[167ms] ease-[cubic-bezier(0.33,0,0,1)]\n hover:scale-110 hover:duration-[250ms] active:scale-[0.85] active:duration-[134ms] active:ease-[cubic-bezier(0.45,0,0.2,1)]\n animate-launcher-entrance\n ",style:{borderRadius:h,backgroundColor:e?d:l,boxShadow:"0 2px 8px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04)"},children:[k&&/* @__PURE__ */f("svg",{className:C,viewBox:"0 0 54 54",fill:"none","aria-hidden":!0,children:/* @__PURE__ */f("rect",{x:"1.25",y:"1.25",width:"51.5",height:"51.5",rx:I+1,ry:I+1})}),
|
|
17
17
|
/* @__PURE__ */f(cp,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(30deg) scale(0)":"rotate(0deg) scale(1)",opacity:e?0:1,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":e,children:/* @__PURE__ */f(Cu,{src:_u,alt:"",className:"relative z-10 w-full h-full object-contain",draggable:!1,onDragStart:e=>e.preventDefault(),style:{borderRadius:h,border:"none",outline:"none",backgroundColor:"transparent",pointerEvents:"none",userSelect:"none"}})}),
|
|
18
|
-
/* @__PURE__ */f(cp,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:e?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!e,children:/* @__PURE__ */f(up,{name:"chevronDown",size:24,className:"relative z-10 text-foreground pointer-events-none"})})]})})})]}),!e&&/* @__PURE__ */g(ku,{className:`absolute bottom-16 ${b.includes("left")?"left-0":"right-0"} mb-2 px-3 py-2 text-sm rounded-lg shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity duration-200`,style:{backgroundColor:m,color:y},children:[/* @__PURE__ */f(vp,{as:"span",className:"text-inherit",children:"Support Agent"}),/* @__PURE__ */f(ku,{"aria-hidden":!0,className:`absolute top-full ${b.includes("left")?"left-4":"right-4"} w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent`,style:{borderTopColor:m}})]})]})},Tp="3.2.
|
|
18
|
+
/* @__PURE__ */f(cp,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:e?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!e,children:/* @__PURE__ */f(up,{name:"chevronDown",size:24,className:"relative z-10 text-foreground pointer-events-none"})})]})})})]}),!e&&/* @__PURE__ */g(ku,{className:`absolute bottom-16 ${b.includes("left")?"left-0":"right-0"} mb-2 px-3 py-2 text-sm rounded-lg shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity duration-200`,style:{backgroundColor:m,color:y},children:[/* @__PURE__ */f(vp,{as:"span",className:"text-inherit",children:"Support Agent"}),/* @__PURE__ */f(ku,{"aria-hidden":!0,className:`absolute top-full ${b.includes("left")?"left-4":"right-4"} w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent`,style:{borderTopColor:m}})]})]})},Tp="3.2.177";function Ap(e){return Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>null!==e.offsetParent&&!e.hasAttribute("aria-hidden"))}function Mp(e){if(!e)return 360;const t=parseInt(e.replace(/px|rem|em/gi,""),10);return isNaN(t)?360:t}function zp(e,t,n){return Math.min(Math.max(e,t),n)}function Op(e,t,n,r,i){const o={"bottom-right":"nwse-resize","bottom-left":"nesw-resize","top-right":"nesw-resize","top-left":"nwse-resize"};switch(e){case"bottom-right":return{dx:r-t,dy:i-n,cursor:o[e]};case"bottom-left":return{dx:t-r,dy:i-n,cursor:o[e]};case"top-right":return{dx:r-t,dy:n-i,cursor:o[e]};case"top-left":return{dx:t-r,dy:n-i,cursor:o[e]}}}var Rp={live:"inline-flex items-center gap-1",status:"inline-flex items-center text-[9px] font-medium px-1.5 py-0.5 rounded"},Np=i(function({variant:e,className:t,style:n,children:r,...i},o){/* @__PURE__ */
|
|
19
19
|
return g("span",{...i,ref:o,className:yu(Rp[e],t),"data-variant":e,style:n,children:["live"===e&&/* @__PURE__ */g("span",{className:"relative flex h-1.5 w-1.5",children:[/* @__PURE__ */f("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-75"}),/* @__PURE__ */f("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-current"})]}),r]})});function Pp({defaultOpen:e=!1,onOpenChange:t,open:n}){const[r,i]=p(e),s=void 0!==n;return{isOpen:s?n:r,setIsOpen:o(e=>{s||i(e),t?.(e)},[s,t])}}var Lp=n(null);function Dp(e){const t=s(Lp);if(!t)throw new Error(`${e} must be used within Dialog`);return t}function $p({children:e,onOpenChange:t,open:n}){const{isOpen:r,setIsOpen:i}=Pp({onOpenChange:t,open:n}),o=l(),s=l(),a=l(),c=d(()=>({contentId:o,descriptionId:a,open:r,setOpen:i,titleId:s}),[o,a,r,i,s]);/* @__PURE__ */
|
|
20
20
|
return f(Lp.Provider,{value:c,children:e})}function jp({children:e,className:t,onKeyDown:n,...r}){const i=Dp("DialogContent");return a(()=>{if(!i.open)return;const e=e=>{"Escape"===e.key&&i.setOpen(!1)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[i]),i.open?/* @__PURE__ */f("div",{...r,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"aria-modal":"true",className:yu("fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[calc(var(--layer-dialog)+1)] flex flex-col w-full max-w-[500px] max-h-[85vh] overflow-auto bg-card rounded-lg shadow-xl p-6 animate-dialog-content-in",t),"data-state":"open",id:i.contentId,onKeyDown:e=>{n?.(e),e.defaultPrevented||"Escape"!==e.key||i.setOpen(!1)},role:"dialog",tabIndex:-1,children:e}):null}function Fp({className:e,...t}){const n=Dp("DialogTitle");/* @__PURE__ */
|
|
21
21
|
return f("h2",{...t,className:yu("text-lg font-semibold text-card-foreground mb-2",e),id:n.titleId})}function Up({className:e,...t}){const n=Dp("DialogDescription");/* @__PURE__ */
|
|
@@ -36,7 +36,7 @@ return g(lp,{role:"tab","aria-selected":r,"aria-controls":`view-${e.id}`,id:`tab
|
|
|
36
36
|
/* @__PURE__ */g(cp,{className:"gap-2 justify-end",children:[/* @__PURE__ */f(lp,{type:"button",variant:"secondary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:"px-4 py-1.5 rounded-full text-sm font-medium border border-gray-200",children:a}),/* @__PURE__ */f(lp,{type:"button",variant:"primary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),o?.()},className:"px-4 py-1.5 rounded-full text-sm font-medium",children:s})]})]}:{className:"bg-white rounded-md shadow-lg border border-gray-200 w-64 p-0",children:[/* @__PURE__ */g(cp,{className:"items-center justify-between px-3 py-1.5 border-b border-gray-100",children:[/* @__PURE__ */f(Fp,{className:"text-[11px] font-semibold text-gray-700 flex-1 text-center mb-0",children:r}),/* @__PURE__ */f(Bp,{className:"text-gray-400 hover:text-gray-600 -mr-1 static w-auto h-auto","aria-label":"Close",children:/* @__PURE__ */f(up,{name:"x",size:12})})]}),/* @__PURE__ */g(fp,{className:"px-3 py-1.5",children:[l.map(e=>/* @__PURE__ */g(cp,{className:"items-center justify-between py-[3px]",children:[/* @__PURE__ */f(vp,{as:"span",className:"text-[10px] text-gray-500",children:e.label}),/* @__PURE__ */g(cp,{className:"items-center gap-1",children:[/* @__PURE__ */f(vp,{as:"code",className:"text-[9px] text-gray-600 bg-gray-50 px-1 py-0.5 rounded max-w-[120px] truncate",children:e.value||"N/A"}),!0===e.copyable&&e.value&&/* @__PURE__ */f(lp,{type:"button",variant:"ghost",size:"sm",onClick:()=>{return t=e.value,void navigator.clipboard.writeText(t);var t},className:"text-[9px] text-blue-500 hover:text-blue-600 min-w-0 p-0 h-auto",children:"Copy"})]})]},e.label)),null!=c&&/* @__PURE__ */g(cp,{className:"items-center justify-between py-[3px]",children:[/* @__PURE__ */f(vp,{as:"span",className:"text-[10px] text-gray-500",children:"Status"}),/* @__PURE__ */f(Np,{variant:"status",className:ih[c.color],children:c.label})]})]})]})});function sh(e){return"registered"===e?"green":"connected"===e?"blue":"connecting"===e?"yellow":"gray"}var ah=({isOpen:e,onClose:t,diagnosticData:n})=>{const r=[{label:"Chat ID",value:n.chatId??"N/A",copyable:!!n.chatId},{label:"Stream Endpoint",value:n.streamEndpoint??"N/A",copyable:!!n.streamEndpoint},{label:"Application ID",value:n.applicationId?.toString()??"N/A",copyable:!!n.applicationId},{label:"Agent ID",value:n.agentId?.toString()??"N/A",copyable:!!n.agentId}],i={label:n.connectionStatus,color:sh(n.connectionStatus)},o="dev"===n.build?"dev":n.build.slice(0,7);/* @__PURE__ */
|
|
37
37
|
return f(oh,{variant:"info",open:e,onClose:t,title:`Widget v${n.version} (${o})`,rows:r,status:i})};function lh(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})}}var ch=t.forwardRef(function({value:e,onChange:t,onSubmit:n,modes:r=[],activeMode:i,onModeChange:s,disabled:l=!1,taskRunning:c=!1,onStop:d,placeholder:p="Ask anything"},h){const m=u(null);a(()=>{const e=m.current;if(e){e.style.height="auto";const t=e.scrollHeight,n=Math.min(t,66);e.style.height=`${n}px`,e.style.overflowY=t>66?"auto":"hidden"}},[e]);const y=o(e=>{t(e.target.value);const n=e.target;n.style.height="auto";const r=Math.min(n.scrollHeight,66);n.style.height=`${r}px`,n.style.overflowY=n.scrollHeight>66?"auto":"hidden"},[t]),w=o(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),n())},[n]),b=Boolean(e.trim())&&!l;/* @__PURE__ */
|
|
38
38
|
return g(fp,{className:"rounded-xl border border-border overflow-hidden focus-within:border-foreground-faint transition-colors",children:[/* @__PURE__ */f(eh,{ref:lh(m,h),value:e,onChange:y,onKeyDown:w,placeholder:p,disabled:l,rows:1,className:"w-full px-3 text-sm text-foreground placeholder:text-foreground-faint resize-none focus:outline-none focus:ring-0 border-none shadow-none disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"transparent",lineHeight:"20px",paddingTop:"4px",paddingBottom:"2px",minHeight:"unset"}}),/* @__PURE__ */g(cp,{className:"items-center justify-between px-1.5 pt-1 pb-1.5",children:[/* @__PURE__ */f(cp,{className:"items-center gap-1",children:r.map(e=>/* @__PURE__ */g(Kp,{active:i===e.id,size:"sm",onClick:t=>{t.preventDefault(),t.stopPropagation(),s?.(e.id)},children:[/* @__PURE__ */f(up,{name:e.icon,size:12}),/* @__PURE__ */f(vp,{as:"span",className:"text-inherit",children:e.label})]},e.id))}),/* @__PURE__ */f(mp,{variant:c?"secondary":"primary",size:"sm",disabled:!c&&!b,label:c?"Stop task":"Send message",onClick:e=>{e.preventDefault(),e.stopPropagation(),c&&d?d():n()},children:/* @__PURE__ */f(up,c?{name:"stop",size:14}:{name:"send",size:16})})]})]})}),dh=({variant:e,message:t})=>{const n="error"===e,r="loading"===e;/* @__PURE__ */
|
|
39
|
-
return g(fp,{align:"center",justify:"center",gap:"lg",paddingY:"2xl",paddingX:"xl",role:r?"status":void 0,"aria-live":n?"assertive":"polite",style:n?{color:"var(--color-red-600, #dc2626)"}:void 0,children:[r&&/* @__PURE__ */f(Xp,{size:"lg"}),/* @__PURE__ */f(vp,{as:"p",size:"sm",align:"center",children:t})]})},uh=({content:e,status:t="pending",accentColor:n,hideIcon:r=!1,textStyle:i="default"})=>/* @__PURE__ */g(cp,{align:"start",gap:"md",children:[!r&&(()=>{switch(t){case"completed":/* @__PURE__ */return f(up,{name:"checkCircle",style:{color:n,marginTop:"2px",flexShrink:0},size:16});case"failed":/* @__PURE__ */return f(up,{name:"timesCircle",style:{opacity:.65,marginTop:"2px",flexShrink:0},size:16});case"canceled":/* @__PURE__ */return f(up,{name:"ban",style:{opacity:.5,marginTop:"2px",flexShrink:0},size:16});case"running":/* @__PURE__ */return f(Xp,{size:"sm",style:{color:n,marginTop:"2px"}});default:/* @__PURE__ */return f(up,{name:"circle",style:{opacity:.5,marginTop:"2px",flexShrink:0},size:16})}})(),/* @__PURE__ */f(vp,{as:"span",size:"xs",weight:"medium",style:{flex:1,whiteSpace:"pre-wrap",lineHeight:"tight",opacity:"muted"===i?.5:1},children:e})]}),ph=({isWaitingForUser:e,accentColor:t})=>/* @__PURE__ */g(cp,{align:"center",gap:"sm",paddingY:"xs",children:[/* @__PURE__ */f(Xp,{size:"sm",style:{color:t}}),/* @__PURE__ */f(vp,{as:"span",weight:"normal",style:{fontSize:"10px",opacity:.5},children:e?"Waiting for you to complete the action":"Thinking"})]}),hh=({message:e,isLastMessage:t,widgetState:n,accentColor:r})=>{const i="waiting-for-user"===(e.placeholderState||"thinking");return e.parts&&e.parts.length>0?/* @__PURE__ */g(fp,{gap:"sm",children:[e.parts.map((t,n)=>{if("text"===t.type){let e=(i=t.content,i.replace(/\n\n__THINKING__$/,"").replace(/__THINKING__/g,"")).trim();return e=e.replace(/\(Cancelled by cleanup\)/gi,"").replace(/\s+/g," ").trim(),e?/* @__PURE__ */f(vp,{as:"div",size:"xs",weight:"medium",style:{lineHeight:"tight",wordBreak:"break-word",whiteSpace:"pre-wrap",marginBottom:"4px"},children:e},`part-${n}`):null}return"progress"===t.type?"done"===t.toolName&&"done"===e.taskStatus?null:/* @__PURE__ */f(uh,{content:t.content,status:t.status||"running",accentColor:r,...void 0!==t.hideIcon?{hideIcon:t.hideIcon}:{},...void 0!==t.textStyle?{textStyle:t.textStyle}:{}},`part-${n}`):null;var i}),(e.isPlaceholder&&!e.parts.some(e=>"text"===e.type)||n.isTaskRunning&&t&&("show"===e.mode||"do"===e.mode))&&/* @__PURE__ */f(ph,{isWaitingForUser:i,accentColor:r})]}):e.isPlaceholder||n.isTaskRunning&&t&&("show"===e.mode||"do"===e.mode)?/* @__PURE__ */f(ph,{isWaitingForUser:i,accentColor:r}):/* @__PURE__ */f(ku,{})},mh=({status:e,accentColor:t})=>{switch(e){case"done":/* @__PURE__ */return f(up,{name:"checkCircle",style:{color:t,flexShrink:0},size:14});case"failed":/* @__PURE__ */return f(up,{name:"exclamationCircle",style:{color:k(t,.75),flexShrink:0},size:14});case"stopped":/* @__PURE__ */return f(up,{name:"circle",style:{color:k(t,.5),flexShrink:0},size:14});default:/* @__PURE__ */return f(Xp,{size:"sm",style:{color:t}})}},fh=({stream:e})=>{const t=u(null),n=u(null),[r,i]=p(!1),[o,s]=p(!1);if(a(()=>{if(t.current&&e){const r=t.current;i(!1),s(!1),n.current&&(n.current.catch(()=>{}),n.current=null),r.srcObject=e;const o=()=>{i(!0)},a=()=>{s(!0),i(!1)};r.addEventListener("loadedmetadata",o),r.addEventListener("error",a);const l=r.play();return n.current=l,l.then(()=>{i(!0)}).catch(e=>{e instanceof Error&&"AbortError"!==e.name&&s(!0),n.current=null}),()=>{r.removeEventListener("loadedmetadata",o),r.removeEventListener("error",a)}}return()=>{n.current&&(n.current.catch(()=>{}),n.current=null),t.current&&(t.current.srcObject=null),i(!1),s(!1)}},[e]),!e)return null;const l="8px";/* @__PURE__ */
|
|
39
|
+
return g(fp,{align:"center",justify:"center",gap:"lg",paddingY:"2xl",paddingX:"xl",role:r?"status":void 0,"aria-live":n?"assertive":"polite",style:n?{color:"var(--color-red-600, #dc2626)"}:void 0,children:[r&&/* @__PURE__ */f(Xp,{size:"lg"}),/* @__PURE__ */f(vp,{as:"p",size:"sm",align:"center",children:t})]})},uh=({content:e,status:t="pending",accentColor:n,hideIcon:r=!1,textStyle:i="default"})=>/* @__PURE__ */g(cp,{align:"start",gap:"md",children:[!r&&(()=>{switch(t){case"completed":/* @__PURE__ */return f(up,{name:"checkCircle",style:{color:n,marginTop:"2px",flexShrink:0},size:16});case"failed":/* @__PURE__ */return f(up,{name:"timesCircle",style:{opacity:.65,marginTop:"2px",flexShrink:0},size:16});case"canceled":/* @__PURE__ */return f(up,{name:"ban",style:{opacity:.5,marginTop:"2px",flexShrink:0},size:16});case"running":/* @__PURE__ */return f(Xp,{size:"sm",style:{color:n,marginTop:"2px"}});default:/* @__PURE__ */return f(up,{name:"circle",style:{opacity:.5,marginTop:"2px",flexShrink:0},size:16})}})(),/* @__PURE__ */f(vp,{as:"span",size:"xs",weight:"medium",style:{flex:1,whiteSpace:"pre-wrap",lineHeight:"tight",opacity:"muted"===i?.5:1},children:e})]}),ph=({isWaitingForUser:e,accentColor:t})=>/* @__PURE__ */g(cp,{align:"center",gap:"sm",paddingY:"xs",children:[/* @__PURE__ */f(Xp,{size:"sm",style:{color:t}}),/* @__PURE__ */f(vp,{as:"span",weight:"normal",style:{fontSize:"10px",opacity:.5},children:e?"Waiting for you to complete the action":"Thinking"})]}),hh=({message:e,isLastMessage:t,widgetState:n,accentColor:r})=>{const i="waiting-for-user"===(e.placeholderState||"thinking");return e.parts&&e.parts.length>0?/* @__PURE__ */g(fp,{gap:"sm",children:[e.parts.map((t,n)=>{if("text"===t.type){let e=(i=t.content,i.replace(/\n\n__THINKING__$/,"").replace(/__THINKING__/g,"")).trim();return e=e.replace(/\(Cancelled by cleanup\)/gi,"").replace(/\s+/g," ").trim(),e?/* @__PURE__ */f(vp,{as:"div",size:"xs",weight:"medium",style:{lineHeight:"tight",wordBreak:"break-word",whiteSpace:"pre-wrap",marginBottom:"4px"},children:e},`part-${n}`):null}return"progress"===t.type?"done"===t.toolName&&"done"===e.taskStatus?null:/* @__PURE__ */f(uh,{content:t.content,status:t.status||"running",accentColor:r,...void 0!==t.hideIcon?{hideIcon:t.hideIcon}:{},...void 0!==t.textStyle?{textStyle:t.textStyle}:{}},`part-${n}`):null;var i}),(e.isPlaceholder&&!e.parts.some(e=>"text"===e.type)||n.isTaskRunning&&t&&("show"===e.mode||"do"===e.mode))&&/* @__PURE__ */f(ph,{isWaitingForUser:i,accentColor:r})]}):e.isPlaceholder||n.isTaskRunning&&t&&("show"===e.mode||"do"===e.mode)?/* @__PURE__ */f(ph,{isWaitingForUser:i,accentColor:r}):e.content?/* @__PURE__ */f(vp,{as:"div",size:"xs",weight:"medium",style:{lineHeight:"tight",wordBreak:"break-word",whiteSpace:"pre-wrap"},children:e.content}):/* @__PURE__ */f(ku,{})},mh=({status:e,accentColor:t})=>{switch(e){case"done":/* @__PURE__ */return f(up,{name:"checkCircle",style:{color:t,flexShrink:0},size:14});case"failed":/* @__PURE__ */return f(up,{name:"exclamationCircle",style:{color:k(t,.75),flexShrink:0},size:14});case"stopped":/* @__PURE__ */return f(up,{name:"circle",style:{color:k(t,.5),flexShrink:0},size:14});default:/* @__PURE__ */return f(Xp,{size:"sm",style:{color:t}})}},fh=({stream:e})=>{const t=u(null),n=u(null),[r,i]=p(!1),[o,s]=p(!1);if(a(()=>{if(t.current&&e){const r=t.current;i(!1),s(!1),n.current&&(n.current.catch(()=>{}),n.current=null),r.srcObject=e;const o=()=>{i(!0)},a=()=>{s(!0),i(!1)};r.addEventListener("loadedmetadata",o),r.addEventListener("error",a);const l=r.play();return n.current=l,l.then(()=>{i(!0)}).catch(e=>{e instanceof Error&&"AbortError"!==e.name&&s(!0),n.current=null}),()=>{r.removeEventListener("loadedmetadata",o),r.removeEventListener("error",a)}}return()=>{n.current&&(n.current.catch(()=>{}),n.current=null),t.current&&(t.current.srcObject=null),i(!1),s(!1)}},[e]),!e)return null;const l="8px";/* @__PURE__ */
|
|
40
40
|
return g(ku,{width:"full",overflow:"hidden",position:"relative",style:{marginBottom:"4px",borderRadius:`${l} ${l} 0 0`,backgroundColor:"#000000",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06)"},children:[!r&&!o&&/* @__PURE__ */f(cp,{position:"absolute",inset:"0",align:"center",justify:"center",style:{backgroundColor:"#111827",borderRadius:`${l} ${l} 0 0`,zIndex:10,transition:"opacity 300ms",opacity:r?0:1},children:/* @__PURE__ */g(cp,{direction:"column",align:"center",gap:"md",children:[/* @__PURE__ */g(ku,{position:"relative",style:{width:"32px",height:"32px"},children:[/* @__PURE__ */f(ku,{position:"absolute",inset:"0",rounded:"full",animate:"spin",style:{border:"2px solid white",borderTopColor:"transparent"}}),/* @__PURE__ */f(ku,{position:"absolute",inset:"0",rounded:"full",animate:"spin",style:{border:"2px solid transparent",borderRightColor:"white",animationDirection:"reverse",animationDuration:"0.8s"}})]}),/* @__PURE__ */f(vp,{as:"span",size:"xs",weight:"medium",style:{color:"rgba(255,255,255,0.7)"},children:"Loading stream..."})]})}),o&&/* @__PURE__ */f(cp,{position:"absolute",inset:"0",align:"center",justify:"center",style:{backgroundColor:"#111827",borderRadius:`${l} ${l} 0 0`,zIndex:10},children:/* @__PURE__ */g(cp,{direction:"column",align:"center",gap:"md",style:{textAlign:"center",paddingLeft:"16px",paddingRight:"16px"},children:[/* @__PURE__ */f(up,{name:"alertCircle",size:32,style:{color:"#9ca3af"}}),/* @__PURE__ */f(vp,{as:"span",size:"xs",weight:"medium",style:{color:"rgba(255,255,255,0.7)"},children:"Failed to load stream"})]})}),
|
|
41
41
|
/* @__PURE__ */f(th,{ref:t,autoPlay:!0,muted:!0,playsInline:!0,style:{width:"100%",height:"auto",maxHeight:"192px",objectFit:"contain",borderRadius:`${l} ${l} 0 0`,transition:"opacity 500ms",opacity:r?1:0,minHeight:"120px",background:"linear-gradient(135deg, #111827 0%, #374151 100%)"}}),r&&!o&&/* @__PURE__ */g(cp,{position:"absolute",align:"center",gap:"sm",animate:"fadeIn",style:{top:"8px",right:"8px",padding:"4px 8px",borderRadius:"9999px",backgroundColor:"rgba(55,65,81,0.9)",backdropFilter:"blur(4px)",zIndex:20,boxShadow:"0 2px 8px rgba(31, 41, 55, 0.4)"},children:[/* @__PURE__ */g(cp,{position:"relative",align:"center",justify:"center",children:[/* @__PURE__ */f(ku,{position:"absolute",rounded:"full",animate:"ping",style:{width:"8px",height:"8px",backgroundColor:"white",opacity:.75}}),/* @__PURE__ */f(ku,{position:"relative",rounded:"full",style:{width:"6px",height:"6px",backgroundColor:"white"}})]}),/* @__PURE__ */f(vp,{as:"span",size:"xs",weight:"semibold",style:{color:"white",textTransform:"uppercase",letterSpacing:"0.05em",fontSize:"10px"},children:"Live"})]}),
|
|
42
42
|
/* @__PURE__ */f(cp,{position:"absolute",inset:"0",align:"center",justify:"center",style:{borderRadius:`${l} ${l} 0 0`,backgroundColor:"rgba(0,0,0,0)",zIndex:30,pointerEvents:"none"},children:/* @__PURE__ */f(ku,{rounded:"lg",style:{padding:"4px 12px",backgroundColor:"rgba(0,0,0,0.7)",backdropFilter:"blur(4px)"},children:/* @__PURE__ */f(vp,{as:"div",size:"xs",weight:"medium",style:{color:"white"},children:"Screen Sharing Active"})})})]})},gh=({message:e,index:t,isLastMessage:n,widgetState:r,settings:i,onScreenAccessAllow:o,onScreenAccessDeny:s})=>{if(e.isSystemMessage)/* @__PURE__ */return f(cp,{justify:"center",align:"center",children:/* @__PURE__ */f(vp,{as:"span",variant:"faint",style:{fontSize:"10px",fontWeight:"normal"},children:e.content})},`message-${e.id}-${t}`);const a="user"===e.sender;/* @__PURE__ */
|