@alwith/module-chat 0.1.28 → 0.1.30

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 (123) 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-11n6ah6p.js +2 -0
  9. package/dist/chunk-15a7wypc.js +2 -0
  10. package/dist/{chunk-s0nhgptn.js → chunk-2kjmc9hg.js} +1 -1
  11. package/dist/chunk-2sc7ppw2.js +1 -0
  12. package/dist/chunk-51qk29t6.js +2 -0
  13. package/dist/{chunk-v4p0qwmj.js → chunk-5hqv4m75.js} +1 -1
  14. package/dist/{chunk-dekjd5sf.js → chunk-67gms74t.js} +2 -2
  15. package/dist/{chunk-s3z33k7f.js → chunk-7471tnsq.js} +2 -2
  16. package/dist/{chunk-hy1x2td2.js → chunk-85y9tqsd.js} +2 -2
  17. package/dist/{chunk-src2j5cw.js → chunk-98t2nc02.js} +2 -2
  18. package/dist/{chunk-gycty1x1.js → chunk-99xmegcw.js} +2 -2
  19. package/dist/{chunk-70sfgw0j.js → chunk-9cdspnb1.js} +2 -2
  20. package/dist/{chunk-9me7jmzd.js → chunk-aaybyhdj.js} +2 -2
  21. package/dist/{chunk-m8gejgjs.js → chunk-ake02dgs.js} +1 -1
  22. package/dist/{chunk-8zs8vy0q.js → chunk-b5srhd6k.js} +1 -1
  23. package/dist/{chunk-7gh078gc.js → chunk-bbnrzw5x.js} +2 -2
  24. package/dist/{chunk-skx67pc6.js → chunk-bgj6z7z4.js} +1 -1
  25. package/dist/{chunk-8bdd6q4w.js → chunk-d1xydh51.js} +2 -2
  26. package/dist/chunk-dvfka70p.js +2 -0
  27. package/dist/chunk-eyn3tdcs.js +2 -0
  28. package/dist/{chunk-etvhn65g.js → chunk-h310nm02.js} +2 -2
  29. package/dist/{chunk-rakd7vzb.js → chunk-h7y6vmb3.js} +1 -1
  30. package/dist/{chunk-s28x10qd.js → chunk-j63t6dxg.js} +1 -1
  31. package/dist/{chunk-25na55ve.js → chunk-kew8ef6z.js} +2 -2
  32. package/dist/{chunk-y2xbq7rb.js → chunk-nvtvm7jc.js} +3 -3
  33. package/dist/chunk-nx3k6k2p.js +2 -0
  34. package/dist/{chunk-swg5v7sg.js → chunk-p4c1w6qx.js} +2 -2
  35. package/dist/chunk-p6kymvjw.js +2 -0
  36. package/dist/{chunk-ghfbzhnb.js → chunk-pkxfrrwf.js} +1 -1
  37. package/dist/chunk-q00ycy4m.js +7 -0
  38. package/dist/chunk-qf9n7v84.js +1 -0
  39. package/dist/{chunk-kj1wrn2j.js → chunk-s4w6yjc0.js} +1 -1
  40. package/dist/{chunk-6x9vcfpg.js → chunk-t83jwyey.js} +1 -1
  41. package/dist/{chunk-0e1pdbec.js → chunk-ta690ra0.js} +2 -2
  42. package/dist/{chunk-bhvtt6tv.js → chunk-tbr607hk.js} +2 -2
  43. package/dist/chunk-tm40sncc.js +2 -0
  44. package/dist/chunk-twww750f.js +2 -0
  45. package/dist/chunk-wbpw278r.js +2 -0
  46. package/dist/{chunk-qj8r5xvx.js → chunk-wf194rae.js} +2 -2
  47. package/dist/{chunk-f20xh0z9.js → chunk-x6jyxw9c.js} +1 -1
  48. package/dist/{chunk-ynga7fm4.js → chunk-xc6fz2xk.js} +3 -3
  49. package/dist/{chunk-7pr2j1zb.js → chunk-xgy0heva.js} +1 -1
  50. package/dist/{chunk-341yykkp.js → chunk-y1cbwywe.js} +1 -1
  51. package/dist/{chunk-ax9ganqr.js → chunk-ytqka33j.js} +2 -2
  52. package/dist/chunk-z3gwnjmk.js +2 -0
  53. package/dist/codex/activity-group.js +1 -1
  54. package/dist/codex/assistant-message.js +2 -2
  55. package/dist/codex/async-question-card.js +1 -1
  56. package/dist/codex/edited-files-card.js +1 -1
  57. package/dist/codex/image-view-activity.js +1 -1
  58. package/dist/codex/markdown-renderer.js +5 -5
  59. package/dist/codex/navigation-preview.js +1 -1
  60. package/dist/codex/navigation-rail.js +1 -1
  61. package/dist/codex/plan.js +1 -1
  62. package/dist/codex/styles.css +1 -1
  63. package/dist/codex/thread-virtualizer.js +1 -1
  64. package/dist/codex/user-message.js +1 -1
  65. package/dist/codex/virtualized-turn-list.js +1 -1
  66. package/dist/composer/completion-filter.js +1 -1
  67. package/dist/composer/completion-menu.js +2 -2
  68. package/dist/composer/completion-trigger.js +1 -1
  69. package/dist/composer/effort-slider.js +1 -1
  70. package/dist/composer/menu-radio.js +1 -1
  71. package/dist/composer/model-select.js +1 -1
  72. package/dist/composer/permission-mode-select.js +1 -1
  73. package/dist/composer/prompt-input-attachments.js +1 -1
  74. package/dist/composer/prompt-input-clipboard.js +1 -1
  75. package/dist/composer/prompt-input-context.js +1 -1
  76. package/dist/composer/prompt-input-textarea.js +3 -3
  77. package/dist/composer/prompt-input.js +1 -1
  78. package/dist/image-lightbox.js +1 -1
  79. package/dist/image-preview-dialog.js +1 -1
  80. package/dist/lib/code-highlighter.js +1 -1
  81. package/dist/lib/fuzzy.js +1 -1
  82. package/dist/lib/group-blocks.js +1 -1
  83. package/dist/lib/image-encode.js +1 -1
  84. package/dist/lib/limits.js +1 -1
  85. package/dist/lib/markdown-parser.js +1 -1
  86. package/dist/lib/markdown-rules.js +1 -1
  87. package/dist/lib/model-name.js +1 -1
  88. package/dist/lib/pointer-centered-zoom.js +1 -1
  89. package/dist/lib/prepare-prompt-files.js +1 -1
  90. package/dist/lib/stream-style.js +1 -1
  91. package/dist/lib/streaming-markdown.js +1 -1
  92. package/dist/search/chat-search.js +1 -1
  93. package/dist/search/dom-matches.js +1 -1
  94. package/dist/search/find-bar.js +1 -1
  95. package/dist/search/literal-matches.js +1 -1
  96. package/dist/ui/badge.js +1 -1
  97. package/dist/ui/button.js +1 -1
  98. package/dist/ui/card.js +1 -1
  99. package/dist/ui/checkbox.js +1 -1
  100. package/dist/ui/dialog.js +1 -1
  101. package/dist/ui/dropdown-menu.js +1 -1
  102. package/dist/ui/field.js +1 -1
  103. package/dist/ui/hover-card.js +1 -1
  104. package/dist/ui/input-group.js +1 -1
  105. package/dist/ui/input.js +1 -1
  106. package/dist/ui/separator.js +1 -1
  107. package/dist/ui/switch.js +1 -1
  108. package/dist/ui/tooltip.js +1 -1
  109. package/package.json +3 -3
  110. package/dist/chunk-74phx7h8.js +0 -2
  111. package/dist/chunk-7tj0a2na.js +0 -2
  112. package/dist/chunk-awbgf3hp.js +0 -2
  113. package/dist/chunk-darkfx1b.js +0 -2
  114. package/dist/chunk-g20b01rn.js +0 -2
  115. package/dist/chunk-hnt4tt1n.js +0 -2
  116. package/dist/chunk-k1c0jrk1.js +0 -1
  117. package/dist/chunk-kzccs8ak.js +0 -2
  118. package/dist/chunk-p9wpghey.js +0 -2
  119. package/dist/chunk-qyhgwc51.js +0 -2
  120. package/dist/chunk-reqrpvyy.js +0 -2
  121. package/dist/chunk-wc3patey.js +0 -7
  122. package/dist/chunk-wtkv29ba.js +0 -1
  123. package/dist/chunk-yk52gm8x.js +0 -2
