import{j as e,r as t}from"./vendor-react-RSDKEZ60.js";import{bb as s,f as r,gt as a,gu as n,gv as o,gw as l,gx as c,S as i,A as u}from"./c818056db-BBpc4u6S.js";import{u as d}from"./c85adc124-D_vRw5L5.js";import{u as x}from"./vendor-intl-BNW8a19h.js";import{c as b,p as m,a as p}from"./vendor-zustand-IIUY2Tf-.js";const f=t=>e.jsx(s,{...t,children:e.jsx("path",{d:"M12.67 3a3.25 3.25 0 0 1 3.206 2.716l.68 4.082A2.75 2.75 0 0 1 13.845 13H11.61l.403 2.01A2.5 2.5 0 0 1 9.56 18h-.238a1 1 0 0 1-.843-.46l-.069-.13-1.514-3.364a2.75 2.75 0 0 0-1.56-1.453l-.139-.047-1.14-.35A1.5 1.5 0 0 1 3 10.761V4.5A1.5 1.5 0 0 1 4.5 3zM4.5 4a.5.5 0 0 0-.5.5v6.262a.5.5 0 0 0 .353.477l1.14.35.19.065a3.75 3.75 0 0 1 2.127 1.98L9.323 17h.238a1.5 1.5 0 0 0 1.47-1.794l-.521-2.608A.5.5 0 0 1 11 12h2.844a1.75 1.75 0 0 0 1.726-2.038l-.68-4.082A2.25 2.25 0 0 0 12.67 4z"})}),h=t=>e.jsx(s,{...t,children:e.jsx("path",{d:"M9.56 2a2.5 2.5 0 0 1 2.452 2.99L11.609 7h2.235a2.75 2.75 0 0 1 2.713 3.202l-.681 4.082A3.25 3.25 0 0 1 12.67 17H4.5A1.5 1.5 0 0 1 3 15.5V9.238a1.5 1.5 0 0 1 1.059-1.433l1.14-.35.139-.048a2.75 2.75 0 0 0 1.56-1.453L8.41 2.59l.07-.13A1 1 0 0 1 9.322 2zM7.81 6.365a3.75 3.75 0 0 1-2.126 1.98l-.192.065-1.14.35A.5.5 0 0 0 4 9.239V15.5a.5.5 0 0 0 .5.5h8.17a2.25 2.25 0 0 0 2.22-1.88l.68-4.082A1.75 1.75 0 0 0 13.844 8H11a.5.5 0 0 1-.49-.598l.521-2.608A1.5 1.5 0 0 0 9.561 3h-.238z"})}),g=/\x1b(?:\[[0-9;?]*[A-Za-z]|\][^\x07\x1b]*(?:\x07|\x1b\\)?|[()][A-B012]|[78DEHM=>Nnl])/g;function j(e){return g.lastIndex=0,g.test(e)}function v(e){return e.replace(g,"")}const S={0:"#4d4d4c",1:"#c82829",2:"#718c00",3:"#eab700",4:"#4271ae",5:"#8959a8",6:"#3e999f",7:"#d6d6d6"},k={0:"#8e908c",1:"#f5871f",2:"#a2bd40",3:"#f0c674",4:"#6ca4e0",5:"#b777db",6:"#6bc8cd",7:"#ffffff"};function y(e){if(e<0||e>255)return;if(e<8)return S[e];if(e<16)return k[e-8];if(e<232){const t=e-16,s=Math.floor(t/36),r=Math.floor(t%36/6),a=t%6,n=e=>(0===e?0:55+40*e).toString(16).padStart(2,"0");return`#${n(s)}${n(r)}${n(a)}`}const t=(8+10*(e-232)).toString(16).padStart(2,"0");return`#${t}${t}${t}`}function C(e,t){let s={...t},r=0;for(;r<e.length;){const t=e[r];switch(t){case 0:s={};break;case 1:s.bold=!0;break;case 2:s.dim=!0;break;case 3:s.italic=!0;break;case 4:s.underline=!0;break;case 9:s.strikethrough=!0;break;case 22:s.bold=!1,s.dim=!1;break;case 23:s.italic=!1;break;case 24:s.underline=!1;break;case 29:s.strikethrough=!1;break;case 39:delete s.fg;break;case 49:delete s.bg;break;default:if(t>=30&&t<=37)s.fg=S[t-30];else if(t>=40&&t<=47)s.bg=S[t-40];else if(t>=90&&t<=97)s.fg=k[t-90];else if(t>=100&&t<=107)s.bg=k[t-100];else if(38===t){if(5===e[r+1]&&r+2<e.length)s.fg=y(e[r+2]??0),r+=2;else if(2===e[r+1]&&r+4<e.length){const t=(e[r+2]??0).toString(16).padStart(2,"0"),a=(e[r+3]??0).toString(16).padStart(2,"0"),n=(e[r+4]??0).toString(16).padStart(2,"0");s.fg=`#${t}${a}${n}`,r+=4}}else if(48===t)if(5===e[r+1]&&r+2<e.length)s.bg=y(e[r+2]??0),r+=2;else if(2===e[r+1]&&r+4<e.length){const t=(e[r+2]??0).toString(16).padStart(2,"0"),a=(e[r+3]??0).toString(16).padStart(2,"0"),n=(e[r+4]??0).toString(16).padStart(2,"0");s.bg=`#${t}${a}${n}`,r+=4}}r++}return s}function N(e){const t=[];let s,r={},a=0;for(g.lastIndex=0;null!==(s=g.exec(e));){if(s.index>a){const n=e.slice(a,s.index);n&&t.push({text:n,style:{...r}})}a=s.index+s[0].length;const n=s[0];if(n.startsWith("\x1b[")&&n.endsWith("m")){const e=n.slice(2,-1);r=C(""===e?[0]:e.split(";").map(e=>parseInt(e,10)||0),r)}}if(a<e.length){const s=e.slice(a);s&&t.push({text:s,style:{...r}})}return t}function w(e){const t={};let s=!1;return e.bold&&(t.fontWeight="bold",s=!0),e.dim&&(t.opacity=.7,s=!0),e.italic&&(t.fontStyle="italic",s=!0),e.underline&&(t.textDecoration="underline",s=!0),e.strikethrough&&(t.textDecoration=e.underline?"underline line-through":"line-through",s=!0),e.fg&&(t.color=e.fg,s=!0),e.bg&&(t.backgroundColor=e.bg,s=!0),s?t:void 0}const T=t.memo(({code:s,className:a,codeTagProps:n})=>{const o=t.useMemo(()=>N(s),[s]);return e.jsx("pre",{className:r("!my-0 !p-0 !rounded-none !text-sm !leading-relaxed whitespace-pre-wrap break-words overflow-x-auto",a),children:e.jsx("code",{...n,children:o.map((t,s)=>{const r=w(t.style);return r?e.jsx("span",{style:r,children:t.text},s):t.text})})})});function $({className:s,code:i,codeTagProps:u,language:d,title:x}){const{codeStyle:b}=a(),{exceedsSizeLimit:m}=n(i),p=t.useMemo(()=>j(i),[i]),f="code-block__code !my-0 !p-0 !rounded-none !text-sm !leading-relaxed";return e.jsxs("div",{className:r("flex flex-col gap-3 p-3 bg-bg-100 rounded-md",s),children:[e.jsx(z,{language:d,title:x}),m?e.jsx(o,{code:i,codeClassName:r(f,"-px-3")}):p?e.jsx(T,{code:i,className:f,codeTagProps:u}):e.jsx(l,{className:f,codeTagProps:u,language:d,PreTag:"div",style:b,renderer:c,wrapLongLines:!0,children:i})]})}function z({language:t,title:s}){return e.jsx("div",{className:"flex justify-between items-center h-3",children:e.jsx("p",{className:r("text-text-300 text-[0.6875rem]",s?"font-ui font-medium":"font-mono font-[450]"),children:s||t})})}T.displayName="AnsiOutput";const L=b()(m(e=>({drafts:{},submitted:{},setFreeText:(t,s)=>e(e=>({drafts:{...e.drafts,[t]:{...e.drafts[t]??{freeText:"",steps:{}},freeText:s}}})),setStepThumb:(t,s,r)=>e(e=>{const a=e.drafts[t]??{freeText:"",steps:{}},n={...a.steps[s]??{},thumb:r};return void 0===r&&delete n.thumb,{drafts:{...e.drafts,[t]:{...a,steps:{...a.steps,[s]:n}}}}}),setStepNote:(t,s,r)=>e(e=>{const a=e.drafts[t]??{freeText:"",steps:{}},n=a.steps[s]??{};return{drafts:{...e.drafts,[t]:{...a,steps:{...a.steps,[s]:{...n,note:r}}}}}}),markSubmitted:t=>e(e=>({submitted:{...e.submitted,[t]:Date.now()}})),clearDraft:t=>e(e=>{const{[t]:s,...r}=e.drafts;return{drafts:r}})}),{name:"transcript-feedback-drafts",storage:p(()=>localStorage),onRehydrateStorage:()=>e=>{if(!e)return;const t=Object.entries(e.drafts);if(t.length<=50)return;const s=e.submitted,r=t.sort(([e],[t])=>(s[t]??1/0)-(s[e]??1/0));e.drafts=Object.fromEntries(r.slice(0,50)),e.submitted=Object.fromEntries(Object.entries(s).filter(([t])=>t in e.drafts))}}));function A(e){return L(t=>t.drafts[e])}function V(e){return L(t=>t.submitted[e])}const I=t.createContext(null),O=I.Provider;function _(){return null!==t.useContext(I)}function M(t){return e.jsx(s,{...t,children:e.jsx("path",{d:"M9.56055 2C11.1381 2.00009 12.3211 3.44332 12.0117 4.99023L11.6094 7H13.8438C15.5431 7 16.836 8.52594 16.5566 10.2021L15.876 14.2842C15.6148 15.8513 14.2586 17 12.6699 17H4.5C3.67157 17 3 16.3284 3 15.5V9.23828C3.00013 8.57996 3.4294 7.99838 4.05859 7.80469L5.19824 7.4541L5.33789 7.40723C6.02983 7.15302 6.59327 6.63008 6.89746 5.9541L8.41113 2.58984L8.48047 2.46094C8.66235 2.17643 8.97898 2.00002 9.32324 2H9.56055Z"})})}function P(t){return e.jsx(s,{...t,children:e.jsx("path",{d:"M12.6699 3C14.2586 3 15.6148 4.14871 15.876 5.71582L16.5566 9.79785C16.836 11.4741 15.5431 13 13.8438 13H11.6094L12.0117 15.0098C12.3211 16.5567 11.1381 17.9999 9.56055 18H9.32324C8.97898 18 8.66235 17.8236 8.48047 17.5391L8.41113 17.4102L6.89746 14.0459C6.59327 13.3699 6.02983 12.847 5.33789 12.5928L5.19824 12.5459L4.05859 12.1953C3.4294 12.0016 3.00013 11.42 3 10.7617V4.5C3 3.67157 3.67157 3 4.5 3H12.6699Z"})})}const H=t.memo(({toolUseId:s,toolName:a})=>{const n=x(),o=t.useContext(I),l=o?.sessionId,c=L(e=>l?e.drafts[l]?.steps[s]:void 0),[d,b]=t.useState(!1),m=t.useCallback(e=>{l&&L.getState().setStepThumb(l,s,e)},[l,s]),p=t.useCallback(()=>m("up"===c?.thumb?void 0:"up"),[m,c?.thumb]),g=t.useCallback(()=>{m("down"===c?.thumb?void 0:"down"),"down"===c?.thumb||c?.note||b(!0)},[m,c?.thumb,c?.note]),j=t.useCallback(e=>{l&&L.getState().setStepNote(l,s,e.target.value)},[l,s]),v=t.useCallback(()=>b(e=>!e),[]);if(!o)return null;const S=d||(c?.note?.length??0)>0;return e.jsxs("div",{className:"-mt-1 mb-1.5 pl-10",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-text-400",children:[e.jsx("button",{type:"button",onClick:p,"aria-label":u({id:"858vuq",intl:n,dangerouslyVisiblePublicValues:{toolName:a}}),"aria-pressed":"up"===c?.thumb,className:r("rounded p-1 transition-colors hover:bg-bg-200","up"===c?.thumb?"text-accent-brand":"text-text-400"),children:"up"===c?.thumb?e.jsx(M,{vectorSizeOverride:14}):e.jsx(h,{vectorSizeOverride:14})}),e.jsx("button",{type:"button",onClick:g,"aria-label":u({id:"858u4e",intl:n,dangerouslyVisiblePublicValues:{toolName:a}}),"aria-pressed":"down"===c?.thumb,className:r("rounded p-1 transition-colors hover:bg-bg-200","down"===c?.thumb?"text-danger-000":"text-text-400"),children:"down"===c?.thumb?e.jsx(P,{vectorSizeOverride:14}):e.jsx(f,{vectorSizeOverride:14})}),e.jsx("button",{type:"button",onClick:v,"aria-expanded":S,className:"rounded px-1.5 py-1 text-text-400 hover:bg-bg-200 hover:text-text-200",children:c?.note?e.jsx(i,{id:"4zcmoq"}):e.jsx(i,{id:"1fquwm5"})})]}),S&&e.jsx("input",{type:"text",value:c?.note??"",onChange:j,placeholder:u({id:"wvlyhq",intl:n}),className:"bg-bg-000 border-border-300 mt-1 w-full max-w-md rounded border px-2 py-1 text-xs text-text-200 placeholder:text-text-500"})]})});function E(e){const t=e.action.replace(/_/g," ");switch(e.action){case"key":return`key ${e.text??""}`.trim();case"type":return`type "${e.text??""}"`;case"left_click":case"right_click":case"double_click":case"triple_click":case"middle_click":case"mouse_move":case"left_mouse_down":case"left_mouse_up":return e.coordinate?`${t} (${e.coordinate[0]}, ${e.coordinate[1]})`:t;default:return e.text?`${t} ${e.text}`:t}}H.displayName="ToolStepThumbs";const q=t.memo(({toolUseId:s,actions:r})=>{const a=x(),n=t.useContext(I),o=n?.sessionId,l=L(e=>o?e.drafts[o]?.steps[s]?.note:void 0),[c,d]=t.useState(!1),b=t.useCallback(e=>{o&&L.getState().setStepNote(o,s,e.target.value)},[o,s]),m=t.useCallback(()=>d(e=>!e),[]);if(!n||0===r.length)return null;const p=c||(l?.length??0)>0;return e.jsxs("div",{className:"mb-1.5 pl-10",children:[r.map((t,r)=>e.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[e.jsx("span",{className:"w-56 shrink-0 truncate font-mono text-xs text-text-400",children:e.jsx(i,{id:"jnvcbs",dangerouslyVisiblePublicValues:{index:r+1,action:E(t)}})}),e.jsx(R,{toolUseId:`${s}:${r}`,toolName:E(t)})]},r)),e.jsx("button",{type:"button",onClick:m,"aria-expanded":p,className:"mt-1 rounded px-1.5 py-1 text-xs text-text-400 hover:bg-bg-200 hover:text-text-200",children:l?e.jsx(i,{id:"4zcmoq"}):e.jsx(i,{id:"1fquwm5"})}),p&&e.jsx("input",{type:"text",value:l??"",onChange:b,placeholder:u({id:"1863ht6",intl:a}),className:"bg-bg-000 border-border-300 mt-1 block w-full max-w-md rounded border px-2 py-1 text-xs text-text-200 placeholder:text-text-500"})]})});q.displayName="ComputerBatchStepThumbs";const R=t.memo(({toolUseId:s,toolName:a})=>{const n=x(),o=t.useContext(I),l=o?.sessionId,c=L(e=>l?e.drafts[l]?.steps[s]:void 0),i=t.useCallback(e=>{l&&L.getState().setStepThumb(l,s,e)},[l,s]),d=t.useCallback(()=>i("up"===c?.thumb?void 0:"up"),[i,c?.thumb]),b=t.useCallback(()=>i("down"===c?.thumb?void 0:"down"),[i,c?.thumb]);return o?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:d,"aria-label":u({id:"858vuq",intl:n,dangerouslyVisiblePublicValues:{toolName:a}}),"aria-pressed":"up"===c?.thumb,className:r("rounded p-0.5 transition-colors hover:bg-bg-200","up"===c?.thumb?"text-accent-brand":"text-text-400"),children:"up"===c?.thumb?e.jsx(M,{vectorSizeOverride:12}):e.jsx(h,{vectorSizeOverride:12})}),e.jsx("button",{type:"button",onClick:b,"aria-label":u({id:"858u4e",intl:n,dangerouslyVisiblePublicValues:{toolName:a}}),"aria-pressed":"down"===c?.thumb,className:r("rounded p-0.5 transition-colors hover:bg-bg-200","down"===c?.thumb?"text-danger-000":"text-text-400"),children:"down"===c?.thumb?e.jsx(P,{vectorSizeOverride:12}):e.jsx(f,{vectorSizeOverride:12})})]}):null});function D(e,s,r,a){const n=t.useRef(!1),o=t.useRef(!1),l=t.useRef(!1),c=t.useRef(null),i=t.useRef(null),[u,x]=t.useState(!1),[b,m]=t.useState(!e),{expandedItemKey:p,setExpandedItemKey:f}=d(),h=s&&f&&!r,g=t.useCallback(e=>{h&&f(e?s:void 0),x(e)},[h,f,x,s]),j=t.useRef(p);t.useEffect(()=>{j.current=p},[p]);const v=_(),S=!(!r&&!v)||(h?p===s:u);return t.useEffect(()=>{c.current&&(clearTimeout(c.current),c.current=null),i.current&&(clearTimeout(i.current),i.current=null);const t=!!a&&!r,u=t&&!l.current;return l.current=t,t?(o.current=!0,n.current=!1,u&&(h&&j.current!==s?x(!1):g(!1),m(!0))):e&&!o.current?(n.current=!0,g(!0),m(!1)):!e&&o.current?o.current=!1:n.current&&!r&&(c.current=setTimeout(()=>{g(!1),i.current=setTimeout(()=>{m(!0),n.current=!1},350)},2e3)),()=>{c.current&&(clearTimeout(c.current),c.current=null),i.current&&(clearTimeout(i.current),i.current=null)}},[e,g,r,a,h,s]),{isExpanded:S,setIsExpanded:g,snappyTransition:b}}R.displayName="ToolStepThumbsInline";export{$ as C,O as T,w as a,A as b,j as c,V as d,L as e,q as f,H as g,_ as h,h as i,f as j,N as p,v as s,D as u};
