agent-canvas 0.1.26 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.github/workflows/ci.yml +25 -0
  2. package/.github/workflows/deploy-worker-prod.yml +20 -0
  3. package/.github/workflows/deploy-worker-stage.yml +22 -0
  4. package/.github/workflows/deploy-worker.yml +73 -0
  5. package/bin/lib/instructions/overview.md +1 -0
  6. package/bun.lock +193 -0
  7. package/daemon/build.ts +22 -0
  8. package/daemon/client/AnnotationEditor.tsx +12 -2
  9. package/daemon/client/AnnotationProvider.tsx +20 -6
  10. package/daemon/client/AnnotationSidebar.tsx +72 -35
  11. package/daemon/client/App.tsx +219 -10
  12. package/daemon/client/FileBrowser.tsx +16 -0
  13. package/daemon/client/FileViewer.tsx +18 -0
  14. package/daemon/client/PlanRenderer.tsx +3 -2
  15. package/daemon/client/ReviewerIdentityDialog.tsx +95 -0
  16. package/daemon/client/SessionSwitcher.tsx +5 -0
  17. package/daemon/client/ShareDialog.tsx +230 -0
  18. package/daemon/client/clientApi.ts +142 -0
  19. package/daemon/client/runtime.ts +22 -0
  20. package/daemon/dist/client.css +1 -1
  21. package/daemon/dist/client.js +74 -74
  22. package/daemon/dist/components.js +50 -50
  23. package/daemon/src/handlers/api.ts +63 -0
  24. package/daemon/src/remote-feedback.test.ts +179 -0
  25. package/daemon/src/remote-feedback.ts +128 -0
  26. package/daemon/src/server.ts +5 -0
  27. package/daemon/src/session.ts +139 -6
  28. package/daemon/src/share.test.ts +221 -0
  29. package/daemon/src/share.ts +187 -0
  30. package/daemon/src/websocket.ts +15 -2
  31. package/package.json +5 -1
  32. package/workers/canvas-share/README.md +159 -0
  33. package/workers/canvas-share/oblaka.ts +56 -0
  34. package/workers/canvas-share/package.json +25 -0
  35. package/workers/canvas-share/public/assets/.gitkeep +0 -0
  36. package/workers/canvas-share/public/assets/client.css +2 -0
  37. package/workers/canvas-share/public/assets/client.js +91 -0
  38. package/workers/canvas-share/public/assets/components.js +63 -0
  39. package/workers/canvas-share/public/assets/jsx-runtime.js +3 -0
  40. package/workers/canvas-share/public/assets/preact-compat.js +1 -0
  41. package/workers/canvas-share/public/assets/runtime.js +1 -0
  42. package/workers/canvas-share/public/index.html +385 -0
  43. package/workers/canvas-share/public/screenshot-dark.png +0 -0
  44. package/workers/canvas-share/public/screenshot-light.png +0 -0
  45. package/workers/canvas-share/src/index.test.ts +165 -0
  46. package/workers/canvas-share/src/index.ts +510 -0
  47. package/workers/canvas-share/src/types.ts +97 -0
  48. package/workers/canvas-share/src/util.ts +156 -0
  49. package/workers/canvas-share/src/validation.ts +117 -0
  50. package/workers/canvas-share/tsconfig.json +16 -0
