var{defineProperty:R,getOwnPropertyNames:J,getOwnPropertyDescriptor:K}=Object,Q=Object.prototype.hasOwnProperty;function X(O){return this[O]}var v=(O)=>{var N=(a??=new WeakMap).get(O),L;if(N)return N;if(N=R({},"__esModule",{value:!0}),O&&typeof O==="object"||typeof O==="function"){for(var P of J(O))if(!Q.call(N,P))R(N,P,{get:X.bind(O,P),enumerable:!(L=K(O,P))||L.enumerable})}return a.set(O,N),N},a;var Z=(O)=>O;function $(O,N){this[O]=Z.bind(null,N)}var V=(O,N)=>{for(var L in N)R(O,L,{get:N[L],enumerable:!0,configurable:!0,set:$.bind(N,L)})};var d=(O,N)=>()=>(O&&(N=O(O=0)),N);var q={};V(q,{groupByToArray:()=>B,groupByMultiple:()=>G,groupBy:()=>E,getUniqueTags:()=>j,getUniqueOwners:()=>U,getUniqueDomains:()=>o,filterBy:()=>I,GroupingStrategies:()=>C});function I(O,N){return O.filter((L)=>{if(N.tags?.length){if(!N.tags.some((_)=>L.meta.tags?.includes(_)))return!1}if(N.owners?.length){if(!N.owners.some((_)=>L.meta.owners?.includes(_)))return!1}if(N.stability?.length){if(!N.stability.includes(L.meta.stability??"stable"))return!1}if(N.domain){if(C.byDomain(L)!==N.domain)return!1}if(N.keyPattern){let P=L.meta.key??L.meta.key??"",_=N.keyPattern.replace(/\*/g,".*").replace(/\?/g,".");if(!new RegExp(`^${_}$`,"i").test(P))return!1}return!0})}function E(O,N){let L=new Map;for(let P of O){let _=N(P),A=L.get(_);if(A)A.push(P);else L.set(_,[P])}return L}function B(O,N){let L=E(O,N);return Array.from(L.entries()).map(([P,_])=>({key:P,items:_}))}function G(O,N){let L=new Map;for(let P of O){let _=N(P);for(let A of _){let M=L.get(A);if(M)M.push(P);else L.set(A,[P])}}return L}function j(O){let N=new Set;for(let L of O)for(let P of L.meta.tags??[])N.add(P);return Array.from(N).sort()}function U(O){let N=new Set;for(let L of O)for(let P of L.meta.owners??[])N.add(P);return Array.from(N).sort()}function o(O){let N=new Set;for(let L of O)N.add(C.byDomain(L));return Array.from(N).sort()}var C;var h=d(()=>{C={byTag:(O)=>O.meta.tags?.[0]??"untagged",byAllTags:(O)=>O.meta.tags?.length?O.meta.tags:["untagged"],byOwner:(O)=>O.meta.owners?.[0]??"unowned",byDomain:(O)=>{return(O.meta.key??O.meta.key??"").split(".")[0]??"default"},byStability:(O)=>O.meta.stability??"stable",byUrlPath:(O)=>(N)=>{if(!N.path)return"root";return N.path.split("/").filter(Boolean).slice(0,O).join("/")||"root"}}});var W={Idea:"idea",InCreation:"in_creation",Experimental:"experimental",Beta:"beta",Stable:"stable",Deprecated:"deprecated"},S={PlatformCore:"platform.core",PlatformSigil:"platform.sigil",PlatformMarketplace:"platform.marketplace",PlatformMessaging:"platform.messaging",PlatformContent:"platform.content",PlatformFeatureFlags:"platform.featureflags",PlatformFinance:"platform.finance"},f=S,x={Spots:"spots",Collectivity:"collectivity",Marketplace:"marketplace",Sellers:"sellers",Auth:"auth",Login:"login",Signup:"signup",Guide:"guide",Docs:"docs",I18n:"i18n",Incident:"incident",Automation:"automation",Hygiene:"hygiene"},y=x;h();import{compareVersions as c}from"compare-versions";var w=(O)=>`${O.meta.key}.v${O.meta.version}`;class D{contractType;items=new Map;constructor(O,N){this.contractType=O;if(N)N.forEach((L)=>this.register(L))}register(O){let N=w(O);if(this.items.has(N))throw Error(`Duplicate contract \`${this.contractType}\` ${N}`);return this.items.set(N,O),this}count(){return this.items.size}list(){return[...this.items.values()]}get(O,N){if(N!=null)return this.items.get(`${O}.v${N}`);let L;for(let[P,_]of this.items.entries()){if(!P.startsWith(`${O}.v`))continue;if(!L||c(_.meta.version,L.meta.version)>0)L=_}return L}has(O,N){return!!this.get(O,N)}filter(O){return I(this.list(),O)}listByTag(O){return this.list().filter((N)=>N.meta.tags?.includes(O))}listByOwner(O){return this.list().filter((N)=>N.meta.owners?.includes(O))}groupBy(O){return E(this.list(),O)}getUniqueTags(){return j(this.list())}}function Y(O){return O}var t=(O,N)=>`${O}.v${N}`;class p extends D{constructor(O){super("event",O)}}var b="control-plane",l=[S.PlatformCore],z=[x.Automation,"control-plane","agent-runtime"],H=W.Experimental;import{ScalarTypeEnum as T,SchemaModel as F}from"@contractspec/lib.schema";var u=new F({name:"ControlPlanePlanRejectedPayload",fields:{executionId:{type:T.ID(),isOptional:!1},planId:{type:T.ID(),isOptional:!0},rejectedAt:{type:T.DateTime(),isOptional:!1},reasons:{type:T.String_unsecure(),isOptional:!0,isArray:!0}}}),_O=Y({meta:{key:"controlPlane.plan.rejected",version:"1.0.0",description:"Emitted when a plan fails verification or governance checks.",domain:b,owners:l,tags:[...z,"plan","governance"],stability:H},payload:u});export{u as ControlPlanePlanRejectedPayload,_O as ControlPlanePlanRejectedEvent};