@@ -1 +1 @@
1
- import{ue}from"../chunk-bhvtt6tv.js";export{ue as detectTrigger};
1
+ import{Le}from"../chunk-tbr607hk.js";export{Le as detectTrigger};
@@ -1 +1 @@
1
- import{U}from"../chunk-etvhn65g.js";export{U as EffortSlider};
1
+ import{Q}from"../chunk-h310nm02.js";export{Q as EffortSlider};
@@ -1 +1 @@
1
- import{n}from"../chunk-skx67pc6.js";import"../chunk-kj1wrn2j.js";export{n as MenuRadioSelect};
1
+ import{n}from"../chunk-bgj6z7z4.js";import"../chunk-s4w6yjc0.js";export{n as MenuRadioSelect};
@@ -1 +1 @@
1
- import{e}from"../chunk-7pr2j1zb.js";import{x,v,m,b,H,y,P,I,M,J,s}from"../chunk-kj1wrn2j.js";import{S}from"../chunk-s28x10qd.js";import{G,j,Q}from"../chunk-wtkv29ba.js";import{U}from"../chunk-etvhn65g.js";import{n}from"../chunk-skx67pc6.js";import{cn as p}from"cn";import{ArrowUpRight as pe,ChevronUp as Y,Loader2Icon as E,Zap as ee}from"lucide-react";import{Fragment as ce,useState as ne}from"react";import{jsxDEV as a,Fragment as h}from"react/jsx-dev-runtime";function ye({value:w,onChange:ae,models:f,modelGroups:_,compactCatalog:d,effortPresentation:F="slider",unavailableEffort:C,providerMenu:g,header:N,className:W,condensed:R,stripLabelPrefix:A,showDescription:se,showModelList:oe=!0,loading:ie,switching:Z,isLoading:te,effortConfig:i,booleanOptions:V,onBooleanChange:L,selectOptions:le=[],t:c,...u}){let[de,re]=ne(!1),[me,ue]=ne(!1),r=V?.find((o)=>o.id==="fast_mode"),B=d?V?.filter((o)=>o!==r):V,q=(o)=>A&&o.startsWith(A)?o.slice(A.length):o;if(ie)return a("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:a(e,{variant:"ghost",disabled:!0,className:p("h-7 min-w-0 shrink gap-1.5 rounded-md px-2 text-xs font-normal",W),children:[a(E,{className:"size-3 animate-spin"},void 0,!1,void 0,this),a("span",{className:"text-muted-foreground truncate",children:c("model.loadingModels")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return a("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:[g&&a(x,{open:de,onOpenChange:re,children:[a(G,{children:[a(j,{render:a(v,{render:a(e,{"data-testid":"provider-trigger",variant:"ghost",disabled:u.disabled,className:p("h-7 shrink-0 gap-1 rounded-md px-1.5","hover:bg-accent"),children:[g.icon,a(Y,{className:"size-2.5 shrink-0 opacity-60"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),a(Q,{children:c("model.switchProvider")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(m,{side:"top",align:"end",sideOffset:4,className:"z-100 min-w-[10rem]",children:[g.groups.map((o,l)=>a(ce,{children:[l>0&&o.length>0&&a(s,{},void 0,!1,void 0,this),a(n,{value:g.value,onValueChange:g.onChange,options:o},void 0,!1,void 0,this)]},l,!0,void 0,this)),g.moreAction&&a(h,{children:[a(s,{},void 0,!1,void 0,this),a(y,{onClick:g.moreAction,className:"whitespace-nowrap",children:[a("span",{className:"min-w-0 flex-1 truncate",children:c("model.moreModels")},void 0,!1,void 0,this),a(pe,{className:"size-4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a(x,{open:me,onOpenChange:ue,children:[a(G,{children:[a(j,{render:a(v,{render:a(e,{"data-testid":"model-trigger","aria-busy":Z,variant:"ghost",className:p("h-7 gap-1.5 rounded-md px-2 text-xs font-normal","hover:bg-accent","max-w-full min-w-0 shrink",R&&"h-7 gap-1 px-1.5 text-[11px]",W),...u,children:[w.icon,V?.some((o)=>o.id==="fast_mode"&&o.currentValue&&!o.disabled)&&a(ee,{"aria-hidden":"true",className:"size-3 shrink-0"},void 0,!1,void 0,this),a("span",{className:p("min-w-0 flex-1 truncate text-start",R&&"text-[11px]"),children:q(w.label)||c("model.selectModel")},void 0,!1,void 0,this),i&&a("span",{className:"text-muted-foreground grid shrink-0 justify-items-center",children:[a("span",{className:"invisible col-start-1 row-start-1",children:i.sizer??i.levels.reduce((o,l)=>l.name.length>o.length?l.name:o,"")},void 0,!1,void 0,this),a("span",{className:"col-start-1 row-start-1",children:i.levels.find((o)=>o.value===i.value)?.name??i.value},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z?a(E,{"data-testid":"model-switch-loading",className:"size-3 shrink-0 animate-spin"},void 0,!1,void 0,this):a(Y,{className:p("size-3 shrink-0",R&&"size-2.5")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),a(Q,{children:c("model.switchModel")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(m,{side:"top",align:"end",sideOffset:4,className:p("z-100 w-auto max-w-[min(24rem,calc(100vw-1rem))] min-w-[14rem]",d&&"flex h-[350px] w-80 min-w-0 flex-col overflow-hidden rounded-xl p-1.5"),children:[d&&a(h,{children:[a(b,{"data-model-menu-header":!0,className:"flex shrink-0 items-center justify-between gap-2 px-1 py-1",children:[i?F==="slider"?a("div",{role:"menuitem","aria-label":i.name,className:"min-w-0 [&>div]:justify-start [&>div]:gap-3 [&>div]:px-2 [&>div]:py-1.5",children:a(U,{...i,disabled:u.disabled},void 0,!1,void 0,this)},void 0,!1,void 0,this):a(P,{children:[a(I,{disabled:u.disabled,className:"h-8 min-w-0 flex-1 gap-2 rounded-md",children:[a("span",{children:i.name},void 0,!1,void 0,this),a("span",{className:"text-muted-foreground min-w-0 truncate text-xs",children:i.levels.find((o)=>o.value===i.value)?.name??i.value},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(M,{children:a(n,{value:i.value,onValueChange:i.onChange,options:i.levels.map((o)=>({value:o.value,label:o.name}))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):C?a(y,{disabled:!0,className:"h-8 min-w-0 flex-1 gap-2",children:[a("span",{children:C.name},void 0,!1,void 0,this),a("span",{className:"text-muted-foreground truncate text-xs",children:C.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this):a(H,{className:"min-w-0 flex-1 truncate",children:N?.name},void 0,!1,void 0,this),r&&a(J,{"aria-label":r.name,title:r.title??r.name,disabled:u.disabled||r.disabled,checked:r.currentValue,closeOnClick:!1,onCheckedChange:(o)=>L?.(r.id,o),className:p("hover:bg-accent focus:hover:bg-accent focus-visible:bg-accent ml-auto size-8 shrink-0 justify-center rounded-md p-0 focus:bg-transparent [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",r.currentValue&&!r.disabled?"text-foreground [&_svg]:fill-current":"text-muted-foreground"),children:r.icon??a(ee,{className:"size-4","aria-hidden":"true"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(s,{className:"shrink-0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N&&!d&&a(h,{children:[a("div",{className:"flex items-center gap-2 px-2 py-2",children:[N.icon,a("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:N.name},void 0,!1,void 0,this),N.action]},void 0,!0,void 0,this),a(s,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(b,{"data-model-menu-list":d?"":void 0,className:d?"min-h-0 flex-1 overflow-y-auto overscroll-contain":void 0,children:[oe&&(te?a(y,{disabled:!0,className:"text-muted-foreground",children:c("model.loadingModels")},void 0,!1,void 0,this):f.length===0?a(y,{disabled:!0,className:"text-muted-foreground",children:c("model.noModelsAvailable")},void 0,!1,void 0,this):(()=>{let o=f.filter((t)=>!t.more),l=f.filter((t)=>t.more),K=o.length>0&&l.length>0,T=(t,D)=>({disabled:u.disabled,icon:t.icon,value:t.api_id,label:q(t.label),description:D?.noDescription?void 0:se?t.description:void 0}),O=(t)=>{let D=f.find((z)=>z.api_id===t);if(D)ae(D)};if(d)return a(n,{value:w.api_id,onValueChange:O,itemClassName:"font-normal whitespace-nowrap",options:f.map((t)=>T(t))},void 0,!1,void 0,this);return a(h,{children:[_?_.map((t)=>{let D=t.models.filter((k)=>!k.more),z=t.models.filter((k)=>k.more),X=D.length>0&&z.length>0;return a(b,{children:[a(H,{className:"text-muted-foreground text-xs font-normal",children:t.name},void 0,!1,void 0,this),a(n,{value:w.api_id,onValueChange:O,itemClassName:"font-medium whitespace-nowrap",options:(X?D:t.models).map((k)=>T(k))},void 0,!1,void 0,this),X&&a(P,{children:[a(I,{className:"font-medium whitespace-nowrap",children:c("model.moreModels")},void 0,!1,void 0,this),a(M,{children:a(n,{value:w.api_id,onValueChange:O,itemClassName:"font-medium whitespace-nowrap",options:z.map((k)=>T(k,{noDescription:!0}))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},t.id,!0,void 0,this)}):a(n,{value:w.api_id,onValueChange:O,itemClassName:"font-medium whitespace-nowrap",options:(K?o:f).map((t)=>T(t))},void 0,!1,void 0,this),!_&&K&&a(P,{children:[a(I,{className:"font-medium whitespace-nowrap",children:c("model.moreModels")},void 0,!1,void 0,this),a(M,{children:a(n,{value:w.api_id,onValueChange:O,itemClassName:"font-medium whitespace-nowrap",options:l.map((t)=>T(t,{noDescription:!0}))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)})()),!d&&i&&a(h,{children:[a(s,{},void 0,!1,void 0,this),F==="menu"?a(P,{children:[a(I,{disabled:u.disabled,children:[a("span",{className:"flex-1",children:i.name},void 0,!1,void 0,this),a("span",{className:"text-muted-foreground",children:i.levels.find((o)=>o.value===i.value)?.name??i.value},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(M,{children:a(n,{value:i.value,onValueChange:i.onChange,options:i.levels.map((o)=>({value:o.value,label:o.name}))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):a(U,{...i,disabled:u.disabled},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!d&&!i&&C&&a(h,{children:[a(s,{},void 0,!1,void 0,this),a(y,{disabled:!0,children:[a("span",{className:"flex-1",children:C.name},void 0,!1,void 0,this),a("span",{children:C.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),le.map((o)=>a(b,{children:[a(s,{},void 0,!1,void 0,this),a(H,{children:o.name},void 0,!1,void 0,this),a(n,{value:o.value,onValueChange:o.onChange,options:o.options,itemClassName:"whitespace-nowrap"},void 0,!1,void 0,this)]},o.id,!0,void 0,this)),B&&B.length>0&&a(h,{children:[!i&&a(s,{},void 0,!1,void 0,this),B.map((o)=>d?a(J,{"aria-label":o.name,title:o.title,disabled:u.disabled||o.disabled,checked:o.currentValue,closeOnClick:!1,onCheckedChange:(l)=>L?.(o.id,l),className:"justify-between gap-3 py-2.5 pr-2 [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",children:[a("span",{className:"flex items-center gap-2",children:[o.icon,o.name]},void 0,!0,void 0,this),a("span",{"aria-hidden":"true",className:p("flex h-[18px] w-8 shrink-0 items-center rounded-full p-0.5",o.currentValue?"bg-primary":"bg-input"),children:a("span",{className:p("bg-background size-3.5 rounded-full shadow-xs transition-transform",o.currentValue&&"translate-x-3.5")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},o.id,!0,void 0,this):a("div",{title:o.title,className:p("flex items-center justify-between gap-3 px-2 py-2.5",o.disabled&&"opacity-50"),children:[a("span",{className:"flex items-center gap-2 text-sm font-medium",children:[o.icon,o.name]},void 0,!0,void 0,this),a(S,{"aria-label":o.name,disabled:u.disabled||o.disabled,checked:o.currentValue,onCheckedChange:(l)=>L?.(o.id,l)},void 0,!1,void 0,this)]},o.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d&&N?.action&&a(h,{children:[a(s,{className:"shrink-0"},void 0,!1,void 0,this),a(b,{"data-model-menu-footer":!0,className:"shrink-0",children:N.action},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{ye as ModelSelect};
1
+ import{e}from"../chunk-xgy0heva.js";import{v,b,m,y,D,w,N,S,E,J,s}from"../chunk-s4w6yjc0.js";import{L}from"../chunk-j63t6dxg.js";import{ie,ae,se}from"../chunk-qf9n7v84.js";import{Q}from"../chunk-h310nm02.js";import{n}from"../chunk-bgj6z7z4.js";import{cn as p}from"cn";import{ArrowUpRight as pe,ChevronUp as q,Loader2Icon as H,Zap as K}from"lucide-react";import{Fragment as ce,useState as X}from"react";import{jsxDEV as a,Fragment as h}from"react/jsx-dev-runtime";function ye({value:g,onChange:Y,models:C,modelGroups:R,compactCatalog:d,effortPresentation:G="slider",unavailableEffort:T,providerMenu:x,header:M,className:P,condensed:I,stripLabelPrefix:A,showDescription:ee,showModelList:ne=!0,loading:oe,switching:F,isLoading:te,effortConfig:o,booleanOptions:z,onBooleanChange:j,selectOptions:le=[],t:c,...u}){let[de,re]=X(!1),[me,ue]=X(!1),r=z?.find((i)=>i.id==="fast_mode"),B=d?z?.filter((i)=>i!==r):z,U=(i)=>A&&i.startsWith(A)?i.slice(A.length):i;if(oe)return a("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:a(e,{variant:"ghost",disabled:!0,className:p("h-7 min-w-0 shrink gap-1.5 rounded-md px-2 text-xs font-normal",P),children:[a(H,{className:"size-3 animate-spin"},void 0,!1,void 0,this),a("span",{className:"text-muted-foreground truncate",children:c("model.loadingModels")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return a("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:[x&&a(v,{open:de,onOpenChange:re,children:[a(ie,{children:[a(ae,{render:a(b,{render:a(e,{"data-testid":"provider-trigger",variant:"ghost",disabled:u.disabled,className:p("h-7 shrink-0 gap-1 rounded-md px-1.5","hover:bg-accent"),children:[x.icon,a(q,{className:"size-2.5 shrink-0 opacity-60"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),a(se,{children:c("model.switchProvider")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(m,{side:"top",align:"end",sideOffset:4,className:"z-100 min-w-[10rem]",children:[x.groups.map((i,l)=>a(ce,{children:[l>0&&i.length>0&&a(s,{},void 0,!1,void 0,this),a(n,{value:x.value,onValueChange:x.onChange,options:i},void 0,!1,void 0,this)]},l,!0,void 0,this)),x.moreAction&&a(h,{children:[a(s,{},void 0,!1,void 0,this),a(w,{onClick:x.moreAction,className:"whitespace-nowrap",children:[a("span",{className:"min-w-0 flex-1 truncate",children:c("model.moreModels")},void 0,!1,void 0,this),a(pe,{className:"size-4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a(v,{open:me,onOpenChange:ue,children:[a(ie,{children:[a(ae,{render:a(b,{render:a(e,{"data-testid":"model-trigger","aria-busy":F,variant:"ghost",className:p("h-7 gap-1.5 rounded-md px-2 text-xs font-normal","hover:bg-accent","max-w-full min-w-0 shrink",I&&"h-7 gap-1 px-1.5 text-[11px]",P),...u,children:[g.icon,z?.some((i)=>i.id==="fast_mode"&&i.currentValue&&!i.disabled)&&a(K,{"aria-hidden":"true",className:"size-3 shrink-0"},void 0,!1,void 0,this),a("span",{className:p("min-w-0 flex-1 truncate text-start",I&&"text-[11px]"),children:U(g.label)||c("model.selectModel")},void 0,!1,void 0,this),o&&a("span",{className:"text-muted-foreground grid shrink-0 justify-items-center",children:[a("span",{className:"invisible col-start-1 row-start-1",children:o.sizer??o.levels.reduce((i,l)=>l.name.length>i.length?l.name:i,"")},void 0,!1,void 0,this),a("span",{className:"col-start-1 row-start-1",children:o.levels.find((i)=>i.value===o.value)?.name??o.value},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F?a(H,{"data-testid":"model-switch-loading",className:"size-3 shrink-0 animate-spin"},void 0,!1,void 0,this):a(q,{className:p("size-3 shrink-0",I&&"size-2.5")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),a(se,{children:c("model.switchModel")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(m,{side:"top",align:"end",sideOffset:4,className:p("z-100 w-auto max-w-[min(24rem,calc(100vw-1rem))] min-w-[14rem]",d&&"flex h-[350px] w-80 min-w-0 flex-col overflow-hidden rounded-xl p-1.5"),children:[d&&a(h,{children:[a(y,{"data-model-menu-header":!0,className:"flex shrink-0 items-center justify-between gap-2 px-1 py-1",children:[o?G==="slider"?a("div",{role:"menuitem","aria-label":o.name,className:"min-w-0 [&>div]:justify-start [&>div]:gap-3 [&>div]:px-2 [&>div]:py-1.5",children:a(Q,{...o,disabled:u.disabled},void 0,!1,void 0,this)},void 0,!1,void 0,this):a(N,{children:[a(S,{disabled:u.disabled,className:"h-8 min-w-0 flex-1 gap-2 rounded-md",children:[a("span",{children:o.name},void 0,!1,void 0,this),a("span",{className:"text-muted-foreground min-w-0 truncate text-xs",children:o.levels.find((i)=>i.value===o.value)?.name??o.value},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(E,{children:a(n,{value:o.value,onValueChange:o.onChange,options:o.levels.map((i)=>({value:i.value,label:i.name}))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):T?a(w,{disabled:!0,className:"h-8 min-w-0 flex-1 gap-2",children:[a("span",{children:T.name},void 0,!1,void 0,this),a("span",{className:"text-muted-foreground truncate text-xs",children:T.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this):a(D,{className:"min-w-0 flex-1 truncate",children:M?.name},void 0,!1,void 0,this),r&&a(J,{"aria-label":r.name,title:r.title??r.name,disabled:u.disabled||r.disabled,checked:r.currentValue,closeOnClick:!1,onCheckedChange:(i)=>j?.(r.id,i),className:p("hover:bg-accent focus:hover:bg-accent focus-visible:bg-accent ml-auto size-8 shrink-0 justify-center rounded-md p-0 focus:bg-transparent [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",r.currentValue&&!r.disabled?"text-foreground [&_svg]:fill-current":"text-muted-foreground"),children:r.icon??a(K,{className:"size-4","aria-hidden":"true"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(s,{className:"shrink-0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M&&!d&&a(h,{children:[a("div",{className:"flex items-center gap-2 px-2 py-2",children:[M.icon,a("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:M.name},void 0,!1,void 0,this),M.action]},void 0,!0,void 0,this),a(s,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(y,{"data-model-menu-list":d?"":void 0,className:d?"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain":void 0,children:[ne&&(te?a(w,{disabled:!0,className:"text-muted-foreground",children:c("model.loadingModels")},void 0,!1,void 0,this):C.length===0?a(w,{disabled:!0,className:"text-muted-foreground",children:c("model.noModelsAvailable")},void 0,!1,void 0,this):(()=>{let i=C.filter((t)=>!t.more),l=C.filter((t)=>t.more),W=i.length>0&&l.length>0,O=(t,k)=>({disabled:u.disabled,icon:t.icon,value:t.api_id,label:U(t.label),description:k?.noDescription?void 0:ee?t.description:void 0}),V=(t)=>{let k=C.find((_)=>_.api_id===t);if(k)Y(k)};if(d)return a(n,{value:g.api_id,onValueChange:V,itemClassName:"min-w-0 max-w-full font-normal whitespace-nowrap",options:C.map((t)=>O(t))},void 0,!1,void 0,this);return a(h,{children:[R?R.map((t)=>{let k=t.models.filter((f)=>!f.more),_=t.models.filter((f)=>f.more),Z=k.length>0&&_.length>0;return a(y,{children:[a(D,{className:"text-muted-foreground text-xs font-normal",children:t.name},void 0,!1,void 0,this),a(n,{value:g.api_id,onValueChange:V,itemClassName:"font-medium whitespace-nowrap",options:(Z?k:t.models).map((f)=>O(f))},void 0,!1,void 0,this),Z&&a(N,{children:[a(S,{className:"font-medium whitespace-nowrap",children:c("model.moreModels")},void 0,!1,void 0,this),a(E,{children:a(n,{value:g.api_id,onValueChange:V,itemClassName:"font-medium whitespace-nowrap",options:_.map((f)=>O(f,{noDescription:!0}))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},t.id,!0,void 0,this)}):a(n,{value:g.api_id,onValueChange:V,itemClassName:"font-medium whitespace-nowrap",options:(W?i:C).map((t)=>O(t))},void 0,!1,void 0,this),!R&&W&&a(N,{children:[a(S,{className:"font-medium whitespace-nowrap",children:c("model.moreModels")},void 0,!1,void 0,this),a(E,{children:a(n,{value:g.api_id,onValueChange:V,itemClassName:"font-medium whitespace-nowrap",options:l.map((t)=>O(t,{noDescription:!0}))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)})()),!d&&o&&a(h,{children:[a(s,{},void 0,!1,void 0,this),G==="menu"?a(N,{children:[a(S,{disabled:u.disabled,children:[a("span",{className:"flex-1",children:o.name},void 0,!1,void 0,this),a("span",{className:"text-muted-foreground",children:o.levels.find((i)=>i.value===o.value)?.name??o.value},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(E,{children:a(n,{value:o.value,onValueChange:o.onChange,options:o.levels.map((i)=>({value:i.value,label:i.name}))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):a(Q,{...o,disabled:u.disabled},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!d&&!o&&T&&a(h,{children:[a(s,{},void 0,!1,void 0,this),a(w,{disabled:!0,children:[a("span",{className:"flex-1",children:T.name},void 0,!1,void 0,this),a("span",{children:T.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),le.map((i)=>a(y,{children:[a(s,{},void 0,!1,void 0,this),a(D,{children:i.name},void 0,!1,void 0,this),a(n,{value:i.value,onValueChange:i.onChange,options:i.options,itemClassName:"whitespace-nowrap"},void 0,!1,void 0,this)]},i.id,!0,void 0,this)),B&&B.length>0&&a(h,{children:[!o&&a(s,{},void 0,!1,void 0,this),B.map((i)=>d?a(J,{"aria-label":i.name,title:i.title,disabled:u.disabled||i.disabled,checked:i.currentValue,closeOnClick:!1,onCheckedChange:(l)=>j?.(i.id,l),className:"justify-between gap-3 py-2.5 pr-2 [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",children:[a("span",{className:"flex items-center gap-2",children:[i.icon,i.name]},void 0,!0,void 0,this),a("span",{"aria-hidden":"true",className:p("flex h-[18px] w-8 shrink-0 items-center rounded-full p-0.5",i.currentValue?"bg-primary":"bg-input"),children:a("span",{className:p("bg-background size-3.5 rounded-full shadow-xs transition-transform",i.currentValue&&"translate-x-3.5")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},i.id,!0,void 0,this):a("div",{title:i.title,className:p("flex items-center justify-between gap-3 px-2 py-2.5",i.disabled&&"opacity-50"),children:[a("span",{className:"flex items-center gap-2 text-sm font-medium",children:[i.icon,i.name]},void 0,!0,void 0,this),a(L,{"aria-label":i.name,disabled:u.disabled||i.disabled,checked:i.currentValue,onCheckedChange:(l)=>j?.(i.id,l)},void 0,!1,void 0,this)]},i.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d&&M?.action&&a(h,{children:[a(s,{className:"shrink-0"},void 0,!1,void 0,this),a(y,{"data-model-menu-footer":!0,className:"shrink-0",children:M.action},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{ye as ModelSelect};
@@ -1 +1 @@
1
- import{e}from"../chunk-7pr2j1zb.js";import{x,v,m}from"../chunk-kj1wrn2j.js";import{n}from"../chunk-skx67pc6.js";import{useState as f}from"react";import{jsxDEV as o}from"react/jsx-dev-runtime";function N({value:p,currentName:t,icon:r,options:s,label:i,header:a,onValueChange:l,showLabel:d=!1,disabled:u=!1}){let[c,g]=f(!1);return o(x,{open:c,onOpenChange:g,children:[o(v,{render:o(e,{disabled:u,variant:"ghost","aria-label":`${i}: ${t}`,title:t,className:"text-muted-foreground data-popup-open:hover:bg-muted h-7 gap-1.5 rounded-full bg-transparent px-2 text-xs font-normal whitespace-nowrap data-popup-open:bg-transparent",children:[r,o("span",{className:d?"max-w-40 truncate":"hidden max-w-40 truncate @[40rem]/input-footer:inline-block",children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),o(m,{align:"start",sideOffset:4,className:"permission-mode-menu z-100 w-auto max-w-[calc(100vw-2rem)] min-w-72 rounded-xl p-1.5",children:[a&&o("div",{className:"text-muted-foreground flex items-center px-1.5 pt-0.5 pb-1 text-[11px] leading-4",children:o("span",{children:a},void 0,!1,void 0,this)},void 0,!1,void 0,this),o(n,{value:p,onValueChange:l,itemClassName:"items-center gap-2 py-1 pr-6 pl-2 whitespace-nowrap",options:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{N as PermissionModeSelect};
1
+ import{e}from"../chunk-xgy0heva.js";import{v,b,m}from"../chunk-s4w6yjc0.js";import{n}from"../chunk-bgj6z7z4.js";import{useState as f}from"react";import{jsxDEV as o}from"react/jsx-dev-runtime";function N({value:p,currentName:t,icon:r,options:s,label:i,header:a,onValueChange:l,showLabel:d=!1,disabled:u=!1}){let[c,g]=f(!1);return o(v,{open:c,onOpenChange:g,children:[o(b,{render:o(e,{disabled:u,variant:"ghost","aria-label":`${i}: ${t}`,title:t,className:"text-muted-foreground data-popup-open:hover:bg-muted h-7 gap-1.5 rounded-full bg-transparent px-2 text-xs font-normal whitespace-nowrap data-popup-open:bg-transparent",children:[r,o("span",{className:d?"max-w-40 truncate":"hidden max-w-40 truncate @[40rem]/input-footer:inline-block",children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),o(m,{align:"start",sideOffset:4,className:"permission-mode-menu z-100 w-auto max-w-[calc(100vw-2rem)] min-w-72 rounded-xl p-1.5",children:[a&&o("div",{className:"text-muted-foreground flex items-center px-1.5 pt-0.5 pb-1 text-[11px] leading-4",children:o("span",{children:a},void 0,!1,void 0,this)},void 0,!1,void 0,this),o(n,{value:p,onValueChange:l,itemClassName:"items-center gap-2 py-1 pr-6 pl-2 whitespace-nowrap",options:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{N as PermissionModeSelect};
@@ -1 +1 @@
1
- import"../chunk-qj8r5xvx.js";import{e}from"../chunk-7pr2j1zb.js";import"../chunk-s0nhgptn.js";import{Ke}from"../chunk-74phx7h8.js";import{Re,Le,_e}from"../chunk-6x9vcfpg.js";import{p}from"../chunk-awbgf3hp.js";import{cn as f}from"cn";import{PaperclipIcon as H,XIcon as k}from"lucide-react";import{Fragment as T,useEffect as M,useRef as L,useState as P}from"react";import{jsxDEV as t,Fragment as E}from"react/jsx-dev-runtime";function z(n){return t(_e,{align:"start",...n},void 0,!1,void 0,this)}function W({data:n,t:r,className:u,...m}){let c=p(),[d,h]=P(!1),[N,v]=P(1),I=L(null),a=n.filename||"",o=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",C=a||(o?r("input.image"):r("input.attachment"));return M(()=>{if(!d)return;let l=0.1,g=(i)=>Math.min(10,Math.max(0.1,i)),y=(i)=>{if(!(i.ctrlKey||i.metaKey))return;let s=i.key,x=s==="+"||s==="=",A=s==="-"||s==="_",w=s==="0";if(!x&&!A&&!w)return;i.preventDefault(),v((b)=>{if(w)return 1;if(x)return g(b+l);return g(b-l)})};return window.addEventListener("keydown",y,{passive:!1}),()=>window.removeEventListener("keydown",y)},[d]),t(E,{children:[t(Re,{children:[t(Le,{render:t("div",{className:f("group border-border hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent relative flex h-8 cursor-pointer items-center gap-1.5 rounded-md border px-1.5 text-sm font-medium transition-all select-none",u),...m,children:[t("div",{className:"relative size-5 shrink-0",children:[o?t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":r("input.image"),className:"bg-background absolute inset-0 size-5 overflow-hidden rounded p-0 transition-opacity group-hover:opacity-0",onClick:()=>{v(1),h(!0)},children:t("img",{alt:a||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20},void 0,!1,void 0,this)},void 0,!1,void 0,this):t("div",{className:"bg-background text-muted-foreground absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded transition-opacity group-hover:opacity-0",children:t(H,{className:"size-3"},void 0,!1,void 0,this)},void 0,!1,void 0,this),t(e,{"aria-label":r("input.removeAttachment"),className:f("absolute -top-1 -right-1 size-4 rounded-full p-0 opacity-0 transition-opacity [&>svg]:size-3","pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100"),onClick:(l)=>{l.stopPropagation(),c.remove(n.id)},type:"button",variant:"ghost",children:[t(k,{},void 0,!1,void 0,this),t("span",{className:"sr-only",children:r("input.removeAttachment")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!o&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t(z,{className:"w-auto p-2",children:t("div",{className:"w-auto space-y-3",children:[o&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:a||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("div",{className:"flex items-center gap-2.5",children:t("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[t("h4",{className:"truncate text-sm leading-none font-semibold",children:a||(o?"Image":"Attachment")},void 0,!1,void 0,this),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o&&n.url&&t(Ke,{containerRef:I,filename:a||r("input.image"),onOpenChange:h,onScaleChange:v,open:d,scale:N,url:n.url},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function X({children:n,className:r,...u}){let m=p();if(!m.files.length)return null;return t("div",{className:f("flex w-full flex-wrap items-center gap-1",r),...u,children:m.files.map((c)=>t(T,{children:n(c)},c.id,!1,void 0,this))},void 0,!1,void 0,this)}export{W as PromptInputAttachment,X as PromptInputAttachments};
1
+ import"../chunk-wf194rae.js";import{e}from"../chunk-xgy0heva.js";import"../chunk-2kjmc9hg.js";import{Ae}from"../chunk-51qk29t6.js";import{Xe,Ze,Ye}from"../chunk-t83jwyey.js";import{h}from"../chunk-twww750f.js";import{cn as v}from"cn";import{PaperclipIcon as H,XIcon as k}from"lucide-react";import{Fragment as T,useEffect as M,useRef as L,useState as P}from"react";import{jsxDEV as t,Fragment as E}from"react/jsx-dev-runtime";function z(n){return t(Ye,{align:"start",...n},void 0,!1,void 0,this)}function W({data:n,t:r,className:l,...m}){let c=h(),[u,f]=P(!1),[N,d]=P(1),I=L(null),a=n.filename||"",o=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",C=a||(o?r("input.image"):r("input.attachment"));return M(()=>{if(!u)return;let p=0.1,g=(i)=>Math.min(10,Math.max(0.1,i)),y=(i)=>{if(!(i.ctrlKey||i.metaKey))return;let s=i.key,x=s==="+"||s==="=",A=s==="-"||s==="_",w=s==="0";if(!x&&!A&&!w)return;i.preventDefault(),d((b)=>{if(w)return 1;if(x)return g(b+p);return g(b-p)})};return window.addEventListener("keydown",y,{passive:!1}),()=>window.removeEventListener("keydown",y)},[u]),t(E,{children:[t(Xe,{children:[t(Ze,{render:t("div",{className:v("group border-border hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent relative flex h-8 cursor-pointer items-center gap-1.5 rounded-md border px-1.5 text-sm font-medium transition-all select-none",l),...m,children:[t("div",{className:"relative size-5 shrink-0",children:[o?t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":r("input.image"),className:"bg-background absolute inset-0 size-5 overflow-hidden rounded p-0 transition-opacity group-hover:opacity-0",onClick:()=>{d(1),f(!0)},children:t("img",{alt:a||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20},void 0,!1,void 0,this)},void 0,!1,void 0,this):t("div",{className:"bg-background text-muted-foreground absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded transition-opacity group-hover:opacity-0",children:t(H,{className:"size-3"},void 0,!1,void 0,this)},void 0,!1,void 0,this),t(e,{"aria-label":r("input.removeAttachment"),className:v("absolute -top-1 -right-1 size-4 rounded-full p-0 opacity-0 transition-opacity [&>svg]:size-3","pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100"),onClick:(p)=>{p.stopPropagation(),c.remove(n.id)},type:"button",variant:"ghost",children:[t(k,{},void 0,!1,void 0,this),t("span",{className:"sr-only",children:r("input.removeAttachment")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!o&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t(z,{className:"w-auto p-2",children:t("div",{className:"w-auto space-y-3",children:[o&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:a||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("div",{className:"flex items-center gap-2.5",children:t("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[t("h4",{className:"truncate text-sm leading-none font-semibold",children:a||(o?"Image":"Attachment")},void 0,!1,void 0,this),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o&&n.url&&t(Ae,{containerRef:I,filename:a||r("input.image"),onOpenChange:f,onScaleChange:d,open:u,scale:N,url:n.url},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function X({children:n,className:r,...l}){let m=h();if(!m.files.length)return null;return t("div",{className:v("flex w-full flex-wrap items-center gap-1",r),...l,children:m.files.map((c)=>t(T,{children:n(c)},c.id,!1,void 0,this))},void 0,!1,void 0,this)}export{W as PromptInputAttachment,X as PromptInputAttachments};
@@ -1 +1 @@
1
- import{ot,le,de,it,nt,_}from"../chunk-7tj0a2na.js";export{de as clipboardHasStringItem,nt as countControlCharsBeforeIndex,ot as normalizePastedImageFile,_ as sanitizeTextareaTargetValue,it as sanitizeTextareaValue,le as scanClipboardForImageFiles};
1
+ import{st,Ie,Me,lt,rt,F}from"../chunk-nx3k6k2p.js";export{Me as clipboardHasStringItem,rt as countControlCharsBeforeIndex,st as normalizePastedImageFile,F as sanitizeTextareaTargetValue,lt as sanitizeTextareaValue,Ie as scanClipboardForImageFiles};
@@ -1 +1 @@
1
- import{O,pt,B,gt,k,ce,C,ft,ht,z,p}from"../chunk-awbgf3hp.js";export{z as LocalAttachmentsContext,ht as PromptInputProvider,B as PromptInputSubmissionContext,O as PromptInputSubmitContext,k as ProviderAttachmentsContext,C as useOptionalPromptInputController,p as usePromptInputAttachments,ce as usePromptInputController,gt as usePromptInputSubmission,pt as usePromptInputSubmit,ft as useProviderAttachments};
1
+ import{X,Pt,Z,It,C,_e,T,Mt,Nt,Y,h}from"../chunk-twww750f.js";export{Y as LocalAttachmentsContext,Nt as PromptInputProvider,Z as PromptInputSubmissionContext,X as PromptInputSubmitContext,C as ProviderAttachmentsContext,T as useOptionalPromptInputController,h as usePromptInputAttachments,_e as usePromptInputController,It as usePromptInputSubmission,Pt as usePromptInputSubmit,Mt as useProviderAttachments};
@@ -1,3 +1,3 @@
1
- import"../chunk-r9k7kszp.js";import{ne}from"../chunk-jnx3t913.js";import{le,de,_}from"../chunk-7tj0a2na.js";import{C,p}from"../chunk-awbgf3hp.js";import{cn as A}from"cn";import{forwardRef as D,useCallback as M,useEffect as K,useImperativeHandle as L,useRef as d}from"react";import{jsxDEV as q}from"react/jsx-dev-runtime";var R=(i)=>!i.shiftKey,F=()=>!1,N=D(({onChange:i,onCompositionStart:v,onCompositionEnd:x,className:T,placeholder:y,bashMode:b=!1,isSendShortcut:E=R,isNewlineShortcut:I=F,...H},P)=>{let n=C(),l=p(),o=d(!1),u=d(!1),r=d(null),s=M(()=>{let e=r.current;if(!e||o.current)return;e.style.height="auto",e.style.height=`${e.scrollHeight}px`},[]);K(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(()=>{requestAnimationFrame(s)});return t.observe(e),()=>t.disconnect()},[s]);let c=b&&(n?.textInput.value??"").startsWith("!"),S=(e)=>{if(o.current||e.nativeEvent.isComposing||e.nativeEvent.keyCode===229||u.current)return;if(e.key.length===1&&e.key.charCodeAt(0)<32&&e.key!==`
2
- `&&e.key!=="\r"&&e.key!=="\t"){e.preventDefault();return}if(c&&n){let t=e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0;if(e.key==="Escape"||(e.key==="Backspace"||e.key==="Delete")&&t){e.preventDefault(),n.textInput.setInput(n.textInput.value.slice(1));return}}if(e.key==="Enter"){if(I(e.nativeEvent)){e.preventDefault();let t=e.currentTarget,{selectionStart:a,selectionEnd:f,value:m}=t,h=`${m.slice(0,a)}
3
- ${m.slice(f)}`;if(n)n.textInput.setInput(h);else t.value=h;let g=a+1;t.setSelectionRange(g,g),s();return}if(E(e.nativeEvent)){e.preventDefault();let t=e.currentTarget.form;if(!t)return;let a=t.querySelector('button[type="submit"]');if(!a||a.disabled)return;t.requestSubmit(a)}}if(e.key==="Backspace"&&e.currentTarget.value===""&&l.files.length>0){e.preventDefault();let t=l.files.at(-1);if(t)l.remove(t.id)}},k=(e)=>{let t=e.clipboardData?.items;if(!t)return;let{imageFiles:a,sawNonImageFile:f}=le(t),m=de(t);if(a.length>0)e.preventDefault(),l.add(a);else if(f&&!m)e.preventDefault()},w=n?{value:o.current&&r.current?r.current.value:c?n.textInput.value.slice(1):n.textInput.value,onChange:(e)=>{let t=o.current?e.currentTarget.value:_(e.currentTarget);n.textInput.setInput(c?`!${t}`:t),s(),i?.(e)}}:{onChange:(e)=>{if(!o.current)_(e.currentTarget);s(),i?.(e)}};return L(P,()=>({resetHeight:()=>{if(r.current)r.current.style.height="auto"},focus:()=>{r.current?.focus()},isComposing:()=>o.current||u.current,getTextarea:()=>r.current}),[]),q(ne,{"data-chat-input":!0,ref:r,rows:3,className:A("field-sizing-content max-h-(--chat-input-max-height) min-h-[calc(var(--chat-input-line-height)*3)] min-w-0 flex-1 overflow-x-hidden","leading-(--chat-input-line-height)","placeholder:text-chat-input-placeholder p-0 pe-2.5","bg-chat-input-bg",T),name:"message",onCompositionEnd:(e)=>{o.current=!1;let t=_(e.currentTarget);n?.textInput.setInput(c?`!${t}`:t),s(),x?.(e),u.current=!0,requestAnimationFrame(()=>{u.current=!1})},onCompositionStart:(e)=>{u.current=!1,o.current=!0,v?.(e)},onKeyDown:S,onPaste:k,placeholder:y,...H,...w},void 0,!1,void 0,this)});N.displayName="PromptInputTextarea";export{N as PromptInputTextarea};
1
+ import"../chunk-r9k7kszp.js";import{ne}from"../chunk-jnx3t913.js";import{Ie,Me,F}from"../chunk-nx3k6k2p.js";import{T,h}from"../chunk-twww750f.js";import{cn as A}from"cn";import{forwardRef as D,useCallback as M,useEffect as K,useImperativeHandle as L,useRef as f}from"react";import{jsxDEV as z}from"react/jsx-dev-runtime";var R=(i)=>!i.shiftKey,N=()=>!1,q=D(({onChange:i,onCompositionStart:v,onCompositionEnd:x,className:y,placeholder:b,bashMode:E=!1,isSendShortcut:I=R,isNewlineShortcut:C=N,...H},P)=>{let n=T(),l=h(),o=f(!1),u=f(!1),r=f(null),s=M(()=>{let e=r.current;if(!e||o.current)return;e.style.height="auto",e.style.height=`${e.scrollHeight}px`},[]);K(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(()=>{requestAnimationFrame(s)});return t.observe(e),()=>t.disconnect()},[s]);let c=E&&(n?.textInput.value??"").startsWith("!"),S=(e)=>{if(o.current||e.nativeEvent.isComposing||e.nativeEvent.keyCode===229||u.current)return;if(e.key.length===1&&e.key.charCodeAt(0)<32&&e.key!==`
2
+ `&&e.key!=="\r"&&e.key!=="\t"){e.preventDefault();return}if(c&&n){let t=e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0;if(e.key==="Escape"||(e.key==="Backspace"||e.key==="Delete")&&t){e.preventDefault(),n.textInput.setInput(n.textInput.value.slice(1));return}}if(e.key==="Enter"){if(C(e.nativeEvent)){e.preventDefault();let t=e.currentTarget,{selectionStart:a,selectionEnd:m,value:p}=t,d=`${p.slice(0,a)}
3
+ ${p.slice(m)}`;if(n)n.textInput.setInput(d);else t.value=d;let g=a+1;t.setSelectionRange(g,g),s();return}if(I(e.nativeEvent)){e.preventDefault();let t=e.currentTarget.form;if(!t)return;let a=t.querySelector('button[type="submit"]');if(!a||a.disabled)return;t.requestSubmit(a)}}if(e.key==="Backspace"&&e.currentTarget.value===""&&l.files.length>0){e.preventDefault();let t=l.files.at(-1);if(t)l.remove(t.id)}},k=(e)=>{let t=e.clipboardData?.items;if(!t)return;let{imageFiles:a,sawNonImageFile:m}=Ie(t),p=Me(t);if(a.length>0)e.preventDefault(),l.add(a);else if(m&&!p)e.preventDefault()},w=n?{value:o.current&&r.current?r.current.value:c?n.textInput.value.slice(1):n.textInput.value,onChange:(e)=>{let t=o.current?e.currentTarget.value:F(e.currentTarget);n.textInput.setInput(c?`!${t}`:t),s(),i?.(e)}}:{onChange:(e)=>{if(!o.current)F(e.currentTarget);s(),i?.(e)}};return L(P,()=>({resetHeight:()=>{if(r.current)r.current.style.height="auto"},focus:()=>{r.current?.focus()},isComposing:()=>o.current||u.current,getTextarea:()=>r.current}),[]),z(ne,{"data-chat-input":!0,ref:r,rows:3,className:A("field-sizing-content max-h-(--chat-input-max-height) min-h-[calc(var(--chat-input-line-height)*3)] min-w-0 flex-1 overflow-x-hidden","leading-(--chat-input-line-height)","placeholder:text-chat-input-placeholder p-0 pe-2.5","bg-chat-input-bg",y),name:"message",onCompositionEnd:(e)=>{o.current=!1;let t=F(e.currentTarget);n?.textInput.setInput(c?`!${t}`:t),s(),x?.(e),u.current=!0,requestAnimationFrame(()=>{u.current=!1})},onCompositionStart:(e)=>{u.current=!1,o.current=!0,v?.(e)},onKeyDown:S,onPaste:k,placeholder:b,...H,...w},void 0,!1,void 0,this)});q.displayName="PromptInputTextarea";export{q as PromptInputTextarea};
@@ -1 +1 @@
1
- import{Ze,ae}from"../chunk-reqrpvyy.js";import"../chunk-0e1pdbec.js";import{Ve}from"../chunk-src2j5cw.js";import"../chunk-7pr2j1zb.js";import"../chunk-r9k7kszp.js";import"../chunk-jnx3t913.js";import{ze,ee,te}from"../chunk-ghfbzhnb.js";import{O,B,k,C,z}from"../chunk-awbgf3hp.js";import{cn as P}from"cn";import{ArrowUpIcon as Ie,Loader2Icon as ye,SquareIcon as xe,XIcon as Le}from"lucide-react";import{Children as oe,useCallback as h,useEffect as F,useMemo as Te,useRef as M,useState as Fe}from"react";import{flushSync as Me}from"react-dom";import{jsxDEV as o}from"react/jsx-dev-runtime";function se(u){let s=new FormData(u).get("message");return typeof s==="string"?s:""}var De=({className:u,bashMode:s=!1,attachmentPolicy:I,onCommand:d,onSubmitError:y,canSubmit:f,onSubmitAsync:g,accept:E,multiple:ie,globalDrop:A,syncHiddenInput:G,maxFiles:D,maxFileSize:N,onError:b,onSubmit:ue,children:le,...pe})=>{let i=C(),l=!!i,me=s&&l&&i.textInput.value.startsWith("!"),x=M(null),w=M(null),R=M(!1),[ce,U]=Fe([]),c=l?i.attachments.files:ce,j=M(c);j.current=c;let de=h(()=>{x.current?.click()},[]),q=h((e)=>{if(!E||E.trim()==="")return!0;return E.split(",").map((t)=>t.trim()).filter(Boolean).some((t)=>{if(t.endsWith("/*")){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t})},[E]),X=h((e)=>{if(e.type)return e.type;let r=(e.name||"").toLowerCase();if(r.endsWith(".png"))return"image/png";if(r.endsWith(".jpg")||r.endsWith(".jpeg"))return"image/jpeg";if(r.endsWith(".webp"))return"image/webp";if(r.endsWith(".gif"))return"image/gif";if(r.endsWith(".bmp"))return"image/bmp";if(r.endsWith(".svg"))return"image/svg+xml";return""},[]),fe=h((e)=>{let r=[...e],t=r.filter((a)=>q(a));if(r.length&&t.length===0){b?.({code:"accept",message:"No files match the accepted types."});return}let n=(a)=>N?a.size<=N:!0,m=t.filter(n);if(t.length>0&&m.length===0){b?.({code:"max_file_size",message:"All files exceed the maximum size."});return}U((a)=>{let v=I?I.uniqueFiles(m,a):m,p=typeof D==="number"?Math.max(0,D-a.length):void 0,H=typeof p==="number"?v.slice(0,p):v;if(typeof p==="number"&&v.length>p)b?.({code:"max_files",message:"Too many files. Some were not added."});let re=[];for(let T of H){let ne=I?.sourcePath(T);re.push({id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(T),mediaType:X(T),filename:T.name,size:T.size,lastModified:T.lastModified,...ne===void 0?{}:{sourcePath:ne}})}return[...a,...re]})},[I,X,q,D,N,b]),ge=h((e)=>U((r)=>{let t=r.find((n)=>n.id===e);if(t?.url)URL.revokeObjectURL(t.url);return r.filter((n)=>n.id!==e)}),[]),be=h(()=>U((e)=>{for(let r of e)if(r.url)URL.revokeObjectURL(r.url);return[]}),[]),J=l?i.attachments.add:fe,L=h((e)=>{let r=[...e],t=r.filter((m)=>!(m.type??"").toLowerCase().startsWith("image/"));if(t.length>0){b?.({code:"unsupported_type",message:`Only image attachments are supported. ${t.length} non-image file(s) were ignored.`});return}let n=r.reduce((m,a)=>m+a.size,0);if(n>0){let m=c.filter((a)=>(a.mediaType??"").toLowerCase().startsWith("image/")).reduce((a,v)=>a+(v.size??0),0);if(Ze(m,n)){b?.({code:"max_total_size",message:`Total image size must not exceed ${ae}MB.`});return}}J(r)},[c,J,b]),K=l?i.attachments.remove:ge,W=l?i.attachments.clear:be,Q=l?i.attachments.openFileDialog:de;F(()=>{if(!l)return;i.__registerFileInput(x,()=>x.current?.click())},[l,i]),F(()=>{if(G&&x.current&&c.length===0)x.current.value=""},[c,G]),F(()=>{let e=w.current;if(!e)return;if(A)return;let r=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault()},t=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault();if(n.dataTransfer?.files&&n.dataTransfer.files.length>0)L(n.dataTransfer.files)};return e.addEventListener("dragover",r),e.addEventListener("drop",t),()=>{e.removeEventListener("dragover",r),e.removeEventListener("drop",t)}},[L,A]),F(()=>{if(!A)return;let e=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault()},r=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault();if(t.dataTransfer?.files&&t.dataTransfer.files.length>0)L(t.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",r),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",r)}},[L,A]),F(()=>()=>{if(!l){for(let e of j.current)if(e.url)URL.revokeObjectURL(e.url)}},[l]);let ve=(e)=>{if(e.currentTarget.files)L(e.currentTarget.files);e.currentTarget.value=""},V=Te(()=>({files:c.map((e)=>({...e,id:e.id})),add:L,remove:K,clear:W,openFileDialog:Q,fileInputRef:x}),[c,L,K,W,Q]),S=M({controller:i,files:c,canSubmit:f});S.current={controller:i,files:c,canSubmit:f};let _=M(!0);F(()=>(_.current=!0,()=>{_.current=!1}),[]);let Y=async(e)=>{let r=f===void 0?!0:f();if(r!==!0)return{status:"blocked",reason:r};if(R.current)return{status:"blocked",reason:"submission_pending"};if(e===null&&g===void 0)throw Error("Awaitable submission requires onSubmitAsync");let t=w.current;if(t===null)return{status:"blocked",reason:"form_unmounted"};let n=l?i.textInput.value:se(t),m=i?.textInput.getRevision?.(),a=c,v=()=>{if(!_.current)return;let p=S.current;if(p.files!==a)return;if(l){if(m===void 0||p.controller===null||p.controller.textInput.getRevision?.()!==m)return;if(p.controller.textInput.clearSubmitted===void 0)p.controller.textInput.clear();else p.controller.textInput.clearSubmitted()}else if(se(t)===n)t.reset();W()};R.current=!0;try{if(d?.(n.trim()))return v(),{status:"accepted"};let p=await Ve(a),H=S.current.canSubmit===void 0?!0:S.current.canSubmit();if(H!==!0)return{status:"blocked",reason:H};if(!_.current)return{status:"blocked",reason:"form_unmounted"};if(p.rejectedCount>0)b?.({code:"accept",message:"One or more images are corrupted and were removed before sending."});if(g!==void 0)await g({text:n,files:p.files});else if(e!==null)await ue({text:n,files:p.files},e);return v(),{status:"accepted"}}finally{R.current=!1}},he=(e)=>{e.preventDefault(),Y(e).catch(y)},Pe=h((e)=>{if(!e.trim())return;if(l&&i)Me(()=>{i.textInput.setInput(e)});w.current?.requestSubmit()},[i,l]),Z=o(B.Provider,{value:()=>Y(null),children:o(O.Provider,{value:Pe,children:[o("input",{accept:E,"aria-label":"Upload files",className:"hidden",multiple:ie,onChange:ve,ref:x,title:"Upload files",type:"file"},void 0,!1,void 0,this),o("form",{className:P("w-full",u),onSubmit:he,ref:w,"data-tour":"chat-input",...pe,children:o(ze,{className:P("codex-composer-surface overflow-y-auto has-[[data-slot=input-group-control]:focus-visible]:ring-0",me&&"border! border-[rgb(255,0,135)] has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(255,0,135)] dark:border-[rgb(253,93,177)] dark:has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(253,93,177)]"),children:le},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return l?o(k.Provider,{value:V,children:Z},void 0,!1,void 0,this):o(z.Provider,{value:V,children:Z},void 0,!1,void 0,this)};function Ne({className:u,...s}){return o("div",{className:P("flex w-full min-w-0 flex-row items-end gap-2",u),...s},void 0,!1,void 0,this)}function Re({className:u,...s}){return o(ee,{align:"block-end",className:P("order-first flex-wrap gap-1 p-2 pb-1.5",u),...s},void 0,!1,void 0,this)}function Ue({className:u,...s}){return o(ee,{align:"block-end",className:P("mt-3.5 justify-between gap-1 p-0",u),...s},void 0,!1,void 0,this)}function Be({className:u,...s}){return o("div",{className:P("flex items-center gap-1",u),...s},void 0,!1,void 0,this)}var Oe=({variant:u="ghost",className:s,size:I,collapsed:d=!1,...y})=>{let f=d||oe.count(y.children)<=1?"icon-xs":"xs";return o(te,{className:P("h-7 rounded-full text-xs font-medium hover:bg-transparent dark:hover:bg-transparent",(d||oe.count(y.children)<=1)&&"size-7",s),size:f,type:"button",variant:u,...y},void 0,!1,void 0,this)},We=({className:u,variant:s="ghost",size:I="icon-xs",status:d,children:y,...f})=>{let g=o(Ie,{className:"size-4"},void 0,!1,void 0,this);if(d==="submitted")g=o(ye,{className:"size-4 animate-spin"},void 0,!1,void 0,this);else if(d==="streaming")g=o(xe,{className:"size-3 fill-current"},void 0,!1,void 0,this);else if(d==="error")g=o(Le,{className:"size-4"},void 0,!1,void 0,this);return o(te,{"aria-label":"Submit",className:P("bg-foreground text-background hover:bg-foreground/70 size-7 rounded-full p-0 transition-opacity disabled:opacity-50",u),size:I,type:"submit",variant:s,...f,children:y??g},void 0,!1,void 0,this)};export{ae as MAX_TOTAL_IMAGE_MB,De as PromptInput,Ne as PromptInputBody,Oe as PromptInputButton,Ue as PromptInputFooter,Re as PromptInputHeader,We as PromptInputSubmit,Be as PromptInputTools};
1
+ import{Se,j}from"../chunk-wbpw278r.js";import"../chunk-ta690ra0.js";import{Ne}from"../chunk-98t2nc02.js";import"../chunk-xgy0heva.js";import"../chunk-r9k7kszp.js";import"../chunk-jnx3t913.js";import{Qe,ee,te}from"../chunk-pkxfrrwf.js";import{X,Z,C,T,Y}from"../chunk-twww750f.js";import{cn as P}from"cn";import{ArrowUpIcon as Ie,Loader2Icon as ye,SquareIcon as xe,XIcon as Le}from"lucide-react";import{Children as se,useCallback as h,useEffect as M,useMemo as Te,useRef as E,useState as Fe}from"react";import{flushSync as Me}from"react-dom";import{jsxDEV as o}from"react/jsx-dev-runtime";function ie(u){let s=new FormData(u).get("message");return typeof s==="string"?s:""}var De=({className:u,bashMode:s=!1,attachmentPolicy:I,onCommand:d,onSubmitError:y,canSubmit:f,onSubmitAsync:g,accept:A,multiple:ae,globalDrop:w,syncHiddenInput:B,maxFiles:k,maxFileSize:D,onError:b,onSubmit:ue,children:le,...pe})=>{let i=T(),l=!!i,me=s&&l&&i.textInput.value.startsWith("!"),x=E(null),S=E(null),N=E(!1),[ce,R]=Fe([]),c=l?i.attachments.files:ce,O=E(c);O.current=c;let de=h(()=>{x.current?.click()},[]),W=h((e)=>{if(!A||A.trim()==="")return!0;return A.split(",").map((t)=>t.trim()).filter(Boolean).some((t)=>{if(t.endsWith("/*")){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t})},[A]),G=h((e)=>{if(e.type)return e.type;let r=(e.name||"").toLowerCase();if(r.endsWith(".png"))return"image/png";if(r.endsWith(".jpg")||r.endsWith(".jpeg"))return"image/jpeg";if(r.endsWith(".webp"))return"image/webp";if(r.endsWith(".gif"))return"image/gif";if(r.endsWith(".bmp"))return"image/bmp";if(r.endsWith(".svg"))return"image/svg+xml";return""},[]),fe=h((e)=>{let r=[...e],t=r.filter((a)=>W(a));if(r.length&&t.length===0){b?.({code:"accept",message:"No files match the accepted types."});return}let n=(a)=>D?a.size<=D:!0,m=t.filter(n);if(t.length>0&&m.length===0){b?.({code:"max_file_size",message:"All files exceed the maximum size."});return}R((a)=>{let v=I?I.uniqueFiles(m,a):m,p=typeof k==="number"?Math.max(0,k-a.length):void 0,H=typeof p==="number"?v.slice(0,p):v;if(typeof p==="number"&&v.length>p)b?.({code:"max_files",message:"Too many files. Some were not added."});let ne=[];for(let F of H){let oe=I?.sourcePath(F);ne.push({id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(F),mediaType:G(F),filename:F.name,size:F.size,lastModified:F.lastModified,...oe===void 0?{}:{sourcePath:oe}})}return[...a,...ne]})},[I,G,W,k,D,b]),ge=h((e)=>R((r)=>{let t=r.find((n)=>n.id===e);if(t?.url)URL.revokeObjectURL(t.url);return r.filter((n)=>n.id!==e)}),[]),be=h(()=>R((e)=>{for(let r of e)if(r.url)URL.revokeObjectURL(r.url);return[]}),[]),q=l?i.attachments.add:fe,L=h((e)=>{let r=[...e],t=r.filter((m)=>!(m.type??"").toLowerCase().startsWith("image/"));if(t.length>0){b?.({code:"unsupported_type",message:`Only image attachments are supported. ${t.length} non-image file(s) were ignored.`});return}let n=r.reduce((m,a)=>m+a.size,0);if(n>0){let m=c.filter((a)=>(a.mediaType??"").toLowerCase().startsWith("image/")).reduce((a,v)=>a+(v.size??0),0);if(Se(m,n)){b?.({code:"max_total_size",message:`Total image size must not exceed ${j}MB.`});return}}q(r)},[c,q,b]),J=l?i.attachments.remove:ge,U=l?i.attachments.clear:be,K=l?i.attachments.openFileDialog:de;M(()=>{if(!l)return;i.__registerFileInput(x,()=>x.current?.click())},[l,i]),M(()=>{if(B&&x.current&&c.length===0)x.current.value=""},[c,B]),M(()=>{let e=S.current;if(!e)return;if(w)return;let r=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault()},t=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault();if(n.dataTransfer?.files&&n.dataTransfer.files.length>0)L(n.dataTransfer.files)};return e.addEventListener("dragover",r),e.addEventListener("drop",t),()=>{e.removeEventListener("dragover",r),e.removeEventListener("drop",t)}},[L,w]),M(()=>{if(!w)return;let e=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault()},r=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault();if(t.dataTransfer?.files&&t.dataTransfer.files.length>0)L(t.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",r),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",r)}},[L,w]),M(()=>()=>{if(!l){for(let e of O.current)if(e.url)URL.revokeObjectURL(e.url)}},[l]);let ve=(e)=>{if(e.currentTarget.files)L(e.currentTarget.files);e.currentTarget.value=""},Q=Te(()=>({files:c.map((e)=>({...e,id:e.id})),add:L,remove:J,clear:U,openFileDialog:K,fileInputRef:x}),[c,L,J,U,K]),_=E({controller:i,files:c,canSubmit:f});_.current={controller:i,files:c,canSubmit:f};let z=E(!0);M(()=>(z.current=!0,()=>{z.current=!1}),[]);let V=async(e)=>{let r=f===void 0?!0:f();if(r!==!0)return{status:"blocked",reason:r};if(N.current)return{status:"blocked",reason:"submission_pending"};if(e===null&&g===void 0)throw Error("Awaitable submission requires onSubmitAsync");let t=S.current;if(t===null)return{status:"blocked",reason:"form_unmounted"};let n=l?i.textInput.value:ie(t),m=i?.textInput.getRevision?.(),a=c,v=()=>{if(!z.current)return;let p=_.current;if(p.files!==a)return;if(l){if(m===void 0||p.controller===null||p.controller.textInput.getRevision?.()!==m)return;if(p.controller.textInput.clearSubmitted===void 0)p.controller.textInput.clear();else p.controller.textInput.clearSubmitted()}else if(ie(t)===n)t.reset();U()};N.current=!0;try{if(d?.(n.trim()))return v(),{status:"accepted"};let p=await Ne(a),H=_.current.canSubmit===void 0?!0:_.current.canSubmit();if(H!==!0)return{status:"blocked",reason:H};if(!z.current)return{status:"blocked",reason:"form_unmounted"};if(p.rejectedCount>0)b?.({code:"accept",message:"One or more images are corrupted and were removed before sending."});if(g!==void 0)await g({text:n,files:p.files});else if(e!==null)await ue({text:n,files:p.files},e);return v(),{status:"accepted"}}finally{N.current=!1}},he=(e)=>{e.preventDefault(),V(e).catch(y)},Pe=h((e)=>{if(!e.trim())return;if(l&&i)Me(()=>{i.textInput.setInput(e)});S.current?.requestSubmit()},[i,l]),re=o(Z.Provider,{value:()=>V(null),children:o(X.Provider,{value:Pe,children:[o("input",{accept:A,"aria-label":"Upload files",className:"hidden",multiple:ae,onChange:ve,ref:x,title:"Upload files",type:"file"},void 0,!1,void 0,this),o("form",{className:P("w-full",u),onSubmit:he,ref:S,"data-tour":"chat-input",...pe,children:o(Qe,{className:P("codex-composer-surface overflow-y-auto has-[[data-slot=input-group-control]:focus-visible]:ring-0",me&&"border! border-[rgb(255,0,135)] has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(255,0,135)] dark:border-[rgb(253,93,177)] dark:has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(253,93,177)]"),children:le},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return l?o(C.Provider,{value:Q,children:re},void 0,!1,void 0,this):o(Y.Provider,{value:Q,children:re},void 0,!1,void 0,this)};function Re({className:u,...s}){return o("div",{className:P("flex w-full min-w-0 flex-row items-end gap-2",u),...s},void 0,!1,void 0,this)}function Ue({className:u,...s}){return o(ee,{align:"block-end",className:P("order-first flex-wrap gap-1 p-2 pb-1.5",u),...s},void 0,!1,void 0,this)}function Be({className:u,...s}){return o(ee,{align:"block-end",className:P("mt-3.5 justify-between gap-1 p-0",u),...s},void 0,!1,void 0,this)}function Oe({className:u,...s}){return o("div",{className:P("flex items-center gap-1",u),...s},void 0,!1,void 0,this)}var We=({variant:u="ghost",className:s,size:I,collapsed:d=!1,...y})=>{let f=d||se.count(y.children)<=1?"icon-xs":"xs";return o(te,{className:P("h-7 rounded-full text-xs font-medium hover:bg-transparent dark:hover:bg-transparent",(d||se.count(y.children)<=1)&&"size-7",s),size:f,type:"button",variant:u,...y},void 0,!1,void 0,this)},Ge=({className:u,variant:s="ghost",size:I="icon-xs",status:d,children:y,...f})=>{let g=o(Ie,{className:"size-4"},void 0,!1,void 0,this);if(d==="submitted")g=o(ye,{className:"size-4 animate-spin"},void 0,!1,void 0,this);else if(d==="streaming")g=o(xe,{className:"size-3 fill-current"},void 0,!1,void 0,this);else if(d==="error")g=o(Le,{className:"size-4"},void 0,!1,void 0,this);return o(te,{"aria-label":"Submit",className:P("bg-foreground text-background hover:bg-foreground/70 size-7 rounded-full p-0 transition-opacity disabled:opacity-50",u),size:I,type:"submit",variant:s,...f,children:y??g},void 0,!1,void 0,this)};export{j as MAX_TOTAL_IMAGE_MB,De as PromptInput,Re as PromptInputBody,We as PromptInputButton,Be as PromptInputFooter,Ue as PromptInputHeader,Ge as PromptInputSubmit,Oe as PromptInputTools};
@@ -1 +1 @@
1
- import{ke}from"./chunk-8bdd6q4w.js";export{ke as ImageLightbox};
1
+ import{Re}from"./chunk-d1xydh51.js";export{Re as ImageLightbox};
@@ -1 +1 @@
1
- import{Ke}from"./chunk-74phx7h8.js";import"./chunk-s0nhgptn.js";import"./chunk-7pr2j1zb.js";import"./chunk-qj8r5xvx.js";export{Ke as ImagePreviewDialog};
1
+ import{Ae}from"./chunk-51qk29t6.js";import"./chunk-wf194rae.js";import"./chunk-2kjmc9hg.js";import"./chunk-xgy0heva.js";export{Ae as ImagePreviewDialog};
@@ -1 +1 @@
1
- import{tt}from"../chunk-25na55ve.js";export{tt as createCodeHighlighter};
1
+ import{ke}from"../chunk-kew8ef6z.js";export{ke as createCodeHighlighter};
package/dist/lib/fuzzy.js CHANGED
@@ -1 +1 @@
1
- import{se,Je}from"../chunk-hnt4tt1n.js";export{Je as fuzzyFilter,se as fuzzyMatch};
1
+ import{G,Pe}from"../chunk-z3gwnjmk.js";export{Pe as fuzzyFilter,G as fuzzyMatch};
@@ -1 +1 @@
1
- import{Ue}from"../chunk-s3z33k7f.js";import"../chunk-y2xbq7rb.js";export{Ue as groupBlocksForStyle};
1
+ import{fe}from"../chunk-7471tnsq.js";import"../chunk-nvtvm7jc.js";export{fe as groupBlocksForStyle};
@@ -1 +1 @@
1
- import{Qe}from"../chunk-0e1pdbec.js";export{Qe as convertBlobUrlToDataUrl};
1
+ import{Ee}from"../chunk-ta690ra0.js";export{Ee as convertBlobUrlToDataUrl};
@@ -1 +1 @@
1
- import{At,Ft,Ze,Dt,ae}from"../chunk-reqrpvyy.js";export{At as BYTES_PER_MB,Ft as MAX_TOTAL_IMAGE_BYTES,ae as MAX_TOTAL_IMAGE_MB,Ze as exceedsImageLimit,Dt as formatImageSizeMb};
1
+ import{kt,Ct,Se,Tt,j}from"../chunk-wbpw278r.js";export{kt as BYTES_PER_MB,Ct as MAX_TOTAL_IMAGE_BYTES,j as MAX_TOTAL_IMAGE_MB,Se as exceedsImageLimit,Tt as formatImageSizeMb};
@@ -1 +1 @@
1
- import{ie,Xe}from"../chunk-g20b01rn.js";export{ie as cachedMarkdown,Xe as createMarkdownParser};
1
+ import{K,we}from"../chunk-tm40sncc.js";export{K as cachedMarkdown,we as createMarkdownParser};
@@ -1 +1 @@
1
- import{$e,re}from"../chunk-9me7jmzd.js";export{$e as createChatMarkdown,re as isSafeMarkdownUrl};
1
+ import{Ce,W}from"../chunk-aaybyhdj.js";export{Ce as createChatMarkdown,W as isSafeMarkdownUrl};
@@ -1 +1 @@
1
- import{oe}from"../chunk-p9wpghey.js";export{oe as formatModelName};
1
+ import{V}from"../chunk-eyn3tdcs.js";export{V as formatModelName};
@@ -1 +1 @@
1
- import{Ye}from"../chunk-qj8r5xvx.js";export{Ye as getPointerCenteredScrollPosition};
1
+ import{Fe}from"../chunk-wf194rae.js";export{Fe as getPointerCenteredScrollPosition};
@@ -1 +1 @@
1
- import{Ve}from"../chunk-src2j5cw.js";import"../chunk-0e1pdbec.js";export{Ve as preparePromptFiles};
1
+ import{Ne}from"../chunk-98t2nc02.js";import"../chunk-ta690ra0.js";export{Ne as preparePromptFiles};
@@ -1 +1 @@
1
- import{Ht,et,mt,d,Ot}from"../chunk-y2xbq7rb.js";export{Ht as STREAM_STYLES,mt as TOOL_CATEGORIES,d as describeToolUse,et as isCodexLook,Ot as toolDotClass};
1
+ import{vt,ve,ot,l,bt}from"../chunk-nvtvm7jc.js";export{vt as STREAM_STYLES,ot as TOOL_CATEGORIES,l as describeToolUse,ve as isCodexLook,bt as toolDotClass};
@@ -1,2 +1,2 @@
1
- import{$e}from"../chunk-9me7jmzd.js";function T(e,o){let t=Object.keys(e);return t.length===Object.keys(o).length&&t.every((r)=>{let i=o[r];return e[r].href===i?.href&&e[r].title===i.title})}function b(e,o){let t=2,r=0;for(let n=e.length-1;n>=0;n-=1){if(e[n].type==="space")continue;if(t-=1,t===0){r=n;break}}let i=0;for(let n=0;n<r;n+=1){let l=e[n];if(l.type==="def"||/^ {0,3}(?:\[|<|\$\$|\\\[)/.test(l.raw))return i;let k=!1;if(o.walkTokens([e[n]],(a)=>{if(a.type==="html"&&(("inLink"in a)&&a.inLink||("inRawBlock"in a)&&a.inRawBlock))k=!0}),k)return i;if(/\n[\t ]*\n$/.test(e[n].raw))i=n+1}return i}function L(e=$e()){let o="",t=[],r={},i={};return{parse(n){let l=n.replaceAll(/\r\n|\r/g,`
1
+ import{Ce}from"../chunk-aaybyhdj.js";function T(e,o){let t=Object.keys(e);return t.length===Object.keys(o).length&&t.every((r)=>{let i=o[r];return e[r].href===i?.href&&e[r].title===i.title})}function b(e,o){let t=2,r=0;for(let n=e.length-1;n>=0;n-=1){if(e[n].type==="space")continue;if(t-=1,t===0){r=n;break}}let i=0;for(let n=0;n<r;n+=1){let l=e[n];if(l.type==="def"||/^ {0,3}(?:\[|<|\$\$|\\\[)/.test(l.raw))return i;let k=!1;if(o.walkTokens([e[n]],(a)=>{if(a.type==="html"&&(("inLink"in a)&&a.inLink||("inRawBlock"in a)&&a.inRawBlock))k=!0}),k)return i;if(/\n[\t ]*\n$/.test(e[n].raw))i=n+1}return i}function L(e=Ce()){let o="",t=[],r={},i={};return{parse(n){let l=n.replaceAll(/\r\n|\r/g,`
2
2
  `);if(!l.startsWith(o))o="",t=[],r={},i={};let k=new e.Lexer(e.defaults);k.tokens.links={...r};let a=k.lex(l.slice(o.length)),f=[...t,...a],u=a.links;if(t.length>0&&!T(i,u)){let s=e.lexer(l);f=[...s],u=s.links}i=u;let h=0,d=[];for(let s of f){if(!l.startsWith(s.raw,h))break;d.push(s),h+=s.raw.length}return t=d.slice(0,b(d,e)),o=l.slice(0,t.reduce((s,c)=>s+c.raw.length,0)),r=Object.create(null),e.walkTokens(t,(s)=>{if(s.type!=="def")return;let c=s;if(!Object.hasOwn(r,c.tag))r[c.tag]={href:c.href,title:c.title}}),structuredClone(f)}}}export{L as createStreamingMarkdownLexer};
@@ -1 +1 @@
1
- import{e}from"../chunk-7pr2j1zb.js";import"../chunk-m8gejgjs.js";import{ve}from"../chunk-70sfgw0j.js";import"../chunk-qyhgwc51.js";import{A}from"../chunk-rakd7vzb.js";import{cn as Y}from"cn";import{SearchIcon as Z}from"lucide-react";import{useCallback as _,useEffect as g,useMemo as z,useRef as v,useState as R}from"react";import{jsxDEV as y,Fragment as et}from"react/jsx-dev-runtime";var D="chat-search",F="chat-search-current",U=150;function it(o){let r=o??"";return[...document.querySelectorAll("[data-chat-scroll]")].find((l)=>l.dataset.chatScroll===r)??null}var j=12;function J(o,r="center"){let l=o.closest("[data-chat-scroll]");if(!l)return;let d=o.getBoundingClientRect(),m=l.getBoundingClientRect(),x=r==="start"?j:(l.clientHeight-d.height)/2;l.scrollTo({top:l.scrollTop+(d.top-m.top)-x,behavior:"smooth"})}function q(o){let r=o.startContainer.parentElement;if(!r)return;J(r)}var T=new Map;function Q(){if(typeof CSS>"u"||!("highlights"in CSS)||typeof Highlight>"u")return;if(T.size===0){CSS.highlights.delete(D),CSS.highlights.delete(F);return}let o=[...T.values()];CSS.highlights.set(D,new Highlight(...o.flatMap((r)=>r.all))),CSS.highlights.set(F,new Highlight(...o.flatMap((r)=>r.current?[r.current]:[])))}function tt(){let o=Symbol();return{clearHighlights:()=>{T.delete(o),Q()},applyHighlights:(r,l)=>{T.set(o,{all:r,current:l}),Q()}}}function ut({getViewport:o,findSourceMatches:r,revealTurn:l,subscribeOpen:d,labels:m,placement:x="header"}){let{clearHighlights:i,applyHighlights:p}=z(tt,[]),S=r!==void 0,[s,w]=R(!1),[u,K]=R(""),h=z(()=>s&&u.trim()&&r?r(u.trim()):[],[r,s,u]),[O,L]=R(0),[V,E]=R(0),C=v([]),H=v(0),a=v(null),P=v(null),G=v(null);g(()=>{if(!d)return;return d(()=>{w(!0);let t=G.current;if(t!==null)t.focus(),t.select()})},[d]);let I=_(async(c,t)=>{let n=h[c];if(n===void 0)return;let f=o();if(f===null)throw Error("Chat scroll container is missing");if(l)await l(n.turnKey,t);if(t.aborted)return;let b=f.querySelector(`[data-turn-key="${CSS.escape(n.turnKey)}"]`);if(b===null)throw Error(`Codex turn is missing: ${n.turnKey}`);if(!l)J(b,"start");if(await new Promise((X)=>requestAnimationFrame(()=>X())),t.aborted)return;let B=A(b,u.trim());C.current=B;let N=B[n.occurrenceInTurn];if(p(B,N??null),N!==void 0)q(N)},[p,h,o,u,l]),k=v(I);g(()=>{k.current=I},[I]);let M=_(()=>{w(!1),K(""),H.current=0,a.current?.abort(),a.current=null,i(),C.current=[]},[i]);g(()=>{if(!s)return;let c=(t)=>{if(t.key==="Escape"&&P.current?.contains(document.activeElement))t.preventDefault(),M()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s,M]),g(()=>{if(!s||!u.trim()){i(),C.current=[],L(0),E(0),H.current=0;return}let c=setTimeout(()=>{if(S)return;let t=o();if(!t)return;let n=A(t,u);if(C.current=n,L(n.length),E(0),p(n,n[0]??null),n[0])q(n[0])},U);return()=>{clearTimeout(c),i()}},[p,i,S,s,u,o]),g(()=>{if(!s||!S||!u.trim())return;let c=new AbortController;a.current?.abort(),a.current=c;let t=setTimeout(()=>{C.current=[],H.current=0,L(h.length),E(0),i(),k.current(0,c.signal)},U);return()=>{if(c.abort(),a.current===c)a.current=null;clearTimeout(t),i()}},[i,h.length,S,s,u]),g(()=>()=>{a.current?.abort(),i()},[i]),g(()=>{if(!s)i()},[i,s]);let W=_((c)=>{if(S){if(h.length===0)return;let n=(H.current+(c?-1:1)+h.length)%h.length;H.current=n,E(n),a.current?.abort();let f=new AbortController;a.current=f,k.current(n,f.signal);return}let t=C.current;if(!t.length)return;E((n)=>{let f=(n+(c?-1:1)+t.length)%t.length,b=t[f];return p(t,b),q(b),f})},[p,h.length,S]);return y(et,{children:[x==="header"&&y(e,{variant:"ghost",size:"icon-sm",title:m.search,onClick:()=>s?M():w(!0),children:y(Z,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),s&&y("div",{"data-chat-search":!0,ref:P,className:Y("bg-background border-b",x==="body"?"relative shrink-0":"absolute inset-x-0 top-full z-30"),children:[y(ve,{ref:G,value:u,onChange:K,onFind:W,onClose:M,placeholder:m.placeholder,prevTitle:m.previous,nextTitle:m.next},void 0,!1,void 0,this),u.trim()&&y("div",{className:"text-muted-foreground border-border border-t px-3 py-1 text-[11px]",children:O===0?"0 / 0":`${V+1} / ${O}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{ut as ChatSearch,A as collectMatches,it as findChatScrollContainer,J as scrollChatElementIntoView};
1
+ import{e}from"../chunk-xgy0heva.js";import"../chunk-ake02dgs.js";import{ce}from"../chunk-9cdspnb1.js";import"../chunk-11n6ah6p.js";import{A}from"../chunk-h7y6vmb3.js";import{cn as Y}from"cn";import{SearchIcon as Z}from"lucide-react";import{useCallback as _,useEffect as g,useMemo as z,useRef as v,useState as R}from"react";import{jsxDEV as y,Fragment as et}from"react/jsx-dev-runtime";var D="chat-search",F="chat-search-current",U=150;function it(o){let r=o??"";return[...document.querySelectorAll("[data-chat-scroll]")].find((l)=>l.dataset.chatScroll===r)??null}var j=12;function J(o,r="center"){let l=o.closest("[data-chat-scroll]");if(!l)return;let d=o.getBoundingClientRect(),m=l.getBoundingClientRect(),x=r==="start"?j:(l.clientHeight-d.height)/2;l.scrollTo({top:l.scrollTop+(d.top-m.top)-x,behavior:"smooth"})}function q(o){let r=o.startContainer.parentElement;if(!r)return;J(r)}var T=new Map;function Q(){if(typeof CSS>"u"||!("highlights"in CSS)||typeof Highlight>"u")return;if(T.size===0){CSS.highlights.delete(D),CSS.highlights.delete(F);return}let o=[...T.values()];CSS.highlights.set(D,new Highlight(...o.flatMap((r)=>r.all))),CSS.highlights.set(F,new Highlight(...o.flatMap((r)=>r.current?[r.current]:[])))}function tt(){let o=Symbol();return{clearHighlights:()=>{T.delete(o),Q()},applyHighlights:(r,l)=>{T.set(o,{all:r,current:l}),Q()}}}function ut({getViewport:o,findSourceMatches:r,revealTurn:l,subscribeOpen:d,labels:m,placement:x="header"}){let{clearHighlights:i,applyHighlights:p}=z(tt,[]),S=r!==void 0,[s,w]=R(!1),[u,K]=R(""),h=z(()=>s&&u.trim()&&r?r(u.trim()):[],[r,s,u]),[O,L]=R(0),[V,E]=R(0),C=v([]),H=v(0),a=v(null),P=v(null),G=v(null);g(()=>{if(!d)return;return d(()=>{w(!0);let t=G.current;if(t!==null)t.focus(),t.select()})},[d]);let I=_(async(c,t)=>{let n=h[c];if(n===void 0)return;let f=o();if(f===null)throw Error("Chat scroll container is missing");if(l)await l(n.turnKey,t);if(t.aborted)return;let b=f.querySelector(`[data-turn-key="${CSS.escape(n.turnKey)}"]`);if(b===null)throw Error(`Codex turn is missing: ${n.turnKey}`);if(!l)J(b,"start");if(await new Promise((X)=>requestAnimationFrame(()=>X())),t.aborted)return;let B=A(b,u.trim());C.current=B;let N=B[n.occurrenceInTurn];if(p(B,N??null),N!==void 0)q(N)},[p,h,o,u,l]),k=v(I);g(()=>{k.current=I},[I]);let M=_(()=>{w(!1),K(""),H.current=0,a.current?.abort(),a.current=null,i(),C.current=[]},[i]);g(()=>{if(!s)return;let c=(t)=>{if(t.key==="Escape"&&P.current?.contains(document.activeElement))t.preventDefault(),M()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s,M]),g(()=>{if(!s||!u.trim()){i(),C.current=[],L(0),E(0),H.current=0;return}let c=setTimeout(()=>{if(S)return;let t=o();if(!t)return;let n=A(t,u);if(C.current=n,L(n.length),E(0),p(n,n[0]??null),n[0])q(n[0])},U);return()=>{clearTimeout(c),i()}},[p,i,S,s,u,o]),g(()=>{if(!s||!S||!u.trim())return;let c=new AbortController;a.current?.abort(),a.current=c;let t=setTimeout(()=>{C.current=[],H.current=0,L(h.length),E(0),i(),k.current(0,c.signal)},U);return()=>{if(c.abort(),a.current===c)a.current=null;clearTimeout(t),i()}},[i,h.length,S,s,u]),g(()=>()=>{a.current?.abort(),i()},[i]),g(()=>{if(!s)i()},[i,s]);let W=_((c)=>{if(S){if(h.length===0)return;let n=(H.current+(c?-1:1)+h.length)%h.length;H.current=n,E(n),a.current?.abort();let f=new AbortController;a.current=f,k.current(n,f.signal);return}let t=C.current;if(!t.length)return;E((n)=>{let f=(n+(c?-1:1)+t.length)%t.length,b=t[f];return p(t,b),q(b),f})},[p,h.length,S]);return y(et,{children:[x==="header"&&y(e,{variant:"ghost",size:"icon-sm",title:m.search,onClick:()=>s?M():w(!0),children:y(Z,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),s&&y("div",{"data-chat-search":!0,ref:P,className:Y("bg-background border-b",x==="body"?"relative shrink-0":"absolute inset-x-0 top-full z-30"),children:[y(ce,{ref:G,value:u,onChange:K,onFind:W,onClose:M,placeholder:m.placeholder,prevTitle:m.previous,nextTitle:m.next},void 0,!1,void 0,this),u.trim()&&y("div",{className:"text-muted-foreground border-border border-t px-3 py-1 text-[11px]",children:O===0?"0 / 0":`${V+1} / ${O}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{ut as ChatSearch,A as collectMatches,it as findChatScrollContainer,J as scrollChatElementIntoView};
@@ -1 +1 @@
1
- import{A}from"../chunk-rakd7vzb.js";import"../chunk-qyhgwc51.js";export{A as collectMatches};
1
+ import{A}from"../chunk-h7y6vmb3.js";import"../chunk-11n6ah6p.js";export{A as collectMatches};
@@ -1 +1 @@
1
- import{ve}from"../chunk-70sfgw0j.js";import"../chunk-m8gejgjs.js";import"../chunk-7pr2j1zb.js";export{ve as FindBar};
1
+ import{ce}from"../chunk-9cdspnb1.js";import"../chunk-ake02dgs.js";import"../chunk-xgy0heva.js";export{ce as FindBar};
@@ -1 +1 @@
1
- import{q,yt}from"../chunk-qyhgwc51.js";export{yt as findTextSourceMatches,q as literalMatches};
1
+ import{B,ft}from"../chunk-11n6ah6p.js";export{ft as findTextSourceMatches,B as literalMatches};
package/dist/ui/badge.js CHANGED
@@ -1 +1 @@
1
- import{lt,Ae}from"../chunk-341yykkp.js";export{Ae as Badge,lt as badgeVariants};
1
+ import{ut,ze}from"../chunk-y1cbwywe.js";export{ze as Badge,ut as badgeVariants};
package/dist/ui/button.js CHANGED
@@ -1 +1 @@
1
- import{ut,e}from"../chunk-7pr2j1zb.js";export{e as Button,ut as buttonVariants};
1
+ import{mt,e}from"../chunk-xgy0heva.js";export{e as Button,mt as buttonVariants};
package/dist/ui/card.js CHANGED
@@ -1 +1 @@
1
- import{Pe,Ie,Me,Ne,Pt,Se,Ee}from"../chunk-f20xh0z9.js";export{Pe as Card,Pt as CardAction,Se as CardContent,Ne as CardDescription,Ee as CardFooter,Ie as CardHeader,Me as CardTitle};
1
+ import{Ve,Ke,We,qe,Lt,Ge,je}from"../chunk-x6jyxw9c.js";export{Ve as Card,Lt as CardAction,Ge as CardContent,qe as CardDescription,je as CardFooter,Ke as CardHeader,We as CardTitle};
@@ -1 +1 @@
1
- import{w}from"../chunk-v4p0qwmj.js";export{w as Checkbox};
1
+ import{x}from"../chunk-5hqv4m75.js";export{x as Checkbox};
package/dist/ui/dialog.js CHANGED
@@ -1 +1 @@
1
- import{E,_t,dt,We,ct,R,qe,Ge,L,je}from"../chunk-s0nhgptn.js";import"../chunk-7pr2j1zb.js";export{E as Dialog,We as DialogClose,R as DialogContent,je as DialogDescription,Ge as DialogFooter,qe as DialogHeader,ct as DialogOverlay,dt as DialogPortal,L as DialogTitle,_t as DialogTrigger};
1
+ import{P,St,dt,De,ct,I,He,Oe,M,Be}from"../chunk-2kjmc9hg.js";import"../chunk-xgy0heva.js";export{P as Dialog,De as DialogClose,I as DialogContent,Be as DialogDescription,Oe as DialogFooter,He as DialogHeader,ct as DialogOverlay,dt as DialogPortal,M as DialogTitle,St as DialogTrigger};
@@ -1 +1 @@
1
- import{x,Et,v,m,b,H,y,P,I,M,J,Oe,Be,s,Rt}from"../chunk-kj1wrn2j.js";export{x as DropdownMenu,J as DropdownMenuCheckboxItem,m as DropdownMenuContent,b as DropdownMenuGroup,y as DropdownMenuItem,H as DropdownMenuLabel,Et as DropdownMenuPortal,Oe as DropdownMenuRadioGroup,Be as DropdownMenuRadioItem,s as DropdownMenuSeparator,Rt as DropdownMenuShortcut,P as DropdownMenuSub,M as DropdownMenuSubContent,I as DropdownMenuSubTrigger,v as DropdownMenuTrigger};
1
+ import{v,Et,b,m,y,D,w,N,S,E,J,$e,Ue,s,Rt}from"../chunk-s4w6yjc0.js";export{v as DropdownMenu,J as DropdownMenuCheckboxItem,m as DropdownMenuContent,y as DropdownMenuGroup,w as DropdownMenuItem,D as DropdownMenuLabel,Et as DropdownMenuPortal,$e as DropdownMenuRadioGroup,Ue as DropdownMenuRadioItem,s as DropdownMenuSeparator,Rt as DropdownMenuShortcut,N as DropdownMenuSub,E as DropdownMenuSubContent,S as DropdownMenuSubTrigger,b as DropdownMenuTrigger};
package/dist/ui/field.js CHANGED
@@ -1 +1 @@
1
- import{Z,Y,Fe,De,It,He,Mt,D,Nt,St}from"../chunk-k1c0jrk1.js";import"../chunk-pnncsvbz.js";import"../chunk-8zs8vy0q.js";export{De as Field,It as FieldContent,D as FieldDescription,St as FieldError,Fe as FieldGroup,He as FieldLabel,Y as FieldLegend,Nt as FieldSeparator,Z as FieldSet,Mt as FieldTitle};
1
+ import{re,oe,Je,et,At,tt,Ft,H,Dt,Ht}from"../chunk-2sc7ppw2.js";import"../chunk-b5srhd6k.js";import"../chunk-pnncsvbz.js";export{et as Field,At as FieldContent,H as FieldDescription,Ht as FieldError,Je as FieldGroup,tt as FieldLabel,oe as FieldLegend,Dt as FieldSeparator,re as FieldSet,Ft as FieldTitle};
@@ -1 +1 @@
1
- import{Re,Le,_e}from"../chunk-6x9vcfpg.js";export{Re as HoverCard,_e as HoverCardContent,Le as HoverCardTrigger};
1
+ import{Xe,Ze,Ye}from"../chunk-t83jwyey.js";export{Xe as HoverCard,Ye as HoverCardContent,Ze as HoverCardTrigger};
@@ -1 +1 @@
1
- import{ze,ee,te,Lt}from"../chunk-ghfbzhnb.js";import{ne}from"../chunk-jnx3t913.js";import"../chunk-r9k7kszp.js";import"../chunk-7pr2j1zb.js";export{ze as InputGroup,ee as InputGroupAddon,te as InputGroupButton,Lt as InputGroupText,ne as InputGroupTextarea};
1
+ import{Qe,ee,te,_t}from"../chunk-pkxfrrwf.js";import"../chunk-xgy0heva.js";import{ne}from"../chunk-jnx3t913.js";import"../chunk-r9k7kszp.js";export{Qe as InputGroup,ee as InputGroupAddon,te as InputGroupButton,_t as InputGroupText,ne as InputGroupTextarea};
package/dist/ui/input.js CHANGED
@@ -1 +1 @@
1
- import{l}from"../chunk-m8gejgjs.js";export{l as Input};
1
+ import{d}from"../chunk-ake02dgs.js";export{d as Input};
@@ -1 +1 @@
1
- import{N}from"../chunk-8zs8vy0q.js";export{N as Separator};
1
+ import{R}from"../chunk-b5srhd6k.js";export{R as Separator};
package/dist/ui/switch.js CHANGED
@@ -1 +1 @@
1
- import{S}from"../chunk-s28x10qd.js";export{S as Switch};
1
+ import{L}from"../chunk-j63t6dxg.js";export{L as Switch};
@@ -1 +1 @@
1
- import{kt,G,j,Q}from"../chunk-wtkv29ba.js";export{G as Tooltip,Q as TooltipContent,kt as TooltipProvider,j as TooltipTrigger};
1
+ import{Ot,ie,ae,se}from"../chunk-qf9n7v84.js";export{ie as Tooltip,se as TooltipContent,Ot as TooltipProvider,ae as TooltipTrigger};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwith/module-chat",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -280,7 +280,7 @@
280
280
  },
281
281
  "peerDependencies": {
282
282
  "@agentclientprotocol/sdk": "^2.0.2",
283
- "@alwith/api": "^0.4.19",
283
+ "@alwith/api": "^0.4.21",
284
284
  "react": "^19.3.1",
285
285
  "react-dom": "^19.3.1"
286
286
  },
@@ -304,7 +304,7 @@
304
304
  },
305
305
  "devDependencies": {
306
306
  "@agentclientprotocol/sdk": "^2.0.2",
307
- "@alwith/api": "^0.4.19",
307
+ "@alwith/api": "^0.4.21",
308
308
  "@happy-dom/global-registrator": "^21.0.4",
309
309
  "@testing-library/dom": "^10.4.2",
310
310
  "@testing-library/react": "^16.3.3",
@@ -1,2 +0,0 @@
1
- import{Ye}from"./chunk-qj8r5xvx.js";import{E,We,R,L}from"./chunk-s0nhgptn.js";import{cn as p}from"cn";import{XIcon as _}from"lucide-react";import{useCallback as v,useEffect as D,useMemo as j,useRef as N,useState as b}from"react";import{jsxDEV as i}from"react/jsx-dev-runtime";function Ke({open:l,onOpenChange:y,url:h,filename:M,scale:d,onScaleChange:f,containerRef:z,containerClassName:H,dialogContentClassName:P,imageClassName:T}){let g=v((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=v((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=v(()=>{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:i(R,{className:p("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"},void 0,!1,void 0,this),i(We,{"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"},void 0,!1,void 0,this)},void 0,!1,void 0,this),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?Ye({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:p("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:p("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},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
2
- export{Ke};
@@ -1,2 +0,0 @@
1
- function ot(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 le(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(ot(n,i))}return{imageFiles:e,sawNonImageFile:o}}function de(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 it(t){return[...t].filter((e)=>!s(e)).join("")}function nt(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 _(t){let{value:e,selectionStart:o,selectionEnd:i}=t,n=it(e);if(n===e)return n;if(t.value=n,o!==null&&i!==null){let a=Math.max(0,o-nt(e,o)),r=Math.max(0,i-nt(e,i));requestAnimationFrame(()=>{t.setSelectionRange(a,r)})}return n}
2
- export{ot,le,de,it,nt,_};
@@ -1,2 +0,0 @@
1
- import{createContext as f,useCallback as n,useContext as i,useEffect as et,useMemo as J,useRef as g,useState as K}from"react";import{jsxDEV as N}from"react/jsx-dev-runtime";var A=f(null),O=f(null);function pt(){return i(O)}var B=f(null);function gt(){return i(B)}var k=f(null);function ce(){let r=i(A);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var C=()=>i(A);function ft(){let r=i(k);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var nt=()=>i(k);function ht({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:R,attachmentPolicy:P,value:y,onValueChange:U,attachments:L,onAttachmentsChange:S,children:Q}){let T=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]=K(r),a=y??V,o=g({value:a,external:l,revision:0});if(o.current.value!==a||o.current.external!==l)o.current={value:a,external:l,revision:o.current.revision+1};let j=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]=K([]),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]),w=g(null),M=g(()=>{}),E=n((t)=>{let e=[...t];if(e.length===0)return;s((m)=>{let d=P===void 0?e:P.uniqueFiles(e,m);return[...m,...d.map((u)=>{let G=P?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:T(u),filename:u.name,size:u.size,lastModified:u.lastModified,...G===void 0?{}:{sourcePath:G}}})]})},[P,T,s]),H=n((t)=>{s((e)=>{let m=e.find((d)=>d.id===t);if(m?.url)URL.revokeObjectURL(m.url);return e.filter((d)=>d.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 q=n(()=>{M.current?.()},[]),F=J(()=>({files:I,add:E,remove:H,clear:_,openFileDialog:q,fileInputRef:w}),[I,E,H,_,q]),D=n((t,e)=>{w.current=t.current,M.current=e},[]),tt=J(()=>({textInput:{value:a,setInput:x,clear:h,getRevision:j,clearSubmitted:c??h},attachments:F,__registerFileInput:D}),[a,x,h,j,c,F,D]);return N(A.Provider,{value:tt,children:N(k.Provider,{value:F,children:Q},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var z=f(null);function p(){let r=nt(),l=i(z),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
2
- export{O,pt,B,gt,k,ce,C,ft,ht,z,p};
@@ -1,2 +0,0 @@
1
- var rt={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function Te(e){return[...e].toSorted((o,n)=>(rt[o.kind]??99)-(rt[n.kind]??99))}function Ct(e){return e==="allow_once"||e==="allow_always"}function Tt(e){return e==="allow_always"||e==="reject_always"}
2
- export{rt,Te,Ct,Tt};
@@ -1,2 +0,0 @@
1
- var t=new Map;var a=0;function ie(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=ie(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 Xe(e,n){return d??=new l,d.connect(e,n)}
2
- export{ie,Xe};
@@ -1,2 +0,0 @@
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 se(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 Je(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=se(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{se,Je};
@@ -1 +0,0 @@
1
- import{r}from"./chunk-pnncsvbz.js";import{N}from"./chunk-8zs8vy0q.js";import{cva as p}from"class-variance-authority";import{cn as l}from"cn";import{useMemo as u}from"react";import{jsxDEV as t}from"react/jsx-dev-runtime";function Z({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},void 0,!1,void 0,this)}function Y({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},void 0,!1,void 0,this)}function Fe({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},void 0,!1,void 0,this)}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 De({className:a,orientation:e="vertical",...o}){return t("div",{role:"group","data-slot":"field","data-orientation":e,className:l(c({orientation:e}),a),...o},void 0,!1,void 0,this)}function It({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},void 0,!1,void 0,this)}function He({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},void 0,!1,void 0,this)}function Mt({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},void 0,!1,void 0,this)}function D({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},void 0,!1,void 0,this)}function Nt({children:a,className:e,...o}){return t("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(N,{className:"absolute inset-0 top-1/2"},void 0,!1,void 0,this),a&&t("span",{className:"bg-background text-muted-foreground relative mx-auto block w-fit px-2","data-slot":"field-separator-content",children:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function St({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,!1,void 0,this))},void 0,!1,void 0,this)},[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},void 0,!1,void 0,this)}export{Z,Y,Fe,De,It,He,Mt,D,Nt,St};
@@ -1,2 +0,0 @@
1
- import{se,Je}from"./chunk-hnt4tt1n.js";function c(t){return{key:t.name,label:t.name,description:t.description??void 0,payload:t.name}}function V(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=se(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 xt(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 Je(l,s,(e)=>e.rel,i).map(({item:e})=>({key:e.abs,label:e.rel,payload:e.abs}))}
2
- export{V,xt};
@@ -1,2 +0,0 @@
1
- function oe(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{oe};
@@ -1,2 +0,0 @@
1
- function*q(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 yt(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 q(s,e))r.push({turnKey:t,occurrenceInTurn:c}),c+=1}return r}
2
- export{q,yt};
@@ -1,2 +0,0 @@
1
- var At=1e6,Ft=5000000;function Ze(_,e){return _+e>5000000}function Dt(_){return(_/1e6).toFixed(1)}var ae=5;
2
- export{At,Ft,Ze,Dt,ae};