meshy-node 0.2.8 → 0.3.2

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.
@@ -0,0 +1,59 @@
1
+ import{c as x,r as h,j as s,i as E,w as $,a as P,X as oe,J as ie,V as ae,K as ce,A as z,B as le}from"./index-CSVyG8lh.js";/**
2
+ * @license lucide-react v1.7.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ue=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],de=x("brain",ue);/**
7
+ * @license lucide-react v1.7.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const me=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],fe=x("circle-question-mark",me);/**
12
+ * @license lucide-react v1.7.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const pe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ge=x("circle",pe);/**
17
+ * @license lucide-react v1.7.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const xe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ee=x("copy",xe);/**
22
+ * @license lucide-react v1.7.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const he=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],ye=x("list-checks",he);/**
27
+ * @license lucide-react v1.7.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const be=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],je=x("loader-circle",be);/**
32
+ * @license lucide-react v1.7.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const Ne=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],we=x("shield-alert",Ne);/**
37
+ * @license lucide-react v1.7.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const ke=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Se=x("shield-check",ke);/**
42
+ * @license lucide-react v1.7.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const ve=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],_e=x("user",ve);/**
47
+ * @license lucide-react v1.7.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const Ce=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],te=x("wrench",Ce);function I(e){return typeof e=="object"&&e!==null}function Te(e){if(!I(e))return null;if(e.type==="text"&&typeof e.text=="string"){const t=e.text.trim();return t?{type:"text",text:t}:null}if(e.type==="image"&&typeof e.mediaType=="string"&&typeof e.data=="string"){const t=e.mediaType.trim(),r=e.data;return!t||!r?null:{type:"image",mediaType:t,data:r,...typeof e.filename=="string"&&e.filename.trim()?{filename:e.filename.trim()}:{}}}if(e.type==="tool_result"&&typeof e.toolUseId=="string"&&typeof e.content=="string"){const t=e.toolUseId.trim(),r=e.content.trim();return!t||!r?null:{type:"tool_result",toolUseId:t,content:r,...typeof e.isError=="boolean"?{isError:e.isError}:{}}}return null}function Ae(e){if(!I(e))return null;if(e.type==="text"&&typeof e.text=="string"){const n=e.text.trim();return n?{type:"text",text:n}:null}if(e.type!=="image"||!I(e.source)){if(e.type==="tool_result"&&typeof e.tool_use_id=="string"&&typeof e.content=="string"){const n=e.tool_use_id.trim(),o=e.content.trim();return!n||!o?null:{type:"tool_result",toolUseId:n,content:o,...typeof e.is_error=="boolean"?{isError:e.is_error}:{}}}return null}const t=typeof e.source.media_type=="string"?e.source.media_type.trim():"",r=typeof e.source.data=="string"?e.source.data:"";return!t||!r?null:{type:"image",mediaType:t,data:r}}function U(e){if(typeof e=="string"){const t=e.trim();return t?[{type:"text",text:t}]:[]}return Array.isArray(e)?e.map(t=>Te(t)??Ae(t)).filter(t=>t!==null):[]}function ht(e,t){const r=e.trim();return[...r?[{type:"text",text:r}]:[],...t]}function $e(e){return{role:"user",content:e.map(t=>t.type==="text"?{type:"text",text:t.text}:t.type==="tool_result"?{type:"tool_result",tool_use_id:t.toolUseId,content:t.content,...typeof t.isError=="boolean"?{is_error:t.isError}:{}}:{type:"image",source:{type:"base64",media_type:t.mediaType,data:t.data}})}}function yt(e,t=new Date().toISOString()){return{type:"user",message:$e(e),timestamp:t}}function S(e){if(e.type!=="user"||e.isSynthetic===!0)return null;if(typeof e.message=="string"){const t=U(e.message);return t.length>0?t:null}if(I(e.message)&&Array.isArray(e.message.content)){const t=U(e.message.content);return t.length>0?t:null}if(Array.isArray(e.content)){const t=U(e.content);return t.length>0?t:null}return null}function bt(e){return U(e.payload.initialMessage)}function b(e){return e.map(t=>{if(t.type==="text")return`t:${t.text}`;if(t.type==="tool_result")return`r:${t.toolUseId}:${t.isError===!0?"1":"0"}:${t.content}`;const r=t.data.slice(0,32),n=t.data.slice(-32);return`i:${t.mediaType}:${t.data.length}:${r}:${n}`}).join("|")}function Me(e){return e.map(t=>t.type==="text"?t.text:t.type==="tool_result"?t.content:"").filter(Boolean).join(`
52
+ `)}function Ue(e){return`data:${e.mediaType};base64,${e.data}`}function jt(e){var o,i;if(!e)return[];const t=[],r=e.items;if(r)for(const c of Array.from(r)){if((c==null?void 0:c.kind)!=="file"||!((o=c.type)!=null&&o.startsWith("image/")))continue;const a=(i=c.getAsFile)==null?void 0:i.call(c);a&&a.type.startsWith("image/")&&t.push(a)}if(t.length>0)return t;const n=e.files;return n?Array.from(n).filter(c=>c.type.startsWith("image/")):[]}function Ee(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{if(typeof n.result!="string"){r(new Error(`Failed to read ${e.name}`));return}t(n.result)},n.onerror=()=>r(n.error??new Error(`Failed to read ${e.name}`)),n.readAsDataURL(e)})}async function Nt(e){return Promise.all(Array.from(e).map(async t=>{if(!t.type.startsWith("image/"))throw new Error(`${t.name} is not an image`);const r=await Ee(t),n=r.indexOf(",");if(n===-1)throw new Error(`Failed to parse ${t.name}`);return{type:"image",mediaType:t.type||"image/png",data:r.slice(n+1),filename:t.name}}))}function M(e){return typeof e=="object"&&e!==null}function Pe(e){return M(e)&&typeof e.name=="string"&&e.name.toLowerCase()==="askuserquestion"}function Ie(e){return!M(e)||typeof e.label!="string"||!e.label.trim()?null:{label:e.label.trim(),description:typeof e.description=="string"?e.description.trim():""}}function Oe(e){if(!M(e)||typeof e.question!="string"||!e.question.trim())return null;const t=Array.isArray(e.options)?e.options.map(Ie).filter(r=>r!==null):[];return t.length===0?null:{header:typeof e.header=="string"&&e.header.trim()?e.header.trim():void 0,question:e.question.trim(),multiSelect:e.multiSelect===!0,options:t}}function q(e){if(!M(e)||!Array.isArray(e.questions))return null;const t=e.questions.map(Oe).filter(r=>r!==null);return t.length===0?null:{questions:t}}function v(e){return JSON.stringify({questions:e.questions})}function O(e){const t=q(e);if(t)return t;if(Pe(e)){const r=M(e.input)?e.input:void 0,n=q(r);return n?{...n,...typeof e.id=="string"&&e.id.trim()?{toolUseId:e.id.trim()}:{}}:null}return null}function Be(e){var o;const t=e.trim();if(!t)return[];const r=[t],n=t.matchAll(/```(?:json)?\s*([\s\S]*?)```/gi);for(const i of n){const c=(o=i[1])==null?void 0:o.trim();c&&r.push(c)}return r}function B(e){for(const t of Be(e))try{const r=JSON.parse(t),n=q(r);if(n)return n}catch{}return null}function Fe(e){return e.questions.map(t=>t.options.length>0?[0]:[])}function ze(e,t){return e.questions.every((r,n)=>(t[n]??[]).length>0)}function Le(e,t){const n=e.questions.map((o,i)=>{const c=[...new Set(t[i]??[])].sort((a,d)=>a-d).filter(a=>o.options[a]!==void 0);return{header:o.header??null,question:o.question,multiSelect:o.multiSelect,selectedOptions:c.map(a=>o.options[a]).filter(a=>a!==void 0)}}).map(o=>{const i=o.header??o.question,c=o.selectedOptions.map(a=>a.label).join(o.multiSelect?", ":"");return`${i}: ${c}`}).join(`
53
+ `);return e.toolUseId?[{type:"tool_result",toolUseId:e.toolUseId,content:n,isError:!1}]:[{type:"text",text:n}]}function T(e){return typeof e=="object"&&e!==null}function qe(e){if(!e)return;const t=["file_path","path","command"].map(r=>e[r]).find(r=>typeof r=="string"&&r.trim().length>0);return t==null?void 0:t.trim()}function Je(e){const t=e.toLowerCase();return t.includes(" permission to write ")?"Write":t.includes(" permission to edit ")?"Edit":t.includes(" permission to run ")||t.includes(" permission to execute ")?"Bash":"Action"}function J(e){const t=e.trim();if(!t.startsWith("Awaiting your permission to "))return null;const r=t.match(/`([^`]+)`/);return{requests:[{toolName:Je(t),target:r==null?void 0:r[1],summary:t}]}}function Re(e){if(!Array.isArray(e.permission_denials))return null;const t=[];for(const r of e.permission_denials){if(!T(r)||typeof r.tool_name!="string")continue;const n=T(r.tool_input)?r.tool_input:void 0,o=qe(n),i=typeof e.result=="string"&&e.result.trim().length>0?e.result.trim():`Awaiting your permission to use ${r.tool_name}${o?` on \`${o}\``:""}.`;t.push({toolName:r.tool_name,...typeof r.tool_use_id=="string"?{toolUseId:r.tool_use_id}:{},...o?{target:o}:{},summary:i})}return t.length>0?{requests:t}:null}function H(e){if(!Array.isArray(e))return null;for(const t of e){if(!T(t)||t.type!=="text"||typeof t.text!="string")continue;const r=J(t.text);if(r)return r}return null}function V(e){if(!T(e))return null;const t=Re(e);if(t)return t;if(typeof e.result=="string"){const n=J(e.result);if(n)return n}if(typeof e.message=="string"){const n=J(e.message);if(n)return n}if(T(e.message)){const n=V(e.message);if(n)return n;const o=H(e.message.content);if(o)return o}const r=H(e.content);return r||null}function De(e){return JSON.stringify(e.requests.map(t=>({toolName:t.toolName,target:t.target??null,summary:t.summary})))}function We(e,t){return e.requests.map(r=>{const n=r.target?` for \`${r.target}\``:"",o=t==="approve"?`Approved. Proceed with the requested ${r.toolName} action${n}.`:`Denied. Do not proceed with the requested ${r.toolName} action${n}. Ask for another approach if needed.`;return r.toolUseId?{type:"tool_result",toolUseId:r.toolUseId,content:o,isError:t==="deny"}:t==="approve"?{type:"text",text:o}:{type:"text",text:o}})}function Ve(e){return S(e)!==null}function R(e){return typeof e=="object"&&e!==null}function X(e){if(e.type==="user"){const t=S(e),r=typeof e.timestamp=="string"?e.timestamp:"";if(t)return`user:${r}:${b(t)}`}return JSON.stringify(e)}function _(e){return Array.isArray(e)?e.map(t=>_(t)):R(e)?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>[t,_(r)])):e}function Y(e){const t=S(e);if(t)return`user:${b(t)}`;if(e.type==="assistant"){if(typeof e.message=="string")return`assistant:${JSON.stringify(e.message)}`;if(R(e.message)&&"content"in e.message)return`assistant:${JSON.stringify(_(e.message.content))}`;if(Array.isArray(e.content))return`assistant:${JSON.stringify(_(e.content))}`;if(R(e.message))return`assistant:${JSON.stringify(_(e.message))}`}return JSON.stringify(e)}function Z(e){if(typeof e.timestamp!="string")return null;const t=Date.parse(e.timestamp);return Number.isNaN(t)?null:t}function D(e){const t=O(e);return t?`question:${v(t)}`:null}function Ke(e){const t=V(e);return t?`permission:${De(t)}`:null}function Q(e){if(!Array.isArray(e))return null;const t=new Set;for(const r of e){const n=D(r);if(n){t.add(n);continue}if(typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"){const o=B(r.text);o&&t.add(v(o))}}return t.size===0?null:Array.from(t).sort().join("|")}function Ge(e){const t=D(e);if(t)return t;if(typeof e.message=="string"){const r=B(e.message);return r?v(r):null}if(typeof e.message=="object"&&e.message!==null){const r=D(e.message);return r||Q(e.message.content)}return Q(e.content)}function He(e){return Ke(e)}function wt(e,t,r){const n=typeof t.timestamp=="string"?t.timestamp:"";return`${e}-${n}-${r}`}function kt(e,t){const r=new Map;for(const o of t){const i=Y(o);r.set(i,(r.get(i)??0)+1)}const n=[];for(let o=e.length-1;o>=0;o-=1){const i=e[o];if(!i)continue;const c=Y(i),a=r.get(c)??0;if(a>0){r.set(c,a-1);continue}n.push({...i})}return[...n.reverse(),...t.map(o=>({...o}))].map((o,i)=>({event:o,order:i})).sort((o,i)=>{const c=Z(o.event),a=Z(i.event);return c!==null&&a!==null&&c!==a?c-a:o.order-i.order}).map(o=>o.event)}function St(e,t){const r=X(t);return e.some(n=>X(n)===r)?e:[...e,{...t}]}function vt(e,t){const r=new Map;for(const n of t){const o=S(n);if(!o)continue;const i=b(o);r.set(i,(r.get(i)??0)+1)}return e.filter(n=>{const o=b(n.content),i=r.get(o)??0;return i<=0?!0:(r.set(o,i-1),!1)})}function _t(e,t){const r=b(t),n=e.findIndex(o=>b(o.content)===r);return n===-1?e:e.filter((o,i)=>i!==n)}function Ct(e,t){const r=b(t);return e.some(n=>{const o=S(n);return o!==null&&b(o)===r})}function Tt(e){const t=[];let r=null;for(const n of e){if(Ve(n)){r=null,t.push(n);continue}const o=He(n)??Ge(n);o&&o===r||(t.push(n),o&&(r=o))}return t}function A({payload:e,disabled:t=!1,bypassEnabled:r=!1,onBypassChange:n,onSubmit:o}){const[i,c]=h.useState(()=>r?Fe(e):e.questions.map(()=>[])),[a,d]=h.useState(!1),[l,m]=h.useState(!1);h.useEffect(()=>{r&&c(u=>u.map((f,y)=>{var p;return f.length>0?f:(p=e.questions[y])!=null&&p.options.length?[0]:[]}))},[r,e]);const g=ze(e,i)&&!t&&!a&&!l&&!!o,j=(u,f)=>{t||l||a||c(y=>y.map((p,N)=>{if(N!==u)return p;const w=e.questions[N];return w?w.multiSelect?p.includes(f)?p.filter(F=>F!==f):[...p,f].sort((F,se)=>F-se):[f]:p}))},G=async()=>{if(!g||!o)return;d(!0);const u=await o(Le(e,i));d(!1),u&&m(!0)};return s.jsxs("div",{className:"rounded-[24px] border border-primary/20 bg-primary/5 p-4 shadow-[0_24px_80px_-60px_hsl(var(--primary)/0.9)]",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-primary/20 bg-primary/10 text-primary",children:s.jsx(fe,{className:"h-4 w-4"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-primary/80",children:"Ask User Question"}),s.jsx("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:"Select the answer you want to send back to the agent."})]})]}),s.jsxs(E,{type:"button",variant:r?"secondary":"outline",size:"sm",onClick:()=>n==null?void 0:n(!r),className:"rounded-full",children:[s.jsx(Se,{className:"h-4 w-4"}),r?"Bypass on":"Bypass future questions"]})]}),s.jsx("div",{className:"mt-4 space-y-4",children:e.questions.map((u,f)=>{const y=i[f]??[];return s.jsxs("div",{className:"space-y-3 rounded-[20px] border border-border/60 bg-background/75 p-4",children:[s.jsxs("div",{children:[u.header&&s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:u.header}),s.jsx("div",{className:"mt-1 text-sm font-medium leading-6 text-foreground",children:u.question}),s.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:u.multiSelect?"Select one or more options.":"Select one option."})]}),s.jsx("div",{className:"space-y-2",children:u.options.map((p,N)=>{const w=y.includes(N);return s.jsxs("button",{type:"button",onClick:()=>j(f,N),disabled:t||a||l,"aria-pressed":w,className:P("flex w-full items-start gap-3 rounded-[18px] border px-4 py-3 text-left transition-colors",w?"border-primary/50 bg-primary/10 text-foreground":"border-border/60 bg-background/80 text-foreground hover:border-primary/30 hover:bg-primary/5"),children:[s.jsx("span",{className:P("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border",w?"border-primary bg-primary text-primary-foreground":"border-border/70 bg-background text-transparent"),children:s.jsx($,{className:"h-3.5 w-3.5"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block text-sm font-medium leading-5",children:p.label}),p.description&&s.jsx("span",{className:"mt-1 block text-xs leading-5 text-muted-foreground",children:p.description})]})]},`${p.label}-${N}`)})})]},`${u.header??"question"}-${f}`)})}),s.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:[s.jsx("div",{className:"text-xs text-muted-foreground",children:r?"Bypass is enabled. New question cards will default to the first option.":"Enable bypass if you want future question cards to preselect the first option."}),s.jsx(E,{type:"button",onClick:()=>void G(),disabled:!g,className:"rounded-full px-5",children:l?"Sent":a?"Sending...":e.questions.length>1?"Send answers":"Send answer"})]})]})}function Xe({payload:e,disabled:t=!1,onSubmit:r}){const[n,o]=h.useState(null),[i,c]=h.useState(!1),a=!t&&!i&&!!r,d=async l=>{if(!a||!r)return;o(l);const m=await r(We(e,l));o(null),m&&c(!0)};return s.jsxs("div",{className:"rounded-[24px] border border-amber-500/25 bg-amber-500/5 p-4 shadow-[0_24px_80px_-60px_rgba(245,158,11,0.8)]",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-400",children:s.jsx(we,{className:"h-4 w-4"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-amber-700/80 dark:text-amber-300/80",children:"Permission Request"}),s.jsx("div",{className:"mt-1 space-y-3",children:e.requests.map((l,m)=>s.jsxs("div",{className:"rounded-[18px] border border-border/60 bg-background/75 px-4 py-3",children:[s.jsx("div",{className:"text-sm font-medium leading-6 text-foreground",children:l.summary}),(l.toolName||l.target)&&s.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:[s.jsx("span",{children:l.toolName}),l.target&&s.jsx("span",{className:"font-mono normal-case tracking-normal",children:l.target})]})]},`${l.toolUseId??l.toolName}-${m}`))})]})]}),s.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-end gap-2",children:[s.jsxs(E,{type:"button",variant:"outline",onClick:()=>void d("deny"),disabled:!a||n!==null,className:"rounded-full",children:[s.jsx(oe,{className:"h-4 w-4"}),i?"Sent":n==="deny"?"Sending...":"Deny"]}),s.jsxs(E,{type:"button",onClick:()=>void d("approve"),disabled:!a||n!==null,className:"rounded-full",children:[s.jsx($,{className:"h-4 w-4"}),i?"Sent":n==="approve"?"Sending...":"Approve"]})]})]})}function At({event:e,questionBypassEnabled:t=!1,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o=!1}){const i=e.type,c=V(e),a=O(e);if(c)return s.jsx(C,{children:s.jsx(Xe,{payload:c,onSubmit:n,disabled:o})});if(a)return s.jsx(C,{children:s.jsx(A,{payload:a,bypassEnabled:t,onBypassChange:r,onSubmit:n,disabled:o})});if(i==="user"){const d=Ye(e),l=d.filter(g=>g.type==="tool_result");if(l.length>0&&d.every(g=>g.type==="tool_result"))return s.jsx(C,{children:l.map((g,j)=>s.jsx(ne,{block:g,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o},j))});const m=S(e);return m?s.jsx(tt,{content:m}):null}return i==="assistant"?s.jsx(rt,{event:e,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o}):null}function Ye(e){const t=e.message,r=t==null?void 0:t.content;if(Array.isArray(r))return r.filter(o=>typeof o=="object"&&o!==null);const n=e.content;return Array.isArray(n)?n.filter(o=>typeof o=="object"&&o!==null):[]}function L(e){var r;const t=e.replace(/\r\n/g,`
54
+ `).split(`
55
+ `);for(;t.length>0&&((r=t[0])==null?void 0:r.trim())==="";)t.shift();return t.join(`
56
+ `)}function re({text:e,className:t=""}){const[r,n]=h.useState(!1);if(!e)return null;const o=async i=>{i.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}};return s.jsx("button",{type:"button",onClick:o,"aria-label":r?"Copied":"Copy message",className:`flex h-6 w-6 items-center justify-center rounded-full border border-border/60 bg-background/80 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 ${t}`,children:r?s.jsx($,{className:"h-3 w-3 text-emerald-500"}):s.jsx(ee,{className:"h-3 w-3"})})}async function Ze(e){let r=await(await fetch(e)).blob();r.type!=="image/png"&&(r=await Qe(r)),await navigator.clipboard.write([new ClipboardItem({[r.type]:r})])}async function Qe(e){const t=await createImageBitmap(e),r=document.createElement("canvas");r.width=t.width,r.height=t.height;const n=r.getContext("2d");if(!n)throw new Error("canvas 2d context unavailable");return n.drawImage(t,0,0),await new Promise((o,i)=>{r.toBlob(c=>c?o(c):i(new Error("toBlob failed")),"image/png")})}function et({dataUrl:e,className:t=""}){const[r,n]=h.useState(!1),o=async i=>{i.stopPropagation();try{await Ze(e),n(!0),setTimeout(()=>n(!1),1500)}catch(c){console.error("copy image failed",c)}};return s.jsx("button",{type:"button",onClick:o,"aria-label":r?"Copied":"Copy image",className:`flex h-6 w-6 items-center justify-center rounded-full border border-border/60 bg-background/80 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 ${t}`,children:r?s.jsx($,{className:"h-3 w-3 text-emerald-500"}):s.jsx(ee,{className:"h-3 w-3"})})}function tt({content:e}){const t=Me(e),r=e.filter(n=>n.type==="image");return s.jsx("div",{className:"animate-message-rise flex justify-end",children:s.jsxs("div",{className:"group relative flex max-w-[88%] items-start gap-3",children:[s.jsx(re,{text:t,className:"absolute -left-8 top-2"}),s.jsxs("div",{className:"space-y-1 rounded-[26px] rounded-tr-md border border-primary/25 bg-primary px-4 py-3 text-[13px] leading-5 text-primary-foreground shadow-[0_20px_70px_-42px_hsl(var(--primary)/0.95)]",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.28em] text-primary-foreground/75",children:"You"}),t&&s.jsx("div",{className:"whitespace-pre-wrap",children:t}),r.length>0&&s.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:r.map((n,o)=>{const i=Ue(n);return s.jsxs("div",{className:"relative",children:[s.jsx("img",{src:i,alt:n.filename??`attachment ${o+1}`,className:"max-h-72 w-full rounded-2xl border border-primary-foreground/15 object-cover"}),s.jsx(et,{dataUrl:i,className:"absolute right-2 top-2"})]},`${n.filename??"image"}-${o}`)})})]}),s.jsx("div",{className:"mt-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-primary/20 bg-primary/10 text-primary",children:s.jsx(_e,{className:"h-4 w-4"})})]})})}function C({children:e}){return s.jsx("div",{className:"animate-message-rise flex justify-start",children:s.jsxs("div",{className:"flex max-w-[92%] items-start gap-3",children:[s.jsx("div",{className:"mt-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-border/70 bg-muted/70 text-muted-foreground",children:s.jsx(ie,{className:"h-4 w-4"})}),s.jsxs("div",{className:"min-w-0 space-y-3",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.28em] text-muted-foreground",children:"Agent"}),e]})]})})}function rt({event:e,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o}){const i=e.message;if(!i)return null;const c=O(i);if(c)return s.jsx(C,{children:s.jsx(A,{payload:c,bypassEnabled:t,onBypassChange:r,onSubmit:n,disabled:o})});const a=i.content;if(!a||!Array.isArray(a))return null;const d=new Set,l=a.filter(u=>u.type==="text").map(u=>({...u,text:L(String(u.text??"")),questionPayload:B(L(String(u.text??"")))})).filter(u=>u.text.length>0||u.questionPayload),m=a.filter(u=>u.type==="thinking").map(u=>L(String(u.thinking??""))).filter(Boolean).join(`
57
+
58
+ `),g=a.filter(u=>u.type==="tool_use"),j=a.filter(u=>u.type==="tool_result");return l.length>0||m.length>0||g.length>0||j.length>0?s.jsxs(C,{children:[m.length>0&&s.jsx(it,{text:m}),l.map((u,f)=>{if(u.questionPayload){const y=v(u.questionPayload);return d.has(y)?null:(d.add(y),s.jsx(A,{payload:u.questionPayload,bypassEnabled:t,onBypassChange:r,onSubmit:n,disabled:o},f))}return s.jsxs("div",{className:"group relative rounded-[26px] rounded-tl-md border border-border/70 bg-card/80 px-4 py-3 text-[13px] leading-5 text-foreground shadow-[0_20px_70px_-58px_rgba(0,0,0,0.9)] backdrop-blur-sm",children:[s.jsx(re,{text:u.text,className:"absolute right-2 top-2"}),s.jsx("div",{className:"whitespace-pre-wrap",children:u.text})]},f)}),g.map((u,f)=>s.jsx(at,{block:u,renderedQuestionSignatures:d,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o},f)),j.map((u,f)=>s.jsx(ne,{block:u,renderedQuestionSignatures:d,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:n,questionResponseDisabled:o},f))]}):null}function nt(e){return e.replace(/\s+/g," ").trim()}function k(e,t=132){const r=nt(e);return r?r.length>t?`${r.slice(0,t-3)}...`:r:""}function W(e,t=84){if(typeof e=="string")return k(e,t);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const r=e.slice(0,3).map(n=>W(n,28)).filter(Boolean).join(", ");return k(r||JSON.stringify(e),t)}if(typeof e=="object"&&e!==null){const r=Object.entries(e).slice(0,3).map(([n,o])=>`${n}: ${W(o,32)}`).join(" · ");return k(r||JSON.stringify(e),t)}return""}function st(e){if(!e)return"No input";const t=Object.entries(e).slice(0,4).map(([r,n])=>`${r}: ${W(n,40)}`).filter(r=>r.trim().length>0).join(" · ");return k(t||JSON.stringify(e),156)||"No input"}function ot({expanded:e}){return s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-border/60 bg-background/70 px-2 py-1 text-[10px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[e?"Less":"More",e?s.jsx(ae,{className:"h-3 w-3"}):s.jsx(ce,{className:"h-3 w-3"})]})}function K({title:e,preview:t,icon:r,children:n,accentClassName:o,previewClassName:i="font-mono text-[11px] text-muted-foreground/90"}){const[c,a]=h.useState(!1);return s.jsxs("div",{className:`overflow-hidden rounded-[22px] border border-border/60 ${o}`,children:[s.jsxs("button",{type:"button",onClick:()=>a(d=>!d),className:"flex w-full items-start gap-3 px-4 py-3 text-left transition-colors hover:bg-background/30",children:[s.jsx("div",{className:"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border/60 bg-background/70 text-muted-foreground",children:r}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-muted-foreground",children:e})}),s.jsx("div",{className:`mt-1 whitespace-pre-wrap break-words text-[12px] leading-5 ${i}`,children:t})]}),s.jsx(ot,{expanded:c})]}),c&&s.jsx("div",{className:"border-t border-border/60 px-4 py-3",children:n})]})}function it({text:e}){const t=k(e,156);return s.jsx(K,{title:"Thinking",preview:t,icon:s.jsx(de,{className:"h-3.5 w-3.5"}),accentClassName:"bg-muted/35",previewClassName:"text-[12px] leading-5 text-muted-foreground/90",children:s.jsx("div",{className:"whitespace-pre-wrap text-[13px] leading-5 text-muted-foreground/90",children:e})})}function at({block:e,renderedQuestionSignatures:t,questionBypassEnabled:r,onQuestionBypassChange:n,onSubmitQuestionResponse:o,questionResponseDisabled:i}){const c=String(e.name??"tool"),a=e.input,d=O(e);if(d){const m=v(d);return t!=null&&t.has(m)?null:(t==null||t.add(m),s.jsx(A,{payload:d,bypassEnabled:r,onBypassChange:n,onSubmit:o,disabled:i}))}const l=st(a);if(c==="TodoWrite"){const m=ct(a==null?void 0:a.todos);if(m.length>0)return s.jsx(lt,{todos:m})}return s.jsx(K,{title:`Tool: ${c}`,preview:l,icon:s.jsx(te,{className:"h-3.5 w-3.5"}),accentClassName:"bg-muted/25",children:s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:JSON.stringify(a??{},null,2)})})}function ne({block:e,renderedQuestionSignatures:t,questionBypassEnabled:r,onQuestionBypassChange:n,onSubmitQuestionResponse:o,questionResponseDisabled:i}){const c=e.content,a=typeof c=="string"?c:Array.isArray(c)?c.map(m=>String(m.text??"")).join(`
59
+ `):"";if(!a)return null;const d=B(a);if(d){const m=v(d);return t!=null&&t.has(m)?null:(t==null||t.add(m),s.jsx(A,{payload:d,bypassEnabled:r,onBypassChange:n,onSubmit:o,disabled:i}))}const l=k(a,156);return s.jsx(K,{title:"Result",preview:l,icon:s.jsx(te,{className:"h-3.5 w-3.5"}),accentClassName:"bg-background/65",children:s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:a})})}function ct(e){return Array.isArray(e)?e.map(t=>{if(typeof t!="object"||t===null)return null;const r=t,n=typeof r.content=="string"?r.content:"";if(!n)return null;const o=typeof r.activeForm=="string"?r.activeForm:n,i=typeof r.status=="string"?r.status:"pending";return{content:n,activeForm:o,status:i==="completed"||i==="in_progress"?i:"pending"}}).filter(t=>t!==null):[]}function lt({todos:e}){const t=e.filter(o=>o.status==="completed").length,r=e.length,n=e.find(o=>o.status==="in_progress");return s.jsxs("div",{className:"overflow-hidden rounded-[22px] border border-border/60 bg-muted/20",children:[s.jsxs("div",{className:"flex items-center gap-3 border-b border-border/50 px-4 py-3",children:[s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border/60 bg-background/70 text-muted-foreground",children:s.jsx(ye,{className:"h-3.5 w-3.5"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-muted-foreground",children:"Todos"}),s.jsx("div",{className:"mt-0.5 truncate text-[12px] leading-5 text-muted-foreground/90",children:n?n.activeForm:r===0?"No items":t===r?"All complete":"Up next"})]}),s.jsxs("div",{className:"shrink-0 rounded-full border border-border/60 bg-background/70 px-2 py-0.5 font-mono text-[10px] tracking-wide text-muted-foreground",children:[t,"/",r]})]}),s.jsx("ul",{className:"divide-y divide-border/40",children:e.map((o,i)=>s.jsxs("li",{className:"flex items-start gap-3 px-4 py-2.5",children:[s.jsx(ut,{status:o.status}),s.jsx("span",{className:o.status==="completed"?"text-[13px] leading-5 text-muted-foreground line-through decoration-muted-foreground/60":o.status==="in_progress"?"text-[13px] font-medium leading-5 text-foreground":"text-[13px] leading-5 text-foreground/85",children:o.status==="in_progress"?o.activeForm:o.content})]},`${i}-${o.content}`))})]})}function ut({status:e}){return e==="completed"?s.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-emerald-500/15 text-emerald-500 dark:text-emerald-400",children:s.jsx($,{className:"h-3 w-3"})}):e==="in_progress"?s.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center text-primary",children:s.jsx(je,{className:"h-3.5 w-3.5 animate-spin"})}):s.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground/60",children:s.jsx(ge,{className:"h-3 w-3"})})}const $t="bypass",dt=[{value:"claudecode",label:"claudecode",supportsFollowUp:!0},{value:"codex",label:"codex",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],Mt=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],Ut=new Set(dt.filter(e=>e.supportsFollowUp).map(e=>e.value)),Et=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],mt=new Set(["pending","assigned"]),ft=new Set(["running"]),pt=new Set(["completed","failed","cancelled"]);function Pt(e,t){switch(t){case"running":return ft.has(e.status);case"waiting":return mt.has(e.status);case"closed":return pt.has(e.status);case"shared":return!!e.activeShare;case"archived":return e.status==="archived";case"active":default:return e.status!=="archived"}}function It(e,t){const r=t.trim().toLowerCase();return r?[e.title,e.description,e.id,e.agent,e.assignedTo??"",e.assignedNodeName??"",e.project??"",e.effectiveProjectPath??"",e.conversationKind==="nativeSession"?"native session":"meshy chat",e.activeShare?"shared conversation":""].some(n=>n.toLowerCase().includes(r)):!0}function gt(e,t,r){if(!e)return"unassigned";const n=t==null?void 0:t.find(o=>o.id===e);return(n==null?void 0:n.name)??r??e.slice(0,8)}function Ot(e,t,r){return gt(e,t,r).toLowerCase()}function Bt(e,t){return[...e].sort((r,n)=>r.id===t?-1:n.id===t?1:r.name.localeCompare(n.name))}function Ft(e){if(!e||typeof e!="object")return null;const t=e,r=t.createMode,n=r==="chat"||r==="native"?r:void 0;return{draftNewTask:t.draftNewTask===!0,returnRoute:typeof t.returnRoute=="string"?t.returnRoute:void 0,returnTaskId:typeof t.returnTaskId=="string"||t.returnTaskId===null?t.returnTaskId:void 0,createMode:n}}function zt(e){switch(e){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function Lt(e){return e==="default workspace"?e:e.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??e}function qt(e){const t=Date.now()-e;return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m`:t<864e5?`${Math.floor(t/36e5)}h`:`${Math.floor(t/864e5)}d`}function Jt(e){return new Date(e).toLocaleString()}function Rt(e){const t=Math.floor(e/1e3),r=Math.floor(t/3600),n=Math.floor(t%3600/60),o=t%60;return`${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}:${String(o).padStart(2,"0")}`}async function Dt(e,t="Copied to clipboard"){var r,n,o;try{if((n=(r=globalThis.navigator)==null?void 0:r.clipboard)!=null&&n.writeText)return await globalThis.navigator.clipboard.writeText(e),z.success(t),!0;const i=globalThis.document,c=(o=i==null?void 0:i.execCommand)==null?void 0:o.bind(i);if(!(i!=null&&i.body)||typeof i.createElement!="function"||typeof c!="function")throw new Error("Clipboard access is unavailable");const a=i.createElement("textarea"),d=i.activeElement,l=d&&typeof d.focus=="function"?d:null;a.value=e,a.setAttribute("readonly","true"),a.style.position="fixed",a.style.opacity="0",a.style.pointerEvents="none",i.body.appendChild(a),a.select(),a.setSelectionRange(0,a.value.length);const m=c("copy");if(i.body.removeChild(a),l==null||l.focus(),!m)throw new Error("Clipboard access is unavailable");return z.success(t),!0}catch(i){return z.error(i instanceof Error?i.message:"Failed to copy"),!1}}function Wt(e,t){const r=new Map;for(const o of e){const i=o.assignedTo??null,c=i??"__unassigned__",a=i?t.get(i)??o.assignedNodeName??i.slice(0,8):"Unassigned",d=o.effectiveProjectPath??o.project??"default workspace";r.has(c)||r.set(c,{nodeId:i,nodeName:a,dirMap:new Map});const l=r.get(c);l.dirMap.has(d)||l.dirMap.set(d,[]),l.dirMap.get(d).push(o)}const n=Array.from(r.values()).map(({nodeId:o,nodeName:i,dirMap:c})=>{const a=Array.from(c.entries()).map(([d,l])=>({path:d,tasks:l})).sort((d,l)=>l.tasks.length-d.tasks.length||d.path.localeCompare(l.path));return{nodeId:o,nodeName:i,dirs:a}});return n.sort((o,i)=>o.nodeId===null?1:i.nodeId===null?-1:o.nodeName.localeCompare(i.nodeName)),n}function Vt({label:e,value:t}){return s.jsxs("div",{className:"min-w-[7.25rem] flex-1 rounded-[20px] border border-border/60 bg-background/45 px-3 py-3",children:[s.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:e}),s.jsx("div",{className:"mt-1 text-lg font-semibold tracking-tight text-foreground",children:t})]})}function Kt({label:e}){return s.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-muted-foreground",children:e})}function Gt({label:e,value:t,mono:r,action:n}){return s.jsxs("div",{className:"grid grid-cols-[5.25rem,minmax(0,1fr)] items-start gap-3",children:[s.jsx("span",{className:"pt-0.5 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:e}),s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx("span",{className:P("min-w-0 flex-1 break-all text-sm text-foreground",r&&"font-mono text-[11px] leading-5"),children:t}),n]})]})}function Ht({label:e,value:t,mono:r}){return s.jsxs("div",{className:"rounded-[18px] border border-border/60 bg-background/60 px-3 py-3",children:[s.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:e}),s.jsx("div",{className:P("mt-1 text-sm font-medium text-foreground",r&&"font-mono text-[11px]"),children:t})]})}function Xt({capabilities:e,action:t}){return s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[s.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Capabilities"}),s.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.length>0?e.map(r=>s.jsx(le,{variant:"secondary",className:"rounded-full",children:r},r)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"None declared"})})]}),t&&s.jsx("div",{className:"shrink-0 self-start",children:t})]})}export{St as A,S as B,ee as C,$t as D,_t as E,Ut as F,Tt as G,yt as H,Gt as I,bt as J,U as K,je as L,Ht as M,Ct as N,ft as R,Mt as T,mt as W,dt as a,ht as b,Dt as c,gt as d,jt as e,Jt as f,At as g,wt as h,Kt as i,Vt as j,Rt as k,Xt as l,Wt as m,Et as n,Lt as o,zt as p,qt as q,Nt as r,Bt as s,Ue as t,kt as u,vt as v,Ft as w,Pt as x,Ot as y,It as z};
@@ -1,4 +1,4 @@
1
- import{r as c,aD as L,ay as M,j as e,B as g,a as w,K as P}from"./index-COwXI8L0.js";import{G as O}from"./DashboardPage-ChA_y3oq.js";import{F as R}from"./file-BUN3RpOS.js";import{C as _,F as B}from"./folder-C28inzgP.js";import"./DashboardShared-B4AJ8Ukj.js";function C(r,t){if(!(r!=null&&r.trim()))return[];const s=r.split(`
1
+ import{r as c,aF as L,aA as M,j as e,B as g,a as w,K as P}from"./index-CSVyG8lh.js";import{G as O}from"./DashboardPage-BMIVTxil.js";import{F as R}from"./file-DCzQQ4U3.js";import{C as _,F as B}from"./folder-D2R8g5cx.js";import"./DashboardShared-BSmoDCJG.js";function D(r,t){if(!(r!=null&&r.trim()))return[];const s=r.split(`
2
2
  `),n=[];let a=[];const d=()=>{if(a.length===0)return;const l=a.join(`
3
- `).trim();if(!l){a=[];return}const i=J(a);if(!i){a=[];return}n.push({id:`${t}:${i}`,path:i,section:t,patch:l}),a=[]};for(const l of s)l.startsWith("diff --git ")&&a.length>0&&d(),a.push(l);return d(),n}function I(r){const t=[];for(const s of[...r].sort((n,a)=>n.path.localeCompare(a.path))){const n=s.path.split("/").filter(Boolean);let a=t,d="";n.forEach((l,i)=>{d=d?`${d}/${l}`:l;const p=i===n.length-1;let m=a.find(b=>b.name===l);m||(m=p?{type:"file",name:l,path:d,item:s}:{type:"folder",name:l,path:d,children:[]},a.push(m)),p||(m.children??(m.children=[]),a=m.children)})}return t}function G(r){const t=[];let s="";for(const n of r.split("/").filter(Boolean).slice(0,-1))s=s?`${s}/${n}`:n,t.push(s);return t}function A(r){return r.map(t=>({id:`untracked:${t}`,path:t,section:"untracked"}))}function J(r){var d,l;const t=(d=r.find(i=>i.startsWith("+++ ")))==null?void 0:d.slice(4).trim();if(t&&t!=="/dev/null")return k(t);const s=(l=r.find(i=>i.startsWith("--- ")))==null?void 0:l.slice(4).trim();if(s&&s!=="/dev/null")return k(s);const n=r.find(i=>i.startsWith("diff --git "));if(!n)return null;const a=n.match(/^diff --git a\/(.+?) b\/(.+)$/);return a?k(a[2]||a[1]||""):null}function k(r){return r.replace(/^[ab]\//,"")}const y={staged:"Staged",unstaged:"Unstaged",untracked:"Untracked"};function re({taskId:r}){const[t,s]=c.useState(null),[n,a]=c.useState(!0),[d,l]=c.useState(null),[i,p]=c.useState(null),[m,b]=c.useState(null),[T,v]=c.useState(!1),[U,N]=c.useState(null),S=c.useCallback(async()=>{a(!0),l(null),s(null);try{const o=await L(r);s(o)}catch(o){l(o instanceof Error?o.message:"Failed to load diff")}finally{a(!1)}},[r]);c.useEffect(()=>{S()},[S]);const F=c.useMemo(()=>C(t==null?void 0:t.staged,"staged"),[t==null?void 0:t.staged]),D=c.useMemo(()=>C(t==null?void 0:t.unstaged,"unstaged"),[t==null?void 0:t.unstaged]),E=c.useMemo(()=>A((t==null?void 0:t.untrackedFiles)??[]),[t==null?void 0:t.untrackedFiles]),j=c.useMemo(()=>[{section:"staged",items:F},{section:"unstaged",items:D},{section:"untracked",items:E}],[F,D,E]),h=c.useMemo(()=>j.flatMap(o=>o.items),[j]),u=c.useMemo(()=>h.find(o=>o.id===i)??h[0]??null,[h,i]);return c.useEffect(()=>{var o;(!i||!h.some(x=>x.id===i))&&p(((o=h[0])==null?void 0:o.id)??null)},[h,i]),c.useEffect(()=>{if(b(null),N(null),v(!1),!u||u.section!=="untracked")return;if(u.path.endsWith("/")){N("This untracked path is a directory. Open the Files tab to inspect its contents.");return}let o=!1;return v(!0),M(r,u.path).then(x=>{o||b(x)}).catch(x=>{o||N(x instanceof Error?x.message:"Failed to load file content")}).finally(()=>{o||v(!1)}),()=>{o=!0}},[u,r]),n?e.jsx(f,{tone:"muted",children:"Loading diff..."}):d?e.jsx(f,{tone:"destructive",children:d}):t!=null&&t.available?h.length>0?e.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[19rem_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"flex min-h-0 flex-col border-b border-border/60 bg-background/30 lg:border-b-0 lg:border-r",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Repository diff"}),e.jsx("div",{className:"mt-3 flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[e.jsx(O,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:t.branch??"detached HEAD"})]}),t.repoRoot&&e.jsx("div",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",children:t.repoRoot})]})}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:j.map(o=>e.jsxs(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[y[o.section]," ",o.items.length]},o.section))})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:e.jsx("div",{className:"space-y-3",children:j.map(({section:o,items:x})=>e.jsx(V,{section:o,items:x,selectedId:(u==null?void 0:u.id)??null,onSelect:p},o))})})]}),e.jsx("section",{className:"min-h-0 flex flex-col bg-card/10",children:u?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:y[u.section]}),u.section==="untracked"?e.jsx(g,{variant:"secondary",className:"rounded-full",children:"File content"}):e.jsx(g,{variant:"secondary",className:"rounded-full",children:"Diff patch"})]}),e.jsx("div",{className:"mt-3 break-all font-mono text-xs text-muted-foreground",children:u.path})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:u.section==="untracked"?e.jsx(K,{loading:T,error:U,content:m}):e.jsx(H,{patch:u.patch??""})})]}):e.jsx(f,{tone:"muted",children:"Select a file to inspect."})})]}):e.jsx(f,{tone:"muted",children:"Working tree is clean."}):e.jsx(f,{tone:"muted",children:"Task working directory is not inside a Git repository."})}function V({section:r,items:t,selectedId:s,onSelect:n}){const a=c.useMemo(()=>I(t),[t]),d=c.useMemo(()=>t.find(i=>i.id===s)??null,[t,s]),l=c.useMemo(()=>new Set(d?G(d.path):[]),[d]);return e.jsxs("section",{className:"rounded-[22px] border border-border/60 bg-background/35",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/60 px-3 py-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:y[r]}),e.jsx(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:t.length})]}),e.jsx("div",{className:"p-2",children:a.length>0?e.jsx("div",{className:"space-y-1",children:a.map(i=>e.jsx(W,{node:i,depth:0,selectedId:s,expandedAncestorPaths:l,onSelect:n},`${r}:${i.path}`))}):e.jsx("div",{className:"rounded-[16px] border border-dashed border-border/70 bg-background/30 px-3 py-3 text-sm text-muted-foreground",children:"No files."})})]})}function W({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){var d;return r.type==="folder"?e.jsx(z,{node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}):e.jsxs("button",{type:"button",onClick:()=>{r.item&&a(r.item.id)},className:w("flex w-full cursor-pointer items-center gap-2 rounded-[16px] px-2 py-2 text-left transition-colors",((d=r.item)==null?void 0:d.id)===s?"bg-primary/8 text-foreground":"text-foreground/90 hover:bg-background/55"),style:{paddingLeft:`${t*14+8}px`},children:[e.jsx(R,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate text-sm",children:r.name})]})}function z({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){const[d,l]=c.useState(!0);return c.useEffect(()=>{n.has(r.path)&&l(!0)},[n,r.path]),e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>l(i=>!i),"aria-expanded":d,className:"flex w-full cursor-pointer select-none items-center gap-2 rounded-[14px] px-2 py-1.5 text-left text-sm text-muted-foreground transition-colors hover:bg-background/55 hover:text-foreground",style:{paddingLeft:`${t*14+8}px`},children:[d?e.jsx(P,{className:"h-4 w-4 shrink-0"}):e.jsx(_,{className:"h-4 w-4 shrink-0"}),e.jsx(B,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:r.name})]}),d&&e.jsx("div",{className:"space-y-1",children:(r.children??[]).map(i=>e.jsx(W,{node:i,depth:t+1,selectedId:s,expandedAncestorPaths:n,onSelect:a},i.path))})]})}function H({patch:r}){const t=r.split(`
3
+ `).trim();if(!l){a=[];return}const i=J(a);if(!i){a=[];return}n.push({id:`${t}:${i}`,path:i,section:t,patch:l}),a=[]};for(const l of s)l.startsWith("diff --git ")&&a.length>0&&d(),a.push(l);return d(),n}function I(r){const t=[];for(const s of[...r].sort((n,a)=>n.path.localeCompare(a.path))){const n=s.path.split("/").filter(Boolean);let a=t,d="";n.forEach((l,i)=>{d=d?`${d}/${l}`:l;const p=i===n.length-1;let m=a.find(b=>b.name===l);m||(m=p?{type:"file",name:l,path:d,item:s}:{type:"folder",name:l,path:d,children:[]},a.push(m)),p||(m.children??(m.children=[]),a=m.children)})}return t}function G(r){const t=[];let s="";for(const n of r.split("/").filter(Boolean).slice(0,-1))s=s?`${s}/${n}`:n,t.push(s);return t}function A(r){return r.map(t=>({id:`untracked:${t}`,path:t,section:"untracked"}))}function J(r){var d,l;const t=(d=r.find(i=>i.startsWith("+++ ")))==null?void 0:d.slice(4).trim();if(t&&t!=="/dev/null")return k(t);const s=(l=r.find(i=>i.startsWith("--- ")))==null?void 0:l.slice(4).trim();if(s&&s!=="/dev/null")return k(s);const n=r.find(i=>i.startsWith("diff --git "));if(!n)return null;const a=n.match(/^diff --git a\/(.+?) b\/(.+)$/);return a?k(a[2]||a[1]||""):null}function k(r){return r.replace(/^[ab]\//,"")}const y={staged:"Staged",unstaged:"Unstaged",untracked:"Untracked"};function re({taskId:r}){const[t,s]=c.useState(null),[n,a]=c.useState(!0),[d,l]=c.useState(null),[i,p]=c.useState(null),[m,b]=c.useState(null),[T,v]=c.useState(!1),[U,N]=c.useState(null),F=c.useCallback(async()=>{a(!0),l(null),s(null);try{const o=await L(r);s(o)}catch(o){l(o instanceof Error?o.message:"Failed to load diff")}finally{a(!1)}},[r]);c.useEffect(()=>{F()},[F]);const S=c.useMemo(()=>D(t==null?void 0:t.staged,"staged"),[t==null?void 0:t.staged]),E=c.useMemo(()=>D(t==null?void 0:t.unstaged,"unstaged"),[t==null?void 0:t.unstaged]),C=c.useMemo(()=>A((t==null?void 0:t.untrackedFiles)??[]),[t==null?void 0:t.untrackedFiles]),j=c.useMemo(()=>[{section:"staged",items:S},{section:"unstaged",items:E},{section:"untracked",items:C}],[S,E,C]),h=c.useMemo(()=>j.flatMap(o=>o.items),[j]),u=c.useMemo(()=>h.find(o=>o.id===i)??h[0]??null,[h,i]);return c.useEffect(()=>{var o;(!i||!h.some(x=>x.id===i))&&p(((o=h[0])==null?void 0:o.id)??null)},[h,i]),c.useEffect(()=>{if(b(null),N(null),v(!1),!u||u.section!=="untracked")return;if(u.path.endsWith("/")){N("This untracked path is a directory. Open the Files tab to inspect its contents.");return}let o=!1;return v(!0),M(r,u.path).then(x=>{o||b(x)}).catch(x=>{o||N(x instanceof Error?x.message:"Failed to load file content")}).finally(()=>{o||v(!1)}),()=>{o=!0}},[u,r]),n?e.jsx(f,{tone:"muted",children:"Loading diff..."}):d?e.jsx(f,{tone:"destructive",children:d}):t!=null&&t.available?h.length>0?e.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[19rem_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"flex min-h-0 flex-col border-b border-border/60 bg-background/30 lg:border-b-0 lg:border-r",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Repository diff"}),e.jsx("div",{className:"mt-3 flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[e.jsx(O,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:t.branch??"detached HEAD"})]}),t.repoRoot&&e.jsx("div",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",children:t.repoRoot})]})}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:j.map(o=>e.jsxs(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[y[o.section]," ",o.items.length]},o.section))})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:e.jsx("div",{className:"space-y-3",children:j.map(({section:o,items:x})=>e.jsx(V,{section:o,items:x,selectedId:(u==null?void 0:u.id)??null,onSelect:p},o))})})]}),e.jsx("section",{className:"min-h-0 flex flex-col bg-card/10",children:u?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:y[u.section]}),u.section==="untracked"?e.jsx(g,{variant:"secondary",className:"rounded-full",children:"File content"}):e.jsx(g,{variant:"secondary",className:"rounded-full",children:"Diff patch"})]}),e.jsx("div",{className:"mt-3 break-all font-mono text-xs text-muted-foreground",children:u.path})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:u.section==="untracked"?e.jsx(K,{loading:T,error:U,content:m}):e.jsx(H,{patch:u.patch??""})})]}):e.jsx(f,{tone:"muted",children:"Select a file to inspect."})})]}):e.jsx(f,{tone:"muted",children:"Working tree is clean."}):e.jsx(f,{tone:"muted",children:"Task working directory is not inside a Git repository."})}function V({section:r,items:t,selectedId:s,onSelect:n}){const a=c.useMemo(()=>I(t),[t]),d=c.useMemo(()=>t.find(i=>i.id===s)??null,[t,s]),l=c.useMemo(()=>new Set(d?G(d.path):[]),[d]);return e.jsxs("section",{className:"rounded-[22px] border border-border/60 bg-background/35",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/60 px-3 py-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:y[r]}),e.jsx(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:t.length})]}),e.jsx("div",{className:"p-2",children:a.length>0?e.jsx("div",{className:"space-y-1",children:a.map(i=>e.jsx(W,{node:i,depth:0,selectedId:s,expandedAncestorPaths:l,onSelect:n},`${r}:${i.path}`))}):e.jsx("div",{className:"rounded-[16px] border border-dashed border-border/70 bg-background/30 px-3 py-3 text-sm text-muted-foreground",children:"No files."})})]})}function W({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){var d;return r.type==="folder"?e.jsx(z,{node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}):e.jsxs("button",{type:"button",onClick:()=>{r.item&&a(r.item.id)},className:w("flex w-full cursor-pointer items-center gap-2 rounded-[16px] px-2 py-2 text-left transition-colors",((d=r.item)==null?void 0:d.id)===s?"bg-primary/8 text-foreground":"text-foreground/90 hover:bg-background/55"),style:{paddingLeft:`${t*14+8}px`},children:[e.jsx(R,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate text-sm",children:r.name})]})}function z({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){const[d,l]=c.useState(!0);return c.useEffect(()=>{n.has(r.path)&&l(!0)},[n,r.path]),e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>l(i=>!i),"aria-expanded":d,className:"flex w-full cursor-pointer select-none items-center gap-2 rounded-[14px] px-2 py-1.5 text-left text-sm text-muted-foreground transition-colors hover:bg-background/55 hover:text-foreground",style:{paddingLeft:`${t*14+8}px`},children:[d?e.jsx(P,{className:"h-4 w-4 shrink-0"}):e.jsx(_,{className:"h-4 w-4 shrink-0"}),e.jsx(B,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:r.name})]}),d&&e.jsx("div",{className:"space-y-1",children:(r.children??[]).map(i=>e.jsx(W,{node:i,depth:t+1,selectedId:s,expandedAncestorPaths:n,onSelect:a},i.path))})]})}function H({patch:r}){const t=r.split(`
4
4
  `);return e.jsxs("div",{className:"rounded-[28px] border border-border/60 bg-background/55",children:[e.jsxs("div",{className:"border-b border-border/60 px-4 py-4",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"File diff"}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[t.length," lines"]})]}),e.jsx("div",{className:"font-mono text-xs leading-6",children:t.map((s,n)=>e.jsxs("div",{className:w("grid grid-cols-[56px_minmax(0,1fr)] gap-4 px-4 py-0.5",q(s)),children:[e.jsx("span",{className:"select-none text-right text-muted-foreground/55",children:n+1}),e.jsx("span",{className:"whitespace-pre-wrap break-all text-foreground",children:s||" "})]},`${n}-${s}`))})]})}function K({loading:r,error:t,content:s}){if(r)return e.jsx(f,{tone:"muted",children:"Loading file content..."});if(t)return e.jsx(f,{tone:"destructive",children:t});if(!s)return e.jsx(f,{tone:"muted",children:"Select an untracked file to preview its content."});if(s.kind==="image"){const n=s.content?`data:${s.mimeType};base64,${s.content}`:s.downloadUrl;return n?e.jsx("div",{className:"flex min-h-[20rem] items-center justify-center rounded-[28px] border border-border/60 bg-background/55 p-4",children:e.jsx("img",{src:n,alt:s.path,className:"max-h-full max-w-full rounded-[20px] object-contain shadow-[0_24px_90px_-52px_rgba(0,0,0,0.65)]"})}):e.jsx(f,{tone:"muted",children:"Image preview is not available."})}if(s.kind==="pdf"&&s.downloadUrl)return e.jsx("div",{className:"h-full min-h-[24rem] overflow-hidden rounded-[28px] border border-border/60 bg-background/55",children:e.jsx("iframe",{src:s.downloadUrl,title:s.path,className:"h-full w-full border-0"})});if(s.kind==="json"){let n=s.content;try{n=JSON.stringify(JSON.parse(s.content),null,2)}catch{}return e.jsx($,{content:n,truncated:s.truncated})}return s.kind==="markdown"||s.kind==="text"||s.kind==="html"?e.jsx($,{content:s.content,truncated:s.truncated}):e.jsx(f,{tone:"muted",children:"This file cannot be previewed inline."})}function $({content:r,truncated:t}){return e.jsxs("div",{className:"rounded-[28px] border border-border/60 bg-background/55",children:[e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap px-5 py-5 font-mono text-xs leading-6 text-foreground",children:r}),t&&e.jsx("div",{className:"border-t border-border/60 px-5 py-3 text-xs text-muted-foreground",children:"Content truncated. Open the Files tab to inspect the full artifact."})]})}function f({children:r,tone:t}){return e.jsx("div",{className:w("flex h-full min-h-[16rem] items-center justify-center rounded-[24px] text-sm",t==="muted"?"text-muted-foreground":"text-destructive"),children:r})}function q(r){return r.startsWith("@@")?"bg-sky-500/10":r.startsWith("+")&&!r.startsWith("+++")?"bg-emerald-500/10":r.startsWith("-")&&!r.startsWith("---")?"bg-destructive/10":r.startsWith("diff ")||r.startsWith("index ")||r.startsWith("---")||r.startsWith("+++")?"bg-muted/45":""}export{re as DiffTab};
@@ -1,4 +1,4 @@
1
- import{c as Ze,ax as Dt,j as y,r as re,ay as Nr,az as Ar,aA as Pr,B as rn,i as Me,a as Te}from"./index-COwXI8L0.js";import{F as zr,C as jr}from"./folder-C28inzgP.js";import{F as Lr}from"./file-BUN3RpOS.js";/**
1
+ import{c as Ze,az as Dt,j as y,r as re,aA as Nr,aB as Ar,aC as Pr,B as rn,i as Me,a as Te}from"./index-CSVyG8lh.js";import{F as zr,C as jr}from"./folder-D2R8g5cx.js";import{F as Lr}from"./file-DCzQQ4U3.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,16 +1,16 @@
1
- import{c as b,r as n,aB as O,aA as L,j as e,i as o,a0 as P,B as C,J as _,D,g as A,aC as F}from"./index-COwXI8L0.js";/**
1
+ import{c as b,r as n,aD as O,aC as L,j as e,i as o,a2 as P,B as M,M as D,D as _,g as F,aE as H}from"./index-CSVyG8lh.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const H=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],R=b("maximize-2",H);/**
6
+ */const R=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],$=b("maximize-2",R);/**
7
7
  * @license lucide-react v1.7.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const $=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],B=b("minimize-2",$);/**
11
+ */const A=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],U=b("minimize-2",A);/**
12
12
  * @license lucide-react v1.7.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const U=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],g=b("refresh-cw",U),q={getOutput:L,createPreviewSession:O};function J({taskId:i,api:l=q}){var E;const[r,x]=n.useState(null),[t,v]=n.useState(null),[f,j]=n.useState(null),[S,w]=n.useState(!0),[N,p]=n.useState(null),[z,y]=n.useState(!1),k=n.useCallback(async()=>{w(!0),p(null),x(null),v(null),j(null);try{const s=await l.getOutput(i);x(s),w(!1)}catch(s){p(s instanceof Error?s.message:"Failed to load output"),w(!1)}},[l,i]);n.useEffect(()=>{k()},[k]);const d=n.useCallback(async s=>{p(null);try{const a=await l.createPreviewSession(i,s);v(a),j(a.entryPath)}catch(a){p(a instanceof Error?a.message:"Failed to create preview session")}},[l,i]);n.useEffect(()=>{var a,u;if(!(r!=null&&r.available)||!((a=r.summary)!=null&&a.htmlEntries.length)||t)return;const s=f??((u=r.summary.htmlEntries[0])==null?void 0:u.path);s&&d(s)},[r,f,t,d]);const c=n.useCallback(()=>{var a,u;v(null);const s=(t==null?void 0:t.entryPath)??f??((u=(a=r==null?void 0:r.summary)==null?void 0:a.htmlEntries[0])==null?void 0:u.path);s&&d(s)},[r,f,t,d]);if(n.useEffect(()=>{if(!t)return;const s=t.expiresAt-Date.now()-5e3;if(s<=0){c();return}const a=window.setTimeout(c,s);return()=>window.clearTimeout(a)},[c,t]),S)return e.jsx(m,{children:"Loading preview..."});if(!(r!=null&&r.available))return e.jsx(m,{children:"Task output is not available yet."});const h=((E=r.summary)==null?void 0:E.htmlEntries)??[];if(h.length===0)return e.jsx(m,{children:"No HTML files were found in this task output."});if(N)return e.jsx(m,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-sm text-destructive",children:N}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(o,{variant:"outline",size:"sm",onClick:c,className:"rounded-full",children:[e.jsx(g,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});if(!t)return e.jsx(m,{children:"Starting preview session..."});const T=e.jsx("iframe",{src:t.previewUrl,className:"h-full w-full border-0",sandbox:"allow-scripts allow-same-origin",title:"HTML Preview"});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:t.entryPath}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:M(t.expiresAt)})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsx(o,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:c,title:"Refresh",children:e.jsx(g,{className:"h-3.5 w-3.5"})}),e.jsx(o,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:t.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(P,{className:"h-3.5 w-3.5"})})}),e.jsx(o,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:()=>y(!0),title:"Fullscreen",children:e.jsx(R,{className:"h-3.5 w-3.5"})})]})]}),h.length>1&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:h.map(s=>e.jsx("button",{type:"button",onClick:()=>{j(s.path),d(s.path)},className:t.entryPath===s.path?"rounded-full border border-primary/40 bg-primary/10 px-3 py-1 text-xs font-medium text-primary":"rounded-full border border-border/70 bg-background/55 px-3 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:s.label},s.path))}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsxs(C,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[h.length," ",h.length===1?"entry":"entries"]}),e.jsx(C,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:"Sandboxed iframe"})]})]}),e.jsx("div",{className:"min-h-0 flex-1 p-2",children:e.jsx("div",{className:"h-full overflow-hidden rounded-2xl border border-border/60 bg-white shadow-sm",children:T})}),e.jsx(_,{open:z,onOpenChange:y,children:e.jsxs(D,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(A,{className:"sr-only",children:["Preview: ",t.entryPath]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:t.entryPath}),e.jsx("span",{className:"text-xs text-muted-foreground",children:M(t.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(o,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:c,title:"Refresh",children:e.jsx(g,{className:"h-3.5 w-3.5"})}),e.jsx(o,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:t.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(P,{className:"h-3.5 w-3.5"})})}),e.jsx(F,{asChild:!0,children:e.jsxs(o,{variant:"outline",size:"sm",className:"rounded-full",title:"Exit fullscreen",children:[e.jsx(B,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:t.previewUrl,className:"h-full w-full border-0",sandbox:"allow-scripts allow-same-origin",title:"HTML Preview Fullscreen"})})]})})]})}function m({children:i}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:i})}function M(i){const l=Math.max(0,Math.round((i-Date.now())/1e3));if(l<60)return`${l}s`;const r=Math.floor(l/60),x=l%60;return`${r}m ${x}s`}export{J as PreviewTab};
16
+ */const B=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],g=b("refresh-cw",B),q={getOutput:L,createPreviewSession:O};function V({taskId:i,api:l=q}){var E;const[r,x]=n.useState(null),[t,v]=n.useState(null),[f,j]=n.useState(null),[S,w]=n.useState(!0),[N,p]=n.useState(null),[z,y]=n.useState(!1),k=n.useCallback(async()=>{w(!0),p(null),x(null),v(null),j(null);try{const s=await l.getOutput(i);x(s),w(!1)}catch(s){p(s instanceof Error?s.message:"Failed to load output"),w(!1)}},[l,i]);n.useEffect(()=>{k()},[k]);const d=n.useCallback(async s=>{p(null);try{const a=await l.createPreviewSession(i,s);v(a),j(a.entryPath)}catch(a){p(a instanceof Error?a.message:"Failed to create preview session")}},[l,i]);n.useEffect(()=>{var a,u;if(!(r!=null&&r.available)||!((a=r.summary)!=null&&a.htmlEntries.length)||t)return;const s=f??((u=r.summary.htmlEntries[0])==null?void 0:u.path);s&&d(s)},[r,f,t,d]);const c=n.useCallback(()=>{var a,u;v(null);const s=(t==null?void 0:t.entryPath)??f??((u=(a=r==null?void 0:r.summary)==null?void 0:a.htmlEntries[0])==null?void 0:u.path);s&&d(s)},[r,f,t,d]);if(n.useEffect(()=>{if(!t)return;const s=t.expiresAt-Date.now()-5e3;if(s<=0){c();return}const a=window.setTimeout(c,s);return()=>window.clearTimeout(a)},[c,t]),S)return e.jsx(m,{children:"Loading preview..."});if(!(r!=null&&r.available))return e.jsx(m,{children:"Task output is not available yet."});const h=((E=r.summary)==null?void 0:E.htmlEntries)??[];if(h.length===0)return e.jsx(m,{children:"No HTML files were found in this task output."});if(N)return e.jsx(m,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-sm text-destructive",children:N}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(o,{variant:"outline",size:"sm",onClick:c,className:"rounded-full",children:[e.jsx(g,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});if(!t)return e.jsx(m,{children:"Starting preview session..."});const T=e.jsx("iframe",{src:t.previewUrl,className:"h-full w-full border-0",sandbox:"allow-scripts allow-same-origin",title:"HTML Preview"});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:t.entryPath}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:C(t.expiresAt)})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsx(o,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:c,title:"Refresh",children:e.jsx(g,{className:"h-3.5 w-3.5"})}),e.jsx(o,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:t.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(P,{className:"h-3.5 w-3.5"})})}),e.jsx(o,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:()=>y(!0),title:"Fullscreen",children:e.jsx($,{className:"h-3.5 w-3.5"})})]})]}),h.length>1&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:h.map(s=>e.jsx("button",{type:"button",onClick:()=>{j(s.path),d(s.path)},className:t.entryPath===s.path?"rounded-full border border-primary/40 bg-primary/10 px-3 py-1 text-xs font-medium text-primary":"rounded-full border border-border/70 bg-background/55 px-3 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:s.label},s.path))}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsxs(M,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[h.length," ",h.length===1?"entry":"entries"]}),e.jsx(M,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:"Sandboxed iframe"})]})]}),e.jsx("div",{className:"min-h-0 flex-1 p-2",children:e.jsx("div",{className:"h-full overflow-hidden rounded-2xl border border-border/60 bg-white shadow-sm",children:T})}),e.jsx(D,{open:z,onOpenChange:y,children:e.jsxs(_,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(F,{className:"sr-only",children:["Preview: ",t.entryPath]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:t.entryPath}),e.jsx("span",{className:"text-xs text-muted-foreground",children:C(t.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(o,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:c,title:"Refresh",children:e.jsx(g,{className:"h-3.5 w-3.5"})}),e.jsx(o,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:t.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(P,{className:"h-3.5 w-3.5"})})}),e.jsx(H,{asChild:!0,children:e.jsxs(o,{variant:"outline",size:"sm",className:"rounded-full",title:"Exit fullscreen",children:[e.jsx(U,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:t.previewUrl,className:"h-full w-full border-0",sandbox:"allow-scripts allow-same-origin",title:"HTML Preview Fullscreen"})})]})})]})}function m({children:i}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:i})}function C(i){const l=Math.max(0,Math.round((i-Date.now())/1e3));if(l<60)return`${l}s`;const r=Math.floor(l/60),x=l%60;return`${r}m ${x}s`}export{V as PreviewTab};
@@ -0,0 +1,12 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-CSpNGxJl.js","assets/index-CSVyG8lh.js","assets/index-CnhngBZ-.css","assets/folder-D2R8g5cx.js","assets/file-DCzQQ4U3.js","assets/PreviewTab-CEFgpX6R.js"])))=>i.map(i=>d[i]);
2
+ import{c as j,ad as k,r as s,j as e,Q as S,U as T,at as C,au as M,av as w,aw as _,ax as P,ay as E,$ as y}from"./index-CSVyG8lh.js";import{K as L,H as A,G as I,L as O,g as F,f as R,i as v,u as z}from"./DashboardShared-BSmoDCJG.js";/**
3
+ * @license lucide-react v1.7.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const D=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],V=j("message-square-text",D);/**
8
+ * @license lucide-react v1.7.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const q=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],B=j("terminal",q),G=s.lazy(async()=>({default:(await y(()=>import("./FilesTab-CSpNGxJl.js"),__vite__mapDeps([0,1,2,3,4]))).FilesTab})),H=s.lazy(async()=>({default:(await y(()=>import("./PreviewTab-CEFgpX6R.js"),__vite__mapDeps([5,1,2]))).PreviewTab})),U={getOutput:w,getOutputTree:M,getOutputContent:C},$={getOutput:w,createPreviewSession:_};function J(){const{shareId:t}=k(),[h,a]=s.useState(null),[l,r]=s.useState([]),[u,c]=s.useState(!0),[p,n]=s.useState(null),o=s.useRef(null);return s.useEffect(()=>{if(!t){a(null),r([]),n("Shared conversation not found"),c(!1);return}let i=!1;o.current=t,c(!0),n(null);const x=async m=>{try{const[f,b]=await Promise.all([P(t),E(t)]);if(i||o.current!==t)return;a(f),r(N=>m?b.logs:z(N,b.logs)),n(null)}catch(f){if(i||o.current!==t)return;m&&(a(null),r([]),n(f instanceof Error?f.message:"Failed to load shared conversation"))}finally{!i&&o.current===t&&m&&c(!1)}};x(!0);const d=window.setInterval(()=>{x(!1)},2500);return()=>{i=!0,window.clearInterval(d)}},[t]),e.jsx(W,{conversation:h,logs:l,loading:u,error:p})}function W({conversation:t,logs:h,loading:a,error:l}){const[r,u]=s.useState("transcript"),[c,p]=s.useState(!1),n=s.useMemo(()=>{if(!t)return null;const d=L(t.payload.initialMessage);return d.length>0?A(d,new Date(t.createdAt).toISOString()):null},[t]),o=s.useMemo(()=>I([...n?[n]:[],...h]),[n,h]),i=(t==null?void 0:t.scope)==="filesPreview",x=e.jsx("section",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pb-16 px-4 py-5 sm:px-6",children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5 pb-16",children:[a&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/60 bg-background/60 px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(O,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!a&&l&&e.jsxs("div",{className:"rounded-lg border border-destructive/20 bg-destructive/10 px-5 py-8 text-center text-destructive",children:[e.jsx("div",{className:"text-base font-semibold",children:"Shared conversation unavailable"}),e.jsx("div",{className:"mt-2 text-sm",children:l})]}),!a&&!l&&o.length===0&&e.jsxs("div",{className:"rounded-lg border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[e.jsx(V,{className:"mx-auto h-6 w-6 text-muted-foreground"}),e.jsx("div",{className:"mt-3 text-sm font-medium text-foreground",children:"No transcript output yet"})]}),!a&&!l&&o.map((d,m)=>e.jsx(F,{event:d,questionResponseDisabled:!0},`shared-${m}`))]})});return e.jsxs("div",{className:"relative flex h-full min-h-0 overflow-hidden bg-background text-foreground",children:[e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-r border-border/60 bg-muted/20 px-4 py-5 lg:flex xl:w-72",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Shared view"})]})]}),e.jsx("div",{className:"mt-7 text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("h1",{className:"max-h-28 overflow-hidden break-words text-base font-semibold leading-5 text-foreground [overflow-wrap:anywhere]",title:t.title,children:t.title}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(S,{status:t.status}),e.jsx(T,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[e.jsxs("div",{children:["updated ",R(t.updatedAt)]}),e.jsx("div",{className:"font-mono",children:t.id.slice(0,8)})]})]}),e.jsxs("div",{className:"mt-auto space-y-2 pt-6",children:[c&&e.jsx("div",{className:"rounded-xl border border-border/70 bg-background/80 p-3 font-mono text-[11px] text-foreground shadow-sm",children:"npx -y meshy-node@latest start"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{href:"https://github.com/ai-microsoft/meshy",target:"_blank",rel:"noreferrer","aria-label":"Open Meshy on GitHub",className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/70 bg-background/70 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(K,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>p(d=>!d),"aria-expanded":c,className:"inline-flex h-9 items-center gap-2 rounded-full border border-border/70 bg-background/70 px-3 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(B,{className:"h-4 w-4"}),"Try it"]})]})]})]}),e.jsxs("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/60 bg-background/85 px-4 py-3 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background lg:hidden",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"truncate text-base font-semibold text-foreground",children:(t==null?void 0:t.title)??"Shared conversation"})]})]}),i&&e.jsxs("div",{className:"mt-3 inline-flex h-auto rounded-full bg-muted/70 p-1 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>u("transcript"),className:g(r==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>u("files"),className:g(r==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>u("preview"),className:g(r==="preview"),children:"Preview"})]})]}),i&&t?e.jsxs(e.Fragment,{children:[r==="transcript"&&x,r==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading files..."}),children:e.jsx(G,{taskId:t.shareId,api:U})})}),r==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading preview..."}),children:e.jsx(H,{taskId:t.shareId,api:$})})})]}):x]})]})}function g(t){return t?"inline-flex items-center justify-center whitespace-nowrap rounded-full bg-background px-3 py-1.5 text-sm font-medium text-foreground shadow-sm":"inline-flex items-center justify-center whitespace-nowrap rounded-full px-3 py-1.5 text-sm font-medium transition-colors hover:text-foreground"}function K({className:t}){return e.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.58 2 12.23c0 4.51 2.87 8.34 6.84 9.7.5.1.68-.22.68-.49 0-.24-.01-.88-.01-1.73-2.78.62-3.37-1.37-3.37-1.37-.45-1.18-1.11-1.49-1.11-1.49-.91-.64.07-.63.07-.63 1 .07 1.53 1.06 1.53 1.06.89 1.56 2.34 1.11 2.91.85.09-.66.35-1.11.63-1.37-2.22-.26-4.55-1.14-4.55-5.05 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.31.1-2.71 0 0 .84-.27 2.75 1.05A9.3 9.3 0 0 1 12 6.96c.85 0 1.71.12 2.51.34 1.91-1.32 2.75-1.05 2.75-1.05.55 1.4.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.92-2.34 4.79-4.57 5.05.36.32.68.94.68 1.9 0 1.37-.01 2.47-.01 2.81 0 .27.18.59.69.49A10.05 10.05 0 0 0 22 12.23C22 6.58 17.52 2 12 2Z"})})}export{J as SharedConversationPage,W as SharedConversationView};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-COwXI8L0.js";/**
1
+ import{c as a}from"./index-CSVyG8lh.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-COwXI8L0.js";/**
1
+ import{c as o}from"./index-CSVyG8lh.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.