agent-canvas 0.1.5 → 0.1.7
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/LICENSE +21 -0
- package/README.md +71 -0
- package/bin/agent-canvas.ts +26 -353
- package/bin/lib/commands/daemon.ts +51 -0
- package/bin/lib/commands/fetch.ts +20 -0
- package/bin/lib/commands/install.ts +48 -0
- package/bin/lib/commands/push.ts +66 -0
- package/bin/lib/commands/watch.ts +23 -0
- package/bin/lib/config.ts +10 -0
- package/bin/lib/daemon-lifecycle.ts +74 -0
- package/bin/lib/helpers.ts +78 -0
- package/daemon/build.ts +27 -61
- package/daemon/client/AnnotationProvider.tsx +2 -2
- package/daemon/client/AnnotationSidebar.tsx +199 -31
- package/daemon/client/App.tsx +4 -3
- package/daemon/client/FileBrowser.tsx +8 -7
- package/daemon/client/FileViewer.tsx +153 -16
- package/daemon/client/PlanRenderer.tsx +6 -3
- package/daemon/client/ResponsePreview.tsx +5 -116
- package/daemon/client/SessionSwitcher.tsx +21 -10
- package/daemon/client/compat/preact-all.ts +4 -0
- package/daemon/client/components/Markdown.tsx +44 -0
- package/daemon/client/components/ResponseNote.tsx +3 -8
- package/daemon/client/components/UserInput.tsx +2 -4
- package/daemon/client/components/index.ts +1 -0
- package/daemon/client/domDiff.ts +82 -2
- package/daemon/client/generateMarkdown.ts +46 -9
- package/daemon/client/highlightRange.ts +8 -6
- package/daemon/client/runtime.ts +2 -0
- package/daemon/client/styles.css +126 -0
- package/daemon/client/unifiedDiff.ts +155 -2
- package/daemon/client/utils.ts +10 -0
- package/daemon/dist/client.css +1 -1
- package/daemon/dist/client.js +83 -36
- package/daemon/dist/components.js +63 -5
- package/daemon/dist/index.html +5 -12
- package/daemon/dist/jsx-runtime.js +3 -0
- package/daemon/dist/preact-compat.js +1 -0
- package/daemon/src/compiler.ts +28 -2
- package/daemon/src/handlers/api.ts +150 -0
- package/daemon/src/handlers/files.ts +114 -0
- package/daemon/src/handlers/static.ts +61 -0
- package/daemon/src/handlers/utils.ts +14 -0
- package/daemon/src/router.ts +16 -0
- package/daemon/src/server.ts +28 -403
- package/daemon/src/session.ts +41 -23
- package/daemon/src/websocket.ts +83 -0
- package/package.json +3 -3
- package/skills/canvas/SKILL.md +32 -22
- package/skills/canvas/components.md +31 -0
- package/skills/canvas/flows.md +2 -2
- package/daemon/dist/jsx-dev-runtime-shim.js +0 -17
- package/daemon/dist/jsx-runtime-shim.js +0 -17
- package/daemon/dist/react-dom-client-shim.js +0 -4
- package/daemon/dist/react-dom-shim.js +0 -4
- package/daemon/dist/react-shim.js +0 -4
|
@@ -1,5 +1,63 @@
|
|
|
1
|
-
import{useState as
|
|
2
|
-
`).slice(
|
|
3
|
-
`);J(U),Y(k.language||"text")}}).catch(()=>K("Failed to fetch file")).finally(()=>F(!1))},[f,y,W?.[0],W?.[1],B]),my(()=>{let k=q.current,U=window.hljs;if(!k||!U||!$)return;k.removeAttribute("data-highlighted"),k.className=m?`language-${m}`:"",k.textContent=$,U.highlightElement(k)},[$,m]),b)return c("div",{className:"text-text-tertiary text-body mt-3 bg-bg-code rounded-md p-4",children:["Loading ",y,"..."]},void 0,!0,void 0,this);if(Q)return c("div",{className:"text-accent-red text-body mt-3 bg-accent-red-muted rounded-md p-4",children:[y,": ",Q]},void 0,!0,void 0,this);return c("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden","data-md":"filepreview","data-md-path":y,...W?{"data-md-lines":`${W[0]}-${W[1]}`}:{},children:[c("div",{className:"px-4 py-2 flex items-center justify-between",children:[c("button",{className:"font-mono text-meta text-text-tertiary hover:text-text-secondary hover:underline cursor-pointer text-left",onClick:()=>N({type:"file",path:y}),title:`Open ${y}`,children:y},void 0,!1,void 0,this),W&&c("span",{className:"font-mono text-meta text-text-tertiary opacity-60",children:["L",W[0],"–",W[1]]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),c("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono !bg-transparent",style:{background:"transparent"},children:c("code",{ref:q,className:m?`language-${m}`:"",children:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as $y,useRef as D,useState as i,useCallback as S}from"react";import sy from"react-dom";import{useAnnotations as ey}from"#canvas/runtime";import{useEffect as yy,useRef as fy,useState as e,useCallback as Wy,useMemo as Yy}from"react";import{createPortal as ty}from"react-dom";function Qy(y,W){let N=W||document.body,$=y.getBoundingClientRect(),J=N.getBoundingClientRect(),m=N===document.body?window.scrollY:N.scrollTop,Y=$.bottom-J.top+m+8,Q=Math.max(0,Math.min($.left-J.left,J.width-280-12));return N.style.position="relative",{style:{position:"absolute",top:`${Y}px`,left:`${Q}px`},parent:N}}import{jsxDEV as R}from"react/jsx-dev-runtime";function ny({anchorEl:y,scrollContainer:W,onClose:B,ignoreSelector:f,zIndex:N="50",padding:$="12px",width:J="280px",children:m}){let Y=fy(null),Q=fy(B);Q.current=B;let{style:K,parent:b}=Qy(y,W);return yy(()=>{let F=setTimeout(()=>{let q=(k)=>{if(Y.current&&!Y.current.contains(k.target)){if(f&&k.target.closest?.(f))return;Q.current(),document.removeEventListener("mousedown",q)}};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},0);return()=>clearTimeout(F)},[f]),ty(R("div",{ref:Y,style:{...K,zIndex:N,width:J,background:"var(--color-bg-elevated)",border:"1px solid var(--color-border-hover)",borderRadius:"8px",boxShadow:"0 4px 12px var(--color-shadow)",padding:$,fontFamily:"'Inter', sans-serif"},children:m},void 0,!1,void 0,this),b)}var Ly=[{label:"Clarity",items:["Unclear","Why?","Needs example","Missing context"]},{label:"Scope",items:["Overkill","Out of scope","Important","Risky"]},{label:"Action",items:["Simplify","Rethink","Expand on this","Skip this"]}],ky=Ly.flatMap((y)=>y.items);function by({anchorEl:y,scrollContainer:W,snippet:B,truncateAt:f=100,header:N,onAdd:$,onCancel:J}){let[m,Y]=e(""),[Q,K]=e(null),[b,F]=e(!1),q=fy(null);yy(()=>{q.current?.focus()},[]);let k=Wy(()=>{if(m.trim())$(m.trim());else J()},[m,$,J]),U=m.trim().length>0?ky.filter((L)=>L.toLowerCase().startsWith(m.trim().toLowerCase())):ky,P=b?[]:U.length===1&&U[0].toLowerCase()===m.trim().toLowerCase()?[]:U,M=new Set(P),w=Ly.map((L)=>({label:L.label,items:L.items.filter((H)=>M.has(H))})).filter((L)=>L.items.length>0),v=w.map((L)=>L.items),A=v.flat(),g=Yy(()=>{if(Q===null)return 0;let L=0;for(let H=0;H<v.length;H++){if(Q<L+v[H].length)return H;L+=v[H].length}return 0},[Q,v]),_=Yy(()=>{if(Q===null)return 0;let L=0;for(let H=0;H<g;H++)L+=v[H].length;return Q-L},[Q,g,v]),C=(L,H)=>{let Z=0;for(let O=0;O<L;O++)Z+=v[O].length;return Z+H};yy(()=>{K(null),F(!1)},[m]);let I=Wy((L)=>{Y(L)},[]),z=B.length>f?B.slice(0,f)+"...":B;return R(ny,{anchorEl:y,scrollContainer:W,onClose:J,width:"420px",children:[N??R("div",{style:{fontSize:"11px",color:"var(--color-text-tertiary)",fontStyle:"italic",marginBottom:"8px",lineHeight:"1.4",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:["“",z,"”"]},void 0,!0,void 0,this),R("textarea",{ref:q,value:m,onChange:(L)=>Y(L.target.value),onKeyDown:(L)=>{if(A.length>0&&(L.key==="ArrowDown"||L.key==="ArrowUp"||L.key==="ArrowLeft"||L.key==="ArrowRight")){if(L.preventDefault(),Q===null){K(0);return}if(L.key==="ArrowDown"){let H=Math.min(_+1,v[g].length-1);K(C(g,H))}else if(L.key==="ArrowUp"){let H=Math.max(_-1,0);K(C(g,H))}else if(L.key==="ArrowRight"){let H=Math.min(g+1,v.length-1),Z=Math.min(_,v[H].length-1);K(C(H,Z))}else if(L.key==="ArrowLeft"){let H=Math.max(g-1,0),Z=Math.min(_,v[H].length-1);K(C(H,Z))}return}if(Q!==null&&A.length>0){if(L.key==="Tab"){L.preventDefault(),I(A[Q]);return}if(L.key==="Enter"&&!L.shiftKey){L.preventDefault(),$(A[Q]);return}}if(L.key==="Enter"&&!L.shiftKey){L.preventDefault(),k();return}if(L.key==="Escape")if(A.length>0&&!b)F(!0);else J()},style:{width:"100%",minHeight:"60px",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",resize:"vertical",outline:"none"},placeholder:"Add your note..."},void 0,!1,void 0,this),R("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"8px"},children:[R("button",{onClick:J,style:{fontSize:"11px",color:"var(--color-text-tertiary)",background:"none",border:"none",cursor:"pointer",padding:"4px 12px",fontFamily:"'Inter', sans-serif"},children:"Cancel"},void 0,!1,void 0,this),R("button",{onClick:k,style:{fontSize:"11px",fontWeight:500,padding:"4px 12px",borderRadius:"6px",background:"var(--color-highlight-bg)",color:"var(--color-text-primary)",border:"1px solid var(--color-highlight-border)",cursor:"pointer",fontFamily:"'Inter', sans-serif"},children:"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A.length>0&&R("div",{style:{marginTop:"6px",borderTop:"1px solid var(--color-border-subtle)",paddingTop:"8px",display:"flex",gap:"4px"},children:w.map((L)=>R("div",{style:{flex:1},children:[R("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--color-text-disabled)",textTransform:"uppercase",letterSpacing:"0.05em",padding:"2px 6px",marginBottom:"2px",fontFamily:"'Inter', sans-serif"},children:L.label},void 0,!1,void 0,this),L.items.map((H)=>{let Z=A.indexOf(H);return R("div",{onMouseDown:(O)=>{O.preventDefault(),O.stopPropagation(),I(H)},onMouseEnter:()=>K(Z),style:{padding:"3px 6px",fontSize:"12px",borderRadius:"4px",fontFamily:"'Inter', sans-serif",color:Z===Q?"var(--color-text-primary)":"var(--color-text-secondary)",background:Z===Q?"var(--color-highlight-selected)":"transparent",cursor:"pointer"},children:[R("span",{style:{fontWeight:500},children:H.slice(0,m.trim().length)},void 0,!1,void 0,this),H.slice(m.trim().length)]},H,!0,void 0,this)})]},L.label,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as X,Fragment as Hy}from"react/jsx-dev-runtime";var d=0.2,o=0.25,l=4;function Xy({zoom:y,onZoomIn:W,onZoomOut:B,onZoomReset:f,onFullscreen:N}){return X("div",{className:"flex items-center gap-0.5 bg-bg-surface border border-border-subtle rounded-md px-1 py-0.5",style:{fontSize:"12px"},children:[X("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:B,title:"Zoom out",disabled:y<=o,children:X("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:X("line",{x1:"5",y1:"12",x2:"19",y2:"12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),X("button",{className:"px-1.5 h-7 rounded hover:bg-bg-elevated text-text-tertiary hover:text-text-primary transition-colors tabular-nums",onClick:f,title:"Reset zoom",children:[Math.round(y*100),"%"]},void 0,!0,void 0,this),X("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:W,title:"Zoom in",disabled:y>=l,children:X("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[X("line",{x1:"12",y1:"5",x2:"12",y2:"19"},void 0,!1,void 0,this),X("line",{x1:"5",y1:"12",x2:"19",y2:"12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),N&&X(Hy,{children:[X("div",{className:"w-px h-4 bg-border-subtle mx-0.5"},void 0,!1,void 0,this),X("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:N,title:"Fullscreen",children:X("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[X("polyline",{points:"15 3 21 3 21 9"},void 0,!1,void 0,this),X("polyline",{points:"9 21 3 21 3 15"},void 0,!1,void 0,this),X("line",{x1:"21",y1:"3",x2:"14",y2:"10"},void 0,!1,void 0,this),X("line",{x1:"3",y1:"21",x2:"10",y2:"14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Py(y=1){let[W,B]=i(y),f=S(()=>B((J)=>Math.min(l,+(J+d).toFixed(2))),[]),N=S(()=>B((J)=>Math.max(o,+(J-d).toFixed(2))),[]),$=S(()=>B(1),[]);return{zoom:W,zoomIn:f,zoomOut:N,zoomReset:$,setZoom:B}}function y1({svgHtml:y,source:W,onClose:B}){let f=D(null),{zoom:N,zoomIn:$,zoomOut:J,zoomReset:m,setZoom:Y}=Py(1),[Q,K]=i({x:0,y:0}),b=D(null);$y(()=>{let M=(w)=>{if(w.key==="Escape")B()};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[B]);let F=S((M)=>{M.preventDefault();let w=M.deltaY>0?-d:d;Y((v)=>Math.max(o,Math.min(l,+(v+w).toFixed(2))))},[Y]),q=S((M)=>{if(M.button!==0)return;b.current={startX:M.clientX,startY:M.clientY,panX:Q.x,panY:Q.y},M.preventDefault()},[Q]),k=S((M)=>{if(!b.current)return;K({x:b.current.panX+(M.clientX-b.current.startX),y:b.current.panY+(M.clientY-b.current.startY)})},[]),U=S(()=>{b.current=null},[]),P=S(()=>{m(),K({x:0,y:0})},[m]);return sy.createPortal(X("div",{style:{position:"fixed",inset:0,zIndex:9999,background:"var(--color-bg-base)",display:"flex",flexDirection:"column"},onMouseMove:k,onMouseUp:U,onMouseLeave:U,children:[X("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border-subtle",style:{flexShrink:0,background:"var(--color-bg-surface)"},children:[X("span",{className:"text-body text-text-secondary",style:{fontSize:"13px"},children:"Mermaid Diagram"},void 0,!1,void 0,this),X("div",{className:"flex items-center gap-2",children:[X(Xy,{zoom:N,onZoomIn:$,onZoomOut:J,onZoomReset:P},void 0,!1,void 0,this),X("button",{className:"flex items-center justify-center w-8 h-8 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:B,title:"Close (Esc)",children:X("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[X("line",{x1:"18",y1:"6",x2:"6",y2:"18"},void 0,!1,void 0,this),X("line",{x1:"6",y1:"6",x2:"18",y2:"18"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X("div",{style:{flex:1,overflow:"hidden",cursor:b.current?"grabbing":"grab"},onWheel:F,onMouseDown:q,children:X("div",{ref:f,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",transform:`translate(${Q.x}px, ${Q.y}px) scale(${N})`,transformOrigin:"center center",transition:b.current?"none":"transform 0.1s ease-out"},dangerouslySetInnerHTML:{__html:y}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),document.body)}function f1({children:y}){let W=D(null),[B,f]=i(null),[N,$]=i(!1),[J,m]=i(""),Y=typeof y==="string"?y:String(y??""),{annotations:Q,addAnnotationWithId:K,activeAnnotationId:b,setActiveAnnotationId:F}=ey(),[q,k]=i(null),{zoom:U,zoomIn:P,zoomOut:M,zoomReset:w,setZoom:v}=Py(1),A=D(Q);A.current=Q;let g=S((z,L,H)=>{let Z=`[Diagram ${H.toLowerCase()}] ${L}`,O=A.current.find((n)=>n.snippet===Z);if(O)F(O.id);else k({anchorEl:z,snippet:L,prefix:H})},[F]),_=D(g);_.current=g,$y(()=>{let z=!1,L=async()=>{try{let Z=window.mermaid;if(!Z){f("Mermaid library not loaded");return}let O=document.documentElement.dataset.theme==="light"?"default":"dark";Z.initialize({startOnLoad:!1,theme:O});let n=`mermaid-${Math.random().toString(36).slice(2)}`,{svg:By}=await Z.render(n,Y.trim());if(!z&&W.current)W.current.innerHTML=By,m(By),$1(W.current,(Zy,wy,zy)=>_.current(Zy,wy,zy)),Ky(W.current,A.current);f(null)}catch(Z){if(!z)f(Z.message||"Invalid diagram")}};L();let H=new MutationObserver((Z)=>{for(let O of Z)if(O.attributeName==="data-theme")L()});return H.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{z=!0,H.disconnect()}},[Y]),$y(()=>{if(W.current)Ky(W.current,Q,b)},[Q,b]);let C=S((z)=>{if(!z.ctrlKey&&!z.metaKey)return;z.preventDefault();let L=z.deltaY>0?-d:d;v((H)=>Math.max(o,Math.min(l,+(H+L).toFixed(2))))},[v]);if(B)return X("div",{className:"bg-accent-red-muted rounded-md p-4 mt-3 text-body text-accent-red",children:["Mermaid error: ",B,X("pre",{className:"mt-2 text-tiny text-text-tertiary whitespace-pre-wrap",children:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let I=W.current?.closest("#plan-scroll-container");return X(Hy,{children:[X("div",{className:"mt-3 mermaid-container","data-md":"mermaid","data-md-source":Y.trim(),children:[X("div",{className:"flex justify-end mb-1",children:X(Xy,{zoom:U,onZoomIn:P,onZoomOut:M,onZoomReset:w,onFullscreen:()=>$(!0)},void 0,!1,void 0,this)},void 0,!1,void 0,this),X("div",{style:{overflow:"auto",maxHeight:"70vh"},onWheel:C,children:X("div",{ref:W,className:"flex justify-center",style:{transform:`scale(${U})`,transformOrigin:"top center",transition:"transform 0.1s ease-out",minHeight:U<1?void 0:void 0}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q&&X(by,{anchorEl:q.anchorEl,scrollContainer:I,snippet:q.snippet,header:X("div",{style:{fontSize:"12px",color:"var(--color-text-tertiary)",marginBottom:"8px",lineHeight:"1.4",display:"flex",alignItems:"center",gap:"6px"},children:[X("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--color-accent-amber)",flexShrink:0}},void 0,!1,void 0,this),q.snippet]},void 0,!0,void 0,this),onAdd:(z)=>{let L=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;K(L,`[Diagram ${q.prefix.toLowerCase()}] ${q.snippet}`,z),k(null)},onCancel:()=>k(null)},void 0,!1,void 0,this),N&&J&&X(y1,{svgHtml:J,source:Y,onClose:()=>$(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function $1(y,W){let B=(f,N,$)=>{f.style.cursor="pointer",f.addEventListener("mouseenter",()=>{f.style.filter="brightness(1.2)"}),f.addEventListener("mouseleave",()=>{f.style.filter=""}),f.addEventListener("click",(J)=>{J.stopPropagation(),J.preventDefault(),W(f,N(),$)})};for(let f of y.querySelectorAll(".node"))B(f,()=>{return(f.querySelector(".nodeLabel")||f.querySelector("foreignObject span")||f.querySelector("text"))?.textContent?.trim()||"Node"},"Node");for(let f of y.querySelectorAll(".edgePath")){let N=f,$=N.querySelector("path");if($){$.style.strokeWidth=Math.max(parseFloat($.style.strokeWidth||"1"),8)+"px",$.style.strokeOpacity="0";let m=$.cloneNode(!0);m.style.strokeWidth="",m.style.strokeOpacity="",N.insertBefore(m,$)}let J=N.id||"";B(N,()=>{let m=y.querySelectorAll(".edgeLabel");for(let Y of m)if(Y.id&&J&&Y.id.replace("label","").includes(J.replace("L-","").replace("edge",""))){let Q=Y.textContent?.trim();if(Q)return Q}return"Connection"},"Edge")}for(let f of y.querySelectorAll(".edgeLabel")){let N=f.textContent?.trim();if(!N)continue;B(f,()=>N,"Edge")}for(let f of y.querySelectorAll(".actor")){let N=f.closest("g")?.querySelector("text")||f.parentElement?.querySelector("text");if(!N)continue;let $=f.closest("g");if(!$||$.hasAttribute("data-clickable"))continue;$.setAttribute("data-clickable","true"),B($,()=>N.textContent?.trim()||"Participant","Node")}for(let f of y.querySelectorAll(".messageText")){let N=f.textContent?.trim();if(!N)continue;B(f,()=>N,"Edge")}for(let f of y.querySelectorAll(".entityBox")){let N=f.closest("g");if(!N||N.hasAttribute("data-clickable"))continue;let $=N.querySelector(".entityLabel");if(!$)continue;N.setAttribute("data-clickable","true"),B(N,()=>$.textContent?.trim()||"Entity","Node")}for(let f of y.querySelectorAll(".relationshipLabel")){let N=f.textContent?.trim();if(!N)continue;let J=f.closest("g")||f;if(J.hasAttribute("data-clickable"))continue;J.setAttribute("data-clickable","true"),B(J,()=>N,"Edge")}for(let f of y.querySelectorAll(".classGroup")){let N=f;if(N.hasAttribute("data-clickable"))continue;let $=N.querySelector(".classTitle, .classTitleText, text");if(!$)continue;N.setAttribute("data-clickable","true"),B(N,()=>$.textContent?.trim()||"Class","Node")}for(let f of y.querySelectorAll(".statediagram-state")){let N=f;if(N.hasAttribute("data-clickable"))continue;let $=N.querySelector(".state-title, text");if(!$)continue;N.setAttribute("data-clickable","true"),B(N,()=>$.textContent?.trim()||"State","Node")}for(let f of y.querySelectorAll(".mindmap-node")){let N=f;if(N.hasAttribute("data-clickable"))continue;let $=N.querySelector(".mindmap-node-label, text");if(!$)continue;N.setAttribute("data-clickable","true"),B(N,()=>$.textContent?.trim()||"Node","Node")}}function Ky(y,W,B){let f=new Map;for(let $ of W){let J=$.snippet.match(/^\[Diagram (?:node|edge)\] (.+)$/);if(J)f.set(J[1],$.id)}for(let $ of y.querySelectorAll("[data-annotated]"))$.style.outline="",$.style.outlineOffset="",$.style.borderRadius="",$.removeAttribute("data-annotated");if(f.size===0)return;for(let $ of y.querySelectorAll(".node")){let m=($.querySelector(".nodeLabel")||$.querySelector("foreignObject span")||$.querySelector("text"))?.textContent?.trim();if(!m||!f.has(m))continue;let Y=f.get(m),Q=$;Q.setAttribute("data-annotated",Y);let K=Y===B;Q.style.outline=K?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",Q.style.outlineOffset="2px",Q.style.borderRadius="4px"}for(let $ of y.querySelectorAll(".edgeLabel")){let J=$.textContent?.trim();if(!J||!f.has(J))continue;let m=f.get(J),Y=$;Y.setAttribute("data-annotated",m);let Q=m===B;Y.style.outline=Q?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",Y.style.outlineOffset="2px",Y.style.borderRadius="4px"}for(let $ of y.querySelectorAll(".actor")){let J=$.closest("g");if(!J)continue;let Y=J.querySelector("text")?.textContent?.trim();if(!Y||!f.has(Y))continue;if(J.hasAttribute("data-annotated"))continue;let Q=f.get(Y);J.setAttribute("data-annotated",Q);let K=Q===B,b=J.querySelector("rect");if(b)b.style.outline=K?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",b.style.outlineOffset="2px",b.style.borderRadius="4px"}for(let $ of y.querySelectorAll(".messageText")){let J=$.textContent?.trim();if(!J||!f.has(J))continue;let m=f.get(J),Y=$;Y.setAttribute("data-annotated",m);let Q=m===B;Y.style.outline=Q?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",Y.style.outlineOffset="2px",Y.style.borderRadius="4px"}let N=($,J,m)=>{for(let Y of y.querySelectorAll($)){let Q=m(Y);if(!Q||Q.hasAttribute("data-annotated"))continue;let b=Q.querySelector(J)?.textContent?.trim();if(!b||!f.has(b))continue;let F=f.get(b);Q.setAttribute("data-annotated",F);let q=F===B,k=Q.querySelector("rect, circle, ellipse, polygon")||Q;k.style.outline=q?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",k.style.outlineOffset="2px",k.style.borderRadius="4px"}};N(".entityBox",".entityLabel",($)=>$.closest("g"));for(let $ of y.querySelectorAll(".relationshipLabel")){let m=$.closest("g")||$;if(m.hasAttribute("data-annotated"))continue;let Y=$.textContent?.trim();if(!Y||!f.has(Y))continue;let Q=f.get(Y);m.setAttribute("data-annotated",Q);let K=Q===B;m.style.outline=K?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",m.style.outlineOffset="2px",m.style.borderRadius="4px"}N(".classGroup",".classTitle, .classTitleText, text",($)=>$),N(".statediagram-state",".state-title, text",($)=>$),N(".mindmap-node",".mindmap-node-label, text",($)=>$)}import{jsxDEV as j}from"react/jsx-dev-runtime";function B1({before:y,after:W,language:B}){let f=y.split(`
|
|
4
|
-
`)
|
|
5
|
-
`),$=N1(f,N),J=[],m=0,Y=0,Q=0;while(m<f.length||Y<N.length)if(Q<$.length&&m<f.length&&Y<N.length&&f[m]===$[Q]&&N[Y]===$[Q])J.push({type:"same",line:f[m]}),m++,Y++,Q++;else if(m<f.length&&(Q>=$.length||f[m]!==$[Q]))J.push({type:"removed",line:f[m]}),m++;else if(Y<N.length)J.push({type:"added",line:N[Y]}),Y++;return j("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden group/diff","data-md":"diff","data-md-language":B||"",children:[B&&j("div",{className:"px-4 py-2 text-meta font-mono text-text-tertiary opacity-0 group-hover/diff:opacity-60 transition-opacity",children:["diff (",B,")"]},void 0,!0,void 0,this),j("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono",children:J.map((K,b)=>j("div",{className:K.type==="removed"?"bg-accent-red-muted text-accent-red":K.type==="added"?"bg-accent-green-muted text-accent-green":"text-text-tertiary",children:[j("span",{className:"select-none w-6 inline-block text-center opacity-60",children:K.type==="removed"?"-":K.type==="added"?"+":" "},void 0,!1,void 0,this),K.line]},b,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function N1(y,W){let B=y.length,f=W.length,N=Array.from({length:B+1},()=>Array(f+1).fill(0));for(let Y=1;Y<=B;Y++)for(let Q=1;Q<=f;Q++)N[Y][Q]=y[Y-1]===W[Q-1]?N[Y-1][Q-1]+1:Math.max(N[Y-1][Q],N[Y][Q-1]);let $=[],J=B,m=f;while(J>0&&m>0)if(y[J-1]===W[m-1])$.unshift(y[J-1]),J--,m--;else if(N[J-1][m]>N[J][m-1])J--;else m--;return $}import{useEffect as t,useRef as qy,useState as Ty}from"react";import{useAnnotations as Fy}from"#canvas/runtime";import{jsxDEV as Uy}from"react/jsx-dev-runtime";function x({note:y,onChange:W}){return Uy("div",{className:"mt-1.5",children:Uy("textarea",{value:y,onChange:(B)=>W(B.target.value),className:"w-full bg-transparent text-[12px] font-body text-text-primary resize-none focus:outline-none border-none placeholder:text-text-disabled transition-colors min-h-[20px] p-0 leading-relaxed",placeholder:"Add a note...",rows:1,onInput:(B)=>{let f=B.target;f.style.height="auto",f.style.height=f.scrollHeight+"px"},ref:(B)=>{if(B)B.style.height="auto",B.style.height=B.scrollHeight+"px"}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as G}from"react/jsx-dev-runtime";function m1({id:y,label:W,options:B,required:f}){let{responses:N,setResponse:$}=Fy(),J=N.get(y),m=J?.value,Y=J?.note||"",[Q,K]=Ty(!1),b=qy(null);t(()=>{if(!N.has(y))$(y,{id:y,type:"radio",label:W,value:null,options:B,required:f})},[y]);let F=(k)=>{$(y,{...J,value:k})};t(()=>{let k=b.current;if(!k)return;let U=(P)=>{let w=P.target.closest("[data-md-label]")?.getAttribute("data-md-label");if(w&&B.includes(w))F(w)};return k.addEventListener("kb-select",U),()=>k.removeEventListener("kb-select",U)});let q=J?.required&&!m;return G("div",{ref:b,"data-md":"choice","data-md-label":W,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[G("div",{className:"flex items-baseline gap-2 mb-2",children:[G("span",{className:"text-[13px] font-body font-medium text-text-primary",children:W},void 0,!1,void 0,this),f&&G("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:"space-y-1",children:B.map((k)=>G("label",{"data-md":"choice-option","data-md-label":k,onClick:()=>F(k),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${m===k?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[G("span",{className:`w-4 h-4 rounded-full border-[1.5px] flex items-center justify-center flex-shrink-0 transition-all ${m===k?"border-accent-amber bg-accent-amber":"border-border-strong"}`,children:m===k&&G("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{className:"text-[13px] font-body text-text-secondary",children:k},void 0,!1,void 0,this)]},k,!0,void 0,this))},void 0,!1,void 0,this),G(x,{show:Q,note:Y,onToggle:()=>K(!Q),onChange:(k)=>$(y,{...J,note:k})},void 0,!1,void 0,this),q&&G("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select an option."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function J1({id:y,label:W,options:B,required:f}){let{responses:N,setResponse:$}=Fy(),J=N.get(y),m=J?.value||[],Y=J?.note||"",[Q,K]=Ty(!1),b=qy(null);t(()=>{if(!N.has(y))$(y,{id:y,type:"checkbox",label:W,value:[],options:B,required:f})},[y]);let F=(k)=>{let U=m.includes(k)?m.filter((P)=>P!==k):[...m,k];$(y,{...J,value:U})};t(()=>{let k=b.current;if(!k)return;let U=(P)=>{let w=P.target.closest("[data-md-label]")?.getAttribute("data-md-label");if(w&&B.includes(w))F(w)};return k.addEventListener("kb-select",U),()=>k.removeEventListener("kb-select",U)});let q=J?.required&&m.length===0;return G("div",{ref:b,"data-md":"multichoice","data-md-label":W,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[G("div",{className:"flex items-baseline gap-2 mb-2",children:[G("span",{className:"text-[13px] font-body font-medium text-text-primary",children:W},void 0,!1,void 0,this),f&&G("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{className:"space-y-1",children:B.map((k)=>{let U=m.includes(k);return G("label",{"data-md":"multichoice-option","data-md-label":k,onClick:()=>F(k),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${U?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[G("span",{className:`w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all ${U?"bg-accent-amber":"border-[1.5px] border-border-strong"}`,children:U&&G("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:G("path",{d:"M2.5 5L4.5 7L7.5 3",style:{stroke:"var(--color-text-inverse)"},strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{className:"text-[13px] font-body text-text-secondary",children:k},void 0,!1,void 0,this)]},k,!0,void 0,this)})},void 0,!1,void 0,this),G(x,{show:Q,note:Y,onToggle:()=>K(!Q),onChange:(k)=>$(y,{...J,note:k})},void 0,!1,void 0,this),q&&G("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select at least one option."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as Gy,useRef as Q1,useState as My}from"react";import{useAnnotations as vy}from"#canvas/runtime";import{jsxDEV as T}from"react/jsx-dev-runtime";function W1({id:y,label:W,placeholder:B,multiline:f,required:N}){let{responses:$,setResponse:J}=vy(),m=$.get(y),Y=m?.value??"",Q=m?.note||"",[K,b]=My(!1),F=Q1(null);Gy(()=>{if(!$.has(y))J(y,{id:y,type:"text",label:W,value:"",required:N})},[y]);let q=(P)=>{J(y,{...m,value:P})},k=(P)=>{P.style.height="auto",P.style.height=Math.max(f?60:32,P.scrollHeight)+"px"},U=m?.required&&!Y.trim();return T("div",{"data-md":"userinput","data-md-label":W,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[T("div",{className:"flex items-baseline gap-2 mb-2",children:[T("span",{className:"text-[13px] font-body font-medium text-text-primary",children:W},void 0,!1,void 0,this),N&&T("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T("textarea",{ref:F,value:Y,onChange:(P)=>{q(P.target.value),k(P.target)},placeholder:B||"Type your response...",rows:f?3:1,className:"w-full bg-bg-input text-[13px] font-body text-text-primary rounded-lg px-3 py-2 resize-none focus:outline-none border border-border-subtle focus:border-border-hover placeholder:text-text-tertiary transition-colors",onInput:(P)=>k(P.target),onFocus:(P)=>k(P.target)},void 0,!1,void 0,this),T(x,{show:K,note:Q,onToggle:()=>b(!K),onChange:(P)=>J(y,{...m,note:P})},void 0,!1,void 0,this),U&&T("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"This field is required."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Y1({id:y,label:W,min:B=1,max:f=10,step:N=1,required:$,minLabel:J,maxLabel:m}){let{responses:Y,setResponse:Q}=vy(),K=Y.get(y),b=K?.value,F=K?.note||"",[q,k]=My(!1);Gy(()=>{if(!Y.has(y))Q(y,{id:y,type:"range",label:W,value:null,required:$})},[y]);let U=(_)=>{Q(y,{...K,value:_})},P=b!==null&&b!==void 0,M=P?b:Math.round((B+f)/2),w=(M-B)/(f-B)*100,v=Math.round((f-B)/N),A=v<=20,g=K?.required&&!P;return T("div",{"data-md":"rangeinput","data-md-label":W,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[T("div",{className:"flex items-baseline justify-between mb-1",children:[T("div",{className:"flex items-baseline gap-2",children:[T("span",{className:"text-[13px] font-body font-medium text-text-primary",children:W},void 0,!1,void 0,this),$&&T("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T("span",{className:"flex items-center gap-1.5",children:[T("span",{className:`text-[13px] font-mono ${P?"text-accent-amber":"text-text-disabled"}`,children:P?b:"—"},void 0,!1,void 0,this),P&&T("button",{onClick:()=>Q(y,{...K,value:null}),className:"text-text-disabled hover:text-text-tertiary transition-colors text-[10px] leading-none",title:"Clear",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T("div",{className:"relative h-6 flex items-center",children:[T("div",{className:"absolute left-0 right-0 h-1.5 rounded-full bg-border-medium",children:P&&T("div",{className:"h-full rounded-full bg-accent-amber transition-all duration-150",style:{width:`${w}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),A&&Array.from({length:v+1},(_,C)=>{let I=B+C*N,z=(I-B)/(f-B)*100,L=P&&I<=b;return T("div",{className:`absolute rounded-full pointer-events-none transition-all duration-150 ${P&&I===b?"w-2.5 h-2.5 bg-accent-amber":L?"w-1.5 h-1.5 bg-accent-amber":"w-1.5 h-1.5 bg-border-hover"}`,style:{left:`${z}%`,transform:"translate(-50%, -50%)",top:"50%"}},C,!1,void 0,this)}),P?T("div",{className:"absolute h-5 w-5 rounded-full bg-accent-amber shadow-md pointer-events-none transition-all duration-150",style:{left:`calc(${w}% - 10px)`,borderWidth:"2px",borderStyle:"solid",borderColor:"var(--color-bg-base)"}},void 0,!1,void 0,this):T("div",{className:"absolute h-4 w-4 rounded-full bg-border-hover pointer-events-none opacity-50",style:{left:"calc(50% - 8px)",borderWidth:"2px",borderStyle:"solid",borderColor:"var(--color-bg-base)"}},void 0,!1,void 0,this),T("input",{type:"range",min:B,max:f,step:N,value:M,onChange:(_)=>U(Number(_.target.value)),className:"absolute inset-0 w-full opacity-0 cursor-pointer"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A&&v<=10?T("div",{className:"flex justify-between -mt-0.5 px-0",children:Array.from({length:v+1},(_,C)=>{let I=B+C*N;return T("span",{className:`text-[10px] font-mono transition-colors ${P&&I===b?"text-accent-amber font-medium":"text-text-disabled"}`,style:{minWidth:"1ch",textAlign:"center"},children:I},C,!1,void 0,this)})},void 0,!1,void 0,this):T("div",{className:"flex justify-between -mt-0.5",children:[T("span",{className:"text-[11px] text-text-tertiary font-body",children:J||B},void 0,!1,void 0,this),T("span",{className:"text-[11px] text-text-tertiary font-body",children:m||f},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T(x,{show:q,note:F,onToggle:()=>k(!q),onChange:(_)=>Q(y,{...K,note:_})},void 0,!1,void 0,this),g&&T("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select a value."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useContext as k1,useState as L1}from"react";import{SessionContext as b1}from"#canvas/runtime";import{jsxDEV as V}from"react/jsx-dev-runtime";function K1({src:y,alt:W,caption:B,width:f,height:N}){let $=k1(b1),[J,m]=L1(!1),Y=`/api/image?session=${encodeURIComponent($)}&path=${encodeURIComponent(y)}`;if(J)return V("div",{className:"mt-3 text-accent-red text-body bg-accent-red-muted rounded-md p-4",children:[y,": Failed to load image"]},void 0,!0,void 0,this);return V("figure",{className:"mt-3 relative","data-md":"image","data-md-src":y,children:[V("div",{className:"rounded-md overflow-hidden border border-border-subtle bg-bg-code inline-block",children:V("img",{src:Y,alt:W||y,onError:()=>m(!0),className:"block max-w-full h-auto",...f?{width:f}:{},...N?{height:N}:{}},void 0,!1,void 0,this)},void 0,!1,void 0,this),B&&V("figcaption",{className:"mt-1.5 text-meta text-text-tertiary font-body",children:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useFeedback as c0}from"#canvas/runtime";export{c0 as useFeedback,W1 as UserInput,Ry as Task,iy as Table,Ay as Section,Y1 as RangeInput,Dy as Priority,uy as Note,J1 as MultiChoice,f1 as Mermaid,Ny as Item,K1 as ImageView,ly as FilePreview,B1 as Diff,Sy as CodeBlock,m1 as Choice,dy as Checklist,cy as Callout};
|
|
1
|
+
import{useState as v1}from"react";import{jsxDEV as u}from"react/jsx-dev-runtime";function Z1({title:B,children:y}){let[N,J]=v1(!1);return u("div",{className:"relative mb-8 p-4 group/section","data-md":"section","data-md-title":B,children:[u("div",{className:"relative mb-2",children:[u("button",{onClick:()=>J(!N),className:`absolute -left-8 top-1/2 -translate-y-1/2 text-text-tertiary opacity-0 group-hover/section:opacity-50 hover:!opacity-100 transition-all duration-150 p-0.5 ${N?"-rotate-90":""}`,children:u("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:u("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),u("h2",{className:"font-heading text-section text-text-primary",style:{fontWeight:400},children:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u("div",{className:N?"mt-6 hidden":"mt-6",children:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as c}from"react/jsx-dev-runtime";var w1={todo:"bg-border-hover",done:"bg-accent-green",blocked:"bg-accent-red","in-progress":"bg-accent-blue"},k1={todo:"Todo",done:"Done",blocked:"Blocked","in-progress":"In progress"},A1={info:"bg-accent-blue-muted text-accent-blue",success:"bg-accent-green-muted text-accent-green",warning:"bg-accent-amber-muted text-accent-amber",danger:"bg-accent-red-muted text-accent-red",neutral:"bg-border-subtle text-text-tertiary"};function gy({id:B,label:y,status:N,badge:J,badgeVariant:$="neutral",children:Q}){return c("div",{className:"group/task relative -mx-4 px-4 py-3 rounded-md transition-colors duration-150 hover:bg-bg-input","data-task-id":B,"data-md":"item","data-md-label":y,...N?{"data-md-status":N}:{},...J?{"data-md-badge":J}:{},children:c("div",{className:"flex items-start gap-3",children:[N&&c("span",{className:`w-2 h-2 rounded-full mt-[7px] flex-shrink-0 ${w1[N]}`},void 0,!1,void 0,this),c("div",{className:"flex-1 min-w-0",children:[c("div",{className:"flex items-baseline gap-2",children:[c("span",{className:"font-body text-task-label font-semibold text-text-primary",children:y},void 0,!1,void 0,this),N&&c("span",{className:"font-body text-tiny uppercase tracking-wider text-text-tertiary opacity-0 group-hover/task:opacity-100 transition-opacity duration-150",children:k1[N]},void 0,!1,void 0,this),J&&c("span",{className:`font-body text-tiny font-medium px-1.5 py-px rounded-full ${A1[$]}`,children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q&&c("div",{className:"text-body text-text-secondary mt-1 leading-relaxed",children:Q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function z1(B){return c(gy,{...B},void 0,!1,void 0,this)}import{useEffect as _1,useRef as O1}from"react";import{jsxDEV as Yy}from"react/jsx-dev-runtime";function C1({language:B,children:y}){let N=typeof y==="string"?y:String(y??""),J=O1(null);return _1(()=>{let $=J.current,Q=window.hljs;if(!$||!Q)return;$.removeAttribute("data-highlighted"),$.className=B?`language-${B}`:"",$.textContent=N,Q.highlightElement($)},[N,B]),Yy("div",{className:"relative mt-3 group/code","data-md":"codeblock","data-md-language":B||"",children:[B&&Yy("span",{className:"absolute top-2 right-3 text-tiny text-text-tertiary opacity-0 group-hover/code:opacity-60 transition-opacity duration-150 z-10 font-mono",children:B},void 0,!1,void 0,this),Yy("pre",{className:"bg-bg-code rounded-md p-4 overflow-x-auto text-code font-mono leading-relaxed",children:Yy("code",{ref:J,className:B?`language-${B}`:"",children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Gy}from"react/jsx-dev-runtime";var I1={info:{bg:"bg-accent-blue-muted",icon:"i",iconColor:"text-accent-blue"},warning:{bg:"bg-accent-amber-muted",icon:"!",iconColor:"text-accent-amber"},danger:{bg:"bg-accent-red-muted",icon:"✕",iconColor:"text-accent-red"},tip:{bg:"bg-accent-green-muted",icon:"✓",iconColor:"text-accent-green"}};function R1({type:B="info",children:y}){let N=I1[B];return Gy("div",{className:`${N.bg} relative rounded-lg px-5 py-4 mt-3 flex gap-3 items-start`,"data-md":"callout","data-md-type":B,children:[Gy("span",{className:`${N.iconColor} opacity-70 text-base leading-relaxed flex-shrink-0 mt-px`,children:N.icon},void 0,!1,void 0,this),Gy("div",{className:"text-body text-text-secondary leading-relaxed",children:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as g1}from"react/jsx-dev-runtime";function S1({children:B}){return g1("div",{className:"relative bg-bg-elevated rounded-lg px-5 py-4 mt-3 text-body text-text-secondary italic leading-relaxed","data-md":"note",children:B},void 0,!1,void 0,this)}import{jsxDEV as p}from"react/jsx-dev-runtime";function h1({headers:B,rows:y}){return p("div",{className:"overflow-x-auto mt-3","data-md":"table",children:p("table",{className:"w-full text-body",children:[p("thead",{children:p("tr",{className:"border-b border-border-subtle",children:B.map((N,J)=>p("th",{className:"text-left px-4 py-2.5 text-meta font-medium uppercase tracking-wider text-text-tertiary font-body",children:N},J,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),p("tbody",{children:y.map((N,J)=>p("tr",{className:`relative border-b border-border-subtle last:border-b-0 transition-colors hover:bg-bg-surface/50 ${J%2===1?"bg-bg-surface/30":""}`,children:N.map(($,Q)=>p("td",{className:"px-4 py-2.5 text-text-secondary font-body",children:$},Q,!1,void 0,this))},J,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as l}from"react/jsx-dev-runtime";function D1({items:B}){return l("ul",{className:"space-y-1 mt-3","data-md":"checklist",children:B.map((y,N)=>l("li",{"data-md":"checklist-item","data-md-label":y.label,className:"relative flex items-start gap-2.5 py-1",children:[l("span",{className:`w-4 h-4 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 transition-all ${y.checked?"bg-accent-green":"border-[1.5px] border-border-hover"}`,children:y.checked&&l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:l("path",{d:"M2.5 5L4.5 7L7.5 3",style:{stroke:"var(--color-text-inverse)"},strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),l("span",{className:`text-body font-body ${y.checked?"text-text-tertiary line-through decoration-border-hover":"text-text-secondary"}`,children:y.label},void 0,!1,void 0,this)]},N,!0,void 0,this))},void 0,!1,void 0,this)}import{jsxDEV as c1}from"react/jsx-dev-runtime";var j1={high:"text-accent-red bg-accent-red-muted",medium:"text-accent-amber bg-accent-amber-muted",low:"text-text-tertiary bg-border-subtle"};function V1({level:B}){return c1("span",{className:`inline text-tiny font-medium font-body ml-2 px-1.5 py-0.5 rounded ${j1[B]}`,"data-md":"priority","data-md-level":B,children:B},void 0,!1,void 0,this)}import{useEffect as hy,useState as Wy,useContext as Dy,useRef as x1}from"react";import{SessionContext as d1,ActiveViewCtx as p1}from"#canvas/runtime";import{jsxDEV as E}from"react/jsx-dev-runtime";var E1={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",py:"python",rs:"rust",go:"go",rb:"ruby",java:"java",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",css:"css",html:"html",sh:"bash",bash:"bash",toml:"toml",sql:"sql",xml:"xml",c:"c",cpp:"cpp",h:"c"};function u1({path:B,lines:y,__content:N}){let J=Dy(d1),{setActiveView:$}=Dy(p1),[Q,Y]=Wy(N??null),[f,W]=Wy(()=>{let L=B.split(".").pop()||"";return E1[L]||"text"}),[K,X]=Wy(null),[b,P]=Wy(!N),U=x1(null);if(hy(()=>{if(N!==void 0)return;P(!0),X(null),fetch(`/api/file?session=${J}&path=${encodeURIComponent(B)}`).then((L)=>L.json()).then((L)=>{if(L.error)X(L.error);else{let q=L.content;if(y)q=q.split(`
|
|
2
|
+
`).slice(y[0]-1,y[1]).join(`
|
|
3
|
+
`);Y(q),W(L.language||"text")}}).catch(()=>X("Failed to fetch file")).finally(()=>P(!1))},[J,B,y?.[0],y?.[1],N]),hy(()=>{let L=U.current,q=window.hljs;if(!L||!q||!Q)return;L.removeAttribute("data-highlighted"),L.className=f?`language-${f}`:"",L.textContent=Q,q.highlightElement(L)},[Q,f]),b)return E("div",{className:"text-text-tertiary text-body mt-3 bg-bg-code rounded-md p-4",children:["Loading ",B,"..."]},void 0,!0,void 0,this);if(K)return E("div",{className:"text-accent-red text-body mt-3 bg-accent-red-muted rounded-md p-4",children:[B,": ",K]},void 0,!0,void 0,this);return E("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden","data-md":"filepreview","data-md-path":B,...y?{"data-md-lines":`${y[0]}-${y[1]}`}:{},children:[E("div",{className:"px-4 py-2 flex items-center justify-between",children:[E("button",{className:"font-mono text-meta text-text-tertiary hover:text-text-secondary hover:underline cursor-pointer text-left",onClick:()=>$({type:"file",path:B}),title:`Open ${B}`,children:B},void 0,!1,void 0,this),y&&E("span",{className:"font-mono text-meta text-text-tertiary opacity-60",children:["L",y[0],"–",y[1]]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),E("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono !bg-transparent",style:{background:"transparent"},children:E("code",{ref:U,className:f?`language-${f}`:"",children:Q},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as vy,useRef as t,useState as o,useCallback as x}from"react";import a1 from"react-dom";import{useAnnotations as l1}from"#canvas/runtime";import{useEffect as my,useRef as My,useState as Ty,useCallback as Vy,useMemo as cy}from"react";import{createPortal as r1}from"react-dom";function jy(B,y){let $=y||document.body,Q=B.getBoundingClientRect(),Y=$.getBoundingClientRect(),f=$===document.body?window.scrollY:$.scrollTop,W=Q.bottom-Y.top+f+8,K=Math.max(0,Math.min(Q.left-Y.left,Y.width-280-12));return $.style.position="relative",{style:{position:"absolute",top:`${W}px`,left:`${K}px`},parent:$}}import{jsxDEV as h}from"react/jsx-dev-runtime";function i1({anchorEl:B,scrollContainer:y,onClose:N,ignoreSelector:J,zIndex:$="50",padding:Q="12px",width:Y="280px",children:f}){let W=My(null),K=My(N);K.current=N;let{style:X,parent:b}=jy(B,y);return my(()=>{let P=setTimeout(()=>{let U=(L)=>{if(W.current&&!W.current.contains(L.target)){if(J&&L.target.closest?.(J))return;K.current(),document.removeEventListener("mousedown",U)}};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},0);return()=>clearTimeout(P)},[J]),r1(h("div",{ref:W,style:{...X,zIndex:$,width:Y,background:"var(--color-bg-elevated)",border:"1px solid var(--color-border-hover)",borderRadius:"8px",boxShadow:"0 4px 12px var(--color-shadow)",padding:Q,fontFamily:"'Inter', sans-serif"},children:f},void 0,!1,void 0,this),b)}var dy=[{label:"Clarity",items:["Unclear","Why?","Needs example","Missing context"]},{label:"Scope",items:["Overkill","Out of scope","Important","Risky"]},{label:"Action",items:["Simplify","Rethink","Expand on this","Skip this"]}],xy=dy.flatMap((B)=>B.items);function py({anchorEl:B,scrollContainer:y,snippet:N,truncateAt:J=100,header:$,onAdd:Q,onCancel:Y}){let[f,W]=Ty(""),[K,X]=Ty(null),[b,P]=Ty(!1),U=My(null);my(()=>{U.current?.focus()},[]);let L=Vy(()=>{if(f.trim())Q(f.trim());else Y()},[f,Q,Y]),q=f.trim().length>0?xy.filter((H)=>H.toLowerCase().startsWith(f.trim().toLowerCase())):xy,G=b?[]:q.length===1&&q[0].toLowerCase()===f.trim().toLowerCase()?[]:q,Z=new Set(G),A=dy.map((H)=>({label:H.label,items:H.items.filter((T)=>Z.has(T))})).filter((H)=>H.items.length>0),w=A.map((H)=>H.items),C=w.flat(),I=cy(()=>{if(K===null)return 0;let H=0;for(let T=0;T<w.length;T++){if(K<H+w[T].length)return T;H+=w[T].length}return 0},[K,w]),z=cy(()=>{if(K===null)return 0;let H=0;for(let T=0;T<I;T++)H+=w[T].length;return K-H},[K,I,w]),g=(H,T)=>{let _=0;for(let S=0;S<H;S++)_+=w[S].length;return _+T};my(()=>{X(null),P(!1)},[f]);let D=Vy((H)=>{W(H)},[]),O=N.length>J?N.slice(0,J)+"...":N;return h(i1,{anchorEl:B,scrollContainer:y,onClose:Y,width:"420px",children:[$??h("div",{style:{fontSize:"11px",color:"var(--color-text-tertiary)",fontStyle:"italic",marginBottom:"8px",lineHeight:"1.4",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:["“",O,"”"]},void 0,!0,void 0,this),h("textarea",{ref:U,value:f,onChange:(H)=>W(H.target.value),onKeyDown:(H)=>{if(C.length>0&&(H.key==="ArrowDown"||H.key==="ArrowUp"||H.key==="ArrowLeft"||H.key==="ArrowRight")){if(H.preventDefault(),K===null){X(0);return}if(H.key==="ArrowDown"){let T=Math.min(z+1,w[I].length-1);X(g(I,T))}else if(H.key==="ArrowUp"){let T=Math.max(z-1,0);X(g(I,T))}else if(H.key==="ArrowRight"){let T=Math.min(I+1,w.length-1),_=Math.min(z,w[T].length-1);X(g(T,_))}else if(H.key==="ArrowLeft"){let T=Math.max(I-1,0),_=Math.min(z,w[T].length-1);X(g(T,_))}return}if(K!==null&&C.length>0){if(H.key==="Tab"){H.preventDefault(),D(C[K]);return}if(H.key==="Enter"&&!H.shiftKey){H.preventDefault(),Q(C[K]);return}}if(H.key==="Enter"&&!H.shiftKey){H.preventDefault(),L();return}if(H.key==="Escape")if(C.length>0&&!b)P(!0);else Y()},style:{width:"100%",minHeight:"60px",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",resize:"vertical",outline:"none"},placeholder:"Add your note..."},void 0,!1,void 0,this),h("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"8px"},children:[h("button",{onClick:Y,style:{fontSize:"11px",color:"var(--color-text-tertiary)",background:"none",border:"none",cursor:"pointer",padding:"4px 12px",fontFamily:"'Inter', sans-serif"},children:"Cancel"},void 0,!1,void 0,this),h("button",{onClick:L,style:{fontSize:"11px",fontWeight:500,padding:"4px 12px",borderRadius:"6px",background:"var(--color-highlight-bg)",color:"var(--color-text-primary)",border:"1px solid var(--color-highlight-border)",cursor:"pointer",fontFamily:"'Inter', sans-serif"},children:"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C.length>0&&h("div",{style:{marginTop:"6px",borderTop:"1px solid var(--color-border-subtle)",paddingTop:"8px",display:"flex",gap:"4px"},children:A.map((H)=>h("div",{style:{flex:1},children:[h("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--color-text-disabled)",textTransform:"uppercase",letterSpacing:"0.05em",padding:"2px 6px",marginBottom:"2px",fontFamily:"'Inter', sans-serif"},children:H.label},void 0,!1,void 0,this),H.items.map((T)=>{let _=C.indexOf(T);return h("div",{onMouseDown:(S)=>{S.preventDefault(),S.stopPropagation(),D(T)},onMouseEnter:()=>X(_),style:{padding:"3px 6px",fontSize:"12px",borderRadius:"4px",fontFamily:"'Inter', sans-serif",color:_===K?"var(--color-text-primary)":"var(--color-text-secondary)",background:_===K?"var(--color-highlight-selected)":"transparent",cursor:"pointer"},children:[h("span",{style:{fontWeight:500},children:T.slice(0,f.trim().length)},void 0,!1,void 0,this),T.slice(f.trim().length)]},T,!0,void 0,this)})]},H.label,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as F,Fragment as iy}from"react/jsx-dev-runtime";var s=0.2,fy=0.25,Ky=4;function uy({zoom:B,onZoomIn:y,onZoomOut:N,onZoomReset:J,onFullscreen:$}){return F("div",{className:"flex items-center gap-0.5 bg-bg-surface border border-border-subtle rounded-md px-1 py-0.5",style:{fontSize:"12px"},children:[F("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:N,title:"Zoom out",disabled:B<=fy,children:F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:F("line",{x1:"5",y1:"12",x2:"19",y2:"12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),F("button",{className:"px-1.5 h-7 rounded hover:bg-bg-elevated text-text-tertiary hover:text-text-primary transition-colors tabular-nums",onClick:J,title:"Reset zoom",children:[Math.round(B*100),"%"]},void 0,!0,void 0,this),F("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:y,title:"Zoom in",disabled:B>=Ky,children:F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[F("line",{x1:"12",y1:"5",x2:"12",y2:"19"},void 0,!1,void 0,this),F("line",{x1:"5",y1:"12",x2:"19",y2:"12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$&&F(iy,{children:[F("div",{className:"w-px h-4 bg-border-subtle mx-0.5"},void 0,!1,void 0,this),F("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:$,title:"Fullscreen",children:F("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[F("polyline",{points:"15 3 21 3 21 9"},void 0,!1,void 0,this),F("polyline",{points:"9 21 3 21 3 15"},void 0,!1,void 0,this),F("line",{x1:"21",y1:"3",x2:"14",y2:"10"},void 0,!1,void 0,this),F("line",{x1:"3",y1:"21",x2:"10",y2:"14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function ry(B=1){let[y,N]=o(B),J=x(()=>N((Y)=>Math.min(Ky,+(Y+s).toFixed(2))),[]),$=x(()=>N((Y)=>Math.max(fy,+(Y-s).toFixed(2))),[]),Q=x(()=>N(1),[]);return{zoom:y,zoomIn:J,zoomOut:$,zoomReset:Q,setZoom:N}}function o1({svgHtml:B,source:y,onClose:N}){let J=t(null),{zoom:$,zoomIn:Q,zoomOut:Y,zoomReset:f,setZoom:W}=ry(1),[K,X]=o({x:0,y:0}),b=t(null);vy(()=>{let Z=(A)=>{if(A.key==="Escape")N()};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[N]);let P=x((Z)=>{Z.preventDefault();let A=Z.deltaY>0?-s:s;W((w)=>Math.max(fy,Math.min(Ky,+(w+A).toFixed(2))))},[W]),U=x((Z)=>{if(Z.button!==0)return;b.current={startX:Z.clientX,startY:Z.clientY,panX:K.x,panY:K.y},Z.preventDefault()},[K]),L=x((Z)=>{if(!b.current)return;X({x:b.current.panX+(Z.clientX-b.current.startX),y:b.current.panY+(Z.clientY-b.current.startY)})},[]),q=x(()=>{b.current=null},[]),G=x(()=>{f(),X({x:0,y:0})},[f]);return a1.createPortal(F("div",{style:{position:"fixed",inset:0,zIndex:9999,background:"var(--color-bg-base)",display:"flex",flexDirection:"column"},onMouseMove:L,onMouseUp:q,onMouseLeave:q,children:[F("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border-subtle",style:{flexShrink:0,background:"var(--color-bg-surface)"},children:[F("span",{className:"text-body text-text-secondary",style:{fontSize:"13px"},children:"Mermaid Diagram"},void 0,!1,void 0,this),F("div",{className:"flex items-center gap-2",children:[F(uy,{zoom:$,onZoomIn:Q,onZoomOut:Y,onZoomReset:G},void 0,!1,void 0,this),F("button",{className:"flex items-center justify-center w-8 h-8 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:N,title:"Close (Esc)",children:F("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[F("line",{x1:"18",y1:"6",x2:"6",y2:"18"},void 0,!1,void 0,this),F("line",{x1:"6",y1:"6",x2:"18",y2:"18"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F("div",{style:{flex:1,overflow:"hidden",cursor:b.current?"grabbing":"grab"},onWheel:P,onMouseDown:U,children:F("div",{ref:J,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",transform:`translate(${K.x}px, ${K.y}px) scale(${$})`,transformOrigin:"center center",transition:b.current?"none":"transform 0.1s ease-out"},dangerouslySetInnerHTML:{__html:B}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),document.body)}function s1({children:B}){let y=t(null),[N,J]=o(null),[$,Q]=o(!1),[Y,f]=o(""),W=typeof B==="string"?B:String(B??""),{annotations:K,addAnnotationWithId:X,activeAnnotationId:b,setActiveAnnotationId:P}=l1(),[U,L]=o(null),{zoom:q,zoomIn:G,zoomOut:Z,zoomReset:A,setZoom:w}=ry(1),C=t(K);C.current=K;let I=x((O,H,T)=>{let _=`[Diagram ${T.toLowerCase()}] ${H}`,S=C.current.find((Fy)=>Fy.snippet===_);if(S)P(S.id);else L({anchorEl:O,snippet:H,prefix:T})},[P]),z=t(I);z.current=I,vy(()=>{let O=!1,H=async()=>{try{let _=window.mermaid;if(!_){J("Mermaid library not loaded");return}let S=document.documentElement.dataset.theme==="light"?"default":"dark";_.initialize({startOnLoad:!1,theme:S});let Fy=`mermaid-${Math.random().toString(36).slice(2)}`,{svg:Sy}=await _.render(Fy,W.trim());if(!O&&y.current)y.current.innerHTML=Sy,f(Sy),n1(y.current,(T1,m1,M1)=>z.current(T1,m1,M1)),Ey(y.current,C.current);J(null)}catch(_){if(!O)J(_.message||"Invalid diagram")}};H();let T=new MutationObserver((_)=>{for(let S of _)if(S.attributeName==="data-theme")H()});return T.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{O=!0,T.disconnect()}},[W]),vy(()=>{if(y.current)Ey(y.current,K,b)},[K,b]);let g=x((O)=>{if(!O.ctrlKey&&!O.metaKey)return;O.preventDefault();let H=O.deltaY>0?-s:s;w((T)=>Math.max(fy,Math.min(Ky,+(T+H).toFixed(2))))},[w]);if(N)return F("div",{className:"bg-accent-red-muted rounded-md p-4 mt-3 text-body text-accent-red",children:["Mermaid error: ",N,F("pre",{className:"mt-2 text-tiny text-text-tertiary whitespace-pre-wrap",children:W},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let D=y.current?.closest("#plan-scroll-container");return F(iy,{children:[F("div",{className:"mt-3 mermaid-container","data-md":"mermaid","data-md-source":W.trim(),children:[F("div",{className:"flex justify-end mb-1",children:F(uy,{zoom:q,onZoomIn:G,onZoomOut:Z,onZoomReset:A,onFullscreen:()=>Q(!0)},void 0,!1,void 0,this)},void 0,!1,void 0,this),F("div",{style:{overflow:"auto",maxHeight:"70vh"},onWheel:g,children:F("div",{ref:y,className:"flex justify-center",style:{transform:`scale(${q})`,transformOrigin:"top center",transition:"transform 0.1s ease-out",minHeight:q<1?void 0:void 0}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&F(py,{anchorEl:U.anchorEl,scrollContainer:D,snippet:U.snippet,header:F("div",{style:{fontSize:"12px",color:"var(--color-text-tertiary)",marginBottom:"8px",lineHeight:"1.4",display:"flex",alignItems:"center",gap:"6px"},children:[F("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--color-accent-amber)",flexShrink:0}},void 0,!1,void 0,this),U.snippet]},void 0,!0,void 0,this),onAdd:(O)=>{let H=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;X(H,`[Diagram ${U.prefix.toLowerCase()}] ${U.snippet}`,O),L(null)},onCancel:()=>L(null)},void 0,!1,void 0,this),$&&Y&&F(o1,{svgHtml:Y,source:W,onClose:()=>Q(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function n1(B,y){let N=(J,$,Q)=>{J.style.cursor="pointer",J.addEventListener("mouseenter",()=>{J.style.filter="brightness(1.2)"}),J.addEventListener("mouseleave",()=>{J.style.filter=""}),J.addEventListener("click",(Y)=>{Y.stopPropagation(),Y.preventDefault(),y(J,$(),Q)})};for(let J of B.querySelectorAll(".node"))N(J,()=>{return(J.querySelector(".nodeLabel")||J.querySelector("foreignObject span")||J.querySelector("text"))?.textContent?.trim()||"Node"},"Node");for(let J of B.querySelectorAll(".edgePath")){let $=J,Q=$.querySelector("path");if(Q){Q.style.strokeWidth=Math.max(parseFloat(Q.style.strokeWidth||"1"),8)+"px",Q.style.strokeOpacity="0";let f=Q.cloneNode(!0);f.style.strokeWidth="",f.style.strokeOpacity="",$.insertBefore(f,Q)}let Y=$.id||"";N($,()=>{let f=B.querySelectorAll(".edgeLabel");for(let W of f)if(W.id&&Y&&W.id.replace("label","").includes(Y.replace("L-","").replace("edge",""))){let K=W.textContent?.trim();if(K)return K}return"Connection"},"Edge")}for(let J of B.querySelectorAll(".edgeLabel")){let $=J.textContent?.trim();if(!$)continue;N(J,()=>$,"Edge")}for(let J of B.querySelectorAll(".actor")){let $=J.closest("g")?.querySelector("text")||J.parentElement?.querySelector("text");if(!$)continue;let Q=J.closest("g");if(!Q||Q.hasAttribute("data-clickable"))continue;Q.setAttribute("data-clickable","true"),N(Q,()=>$.textContent?.trim()||"Participant","Node")}for(let J of B.querySelectorAll(".messageText")){let $=J.textContent?.trim();if(!$)continue;N(J,()=>$,"Edge")}for(let J of B.querySelectorAll(".entityBox")){let $=J.closest("g");if(!$||$.hasAttribute("data-clickable"))continue;let Q=$.querySelector(".entityLabel");if(!Q)continue;$.setAttribute("data-clickable","true"),N($,()=>Q.textContent?.trim()||"Entity","Node")}for(let J of B.querySelectorAll(".relationshipLabel")){let $=J.textContent?.trim();if(!$)continue;let Y=J.closest("g")||J;if(Y.hasAttribute("data-clickable"))continue;Y.setAttribute("data-clickable","true"),N(Y,()=>$,"Edge")}for(let J of B.querySelectorAll(".classGroup")){let $=J;if($.hasAttribute("data-clickable"))continue;let Q=$.querySelector(".classTitle, .classTitleText, text");if(!Q)continue;$.setAttribute("data-clickable","true"),N($,()=>Q.textContent?.trim()||"Class","Node")}for(let J of B.querySelectorAll(".statediagram-state")){let $=J;if($.hasAttribute("data-clickable"))continue;let Q=$.querySelector(".state-title, text");if(!Q)continue;$.setAttribute("data-clickable","true"),N($,()=>Q.textContent?.trim()||"State","Node")}for(let J of B.querySelectorAll(".mindmap-node")){let $=J;if($.hasAttribute("data-clickable"))continue;let Q=$.querySelector(".mindmap-node-label, text");if(!Q)continue;$.setAttribute("data-clickable","true"),N($,()=>Q.textContent?.trim()||"Node","Node")}}function Ey(B,y,N){let J=new Map;for(let Q of y){let Y=Q.snippet.match(/^\[Diagram (?:node|edge)\] (.+)$/);if(Y)J.set(Y[1],Q.id)}for(let Q of B.querySelectorAll("[data-annotated]"))Q.style.outline="",Q.style.outlineOffset="",Q.style.borderRadius="",Q.removeAttribute("data-annotated");if(J.size===0)return;for(let Q of B.querySelectorAll(".node")){let f=(Q.querySelector(".nodeLabel")||Q.querySelector("foreignObject span")||Q.querySelector("text"))?.textContent?.trim();if(!f||!J.has(f))continue;let W=J.get(f),K=Q;K.setAttribute("data-annotated",W);let X=W===N;K.style.outline=X?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",K.style.outlineOffset="2px",K.style.borderRadius="4px"}for(let Q of B.querySelectorAll(".edgeLabel")){let Y=Q.textContent?.trim();if(!Y||!J.has(Y))continue;let f=J.get(Y),W=Q;W.setAttribute("data-annotated",f);let K=f===N;W.style.outline=K?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",W.style.outlineOffset="2px",W.style.borderRadius="4px"}for(let Q of B.querySelectorAll(".actor")){let Y=Q.closest("g");if(!Y)continue;let W=Y.querySelector("text")?.textContent?.trim();if(!W||!J.has(W))continue;if(Y.hasAttribute("data-annotated"))continue;let K=J.get(W);Y.setAttribute("data-annotated",K);let X=K===N,b=Y.querySelector("rect");if(b)b.style.outline=X?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",b.style.outlineOffset="2px",b.style.borderRadius="4px"}for(let Q of B.querySelectorAll(".messageText")){let Y=Q.textContent?.trim();if(!Y||!J.has(Y))continue;let f=J.get(Y),W=Q;W.setAttribute("data-annotated",f);let K=f===N;W.style.outline=K?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",W.style.outlineOffset="2px",W.style.borderRadius="4px"}let $=(Q,Y,f)=>{for(let W of B.querySelectorAll(Q)){let K=f(W);if(!K||K.hasAttribute("data-annotated"))continue;let b=K.querySelector(Y)?.textContent?.trim();if(!b||!J.has(b))continue;let P=J.get(b);K.setAttribute("data-annotated",P);let U=P===N,L=K.querySelector("rect, circle, ellipse, polygon")||K;L.style.outline=U?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",L.style.outlineOffset="2px",L.style.borderRadius="4px"}};$(".entityBox",".entityLabel",(Q)=>Q.closest("g"));for(let Q of B.querySelectorAll(".relationshipLabel")){let f=Q.closest("g")||Q;if(f.hasAttribute("data-annotated"))continue;let W=Q.textContent?.trim();if(!W||!J.has(W))continue;let K=J.get(W);f.setAttribute("data-annotated",K);let X=K===N;f.style.outline=X?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",f.style.outlineOffset="2px",f.style.borderRadius="4px"}$(".classGroup",".classTitle, .classTitleText, text",(Q)=>Q),$(".statediagram-state",".state-title, text",(Q)=>Q),$(".mindmap-node",".mindmap-node-label, text",(Q)=>Q)}import{jsxDEV as e}from"react/jsx-dev-runtime";function t1({before:B,after:y,language:N}){let J=B.split(`
|
|
4
|
+
`),$=y.split(`
|
|
5
|
+
`),Q=e1(J,$),Y=[],f=0,W=0,K=0;while(f<J.length||W<$.length)if(K<Q.length&&f<J.length&&W<$.length&&J[f]===Q[K]&&$[W]===Q[K])Y.push({type:"same",line:J[f]}),f++,W++,K++;else if(f<J.length&&(K>=Q.length||J[f]!==Q[K]))Y.push({type:"removed",line:J[f]}),f++;else if(W<$.length)Y.push({type:"added",line:$[W]}),W++;return e("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden group/diff","data-md":"diff","data-md-language":N||"",children:[N&&e("div",{className:"px-4 py-2 text-meta font-mono text-text-tertiary opacity-0 group-hover/diff:opacity-60 transition-opacity",children:["diff (",N,")"]},void 0,!0,void 0,this),e("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono",children:Y.map((X,b)=>e("div",{className:X.type==="removed"?"bg-accent-red-muted text-accent-red":X.type==="added"?"bg-accent-green-muted text-accent-green":"text-text-tertiary",children:[e("span",{className:"select-none w-6 inline-block text-center opacity-60",children:X.type==="removed"?"-":X.type==="added"?"+":" "},void 0,!1,void 0,this),X.line]},b,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function e1(B,y){let N=B.length,J=y.length,$=Array.from({length:N+1},()=>Array(J+1).fill(0));for(let W=1;W<=N;W++)for(let K=1;K<=J;K++)$[W][K]=B[W-1]===y[K-1]?$[W-1][K-1]+1:Math.max($[W-1][K],$[W][K-1]);let Q=[],Y=N,f=J;while(Y>0&&f>0)if(B[Y-1]===y[f-1])Q.unshift(B[Y-1]),Y--,f--;else if($[Y-1][f]>$[Y][f-1])Y--;else f--;return Q}import{useEffect as Xy,useRef as ly,useState as oy}from"react";import{useAnnotations as sy}from"#canvas/runtime";function yy(B,y){B.style.height="auto",B.style.height=(y?Math.max(y,B.scrollHeight):B.scrollHeight)+"px"}import{jsxDEV as ay}from"react/jsx-dev-runtime";function n({note:B,onChange:y}){return ay("div",{className:"mt-1.5",children:ay("textarea",{value:B,onChange:(N)=>y(N.target.value),className:"w-full bg-transparent text-[12px] font-body text-text-primary resize-none focus:outline-none border-none placeholder:text-text-disabled transition-colors min-h-[20px] p-0 leading-relaxed",placeholder:"Add a note...",rows:1,onInput:(N)=>yy(N.target),ref:(N)=>{if(N)yy(N)}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as k}from"react/jsx-dev-runtime";function y0({id:B,label:y,options:N,required:J}){let{responses:$,setResponse:Q}=sy(),Y=$.get(B),f=Y?.value,W=Y?.note||"",[K,X]=oy(!1),b=ly(null);Xy(()=>{if(!$.has(B))Q(B,{id:B,type:"radio",label:y,value:null,options:N,required:J})},[B]);let P=(L)=>{Q(B,{...Y,value:L})};Xy(()=>{let L=b.current;if(!L)return;let q=(G)=>{let A=G.target.closest("[data-md-label]")?.getAttribute("data-md-label");if(A&&N.includes(A))P(A)};return L.addEventListener("kb-select",q),()=>L.removeEventListener("kb-select",q)});let U=Y?.required&&!f;return k("div",{ref:b,"data-md":"choice","data-md-label":y,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[k("div",{className:"flex items-baseline gap-2 mb-2",children:[k("span",{className:"text-[13px] font-body font-medium text-text-primary",children:y},void 0,!1,void 0,this),J&&k("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k("div",{className:"space-y-1",children:N.map((L)=>k("label",{"data-md":"choice-option","data-md-label":L,onClick:()=>P(L),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${f===L?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[k("span",{className:`w-4 h-4 rounded-full border-[1.5px] flex items-center justify-center flex-shrink-0 transition-all ${f===L?"border-accent-amber bg-accent-amber":"border-border-strong"}`,children:f===L&&k("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"},void 0,!1,void 0,this)},void 0,!1,void 0,this),k("span",{className:"text-[13px] font-body text-text-secondary",children:L},void 0,!1,void 0,this)]},L,!0,void 0,this))},void 0,!1,void 0,this),k(n,{show:K,note:W,onToggle:()=>X(!K),onChange:(L)=>Q(B,{...Y,note:L})},void 0,!1,void 0,this),U&&k("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select an option."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function $0({id:B,label:y,options:N,required:J}){let{responses:$,setResponse:Q}=sy(),Y=$.get(B),f=Y?.value||[],W=Y?.note||"",[K,X]=oy(!1),b=ly(null);Xy(()=>{if(!$.has(B))Q(B,{id:B,type:"checkbox",label:y,value:[],options:N,required:J})},[B]);let P=(L)=>{let q=f.includes(L)?f.filter((G)=>G!==L):[...f,L];Q(B,{...Y,value:q})};Xy(()=>{let L=b.current;if(!L)return;let q=(G)=>{let A=G.target.closest("[data-md-label]")?.getAttribute("data-md-label");if(A&&N.includes(A))P(A)};return L.addEventListener("kb-select",q),()=>L.removeEventListener("kb-select",q)});let U=Y?.required&&f.length===0;return k("div",{ref:b,"data-md":"multichoice","data-md-label":y,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[k("div",{className:"flex items-baseline gap-2 mb-2",children:[k("span",{className:"text-[13px] font-body font-medium text-text-primary",children:y},void 0,!1,void 0,this),J&&k("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k("div",{className:"space-y-1",children:N.map((L)=>{let q=f.includes(L);return k("label",{"data-md":"multichoice-option","data-md-label":L,onClick:()=>P(L),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${q?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[k("span",{className:`w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all ${q?"bg-accent-amber":"border-[1.5px] border-border-strong"}`,children:q&&k("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:k("path",{d:"M2.5 5L4.5 7L7.5 3",style:{stroke:"var(--color-text-inverse)"},strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),k("span",{className:"text-[13px] font-body text-text-secondary",children:L},void 0,!1,void 0,this)]},L,!0,void 0,this)})},void 0,!1,void 0,this),k(n,{show:K,note:W,onToggle:()=>X(!K),onChange:(L)=>Q(B,{...Y,note:L})},void 0,!1,void 0,this),U&&k("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select at least one option."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as ny,useRef as B0,useState as ty}from"react";import{useAnnotations as ey}from"#canvas/runtime";import{jsxDEV as v}from"react/jsx-dev-runtime";function N0({id:B,label:y,placeholder:N,multiline:J,required:$}){let{responses:Q,setResponse:Y}=ey(),f=Q.get(B),W=f?.value??"",K=f?.note||"",[X,b]=ty(!1),P=B0(null);ny(()=>{if(!Q.has(B))Y(B,{id:B,type:"text",label:y,value:"",required:$})},[B]);let U=(G)=>{Y(B,{...f,value:G})},L=(G)=>yy(G,J?60:32),q=f?.required&&!W.trim();return v("div",{"data-md":"userinput","data-md-label":y,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[v("div",{className:"flex items-baseline gap-2 mb-2",children:[v("span",{className:"text-[13px] font-body font-medium text-text-primary",children:y},void 0,!1,void 0,this),$&&v("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v("textarea",{ref:P,value:W,onChange:(G)=>{U(G.target.value),L(G.target)},placeholder:N||"Type your response...",rows:J?3:1,className:"w-full bg-bg-input text-[13px] font-body text-text-primary rounded-lg px-3 py-2 resize-none focus:outline-none border border-border-subtle focus:border-border-hover placeholder:text-text-tertiary transition-colors",onInput:(G)=>L(G.target),onFocus:(G)=>L(G.target)},void 0,!1,void 0,this),v(n,{show:X,note:K,onToggle:()=>b(!X),onChange:(G)=>Y(B,{...f,note:G})},void 0,!1,void 0,this),q&&v("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"This field is required."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function J0({id:B,label:y,min:N=1,max:J=10,step:$=1,required:Q,minLabel:Y,maxLabel:f}){let{responses:W,setResponse:K}=ey(),X=W.get(B),b=X?.value,P=X?.note||"",[U,L]=ty(!1);ny(()=>{if(!W.has(B))K(B,{id:B,type:"range",label:y,value:null,required:Q})},[B]);let q=(z)=>{K(B,{...X,value:z})},G=b!==null&&b!==void 0,Z=G?b:Math.round((N+J)/2),A=(Z-N)/(J-N)*100,w=Math.round((J-N)/$),C=w<=20,I=X?.required&&!G;return v("div",{"data-md":"rangeinput","data-md-label":y,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[v("div",{className:"flex items-baseline justify-between mb-1",children:[v("div",{className:"flex items-baseline gap-2",children:[v("span",{className:"text-[13px] font-body font-medium text-text-primary",children:y},void 0,!1,void 0,this),Q&&v("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v("span",{className:"flex items-center gap-1.5",children:[v("span",{className:`text-[13px] font-mono ${G?"text-accent-amber":"text-text-disabled"}`,children:G?b:"—"},void 0,!1,void 0,this),G&&v("button",{onClick:()=>K(B,{...X,value:null}),className:"text-text-disabled hover:text-text-tertiary transition-colors text-[10px] leading-none",title:"Clear",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),v("div",{className:"relative h-6 flex items-center",children:[v("div",{className:"absolute left-0 right-0 h-1.5 rounded-full bg-border-medium",children:G&&v("div",{className:"h-full rounded-full bg-accent-amber transition-all duration-150",style:{width:`${A}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),C&&Array.from({length:w+1},(z,g)=>{let D=N+g*$,O=(D-N)/(J-N)*100,H=G&&D<=b;return v("div",{className:`absolute rounded-full pointer-events-none transition-all duration-150 ${G&&D===b?"w-2.5 h-2.5 bg-accent-amber":H?"w-1.5 h-1.5 bg-accent-amber":"w-1.5 h-1.5 bg-border-hover"}`,style:{left:`${O}%`,transform:"translate(-50%, -50%)",top:"50%"}},g,!1,void 0,this)}),G?v("div",{className:"absolute h-5 w-5 rounded-full bg-accent-amber shadow-md pointer-events-none transition-all duration-150",style:{left:`calc(${A}% - 10px)`,borderWidth:"2px",borderStyle:"solid",borderColor:"var(--color-bg-base)"}},void 0,!1,void 0,this):v("div",{className:"absolute h-4 w-4 rounded-full bg-border-hover pointer-events-none opacity-50",style:{left:"calc(50% - 8px)",borderWidth:"2px",borderStyle:"solid",borderColor:"var(--color-bg-base)"}},void 0,!1,void 0,this),v("input",{type:"range",min:N,max:J,step:$,value:Z,onChange:(z)=>q(Number(z.target.value)),className:"absolute inset-0 w-full opacity-0 cursor-pointer"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&w<=10?v("div",{className:"flex justify-between -mt-0.5 px-0",children:Array.from({length:w+1},(z,g)=>{let D=N+g*$;return v("span",{className:`text-[10px] font-mono transition-colors ${G&&D===b?"text-accent-amber font-medium":"text-text-disabled"}`,style:{minWidth:"1ch",textAlign:"center"},children:D},g,!1,void 0,this)})},void 0,!1,void 0,this):v("div",{className:"flex justify-between -mt-0.5",children:[v("span",{className:"text-[11px] text-text-tertiary font-body",children:Y||N},void 0,!1,void 0,this),v("span",{className:"text-[11px] text-text-tertiary font-body",children:f||J},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v(n,{show:U,note:P,onToggle:()=>L(!U),onChange:(z)=>K(B,{...X,note:z})},void 0,!1,void 0,this),I&&v("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select a value."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useContext as Q0,useState as Y0}from"react";import{SessionContext as W0}from"#canvas/runtime";import{jsxDEV as $y}from"react/jsx-dev-runtime";function f0({src:B,alt:y,caption:N,width:J,height:$}){let Q=Q0(W0),[Y,f]=Y0(!1),W=`/api/image?session=${encodeURIComponent(Q)}&path=${encodeURIComponent(B)}`;if(Y)return $y("div",{className:"mt-3 text-accent-red text-body bg-accent-red-muted rounded-md p-4",children:[B,": Failed to load image"]},void 0,!0,void 0,this);return $y("figure",{className:"mt-3 relative","data-md":"image","data-md-src":B,children:[$y("div",{className:"rounded-md overflow-hidden border border-border-subtle bg-bg-code inline-block",children:$y("img",{src:W,alt:y||B,onError:()=>f(!0),className:"block max-w-full h-auto",...J?{width:J}:{},...$?{height:$}:{}},void 0,!1,void 0,this)},void 0,!1,void 0,this),N&&$y("figcaption",{className:"mt-1.5 text-meta text-text-tertiary font-body",children:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useMemo as t0}from"react";function wy(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var a=wy();function Y1(B){a=B}var r={exec:()=>null};function m(B,y=""){let N=typeof B=="string"?B:B.source,J={replace:($,Q)=>{let Y=typeof Q=="string"?Q:Q.source;return Y=Y.replace(R.caret,"$1"),N=N.replace($,Y),J},getRegex:()=>new RegExp(N,y)};return J}var K0=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),R={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:(B)=>new RegExp(`^( {0,3}${B})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:(B)=>new RegExp(`^ {0,${Math.min(3,B-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:(B)=>new RegExp(`^ {0,${Math.min(3,B-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:(B)=>new RegExp(`^ {0,${Math.min(3,B-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:(B)=>new RegExp(`^ {0,${Math.min(3,B-1)}}#`),htmlBeginRegex:(B)=>new RegExp(`^ {0,${Math.min(3,B-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:(B)=>new RegExp(`^ {0,${Math.min(3,B-1)}}>`)},X0=/^(?:[ \t]*(?:\n|$))+/,L0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,b0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Qy=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,P0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ky=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,W1=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,f1=m(W1).replace(/bull/g,ky).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),H0=m(W1).replace(/bull/g,ky).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ay=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,U0=/^[^\n]+/,zy=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,q0=m(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",zy).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),F0=m(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ky).getRegex(),Uy="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_y=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,G0=m("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",_y).replace("tag",Uy).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),K1=m(Ay).replace("hr",Qy).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Uy).getRegex(),T0=m(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",K1).getRegex(),Oy={blockquote:T0,code:L0,def:q0,fences:b0,heading:P0,hr:Qy,html:G0,lheading:f1,list:F0,newline:X0,paragraph:K1,table:r,text:U0},y1=m("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Qy).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Uy).getRegex(),m0={...Oy,lheading:H0,table:y1,paragraph:m(Ay).replace("hr",Qy).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",y1).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Uy).getRegex()},M0={...Oy,html:m(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_y).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:r,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:m(Ay).replace("hr",Qy).replace("heading",` *#{1,6} *[^
|
|
6
|
+
]`).replace("lheading",f1).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},v0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Z0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,X1=/^( {2,}|\\)\n(?!\s*$)/,w0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,qy=/[\p{P}\p{S}]/u,Cy=/[\s\p{P}\p{S}]/u,L1=/[^\s\p{P}\p{S}]/u,k0=m(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Cy).getRegex(),b1=/(?!~)[\p{P}\p{S}]/u,A0=/(?!~)[\s\p{P}\p{S}]/u,z0=/(?:[^\s\p{P}\p{S}]|~)/u,P1=/(?![*_])[\p{P}\p{S}]/u,_0=/(?![*_])[\s\p{P}\p{S}]/u,O0=/(?:[^\s\p{P}\p{S}]|[*_])/u,C0=m(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",K0?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),H1=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,I0=m(H1,"u").replace(/punct/g,qy).getRegex(),R0=m(H1,"u").replace(/punct/g,b1).getRegex(),U1="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",S0=m(U1,"gu").replace(/notPunctSpace/g,L1).replace(/punctSpace/g,Cy).replace(/punct/g,qy).getRegex(),g0=m(U1,"gu").replace(/notPunctSpace/g,z0).replace(/punctSpace/g,A0).replace(/punct/g,b1).getRegex(),h0=m("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,L1).replace(/punctSpace/g,Cy).replace(/punct/g,qy).getRegex(),D0=m(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,P1).getRegex(),j0="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",V0=m(j0,"gu").replace(/notPunctSpace/g,O0).replace(/punctSpace/g,_0).replace(/punct/g,P1).getRegex(),c0=m(/\\(punct)/,"gu").replace(/punct/g,qy).getRegex(),x0=m(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),d0=m(_y).replace("(?:-->|$)","-->").getRegex(),p0=m("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",d0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),by=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,E0=m(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",by).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),q1=m(/^!?\[(label)\]\[(ref)\]/).replace("label",by).replace("ref",zy).getRegex(),F1=m(/^!?\[(ref)\](?:\[\])?/).replace("ref",zy).getRegex(),u0=m("reflink|nolink(?!\\()","g").replace("reflink",q1).replace("nolink",F1).getRegex(),$1=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Iy={_backpedal:r,anyPunctuation:c0,autolink:x0,blockSkip:C0,br:X1,code:Z0,del:r,delLDelim:r,delRDelim:r,emStrongLDelim:I0,emStrongRDelimAst:S0,emStrongRDelimUnd:h0,escape:v0,link:E0,nolink:F1,punctuation:k0,reflink:q1,reflinkSearch:u0,tag:p0,text:w0,url:r},r0={...Iy,link:m(/^!?\[(label)\]\((.*?)\)/).replace("label",by).getRegex(),reflink:m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",by).getRegex()},Zy={...Iy,emStrongRDelimAst:g0,emStrongLDelim:R0,delLDelim:D0,delRDelim:V0,url:m(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",$1).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:m(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",$1).getRegex()},i0={...Zy,br:m(X1).replace("{2,}","*").getRegex(),text:m(Zy.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ly={normal:Oy,gfm:m0,pedantic:M0},By={normal:Iy,gfm:Zy,breaks:i0,pedantic:r0},a0={"&":"&","<":"<",">":">",'"':""","'":"'"},B1=(B)=>a0[B];function d(B,y){if(y){if(R.escapeTest.test(B))return B.replace(R.escapeReplace,B1)}else if(R.escapeTestNoEncode.test(B))return B.replace(R.escapeReplaceNoEncode,B1);return B}function N1(B){try{B=encodeURI(B).replace(R.percentDecode,"%")}catch{return null}return B}function J1(B,y){let N=B.replace(R.findPipe,(Q,Y,f)=>{let W=!1,K=Y;for(;--K>=0&&f[K]==="\\";)W=!W;return W?"|":" |"}),J=N.split(R.splitPipe),$=0;if(J[0].trim()||J.shift(),J.length>0&&!J.at(-1)?.trim()&&J.pop(),y)if(J.length>y)J.splice(y);else for(;J.length<y;)J.push("");for(;$<J.length;$++)J[$]=J[$].trim().replace(R.slashPipe,"|");return J}function Ny(B,y,N){let J=B.length;if(J===0)return"";let $=0;for(;$<J;){let Q=B.charAt(J-$-1);if(Q===y&&!N)$++;else if(Q!==y&&N)$++;else break}return B.slice(0,J-$)}function l0(B,y){if(B.indexOf(y[1])===-1)return-1;let N=0;for(let J=0;J<B.length;J++)if(B[J]==="\\")J++;else if(B[J]===y[0])N++;else if(B[J]===y[1]&&(N--,N<0))return J;return N>0?-2:-1}function o0(B,y=0){let N=y,J="";for(let $ of B)if($==="\t"){let Q=4-N%4;J+=" ".repeat(Q),N+=Q}else J+=$,N++;return J}function Q1(B,y,N,J,$){let Q=y.href,Y=y.title||null,f=B[1].replace($.other.outputLinkReplace,"$1");J.state.inLink=!0;let W={type:B[0].charAt(0)==="!"?"image":"link",raw:N,href:Q,title:Y,text:f,tokens:J.inlineTokens(f)};return J.state.inLink=!1,W}function s0(B,y,N){let J=B.match(N.other.indentCodeCompensation);if(J===null)return y;let $=J[1];return y.split(`
|
|
7
|
+
`).map((Q)=>{let Y=Q.match(N.other.beginningSpace);if(Y===null)return Q;let[f]=Y;return f.length>=$.length?Q.slice($.length):Q}).join(`
|
|
8
|
+
`)}var Py=class{options;rules;lexer;constructor(B){this.options=B||a}space(B){let y=this.rules.block.newline.exec(B);if(y&&y[0].length>0)return{type:"space",raw:y[0]}}code(B){let y=this.rules.block.code.exec(B);if(y){let N=y[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:y[0],codeBlockStyle:"indented",text:this.options.pedantic?N:Ny(N,`
|
|
9
|
+
`)}}}fences(B){let y=this.rules.block.fences.exec(B);if(y){let N=y[0],J=s0(N,y[3]||"",this.rules);return{type:"code",raw:N,lang:y[2]?y[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):y[2],text:J}}}heading(B){let y=this.rules.block.heading.exec(B);if(y){let N=y[2].trim();if(this.rules.other.endingHash.test(N)){let J=Ny(N,"#");(this.options.pedantic||!J||this.rules.other.endingSpaceChar.test(J))&&(N=J.trim())}return{type:"heading",raw:y[0],depth:y[1].length,text:N,tokens:this.lexer.inline(N)}}}hr(B){let y=this.rules.block.hr.exec(B);if(y)return{type:"hr",raw:Ny(y[0],`
|
|
10
|
+
`)}}blockquote(B){let y=this.rules.block.blockquote.exec(B);if(y){let N=Ny(y[0],`
|
|
11
|
+
`).split(`
|
|
12
|
+
`),J="",$="",Q=[];for(;N.length>0;){let Y=!1,f=[],W;for(W=0;W<N.length;W++)if(this.rules.other.blockquoteStart.test(N[W]))f.push(N[W]),Y=!0;else if(!Y)f.push(N[W]);else break;N=N.slice(W);let K=f.join(`
|
|
13
|
+
`),X=K.replace(this.rules.other.blockquoteSetextReplace,`
|
|
14
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");J=J?`${J}
|
|
15
|
+
${K}`:K,$=$?`${$}
|
|
16
|
+
${X}`:X;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(X,Q,!0),this.lexer.state.top=b,N.length===0)break;let P=Q.at(-1);if(P?.type==="code")break;if(P?.type==="blockquote"){let U=P,L=U.raw+`
|
|
17
|
+
`+N.join(`
|
|
18
|
+
`),q=this.blockquote(L);Q[Q.length-1]=q,J=J.substring(0,J.length-U.raw.length)+q.raw,$=$.substring(0,$.length-U.text.length)+q.text;break}else if(P?.type==="list"){let U=P,L=U.raw+`
|
|
19
|
+
`+N.join(`
|
|
20
|
+
`),q=this.list(L);Q[Q.length-1]=q,J=J.substring(0,J.length-P.raw.length)+q.raw,$=$.substring(0,$.length-U.raw.length)+q.raw,N=L.substring(Q.at(-1).raw.length).split(`
|
|
21
|
+
`);continue}}return{type:"blockquote",raw:J,tokens:Q,text:$}}}list(B){let y=this.rules.block.list.exec(B);if(y){let N=y[1].trim(),J=N.length>1,$={type:"list",raw:"",ordered:J,start:J?+N.slice(0,-1):"",loose:!1,items:[]};N=J?`\\d{1,9}\\${N.slice(-1)}`:`\\${N}`,this.options.pedantic&&(N=J?N:"[*+-]");let Q=this.rules.other.listItemRegex(N),Y=!1;for(;B;){let W=!1,K="",X="";if(!(y=Q.exec(B))||this.rules.block.hr.test(B))break;K=y[0],B=B.substring(K.length);let b=o0(y[2].split(`
|
|
22
|
+
`,1)[0],y[1].length),P=B.split(`
|
|
23
|
+
`,1)[0],U=!b.trim(),L=0;if(this.options.pedantic?(L=2,X=b.trimStart()):U?L=y[1].length+1:(L=b.search(this.rules.other.nonSpaceChar),L=L>4?1:L,X=b.slice(L),L+=y[1].length),U&&this.rules.other.blankLine.test(P)&&(K+=P+`
|
|
24
|
+
`,B=B.substring(P.length+1),W=!0),!W){let q=this.rules.other.nextBulletRegex(L),G=this.rules.other.hrRegex(L),Z=this.rules.other.fencesBeginRegex(L),A=this.rules.other.headingBeginRegex(L),w=this.rules.other.htmlBeginRegex(L),C=this.rules.other.blockquoteBeginRegex(L);for(;B;){let I=B.split(`
|
|
25
|
+
`,1)[0],z;if(P=I,this.options.pedantic?(P=P.replace(this.rules.other.listReplaceNesting," "),z=P):z=P.replace(this.rules.other.tabCharGlobal," "),Z.test(P)||A.test(P)||w.test(P)||C.test(P)||q.test(P)||G.test(P))break;if(z.search(this.rules.other.nonSpaceChar)>=L||!P.trim())X+=`
|
|
26
|
+
`+z.slice(L);else{if(U||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Z.test(b)||A.test(b)||G.test(b))break;X+=`
|
|
27
|
+
`+P}U=!P.trim(),K+=I+`
|
|
28
|
+
`,B=B.substring(I.length+1),b=z.slice(L)}}$.loose||(Y?$.loose=!0:this.rules.other.doubleBlankLine.test(K)&&(Y=!0)),$.items.push({type:"list_item",raw:K,task:!!this.options.gfm&&this.rules.other.listIsTask.test(X),loose:!1,text:X,tokens:[]}),$.raw+=K}let f=$.items.at(-1);if(f)f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd();else return;$.raw=$.raw.trimEnd();for(let W of $.items){if(this.lexer.state.top=!1,W.tokens=this.lexer.blockTokens(W.text,[]),W.task){if(W.text=W.text.replace(this.rules.other.listReplaceTask,""),W.tokens[0]?.type==="text"||W.tokens[0]?.type==="paragraph"){W.tokens[0].raw=W.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),W.tokens[0].text=W.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let X=this.lexer.inlineQueue.length-1;X>=0;X--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[X].src)){this.lexer.inlineQueue[X].src=this.lexer.inlineQueue[X].src.replace(this.rules.other.listReplaceTask,"");break}}let K=this.rules.other.listTaskCheckbox.exec(W.raw);if(K){let X={type:"checkbox",raw:K[0]+" ",checked:K[0]!=="[ ]"};W.checked=X.checked,$.loose?W.tokens[0]&&["paragraph","text"].includes(W.tokens[0].type)&&"tokens"in W.tokens[0]&&W.tokens[0].tokens?(W.tokens[0].raw=X.raw+W.tokens[0].raw,W.tokens[0].text=X.raw+W.tokens[0].text,W.tokens[0].tokens.unshift(X)):W.tokens.unshift({type:"paragraph",raw:X.raw,text:X.raw,tokens:[X]}):W.tokens.unshift(X)}}if(!$.loose){let K=W.tokens.filter((b)=>b.type==="space"),X=K.length>0&&K.some((b)=>this.rules.other.anyLine.test(b.raw));$.loose=X}}if($.loose)for(let W of $.items){W.loose=!0;for(let K of W.tokens)K.type==="text"&&(K.type="paragraph")}return $}}html(B){let y=this.rules.block.html.exec(B);if(y)return{type:"html",block:!0,raw:y[0],pre:y[1]==="pre"||y[1]==="script"||y[1]==="style",text:y[0]}}def(B){let y=this.rules.block.def.exec(B);if(y){let N=y[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),J=y[2]?y[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",$=y[3]?y[3].substring(1,y[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):y[3];return{type:"def",tag:N,raw:y[0],href:J,title:$}}}table(B){let y=this.rules.block.table.exec(B);if(!y||!this.rules.other.tableDelimiter.test(y[2]))return;let N=J1(y[1]),J=y[2].replace(this.rules.other.tableAlignChars,"").split("|"),$=y[3]?.trim()?y[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
29
|
+
`):[],Q={type:"table",raw:y[0],header:[],align:[],rows:[]};if(N.length===J.length){for(let Y of J)this.rules.other.tableAlignRight.test(Y)?Q.align.push("right"):this.rules.other.tableAlignCenter.test(Y)?Q.align.push("center"):this.rules.other.tableAlignLeft.test(Y)?Q.align.push("left"):Q.align.push(null);for(let Y=0;Y<N.length;Y++)Q.header.push({text:N[Y],tokens:this.lexer.inline(N[Y]),header:!0,align:Q.align[Y]});for(let Y of $)Q.rows.push(J1(Y,Q.header.length).map((f,W)=>({text:f,tokens:this.lexer.inline(f),header:!1,align:Q.align[W]})));return Q}}lheading(B){let y=this.rules.block.lheading.exec(B);if(y)return{type:"heading",raw:y[0],depth:y[2].charAt(0)==="="?1:2,text:y[1],tokens:this.lexer.inline(y[1])}}paragraph(B){let y=this.rules.block.paragraph.exec(B);if(y){let N=y[1].charAt(y[1].length-1)===`
|
|
30
|
+
`?y[1].slice(0,-1):y[1];return{type:"paragraph",raw:y[0],text:N,tokens:this.lexer.inline(N)}}}text(B){let y=this.rules.block.text.exec(B);if(y)return{type:"text",raw:y[0],text:y[0],tokens:this.lexer.inline(y[0])}}escape(B){let y=this.rules.inline.escape.exec(B);if(y)return{type:"escape",raw:y[0],text:y[1]}}tag(B){let y=this.rules.inline.tag.exec(B);if(y)return!this.lexer.state.inLink&&this.rules.other.startATag.test(y[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(y[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(y[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(y[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:y[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:y[0]}}link(B){let y=this.rules.inline.link.exec(B);if(y){let N=y[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(N)){if(!this.rules.other.endAngleBracket.test(N))return;let Q=Ny(N.slice(0,-1),"\\");if((N.length-Q.length)%2===0)return}else{let Q=l0(y[2],"()");if(Q===-2)return;if(Q>-1){let Y=(y[0].indexOf("!")===0?5:4)+y[1].length+Q;y[2]=y[2].substring(0,Q),y[0]=y[0].substring(0,Y).trim(),y[3]=""}}let J=y[2],$="";if(this.options.pedantic){let Q=this.rules.other.pedanticHrefTitle.exec(J);Q&&(J=Q[1],$=Q[3])}else $=y[3]?y[3].slice(1,-1):"";return J=J.trim(),this.rules.other.startAngleBracket.test(J)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(N)?J=J.slice(1):J=J.slice(1,-1)),Q1(y,{href:J&&J.replace(this.rules.inline.anyPunctuation,"$1"),title:$&&$.replace(this.rules.inline.anyPunctuation,"$1")},y[0],this.lexer,this.rules)}}reflink(B,y){let N;if((N=this.rules.inline.reflink.exec(B))||(N=this.rules.inline.nolink.exec(B))){let J=(N[2]||N[1]).replace(this.rules.other.multipleSpaceGlobal," "),$=y[J.toLowerCase()];if(!$){let Q=N[0].charAt(0);return{type:"text",raw:Q,text:Q}}return Q1(N,$,N[0],this.lexer,this.rules)}}emStrong(B,y,N=""){let J=this.rules.inline.emStrongLDelim.exec(B);if(!J||J[3]&&N.match(this.rules.other.unicodeAlphaNumeric))return;if(!(J[1]||J[2])||!N||this.rules.inline.punctuation.exec(N)){let $=[...J[0]].length-1,Q,Y,f=$,W=0,K=J[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(K.lastIndex=0,y=y.slice(-1*B.length+$);(J=K.exec(y))!=null;){if(Q=J[1]||J[2]||J[3]||J[4]||J[5]||J[6],!Q)continue;if(Y=[...Q].length,J[3]||J[4]){f+=Y;continue}else if((J[5]||J[6])&&$%3&&!(($+Y)%3)){W+=Y;continue}if(f-=Y,f>0)continue;Y=Math.min(Y,Y+f+W);let X=[...J[0]][0].length,b=B.slice(0,$+J.index+X+Y);if(Math.min($,Y)%2){let U=b.slice(1,-1);return{type:"em",raw:b,text:U,tokens:this.lexer.inlineTokens(U)}}let P=b.slice(2,-2);return{type:"strong",raw:b,text:P,tokens:this.lexer.inlineTokens(P)}}}}codespan(B){let y=this.rules.inline.code.exec(B);if(y){let N=y[2].replace(this.rules.other.newLineCharGlobal," "),J=this.rules.other.nonSpaceChar.test(N),$=this.rules.other.startingSpaceChar.test(N)&&this.rules.other.endingSpaceChar.test(N);return J&&$&&(N=N.substring(1,N.length-1)),{type:"codespan",raw:y[0],text:N}}}br(B){let y=this.rules.inline.br.exec(B);if(y)return{type:"br",raw:y[0]}}del(B,y,N=""){let J=this.rules.inline.delLDelim.exec(B);if(!J)return;if(!J[1]||!N||this.rules.inline.punctuation.exec(N)){let $=[...J[0]].length-1,Q,Y,f=$,W=this.rules.inline.delRDelim;for(W.lastIndex=0,y=y.slice(-1*B.length+$);(J=W.exec(y))!=null;){if(Q=J[1]||J[2]||J[3]||J[4]||J[5]||J[6],!Q||(Y=[...Q].length,Y!==$))continue;if(J[3]||J[4]){f+=Y;continue}if(f-=Y,f>0)continue;Y=Math.min(Y,Y+f);let K=[...J[0]][0].length,X=B.slice(0,$+J.index+K+Y),b=X.slice($,-$);return{type:"del",raw:X,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(B){let y=this.rules.inline.autolink.exec(B);if(y){let N,J;return y[2]==="@"?(N=y[1],J="mailto:"+N):(N=y[1],J=N),{type:"link",raw:y[0],text:N,href:J,tokens:[{type:"text",raw:N,text:N}]}}}url(B){let y;if(y=this.rules.inline.url.exec(B)){let N,J;if(y[2]==="@")N=y[0],J="mailto:"+N;else{let $;do $=y[0],y[0]=this.rules.inline._backpedal.exec(y[0])?.[0]??"";while($!==y[0]);N=y[0],y[1]==="www."?J="http://"+y[0]:J=y[0]}return{type:"link",raw:y[0],text:N,href:J,tokens:[{type:"text",raw:N,text:N}]}}}inlineText(B){let y=this.rules.inline.text.exec(B);if(y){let N=this.lexer.state.inRawBlock;return{type:"text",raw:y[0],text:y[0],escaped:N}}}},j=class B{tokens;options;state;inlineQueue;tokenizer;constructor(y){this.tokens=[],this.tokens.links=Object.create(null),this.options=y||a,this.options.tokenizer=this.options.tokenizer||new Py,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let N={other:R,block:Ly.normal,inline:By.normal};this.options.pedantic?(N.block=Ly.pedantic,N.inline=By.pedantic):this.options.gfm&&(N.block=Ly.gfm,this.options.breaks?N.inline=By.breaks:N.inline=By.gfm),this.tokenizer.rules=N}static get rules(){return{block:Ly,inline:By}}static lex(y,N){return new B(N).lex(y)}static lexInline(y,N){return new B(N).inlineTokens(y)}lex(y){y=y.replace(R.carriageReturn,`
|
|
31
|
+
`),this.blockTokens(y,this.tokens);for(let N=0;N<this.inlineQueue.length;N++){let J=this.inlineQueue[N];this.inlineTokens(J.src,J.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(y,N=[],J=!1){for(this.options.pedantic&&(y=y.replace(R.tabCharGlobal," ").replace(R.spaceLine,""));y;){let $;if(this.options.extensions?.block?.some((Y)=>($=Y.call({lexer:this},y,N))?(y=y.substring($.raw.length),N.push($),!0):!1))continue;if($=this.tokenizer.space(y)){y=y.substring($.raw.length);let Y=N.at(-1);$.raw.length===1&&Y!==void 0?Y.raw+=`
|
|
32
|
+
`:N.push($);continue}if($=this.tokenizer.code(y)){y=y.substring($.raw.length);let Y=N.at(-1);Y?.type==="paragraph"||Y?.type==="text"?(Y.raw+=(Y.raw.endsWith(`
|
|
33
|
+
`)?"":`
|
|
34
|
+
`)+$.raw,Y.text+=`
|
|
35
|
+
`+$.text,this.inlineQueue.at(-1).src=Y.text):N.push($);continue}if($=this.tokenizer.fences(y)){y=y.substring($.raw.length),N.push($);continue}if($=this.tokenizer.heading(y)){y=y.substring($.raw.length),N.push($);continue}if($=this.tokenizer.hr(y)){y=y.substring($.raw.length),N.push($);continue}if($=this.tokenizer.blockquote(y)){y=y.substring($.raw.length),N.push($);continue}if($=this.tokenizer.list(y)){y=y.substring($.raw.length),N.push($);continue}if($=this.tokenizer.html(y)){y=y.substring($.raw.length),N.push($);continue}if($=this.tokenizer.def(y)){y=y.substring($.raw.length);let Y=N.at(-1);Y?.type==="paragraph"||Y?.type==="text"?(Y.raw+=(Y.raw.endsWith(`
|
|
36
|
+
`)?"":`
|
|
37
|
+
`)+$.raw,Y.text+=`
|
|
38
|
+
`+$.raw,this.inlineQueue.at(-1).src=Y.text):this.tokens.links[$.tag]||(this.tokens.links[$.tag]={href:$.href,title:$.title},N.push($));continue}if($=this.tokenizer.table(y)){y=y.substring($.raw.length),N.push($);continue}if($=this.tokenizer.lheading(y)){y=y.substring($.raw.length),N.push($);continue}let Q=y;if(this.options.extensions?.startBlock){let Y=1/0,f=y.slice(1),W;this.options.extensions.startBlock.forEach((K)=>{W=K.call({lexer:this},f),typeof W=="number"&&W>=0&&(Y=Math.min(Y,W))}),Y<1/0&&Y>=0&&(Q=y.substring(0,Y+1))}if(this.state.top&&($=this.tokenizer.paragraph(Q))){let Y=N.at(-1);J&&Y?.type==="paragraph"?(Y.raw+=(Y.raw.endsWith(`
|
|
39
|
+
`)?"":`
|
|
40
|
+
`)+$.raw,Y.text+=`
|
|
41
|
+
`+$.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=Y.text):N.push($),J=Q.length!==y.length,y=y.substring($.raw.length);continue}if($=this.tokenizer.text(y)){y=y.substring($.raw.length);let Y=N.at(-1);Y?.type==="text"?(Y.raw+=(Y.raw.endsWith(`
|
|
42
|
+
`)?"":`
|
|
43
|
+
`)+$.raw,Y.text+=`
|
|
44
|
+
`+$.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=Y.text):N.push($);continue}if(y){let Y="Infinite loop on byte: "+y.charCodeAt(0);if(this.options.silent){console.error(Y);break}else throw Error(Y)}}return this.state.top=!0,N}inline(y,N=[]){return this.inlineQueue.push({src:y,tokens:N}),N}inlineTokens(y,N=[]){let J=y,$=null;if(this.tokens.links){let W=Object.keys(this.tokens.links);if(W.length>0)for(;($=this.tokenizer.rules.inline.reflinkSearch.exec(J))!=null;)W.includes($[0].slice($[0].lastIndexOf("[")+1,-1))&&(J=J.slice(0,$.index)+"["+"a".repeat($[0].length-2)+"]"+J.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;($=this.tokenizer.rules.inline.anyPunctuation.exec(J))!=null;)J=J.slice(0,$.index)+"++"+J.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let Q;for(;($=this.tokenizer.rules.inline.blockSkip.exec(J))!=null;)Q=$[2]?$[2].length:0,J=J.slice(0,$.index+Q)+"["+"a".repeat($[0].length-Q-2)+"]"+J.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);J=this.options.hooks?.emStrongMask?.call({lexer:this},J)??J;let Y=!1,f="";for(;y;){Y||(f=""),Y=!1;let W;if(this.options.extensions?.inline?.some((X)=>(W=X.call({lexer:this},y,N))?(y=y.substring(W.raw.length),N.push(W),!0):!1))continue;if(W=this.tokenizer.escape(y)){y=y.substring(W.raw.length),N.push(W);continue}if(W=this.tokenizer.tag(y)){y=y.substring(W.raw.length),N.push(W);continue}if(W=this.tokenizer.link(y)){y=y.substring(W.raw.length),N.push(W);continue}if(W=this.tokenizer.reflink(y,this.tokens.links)){y=y.substring(W.raw.length);let X=N.at(-1);W.type==="text"&&X?.type==="text"?(X.raw+=W.raw,X.text+=W.text):N.push(W);continue}if(W=this.tokenizer.emStrong(y,J,f)){y=y.substring(W.raw.length),N.push(W);continue}if(W=this.tokenizer.codespan(y)){y=y.substring(W.raw.length),N.push(W);continue}if(W=this.tokenizer.br(y)){y=y.substring(W.raw.length),N.push(W);continue}if(W=this.tokenizer.del(y,J,f)){y=y.substring(W.raw.length),N.push(W);continue}if(W=this.tokenizer.autolink(y)){y=y.substring(W.raw.length),N.push(W);continue}if(!this.state.inLink&&(W=this.tokenizer.url(y))){y=y.substring(W.raw.length),N.push(W);continue}let K=y;if(this.options.extensions?.startInline){let X=1/0,b=y.slice(1),P;this.options.extensions.startInline.forEach((U)=>{P=U.call({lexer:this},b),typeof P=="number"&&P>=0&&(X=Math.min(X,P))}),X<1/0&&X>=0&&(K=y.substring(0,X+1))}if(W=this.tokenizer.inlineText(K)){y=y.substring(W.raw.length),W.raw.slice(-1)!=="_"&&(f=W.raw.slice(-1)),Y=!0;let X=N.at(-1);X?.type==="text"?(X.raw+=W.raw,X.text+=W.text):N.push(W);continue}if(y){let X="Infinite loop on byte: "+y.charCodeAt(0);if(this.options.silent){console.error(X);break}else throw Error(X)}}return N}},Hy=class{options;parser;constructor(B){this.options=B||a}space(B){return""}code({text:B,lang:y,escaped:N}){let J=(y||"").match(R.notSpaceStart)?.[0],$=B.replace(R.endingNewline,"")+`
|
|
45
|
+
`;return J?'<pre><code class="language-'+d(J)+'">'+(N?$:d($,!0))+`</code></pre>
|
|
46
|
+
`:"<pre><code>"+(N?$:d($,!0))+`</code></pre>
|
|
47
|
+
`}blockquote({tokens:B}){return`<blockquote>
|
|
48
|
+
${this.parser.parse(B)}</blockquote>
|
|
49
|
+
`}html({text:B}){return B}def(B){return""}heading({tokens:B,depth:y}){return`<h${y}>${this.parser.parseInline(B)}</h${y}>
|
|
50
|
+
`}hr(B){return`<hr>
|
|
51
|
+
`}list(B){let{ordered:y,start:N}=B,J="";for(let Y=0;Y<B.items.length;Y++){let f=B.items[Y];J+=this.listitem(f)}let $=y?"ol":"ul",Q=y&&N!==1?' start="'+N+'"':"";return"<"+$+Q+`>
|
|
52
|
+
`+J+"</"+$+`>
|
|
53
|
+
`}listitem(B){return`<li>${this.parser.parse(B.tokens)}</li>
|
|
54
|
+
`}checkbox({checked:B}){return"<input "+(B?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:B}){return`<p>${this.parser.parseInline(B)}</p>
|
|
55
|
+
`}table(B){let y="",N="";for(let $=0;$<B.header.length;$++)N+=this.tablecell(B.header[$]);y+=this.tablerow({text:N});let J="";for(let $=0;$<B.rows.length;$++){let Q=B.rows[$];N="";for(let Y=0;Y<Q.length;Y++)N+=this.tablecell(Q[Y]);J+=this.tablerow({text:N})}return J&&(J=`<tbody>${J}</tbody>`),`<table>
|
|
56
|
+
<thead>
|
|
57
|
+
`+y+`</thead>
|
|
58
|
+
`+J+`</table>
|
|
59
|
+
`}tablerow({text:B}){return`<tr>
|
|
60
|
+
${B}</tr>
|
|
61
|
+
`}tablecell(B){let y=this.parser.parseInline(B.tokens),N=B.header?"th":"td";return(B.align?`<${N} align="${B.align}">`:`<${N}>`)+y+`</${N}>
|
|
62
|
+
`}strong({tokens:B}){return`<strong>${this.parser.parseInline(B)}</strong>`}em({tokens:B}){return`<em>${this.parser.parseInline(B)}</em>`}codespan({text:B}){return`<code>${d(B,!0)}</code>`}br(B){return"<br>"}del({tokens:B}){return`<del>${this.parser.parseInline(B)}</del>`}link({href:B,title:y,tokens:N}){let J=this.parser.parseInline(N),$=N1(B);if($===null)return J;B=$;let Q='<a href="'+B+'"';return y&&(Q+=' title="'+d(y)+'"'),Q+=">"+J+"</a>",Q}image({href:B,title:y,text:N,tokens:J}){J&&(N=this.parser.parseInline(J,this.parser.textRenderer));let $=N1(B);if($===null)return d(N);B=$;let Q=`<img src="${B}" alt="${d(N)}"`;return y&&(Q+=` title="${d(y)}"`),Q+=">",Q}text(B){return"tokens"in B&&B.tokens?this.parser.parseInline(B.tokens):("escaped"in B)&&B.escaped?B.text:d(B.text)}},Ry=class{strong({text:B}){return B}em({text:B}){return B}codespan({text:B}){return B}del({text:B}){return B}html({text:B}){return B}text({text:B}){return B}link({text:B}){return""+B}image({text:B}){return""+B}br(){return""}checkbox({raw:B}){return B}},V=class B{options;renderer;textRenderer;constructor(y){this.options=y||a,this.options.renderer=this.options.renderer||new Hy,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ry}static parse(y,N){return new B(N).parse(y)}static parseInline(y,N){return new B(N).parseInline(y)}parse(y){let N="";for(let J=0;J<y.length;J++){let $=y[J];if(this.options.extensions?.renderers?.[$.type]){let Y=$,f=this.options.extensions.renderers[Y.type].call({parser:this},Y);if(f!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(Y.type)){N+=f||"";continue}}let Q=$;switch(Q.type){case"space":{N+=this.renderer.space(Q);break}case"hr":{N+=this.renderer.hr(Q);break}case"heading":{N+=this.renderer.heading(Q);break}case"code":{N+=this.renderer.code(Q);break}case"table":{N+=this.renderer.table(Q);break}case"blockquote":{N+=this.renderer.blockquote(Q);break}case"list":{N+=this.renderer.list(Q);break}case"checkbox":{N+=this.renderer.checkbox(Q);break}case"html":{N+=this.renderer.html(Q);break}case"def":{N+=this.renderer.def(Q);break}case"paragraph":{N+=this.renderer.paragraph(Q);break}case"text":{N+=this.renderer.text(Q);break}default:{let Y='Token with "'+Q.type+'" type was not found.';if(this.options.silent)return console.error(Y),"";throw Error(Y)}}}return N}parseInline(y,N=this.renderer){let J="";for(let $=0;$<y.length;$++){let Q=y[$];if(this.options.extensions?.renderers?.[Q.type]){let f=this.options.extensions.renderers[Q.type].call({parser:this},Q);if(f!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(Q.type)){J+=f||"";continue}}let Y=Q;switch(Y.type){case"escape":{J+=N.text(Y);break}case"html":{J+=N.html(Y);break}case"link":{J+=N.link(Y);break}case"image":{J+=N.image(Y);break}case"checkbox":{J+=N.checkbox(Y);break}case"strong":{J+=N.strong(Y);break}case"em":{J+=N.em(Y);break}case"codespan":{J+=N.codespan(Y);break}case"br":{J+=N.br(Y);break}case"del":{J+=N.del(Y);break}case"text":{J+=N.text(Y);break}default:{let f='Token with "'+Y.type+'" type was not found.';if(this.options.silent)return console.error(f),"";throw Error(f)}}}return J}},Jy=class{options;block;constructor(B){this.options=B||a}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(B){return B}postprocess(B){return B}processAllTokens(B){return B}emStrongMask(B){return B}provideLexer(){return this.block?j.lex:j.lexInline}provideParser(){return this.block?V.parse:V.parseInline}},n0=class{defaults=wy();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=V;Renderer=Hy;TextRenderer=Ry;Lexer=j;Tokenizer=Py;Hooks=Jy;constructor(...B){this.use(...B)}walkTokens(B,y){let N=[];for(let J of B)switch(N=N.concat(y.call(this,J)),J.type){case"table":{let $=J;for(let Q of $.header)N=N.concat(this.walkTokens(Q.tokens,y));for(let Q of $.rows)for(let Y of Q)N=N.concat(this.walkTokens(Y.tokens,y));break}case"list":{let $=J;N=N.concat(this.walkTokens($.items,y));break}default:{let $=J;this.defaults.extensions?.childTokens?.[$.type]?this.defaults.extensions.childTokens[$.type].forEach((Q)=>{let Y=$[Q].flat(1/0);N=N.concat(this.walkTokens(Y,y))}):$.tokens&&(N=N.concat(this.walkTokens($.tokens,y)))}}return N}use(...B){let y=this.defaults.extensions||{renderers:{},childTokens:{}};return B.forEach((N)=>{let J={...N};if(J.async=this.defaults.async||J.async||!1,N.extensions&&(N.extensions.forEach(($)=>{if(!$.name)throw Error("extension name required");if("renderer"in $){let Q=y.renderers[$.name];Q?y.renderers[$.name]=function(...Y){let f=$.renderer.apply(this,Y);return f===!1&&(f=Q.apply(this,Y)),f}:y.renderers[$.name]=$.renderer}if("tokenizer"in $){if(!$.level||$.level!=="block"&&$.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let Q=y[$.level];Q?Q.unshift($.tokenizer):y[$.level]=[$.tokenizer],$.start&&($.level==="block"?y.startBlock?y.startBlock.push($.start):y.startBlock=[$.start]:$.level==="inline"&&(y.startInline?y.startInline.push($.start):y.startInline=[$.start]))}"childTokens"in $&&$.childTokens&&(y.childTokens[$.name]=$.childTokens)}),J.extensions=y),N.renderer){let $=this.defaults.renderer||new Hy(this.defaults);for(let Q in N.renderer){if(!(Q in $))throw Error(`renderer '${Q}' does not exist`);if(["options","parser"].includes(Q))continue;let Y=Q,f=N.renderer[Y],W=$[Y];$[Y]=(...K)=>{let X=f.apply($,K);return X===!1&&(X=W.apply($,K)),X||""}}J.renderer=$}if(N.tokenizer){let $=this.defaults.tokenizer||new Py(this.defaults);for(let Q in N.tokenizer){if(!(Q in $))throw Error(`tokenizer '${Q}' does not exist`);if(["options","rules","lexer"].includes(Q))continue;let Y=Q,f=N.tokenizer[Y],W=$[Y];$[Y]=(...K)=>{let X=f.apply($,K);return X===!1&&(X=W.apply($,K)),X}}J.tokenizer=$}if(N.hooks){let $=this.defaults.hooks||new Jy;for(let Q in N.hooks){if(!(Q in $))throw Error(`hook '${Q}' does not exist`);if(["options","block"].includes(Q))continue;let Y=Q,f=N.hooks[Y],W=$[Y];Jy.passThroughHooks.has(Q)?$[Y]=(K)=>{if(this.defaults.async&&Jy.passThroughHooksRespectAsync.has(Q))return(async()=>{let b=await f.call($,K);return W.call($,b)})();let X=f.call($,K);return W.call($,X)}:$[Y]=(...K)=>{if(this.defaults.async)return(async()=>{let b=await f.apply($,K);return b===!1&&(b=await W.apply($,K)),b})();let X=f.apply($,K);return X===!1&&(X=W.apply($,K)),X}}J.hooks=$}if(N.walkTokens){let $=this.defaults.walkTokens,Q=N.walkTokens;J.walkTokens=function(Y){let f=[];return f.push(Q.call(this,Y)),$&&(f=f.concat($.call(this,Y))),f}}this.defaults={...this.defaults,...J}}),this}setOptions(B){return this.defaults={...this.defaults,...B},this}lexer(B,y){return j.lex(B,y??this.defaults)}parser(B,y){return V.parse(B,y??this.defaults)}parseMarkdown(B){return(y,N)=>{let J={...N},$={...this.defaults,...J},Q=this.onError(!!$.silent,!!$.async);if(this.defaults.async===!0&&J.async===!1)return Q(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof y>"u"||y===null)return Q(Error("marked(): input parameter is undefined or null"));if(typeof y!="string")return Q(Error("marked(): input parameter is of type "+Object.prototype.toString.call(y)+", string expected"));if($.hooks&&($.hooks.options=$,$.hooks.block=B),$.async)return(async()=>{let Y=$.hooks?await $.hooks.preprocess(y):y,f=await($.hooks?await $.hooks.provideLexer():B?j.lex:j.lexInline)(Y,$),W=$.hooks?await $.hooks.processAllTokens(f):f;$.walkTokens&&await Promise.all(this.walkTokens(W,$.walkTokens));let K=await($.hooks?await $.hooks.provideParser():B?V.parse:V.parseInline)(W,$);return $.hooks?await $.hooks.postprocess(K):K})().catch(Q);try{$.hooks&&(y=$.hooks.preprocess(y));let Y=($.hooks?$.hooks.provideLexer():B?j.lex:j.lexInline)(y,$);$.hooks&&(Y=$.hooks.processAllTokens(Y)),$.walkTokens&&this.walkTokens(Y,$.walkTokens);let f=($.hooks?$.hooks.provideParser():B?V.parse:V.parseInline)(Y,$);return $.hooks&&(f=$.hooks.postprocess(f)),f}catch(Y){return Q(Y)}}}onError(B,y){return(N)=>{if(N.message+=`
|
|
63
|
+
Please report this to https://github.com/markedjs/marked.`,B){let J="<p>An error occurred:</p><pre>"+d(N.message+"",!0)+"</pre>";return y?Promise.resolve(J):J}if(y)return Promise.reject(N);throw N}}},i=new n0;function M(B,y){return i.parse(B,y)}M.options=M.setOptions=function(B){return i.setOptions(B),M.defaults=i.defaults,Y1(M.defaults),M};M.getDefaults=wy;M.defaults=a;M.use=function(...B){return i.use(...B),M.defaults=i.defaults,Y1(M.defaults),M};M.walkTokens=function(B,y){return i.walkTokens(B,y)};M.parseInline=i.parseInline;M.Parser=V;M.parser=V.parse;M.Renderer=Hy;M.TextRenderer=Ry;M.Lexer=j;M.lexer=j.lex;M.Tokenizer=Py;M.Hooks=Jy;M.parse=M;var{options:X2,setOptions:L2,use:b2,walkTokens:P2,parseInline:H2}=M;var U2=V.parse,q2=j.lex;import{jsxDEV as G1}from"react/jsx-dev-runtime";M.setOptions({gfm:!0,breaks:!1});function e0({children:B,file:y,__content:N}){let J=N??(typeof B==="string"?B:String(B??"")),$=t0(()=>{if(!J)return"";return M.parse(J,{async:!1})},[J]);if(!J)return G1("div",{className:"text-text-tertiary text-tiny mt-3",children:y?`Could not load: ${y}`:"No markdown content"},void 0,!1,void 0,this);return G1("div",{className:"mt-3 prose-canvas","data-md":"markdown",...y?{"data-md-file":y}:{},"data-md-source":J,dangerouslySetInnerHTML:{__html:$}},void 0,!1,void 0,this)}import{useFeedback as r2}from"#canvas/runtime";export{r2 as useFeedback,N0 as UserInput,z1 as Task,h1 as Table,Z1 as Section,J0 as RangeInput,V1 as Priority,S1 as Note,$0 as MultiChoice,s1 as Mermaid,e0 as Markdown,gy as Item,f0 as ImageView,u1 as FilePreview,t1 as Diff,C1 as CodeBlock,y0 as Choice,D1 as Checklist,R1 as Callout};
|
package/daemon/dist/index.html
CHANGED
|
@@ -83,21 +83,14 @@
|
|
|
83
83
|
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/highlight.min.js"></script>
|
|
84
84
|
<script src="https://unpkg.com/mermaid@11.4.1/dist/mermaid.min.js"></script>
|
|
85
85
|
<script>mermaid.initialize({ startOnLoad: false, theme: document.documentElement.dataset.theme === 'light' ? 'default' : 'dark' });</script>
|
|
86
|
-
<script src="https://unpkg.com/react@18.3.1/umd/react.production.min.js"></script>
|
|
87
|
-
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js"></script>
|
|
88
|
-
<script>
|
|
89
|
-
// Create ESM modules from UMD globals
|
|
90
|
-
window.__REACT_ESM__ = Object.keys(React).reduce((m, k) => { m[k] = React[k]; return m; }, { default: React, __esModule: true });
|
|
91
|
-
window.__REACT_DOM_ESM__ = Object.keys(ReactDOM).reduce((m, k) => { m[k] = ReactDOM[k]; return m; }, { default: ReactDOM, __esModule: true });
|
|
92
|
-
</script>
|
|
93
86
|
<script type="importmap">
|
|
94
87
|
{
|
|
95
88
|
"imports": {
|
|
96
|
-
"react": "/assets/
|
|
97
|
-
"react-dom": "/assets/
|
|
98
|
-
"react-dom/client": "/assets/
|
|
99
|
-
"react/jsx-runtime": "/assets/jsx-runtime
|
|
100
|
-
"react/jsx-dev-runtime": "/assets/jsx-
|
|
89
|
+
"react": "/assets/preact-compat.js",
|
|
90
|
+
"react-dom": "/assets/preact-compat.js",
|
|
91
|
+
"react-dom/client": "/assets/preact-compat.js",
|
|
92
|
+
"react/jsx-runtime": "/assets/jsx-runtime.js",
|
|
93
|
+
"react/jsx-dev-runtime": "/assets/jsx-runtime.js",
|
|
101
94
|
"#canvas/components": "/assets/components.js",
|
|
102
95
|
"#canvas/runtime": "/assets/runtime.js"
|
|
103
96
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p,V,b0,z1,M,M0,m0,S0,_0,J0,Z0,G0,k0,i={},r=[],B1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,s=Array.isArray;function d(X,Y){for(var Z in Y)X[Z]=Y[Z];return X}function K0(X){X&&X.parentNode&&X.parentNode.removeChild(X)}function I(X,Y,Z){var G,W,Q,J={};for(Q in Y)Q=="key"?G=Y[Q]:Q=="ref"?W=Y[Q]:J[Q]=Y[Q];if(arguments.length>2&&(J.children=arguments.length>3?p.call(arguments,2):Z),typeof X=="function"&&X.defaultProps!=null)for(Q in X.defaultProps)J[Q]===void 0&&(J[Q]=X.defaultProps[Q]);return w(X,J,G,W,null)}function w(X,Y,Z,G,W){var Q={type:X,props:Y,key:Z,ref:G,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:W==null?++b0:W,__i:-1,__u:0};return W==null&&V.vnode!=null&&V.vnode(Q),Q}function O0(){return{current:null}}function z(X){return X.children}function B(X,Y){this.props=X,this.context=Y}function m(X,Y){if(Y==null)return X.__?m(X.__,X.__i+1):null;for(var Z;Y<X.__k.length;Y++)if((Z=X.__k[Y])!=null&&Z.__e!=null)return Z.__e;return typeof X.type=="function"?m(X):null}function L1(X){if(X.__P&&X.__d){var Y=X.__v,Z=Y.__e,G=[],W=[],Q=d({},Y);Q.__v=Y.__v+1,V.vnode&&V.vnode(Q),A0(X.__P,Q,Y,X.__n,X.__P.namespaceURI,32&Y.__u?[Z]:null,G,Z==null?m(Y):Z,!!(32&Y.__u),W),Q.__v=Y.__v,Q.__.__k[Q.__i]=Q,s0(G,Q,W),Y.__e=Y.__=null,Q.__e!=Z&&y0(Q)}}function y0(X){if((X=X.__)!=null&&X.__c!=null)return X.__e=X.__c.base=null,X.__k.some(function(Y){if(Y!=null&&Y.__e!=null)return X.__e=X.__c.base=Y.__e}),y0(X)}function Q0(X){(!X.__d&&(X.__d=!0)&&M.push(X)&&!e.__r++||M0!=V.debounceRendering)&&((M0=V.debounceRendering)||m0)(e)}function e(){try{for(var X,Y=1;M.length;)M.length>Y&&M.sort(S0),X=M.shift(),Y=M.length,L1(X)}finally{M.length=e.__r=0}}function w0(X,Y,Z,G,W,Q,J,A,N,O,E){var K,R,q,H,L,P,F,D=G&&G.__k||r,v=Y.length;for(N=I1(Z,Y,D,N,v),K=0;K<v;K++)(q=Z.__k[K])!=null&&(R=q.__i!=-1&&D[q.__i]||i,q.__i=K,P=A0(X,q,R,W,Q,J,A,N,O,E),H=q.__e,q.ref&&R.ref!=q.ref&&(R.ref&&N0(R.ref,null,q),E.push(q.ref,q.__c||H,q)),L==null&&H!=null&&(L=H),(F=!!(4&q.__u))||R.__k===q.__k?N=p0(q,N,X,F):typeof q.type=="function"&&P!==void 0?N=P:H&&(N=H.nextSibling),q.__u&=-7);return Z.__e=L,N}function I1(X,Y,Z,G,W){var Q,J,A,N,O,E=Z.length,K=E,R=0;for(X.__k=Array(W),Q=0;Q<W;Q++)(J=Y[Q])!=null&&typeof J!="boolean"&&typeof J!="function"?(typeof J=="string"||typeof J=="number"||typeof J=="bigint"||J.constructor==String?J=X.__k[Q]=w(null,J,null,null,null):s(J)?J=X.__k[Q]=w(z,{children:J},null,null,null):J.constructor===void 0&&J.__b>0?J=X.__k[Q]=w(J.type,J.props,J.key,J.ref?J.ref:null,J.__v):X.__k[Q]=J,N=Q+R,J.__=X,J.__b=X.__b+1,A=null,(O=J.__i=$1(J,Z,N,K))!=-1&&(K--,(A=Z[O])&&(A.__u|=2)),A==null||A.__v==null?(O==-1&&(W>E?R--:W<E&&R++),typeof J.type!="function"&&(J.__u|=4)):O!=N&&(O==N-1?R--:O==N+1?R++:(O>N?R--:R++,J.__u|=4))):X.__k[Q]=null;if(K)for(Q=0;Q<E;Q++)(A=Z[Q])!=null&&(2&A.__u)==0&&(A.__e==G&&(G=m(A)),a0(A,A));return G}function p0(X,Y,Z,G){var W,Q;if(typeof X.type=="function"){for(W=X.__k,Q=0;W&&Q<W.length;Q++)W[Q]&&(W[Q].__=X,Y=p0(W[Q],Y,Z,G));return Y}X.__e!=Y&&(G&&(Y&&X.type&&!Y.parentNode&&(Y=m(X)),Z.insertBefore(X.__e,Y||null)),Y=X.__e);do Y=Y&&Y.nextSibling;while(Y!=null&&Y.nodeType==8);return Y}function x(X,Y){return Y=Y||[],X==null||typeof X=="boolean"||(s(X)?X.some(function(Z){x(Z,Y)}):Y.push(X)),Y}function $1(X,Y,Z,G){var W,Q,J,A=X.key,N=X.type,O=Y[Z],E=O!=null&&(2&O.__u)==0;if(O===null&&A==null||E&&A==O.key&&N==O.type)return Z;if(G>(E?1:0)){for(W=Z-1,Q=Z+1;W>=0||Q<Y.length;)if((O=Y[J=W>=0?W--:Q++])!=null&&(2&O.__u)==0&&A==O.key&&N==O.type)return J}return-1}function C0(X,Y,Z){Y[0]=="-"?X.setProperty(Y,Z==null?"":Z):X[Y]=Z==null?"":typeof Z!="number"||B1.test(Y)?Z:Z+"px"}function o(X,Y,Z,G,W){var Q,J;X:if(Y=="style")if(typeof Z=="string")X.style.cssText=Z;else{if(typeof G=="string"&&(X.style.cssText=G=""),G)for(Y in G)Z&&Y in Z||C0(X.style,Y,"");if(Z)for(Y in Z)G&&Z[Y]==G[Y]||C0(X.style,Y,Z[Y])}else if(Y[0]=="o"&&Y[1]=="n")Q=Y!=(Y=Y.replace(_0,"$1")),J=Y.toLowerCase(),Y=J in X||Y=="onFocusOut"||Y=="onFocusIn"?J.slice(2):Y.slice(2),X.l||(X.l={}),X.l[Y+Q]=Z,Z?G?Z.u=G.u:(Z.u=J0,X.addEventListener(Y,Q?G0:Z0,Q)):X.removeEventListener(Y,Q?G0:Z0,Q);else{if(W=="http://www.w3.org/2000/svg")Y=Y.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(Y!="width"&&Y!="height"&&Y!="href"&&Y!="list"&&Y!="form"&&Y!="tabIndex"&&Y!="download"&&Y!="rowSpan"&&Y!="colSpan"&&Y!="role"&&Y!="popover"&&Y in X)try{X[Y]=Z==null?"":Z;break X}catch(A){}typeof Z=="function"||(Z==null||Z===!1&&Y[4]!="-"?X.removeAttribute(Y):X.setAttribute(Y,Y=="popover"&&Z==1?"":Z))}}function T0(X){return function(Y){if(this.l){var Z=this.l[Y.type+X];if(Y.t==null)Y.t=J0++;else if(Y.t<Z.u)return;return Z(V.event?V.event(Y):Y)}}}function A0(X,Y,Z,G,W,Q,J,A,N,O){var E,K,R,q,H,L,P,F,D,v,C,y,v0,c,Y0,$=Y.type;if(Y.constructor!==void 0)return null;128&Z.__u&&(N=!!(32&Z.__u),Q=[A=Y.__e=Z.__e]),(E=V.__b)&&E(Y);X:if(typeof $=="function")try{if(F=Y.props,D=$.prototype&&$.prototype.render,v=(E=$.contextType)&&G[E.__c],C=E?v?v.props.value:E.__:G,Z.__c?P=(K=Y.__c=Z.__c).__=K.__E:(D?Y.__c=K=new $(F,C):(Y.__c=K=new B(F,C),K.constructor=$,K.render=x1),v&&v.sub(K),K.state||(K.state={}),K.__n=G,R=K.__d=!0,K.__h=[],K._sb=[]),D&&K.__s==null&&(K.__s=K.state),D&&$.getDerivedStateFromProps!=null&&(K.__s==K.state&&(K.__s=d({},K.__s)),d(K.__s,$.getDerivedStateFromProps(F,K.__s))),q=K.props,H=K.state,K.__v=Y,R)D&&$.getDerivedStateFromProps==null&&K.componentWillMount!=null&&K.componentWillMount(),D&&K.componentDidMount!=null&&K.__h.push(K.componentDidMount);else{if(D&&$.getDerivedStateFromProps==null&&F!==q&&K.componentWillReceiveProps!=null&&K.componentWillReceiveProps(F,C),Y.__v==Z.__v||!K.__e&&K.shouldComponentUpdate!=null&&K.shouldComponentUpdate(F,K.__s,C)===!1){Y.__v!=Z.__v&&(K.props=F,K.state=K.__s,K.__d=!1),Y.__e=Z.__e,Y.__k=Z.__k,Y.__k.some(function(b){b&&(b.__=Y)}),r.push.apply(K.__h,K._sb),K._sb=[],K.__h.length&&J.push(K);break X}K.componentWillUpdate!=null&&K.componentWillUpdate(F,K.__s,C),D&&K.componentDidUpdate!=null&&K.__h.push(function(){K.componentDidUpdate(q,H,L)})}if(K.context=C,K.props=F,K.__P=X,K.__e=!1,y=V.__r,v0=0,D)K.state=K.__s,K.__d=!1,y&&y(Y),E=K.render(K.props,K.state,K.context),r.push.apply(K.__h,K._sb),K._sb=[];else do K.__d=!1,y&&y(Y),E=K.render(K.props,K.state,K.context),K.state=K.__s;while(K.__d&&++v0<25);K.state=K.__s,K.getChildContext!=null&&(G=d(d({},G),K.getChildContext())),D&&!R&&K.getSnapshotBeforeUpdate!=null&&(L=K.getSnapshotBeforeUpdate(q,H)),c=E!=null&&E.type===z&&E.key==null?f0(E.props.children):E,A=w0(X,s(c)?c:[c],Y,Z,G,W,Q,J,A,N,O),K.base=Y.__e,Y.__u&=-161,K.__h.length&&J.push(K),P&&(K.__E=K.__=null)}catch(b){if(Y.__v=null,N||Q!=null)if(b.then){for(Y.__u|=N?160:128;A&&A.nodeType==8&&A.nextSibling;)A=A.nextSibling;Q[Q.indexOf(A)]=null,Y.__e=A}else{for(Y0=Q.length;Y0--;)K0(Q[Y0]);W0(Y)}else Y.__e=Z.__e,Y.__k=Z.__k,b.then||W0(Y);V.__e(b,Y,Z)}else Q==null&&Y.__v==Z.__v?(Y.__k=Z.__k,Y.__e=Z.__e):A=Y.__e=d1(Z.__e,Y,Z,G,W,Q,J,N,O);return(E=V.diffed)&&E(Y),128&Y.__u?void 0:A}function W0(X){X&&(X.__c&&(X.__c.__e=!0),X.__k&&X.__k.some(W0))}function s0(X,Y,Z){for(var G=0;G<Z.length;G++)N0(Z[G],Z[++G],Z[++G]);V.__c&&V.__c(Y,X),X.some(function(W){try{X=W.__h,W.__h=[],X.some(function(Q){Q.call(W)})}catch(Q){V.__e(Q,W.__v)}})}function f0(X){return typeof X!="object"||X==null||X.__b>0?X:s(X)?X.map(f0):d({},X)}function d1(X,Y,Z,G,W,Q,J,A,N){var O,E,K,R,q,H,L,P=Z.props||i,F=Y.props,D=Y.type;if(D=="svg"?W="http://www.w3.org/2000/svg":D=="math"?W="http://www.w3.org/1998/Math/MathML":W||(W="http://www.w3.org/1999/xhtml"),Q!=null){for(O=0;O<Q.length;O++)if((q=Q[O])&&"setAttribute"in q==!!D&&(D?q.localName==D:q.nodeType==3)){X=q,Q[O]=null;break}}if(X==null){if(D==null)return document.createTextNode(F);X=document.createElementNS(W,D,F.is&&F),A&&(V.__m&&V.__m(Y,Q),A=!1),Q=null}if(D==null)P===F||A&&X.data==F||(X.data=F);else{if(Q=Q&&p.call(X.childNodes),!A&&Q!=null)for(P={},O=0;O<X.attributes.length;O++)P[(q=X.attributes[O]).name]=q.value;for(O in P)q=P[O],O=="dangerouslySetInnerHTML"?K=q:O=="children"||(O in F)||O=="value"&&("defaultValue"in F)||O=="checked"&&("defaultChecked"in F)||o(X,O,null,q,W);for(O in F)q=F[O],O=="children"?R=q:O=="dangerouslySetInnerHTML"?E=q:O=="value"?H=q:O=="checked"?L=q:A&&typeof q!="function"||P[O]===q||o(X,O,q,P[O],W);if(E)A||K&&(E.__html==K.__html||E.__html==X.innerHTML)||(X.innerHTML=E.__html),Y.__k=[];else if(K&&(X.innerHTML=""),w0(Y.type=="template"?X.content:X,s(R)?R:[R],Y,Z,G,D=="foreignObject"?"http://www.w3.org/1999/xhtml":W,Q,J,Q?Q[0]:Z.__k&&m(Z,0),A,N),Q!=null)for(O=Q.length;O--;)K0(Q[O]);A||(O="value",D=="progress"&&H==null?X.removeAttribute("value"):H!=null&&(H!==X[O]||D=="progress"&&!H||D=="option"&&H!=P[O])&&o(X,O,H,P[O],W),O="checked",L!=null&&L!=X[O]&&o(X,O,L,P[O],W))}return X}function N0(X,Y,Z){try{if(typeof X=="function"){var G=typeof X.__u=="function";G&&X.__u(),G&&Y==null||(X.__u=X(Y))}else X.current=Y}catch(W){V.__e(W,Z)}}function a0(X,Y,Z){var G,W;if(V.unmount&&V.unmount(X),(G=X.ref)&&(G.current&&G.current!=X.__e||N0(G,null,Y)),(G=X.__c)!=null){if(G.componentWillUnmount)try{G.componentWillUnmount()}catch(Q){V.__e(Q,Y)}G.base=G.__P=null}if(G=X.__k)for(W=0;W<G.length;W++)G[W]&&a0(G[W],Y,Z||typeof X.type!="function");Z||K0(X.__e),X.__c=X.__=X.__e=void 0}function x1(X,Y,Z){return this.constructor(X,Z)}function S(X,Y,Z){var G,W,Q,J;Y==document&&(Y=document.documentElement),V.__&&V.__(X,Y),W=(G=typeof Z=="function")?null:Z&&Z.__k||Y.__k,Q=[],J=[],A0(Y,X=(!G&&Z||Y).__k=I(z,null,[X]),W||i,i,Y.namespaceURI,!G&&Z?[Z]:W?null:Y.firstChild?p.call(Y.childNodes):null,Q,!G&&Z?Z:W?W.__e:Y.firstChild,G,J),s0(Q,X,J)}function V0(X,Y){S(X,Y,V0)}function h0(X,Y,Z){var G,W,Q,J,A=d({},X.props);for(Q in X.type&&X.type.defaultProps&&(J=X.type.defaultProps),Y)Q=="key"?G=Y[Q]:Q=="ref"?W=Y[Q]:A[Q]=Y[Q]===void 0&&J!=null?J[Q]:Y[Q];return arguments.length>2&&(A.children=arguments.length>3?p.call(arguments,2):Z),w(X.type,A,G||X.key,W||X.ref,null)}function q0(X){function Y(Z){var G,W;return this.getChildContext||(G=new Set,(W={})[Y.__c]=this,this.getChildContext=function(){return W},this.componentWillUnmount=function(){G=null},this.shouldComponentUpdate=function(Q){this.props.value!=Q.value&&G.forEach(function(J){J.__e=!0,Q0(J)})},this.sub=function(Q){G.add(Q);var J=Q.componentWillUnmount;Q.componentWillUnmount=function(){G&&G.delete(Q),J&&J.call(Q)}}),Z.children}return Y.__c="__cC"+k0++,Y.__=X,Y.Provider=Y.__l=(Y.Consumer=function(Z,G){return Z.children(G)}).contextType=Y,Y}p=r.slice,V={__e:function(X,Y,Z,G){for(var W,Q,J;Y=Y.__;)if((W=Y.__c)&&!W.__)try{if((Q=W.constructor)&&Q.getDerivedStateFromError!=null&&(W.setState(Q.getDerivedStateFromError(X)),J=W.__d),W.componentDidCatch!=null&&(W.componentDidCatch(X,G||{}),J=W.__d),J)return W.__E=W}catch(A){X=A}throw X}},b0=0,z1=function(X){return X!=null&&X.constructor===void 0},B.prototype.setState=function(X,Y){var Z;Z=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=d({},this.state),typeof X=="function"&&(X=X(d({},Z),this.props)),X&&d(Z,X),X!=null&&this.__v&&(Y&&this._sb.push(Y),Q0(this))},B.prototype.forceUpdate=function(X){this.__v&&(this.__e=!0,X&&this.__h.push(X),Q0(this))},B.prototype.render=z,M=[],m0=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,S0=function(X,Y){return X.__v.__b-Y.__v.__b},e.__r=0,_0=/(PointerCapture)$|Capture$/i,J0=0,Z0=T0(!1),G0=T0(!0),k0=0;var g,U,E0,c0,_=0,n0=[],j=V,o0=j.__b,i0=j.__r,r0=j.diffed,e0=j.__c,l0=j.unmount,t0=j.__;function T(X,Y){j.__h&&j.__h(U,X,_||Y),_=0;var Z=U.__H||(U.__H={__:[],__h:[]});return X>=Z.__.length&&Z.__.push({}),Z.__[X]}function f(X){return _=1,t(X1,X)}function t(X,Y,Z){var G=T(g++,2);if(G.t=X,!G.__c&&(G.__=[Z?Z(Y):X1(void 0,Y),function(A){var N=G.__N?G.__N[0]:G.__[0],O=G.t(N,A);N!==O&&(G.__N=[O,G.__[1]],G.__c.setState({}))}],G.__c=U,!U.__f)){var W=function(A,N,O){if(!G.__c.__H)return!0;var E=G.__c.__H.__.filter(function(R){return R.__c});if(E.every(function(R){return!R.__N}))return!Q||Q.call(this,A,N,O);var K=G.__c.props!==A;return E.some(function(R){if(R.__N){var q=R.__[0];R.__=R.__N,R.__N=void 0,q!==R.__[0]&&(K=!0)}}),Q&&Q.call(this,A,N,O)||K};U.__f=!0;var{shouldComponentUpdate:Q,componentWillUpdate:J}=U;U.componentWillUpdate=function(A,N,O){if(this.__e){var E=Q;Q=void 0,W(A,N,O),Q=E}J&&J.call(this,A,N,O)},U.shouldComponentUpdate=W}return G.__N||G.__}function u(X,Y){var Z=T(g++,3);!j.__s&&z0(Z.__H,Y)&&(Z.__=X,Z.u=Y,U.__H.__h.push(Z))}function k(X,Y){var Z=T(g++,4);!j.__s&&z0(Z.__H,Y)&&(Z.__=X,Z.u=Y,U.__h.push(Z))}function U0(X){return _=5,a(function(){return{current:X}},[])}function D0(X,Y,Z){_=6,k(function(){if(typeof X=="function"){var G=X(Y());return function(){X(null),G&&typeof G=="function"&&G()}}if(X)return X.current=Y(),function(){return X.current=null}},Z==null?Z:Z.concat(X))}function a(X,Y){var Z=T(g++,7);return z0(Z.__H,Y)&&(Z.__=X(),Z.__H=Y,Z.__h=X),Z.__}function F0(X,Y){return _=8,a(function(){return X},Y)}function j0(X){var Y=U.context[X.__c],Z=T(g++,9);return Z.c=X,Y?(Z.__==null&&(Z.__=!0,Y.sub(U)),Y.props.value):X.__}function H0(X,Y){j.useDebugValue&&j.useDebugValue(Y?Y(X):X)}function W2(X){var Y=T(g++,10),Z=f();return Y.__=X,U.componentDidCatch||(U.componentDidCatch=function(G,W){Y.__&&Y.__(G,W),Z[1](G)}),[Z[0],function(){Z[1](void 0)}]}function P0(){var X=T(g++,11);if(!X.__){for(var Y=U.__v;Y!==null&&!Y.__m&&Y.__!==null;)Y=Y.__;var Z=Y.__m||(Y.__m=[0,0]);X.__="P"+Z[0]+"-"+Z[1]++}return X.__}function g1(){for(var X;X=n0.shift();){var Y=X.__H;if(X.__P&&Y)try{Y.__h.some(l),Y.__h.some(R0),Y.__h=[]}catch(Z){Y.__h=[],j.__e(Z,X.__v)}}}j.__b=function(X){U=null,o0&&o0(X)},j.__=function(X,Y){X&&Y.__k&&Y.__k.__m&&(X.__m=Y.__k.__m),t0&&t0(X,Y)},j.__r=function(X){i0&&i0(X),g=0;var Y=(U=X.__c).__H;Y&&(E0===U?(Y.__h=[],U.__h=[],Y.__.some(function(Z){Z.__N&&(Z.__=Z.__N),Z.u=Z.__N=void 0})):(Y.__h.some(l),Y.__h.some(R0),Y.__h=[],g=0)),E0=U},j.diffed=function(X){r0&&r0(X);var Y=X.__c;Y&&Y.__H&&(Y.__H.__h.length&&(n0.push(Y)!==1&&c0===j.requestAnimationFrame||((c0=j.requestAnimationFrame)||v1)(g1)),Y.__H.__.some(function(Z){Z.u&&(Z.__H=Z.u),Z.u=void 0})),E0=U=null},j.__c=function(X,Y){Y.some(function(Z){try{Z.__h.some(l),Z.__h=Z.__h.filter(function(G){return!G.__||R0(G)})}catch(G){Y.some(function(W){W.__h&&(W.__h=[])}),Y=[],j.__e(G,Z.__v)}}),e0&&e0(X,Y)},j.unmount=function(X){l0&&l0(X);var Y,Z=X.__c;Z&&Z.__H&&(Z.__H.__.some(function(G){try{l(G)}catch(W){Y=W}}),Z.__H=void 0,Y&&j.__e(Y,Z.__v))};var u0=typeof requestAnimationFrame=="function";function v1(X){var Y,Z=function(){clearTimeout(G),u0&&cancelAnimationFrame(Y),setTimeout(X)},G=setTimeout(Z,35);u0&&(Y=requestAnimationFrame(Z))}function l(X){var Y=U,Z=X.__c;typeof Z=="function"&&(X.__c=void 0,Z()),U=Y}function R0(X){var Y=U;X.__c=X.__(),U=Y}function z0(X,Y){return!X||X.length!==Y.length||Y.some(function(Z,G){return Z!==X[G]})}function X1(X,Y){return typeof Y=="function"?Y(X):Y}function A1(X,Y){for(var Z in Y)X[Z]=Y[Z];return X}function L0(X,Y){for(var Z in X)if(Z!=="__source"&&!(Z in Y))return!0;for(var G in Y)if(G!=="__source"&&X[G]!==Y[G])return!0;return!1}function N1(X,Y){var Z=Y(),G=f({t:{__:Z,u:Y}}),W=G[0].t,Q=G[1];return k(function(){W.__=Z,W.u=Y,B0(W)&&Q({t:W})},[X,Z,Y]),u(function(){return B0(W)&&Q({t:W}),X(function(){B0(W)&&Q({t:W})})},[X]),Z}function B0(X){try{return!((Y=X.__)===(Z=X.u())&&(Y!==0||1/Y==1/Z)||Y!=Y&&Z!=Z)}catch(G){return!0}var Y,Z}function V1(X){X()}function q1(X){return X}function E1(){return[!1,V1]}var R1=k;function I0(X,Y){this.props=X,this.context=Y}function M1(X,Y){function Z(W){var Q=this.props.ref;return Q!=W.ref&&Q&&(typeof Q=="function"?Q(null):Q.current=null),Y?!Y(this.props,W)||Q!=W.ref:L0(this.props,W)}function G(W){return this.shouldComponentUpdate=Z,I(X,W)}return G.displayName="Memo("+(X.displayName||X.name)+")",G.__f=G.prototype.isReactComponent=!0,G.type=X,G}(I0.prototype=new B).isPureReactComponent=!0,I0.prototype.shouldComponentUpdate=function(X,Y){return L0(this.props,X)||L0(this.state,Y)};var Y1=V.__b;V.__b=function(X){X.type&&X.type.__f&&X.ref&&(X.props.ref=X.ref,X.ref=null),Y1&&Y1(X)};var C1=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function T1(X){function Y(Z){var G=A1({},Z);return delete G.ref,X(G,Z.ref||null)}return Y.$$typeof=C1,Y.render=X,Y.prototype.isReactComponent=Y.__f=!0,Y.displayName="ForwardRef("+(X.displayName||X.name)+")",Y}var Z1=function(X,Y){return X==null?null:x(x(X).map(Y))},b1={map:Z1,forEach:Z1,count:function(X){return X?x(X).length:0},only:function(X){var Y=x(X);if(Y.length!==1)throw"Children.only";return Y[0]},toArray:x},m1=V.__e;V.__e=function(X,Y,Z,G){if(X.then){for(var W,Q=Y;Q=Q.__;)if((W=Q.__c)&&W.__c)return Y.__e==null&&(Y.__e=Z.__e,Y.__k=Z.__k),W.__c(X,Y)}m1(X,Y,Z,G)};var G1=V.unmount;function U1(X,Y,Z){return X&&(X.__c&&X.__c.__H&&(X.__c.__H.__.forEach(function(G){typeof G.__c=="function"&&G.__c()}),X.__c.__H=null),(X=A1({},X)).__c!=null&&(X.__c.__P===Z&&(X.__c.__P=Y),X.__c.__e=!0,X.__c=null),X.__k=X.__k&&X.__k.map(function(G){return U1(G,Y,Z)})),X}function D1(X,Y,Z){return X&&Z&&(X.__v=null,X.__k=X.__k&&X.__k.map(function(G){return D1(G,Y,Z)}),X.__c&&X.__c.__P===Y&&(X.__e&&Z.appendChild(X.__e),X.__c.__e=!0,X.__c.__P=Z)),X}function n(){this.__u=0,this.o=null,this.__b=null}function F1(X){var Y=X.__&&X.__.__c;return Y&&Y.__a&&Y.__a(X)}function S1(X){var Y,Z,G,W=null;function Q(J){if(Y||(Y=X()).then(function(A){A&&(W=A.default||A),G=!0},function(A){Z=A,G=!0}),Z)throw Z;if(!G)throw Y;return W?I(W,J):null}return Q.displayName="Lazy",Q.__f=!0,Q}function h(){this.i=null,this.l=null}V.unmount=function(X){var Y=X.__c;Y&&(Y.__z=!0),Y&&Y.__R&&Y.__R(),Y&&32&X.__u&&(X.type=null),G1&&G1(X)},(n.prototype=new B).__c=function(X,Y){var Z=Y.__c,G=this;G.o==null&&(G.o=[]),G.o.push(Z);var W=F1(G.__v),Q=!1,J=function(){Q||G.__z||(Q=!0,Z.__R=null,W?W(N):N())};Z.__R=J;var A=Z.__P;Z.__P=null;var N=function(){if(!--G.__u){if(G.state.__a){var O=G.state.__a;G.__v.__k[0]=D1(O,O.__c.__P,O.__c.__O)}var E;for(G.setState({__a:G.__b=null});E=G.o.pop();)E.__P=A,E.forceUpdate()}};G.__u++||32&Y.__u||G.setState({__a:G.__b=G.__v.__k[0]}),X.then(J,J)},n.prototype.componentWillUnmount=function(){this.o=[]},n.prototype.render=function(X,Y){if(this.__b){if(this.__v.__k){var Z=document.createElement("div"),G=this.__v.__k[0].__c;this.__v.__k[0]=U1(this.__b,Z,G.__O=G.__P)}this.__b=null}var W=Y.__a&&I(z,null,X.fallback);return W&&(W.__u&=-33),[I(z,null,Y.__a?null:X.children),W]};var Q1=function(X,Y,Z){if(++Z[1]===Z[0]&&X.l.delete(Y),X.props.revealOrder&&(X.props.revealOrder[0]!=="t"||!X.l.size))for(Z=X.i;Z;){for(;Z.length>3;)Z.pop()();if(Z[1]<Z[0])break;X.i=Z=Z[2]}};function _1(X){return this.getChildContext=function(){return X.context},X.children}function k1(X){var Y=this,Z=X.h;if(Y.componentWillUnmount=function(){S(null,Y.v),Y.v=null,Y.h=null},Y.h&&Y.h!==Z&&Y.componentWillUnmount(),!Y.v){for(var G=Y.__v;G!==null&&!G.__m&&G.__!==null;)G=G.__;Y.h=Z,Y.v={nodeType:1,parentNode:Z,childNodes:[],__k:{__m:G.__m},contains:function(){return!0},namespaceURI:Z.namespaceURI,insertBefore:function(W,Q){this.childNodes.push(W),Y.h.insertBefore(W,Q)},removeChild:function(W){this.childNodes.splice(this.childNodes.indexOf(W)>>>1,1),Y.h.removeChild(W)}}}S(I(_1,{context:Y.context},X.__v),Y.v)}function y1(X,Y){var Z=I(k1,{__v:X,h:Y});return Z.containerInfo=Y,Z}(h.prototype=new B).__a=function(X){var Y=this,Z=F1(Y.__v),G=Y.l.get(X);return G[0]++,function(W){var Q=function(){Y.props.revealOrder?(G.push(W),Q1(Y,X,G)):W()};Z?Z(Q):Q()}},h.prototype.render=function(X){this.i=null,this.l=new Map;var Y=x(X.children);X.revealOrder&&X.revealOrder[0]==="b"&&Y.reverse();for(var Z=Y.length;Z--;)this.l.set(Y[Z],this.i=[1,0,this.i]);return X.children},h.prototype.componentDidUpdate=h.prototype.componentDidMount=function(){var X=this;this.l.forEach(function(Y,Z){Q1(X,Z,Y)})};var j1=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,w1=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,p1=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,s1=/[A-Z0-9]/g,f1=typeof document<"u",a1=function(X){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(X)};function $0(X,Y,Z){return Y.__k==null&&(Y.textContent=""),S(X,Y),typeof Z=="function"&&Z(),X?X.__c:null}function d0(X,Y,Z){return V0(X,Y),typeof Z=="function"&&Z(),X?X.__c:null}B.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(X){Object.defineProperty(B.prototype,X,{configurable:!0,get:function(){return this["UNSAFE_"+X]},set:function(Y){Object.defineProperty(this,X,{configurable:!0,writable:!0,value:Y})}})});var W1=V.event;V.event=function(X){return W1&&(X=W1(X)),X.persist=function(){},X.isPropagationStopped=function(){return this.cancelBubble},X.isDefaultPrevented=function(){return this.defaultPrevented},X.nativeEvent=X};var x0,h1={configurable:!0,get:function(){return this.class}},J1=V.vnode;V.vnode=function(X){typeof X.type=="string"&&function(Y){var{props:Z,type:G}=Y,W={},Q=G.indexOf("-")==-1;for(var J in Z){var A=Z[J];if(!(J==="value"&&("defaultValue"in Z)&&A==null||f1&&J==="children"&&G==="noscript"||J==="class"||J==="className")){var N=J.toLowerCase();J==="defaultValue"&&"value"in Z&&Z.value==null?J="value":J==="download"&&A===!0?A="":N==="translate"&&A==="no"?A=!1:N[0]==="o"&&N[1]==="n"?N==="ondoubleclick"?J="ondblclick":N!=="onchange"||G!=="input"&&G!=="textarea"||a1(Z.type)?N==="onfocus"?J="onfocusin":N==="onblur"?J="onfocusout":p1.test(J)&&(J=N):N=J="oninput":Q&&w1.test(J)?J=J.replace(s1,"-$&").toLowerCase():A===null&&(A=void 0),N==="oninput"&&W[J=N]&&(J="oninputCapture"),W[J]=A}}G=="select"&&(W.multiple&&Array.isArray(W.value)&&(W.value=x(Z.children).forEach(function(O){O.props.selected=W.value.indexOf(O.props.value)!=-1})),W.defaultValue!=null&&(W.value=x(Z.children).forEach(function(O){O.props.selected=W.multiple?W.defaultValue.indexOf(O.props.value)!=-1:W.defaultValue==O.props.value}))),Z.class&&!Z.className?(W.class=Z.class,Object.defineProperty(W,"className",h1)):Z.className&&(W.class=W.className=Z.className),Y.props=W}(X),X.$$typeof=j1,J1&&J1(X)};var K1=V.__r;V.__r=function(X){K1&&K1(X),x0=X.__c};var O1=V.diffed;V.diffed=function(X){O1&&O1(X);var{props:Y,__e:Z}=X;Z!=null&&X.type==="textarea"&&"value"in Y&&Y.value!==Z.value&&(Z.value=Y.value==null?"":Y.value),x0=null};var c1={ReactCurrentDispatcher:{current:{readContext:function(X){return x0.__n[X.__c].props.value},useCallback:F0,useContext:j0,useDebugValue:H0,useDeferredValue:q1,useEffect:u,useId:P0,useImperativeHandle:D0,useInsertionEffect:R1,useLayoutEffect:k,useMemo:a,useReducer:t,useRef:U0,useState:f,useSyncExternalStore:N1,useTransition:E1}}},A2="18.3.1";function o1(X){return I.bind(null,X)}function X0(X){return!!X&&X.$$typeof===j1}function i1(X){return X0(X)&&X.type===z}function r1(X){return!!X&&typeof X.displayName=="string"&&X.displayName.indexOf("Memo(")==0}function e1(X){return X0(X)?h0.apply(null,arguments):X}function g0(X){return!!X.__k&&(S(null,X),!0)}function l1(X){return X&&(X.base||X.nodeType===1&&X)||null}var t1=function(X,Y){return X(Y)},u1=function(X,Y){var Z=V.debounceRendering;V.debounceRendering=function(W){return W()};var G=X(Y);return V.debounceRendering=Z,G},n1=X0,X2={useState:f,useId:P0,useReducer:t,useEffect:u,useLayoutEffect:k,useInsertionEffect:R1,useTransition:E1,useDeferredValue:q1,useSyncExternalStore:N1,startTransition:V1,useRef:U0,useImperativeHandle:D0,useMemo:a,useCallback:F0,useContext:j0,useDebugValue:H0,version:"18.3.1",Children:b1,render:$0,hydrate:d0,unmountComponentAtNode:g0,createPortal:y1,createElement:I,createContext:q0,createFactory:o1,cloneElement:e1,createRef:O0,Fragment:z,isValidElement:X0,isElement:n1,isFragment:i1,isMemo:r1,findDOMNode:l1,Component:B,PureComponent:I0,memo:M1,forwardRef:T1,flushSync:u1,unstable_batchedUpdates:t1,StrictMode:z,Suspense:n,SuspenseList:h,lazy:S1,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:c1};var Y2=0;function H1(X,Y,Z,G,W,Q){Y||(Y={});var J,A,N=Y;if("ref"in N)for(A in N={},Y)A=="ref"?J=Y[A]:N[A]=Y[A];var O={type:X,props:N,key:Z,ref:J,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Y2,__i:-1,__u:0,__source:W,__self:Q};if(typeof X=="function"&&(J=X.defaultProps))for(A in J)N[A]===void 0&&(N[A]=J[A]);return V.vnode&&V.vnode(O),O}function P1(X){return{render:function(Y){$0(Y,X)},unmount:function(){g0(X)}}}function Z2(X,Y){return d0(Y,X),P1(X)}export{A2 as version,E1 as useTransition,N1 as useSyncExternalStore,f as useState,U0 as useRef,t as useReducer,a as useMemo,k as useLayoutEffect,R1 as useInsertionEffect,D0 as useImperativeHandle,P0 as useId,W2 as useErrorBoundary,u as useEffect,q1 as useDeferredValue,H0 as useDebugValue,j0 as useContext,F0 as useCallback,t1 as unstable_batchedUpdates,g0 as unmountComponentAtNode,V1 as startTransition,$0 as render,M1 as memo,S1 as lazy,H1 as jsxs,H1 as jsx,X0 as isValidElement,r1 as isMemo,i1 as isFragment,n1 as isElement,Z2 as hydrateRoot,d0 as hydrate,T1 as forwardRef,u1 as flushSync,l1 as findDOMNode,X2 as default,P1 as createRoot,O0 as createRef,y1 as createPortal,o1 as createFactory,I as createElement,q0 as createContext,e1 as cloneElement,c1 as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,h as SuspenseList,n as Suspense,z as StrictMode,I0 as PureComponent,z as Fragment,B as Component,b1 as Children};
|
package/daemon/src/compiler.ts
CHANGED
|
@@ -12,13 +12,14 @@ import * as C from '#canvas/components';
|
|
|
12
12
|
const { Section, Item, Task, FilePreview, CodeBlock, Callout,
|
|
13
13
|
Mermaid, Table, Priority, Checklist, Note, Diff,
|
|
14
14
|
Choice, MultiChoice, UserInput, RangeInput, ImageView,
|
|
15
|
-
useFeedback, useAnnotations } = C;
|
|
15
|
+
Markdown, useFeedback, useAnnotations } = C;
|
|
16
16
|
`;
|
|
17
17
|
|
|
18
18
|
export async function compilePlan(jsx: string, projectRoot?: string): Promise<CompileResult> {
|
|
19
|
-
// Resolve
|
|
19
|
+
// Resolve file contents at compile time
|
|
20
20
|
if (projectRoot) {
|
|
21
21
|
jsx = resolveFilePreviews(jsx, projectRoot);
|
|
22
|
+
jsx = resolveMarkdownFiles(jsx, projectRoot);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const hasDefaultExport = /export\s+default\b/.test(jsx);
|
|
@@ -55,6 +56,31 @@ export async function compilePlan(jsx: string, projectRoot?: string): Promise<Co
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Find <Markdown file="..." /> tags and inject __content with the file contents
|
|
61
|
+
* resolved at compile time.
|
|
62
|
+
*/
|
|
63
|
+
function resolveMarkdownFiles(jsx: string, projectRoot: string): string {
|
|
64
|
+
return jsx.replace(
|
|
65
|
+
/<Markdown\b([^>]*?)\/>/g,
|
|
66
|
+
(match, attrs: string) => {
|
|
67
|
+
const fileMatch = attrs.match(/file=["']([^"']+)["']/);
|
|
68
|
+
if (!fileMatch) return match;
|
|
69
|
+
|
|
70
|
+
const filePath = fileMatch[1];
|
|
71
|
+
const absPath = join(projectRoot, filePath);
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const content = readFileSync(absPath, "utf-8");
|
|
75
|
+
const escaped = JSON.stringify(content);
|
|
76
|
+
return `<Markdown${attrs} __content={${escaped}} />`;
|
|
77
|
+
} catch {
|
|
78
|
+
return match;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
58
84
|
/**
|
|
59
85
|
* Find <FilePreview path="..." /> tags and inject __content with the file contents
|
|
60
86
|
* resolved at compile time so the browser doesn't need to fetch.
|