@alwith/module-chat 0.5.0 → 0.5.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 (129) hide show
  1. package/dist/activity-host.js +1 -1
  2. package/dist/approval/choice-elicitation-form.js +1 -1
  3. package/dist/approval/choice-schema.js +1 -1
  4. package/dist/approval/permission-options.js +1 -1
  5. package/dist/approval/permission-view.js +1 -1
  6. package/dist/approval/schema-elicitation-form.js +1 -1
  7. package/dist/approval/url-elicitation-card.js +1 -1
  8. package/dist/{chunk-4gayxp21.js → chunk-1vxrdkew.js} +2 -2
  9. package/dist/{chunk-kget6qfz.js → chunk-2sgxwycp.js} +1 -1
  10. package/dist/{chunk-y2xbq7rb.js → chunk-2v9kbth7.js} +3 -3
  11. package/dist/chunk-35j3t609.js +2 -0
  12. package/dist/{chunk-1twg3evk.js → chunk-38skakaz.js} +1 -1
  13. package/dist/chunk-3abwky4a.js +1 -0
  14. package/dist/chunk-3t2c4zky.js +2 -0
  15. package/dist/{chunk-0e1pdbec.js → chunk-3z0y9amd.js} +2 -2
  16. package/dist/chunk-6mhdcz0h.js +2 -0
  17. package/dist/{chunk-yvj5y06y.js → chunk-6pmsbx1j.js} +2 -2
  18. package/dist/{chunk-341yykkp.js → chunk-6q8b8aww.js} +1 -1
  19. package/dist/{chunk-1yy2jsnh.js → chunk-6ynartgd.js} +1 -1
  20. package/dist/{chunk-91nk8n6w.js → chunk-7ar540cc.js} +2 -2
  21. package/dist/{chunk-k7s0drzk.js → chunk-7ex6r8ja.js} +3 -3
  22. package/dist/chunk-7xdvwjxh.js +2 -0
  23. package/dist/{chunk-1cy1j8gj.js → chunk-8md0gr7j.js} +2 -2
  24. package/dist/{chunk-tzdd96d0.js → chunk-98g6kwj5.js} +2 -2
  25. package/dist/chunk-9f42d428.js +1 -0
  26. package/dist/{chunk-k1pd257q.js → chunk-ahcmeqvb.js} +2 -2
  27. package/dist/chunk-bbw2zg1a.js +2 -0
  28. package/dist/chunk-c4ps9628.js +2 -0
  29. package/dist/chunk-c8dr4btd.js +2 -0
  30. package/dist/chunk-d4e74rv1.js +2 -0
  31. package/dist/{chunk-r5d37dc0.js → chunk-dj8v2w6n.js} +1 -1
  32. package/dist/{chunk-25na55ve.js → chunk-dp4g5y18.js} +2 -2
  33. package/dist/{chunk-ftka421d.js → chunk-en6qem8e.js} +2 -2
  34. package/dist/chunk-fk1z4bmr.js +2 -0
  35. package/dist/{chunk-e9zndx26.js → chunk-fk5nvz2s.js} +2 -2
  36. package/dist/{chunk-evcrrxfp.js → chunk-fmxt5ysw.js} +1 -1
  37. package/dist/{chunk-90rwhxdf.js → chunk-g13txkf0.js} +2 -2
  38. package/dist/{chunk-66headm4.js → chunk-gnthx1zg.js} +1 -1
  39. package/dist/{chunk-bf5fh35b.js → chunk-h96s3j1e.js} +2 -2
  40. package/dist/chunk-j3my6gn8.js +1 -0
  41. package/dist/{chunk-3496tgga.js → chunk-jaf9msp7.js} +2 -2
  42. package/dist/{chunk-c4cqqqqh.js → chunk-k0mayxgs.js} +2 -2
  43. package/dist/chunk-k4w61adv.js +2 -0
  44. package/dist/chunk-kk9q6wtq.js +2 -0
  45. package/dist/{chunk-zt7a6b1m.js → chunk-nfd274y3.js} +1 -1
  46. package/dist/{chunk-cp20nzhv.js → chunk-p141s624.js} +2 -2
  47. package/dist/{chunk-ph7bk34y.js → chunk-r125b0z5.js} +2 -2
  48. package/dist/{chunk-m5pbe513.js → chunk-s2n85pks.js} +1 -1
  49. package/dist/chunk-sdv6vdhr.js +7 -0
  50. package/dist/{chunk-pqgtv07g.js → chunk-sptvg9xh.js} +2 -2
  51. package/dist/{chunk-qj8r5xvx.js → chunk-tcqf45rf.js} +2 -2
  52. package/dist/{chunk-wjejhpgw.js → chunk-vk39871j.js} +1 -1
  53. package/dist/{chunk-1hy64ewz.js → chunk-wmsdg5fb.js} +1 -1
  54. package/dist/{chunk-yw4e2tcz.js → chunk-wnq8g0kp.js} +1 -1
  55. package/dist/codex/activity-group.js +1 -1
  56. package/dist/codex/assistant-message.js +2 -2
  57. package/dist/codex/async-question-card.js +2 -2
  58. package/dist/codex/edited-files-card.js +1 -1
  59. package/dist/codex/image-view-activity.js +1 -1
  60. package/dist/codex/markdown-renderer.js +4 -4
  61. package/dist/codex/navigation-audio.d.ts +5 -5
  62. package/dist/codex/navigation-audio.js +1 -1
  63. package/dist/codex/navigation-preview.js +1 -1
  64. package/dist/codex/navigation-rail.js +1 -1
  65. package/dist/codex/plan.js +1 -1
  66. package/dist/codex/timeline-virtualizer.js +1 -1
  67. package/dist/codex/user-message.js +1 -1
  68. package/dist/codex/virtualized-turn-list.js +1 -1
  69. package/dist/composer/completion-filter.js +1 -1
  70. package/dist/composer/completion-menu.js +2 -2
  71. package/dist/composer/completion-trigger.js +1 -1
  72. package/dist/composer/effort-slider.js +1 -1
  73. package/dist/composer/menu-radio.js +1 -1
  74. package/dist/composer/model-select.js +1 -1
  75. package/dist/composer/permission-mode-select.js +1 -1
  76. package/dist/composer/prompt-input-attachments.js +1 -1
  77. package/dist/composer/prompt-input-clipboard.js +1 -1
  78. package/dist/composer/prompt-input-context.js +1 -1
  79. package/dist/composer/prompt-input-textarea.js +3 -3
  80. package/dist/composer/prompt-input.js +1 -1
  81. package/dist/image-lightbox.js +1 -1
  82. package/dist/image-preview-dialog.js +1 -1
  83. package/dist/lib/code-highlighter.js +1 -1
  84. package/dist/lib/fuzzy.js +1 -1
  85. package/dist/lib/group-blocks.js +1 -1
  86. package/dist/lib/image-encode.js +1 -1
  87. package/dist/lib/limits.js +1 -1
  88. package/dist/lib/markdown-parser.js +1 -1
  89. package/dist/lib/markdown-rules.js +1 -1
  90. package/dist/lib/model-name.js +1 -1
  91. package/dist/lib/pointer-centered-zoom.js +1 -1
  92. package/dist/lib/prepare-prompt-files.js +1 -1
  93. package/dist/lib/stream-style.js +1 -1
  94. package/dist/lib/streaming-markdown.js +1 -1
  95. package/dist/search/chat-search.js +1 -1
  96. package/dist/search/dom-matches.js +1 -1
  97. package/dist/search/find-bar.js +1 -1
  98. package/dist/search/literal-matches.js +1 -1
  99. package/dist/ui/badge.js +1 -1
  100. package/dist/ui/button.js +1 -1
  101. package/dist/ui/card.js +1 -1
  102. package/dist/ui/checkbox.js +1 -1
  103. package/dist/ui/dialog.js +1 -1
  104. package/dist/ui/dropdown-menu.js +1 -1
  105. package/dist/ui/field.js +1 -1
  106. package/dist/ui/hover-card.js +1 -1
  107. package/dist/ui/input-group-textarea.js +1 -1
  108. package/dist/ui/input-group.js +1 -1
  109. package/dist/ui/input.js +1 -1
  110. package/dist/ui/radio-group.js +1 -1
  111. package/dist/ui/separator.js +1 -1
  112. package/dist/ui/switch.js +1 -1
  113. package/dist/ui/tooltip.js +1 -1
  114. package/package.json +1 -1
  115. package/dist/chunk-2q9rzxbj.js +0 -2
  116. package/dist/chunk-36h9z1mt.js +0 -1
  117. package/dist/chunk-3eg720sa.js +0 -2
  118. package/dist/chunk-7tj0a2na.js +0 -2
  119. package/dist/chunk-8z8va1ws.js +0 -2
  120. package/dist/chunk-arge74eh.js +0 -2
  121. package/dist/chunk-g20b01rn.js +0 -2
  122. package/dist/chunk-gfj69sqc.js +0 -2
  123. package/dist/chunk-hnt4tt1n.js +0 -2
  124. package/dist/chunk-kaeqvcew.js +0 -1
  125. package/dist/chunk-mbrd76nh.js +0 -2
  126. package/dist/chunk-p9wpghey.js +0 -2
  127. package/dist/chunk-pc1yzf1x.js +0 -1
  128. package/dist/chunk-reqrpvyy.js +0 -2
  129. package/dist/chunk-svmc952q.js +0 -7