@@ -0,0 +1,63 @@
1
+ import{useState as x0}from"react";import{jsxDEV as Q1}from"react/jsx-dev-runtime";function D0({title:J,children:y}){let[Q,B]=x0(!1);return Q1("div",{className:"relative mb-8 p-4 group/section","data-md":"section","data-md-title":J,children:[Q1("div",{className:"relative mb-2",children:[Q1("button",{onClick:()=>B(!Q),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 ${Q?"-rotate-90":""}`,children:Q1("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:Q1("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),Q1("h2",{className:"font-heading text-section text-text-primary",style:{fontWeight:400},children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q1("div",{className:Q?"mt-6 hidden":"mt-6",children:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as o}from"react/jsx-dev-runtime";var c0={todo:"bg-border-hover",done:"bg-accent-green",blocked:"bg-accent-red","in-progress":"bg-accent-blue"},p0={todo:"Todo",done:"Done",blocked:"Blocked","in-progress":"In progress"},E0={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 t1({id:J,label:y,status:Q,badge:B,badgeVariant:$="neutral",children:Y}){return o("div",{className:"group/task relative -mx-4 px-4 py-3 rounded-md transition-colors duration-150 hover:bg-bg-input","data-task-id":J,"data-md":"item","data-md-label":y,...Q?{"data-md-status":Q}:{},...B?{"data-md-badge":B}:{},children:o("div",{className:"flex items-start gap-3",children:[Q&&o("span",{className:`w-2 h-2 rounded-full mt-[7px] flex-shrink-0 ${c0[Q]}`},void 0,!1,void 0,this),o("div",{className:"flex-1 min-w-0",children:[o("div",{className:"flex items-baseline gap-2",children:[o("span",{className:"font-body text-task-label font-semibold text-text-primary",children:y},void 0,!1,void 0,this),Q&&o("span",{className:"font-body text-tiny uppercase tracking-wider text-text-tertiary opacity-0 group-hover/task:opacity-100 transition-opacity duration-150",children:p0[Q]},void 0,!1,void 0,this),B&&o("span",{className:`font-body text-tiny font-medium px-1.5 py-px rounded-full ${E0[$]}`,children:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y&&o("div",{className:"text-body text-text-secondary mt-1 leading-relaxed",children:Y},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 d0(J){return o(t1,{...J},void 0,!1,void 0,this)}import{useEffect as u0,useRef as r0}from"react";import{jsxDEV as A1}from"react/jsx-dev-runtime";function i0({language:J,children:y}){let Q=typeof y==="string"?y:String(y??""),B=r0(null);return u0(()=>{let $=B.current,Y=window.hljs;if(!$||!Y)return;$.removeAttribute("data-highlighted"),$.className=J?`language-${J}`:"",$.textContent=Q,Y.highlightElement($)},[Q,J]),A1("div",{className:"relative mt-3 group/code","data-md":"codeblock","data-md-language":J||"",children:[J&&A1("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:J},void 0,!1,void 0,this),A1("pre",{className:"bg-bg-code rounded-md p-4 overflow-x-auto text-code font-mono leading-relaxed",children:A1("code",{ref:B,className:J?`language-${J}`:"",children:Q},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as V1}from"react/jsx-dev-runtime";var l0={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 a0({type:J="info",children:y}){let Q=l0[J];return V1("div",{className:`${Q.bg} relative rounded-lg px-5 py-4 mt-3 flex gap-3 items-start`,"data-md":"callout","data-md-type":J,children:[V1("span",{className:`${Q.iconColor} opacity-70 text-base leading-relaxed flex-shrink-0 mt-px`,children:Q.icon},void 0,!1,void 0,this),V1("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 s0}from"react/jsx-dev-runtime";function o0({children:J}){return s0("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:J},void 0,!1,void 0,this)}import{jsxDEV as $1}from"react/jsx-dev-runtime";function n0({headers:J,rows:y}){return $1("div",{className:"overflow-x-auto mt-3","data-md":"table",children:$1("table",{className:"w-full text-body",children:[$1("thead",{children:$1("tr",{className:"border-b border-border-subtle",children:J.map((Q,B)=>$1("th",{className:"text-left px-4 py-2.5 text-meta font-medium uppercase tracking-wider text-text-tertiary font-body",children:Q},B,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),$1("tbody",{children:y.map((Q,B)=>$1("tr",{className:`relative border-b border-border-subtle last:border-b-0 transition-colors hover:bg-bg-surface/50 ${B%2===1?"bg-bg-surface/30":""}`,children:Q.map(($,Y)=>$1("td",{className:"px-4 py-2.5 text-text-secondary font-body",children:$},Y,!1,void 0,this))},B,!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 q1}from"react/jsx-dev-runtime";function t0({items:J}){return q1("ul",{className:"space-y-1 mt-3","data-md":"checklist",children:J.map((y,Q)=>q1("li",{"data-md":"checklist-item","data-md-label":y.label,className:"relative flex items-start gap-2.5 py-1",children:[q1("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&&q1("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:q1("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),q1("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)]},Q,!0,void 0,this))},void 0,!1,void 0,this)}import{jsxDEV as $5}from"react/jsx-dev-runtime";var e0={high:"text-accent-red bg-accent-red-muted",medium:"text-accent-amber bg-accent-amber-muted",low:"text-text-tertiary bg-border-subtle"};function y5({level:J}){return $5("span",{className:`inline text-tiny font-medium font-body ml-2 px-1.5 py-0.5 rounded ${e0[J]}`,"data-md":"priority","data-md-level":J,children:J},void 0,!1,void 0,this)}import{useEffect as e1,useState as v1,useContext as y0,useRef as J5}from"react";import{SessionContext as Q5,ActiveViewCtx as B5}from"#canvas/runtime";import{jsxDEV as J1}from"react/jsx-dev-runtime";var Y5={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 W5({path:J,lines:y,__content:Q}){let B=y0(Q5),{setActiveView:$}=y0(B5),[Y,W]=v1(Q??null),[L,X]=v1(()=>{let q=J.split(".").pop()||"";return Y5[q]||"text"}),[K,N]=v1(null),[G,U]=v1(!Q),T=J5(null);if(e1(()=>{if(Q!==void 0)return;U(!0),N(null),fetch(`/api/file?session=${B}&path=${encodeURIComponent(J)}`).then((q)=>q.json()).then((q)=>{if(q.error)N(q.error);else{let b=q.content;if(y)b=b.split(`
2
+ `).slice(y[0]-1,y[1]).join(`
3
+ `);W(b),X(q.language||"text")}}).catch(()=>N("Failed to fetch file")).finally(()=>U(!1))},[B,J,y?.[0],y?.[1],Q]),e1(()=>{let q=T.current,b=window.hljs;if(!q||!b||!Y)return;q.removeAttribute("data-highlighted"),q.className=L?`language-${L}`:"",q.textContent=Y,b.highlightElement(q)},[Y,L]),G)return J1("div",{className:"text-text-tertiary text-body mt-3 bg-bg-code rounded-md p-4",children:["Loading ",J,"..."]},void 0,!0,void 0,this);if(K)return J1("div",{className:"text-accent-red text-body mt-3 bg-accent-red-muted rounded-md p-4",children:[J,": ",K]},void 0,!0,void 0,this);return J1("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden","data-md":"filepreview","data-md-path":J,...y?{"data-md-lines":`${y[0]}-${y[1]}`}:{},children:[J1("div",{className:"px-4 py-2 flex items-center justify-between",children:[J1("button",{className:"font-mono text-meta text-text-tertiary hover:text-text-secondary hover:underline cursor-pointer text-left",onClick:()=>$({type:"file",path:J}),title:`Open ${J}`,children:J},void 0,!1,void 0,this),y&&J1("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),J1("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono !bg-transparent",style:{background:"transparent"},children:J1("code",{ref:T,className:L?`language-${L}`:"",children:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as p1,useRef as b1,useState as U1,useCallback as s}from"react";import Z5 from"react-dom";import{useAnnotations as F5,useCanvasFile as f5}from"#canvas/runtime";import{useEffect as q5,useRef as z1,useState as G1,useCallback as k1,useMemo as B0,useContext as G5}from"react";import{createPortal as U5}from"react-dom";function $0(J,y){let $=y||document.body,Y=J.getBoundingClientRect(),W=$.getBoundingClientRect(),L=$===document.body?window.scrollY:$.scrollTop,X=Y.bottom-W.top+L+8,K=Math.max(0,Math.min(Y.left-W.left,W.width-280-12));return $.style.position="relative",{style:{position:"absolute",top:`${X}px`,left:`${K}px`},parent:$}}import{useState as x1,useRef as D1,useCallback as y1,useEffect as L5}from"react";function B1(J,y){J.style.height="auto",J.style.height=(y?Math.max(y,J.scrollHeight):J.scrollHeight)+"px"}function X5(){if(typeof window<"u"&&window.__CANVAS_SHARE__?.shareId)return{isShared:!0,shareId:window.__CANVAS_SHARE__.shareId};return{isShared:!1,sessionId:typeof window<"u"?window.location.pathname.replace("/s/",""):""}}var Y1=X5();function J0(){if(Y1.isShared)return`/s/${Y1.shareId}/upload`;return`/api/session/${Y1.sessionId}/upload`}var ey=!Y1.isShared,y2=!Y1.isShared;import{jsxDEV as j}from"react/jsx-dev-runtime";function K5(J){if(J.startsWith("/s/")||J.startsWith("http://")||J.startsWith("https://"))return J;return`/api/uploads/${J.split("/").pop()}`}async function N5(J,y){let Q=new FormData;Q.append("image",y);try{let $=await(await fetch(J0(),{method:"POST",body:Q})).json();if(Y1.isShared)return $.url||null;return $.path||null}catch{return null}}function Q0({note:J,onNoteChange:y,images:Q,onAddImage:B,onRemoveImage:$,sessionId:Y,placeholder:W="Add your note...",autoFocus:L=!1,autoResize:X=!1,readOnly:K=!1,onKeyDown:N,onTextareaClick:G,textareaRef:U,textareaClassName:T,textareaStyle:q,minHeight:b,attachButton:P="always",openFilePickerRef:_}){let[k,m]=x1(!1),[r,g]=x1(!1),[M,x]=x1(!1),I=D1(0),E=D1(null),O=D1(null),C=y1(()=>O.current?.click(),[]);if(_)_.current=C;let c=y1((Z)=>{if(E.current=Z,U)U.current=Z;if(Z&&X)B1(Z,b)},[U,X,b]);L5(()=>{if(L&&E.current){let Z=E.current;if(Z.focus(),Z.value)Z.setSelectionRange(Z.value.length,Z.value.length)}},[L]);let R=y1(async(Z)=>{if(!Z.type.startsWith("image/"))return;g(!0);try{let D=await N5(Y,Z);if(D)B(D)}finally{g(!1)}},[Y,B]),i=y1((Z)=>{let D=Z.clipboardData.items;for(let H of D)if(H.type.startsWith("image/")){Z.preventDefault();let f=H.getAsFile();if(f)R(f);return}},[R]),S=y1((Z)=>{if(Z.preventDefault(),I.current++,I.current===1)m(!0)},[]),p=y1((Z)=>{Z.preventDefault()},[]),d=y1((Z)=>{if(Z.preventDefault(),I.current--,I.current===0)m(!1)},[]),t=y1((Z)=>{Z.preventDefault(),I.current=0,m(!1);for(let D of Z.dataTransfer.files)if(D.type.startsWith("image/"))R(D)},[R]),e=y1((Z)=>{if(y(Z.target.value),X)Z.target.style.height="auto",Z.target.style.height=(b?Math.max(b,Z.target.scrollHeight):Z.target.scrollHeight)+"px"},[y,X,b]),g1="w-full bg-transparent text-[13px] font-body text-text-primary resize-none focus:outline-none leading-relaxed p-0 border-none",j1={width:"100%",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",outline:"none",...X?{resize:"none",overflow:"hidden"}:{resize:"vertical"}},K1=!K&&(P==="always"||P==="on-focus"&&M);return j("div",{style:{position:"relative"},onDragEnter:K?void 0:S,onDragOver:K?void 0:p,onDragLeave:K?void 0:d,onDrop:K?void 0:t,children:[j("textarea",{ref:c,value:J,onChange:K?void 0:e,onPaste:K?void 0:i,onKeyDown:N,onClick:G,onFocus:()=>x(!0),onBlur:()=>{setTimeout(()=>x(!1),150)},readOnly:K,placeholder:W,className:T??g1,style:q??j1,rows:X?1:void 0},void 0,!1,void 0,this),!K&&j("input",{ref:O,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:(Z)=>{let D=Z.target.files;if(D)for(let H of D)R(H);Z.target.value=""}},void 0,!1,void 0,this),(Q.length>0||K1)&&j("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",marginTop:"6px",alignItems:"center"},children:[Q.map((Z)=>j("div",{style:{position:"relative",width:"56px",height:"56px",borderRadius:"6px",overflow:"hidden",border:"1px solid var(--color-border-subtle)",flexShrink:0},children:[j("img",{src:K5(Z),alt:"",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}},void 0,!1,void 0,this),!K&&j("button",{onClick:(D)=>{D.stopPropagation(),$(Z)},style:{position:"absolute",top:"2px",right:"2px",width:"16px",height:"16px",borderRadius:"50%",background:"rgba(0,0,0,0.6)",color:"white",border:"none",cursor:"pointer",fontSize:"11px",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,padding:0},title:"Remove image",children:"×"},void 0,!1,void 0,this)]},Z,!0,void 0,this)),K1&&j(c1,{onClick:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r&&j("div",{style:{fontSize:"11px",color:"var(--color-text-tertiary)",fontFamily:"'Inter', sans-serif",marginTop:"4px"},children:"Uploading..."},void 0,!1,void 0,this),k&&j("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-highlight-bg)",opacity:0.9,border:"2px dashed var(--color-highlight-border)",borderRadius:"6px",zIndex:10,pointerEvents:"none",fontSize:"12px",fontFamily:"'Inter', sans-serif",color:"var(--color-text-secondary)"},children:"Drop image"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function c1({onClick:J,size:y=16}){return j("button",{onClick:(Q)=>{Q.stopPropagation(),J()},style:{width:`${y*2}px`,height:`${y*2}px`,borderRadius:"6px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",flexShrink:0,transition:"color 0.15s"},title:"Attach image",onMouseEnter:(Q)=>{Q.currentTarget.style.color="var(--color-text-secondary)"},onMouseLeave:(Q)=>{Q.currentTarget.style.color="var(--color-text-tertiary)"},children:j("svg",{width:y,height:y,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[j("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"},void 0,!1,void 0,this),j("circle",{cx:"8.5",cy:"8.5",r:"1.5"},void 0,!1,void 0,this),j("polyline",{points:"21 15 16 10 5 21"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{SessionContext as P5}from"#canvas/runtime";import{jsxDEV as h,Fragment as T5}from"react/jsx-dev-runtime";function H5({anchorEl:J,scrollContainer:y,onClose:Q,ignoreSelector:B,zIndex:$="50",padding:Y="12px",width:W="280px",children:L}){let X=z1(null),K=z1(Q);K.current=Q;let{style:N,parent:G}=$0(J,y);return q5(()=>{let U=setTimeout(()=>{let T=(q)=>{if(X.current&&!X.current.contains(q.target)){if(B&&q.target.closest?.(B))return;K.current(),document.removeEventListener("mousedown",T)}};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},0);return()=>clearTimeout(U)},[B]),U5(h("div",{ref:X,style:{...N,zIndex:$,width:W,background:"var(--color-bg-elevated)",border:"1px solid var(--color-border-hover)",borderRadius:"8px",boxShadow:"0 4px 12px var(--color-shadow)",padding:Y,fontFamily:"'Inter', sans-serif"},children:L},void 0,!1,void 0,this),G)}var W0=[{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"]}],Y0=W0.flatMap((J)=>J.items);function b5({anchorEl:J,scrollContainer:y,snippet:Q,truncateAt:B=100,header:$,initialNote:Y="",initialImages:W,onConfirm:L,onCancel:X,onDelete:K}){let N=G5(P5),G=Y!==""||!!K,[U,T]=G1(Y),[q,b]=G1(W||[]),[P,_]=G1(null),[k,m]=G1(G),[r,g]=G1(!1),M=z1(null),x=z1(null),I=k1(()=>{if(U.trim()||q.length>0)L(U.trim(),q);else if(G&&K)K();else X()},[U,q,L,X,G,K]),E=k1(()=>{if(G){if(!U.trim()&&q.length===0&&K){K(),X();return}L(U,q);return}X()},[U,q,G,L,X,K]),O=!G,C=U.trim().length>0?Y0.filter((H)=>H.toLowerCase().startsWith(U.trim().toLowerCase())):Y0,c=!O||k?[]:C.length===1&&C[0].toLowerCase()===U.trim().toLowerCase()?[]:C,R=new Set(c),i=W0.map((H)=>({label:H.label,items:H.items.filter((f)=>R.has(f))})).filter((H)=>H.items.length>0),S=i.map((H)=>H.items),p=S.flat(),d=B0(()=>{if(P===null)return 0;let H=0;for(let f=0;f<S.length;f++){if(P<H+S[f].length)return f;H+=S[f].length}return 0},[P,S]),t=B0(()=>{if(P===null)return 0;let H=0;for(let f=0;f<d;f++)H+=S[f].length;return P-H},[P,d,S]),e=(H,f)=>{let u=0;for(let N1=0;N1<H;N1++)u+=S[N1].length;return u+f},[g1,j1]=G1(U);if(U!==g1)j1(U),_(null),m(G);let K1=k1((H)=>{T(H)},[]),Z=Q.length>B?Q.slice(0,B)+"...":Q,D=k1((H)=>{if(p.length>0&&(H.key==="ArrowDown"||H.key==="ArrowUp"||H.key==="ArrowLeft"||H.key==="ArrowRight")){if(H.preventDefault(),P===null){_(0);return}if(H.key==="ArrowDown"){let f=Math.min(t+1,S[d].length-1);_(e(d,f))}else if(H.key==="ArrowUp"){let f=Math.max(t-1,0);_(e(d,f))}else if(H.key==="ArrowRight"){let f=Math.min(d+1,S.length-1),u=Math.min(t,S[f].length-1);_(e(f,u))}else if(H.key==="ArrowLeft"){let f=Math.max(d-1,0),u=Math.min(t,S[f].length-1);_(e(f,u))}return}if(P!==null&&p.length>0){if(H.key==="Tab"){H.preventDefault(),K1(p[P]);return}if(H.key==="Enter"&&!H.shiftKey){H.preventDefault(),L(p[P],q);return}}if(H.key==="Enter"&&!H.shiftKey){H.preventDefault(),I();return}if(H.key==="Escape")if(p.length>0&&!k)m(!0);else if(G)E();else X()},[p,P,t,d,S,e,K1,L,q,I,k,G,E,X]);return h(H5,{anchorEl:J,scrollContainer:y,onClose:G?E:X,ignoreSelector:G?"[data-annotation-id]":void 0,zIndex:G?"60":"50",padding:G?"10px 12px":"12px",width:"420px",children:[!G&&($??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:["“",Z,"”"]},void 0,!0,void 0,this)),h(Q0,{note:U,onNoteChange:T,images:q,onAddImage:(H)=>b((f)=>[...f,H]),onRemoveImage:(H)=>b((f)=>f.filter((u)=>u!==H)),sessionId:N,autoFocus:!0,autoResize:G,textareaRef:M,onKeyDown:D,attachButton:"none",openFilePickerRef:x,textareaStyle:G?{width:"100%",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",resize:"none",outline:"none",overflow:"hidden"}:{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",alignItems:"center",gap:"8px",marginTop:G?"6px":"8px"},children:[h(c1,{onClick:()=>x.current?.(),size:14},void 0,!1,void 0,this),h("div",{style:{flex:1}},void 0,!1,void 0,this),G?h("button",{onClick:()=>{if(K)K();X()},onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),style:{fontSize:"11px",color:r?"var(--color-accent-red)":"var(--color-text-tertiary)",background:"none",border:"none",cursor:"pointer",padding:"2px 0",fontFamily:"'Inter', sans-serif"},children:"Delete"},void 0,!1,void 0,this):h(T5,{children:[h("button",{onClick:X,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:I,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)]},void 0,!0,void 0,this),p.length>0&&h("div",{style:{marginTop:"6px",borderTop:"1px solid var(--color-border-subtle)",paddingTop:"8px",display:"flex",gap:"4px"},children:i.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((f)=>{let u=p.indexOf(f);return h("div",{onMouseDown:(N1)=>{N1.preventDefault(),N1.stopPropagation(),K1(f)},onMouseEnter:()=>_(u),style:{padding:"3px 6px",fontSize:"12px",borderRadius:"4px",fontFamily:"'Inter', sans-serif",color:u===P?"var(--color-text-primary)":"var(--color-text-secondary)",background:u===P?"var(--color-highlight-selected)":"transparent",cursor:"pointer"},children:[h("span",{style:{fontWeight:500},children:f.slice(0,U.trim().length)},void 0,!1,void 0,this),f.slice(U.trim().length)]},f,!0,void 0,this)})]},H.label,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function X0({anchorEl:J,scrollContainer:y,snippet:Q,truncateAt:B,header:$,onAdd:Y,onCancel:W}){return h(b5,{anchorEl:J,scrollContainer:y,snippet:Q,truncateAt:B,header:$,onConfirm:(L,X)=>Y(L,X),onCancel:W},void 0,!1,void 0,this)}import{jsxDEV as F,Fragment as q0}from"react/jsx-dev-runtime";var P1=0.2,M1=0.25,O1=4;function K0({zoom:J,onZoomIn:y,onZoomOut:Q,onZoomReset:B,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:Q,title:"Zoom out",disabled:J<=M1,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:B,title:"Reset zoom",children:[Math.round(J*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:J>=O1,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(q0,{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 N0(J=1){let[y,Q]=U1(J),B=s(()=>Q((W)=>Math.min(O1,+(W+P1).toFixed(2))),[]),$=s(()=>Q((W)=>Math.max(M1,+(W-P1).toFixed(2))),[]),Y=s(()=>Q(1),[]);return{zoom:y,zoomIn:B,zoomOut:$,zoomReset:Y,setZoom:Q}}function _5({svgHtml:J,source:y,onClose:Q}){let B=b1(null),{zoom:$,zoomIn:Y,zoomOut:W,zoomReset:L,setZoom:X}=N0(1),[K,N]=U1({x:0,y:0}),G=b1(null);p1(()=>{let _=(k)=>{if(k.key==="Escape")Q()};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[Q]);let U=s((_)=>{_.preventDefault();let k=_.deltaY>0?-P1:P1;X((m)=>Math.max(M1,Math.min(O1,+(m+k).toFixed(2))))},[X]),T=s((_)=>{if(_.button!==0)return;G.current={startX:_.clientX,startY:_.clientY,panX:K.x,panY:K.y},_.preventDefault()},[K]),q=s((_)=>{if(!G.current)return;N({x:G.current.panX+(_.clientX-G.current.startX),y:G.current.panY+(_.clientY-G.current.startY)})},[]),b=s(()=>{G.current=null},[]),P=s(()=>{L(),N({x:0,y:0})},[L]);return Z5.createPortal(F("div",{style:{position:"fixed",inset:0,zIndex:9999,background:"var(--color-bg-base)",display:"flex",flexDirection:"column"},onMouseMove:q,onMouseUp:b,onMouseLeave:b,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(K0,{zoom:$,onZoomIn:Y,onZoomOut:W,onZoomReset:P},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:Q,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:G.current?"grabbing":"grab"},onWheel:U,onMouseDown:T,children:F("div",{ref:B,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",transform:`translate(${K.x}px, ${K.y}px) scale(${$})`,transformOrigin:"center center",transition:G.current?"none":"transform 0.1s ease-out"},dangerouslySetInnerHTML:{__html:J}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),document.body)}function w5({children:J}){let y=b1(null),[Q,B]=U1(null),[$,Y]=U1(!1),[W,L]=U1(""),X=typeof J==="string"?J:String(J??""),{annotations:K,addAnnotationWithId:N,activeAnnotationId:G,setActiveAnnotationId:U}=F5(),T=f5(),[q,b]=U1(null),{zoom:P,zoomIn:_,zoomOut:k,zoomReset:m,setZoom:r}=N0(1),g=b1(K);g.current=K;let M=s((O,C,c)=>{let R=`[Diagram ${c.toLowerCase()}] ${C}`,i=g.current.find((S)=>S.snippet===R);if(i)U(i.id);else b({anchorEl:O,snippet:C,prefix:c})},[U]),x=b1(M);x.current=M,p1(()=>{let O=!1,C=async()=>{try{let R=window.mermaid;if(!R){B("Mermaid library not loaded");return}let i=document.documentElement.dataset.theme==="light"?"default":"dark";R.initialize({startOnLoad:!1,theme:i});let S=`mermaid-${Math.random().toString(36).slice(2)}`,{svg:p}=await R.render(S,X.trim());if(!O&&y.current)y.current.innerHTML=p,L(p),A5(y.current,(d,t,e)=>x.current(d,t,e)),L0(y.current,g.current);B(null)}catch(R){if(!O)B(R.message||"Invalid diagram")}};C();let c=new MutationObserver((R)=>{for(let i of R)if(i.attributeName==="data-theme")C()});return c.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{O=!0,c.disconnect()}},[X]),p1(()=>{if(y.current)L0(y.current,K,G)},[K,G]);let I=s((O)=>{if(!O.ctrlKey&&!O.metaKey)return;O.preventDefault();let C=O.deltaY>0?-P1:P1;r((c)=>Math.max(M1,Math.min(O1,+(c+C).toFixed(2))))},[r]);if(Q)return F("div",{className:"bg-accent-red-muted rounded-md p-4 mt-3 text-body text-accent-red",children:["Mermaid error: ",Q,F("pre",{className:"mt-2 text-tiny text-text-tertiary whitespace-pre-wrap",children:X},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let E=y.current?.closest("#plan-scroll-container");return F(q0,{children:[F("div",{className:"mt-3 mermaid-container","data-md":"mermaid","data-md-source":X.trim(),children:[F("div",{className:"flex justify-end mb-1",children:F(K0,{zoom:P,onZoomIn:_,onZoomOut:k,onZoomReset:m,onFullscreen:()=>Y(!0)},void 0,!1,void 0,this)},void 0,!1,void 0,this),F("div",{style:{overflow:"auto",maxHeight:"70vh"},onWheel:I,children:F("div",{ref:y,className:"flex justify-center",style:{transform:`scale(${P})`,transformOrigin:"top center",transition:"transform 0.1s ease-out",minHeight:P<1?void 0:void 0}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q&&F(X0,{anchorEl:q.anchorEl,scrollContainer:E,snippet:q.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),q.snippet]},void 0,!0,void 0,this),onAdd:(O,C)=>{let c=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;N(c,`[Diagram ${q.prefix.toLowerCase()}] ${q.snippet}`,O,void 0,void 0,C,T||void 0),b(null)},onCancel:()=>b(null)},void 0,!1,void 0,this),$&&W&&F(_5,{svgHtml:W,source:X,onClose:()=>Y(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function A5(J,y){let Q=(B,$,Y)=>{B.style.cursor="pointer",B.addEventListener("mouseenter",()=>{B.style.filter="brightness(1.2)"}),B.addEventListener("mouseleave",()=>{B.style.filter=""}),B.addEventListener("click",(W)=>{W.stopPropagation(),W.preventDefault(),y(B,$(),Y)})};for(let B of J.querySelectorAll(".node"))Q(B,()=>{return(B.querySelector(".nodeLabel")||B.querySelector("foreignObject span")||B.querySelector("text"))?.textContent?.trim()||"Node"},"Node");for(let B of J.querySelectorAll(".edgePath")){let $=B,Y=$.querySelector("path");if(Y){Y.style.strokeWidth=Math.max(parseFloat(Y.style.strokeWidth||"1"),8)+"px",Y.style.strokeOpacity="0";let L=Y.cloneNode(!0);L.style.strokeWidth="",L.style.strokeOpacity="",$.insertBefore(L,Y)}let W=$.id||"";Q($,()=>{let L=J.querySelectorAll(".edgeLabel");for(let X of L)if(X.id&&W&&X.id.replace("label","").includes(W.replace("L-","").replace("edge",""))){let K=X.textContent?.trim();if(K)return K}return"Connection"},"Edge")}for(let B of J.querySelectorAll(".edgeLabel")){let $=B.textContent?.trim();if(!$)continue;Q(B,()=>$,"Edge")}for(let B of J.querySelectorAll(".actor")){let $=B.closest("g")?.querySelector("text")||B.parentElement?.querySelector("text");if(!$)continue;let Y=B.closest("g");if(!Y||Y.hasAttribute("data-clickable"))continue;Y.setAttribute("data-clickable","true"),Q(Y,()=>$.textContent?.trim()||"Participant","Node")}for(let B of J.querySelectorAll(".messageText")){let $=B.textContent?.trim();if(!$)continue;Q(B,()=>$,"Edge")}for(let B of J.querySelectorAll(".entityBox")){let $=B.closest("g");if(!$||$.hasAttribute("data-clickable"))continue;let Y=$.querySelector(".entityLabel");if(!Y)continue;$.setAttribute("data-clickable","true"),Q($,()=>Y.textContent?.trim()||"Entity","Node")}for(let B of J.querySelectorAll(".relationshipLabel")){let $=B.textContent?.trim();if(!$)continue;let W=B.closest("g")||B;if(W.hasAttribute("data-clickable"))continue;W.setAttribute("data-clickable","true"),Q(W,()=>$,"Edge")}for(let B of J.querySelectorAll(".classGroup")){let $=B;if($.hasAttribute("data-clickable"))continue;let Y=$.querySelector(".classTitle, .classTitleText, text");if(!Y)continue;$.setAttribute("data-clickable","true"),Q($,()=>Y.textContent?.trim()||"Class","Node")}for(let B of J.querySelectorAll(".statediagram-state")){let $=B;if($.hasAttribute("data-clickable"))continue;let Y=$.querySelector(".state-title, text");if(!Y)continue;$.setAttribute("data-clickable","true"),Q($,()=>Y.textContent?.trim()||"State","Node")}for(let B of J.querySelectorAll(".mindmap-node")){let $=B;if($.hasAttribute("data-clickable"))continue;let Y=$.querySelector(".mindmap-node-label, text");if(!Y)continue;$.setAttribute("data-clickable","true"),Q($,()=>Y.textContent?.trim()||"Node","Node")}}function L0(J,y,Q){let B=new Map;for(let Y of y){let W=Y.snippet.match(/^\[Diagram (?:node|edge)\] (.+)$/);if(W)B.set(W[1],Y.id)}for(let Y of J.querySelectorAll("[data-annotated]"))Y.style.outline="",Y.style.outlineOffset="",Y.style.borderRadius="",Y.removeAttribute("data-annotated");if(B.size===0)return;for(let Y of J.querySelectorAll(".node")){let L=(Y.querySelector(".nodeLabel")||Y.querySelector("foreignObject span")||Y.querySelector("text"))?.textContent?.trim();if(!L||!B.has(L))continue;let X=B.get(L),K=Y;K.setAttribute("data-annotated",X);let N=X===Q;K.style.outline=N?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",K.style.outlineOffset="2px",K.style.borderRadius="4px"}for(let Y of J.querySelectorAll(".edgeLabel")){let W=Y.textContent?.trim();if(!W||!B.has(W))continue;let L=B.get(W),X=Y;X.setAttribute("data-annotated",L);let K=L===Q;X.style.outline=K?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",X.style.outlineOffset="2px",X.style.borderRadius="4px"}for(let Y of J.querySelectorAll(".actor")){let W=Y.closest("g");if(!W)continue;let X=W.querySelector("text")?.textContent?.trim();if(!X||!B.has(X))continue;if(W.hasAttribute("data-annotated"))continue;let K=B.get(X);W.setAttribute("data-annotated",K);let N=K===Q,G=W.querySelector("rect");if(G)G.style.outline=N?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",G.style.outlineOffset="2px",G.style.borderRadius="4px"}for(let Y of J.querySelectorAll(".messageText")){let W=Y.textContent?.trim();if(!W||!B.has(W))continue;let L=B.get(W),X=Y;X.setAttribute("data-annotated",L);let K=L===Q;X.style.outline=K?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",X.style.outlineOffset="2px",X.style.borderRadius="4px"}let $=(Y,W,L)=>{for(let X of J.querySelectorAll(Y)){let K=L(X);if(!K||K.hasAttribute("data-annotated"))continue;let G=K.querySelector(W)?.textContent?.trim();if(!G||!B.has(G))continue;let U=B.get(G);K.setAttribute("data-annotated",U);let T=U===Q,q=K.querySelector("rect, circle, ellipse, polygon")||K;q.style.outline=T?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",q.style.outlineOffset="2px",q.style.borderRadius="4px"}};$(".entityBox",".entityLabel",(Y)=>Y.closest("g"));for(let Y of J.querySelectorAll(".relationshipLabel")){let L=Y.closest("g")||Y;if(L.hasAttribute("data-annotated"))continue;let X=Y.textContent?.trim();if(!X||!B.has(X))continue;let K=B.get(X);L.setAttribute("data-annotated",K);let N=K===Q;L.style.outline=N?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",L.style.outlineOffset="2px",L.style.borderRadius="4px"}$(".classGroup",".classTitle, .classTitleText, text",(Y)=>Y),$(".statediagram-state",".state-title, text",(Y)=>Y),$(".mindmap-node",".mindmap-node-label, text",(Y)=>Y)}import{jsxDEV as T1}from"react/jsx-dev-runtime";function v5({before:J,after:y,language:Q}){let B=J.split(`
4
+ `),$=y.split(`
5
+ `),Y=k5(B,$),W=[],L=0,X=0,K=0;while(L<B.length||X<$.length)if(K<Y.length&&L<B.length&&X<$.length&&B[L]===Y[K]&&$[X]===Y[K])W.push({type:"same",line:B[L]}),L++,X++,K++;else if(L<B.length&&(K>=Y.length||B[L]!==Y[K]))W.push({type:"removed",line:B[L]}),L++;else if(X<$.length)W.push({type:"added",line:$[X]}),X++;return T1("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden group/diff","data-md":"diff","data-md-language":Q||"",children:[Q&&T1("div",{className:"px-4 py-2 text-meta font-mono text-text-tertiary opacity-0 group-hover/diff:opacity-60 transition-opacity",children:["diff (",Q,")"]},void 0,!0,void 0,this),T1("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono",children:W.map((N,G)=>T1("div",{className:N.type==="removed"?"bg-accent-red-muted text-accent-red":N.type==="added"?"bg-accent-green-muted text-accent-green":"text-text-tertiary",children:[T1("span",{className:"select-none w-6 inline-block text-center opacity-60",children:N.type==="removed"?"-":N.type==="added"?"+":" "},void 0,!1,void 0,this),N.line]},G,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function k5(J,y){let Q=J.length,B=y.length,$=Array.from({length:Q+1},()=>Array(B+1).fill(0));for(let X=1;X<=Q;X++)for(let K=1;K<=B;K++)$[X][K]=J[X-1]===y[K-1]?$[X-1][K-1]+1:Math.max($[X-1][K],$[X][K-1]);let Y=[],W=Q,L=B;while(W>0&&L>0)if(J[W-1]===y[L-1])Y.unshift(J[W-1]),W--,L--;else if($[W-1][L]>$[W][L-1])W--;else L--;return Y}import{useEffect as U0,useRef as P0,useState as H0}from"react";import{useAnnotations as b0}from"#canvas/runtime";import{jsxDEV as G0}from"react/jsx-dev-runtime";function H1({note:J,onChange:y}){return G0("div",{className:"mt-1.5",children:G0("textarea",{value:J,onChange:(Q)=>y(Q.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:(Q)=>B1(Q.target),ref:(Q)=>{if(Q)B1(Q)}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as z}from"react/jsx-dev-runtime";function z5({id:J,label:y,options:Q,required:B}){let{responses:$,setResponse:Y}=b0(),W=$.get(J),L=W?.value,X=W?.note||"",[K,N]=H0(!1),G=P0(null);if(!$.has(J))Y(J,{id:J,type:"radio",label:y,value:null,options:Q,required:B});let U=(q)=>{Y(J,{...W,value:q})};U0(()=>{let q=G.current;if(!q)return;let b=(P)=>{let k=P.target.closest("[data-md-label]")?.getAttribute("data-md-label");if(k&&Q.includes(k))U(k)};return q.addEventListener("kb-select",b),()=>q.removeEventListener("kb-select",b)},[Q,U]);let T=W?.required&&!L;return z("div",{ref:G,"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:[z("div",{className:"flex items-baseline gap-2 mb-2",children:[z("span",{className:"text-[13px] font-body font-medium text-text-primary",children:y},void 0,!1,void 0,this),B&&z("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z("div",{className:"space-y-1",children:Q.map((q)=>z("label",{"data-md":"choice-option","data-md-label":q,onClick:()=>U(q),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${L===q?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[z("span",{className:`w-4 h-4 rounded-full border-[1.5px] flex items-center justify-center flex-shrink-0 transition-all ${L===q?"border-accent-amber bg-accent-amber":"border-border-strong"}`,children:L===q&&z("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),z("span",{className:"text-[13px] font-body text-text-secondary",children:q},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this),z(H1,{show:K,note:X,onToggle:()=>N(!K),onChange:(q)=>Y(J,{...W,note:q})},void 0,!1,void 0,this),T&&z("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 M5({id:J,label:y,options:Q,required:B}){let{responses:$,setResponse:Y}=b0(),W=$.get(J),L=W?.value||[],X=W?.note||"",[K,N]=H0(!1),G=P0(null);if(!$.has(J))Y(J,{id:J,type:"checkbox",label:y,value:[],options:Q,required:B});let U=(q)=>{let b=L.includes(q)?L.filter((P)=>P!==q):[...L,q];Y(J,{...W,value:b})};U0(()=>{let q=G.current;if(!q)return;let b=(P)=>{let k=P.target.closest("[data-md-label]")?.getAttribute("data-md-label");if(k&&Q.includes(k))U(k)};return q.addEventListener("kb-select",b),()=>q.removeEventListener("kb-select",b)},[Q,U]);let T=W?.required&&L.length===0;return z("div",{ref:G,"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:[z("div",{className:"flex items-baseline gap-2 mb-2",children:[z("span",{className:"text-[13px] font-body font-medium text-text-primary",children:y},void 0,!1,void 0,this),B&&z("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z("div",{className:"space-y-1",children:Q.map((q)=>{let b=L.includes(q);return z("label",{"data-md":"multichoice-option","data-md-label":q,onClick:()=>U(q),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${b?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[z("span",{className:`w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all ${b?"bg-accent-amber":"border-[1.5px] border-border-strong"}`,children:b&&z("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:z("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),z("span",{className:"text-[13px] font-body text-text-secondary",children:q},void 0,!1,void 0,this)]},q,!0,void 0,this)})},void 0,!1,void 0,this),z(H1,{show:K,note:X,onToggle:()=>N(!K),onChange:(q)=>Y(J,{...W,note:q})},void 0,!1,void 0,this),T&&z("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{useRef as O5,useState as T0}from"react";import{useAnnotations as Z0}from"#canvas/runtime";import{jsxDEV as v}from"react/jsx-dev-runtime";function S5({id:J,label:y,placeholder:Q,multiline:B,required:$}){let{responses:Y,setResponse:W}=Z0(),L=Y.get(J),X=L?.value??"",K=L?.note||"",[N,G]=T0(!1),U=O5(null);if(!Y.has(J))W(J,{id:J,type:"text",label:y,value:"",required:$});let T=(P)=>{W(J,{...L,value:P})},q=(P)=>B1(P,B?60:32),b=L?.required&&!X.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:U,value:X,onChange:(P)=>{T(P.target.value),q(P.target)},placeholder:Q||"Type your response...",rows:B?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)=>q(P.target),onFocus:(P)=>q(P.target)},void 0,!1,void 0,this),v(H1,{show:N,note:K,onToggle:()=>G(!N),onChange:(P)=>W(J,{...L,note:P})},void 0,!1,void 0,this),b&&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 I5({id:J,label:y,min:Q=1,max:B=10,step:$=1,required:Y,minLabel:W,maxLabel:L}){let{responses:X,setResponse:K}=Z0(),N=X.get(J),G=N?.value,U=N?.note||"",[T,q]=T0(!1);if(!X.has(J))K(J,{id:J,type:"range",label:y,value:null,required:Y});let b=(M)=>{K(J,{...N,value:M})},P=G!==null&&G!==void 0,_=P?G:Math.round((Q+B)/2),k=(_-Q)/(B-Q)*100,m=Math.round((B-Q)/$),r=m<=20,g=N?.required&&!P;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),Y&&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 ${P?"text-accent-amber":"text-text-disabled"}`,children:P?G:"—"},void 0,!1,void 0,this),P&&v("button",{onClick:()=>K(J,{...N,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:P&&v("div",{className:"h-full rounded-full bg-accent-amber transition-all duration-150",style:{width:`${k}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),r&&Array.from({length:m+1},(M,x)=>{let I=Q+x*$,E=(I-Q)/(B-Q)*100,O=P&&I<=G;return v("div",{className:`absolute rounded-full pointer-events-none transition-all duration-150 ${P&&I===G?"w-2.5 h-2.5 bg-accent-amber":O?"w-1.5 h-1.5 bg-accent-amber":"w-1.5 h-1.5 bg-border-hover"}`,style:{left:`${E}%`,transform:"translate(-50%, -50%)",top:"50%"}},x,!1,void 0,this)}),P?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(${k}% - 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:Q,max:B,step:$,value:_,onChange:(M)=>b(Number(M.target.value)),className:"absolute inset-0 w-full opacity-0 cursor-pointer"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r&&m<=10?v("div",{className:"flex justify-between -mt-0.5 px-0",children:Array.from({length:m+1},(M,x)=>{let I=Q+x*$;return v("span",{className:`text-[10px] font-mono transition-colors ${P&&I===G?"text-accent-amber font-medium":"text-text-disabled"}`,style:{minWidth:"1ch",textAlign:"center"},children:I},x,!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:W||Q},void 0,!1,void 0,this),v("span",{className:"text-[11px] text-text-tertiary font-body",children:L||B},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v(H1,{show:T,note:U,onToggle:()=>q(!T),onChange:(M)=>K(J,{...N,note:M})},void 0,!1,void 0,this),g&&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 m5,useState as C5}from"react";import{SessionContext as R5}from"#canvas/runtime";import{jsxDEV as Z1}from"react/jsx-dev-runtime";function h5({src:J,alt:y,caption:Q,width:B,height:$}){let Y=m5(R5),[W,L]=C5(!1),X=`/api/image?session=${encodeURIComponent(Y)}&path=${encodeURIComponent(J)}`;if(W)return Z1("div",{className:"mt-3 text-accent-red text-body bg-accent-red-muted rounded-md p-4",children:[J,": Failed to load image"]},void 0,!0,void 0,this);return Z1("figure",{className:"mt-3 relative","data-md":"image","data-md-src":J,children:[Z1("div",{className:"rounded-md overflow-hidden border border-border-subtle bg-bg-code inline-block",children:Z1("img",{src:X,alt:y||J,onError:()=>L(!0),className:"block max-w-full h-auto",...B?{width:B}:{},...$?{height:$}:{}},void 0,!1,void 0,this)},void 0,!1,void 0,this),Q&&Z1("figcaption",{className:"mt-1.5 text-meta text-text-tertiary font-body",children:Q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useMemo as vy}from"react";function d1(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var L1=d1();function k0(J){L1=J}var W1={exec:()=>null};function w(J,y=""){let Q=typeof J=="string"?J:J.source,B={replace:($,Y)=>{let W=typeof Y=="string"?Y:Y.source;return W=W.replace(V.caret,"$1"),Q=Q.replace($,W),B},getRegex:()=>new RegExp(Q,y)};return B}var g5=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),V={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:(J)=>new RegExp(`^( {0,3}${J})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:(J)=>new RegExp(`^ {0,${Math.min(3,J-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:(J)=>new RegExp(`^ {0,${Math.min(3,J-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:(J)=>new RegExp(`^ {0,${Math.min(3,J-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:(J)=>new RegExp(`^ {0,${Math.min(3,J-1)}}#`),htmlBeginRegex:(J)=>new RegExp(`^ {0,${Math.min(3,J-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:(J)=>new RegExp(`^ {0,${Math.min(3,J-1)}}>`)},j5=/^(?:[ \t]*(?:\n|$))+/,V5=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,x5=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,w1=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,D5=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,u1=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,z0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,M0=w(z0).replace(/bull/g,u1).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(),c5=w(z0).replace(/bull/g,u1).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(),r1=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,p5=/^[^\n]+/,i1=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,E5=w(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",i1).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),d5=w(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,u1).getRegex(),R1="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",l1=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,u5=w("^ {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",l1).replace("tag",R1).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),O0=w(r1).replace("hr",w1).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",R1).getRegex(),r5=w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",O0).getRegex(),a1={blockquote:r5,code:V5,def:E5,fences:x5,heading:D5,hr:w1,html:u5,lheading:M0,list:d5,newline:j5,paragraph:O0,table:W1,text:p5},F0=w("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",w1).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",R1).getRegex(),i5={...a1,lheading:c5,table:F0,paragraph:w(r1).replace("hr",w1).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",F0).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",R1).getRegex()},l5={...a1,html:w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",l1).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:W1,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:w(r1).replace("hr",w1).replace("heading",` *#{1,6} *[^
6
+ ]`).replace("lheading",M0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},a5=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,o5=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,S0=/^( {2,}|\\)\n(?!\s*$)/,s5=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,h1=/[\p{P}\p{S}]/u,o1=/[\s\p{P}\p{S}]/u,I0=/[^\s\p{P}\p{S}]/u,n5=w(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,o1).getRegex(),m0=/(?!~)[\p{P}\p{S}]/u,t5=/(?!~)[\s\p{P}\p{S}]/u,e5=/(?:[^\s\p{P}\p{S}]|~)/u,C0=/(?![*_])[\p{P}\p{S}]/u,yy=/(?![*_])[\s\p{P}\p{S}]/u,$y=/(?:[^\s\p{P}\p{S}]|[*_])/u,Jy=w(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",g5?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),R0=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Qy=w(R0,"u").replace(/punct/g,h1).getRegex(),By=w(R0,"u").replace(/punct/g,m0).getRegex(),h0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Yy=w(h0,"gu").replace(/notPunctSpace/g,I0).replace(/punctSpace/g,o1).replace(/punct/g,h1).getRegex(),Wy=w(h0,"gu").replace(/notPunctSpace/g,e5).replace(/punctSpace/g,t5).replace(/punct/g,m0).getRegex(),Xy=w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,I0).replace(/punctSpace/g,o1).replace(/punct/g,h1).getRegex(),Ly=w(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,C0).getRegex(),Ky="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ny=w(Ky,"gu").replace(/notPunctSpace/g,$y).replace(/punctSpace/g,yy).replace(/punct/g,C0).getRegex(),qy=w(/\\(punct)/,"gu").replace(/punct/g,h1).getRegex(),Gy=w(/^<(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(),Uy=w(l1).replace("(?:-->|$)","-->").getRegex(),Py=w("^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",Uy).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),I1=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Hy=w(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",I1).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),g0=w(/^!?\[(label)\]\[(ref)\]/).replace("label",I1).replace("ref",i1).getRegex(),j0=w(/^!?\[(ref)\](?:\[\])?/).replace("ref",i1).getRegex(),by=w("reflink|nolink(?!\\()","g").replace("reflink",g0).replace("nolink",j0).getRegex(),f0=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,s1={_backpedal:W1,anyPunctuation:qy,autolink:Gy,blockSkip:Jy,br:S0,code:o5,del:W1,delLDelim:W1,delRDelim:W1,emStrongLDelim:Qy,emStrongRDelimAst:Yy,emStrongRDelimUnd:Xy,escape:a5,link:Hy,nolink:j0,punctuation:n5,reflink:g0,reflinkSearch:by,tag:Py,text:s5,url:W1},Ty={...s1,link:w(/^!?\[(label)\]\((.*?)\)/).replace("label",I1).getRegex(),reflink:w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",I1).getRegex()},E1={...s1,emStrongRDelimAst:Wy,emStrongLDelim:By,delLDelim:Ly,delRDelim:Ny,url:w(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",f0).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:w(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",f0).getRegex()},Zy={...E1,br:w(S0).replace("{2,}","*").getRegex(),text:w(E1.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},S1={normal:a1,gfm:i5,pedantic:l5},F1={normal:s1,gfm:E1,breaks:Zy,pedantic:Ty},Fy={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},_0=(J)=>Fy[J];function n(J,y){if(y){if(V.escapeTest.test(J))return J.replace(V.escapeReplace,_0)}else if(V.escapeTestNoEncode.test(J))return J.replace(V.escapeReplaceNoEncode,_0);return J}function w0(J){try{J=encodeURI(J).replace(V.percentDecode,"%")}catch{return null}return J}function A0(J,y){let Q=J.replace(V.findPipe,(Y,W,L)=>{let X=!1,K=W;for(;--K>=0&&L[K]==="\\";)X=!X;return X?"|":" |"}),B=Q.split(V.splitPipe),$=0;if(B[0].trim()||B.shift(),B.length>0&&!B.at(-1)?.trim()&&B.pop(),y)if(B.length>y)B.splice(y);else for(;B.length<y;)B.push("");for(;$<B.length;$++)B[$]=B[$].trim().replace(V.slashPipe,"|");return B}function f1(J,y,Q){let B=J.length;if(B===0)return"";let $=0;for(;$<B;){let Y=J.charAt(B-$-1);if(Y===y&&!Q)$++;else if(Y!==y&&Q)$++;else break}return J.slice(0,B-$)}function fy(J,y){if(J.indexOf(y[1])===-1)return-1;let Q=0;for(let B=0;B<J.length;B++)if(J[B]==="\\")B++;else if(J[B]===y[0])Q++;else if(J[B]===y[1]&&(Q--,Q<0))return B;return Q>0?-2:-1}function _y(J,y=0){let Q=y,B="";for(let $ of J)if($==="\t"){let Y=4-Q%4;B+=" ".repeat(Y),Q+=Y}else B+=$,Q++;return B}function v0(J,y,Q,B,$){let Y=y.href,W=y.title||null,L=J[1].replace($.other.outputLinkReplace,"$1");B.state.inLink=!0;let X={type:J[0].charAt(0)==="!"?"image":"link",raw:Q,href:Y,title:W,text:L,tokens:B.inlineTokens(L)};return B.state.inLink=!1,X}function wy(J,y,Q){let B=J.match(Q.other.indentCodeCompensation);if(B===null)return y;let $=B[1];return y.split(`
7
+ `).map((Y)=>{let W=Y.match(Q.other.beginningSpace);if(W===null)return Y;let[L]=W;return L.length>=$.length?Y.slice($.length):Y}).join(`
8
+ `)}var m1=class{options;rules;lexer;constructor(J){this.options=J||L1}space(J){let y=this.rules.block.newline.exec(J);if(y&&y[0].length>0)return{type:"space",raw:y[0]}}code(J){let y=this.rules.block.code.exec(J);if(y){let Q=y[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:y[0],codeBlockStyle:"indented",text:this.options.pedantic?Q:f1(Q,`
9
+ `)}}}fences(J){let y=this.rules.block.fences.exec(J);if(y){let Q=y[0],B=wy(Q,y[3]||"",this.rules);return{type:"code",raw:Q,lang:y[2]?y[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):y[2],text:B}}}heading(J){let y=this.rules.block.heading.exec(J);if(y){let Q=y[2].trim();if(this.rules.other.endingHash.test(Q)){let B=f1(Q,"#");(this.options.pedantic||!B||this.rules.other.endingSpaceChar.test(B))&&(Q=B.trim())}return{type:"heading",raw:y[0],depth:y[1].length,text:Q,tokens:this.lexer.inline(Q)}}}hr(J){let y=this.rules.block.hr.exec(J);if(y)return{type:"hr",raw:f1(y[0],`
10
+ `)}}blockquote(J){let y=this.rules.block.blockquote.exec(J);if(y){let Q=f1(y[0],`
11
+ `).split(`
12
+ `),B="",$="",Y=[];for(;Q.length>0;){let W=!1,L=[],X;for(X=0;X<Q.length;X++)if(this.rules.other.blockquoteStart.test(Q[X]))L.push(Q[X]),W=!0;else if(!W)L.push(Q[X]);else break;Q=Q.slice(X);let K=L.join(`
13
+ `),N=K.replace(this.rules.other.blockquoteSetextReplace,`
14
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");B=B?`${B}
15
+ ${K}`:K,$=$?`${$}
16
+ ${N}`:N;let G=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(N,Y,!0),this.lexer.state.top=G,Q.length===0)break;let U=Y.at(-1);if(U?.type==="code")break;if(U?.type==="blockquote"){let T=U,q=T.raw+`
17
+ `+Q.join(`
18
+ `),b=this.blockquote(q);Y[Y.length-1]=b,B=B.substring(0,B.length-T.raw.length)+b.raw,$=$.substring(0,$.length-T.text.length)+b.text;break}else if(U?.type==="list"){let T=U,q=T.raw+`
19
+ `+Q.join(`
20
+ `),b=this.list(q);Y[Y.length-1]=b,B=B.substring(0,B.length-U.raw.length)+b.raw,$=$.substring(0,$.length-T.raw.length)+b.raw,Q=q.substring(Y.at(-1).raw.length).split(`
21
+ `);continue}}return{type:"blockquote",raw:B,tokens:Y,text:$}}}list(J){let y=this.rules.block.list.exec(J);if(y){let Q=y[1].trim(),B=Q.length>1,$={type:"list",raw:"",ordered:B,start:B?+Q.slice(0,-1):"",loose:!1,items:[]};Q=B?`\\d{1,9}\\${Q.slice(-1)}`:`\\${Q}`,this.options.pedantic&&(Q=B?Q:"[*+-]");let Y=this.rules.other.listItemRegex(Q),W=!1;for(;J;){let X=!1,K="",N="";if(!(y=Y.exec(J))||this.rules.block.hr.test(J))break;K=y[0],J=J.substring(K.length);let G=_y(y[2].split(`
22
+ `,1)[0],y[1].length),U=J.split(`
23
+ `,1)[0],T=!G.trim(),q=0;if(this.options.pedantic?(q=2,N=G.trimStart()):T?q=y[1].length+1:(q=G.search(this.rules.other.nonSpaceChar),q=q>4?1:q,N=G.slice(q),q+=y[1].length),T&&this.rules.other.blankLine.test(U)&&(K+=U+`
24
+ `,J=J.substring(U.length+1),X=!0),!X){let b=this.rules.other.nextBulletRegex(q),P=this.rules.other.hrRegex(q),_=this.rules.other.fencesBeginRegex(q),k=this.rules.other.headingBeginRegex(q),m=this.rules.other.htmlBeginRegex(q),r=this.rules.other.blockquoteBeginRegex(q);for(;J;){let g=J.split(`
25
+ `,1)[0],M;if(U=g,this.options.pedantic?(U=U.replace(this.rules.other.listReplaceNesting," "),M=U):M=U.replace(this.rules.other.tabCharGlobal," "),_.test(U)||k.test(U)||m.test(U)||r.test(U)||b.test(U)||P.test(U))break;if(M.search(this.rules.other.nonSpaceChar)>=q||!U.trim())N+=`
26
+ `+M.slice(q);else{if(T||G.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(G)||k.test(G)||P.test(G))break;N+=`
27
+ `+U}T=!U.trim(),K+=g+`
28
+ `,J=J.substring(g.length+1),G=M.slice(q)}}$.loose||(W?$.loose=!0:this.rules.other.doubleBlankLine.test(K)&&(W=!0)),$.items.push({type:"list_item",raw:K,task:!!this.options.gfm&&this.rules.other.listIsTask.test(N),loose:!1,text:N,tokens:[]}),$.raw+=K}let L=$.items.at(-1);if(L)L.raw=L.raw.trimEnd(),L.text=L.text.trimEnd();else return;$.raw=$.raw.trimEnd();for(let X of $.items){if(this.lexer.state.top=!1,X.tokens=this.lexer.blockTokens(X.text,[]),X.task){if(X.text=X.text.replace(this.rules.other.listReplaceTask,""),X.tokens[0]?.type==="text"||X.tokens[0]?.type==="paragraph"){X.tokens[0].raw=X.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),X.tokens[0].text=X.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let N=this.lexer.inlineQueue.length-1;N>=0;N--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[N].src)){this.lexer.inlineQueue[N].src=this.lexer.inlineQueue[N].src.replace(this.rules.other.listReplaceTask,"");break}}let K=this.rules.other.listTaskCheckbox.exec(X.raw);if(K){let N={type:"checkbox",raw:K[0]+" ",checked:K[0]!=="[ ]"};X.checked=N.checked,$.loose?X.tokens[0]&&["paragraph","text"].includes(X.tokens[0].type)&&"tokens"in X.tokens[0]&&X.tokens[0].tokens?(X.tokens[0].raw=N.raw+X.tokens[0].raw,X.tokens[0].text=N.raw+X.tokens[0].text,X.tokens[0].tokens.unshift(N)):X.tokens.unshift({type:"paragraph",raw:N.raw,text:N.raw,tokens:[N]}):X.tokens.unshift(N)}}if(!$.loose){let K=X.tokens.filter((G)=>G.type==="space"),N=K.length>0&&K.some((G)=>this.rules.other.anyLine.test(G.raw));$.loose=N}}if($.loose)for(let X of $.items){X.loose=!0;for(let K of X.tokens)K.type==="text"&&(K.type="paragraph")}return $}}html(J){let y=this.rules.block.html.exec(J);if(y)return{type:"html",block:!0,raw:y[0],pre:y[1]==="pre"||y[1]==="script"||y[1]==="style",text:y[0]}}def(J){let y=this.rules.block.def.exec(J);if(y){let Q=y[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),B=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:Q,raw:y[0],href:B,title:$}}}table(J){let y=this.rules.block.table.exec(J);if(!y||!this.rules.other.tableDelimiter.test(y[2]))return;let Q=A0(y[1]),B=y[2].replace(this.rules.other.tableAlignChars,"").split("|"),$=y[3]?.trim()?y[3].replace(this.rules.other.tableRowBlankLine,"").split(`
29
+ `):[],Y={type:"table",raw:y[0],header:[],align:[],rows:[]};if(Q.length===B.length){for(let W of B)this.rules.other.tableAlignRight.test(W)?Y.align.push("right"):this.rules.other.tableAlignCenter.test(W)?Y.align.push("center"):this.rules.other.tableAlignLeft.test(W)?Y.align.push("left"):Y.align.push(null);for(let W=0;W<Q.length;W++)Y.header.push({text:Q[W],tokens:this.lexer.inline(Q[W]),header:!0,align:Y.align[W]});for(let W of $)Y.rows.push(A0(W,Y.header.length).map((L,X)=>({text:L,tokens:this.lexer.inline(L),header:!1,align:Y.align[X]})));return Y}}lheading(J){let y=this.rules.block.lheading.exec(J);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(J){let y=this.rules.block.paragraph.exec(J);if(y){let Q=y[1].charAt(y[1].length-1)===`
30
+ `?y[1].slice(0,-1):y[1];return{type:"paragraph",raw:y[0],text:Q,tokens:this.lexer.inline(Q)}}}text(J){let y=this.rules.block.text.exec(J);if(y)return{type:"text",raw:y[0],text:y[0],tokens:this.lexer.inline(y[0])}}escape(J){let y=this.rules.inline.escape.exec(J);if(y)return{type:"escape",raw:y[0],text:y[1]}}tag(J){let y=this.rules.inline.tag.exec(J);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(J){let y=this.rules.inline.link.exec(J);if(y){let Q=y[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(Q)){if(!this.rules.other.endAngleBracket.test(Q))return;let Y=f1(Q.slice(0,-1),"\\");if((Q.length-Y.length)%2===0)return}else{let Y=fy(y[2],"()");if(Y===-2)return;if(Y>-1){let W=(y[0].indexOf("!")===0?5:4)+y[1].length+Y;y[2]=y[2].substring(0,Y),y[0]=y[0].substring(0,W).trim(),y[3]=""}}let B=y[2],$="";if(this.options.pedantic){let Y=this.rules.other.pedanticHrefTitle.exec(B);Y&&(B=Y[1],$=Y[3])}else $=y[3]?y[3].slice(1,-1):"";return B=B.trim(),this.rules.other.startAngleBracket.test(B)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(Q)?B=B.slice(1):B=B.slice(1,-1)),v0(y,{href:B&&B.replace(this.rules.inline.anyPunctuation,"$1"),title:$&&$.replace(this.rules.inline.anyPunctuation,"$1")},y[0],this.lexer,this.rules)}}reflink(J,y){let Q;if((Q=this.rules.inline.reflink.exec(J))||(Q=this.rules.inline.nolink.exec(J))){let B=(Q[2]||Q[1]).replace(this.rules.other.multipleSpaceGlobal," "),$=y[B.toLowerCase()];if(!$){let Y=Q[0].charAt(0);return{type:"text",raw:Y,text:Y}}return v0(Q,$,Q[0],this.lexer,this.rules)}}emStrong(J,y,Q=""){let B=this.rules.inline.emStrongLDelim.exec(J);if(!B||B[3]&&Q.match(this.rules.other.unicodeAlphaNumeric))return;if(!(B[1]||B[2])||!Q||this.rules.inline.punctuation.exec(Q)){let $=[...B[0]].length-1,Y,W,L=$,X=0,K=B[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(K.lastIndex=0,y=y.slice(-1*J.length+$);(B=K.exec(y))!=null;){if(Y=B[1]||B[2]||B[3]||B[4]||B[5]||B[6],!Y)continue;if(W=[...Y].length,B[3]||B[4]){L+=W;continue}else if((B[5]||B[6])&&$%3&&!(($+W)%3)){X+=W;continue}if(L-=W,L>0)continue;W=Math.min(W,W+L+X);let N=[...B[0]][0].length,G=J.slice(0,$+B.index+N+W);if(Math.min($,W)%2){let T=G.slice(1,-1);return{type:"em",raw:G,text:T,tokens:this.lexer.inlineTokens(T)}}let U=G.slice(2,-2);return{type:"strong",raw:G,text:U,tokens:this.lexer.inlineTokens(U)}}}}codespan(J){let y=this.rules.inline.code.exec(J);if(y){let Q=y[2].replace(this.rules.other.newLineCharGlobal," "),B=this.rules.other.nonSpaceChar.test(Q),$=this.rules.other.startingSpaceChar.test(Q)&&this.rules.other.endingSpaceChar.test(Q);return B&&$&&(Q=Q.substring(1,Q.length-1)),{type:"codespan",raw:y[0],text:Q}}}br(J){let y=this.rules.inline.br.exec(J);if(y)return{type:"br",raw:y[0]}}del(J,y,Q=""){let B=this.rules.inline.delLDelim.exec(J);if(!B)return;if(!B[1]||!Q||this.rules.inline.punctuation.exec(Q)){let $=[...B[0]].length-1,Y,W,L=$,X=this.rules.inline.delRDelim;for(X.lastIndex=0,y=y.slice(-1*J.length+$);(B=X.exec(y))!=null;){if(Y=B[1]||B[2]||B[3]||B[4]||B[5]||B[6],!Y||(W=[...Y].length,W!==$))continue;if(B[3]||B[4]){L+=W;continue}if(L-=W,L>0)continue;W=Math.min(W,W+L);let K=[...B[0]][0].length,N=J.slice(0,$+B.index+K+W),G=N.slice($,-$);return{type:"del",raw:N,text:G,tokens:this.lexer.inlineTokens(G)}}}}autolink(J){let y=this.rules.inline.autolink.exec(J);if(y){let Q,B;return y[2]==="@"?(Q=y[1],B="mailto:"+Q):(Q=y[1],B=Q),{type:"link",raw:y[0],text:Q,href:B,tokens:[{type:"text",raw:Q,text:Q}]}}}url(J){let y;if(y=this.rules.inline.url.exec(J)){let Q,B;if(y[2]==="@")Q=y[0],B="mailto:"+Q;else{let $;do $=y[0],y[0]=this.rules.inline._backpedal.exec(y[0])?.[0]??"";while($!==y[0]);Q=y[0],y[1]==="www."?B="http://"+y[0]:B=y[0]}return{type:"link",raw:y[0],text:Q,href:B,tokens:[{type:"text",raw:Q,text:Q}]}}}inlineText(J){let y=this.rules.inline.text.exec(J);if(y){let Q=this.lexer.state.inRawBlock;return{type:"text",raw:y[0],text:y[0],escaped:Q}}}},l=class J{tokens;options;state;inlineQueue;tokenizer;constructor(y){this.tokens=[],this.tokens.links=Object.create(null),this.options=y||L1,this.options.tokenizer=this.options.tokenizer||new m1,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 Q={other:V,block:S1.normal,inline:F1.normal};this.options.pedantic?(Q.block=S1.pedantic,Q.inline=F1.pedantic):this.options.gfm&&(Q.block=S1.gfm,this.options.breaks?Q.inline=F1.breaks:Q.inline=F1.gfm),this.tokenizer.rules=Q}static get rules(){return{block:S1,inline:F1}}static lex(y,Q){return new J(Q).lex(y)}static lexInline(y,Q){return new J(Q).inlineTokens(y)}lex(y){y=y.replace(V.carriageReturn,`
31
+ `),this.blockTokens(y,this.tokens);for(let Q=0;Q<this.inlineQueue.length;Q++){let B=this.inlineQueue[Q];this.inlineTokens(B.src,B.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(y,Q=[],B=!1){for(this.options.pedantic&&(y=y.replace(V.tabCharGlobal," ").replace(V.spaceLine,""));y;){let $;if(this.options.extensions?.block?.some((W)=>($=W.call({lexer:this},y,Q))?(y=y.substring($.raw.length),Q.push($),!0):!1))continue;if($=this.tokenizer.space(y)){y=y.substring($.raw.length);let W=Q.at(-1);$.raw.length===1&&W!==void 0?W.raw+=`
32
+ `:Q.push($);continue}if($=this.tokenizer.code(y)){y=y.substring($.raw.length);let W=Q.at(-1);W?.type==="paragraph"||W?.type==="text"?(W.raw+=(W.raw.endsWith(`
33
+ `)?"":`
34
+ `)+$.raw,W.text+=`
35
+ `+$.text,this.inlineQueue.at(-1).src=W.text):Q.push($);continue}if($=this.tokenizer.fences(y)){y=y.substring($.raw.length),Q.push($);continue}if($=this.tokenizer.heading(y)){y=y.substring($.raw.length),Q.push($);continue}if($=this.tokenizer.hr(y)){y=y.substring($.raw.length),Q.push($);continue}if($=this.tokenizer.blockquote(y)){y=y.substring($.raw.length),Q.push($);continue}if($=this.tokenizer.list(y)){y=y.substring($.raw.length),Q.push($);continue}if($=this.tokenizer.html(y)){y=y.substring($.raw.length),Q.push($);continue}if($=this.tokenizer.def(y)){y=y.substring($.raw.length);let W=Q.at(-1);W?.type==="paragraph"||W?.type==="text"?(W.raw+=(W.raw.endsWith(`
36
+ `)?"":`
37
+ `)+$.raw,W.text+=`
38
+ `+$.raw,this.inlineQueue.at(-1).src=W.text):this.tokens.links[$.tag]||(this.tokens.links[$.tag]={href:$.href,title:$.title},Q.push($));continue}if($=this.tokenizer.table(y)){y=y.substring($.raw.length),Q.push($);continue}if($=this.tokenizer.lheading(y)){y=y.substring($.raw.length),Q.push($);continue}let Y=y;if(this.options.extensions?.startBlock){let W=1/0,L=y.slice(1),X;this.options.extensions.startBlock.forEach((K)=>{X=K.call({lexer:this},L),typeof X=="number"&&X>=0&&(W=Math.min(W,X))}),W<1/0&&W>=0&&(Y=y.substring(0,W+1))}if(this.state.top&&($=this.tokenizer.paragraph(Y))){let W=Q.at(-1);B&&W?.type==="paragraph"?(W.raw+=(W.raw.endsWith(`
39
+ `)?"":`
40
+ `)+$.raw,W.text+=`
41
+ `+$.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=W.text):Q.push($),B=Y.length!==y.length,y=y.substring($.raw.length);continue}if($=this.tokenizer.text(y)){y=y.substring($.raw.length);let W=Q.at(-1);W?.type==="text"?(W.raw+=(W.raw.endsWith(`
42
+ `)?"":`
43
+ `)+$.raw,W.text+=`
44
+ `+$.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=W.text):Q.push($);continue}if(y){let W="Infinite loop on byte: "+y.charCodeAt(0);if(this.options.silent){console.error(W);break}else throw Error(W)}}return this.state.top=!0,Q}inline(y,Q=[]){return this.inlineQueue.push({src:y,tokens:Q}),Q}inlineTokens(y,Q=[]){let B=y,$=null;if(this.tokens.links){let X=Object.keys(this.tokens.links);if(X.length>0)for(;($=this.tokenizer.rules.inline.reflinkSearch.exec(B))!=null;)X.includes($[0].slice($[0].lastIndexOf("[")+1,-1))&&(B=B.slice(0,$.index)+"["+"a".repeat($[0].length-2)+"]"+B.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;($=this.tokenizer.rules.inline.anyPunctuation.exec(B))!=null;)B=B.slice(0,$.index)+"++"+B.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let Y;for(;($=this.tokenizer.rules.inline.blockSkip.exec(B))!=null;)Y=$[2]?$[2].length:0,B=B.slice(0,$.index+Y)+"["+"a".repeat($[0].length-Y-2)+"]"+B.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);B=this.options.hooks?.emStrongMask?.call({lexer:this},B)??B;let W=!1,L="";for(;y;){W||(L=""),W=!1;let X;if(this.options.extensions?.inline?.some((N)=>(X=N.call({lexer:this},y,Q))?(y=y.substring(X.raw.length),Q.push(X),!0):!1))continue;if(X=this.tokenizer.escape(y)){y=y.substring(X.raw.length),Q.push(X);continue}if(X=this.tokenizer.tag(y)){y=y.substring(X.raw.length),Q.push(X);continue}if(X=this.tokenizer.link(y)){y=y.substring(X.raw.length),Q.push(X);continue}if(X=this.tokenizer.reflink(y,this.tokens.links)){y=y.substring(X.raw.length);let N=Q.at(-1);X.type==="text"&&N?.type==="text"?(N.raw+=X.raw,N.text+=X.text):Q.push(X);continue}if(X=this.tokenizer.emStrong(y,B,L)){y=y.substring(X.raw.length),Q.push(X);continue}if(X=this.tokenizer.codespan(y)){y=y.substring(X.raw.length),Q.push(X);continue}if(X=this.tokenizer.br(y)){y=y.substring(X.raw.length),Q.push(X);continue}if(X=this.tokenizer.del(y,B,L)){y=y.substring(X.raw.length),Q.push(X);continue}if(X=this.tokenizer.autolink(y)){y=y.substring(X.raw.length),Q.push(X);continue}if(!this.state.inLink&&(X=this.tokenizer.url(y))){y=y.substring(X.raw.length),Q.push(X);continue}let K=y;if(this.options.extensions?.startInline){let N=1/0,G=y.slice(1),U;this.options.extensions.startInline.forEach((T)=>{U=T.call({lexer:this},G),typeof U=="number"&&U>=0&&(N=Math.min(N,U))}),N<1/0&&N>=0&&(K=y.substring(0,N+1))}if(X=this.tokenizer.inlineText(K)){y=y.substring(X.raw.length),X.raw.slice(-1)!=="_"&&(L=X.raw.slice(-1)),W=!0;let N=Q.at(-1);N?.type==="text"?(N.raw+=X.raw,N.text+=X.text):Q.push(X);continue}if(y){let N="Infinite loop on byte: "+y.charCodeAt(0);if(this.options.silent){console.error(N);break}else throw Error(N)}}return Q}},C1=class{options;parser;constructor(J){this.options=J||L1}space(J){return""}code({text:J,lang:y,escaped:Q}){let B=(y||"").match(V.notSpaceStart)?.[0],$=J.replace(V.endingNewline,"")+`
45
+ `;return B?'<pre><code class="language-'+n(B)+'">'+(Q?$:n($,!0))+`</code></pre>
46
+ `:"<pre><code>"+(Q?$:n($,!0))+`</code></pre>
47
+ `}blockquote({tokens:J}){return`<blockquote>
48
+ ${this.parser.parse(J)}</blockquote>
49
+ `}html({text:J}){return J}def(J){return""}heading({tokens:J,depth:y}){return`<h${y}>${this.parser.parseInline(J)}</h${y}>
50
+ `}hr(J){return`<hr>
51
+ `}list(J){let{ordered:y,start:Q}=J,B="";for(let W=0;W<J.items.length;W++){let L=J.items[W];B+=this.listitem(L)}let $=y?"ol":"ul",Y=y&&Q!==1?' start="'+Q+'"':"";return"<"+$+Y+`>
52
+ `+B+"</"+$+`>
53
+ `}listitem(J){return`<li>${this.parser.parse(J.tokens)}</li>
54
+ `}checkbox({checked:J}){return"<input "+(J?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:J}){return`<p>${this.parser.parseInline(J)}</p>
55
+ `}table(J){let y="",Q="";for(let $=0;$<J.header.length;$++)Q+=this.tablecell(J.header[$]);y+=this.tablerow({text:Q});let B="";for(let $=0;$<J.rows.length;$++){let Y=J.rows[$];Q="";for(let W=0;W<Y.length;W++)Q+=this.tablecell(Y[W]);B+=this.tablerow({text:Q})}return B&&(B=`<tbody>${B}</tbody>`),`<table>
56
+ <thead>
57
+ `+y+`</thead>
58
+ `+B+`</table>
59
+ `}tablerow({text:J}){return`<tr>
60
+ ${J}</tr>
61
+ `}tablecell(J){let y=this.parser.parseInline(J.tokens),Q=J.header?"th":"td";return(J.align?`<${Q} align="${J.align}">`:`<${Q}>`)+y+`</${Q}>
62
+ `}strong({tokens:J}){return`<strong>${this.parser.parseInline(J)}</strong>`}em({tokens:J}){return`<em>${this.parser.parseInline(J)}</em>`}codespan({text:J}){return`<code>${n(J,!0)}</code>`}br(J){return"<br>"}del({tokens:J}){return`<del>${this.parser.parseInline(J)}</del>`}link({href:J,title:y,tokens:Q}){let B=this.parser.parseInline(Q),$=w0(J);if($===null)return B;J=$;let Y='<a href="'+J+'"';return y&&(Y+=' title="'+n(y)+'"'),Y+=">"+B+"</a>",Y}image({href:J,title:y,text:Q,tokens:B}){B&&(Q=this.parser.parseInline(B,this.parser.textRenderer));let $=w0(J);if($===null)return n(Q);J=$;let Y=`<img src="${J}" alt="${n(Q)}"`;return y&&(Y+=` title="${n(y)}"`),Y+=">",Y}text(J){return"tokens"in J&&J.tokens?this.parser.parseInline(J.tokens):("escaped"in J)&&J.escaped?J.text:n(J.text)}},n1=class{strong({text:J}){return J}em({text:J}){return J}codespan({text:J}){return J}del({text:J}){return J}html({text:J}){return J}text({text:J}){return J}link({text:J}){return""+J}image({text:J}){return""+J}br(){return""}checkbox({raw:J}){return J}},a=class J{options;renderer;textRenderer;constructor(y){this.options=y||L1,this.options.renderer=this.options.renderer||new C1,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new n1}static parse(y,Q){return new J(Q).parse(y)}static parseInline(y,Q){return new J(Q).parseInline(y)}parse(y){let Q="";for(let B=0;B<y.length;B++){let $=y[B];if(this.options.extensions?.renderers?.[$.type]){let W=$,L=this.options.extensions.renderers[W.type].call({parser:this},W);if(L!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(W.type)){Q+=L||"";continue}}let Y=$;switch(Y.type){case"space":{Q+=this.renderer.space(Y);break}case"hr":{Q+=this.renderer.hr(Y);break}case"heading":{Q+=this.renderer.heading(Y);break}case"code":{Q+=this.renderer.code(Y);break}case"table":{Q+=this.renderer.table(Y);break}case"blockquote":{Q+=this.renderer.blockquote(Y);break}case"list":{Q+=this.renderer.list(Y);break}case"checkbox":{Q+=this.renderer.checkbox(Y);break}case"html":{Q+=this.renderer.html(Y);break}case"def":{Q+=this.renderer.def(Y);break}case"paragraph":{Q+=this.renderer.paragraph(Y);break}case"text":{Q+=this.renderer.text(Y);break}default:{let W='Token with "'+Y.type+'" type was not found.';if(this.options.silent)return console.error(W),"";throw Error(W)}}}return Q}parseInline(y,Q=this.renderer){let B="";for(let $=0;$<y.length;$++){let Y=y[$];if(this.options.extensions?.renderers?.[Y.type]){let L=this.options.extensions.renderers[Y.type].call({parser:this},Y);if(L!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(Y.type)){B+=L||"";continue}}let W=Y;switch(W.type){case"escape":{B+=Q.text(W);break}case"html":{B+=Q.html(W);break}case"link":{B+=Q.link(W);break}case"image":{B+=Q.image(W);break}case"checkbox":{B+=Q.checkbox(W);break}case"strong":{B+=Q.strong(W);break}case"em":{B+=Q.em(W);break}case"codespan":{B+=Q.codespan(W);break}case"br":{B+=Q.br(W);break}case"del":{B+=Q.del(W);break}case"text":{B+=Q.text(W);break}default:{let L='Token with "'+W.type+'" type was not found.';if(this.options.silent)return console.error(L),"";throw Error(L)}}}return B}},_1=class{options;block;constructor(J){this.options=J||L1}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(J){return J}postprocess(J){return J}processAllTokens(J){return J}emStrongMask(J){return J}provideLexer(){return this.block?l.lex:l.lexInline}provideParser(){return this.block?a.parse:a.parseInline}},Ay=class{defaults=d1();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=a;Renderer=C1;TextRenderer=n1;Lexer=l;Tokenizer=m1;Hooks=_1;constructor(...J){this.use(...J)}walkTokens(J,y){let Q=[];for(let B of J)switch(Q=Q.concat(y.call(this,B)),B.type){case"table":{let $=B;for(let Y of $.header)Q=Q.concat(this.walkTokens(Y.tokens,y));for(let Y of $.rows)for(let W of Y)Q=Q.concat(this.walkTokens(W.tokens,y));break}case"list":{let $=B;Q=Q.concat(this.walkTokens($.items,y));break}default:{let $=B;this.defaults.extensions?.childTokens?.[$.type]?this.defaults.extensions.childTokens[$.type].forEach((Y)=>{let W=$[Y].flat(1/0);Q=Q.concat(this.walkTokens(W,y))}):$.tokens&&(Q=Q.concat(this.walkTokens($.tokens,y)))}}return Q}use(...J){let y=this.defaults.extensions||{renderers:{},childTokens:{}};return J.forEach((Q)=>{let B={...Q};if(B.async=this.defaults.async||B.async||!1,Q.extensions&&(Q.extensions.forEach(($)=>{if(!$.name)throw Error("extension name required");if("renderer"in $){let Y=y.renderers[$.name];Y?y.renderers[$.name]=function(...W){let L=$.renderer.apply(this,W);return L===!1&&(L=Y.apply(this,W)),L}:y.renderers[$.name]=$.renderer}if("tokenizer"in $){if(!$.level||$.level!=="block"&&$.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let Y=y[$.level];Y?Y.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)}),B.extensions=y),Q.renderer){let $=this.defaults.renderer||new C1(this.defaults);for(let Y in Q.renderer){if(!(Y in $))throw Error(`renderer '${Y}' does not exist`);if(["options","parser"].includes(Y))continue;let W=Y,L=Q.renderer[W],X=$[W];$[W]=(...K)=>{let N=L.apply($,K);return N===!1&&(N=X.apply($,K)),N||""}}B.renderer=$}if(Q.tokenizer){let $=this.defaults.tokenizer||new m1(this.defaults);for(let Y in Q.tokenizer){if(!(Y in $))throw Error(`tokenizer '${Y}' does not exist`);if(["options","rules","lexer"].includes(Y))continue;let W=Y,L=Q.tokenizer[W],X=$[W];$[W]=(...K)=>{let N=L.apply($,K);return N===!1&&(N=X.apply($,K)),N}}B.tokenizer=$}if(Q.hooks){let $=this.defaults.hooks||new _1;for(let Y in Q.hooks){if(!(Y in $))throw Error(`hook '${Y}' does not exist`);if(["options","block"].includes(Y))continue;let W=Y,L=Q.hooks[W],X=$[W];_1.passThroughHooks.has(Y)?$[W]=(K)=>{if(this.defaults.async&&_1.passThroughHooksRespectAsync.has(Y))return(async()=>{let G=await L.call($,K);return X.call($,G)})();let N=L.call($,K);return X.call($,N)}:$[W]=(...K)=>{if(this.defaults.async)return(async()=>{let G=await L.apply($,K);return G===!1&&(G=await X.apply($,K)),G})();let N=L.apply($,K);return N===!1&&(N=X.apply($,K)),N}}B.hooks=$}if(Q.walkTokens){let $=this.defaults.walkTokens,Y=Q.walkTokens;B.walkTokens=function(W){let L=[];return L.push(Y.call(this,W)),$&&(L=L.concat($.call(this,W))),L}}this.defaults={...this.defaults,...B}}),this}setOptions(J){return this.defaults={...this.defaults,...J},this}lexer(J,y){return l.lex(J,y??this.defaults)}parser(J,y){return a.parse(J,y??this.defaults)}parseMarkdown(J){return(y,Q)=>{let B={...Q},$={...this.defaults,...B},Y=this.onError(!!$.silent,!!$.async);if(this.defaults.async===!0&&B.async===!1)return Y(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 Y(Error("marked(): input parameter is undefined or null"));if(typeof y!="string")return Y(Error("marked(): input parameter is of type "+Object.prototype.toString.call(y)+", string expected"));if($.hooks&&($.hooks.options=$,$.hooks.block=J),$.async)return(async()=>{let W=$.hooks?await $.hooks.preprocess(y):y,L=await($.hooks?await $.hooks.provideLexer():J?l.lex:l.lexInline)(W,$),X=$.hooks?await $.hooks.processAllTokens(L):L;$.walkTokens&&await Promise.all(this.walkTokens(X,$.walkTokens));let K=await($.hooks?await $.hooks.provideParser():J?a.parse:a.parseInline)(X,$);return $.hooks?await $.hooks.postprocess(K):K})().catch(Y);try{$.hooks&&(y=$.hooks.preprocess(y));let W=($.hooks?$.hooks.provideLexer():J?l.lex:l.lexInline)(y,$);$.hooks&&(W=$.hooks.processAllTokens(W)),$.walkTokens&&this.walkTokens(W,$.walkTokens);let L=($.hooks?$.hooks.provideParser():J?a.parse:a.parseInline)(W,$);return $.hooks&&(L=$.hooks.postprocess(L)),L}catch(W){return Y(W)}}}onError(J,y){return(Q)=>{if(Q.message+=`
63
+ Please report this to https://github.com/markedjs/marked.`,J){let B="<p>An error occurred:</p><pre>"+n(Q.message+"",!0)+"</pre>";return y?Promise.resolve(B):B}if(y)return Promise.reject(Q);throw Q}}},X1=new Ay;function A(J,y){return X1.parse(J,y)}A.options=A.setOptions=function(J){return X1.setOptions(J),A.defaults=X1.defaults,k0(A.defaults),A};A.getDefaults=d1;A.defaults=L1;A.use=function(...J){return X1.use(...J),A.defaults=X1.defaults,k0(A.defaults),A};A.walkTokens=function(J,y){return X1.walkTokens(J,y)};A.parseInline=X1.parseInline;A.Parser=a;A.parser=a.parse;A.Renderer=C1;A.TextRenderer=n1;A.Lexer=l;A.lexer=l.lex;A.Tokenizer=m1;A.Hooks=_1;A.parse=A;var{options:l2,setOptions:a2,use:o2,walkTokens:s2,parseInline:n2}=A;var t2=a.parse,e2=l.lex;import{jsxDEV as V0}from"react/jsx-dev-runtime";A.setOptions({gfm:!0,breaks:!1});function ky({children:J,file:y,__content:Q}){let B=Q??(typeof J==="string"?J:String(J??"")),$=vy(()=>{if(!B)return"";return A.parse(B,{async:!1})},[B]);if(!B)return V0("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 V0("div",{className:"mt-3 prose-canvas","data-md":"markdown",...y?{"data-md-file":y}:{},"data-md-source":B,dangerouslySetInnerHTML:{__html:$}},void 0,!1,void 0,this)}import{useFeedback as O4}from"#canvas/runtime";export{O4 as useFeedback,S5 as UserInput,d0 as Task,n0 as Table,D0 as Section,I5 as RangeInput,y5 as Priority,o0 as Note,M5 as MultiChoice,w5 as Mermaid,ky as Markdown,t1 as Item,h5 as ImageView,W5 as FilePreview,v5 as Diff,i0 as CodeBlock,z5 as Choice,t0 as Checklist,a0 as Callout};
@@ -0,0 +1,3 @@
1
+ import { jsx, jsxs, Fragment } from "./preact-compat.js";
2
+ export { jsx, jsxs, Fragment };
3
+ export const jsxDEV = jsx;
@@ -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};
@@ -0,0 +1 @@
1
+ import{createContext as q,useContext as B,useEffect as J}from"react";import{createContext as H}from"react";var I=H("");var K=q(null);function L(){return B(K)}function R(h,z,j){let{setFeedbackEntry:D,removeFeedbackEntry:G}=L();J(()=>{return D(h,{id:h,markdown:z,label:j?.label,required:j?.required}),()=>G(h)},[h,z,j?.label,j?.required])}var M=q("");function S(){return B(M)}var T=q({setActiveView:()=>{}});export{R as useFeedback,S as useCanvasFile,L as useAnnotations,I as SessionContext,M as CanvasFileCtx,K as AnnotationCtx,T as ActiveViewCtx};