var w=Object.defineProperty;var T=(e)=>e;function q(e,t){this[e]=T.bind(null,t)}var N=(e,t)=>{for(var r in t)w(e,r,{get:t[r],enumerable:!0,configurable:!0,set:q.bind(t,r)})};var O=(e,t)=>()=>(e&&(t=e(e=0)),t);var D=/^##\s+Metadata[\s\S]*?(?=^##\s|^#\s|Z)/m;function L(e){return e.replace(/^#\s+.*\n+/m,"").replace(D,"")}function c(e){return/^#{1,4}\s+/.test(e)||/^```/.test(e)||/^\s*[-*]\s+/.test(e)||/^\s*\d+\.\s+/.test(e)||/^>\s+/.test(e)}function f(e){let t=L(e).split(/\r?\n/),r=[],s=0;while(s<t.length){let a=t[s]??"";if(a.startsWith("<!-- @generated")){s+=1;continue}let i=a.trim();if(!i){s+=1;continue}if(i.startsWith("```")){let n=i.slice(3).trim(),h=[];s+=1;while(s<t.length&&!(t[s]??"").trim().startsWith("```"))h.push(t[s]??""),s+=1;s+=1,r.push({type:"code",language:n||"text",code:h.join(`
`)});continue}if(/^#{1,4}\s+/.test(i)){let n=i.match(/^#{1,4}/)?.[0].length??2;r.push({type:"heading",level:n,text:i.replace(/^#{1,4}\s+/,"")}),s+=1;continue}if(/^>\s+/.test(i)){let n=[];while(s<t.length&&/^>\s+/.test((t[s]??"").trim()))n.push((t[s]??"").trim().replace(/^>\s+/,"")),s+=1;r.push({type:"quote",text:n.join(" ")});continue}if(/^[-*]\s+/.test(i)||/^\d+\.\s+/.test(i)){let n=/^\d+\.\s+/.test(i),h=[];while(s<t.length&&c((t[s]??"").trim())){let g=(t[s]??"").trim();if(n&&/^\d+\.\s+/.test(g))h.push(g.replace(/^\d+\.\s+/,""));else if(!n&&/^[-*]\s+/.test(g))h.push(g.replace(/^[-*]\s+/,""));else break;s+=1}r.push({type:"list",ordered:n,items:h});continue}let u=[];while(s<t.length&&!c((t[s]??"").trim())){let n=(t[s]??"").trim();if(!n)break;u.push(n),s+=1}r.push({type:"paragraph",text:u.join(" ")})}return r}import{CodeBlock as M}from"@contractspec/lib.design-system";import{HStack as W,VStack as o}from"@contractspec/lib.ui-kit-web/ui/stack";import{BlockQuote as B,H2 as A,H3 as Z,H4 as l,Muted as m,P as y}from"@contractspec/lib.ui-kit-web/ui/typography";import{jsx as p,jsxs as K}from"react/jsx-runtime";var E=new Set(["typescript","tsx","javascript","jsx","bash","shell","json","yaml","graphql","sql","python","go","rust","css","scss","html","markdown","text"]);function F(e){if(!e)return"text";let t=e.toLowerCase();return E.has(t)?t:"text"}function J(e,t){if(e<=2)return p(A,{children:t});if(e===3)return p(Z,{children:t});return p(l,{children:t})}function Q({content:e}){let t=f(e);if(!t.length)return p(m,{children:"No reference content available."});return p(o,{gap:"md",children:t.map((r,s)=>{switch(r.type){case"heading":return p(o,{children:J(r.level,r.text)},s);case"paragraph":return p(y,{children:r.text},s);case"quote":return p(B,{children:r.text},s);case"code":return p(M,{language:F(r.language),code:r.code},s);case"list":return p(o,{gap:"xs",children:r.items.map((a,i)=>K(W,{gap:"sm",align:"start",children:[p(m,{children:r.ordered?`${i+1}.`:"•"}),p(y,{className:"leading-relaxed",children:a})]},i))},s);default:return null}})})}export{Q as DocsMarkdownContent};
