@hsafa/ui-sdk 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),zt=require('react'),reactDom=require('react-dom');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var zt__default=/*#__PURE__*/_interopDefault(zt);var it={};var Fr=({variant:t="primary",size:e="md",loading:n=false,disabled:o,children:a,className:c,...r})=>{let l=[it.button,it[t],it[e],n&&it.loading,c].filter(Boolean).join(" ");return jsxRuntime.jsxs("button",{className:l,disabled:o||n,...r,children:[n&&jsxRuntime.jsx("span",{className:it.spinner}),jsxRuntime.jsx("span",{className:n?it.hiddenText:void 0,children:a})]})};function qt(t){if(!t||Number.isNaN(t))return "0 B";let e=["B","KB","MB","GB","TB"],n=Math.min(e.length-1,Math.floor(Math.log(t)/Math.log(1024)));return `${(t/Math.pow(1024,n)).toFixed(n===0?0:1)} ${e[n]}`}function It({attachments:t,resolvedColors:e,onRemove:n}){if(!Array.isArray(t)||t.length===0)return null;let o=typeof n=="function";return jsxRuntime.jsx("div",{style:{marginTop:"12px",display:"flex",flexWrap:"wrap",gap:"8px"},children:t.map(a=>{let c=a.mimeType?.startsWith("image/");return o?jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 10px",backgroundColor:e.inputBackground,borderRadius:"8px",border:`1px solid ${e.borderColor}`,fontSize:"11px",color:e.textColor,maxWidth:"200px",position:"relative"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"3px",backgroundColor:c?"transparent":e.accentColor,flexShrink:0},children:c?jsxRuntime.jsx("img",{src:a.url,alt:a.name,style:{width:"16px",height:"16px",borderRadius:"3px",objectFit:"cover"}}):jsxRuntime.jsx(lucideReact.File,{size:"10",strokeWidth:"2",style:{color:e.mutedTextColor}})}),jsxRuntime.jsxs("div",{style:{minWidth:"0",flex:"1"},children:[jsxRuntime.jsx("div",{title:a.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:"500"},children:a.name}),jsxRuntime.jsx("div",{style:{fontSize:"9px",color:e.mutedTextColor,marginTop:"1px"},children:qt(a.size)})]}),jsxRuntime.jsx("button",{onClick:()=>n(a.id),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"4px",border:"none",backgroundColor:"transparent",color:e.mutedTextColor,cursor:"pointer",transition:"all 0.2s",flexShrink:0},onMouseEnter:r=>{r.currentTarget.style.backgroundColor="rgba(239, 68, 68, 0.1)",r.currentTarget.style.color="#ef4444";},onMouseLeave:r=>{r.currentTarget.style.backgroundColor="transparent",r.currentTarget.style.color=e.mutedTextColor;},children:jsxRuntime.jsx(lucideReact.X,{size:"12",strokeWidth:"2"})})]},a.id):jsxRuntime.jsxs("a",{href:a.url,target:"_blank",rel:"noreferrer",style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 10px",backgroundColor:e.inputBackground,borderRadius:"8px",border:`1px solid ${e.borderColor}`,fontSize:"11px",color:e.textColor,textDecoration:"none",transition:"all 0.2s",cursor:"pointer",maxWidth:"200px"},onMouseEnter:r=>{r.currentTarget.style.backgroundColor=e.hoverBackground,r.currentTarget.style.borderColor=e.primaryColor;},onMouseLeave:r=>{r.currentTarget.style.backgroundColor=e.inputBackground,r.currentTarget.style.borderColor=e.borderColor;},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"3px",backgroundColor:c?"transparent":e.accentColor,flexShrink:0},children:[c?jsxRuntime.jsx("img",{src:a.url,alt:a.name,style:{width:"16px",height:"16px",borderRadius:"3px",objectFit:"cover"},onError:r=>{r.target.style.display="none";let l=r.target.nextElementSibling;l&&(l.style.display="block");}}):null,jsxRuntime.jsx(lucideReact.File,{size:"10",strokeWidth:"2",style:{display:c?"none":"block",color:e.mutedTextColor}})]}),jsxRuntime.jsxs("div",{style:{minWidth:"0",flex:"1"},children:[jsxRuntime.jsx("div",{title:a.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:"500"},children:a.name}),jsxRuntime.jsx("div",{style:{fontSize:"9px",color:e.mutedTextColor,marginTop:"1px"},children:qt(a.size)})]}),jsxRuntime.jsx(lucideReact.Download,{size:"10",strokeWidth:"2",style:{color:e.mutedTextColor,flexShrink:0}})]},a.id)})})}function ke({messageId:t,initialText:e,editingText:n,onEditingTextChange:o,onCancel:a,onSave:c,streaming:r,resolvedColors:l,attachments:m,onRemoveAttachment:b,onAddAttachments:g,uploading:C,t:d}){let f=zt__default.default.useRef(null),y=u=>{u.key==="Escape"?a():u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),r||c(t,n||e));},M=u=>{let i=u.target.files;i&&i.length>0&&g&&g(i),f.current&&(f.current.value="");};return jsxRuntime.jsxs("div",{style:{maxWidth:"720px",borderRadius:"16px",padding:"8px",fontSize:"15px",border:`2px solid ${l.primaryColor}`,backgroundColor:l.accentColor,color:l.textColor},children:[jsxRuntime.jsx("textarea",{autoFocus:true,style:{width:"100%",resize:"none",backgroundColor:"transparent",padding:"8px",lineHeight:"1.6",outline:"none",border:"none",color:"inherit",fontFamily:"inherit",fontSize:"inherit"},rows:Math.max(2,Math.min(10,Math.ceil((n||e).length/60))),value:n,onChange:u=>o(u.target.value),onKeyDown:y}),m&&m.length>0&&jsxRuntime.jsx("div",{style:{padding:"8px"},children:jsxRuntime.jsx(It,{attachments:m,resolvedColors:l,onRemove:b})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",padding:"8px 8px 8px 0"},children:[g&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{ref:f,type:"file",multiple:true,onChange:M,style:{display:"none"}}),jsxRuntime.jsx("button",{onClick:()=>f.current?.click(),disabled:C||r,title:d(C?"input.uploadingFiles":"input.attachFiles"),style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:"28px",height:"28px",transition:"all 0.2s",border:`1px solid ${l.borderColor}`,color:l.mutedTextColor,backgroundColor:"transparent",cursor:C||r?"not-allowed":"pointer",opacity:C||r?.5:1},onMouseEnter:u=>{!C&&!r&&(u.currentTarget.style.backgroundColor=l.inputBackground,u.currentTarget.style.borderColor=l.primaryColor);},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent",u.currentTarget.style.borderColor=l.borderColor;},children:jsxRuntime.jsx(lucideReact.Plus,{size:16,strokeWidth:2})})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsx("button",{style:{borderRadius:"8px",padding:"4px 12px",fontSize:"14px",transition:"background-color 0.2s",border:`1px solid ${l.borderColor}`,color:l.mutedTextColor,backgroundColor:"transparent",cursor:"pointer"},onMouseEnter:u=>u.currentTarget.style.backgroundColor=l.inputBackground,onMouseLeave:u=>u.currentTarget.style.backgroundColor="transparent",onClick:a,children:d("editor.cancel")}),jsxRuntime.jsx("button",{style:{borderRadius:"8px",padding:"4px 12px",fontSize:"14px",transition:"border-color 0.2s",border:`1px solid ${l.borderColor}`,backgroundColor:l.cardBackground,color:l.textColor,cursor:"pointer"},onMouseEnter:u=>u.currentTarget.style.borderColor=l.primaryColor,onMouseLeave:u=>u.currentTarget.style.borderColor=l.borderColor,onClick:()=>{r||c(t,n||e);},children:d("editor.saveAndRegenerate")})]})]})]})}function Dn(t){return t.mimeType.startsWith("image/")?{type:"image",image:new URL(t.url),mediaType:t.mimeType}:{type:"file",data:t.url,mediaType:t.mimeType,name:t.name}}function Vt(t,e){let n=(t||"").trim();if(!e||e.length===0)return n;let o=[];n&&o.push({type:"text",text:n});for(let a of e)o.push(Dn(a));return o}function Te(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(n=>n.type==="text").map(n=>n.text).join(`
|
|
1
|
+
'use strict';var jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),zt=require('react'),reactDom=require('react-dom');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var zt__default=/*#__PURE__*/_interopDefault(zt);var it={};var Fr=({variant:t="primary",size:e="md",loading:n=false,disabled:o,children:a,className:c,...r})=>{let l=[it.button,it[t],it[e],n&&it.loading,c].filter(Boolean).join(" ");return jsxRuntime.jsxs("button",{className:l,disabled:o||n,...r,children:[n&&jsxRuntime.jsx("span",{className:it.spinner}),jsxRuntime.jsx("span",{className:n?it.hiddenText:void 0,children:a})]})};function qt(t){if(!t||Number.isNaN(t))return "0 B";let e=["B","KB","MB","GB","TB"],n=Math.min(e.length-1,Math.floor(Math.log(t)/Math.log(1024)));return `${(t/Math.pow(1024,n)).toFixed(n===0?0:1)} ${e[n]}`}function It({attachments:t,resolvedColors:e,onRemove:n}){if(!Array.isArray(t)||t.length===0)return null;let o=typeof n=="function";return jsxRuntime.jsx("div",{style:{marginTop:"12px",display:"flex",flexWrap:"wrap",gap:"8px"},children:t.map(a=>{let c=a.mimeType?.startsWith("image/");return o?jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 10px",backgroundColor:e.inputBackground,borderRadius:"8px",border:`1px solid ${e.borderColor}`,fontSize:"11px",color:e.textColor,maxWidth:"200px",position:"relative"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"3px",backgroundColor:c?"transparent":e.accentColor,flexShrink:0},children:c?jsxRuntime.jsx("img",{src:a.url,alt:a.name,style:{width:"16px",height:"16px",borderRadius:"3px",objectFit:"cover"}}):jsxRuntime.jsx(lucideReact.File,{size:"10",strokeWidth:"2",style:{color:e.mutedTextColor}})}),jsxRuntime.jsxs("div",{style:{minWidth:"0",flex:"1"},children:[jsxRuntime.jsx("div",{title:a.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:"500"},children:a.name}),jsxRuntime.jsx("div",{style:{fontSize:"9px",color:e.mutedTextColor,marginTop:"1px"},children:qt(a.size)})]}),jsxRuntime.jsx("button",{onClick:()=>n(a.id),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"4px",border:"none",backgroundColor:"transparent",color:e.mutedTextColor,cursor:"pointer",transition:"all 0.2s",flexShrink:0},onMouseEnter:r=>{r.currentTarget.style.backgroundColor="rgba(239, 68, 68, 0.1)",r.currentTarget.style.color="#ef4444";},onMouseLeave:r=>{r.currentTarget.style.backgroundColor="transparent",r.currentTarget.style.color=e.mutedTextColor;},children:jsxRuntime.jsx(lucideReact.X,{size:"12",strokeWidth:"2"})})]},a.id):jsxRuntime.jsxs("a",{href:a.url,target:"_blank",rel:"noreferrer",style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 10px",backgroundColor:e.inputBackground,borderRadius:"8px",border:`1px solid ${e.borderColor}`,fontSize:"11px",color:e.textColor,textDecoration:"none",transition:"all 0.2s",cursor:"pointer",maxWidth:"200px"},onMouseEnter:r=>{r.currentTarget.style.backgroundColor=e.hoverBackground,r.currentTarget.style.borderColor=e.primaryColor;},onMouseLeave:r=>{r.currentTarget.style.backgroundColor=e.inputBackground,r.currentTarget.style.borderColor=e.borderColor;},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"3px",backgroundColor:c?"transparent":e.accentColor,flexShrink:0},children:[c?jsxRuntime.jsx("img",{src:a.url,alt:a.name,style:{width:"16px",height:"16px",borderRadius:"3px",objectFit:"cover"},onError:r=>{r.target.style.display="none";let l=r.target.nextElementSibling;l&&(l.style.display="block");}}):null,jsxRuntime.jsx(lucideReact.File,{size:"10",strokeWidth:"2",style:{display:c?"none":"block",color:e.mutedTextColor}})]}),jsxRuntime.jsxs("div",{style:{minWidth:"0",flex:"1"},children:[jsxRuntime.jsx("div",{title:a.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:"500"},children:a.name}),jsxRuntime.jsx("div",{style:{fontSize:"9px",color:e.mutedTextColor,marginTop:"1px"},children:qt(a.size)})]}),jsxRuntime.jsx(lucideReact.Download,{size:"10",strokeWidth:"2",style:{color:e.mutedTextColor,flexShrink:0}})]},a.id)})})}function ke({messageId:t,initialText:e,editingText:n,onEditingTextChange:o,onCancel:a,onSave:c,streaming:r,resolvedColors:l,attachments:m,onRemoveAttachment:b,onAddAttachments:g,uploading:C,t:d}){let f=zt__default.default.useRef(null),y=u=>{u.key==="Escape"?a():u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),r||c(t,n||e));},M=u=>{let i=u.target.files;i&&i.length>0&&g&&g(i),f.current&&(f.current.value="");};return jsxRuntime.jsxs("div",{style:{maxWidth:"720px",borderRadius:"16px",padding:"8px",fontSize:"15px",border:`2px solid ${l.primaryColor}`,backgroundColor:l.accentColor,color:l.textColor},children:[jsxRuntime.jsx("textarea",{autoFocus:true,style:{width:"100%",resize:"none",backgroundColor:"transparent",padding:"8px",lineHeight:"1.6",outline:"none",border:"none",color:"inherit",fontFamily:"inherit",fontSize:"inherit"},rows:Math.max(2,Math.min(10,Math.ceil((n||e).length/60))),value:n,onChange:u=>o(u.target.value),onKeyDown:y}),m&&m.length>0&&jsxRuntime.jsx("div",{style:{padding:"8px"},children:jsxRuntime.jsx(It,{attachments:m,resolvedColors:l,onRemove:b})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",padding:"8px 8px 8px 0"},children:[g&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{ref:f,type:"file",multiple:true,onChange:M,style:{display:"none"}}),jsxRuntime.jsx("button",{onClick:()=>f.current?.click(),disabled:C||r,title:d(C?"input.uploadingFiles":"input.attachFiles"),style:{display:"flex",margin:"0 10px",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:"28px",height:"28px",transition:"all 0.2s",border:`1px solid ${l.borderColor}`,color:l.mutedTextColor,backgroundColor:"transparent",cursor:C||r?"not-allowed":"pointer",opacity:C||r?.5:1},onMouseEnter:u=>{!C&&!r&&(u.currentTarget.style.backgroundColor=l.inputBackground,u.currentTarget.style.borderColor=l.primaryColor);},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent",u.currentTarget.style.borderColor=l.borderColor;},children:jsxRuntime.jsx(lucideReact.Plus,{size:16,strokeWidth:2})})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsx("button",{style:{borderRadius:"8px",padding:"4px 12px",fontSize:"14px",transition:"background-color 0.2s",border:`1px solid ${l.borderColor}`,color:l.mutedTextColor,backgroundColor:"transparent",cursor:"pointer"},onMouseEnter:u=>u.currentTarget.style.backgroundColor=l.inputBackground,onMouseLeave:u=>u.currentTarget.style.backgroundColor="transparent",onClick:a,children:d("editor.cancel")}),jsxRuntime.jsx("button",{style:{borderRadius:"8px",padding:"4px 12px",fontSize:"14px",transition:"border-color 0.2s",border:`1px solid ${l.borderColor}`,backgroundColor:l.cardBackground,color:l.textColor,cursor:"pointer"},onMouseEnter:u=>u.currentTarget.style.borderColor=l.primaryColor,onMouseLeave:u=>u.currentTarget.style.borderColor=l.borderColor,onClick:()=>{r||c(t,n||e);},children:d("editor.saveAndRegenerate")})]})]})]})}function Dn(t){return t.mimeType.startsWith("image/")?{type:"image",image:new URL(t.url),mediaType:t.mimeType}:{type:"file",data:t.url,mediaType:t.mimeType,name:t.name}}function Vt(t,e){let n=(t||"").trim();if(!e||e.length===0)return n;let o=[];n&&o.push({type:"text",text:n});for(let a of e)o.push(Dn(a));return o}function Te(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(n=>n.type==="text").map(n=>n.text).join(`
|
|
2
2
|
`):""}function Me(t){if(typeof t=="string"||!Array.isArray(t))return [];let e=[];for(let n of t)if(n.type==="image"){let o=typeof n.image=="string"?n.image:n.image.toString();e.push({id:`img_${Date.now()}_${Math.random().toString(36).slice(2)}`,name:"image",url:o,mimeType:n.mediaType||"image/jpeg",size:0});}else if(n.type==="file"){let o=typeof n.data=="string"?n.data:n.data.toString();e.push({id:`file_${Date.now()}_${Math.random().toString(36).slice(2)}`,name:n.name||"file",url:o,mimeType:n.mediaType,size:0});}return e}function Jt(t){return t.role==="user"?t.text?t.text:Te(t.content):""}function gt(t){return t.role==="user"?t.attachments?t.attachments:Me(t.content):[]}function ve(t,e=[]){let n=Vt(t,e),o=Date.now();return {id:`user_${o}_${Math.random().toString(36).slice(2)}`,role:"user",content:n,createdAt:o,text:t,attachments:e.length>0?e:void 0}}function Xt(t=false){let e=Date.now();return {id:`assistant_${e}_${Math.random().toString(36).slice(2)}`,role:"assistant",items:[],reasoning:"",reasoningOpen:t,mainAgentActions:[],createdAt:e}}function Ae(t){let e=[];for(let n of t)if(n.role==="user")e.push({role:n.role,content:n.content});else if(n.role==="assistant"){let o=[];if(n.firstAgentMessage&&o.push({type:"text",text:n.firstAgentMessage}),n.mainAgentActions&&n.mainAgentActions.length>0){for(let a of n.mainAgentActions)if(a.type==="reasoning"&&a.reasoning)o.push({type:"reasoning",text:a.reasoning});else if(a.type==="tool-call"&&a.toolName){let c=a.toolCallId||(typeof a.startDate=="number"&&a.toolName?`${a.toolName}_${a.startDate}`:`call_${a.toolName||"tool"}_${Math.abs(a.durationMs||0)}`);o.push({type:"tool-call",toolCallId:c,toolName:a.toolName,input:a.input||{}}),a.output!==void 0&&e.push({role:"tool",content:[{type:"tool-result",toolCallId:c,toolName:a.toolName,output:a.output,isError:a.status==="error"}]});}}if(n.items&&n.items.length>0){let a=JSON.stringify(n.items,null,2);o.push({type:"text",text:a});}o.length>0&&e.push({role:n.role,content:o});}return e}function we(t,e,n){let o=n??gt(t),a=Vt(e,o);return {...t,content:a,text:e,attachments:o.length>0?o:void 0}}function Se(t){if(t.role==="user"){let e=Jt(t),n=gt(t);return n.length>0?`${e} [${n.length} attachment${n.length>1?"s":""}]`:e}else if(t.role==="assistant"){let n=(t.items||[]).filter(o=>o.type==="text");return n.length>0?n.map(o=>o.text||"").join(" ").slice(0,100):"Assistant response"}return ""}function $e({message:t,isEditing:e,editingText:n,editingAttachments:o,onEditingTextChange:a,onStartEdit:c,onCancelEdit:r,onSaveEdit:l,onRemoveAttachment:m,onAddAttachments:b,uploading:g,streaming:C,resolvedColors:d,t:f}){let y=Jt(t),M=gt(t);return e?jsxRuntime.jsx(ke,{messageId:t.id,initialText:y,editingText:n,onEditingTextChange:a,onCancel:r,onSave:l,streaming:C,resolvedColors:d,attachments:o||M,onRemoveAttachment:m,onAddAttachments:b,uploading:g,t:f}):jsxRuntime.jsxs("div",{title:f("editor.clickToEdit"),onClick:()=>{C||c(t.id,y);},style:{maxWidth:"720px",borderRadius:"16px",padding:"16px",fontSize:"15px",lineHeight:"1.6",whiteSpace:"pre-wrap",cursor:"pointer",transition:"background-color 0.2s",backgroundColor:d.accentColor,color:d.textColor},onMouseEnter:u=>u.currentTarget.style.backgroundColor=d.hoverBackground,onMouseLeave:u=>u.currentTarget.style.backgroundColor=d.accentColor,children:[y,jsxRuntime.jsx(It,{attachments:M,resolvedColors:d})]})}function Fe({reasoning:t,reasoningOpen:e,onToggleReasoning:n,resolvedColors:o}){return t?jsxRuntime.jsxs("div",{style:{borderRadius:"12px",padding:"12px",cursor:"pointer",backgroundColor:o.inputBackground,border:`1px solid ${o.borderColor}`},onClick:n,children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"},children:[jsxRuntime.jsx("div",{style:{fontSize:"12px",color:o.mutedTextColor},children:"Reasoning"}),jsxRuntime.jsx("button",{type:"button",style:{fontSize:"12px",transition:"color 0.2s",color:o.mutedTextColor,background:"none",border:"none",cursor:"pointer"},onMouseEnter:a=>a.currentTarget.style.color=o.textColor,onMouseLeave:a=>a.currentTarget.style.color=o.mutedTextColor,children:e?"Hide":"Show full"})]}),e?jsxRuntime.jsx("pre",{style:{fontSize:"12px",whiteSpace:"pre-wrap",wordBreak:"break-word",color:o.mutedTextColor,margin:"0",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace'},children:t}):(()=>{let a=(t||"").trim().split(`
|
|
3
3
|
`).filter(r=>r.trim()),c=a.length>0?a[a.length-1]:"";return jsxRuntime.jsx("pre",{style:{fontSize:"12px",whiteSpace:"pre-wrap",wordBreak:"break-word",color:o.mutedTextColor,margin:"0",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace'},children:c||"\u2026"})})()]}):null}function ze({chart:t,theme:e}){let n=zt.useRef(null),[o,a]=zt.useState(null),[c,r]=zt.useState(true);zt.useEffect(()=>{let d=true;return (async()=>{try{r(!0),a(null);let y;try{y=await import('mermaid');}catch{throw new Error("Mermaid library not available")}if(!d)return;if(y.default?.initialize({startOnLoad:!1,theme:e==="dark"?"dark":"default",themeVariables:{darkMode:e==="dark",primaryColor:e==="dark"?"#3B82F6":"#1D4ED8",primaryTextColor:e==="dark"?"#F3F4F6":"#1F2937",primaryBorderColor:e==="dark"?"#374151":"#D1D5DB"},flowchart:{useMaxWidth:!0},sequence:{useMaxWidth:!0},gantt:{useMaxWidth:!0}}),n.current&&d){let M=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2)}`,{svg:u}=await y.default.render(M,t);if(n.current&&d){n.current.innerHTML=u;let i=n.current.querySelector("svg");i&&(i.style.maxWidth="100%",i.style.height="auto",i.style.display="block");}}}catch(y){d&&a(y instanceof Error?y.message:"Failed to render diagram");}finally{d&&r(false);}})(),()=>{d=false;}},[t,e]);let l=e==="dark"?"#374151":"#D1D5DB",m=e==="dark"?"#1F2937":"#F9FAFB",b=e==="dark"?"#7F1D1D":"#FEF2F2",g=e==="dark"?"#FCA5A5":"#DC2626",C=e==="dark"?"#9CA3AF":"#6B7280";return o?jsxRuntime.jsxs("div",{style:{borderRadius:"12px",border:`1px solid ${l}`,backgroundColor:b,padding:"16px",margin:"8px 0"},children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",color:g,marginBottom:"8px",fontWeight:"500"},children:"Failed to render diagram"}),jsxRuntime.jsx("div",{style:{fontSize:"12px",color:g,opacity:.8},children:o})]}):jsxRuntime.jsxs("div",{style:{borderRadius:"12px",border:`1px solid ${l}`,backgroundColor:m,padding:"16px",margin:"8px 0",overflow:"hidden"},children:[c&&jsxRuntime.jsx("div",{style:{fontSize:"14px",color:C,textAlign:"center",padding:"32px"},children:"Rendering diagram..."}),jsxRuntime.jsx("div",{ref:n,style:{display:c?"none":"block",textAlign:"center",minHeight:c?"0":"50px"}})]})}function Q(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ht(t){return t=t.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="text-decoration: underline; color: inherit; opacity: 0.8;">$1</a>'),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t=t.replace(/\*([^*\n]+)\*/g,"<em>$1</em>"),t=t.replace(/`([^`]+)`/g,'<code style="padding: 2px 4px; border-radius: 4px; background-color: rgba(0,0,0,0.1); font-family: monospace;">$1</code>'),t}function Pn(t,e="dark"){let n=(t||"").replace(/\r\n/g,`
|
|
4
4
|
`).split(`
|