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

`).trim()}function ss({entry:s,content:i}){let h=R(s.summary),p=L(i,"Type"),T=L(i,"Version")??s.version,g=L(i,"Tags")?.split(",").map((A)=>A.trim()).filter(Boolean),W=L(i,"Owners")?.split(",").map((A)=>A.trim()).filter(Boolean),t=L(i,"Stability")??s.visibility,f={reference:{key:s.title??s.id,version:T,type:p,title:s.title??s.id,description:h,tags:g??s.tags,owners:W??s.owners,stability:t}},q={...B,meta:{...B.meta,title:s.title??B.meta.title,description:h??B.meta.description}};return S(H,{gap:"xl",children:[O(d,{spec:q,item:f}),O(N,{content:i})]})}export{ss as DocsReferenceContent};
