@alwith/module-chat 0.1.27 → 0.1.28
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.
- package/dist/{chunk-jkr153v1.js → chunk-70sfgw0j.js} +2 -2
- package/dist/{chunk-2845n9v4.js → chunk-kj1wrn2j.js} +1 -1
- package/dist/{chunk-arge74eh.js → chunk-kzccs8ak.js} +2 -2
- package/dist/{chunk-g3r8m488.js → chunk-skx67pc6.js} +1 -1
- package/dist/{chunk-g77gammg.js → chunk-swg5v7sg.js} +2 -2
- package/dist/{chunk-q17wr01c.js → chunk-ynga7fm4.js} +2 -2
- package/dist/codex/assistant-message.js +2 -2
- package/dist/codex/edited-files-card.js +1 -1
- package/dist/codex/navigation-rail.css +216 -1
- package/dist/codex/navigation-rail.js +1 -1
- package/dist/codex/thread-virtualizer.js +1 -1
- package/dist/codex/virtualized-turn-list.js +1 -1
- package/dist/composer/completion-filter.js +1 -1
- package/dist/composer/completion-menu.js +1 -1
- package/dist/composer/menu-radio.js +1 -1
- package/dist/composer/model-select.js +1 -1
- package/dist/composer/permission-mode-select.js +1 -1
- package/dist/search/chat-search.js +1 -1
- package/dist/search/find-bar.js +1 -1
- package/dist/ui/dropdown-menu.js +1 -1
- package/package.json +3 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-7pr2j1zb.js";import{l}from"./chunk-m8gejgjs.js";import{cn as v}from"cn";import{ChevronDownIcon as g,ChevronUpIcon as b,XIcon as z}from"lucide-react";import{useEffect as B,useImperativeHandle as N,useRef as E}from"react";import{jsxDEV as n}from"react/jsx-dev-runtime";function
|
|
2
|
-
export{
|
|
1
|
+
import{e}from"./chunk-7pr2j1zb.js";import{l}from"./chunk-m8gejgjs.js";import{cn as v}from"cn";import{ChevronDownIcon as g,ChevronUpIcon as b,XIcon as z}from"lucide-react";import{useEffect as B,useImperativeHandle as N,useRef as E}from"react";import{jsxDEV as n}from"react/jsx-dev-runtime";function ve({ref:p,value:i,onChange:m,onFind:o,onClose:s,placeholder:d,autoFocusOpen:a=!0,prevTitle:c,nextTitle:u,className:h}){let r=E(null);N(p,()=>{if(r.current===null)throw Error("FindBar input is not mounted");return r.current},[]),B(()=>{if(!a)return;let t=r.current;if(t===null)throw Error("FindBar input is not mounted");t.focus(),t.select()},[a]);let f=!i;return n("div",{className:v("border-border flex h-9 shrink-0 items-center gap-1 border-b px-2",h),children:[n(l,{ref:r,value:i,onChange:(t)=>m(t.target.value),placeholder:d,className:"h-7 text-xs",onKeyDown:(t)=>{if(t.key==="Escape"){t.preventDefault(),s();return}if(t.key==="Enter"){if(t.preventDefault(),i)o(t.shiftKey)}}},void 0,!1,void 0,this),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>o(!0),title:c?`${c} (⇧↵)`:"⇧↵",children:n(b,{className:"size-3.5"},void 0,!1,void 0,this)},void 0,!1,void 0,this),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>o(!1),title:u?`${u} (↵)`:"↵",children:n(g,{className:"size-3.5"},void 0,!1,void 0,this)},void 0,!1,void 0,this),n(e,{size:"icon",variant:"ghost",className:"size-6",onClick:s,title:"Esc",children:n(z,{className:"size-3.5"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
+
export{ve};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Menu as n}from"@base-ui/react/menu";import{cn as i}from"cn";import{CheckIcon as c,ChevronRightIcon as p}from"lucide-react";import{jsxDEV as t}from"react/jsx-dev-runtime";function
|
|
1
|
+
import{Menu as n}from"@base-ui/react/menu";import{cn as i}from"cn";import{CheckIcon as c,ChevronRightIcon as p}from"lucide-react";import{jsxDEV as t}from"react/jsx-dev-runtime";function x({...e}){return t(n.Root,{"data-slot":"dropdown-menu",...e},void 0,!1,void 0,this)}function Et({...e}){return t(n.Portal,{"data-slot":"dropdown-menu-portal",...e},void 0,!1,void 0,this)}function v({...e}){return t(n.Trigger,{"data-slot":"dropdown-menu-trigger",...e},void 0,!1,void 0,this)}function m({align:e="start",alignOffset:o=0,side:a="bottom",sideOffset:r=4,className:d,...u}){return t(n.Portal,{children:t(n.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:o,side:a,sideOffset:r,children:t(n.Popup,{"data-slot":"dropdown-menu-content",className:i("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md p-1 shadow-md ring-1 duration-100 outline-none data-closed:overflow-hidden",d),...u},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function b({...e}){return t(n.Group,{"data-slot":"dropdown-menu-group",...e},void 0,!1,void 0,this)}function H({className:e,inset:o,...a}){return t(n.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":o,className:i("text-muted-foreground px-2 py-1.5 text-xs font-medium data-inset:pl-8",e),...a},void 0,!1,void 0,this)}function y({className:e,inset:o,variant:a="default",...r}){return t(n.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":a,className:i("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r},void 0,!1,void 0,this)}function P({...e}){return t(n.SubmenuRoot,{"data-slot":"dropdown-menu-sub",...e},void 0,!1,void 0,this)}function I({className:e,inset:o,children:a,...r}){return t(n.SubmenuTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:i("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[a,t(p,{className:"ml-auto"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function M({align:e="start",alignOffset:o=-3,side:a="right",sideOffset:r=0,className:d,...u}){return t(m,{"data-slot":"dropdown-menu-sub-content",className:i("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 w-auto min-w-[96px] rounded-md p-1 shadow-lg ring-1 duration-100",d),align:e,alignOffset:o,side:a,sideOffset:r,...u},void 0,!1,void 0,this)}function J({className:e,children:o,checked:a,inset:r,...d}){return t(n.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":r,className:i("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:a,...d,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:t(n.CheckboxItemIndicator,{children:t(c,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),o]},void 0,!0,void 0,this)}function Oe({...e}){return t(n.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...e},void 0,!1,void 0,this)}function Be({className:e,children:o,inset:a,...r}){return t(n.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":a,className:i("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:t(n.RadioItemIndicator,{children:t(c,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),o]},void 0,!0,void 0,this)}function s({className:e,...o}){return t(n.Separator,{"data-slot":"dropdown-menu-separator",className:i("bg-border -mx-1 my-1 h-px",e),...o},void 0,!1,void 0,this)}function Rt({className:e,...o}){return t("span",{"data-slot":"dropdown-menu-shortcut",className:i("text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-xs tracking-widest",e),...o},void 0,!1,void 0,this)}export{x,Et,v,m,b,H,y,P,I,M,J,Oe,Be,s,Rt};
|
|
@@ -1,2 +1,2 @@
|
|
|
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
|
|
2
|
-
export{V,
|
|
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 +1,2 @@
|
|
|
1
|
-
import{Oe,Be}from"./chunk-
|
|
1
|
+
import{Oe,Be}from"./chunk-kj1wrn2j.js";import{cn as l}from"cn";import{jsxDEV as t}from"react/jsx-dev-runtime";function n({value:a,onValueChange:i,options:o,itemClassName:d}){return t(Oe,{value:a,onValueChange:(e)=>i(String(e)),children:o.map((e)=>t(Be,{value:e.value,disabled:e.disabled,title:e.title,closeOnClick:!0,className:l("gap-2",e.description?"items-start":"items-center",d),children:[e.icon,e.description?t("div",{className:"min-w-0 flex-1",children:[t("div",{className:"text-xs font-medium",children:e.label},void 0,!1,void 0,this),t("div",{className:"text-muted-foreground text-[11px] font-normal",children:e.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this):t("span",{className:"min-w-0 flex-1 truncate text-start",children:e.label},void 0,!1,void 0,this)]},e.value,!0,void 0,this))},void 0,!1,void 0,this)}
|
|
2
2
|
export{n};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
export{
|
|
1
|
+
var vt=280;function pe({entries:i,gapPx:t,measuredHeightsByKey:o,leadingInsetPx:e=0}){let n=[],r=[],d=new Map,s=[],u=e;for(let[x,a]of i.entries()){d.set(a.turnKey,x);for(let h of a.aliases??[])d.set(h,x);s.push(a.turnKey),r.push(u);let f=a.aliases?.map((h)=>o[h]).find((h)=>h!==void 0),m=o[a.turnKey]??f??a.estimatedHeightPx??280;if(n.push(m),u+=m,x<i.length-1)u+=t}return{bottomOffsetsPx:r.map((x,a)=>{let f=n[a];if(f===void 0)throw Error(`Codex turn height is missing at index ${a}`);return u-x-f}),heightsPx:n,topOffsetsPx:r,totalHeightPx:u,turnIndexByKey:d,turnKeys:s}}function g({distanceFromBottomPx:i,layout:t,overscanCount:o,viewportHeightPx:e}){if(t.turnKeys.length===0)return{startIndex:0,endIndex:0};let n=Math.min(Math.max(0,i),t.totalHeightPx),r=Math.min(n+Math.max(0,e),t.totalHeightPx),d=l(t.bottomOffsetsPx,r),s=c(t.bottomOffsetsPx,t.heightsPx,n);return{startIndex:Math.max(0,d-o),endIndex:Math.min(t.turnKeys.length,Math.max(s,d+1)+o)}}function K({anchorKey:i,layout:t,previousRange:o}){let e=t.turnIndexByKey.get(i);if(e===void 0)return null;return{startIndex:e,endIndex:Math.min(t.turnKeys.length,e+o.endIndex-o.startIndex)}}function ge({anchorKey:i,distanceFromBottomPx:t,nextLayout:o,previousLayout:e}){let n=e.turnIndexByKey.get(i),r=o.turnIndexByKey.get(i);if(n===void 0||r===void 0)return null;let d=e.bottomOffsetsPx[n],s=e.heightsPx[n],u=o.bottomOffsetsPx[r],x=o.heightsPx[r];if(d===void 0||s===void 0||u===void 0||x===void 0)throw Error(`Codex turn geometry is missing: ${i}`);return Math.max(0,t+u+x-d-s)}function fe({layout:i,turnKey:t,viewportHeightPx:o}){let e=i.turnIndexByKey.get(t);if(e===void 0)return null;let n=i.bottomOffsetsPx[e],r=i.heightsPx[e];if(n===void 0||r===void 0)throw Error(`Codex turn geometry is missing: ${t}`);return Math.max(0,n-o/2+r/2)}function he({align:i,layout:t,targetHeightPx:o,targetOffsetPx:e,turnKey:n,viewportHeightPx:r}){let d=t.turnIndexByKey.get(n);if(d===void 0)return null;let s=t.bottomOffsetsPx[d],u=t.heightsPx[d];if(s===void 0||u===void 0)throw Error(`Codex turn geometry is missing: ${n}`);let x=s+u-e;return i==="top"?Math.max(0,x-r+10):Math.max(0,x-o/2-r/2)}function l(i,t){let o=0,e=i.length;while(o<e){let n=Math.floor((o+e)/2),r=i[n];if(r===void 0)throw Error(`Codex bottom offset is missing at index ${n}`);if(r<t)e=n;else o=n+1}return o}function c(i,t,o){let e=0,n=i.length;while(e<n){let r=Math.floor((e+n)/2),d=i[r],s=t[r];if(d===void 0||s===void 0)throw Error(`Codex turn geometry is missing at index ${r}`);if(d+s<=o)n=r;else e=r+1}return e}
|
|
2
|
+
export{vt,pe,g,K,ge,fe,he};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{t}from"./chunk-gycty1x1.js";import{ChevronDownIcon as g,ChevronUpIcon as b,FileDiffIcon as v}from"lucide-react";import{useState as p}from"react";import{jsxDEV as e}from"react/jsx-dev-runtime";function m(n){if(n===null||n.length===0)return 0;return n.split(`
|
|
2
|
-
`).length}function at(n){let c=new Map;for(let r of n)for(let d of r.content){if(d.type!=="diff")continue;let u=d,l=u._meta?.alwith?.hunks??[],f=l.reduce((i,s)=>i+m(s.newText),0),a=l.reduce((i,s)=>i+m(s.oldText),0);for(let i of u.changes){let s=c.get(i.path);if(s)s.additions+=f,s.deletions+=a;else c.set(i.path,{path:i.path,additions:f,deletions:a})}}return[...c.values()]}function
|
|
3
|
-
export{at,
|
|
2
|
+
`).length}function at(n){let c=new Map;for(let r of n)for(let d of r.content){if(d.type!=="diff")continue;let u=d,l=u._meta?.alwith?.hunks??[],f=l.reduce((i,s)=>i+m(s.newText),0),a=l.reduce((i,s)=>i+m(s.oldText),0);for(let i of u.changes){let s=c.get(i.path);if(s)s.additions+=f,s.deletions+=a;else c.set(i.path,{path:i.path,additions:f,deletions:a})}}return[...c.values()]}function xe({blocks:n}){return e(st,{files:at(n)},void 0,!1,void 0,this)}function st({files:n,onOpen:c,renderPath:r}){let{t:d,openLink:u}=t(),[l,f]=p(!0),[a,i]=p(!1);if(n.length===0)return null;let s=n.reduce((o,h)=>o+h.additions,0),x=n.reduce((o,h)=>o+h.deletions,0);return e("section",{className:"codex-edited-files-card",children:[e("div",{className:"codex-edited-files-header",children:[e("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:e(v,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),e("div",{className:"codex-edited-files-summary",children:[e("strong",{children:d("stream.codex.editedFilesCount",{count:n.length})},void 0,!1,void 0,this),e("button",{type:"button","data-codex-disclosure":"",onClick:()=>{f((o)=>!o),i(!1)},"aria-expanded":l,children:d(l?"stream.codex.hideChanges":"stream.codex.viewChanges")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e("div",{className:"codex-edited-files-total",title:d("stream.codex.changedLines"),children:[e("span",{className:"codex-diff-additions",children:["+",s]},void 0,!0,void 0,this),e("span",{className:"codex-diff-deletions",children:["-",x]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),l&&e("div",{className:"codex-edited-files-list",children:[(a?n:n.slice(0,3)).map((o)=>e("div",{className:"codex-edited-file-row",children:[e("button",{type:"button",className:"codex-edited-file-path",title:o.path,onClick:()=>c===void 0?u(o.path):c(o),children:r===void 0?o.path:r(o)},void 0,!1,void 0,this),e("span",{className:"codex-edited-file-counts",children:[e("span",{className:"codex-diff-additions",children:["+",o.additions]},void 0,!0,void 0,this),e("span",{className:"codex-diff-deletions",children:["-",o.deletions]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},o.path,!0,void 0,this)),n.length>3&&e("button",{type:"button",className:"codex-edited-files-more","aria-expanded":a,onClick:()=>i((o)=>!o),children:[d(a?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:n.length-3}),a?e(b,{size:16,"aria-hidden":"true"},void 0,!1,void 0,this):e(g,{size:16,"aria-hidden":"true"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
|
|
3
|
+
export{at,xe,st};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t,u}from"../chunk-gycty1x1.js";import{d}from"../chunk-y2xbq7rb.js";import{Ue}from"../chunk-s3z33k7f.js";import"../chunk-p9wpghey.js";import"../chunk-pve9b7z3.js";import"../chunk-hy1x2td2.js";import{T}from"../chunk-7gh078gc.js";import{be,ye}from"../chunk-wc3patey.js";import{
|
|
2
|
-
`),M=!e.streaming&&C.trim().length>0?n(S,{text:C,isMostRecentTurn:s,beforeCopy:a,afterCopy:x,time:r},void 0,!1,void 0,this):null,l=Ue(e.content,"compact"),f=l.reduce((o,c,p)=>c.kind==="codexActivityGroup"?p:o,-1),h=l.findIndex((o,c)=>c>f&&o.kind==="block"&&o.block.type==="text"),b=[...e.content].toReversed().find((o)=>o.type==="text"),m=e.content.filter((o)=>o.type==="tool_use"&&d(o).category==="edit"),k=(o)=>{if(o.kind==="codexActivityGroup"){let c=o.blocks.filter((p)=>p.type!=="tool_use"||!i.has(p.name));return c.length===0?null:n(ye,{blocks:c},`activity:${R(c[0])}`,!1,void 0,this)}if(o.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${o.kind}`);return n(E,{block:o.block,streaming:Boolean(e.streaming),actions:o.block===b?M:void 0,renderText:B},R(o.block),!1,void 0,this)},g=f===-1?0:h===-1?l.length:h;return n(O,{stateKey:e.id,active:Boolean(e.streaming),startedAt:e.startedAt,durationMs:e.durationMs,providerId:e.providerId,providerIcon:A,work:l.slice(0,g).map(k),answer:l.length>g?l.slice(g).map(k):null,footer:f!==-1&&m.length>0&&(y===void 0?n(
|
|
1
|
+
import{t,u}from"../chunk-gycty1x1.js";import{d}from"../chunk-y2xbq7rb.js";import{Ue}from"../chunk-s3z33k7f.js";import"../chunk-p9wpghey.js";import"../chunk-pve9b7z3.js";import"../chunk-hy1x2td2.js";import{T}from"../chunk-7gh078gc.js";import{be,ye}from"../chunk-wc3patey.js";import{xe}from"../chunk-ynga7fm4.js";import"../chunk-8bdd6q4w.js";import{W}from"../chunk-ax9ganqr.js";import{cn as w}from"cn";import{jsxDEV as n}from"react/jsx-dev-runtime";var v=new WeakMap,P=1;function R(e){if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return`${e.type}:${e.id}`;let s=v.get(e);if(s!==void 0)return`${e.type}:${s}`;let i=P++;return v.set(e,i),`${e.type}:${i}`}function I({block:e,streaming:s,actions:i}){if(e.isApiError)return n("div",{className:"codex-stream-error",children:e.text},void 0,!1,void 0,this);return n("div",{className:"codex-assistant-message",children:[n(u,{text:e.text,streaming:s},void 0,!1,void 0,this),i]},void 0,!0,void 0,this)}function E({block:e,streaming:s,actions:i,renderText:r}){switch(e.type){case"text":return r===void 0?n(I,{block:e,streaming:s,actions:i},void 0,!1,void 0,this):r({block:e,streaming:s,actions:i});case"thinking":return e.thinking.length>0?n(u,{text:e.thinking,streaming:!e.isComplete},void 0,!1,void 0,this):null;case"plan":return n(T,{entries:e.entries},void 0,!1,void 0,this);case"image":return n("img",{src:`data:${e.source.media_type};base64,${e.source.data}`,className:"max-h-64 rounded",alt:""},void 0,!1,void 0,this);case"tool_use":case"subagent":case"collab":return null}}var _=new Set;function q({message:e,isMostRecentTurn:s,hiddenTools:i=_,time:r,beforeCopy:a,afterCopy:x,providerIcon:A,renderText:B,renderEditedFiles:y}){if(e.streaming===!0&&e.content.every((o)=>o.type==="text"?o.text.length===0:o.type==="thinking"?o.thinking.length===0:!1))return n(N,{},void 0,!1,void 0,this);let C=e.content.filter((o)=>o.type==="text").map((o)=>o.text).join(`
|
|
2
|
+
`),M=!e.streaming&&C.trim().length>0?n(S,{text:C,isMostRecentTurn:s,beforeCopy:a,afterCopy:x,time:r},void 0,!1,void 0,this):null,l=Ue(e.content,"compact"),f=l.reduce((o,c,p)=>c.kind==="codexActivityGroup"?p:o,-1),h=l.findIndex((o,c)=>c>f&&o.kind==="block"&&o.block.type==="text"),b=[...e.content].toReversed().find((o)=>o.type==="text"),m=e.content.filter((o)=>o.type==="tool_use"&&d(o).category==="edit"),k=(o)=>{if(o.kind==="codexActivityGroup"){let c=o.blocks.filter((p)=>p.type!=="tool_use"||!i.has(p.name));return c.length===0?null:n(ye,{blocks:c},`activity:${R(c[0])}`,!1,void 0,this)}if(o.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${o.kind}`);return n(E,{block:o.block,streaming:Boolean(e.streaming),actions:o.block===b?M:void 0,renderText:B},R(o.block),!1,void 0,this)},g=f===-1?0:h===-1?l.length:h;return n(O,{stateKey:e.id,active:Boolean(e.streaming),startedAt:e.startedAt,durationMs:e.durationMs,providerId:e.providerId,providerIcon:A,work:l.slice(0,g).map(k),answer:l.length>g?l.slice(g).map(k):null,footer:f!==-1&&m.length>0&&(y===void 0?n(xe,{blocks:m},void 0,!1,void 0,this):y(m))},void 0,!1,void 0,this)}function S({text:e,isMostRecentTurn:s=!1,beforeCopy:i,afterCopy:r,time:a}){let{t:x}=t();return n("div",{className:w("mt-1.5 flex h-5 w-fit -translate-x-1 items-center justify-start gap-0.5 [&_*]:transition-none",s?"opacity-100":"opacity-0 group-focus-within/am:opacity-100 group-hover/am:opacity-100"),children:[i,n(W,{text:e,label:x("actions.copy")},void 0,!1,void 0,this),r,a&&n("span",{className:"codex-user-time ms-1",title:a.full,children:a.short},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function N(){let{t:e}=t();return n("div",{className:"codex-pending-message py-2",role:"status",children:n("span",{className:"codex-activity-running",children:e("message.thinking")},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function O({work:e,answer:s,footer:i,loading:r=!1,...a}){if(r)return n(N,{},void 0,!1,void 0,this);return n("div",{className:"group/am codex-assistant-turn",children:[e.length>0&&n(be,{...a,children:e},void 0,!1,void 0,this),s!==null&&(e.length===0?s:n("div",{"data-local-conversation-final-assistant":!0,"data-testid":"codex-final-answer",className:"codex-final-answer",children:s},void 0,!1,void 0,this)),i]},void 0,!0,void 0,this)}export{q as CodexAssistantMessage,O as CodexAssistantTurn,S as CodexMessageActions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{at,
|
|
1
|
+
import{at,xe,st}from"../chunk-ynga7fm4.js";import"../chunk-gycty1x1.js";export{xe as CodexEditedFilesCard,st as EditedFilesCard,at as fileChanges};
|
|
@@ -1 +1,216 @@
|
|
|
1
|
-
.thread-user-message-navigation
|
|
1
|
+
.thread-user-message-navigation {
|
|
2
|
+
animation: thread-user-message-navigation-enter 150ms cubic-bezier(0.23, 1, 0.32, 1) both;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.thread-user-message-navigation-rail-list {
|
|
6
|
+
--edge-fade-distance: 2.5rem;
|
|
7
|
+
display: flex;
|
|
8
|
+
max-height: min(70vh, 40rem);
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
overflow-y: auto;
|
|
11
|
+
overscroll-behavior: contain;
|
|
12
|
+
scrollbar-width: none;
|
|
13
|
+
mask: linear-gradient(
|
|
14
|
+
to bottom in oklch,
|
|
15
|
+
oklch(60% 0 0 / 0),
|
|
16
|
+
oklch(85% 0 0) var(--top-fade) calc(100% - var(--bottom-fade)),
|
|
17
|
+
oklch(60% 0 0 / 0)
|
|
18
|
+
);
|
|
19
|
+
animation-name: thread-user-message-navigation-edge-fade;
|
|
20
|
+
animation-timing-function: linear;
|
|
21
|
+
animation-fill-mode: both;
|
|
22
|
+
animation-timeline: scroll(self y);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.thread-user-message-navigation-rail-list::-webkit-scrollbar {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.thread-user-message-navigation-row {
|
|
30
|
+
display: flex;
|
|
31
|
+
width: 36px;
|
|
32
|
+
height: 10px;
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
align-items: center;
|
|
35
|
+
cursor: default;
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.thread-user-message-navigation-marker {
|
|
40
|
+
--marker-progress: 0;
|
|
41
|
+
width: 26px;
|
|
42
|
+
height: 2px;
|
|
43
|
+
background-color: var(--muted-foreground);
|
|
44
|
+
opacity: 0.4;
|
|
45
|
+
transform: scaleX(calc(0.2308 + 0.7692 * var(--marker-progress)));
|
|
46
|
+
transform-origin: left;
|
|
47
|
+
transition: transform 160ms
|
|
48
|
+
linear(0, 0.398 10%, 0.682 20%, 0.843 30%, 0.925 40%, 0.972 50%, 1.004 60%, 1.008 70%, 1.003 80%, 1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.thread-user-message-navigation-marker:dir(rtl) {
|
|
52
|
+
transform-origin: right;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:is(
|
|
56
|
+
.thread-user-message-navigation-row:has(+ .thread-user-message-navigation-row[data-scrub-target]),
|
|
57
|
+
.thread-user-message-navigation-row[data-scrub-target] + .thread-user-message-navigation-row
|
|
58
|
+
)
|
|
59
|
+
.thread-user-message-navigation-marker {
|
|
60
|
+
--marker-progress: 0.7;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:is(
|
|
64
|
+
.thread-user-message-navigation-row:has(
|
|
65
|
+
+ .thread-user-message-navigation-row + .thread-user-message-navigation-row[data-scrub-target]
|
|
66
|
+
),
|
|
67
|
+
.thread-user-message-navigation-row[data-scrub-target]
|
|
68
|
+
+ .thread-user-message-navigation-row
|
|
69
|
+
+ .thread-user-message-navigation-row
|
|
70
|
+
)
|
|
71
|
+
.thread-user-message-navigation-marker {
|
|
72
|
+
--marker-progress: 0.4;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:is(
|
|
76
|
+
.thread-user-message-navigation-row:has(
|
|
77
|
+
+ .thread-user-message-navigation-row
|
|
78
|
+
+ .thread-user-message-navigation-row
|
|
79
|
+
+ .thread-user-message-navigation-row[data-scrub-target]
|
|
80
|
+
),
|
|
81
|
+
.thread-user-message-navigation-row[data-scrub-target]
|
|
82
|
+
+ .thread-user-message-navigation-row
|
|
83
|
+
+ .thread-user-message-navigation-row
|
|
84
|
+
+ .thread-user-message-navigation-row
|
|
85
|
+
)
|
|
86
|
+
.thread-user-message-navigation-marker {
|
|
87
|
+
--marker-progress: 0.2;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.thread-user-message-navigation-row[aria-current="true"] .thread-user-message-navigation-marker {
|
|
91
|
+
background-color: var(--foreground);
|
|
92
|
+
opacity: 0.6;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:is(.thread-user-message-navigation-row:focus-visible, .thread-user-message-navigation-row[data-scrub-target])
|
|
96
|
+
.thread-user-message-navigation-marker {
|
|
97
|
+
--marker-progress: 1;
|
|
98
|
+
background-color: var(--foreground);
|
|
99
|
+
opacity: 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.thread-user-message-navigation-rail-list[data-scrubbing] .thread-user-message-navigation-marker {
|
|
103
|
+
transition-duration: 0s;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.thread-user-message-navigation-rail-list[data-scrubbing]
|
|
107
|
+
.thread-user-message-navigation-row[aria-current="true"]:not([data-scrub-target])
|
|
108
|
+
.thread-user-message-navigation-marker {
|
|
109
|
+
background-color: var(--muted-foreground);
|
|
110
|
+
opacity: 0.4;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@media (hover: hover) and (pointer: fine) {
|
|
114
|
+
.thread-user-message-navigation-rail-list:not([data-scrubbing]):hover
|
|
115
|
+
.thread-user-message-navigation-row[aria-current="true"]:not(:hover):not(:focus-visible)
|
|
116
|
+
.thread-user-message-navigation-marker {
|
|
117
|
+
background-color: var(--muted-foreground);
|
|
118
|
+
opacity: 0.4;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:is(
|
|
122
|
+
.thread-user-message-navigation-rail-list:not([data-scrubbing])
|
|
123
|
+
.thread-user-message-navigation-row:has(+ .thread-user-message-navigation-row:hover),
|
|
124
|
+
.thread-user-message-navigation-rail-list:not([data-scrubbing])
|
|
125
|
+
.thread-user-message-navigation-row:hover
|
|
126
|
+
+ .thread-user-message-navigation-row
|
|
127
|
+
)
|
|
128
|
+
.thread-user-message-navigation-marker {
|
|
129
|
+
--marker-progress: 0.7;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
:is(
|
|
133
|
+
.thread-user-message-navigation-rail-list:not([data-scrubbing])
|
|
134
|
+
.thread-user-message-navigation-row:has(
|
|
135
|
+
+ .thread-user-message-navigation-row + .thread-user-message-navigation-row:hover
|
|
136
|
+
),
|
|
137
|
+
.thread-user-message-navigation-rail-list:not([data-scrubbing])
|
|
138
|
+
.thread-user-message-navigation-row:hover
|
|
139
|
+
+ .thread-user-message-navigation-row
|
|
140
|
+
+ .thread-user-message-navigation-row
|
|
141
|
+
)
|
|
142
|
+
.thread-user-message-navigation-marker {
|
|
143
|
+
--marker-progress: 0.4;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:is(
|
|
147
|
+
.thread-user-message-navigation-rail-list:not([data-scrubbing])
|
|
148
|
+
.thread-user-message-navigation-row:has(
|
|
149
|
+
+ .thread-user-message-navigation-row
|
|
150
|
+
+ .thread-user-message-navigation-row
|
|
151
|
+
+ .thread-user-message-navigation-row:hover
|
|
152
|
+
),
|
|
153
|
+
.thread-user-message-navigation-rail-list:not([data-scrubbing])
|
|
154
|
+
.thread-user-message-navigation-row:hover
|
|
155
|
+
+ .thread-user-message-navigation-row
|
|
156
|
+
+ .thread-user-message-navigation-row
|
|
157
|
+
+ .thread-user-message-navigation-row
|
|
158
|
+
)
|
|
159
|
+
.thread-user-message-navigation-marker {
|
|
160
|
+
--marker-progress: 0.2;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.thread-user-message-navigation-rail-list:not([data-scrubbing])
|
|
164
|
+
.thread-user-message-navigation-row:hover
|
|
165
|
+
.thread-user-message-navigation-marker {
|
|
166
|
+
--marker-progress: 1;
|
|
167
|
+
background-color: var(--foreground);
|
|
168
|
+
opacity: 1;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@media (prefers-reduced-motion: reduce) {
|
|
173
|
+
.thread-user-message-navigation {
|
|
174
|
+
animation-duration: 0s;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.thread-user-message-navigation-marker {
|
|
178
|
+
transition-duration: 0s;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@keyframes thread-user-message-navigation-enter {
|
|
183
|
+
from {
|
|
184
|
+
opacity: 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
to {
|
|
188
|
+
opacity: 1;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@keyframes thread-user-message-navigation-edge-fade {
|
|
193
|
+
0%,
|
|
194
|
+
1% {
|
|
195
|
+
--top-fade: 0;
|
|
196
|
+
--bottom-fade: var(--edge-fade-distance);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
99%,
|
|
200
|
+
100% {
|
|
201
|
+
--top-fade: var(--edge-fade-distance);
|
|
202
|
+
--bottom-fade: 0;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@property --top-fade {
|
|
207
|
+
syntax: "<length>";
|
|
208
|
+
inherits: false;
|
|
209
|
+
initial-value: 0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@property --bottom-fade {
|
|
213
|
+
syntax: "<length>";
|
|
214
|
+
inherits: false;
|
|
215
|
+
initial-value: 0;
|
|
216
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{me}from"../chunk-dekjd5sf.js";import{useCallback as
|
|
1
|
+
import{me}from"../chunk-dekjd5sf.js";import{useCallback as xe,useEffect as P,useLayoutEffect as ye,useMemo as Q,useRef as I,useState as E}from"react";import"@alwith/module-chat/navigation-rail.css";import{jsxDEV as h,Fragment as Ne}from"react/jsx-dev-runtime";var we=4,ge=10;function Se(T,x){let v=new Map(x.flatMap((c)=>c.itemIds.map((w)=>[w,c.key]))),p=Array(T.length),C;for(let c=T.length-1;c>=0;c--)C=v.get(T[c])??C,p[c]=C;let O=Math.max(-1,...x.map((c)=>c.key))+1,B=new Set,n=[];for(let[c,w]of T.entries()){let S=v.get(w),g=n.at(-1);if(!g||S!==void 0&&S!==g.key||S===void 0&&g.itemIds.length>=64&&p[c]!==g.key){let y=S!==void 0&&!B.has(S)?S:O++;g={key:y,startIndex:c,itemIds:[]},n.push(g),B.add(y)}g.itemIds.push(w)}return n}function fe(T,x){if(T.size!==x.size)return!1;for(let v of T)if(!x.has(v))return!1;return!0}function Le({audio:T,beforeReveal:x,ensureItemMounted:v,items:p,onPreviewItem:C,renderPreview:O,onRevealError:B,scrollRoot:n,targetTopMarginPx:c=16}){let[w,S]=E(()=>{let e=p.at(-1);return new Set(e===void 0?[]:[e.id])}),[g,y]=E(null),[W,A]=E(null),[X,U]=E(!1),[_,pe]=E(()=>new Set),[ve,be]=E(!0),[Ie,j]=E(null),{installUnlock:Z,preload:ee,playSequence:te}=T,K=I(null),M=I(null),R=I(!1),H=I(null),L=I(0),N=I(null),G=I(new Set),V=Q(()=>p.map((e)=>e.id).join("\x00"),[p]),F=I(p);F.current=p;let ne=I(_),re=I(w),ie=I({itemIdsKey:V,scrollRoot:n});if(ie.current.scrollRoot!==n)L.current+=1,ie.current={itemIdsKey:V,scrollRoot:n};let m=Q(()=>v===void 0?p.filter((e)=>_.has(e.id)):p,[v,p,_]),se=Q(()=>m.map((e)=>({inputTokens:e.inputTokens,outputTokens:e.outputTokens})),[m]),z=I({ids:"",groups:[]}),ae=m.map((e)=>e.id).join("\x00");if(z.current.ids!==ae)z.current={ids:ae,groups:Se(m.map((e)=>e.id),z.current.groups)};P(()=>Z(),[Z]),P(()=>()=>{if(L.current+=1,N.current!==null)clearTimeout(N.current)},[]),P(()=>{y(null),U(!1),A(null),M.current=null,R.current=!1,H.current=null,j(null),G.current.clear()},[n]),P(()=>{ee()},[ee]),P(()=>{if(n===null)return;let e=new Set,t=new Map,r=new Set(F.current.map((o)=>o.id)),i=()=>{let o=new Set(t.values()),l=F.current.filter((f)=>o.has(f.id)).map((f)=>f.id),u=l.findIndex((f)=>e.has(f));if(u===-1)return;let b=u;for(let f=u+1;f<l.length;f++)if(e.has(l[f]))b=f;let k=new Set(l.slice(u,b+1));if(fe(re.current,k))return;re.current=k,S(k)},s=new IntersectionObserver((o)=>{for(let l of o){let u=t.get(l.target);if(l.isIntersecting)e.add(u);else e.delete(u)}i()},{root:n,rootMargin:`-${c}px 0px 0px 0px`}),a=()=>{let o=new Set,l=new Set;for(let u of n.querySelectorAll("[data-content-search-unit-key]")){let b=u.dataset.contentSearchUnitKey;if(b===void 0||!r.has(b)||o.has(b))continue;o.add(b);let k=u.closest("[data-turn-key]"),f=k===null||l.has(k)?u:k;if(l.add(f),t.has(f))continue;t.set(f,b),s.observe(f)}for(let u of t.keys()){if(l.has(u))continue;s.unobserve(u),e.delete(t.get(u)),t.delete(u)}if(i(),fe(ne.current,o))return;ne.current=o,pe(o)};a();let d=new MutationObserver((o)=>{if(o.some((u)=>[...u.addedNodes,...u.removedNodes].some((b)=>b instanceof Element&&(b.matches("[data-turn-key], [data-content-search-unit-key]")||b.querySelector("[data-turn-key], [data-content-search-unit-key]")!==null))))a()});return d.observe(n,{childList:!0,subtree:!0}),()=>{d.disconnect(),s.disconnect()}},[V,n,c]);let J=m.find((e)=>w.has(e.id))?.id??m.at(-1)?.id;ye(()=>{let e=K.current;if(e===null||M.current!==null||J===void 0)return;let t=e.querySelector(`[data-thread-user-message-navigation-item-id="${CSS.escape(J)}"]`);if(t===null)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();if(i.top<r.top)e.scrollTop+=i.top-r.top;else if(i.bottom>r.bottom)e.scrollTop+=i.bottom-r.bottom+1},[J,V]),P(()=>{let e=n?.querySelector("[data-thread-user-message-navigation-content]");if(!n||!e)return;let t=()=>{let i=n.getBoundingClientRect(),s=e.getBoundingClientRect();if(i.width===0||s.width===0)return;let a=n.offsetWidth>0?i.width/n.offsetWidth:1;be((s.left-i.left)/a>=48)},r=new ResizeObserver(t);return r.observe(n),r.observe(e),t(),()=>r.disconnect()},[n]);let he=xe(async(e,t="smooth")=>{if(n===null)throw Error("Thread user-message navigation scroll root is missing");let r=L.current+1;L.current=r,x();let i=()=>n.querySelector(`[data-content-search-unit-key="${CSS.escape(e.id)}"]`),s=i(),a=s!==null&&n.clientHeight>0&&s.closest("[data-turn-key]")!==null&&Math.abs(s.getBoundingClientRect().top-n.getBoundingClientRect().top)>n.clientHeight*2;if((s===null||a)&&v!==void 0){if(t==="instant"&&e.isLoaded===!1)return;s=await v(e,()=>L.current===r)??i(),t="instant"}if(L.current!==r)return;if(s===null)return;let d=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;s.scrollIntoView({behavior:d?"instant":t,block:"start"}),s.querySelector("[data-user-message-bubble], [data-composer-attachment-pill]")?.animate?.([{backgroundColor:"color-mix(in srgb, var(--foreground) 14%, transparent)"},{backgroundColor:"color-mix(in srgb, var(--foreground) 14%, transparent)",offset:0.35},{backgroundColor:"transparent"}],{duration:d?0:1000,easing:"cubic-bezier(0.23, 1, 0.32, 1)"})},[x,v,n]);if(m.length<we||!ve)return null;let Y=()=>{if(N.current!==null)clearTimeout(N.current);N.current=null},oe=(e,t=!1)=>{if(Y(),C===void 0||e.isLoaded!==!1||G.current.has(e.turnKey))return;let r=()=>{N.current=null,G.current.add(e.turnKey),C(e).catch(()=>G.current.delete(e.turnKey))};if(t)r();else N.current=setTimeout(r,150)},q=g===null?null:m.find((e)=>e.id===g.item.id)??m.find((e)=>e.nativeTurnId!==void 0&&e.nativeTurnId===g.item.nativeTurnId)??g.item,ue=(e,t="smooth")=>{he(e,t).catch((r)=>{if(B)B(r);else throw r})},de=m.findIndex((e)=>e.id===(W??Ie)),le=K.current,Te=g===null||!le?.contains(g.button)?0:Me(le,g.button),ce=(e)=>{let t=e?.closest("[data-thread-user-message-navigation-item-id]"),r=K.current;if(t===void 0||t===null||!r.contains(t))return null;let i=t.dataset.threadUserMessageNavigationItemId,s=m.findIndex((a)=>a.id===i);return{button:t,item:m[s],index:s}},D=(e)=>{let t=M.current;if(t?.pointerId!==e.pointerId)return;if(M.current=null,A(null),t.captureTarget.hasPointerCapture(e.pointerId))t.captureTarget.releasePointerCapture(e.pointerId)};return h("nav",{"aria-label":"User messages",className:"thread-user-message-navigation absolute start-4 top-1/2 z-20 -translate-y-1/2",children:h(me,{open:X,onOpenChange:U,side:"inline-end",sideOffset:0,align:"center",alignOffset:Te,trigger:h("div",{ref:K,"data-thread-user-message-navigation-rail-list":!0,"data-scrubbing":W===null?void 0:"",className:"thread-user-message-navigation-rail-list",onPointerEnter:()=>{H.current=null},onPointerDown:(e)=>{if(e.button!==0)return;Y();let t=ce(e.target instanceof Element?e.target:null);if(t===null)return;R.current=!1,M.current={pointerId:e.pointerId,itemId:t.item.id,itemIndex:t.index,captureTarget:t.button},t.button.setPointerCapture(e.pointerId),A(t.item.id),y(t),U(!0)},onPointerMove:(e)=>{let t=M.current;if(t===null){let d=ce(e.target instanceof Element?e.target:null);if(d!==null){j(d.item.id);let o=H.current;if(o!==null&&o!==d.index)te(o,d.index,se);H.current=d.index,y((l)=>l?.item.id===d.item.id?l:d),oe(d.item)}return}if(t.pointerId!==e.pointerId)return;if((e.buttons&1)===0){D(e);return}let r=e.currentTarget.getBoundingClientRect(),i=Math.max(0,Math.min(m.length-1,Math.floor((e.clientY-r.top+e.currentTarget.scrollTop)/ge))),a={button:e.currentTarget.querySelectorAll("[data-thread-user-message-navigation-item-id]")[i],item:m[i],index:i};if(a.item.id===t.itemId)return;te(t.itemIndex,a.index,se),H.current=a.index,M.current={...t,itemId:a.item.id,itemIndex:a.index},R.current=!0,A(a.item.id),y(a),ue(a.item,"instant")},onPointerUp:D,onPointerCancel:D,onLostPointerCapture:D,onPointerLeave:()=>{if(Y(),j(null),H.current=null,M.current===null&&!X)y(null)},children:h("div",{className:"flex flex-col",children:z.current.groups.map((e)=>h("div",{className:"flex w-9 shrink-0 flex-col [content-visibility:auto]",style:{height:e.itemIds.length*ge},children:m.slice(e.startIndex,e.startIndex+e.itemIds.length).map((t,r)=>{let i=e.startIndex+r,s=Math.abs(i-de),a=de===-1||s>3?void 0:[1,0.7,0.4,0.2][s];return h("button",{type:"button","data-thread-user-message-navigation-item-id":t.id,"data-scrub-target":W===t.id?"":void 0,"aria-current":w.has(t.id)?"true":void 0,"aria-label":`Jump to user message ${i+1}`,className:"thread-user-message-navigation-row",onClick:(d)=>{if(R.current){R.current=!1;return}let o={button:d.currentTarget,item:t,index:i};y(o),U(!0),ue(t)},onFocus:(d)=>{oe(t,!0),y({button:d.currentTarget,item:t,index:i}),U(!0)},children:h("span",{className:"flex h-0.5 w-[30px] items-center",children:h("span",{className:"thread-user-message-navigation-marker",style:a===void 0?void 0:{"--marker-progress":a}},void 0,!1,void 0,this)},void 0,!1,void 0,this)},t.id,!1,void 0,this)})},e.key,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:q!==null&&h("div",{className:"bg-popover/95 text-popover-foreground ring-border w-80 max-w-[calc(100vw-1rem)] overflow-hidden rounded-xl p-2 text-sm leading-5 shadow-xl ring-[0.5px] backdrop-blur-sm",children:O?O(q):h(Ne,{children:[h("div",{className:"min-w-0 truncate font-medium",children:q.label},void 0,!1,void 0,this),q.response.length>0&&h("div",{className:"text-muted-foreground mt-1 line-clamp-3",children:q.response},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Me(T,x){let v=T.getBoundingClientRect(),p=x.getBoundingClientRect();return p.top+p.height/2-(v.top+v.height/2)}export{Le as ThreadUserMessageNavigationRail};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{vt,pe,g,K,ge,fe,he}from"../chunk-swg5v7sg.js";export{vt as CODEX_UNKNOWN_TURN_HEIGHT,g as calculateCodexThreadVirtualRange,fe as calculateCodexTurnCenterDistanceFromBottom,he as calculateCodexTurnTargetDistanceFromBottom,pe as createCodexThreadVirtualLayout,ge as preserveCodexThreadDistanceFromBottom,K as preserveCodexThreadRenderedWindow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pe,g,K,ge,fe,he}from"../chunk-
|
|
1
|
+
import{pe,g,K,ge,fe,he}from"../chunk-swg5v7sg.js";import{forwardRef as Te,useCallback as L,useEffect as xe,useImperativeHandle as be,useLayoutEffect as M,useMemo as ie,useRef as s,useState as N}from"react";import{jsxDEV as m}from"react/jsx-dev-runtime";var Pe=12,J=2,W=800,ye=new Map;function Be({turnKey:_,heightPx:v,placeholder:U=!1,deferUntilReady:n=!1,observe:T,onReady:C,children:k}){let f=s(null),[b,G]=N(!1),X=L((x)=>{f.current=x,T(_,x)},[T,_]);return M(()=>{let x=f.current;if(x===null)throw Error("Codex turn element is missing");let P=()=>{C(x),G(!0)};if(x.querySelector("[data-markdown-pending]")===null){P();return}let d=new MutationObserver(()=>{if(x.querySelector("[data-markdown-pending]")!==null)return;d.disconnect(),P()});return d.observe(x,{childList:!0,subtree:!0}),()=>d.disconnect()},[C]),m("div",{style:b?void 0:{position:"relative",height:v,overflow:"hidden"},children:[m("div",{ref:X,className:"[&_[data-virtualized-turn-content]]:[content-visibility:visible]","data-turn-key":_,"aria-busy":!b||void 0,style:!b&&!U&&n?{visibility:"hidden"}:void 0,"data-turn-ready":b?"":void 0,children:k},void 0,!1,void 0,this),!b&&!U&&n&&m("div",{"aria-hidden":"true",className:"codex-turn-loading",children:m("div",{className:"codex-turn-loading-lines",children:[m("span",{},void 0,!1,void 0,this),m("span",{},void 0,!1,void 0,this),m("span",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Me=Te(function({entries:v,renderTurn:U,scrollElement:n,sessionKey:T,leadingContent:C,leadingInsetPx:k=0,preserveViewport:f=!1},b){let G=s(null),[X,x]=N(k),P=C!==void 0&&C!==null;M(()=>{let e=G.current;if(e===null)return;let t=()=>x(e.getBoundingClientRect().height);t();let o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[P]);let d=ie(()=>ye.get(T),[T]),[Q,Y]=N(()=>d?.turnHeightsByKey??{}),i=ie(()=>pe({entries:v,gapPx:Pe,measuredHeightsByKey:Q,leadingInsetPx:P?X:k}),[v,Q,P,X,k]),ve=ie(()=>{let e=g({distanceFromBottomPx:d?.distanceFromBottomPx??0,layout:i,overscanCount:J,viewportHeightPx:W}),t=d?.renderedWindow;if(t===void 0||t===null)return e;return K({anchorKey:t.anchorKey,layout:i,previousRange:{startIndex:0,endIndex:Math.min(t.count,e.endIndex-e.startIndex)}})??e},[d,i]),[I,oe]=N(ve),[p,ue]=N(W),[c,ae]=N(null),S=s(d?.distanceFromBottomPx??0),E=s(I),se=s(i.turnKeys),l=s(Q),D=s(i),ce=s(i),B=s(new Map),R=s(null),F=s(null),O=s(null),A=s(new Map),Z=s(!1),de=s(()=>{}),V=s(null),le=L(()=>{if(!f||n===null||R.current!==null||V.current!==null)return;let e=n.getBoundingClientRect();if(e.height<=0)return;let t=[...B.current].filter(([,r])=>r.hasAttribute("data-turn-ready")).map(([r,u])=>{let a=u.getBoundingClientRect(),h=D.current.turnIndexByKey.get(r),w=h===void 0?a.height:D.current.heightsPx[h];return{key:r,element:u,rect:a,bottom:a.top+w}}).filter(({rect:r,bottom:u})=>u>e.top&&r.top<e.bottom).toSorted((r,u)=>r.rect.top-u.rect.top),o=t.flatMap((r)=>[...r.element.querySelectorAll("[data-user-message-bubble], .codex-markdown-root > *")].filter((u)=>!u.closest('[aria-hidden="true"], [inert]')).map((u)=>({key:r.key,element:u,rect:u.getBoundingClientRect()})).filter(({rect:u})=>u.height>0&&u.top>=e.top&&u.top<e.bottom)).toSorted((r,u)=>r.rect.top-u.rect.top)[0]??t[0];if(o)V.current={key:o.key,element:o.element,top:o.rect.top-e.top,scrollTop:n.scrollTop}},[f,n]),ee=s(le);ee.current=le;let H=L((e,t)=>{let o=Math.min(e,i.totalHeightPx),r=g({distanceFromBottomPx:o,layout:i,overscanCount:J,viewportHeightPx:t}),u=E.current,a=u.startIndex<=r.startIndex&&u.endIndex>=r.endIndex?u:r;if(S.current=o,E.current=a,se.current=i.turnKeys,ue(t),a!==u)oe(a)},[i]),q=L((e)=>{let t=Math.max(0,e.scrollHeight-i.totalHeightPx);return Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop-t)},[i.totalHeightPx]),Re=L((e)=>{let t=e.dataset.turnKey;if(t===void 0)throw Error("Codex measured turn is missing its key");let o=Math.max(1,e.getBoundingClientRect().height);if(l.current[t]===o)return;ee.current();let r={...l.current,[t]:o};l.current=r,Y(r)},[]),te=L(()=>{if(F.current!==null)return F.current;return F.current=new ResizeObserver((e)=>{for(let t of e){let o=t.target;if(!("turnReady"in o.dataset)&&o.querySelector("[data-markdown-pending]")!==null)continue;let r=o.dataset.turnKey;if(r===void 0)throw Error("Codex measured turn is missing its key");let u=Math.max(1,t.borderBoxSize[0]?.blockSize??t.contentRect.height);A.current.set(r,u)}if(O.current!==null||A.current.size===0)return;O.current=requestAnimationFrame(()=>{O.current=null;let t=[...A.current].filter(([r,u])=>l.current[r]!==u);if(A.current.clear(),t.length===0)return;ee.current();let o={...l.current,...Object.fromEntries(t)};l.current=o,Y(o)})}),F.current},[]),He=L((e,t)=>{let o=B.current.get(e);if(o!==void 0)te().unobserve(o),B.current.delete(e);if(t===null)return;if(t.dataset.turnKey!==e)throw Error(`Codex turn key does not match its element: ${e}`);B.current.set(e,t),te().observe(t)},[te]);xe(()=>()=>{if(F.current?.disconnect(),O.current!==null)cancelAnimationFrame(O.current);A.current.clear(),F.current=null,B.current.clear()},[]),M(()=>{de.current=()=>{if(n===null)return;let e=q(n);if(R.current!==null){S.current=e,ue(n.clientHeight||W);return}H(e,n.clientHeight||W)}},[q,n,H]),M(()=>{if(n===null)return;if(!Z.current){Z.current=!0;let o=d?.distanceFromBottomPx??0;n.scrollTo({behavior:"instant",top:Math.max(0,o>0?D.current.totalHeightPx-n.clientHeight-o:n.scrollHeight-n.clientHeight)})}let e=()=>de.current();e(),n.addEventListener("scroll",e,{passive:!0});let t=new ResizeObserver(e);return t.observe(n),()=>{n.removeEventListener("scroll",e),t.disconnect()}},[d,n]),M(()=>{if(n===null||c===null)return;let e=B.current.get(c.turnKey);if(e?.querySelector("[data-markdown-pending]")!==null)return;let t=e.offsetHeight;if(t<=0)return;if(l.current[c.turnKey]!==t){let h={...l.current,[c.turnKey]:t};l.current=h,Y(h);return}let o=c.getTargetElement(e)??e,r=e.getBoundingClientRect(),u=o.getBoundingClientRect(),a=he({align:c.align,layout:i,targetHeightPx:u.height,targetOffsetPx:u.top-r.top,turnKey:c.turnKey,viewportHeightPx:n.clientHeight});if(a===null)throw Error(`Codex virtual turn is missing: ${c.turnKey}`);n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-a)}),H(a,n.clientHeight||W),queueMicrotask(()=>{if(R.current!==c)return;c.complete(),R.current=null,ae(null)})},[i,c,n,H]),M(()=>{let e=ce.current;if(ce.current=i,D.current=i,n===null||c!==null){V.current=null;return}let t=V.current;V.current=null;let o=t===null?void 0:n.contains(t.element)?t.element:B.current.get(t.key);if(f&&e!==i&&t!==null&&o!==void 0){let u=o.getBoundingClientRect().top-n.getBoundingClientRect().top,a=n.scrollTop-t.scrollTop;n.scrollTop+=u-t.top+a,H(q(n),n.clientHeight);return}let r=S.current;if(f&&e!==i&&Z.current)r=Math.max(0,e.totalHeightPx-n.clientHeight-n.scrollTop);if((r>24||f)&&e!==i){let u=q(n);if(u<=96&&!f){H(u,p);return}let a=g({distanceFromBottomPx:r,layout:e,overscanCount:0,viewportHeightPx:p}),h=e.turnKeys.slice(a.startIndex,a.endIndex).filter((y)=>i.turnIndexByKey.has(y)),w=h.find((y)=>l.current[y]!==void 0)??h[0];if(w!==void 0){let y=ge({anchorKey:w,distanceFromBottomPx:r,nextLayout:i,previousLayout:e});if(y===null)throw Error(`Codex viewport anchor is missing: ${w}`);r=y,n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-r)})}}H(r,p)},[i,c,q,n,H,p,f]),M(()=>{E.current=I},[I]),xe(()=>()=>{R.current?.complete(),R.current=null;let e=E.current,o=D.current.turnKeys[e.startIndex];ye.set(T,{distanceFromBottomPx:S.current,renderedWindow:o===void 0?null:{anchorKey:o,count:e.endIndex-e.startIndex},turnHeightsByKey:l.current})},[T]),be(b,()=>({scrollToKey(e,t=(r)=>r,o={align:"center"}){R.current?.complete();let r=i.turnIndexByKey.get(e);if(r===void 0)throw Error(`Codex virtual turn is missing: ${e}`);let u=i.turnKeys[r],a=fe({layout:i,turnKey:e,viewportHeightPx:p});if(a===null)throw Error(`Codex virtual turn is missing: ${e}`);let h=g({distanceFromBottomPx:a,layout:i,overscanCount:J,viewportHeightPx:p});return E.current=h,oe(h),new Promise((w)=>{let y={align:o.align,complete:w,getTargetElement:t,turnKey:u};R.current=y,ae(y)})}}),[i,p]);let z=I,j=se.current;if(!(j===i.turnKeys||j.length===i.turnKeys.length&&j.every((e,t)=>e===i.turnKeys[t]))){let e=j[I.startIndex];z=(e===void 0?null:K({anchorKey:e,layout:i,previousRange:I}))??g({distanceFromBottomPx:S.current,layout:i,overscanCount:J,viewportHeightPx:p})}let ne=v.length-1,me=v[ne],re=v.slice(z.startIndex,Math.min(z.endIndex,ne)).map((e,t)=>({entry:e,index:z.startIndex+t}));if(me!==void 0)re.push({entry:me,index:ne});return m("div",{"data-codex-thread":!0,"data-codex-virtualized-pending-key":c?.turnKey,"data-codex-virtualized-range":`${z.startIndex}:${z.endIndex}`,"data-codex-virtualized-total-count":v.length,"data-codex-virtualized-turn-count":re.length,className:"relative shrink-0",style:{height:i.totalHeightPx},children:[P&&m("div",{ref:G,"data-codex-thread-leading":!0,className:"absolute inset-x-0 top-0",children:C},void 0,!1,void 0,this),re.map(({entry:e,index:t})=>m("div",{className:"absolute inset-x-0",style:{top:i.topOffsetsPx[t]??0},children:m(Be,{turnKey:e.turnKey,heightPx:i.heightsPx[t],placeholder:e.placeholder,deferUntilReady:e.deferUntilReady,observe:He,onReady:Re,children:U(e,t)},void 0,!1,void 0,this)},e.turnKey,!1,void 0,this))]},void 0,!0,void 0,this)});export{Me as VirtualizedTurnList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V,
|
|
1
|
+
import{V,xt}from"../chunk-kzccs8ak.js";import"../chunk-hnt4tt1n.js";export{xt as filterFiles,V as filterSlashCommands};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e}from"../chunk-7pr2j1zb.js";import{N}from"../chunk-8zs8vy0q.js";import"../chunk-hnt4tt1n.js";import{V}from"../chunk-
|
|
1
|
+
import{e}from"../chunk-7pr2j1zb.js";import{N}from"../chunk-8zs8vy0q.js";import"../chunk-hnt4tt1n.js";import{V}from"../chunk-kzccs8ak.js";import{ue}from"../chunk-bhvtt6tv.js";import{ce}from"../chunk-awbgf3hp.js";import{autoUpdate as rt}from"@floating-ui/dom";import{cn as X}from"cn";import{BookOpenTextIcon as st,FileIcon as it,StoreIcon as lt}from"lucide-react";import{useCallback as ut,useEffect as v,useLayoutEffect as Y,useMemo as Z,useRef as _,useState as g}from"react";import{createPortal as at}from"react-dom";import{jsxDEV as i,Fragment as ct}from"react/jsx-dev-runtime";function wt({handleRef:c,anchorRef:m,commands:T,searchFiles:a,onMention:R,onSearchError:H,fileSearchDebounceMs:C=0,bashMode:A=!1,forcedOpen:l=!1,onForcedOpenChange:f,emptyLabel:F,fileStatusLabels:E,morePlugins:M}){let j=ce(),u=j.textInput.value,[z,K]=g(0),[y,D]=g(null),[b,h]=g(0),U=_(null);v(()=>{let t=c.current?.getTextarea();if(!t)return;let n=()=>K(t.selectionStart??0),o=()=>{if(document.activeElement===t)n()};return t.addEventListener("keyup",n),t.addEventListener("click",n),t.addEventListener("input",n),t.addEventListener("select",n),t.addEventListener("focus",n),document.addEventListener("selectionchange",o),()=>{t.removeEventListener("keyup",n),t.removeEventListener("click",n),t.removeEventListener("input",n),t.removeEventListener("select",n),t.removeEventListener("focus",n),document.removeEventListener("selectionchange",o)}});let W=Z(()=>A&&u.startsWith("!")?null:ue(u,z),[u,z,A]),r=W?.kind==="at"&&!a?null:W,P=`${r?.kind??"forced"}:${r?.query??""}:${l}`,[O,tt]=g(P);if(O!==P)tt(P),h(0);let L=_(null);v(()=>{if(!l){L.current=null;return}if(L.current===null)L.current=u;else if(u!==L.current)f?.(!1)},[l,u,f]);let x=r?.kind==="at"?r.query:null;v(()=>{if(x===null||!a){D(null);return}let t=!0,n=()=>{a(x).then((s)=>{if(t)D({query:x,search:a,items:s})},(s)=>{if(t)D({query:x,search:a,items:[]}),H(s)})},o=C>0?window.setTimeout(n,C):null;if(o===null)n();return()=>{if(t=!1,o!==null)window.clearTimeout(o)}},[x,a,C,H]);let d=Z(()=>{if(r?.kind==="at")return y?.query===r.query&&y.search===a?y.items:[];if(r)return V(T,r.query);if(l)return V(T,"");return[]},[r,l,T,y,a]),[et,q]=g(!1);v(()=>{let t=c.current?.getTextarea();if(!t)return;let n=()=>q(!0),o=()=>{if(q(!1),l)f?.(!1)};return q(document.activeElement===t),t.addEventListener("focus",n),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",n),t.removeEventListener("blur",o)}},[c,l,f]),v(()=>{if(l)c.current?.getTextarea()?.focus()},[l,c]);let p=et&&(r!==null?r.kind==="slash"||d.length>0||!!E:l);v(()=>{if(!p)return;U.current?.querySelector(`[data-idx="${b}"]`)?.scrollIntoView({block:"nearest"})},[b,p]);function Q(t){let n=c.current?.getTextarea();if(!n)return;let o,s;if(r){let B=r.kind==="slash"?`/${t.payload} `:`@${t.label} `;if(o=u.slice(0,r.start)+B+u.slice(r.end),r.kind==="at")R?.(t.payload);s=r.start+B.length}else if(l)o=`${u.length===0||u.endsWith(`
|
|
2
2
|
`)?u:`${u}
|
|
3
3
|
`}/${t.payload} `,s=o.length,f?.(!1);else return;j.textInput.setInput(o),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(s,s)})}v(()=>{let t=c.current?.getTextarea();if(!t)return;let n=(o)=>{if(!p)return;if(c.current?.isComposing()||o.isComposing||o.keyCode===229)return;if(o.key==="ArrowDown")o.preventDefault(),o.stopPropagation(),h((s)=>d.length===0?0:Math.min(d.length-1,s+1));else if(o.key==="ArrowUp")o.preventDefault(),o.stopPropagation(),h((s)=>Math.max(0,s-1));else if(o.key==="Enter"||o.key==="Tab"){o.preventDefault(),o.stopPropagation();let s=d[b];if(s)Q(s)}else if(o.key==="Escape")if(o.preventDefault(),o.stopPropagation(),r)K(Math.max(0,r.start-1)),t.setSelectionRange(r.start,r.start);else f?.(!1)};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)});let[k,G]=g(null),[S,nt]=g(null),I=ut(()=>{let t=m?.current;if(!t)return;let n=t.getBoundingClientRect();G({left:n.left,width:n.width,bottom:window.innerHeight-n.top+8})},[m]);if(Y(()=>{if(!p){G(null);return}I()},[p,I]),Y(()=>{let t=m?.current;if(!p||!t||!S)return;return rt(t,S,I,{animationFrame:!0})},[p,S,m,I]),!p||m&&!k)return null;let w=r?r.kind==="slash":l,ot=w?st:it,J=i("div",{ref:nt,className:m?"fixed z-50":"absolute inset-x-0 bottom-full z-50 mb-2",style:m&&k?{left:k.left,width:k.width,bottom:k.bottom}:void 0,children:i("div",{ref:U,role:"listbox",onMouseDown:(t)=>t.preventDefault(),className:"bg-popover text-popover-foreground ring-foreground/10 pointer-events-auto w-full overflow-hidden rounded-lg p-1 shadow-md ring-1 outline-hidden",children:[i("div",{className:"max-h-72 overflow-y-auto",children:[d.length===0&&w&&i("div",{className:"text-muted-foreground px-2 py-3 text-xs",children:F},void 0,!1,void 0,this),d.length===0&&!w&&E&&i("div",{role:"status",className:"text-muted-foreground px-2 py-3 text-xs",children:y?.query===x&&y.search===a?E.empty:E.loading},void 0,!1,void 0,this),d.map((t,n)=>i(e,{type:"button",variant:"ghost",role:"option","aria-selected":n===b,"data-idx":n,onMouseDown:(o)=>{o.preventDefault(),Q(t)},onMouseEnter:()=>h(n),className:X("flex h-auto w-full items-center justify-start gap-2.5 rounded-md px-2.5 py-2 text-start",n===b&&"bg-muted"),children:[i(ot,{className:X("size-4 shrink-0",w?"text-blue-500":"text-muted-foreground")},void 0,!1,void 0,this),i("span",{className:"text-foreground shrink-0 text-sm font-medium",children:t.label},void 0,!1,void 0,this),t.description&&i("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:t.description},void 0,!1,void 0,this)]},t.key,!0,void 0,this))]},void 0,!0,void 0,this),w&&M&&i(ct,{children:[i(N,{},void 0,!1,void 0,this),i(e,{type:"button",variant:"ghost",onMouseDown:(t)=>{t.preventDefault(),f?.(!1),M.open()},className:"h-auto w-full justify-start px-2.5 py-2",children:[i(lt,{"data-icon":"inline-start"},void 0,!1,void 0,this),M.label]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return m?at(J,document.body):J}export{wt as CompletionMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n}from"../chunk-
|
|
1
|
+
import{n}from"../chunk-skx67pc6.js";import"../chunk-kj1wrn2j.js";export{n as MenuRadioSelect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"../chunk-7pr2j1zb.js";import{v,x,m,b,H,y,P,I,M,J,s}from"../chunk-2845n9v4.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-g3r8m488.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(v,{open:de,onOpenChange:re,children:[a(G,{children:[a(j,{render:a(x,{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(v,{open:me,onOpenChange:ue,children:[a(G,{children:[a(j,{render:a(x,{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-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 +1 @@
|
|
|
1
|
-
import{e}from"../chunk-7pr2j1zb.js";import{v,
|
|
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 +1 @@
|
|
|
1
|
-
import{e}from"../chunk-7pr2j1zb.js";import"../chunk-m8gejgjs.js";import{
|
|
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};
|
package/dist/search/find-bar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ve}from"../chunk-70sfgw0j.js";import"../chunk-m8gejgjs.js";import"../chunk-7pr2j1zb.js";export{ve as FindBar};
|
package/dist/ui/dropdown-menu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwith/module-chat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -275,7 +275,8 @@
|
|
|
275
275
|
"types": "./dist/lib/code-highlighter.worker.d.ts",
|
|
276
276
|
"import": "./dist/lib/code-highlighter.worker.js",
|
|
277
277
|
"default": "./dist/lib/code-highlighter.worker.js"
|
|
278
|
-
}
|
|
278
|
+
},
|
|
279
|
+
"./navigation-rail.css": "./dist/codex/navigation-rail.css"
|
|
279
280
|
},
|
|
280
281
|
"peerDependencies": {
|
|
281
282
|
"@agentclientprotocol/sdk": "^2.0.2",
|