@ggui-ai/console 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -109,7 +109,7 @@ Error generating stack: `+s.message+`
|
|
|
109
109
|
|
|
110
110
|
`)}k.write("payload.value = newResult;"),k.write("return payload;");const $=k.compile();return(_,S)=>$(j,_,S)};let u;const d=Qo,p=!Yf.jitless,h=p&&Gx.value,y=n.catchall;let v;e._zod.parse=(j,k)=>{v??(v=l.value);const x=j.value;return d(x)?p&&h&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(u||(u=c(n.shape)),j=u(j,k),y?u1([],x,j,k,v,e):j):o(j,k):(j.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),j)}});function Rh(e,n,o,l){for(const u of e)if(u.issues.length===0)return n.value=u.value,n;const c=e.filter(u=>!Li(u));return c.length===1?(n.value=c[0].value,c[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:o,errors:e.map(u=>u.issues.map(d=>_n(d,l,xn())))}),n)}const d1=le("$ZodUnion",(e,n)=>{lt.init(e,n),He(e._zod,"optin",()=>n.options.some(l=>l._zod.optin==="optional")?"optional":void 0),He(e._zod,"optout",()=>n.options.some(l=>l._zod.optout==="optional")?"optional":void 0),He(e._zod,"values",()=>{if(n.options.every(l=>l._zod.values))return new Set(n.options.flatMap(l=>Array.from(l._zod.values)))}),He(e._zod,"pattern",()=>{if(n.options.every(l=>l._zod.pattern)){const l=n.options.map(c=>c._zod.pattern);return new RegExp(`^(${l.map(c=>Xf(c.source)).join("|")})$`)}});const o=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(l,c)=>{if(o)return o(l,c);let u=!1;const d=[];for(const p of n.options){const g=p._zod.run({value:l.value,issues:[]},c);if(g instanceof Promise)d.push(g),u=!0;else{if(g.issues.length===0)return g;d.push(g)}}return u?Promise.all(d).then(p=>Rh(p,l,e,c)):Rh(d,l,e,c)}}),D4=le("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,d1.init(e,n);const o=e._zod.parse;He(e._zod,"propValues",()=>{const c={};for(const u of n.options){const d=u._zod.propValues;if(!d||Object.keys(d).length===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(u)}"`);for(const[p,g]of Object.entries(d)){c[p]||(c[p]=new Set);for(const h of g)c[p].add(h)}}return c});const l=Ec(()=>{var d;const c=n.options,u=new Map;for(const p of c){const g=(d=p._zod.propValues)==null?void 0:d[n.discriminator];if(!g||g.size===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(p)}"`);for(const h of g){if(u.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);u.set(h,p)}}return u});e._zod.parse=(c,u)=>{const d=c.value;if(!Qo(d))return c.issues.push({code:"invalid_type",expected:"object",input:d,inst:e}),c;const p=l.value.get(d==null?void 0:d[n.discriminator]);return p?p._zod.run(c,u):n.unionFallback||u.direction==="backward"?o(c,u):(c.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,options:Array.from(l.value.keys()),input:d,path:[n.discriminator],inst:e}),c)}}),I4=le("$ZodIntersection",(e,n)=>{lt.init(e,n),e._zod.parse=(o,l)=>{const c=o.value,u=n.left._zod.run({value:c,issues:[]},l),d=n.right._zod.run({value:c,issues:[]},l);return u instanceof Promise||d instanceof Promise?Promise.all([u,d]).then(([g,h])=>Ah(o,g,h)):Ah(o,u,d)}});function Df(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(Pi(e)&&Pi(n)){const o=Object.keys(n),l=Object.keys(e).filter(u=>o.indexOf(u)!==-1),c={...e,...n};for(const u of l){const d=Df(e[u],n[u]);if(!d.valid)return{valid:!1,mergeErrorPath:[u,...d.mergeErrorPath]};c[u]=d.data}return{valid:!0,data:c}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const o=[];for(let l=0;l<e.length;l++){const c=e[l],u=n[l],d=Df(c,u);if(!d.valid)return{valid:!1,mergeErrorPath:[l,...d.mergeErrorPath]};o.push(d.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function Ah(e,n,o){const l=new Map;let c;for(const p of n.issues)if(p.code==="unrecognized_keys"){c??(c=p);for(const g of p.keys)l.has(g)||l.set(g,{}),l.get(g).l=!0}else e.issues.push(p);for(const p of o.issues)if(p.code==="unrecognized_keys")for(const g of p.keys)l.has(g)||l.set(g,{}),l.get(g).r=!0;else e.issues.push(p);const u=[...l].filter(([,p])=>p.l&&p.r).map(([p])=>p);if(u.length&&c&&e.issues.push({...c,keys:u}),Li(e))return e;const d=Df(n.value,o.value);if(!d.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(d.mergeErrorPath)}`);return e.value=d.data,e}const U4=le("$ZodRecord",(e,n)=>{lt.init(e,n),e._zod.parse=(o,l)=>{const c=o.value;if(!Pi(c))return o.issues.push({expected:"record",code:"invalid_type",input:c,inst:e}),o;const u=[],d=n.keyType._zod.values;if(d){o.value={};const p=new Set;for(const h of d)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){p.add(typeof h=="number"?h.toString():h);const y=n.keyType._zod.run({value:h,issues:[]},l);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(y.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map(k=>_n(k,l,xn())),input:h,path:[h],inst:e});continue}const v=y.value,j=n.valueType._zod.run({value:c[h],issues:[]},l);j instanceof Promise?u.push(j.then(k=>{k.issues.length&&o.issues.push(...Vi(h,k.issues)),o.value[v]=k.value})):(j.issues.length&&o.issues.push(...Vi(h,j.issues)),o.value[v]=j.value)}let g;for(const h in c)p.has(h)||(g=g??[],g.push(h));g&&g.length>0&&o.issues.push({code:"unrecognized_keys",input:c,inst:e,keys:g})}else{o.value={};for(const p of Reflect.ownKeys(c)){if(p==="__proto__"||!Object.prototype.propertyIsEnumerable.call(c,p))continue;let g=n.keyType._zod.run({value:p,issues:[]},l);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof p=="string"&&n1.test(p)&&g.issues.length){const v=n.keyType._zod.run({value:Number(p),issues:[]},l);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");v.issues.length===0&&(g=v)}if(g.issues.length){n.mode==="loose"?o.value[p]=c[p]:o.issues.push({code:"invalid_key",origin:"record",issues:g.issues.map(v=>_n(v,l,xn())),input:p,path:[p],inst:e});continue}const y=n.valueType._zod.run({value:c[p],issues:[]},l);y instanceof Promise?u.push(y.then(v=>{v.issues.length&&o.issues.push(...Vi(p,v.issues)),o.value[g.value]=v.value})):(y.issues.length&&o.issues.push(...Vi(p,y.issues)),o.value[g.value]=y.value)}}return u.length?Promise.all(u).then(()=>o):o}}),L4=le("$ZodEnum",(e,n)=>{lt.init(e,n);const o=Yv(n.entries),l=new Set(o);e._zod.values=l,e._zod.pattern=new RegExp(`^(${o.filter(c=>Fx.has(typeof c)).map(c=>typeof c=="string"?Zi(c):c.toString()).join("|")})$`),e._zod.parse=(c,u)=>{const d=c.value;return l.has(d)||c.issues.push({code:"invalid_value",values:o,input:d,inst:e}),c}}),V4=le("$ZodLiteral",(e,n)=>{if(lt.init(e,n),n.values.length===0)throw new Error("Cannot create literal schema with no valid values");const o=new Set(n.values);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.values.map(l=>typeof l=="string"?Zi(l):l?Zi(l.toString()):String(l)).join("|")})$`),e._zod.parse=(l,c)=>{const u=l.value;return o.has(u)||l.issues.push({code:"invalid_value",values:n.values,input:u,inst:e}),l}}),B4=le("$ZodTransform",(e,n)=>{lt.init(e,n),e._zod.optin="optional",e._zod.parse=(o,l)=>{if(l.direction==="backward")throw new Fv(e.constructor.name);const c=n.transform(o.value,o);if(l.async)return(c instanceof Promise?c:Promise.resolve(c)).then(d=>(o.value=d,o.fallback=!0,o));if(c instanceof Promise)throw new Bi;return o.value=c,o.fallback=!0,o}});function Dh(e,n){return n===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const f1=le("$ZodOptional",(e,n)=>{lt.init(e,n),e._zod.optin="optional",e._zod.optout="optional",He(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),He(e._zod,"pattern",()=>{const o=n.innerType._zod.pattern;return o?new RegExp(`^(${Xf(o.source)})?$`):void 0}),e._zod.parse=(o,l)=>{if(n.innerType._zod.optin==="optional"){const c=o.value,u=n.innerType._zod.run(o,l);return u instanceof Promise?u.then(d=>Dh(d,c)):Dh(u,c)}return o.value===void 0?o:n.innerType._zod.run(o,l)}}),H4=le("$ZodExactOptional",(e,n)=>{f1.init(e,n),He(e._zod,"values",()=>n.innerType._zod.values),He(e._zod,"pattern",()=>n.innerType._zod.pattern),e._zod.parse=(o,l)=>n.innerType._zod.run(o,l)}),q4=le("$ZodNullable",(e,n)=>{lt.init(e,n),He(e._zod,"optin",()=>n.innerType._zod.optin),He(e._zod,"optout",()=>n.innerType._zod.optout),He(e._zod,"pattern",()=>{const o=n.innerType._zod.pattern;return o?new RegExp(`^(${Xf(o.source)}|null)$`):void 0}),He(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),e._zod.parse=(o,l)=>o.value===null?o:n.innerType._zod.run(o,l)}),P4=le("$ZodDefault",(e,n)=>{lt.init(e,n),e._zod.optin="optional",He(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(o,l)=>{if(l.direction==="backward")return n.innerType._zod.run(o,l);if(o.value===void 0)return o.value=n.defaultValue,o;const c=n.innerType._zod.run(o,l);return c instanceof Promise?c.then(u=>Ih(u,n)):Ih(c,n)}});function Ih(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const Z4=le("$ZodPrefault",(e,n)=>{lt.init(e,n),e._zod.optin="optional",He(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(o,l)=>(l.direction==="backward"||o.value===void 0&&(o.value=n.defaultValue),n.innerType._zod.run(o,l))}),G4=le("$ZodNonOptional",(e,n)=>{lt.init(e,n),He(e._zod,"values",()=>{const o=n.innerType._zod.values;return o?new Set([...o].filter(l=>l!==void 0)):void 0}),e._zod.parse=(o,l)=>{const c=n.innerType._zod.run(o,l);return c instanceof Promise?c.then(u=>Uh(u,e)):Uh(c,e)}});function Uh(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const F4=le("$ZodCatch",(e,n)=>{lt.init(e,n),e._zod.optin="optional",He(e._zod,"optout",()=>n.innerType._zod.optout),He(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(o,l)=>{if(l.direction==="backward")return n.innerType._zod.run(o,l);const c=n.innerType._zod.run(o,l);return c instanceof Promise?c.then(u=>(o.value=u.value,u.issues.length&&(o.value=n.catchValue({...o,error:{issues:u.issues.map(d=>_n(d,l,xn()))},input:o.value}),o.issues=[],o.fallback=!0),o)):(o.value=c.value,c.issues.length&&(o.value=n.catchValue({...o,error:{issues:c.issues.map(u=>_n(u,l,xn()))},input:o.value}),o.issues=[],o.fallback=!0),o)}}),Y4=le("$ZodPipe",(e,n)=>{lt.init(e,n),He(e._zod,"values",()=>n.in._zod.values),He(e._zod,"optin",()=>n.in._zod.optin),He(e._zod,"optout",()=>n.out._zod.optout),He(e._zod,"propValues",()=>n.in._zod.propValues),e._zod.parse=(o,l)=>{if(l.direction==="backward"){const u=n.out._zod.run(o,l);return u instanceof Promise?u.then(d=>zs(d,n.in,l)):zs(u,n.in,l)}const c=n.in._zod.run(o,l);return c instanceof Promise?c.then(u=>zs(u,n.out,l)):zs(c,n.out,l)}});function zs(e,n,o){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},o)}const K4=le("$ZodReadonly",(e,n)=>{lt.init(e,n),He(e._zod,"propValues",()=>n.innerType._zod.propValues),He(e._zod,"values",()=>n.innerType._zod.values),He(e._zod,"optin",()=>{var o,l;return(l=(o=n.innerType)==null?void 0:o._zod)==null?void 0:l.optin}),He(e._zod,"optout",()=>{var o,l;return(l=(o=n.innerType)==null?void 0:o._zod)==null?void 0:l.optout}),e._zod.parse=(o,l)=>{if(l.direction==="backward")return n.innerType._zod.run(o,l);const c=n.innerType._zod.run(o,l);return c instanceof Promise?c.then(Lh):Lh(c)}});function Lh(e){return e.value=Object.freeze(e.value),e}const X4=le("$ZodLazy",(e,n)=>{lt.init(e,n),He(e._zod,"innerType",()=>{const o=n;return o._cachedInner||(o._cachedInner=n.getter()),o._cachedInner}),He(e._zod,"pattern",()=>{var o,l;return(l=(o=e._zod.innerType)==null?void 0:o._zod)==null?void 0:l.pattern}),He(e._zod,"propValues",()=>{var o,l;return(l=(o=e._zod.innerType)==null?void 0:o._zod)==null?void 0:l.propValues}),He(e._zod,"optin",()=>{var o,l;return((l=(o=e._zod.innerType)==null?void 0:o._zod)==null?void 0:l.optin)??void 0}),He(e._zod,"optout",()=>{var o,l;return((l=(o=e._zod.innerType)==null?void 0:o._zod)==null?void 0:l.optout)??void 0}),e._zod.parse=(o,l)=>e._zod.innerType._zod.run(o,l)}),J4=le("$ZodCustom",(e,n)=>{ca.init(e,n),lt.init(e,n),e._zod.parse=(o,l)=>o,e._zod.check=o=>{const l=o.value,c=n.fn(l);if(c instanceof Promise)return c.then(u=>Vh(u,o,l,e));Vh(c,o,l,e)}});function Vh(e,n,o,l){if(!e){const c={code:"custom",input:o,inst:l,path:[...l._zod.def.path??[]],continue:!l._zod.def.abort};l._zod.def.params&&(c.params=l._zod.def.params),n.issues.push(Wo(c))}}var Bh;class Q4{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...o){const l=o[0];return this._map.set(n,l),l&&typeof l=="object"&&"id"in l&&this._idmap.set(l.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const o=this._map.get(n);return o&&typeof o=="object"&&"id"in o&&this._idmap.delete(o.id),this._map.delete(n),this}get(n){const o=n._zod.parent;if(o){const l={...this.get(o)??{}};delete l.id;const c={...l,...this._map.get(n)};return Object.keys(c).length?c:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function W4(){return new Q4}(Bh=globalThis).__zod_globalRegistry??(Bh.__zod_globalRegistry=W4());const Jo=globalThis.__zod_globalRegistry;function e_(e,n){return new e({type:"string",...xe(n)})}function t_(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...xe(n)})}function Hh(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...xe(n)})}function a_(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...xe(n)})}function n_(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...xe(n)})}function r_(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...xe(n)})}function i_(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...xe(n)})}function p1(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...xe(n)})}function o_(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...xe(n)})}function l_(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...xe(n)})}function s_(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...xe(n)})}function c_(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...xe(n)})}function u_(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...xe(n)})}function d_(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...xe(n)})}function f_(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...xe(n)})}function p_(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...xe(n)})}function g_(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...xe(n)})}function m_(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...xe(n)})}function h_(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...xe(n)})}function y_(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...xe(n)})}function v_(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...xe(n)})}function $_(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...xe(n)})}function b_(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...xe(n)})}function x_(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...xe(n)})}function __(e,n){return new e({type:"string",format:"date",check:"string_format",...xe(n)})}function j_(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...xe(n)})}function S_(e,n){return new e({type:"string",format:"duration",check:"string_format",...xe(n)})}function w_(e,n){return new e({type:"number",checks:[],...xe(n)})}function k_(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...xe(n)})}function N_(e,n){return new e({type:"boolean",...xe(n)})}function z_(e,n){return new e({type:"null",...xe(n)})}function E_(e){return new e({type:"unknown"})}function C_(e,n){return new e({type:"never",...xe(n)})}function qh(e,n){return new i1({check:"less_than",...xe(n),value:e,inclusive:!1})}function gf(e,n){return new i1({check:"less_than",...xe(n),value:e,inclusive:!0})}function Ph(e,n){return new o1({check:"greater_than",...xe(n),value:e,inclusive:!1})}function mf(e,n){return new o1({check:"greater_than",...xe(n),value:e,inclusive:!0})}function Zh(e,n){return new q5({check:"multiple_of",...xe(n),value:e})}function g1(e,n){return new Z5({check:"max_length",...xe(n),maximum:e})}function jc(e,n){return new G5({check:"min_length",...xe(n),minimum:e})}function m1(e,n){return new F5({check:"length_equals",...xe(n),length:e})}function T_(e,n){return new Y5({check:"string_format",format:"regex",...xe(n),pattern:e})}function M_(e){return new K5({check:"string_format",format:"lowercase",...xe(e)})}function O_(e){return new X5({check:"string_format",format:"uppercase",...xe(e)})}function R_(e,n){return new J5({check:"string_format",format:"includes",...xe(n),includes:e})}function A_(e,n){return new Q5({check:"string_format",format:"starts_with",...xe(n),prefix:e})}function D_(e,n){return new W5({check:"string_format",format:"ends_with",...xe(n),suffix:e})}function Fi(e){return new e4({check:"overwrite",tx:e})}function I_(e){return Fi(n=>n.normalize(e))}function U_(){return Fi(e=>e.trim())}function L_(){return Fi(e=>e.toLowerCase())}function V_(){return Fi(e=>e.toUpperCase())}function B_(){return Fi(e=>Zx(e))}function H_(e,n,o){return new e({type:"array",element:n,...xe(o)})}function q_(e,n,o){return new e({type:"custom",check:"custom",fn:n,...xe(o)})}function P_(e,n){const o=Z_(l=>(l.addIssue=c=>{if(typeof c=="string")l.issues.push(Wo(c,l.value,o._zod.def));else{const u=c;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=l.value),u.inst??(u.inst=o),u.continue??(u.continue=!o._zod.def.abort),l.issues.push(Wo(u))}},e(l.value,l)),n);return o}function Z_(e,n){const o=new ca({check:"custom",...xe(n)});return o._zod.check=e,o}function h1(e){let n=(e==null?void 0:e.target)??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Jo,target:n,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function bt(e,n,o={path:[],schemaPath:[]}){var y,v;var l;const c=e._zod.def,u=n.seen.get(e);if(u)return u.count++,o.schemaPath.includes(e)&&(u.cycle=o.path),u.schema;const d={schema:{},count:1,cycle:void 0,path:o.path};n.seen.set(e,d);const p=(v=(y=e._zod).toJSONSchema)==null?void 0:v.call(y);if(p)d.schema=p;else{const j={...o,schemaPath:[...o.schemaPath,e],path:o.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,d.schema,j);else{const x=d.schema,E=n.processors[c.type];if(!E)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${c.type}`);E(e,n,x,j)}const k=e._zod.parent;k&&(d.ref||(d.ref=k),bt(k,n,j),n.seen.get(k).isParent=!0)}const g=n.metadataRegistry.get(e);return g&&Object.assign(d.schema,g),n.io==="input"&&Xt(e)&&(delete d.schema.examples,delete d.schema.default),n.io==="input"&&"_prefault"in d.schema&&((l=d.schema).default??(l.default=d.schema._prefault)),delete d.schema._prefault,n.seen.get(e).schema}function y1(e,n){var d,p,g,h;const o=e.seen.get(n);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=new Map;for(const y of e.seen.entries()){const v=(d=e.metadataRegistry.get(y[0]))==null?void 0:d.id;if(v){const j=l.get(v);if(j&&j!==y[0])throw new Error(`Duplicate schema id "${v}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(v,y[0])}}const c=y=>{var E;const v=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const z=(E=e.external.registry.get(y[0]))==null?void 0:E.id,w=e.external.uri??(N=>N);if(z)return{ref:w(z)};const $=y[1].defId??y[1].schema.id??`schema${e.counter++}`;return y[1].defId=$,{defId:$,ref:`${w("__shared")}#/${v}/${$}`}}if(y[1]===o)return{ref:"#"};const k=`#/${v}/`,x=y[1].schema.id??`__schema${e.counter++}`;return{defId:x,ref:k+x}},u=y=>{if(y[1].schema.$ref)return;const v=y[1],{ref:j,defId:k}=c(y);v.def={...v.schema},k&&(v.defId=k);const x=v.schema;for(const E in x)delete x[E];x.$ref=j};if(e.cycles==="throw")for(const y of e.seen.entries()){const v=y[1];if(v.cycle)throw new Error(`Cycle detected: #/${(p=v.cycle)==null?void 0:p.join("/")}/<root>
|
|
111
111
|
|
|
112
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const v=y[1];if(n===y[0]){u(y);continue}if(e.external){const k=(g=e.external.registry.get(y[0]))==null?void 0:g.id;if(n!==y[0]&&k){u(y);continue}}if((h=e.metadataRegistry.get(y[0]))==null?void 0:h.id){u(y);continue}if(v.cycle){u(y);continue}if(v.count>1&&e.reused==="ref"){u(y);continue}}}function v1(e,n){var p,g,h,y;const o=e.seen.get(n);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=v=>{const j=e.seen.get(v);if(j.ref===null)return;const k=j.def??j.schema,x={...k},E=j.ref;if(j.ref=null,E){l(E);const w=e.seen.get(E),$=w.schema;if($.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push($)):Object.assign(k,$),Object.assign(k,x),v._zod.parent===E)for(const R in k)R==="$ref"||R==="allOf"||R in x||delete k[R];if($.$ref&&w.def)for(const R in k)R==="$ref"||R==="allOf"||R in w.def&&JSON.stringify(k[R])===JSON.stringify(w.def[R])&&delete k[R]}const z=v._zod.parent;if(z&&z!==E){l(z);const w=e.seen.get(z);if(w!=null&&w.schema.$ref&&(k.$ref=w.schema.$ref,w.def))for(const $ in k)$==="$ref"||$==="allOf"||$ in w.def&&JSON.stringify(k[$])===JSON.stringify(w.def[$])&&delete k[$]}e.override({zodSchema:v,jsonSchema:k,path:j.path??[]})};for(const v of[...e.seen.entries()].reverse())l(v[0]);const c={};if(e.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?c.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?c.$schema="http://json-schema.org/draft-04/schema#":e.target,(p=e.external)!=null&&p.uri){const v=(g=e.external.registry.get(n))==null?void 0:g.id;if(!v)throw new Error("Schema is missing an `id` property");c.$id=e.external.uri(v)}Object.assign(c,o.def??o.schema);const u=(h=e.metadataRegistry.get(n))==null?void 0:h.id;u!==void 0&&c.id===u&&delete c.id;const d=((y=e.external)==null?void 0:y.defs)??{};for(const v of e.seen.entries()){const j=v[1];j.def&&j.defId&&(j.def.id===j.defId&&delete j.def.id,d[j.defId]=j.def)}e.external||Object.keys(d).length>0&&(e.target==="draft-2020-12"?c.$defs=d:c.definitions=d);try{const v=JSON.parse(JSON.stringify(c));return Object.defineProperty(v,"~standard",{value:{...n["~standard"],jsonSchema:{input:Sc(n,"input",e.processors),output:Sc(n,"output",e.processors)}},enumerable:!1,writable:!1}),v}catch{throw new Error("Error converting schema to JSON.")}}function Xt(e,n){const o=n??{seen:new Set};if(o.seen.has(e))return!1;o.seen.add(e);const l=e._zod.def;if(l.type==="transform")return!0;if(l.type==="array")return Xt(l.element,o);if(l.type==="set")return Xt(l.valueType,o);if(l.type==="lazy")return Xt(l.getter(),o);if(l.type==="promise"||l.type==="optional"||l.type==="nonoptional"||l.type==="nullable"||l.type==="readonly"||l.type==="default"||l.type==="prefault")return Xt(l.innerType,o);if(l.type==="intersection")return Xt(l.left,o)||Xt(l.right,o);if(l.type==="record"||l.type==="map")return Xt(l.keyType,o)||Xt(l.valueType,o);if(l.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Xt(l.in,o)||Xt(l.out,o);if(l.type==="object"){for(const c in l.shape)if(Xt(l.shape[c],o))return!0;return!1}if(l.type==="union"){for(const c of l.options)if(Xt(c,o))return!0;return!1}if(l.type==="tuple"){for(const c of l.items)if(Xt(c,o))return!0;return!!(l.rest&&Xt(l.rest,o))}return!1}const G_=(e,n={})=>o=>{const l=h1({...o,processors:n});return bt(e,l),y1(l,e),v1(l,e)},Sc=(e,n,o={})=>l=>{const{libraryOptions:c,target:u}=l??{},d=h1({...c??{},target:u,io:n,processors:o});return bt(e,d),y1(d,e),v1(d,e)},F_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Y_=(e,n,o,l)=>{const c=o;c.type="string";const{minimum:u,maximum:d,format:p,patterns:g,contentEncoding:h}=e._zod.bag;if(typeof u=="number"&&(c.minLength=u),typeof d=="number"&&(c.maxLength=d),p&&(c.format=F_[p]??p,c.format===""&&delete c.format,p==="time"&&delete c.format),h&&(c.contentEncoding=h),g&&g.size>0){const y=[...g];y.length===1?c.pattern=y[0].source:y.length>1&&(c.allOf=[...y.map(v=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},K_=(e,n,o,l)=>{const c=o,{minimum:u,maximum:d,format:p,multipleOf:g,exclusiveMaximum:h,exclusiveMinimum:y}=e._zod.bag;typeof p=="string"&&p.includes("int")?c.type="integer":c.type="number";const v=typeof y=="number"&&y>=(u??Number.NEGATIVE_INFINITY),j=typeof h=="number"&&h<=(d??Number.POSITIVE_INFINITY),k=n.target==="draft-04"||n.target==="openapi-3.0";v?k?(c.minimum=y,c.exclusiveMinimum=!0):c.exclusiveMinimum=y:typeof u=="number"&&(c.minimum=u),j?k?(c.maximum=h,c.exclusiveMaximum=!0):c.exclusiveMaximum=h:typeof d=="number"&&(c.maximum=d),typeof g=="number"&&(c.multipleOf=g)},X_=(e,n,o,l)=>{o.type="boolean"},J_=(e,n,o,l)=>{n.target==="openapi-3.0"?(o.type="string",o.nullable=!0,o.enum=[null]):o.type="null"},Q_=(e,n,o,l)=>{o.not={}},W_=(e,n,o,l)=>{},ej=(e,n,o,l)=>{const c=e._zod.def,u=Yv(c.entries);u.every(d=>typeof d=="number")&&(o.type="number"),u.every(d=>typeof d=="string")&&(o.type="string"),o.enum=u},tj=(e,n,o,l)=>{const c=e._zod.def,u=[];for(const d of c.values)if(d===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof d=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");u.push(Number(d))}else u.push(d);if(u.length!==0)if(u.length===1){const d=u[0];o.type=d===null?"null":typeof d,n.target==="draft-04"||n.target==="openapi-3.0"?o.enum=[d]:o.const=d}else u.every(d=>typeof d=="number")&&(o.type="number"),u.every(d=>typeof d=="string")&&(o.type="string"),u.every(d=>typeof d=="boolean")&&(o.type="boolean"),u.every(d=>d===null)&&(o.type="null"),o.enum=u},aj=(e,n,o,l)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},nj=(e,n,o,l)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},rj=(e,n,o,l)=>{const c=o,u=e._zod.def,{minimum:d,maximum:p}=e._zod.bag;typeof d=="number"&&(c.minItems=d),typeof p=="number"&&(c.maxItems=p),c.type="array",c.items=bt(u.element,n,{...l,path:[...l.path,"items"]})},ij=(e,n,o,l)=>{var h;const c=o,u=e._zod.def;c.type="object",c.properties={};const d=u.shape;for(const y in d)c.properties[y]=bt(d[y],n,{...l,path:[...l.path,"properties",y]});const p=new Set(Object.keys(d)),g=new Set([...p].filter(y=>{const v=u.shape[y]._zod;return n.io==="input"?v.optin===void 0:v.optout===void 0}));g.size>0&&(c.required=Array.from(g)),((h=u.catchall)==null?void 0:h._zod.def.type)==="never"?c.additionalProperties=!1:u.catchall?u.catchall&&(c.additionalProperties=bt(u.catchall,n,{...l,path:[...l.path,"additionalProperties"]})):n.io==="output"&&(c.additionalProperties=!1)},oj=(e,n,o,l)=>{const c=e._zod.def,u=c.inclusive===!1,d=c.options.map((p,g)=>bt(p,n,{...l,path:[...l.path,u?"oneOf":"anyOf",g]}));u?o.oneOf=d:o.anyOf=d},lj=(e,n,o,l)=>{const c=e._zod.def,u=bt(c.left,n,{...l,path:[...l.path,"allOf",0]}),d=bt(c.right,n,{...l,path:[...l.path,"allOf",1]}),p=h=>"allOf"in h&&Object.keys(h).length===1,g=[...p(u)?u.allOf:[u],...p(d)?d.allOf:[d]];o.allOf=g},sj=(e,n,o,l)=>{const c=o,u=e._zod.def;c.type="object";const d=u.keyType,p=d._zod.bag,g=p==null?void 0:p.patterns;if(u.mode==="loose"&&g&&g.size>0){const y=bt(u.valueType,n,{...l,path:[...l.path,"patternProperties","*"]});c.patternProperties={};for(const v of g)c.patternProperties[v.source]=y}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(c.propertyNames=bt(u.keyType,n,{...l,path:[...l.path,"propertyNames"]})),c.additionalProperties=bt(u.valueType,n,{...l,path:[...l.path,"additionalProperties"]});const h=d._zod.values;if(h){const y=[...h].filter(v=>typeof v=="string"||typeof v=="number");y.length>0&&(c.required=y)}},cj=(e,n,o,l)=>{const c=e._zod.def,u=bt(c.innerType,n,l),d=n.seen.get(e);n.target==="openapi-3.0"?(d.ref=c.innerType,o.nullable=!0):o.anyOf=[u,{type:"null"}]},uj=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType},dj=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType,o.default=JSON.parse(JSON.stringify(c.defaultValue))},fj=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType,n.io==="input"&&(o._prefault=JSON.parse(JSON.stringify(c.defaultValue)))},pj=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType;let d;try{d=c.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}o.default=d},gj=(e,n,o,l)=>{const c=e._zod.def,u=c.in._zod.traits.has("$ZodTransform"),d=n.io==="input"?u?c.out:c.in:c.out;bt(d,n,l);const p=n.seen.get(e);p.ref=d},mj=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType,o.readOnly=!0},$1=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType},hj=(e,n,o,l)=>{const c=e._zod.innerType;bt(c,n,l);const u=n.seen.get(e);u.ref=c},yj=le("ZodISODateTime",(e,n)=>{g4.init(e,n),ft.init(e,n)});function vj(e){return x_(yj,e)}const $j=le("ZodISODate",(e,n)=>{m4.init(e,n),ft.init(e,n)});function bj(e){return __($j,e)}const xj=le("ZodISOTime",(e,n)=>{h4.init(e,n),ft.init(e,n)});function _j(e){return j_(xj,e)}const jj=le("ZodISODuration",(e,n)=>{y4.init(e,n),ft.init(e,n)});function Sj(e){return S_(jj,e)}const wj=(e,n)=>{Qv.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>i5(e,o)},flatten:{value:o=>r5(e,o)},addIssue:{value:o=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Af,2)}},addIssues:{value:o=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Af,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ra=le("ZodError",wj,{Parent:Error}),kj=Qf(Ra),Nj=Wf(Ra),zj=Cc(Ra),Ej=Tc(Ra),Cj=s5(Ra),Tj=c5(Ra),Mj=u5(Ra),Oj=d5(Ra),Rj=f5(Ra),Aj=p5(Ra),Dj=g5(Ra),Ij=m5(Ra),Gh=new WeakMap;function nl(e,n,o){const l=Object.getPrototypeOf(e);let c=Gh.get(l);if(c||(c=new Set,Gh.set(l,c)),!c.has(n)){c.add(n);for(const u in o){const d=o[u];Object.defineProperty(l,u,{configurable:!0,enumerable:!1,get(){const p=d.bind(this);return Object.defineProperty(this,u,{configurable:!0,writable:!0,enumerable:!0,value:p}),p},set(p){Object.defineProperty(this,u,{configurable:!0,writable:!0,enumerable:!0,value:p})}})}}}const st=le("ZodType",(e,n)=>(lt.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:Sc(e,"input"),output:Sc(e,"output")}}),e.toJSONSchema=G_(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.parse=(o,l)=>kj(e,o,l,{callee:e.parse}),e.safeParse=(o,l)=>zj(e,o,l),e.parseAsync=async(o,l)=>Nj(e,o,l,{callee:e.parseAsync}),e.safeParseAsync=async(o,l)=>Ej(e,o,l),e.spa=e.safeParseAsync,e.encode=(o,l)=>Cj(e,o,l),e.decode=(o,l)=>Tj(e,o,l),e.encodeAsync=async(o,l)=>Mj(e,o,l),e.decodeAsync=async(o,l)=>Oj(e,o,l),e.safeEncode=(o,l)=>Rj(e,o,l),e.safeDecode=(o,l)=>Aj(e,o,l),e.safeEncodeAsync=async(o,l)=>Dj(e,o,l),e.safeDecodeAsync=async(o,l)=>Ij(e,o,l),nl(e,"ZodType",{check(...o){const l=this.def;return this.clone(xr(l,{checks:[...l.checks??[],...o.map(c=>typeof c=="function"?{_zod:{check:c,def:{check:"custom"},onattach:[]}}:c)]}),{parent:!0})},with(...o){return this.check(...o)},clone(o,l){return _r(this,o,l)},brand(){return this},register(o,l){return o.add(this,l),this},refine(o,l){return this.check(TS(o,l))},superRefine(o,l){return this.check(MS(o,l))},overwrite(o){return this.check(Fi(o))},optional(){return Xh(this)},exactOptional(){return yS(this)},nullable(){return Jh(this)},nullish(){return Xh(Jh(this))},nonoptional(o){return jS(this,o)},array(){return zt(this)},or(o){return jn([this,o])},and(o){return fS(this,o)},transform(o){return Qh(this,mS(o))},default(o){return bS(this,o)},prefault(o){return _S(this,o)},catch(o){return wS(this,o)},pipe(o){return Qh(this,o)},readonly(){return zS(this)},describe(o){const l=this.clone();return Jo.add(l,{description:o}),l},meta(...o){if(o.length===0)return Jo.get(this);const l=this.clone();return Jo.add(l,o[0]),l},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(o){return o(this)}}),Object.defineProperty(e,"description",{get(){var o;return(o=Jo.get(e))==null?void 0:o.description},configurable:!0}),e)),b1=le("_ZodString",(e,n)=>{ep.init(e,n),st.init(e,n),e._zod.processJSONSchema=(l,c,u)=>Y_(e,l,c);const o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,nl(e,"_ZodString",{regex(...l){return this.check(T_(...l))},includes(...l){return this.check(R_(...l))},startsWith(...l){return this.check(A_(...l))},endsWith(...l){return this.check(D_(...l))},min(...l){return this.check(jc(...l))},max(...l){return this.check(g1(...l))},length(...l){return this.check(m1(...l))},nonempty(...l){return this.check(jc(1,...l))},lowercase(l){return this.check(M_(l))},uppercase(l){return this.check(O_(l))},trim(){return this.check(U_())},normalize(...l){return this.check(I_(...l))},toLowerCase(){return this.check(L_())},toUpperCase(){return this.check(V_())},slugify(){return this.check(B_())}})}),Uj=le("ZodString",(e,n)=>{ep.init(e,n),b1.init(e,n),e.email=o=>e.check(t_(Lj,o)),e.url=o=>e.check(p1(x1,o)),e.jwt=o=>e.check(b_(eS,o)),e.emoji=o=>e.check(o_(Vj,o)),e.guid=o=>e.check(Hh(Fh,o)),e.uuid=o=>e.check(a_(Es,o)),e.uuidv4=o=>e.check(n_(Es,o)),e.uuidv6=o=>e.check(r_(Es,o)),e.uuidv7=o=>e.check(i_(Es,o)),e.nanoid=o=>e.check(l_(Bj,o)),e.guid=o=>e.check(Hh(Fh,o)),e.cuid=o=>e.check(s_(Hj,o)),e.cuid2=o=>e.check(c_(qj,o)),e.ulid=o=>e.check(u_(Pj,o)),e.base64=o=>e.check(y_(Jj,o)),e.base64url=o=>e.check(v_(Qj,o)),e.xid=o=>e.check(d_(Zj,o)),e.ksuid=o=>e.check(f_(Gj,o)),e.ipv4=o=>e.check(p_(Fj,o)),e.ipv6=o=>e.check(g_(Yj,o)),e.cidrv4=o=>e.check(m_(Kj,o)),e.cidrv6=o=>e.check(h_(Xj,o)),e.e164=o=>e.check($_(Wj,o)),e.datetime=o=>e.check(vj(o)),e.date=o=>e.check(bj(o)),e.time=o=>e.check(_j(o)),e.duration=o=>e.check(Sj(o))});function Z(e){return e_(Uj,e)}const ft=le("ZodStringFormat",(e,n)=>{dt.init(e,n),b1.init(e,n)}),Lj=le("ZodEmail",(e,n)=>{i4.init(e,n),ft.init(e,n)}),Fh=le("ZodGUID",(e,n)=>{n4.init(e,n),ft.init(e,n)}),Es=le("ZodUUID",(e,n)=>{r4.init(e,n),ft.init(e,n)}),x1=le("ZodURL",(e,n)=>{o4.init(e,n),ft.init(e,n)});function Cs(e){return p1(x1,e)}const Vj=le("ZodEmoji",(e,n)=>{l4.init(e,n),ft.init(e,n)}),Bj=le("ZodNanoID",(e,n)=>{s4.init(e,n),ft.init(e,n)}),Hj=le("ZodCUID",(e,n)=>{c4.init(e,n),ft.init(e,n)}),qj=le("ZodCUID2",(e,n)=>{u4.init(e,n),ft.init(e,n)}),Pj=le("ZodULID",(e,n)=>{d4.init(e,n),ft.init(e,n)}),Zj=le("ZodXID",(e,n)=>{f4.init(e,n),ft.init(e,n)}),Gj=le("ZodKSUID",(e,n)=>{p4.init(e,n),ft.init(e,n)}),Fj=le("ZodIPv4",(e,n)=>{v4.init(e,n),ft.init(e,n)}),Yj=le("ZodIPv6",(e,n)=>{$4.init(e,n),ft.init(e,n)}),Kj=le("ZodCIDRv4",(e,n)=>{b4.init(e,n),ft.init(e,n)}),Xj=le("ZodCIDRv6",(e,n)=>{x4.init(e,n),ft.init(e,n)}),Jj=le("ZodBase64",(e,n)=>{_4.init(e,n),ft.init(e,n)}),Qj=le("ZodBase64URL",(e,n)=>{S4.init(e,n),ft.init(e,n)}),Wj=le("ZodE164",(e,n)=>{w4.init(e,n),ft.init(e,n)}),eS=le("ZodJWT",(e,n)=>{N4.init(e,n),ft.init(e,n)}),_1=le("ZodNumber",(e,n)=>{s1.init(e,n),st.init(e,n),e._zod.processJSONSchema=(l,c,u)=>K_(e,l,c),nl(e,"ZodNumber",{gt(l,c){return this.check(Ph(l,c))},gte(l,c){return this.check(mf(l,c))},min(l,c){return this.check(mf(l,c))},lt(l,c){return this.check(qh(l,c))},lte(l,c){return this.check(gf(l,c))},max(l,c){return this.check(gf(l,c))},int(l){return this.check(Yh(l))},safe(l){return this.check(Yh(l))},positive(l){return this.check(Ph(0,l))},nonnegative(l){return this.check(mf(0,l))},negative(l){return this.check(qh(0,l))},nonpositive(l){return this.check(gf(0,l))},multipleOf(l,c){return this.check(Zh(l,c))},step(l,c){return this.check(Zh(l,c))},finite(){return this}});const o=e._zod.bag;e.minValue=Math.max(o.minimum??Number.NEGATIVE_INFINITY,o.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(o.maximum??Number.POSITIVE_INFINITY,o.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??.5),e.isFinite=!0,e.format=o.format??null});function it(e){return w_(_1,e)}const tS=le("ZodNumberFormat",(e,n)=>{z4.init(e,n),_1.init(e,n)});function Yh(e){return k_(tS,e)}const aS=le("ZodBoolean",(e,n)=>{E4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>X_(e,o,l)});function Ft(e){return N_(aS,e)}const nS=le("ZodNull",(e,n)=>{C4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>J_(e,o,l)});function rS(e){return z_(nS,e)}const iS=le("ZodUnknown",(e,n)=>{T4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>W_()});function $r(){return E_(iS)}const oS=le("ZodNever",(e,n)=>{M4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>Q_(e,o,l)});function lS(e){return C_(oS,e)}const sS=le("ZodArray",(e,n)=>{O4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>rj(e,o,l,c),e.element=n.element,nl(e,"ZodArray",{min(o,l){return this.check(jc(o,l))},nonempty(o){return this.check(jc(1,o))},max(o,l){return this.check(g1(o,l))},length(o,l){return this.check(m1(o,l))},unwrap(){return this.element}})});function zt(e,n){return H_(sS,e,n)}const cS=le("ZodObject",(e,n)=>{A4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>ij(e,o,l,c),He(e,"shape",()=>n.shape),nl(e,"ZodObject",{keyof(){return ut(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:$r()})},loose(){return this.clone({...this._zod.def,catchall:$r()})},strict(){return this.clone({...this._zod.def,catchall:lS()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return Qx(this,o)},safeExtend(o){return Wx(this,o)},merge(o){return e5(this,o)},pick(o){return Xx(this,o)},omit(o){return Jx(this,o)},partial(...o){return t5(S1,this,o[0])},required(...o){return a5(w1,this,o[0])}})});function fe(e,n){const o={type:"object",shape:e??{},...xe(n)};return new cS(o)}const j1=le("ZodUnion",(e,n)=>{d1.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>oj(e,o,l,c),e.options=n.options});function jn(e,n){return new j1({type:"union",options:e,...xe(n)})}const uS=le("ZodDiscriminatedUnion",(e,n)=>{j1.init(e,n),D4.init(e,n)});function rl(e,n,o){return new uS({type:"union",options:n,discriminator:e,...xe(o)})}const dS=le("ZodIntersection",(e,n)=>{I4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>lj(e,o,l,c)});function fS(e,n){return new dS({type:"intersection",left:e,right:n})}const Kh=le("ZodRecord",(e,n)=>{U4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>sj(e,o,l,c),e.keyType=n.keyType,e.valueType=n.valueType});function xt(e,n,o){return!n||!n._zod?new Kh({type:"record",keyType:Z(),valueType:e,...xe(n)}):new Kh({type:"record",keyType:e,valueType:n,...xe(o)})}const If=le("ZodEnum",(e,n)=>{L4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(l,c,u)=>ej(e,l,c),e.enum=n.entries,e.options=Object.values(n.entries);const o=new Set(Object.keys(n.entries));e.extract=(l,c)=>{const u={};for(const d of l)if(o.has(d))u[d]=n.entries[d];else throw new Error(`Key ${d} not found in enum`);return new If({...n,checks:[],...xe(c),entries:u})},e.exclude=(l,c)=>{const u={...n.entries};for(const d of l)if(o.has(d))delete u[d];else throw new Error(`Key ${d} not found in enum`);return new If({...n,checks:[],...xe(c),entries:u})}});function ut(e,n){const o=Array.isArray(e)?Object.fromEntries(e.map(l=>[l,l])):e;return new If({type:"enum",entries:o,...xe(n)})}const pS=le("ZodLiteral",(e,n)=>{V4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>tj(e,o,l),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Oe(e,n){return new pS({type:"literal",values:Array.isArray(e)?e:[e],...xe(n)})}const gS=le("ZodTransform",(e,n)=>{B4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>nj(e,o),e._zod.parse=(o,l)=>{if(l.direction==="backward")throw new Fv(e.constructor.name);o.addIssue=u=>{if(typeof u=="string")o.issues.push(Wo(u,o.value,n));else{const d=u;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=o.value),d.inst??(d.inst=e),o.issues.push(Wo(d))}};const c=n.transform(o.value,o);return c instanceof Promise?c.then(u=>(o.value=u,o.fallback=!0,o)):(o.value=c,o.fallback=!0,o)}});function mS(e){return new gS({type:"transform",transform:e})}const S1=le("ZodOptional",(e,n)=>{f1.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>$1(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function Xh(e){return new S1({type:"optional",innerType:e})}const hS=le("ZodExactOptional",(e,n)=>{H4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>$1(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function yS(e){return new hS({type:"optional",innerType:e})}const vS=le("ZodNullable",(e,n)=>{q4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>cj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function Jh(e){return new vS({type:"nullable",innerType:e})}const $S=le("ZodDefault",(e,n)=>{P4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>dj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bS(e,n){return new $S({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():Xv(n)}})}const xS=le("ZodPrefault",(e,n)=>{Z4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>fj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function _S(e,n){return new xS({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():Xv(n)}})}const w1=le("ZodNonOptional",(e,n)=>{G4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>uj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function jS(e,n){return new w1({type:"nonoptional",innerType:e,...xe(n)})}const SS=le("ZodCatch",(e,n)=>{F4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>pj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wS(e,n){return new SS({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const kS=le("ZodPipe",(e,n)=>{Y4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>gj(e,o,l,c),e.in=n.in,e.out=n.out});function Qh(e,n){return new kS({type:"pipe",in:e,out:n})}const NS=le("ZodReadonly",(e,n)=>{K4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>mj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function zS(e){return new NS({type:"readonly",innerType:e})}const ES=le("ZodLazy",(e,n)=>{X4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>hj(e,o,l,c),e.unwrap=()=>e._zod.def.getter()});function k1(e){return new ES({type:"lazy",getter:e})}const CS=le("ZodCustom",(e,n)=>{J4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>aj(e,o)});function TS(e,n={}){return q_(CS,e,n)}function MS(e,n){return P_(e,n)}const N1="@ggui-ai/gadgets",OS="0.6.1",RS=[{package:N1,version:OS,exports:[{hook:"useCamera",permission:"camera",description:"Capture stills or live video from the device camera.",usage:"Mount when the intent names photo capture, QR / barcode scanning, video recording, or anything that requires a camera feed. The hook returns a stream once `start()` resolves; thread the resulting blob or stream URL into a contextSpec slot or an actionSpec payload to surface it to the agent.",example:{call:"const cam = useCamera({ facingMode: 'environment' }); // on button click: await cam.start()",returns:{status:"completed",value:{dataUrl:"data:image/png;base64,…",width:640,height:480,mimeType:"image/png"}}}},{hook:"useClipboardPaste",permission:"clipboard-read",description:"Read the system clipboard contents on user gesture.",usage:"Mount when the intent involves importing copied content (paste-into-form, paste-image-to-upload, paste-link). The Permissions API requires a user gesture; gate `start()` behind a button click. Returned value lands in a contextSpec slot or an actionSpec payload.",example:{call:"const paste = useClipboardPaste(); // on button click: await paste.start()",returns:{status:"completed",value:"pasted clipboard text"}}},{hook:"useClipboardWrite",permission:"clipboard-write",description:"Write to the system clipboard on user gesture.",usage:"Mount when the intent includes copying generated text, share links, codes, or transcripts to the system clipboard. Fire an actionSpec event so the agent observes the act (it does not see the written value — that stays component-local).",example:{call:"const write = useClipboardWrite({ text: 'hello' }); // on button click: await write.start()",returns:{status:"completed",value:"hello"}}},{hook:"useFilePicker",description:"Open the native file picker and read selected files.",usage:"Mount when the intent names file upload, attachment selection, or document import. No permission required. The hook returns the picked files plus metadata; thread file refs / data URLs into a contextSpec slot or actionSpec payload.",example:{call:"const picker = useFilePicker({ accept: 'image/*' }); // on button click: await picker.start()",returns:{status:"completed",value:{files:[{name:"photo.png",type:"image/png",size:12345,_file:"<File>"}]}}}},{hook:"useGeolocation",permission:"geolocation",description:"Resolve the device's current geolocation.",usage:'Mount when the intent names "current location", maps, nearby search, location-aware UI. Browser prompts the user on `start()`; the hook returns coordinates once granted. Thread the resolved coords into a contextSpec slot so the agent observes the latest fix.',example:{call:"const geo = useGeolocation(); // on button click: await geo.start()",returns:{status:"completed",value:{latitude:37.7749,longitude:-122.4194,accuracy:20,timestamp:1718e9}}}},{hook:"useMicrophone",permission:"microphone",description:"Capture audio from the device microphone.",usage:"Mount when the intent names voice memos, audio messages, dictation, voice-driven UI. Returns an audio stream / blob; thread it into an actionSpec payload at recording-stop, or into a contextSpec slot for live transcription pipelines.",example:{call:"const mic = useMicrophone(); // record on click: await mic.start(); end with mic.stop()",returns:{status:"completed",value:{blob:"<Blob>",durationMs:4200,mimeType:"audio/webm"}}}},{hook:"useNotifications",permission:"notifications",description:"Show system / browser notifications to the user.",usage:"Mount when the intent involves alerting the user about something (reminders, completion of long tasks, incoming messages) and the UI may be in the background. Permission is prompted on first `start()`; the agent does NOT see notification dismissal directly — surface it via an actionSpec if needed.",example:{call:"const notify = useNotifications({ title: 'Done' }); // after the task completes: await notify.start()",returns:{status:"completed",value:{outcome:"closed"}}}}]}];Object.freeze(new Set(RS.flatMap(e=>e.exports).map(e=>e.hook).filter(e=>e!==void 0)));const tp=/^use[A-Z][A-Za-z0-9]*$/,ap=/^[A-Z][A-Za-z0-9]*$/,np=["geolocation","notifications","microphone","camera","persistent-storage","midi","clipboard-read","clipboard-write","speaker-selection","storage-access","background-sync","accelerometer","gyroscope","magnetometer","ambient-light-sensor","screen-wake-lock"];new Set(np);const mt=k1(()=>jn([Z(),it(),Ft(),rS(),zt(mt),xt(Z(),mt)])),bn=k1(()=>fe({type:ut(["string","number","integer","boolean","array","object","null"]).optional(),description:Z().optional(),enum:zt(mt).optional(),default:mt.optional(),example:mt.optional(),items:bn.optional(),properties:xt(Z(),bn).optional(),required:zt(Z()).optional(),additionalProperties:jn([bn,Ft()]).optional(),format:Z().optional()}).passthrough()),AS=fe({description:Z().optional(),schema:bn,required:Ft().optional(),default:mt.optional(),example:mt.optional(),sourceTool:Z().optional()}).strict(),DS=fe({description:Z().optional(),properties:xt(Z(),AS)}).strict(),IS=fe({description:Z().optional(),label:Z(),schema:bn.optional(),example:mt.optional(),icon:Z().optional(),confirm:Ft().optional(),nextStep:Z().min(1).optional()}).strict(),US=xt(Z(),IS),LS=fe({description:Z().optional(),schema:bn,example:mt.optional(),mode:ut(["append","replace"]).optional(),replay:ut(["latest","all","none"]).optional(),complete:Ft().optional(),source:fe({tool:Z(),args:xt(Z(),mt).optional()}).strict().optional()}).strict(),VS=xt(Z(),LS),BS=fe({description:Z().optional(),schema:bn,default:mt.optional(),debounceMs:it().int().nonnegative().optional(),example:mt.optional()}).strict(),HS=xt(Z(),BS),qS=fe({serverInfo:fe({name:Z(),version:Z().optional()}).strict().optional(),toolInfo:fe({inputSchema:bn,description:Z().optional(),outputSchema:bn.optional()}).strict(),usage:Z().optional(),example:fe({input:mt,output:mt}).strict().optional()}).strict(),PS=fe({tools:xt(Z(),qS)}).passthrough(),z1=/^GGUI_PUBLIC_APP_[A-Z0-9_]+$/,ZS=zt(Z().regex(z1)).readonly(),Wh=/^sha384-[A-Za-z0-9+/]+=*$/,E1=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,GS=/^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/,FS=/^[a-z0-9.-]+(:\d+)?$/,C1={gotchas:Z().optional()},ey={...C1,description:Z().optional(),usage:Z().optional(),example:mt.optional(),permission:Z().optional()},ty={...C1,description:Z().min(1),usage:Z().min(1),example:mt,permission:ut(np).optional()},T1={version:Z().regex(GS),package:Z().regex(E1),bundleUrl:Cs().optional(),bundleHost:Z().regex(FS).optional(),bundleSri:Z().regex(Wh).optional(),styleUrl:Cs().optional(),connect:zt(Cs()).readonly().optional(),requires:ZS.optional(),typesUrl:Cs().optional(),typesSri:Z().regex(Wh).optional()},YS=jn([fe({hook:Z().regex(tp),...ey}).strict(),fe({component:Z().regex(ap),...ey}).strict()]),KS=jn([fe({hook:Z().regex(tp),...ty}).strict(),fe({component:Z().regex(ap),...ty}).strict()]);fe({...T1,exports:zt(YS).min(1)}).strict();const XS=fe({...T1,exports:zt(KS).min(1)}).strict();XS.refine(e=>e.package===N1||typeof e.typesUrl=="string",{message:"registered GadgetDescriptor MUST declare a `typesUrl` (HTTPS URL to the package's .d.ts) — the code-gen sandbox loads it to typecheck generated component code against the export signatures. Run `tsup --dts` (or `tsc --declaration`) in the wrapper build and publish the emitted .d.ts. Only the first-party `@ggui-ai/gadgets` stdlib is exempt.",path:["typesUrl"]});const JS=fe({description:Z().optional(),usage:Z().optional()}).strict(),QS=xt(Z().refine(e=>tp.test(e)||ap.test(e),{message:"gadget export name must be a `use`-prefixed hook or a PascalCase component identifier"}),JS).refine(e=>Object.keys(e).length>0,{message:"a `clientCapabilities.gadgets` package entry must declare at least one export"}),WS=fe({gadgets:xt(Z().regex(E1),QS)}).strict();xt(Z().regex(z1),Z()).readonly();const il=fe({propsSpec:DS.optional(),actionSpec:US.optional(),streamSpec:VS.optional(),contextSpec:HS.optional(),agentCapabilities:PS.optional(),clientCapabilities:WS.optional()}).passthrough(),M1=fe({kind:Oe("llm"),generator:Z().min(1),model:Z().min(1)}).strict(),O1=fe({kind:Oe("user")}).strict(),e3=fe({kind:Oe("curated")}).strict(),R1=jn([M1,O1,e3]),Oc=fe({persona:Z().optional().describe('Design persona, e.g. "minimalist" / "data-dense". Part of cache identity.'),aesthetic:Z().optional().describe('Visual aesthetic, e.g. "calm" / "ornate". Part of cache identity.'),context:xt(Z(),mt).optional().describe('Deliberate design-shaping signals (e.g. {situation:"sad"}) — part of cache identity. NOT for per-user runtime data; put that in propsSpec/contextSpec.'),seedPrompt:Z().optional().describe("Generation seed directive. Part of cache identity.")}).strict(),t3=fe({blueprintId:Z().min(1),contractHash:Z().min(1),appId:Z().min(1),codeS3Url:Z().optional(),codeHash:Z().optional(),source:R1,validatorScore:it().min(0).max(1).optional(),variance:Oc,isOperatorDefault:Oe(!0).optional(),createdAt:Z().min(1),createdBy:ut(["agent","operator"]),contract:il,contractEmbedding:zt(it()).optional()}).strict(),a3=fe({hash:it().min(0).optional(),embed:it().min(0).optional(),struct:it().min(0).optional(),variance:it().min(0).optional(),intent:it().min(0).optional()}).strict();fe({weights:a3.optional(),threshold:it().min(0).max(1).optional(),topK:it().int().min(1).optional()}).strict();const n3=ut(["cache","agent","synth"]),r3=jn([fe({op:Oe("add"),path:Z(),value:mt}).strict(),fe({op:Oe("remove"),path:Z()}).strict(),fe({op:Oe("replace"),path:Z(),value:mt}).strict()]),i3=zt(r3),o3=fe({contract:il,variance:fe({persona:Z().optional(),aesthetic:Z().optional(),context:xt(Z(),mt).optional(),seedPrompt:Z().optional()}).strict().optional(),generator:Z().optional()}).strict(),l3=o3,s3=fe({blueprintId:Z().min(1).optional(),contractHash:Z().min(1),codeHash:Z().optional(),source:R1.optional(),variance:Oc,selectedReason:Z().optional()}).strict(),c3=fe({code:Z().min(1),severity:ut(["error","warn"]),path:Z(),message:Z()}).strict(),u3=fe({contractDiff:i3,reasoning:Z()}).strict(),d3=fe({origin:n3,rationale:Z(),blueprintMeta:s3,proposedContractSummary:Z().optional(),amendments:u3.optional(),validationFindings:zt(c3).optional()}).strict(),f3=fe({width:it(),height:it()}),p3=fe({viewport:f3,platform:ut(["web","mobile","desktop"]),deviceType:ut(["phone","tablet","desktop"]),orientation:ut(["portrait","landscape"]),devicePixelRatio:it().optional(),touchPrimary:Ft().optional(),shellType:ut(["chat","fullscreen","spatial"]).optional(),colorScheme:ut(["light","dark"]).optional(),reducedMotion:Ft().optional()}).passthrough(),g3={sessionId:Z().min(1).describe("Globally-unique sessionId to consume events from. Cross-tenant access surfaces uniformly as session_not_found."),timeout:it().int().min(0).max(25).optional().describe("Inline long-poll seconds, integer in [0, 25]. 0 = immediate. Values outside the bound reject INVALID_PARAMS. Returns on first event OR timeout; re-call on empty to keep waiting — longer waits are your loop, not a bigger timeout.")};fe(g3);const m3={sessionId:Z().min(1),channel:Z().min(1),payload:$r(),complete:Ft().optional()};fe(m3);const h3={sessionId:Z().min(1).describe("GguiSession opaque id (UUID) — returned by ggui_render.")};fe(h3);const y3={};fe(y3);const v3={query:Z().min(1).describe("Natural-language description of the UI you're looking for"),limit:it().int().min(1).max(100).optional()};fe(v3);const $3={blueprintId:Z().min(1).describe("The stable blueprint id declared via ggui.ui.json#id. Must match an entry in this server's UI registry.")};fe($3);const b3={};fe(b3);const x3={serviceId:Z().min(1),reason:Z().optional(),sessionId:Z().optional()};fe(x3);fe({intent:Z().min(1).describe('Concise purpose — same intent = same component reused. e.g. "Gmail inbox for email triage"'),blueprintDraft:l3.describe("Agent's draft: contract (required) + optional variance + optional generator slug hint. The server combines this with cached blueprints + validator outcomes to produce a three-mode suggestion (cache / agent / synth)."),forceCreate:Ft().optional()}).strict();fe({handshakeId:Z().describe("Stable id — pass to ggui_render / ggui_update"),action:ut(["create","reuse","update","replace","declined"]),suggestion:d3.describe("Server's suggestion — origin-routed (cache | agent | synth). Always carries a provisional `blueprintMeta` the agent reuses by rendering WITHOUT `override` (accept the proposal as-is)."),reason:Z().max(280).optional().describe("Short rationale (≤280 chars) for the `action` value. Surfaced for agent + operator visibility; truncated to keep the structuredContent payload predictable."),nextStep:fe({tool:Oe("ggui_render"),description:Z(),example:Z()}).optional().describe("Wire-shape recovery hint. A worked literal example of the next ggui_render call the agent should emit — the example string can be copied verbatim and tweaked (e.g. fill in `props` placeholders). Top-level field so a skimming agent finds it immediately.")});const _3={handshakeId:Z({message:"ggui_render: handshakeId is REQUIRED. Call ggui_handshake({intent, blueprintDraft}) first to negotiate — handshake returns a handshakeId + suggestion. Then render with {handshakeId, props} (accept the suggestion as-is) or {handshakeId, props, override: {contract?, variance?}} (re-aim the contract and/or variance). Direct-render without a handshakeId is not supported."}).min(1,"ggui_render: handshakeId must be a non-empty string from a prior ggui_handshake call."),props:xt(Z(),$r()),themeId:Z().min(1).optional().describe("Per-render theme override. Wins over App.defaultThemeId for THIS render. Omit to inherit the app theme."),infra:fe({model:Z().min(1).optional().describe("Provider-prefixed model id (e.g., `anthropic/claude-haiku-4-5`, `openai/gpt-5`). Generator-specific prefixes (e.g., `bedrock/...` for AWS Bedrock routing) supported when the bound generator handles them.")}).strict().optional(),override:fe({contract:il.optional().describe("STRICT full re-draft of the contract — must already conform; the server will not repair it."),variance:Oc.optional().describe("Re-aim the variant (persona/aesthetic/context/seedPrompt); keeps the agreed contract.")}).strict().refine(e=>e.contract!==void 0||e.variance!==void 0,{message:"override must set contract and/or variance — omit override entirely to ACCEPT the handshake proposal as-is."}).optional().describe("Omit to ACCEPT the proposal as-is. Provide to re-aim contract and/or variance (PATCH semantics).")};fe(_3);const j3=fe({hit:Ft().describe("True when a stored component was served without generating new code."),similarity:it().optional().describe("Cosine similarity of the matched component to the request (semantic match only)."),cachedBlueprintId:Z().optional().describe("The stored component id that was matched. Equals top-level blueprintId on a hit."),llmCallsAvoided:it().describe("Generation calls skipped by serving the stored component (0 on a fresh generation)."),kind:ut(["full-template","cold"]).optional().describe("full-template = a whole stored component was served; cold = freshly generated."),reason:Z().optional().describe("Compact human-readable explanation of the cache outcome — why this render reused a stored component or generated cold. Diagnostic; default-available without the verbose env-gated trace.")}),S3=ut(["PRODUCTION_FAILED","VALIDATION_ERROR","NO_PLATFORM_KEY","NO_CREDENTIALS"]),w3=fe({code:S3.describe("Canonical failure class. PRODUCTION_FAILED: generation did not produce a component. VALIDATION_ERROR: a server-side precondition rejected the render before generation. NO_PLATFORM_KEY: the server's managed provider-key configuration has no key for the resolved route. NO_CREDENTIALS: no generation credentials are configured on the server."),message:Z().describe("Human-readable failure detail — fold into the next attempt or surface to the operator.")});fe({sessionId:Z(),resourceUri:Z().optional().describe("MCP-Apps mount URI (ui://ggui/render/{id}). Present iff the render is mountable; absent on a failed render."),action:ut(["create","reuse","update","replace","declined"]),contractHash:Z().describe("Canonical hash of the rendered data contract (shape only — fields, types, specs). Same hash ⟺ same data flow."),blueprintId:Z().describe("Opaque id of the materialised component for this render. On the handshake-decided reuse paths (accept a cache-origin proposal, or a variance re-aim that resolves to an existing variant) it is the stored id — equal ids across renders mean the same stored component. override.contract always generates cold and mints a fresh id, even for an identical contract."),variantKey:Z().describe("Canonical hash of the design-time variance (persona, aesthetic, seed prompt, context). With contractHash it forms the reuse key: the same pair reuses one component; a different variant of the same contract gets its own."),cache:j3.describe("Reuse outcome for this render: whether a stored component was served, its similarity, the matched component id, and how many generation calls that avoided."),error:w3.optional().describe("Present iff the tool result is isError — canonical {code, message} for a failed/rejected generation. Absent on success."),nextStep:fe({tool:Oe("ggui_consume"),description:Z(),example:Z(),args:fe({sessionId:Z()})}).optional().describe("Recovery hint — when the rendered contract has actions, points the agent at ggui_consume({sessionId}) for the inbound action loop. Absent for pure-display renders.")});rl("kind",[fe({sessionId:Z().describe("GguiSession opaque id (UUID) — returned by ggui_render."),kind:Oe("replace"),props:xt(Z(),$r()).describe("Full replacement props map. New map IS the new state.")}).strict(),fe({sessionId:Z().describe("GguiSession opaque id (UUID) — returned by ggui_render."),kind:Oe("merge"),patch:xt(Z(),$r()).describe("RFC 7396 JSON Merge Patch — null deletes a key; arrays fully replace.")}).strict()]);fe({sessionId:Z(),updated:Ft(),resourceUri:Z()});fe({toolCatalog:xt(Z(),fe({name:Z(),version:Z().optional()}).strict()).describe("Per-app canonical tool identities: bare tool name -> its server's initialize-declared serverInfo. Host/library-supplied; not an agent action.")}).strict();fe({saved:Ft(),appId:Z()}).strict();const k3=fe({type:Oe("text"),text:Z()}),N3=fe({type:Oe("tool_use"),id:Z(),name:Z(),input:xt(Z(),$r())}),z3=fe({type:Oe("tool_result"),tool_use_id:Z(),content:$r(),is_error:Ft().optional()}),A1=rl("type",[k3,N3,z3]),E3=fe({type:Oe("text_delta"),text:Z()}),C3=fe({type:Oe("input_json_delta"),partial_json:Z()}),T3=rl("type",[E3,C3]),M3=fe({type:Oe("message_start"),message:fe({id:Z(),role:Oe("assistant"),model:Z().optional()})}),O3=fe({type:Oe("content_block_start"),index:it().int().nonnegative(),content_block:A1}),R3=fe({type:Oe("content_block_delta"),index:it().int().nonnegative(),delta:T3}),A3=fe({type:Oe("content_block_stop"),index:it().int().nonnegative()}),D3=fe({type:Oe("message_delta"),delta:fe({stop_reason:ut(["end_turn","max_tokens","tool_use","error"]),stop_sequence:Z().nullable().optional()}),usage:fe({input_tokens:it().int().nonnegative(),output_tokens:it().int().nonnegative()})}),I3=fe({type:Oe("message_stop")}),U3=fe({type:Oe("ping")}),L3=ut(["invalid_request","unauthorized","rate_limited","invoke_in_progress","upstream_error","tool_error","internal"]),V3=fe({type:Oe("error"),error:fe({code:L3,message:Z(),retryAfterMs:it().int().nonnegative().optional()})});rl("type",[M3,O3,R3,A3,D3,I3,U3,V3]);const B3=fe({role:ut(["user","assistant"]),content:jn([Z(),zt(A1)])});fe({message:Z(),history:zt(B3).optional(),interfaceContext:p3.optional(),requestId:Z().optional()});const H3=/^--ggui-[a-zA-Z0-9-]+$/,q3=/^[^;{}<>@]*$/,P3=Z().min(1).max(256).regex(q3,"css value contains a disallowed character").refine(e=>!e.includes("/*"),"css value may not contain a comment");fe({mode:ut(["light","dark"]),cssVariables:xt(Z().regex(H3,"css var key must be --ggui-*"),P3).refine(e=>Object.keys(e).length<=200,"too many css variables (max 200)"),name:Z().min(1).max(64).optional()}).strict();fe({contract:il,generator:Z().min(1).optional().describe("Generator slug (e.g. `ui-gen-default-haiku-4-5`). When omitted, dispatches through `GeneratorRegistry.defaultGenerator()`."),persona:Z().optional().describe("Free-form persona tag (e.g. 'minimalist', 'data-dense'). Normalized via lowercase+trim before persistence; logged as a warning when within Levenshtein distance < 2 of an existing tag for the same appId."),aesthetic:Z().optional().describe("Free-form aesthetic tag (e.g. 'glassmorphic', 'brutalist', 'editorial'). Persisted on `Blueprint.variance.aesthetic`. Distinct from persona — persona names the user mental model; aesthetic names the visual treatment."),context:xt(Z(),mt).optional().describe("Small structured signal carried alongside the persona. Persisted on `Blueprint.variance.context`."),seedPrompt:Z().optional().describe("The raw operator prompt that produced this variant. Round-trip input for the variant-selector + audit trail."),setAsOperatorDefault:Ft().optional().describe("When true, pins the new blueprint as the operator default for its `(appId, contractHash)` group, clearing any prior default in the same group.")}).strict();fe({blueprintId:Z().min(1),codeHash:Z().optional().describe("Content hash of the generated code body. Absent when the generator returned a non-`ok` result and persistence skipped — the failure mode is surfaced through generator-level error reporting elsewhere."),validatorScore:it().min(0).max(1).optional().describe("Advanced generator's iterative-loop validator score (0-1). Absent for default-generator output."),source:M1.describe("Provenance stamped on the persisted `Blueprint.source` — always the `llm` arm on this path: `generator` is the engine slug the dispatch resolved to (stamped from the engine's own metadata claim); `model` is the LLM model id the engine called.")}).strict();fe({contract:il,componentCode:Z().min(1).describe("Verbatim component-code body to persist. Stored as-is — no LLM call, no validator pass. Operator owns correctness; the handler computes the canonical sha256 codeHash and routes the bytes through the same persistence seams as `*_generate_*`."),persona:Z().optional().describe("Free-form persona tag (e.g. 'minimalist', 'data-dense'). Normalized via lowercase+trim before persistence; logged as a warning when within Levenshtein distance < 2 of an existing tag for the same appId."),aesthetic:Z().optional().describe("Free-form aesthetic tag. Persisted on `Blueprint.variance.aesthetic`."),context:xt(Z(),mt).optional().describe("Small structured signal carried alongside the persona. Persisted on `Blueprint.variance.context`."),seedPrompt:Z().optional().describe("Optional originating prompt for audit + round-tripping (e.g. the prose the operator originally fed into `*_generate_*` before exporting)."),setAsOperatorDefault:Ft().optional().describe("When true, pins the new blueprint as the operator default for its `(appId, contractHash)` group, clearing any prior default in the same group.")}).strict();fe({blueprintId:Z().min(1),codeHash:Z().min(1).describe("Content hash of the persisted code body (full sha256 hex)."),source:O1.describe('Provenance stamped on the persisted `Blueprint.source` — always `{kind: "user"}` on this path: operator-supplied bytes, no LLM dispatch, no engine claim to record.')}).strict();fe({contractHash:Z().min(1).optional().describe("Filter to a single `(appId, contractHash)` group. Combine with `generator` / `persona` to narrow within the group."),generator:Z().min(1).optional().describe('Filter to engine-generated blueprints (`source.kind === "llm"`) whose `source.generator` equals this slug. `user`-sourced rows never match (they carry no engine provenance).'),persona:Z().optional().describe("Filter on `variance.persona`. Normalized to match persisted form (lowercase+trim)."),intentKeywords:zt(Z().min(1)).optional().describe("Semantic-search tokens. When set, dispatches through `BlueprintSearch.search()` rather than indexed `list()`.")}).strict();fe({blueprints:zt(t3)}).strict();fe({blueprintId:Z().min(1),isOperatorDefault:Oe(!0).optional().describe("When `true`, pins this blueprint as the operator default for its `(appId, contractHash)` group. Clears any prior default. Cannot set to `false` — to unpin, set another blueprint in the same group as default, or delete this one."),variance:Oc.optional().describe('Partial-merge into the existing variance. Supplied keys overwrite; omitted keys preserve. Pass `{persona: ""}` to clear a persona (handler treats empty string as removal).')}).strict();fe({blueprintId:Z().min(1),updatedAt:Z().min(1)}).strict();fe({blueprintId:Z().min(1)}).strict();fe({deleted:Oe(!0)}).strict();function Z3(e){return"schemaVersion"in e?e.schemaVersion:qx}function G3(e){const n={sessionId:e.sessionId,type:e.type};e.payload!==void 0&&(n.payload=e.payload),e.clientSeq!==void 0&&(n.clientSeq=e.clientSeq);const o=Z3(e);return o!==void 0&&(n.schemaVersion=o),n}var Ts={exports:{}},hf={},hn={},qr={},yf={},vf={},$f={},ay;function wc(){return ay||(ay=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class n{}e._CodeOrName=n,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class o extends n{constructor($){if(super(),!e.IDENTIFIER.test($))throw new Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=o;class l extends n{constructor($){super(),this._items=typeof $=="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((N,R)=>`${N}${R}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((N,R)=>(R instanceof o&&(N[R.str]=(N[R.str]||0)+1),N),{})}}e._Code=l,e.nil=new l("");function c(w,...$){const N=[w[0]];let R=0;for(;R<$.length;)p(N,$[R]),N.push(w[++R]);return new l(N)}e._=c;const u=new l("+");function d(w,...$){const N=[k(w[0])];let R=0;for(;R<$.length;)N.push(u),p(N,$[R]),N.push(u,k(w[++R]));return g(N),new l(N)}e.str=d;function p(w,$){$ instanceof l?w.push(...$._items):$ instanceof o?w.push($):w.push(v($))}e.addCodeArg=p;function g(w){let $=1;for(;$<w.length-1;){if(w[$]===u){const N=h(w[$-1],w[$+1]);if(N!==void 0){w.splice($-1,3,N);continue}w[$++]="+"}$++}}function h(w,$){if($==='""')return w;if(w==='""')return $;if(typeof w=="string")return $ instanceof o||w[w.length-1]!=='"'?void 0:typeof $!="string"?`${w.slice(0,-1)}${$}"`:$[0]==='"'?w.slice(0,-1)+$.slice(1):void 0;if(typeof $=="string"&&$[0]==='"'&&!(w instanceof o))return`"${w}${$.slice(1)}`}function y(w,$){return $.emptyStr()?w:w.emptyStr()?$:d`${w}${$}`}e.strConcat=y;function v(w){return typeof w=="number"||typeof w=="boolean"||w===null?w:k(Array.isArray(w)?w.join(","):w)}function j(w){return new l(k(w))}e.stringify=j;function k(w){return JSON.stringify(w).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=k;function x(w){return typeof w=="string"&&e.IDENTIFIER.test(w)?new l(`.${w}`):c`[${w}]`}e.getProperty=x;function E(w){if(typeof w=="string"&&e.IDENTIFIER.test(w))return new l(`${w}`);throw new Error(`CodeGen: invalid export name: ${w}, use explicit $id name mapping`)}e.getEsmExportName=E;function z(w){return new l(w.toString())}e.regexpCode=z})($f)),$f}var bf={},ny;function ry(){return ny||(ny=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const n=wc();class o extends Error{constructor(h){super(`CodeGen: "code" for ${h} not defined`),this.value=h.value}}var l;(function(g){g[g.Started=0]="Started",g[g.Completed=1]="Completed"})(l||(e.UsedValueState=l={})),e.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class c{constructor({prefixes:h,parent:y}={}){this._names={},this._prefixes=h,this._parent=y}toName(h){return h instanceof n.Name?h:this.name(h)}name(h){return new n.Name(this._newName(h))}_newName(h){const y=this._names[h]||this._nameGroup(h);return`${h}${y.index++}`}_nameGroup(h){var y,v;if(!((v=(y=this._parent)===null||y===void 0?void 0:y._prefixes)===null||v===void 0)&&v.has(h)||this._prefixes&&!this._prefixes.has(h))throw new Error(`CodeGen: prefix "${h}" is not allowed in this scope`);return this._names[h]={prefix:h,index:0}}}e.Scope=c;class u extends n.Name{constructor(h,y){super(y),this.prefix=h}setValue(h,{property:y,itemIndex:v}){this.value=h,this.scopePath=(0,n._)`.${new n.Name(y)}[${v}]`}}e.ValueScopeName=u;const d=(0,n._)`\n`;class p extends c{constructor(h){super(h),this._values={},this._scope=h.scope,this.opts={...h,_n:h.lines?d:n.nil}}get(){return this._scope}name(h){return new u(h,this._newName(h))}value(h,y){var v;if(y.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const j=this.toName(h),{prefix:k}=j,x=(v=y.key)!==null&&v!==void 0?v:y.ref;let E=this._values[k];if(E){const $=E.get(x);if($)return $}else E=this._values[k]=new Map;E.set(x,j);const z=this._scope[k]||(this._scope[k]=[]),w=z.length;return z[w]=y.ref,j.setValue(y,{property:k,itemIndex:w}),j}getValue(h,y){const v=this._values[h];if(v)return v.get(y)}scopeRefs(h,y=this._values){return this._reduceValues(y,v=>{if(v.scopePath===void 0)throw new Error(`CodeGen: name "${v}" has no value`);return(0,n._)`${h}${v.scopePath}`})}scopeCode(h=this._values,y,v){return this._reduceValues(h,j=>{if(j.value===void 0)throw new Error(`CodeGen: name "${j}" has no value`);return j.value.code},y,v)}_reduceValues(h,y,v={},j){let k=n.nil;for(const x in h){const E=h[x];if(!E)continue;const z=v[x]=v[x]||new Map;E.forEach(w=>{if(z.has(w))return;z.set(w,l.Started);let $=y(w);if($){const N=this.opts.es5?e.varKinds.var:e.varKinds.const;k=(0,n._)`${k}${N} ${w} = ${$};${this.opts._n}`}else if($=j==null?void 0:j(w))k=(0,n._)`${k}${$}${this.opts._n}`;else throw new o(w);z.set(w,l.Completed)})}return k}}e.ValueScope=p})(bf)),bf}var iy;function Ae(){return iy||(iy=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const n=wc(),o=ry();var l=wc();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return l.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return l.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return l.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}});var c=ry();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return c.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return c.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return c.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return c.varKinds}}),e.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class u{optimizeNodes(){return this}optimizeNames(O,D){return this}}class d extends u{constructor(O,D,X){super(),this.varKind=O,this.name=D,this.rhs=X}render({es5:O,_n:D}){const X=O?o.varKinds.var:this.varKind,pe=this.rhs===void 0?"":` = ${this.rhs}`;return`${X} ${this.name}${pe};`+D}optimizeNames(O,D){if(O[this.name.str])return this.rhs&&(this.rhs=ie(this.rhs,O,D)),this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class p extends u{constructor(O,D,X){super(),this.lhs=O,this.rhs=D,this.sideEffects=X}render({_n:O}){return`${this.lhs} = ${this.rhs};`+O}optimizeNames(O,D){if(!(this.lhs instanceof n.Name&&!O[this.lhs.str]&&!this.sideEffects))return this.rhs=ie(this.rhs,O,D),this}get names(){const O=this.lhs instanceof n.Name?{}:{...this.lhs.names};return F(O,this.rhs)}}class g extends p{constructor(O,D,X,pe){super(O,X,pe),this.op=D}render({_n:O}){return`${this.lhs} ${this.op}= ${this.rhs};`+O}}class h extends u{constructor(O){super(),this.label=O,this.names={}}render({_n:O}){return`${this.label}:`+O}}class y extends u{constructor(O){super(),this.label=O,this.names={}}render({_n:O}){return`break${this.label?` ${this.label}`:""};`+O}}class v extends u{constructor(O){super(),this.error=O}render({_n:O}){return`throw ${this.error};`+O}get names(){return this.error.names}}class j extends u{constructor(O){super(),this.code=O}render({_n:O}){return`${this.code};`+O}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(O,D){return this.code=ie(this.code,O,D),this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class k extends u{constructor(O=[]){super(),this.nodes=O}render(O){return this.nodes.reduce((D,X)=>D+X.render(O),"")}optimizeNodes(){const{nodes:O}=this;let D=O.length;for(;D--;){const X=O[D].optimizeNodes();Array.isArray(X)?O.splice(D,1,...X):X?O[D]=X:O.splice(D,1)}return O.length>0?this:void 0}optimizeNames(O,D){const{nodes:X}=this;let pe=X.length;for(;pe--;){const he=X[pe];he.optimizeNames(O,D)||(_e(O,he.names),X.splice(pe,1))}return X.length>0?this:void 0}get names(){return this.nodes.reduce((O,D)=>Y(O,D.names),{})}}class x extends k{render(O){return"{"+O._n+super.render(O)+"}"+O._n}}class E extends k{}class z extends x{}z.kind="else";class w extends x{constructor(O,D){super(D),this.condition=O}render(O){let D=`if(${this.condition})`+super.render(O);return this.else&&(D+="else "+this.else.render(O)),D}optimizeNodes(){super.optimizeNodes();const O=this.condition;if(O===!0)return this.nodes;let D=this.else;if(D){const X=D.optimizeNodes();D=this.else=Array.isArray(X)?new z(X):X}if(D)return O===!1?D instanceof w?D:D.nodes:this.nodes.length?this:new w(ae(O),D instanceof w?[D]:D.nodes);if(!(O===!1||!this.nodes.length))return this}optimizeNames(O,D){var X;if(this.else=(X=this.else)===null||X===void 0?void 0:X.optimizeNames(O,D),!!(super.optimizeNames(O,D)||this.else))return this.condition=ie(this.condition,O,D),this}get names(){const O=super.names;return F(O,this.condition),this.else&&Y(O,this.else.names),O}}w.kind="if";class $ extends x{}$.kind="for";class N extends ${constructor(O){super(),this.iteration=O}render(O){return`for(${this.iteration})`+super.render(O)}optimizeNames(O,D){if(super.optimizeNames(O,D))return this.iteration=ie(this.iteration,O,D),this}get names(){return Y(super.names,this.iteration.names)}}class R extends ${constructor(O,D,X,pe){super(),this.varKind=O,this.name=D,this.from=X,this.to=pe}render(O){const D=O.es5?o.varKinds.var:this.varKind,{name:X,from:pe,to:he}=this;return`for(${D} ${X}=${pe}; ${X}<${he}; ${X}++)`+super.render(O)}get names(){const O=F(super.names,this.from);return F(O,this.to)}}class _ extends ${constructor(O,D,X,pe){super(),this.loop=O,this.varKind=D,this.name=X,this.iterable=pe}render(O){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(O)}optimizeNames(O,D){if(super.optimizeNames(O,D))return this.iterable=ie(this.iterable,O,D),this}get names(){return Y(super.names,this.iterable.names)}}class S extends x{constructor(O,D,X){super(),this.name=O,this.args=D,this.async=X}render(O){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(O)}}S.kind="func";class C extends k{render(O){return"return "+super.render(O)}}C.kind="return";class I extends x{render(O){let D="try"+super.render(O);return this.catch&&(D+=this.catch.render(O)),this.finally&&(D+=this.finally.render(O)),D}optimizeNodes(){var O,D;return super.optimizeNodes(),(O=this.catch)===null||O===void 0||O.optimizeNodes(),(D=this.finally)===null||D===void 0||D.optimizeNodes(),this}optimizeNames(O,D){var X,pe;return super.optimizeNames(O,D),(X=this.catch)===null||X===void 0||X.optimizeNames(O,D),(pe=this.finally)===null||pe===void 0||pe.optimizeNames(O,D),this}get names(){const O=super.names;return this.catch&&Y(O,this.catch.names),this.finally&&Y(O,this.finally.names),O}}class te extends x{constructor(O){super(),this.error=O}render(O){return`catch(${this.error})`+super.render(O)}}te.kind="catch";class G extends x{render(O){return"finally"+super.render(O)}}G.kind="finally";class H{constructor(O,D={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...D,_n:D.lines?`
|
|
112
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const v=y[1];if(n===y[0]){u(y);continue}if(e.external){const k=(g=e.external.registry.get(y[0]))==null?void 0:g.id;if(n!==y[0]&&k){u(y);continue}}if((h=e.metadataRegistry.get(y[0]))==null?void 0:h.id){u(y);continue}if(v.cycle){u(y);continue}if(v.count>1&&e.reused==="ref"){u(y);continue}}}function v1(e,n){var p,g,h,y;const o=e.seen.get(n);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=v=>{const j=e.seen.get(v);if(j.ref===null)return;const k=j.def??j.schema,x={...k},E=j.ref;if(j.ref=null,E){l(E);const w=e.seen.get(E),$=w.schema;if($.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push($)):Object.assign(k,$),Object.assign(k,x),v._zod.parent===E)for(const R in k)R==="$ref"||R==="allOf"||R in x||delete k[R];if($.$ref&&w.def)for(const R in k)R==="$ref"||R==="allOf"||R in w.def&&JSON.stringify(k[R])===JSON.stringify(w.def[R])&&delete k[R]}const z=v._zod.parent;if(z&&z!==E){l(z);const w=e.seen.get(z);if(w!=null&&w.schema.$ref&&(k.$ref=w.schema.$ref,w.def))for(const $ in k)$==="$ref"||$==="allOf"||$ in w.def&&JSON.stringify(k[$])===JSON.stringify(w.def[$])&&delete k[$]}e.override({zodSchema:v,jsonSchema:k,path:j.path??[]})};for(const v of[...e.seen.entries()].reverse())l(v[0]);const c={};if(e.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?c.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?c.$schema="http://json-schema.org/draft-04/schema#":e.target,(p=e.external)!=null&&p.uri){const v=(g=e.external.registry.get(n))==null?void 0:g.id;if(!v)throw new Error("Schema is missing an `id` property");c.$id=e.external.uri(v)}Object.assign(c,o.def??o.schema);const u=(h=e.metadataRegistry.get(n))==null?void 0:h.id;u!==void 0&&c.id===u&&delete c.id;const d=((y=e.external)==null?void 0:y.defs)??{};for(const v of e.seen.entries()){const j=v[1];j.def&&j.defId&&(j.def.id===j.defId&&delete j.def.id,d[j.defId]=j.def)}e.external||Object.keys(d).length>0&&(e.target==="draft-2020-12"?c.$defs=d:c.definitions=d);try{const v=JSON.parse(JSON.stringify(c));return Object.defineProperty(v,"~standard",{value:{...n["~standard"],jsonSchema:{input:Sc(n,"input",e.processors),output:Sc(n,"output",e.processors)}},enumerable:!1,writable:!1}),v}catch{throw new Error("Error converting schema to JSON.")}}function Xt(e,n){const o=n??{seen:new Set};if(o.seen.has(e))return!1;o.seen.add(e);const l=e._zod.def;if(l.type==="transform")return!0;if(l.type==="array")return Xt(l.element,o);if(l.type==="set")return Xt(l.valueType,o);if(l.type==="lazy")return Xt(l.getter(),o);if(l.type==="promise"||l.type==="optional"||l.type==="nonoptional"||l.type==="nullable"||l.type==="readonly"||l.type==="default"||l.type==="prefault")return Xt(l.innerType,o);if(l.type==="intersection")return Xt(l.left,o)||Xt(l.right,o);if(l.type==="record"||l.type==="map")return Xt(l.keyType,o)||Xt(l.valueType,o);if(l.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Xt(l.in,o)||Xt(l.out,o);if(l.type==="object"){for(const c in l.shape)if(Xt(l.shape[c],o))return!0;return!1}if(l.type==="union"){for(const c of l.options)if(Xt(c,o))return!0;return!1}if(l.type==="tuple"){for(const c of l.items)if(Xt(c,o))return!0;return!!(l.rest&&Xt(l.rest,o))}return!1}const G_=(e,n={})=>o=>{const l=h1({...o,processors:n});return bt(e,l),y1(l,e),v1(l,e)},Sc=(e,n,o={})=>l=>{const{libraryOptions:c,target:u}=l??{},d=h1({...c??{},target:u,io:n,processors:o});return bt(e,d),y1(d,e),v1(d,e)},F_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Y_=(e,n,o,l)=>{const c=o;c.type="string";const{minimum:u,maximum:d,format:p,patterns:g,contentEncoding:h}=e._zod.bag;if(typeof u=="number"&&(c.minLength=u),typeof d=="number"&&(c.maxLength=d),p&&(c.format=F_[p]??p,c.format===""&&delete c.format,p==="time"&&delete c.format),h&&(c.contentEncoding=h),g&&g.size>0){const y=[...g];y.length===1?c.pattern=y[0].source:y.length>1&&(c.allOf=[...y.map(v=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},K_=(e,n,o,l)=>{const c=o,{minimum:u,maximum:d,format:p,multipleOf:g,exclusiveMaximum:h,exclusiveMinimum:y}=e._zod.bag;typeof p=="string"&&p.includes("int")?c.type="integer":c.type="number";const v=typeof y=="number"&&y>=(u??Number.NEGATIVE_INFINITY),j=typeof h=="number"&&h<=(d??Number.POSITIVE_INFINITY),k=n.target==="draft-04"||n.target==="openapi-3.0";v?k?(c.minimum=y,c.exclusiveMinimum=!0):c.exclusiveMinimum=y:typeof u=="number"&&(c.minimum=u),j?k?(c.maximum=h,c.exclusiveMaximum=!0):c.exclusiveMaximum=h:typeof d=="number"&&(c.maximum=d),typeof g=="number"&&(c.multipleOf=g)},X_=(e,n,o,l)=>{o.type="boolean"},J_=(e,n,o,l)=>{n.target==="openapi-3.0"?(o.type="string",o.nullable=!0,o.enum=[null]):o.type="null"},Q_=(e,n,o,l)=>{o.not={}},W_=(e,n,o,l)=>{},ej=(e,n,o,l)=>{const c=e._zod.def,u=Yv(c.entries);u.every(d=>typeof d=="number")&&(o.type="number"),u.every(d=>typeof d=="string")&&(o.type="string"),o.enum=u},tj=(e,n,o,l)=>{const c=e._zod.def,u=[];for(const d of c.values)if(d===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof d=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");u.push(Number(d))}else u.push(d);if(u.length!==0)if(u.length===1){const d=u[0];o.type=d===null?"null":typeof d,n.target==="draft-04"||n.target==="openapi-3.0"?o.enum=[d]:o.const=d}else u.every(d=>typeof d=="number")&&(o.type="number"),u.every(d=>typeof d=="string")&&(o.type="string"),u.every(d=>typeof d=="boolean")&&(o.type="boolean"),u.every(d=>d===null)&&(o.type="null"),o.enum=u},aj=(e,n,o,l)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},nj=(e,n,o,l)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},rj=(e,n,o,l)=>{const c=o,u=e._zod.def,{minimum:d,maximum:p}=e._zod.bag;typeof d=="number"&&(c.minItems=d),typeof p=="number"&&(c.maxItems=p),c.type="array",c.items=bt(u.element,n,{...l,path:[...l.path,"items"]})},ij=(e,n,o,l)=>{var h;const c=o,u=e._zod.def;c.type="object",c.properties={};const d=u.shape;for(const y in d)c.properties[y]=bt(d[y],n,{...l,path:[...l.path,"properties",y]});const p=new Set(Object.keys(d)),g=new Set([...p].filter(y=>{const v=u.shape[y]._zod;return n.io==="input"?v.optin===void 0:v.optout===void 0}));g.size>0&&(c.required=Array.from(g)),((h=u.catchall)==null?void 0:h._zod.def.type)==="never"?c.additionalProperties=!1:u.catchall?u.catchall&&(c.additionalProperties=bt(u.catchall,n,{...l,path:[...l.path,"additionalProperties"]})):n.io==="output"&&(c.additionalProperties=!1)},oj=(e,n,o,l)=>{const c=e._zod.def,u=c.inclusive===!1,d=c.options.map((p,g)=>bt(p,n,{...l,path:[...l.path,u?"oneOf":"anyOf",g]}));u?o.oneOf=d:o.anyOf=d},lj=(e,n,o,l)=>{const c=e._zod.def,u=bt(c.left,n,{...l,path:[...l.path,"allOf",0]}),d=bt(c.right,n,{...l,path:[...l.path,"allOf",1]}),p=h=>"allOf"in h&&Object.keys(h).length===1,g=[...p(u)?u.allOf:[u],...p(d)?d.allOf:[d]];o.allOf=g},sj=(e,n,o,l)=>{const c=o,u=e._zod.def;c.type="object";const d=u.keyType,p=d._zod.bag,g=p==null?void 0:p.patterns;if(u.mode==="loose"&&g&&g.size>0){const y=bt(u.valueType,n,{...l,path:[...l.path,"patternProperties","*"]});c.patternProperties={};for(const v of g)c.patternProperties[v.source]=y}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(c.propertyNames=bt(u.keyType,n,{...l,path:[...l.path,"propertyNames"]})),c.additionalProperties=bt(u.valueType,n,{...l,path:[...l.path,"additionalProperties"]});const h=d._zod.values;if(h){const y=[...h].filter(v=>typeof v=="string"||typeof v=="number");y.length>0&&(c.required=y)}},cj=(e,n,o,l)=>{const c=e._zod.def,u=bt(c.innerType,n,l),d=n.seen.get(e);n.target==="openapi-3.0"?(d.ref=c.innerType,o.nullable=!0):o.anyOf=[u,{type:"null"}]},uj=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType},dj=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType,o.default=JSON.parse(JSON.stringify(c.defaultValue))},fj=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType,n.io==="input"&&(o._prefault=JSON.parse(JSON.stringify(c.defaultValue)))},pj=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType;let d;try{d=c.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}o.default=d},gj=(e,n,o,l)=>{const c=e._zod.def,u=c.in._zod.traits.has("$ZodTransform"),d=n.io==="input"?u?c.out:c.in:c.out;bt(d,n,l);const p=n.seen.get(e);p.ref=d},mj=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType,o.readOnly=!0},$1=(e,n,o,l)=>{const c=e._zod.def;bt(c.innerType,n,l);const u=n.seen.get(e);u.ref=c.innerType},hj=(e,n,o,l)=>{const c=e._zod.innerType;bt(c,n,l);const u=n.seen.get(e);u.ref=c},yj=le("ZodISODateTime",(e,n)=>{g4.init(e,n),ft.init(e,n)});function vj(e){return x_(yj,e)}const $j=le("ZodISODate",(e,n)=>{m4.init(e,n),ft.init(e,n)});function bj(e){return __($j,e)}const xj=le("ZodISOTime",(e,n)=>{h4.init(e,n),ft.init(e,n)});function _j(e){return j_(xj,e)}const jj=le("ZodISODuration",(e,n)=>{y4.init(e,n),ft.init(e,n)});function Sj(e){return S_(jj,e)}const wj=(e,n)=>{Qv.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>i5(e,o)},flatten:{value:o=>r5(e,o)},addIssue:{value:o=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Af,2)}},addIssues:{value:o=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Af,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ra=le("ZodError",wj,{Parent:Error}),kj=Qf(Ra),Nj=Wf(Ra),zj=Cc(Ra),Ej=Tc(Ra),Cj=s5(Ra),Tj=c5(Ra),Mj=u5(Ra),Oj=d5(Ra),Rj=f5(Ra),Aj=p5(Ra),Dj=g5(Ra),Ij=m5(Ra),Gh=new WeakMap;function nl(e,n,o){const l=Object.getPrototypeOf(e);let c=Gh.get(l);if(c||(c=new Set,Gh.set(l,c)),!c.has(n)){c.add(n);for(const u in o){const d=o[u];Object.defineProperty(l,u,{configurable:!0,enumerable:!1,get(){const p=d.bind(this);return Object.defineProperty(this,u,{configurable:!0,writable:!0,enumerable:!0,value:p}),p},set(p){Object.defineProperty(this,u,{configurable:!0,writable:!0,enumerable:!0,value:p})}})}}}const st=le("ZodType",(e,n)=>(lt.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:Sc(e,"input"),output:Sc(e,"output")}}),e.toJSONSchema=G_(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.parse=(o,l)=>kj(e,o,l,{callee:e.parse}),e.safeParse=(o,l)=>zj(e,o,l),e.parseAsync=async(o,l)=>Nj(e,o,l,{callee:e.parseAsync}),e.safeParseAsync=async(o,l)=>Ej(e,o,l),e.spa=e.safeParseAsync,e.encode=(o,l)=>Cj(e,o,l),e.decode=(o,l)=>Tj(e,o,l),e.encodeAsync=async(o,l)=>Mj(e,o,l),e.decodeAsync=async(o,l)=>Oj(e,o,l),e.safeEncode=(o,l)=>Rj(e,o,l),e.safeDecode=(o,l)=>Aj(e,o,l),e.safeEncodeAsync=async(o,l)=>Dj(e,o,l),e.safeDecodeAsync=async(o,l)=>Ij(e,o,l),nl(e,"ZodType",{check(...o){const l=this.def;return this.clone(xr(l,{checks:[...l.checks??[],...o.map(c=>typeof c=="function"?{_zod:{check:c,def:{check:"custom"},onattach:[]}}:c)]}),{parent:!0})},with(...o){return this.check(...o)},clone(o,l){return _r(this,o,l)},brand(){return this},register(o,l){return o.add(this,l),this},refine(o,l){return this.check(TS(o,l))},superRefine(o,l){return this.check(MS(o,l))},overwrite(o){return this.check(Fi(o))},optional(){return Xh(this)},exactOptional(){return yS(this)},nullable(){return Jh(this)},nullish(){return Xh(Jh(this))},nonoptional(o){return jS(this,o)},array(){return zt(this)},or(o){return jn([this,o])},and(o){return fS(this,o)},transform(o){return Qh(this,mS(o))},default(o){return bS(this,o)},prefault(o){return _S(this,o)},catch(o){return wS(this,o)},pipe(o){return Qh(this,o)},readonly(){return zS(this)},describe(o){const l=this.clone();return Jo.add(l,{description:o}),l},meta(...o){if(o.length===0)return Jo.get(this);const l=this.clone();return Jo.add(l,o[0]),l},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(o){return o(this)}}),Object.defineProperty(e,"description",{get(){var o;return(o=Jo.get(e))==null?void 0:o.description},configurable:!0}),e)),b1=le("_ZodString",(e,n)=>{ep.init(e,n),st.init(e,n),e._zod.processJSONSchema=(l,c,u)=>Y_(e,l,c);const o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,nl(e,"_ZodString",{regex(...l){return this.check(T_(...l))},includes(...l){return this.check(R_(...l))},startsWith(...l){return this.check(A_(...l))},endsWith(...l){return this.check(D_(...l))},min(...l){return this.check(jc(...l))},max(...l){return this.check(g1(...l))},length(...l){return this.check(m1(...l))},nonempty(...l){return this.check(jc(1,...l))},lowercase(l){return this.check(M_(l))},uppercase(l){return this.check(O_(l))},trim(){return this.check(U_())},normalize(...l){return this.check(I_(...l))},toLowerCase(){return this.check(L_())},toUpperCase(){return this.check(V_())},slugify(){return this.check(B_())}})}),Uj=le("ZodString",(e,n)=>{ep.init(e,n),b1.init(e,n),e.email=o=>e.check(t_(Lj,o)),e.url=o=>e.check(p1(x1,o)),e.jwt=o=>e.check(b_(eS,o)),e.emoji=o=>e.check(o_(Vj,o)),e.guid=o=>e.check(Hh(Fh,o)),e.uuid=o=>e.check(a_(Es,o)),e.uuidv4=o=>e.check(n_(Es,o)),e.uuidv6=o=>e.check(r_(Es,o)),e.uuidv7=o=>e.check(i_(Es,o)),e.nanoid=o=>e.check(l_(Bj,o)),e.guid=o=>e.check(Hh(Fh,o)),e.cuid=o=>e.check(s_(Hj,o)),e.cuid2=o=>e.check(c_(qj,o)),e.ulid=o=>e.check(u_(Pj,o)),e.base64=o=>e.check(y_(Jj,o)),e.base64url=o=>e.check(v_(Qj,o)),e.xid=o=>e.check(d_(Zj,o)),e.ksuid=o=>e.check(f_(Gj,o)),e.ipv4=o=>e.check(p_(Fj,o)),e.ipv6=o=>e.check(g_(Yj,o)),e.cidrv4=o=>e.check(m_(Kj,o)),e.cidrv6=o=>e.check(h_(Xj,o)),e.e164=o=>e.check($_(Wj,o)),e.datetime=o=>e.check(vj(o)),e.date=o=>e.check(bj(o)),e.time=o=>e.check(_j(o)),e.duration=o=>e.check(Sj(o))});function Z(e){return e_(Uj,e)}const ft=le("ZodStringFormat",(e,n)=>{dt.init(e,n),b1.init(e,n)}),Lj=le("ZodEmail",(e,n)=>{i4.init(e,n),ft.init(e,n)}),Fh=le("ZodGUID",(e,n)=>{n4.init(e,n),ft.init(e,n)}),Es=le("ZodUUID",(e,n)=>{r4.init(e,n),ft.init(e,n)}),x1=le("ZodURL",(e,n)=>{o4.init(e,n),ft.init(e,n)});function Cs(e){return p1(x1,e)}const Vj=le("ZodEmoji",(e,n)=>{l4.init(e,n),ft.init(e,n)}),Bj=le("ZodNanoID",(e,n)=>{s4.init(e,n),ft.init(e,n)}),Hj=le("ZodCUID",(e,n)=>{c4.init(e,n),ft.init(e,n)}),qj=le("ZodCUID2",(e,n)=>{u4.init(e,n),ft.init(e,n)}),Pj=le("ZodULID",(e,n)=>{d4.init(e,n),ft.init(e,n)}),Zj=le("ZodXID",(e,n)=>{f4.init(e,n),ft.init(e,n)}),Gj=le("ZodKSUID",(e,n)=>{p4.init(e,n),ft.init(e,n)}),Fj=le("ZodIPv4",(e,n)=>{v4.init(e,n),ft.init(e,n)}),Yj=le("ZodIPv6",(e,n)=>{$4.init(e,n),ft.init(e,n)}),Kj=le("ZodCIDRv4",(e,n)=>{b4.init(e,n),ft.init(e,n)}),Xj=le("ZodCIDRv6",(e,n)=>{x4.init(e,n),ft.init(e,n)}),Jj=le("ZodBase64",(e,n)=>{_4.init(e,n),ft.init(e,n)}),Qj=le("ZodBase64URL",(e,n)=>{S4.init(e,n),ft.init(e,n)}),Wj=le("ZodE164",(e,n)=>{w4.init(e,n),ft.init(e,n)}),eS=le("ZodJWT",(e,n)=>{N4.init(e,n),ft.init(e,n)}),_1=le("ZodNumber",(e,n)=>{s1.init(e,n),st.init(e,n),e._zod.processJSONSchema=(l,c,u)=>K_(e,l,c),nl(e,"ZodNumber",{gt(l,c){return this.check(Ph(l,c))},gte(l,c){return this.check(mf(l,c))},min(l,c){return this.check(mf(l,c))},lt(l,c){return this.check(qh(l,c))},lte(l,c){return this.check(gf(l,c))},max(l,c){return this.check(gf(l,c))},int(l){return this.check(Yh(l))},safe(l){return this.check(Yh(l))},positive(l){return this.check(Ph(0,l))},nonnegative(l){return this.check(mf(0,l))},negative(l){return this.check(qh(0,l))},nonpositive(l){return this.check(gf(0,l))},multipleOf(l,c){return this.check(Zh(l,c))},step(l,c){return this.check(Zh(l,c))},finite(){return this}});const o=e._zod.bag;e.minValue=Math.max(o.minimum??Number.NEGATIVE_INFINITY,o.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(o.maximum??Number.POSITIVE_INFINITY,o.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??.5),e.isFinite=!0,e.format=o.format??null});function it(e){return w_(_1,e)}const tS=le("ZodNumberFormat",(e,n)=>{z4.init(e,n),_1.init(e,n)});function Yh(e){return k_(tS,e)}const aS=le("ZodBoolean",(e,n)=>{E4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>X_(e,o,l)});function Ft(e){return N_(aS,e)}const nS=le("ZodNull",(e,n)=>{C4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>J_(e,o,l)});function rS(e){return z_(nS,e)}const iS=le("ZodUnknown",(e,n)=>{T4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>W_()});function $r(){return E_(iS)}const oS=le("ZodNever",(e,n)=>{M4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>Q_(e,o,l)});function lS(e){return C_(oS,e)}const sS=le("ZodArray",(e,n)=>{O4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>rj(e,o,l,c),e.element=n.element,nl(e,"ZodArray",{min(o,l){return this.check(jc(o,l))},nonempty(o){return this.check(jc(1,o))},max(o,l){return this.check(g1(o,l))},length(o,l){return this.check(m1(o,l))},unwrap(){return this.element}})});function zt(e,n){return H_(sS,e,n)}const cS=le("ZodObject",(e,n)=>{A4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>ij(e,o,l,c),He(e,"shape",()=>n.shape),nl(e,"ZodObject",{keyof(){return ut(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:$r()})},loose(){return this.clone({...this._zod.def,catchall:$r()})},strict(){return this.clone({...this._zod.def,catchall:lS()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return Qx(this,o)},safeExtend(o){return Wx(this,o)},merge(o){return e5(this,o)},pick(o){return Xx(this,o)},omit(o){return Jx(this,o)},partial(...o){return t5(S1,this,o[0])},required(...o){return a5(w1,this,o[0])}})});function fe(e,n){const o={type:"object",shape:e??{},...xe(n)};return new cS(o)}const j1=le("ZodUnion",(e,n)=>{d1.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>oj(e,o,l,c),e.options=n.options});function jn(e,n){return new j1({type:"union",options:e,...xe(n)})}const uS=le("ZodDiscriminatedUnion",(e,n)=>{j1.init(e,n),D4.init(e,n)});function rl(e,n,o){return new uS({type:"union",options:n,discriminator:e,...xe(o)})}const dS=le("ZodIntersection",(e,n)=>{I4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>lj(e,o,l,c)});function fS(e,n){return new dS({type:"intersection",left:e,right:n})}const Kh=le("ZodRecord",(e,n)=>{U4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>sj(e,o,l,c),e.keyType=n.keyType,e.valueType=n.valueType});function xt(e,n,o){return!n||!n._zod?new Kh({type:"record",keyType:Z(),valueType:e,...xe(n)}):new Kh({type:"record",keyType:e,valueType:n,...xe(o)})}const If=le("ZodEnum",(e,n)=>{L4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(l,c,u)=>ej(e,l,c),e.enum=n.entries,e.options=Object.values(n.entries);const o=new Set(Object.keys(n.entries));e.extract=(l,c)=>{const u={};for(const d of l)if(o.has(d))u[d]=n.entries[d];else throw new Error(`Key ${d} not found in enum`);return new If({...n,checks:[],...xe(c),entries:u})},e.exclude=(l,c)=>{const u={...n.entries};for(const d of l)if(o.has(d))delete u[d];else throw new Error(`Key ${d} not found in enum`);return new If({...n,checks:[],...xe(c),entries:u})}});function ut(e,n){const o=Array.isArray(e)?Object.fromEntries(e.map(l=>[l,l])):e;return new If({type:"enum",entries:o,...xe(n)})}const pS=le("ZodLiteral",(e,n)=>{V4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>tj(e,o,l),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Oe(e,n){return new pS({type:"literal",values:Array.isArray(e)?e:[e],...xe(n)})}const gS=le("ZodTransform",(e,n)=>{B4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>nj(e,o),e._zod.parse=(o,l)=>{if(l.direction==="backward")throw new Fv(e.constructor.name);o.addIssue=u=>{if(typeof u=="string")o.issues.push(Wo(u,o.value,n));else{const d=u;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=o.value),d.inst??(d.inst=e),o.issues.push(Wo(d))}};const c=n.transform(o.value,o);return c instanceof Promise?c.then(u=>(o.value=u,o.fallback=!0,o)):(o.value=c,o.fallback=!0,o)}});function mS(e){return new gS({type:"transform",transform:e})}const S1=le("ZodOptional",(e,n)=>{f1.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>$1(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function Xh(e){return new S1({type:"optional",innerType:e})}const hS=le("ZodExactOptional",(e,n)=>{H4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>$1(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function yS(e){return new hS({type:"optional",innerType:e})}const vS=le("ZodNullable",(e,n)=>{q4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>cj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function Jh(e){return new vS({type:"nullable",innerType:e})}const $S=le("ZodDefault",(e,n)=>{P4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>dj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bS(e,n){return new $S({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():Xv(n)}})}const xS=le("ZodPrefault",(e,n)=>{Z4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>fj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function _S(e,n){return new xS({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():Xv(n)}})}const w1=le("ZodNonOptional",(e,n)=>{G4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>uj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function jS(e,n){return new w1({type:"nonoptional",innerType:e,...xe(n)})}const SS=le("ZodCatch",(e,n)=>{F4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>pj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wS(e,n){return new SS({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const kS=le("ZodPipe",(e,n)=>{Y4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>gj(e,o,l,c),e.in=n.in,e.out=n.out});function Qh(e,n){return new kS({type:"pipe",in:e,out:n})}const NS=le("ZodReadonly",(e,n)=>{K4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>mj(e,o,l,c),e.unwrap=()=>e._zod.def.innerType});function zS(e){return new NS({type:"readonly",innerType:e})}const ES=le("ZodLazy",(e,n)=>{X4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>hj(e,o,l,c),e.unwrap=()=>e._zod.def.getter()});function k1(e){return new ES({type:"lazy",getter:e})}const CS=le("ZodCustom",(e,n)=>{J4.init(e,n),st.init(e,n),e._zod.processJSONSchema=(o,l,c)=>aj(e,o)});function TS(e,n={}){return q_(CS,e,n)}function MS(e,n){return P_(e,n)}const N1="@ggui-ai/gadgets",OS="0.6.2",RS=[{package:N1,version:OS,exports:[{hook:"useCamera",permission:"camera",description:"Capture stills or live video from the device camera.",usage:"Mount when the intent names photo capture, QR / barcode scanning, video recording, or anything that requires a camera feed. The hook returns a stream once `start()` resolves; thread the resulting blob or stream URL into a contextSpec slot or an actionSpec payload to surface it to the agent.",example:{call:"const cam = useCamera({ facingMode: 'environment' }); // on button click: await cam.start()",returns:{status:"completed",value:{dataUrl:"data:image/png;base64,…",width:640,height:480,mimeType:"image/png"}}}},{hook:"useClipboardPaste",permission:"clipboard-read",description:"Read the system clipboard contents on user gesture.",usage:"Mount when the intent involves importing copied content (paste-into-form, paste-image-to-upload, paste-link). The Permissions API requires a user gesture; gate `start()` behind a button click. Returned value lands in a contextSpec slot or an actionSpec payload.",example:{call:"const paste = useClipboardPaste(); // on button click: await paste.start()",returns:{status:"completed",value:"pasted clipboard text"}}},{hook:"useClipboardWrite",permission:"clipboard-write",description:"Write to the system clipboard on user gesture.",usage:"Mount when the intent includes copying generated text, share links, codes, or transcripts to the system clipboard. Fire an actionSpec event so the agent observes the act (it does not see the written value — that stays component-local).",example:{call:"const write = useClipboardWrite({ text: 'hello' }); // on button click: await write.start()",returns:{status:"completed",value:"hello"}}},{hook:"useFilePicker",description:"Open the native file picker and read selected files.",usage:"Mount when the intent names file upload, attachment selection, or document import. No permission required. The hook returns the picked files plus metadata; thread file refs / data URLs into a contextSpec slot or actionSpec payload.",example:{call:"const picker = useFilePicker({ accept: 'image/*' }); // on button click: await picker.start()",returns:{status:"completed",value:{files:[{name:"photo.png",type:"image/png",size:12345,_file:"<File>"}]}}}},{hook:"useGeolocation",permission:"geolocation",description:"Resolve the device's current geolocation.",usage:'Mount when the intent names "current location", maps, nearby search, location-aware UI. Browser prompts the user on `start()`; the hook returns coordinates once granted. Thread the resolved coords into a contextSpec slot so the agent observes the latest fix.',example:{call:"const geo = useGeolocation(); // on button click: await geo.start()",returns:{status:"completed",value:{latitude:37.7749,longitude:-122.4194,accuracy:20,timestamp:1718e9}}}},{hook:"useMicrophone",permission:"microphone",description:"Capture audio from the device microphone.",usage:"Mount when the intent names voice memos, audio messages, dictation, voice-driven UI. Returns an audio stream / blob; thread it into an actionSpec payload at recording-stop, or into a contextSpec slot for live transcription pipelines.",example:{call:"const mic = useMicrophone(); // record on click: await mic.start(); end with mic.stop()",returns:{status:"completed",value:{blob:"<Blob>",durationMs:4200,mimeType:"audio/webm"}}}},{hook:"useNotifications",permission:"notifications",description:"Show system / browser notifications to the user.",usage:"Mount when the intent involves alerting the user about something (reminders, completion of long tasks, incoming messages) and the UI may be in the background. Permission is prompted on first `start()`; the agent does NOT see notification dismissal directly — surface it via an actionSpec if needed.",example:{call:"const notify = useNotifications({ title: 'Done' }); // after the task completes: await notify.start()",returns:{status:"completed",value:{outcome:"closed"}}}}]}];Object.freeze(new Set(RS.flatMap(e=>e.exports).map(e=>e.hook).filter(e=>e!==void 0)));const tp=/^use[A-Z][A-Za-z0-9]*$/,ap=/^[A-Z][A-Za-z0-9]*$/,np=["geolocation","notifications","microphone","camera","persistent-storage","midi","clipboard-read","clipboard-write","speaker-selection","storage-access","background-sync","accelerometer","gyroscope","magnetometer","ambient-light-sensor","screen-wake-lock"];new Set(np);const mt=k1(()=>jn([Z(),it(),Ft(),rS(),zt(mt),xt(Z(),mt)])),bn=k1(()=>fe({type:ut(["string","number","integer","boolean","array","object","null"]).optional(),description:Z().optional(),enum:zt(mt).optional(),default:mt.optional(),example:mt.optional(),items:bn.optional(),properties:xt(Z(),bn).optional(),required:zt(Z()).optional(),additionalProperties:jn([bn,Ft()]).optional(),format:Z().optional()}).passthrough()),AS=fe({description:Z().optional(),schema:bn,required:Ft().optional(),default:mt.optional(),example:mt.optional(),sourceTool:Z().optional()}).strict(),DS=fe({description:Z().optional(),properties:xt(Z(),AS)}).strict(),IS=fe({description:Z().optional(),label:Z(),schema:bn.optional(),example:mt.optional(),icon:Z().optional(),confirm:Ft().optional(),nextStep:Z().min(1).optional()}).strict(),US=xt(Z(),IS),LS=fe({description:Z().optional(),schema:bn,example:mt.optional(),mode:ut(["append","replace"]).optional(),replay:ut(["latest","all","none"]).optional(),complete:Ft().optional(),source:fe({tool:Z(),args:xt(Z(),mt).optional()}).strict().optional()}).strict(),VS=xt(Z(),LS),BS=fe({description:Z().optional(),schema:bn,default:mt.optional(),debounceMs:it().int().nonnegative().optional(),example:mt.optional()}).strict(),HS=xt(Z(),BS),qS=fe({serverInfo:fe({name:Z(),version:Z().optional()}).strict().optional(),toolInfo:fe({inputSchema:bn,description:Z().optional(),outputSchema:bn.optional()}).strict(),usage:Z().optional(),example:fe({input:mt,output:mt}).strict().optional()}).strict(),PS=fe({tools:xt(Z(),qS)}).passthrough(),z1=/^GGUI_PUBLIC_APP_[A-Z0-9_]+$/,ZS=zt(Z().regex(z1)).readonly(),Wh=/^sha384-[A-Za-z0-9+/]+=*$/,E1=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,GS=/^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/,FS=/^[a-z0-9.-]+(:\d+)?$/,C1={gotchas:Z().optional()},ey={...C1,description:Z().optional(),usage:Z().optional(),example:mt.optional(),permission:Z().optional()},ty={...C1,description:Z().min(1),usage:Z().min(1),example:mt,permission:ut(np).optional()},T1={version:Z().regex(GS),package:Z().regex(E1),bundleUrl:Cs().optional(),bundleHost:Z().regex(FS).optional(),bundleSri:Z().regex(Wh).optional(),styleUrl:Cs().optional(),connect:zt(Cs()).readonly().optional(),requires:ZS.optional(),typesUrl:Cs().optional(),typesSri:Z().regex(Wh).optional()},YS=jn([fe({hook:Z().regex(tp),...ey}).strict(),fe({component:Z().regex(ap),...ey}).strict()]),KS=jn([fe({hook:Z().regex(tp),...ty}).strict(),fe({component:Z().regex(ap),...ty}).strict()]);fe({...T1,exports:zt(YS).min(1)}).strict();const XS=fe({...T1,exports:zt(KS).min(1)}).strict();XS.refine(e=>e.package===N1||typeof e.typesUrl=="string",{message:"registered GadgetDescriptor MUST declare a `typesUrl` (HTTPS URL to the package's .d.ts) — the code-gen sandbox loads it to typecheck generated component code against the export signatures. Run `tsup --dts` (or `tsc --declaration`) in the wrapper build and publish the emitted .d.ts. Only the first-party `@ggui-ai/gadgets` stdlib is exempt.",path:["typesUrl"]});const JS=fe({description:Z().optional(),usage:Z().optional()}).strict(),QS=xt(Z().refine(e=>tp.test(e)||ap.test(e),{message:"gadget export name must be a `use`-prefixed hook or a PascalCase component identifier"}),JS).refine(e=>Object.keys(e).length>0,{message:"a `clientCapabilities.gadgets` package entry must declare at least one export"}),WS=fe({gadgets:xt(Z().regex(E1),QS)}).strict();xt(Z().regex(z1),Z()).readonly();const il=fe({propsSpec:DS.optional(),actionSpec:US.optional(),streamSpec:VS.optional(),contextSpec:HS.optional(),agentCapabilities:PS.optional(),clientCapabilities:WS.optional()}).passthrough(),M1=fe({kind:Oe("llm"),generator:Z().min(1),model:Z().min(1)}).strict(),O1=fe({kind:Oe("user")}).strict(),e3=fe({kind:Oe("curated")}).strict(),R1=jn([M1,O1,e3]),Oc=fe({persona:Z().optional().describe('Design persona, e.g. "minimalist" / "data-dense". Part of cache identity.'),aesthetic:Z().optional().describe('Visual aesthetic, e.g. "calm" / "ornate". Part of cache identity.'),context:xt(Z(),mt).optional().describe('Deliberate design-shaping signals (e.g. {situation:"sad"}) — part of cache identity. NOT for per-user runtime data; put that in propsSpec/contextSpec.'),seedPrompt:Z().optional().describe("Generation seed directive. Part of cache identity.")}).strict(),t3=fe({blueprintId:Z().min(1),contractHash:Z().min(1),appId:Z().min(1),codeS3Url:Z().optional(),codeHash:Z().optional(),source:R1,validatorScore:it().min(0).max(1).optional(),variance:Oc,isOperatorDefault:Oe(!0).optional(),createdAt:Z().min(1),createdBy:ut(["agent","operator"]),contract:il,contractEmbedding:zt(it()).optional()}).strict(),a3=fe({hash:it().min(0).optional(),embed:it().min(0).optional(),struct:it().min(0).optional(),variance:it().min(0).optional(),intent:it().min(0).optional()}).strict();fe({weights:a3.optional(),threshold:it().min(0).max(1).optional(),topK:it().int().min(1).optional()}).strict();const n3=ut(["cache","agent","synth"]),r3=jn([fe({op:Oe("add"),path:Z(),value:mt}).strict(),fe({op:Oe("remove"),path:Z()}).strict(),fe({op:Oe("replace"),path:Z(),value:mt}).strict()]),i3=zt(r3),o3=fe({contract:il,variance:fe({persona:Z().optional(),aesthetic:Z().optional(),context:xt(Z(),mt).optional(),seedPrompt:Z().optional()}).strict().optional(),generator:Z().optional()}).strict(),l3=o3,s3=fe({blueprintId:Z().min(1).optional(),contractHash:Z().min(1),codeHash:Z().optional(),source:R1.optional(),variance:Oc,selectedReason:Z().optional()}).strict(),c3=fe({code:Z().min(1),severity:ut(["error","warn"]),path:Z(),message:Z()}).strict(),u3=fe({contractDiff:i3,reasoning:Z()}).strict(),d3=fe({origin:n3,rationale:Z(),blueprintMeta:s3,proposedContractSummary:Z().optional(),amendments:u3.optional(),validationFindings:zt(c3).optional()}).strict(),f3=fe({width:it(),height:it()}),p3=fe({viewport:f3,platform:ut(["web","mobile","desktop"]),deviceType:ut(["phone","tablet","desktop"]),orientation:ut(["portrait","landscape"]),devicePixelRatio:it().optional(),touchPrimary:Ft().optional(),shellType:ut(["chat","fullscreen","spatial"]).optional(),colorScheme:ut(["light","dark"]).optional(),reducedMotion:Ft().optional()}).passthrough(),g3={sessionId:Z().min(1).describe("Globally-unique sessionId to consume events from. Cross-tenant access surfaces uniformly as session_not_found."),timeout:it().int().min(0).max(25).optional().describe("Inline long-poll seconds, integer in [0, 25]. 0 = immediate. Values outside the bound reject INVALID_PARAMS. Returns on first event OR timeout; re-call on empty to keep waiting — longer waits are your loop, not a bigger timeout.")};fe(g3);const m3={sessionId:Z().min(1),channel:Z().min(1),payload:$r(),complete:Ft().optional()};fe(m3);const h3={sessionId:Z().min(1).describe("GguiSession opaque id (UUID) — returned by ggui_render.")};fe(h3);const y3={};fe(y3);const v3={query:Z().min(1).describe("Natural-language description of the UI you're looking for"),limit:it().int().min(1).max(100).optional()};fe(v3);const $3={blueprintId:Z().min(1).describe("The stable blueprint id declared via ggui.ui.json#id. Must match an entry in this server's UI registry.")};fe($3);const b3={};fe(b3);const x3={serviceId:Z().min(1),reason:Z().optional(),sessionId:Z().optional()};fe(x3);fe({intent:Z().min(1).describe('Concise purpose — same intent = same component reused. e.g. "Gmail inbox for email triage"'),blueprintDraft:l3.describe("Agent's draft: contract (required) + optional variance + optional generator slug hint. The server combines this with cached blueprints + validator outcomes to produce a three-mode suggestion (cache / agent / synth)."),forceCreate:Ft().optional()}).strict();fe({handshakeId:Z().describe("Stable id — pass to ggui_render / ggui_update"),action:ut(["create","reuse","update","replace","declined"]),suggestion:d3.describe("Server's suggestion — origin-routed (cache | agent | synth). Always carries a provisional `blueprintMeta` the agent reuses by rendering WITHOUT `override` (accept the proposal as-is)."),reason:Z().max(280).optional().describe("Short rationale (≤280 chars) for the `action` value. Surfaced for agent + operator visibility; truncated to keep the structuredContent payload predictable."),nextStep:fe({tool:Oe("ggui_render"),description:Z(),example:Z()}).optional().describe("Wire-shape recovery hint. A worked literal example of the next ggui_render call the agent should emit — the example string can be copied verbatim and tweaked (e.g. fill in `props` placeholders). Top-level field so a skimming agent finds it immediately.")});const _3={handshakeId:Z({message:"ggui_render: handshakeId is REQUIRED. Call ggui_handshake({intent, blueprintDraft}) first to negotiate — handshake returns a handshakeId + suggestion. Then render with {handshakeId, props} (accept the suggestion as-is) or {handshakeId, props, override: {contract?, variance?}} (re-aim the contract and/or variance). Direct-render without a handshakeId is not supported."}).min(1,"ggui_render: handshakeId must be a non-empty string from a prior ggui_handshake call."),props:xt(Z(),$r()),themeId:Z().min(1).optional().describe("Per-render theme override. Wins over App.defaultThemeId for THIS render. Omit to inherit the app theme."),infra:fe({model:Z().min(1).optional().describe("Provider-prefixed model id (e.g., `anthropic/claude-haiku-4-5`, `openai/gpt-5`). Generator-specific prefixes (e.g., `bedrock/...` for AWS Bedrock routing) supported when the bound generator handles them.")}).strict().optional(),override:fe({contract:il.optional().describe("STRICT full re-draft of the contract — must already conform; the server will not repair it."),variance:Oc.optional().describe("Re-aim the variant (persona/aesthetic/context/seedPrompt); keeps the agreed contract.")}).strict().refine(e=>e.contract!==void 0||e.variance!==void 0,{message:"override must set contract and/or variance — omit override entirely to ACCEPT the handshake proposal as-is."}).optional().describe("Omit to ACCEPT the proposal as-is. Provide to re-aim contract and/or variance (PATCH semantics).")};fe(_3);const j3=fe({hit:Ft().describe("True when a stored component was served without generating new code."),similarity:it().optional().describe("Cosine similarity of the matched component to the request (semantic match only)."),cachedBlueprintId:Z().optional().describe("The stored component id that was matched. Equals top-level blueprintId on a hit."),llmCallsAvoided:it().describe("Generation calls skipped by serving the stored component (0 on a fresh generation)."),kind:ut(["full-template","cold"]).optional().describe("full-template = a whole stored component was served; cold = freshly generated."),reason:Z().optional().describe("Compact human-readable explanation of the cache outcome — why this render reused a stored component or generated cold. Diagnostic; default-available without the verbose env-gated trace.")}),S3=ut(["PRODUCTION_FAILED","VALIDATION_ERROR","NO_PLATFORM_KEY","NO_CREDENTIALS"]),w3=fe({code:S3.describe("Canonical failure class. PRODUCTION_FAILED: generation did not produce a component. VALIDATION_ERROR: a server-side precondition rejected the render before generation. NO_PLATFORM_KEY: the server's managed provider-key configuration has no key for the resolved route. NO_CREDENTIALS: no generation credentials are configured on the server."),message:Z().describe("Human-readable failure detail — fold into the next attempt or surface to the operator.")});fe({sessionId:Z(),resourceUri:Z().optional().describe("MCP-Apps mount URI (ui://ggui/render/{id}). Present iff the render is mountable; absent on a failed render."),action:ut(["create","reuse","update","replace","declined"]),contractHash:Z().describe("Canonical hash of the rendered data contract (shape only — fields, types, specs). Same hash ⟺ same data flow."),blueprintId:Z().describe("Opaque id of the materialised component for this render. On the handshake-decided reuse paths (accept a cache-origin proposal, or a variance re-aim that resolves to an existing variant) it is the stored id — equal ids across renders mean the same stored component. override.contract always generates cold and mints a fresh id, even for an identical contract."),variantKey:Z().describe("Canonical hash of the design-time variance (persona, aesthetic, seed prompt, context). With contractHash it forms the reuse key: the same pair reuses one component; a different variant of the same contract gets its own."),cache:j3.describe("Reuse outcome for this render: whether a stored component was served, its similarity, the matched component id, and how many generation calls that avoided."),error:w3.optional().describe("Present iff the tool result is isError — canonical {code, message} for a failed/rejected generation. Absent on success."),nextStep:fe({tool:Oe("ggui_consume"),description:Z(),example:Z(),args:fe({sessionId:Z()})}).optional().describe("Recovery hint — when the rendered contract has actions, points the agent at ggui_consume({sessionId}) for the inbound action loop. Absent for pure-display renders.")});rl("kind",[fe({sessionId:Z().describe("GguiSession opaque id (UUID) — returned by ggui_render."),kind:Oe("replace"),props:xt(Z(),$r()).describe("Full replacement props map. New map IS the new state.")}).strict(),fe({sessionId:Z().describe("GguiSession opaque id (UUID) — returned by ggui_render."),kind:Oe("merge"),patch:xt(Z(),$r()).describe("RFC 7396 JSON Merge Patch — null deletes a key; arrays fully replace.")}).strict()]);fe({sessionId:Z(),updated:Ft(),resourceUri:Z()});fe({toolCatalog:xt(Z(),fe({name:Z(),version:Z().optional()}).strict()).describe("Per-app canonical tool identities: bare tool name -> its server's initialize-declared serverInfo. Host/library-supplied; not an agent action.")}).strict();fe({saved:Ft(),appId:Z()}).strict();const k3=fe({type:Oe("text"),text:Z()}),N3=fe({type:Oe("tool_use"),id:Z(),name:Z(),input:xt(Z(),$r())}),z3=fe({type:Oe("tool_result"),tool_use_id:Z(),content:$r(),is_error:Ft().optional()}),A1=rl("type",[k3,N3,z3]),E3=fe({type:Oe("text_delta"),text:Z()}),C3=fe({type:Oe("input_json_delta"),partial_json:Z()}),T3=rl("type",[E3,C3]),M3=fe({type:Oe("message_start"),message:fe({id:Z(),role:Oe("assistant"),model:Z().optional()})}),O3=fe({type:Oe("content_block_start"),index:it().int().nonnegative(),content_block:A1}),R3=fe({type:Oe("content_block_delta"),index:it().int().nonnegative(),delta:T3}),A3=fe({type:Oe("content_block_stop"),index:it().int().nonnegative()}),D3=fe({type:Oe("message_delta"),delta:fe({stop_reason:ut(["end_turn","max_tokens","tool_use","error"]),stop_sequence:Z().nullable().optional()}),usage:fe({input_tokens:it().int().nonnegative(),output_tokens:it().int().nonnegative()})}),I3=fe({type:Oe("message_stop")}),U3=fe({type:Oe("ping")}),L3=ut(["invalid_request","unauthorized","rate_limited","invoke_in_progress","upstream_error","tool_error","internal"]),V3=fe({type:Oe("error"),error:fe({code:L3,message:Z(),retryAfterMs:it().int().nonnegative().optional()})});rl("type",[M3,O3,R3,A3,D3,I3,U3,V3]);const B3=fe({role:ut(["user","assistant"]),content:jn([Z(),zt(A1)])});fe({message:Z(),history:zt(B3).optional(),interfaceContext:p3.optional(),requestId:Z().optional()});const H3=/^--ggui-[a-zA-Z0-9-]+$/,q3=/^[^;{}<>@]*$/,P3=Z().min(1).max(256).regex(q3,"css value contains a disallowed character").refine(e=>!e.includes("/*"),"css value may not contain a comment");fe({mode:ut(["light","dark"]),cssVariables:xt(Z().regex(H3,"css var key must be --ggui-*"),P3).refine(e=>Object.keys(e).length<=200,"too many css variables (max 200)"),name:Z().min(1).max(64).optional()}).strict();fe({contract:il,generator:Z().min(1).optional().describe("Generator slug (e.g. `ui-gen-default-haiku-4-5`). When omitted, dispatches through `GeneratorRegistry.defaultGenerator()`."),persona:Z().optional().describe("Free-form persona tag (e.g. 'minimalist', 'data-dense'). Normalized via lowercase+trim before persistence; logged as a warning when within Levenshtein distance < 2 of an existing tag for the same appId."),aesthetic:Z().optional().describe("Free-form aesthetic tag (e.g. 'glassmorphic', 'brutalist', 'editorial'). Persisted on `Blueprint.variance.aesthetic`. Distinct from persona — persona names the user mental model; aesthetic names the visual treatment."),context:xt(Z(),mt).optional().describe("Small structured signal carried alongside the persona. Persisted on `Blueprint.variance.context`."),seedPrompt:Z().optional().describe("The raw operator prompt that produced this variant. Round-trip input for the variant-selector + audit trail."),setAsOperatorDefault:Ft().optional().describe("When true, pins the new blueprint as the operator default for its `(appId, contractHash)` group, clearing any prior default in the same group.")}).strict();fe({blueprintId:Z().min(1),codeHash:Z().optional().describe("Content hash of the generated code body. Absent when the generator returned a non-`ok` result and persistence skipped — the failure mode is surfaced through generator-level error reporting elsewhere."),validatorScore:it().min(0).max(1).optional().describe("Advanced generator's iterative-loop validator score (0-1). Absent for default-generator output."),source:M1.describe("Provenance stamped on the persisted `Blueprint.source` — always the `llm` arm on this path: `generator` is the engine slug the dispatch resolved to (stamped from the engine's own metadata claim); `model` is the LLM model id the engine called.")}).strict();fe({contract:il,componentCode:Z().min(1).describe("Verbatim component-code body to persist. Stored as-is — no LLM call, no validator pass. Operator owns correctness; the handler computes the canonical sha256 codeHash and routes the bytes through the same persistence seams as `*_generate_*`."),persona:Z().optional().describe("Free-form persona tag (e.g. 'minimalist', 'data-dense'). Normalized via lowercase+trim before persistence; logged as a warning when within Levenshtein distance < 2 of an existing tag for the same appId."),aesthetic:Z().optional().describe("Free-form aesthetic tag. Persisted on `Blueprint.variance.aesthetic`."),context:xt(Z(),mt).optional().describe("Small structured signal carried alongside the persona. Persisted on `Blueprint.variance.context`."),seedPrompt:Z().optional().describe("Optional originating prompt for audit + round-tripping (e.g. the prose the operator originally fed into `*_generate_*` before exporting)."),setAsOperatorDefault:Ft().optional().describe("When true, pins the new blueprint as the operator default for its `(appId, contractHash)` group, clearing any prior default in the same group.")}).strict();fe({blueprintId:Z().min(1),codeHash:Z().min(1).describe("Content hash of the persisted code body (full sha256 hex)."),source:O1.describe('Provenance stamped on the persisted `Blueprint.source` — always `{kind: "user"}` on this path: operator-supplied bytes, no LLM dispatch, no engine claim to record.')}).strict();fe({contractHash:Z().min(1).optional().describe("Filter to a single `(appId, contractHash)` group. Combine with `generator` / `persona` to narrow within the group."),generator:Z().min(1).optional().describe('Filter to engine-generated blueprints (`source.kind === "llm"`) whose `source.generator` equals this slug. `user`-sourced rows never match (they carry no engine provenance).'),persona:Z().optional().describe("Filter on `variance.persona`. Normalized to match persisted form (lowercase+trim)."),intentKeywords:zt(Z().min(1)).optional().describe("Semantic-search tokens. When set, dispatches through `BlueprintSearch.search()` rather than indexed `list()`.")}).strict();fe({blueprints:zt(t3)}).strict();fe({blueprintId:Z().min(1),isOperatorDefault:Oe(!0).optional().describe("When `true`, pins this blueprint as the operator default for its `(appId, contractHash)` group. Clears any prior default. Cannot set to `false` — to unpin, set another blueprint in the same group as default, or delete this one."),variance:Oc.optional().describe('Partial-merge into the existing variance. Supplied keys overwrite; omitted keys preserve. Pass `{persona: ""}` to clear a persona (handler treats empty string as removal).')}).strict();fe({blueprintId:Z().min(1),updatedAt:Z().min(1)}).strict();fe({blueprintId:Z().min(1)}).strict();fe({deleted:Oe(!0)}).strict();function Z3(e){return"schemaVersion"in e?e.schemaVersion:qx}function G3(e){const n={sessionId:e.sessionId,type:e.type};e.payload!==void 0&&(n.payload=e.payload),e.clientSeq!==void 0&&(n.clientSeq=e.clientSeq);const o=Z3(e);return o!==void 0&&(n.schemaVersion=o),n}var Ts={exports:{}},hf={},hn={},qr={},yf={},vf={},$f={},ay;function wc(){return ay||(ay=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class n{}e._CodeOrName=n,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class o extends n{constructor($){if(super(),!e.IDENTIFIER.test($))throw new Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=o;class l extends n{constructor($){super(),this._items=typeof $=="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((N,R)=>`${N}${R}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((N,R)=>(R instanceof o&&(N[R.str]=(N[R.str]||0)+1),N),{})}}e._Code=l,e.nil=new l("");function c(w,...$){const N=[w[0]];let R=0;for(;R<$.length;)p(N,$[R]),N.push(w[++R]);return new l(N)}e._=c;const u=new l("+");function d(w,...$){const N=[k(w[0])];let R=0;for(;R<$.length;)N.push(u),p(N,$[R]),N.push(u,k(w[++R]));return g(N),new l(N)}e.str=d;function p(w,$){$ instanceof l?w.push(...$._items):$ instanceof o?w.push($):w.push(v($))}e.addCodeArg=p;function g(w){let $=1;for(;$<w.length-1;){if(w[$]===u){const N=h(w[$-1],w[$+1]);if(N!==void 0){w.splice($-1,3,N);continue}w[$++]="+"}$++}}function h(w,$){if($==='""')return w;if(w==='""')return $;if(typeof w=="string")return $ instanceof o||w[w.length-1]!=='"'?void 0:typeof $!="string"?`${w.slice(0,-1)}${$}"`:$[0]==='"'?w.slice(0,-1)+$.slice(1):void 0;if(typeof $=="string"&&$[0]==='"'&&!(w instanceof o))return`"${w}${$.slice(1)}`}function y(w,$){return $.emptyStr()?w:w.emptyStr()?$:d`${w}${$}`}e.strConcat=y;function v(w){return typeof w=="number"||typeof w=="boolean"||w===null?w:k(Array.isArray(w)?w.join(","):w)}function j(w){return new l(k(w))}e.stringify=j;function k(w){return JSON.stringify(w).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=k;function x(w){return typeof w=="string"&&e.IDENTIFIER.test(w)?new l(`.${w}`):c`[${w}]`}e.getProperty=x;function E(w){if(typeof w=="string"&&e.IDENTIFIER.test(w))return new l(`${w}`);throw new Error(`CodeGen: invalid export name: ${w}, use explicit $id name mapping`)}e.getEsmExportName=E;function z(w){return new l(w.toString())}e.regexpCode=z})($f)),$f}var bf={},ny;function ry(){return ny||(ny=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const n=wc();class o extends Error{constructor(h){super(`CodeGen: "code" for ${h} not defined`),this.value=h.value}}var l;(function(g){g[g.Started=0]="Started",g[g.Completed=1]="Completed"})(l||(e.UsedValueState=l={})),e.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class c{constructor({prefixes:h,parent:y}={}){this._names={},this._prefixes=h,this._parent=y}toName(h){return h instanceof n.Name?h:this.name(h)}name(h){return new n.Name(this._newName(h))}_newName(h){const y=this._names[h]||this._nameGroup(h);return`${h}${y.index++}`}_nameGroup(h){var y,v;if(!((v=(y=this._parent)===null||y===void 0?void 0:y._prefixes)===null||v===void 0)&&v.has(h)||this._prefixes&&!this._prefixes.has(h))throw new Error(`CodeGen: prefix "${h}" is not allowed in this scope`);return this._names[h]={prefix:h,index:0}}}e.Scope=c;class u extends n.Name{constructor(h,y){super(y),this.prefix=h}setValue(h,{property:y,itemIndex:v}){this.value=h,this.scopePath=(0,n._)`.${new n.Name(y)}[${v}]`}}e.ValueScopeName=u;const d=(0,n._)`\n`;class p extends c{constructor(h){super(h),this._values={},this._scope=h.scope,this.opts={...h,_n:h.lines?d:n.nil}}get(){return this._scope}name(h){return new u(h,this._newName(h))}value(h,y){var v;if(y.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const j=this.toName(h),{prefix:k}=j,x=(v=y.key)!==null&&v!==void 0?v:y.ref;let E=this._values[k];if(E){const $=E.get(x);if($)return $}else E=this._values[k]=new Map;E.set(x,j);const z=this._scope[k]||(this._scope[k]=[]),w=z.length;return z[w]=y.ref,j.setValue(y,{property:k,itemIndex:w}),j}getValue(h,y){const v=this._values[h];if(v)return v.get(y)}scopeRefs(h,y=this._values){return this._reduceValues(y,v=>{if(v.scopePath===void 0)throw new Error(`CodeGen: name "${v}" has no value`);return(0,n._)`${h}${v.scopePath}`})}scopeCode(h=this._values,y,v){return this._reduceValues(h,j=>{if(j.value===void 0)throw new Error(`CodeGen: name "${j}" has no value`);return j.value.code},y,v)}_reduceValues(h,y,v={},j){let k=n.nil;for(const x in h){const E=h[x];if(!E)continue;const z=v[x]=v[x]||new Map;E.forEach(w=>{if(z.has(w))return;z.set(w,l.Started);let $=y(w);if($){const N=this.opts.es5?e.varKinds.var:e.varKinds.const;k=(0,n._)`${k}${N} ${w} = ${$};${this.opts._n}`}else if($=j==null?void 0:j(w))k=(0,n._)`${k}${$}${this.opts._n}`;else throw new o(w);z.set(w,l.Completed)})}return k}}e.ValueScope=p})(bf)),bf}var iy;function Ae(){return iy||(iy=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const n=wc(),o=ry();var l=wc();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return l.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return l.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return l.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}});var c=ry();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return c.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return c.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return c.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return c.varKinds}}),e.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class u{optimizeNodes(){return this}optimizeNames(O,D){return this}}class d extends u{constructor(O,D,X){super(),this.varKind=O,this.name=D,this.rhs=X}render({es5:O,_n:D}){const X=O?o.varKinds.var:this.varKind,pe=this.rhs===void 0?"":` = ${this.rhs}`;return`${X} ${this.name}${pe};`+D}optimizeNames(O,D){if(O[this.name.str])return this.rhs&&(this.rhs=ie(this.rhs,O,D)),this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class p extends u{constructor(O,D,X){super(),this.lhs=O,this.rhs=D,this.sideEffects=X}render({_n:O}){return`${this.lhs} = ${this.rhs};`+O}optimizeNames(O,D){if(!(this.lhs instanceof n.Name&&!O[this.lhs.str]&&!this.sideEffects))return this.rhs=ie(this.rhs,O,D),this}get names(){const O=this.lhs instanceof n.Name?{}:{...this.lhs.names};return F(O,this.rhs)}}class g extends p{constructor(O,D,X,pe){super(O,X,pe),this.op=D}render({_n:O}){return`${this.lhs} ${this.op}= ${this.rhs};`+O}}class h extends u{constructor(O){super(),this.label=O,this.names={}}render({_n:O}){return`${this.label}:`+O}}class y extends u{constructor(O){super(),this.label=O,this.names={}}render({_n:O}){return`break${this.label?` ${this.label}`:""};`+O}}class v extends u{constructor(O){super(),this.error=O}render({_n:O}){return`throw ${this.error};`+O}get names(){return this.error.names}}class j extends u{constructor(O){super(),this.code=O}render({_n:O}){return`${this.code};`+O}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(O,D){return this.code=ie(this.code,O,D),this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class k extends u{constructor(O=[]){super(),this.nodes=O}render(O){return this.nodes.reduce((D,X)=>D+X.render(O),"")}optimizeNodes(){const{nodes:O}=this;let D=O.length;for(;D--;){const X=O[D].optimizeNodes();Array.isArray(X)?O.splice(D,1,...X):X?O[D]=X:O.splice(D,1)}return O.length>0?this:void 0}optimizeNames(O,D){const{nodes:X}=this;let pe=X.length;for(;pe--;){const he=X[pe];he.optimizeNames(O,D)||(_e(O,he.names),X.splice(pe,1))}return X.length>0?this:void 0}get names(){return this.nodes.reduce((O,D)=>Y(O,D.names),{})}}class x extends k{render(O){return"{"+O._n+super.render(O)+"}"+O._n}}class E extends k{}class z extends x{}z.kind="else";class w extends x{constructor(O,D){super(D),this.condition=O}render(O){let D=`if(${this.condition})`+super.render(O);return this.else&&(D+="else "+this.else.render(O)),D}optimizeNodes(){super.optimizeNodes();const O=this.condition;if(O===!0)return this.nodes;let D=this.else;if(D){const X=D.optimizeNodes();D=this.else=Array.isArray(X)?new z(X):X}if(D)return O===!1?D instanceof w?D:D.nodes:this.nodes.length?this:new w(ae(O),D instanceof w?[D]:D.nodes);if(!(O===!1||!this.nodes.length))return this}optimizeNames(O,D){var X;if(this.else=(X=this.else)===null||X===void 0?void 0:X.optimizeNames(O,D),!!(super.optimizeNames(O,D)||this.else))return this.condition=ie(this.condition,O,D),this}get names(){const O=super.names;return F(O,this.condition),this.else&&Y(O,this.else.names),O}}w.kind="if";class $ extends x{}$.kind="for";class N extends ${constructor(O){super(),this.iteration=O}render(O){return`for(${this.iteration})`+super.render(O)}optimizeNames(O,D){if(super.optimizeNames(O,D))return this.iteration=ie(this.iteration,O,D),this}get names(){return Y(super.names,this.iteration.names)}}class R extends ${constructor(O,D,X,pe){super(),this.varKind=O,this.name=D,this.from=X,this.to=pe}render(O){const D=O.es5?o.varKinds.var:this.varKind,{name:X,from:pe,to:he}=this;return`for(${D} ${X}=${pe}; ${X}<${he}; ${X}++)`+super.render(O)}get names(){const O=F(super.names,this.from);return F(O,this.to)}}class _ extends ${constructor(O,D,X,pe){super(),this.loop=O,this.varKind=D,this.name=X,this.iterable=pe}render(O){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(O)}optimizeNames(O,D){if(super.optimizeNames(O,D))return this.iterable=ie(this.iterable,O,D),this}get names(){return Y(super.names,this.iterable.names)}}class S extends x{constructor(O,D,X){super(),this.name=O,this.args=D,this.async=X}render(O){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(O)}}S.kind="func";class C extends k{render(O){return"return "+super.render(O)}}C.kind="return";class I extends x{render(O){let D="try"+super.render(O);return this.catch&&(D+=this.catch.render(O)),this.finally&&(D+=this.finally.render(O)),D}optimizeNodes(){var O,D;return super.optimizeNodes(),(O=this.catch)===null||O===void 0||O.optimizeNodes(),(D=this.finally)===null||D===void 0||D.optimizeNodes(),this}optimizeNames(O,D){var X,pe;return super.optimizeNames(O,D),(X=this.catch)===null||X===void 0||X.optimizeNames(O,D),(pe=this.finally)===null||pe===void 0||pe.optimizeNames(O,D),this}get names(){const O=super.names;return this.catch&&Y(O,this.catch.names),this.finally&&Y(O,this.finally.names),O}}class te extends x{constructor(O){super(),this.error=O}render(O){return`catch(${this.error})`+super.render(O)}}te.kind="catch";class G extends x{render(O){return"finally"+super.render(O)}}G.kind="finally";class H{constructor(O,D={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...D,_n:D.lines?`
|
|
113
113
|
`:""},this._extScope=O,this._scope=new o.Scope({parent:O}),this._nodes=[new E]}toString(){return this._root.render(this.opts)}name(O){return this._scope.name(O)}scopeName(O){return this._extScope.name(O)}scopeValue(O,D){const X=this._extScope.value(O,D);return(this._values[X.prefix]||(this._values[X.prefix]=new Set)).add(X),X}getScopeValue(O,D){return this._extScope.getValue(O,D)}scopeRefs(O){return this._extScope.scopeRefs(O,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(O,D,X,pe){const he=this._scope.toName(D);return X!==void 0&&pe&&(this._constants[he.str]=X),this._leafNode(new d(O,he,X)),he}const(O,D,X){return this._def(o.varKinds.const,O,D,X)}let(O,D,X){return this._def(o.varKinds.let,O,D,X)}var(O,D,X){return this._def(o.varKinds.var,O,D,X)}assign(O,D,X){return this._leafNode(new p(O,D,X))}add(O,D){return this._leafNode(new g(O,e.operators.ADD,D))}code(O){return typeof O=="function"?O():O!==n.nil&&this._leafNode(new j(O)),this}object(...O){const D=["{"];for(const[X,pe]of O)D.length>1&&D.push(","),D.push(X),(X!==pe||this.opts.es5)&&(D.push(":"),(0,n.addCodeArg)(D,pe));return D.push("}"),new n._Code(D)}if(O,D,X){if(this._blockNode(new w(O)),D&&X)this.code(D).else().code(X).endIf();else if(D)this.code(D).endIf();else if(X)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(O){return this._elseNode(new w(O))}else(){return this._elseNode(new z)}endIf(){return this._endBlockNode(w,z)}_for(O,D){return this._blockNode(O),D&&this.code(D).endFor(),this}for(O,D){return this._for(new N(O),D)}forRange(O,D,X,pe,he=this.opts.es5?o.varKinds.var:o.varKinds.let){const Se=this._scope.toName(O);return this._for(new R(he,Se,D,X),()=>pe(Se))}forOf(O,D,X,pe=o.varKinds.const){const he=this._scope.toName(O);if(this.opts.es5){const Se=D instanceof n.Name?D:this.var("_arr",D);return this.forRange("_i",0,(0,n._)`${Se}.length`,Te=>{this.var(he,(0,n._)`${Se}[${Te}]`),X(he)})}return this._for(new _("of",pe,he,D),()=>X(he))}forIn(O,D,X,pe=this.opts.es5?o.varKinds.var:o.varKinds.const){if(this.opts.ownProperties)return this.forOf(O,(0,n._)`Object.keys(${D})`,X);const he=this._scope.toName(O);return this._for(new _("in",pe,he,D),()=>X(he))}endFor(){return this._endBlockNode($)}label(O){return this._leafNode(new h(O))}break(O){return this._leafNode(new y(O))}return(O){const D=new C;if(this._blockNode(D),this.code(O),D.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(C)}try(O,D,X){if(!D&&!X)throw new Error('CodeGen: "try" without "catch" and "finally"');const pe=new I;if(this._blockNode(pe),this.code(O),D){const he=this.name("e");this._currNode=pe.catch=new te(he),D(he)}return X&&(this._currNode=pe.finally=new G,this.code(X)),this._endBlockNode(te,G)}throw(O){return this._leafNode(new v(O))}block(O,D){return this._blockStarts.push(this._nodes.length),O&&this.code(O).endBlock(D),this}endBlock(O){const D=this._blockStarts.pop();if(D===void 0)throw new Error("CodeGen: not in self-balancing block");const X=this._nodes.length-D;if(X<0||O!==void 0&&X!==O)throw new Error(`CodeGen: wrong number of nodes: ${X} vs ${O} expected`);return this._nodes.length=D,this}func(O,D=n.nil,X,pe){return this._blockNode(new S(O,D,X)),pe&&this.code(pe).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(O=1){for(;O-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(O){return this._currNode.nodes.push(O),this}_blockNode(O){this._currNode.nodes.push(O),this._nodes.push(O)}_endBlockNode(O,D){const X=this._currNode;if(X instanceof O||D&&X instanceof D)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${D?`${O.kind}/${D.kind}`:O.kind}"`)}_elseNode(O){const D=this._currNode;if(!(D instanceof w))throw new Error('CodeGen: "else" without "if"');return this._currNode=D.else=O,this}get _root(){return this._nodes[0]}get _currNode(){const O=this._nodes;return O[O.length-1]}set _currNode(O){const D=this._nodes;D[D.length-1]=O}}e.CodeGen=H;function Y(L,O){for(const D in O)L[D]=(L[D]||0)+(O[D]||0);return L}function F(L,O){return O instanceof n._CodeOrName?Y(L,O.names):L}function ie(L,O,D){if(L instanceof n.Name)return X(L);if(!pe(L))return L;return new n._Code(L._items.reduce((he,Se)=>(Se instanceof n.Name&&(Se=X(Se)),Se instanceof n._Code?he.push(...Se._items):he.push(Se),he),[]));function X(he){const Se=D[he.str];return Se===void 0||O[he.str]!==1?he:(delete O[he.str],Se)}function pe(he){return he instanceof n._Code&&he._items.some(Se=>Se instanceof n.Name&&O[Se.str]===1&&D[Se.str]!==void 0)}}function _e(L,O){for(const D in O)L[D]=(L[D]||0)-(O[D]||0)}function ae(L){return typeof L=="boolean"||typeof L=="number"||L===null?!L:(0,n._)`!${V(L)}`}e.not=ae;const de=T(e.operators.AND);function ge(...L){return L.reduce(de)}e.and=ge;const ke=T(e.operators.OR);function re(...L){return L.reduce(ke)}e.or=re;function T(L){return(O,D)=>O===n.nil?D:D===n.nil?O:(0,n._)`${V(O)} ${L} ${V(D)}`}function V(L){return L instanceof n.Name?L:(0,n._)`(${L})`}})(vf)),vf}var Re={},oy;function qe(){if(oy)return Re;oy=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.checkStrictMode=Re.getErrorPath=Re.Type=Re.useFunc=Re.setEvaluated=Re.evaluatedPropsToName=Re.mergeEvaluated=Re.eachItem=Re.unescapeJsonPointer=Re.escapeJsonPointer=Re.escapeFragment=Re.unescapeFragment=Re.schemaRefOrVal=Re.schemaHasRulesButRef=Re.schemaHasRules=Re.checkUnknownRules=Re.alwaysValidSchema=Re.toHash=void 0;const e=Ae(),n=wc();function o(_){const S={};for(const C of _)S[C]=!0;return S}Re.toHash=o;function l(_,S){return typeof S=="boolean"?S:Object.keys(S).length===0?!0:(c(_,S),!u(S,_.self.RULES.all))}Re.alwaysValidSchema=l;function c(_,S=_.schema){const{opts:C,self:I}=_;if(!C.strictSchema||typeof S=="boolean")return;const te=I.RULES.keywords;for(const G in S)te[G]||R(_,`unknown keyword: "${G}"`)}Re.checkUnknownRules=c;function u(_,S){if(typeof _=="boolean")return!_;for(const C in _)if(S[C])return!0;return!1}Re.schemaHasRules=u;function d(_,S){if(typeof _=="boolean")return!_;for(const C in _)if(C!=="$ref"&&S.all[C])return!0;return!1}Re.schemaHasRulesButRef=d;function p({topSchemaRef:_,schemaPath:S},C,I,te){if(!te){if(typeof C=="number"||typeof C=="boolean")return C;if(typeof C=="string")return(0,e._)`${C}`}return(0,e._)`${_}${S}${(0,e.getProperty)(I)}`}Re.schemaRefOrVal=p;function g(_){return v(decodeURIComponent(_))}Re.unescapeFragment=g;function h(_){return encodeURIComponent(y(_))}Re.escapeFragment=h;function y(_){return typeof _=="number"?`${_}`:_.replace(/~/g,"~0").replace(/\//g,"~1")}Re.escapeJsonPointer=y;function v(_){return _.replace(/~1/g,"/").replace(/~0/g,"~")}Re.unescapeJsonPointer=v;function j(_,S){if(Array.isArray(_))for(const C of _)S(C);else S(_)}Re.eachItem=j;function k({mergeNames:_,mergeToName:S,mergeValues:C,resultToName:I}){return(te,G,H,Y)=>{const F=H===void 0?G:H instanceof e.Name?(G instanceof e.Name?_(te,G,H):S(te,G,H),H):G instanceof e.Name?(S(te,H,G),G):C(G,H);return Y===e.Name&&!(F instanceof e.Name)?I(te,F):F}}Re.mergeEvaluated={props:k({mergeNames:(_,S,C)=>_.if((0,e._)`${C} !== true && ${S} !== undefined`,()=>{_.if((0,e._)`${S} === true`,()=>_.assign(C,!0),()=>_.assign(C,(0,e._)`${C} || {}`).code((0,e._)`Object.assign(${C}, ${S})`))}),mergeToName:(_,S,C)=>_.if((0,e._)`${C} !== true`,()=>{S===!0?_.assign(C,!0):(_.assign(C,(0,e._)`${C} || {}`),E(_,C,S))}),mergeValues:(_,S)=>_===!0?!0:{..._,...S},resultToName:x}),items:k({mergeNames:(_,S,C)=>_.if((0,e._)`${C} !== true && ${S} !== undefined`,()=>_.assign(C,(0,e._)`${S} === true ? true : ${C} > ${S} ? ${C} : ${S}`)),mergeToName:(_,S,C)=>_.if((0,e._)`${C} !== true`,()=>_.assign(C,S===!0?!0:(0,e._)`${C} > ${S} ? ${C} : ${S}`)),mergeValues:(_,S)=>_===!0?!0:Math.max(_,S),resultToName:(_,S)=>_.var("items",S)})};function x(_,S){if(S===!0)return _.var("props",!0);const C=_.var("props",(0,e._)`{}`);return S!==void 0&&E(_,C,S),C}Re.evaluatedPropsToName=x;function E(_,S,C){Object.keys(C).forEach(I=>_.assign((0,e._)`${S}${(0,e.getProperty)(I)}`,!0))}Re.setEvaluated=E;const z={};function w(_,S){return _.scopeValue("func",{ref:S,code:z[S.code]||(z[S.code]=new n._Code(S.code))})}Re.useFunc=w;var $;(function(_){_[_.Num=0]="Num",_[_.Str=1]="Str"})($||(Re.Type=$={}));function N(_,S,C){if(_ instanceof e.Name){const I=S===$.Num;return C?I?(0,e._)`"[" + ${_} + "]"`:(0,e._)`"['" + ${_} + "']"`:I?(0,e._)`"/" + ${_}`:(0,e._)`"/" + ${_}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return C?(0,e.getProperty)(_).toString():"/"+y(_)}Re.getErrorPath=N;function R(_,S,C=_.opts.strictSchema){if(C){if(S=`strict mode: ${S}`,C===!0)throw new Error(S);_.self.logger.warn(S)}}return Re.checkStrictMode=R,Re}var Ms={},ly;function jr(){if(ly)return Ms;ly=1,Object.defineProperty(Ms,"__esModule",{value:!0});const e=Ae(),n={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return Ms.default=n,Ms}var sy;function Rc(){return sy||(sy=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const n=Ae(),o=qe(),l=jr();e.keywordError={message:({keyword:z})=>(0,n.str)`must pass "${z}" keyword validation`},e.keyword$DataError={message:({keyword:z,schemaType:w})=>w?(0,n.str)`"${z}" keyword must be ${w} ($data)`:(0,n.str)`"${z}" keyword is invalid ($data)`};function c(z,w=e.keywordError,$,N){const{it:R}=z,{gen:_,compositeRule:S,allErrors:C}=R,I=v(z,w,$);N??(S||C)?g(_,I):h(R,(0,n._)`[${I}]`)}e.reportError=c;function u(z,w=e.keywordError,$){const{it:N}=z,{gen:R,compositeRule:_,allErrors:S}=N,C=v(z,w,$);g(R,C),_||S||h(N,l.default.vErrors)}e.reportExtraError=u;function d(z,w){z.assign(l.default.errors,w),z.if((0,n._)`${l.default.vErrors} !== null`,()=>z.if(w,()=>z.assign((0,n._)`${l.default.vErrors}.length`,w),()=>z.assign(l.default.vErrors,null)))}e.resetErrorsCount=d;function p({gen:z,keyword:w,schemaValue:$,data:N,errsCount:R,it:_}){if(R===void 0)throw new Error("ajv implementation error");const S=z.name("err");z.forRange("i",R,l.default.errors,C=>{z.const(S,(0,n._)`${l.default.vErrors}[${C}]`),z.if((0,n._)`${S}.instancePath === undefined`,()=>z.assign((0,n._)`${S}.instancePath`,(0,n.strConcat)(l.default.instancePath,_.errorPath))),z.assign((0,n._)`${S}.schemaPath`,(0,n.str)`${_.errSchemaPath}/${w}`),_.opts.verbose&&(z.assign((0,n._)`${S}.schema`,$),z.assign((0,n._)`${S}.data`,N))})}e.extendErrors=p;function g(z,w){const $=z.const("err",w);z.if((0,n._)`${l.default.vErrors} === null`,()=>z.assign(l.default.vErrors,(0,n._)`[${$}]`),(0,n._)`${l.default.vErrors}.push(${$})`),z.code((0,n._)`${l.default.errors}++`)}function h(z,w){const{gen:$,validateName:N,schemaEnv:R}=z;R.$async?$.throw((0,n._)`new ${z.ValidationError}(${w})`):($.assign((0,n._)`${N}.errors`,w),$.return(!1))}const y={keyword:new n.Name("keyword"),schemaPath:new n.Name("schemaPath"),params:new n.Name("params"),propertyName:new n.Name("propertyName"),message:new n.Name("message"),schema:new n.Name("schema"),parentSchema:new n.Name("parentSchema")};function v(z,w,$){const{createErrors:N}=z.it;return N===!1?(0,n._)`{}`:j(z,w,$)}function j(z,w,$={}){const{gen:N,it:R}=z,_=[k(R,$),x(z,$)];return E(z,w,_),N.object(..._)}function k({errorPath:z},{instancePath:w}){const $=w?(0,n.str)`${z}${(0,o.getErrorPath)(w,o.Type.Str)}`:z;return[l.default.instancePath,(0,n.strConcat)(l.default.instancePath,$)]}function x({keyword:z,it:{errSchemaPath:w}},{schemaPath:$,parentSchema:N}){let R=N?w:(0,n.str)`${w}/${z}`;return $&&(R=(0,n.str)`${R}${(0,o.getErrorPath)($,o.Type.Str)}`),[y.schemaPath,R]}function E(z,{params:w,message:$},N){const{keyword:R,data:_,schemaValue:S,it:C}=z,{opts:I,propertyName:te,topSchemaRef:G,schemaPath:H}=C;N.push([y.keyword,R],[y.params,typeof w=="function"?w(z):w||(0,n._)`{}`]),I.messages&&N.push([y.message,typeof $=="function"?$(z):$]),I.verbose&&N.push([y.schema,S],[y.parentSchema,(0,n._)`${G}${H}`],[l.default.data,_]),te&&N.push([y.propertyName,te])}})(yf)),yf}var cy;function F3(){if(cy)return qr;cy=1,Object.defineProperty(qr,"__esModule",{value:!0}),qr.boolOrEmptySchema=qr.topBoolOrEmptySchema=void 0;const e=Rc(),n=Ae(),o=jr(),l={message:"boolean schema is false"};function c(p){const{gen:g,schema:h,validateName:y}=p;h===!1?d(p,!1):typeof h=="object"&&h.$async===!0?g.return(o.default.data):(g.assign((0,n._)`${y}.errors`,null),g.return(!0))}qr.topBoolOrEmptySchema=c;function u(p,g){const{gen:h,schema:y}=p;y===!1?(h.var(g,!1),d(p)):h.var(g,!0)}qr.boolOrEmptySchema=u;function d(p,g){const{gen:h,data:y}=p,v={gen:h,keyword:"false schema",data:y,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:p};(0,e.reportError)(v,l,void 0,g)}return qr}var Ht={},Pr={},uy;function D1(){if(uy)return Pr;uy=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.getRules=Pr.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],n=new Set(e);function o(c){return typeof c=="string"&&n.has(c)}Pr.isJSONType=o;function l(){const c={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...c,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},c.number,c.string,c.array,c.object],post:{rules:[]},all:{},keywords:{}}}return Pr.getRules=l,Pr}var yn={},dy;function I1(){if(dy)return yn;dy=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.shouldUseRule=yn.shouldUseGroup=yn.schemaHasRulesForType=void 0;function e({schema:l,self:c},u){const d=c.RULES.types[u];return d&&d!==!0&&n(l,d)}yn.schemaHasRulesForType=e;function n(l,c){return c.rules.some(u=>o(l,u))}yn.shouldUseGroup=n;function o(l,c){var u;return l[c.keyword]!==void 0||((u=c.definition.implements)===null||u===void 0?void 0:u.some(d=>l[d]!==void 0))}return yn.shouldUseRule=o,yn}var fy;function kc(){if(fy)return Ht;fy=1,Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.reportTypeError=Ht.checkDataTypes=Ht.checkDataType=Ht.coerceAndCheckDataType=Ht.getJSONTypes=Ht.getSchemaTypes=Ht.DataType=void 0;const e=D1(),n=I1(),o=Rc(),l=Ae(),c=qe();var u;(function($){$[$.Correct=0]="Correct",$[$.Wrong=1]="Wrong"})(u||(Ht.DataType=u={}));function d($){const N=p($.type);if(N.includes("null")){if($.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!N.length&&$.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');$.nullable===!0&&N.push("null")}return N}Ht.getSchemaTypes=d;function p($){const N=Array.isArray($)?$:$?[$]:[];if(N.every(e.isJSONType))return N;throw new Error("type must be JSONType or JSONType[]: "+N.join(","))}Ht.getJSONTypes=p;function g($,N){const{gen:R,data:_,opts:S}=$,C=y(N,S.coerceTypes),I=N.length>0&&!(C.length===0&&N.length===1&&(0,n.schemaHasRulesForType)($,N[0]));if(I){const te=x(N,_,S.strictNumbers,u.Wrong);R.if(te,()=>{C.length?v($,N,C):z($)})}return I}Ht.coerceAndCheckDataType=g;const h=new Set(["string","number","integer","boolean","null"]);function y($,N){return N?$.filter(R=>h.has(R)||N==="array"&&R==="array"):[]}function v($,N,R){const{gen:_,data:S,opts:C}=$,I=_.let("dataType",(0,l._)`typeof ${S}`),te=_.let("coerced",(0,l._)`undefined`);C.coerceTypes==="array"&&_.if((0,l._)`${I} == 'object' && Array.isArray(${S}) && ${S}.length == 1`,()=>_.assign(S,(0,l._)`${S}[0]`).assign(I,(0,l._)`typeof ${S}`).if(x(N,S,C.strictNumbers),()=>_.assign(te,S))),_.if((0,l._)`${te} !== undefined`);for(const H of R)(h.has(H)||H==="array"&&C.coerceTypes==="array")&&G(H);_.else(),z($),_.endIf(),_.if((0,l._)`${te} !== undefined`,()=>{_.assign(S,te),j($,te)});function G(H){switch(H){case"string":_.elseIf((0,l._)`${I} == "number" || ${I} == "boolean"`).assign(te,(0,l._)`"" + ${S}`).elseIf((0,l._)`${S} === null`).assign(te,(0,l._)`""`);return;case"number":_.elseIf((0,l._)`${I} == "boolean" || ${S} === null
|
|
114
114
|
|| (${I} == "string" && ${S} && ${S} == +${S})`).assign(te,(0,l._)`+${S}`);return;case"integer":_.elseIf((0,l._)`${I} === "boolean" || ${S} === null
|
|
115
115
|
|| (${I} === "string" && ${S} && ${S} == +${S} && !(${S} % 1))`).assign(te,(0,l._)`+${S}`);return;case"boolean":_.elseIf((0,l._)`${S} === "false" || ${S} === 0 || ${S} === null`).assign(te,!1).elseIf((0,l._)`${S} === "true" || ${S} === 1`).assign(te,!0);return;case"null":_.elseIf((0,l._)`${S} === "" || ${S} === 0 || ${S} === false`),_.assign(te,null);return;case"array":_.elseIf((0,l._)`${I} === "string" || ${I} === "number"
|
|
@@ -211,7 +211,7 @@ ${u}
|
|
|
211
211
|
${d}
|
|
212
212
|
}
|
|
213
213
|
}`;return`${y}
|
|
214
|
-
${v}`}var D9=["useAction","useStream","useAuth","useApp","useRender","useGguiContext","useContract","useWireContext","GguiWireProvider"],I9=["Container","Card","Stack","Row","Grid","Box","Divider","Spacer","Text","Heading","Button","Input","TextArea","Select","Checkbox","Toggle","RadioGroup","Slider","Badge","Spinner","Skeleton","Avatar","Alert","Progress","Image","Icon","Link","Tooltip","Table","Tabs","Toast","Accordion","MotionKeyframes","useMotion","useAnimationKey"],U9=["SearchField","FormField","MenuItem","Tag","Dropdown","Autocomplete","Breadcrumb","Pagination","EmptyState","Stat","Stepper","Markdown","MarkdownInline","renderRichTextInlines"],L9=["Header","Sidebar","CardGrid","CommentThread","DataTable","ChatWindow","NavigationBar","FileUploader","NotificationCenter","Modal","CommandPalette","Footer","Hero"],Ev=["Clickable","Hoverable","Pressable"],V9=["useState","useEffect","useRef","useCallback","useMemo","useContext","useReducer","useId","use","useActionState","useOptimistic","useTransition","startTransition","useDeferredValue","useSyncExternalStore","useInsertionEffect","useLayoutEffect","useImperativeHandle","useDebugValue","createElement","Fragment","Children","cloneElement","createContext","forwardRef","memo","lazy","Suspense","Component","PureComponent","isValidElement","createRef"],B9=["animation","duration","easing","transition","keyframes","thinkingAnimation","thinkingKeyframes","thinkingPresets","THINKING_DEFAULT_STYLE","motionSafe","reducedMotion","reducedMotionCSS","colors","gray","primary","semantic","chartColors","success","warning","error","info","highContrast","typography","fontFamily","fontSize","fontSizeValues","fontWeight","lineHeight","letterSpacing","headingStyles","spacing","spacingValues","radius","shadow","elevation","maxWidth","zIndex","accessibility","focusRing","nativeTokens","tokens"];function qt(e,n,o){return e=e.split(`from"${n}"`).join(`from"${o}"`),e=e.split(`from "${n}"`).join(`from "${o}"`),e=e.split(`from'${n}'`).join(`from'${o}'`),e=e.split(`from '${n}'`).join(`from '${o}'`),e=e.split(`import"${n}"`).join(`import"${o}"`),e=e.split(`import "${n}"`).join(`import "${o}"`),e=e.split(`import'${n}'`).join(`import'${o}'`),e=e.split(`import '${n}'`).join(`import '${o}'`),e}function yp(e,n){return`(globalThis.__ggui__&&globalThis.__ggui__["${e}"]||window["${n}"])`}function H9(e){const n=V9.map(c=>`export const ${c} = R.${c};`).join(" "),l=`const R = ${yp("react",e)}; export default R; ${n}`;return`data:text/javascript,${encodeURIComponent(l)}`}function q9(){const o=`const D = globalThis.__ggui__["reactDom"]; export default D; ${["createPortal","flushSync","unstable_batchedUpdates"].map(l=>`export const ${l} = D.${l};`).join(" ")}`;return`data:text/javascript,${encodeURIComponent(o)}`}function P9(e){const o=[`const R = ${yp("react",e)};`,"function jsx(t,p,k){","if(k!==undefined){p={...p,key:k}}","const c=p.children;","delete p.children;","return Array.isArray(c)?R.createElement(t,p,...c):c!==undefined?R.createElement(t,p,c):R.createElement(t,p)","}","export{jsx,jsx as jsxs,jsx as jsxDEV};","export const Fragment=R.Fragment;"].join("");return`data:text/javascript,${encodeURIComponent(o)}`}function Wn(e,n,o,l,c){if(o&&o.length>0){const p=[e,...l||[]],g=[n,...c||[]],h=p.map((k,x)=>`(globalThis.__ggui__&&globalThis.__ggui__["${g[x]}"]||window["${k}"]||{})`),y=h.join(","),v=o.map(k=>`export const ${k} = M["${k}"];`).join(" "),j=h.length>1?`const M = Object.assign({}, ${y}); ${v} export default M;`:`const M = ${h[0]}; ${v} export default M;`;return`data:text/javascript,${encodeURIComponent(j)}`}const d=`const M = ${yp(n,e)} || {}; const handler = { get(_, key) { return M[key]; } }; export default new Proxy({}, handler);`;return`data:text/javascript,${encodeURIComponent(d)}`}function Z9(){const n=`const w = globalThis.__ggui__.wire; ${D9.map(o=>`export const ${o} = w.${o};`).join(" ")} export default w;`;return`data:text/javascript,${encodeURIComponent(n)}`}function G9(e,n){var d;const o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(`import\\s*(?:[A-Za-z_$][\\w$]*\\s*,\\s*)?\\{([^}]*)\\}\\s*from\\s*['"]${o}['"]`,"g"),c=new Set;let u;for(;(u=l.exec(e))!==null;)for(const p of u[1].split(",")){const g=(d=p.trim().split(/\s+as\s+/)[0])==null?void 0:d.trim();g!==void 0&&/^[A-Za-z_$][\w$]*$/.test(g)&&c.add(g)}return[...c]}function F9(e,n){const o=JSON.stringify(e),l=n.some(u=>/^[A-Z]/.test(u)),c=[];c.push(`var P=${o};`),c.push("function NS(){return(globalThis.__ggui__&&globalThis.__ggui__.gadgets&&globalThis.__ggui__.gadgets[P])||{};}"),c.push('function H(n){return function(){var f=NS()[n];if(typeof f!=="function")throw new Error("[gadget] export "+n+" from package "+P+" is not loaded — the package failed to load at iframe boot or is not registered on App.gadgets.");return f.apply(this,arguments);};}'),l&&(c.push("var R=globalThis.__ggui__&&globalThis.__ggui__.react;"),c.push('class GEB extends R.Component{constructor(p){super(p);this.state={e:null};}static getDerivedStateFromError(e){return{e:e};}render(){if(this.state.e)return R.createElement("div",{style:{padding:"8px",border:"1px solid #e0a0c0",borderRadius:"6px",color:"#a03070",font:"13px system-ui"}},"[gadget] "+this.props.g+" failed to render");return this.props.children;}}'),c.push('function C(n){return function(props){var Cmp=NS()[n];if(typeof Cmp!=="function")return R.createElement("div",{style:{padding:"8px",border:"1px solid #e0a0c0",borderRadius:"6px",color:"#a03070",font:"13px system-ui"}},"[gadget] component "+n+" from package "+P+" is not loaded");return R.createElement(GEB,{g:n},R.createElement(Cmp,props));};}'));for(const u of n){const d=/^[A-Z]/.test(u)?"C":"H";c.push(`export const ${u}=${d}(${JSON.stringify(u)});`)}return c.push("export default new Proxy({},{get:function(_,k){return NS()[k];}});"),`data:text/javascript,${encodeURIComponent(c.join(""))}`}function Y9(e,n){const o=n.reactGlobal??"__REACT",l=n.primitivesGlobal??"__GGUI_PRIMITIVES",c=n.componentsGlobal??"__GGUI_COMPONENTS",u=n.compositionsGlobal??"__GGUI_COMPOSITIONS",d=n.interactGlobal??"__GGUI_INTERACT",p=n.appComponentsGlobal??"__GGUI_APP_COMPONENTS",g=H9(o),h=P9(o);e=qt(e,"react/jsx-runtime",h),e=qt(e,"react/jsx-dev-runtime",h);const y=q9();e=qt(e,"react-dom",y),e=qt(e,"react",g);const v=[...I9,...U9,...L9,...Ev];e=qt(e,"@ggui-ai/design/primitives",Wn(l,"primitives",v,[c,u,d],["components","compositions","interact"])),e=qt(e,"@ggui-ai/design/components",Wn(c,"components",v,[l,u,d],["primitives","compositions","interact"])),e=qt(e,"@ggui-ai/design/compositions",Wn(u,"compositions",v,[l,c,d],["primitives","components","interact"])),e=qt(e,"@ggui-ai/design/interact",Wn(d,"interact",[...Ev])),e=qt(e,"@ggui-ai/design/templates",Wn(u,"compositions",v,[l,c],["primitives","components"])),e=qt(e,"@ggui-ai/design/app-components",Wn(p,"appComponents")),e=qt(e,"@ggui-ai/design/tokens",Wn("__GGUI_TOKENS","tokens",[...B9])),e=qt(e,"@ggui-ai/design",Wn(l,"primitives",v,[c,u,d],["components","compositions","interact"])),e=qt(e,"@ggui-ai/wire",Z9());const j=[...new Set(["@ggui-ai/gadgets",...n.gadgetPackages??[]])];for(const k of j){const x=G9(e,k);e=qt(e,k,F9(k,x))}return e}function K9(e,n){const o=n.reactBaseUrl??"https://esm.sh/react@18.2.0";return e=qt(e,"react/jsx-runtime",`${o}/jsx-runtime`),e=qt(e,"react/jsx-dev-runtime",`${o}/jsx-runtime`),e=qt(e,"react",o),e}function X9(e,n){switch(n.mode){case"data-url":return Y9(e,n);case"importmap":return K9(e,n)}}function J9(e){const n=e.split(";"),o=[],l=[];for(const c of n)c.trimStart().startsWith("import")?o.push(c):l.push(c);return o.length===0?e:o.join(";")+";"+l.join(";")}async function Q9(e){const n=new Blob([e],{type:"application/javascript"}),o=URL.createObjectURL(n);try{return await import(o)}finally{URL.revokeObjectURL(o)}}var W9=0;function eN(e){return`ggui-rcr-${e.replace(/[^a-z0-9]/gi,"")}`}var tN=1,aN=500,nN=class extends xc.Component{constructor(){super(...arguments);gn(this,"state",{error:null,catchCount:0,autoRetrying:!1});gn(this,"retryTimer",null)}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n){var l,c;const o=this.state.catchCount+1;this.setState({catchCount:o}),o<=tN?(this.setState({autoRetrying:!0}),this.retryTimer=setTimeout(()=>{this.setState({error:null,autoRetrying:!1})},aN)):(c=(l=this.props).onError)==null||c.call(l,n)}componentWillUnmount(){this.retryTimer&&clearTimeout(this.retryTimer)}render(){const{error:n,autoRetrying:o,catchCount:l}=this.state;return n?o?i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:24,minHeight:80,gap:8,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:13,color:"rgba(255,255,255,0.4)"},children:[i.jsx("div",{style:{width:16,height:16,border:"2px solid rgba(255,255,255,0.15)",borderTopColor:"rgba(255,255,255,0.5)",borderRadius:"50%",animation:"ggui-err-spin 0.6s linear infinite"}}),"Retrying...",i.jsx("style",{children:"@keyframes ggui-err-spin { to { transform: rotate(360deg); } }"})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 24px",minHeight:120,gap:12,textAlign:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[i.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"rgba(239, 68, 68, 0.1)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22},children:"!"}),i.jsx("div",{style:{fontSize:14,fontWeight:600,color:"rgba(255,255,255,0.8)"},children:"Something went wrong"}),i.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.4)",maxWidth:280,lineHeight:1.4},children:"This component encountered an error. Try asking for a different view."}),i.jsx("button",{onClick:()=>this.setState({error:null,catchCount:0}),style:{marginTop:4,padding:"8px 20px",borderRadius:8,border:"1px solid rgba(255,255,255,0.15)",background:"rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.7)",fontSize:13,fontWeight:500,cursor:"pointer"},children:"Retry"}),l>1&&i.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.2)"},children:n.message})]}):this.props.children}};function rN({code:e,props:n={},themeId:o,cssOverrides:l,fallback:c=i.jsx("div",{children:"Loading component..."}),onError:u}){const d=A.useId(),[p]=A.useState(()=>eN(d)||`ggui-rcr-${++W9}`),[g,h]=A.useState(null),[y,v]=A.useState(null),[j,k]=A.useState(!0);A.useEffect(()=>{if(!e||e.trim().length===0){h(null),k(!1);return}let E=!1;k(!0),v(null),h(null);async function z(){try{let w=e;if(e.startsWith("https://")){const te=await fetch(e);if(!te.ok)throw new Error(`Failed to fetch component code: ${te.status}`);w=await te.text()}const $=Jk(w),N=globalThis;let R={};try{R=await Bx(()=>import("./index-B2zPeSf8.js").then(te=>te.i),[])}catch{}N.__ggui__={react:xc,reactDom:R,primitives:Uf,components:Vf,compositions:Hf,interact:qf,wire:kw},N.__REACT=xc,N.__GGUI_PRIMITIVES=Uf,N.__GGUI_COMPONENTS=Vf,N.__GGUI_COMPOSITIONS=Hf,N.__GGUI_INTERACT=qf;const _=J9($),S=X9(_,{mode:"data-url"}),C=await Q9(S);if(E)return;const I=C.default??Object.values(C).find(te=>typeof te=="function");if(!I)throw new Error("Module does not export a default component");h(()=>I),v(null)}catch(w){if(E)return;const $=w instanceof Error?w:new Error(String(w));v($),h(null),u==null||u($)}finally{E||k(!1)}}return z(),()=>{E=!0}},[e]);const x=o?hp(o,p):R9(p);return!e||e.trim().length===0?i.jsx("div",{children:c}):j?i.jsx("div",{children:c}):y?i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 24px",minHeight:120,gap:12,textAlign:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[i.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"rgba(239, 68, 68, 0.1)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22},children:"!"}),i.jsx("div",{style:{fontSize:14,fontWeight:600,color:"rgba(255,255,255,0.8)"},children:"Failed to load component"}),i.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.4)",maxWidth:280,lineHeight:1.4},children:y.message})]}):g?i.jsxs("div",{className:p,children:[i.jsxs("style",{children:[x,l??""]}),i.jsx(nN,{onError:u,children:i.jsx(g,{...n})},e.length)]}):i.jsx("div",{children:c})}var Cv="ggui-preview-keyframes",iN=`@keyframes ggui-preview-shimmer {
|
|
214
|
+
${v}`}var D9=["useAction","useStream","useAuth","useApp","useRender","useGguiContext","useContract","useWireContext","GguiWireProvider"],I9=["Container","Card","Stack","Row","Grid","Box","Divider","Spacer","Text","Heading","Button","Input","TextArea","Select","Checkbox","Toggle","RadioGroup","Slider","Badge","Spinner","Skeleton","Avatar","Alert","Progress","Image","Icon","Link","Tooltip","Table","Tabs","Toast","Accordion","MotionKeyframes","useMotion","useAnimationKey"],U9=["SearchField","FormField","MenuItem","Tag","Dropdown","Autocomplete","Breadcrumb","Pagination","EmptyState","Stat","Stepper","Markdown","MarkdownInline","renderRichTextInlines"],L9=["Header","Sidebar","CardGrid","CommentThread","DataTable","ChatWindow","NavigationBar","FileUploader","NotificationCenter","Modal","CommandPalette","Footer","Hero"],Ev=["Clickable","Hoverable","Pressable"],V9=["useState","useEffect","useRef","useCallback","useMemo","useContext","useReducer","useId","use","useActionState","useOptimistic","useTransition","startTransition","useDeferredValue","useSyncExternalStore","useInsertionEffect","useLayoutEffect","useImperativeHandle","useDebugValue","createElement","Fragment","Children","cloneElement","createContext","forwardRef","memo","lazy","Suspense","Component","PureComponent","isValidElement","createRef"],B9=["animation","duration","easing","transition","keyframes","thinkingAnimation","thinkingKeyframes","thinkingPresets","THINKING_DEFAULT_STYLE","motionSafe","reducedMotion","reducedMotionCSS","colors","gray","primary","semantic","chartColors","success","warning","error","info","highContrast","typography","fontFamily","fontSize","fontSizeValues","fontWeight","lineHeight","letterSpacing","headingStyles","spacing","spacingValues","radius","shadow","elevation","maxWidth","zIndex","accessibility","focusRing","nativeTokens","tokens"];function qt(e,n,o){return e=e.split(`from"${n}"`).join(`from"${o}"`),e=e.split(`from "${n}"`).join(`from "${o}"`),e=e.split(`from'${n}'`).join(`from'${o}'`),e=e.split(`from '${n}'`).join(`from '${o}'`),e=e.split(`import"${n}"`).join(`import"${o}"`),e=e.split(`import "${n}"`).join(`import "${o}"`),e=e.split(`import'${n}'`).join(`import'${o}'`),e=e.split(`import '${n}'`).join(`import '${o}'`),e}function yp(e,n){return`(globalThis.__ggui__&&globalThis.__ggui__["${e}"]||window["${n}"])`}function H9(e){const n=V9.map(c=>`export const ${c} = R.${c};`).join(" "),l=`const R = ${yp("react",e)}; export default R; ${n}`;return`data:text/javascript,${encodeURIComponent(l)}`}function q9(){const o=`const D = globalThis.__ggui__["reactDom"]; export default D; ${["createPortal","flushSync","unstable_batchedUpdates"].map(l=>`export const ${l} = D.${l};`).join(" ")}`;return`data:text/javascript,${encodeURIComponent(o)}`}function P9(e){const o=[`const R = ${yp("react",e)};`,"function jsx(t,p,k){","if(k!==undefined){p={...p,key:k}}","const c=p.children;","delete p.children;","return Array.isArray(c)?R.createElement(t,p,...c):c!==undefined?R.createElement(t,p,c):R.createElement(t,p)","}","export{jsx,jsx as jsxs,jsx as jsxDEV};","export const Fragment=R.Fragment;"].join("");return`data:text/javascript,${encodeURIComponent(o)}`}function Wn(e,n,o,l,c){if(o&&o.length>0){const p=[e,...l||[]],g=[n,...c||[]],h=p.map((k,x)=>`(globalThis.__ggui__&&globalThis.__ggui__["${g[x]}"]||window["${k}"]||{})`),y=h.join(","),v=o.map(k=>`export const ${k} = M["${k}"];`).join(" "),j=h.length>1?`const M = Object.assign({}, ${y}); ${v} export default M;`:`const M = ${h[0]}; ${v} export default M;`;return`data:text/javascript,${encodeURIComponent(j)}`}const d=`const M = ${yp(n,e)} || {}; const handler = { get(_, key) { return M[key]; } }; export default new Proxy({}, handler);`;return`data:text/javascript,${encodeURIComponent(d)}`}function Z9(){const n=`const w = globalThis.__ggui__.wire; ${D9.map(o=>`export const ${o} = w.${o};`).join(" ")} export default w;`;return`data:text/javascript,${encodeURIComponent(n)}`}function G9(e,n){var d;const o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(`import\\s*(?:[A-Za-z_$][\\w$]*\\s*,\\s*)?\\{([^}]*)\\}\\s*from\\s*['"]${o}['"]`,"g"),c=new Set;let u;for(;(u=l.exec(e))!==null;)for(const p of u[1].split(",")){const g=(d=p.trim().split(/\s+as\s+/)[0])==null?void 0:d.trim();g!==void 0&&/^[A-Za-z_$][\w$]*$/.test(g)&&c.add(g)}return[...c]}function F9(e,n){const o=JSON.stringify(e),l=n.some(u=>/^[A-Z]/.test(u)),c=[];c.push(`var P=${o};`),c.push("function NS(){return(globalThis.__ggui__&&globalThis.__ggui__.gadgets&&globalThis.__ggui__.gadgets[P])||{};}"),c.push('function H(n){return function(){var f=NS()[n];if(typeof f!=="function")throw new Error("[gadget] export "+n+" from package "+P+" is not loaded — the package failed to load at iframe boot or is not registered on App.gadgets.");return f.apply(this,arguments);};}'),l&&(c.push("var R=globalThis.__ggui__&&globalThis.__ggui__.react;"),c.push('class GEB extends R.Component{constructor(p){super(p);this.state={e:null};}static getDerivedStateFromError(e){return{e:e};}render(){if(this.state.e)return R.createElement("div",{style:{padding:"8px",border:"1px solid #e0a0c0",borderRadius:"6px",color:"#a03070",font:"13px system-ui"}},"[gadget] "+this.props.g+" failed to render");return this.props.children;}}'),c.push('function C(n){return function(props){var Cmp=NS()[n];if(typeof Cmp!=="function")return R.createElement("div",{style:{padding:"8px",border:"1px solid #e0a0c0",borderRadius:"6px",color:"#a03070",font:"13px system-ui"}},"[gadget] component "+n+" from package "+P+" is not loaded");return R.createElement(GEB,{g:n},R.createElement(Cmp,props));};}'));for(const u of n){const d=/^[A-Z]/.test(u)?"C":"H";c.push(`export const ${u}=${d}(${JSON.stringify(u)});`)}return c.push("export default new Proxy({},{get:function(_,k){return NS()[k];}});"),`data:text/javascript,${encodeURIComponent(c.join(""))}`}function Y9(e,n){const o=n.reactGlobal??"__REACT",l=n.primitivesGlobal??"__GGUI_PRIMITIVES",c=n.componentsGlobal??"__GGUI_COMPONENTS",u=n.compositionsGlobal??"__GGUI_COMPOSITIONS",d=n.interactGlobal??"__GGUI_INTERACT",p=n.appComponentsGlobal??"__GGUI_APP_COMPONENTS",g=H9(o),h=P9(o);e=qt(e,"react/jsx-runtime",h),e=qt(e,"react/jsx-dev-runtime",h);const y=q9();e=qt(e,"react-dom",y),e=qt(e,"react",g);const v=[...I9,...U9,...L9,...Ev];e=qt(e,"@ggui-ai/design/primitives",Wn(l,"primitives",v,[c,u,d],["components","compositions","interact"])),e=qt(e,"@ggui-ai/design/components",Wn(c,"components",v,[l,u,d],["primitives","compositions","interact"])),e=qt(e,"@ggui-ai/design/compositions",Wn(u,"compositions",v,[l,c,d],["primitives","components","interact"])),e=qt(e,"@ggui-ai/design/interact",Wn(d,"interact",[...Ev])),e=qt(e,"@ggui-ai/design/templates",Wn(u,"compositions",v,[l,c],["primitives","components"])),e=qt(e,"@ggui-ai/design/app-components",Wn(p,"appComponents")),e=qt(e,"@ggui-ai/design/tokens",Wn("__GGUI_TOKENS","tokens",[...B9])),e=qt(e,"@ggui-ai/design",Wn(l,"primitives",v,[c,u,d],["components","compositions","interact"])),e=qt(e,"@ggui-ai/wire",Z9());const j=[...new Set(["@ggui-ai/gadgets",...n.gadgetPackages??[]])];for(const k of j){const x=G9(e,k);e=qt(e,k,F9(k,x))}return e}function K9(e,n){const o=n.reactBaseUrl??"https://esm.sh/react@18.2.0";return e=qt(e,"react/jsx-runtime",`${o}/jsx-runtime`),e=qt(e,"react/jsx-dev-runtime",`${o}/jsx-runtime`),e=qt(e,"react",o),e}function X9(e,n){switch(n.mode){case"data-url":return Y9(e,n);case"importmap":return K9(e,n)}}function J9(e){const n=e.split(";"),o=[],l=[];for(const c of n)c.trimStart().startsWith("import")?o.push(c):l.push(c);return o.length===0?e:o.join(";")+";"+l.join(";")}async function Q9(e){const n=new Blob([e],{type:"application/javascript"}),o=URL.createObjectURL(n);try{return await import(o)}finally{URL.revokeObjectURL(o)}}var W9=0;function eN(e){return`ggui-rcr-${e.replace(/[^a-z0-9]/gi,"")}`}var tN=1,aN=500,nN=class extends xc.Component{constructor(){super(...arguments);gn(this,"state",{error:null,catchCount:0,autoRetrying:!1});gn(this,"retryTimer",null)}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n){var l,c;const o=this.state.catchCount+1;this.setState({catchCount:o}),o<=tN?(this.setState({autoRetrying:!0}),this.retryTimer=setTimeout(()=>{this.setState({error:null,autoRetrying:!1})},aN)):(c=(l=this.props).onError)==null||c.call(l,n)}componentWillUnmount(){this.retryTimer&&clearTimeout(this.retryTimer)}render(){const{error:n,autoRetrying:o,catchCount:l}=this.state;return n?o?i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:24,minHeight:80,gap:8,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:13,color:"rgba(255,255,255,0.4)"},children:[i.jsx("div",{style:{width:16,height:16,border:"2px solid rgba(255,255,255,0.15)",borderTopColor:"rgba(255,255,255,0.5)",borderRadius:"50%",animation:"ggui-err-spin 0.6s linear infinite"}}),"Retrying...",i.jsx("style",{children:"@keyframes ggui-err-spin { to { transform: rotate(360deg); } }"})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 24px",minHeight:120,gap:12,textAlign:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[i.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"rgba(239, 68, 68, 0.1)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22},children:"!"}),i.jsx("div",{style:{fontSize:14,fontWeight:600,color:"rgba(255,255,255,0.8)"},children:"Something went wrong"}),i.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.4)",maxWidth:280,lineHeight:1.4},children:"This component encountered an error. Try asking for a different view."}),i.jsx("button",{onClick:()=>this.setState({error:null,catchCount:0}),style:{marginTop:4,padding:"8px 20px",borderRadius:8,border:"1px solid rgba(255,255,255,0.15)",background:"rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.7)",fontSize:13,fontWeight:500,cursor:"pointer"},children:"Retry"}),l>1&&i.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.2)"},children:n.message})]}):this.props.children}};function rN({code:e,props:n={},themeId:o,cssOverrides:l,fallback:c=i.jsx("div",{children:"Loading component..."}),onError:u}){const d=A.useId(),[p]=A.useState(()=>eN(d)||`ggui-rcr-${++W9}`),[g,h]=A.useState(null),[y,v]=A.useState(null),[j,k]=A.useState(!0);A.useEffect(()=>{if(!e||e.trim().length===0){h(null),k(!1);return}let E=!1;k(!0),v(null),h(null);async function z(){try{let w=e;if(e.startsWith("https://")){const te=await fetch(e);if(!te.ok)throw new Error(`Failed to fetch component code: ${te.status}`);w=await te.text()}const $=Jk(w),N=globalThis;let R={};try{R=await Bx(()=>import("./index-wrKS4JpJ.js").then(te=>te.i),[])}catch{}N.__ggui__={react:xc,reactDom:R,primitives:Uf,components:Vf,compositions:Hf,interact:qf,wire:kw},N.__REACT=xc,N.__GGUI_PRIMITIVES=Uf,N.__GGUI_COMPONENTS=Vf,N.__GGUI_COMPOSITIONS=Hf,N.__GGUI_INTERACT=qf;const _=J9($),S=X9(_,{mode:"data-url"}),C=await Q9(S);if(E)return;const I=C.default??Object.values(C).find(te=>typeof te=="function");if(!I)throw new Error("Module does not export a default component");h(()=>I),v(null)}catch(w){if(E)return;const $=w instanceof Error?w:new Error(String(w));v($),h(null),u==null||u($)}finally{E||k(!1)}}return z(),()=>{E=!0}},[e]);const x=o?hp(o,p):R9(p);return!e||e.trim().length===0?i.jsx("div",{children:c}):j?i.jsx("div",{children:c}):y?i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 24px",minHeight:120,gap:12,textAlign:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[i.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"rgba(239, 68, 68, 0.1)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22},children:"!"}),i.jsx("div",{style:{fontSize:14,fontWeight:600,color:"rgba(255,255,255,0.8)"},children:"Failed to load component"}),i.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.4)",maxWidth:280,lineHeight:1.4},children:y.message})]}):g?i.jsxs("div",{className:p,children:[i.jsxs("style",{children:[x,l??""]}),i.jsx(nN,{onError:u,children:i.jsx(g,{...n})},e.length)]}):i.jsx("div",{children:c})}var Cv="ggui-preview-keyframes",iN=`@keyframes ggui-preview-shimmer {
|
|
215
215
|
0% { transform: translateX(-100%); }
|
|
216
216
|
100% { transform: translateX(100%); }
|
|
217
217
|
}`,oN=`@keyframes ggui-preview-caret {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as s,r as c}from"./index
|
|
1
|
+
import{g as s,r as c}from"./index--YmInJT8.js";function f(t,a){for(var o=0;o<a.length;o++){const e=a[o];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const n=Object.getOwnPropertyDescriptor(e,r);n&&Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var i=c();const p=s(i),g=f({__proto__:null,default:p},[i]);export{g as i};
|
package/dist/index.html
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
Single-letter mark reads cleanly at 16px tab size.
|
|
21
21
|
-->
|
|
22
22
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Cpath d='M 0 0 H 50 V 25 H 25 V 50 H 0 Z' fill='%23292929'/%3E%3Crect x='33' y='33' width='17' height='17' fill='%23f4f3ed'/%3E%3C/svg%3E" />
|
|
23
|
-
<script type="module" crossorigin src="/assets/index
|
|
23
|
+
<script type="module" crossorigin src="/assets/index--YmInJT8.js"></script>
|
|
24
24
|
<link rel="stylesheet" crossorigin href="/assets/index-CHgj9yqx.css">
|
|
25
25
|
</head>
|
|
26
26
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggui-ai/console",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Operator console for a self-hosted @ggui-ai/mcp-server instance — a single-origin admin and devtools surface served by the server itself.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ggui",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"react": "^19.0.0",
|
|
29
29
|
"react-dom": "^19.0.0",
|
|
30
|
-
"@ggui-ai/design": "0.6.
|
|
31
|
-
"@ggui-ai/
|
|
32
|
-
"@ggui-ai/
|
|
30
|
+
"@ggui-ai/design": "0.6.2",
|
|
31
|
+
"@ggui-ai/project-config": "0.6.2",
|
|
32
|
+
"@ggui-ai/react": "0.6.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@testing-library/react": "^16.0.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"typescript": "^5.0.0",
|
|
43
43
|
"vite": "^6.4.3",
|
|
44
44
|
"vitest": "^3.2.6",
|
|
45
|
-
"@ggui-ai/protocol": "0.6.
|
|
45
|
+
"@ggui-ai/protocol": "0.6.2"
|
|
46
46
|
},
|
|
47
47
|
"repository": {
|
|
48
48
|
"type": "git",
|