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

`).trim()}function Z({entry:s,content:p}){let h=w(s.summary),i=T(p,"Type"),u=T(p,"Version")??s.version,t=T(p,"Tags")?.split(",").map((W)=>W.trim()).filter(Boolean),q=T(p,"Owners")?.split(",").map((W)=>W.trim()).filter(Boolean),g=T(p,"Stability")??s.visibility,f={reference:{key:s.title??s.id,version:u,type:i,title:s.title??s.id,description:h,tags:t??s.tags,owners:q??s.owners,stability:g}},o={...L,meta:{...L.meta,title:s.title??L.meta.title,description:h??L.meta.description}};return m(v,{gap:"xl",children:[A(n,{spec:o,item:f}),A(e,{content:p})]})}import{jsx as M}from"react/jsx-runtime";function gs({entry:s,content:p}){return M(Z,{entry:s,content:p})}export{gs as DocsReferencePage};