@@ -1 +1 @@
1
- import{yt,t,u}from"./chunk-pqgtv07g.js";export{yt as ActivityHostProvider,u as ActivityMarkdown,t as useActivityHost};
1
+ import{It,t,u}from"./chunk-sptvg9xh.js";export{It as ActivityHostProvider,u as ActivityMarkdown,t as useActivityHost};
@@ -1 +1 @@
1
- import{Ae}from"../chunk-341yykkp.js";import{e}from"../chunk-wjejhpgw.js";import{v}from"../chunk-r5d37dc0.js";import{l}from"../chunk-1hy64ewz.js";import{r}from"../chunk-bwzjm3g8.js";import{c,a}from"../chunk-zt7a6b1m.js";import{o}from"../chunk-d0ptk8x8.js";import{ke,q,h,A}from"../chunk-c4cqqqqh.js";import{autoUpdate as X}from"@floating-ui/dom";import{cn as D}from"cn";import{useCallback as L,useEffect as j,useLayoutEffect as G,useMemo as V,useRef as J,useState as B}from"react";import{createPortal as Y}from"react-dom";import{jsx as i,jsxs as g}from"react/jsx-runtime";var p="__other__";function me({current:m,total:H,anchorRef:T,t:w,onAccept:M,onDecline:O}){let k=V(()=>m?ke(m.requestedSchema):[],[m]),[C,y]=B({}),Q=J(null);j(()=>{if(m?.elicitationId===void 0)return;let t={};for(let{key:u,property:n}of k)if(!h(n)){let x=A(n)[0];if(x)t[u]={selected:x.value}}y(t)},[m?.elicitationId,k]),j(()=>{if(m?.elicitationId!==void 0&&Q.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")Q.current.focus()},[m?.elicitationId]);let[U,_]=B(null),[R,W]=B(null),P=L(()=>{let t=T.current;if(!t)return;let u=t.getBoundingClientRect();if(u.width===0){let n=Math.min(640,window.innerWidth*0.9);_({left:(window.innerWidth-n)/2,width:n,bottom:24});return}_({left:u.left,width:u.width,bottom:window.innerHeight-u.bottom+20})},[T]);G(()=>{if(!m)return;let t=0,u=()=>{if(T.current){P();return}t=requestAnimationFrame(u)};return u(),()=>cancelAnimationFrame(t)},[m,P,T]),G(()=>{let t=T.current;if(!m||!t||!R)return;return X(t,R,P,{animationFrame:!0})},[m,R,T,P]);let F=V(()=>{if(!m)return!1;for(let{key:t,property:u}of k){let n=C[t];if(!n)return!1;if(h(u)){if(!n.selectedSet||n.selectedSet.size===0)return!1;if(n.selectedSet.has(p)&&!n.otherText?.trim())return!1}else{if(!n.selected)return!1;if(n.selected===p&&!n.otherText?.trim())return!1}}return!0},[m,k,C]),K=L(async()=>{if(!m)return;if(!F)return;let t={},u={};for(let{key:n,property:x}of k){let f=C[n];if(!f)continue;let N;if(h(x))t[n]=[...f.selectedSet??[]].map((b)=>b===p?(f.otherText??"").trim():b).filter(Boolean);else{let b=f.selected??"";if(t[n]=b===p?(f.otherText??"").trim():b,b!==p)N=A(x).find((s)=>s.value===b)?.preview}let S=f.notes?.trim();if(N||S)u[n]={...N&&{preview:N},...S&&{notes:S}}}await M(m.elicitationId,t,u)},[m,k,C,F,M]),z=L(async()=>{if(m)await O(m.elicitationId)},[m,O]);if(!m||!U)return null;return Y(g("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),z()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:U.left,width:U.width,bottom:U.bottom,maxHeight:"70vh"},ref:(t)=>{Q.current=t,W(t)},children:[g("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[i("div",{className:"text-foreground text-sm font-medium",children:w("askUserQuestion.title")}),H>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${H}`})]}),i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"space-y-4 px-3 py-3",children:k.map(({key:t,property:u},n)=>{let x=C[t],f=x?.selected,N=x?.selectedSet??new Set,S=A(u),b=h(u);return g("div",{className:"space-y-2",children:[g("div",{className:"flex items-center gap-2",children:[i(Ae,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:q(u).title??t}),i("div",{className:"text-foreground text-sm font-medium",children:q(u).description})]}),b?g("div",{className:"space-y-1.5 ps-1",children:[S.map((s)=>g("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(v,{checked:N.has(s.value),onCheckedChange:(d)=>{y((E)=>{let I=new Set(E[t]?.selectedSet??new Set);if(d)I.add(s.value);else I.delete(s.value);return{...E,[t]:{...E[t],selectedSet:I}}})}}),g("div",{className:"min-w-0 flex-1",children:[i("div",{className:"text-foreground text-sm",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs",children:s.description})]})]},s.value)),g("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(v,{checked:N.has(p),onCheckedChange:(s)=>{y((d)=>{let E=new Set(d[t]?.selectedSet??new Set);if(s)E.add(p);else E.delete(p);return{...d,[t]:{...d[t],selectedSet:E}}})}}),i("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:w("askUserQuestion.other")})]}),N.has(p)&&i("div",{className:"ps-7",children:i(l,{placeholder:w("askUserQuestion.otherPlaceholder"),value:x?.otherText??"",onChange:(s)=>y((d)=>({...d,[t]:{...d[t],otherText:s.target.value}}))})})]}):g(c,{value:f??"",onValueChange:(s)=>y((d)=>({...d,[t]:{...d[t],selected:s}})),className:"space-y-1.5 ps-1",children:[S.map((s)=>{let d=`${n}:${s.value}`;return g("div",{className:D("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",f===s.value&&"bg-muted/60"),children:[i(a,{value:s.value,id:d}),g(r,{htmlFor:d,className:"min-w-0 flex-1 cursor-pointer",children:[i("div",{className:"text-foreground text-sm font-normal",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs font-normal",children:s.description})]})]},s.value)}),g("div",{className:D("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",f===p&&"bg-muted/60"),children:[i(a,{value:p,id:`${n}:other`,className:"mt-0.5"}),i(r,{htmlFor:`${n}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:w("askUserQuestion.other")})]}),f===p&&i("div",{className:"ps-7",children:i(l,{placeholder:w("askUserQuestion.otherPlaceholder"),value:x?.otherText??"",onChange:(s)=>y((d)=>({...d,[t]:{...d[t],otherText:s.target.value}}))})})]}),!b&&f&&f!==p&&(()=>{let s=S.find((d)=>d.value===f)?.preview;if(!s)return null;return i("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:s})})(),S.some((s)=>s.preview)&&i(o,{placeholder:w("askUserQuestion.notesPlaceholder"),value:x?.notes??"",onChange:(s)=>y((d)=>({...d,[t]:{...d[t],notes:s.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),g("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[i(e,{variant:"ghost",size:"sm",onClick:()=>void z(),children:w("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!F,onClick:()=>void K(),children:w("askUserQuestion.submit")})]})]}),document.body)}export{me as ChoiceElicitationForm};
1
+ import{Se}from"../chunk-6q8b8aww.js";import{e}from"../chunk-vk39871j.js";import{w}from"../chunk-dj8v2w6n.js";import{d}from"../chunk-wmsdg5fb.js";import{r}from"../chunk-bwzjm3g8.js";import{c,s}from"../chunk-nfd274y3.js";import{o}from"../chunk-d0ptk8x8.js";import{Ce,G,h,A}from"../chunk-k0mayxgs.js";import{autoUpdate as X}from"@floating-ui/dom";import{cn as z}from"cn";import{useCallback as L,useEffect as D,useLayoutEffect as j,useMemo as V,useRef as J,useState as q}from"react";import{createPortal as Y}from"react-dom";import{jsx as n,jsxs as p}from"react/jsx-runtime";var v="__other__";function me({current:m,total:B,anchorRef:T,t:b,onAccept:H,onDecline:M}){let k=V(()=>m?Ce(m.requestedSchema):[],[m]),[C,y]=q({}),Q=J(null);D(()=>{if(m?.elicitationId===void 0)return;let t={};for(let{key:u,property:a}of k)if(!h(a)){let g=A(a)[0];if(g)t[u]={selected:g.value}}y(t)},[m?.elicitationId,k]),D(()=>{if(m?.elicitationId!==void 0&&Q.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")Q.current.focus()},[m?.elicitationId]);let[U,O]=q(null),[R,W]=q(null),P=L(()=>{let t=T.current;if(!t)return;let u=t.getBoundingClientRect();if(u.width===0){let a=Math.min(640,window.innerWidth*0.9);O({left:(window.innerWidth-a)/2,width:a,bottom:24});return}O({left:u.left,width:u.width,bottom:window.innerHeight-u.bottom+20})},[T]);j(()=>{if(!m)return;let t=0,u=()=>{if(T.current){P();return}t=requestAnimationFrame(u)};return u(),()=>cancelAnimationFrame(t)},[m,P,T]),j(()=>{let t=T.current;if(!m||!t||!R)return;return X(t,R,P,{animationFrame:!0})},[m,R,T,P]);let F=V(()=>{if(!m)return!1;for(let{key:t,property:u}of k){let a=C[t];if(!a)return!1;if(h(u)){if(!a.selectedSet||a.selectedSet.size===0)return!1;if(a.selectedSet.has(v)&&!a.otherText?.trim())return!1}else{if(!a.selected)return!1;if(a.selected===v&&!a.otherText?.trim())return!1}}return!0},[m,k,C]),K=L(async()=>{if(!m)return;if(!F)return;let t={},u={};for(let{key:a,property:g}of k){let f=C[a];if(!f)continue;let N;if(h(g))t[a]=[...f.selectedSet??[]].map((x)=>x===v?(f.otherText??"").trim():x).filter(Boolean);else{let x=f.selected??"";if(t[a]=x===v?(f.otherText??"").trim():x,x!==v)N=A(g).find((i)=>i.value===x)?.preview}let S=f.notes?.trim();if(N||S)u[a]={...N&&{preview:N},...S&&{notes:S}}}await H(m.elicitationId,t,u)},[m,k,C,F,H]),_=L(async()=>{if(m)await M(m.elicitationId)},[m,M]);if(!m||!U)return null;return Y(p("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),_()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:U.left,width:U.width,bottom:U.bottom,maxHeight:"70vh"},ref:(t)=>{Q.current=t,W(t)},children:[p("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[n("div",{className:"text-foreground text-sm font-medium",children:b("askUserQuestion.title")}),B>1&&n("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${B}`})]}),n("div",{className:"min-h-0 flex-1 overflow-y-auto",children:n("div",{className:"space-y-4 px-3 py-3",children:k.map(({key:t,property:u},a)=>{let g=C[t],f=g?.selected,N=g?.selectedSet??new Set,S=A(u),x=h(u);return p("div",{className:"space-y-2",children:[p("div",{className:"flex items-center gap-2",children:[n(Se,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:G(u).title??t}),n("div",{className:"text-foreground text-sm font-medium",children:G(u).description})]}),x?p("div",{className:"space-y-1.5 ps-1",children:[S.map((i)=>p("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[n(w,{checked:N.has(i.value),onCheckedChange:(l)=>{y((E)=>{let I=new Set(E[t]?.selectedSet??new Set);if(l)I.add(i.value);else I.delete(i.value);return{...E,[t]:{...E[t],selectedSet:I}}})}}),p("div",{className:"min-w-0 flex-1",children:[n("div",{className:"text-foreground text-sm",children:i.label}),i.description&&n("div",{className:"text-muted-foreground text-xs",children:i.description})]})]},i.value)),p("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[n(w,{checked:N.has(v),onCheckedChange:(i)=>{y((l)=>{let E=new Set(l[t]?.selectedSet??new Set);if(i)E.add(v);else E.delete(v);return{...l,[t]:{...l[t],selectedSet:E}}})}}),n("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:b("askUserQuestion.other")})]}),N.has(v)&&n("div",{className:"ps-7",children:n(d,{placeholder:b("askUserQuestion.otherPlaceholder"),value:g?.otherText??"",onChange:(i)=>y((l)=>({...l,[t]:{...l[t],otherText:i.target.value}}))})})]}):p(c,{value:f??"",onValueChange:(i)=>y((l)=>({...l,[t]:{...l[t],selected:i}})),className:"space-y-1.5 ps-1",children:[S.map((i)=>{let l=`${a}:${i.value}`;return p("div",{className:z("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",f===i.value&&"bg-muted/60"),children:[n(s,{value:i.value,id:l}),p(r,{htmlFor:l,className:"min-w-0 flex-1 cursor-pointer",children:[n("div",{className:"text-foreground text-sm font-normal",children:i.label}),i.description&&n("div",{className:"text-muted-foreground text-xs font-normal",children:i.description})]})]},i.value)}),p("div",{className:z("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",f===v&&"bg-muted/60"),children:[n(s,{value:v,id:`${a}:other`,className:"mt-0.5"}),n(r,{htmlFor:`${a}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:b("askUserQuestion.other")})]}),f===v&&n("div",{className:"ps-7",children:n(d,{placeholder:b("askUserQuestion.otherPlaceholder"),value:g?.otherText??"",onChange:(i)=>y((l)=>({...l,[t]:{...l[t],otherText:i.target.value}}))})})]}),!x&&f&&f!==v&&(()=>{let i=S.find((l)=>l.value===f)?.preview;if(!i)return null;return n("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:i})})(),S.some((i)=>i.preview)&&n(o,{placeholder:b("askUserQuestion.notesPlaceholder"),value:g?.notes??"",onChange:(i)=>y((l)=>({...l,[t]:{...l[t],notes:i.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),p("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[n(e,{variant:"ghost",size:"sm",onClick:()=>void _(),children:b("askUserQuestion.cancel")}),n(e,{size:"sm",disabled:!F,onClick:()=>void K(),children:b("askUserQuestion.submit")})]})]}),document.body)}export{me as ChoiceElicitationForm};
@@ -1 +1 @@
1
- import{ke,q,h,A}from"../chunk-c4cqqqqh.js";export{ke as elicitationFields,q as elicitationLabels,A as elicitationOptions,h as isMultiSelect};
1
+ import{Ce,G,h,A}from"../chunk-k0mayxgs.js";export{Ce as elicitationFields,G as elicitationLabels,A as elicitationOptions,h as isMultiSelect};
@@ -1 +1 @@
1
- import{rt,Ce,wt,kt}from"../chunk-8z8va1ws.js";export{rt as PERMISSION_KIND_GROUP_ORDER,wt as isAllowKind,kt as isAlwaysKind,Ce as sortPermissionOptions};
1
+ import{nt,ke,wt,kt}from"../chunk-d4e74rv1.js";export{nt as PERMISSION_KIND_GROUP_ORDER,wt as isAllowKind,kt as isAlwaysKind,ke as sortPermissionOptions};
@@ -1 +1 @@
1
- import{Ce}from"../chunk-8z8va1ws.js";import{autoUpdate as L}from"@floating-ui/dom";import{cn as I}from"cn";import{CheckCheckIcon as M,CheckIcon as h,ShieldXIcon as V,XIcon as F}from"lucide-react";import{useCallback as H,useEffect as N,useId as T,useLayoutEffect as _,useRef as S,useState as f}from"react";import{createPortal as z}from"react-dom";import{jsx as i,jsxs as u}from"react/jsx-runtime";var U={allow_once:{icon:h},allow_always:{icon:M},reject_once:{icon:F},reject_always:{icon:V}};function Y({requestId:p,options:D,title:E,children:P,total:w=1,alwaysLabel:j="always",autoFocus:y="always",anchorRef:n,onRespond:r}){let b=T(),[a,g]=f(0),[s,v]=f(null),[l,A]=f(null),x=S(null),c=Ce(D);N(()=>{g(0)},[p]),N(()=>{let e=document.activeElement;if(y==="always"||e===null||e===document.body)x.current?.focus()},[p,l,y]);let d=H(()=>{let e=n?.current;if(!e)return;let t=e.getBoundingClientRect();if(t.width===0){let o=Math.min(640,window.innerWidth*0.9);v({left:(window.innerWidth-o)/2,width:o,bottom:24});return}v({left:t.left,width:t.width,bottom:window.innerHeight-t.bottom+20})},[n]);if(_(()=>{if(!n)return;let e=0,t=()=>{if(n.current)d();else e=requestAnimationFrame(t)};return t(),()=>cancelAnimationFrame(e)},[p,n,d]),_(()=>{let e=n?.current;if(!e||!l)return;return L(e,l,d,{animationFrame:!0})},[n,l,d]),n&&!s)return null;let k=u("div",{ref:A,"data-overlay":"permission-request",className:I("bg-card border-border overflow-hidden rounded-lg border",n&&"fixed z-50"),style:n&&s?{left:s.left,width:s.width,bottom:s.bottom}:void 0,children:[u("div",{className:"border-border border-b px-3 py-2",children:[u("div",{className:"flex items-center justify-between gap-2",children:[i("div",{id:b,className:"text-foreground text-sm font-medium",children:E}),w>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${w}`})]}),P]}),i("div",{role:"listbox","aria-labelledby":b,tabIndex:0,ref:x,onKeyDown:(e)=>{let t=c.length;if(t===0&&e.key!=="Escape")return;if(e.key==="ArrowDown"||e.key==="ArrowUp")e.preventDefault(),g((o)=>e.key==="ArrowDown"?(o+1)%t:(o-1+t)%t);else if(e.key==="Enter")e.preventDefault(),r(c[a].optionId);else if(e.key==="Escape")e.preventDefault(),r(null);else if(/^[1-9]$/.test(e.key)&&Number(e.key)<=t)e.preventDefault(),r(c[Number(e.key)-1].optionId)},className:"outline-none",children:c.map((e,t)=>{let o=e.kind??"allow_once",C=U[o]?.icon??h,K=o==="allow_always"||o==="reject_always",O=o==="reject_once"||o==="reject_always";return u("div",{role:"option",tabIndex:-1,"aria-selected":t===a,title:e.description,onClick:()=>void r(e.optionId),onKeyDown:(m)=>{if(m.key==="Enter"||m.key===" ")m.preventDefault(),m.stopPropagation(),r(e.optionId)},className:I("flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm select-none",t===a?"bg-ring text-accent-foreground":"text-foreground",O&&t!==a&&"text-muted-foreground"),children:[i("span",{className:"min-w-3 text-xs opacity-70",children:t+1}),i(C,{className:"size-3.5 shrink-0 opacity-80"}),i("span",{className:"min-w-0 flex-1 truncate",children:e.name}),K&&i("span",{className:"bg-muted text-muted-foreground rounded px-1.5 py-0.5 text-[10px] tracking-wide uppercase",children:j})]},e.optionId)})})]});return n?z(k,document.body):k}export{Y as PermissionView};
1
+ import{ke}from"../chunk-d4e74rv1.js";import{autoUpdate as L}from"@floating-ui/dom";import{cn as I}from"cn";import{CheckCheckIcon as M,CheckIcon as h,ShieldXIcon as V,XIcon as F}from"lucide-react";import{useCallback as H,useEffect as N,useId as T,useLayoutEffect as _,useRef as S,useState as f}from"react";import{createPortal as z}from"react-dom";import{jsx as i,jsxs as u}from"react/jsx-runtime";var U={allow_once:{icon:h},allow_always:{icon:M},reject_once:{icon:F},reject_always:{icon:V}};function Y({requestId:p,options:D,title:E,children:P,total:w=1,alwaysLabel:j="always",autoFocus:y="always",anchorRef:n,onRespond:r}){let b=T(),[a,g]=f(0),[s,v]=f(null),[l,A]=f(null),x=S(null),c=ke(D);N(()=>{g(0)},[p]),N(()=>{let e=document.activeElement;if(y==="always"||e===null||e===document.body)x.current?.focus()},[p,l,y]);let d=H(()=>{let e=n?.current;if(!e)return;let t=e.getBoundingClientRect();if(t.width===0){let o=Math.min(640,window.innerWidth*0.9);v({left:(window.innerWidth-o)/2,width:o,bottom:24});return}v({left:t.left,width:t.width,bottom:window.innerHeight-t.bottom+20})},[n]);if(_(()=>{if(!n)return;let e=0,t=()=>{if(n.current)d();else e=requestAnimationFrame(t)};return t(),()=>cancelAnimationFrame(e)},[p,n,d]),_(()=>{let e=n?.current;if(!e||!l)return;return L(e,l,d,{animationFrame:!0})},[n,l,d]),n&&!s)return null;let k=u("div",{ref:A,"data-overlay":"permission-request",className:I("bg-card border-border overflow-hidden rounded-lg border",n&&"fixed z-50"),style:n&&s?{left:s.left,width:s.width,bottom:s.bottom}:void 0,children:[u("div",{className:"border-border border-b px-3 py-2",children:[u("div",{className:"flex items-center justify-between gap-2",children:[i("div",{id:b,className:"text-foreground text-sm font-medium",children:E}),w>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${w}`})]}),P]}),i("div",{role:"listbox","aria-labelledby":b,tabIndex:0,ref:x,onKeyDown:(e)=>{let t=c.length;if(t===0&&e.key!=="Escape")return;if(e.key==="ArrowDown"||e.key==="ArrowUp")e.preventDefault(),g((o)=>e.key==="ArrowDown"?(o+1)%t:(o-1+t)%t);else if(e.key==="Enter")e.preventDefault(),r(c[a].optionId);else if(e.key==="Escape")e.preventDefault(),r(null);else if(/^[1-9]$/.test(e.key)&&Number(e.key)<=t)e.preventDefault(),r(c[Number(e.key)-1].optionId)},className:"outline-none",children:c.map((e,t)=>{let o=e.kind??"allow_once",C=U[o]?.icon??h,K=o==="allow_always"||o==="reject_always",O=o==="reject_once"||o==="reject_always";return u("div",{role:"option",tabIndex:-1,"aria-selected":t===a,title:e.description,onClick:()=>void r(e.optionId),onKeyDown:(m)=>{if(m.key==="Enter"||m.key===" ")m.preventDefault(),m.stopPropagation(),r(e.optionId)},className:I("flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm select-none",t===a?"bg-ring text-accent-foreground":"text-foreground",O&&t!==a&&"text-muted-foreground"),children:[i("span",{className:"min-w-3 text-xs opacity-70",children:t+1}),i(C,{className:"size-3.5 shrink-0 opacity-80"}),i("span",{className:"min-w-0 flex-1 truncate",children:e.name}),K&&i("span",{className:"bg-muted text-muted-foreground rounded px-1.5 py-0.5 text-[10px] tracking-wide uppercase",children:j})]},e.optionId)})})]});return n?z(k,document.body):k}export{Y as PermissionView};
@@ -1 +1 @@
1
- import{e}from"../chunk-wjejhpgw.js";import{v}from"../chunk-r5d37dc0.js";import{M,N,Ke,We,S,qe}from"../chunk-yw4e2tcz.js";import{r}from"../chunk-bwzjm3g8.js";import"../chunk-66headm4.js";import{j,Q,Fe,De,He,D}from"../chunk-36h9z1mt.js";import{l}from"../chunk-1hy64ewz.js";import{c,a}from"../chunk-zt7a6b1m.js";import{I}from"../chunk-m5pbe513.js";import{o}from"../chunk-d0ptk8x8.js";import{isArrayProperty as A,isBooleanProperty as C,isNumberProperty as E,isStringProperty as V}from"@alwith/api";import{useEffect as R,useMemo as q,useState as P}from"react";import{jsx as u,jsxs as f}from"react/jsx-runtime";function L(s){if(!V(s))return null;if(s.oneOf&&s.oneOf.length>0)return s.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(s.enum&&s.enum.length>0)return s.enum.map((t)=>({value:t,label:t}));return null}function G(s){let t=s,n=t._meta?.alwith?.options;if(Array.isArray(n)&&Array.isArray(t.enum))return n.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));if(Array.isArray(t.enum))return t.enum.map((i)=>({value:String(i),label:String(i)}));if(Array.isArray(t.oneOf))return t.oneOf.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));return null}function B(s){let t=new Set(s.required??[]);return Object.entries(s.properties??{}).map(([n,i])=>({key:n,property:i,title:i.title??n,description:i.description??null,required:t.has(n),options:L(i),multiOptions:A(i)?G(i.items):null}))}function O(s){let t={};for(let n of s){let i=n.property.default;if(i!==void 0&&i!==null)t[n.key]=i;else if(n.options)t[n.key]=n.options[0].value;else if(C(n.property))t[n.key]=!1;else if(A(n.property))t[n.key]=[]}return t}function K(s,t){if(s.multiOptions)return Array.isArray(t)&&t.length>0;if(!s.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function w({id:s,label:t,description:n,control:i}){return f("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,f(r,{htmlFor:s,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[u("div",{className:"text-foreground text-sm",children:t}),n&&u("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function T({id:s,field:t,value:n,onChange:i}){if(t.multiOptions){let m=new Set(Array.isArray(n)?n:[]);return f(j,{children:[u(Q,{variant:"label",children:t.title}),t.description&&u(D,{children:t.description}),u("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((p)=>{let g=`${s}:${p.value}`;return u(w,{id:g,...p,control:u(v,{id:g,checked:m.has(p.value),onCheckedChange:(F)=>{let y=new Set(m);if(F)y.add(p.value);else y.delete(p.value);i([...y])}})},p.value)})})]})}if(t.options)return f(j,{children:[u(Q,{variant:"label",children:t.title}),t.description&&u(D,{children:t.description}),u(c,{value:typeof n==="string"?n:"",onValueChange:(m)=>i(String(m)),className:"flex flex-col gap-1",children:t.options.map((m)=>{let p=`${s}:${m.value}`;return u(w,{id:p,...m,control:u(a,{value:m.value,id:p})},m.value)})})]});return f(De,{children:[u(He,{htmlFor:s,children:t.title}),C(t.property)?u(I,{id:s,checked:n===!0,onCheckedChange:(m)=>i(m)}):E(t.property)?u(l,{id:s,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(m)=>i(m.target.value===""?void 0:Number(m.target.value))}):u(o,{id:s,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(m)=>i(m.target.value)}),t.description&&u(D,{children:t.description})]})}function ie({requestId:s,schema:t,message:n,total:i,t:m,onRespond:p}){let g=q(()=>B(t),[t]),[F,y]=P(()=>O(g));R(()=>y(O(g)),[s,g]);let x=g.every((d)=>K(d,F[d.key])),k=()=>{if(!x)return;let d={};for(let[b,h]of Object.entries(F))if(h!==void 0)d[b]=h;p({action:"accept",content:d})};return u(M,{open:!0,onOpenChange:(d)=>!d&&p({action:"cancel"}),children:f(N,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(d)=>{if(d.key==="Enter"&&(d.metaKey||d.ctrlKey))d.preventDefault(),k()},children:[f(Ke,{children:[f("div",{className:"flex items-center justify-between gap-2 pe-8",children:[u(S,{children:t.title??m("approval.needed")}),i>1&&u("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),u(qe,{children:n})]}),u("div",{className:"min-h-0 flex-1 overflow-y-auto",children:u(Fe,{children:g.map((d)=>u(T,{id:`${s}:${d.key}`,field:d,value:F[d.key],onChange:(b)=>y((h)=>({...h,[d.key]:b}))},d.key))})}),f(We,{children:[u(e,{variant:"ghost",onClick:()=>p({action:"decline"}),children:m("actions.decline")}),u(e,{disabled:!x,onClick:k,children:m("actions.submit")})]})]})})}export{ie as SchemaElicitationForm,B as elicitationFields,O as initialValues,K as isAnswered};
1
+ import{e}from"../chunk-vk39871j.js";import{w}from"../chunk-dj8v2w6n.js";import{E,R,Ye,Je,L,et}from"../chunk-wnq8g0kp.js";import{r}from"../chunk-bwzjm3g8.js";import"../chunk-gnthx1zg.js";import{re,oe,je,Qe,Xe,H}from"../chunk-3abwky4a.js";import{d}from"../chunk-wmsdg5fb.js";import{c,s}from"../chunk-nfd274y3.js";import{N}from"../chunk-s2n85pks.js";import{o}from"../chunk-d0ptk8x8.js";import{isArrayProperty as D,isBooleanProperty as S,isNumberProperty as A,isStringProperty as C}from"@alwith/api";import{useEffect as V,useMemo as q,useState as P}from"react";import{jsx as l,jsxs as f}from"react/jsx-runtime";function G(a){if(!C(a))return null;if(a.oneOf&&a.oneOf.length>0)return a.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(a.enum&&a.enum.length>0)return a.enum.map((t)=>({value:t,label:t}));return null}function I(a){let t=a,n=t._meta?.alwith?.options;if(Array.isArray(n)&&Array.isArray(t.enum))return n.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));if(Array.isArray(t.enum))return t.enum.map((i)=>({value:String(i),label:String(i)}));if(Array.isArray(t.oneOf))return t.oneOf.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));return null}function B(a){let t=new Set(a.required??[]);return Object.entries(a.properties??{}).map(([n,i])=>({key:n,property:i,title:i.title??n,description:i.description??null,required:t.has(n),options:G(i),multiOptions:D(i)?I(i.items):null}))}function k(a){let t={};for(let n of a){let i=n.property.default;if(i!==void 0&&i!==null)t[n.key]=i;else if(n.options)t[n.key]=n.options[0].value;else if(S(n.property))t[n.key]=!1;else if(D(n.property))t[n.key]=[]}return t}function K(a,t){if(a.multiOptions)return Array.isArray(t)&&t.length>0;if(!a.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function O({id:a,label:t,description:n,control:i}){return f("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,f(r,{htmlFor:a,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[l("div",{className:"text-foreground text-sm",children:t}),n&&l("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function T({id:a,field:t,value:n,onChange:i}){if(t.multiOptions){let u=new Set(Array.isArray(n)?n:[]);return f(re,{children:[l(oe,{variant:"label",children:t.title}),t.description&&l(H,{children:t.description}),l("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((p)=>{let g=`${a}:${p.value}`;return l(O,{id:g,...p,control:l(w,{id:g,checked:u.has(p.value),onCheckedChange:(F)=>{let y=new Set(u);if(F)y.add(p.value);else y.delete(p.value);i([...y])}})},p.value)})})]})}if(t.options)return f(re,{children:[l(oe,{variant:"label",children:t.title}),t.description&&l(H,{children:t.description}),l(c,{value:typeof n==="string"?n:"",onValueChange:(u)=>i(String(u)),className:"flex flex-col gap-1",children:t.options.map((u)=>{let p=`${a}:${u.value}`;return l(O,{id:p,...u,control:l(s,{value:u.value,id:p})},u.value)})})]});return f(Qe,{children:[l(Xe,{htmlFor:a,children:t.title}),S(t.property)?l(N,{id:a,checked:n===!0,onCheckedChange:(u)=>i(u)}):A(t.property)?l(d,{id:a,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(u)=>i(u.target.value===""?void 0:Number(u.target.value))}):l(o,{id:a,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(u)=>i(u.target.value)}),t.description&&l(H,{children:t.description})]})}function ee({requestId:a,schema:t,message:n,total:i,t:u,onRespond:p}){let g=q(()=>B(t),[t]),[F,y]=P(()=>k(g));V(()=>y(k(g)),[a,g]);let b=g.every((m)=>K(m,F[m.key])),x=()=>{if(!b)return;let m={};for(let[h,v]of Object.entries(F))if(v!==void 0)m[h]=v;p({action:"accept",content:m})};return l(E,{open:!0,onOpenChange:(m)=>!m&&p({action:"cancel"}),children:f(R,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(m)=>{if(m.key==="Enter"&&(m.metaKey||m.ctrlKey))m.preventDefault(),x()},children:[f(Ye,{children:[f("div",{className:"flex items-center justify-between gap-2 pe-8",children:[l(L,{children:t.title??u("approval.needed")}),i>1&&l("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),l(et,{children:n})]}),l("div",{className:"min-h-0 flex-1 overflow-y-auto",children:l(je,{children:g.map((m)=>l(T,{id:`${a}:${m.key}`,field:m,value:F[m.key],onChange:(h)=>y((v)=>({...v,[m.key]:h}))},m.key))})}),f(Je,{children:[l(e,{variant:"ghost",onClick:()=>p({action:"decline"}),children:u("actions.decline")}),l(e,{disabled:!b,onClick:x,children:u("actions.submit")})]})]})})}export{ee as SchemaElicitationForm,B as elicitationFields,k as initialValues,K as isAnswered};
@@ -1 +1 @@
1
- import{e}from"../chunk-wjejhpgw.js";import{Pe,Ie,Me,Ne,Se,Ee}from"../chunk-kget6qfz.js";import{ExternalLinkIcon as d}from"lucide-react";import{jsx as a,jsxs as n}from"react/jsx-runtime";function C({message:r,url:t,t:i,onOpen:l,onRespond:o}){return n(Pe,{size:"sm",children:[n(Ie,{children:[a(Ne,{children:i("approval.needed")}),a(Me,{children:r})]}),a(Se,{children:n("div",{className:"flex flex-col gap-3",children:[n(e,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>void l(t),children:[a(d,{"data-icon":"inline-start"}),i("approval.openLink")]}),a("p",{className:"text-muted-foreground text-sm",children:i("approval.waitingForLink")})]})}),n(Ee,{className:"flex flex-wrap gap-2",children:[a(e,{variant:"outline",size:"sm",onClick:()=>o("decline"),children:i("actions.decline")}),a(e,{variant:"ghost",size:"sm",onClick:()=>o("cancel"),children:i("actions.cancel")})]})]})}export{C as UrlElicitationCard};
1
+ import{e}from"../chunk-vk39871j.js";import{Be,ze,$e,Ue,Ve,Ke}from"../chunk-2sgxwycp.js";import{ExternalLinkIcon as d}from"lucide-react";import{jsx as a,jsxs as n}from"react/jsx-runtime";function C({message:r,url:t,t:i,onOpen:l,onRespond:o}){return n(Be,{size:"sm",children:[n(ze,{children:[a(Ue,{children:i("approval.needed")}),a($e,{children:r})]}),a(Ve,{children:n("div",{className:"flex flex-col gap-3",children:[n(e,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>void l(t),children:[a(d,{"data-icon":"inline-start"}),i("approval.openLink")]}),a("p",{className:"text-muted-foreground text-sm",children:i("approval.waitingForLink")})]})}),n(Ke,{className:"flex flex-wrap gap-2",children:[a(e,{variant:"outline",size:"sm",onClick:()=>o("decline"),children:i("actions.decline")}),a(e,{variant:"ghost",size:"sm",onClick:()=>o("cancel"),children:i("actions.cancel")})]})]})}export{C as UrlElicitationCard};
@@ -1,2 +1,2 @@
1
- import{Qe}from"./chunk-0e1pdbec.js";async function m(r){try{let i=await(await fetch(r)).blob();if(typeof createImageBitmap==="function")return(await createImageBitmap(i)).close(),!0;return await new Promise((a)=>{let o=new Image;o.onload=()=>a(!0),o.onerror=()=>a(!1),o.src=r})}catch{return!1}}async function $e(r){let n=await Promise.all(r.map(async({id:a,lastModified:o,sourcePath:p,...t})=>{let e=t.url;if(t.url.startsWith("blob:")){let s=await Qe(t.url,t.mediaType);if(s===null)return null;e=s}let l=t.mediaType.toLowerCase().startsWith("image/"),c=e.startsWith("data:image/");if(l&&c&&!await m(e))return null;let u=e.startsWith("data:")?e.slice(5,e.indexOf(";")):t.mediaType;return{...t,url:e,mediaType:u}})),i=n.filter((a)=>a!==null);return{files:i,rejectedCount:n.length-i.length}}
2
- export{$e};
1
+ import{Fe}from"./chunk-3z0y9amd.js";async function m(r){try{let i=await(await fetch(r)).blob();if(typeof createImageBitmap==="function")return(await createImageBitmap(i)).close(),!0;return await new Promise((a)=>{let o=new Image;o.onload=()=>a(!0),o.onerror=()=>a(!1),o.src=r})}catch{return!1}}async function Ae(r){let n=await Promise.all(r.map(async({id:a,lastModified:o,sourcePath:p,...t})=>{let e=t.url;if(t.url.startsWith("blob:")){let s=await Fe(t.url,t.mediaType);if(s===null)return null;e=s}let l=t.mediaType.toLowerCase().startsWith("image/"),c=e.startsWith("data:image/");if(l&&c&&!await m(e))return null;let u=e.startsWith("data:")?e.slice(5,e.indexOf(";")):t.mediaType;return{...t,url:e,mediaType:u}})),i=n.filter((a)=>a!==null);return{files:i,rejectedCount:n.length-i.length}}
2
+ export{Ae};
@@ -1 +1 @@
1
- import{cn as r}from"cn";import{jsx as d}from"react/jsx-runtime";function Pe({className:a,size:t="default",...o}){return d("div",{"data-slot":"card","data-size":t,className:r("group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm shadow-xs ring-1 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...o})}function Ie({className:a,...t}){return d("div",{"data-slot":"card-header",className:r("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",a),...t})}function Me({className:a,...t}){return d("div",{"data-slot":"card-title",className:r("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",a),...t})}function Ne({className:a,...t}){return d("div",{"data-slot":"card-description",className:r("text-muted-foreground text-sm",a),...t})}function Tt({className:a,...t}){return d("div",{"data-slot":"card-action",className:r("col-start-2 row-span-2 row-start-1 self-start justify-self-end",a),...t})}function Se({className:a,...t}){return d("div",{"data-slot":"card-content",className:r("flex flex-col gap-3 px-(--card-spacing)",a),...t})}function Ee({className:a,...t}){return d("div",{"data-slot":"card-footer",className:r("flex items-center rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing)",a),...t})}export{Pe,Ie,Me,Ne,Tt,Se,Ee};
1
+ import{cn as r}from"cn";import{jsx as d}from"react/jsx-runtime";function Be({className:a,size:t="default",...o}){return d("div",{"data-slot":"card","data-size":t,className:r("group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm shadow-xs ring-1 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...o})}function ze({className:a,...t}){return d("div",{"data-slot":"card-header",className:r("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",a),...t})}function $e({className:a,...t}){return d("div",{"data-slot":"card-title",className:r("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",a),...t})}function Ue({className:a,...t}){return d("div",{"data-slot":"card-description",className:r("text-muted-foreground text-sm",a),...t})}function Rt({className:a,...t}){return d("div",{"data-slot":"card-action",className:r("col-start-2 row-span-2 row-start-1 self-start justify-self-end",a),...t})}function Ve({className:a,...t}){return d("div",{"data-slot":"card-content",className:r("flex flex-col gap-3 px-(--card-spacing)",a),...t})}function Ke({className:a,...t}){return d("div",{"data-slot":"card-footer",className:r("flex items-center rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing)",a),...t})}export{Be,ze,$e,Ue,Rt,Ve,Ke};
@@ -1,3 +1,3 @@
1
- var Ht=["full","compact","codexUI"];function et(t){return t==="compact"||t==="codexUI"}var mt=["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"];function c(t){let o=t.split(/[/\\]/).at(-1)??"";return o===""?t:o}function d(t){let o=mt.includes(t.kind)?t.kind:"other",i=t.rawInput,e=(a)=>{let r=i[a];return typeof r==="string"&&r.length>0?r:void 0},n=t.locations?.[0]?.path??e("file_path")??e("notebook_path"),s=n!==void 0?c(n):e("command")?.split(`
2
- `)[0]??e("pattern")??e("url")??e("query")??e("description");return{category:o,...s===void 0?{}:{target:s},...n===void 0?{}:{filePath:n}}}function Ot(t,o){if(o)return"dot-permission";switch(t){case"completed":return"dot-success";case"failed":return"dot-error";case"in_progress":return"dot-in-progress";case"pending":return"dot-pending";case"interrupted":return"dot-interrupted";default:return console.warn("[acp] unknown tool call status:",t),"dot-pending"}}
3
- export{Ht,et,mt,d,Ot};
1
+ var Mt=["full","compact","codexUI"];function Re(t){return t==="compact"||t==="codexUI"}var dt=["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"];function c(t){let o=t.split(/[/\\]/).at(-1)??"";return o===""?t:o}function l(t){let o=dt.includes(t.kind)?t.kind:"other",i=t.rawInput,e=(a)=>{let r=i[a];return typeof r==="string"&&r.length>0?r:void 0},n=t.locations?.[0]?.path??e("file_path")??e("notebook_path"),s=n!==void 0?c(n):e("command")?.split(`
2
+ `)[0]??e("pattern")??e("url")??e("query")??e("description");return{category:o,...s===void 0?{}:{target:s},...n===void 0?{}:{filePath:n}}}function Nt(t,o){if(o)return"dot-permission";switch(t){case"completed":return"dot-success";case"failed":return"dot-error";case"in_progress":return"dot-in-progress";case"pending":return"dot-pending";case"interrupted":return"dot-interrupted";default:return console.warn("[acp] unknown tool call status:",t),"dot-pending"}}
3
+ export{Mt,Re,dt,l,Nt};
@@ -0,0 +1,2 @@
1
+ var t=new Map;var a=0;function Z(e,n){let r=n?void 0:t.get(e);if(r===void 0)return null;return t.delete(e),t.set(e,r),{...r,tokens:structuredClone(r.tokens)}}function c(e){if(e.isStreaming||e.text.length>1048576)return;if(t.delete(e.text))a-=e.text.length;t.set(e.text,{...e,tokens:structuredClone(e.tokens)}),a+=e.text.length;while(a>2097152||t.size>200){let n=t.keys().next().value;a-=n.length,t.delete(n)}}class l{worker=new Worker(new URL("@alwith/module-chat/markdown-parser.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(e)=>{let n=e.data,r=this.active;if(n.clientId!==r?.clientId||n.revision!==r.revision){this.fail(Error("Markdown worker returned an unexpected request"));return}if(this.active=null,!n.ok){this.fail(Error(n.error));return}let i={...r.input,tokens:n.tokens};c(i);let s=this.clients.get(r.clientId),o=this.pending.get(r.clientId),u=o!==void 0&&r.input.isStreaming&&o.input.isStreaming&&o.input.text.startsWith(r.input.text);if(s!==void 0&&(s.revision===r.revision||u))s.onResult(i);this.dispatch()},this.worker.onerror=(e)=>this.fail(Error(e.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize Markdown parsing result"))}fail(e){this.failure=e,this.worker.terminate(),this.pending.clear(),this.active=null;for(let n of this.clients.values())n.onError(e)}send(e){try{this.worker.postMessage(e)}catch(n){this.fail(n instanceof Error?n:Error(String(n)))}}dispatch(){if(this.active!==null||this.pending.size===0)return;let e=this.pending.values().next().value;this.pending.delete(e.clientId),this.active=e,this.send({type:"parse",clientId:e.clientId,revision:e.revision,source:e.input.source})}connect(e,n){if(this.failure!==null)throw this.failure;let r=++this.nextClientId,i={revision:0,onResult:e,onError:n};return this.clients.set(r,i),{update:(s)=>{if(this.failure!==null)throw this.failure;i.revision+=1;let o=Z(s.text,s.isStreaming);if(o!==null){this.pending.delete(r),i.onResult(o);return}this.pending.set(r,{clientId:r,revision:i.revision,input:s}),this.dispatch()},dispose:()=>{if(!this.clients.delete(r))return;if(this.pending.delete(r),this.clients.size===0)this.worker.terminate(),d=void 0;else if(this.failure===null)this.send({type:"dispose",clientId:r})}}}}var d;function _e(e,n){return d??=new l,d.connect(e,n)}
2
+ export{Z,_e};
@@ -1 +1 @@
1
- import{PreviewCard as i}from"@base-ui/react/preview-card";import{cn as s}from"cn";import{jsx as r}from"react/jsx-runtime";function Re({...e}){return r(i.Root,{"data-slot":"hover-card",...e})}function Le({...e}){return r(i.Trigger,{"data-slot":"hover-card-trigger",...e})}function _e({className:e,side:o="bottom",sideOffset:t=4,align:a="center",alignOffset:d=4,...n}){return r(i.Portal,{"data-slot":"hover-card-portal",children:r(i.Positioner,{align:a,alignOffset:d,side:o,sideOffset:t,className:"isolate z-50",children:r(i.Popup,{"data-slot":"hover-card-content",className:s("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 w-64 origin-(--transform-origin) rounded-lg p-4 text-sm shadow-md ring-1 outline-hidden duration-100",e),...n})})})}export{Re,Le,_e};
1
+ import{PreviewCard as i}from"@base-ui/react/preview-card";import{cn as s}from"cn";import{jsx as r}from"react/jsx-runtime";function We({...e}){return r(i.Root,{"data-slot":"hover-card",...e})}function qe({...e}){return r(i.Trigger,{"data-slot":"hover-card-trigger",...e})}function Ge({className:e,side:o="bottom",sideOffset:t=4,align:a="center",alignOffset:d=4,...n}){return r(i.Portal,{"data-slot":"hover-card-portal",children:r(i.Positioner,{align:a,alignOffset:d,side:o,sideOffset:t,className:"isolate z-50",children:r(i.Popup,{"data-slot":"hover-card-content",className:s("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 w-64 origin-(--transform-origin) rounded-lg p-4 text-sm shadow-md ring-1 outline-hidden duration-100",e),...n})})})}export{We,qe,Ge};
@@ -0,0 +1 @@
1
+ import{r}from"./chunk-bwzjm3g8.js";import{S}from"./chunk-gnthx1zg.js";import{cva as p}from"class-variance-authority";import{cn as l}from"cn";import{useMemo as u}from"react";import{jsx as t,jsxs as m}from"react/jsx-runtime";function re({className:a,...e}){return t("fieldset",{"data-slot":"field-set",className:l("flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",a),...e})}function oe({className:a,variant:e="legend",...o}){return t("legend",{"data-slot":"field-legend","data-variant":e,className:l("mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",a),...o})}function je({className:a,...e}){return t("div",{"data-slot":"field-group",className:l("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",a),...e})}var c=p("group/field data-[invalid=true]:text-destructive flex w-full gap-3",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function Qe({className:a,orientation:e="vertical",...o}){return t("div",{role:"group","data-slot":"field","data-orientation":e,className:l(c({orientation:e}),a),...o})}function _t({className:a,...e}){return t("div",{"data-slot":"field-content",className:l("group/field-content flex flex-1 flex-col gap-1 leading-snug",a),...e})}function Xe({className:a,...e}){return t(r,{"data-slot":"field-label",className:l("group/field-label peer/field-label has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10 flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 *:data-[slot=field]:p-3","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",a),...e})}function At({className:a,...e}){return t("div",{"data-slot":"field-label",className:l("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",a),...e})}function H({className:a,...e}){return t("p",{"data-slot":"field-description",className:l("text-muted-foreground text-left text-sm leading-normal font-normal group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5","last:mt-0 nth-last-2:-mt-1","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",a),...e})}function Ft({children:a,className:e,...o}){return m("div",{"data-slot":"field-separator","data-content":!!a,className:l("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",e),...o,children:[t(S,{className:"absolute inset-0 top-1/2"}),a&&t("span",{className:"bg-background text-muted-foreground relative mx-auto block w-fit px-2","data-slot":"field-separator-content",children:a})]})}function Dt({className:a,children:e,errors:o,...n}){let s=u(()=>{if(e)return e;if(!o?.length)return null;let i=[...new Map(o.map((d)=>[d?.message,d])).values()];if(i?.length==1)return i[0]?.message;return t("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:i.map((d,f)=>d?.message&&t("li",{children:d.message},f))})},[e,o]);if(!s)return null;return t("div",{role:"alert","data-slot":"field-error",className:l("text-destructive text-sm font-normal",a),...n,children:s})}export{re,oe,je,Qe,_t,Xe,At,H,Ft,Dt};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-vk39871j.js";import{d}from"./chunk-wmsdg5fb.js";import{cn as v}from"cn";import{ChevronDownIcon as g,ChevronUpIcon as b,XIcon as z}from"lucide-react";import{useEffect as B,useImperativeHandle as N,useRef as E}from"react";import{jsx as n,jsxs as k}from"react/jsx-runtime";function ue({ref:f,value:i,onChange:p,onFind:o,onClose:s,placeholder:m,autoFocusOpen:a=!0,prevTitle:l,nextTitle:c,className:h}){let r=E(null);N(f,()=>{if(r.current===null)throw Error("FindBar input is not mounted");return r.current},[]),B(()=>{if(!a)return;let t=r.current;if(t===null)throw Error("FindBar input is not mounted");t.focus(),t.select()},[a]);let u=!i;return k("div",{className:v("border-border flex h-9 shrink-0 items-center gap-1 border-b px-2",h),children:[n(d,{ref:r,value:i,onChange:(t)=>p(t.target.value),placeholder:m,className:"h-7 text-xs",onKeyDown:(t)=>{if(t.key==="Escape"){t.preventDefault(),s();return}if(t.key==="Enter"){if(t.preventDefault(),i)o(t.shiftKey)}}}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:u,onClick:()=>o(!0),title:l?`${l} (⇧↵)`:"⇧↵",children:n(b,{className:"size-3.5"})}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:u,onClick:()=>o(!1),title:c?`${c} (↵)`:"↵",children:n(g,{className:"size-3.5"})}),n(e,{size:"icon",variant:"ghost",className:"size-6",onClick:s,title:"Esc",children:n(z,{className:"size-3.5"})})]})}
2
+ export{ue};
@@ -1,2 +1,2 @@
1
- async function Qe(g,u){try{let a=await(await fetch(g)).blob(),s=u??a.type??"";if(!s.startsWith("image/"))return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(a)});let w=s.includes("svg"),n,r,o;if(w){let e=new Image,t=URL.createObjectURL(a);e.src=t;try{await new Promise((h,f)=>{e.onload=()=>h(),e.onerror=()=>f(Error("svg load failed"))})}finally{URL.revokeObjectURL(t)}r=e.naturalWidth||1024,o=e.naturalHeight||1024,n=e}else{let e=await createImageBitmap(a);r=e.width,o=e.height,n=e}let i=Math.min(1,2000/Math.max(r,o)),c=Math.round(r*i),l=Math.round(o*i),d=new OffscreenCanvas(c,l),m=d.getContext("2d");if(!m)throw Error("image-encode: OffscreenCanvas 2d context 不可用");if(m.drawImage(n,0,0,c,l),n instanceof ImageBitmap)n.close();let b=await d.convertToBlob({type:"image/webp",quality:0.85});return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(b)})}catch{return null}}
2
- export{Qe};
1
+ async function Fe(g,u){try{let a=await(await fetch(g)).blob(),s=u??a.type??"";if(!s.startsWith("image/"))return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(a)});let w=s.includes("svg"),n,r,o;if(w){let e=new Image,t=URL.createObjectURL(a);e.src=t;try{await new Promise((h,f)=>{e.onload=()=>h(),e.onerror=()=>f(Error("svg load failed"))})}finally{URL.revokeObjectURL(t)}r=e.naturalWidth||1024,o=e.naturalHeight||1024,n=e}else{let e=await createImageBitmap(a);r=e.width,o=e.height,n=e}let i=Math.min(1,2000/Math.max(r,o)),c=Math.round(r*i),l=Math.round(o*i),d=new OffscreenCanvas(c,l),m=d.getContext("2d");if(!m)throw Error("image-encode: OffscreenCanvas 2d context 不可用");if(m.drawImage(n,0,0,c,l),n instanceof ImageBitmap)n.close();let b=await d.convertToBlob({type:"image/webp",quality:0.85});return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(b)})}catch{return null}}
2
+ export{Fe};
@@ -0,0 +1,2 @@
1
+ import{Y,De}from"./chunk-c4ps9628.js";function c(t){return{key:t.name,label:t.name,description:t.description??void 0,payload:t.name}}function U(t,s,o=50){let i=new Set,r=t.filter((n)=>{if(i.has(n.name))return!1;return i.add(n.name),!0});if(!s)return r.slice(0,o).map(c);let l=s.toLowerCase(),e=[];for(let n of r){let a=Y(n.name,s);if(a)e.push({c:n,score:a.score});else if(n.description?.toLowerCase().includes(l))e.push({c:n,score:-1})}return e.sort((n,a)=>a.score-n.score),e.slice(0,o).map((n)=>c(n.c))}function ht(t,s,o,i=50){let r=o?`${o.replace(/\/$/,"")}/`:"",l=t.map((e)=>({abs:e,rel:r&&e.startsWith(r)?e.slice(r.length):e}));return De(l,s,(e)=>e.rel,i).map(({item:e})=>({key:e.abs,label:e.rel,payload:e.abs}))}
2
+ export{U,ht};
@@ -1,2 +1,2 @@
1
- var xt=280;function me({entries:i,gapPx:t,measuredHeightsByKey:o,leadingInsetPx:e=0}){let n=[],r=[],d=new Map,s=[],u=e;for(let[x,a]of i.entries()){d.set(a.turnKey,x);for(let h of a.aliases??[])d.set(h,x);s.push(a.turnKey),r.push(u);let f=a.aliases?.map((h)=>o[h]).find((h)=>h!==void 0),m=o[a.turnKey]??f??a.estimatedHeightPx??280;if(n.push(m),u+=m,x<i.length-1)u+=t}return{bottomOffsetsPx:r.map((x,a)=>{let f=n[a];if(f===void 0)throw Error(`Codex turn height is missing at index ${a}`);return u-x-f}),heightsPx:n,topOffsetsPx:r,totalHeightPx:u,turnIndexByKey:d,turnKeys:s}}function g({distanceFromBottomPx:i,layout:t,overscanCount:o,viewportHeightPx:e}){if(t.turnKeys.length===0)return{startIndex:0,endIndex:0};let n=Math.min(Math.max(0,i),t.totalHeightPx),r=Math.min(n+Math.max(0,e),t.totalHeightPx),d=l(t.bottomOffsetsPx,r),s=c(t.bottomOffsetsPx,t.heightsPx,n);return{startIndex:Math.max(0,d-o),endIndex:Math.min(t.turnKeys.length,Math.max(s,d+1)+o)}}function K({anchorKey:i,layout:t,previousRange:o}){let e=t.turnIndexByKey.get(i);if(e===void 0)return null;return{startIndex:e,endIndex:Math.min(t.turnKeys.length,e+o.endIndex-o.startIndex)}}function pe({anchorKey:i,distanceFromBottomPx:t,nextLayout:o,previousLayout:e}){let n=e.turnIndexByKey.get(i),r=o.turnIndexByKey.get(i);if(n===void 0||r===void 0)return null;let d=e.bottomOffsetsPx[n],s=e.heightsPx[n],u=o.bottomOffsetsPx[r],x=o.heightsPx[r];if(d===void 0||s===void 0||u===void 0||x===void 0)throw Error(`Codex turn geometry is missing: ${i}`);return Math.max(0,t+u+x-d-s)}function ge({layout:i,turnKey:t,viewportHeightPx:o}){let e=i.turnIndexByKey.get(t);if(e===void 0)return null;let n=i.bottomOffsetsPx[e],r=i.heightsPx[e];if(n===void 0||r===void 0)throw Error(`Codex turn geometry is missing: ${t}`);return Math.max(0,n-o/2+r/2)}function fe({align:i,layout:t,targetHeightPx:o,targetOffsetPx:e,turnKey:n,viewportHeightPx:r}){let d=t.turnIndexByKey.get(n);if(d===void 0)return null;let s=t.bottomOffsetsPx[d],u=t.heightsPx[d];if(s===void 0||u===void 0)throw Error(`Codex turn geometry is missing: ${n}`);let x=s+u-e;return i==="top"?Math.max(0,x-r+10):Math.max(0,x-o/2-r/2)}function l(i,t){let o=0,e=i.length;while(o<e){let n=Math.floor((o+e)/2),r=i[n];if(r===void 0)throw Error(`Codex bottom offset is missing at index ${n}`);if(r<t)e=n;else o=n+1}return o}function c(i,t,o){let e=0,n=i.length;while(e<n){let r=Math.floor((e+n)/2),d=i[r],s=t[r];if(d===void 0||s===void 0)throw Error(`Codex turn geometry is missing at index ${r}`);if(d+s<=o)n=r;else e=r+1}return e}
2
- export{xt,me,g,K,pe,ge,fe};
1
+ var ft=280;function fe({entries:i,gapPx:t,measuredHeightsByKey:o,leadingInsetPx:e=0}){let n=[],r=[],d=new Map,s=[],u=e;for(let[x,a]of i.entries()){d.set(a.turnKey,x);for(let h of a.aliases??[])d.set(h,x);s.push(a.turnKey),r.push(u);let f=a.aliases?.map((h)=>o[h]).find((h)=>h!==void 0),m=o[a.turnKey]??f??a.estimatedHeightPx??280;if(n.push(m),u+=m,x<i.length-1)u+=t}return{bottomOffsetsPx:r.map((x,a)=>{let f=n[a];if(f===void 0)throw Error(`Codex turn height is missing at index ${a}`);return u-x-f}),heightsPx:n,topOffsetsPx:r,totalHeightPx:u,turnIndexByKey:d,turnKeys:s}}function g({distanceFromBottomPx:i,layout:t,overscanCount:o,viewportHeightPx:e}){if(t.turnKeys.length===0)return{startIndex:0,endIndex:0};let n=Math.min(Math.max(0,i),t.totalHeightPx),r=Math.min(n+Math.max(0,e),t.totalHeightPx),d=l(t.bottomOffsetsPx,r),s=c(t.bottomOffsetsPx,t.heightsPx,n);return{startIndex:Math.max(0,d-o),endIndex:Math.min(t.turnKeys.length,Math.max(s,d+1)+o)}}function z({anchorKey:i,layout:t,previousRange:o}){let e=t.turnIndexByKey.get(i);if(e===void 0)return null;return{startIndex:e,endIndex:Math.min(t.turnKeys.length,e+o.endIndex-o.startIndex)}}function he({anchorKey:i,distanceFromBottomPx:t,nextLayout:o,previousLayout:e}){let n=e.turnIndexByKey.get(i),r=o.turnIndexByKey.get(i);if(n===void 0||r===void 0)return null;let d=e.bottomOffsetsPx[n],s=e.heightsPx[n],u=o.bottomOffsetsPx[r],x=o.heightsPx[r];if(d===void 0||s===void 0||u===void 0||x===void 0)throw Error(`Codex turn geometry is missing: ${i}`);return Math.max(0,t+u+x-d-s)}function ve({layout:i,turnKey:t,viewportHeightPx:o}){let e=i.turnIndexByKey.get(t);if(e===void 0)return null;let n=i.bottomOffsetsPx[e],r=i.heightsPx[e];if(n===void 0||r===void 0)throw Error(`Codex turn geometry is missing: ${t}`);return Math.max(0,n-o/2+r/2)}function xe({align:i,layout:t,targetHeightPx:o,targetOffsetPx:e,turnKey:n,viewportHeightPx:r}){let d=t.turnIndexByKey.get(n);if(d===void 0)return null;let s=t.bottomOffsetsPx[d],u=t.heightsPx[d];if(s===void 0||u===void 0)throw Error(`Codex turn geometry is missing: ${n}`);let x=s+u-e;return i==="top"?Math.max(0,x-r+10):Math.max(0,x-o/2-r/2)}function l(i,t){let o=0,e=i.length;while(o<e){let n=Math.floor((o+e)/2),r=i[n];if(r===void 0)throw Error(`Codex bottom offset is missing at index ${n}`);if(r<t)e=n;else o=n+1}return o}function c(i,t,o){let e=0,n=i.length;while(e<n){let r=Math.floor((e+n)/2),d=i[r],s=t[r];if(d===void 0||s===void 0)throw Error(`Codex turn geometry is missing at index ${r}`);if(d+s<=o)n=r;else e=r+1}return e}
2
+ export{ft,fe,g,z,he,ve,xe};
@@ -1 +1 @@
1
- import{mergeProps as a}from"@base-ui/react/merge-props";import{useRender as n}from"@base-ui/react/use-render";import{cva as o}from"class-variance-authority";import{cn as d}from"cn";var lt=o("group/badge focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Ae({className:r,variant:e="default",render:t,...i}){return n({defaultTagName:"span",props:a({className:d(lt({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{lt,Ae};
1
+ import{mergeProps as a}from"@base-ui/react/merge-props";import{useRender as n}from"@base-ui/react/use-render";import{cva as o}from"class-variance-authority";import{cn as d}from"cn";var lt=o("group/badge focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Se({className:r,variant:e="default",render:t,...i}){return n({defaultTagName:"span",props:a({className:d(lt({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{lt,Se};
@@ -1,2 +1,2 @@
1
- import{Ge,je}from"./chunk-kaeqvcew.js";import{cn as r}from"cn";import{jsx as t,jsxs as a}from"react/jsx-runtime";function n({value:i,onValueChange:o,options:d,itemClassName:l}){return t(Ge,{value:i,onValueChange:(e)=>o(String(e)),children:d.map((e)=>a(je,{value:e.value,disabled:e.disabled,title:e.title,closeOnClick:!0,className:r("gap-2",e.description?"items-start":"items-center",l),children:[e.icon,e.description?a("div",{className:"min-w-0 flex-1",children:[t("div",{className:"text-xs font-medium",children:e.label}),t("div",{className:"text-muted-foreground text-[11px] font-normal",children:e.description})]}):t("span",{className:"min-w-0 flex-1 truncate text-start",children:e.label})]},e.value))})}
1
+ import{He,Oe}from"./chunk-j3my6gn8.js";import{cn as r}from"cn";import{jsx as t,jsxs as a}from"react/jsx-runtime";function n({value:i,onValueChange:o,options:d,itemClassName:l}){return t(He,{value:i,onValueChange:(e)=>o(String(e)),children:d.map((e)=>a(Oe,{value:e.value,disabled:e.disabled,title:e.title,closeOnClick:!0,className:r("gap-2",e.description?"items-start":"items-center",l),children:[e.icon,e.description?a("div",{className:"min-w-0 flex-1",children:[t("div",{className:"text-xs font-medium",children:e.label}),t("div",{className:"text-muted-foreground text-[11px] font-normal",children:e.description})]}):t("span",{className:"min-w-0 flex-1 truncate text-start",children:e.label})]},e.value))})}
2
2
  export{n};
@@ -1,2 +1,2 @@
1
- import{t}from"./chunk-pqgtv07g.js";import{i}from"./chunk-rgy601b7.js";import{isContentEntry as N,isImage as w,isResourceLink as C}from"@alwith/api";import{ChevronRightIcon as S,ImageIcon as A,LoaderCircleIcon as R,RefreshCwIcon as B}from"lucide-react";import{useEffect as T,useState as x}from"react";import{jsx as r,jsxs as h}from"react/jsx-runtime";function f(e){return e.type==="tool_use"&&e.name==="view_image"&&e.status==="completed"}function E(e){let c=[];for(let[l,u]of e.content.entries()){if(!N(u))continue;let s=u.content;if(w(s))c.push({key:`${e.id}:${l}`,src:`data:${s.mimeType};base64,${s.data}`,alt:e.title??""});if(C(s))c.push({key:`${e.id}:${l}`,path:s.uri,alt:s.name})}if(c.length)return c;let o=e.rawInput;if(o!==null&&typeof o==="object"&&"path"in o&&typeof o.path==="string")return[{key:e.id,path:o.path,alt:o.path.split(/[\\/]/).at(-1)??o.path}];throw Error(`Image view ${e.id} has no image source`)}function U({images:e}){let{loadImage:c,openImageGallery:o,openImage:l,t:u}=t(),[s,y]=x({}),[I,k]=x(0),v=JSON.stringify(e);T(()=>{let a=!0,d=JSON.parse(v);y({});for(let n of d)(n.src!==void 0?Promise.resolve(n.src):n.path!==void 0&&c?c(n.path):Promise.reject(Error("Image loading is unavailable"))).then((m)=>{if(a)y((g)=>({...g,[n.key]:{src:m}}))},()=>{if(a)y((m)=>({...m,[n.key]:{error:!0}}))});return()=>{a=!1}},[v,c,I]);let b=e.flatMap((a)=>{let d=s[a.key];return d&&"src"in d?[{src:d.src,alt:a.alt}]:[]});return r("div",{className:"codex-image-thumbnails",children:e.map((a,d)=>{let n=s[a.key];if(!n)return r("div",{className:"codex-image-thumbnail",role:"status","aria-label":u("stream.codex.imageLoading"),children:r(R,{className:"motion-safe:animate-spin","aria-hidden":"true"})},a.key);if("error"in n)return r("button",{type:"button",className:"codex-image-thumbnail",title:a.alt,"aria-label":u("stream.codex.imageFailed"),onClick:()=>k((p)=>p+1),children:r(B,{"aria-hidden":"true"})},a.key);return r("button",{type:"button",className:"codex-image-thumbnail",title:a.alt,onClick:()=>{let p=e.slice(0,d).filter((m)=>{let g=s[m.key];return g&&"src"in g}).length;if(o)o(b,p);else l?.(n.src)},children:r("img",{src:n.src,alt:a.alt,draggable:!1})},a.key)})})}function ye({blocks:e}){let{t:c}=t(),o=e.flatMap(E),[l,u]=i(`image-view:${e[0].id}`,!1);return h("div",{className:"codex-activity-item",children:[h("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":l,onClick:()=>u((s)=>!s),children:[h("span",{className:"codex-activity-label",children:[r(A,{className:"codex-activity-icon","aria-hidden":"true"}),r("span",{className:"codex-activity-leading",children:c("stream.codex.viewedImages",{count:o.length})})]}),r(S,{className:l?"codex-image-chevron codex-image-chevron-open":"codex-image-chevron","aria-hidden":"true"})]}),l&&r(U,{images:o})]})}
2
- export{f,ye};
1
+ import{t}from"./chunk-sptvg9xh.js";import{i}from"./chunk-rgy601b7.js";import{isContentEntry as N,isImage as w,isResourceLink as C}from"@alwith/api";import{ChevronRightIcon as S,ImageIcon as A,LoaderCircleIcon as R,RefreshCwIcon as B}from"lucide-react";import{useEffect as T,useState as x}from"react";import{jsx as r,jsxs as h}from"react/jsx-runtime";function p(e){return e.type==="tool_use"&&e.name==="view_image"&&e.status==="completed"}function E(e){let c=[];for(let[l,u]of e.content.entries()){if(!N(u))continue;let s=u.content;if(w(s))c.push({key:`${e.id}:${l}`,src:`data:${s.mimeType};base64,${s.data}`,alt:e.title??""});if(C(s))c.push({key:`${e.id}:${l}`,path:s.uri,alt:s.name})}if(c.length)return c;let o=e.rawInput;if(o!==null&&typeof o==="object"&&"path"in o&&typeof o.path==="string")return[{key:e.id,path:o.path,alt:o.path.split(/[\\/]/).at(-1)??o.path}];throw Error(`Image view ${e.id} has no image source`)}function U({images:e}){let{loadImage:c,openImageGallery:o,openImage:l,t:u}=t(),[s,f]=x({}),[I,k]=x(0),v=JSON.stringify(e);T(()=>{let a=!0,d=JSON.parse(v);f({});for(let n of d)(n.src!==void 0?Promise.resolve(n.src):n.path!==void 0&&c?c(n.path):Promise.reject(Error("Image loading is unavailable"))).then((m)=>{if(a)f((y)=>({...y,[n.key]:{src:m}}))},()=>{if(a)f((m)=>({...m,[n.key]:{error:!0}}))});return()=>{a=!1}},[v,c,I]);let b=e.flatMap((a)=>{let d=s[a.key];return d&&"src"in d?[{src:d.src,alt:a.alt}]:[]});return r("div",{className:"codex-image-thumbnails",children:e.map((a,d)=>{let n=s[a.key];if(!n)return r("div",{className:"codex-image-thumbnail",role:"status","aria-label":u("stream.codex.imageLoading"),children:r(R,{className:"motion-safe:animate-spin","aria-hidden":"true"})},a.key);if("error"in n)return r("button",{type:"button",className:"codex-image-thumbnail",title:a.alt,"aria-label":u("stream.codex.imageFailed"),onClick:()=>k((g)=>g+1),children:r(B,{"aria-hidden":"true"})},a.key);return r("button",{type:"button",className:"codex-image-thumbnail",title:a.alt,onClick:()=>{let g=e.slice(0,d).filter((m)=>{let y=s[m.key];return y&&"src"in y}).length;if(o)o(b,g);else l?.(n.src)},children:r("img",{src:n.src,alt:a.alt,draggable:!1})},a.key)})})}function pe({blocks:e}){let{t:c}=t(),o=e.flatMap(E),[l,u]=i(`image-view:${e[0].id}`,!1);return h("div",{className:"codex-activity-item",children:[h("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":l,onClick:()=>u((s)=>!s),children:[h("span",{className:"codex-activity-label",children:[r(A,{className:"codex-activity-icon","aria-hidden":"true"}),r("span",{className:"codex-activity-leading",children:c("stream.codex.viewedImages",{count:o.length})})]}),r(S,{className:l?"codex-image-chevron codex-image-chevron-open":"codex-image-chevron","aria-hidden":"true"})]}),l&&r(U,{images:o})]})}
2
+ export{p,pe};
@@ -1,3 +1,3 @@
1
- import{t}from"./chunk-pqgtv07g.js";import{ChevronDownIcon as v,ChevronUpIcon as b,FileDiffIcon as C}from"lucide-react";import{useState as m}from"react";import{jsx as d,jsxs as o}from"react/jsx-runtime";function x(e){if(e===null||e.length===0)return 0;return e.split(`
2
- `).length}function at(e){let l=new Map;for(let u of e)for(let a of u.content){if(a.type!=="diff")continue;let f=a,r=f._meta?.alwith?.hunks??[],h=r.reduce((i,s)=>i+x(s.newText),0),c=r.reduce((i,s)=>i+x(s.oldText),0);for(let i of f.changes){let s=l.get(i.path);if(s)s.additions+=h,s.deletions+=c;else l.set(i.path,{path:i.path,additions:h,deletions:c})}}return[...l.values()]}function he({blocks:e}){return d(st,{files:at(e)})}function st({files:e,onOpen:l,renderPath:u}){let{t:a,openLink:f}=t(),[r,h]=m(!0),[c,i]=m(!1);if(e.length===0)return null;let s=e.reduce((n,p)=>n+p.additions,0),g=e.reduce((n,p)=>n+p.deletions,0);return o("section",{className:"codex-edited-files-card",children:[o("div",{className:"codex-edited-files-header",children:[d("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:d(C,{})}),o("div",{className:"codex-edited-files-summary",children:[d("strong",{children:a("stream.codex.editedFilesCount",{count:e.length})}),d("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((n)=>!n),i(!1)},"aria-expanded":r,children:a(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),o("div",{className:"codex-edited-files-total",title:a("stream.codex.changedLines"),children:[o("span",{className:"codex-diff-additions",children:["+",s]}),o("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&o("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((n)=>o("div",{className:"codex-edited-file-row",children:[d("button",{type:"button",className:"codex-edited-file-path",title:n.path,onClick:()=>l===void 0?f(n.path):l(n),children:u===void 0?n.path:u(n)}),o("span",{className:"codex-edited-file-counts",children:[o("span",{className:"codex-diff-additions",children:["+",n.additions]}),o("span",{className:"codex-diff-deletions",children:["-",n.deletions]})]})]},n.path)),e.length>3&&o("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>i((n)=>!n),children:[a(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?d(b,{size:16,"aria-hidden":"true"}):d(v,{size:16,"aria-hidden":"true"})]})]})]})}
3
- export{at,he,st};
1
+ import{t}from"./chunk-sptvg9xh.js";import{ChevronDownIcon as v,ChevronUpIcon as b,FileDiffIcon as C}from"lucide-react";import{useState as m}from"react";import{jsx as d,jsxs as o}from"react/jsx-runtime";function x(e){if(e===null||e.length===0)return 0;return e.split(`
2
+ `).length}function ot(e){let l=new Map;for(let u of e)for(let a of u.content){if(a.type!=="diff")continue;let f=a,r=f._meta?.alwith?.hunks??[],h=r.reduce((i,s)=>i+x(s.newText),0),c=r.reduce((i,s)=>i+x(s.oldText),0);for(let i of f.changes){let s=l.get(i.path);if(s)s.additions+=h,s.deletions+=c;else l.set(i.path,{path:i.path,additions:h,deletions:c})}}return[...l.values()]}function le({blocks:e}){return d(it,{files:ot(e)})}function it({files:e,onOpen:l,renderPath:u}){let{t:a,openLink:f}=t(),[r,h]=m(!0),[c,i]=m(!1);if(e.length===0)return null;let s=e.reduce((n,p)=>n+p.additions,0),g=e.reduce((n,p)=>n+p.deletions,0);return o("section",{className:"codex-edited-files-card",children:[o("div",{className:"codex-edited-files-header",children:[d("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:d(C,{})}),o("div",{className:"codex-edited-files-summary",children:[d("strong",{children:a("stream.codex.editedFilesCount",{count:e.length})}),d("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((n)=>!n),i(!1)},"aria-expanded":r,children:a(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),o("div",{className:"codex-edited-files-total",title:a("stream.codex.changedLines"),children:[o("span",{className:"codex-diff-additions",children:["+",s]}),o("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&o("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((n)=>o("div",{className:"codex-edited-file-row",children:[d("button",{type:"button",className:"codex-edited-file-path",title:n.path,onClick:()=>l===void 0?f(n.path):l(n),children:u===void 0?n.path:u(n)}),o("span",{className:"codex-edited-file-counts",children:[o("span",{className:"codex-diff-additions",children:["+",n.additions]}),o("span",{className:"codex-diff-deletions",children:["-",n.deletions]})]})]},n.path)),e.length>3&&o("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>i((n)=>!n),children:[a(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?d(b,{size:16,"aria-hidden":"true"}):d(v,{size:16,"aria-hidden":"true"})]})]})]})}
3
+ export{ot,le,it};
@@ -0,0 +1,2 @@
1
+ function*O(n,e){if(e.length===0)return;let r=new RegExp(e.replaceAll(/[.*+?^{}()|[\]\\$]/g,String.raw`\$&`),"giu");for(let t of n.matchAll(r))yield{start:t.index,end:t.index+t[0].length}}function pt(n,e){if(e.length===0)return[];let r=[];for(let{turnKey:t,segments:o}of n){let c=0;for(let s of o)for(let a of O(s,e))r.push({turnKey:t,occurrenceInTurn:c}),c+=1}return r}
2
+ export{O,pt};
@@ -1,4 +1,4 @@
1
- function ce(t,e){if(e===0)return null;let r=e-1;while(r>=0){let n=t[r];if(n===" "||n==="\t"||n===`
1
+ function be(t,e){if(e===0)return null;let r=e-1;while(r>=0){let n=t[r];if(n===" "||n==="\t"||n===`
2
2
  `)return null;if(n==="@"||n==="/"){let i=r===0?"":t[r-1],s=r===0||i===`
3
3
  `;if(n==="/"?s&&!/[/\\]/.test(t.slice(r+1,e)):s||i===" "||i==="\t")return{kind:n==="/"?"slash":"at",start:r,end:e,query:t.slice(r+1,e)}}r-=1}return null}
4
- export{ce};
4
+ export{be};
@@ -1,2 +1,2 @@
1
- import{G}from"./chunk-gfj69sqc.js";function F(d,f){if(!f)return[];let h=[],s="",n=[],a=()=>{let t=0,e=0;for(let{start:r,end:o}of G(s,f)){while(t<n.length&&n[t].end<=r)t++;e=Math.max(e,t);while(e<n.length&&n[e].end<o)e++;let l=n[t],c=n[e];if(!l||!c)throw Error("Search text offset has no DOM node");let i=document.createRange();i.setStart(l.node,r-l.start),i.setEnd(c.node,o-c.start),h.push(i)}s="",n=[]},u=new Set(["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DIV","DL","DT","DD","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","TABLE","TD","TH","TR","UL"]),E=(t)=>{if(t.nodeType===Node.TEXT_NODE){let r=t.parentElement;if(!r||r.offsetParent===null&&r.tagName!=="BODY")return;let o=t.nodeValue??"";n.push({node:t,start:s.length,end:s.length+o.length}),s+=o;return}if(!(t instanceof Element))return;if(t.matches("script, style, [hidden], [aria-hidden='true']")){a();return}if(t.tagName==="BR"){a();return}let e=u.has(t.tagName);if(e)a();for(let r of t.childNodes)E(r);if(e)a()};return E(d),a(),h}
2
- export{F};
1
+ import{O}from"./chunk-7xdvwjxh.js";function _(d,f){if(!f)return[];let h=[],s="",n=[],a=()=>{let t=0,e=0;for(let{start:r,end:o}of O(s,f)){while(t<n.length&&n[t].end<=r)t++;e=Math.max(e,t);while(e<n.length&&n[e].end<o)e++;let l=n[t],c=n[e];if(!l||!c)throw Error("Search text offset has no DOM node");let i=document.createRange();i.setStart(l.node,r-l.start),i.setEnd(c.node,o-c.start),h.push(i)}s="",n=[]},u=new Set(["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DIV","DL","DT","DD","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","TABLE","TD","TH","TR","UL"]),E=(t)=>{if(t.nodeType===Node.TEXT_NODE){let r=t.parentElement;if(!r||r.offsetParent===null&&r.tagName!=="BODY")return;let o=t.nodeValue??"";n.push({node:t,start:s.length,end:s.length+o.length}),s+=o;return}if(!(t instanceof Element))return;if(t.matches("script, style, [hidden], [aria-hidden='true']")){a();return}if(t.tagName==="BR"){a();return}let e=u.has(t.tagName);if(e)a();for(let r of t.childNodes)E(r);if(e)a()};return E(d),a(),h}
2
+ export{_};
@@ -0,0 +1 @@
1
+ import{Tooltip as i}from"@base-ui/react/tooltip";import{cn as l}from"cn";import{jsx as o,jsxs as p}from"react/jsx-runtime";function Lt({delay:t=0,...e}){return o(i.Provider,{"data-slot":"tooltip-provider",delay:t,...e})}function ee({...t}){return o(i.Root,{"data-slot":"tooltip",...t})}function te({...t}){return o(i.Trigger,{"data-slot":"tooltip-trigger",...t})}function ne({className:t,side:e="top",sideOffset:a=4,align:d="center",alignOffset:r=0,children:n,...s}){return o(i.Portal,{children:o(i.Positioner,{align:d,alignOffset:r,side:e,sideOffset:a,className:"isolate z-50",children:p(i.Popup,{"data-slot":"tooltip-content",className:l("bg-foreground text-background data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md px-3 py-1.5 text-xs has-data-[slot=kbd]:pr-1.5 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm",t),...s,children:[n,o(i.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}export{Lt,ee,te,ne};
@@ -1,2 +1,2 @@
1
- import{Marked as p}from"marked";import k from"marked-linkify-it";var h=/<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>/,m=/^<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/,d=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])/,x={extensions:[{name:"math",level:"block",tokenizer(n){let t=d.exec(n);if(t===null)return;return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0}}},{name:"math",level:"inline",start(n){return n.search(/\$|\\[([]/)},tokenizer(n){let t=d.exec(n);if(t!==null)return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0};let r=/^\\\(([^\n]+?)\\\)/.exec(n);if(r!==null)return{type:"math",raw:r[0],text:r[1].trim(),display:!1};let i=/^\$(?!\$)((?:\\[^\n]|[^\\$\n])+?)\$(?![\d$])/.exec(n);if(i===null||/^\s|\s$/.test(i[1]))return;return{type:"math",raw:i[0],text:i[1],display:!1}}}]};function Be(){let n=new p({gfm:!0}),t=k(),r=t.extensions[0],i=r.tokenizer;r.tokenizer=function(o,a){let e=i.call(this,o,a);if(e===void 0)return;if(e.raw.startsWith("<"))return e;let l=/^(?:[a-z][a-z\d+.-]*:\/\/|www\.)[^/?#]+[/?#]/i.exec(e.raw);if(l===null)return e;let c=l[0].length-1,u=e.raw.slice(c).search(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u);if(u===-1)return e;let s=e.raw.slice(0,c+u),f=e.href.slice(0,e.href.length-(e.raw.length-s.length));return{...e,raw:s,href:f,text:s,tokens:[{type:"text",raw:s,text:s}]}},n.use(x,t);for(let o of["block","inline"])n.use({extensions:[{name:"internalMessage",level:o,...o==="inline"?{start(a){return h.exec(a)?.index}}:{},tokenizer(a){let e=m.exec(a);if(e===null)return;return{type:"internalMessage",raw:e[0]}},renderer(){return""}}]});return n}function ne(n){let t=n.replaceAll(/[\p{Cc}\s]/gu,"");return!/^(?:data|javascript|vbscript):/i.test(t)}
2
- export{Be,ne};
1
+ import{Marked as p}from"marked";import k from"marked-linkify-it";var h=/<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>/,m=/^<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/,d=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])/,x={extensions:[{name:"math",level:"block",tokenizer(n){let t=d.exec(n);if(t===null)return;return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0}}},{name:"math",level:"inline",start(n){return n.search(/\$|\\[([]/)},tokenizer(n){let t=d.exec(n);if(t!==null)return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0};let r=/^\\\(([^\n]+?)\\\)/.exec(n);if(r!==null)return{type:"math",raw:r[0],text:r[1].trim(),display:!1};let i=/^\$(?!\$)((?:\\[^\n]|[^\\$\n])+?)\$(?![\d$])/.exec(n);if(i===null||/^\s|\s$/.test(i[1]))return;return{type:"math",raw:i[0],text:i[1],display:!1}}}]};function Le(){let n=new p({gfm:!0}),t=k(),r=t.extensions[0],i=r.tokenizer;r.tokenizer=function(o,a){let e=i.call(this,o,a);if(e===void 0)return;if(e.raw.startsWith("<"))return e;let l=/^(?:[a-z][a-z\d+.-]*:\/\/|www\.)[^/?#]+[/?#]/i.exec(e.raw);if(l===null)return e;let c=l[0].length-1,u=e.raw.slice(c).search(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u);if(u===-1)return e;let s=e.raw.slice(0,c+u),f=e.href.slice(0,e.href.length-(e.raw.length-s.length));return{...e,raw:s,href:f,text:s,tokens:[{type:"text",raw:s,text:s}]}},n.use(x,t);for(let o of["block","inline"])n.use({extensions:[{name:"internalMessage",level:o,...o==="inline"?{start(a){return h.exec(a)?.index}}:{},tokenizer(a){let e=m.exec(a);if(e===null)return;return{type:"internalMessage",raw:e[0]}},renderer(){return""}}]});return n}function X(n){let t=n.replaceAll(/[\p{Cc}\s]/gu,"");return!/^(?:data|javascript|vbscript):/i.test(t)}
2
+ export{Le,X};
@@ -0,0 +1,2 @@
1
+ var Ct=1e6,Tt=5000000;function Ne(_,e){return _+e>5000000}function Pt(_){return(_/1e6).toFixed(1)}var Q=5;
2
+ export{Ct,Tt,Ne,Pt,Q};
@@ -0,0 +1,2 @@
1
+ var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function Y(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function De(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=Y(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
2
+ export{Y,De};
@@ -0,0 +1,2 @@
1
+ function at(t,e){if(t.type||!e.type)return t;let o=e.type.split("/")[1],i=o!==void 0&&o!==""?`pasted-${Date.now()}.${o==="jpeg"?"jpg":o}`:"";return new File([t],t.name||i||`pasted-${Date.now()}`,{type:e.type})}function Te(t){let e=[],o=!1;for(let i of t){if(i.kind!=="file")continue;let n=i.getAsFile();if(!n)continue;if(!(n.type||i.type).startsWith("image/")){o=!0;continue}e.push(at(n,i))}return{imageFiles:e,sawNonImageFile:o}}function Pe(t){return[...t].some((e)=>e.kind==="string")}function s(t){let e=t.codePointAt(0);return e<32&&e!==9&&e!==10&&e!==13||e===127}function st(t){return[...t].filter((e)=>!s(e)).join("")}function rt(t,e){let o=0;for(let i=0;i<e;i++){let n=t.charCodeAt(i);if(n>=0&&n<=8||n===11||n===12||n>=14&&n<=31||n===127)o++}return o}function F(t){let{value:e,selectionStart:o,selectionEnd:i}=t,n=st(e);if(n===e)return n;if(t.value=n,o!==null&&i!==null){let a=Math.max(0,o-rt(e,o)),r=Math.max(0,i-rt(e,i));requestAnimationFrame(()=>{t.setSelectionRange(a,r)})}return n}
2
+ export{at,Te,Pe,st,rt,F};
@@ -0,0 +1,2 @@
1
+ var nt={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function ke(e){return[...e].toSorted((o,n)=>(nt[o.kind]??99)-(nt[n.kind]??99))}function wt(e){return e==="allow_once"||e==="allow_always"}function kt(e){return e==="allow_always"||e==="reject_always"}
2
+ export{nt,ke,wt,kt};
@@ -1 +1 @@
1
- import{Checkbox as i}from"@base-ui/react/checkbox";import{cn as o}from"cn";import{CheckIcon as t}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function v({className:r,...a}){return e(i.Root,{"data-slot":"checkbox",className:o("peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:e(i.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e(t,{})})})}export{v};
1
+ import{Checkbox as i}from"@base-ui/react/checkbox";import{cn as o}from"cn";import{CheckIcon as t}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function w({className:r,...a}){return e(i.Root,{"data-slot":"checkbox",className:o("peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:e(i.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e(t,{})})})}export{w};
@@ -1,2 +1,2 @@
1
- class s{worker=new Worker(new URL("@alwith/module-chat/code-highlighter.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(i)=>{let e=this.active,t=i.data;if(t.clientId!==e?.clientId||t.revision!==e.revision){this.fail(Error("Code highlighting worker returned an unexpected request"));return}if(this.active=null,!t.ok){this.fail(Error(t.error));return}let r=this.clients.get(e.clientId);if(r?.revision===e.revision)r.onResult({code:e.code,language:e.language,html:t.html});this.dispatch()},this.worker.onerror=(i)=>this.fail(Error(i.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize code highlighting result"))}fail(i){this.failure=i,this.worker.terminate(),this.pending.clear(),this.active=null;for(let e of this.clients.values())e.onError(i)}dispatch(){if(this.active!==null||this.pending.size===0)return;let i=this.pending.values().next().value;this.pending.delete(i.clientId),this.active=i;try{this.worker.postMessage(i)}catch(e){this.fail(e instanceof Error?e:Error(String(e)))}}connect(i,e){if(this.failure!==null)throw this.failure;let t=++this.nextClientId,r={revision:0,onResult:i,onError:e};return this.clients.set(t,r),{update:(o,l)=>{if(this.failure!==null)throw this.failure;r.revision+=1,this.pending.set(t,{clientId:t,revision:r.revision,code:o,language:l}),this.dispatch()},dispose:()=>{if(this.clients.delete(t),this.pending.delete(t),this.clients.size===0)this.worker.terminate(),n=void 0}}}}var n;function tt(i,e){return n??=new s,n.connect(i,e)}
2
- export{tt};
1
+ class s{worker=new Worker(new URL("@alwith/module-chat/code-highlighter.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(i)=>{let e=this.active,t=i.data;if(t.clientId!==e?.clientId||t.revision!==e.revision){this.fail(Error("Code highlighting worker returned an unexpected request"));return}if(this.active=null,!t.ok){this.fail(Error(t.error));return}let r=this.clients.get(e.clientId);if(r?.revision===e.revision)r.onResult({code:e.code,language:e.language,html:t.html});this.dispatch()},this.worker.onerror=(i)=>this.fail(Error(i.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize code highlighting result"))}fail(i){this.failure=i,this.worker.terminate(),this.pending.clear(),this.active=null;for(let e of this.clients.values())e.onError(i)}dispatch(){if(this.active!==null||this.pending.size===0)return;let i=this.pending.values().next().value;this.pending.delete(i.clientId),this.active=i;try{this.worker.postMessage(i)}catch(e){this.fail(e instanceof Error?e:Error(String(e)))}}connect(i,e){if(this.failure!==null)throw this.failure;let t=++this.nextClientId,r={revision:0,onResult:i,onError:e};return this.clients.set(t,r),{update:(o,l)=>{if(this.failure!==null)throw this.failure;r.revision+=1,this.pending.set(t,{clientId:t,revision:r.revision,code:o,language:l}),this.dispatch()},dispose:()=>{if(this.clients.delete(t),this.pending.delete(t),this.clients.size===0)this.worker.terminate(),n=void 0}}}}var n;function Me(i,e){return n??=new s,n.connect(i,e)}
2
+ export{Me};
@@ -1,2 +1,2 @@
1
- import{createPortal as n}from"react-dom";import{jsx as t}from"react/jsx-runtime";function we({src:o,alt:e,onClose:i}){return n(t("button",{type:"button",className:"fixed inset-0 z-[1000] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.7)"},onClick:i,children:t("img",{src:o,alt:e,style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:4}})}),document.body)}
2
- export{we};
1
+ import{createPortal as n}from"react-dom";import{jsx as t}from"react/jsx-runtime";function ge({src:o,alt:e,onClose:i}){return n(t("button",{type:"button",className:"fixed inset-0 z-[1000] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.7)"},onClick:i,children:t("img",{src:o,alt:e,style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:4}})}),document.body)}
2
+ export{ge};
@@ -0,0 +1,2 @@
1
+ import{createContext as d,useCallback as n,useContext as i,useEffect as et,useMemo as G,useRef as g,useState as J}from"react";import{jsx as N}from"react/jsx-runtime";var A=d(null),K=d(null);function vt(){return i(K)}var W=d(null);function xt(){return i(W)}var C=d(null);function ye(){let r=i(A);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var T=()=>i(A);function bt(){let r=i(C);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var nt=()=>i(C);function yt({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:R,attachmentPolicy:P,value:y,onValueChange:U,attachments:L,onAttachmentsChange:S,children:Q}){let j=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),w=y!==void 0,[V,X]=J(r),p=y??V,o=g({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let O=n(()=>o.current.revision,[]),x=n((t)=>{if(o.current.value=t,o.current.revision++,w)U?.(t);else X(t)},[w,U]),h=n(()=>x(""),[x]),v=L!==void 0,[Y,Z]=J([]),I=L??Y,b=g(I);b.current=I;let s=n((t)=>{let e=typeof t==="function"?t(b.current):t;if(v)S?.(e);else Z(e)},[v,S]),M=g(null),E=g(()=>{}),k=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=P===void 0?e:P.uniqueFiles(e,a);return[...a,...m.map((u)=>{let B=P?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:j(u),filename:u.name,size:u.size,lastModified:u.lastModified,...B===void 0?{}:{sourcePath:B}}})]})},[P,j,s]),H=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),R?.()},[R,s]),_=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);et(()=>{if(v)return;return()=>{for(let t of b.current)if(t.url)URL.revokeObjectURL(t.url)}},[v]);let z=n(()=>{E.current?.()},[]),F=G(()=>({files:I,add:k,remove:H,clear:_,openFileDialog:z,fileInputRef:M}),[I,k,H,_,z]),D=n((t,e)=>{M.current=t.current,E.current=e},[]),tt=G(()=>({textInput:{value:p,setInput:x,clear:h,getRevision:O,clearSubmitted:c??h},attachments:F,__registerFileInput:D}),[p,x,h,O,c,F,D]);return N(A.Provider,{value:tt,children:N(C.Provider,{value:F,children:Q})})}var q=d(null);function f(){let r=nt(),l=i(q),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
2
+ export{K,vt,W,xt,C,ye,T,bt,yt,q,f};
@@ -1,2 +1,2 @@
1
- import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function O({name:p,value:P,levels:h,disabled:c,onChange:v}){if(h.length===0)throw Error("EffortSlider requires at least one level");let o=h,g=Math.max(0,o.findIndex((t)=>t.value===P)),[M,d]=k(null),l=y(null),[I,b]=k(null),x=y(0),s=M??I??g,w=(t)=>{let n=++x.current;b(t);let e=()=>{if(x.current===n)b(null)};try{Promise.resolve(v(o[t].value)).then(e,e)}catch(N){throw e(),N}},f=76,r=14,a=2,i=o.length,C=a+s/Math.max(1,i-1)*(f-r-a*2);return u("div",{className:S("flex items-center justify-between px-2 py-2.5",c&&"opacity-50"),children:[u("span",{className:"grid shrink-0 text-sm whitespace-nowrap",children:[o.map((t)=>u("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:[p," ",u("span",{style:{fontSize:12},children:["(",t.name,")"]})]},t.value)),u("span",{className:"col-start-1 row-start-1",children:[p," ",u("span",{"data-effort-value":"",style:{fontSize:12},children:["(",o[s].name,")"]})]})]}),u("button",{type:"button",disabled:c,role:"slider","aria-label":p,"aria-valuemin":0,"aria-valuemax":i-1,"aria-valuenow":s,"aria-valuetext":o[s].name,onKeyDown:(t)=>{let n;if(t.key==="ArrowRight"||t.key==="ArrowUp")n=Math.min(i-1,s+1);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")n=Math.max(0,s-1);else if(t.key==="Home")n=0;else if(t.key==="End")n=i-1;else return;if(t.preventDefault(),t.stopPropagation(),!c&&n!==s)w(n)},className:"relative shrink-0 cursor-pointer touch-none overflow-hidden rounded-full border-none p-0 disabled:cursor-default",style:{width:f,height:18,background:"var(--input)"},onPointerDown:(t)=>{if(c||t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerMove:(t)=>{if(l.current===null)return;let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerUp:(t)=>{let n=l.current;if(l.current=null,d(null),t.currentTarget.hasPointerCapture(t.pointerId))t.currentTarget.releasePointerCapture(t.pointerId);if(!c&&n!==null&&n!==g)w(n)},onLostPointerCapture:()=>{l.current=null,d(null)},onPointerCancel:()=>{l.current=null,d(null)},onClick:(t)=>{t.preventDefault(),t.stopPropagation()},children:[m("span",{className:"absolute inset-y-0 left-0 w-full rounded-full",style:{background:"var(--input)"}}),o.map((t,n)=>{let e=a+r/2+n/Math.max(1,i-1)*(f-r-a*2)-2;return m("span",{className:"absolute top-1/2 size-1 -translate-y-1/2 rounded-full",style:{left:e,background:"color-mix(in srgb, var(--muted-foreground) 40%, transparent)"}},t.value)}),m("span",{className:"absolute rounded-full transition-all duration-150",style:{width:r,height:r,top:a,left:C,background:"var(--foreground)",boxShadow:"0 1px 2px #0003"}})]})]})}
2
- export{O};
1
+ import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function V({name:p,value:P,levels:h,disabled:c,onChange:v}){if(h.length===0)throw Error("EffortSlider requires at least one level");let o=h,g=Math.max(0,o.findIndex((t)=>t.value===P)),[M,d]=k(null),l=y(null),[I,b]=k(null),x=y(0),s=M??I??g,w=(t)=>{let n=++x.current;b(t);let e=()=>{if(x.current===n)b(null)};try{Promise.resolve(v(o[t].value)).then(e,e)}catch(N){throw e(),N}},f=76,r=14,a=2,i=o.length,C=a+s/Math.max(1,i-1)*(f-r-a*2);return u("div",{className:S("flex items-center justify-between px-2 py-2.5",c&&"opacity-50"),children:[u("span",{className:"grid shrink-0 text-sm whitespace-nowrap",children:[o.map((t)=>u("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:[p," ",u("span",{style:{fontSize:12},children:["(",t.name,")"]})]},t.value)),u("span",{className:"col-start-1 row-start-1",children:[p," ",u("span",{"data-effort-value":"",style:{fontSize:12},children:["(",o[s].name,")"]})]})]}),u("button",{type:"button",disabled:c,role:"slider","aria-label":p,"aria-valuemin":0,"aria-valuemax":i-1,"aria-valuenow":s,"aria-valuetext":o[s].name,onKeyDown:(t)=>{let n;if(t.key==="ArrowRight"||t.key==="ArrowUp")n=Math.min(i-1,s+1);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")n=Math.max(0,s-1);else if(t.key==="Home")n=0;else if(t.key==="End")n=i-1;else return;if(t.preventDefault(),t.stopPropagation(),!c&&n!==s)w(n)},className:"relative shrink-0 cursor-pointer touch-none overflow-hidden rounded-full border-none p-0 disabled:cursor-default",style:{width:f,height:18,background:"var(--input)"},onPointerDown:(t)=>{if(c||t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerMove:(t)=>{if(l.current===null)return;let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerUp:(t)=>{let n=l.current;if(l.current=null,d(null),t.currentTarget.hasPointerCapture(t.pointerId))t.currentTarget.releasePointerCapture(t.pointerId);if(!c&&n!==null&&n!==g)w(n)},onLostPointerCapture:()=>{l.current=null,d(null)},onPointerCancel:()=>{l.current=null,d(null)},onClick:(t)=>{t.preventDefault(),t.stopPropagation()},children:[m("span",{className:"absolute inset-y-0 left-0 w-full rounded-full",style:{background:"var(--input)"}}),o.map((t,n)=>{let e=a+r/2+n/Math.max(1,i-1)*(f-r-a*2)-2;return m("span",{className:"absolute top-1/2 size-1 -translate-y-1/2 rounded-full",style:{left:e,background:"color-mix(in srgb, var(--muted-foreground) 40%, transparent)"}},t.value)}),m("span",{className:"absolute rounded-full transition-all duration-150",style:{width:r,height:r,top:a,left:C,background:"var(--foreground)",boxShadow:"0 1px 2px #0003"}})]})]})}
2
+ export{V};
@@ -1 +1 @@
1
- import{e}from"./chunk-wjejhpgw.js";import{cva as i}from"class-variance-authority";import{cn as r}from"cn";import{jsx as o}from"react/jsx-runtime";function Oe({className:a,...t}){return o("div",{"data-slot":"input-group",role:"group",className:r("group/input-group border-input has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 relative flex h-9 w-full min-w-0 items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...t})}var p=i("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function J({className:a,align:t="inline-start",...s}){return o("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:r(p({align:t}),a),onClick:(n)=>{if(n.target.closest("button"))return;n.currentTarget.parentElement?.querySelector("input")?.focus()},...s})}var l=i("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function ee({className:a,type:t="button",variant:s="ghost",size:n="xs",...u}){return o(e,{type:t,"data-size":n,variant:s,className:r(l({size:n}),a),...u})}function Et({className:a,...t}){return o("span",{className:r("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",a),...t})}export{Oe,J,ee,Et};
1
+ import{e}from"./chunk-vk39871j.js";import{cva as i}from"class-variance-authority";import{cn as r}from"cn";import{jsx as o}from"react/jsx-runtime";function tt({className:a,...t}){return o("div",{"data-slot":"input-group",role:"group",className:r("group/input-group border-input has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 relative flex h-9 w-full min-w-0 items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...t})}var p=i("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function ie({className:a,align:t="inline-start",...s}){return o("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:r(p({align:t}),a),onClick:(n)=>{if(n.target.closest("button"))return;n.currentTarget.parentElement?.querySelector("input")?.focus()},...s})}var l=i("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function ae({className:a,type:t="button",variant:s="ghost",size:n="xs",...u}){return o(e,{type:t,"data-size":n,variant:s,className:r(l({size:n}),a),...u})}function Ot({className:a,...t}){return o("span",{className:r("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",a),...t})}export{tt,ie,ae,Ot};
@@ -1,2 +1,2 @@
1
- import{et}from"./chunk-y2xbq7rb.js";function ze(t,o){if(et(o))return y(t);return t.map((e)=>({kind:"block",block:e}))}function i(t){return t.type==="thinking"||t.type==="tool_use"||t.type==="subagent"||t.type==="collab"}function c(t){return t.type==="tool_use"&&t.kind!=="think"}function y(t){let o=[],e=[],r=()=>{if(e.length===0)return;o.push({kind:"codexActivityGroup",blocks:e}),e=[]};for(let n of t){if(i(n)&&c(n)){e.push(n);continue}if(r(),i(n)){o.push({kind:"codexActivityGroup",blocks:[n]});continue}o.push({kind:"block",block:n})}return r(),o}
2
- export{ze};
1
+ import{Re}from"./chunk-2v9kbth7.js";function Ee(t,o){if(Re(o))return y(t);return t.map((e)=>({kind:"block",block:e}))}function i(t){return t.type==="thinking"||t.type==="tool_use"||t.type==="subagent"||t.type==="collab"}function c(t){return t.type==="tool_use"&&t.kind!=="think"}function y(t){let o=[],e=[],r=()=>{if(e.length===0)return;o.push({kind:"codexActivityGroup",blocks:e}),e=[]};for(let n of t){if(i(n)&&c(n)){e.push(n);continue}if(r(),i(n)){o.push({kind:"codexActivityGroup",blocks:[n]});continue}o.push({kind:"block",block:n})}return r(),o}
2
+ export{Ee};
@@ -1 +1 @@
1
- import{Separator as o}from"@base-ui/react/separator";import{cn as i}from"cn";import{jsx as e}from"react/jsx-runtime";function P({className:a,orientation:r="horizontal",...t}){return e(o,{"data-slot":"separator",orientation:r,className:i("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...t})}export{P};
1
+ import{Separator as o}from"@base-ui/react/separator";import{cn as i}from"cn";import{jsx as e}from"react/jsx-runtime";function S({className:a,orientation:r="horizontal",...t}){return e(o,{"data-slot":"separator",orientation:r,className:i("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...t})}export{S};
@@ -1,2 +1,2 @@
1
- import{CheckCircleIcon as c,CircleIcon as o,LoaderIcon as i}from"lucide-react";import{jsx as n,jsxs as e}from"react/jsx-runtime";function T({entries:s}){let d=s.filter((a)=>a.status==="completed").length,t=s.find((a)=>a.status==="in_progress");return e("div",{className:"codex-plan",children:[e("div",{className:"codex-plan-summary",children:[e("span",{children:[d,"/",s.length]}),t!==void 0&&e("span",{className:"codex-plan-active",children:["· ",t.content]})]}),n("div",{className:"codex-plan-entries",children:s.map((a)=>e("div",{className:"codex-plan-entry","data-status":a.status,children:[a.status==="completed"&&n(c,{"aria-hidden":"true"}),a.status==="in_progress"&&n(i,{className:"codex-plan-spinner","aria-hidden":"true"}),a.status==="pending"&&n(o,{"aria-hidden":"true"}),n("span",{children:a.content})]},a.content))})]})}
2
- export{T};
1
+ import{CheckCircleIcon as c,CircleIcon as o,LoaderIcon as i}from"lucide-react";import{jsx as n,jsxs as e}from"react/jsx-runtime";function k({entries:s}){let d=s.filter((a)=>a.status==="completed").length,t=s.find((a)=>a.status==="in_progress");return e("div",{className:"codex-plan",children:[e("div",{className:"codex-plan-summary",children:[e("span",{children:[d,"/",s.length]}),t!==void 0&&e("span",{className:"codex-plan-active",children:["· ",t.content]})]}),n("div",{className:"codex-plan-entries",children:s.map((a)=>e("div",{className:"codex-plan-entry","data-status":a.status,children:[a.status==="completed"&&n(c,{"aria-hidden":"true"}),a.status==="in_progress"&&n(i,{className:"codex-plan-spinner","aria-hidden":"true"}),a.status==="pending"&&n(o,{"aria-hidden":"true"}),n("span",{children:a.content})]},a.content))})]})}
2
+ export{k};
@@ -0,0 +1 @@
1
+ import{Menu as n}from"@base-ui/react/menu";import{cn as d}from"cn";import{CheckIcon as p,ChevronRightIcon as l}from"lucide-react";import{jsx as t,jsxs as c}from"react/jsx-runtime";function v({...e}){return t(n.Root,{"data-slot":"dropdown-menu",...e})}function St({...e}){return t(n.Portal,{"data-slot":"dropdown-menu-portal",...e})}function x({...e}){return t(n.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function m({align:e="start",alignOffset:o=0,side:r="bottom",sideOffset:i=4,className:s,...u}){return t(n.Portal,{children:t(n.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:o,side:r,sideOffset:i,children:t(n.Popup,{"data-slot":"dropdown-menu-content",className:d("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md p-1 shadow-md ring-1 duration-100 outline-none data-closed:overflow-hidden",s),...u})})})}function b({...e}){return t(n.Group,{"data-slot":"dropdown-menu-group",...e})}function D({className:e,inset:o,...r}){return t(n.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":o,className:d("text-muted-foreground px-2 py-1.5 text-xs font-medium data-inset:pl-8",e),...r})}function y({className:e,inset:o,variant:r="default",...i}){return t(n.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:d("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i})}function P({...e}){return t(n.SubmenuRoot,{"data-slot":"dropdown-menu-sub",...e})}function I({className:e,inset:o,children:r,...i}){return c(n.SubmenuTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:d("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,children:[r,t(l,{className:"ml-auto"})]})}function M({align:e="start",alignOffset:o=-3,side:r="right",sideOffset:i=0,className:s,...u}){return t(m,{"data-slot":"dropdown-menu-sub-content",className:d("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 w-auto min-w-[96px] rounded-md p-1 shadow-lg ring-1 duration-100",s),align:e,alignOffset:o,side:r,sideOffset:i,...u})}function J({className:e,children:o,checked:r,inset:i,...s}){return c(n.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":i,className:d("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:r,...s,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:t(n.CheckboxItemIndicator,{children:t(p,{})})}),o]})}function He({...e}){return t(n.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...e})}function Oe({className:e,children:o,inset:r,...i}){return c(n.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":r,className:d("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:t(n.RadioItemIndicator,{children:t(p,{})})}),o]})}function a({className:e,...o}){return t(n.Separator,{"data-slot":"dropdown-menu-separator",className:d("bg-border -mx-1 my-1 h-px",e),...o})}function Et({className:e,...o}){return t("span",{"data-slot":"dropdown-menu-shortcut",className:d("text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-xs tracking-widest",e),...o})}export{v,St,x,m,b,D,y,P,I,M,J,He,Oe,a,Et};
@@ -1,2 +1,2 @@
1
- import{we}from"./chunk-ftka421d.js";import{CheckIcon as N,ChevronDownIcon as E,CopyIcon as w,FileIcon as k}from"lucide-react";import{useEffect as H,useLayoutEffect as I,useRef as T,useState as b}from"react";import{jsx as e,jsxs as g,Fragment as y}from"react/jsx-runtime";var A=20,L='a[href], area[href], button, input, select, textarea, summary, audio[controls], video[controls], iframe, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function h(n,o,s){if(n.toggleAttribute("inert",!o),!o){n.setAttribute("aria-hidden","true");return}if(s===null)n.removeAttribute("aria-hidden");else n.setAttribute("aria-hidden",s)}function R(n,o){let s=n.getBoundingClientRect(),i=o.getBoundingClientRect();return s.top>=i.top&&s.right<=i.right&&s.bottom<=i.bottom&&s.left>=i.left}function M({text:n,host:o}){let{t:s,Markdown:i}=o,c=T(null),[l,p]=b(!1),[d,f]=b(!1);return I(()=>{let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=()=>{if(r.scrollHeight===0){p(!1);return}let x=Number.parseFloat(getComputedStyle(r).lineHeight);if(!Number.isFinite(x))throw Error("Codex user message line height is invalid");p(r.scrollHeight>A*x+1)};t();let u=new ResizeObserver(t);return u.observe(r),()=>u.disconnect()},[]),H(()=>{if(!l||d)return;let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=new Map,u=typeof IntersectionObserver>"u"?null:new IntersectionObserver((a)=>{for(let m of a){let v=m.target;if(!t.has(v))continue;h(v,m.isIntersecting&&m.intersectionRatio>=1,t.get(v))}},{root:r,rootMargin:"0px",threshold:1}),x=()=>{for(let a of t.keys()){if(r.contains(a))continue;u?.unobserve(a),t.delete(a)}for(let a of r.querySelectorAll(L)){if(t.has(a)||a.hasAttribute("inert"))continue;let m=a.getAttribute("aria-hidden");t.set(a,m),h(a,u===null&&R(a,r),m),u?.observe(a)}};x();let C=new MutationObserver(x);return C.observe(r,{childList:!0,subtree:!0}),()=>{u?.disconnect(),C.disconnect();for(let[a,m]of t)h(a,!0,m)}},[l,d]),g("div",{className:"codex-user-message-content",children:[e("div",{ref:c,className:l&&!d?"codex-user-message-text codex-user-message-text-collapsed":"codex-user-message-text",children:e(i,{text:n,streaming:!1})}),l&&!d&&e("span",{className:"codex-user-message-ellipsis","aria-hidden":"true",children:"…"}),l&&g("button",{type:"button","aria-expanded":d,className:"codex-user-message-collapse-trigger",onClick:()=>{f((r)=>!r)},children:[e("span",{children:d?s("stream.codex.showLess"):s("stream.codex.showMore")}),e(E,{className:d?"codex-user-message-collapse-chevron codex-user-message-collapse-chevron-expanded":"codex-user-message-collapse-chevron","aria-hidden":"true"})]})]})}function W({text:n,label:o}){let[s,i]=b(!1);return e("button",{type:"button",className:"codex-message-action","aria-label":o,title:o,onClick:()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2000)},children:s?e(N,{className:"codex-message-action-confirmed"}):e(w,{})})}function S({image:n,openImage:o}){let[s,i]=b(!1),c=`data:${n.mimeType};base64,${n.data}`;return g(y,{children:[e("button",{type:"button",className:"codex-user-image",onClick:()=>o===void 0?i(!0):o(c),children:e("img",{src:c,alt:""})}),s&&e(we,{src:c,alt:"",onClose:()=>i(!1)})]})}function bt({message:n,text:o,textParts:s,mentions:i,images:c,messageTime:l,host:p,bubbleStyle:d}){let{t:f,openImage:r}=p;return e("div",{"data-content-search-unit-key":n.id,"data-message-id":n.id,className:"timeline-break codex-user-message scroll-mt-4",children:g("div",{className:"group/codex-user codex-user-message-group",children:[i.length>0&&e("div",{className:"codex-user-mentions",children:i.map((t)=>g("span",{className:"codex-user-mention",title:t.title,children:[e(k,{"aria-hidden":"true"}),e("span",{className:"codex-user-mention-label",children:t.label})]},t.key))}),c.length>0&&e("div",{className:"codex-user-images",children:c.map((t)=>e(S,{image:t,openImage:r},`${t.mimeType}:${t.data}`))}),o.length>0&&e(y,{children:e("div",{"data-user-message-bubble":!0,tabIndex:0,className:"codex-user-bubble",style:d,children:s?s.map((t,u)=>e("div",{className:"codex-user-text-part",children:t.question===void 0?e(M,{text:t.text,host:p}):g(y,{children:[e("div",{className:"codex-user-question-summary",title:t.question,children:t.question}),e("div",{className:"codex-user-question-answer",children:t.text})]})},u)):e(M,{text:o,host:p})})}),g("div",{className:"codex-user-actions",children:[e(W,{text:o,label:f("actions.copy")}),l&&e("span",{className:"codex-user-time",title:l.full,children:l.short})]})]})})}
2
- export{W,bt};
1
+ import{ge}from"./chunk-en6qem8e.js";import{CheckIcon as N,ChevronDownIcon as E,CopyIcon as w,FileIcon as k}from"lucide-react";import{useEffect as H,useLayoutEffect as I,useRef as T,useState as b}from"react";import{jsx as e,jsxs as g,Fragment as y}from"react/jsx-runtime";var A=20,L='a[href], area[href], button, input, select, textarea, summary, audio[controls], video[controls], iframe, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function h(n,o,s){if(n.toggleAttribute("inert",!o),!o){n.setAttribute("aria-hidden","true");return}if(s===null)n.removeAttribute("aria-hidden");else n.setAttribute("aria-hidden",s)}function R(n,o){let s=n.getBoundingClientRect(),i=o.getBoundingClientRect();return s.top>=i.top&&s.right<=i.right&&s.bottom<=i.bottom&&s.left>=i.left}function M({text:n,host:o}){let{t:s,Markdown:i}=o,c=T(null),[l,p]=b(!1),[d,f]=b(!1);return I(()=>{let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=()=>{if(r.scrollHeight===0){p(!1);return}let x=Number.parseFloat(getComputedStyle(r).lineHeight);if(!Number.isFinite(x))throw Error("Codex user message line height is invalid");p(r.scrollHeight>A*x+1)};t();let u=new ResizeObserver(t);return u.observe(r),()=>u.disconnect()},[]),H(()=>{if(!l||d)return;let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=new Map,u=typeof IntersectionObserver>"u"?null:new IntersectionObserver((a)=>{for(let m of a){let v=m.target;if(!t.has(v))continue;h(v,m.isIntersecting&&m.intersectionRatio>=1,t.get(v))}},{root:r,rootMargin:"0px",threshold:1}),x=()=>{for(let a of t.keys()){if(r.contains(a))continue;u?.unobserve(a),t.delete(a)}for(let a of r.querySelectorAll(L)){if(t.has(a)||a.hasAttribute("inert"))continue;let m=a.getAttribute("aria-hidden");t.set(a,m),h(a,u===null&&R(a,r),m),u?.observe(a)}};x();let C=new MutationObserver(x);return C.observe(r,{childList:!0,subtree:!0}),()=>{u?.disconnect(),C.disconnect();for(let[a,m]of t)h(a,!0,m)}},[l,d]),g("div",{className:"codex-user-message-content",children:[e("div",{ref:c,className:l&&!d?"codex-user-message-text codex-user-message-text-collapsed":"codex-user-message-text",children:e(i,{text:n,streaming:!1})}),l&&!d&&e("span",{className:"codex-user-message-ellipsis","aria-hidden":"true",children:"…"}),l&&g("button",{type:"button","aria-expanded":d,className:"codex-user-message-collapse-trigger",onClick:()=>{f((r)=>!r)},children:[e("span",{children:d?s("stream.codex.showLess"):s("stream.codex.showMore")}),e(E,{className:d?"codex-user-message-collapse-chevron codex-user-message-collapse-chevron-expanded":"codex-user-message-collapse-chevron","aria-hidden":"true"})]})]})}function B({text:n,label:o}){let[s,i]=b(!1);return e("button",{type:"button",className:"codex-message-action","aria-label":o,title:o,onClick:()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2000)},children:s?e(N,{className:"codex-message-action-confirmed"}):e(w,{})})}function S({image:n,openImage:o}){let[s,i]=b(!1),c=`data:${n.mimeType};base64,${n.data}`;return g(y,{children:[e("button",{type:"button",className:"codex-user-image",onClick:()=>o===void 0?i(!0):o(c),children:e("img",{src:c,alt:""})}),s&&e(ge,{src:c,alt:"",onClose:()=>i(!1)})]})}function gt({message:n,text:o,textParts:s,mentions:i,images:c,messageTime:l,host:p,bubbleStyle:d}){let{t:f,openImage:r}=p;return e("div",{"data-content-search-unit-key":n.id,"data-message-id":n.id,className:"timeline-break codex-user-message scroll-mt-4",children:g("div",{className:"group/codex-user codex-user-message-group",children:[i.length>0&&e("div",{className:"codex-user-mentions",children:i.map((t)=>g("span",{className:"codex-user-mention",title:t.title,children:[e(k,{"aria-hidden":"true"}),e("span",{className:"codex-user-mention-label",children:t.label})]},t.key))}),c.length>0&&e("div",{className:"codex-user-images",children:c.map((t)=>e(S,{image:t,openImage:r},`${t.mimeType}:${t.data}`))}),o.length>0&&e(y,{children:e("div",{"data-user-message-bubble":!0,tabIndex:0,className:"codex-user-bubble",style:d,children:s?s.map((t,u)=>e("div",{className:"codex-user-text-part",children:t.question===void 0?e(M,{text:t.text,host:p}):g(y,{children:[e("div",{className:"codex-user-question-summary",title:t.question,children:t.question}),e("div",{className:"codex-user-question-answer",children:t.text})]})},u)):e(M,{text:o,host:p})})}),g("div",{className:"codex-user-actions",children:[e(B,{text:o,label:f("actions.copy")}),l&&e("span",{className:"codex-user-time",title:l.full,children:l.short})]})]})})}
2
+ export{B,gt};
@@ -1,2 +1,2 @@
1
- function ke(t){return Object.entries(t.properties??{}).map(([n,e])=>({key:n,property:e}))}function q(t){let{title:n,description:e}=t;return{title:n??void 0,description:e??void 0}}function h(t){return t.type==="array"}function A(t){return(h(t)?t.items?.oneOf??[]:t.oneOf??[]).map((e)=>{let i=e,r=i.const??i.title??"";return{value:r,label:i.title??r,...i.description?{description:i.description}:{},...i._meta?.alwith?.preview?{preview:i._meta.alwith.preview}:{}}})}
2
- export{ke,q,h,A};
1
+ function Ce(t){return Object.entries(t.properties??{}).map(([n,e])=>({key:n,property:e}))}function G(t){let{title:n,description:e}=t;return{title:n??void 0,description:e??void 0}}function h(t){return t.type==="array"}function A(t){return(h(t)?t.items?.oneOf??[]:t.oneOf??[]).map((e)=>{let i=e,r=i.const??i.title??"";return{value:r,label:i.title??r,...i.description?{description:i.description}:{},...i._meta?.alwith?.preview?{preview:i._meta.alwith.preview}:{}}})}
2
+ export{Ce,G,h,A};
@@ -0,0 +1,2 @@
1
+ function j(r){if(!r.trimStart().toLowerCase().startsWith("gpt"))return r;let a=/^gpt-\d/iu.test(r.trimStart())?" ":"-";return r.split(/(\s+)/).map((i)=>i.trim().length===0?i:i.split("-").map((t,o)=>{if(t.toLowerCase()==="gpt")return"GPT";if(t.toLowerCase()==="oai")return"OAI";return o>0&&t.length>0?`${t[0]?.toUpperCase()}${t.slice(1)}`:t}).join(a).replace(/^GPT (?=\d)/u,"GPT-")).join("")}
2
+ export{j};
@@ -0,0 +1,2 @@
1
+ import{Ie}from"./chunk-tcqf45rf.js";import{E,Ze,R,L}from"./chunk-wnq8g0kp.js";import{cn as v}from"cn";import{XIcon as _}from"lucide-react";import{useCallback as p,useEffect as D,useMemo as j,useRef as N,useState as b}from"react";import{jsx as i,jsxs as A}from"react/jsx-runtime";function we({open:l,onOpenChange:y,url:h,filename:M,scale:d,onScaleChange:f,containerRef:z,containerClassName:H,dialogContentClassName:P,imageClassName:T}){let g=p((e)=>Math.min(4,Math.max(0.25,e)),[]),[I,O]=b(1),o=g(d??I),W=N(null),s=z??W,S=N(null),[m,x]=b({width:0,height:0}),[C,Z]=b({width:0,height:0}),w=p((e)=>{let n=g(e);if(typeof f==="function"){f(n);return}O(n)},[f,g]);D(()=>{if(!l)return;if(!h)return;if(typeof d==="number")return;O(1)},[l,h,d]),D(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{x({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let k=p(()=>{w(1)},[w]),r=j(()=>{let{width:e,height:n}=C,{width:t,height:a}=m;if(e===0||n===0)return{width:0,height:0};if(t===0||a===0)return{width:0,height:0};let c=Math.min(t/e,a/n,1),u=e*c,X=n*c;return{width:u*o,height:X*o}},[o,C,m]);if(!h)return null;return i(E,{open:l,onOpenChange:y,children:A(R,{className:v("top-1/2 left-1/2 h-[90vh] max-h-[90vh] w-[90vw]! max-w-[90vw]! -translate-x-1/2 -translate-y-1/2 gap-0 rounded-none bg-transparent p-0 ring-0 sm:w-[90vw]! sm:max-w-[90vw]!",P),showCloseButton:!1,children:[i(L,{className:"sr-only",children:M||"Image preview"}),i(Ze,{"aria-label":"Close",className:"absolute top-3 right-3 z-10 flex size-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-colors hover:bg-black/75",children:i(_,{className:"size-5"})}),i("div",{ref:s,onWheel:(e)=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=e.deltaY>0?o-0.2:o+0.2,t=g(Number.parseFloat(n.toFixed(2)));if(t===o)return;let a=s.current,c=S.current,u=a&&c?Ie({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(w(t),a&&u)requestAnimationFrame(()=>{a.scrollTo(u)})},className:v("h-full w-full scrollbar-thin overflow-auto",H),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(m.width,r.width),height:Math.max(m.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:M||"image preview",className:v("block object-contain select-none",T),decoding:"async",draggable:!1,ref:S,onDoubleClick:k,onLoad:(e)=>{let n=e.currentTarget;Z({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))x({width:t.clientWidth,height:t.clientHeight})},style:{imageRendering:"auto",width:r.width||void 0,height:r.height||void 0,maxWidth:r.width?"none":"90vw",maxHeight:r.height?"none":"90vh"},src:h})})})})]})})}
2
+ export{we};
@@ -1 +1 @@
1
- import{Radio as o}from"@base-ui/react/radio";import{RadioGroup as t}from"@base-ui/react/radio-group";import{cn as d}from"cn";import{jsx as i}from"react/jsx-runtime";function c({className:r,...e}){return i(t,{"data-slot":"radio-group",className:d("grid w-full gap-3",r),...e})}function a({className:r,...e}){return i(o.Root,{"data-slot":"radio-group-item",className:d("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...e,children:i(o.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{c,a};
1
+ import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function c({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function s({className:r,...a}){return i(e.Root,{"data-slot":"radio-group-item",className:o("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:i(e.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{c,s};