// @bun
var{defineProperty:K,getOwnPropertyNames:Z,getOwnPropertyDescriptor:_}=Object,$=Object.prototype.hasOwnProperty;function b(j){return this[j]}var G=(j)=>{var z=(X??=new WeakMap).get(j),A;if(z)return z;if(z=K({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var D of Z(j))if(!$.call(z,D))K(z,D,{get:b.bind(j,D),enumerable:!(A=_(j,D))||A.enumerable})}return X.set(j,z),z},X;var I=(j)=>j;function O(j,z){this[j]=I.bind(null,z)}var P=(j,z)=>{for(var A in z)K(j,A,{get:z[A],enumerable:!0,configurable:!0,set:O.bind(z,A)})};var R=(j,z)=>()=>(j&&(z=j(j=0)),z);var x={};P(x,{groupByToArray:()=>T,groupByMultiple:()=>U,groupBy:()=>J,getUniqueTags:()=>N,getUniqueOwners:()=>V,getUniqueDomains:()=>h,filterBy:()=>M,GroupingStrategies:()=>L});function M(j,z){return j.filter((A)=>{if(z.tags?.length){if(!z.tags.some((E)=>A.meta.tags?.includes(E)))return!1}if(z.owners?.length){if(!z.owners.some((E)=>A.meta.owners?.includes(E)))return!1}if(z.stability?.length){if(!z.stability.includes(A.meta.stability??"stable"))return!1}if(z.domain){if(L.byDomain(A)!==z.domain)return!1}if(z.keyPattern){let D=A.meta.key??A.meta.key??"",E=z.keyPattern.replace(/\*/g,".*").replace(/\?/g,".");if(!new RegExp(`^${E}$`,"i").test(D))return!1}return!0})}function J(j,z){let A=new Map;for(let D of j){let E=z(D),H=A.get(E);if(H)H.push(D);else A.set(E,[D])}return A}function T(j,z){let A=J(j,z);return Array.from(A.entries()).map(([D,E])=>({key:D,items:E}))}function U(j,z){let A=new Map;for(let D of j){let E=z(D);for(let H of E){let W=A.get(H);if(W)W.push(D);else A.set(H,[D])}}return A}function N(j){let z=new Set;for(let A of j)for(let D of A.meta.tags??[])z.add(D);return Array.from(z).sort()}function V(j){let z=new Set;for(let A of j)for(let D of A.meta.owners??[])z.add(D);return Array.from(z).sort()}function h(j){let z=new Set;for(let A of j)z.add(L.byDomain(A));return Array.from(z).sort()}var L;var Y=R(()=>{L={byTag:(j)=>j.meta.tags?.[0]??"untagged",byAllTags:(j)=>j.meta.tags?.length?j.meta.tags:["untagged"],byOwner:(j)=>j.meta.owners?.[0]??"unowned",byDomain:(j)=>{return(j.meta.key??j.meta.key??"").split(".")[0]??"default"},byStability:(j)=>j.meta.stability??"stable",byUrlPath:(j)=>(z)=>{if(!z.path)return"root";return z.path.split("/").filter(Boolean).slice(0,j).join("/")||"root"}}});Y();import{compareVersions as C}from"compare-versions";var q=(j)=>`${j.meta.key}.v${j.meta.version}`;class Q{contractType;items=new Map;constructor(j,z){this.contractType=j;if(z)z.forEach((A)=>this.register(A))}register(j){let z=q(j);if(this.items.has(z))throw Error(`Duplicate contract \`${this.contractType}\` ${z}`);return this.items.set(z,j),this}count(){return this.items.size}list(){return[...this.items.values()]}get(j,z){if(z!=null)return this.items.get(`${j}.v${z}`);let A;for(let[D,E]of this.items.entries()){if(!D.startsWith(`${j}.v`))continue;if(!A||C(E.meta.version,A.meta.version)>0)A=E}return A}has(j,z){return!!this.get(j,z)}filter(j){return M(this.list(),j)}listByTag(j){return this.list().filter((z)=>z.meta.tags?.includes(j))}listByOwner(j){return this.list().filter((z)=>z.meta.owners?.includes(j))}groupBy(j){return J(this.list(),j)}getUniqueTags(){return N(this.list())}}var d=(j)=>{return j},u=[{id:"docs.tech.contracts.presentations-conventions",title:"Presentations Conventions (A11y & i18n)",summary:"- Always provide `meta.description` (\u2265 3 chars) \u2014 used by a11y/docs/agents.",kind:"reference",visibility:"public",route:"/docs/tech/contracts/presentations-conventions",tags:["tech","contracts","presentations-conventions"],body:`## Presentations Conventions (A11y & i18n)

- Always provide \`meta.description\` (\u2265 3 chars) \u2014 used by a11y/docs/agents.
- Prefer source = BlockNote for rich guides; use component key for interactive flows.
- i18n strings belong in host apps; descriptors carry keys/defaults only.
- Target selection: include only what you intend to support to avoid drift.
- PII: declare JSON-like paths under \`policy.pii\`; engine redacts in outputs.
`}],c=[{id:"docs.tech.contracts.presentations",title:"Presentations \u2014 Unified Descriptor & Transform Engine",summary:"How PresentationSpec and TransformEngine keep docs/renderers consistent.",visibility:"public",route:"/docs/tech/contracts/presentations",kind:"reference",tags:["presentations","docs","mcp"],body:`## Presentations V2 \u2014 Unified Descriptor & Transform Engine

### Purpose

Unify presentations into one descriptor (\`PresentationSpec\`) that declares a single source (React component key or BlockNote doc) and a list of output targets (react, markdown, application/json, application/xml). A pluggable \`TransformEngine\` renders any target and applies PII redaction.

### Types

\`\`\`ts
type PresentationTarget =
  | 'react'
  | 'markdown'
  | 'application/json'
  | 'application/xml';

type PresentationSource =
  | {
      type: 'component';
      framework: 'react';
      componentKey: string;
      props?: AnySchemaModel;
    }
  | { type: 'blocknotejs'; docJson: unknown; blockConfig?: unknown };

interface PresentationSpec {
  meta: PresentationMeta; // includes partial OwnerShipMeta + description
  policy?: { flags?: string[]; pii?: string[] };
  source: PresentationSource;
  targets: PresentationTarget[];
}

// Shared ownership schema (source of truth in @contractspec/lib.contracts-spec/src/ownership.ts)
interface OwnerShipMeta {
  title: string;
  description: string;
  domain: string;
  owners: Owner[];
  tags: Tag[];
  stability: Stability;
}

type Stability = 'experimental' | 'beta' | 'stable' | 'deprecated';
type Owner = string; // curated list available in code (e.g., '@sigil-team', 'team-strit')
type Tag = string; // curated list available in code (e.g., 'auth', 'spots')

// For presentations, meta is a Partial<OwnerShipMeta> plus description, name, version
interface PresentationMeta extends Partial<OwnerShipMeta> {
  name: string;
  version: string;
  description?: string;
}
\`\`\`

### Engine

Use \`createDefaultTransformEngine()\` from \`@contractspec/lib.presentation-runtime-core/transform-engine\` and register custom renderers as needed. React hosts add \`registerDefaultReactRenderer()\` from \`@contractspec/lib.contracts-runtime-client-react/transform-engine\`. The core engine supports markdown/json/xml; the React renderer returns a serializable descriptor the host app renders via a \`componentMap\` or a BlockNote renderer. The canonical source type string is \`blocknotejs\` (not \`blocknote\`).

PII paths (JSON-like) are redacted from rendered outputs.

### MCP Integration

\`createMcpServer\` accepts \`presentationsV2\`. Each descriptor is exposed under \`presentation://<name>/v<version>\` and negotiated variants (\`.md/.json/.xml\`) are rendered by the engine.

### Migration

- V1 \`PresentationSpec\` remains supported; a back-compat helper converts V1 \u2192 V2 when convenient.
- Prefer V2 for new work.

### Examples (Sigil)

- \`sigil.auth.webauth_tabs_v2\`: component source (\`componentKey: 'sigil.webauth.tabs'\`), targets \`react/json/xml\`.
- \`sigil.signup.guide_v2\`: BlockNote doc source, targets \`react/markdown/json/xml\`.

### React Rendering

Host apps use a \`componentMap\` (e.g., \`'sigil.webauth.tabs' \u2192 WebAuthTabs\`) and a BlockNote renderer to turn the React render descriptor into elements.`}];class B extends Q{constructor(j){super("presentation",j)}}export{u as tech_contracts_presentations_conventions_DocBlocks,c as techContractsDocs,d as definePresentation,B as PresentationRegistry};
