@bendyline/molen-tooling 0.0.14 → 0.0.15
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.
- package/dist/capture/harness.js +76 -76
- package/dist/capture/worldgen-preview.js +1 -1
- package/dist/docs-src/guide/aircraft.md +13 -3
- package/dist/docs-src/guide/dioramas.md +7 -0
- package/dist/docs-src/guide/graphics-performance.md +18 -7
- package/dist/docs-src/guide/terrain.md +10 -4
- package/dist/templates/index.json +11 -11
- package/package.json +7 -7
|
@@ -4788,7 +4788,7 @@ ${c}
|
|
|
4788
4788
|
}`,h;try{h=new u(...o,d)(...a)}catch(f){throw new sn(`this schema (generated code failed to evaluate: ${f.message})`)}return e?.debug&&(h.code=l),h.definite=i.definite,h}function Dt(n,e){for(let[i,r]of n.constants)if(r===e)return i;let t=`c${n.constantCounter++}`;return n.constants.set(t,e),t}function lh(n,e){return n.definite=!1,Dt(n,e)}function Mt(n){return`v${n.varCounter++}`}function GY(n,e){let t=n._zod.run({value:e,issues:[]},{});if(t&&typeof t.then=="function")return ns;let i=t;return i.issues.length===0?i.value:ns}function Fr(n,e,t,i,r=!0){let s=n.content.length,o=e.constants.size,a=e.constantCounter,c=e.varCounter;try{return ci(n,e,t,i,r)}catch(l){if(!(l instanceof sn)||!l.islandable)throw l;if(n.content.length=s,e.constants.size>o){let u=Array.from(e.constants.keys()).slice(o);for(let d of u)e.constants.delete(d)}return e.constantCounter=a,e.varCounter=c,VY(n,e,t,i)}}function VY(n,e,t,i){e.definite=!1;let r=Dt(e,t),s=Dt(e,GY),o=Mt(e);return n.write(`const ${o} = ${s}(${r}, ${i});`),n.write(`if (${o} === INVALID) return INVALID;`),o}var HY=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function jY(n,e,t,i){let r=t._zod.def.checks;if(!r||r.length===0)return i;let s=i;for(let o of r){let a=o._zod.def;if(a.when&&!HY.has(a.check))throw new sn('check with a custom "when" condition');switch(a.check){case"greater_than":QY(n,e,a,s);break;case"less_than":WY(n,e,a,s);break;case"multiple_of":qY(n,e,a,s);break;case"number_format":TG(n,a,s);break;case"min_length":{let c=ah(a.minimum,"min_length"),l=$B(n,e,s,`${s}.length >= ${c} && ${s}.length < ${a.minimum*2}`);n.write(`if (${l} < ${c}) return INVALID;`);break}case"max_length":{let c=ah(a.maximum,"max_length"),l=$B(n,e,s,`${s}.length > ${c}`);n.write(`if (${l} > ${c}) return INVALID;`);break}case"length_equals":{let c=ah(a.length,"length_equals"),l=$B(n,e,s,`${s}.length >= ${c} && ${s}.length <= ${a.length*2}`);n.write(`if (${l} !== ${c}) return INVALID;`);break}case"min_size":n.write(`if (${s}.size < ${ah(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":n.write(`if (${s}.size > ${ah(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":n.write(`if (${s}.size !== ${ah(a.size,"size_equals")}) return INVALID;`);break;case"string_format":s=MG(n,e,a,s);break;case"custom":s=eee(n,e,o,s);break;case"bigint_format":KY(n,a,s);break;case"mime_type":XY(n,e,a,s);break;case"property":JY(n,e,a,s);break;case"properties":ZY(n,e,a,s);break;case"overwrite":{let c=Mt(e);YY(n,e,o,s,c),s=c;break}default:throw new sn(`check type ${a.check}`)}}return s}function $B(n,e,t,i){let r=Dt(e,ih),s=Mt(e);return n.write(`const ${s} = typeof ${t} === "string" && ${i} ? ${r}(${t}) : ${t}.length;`),s}function ah(n,e){if(typeof n!="number"||!Number.isFinite(n))throw new sn(`${e} bound of type ${typeof n}`);return`${n}`}function EG(n,e){if(typeof e=="bigint")return`${e}n`;if(typeof e=="number"){if(Number.isNaN(e))throw new sn("comparison check with NaN bound");return`${e}`}if(e instanceof Date){if(Number.isNaN(e.getTime()))throw new sn("comparison check with Invalid Date bound");return Dt(n,e)}throw new sn(`comparison check bound of type ${typeof e}`)}function QY(n,e,t,i){let r=t.inclusive?"<":"<=";n.write(`if (${i} ${r} ${EG(e,t.value)}) return INVALID;`)}function WY(n,e,t,i){let r=t.inclusive?">":">=";n.write(`if (${i} ${r} ${EG(e,t.value)}) return INVALID;`)}function qY(n,e,t,i){if(typeof t.value=="bigint"){if(t.value===BigInt(0))throw new sn("multiple_of check with a zero divisor");n.write(`if (${i} % ${t.value}n !== 0n) return INVALID;`)}else{let r=Dt(e,rb);n.write(`if (${r}(${i}, ${ah(t.value,"multiple_of")}) !== 0) return INVALID;`)}}function TG(n,e,t){let i=e.format;switch(i){case"safeint":n.write(`if (!Number.isSafeInteger(${t})) return INVALID;`);break;case"int32":n.write(`if (!Number.isInteger(${t}) || ${t} < -2147483648 || ${t} > 2147483647) return INVALID;`);break;case"uint32":n.write(`if (!Number.isInteger(${t}) || ${t} < 0 || ${t} > 4294967295) return INVALID;`);break;case"float32":n.write(`if (!Number.isFinite(${t}) || ${t} < -3.4028234663852886e38 || ${t} > 3.4028234663852886e38) return INVALID;`);break;case"float64":n.write(`if (!Number.isFinite(${t})) return INVALID;`);break;default:throw new sn(`number format ${i}`)}}function KY(n,e,t){let i=e.format;if(i)switch(i){case"int64":n.write(`if (${t} < -9223372036854775808n || ${t} > 9223372036854775807n) return INVALID;`);break;case"uint64":n.write(`if (${t} < 0n || ${t} > 18446744073709551615n) return INVALID;`);break;default:throw new sn(`bigint format ${i}`)}}function XY(n,e,t,i){let r=t.mime;if(r&&r.length>0){let s=Dt(e,new Set(r));n.write(`if (!${s}.has(${i}.type)) return INVALID;`)}}function ZY(n,e,t,i){if(t.when)throw new sn('check with a custom "when" condition');n.write(`if (${i} == null) return INVALID;`);let r=t.shape;for(let s of Reflect.ownKeys(r)){let o=typeof s=="symbol"?Dt(e,s):es(s),a=Mt(e);n.write(`const ${a} = ${i}[${o}];`),Fr(n,e,r[s],a,!1)}}function JY(n,e,t,i){let r=`${i}[${JSON.stringify(t.property)}]`;ci(n,e,t.schema,r)}function YY(n,e,t,i,r){let s=t._zod.def.tx;if(!s)throw new sn("overwrite check without a transform function");if(uh(s))throw new da("z.compile: async overwrite transforms are not supported");let o=Dt(e,s);n.write(`const ${r} = ${o}(${i});`)}function zB(){throw new Cs}function HB(n){this.issues.push(n)}function eee(n,e,t,i){let r=t._zod.def;if(r.fn){if(uh(r.fn))throw new da("z.compile: async .refine() predicates are not supported");let s=lh(e,r.fn),o=Dt(e,zB),a=Mt(e);return n.write(`const ${a} = ${s}(${i});`),n.write(`if (${a} instanceof Promise) ${o}();`),n.write(`if (!${a}) return INVALID;`),i}if(t._zod.check){if(uh(t._zod.check))throw new da("z.compile: async .superRefine() / check functions are not supported");let s=t._zod.check,a=lh(e,l=>{let u={value:l,issues:[],addIssue:HB};return s(u)instanceof Promise&&zB(),u.issues.length===0?u.value:ns}),c=Mt(e);return n.write(`const ${c} = ${a}(${i});`),n.write(`if (${c} === INVALID) return INVALID;`),c}throw new sn("custom check without a predicate or check function")}var tee=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function MG(n,e,t,i,r=!0){let s=t.format;if(s==="base64"){let l=Dt(e,wb);return n.write(`if (!${l}(${i})) return INVALID;`),i}if(s==="base64url"){let l=Dt(e,N_);return n.write(`if (!${l}(${i})) return INVALID;`),i}if(s==="jwt"){let l=Dt(e,F_),u=Dt(e,t.alg??null);return n.write(`if (!${l}(${i}, ${u})) return INVALID;`),i}if(s==="ipv6"){let l=Dt(e,_b);return n.write(`if (!${l}(${i})) return INVALID;`),i}if(s==="cidrv6"){let l=Dt(e,R_);return n.write(`if (!${l}(${i})) return INVALID;`),i}if(s==="credit_card"){let l=Dt(e,k_);return n.write(`if (!${l}(${i})) return INVALID;`),i}if(s==="iban"){let l=Dt(e,D_);return n.write(`if (!${l}(${i})) return INVALID;`),i}let o=t;if(s==="url"||s==="httpurl"||o.normalize||o.hostname!==void 0||o.protocol!==void 0){let l=Dt(e,M_),u=Dt(e,t),d=Mt(e),h=Mt(e);if(n.write(`const ${d} = ${i}.trim();`),n.write(`const ${h} = ${l}(${d}, ${u});`),n.write(`if (typeof ${h} === "number") return INVALID;`),o.hostname!==void 0){let g=Dt(e,I_);n.write(`if (!${g}(${h}, ${u}.hostname)) return INVALID;`)}if(o.protocol!==void 0){let g=Dt(e,C_);n.write(`if (!${g}(${h}, ${u}.protocol)) return INVALID;`)}if(!r)return null;let f=Mt(e),p=o.normalize?`${h}.href`:`${Dt(e,xb)}(${d})`;return n.write(`const ${f} = ${p};`),f}let a=t.fn;if(a){if(uh(a))throw new sn(`async string format ${s}`);let l=Dt(e,a);return n.write(`if (!${l}(${i})) return INVALID;`),i}if(tee.has(s)&&t.pattern){let l=Dt(e,t.pattern);return n.write(`${l}.lastIndex = 0;`),n.write(`if (!${l}.test(${i})) return INVALID;`),i}let c=t.format;switch(c){case"regex":throw new sn("regex format without a pattern");case"lowercase":n.write(`if (${i} !== ${i}.toLowerCase()) return INVALID;`);break;case"uppercase":n.write(`if (${i} !== ${i}.toUpperCase()) return INVALID;`);break;case"includes":n.write(`if (!${i}.includes(${es(t.includes)})) return INVALID;`);break;case"starts_with":{let l=t.prefix;n.write(`if (${i}.slice(0, ${l.length}) !== ${es(l)}) return INVALID;`);break}case"ends_with":{let l=t.suffix;n.write(`if (${i}.slice(-${l.length}) !== ${es(l)}) return INVALID;`);break}default:throw new sn(`string format ${c}`)}return i}function ci(n,e,t,i,r=!0){let s=t._zod.def,o=s.type;if(s.coerce)throw new sn(`coercion (z.coerce.${o}())`);let a=r||!!s.checks?.length,c;switch(o){case"string":c=nee(n,e,t,i,a);break;case"number":c=iee(n,t,i);break;case"boolean":c=ree(n,i);break;case"bigint":c=see(n,t,i);break;case"symbol":c=oee(n,i);break;case"undefined":c=aee(n,i);break;case"null":c=cee(n,i);break;case"any":case"unknown":c=i;break;case"never":n.write("return INVALID;"),c=i;break;case"void":c=lee(n,i);break;case"nan":c=uee(n,i);break;case"date":c=dee(n,i);break;case"object":c=hee(n,e,t,i,a);break;case"optional":c=fee(n,e,t,i,a);break;case"nullable":c=gee(n,e,t,i,a);break;case"array":c=Aee(n,e,t,i,a);break;case"literal":c=bee(n,e,t,i);break;case"enum":c=yee(n,e,t,i);break;case"readonly":{let l=_G(n,e,t,i),u=Mt(e);n.write(`const ${u} = Object.freeze(${l});`),c=u;break}case"success":_G(n,e,t,i),c="true";break;case"default":case"prefault":c=vee(n,e,t,i);break;case"nonoptional":c=xee(n,e,t,i);break;case"tuple":c=_ee(n,e,t,i);break;case"union":c=wee(n,e,t,i);break;case"intersection":c=Tee(n,e,t,i);break;case"record":c=Mee(n,e,t,i);break;case"map":c=Cee(n,e,t,i);break;case"set":c=Ree(n,e,t,i);break;case"file":c=Bee(n,i);break;case"template_literal":c=Nee(n,e,t,i);break;case"lazy":c=kee(n,e,t,i);break;case"pipe":c=Dee(n,e,t,i);break;case"custom":c=Fee(n,e,t,i);break;case"transform":c=Lee(n,e,t,i);break;case"catch":c=Oee(n,e,t,i);break;default:throw new sn(`schema type ${o}`)}return c===null?null:jY(n,e,t,c)}function nee(n,e,t,i,r=!0){n.write(`if (typeof ${i} !== "string") return INVALID;`);let s=t._zod.def;return s.format===void 0?i:MG(n,e,s,i,r)}function iee(n,e,t){n.write(`if (typeof ${t} !== "number" || !Number.isFinite(${t})) return INVALID;`);let i=e._zod.def;return i.check==="number_format"&&i.format&&TG(n,{format:i.format},t),t}function ree(n,e){return n.write(`if (typeof ${e} !== "boolean") return INVALID;`),e}function see(n,e,t){n.write(`if (typeof ${t} !== "bigint") return INVALID;`);let i=e._zod.def;if(i.format)switch(i.format){case"int64":n.write(`if (${t} < -9223372036854775808n || ${t} > 9223372036854775807n) return INVALID;`);break;case"uint64":n.write(`if (${t} < 0n || ${t} > 18446744073709551615n) return INVALID;`);break}return t}function oee(n,e){return n.write(`if (typeof ${e} !== "symbol") return INVALID;`),e}function aee(n,e){return n.write(`if (${e} !== undefined) return INVALID;`),e}function cee(n,e){return n.write(`if (${e} !== null) return INVALID;`),e}function lee(n,e){return n.write(`if (${e} !== undefined) return INVALID;`),e}function uee(n,e){return n.write(`if (typeof ${e} !== "number" || !Number.isNaN(${e})) return INVALID;`),e}function dee(n,e){return n.write(`if (!(${e} instanceof Date) || Number.isNaN(${e}.getTime())) return INVALID;`),e}function hee(n,e,t,i,r=!0){let s=t._zod.def;n.write(`if (typeof ${i} !== "object" || ${i} === null || Array.isArray(${i})) return INVALID;`);let o=s.shape,a=Object.keys(o),c=Object.getOwnPropertySymbols(o),l=c.length?[...a,...c]:a,u=y=>typeof y=="symbol"?Dt(e,y):es(y),d=y=>typeof y=="symbol"?`[${u(y)}]`:es(y),h=o;if(a.includes("__proto__"))throw new sn('object shape key "__proto__"');let f=new Map;for(let y of l){let v=h[y],x=u(y),w=Mt(e);if(n.write(`const ${w} = ${i}[${x}];`),v._zod.optin!==void 0){let _=Mt(e);n.write(`let ${_} = (() => {`),n.indented(E=>{let S=Fr(E,e,v,w);E.write(`return ${S};`)}),n.write("})();"),v._zod.optout==="optional"?(n.write(`if (${_} === INVALID) {`),n.indented(E=>{E.write(`if (${x} in ${i}) return INVALID;`),E.write(`${_} = undefined;`)}),n.write("}")):n.write(`if (${_} === INVALID) return INVALID;`),f.set(y,_)}else{mee(v)&&n.write(`if (!(${x} in ${i})) return INVALID;`);let _=Fr(n,e,v,w,r);_!==null&&f.set(y,_)}}let p=s.catchall,g="none";if(p){let y=p._zod.def.type;if(y==="never"){let v=a.map(x=>`k !== ${es(x)}`).join(" && ")||"true";n.write(`for (const k in ${i}) {`),n.indented(x=>{x.write(`if (${v}) return INVALID;`)}),n.write("}")}else(y==="unknown"||y==="any")&&!p._zod.def.checks?.length?g="passthrough":g="schema"}let b=Mt(e),A=l.some(y=>xG(h[y])||GB(h[y]));if(!r){if(g==="schema"){let y=a.length>0?Dt(e,new Set(a)):null;n.write(`for (const k in ${i}) {`),n.indented(v=>{v.write('if (k === "__proto__") continue;'),y&&v.write(`if (${y}.has(k)) continue;`);let x=Mt(e);v.write(`const ${x} = ${i}[k];`),Fr(v,e,p,x,!1)}),n.write("}")}return null}if(A){n.write(`const ${b} = {};`);for(let y of l){let v=u(y),x=f.get(y);GB(h[y])?n.write(`if (${v} in ${i}) ${b}[${v}] = ${x};`):xG(h[y])?n.write(`if (${x} !== undefined || ${v} in ${i}) ${b}[${v}] = ${x};`):n.write(`${b}[${v}] = ${x};`)}}else{let y=l.map(v=>`${d(v)}: ${f.get(v)}`).join(", ");n.write(`const ${b} = { ${y} };`)}if(g!=="none"){let y=a.length>0?Dt(e,new Set(a)):null;n.write(`for (const k in ${i}) {`),n.indented(v=>{if(v.write('if (k === "__proto__") continue;'),y&&v.write(`if (${y}.has(k)) continue;`),g==="passthrough")v.write(`${b}[k] = ${i}[k];`);else{let x=Mt(e);v.write(`const ${x} = ${i}[k];`);let w=Fr(v,e,p,x);v.write(`${b}[k] = ${w};`)}}),n.write("}")}return b}function fee(n,e,t,i,r=!0){let s=t._zod.def;if(pee(t))return ci(n,e,s.innerType,i,r);if(s.innerType._zod.optin==="defaulted"){let a=Mt(e),c=Mt(e);return n.write(`let ${a};`),n.write(`if (${i} === undefined) {`),n.indented(l=>{l.write(`const ${c} = (() => {`),l.indented(u=>{let d=ci(u,e,s.innerType,i);u.write(`return ${d};`)}),l.write("})();"),l.write(`if (${c} !== INVALID) ${a} = ${c};`)}),n.write("} else {"),n.indented(l=>{let u=ci(l,e,s.innerType,i);l.write(`${a} = ${u};`)}),n.write("}"),a}let o=r?Mt(e):null;return o&&n.write(`let ${o};`),n.write(`if (${i} !== undefined) {`),n.indented(a=>{let c=ci(a,e,s.innerType,i,r);o&&c!==null&&a.write(`${o} = ${c};`)}),n.write("}"),o}function pee(n){return n._zod.traits?.has("$ZodExactOptional")===!0}function mee(n){return n._zod.optin===void 0&&ch(n)}function ch(n){if(n._zod.def.coerce)return!0;let e=n._zod.def;switch(e.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return e.innerType?ch(e.innerType):!1;case"literal":return!!e.values?.includes(void 0);case"enum":return!!n._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return e.innerType?ch(e.innerType):!0;case"catch":return!0;case"union":return e.options?e.options.some(ch):!0;case"intersection":return!e.left||!e.right?!0:ch(e.left)&&ch(e.right);case"pipe":return e.in?ch(e.in):!0;default:return!0}}function GB(n){return n._zod.optin==="optional"&&n._zod.optout==="optional"}function xG(n){return(n._zod.optin!=="defaulted"||n._zod.optout==="optional")&&Fp(n)}function Fp(n){let e=n._zod.def;switch(e.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!e.values?.includes(void 0);case"enum":return!!n._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return e.innerType?Fp(e.innerType):!0;case"union":return e.options?e.options.some(Fp):!0;case"intersection":return!e.left||!e.right||Fp(e.left)||Fp(e.right);case"pipe":return e.out?Fp(e.out):!0;default:return!0}}function gee(n,e,t,i,r=!0){let s=t._zod.def,o=r?Mt(e):null;return o&&n.write(`let ${o} = null;`),n.write(`if (${i} !== null) {`),n.indented(a=>{let c=ci(a,e,s.innerType,i,r);o&&c!==null&&a.write(`${o} = ${c};`)}),n.write("}"),o}function Aee(n,e,t,i,r=!0){let s=t._zod.def;n.write(`if (!Array.isArray(${i})) return INVALID;`);let o=r?Mt(e):null,a=Mt(e),c=Mt(e);return o&&n.write(`const ${o} = new Array(${i}.length);`),n.write(`for (let ${a} = 0; ${a} < ${i}.length; ${a}++) {`),n.indented(l=>{l.write(`const ${c} = ${i}[${a}];`);let u=Fr(l,e,s.element,c,r);o&&u!==null&&l.write(`${o}[${a}] = ${u};`)}),n.write("}"),o}function bee(n,e,t,i){let s=t._zod.def.values;if(s.length!==1){let a=Dt(e,new Set(s));return n.write(`if (!${a}.has(${i})) return INVALID;`),i}let o=s[0];if(typeof o=="number"&&Number.isNaN(o)){let a=Dt(e,new Set(s));return n.write(`if (!${a}.has(${i})) return INVALID;`),i}if(typeof o=="string")n.write(`if (${i} !== ${es(o)}) return INVALID;`);else if(typeof o=="number"||typeof o=="boolean")n.write(`if (${i} !== ${o}) return INVALID;`);else if(o===null)n.write(`if (${i} !== null) return INVALID;`);else if(o===void 0)n.write(`if (${i} !== undefined) return INVALID;`);else if(typeof o=="bigint")n.write(`if (${i} !== ${o}n) return INVALID;`);else throw new sn(`literal type ${typeof o}`);return i}function yee(n,e,t,i){let r=t._zod.values;if(!r)throw new sn("enum schema without enumerated values");let s=Dt(e,r);return n.write(`if (!${s}.has(${i})) return INVALID;`),i}function _G(n,e,t,i){let r=t._zod.def;return ci(n,e,r.innerType,i)}function vee(n,e,t,i){let r=t._zod.def,o=Object.getOwnPropertyDescriptor(t._zod.def,"defaultValue")?()=>t._zod.def.defaultValue:void 0;if(t._zod.def.type==="prefault"){if(!o)return ci(n,e,r.innerType,i);let c=Dt(e,o),l=Mt(e);return n.write(`let ${l} = ${i};`),n.write(`if (${i} === undefined) ${l} = ${c}();`),ci(n,e,r.innerType,l)}let a=Mt(e);if(o){let c=Dt(e,o),l=Dt(e,sb);n.write(`let ${a};`),n.write(`if (${i} === undefined) {`),n.indented(u=>{u.write(`${a} = ${l}(${c}());`)}),n.write("} else {"),n.indented(u=>{let d=ci(u,e,r.innerType,i);u.write(`${a} = ${d} === undefined ? ${l}(${c}()) : ${d};`)}),n.write("}")}else n.write(`let ${a};`),n.write(`if (${i} !== undefined) {`),n.indented(c=>{let l=ci(c,e,r.innerType,i);c.write(`${a} = ${l};`)}),n.write("}");return a}function xee(n,e,t,i){let r=t._zod.def,s=ci(n,e,r.innerType,i),o=Mt(e);return n.write(`const ${o} = ${s};`),n.write(`if (${o} === undefined) return INVALID;`),o}function _ee(n,e,t,i){let r=t._zod.def,s=r.items,o=r.rest;n.write(`if (!Array.isArray(${i})) return INVALID;`);let a=wG(s,"optin"),c=wG(s,"optout");o?n.write(`if (${i}.length < ${a}) return INVALID;`):n.write(`if (${i}.length < ${a} || ${i}.length > ${s.length}) return INVALID;`);let l=Mt(e);n.write(`const ${l} = [];`);for(let u=0;u<s.length;u++){let d=s[u];if(u>=c)n.write(`if (${l}.length === ${u}) {`),n.indented(h=>{h.write(`if (${u} < ${i}.length) {`),h.indented(f=>{let p=Mt(e);f.write(`const ${p} = ${i}[${u}];`);let g=Fr(f,e,d,p);f.write(`${l}[${u}] = ${g};`)}),h.write("} else {"),h.indented(f=>{if(GB(d)){f.write(`${l}.length = ${u};`);return}let p=Mt(e),g=Mt(e);f.write(`const ${p} = undefined;`),f.write(`const ${g} = (() => {`),f.indented(b=>{let A=Fr(b,e,d,p);b.write(`return ${A};`)}),f.write("})();"),f.write(`if (${g} === INVALID || ${g} === undefined) ${l}.length = ${u};`),f.write(`else ${l}[${u}] = ${g};`)}),h.write("}")}),n.write("}");else{let h=Mt(e);n.write(`const ${h} = ${i}[${u}];`);let f=Fr(n,e,d,h);n.write(`${l}[${u}] = ${f};`)}}if(o){let u=Mt(e),d=Mt(e);n.write(`for (let ${u} = ${s.length}; ${u} < ${i}.length; ${u}++) {`),n.indented(h=>{h.write(`const ${d} = ${i}[${u}];`);let f=Fr(h,e,o,d);h.write(`${l}[${u}] = ${f};`)}),n.write("}")}return l}function wG(n,e){for(let t=n.length-1;t>=0;t--)if(!(e==="optin"?n[t]._zod.optin!==void 0:n[t]._zod.optout==="optional"))return t+1;return 0}function wee(n,e,t,i){let r=t._zod.def,s=r.options;if(r.discriminator)return See(n,e,r,i);if(r.inclusive===!1)throw new sn("exclusive unions (z.xor)");if(s.length===0)return n.write("return INVALID;"),i;if(s.length===1)return ci(n,e,s[0],i);if(s.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(s.flatMap(u=>u._zod.def.values)),l=Dt(e,c);return n.write(`if (!${l}.has(${i})) return INVALID;`),i}let a=Mt(e);n.write(`let ${a};`);for(let c=0;c<s.length;c++){let l=s[c];c===0?n.write(`${a} = (() => {`):n.write(`if (${a} === INVALID) ${a} = (() => {`),n.indented(u=>{let d=ci(u,e,l,i);u.write(`return ${d};`)}),n.write("})();")}return n.write(`if (${a} === INVALID) return INVALID;`),a}function See(n,e,t,i){if(t.unionFallback)throw new sn("discriminated union with unionFallback");if(t.options.length===0)return n.write("return INVALID;"),i;let r=Mt(e),s=Mt(e);n.write(`const ${r} = ${i}?.[${es(t.discriminator)}];`),n.write(`let ${s};`);let o=!0,a=new Set;for(let c of t.options){let l=c._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new sn("discriminated union option without static discriminator values");for(let h of l){if(a.has(h))throw new sn(`duplicate discriminator value ${String(h)}`);a.add(h)}let u=Array.from(l,h=>Eee(e,r,h)),d=o?"if":"else if";n.write(`${d} (${u.join(" || ")}) {`),n.indented(h=>{let f=ci(h,e,c,i);h.write(`${s} = ${f};`)}),n.write("}"),o=!1}return n.write("else { return INVALID; }"),s}function Eee(n,e,t){if(typeof t=="string")return`${e} === ${es(t)}`;if(typeof t=="number")return Number.isNaN(t)?`Number.isNaN(${e})`:`${e} === ${t}`;if(typeof t=="boolean")return`${e} === ${t}`;if(t===null)return`${e} === null`;if(t===void 0)return`${e} === undefined`;if(typeof t=="bigint")return`${e} === ${t}n`;if(typeof t=="symbol"){let i=Dt(n,t);return`${e} === ${i}`}throw new sn(`literal discriminator value ${String(t)}`)}function Tee(n,e,t,i){let r=t._zod.def;e.definite=!1;let s=Fr(n,e,r.left,i),o=Fr(n,e,r.right,i),a=Dt(e,Np),c=Mt(e);return n.write(`const ${c} = ${a}(${s}, ${o});`),n.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function Mee(n,e,t,i){let r=t._zod.def,s=Dt(e,Eo);n.write(`if (!${s}(${i})) return INVALID;`);let o=Mt(e),a=Mt(e),c=Mt(e);n.write(`const ${o} = {};`);let l=r,u=l.partial?void 0:r.keyType._zod.values;if(u){let f=[];for(let g of u){if(!(typeof g=="string"||typeof g=="number"||typeof g=="symbol"))throw new sn(`record key value ${String(g)}`);let b=typeof g=="number"?g.toString():g;if(b==="__proto__")throw new sn('record key "__proto__"');f.push(b);let A=Dt(e,g),y=ci(n,e,r.keyType,A),v=Mt(e);n.write(`const ${v} = ${i}[${Iee(e,b)}];`);let x=Fr(n,e,r.valueType,v);n.write(`${o}[${y}] = ${x};`)}let p=Dt(e,new Set(f));return n.write(`for (const ${a} in ${i}) {`),n.indented(g=>{g.write(`if (${p}.has(${a})) continue;`),l.mode==="loose"?g.write(`if (${a} !== "__proto__") ${o}[${a}] = ${i}[${a}];`):g.write("return INVALID;")}),n.write("}"),o}let d=r.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let f=r.mode==="loose",p=Y_(r.keyType);p.definite===!1&&(e.definite=!1);let g=Dt(e,p),b=Dt(e,rl),A=Mt(e);return SG(n,e,i,a,y=>{y.write(`let ${A} = ${g}(${a});`),y.write(`if (${A} === INVALID && typeof ${a} === "string" && ${b}.test(${a})) ${A} = ${g}(Number(${a}));`),f?y.write(`if (${A} === INVALID) { ${o}[${a}] = ${i}[${a}]; continue; }`):y.write(`if (${A} === INVALID) return INVALID;`),y.write(`if (${A} === "__proto__") continue;`);let v=Mt(e);y.write(`const ${v} = ${i}[${a}];`);let x=Fr(y,e,r.valueType,v);y.write(`${o}[${A}] = ${x};`)}),o}return SG(n,e,i,a,f=>{f.write(`const ${c} = ${i}[${a}];`);let p=Fr(f,e,r.valueType,c);f.write(`${o}[${a}] = ${p};`)},"return INVALID;"),o}function SG(n,e,t,i,r,s){let o=Dt(e,Object.prototype.propertyIsEnumerable),a=Mt(e),c=Mt(e),l=Mt(e);n.write(`const ${a} = Object.getOwnPropertySymbols(${t});`),n.write(`const ${c} = Object.getOwnPropertyNames(${t});`),n.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`),n.indented(u=>{u.write(`const ${i} = ${c}[${l}];`),u.write(`if (${i} === "__proto__" || !${o}.call(${t}, ${i})) continue;`),r(u)}),n.write("}"),n.write(`for (let ${l} = 0; ${l} < ${a}.length; ${l}++) {`),n.indented(u=>{u.write(`const ${i} = ${a}[${l}];`),u.write(`if (!${o}.call(${t}, ${i})) continue;`),s?u.write(s):r(u)}),n.write("}")}function Iee(n,e){return typeof e=="string"?es(e):Dt(n,e)}function Cee(n,e,t,i){let r=t._zod.def;n.write(`if (!(${i} instanceof Map)) return INVALID;`);let s=Mt(e),o=Mt(e),a=Mt(e);return n.write(`const ${s} = new Map();`),n.write(`for (const [${o}, ${a}] of ${i}) {`),n.indented(c=>{let l=ci(c,e,r.keyType,o),u=ci(c,e,r.valueType,a);c.write(`${s}.set(${l}, ${u});`)}),n.write("}"),s}function Ree(n,e,t,i){let r=t._zod.def;n.write(`if (!(${i} instanceof Set)) return INVALID;`);let s=Mt(e),o=Mt(e);return n.write(`const ${s} = new Set();`),n.write(`for (const ${o} of ${i}) {`),n.indented(a=>{let c=ci(a,e,r.valueType,o);a.write(`${s}.add(${c});`)}),n.write("}"),s}function Bee(n,e){return n.write(`if (!(${e} instanceof File)) return INVALID;`),e}function Nee(n,e,t,i){n.write(`if (typeof ${i} !== "string") return INVALID;`);let r=t._zod.pattern;if(r){let s=Dt(e,r);n.write(`${s}.lastIndex = 0;`),n.write(`if (!${s}.test(${i})) return INVALID;`)}return i}function kee(n,e,t,i){let r=t._zod.def,s=lh(e,r.getter),o=Dt(e,{parser:null});n.write(`if (!${o}.parser) {`),n.indented(c=>{c.write(`const inner = ${s}();`),c.write(`${o}.parser = function(input) {`),c.indented(l=>{l.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),l.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),n.write("}");let a=Mt(e);return n.write(`const ${a} = ${o}.parser(${i});`),n.write(`if (${a} === INVALID) return INVALID;`),a}function Dee(n,e,t,i){let r=t._zod.def,s=ci(n,e,r.in,i);if(r.transform){if(uh(r.transform))throw new da("z.compile: async transforms in pipes are not supported");let o=r.transform,c=lh(e,u=>{let d={value:u,issues:[],addIssue:HB},h=o(u,d);return h instanceof Promise?ns:d.issues.length===0?h:ns}),l=Mt(e);return n.write(`const ${l} = ${c}(${s});`),n.write(`if (${l} === INVALID) return INVALID;`),ci(n,e,r.out,l)}else return ci(n,e,r.out,s)}function uh(n){return typeof n=="function"&&(n.constructor.name==="AsyncFunction"||n[Symbol.toStringTag]==="AsyncFunction")}function Fee(n,e,t,i){let r=t._zod.def;if(r.fn){if(uh(r.fn))throw new da("z.compile: async custom predicates are not supported");let s=lh(e,r.fn),o=Dt(e,zB),a=Mt(e);n.write(`const ${a} = ${s}(${i});`),n.write(`if (${a} instanceof Promise) ${o}();`),n.write(`if (!${a}) return INVALID;`)}else throw new sn("custom schema without a predicate function");return i}function Pee(n,e,t){let i=n._zod.run({value:t,issues:[]},{});if(i&&typeof i.then=="function")return ns;let r=i;return r.issues.length===0?r.value:e()}function Oee(n,e,t,i){let r=t._zod.def;if(!r.catchValue[r_])throw new sn("catch with a callback (only a constant catch value compiles)",!1);let s=Mt(e);n.write(`let ${s} = (() => {`),n.indented(l=>{let u=Fr(l,e,r.innerType,i);l.write(`return ${u};`)}),n.write("})();");let o=Dt(e,r.innerType),a=lh(e,r.catchValue),c=Dt(e,Pee);return n.write(`if (${s} === INVALID) {`),n.indented(l=>{l.write(`${s} = ${c}(${o}, ${a}, ${i});`),l.write(`if (${s} === INVALID) return INVALID;`)}),n.write("}"),s}function Lee(n,e,t,i){let r=t._zod.def;if(r.transform){if(uh(r.transform))throw new da("z.compile: async transforms are not supported");let s=r.transform,a=lh(e,l=>{let u={value:l,issues:[],addIssue:HB},d=s(l,u);return d instanceof Promise?ns:u.issues.length===0?d:ns}),c=Mt(e);return n.write(`const ${c} = ${a}(${i});`),n.write(`if (${c} === INVALID) return INVALID;`),c}return i}function ew(n){return n.checks&&(n.checks=[...n.checks]),n}function jB(n,e){return new n(ew({type:"string",...De(e)}))}function QB(n,e){return new n(ew({type:"string",coerce:!0,...De(e)}))}function tw(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...De(e)})}function nw(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...De(e)})}function iw(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...De(e)})}function rw(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...De(e)})}function sw(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...De(e)})}function ow(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...De(e)})}function Db(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...De(e)})}function aw(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...De(e)})}function cw(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...De(e)})}function lw(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...De(e)})}function uw(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...De(e)})}function dw(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...De(e)})}function hw(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...De(e)})}function fw(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...De(e)})}function pw(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...De(e)})}function mw(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...De(e)})}function WB(n,e){return new n({type:"string",format:"mac",check:"string_format",abort:!1,...De(e)})}function gw(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...De(e)})}function Aw(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...De(e)})}function bw(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...De(e)})}function yw(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...De(e)})}function vw(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...De(e)})}function qB(n,e){return new n({type:"string",format:"credit_card",check:"string_format",abort:!1,...De(e)})}function KB(n,e){return new n({type:"string",format:"iban",check:"string_format",abort:!1,...De(e)})}function xw(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...De(e)})}var XB={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Fb(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...De(e)})}function Pb(n,e){return new n({type:"string",format:"date",check:"string_format",...De(e)})}function Ob(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...De(e)})}function Lb(n,e){return new n({type:"string",format:"duration",check:"string_format",...De(e)})}function ZB(n,e){return new n(ew({type:"number",checks:[],...De(e)}))}function JB(n,e){return new n(ew({type:"number",coerce:!0,checks:[],...De(e)}))}function YB(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...De(e)})}function eN(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"float32",...De(e)})}function tN(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"float64",...De(e)})}function nN(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"int32",...De(e)})}function iN(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"uint32",...De(e)})}function rN(n,e){return new n({type:"boolean",...De(e)})}function sN(n,e){return new n({type:"boolean",coerce:!0,...De(e)})}function oN(n,e){return new n({type:"bigint",...De(e)})}function aN(n,e){return new n({type:"bigint",coerce:!0,...De(e)})}function cN(n,e){return new n({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...De(e)})}function lN(n,e){return new n({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...De(e)})}function uN(n,e){return new n({type:"symbol",...De(e)})}function dN(n,e){return new n({type:"undefined",...De(e)})}function hN(n,e){return new n({type:"null",...De(e)})}function fN(n){return new n({type:"any"})}function pN(n){return new n({type:"unknown"})}function mN(n,e){return new n({type:"never",...De(e)})}function gN(n,e){return new n({type:"void",...De(e)})}function AN(n,e){return new n({type:"date",...De(e)})}function bN(n,e){return new n({type:"date",coerce:!0,...De(e)})}function yN(n,e){return new n({type:"nan",...De(e)})}function ic(n,e){return new v_({check:"less_than",...De(e),value:n,inclusive:!1})}function qs(n,e){return new v_({check:"less_than",...De(e),value:n,inclusive:!0})}function rc(n,e){return new x_({check:"greater_than",...De(e),value:n,inclusive:!1})}function Ks(n,e){return new x_({check:"greater_than",...De(e),value:n,inclusive:!0})}function _w(n){return rc(0,n)}function ww(n){return ic(0,n)}function Sw(n){return qs(0,n)}function Ew(n){return Ks(0,n)}function yu(n,e){return new iR({check:"multiple_of",...De(e),value:n})}function vu(n,e){return new oR({check:"max_size",...De(e),maximum:n})}function sc(n,e){return new aR({check:"min_size",...De(e),minimum:n})}function dh(n,e){return new cR({check:"size_equals",...De(e),size:n})}function hh(n,e){return new lR({check:"max_length",...De(e),maximum:n})}function sl(n,e){return new uR({check:"min_length",...De(e),minimum:n})}function fh(n,e){return new dR({check:"length_equals",...De(e),length:n})}function Pp(n,e){return new hR({check:"string_format",format:"regex",...De(e),pattern:n})}function Op(n){return new fR({check:"string_format",format:"lowercase",...De(n)})}function Lp(n){return new pR({check:"string_format",format:"uppercase",...De(n)})}function Up(n,e){return new mR({check:"string_format",format:"includes",...De(e),includes:n})}function $p(n,e){return new gR({check:"string_format",format:"starts_with",...De(e),prefix:n})}function zp(n,e){return new AR({check:"string_format",format:"ends_with",...De(e),suffix:n})}function Tw(n,e,t){return new bR({check:"property",property:n,schema:e,...De(t)})}function Gp(n,e){return new yR({check:"properties",shape:n,...De(e)})}function Vp(n,e){return new vR({check:"mime_type",mime:n,...De(e)})}function ha(n){return new xR({check:"overwrite",tx:n})}function Hp(n){return ha(e=>e.normalize(n))}function jp(){return ha(n=>n.trim())}function Qp(){return ha(n=>n.toLowerCase())}function Wp(){return ha(n=>n.toUpperCase())}function qp(){return ha(n=>sC(n))}function vN(n,e,t){return new n({type:"array",element:e,...De(t)})}function Uee(n,e,t){return new n({type:"union",options:e,...De(t)})}function $ee(n,e,t){return new n({type:"union",options:e,inclusive:!1,...De(t)})}function zee(n,e,t,i){return new n({type:"union",options:t,discriminator:e,...De(i)})}function Gee(n,e,t){return new n({type:"intersection",left:e,right:t})}function Vee(n,e,t,i){let r=t instanceof Lt,s=r?i:t,o=r?t:null;return new n({type:"tuple",items:e,rest:o,...De(s)})}function Hee(n,e,t,i){return new n({type:"record",keyType:e,valueType:t,...De(i)})}function jee(n,e,t,i){return new n({type:"map",keyType:e,valueType:t,...De(i)})}function Qee(n,e,t){return new n({type:"set",valueType:e,...De(t)})}function Wee(n,e,t){let i=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new n({type:"enum",entries:i,...De(t)})}function qee(n,e,t){return new n({type:"enum",entries:e,...De(t)})}function Kee(n,e,t){return new n({type:"literal",values:Array.isArray(e)?e:[e],...De(t)})}function xN(n,e){return new n({type:"file",...De(e)})}function Xee(n,e){return new n({type:"transform",transform:e})}function Zee(n,e){return new n({type:"optional",innerType:e})}function Jee(n,e){return new n({type:"nullable",innerType:e})}function Yee(n,e,t){return new n({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():sb(t)}})}function ete(n,e,t){return new n({type:"nonoptional",innerType:e,...De(t)})}function tte(n,e){return new n({type:"success",innerType:e})}function nte(n,e,t){return new n({type:"catch",innerType:e,catchValue:typeof t=="function"?t:dC(t)})}function ite(n,e,t){return new n({type:"pipe",in:e,out:t})}function rte(n,e){return new n({type:"readonly",innerType:e})}function ste(n,e,t){return new n({type:"template_literal",parts:e,...De(t)})}function ote(n,e){return new n({type:"lazy",getter:e})}function ate(n,e){return new n({type:"promise",innerType:e})}function _N(n,e,t){let i=De(t);return i.abort??(i.abort=!0),new n({type:"custom",check:"custom",fn:e,...i})}function wN(n,e,t){return new n({type:"custom",check:"custom",fn:e,...De(t)})}function SN(n,e){let t=IG(i=>(i.addIssue=r=>{if(typeof r=="string")i.issues.push(Tp(r,i.value,t._zod.def));else{let s=r;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=i.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),i.issues.push(Tp(s))}},n(i.value,i)),e);return t}function IG(n,e){let t=new Vn({check:"custom",...De(e)});return t._zod.check=n,t}function EN(n){let e=new Vn({check:"describe"});return e._zod.onattach=[t=>{let i=Tr.get(t)??{};Tr.add(t,{...i,description:n})}],e._zod.check=()=>{},e}function TN(n){let e=new Vn({check:"meta"});return e._zod.onattach=[t=>{let i=Tr.get(t)??{};Tr.add(t,{...i,...n})}],e._zod.check=()=>{},e}function MN(n,e){let t=De(e),i=t.truthy??["true","1","yes","on","y","enabled"],r=t.falsy??["false","0","no","off","n","disabled"];t.case!=="sensitive"&&(i=i.map(f=>typeof f=="string"?f.toLowerCase():f),r=r.map(f=>typeof f=="string"?f.toLowerCase():f));let s=new Set(i),o=new Set(r),a=n.Codec??Mb,c=n.Boolean??Eb,l=n.String??oh,u=new l({type:"string",error:t.error}),d=new c({type:"boolean",error:t.error}),h=new a({type:"pipe",in:u,out:d,transform:((f,p)=>{let g=f;return t.case!=="sensitive"&&(g=g.toLowerCase()),s.has(g)?!0:o.has(g)?!1:(p.issues.push({code:"invalid_value",expected:"stringbool",values:[...s,...o],input:p.value,inst:h,continue:!1}),{})}),reverseTransform:((f,p)=>f===!0?i[0]||"true":r[0]||"false"),error:t.error});return h._zod.bag.truthy=i,h._zod.bag.falsy=r,h._zod.bag.case=t.case??"insensitive",h}function ph(n,e,t,i={}){let r=De(i),s={check:"string_format",type:"string",format:e,fn:typeof t=="function"?t:a=>t.test(a),...r};return t instanceof RegExp&&(s.pattern=t),new n(s)}function Ub(n,...e){for(let t of e)for(let i of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,i)&&Er(n,i,t[i]);return n}function xu(n){let e=n?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:n?.metadata??Tr,target:e,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:n?.cycles??"ref",reused:n?.reused??"inline",intersections:[],deferred:[],external:n?.external??void 0}}function Ji(n,e,t,i,r){let s=typeof e.unrepresentable=="function"?e.unrepresentable({zodSchema:n,path:i.path,message:r}):e.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(r);return Object.assign(t,s),!0}function Fn(n,e,t={path:[],schemaPath:[]}){var i;let r=n._zod.def,s=e.seen.get(n);if(s)return s.count++,t.schemaPath.includes(n)&&(s.cycle=t.path),s.schema;let o={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,o),e.sharedDefsExtractedFor=void 0,e.sharedEmitDoneFor=void 0;let a=n._zod.toJSONSchema?.();if(a)o.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,u);else{let h=o.schema,f=e.processors[r.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);f(n,e,h,u)}let d=n._zod.parent;d&&(o.ref||(o.ref=d),Fn(d,e,u),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(n);return c&&Ub(o.schema,c),e.io==="input"&&is(n)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((i=o.schema).default??(i.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(n).schema}function CG(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}function _u(n,e){let t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");if(n.external&&n.sharedDefsExtractedFor===n.external)return;let i=new Map;for(let o of n.seen.entries()){let a=n.metadataRegistry.get(o[0])?.id;if(a){let c=i.get(a);if(c&&c!==o[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,o[0])}}let r=o=>{let a=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let d=n.external.registry.get(o[0])?.id,h=n.external.uri??(p=>p);if(d)return{ref:h(d)};let f=o[1].defId??o[1].schema.id??`schema${n.counter++}`;return o[1].defId=f,{defId:f,ref:`${h("__shared")}#/${a}/${CG(f)}`}}let c="#",l=`${c}/${a}/`;if(o[1]===t&&!o[1].schema.id)return{ref:c};let u=o[1].schema.id??`__schema${n.counter++}`;return{defId:u,ref:l+CG(u)}},s=o=>{if(o[1].schema.$ref)return;let a=o[1],{ref:c,defId:l}=r(o);a.def={...a.schema},l&&(a.defId=l);let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(n.cycles==="throw")for(let o of n.seen.entries()){let a=o[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
4789
4789
|
|
|
4790
4790
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of n.seen.entries()){let a=o[1];if(e===o[0]){s(o);continue}if(n.external){let l=n.external.registry.get(o[0])?.id;if(e!==o[0]&&l){s(o);continue}}if(n.metadataRegistry.get(o[0])?.id){s(o);continue}if(a.cycle){s(o);continue}a.count>1&&n.reused==="ref"&&s(o)}n.external&&(n.sharedDefsExtractedFor=n.external)}function NG(n){let e=n.anyOf;if(!Array.isArray(e)||e.length===0||n.type!==void 0)return;let t=[];for(let i of e){if(!i||typeof i!="object")return;NG(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let s=i.type;for(let o of Array.isArray(s)?s:[s]){if(typeof o!="string")return;t.includes(o)||t.push(o)}}delete n.anyOf,n.type=t.length===1?t[0]:t}var kG=new Set(["type","properties","required","additionalProperties"]),RG=["oneOf","anyOf"];function BG(n){let e=n.additionalProperties;return e===void 0||e===!1||typeof e!="object"||e===null?null:Object.keys(e).length?e:null}function IN(n){let e=[];for(let s of n){if(typeof s!="object"||s.type!=="object")return null;for(let o in s)if(!kG.has(o))return null;e.push(s)}let t={},i=new Set;for(let s of e){for(let o in s.properties){if(Object.prototype.hasOwnProperty.call(t,o))continue;let a=[];for(let l of e){let u=l.properties?.[o]??BG(l);u!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(u))||a.push(u))}let c=a.length===1?a[0]:IN(a)??{allOf:a};Er(t,o,c)}for(let o of s.required??[])i.add(o)}let r={type:"object",properties:t};if(i.size&&(r.required=[...i]),e.every(s=>s.additionalProperties===!1))r.additionalProperties=!1;else{let s=[];for(let o of e){let a=BG(o);a&&!s.some(c=>JSON.stringify(c)===JSON.stringify(a))&&s.push(a)}s.length===1?r.additionalProperties=s[0]:s.length>1&&(r.additionalProperties={allOf:s})}return r}function cte(n){let e=n.allOf;if(!Array.isArray(e)||e.length<2)return;for(let r of kG)if(r in n)return;let t=e.filter(r=>RG.some(s=>Array.isArray(r[s]))),i=null;if(!t.length)i=IN(e);else{let r=t[0],s=RG.find(c=>Array.isArray(r[c]));if(Object.keys(r).length!==1)return;let o=e.filter(c=>c!==r),a=r[s].map(c=>IN([...o,c]));if(a.some(c=>!c))return;i={[s]:a}}i&&(delete n.allOf,Ub(n,i))}function wu(n,e){let t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let c=n.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){i(d);let f=n.seen.get(d),p=f.schema;if(p.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(p)):Ub(l,p),Ub(l,u),a._zod.parent===d)for(let b in l)b==="$ref"||b==="allOf"||b in u||delete l[b];if(p.$ref&&f.def)for(let b in l)b==="$ref"||b==="allOf"||b in f.def&&JSON.stringify(l[b])===JSON.stringify(f.def[b])&&delete l[b]}let h=a._zod.parent;if(h&&h!==d){i(h);let f=n.seen.get(h);if(f?.schema.$ref&&(l.$ref=f.schema.$ref,f.def))for(let p in l)p==="$ref"||p==="allOf"||p in f.def&&JSON.stringify(l[p])===JSON.stringify(f.def[p])&&delete l[p]}n.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!n.external||n.sharedEmitDoneFor!==n.external){for(let a of[...n.seen.entries()].reverse())i(a[0]);if(n.target!=="openapi-3.0")for(let a of n.seen.entries())NG(a[1].def??a[1].schema);for(let a of n.deferred)a();if(n.intersections.length){let a=new Map;for(let c of n.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);d?d.push(l):a.set(u,[l])}for(let c of n.intersections)for(let l of a.get(c)??[])cte(l)}}let r={};if(n.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){let a=n.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=n.external.uri(a)}Ub(r,t.defId?t.schema:t.def??t.schema);let s=n.metadataRegistry.get(e)?.id;s!==void 0&&r.id===s&&delete r.id;let o=n.external?.defs??{};if(!n.external||n.sharedEmitDoneFor!==n.external)for(let a of n.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,Er(o,c.defId,c.def))}n.external&&(n.sharedEmitDoneFor=n.external),n.external||Object.keys(o).length>0&&(n.target==="draft-2020-12"?r.$defs=o:r.definitions=o);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Kp(e,"input",n.processors),output:Kp(e,"output",n.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function is(n,e){let t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);let i=n._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return is(i.element,t);if(i.type==="set")return is(i.valueType,t);if(i.type==="lazy")return is(i.getter(),t);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return is(i.innerType,t);if(i.type==="intersection")return is(i.left,t)||is(i.right,t);if(i.type==="record"||i.type==="map")return is(i.keyType,t)||is(i.valueType,t);if(i.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:is(i.in,t)||is(i.out,t);if(i.type==="object"){for(let r in i.shape)if(is(i.shape[r],t))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(is(r,t))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(is(r,t))return!0;return!!(i.rest&&is(i.rest,t))}return!1}var CN=(n,e={})=>t=>{let i=xu({...t,processors:e});return Fn(n,i),_u(i,n),wu(i,n)},Kp=(n,e,t={})=>i=>{let{libraryOptions:r,target:s}=i??{},o=xu({...r??{},target:s,io:e,processors:t});return Fn(n,o),_u(o,n),wu(o,n)};var Xp=(n,e,t)=>{(n[e]===void 0||t>n[e])&&(n[e]=t)},Zp=(n,e,t)=>{(n[e]===void 0||t<n[e])&&(n[e]=t)},DG=(n,e)=>{Xp(n,"minimum",e),Zp(n,"maximum",e)},LG=(n,e)=>{n.multipleOf??(n.multipleOf=[]),n.multipleOf.includes(e)||n.multipleOf.push(e)},UG=(n,e)=>{n.patterns??(n.patterns=new Set),n.patterns.add(e)},$G=(n,e)=>{n.mime=n.mime?n.mime.filter(t=>e.includes(t)):[...e]},zG=(n,e)=>{n.format=e,e.includes("int")&&(n.isInt=!0)},FG=(n,e)=>Xp(n,"minimum",e.minimum),PG=(n,e)=>Zp(n,"maximum",e.maximum),OG=n=>(e,t)=>{zG(e,t.format);let[i,r]=n[t.format];Xp(e,"minimum",i),Zp(e,"maximum",r)},lte={greater_than:(n,e)=>Xp(n,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(n,e)=>Zp(n,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(n,e)=>LG(n,e.value),number_format:OG(ab),bigint_format:OG(cb),min_length:FG,max_length:PG,length_equals:(n,e)=>DG(n,e.length),min_size:FG,max_size:PG,size_equals:(n,e)=>DG(n,e.size),string_format:(n,e)=>{zG(n,e.format),e.pattern&&UG(n,e.pattern),(e.format==="base64"||e.format==="base64url")&&(n.contentEncoding=e.format),(e.local||e.precision===-1)&&(n.laxFormat=!0)},mime_type:(n,e)=>$G(n,e.mime)};function Yi(n){let e={},t=n._zod.def,i=n._zod.traits.has("$ZodCheck")?[n,...t.checks??[]]:t.checks??[];for(let s of i)lte[s._zod.def.check]?.(e,s._zod.def);let r=n._zod.bag;r.minimum!==void 0&&Xp(e,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&Xp(e,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&Zp(e,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&Zp(e,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&LG(e,r.multipleOf),r.format!==void 0&&(e.format??(e.format=r.format),r.format.includes("int")&&(e.isInt=!0)),r.mime&&$G(e,r.mime);for(let s of r.patterns??[])UG(e,s);return e}var ute={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dte=new Map([[B_,OC],[Sb,LC]]),GG=n=>dte.get(n)??n,NN=(n,e,t,i)=>{let r=t;r.type="string";let{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Yi(n);if(typeof s=="number"&&(r.minLength=s),typeof o=="number"&&(r.maxLength=o),a&&(r.format=ute[a]??a,r.format===""&&delete r.format,(a==="time"||u)&&delete r.format),l&&(r.contentEncoding=l),c&&c.size>0){let d=[...c].map(GG);d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(h=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},kN=(n,e,t,i)=>{let r=t,{minimum:s,maximum:o,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Yi(n);r.type=u?"integer":"number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),h=typeof c=="number"&&c<=(o??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";if(d?f?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:typeof s=="number"&&(r.minimum=s),h?f?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:typeof o=="number"&&(r.maximum=o),a){let p=new Set;for(let A of a)Number.isFinite(A)&&A!==0?p.add(Math.abs(A)):Ji(n,e,r,i,`A multipleOf divisor of ${A} cannot be represented in JSON Schema`);let[g,...b]=p;g!==void 0&&(r.multipleOf=g),b.length&&(r.allOf=[...r.allOf??[],...b.map(A=>({multipleOf:A}))])}},DN=(n,e,t,i)=>{t.type="boolean"},FN=(n,e,t,i)=>{Ji(n,e,t,i,"BigInt cannot be represented in JSON Schema")},PN=(n,e,t,i)=>{Ji(n,e,t,i,"Symbols cannot be represented in JSON Schema")},ON=(n,e,t,i)=>{e.target==="openapi-3.0"?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null"},LN=(n,e,t,i)=>{Ji(n,e,t,i,"Undefined cannot be represented in JSON Schema")},UN=(n,e,t,i)=>{Ji(n,e,t,i,"Void cannot be represented in JSON Schema")},$N=(n,e,t,i)=>{t.not={}},zN=(n,e,t,i)=>{},GN=(n,e,t,i)=>{},VN=(n,e,t,i)=>{Ji(n,e,t,i,"Date cannot be represented in JSON Schema")},HN=(n,e,t,i)=>{let r=n._zod.def,s=_p(r.entries);if(s.length===0){t.not={};return}s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},jN=(n,e,t,i)=>{let r=n._zod.def;if(r.values.length===0){t.not={};return}let s=[];for(let o of r.values)if(o===void 0){if(Ji(n,e,t,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o=="bigint"){if(Ji(n,e,t,i,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){let o=s[0];t.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[o]:t.const=o}else s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),s.every(o=>typeof o=="boolean")&&(t.type="boolean"),s.every(o=>o===null)&&(t.type="null"),t.enum=s},QN=(n,e,t,i)=>{Ji(n,e,t,i,"NaN cannot be represented in JSON Schema")},WN=(n,e,t,i)=>{let r=t,s=n._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=s.source},qN=(n,e,t,i)=>{let r=t;r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:s,maximum:o,mime:a}=Yi(n);s!==void 0&&(r.minLength=s),o!==void 0&&(r.maxLength=o),a&&(a.length===0?r.not={}:a.length===1?r.contentMediaType=a[0]:r.anyOf=a.map(c=>({contentMediaType:c})))},KN=(n,e,t,i)=>{t.type="boolean"},XN=(n,e,t,i)=>{Ji(n,e,t,i,"Custom types cannot be represented in JSON Schema")},ZN=(n,e,t,i)=>{Ji(n,e,t,i,"Function types cannot be represented in JSON Schema")},JN=(n,e,t,i)=>{Ji(n,e,t,i,"Transforms cannot be represented in JSON Schema")},YN=(n,e,t,i)=>{Ji(n,e,t,i,"Map cannot be represented in JSON Schema")},e2=(n,e,t,i)=>{Ji(n,e,t,i,"Set cannot be represented in JSON Schema")},t2=(n,e,t,i)=>{let r=t,s=n._zod.def,{minimum:o,maximum:a}=Yi(n);typeof o=="number"&&(r.minItems=o),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=Fn(s.element,e,{...i,path:[...i.path,"items"]})};function $b(n){let e=n._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?$b(e.out):e.type==="catch"?$b(e.innerType):n._zod.optin}var n2=(n,e,t,i)=>{let r=t,s=n._zod.def,o=s.shape;if(Object.getOwnPropertySymbols(o).length&&Ji(n,e,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let l in o)Er(r.properties,l,Fn(o[l],e,{...i,path:[...i.path,"properties",l]}));let c=[];for(let l of Object.keys(o)){let u=s.shape[l];(e.io==="input"?$b(u)===void 0:u._zod.optout===void 0)&&c.push(l)}c.length>0&&(r.required=c),s.catchall?._zod.def.type==="never"?r.additionalProperties=!1:s.catchall?s.catchall&&(r.additionalProperties=Fn(s.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(r.additionalProperties=!1)},Iw=(n,e,t,i)=>{let r=n._zod.def,s=r.inclusive===!1,o=r.options.map((a,c)=>Fn(a,e,{...i,path:[...i.path,s?"oneOf":"anyOf",c]}));s?t.oneOf=o:t.anyOf=o},i2=(n,e,t,i)=>{let r=n._zod.def,s=Fn(r.left,e,{...i,path:[...i.path,"allOf",0]}),o=Fn(r.right,e,{...i,path:[...i.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];t.allOf=c,e.intersections.push(c)},r2=(n,e,t,i)=>{let r=t,s=n._zod.def;r.type="array";let o=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((g,b)=>Fn(g,e,{...i,path:[...i.path,o,b]})),l=s.rest?Fn(s.rest,e,{...i,path:[...i.path,a,...e.target==="openapi-3.0"?[s.items.length]:[]]}):null,u=s.items.length;for(;u>0;){let g=s.items[u-1];if(!(e.io==="input"?$b(g)!==void 0:g._zod.optout==="optional"))break;u--}let d=s.items.length,h=!s.rest;e.target==="draft-2020-12"?(r.prefixItems=c,h?r.items=!1:l&&(r.items=l),u>0&&(r.minItems=u),h&&(r.maxItems=d)):e.target==="openapi-3.0"?(r.items={anyOf:c},l&&r.items.anyOf.push(l),u>0&&(r.minItems=u),h&&(r.maxItems=d)):(r.items=c,h?r.additionalItems=!1:l&&(r.additionalItems=l),u>0&&(r.minItems=u),h&&(r.maxItems=d));let{minimum:f,maximum:p}=Yi(n);typeof f=="number"&&(r.minItems=f),typeof p=="number"&&(r.maxItems=p)};function RN(n,e,t){if(e.$ref){if(t.has(e))return e;t.add(e);let p=n.get(e)?.def;if(!p)return e;let g=RN(n,p,t);return g===p?e:g}for(let p of["anyOf","oneOf"]){let g=e[p];if(!Array.isArray(g))continue;let b=g.map(A=>RN(n,A,t));b.some((A,y)=>A!==g[y])&&(e={...e,[p]:b})}let i=Array.isArray(e.type)?e.type:[e.type],r=!i.includes("string")&&i.some(p=>p==="number"||p==="integer"),s=e.enum??(e.const!==void 0?[e.const]:void 0);if(!r&&!s?.some(p=>typeof p=="number"))return e;let{minimum:o,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:h,...f}=e;return f.enum?f.enum=f.enum.map(p=>typeof p=="number"?String(p):p):typeof f.const=="number"&&(f.const=String(f.const)),r&&(f.type="string",s||(f.pattern=(i.includes("number")?rl:Ab).source)),f}var BN=new WeakMap;function hte(n){let e=new Map;for(let i of n.seen.values())i.def&&!e.has(i.schema)&&e.set(i.schema,i);let t=new Map;for(let i of BN.get(n)??[]){let r=n.seen.get(i),s=(r?.def??r?.schema)?.propertyNames;if(!s||s===!0||t.has(s))continue;let o=RN(e,s,new Set);o!==s&&t.set(s,o)}if(t.size)for(let i of n.seen.values())for(let r of[i.schema,i.def]){let s=r&&t.get(r.propertyNames);s&&(r.propertyNames=s)}}var s2=(n,e,t,i)=>{let r=t,s=n._zod.def;r.type="object";let o=s.keyType,a=Yi(o).patterns;if(s.mode==="loose"&&a&&a.size>0){let u=Fn(s.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let d of a)Er(r.patternProperties,GG(d).source,u)}else{if(e.target==="draft-07"||e.target==="draft-2020-12"){r.propertyNames=Fn(s.keyType,e,{...i,path:[...i.path,"propertyNames"]});let u=BN.get(e);u||(u=[],BN.set(e,u),e.deferred.push(()=>hte(e))),u.push(n)}r.additionalProperties=Fn(s.valueType,e,{...i,path:[...i.path,"additionalProperties"]})}let c=o._zod.values,l=e.io==="input"&&$b(s.valueType)!==void 0;if(c&&!s.partial&&!l){let u=[...c].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(r.required=u.map(String))}},o2=(n,e,t,i)=>{let r=n._zod.def,s=Fn(r.innerType,e,i),o=e.seen.get(n);e.target==="openapi-3.0"?(o.ref=r.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},a2=(n,e,t,i)=>{let r=n._zod.def;Fn(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType},c2=Symbol();function VG(n,e,t,i,r){let s=!1,o=JSON.stringify(n,(a,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(Ji(e,t,i,r,"BigInt defaults cannot be represented in JSON Schema"),c2):JSON.parse(o)}var l2=(n,e,t,i)=>{let r=n._zod.def;Fn(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType;let o=VG(r.defaultValue,n,e,t,i);o!==c2&&(t.default=o)},u2=(n,e,t,i)=>{let r=n._zod.def;Fn(r.innerType,e,i);let s=e.seen.get(n);if(s.ref=r.innerType,e.io!=="input")return;let o=VG(r.defaultValue,n,e,t,i);o!==c2&&(t._prefault=o)},d2=(n,e,t,i)=>{let r=n._zod.def;Fn(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType;let o;try{o=r.catchValue(void 0)}catch{Ji(n,e,t,i,"Dynamic catch values are not supported in JSON Schema");return}t.default=o},h2=(n,e,t,i)=>{let r=n._zod.def,s=r.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?s?r.out:r.in:r.out;Fn(o,e,i);let a=e.seen.get(n);a.ref=o},f2=(n,e,t,i)=>{let r=n._zod.def;Fn(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType,t.readOnly=!0},p2=(n,e,t,i)=>{let r=n._zod.def;Fn(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType},Cw=(n,e,t,i)=>{let r=n._zod.def;Fn(r.innerType,e,i);let s=e.seen.get(n);s.ref=r.innerType},m2=(n,e,t,i)=>{let r=n._zod.innerType;Fn(r,e,i);let s=e.seen.get(n);s.ref=r},Mw={string:NN,number:kN,boolean:DN,bigint:FN,symbol:PN,null:ON,undefined:LN,void:UN,never:$N,any:zN,unknown:GN,date:VN,enum:HN,literal:jN,nan:QN,template_literal:WN,file:qN,success:KN,custom:XN,function:ZN,transform:JN,map:YN,set:e2,array:t2,object:n2,union:Iw,intersection:i2,tuple:r2,record:s2,nullable:o2,nonoptional:a2,default:l2,prefault:u2,catch:d2,pipe:h2,readonly:f2,promise:p2,optional:Cw,lazy:m2};function Rw(n,e){if("_idmap"in n){let i=n,r=xu({...e,processors:Mw}),s={};for(let c of i._idmap.entries()){let[l,u]=c;Fn(u,r)}let o={},a={registry:i,uri:e?.uri,defs:s};r.external=a;for(let c of i._idmap.entries()){let[l,u]=c;_u(r,u),Er(o,l,wu(r,u))}if(Object.keys(s).length>0){let c=r.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[c]:s}}return{schemas:o}}let t=xu({...e,processors:Mw});return Fn(n,t),_u(t,n),wu(t,n)}var Bw=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),this.ctx=xu({processors:Mw,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return Fn(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,_u(this.ctx,e);let i=wu(this.ctx,e),{"~standard":r,...s}=i;return s}};var HG={};var sm={};Sr(sm,{ZodAny:()=>O2,ZodArray:()=>z2,ZodBase64:()=>Xw,ZodBase64URL:()=>Zw,ZodBigInt:()=>im,ZodBigIntFormat:()=>eS,ZodBoolean:()=>nm,ZodCIDRv4:()=>qw,ZodCIDRv6:()=>Kw,ZodCUID:()=>zw,ZodCUID2:()=>Gw,ZodCatch:()=>ck,ZodCodec:()=>Xb,ZodCreditCard:()=>C2,ZodCustom:()=>Zb,ZodCustomStringFormat:()=>bh,ZodDate:()=>Hb,ZodDefault:()=>nk,ZodDiscriminatedUnion:()=>V2,ZodE164:()=>Jw,ZodEmail:()=>Ow,ZodEmoji:()=>Uw,ZodEnum:()=>Yp,ZodExactOptional:()=>rS,ZodFile:()=>J2,ZodFunction:()=>bk,ZodGUID:()=>Lw,ZodIBAN:()=>R2,ZodIPv4:()=>Qw,ZodIPv6:()=>Ww,ZodISODate:()=>Eu,ZodISODateTime:()=>Su,ZodISODuration:()=>Mu,ZodISOTime:()=>Tu,ZodInstanceOf:()=>xk,ZodIntersection:()=>H2,ZodJWT:()=>Yw,ZodKSUID:()=>jw,ZodLazy:()=>mk,ZodLiteral:()=>Z2,ZodMAC:()=>I2,ZodMap:()=>K2,ZodNaN:()=>uk,ZodNanoID:()=>$w,ZodNever:()=>U2,ZodNonOptional:()=>sS,ZodNull:()=>F2,ZodNullable:()=>tk,ZodNumber:()=>tm,ZodNumberFormat:()=>yh,ZodObject:()=>Qb,ZodOptional:()=>qb,ZodPipe:()=>Kb,ZodPrefault:()=>rk,ZodPreprocess:()=>dk,ZodPromise:()=>Ak,ZodReadonly:()=>hk,ZodRecord:()=>Jp,ZodSet:()=>X2,ZodString:()=>em,ZodStringFormat:()=>$n,ZodSuccess:()=>ak,ZodSymbol:()=>k2,ZodTemplateLiteral:()=>pk,ZodTransform:()=>Y2,ZodTuple:()=>Q2,ZodType:()=>jt,ZodULID:()=>Vw,ZodURL:()=>Vb,ZodUUID:()=>oc,ZodUndefined:()=>D2,ZodUnion:()=>Wb,ZodUnknown:()=>L2,ZodVoid:()=>$2,ZodXID:()=>Hw,ZodXor:()=>G2,_ZodString:()=>Pw,_default:()=>ik,_function:()=>n6,any:()=>kV,array:()=>jb,base64:()=>fV,base64url:()=>pV,bigint:()=>IV,boolean:()=>N2,catch:()=>lk,check:()=>i6,cidrv4:()=>dV,cidrv6:()=>hV,codec:()=>JV,creditCard:()=>gV,cuid:()=>iV,cuid2:()=>rV,currencyCode:()=>_V,custom:()=>r6,date:()=>FV,describe:()=>s6,discriminatedUnion:()=>zV,e164:()=>mV,email:()=>WG,emoji:()=>tV,enum:()=>nS,exactOptional:()=>ek,file:()=>qV,float32:()=>SV,float64:()=>EV,function:()=>n6,guid:()=>qG,hash:()=>wV,hex:()=>xV,hostname:()=>vV,httpUrl:()=>eV,iban:()=>AV,instanceof:()=>a6,int:()=>Dw,int32:()=>TV,int64:()=>CV,intersection:()=>j2,invertCodec:()=>YV,ipv4:()=>cV,ipv6:()=>uV,json:()=>l6,jwt:()=>bV,keyof:()=>PV,ksuid:()=>aV,lazy:()=>gk,literal:()=>WV,looseObject:()=>UV,looseRecord:()=>VV,mac:()=>lV,map:()=>HV,meta:()=>o6,nan:()=>ZV,nanoid:()=>nV,nativeEnum:()=>QV,never:()=>tS,nonoptional:()=>ok,null:()=>P2,nullable:()=>Gb,nullish:()=>KV,number:()=>B2,object:()=>OV,optional:()=>gh,partialRecord:()=>GV,pipe:()=>Fw,prefault:()=>sk,preprocess:()=>u6,promise:()=>t6,readonly:()=>fk,record:()=>q2,refine:()=>yk,set:()=>jV,strictObject:()=>LV,string:()=>zb,stringFormat:()=>yV,stringbool:()=>c6,success:()=>XV,superRefine:()=>vk,symbol:()=>BV,templateLiteral:()=>e6,transform:()=>iS,tuple:()=>W2,uint32:()=>MV,uint64:()=>RV,ulid:()=>sV,undefined:()=>NV,union:()=>rm,unknown:()=>mh,url:()=>YG,uuid:()=>KG,uuidv4:()=>XG,uuidv6:()=>ZG,uuidv7:()=>JG,void:()=>DV,xid:()=>oV,xor:()=>$V});var Nw={};Sr(Nw,{endsWith:()=>zp,gt:()=>rc,gte:()=>Ks,includes:()=>Up,length:()=>fh,lowercase:()=>Op,lt:()=>ic,lte:()=>qs,maxLength:()=>hh,maxSize:()=>vu,mime:()=>Vp,minLength:()=>sl,minSize:()=>sc,multipleOf:()=>yu,negative:()=>ww,nonnegative:()=>Ew,nonpositive:()=>Sw,normalize:()=>Hp,overwrite:()=>ha,positive:()=>_w,properties:()=>Gp,property:()=>Tw,regex:()=>Pp,size:()=>dh,slugify:()=>qp,startsWith:()=>$p,toLowerCase:()=>Qp,toUpperCase:()=>Wp,trim:()=>jp,uppercase:()=>Lp});var jG=new WeakSet([Object.prototype,Error.prototype]);function kw(n,e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){let i=t(this);return Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,e,{value:i,configurable:!0,writable:!0})}})}var QG=(n,e)=>{AC.init(n,e),n.name="ZodError";let t=Object.getPrototypeOf(n);jG.has(t)||(jG.add(t),kw(t,"format",i=>r=>fb(i,r)),kw(t,"flatten",i=>r=>hb(i,r)),kw(t,"addIssue",i=>r=>{i.issues.push(r),i.message=JSON.stringify(i.issues,wp,2)}),kw(t,"addIssues",i=>r=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,wp,2)}),Object.defineProperty(t,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},pte=q("ZodError",QG),Bs=q("ZodError",QG,void 0,{Parent:Error});var g2=Mp(Bs),A2=Ip(Bs),b2=Cp(Bs),y2=Rp(Bs),v2=c_(Bs),x2=l_(Bs),_2=u_(Bs),w2=d_(Bs),S2=h_(Bs),E2=f_(Bs),T2=p_(Bs),M2=m_(Bs);function gte(){ur.localeError||_i(W_())}function Ah(){ur.memoizer||_i({memoizer:Bb()})}var jt=q("ZodType",(n,e)=>(gte(),Lt.init(n,e),n.def=e,n.type=e.type,n),{check(...n){let e=this.def;return this.clone(fe.mergeDefs(e,{checks:[...e.checks??[],...n.map(t=>typeof t=="function"?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,e){return kn(this,n,e)},brand(){return this},register(n,e){return n.add(this,e),this},refine(n,e){return this.check(yk(n,e))},superRefine(n,e){return this.check(vk(n,e))},overwrite(n){return this.check(ha(n))},optional(){return gh(this)},exactOptional(){return ek(this)},nullable(){return Gb(this)},nullish(){return gh(Gb(this))},nonoptional(n){return ok(this,n)},array(){return jb(this)},or(n){return rm([this,n])},and(n){return j2(this,n)},transform(n){return Fw(this,iS(n))},default(n){return ik(this,n)},prefault(n){return sk(this,n)},catch(n){return lk(this,n)},pipe(n){return Fw(this,n)},readonly(){return fk(this)},describe(n){let e=this.clone();return Tr.add(e,{description:n}),e},meta(...n){if(n.length===0)return Tr.get(this);let e=this.clone();return Tr.add(e,n[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n,...e){return e.length===0?n(this):n(this,...e)},get"~standard"(){return fe.hide(this,"~standard",{...T_(this),jsonSchema:{input:Kp(this,"input"),output:Kp(this,"output")}})},set"~standard"(n){fe.own(this,"~standard",n)},parse:function n(e,t){return g2(this,e,t,{callee:n})},parseAsync:async function n(e,t){return await A2(this,e,t,{callee:n})},safeParse(n,e){return b2(this,n,e)},async safeParseAsync(n,e){return y2(this,n,e)},get spa(){return this?.safeParseAsync},set spa(n){fe.own(this,"spa",n)},validate(n,e){return pb(this,n,e)},validateAsync(n,e){return mb(this,n,e)},encode:function n(e,t){return v2(this,e,t,{callee:n})},decode:function n(e,t){return x2(this,e,t,{callee:n})},encodeAsync:async function n(e,t){return await _2(this,e,t,{callee:n})},decodeAsync:async function n(e,t){return await w2(this,e,t,{callee:n})},safeEncode(n,e){return S2(this,n,e)},safeDecode(n,e){return E2(this,n,e)},async safeEncodeAsync(n,e){return T2(this,n,e)},async safeDecodeAsync(n,e){return M2(this,n,e)},toJSONSchema(n){return CN(this,{})(n)},get description(){return Tr.get(this)?.description},get _def(){return this._zod.def}}),Pw=q("_ZodString",(n,e)=>{oh.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>NN(n,t,i,r)},fe.derived({format:n=>Yi(n).format??null,minLength:n=>Yi(n).minimum??null,maxLength:n=>Yi(n).maximum??null},{regex(...n){return this.check(Pp(...n))},includes(...n){return this.check(Up(...n))},startsWith(...n){return this.check($p(...n))},endsWith(...n){return this.check(zp(...n))},min(...n){return this.check(sl(...n))},max(...n){return this.check(hh(...n))},length(...n){return this.check(fh(...n))},nonempty(...n){return this.check(sl(1,...n))},lowercase(n){return this.check(Op(n))},uppercase(n){return this.check(Lp(n))},trim(){return this.check(jp())},normalize(...n){return this.check(Hp(...n))},toLowerCase(){return this.check(Qp())},toUpperCase(){return this.check(Wp())},slugify(){return this.check(qp())}})),em=q("ZodString",(n,e)=>{oh.init(n,e),Pw.init(n,e)},{email(n){return this.check(tw(Ow,n))},url(n){return this.check(Db(Vb,n))},jwt(n){return this.check(xw(Yw,n))},emoji(n){return this.check(aw(Uw,n))},guid(n){return this.check(nw(Lw,n))},uuid(n){return this.check(iw(oc,n))},uuidv4(n){return this.check(rw(oc,n))},uuidv6(n){return this.check(sw(oc,n))},uuidv7(n){return this.check(ow(oc,n))},nanoid(n){return this.check(cw($w,n))},cuid(n){return this.check(lw(zw,n))},cuid2(n){return this.check(uw(Gw,n))},ulid(n){return this.check(dw(Vw,n))},base64(n){return this.check(bw(Xw,n))},base64url(n){return this.check(yw(Zw,n))},xid(n){return this.check(hw(Hw,n))},ksuid(n){return this.check(fw(jw,n))},ipv4(n){return this.check(pw(Qw,n))},ipv6(n){return this.check(mw(Ww,n))},cidrv4(n){return this.check(gw(qw,n))},cidrv6(n){return this.check(Aw(Kw,n))},e164(n){return this.check(vw(Jw,n))},datetime(n){return this.check(Fb(Su,n))},date(n){return this.check(Pb(Eu,n))},time(n){return this.check(Ob(Tu,n))},duration(n){return this.check(Lb(Mu,n))}});function zb(n){return jB(em,n)}var $n=q("ZodStringFormat",(n,e)=>{Dn.init(n,e),Pw.init(n,e)}),Su=q("ZodISODateTime",(n,e)=>{OR.init(n,e),$n.init(n,e)}),Eu=q("ZodISODate",(n,e)=>{LR.init(n,e),$n.init(n,e)}),Tu=q("ZodISOTime",(n,e)=>{UR.init(n,e),$n.init(n,e)}),Mu=q("ZodISODuration",(n,e)=>{$R.init(n,e),$n.init(n,e)}),Ow=q("ZodEmail",(n,e)=>{TR.init(n,e),$n.init(n,e)});function WG(n){return tw(Ow,n)}var Lw=q("ZodGUID",(n,e)=>{SR.init(n,e),$n.init(n,e)});function qG(n){return nw(Lw,n)}var oc=q("ZodUUID",(n,e)=>{ER.init(n,e),$n.init(n,e)});function KG(n){return iw(oc,n)}function XG(n){return rw(oc,n)}function ZG(n){return sw(oc,n)}function JG(n){return ow(oc,n)}var Vb=q("ZodURL",(n,e)=>{CR.init(n,e),$n.init(n,e)});function YG(n){return Db(Vb,n)}function eV(n){return Db(Vb,{protocol:gb,hostname:$C,...fe.normalizeParams(n)})}var Uw=q("ZodEmoji",(n,e)=>{RR.init(n,e),$n.init(n,e)});function tV(n){return aw(Uw,n)}var $w=q("ZodNanoID",(n,e)=>{BR.init(n,e),$n.init(n,e)});function nV(n){return cw($w,n)}var zw=q("ZodCUID",(n,e)=>{NR.init(n,e),$n.init(n,e)});function iV(n){return lw(zw,n)}var Gw=q("ZodCUID2",(n,e)=>{kR.init(n,e),$n.init(n,e)});function rV(n){return uw(Gw,n)}var Vw=q("ZodULID",(n,e)=>{DR.init(n,e),$n.init(n,e)});function sV(n){return dw(Vw,n)}var Hw=q("ZodXID",(n,e)=>{FR.init(n,e),$n.init(n,e)});function oV(n){return hw(Hw,n)}var jw=q("ZodKSUID",(n,e)=>{PR.init(n,e),$n.init(n,e)});function aV(n){return fw(jw,n)}var Qw=q("ZodIPv4",(n,e)=>{zR.init(n,e),$n.init(n,e)});function cV(n){return pw(Qw,n)}var I2=q("ZodMAC",(n,e)=>{VR.init(n,e),$n.init(n,e)});function lV(n){return WB(I2,n)}var Ww=q("ZodIPv6",(n,e)=>{GR.init(n,e),$n.init(n,e)});function uV(n){return mw(Ww,n)}var qw=q("ZodCIDRv4",(n,e)=>{HR.init(n,e),$n.init(n,e)});function dV(n){return gw(qw,n)}var Kw=q("ZodCIDRv6",(n,e)=>{jR.init(n,e),$n.init(n,e)});function hV(n){return Aw(Kw,n)}var Xw=q("ZodBase64",(n,e)=>{QR.init(n,e),$n.init(n,e)});function fV(n){return bw(Xw,n)}var Zw=q("ZodBase64URL",(n,e)=>{WR.init(n,e),$n.init(n,e)});function pV(n){return yw(Zw,n)}var Jw=q("ZodE164",(n,e)=>{qR.init(n,e),$n.init(n,e)});function mV(n){return vw(Jw,n)}var C2=q("ZodCreditCard",(n,e)=>{KR.init(n,e),$n.init(n,e)});function gV(n){return qB(C2,n)}var R2=q("ZodIBAN",(n,e)=>{XR.init(n,e),$n.init(n,e)});function AV(n){return KB(R2,n)}var Yw=q("ZodJWT",(n,e)=>{ZR.init(n,e),$n.init(n,e)});function bV(n){return xw(Yw,n)}var bh=q("ZodCustomStringFormat",(n,e)=>{JR.init(n,e),$n.init(n,e)});function yV(n,e,t={}){return ph(bh,n,e,t)}function vV(n){return ph(bh,"hostname",UC,n)}function xV(n){return ph(bh,"hex",eR,n)}function _V(n){return ph(bh,"currency_code",GC,n)}function wV(n,e){let t=e?.enc??"hex",i=`${n}_${t}`,r=Mo[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return ph(bh,i,r,e)}var tm=q("ZodNumber",(n,e)=>{P_.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>kN(n,t,i,r),n.isFinite=!0},fe.derived({minValue:n=>{let{minimum:e,exclusiveMinimum:t}=Yi(n);return Math.max(e??Number.NEGATIVE_INFINITY,t??Number.NEGATIVE_INFINITY)},maxValue:n=>{let{maximum:e,exclusiveMaximum:t}=Yi(n);return Math.min(e??Number.POSITIVE_INFINITY,t??Number.POSITIVE_INFINITY)},isInt:n=>{let{isInt:e,multipleOf:t}=Yi(n);return!!e||!!t?.some(Number.isSafeInteger)},format:n=>Yi(n).format??null},{gt(n,e){return this.check(rc(n,e))},gte(n,e){return this.check(Ks(n,e))},min(n,e){return this.check(Ks(n,e))},lt(n,e){return this.check(ic(n,e))},lte(n,e){return this.check(qs(n,e))},max(n,e){return this.check(qs(n,e))},int(n){return this.check(Dw(n))},safe(n){return this.check(Dw(n))},positive(n){return this.check(rc(0,n))},nonnegative(n){return this.check(Ks(0,n))},negative(n){return this.check(ic(0,n))},nonpositive(n){return this.check(qs(0,n))},multipleOf(n,e){return this.check(yu(n,e))},step(n,e){return this.check(yu(n,e))},finite(){return this}}));function B2(n){return ZB(tm,n)}var yh=q("ZodNumberFormat",(n,e)=>{YR.init(n,e),tm.init(n,e)});function Dw(n){return YB(yh,n)}function SV(n){return eN(yh,n)}function EV(n){return tN(yh,n)}function TV(n){return nN(yh,n)}function MV(n){return iN(yh,n)}var nm=q("ZodBoolean",(n,e)=>{Eb.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>DN(n,t,i,r)});function N2(n){return rN(nm,n)}var im=q("ZodBigInt",(n,e)=>{O_.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>FN(n,t,i,r)},fe.derived({minValue:n=>Yi(n).minimum??null,maxValue:n=>Yi(n).maximum??null,format:n=>Yi(n).format??null},{gte(n,e){return this.check(Ks(n,e))},min(n,e){return this.check(Ks(n,e))},gt(n,e){return this.check(rc(n,e))},lt(n,e){return this.check(ic(n,e))},lte(n,e){return this.check(qs(n,e))},max(n,e){return this.check(qs(n,e))},positive(n){return this.check(rc(BigInt(0),n))},negative(n){return this.check(ic(BigInt(0),n))},nonpositive(n){return this.check(qs(BigInt(0),n))},nonnegative(n){return this.check(Ks(BigInt(0),n))},multipleOf(n,e){return this.check(yu(n,e))}}));function IV(n){return oN(im,n)}var eS=q("ZodBigIntFormat",(n,e)=>{eB.init(n,e),im.init(n,e)});function CV(n){return cN(eS,n)}function RV(n){return lN(eS,n)}var k2=q("ZodSymbol",(n,e)=>{tB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>PN(n,t,i,r)});function BV(n){return uN(k2,n)}var D2=q("ZodUndefined",(n,e)=>{nB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>LN(n,t,i,r)});function NV(n){return dN(D2,n)}var F2=q("ZodNull",(n,e)=>{iB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>ON(n,t,i,r)});function P2(n){return hN(F2,n)}var O2=q("ZodAny",(n,e)=>{rB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>zN(n,t,i,r)});function kV(){return fN(O2)}var L2=q("ZodUnknown",(n,e)=>{sB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>GN(n,t,i,r)});function mh(){return pN(L2)}var U2=q("ZodNever",(n,e)=>{oB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>$N(n,t,i,r)});function tS(n){return mN(U2,n)}var $2=q("ZodVoid",(n,e)=>{aB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>UN(n,t,i,r)});function DV(n){return gN($2,n)}var Hb=q("ZodDate",(n,e)=>{cB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>VN(n,t,i,r),n.min=(t,i)=>n.check(Ks(t,i)),n.max=(t,i)=>n.check(qs(t,i))},fe.derived({minDate:n=>{let{minimum:e}=Yi(n);return e?new Date(e):null},maxDate:n=>{let{maximum:e}=Yi(n);return e?new Date(e):null}},{}));function FV(n){return AN(Hb,n)}var z2=q("ZodArray",(n,e)=>{Ah(),lB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>t2(n,t,i,r),n.element=e.element},{min(n,e){return this.check(sl(n,e))},nonempty(n){return this.check(sl(1,n))},max(n,e){return this.check(hh(n,e))},length(n,e){return this.check(fh(n,e))},unwrap(){return this.element}});function jb(n,e){return vN(z2,n,e)}function PV(n){let e=n._zod.def.shape;return nS(Object.keys(e))}var Qb=q("ZodObject",(n,e)=>{Ah(),uB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>n2(n,t,i,r),fe.installLazyProp(n,"shape",t=>t._zod.def.shape,!1)},{keyof(){return nS(Object.keys(this._zod.def.shape))},catchall(n){return this.clone(fe.mergeDefs(this._zod.def,{catchall:n}))},passthrough(){return this.clone(fe.mergeDefs(this._zod.def,{catchall:mh()}))},loose(){return this.clone(fe.mergeDefs(this._zod.def,{catchall:mh()}))},strict(){return this.clone(fe.mergeDefs(this._zod.def,{catchall:tS()}))},strip(){return this.clone(fe.mergeDefs(this._zod.def,{catchall:void 0}))},extend(n){return fe.extend(this,n)},safeExtend(n){return fe.safeExtend(this,n)},merge(n){return fe.merge(this,n)},pick(n){return fe.pick(this,n)},omit(n){return fe.omit(this,n)},partial(...n){return fe.partial(qb,this,n[0])},exactPartial(...n){return fe.partial(rS,this,n[0],"exactPartial")},required(...n){return fe.required(sS,this,n[0])}});function OV(n,e){let t={type:"object",shape:n??{},...fe.normalizeParams(e)};return new Qb(t)}function LV(n,e){return new Qb({type:"object",shape:n,catchall:tS(),...fe.normalizeParams(e)})}function UV(n,e){return new Qb({type:"object",shape:n,catchall:mh(),...fe.normalizeParams(e)})}var Wb=q("ZodUnion",(n,e)=>{Tb.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Iw(n,t,i,r),n.options=e.options});function rm(n,e){return new Wb({type:"union",options:n,...fe.normalizeParams(e)})}var G2=q("ZodXor",(n,e)=>{Wb.init(n,e),dB.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Iw(n,t,i,r),n.options=e.options});function $V(n,e){return new G2({type:"union",options:n,inclusive:!1,...fe.normalizeParams(e)})}var V2=q("ZodDiscriminatedUnion",(n,e)=>{Wb.init(n,e),fB.init(n,e)});function zV(n,e,t){return new V2({type:"union",options:e,discriminator:n,...fe.normalizeParams(t)})}var H2=q("ZodIntersection",(n,e)=>{pB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>i2(n,t,i,r)});function j2(n,e){return new H2({type:"intersection",left:n,right:e})}var Q2=q("ZodTuple",(n,e)=>{Ah(),L_.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>r2(n,t,i,r)},{rest(n){return this.clone({...this._zod.def,rest:n})},partial(){let n=this._zod.def;if(n.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...n,items:n.items.map(e=>new qb({type:"optional",innerType:e}))})}});function W2(n,e,t){let i=e instanceof Lt,r=i?t:e,s=i?e:null;return new Q2({type:"tuple",items:n,rest:s,...fe.normalizeParams(r)})}var Jp=q("ZodRecord",(n,e)=>{Ah(),mB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>s2(n,t,i,r),n.keyType=e.keyType,n.valueType=e.valueType});function q2(n,e,t){return!e||!e._zod?new Jp({type:"record",keyType:zb(),valueType:n,...fe.normalizeParams(e)}):new Jp({type:"record",keyType:n,valueType:e,...fe.normalizeParams(t)})}function GV(n,e,t){return new Jp({type:"record",keyType:n,valueType:e,...fe.normalizeParams(t),partial:!0})}function VV(n,e,t){return new Jp({type:"record",keyType:n,valueType:e,mode:"loose",...fe.normalizeParams(t)})}var K2=q("ZodMap",(n,e)=>{Ah(),gB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>YN(n,t,i,r),n.keyType=e.keyType,n.valueType=e.valueType,n.min=(...t)=>n.check(sc(...t)),n.nonempty=t=>n.check(sc(1,t)),n.max=(...t)=>n.check(vu(...t)),n.size=(...t)=>n.check(dh(...t))});function HV(n,e,t){return new K2({type:"map",keyType:n,valueType:e,...fe.normalizeParams(t)})}var X2=q("ZodSet",(n,e)=>{Ah(),AB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>e2(n,t,i,r),n.min=(...t)=>n.check(sc(...t)),n.nonempty=t=>n.check(sc(1,t)),n.max=(...t)=>n.check(vu(...t)),n.size=(...t)=>n.check(dh(...t))});function jV(n,e){return new X2({type:"set",valueType:n,...fe.normalizeParams(e)})}var Yp=q("ZodEnum",(n,e)=>{bB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(i,r,s)=>HN(n,i,r,s),n.enum=e.entries,n.options=[...n._zod.values];let t=new Set(Object.keys(e.entries));n.extract=(i,r)=>{let s={};for(let o of i)if(t.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Yp({...e,checks:[],...fe.normalizeParams(r),entries:s})},n.exclude=(i,r)=>{let s={...e.entries};for(let o of i)if(t.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Yp({...e,checks:[],...fe.normalizeParams(r),entries:s})}});function nS(n,e){let t=Array.isArray(n)?Object.fromEntries(n.map(i=>[i,i])):n;return new Yp({type:"enum",entries:t,...fe.normalizeParams(e)})}function QV(n,e){return new Yp({type:"enum",entries:n,...fe.normalizeParams(e)})}var Z2=q("ZodLiteral",(n,e)=>{yB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>jN(n,t,i,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function WV(n,e){return new Z2({type:"literal",values:Array.isArray(n)?n:[n],...fe.normalizeParams(e)})}var J2=q("ZodFile",(n,e)=>{vB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>qN(n,t,i,r),n.min=(t,i)=>n.check(sc(t,i)),n.max=(t,i)=>n.check(vu(t,i)),n.mime=(t,i)=>n.check(Vp(Array.isArray(t)?t:[t],i))});function qV(n){return xN(J2,n)}var Y2=q("ZodTransform",(n,e)=>{Ah(),xB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>JN(n,t,i,r),n._zod.parse=(t,i)=>{if(i.direction==="backward")throw new bu(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(fe.issue(s,t.value,e));else{let o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=t.value),o.inst??(o.inst=n),t.issues.push(fe.issue(o))}};let r=e.transform(t.value,t);return r instanceof Promise?r.then(s=>(t.value=s,t)):(t.value=r,t)}});function iS(n){return new Y2({type:"transform",transform:n})}var qb=q("ZodOptional",(n,e)=>{U_.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Cw(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});function gh(n){return new qb({type:"optional",innerType:n})}var rS=q("ZodExactOptional",(n,e)=>{_B.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>Cw(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});function ek(n){return new rS({type:"optional",innerType:n})}var tk=q("ZodNullable",(n,e)=>{wB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>o2(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});function Gb(n){return new tk({type:"nullable",innerType:n})}function KV(n){return gh(Gb(n))}var nk=q("ZodDefault",(n,e)=>{SB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>l2(n,t,i,r),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function ik(n,e){return new nk({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():fe.shallowClone(e)}})}var rk=q("ZodPrefault",(n,e)=>{EB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>u2(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});function sk(n,e){return new rk({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():fe.shallowClone(e)}})}var sS=q("ZodNonOptional",(n,e)=>{TB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>a2(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});function ok(n,e){return new sS({type:"nonoptional",innerType:n,...fe.normalizeParams(e)})}var ak=q("ZodSuccess",(n,e)=>{MB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>KN(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});function XV(n){return new ak({type:"success",innerType:n})}var ck=q("ZodCatch",(n,e)=>{IB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>d2(n,t,i,r),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function lk(n,e){return new ck({type:"catch",innerType:n,catchValue:typeof e=="function"?e:fe.constantCatch(e)})}var uk=q("ZodNaN",(n,e)=>{CB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>QN(n,t,i,r)});function ZV(n){return yN(uk,n)}var Kb=q("ZodPipe",(n,e)=>{$_.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>h2(n,t,i,r),n.in=e.in,n.out=e.out});function Fw(n,e){return new Kb({type:"pipe",in:n,out:e})}var Xb=q("ZodCodec",(n,e)=>{Kb.init(n,e),Mb.init(n,e)});function JV(n,e,t){return new Xb({type:"pipe",in:n,out:e,transform:t.decode,reverseTransform:t.encode})}function YV(n){let e=n._zod.def;return new Xb({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}var dk=q("ZodPreprocess",(n,e)=>{Kb.init(n,e),RB.init(n,e)}),hk=q("ZodReadonly",(n,e)=>{BB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>f2(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});function fk(n){return new hk({type:"readonly",innerType:n})}var pk=q("ZodTemplateLiteral",(n,e)=>{NB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>WN(n,t,i,r)});function e6(n,e){return new pk({type:"template_literal",parts:n,...fe.normalizeParams(e)})}var mk=q("ZodLazy",(n,e)=>{Ib.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>m2(n,t,i,r),n.unwrap=()=>n._zod.def.getter()});function gk(n){return new mk({type:"lazy",getter:n})}var Ak=q("ZodPromise",(n,e)=>{DB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>p2(n,t,i,r),n.unwrap=()=>n._zod.def.innerType});function t6(n){return new Ak({type:"promise",innerType:n})}var bk=q("ZodFunction",(n,e)=>{kB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>ZN(n,t,i,r)});function n6(n){return new bk({type:"function",input:Array.isArray(n?.input)?W2(n?.input):n?.input??jb(mh()),output:n?.output??mh()})}var Zb=q("ZodCustom",(n,e)=>{FB.init(n,e),jt.init(n,e),n._zod.processJSONSchema=(t,i,r)=>XN(n,t,i,r)});function i6(n){let e=new Vn({check:"custom"});return e._zod.check=n,e}function r6(n,e){return _N(Zb,n??(()=>!0),e)}function yk(n,e={}){return wN(Zb,n,e)}function vk(n,e){return SN(n,e)}var s6=EN,o6=TN,xk=q("ZodInstanceOf",(n,e)=>{Zb.init(n,e)},{properties(n,e){return this.check(Gp(n,e))}});function a6(n,e={}){let t=new xk({type:"custom",check:"custom",fn:i=>i instanceof n,abort:!0,...fe.normalizeParams(e)});return t._zod.bag.Class=n,t._zod.check=i=>{i.value instanceof n||i.issues.push({code:"invalid_type",expected:n.name,input:i.value,inst:t,path:[...t._zod.def.path??[]]})},t}var c6=(...n)=>MN({Codec:Xb,Boolean:nm,String:em},...n);function l6(n){let e=gk(()=>rm([zb(n),B2(),N2(),P2(),jb(e),q2(zb(),e)]));return e}function u6(n,e){return new dk({type:"pipe",in:iS(n),out:e})}var Ate={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function bte(n){_i({customError:n})}function yte(){return _i().customError}var _k;_k||(_k={});var Jb={};Sr(Jb,{ZodISODate:()=>Eu,ZodISODateTime:()=>Su,ZodISODuration:()=>Mu,ZodISOTime:()=>Tu,date:()=>xte,datetime:()=>vte,duration:()=>wte,time:()=>_te});function vte(n){return Fb(Su,n)}function xte(n){return Pb(Eu,n)}function _te(n){return Ob(Tu,n)}function wte(n){return Lb(Mu,n)}var Ye={...sm,...Nw,iso:Jb},Ste=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Ete(n,e){let t=n.$schema;return t==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":t==="http://json-schema.org/draft-07/schema#"?"draft-7":t==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function d6(n,e){return n.map((t,i)=>i<e?t:t.optional())}function Tte(n){return n.replace(/~1/g,"/").replace(/~0/g,"~")}function Mte(n,e){if(!n.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let t=n.slice(1).split("/").filter(Boolean);if(t.length===0)return e.rootSchema;let i=e.version==="draft-2020-12"?"$defs":"definitions";if(t[0]===i){let r=t[1]===void 0?void 0:Tte(t[1]);if(!r||!e.defs[r])throw new Error(`Reference not found: ${n}`);return e.defs[r]}throw new Error(`Reference not found: ${n}`)}function Ite(n,e){return Ye.transform(i=>i).check(i=>{let r=i.value;if(typeof r!="object"||r===null||Array.isArray(r))return;let s=Object.getOwnPropertyNames(r);if(e.minProperties!==void 0&&s.length<e.minProperties&&i.issues.push({origin:"object",code:"too_small",minimum:e.minProperties,inclusive:!0,message:`Too small: expected object to have >=${e.minProperties} properties`,input:r,inst:n,continue:!0}),e.maxProperties!==void 0&&s.length>e.maxProperties&&i.issues.push({origin:"object",code:"too_big",maximum:e.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${e.maxProperties} properties`,input:r,inst:n,continue:!0}),e.keySchema)for(let o of s){let a=e.keySchema.safeParse(o);a.success||i.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:o,path:[o],continue:!0})}}).pipe(n)}function wk(n,e){if(n===null)return"z";let t=typeof n;if(t!=="object"){if(t==="number"&&Number.isNaN(n))return null;let i=String(n);return`${t[0]}${i.length}:${i}`}if(e.has(n))return null;e.add(n);try{if(Array.isArray(n)){let s=[];for(let o of n){let a=wk(o,e);if(a===null)return null;s.push(a)}return`a${s.length}:[${s.join(",")}]`}let i=Object.keys(n).sort(),r=[];for(let s of i){let o=wk(n[s],e);if(o===null)return null;r.push(`${s.length}:${s}=${o}`)}return`o${r.length}:{${r.join(",")}}`}finally{e.delete(n)}}var Cte=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Rte=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Yb(n){return typeof n!="object"||n===null?!1:Array.isArray(n)?n.some(Yb):typeof n.$ref=="string"?!0:Object.entries(n).some(([e,t])=>Cte.has(e)?Yb(t):!Rte.has(e)||typeof t!="object"||t===null?!1:Object.values(t).some(Yb))}function h6(n){return n===1?"element":"elements"}function Bte(n,e){return Ye.transform(i=>i).check(i=>{let r=i.value;if(Array.isArray(r)){if(e.uniqueItems===!0){let s=new Map;for(let o=0;o<r.length;o++){let a=wk(r[o],new Set);if(a===null)continue;let c=s.get(a);if(c===void 0){s.set(a,o);continue}i.issues.push({code:"custom",message:`Array items must be unique: element at index ${o} duplicates the one at index ${c}`,input:r,path:[o],continue:!0})}}if(e.containsSchema){let s=e.minContains??1,o=e.maxContains!==void 0?e.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of r)if(e.containsSchema.safeParse(c).success&&++a>=o)break;a<s&&i.issues.push({code:"custom",message:`Array must contain at least ${s} matching ${h6(s)}; found ${a}`,input:r,continue:!0}),e.maxContains!==void 0&&a>e.maxContains&&i.issues.push({code:"custom",message:`Array must contain at most ${e.maxContains} matching ${h6(e.maxContains)}`,input:r,continue:!0})}}}).pipe(n)}function f6(n,e){if(n!==!1)return n===void 0||n===!0?Ye.any():rs(n,e)}var Nte=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function p6(n,e){if(n.not!==void 0){if(typeof n.not=="object"&&Object.keys(n.not).length===0)return Ye.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(n.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(n.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(n.if!==void 0||n.then!==void 0||n.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(n.dependentSchemas!==void 0||n.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(n.$ref){let r=n.$ref;if(e.refs.has(r))return e.refs.get(r);if(e.processing.has(r))return Ye.lazy(()=>{if(!e.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return e.refs.get(r)});e.processing.add(r);let s=Mte(r,e),o=rs(s,e);return e.refs.set(r,o),e.processing.delete(r),o}if(n.enum!==void 0){let r=n.enum;if(e.version==="openapi-3.0"&&n.nullable===!0&&r.length===1&&r[0]===null)return Ye.null();if(r.length===0)return Ye.never();if(r.length===1)return Ye.literal(r[0]);if(r.every(o=>typeof o=="string"))return Ye.enum(r);let s=r.map(o=>Ye.literal(o));return s.length<2?s[0]:Ye.union([s[0],s[1],...s.slice(2)])}if(n.const!==void 0)return Ye.literal(n.const);let t=n.type;if(Array.isArray(t)){let r=t.map(s=>{let o={...n,type:s};return p6(o,e)});return r.length===0?Ye.never():r.length===1?r[0]:Ye.union(r)}if(!t)return Ye.any();let i;switch(t){case"string":{let r=Ye.string();if(n.format){let s=n.format;s==="email"?r=r.check(Ye.email()):s==="uri"||s==="uri-reference"?r=r.check(Ye.url()):s==="uuid"||s==="guid"?r=r.check(Ye.uuid()):s==="date-time"?r=r.check(Ye.iso.datetime({offset:!0})):s==="date"?r=r.check(Ye.iso.date()):s==="time"?r=r.check(Ye.regex(Nte)):s==="duration"?r=r.check(Ye.iso.duration()):s==="hostname"?r=r.check(Ye.hostname()):s==="ipv4"?r=r.check(Ye.ipv4()):s==="ipv6"?r=r.check(Ye.ipv6()):s==="mac"?r=r.check(Ye.mac()):s==="cidr"?r=r.check(Ye.cidrv4()):s==="cidr-v6"?r=r.check(Ye.cidrv6()):s==="base64"?r=r.check(Ye.base64()):s==="base64url"?r=r.check(Ye.base64url()):s==="e164"?r=r.check(Ye.e164()):s==="credit_card"?r=r.check(Ye.creditCard()):s==="iban"?r=r.check(Ye.iban()):s==="jwt"?r=r.check(Ye.jwt()):s==="emoji"?r=r.check(Ye.emoji()):s==="nanoid"?r=r.check(Ye.nanoid()):s==="cuid"?r=r.check(Ye.cuid()):s==="cuid2"?r=r.check(Ye.cuid2()):s==="ulid"?r=r.check(Ye.ulid()):s==="xid"?r=r.check(Ye.xid()):s==="ksuid"&&(r=r.check(Ye.ksuid()))}typeof n.minLength=="number"&&(r=r.min(n.minLength)),typeof n.maxLength=="number"&&(r=r.max(n.maxLength)),n.pattern&&(r=r.regex(new RegExp(n.pattern))),i=r;break}case"number":case"integer":{let r=t==="integer"?Ye.number().int():Ye.number();typeof n.minimum=="number"&&n.exclusiveMinimum!==!0&&(r=r.min(n.minimum)),typeof n.maximum=="number"&&n.exclusiveMaximum!==!0&&(r=r.max(n.maximum)),typeof n.exclusiveMinimum=="number"?r=r.gt(n.exclusiveMinimum):n.exclusiveMinimum===!0&&typeof n.minimum=="number"&&(r=r.gt(n.minimum)),typeof n.exclusiveMaximum=="number"?r=r.lt(n.exclusiveMaximum):n.exclusiveMaximum===!0&&typeof n.maximum=="number"&&(r=r.lt(n.maximum)),typeof n.multipleOf=="number"&&(r=r.multipleOf(n.multipleOf)),i=r;break}case"boolean":{i=Ye.boolean();break}case"null":{i=Ye.null();break}case"object":{let r={},s=n.properties||{},o=new Set(n.required||[]),a=typeof n.additionalProperties=="object"?rs(n.additionalProperties,e):void 0;for(let[d,h]of Object.entries(s)){let f=rs(h,e);Er(r,d,o.has(d)?f:f.optional())}if(n.patternProperties){let d=n.patternProperties,h=Object.keys(d),f=[];for(let g of h){let b=rs(d[g],e),A=Ye.string().regex(new RegExp(g));f.push(Ye.looseRecord(A,b))}let p=[];if(Object.keys(r).length>0&&p.push(Ye.object(r).passthrough()),p.push(...f),p.length===0)i=Ye.object({}).passthrough();else if(p.length===1)i=p[0];else{let g=Ye.intersection(p[0],p[1]);for(let b=2;b<p.length;b++)g=Ye.intersection(g,p[b]);i=g}if(n.additionalProperties===!1){let g=Object.keys(r),b=h.map(y=>new RegExp(y)),A=i;i=i.check(y=>{if(!Eo(y.value))return;let v=[];for(let x of Object.keys(y.value))g.includes(x)||b.some(w=>w.test(x))||v.push(x);v.length&&y.issues.push({code:"unrecognized_keys",keys:v,input:y.value,inst:A})})}}else{let d=Ye.object(r);n.additionalProperties===!1?i=d.strict():a?i=d.catchall(a):i=d.passthrough()}let c=n.propertyNames!==void 0&&n.propertyNames!==!0,l=typeof n.minProperties=="number"?n.minProperties:void 0,u=typeof n.maxProperties=="number"?n.maxProperties:void 0;if(c||l!==void 0||u!==void 0){let d;if(c){let h=typeof n.propertyNames=="object"&&n.propertyNames.type===void 0?{type:"string",...n.propertyNames}:n.propertyNames;d=rs(h,e)}i=Ite(i,{keySchema:d,minProperties:l,maxProperties:u})}break}case"array":{let r=n.prefixItems,s=n.items;if(r&&Array.isArray(r)){let o=typeof n.minItems=="number"?n.minItems:0,a=r.map(d=>rs(d,e)),c=d6(a,o),l=Array.isArray(s)?void 0:f6(s,e),u=Ye.tuple(c);i=l?u.rest(l):u,typeof n.minItems=="number"&&(i=i.check(Ye.minLength(n.minItems))),typeof n.maxItems=="number"&&(i=i.check(Ye.maxLength(n.maxItems)))}else if(Array.isArray(s)){let o=typeof n.minItems=="number"?n.minItems:0,a=s.map(d=>rs(d,e)),c=d6(a,o),l=f6(n.additionalItems,e),u=Ye.tuple(c);i=l?u.rest(l):u,typeof n.minItems=="number"&&(i=i.check(Ye.minLength(n.minItems))),typeof n.maxItems=="number"&&(i=i.check(Ye.maxLength(n.maxItems)))}else if(s!==void 0){let o=rs(s,e),a=Ye.array(o);typeof n.minItems=="number"&&(a=a.min(n.minItems)),typeof n.maxItems=="number"&&(a=a.max(n.maxItems)),i=a}else i=Ye.array(Ye.any());(n.uniqueItems===!0||n.contains!==void 0)&&(i=Bte(i,{uniqueItems:n.uniqueItems===!0,containsSchema:n.contains!==void 0?rs(n.contains,e):void 0,minContains:typeof n.minContains=="number"?n.minContains:void 0,maxContains:typeof n.maxContains=="number"?n.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${t}`)}return i}function rs(n,e){if(typeof n=="boolean")return n?Ye.any():Ye.never();let t=p6(n,e),i=n.type||n.enum!==void 0||n.const!==void 0;if(n.anyOf&&Array.isArray(n.anyOf)){let a=n.anyOf.map(l=>rs(l,e)),c=Ye.union(a);t=i?Ye.intersection(t,c):c}if(n.oneOf&&Array.isArray(n.oneOf)){let a=n.oneOf.map(l=>rs(l,e)),c=Ye.xor(a);t=i?Ye.intersection(t,c):c}if(n.allOf&&Array.isArray(n.allOf))if(n.allOf.length===0)t=i?t:Ye.any();else{let a=i?t:rs(n.allOf[0],e),c=i?0:1;for(let l=c;l<n.allOf.length;l++)a=Ye.intersection(a,rs(n.allOf[l],e));t=a}n.nullable===!0&&e.version==="openapi-3.0"&&(t=Ye.nullable(t)),n.readOnly===!0&&(t=Ye.readonly(t)),n.default!==void 0&&(t=t.default(n.default));let r={},s=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of s)a in n&&(r[a]=n[a]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let a of o)a in n&&(r[a]=n[a]);if(n.type==="object"&&n.$ref===void 0){n.propertyNames!==void 0&&!Yb(n.propertyNames)&&(r.propertyNames=n.propertyNames);for(let a of["minProperties","maxProperties"])n[a]!==void 0&&(r[a]=n[a])}if(n.type==="array"&&n.$ref===void 0){n.contains!==void 0&&!Yb(n.contains)&&(r.contains=n.contains);for(let a of["uniqueItems","minContains","maxContains"])n[a]!==void 0&&(r[a]=n[a])}for(let a of Object.keys(n))Ste.has(a)||Er(r,a,n[a]);return Object.keys(r).length>0&&e.registry.add(t,r),n.description&&(t=t.describe(n.description)),t}function m6(n,e){if(typeof n=="boolean")return n?Ye.any():Ye.never();let t;try{t=JSON.parse(JSON.stringify(n))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=Ete(t,e?.defaultTarget),r=t.$defs||t.definitions||{},s={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:t,registry:e?.registry??Tr};return rs(t,s)}var g6=Symbol("z.visit/resolving");function e0(n,e){let t=typeof e=="function"?e:(o,a)=>{let c=e[o._zod.def.type];return c?c(o,a):o},i=new Map;function r(o){let a=i.get(o);if(a===g6)return new Ib({type:"lazy",getter:()=>i.get(o)});if(a!==void 0)return a;i.set(o,g6);let c=s(o),l=t(c,c!==o);return i.set(o,l),l}function s(o){let a=o._zod.def,c=a.type;switch(c){case"object":{let l=a.shape,u=Object.keys(l),d=!1,h={};for(let p of u){let g=r(l[p]);g!==l[p]&&(d=!0),h[p]=g}let f=a.catchall;return a.catchall&&(f=r(a.catchall),f!==a.catchall&&(d=!0)),d?kn(o,{...a,shape:h,catchall:f}):o}case"array":{let l=r(a.element);return l===a.element?o:kn(o,{...a,element:l})}case"tuple":{let l=a.items,u=!1,d=[];for(let f of l){let p=r(f);p!==f&&(u=!0),d.push(p)}let h=a.rest;return a.rest&&(h=r(a.rest),h!==a.rest&&(u=!0)),u?kn(o,{...a,items:d,rest:h}):o}case"record":case"map":{let l=r(a.keyType),u=r(a.valueType);return l===a.keyType&&u===a.valueType?o:kn(o,{...a,keyType:l,valueType:u})}case"set":{let l=r(a.valueType);return l===a.valueType?o:kn(o,{...a,valueType:l})}case"union":{let l=a.options,u=!1,d=[];for(let h of l){let f=r(h);f!==h&&(u=!0),d.push(f)}return u?kn(o,{...a,options:d}):o}case"intersection":{let l=r(a.left),u=r(a.right);return l===a.left&&u===a.right?o:kn(o,{...a,left:l,right:u})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=r(a.innerType);return l===a.innerType?o:kn(o,{...a,innerType:l})}case"pipe":{let l=r(a.in),u=r(a.out);return l===a.in&&u===a.out?o:kn(o,{...a,in:l,out:u})}case"function":{let l=r(a.input),u=r(a.output);return l===a.input&&u===a.output?o:kn(o,{...a,input:l,output:u})}case"lazy":{let l=a.getter,{_cachedInner:u,...d}=a;return kn(o,{...d,getter:()=>r(l())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return o;default:return o}}return r(n)}function A6(n){return e0(n,{object:e=>e.partial(),union:e=>{let t=e._zod.def;return t.discriminator===void 0?e:rm(t.options)}})}function kte(n,e){if(!e?.length)return n;let t=n._zod.def;return kn(n,ua(t,{checks:[...t.checks??[],...e]}),{parent:!0})}function b6(n){return kte(n.out,n.checks)}function Dte(n){return n.in._zod.traits.has("$ZodTransform")?b6(n):n.in}function y6(n){return e0(n,{pipe:e=>Dte(e._zod.def),default:(e,t)=>t?gh(e._zod.def.innerType):e,catch:(e,t)=>t?e._zod.def.innerType:e})}function v6(n){return e0(n,{pipe:e=>b6(e._zod.def),prefault:(e,t)=>t?e._zod.def.innerType:e})}var Sk={};Sr(Sk,{bigint:()=>Lte,boolean:()=>Ote,date:()=>Ute,number:()=>Pte,string:()=>Fte});function Fte(n){return QB(em,n)}function Pte(n){return JB(tm,n)}function Ote(n){return sN(nm,n)}function Lte(n){return aN(im,n)}function Ute(n){return bN(Hb,n)}var pS=m.string().regex(/^[a-z][a-z0-9_]*(\.[a-z0-9][a-z0-9_]*)*$/,{error:'must be dotted lowercase segments starting with a letter; later segments may start with digits, e.g. "landmark.30_st_mary_axe"'});var o0=new Map;function Xn(n,e,t){if(o0.has(n))throw new Error(`schema kind "${n}" is already registered`);if(t.examples.length===0)throw new Error(`schema kind "${n}" must provide at least one example`);o0.set(n,{kind:n,zod:e,meta:t,legacy:[]})}function $te(n,e){return o0.get(n)?.legacy.find(t=>t.id===e)}function ll(n){return o0.get(n)}function zte(){return[...o0.keys()]}var fa=m.string().min(1).regex(/^(?![A-Za-z]:|[/\\])(?!.*\\)(?!.*(?:^|\/)\.\.?(?:\/|$)).+$/),Ok=m.string().regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/),Lk=m.string().regex(/^sha256:[0-9a-f]{64}$/),H6=m.string().regex(/^[a-z][a-z0-9-]*$/),Gte=m.strictObject({size:m.int().nonnegative().describe("Uncompressed size in bytes."),sha256:Lk.describe("sha256 of the uncompressed content."),mediaType:m.string().min(1).describe("Media type, e.g. model/gltf-binary."),block:m.string().min(1).describe("Solid block holding this file; absent when it is its own zip member.").optional(),offset:m.int().nonnegative().describe("Byte offset inside the block.").optional(),variants:m.record(m.string().regex(/^[a-z0-9][a-z0-9-]*$/),fa).describe("Alternative encodings of the same content, variant name to entry path.").optional()}),Vte=m.strictObject({format:m.literal("molen/pack@1").describe("Format envelope; always 'molen/pack@1'."),id:Ok.describe("Stable pack id, e.g. molen.entities."),version:m.string().min(1).describe("Pack version."),title:m.string().min(1).describe("Human-readable pack name.").optional(),license:m.string().min(1).describe("SPDX expression for the pack's content.").optional(),notice:fa.describe("Entry that carries the attribution notice.").optional(),contentHash:Lk.describe("sha256 over every logical file (path and content), independent of the zip layout."),provides:m.record(H6,m.array(fa)).describe("Role (e.g. types, stylepack, stars) to the entry paths that provide it.").default({}),ids:m.record(pS,fa).describe("Asset id to the entry path of its runtime file.").default({}),blocks:m.record(m.string().min(1),m.strictObject({entry:m.string().min(1).describe("Zip member holding the block."),size:m.int().nonnegative().describe("Uncompressed block size in bytes.")})).describe("Solid blocks: many small files compressed together as one zip member.").default({}),entries:m.record(fa,Gte).describe("Every logical file in the pack, by path.")});function Hte(n){let e=n,t=[],i=r=>e.entries[r]!==void 0;for(let[r,s]of Object.entries(e.entries)){if((r==="molen-pack.json"||r.startsWith("molen-pack/"))&&t.push({path:`/entries/${r}`,code:"reserved_pack_path",message:`"${r}" is reserved for the pack's own structure`}),s.block===void 0!=(s.offset===void 0)&&t.push({path:`/entries/${r}`,code:"block_offset_pair",message:"block and offset must be given together"}),s.block!==void 0){let o=e.blocks[s.block];o===void 0?t.push({path:`/entries/${r}/block`,code:"unknown_block",message:`block "${s.block}" is not declared in blocks`}):(s.offset??0)+s.size>o.size&&t.push({path:`/entries/${r}`,code:"block_overrun",message:`offset ${s.offset} + size ${s.size} runs past block "${s.block}" (${o.size} bytes)`})}for(let[o,a]of Object.entries(s.variants??{}))i(a)||t.push({path:`/entries/${r}/variants/${o}`,code:"unknown_entry",message:`variant "${o}" points at "${a}", which is not an entry`})}e.notice!==void 0&&!i(e.notice)&&t.push({path:"/notice",code:"unknown_entry",message:`notice "${e.notice}" is not an entry`});for(let[r,s]of Object.entries(e.ids))i(s)||t.push({path:`/ids/${r}`,code:"unknown_entry",message:`asset "${r}" points at "${s}", which is not an entry`});for(let[r,s]of Object.entries(e.provides))for(let o of s)i(o)||t.push({path:`/provides/${r}`,code:"unknown_entry",message:`"${r}" lists "${o}", which is not an entry`});return t}var jte=m.strictObject({format:m.literal("molen/pack-source@1").describe("Format envelope; always 'molen/pack-source@1'."),id:Ok.describe("Stable pack id, e.g. molen.entities."),version:m.string().min(1).describe("Pack version."),title:m.string().min(1).describe("Human-readable pack name.").optional(),license:m.string().min(1).describe("SPDX expression for the pack's content.").optional(),notice:fa.describe("File that carries the attribution notice.").optional(),include:m.array(m.string().min(1)).describe("Globs (*, **, ?) of files to include, relative to the source directory.").default(["**"]),exclude:m.array(m.string().min(1)).describe("Globs of files to leave out.").default([]),ids:m.record(pS,fa).describe("Extra asset id to file mappings. Ids declared by molen/asset@1 sidecars are added automatically.").default({}),provides:m.record(H6,m.union([fa,m.array(fa)])).describe("Role (e.g. types, stylepack, stars) to the file or files that provide it.").default({}),independent:m.array(fa).describe("Files or directory prefixes ending / kept independently readable.").default([]),solid:m.boolean().describe("Group small text files into compressed solid blocks (default true).").default(!0)}),Qte=m.strictObject({format:m.literal("molen/pack-index@1").describe("Format envelope; always 'molen/pack-index@1'."),packs:m.record(Ok,m.strictObject({version:m.string().min(1).describe("Pack version."),file:fa.describe("Pack file, relative to the index."),contentHash:Lk.describe("The pack manifest's contentHash."),size:m.int().nonnegative().describe("File size in bytes.")})).describe("Pack id to its current built file.")}),n0="sha256:0000000000000000000000000000000000000000000000000000000000000000";Xn("pack",Vte,{id:"molen/pack@1",title:"Content pack manifest",description:"Manifest inside a content pack: a zip file carrying models, documents and catalogs outside the code packages. It lists every logical file with its size and hash, the asset ids it provides, and the roles (types, stylepack, stars, ...) its files fill.",examples:[{format:"molen/pack@1",id:"example.vehicles",version:"1.0.0",license:"CC0-1.0",notice:"NOTICE.md",contentHash:n0,provides:{types:["types/vehicles.types.json"]},ids:{"example.vehicle.roadster":"models/roadster/model.glb"},blocks:{types:{entry:"molen-pack/blocks/types.blk",size:2400}},entries:{"NOTICE.md":{size:180,sha256:n0,mediaType:"text/markdown"},"models/roadster/model.glb":{size:88120,sha256:n0,mediaType:"model/gltf-binary"},"types/vehicles.types.json":{size:2400,sha256:n0,mediaType:"application/json",block:"types",offset:0}}}],validate:Hte});Xn("pack-source",jte,{id:"molen/pack-source@1",title:"Content pack source",description:"Build settings for a content pack, kept as molen-pack.source.json in the directory `molen pack build` turns into a pack.",examples:[{format:"molen/pack-source@1",id:"example.vehicles",version:"1.0.0",license:"CC0-1.0",notice:"NOTICE.md",include:["**"],exclude:["**/*.psd"],ids:{},provides:{types:"types/vehicles.types.json"},solid:!0}]});Xn("pack-index",Qte,{id:"molen/pack-index@1",title:"Content pack index",description:"Lists the current built file of each pack in a directory, so a host can publish several packs and clients can find them by id.",examples:[{format:"molen/pack-index@1",packs:{"example.vehicles":{version:"1.0.0",file:"example.vehicles-0123456789ab.zip",contentHash:n0,size:91234}}}]});var i0=m.string().min(1).regex(/^(?![A-Za-z]:|[/\\])(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$)).+$/),Nk=m.string().regex(/^[a-z][a-z0-9_.-]*$/),Wte=m.string().regex(/^sha256:[0-9a-f]{64}$/),oS=m.strictObject({id:Nk.describe("Stable role/name for this file inside the logical source bundle."),path:i0.describe("Bundle-relative source path; it may not escape the bundle.")}),qte=m.strictObject({format:m.literal("molen/source-bundle@1").describe("Format envelope; always 'molen/source-bundle@1'."),id:Nk.describe("Stable logical content id, normally the runtime entity or asset id."),kind:m.string().regex(/^[a-z][a-z0-9-]*$/).describe("Open content class such as 'entity', 'vehicle', or 'worldgen-structure'."),title:m.string().min(1).describe("Human-readable content name."),order:m.int().nonnegative().describe("Optional stable presentation or build order within an owning collection.").optional(),files:m.strictObject({definitions:m.array(i0).describe("Bundle-relative JSON definitions, manifests, recipes, or configuration files.").default([]),models:m.array(m.strictObject({path:i0.describe("Bundle-relative editable model or model recipe path."),assetId:Nk.describe("Runtime asset id produced from this source model, when applicable.").optional(),output:i0.describe("Owning-project-relative output path of the generated molen/asset@1 sidecar, when applicable.").optional(),pipeline:m.enum(["copy","import"]).describe("'copy' when the editable GLB is already canonical; 'import' when molen asset import derives the runtime model.").optional(),sha256:Wte.describe("Optional pinned authoring-source hash for binary model masters.").optional()})).describe("Editable model masters and procedural model recipes.").default([]),generators:m.array(oS).describe("Authoring programs used to create, verify, or transform owned source files.").default([]),scripts:m.array(oS).describe("Deterministic behavior scripts owned by this logical thing.").default([]),textures:m.array(oS).describe("Authoring texture sources owned by this logical thing.").default([]),sounds:m.array(oS).describe("Authoring audio sources owned by this logical thing.").default([]),documents:m.array(i0).describe("Bundle-relative provenance, briefs, verification reports, and previews.").default([])}).describe("Every source file owned by the logical thing. Shared engine code and generated runtime outputs are intentionally excluded.")});function Kte(n){let e=n,t=[...e.files.definitions,...e.files.models.map(r=>r.path),...e.files.generators.map(r=>r.path),...e.files.scripts.map(r=>r.path),...e.files.textures.map(r=>r.path),...e.files.sounds.map(r=>r.path),...e.files.documents],i=[];t.length===0&&i.push({path:"/files",code:"empty_source_bundle",message:"a source bundle must list at least one owned source file"});for(let r of new Set(t))t.filter(s=>s===r).length>1&&i.push({path:"/files",code:"duplicate_source_path",message:`source path "${r}" is listed more than once`});return i}Xn("source-bundle",qte,{id:"molen/source-bundle@1",title:"Logical source bundle",description:"Portable authoring-time manifest for one logical thing: definitions, editable models or recipes, generators, behavior scripts, textures, sounds, and documentation under one directory.",examples:[{format:"molen/source-bundle@1",id:"example.vehicle.roadster",kind:"vehicle",title:"Roadster",order:10,files:{definitions:["entity.types.json"],models:[{path:"models/source.glb",assetId:"example.vehicle.roadster",output:"assets/example/vehicle/roadster/asset.json",pipeline:"import",sha256:"sha256:0000000000000000000000000000000000000000000000000000000000000000"}],generators:[{id:"model",path:"models/generate.mjs"}],scripts:[{id:"interactions",path:"scripts/interactions.ts"}],textures:[],sounds:[],documents:["README.md"]}}],docsRef:"guide/source-bundles.md",validate:Kte});var Uk=m.string().regex(/^[a-zA-Z][a-zA-Z0-9]*$/).max(64),$k=m.number().finite().min(0).max(1),j6=m.record(Uk,m.strictObject({seconds:m.number().finite().nonnegative().describe("Seconds for full travel or a full cycle."),initial:$k.optional().describe("Rest position or phase; defaults to zero."),mode:m.enum(["position","cycle","latch"]).optional().describe("Position by default. Cycles park when off; latches cannot reverse.")}).refine(n=>n.mode!=="cycle"||n.seconds>0,"Cycles require positive seconds.")),Q6=m.record(Uk,m.union([$k,m.boolean()])),W6=m.record(Uk,$k),uS=m.number(),Ek=m.array(uS).length(3),t0=m.string().min(1).regex(/^(?![A-Za-z]:|[/\\])(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$)).+$/),om=m.string().regex(/^sha256:[0-9a-f]{64}$/),Xte=1e6,Zte=3e6,nFe=64*1024*1024,Jte=m.strictObject({format:m.literal("molen/asset@1").describe("Format envelope; always 'molen/asset@1'."),id:m.string().min(1).describe("Asset id referenced by renderable.ref / collider3d.shape.assetId, e.g. 'crate'."),kind:m.enum(["model","audio"]).describe("Asset kind: model (glTF/GLB) or audio."),files:m.strictObject({main:t0.describe("Sidecar-relative path of the main file (the GLB)."),collision:t0.describe("Sidecar-relative path of the collision trimesh binary, if any.").optional(),variants:m.record(m.string(),t0).describe("Variant name to sidecar-relative file path (e.g. LOD or compressed variants).").default({})}).describe("Files that make up the asset, relative to the sidecar directory."),hash:om.describe("'sha256:<hex>' of files.main."),sourceHash:om.describe("'sha256:<hex>' of the pre-import source file.").optional(),runtimeLods:m.strictObject({recipe:m.int().positive(),recipeHash:om.optional(),masterHash:om,levels:m.array(m.strictObject({name:m.enum(["skyline","district","street","closeup"]),file:t0,hash:om,bytes:m.int().positive(),gzipBytes:m.int().positive(),triangles:m.int().positive(),cpuBytes:m.int().positive(),gpuBytes:m.int().positive(),errorMeters:m.number().finite().nonnegative(),drawCalls:m.int().positive()})).length(4).refine(n=>n.every((e,t)=>e.name===["skyline","district","street","closeup"][t]),"Runtime LODs must be ordered skyline, district, street, closeup")}).describe("Separately fetchable source-derived runtime LODs, bound to the master hash.").optional(),bounds:m.strictObject({aabb:m.strictObject({min:Ek.describe("Minimum corner [x, y, z] in meters."),max:Ek.describe("Maximum corner [x, y, z] in meters.")}).describe("Axis-aligned bounding box in model space."),sphere:m.strictObject({center:Ek.describe("Sphere center [x, y, z] in meters."),radius:uS.nonnegative().describe("Sphere radius in meters.")}).describe("Bounding sphere in model space.")}).describe("Model-space bounds (meters, Y-up) for placement, culling, and headless reasoning."),stats:m.strictObject({triangles:m.int().nonnegative().describe("Total triangle count."),vertices:m.int().nonnegative().describe("Total vertex count."),meshes:m.int().nonnegative().describe("Number of glTF meshes."),primitives:m.int().nonnegative().describe("Number of mesh primitives (draw calls)."),materials:m.int().nonnegative().describe("Number of materials."),textures:m.int().nonnegative().describe("Number of textures."),animations:m.int().nonnegative().describe("Number of animation clips."),sizeBytes:m.int().nonnegative().describe("Size of files.main in bytes.")}).describe("Size and complexity summary of the asset."),nodes:m.array(m.strictObject({name:m.string().describe("glTF node name (usable as renderable.node)."),triangles:m.int().nonnegative().describe("Triangles under this node.")})).describe("Named mesh-bearing nodes (capped; see nodesTruncated).").default([]),nodesTruncated:m.boolean().describe("True when the nodes list was capped and omits some nodes.").default(!1),animations:m.array(m.strictObject({name:m.string().describe("Clip name (usable as renderable.animation.clip)."),durationSec:uS.nonnegative().describe("Clip duration in seconds at speed 1."),channels:m.int().nonnegative().describe("Number of animated channels in the clip.")})).describe("Animation clips in the asset.").default([]),materials:m.array(m.strictObject({name:m.string().describe("Material name."),slots:m.array(m.enum(["baseColor","roughness","metalness","normal","emissive","ao"])).describe("Texture slots the material binds.").default([]),doubleSided:m.boolean().describe("Whether the material renders both faces.").default(!1),alphaMode:m.enum(["OPAQUE","MASK","BLEND"]).describe("glTF alpha mode.").default("OPAQUE")})).describe("Materials in the asset (name-level summary).").default([]),collision:m.strictObject({hulls:m.array(m.strictObject({node:m.string().describe("Mesh-bearing node the hull was computed from."),points:m.array(uS).min(12).max(192).describe("Flat [x, y, z, ...] hull vertices in meters (4..64 points, rounded to 1e-4).")})).describe("Convex hulls, one per mesh-bearing node (used by collider3d shape.type = asset).").default([]),trimesh:m.strictObject({bin:t0.describe("Sidecar-relative filename of the collision binary."),positions:m.strictObject({byteOffset:m.int().nonnegative().multipleOf(4).describe("Byte offset of the position block in the binary (4-byte aligned)."),count:m.int().positive().max(Xte).describe("Number of vertices (f32le [x, y, z] triples in meters).")}).describe("Vertex position block: f32le xyz triples."),indices:m.strictObject({byteOffset:m.int().nonnegative().multipleOf(4).describe("Byte offset of the index block in the binary (4-byte aligned)."),count:m.int().positive().max(Zte).multipleOf(3).describe("Number of u32le indices (a multiple of 3; three per triangle).")}).describe("Triangle index block: u32le indices."),hash:om.describe("'sha256:<hex>' of the collision binary.")}).describe("Exact triangle-mesh collision geometry stored in an external binary.").optional()}).describe("Collision geometry for headless physics."),extensionsUsed:m.array(m.string()).describe("glTF extensions the asset uses (e.g. KHR_draco_mesh_compression).").default([])});function Yte(n){let e=n,t=[];return e.collision.hulls.forEach((i,r)=>{i.points.length%3!==0&&t.push({path:`/collision/hulls/${r}/points`,code:"hull_arity",message:"collision hull points must contain complete xyz triples"})}),t}Xn("asset",Jte,{id:"molen/asset@1",title:"Asset sidecar",description:"Per-asset metadata written by `molen asset import`: bounds + collision geometry for headless physics, and name-level node/animation/material summaries for agents.",examples:[{format:"molen/asset@1",id:"crate",kind:"model",files:{main:"model.glb",variants:{}},hash:"sha256:0000000000000000000000000000000000000000000000000000000000000000",bounds:{aabb:{min:[-.5,0,-.5],max:[.5,1,.5]},sphere:{center:[0,.5,0],radius:.87}},stats:{triangles:12,vertices:24,meshes:1,primitives:1,materials:1,textures:0,animations:0,sizeBytes:1024},nodes:[{name:"Crate",triangles:12}],nodesTruncated:!1,animations:[],materials:[{name:"wood",slots:["baseColor"],doubleSided:!1,alphaMode:"OPAQUE"}],collision:{hulls:[{node:"Crate",points:[-.5,0,-.5,.5,0,-.5,.5,0,.5,-.5,0,.5,-.5,1,-.5,.5,1,-.5,.5,1,.5,-.5,1,.5]}]},extensionsUsed:[]}],docsRef:"schemas/asset.md",validate:Yte});function kk(n,e,t){let i=[];for(let r of n.issues)q6(r,e,t,i);return i}function q6(n,e,t,i){if(n.code==="invalid_union"&&Array.isArray(n.errors)&&n.errors.length>0){let r,s=-1;for(let o of n.errors){let a=o.reduce((c,l)=>Math.max(c,l.path.length),0);a>s&&(s=a,r=o)}if(r!==void 0&&s>0){for(let o of r)q6(ene(o,n.path),e,t,i);return}}i.push(nne(n,e,t))}function ene(n,e){return e.length===0?n:{...n,path:[...e,...n.path]}}var x6=/^molen\/([a-z-]+(?:\/[a-z-]+)*)@(\d+)$/;function tne(n,e,t){let i=e.values??[],r=i.length===1?i[0]:void 0;if(typeof r!="string")return;let s=x6.exec(r);if(s===null)return;let o=s[1],a=Number(s[2]),c=JSON.stringify(r);if(t===void 0)return{path:n,code:"missing_format",message:`missing "format" envelope; every ${o} document declares one`,expected:c,received:"undefined (missing)",hint:`add "format": ${c} as the first key \u2014 it is how every tool identifies the document`};if(typeof t!="string")return;let l=x6.exec(t);if(l===null)return;let u=l[1],d=Number(l[2]),h=JSON.stringify(t);return u!==o?{path:n,code:"format_kind_mismatch",message:`document declares ${h}, which is a ${u} document, not a ${o}`,expected:c,received:h,hint:`validate it as a ${u} (the kind is taken from "format"), or replace the envelope if this really is a ${o}`}:{path:n,code:"format_version_skew",message:`document declares ${h}; this build reads ${c}`,expected:c,received:h,hint:d<a?`${o}@${a} is a different shape, not a renamed ${o}@${d}: re-author the document against the current schema (\`molen schema get ${o}\`) instead of bumping the version string`:`${o}@${d} is newer than this build reads: upgrade @bendyline/molen-* to a version that ships ${o}@${d}, or re-author the document as ${c}`}}function nne(n,e,t){let i=ine(n.code==="unrecognized_keys"&&n.keys?.length===1&&n.keys[0]!==void 0?[...n.path,n.keys[0]]:n.path),r=rne(e,n.path),s=n.message,o,a,c=sne(r);if(n.code==="invalid_value"&&i==="/format"&&n.path.length===1){let u=tne(i,n,r);if(u!==void 0)return u}switch(n.code){case"invalid_type":o=String(n.expected),r===void 0&&(c="undefined (missing)");break;case"invalid_value":{let u=n.values??[];if(o=`one of: ${u.map(d=>JSON.stringify(d)).join(", ")}`,typeof r=="string"){let d=ss(r,u.filter(h=>typeof h=="string"));d!==void 0&&(a=`did you mean ${JSON.stringify(d)}?`)}break}case"unrecognized_keys":{let u=n.keys??[];s=`unknown key${u.length>1?"s":""}: ${u.map(h=>JSON.stringify(h)).join(", ")}`;let d=one(t,n.path);if(d!==void 0&&d.length>0&&(o=`known keys: ${d.join(", ")}`,u.length===1&&u[0]!==void 0)){let h=ss(u[0],d);h!==void 0&&(a=`did you mean ${JSON.stringify(h)}?`)}c=void 0;break}case"too_small":o=`${n.origin??"value"} of at least ${String(n.minimum)}`;break;case"too_big":o=`${n.origin??"value"} of at most ${String(n.maximum)}`;break;case"invalid_format":o=n.format!==void 0?`string matching ${n.format}`:"valid format";break;default:break}let l={path:i,code:n.code??"invalid",message:s};return o!==void 0&&(l.expected=o),c!==void 0&&(l.received=c),a!==void 0&&(l.hint=a),l}function ine(n){return n.length===0?"":`/${n.map(e=>String(e).replaceAll("~","~0").replaceAll("/","~1")).join("/")}`}function rne(n,e){let t=n;for(let i of e){if(t===null||typeof t!="object")return;t=t[i]}return t}var _6=60;function sne(n){if(n===void 0)return"undefined";let e;try{e=JSON.stringify(n)??String(n)}catch{e=String(n)}return e.length>_6?`${e.slice(0,_6-1)}\u2026`:e}function w6(n){if(!(n instanceof m.ZodUnion))return;let e=n.options;return Array.isArray(e)?e.map(Dk):void 0}function one(n,e){if(n!==void 0)try{let t=Dk(n);for(let r of e){if(t===void 0)return;let s=w6(t);if(s!==void 0)t=s.map(o=>o instanceof m.ZodObject?o.shape[String(r)]:void 0).find(o=>o!==void 0);else if(t instanceof m.ZodObject)t=t.shape[String(r)];else if(t instanceof m.ZodArray)t=t.element;else if(t instanceof m.ZodRecord)t=t.valueType;else return;t=t===void 0?void 0:Dk(t)}if(t instanceof m.ZodObject)return Object.keys(t.shape);let i=t===void 0?void 0:w6(t);if(i!==void 0){let r=new Set;for(let s of i){if(!(s instanceof m.ZodObject))return;for(let o of Object.keys(s.shape))r.add(o)}return r.size>0?[...r]:void 0}return}catch{return}}function Dk(n){let e=n;for(let t=0;t<8;t++){let i=e;if(typeof i.unwrap=="function"){e=i.unwrap();continue}return e}return e}function ss(n,e){return mS(n,e)?.candidate}function mS(n,e){let t,i=Number.POSITIVE_INFINITY;for(let s of e){let o=ane(n.toLowerCase(),s.toLowerCase());o<i&&(i=o,t=s)}let r=Math.max(2,Math.floor(n.length/3));return t!==void 0&&i<=r?{candidate:t,distance:i}:void 0}function ane(n,e){if(n===e)return 0;let t=n.length,i=e.length;if(t===0)return i;if(i===0)return t;let r=new Array(i+1),s=new Array(i+1);for(let o=0;o<=i;o++)r[o]=o;for(let o=1;o<=t;o++){s[0]=o;for(let a=1;a<=i;a++){let c=n[o-1]===e[a-1]?0:1;s[a]=Math.min(s[a-1]+1,r[a]+1,r[a-1]+c)}[r,s]=[s,r]}return r[i]}var Vi=m.number().finite(),cne=m.array(Vi).length(3),K6=/^[a-z0-9][a-z0-9_-]*(\.[a-z0-9][a-z0-9_-]*)*$/,X6=/^[a-z][a-z0-9-]*$/;var Bu=m.string().regex(K6).describe('Sound id from a molen/soundbank@1 document, e.g. "ambience.rain.medium".'),gS=m.string().regex(X6).describe("Mixer bus: music, ambience, sfx, ui, voice, or a custom lowercase name."),vh=Vi.min(0).max(4),lne=m.array(Vi.positive()).length(2),lm=Vi.nonnegative(),une=m.strictObject({refDistance:Vi.positive().optional().describe("Distance in meters at which the sound plays at full gain; default 1."),maxDistance:Vi.positive().optional().describe("Distance in meters beyond which the sound is culled; default 60."),rolloff:Vi.nonnegative().optional().describe("How fast gain falls off past refDistance; default 1."),model:m.enum(["linear","inverse","exponential"]).optional().describe("Distance attenuation model (Web Audio PannerNode.distanceModel); default inverse.")}),Z6=m.union([m.literal(!1),une]).describe("false = non-positional (2D); an object = positional with these distance settings."),dne=m.strictObject({license:m.string().min(1).describe('SPDX-style license of this recording, e.g. "CC0-1.0". Required provenance.'),site:m.string().optional().describe("Where it came from: freesound, kenney, opengameart, \u2026"),url:m.string().optional().describe("Page of the original recording."),author:m.string().optional().describe("Recordist or creator."),title:m.string().optional().describe("Original title."),prompt:m.string().optional().describe("Prompt text, when the clip was generated."),generator:m.string().optional().describe("Generator/model name, when the clip was generated."),notes:m.string().optional().describe("Edits made: trims, loudness normalization, loop points.")}),hne=m.strictObject({clips:m.array(m.string().min(1)).min(1).describe("Audio files relative to the bank document (MP3 plays in every browser). Several clips = variations picked per play."),description:m.string().optional().describe('What it sounds like, for agents choosing sounds ("steady medium rain on leaves").'),tags:m.array(m.string()).optional().describe("Search tags."),loop:m.boolean().optional().describe("Loop the clip (ambience, engines); default false."),loopStart:lm.optional().describe("Loop start in seconds (trims encoder padding)."),loopEnd:lm.optional().describe("Loop end in seconds; must exceed loopStart."),gain:vh.optional().describe("Linear base gain; default 1."),pitch:lne.optional().describe("[min, max] playback-rate range; each play picks a value in it. Default [1, 1]."),bus:gS.optional().describe("Default bus; default sfx."),spatial:Z6.optional(),durationS:lm.optional().describe("Clip duration in seconds (written by molen audio import)."),hash:m.string().optional().describe('sha256 of the first clip, "sha256:<hex>".'),source:dne.describe("Provenance: license plus origin or generation prompt.")}),fne=m.strictObject({format:m.literal("molen/soundbank@1").describe("Format envelope; always 'molen/soundbank@1'."),id:m.string().min(1).describe('Bank id, usually the content pack id, e.g. "molen.sounds".'),title:m.string().optional().describe("Human title."),license:m.string().optional().describe("Bank-wide license policy. When set, every sound must carry exactly this source.license."),sounds:m.record(m.string().regex(K6),hne).describe("Sound id \u2192 entry. Later banks override earlier ones with the same id.")});function pne(n){let e=n,t=[];for(let[i,r]of Object.entries(e.sounds)){let s=`/sounds/${i}`;r.loopStart!==void 0&&r.loopEnd!==void 0&&r.loopEnd<=r.loopStart&&t.push({path:`${s}/loopEnd`,code:"loop_range",message:`loopEnd (${r.loopEnd}) must be greater than loopStart (${r.loopStart})`}),r.durationS!==void 0&&r.loopEnd!==void 0&&r.loopEnd>r.durationS+1e-6&&t.push({path:`${s}/loopEnd`,code:"loop_range",message:`loopEnd (${r.loopEnd}) is past the clip end (${r.durationS}s)`}),r.pitch&&r.pitch[0]>r.pitch[1]&&t.push({path:`${s}/pitch`,code:"pitch_range",message:"pitch is [min, max]; min must not exceed max"}),r.clips.forEach((o,a)=>{(o.startsWith("/")||o.split("/").includes("..")||/^[a-z]+:/i.test(o))&&t.push({path:`${s}/clips/${a}`,code:"clip_path",message:`clip "${o}" must be a relative path inside the bank's directory`})}),new Set(r.clips).size!==r.clips.length&&t.push({path:`${s}/clips`,code:"duplicate_clip",message:"clips repeat a file"}),e.license!==void 0&&r.source.license!==e.license&&t.push({path:`${s}/source/license`,code:"license_policy",message:`sound is licensed "${r.source.license}" but the bank requires "${e.license}"`,hint:"move it to a bank with a compatible license, or replace the recording"})}return t}var S6=m.union([m.string(),Vi,m.boolean()]),mne=m.union([S6,m.array(S6).min(1),m.strictObject({min:Vi.optional().describe("Inclusive lower bound."),max:Vi.optional().describe("Inclusive upper bound.")}),m.strictObject({exists:m.boolean().describe("true = the signal resolves to a value.")})]),a0=m.record(m.string().min(1),mne).describe("Conditions that must ALL hold, keyed by signal: a value (equality), a list (any of), {min,max} (inclusive range), or {exists}."),gne=m.array(Vi).length(2),E6=m.strictObject({signal:m.string().min(1).describe("Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."),curve:m.array(gne).min(1).describe("Piecewise-linear [input, output] points, clamped at the ends."),smoothS:lm.optional().describe("Smoothing time constant in seconds; default 0.15.")}),hS=m.union([E6,m.array(E6).min(1)]);var Ane=m.strictObject({signal:m.string().min(1).describe("Signal to watch (see signal paths)."),every:Vi.positive().optional().describe("Fire each time the signal advances by this much (odometer-style, e.g. meters)."),onChange:m.boolean().optional().describe("Fire whenever the signal value changes."),sound:Bu.optional().describe("Sound to fire; default the source's own sound.")}),bne=m.strictObject({sound:Bu,loop:m.boolean().optional().describe("Loop while active; default the sound's own loop flag."),autoplay:m.boolean().optional().describe("Play when the entity exists and `when` holds; default true. false = only triggerFrom/startTick fire it."),gain:vh.optional().describe("Gain multiplier; default 1."),pitch:Vi.positive().optional().describe("Playback-rate multiplier; default 1."),bus:gS.optional(),spatial:Z6.optional().describe("Override the sound's spatial settings. Positional sources follow the entity's transform."),when:a0.optional(),gainFrom:hS.optional().describe("Drive gain from a signal, or from several whose curves multiply."),pitchFrom:hS.optional().describe("Drive pitch from a signal, or from several whose curves multiply."),triggerFrom:Ane.optional().describe("Fire one-shots from a signal (footsteps from distance, clicks on change)."),startTick:Vi.int().nonnegative().optional().describe("Play once at this tick; changing it retriggers (like renderable.animation).")}),yne=m.strictObject({sound:Bu.describe("Looping ambience played while the listener is inside the zone."),shape:m.discriminatedUnion("kind",[m.strictObject({kind:m.literal("sphere").describe("Sphere around the entity."),radius:Vi.positive().describe("Radius in meters.")}),m.strictObject({kind:m.literal("box").describe("Axis-aligned box around the entity."),halfExtents:cne.describe("Half sizes [x, y, z] in meters, axis-aligned.")})]).describe("Zone volume, centered on the entity's transform."),fade:Vi.nonnegative().optional().describe("Meters outside the shape over which gain fades to zero; default 5."),gain:vh.optional().describe("Gain multiplier; default 1."),bus:gS.optional().describe("Default ambience."),when:a0.optional()}),vne=m.strictObject({sound:Bu,when:a0.optional(),gain:vh.optional().describe("Gain multiplier; default 1."),gainFrom:hS.optional().describe("Drive gain from a signal, or from several whose curves multiply."),pitchFrom:hS.optional().describe("Drive pitch from a signal, or from several whose curves multiply."),fadeS:lm.optional().describe("Fade in/out time in seconds; default 1.5.")}),xne=m.strictObject({sound:Bu,at:m.string().optional().describe('Where it plays: "listener" (2D) or "payload.<field>" naming an entity id or [x,y,z]. Default: payload.entity, payload.position, payload.a, else listener.'),gain:vh.optional(),pitch:Vi.positive().optional(),bus:gS.optional()}),_ne=m.strictObject({buses:m.record(m.string().regex(X6),Vi.min(0).max(2)).optional().describe("Bus gains (music, ambience, sfx, ui, voice, custom), default 1 each."),ambience:m.array(vne).optional().describe("Looping ambience layers, each active while its `when` holds."),music:m.strictObject({playlist:m.array(Bu).min(1).describe("Tracks, played on the music bus."),mode:m.enum(["sequence","shuffle"]).optional().describe("Default sequence."),crossfadeS:lm.optional().describe("Crossfade between tracks; default 4."),gain:vh.optional().describe("Music gain multiplier; default 1."),when:a0.optional()}).optional().describe("Background music; scripts switch it with molen.audio.music()."),events:m.record(m.string().min(1),xne).optional().describe('Engine/script event type \u2192 one-shot sound (e.g. "crash", "delivery").'),footsteps:m.strictObject({sound:Bu.describe("Default footstep sound."),surfaces:m.record(m.string(),Bu).optional().describe("listener.surface value \u2192 footstep sound (grass, concrete, wood\u2026)."),strideM:Vi.positive().optional().describe("Meters per step; default 0.75."),gain:vh.optional().describe("Footstep gain multiplier; default 1."),when:a0.optional().describe('Default { "listener.grounded": true }.')}).optional().describe("Listener footsteps from distance travelled (walk modes, first-person games)."),listenerEntity:m.string().optional().describe("Entity treated as the listener's body; <component>.<field> signals in ambience/music/footsteps resolve on it."),maxVoices:Vi.int().min(1).max(256).optional().describe("Voice budget; default 32.")});var wne={format:"molen/soundbank@1",id:"my.sounds",license:"CC0-1.0",sounds:{"ambience.rain.medium":{clips:["ambience/rain-medium.mp3"],description:"Steady medium rain on foliage and pavement.",loop:!0,loopStart:.05,loopEnd:29.9,gain:.8,bus:"ambience",spatial:!1,durationS:30,source:{license:"CC0-1.0",site:"freesound",url:"https://freesound.org/s/000000/"}},"footstep.grass":{clips:["footsteps/grass-1.mp3","footsteps/grass-2.mp3","footsteps/grass-3.mp3"],description:"Single footstep on short grass.",pitch:[.94,1.06],gain:.6,bus:"sfx",source:{license:"CC0-1.0",site:"kenney",notes:"trimmed, normalized to -16 LUFS"}}}};Xn("soundbank",fne,{id:"molen/soundbank@1",title:"Sound bank",description:"Named sounds for the audio director: clip files (relative to the bank), loop points, gain, pitch range, bus, spatial defaults and required provenance. Content packs expose banks under provides.soundbank.",examples:[wne],docsRef:"guide/audio.md",validate:pne});var xn=m.number().finite(),Sne=m.strictObject({waves:m.array(m.strictObject({amplitude:xn.min(0).max(10).describe("Swell amplitude in meters."),wavelength:xn.min(1).describe("Wavelength in meters."),direction:xn.describe("Travel direction in radians; zero is +Z."),speed:xn.min(0).describe("Wave propagation speed in m/s.")})).max(8).optional().describe("Up to eight travelling swells added to the water surface."),current:m.tuple([xn,xn]).optional().describe("Current [east, south] in m/s.")}),Ene=m.strictObject({label:m.string().min(1).describe("Human-readable vessel name."),length:xn.positive().describe("Hull length along Z in meters."),width:xn.positive().describe("Hull width along X in meters."),height:xn.positive().describe("Vessel height in meters."),draft:xn.positive().describe("Minimum water depth in meters."),mass:xn.positive().describe("Mass in kg."),thrust:xn.positive().describe("Forward propeller thrust in newtons."),maxSpeed:xn.positive().describe("Maximum forward speed through water in m/s."),reverseSpeed:xn.positive().describe("Maximum reverse speed through water in m/s."),turnRate:xn.positive().describe("Maximum cruise yaw rate in radians per second."),turnResponse:xn.positive().describe("Time to build or lose yaw rate in seconds."),lateralDrag:xn.positive().describe("Lateral water resistance per second."),buoyancyFrequency:xn.positive().max(4).describe("Buoyancy spring frequency in hertz."),driverEye:m.tuple([xn,xn,xn]).describe("Helm eye position in local meters.")}),Tne=m.strictObject({throttle:xn.min(-1).max(1).describe("Signed propeller power; negative reverses thrust."),steering:xn.min(-1).max(1).describe("Signed helm input; positive turns right."),anchor:m.boolean().describe("Request the low-speed anchor; release to apply thrust.")}),Mne=m.strictObject({boosted:m.boolean().optional().describe("Horizontal speeds include the 4\xD7 travel boost."),speed:xn.describe("Forward speed through water in m/s."),lateralSpeed:xn.describe("Lateral speed through water in m/s."),velocity:m.tuple([xn,xn]).describe("World velocity [east, south] including current in m/s."),yaw:xn.describe("Heading about +Y in radians."),yawRate:xn.describe("Yaw rate in radians per second."),steer:xn.describe("Smoothed helm input in [-1, 1]."),pitch:xn.describe("Hull pitch in radians."),roll:xn.describe("Hull roll in radians."),vy:xn.describe("Vertical buoyancy velocity in m/s."),anchored:m.boolean().describe("Whether the low-speed anchor is engaged."),grounded:m.boolean().describe("Whether the hull is stopped by insufficient depth."),waitingForWater:m.boolean().describe("Whether motion is paused for unavailable water data.")});function Ine(n){return n.filter(e=>e.severity!=="notice")}function Cne(n){return n.filter(e=>e.severity==="notice")}var Tk=10;function r0(n,e){let t=e.slice(0,Tk),i=[];return i.push(`\u2716 ${n} failed validation (${e.length} issue${e.length===1?"":"s"})`),t.forEach((r,s)=>{i.push(""),i.push(`${s+1}. ${r.path===""?"/":r.path}`),i.push(` ${r.message}`),r.expected!==void 0&&i.push(` expected: ${r.expected}`),r.received!==void 0&&i.push(` received: ${r.received}`),r.hint!==void 0&&i.push(` hint: ${r.hint}`),r.docsRef!==void 0&&i.push(` docs: ${r.docsRef}`)}),e.length>Tk&&(i.push(""),i.push(`\u2026and ${e.length-Tk} more`)),i.join(`
|
|
4791
|
-
`)}var T6=1e3;function M6(n,e){let t=n[e],i;if(t==="*"||t==="+"||t==="?")i=e+1;else if(t==="{"){let r=/^\{\d+(?:,\d*)?\}/.exec(n.slice(e));if(r===null)return;i=e+r[0].length}else return;return n[i]==="?"&&(i+=1),{end:i}}function Rne(n,e){let t=e+1;if(n[t]!=="?")return t;if(t+=1,n[t]==="<"&&n[t+1]!=="="&&n[t+1]!=="!"){for(;t<n.length&&n[t]!==">";)t+=1;return t+1}return n[t]==="<"?t+2:n[t]===":"||n[t]==="="||n[t]==="!"?t+1:t}function Bne(n){if(n.length>T6)return`is ${n.length} characters long (limit ${T6})`;let e=[{hasQuantifier:!1}],t=0;for(;t<n.length;){let i=n[t];if(i==="\\"){t+=2;continue}if(i==="["){for(t+=1;t<n.length&&n[t]!=="]";)t+=n[t]==="\\"?2:1;t+=1;continue}if(i==="("){e.push({hasQuantifier:!1}),t=Rne(n,t);continue}if(i===")"){let s=e.pop(),o=e[e.length-1];if(s===void 0||o===void 0)return;t+=1;let a=M6(n,t);if(a!==void 0){if(t=a.end,s.hasQuantifier)return'nests a quantifier inside a quantified group, which backtracks catastrophically (e.g. "^(a+)+$" takes over a second on 26 characters and doubles per character after that)';o.hasQuantifier=!0}else s.hasQuantifier&&(o.hasQuantifier=!0);continue}let r=M6(n,t);if(r!==void 0){let s=e[e.length-1];s!==void 0&&(s.hasQuantifier=!0),t=r.end;continue}t+=1}}var Nne=new Set(["default","const","enum","examples"]);function kne(n){return n.replaceAll("~","~0").replaceAll("/","~1")}function zk(n,e=""){let t=[],i=(r,s)=>{if(Array.isArray(r)){r.forEach((o,a)=>{i(o,`${s}/${a}`)});return}if(!(r===null||typeof r!="object"))for(let[o,a]of Object.entries(r)){if(Nne.has(o))continue;let c=`${s}/${kne(o)}`;if(o==="pattern"&&typeof a=="string"){let l=Bne(a);l!==void 0&&t.push({pointer:c,pattern:a,reason:l});continue}i(a,c)}};return i(n,e),t}function Dne(n){let e=zk(n)[0];if(e!==void 0)throw new Error(`pattern ${JSON.stringify(e.pattern)} at "${e.pointer}" ${e.reason}`);return m.fromJSONSchema(n)}var os=m.number().finite(),ac=os.positive(),I6=os.min(0).max(1),J6=m.tuple([os,os]),c0=m.tuple([os,os,os]),Y6=m.tuple([os,os,os,os]).refine(n=>Math.abs(n.reduce((e,t)=>e+t*t,0)-1)<1e-5,"Glass rotation must be a unit quaternion."),Fne=m.strictObject({id:m.string().min(1).max(64).describe("Stable pane id, unique on its owner."),material:m.enum(["laminated","tempered","annealed"]).describe("Laminated retains cracked glass; tempered releases granules; annealed releases larger shards."),center:c0.describe("Pane center in owner coordinates, meters."),rotation:Y6.describe("Pane XY orientation in owner coordinates, unit quaternion."),size:m.tuple([ac,ac]).describe("Width and height in meters."),thickness:ac.describe("Total glass thickness, meters; interlayer thickness excluded."),density:ac.optional().describe("Glass density, kg/m\xB3; default 2500."),strength:ac.optional().describe("Effective bending failure stress, Pa. Defaults: tempered 120e6, others 45e6. Simulation tuning, not certification."),fractureEnergy:ac.optional().describe("Post-initiation fracture work, J/m\xB2; default 80."),retentionForce:ac.optional().describe("Frame/interlayer failure force, N; default 4000 times pane perimeter in meters."),retentionEnergy:ac.optional().describe("Work to lose frame/interlayer retention, J; default 3000 times area in m\xB2."),nodes:m.array(m.string().min(1)).min(1).optional().describe("Dedicated glass mesh/group names; omit for a generated rectangular pane. Never bind a whole vehicle or a shared body mesh.")}),Pne=m.strictObject({surfaces:m.array(Fne).min(1).max(64).describe("Physical glass panes and their model bindings."),crashPulseSeconds:ac.max(1).optional().describe("Duration of the vehicle crash pulse, seconds; default 0.06, independent of tick rate.")}).superRefine((n,e)=>{let t=new Set,i=new Set;n.surfaces.forEach((r,s)=>{t.has(r.id)&&e.addIssue({code:"custom",path:["surfaces",s,"id"],message:"Duplicate glass surface id."}),t.add(r.id);for(let o of r.nodes??[])i.has(o)&&e.addIssue({code:"custom",path:["surfaces",s,"nodes"],message:"A node can belong to only one glass surface."}),i.add(o)})}),One=m.strictObject({surfaces:m.record(m.string().min(1),m.strictObject({fracture:m.enum(["intact","cracked","shattered"]),retained:m.boolean(),damage:I6,retentionDamage:I6,peakStress:os.nonnegative().describe("Largest resolved bending stress in Pa."),point:J6,release:m.strictObject({time:os.nonnegative(),position:c0,rotation:Y6,velocity:c0,fragmentSpeed:os.nonnegative().optional().describe("Energy-limited cosmetic fragment dispersion speed, m/s.")}).optional().describe("Snapshot-safe initial world pose, velocity and simulation time for cosmetic debris.")})).describe("Per-pane fracture, retention and release state keyed by surface id.")}),iFe=m.strictObject({entity:m.string().min(1),surface:m.string().min(1),impulse:c0,energy:os.nonnegative().describe("Available impact energy in joules."),duration:ac.describe("Physical contact duration, seconds; do not use render frame time."),point:J6,distributed:m.boolean().optional(),velocity:c0.optional()}),al=m.string().min(1).max(128),Mk=m.string().regex(/^#[0-9a-fA-F]{6}$/),C6=m.tuple([m.number(),m.number(),m.number()]),aS=m.number().min(0).max(1),Ik=m.number().positive().max(4),Lne=m.strictObject({selected:al.describe("Selected variant id; patch only this field to change the livery."),slots:m.record(al,m.strictObject({materials:m.array(al).min(1).describe("Exact glTF material names belonging to this paint region."),node:al.optional().describe("Optional named glTF subtree restricting this region.")})).describe("Stable paint regions bound to named model materials."),anchors:m.record(al,m.strictObject({slot:al.describe("Paint region receiving the projected marking."),position:C6.describe("Projector center as fractions of the region bounds, measured from their minimum corner."),size:m.tuple([Ik,Ik,Ik]).describe("Projector width, height and depth as fractions of the longest region dimension."),rotation:C6.describe("XYZ Euler rotation in radians; local positive Z points out of the surface.")})).optional().describe("Reusable marking projectors attached to model paint regions."),variants:m.array(m.strictObject({id:al.describe("Stable identifier used by selected."),label:m.string().min(1).max(256).describe("Display name for this livery."),provenance:m.strictObject({kind:m.enum(["photo","inspired","original"]).describe("Whether the appearance is photograph verified, reference inspired or an original design."),note:m.string().min(1).describe("Attribution, verification scope and any deliberate approximations."),references:m.array(m.strictObject({title:m.string().min(1).describe("Human-readable reference title."),url:m.string().regex(/^https?:\/\/[^\s]+$/).describe("HTTP or HTTPS source URL.")})).describe("Public references supporting the appearance; required for photo and inspired designs.")}).describe("Evidence and authorship for the appearance."),paints:m.record(al,m.strictObject({color:Mk.describe("Base paint color as an sRGB hex triplet."),roughness:aS.optional().describe("Optional material roughness override."),metalness:aS.optional().describe("Optional material metalness override."),camouflage:m.strictObject({colors:m.array(Mk).min(2).max(4).describe("Two to four colors for deterministic camouflage patches."),scale:m.number().positive().max(100).describe("Pattern repetitions across the longest paint-region dimension."),seed:m.number().int().min(0).max(4294967295).describe("Unsigned deterministic pattern seed.")}).optional().describe("Optional camouflage projected in model space without changing authored UVs.")})).describe("Paint overrides keyed by stable paint-region name; omitted regions retain their authored appearance."),markings:m.array(m.strictObject({anchor:al.describe("Reusable model marking anchor."),graphic:m.strictObject({label:m.string().max(256).optional().describe("Optional descriptive label; rendered lettering belongs in the polygon artwork."),shapes:m.array(m.strictObject({color:Mk.describe("Flat polygon color as an sRGB hex triplet."),points:m.array(m.tuple([aS,aS])).min(3).max(512).describe("Polygon vertices in normalized 0\u20131 coordinates with positive Y upward.")})).min(1).max(4096).describe("Original flat artwork polygons, painted in order.")}).describe("Resolution-independent artwork rasterized for the surface projector.")})).max(32).optional().describe("Surface markings to project for this variant.")})).min(1).max(64).describe("Available livery recipes for this model.")}).superRefine((n,e)=>{let t=(r,s)=>e.addIssue({code:"custom",path:r,message:s}),i=new Set;for(let[r,s]of n.variants.entries()){i.has(s.id)&&t(["variants",r,"id"],"Duplicate livery id"),i.add(s.id);for(let o of Object.keys(s.paints))Object.hasOwn(n.slots,o)||t(["variants",r,"paints",o],"Unknown paint slot");for(let[o,a]of(s.markings??[]).entries())Object.hasOwn(n.anchors??{},a.anchor)||t(["variants",r,"markings",o,"anchor"],"Unknown marking anchor");s.provenance.kind!=="original"&&s.provenance.references.length===0&&t(["variants",r,"provenance","references"],"Photo and inspired liveries need references")}i.has(n.selected)||t(["selected"],"Unknown livery id");for(let[r,s]of Object.entries(n.anchors??{}))Object.hasOwn(n.slots,s.slot)||t(["anchors",r,"slot"],"Unknown paint slot")}),Une={add:[2,16],subtract:[2,2],multiply:[2,16],divide:[2,2],min:[2,16],max:[2,16],clamp:[3,3],abs:[1,1],sqrt:[1,1],floor:[1,1],modulo:[2,2],sin:[1,1],cos:[1,1],atan2:[2,2],less:[2,2],greater:[2,2],equal:[2,2],and:[2,16],or:[2,16],not:[1,1],if:[3,3],coalesce:[2,16]},$ne=m.strictObject({op:m.enum(["add","subtract","multiply","divide","min","max","clamp","abs","sqrt","floor","modulo","sin","cos","atan2","less","greater","equal","and","or","not","if","coalesce"]).describe("Numeric operation; comparisons/logic return 0 or 1. Angles are radians."),args:m.array(m.union([m.number().finite(),m.string().min(1)])).min(1).max(16).describe("Finite numeric literals or names of signals, in operand order.")}).superRefine((n,e)=>{let[t,i]=Une[n.op];(n.args.length<t||n.args.length>i)&&e.addIssue({code:"custom",path:["args"],message:`${n.op} requires ${t===i?t:`${t}\u2013${i}`} operands`})}),d0=m.record(m.string().min(1),$ne).superRefine((n,e)=>{if(Object.keys(n).length>256){e.addIssue({code:"custom",message:"At most 256 derived signals per model"});return}let t=new Set,i=new Set,r=s=>{if(t.has(s)){e.addIssue({code:"custom",path:[s],message:"Cyclic derived signal dependency"});return}if(!i.has(s)){t.add(s);for(let o of n[s]?.args??[])typeof o=="string"&&Object.hasOwn(n,o)&&r(o);t.delete(s),i.add(s)}};for(let s of Object.keys(n))r(s)}).describe("Up to 256 named data-only formulas, evaluated in dependency order. No cycles.");function Gk(n,e,t=!1){let i=n.sources??{},r=n.derived??{};for(let[s,o]of Object.entries(r))Object.hasOwn(i,s)&&e.addIssue({code:"custom",path:["derived",s],message:"Derived signal duplicates a component source"}),t&&o.args.forEach((a,c)=>{typeof a=="string"&&!Object.hasOwn(i,a)&&!Object.hasOwn(r,a)&&e.addIssue({code:"custom",path:["derived",s,"args",c],message:`Unknown signal: ${a}`})});t&&n.bindings.forEach((s,o)=>{!Object.hasOwn(i,s.source)&&!Object.hasOwn(r,s.source)&&e.addIssue({code:"custom",path:["bindings",o,"source"],message:"Unknown signal source"})})}var Vk=m.record(m.string().min(1),m.strictObject({component:m.string().min(1).describe("Component on this same entity."),path:m.array(m.union([m.string().min(1),m.number().int().nonnegative()])).min(1).describe("Explicit property names or array indices leading to a number or boolean.")})).describe("Named signals read from same-entity component fields."),Hk=m.array(m.strictObject({node:m.string().min(1).describe("Exact loaded GLB node name."),source:m.string().min(1).describe("Named simulation signal."),property:m.enum(["rotation","position","visible"]).describe("Local transform or visibility channel."),axis:m.enum(["x","y","z"]).optional().describe("Required for transforms; omit for visible."),scale:m.number().finite().optional().describe("Multiply the signal by this value. Supply this or keys."),offset:m.number().finite().optional().describe("Offset after scaling; default zero."),keys:m.array(m.tuple([m.number().finite(),m.number().finite()])).min(2).optional().describe("Keyframed curve of [signal, displacement] pairs, signals strictly ascending; holds the end values outside them. Supply this or scale."),ease:m.enum(["linear","smooth"]).optional().describe("Interpolation between keys: linear (default), or smooth to ease out of and into every key."),min:m.number().finite().optional().describe("Minimum displacement from authored pose."),max:m.number().finite().optional().describe("Maximum displacement from authored pose."),period:m.number().finite().positive().optional().describe("Rotation output wraps to [0, period); smoothing follows the shortest arc. Cannot combine with min/max."),responseSeconds:m.number().finite().nonnegative().optional().describe("First-order response time constant in simulation seconds; default zero. Requires a timestamp from the host."),missing:m.enum(["hold","rest","hide"]).optional().describe("Missing reading: hold last pose (default), restore authored pose, or hide a visible channel.")}).superRefine((n,e)=>{n.missing==="hide"&&n.property!=="visible"&&e.addIssue({code:"custom",path:["missing"],message:"hide requires a visible channel"}),n.property==="visible"!=(n.axis===void 0)&&e.addIssue({code:"custom",path:["axis"],message:"Transform channels require an axis; visible must omit it"}),n.period!==void 0&&(n.property!=="rotation"||n.min!==void 0||n.max!==void 0)&&e.addIssue({code:"custom",path:["period"],message:"period requires an unlimited rotation channel"}),n.property==="visible"&&n.responseSeconds!==void 0&&e.addIssue({code:"custom",path:["responseSeconds"],message:"Visibility changes immediately; smooth a transform instead"}),n.min!==void 0&&n.max!==void 0&&n.min>n.max&&e.addIssue({code:"custom",path:["max"],message:"max must be at least min"}),n.scale===void 0==(n.keys===void 0)&&e.addIssue({code:"custom",path:["scale"],message:"Supply exactly one of scale or keys"}),n.keys!==void 0&&n.offset!==void 0&&e.addIssue({code:"custom",path:["offset"],message:"offset calibrates scale; put it in the keys instead"}),n.keys===void 0&&n.ease!==void 0&&e.addIssue({code:"custom",path:["ease"],message:"ease requires keys"}),n.keys?.forEach((t,i)=>{let r=n.keys?.[i-1];r!==void 0&&t[0]<=r[0]&&e.addIssue({code:"custom",path:["keys",i,0],message:"Key signals must be strictly ascending"})})})).superRefine((n,e)=>{let t=new Set;n.forEach((i,r)=>{let s=JSON.stringify([i.node,i.property,i.axis]);t.has(s)&&e.addIssue({code:"custom",path:[r],message:"Duplicate node transform channel"}),t.add(s)})}).describe("Per-model node channels and their signal calibration."),zne=m.strictObject({sources:Vk.optional().describe("Optional component fields overriding or extending host telemetry."),bindings:Hk,derived:d0.optional()}).superRefine((n,e)=>Gk(n,e)),Gne=m.strictObject({sources:Vk,bindings:Hk,derived:d0.optional()}).superRefine((n,e)=>Gk(n,e,!0)),Pi=m.number().finite(),Iu=m.string().regex(/^#[0-9a-fA-F]{6}$/),e5=m.array(Pi).length(3),Vne=e5.describe("Nonzero direction toward the body; +X east, +Y up, -Z north. Normalized by the renderer."),R6=m.strictObject({direction:Vne,angularDiameterDeg:Pi.positive().max(90).optional().describe("Apparent diameter in degrees; default 0.53.")}),B6={palette:m.strictObject({dayZenith:Iu.optional().describe("Daytime overhead color, default #2374c5."),dayHorizon:Iu.optional().describe("Daytime horizon and ambient light color, default #b8d7eb."),twilight:Iu.optional().describe("Twilight glow and low Sun color, default #f78753."),nightZenith:Iu.optional().describe("Nighttime overhead color, default #020510."),nightHorizon:Iu.optional().describe("Nighttime horizon and ambient light color, default #121c32."),ground:Iu.optional().describe("Below-horizon dome and ground ambient color, default #18212c."),sun:Iu.optional().describe("Sun disk and high-altitude sunlight color, default #fff4dc."),moon:Iu.optional().describe("Moon surface and moonlight color, default #dae5f5.")}).optional().describe("Art-directed clear-sky colors. These control the sky dome, not distance fog or weather."),lighting:m.strictObject({sunIntensity:Pi.nonnegative().optional().describe("Peak directional sunlight, default 3."),moonIntensity:Pi.nonnegative().optional().describe("Full-moon directional light, default 0.12; scaled by phase and altitude."),dayAmbient:Pi.nonnegative().optional().describe("Daytime hemisphere intensity, default 0.6."),nightAmbient:Pi.nonnegative().optional().describe("Nighttime hemisphere intensity, default 0.025."),skyLightSaturation:Pi.min(0).max(1).optional().describe("Saturation of the light the sky casts (fill and reflections) relative to the dome colors: 1 (default) lights with the dome palette, lower values toward its luminance. A saturated zenith otherwise tints every surface in shade blue."),referenceElevation:Pi.min(1).max(90).optional().describe("Sun elevation in degrees whose sunlit-ground brightness is kept as the sun climbs higher: above it, sun and sky light scale down together so a level surface in sun receives the same light, as a camera adapts its exposure. Omit for constant light, which renders midday ground brighter than its authored color."),castShadow:m.boolean().optional().describe("Sun shadows; also requires environment.shadows. Default true.")}).optional().describe("Sky-managed lights replace environment.ambient and environment.sun when sky is enabled."),dome:m.strictObject({brightness:Pi.positive().max(4).optional().describe("Multiplier on the drawn dome color, default 1. Lighting and reflections keep the palette.")}).optional().describe("Sky dome drawing. Filmic tone mapping renders a physically bright clear sky pale; below 1 deepens it."),stars:m.strictObject({enabled:m.boolean().optional().describe("Show the star catalog, default true."),magnitudeLimit:Pi.min(-2).max(6.5).optional().describe("Faintest catalog magnitude rendered, default 6."),intensity:Pi.nonnegative().optional().describe("Star brightness multiplier, default 1; fades with daylight and moonlight."),size:Pi.positive().max(10).optional().describe("Visual angular-size multiplier, default 1.")}).optional().describe("Star catalog visibility, brightness and size."),sun:m.strictObject({visible:m.boolean().optional().describe("Show the Sun disk; lighting is independent. Default true."),size:Pi.positive().max(100).optional().describe("Visual diameter multiplier, default 1. Does not affect astronomy or lighting.")}).optional().describe("Sun disk appearance."),moon:m.strictObject({visible:m.boolean().optional().describe("Show the Moon disk; lighting is independent. Default true."),size:Pi.positive().max(100).optional().describe("Visual diameter multiplier, default 1."),earthshine:Pi.min(0).max(1).optional().describe("Dark-side visibility, default 0.025.")}).optional().describe("Moon disk appearance.")},AS=m.discriminatedUnion("mode",[m.strictObject({...B6,mode:m.literal("earth").describe("Compute positions from an Earth observer and UTC clock."),observer:m.strictObject({latitude:Pi.min(-90).max(90).describe("Geodetic degrees north."),longitude:Pi.min(-180).max(180).describe("Degrees east; west is negative."),elevation:Pi.min(-500).max(1e5).optional().describe("Meters above sea level, default 0; used for lunar parallax."),northOffsetDeg:Pi.optional().describe("Rotate geographic north clockwise toward +X, default 0 (-Z north).")}).describe("Geographic observing position and world orientation."),time:m.strictObject({epochMs:Pi.min(-22089888e5).max(4133980799999).describe("UTC Unix milliseconds at simulation second zero (1900\u20132100). Explicit: never reads the host clock."),scale:Pi.optional().describe("Sky seconds per simulation second, default 1. Zero freezes, negative rewinds.")}).describe("UTC epoch and rate relative to simulation time.")}),m.strictObject({...B6,mode:m.literal("custom").describe("Use authored body positions without an Earth clock."),sunBody:R6.describe("Authored sun position and apparent diameter."),moonBody:R6.optional().describe("Moon lit from sunBody.direction; omit for a moonless world."),starRotationDeg:e5.optional().describe("XYZ Euler rotation in degrees of the catalog sphere; default [0,0,0].")})]),t5=m.strictObject({nodes:m.array(m.string().min(1)).min(1).describe("Cabin nodes in the same exterior/interior GLB."),sources:Vk.optional().describe("Optional component fields overriding or extending host telemetry."),bindings:Hk,derived:d0.optional()}).superRefine((n,e)=>Gk(n,e)),Ns=m.number().finite(),Cu=Ns.min(0).max(1),Hne=m.array(Ns).length(3),bS=m.strictObject({atmosphere:m.strictObject({model:m.enum(["standard","isothermal"]).optional().describe("Standard layered Earth lapse rates (default), or a uniform-temperature isothermal atmosphere."),moistAir:m.boolean().optional().describe("Apply water-vapor ideal-gas density correction. Default false (dry reference air)."),temperatureK:Ns.positive().optional().describe("Temperature at referenceAltitude in kelvin; default 288.15 (15 \xB0C)."),pressurePa:Ns.nonnegative().optional().describe("Absolute barometric pressure at referenceAltitude in pascals; default 101325. Zero permits vacuum."),relativeHumidity:Cu.optional().describe("Relative humidity 0\u20131, default 0.5. Stored independently; does not select precipitation."),windVelocity:Hne.optional().describe("Air velocity [x,y,z] in world meters/second; default [0,0,0]. This is a velocity, not a meteorological FROM bearing."),referenceAltitude:Ns.optional().describe("World Y in meters where temperature and pressure apply; default 0."),gasConstant:Ns.positive().optional().describe("Specific gas constant in J/(kg\xB7K); default 287.05 for dry Earth air. Supports other atmospheres.")}).optional().describe("Physical atmospheric state; independent of the visual weather profile."),visibility:Ns.positive().optional().describe("Visual distance in meters; default 50000. Independent of clouds and precipitation. Renderer also respects a nearer authored fog limit."),clouds:m.strictObject({coverage:Cu.optional().describe("Sky coverage 0\u20131, default 0: the share of the sky the layer covers; 1 closes it."),density:Cu.optional().describe("Cloud optical density 0\u20131, default 0.65; independent of coverage."),baseAltitude:Ns.optional().describe("Cloud base at absolute world Y in meters, default 1800."),thickness:Ns.positive().optional().describe("Depth of the layer from base to top in meters, default 600."),scale:Ns.positive().optional().describe("Horizontal cloud-pattern repeat size in meters, default 16000."),type:m.enum(["cumulus","stratocumulus","stratus","cumulonimbus"]).optional().describe("Cloud type of the layer, default cumulus: separate heaps; stratocumulus a lumpy closed layer; stratus a flat sheet; cumulonimbus towering storm cells (give them a thick layer)."),cirrus:Cu.optional().describe("Coverage 0\u20131 of a thin, wispy high cirrus layer, default 0. Independent of the main layer."),cirrusAltitude:Ns.optional().describe("Cirrus layer at absolute world Y in meters, default 9000.")}).optional().describe("World-anchored, wind-advected volumetric cloud layer of one type, plus an optional high cirrus layer. Does not imply precipitation."),precipitation:m.strictObject({kind:m.enum(["none","rain","snow"]).optional().describe("Explicit precipitation phase, default none. Temperature never silently overrides it."),intensity:Cu.optional().describe("Visual precipitation intensity 0\u20131, default 0. Not a calibrated rainfall rate.")}).optional().describe("Precipitation independent of cloud coverage and visibility."),wind:m.strictObject({referenceHeight:Ns.positive().optional().describe("Height above ground in meters where atmosphere.windVelocity is measured; default 10."),shear:Ns.min(0).max(1).optional().describe("Power-law exponent of mean wind speed with height above ground, up to 600 m; default 0 (uniform). About 0.14 over open country, 0.3 over cities."),turbulence:Cu.optional().describe("Turbulence intensity 0\u20131, default 0: about 0.15 light chop, 0.4 moderate, 0.8 severe. Grows with wind speed and fades above the 1 km boundary layer."),gusts:Cu.optional().describe("Gust factor 0\u20131, default 0: along-wind speed swings as a fraction of the mean wind, advected with it."),terrain:Cu.optional().describe("Strength 0\u20131 of wind deflected by terrain slopes: ridge lift upwind, sink in the lee. Default 0.")}).optional().describe("Spatial and temporal structure of the wind around the mean atmosphere.windVelocity. Deterministic from seed and simulation time; consumes no simulation RNG."),seed:Ns.int().min(0).max(4294967295).optional().describe("Stable visual pattern seed, default 1. Does not consume simulation RNG.")});function h0(n={}){return{atmosphere:{temperatureK:288.15,model:"standard",moistAir:!1,pressurePa:101325,relativeHumidity:.5,referenceAltitude:0,gasConstant:287.05,...n.atmosphere,windVelocity:[...n.atmosphere?.windVelocity??[0,0,0]]},visibility:n.visibility??5e4,clouds:{coverage:0,density:.65,baseAltitude:1800,thickness:600,scale:16e3,type:"cumulus",cirrus:0,cirrusAltitude:9e3,...n.clouds},precipitation:{kind:"none",intensity:0,...n.precipitation},wind:{referenceHeight:10,shear:0,turbulence:0,gusts:0,terrain:0,...n.wind},seed:n.seed??1}}var dm=new Map;function jne(n={},e){let t=new Map(e?.base??dm);return{registry:t,issues:Qne(n,{registry:t,owner:e?.owner})}}function Ft(n,e,t,i){if(n.length===0)throw new Error("component name must be non-empty");if(dm.has(n)&&i?.override!==!0)throw new Error(`component "${n}" is already registered (pass { override: true } to replace)`);dm.set(n,{name:n,zod:e,meta:t})}function Qne(n,e){let t=[],i=e.registry;for(let[r,s]of Object.entries(n)){let o=i.get(r);if(o!==void 0&&!["scene","project","declared"].includes(o.meta.owner??"")){t.push({path:`${e.pointer??"/components"}/${dS(r)}`,code:"reserved_component",message:`component "${r}" is owned by ${o.meta.owner??"a registered package"} and cannot be redeclared`});continue}let a=m.looseObject({});if(s.schema!==void 0){let c=zk(s.schema,`${e.pointer??"/components"}/${dS(r)}/schema`)[0];if(c!==void 0){t.push({path:c.pointer,code:"component_schema_unsafe_pattern",message:`component "${r}" declares a pattern that ${c.reason}`,received:JSON.stringify(c.pattern),hint:"flatten the repetition (one quantifier per group), or drop the pattern",docsRef:"schemas/components.md"});continue}try{a=m.fromJSONSchema(s.schema)}catch(l){t.push({path:`${e.pointer??"/components"}/${dS(r)}/schema`,code:"component_schema_unsupported",message:`component "${r}" schema could not be compiled (${l instanceof Error?l.message:String(l)})`,hint:"use the JSON Schema subset: type object/array/number/integer/string/boolean, properties, required, additionalProperties, items, enum, const, min*/max*",docsRef:"schemas/components.md"});continue}}i.set(r,{name:r,zod:a,meta:{description:s.description,examples:s.examples,owner:e.owner??"declared"}})}return t}function N6(n=dm){return[...n.keys()].sort()}function dS(n){return n.replaceAll("~","~0").replaceAll("/","~1")}function Wne(n){if(n===void 0)return;let e=JSON.stringify(n);return e!==void 0&&e.length<=80?e:void 0}function qne(n,e,t,i){let r=i?.registry??dm,s=r.get(n);if(s===void 0){if(i?.allowUnknownComponents===!0)return[];let u=mS(n,N6(r));if(u===void 0)return[];let d=n.toLowerCase(),h=u.candidate.toLowerCase();return d===h||u.distance<=1&&d!==`${h}s`?[{path:t,code:"unknown_component",message:`unknown component "${n}"`,expected:`one of: ${N6(r).join(", ")}`,hint:`did you mean "${u.candidate}"? (or declare "${n}" under "components" if it is intentional)`,docsRef:"schemas/components.md"}]:[{path:t,code:"undeclared_component",message:`"${n}" is not a known component; accepted as a custom component`,hint:`declare "${n}" under "components" (description + examples) to document it and silence this notice \u2014 or did you mean "${u.candidate}"?`,docsRef:"schemas/components.md",severity:"notice"}]}if(i?.partial===!0)return[];let o=s.zod.safeParse(e);if(o.success)return[];let a=kk(o.error,e,s.zod),c=Wne(s.meta.examples[0]),l=!1;return a.map(u=>{let d={...u,path:t+u.path,docsRef:u.docsRef??s.meta.docsRef??"schemas/components.md"};return d.hint===void 0&&!l&&c!==void 0&&(d.hint=`e.g. "${n}": ${c}`,l=!0),d})}function Kne(n,e,t){if(n==null)return[];let i=[];for(let[r,s]of Object.entries(n))i.push(...qne(r,s,`${e}/${dS(r)}`,t));if(t?.partial!==!0&&n.collider3d!==void 0){let r=n.transform?.scale;r!==void 0&&(!Array.isArray(r)||r.length!==3||!r.every(s=>typeof s=="number"&&Number.isFinite(s)&&s>0)||r[0]!==r[1]||r[0]!==r[2])&&i.push({path:`${e}/transform/scale`,code:"unsupported_physics_scale",message:"collider3d requires positive uniform transform.scale",hint:"bake nonuniform or mirrored scale into collision geometry"})}return i}var L=m.number(),Ct=m.array(L).length(3),yS=m.array(L).length(4),Xne=m.json(),n5=n=>m.strictObject({pos:Ct.describe(`${n} position [x, y, z] in meters (Y-up).`),rot:yS.describe(`${n} orientation quaternion [x, y, z, w]; defaults to identity [0, 0, 0, 1].`).optional(),scale:Ct.describe("Per-axis scale factors [x, y, z]; defaults to [1, 1, 1].").optional(),teleport:m.boolean().describe("Client interpolation hint: when true the client snaps to this update instead of lerping from the previous tick.").optional()}),Zne=n5("World"),Jne=n5("Parent-relative"),jk=new Map([["primitive",{description:"built-in geometry named by ref",owner:"client"}],["gltf",{description:"an imported project asset",owner:"client"}]]),Yne=()=>`Render source: ${[...jk].map(([n,e])=>`'${n}' (${e.description})`).join(", ")}.`,eie={ref:m.string().min(1).describe("Primitive name (box, sphere, plane, cylinder) or, for gltf, the project asset id."),materialRef:m.string().describe("Material reference, e.g. 'palette:#rrggbb' or a project material doc id; overrides the asset's own materials.").optional(),primitive:m.strictObject({size:Ct.describe("Primitive extents [x, y, z] in meters: box = full extents; sphere = x is the diameter; cylinder = x diameter, y height; plane = x by z. Default [1, 1, 1].").optional()}).describe("Primitive geometry parameters (kind = primitive).").optional(),node:m.string().min(1).describe("gltf: named sub-node of the asset to instance (default: the whole scene).").optional(),visible:m.boolean().describe("Whether the object is drawn; default true.").optional(),shadows:m.strictObject({cast:m.boolean().describe("Whether this object casts shadows onto others.").optional(),receive:m.boolean().describe("Whether this object receives shadows from others.").optional()}).describe("Shadow participation flags.").optional(),animation:m.strictObject({clip:m.string().min(1).describe("Name of the glTF animation clip to play."),speed:L.describe("Playback rate multiplier (1 = authored speed).").optional(),loop:m.enum(["repeat","once","pingpong"]).describe("Loop mode: repeat, once (hold the last frame), or pingpong.").optional(),paused:m.boolean().describe("Freeze playback at pausedAtTick (default startTick).").optional(),pausedAtTick:m.int().nonnegative().describe("Simulation tick to hold while paused; serialize this when pausing so live and captured poses agree.").optional(),startTick:m.int().nonnegative().describe("Tick the clip started at; clip time = (tick - startTick) / tickRate * speed seconds (default 0).").optional()}).describe("gltf clip playback (client-owned); clip time derives deterministically from startTick.").optional()},tie=()=>{let n={};for(let e of jk.values())for(let[t,i]of Object.entries(e.fields??{}))n[t]=i.optional();return n},nie=()=>m.strictObject({kind:m.enum([...jk.keys()]).describe(Yne()),...eie,...tie()}),am=m.string().regex(/^#[0-9a-fA-F]{6}$/,{error:'must be "#rrggbb"'}),iie=m.strictObject({type:m.enum(["directional","point","spot"]).describe("Light type: directional (parallel rays), point (omnidirectional), or spot (cone). Directional/spot lights aim at the world origin by default."),color:am.describe("Light color as '#rrggbb'.").optional(),intensity:L.nonnegative().describe("Light intensity (three.js units; a unitless multiplier).").optional(),range:L.positive().describe("point/spot falloff distance in meters (absent = unlimited).").optional(),angleDeg:L.positive().describe("spot cone half-angle in degrees, measured from the aim direction (default 45).").optional(),penumbra:L.min(0).max(1).describe("spot soft-edge fraction 0..1 of the cone (default 0 = hard edge).").optional(),castShadow:m.boolean().describe("Whether this light casts shadows.").optional()}),rie=m.strictObject({sky:AS.optional().describe("Clear sky with sun, moon, stars and automatic lighting. Earth mode uses an explicit UTC epoch and observer; custom mode accepts authored body directions. See guide/sky.md."),ambient:m.strictObject({sky:am.describe("Sky-side (from above) ambient color '#rrggbb'.").optional(),ground:am.describe("Ground-side (from below) ambient color '#rrggbb'.").optional(),intensity:L.nonnegative().describe("Ambient intensity (unitless multiplier; default 1.1).").optional()}).describe("Hemisphere ambient light.").optional(),sun:m.strictObject({direction:Ct.describe("Vector [x, y, z] pointing FROM the world origin TOWARD the sun: the directional light is placed at this offset and shines back toward the origin, so y > 0 puts the sun above the horizon (Y-up). Default [5, 10, 7].").optional(),color:am.describe("Sun light color '#rrggbb'.").optional(),intensity:L.nonnegative().describe("Sun intensity (unitless multiplier; default 1.4).").optional(),castShadow:m.boolean().describe("Whether the sun casts shadows (also requires shadows != 'off').").optional()}).describe("Directional sun light.").optional(),background:am.describe("Background clear color '#rrggbb'.").optional(),fog:m.strictObject({color:am.describe("Fog color '#rrggbb'."),near:L.nonnegative().describe("Distance from the camera in meters at which fog starts.").optional(),far:L.positive().describe("Distance from the camera in meters at which fog is fully opaque.").optional()}).describe("Linear distance fog.").optional(),toneMapping:m.enum(["none","aces","agx","neutral"]).describe("Tone-mapping operator: none, aces, agx, or neutral (Khronos PBR Neutral: keeps authored base colors and saturation below the highlights).").optional(),exposure:L.positive().describe("Tone-mapping exposure multiplier (1 = neutral).").optional(),shadows:m.enum(["off","low","medium","high"]).describe("Shadow quality tier (shadow-map resolution); off disables all shadows.").optional()});Ft("boostMode",m.strictObject({enabled:m.boolean().describe("Enable 4\xD7 travel speed for people and vehicles.")}),{description:"World-wide 4\xD7 travel assist for people and vehicles. Control response times stay normal.",owner:"kernel",examples:[{enabled:!0}],docsRef:"guide/boost-mode.md"});Ft("weather",bS,{description:"Singleton physical atmosphere and visual weather: temperature, pressure, humidity, wind, independent cloud cover, precipitation and visibility. Readable by scripts and physics; see guide/weather.md.",examples:[{atmosphere:{temperatureK:282.15,pressurePa:100200,windVelocity:[7,0,3]},clouds:{coverage:.95},precipitation:{kind:"rain",intensity:.7},visibility:4500}]});Ft("audioSource",bne,{description:"Sound emitter on an entity: a sound-bank id, loop/autoplay, gain and pitch driven by signals (vehicleState.speed, listener.distance\u2026), and one-shot triggers. Positional when the entity has a transform. Render-side only; see guide/audio.md.",owner:"audio",docsRef:"guide/audio.md",examples:[{sound:"vehicle.engine.car",loop:!0,spatial:{refDistance:3,maxDistance:120},pitchFrom:{signal:"vehicleState.speed",curve:[[0,.8],[30,1.7]]},gainFrom:{signal:"vehicleInput.throttle",curve:[[0,.45],[1,1]]}}]});Ft("audioZone",yne,{description:"Area ambience: a looping sound that fades in as the listener enters a sphere or box around the entity (a waterfall, a machine room, a market).",owner:"audio",docsRef:"guide/audio.md",examples:[{sound:"ambience.water.stream",shape:{kind:"sphere",radius:12},fade:8}]});Ft("audioEnvironment",_ne,{description:"Singleton soundscape rules: bus gains, ambience layers gated on weather/sky/listener signals, music playlist, event \u2192 sound mappings and listener footsteps.",owner:"audio",docsRef:"guide/audio.md",examples:[{buses:{music:.5},ambience:[{sound:"ambience.rain.medium",when:{"weather.precipitation.kind":"rain"},gainFrom:{signal:"weather.precipitation.intensity",curve:[[0,0],[1,1]]}},{sound:"ambience.birds.day",when:{"sky.daylight":{min:.3}},fadeS:4}],music:{playlist:["music.ambient.dawn"],mode:"sequence"},events:{crash:{sound:"impact.metal.heavy"}},footsteps:{sound:"footstep.grass",strideM:.75}}]});var i5=m.number().int().min(0).max(4294967295),k6=i5.describe("Bitmask of collision layers this collider belongs to; a collides with b when (a.mask & b.layer) or (b.mask & a.layer) is non-zero."),D6=i5.describe("Bitmask of layers this collider collides with (see layer for the rule)."),F6=m.boolean().describe("Static colliders never move and are never pushed by other bodies.").optional(),sie=m.discriminatedUnion("shape",[m.strictObject({shape:m.literal("circle").describe("Circle collider in the XZ plane."),radius:L.positive().describe("Circle radius in meters (default 0.5).").optional(),layer:k6,mask:D6,isStatic:F6}),m.strictObject({shape:m.literal("aabb").describe("Axis-aligned box collider in the XZ plane."),halfExtents:m.array(L.positive()).length(2).describe("Half-extents [x, z] in meters of the box in the XZ plane (2.5D; default [0.5, 0.5]).").optional(),layer:k6,mask:D6,isStatic:F6})]),oie=m.strictObject({vel:Ct.describe("Velocity [x, y, z] in meters per second, integrated each tick (dt = 1/tickRate)."),slide:m.boolean().describe("When true, blocked motion slides along the contact surface instead of stopping.")}),aie=m.strictObject({speed:L.describe("Planar move speed in meters per second."),jumpSpeed:L.describe("Initial upward velocity in meters per second applied when jumping from the ground."),gravity:L.describe("Downward acceleration in meters per second squared applied to vy each tick."),vy:L.describe("Current vertical velocity in meters per second (kernel-owned)."),grounded:m.boolean().describe("True when the character stood on the ground as of the last tick (kernel-owned).")}),cie=m.strictObject({dir:m.array(L).length(2).describe("Desired planar move direction [x, z]: +x east, +z south (screen-down in top-down views); magnitudes above 1 are normalized."),jump:m.boolean().describe("Request a jump this tick (honored only while grounded).")}),lie=m.strictObject({ticksLeft:L.describe("Ticks remaining before the entity is despawned; decremented each tick.")}),uie=m.looseObject({hp:L.describe("Hit points.")}),die=m.looseObject({name:m.string().min(1).describe("Tag name used for selecting/grouping entities, e.g. 'enemy'.")});Ft("transform",Zne,{description:"World position + orientation. pos is required; rot defaults to identity.",owner:"kernel",examples:[{pos:[0,1.5,-3],rot:[0,0,0,1]}],docsRef:"schemas/components.md"});function hie(){Ft("renderable",nie(),{description:"Client render contract: a primitive, a gltf asset (by project asset id) with optional sub-node, material override, shadows, and clip playback, or a capability-registered kind.",owner:"client",examples:[{kind:"primitive",ref:"box",materialRef:"palette:#4363d8"},{kind:"gltf",ref:"crate",animation:{clip:"spin",loop:"repeat"}}],docsRef:"schemas/components.md"},{override:!0})}hie();Ft("livery",Lne,{description:"Reusable model paint slots, bound surface markings and selectable liveries. Visual only.",owner:"client",docsRef:"guide/liveries.md",examples:[{selected:"red",slots:{body:{materials:["body-paint"]}},variants:[{id:"red",label:"Red",provenance:{kind:"original",note:"Original paint.",references:[]},paints:{body:{color:"#b8463d"}}}]}]});Ft("model.signals",Gne,{description:"Bind same-entity simulation fields and named numeric expressions to GLB transforms and visibility. Supports calibration, cyclic needles and timed response. Visual only; no physics writes.",owner:"client",examples:[{sources:{speed:{component:"vehicleState",path:["speed"]}},derived:{speedKmh:{op:"multiply",args:["speed",3.6]}},bindings:[{node:"speed-pointer",source:"speedKmh",property:"rotation",axis:"z",keys:[[0,-2],[60,0],[180,2]],responseSeconds:.2}]}],docsRef:"guide/vehicle-interiors.md"});Ft("light",iie,{description:"A light source at the entity transform (directional/point/spot).",owner:"client",examples:[{type:"point",color:"#ffdca8",intensity:2,range:12}],docsRef:"schemas/components.md"});Ft("environment",rie,{description:"Singleton scene environment: optional Earth/custom sky, ambient/sun lighting, background, fog, tone mapping, shadow quality tier.",owner:"client",examples:[{ambient:{sky:"#ffffff",ground:"#444455",intensity:1.1},sun:{direction:[5,10,7],intensity:1.4,castShadow:!0},shadows:"medium"},{sky:{mode:"earth",observer:{latitude:47.6,longitude:-122.3},time:{epochMs:17189424e5,scale:60}},toneMapping:"agx"}],docsRef:"schemas/components.md"});Ft("lifetime",lie,{description:"Auto-despawn countdown in ticks.",owner:"kernel",examples:[{ticksLeft:30}],docsRef:"schemas/components.md"});Ft("collider",sie,{description:"2.5D kinematic collider (circle or XZ AABB) with layer/mask bitmasks.",owner:"kernel/kinematics",examples:[{shape:"circle",radius:.5,layer:1,mask:1}],docsRef:"schemas/components.md"});Ft("kinematicBody",oie,{description:"Velocity-driven body for the kinematic collision layer.",owner:"kernel/kinematics",examples:[{vel:[0,0,0],slide:!0}],docsRef:"schemas/components.md"});Ft("character",aie,{description:"Kinematic character controller state (speed/jump/gravity + kernel-owned vy/grounded).",owner:"kernel/character",examples:[{speed:6,jumpSpeed:8,gravity:20,vy:0,grounded:!0}],docsRef:"schemas/components.md"});Ft("moveIntent",cie,{description:"Desired planar move direction + jump flag, consumed by the character controller.",owner:"kernel/character",examples:[{dir:[1,0],jump:!1}],docsRef:"schemas/components.md"});var fie=m.discriminatedUnion("type",[m.strictObject({type:m.literal("ball").describe("Sphere."),radius:L.positive().describe("Sphere radius in meters.")}),m.strictObject({type:m.literal("cuboid").describe("Axis-aligned box (in the collider frame)."),hx:L.positive().describe("Half-extent along X in meters."),hy:L.positive().describe("Half-extent along Y in meters."),hz:L.positive().describe("Half-extent along Z in meters.")}),m.strictObject({type:m.literal("capsule").describe("Capsule aligned with the Y axis."),halfHeight:L.nonnegative().describe("Half the length of the cylindrical section along Y in meters (caps excluded)."),radius:L.positive().describe("Capsule radius in meters.")}),m.strictObject({type:m.literal("convexHull").describe("Convex hull of a point cloud."),points:m.array(L).min(12).describe("Flat [x, y, z, x, y, z, ...] point list in meters (at least 4 points); the shape is their convex hull.")}),m.strictObject({type:m.literal("trimesh").describe("Triangle mesh (static geometry)."),vertices:m.array(L).min(9).describe("Flat [x, y, z, ...] vertex positions in meters."),indices:m.array(m.int().nonnegative()).min(3).describe("Triangle vertex indices, three per triangle.")}),m.strictObject({type:m.literal("asset").describe("Collision geometry from a project asset's sidecar."),assetId:m.string().min(1).describe("Project asset id whose sidecar collision geometry is used."),collision:m.enum(["hull","trimesh"]).describe("Which sidecar geometry to use: hull (convex, default) or trimesh.").optional(),index:m.int().nonnegative().describe("Index of the sidecar hull to use when the asset has several (default 0).").optional()}),m.strictObject({type:m.literal("heightfield").describe("Terrain heightfield."),ref:m.string().min(1).describe("Heightfield reference id resolved by the host (e.g. the scene terrain).")})]),pie=m.strictObject({shape:fie.describe("Collision shape."),offset:Ct.describe("Shape offset [x, y, z] in meters relative to the entity transform.").optional(),rotOffset:yS.describe("Shape rotation quaternion [x, y, z, w] relative to the entity transform.").optional(),layer:m.int().min(0).max(65535).describe("16-bit collision-group bitmask this collider belongs to (default 1).").optional(),mask:m.int().min(0).max(65535).describe("16-bit bitmask of groups this collider collides with (default 0xffff = all).").optional(),sensor:m.boolean().describe("Sensor colliders detect overlaps (collision events) but produce no contact forces.").optional(),events:m.boolean().describe("Emit 'collision' / 'collisionEnd' world events for this collider.").optional(),restitution:L.min(0).describe("Bounciness coefficient (0 = inelastic).").optional(),friction:L.min(0).describe("Coulomb friction coefficient.").optional(),density:L.positive().describe("Mass density in kg/m^3 used to derive the body mass from the shape volume.").optional()}),mie=m.strictObject({body:m.enum(["dynamic","fixed","kinematicPosition"]).describe("Body type: dynamic (simulated), fixed (immovable), or kinematicPosition (driven by transform writes, e.g. characters)."),gravityScale:L.describe("Multiplier on scene gravity for this body (1 = normal, 0 = weightless).").optional(),linearDamping:L.min(0).describe("Linear velocity damping coefficient per second (0 = none).").optional(),angularDamping:L.min(0).describe("Angular velocity damping coefficient per second (0 = none).").optional(),ccd:m.boolean().describe("Enable continuous collision detection for fast-moving bodies.").optional(),lockRot:m.boolean().describe("Lock all rotations so the body never tumbles.").optional()}),gie=m.strictObject({type:m.enum(["fixed","revolute","spherical","prismatic"]).describe("Joint type: fixed, revolute (hinge), spherical (ball), or prismatic (slider)."),other:m.string().min(1).describe("Entity id of the other body."),anchor1:Ct.describe("Anchor point [x, y, z] in meters in this body's local frame."),anchor2:Ct.describe("Anchor point [x, y, z] in meters in the other body's local frame."),axis:Ct.describe("Joint axis [x, y, z] in this body's local frame (revolute/prismatic).").optional(),limits:m.array(L).length(2).describe("[min, max] joint limits: radians for revolute, meters for prismatic.").optional(),motor:m.strictObject({targetVel:L.describe("Target joint velocity: rad/s for revolute, m/s for prismatic."),maxForce:L.positive().describe("Maximum force (N) or torque (N*m) the motor may apply.")}).describe("Velocity motor driving the joint (revolute/prismatic).").optional()}),Aie=m.strictObject({linear:Ct.describe("Force [x, y, z] in newtons applied at the center of mass every tick while present.").optional(),torque:Ct.describe("Torque [x, y, z] in N*m applied every tick while present.").optional()}),bie=m.strictObject({v:Ct.describe("Linear impulse [x, y, z] in N*s (kg*m/s) applied once.").optional(),torque:Ct.describe("Angular impulse [x, y, z] in N*m*s applied once.").optional()}),yie=m.strictObject({linear:Ct.describe("Linear velocity [x, y, z] in m/s to set once.").optional(),angular:Ct.describe("Angular velocity [x, y, z] in rad/s to set once.").optional()}),vie=m.strictObject({linear:Ct.describe("Current linear velocity [x, y, z] in m/s (plugin-written each tick)."),angular:Ct.describe("Current angular velocity [x, y, z] in rad/s (plugin-written each tick).")});Ft("collider3d",pie,{description:"3D collider (ball/cuboid/capsule/hull/trimesh/asset/heightfield) with layer/mask, sensor, and material params. Static without a rigidbody.",owner:"physics-rapier",examples:[{shape:{type:"cuboid",hx:10,hy:.5,hz:10}}],docsRef:"schemas/components.md"});Ft("rigidbody",mie,{description:"3D rigid-body dynamics: dynamic, fixed, or kinematicPosition (characters).",owner:"physics-rapier",examples:[{body:"dynamic"}],docsRef:"schemas/components.md"});Ft("joint",gie,{description:"Impulse joint to another body (fixed/revolute/spherical/prismatic + limits/motor).",owner:"physics-rapier",examples:[{type:"revolute",other:"chassis",anchor1:[0,0,1],anchor2:[0,0,0],axis:[0,0,1]}],docsRef:"schemas/components.md"});Ft("force",Aie,{description:"Continuous force/torque applied every tick while present.",owner:"physics-rapier",examples:[{linear:[0,20,0]}],docsRef:"schemas/components.md"});Ft("impulse",bie,{description:"One-shot impulse/torque; consumed the tick it is applied.",owner:"physics-rapier",examples:[{v:[10,0,0]}],docsRef:"schemas/components.md"});Ft("setVelocity",yie,{description:"One-shot velocity set; consumed the tick it is applied.",owner:"physics-rapier",examples:[{linear:[0,0,5]}],docsRef:"schemas/components.md"});Ft("velocity",vie,{description:"Opt-in per-tick body velocity mirror (presence = subscription; plugin-written).",owner:"physics-rapier",examples:[{linear:[0,0,0],angular:[0,0,0]}],docsRef:"schemas/components.md"});var xie=m.strictObject({id:m.string().min(1).describe("Entity id of the parent."),onParentDestroyed:m.enum(["destroy","detach"]).describe("When the parent is destroyed: destroy this entity too (default, cascading) or detach it and keep it alive.").optional()}),_ie=m.strictObject({timers:m.array(m.strictObject({id:m.string().min(1).describe("Timer id, unique within this entity."),ticksLeft:m.int().positive().describe("Ticks until the timer fires; decremented each tick."),event:m.string().min(1).describe("World event type emitted when the timer fires (payload carries entity + timerId)."),payload:Xne.describe("Optional JSON payload included in the emitted event.").optional(),repeatEvery:m.int().positive().describe("If set, the timer re-arms with this many ticks after firing (repeating).").optional()})).describe("Active timers on this entity.")}),wie=m.strictObject({tweens:m.array(m.strictObject({id:m.string().min(1).describe("Optional tween id.").optional(),component:m.string().min(1).describe("Name of the component whose value is animated."),path:m.string().min(1).describe("Select-style value path within the component, e.g. 'pos', 'pos[1]', or 'primitive.size'."),from:m.union([L,m.array(L)]).describe("Start value (number or number array); defaults to the current value when the tween starts.").optional(),to:m.union([L,m.array(L)]).describe("End value (number or number array, same arity as from)."),ticks:m.int().positive().describe("Duration in ticks."),elapsed:m.int().nonnegative().describe("Ticks elapsed so far (kernel-owned; starts at 0).").optional(),easing:m.enum(["linear","quadIn","quadOut","quadInOut","cubicIn","cubicOut","cubicInOut"]).describe("Easing curve (default linear).").optional(),loop:m.enum(["none","loop","pingpong"]).describe("After completing: none (remove, default), loop (restart from `from`), or pingpong (swap from/to).").optional(),emitOnComplete:m.string().describe("World event type emitted (payload { entity }) each time the tween completes.").optional()})).describe("Active tweens on this entity.")}),Sie=m.strictObject({state:m.string().min(1).describe("Current state name."),transitions:m.array(m.strictObject({from:m.string().min(1).describe("State the transition leaves ('*' matches any state)."),event:m.string().min(1).describe("World event type that triggers the transition (events with payload.entity only match that entity)."),to:m.string().min(1).describe("State entered.")})).describe("Transition table, checked in order; the first match wins.")});Ft("parent",xie,{description:"Attach to a parent entity: transform becomes parent.transform \xD7 localTransform each tick.",owner:"kernel/gameplay",examples:[{id:"turret-base"}],docsRef:"schemas/components.md"});Ft("localTransform",Jne,{description:"Parent-relative transform for entities carrying `parent`.",owner:"kernel/gameplay",examples:[{pos:[0,1,0],rot:[0,0,0,1]}],docsRef:"schemas/components.md"});Ft("timer",_ie,{description:"Snapshot-safe countdown timers that emit events (one-shot or repeating). Replaces callbacks.",owner:"kernel/gameplay",examples:[{timers:[{id:"respawn",ticksLeft:90,event:"respawn_ready"}]}],docsRef:"schemas/components.md"});Ft("tween",wie,{description:"Data-driven value animation over ticks: component + select-style path, lerp with easing.",owner:"kernel/gameplay",examples:[{tweens:[{component:"transform",path:"pos[1]",to:4,ticks:30,easing:"quadOut"}]}],docsRef:"schemas/components.md"});Ft("fsm",Sie,{description:"Minimal event-driven state machine: transitions fire on world events targeting the entity.",owner:"kernel/gameplay",examples:[{state:"idle",transitions:[{from:"idle",event:"player_seen",to:"aggro"}]}],docsRef:"schemas/components.md"});Ft("health",uie,{description:"Common gameplay hit-points component.",owner:"content",examples:[{hp:100}],docsRef:"schemas/components.md"});Ft("tag",die,{description:'Named tag for selecting/grouping entities (e.g. tag.name === "enemy").',owner:"content",examples:[{name:"enemy"}],docsRef:"schemas/components.md"});var r5=m.array(L.positive()).length(2),Eie=m.array(L).length(2);Ft("platformSolid",m.strictObject({halfExtents:r5.describe("Static XY box half-width/half-height in world meters. Rotation and visual scale do not affect collision."),oneWay:m.boolean().describe("Only stop descending bodies crossing the top; default false.").optional()}),{owner:"kernel",description:"Static XY solid for physics.engine=platformer; Z is ignored.",examples:[{halfExtents:[3,.5]}]});Ft("platformBody",m.strictObject({halfExtents:r5.describe("Moving XY box half-width/half-height, world meters. Z remains unchanged."),vel:Eie.optional().describe("XY velocity in meters/second; default [0,0]."),speed:L.positive().optional().describe("Maximum horizontal speed; default 7 m/s."),acceleration:L.positive().optional().describe("Horizontal acceleration/braking; default 45 m/s squared."),gravity:L.positive().optional().describe("Downward acceleration; default 28 m/s squared."),jumpSpeed:L.positive().optional().describe("Jump velocity; default 11 m/s."),grounded:m.boolean().optional().describe("Output: landed in the last physics tick."),coyoteTicks:m.int().nonnegative().optional().describe("Jump grace after leaving a ledge; default 3 ticks."),bufferTicks:m.int().nonnegative().optional().describe("Jump input buffer before landing; default 4 ticks."),grace:m.int().nonnegative().optional().describe("Runtime remaining coyote ticks; checkpointed."),buffered:m.int().nonnegative().optional().describe("Runtime remaining buffered jump ticks; checkpointed.")}),{owner:"kernel",description:"Deterministic XY platform controller: gravity, swept wall/floor/ceiling collision, jump buffering and coyote time.",examples:[{halfExtents:[.4,.6],speed:7,jumpSpeed:11}]});Ft("platformIntent",m.strictObject({move:L.min(-1).max(1).describe("Horizontal intent -1..1."),jump:m.boolean().optional().describe("One-shot jump request, consumed by the controller. Send on press, not every tick."),jumpHeld:m.boolean().optional().describe("Hold for full height; false cuts upward velocity for a short hop. Default true.")}),{owner:"kernel",description:"Input to a platformBody. Scripts translate declared commands to this component.",examples:[{move:1,jump:!0,jumpHeld:!0}]});function cl(n){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.description?t:t.describe(`External ${e} setting.`)]))}var Tie=m.enum(["city","hatchback","sedan","fastback","coupe","roadster","wagon","crossover","suv","offroad","pickup","van","cargo-van","box-truck","motorhome","bus","light-rail","bicycle","motorcycle","scooter"]).describe("Generic body style, independent of any make or model name."),s5=m.string().min(1).describe("Name-free display label such as 'Full-size pickup', for hosts that must not show a manufacturer, model or type name.");Ft("glass",Pne,{description:"Breakable glass surfaces with metric geometry, material fracture and independent frame/interlayer retention.",owner:"kernel/glass",docsRef:"guide/glass.md",examples:[{surfaces:[{id:"windshield",material:"laminated",center:[0,1.2,.8],rotation:[0,0,0,1],size:[1.4,.7],thickness:.005}]}]});Ft("glassState",One,{description:"Persistent glass fracture, retention and release state. Missing panes are intact; remove the component to repair.",owner:"kernel/glass",docsRef:"guide/glass.md",examples:[{surfaces:{}}]});var Mie=m.strictObject(cl({collisionParts:m.array(m.strictObject({id:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/).describe("Unique part id used by damage and debris state."),role:m.enum(["frontWheel","rearWheel","panel","engine"]).describe("Wheel axle, exterior panel or drivetrain role."),hinge:m.strictObject({pivot:Ct.describe("Hinge pivot in model coordinates, meters."),axis:Ct.refine(n=>Math.abs(Math.hypot(...n)-1)<1e-5,"Expected a unit axis.").describe("Unit hinge axis in model coordinates."),angle:L.describe("Hinge rotation in radians at full actuator travel."),actuator:m.string().min(1).describe("Vehicle actuator id supplying hinge travel.")}).optional().describe("Panel hinge driven by the named vehicle actuator."),center:Ct.describe("Debris origin in model coordinates, meters."),probes:m.array(Ct).min(1).max(64).describe("Sphere centers in model coordinates, meters."),radius:L.positive().describe("Probe and debris collision radius, meters."),massFraction:L.positive().max(1).describe("Share of the original mass removed on separation."),breakSpeed:L.positive().describe("Normal impact speed that breaks an intact joint, m/s."),nodes:m.array(m.string().min(1)).min(1).describe("Exact GLB node names owned by this part.")})).max(64).superRefine((n,e)=>{new Set(n.map(i=>i.id)).size!==n.length&&e.addIssue({code:"custom",message:"Collision part ids must be unique."});let t=n.flatMap(i=>i.nodes);new Set(t).size!==t.length&&e.addIssue({code:"custom",message:"Each node must belong to one collision part."}),n.reduce((i,r)=>i+r.massFraction,0)>=.8&&e.addIssue({code:"custom",message:"Detachable parts must leave at least 20% of the chassis mass."})}).optional().describe("Independent wheels, panels and engines: model-space sphere probes, joint strength in m/s and GLB node ownership."),actuators:j6.optional(),label:m.string().min(1),bodyStyle:Tie.optional(),genericLabel:s5.optional(),width:L.positive(),length:L.positive(),height:L.positive(),centerOfMass:Ct,wheelbase:L.positive(),wheelTrack:L.nonnegative().describe("Lateral wheel spacing in meters; zero for cycles."),wheelRadius:L.positive(),mass:L.positive(),engineForce:L.positive(),maxSpeed:L.positive(),reverseSpeed:L.nonnegative().describe("Maximum reverse speed; zero disables powered reverse."),brakeDeceleration:L.positive(),maxSteer:L.nonnegative(),grip:L.positive().describe("Peak tire friction on dry pavement as an acceleration in m/s\xB2; grip / 9.81 is the friction coefficient. Rain and snow lower it."),driverEye:Ct,steeringRate:L.positive(),steeringFadeSpeed:L.positive(),rollingResistance:L.nonnegative(),aerodynamicResistance:L.nonnegative(),terrainAlignRate:L.positive(),supportTolerance:L.nonnegative(),maxStepHeight:L.nonnegative(),maxSlope:L.positive(),drive:m.enum(["front","rear","all"]).optional().describe("Driven wheels. Default front."),corneringStiffness:L.positive().optional().describe("Tire side force per unit load per radian of slip angle before it saturates at the grip limit. Default 18."),brakeBias:L.min(0).max(1).optional().describe("Share of braking force on the front wheels. Default 0.65."),yawInertia:L.positive().optional().describe("Yaw moment of inertia in kg m\xB2. Default mass * (length\xB2 + width\xB2) / 12."),rollStiffness:L.nonnegative().optional().describe("Body roll in radians per g of cornering. Default 0.05."),pitchStiffness:L.nonnegative().optional().describe("Body pitch in radians per g of braking or acceleration. Default 0.03. Weight shifts between the axles through this pitch; 0 keeps the axle loads fixed."),suspensionFrequency:L.positive().optional().describe("Suspension natural frequency in Hz for body roll and pitch. Default 1.5."),suspensionDamping:L.positive().optional().describe("Suspension damping ratio. Default 0.5."),cycle:m.strictObject({maxLean:L.positive().max(1.2).describe("Maximum balanced inward lean in radians."),riderLean:L.min(0).max(1).describe("Forward torso lean in radians."),handlebarPivot:Ct.describe("Steering pivot in model-local meters."),grips:m.tuple([Ct,Ct]).describe("Left and right hand targets in model-local meters."),footrests:m.tuple([Ct,Ct]).describe("Left and right ankle targets in model-local meters."),pedals:m.strictObject({center:Ct.describe("Crank centre in model-local meters."),radius:L.positive().describe("Crank arm length in meters."),halfWidth:L.positive().describe("Distance from centreline to each pedal in meters."),ratio:L.positive().describe("Wheel revolutions per crank revolution.")}).optional().describe("Bicycle crank geometry and gearing; omitted on motor vehicles.")}).optional().describe("Self-balancing cycle handling and rider contact points. Driver seat anchors the pelvis.")})).superRefine((n,e)=>{n.cycle===void 0&&n.wheelTrack===0&&e.addIssue({code:"custom",path:["wheelTrack"],message:"Vehicles without cycle tuning need a positive wheel track."})}),o5=zne.describe("Exterior moving parts (gear legs and doors, flaps, control surfaces, doors) posed from the interior signals; bindings may use keyframed curves.");function a5(n,e,t){let i=new Set((n.interior?.bindings??[]).map(r=>JSON.stringify([r.node,r.property,r.axis])));n.animation?.bindings.forEach((r,s)=>{i.has(JSON.stringify([r.node,r.property,r.axis]))&&e.addIssue({code:"custom",path:[...t,"animation","bindings",s],message:"Node transform channel is already bound by interior"})})}var c5=m.strictObject(cl({wheelNodes:m.array(m.string().min(1)).min(1),frontWheelNodes:m.array(m.string().min(1)).min(1),steeringWheelNode:m.string().min(1).optional(),paintMaterial:m.string().min(1),interior:t5.optional(),animation:o5.optional()})).superRefine((n,e)=>a5(n,e,[]));Ft("water",Sne,{description:"Deterministic swells and current for boats; heights and coverage come from the host water field.",owner:"kernel/boats",docsRef:"guide/boats.md",examples:[{waves:[],current:[0,0]}]});Ft("boat",m.strictObject({kind:m.string().min(1).describe("Stable external vessel entity/type id."),spec:Ene.describe("Complete hull dimensions and handling configuration."),visual:c5.safeExtend({wheelNodes:m.array(m.string().min(1)).describe("Wheel nodes; empty for ordinary hulls."),frontWheelNodes:m.array(m.string().min(1)).describe("Steering wheel nodes; usually empty.")}).describe("Named GLB nodes, material and animation bindings."),color:m.string().optional().describe("Optional hull paint override.")}),{description:"Waterline-aligned powered hull with data-driven handling and shared seats.",owner:"kernel/boats",docsRef:"guide/boats.md",examples:[{kind:"demo.boat",spec:{label:"Launch",length:6,width:2.4,height:2,draft:.5,mass:1200,thrust:3600,maxSpeed:14,reverseSpeed:3,turnRate:.5,turnResponse:1,lateralDrag:2,buoyancyFrequency:1,driverEye:[.5,1.2,0]},visual:{wheelNodes:[],frontWheelNodes:[],paintMaterial:"hull"}}]});Ft("boatInput",Tne,{description:"Helm intent: signed thrust, steering and low-speed anchor. Only the driver controls it.",owner:"kernel/boats",docsRef:"guide/boats.md",examples:[{throttle:0,steering:0,anchor:!0}]});Ft("boatState",Mne,{description:"Snapshot-safe hull motion, buoyancy and anchoring; owned by installBoats.",owner:"kernel/boats",docsRef:"guide/boats.md",examples:[{speed:0,lateralSpeed:0,velocity:[0,0],yaw:0,yawRate:0,steer:0,pitch:0,roll:0,vy:0,anchored:!0,grounded:!1,waitingForWater:!1}]});Ft("vehicle",m.strictObject({kind:m.string().min(1).describe("Stable external entity/type id."),color:m.string().regex(/^#[0-9a-fA-F]{6}$/).describe("Body paint as an sRGB #rrggbb color."),spec:Mie.describe("Complete data-driven chassis and handling configuration."),visual:c5.describe("Named GLB nodes/material used by the generic client.")}),{description:"External wheeled-vehicle instance: stable id, paint, complete physics tuning, and GLB bindings.",owner:"kernel/vehicles",examples:[{kind:"example.vehicle",color:"#566d82",spec:{label:"Example car",width:1.8,length:4.6,height:1.5,centerOfMass:[0,.55,0],wheelbase:2.75,wheelTrack:1.5,wheelRadius:.31,mass:1450,engineForce:6200,maxSpeed:42,reverseSpeed:8,brakeDeceleration:9.5,maxSteer:.56,grip:8,driverEye:[.4,1.14,.25],steeringRate:1.8,steeringFadeSpeed:18,rollingResistance:.15,aerodynamicResistance:.0025,terrainAlignRate:1.8,supportTolerance:.08,maxStepHeight:.4,maxSlope:.61},visual:{wheelNodes:["wheel-front-left"],frontWheelNodes:["wheel-front-left"],steeringWheelNode:"steering-wheel",paintMaterial:"vehicle-paint-and-trim"}}],docsRef:"guide/vehicles.md"});Ft("vehicleInput",m.strictObject({actuators:Q6.optional().describe("Mechanism targets from zero to one, or on/off selections."),throttle:L.min(-1).max(1).describe("Signed accelerator; opposite input brakes to zero before reversing."),steering:L.min(-1).max(1).describe("Steering intent -1..1; positive turns right."),brake:m.boolean().describe("Apply the service brakes (all wheels, anti-lock) while true; holds the car at rest."),handbrake:m.boolean().optional().describe("Lock the rear wheels while true: they slide instead of rolling, for handbrake turns.")}),{description:"Driver intent: signed throttle (negative brakes then reverses), signed steering (positive right), service brake and optional handbrake.",owner:"kernel/vehicles",examples:[{throttle:1,steering:0,brake:!1}],docsRef:"guide/vehicles.md"});Ft("vehicleState",m.strictObject({damage:m.record(m.string(),m.strictObject({integrity:L.min(0).max(1),detached:m.boolean()})).optional().describe("Persistent joint integrity and separation, keyed by collision part id."),debris:m.array(m.strictObject({part:m.string().min(1).describe("Collision part id of the separated geometry."),pos:Ct.describe("Debris origin in world coordinates, meters."),rot:yS.describe("Debris orientation as a quaternion."),velocity:Ct.describe("World-space linear velocity, m/s."),angularVelocity:Ct.describe("Local angular velocity about X, Y and Z, radians/s."),age:L.nonnegative().describe("Elapsed simulation seconds since separation.")})).max(64).optional().describe("Detached parts in world coordinates; expire after 20 simulated seconds without repairing the vehicle."),actuators:W6.optional().describe("Current mechanism positions and cycle phases, from zero to one."),boosted:m.boolean().optional().describe("Speeds include the 4\xD7 travel boost; kernel-owned."),speed:L.describe("Signed forward speed in meters per second."),steer:L.describe("Current front wheel steering angle in radians. Positive turns right."),yaw:L.describe("Chassis rotation about Y in radians; zero faces +Z."),pitch:L.describe("Chassis rotation about local X in radians from terrain support, nose down positive."),roll:L.describe("Chassis rotation about local Z in radians from terrain support, right side down positive."),vy:L.describe("Vertical velocity in meters per second."),grounded:m.boolean().describe("Whether wheel support currently carries the chassis."),waitingForTerrain:m.boolean().describe("Motion is paused because one or more wheel samples have no terrain."),wheelAngle:L.describe("Accumulated wheel spin angle in radians, wrapped each revolution."),pedalAngle:L.optional().describe("Cycle crank angle in radians; advances under forward power and holds while coasting or braking."),lateralSpeed:L.optional().describe("Sideways speed in meters per second, positive to the left: the slide."),yawRate:L.optional().describe("Yaw rate in radians per second, positive turning left."),bodyPitch:L.optional().describe("Suspension pitch in radians on top of the terrain, nose down positive."),bodyPitchRate:L.optional().describe("Suspension pitch rate in radians per second."),bodyRoll:L.optional().describe("Suspension roll in radians on top of the terrain, right side down positive."),bodyRollRate:L.optional().describe("Suspension roll rate in radians per second."),skid:L.min(0).max(1).optional().describe("0\u20131: how far the tires are past their grip (sliding, wheelspin, locked wheels).")}),{description:"Snapshot-safe chassis state. Speeds in m/s, angles in radians; owned by installVehicles.",owner:"kernel/vehicles",examples:[{speed:0,steer:0,yaw:0,pitch:0,roll:0,vy:0,grounded:!0,waitingForTerrain:!1,wheelAngle:0}],docsRef:"guide/vehicles.md"});Ft("mountable",m.strictObject({seats:m.array(m.strictObject({id:m.string().min(1).describe("Unique seat identifier within this mount."),role:m.enum(["driver","passenger"]).describe("Only a driver seat grants vehicle control."),position:Ct.describe("Local rider/camera anchor in meters, transformed by the chassis quaternion.")})).min(1).describe("Available seat definitions. Each seat can hold one actor."),entries:m.array(Ct).min(1).optional().describe("Optional boarding points in local meters, e.g. a boat gangway; seat anchors remain valid entry points."),exits:m.array(Ct).min(1).describe("Ordered local foot positions to check when dismounting."),reach:L.positive().describe("Maximum distance in meters from the actor to the seat to enter.")}),{description:"Mount points in local meters, ordered safe exit candidates, and interaction reach. Seat position is the rider camera anchor.",owner:"kernel/vehicles",examples:[{seats:[{id:"driver",role:"driver",position:[.4,1.14,.25]}],exits:[[-1.56,0,.25],[1.56,0,.25]],reach:3}],docsRef:"guide/vehicles.md"});Ft("mounted",m.strictObject({vehicle:m.string().min(1).describe("Entity ID of the mount."),seat:m.string().min(1).describe("Occupied seat ID in the mountable component.")}),{description:"Rider-to-mount relationship. Occupied seats are exclusive; mounted characters bypass walking physics.",owner:"kernel/vehicles",examples:[{vehicle:"car-1",seat:"driver"}],docsRef:"guide/vehicles.md"});var cS=m.strictObject(cl({node:m.string().min(1),axis:m.enum(["x","y","z"]),multiplier:L})),Iie=m.strictObject(cl({wingPosition:Ct,wingArea:L.positive(),controlAuthoritySpeed:L.positive().describe("Reference equivalent airspeed in m/s for the control, stability and damping rates."),maxControlAuthority:L.positive().describe("Cap on aileron, elevator and rudder power relative to the reference speed."),pitchAuthority:L.positive().describe("Angle of attack in radians that full elevator adds to the trim angle."),pitchResponse:L.positive().describe("Elevator travel per second, in full deflections."),stallPitchRate:L.nonnegative().describe("Nose-down pitch rate in rad/s at full flow separation (the stall break)."),rollAuthority:L.positive().describe("Roll rate in rad/s at full aileron and reference speed; grows with speed up to maxControlAuthority."),rollResponse:L.positive().describe("Roll damping in 1/s at reference speed; grows with airspeed."),rudderAuthority:L.positive().describe("Yaw acceleration in rad/s\xB2 at full rudder and reference speed; propwash keeps some at low speed."),groundSteerSpeed:L.positive().describe("Ground speed in m/s at which tailwheel steering reaches full turn rate."),groundLevelRate:L.positive(),maxGroundPitch:L.positive(),camberAngle:L,flapLift:L.nonnegative(),postStallFlapEffect:L.nonnegative(),stallAngle:L.positive(),criticalMach:L.positive().optional().describe("Mach at which compressibility wave drag begins; omitted disables wave drag."),waveDrag:L.nonnegative().optional().describe("Wave drag coefficient at criticalMach + 0.25; default 0."),maxEquivalentAirspeed:L.positive().optional().describe("Airframe operating limit in m/s equivalent airspeed; alert only."),maxMach:L.positive().optional().describe("Airframe Mach operating limit; alert only."),gearLimitSpeed:L.positive().optional().describe("Maximum equivalent airspeed with gear extended, m/s; alert only."),flapLimitSpeed:L.positive().optional().describe("Maximum equivalent airspeed with flaps extended, m/s; alert only."),groundEffect:m.boolean().optional().describe("Reduce wing induced drag near the ground; default false."),departure:m.strictObject({onsetAngle:L.min(0).max(Math.PI/2).describe("High-alpha departure onset, radians."),fullAngle:L.positive().max(Math.PI/2).describe("Fully developed departure incidence, radians; greater than onsetAngle."),yawInstability:L.nonnegative().describe("Separated-flow yaw growth rate, per second."),yawSaturationRate:L.positive().describe("Autorotation saturation scale, radians per second."),rudderBlanking:L.min(0).max(1).describe("Fraction of rudder authority lost at full departure."),pitchBlanking:L.min(0).max(1).describe("Fraction of pitch stability and control lost at full departure."),aileronReversal:L.min(0).max(1).describe("Aileron reversal: 0 unchanged, 0.5 ineffective, 1 reversed.")}).refine(n=>n.fullAngle>n.onsetAngle,"Full departure angle must exceed onset.").optional(),stallTransitionAngle:L.positive().optional().describe("Radians beyond stallAngle over which flow separates smoothly. Default 0.12."),pitchFrequency:L.positive().optional().describe("Short-period natural frequency in rad/s at reference speed. Default 3.5."),pitchDamping:L.positive().optional().describe("Short-period damping ratio. Default 0.7."),maxLoadFactor:L.positive().optional().describe("Load factor in g that full back stick pulls at high speed. Default 6."),minLoadFactor:L.negative().optional().describe("Load factor in g that full forward stick pushes at high speed. Default -3."),autoTrim:L.nonnegative().optional().describe("Rate in 1/s at which trim follows the angle of attack that holds the flight path; 0 leaves trim fixed. Default 1."),directionalStability:L.nonnegative().optional().describe("Weathercock stiffness: yaw acceleration in rad/s\xB2 per radian of sideslip at reference speed. Default 4."),yawDamping:L.nonnegative().optional().describe("Yaw damping in 1/s at reference speed. Default 1.2."),dihedralEffect:L.optional().describe("Roll acceleration in rad/s\xB2 per radian of sideslip at reference speed, away from the slip. Default 3."),rollInertia:L.positive().optional().describe("Roll inertia in kg m\xB2. Default mass * (0.14 * span)\xB2."),pitchInertia:L.positive().optional().describe("Pitch inertia in kg m\xB2. Default mass * (0.18 * length)\xB2."),yawInertia:L.positive().optional().describe("Yaw inertia in kg m\xB2. Default mass * (span\xB2 + length\xB2) / 12."),propellerEffects:L.min(0).max(1).optional().describe("Scale of propeller torque, P-factor and slipstream yaw, and gyroscopic precession; 0 disables them. Default 0."),stallSpeed:L.positive().describe("Legacy tuning reference in m/s; aerodynamic stall detection uses angle of attack."),liftSlope:L.positive(),postStallLift:L.nonnegative(),postStallDecay:L.nonnegative(),profileDrag:L.nonnegative(),inducedDrag:L.nonnegative(),gearDrag:L.nonnegative().describe("Drag coefficient of the landing gear fully down; scales with the gear position."),speedBrakeDrag:L.nonnegative().optional().describe("Additional drag coefficient at full speedBrake actuator extension."),flapDrag:L.nonnegative().describe("Drag coefficient of the flaps fully down; scales with the flap position."),fixedGear:m.boolean().optional().describe("Fixed undercarriage stays down regardless of the gear selection."),gearTransitTime:L.nonnegative().optional().describe("Seconds for a full landing-gear cycle, doors included, either way. The gear holds still with weight on the wheels, and only a locked-down gear can land. Default 0 (instant)."),flapTransitTime:L.nonnegative().optional().describe("Seconds for the flaps to travel fully up to fully down. Default 0 (instant)."),stallDrag:L.nonnegative().describe("Broadside separated-flow drag coefficient, blended by separation and sin(alpha)^2."),propellerEfficiency:L.nonnegative(),maxThrust:L.positive(),minPropellerSpeed:L.positive(),lateralDamping:L.nonnegative(),brakeDeceleration:L.positive(),rollingDeceleration:L.nonnegative(),groundTrackRate:L.positive().describe("Tire side grip with full weight on the wheels: lateral deceleration in m/s\xB2 and yaw grip in 1/s.")})),Cie=m.strictObject(cl({fixedGear:m.boolean().optional().describe("Fixed skids or wheels by default; false enables retractable gear."),gearTransitTime:L.nonnegative().optional().describe("Seconds for full retractable gear travel."),rotorPosition:Ct,rotorRadius:L.positive(),powerLimitedRotor:m.boolean().optional().describe("Govern rotor RPM and limit thrust using installed shaft power and actuator-disc momentum theory."),rotorEfficiency:L.positive().max(1).optional().describe("Rotor induced-power efficiency; default 0.75."),profilePowerFraction:L.min(0).max(1).optional().describe("Installed shaft-power fraction spent on rotor profile drag at governed RPM; default 0.12."),vortexRing:m.boolean().optional().describe("Enable estimated powered-descent vortex-ring loss of lift; default false."),retreatingBladeSpeed:L.positive().optional().describe("Sea-level TAS for estimated retreating-blade onset, m/s; decreases with density and rotor RPM."),rotorDiscs:L.int().min(1).max(2).optional().describe("Effective lifting-disc count, 2 for a tandem rotor; default 1."),cyclicTilt:L.positive(),cyclicResponse:L.positive(),cyclicDamping:L.nonnegative(),groundLevelRate:L.positive(),maxTilt:L.positive(),yawRate:L.positive(),liftMultiplier:L.positive(),groundEffect:L.nonnegative(),translationalLift:L.nonnegative(),translationalLiftSpeed:L.positive(),verticalDrag:L.nonnegative(),horizontalDrag:L.nonnegative(),quadraticDrag:L.nonnegative(),groundDeceleration:L.positive()})),P6=m.strictObject(cl({mixtureControl:m.boolean().optional().describe("Manual piston mixture; omitted leaves fuel scheduling automatic."),propellerControl:m.strictObject({minRpm:L.min(.3).max(.95).describe("Minimum governed RPM as a fraction of rated propeller RPM.")}).optional().describe("Constant-speed propeller; the lever selects RPM and the governor varies pitch."),propulsion:m.enum(["propeller","jet"]).optional().describe("Installed propulsion type; omitted preserves the legacy constant-power model."),dryThrust:L.positive().optional().describe("Sea-level static dry jet thrust in newtons, per engine."),afterburnerThrust:L.positive().optional().describe("Total sea-level static augmented thrust in newtons, per engine; must exceed dry thrust."),afterburnerDetent:L.min(.1).max(.99).optional().describe("Throttle fraction where reheat starts; default 0.85."),densityExponent:L.nonnegative().max(3).optional().describe("Installed power/thrust density lapse exponent."),highAltitudeDensityRatio:L.positive().max(1).optional().describe("Density ratio where upper-altitude engine lapse begins; continuous at this knee."),highAltitudeExponent:L.nonnegative().max(3).optional().describe("Density lapse exponent below highAltitudeDensityRatio; defaults to densityExponent."),ratedDensityRatio:L.positive().max(1).optional().describe("Lowest density ratio retaining flat-rated power or thrust; default 1."),ramRise:L.nonnegative().max(2).optional().describe("Jet net-thrust multiplier per Mach squared, representing inlet ram recovery; default 0."),position:Ct.describe("Engine thrust application point in aircraft-local meters, relative to the landing-contact origin."),thrustAxis:Ct.refine(n=>n.some(e=>e!==0),"Thrust axis must be nonzero.").describe("Local thrust direction; normalized by the solver."),power:L.positive().describe("Maximum shaft power in watts, per engine; retained as compatibility metadata for jets."),idleRpm:L.min(0).max(1),spoolRate:L.positive(),rotorAngularSpeed:L.positive(),vectored:m.boolean().optional().describe("Rotate +Z thrust toward +Y with the powered-lift lever."),propellerEfficiency:L.min(0).max(1).optional().describe("Per-engine override of airplane.propellerEfficiency."),maxThrust:L.positive().optional().describe("Per-engine static thrust cap in newtons; defaults to airplane.maxThrust."),minPropellerSpeed:L.positive().optional().describe("Minimum propeller advance speed in m/s for the power/thrust calculation; defaults to airplane.minPropellerSpeed."),propellerRotation:m.enum(["clockwise","counterclockwise"]).optional().describe("Turning direction seen from the cockpit. Clockwise (default) swings the nose left; scaled by airplane.propellerEffects."),propellerInertia:L.nonnegative().optional().describe("Propeller polar moment of inertia in kg m\xB2, for gyroscopic precession. Default 0.")})),s0=m.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/).refine(n=>!["__proto__","constructor","prototype"].includes(n),"Reserved engine id.").describe("Stable engine id, such as left or right; single-engine form uses main."),Rie=m.strictObject(cl({actuators:j6.optional(),label:m.string().min(1),genericLabel:s5.optional(),model:m.enum(["airplane","helicopter"]),mass:L.positive(),span:L.positive(),length:L.positive(),height:L.positive(),centerOfMass:Ct,pilotEye:Ct,engine:P6.optional().describe("Single engine, implicitly named main. Supply exactly one of engine or engines."),engines:m.array(P6.extend({id:s0})).min(1).optional().describe("Named independent airplane engines; ids must be unique. Each power/thrust limit is per engine."),airplane:Iie.optional(),helicopter:Cie.optional(),poweredLift:m.strictObject({transitTime:L.positive().describe("Seconds for thrust-vector travel from forward to vertical."),controlFadeSpeed:L.positive().describe("Axial airspeed in m/s at which assisted hover controls fade to zero."),pitchAuthority:L.positive().describe("Full-stick hover pitch angular acceleration in rad/s\xB2."),rollAuthority:L.positive().describe("Full-stick hover roll angular acceleration in rad/s\xB2."),yawAuthority:L.positive().describe("Full-pedal hover yaw angular acceleration in rad/s\xB2."),damping:L.positive().describe("Thrust-dependent hover angular-rate damping in 1/s.")}).optional().describe("Assisted hover controls and 0\u201390 degree thrust-vector actuator; airplane model only."),hardLandingSpeed:L.positive(),hardLandingRoll:L.positive(),hardLandingPitch:L.positive(),maxSupportStep:L.nonnegative(),collisionProbes:m.array(Ct).min(1),collisionParts:m.array(m.strictObject({id:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/).describe("Unique section id used by damage and debris state."),role:m.enum(["body","leftWing","rightWing","tail","rotor","tailRotor","gear","engine"]).describe("Flight role; +X is the left wing. Body sections cannot detach."),probes:m.array(Ct).max(64).describe("Local collision sphere centers, meters."),radius:L.positive().describe("Probe and detached-piece collision radius, meters."),disc:m.strictObject({center:Ct.describe("Rotor hub in model coordinates, meters."),normal:Ct.refine(n=>Math.abs(Math.hypot(...n)-1)<1e-5,"Expected a unit normal.").describe("Unit rotation axis in model coordinates."),radius:L.positive().describe("Full swept rotor radius, meters."),halfThickness:L.positive().describe("Half the swept blade thickness, meters."),rotor:m.string().min(1).describe("Node in visual.rotors supplying engine RPM and speed multiplier."),tilt:m.strictObject({pivot:Ct.describe("Powered-lift hinge pivot in model coordinates, meters."),axis:Ct.refine(n=>Math.abs(Math.hypot(...n)-1)<1e-5,"Expected a unit axis.").describe("Unit powered-lift hinge axis in model coordinates."),angle:L.describe("Hinge rotation in radians at full thrustVectorPosition.")}).optional().describe("Powered-lift hinge, in model coordinates at forward thrust.")}).optional().describe("Finite rotor disc replacing sphere probes, including at rest. Blade speed contributes to strike damage."),parent:m.string().min(1).optional().describe("Supporting part id; separation also releases this part."),center:Ct.describe("Section center in model coordinates, meters."),massFraction:L.positive().max(1).describe("Share of the original mass removed on separation."),breakSpeed:L.positive().optional().describe("Joint failure speed in m/s for a normal impact. Loaded sliding also causes shear damage. Omit for an unbreakable section."),nodes:m.array(m.string().min(1)).describe("GLB node names belonging to this section, including attached controls."),fragments:m.strictObject({nodes:m.array(m.string().min(1)).min(1).describe("Shared static meshes to partition by triangle centroid."),min:Ct.describe("Minimum corner of the section region in model meters."),max:Ct.describe("Maximum corner of the section region in model meters.")}).optional().describe("Optional region for splitting shared markings and detail meshes."),engines:m.array(s0).optional().describe("Engine ids that fail when this section detaches.")})).min(1).max(64).optional().describe("Breakable airframe sections: local probe spheres, section center, mass fraction, normal break speed (m/s), GLB nodes and attached engines. Replaces collisionProbes."),visual:m.strictObject(cl({rotors:m.array(cS.extend({engine:s0.optional().describe("Engine id driving this propeller; omitted follows the first engine.")})),gearNodes:m.array(m.string().min(1)).describe("Nodes hidden while the landing gear is fully up."),flaps:m.array(cS).describe("Flap nodes turned by multiplier radians at full travel, in proportion to the flap position."),ailerons:m.array(cS),controlStick:m.strictObject(cl({node:m.string().min(1),pitchAxis:m.enum(["x","y","z"]),rollAxis:m.enum(["x","y","z"])})).optional(),collective:cS.optional(),airspeedGaugeMax:L.positive().optional(),interior:t5.optional(),animation:o5.optional()}))})).superRefine((n,e)=>{let t=n.engines??(n.engine?[n.engine]:[]);n.poweredLift&&(n.model!=="airplane"||!t.some(a=>a.vectored))&&e.addIssue({code:"custom",path:["poweredLift"],message:"Powered lift requires an airplane with a vectored engine."});for(let[a,c]of t.entries()){let l=n.engine?["engine"]:["engines",a];c.propulsion==="jet"&&(c.mixtureControl||c.propellerControl)&&e.addIssue({code:"custom",path:l,message:"Jets cannot have manual piston mixture or propeller controls."}),c.propellerControl&&(n.model!=="airplane"||c.propellerControl.minRpm<=c.idleRpm)&&e.addIssue({code:"custom",path:l,message:"Propeller governing requires an airplane and minimum RPM above idle."}),c.propulsion==="jet"&&(c.dryThrust===void 0||n.model!=="airplane")&&e.addIssue({code:"custom",path:l,message:"Jet propulsion requires dryThrust and model airplane."}),c.afterburnerThrust!==void 0&&(c.propulsion!=="jet"||c.afterburnerThrust<=(c.dryThrust??0))&&e.addIssue({code:"custom",path:l,message:"Afterburner thrust requires a jet and must exceed dry thrust."})}for(let a of t)a.vectored&&(!n.poweredLift||a.thrustAxis[0]!==0||a.thrustAxis[1]!==0||(a.thrustAxis[2]??0)<=0)&&e.addIssue({code:"custom",path:["poweredLift"],message:"Vectored engines require poweredLift and a forward +Z thrust axis."});n.engine===void 0==(n.engines===void 0)&&e.addIssue({code:"custom",path:["engines"],message:"Supply exactly one of engine or engines."}),n.model==="helicopter"&&n.engines!==void 0&&e.addIssue({code:"custom",path:["engines"],message:"Independent propeller engines require model airplane; helicopters use engine and a shared rotor."});let i=new Set;n.engine!==void 0&&i.add("main");for(let[a,c]of(n.engines??[]).entries())i.has(c.id)&&e.addIssue({code:"custom",path:["engines",a,"id"],message:"Engine ids must be unique."}),i.add(c.id);a5(n.visual,e,["visual"]);let r=new Set,s=new Set,o=0;for(let[a,c]of(n.collisionParts??[]).entries()){r.has(c.id)&&e.addIssue({code:"custom",path:["collisionParts",a,"id"],message:"Collision part ids must be unique."}),r.add(c.id),!c.disc&&c.probes.length===0&&e.addIssue({code:"custom",path:["collisionParts",a,"probes"],message:"A section needs sphere probes or a rotor disc."}),c.disc&&!n.visual.rotors.some(d=>d.node===c.disc?.rotor)&&e.addIssue({code:"custom",path:["collisionParts",a,"disc","rotor"],message:"Unknown visual rotor node."});let l=new Set([c.id]),u=c.parent;for(;u!==void 0;){let d=n.collisionParts?.find(h=>h.id===u);if(!d||l.has(u)||c.role==="body"){e.addIssue({code:"custom",path:["collisionParts",a,"parent"],message:"Part parents must exist, be acyclic, and cannot carry the body."});break}l.add(u),u=d.parent}c.fragments&&c.fragments.min.some((d,h)=>d>=(c.fragments?.max[h]??0))&&e.addIssue({code:"custom",path:["collisionParts",a,"fragments"],message:"Fragment bounds must have positive size on every axis."}),(c.breakSpeed!==void 0||c.parent!==void 0)&&(o+=c.massFraction),c.role==="body"&&c.breakSpeed!==void 0&&e.addIssue({code:"custom",path:["collisionParts",a,"breakSpeed"],message:"The body cannot detach."});for(let d of c.nodes)s.has(d)&&e.addIssue({code:"custom",path:["collisionParts",a,"nodes"],message:"A node can belong to only one collision part."}),s.add(d);for(let d of c.engines??[])i.has(d)||e.addIssue({code:"custom",path:["collisionParts",a,"engines"],message:`Unknown engine id ${d}.`})}o>=.8&&e.addIssue({code:"custom",path:["collisionParts"],message:"Detachable sections must leave at least 20% of the aircraft mass."}),n.collisionParts&&!n.collisionParts.some(a=>a.role==="body")&&e.addIssue({code:"custom",path:["collisionParts"],message:"Collision parts must include a body."});for(let[a,c]of n.visual.rotors.entries())c.engine!==void 0&&!i.has(c.engine)&&e.addIssue({code:"custom",path:["visual","rotors",a,"engine"],message:`Unknown engine id ${c.engine}.`});(n.model==="airplane"?n.airplane:n.helicopter)===void 0&&e.addIssue({code:"custom",path:[n.model],message:`${n.model} configuration is required for model ${n.model}`})});Ft("aircraft",m.strictObject({kind:m.string().min(1).describe("Stable external entity/type id."),spec:Rie.describe("Complete airplane or helicopter performance configuration.")}),{owner:"kernel/aircraft",description:"External airplane/helicopter instance. Y up, Z forward; landing-contact origin.",docsRef:"guide/aircraft.md",examples:[{kind:"example.airplane",spec:{label:"Example airplane",model:"airplane",mass:1200,span:10,length:8,height:3,centerOfMass:[0,1,0],pilotEye:[0,1.8,0],engine:{position:[0,1,2.5],thrustAxis:[0,0,1],power:2e5,idleRpm:.2,spoolRate:.5,rotorAngularSpeed:200},airplane:{wingPosition:[0,1,0],wingArea:16,controlAuthoritySpeed:45,maxControlAuthority:1.3,pitchAuthority:.4,pitchResponse:3,stallPitchRate:.18,rollAuthority:1,rollResponse:2,rudderAuthority:1,groundSteerSpeed:8,groundLevelRate:2,maxGroundPitch:.2,camberAngle:.04,flapLift:.3,postStallFlapEffect:.4,stallAngle:.28,stallSpeed:22,liftSlope:4.5,postStallLift:.2,postStallDecay:2.8,profileDrag:.025,inducedDrag:.065,gearDrag:.018,flapDrag:.035,stallDrag:.2,propellerEfficiency:.8,maxThrust:5e3,minPropellerSpeed:40,lateralDamping:.8,brakeDeceleration:7,rollingDeceleration:.22,groundTrackRate:12},hardLandingSpeed:4.5,hardLandingRoll:.3,hardLandingPitch:.35,maxSupportStep:.65,collisionProbes:[[0,1,0]],visual:{rotors:[{node:"propeller",axis:"z",multiplier:1}],gearNodes:["gear"],flaps:[{node:"flap",axis:"x",multiplier:-.45}],ailerons:[{node:"aileron",axis:"x",multiplier:.3}],controlStick:{node:"control-stick",pitchAxis:"x",rollAxis:"z"},airspeedGaugeMax:180}}}]});Ft("aircraftInput",m.strictObject({actuators:Q6.optional().describe("Mechanism targets from zero to one, or on/off selections."),mixture:L.min(0).max(1).optional().describe("Common mixture: 0 idle cutoff, 1 full rich (default)."),propeller:L.min(0).max(1).optional().describe("Common propeller lever: 0 minimum governed RPM, 1 maximum (default)."),power:L.min(0).max(1).describe("Absolute throttle for a plane; collective for a helicopter."),pitch:L.min(-1).max(1).describe("Positive pulls the nose up."),roll:L.min(-1).max(1).describe("Positive banks right."),yaw:L.min(-1).max(1).describe("Positive rudder/pedals turns right."),brake:m.boolean().describe("Ground wheel brake."),engine:m.boolean().describe("Engine on; rotor/propeller spools over time."),engines:m.record(s0,m.strictObject({power:L.min(0).max(1).optional().describe("Absolute throttle override; omitted inherits common power."),mixture:L.min(0).max(1).optional().describe("Individual mixture override; inherits common mixture."),propeller:L.min(0).max(1).optional().describe("Individual propeller RPM override; inherits common propeller."),enabled:m.boolean().optional().describe("Individual engine switch; common engine switch is the master cutoff.")})).optional().describe("Per-engine pilot overrides by id. Failures live in aircraftState and cannot be cleared by pilot input."),gear:m.boolean().describe("Landing gear extended; helicopter skids are fixed."),flaps:m.union([m.boolean(),L.min(0).max(1)]).describe("Plane flap selection: boolean up/down or fraction 0..1."),thrustVector:L.min(0).max(1).optional().describe("Powered-lift lever: 0 forward to 1 vertical.")}),{owner:"kernel/aircraft",description:"Pilot flight controls. Power is retained when input keys are released.",docsRef:"guide/aircraft.md",examples:[{power:0,pitch:0,roll:0,yaw:0,brake:!0,engine:!1,gear:!0,flaps:!1}]});Ft("aircraftState",m.strictObject({actuators:W6.optional().describe("Current mechanism positions and cycle phases, from zero to one."),damage:m.record(m.string(),m.strictObject({integrity:L.min(0).max(1).describe("Remaining joint integrity, 0 broken to 1 intact."),detached:m.boolean().describe("Section has separated and no longer supplies lift or collision probes.")})).optional().describe("Persistent section integrity and separation, keyed by collision part id."),debris:m.array(m.strictObject({part:m.string().min(1).describe("Owning collision section id."),pos:Ct.describe("Section center in world meters."),rot:yS.describe("World-space section orientation quaternion."),velocity:Ct.describe("World velocity in m/s, inherited at separation including travel boost."),angularVelocity:Ct.describe("Local angular velocity about +X, +Y and +Z, rad/s."),age:L.nonnegative().describe("Simulated seconds since separation; expires at 20 seconds.")})).max(64).optional().describe("Detached sections in world coordinates, simulated for 20 seconds. Their removal does not repair the aircraft."),boosted:m.boolean().optional().describe("Speeds include the 4\xD7 travel boost; kernel-owned."),mach:L.nonnegative().optional().describe("True airspeed divided by local speed of sound."),equivalentAirspeed:L.nonnegative().optional().describe("Airspeed normalized to standard sea-level density, m/s; not calibrated IAS."),overspeed:m.boolean().optional().describe("An airframe, surface or rotor speed limit is exceeded; informational, not a speed clamp."),departure:L.min(0).max(1).optional().describe("Developed high-alpha departure fraction."),vortexRing:L.min(0).max(1).optional().describe("Rotor vortex-ring severity in powered slow descent."),velocity:Ct.describe("World velocity in meters per second."),yaw:L.describe("Heading in radians, zero +Z. Airplanes report it from transform.rot, which is authoritative."),pitch:L.describe("Nose-up angle in radians (\xB1\u03C0/2 at the vertical)."),roll:L.describe("Right bank angle in radians; \xB1\u03C0 inverted."),pitchRate:L.describe("Body pitch rate, nose up, in radians per second."),rollRate:L.describe("Body roll rate, right wing down, in radians per second."),yawRate:L.optional().describe("Airplane body yaw rate about local +Y (nose left), in rad/s."),elevator:L.min(-1).max(1).optional().describe("Airplane elevator position after its travel limit, -1..1."),gearPosition:L.min(0).max(1).optional().describe("Landing gear: 0 up and locked, 1 down and locked, between them in transit. Fixed undercarriages stay down."),flapPosition:L.min(0).max(1).optional().describe("Airplane flaps as a fraction of full travel, 0..1. Starts at the commanded position."),pitchTrim:L.optional().describe("Airplane trimmed angle of attack in radians, flown with the stick centered."),thrustVectorPosition:L.min(0).max(1).optional().describe("Actual thrust-vector position after actuator travel, 0 forward to 1 vertical."),sideslip:L.optional().describe("Airplane sideslip in radians, positive with the relative wind from the left."),loadFactor:L.optional().describe("Airplane aerodynamic and thrust load along its up axis, in g."),engines:m.record(s0,m.strictObject({rpm:L.min(0).max(1),shaftPower:L.nonnegative().optional(),combustion:L.min(0).max(1).optional(),rotorAngle:L,failed:m.boolean(),afterburner:L.min(0).max(1).optional(),thrust:L.nonnegative().describe("Current propeller thrust in newtons; zero for the helicopter shaft engine.")})).optional().describe("Authoritative individual spool, rotor phase, failure and thrust state; initialized by the solver."),rpm:L.min(0).max(1).describe("Maximum normalized RPM across all engines; used by common HUDs and exit checks."),rotorAngle:L.describe("First engine rotor phase, wrapped in radians; bind visuals by engine id for independent phases."),airspeed:L.nonnegative().describe("Speed relative to wind in meters per second."),altitudeAGL:L.nonnegative().describe("Height above available terrain in meters."),verticalSpeed:L.describe("Vertical velocity in meters per second."),angleOfAttack:L.describe("Wing incidence relative to airflow in radians."),stalled:m.boolean().describe("Wing beyond useful lift envelope."),grounded:m.boolean().describe("Supported by landing surface."),crashed:m.boolean().describe("Airframe damage requiring recovery. Motion continues under forces and collision impulses."),waitingForTerrain:m.boolean().describe("Paused at last known position while terrain is unavailable.")}),{owner:"kernel/aircraft",description:"Deterministic flight state, including rotor phase and engine spool, preserved by keyframes.",docsRef:"guide/aircraft.md",examples:[{velocity:[0,0,0],yaw:0,pitch:0,roll:0,pitchRate:0,rollRate:0,rpm:0,rotorAngle:0,airspeed:0,altitudeAGL:0,verticalSpeed:0,angleOfAttack:0,stalled:!1,grounded:!0,crashed:!1,waitingForTerrain:!1}]});var rFe=new Set(dm.keys()),O6=m.strictObject({id:m.string().min(1).describe("Exact browser Gamepad.id; omit to match any ID.").optional(),index:m.int().nonnegative().describe("Browser Gamepad.index; may change on reconnect.").optional()}),Fk={bindings:m.record(m.string().min(1),m.string().min(1)).describe("KeyboardEvent.code or Mouse<button> to action name."),axes:m.array(m.strictObject({action:m.string().min(1).describe("Named action receiving the numeric axis value."),axis:m.int().nonnegative().describe("Raw zero-based axis index; no standard mapping required."),device:O6.optional(),mode:m.enum(["signed","positive","negative","unit"]).describe("signed -1..1 (default), positive/negative half axis 0..1, or unit full travel 0..1.").optional(),invert:m.boolean().describe("Reverse calibrated travel before applying the mode.").optional(),deadZone:m.number().min(0).lt(1).describe("Rescaled dead zone; default 0.12 (unit: 0).").optional(),curve:m.number().positive().describe("Response exponent; default 1 (linear).").optional(),min:m.number().describe("Raw minimum; default -1. Must be below center.").optional(),center:m.number().describe("Raw center; default 0. Must lie between min and max.").optional(),max:m.number().describe("Raw maximum; default 1. Must be above center.").optional()})).describe("Mappings for arbitrary browser-exposed joystick axes.").optional(),buttons:m.array(m.strictObject({action:m.string().min(1).describe("Named action receiving button presses and releases."),button:m.int().nonnegative().describe("Raw zero-based button index."),device:O6.optional(),threshold:m.number().positive().max(1).describe("Analog button press threshold; default 0.5.").optional()})).describe("Mappings for arbitrary browser-exposed controller buttons.").optional()},l5=m.strictObject(Fk);function u5(n){return(n.axes??[]).flatMap((e,t)=>(e.min??-1)<(e.center??0)&&(e.center??0)<(e.max??1)?[]:[{axis:t,message:"Axis calibration requires min < center < max."}])}function fS(n){if(n===null||typeof n!="object")return n;if(Array.isArray(n))return n.map(t=>fS(t));let e=Object.create(null);for(let[t,i]of Object.entries(n))i!==void 0&&(e[t]=fS(i));return e}function l0(n,e){let t=fS(n);for(let[i,r]of Object.entries(e)){if(r===void 0)continue;let s=t[i];s!=null&&typeof s=="object"&&!Array.isArray(s)&&r!==null&&typeof r=="object"&&!Array.isArray(r)?t[i]=l0(s,r):t[i]=fS(r)}return t}function Pk(n,e){if(n===void 0)return{};let t=e?.types?.get(n);if(t===void 0)throw new Error(`scene references unknown type "${n}" \u2014 is a project.json with types loaded?`);return t.components}function Qk(n,e,t,i=[]){if(i.includes(e))throw new Error(`prefab inheritance cycle: ${[...i,e].join(" \u2192 ")}`);let r=n.prefabs[e];if(r===void 0)throw new Error(`scene references unknown prefab "${e}"`);let s=r.extends!==void 0?Qk(n,r.extends,t,[...i,e]):Pk(r.type,t);return l0(r.extends!==void 0&&r.type!==void 0?l0(Pk(r.type,t),s):s,r.components)}function Bie(n,e,t){let i=Pk(e.type,t);return e.prefab!==void 0&&(i=l0(i,Qk(n,e.prefab,t))),e.components!==void 0&&(i=l0(i,e.components)),i}function vS(n,e){return e===n||e.startsWith(`${n}.`)}function Nie(n,e){let t=[...e],i=new Set(t),r=[],s=(o,a,c)=>{let l=ss(a,t);r.push({path:o,code:"unknown_type",message:`${c} references unknown registry type "${a}"`,expected:t.length>0?`one of: ${t.join(", ")}`:'a type from project.json "types"',...l!==void 0?{hint:`did you mean "${l}"?`}:{},docsRef:"guide/project.md"})};n.entities.forEach((o,a)=>{o.type!==void 0&&!i.has(o.type)&&s(`/entities/${a}/type`,o.type,"entity")});for(let[o,a]of Object.entries(n.prefabs))a.type!==void 0&&!i.has(a.type)&&s(`/prefabs/${o.replaceAll("~","~0").replaceAll("/","~1")}/type`,a.type,`prefab "${o}"`);return r}var fm=m.json(),f0=m.record(m.string(),fm),hm=m.record(m.string(),f0),cm=m.string().min(1),kie=m.string().min(1).regex(/^(?!e\d+$)(?!\d+$)(?!\$)/,'authored entity ids must not look like runtime ids ("e" + number), be all digits (JSON objects reorder integer-like keys, which would break creation-order iteration after save/load), or start with "$" (kernel singletons)'),Wk=m.union([m.string(),m.number()]),u0=m.int().nonnegative(),qk=m.strictObject({kind:m.literal("command").describe("Envelope discriminator; always 'command'."),seq:m.int().nonnegative().describe("Monotonic sequence number assigned by the source; orders commands within a tick."),source:m.string().min(1).describe("Origin of the command, e.g. 'local' or 'agent:<name>'."),tick:u0.describe("Tick the command was submitted for."),tickExecuted:u0.describe("Tick the kernel actually executed the command at (set when a late command was rewritten to a later tick).").optional(),type:m.string().min(1).describe("Command type; must match a registered handler and, for molen/scene@3, an entry under the scene `commands`."),payload:fm.describe("Command payload (any JSON); validated against the declared payload schema when the scene declares one.")}),Die=m.strictObject({type:m.string().min(1).describe("Event type name."),payload:fm.describe("Event payload (any JSON).")}),Kk=m.string().regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/,{error:'must be dotted lower_snake segments, e.g. "train" or "train.rolling_stock"'}),xS=m.string().regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/,{error:'must be a namespaced dotted id, e.g. "train.locomotive"'}),cc=m.string().min(1).regex(/^(?![A-Za-z]:|[/\\])(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$)).+$/,{error:'must be a contained relative POSIX path (no drive letters, leading/back slashes, or ".." segments)'}),um=n=>m.array(m.number()).length(n),d5=m.strictObject({format:m.literal("molen/prefab@1").describe("Format envelope 'molen/prefab@1' (optional when the prefab is inlined in a scene).").optional(),extends:m.string().min(1).describe("Name of a prefab in the same manifest to inherit components from (deep-merged).").optional(),type:xS.describe("Project-registry type id this prefab specializes, e.g. 'train.locomotive'.").optional(),components:hm.describe("Component name to pure-JSON component data (deep-merged over the extends/type base).").default({})}),Fie=m.strictObject({id:kie.describe("Authored entity id, stable across save/load; omitted = runtime id 'e<n>'.").optional(),type:xS.describe("Project-registry type id to instantiate, e.g. 'train.locomotive'.").optional(),prefab:m.string().min(1).describe("Name of a prefab in this scene to instantiate.").optional(),components:hm.describe("Component name to component data, layered over the type/prefab base (a partial when a base is present).").optional()}),Pie=m.strictObject({doc:m.string().describe("Human/agent description of what the command does.").optional(),payload:f0.describe("JSON Schema (object/array/number/integer/string/boolean subset) the payload must satisfy; omitted = any JSON.").optional()}),h5=m.strictObject({description:m.string().min(1).describe("One-line human/agent description of the component."),examples:m.array(fm).min(1).describe("At least one valid example of the component data (feeds hints and docs)."),schema:f0.describe("JSON Schema (object/array/number/integer/string/boolean subset) for the component data; omitted = any object.").optional()}),f5=m.string().regex(/^[a-zA-Z]\w*$/,{error:'component names are identifiers, e.g. "team" or "spawnPoint"'}),p5=m.strictObject({checkpoint:m.literal("state").describe("Opt into checkpoint restore: keep all durable state in molen.state, components, or snapshot providers, never mutable closures. Without this declaration replay seeks from the beginning.").optional(),id:m.string().min(1).describe("Script id, unique within the scene."),code:m.string().min(1).describe("Inline JavaScript source (exactly one of code or path).").optional(),path:cc.regex(/\.(?:js|ts)$/,{error:"script path must end in .js or .ts"}).describe("Scene-relative path to a script file, .js or .ts (exactly one of code or path). A .ts file has its types erased when the scene is loaded.").optional(),config:f0.describe("Frozen JSON config exposed to the script as `config`.").default({})}),L6=um(3).describe("Camera position [x, y, z] in meters (Y-up)."),U6=um(3).describe("Point [x, y, z] in meters the camera looks at (default: the origin).").optional(),Ck=m.number().min(1).max(179).describe("Vertical field of view in degrees.").optional(),Oie=m.discriminatedUnion("mode",[m.strictObject({mode:m.literal("follow").describe("Perspective camera tracking an interpolated entity transform; works in live play and capture."),entity:m.string().min(1).describe("Entity to follow (need not have a renderable)."),offset:um(3).describe("Camera offset [x,y,z] in meters from the target."),lookOffset:um(3).describe("Look-at offset from the target; must differ from offset."),space:m.enum(["world","local"]).describe("World-axis offsets (default), or offsets rotated by the target quaternion (first person/chase).").optional(),fov:Ck}),m.strictObject({mode:m.literal("fixed").describe("Static perspective camera."),position:L6,lookAt:U6,fov:Ck}),m.strictObject({mode:m.literal("free-fly").describe("Perspective camera the user flies with keyboard/mouse."),position:L6,lookAt:U6,fov:Ck,moveSpeed:m.number().positive().describe("Base fly speed in meters per second (default 10).").default(10),boost:m.number().positive().describe("Speed multiplier while the boost key is held (default 4).").default(4)}),m.strictObject({mode:m.literal("top-down-ortho").describe("Orthographic camera looking straight down (-Y); screen-up is -z (north), screen-down is +z (south)."),center:um(2).describe("World [x, z] in meters the view centers on."),viewHeight:m.number().positive().describe("World-space height in meters of the visible area; width follows the viewport aspect."),cameraHeight:m.number().positive().describe("Camera height in meters above the y = 0 plane (default 200).").optional()})]),Ru=n=>m.string().min(1).describe(`Input action name produced by keyboard, button, or axis bindings ${n}.`),lS=m.string().min(1).describe("Command type to emit; must be declared under the scene `commands`."),$6=f0.describe("Fixed JSON payload sent with the command.").default({}),Lie=m.discriminatedUnion("kind",[m.strictObject({kind:m.literal("axis").describe("Emit a numeric action value when it changes."),action:Ru("whose numeric value drives the axis"),negative:Ru("to subtract from the value (optional keyboard opposite)").optional(),command:lS,field:m.string().min(1).describe("Payload field receiving the number (default 'value').").default("value")}),m.strictObject({kind:m.literal("press").describe("Emit once when the action becomes active."),action:Ru("that triggers the command"),command:lS,payload:$6}),m.strictObject({kind:m.literal("release").describe("Emit once when the action becomes inactive."),action:Ru("that triggers the command"),command:lS,payload:$6}),m.strictObject({kind:m.literal("axis2d").describe("Emit the command whenever the [x, y] axis vector built from four actions changes."),xNeg:Ru("that drives x toward -1 (west)"),xPos:Ru("that drives x toward +1 (east)"),yNeg:Ru("that drives y toward -1 (north / screen-up)"),yPos:Ru("that drives y toward +1 (south / screen-down, i.e. +z)"),command:lS,field:m.string().min(1).describe("Payload field that receives the [x, y] vector (default 'dir').").default("dir")})]),Uie=m.strictObject({bindings:m.record(m.string().min(1),m.string().min(1)).describe("KeyboardEvent.code (e.g. 'KeyW') to input action name."),axes:Fk.axes,buttons:Fk.buttons,profiles:m.record(m.string().min(1),l5).describe("Named complete binding sets for walking, flying, driving, or other use cases.").optional(),profile:m.string().min(1).describe("Initial profile name; absent uses the root bindings.").optional(),emit:m.array(Lie).describe("Rules that turn input actions into commands.").default([])}),$ie=m.strictObject({descriptor:cc.describe("Scene-relative path to the molen/terrain descriptor JSON."),heightmap:cc.describe("Scene-relative path to a PNG16 heightmap used for headless ground sampling / collision.").optional()}),Rk=m.enum(["car","pedestrian","train","aircraft","boat"]),zie=m.strictObject({network:m.union([cc,m.looseObject({format:m.literal("molen/transport-network@1").describe("Format envelope; always 'molen/transport-network@1'.")})]).describe("The road, rail and path network NPCs move on: a scene-relative path to a molen/transport-network@1 document, or the document inline.").optional(),observer:m.string().min(1).describe("Entity whose position drives the spawn ring (default: the entity carrying ambientObserver, else the ambient.observer command).").optional(),classes:m.array(Rk).describe("Which NPC classes run (default ['car']).").optional(),density:m.partialRecord(Rk,m.number().nonnegative()).describe("Target agents per kilometre of lane near the observer, per class.").optional(),drivingSide:m.enum(["right","left"]).describe("Which side of the road traffic keeps to (default 'right').").optional(),radius:m.number().positive().describe("Outer spawn radius in metres for cars (other classes scale from it).").optional(),despawnRadius:m.number().positive().describe("Distance in metres beyond which cars are removed (must exceed radius).").optional(),templates:m.partialRecord(Rk,m.string().min(1)).describe("Prefab name per class whose components every spawned agent receives.").optional(),seedSalt:m.string().describe("Mixed into the scene seed for ambient draws, to vary traffic without reseeding.").optional()}),Gie=m.strictObject({engine:m.enum(["none","kinematics","platformer","rapier"]).describe("Physics engine: none, kinematics (cross-platform deterministic 2.5D in the XZ plane), platformer (cross-platform deterministic XY swept boxes), or rapier (same-platform deterministic 3D)."),gravity:um(3).describe("Gravity [x, y, z] in meters per second squared (rapier; default [0, -9.81, 0]).").optional(),ground:m.enum(["flat","terrain"]).describe("Ground for kinematic bodies: flat y = 0 (default) or the scene's terrain heightfield.").optional(),character:m.boolean().describe("Install the kernel character controller (character + moveIntent components); not allowed with rapier.").optional()}),Vie=m.strictObject({format:m.literal("molen/scene@3").describe("Format envelope; always 'molen/scene@3'."),name:m.string().min(1).describe("Human-readable scene name."),seed:Wk.describe("Deterministic RNG seed (string or number; default 0).").default(0),tickRate:m.int().min(1).max(240).describe("Simulation ticks per second, 1..240 (default 30); dt = 1/tickRate seconds.").default(30),lateCommands:m.enum(["rewrite","reject"]).describe("Commands that arrive for a past tick: rewrite to the current tick (default) or reject.").default("rewrite"),keyframeInterval:m.int().min(1).describe("Ticks between full keyframe snapshots (default 60).").default(60),prefabs:m.record(m.string(),d5).describe("Prefab name to prefab (entity templates instantiated by entities[].prefab).").default({}),entities:m.array(Fie).describe("Entities instantiated at tick 0, in order.").default([]),scripts:m.array(p5).describe("Deterministic scene scripts (inline code or file refs). Evaluated with the authority of the host process, so treat a manifest like source code.").default([]),commands:m.record(m.string().min(1),Pie).describe("Command types this scene accepts, with optional doc and payload schema (scripts attach handlers via molen.onCommand).").default({}),components:m.record(f5,h5).describe("Custom component vocabulary this scene introduces (description + examples, optional schema); known to validation and docs.").default({}),camera:Oie.describe("Initial client camera.").optional(),input:Uie.describe("Keyboard bindings and the rules that turn them into commands.").optional(),terrain:$ie.describe("Streamed heightmap terrain attached to the scene.").optional(),physics:Gie.describe("Physics engine selection and settings.").optional(),ambient:zie.describe("Ambient life: NPC cars, pedestrians, trains and aircraft that spawn around an observer on a transport network (needs @bendyline/molen-ambient).").optional()}),Hie=m.strictObject({algo:m.literal("sfc32").describe("RNG algorithm; always 'sfc32'."),state:m.array(m.int().nonnegative()).length(4).describe("The four 32-bit unsigned words of sfc32 state.")}),m5=m.strictObject({kind:m.literal("keyframe").describe("Envelope discriminator; always 'keyframe'."),v:m.literal(1).describe("Keyframe format version; always 1."),engine:m.string().min(1).describe("Engine version that produced the snapshot."),tick:u0.describe("Tick the snapshot was taken at (state after this tick)."),tickRate:m.int().min(1).max(240).describe("Simulation ticks per second of the world; dt = 1/tickRate seconds."),seed:Wk.describe("World RNG seed (string or number)."),nextEntitySeq:m.int().nonnegative().describe("Next runtime entity sequence number (runtime ids are 'e<seq>')."),entityOrder:m.array(cm).describe("Entity creation order; older snapshots fall back to object key order.").optional(),commands:m.strictObject({pending:m.array(qk),highestSeq:m.record(m.string(),m.int().nonnegative()),latePolicy:m.enum(["rewrite","reject"])}).describe("Accepted future commands and deduplication cursors.").optional(),rng:Hie.describe("Exact RNG state so the run resumes deterministically."),entities:m.record(cm,hm).describe("Entity id to component map: the complete world state."),plugins:m.record(m.string(),fm).describe("Opaque per-plugin snapshot blobs keyed by plugin name.").default({})}),jie=m.strictObject({kind:m.literal("delta").describe("Envelope discriminator; always 'delta'."),v:m.literal(1).describe("Delta format version; always 1."),tick:u0.describe("Tick this delta describes (state after this tick)."),baseTick:u0.describe("Tick the delta is relative to (normally tick - 1)."),spawned:m.record(cm,hm).describe("Entities created this tick with their full component maps.").default({}),destroyed:m.array(cm).describe("Ids of entities destroyed this tick.").default([]),changed:m.record(cm,hm).describe("Entities whose components changed, each carrying the full new value of every changed component (whole-component granularity).").default({}),removedComponents:m.record(cm,m.array(m.string())).describe("Entity id to names of components removed this tick.").default({}),events:m.array(Die).describe("World events emitted this tick, in emission order.").default([])}),Qie=m.record(m.string().min(1),m.strictObject({hash:m.string().min(1).describe("Hash of the domain's content."),packs:m.array(m.string().min(1)).describe('Packs the content came from, as "id@version".').optional()})).describe("Content the world was built from, by domain (e.g. types, places)."),z6={format:m.literal("molen/replay@1").describe("Format envelope; always 'molen/replay@1'."),content:Qie.describe("Content the replay was recorded with; replaying against different content fails before the first tick.").optional(),engine:m.string().min(1).describe("Engine version the fixture was recorded with."),seed:Wk.describe("Seed override (string or number; defaults to the scene seed).").optional(),ticks:m.int().positive().describe("Number of ticks to simulate."),commands:m.array(qk).describe("Command log to feed in, ordered by tick then seq.").default([]),expected:m.strictObject({stateHash:m.string().min(1).describe("Expected world-state hash after the final tick."),eventCount:m.int().nonnegative().describe("Expected total number of events emitted over the run.").optional(),tickHashes:m.array(m.string().min(1)).describe("Per-tick reference hashes (entry i = hash after tick i) used to localize divergence.").optional()}).describe("Expected outcome; a mismatch is a determinism failure.").optional()},G6=cc.describe("Fixture-relative path to the scene file to boot from."),V6=m5.describe("Keyframe to start from instead of (or in addition to) booting the scene."),Wie=m.union([m.strictObject({...z6,scene:G6,initialKeyframe:V6.optional()}),m.strictObject({...z6,scene:G6.optional(),initialKeyframe:V6})]),qie=m.strictObject({select:m.string().min(1).describe("Entity selector plus optional value path: '#id', 'tag:name', 'has:component', e.g. '#player .health.hp'."),op:m.enum(["eq","approx","gt","gte","lt","lte","count","exists","all_eq","all_approx","all_gt","all_gte","all_lt","all_lte","any_eq","any_approx","any_gt","any_gte","any_lt","any_lte"]).describe("Comparison: eq/approx/gt/gte/lt/lte on the single match, count/exists on the match set, all_*/any_* over every match."),value:fm.describe("Expected value (for count: the expected number of matches).").optional(),tol:m.number().positive().describe("Absolute tolerance for approx ops (default 1e-6).").optional()}),Kie=m.strictObject({event:m.string().min(1).describe("World event type to check."),op:m.enum(["occurred","never","count","at_tick"]).describe("occurred (at least once), never, count (value = expected count), or at_tick (value = tick it must have occurred at)."),value:m.number().describe("Expected count for count, or tick for at_tick.").optional()}),Xie=m.strictObject({format:m.literal("molen/assert@1").describe("Format envelope; always 'molen/assert@1'."),assertions:m.array(m.union([qie,Kie])).min(1).describe("Assertions evaluated after the run (at least one).")}),Zie={kind:"keyframe",v:1,engine:"0.0.1",tick:120,tickRate:30,seed:"demo",nextEntitySeq:2,rng:{algo:"sfc32",state:[738291,102,99182,4]},entities:{player:{transform:{pos:[0,1,0],rot:[0,0,0,1]},health:{hp:80}},e1:{transform:{pos:[9,0,3],rot:[0,0,0,1]},lifetime:{ticksLeft:12}}},plugins:{}};Xn("command",qk,{id:"molen/command@1",title:"Command envelope",description:"Client/agent intent submitted to the kernel for validation and adjudication at a tick.",examples:[{kind:"command",seq:1,source:"local",tick:45,type:"spawn_cube",payload:{pos:[0,2,0]}}],docsRef:"schemas/command.md"});function Io(n){return n.replaceAll("~","~0").replaceAll("/","~1")}function Jie(n){let e=n,t=[];for(let[c,l]of Object.entries(e.ambient?.templates??{}))if(e.prefabs[l]===void 0){let u=ss(l,Object.keys(e.prefabs));t.push({path:`/ambient/templates/${Io(c)}`,code:"unknown_prefab",message:`ambient ${c} template references unknown prefab "${l}"`,...u!==void 0?{hint:`did you mean "${u}"?`}:{},docsRef:"schemas/scene.md"})}let i=e.ambient?.radius,r=e.ambient?.despawnRadius;i!==void 0&&r!==void 0&&r<=i&&t.push({path:"/ambient/despawnRadius",code:"invalid_ambient",message:`ambient despawnRadius (${r}) must exceed radius (${i})`,docsRef:"schemas/scene.md"}),e.camera?.mode==="follow"&&e.camera.offset?.every((c,l)=>c===e.camera?.lookOffset?.[l])&&t.push({path:"/camera/lookOffset",code:"invalid_camera",message:"follow camera offset and lookOffset must differ"});let s=Object.keys(e.prefabs);for(let[c,l]of Object.entries(e.prefabs))if(l.extends!==void 0&&e.prefabs[l.extends]===void 0){let u=ss(l.extends,s);t.push({path:`/prefabs/${Io(c)}/extends`,code:"unknown_prefab",message:`prefab "${c}" extends unknown prefab "${l.extends}"`,expected:`one of: ${s.join(", ")}`,...u!==void 0?{hint:`did you mean "${u}"?`}:{},docsRef:"schemas/scene.md"})}for(let c of s){let l=[],u=c;for(;u!==void 0&&e.prefabs[u]!==void 0;){if(l.includes(u)){u===c&&t.push({path:`/prefabs/${Io(c)}/extends`,code:"prefab_extends_cycle",message:`extends cycle: ${[...l,u].join(" \u2192 ")}`,docsRef:"schemas/scene.md"});break}l.push(u),u=e.prefabs[u]?.extends}}e.entities.forEach((c,l)=>{if(c.prefab!==void 0&&e.prefabs[c.prefab]===void 0){let u=ss(c.prefab,s);t.push({path:`/entities/${l}/prefab`,code:"unknown_prefab",message:`entity references unknown prefab "${c.prefab}"`,expected:`one of: ${s.join(", ")}`,...u!==void 0?{hint:`did you mean "${u}"?`}:{},docsRef:"schemas/scene.md"})}});for(let[c,l]of Object.entries(e.commands)){if(l.payload===void 0)continue;let u=zk(l.payload,`/commands/${Io(c)}/payload`);if(u.length>0){for(let{pointer:d,pattern:h,reason:f}of u)t.push({path:d,code:"unsafe_payload_pattern",message:`command "${c}" declares a pattern that ${f}`,received:JSON.stringify(h),hint:"flatten the repetition (one quantifier per group), or drop the pattern and check the value in the command handler",docsRef:"schemas/scene.md"});continue}try{Dne(l.payload)}catch(d){t.push({path:`/commands/${Io(c)}/payload`,code:"invalid_payload_schema",message:`command "${c}" payload schema is not supported: ${d instanceof Error?d.message:String(d)}`,hint:"use the JSON Schema subset: type object/array/number/integer/string/boolean, properties, required, additionalProperties, items, enum, const, min*/max*",docsRef:"schemas/scene.md"})}}e.physics?.character===!0&&["rapier","platformer"].includes(e.physics.engine)&&t.push({path:"/physics/character",code:"character_engine_conflict",message:"physics.character installs the kernel character controller, which conflicts with the selected engine (rapier/platformer own their movement)",hint:'remove "character": true, or switch engine to "kinematics"',docsRef:"schemas/scene.md"});let o=new Set;e.scripts.forEach((c,l)=>{o.has(c.id)&&t.push({path:`/scripts/${l}/id`,code:"duplicate_script_id",message:`duplicate script id "${c.id}"`,docsRef:"schemas/scene.md"}),o.add(c.id);let u=[c.code!==void 0,c.path!==void 0].filter(Boolean).length;u!==1&&t.push({path:`/scripts/${l}`,code:u===0?"script_source_missing":"script_source_ambiguous",message:`script "${c.id}" must have exactly one of "code" (inline JS) or "path" (file ref)`,hint:`inline: { "code": "molen.on('tick', \u2026)" } \xB7 file: { "path": "scripts/spin.js" }`,docsRef:"schemas/scene.md"})});let a=new Set;if(e.entities.forEach((c,l)=>{c.id!==void 0&&(a.has(c.id)&&t.push({path:`/entities/${l}/id`,code:"duplicate_entity_id",message:`duplicate authored entity id "${c.id}"`,docsRef:"schemas/scene.md"}),a.add(c.id))}),e.input!==void 0){let c=[[void 0,e.input],...Object.entries(e.input.profiles??{})],l=new Set;for(let[d,h]of c){for(let f of Object.values(h.bindings))l.add(f);for(let f of[...h.axes??[],...h.buttons??[]])l.add(f.action);for(let f of u5(h))t.push({path:`${d===void 0?"/input":`/input/profiles/${d}`}/axes/${f.axis}`,code:"invalid_axis_calibration",message:f.message,docsRef:"guide/input.md"})}e.input.profile!==void 0&&!Object.hasOwn(e.input.profiles??{},e.input.profile)&&t.push({path:"/input/profile",code:"unknown_input_profile",message:`Unknown input profile "${e.input.profile}".`,docsRef:"guide/input.md"});let u=Object.keys(e.commands);e.input.emit.forEach((d,h)=>{if(d.command!==void 0&&e.commands[d.command]===void 0){let p=ss(d.command,u);t.push({path:`/input/emit/${h}/command`,code:"undeclared_command",message:`emit rule sends command "${d.command}" which the scene does not declare`,expected:`one of: ${u.join(", ")}`,hint:p!==void 0?`did you mean "${p}"?`:`add "${d.command}" under "commands" (payload schema is optional)`,docsRef:"schemas/scene.md"})}let f=d.kind==="axis2d"?["xNeg","xPos","yNeg","yPos"].map(p=>d[p]):d.kind==="axis"&&d.negative!==void 0?[d.action,d.negative]:[d.action];for(let p of f)l.has(p)||t.push({path:`/input/emit/${h}`,code:"unknown_input_action",message:`emit rule references action "${p}" which no binding produces`,expected:`one of: ${[...l].join(", ")}`,docsRef:"schemas/scene.md"})})}return t}Xn("scene",Vie,{id:"molen/scene@3",title:"Scene manifest",description:"Root document an experience boots from; instantiates into ECS state at tick 0.",examples:[{format:"molen/scene@3",name:"demo",seed:"demo-1",tickRate:30,prefabs:{cube:{components:{transform:{pos:[0,0,0],rot:[0,0,0,1]},spin:{axis:[0,1,0],radPerTick:.05}}}},entities:[{id:"cube-1",prefab:"cube"}],components:{spin:{description:"Continuous rotation about an axis, applied by the spin script.",examples:[{axis:[0,1,0],radPerTick:.05}]}},commands:{move:{doc:"Set the planar move direction [x, z] (-1..1 per axis).",payload:{type:"object",properties:{dir:{type:"array",items:{type:"number"},minItems:2,maxItems:2}},required:["dir"],additionalProperties:!1}}},scripts:[{id:"control",code:"molen.onCommand('move', (p) => molen.patch('cube-1', 'transform', { pos: [p.dir[0], 0, p.dir[1]] }));"}],camera:{mode:"fixed",position:[0,6,16],lookAt:[0,0,0]},input:{bindings:{KeyW:"up",KeyS:"down",KeyA:"left",KeyD:"right"},emit:[{kind:"axis2d",xNeg:"left",xPos:"right",yNeg:"up",yPos:"down",command:"move",field:"dir"}]}}],docsRef:"schemas/scene.md",validate:Jie});Xn("prefab",d5,{id:"molen/prefab@1",title:"Prefab",description:"Declarative entity template: component name to pure-JSON component data.",examples:[{format:"molen/prefab@1",components:{transform:{pos:[0,0,0],rot:[0,0,0,1]},health:{hp:10}}}],docsRef:"schemas/prefab.md"});var Yie=m.strictObject({doc:m.string().describe("Human/agent description of the type.").optional(),extends:xS.describe("Parent type id whose components this type inherits (deep-merged).").optional(),components:hm.describe("Default component map for entities of this type (a partial when extends is set).").default({}),assets:m.array(pS).describe("Project asset ids this type references (e.g. its gltf model).").default([]),scripts:m.array(p5).describe("Deterministic type behavior, installed once per world with config.type set to this type id.").default([])}),ere=m.strictObject({format:m.literal("molen/types@1").describe("Format envelope; always 'molen/types@1'."),namespace:Kk.describe("Namespace every type id in this file lives under (dotted lower_snake, e.g. 'train')."),owner:m.string().min(1).describe("Owning agent or package label, e.g. 'agent:layout'.").optional(),doc:m.string().describe("Human/agent description of this type collection.").optional(),types:m.record(xS,Yie).describe("Type id to definition; every id must start with '<namespace>.'.").default({})});function tre(n){let e=n,t=[];for(let i of Object.keys(e.types))i.startsWith(`${e.namespace}.`)||t.push({path:`/types/${i.replaceAll("~","~0").replaceAll("/","~1")}`,code:"type_outside_namespace",message:`type id "${i}" is outside this file's namespace "${e.namespace}"`,expected:`an id starting with "${e.namespace}."`,docsRef:"schemas/types.md"});for(let[i,r]of Object.entries(e.types)){let s=new Set;r.scripts.forEach((o,a)=>{s.has(o.id)&&t.push({path:`/types/${Io(i)}/scripts/${a}/id`,code:"duplicate_script_id",message:`duplicate type script id "${o.id}"`}),s.add(o.id),o.code===void 0==(o.path===void 0)&&t.push({path:`/types/${Io(i)}/scripts/${a}`,code:"script_source",message:'type script requires exactly one of "code" or "path"'})})}for(let i of Object.keys(e.types)){let r=[],s=i;for(;s!==void 0&&e.types[s]!==void 0;){if(r.includes(s)){s===i&&t.push({path:`/types/${i.replaceAll("~","~0").replaceAll("/","~1")}/extends`,code:"type_extends_cycle",message:`extends cycle: ${[...r,s].join(" \u2192 ")}`,docsRef:"schemas/types.md"});break}r.push(s),s=e.types[s]?.extends}}return t}Xn("types",ere,{id:"molen/types@1",title:"Entity type registry",description:"Namespaced entity types with doc strings, default components, inheritance, and asset refs. Scenes instantiate them; reservations in project.json partition the id space between agents.",examples:[{format:"molen/types@1",namespace:"train",owner:"agent:layout",types:{"train.car":{doc:"A generic rail vehicle.",components:{transform:{pos:[0,0,0],rot:[0,0,0,1]},renderable:{kind:"primitive",ref:"box",materialRef:"palette:#8a5a2b"}}},"train.locomotive":{doc:"Powered engine at the head of a consist.",extends:"train.car",components:{renderable:{materialRef:"palette:#2b2b2b"}}}}}],docsRef:"schemas/types.md",validate:tre});var nre=m.strictObject({namespace:Kk.describe("Reserved namespace (covers all of its sub-namespaces)."),owner:m.string().min(1).describe("Owner label holding the reservation, e.g. an agent id."),note:m.string().describe("Free-form note about the reservation.").optional()}),ire=m.strictObject({format:m.literal("molen/project@1").describe("Format envelope; always 'molen/project@1'."),name:m.string().min(1).describe("Project name."),engine:m.string().min(1).describe("Engine version the project targets.").optional(),scenes:m.record(m.string().regex(/^[a-z][a-z0-9_-]*$/),cc).describe("Scene name (lower-kebab) to project-relative scene file path.").default({}),defaultScene:m.string().describe("Key of `scenes` opened when none is named.").optional(),types:m.array(cc).describe("Project-relative paths of molen/types@1 documents to load.").default([]),assets:m.record(pS,cc).describe("Asset id to project-relative path of its molen/asset@1 sidecar (asset.json).").default({}),reservations:m.array(nre).describe("Namespace reservations partitioning the type-id space between owners.").default([]),setup:cc.describe("Project-relative path of the setup module (setup.mjs) exporting setup(world, manifest).").optional(),packs:m.array(m.strictObject({id:Kk.describe("Pack id (the pack manifest's id)."),source:m.union([m.string().min(1).regex(/^(?![A-Za-z]:|[/\\])(?!.*\\).+$/),m.string().regex(/^https?:\/\/\S+$/)]).describe("Pack file or source directory relative to project.json (it may be outside the project), or an http(s) URL."),contentHash:m.string().regex(/^sha256:[0-9a-f]{64}$/).describe("Expected pack contentHash; loading fails when the pack's differs.").optional()})).describe("Content packs the project loads, in order. When two packs provide the same id, the later one wins.").default([]),components:m.record(f5,h5).describe("Custom component vocabulary shared by every scene in the project.").default({}),codegen:m.strictObject({out:cc.describe("Project-relative output path for generated TypeScript types.").default("gen/molen-types.ts")}).describe("Code generation settings (molen codegen).").default({out:"gen/molen-types.ts"})});function rre(n){let e=n,t=[];e.defaultScene!==void 0&&e.scenes[e.defaultScene]===void 0&&t.push({path:"/defaultScene",code:"unknown_default_scene",message:`defaultScene "${e.defaultScene}" is not a key of scenes`,expected:`one of: ${Object.keys(e.scenes).join(", ")}`,docsRef:"schemas/project.md"});let i=(r,s)=>r===s||s.startsWith(`${r}.`);return e.reservations.forEach((r,s)=>{for(let o=0;o<s;o++){let a=e.reservations[o];a.owner!==r.owner&&(i(a.namespace,r.namespace)||i(r.namespace,a.namespace))&&t.push({path:`/reservations/${s}`,code:"reservation_overlap",message:`namespace "${r.namespace}" (${r.owner}) overlaps "${a.namespace}" held by ${a.owner}`,docsRef:"schemas/project.md"})}}),t}Xn("project",ire,{id:"molen/project@1",title:"Project manifest",description:"Binds an experience project together: scenes by name, type-registry documents, imported assets, namespace reservations, and the default setup module.",examples:[{format:"molen/project@1",name:"rail-yard",scenes:{main:"scenes/main.scene.json"},defaultScene:"main",types:["types/train.types.json"],assets:{"train.boxcar_mesh":"assets/boxcar/asset.json"},reservations:[{namespace:"train",owner:"agent:layout"}],setup:"setup.mjs",codegen:{out:"gen/molen-types.ts"}}],docsRef:"schemas/project.md",validate:rre});Xn("keyframe",m5,{id:"molen/keyframe@1",title:"Keyframe snapshot",description:"Complete world state at a tick: the save-file format, replay seek index, and snapshot-viewer input.",examples:[Zie],docsRef:"schemas/keyframe.md"});Xn("delta",jie,{id:"molen/delta@1",title:"Per-tick delta",description:"Dirty-tracked changes since the previous tick, whole-component granularity.",examples:[{kind:"delta",v:1,tick:121,baseTick:120,spawned:{},destroyed:[],changed:{player:{transform:{pos:[.1,1,0],rot:[0,0,0,1]}}},removedComponents:{},events:[]}],docsRef:"schemas/delta.md"});Xn("replay",Wie,{id:"molen/replay@1",title:"Replay fixture",description:"Initial state plus command log; determinism regenerates everything else. Used by test:replay.",examples:[{format:"molen/replay@1",engine:"0.0.1",scene:"scenes/demo.scene.json",seed:"demo-1",ticks:300,commands:[{kind:"command",seq:1,source:"local",tick:45,tickExecuted:46,type:"spawn_cube",payload:{}}],expected:{stateHash:"sha256:0000",eventCount:0}}],docsRef:"schemas/replay.md"});Xn("assert",Xie,{id:"molen/assert@1",title:"Assertion document",description:"Declarative world-state and event assertions evaluated after a headless run.",examples:[{format:"molen/assert@1",assertions:[{select:"has:transform",op:"count",value:2},{select:"#player .health.hp",op:"gte",value:1},{event:"player_died",op:"never"}]}],docsRef:"schemas/assert.md"});function sre(n,e,t){if(e===null||typeof e!="object")return[];let i=e,r=[],s=(o,a,c)=>{r.push(...Kne(o,a,c===!0?{...t,partial:!0}:t))};switch(n){case"scene":{let o=e;if(t?.types!==void 0){let c=Nie(o,t.types.keys());if(c.length>0){r.push(...c);break}}let a=(c,l)=>{try{s(c(),l)}catch(u){let d=u instanceof Error?u.message:String(u);if(t?.types===void 0&&d.includes("unknown type"))return;r.push({path:l,code:"component_resolution",message:d})}};for(let c of Object.keys(o.prefabs))a(()=>Qk(o,c,t),`/prefabs/${Io(c)}/components`);o.entities.forEach((c,l)=>{a(()=>Bie(o,c,t),`/entities/${l}/components`)});break}case"prefab":s(i.components,"/components");break;case"types":{let o=i.types??{};for(let[a,c]of Object.entries(o))c?.extends===void 0&&s(c?.components,`/types/${Io(a)}/components`);break}case"keyframe":{let o=i.entities??{};for(let[a,c]of Object.entries(o))s(c,`/entities/${Io(a)}`);break}case"delta":{let o=i.spawned??{};for(let[c,l]of Object.entries(o))s(l,`/spawned/${Io(c)}`);let a=i.changed??{};for(let[c,l]of Object.entries(a))s(l,`/changed/${Io(c)}`);break}default:break}return r}function _S(n,e,t){let i=ll(n);if(i===void 0){let l=zte(),u=ss(n,l),d={path:"",code:"unknown_schema_kind",message:`unknown schema kind "${n}"`,expected:`one of: ${l.join(", ")}`,...u!==void 0?{hint:`did you mean "${u}"?`}:{}};return{ok:!1,issues:[d],formatted:r0(`document (kind "${n}")`,[d])}}let r=e!==null&&typeof e=="object"?e.format:void 0,s=typeof r=="string"&&r!==i.meta.id?$te(n,r):void 0,o=s?.zod??i.zod,a=o.safeParse(e);if(a.success){let l=a.data;if(s!==void 0){let p=s.upgrade(a.data),g=i.zod.safeParse(p);if(!g.success){let b=kk(g.error,p,i.zod);if(i.meta.docsRef!==void 0)for(let A of b)A.docsRef??=i.meta.docsRef;return{ok:!1,issues:b,formatted:r0(t?.label??Bk(n,e),b)}}l=g.data}let u=jne(n==="scene"||n==="project"?l.components??{}:{},{base:t?.registry,owner:n}),d=[...u.issues,...sre(n,l,{...t,registry:u.registry}),...i.meta.validate?.(l)??[]],h=Ine(d),f=Cne(d);return s!==void 0&&f.push({path:"/format",code:"deprecated_format",message:`"${s.id}" is a previous version of this format`,expected:i.meta.id,hint:`rewrite the document as ${i.meta.id}`,...i.meta.docsRef!==void 0?{docsRef:i.meta.docsRef}:{},severity:"notice"}),h.length===0?f.length===0?{ok:!0,value:l}:{ok:!0,value:l,notices:f}:{ok:!1,issues:h,formatted:r0(t?.label??Bk(n,e),h)}}let c=kk(a.error,e,o);if(i.meta.docsRef!==void 0)for(let l of c)l.docsRef===void 0&&(l.docsRef=i.meta.docsRef);return{ok:!1,issues:c,formatted:r0(t?.label??Bk(n,e),c)}}function Bk(n,e){if(e!==null&&typeof e=="object"){let t=e.name;if(typeof t=="string"&&t.length>0)return`${n} "${t}"`}return n}function ore(n,e){let t=n.args.map(u=>typeof u=="number"?u:Object.hasOwn(e,u)?e[u]:void 0),[i,r,s]=t;if(n.op==="if")return i===void 0?void 0:i!==0?r:s;if(n.op==="coalesce")return t.find(u=>u!==void 0);if(t.some(u=>u===void 0))return;let o=t,a=i,c=r,l=s;switch(n.op){case"add":return o.reduce((u,d)=>u+d,0);case"subtract":return a-c;case"multiply":return o.reduce((u,d)=>u*d,1);case"divide":return c===0?void 0:a/c;case"min":return Math.min(...o);case"max":return Math.max(...o);case"clamp":return c>l?void 0:Math.max(c,Math.min(l,a));case"abs":return Math.abs(a);case"sqrt":return a<0?void 0:Math.sqrt(a);case"floor":return Math.floor(a);case"modulo":return c<=0?void 0:(a%c+c)%c;case"sin":return Math.sin(a);case"cos":return Math.cos(a);case"atan2":return Math.atan2(a,c);case"less":return+(a<c);case"greater":return+(a>c);case"equal":return+(a===c);case"and":return Number(o.every(u=>u!==0));case"or":return Number(o.some(u=>u!==0));case"not":return+(a===0)}}function are(n){let e=d0.parse(n??{}),t=[],i=new Set,r=s=>{if(i.has(s))return;i.add(s);let o=e[s];if(o){for(let a of o.args)typeof a=="string"&&Object.hasOwn(e,a)&&r(a);t.push([s,o])}};for(let s of Object.keys(e))r(s);return s=>{let o=Object.create(null);for(let[a,c]of Object.entries(s))typeof c=="number"&&Number.isFinite(c)&&(o[a]=c);for(let[a,c]of t){let l=ore(c,o);o[a]=l!==void 0&&Number.isFinite(l)?l:void 0}return o}}function g5(n,e){let t=Object.create(null);for(let[i,r]of Object.entries(n??{})){t[i]=void 0,t[i]=void 0;let s=e(r.component);for(let o of r.path){if(s===null||typeof s!="object"||!Object.hasOwn(s,o)){s=void 0;break}s=s[o]}typeof s=="boolean"?t[i]=Number(s):typeof s=="number"&&Number.isFinite(s)&&(t[i]=s)}return t}function cre(n,e){let t=n.keys;if(t===void 0)return e*(n.scale??1)+(n.offset??0);let i=t[0],r=t[t.length-1];if(i===void 0||r===void 0)return 0;if(e<=i[0])return i[1];if(e>=r[0])return r[1];let s=1;for(;s<t.length-1&&e>(t[s]?.[0]??1/0);)s++;let[o,a]=t[s-1]??i,[c,l]=t[s]??r,u=(e-o)/(c-o);return n.ease==="smooth"&&(u=u*u*(3-2*u)),a+(l-a)*u}function A5(n,e){let t=are(e.derived),i=[],r=new Map;n.traverse(a=>{let c=r.get(a.name)??[];c.push(a),r.set(a.name,c)});let s=[...new Set(e.bindings.map(a=>a.node))].filter(a=>!r.has(a)),o=e.bindings.flatMap(a=>(r.get(a.node)??[]).map(c=>(c.matrixAutoUpdate=!0,{binding:a,node:c,rest:a.property==="visible"?Number(c.visible):c[a.property][a.axis??"z"],current:void 0,time:void 0})));return{missingNodes:s,get missingSignals(){return i},update(a,c){let l=t(a),u=new Set,d=c!==void 0&&Number.isFinite(c)?c:void 0;for(let h of o){let{binding:f,node:p,rest:g}=h,b=_=>{f.property==="visible"?p.visible=_>0:p[f.property][f.axis??"z"]=_},A=l[f.source],y=A===void 0?NaN:cre(f,A);if(!Number.isFinite(y)){u.add(f.source),h.time=void 0,f.missing==="rest"||f.missing==="hide"?(b(f.missing==="hide"?0:g),h.current=void 0):b(h.current===void 0?g:f.property==="visible"?h.current:g+h.current);continue}let v=Math.max(f.min??-1/0,Math.min(f.max??1/0,y)),x=f.period,w=_=>x===void 0?_:(_%x+x)%x;if(v=w(v),f.responseSeconds&&d!==void 0&&h.time!==void 0&&d>=h.time&&h.current!==void 0){let _=v-h.current;x!==void 0&&(_=((_+x/2)%x+x)%x-x/2),v=w(h.current+_*-Math.expm1(-(d-h.time)/f.responseSeconds))}h.current=v,h.time=d,b(f.property==="visible"?v:g+v)}i=[...u]},reset(){for(let a of o){let{binding:c,node:l,rest:u}=a;c.property==="visible"?l.visible=u>0:l[c.property][c.axis??"z"]=u,a.current=a.time=void 0}i=[]}}}ms();function xd(n){let e=Math.imul(n+1,73244475);return e=Math.imul(e^e>>>16,73244475),((e^e>>>16)>>>0)/4294967296}function Vue(n,e){let t=[],i=[];for(let r=0;r<=4;r++){let s=[];for(let o=0;o<20;o++){let a=(o+(xd(o+101)-.5)*.5)*Math.PI*2/20,c=Math.cos(a),l=Math.sin(a),u=Math.abs(c)<1e-9?1/0:(Math.sign(c)*n.size[0]/2-e[0])/c,d=Math.abs(l)<1e-9?1/0:(Math.sign(l)*n.size[1]/2-e[1])/l,h=Math.min(u,d)*(r===0?0:r===4?1:(r+(xd(o+r*31)-.5)*.5)/4);s.push(new C(e[0]+c*h,e[1]+l*h,.003))}i.push(s)}for(let r=1;r<=4;r++)for(let s=0;s<20;s++){let o=i[r-1]?.[s],a=i[r]?.[s];t.push(...o.toArray(),...a.toArray()),r<4&&t.push(...a.toArray(),...(i[r]?.[(s+1)%20]).toArray())}return t}function Hue(n){let e=n.material==="annealed"?4:12,t=n.material==="annealed"?3:8,i=[];for(let c=0;c<=t;c++)for(let l=0;l<=e;l++){let u=c*(e+1)+l;i.push(new C(((l+(l>0&&l<e?(xd(u)-.5)*.6:0))/e-.5)*n.size[0],((c+(c>0&&c<t?(xd(u+901)-.5)*.6:0))/t-.5)*n.size[1],0))}let r=[],s=[],o=[];for(let c=0;c<t;c++)for(let l=0;l<e;l++){let u=i[c*(e+1)+l],d=i[c*(e+1)+l+1],h=i[(c+1)*(e+1)+l+1],f=i[(c+1)*(e+1)+l];for(let p of[u,d,h,u,h,f])r.push(p.x,p.y,p.z);o.push(u.clone().add(d).add(h).add(f).multiplyScalar(.25));for(let[p,g]of[[u,d],[d,h],[h,f],[f,u]])s.push(p.x,p.y,.003,g.x,g.y,.003)}let a=new Ke;return a.setAttribute("position",new Me(r,3)),a.computeVertexNormals(),{geometry:a,centers:o,edges:s}}function fH(n,e){let t=[],i=new Set,r=e.surfaces.map(g=>{let b=[];for(let A of g.nodes??[]){let y=[];n.traverse(v=>{v!==n&&(v.userData.name??v.name)===A&&y.push(v)}),y.length===0&&t.push(A);for(let v of y)v.traverse(x=>{if(i.has(x))throw new Error(`Glass node '${A}' belongs to more than one pane.`);i.add(x)}),b.push(v)}return{spec:g,sources:b,visible:b.map(A=>A.visible)}}).map(({spec:g,sources:b,visible:A})=>{let y=new Pn;y.name=`glass:${g.id}`,n.add(y);let v=new ii({color:"#8baeb7",roughness:.18,metalness:.1,transparent:!0,opacity:.36,depthWrite:!1,side:ln}),{geometry:x,centers:w,edges:_}=Hue(g),E=new vt(x,v);E.name=`glass-pane:${g.id}`,y.add(E);let S=new Float32Array(x.getAttribute("position").array),M=new Ke;M.setAttribute("position",new Me(_,3));let I=new ui({color:"#e1f5f5",transparent:!0,opacity:.8,depthWrite:!1}),R=new pr(M,I);R.name=`glass-cracks:${g.id}`,y.add(R);let N=new Pn;N.name=`glass-sheet:${g.id}`,y.add(N),n.updateWorldMatrix(!0,!0);let P=new Oe().compose(new C().fromArray(g.center),new In().fromArray(g.rotation),new C(1,1,1)),U=P.clone().invert().multiply(n.matrixWorld.clone().invert());for(let F of b){let $=F.clone(!0);$.matrixAutoUpdate=!1,$.matrix.copy(U).multiply(F.matrixWorld),$.matrix.decompose($.position,$.quaternion,$.scale),$.visible=F.visible,N.add($)}return{spec:g,sources:b,visible:A,group:y,mesh:E,cracks:R,sheet:N,geometry:x,edgeGeometry:M,material:v,edgeMaterial:I,rest:S,centers:w,paneMatrix:P,crackPoint:"",fragmentAge:-1}}),s=new Oe,o=new Oe,a=new C,c=new In,l=new C(1,1,1),u=new C,d=new C,h=new In,f=!1,p=(g,b)=>{if(!f){n.updateMatrix(),s.copy(n.matrix).invert();for(let A of r){let{spec:y,group:v,geometry:x,mesh:w,cracks:_,sheet:E,sources:S}=A,M=g&&Object.hasOwn(g.surfaces,y.id)?g.surfaces[y.id]:void 0,I=M?.retained!==!1,R=M?.release,N=R?Math.max(0,b-R.time):0,P=M?.fracture==="shattered"&&y.material!=="laminated";v.visible=I||!!R&&N<8,v.matrixAutoUpdate=!1,v.matrix.copy(A.paneMatrix),!I&&R&&(a.fromArray(R.position).addScaledVector(new C().fromArray(R.velocity),N),a.y-=.5*9.81*N*N,c.fromArray(R.rotation),o.compose(a,c,l),v.matrix.copy(s).multiply(o)),v.matrixWorldNeedsUpdate=!0,v.matrix.decompose(v.position,v.quaternion,v.scale),S.forEach((J,re)=>{J.visible=I&&(A.visible[re]??!0)}),E.visible=!I&&!P&&S.length>0,w.visible=S.length===0||!I&&P,_.visible=M!==void 0&&M.fracture!=="intact"&&!P;let U=JSON.stringify(M?.point??[0,0]);y.material==="laminated"&&A.crackPoint!==U&&(A.edgeGeometry.setAttribute("position",new Me(Vue(y,M?.point??[0,0]),3)),A.edgeGeometry.computeBoundingSphere(),A.crackPoint=U),A.edgeGeometry.setDrawRange(0,Math.floor(A.edgeGeometry.getAttribute("position").count/2*(M?.damage??0))*2),A.material.opacity=I?.36:.65*Math.max(0,Math.min(1,8-N)),A.edgeMaterial.opacity=I?.8:.8*Math.max(0,Math.min(1,8-N));let F=x.getAttribute("position"),$=F.array,V=v.visible&&!I&&P?N:-1;if(A.fragmentAge!==V){if(A.fragmentAge=V,$.set(A.rest),v.visible&&!I&&P)for(let J=0;J<A.centers.length;J++){let re=A.centers[J],pe=R?.fragmentSpeed??0;d.set(xd(J+17)-.5,xd(J+101)-.5,xd(J+73)-.5).multiplyScalar(N*pe),h.setFromAxisAngle(new C(.4,.7,.2).normalize(),(xd(J+911)-.5)*N*pe*7);for(let ae=0;ae<6;ae++){let de=(J*6+ae)*3;u.fromArray(A.rest,de).sub(re).applyQuaternion(h).add(re).add(d),u.toArray($,de)}}F.needsUpdate=!0,x.computeVertexNormals(),x.computeBoundingSphere()}}}};return p(void 0,0),{missingNodes:t,update:p,dispose(){if(!f){f=!0;for(let g of r)g.sources.forEach((b,A)=>{b.visible=g.visible[A]??!0}),g.group.removeFromParent(),g.geometry.dispose(),g.edgeGeometry.dispose(),g.material.dispose(),g.edgeMaterial.dispose()}}}}ms();ms();var j1=class extends Ke{constructor(e=new vt,t=new C,i=new ir,r=new C(1,1,1)){super();let s=[],o=[],a=[],c=new C,l=new It().getNormalMatrix(e.matrixWorld),u=new Oe;u.makeRotationFromEuler(i),u.setPosition(t);let d=new Oe;d.copy(u).invert(),h(),this.setAttribute("position",new Me(s,3)),this.setAttribute("uv",new Me(a,2)),o.length>0&&this.setAttribute("normal",new Me(o,3));function h(){let b=[],A=new C,y=new C,v=e.geometry,x=v.attributes.position,w=v.attributes.normal;if(v.index!==null){let _=v.index;for(let E=0;E<_.count;E++)A.fromBufferAttribute(x,_.getX(E)),w?(y.fromBufferAttribute(w,_.getX(E)),f(b,A,y)):f(b,A)}else{if(x===void 0)return;for(let _=0;_<x.count;_++)A.fromBufferAttribute(x,_),w?(y.fromBufferAttribute(w,_),f(b,A,y)):f(b,A)}b=p(b,c.set(1,0,0)),b=p(b,c.set(-1,0,0)),b=p(b,c.set(0,1,0)),b=p(b,c.set(0,-1,0)),b=p(b,c.set(0,0,1)),b=p(b,c.set(0,0,-1));for(let _=0;_<b.length;_++){let E=b[_];a.push(.5+E.position.x/r.x,.5+E.position.y/r.y),E.position.applyMatrix4(u),s.push(E.position.x,E.position.y,E.position.z),E.normal!==null&&o.push(E.normal.x,E.normal.y,E.normal.z)}}function f(b,A,y=null){A.applyMatrix4(e.matrixWorld),A.applyMatrix4(d),y?(y.applyNormalMatrix(l),b.push(new Ky(A.clone(),y.clone()))):b.push(new Ky(A.clone()))}function p(b,A){let y=[],v=.5*Math.abs(r.dot(A));for(let x=0;x<b.length;x+=3){let w=0,_,E,S,M,I=b[x+0].position.dot(A)-v,R=b[x+1].position.dot(A)-v,N=b[x+2].position.dot(A)-v,P=I>0,U=R>0,F=N>0;switch(w=(P?1:0)+(U?1:0)+(F?1:0),w){case 0:{y.push(b[x]),y.push(b[x+1]),y.push(b[x+2]);break}case 1:{if(P&&(_=b[x+1],E=b[x+2],S=g(b[x],_,A,v),M=g(b[x],E,A,v)),U){_=b[x],E=b[x+2],S=g(b[x+1],_,A,v),M=g(b[x+1],E,A,v),y.push(S),y.push(E.clone()),y.push(_.clone()),y.push(E.clone()),y.push(S.clone()),y.push(M);break}F&&(_=b[x],E=b[x+1],S=g(b[x+2],_,A,v),M=g(b[x+2],E,A,v)),y.push(_.clone()),y.push(E.clone()),y.push(S),y.push(M),y.push(S.clone()),y.push(E.clone());break}case 2:{P||(_=b[x].clone(),E=g(_,b[x+1],A,v),S=g(_,b[x+2],A,v),y.push(_),y.push(E),y.push(S)),U||(_=b[x+1].clone(),E=g(_,b[x+2],A,v),S=g(_,b[x],A,v),y.push(_),y.push(E),y.push(S)),F||(_=b[x+2].clone(),E=g(_,b[x],A,v),S=g(_,b[x+1],A,v),y.push(_),y.push(E),y.push(S));break}case 3:break}}return y}function g(b,A,y,v){let x=b.position.dot(y)-v,w=A.position.dot(y)-v,_=x/(x-w),E=new C(b.position.x+_*(A.position.x-b.position.x),b.position.y+_*(A.position.y-b.position.y),b.position.z+_*(A.position.z-b.position.z)),S=null;return b.normal!==null&&A.normal!==null&&(S=new C(b.normal.x+_*(A.normal.x-b.normal.x),b.normal.y+_*(A.normal.y-b.normal.y),b.normal.z+_*(A.normal.z-b.normal.z))),new Ky(E,S)}}},Ky=class{constructor(e,t=null){this.position=e,this.normal=t}clone(){let e=this.position.clone(),t=this.normal!==null?this.normal.clone():null;return new this.constructor(e,t)}};function jue(n,e,t){let i=!1;for(let r=0,s=t.length-1;r<t.length;s=r++){let o=t[r],a=t[s];o[1]>e!=a[1]>e&&n<(a[0]-o[0])*(e-o[1])/(a[1]-o[1])+o[0]&&(i=!i)}return i}function gH(n,e){let t=new wn(n,e,e);return t.colorSpace=rn,t.magFilter=ot,t.minFilter=mn,t.generateMipmaps=!0,t.needsUpdate=!0,t}function AH(n,e=256){let t=new Uint8Array(e*e*4);for(let i of n.shapes){let r=Number.parseInt(i.color.slice(1),16),s=i.points.map(d=>d[0]),o=i.points.map(d=>d[1]),a=Math.max(0,Math.floor(Math.min(...s)*e)),c=Math.min(e,Math.ceil(Math.max(...s)*e)),l=Math.max(0,Math.floor(Math.min(...o)*e)),u=Math.min(e,Math.ceil(Math.max(...o)*e));for(let d=l;d<u;d++)for(let h=a;h<c;h++){if(!jue((h+.5)/e,(d+.5)/e,i.points))continue;let f=(d*e+h)*4;t[f]=r>>16&255,t[f+1]=r>>8&255,t[f+2]=r&255,t[f+3]=255}}return gH(t,e)}function Que(n,e){let i=new Uint8Array(65536),r=(o,a)=>{let c=Math.imul((o&7)+31*(a&7),374761393)^n.seed;return c=Math.imul(c^c>>>13,1274126177),((c^c>>>16)>>>0)/4294967296};for(let o=0;o<128;o++)for(let a=0;a<128;a++){let c=a*8/128,l=o*8/128,u=Math.floor(c),d=Math.floor(l),h=c-u,f=l-d;h=h*h*(3-2*h),f=f*f*(3-2*f);let p=Ga.lerp(Ga.lerp(r(u,d),r(u+1,d),h),Ga.lerp(r(u,d+1),r(u+1,d+1),h),f),g=n.colors[Math.min(n.colors.length-1,Math.floor(p*n.colors.length))],b=Number.parseInt(g.slice(1),16),A=(o*128+a)*4;i[A]=b>>16&255,i[A+1]=b>>8&255,i[A+2]=b&255,i[A+3]=255}let s=gH(i,128);return s.wrapS=s.wrapT=jn,s.channel=e,s.repeat.setScalar(n.scale),s}var Xy=n=>Array.isArray(n.material)?n.material:[n.material],pH=new WeakMap;function mH(n,e){let t=n.geometry.index?n.geometry.toNonIndexed():n.geometry.clone(),i=Xy(n),r=Array.isArray(n.material)?t.groups:[{start:0,count:t.getAttribute("position").count,materialIndex:0}],s=[],o=[],a=t.getAttribute("position"),c=t.getAttribute("normal");for(let u of r)if(e.has(i[u.materialIndex??0]?.name??""))for(let d=u.start;d<Math.min(a.count,u.start+u.count);d++)s.push(a.getX(d),a.getY(d),a.getZ(d)),c&&o.push(c.getX(d),c.getY(d),c.getZ(d));t.dispose();let l=new Ke;return l.setAttribute("position",new Me(s,3)),o.length?l.setAttribute("normal",new Me(o,3)):l.computeVertexNormals(),l}function Wue(n,e,t,i,r){let s=n.geometry.index?n.geometry.toNonIndexed():n.geometry.clone(),o=r===0?"uv":`uv${r}`,a=s.getAttribute("position"),c=s.getAttribute(o)?Float32Array.from(s.getAttribute(o).array):new Float32Array(a.count*2),l=new Uint8Array(a.count);if(!Array.isArray(n.material))l.fill(1);else for(let g of s.groups)i.includes(n.material[g.materialIndex??0]?.name??"")&&l.fill(1,g.start,Math.min(a.count,g.start+g.count));let u=e.getSize(new C),d=Math.max(u.x,u.y,u.z,.001),h=new C,f=new C,p=new C;for(let g=0;g<a.count;g+=3){if(!l[g])continue;h.fromBufferAttribute(a,g).applyMatrix4(t),f.fromBufferAttribute(a,g+1).applyMatrix4(t),p.fromBufferAttribute(a,g+2).applyMatrix4(t);let b=f.clone().sub(h).cross(p.clone().sub(h)),A=Math.abs(b.y)>=Math.max(Math.abs(b.x),Math.abs(b.z))?"y":Math.abs(b.x)>Math.abs(b.z)?"x":"z";for(let[y,v]of[h,f,p].entries())c[(g+y)*2]=((A==="x"?v.z:v.x)-(A==="x"?e.min.z:e.min.x))/d,c[(g+y)*2+1]=((A==="y"?v.z:v.y)-(A==="y"?e.min.z:e.min.y))/d}return s.setAttribute(o,new ut(c,2)),s}function bH(n,e){let t=e.variants.find(y=>y.id===e.selected);if(!t)throw new Error(`Unknown livery: ${e.selected}`);let i=[],r=new Map,s=new Set,o=new Set,a=new Set,c=[],l=y=>{r.has(y)||r.set(y,{material:y.material,geometry:y.geometry})};n.updateWorldMatrix(!0,!0);let u=n.matrixWorld.clone().invert(),d=pH.get(n);d||(d=new Map,n.traverse(y=>{y instanceof vt&&d?.set(y,u.clone().multiply(y.matrixWorld))}),pH.set(n,d));let h=y=>(d?.get(y)??u.clone().multiply(y.matrixWorld)).clone(),f=new Map;for(let[y,v]of Object.entries(e.slots)){let x=v.node===void 0?n:n.getObjectByName(v.node),w=[],_=new On,E=S=>{if(!(S instanceof vt)||w.includes(S)||!Xy(S).some(I=>v.materials.includes(I.name)))return;if(S.isSkinnedMesh||S.morphTargetInfluences?.length){i.push(`Slot ${y}: deforming mesh ${S.name} is unsupported`);return}w.push(S);let M=mH(S,new Set(v.materials));M.applyMatrix4(h(S)),M.computeBoundingBox(),M.boundingBox&&_.union(M.boundingBox),M.dispose()};x?.traverse(E),v.node!==void 0&&n.traverse(S=>{let M=S.userData.liverySourceNodes;Array.isArray(M)&&M.includes(v.node)&&E(S)}),(!w.length||_.isEmpty())&&i.push(`Slot ${y}: no matching surface`),f.set(y,{meshes:w,bounds:_,binding:v})}let p=new Map,g=new Set;n.traverse(y=>{if(y instanceof vt)for(let v of Xy(y))for(let x of Object.values(v))x instanceof Gt&&g.add(x.channel)});let b=[3,2,1,0].find(y=>!g.has(y));for(let[y,v]of Object.entries(t.paints)){let x=f.get(y);if(!x||x.bounds.isEmpty()){i.push(`Paint ${y}: missing slot`);continue}let w=new Map;v.camouflage&&b===void 0&&i.push(`Paint ${y}: no unused UV channel for camouflage; using the base color`);let _=v.camouflage&&b!==void 0?Que(v.camouflage,b):void 0;_&&a.add(_);for(let E of x.meshes){l(E);let S=p.get(E)??new Set;p.set(E,S);let M=Xy(E).map((I,R)=>{if(!x.binding.materials.includes(I.name))return I;if(S.has(R))return i.push(`Paint ${y}: overlapping slot on ${E.name}`),I;S.add(R);let N=w.get(I);return N||(N=I.clone(),w.set(I,N),s.add(N),"color"in N&&N.color.set(v.color),"roughness"in N&&v.roughness!==void 0&&(N.roughness=v.roughness),"metalness"in N&&v.metalness!==void 0&&(N.metalness=v.metalness),"map"in N&&(N.map=_??null),_&&"color"in N&&N.color.set("#ffffff"),N.needsUpdate=!0),N});E.material=Array.isArray(E.material)?M:M[0],_&&(E.geometry=Wue(E,x.bounds,h(E),x.binding.materials,_.channel),o.add(E.geometry))}}for(let y of t.markings??[]){let v=e.anchors?.[y.anchor],x=v&&f.get(v.slot);if(!v||!x||x.bounds.isEmpty()){i.push(`Marking ${y.anchor}: missing surface`);continue}let w=x.bounds.getSize(new C),_=new C(...v.position).multiply(w).add(x.bounds.min),E=new C(...v.size).multiplyScalar(Math.max(w.x,w.y,w.z)),S=new ir(...v.rotation),M=new C(0,0,1).applyEuler(S),I=AH(y.graphic);a.add(I);let R=new ii({map:I,transparent:!0,depthWrite:!1,roughness:.65,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});s.add(R);let N=0;for(let P of x.meshes){let U=mH(P,new Set(x.binding.materials)),F=h(P);U.applyMatrix4(F);let $=U.getAttribute("position"),V=U.getAttribute("normal"),J=[],re=Xy(P).some(de=>x.binding.materials.includes(de.name)&&de.side===ln);for(let de=0;de<$.count;de+=3){let Be=new C().fromBufferAttribute(V,de).dot(M);if(Be>.05)J.push(de,de+1,de+2);else if(re&&Be<-.05){J.push(de,de+2,de+1);for(let Ze=de;Ze<de+3;Ze++)V.setXYZ(Ze,-V.getX(Ze),-V.getY(Ze),-V.getZ(Ze))}}U.setIndex(J);let pe=new j1(new vt(U),_,S,E);if(U.dispose(),!pe.getAttribute("position").count){pe.dispose();continue}pe.applyMatrix4(F.invert()),o.add(pe);let ae=new vt(pe,R);ae.name=`livery:${y.anchor}`,ae.userData.liveryMarking=!0,ae.receiveShadow=!0,ae.renderOrder=1,P.add(ae),c.push(ae),N++}N||i.push(`Marking ${y.anchor}: projector misses its surface`)}let A=!1;return{warnings:i,dispose(){if(!A){A=!0;for(let y of c)y.removeFromParent();for(let[y,v]of r)y.material=v.material,y.geometry=v.geometry;for(let y of o)y.dispose();for(let y of s)y.dispose();for(let y of a)y.dispose()}}}}zF();VF();ms();function X1(n){let e=new Map,t=new Map,i=n.clone();return CH(n,i,function(r,s){e.set(s,r),t.set(r,s)}),i.traverse(function(r){if(!r.isSkinnedMesh)return;let s=r,o=e.get(r),a=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=a.map(function(c){return t.get(c)}),s.bind(s.skeleton,s.bindMatrix)}),i}function CH(n,e,t){t(n,e);for(let i=0;i<n.children.length;i++)CH(n.children[i],e.children[i],t)}function ude(n,e,t){let i=(n|0)*374761393+(e|0)*668265263+(t|0)*2147483647;return i=(i^i>>>13)>>>0,i=Math.imul(i,1274126177)>>>0,(i^i>>>16)>>>0}function If(n,e,t){return ude(n,e,t)/4294967296}function J1(n){return n*n*(3-2*n)}function qg(n,e,t){return n+(e-n)*t}function dde(n,e,t){let i=Math.floor(n),r=Math.floor(e),s=J1(n-i),o=J1(e-r),a=If(i,r,t),c=If(i+1,r,t),l=If(i,r+1,t),u=If(i+1,r+1,t);return qg(qg(a,c,s),qg(l,u,s),o)}function hde(n,e,t){let i=Math.floor(n),r=Math.floor(e),s=n-i,o=e-r,a=(u,d,h,f)=>{let p=If(u,d,t)*Math.PI*2;return Math.cos(p)*h+Math.sin(p)*f},c=J1(s),l=J1(o);return qg(qg(a(i,r,s,o),a(i+1,r,s-1,o),c),qg(a(i,r+1,s,o-1),a(i+1,r+1,s-1,o-1),c),l)*.5+.5}function fde(n,e,t,i,r,s,o){let a=1,c=1,l=0,u=0;for(let d=0;d<r;d++)l+=a*n(e*c,t*c,i+d*1013),u+=a,a*=o,c*=s;return u>0?l/u:0}function pde(n,e,t,i,r){let s=Math.floor(n),o=Math.floor(e),a=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY;for(let u=-1;u<=1;u++)for(let d=-1;d<=1;d++){let h=s+d,f=o+u,p=h+i*If(h,f,t),g=f+i*If(h,f,t+7919),b=p-n,A=g-e,y=Math.sqrt(b*b+A*A);y<a?(c=a,a=y):y<c&&(c=y)}let l=r==="f1"?a:r==="f2"?c:c-a;return Math.min(1,l)}var HF=8192,RH=16777216;function mde(n,e){if(!Number.isSafeInteger(n)||!Number.isSafeInteger(e)||n<1||e<1)throw new Error(`image dimensions must be positive safe integers, got ${n}x${e}`);if(n>HF||e>HF||n*e>RH)throw new Error(`image dimensions exceed the ${HF}px/${RH}-pixel limit`)}function OH(n,e){return mde(n,e),{width:n,height:e,data:new Uint8ClampedArray(n*e*4)}}var BH=256,NH=64;function ev(n){let e=n.slice(1);return[Number.parseInt(e.slice(0,2),16)/255,Number.parseInt(e.slice(2,4),16)/255,Number.parseInt(e.slice(4,6),16)/255,e.length>=8?Number.parseInt(e.slice(6,8),16)/255:1]}function tv(n){return n.t==="s"?n.v:n.t==="c"?(n.v[0]+n.v[1]+n.v[2])/3:n.v[0]}function QF(n){return n.t==="c"?n.v:n.t==="s"?[n.v,n.v,n.v,1]:[n.v[0],n.v[1],0,1]}function jF(n){return n.t==="uv"?n.v:n.t==="s"?[n.v,n.v]:[n.v[0],n.v[1]]}function Cc(n){return n<0?0:n>1?1:n}var kH=new Map([["const",["value"]],["uv",[]],["uv-transform",["scale","offset","rotateDeg"]],["noise",["kind","octaves","lacunarity","gain","scale","seedOffset"]],["worley",["scale","jitter","output"]],["gradient",["kind","angleDeg"]],["checker",["scale"]],["bricks",["rows","cols","mortarWidth","offset","output"]],["ramp",["stops"]],["blend",["mode","factor"]],["threshold",["edge","smoothness"]],["invert",[]],["levels",["inMin","inMax","gamma","outMin","outMax"]],["height-to-normal",["strength"]]]),wd="bake a validated document \u2014 validateByKind('matgraph', doc) applies the schema defaults";function WF(n){return typeof n=="number"?Number.isFinite(n):Array.isArray(n)?n.every(WF):typeof n=="object"&&n!==null?Object.values(n).every(WF):n!==void 0}function gde(n){let e=kH.get(n.type);if(e===void 0)throw new Error(`material graph node "${n.id}" has unknown type "${n.type}" \u2014 known types: ${[...kH.keys()].join(", ")}`);let t=n.params;if(e.length>0&&(t===null||typeof t!="object"))throw new Error(`material graph node "${n.id}" (${n.type}) has no params \u2014 ${wd}`);for(let i of e){let r=t[i];if(r===void 0)throw new Error(`material graph node "${n.id}" (${n.type}) is missing params.${i} \u2014 ${wd}`);if(!WF(r))throw new Error(`material graph node "${n.id}" (${n.type}) has a non-finite params.${i} \u2014 ${wd}`)}}function Ade(n,e){let t=n>>>0;for(let i=0;i<e.length;i++)t=Math.imul(t^e.charCodeAt(i),2654435761)+1>>>0;return t>>>0}var bde=class{doc;byId=new Map;seeds=new Map;memo=new Map;constructor(n){if(this.doc=n,!Array.isArray(n.nodes)||n.nodes.length<1||n.nodes.length>BH)throw new Error(`material graph must contain 1..${BH} nodes`);if(!Number.isFinite(n.seed))throw new Error(`material graph has a non-finite seed (${String(n.seed)}) \u2014 ${wd}`);if(n.outputs===null||typeof n.outputs!="object")throw new Error(`material graph has no outputs map \u2014 ${wd}`);for(let e of n.nodes)gde(e),this.byId.set(e.id,e),this.seeds.set(e.id,Ade(n.seed,e.id));this.detectCycles()}detectCycles(){let n=new Map,e=[],t=i=>{let r=n.get(i)??0;if(r===2)return;if(r===1){let o=[...e.slice(e.indexOf(i)),i].join(" \u2192 ");throw new Error(`material graph has a cycle: ${o}`)}if(n.set(i,1),e.push(i),e.length>NH)throw new Error(`material graph depth exceeds the limit of ${NH}`);let s=this.byId.get(i);if(s!==void 0)for(let o of this.depsOf(s))this.byId.has(o)&&t(o);e.pop(),n.set(i,2)};for(let i of this.doc.nodes)t(i.id)}depsOf(n){let e=[];return n.input!==void 0&&e.push(n.input),n.inputs!==void 0&&e.push(...Object.values(n.inputs)),e}input(n,e,t){let i=n.input??n.inputs?.a;if(i!==void 0)return this.eval(i,e,t)}beginSample(){this.memo.clear()}eval(n,e,t){let i=`${n}\0${e}\0${t}`,r=this.memo.get(i);if(r!==void 0)return r;let s=this.evalUncached(n,e,t);return this.memo.set(i,s),s}evalUncached(n,e,t){let i=this.byId.get(n);if(i===void 0)return{t:"s",v:0};let r=this.seeds.get(n)??0;switch(i.type){case"const":{let s=i.params.value;return typeof s=="number"?{t:"s",v:s}:{t:"c",v:s}}case"uv":return{t:"uv",v:[e,t]};case"uv-transform":{let s=this.input(i,e,t),[o,a]=s!==void 0?jF(s):[e,t],{scale:c,offset:l,rotateDeg:u}=i.params,d=u*Math.PI/180,h=o-.5,f=a-.5,p=h*Math.cos(d)-f*Math.sin(d),g=h*Math.sin(d)+f*Math.cos(d);return{t:"uv",v:[(p+.5)*c+l[0],(g+.5)*c+l[1]]}}case"noise":{let s=this.input(i,e,t),[o,a]=s!==void 0?jF(s):[e,t];return{t:"s",v:Cc(fde(i.params.kind==="value"?dde:hde,o*i.params.scale,a*i.params.scale,r+i.params.seedOffset,i.params.octaves,i.params.lacunarity,i.params.gain))}}case"worley":{let s=this.input(i,e,t),[o,a]=s!==void 0?jF(s):[e,t];return{t:"s",v:pde(o*i.params.scale,a*i.params.scale,r,i.params.jitter,i.params.output)}}case"gradient":{let s=i.params.angleDeg*Math.PI/180;if(i.params.kind==="radial"){let o=e-.5,a=t-.5;return{t:"s",v:Cc(Math.sqrt(o*o+a*a)*2)}}return{t:"s",v:Cc(e*Math.cos(s)+t*Math.sin(s))}}case"checker":{let s=i.params.scale;return{t:"s",v:(Math.floor(e*s)+Math.floor(t*s))%2===0?0:1}}case"bricks":{let{rows:s,cols:o,mortarWidth:a,offset:c,output:l}=i.params,u=t*s,d=Math.floor(u),h=d%2===0?0:c,f=(e*o+h)%1,p=u-d;if(l==="row")return{t:"s",v:p};let g=f<a||f>1-a||p<a||p>1-a;if(l!=="random"||g)return{t:"s",v:g?0:1};let b=(Math.floor(e*o+h)%o+o)%o>>>0,A=(d%s+s)%s>>>0,y=(r^Math.imul(A+1,2654435761)^Math.imul(b+1,2246822507))>>>0;return y=Math.imul(y^y>>>16,2146121005)>>>0,y=Math.imul(y^y>>>15,2221713035)>>>0,{t:"s",v:((y^y>>>16)>>>0)/4294967296}}case"ramp":{let s=Cc(tv(this.input(i,e,t)??{t:"s",v:0}));return{t:"c",v:yde(i.params.stops,s)}}case"blend":{let s=QF(this.input(i,e,t)??{t:"s",v:0}),o=i.inputs?.b;return{t:"c",v:vde(s,o!==void 0?QF(this.eval(o,e,t)):[0,0,0,1],i.params.mode,i.params.factor)}}case"threshold":{let s=tv(this.input(i,e,t)??{t:"s",v:0}),{edge:o,smoothness:a}=i.params,c=o-a,l=o+a,u=l>c?Cc((s-c)/(l-c)):s>=o?1:0;return{t:"s",v:u*u*(3-2*u)}}case"invert":{let s=this.input(i,e,t)??{t:"s",v:0};return s.t==="c"?{t:"c",v:[1-s.v[0],1-s.v[1],1-s.v[2],s.v[3]]}:{t:"s",v:1-tv(s)}}case"levels":{let s=tv(this.input(i,e,t)??{t:"s",v:0}),{inMin:o,inMax:a,gamma:c,outMin:l,outMax:u}=i.params,d=a>o?Cc((s-o)/(a-o)):0;return{t:"s",v:l+(c>0?d**(1/c):d)*(u-l)}}case"height-to-normal":{let s=1/this.doc.size[0],o=1/this.doc.size[1],a=(p,g)=>tv(this.input(i,p,g)??{t:"s",v:0}),c=(a(e+s,t)-a(e-s,t))/(2*s)*i.params.strength,l=(a(e,t+o)-a(e,t-o))/(2*o)*i.params.strength,u=-c,d=-l,h=1,f=Math.sqrt(u*u+d*d+h*h)||1;return{t:"c",v:[u/f*.5+.5,d/f*.5+.5,h/f*.5+.5,1]}}default:return{t:"s",v:0}}}};function yde(n,e){let t=[...n].sort((r,s)=>r.t-s.t);if(e<=t[0].t)return ev(t[0].color);let i=t[t.length-1];if(e>=i.t)return ev(i.color);for(let r=0;r<t.length-1;r++){let s=t[r],o=t[r+1];if(e>=s.t&&e<=o.t){let a=o.t>s.t?(e-s.t)/(o.t-s.t):0,c=ev(s.color),l=ev(o.color);return[c[0]+(l[0]-c[0])*a,c[1]+(l[1]-c[1])*a,c[2]+(l[2]-c[2])*a,c[3]+(l[3]-c[3])*a]}}return ev(i.color)}function vde(n,e,t,i){let r=[0,0,0,1];for(let s=0;s<3;s++){let o=n[s],a=e[s],c;switch(t){case"multiply":c=o*a;break;case"add":c=o+a;break;case"screen":c=1-(1-o)*(1-a);break;case"overlay":c=o<.5?2*o*a:1-2*(1-o)*(1-a);break;default:c=a;break}r[s]=o+(c-o)*i}return r[3]=n[3],r}function xde(n,e,t,i){let r=Object.entries(e).filter(o=>typeof o[1]=="string"),s={};for(let[o]of r)s[o]=OH(t,i);for(let o=0;o<i;o++){let a=(o+.5)/i;for(let c=0;c<t;c++){let l=(c+.5)/t;n.beginSample();let u=(o*t+c)*4;for(let[d,h]of r){let f=QF(n.eval(h,l,a)),p=s[d].data;p[u]=Math.round(Cc(f[0])*255),p[u+1]=Math.round(Cc(f[1])*255),p[u+2]=Math.round(Cc(f[2])*255),p[u+3]=Math.round(Cc(f[3])*255)}}}return s}function LH(n){if(n.alphaCoverage!==void 0&&typeof n.alphaCoverage!="boolean"||n.alphaCoverage&&(n.alphaTest!==void 0||!n.outputs?.baseColor))throw new Error(`material graph alphaCoverage requires baseColor and excludes alphaTest \u2014 ${wd}`);if(n.alphaTest!==void 0&&(!Number.isFinite(n.alphaTest)||n.alphaTest<0||n.alphaTest>1))throw new Error(`material graph alphaTest must be finite and between 0 and 1 \u2014 ${wd}`);if(!Array.isArray(n.size)||n.size.length!==2)throw new Error(`material graph has no size [width, height] \u2014 ${wd}`);let[e,t]=n.size;return{slots:xde(new bde(n),n.outputs,e,t),meta:{filter:"linear",...n.alphaTest===void 0?{}:{alphaTest:n.alphaTest},...n.alphaCoverage?{alphaCoverage:!0}:{}}}}function _de(n){if(n==="transparent")return[0,0,0,0];let e=n.replace("#","");return[Number.parseInt(e.slice(0,2),16),Number.parseInt(e.slice(2,4),16),Number.parseInt(e.slice(4,6),16),e.length>=8?Number.parseInt(e.slice(6,8),16):255]}function UH(n){let e=n.slots;if(e===void 0)throw new Error("pixelgrid document has no slots block \u2014 validate it first (molen/pixelgrid@1 defaults to { baseColor: true, emissive: false })");if(e.baseColor!==!0&&e.emissive!==!0)throw new Error("pixelgrid has every slot disabled \u2014 enable slots.baseColor or slots.emissive");let[t,i]=n.size;if(n.rows.length!==i)throw new Error(`pixelgrid has ${n.rows.length} rows, expected ${i} (size height)`);let r=new Map;for(let[c,l]of Object.entries(n.palette)){if(l!=="transparent"&&!/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(l))throw new Error(`palette entry "${c}" has invalid color "${l}" (expected transparent or #rrggbb[aa])`);r.set(c,_de(l))}let s=OH(t,i),o=!1;for(let c=0;c<i;c++){let l=n.rows[c],u=[...l];if(u.length!==t)throw new Error(`row ${c} has ${u.length} chars, expected ${t}; row: "${l}"`);for(let d=0;d<t;d++){let h=u[d],f=r.get(h);if(f===void 0)throw new Error(`char "${h}" at row ${c} col ${d} is not in the palette \u2014 keys are: ${[...r.keys()].join(" ")}`);f[3]===0&&(o=!0);let p=(c*t+d)*4;s.data[p]=f[0],s.data[p+1]=f[1],s.data[p+2]=f[2],s.data[p+3]=f[3]}}let a={};return e.baseColor&&(a.baseColor=s),e.emissive&&(a.emissive=s),{slots:a,meta:{filter:n.filter,...o?{alphaTest:.5}:{}}}}var wde=/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,DH=256,FH=64;function Sde(n){let e=n,t=[];e.slots!==void 0&&e.slots.baseColor!==!0&&e.slots.emissive!==!0&&t.push({path:"/slots",code:"no_slot_enabled",message:"every texture slot is disabled, so the grid would rasterize to nothing",expected:"baseColor and/or emissive set to true",received:JSON.stringify(e.slots)});let i=e.palette??{};for(let[a,c]of Object.entries(i))c!=="transparent"&&!wde.test(c)&&t.push({path:`/palette/${a}`,code:"invalid_color",message:`palette entry "${a}" has invalid color "${c}"`,expected:"transparent or #rrggbb[aa]"});if(!Array.isArray(e.size))return t;let[r,s]=e.size,o=e.rows??[];return o.length!==s&&t.push({path:"/rows",code:"row_count",message:`${o.length} rows, expected ${s} (size height)`,expected:`${s} rows`,received:`${o.length} rows`}),o.forEach((a,c)=>{let l=[...a];l.length!==r&&t.push({path:`/rows/${c}`,code:"row_length",message:`row ${c} has ${l.length} chars, expected ${r} (size width)`,received:JSON.stringify(a)});for(let u=0;u<l.length;u++){let d=l[u];if(!Object.hasOwn(i,d)){t.push({path:`/rows/${c}`,code:"unknown_palette_char",message:`char "${d}" at row ${c} col ${u} is not in the palette`,expected:`one of: ${Object.keys(i).join(" ")}`});break}}}),t}function qF(n){let e=[];return n.input!==void 0&&e.push(n.input),n.inputs!==void 0&&e.push(...Object.values(n.inputs)),e}function Ede(n){let e=n,t=e.nodes??[],i=[];e.alphaCoverage&&(e.alphaTest!==void 0||!e.outputs?.baseColor)&&i.push({path:"/alphaCoverage",code:"alpha_coverage",message:"alphaCoverage requires baseColor and cannot be combined with alphaTest"});let r=new Set;t.forEach((o,a)=>{r.has(o.id)&&i.push({path:`/nodes/${a}/id`,code:"duplicate_node_id",message:`duplicate node id "${o.id}"`}),r.add(o.id)}),t.forEach((o,a)=>{for(let c of qF(o))if(!r.has(c)){let l=ss(c,[...r]);i.push({path:`/nodes/${a}`,code:"unknown_node_ref",message:`node "${o.id}" references unknown node "${c}"`,...l!==void 0?{hint:`did you mean "${l}"?`}:{}})}});for(let[o,a]of Object.entries(e.outputs??{}))if(a!==void 0&&!r.has(a)){let c=ss(a,[...r]);i.push({path:`/outputs/${o}`,code:"unknown_node_ref",message:`output "${o}" references unknown node "${a}"`,...c!==void 0?{hint:`did you mean "${c}"?`}:{}})}let s=Mde(t,r);if(s!==void 0)i.push({path:"/nodes",code:"graph_cycle",message:`material graph has a cycle: ${s.join(" \u2192 ")}`});else{let o=Tde(t);o>FH&&i.push({path:"/nodes",code:"graph_depth",message:`material graph depth ${o} exceeds the limit of ${FH}`,hint:"split or flatten long dependency chains"})}return t.forEach((o,a)=>{let c=o;c.type==="levels"&&c.params?.inMin!==void 0&&c.params.inMax!==void 0&&c.params.inMin>=c.params.inMax&&i.push({path:`/nodes/${a}/params`,code:"levels_range",message:"levels.inMin must be less than levels.inMax"})}),i}function Tde(n){let e=new Map(n.map(r=>[r.id,r])),t=new Map,i=r=>{let s=t.get(r);if(s!==void 0)return s;let o=e.get(r),a=o===void 0?0:1+Math.max(0,...qF(o).filter(c=>e.has(c)).map(i));return t.set(r,a),a};return Math.max(0,...n.map(r=>i(r.id)))}function Mde(n,e){let t=new Map(n.map(a=>[a.id,a])),i=new Map,r=[],s,o=a=>{if(s!==void 0)return;let c=i.get(a)??0;if(c===2)return;if(c===1){s=[...r.slice(r.indexOf(a)),a];return}i.set(a,1),r.push(a);let l=t.get(a);if(l!==void 0)for(let u of qF(l))e.has(u)&&o(u);r.pop(),i.set(a,2)};for(let a of n)o(a.id);return s}var Ide=m.string().regex(/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,"expected #rrggbb or #rrggbbaa"),Cde=m.strictObject({t:m.number().min(0).max(1).describe("Position of the stop along the input 0..1."),color:Ide.describe("Stop color '#rrggbb' or '#rrggbbaa'.")}),Gs={id:m.string().min(1).describe("Node id, unique within the graph."),input:m.string().min(1).describe("Id of the single upstream node this node reads (single-input nodes).").optional(),inputs:m.record(m.string(),m.string()).describe("Named upstream node ids for multi-input nodes, e.g. { a: 'n1', b: 'n2' } for blend.").optional()},Z1=n=>m.number().positive().max(1e6).describe(`Pattern repeats across the 0..1 UV range (default ${n}).`).default(n),Rde=m.discriminatedUnion("type",[m.strictObject({...Gs,type:m.literal("const").describe("Constant scalar or RGBA value."),params:m.strictObject({value:m.union([m.number(),m.array(m.number()).length(4)]).describe("Scalar 0..1 or [r, g, b, a] 0..1.")}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("uv").describe("Raw UV coordinates as a value."),params:m.strictObject({}).describe("No parameters.").default({})}),m.strictObject({...Gs,type:m.literal("uv-transform").describe("Scale/offset/rotate the UV space of the upstream node."),params:m.strictObject({scale:Z1(1),offset:m.array(m.number()).length(2).describe("UV offset [u, v] in 0..1 units (default [0, 0]).").default([0,0]),rotateDeg:m.number().describe("Rotation in degrees about the UV origin (default 0).").default(0)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("noise").describe("Fractal noise field (0..1)."),params:m.strictObject({kind:m.enum(["simplex","value"]).describe("Base noise: simplex (default) or value noise.").default("simplex"),octaves:m.int().min(1).max(8).describe("Number of fBm octaves, 1..8 (default 4).").default(4),lacunarity:m.number().positive().max(16).describe("Frequency multiplier per octave (default 2).").default(2),gain:m.number().min(0).max(1).describe("Amplitude multiplier per octave, 0..1 (default 0.5).").default(.5),scale:Z1(4),seedOffset:m.int().describe("Added to the document seed so sibling noise nodes differ (default 0).").default(0)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("worley").describe("Worley (cellular) noise (0..1)."),params:m.strictObject({scale:Z1(4),jitter:m.number().min(0).max(1).describe("Cell point randomness, 0 (regular grid) .. 1 (default).").default(1),output:m.enum(["f1","f2","f2-f1"]).describe("Distance output: nearest (f1, default), second-nearest (f2), or their difference (f2-f1).").default("f1")}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("gradient").describe("Linear or radial gradient (0..1)."),params:m.strictObject({kind:m.enum(["linear","radial"]).describe("linear across UV (default) or radial from the center.").default("linear"),angleDeg:m.number().describe("Direction of a linear gradient in degrees (0 = along +u; default 0).").default(0)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("checker").describe("Checkerboard (0/1)."),params:m.strictObject({scale:Z1(8)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("bricks").describe("Running-bond bricks: a brick/mortar mask, a per-brick random value or the position within a row."),params:m.strictObject({rows:m.int().positive().max(4096).describe("Brick rows across V (default 8).").default(8),cols:m.int().positive().max(4096).describe("Brick columns across U (default 4).").default(4),mortarWidth:m.number().min(0).max(.5).describe("Mortar width as a fraction of one brick cell, 0..0.5 (default 0.05).").default(.05),offset:m.number().min(0).max(1).describe("Horizontal shift of alternate rows as a fraction of a brick, 0..1 (default 0.5).").default(.5),output:m.enum(["mask","random","row"]).describe("mask (default): 1 on a brick, 0 on mortar. random: a stable 0..1 value per brick (0 on mortar), for per-tile tone variation. row: position within the row, 0 at its top (v) edge to 1 at its bottom, for course shading and normals.").default("mask")}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("ramp").describe("Map the scalar input 0..1 through a color ramp."),params:m.strictObject({stops:m.array(Cde).min(2).describe("Color stops ordered by t (at least two).")}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("blend").describe("Combine inputs.a and inputs.b."),params:m.strictObject({mode:m.enum(["mix","multiply","add","screen","overlay"]).describe("Blend mode (default mix).").default("mix"),factor:m.number().min(0).max(1).describe("Weight of input b, 0..1 (default 0.5).").default(.5)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("threshold").describe("Soft step of the scalar input around an edge."),params:m.strictObject({edge:m.number().describe("Input value at which the output crosses 0.5 (default 0.5).").default(.5),smoothness:m.number().nonnegative().max(1).describe("Half-width of the smooth transition around edge, 0..1 (default 0.05).").default(.05)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("invert").describe("1 - input."),params:m.strictObject({}).describe("No parameters.").default({})}),m.strictObject({...Gs,type:m.literal("levels").describe("Remap input range to output range with gamma."),params:m.strictObject({inMin:m.number().describe("Input value mapped to outMin (default 0).").default(0),inMax:m.number().describe("Input value mapped to outMax (default 1; must exceed inMin).").default(1),gamma:m.number().positive().max(100).describe("Gamma exponent (default 1).").default(1),outMin:m.number().describe("Output low value (default 0).").default(0),outMax:m.number().describe("Output high value (default 1).").default(1)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("height-to-normal").describe("Derive a tangent-space normal map from a height input."),params:m.strictObject({strength:m.number().nonnegative().max(100).describe("Height gradient multiplier (default 1).").default(1)}).describe("Node parameters.")})]),Xo=n=>m.string().describe(`Id of the node rasterized into the ${n} texture.`),Wg={baseColor:Xo("baseColor").optional(),roughness:Xo("roughness").optional(),metalness:Xo("metalness").optional(),normal:Xo("normal").optional(),emissive:Xo("emissive").optional(),ao:Xo("ambient-occlusion").optional()},Bde=m.union([m.strictObject({...Wg,baseColor:Xo("baseColor")}),m.strictObject({...Wg,roughness:Xo("roughness")}),m.strictObject({...Wg,metalness:Xo("metalness")}),m.strictObject({...Wg,normal:Xo("normal")}),m.strictObject({...Wg,emissive:Xo("emissive")}),m.strictObject({...Wg,ao:Xo("ambient-occlusion")})]).describe("Texture slot to node id (at least one slot)."),Nde=m.strictObject({format:m.literal("molen/matgraph@1").describe("Format envelope; always 'molen/matgraph@1'."),alphaCoverage:m.boolean().optional().describe("Filter baseColor alpha as fractional surface coverage for porous surfaces. Uses mipmapped alpha blending; requires baseColor and excludes alphaTest. Like portable glTF BLEND, overlapping transparent surfaces require sorting."),alphaTest:m.number().min(0).max(1).optional().describe("Optional alpha cutout threshold for baseColor RGBA. Omit for opaque materials; this does not enable blended transparency."),size:m.array(m.int().min(1).max(2048)).length(2).describe("Output texture size [width, height] in pixels, 1..2048 (default [512, 512]).").default([512,512]),seed:m.int().describe("Deterministic seed for noise nodes (default 0).").default(0),nodes:m.array(Rde).min(1).max(DH).describe(`Graph nodes (1..${DH}); each is a pure per-UV function of its inputs.`),outputs:Bde}),kde=m.strictObject({format:m.literal("molen/pixelgrid@1").describe("Format envelope; always 'molen/pixelgrid@1'."),size:m.array(m.int().min(1).max(256)).length(2).describe("Grid size [width, height] in pixels, 1..256."),palette:m.record(m.string(),m.string()).describe("Single-character key to 'transparent' or '#rrggbb[aa]' color."),rows:m.array(m.string()).min(1).describe("One string per row (top to bottom), each `width` palette characters long."),slots:m.strictObject({baseColor:m.boolean().describe("Emit the baseColor texture (default true).").default(!0),emissive:m.boolean().describe("Also emit the grid as an emissive texture (default false).").default(!1)}).describe("Which material texture slots the grid is rasterized into.").default({baseColor:!0,emissive:!1}),filter:m.enum(["nearest","linear"]).describe("Texture sampling filter: nearest (crisp pixels, default) or linear.").default("nearest")}),PH=!1;function KF(){PH||(PH=!0,Xn("pixelgrid",kde,{id:"molen/pixelgrid@1",title:"Pixel-grid texture",description:"Indexed palette + rows of characters rasterized to a pixel-art texture.",examples:[{format:"molen/pixelgrid@1",size:[4,4],palette:{".":"transparent",X:"#222222",o:"#e6b84a"},rows:[".XX.","XooX","XooX",".XX."]}],docsRef:"schemas/pixelgrid.md",validate:Sde}),Xn("uvpaint",m.strictObject({format:m.literal("molen/uvpaint@1").describe("Format envelope; always 'molen/uvpaint@1'."),model:m.string().min(1).describe("Sidecar-relative path of the model the template was unwrapped from."),atlasSize:m.array(m.int().positive()).length(2).describe("Template/atlas size [width, height] in pixels (default [1024, 1024]).").default([1024,1024]),texelDensity:m.number().positive().describe("Texels per meter of model surface the atlas was laid out at (default 128).").default(128),islands:m.array(m.strictObject({id:m.int().nonnegative().describe("Island number as printed on the template."),label:m.string().describe("Human label for the island, e.g. 'head'.").default(""),color:m.string().regex(/^#[0-9a-fA-F]{6}$/).describe("'#rrggbb' key color of the island in the island map."),uvBBox:m.array(m.number()).length(4).describe("Island bounds [minU, minV, maxU, maxV] in 0..1 UV space."),notes:m.string().describe("Free-form painting notes.").default("")})).describe("UV islands annotated on the template.").default([]),paintedImage:m.string().describe("Sidecar-relative path of the painted template image to re-import.").optional(),importRules:m.strictObject({maskToIslands:m.boolean().describe("Clip paint to the island shapes on import (default true).").default(!0),dilationPx:m.int().nonnegative().describe("Gutter dilation in pixels applied after masking (default 8).").default(8)}).describe("How the painted image is turned back into a texture.").default({maskToIslands:!0,dilationPx:8})}),{id:"molen/uvpaint@1",title:"UV paint sidecar",description:"Island annotations pairing a paint-by-numbers template with a model for re-import.",examples:[{format:"molen/uvpaint@1",model:"models/scout.glb",atlasSize:[1024,1024],islands:[{id:1,label:"head",color:"#e6194b",uvBBox:[.02,.05,.31,.4]}]}],docsRef:"schemas/uvpaint.md"}),Xn("matgraph",Nde,{id:"molen/matgraph@1",title:"Procedural material graph",description:"A small node graph (noise, gradients, ramps, blends) CPU-rasterized to textures.",examples:[{format:"molen/matgraph@1",size:[256,256],seed:1337,nodes:[{id:"n1",type:"noise",params:{kind:"simplex",octaves:5,scale:4}},{id:"n2",type:"ramp",input:"n1",params:{stops:[{t:0,color:"#4a4a52"},{t:.6,color:"#6e6a63"},{t:1,color:"#9a948a"}]}}],outputs:{baseColor:"n2"}}],docsRef:"schemas/matgraph.md",validate:Ede}))}var EFe=["node",":"].join("");KF();var $H=(function(){var n="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq:VZkdbk:XYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbh5dnawTmbaxa8Acd4fRbbh5kcbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:ysezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:W9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:JBl8Aud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fhOaPaDfhAasaeaH9RaHasfae6EgCcsfgocl4cifcd4hXavcj;cbfaoc9WGgQcetfhLavcj;cbfaQci2fhKavcj;cbfaQfhYcbh8Aaoc;ab6hEincbh3dnawTmbaPa8Acd4fRbbh3kcbh5avcj;cbfh8Eindndndndna3a5cet4ciGgoc9:fPdebdkaxaA9RaQ6mwdnaQTmbavcj;cbfa5aQ2faAaQ;8qbbkaAaCfhAxdkaQTmeavcj;cbfa5aQ2fcbaQ;8kbxekaxaA9RaX6moaoclVcbawEhraAaXfhocbhidnaEmbaxao9Rc;Gb6mbcbhlina8EalfhidndndndndndnaAalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiczfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaicafaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaQ0meaihlaxao9Rc;Fb0mbkkdnaiaQ9pmbaici4hlinaxao9RcK6mwa8EaifhqdndndndndndnaAaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaoclffagRb:q:W:cjbfhoxikaqaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaocwffagRb:q:W:cjbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpkbbahaocdffagRb:q:W:cjbfhokalcdfhlaiczfgiaQ6mbkkaohAaoTmoka8EaQfh8Ea5cefg5cl9hmbkdndndndnawTmbaza8Acd4fRbbglciGPlbedwbkaQTmdavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep9Ta8Fpxeeeeeeeeeeeeeeeegap9op9Hp9rg8Fa8Jp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ugap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp9Ugap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp9Ugap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9AbbbaladfhlaoczfgoaQ6mbxikkaQTmeavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep:nea8Fpxebebebebebebebebgap9op:bep9rg8Fa8Jp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oegap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp:oegap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp:oegap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9AbbbaladfhlaoczfgoaQ6mbxdkkaQTmbcbhocbalcl4gl9Rc8FGhiavcjdfa8Afhrava8Afpbdbhainaravcj;cbfaofpblbg8JaYaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaLaofpblbg8MaKaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Faap9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8LaypmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9AbbbaradfhraoczfgoaQ6mbkka8Aclfg8Aad6mbkdnaCad2goTmbaOavcjdfao;8qbbkdnammbavavcjdfaCcufad2fad;8qbbkaCaHfhHc9:hoaAhPaAmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkNsezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var r=WebAssembly.validate(t)?a(e):a(n),s,o=WebAssembly.instantiate(r,{}).then(function(A){s=A.instance,s.exports.__wasm_call_ctors()});function a(A){for(var y=new Uint8Array(A.length),v=0;v<A.length;++v){var x=A.charCodeAt(v);y[v]=x>96?x-97:x>64?x-39:x+4}for(var w=0,v=0;v<A.length;++v)y[w++]=y[v]<60?i[y[v]]:(y[v]-60)*64+y[++v];return y.buffer.slice(0,w)}function c(A,y,v,x,w,_,E){var S=A.exports.sbrk,M=x+3&-4,I=S(M*w),R=S(_.length),N=new Uint8Array(A.exports.memory.buffer);N.set(_,R);var P=y(I,x,w,R,_.length);if(P==0&&E&&E(I,M,w),v.set(N.subarray(I,I+x*w)),S(I-S(0)),P!=0)throw new Error("Malformed buffer data: "+P)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},u={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},d=[],h=0;function f(A){var y={object:new Worker(A),pending:0,requests:{}};return y.object.onmessage=function(v){var x=v.data;y.pending-=x.count,y.requests[x.id][x.action](x.value),delete y.requests[x.id]},y}function p(A){for(var y="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(r)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+b.name+";"+c.toString()+b.toString(),v=new Blob([y],{type:"text/javascript"}),x=URL.createObjectURL(v),w=d.length;w<A;++w)d[w]=f(x);for(var w=A;w<d.length;++w)d[w].object.postMessage({});d.length=A,URL.revokeObjectURL(x)}function g(A,y,v,x,w){for(var _=d[0],E=1;E<d.length;++E)d[E].pending<_.pending&&(_=d[E]);return new Promise(function(S,M){var I=new Uint8Array(v),R=++h;_.pending+=A,_.requests[R]={resolve:S,reject:M},_.object.postMessage({id:R,count:A,size:y,source:I,mode:x,filter:w},[I.buffer])})}function b(A){var y=A.data;self.ready.then(function(v){if(!y.id)return self.close();try{var x=new Uint8Array(y.count*y.size);c(v,v.exports[y.mode],x,y.count,y.size,y.source,v.exports[y.filter]),self.postMessage({id:y.id,count:y.count,action:"resolve",value:x},[x.buffer])}catch(w){self.postMessage({id:y.id,count:y.count,action:"reject",value:w})}})}return{ready:o,supported:!0,useWorkers:function(A){p(A)},decodeVertexBuffer:function(A,y,v,x,w){c(s,s.exports.meshopt_decodeVertexBuffer,A,y,v,x,s.exports[l[w]])},decodeIndexBuffer:function(A,y,v,x){c(s,s.exports.meshopt_decodeIndexBuffer,A,y,v,x)},decodeIndexSequence:function(A,y,v,x){c(s,s.exports.meshopt_decodeIndexSequence,A,y,v,x)},decodeGltfBuffer:function(A,y,v,x,w,_){c(s,s.exports[u[w]],A,y,v,x,s.exports[l[_]])},decodeGltfBufferAsync:function(A,y,v,x,w){return d.length>0?g(A,y,v,u[x],l[w]):o.then(function(){var _=new Uint8Array(A*y);return c(s,s.exports[u[x]],_,A,y,v,s.exports[l[w]]),_})}}})();ms();var XF=new WeakMap,Y1=class extends ri{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){let s=new hi(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{this.parse(o,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,rn,i).catch(i)}decodeDracoFile(e,t,i,r,s=Zn,o=()=>{}){let a={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:s};return this.decodeGeometry(e,a).then(t).catch(o)}decodeGeometry(e,t){let i=JSON.stringify(t);if(XF.has(e)){let c=XF.get(e);if(c.key===i)return c.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r,s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(c=>(r=c,new Promise((l,u)=>{r._callbacks[s]={resolve:l,reject:u},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),XF.set(e,{key:i,promise:a}),a}_createGeometry(e){let t=new Ke;e.index&&t.setIndex(new ut(e.index.array,1));for(let i=0;i<e.attributes.length;i++){let{name:r,array:s,itemSize:o,stride:a,vertexColorSpace:c}=e.attributes[i],l;if(o===a)l=new ut(s,o);else{let u=new zr(s,a);l=new rr(u,o,0)}r==="color"&&(this._assignVertexColorSpace(l,c),l.normalized=!(s instanceof Float32Array)),t.setAttribute(r,l)}return t}_assignVertexColorSpace(e,t){if(t!==rn)return;let i=new le;for(let r=0,s=e.count;r<s;r++)i.fromBufferAttribute(e,r),lt.colorSpaceToWorking(i,rn),e.setXYZ(r,i.r,i.g,i.b)}_loadLibrary(e,t){let i=new hi(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,s)=>{i.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{let r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);let s=Dde.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
4791
|
+
`)}var T6=1e3;function M6(n,e){let t=n[e],i;if(t==="*"||t==="+"||t==="?")i=e+1;else if(t==="{"){let r=/^\{\d+(?:,\d*)?\}/.exec(n.slice(e));if(r===null)return;i=e+r[0].length}else return;return n[i]==="?"&&(i+=1),{end:i}}function Rne(n,e){let t=e+1;if(n[t]!=="?")return t;if(t+=1,n[t]==="<"&&n[t+1]!=="="&&n[t+1]!=="!"){for(;t<n.length&&n[t]!==">";)t+=1;return t+1}return n[t]==="<"?t+2:n[t]===":"||n[t]==="="||n[t]==="!"?t+1:t}function Bne(n){if(n.length>T6)return`is ${n.length} characters long (limit ${T6})`;let e=[{hasQuantifier:!1}],t=0;for(;t<n.length;){let i=n[t];if(i==="\\"){t+=2;continue}if(i==="["){for(t+=1;t<n.length&&n[t]!=="]";)t+=n[t]==="\\"?2:1;t+=1;continue}if(i==="("){e.push({hasQuantifier:!1}),t=Rne(n,t);continue}if(i===")"){let s=e.pop(),o=e[e.length-1];if(s===void 0||o===void 0)return;t+=1;let a=M6(n,t);if(a!==void 0){if(t=a.end,s.hasQuantifier)return'nests a quantifier inside a quantified group, which backtracks catastrophically (e.g. "^(a+)+$" takes over a second on 26 characters and doubles per character after that)';o.hasQuantifier=!0}else s.hasQuantifier&&(o.hasQuantifier=!0);continue}let r=M6(n,t);if(r!==void 0){let s=e[e.length-1];s!==void 0&&(s.hasQuantifier=!0),t=r.end;continue}t+=1}}var Nne=new Set(["default","const","enum","examples"]);function kne(n){return n.replaceAll("~","~0").replaceAll("/","~1")}function zk(n,e=""){let t=[],i=(r,s)=>{if(Array.isArray(r)){r.forEach((o,a)=>{i(o,`${s}/${a}`)});return}if(!(r===null||typeof r!="object"))for(let[o,a]of Object.entries(r)){if(Nne.has(o))continue;let c=`${s}/${kne(o)}`;if(o==="pattern"&&typeof a=="string"){let l=Bne(a);l!==void 0&&t.push({pointer:c,pattern:a,reason:l});continue}i(a,c)}};return i(n,e),t}function Dne(n){let e=zk(n)[0];if(e!==void 0)throw new Error(`pattern ${JSON.stringify(e.pattern)} at "${e.pointer}" ${e.reason}`);return m.fromJSONSchema(n)}var os=m.number().finite(),ac=os.positive(),I6=os.min(0).max(1),J6=m.tuple([os,os]),c0=m.tuple([os,os,os]),Y6=m.tuple([os,os,os,os]).refine(n=>Math.abs(n.reduce((e,t)=>e+t*t,0)-1)<1e-5,"Glass rotation must be a unit quaternion."),Fne=m.strictObject({id:m.string().min(1).max(64).describe("Stable pane id, unique on its owner."),material:m.enum(["laminated","tempered","annealed"]).describe("Laminated retains cracked glass; tempered releases granules; annealed releases larger shards."),center:c0.describe("Pane center in owner coordinates, meters."),rotation:Y6.describe("Pane XY orientation in owner coordinates, unit quaternion."),size:m.tuple([ac,ac]).describe("Width and height in meters."),thickness:ac.describe("Total glass thickness, meters; interlayer thickness excluded."),density:ac.optional().describe("Glass density, kg/m\xB3; default 2500."),strength:ac.optional().describe("Effective bending failure stress, Pa. Defaults: tempered 120e6, others 45e6. Simulation tuning, not certification."),fractureEnergy:ac.optional().describe("Post-initiation fracture work, J/m\xB2; default 80."),retentionForce:ac.optional().describe("Frame/interlayer failure force, N; default 4000 times pane perimeter in meters."),retentionEnergy:ac.optional().describe("Work to lose frame/interlayer retention, J; default 3000 times area in m\xB2."),nodes:m.array(m.string().min(1)).min(1).optional().describe("Dedicated glass mesh/group names; omit for a generated rectangular pane. Never bind a whole vehicle or a shared body mesh.")}),Pne=m.strictObject({surfaces:m.array(Fne).min(1).max(64).describe("Physical glass panes and their model bindings."),crashPulseSeconds:ac.max(1).optional().describe("Duration of the vehicle crash pulse, seconds; default 0.06, independent of tick rate.")}).superRefine((n,e)=>{let t=new Set,i=new Set;n.surfaces.forEach((r,s)=>{t.has(r.id)&&e.addIssue({code:"custom",path:["surfaces",s,"id"],message:"Duplicate glass surface id."}),t.add(r.id);for(let o of r.nodes??[])i.has(o)&&e.addIssue({code:"custom",path:["surfaces",s,"nodes"],message:"A node can belong to only one glass surface."}),i.add(o)})}),One=m.strictObject({surfaces:m.record(m.string().min(1),m.strictObject({fracture:m.enum(["intact","cracked","shattered"]),retained:m.boolean(),damage:I6,retentionDamage:I6,peakStress:os.nonnegative().describe("Largest resolved bending stress in Pa."),point:J6,release:m.strictObject({time:os.nonnegative(),position:c0,rotation:Y6,velocity:c0,fragmentSpeed:os.nonnegative().optional().describe("Energy-limited cosmetic fragment dispersion speed, m/s.")}).optional().describe("Snapshot-safe initial world pose, velocity and simulation time for cosmetic debris.")})).describe("Per-pane fracture, retention and release state keyed by surface id.")}),iFe=m.strictObject({entity:m.string().min(1),surface:m.string().min(1),impulse:c0,energy:os.nonnegative().describe("Available impact energy in joules."),duration:ac.describe("Physical contact duration, seconds; do not use render frame time."),point:J6,distributed:m.boolean().optional(),velocity:c0.optional()}),al=m.string().min(1).max(128),Mk=m.string().regex(/^#[0-9a-fA-F]{6}$/),C6=m.tuple([m.number(),m.number(),m.number()]),aS=m.number().min(0).max(1),Ik=m.number().positive().max(4),Lne=m.strictObject({selected:al.describe("Selected variant id; patch only this field to change the livery."),slots:m.record(al,m.strictObject({materials:m.array(al).min(1).describe("Exact glTF material names belonging to this paint region."),node:al.optional().describe("Optional named glTF subtree restricting this region.")})).describe("Stable paint regions bound to named model materials."),anchors:m.record(al,m.strictObject({slot:al.describe("Paint region receiving the projected marking."),position:C6.describe("Projector center as fractions of the region bounds, measured from their minimum corner."),size:m.tuple([Ik,Ik,Ik]).describe("Projector width, height and depth as fractions of the longest region dimension."),rotation:C6.describe("XYZ Euler rotation in radians; local positive Z points out of the surface.")})).optional().describe("Reusable marking projectors attached to model paint regions."),variants:m.array(m.strictObject({id:al.describe("Stable identifier used by selected."),label:m.string().min(1).max(256).describe("Display name for this livery."),provenance:m.strictObject({kind:m.enum(["photo","inspired","original"]).describe("Whether the appearance is photograph verified, reference inspired or an original design."),note:m.string().min(1).describe("Attribution, verification scope and any deliberate approximations."),references:m.array(m.strictObject({title:m.string().min(1).describe("Human-readable reference title."),url:m.string().regex(/^https?:\/\/[^\s]+$/).describe("HTTP or HTTPS source URL.")})).describe("Public references supporting the appearance; required for photo and inspired designs.")}).describe("Evidence and authorship for the appearance."),paints:m.record(al,m.strictObject({color:Mk.describe("Base paint color as an sRGB hex triplet."),roughness:aS.optional().describe("Optional material roughness override."),metalness:aS.optional().describe("Optional material metalness override."),camouflage:m.strictObject({colors:m.array(Mk).min(2).max(4).describe("Two to four colors for deterministic camouflage patches."),scale:m.number().positive().max(100).describe("Pattern repetitions across the longest paint-region dimension."),seed:m.number().int().min(0).max(4294967295).describe("Unsigned deterministic pattern seed.")}).optional().describe("Optional camouflage projected in model space without changing authored UVs.")})).describe("Paint overrides keyed by stable paint-region name; omitted regions retain their authored appearance."),markings:m.array(m.strictObject({anchor:al.describe("Reusable model marking anchor."),graphic:m.strictObject({label:m.string().max(256).optional().describe("Optional descriptive label; rendered lettering belongs in the polygon artwork."),shapes:m.array(m.strictObject({color:Mk.describe("Flat polygon color as an sRGB hex triplet."),points:m.array(m.tuple([aS,aS])).min(3).max(512).describe("Polygon vertices in normalized 0\u20131 coordinates with positive Y upward.")})).min(1).max(4096).describe("Original flat artwork polygons, painted in order.")}).describe("Resolution-independent artwork rasterized for the surface projector.")})).max(32).optional().describe("Surface markings to project for this variant.")})).min(1).max(64).describe("Available livery recipes for this model.")}).superRefine((n,e)=>{let t=(r,s)=>e.addIssue({code:"custom",path:r,message:s}),i=new Set;for(let[r,s]of n.variants.entries()){i.has(s.id)&&t(["variants",r,"id"],"Duplicate livery id"),i.add(s.id);for(let o of Object.keys(s.paints))Object.hasOwn(n.slots,o)||t(["variants",r,"paints",o],"Unknown paint slot");for(let[o,a]of(s.markings??[]).entries())Object.hasOwn(n.anchors??{},a.anchor)||t(["variants",r,"markings",o,"anchor"],"Unknown marking anchor");s.provenance.kind!=="original"&&s.provenance.references.length===0&&t(["variants",r,"provenance","references"],"Photo and inspired liveries need references")}i.has(n.selected)||t(["selected"],"Unknown livery id");for(let[r,s]of Object.entries(n.anchors??{}))Object.hasOwn(n.slots,s.slot)||t(["anchors",r,"slot"],"Unknown paint slot")}),Une={add:[2,16],subtract:[2,2],multiply:[2,16],divide:[2,2],min:[2,16],max:[2,16],clamp:[3,3],abs:[1,1],sqrt:[1,1],floor:[1,1],modulo:[2,2],sin:[1,1],cos:[1,1],atan2:[2,2],less:[2,2],greater:[2,2],equal:[2,2],and:[2,16],or:[2,16],not:[1,1],if:[3,3],coalesce:[2,16]},$ne=m.strictObject({op:m.enum(["add","subtract","multiply","divide","min","max","clamp","abs","sqrt","floor","modulo","sin","cos","atan2","less","greater","equal","and","or","not","if","coalesce"]).describe("Numeric operation; comparisons/logic return 0 or 1. Angles are radians."),args:m.array(m.union([m.number().finite(),m.string().min(1)])).min(1).max(16).describe("Finite numeric literals or names of signals, in operand order.")}).superRefine((n,e)=>{let[t,i]=Une[n.op];(n.args.length<t||n.args.length>i)&&e.addIssue({code:"custom",path:["args"],message:`${n.op} requires ${t===i?t:`${t}\u2013${i}`} operands`})}),d0=m.record(m.string().min(1),$ne).superRefine((n,e)=>{if(Object.keys(n).length>256){e.addIssue({code:"custom",message:"At most 256 derived signals per model"});return}let t=new Set,i=new Set,r=s=>{if(t.has(s)){e.addIssue({code:"custom",path:[s],message:"Cyclic derived signal dependency"});return}if(!i.has(s)){t.add(s);for(let o of n[s]?.args??[])typeof o=="string"&&Object.hasOwn(n,o)&&r(o);t.delete(s),i.add(s)}};for(let s of Object.keys(n))r(s)}).describe("Up to 256 named data-only formulas, evaluated in dependency order. No cycles.");function Gk(n,e,t=!1){let i=n.sources??{},r=n.derived??{};for(let[s,o]of Object.entries(r))Object.hasOwn(i,s)&&e.addIssue({code:"custom",path:["derived",s],message:"Derived signal duplicates a component source"}),t&&o.args.forEach((a,c)=>{typeof a=="string"&&!Object.hasOwn(i,a)&&!Object.hasOwn(r,a)&&e.addIssue({code:"custom",path:["derived",s,"args",c],message:`Unknown signal: ${a}`})});t&&n.bindings.forEach((s,o)=>{!Object.hasOwn(i,s.source)&&!Object.hasOwn(r,s.source)&&e.addIssue({code:"custom",path:["bindings",o,"source"],message:"Unknown signal source"})})}var Vk=m.record(m.string().min(1),m.strictObject({component:m.string().min(1).describe("Component on this same entity."),path:m.array(m.union([m.string().min(1),m.number().int().nonnegative()])).min(1).describe("Explicit property names or array indices leading to a number or boolean.")})).describe("Named signals read from same-entity component fields."),Hk=m.array(m.strictObject({node:m.string().min(1).describe("Exact loaded GLB node name."),source:m.string().min(1).describe("Named simulation signal."),property:m.enum(["rotation","position","visible"]).describe("Local transform or visibility channel."),axis:m.enum(["x","y","z"]).optional().describe("Required for transforms; omit for visible."),scale:m.number().finite().optional().describe("Multiply the signal by this value. Supply this or keys."),offset:m.number().finite().optional().describe("Offset after scaling; default zero."),keys:m.array(m.tuple([m.number().finite(),m.number().finite()])).min(2).optional().describe("Keyframed curve of [signal, displacement] pairs, signals strictly ascending; holds the end values outside them. Supply this or scale."),ease:m.enum(["linear","smooth"]).optional().describe("Interpolation between keys: linear (default), or smooth to ease out of and into every key."),min:m.number().finite().optional().describe("Minimum displacement from authored pose."),max:m.number().finite().optional().describe("Maximum displacement from authored pose."),period:m.number().finite().positive().optional().describe("Rotation output wraps to [0, period); smoothing follows the shortest arc. Cannot combine with min/max."),responseSeconds:m.number().finite().nonnegative().optional().describe("First-order response time constant in simulation seconds; default zero. Requires a timestamp from the host."),missing:m.enum(["hold","rest","hide"]).optional().describe("Missing reading: hold last pose (default), restore authored pose, or hide a visible channel.")}).superRefine((n,e)=>{n.missing==="hide"&&n.property!=="visible"&&e.addIssue({code:"custom",path:["missing"],message:"hide requires a visible channel"}),n.property==="visible"!=(n.axis===void 0)&&e.addIssue({code:"custom",path:["axis"],message:"Transform channels require an axis; visible must omit it"}),n.period!==void 0&&(n.property!=="rotation"||n.min!==void 0||n.max!==void 0)&&e.addIssue({code:"custom",path:["period"],message:"period requires an unlimited rotation channel"}),n.property==="visible"&&n.responseSeconds!==void 0&&e.addIssue({code:"custom",path:["responseSeconds"],message:"Visibility changes immediately; smooth a transform instead"}),n.min!==void 0&&n.max!==void 0&&n.min>n.max&&e.addIssue({code:"custom",path:["max"],message:"max must be at least min"}),n.scale===void 0==(n.keys===void 0)&&e.addIssue({code:"custom",path:["scale"],message:"Supply exactly one of scale or keys"}),n.keys!==void 0&&n.offset!==void 0&&e.addIssue({code:"custom",path:["offset"],message:"offset calibrates scale; put it in the keys instead"}),n.keys===void 0&&n.ease!==void 0&&e.addIssue({code:"custom",path:["ease"],message:"ease requires keys"}),n.keys?.forEach((t,i)=>{let r=n.keys?.[i-1];r!==void 0&&t[0]<=r[0]&&e.addIssue({code:"custom",path:["keys",i,0],message:"Key signals must be strictly ascending"})})})).superRefine((n,e)=>{let t=new Set;n.forEach((i,r)=>{let s=JSON.stringify([i.node,i.property,i.axis]);t.has(s)&&e.addIssue({code:"custom",path:[r],message:"Duplicate node transform channel"}),t.add(s)})}).describe("Per-model node channels and their signal calibration."),zne=m.strictObject({sources:Vk.optional().describe("Optional component fields overriding or extending host telemetry."),bindings:Hk,derived:d0.optional()}).superRefine((n,e)=>Gk(n,e)),Gne=m.strictObject({sources:Vk,bindings:Hk,derived:d0.optional()}).superRefine((n,e)=>Gk(n,e,!0)),Pi=m.number().finite(),Iu=m.string().regex(/^#[0-9a-fA-F]{6}$/),e5=m.array(Pi).length(3),Vne=e5.describe("Nonzero direction toward the body; +X east, +Y up, -Z north. Normalized by the renderer."),R6=m.strictObject({direction:Vne,angularDiameterDeg:Pi.positive().max(90).optional().describe("Apparent diameter in degrees; default 0.53.")}),B6={palette:m.strictObject({dayZenith:Iu.optional().describe("Daytime overhead color, default #2374c5."),dayHorizon:Iu.optional().describe("Daytime horizon and ambient light color, default #b8d7eb."),twilight:Iu.optional().describe("Twilight glow and low Sun color, default #f78753."),nightZenith:Iu.optional().describe("Nighttime overhead color, default #020510."),nightHorizon:Iu.optional().describe("Nighttime horizon and ambient light color, default #121c32."),ground:Iu.optional().describe("Below-horizon dome and ground ambient color, default #18212c."),sun:Iu.optional().describe("Sun disk and high-altitude sunlight color, default #fff4dc."),moon:Iu.optional().describe("Moon surface and moonlight color, default #dae5f5.")}).optional().describe("Art-directed clear-sky colors. These control the sky dome, not distance fog or weather."),lighting:m.strictObject({sunIntensity:Pi.nonnegative().optional().describe("Peak directional sunlight, default 3."),moonIntensity:Pi.nonnegative().optional().describe("Full-moon directional light, default 0.12; scaled by phase and altitude."),dayAmbient:Pi.nonnegative().optional().describe("Daytime hemisphere intensity, default 0.6."),nightAmbient:Pi.nonnegative().optional().describe("Nighttime hemisphere intensity, default 0.025."),skyLightSaturation:Pi.min(0).max(1).optional().describe("Saturation of the light the sky casts (fill and reflections) relative to the dome colors: 1 (default) lights with the dome palette, lower values toward its luminance. A saturated zenith otherwise tints every surface in shade blue."),referenceElevation:Pi.min(1).max(90).optional().describe("Sun elevation in degrees whose sunlit-ground brightness is kept as the sun climbs higher: above it, sun and sky light scale down together so a level surface in sun receives the same light, as a camera adapts its exposure. Omit for constant light, which renders midday ground brighter than its authored color."),castShadow:m.boolean().optional().describe("Sun shadows; also requires environment.shadows. Default true.")}).optional().describe("Sky-managed lights replace environment.ambient and environment.sun when sky is enabled."),dome:m.strictObject({brightness:Pi.positive().max(4).optional().describe("Multiplier on the drawn dome color, default 1. Lighting and reflections keep the palette.")}).optional().describe("Sky dome drawing. Filmic tone mapping renders a physically bright clear sky pale; below 1 deepens it."),stars:m.strictObject({enabled:m.boolean().optional().describe("Show the star catalog, default true."),magnitudeLimit:Pi.min(-2).max(6.5).optional().describe("Faintest catalog magnitude rendered, default 6."),intensity:Pi.nonnegative().optional().describe("Star brightness multiplier, default 1; fades with daylight and moonlight."),size:Pi.positive().max(10).optional().describe("Visual angular-size multiplier, default 1.")}).optional().describe("Star catalog visibility, brightness and size."),sun:m.strictObject({visible:m.boolean().optional().describe("Show the Sun disk; lighting is independent. Default true."),size:Pi.positive().max(100).optional().describe("Visual diameter multiplier, default 1. Does not affect astronomy or lighting.")}).optional().describe("Sun disk appearance."),moon:m.strictObject({visible:m.boolean().optional().describe("Show the Moon disk; lighting is independent. Default true."),size:Pi.positive().max(100).optional().describe("Visual diameter multiplier, default 1."),earthshine:Pi.min(0).max(1).optional().describe("Dark-side visibility, default 0.025.")}).optional().describe("Moon disk appearance.")},AS=m.discriminatedUnion("mode",[m.strictObject({...B6,mode:m.literal("earth").describe("Compute positions from an Earth observer and UTC clock."),observer:m.strictObject({latitude:Pi.min(-90).max(90).describe("Geodetic degrees north."),longitude:Pi.min(-180).max(180).describe("Degrees east; west is negative."),elevation:Pi.min(-500).max(1e5).optional().describe("Meters above sea level, default 0; used for lunar parallax."),northOffsetDeg:Pi.optional().describe("Rotate geographic north clockwise toward +X, default 0 (-Z north).")}).describe("Geographic observing position and world orientation."),time:m.strictObject({epochMs:Pi.min(-22089888e5).max(4133980799999).describe("UTC Unix milliseconds at simulation second zero (1900\u20132100). Explicit: never reads the host clock."),scale:Pi.optional().describe("Sky seconds per simulation second, default 1. Zero freezes, negative rewinds.")}).describe("UTC epoch and rate relative to simulation time.")}),m.strictObject({...B6,mode:m.literal("custom").describe("Use authored body positions without an Earth clock."),sunBody:R6.describe("Authored sun position and apparent diameter."),moonBody:R6.optional().describe("Moon lit from sunBody.direction; omit for a moonless world."),starRotationDeg:e5.optional().describe("XYZ Euler rotation in degrees of the catalog sphere; default [0,0,0].")})]),t5=m.strictObject({nodes:m.array(m.string().min(1)).min(1).describe("Cabin nodes in the same exterior/interior GLB."),sources:Vk.optional().describe("Optional component fields overriding or extending host telemetry."),bindings:Hk,derived:d0.optional()}).superRefine((n,e)=>Gk(n,e)),Ns=m.number().finite(),Cu=Ns.min(0).max(1),Hne=m.array(Ns).length(3),bS=m.strictObject({atmosphere:m.strictObject({model:m.enum(["standard","isothermal"]).optional().describe("Standard layered Earth lapse rates (default), or a uniform-temperature isothermal atmosphere."),moistAir:m.boolean().optional().describe("Apply water-vapor ideal-gas density correction. Default false (dry reference air)."),temperatureK:Ns.positive().optional().describe("Temperature at referenceAltitude in kelvin; default 288.15 (15 \xB0C)."),pressurePa:Ns.nonnegative().optional().describe("Absolute barometric pressure at referenceAltitude in pascals; default 101325. Zero permits vacuum."),relativeHumidity:Cu.optional().describe("Relative humidity 0\u20131, default 0.5. Stored independently; does not select precipitation."),windVelocity:Hne.optional().describe("Air velocity [x,y,z] in world meters/second; default [0,0,0]. This is a velocity, not a meteorological FROM bearing."),referenceAltitude:Ns.optional().describe("World Y in meters where temperature and pressure apply; default 0."),gasConstant:Ns.positive().optional().describe("Specific gas constant in J/(kg\xB7K); default 287.05 for dry Earth air. Supports other atmospheres.")}).optional().describe("Physical atmospheric state; independent of the visual weather profile."),visibility:Ns.positive().optional().describe("Visual distance in meters; default 50000. Independent of clouds and precipitation. Renderer also respects a nearer authored fog limit."),clouds:m.strictObject({coverage:Cu.optional().describe("Sky coverage 0\u20131, default 0: the share of the sky the layer covers; 1 closes it."),density:Cu.optional().describe("Cloud optical density 0\u20131, default 0.65; independent of coverage."),baseAltitude:Ns.optional().describe("Cloud base at absolute world Y in meters, default 1800."),thickness:Ns.positive().optional().describe("Depth of the layer from base to top in meters, default 600."),scale:Ns.positive().optional().describe("Horizontal cloud-pattern repeat size in meters, default 16000."),type:m.enum(["cumulus","stratocumulus","stratus","cumulonimbus"]).optional().describe("Cloud type of the layer, default cumulus: separate heaps; stratocumulus a lumpy closed layer; stratus a flat sheet; cumulonimbus towering storm cells (give them a thick layer)."),cirrus:Cu.optional().describe("Coverage 0\u20131 of a thin, wispy high cirrus layer, default 0. Independent of the main layer."),cirrusAltitude:Ns.optional().describe("Cirrus layer at absolute world Y in meters, default 9000.")}).optional().describe("World-anchored, wind-advected volumetric cloud layer of one type, plus an optional high cirrus layer. Does not imply precipitation."),precipitation:m.strictObject({kind:m.enum(["none","rain","snow"]).optional().describe("Explicit precipitation phase, default none. Temperature never silently overrides it."),intensity:Cu.optional().describe("Visual precipitation intensity 0\u20131, default 0. Not a calibrated rainfall rate.")}).optional().describe("Precipitation independent of cloud coverage and visibility."),wind:m.strictObject({referenceHeight:Ns.positive().optional().describe("Height above ground in meters where atmosphere.windVelocity is measured; default 10."),shear:Ns.min(0).max(1).optional().describe("Power-law exponent of mean wind speed with height above ground, up to 600 m; default 0 (uniform). About 0.14 over open country, 0.3 over cities."),turbulence:Cu.optional().describe("Turbulence intensity 0\u20131, default 0: about 0.15 light chop, 0.4 moderate, 0.8 severe. Grows with wind speed and fades above the 1 km boundary layer."),gusts:Cu.optional().describe("Gust factor 0\u20131, default 0: along-wind speed swings as a fraction of the mean wind, advected with it."),terrain:Cu.optional().describe("Strength 0\u20131 of wind deflected by terrain slopes: ridge lift upwind, sink in the lee. Default 0.")}).optional().describe("Spatial and temporal structure of the wind around the mean atmosphere.windVelocity. Deterministic from seed and simulation time; consumes no simulation RNG."),seed:Ns.int().min(0).max(4294967295).optional().describe("Stable visual pattern seed, default 1. Does not consume simulation RNG.")});function h0(n={}){return{atmosphere:{temperatureK:288.15,model:"standard",moistAir:!1,pressurePa:101325,relativeHumidity:.5,referenceAltitude:0,gasConstant:287.05,...n.atmosphere,windVelocity:[...n.atmosphere?.windVelocity??[0,0,0]]},visibility:n.visibility??5e4,clouds:{coverage:0,density:.65,baseAltitude:1800,thickness:600,scale:16e3,type:"cumulus",cirrus:0,cirrusAltitude:9e3,...n.clouds},precipitation:{kind:"none",intensity:0,...n.precipitation},wind:{referenceHeight:10,shear:0,turbulence:0,gusts:0,terrain:0,...n.wind},seed:n.seed??1}}var dm=new Map;function jne(n={},e){let t=new Map(e?.base??dm);return{registry:t,issues:Qne(n,{registry:t,owner:e?.owner})}}function Ft(n,e,t,i){if(n.length===0)throw new Error("component name must be non-empty");if(dm.has(n)&&i?.override!==!0)throw new Error(`component "${n}" is already registered (pass { override: true } to replace)`);dm.set(n,{name:n,zod:e,meta:t})}function Qne(n,e){let t=[],i=e.registry;for(let[r,s]of Object.entries(n)){let o=i.get(r);if(o!==void 0&&!["scene","project","declared"].includes(o.meta.owner??"")){t.push({path:`${e.pointer??"/components"}/${dS(r)}`,code:"reserved_component",message:`component "${r}" is owned by ${o.meta.owner??"a registered package"} and cannot be redeclared`});continue}let a=m.looseObject({});if(s.schema!==void 0){let c=zk(s.schema,`${e.pointer??"/components"}/${dS(r)}/schema`)[0];if(c!==void 0){t.push({path:c.pointer,code:"component_schema_unsafe_pattern",message:`component "${r}" declares a pattern that ${c.reason}`,received:JSON.stringify(c.pattern),hint:"flatten the repetition (one quantifier per group), or drop the pattern",docsRef:"schemas/components.md"});continue}try{a=m.fromJSONSchema(s.schema)}catch(l){t.push({path:`${e.pointer??"/components"}/${dS(r)}/schema`,code:"component_schema_unsupported",message:`component "${r}" schema could not be compiled (${l instanceof Error?l.message:String(l)})`,hint:"use the JSON Schema subset: type object/array/number/integer/string/boolean, properties, required, additionalProperties, items, enum, const, min*/max*",docsRef:"schemas/components.md"});continue}}i.set(r,{name:r,zod:a,meta:{description:s.description,examples:s.examples,owner:e.owner??"declared"}})}return t}function N6(n=dm){return[...n.keys()].sort()}function dS(n){return n.replaceAll("~","~0").replaceAll("/","~1")}function Wne(n){if(n===void 0)return;let e=JSON.stringify(n);return e!==void 0&&e.length<=80?e:void 0}function qne(n,e,t,i){let r=i?.registry??dm,s=r.get(n);if(s===void 0){if(i?.allowUnknownComponents===!0)return[];let u=mS(n,N6(r));if(u===void 0)return[];let d=n.toLowerCase(),h=u.candidate.toLowerCase();return d===h||u.distance<=1&&d!==`${h}s`?[{path:t,code:"unknown_component",message:`unknown component "${n}"`,expected:`one of: ${N6(r).join(", ")}`,hint:`did you mean "${u.candidate}"? (or declare "${n}" under "components" if it is intentional)`,docsRef:"schemas/components.md"}]:[{path:t,code:"undeclared_component",message:`"${n}" is not a known component; accepted as a custom component`,hint:`declare "${n}" under "components" (description + examples) to document it and silence this notice \u2014 or did you mean "${u.candidate}"?`,docsRef:"schemas/components.md",severity:"notice"}]}if(i?.partial===!0)return[];let o=s.zod.safeParse(e);if(o.success)return[];let a=kk(o.error,e,s.zod),c=Wne(s.meta.examples[0]),l=!1;return a.map(u=>{let d={...u,path:t+u.path,docsRef:u.docsRef??s.meta.docsRef??"schemas/components.md"};return d.hint===void 0&&!l&&c!==void 0&&(d.hint=`e.g. "${n}": ${c}`,l=!0),d})}function Kne(n,e,t){if(n==null)return[];let i=[];for(let[r,s]of Object.entries(n))i.push(...qne(r,s,`${e}/${dS(r)}`,t));if(t?.partial!==!0&&n.collider3d!==void 0){let r=n.transform?.scale;r!==void 0&&(!Array.isArray(r)||r.length!==3||!r.every(s=>typeof s=="number"&&Number.isFinite(s)&&s>0)||r[0]!==r[1]||r[0]!==r[2])&&i.push({path:`${e}/transform/scale`,code:"unsupported_physics_scale",message:"collider3d requires positive uniform transform.scale",hint:"bake nonuniform or mirrored scale into collision geometry"})}return i}var L=m.number(),Ct=m.array(L).length(3),yS=m.array(L).length(4),Xne=m.json(),n5=n=>m.strictObject({pos:Ct.describe(`${n} position [x, y, z] in meters (Y-up).`),rot:yS.describe(`${n} orientation quaternion [x, y, z, w]; defaults to identity [0, 0, 0, 1].`).optional(),scale:Ct.describe("Per-axis scale factors [x, y, z]; defaults to [1, 1, 1].").optional(),teleport:m.boolean().describe("Client interpolation hint: when true the client snaps to this update instead of lerping from the previous tick.").optional()}),Zne=n5("World"),Jne=n5("Parent-relative"),jk=new Map([["primitive",{description:"built-in geometry named by ref",owner:"client"}],["gltf",{description:"an imported project asset",owner:"client"}]]),Yne=()=>`Render source: ${[...jk].map(([n,e])=>`'${n}' (${e.description})`).join(", ")}.`,eie={ref:m.string().min(1).describe("Primitive name (box, sphere, plane, cylinder) or, for gltf, the project asset id."),materialRef:m.string().describe("Material reference, e.g. 'palette:#rrggbb' or a project material doc id; overrides the asset's own materials.").optional(),primitive:m.strictObject({size:Ct.describe("Primitive extents [x, y, z] in meters: box = full extents; sphere = x is the diameter; cylinder = x diameter, y height; plane = x by z. Default [1, 1, 1].").optional()}).describe("Primitive geometry parameters (kind = primitive).").optional(),node:m.string().min(1).describe("gltf: named sub-node of the asset to instance (default: the whole scene).").optional(),visible:m.boolean().describe("Whether the object is drawn; default true.").optional(),shadows:m.strictObject({cast:m.boolean().describe("Whether this object casts shadows onto others.").optional(),receive:m.boolean().describe("Whether this object receives shadows from others.").optional()}).describe("Shadow participation flags.").optional(),animation:m.strictObject({clip:m.string().min(1).describe("Name of the glTF animation clip to play."),speed:L.describe("Playback rate multiplier (1 = authored speed).").optional(),loop:m.enum(["repeat","once","pingpong"]).describe("Loop mode: repeat, once (hold the last frame), or pingpong.").optional(),paused:m.boolean().describe("Freeze playback at pausedAtTick (default startTick).").optional(),pausedAtTick:m.int().nonnegative().describe("Simulation tick to hold while paused; serialize this when pausing so live and captured poses agree.").optional(),startTick:m.int().nonnegative().describe("Tick the clip started at; clip time = (tick - startTick) / tickRate * speed seconds (default 0).").optional()}).describe("gltf clip playback (client-owned); clip time derives deterministically from startTick.").optional()},tie=()=>{let n={};for(let e of jk.values())for(let[t,i]of Object.entries(e.fields??{}))n[t]=i.optional();return n},nie=()=>m.strictObject({kind:m.enum([...jk.keys()]).describe(Yne()),...eie,...tie()}),am=m.string().regex(/^#[0-9a-fA-F]{6}$/,{error:'must be "#rrggbb"'}),iie=m.strictObject({type:m.enum(["directional","point","spot"]).describe("Light type: directional (parallel rays), point (omnidirectional), or spot (cone). Directional/spot lights aim at the world origin by default."),color:am.describe("Light color as '#rrggbb'.").optional(),intensity:L.nonnegative().describe("Light intensity (three.js units; a unitless multiplier).").optional(),range:L.positive().describe("point/spot falloff distance in meters (absent = unlimited).").optional(),angleDeg:L.positive().describe("spot cone half-angle in degrees, measured from the aim direction (default 45).").optional(),penumbra:L.min(0).max(1).describe("spot soft-edge fraction 0..1 of the cone (default 0 = hard edge).").optional(),castShadow:m.boolean().describe("Whether this light casts shadows.").optional()}),rie=m.strictObject({sky:AS.optional().describe("Clear sky with sun, moon, stars and automatic lighting. Earth mode uses an explicit UTC epoch and observer; custom mode accepts authored body directions. See guide/sky.md."),ambient:m.strictObject({sky:am.describe("Sky-side (from above) ambient color '#rrggbb'.").optional(),ground:am.describe("Ground-side (from below) ambient color '#rrggbb'.").optional(),intensity:L.nonnegative().describe("Ambient intensity (unitless multiplier; default 1.1).").optional()}).describe("Hemisphere ambient light.").optional(),sun:m.strictObject({direction:Ct.describe("Vector [x, y, z] pointing FROM the world origin TOWARD the sun: the directional light is placed at this offset and shines back toward the origin, so y > 0 puts the sun above the horizon (Y-up). Default [5, 10, 7].").optional(),color:am.describe("Sun light color '#rrggbb'.").optional(),intensity:L.nonnegative().describe("Sun intensity (unitless multiplier; default 1.4).").optional(),castShadow:m.boolean().describe("Whether the sun casts shadows (also requires shadows != 'off').").optional()}).describe("Directional sun light.").optional(),background:am.describe("Background clear color '#rrggbb'.").optional(),fog:m.strictObject({color:am.describe("Fog color '#rrggbb'."),near:L.nonnegative().describe("Distance from the camera in meters at which fog starts.").optional(),far:L.positive().describe("Distance from the camera in meters at which fog is fully opaque.").optional()}).describe("Linear distance fog.").optional(),toneMapping:m.enum(["none","aces","agx","neutral"]).describe("Tone-mapping operator: none, aces, agx, or neutral (Khronos PBR Neutral: keeps authored base colors and saturation below the highlights).").optional(),exposure:L.positive().describe("Tone-mapping exposure multiplier (1 = neutral).").optional(),shadows:m.enum(["off","low","medium","high"]).describe("Shadow quality tier (shadow-map resolution); off disables all shadows.").optional()});Ft("boostMode",m.strictObject({enabled:m.boolean().describe("Enable 4\xD7 travel speed for people and vehicles.")}),{description:"World-wide 4\xD7 travel assist for people and vehicles. Control response times stay normal.",owner:"kernel",examples:[{enabled:!0}],docsRef:"guide/boost-mode.md"});Ft("weather",bS,{description:"Singleton physical atmosphere and visual weather: temperature, pressure, humidity, wind, independent cloud cover, precipitation and visibility. Readable by scripts and physics; see guide/weather.md.",examples:[{atmosphere:{temperatureK:282.15,pressurePa:100200,windVelocity:[7,0,3]},clouds:{coverage:.95},precipitation:{kind:"rain",intensity:.7},visibility:4500}]});Ft("audioSource",bne,{description:"Sound emitter on an entity: a sound-bank id, loop/autoplay, gain and pitch driven by signals (vehicleState.speed, listener.distance\u2026), and one-shot triggers. Positional when the entity has a transform. Render-side only; see guide/audio.md.",owner:"audio",docsRef:"guide/audio.md",examples:[{sound:"vehicle.engine.car",loop:!0,spatial:{refDistance:3,maxDistance:120},pitchFrom:{signal:"vehicleState.speed",curve:[[0,.8],[30,1.7]]},gainFrom:{signal:"vehicleInput.throttle",curve:[[0,.45],[1,1]]}}]});Ft("audioZone",yne,{description:"Area ambience: a looping sound that fades in as the listener enters a sphere or box around the entity (a waterfall, a machine room, a market).",owner:"audio",docsRef:"guide/audio.md",examples:[{sound:"ambience.water.stream",shape:{kind:"sphere",radius:12},fade:8}]});Ft("audioEnvironment",_ne,{description:"Singleton soundscape rules: bus gains, ambience layers gated on weather/sky/listener signals, music playlist, event \u2192 sound mappings and listener footsteps.",owner:"audio",docsRef:"guide/audio.md",examples:[{buses:{music:.5},ambience:[{sound:"ambience.rain.medium",when:{"weather.precipitation.kind":"rain"},gainFrom:{signal:"weather.precipitation.intensity",curve:[[0,0],[1,1]]}},{sound:"ambience.birds.day",when:{"sky.daylight":{min:.3}},fadeS:4}],music:{playlist:["music.ambient.dawn"],mode:"sequence"},events:{crash:{sound:"impact.metal.heavy"}},footsteps:{sound:"footstep.grass",strideM:.75}}]});var i5=m.number().int().min(0).max(4294967295),k6=i5.describe("Bitmask of collision layers this collider belongs to; a collides with b when (a.mask & b.layer) or (b.mask & a.layer) is non-zero."),D6=i5.describe("Bitmask of layers this collider collides with (see layer for the rule)."),F6=m.boolean().describe("Static colliders never move and are never pushed by other bodies.").optional(),sie=m.discriminatedUnion("shape",[m.strictObject({shape:m.literal("circle").describe("Circle collider in the XZ plane."),radius:L.positive().describe("Circle radius in meters (default 0.5).").optional(),layer:k6,mask:D6,isStatic:F6}),m.strictObject({shape:m.literal("aabb").describe("Axis-aligned box collider in the XZ plane."),halfExtents:m.array(L.positive()).length(2).describe("Half-extents [x, z] in meters of the box in the XZ plane (2.5D; default [0.5, 0.5]).").optional(),layer:k6,mask:D6,isStatic:F6})]),oie=m.strictObject({vel:Ct.describe("Velocity [x, y, z] in meters per second, integrated each tick (dt = 1/tickRate)."),slide:m.boolean().describe("When true, blocked motion slides along the contact surface instead of stopping.")}),aie=m.strictObject({speed:L.describe("Planar move speed in meters per second."),jumpSpeed:L.describe("Initial upward velocity in meters per second applied when jumping from the ground."),gravity:L.describe("Downward acceleration in meters per second squared applied to vy each tick."),vy:L.describe("Current vertical velocity in meters per second (kernel-owned)."),grounded:m.boolean().describe("True when the character stood on the ground as of the last tick (kernel-owned).")}),cie=m.strictObject({dir:m.array(L).length(2).describe("Desired planar move direction [x, z]: +x east, +z south (screen-down in top-down views); magnitudes above 1 are normalized."),jump:m.boolean().describe("Request a jump this tick (honored only while grounded).")}),lie=m.strictObject({ticksLeft:L.describe("Ticks remaining before the entity is despawned; decremented each tick.")}),uie=m.looseObject({hp:L.describe("Hit points.")}),die=m.looseObject({name:m.string().min(1).describe("Tag name used for selecting/grouping entities, e.g. 'enemy'.")});Ft("transform",Zne,{description:"World position + orientation. pos is required; rot defaults to identity.",owner:"kernel",examples:[{pos:[0,1.5,-3],rot:[0,0,0,1]}],docsRef:"schemas/components.md"});function hie(){Ft("renderable",nie(),{description:"Client render contract: a primitive, a gltf asset (by project asset id) with optional sub-node, material override, shadows, and clip playback, or a capability-registered kind.",owner:"client",examples:[{kind:"primitive",ref:"box",materialRef:"palette:#4363d8"},{kind:"gltf",ref:"crate",animation:{clip:"spin",loop:"repeat"}}],docsRef:"schemas/components.md"},{override:!0})}hie();Ft("livery",Lne,{description:"Reusable model paint slots, bound surface markings and selectable liveries. Visual only.",owner:"client",docsRef:"guide/liveries.md",examples:[{selected:"red",slots:{body:{materials:["body-paint"]}},variants:[{id:"red",label:"Red",provenance:{kind:"original",note:"Original paint.",references:[]},paints:{body:{color:"#b8463d"}}}]}]});Ft("model.signals",Gne,{description:"Bind same-entity simulation fields and named numeric expressions to GLB transforms and visibility. Supports calibration, cyclic needles and timed response. Visual only; no physics writes.",owner:"client",examples:[{sources:{speed:{component:"vehicleState",path:["speed"]}},derived:{speedKmh:{op:"multiply",args:["speed",3.6]}},bindings:[{node:"speed-pointer",source:"speedKmh",property:"rotation",axis:"z",keys:[[0,-2],[60,0],[180,2]],responseSeconds:.2}]}],docsRef:"guide/vehicle-interiors.md"});Ft("light",iie,{description:"A light source at the entity transform (directional/point/spot).",owner:"client",examples:[{type:"point",color:"#ffdca8",intensity:2,range:12}],docsRef:"schemas/components.md"});Ft("environment",rie,{description:"Singleton scene environment: optional Earth/custom sky, ambient/sun lighting, background, fog, tone mapping, shadow quality tier.",owner:"client",examples:[{ambient:{sky:"#ffffff",ground:"#444455",intensity:1.1},sun:{direction:[5,10,7],intensity:1.4,castShadow:!0},shadows:"medium"},{sky:{mode:"earth",observer:{latitude:47.6,longitude:-122.3},time:{epochMs:17189424e5,scale:60}},toneMapping:"agx"}],docsRef:"schemas/components.md"});Ft("lifetime",lie,{description:"Auto-despawn countdown in ticks.",owner:"kernel",examples:[{ticksLeft:30}],docsRef:"schemas/components.md"});Ft("collider",sie,{description:"2.5D kinematic collider (circle or XZ AABB) with layer/mask bitmasks.",owner:"kernel/kinematics",examples:[{shape:"circle",radius:.5,layer:1,mask:1}],docsRef:"schemas/components.md"});Ft("kinematicBody",oie,{description:"Velocity-driven body for the kinematic collision layer.",owner:"kernel/kinematics",examples:[{vel:[0,0,0],slide:!0}],docsRef:"schemas/components.md"});Ft("character",aie,{description:"Kinematic character controller state (speed/jump/gravity + kernel-owned vy/grounded).",owner:"kernel/character",examples:[{speed:6,jumpSpeed:8,gravity:20,vy:0,grounded:!0}],docsRef:"schemas/components.md"});Ft("moveIntent",cie,{description:"Desired planar move direction + jump flag, consumed by the character controller.",owner:"kernel/character",examples:[{dir:[1,0],jump:!1}],docsRef:"schemas/components.md"});var fie=m.discriminatedUnion("type",[m.strictObject({type:m.literal("ball").describe("Sphere."),radius:L.positive().describe("Sphere radius in meters.")}),m.strictObject({type:m.literal("cuboid").describe("Axis-aligned box (in the collider frame)."),hx:L.positive().describe("Half-extent along X in meters."),hy:L.positive().describe("Half-extent along Y in meters."),hz:L.positive().describe("Half-extent along Z in meters.")}),m.strictObject({type:m.literal("capsule").describe("Capsule aligned with the Y axis."),halfHeight:L.nonnegative().describe("Half the length of the cylindrical section along Y in meters (caps excluded)."),radius:L.positive().describe("Capsule radius in meters.")}),m.strictObject({type:m.literal("convexHull").describe("Convex hull of a point cloud."),points:m.array(L).min(12).describe("Flat [x, y, z, x, y, z, ...] point list in meters (at least 4 points); the shape is their convex hull.")}),m.strictObject({type:m.literal("trimesh").describe("Triangle mesh (static geometry)."),vertices:m.array(L).min(9).describe("Flat [x, y, z, ...] vertex positions in meters."),indices:m.array(m.int().nonnegative()).min(3).describe("Triangle vertex indices, three per triangle.")}),m.strictObject({type:m.literal("asset").describe("Collision geometry from a project asset's sidecar."),assetId:m.string().min(1).describe("Project asset id whose sidecar collision geometry is used."),collision:m.enum(["hull","trimesh"]).describe("Which sidecar geometry to use: hull (convex, default) or trimesh.").optional(),index:m.int().nonnegative().describe("Index of the sidecar hull to use when the asset has several (default 0).").optional()}),m.strictObject({type:m.literal("heightfield").describe("Terrain heightfield."),ref:m.string().min(1).describe("Heightfield reference id resolved by the host (e.g. the scene terrain).")})]),pie=m.strictObject({shape:fie.describe("Collision shape."),offset:Ct.describe("Shape offset [x, y, z] in meters relative to the entity transform.").optional(),rotOffset:yS.describe("Shape rotation quaternion [x, y, z, w] relative to the entity transform.").optional(),layer:m.int().min(0).max(65535).describe("16-bit collision-group bitmask this collider belongs to (default 1).").optional(),mask:m.int().min(0).max(65535).describe("16-bit bitmask of groups this collider collides with (default 0xffff = all).").optional(),sensor:m.boolean().describe("Sensor colliders detect overlaps (collision events) but produce no contact forces.").optional(),events:m.boolean().describe("Emit 'collision' / 'collisionEnd' world events for this collider.").optional(),restitution:L.min(0).describe("Bounciness coefficient (0 = inelastic).").optional(),friction:L.min(0).describe("Coulomb friction coefficient.").optional(),density:L.positive().describe("Mass density in kg/m^3 used to derive the body mass from the shape volume.").optional()}),mie=m.strictObject({body:m.enum(["dynamic","fixed","kinematicPosition"]).describe("Body type: dynamic (simulated), fixed (immovable), or kinematicPosition (driven by transform writes, e.g. characters)."),gravityScale:L.describe("Multiplier on scene gravity for this body (1 = normal, 0 = weightless).").optional(),linearDamping:L.min(0).describe("Linear velocity damping coefficient per second (0 = none).").optional(),angularDamping:L.min(0).describe("Angular velocity damping coefficient per second (0 = none).").optional(),ccd:m.boolean().describe("Enable continuous collision detection for fast-moving bodies.").optional(),lockRot:m.boolean().describe("Lock all rotations so the body never tumbles.").optional()}),gie=m.strictObject({type:m.enum(["fixed","revolute","spherical","prismatic"]).describe("Joint type: fixed, revolute (hinge), spherical (ball), or prismatic (slider)."),other:m.string().min(1).describe("Entity id of the other body."),anchor1:Ct.describe("Anchor point [x, y, z] in meters in this body's local frame."),anchor2:Ct.describe("Anchor point [x, y, z] in meters in the other body's local frame."),axis:Ct.describe("Joint axis [x, y, z] in this body's local frame (revolute/prismatic).").optional(),limits:m.array(L).length(2).describe("[min, max] joint limits: radians for revolute, meters for prismatic.").optional(),motor:m.strictObject({targetVel:L.describe("Target joint velocity: rad/s for revolute, m/s for prismatic."),maxForce:L.positive().describe("Maximum force (N) or torque (N*m) the motor may apply.")}).describe("Velocity motor driving the joint (revolute/prismatic).").optional()}),Aie=m.strictObject({linear:Ct.describe("Force [x, y, z] in newtons applied at the center of mass every tick while present.").optional(),torque:Ct.describe("Torque [x, y, z] in N*m applied every tick while present.").optional()}),bie=m.strictObject({v:Ct.describe("Linear impulse [x, y, z] in N*s (kg*m/s) applied once.").optional(),torque:Ct.describe("Angular impulse [x, y, z] in N*m*s applied once.").optional()}),yie=m.strictObject({linear:Ct.describe("Linear velocity [x, y, z] in m/s to set once.").optional(),angular:Ct.describe("Angular velocity [x, y, z] in rad/s to set once.").optional()}),vie=m.strictObject({linear:Ct.describe("Current linear velocity [x, y, z] in m/s (plugin-written each tick)."),angular:Ct.describe("Current angular velocity [x, y, z] in rad/s (plugin-written each tick).")});Ft("collider3d",pie,{description:"3D collider (ball/cuboid/capsule/hull/trimesh/asset/heightfield) with layer/mask, sensor, and material params. Static without a rigidbody.",owner:"physics-rapier",examples:[{shape:{type:"cuboid",hx:10,hy:.5,hz:10}}],docsRef:"schemas/components.md"});Ft("rigidbody",mie,{description:"3D rigid-body dynamics: dynamic, fixed, or kinematicPosition (characters).",owner:"physics-rapier",examples:[{body:"dynamic"}],docsRef:"schemas/components.md"});Ft("joint",gie,{description:"Impulse joint to another body (fixed/revolute/spherical/prismatic + limits/motor).",owner:"physics-rapier",examples:[{type:"revolute",other:"chassis",anchor1:[0,0,1],anchor2:[0,0,0],axis:[0,0,1]}],docsRef:"schemas/components.md"});Ft("force",Aie,{description:"Continuous force/torque applied every tick while present.",owner:"physics-rapier",examples:[{linear:[0,20,0]}],docsRef:"schemas/components.md"});Ft("impulse",bie,{description:"One-shot impulse/torque; consumed the tick it is applied.",owner:"physics-rapier",examples:[{v:[10,0,0]}],docsRef:"schemas/components.md"});Ft("setVelocity",yie,{description:"One-shot velocity set; consumed the tick it is applied.",owner:"physics-rapier",examples:[{linear:[0,0,5]}],docsRef:"schemas/components.md"});Ft("velocity",vie,{description:"Opt-in per-tick body velocity mirror (presence = subscription; plugin-written).",owner:"physics-rapier",examples:[{linear:[0,0,0],angular:[0,0,0]}],docsRef:"schemas/components.md"});var xie=m.strictObject({id:m.string().min(1).describe("Entity id of the parent."),onParentDestroyed:m.enum(["destroy","detach"]).describe("When the parent is destroyed: destroy this entity too (default, cascading) or detach it and keep it alive.").optional()}),_ie=m.strictObject({timers:m.array(m.strictObject({id:m.string().min(1).describe("Timer id, unique within this entity."),ticksLeft:m.int().positive().describe("Ticks until the timer fires; decremented each tick."),event:m.string().min(1).describe("World event type emitted when the timer fires (payload carries entity + timerId)."),payload:Xne.describe("Optional JSON payload included in the emitted event.").optional(),repeatEvery:m.int().positive().describe("If set, the timer re-arms with this many ticks after firing (repeating).").optional()})).describe("Active timers on this entity.")}),wie=m.strictObject({tweens:m.array(m.strictObject({id:m.string().min(1).describe("Optional tween id.").optional(),component:m.string().min(1).describe("Name of the component whose value is animated."),path:m.string().min(1).describe("Select-style value path within the component, e.g. 'pos', 'pos[1]', or 'primitive.size'."),from:m.union([L,m.array(L)]).describe("Start value (number or number array); defaults to the current value when the tween starts.").optional(),to:m.union([L,m.array(L)]).describe("End value (number or number array, same arity as from)."),ticks:m.int().positive().describe("Duration in ticks."),elapsed:m.int().nonnegative().describe("Ticks elapsed so far (kernel-owned; starts at 0).").optional(),easing:m.enum(["linear","quadIn","quadOut","quadInOut","cubicIn","cubicOut","cubicInOut"]).describe("Easing curve (default linear).").optional(),loop:m.enum(["none","loop","pingpong"]).describe("After completing: none (remove, default), loop (restart from `from`), or pingpong (swap from/to).").optional(),emitOnComplete:m.string().describe("World event type emitted (payload { entity }) each time the tween completes.").optional()})).describe("Active tweens on this entity.")}),Sie=m.strictObject({state:m.string().min(1).describe("Current state name."),transitions:m.array(m.strictObject({from:m.string().min(1).describe("State the transition leaves ('*' matches any state)."),event:m.string().min(1).describe("World event type that triggers the transition (events with payload.entity only match that entity)."),to:m.string().min(1).describe("State entered.")})).describe("Transition table, checked in order; the first match wins.")});Ft("parent",xie,{description:"Attach to a parent entity: transform becomes parent.transform \xD7 localTransform each tick.",owner:"kernel/gameplay",examples:[{id:"turret-base"}],docsRef:"schemas/components.md"});Ft("localTransform",Jne,{description:"Parent-relative transform for entities carrying `parent`.",owner:"kernel/gameplay",examples:[{pos:[0,1,0],rot:[0,0,0,1]}],docsRef:"schemas/components.md"});Ft("timer",_ie,{description:"Snapshot-safe countdown timers that emit events (one-shot or repeating). Replaces callbacks.",owner:"kernel/gameplay",examples:[{timers:[{id:"respawn",ticksLeft:90,event:"respawn_ready"}]}],docsRef:"schemas/components.md"});Ft("tween",wie,{description:"Data-driven value animation over ticks: component + select-style path, lerp with easing.",owner:"kernel/gameplay",examples:[{tweens:[{component:"transform",path:"pos[1]",to:4,ticks:30,easing:"quadOut"}]}],docsRef:"schemas/components.md"});Ft("fsm",Sie,{description:"Minimal event-driven state machine: transitions fire on world events targeting the entity.",owner:"kernel/gameplay",examples:[{state:"idle",transitions:[{from:"idle",event:"player_seen",to:"aggro"}]}],docsRef:"schemas/components.md"});Ft("health",uie,{description:"Common gameplay hit-points component.",owner:"content",examples:[{hp:100}],docsRef:"schemas/components.md"});Ft("tag",die,{description:'Named tag for selecting/grouping entities (e.g. tag.name === "enemy").',owner:"content",examples:[{name:"enemy"}],docsRef:"schemas/components.md"});var r5=m.array(L.positive()).length(2),Eie=m.array(L).length(2);Ft("platformSolid",m.strictObject({halfExtents:r5.describe("Static XY box half-width/half-height in world meters. Rotation and visual scale do not affect collision."),oneWay:m.boolean().describe("Only stop descending bodies crossing the top; default false.").optional()}),{owner:"kernel",description:"Static XY solid for physics.engine=platformer; Z is ignored.",examples:[{halfExtents:[3,.5]}]});Ft("platformBody",m.strictObject({halfExtents:r5.describe("Moving XY box half-width/half-height, world meters. Z remains unchanged."),vel:Eie.optional().describe("XY velocity in meters/second; default [0,0]."),speed:L.positive().optional().describe("Maximum horizontal speed; default 7 m/s."),acceleration:L.positive().optional().describe("Horizontal acceleration/braking; default 45 m/s squared."),gravity:L.positive().optional().describe("Downward acceleration; default 28 m/s squared."),jumpSpeed:L.positive().optional().describe("Jump velocity; default 11 m/s."),grounded:m.boolean().optional().describe("Output: landed in the last physics tick."),coyoteTicks:m.int().nonnegative().optional().describe("Jump grace after leaving a ledge; default 3 ticks."),bufferTicks:m.int().nonnegative().optional().describe("Jump input buffer before landing; default 4 ticks."),grace:m.int().nonnegative().optional().describe("Runtime remaining coyote ticks; checkpointed."),buffered:m.int().nonnegative().optional().describe("Runtime remaining buffered jump ticks; checkpointed.")}),{owner:"kernel",description:"Deterministic XY platform controller: gravity, swept wall/floor/ceiling collision, jump buffering and coyote time.",examples:[{halfExtents:[.4,.6],speed:7,jumpSpeed:11}]});Ft("platformIntent",m.strictObject({move:L.min(-1).max(1).describe("Horizontal intent -1..1."),jump:m.boolean().optional().describe("One-shot jump request, consumed by the controller. Send on press, not every tick."),jumpHeld:m.boolean().optional().describe("Hold for full height; false cuts upward velocity for a short hop. Default true.")}),{owner:"kernel",description:"Input to a platformBody. Scripts translate declared commands to this component.",examples:[{move:1,jump:!0,jumpHeld:!0}]});function cl(n){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.description?t:t.describe(`External ${e} setting.`)]))}var Tie=m.enum(["city","hatchback","sedan","fastback","coupe","roadster","wagon","crossover","suv","offroad","pickup","van","cargo-van","box-truck","motorhome","bus","light-rail","bicycle","motorcycle","scooter"]).describe("Generic body style, independent of any make or model name."),s5=m.string().min(1).describe("Name-free display label such as 'Full-size pickup', for hosts that must not show a manufacturer, model or type name.");Ft("glass",Pne,{description:"Breakable glass surfaces with metric geometry, material fracture and independent frame/interlayer retention.",owner:"kernel/glass",docsRef:"guide/glass.md",examples:[{surfaces:[{id:"windshield",material:"laminated",center:[0,1.2,.8],rotation:[0,0,0,1],size:[1.4,.7],thickness:.005}]}]});Ft("glassState",One,{description:"Persistent glass fracture, retention and release state. Missing panes are intact; remove the component to repair.",owner:"kernel/glass",docsRef:"guide/glass.md",examples:[{surfaces:{}}]});var Mie=m.strictObject(cl({collisionParts:m.array(m.strictObject({id:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/).describe("Unique part id used by damage and debris state."),role:m.enum(["frontWheel","rearWheel","panel","engine"]).describe("Wheel axle, exterior panel or drivetrain role."),hinge:m.strictObject({pivot:Ct.describe("Hinge pivot in model coordinates, meters."),axis:Ct.refine(n=>Math.abs(Math.hypot(...n)-1)<1e-5,"Expected a unit axis.").describe("Unit hinge axis in model coordinates."),angle:L.describe("Hinge rotation in radians at full actuator travel."),actuator:m.string().min(1).describe("Vehicle actuator id supplying hinge travel.")}).optional().describe("Panel hinge driven by the named vehicle actuator."),center:Ct.describe("Debris origin in model coordinates, meters."),probes:m.array(Ct).min(1).max(64).describe("Sphere centers in model coordinates, meters."),radius:L.positive().describe("Probe and debris collision radius, meters."),massFraction:L.positive().max(1).describe("Share of the original mass removed on separation."),breakSpeed:L.positive().describe("Normal impact speed that breaks an intact joint, m/s."),nodes:m.array(m.string().min(1)).min(1).describe("Exact GLB node names owned by this part.")})).max(64).superRefine((n,e)=>{new Set(n.map(i=>i.id)).size!==n.length&&e.addIssue({code:"custom",message:"Collision part ids must be unique."});let t=n.flatMap(i=>i.nodes);new Set(t).size!==t.length&&e.addIssue({code:"custom",message:"Each node must belong to one collision part."}),n.reduce((i,r)=>i+r.massFraction,0)>=.8&&e.addIssue({code:"custom",message:"Detachable parts must leave at least 20% of the chassis mass."})}).optional().describe("Independent wheels, panels and engines: model-space sphere probes, joint strength in m/s and GLB node ownership."),actuators:j6.optional(),label:m.string().min(1),bodyStyle:Tie.optional(),genericLabel:s5.optional(),width:L.positive(),length:L.positive(),height:L.positive(),centerOfMass:Ct,wheelbase:L.positive(),wheelTrack:L.nonnegative().describe("Lateral wheel spacing in meters; zero for cycles."),wheelRadius:L.positive(),mass:L.positive(),engineForce:L.positive(),maxSpeed:L.positive(),reverseSpeed:L.nonnegative().describe("Maximum reverse speed; zero disables powered reverse."),brakeDeceleration:L.positive(),maxSteer:L.nonnegative(),grip:L.positive().describe("Peak tire friction on dry pavement as an acceleration in m/s\xB2; grip / 9.81 is the friction coefficient. Rain and snow lower it."),driverEye:Ct,steeringRate:L.positive(),steeringFadeSpeed:L.positive(),rollingResistance:L.nonnegative(),aerodynamicResistance:L.nonnegative(),terrainAlignRate:L.positive(),supportTolerance:L.nonnegative(),maxStepHeight:L.nonnegative(),maxSlope:L.positive(),drive:m.enum(["front","rear","all"]).optional().describe("Driven wheels. Default front."),corneringStiffness:L.positive().optional().describe("Tire side force per unit load per radian of slip angle before it saturates at the grip limit. Default 18."),brakeBias:L.min(0).max(1).optional().describe("Share of braking force on the front wheels. Default 0.65."),yawInertia:L.positive().optional().describe("Yaw moment of inertia in kg m\xB2. Default mass * (length\xB2 + width\xB2) / 12."),rollStiffness:L.nonnegative().optional().describe("Body roll in radians per g of cornering. Default 0.05."),pitchStiffness:L.nonnegative().optional().describe("Body pitch in radians per g of braking or acceleration. Default 0.03. Weight shifts between the axles through this pitch; 0 keeps the axle loads fixed."),suspensionFrequency:L.positive().optional().describe("Suspension natural frequency in Hz for body roll and pitch. Default 1.5."),suspensionDamping:L.positive().optional().describe("Suspension damping ratio. Default 0.5."),cycle:m.strictObject({maxLean:L.positive().max(1.2).describe("Maximum balanced inward lean in radians."),riderLean:L.min(0).max(1).describe("Forward torso lean in radians."),handlebarPivot:Ct.describe("Steering pivot in model-local meters."),grips:m.tuple([Ct,Ct]).describe("Left and right hand targets in model-local meters."),footrests:m.tuple([Ct,Ct]).describe("Left and right ankle targets in model-local meters."),pedals:m.strictObject({center:Ct.describe("Crank centre in model-local meters."),radius:L.positive().describe("Crank arm length in meters."),halfWidth:L.positive().describe("Distance from centreline to each pedal in meters."),ratio:L.positive().describe("Wheel revolutions per crank revolution.")}).optional().describe("Bicycle crank geometry and gearing; omitted on motor vehicles.")}).optional().describe("Self-balancing cycle handling and rider contact points. Driver seat anchors the pelvis.")})).superRefine((n,e)=>{n.cycle===void 0&&n.wheelTrack===0&&e.addIssue({code:"custom",path:["wheelTrack"],message:"Vehicles without cycle tuning need a positive wheel track."})}),o5=zne.describe("Exterior moving parts (gear legs and doors, flaps, control surfaces, doors) posed from the interior signals; bindings may use keyframed curves.");function a5(n,e,t){let i=new Set((n.interior?.bindings??[]).map(r=>JSON.stringify([r.node,r.property,r.axis])));n.animation?.bindings.forEach((r,s)=>{i.has(JSON.stringify([r.node,r.property,r.axis]))&&e.addIssue({code:"custom",path:[...t,"animation","bindings",s],message:"Node transform channel is already bound by interior"})})}var c5=m.strictObject(cl({wheelNodes:m.array(m.string().min(1)).min(1),frontWheelNodes:m.array(m.string().min(1)).min(1),steeringWheelNode:m.string().min(1).optional(),paintMaterial:m.string().min(1),interior:t5.optional(),animation:o5.optional()})).superRefine((n,e)=>a5(n,e,[]));Ft("water",Sne,{description:"Deterministic swells and current for boats; heights and coverage come from the host water field.",owner:"kernel/boats",docsRef:"guide/boats.md",examples:[{waves:[],current:[0,0]}]});Ft("boat",m.strictObject({kind:m.string().min(1).describe("Stable external vessel entity/type id."),spec:Ene.describe("Complete hull dimensions and handling configuration."),visual:c5.safeExtend({wheelNodes:m.array(m.string().min(1)).describe("Wheel nodes; empty for ordinary hulls."),frontWheelNodes:m.array(m.string().min(1)).describe("Steering wheel nodes; usually empty.")}).describe("Named GLB nodes, material and animation bindings."),color:m.string().optional().describe("Optional hull paint override.")}),{description:"Waterline-aligned powered hull with data-driven handling and shared seats.",owner:"kernel/boats",docsRef:"guide/boats.md",examples:[{kind:"demo.boat",spec:{label:"Launch",length:6,width:2.4,height:2,draft:.5,mass:1200,thrust:3600,maxSpeed:14,reverseSpeed:3,turnRate:.5,turnResponse:1,lateralDrag:2,buoyancyFrequency:1,driverEye:[.5,1.2,0]},visual:{wheelNodes:[],frontWheelNodes:[],paintMaterial:"hull"}}]});Ft("boatInput",Tne,{description:"Helm intent: signed thrust, steering and low-speed anchor. Only the driver controls it.",owner:"kernel/boats",docsRef:"guide/boats.md",examples:[{throttle:0,steering:0,anchor:!0}]});Ft("boatState",Mne,{description:"Snapshot-safe hull motion, buoyancy and anchoring; owned by installBoats.",owner:"kernel/boats",docsRef:"guide/boats.md",examples:[{speed:0,lateralSpeed:0,velocity:[0,0],yaw:0,yawRate:0,steer:0,pitch:0,roll:0,vy:0,anchored:!0,grounded:!1,waitingForWater:!1}]});Ft("vehicle",m.strictObject({kind:m.string().min(1).describe("Stable external entity/type id."),color:m.string().regex(/^#[0-9a-fA-F]{6}$/).describe("Body paint as an sRGB #rrggbb color."),spec:Mie.describe("Complete data-driven chassis and handling configuration."),visual:c5.describe("Named GLB nodes/material used by the generic client.")}),{description:"External wheeled-vehicle instance: stable id, paint, complete physics tuning, and GLB bindings.",owner:"kernel/vehicles",examples:[{kind:"example.vehicle",color:"#566d82",spec:{label:"Example car",width:1.8,length:4.6,height:1.5,centerOfMass:[0,.55,0],wheelbase:2.75,wheelTrack:1.5,wheelRadius:.31,mass:1450,engineForce:6200,maxSpeed:42,reverseSpeed:8,brakeDeceleration:9.5,maxSteer:.56,grip:8,driverEye:[.4,1.14,.25],steeringRate:1.8,steeringFadeSpeed:18,rollingResistance:.15,aerodynamicResistance:.0025,terrainAlignRate:1.8,supportTolerance:.08,maxStepHeight:.4,maxSlope:.61},visual:{wheelNodes:["wheel-front-left"],frontWheelNodes:["wheel-front-left"],steeringWheelNode:"steering-wheel",paintMaterial:"vehicle-paint-and-trim"}}],docsRef:"guide/vehicles.md"});Ft("vehicleInput",m.strictObject({actuators:Q6.optional().describe("Mechanism targets from zero to one, or on/off selections."),throttle:L.min(-1).max(1).describe("Signed accelerator; opposite input brakes to zero before reversing."),steering:L.min(-1).max(1).describe("Steering intent -1..1; positive turns right."),brake:m.boolean().describe("Apply the service brakes (all wheels, anti-lock) while true; holds the car at rest."),handbrake:m.boolean().optional().describe("Lock the rear wheels while true: they slide instead of rolling, for handbrake turns.")}),{description:"Driver intent: signed throttle (negative brakes then reverses), signed steering (positive right), service brake and optional handbrake.",owner:"kernel/vehicles",examples:[{throttle:1,steering:0,brake:!1}],docsRef:"guide/vehicles.md"});Ft("vehicleState",m.strictObject({damage:m.record(m.string(),m.strictObject({integrity:L.min(0).max(1),detached:m.boolean()})).optional().describe("Persistent joint integrity and separation, keyed by collision part id."),debris:m.array(m.strictObject({part:m.string().min(1).describe("Collision part id of the separated geometry."),pos:Ct.describe("Debris origin in world coordinates, meters."),rot:yS.describe("Debris orientation as a quaternion."),velocity:Ct.describe("World-space linear velocity, m/s."),angularVelocity:Ct.describe("Local angular velocity about X, Y and Z, radians/s."),age:L.nonnegative().describe("Elapsed simulation seconds since separation.")})).max(64).optional().describe("Detached parts in world coordinates; expire after 20 simulated seconds without repairing the vehicle."),actuators:W6.optional().describe("Current mechanism positions and cycle phases, from zero to one."),boosted:m.boolean().optional().describe("Speeds include the 4\xD7 travel boost; kernel-owned."),speed:L.describe("Signed forward speed in meters per second."),steer:L.describe("Current front wheel steering angle in radians. Positive turns right."),yaw:L.describe("Chassis rotation about Y in radians; zero faces +Z."),pitch:L.describe("Chassis rotation about local X in radians from terrain support, nose down positive."),roll:L.describe("Chassis rotation about local Z in radians from terrain support, right side down positive."),vy:L.describe("Vertical velocity in meters per second."),grounded:m.boolean().describe("Whether wheel support currently carries the chassis."),waitingForTerrain:m.boolean().describe("Motion is paused because one or more wheel samples have no terrain."),wheelAngle:L.describe("Accumulated wheel spin angle in radians, wrapped each revolution."),pedalAngle:L.optional().describe("Cycle crank angle in radians; advances under forward power and holds while coasting or braking."),lateralSpeed:L.optional().describe("Sideways speed in meters per second, positive to the left: the slide."),yawRate:L.optional().describe("Yaw rate in radians per second, positive turning left."),bodyPitch:L.optional().describe("Suspension pitch in radians on top of the terrain, nose down positive."),bodyPitchRate:L.optional().describe("Suspension pitch rate in radians per second."),bodyRoll:L.optional().describe("Suspension roll in radians on top of the terrain, right side down positive."),bodyRollRate:L.optional().describe("Suspension roll rate in radians per second."),skid:L.min(0).max(1).optional().describe("0\u20131: how far the tires are past their grip (sliding, wheelspin, locked wheels).")}),{description:"Snapshot-safe chassis state. Speeds in m/s, angles in radians; owned by installVehicles.",owner:"kernel/vehicles",examples:[{speed:0,steer:0,yaw:0,pitch:0,roll:0,vy:0,grounded:!0,waitingForTerrain:!1,wheelAngle:0}],docsRef:"guide/vehicles.md"});Ft("mountable",m.strictObject({seats:m.array(m.strictObject({id:m.string().min(1).describe("Unique seat identifier within this mount."),role:m.enum(["driver","passenger"]).describe("Only a driver seat grants vehicle control."),position:Ct.describe("Local rider/camera anchor in meters, transformed by the chassis quaternion.")})).min(1).describe("Available seat definitions. Each seat can hold one actor."),entries:m.array(Ct).min(1).optional().describe("Optional boarding points in local meters, e.g. a boat gangway; seat anchors remain valid entry points."),exits:m.array(Ct).min(1).describe("Ordered local foot positions to check when dismounting."),reach:L.positive().describe("Maximum distance in meters from the actor to the seat to enter.")}),{description:"Mount points in local meters, ordered safe exit candidates, and interaction reach. Seat position is the rider camera anchor.",owner:"kernel/vehicles",examples:[{seats:[{id:"driver",role:"driver",position:[.4,1.14,.25]}],exits:[[-1.56,0,.25],[1.56,0,.25]],reach:3}],docsRef:"guide/vehicles.md"});Ft("mounted",m.strictObject({vehicle:m.string().min(1).describe("Entity ID of the mount."),seat:m.string().min(1).describe("Occupied seat ID in the mountable component.")}),{description:"Rider-to-mount relationship. Occupied seats are exclusive; mounted characters bypass walking physics.",owner:"kernel/vehicles",examples:[{vehicle:"car-1",seat:"driver"}],docsRef:"guide/vehicles.md"});var cS=m.strictObject(cl({node:m.string().min(1),axis:m.enum(["x","y","z"]),multiplier:L})),Iie=m.strictObject(cl({wingPosition:Ct,wingArea:L.positive(),controlAuthoritySpeed:L.positive().describe("Reference equivalent airspeed in m/s for the control, stability and damping rates."),maxControlAuthority:L.positive().describe("Cap on aileron, elevator and rudder power relative to the reference speed."),pitchAuthority:L.positive().describe("Angle of attack in radians that full elevator adds to the trim angle."),pitchResponse:L.positive().describe("Elevator travel per second, in full deflections."),stallPitchRate:L.nonnegative().describe("Nose-down pitch rate in rad/s at full flow separation (the stall break)."),rollAuthority:L.positive().describe("Roll rate in rad/s at full aileron and reference speed; grows with speed up to maxControlAuthority."),rollResponse:L.positive().describe("Roll damping in 1/s at reference speed; grows with airspeed."),rudderAuthority:L.positive().describe("Yaw acceleration in rad/s\xB2 at full rudder and reference speed; propwash keeps some at low speed."),groundSteerSpeed:L.positive().describe("Ground speed in m/s at which tailwheel steering reaches full turn rate."),groundLevelRate:L.positive(),maxGroundPitch:L.positive(),camberAngle:L,flapLift:L.nonnegative(),postStallFlapEffect:L.nonnegative(),stallAngle:L.positive(),criticalMach:L.positive().optional().describe("Mach at which compressibility wave drag begins; omitted disables wave drag."),waveDrag:L.nonnegative().optional().describe("Wave drag coefficient at criticalMach + 0.25; default 0."),maxEquivalentAirspeed:L.positive().optional().describe("Airframe operating limit in m/s equivalent airspeed; alert only."),maxMach:L.positive().optional().describe("Airframe Mach operating limit; alert only."),gearLimitSpeed:L.positive().optional().describe("Maximum equivalent airspeed with gear extended, m/s; alert only."),flapLimitSpeed:L.positive().optional().describe("Maximum equivalent airspeed with flaps extended, m/s; alert only."),groundEffect:m.boolean().optional().describe("Reduce wing induced drag near the ground; default false."),departure:m.strictObject({onsetAngle:L.min(0).max(Math.PI/2).describe("High-alpha departure onset, radians."),fullAngle:L.positive().max(Math.PI/2).describe("Fully developed departure incidence, radians; greater than onsetAngle."),yawInstability:L.nonnegative().describe("Separated-flow yaw growth rate, per second."),yawSaturationRate:L.positive().describe("Autorotation saturation scale, radians per second."),rudderBlanking:L.min(0).max(1).describe("Fraction of rudder authority lost at full departure."),pitchBlanking:L.min(0).max(1).describe("Fraction of pitch stability and control lost at full departure."),aileronReversal:L.min(0).max(1).describe("Aileron reversal: 0 unchanged, 0.5 ineffective, 1 reversed.")}).refine(n=>n.fullAngle>n.onsetAngle,"Full departure angle must exceed onset.").optional(),stallTransitionAngle:L.positive().optional().describe("Radians beyond stallAngle over which flow separates smoothly. Default 0.12."),pitchFrequency:L.positive().optional().describe("Short-period natural frequency in rad/s at reference speed. Default 3.5."),pitchDamping:L.positive().optional().describe("Short-period damping ratio. Default 0.7."),maxLoadFactor:L.positive().optional().describe("Load factor in g that full back stick pulls at high speed. Default 6."),minLoadFactor:L.negative().optional().describe("Load factor in g that full forward stick pushes at high speed. Default -3."),autoTrim:L.nonnegative().optional().describe("Rate in 1/s at which trim follows the angle of attack that holds the flight path; 0 leaves trim fixed. Default 1."),directionalStability:L.nonnegative().optional().describe("Weathercock stiffness: yaw acceleration in rad/s\xB2 per radian of sideslip at reference speed. Default 4."),yawDamping:L.nonnegative().optional().describe("Yaw damping in 1/s at reference speed. Default 1.2."),dihedralEffect:L.optional().describe("Roll acceleration in rad/s\xB2 per radian of sideslip at reference speed, away from the slip. Default 3."),rollInertia:L.positive().optional().describe("Roll inertia in kg m\xB2. Default mass * (0.14 * span)\xB2."),pitchInertia:L.positive().optional().describe("Pitch inertia in kg m\xB2. Default mass * (0.18 * length)\xB2."),yawInertia:L.positive().optional().describe("Yaw inertia in kg m\xB2. Default mass * (span\xB2 + length\xB2) / 12."),propellerEffects:L.min(0).max(1).optional().describe("Scale of propeller torque, P-factor and slipstream yaw, and gyroscopic precession; 0 disables them. Default 0."),stallSpeed:L.positive().describe("Legacy tuning reference in m/s; aerodynamic stall detection uses angle of attack."),liftSlope:L.positive(),postStallLift:L.nonnegative(),postStallDecay:L.nonnegative(),profileDrag:L.nonnegative(),inducedDrag:L.nonnegative(),gearDrag:L.nonnegative().describe("Drag coefficient of the landing gear fully down; scales with the gear position."),speedBrakeDrag:L.nonnegative().optional().describe("Additional drag coefficient at full speedBrake actuator extension."),flapDrag:L.nonnegative().describe("Drag coefficient of the flaps fully down; scales with the flap position."),fixedGear:m.boolean().optional().describe("Fixed undercarriage stays down regardless of the gear selection."),gearTransitTime:L.nonnegative().optional().describe("Seconds for a full landing-gear cycle, doors included, either way. The gear holds still with weight on the wheels, and only a locked-down gear can land. Default 0 (instant)."),flapTransitTime:L.nonnegative().optional().describe("Seconds for the flaps to travel fully up to fully down. Default 0 (instant)."),stallDrag:L.nonnegative().describe("Broadside separated-flow drag coefficient, blended by separation and sin(alpha)^2."),propellerEfficiency:L.nonnegative(),maxThrust:L.positive(),minPropellerSpeed:L.positive(),lateralDamping:L.nonnegative(),brakeDeceleration:L.positive(),rollingDeceleration:L.nonnegative(),groundTrackRate:L.positive().describe("Tire side grip with full weight on the wheels: lateral deceleration in m/s\xB2 and yaw grip in 1/s.")})),Cie=m.strictObject(cl({fixedGear:m.boolean().optional().describe("Fixed skids or wheels by default; false enables retractable gear."),gearTransitTime:L.nonnegative().optional().describe("Seconds for full retractable gear travel."),rotorPosition:Ct,rotorRadius:L.positive(),powerLimitedRotor:m.boolean().optional().describe("Govern rotor RPM and limit thrust using installed shaft power and actuator-disc momentum theory."),rotorEfficiency:L.positive().max(1).optional().describe("Rotor induced-power efficiency; default 0.75."),profilePowerFraction:L.min(0).max(1).optional().describe("Installed shaft-power fraction spent on rotor profile drag at governed RPM; default 0.12."),vortexRing:m.boolean().optional().describe("Enable estimated powered-descent vortex-ring loss of lift; default false."),retreatingBladeSpeed:L.positive().optional().describe("Sea-level TAS for estimated retreating-blade onset, m/s; decreases with density and rotor RPM."),rotorDiscs:L.int().min(1).max(2).optional().describe("Effective lifting-disc count, 2 for a tandem rotor; default 1."),cyclicTilt:L.positive(),cyclicResponse:L.positive(),cyclicDamping:L.nonnegative(),groundLevelRate:L.positive(),maxTilt:L.positive(),yawRate:L.positive(),liftMultiplier:L.positive(),groundEffect:L.nonnegative(),translationalLift:L.nonnegative(),translationalLiftSpeed:L.positive(),verticalDrag:L.nonnegative(),horizontalDrag:L.nonnegative(),quadraticDrag:L.nonnegative(),groundDeceleration:L.positive()})),P6=m.strictObject(cl({mixtureControl:m.boolean().optional().describe("Manual piston mixture; omitted leaves fuel scheduling automatic."),propellerControl:m.strictObject({minRpm:L.min(.3).max(.95).describe("Minimum governed RPM as a fraction of rated propeller RPM.")}).optional().describe("Constant-speed propeller; the lever selects RPM and the governor varies pitch."),propulsion:m.enum(["propeller","jet"]).optional().describe("Installed propulsion type; omitted preserves the legacy constant-power model."),dryThrust:L.positive().optional().describe("Sea-level static dry jet thrust in newtons, per engine."),afterburnerThrust:L.positive().optional().describe("Total sea-level static augmented thrust in newtons, per engine; must exceed dry thrust."),afterburnerDetent:L.min(.1).max(.99).optional().describe("Throttle fraction where reheat starts; default 0.85."),densityExponent:L.nonnegative().max(3).optional().describe("Installed power/thrust density lapse exponent."),highAltitudeDensityRatio:L.positive().max(1).optional().describe("Density ratio where upper-altitude engine lapse begins; continuous at this knee."),highAltitudeExponent:L.nonnegative().max(3).optional().describe("Density lapse exponent below highAltitudeDensityRatio; defaults to densityExponent."),ratedDensityRatio:L.positive().max(1).optional().describe("Lowest density ratio retaining flat-rated power or thrust; default 1."),ramRise:L.nonnegative().max(2).optional().describe("Jet net-thrust multiplier per Mach squared, representing inlet ram recovery; default 0."),position:Ct.describe("Engine thrust application point in aircraft-local meters, relative to the landing-contact origin."),thrustAxis:Ct.refine(n=>n.some(e=>e!==0),"Thrust axis must be nonzero.").describe("Local thrust direction; normalized by the solver."),power:L.positive().describe("Maximum shaft power in watts, per engine; retained as compatibility metadata for jets."),idleRpm:L.min(0).max(1),spoolRate:L.positive(),rotorAngularSpeed:L.positive(),vectored:m.boolean().optional().describe("Rotate +Z thrust toward +Y with the powered-lift lever."),propellerEfficiency:L.min(0).max(1).optional().describe("Per-engine override of airplane.propellerEfficiency."),maxThrust:L.positive().optional().describe("Per-engine static thrust cap in newtons; defaults to airplane.maxThrust."),minPropellerSpeed:L.positive().optional().describe("Minimum propeller advance speed in m/s for the power/thrust calculation; defaults to airplane.minPropellerSpeed."),propellerRotation:m.enum(["clockwise","counterclockwise"]).optional().describe("Turning direction seen from the cockpit. Clockwise (default) swings the nose left; scaled by airplane.propellerEffects."),propellerInertia:L.nonnegative().optional().describe("Propeller polar moment of inertia in kg m\xB2, for gyroscopic precession. Default 0.")})),s0=m.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/).refine(n=>!["__proto__","constructor","prototype"].includes(n),"Reserved engine id.").describe("Stable engine id, such as left or right; single-engine form uses main."),Rie=m.strictObject(cl({actuators:j6.optional(),label:m.string().min(1),genericLabel:s5.optional(),model:m.enum(["airplane","helicopter"]),mass:L.positive(),span:L.positive(),length:L.positive(),height:L.positive(),centerOfMass:Ct,pilotEye:Ct,engine:P6.optional().describe("Single engine, implicitly named main. Supply exactly one of engine or engines."),engines:m.array(P6.extend({id:s0})).min(1).optional().describe("Named independent airplane engines; ids must be unique. Each power/thrust limit is per engine."),airplane:Iie.optional(),helicopter:Cie.optional(),poweredLift:m.strictObject({transitTime:L.positive().describe("Seconds for thrust-vector travel from forward to vertical."),controlFadeSpeed:L.positive().describe("Axial airspeed in m/s at which assisted hover controls fade to zero."),pitchAuthority:L.positive().describe("Full-stick hover pitch angular acceleration in rad/s\xB2."),rollAuthority:L.positive().describe("Full-stick hover roll angular acceleration in rad/s\xB2."),yawAuthority:L.positive().describe("Full-pedal hover yaw angular acceleration in rad/s\xB2."),damping:L.positive().describe("Thrust-dependent hover angular-rate damping in 1/s.")}).optional().describe("Assisted hover controls and 0\u201390 degree thrust-vector actuator; airplane model only."),hardLandingSpeed:L.positive(),hardLandingRoll:L.positive(),hardLandingPitch:L.positive(),maxSupportStep:L.nonnegative(),collisionProbes:m.array(Ct).min(1),collisionParts:m.array(m.strictObject({id:m.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/).describe("Unique section id used by damage and debris state."),role:m.enum(["body","leftWing","rightWing","tail","rotor","tailRotor","gear","engine"]).describe("Flight role; +X is the left wing. Body sections cannot detach."),probes:m.array(Ct).max(64).describe("Local collision sphere centers, meters."),radius:L.positive().describe("Probe and detached-piece collision radius, meters."),disc:m.strictObject({center:Ct.describe("Rotor hub in model coordinates, meters."),normal:Ct.refine(n=>Math.abs(Math.hypot(...n)-1)<1e-5,"Expected a unit normal.").describe("Unit rotation axis in model coordinates."),radius:L.positive().describe("Full swept rotor radius, meters."),halfThickness:L.positive().describe("Half the swept blade thickness, meters."),rotor:m.string().min(1).describe("Node in visual.rotors supplying engine RPM and speed multiplier."),tilt:m.strictObject({pivot:Ct.describe("Powered-lift hinge pivot in model coordinates, meters."),axis:Ct.refine(n=>Math.abs(Math.hypot(...n)-1)<1e-5,"Expected a unit axis.").describe("Unit powered-lift hinge axis in model coordinates."),angle:L.describe("Hinge rotation in radians at full thrustVectorPosition.")}).optional().describe("Powered-lift hinge, in model coordinates at forward thrust.")}).optional().describe("Finite rotor disc replacing sphere probes, including at rest. Blade speed contributes to strike damage."),parent:m.string().min(1).optional().describe("Supporting part id; separation also releases this part."),center:Ct.describe("Section center in model coordinates, meters."),massFraction:L.positive().max(1).describe("Share of the original mass removed on separation."),breakSpeed:L.positive().optional().describe("Joint failure speed in m/s for a normal impact. Loaded sliding also causes shear damage. Omit for an unbreakable section."),nodes:m.array(m.string().min(1)).describe("GLB node names belonging to this section, including attached controls."),fragments:m.strictObject({nodes:m.array(m.string().min(1)).min(1).describe("Shared static meshes to partition by triangle centroid."),min:Ct.describe("Minimum corner of the section region in model meters."),max:Ct.describe("Maximum corner of the section region in model meters.")}).optional().describe("Optional region for splitting shared markings and detail meshes."),engines:m.array(s0).optional().describe("Engine ids that fail when this section detaches.")})).min(1).max(64).optional().describe("Breakable airframe sections: local probe spheres, section center, mass fraction, normal break speed (m/s), GLB nodes and attached engines. Replaces collisionProbes."),visual:m.strictObject(cl({rotors:m.array(cS.extend({engine:s0.optional().describe("Engine id driving this propeller; omitted follows the first engine.")})),gearNodes:m.array(m.string().min(1)).describe("Nodes hidden while the landing gear is fully up."),flaps:m.array(cS).describe("Flap nodes turned by multiplier radians at full travel, in proportion to the flap position."),ailerons:m.array(cS),controlStick:m.strictObject(cl({node:m.string().min(1),pitchAxis:m.enum(["x","y","z"]),rollAxis:m.enum(["x","y","z"])})).optional(),collective:cS.optional(),airspeedGaugeMax:L.positive().optional(),interior:t5.optional(),animation:o5.optional()}))})).superRefine((n,e)=>{let t=n.engines??(n.engine?[n.engine]:[]);n.poweredLift&&(n.model!=="airplane"||!t.some(a=>a.vectored))&&e.addIssue({code:"custom",path:["poweredLift"],message:"Powered lift requires an airplane with a vectored engine."});for(let[a,c]of t.entries()){let l=n.engine?["engine"]:["engines",a];c.propulsion==="jet"&&(c.mixtureControl||c.propellerControl)&&e.addIssue({code:"custom",path:l,message:"Jets cannot have manual piston mixture or propeller controls."}),c.propellerControl&&(n.model!=="airplane"||c.propellerControl.minRpm<=c.idleRpm)&&e.addIssue({code:"custom",path:l,message:"Propeller governing requires an airplane and minimum RPM above idle."}),c.propulsion==="jet"&&(c.dryThrust===void 0||n.model!=="airplane")&&e.addIssue({code:"custom",path:l,message:"Jet propulsion requires dryThrust and model airplane."}),c.afterburnerThrust!==void 0&&(c.propulsion!=="jet"||c.afterburnerThrust<=(c.dryThrust??0))&&e.addIssue({code:"custom",path:l,message:"Afterburner thrust requires a jet and must exceed dry thrust."})}for(let a of t)a.vectored&&(!n.poweredLift||a.thrustAxis[0]!==0||a.thrustAxis[1]!==0||(a.thrustAxis[2]??0)<=0)&&e.addIssue({code:"custom",path:["poweredLift"],message:"Vectored engines require poweredLift and a forward +Z thrust axis."});n.engine===void 0==(n.engines===void 0)&&e.addIssue({code:"custom",path:["engines"],message:"Supply exactly one of engine or engines."}),n.model==="helicopter"&&n.engines!==void 0&&e.addIssue({code:"custom",path:["engines"],message:"Independent propeller engines require model airplane; helicopters use engine and a shared rotor."});let i=new Set;n.engine!==void 0&&i.add("main");for(let[a,c]of(n.engines??[]).entries())i.has(c.id)&&e.addIssue({code:"custom",path:["engines",a,"id"],message:"Engine ids must be unique."}),i.add(c.id);a5(n.visual,e,["visual"]);let r=new Set,s=new Set,o=0;for(let[a,c]of(n.collisionParts??[]).entries()){r.has(c.id)&&e.addIssue({code:"custom",path:["collisionParts",a,"id"],message:"Collision part ids must be unique."}),r.add(c.id),!c.disc&&c.probes.length===0&&e.addIssue({code:"custom",path:["collisionParts",a,"probes"],message:"A section needs sphere probes or a rotor disc."}),c.disc&&!n.visual.rotors.some(d=>d.node===c.disc?.rotor)&&e.addIssue({code:"custom",path:["collisionParts",a,"disc","rotor"],message:"Unknown visual rotor node."});let l=new Set([c.id]),u=c.parent;for(;u!==void 0;){let d=n.collisionParts?.find(h=>h.id===u);if(!d||l.has(u)||c.role==="body"){e.addIssue({code:"custom",path:["collisionParts",a,"parent"],message:"Part parents must exist, be acyclic, and cannot carry the body."});break}l.add(u),u=d.parent}c.fragments&&c.fragments.min.some((d,h)=>d>=(c.fragments?.max[h]??0))&&e.addIssue({code:"custom",path:["collisionParts",a,"fragments"],message:"Fragment bounds must have positive size on every axis."}),(c.breakSpeed!==void 0||c.parent!==void 0)&&(o+=c.massFraction),c.role==="body"&&c.breakSpeed!==void 0&&e.addIssue({code:"custom",path:["collisionParts",a,"breakSpeed"],message:"The body cannot detach."});for(let d of c.nodes)s.has(d)&&e.addIssue({code:"custom",path:["collisionParts",a,"nodes"],message:"A node can belong to only one collision part."}),s.add(d);for(let d of c.engines??[])i.has(d)||e.addIssue({code:"custom",path:["collisionParts",a,"engines"],message:`Unknown engine id ${d}.`})}o>=.8&&e.addIssue({code:"custom",path:["collisionParts"],message:"Detachable sections must leave at least 20% of the aircraft mass."}),n.collisionParts&&!n.collisionParts.some(a=>a.role==="body")&&e.addIssue({code:"custom",path:["collisionParts"],message:"Collision parts must include a body."});for(let[a,c]of n.visual.rotors.entries())c.engine!==void 0&&!i.has(c.engine)&&e.addIssue({code:"custom",path:["visual","rotors",a,"engine"],message:`Unknown engine id ${c.engine}.`});(n.model==="airplane"?n.airplane:n.helicopter)===void 0&&e.addIssue({code:"custom",path:[n.model],message:`${n.model} configuration is required for model ${n.model}`})});Ft("aircraft",m.strictObject({kind:m.string().min(1).describe("Stable external entity/type id."),spec:Rie.describe("Complete airplane or helicopter performance configuration.")}),{owner:"kernel/aircraft",description:"External airplane/helicopter instance. Y up, Z forward; landing-contact origin.",docsRef:"guide/aircraft.md",examples:[{kind:"example.airplane",spec:{label:"Example airplane",model:"airplane",mass:1200,span:10,length:8,height:3,centerOfMass:[0,1,0],pilotEye:[0,1.8,0],engine:{position:[0,1,2.5],thrustAxis:[0,0,1],power:2e5,idleRpm:.2,spoolRate:.5,rotorAngularSpeed:200},airplane:{wingPosition:[0,1,0],wingArea:16,controlAuthoritySpeed:45,maxControlAuthority:1.3,pitchAuthority:.4,pitchResponse:3,stallPitchRate:.18,rollAuthority:1,rollResponse:2,rudderAuthority:1,groundSteerSpeed:8,groundLevelRate:2,maxGroundPitch:.2,camberAngle:.04,flapLift:.3,postStallFlapEffect:.4,stallAngle:.28,stallSpeed:22,liftSlope:4.5,postStallLift:.2,postStallDecay:2.8,profileDrag:.025,inducedDrag:.065,gearDrag:.018,flapDrag:.035,stallDrag:.2,propellerEfficiency:.8,maxThrust:5e3,minPropellerSpeed:40,lateralDamping:.8,brakeDeceleration:7,rollingDeceleration:.22,groundTrackRate:12},hardLandingSpeed:4.5,hardLandingRoll:.3,hardLandingPitch:.35,maxSupportStep:.65,collisionProbes:[[0,1,0]],visual:{rotors:[{node:"propeller",axis:"z",multiplier:1}],gearNodes:["gear"],flaps:[{node:"flap",axis:"x",multiplier:-.45}],ailerons:[{node:"aileron",axis:"x",multiplier:.3}],controlStick:{node:"control-stick",pitchAxis:"x",rollAxis:"z"},airspeedGaugeMax:180}}}]});Ft("aircraftInput",m.strictObject({actuators:Q6.optional().describe("Mechanism targets from zero to one, or on/off selections."),mixture:L.min(0).max(1).optional().describe("Common mixture: 0 idle cutoff, 1 full rich (default)."),propeller:L.min(0).max(1).optional().describe("Common propeller lever: 0 minimum governed RPM, 1 maximum (default)."),power:L.min(0).max(1).describe("Absolute throttle for a plane; collective for a helicopter."),pitch:L.min(-1).max(1).describe("Positive pulls the nose up."),roll:L.min(-1).max(1).describe("Positive banks right."),yaw:L.min(-1).max(1).describe("Positive rudder/pedals turns right."),brake:m.boolean().describe("Ground wheel brake."),engine:m.boolean().describe("Engine on; rotor/propeller spools over time."),engines:m.record(s0,m.strictObject({power:L.min(0).max(1).optional().describe("Absolute throttle override; omitted inherits common power."),mixture:L.min(0).max(1).optional().describe("Individual mixture override; inherits common mixture."),propeller:L.min(0).max(1).optional().describe("Individual propeller RPM override; inherits common propeller."),enabled:m.boolean().optional().describe("Individual engine switch; common engine switch is the master cutoff.")})).optional().describe("Per-engine pilot overrides by id. Failures live in aircraftState and cannot be cleared by pilot input."),gear:m.boolean().describe("Landing gear extended; helicopter skids are fixed."),flaps:m.union([m.boolean(),L.min(0).max(1)]).describe("Plane flap selection: boolean up/down or fraction 0..1."),thrustVector:L.min(0).max(1).optional().describe("Powered-lift lever: 0 forward to 1 vertical.")}),{owner:"kernel/aircraft",description:"Pilot flight controls. Power is retained when input keys are released.",docsRef:"guide/aircraft.md",examples:[{power:0,pitch:0,roll:0,yaw:0,brake:!0,engine:!1,gear:!0,flaps:!1}]});Ft("aircraftState",m.strictObject({actuators:W6.optional().describe("Current mechanism positions and cycle phases, from zero to one."),damage:m.record(m.string(),m.strictObject({integrity:L.min(0).max(1).describe("Remaining joint integrity, 0 broken to 1 intact."),detached:m.boolean().describe("Section has separated and no longer supplies lift or collision probes.")})).optional().describe("Persistent section integrity and separation, keyed by collision part id."),debris:m.array(m.strictObject({part:m.string().min(1).describe("Owning collision section id."),pos:Ct.describe("Section center in world meters."),rot:yS.describe("World-space section orientation quaternion."),velocity:Ct.describe("World velocity in m/s, inherited at separation including travel boost."),angularVelocity:Ct.describe("Local angular velocity about +X, +Y and +Z, rad/s."),age:L.nonnegative().describe("Simulated seconds since separation; expires at 20 seconds.")})).max(64).optional().describe("Detached sections in world coordinates, simulated for 20 seconds. Their removal does not repair the aircraft."),boosted:m.boolean().optional().describe("Speeds include the 4\xD7 travel boost; kernel-owned."),mach:L.nonnegative().optional().describe("True airspeed divided by local speed of sound."),equivalentAirspeed:L.nonnegative().optional().describe("Airspeed normalized to standard sea-level density, m/s; not calibrated IAS."),overspeed:m.boolean().optional().describe("An airframe, surface or rotor speed limit is exceeded; informational, not a speed clamp."),departure:L.min(0).max(1).optional().describe("Developed high-alpha departure fraction."),vortexRing:L.min(0).max(1).optional().describe("Rotor vortex-ring severity in powered slow descent."),velocity:Ct.describe("World velocity in meters per second."),yaw:L.describe("Heading in radians, zero +Z. Airplanes report it from transform.rot, which is authoritative."),pitch:L.describe("Nose-up angle in radians (\xB1\u03C0/2 at the vertical)."),roll:L.describe("Right bank angle in radians; \xB1\u03C0 inverted."),pitchRate:L.describe("Body pitch rate, nose up, in radians per second."),rollRate:L.describe("Body roll rate, right wing down, in radians per second."),yawRate:L.optional().describe("Airplane body yaw rate about local +Y (nose left), in rad/s."),elevator:L.min(-1).max(1).optional().describe("Airplane elevator position after its travel limit, -1..1."),gearPosition:L.min(0).max(1).optional().describe("Landing gear: 0 up and locked, 1 down and locked, between them in transit. Fixed undercarriages stay down."),flapPosition:L.min(0).max(1).optional().describe("Airplane flaps as a fraction of full travel, 0..1. Starts at the commanded position."),pitchTrim:L.optional().describe("Airplane trimmed angle of attack in radians, flown with the stick centered."),thrustVectorPosition:L.min(0).max(1).optional().describe("Actual thrust-vector position after actuator travel, 0 forward to 1 vertical."),sideslip:L.optional().describe("Airplane sideslip in radians, positive with the relative wind from the left."),loadFactor:L.optional().describe("Airplane aerodynamic and thrust load along its up axis, in g."),engines:m.record(s0,m.strictObject({rpm:L.min(0).max(1),shaftPower:L.nonnegative().optional(),combustion:L.min(0).max(1).optional(),rotorAngle:L,failed:m.boolean(),afterburner:L.min(0).max(1).optional(),thrust:L.nonnegative().describe("Current propeller thrust in newtons; zero for the helicopter shaft engine.")})).optional().describe("Authoritative individual spool, rotor phase, failure and thrust state; initialized by the solver."),rpm:L.min(0).max(1).describe("Maximum normalized RPM across all engines; used by common HUDs and exit checks."),rotorAngle:L.describe("First engine rotor phase, wrapped in radians; bind visuals by engine id for independent phases."),airspeed:L.nonnegative().describe("Speed relative to wind in meters per second."),altitudeAGL:L.nonnegative().describe("Height above available terrain in meters."),verticalSpeed:L.describe("Vertical velocity in meters per second."),angleOfAttack:L.describe("Wing incidence relative to airflow in radians."),stalled:m.boolean().describe("Wing beyond useful lift envelope."),grounded:m.boolean().describe("Supported by landing surface."),crashed:m.boolean().describe("Airframe damage requiring recovery. Motion continues under forces and collision impulses."),waitingForTerrain:m.boolean().describe("Paused at last known position while terrain is unavailable.")}),{owner:"kernel/aircraft",description:"Deterministic flight state, including rotor phase and engine spool, preserved by keyframes.",docsRef:"guide/aircraft.md",examples:[{velocity:[0,0,0],yaw:0,pitch:0,roll:0,pitchRate:0,rollRate:0,rpm:0,rotorAngle:0,airspeed:0,altitudeAGL:0,verticalSpeed:0,angleOfAttack:0,stalled:!1,grounded:!0,crashed:!1,waitingForTerrain:!1}]});var rFe=new Set(dm.keys()),O6=m.strictObject({id:m.string().min(1).describe("Exact browser Gamepad.id; omit to match any ID.").optional(),index:m.int().nonnegative().describe("Browser Gamepad.index; may change on reconnect.").optional()}),Fk={bindings:m.record(m.string().min(1),m.string().min(1)).describe("KeyboardEvent.code or Mouse<button> to action name."),axes:m.array(m.strictObject({action:m.string().min(1).describe("Named action receiving the numeric axis value."),axis:m.int().nonnegative().describe("Raw zero-based axis index; no standard mapping required."),device:O6.optional(),mode:m.enum(["signed","positive","negative","unit"]).describe("signed -1..1 (default), positive/negative half axis 0..1, or unit full travel 0..1.").optional(),invert:m.boolean().describe("Reverse calibrated travel before applying the mode.").optional(),deadZone:m.number().min(0).lt(1).describe("Rescaled dead zone; default 0.12 (unit: 0).").optional(),curve:m.number().positive().describe("Response exponent; default 1 (linear).").optional(),min:m.number().describe("Raw minimum; default -1. Must be below center.").optional(),center:m.number().describe("Raw center; default 0. Must lie between min and max.").optional(),max:m.number().describe("Raw maximum; default 1. Must be above center.").optional()})).describe("Mappings for arbitrary browser-exposed joystick axes.").optional(),buttons:m.array(m.strictObject({action:m.string().min(1).describe("Named action receiving button presses and releases."),button:m.int().nonnegative().describe("Raw zero-based button index."),device:O6.optional(),threshold:m.number().positive().max(1).describe("Analog button press threshold; default 0.5.").optional()})).describe("Mappings for arbitrary browser-exposed controller buttons.").optional()},l5=m.strictObject(Fk);function u5(n){return(n.axes??[]).flatMap((e,t)=>(e.min??-1)<(e.center??0)&&(e.center??0)<(e.max??1)?[]:[{axis:t,message:"Axis calibration requires min < center < max."}])}function fS(n){if(n===null||typeof n!="object")return n;if(Array.isArray(n))return n.map(t=>fS(t));let e=Object.create(null);for(let[t,i]of Object.entries(n))i!==void 0&&(e[t]=fS(i));return e}function l0(n,e){let t=fS(n);for(let[i,r]of Object.entries(e)){if(r===void 0)continue;let s=t[i];s!=null&&typeof s=="object"&&!Array.isArray(s)&&r!==null&&typeof r=="object"&&!Array.isArray(r)?t[i]=l0(s,r):t[i]=fS(r)}return t}function Pk(n,e){if(n===void 0)return{};let t=e?.types?.get(n);if(t===void 0)throw new Error(`scene references unknown type "${n}" \u2014 is a project.json with types loaded?`);return t.components}function Qk(n,e,t,i=[]){if(i.includes(e))throw new Error(`prefab inheritance cycle: ${[...i,e].join(" \u2192 ")}`);let r=n.prefabs[e];if(r===void 0)throw new Error(`scene references unknown prefab "${e}"`);let s=r.extends!==void 0?Qk(n,r.extends,t,[...i,e]):Pk(r.type,t);return l0(r.extends!==void 0&&r.type!==void 0?l0(Pk(r.type,t),s):s,r.components)}function Bie(n,e,t){let i=Pk(e.type,t);return e.prefab!==void 0&&(i=l0(i,Qk(n,e.prefab,t))),e.components!==void 0&&(i=l0(i,e.components)),i}function vS(n,e){return e===n||e.startsWith(`${n}.`)}function Nie(n,e){let t=[...e],i=new Set(t),r=[],s=(o,a,c)=>{let l=ss(a,t);r.push({path:o,code:"unknown_type",message:`${c} references unknown registry type "${a}"`,expected:t.length>0?`one of: ${t.join(", ")}`:'a type from project.json "types"',...l!==void 0?{hint:`did you mean "${l}"?`}:{},docsRef:"guide/project.md"})};n.entities.forEach((o,a)=>{o.type!==void 0&&!i.has(o.type)&&s(`/entities/${a}/type`,o.type,"entity")});for(let[o,a]of Object.entries(n.prefabs))a.type!==void 0&&!i.has(a.type)&&s(`/prefabs/${o.replaceAll("~","~0").replaceAll("/","~1")}/type`,a.type,`prefab "${o}"`);return r}var fm=m.json(),f0=m.record(m.string(),fm),hm=m.record(m.string(),f0),cm=m.string().min(1),kie=m.string().min(1).regex(/^(?!e\d+$)(?!\d+$)(?!\$)/,'authored entity ids must not look like runtime ids ("e" + number), be all digits (JSON objects reorder integer-like keys, which would break creation-order iteration after save/load), or start with "$" (kernel singletons)'),Wk=m.union([m.string(),m.number()]),u0=m.int().nonnegative(),qk=m.strictObject({kind:m.literal("command").describe("Envelope discriminator; always 'command'."),seq:m.int().nonnegative().describe("Monotonic sequence number assigned by the source; orders commands within a tick."),source:m.string().min(1).describe("Origin of the command, e.g. 'local' or 'agent:<name>'."),tick:u0.describe("Tick the command was submitted for."),tickExecuted:u0.describe("Tick the kernel actually executed the command at (set when a late command was rewritten to a later tick).").optional(),type:m.string().min(1).describe("Command type; must match a registered handler and, for molen/scene@3, an entry under the scene `commands`."),payload:fm.describe("Command payload (any JSON); validated against the declared payload schema when the scene declares one.")}),Die=m.strictObject({type:m.string().min(1).describe("Event type name."),payload:fm.describe("Event payload (any JSON).")}),Kk=m.string().regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/,{error:'must be dotted lower_snake segments, e.g. "train" or "train.rolling_stock"'}),xS=m.string().regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/,{error:'must be a namespaced dotted id, e.g. "train.locomotive"'}),cc=m.string().min(1).regex(/^(?![A-Za-z]:|[/\\])(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$)).+$/,{error:'must be a contained relative POSIX path (no drive letters, leading/back slashes, or ".." segments)'}),um=n=>m.array(m.number()).length(n),d5=m.strictObject({format:m.literal("molen/prefab@1").describe("Format envelope 'molen/prefab@1' (optional when the prefab is inlined in a scene).").optional(),extends:m.string().min(1).describe("Name of a prefab in the same manifest to inherit components from (deep-merged).").optional(),type:xS.describe("Project-registry type id this prefab specializes, e.g. 'train.locomotive'.").optional(),components:hm.describe("Component name to pure-JSON component data (deep-merged over the extends/type base).").default({})}),Fie=m.strictObject({id:kie.describe("Authored entity id, stable across save/load; omitted = runtime id 'e<n>'.").optional(),type:xS.describe("Project-registry type id to instantiate, e.g. 'train.locomotive'.").optional(),prefab:m.string().min(1).describe("Name of a prefab in this scene to instantiate.").optional(),components:hm.describe("Component name to component data, layered over the type/prefab base (a partial when a base is present).").optional()}),Pie=m.strictObject({doc:m.string().describe("Human/agent description of what the command does.").optional(),payload:f0.describe("JSON Schema (object/array/number/integer/string/boolean subset) the payload must satisfy; omitted = any JSON.").optional()}),h5=m.strictObject({description:m.string().min(1).describe("One-line human/agent description of the component."),examples:m.array(fm).min(1).describe("At least one valid example of the component data (feeds hints and docs)."),schema:f0.describe("JSON Schema (object/array/number/integer/string/boolean subset) for the component data; omitted = any object.").optional()}),f5=m.string().regex(/^[a-zA-Z]\w*$/,{error:'component names are identifiers, e.g. "team" or "spawnPoint"'}),p5=m.strictObject({checkpoint:m.literal("state").describe("Opt into checkpoint restore: keep all durable state in molen.state, components, or snapshot providers, never mutable closures. Without this declaration replay seeks from the beginning.").optional(),id:m.string().min(1).describe("Script id, unique within the scene."),code:m.string().min(1).describe("Inline JavaScript source (exactly one of code or path).").optional(),path:cc.regex(/\.(?:js|ts)$/,{error:"script path must end in .js or .ts"}).describe("Scene-relative path to a script file, .js or .ts (exactly one of code or path). A .ts file has its types erased when the scene is loaded.").optional(),config:f0.describe("Frozen JSON config exposed to the script as `config`.").default({})}),L6=um(3).describe("Camera position [x, y, z] in meters (Y-up)."),U6=um(3).describe("Point [x, y, z] in meters the camera looks at (default: the origin).").optional(),Ck=m.number().min(1).max(179).describe("Vertical field of view in degrees.").optional(),Oie=m.discriminatedUnion("mode",[m.strictObject({mode:m.literal("follow").describe("Perspective camera tracking an interpolated entity transform; works in live play and capture."),entity:m.string().min(1).describe("Entity to follow (need not have a renderable)."),offset:um(3).describe("Camera offset [x,y,z] in meters from the target."),lookOffset:um(3).describe("Look-at offset from the target; must differ from offset."),space:m.enum(["world","local"]).describe("World-axis offsets (default), or offsets rotated by the target quaternion (first person/chase).").optional(),fov:Ck}),m.strictObject({mode:m.literal("fixed").describe("Static perspective camera."),position:L6,lookAt:U6,fov:Ck}),m.strictObject({mode:m.literal("free-fly").describe("Perspective camera the user flies with keyboard/mouse."),position:L6,lookAt:U6,fov:Ck,moveSpeed:m.number().positive().describe("Base fly speed in meters per second (default 10).").default(10),boost:m.number().positive().describe("Speed multiplier while the boost key is held (default 4).").default(4)}),m.strictObject({mode:m.literal("top-down-ortho").describe("Orthographic camera looking straight down (-Y); screen-up is -z (north), screen-down is +z (south)."),center:um(2).describe("World [x, z] in meters the view centers on."),viewHeight:m.number().positive().describe("World-space height in meters of the visible area; width follows the viewport aspect."),cameraHeight:m.number().positive().describe("Camera height in meters above the y = 0 plane (default 200).").optional()})]),Ru=n=>m.string().min(1).describe(`Input action name produced by keyboard, button, or axis bindings ${n}.`),lS=m.string().min(1).describe("Command type to emit; must be declared under the scene `commands`."),$6=f0.describe("Fixed JSON payload sent with the command.").default({}),Lie=m.discriminatedUnion("kind",[m.strictObject({kind:m.literal("axis").describe("Emit a numeric action value when it changes."),action:Ru("whose numeric value drives the axis"),negative:Ru("to subtract from the value (optional keyboard opposite)").optional(),command:lS,field:m.string().min(1).describe("Payload field receiving the number (default 'value').").default("value")}),m.strictObject({kind:m.literal("press").describe("Emit once when the action becomes active."),action:Ru("that triggers the command"),command:lS,payload:$6}),m.strictObject({kind:m.literal("release").describe("Emit once when the action becomes inactive."),action:Ru("that triggers the command"),command:lS,payload:$6}),m.strictObject({kind:m.literal("axis2d").describe("Emit the command whenever the [x, y] axis vector built from four actions changes."),xNeg:Ru("that drives x toward -1 (west)"),xPos:Ru("that drives x toward +1 (east)"),yNeg:Ru("that drives y toward -1 (north / screen-up)"),yPos:Ru("that drives y toward +1 (south / screen-down, i.e. +z)"),command:lS,field:m.string().min(1).describe("Payload field that receives the [x, y] vector (default 'dir').").default("dir")})]),Uie=m.strictObject({bindings:m.record(m.string().min(1),m.string().min(1)).describe("KeyboardEvent.code (e.g. 'KeyW') to input action name."),axes:Fk.axes,buttons:Fk.buttons,profiles:m.record(m.string().min(1),l5).describe("Named complete binding sets for walking, flying, driving, or other use cases.").optional(),profile:m.string().min(1).describe("Initial profile name; absent uses the root bindings.").optional(),emit:m.array(Lie).describe("Rules that turn input actions into commands.").default([])}),$ie=m.strictObject({descriptor:cc.describe("Scene-relative path to the molen/terrain descriptor JSON."),heightmap:cc.describe("Scene-relative path to a PNG16 heightmap used for headless ground sampling / collision.").optional()}),Rk=m.enum(["car","pedestrian","train","aircraft","boat"]),zie=m.strictObject({network:m.union([cc,m.looseObject({format:m.literal("molen/transport-network@1").describe("Format envelope; always 'molen/transport-network@1'.")})]).describe("The road, rail and path network NPCs move on: a scene-relative path to a molen/transport-network@1 document, or the document inline.").optional(),observer:m.string().min(1).describe("Entity whose position drives the spawn ring (default: the entity carrying ambientObserver, else the ambient.observer command).").optional(),classes:m.array(Rk).describe("Which NPC classes run (default ['car']).").optional(),density:m.partialRecord(Rk,m.number().nonnegative()).describe("Target agents per kilometre of lane near the observer, per class.").optional(),drivingSide:m.enum(["right","left"]).describe("Which side of the road traffic keeps to (default 'right').").optional(),radius:m.number().positive().describe("Outer spawn radius in metres for cars (other classes scale from it).").optional(),despawnRadius:m.number().positive().describe("Distance in metres beyond which cars are removed (must exceed radius).").optional(),templates:m.partialRecord(Rk,m.string().min(1)).describe("Prefab name per class whose components every spawned agent receives.").optional(),seedSalt:m.string().describe("Mixed into the scene seed for ambient draws, to vary traffic without reseeding.").optional()}),Gie=m.strictObject({engine:m.enum(["none","kinematics","platformer","rapier"]).describe("Physics engine: none, kinematics (cross-platform deterministic 2.5D in the XZ plane), platformer (cross-platform deterministic XY swept boxes), or rapier (same-platform deterministic 3D)."),gravity:um(3).describe("Gravity [x, y, z] in meters per second squared (rapier; default [0, -9.81, 0]).").optional(),ground:m.enum(["flat","terrain"]).describe("Ground for kinematic bodies: flat y = 0 (default) or the scene's terrain heightfield.").optional(),character:m.boolean().describe("Install the kernel character controller (character + moveIntent components); not allowed with rapier.").optional()}),Vie=m.strictObject({format:m.literal("molen/scene@3").describe("Format envelope; always 'molen/scene@3'."),name:m.string().min(1).describe("Human-readable scene name."),seed:Wk.describe("Deterministic RNG seed (string or number; default 0).").default(0),tickRate:m.int().min(1).max(240).describe("Simulation ticks per second, 1..240 (default 30); dt = 1/tickRate seconds.").default(30),lateCommands:m.enum(["rewrite","reject"]).describe("Commands that arrive for a past tick: rewrite to the current tick (default) or reject.").default("rewrite"),keyframeInterval:m.int().min(1).describe("Ticks between full keyframe snapshots (default 60).").default(60),prefabs:m.record(m.string(),d5).describe("Prefab name to prefab (entity templates instantiated by entities[].prefab).").default({}),entities:m.array(Fie).describe("Entities instantiated at tick 0, in order.").default([]),scripts:m.array(p5).describe("Deterministic scene scripts (inline code or file refs). Evaluated with the authority of the host process, so treat a manifest like source code.").default([]),commands:m.record(m.string().min(1),Pie).describe("Command types this scene accepts, with optional doc and payload schema (scripts attach handlers via molen.onCommand).").default({}),components:m.record(f5,h5).describe("Custom component vocabulary this scene introduces (description + examples, optional schema); known to validation and docs.").default({}),camera:Oie.describe("Initial client camera.").optional(),input:Uie.describe("Keyboard bindings and the rules that turn them into commands.").optional(),terrain:$ie.describe("Streamed heightmap terrain attached to the scene.").optional(),physics:Gie.describe("Physics engine selection and settings.").optional(),ambient:zie.describe("Ambient life: NPC cars, pedestrians, trains and aircraft that spawn around an observer on a transport network (needs @bendyline/molen-ambient).").optional()}),Hie=m.strictObject({algo:m.literal("sfc32").describe("RNG algorithm; always 'sfc32'."),state:m.array(m.int().nonnegative()).length(4).describe("The four 32-bit unsigned words of sfc32 state.")}),m5=m.strictObject({kind:m.literal("keyframe").describe("Envelope discriminator; always 'keyframe'."),v:m.literal(1).describe("Keyframe format version; always 1."),engine:m.string().min(1).describe("Engine version that produced the snapshot."),tick:u0.describe("Tick the snapshot was taken at (state after this tick)."),tickRate:m.int().min(1).max(240).describe("Simulation ticks per second of the world; dt = 1/tickRate seconds."),seed:Wk.describe("World RNG seed (string or number)."),nextEntitySeq:m.int().nonnegative().describe("Next runtime entity sequence number (runtime ids are 'e<seq>')."),entityOrder:m.array(cm).describe("Entity creation order; older snapshots fall back to object key order.").optional(),commands:m.strictObject({pending:m.array(qk),highestSeq:m.record(m.string(),m.int().nonnegative()),latePolicy:m.enum(["rewrite","reject"])}).describe("Accepted future commands and deduplication cursors.").optional(),rng:Hie.describe("Exact RNG state so the run resumes deterministically."),entities:m.record(cm,hm).describe("Entity id to component map: the complete world state."),plugins:m.record(m.string(),fm).describe("Opaque per-plugin snapshot blobs keyed by plugin name.").default({})}),jie=m.strictObject({kind:m.literal("delta").describe("Envelope discriminator; always 'delta'."),v:m.literal(1).describe("Delta format version; always 1."),tick:u0.describe("Tick this delta describes (state after this tick)."),baseTick:u0.describe("Tick the delta is relative to (normally tick - 1)."),spawned:m.record(cm,hm).describe("Entities created this tick with their full component maps.").default({}),destroyed:m.array(cm).describe("Ids of entities destroyed this tick.").default([]),changed:m.record(cm,hm).describe("Entities whose components changed, each carrying the full new value of every changed component (whole-component granularity).").default({}),removedComponents:m.record(cm,m.array(m.string())).describe("Entity id to names of components removed this tick.").default({}),events:m.array(Die).describe("World events emitted this tick, in emission order.").default([])}),Qie=m.record(m.string().min(1),m.strictObject({hash:m.string().min(1).describe("Hash of the domain's content."),packs:m.array(m.string().min(1)).describe('Packs the content came from, as "id@version".').optional()})).describe("Content the world was built from, by domain (e.g. types, places)."),z6={format:m.literal("molen/replay@1").describe("Format envelope; always 'molen/replay@1'."),content:Qie.describe("Content the replay was recorded with; replaying against different content fails before the first tick.").optional(),engine:m.string().min(1).describe("Engine version the fixture was recorded with."),seed:Wk.describe("Seed override (string or number; defaults to the scene seed).").optional(),ticks:m.int().positive().describe("Number of ticks to simulate."),commands:m.array(qk).describe("Command log to feed in, ordered by tick then seq.").default([]),expected:m.strictObject({stateHash:m.string().min(1).describe("Expected world-state hash after the final tick."),eventCount:m.int().nonnegative().describe("Expected total number of events emitted over the run.").optional(),tickHashes:m.array(m.string().min(1)).describe("Per-tick reference hashes (entry i = hash after tick i) used to localize divergence.").optional()}).describe("Expected outcome; a mismatch is a determinism failure.").optional()},G6=cc.describe("Fixture-relative path to the scene file to boot from."),V6=m5.describe("Keyframe to start from instead of (or in addition to) booting the scene."),Wie=m.union([m.strictObject({...z6,scene:G6,initialKeyframe:V6.optional()}),m.strictObject({...z6,scene:G6.optional(),initialKeyframe:V6})]),qie=m.strictObject({select:m.string().min(1).describe("Entity selector plus optional value path: '#id', 'tag:name', 'has:component', e.g. '#player .health.hp'."),op:m.enum(["eq","approx","gt","gte","lt","lte","count","exists","all_eq","all_approx","all_gt","all_gte","all_lt","all_lte","any_eq","any_approx","any_gt","any_gte","any_lt","any_lte"]).describe("Comparison: eq/approx/gt/gte/lt/lte on the single match, count/exists on the match set, all_*/any_* over every match."),value:fm.describe("Expected value (for count: the expected number of matches).").optional(),tol:m.number().positive().describe("Absolute tolerance for approx ops (default 1e-6).").optional()}),Kie=m.strictObject({event:m.string().min(1).describe("World event type to check."),op:m.enum(["occurred","never","count","at_tick"]).describe("occurred (at least once), never, count (value = expected count), or at_tick (value = tick it must have occurred at)."),value:m.number().describe("Expected count for count, or tick for at_tick.").optional()}),Xie=m.strictObject({format:m.literal("molen/assert@1").describe("Format envelope; always 'molen/assert@1'."),assertions:m.array(m.union([qie,Kie])).min(1).describe("Assertions evaluated after the run (at least one).")}),Zie={kind:"keyframe",v:1,engine:"0.0.1",tick:120,tickRate:30,seed:"demo",nextEntitySeq:2,rng:{algo:"sfc32",state:[738291,102,99182,4]},entities:{player:{transform:{pos:[0,1,0],rot:[0,0,0,1]},health:{hp:80}},e1:{transform:{pos:[9,0,3],rot:[0,0,0,1]},lifetime:{ticksLeft:12}}},plugins:{}};Xn("command",qk,{id:"molen/command@1",title:"Command envelope",description:"Client/agent intent submitted to the kernel for validation and adjudication at a tick.",examples:[{kind:"command",seq:1,source:"local",tick:45,type:"spawn_cube",payload:{pos:[0,2,0]}}],docsRef:"schemas/command.md"});function Io(n){return n.replaceAll("~","~0").replaceAll("/","~1")}function Jie(n){let e=n,t=[];for(let[c,l]of Object.entries(e.ambient?.templates??{}))if(e.prefabs[l]===void 0){let u=ss(l,Object.keys(e.prefabs));t.push({path:`/ambient/templates/${Io(c)}`,code:"unknown_prefab",message:`ambient ${c} template references unknown prefab "${l}"`,...u!==void 0?{hint:`did you mean "${u}"?`}:{},docsRef:"schemas/scene.md"})}let i=e.ambient?.radius,r=e.ambient?.despawnRadius;i!==void 0&&r!==void 0&&r<=i&&t.push({path:"/ambient/despawnRadius",code:"invalid_ambient",message:`ambient despawnRadius (${r}) must exceed radius (${i})`,docsRef:"schemas/scene.md"}),e.camera?.mode==="follow"&&e.camera.offset?.every((c,l)=>c===e.camera?.lookOffset?.[l])&&t.push({path:"/camera/lookOffset",code:"invalid_camera",message:"follow camera offset and lookOffset must differ"});let s=Object.keys(e.prefabs);for(let[c,l]of Object.entries(e.prefabs))if(l.extends!==void 0&&e.prefabs[l.extends]===void 0){let u=ss(l.extends,s);t.push({path:`/prefabs/${Io(c)}/extends`,code:"unknown_prefab",message:`prefab "${c}" extends unknown prefab "${l.extends}"`,expected:`one of: ${s.join(", ")}`,...u!==void 0?{hint:`did you mean "${u}"?`}:{},docsRef:"schemas/scene.md"})}for(let c of s){let l=[],u=c;for(;u!==void 0&&e.prefabs[u]!==void 0;){if(l.includes(u)){u===c&&t.push({path:`/prefabs/${Io(c)}/extends`,code:"prefab_extends_cycle",message:`extends cycle: ${[...l,u].join(" \u2192 ")}`,docsRef:"schemas/scene.md"});break}l.push(u),u=e.prefabs[u]?.extends}}e.entities.forEach((c,l)=>{if(c.prefab!==void 0&&e.prefabs[c.prefab]===void 0){let u=ss(c.prefab,s);t.push({path:`/entities/${l}/prefab`,code:"unknown_prefab",message:`entity references unknown prefab "${c.prefab}"`,expected:`one of: ${s.join(", ")}`,...u!==void 0?{hint:`did you mean "${u}"?`}:{},docsRef:"schemas/scene.md"})}});for(let[c,l]of Object.entries(e.commands)){if(l.payload===void 0)continue;let u=zk(l.payload,`/commands/${Io(c)}/payload`);if(u.length>0){for(let{pointer:d,pattern:h,reason:f}of u)t.push({path:d,code:"unsafe_payload_pattern",message:`command "${c}" declares a pattern that ${f}`,received:JSON.stringify(h),hint:"flatten the repetition (one quantifier per group), or drop the pattern and check the value in the command handler",docsRef:"schemas/scene.md"});continue}try{Dne(l.payload)}catch(d){t.push({path:`/commands/${Io(c)}/payload`,code:"invalid_payload_schema",message:`command "${c}" payload schema is not supported: ${d instanceof Error?d.message:String(d)}`,hint:"use the JSON Schema subset: type object/array/number/integer/string/boolean, properties, required, additionalProperties, items, enum, const, min*/max*",docsRef:"schemas/scene.md"})}}e.physics?.character===!0&&["rapier","platformer"].includes(e.physics.engine)&&t.push({path:"/physics/character",code:"character_engine_conflict",message:"physics.character installs the kernel character controller, which conflicts with the selected engine (rapier/platformer own their movement)",hint:'remove "character": true, or switch engine to "kinematics"',docsRef:"schemas/scene.md"});let o=new Set;e.scripts.forEach((c,l)=>{o.has(c.id)&&t.push({path:`/scripts/${l}/id`,code:"duplicate_script_id",message:`duplicate script id "${c.id}"`,docsRef:"schemas/scene.md"}),o.add(c.id);let u=[c.code!==void 0,c.path!==void 0].filter(Boolean).length;u!==1&&t.push({path:`/scripts/${l}`,code:u===0?"script_source_missing":"script_source_ambiguous",message:`script "${c.id}" must have exactly one of "code" (inline JS) or "path" (file ref)`,hint:`inline: { "code": "molen.on('tick', \u2026)" } \xB7 file: { "path": "scripts/spin.js" }`,docsRef:"schemas/scene.md"})});let a=new Set;if(e.entities.forEach((c,l)=>{c.id!==void 0&&(a.has(c.id)&&t.push({path:`/entities/${l}/id`,code:"duplicate_entity_id",message:`duplicate authored entity id "${c.id}"`,docsRef:"schemas/scene.md"}),a.add(c.id))}),e.input!==void 0){let c=[[void 0,e.input],...Object.entries(e.input.profiles??{})],l=new Set;for(let[d,h]of c){for(let f of Object.values(h.bindings))l.add(f);for(let f of[...h.axes??[],...h.buttons??[]])l.add(f.action);for(let f of u5(h))t.push({path:`${d===void 0?"/input":`/input/profiles/${d}`}/axes/${f.axis}`,code:"invalid_axis_calibration",message:f.message,docsRef:"guide/input.md"})}e.input.profile!==void 0&&!Object.hasOwn(e.input.profiles??{},e.input.profile)&&t.push({path:"/input/profile",code:"unknown_input_profile",message:`Unknown input profile "${e.input.profile}".`,docsRef:"guide/input.md"});let u=Object.keys(e.commands);e.input.emit.forEach((d,h)=>{if(d.command!==void 0&&e.commands[d.command]===void 0){let p=ss(d.command,u);t.push({path:`/input/emit/${h}/command`,code:"undeclared_command",message:`emit rule sends command "${d.command}" which the scene does not declare`,expected:`one of: ${u.join(", ")}`,hint:p!==void 0?`did you mean "${p}"?`:`add "${d.command}" under "commands" (payload schema is optional)`,docsRef:"schemas/scene.md"})}let f=d.kind==="axis2d"?["xNeg","xPos","yNeg","yPos"].map(p=>d[p]):d.kind==="axis"&&d.negative!==void 0?[d.action,d.negative]:[d.action];for(let p of f)l.has(p)||t.push({path:`/input/emit/${h}`,code:"unknown_input_action",message:`emit rule references action "${p}" which no binding produces`,expected:`one of: ${[...l].join(", ")}`,docsRef:"schemas/scene.md"})})}return t}Xn("scene",Vie,{id:"molen/scene@3",title:"Scene manifest",description:"Root document an experience boots from; instantiates into ECS state at tick 0.",examples:[{format:"molen/scene@3",name:"demo",seed:"demo-1",tickRate:30,prefabs:{cube:{components:{transform:{pos:[0,0,0],rot:[0,0,0,1]},spin:{axis:[0,1,0],radPerTick:.05}}}},entities:[{id:"cube-1",prefab:"cube"}],components:{spin:{description:"Continuous rotation about an axis, applied by the spin script.",examples:[{axis:[0,1,0],radPerTick:.05}]}},commands:{move:{doc:"Set the planar move direction [x, z] (-1..1 per axis).",payload:{type:"object",properties:{dir:{type:"array",items:{type:"number"},minItems:2,maxItems:2}},required:["dir"],additionalProperties:!1}}},scripts:[{id:"control",code:"molen.onCommand('move', (p) => molen.patch('cube-1', 'transform', { pos: [p.dir[0], 0, p.dir[1]] }));"}],camera:{mode:"fixed",position:[0,6,16],lookAt:[0,0,0]},input:{bindings:{KeyW:"up",KeyS:"down",KeyA:"left",KeyD:"right"},emit:[{kind:"axis2d",xNeg:"left",xPos:"right",yNeg:"up",yPos:"down",command:"move",field:"dir"}]}}],docsRef:"schemas/scene.md",validate:Jie});Xn("prefab",d5,{id:"molen/prefab@1",title:"Prefab",description:"Declarative entity template: component name to pure-JSON component data.",examples:[{format:"molen/prefab@1",components:{transform:{pos:[0,0,0],rot:[0,0,0,1]},health:{hp:10}}}],docsRef:"schemas/prefab.md"});var Yie=m.strictObject({doc:m.string().describe("Human/agent description of the type.").optional(),extends:xS.describe("Parent type id whose components this type inherits (deep-merged).").optional(),components:hm.describe("Default component map for entities of this type (a partial when extends is set).").default({}),assets:m.array(pS).describe("Project asset ids this type references (e.g. its gltf model).").default([]),scripts:m.array(p5).describe("Deterministic type behavior, installed once per world with config.type set to this type id.").default([])}),ere=m.strictObject({format:m.literal("molen/types@1").describe("Format envelope; always 'molen/types@1'."),namespace:Kk.describe("Namespace every type id in this file lives under (dotted lower_snake, e.g. 'train')."),owner:m.string().min(1).describe("Owning agent or package label, e.g. 'agent:layout'.").optional(),doc:m.string().describe("Human/agent description of this type collection.").optional(),types:m.record(xS,Yie).describe("Type id to definition; every id must start with '<namespace>.'.").default({})});function tre(n){let e=n,t=[];for(let i of Object.keys(e.types))i.startsWith(`${e.namespace}.`)||t.push({path:`/types/${i.replaceAll("~","~0").replaceAll("/","~1")}`,code:"type_outside_namespace",message:`type id "${i}" is outside this file's namespace "${e.namespace}"`,expected:`an id starting with "${e.namespace}."`,docsRef:"schemas/types.md"});for(let[i,r]of Object.entries(e.types)){let s=new Set;r.scripts.forEach((o,a)=>{s.has(o.id)&&t.push({path:`/types/${Io(i)}/scripts/${a}/id`,code:"duplicate_script_id",message:`duplicate type script id "${o.id}"`}),s.add(o.id),o.code===void 0==(o.path===void 0)&&t.push({path:`/types/${Io(i)}/scripts/${a}`,code:"script_source",message:'type script requires exactly one of "code" or "path"'})})}for(let i of Object.keys(e.types)){let r=[],s=i;for(;s!==void 0&&e.types[s]!==void 0;){if(r.includes(s)){s===i&&t.push({path:`/types/${i.replaceAll("~","~0").replaceAll("/","~1")}/extends`,code:"type_extends_cycle",message:`extends cycle: ${[...r,s].join(" \u2192 ")}`,docsRef:"schemas/types.md"});break}r.push(s),s=e.types[s]?.extends}}return t}Xn("types",ere,{id:"molen/types@1",title:"Entity type registry",description:"Namespaced entity types with doc strings, default components, inheritance, and asset refs. Scenes instantiate them; reservations in project.json partition the id space between agents.",examples:[{format:"molen/types@1",namespace:"train",owner:"agent:layout",types:{"train.car":{doc:"A generic rail vehicle.",components:{transform:{pos:[0,0,0],rot:[0,0,0,1]},renderable:{kind:"primitive",ref:"box",materialRef:"palette:#8a5a2b"}}},"train.locomotive":{doc:"Powered engine at the head of a consist.",extends:"train.car",components:{renderable:{materialRef:"palette:#2b2b2b"}}}}}],docsRef:"schemas/types.md",validate:tre});var nre=m.strictObject({namespace:Kk.describe("Reserved namespace (covers all of its sub-namespaces)."),owner:m.string().min(1).describe("Owner label holding the reservation, e.g. an agent id."),note:m.string().describe("Free-form note about the reservation.").optional()}),ire=m.strictObject({format:m.literal("molen/project@1").describe("Format envelope; always 'molen/project@1'."),name:m.string().min(1).describe("Project name."),engine:m.string().min(1).describe("Engine version the project targets.").optional(),scenes:m.record(m.string().regex(/^[a-z][a-z0-9_-]*$/),cc).describe("Scene name (lower-kebab) to project-relative scene file path.").default({}),defaultScene:m.string().describe("Key of `scenes` opened when none is named.").optional(),types:m.array(cc).describe("Project-relative paths of molen/types@1 documents to load.").default([]),assets:m.record(pS,cc).describe("Asset id to project-relative path of its molen/asset@1 sidecar (asset.json).").default({}),reservations:m.array(nre).describe("Namespace reservations partitioning the type-id space between owners.").default([]),setup:cc.describe("Project-relative path of the setup module (setup.mjs) exporting setup(world, manifest).").optional(),packs:m.array(m.strictObject({id:Kk.describe("Pack id (the pack manifest's id)."),source:m.union([m.string().min(1).regex(/^(?![A-Za-z]:|[/\\])(?!.*\\).+$/),m.string().regex(/^https?:\/\/\S+$/)]).describe("Pack file or source directory relative to project.json (it may be outside the project), or an http(s) URL."),contentHash:m.string().regex(/^sha256:[0-9a-f]{64}$/).describe("Expected pack contentHash; loading fails when the pack's differs.").optional()})).describe("Content packs the project loads, in order. When two packs provide the same id, the later one wins.").default([]),components:m.record(f5,h5).describe("Custom component vocabulary shared by every scene in the project.").default({}),codegen:m.strictObject({out:cc.describe("Project-relative output path for generated TypeScript types.").default("gen/molen-types.ts")}).describe("Code generation settings (molen codegen).").default({out:"gen/molen-types.ts"})});function rre(n){let e=n,t=[];e.defaultScene!==void 0&&e.scenes[e.defaultScene]===void 0&&t.push({path:"/defaultScene",code:"unknown_default_scene",message:`defaultScene "${e.defaultScene}" is not a key of scenes`,expected:`one of: ${Object.keys(e.scenes).join(", ")}`,docsRef:"schemas/project.md"});let i=(r,s)=>r===s||s.startsWith(`${r}.`);return e.reservations.forEach((r,s)=>{for(let o=0;o<s;o++){let a=e.reservations[o];a.owner!==r.owner&&(i(a.namespace,r.namespace)||i(r.namespace,a.namespace))&&t.push({path:`/reservations/${s}`,code:"reservation_overlap",message:`namespace "${r.namespace}" (${r.owner}) overlaps "${a.namespace}" held by ${a.owner}`,docsRef:"schemas/project.md"})}}),t}Xn("project",ire,{id:"molen/project@1",title:"Project manifest",description:"Binds an experience project together: scenes by name, type-registry documents, imported assets, namespace reservations, and the default setup module.",examples:[{format:"molen/project@1",name:"rail-yard",scenes:{main:"scenes/main.scene.json"},defaultScene:"main",types:["types/train.types.json"],assets:{"train.boxcar_mesh":"assets/boxcar/asset.json"},reservations:[{namespace:"train",owner:"agent:layout"}],setup:"setup.mjs",codegen:{out:"gen/molen-types.ts"}}],docsRef:"schemas/project.md",validate:rre});Xn("keyframe",m5,{id:"molen/keyframe@1",title:"Keyframe snapshot",description:"Complete world state at a tick: the save-file format, replay seek index, and snapshot-viewer input.",examples:[Zie],docsRef:"schemas/keyframe.md"});Xn("delta",jie,{id:"molen/delta@1",title:"Per-tick delta",description:"Dirty-tracked changes since the previous tick, whole-component granularity.",examples:[{kind:"delta",v:1,tick:121,baseTick:120,spawned:{},destroyed:[],changed:{player:{transform:{pos:[.1,1,0],rot:[0,0,0,1]}}},removedComponents:{},events:[]}],docsRef:"schemas/delta.md"});Xn("replay",Wie,{id:"molen/replay@1",title:"Replay fixture",description:"Initial state plus command log; determinism regenerates everything else. Used by test:replay.",examples:[{format:"molen/replay@1",engine:"0.0.1",scene:"scenes/demo.scene.json",seed:"demo-1",ticks:300,commands:[{kind:"command",seq:1,source:"local",tick:45,tickExecuted:46,type:"spawn_cube",payload:{}}],expected:{stateHash:"sha256:0000",eventCount:0}}],docsRef:"schemas/replay.md"});Xn("assert",Xie,{id:"molen/assert@1",title:"Assertion document",description:"Declarative world-state and event assertions evaluated after a headless run.",examples:[{format:"molen/assert@1",assertions:[{select:"has:transform",op:"count",value:2},{select:"#player .health.hp",op:"gte",value:1},{event:"player_died",op:"never"}]}],docsRef:"schemas/assert.md"});function sre(n,e,t){if(e===null||typeof e!="object")return[];let i=e,r=[],s=(o,a,c)=>{r.push(...Kne(o,a,c===!0?{...t,partial:!0}:t))};switch(n){case"scene":{let o=e;if(t?.types!==void 0){let c=Nie(o,t.types.keys());if(c.length>0){r.push(...c);break}}let a=(c,l)=>{try{s(c(),l)}catch(u){let d=u instanceof Error?u.message:String(u);if(t?.types===void 0&&d.includes("unknown type"))return;r.push({path:l,code:"component_resolution",message:d})}};for(let c of Object.keys(o.prefabs))a(()=>Qk(o,c,t),`/prefabs/${Io(c)}/components`);o.entities.forEach((c,l)=>{a(()=>Bie(o,c,t),`/entities/${l}/components`)});break}case"prefab":s(i.components,"/components");break;case"types":{let o=i.types??{};for(let[a,c]of Object.entries(o))c?.extends===void 0&&s(c?.components,`/types/${Io(a)}/components`);break}case"keyframe":{let o=i.entities??{};for(let[a,c]of Object.entries(o))s(c,`/entities/${Io(a)}`);break}case"delta":{let o=i.spawned??{};for(let[c,l]of Object.entries(o))s(l,`/spawned/${Io(c)}`);let a=i.changed??{};for(let[c,l]of Object.entries(a))s(l,`/changed/${Io(c)}`);break}default:break}return r}function _S(n,e,t){let i=ll(n);if(i===void 0){let l=zte(),u=ss(n,l),d={path:"",code:"unknown_schema_kind",message:`unknown schema kind "${n}"`,expected:`one of: ${l.join(", ")}`,...u!==void 0?{hint:`did you mean "${u}"?`}:{}};return{ok:!1,issues:[d],formatted:r0(`document (kind "${n}")`,[d])}}let r=e!==null&&typeof e=="object"?e.format:void 0,s=typeof r=="string"&&r!==i.meta.id?$te(n,r):void 0,o=s?.zod??i.zod,a=o.safeParse(e);if(a.success){let l=a.data;if(s!==void 0){let p=s.upgrade(a.data),g=i.zod.safeParse(p);if(!g.success){let b=kk(g.error,p,i.zod);if(i.meta.docsRef!==void 0)for(let A of b)A.docsRef??=i.meta.docsRef;return{ok:!1,issues:b,formatted:r0(t?.label??Bk(n,e),b)}}l=g.data}let u=jne(n==="scene"||n==="project"?l.components??{}:{},{base:t?.registry,owner:n}),d=[...u.issues,...sre(n,l,{...t,registry:u.registry}),...i.meta.validate?.(l)??[]],h=Ine(d),f=Cne(d);return s!==void 0&&f.push({path:"/format",code:"deprecated_format",message:`"${s.id}" is a previous version of this format`,expected:i.meta.id,hint:`rewrite the document as ${i.meta.id}`,...i.meta.docsRef!==void 0?{docsRef:i.meta.docsRef}:{},severity:"notice"}),h.length===0?f.length===0?{ok:!0,value:l}:{ok:!0,value:l,notices:f}:{ok:!1,issues:h,formatted:r0(t?.label??Bk(n,e),h)}}let c=kk(a.error,e,o);if(i.meta.docsRef!==void 0)for(let l of c)l.docsRef===void 0&&(l.docsRef=i.meta.docsRef);return{ok:!1,issues:c,formatted:r0(t?.label??Bk(n,e),c)}}function Bk(n,e){if(e!==null&&typeof e=="object"){let t=e.name;if(typeof t=="string"&&t.length>0)return`${n} "${t}"`}return n}function ore(n,e){let t=n.args.map(u=>typeof u=="number"?u:Object.hasOwn(e,u)?e[u]:void 0),[i,r,s]=t;if(n.op==="if")return i===void 0?void 0:i!==0?r:s;if(n.op==="coalesce")return t.find(u=>u!==void 0);if(t.some(u=>u===void 0))return;let o=t,a=i,c=r,l=s;switch(n.op){case"add":return o.reduce((u,d)=>u+d,0);case"subtract":return a-c;case"multiply":return o.reduce((u,d)=>u*d,1);case"divide":return c===0?void 0:a/c;case"min":return Math.min(...o);case"max":return Math.max(...o);case"clamp":return c>l?void 0:Math.max(c,Math.min(l,a));case"abs":return Math.abs(a);case"sqrt":return a<0?void 0:Math.sqrt(a);case"floor":return Math.floor(a);case"modulo":return c<=0?void 0:(a%c+c)%c;case"sin":return Math.sin(a);case"cos":return Math.cos(a);case"atan2":return Math.atan2(a,c);case"less":return+(a<c);case"greater":return+(a>c);case"equal":return+(a===c);case"and":return Number(o.every(u=>u!==0));case"or":return Number(o.some(u=>u!==0));case"not":return+(a===0)}}function are(n){let e=d0.parse(n??{}),t=[],i=new Set,r=s=>{if(i.has(s))return;i.add(s);let o=e[s];if(o){for(let a of o.args)typeof a=="string"&&Object.hasOwn(e,a)&&r(a);t.push([s,o])}};for(let s of Object.keys(e))r(s);return s=>{let o=Object.create(null);for(let[a,c]of Object.entries(s))typeof c=="number"&&Number.isFinite(c)&&(o[a]=c);for(let[a,c]of t){let l=ore(c,o);o[a]=l!==void 0&&Number.isFinite(l)?l:void 0}return o}}function g5(n,e){let t=Object.create(null);for(let[i,r]of Object.entries(n??{})){t[i]=void 0,t[i]=void 0;let s=e(r.component);for(let o of r.path){if(s===null||typeof s!="object"||!Object.hasOwn(s,o)){s=void 0;break}s=s[o]}typeof s=="boolean"?t[i]=Number(s):typeof s=="number"&&Number.isFinite(s)&&(t[i]=s)}return t}function cre(n,e){let t=n.keys;if(t===void 0)return e*(n.scale??1)+(n.offset??0);let i=t[0],r=t[t.length-1];if(i===void 0||r===void 0)return 0;if(e<=i[0])return i[1];if(e>=r[0])return r[1];let s=1;for(;s<t.length-1&&e>(t[s]?.[0]??1/0);)s++;let[o,a]=t[s-1]??i,[c,l]=t[s]??r,u=(e-o)/(c-o);return n.ease==="smooth"&&(u=u*u*(3-2*u)),a+(l-a)*u}function A5(n,e){let t=are(e.derived),i=[],r=new Map;n.traverse(a=>{let c=r.get(a.name)??[];c.push(a),r.set(a.name,c)});let s=[...new Set(e.bindings.map(a=>a.node))].filter(a=>!r.has(a)),o=e.bindings.flatMap(a=>(r.get(a.node)??[]).map(c=>(c.matrixAutoUpdate=!0,{binding:a,node:c,rest:a.property==="visible"?Number(c.visible):c[a.property][a.axis??"z"],current:void 0,time:void 0})));return{missingNodes:s,get missingSignals(){return i},update(a,c){let l=t(a),u=new Set,d=c!==void 0&&Number.isFinite(c)?c:void 0;for(let h of o){let{binding:f,node:p,rest:g}=h,b=_=>{f.property==="visible"?p.visible=_>0:p[f.property][f.axis??"z"]=_},A=l[f.source],y=A===void 0?NaN:cre(f,A);if(!Number.isFinite(y)){u.add(f.source),h.time=void 0,f.missing==="rest"||f.missing==="hide"?(b(f.missing==="hide"?0:g),h.current=void 0):b(h.current===void 0?g:f.property==="visible"?h.current:g+h.current);continue}let v=Math.max(f.min??-1/0,Math.min(f.max??1/0,y)),x=f.period,w=_=>x===void 0?_:(_%x+x)%x;if(v=w(v),f.responseSeconds&&d!==void 0&&h.time!==void 0&&d>=h.time&&h.current!==void 0){let _=v-h.current;x!==void 0&&(_=((_+x/2)%x+x)%x-x/2),v=w(h.current+_*-Math.expm1(-(d-h.time)/f.responseSeconds))}h.current=v,h.time=d,b(f.property==="visible"?v:g+v)}i=[...u]},reset(){for(let a of o){let{binding:c,node:l,rest:u}=a;c.property==="visible"?l.visible=u>0:l[c.property][c.axis??"z"]=u,a.current=a.time=void 0}i=[]}}}ms();function xd(n){let e=Math.imul(n+1,73244475);return e=Math.imul(e^e>>>16,73244475),((e^e>>>16)>>>0)/4294967296}function Vue(n,e){let t=[],i=[];for(let r=0;r<=4;r++){let s=[];for(let o=0;o<20;o++){let a=(o+(xd(o+101)-.5)*.5)*Math.PI*2/20,c=Math.cos(a),l=Math.sin(a),u=Math.abs(c)<1e-9?1/0:(Math.sign(c)*n.size[0]/2-e[0])/c,d=Math.abs(l)<1e-9?1/0:(Math.sign(l)*n.size[1]/2-e[1])/l,h=Math.min(u,d)*(r===0?0:r===4?1:(r+(xd(o+r*31)-.5)*.5)/4);s.push(new C(e[0]+c*h,e[1]+l*h,.003))}i.push(s)}for(let r=1;r<=4;r++)for(let s=0;s<20;s++){let o=i[r-1]?.[s],a=i[r]?.[s];t.push(...o.toArray(),...a.toArray()),r<4&&t.push(...a.toArray(),...(i[r]?.[(s+1)%20]).toArray())}return t}function Hue(n){let e=n.material==="annealed"?4:12,t=n.material==="annealed"?3:8,i=[];for(let c=0;c<=t;c++)for(let l=0;l<=e;l++){let u=c*(e+1)+l;i.push(new C(((l+(l>0&&l<e?(xd(u)-.5)*.6:0))/e-.5)*n.size[0],((c+(c>0&&c<t?(xd(u+901)-.5)*.6:0))/t-.5)*n.size[1],0))}let r=[],s=[],o=[];for(let c=0;c<t;c++)for(let l=0;l<e;l++){let u=i[c*(e+1)+l],d=i[c*(e+1)+l+1],h=i[(c+1)*(e+1)+l+1],f=i[(c+1)*(e+1)+l];for(let p of[u,d,h,u,h,f])r.push(p.x,p.y,p.z);o.push(u.clone().add(d).add(h).add(f).multiplyScalar(.25));for(let[p,g]of[[u,d],[d,h],[h,f],[f,u]])s.push(p.x,p.y,.003,g.x,g.y,.003)}let a=new Ke;return a.setAttribute("position",new Me(r,3)),a.computeVertexNormals(),{geometry:a,centers:o,edges:s}}function fH(n,e){let t=[],i=new Set,r=e.surfaces.map(g=>{let b=[];for(let A of g.nodes??[]){let y=[];n.traverse(v=>{v!==n&&(v.userData.name??v.name)===A&&y.push(v)}),y.length===0&&t.push(A);for(let v of y)v.traverse(x=>{if(i.has(x))throw new Error(`Glass node '${A}' belongs to more than one pane.`);i.add(x)}),b.push(v)}return{spec:g,sources:b,visible:b.map(A=>A.visible)}}).map(({spec:g,sources:b,visible:A})=>{let y=new Pn;y.name=`glass:${g.id}`,n.add(y);let v=new ii({color:"#8baeb7",roughness:.18,metalness:.1,transparent:!0,opacity:.36,depthWrite:!1,side:ln,forceSinglePass:!0}),{geometry:x,centers:w,edges:_}=Hue(g),E=new vt(x,v);E.name=`glass-pane:${g.id}`,y.add(E);let S=new Float32Array(x.getAttribute("position").array),M=new Ke;M.setAttribute("position",new Me(_,3));let I=new ui({color:"#e1f5f5",transparent:!0,opacity:.8,depthWrite:!1}),R=new pr(M,I);R.name=`glass-cracks:${g.id}`,y.add(R);let N=new Pn;N.name=`glass-sheet:${g.id}`,y.add(N),n.updateWorldMatrix(!0,!0);let P=new Oe().compose(new C().fromArray(g.center),new In().fromArray(g.rotation),new C(1,1,1)),U=P.clone().invert().multiply(n.matrixWorld.clone().invert());for(let F of b){let $=F.clone(!0);$.matrixAutoUpdate=!1,$.matrix.copy(U).multiply(F.matrixWorld),$.matrix.decompose($.position,$.quaternion,$.scale),$.visible=F.visible,N.add($)}return{spec:g,sources:b,visible:A,group:y,mesh:E,cracks:R,sheet:N,geometry:x,edgeGeometry:M,material:v,edgeMaterial:I,rest:S,centers:w,paneMatrix:P,crackPoint:"",fragmentAge:-1}}),s=new Oe,o=new Oe,a=new C,c=new In,l=new C(1,1,1),u=new C,d=new C,h=new In,f=!1,p=(g,b)=>{if(!f){n.updateMatrix(),s.copy(n.matrix).invert();for(let A of r){let{spec:y,group:v,geometry:x,mesh:w,cracks:_,sheet:E,sources:S}=A,M=g&&Object.hasOwn(g.surfaces,y.id)?g.surfaces[y.id]:void 0,I=M?.retained!==!1,R=M?.release,N=R?Math.max(0,b-R.time):0,P=M?.fracture==="shattered"&&y.material!=="laminated";v.visible=I||!!R&&N<8,v.matrixAutoUpdate=!1,v.matrix.copy(A.paneMatrix),!I&&R&&(a.fromArray(R.position).addScaledVector(new C().fromArray(R.velocity),N),a.y-=.5*9.81*N*N,c.fromArray(R.rotation),o.compose(a,c,l),v.matrix.copy(s).multiply(o)),v.matrixWorldNeedsUpdate=!0,v.matrix.decompose(v.position,v.quaternion,v.scale),S.forEach((J,re)=>{J.visible=I&&(A.visible[re]??!0)}),E.visible=!I&&!P&&S.length>0,w.visible=S.length===0||!I&&P,_.visible=M!==void 0&&M.fracture!=="intact"&&!P;let U=JSON.stringify(M?.point??[0,0]);y.material==="laminated"&&A.crackPoint!==U&&(A.edgeGeometry.setAttribute("position",new Me(Vue(y,M?.point??[0,0]),3)),A.edgeGeometry.computeBoundingSphere(),A.crackPoint=U),A.edgeGeometry.setDrawRange(0,Math.floor(A.edgeGeometry.getAttribute("position").count/2*(M?.damage??0))*2),A.material.opacity=I?.36:.65*Math.max(0,Math.min(1,8-N)),A.edgeMaterial.opacity=I?.8:.8*Math.max(0,Math.min(1,8-N));let F=x.getAttribute("position"),$=F.array,V=v.visible&&!I&&P?N:-1;if(A.fragmentAge!==V){if(A.fragmentAge=V,$.set(A.rest),v.visible&&!I&&P)for(let J=0;J<A.centers.length;J++){let re=A.centers[J],pe=R?.fragmentSpeed??0;d.set(xd(J+17)-.5,xd(J+101)-.5,xd(J+73)-.5).multiplyScalar(N*pe),h.setFromAxisAngle(new C(.4,.7,.2).normalize(),(xd(J+911)-.5)*N*pe*7);for(let ae=0;ae<6;ae++){let de=(J*6+ae)*3;u.fromArray(A.rest,de).sub(re).applyQuaternion(h).add(re).add(d),u.toArray($,de)}}F.needsUpdate=!0,x.computeVertexNormals(),x.computeBoundingSphere()}}}};return p(void 0,0),{missingNodes:t,update:p,dispose(){if(!f){f=!0;for(let g of r)g.sources.forEach((b,A)=>{b.visible=g.visible[A]??!0}),g.group.removeFromParent(),g.geometry.dispose(),g.edgeGeometry.dispose(),g.material.dispose(),g.edgeMaterial.dispose()}}}}ms();ms();var j1=class extends Ke{constructor(e=new vt,t=new C,i=new ir,r=new C(1,1,1)){super();let s=[],o=[],a=[],c=new C,l=new It().getNormalMatrix(e.matrixWorld),u=new Oe;u.makeRotationFromEuler(i),u.setPosition(t);let d=new Oe;d.copy(u).invert(),h(),this.setAttribute("position",new Me(s,3)),this.setAttribute("uv",new Me(a,2)),o.length>0&&this.setAttribute("normal",new Me(o,3));function h(){let b=[],A=new C,y=new C,v=e.geometry,x=v.attributes.position,w=v.attributes.normal;if(v.index!==null){let _=v.index;for(let E=0;E<_.count;E++)A.fromBufferAttribute(x,_.getX(E)),w?(y.fromBufferAttribute(w,_.getX(E)),f(b,A,y)):f(b,A)}else{if(x===void 0)return;for(let _=0;_<x.count;_++)A.fromBufferAttribute(x,_),w?(y.fromBufferAttribute(w,_),f(b,A,y)):f(b,A)}b=p(b,c.set(1,0,0)),b=p(b,c.set(-1,0,0)),b=p(b,c.set(0,1,0)),b=p(b,c.set(0,-1,0)),b=p(b,c.set(0,0,1)),b=p(b,c.set(0,0,-1));for(let _=0;_<b.length;_++){let E=b[_];a.push(.5+E.position.x/r.x,.5+E.position.y/r.y),E.position.applyMatrix4(u),s.push(E.position.x,E.position.y,E.position.z),E.normal!==null&&o.push(E.normal.x,E.normal.y,E.normal.z)}}function f(b,A,y=null){A.applyMatrix4(e.matrixWorld),A.applyMatrix4(d),y?(y.applyNormalMatrix(l),b.push(new Ky(A.clone(),y.clone()))):b.push(new Ky(A.clone()))}function p(b,A){let y=[],v=.5*Math.abs(r.dot(A));for(let x=0;x<b.length;x+=3){let w=0,_,E,S,M,I=b[x+0].position.dot(A)-v,R=b[x+1].position.dot(A)-v,N=b[x+2].position.dot(A)-v,P=I>0,U=R>0,F=N>0;switch(w=(P?1:0)+(U?1:0)+(F?1:0),w){case 0:{y.push(b[x]),y.push(b[x+1]),y.push(b[x+2]);break}case 1:{if(P&&(_=b[x+1],E=b[x+2],S=g(b[x],_,A,v),M=g(b[x],E,A,v)),U){_=b[x],E=b[x+2],S=g(b[x+1],_,A,v),M=g(b[x+1],E,A,v),y.push(S),y.push(E.clone()),y.push(_.clone()),y.push(E.clone()),y.push(S.clone()),y.push(M);break}F&&(_=b[x],E=b[x+1],S=g(b[x+2],_,A,v),M=g(b[x+2],E,A,v)),y.push(_.clone()),y.push(E.clone()),y.push(S),y.push(M),y.push(S.clone()),y.push(E.clone());break}case 2:{P||(_=b[x].clone(),E=g(_,b[x+1],A,v),S=g(_,b[x+2],A,v),y.push(_),y.push(E),y.push(S)),U||(_=b[x+1].clone(),E=g(_,b[x+2],A,v),S=g(_,b[x],A,v),y.push(_),y.push(E),y.push(S)),F||(_=b[x+2].clone(),E=g(_,b[x],A,v),S=g(_,b[x+1],A,v),y.push(_),y.push(E),y.push(S));break}case 3:break}}return y}function g(b,A,y,v){let x=b.position.dot(y)-v,w=A.position.dot(y)-v,_=x/(x-w),E=new C(b.position.x+_*(A.position.x-b.position.x),b.position.y+_*(A.position.y-b.position.y),b.position.z+_*(A.position.z-b.position.z)),S=null;return b.normal!==null&&A.normal!==null&&(S=new C(b.normal.x+_*(A.normal.x-b.normal.x),b.normal.y+_*(A.normal.y-b.normal.y),b.normal.z+_*(A.normal.z-b.normal.z))),new Ky(E,S)}}},Ky=class{constructor(e,t=null){this.position=e,this.normal=t}clone(){let e=this.position.clone(),t=this.normal!==null?this.normal.clone():null;return new this.constructor(e,t)}};function jue(n,e,t){let i=!1;for(let r=0,s=t.length-1;r<t.length;s=r++){let o=t[r],a=t[s];o[1]>e!=a[1]>e&&n<(a[0]-o[0])*(e-o[1])/(a[1]-o[1])+o[0]&&(i=!i)}return i}function gH(n,e){let t=new wn(n,e,e);return t.colorSpace=rn,t.magFilter=ot,t.minFilter=mn,t.generateMipmaps=!0,t.needsUpdate=!0,t}function AH(n,e=256){let t=new Uint8Array(e*e*4);for(let i of n.shapes){let r=Number.parseInt(i.color.slice(1),16),s=i.points.map(d=>d[0]),o=i.points.map(d=>d[1]),a=Math.max(0,Math.floor(Math.min(...s)*e)),c=Math.min(e,Math.ceil(Math.max(...s)*e)),l=Math.max(0,Math.floor(Math.min(...o)*e)),u=Math.min(e,Math.ceil(Math.max(...o)*e));for(let d=l;d<u;d++)for(let h=a;h<c;h++){if(!jue((h+.5)/e,(d+.5)/e,i.points))continue;let f=(d*e+h)*4;t[f]=r>>16&255,t[f+1]=r>>8&255,t[f+2]=r&255,t[f+3]=255}}return gH(t,e)}function Que(n,e){let i=new Uint8Array(65536),r=(o,a)=>{let c=Math.imul((o&7)+31*(a&7),374761393)^n.seed;return c=Math.imul(c^c>>>13,1274126177),((c^c>>>16)>>>0)/4294967296};for(let o=0;o<128;o++)for(let a=0;a<128;a++){let c=a*8/128,l=o*8/128,u=Math.floor(c),d=Math.floor(l),h=c-u,f=l-d;h=h*h*(3-2*h),f=f*f*(3-2*f);let p=Ga.lerp(Ga.lerp(r(u,d),r(u+1,d),h),Ga.lerp(r(u,d+1),r(u+1,d+1),h),f),g=n.colors[Math.min(n.colors.length-1,Math.floor(p*n.colors.length))],b=Number.parseInt(g.slice(1),16),A=(o*128+a)*4;i[A]=b>>16&255,i[A+1]=b>>8&255,i[A+2]=b&255,i[A+3]=255}let s=gH(i,128);return s.wrapS=s.wrapT=jn,s.channel=e,s.repeat.setScalar(n.scale),s}var Xy=n=>Array.isArray(n.material)?n.material:[n.material],pH=new WeakMap;function mH(n,e){let t=n.geometry.index?n.geometry.toNonIndexed():n.geometry.clone(),i=Xy(n),r=Array.isArray(n.material)?t.groups:[{start:0,count:t.getAttribute("position").count,materialIndex:0}],s=[],o=[],a=t.getAttribute("position"),c=t.getAttribute("normal");for(let u of r)if(e.has(i[u.materialIndex??0]?.name??""))for(let d=u.start;d<Math.min(a.count,u.start+u.count);d++)s.push(a.getX(d),a.getY(d),a.getZ(d)),c&&o.push(c.getX(d),c.getY(d),c.getZ(d));t.dispose();let l=new Ke;return l.setAttribute("position",new Me(s,3)),o.length?l.setAttribute("normal",new Me(o,3)):l.computeVertexNormals(),l}function Wue(n,e,t,i,r){let s=n.geometry.index?n.geometry.toNonIndexed():n.geometry.clone(),o=r===0?"uv":`uv${r}`,a=s.getAttribute("position"),c=s.getAttribute(o)?Float32Array.from(s.getAttribute(o).array):new Float32Array(a.count*2),l=new Uint8Array(a.count);if(!Array.isArray(n.material))l.fill(1);else for(let g of s.groups)i.includes(n.material[g.materialIndex??0]?.name??"")&&l.fill(1,g.start,Math.min(a.count,g.start+g.count));let u=e.getSize(new C),d=Math.max(u.x,u.y,u.z,.001),h=new C,f=new C,p=new C;for(let g=0;g<a.count;g+=3){if(!l[g])continue;h.fromBufferAttribute(a,g).applyMatrix4(t),f.fromBufferAttribute(a,g+1).applyMatrix4(t),p.fromBufferAttribute(a,g+2).applyMatrix4(t);let b=f.clone().sub(h).cross(p.clone().sub(h)),A=Math.abs(b.y)>=Math.max(Math.abs(b.x),Math.abs(b.z))?"y":Math.abs(b.x)>Math.abs(b.z)?"x":"z";for(let[y,v]of[h,f,p].entries())c[(g+y)*2]=((A==="x"?v.z:v.x)-(A==="x"?e.min.z:e.min.x))/d,c[(g+y)*2+1]=((A==="y"?v.z:v.y)-(A==="y"?e.min.z:e.min.y))/d}return s.setAttribute(o,new ut(c,2)),s}function bH(n,e){let t=e.variants.find(y=>y.id===e.selected);if(!t)throw new Error(`Unknown livery: ${e.selected}`);let i=[],r=new Map,s=new Set,o=new Set,a=new Set,c=[],l=y=>{r.has(y)||r.set(y,{material:y.material,geometry:y.geometry})};n.updateWorldMatrix(!0,!0);let u=n.matrixWorld.clone().invert(),d=pH.get(n);d||(d=new Map,n.traverse(y=>{y instanceof vt&&d?.set(y,u.clone().multiply(y.matrixWorld))}),pH.set(n,d));let h=y=>(d?.get(y)??u.clone().multiply(y.matrixWorld)).clone(),f=new Map;for(let[y,v]of Object.entries(e.slots)){let x=v.node===void 0?n:n.getObjectByName(v.node),w=[],_=new On,E=S=>{if(!(S instanceof vt)||w.includes(S)||!Xy(S).some(I=>v.materials.includes(I.name)))return;if(S.isSkinnedMesh||S.morphTargetInfluences?.length){i.push(`Slot ${y}: deforming mesh ${S.name} is unsupported`);return}w.push(S);let M=mH(S,new Set(v.materials));M.applyMatrix4(h(S)),M.computeBoundingBox(),M.boundingBox&&_.union(M.boundingBox),M.dispose()};x?.traverse(E),v.node!==void 0&&n.traverse(S=>{let M=S.userData.liverySourceNodes;Array.isArray(M)&&M.includes(v.node)&&E(S)}),(!w.length||_.isEmpty())&&i.push(`Slot ${y}: no matching surface`),f.set(y,{meshes:w,bounds:_,binding:v})}let p=new Map,g=new Set;n.traverse(y=>{if(y instanceof vt)for(let v of Xy(y))for(let x of Object.values(v))x instanceof Gt&&g.add(x.channel)});let b=[3,2,1,0].find(y=>!g.has(y));for(let[y,v]of Object.entries(t.paints)){let x=f.get(y);if(!x||x.bounds.isEmpty()){i.push(`Paint ${y}: missing slot`);continue}let w=new Map;v.camouflage&&b===void 0&&i.push(`Paint ${y}: no unused UV channel for camouflage; using the base color`);let _=v.camouflage&&b!==void 0?Que(v.camouflage,b):void 0;_&&a.add(_);for(let E of x.meshes){l(E);let S=p.get(E)??new Set;p.set(E,S);let M=Xy(E).map((I,R)=>{if(!x.binding.materials.includes(I.name))return I;if(S.has(R))return i.push(`Paint ${y}: overlapping slot on ${E.name}`),I;S.add(R);let N=w.get(I);return N||(N=I.clone(),w.set(I,N),s.add(N),"color"in N&&N.color.set(v.color),"roughness"in N&&v.roughness!==void 0&&(N.roughness=v.roughness),"metalness"in N&&v.metalness!==void 0&&(N.metalness=v.metalness),"map"in N&&(N.map=_??null),_&&"color"in N&&N.color.set("#ffffff"),N.needsUpdate=!0),N});E.material=Array.isArray(E.material)?M:M[0],_&&(E.geometry=Wue(E,x.bounds,h(E),x.binding.materials,_.channel),o.add(E.geometry))}}for(let y of t.markings??[]){let v=e.anchors?.[y.anchor],x=v&&f.get(v.slot);if(!v||!x||x.bounds.isEmpty()){i.push(`Marking ${y.anchor}: missing surface`);continue}let w=x.bounds.getSize(new C),_=new C(...v.position).multiply(w).add(x.bounds.min),E=new C(...v.size).multiplyScalar(Math.max(w.x,w.y,w.z)),S=new ir(...v.rotation),M=new C(0,0,1).applyEuler(S),I=AH(y.graphic);a.add(I);let R=new ii({map:I,transparent:!0,depthWrite:!1,roughness:.65,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});s.add(R);let N=0;for(let P of x.meshes){let U=mH(P,new Set(x.binding.materials)),F=h(P);U.applyMatrix4(F);let $=U.getAttribute("position"),V=U.getAttribute("normal"),J=[],re=Xy(P).some(de=>x.binding.materials.includes(de.name)&&de.side===ln);for(let de=0;de<$.count;de+=3){let Be=new C().fromBufferAttribute(V,de).dot(M);if(Be>.05)J.push(de,de+1,de+2);else if(re&&Be<-.05){J.push(de,de+2,de+1);for(let Ze=de;Ze<de+3;Ze++)V.setXYZ(Ze,-V.getX(Ze),-V.getY(Ze),-V.getZ(Ze))}}U.setIndex(J);let pe=new j1(new vt(U),_,S,E);if(U.dispose(),!pe.getAttribute("position").count){pe.dispose();continue}pe.applyMatrix4(F.invert()),o.add(pe);let ae=new vt(pe,R);ae.name=`livery:${y.anchor}`,ae.userData.liveryMarking=!0,ae.receiveShadow=!0,ae.renderOrder=1,P.add(ae),c.push(ae),N++}N||i.push(`Marking ${y.anchor}: projector misses its surface`)}let A=!1;return{warnings:i,dispose(){if(!A){A=!0;for(let y of c)y.removeFromParent();for(let[y,v]of r)y.material=v.material,y.geometry=v.geometry;for(let y of o)y.dispose();for(let y of s)y.dispose();for(let y of a)y.dispose()}}}}zF();VF();ms();function X1(n){let e=new Map,t=new Map,i=n.clone();return CH(n,i,function(r,s){e.set(s,r),t.set(r,s)}),i.traverse(function(r){if(!r.isSkinnedMesh)return;let s=r,o=e.get(r),a=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=a.map(function(c){return t.get(c)}),s.bind(s.skeleton,s.bindMatrix)}),i}function CH(n,e,t){t(n,e);for(let i=0;i<n.children.length;i++)CH(n.children[i],e.children[i],t)}function ude(n,e,t){let i=(n|0)*374761393+(e|0)*668265263+(t|0)*2147483647;return i=(i^i>>>13)>>>0,i=Math.imul(i,1274126177)>>>0,(i^i>>>16)>>>0}function If(n,e,t){return ude(n,e,t)/4294967296}function J1(n){return n*n*(3-2*n)}function qg(n,e,t){return n+(e-n)*t}function dde(n,e,t){let i=Math.floor(n),r=Math.floor(e),s=J1(n-i),o=J1(e-r),a=If(i,r,t),c=If(i+1,r,t),l=If(i,r+1,t),u=If(i+1,r+1,t);return qg(qg(a,c,s),qg(l,u,s),o)}function hde(n,e,t){let i=Math.floor(n),r=Math.floor(e),s=n-i,o=e-r,a=(u,d,h,f)=>{let p=If(u,d,t)*Math.PI*2;return Math.cos(p)*h+Math.sin(p)*f},c=J1(s),l=J1(o);return qg(qg(a(i,r,s,o),a(i+1,r,s-1,o),c),qg(a(i,r+1,s,o-1),a(i+1,r+1,s-1,o-1),c),l)*.5+.5}function fde(n,e,t,i,r,s,o){let a=1,c=1,l=0,u=0;for(let d=0;d<r;d++)l+=a*n(e*c,t*c,i+d*1013),u+=a,a*=o,c*=s;return u>0?l/u:0}function pde(n,e,t,i,r){let s=Math.floor(n),o=Math.floor(e),a=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY;for(let u=-1;u<=1;u++)for(let d=-1;d<=1;d++){let h=s+d,f=o+u,p=h+i*If(h,f,t),g=f+i*If(h,f,t+7919),b=p-n,A=g-e,y=Math.sqrt(b*b+A*A);y<a?(c=a,a=y):y<c&&(c=y)}let l=r==="f1"?a:r==="f2"?c:c-a;return Math.min(1,l)}var HF=8192,RH=16777216;function mde(n,e){if(!Number.isSafeInteger(n)||!Number.isSafeInteger(e)||n<1||e<1)throw new Error(`image dimensions must be positive safe integers, got ${n}x${e}`);if(n>HF||e>HF||n*e>RH)throw new Error(`image dimensions exceed the ${HF}px/${RH}-pixel limit`)}function OH(n,e){return mde(n,e),{width:n,height:e,data:new Uint8ClampedArray(n*e*4)}}var BH=256,NH=64;function ev(n){let e=n.slice(1);return[Number.parseInt(e.slice(0,2),16)/255,Number.parseInt(e.slice(2,4),16)/255,Number.parseInt(e.slice(4,6),16)/255,e.length>=8?Number.parseInt(e.slice(6,8),16)/255:1]}function tv(n){return n.t==="s"?n.v:n.t==="c"?(n.v[0]+n.v[1]+n.v[2])/3:n.v[0]}function QF(n){return n.t==="c"?n.v:n.t==="s"?[n.v,n.v,n.v,1]:[n.v[0],n.v[1],0,1]}function jF(n){return n.t==="uv"?n.v:n.t==="s"?[n.v,n.v]:[n.v[0],n.v[1]]}function Cc(n){return n<0?0:n>1?1:n}var kH=new Map([["const",["value"]],["uv",[]],["uv-transform",["scale","offset","rotateDeg"]],["noise",["kind","octaves","lacunarity","gain","scale","seedOffset"]],["worley",["scale","jitter","output"]],["gradient",["kind","angleDeg"]],["checker",["scale"]],["bricks",["rows","cols","mortarWidth","offset","output"]],["ramp",["stops"]],["blend",["mode","factor"]],["threshold",["edge","smoothness"]],["invert",[]],["levels",["inMin","inMax","gamma","outMin","outMax"]],["height-to-normal",["strength"]]]),wd="bake a validated document \u2014 validateByKind('matgraph', doc) applies the schema defaults";function WF(n){return typeof n=="number"?Number.isFinite(n):Array.isArray(n)?n.every(WF):typeof n=="object"&&n!==null?Object.values(n).every(WF):n!==void 0}function gde(n){let e=kH.get(n.type);if(e===void 0)throw new Error(`material graph node "${n.id}" has unknown type "${n.type}" \u2014 known types: ${[...kH.keys()].join(", ")}`);let t=n.params;if(e.length>0&&(t===null||typeof t!="object"))throw new Error(`material graph node "${n.id}" (${n.type}) has no params \u2014 ${wd}`);for(let i of e){let r=t[i];if(r===void 0)throw new Error(`material graph node "${n.id}" (${n.type}) is missing params.${i} \u2014 ${wd}`);if(!WF(r))throw new Error(`material graph node "${n.id}" (${n.type}) has a non-finite params.${i} \u2014 ${wd}`)}}function Ade(n,e){let t=n>>>0;for(let i=0;i<e.length;i++)t=Math.imul(t^e.charCodeAt(i),2654435761)+1>>>0;return t>>>0}var bde=class{doc;byId=new Map;seeds=new Map;memo=new Map;constructor(n){if(this.doc=n,!Array.isArray(n.nodes)||n.nodes.length<1||n.nodes.length>BH)throw new Error(`material graph must contain 1..${BH} nodes`);if(!Number.isFinite(n.seed))throw new Error(`material graph has a non-finite seed (${String(n.seed)}) \u2014 ${wd}`);if(n.outputs===null||typeof n.outputs!="object")throw new Error(`material graph has no outputs map \u2014 ${wd}`);for(let e of n.nodes)gde(e),this.byId.set(e.id,e),this.seeds.set(e.id,Ade(n.seed,e.id));this.detectCycles()}detectCycles(){let n=new Map,e=[],t=i=>{let r=n.get(i)??0;if(r===2)return;if(r===1){let o=[...e.slice(e.indexOf(i)),i].join(" \u2192 ");throw new Error(`material graph has a cycle: ${o}`)}if(n.set(i,1),e.push(i),e.length>NH)throw new Error(`material graph depth exceeds the limit of ${NH}`);let s=this.byId.get(i);if(s!==void 0)for(let o of this.depsOf(s))this.byId.has(o)&&t(o);e.pop(),n.set(i,2)};for(let i of this.doc.nodes)t(i.id)}depsOf(n){let e=[];return n.input!==void 0&&e.push(n.input),n.inputs!==void 0&&e.push(...Object.values(n.inputs)),e}input(n,e,t){let i=n.input??n.inputs?.a;if(i!==void 0)return this.eval(i,e,t)}beginSample(){this.memo.clear()}eval(n,e,t){let i=`${n}\0${e}\0${t}`,r=this.memo.get(i);if(r!==void 0)return r;let s=this.evalUncached(n,e,t);return this.memo.set(i,s),s}evalUncached(n,e,t){let i=this.byId.get(n);if(i===void 0)return{t:"s",v:0};let r=this.seeds.get(n)??0;switch(i.type){case"const":{let s=i.params.value;return typeof s=="number"?{t:"s",v:s}:{t:"c",v:s}}case"uv":return{t:"uv",v:[e,t]};case"uv-transform":{let s=this.input(i,e,t),[o,a]=s!==void 0?jF(s):[e,t],{scale:c,offset:l,rotateDeg:u}=i.params,d=u*Math.PI/180,h=o-.5,f=a-.5,p=h*Math.cos(d)-f*Math.sin(d),g=h*Math.sin(d)+f*Math.cos(d);return{t:"uv",v:[(p+.5)*c+l[0],(g+.5)*c+l[1]]}}case"noise":{let s=this.input(i,e,t),[o,a]=s!==void 0?jF(s):[e,t];return{t:"s",v:Cc(fde(i.params.kind==="value"?dde:hde,o*i.params.scale,a*i.params.scale,r+i.params.seedOffset,i.params.octaves,i.params.lacunarity,i.params.gain))}}case"worley":{let s=this.input(i,e,t),[o,a]=s!==void 0?jF(s):[e,t];return{t:"s",v:pde(o*i.params.scale,a*i.params.scale,r,i.params.jitter,i.params.output)}}case"gradient":{let s=i.params.angleDeg*Math.PI/180;if(i.params.kind==="radial"){let o=e-.5,a=t-.5;return{t:"s",v:Cc(Math.sqrt(o*o+a*a)*2)}}return{t:"s",v:Cc(e*Math.cos(s)+t*Math.sin(s))}}case"checker":{let s=i.params.scale;return{t:"s",v:(Math.floor(e*s)+Math.floor(t*s))%2===0?0:1}}case"bricks":{let{rows:s,cols:o,mortarWidth:a,offset:c,output:l}=i.params,u=t*s,d=Math.floor(u),h=d%2===0?0:c,f=(e*o+h)%1,p=u-d;if(l==="row")return{t:"s",v:p};let g=f<a||f>1-a||p<a||p>1-a;if(l!=="random"||g)return{t:"s",v:g?0:1};let b=(Math.floor(e*o+h)%o+o)%o>>>0,A=(d%s+s)%s>>>0,y=(r^Math.imul(A+1,2654435761)^Math.imul(b+1,2246822507))>>>0;return y=Math.imul(y^y>>>16,2146121005)>>>0,y=Math.imul(y^y>>>15,2221713035)>>>0,{t:"s",v:((y^y>>>16)>>>0)/4294967296}}case"ramp":{let s=Cc(tv(this.input(i,e,t)??{t:"s",v:0}));return{t:"c",v:yde(i.params.stops,s)}}case"blend":{let s=QF(this.input(i,e,t)??{t:"s",v:0}),o=i.inputs?.b;return{t:"c",v:vde(s,o!==void 0?QF(this.eval(o,e,t)):[0,0,0,1],i.params.mode,i.params.factor)}}case"threshold":{let s=tv(this.input(i,e,t)??{t:"s",v:0}),{edge:o,smoothness:a}=i.params,c=o-a,l=o+a,u=l>c?Cc((s-c)/(l-c)):s>=o?1:0;return{t:"s",v:u*u*(3-2*u)}}case"invert":{let s=this.input(i,e,t)??{t:"s",v:0};return s.t==="c"?{t:"c",v:[1-s.v[0],1-s.v[1],1-s.v[2],s.v[3]]}:{t:"s",v:1-tv(s)}}case"levels":{let s=tv(this.input(i,e,t)??{t:"s",v:0}),{inMin:o,inMax:a,gamma:c,outMin:l,outMax:u}=i.params,d=a>o?Cc((s-o)/(a-o)):0;return{t:"s",v:l+(c>0?d**(1/c):d)*(u-l)}}case"height-to-normal":{let s=1/this.doc.size[0],o=1/this.doc.size[1],a=(p,g)=>tv(this.input(i,p,g)??{t:"s",v:0}),c=(a(e+s,t)-a(e-s,t))/(2*s)*i.params.strength,l=(a(e,t+o)-a(e,t-o))/(2*o)*i.params.strength,u=-c,d=-l,h=1,f=Math.sqrt(u*u+d*d+h*h)||1;return{t:"c",v:[u/f*.5+.5,d/f*.5+.5,h/f*.5+.5,1]}}default:return{t:"s",v:0}}}};function yde(n,e){let t=[...n].sort((r,s)=>r.t-s.t);if(e<=t[0].t)return ev(t[0].color);let i=t[t.length-1];if(e>=i.t)return ev(i.color);for(let r=0;r<t.length-1;r++){let s=t[r],o=t[r+1];if(e>=s.t&&e<=o.t){let a=o.t>s.t?(e-s.t)/(o.t-s.t):0,c=ev(s.color),l=ev(o.color);return[c[0]+(l[0]-c[0])*a,c[1]+(l[1]-c[1])*a,c[2]+(l[2]-c[2])*a,c[3]+(l[3]-c[3])*a]}}return ev(i.color)}function vde(n,e,t,i){let r=[0,0,0,1];for(let s=0;s<3;s++){let o=n[s],a=e[s],c;switch(t){case"multiply":c=o*a;break;case"add":c=o+a;break;case"screen":c=1-(1-o)*(1-a);break;case"overlay":c=o<.5?2*o*a:1-2*(1-o)*(1-a);break;default:c=a;break}r[s]=o+(c-o)*i}return r[3]=n[3],r}function xde(n,e,t,i){let r=Object.entries(e).filter(o=>typeof o[1]=="string"),s={};for(let[o]of r)s[o]=OH(t,i);for(let o=0;o<i;o++){let a=(o+.5)/i;for(let c=0;c<t;c++){let l=(c+.5)/t;n.beginSample();let u=(o*t+c)*4;for(let[d,h]of r){let f=QF(n.eval(h,l,a)),p=s[d].data;p[u]=Math.round(Cc(f[0])*255),p[u+1]=Math.round(Cc(f[1])*255),p[u+2]=Math.round(Cc(f[2])*255),p[u+3]=Math.round(Cc(f[3])*255)}}}return s}function LH(n){if(n.alphaCoverage!==void 0&&typeof n.alphaCoverage!="boolean"||n.alphaCoverage&&(n.alphaTest!==void 0||!n.outputs?.baseColor))throw new Error(`material graph alphaCoverage requires baseColor and excludes alphaTest \u2014 ${wd}`);if(n.alphaTest!==void 0&&(!Number.isFinite(n.alphaTest)||n.alphaTest<0||n.alphaTest>1))throw new Error(`material graph alphaTest must be finite and between 0 and 1 \u2014 ${wd}`);if(!Array.isArray(n.size)||n.size.length!==2)throw new Error(`material graph has no size [width, height] \u2014 ${wd}`);let[e,t]=n.size;return{slots:xde(new bde(n),n.outputs,e,t),meta:{filter:"linear",...n.alphaTest===void 0?{}:{alphaTest:n.alphaTest},...n.alphaCoverage?{alphaCoverage:!0}:{}}}}function _de(n){if(n==="transparent")return[0,0,0,0];let e=n.replace("#","");return[Number.parseInt(e.slice(0,2),16),Number.parseInt(e.slice(2,4),16),Number.parseInt(e.slice(4,6),16),e.length>=8?Number.parseInt(e.slice(6,8),16):255]}function UH(n){let e=n.slots;if(e===void 0)throw new Error("pixelgrid document has no slots block \u2014 validate it first (molen/pixelgrid@1 defaults to { baseColor: true, emissive: false })");if(e.baseColor!==!0&&e.emissive!==!0)throw new Error("pixelgrid has every slot disabled \u2014 enable slots.baseColor or slots.emissive");let[t,i]=n.size;if(n.rows.length!==i)throw new Error(`pixelgrid has ${n.rows.length} rows, expected ${i} (size height)`);let r=new Map;for(let[c,l]of Object.entries(n.palette)){if(l!=="transparent"&&!/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(l))throw new Error(`palette entry "${c}" has invalid color "${l}" (expected transparent or #rrggbb[aa])`);r.set(c,_de(l))}let s=OH(t,i),o=!1;for(let c=0;c<i;c++){let l=n.rows[c],u=[...l];if(u.length!==t)throw new Error(`row ${c} has ${u.length} chars, expected ${t}; row: "${l}"`);for(let d=0;d<t;d++){let h=u[d],f=r.get(h);if(f===void 0)throw new Error(`char "${h}" at row ${c} col ${d} is not in the palette \u2014 keys are: ${[...r.keys()].join(" ")}`);f[3]===0&&(o=!0);let p=(c*t+d)*4;s.data[p]=f[0],s.data[p+1]=f[1],s.data[p+2]=f[2],s.data[p+3]=f[3]}}let a={};return e.baseColor&&(a.baseColor=s),e.emissive&&(a.emissive=s),{slots:a,meta:{filter:n.filter,...o?{alphaTest:.5}:{}}}}var wde=/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,DH=256,FH=64;function Sde(n){let e=n,t=[];e.slots!==void 0&&e.slots.baseColor!==!0&&e.slots.emissive!==!0&&t.push({path:"/slots",code:"no_slot_enabled",message:"every texture slot is disabled, so the grid would rasterize to nothing",expected:"baseColor and/or emissive set to true",received:JSON.stringify(e.slots)});let i=e.palette??{};for(let[a,c]of Object.entries(i))c!=="transparent"&&!wde.test(c)&&t.push({path:`/palette/${a}`,code:"invalid_color",message:`palette entry "${a}" has invalid color "${c}"`,expected:"transparent or #rrggbb[aa]"});if(!Array.isArray(e.size))return t;let[r,s]=e.size,o=e.rows??[];return o.length!==s&&t.push({path:"/rows",code:"row_count",message:`${o.length} rows, expected ${s} (size height)`,expected:`${s} rows`,received:`${o.length} rows`}),o.forEach((a,c)=>{let l=[...a];l.length!==r&&t.push({path:`/rows/${c}`,code:"row_length",message:`row ${c} has ${l.length} chars, expected ${r} (size width)`,received:JSON.stringify(a)});for(let u=0;u<l.length;u++){let d=l[u];if(!Object.hasOwn(i,d)){t.push({path:`/rows/${c}`,code:"unknown_palette_char",message:`char "${d}" at row ${c} col ${u} is not in the palette`,expected:`one of: ${Object.keys(i).join(" ")}`});break}}}),t}function qF(n){let e=[];return n.input!==void 0&&e.push(n.input),n.inputs!==void 0&&e.push(...Object.values(n.inputs)),e}function Ede(n){let e=n,t=e.nodes??[],i=[];e.alphaCoverage&&(e.alphaTest!==void 0||!e.outputs?.baseColor)&&i.push({path:"/alphaCoverage",code:"alpha_coverage",message:"alphaCoverage requires baseColor and cannot be combined with alphaTest"});let r=new Set;t.forEach((o,a)=>{r.has(o.id)&&i.push({path:`/nodes/${a}/id`,code:"duplicate_node_id",message:`duplicate node id "${o.id}"`}),r.add(o.id)}),t.forEach((o,a)=>{for(let c of qF(o))if(!r.has(c)){let l=ss(c,[...r]);i.push({path:`/nodes/${a}`,code:"unknown_node_ref",message:`node "${o.id}" references unknown node "${c}"`,...l!==void 0?{hint:`did you mean "${l}"?`}:{}})}});for(let[o,a]of Object.entries(e.outputs??{}))if(a!==void 0&&!r.has(a)){let c=ss(a,[...r]);i.push({path:`/outputs/${o}`,code:"unknown_node_ref",message:`output "${o}" references unknown node "${a}"`,...c!==void 0?{hint:`did you mean "${c}"?`}:{}})}let s=Mde(t,r);if(s!==void 0)i.push({path:"/nodes",code:"graph_cycle",message:`material graph has a cycle: ${s.join(" \u2192 ")}`});else{let o=Tde(t);o>FH&&i.push({path:"/nodes",code:"graph_depth",message:`material graph depth ${o} exceeds the limit of ${FH}`,hint:"split or flatten long dependency chains"})}return t.forEach((o,a)=>{let c=o;c.type==="levels"&&c.params?.inMin!==void 0&&c.params.inMax!==void 0&&c.params.inMin>=c.params.inMax&&i.push({path:`/nodes/${a}/params`,code:"levels_range",message:"levels.inMin must be less than levels.inMax"})}),i}function Tde(n){let e=new Map(n.map(r=>[r.id,r])),t=new Map,i=r=>{let s=t.get(r);if(s!==void 0)return s;let o=e.get(r),a=o===void 0?0:1+Math.max(0,...qF(o).filter(c=>e.has(c)).map(i));return t.set(r,a),a};return Math.max(0,...n.map(r=>i(r.id)))}function Mde(n,e){let t=new Map(n.map(a=>[a.id,a])),i=new Map,r=[],s,o=a=>{if(s!==void 0)return;let c=i.get(a)??0;if(c===2)return;if(c===1){s=[...r.slice(r.indexOf(a)),a];return}i.set(a,1),r.push(a);let l=t.get(a);if(l!==void 0)for(let u of qF(l))e.has(u)&&o(u);r.pop(),i.set(a,2)};for(let a of n)o(a.id);return s}var Ide=m.string().regex(/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,"expected #rrggbb or #rrggbbaa"),Cde=m.strictObject({t:m.number().min(0).max(1).describe("Position of the stop along the input 0..1."),color:Ide.describe("Stop color '#rrggbb' or '#rrggbbaa'.")}),Gs={id:m.string().min(1).describe("Node id, unique within the graph."),input:m.string().min(1).describe("Id of the single upstream node this node reads (single-input nodes).").optional(),inputs:m.record(m.string(),m.string()).describe("Named upstream node ids for multi-input nodes, e.g. { a: 'n1', b: 'n2' } for blend.").optional()},Z1=n=>m.number().positive().max(1e6).describe(`Pattern repeats across the 0..1 UV range (default ${n}).`).default(n),Rde=m.discriminatedUnion("type",[m.strictObject({...Gs,type:m.literal("const").describe("Constant scalar or RGBA value."),params:m.strictObject({value:m.union([m.number(),m.array(m.number()).length(4)]).describe("Scalar 0..1 or [r, g, b, a] 0..1.")}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("uv").describe("Raw UV coordinates as a value."),params:m.strictObject({}).describe("No parameters.").default({})}),m.strictObject({...Gs,type:m.literal("uv-transform").describe("Scale/offset/rotate the UV space of the upstream node."),params:m.strictObject({scale:Z1(1),offset:m.array(m.number()).length(2).describe("UV offset [u, v] in 0..1 units (default [0, 0]).").default([0,0]),rotateDeg:m.number().describe("Rotation in degrees about the UV origin (default 0).").default(0)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("noise").describe("Fractal noise field (0..1)."),params:m.strictObject({kind:m.enum(["simplex","value"]).describe("Base noise: simplex (default) or value noise.").default("simplex"),octaves:m.int().min(1).max(8).describe("Number of fBm octaves, 1..8 (default 4).").default(4),lacunarity:m.number().positive().max(16).describe("Frequency multiplier per octave (default 2).").default(2),gain:m.number().min(0).max(1).describe("Amplitude multiplier per octave, 0..1 (default 0.5).").default(.5),scale:Z1(4),seedOffset:m.int().describe("Added to the document seed so sibling noise nodes differ (default 0).").default(0)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("worley").describe("Worley (cellular) noise (0..1)."),params:m.strictObject({scale:Z1(4),jitter:m.number().min(0).max(1).describe("Cell point randomness, 0 (regular grid) .. 1 (default).").default(1),output:m.enum(["f1","f2","f2-f1"]).describe("Distance output: nearest (f1, default), second-nearest (f2), or their difference (f2-f1).").default("f1")}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("gradient").describe("Linear or radial gradient (0..1)."),params:m.strictObject({kind:m.enum(["linear","radial"]).describe("linear across UV (default) or radial from the center.").default("linear"),angleDeg:m.number().describe("Direction of a linear gradient in degrees (0 = along +u; default 0).").default(0)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("checker").describe("Checkerboard (0/1)."),params:m.strictObject({scale:Z1(8)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("bricks").describe("Running-bond bricks: a brick/mortar mask, a per-brick random value or the position within a row."),params:m.strictObject({rows:m.int().positive().max(4096).describe("Brick rows across V (default 8).").default(8),cols:m.int().positive().max(4096).describe("Brick columns across U (default 4).").default(4),mortarWidth:m.number().min(0).max(.5).describe("Mortar width as a fraction of one brick cell, 0..0.5 (default 0.05).").default(.05),offset:m.number().min(0).max(1).describe("Horizontal shift of alternate rows as a fraction of a brick, 0..1 (default 0.5).").default(.5),output:m.enum(["mask","random","row"]).describe("mask (default): 1 on a brick, 0 on mortar. random: a stable 0..1 value per brick (0 on mortar), for per-tile tone variation. row: position within the row, 0 at its top (v) edge to 1 at its bottom, for course shading and normals.").default("mask")}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("ramp").describe("Map the scalar input 0..1 through a color ramp."),params:m.strictObject({stops:m.array(Cde).min(2).describe("Color stops ordered by t (at least two).")}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("blend").describe("Combine inputs.a and inputs.b."),params:m.strictObject({mode:m.enum(["mix","multiply","add","screen","overlay"]).describe("Blend mode (default mix).").default("mix"),factor:m.number().min(0).max(1).describe("Weight of input b, 0..1 (default 0.5).").default(.5)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("threshold").describe("Soft step of the scalar input around an edge."),params:m.strictObject({edge:m.number().describe("Input value at which the output crosses 0.5 (default 0.5).").default(.5),smoothness:m.number().nonnegative().max(1).describe("Half-width of the smooth transition around edge, 0..1 (default 0.05).").default(.05)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("invert").describe("1 - input."),params:m.strictObject({}).describe("No parameters.").default({})}),m.strictObject({...Gs,type:m.literal("levels").describe("Remap input range to output range with gamma."),params:m.strictObject({inMin:m.number().describe("Input value mapped to outMin (default 0).").default(0),inMax:m.number().describe("Input value mapped to outMax (default 1; must exceed inMin).").default(1),gamma:m.number().positive().max(100).describe("Gamma exponent (default 1).").default(1),outMin:m.number().describe("Output low value (default 0).").default(0),outMax:m.number().describe("Output high value (default 1).").default(1)}).describe("Node parameters.")}),m.strictObject({...Gs,type:m.literal("height-to-normal").describe("Derive a tangent-space normal map from a height input."),params:m.strictObject({strength:m.number().nonnegative().max(100).describe("Height gradient multiplier (default 1).").default(1)}).describe("Node parameters.")})]),Xo=n=>m.string().describe(`Id of the node rasterized into the ${n} texture.`),Wg={baseColor:Xo("baseColor").optional(),roughness:Xo("roughness").optional(),metalness:Xo("metalness").optional(),normal:Xo("normal").optional(),emissive:Xo("emissive").optional(),ao:Xo("ambient-occlusion").optional()},Bde=m.union([m.strictObject({...Wg,baseColor:Xo("baseColor")}),m.strictObject({...Wg,roughness:Xo("roughness")}),m.strictObject({...Wg,metalness:Xo("metalness")}),m.strictObject({...Wg,normal:Xo("normal")}),m.strictObject({...Wg,emissive:Xo("emissive")}),m.strictObject({...Wg,ao:Xo("ambient-occlusion")})]).describe("Texture slot to node id (at least one slot)."),Nde=m.strictObject({format:m.literal("molen/matgraph@1").describe("Format envelope; always 'molen/matgraph@1'."),alphaCoverage:m.boolean().optional().describe("Filter baseColor alpha as fractional surface coverage for porous surfaces. Uses mipmapped alpha blending; requires baseColor and excludes alphaTest. Like portable glTF BLEND, overlapping transparent surfaces require sorting."),alphaTest:m.number().min(0).max(1).optional().describe("Optional alpha cutout threshold for baseColor RGBA. Omit for opaque materials; this does not enable blended transparency."),size:m.array(m.int().min(1).max(2048)).length(2).describe("Output texture size [width, height] in pixels, 1..2048 (default [512, 512]).").default([512,512]),seed:m.int().describe("Deterministic seed for noise nodes (default 0).").default(0),nodes:m.array(Rde).min(1).max(DH).describe(`Graph nodes (1..${DH}); each is a pure per-UV function of its inputs.`),outputs:Bde}),kde=m.strictObject({format:m.literal("molen/pixelgrid@1").describe("Format envelope; always 'molen/pixelgrid@1'."),size:m.array(m.int().min(1).max(256)).length(2).describe("Grid size [width, height] in pixels, 1..256."),palette:m.record(m.string(),m.string()).describe("Single-character key to 'transparent' or '#rrggbb[aa]' color."),rows:m.array(m.string()).min(1).describe("One string per row (top to bottom), each `width` palette characters long."),slots:m.strictObject({baseColor:m.boolean().describe("Emit the baseColor texture (default true).").default(!0),emissive:m.boolean().describe("Also emit the grid as an emissive texture (default false).").default(!1)}).describe("Which material texture slots the grid is rasterized into.").default({baseColor:!0,emissive:!1}),filter:m.enum(["nearest","linear"]).describe("Texture sampling filter: nearest (crisp pixels, default) or linear.").default("nearest")}),PH=!1;function KF(){PH||(PH=!0,Xn("pixelgrid",kde,{id:"molen/pixelgrid@1",title:"Pixel-grid texture",description:"Indexed palette + rows of characters rasterized to a pixel-art texture.",examples:[{format:"molen/pixelgrid@1",size:[4,4],palette:{".":"transparent",X:"#222222",o:"#e6b84a"},rows:[".XX.","XooX","XooX",".XX."]}],docsRef:"schemas/pixelgrid.md",validate:Sde}),Xn("uvpaint",m.strictObject({format:m.literal("molen/uvpaint@1").describe("Format envelope; always 'molen/uvpaint@1'."),model:m.string().min(1).describe("Sidecar-relative path of the model the template was unwrapped from."),atlasSize:m.array(m.int().positive()).length(2).describe("Template/atlas size [width, height] in pixels (default [1024, 1024]).").default([1024,1024]),texelDensity:m.number().positive().describe("Texels per meter of model surface the atlas was laid out at (default 128).").default(128),islands:m.array(m.strictObject({id:m.int().nonnegative().describe("Island number as printed on the template."),label:m.string().describe("Human label for the island, e.g. 'head'.").default(""),color:m.string().regex(/^#[0-9a-fA-F]{6}$/).describe("'#rrggbb' key color of the island in the island map."),uvBBox:m.array(m.number()).length(4).describe("Island bounds [minU, minV, maxU, maxV] in 0..1 UV space."),notes:m.string().describe("Free-form painting notes.").default("")})).describe("UV islands annotated on the template.").default([]),paintedImage:m.string().describe("Sidecar-relative path of the painted template image to re-import.").optional(),importRules:m.strictObject({maskToIslands:m.boolean().describe("Clip paint to the island shapes on import (default true).").default(!0),dilationPx:m.int().nonnegative().describe("Gutter dilation in pixels applied after masking (default 8).").default(8)}).describe("How the painted image is turned back into a texture.").default({maskToIslands:!0,dilationPx:8})}),{id:"molen/uvpaint@1",title:"UV paint sidecar",description:"Island annotations pairing a paint-by-numbers template with a model for re-import.",examples:[{format:"molen/uvpaint@1",model:"models/scout.glb",atlasSize:[1024,1024],islands:[{id:1,label:"head",color:"#e6194b",uvBBox:[.02,.05,.31,.4]}]}],docsRef:"schemas/uvpaint.md"}),Xn("matgraph",Nde,{id:"molen/matgraph@1",title:"Procedural material graph",description:"A small node graph (noise, gradients, ramps, blends) CPU-rasterized to textures.",examples:[{format:"molen/matgraph@1",size:[256,256],seed:1337,nodes:[{id:"n1",type:"noise",params:{kind:"simplex",octaves:5,scale:4}},{id:"n2",type:"ramp",input:"n1",params:{stops:[{t:0,color:"#4a4a52"},{t:.6,color:"#6e6a63"},{t:1,color:"#9a948a"}]}}],outputs:{baseColor:"n2"}}],docsRef:"schemas/matgraph.md",validate:Ede}))}var EFe=["node",":"].join("");KF();var $H=(function(){var n="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq:VZkdbk:XYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbh5dnawTmbaxa8Acd4fRbbh5kcbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:ysezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:W9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:JBl8Aud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fhOaPaDfhAasaeaH9RaHasfae6EgCcsfgocl4cifcd4hXavcj;cbfaoc9WGgQcetfhLavcj;cbfaQci2fhKavcj;cbfaQfhYcbh8Aaoc;ab6hEincbh3dnawTmbaPa8Acd4fRbbh3kcbh5avcj;cbfh8Eindndndndna3a5cet4ciGgoc9:fPdebdkaxaA9RaQ6mwdnaQTmbavcj;cbfa5aQ2faAaQ;8qbbkaAaCfhAxdkaQTmeavcj;cbfa5aQ2fcbaQ;8kbxekaxaA9RaX6moaoclVcbawEhraAaXfhocbhidnaEmbaxao9Rc;Gb6mbcbhlina8EalfhidndndndndndnaAalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiczfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaicafaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaQ0meaihlaxao9Rc;Fb0mbkkdnaiaQ9pmbaici4hlinaxao9RcK6mwa8EaifhqdndndndndndnaAaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaoclffagRb:q:W:cjbfhoxikaqaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaocwffagRb:q:W:cjbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpkbbahaocdffagRb:q:W:cjbfhokalcdfhlaiczfgiaQ6mbkkaohAaoTmoka8EaQfh8Ea5cefg5cl9hmbkdndndndnawTmbaza8Acd4fRbbglciGPlbedwbkaQTmdavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep9Ta8Fpxeeeeeeeeeeeeeeeegap9op9Hp9rg8Fa8Jp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ugap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp9Ugap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp9Ugap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9AbbbaladfhlaoczfgoaQ6mbxikkaQTmeavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep:nea8Fpxebebebebebebebebgap9op:bep9rg8Fa8Jp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oegap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp:oegap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp:oegap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9AbbbaladfhlaoczfgoaQ6mbxdkkaQTmbcbhocbalcl4gl9Rc8FGhiavcjdfa8Afhrava8Afpbdbhainaravcj;cbfaofpblbg8JaYaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaLaofpblbg8MaKaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Faap9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8LaypmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9AbbbaradfhraoczfgoaQ6mbkka8Aclfg8Aad6mbkdnaCad2goTmbaOavcjdfao;8qbbkdnammbavavcjdfaCcufad2fad;8qbbkaCaHfhHc9:hoaAhPaAmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkNsezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var r=WebAssembly.validate(t)?a(e):a(n),s,o=WebAssembly.instantiate(r,{}).then(function(A){s=A.instance,s.exports.__wasm_call_ctors()});function a(A){for(var y=new Uint8Array(A.length),v=0;v<A.length;++v){var x=A.charCodeAt(v);y[v]=x>96?x-97:x>64?x-39:x+4}for(var w=0,v=0;v<A.length;++v)y[w++]=y[v]<60?i[y[v]]:(y[v]-60)*64+y[++v];return y.buffer.slice(0,w)}function c(A,y,v,x,w,_,E){var S=A.exports.sbrk,M=x+3&-4,I=S(M*w),R=S(_.length),N=new Uint8Array(A.exports.memory.buffer);N.set(_,R);var P=y(I,x,w,R,_.length);if(P==0&&E&&E(I,M,w),v.set(N.subarray(I,I+x*w)),S(I-S(0)),P!=0)throw new Error("Malformed buffer data: "+P)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},u={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},d=[],h=0;function f(A){var y={object:new Worker(A),pending:0,requests:{}};return y.object.onmessage=function(v){var x=v.data;y.pending-=x.count,y.requests[x.id][x.action](x.value),delete y.requests[x.id]},y}function p(A){for(var y="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(r)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+b.name+";"+c.toString()+b.toString(),v=new Blob([y],{type:"text/javascript"}),x=URL.createObjectURL(v),w=d.length;w<A;++w)d[w]=f(x);for(var w=A;w<d.length;++w)d[w].object.postMessage({});d.length=A,URL.revokeObjectURL(x)}function g(A,y,v,x,w){for(var _=d[0],E=1;E<d.length;++E)d[E].pending<_.pending&&(_=d[E]);return new Promise(function(S,M){var I=new Uint8Array(v),R=++h;_.pending+=A,_.requests[R]={resolve:S,reject:M},_.object.postMessage({id:R,count:A,size:y,source:I,mode:x,filter:w},[I.buffer])})}function b(A){var y=A.data;self.ready.then(function(v){if(!y.id)return self.close();try{var x=new Uint8Array(y.count*y.size);c(v,v.exports[y.mode],x,y.count,y.size,y.source,v.exports[y.filter]),self.postMessage({id:y.id,count:y.count,action:"resolve",value:x},[x.buffer])}catch(w){self.postMessage({id:y.id,count:y.count,action:"reject",value:w})}})}return{ready:o,supported:!0,useWorkers:function(A){p(A)},decodeVertexBuffer:function(A,y,v,x,w){c(s,s.exports.meshopt_decodeVertexBuffer,A,y,v,x,s.exports[l[w]])},decodeIndexBuffer:function(A,y,v,x){c(s,s.exports.meshopt_decodeIndexBuffer,A,y,v,x)},decodeIndexSequence:function(A,y,v,x){c(s,s.exports.meshopt_decodeIndexSequence,A,y,v,x)},decodeGltfBuffer:function(A,y,v,x,w,_){c(s,s.exports[u[w]],A,y,v,x,s.exports[l[_]])},decodeGltfBufferAsync:function(A,y,v,x,w){return d.length>0?g(A,y,v,u[x],l[w]):o.then(function(){var _=new Uint8Array(A*y);return c(s,s.exports[u[x]],_,A,y,v,s.exports[l[w]]),_})}}})();ms();var XF=new WeakMap,Y1=class extends ri{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){let s=new hi(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{this.parse(o,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,rn,i).catch(i)}decodeDracoFile(e,t,i,r,s=Zn,o=()=>{}){let a={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:s};return this.decodeGeometry(e,a).then(t).catch(o)}decodeGeometry(e,t){let i=JSON.stringify(t);if(XF.has(e)){let c=XF.get(e);if(c.key===i)return c.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r,s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(c=>(r=c,new Promise((l,u)=>{r._callbacks[s]={resolve:l,reject:u},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),XF.set(e,{key:i,promise:a}),a}_createGeometry(e){let t=new Ke;e.index&&t.setIndex(new ut(e.index.array,1));for(let i=0;i<e.attributes.length;i++){let{name:r,array:s,itemSize:o,stride:a,vertexColorSpace:c}=e.attributes[i],l;if(o===a)l=new ut(s,o);else{let u=new zr(s,a);l=new rr(u,o,0)}r==="color"&&(this._assignVertexColorSpace(l,c),l.normalized=!(s instanceof Float32Array)),t.setAttribute(r,l)}return t}_assignVertexColorSpace(e,t){if(t!==rn)return;let i=new le;for(let r=0,s=e.count;r<s;r++)i.fromBufferAttribute(e,r),lt.colorSpaceToWorking(i,rn),e.setXYZ(r,i.r,i.g,i.b)}_loadLibrary(e,t){let i=new hi(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,s)=>{i.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{let r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);let s=Dde.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
4792
4792
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){let o=s.data;switch(o.type){case"decode":r._callbacks[o.id].resolve(o);break;case"error":r._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}};function Dde(){let n,e;onmessage=function(o){let a=o.data;switch(a.type){case"init":n=a.decoderConfig,e=new Promise(function(u){n.onModuleLoaded=function(d){u({draco:d})},DracoDecoderModule(n)});break;case"decode":let c=a.buffer,l=a.taskConfig;e.then(u=>{let d=u.draco,h=new d.Decoder;try{let f=t(d,h,new Int8Array(c),l),p=f.attributes.map(g=>g.array.buffer);f.index&&p.push(f.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:f},p)}catch(f){console.error(f),self.postMessage({type:"error",id:a.id,error:f.message})}finally{d.destroy(h)}});break}};function t(o,a,c,l){let u=l.attributeIDs,d=l.attributeTypes,h,f,p=a.GetEncodedGeometryType(c);if(p===o.TRIANGULAR_MESH)h=new o.Mesh,f=a.DecodeArrayToMesh(c,c.byteLength,h);else if(p===o.POINT_CLOUD)h=new o.PointCloud,f=a.DecodeArrayToPointCloud(c,c.byteLength,h);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||h.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());let g={index:null,attributes:[]};for(let b in u){let A=self[d[b]],y,v;if(l.useUniqueIDs)v=u[b],y=a.GetAttributeByUniqueId(h,v);else{if(v=a.GetAttributeId(h,o[u[b]]),v===-1)continue;y=a.GetAttribute(h,v)}let x=r(o,a,h,b,A,y);b==="color"&&(x.vertexColorSpace=l.vertexColorSpace),g.attributes.push(x)}return p===o.TRIANGULAR_MESH&&(g.index=i(o,a,h)),o.destroy(h),g}function i(o,a,c){let u=c.num_faces()*3,d=u*4,h=o._malloc(d);a.GetTrianglesUInt32Array(c,d,h);let f=new Uint32Array(o.HEAPF32.buffer,h,u).slice();return o._free(h),{array:f,itemSize:1}}function r(o,a,c,l,u,d){let h=c.num_points(),f=d.num_components(),p=s(o,u),g=f*u.BYTES_PER_ELEMENT,b=Math.ceil(g/4)*4,A=b/u.BYTES_PER_ELEMENT,y=h*g,v=h*b,x=o._malloc(y);a.GetAttributeDataArrayForAllPoints(c,d,p,y,x);let w=new u(o.HEAPF32.buffer,x,y/u.BYTES_PER_ELEMENT),_;if(g===b)_=w.slice();else{_=new u(v/u.BYTES_PER_ELEMENT);let E=0;for(let S=0,M=w.length;S<M;S++){for(let I=0;I<f;I++)_[E+I]=w[S*f+I];E+=A}}return o._free(x),{name:l,count:h,itemSize:f,array:_,stride:A}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}ms();ms();function ZF(n,e=!1){let t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),r=new Set(Object.keys(n[0].morphAttributes)),s={},o={},a=n[0].morphTargetsRelative,c=new Ke,l=0;for(let u=0;u<n.length;++u){let d=n[u],h=0;if(t!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let f in d.attributes){if(!i.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;s[f]===void 0&&(s[f]=[]),s[f].push(d.attributes[f]),h++}if(h!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let f in d.morphAttributes){if(!r.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[f]===void 0&&(o[f]=[]),o[f].push(d.morphAttributes[f])}if(e){let f;if(t)f=d.index.count;else if(d.attributes.position!==void 0)f=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,f,u),l+=f}}if(t){let u=0,d=[];for(let h=0;h<n.length;++h){let f=n[h].index;for(let p=0;p<f.count;++p)d.push(f.getX(p)+u);u+=n[h].attributes.position.count}c.setIndex(d)}for(let u in s){let d=zH(s[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;c.setAttribute(u,d)}for(let u in o){let d=o[u][0].length;if(d!==0){c.morphAttributes=c.morphAttributes||{},c.morphAttributes[u]=[];for(let h=0;h<d;++h){let f=[];for(let g=0;g<o[u].length;++g)f.push(o[u][g][h]);let p=zH(f);if(!p)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;c.morphAttributes[u].push(p)}}}return c}function zH(n){let e,t,i,r=-1,s=0;for(let l=0;l<n.length;++l){let u=n[l];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=u.normalized),i!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new ut(o,t,i),c=0;for(let l=0;l<n.length;++l){let u=n[l];if(u.isInterleavedBufferAttribute){let d=c/t;for(let h=0,f=u.count;h<f;h++)for(let p=0;p<t;p++){let g=u.getComponent(h,p);a.setComponent(h+d,p,g)}}else o.set(u.array,c);c+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function JF(n,e){if(e===Ly)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===Ad||e===wf){let t=n.getIndex();if(t===null){let o=[],a=n.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)o.push(c);n.setIndex(o),t=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}let i=t.count-2,r=[];if(e===Ad)for(let o=1;o<=i;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<i;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=n.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}var eE=class extends ri{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new sP(t)}),this.register(function(t){return new oP(t)}),this.register(function(t){return new mP(t)}),this.register(function(t){return new gP(t)}),this.register(function(t){return new AP(t)}),this.register(function(t){return new cP(t)}),this.register(function(t){return new lP(t)}),this.register(function(t){return new uP(t)}),this.register(function(t){return new dP(t)}),this.register(function(t){return new rP(t)}),this.register(function(t){return new hP(t)}),this.register(function(t){return new aP(t)}),this.register(function(t){return new pP(t)}),this.register(function(t){return new fP(t)}),this.register(function(t){return new nP(t)}),this.register(function(t){return new tE(t,on.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new tE(t,on.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new bP(t)})}load(e,t,i,r){let s=this,o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){let l=io.extractUrlBase(e);o=io.resolveURL(l,this.path)}else o=io.extractUrlBase(e);this.manager.itemStart(e);let a=function(l){r?r(l):console.error(l),s.manager.itemError(e),s.manager.itemEnd(e)},c=new hi(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{s.parse(l,o,function(u){t(u),s.manager.itemEnd(e)},a)}catch(u){a(u)}},i,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let s,o={},a={},c=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===QH){try{o[on.KHR_BINARY_GLTF]=new yP(e)}catch(d){r&&r(d);return}s=JSON.parse(o[on.KHR_BINARY_GLTF].content)}else s=JSON.parse(c.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new TP(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){let d=this.pluginCallbacks[u](l);d.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[d.name]=d,o[d.name]=!0}if(s.extensionsUsed)for(let u=0;u<s.extensionsUsed.length;++u){let d=s.extensionsUsed[u],h=s.extensionsRequired||[];switch(d){case on.KHR_MATERIALS_UNLIT:o[d]=new iP;break;case on.KHR_DRACO_MESH_COMPRESSION:o[d]=new vP(s,this.dracoLoader);break;case on.KHR_TEXTURE_TRANSFORM:o[d]=new xP;break;case on.KHR_MESH_QUANTIZATION:o[d]=new _P;break;default:h.indexOf(d)>=0&&a[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(i,r)}parseAsync(e,t){let i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}};function Fde(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}function Ui(n,e,t){let i=n.json.materials[e];return i.extensions&&i.extensions[t]?i.extensions[t]:null}var on={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},nP=class{constructor(e){this.parser=e,this.name=on.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){let s=t[i];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){let t=this.parser,i="light:"+e,r=t.cache.get(i);if(r)return r;let s=t.json,c=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l,u=new le(16777215);c.color!==void 0&&u.setRGB(c.color[0],c.color[1],c.color[2],Zn);let d=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new Si(u),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new us(u),l.distance=d;break;case"spot":l=new Ir(u),l.distance=d,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),Rc(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),r=Promise.resolve(l),t.cache.add(i,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){let t=this,i=this.parser,s=i.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(c){return i._getNodeRef(t.cache,a,c)})}},iP=class{constructor(){this.name=on.KHR_MATERIALS_UNLIT}getMaterialType(){return Sn}extendParams(e,t,i){let r=[];e.color=new le(1,1,1),e.opacity=1;let s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){let o=s.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],Zn),e.opacity=o[3]}s.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",s.baseColorTexture,rn))}return Promise.all(r)}},rP=class{constructor(e){this.parser=e,this.name=on.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);return i===null||i.emissiveStrength!==void 0&&(t.emissiveIntensity=i.emissiveStrength),Promise.resolve()}},sP=class{constructor(e){this.parser=e,this.name=on.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return Ui(this.parser,e,this.name)!==null?mr:null}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);if(i===null)return Promise.resolve();let r=[];if(i.clearcoatFactor!==void 0&&(t.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&r.push(this.parser.assignTexture(t,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(r.push(this.parser.assignTexture(t,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){let s=i.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new ce(s,s)}return Promise.all(r)}},oP=class{constructor(e){this.parser=e,this.name=on.KHR_MATERIALS_DISPERSION}getMaterialType(e){return Ui(this.parser,e,this.name)!==null?mr:null}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);return i===null||(t.dispersion=i.dispersion!==void 0?i.dispersion:0),Promise.resolve()}},aP=class{constructor(e){this.parser=e,this.name=on.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return Ui(this.parser,e,this.name)!==null?mr:null}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);if(i===null)return Promise.resolve();let r=[];return i.iridescenceFactor!==void 0&&(t.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&r.push(this.parser.assignTexture(t,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(t.iridescenceIOR=i.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(r)}},cP=class{constructor(e){this.parser=e,this.name=on.KHR_MATERIALS_SHEEN}getMaterialType(e){return Ui(this.parser,e,this.name)!==null?mr:null}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);if(i===null)return Promise.resolve();let r=[];if(t.sheenColor=new le(0,0,0),t.sheenRoughness=0,t.sheen=1,i.sheenColorFactor!==void 0){let s=i.sheenColorFactor;t.sheenColor.setRGB(s[0],s[1],s[2],Zn)}return i.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&r.push(this.parser.assignTexture(t,"sheenColorMap",i.sheenColorTexture,rn)),i.sheenRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(r)}},lP=class{constructor(e){this.parser=e,this.name=on.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return Ui(this.parser,e,this.name)!==null?mr:null}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);if(i===null)return Promise.resolve();let r=[];return i.transmissionFactor!==void 0&&(t.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&r.push(this.parser.assignTexture(t,"transmissionMap",i.transmissionTexture)),Promise.all(r)}},uP=class{constructor(e){this.parser=e,this.name=on.KHR_MATERIALS_VOLUME}getMaterialType(e){return Ui(this.parser,e,this.name)!==null?mr:null}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);if(i===null)return Promise.resolve();let r=[];t.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,"thicknessMap",i.thicknessTexture)),t.attenuationDistance=i.attenuationDistance||1/0;let s=i.attenuationColor||[1,1,1];return t.attenuationColor=new le().setRGB(s[0],s[1],s[2],Zn),Promise.all(r)}},dP=class{constructor(e){this.parser=e,this.name=on.KHR_MATERIALS_IOR}getMaterialType(e){return Ui(this.parser,e,this.name)!==null?mr:null}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);return i===null||(t.ior=i.ior!==void 0?i.ior:1.5,t.ior===0&&(t.ior=1e3)),Promise.resolve()}},hP=class{constructor(e){this.parser=e,this.name=on.KHR_MATERIALS_SPECULAR}getMaterialType(e){return Ui(this.parser,e,this.name)!==null?mr:null}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);if(i===null)return Promise.resolve();let r=[];t.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&r.push(this.parser.assignTexture(t,"specularIntensityMap",i.specularTexture));let s=i.specularColorFactor||[1,1,1];return t.specularColor=new le().setRGB(s[0],s[1],s[2],Zn),i.specularColorTexture!==void 0&&r.push(this.parser.assignTexture(t,"specularColorMap",i.specularColorTexture,rn)),Promise.all(r)}},fP=class{constructor(e){this.parser=e,this.name=on.EXT_MATERIALS_BUMP}getMaterialType(e){return Ui(this.parser,e,this.name)!==null?mr:null}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);if(i===null)return Promise.resolve();let r=[];return t.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&r.push(this.parser.assignTexture(t,"bumpMap",i.bumpTexture)),Promise.all(r)}},pP=class{constructor(e){this.parser=e,this.name=on.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return Ui(this.parser,e,this.name)!==null?mr:null}extendMaterialParams(e,t){let i=Ui(this.parser,e,this.name);if(i===null)return Promise.resolve();let r=[];return i.anisotropyStrength!==void 0&&(t.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(t.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&r.push(this.parser.assignTexture(t,"anisotropyMap",i.anisotropyTexture)),Promise.all(r)}},mP=class{constructor(e){this.parser=e,this.name=on.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let s=r.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}},gP=class{constructor(e){this.parser=e,this.name=on.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;let o=s.extensions[t],a=r.images[o.source],c=i.textureLoader;if(a.uri){let l=i.options.manager.getHandler(a.uri);l!==null&&(c=l)}return i.loadTextureImage(e,o.source,c)}},AP=class{constructor(e){this.parser=e,this.name=on.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;let o=s.extensions[t],a=r.images[o.source],c=i.textureLoader;if(a.uri){let l=i.options.manager.getHandler(a.uri);l!==null&&(c=l)}return i.loadTextureImage(e,o.source,c)}},tE=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){let r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){let c=r.byteOffset||0,l=r.byteLength||0,u=r.count,d=r.byteStride,h=new Uint8Array(a,c,l);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,d,h,r.mode,r.filter).then(function(f){return f.buffer}):o.ready.then(function(){let f=new ArrayBuffer(u*d);return o.decodeGltfBuffer(new Uint8Array(f),u,d,h,r.mode,r.filter),f})})}else return null}},bP=class{constructor(e){this.name=on.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;let r=t.meshes[i.mesh];for(let l of r.primitives)if(l.mode!==Zo.TRIANGLES&&l.mode!==Zo.TRIANGLE_STRIP&&l.mode!==Zo.TRIANGLE_FAN&&l.mode!==void 0)return null;let o=i.extensions[this.name].attributes,a=[],c={};for(let l in o)a.push(this.parser.getDependency("accessor",o[l]).then(u=>(c[l]=u,c[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(l=>{let u=l.pop(),d=u.isGroup?u.children:[u],h=l[0].count,f=[];for(let p of d){let g=new Oe,b=new C,A=new In,y=new C(1,1,1),v=new fr(p.geometry,p.material,h);for(let x=0;x<h;x++)c.TRANSLATION&&b.fromBufferAttribute(c.TRANSLATION,x),c.ROTATION&&A.fromBufferAttribute(c.ROTATION,x),c.SCALE&&y.fromBufferAttribute(c.SCALE,x),v.setMatrixAt(x,g.compose(b,A,y));for(let x in c)if(x==="_COLOR_0"){let w=c[x];v.instanceColor=new sr(w.array,w.itemSize,w.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&p.geometry.setAttribute(x,c[x]);Ut.prototype.copy.call(v,p),this.parser.assignFinalMaterial(v),f.push(v)}return u.isGroup?(u.clear(),u.add(...f),u):f[0]}))}},QH="glTF",nv=12,GH={JSON:1313821514,BIN:5130562},yP=class{constructor(e){this.name=on.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,nv),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==QH)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let r=this.header.length-nv,s=new DataView(e,nv),o=0;for(;o<r;){let a=s.getUint32(o,!0);o+=4;let c=s.getUint32(o,!0);if(o+=4,c===GH.JSON){let l=new Uint8Array(e,nv+o,a);this.content=i.decode(l)}else if(c===GH.BIN){let l=nv+o;this.body=e.slice(l,l+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},vP=class{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=on.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let i=this.json,r=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},c={},l={};for(let u in o){let d=SP[u]||u.toLowerCase();a[d]=o[u]}for(let u in e.attributes){let d=SP[u]||u.toLowerCase();if(o[u]!==void 0){let h=i.accessors[e.attributes[u]],f=Kg[h.componentType];l[d]=f.name,c[d]=h.normalized===!0}}return t.getDependency("bufferView",s).then(function(u){return new Promise(function(d,h){r.decodeDracoFile(u,function(f){for(let p in f.attributes){let g=f.attributes[p],b=c[p];b!==void 0&&(g.normalized=b)}d(f)},a,l,Zn,h)})})}},xP=class{constructor(){this.name=on.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}},_P=class{constructor(){this.name=on.KHR_MESH_QUANTIZATION}},nE=class extends Oo{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r*3+r;for(let o=0;o!==r;o++)t[o]=i[s+o];return t}interpolate_(e,t,i,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=a*2,l=a*3,u=r-t,d=(i-t)/u,h=d*d,f=h*d,p=e*l,g=p-l,b=-2*f+3*h,A=f-h,y=1-b,v=A-h+d;for(let x=0;x!==a;x++){let w=o[g+x+a],_=o[g+x+c]*u,E=o[p+x+a],S=o[p+x]*u;s[x]=y*w+v*_+b*E+A*S}return s}},Pde=new In,wP=class extends nE{interpolate_(e,t,i,r){let s=super.interpolate_(e,t,i,r);return Pde.fromArray(s).normalize().toArray(s),s}},Zo={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Kg={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},VH={9728:Ot,9729:ot,9984:Ta,9985:jo,9986:hs,9987:mn},HH={33071:li,33648:eo,10497:jn},YF={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},SP={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Sd={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ode={CUBICSPLINE:void 0,LINEAR:wl,STEP:_l},eP={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Lde(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new ii({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:bi})),n.DefaultMaterial}function Cf(n,e,t){for(let i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function Rc(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Ude(n,e,t){let i=!1,r=!1,s=!1;for(let l=0,u=e.length;l<u;l++){let d=e[l];if(d.POSITION!==void 0&&(i=!0),d.NORMAL!==void 0&&(r=!0),d.COLOR_0!==void 0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(n);let o=[],a=[],c=[];for(let l=0,u=e.length;l<u;l++){let d=e[l];if(i){let h=d.POSITION!==void 0?t.getDependency("accessor",d.POSITION):n.attributes.position;o.push(h)}if(r){let h=d.NORMAL!==void 0?t.getDependency("accessor",d.NORMAL):n.attributes.normal;a.push(h)}if(s){let h=d.COLOR_0!==void 0?t.getDependency("accessor",d.COLOR_0):n.attributes.color;c.push(h)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(l){let u=l[0],d=l[1],h=l[2];return i&&(n.morphAttributes.position=u),r&&(n.morphAttributes.normal=d),s&&(n.morphAttributes.color=h),n.morphTargetsRelative=!0,n})}function $de(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){let t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function zde(n){let e,t=n.extensions&&n.extensions[on.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+tP(t.attributes):e=n.indices+":"+tP(n.attributes)+":"+n.mode,n.targets!==void 0)for(let i=0,r=n.targets.length;i<r;i++)e+=":"+tP(n.targets[i]);return e}function tP(n){let e="",t=Object.keys(n).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+n[t[i]]+";";return e}function EP(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Gde(n){return n.search(/\.jpe?g($|\?)/i)>0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":n.search(/\.ktx2($|\?)/i)>0||n.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}var Vde=new Oe,TP=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Fde,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=-1,s=!1,o=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let a=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(a)===!0;let c=a.match(/Version\/(\d+)/);r=i&&c?parseInt(c[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||s&&o<98?this.textureLoader=new cf(this.options.manager):this.textureLoader=new df(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new hi(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){let a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return Cf(s,a,r),Rc(a,r),Promise.all(i._invokeAll(function(c){return c.afterRoot&&c.afterRoot(a)})).then(function(){for(let c of a.scenes)c.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){let o=t[r].joints;for(let a=0,c=o.length;a<c;a++)e[o[a]].isBone=!0}for(let r=0,s=e.length;r<s;r++){let o=e[r];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(i[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;let r=i.clone(),s=(o,a)=>{let c=this.associations.get(o);c!=null&&this.associations.set(a,c);for(let[l,u]of o.children.entries())s(u,a.children[l])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){let r=e(t[i]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let i=[];for(let r=0;r<t.length;r++){let s=e(t[r]);s&&i.push(s)}return i}getDependency(e,t){let i=e+":"+t,r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(s,o){return i.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[on.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(s,o){i.load(io.resolveURL(t.uri,r.path),s,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){let r=t.byteLength||0,s=t.byteOffset||0;return i.slice(s,s+r)})}loadAccessor(e){let t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){let o=YF[r.type],a=Kg[r.componentType],c=r.normalized===!0,l=new a(r.count*o);return Promise.resolve(new ut(l,o,c))}let s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(o){let a=o[0],c=YF[r.type],l=Kg[r.componentType],u=l.BYTES_PER_ELEMENT,d=u*c,h=r.byteOffset||0,f=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,p=r.normalized===!0,g,b;if(f&&f!==d){let A=Math.floor(h/f),y="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+A+":"+r.count,v=t.cache.get(y);v||(g=new l(a,A*f,r.count*f/u),v=new zr(g,f/u),t.cache.add(y,v)),b=new rr(v,c,h%f/u,p)}else a===null?g=new l(r.count*c):g=new l(a,h,r.count*c),b=new ut(g,c,p);if(r.sparse!==void 0){let A=YF.SCALAR,y=Kg[r.sparse.indices.componentType],v=r.sparse.indices.byteOffset||0,x=r.sparse.values.byteOffset||0,w=new y(o[1],v,r.sparse.count*A),_=new l(o[2],x,r.sparse.count*c);a!==null&&(b=new ut(b.array.slice(),b.itemSize,b.normalized)),b.normalized=!1;for(let E=0,S=w.length;E<S;E++){let M=w[E];if(b.setX(M,_[E*c]),c>=2&&b.setY(M,_[E*c+1]),c>=3&&b.setZ(M,_[E*c+2]),c>=4&&b.setW(M,_[E*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}b.normalized=p}return b})}loadTexture(e){let t=this.json,i=this.options,s=t.textures[e].source,o=t.images[s],a=this.textureLoader;if(o.uri){let c=i.manager.getHandler(o.uri);c!==null&&(a=c)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,i){let r=this,s=this.json,o=s.textures[e],a=s.images[t],c=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[c])return this.textureCache[c];let l=this.loadImageSource(t,i).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);let h=(s.samplers||{})[o.sampler]||{};return u.magFilter=VH[h.magFilter]||ot,u.minFilter=VH[h.minFilter]||mn,u.wrapS=HH[h.wrapS]||jn,u.wrapT=HH[h.wrapT]||jn,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==Ot&&u.minFilter!==ot,r.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){let i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(d=>d.clone());let o=r.images[e],a=self.URL||self.webkitURL,c=o.uri||"",l=!1;if(o.bufferView!==void 0)c=i.getDependency("bufferView",o.bufferView).then(function(d){l=!0;let h=new Blob([d],{type:o.mimeType});return c=a.createObjectURL(h),c});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let u=Promise.resolve(c).then(function(d){return new Promise(function(h,f){let p=h;t.isImageBitmapLoader===!0&&(p=function(g){let b=new Gt(g);b.needsUpdate=!0,h(b)}),t.load(io.resolveURL(d,s.path),p,void 0,f)})}).then(function(d){return l===!0&&a.revokeObjectURL(c),Rc(d,o),d.userData.mimeType=o.mimeType||Gde(o.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),d});return this.sourceCache[e]=u,u}assignTexture(e,t,i,r){let s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[on.KHR_TEXTURE_TRANSFORM]){let a=i.extensions!==void 0?i.extensions[on.KHR_TEXTURE_TRANSFORM]:void 0;if(a){let c=s.associations.get(o);o=s.extensions[on.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,c)}}return r!==void 0&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){let t=e.geometry,i=e.material,r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){let a="PointsMaterial:"+i.uuid,c=this.cache.get(a);c||(c=new bc,bn.prototype.copy.call(c,i),c.color.copy(i.color),c.map=i.map,c.sizeAttenuation=!1,this.cache.add(a,c)),i=c}else if(e.isLine){let a="LineBasicMaterial:"+i.uuid,c=this.cache.get(a);c||(c=new ui,bn.prototype.copy.call(c,i),c.color.copy(i.color),c.map=i.map,this.cache.add(a,c)),i=c}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let c=this.cache.get(a);c||(c=i.clone(),s&&(c.vertexColors=!0),o&&(c.flatShading=!0),r&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(a,c),this.associations.set(c,this.associations.get(i))),i=c}e.material=i}getMaterialType(){return ii}loadMaterial(e){let t=this,i=this.json,r=this.extensions,s=i.materials[e],o,a={},c=s.extensions||{},l=[];if(c[on.KHR_MATERIALS_UNLIT]){let d=r[on.KHR_MATERIALS_UNLIT];o=d.getMaterialType(),l.push(d.extendParams(a,s,t))}else{let d=s.pbrMetallicRoughness||{};if(a.color=new le(1,1,1),a.opacity=1,Array.isArray(d.baseColorFactor)){let h=d.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],Zn),a.opacity=h[3]}d.baseColorTexture!==void 0&&l.push(t.assignTexture(a,"map",d.baseColorTexture,rn)),a.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,a.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(a,"metalnessMap",d.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",d.metallicRoughnessTexture))),o=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=ln);let u=s.alphaMode||eP.OPAQUE;if(u===eP.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===eP.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Sn&&(l.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new ce(1,1),s.normalTexture.scale!==void 0)){let d=s.normalTexture.scale;a.normalScale.set(d,d)}if(s.occlusionTexture!==void 0&&o!==Sn&&(l.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Sn){let d=s.emissiveFactor;a.emissive=new le().setRGB(d[0],d[1],d[2],Zn)}return s.emissiveTexture!==void 0&&o!==Sn&&l.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,rn)),Promise.all(l).then(function(){let d=new o(a);return s.name&&(d.name=s.name),Rc(d,s),t.associations.set(d,{materials:e}),s.extensions&&Cf(r,d,s),d})}createUniqueName(e){let t=_n.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[on.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(c){return jH(c,a,t)})}let o=[];for(let a=0,c=e.length;a<c;a++){let l=e[a],u=zde(l),d=r[u];if(d)o.push(d.promise);else{let h;l.extensions&&l.extensions[on.KHR_DRACO_MESH_COMPRESSION]?h=s(l):h=jH(new Ke,l,t),r[u]={primitive:l,promise:h},o.push(h)}}return Promise.all(o)}loadMesh(e){let t=this,i=this.json,r=this.extensions,s=i.meshes[e],o=s.primitives,a=[];for(let c=0,l=o.length;c<l;c++){let u=o[c].material===void 0?Lde(this.cache):this.getDependency("material",o[c].material);a.push(u)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(c){let l=c.slice(0,c.length-1),u=c[c.length-1],d=[];for(let f=0,p=u.length;f<p;f++){let g=u[f],b=o[f],A,y=l[f];if(b.mode===Zo.TRIANGLES||b.mode===Zo.TRIANGLE_STRIP||b.mode===Zo.TRIANGLE_FAN||b.mode===void 0)A=s.isSkinnedMesh===!0?new Ac(g,y):new vt(g,y),A.isSkinnedMesh===!0&&A.normalizeSkinWeights(),b.mode===Zo.TRIANGLE_STRIP?A.geometry=JF(A.geometry,wf):b.mode===Zo.TRIANGLE_FAN&&(A.geometry=JF(A.geometry,Ad));else if(b.mode===Zo.LINES)A=new pr(g,y);else if(b.mode===Zo.LINE_STRIP)A=new Gr(g,y);else if(b.mode===Zo.LINE_LOOP)A=new ed(g,y);else if(b.mode===Zo.POINTS)A=new yc(g,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+b.mode);Object.keys(A.geometry.morphAttributes).length>0&&$de(A,s),A.name=t.createUniqueName(s.name||"mesh_"+e),Rc(A,s),b.extensions&&Cf(r,A,b),t.assignFinalMaterial(A),d.push(A)}for(let f=0,p=d.length;f<p;f++)t.associations.set(d[f],{meshes:e,primitives:f});if(d.length===1)return s.extensions&&Cf(r,d[0],s),d[0];let h=new Pn;s.extensions&&Cf(r,h,s),t.associations.set(h,{meshes:e});for(let f=0,p=d.length;f<p;f++)h.add(d[f]);return h})}loadCamera(e){let t,i=this.json.cameras[e],r=i[i.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new pn(Ga.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new or(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),Rc(t,i),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],i=[];for(let r=0,s=t.joints.length;r<s;r++)i.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(r){let s=r.pop(),o=r,a=[],c=[];for(let l=0,u=o.length;l<u;l++){let d=o[l];if(d){a.push(d);let h=new Oe;s!==null&&h.fromArray(s.array,l*16),c.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new Yu(a,c)})}loadAnimation(e){let t=this.json,i=this,r=t.animations[e],s=r.name?r.name:"animation_"+e,o=[],a=[],c=[],l=[],u=[];for(let d=0,h=r.channels.length;d<h;d++){let f=r.channels[d],p=r.samplers[f.sampler],g=f.target,b=g.node,A=r.parameters!==void 0?r.parameters[p.input]:p.input,y=r.parameters!==void 0?r.parameters[p.output]:p.output;g.node!==void 0&&(o.push(this.getDependency("node",b)),a.push(this.getDependency("accessor",A)),c.push(this.getDependency("accessor",y)),l.push(p),u.push(g))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(c),Promise.all(l),Promise.all(u)]).then(function(d){let h=d[0],f=d[1],p=d[2],g=d[3],b=d[4],A=[];for(let v=0,x=h.length;v<x;v++){let w=h[v],_=f[v],E=p[v],S=g[v],M=b[v];if(w===void 0)continue;w.updateMatrix&&w.updateMatrix();let I=i._createAnimationTracks(w,_,E,S,M);if(I)for(let R=0;R<I.length;R++)A.push(I[R])}let y=new _a(s,void 0,A);return Rc(y,r),y})}createNodeMesh(e){let t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(s){let o=i._getNodeRef(i.meshCache,r.mesh,s);return r.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let c=0,l=r.weights.length;c<l;c++)a.morphTargetInfluences[c]=r.weights[c]}),o})}loadNode(e){let t=this.json,i=this,r=t.nodes[e],s=i._loadNodeShallow(e),o=[],a=r.children||[];for(let l=0,u=a.length;l<u;l++)o.push(i.getDependency("node",a[l]));let c=r.skin===void 0?Promise.resolve(null):i.getDependency("skin",r.skin);return Promise.all([s,Promise.all(o),c]).then(function(l){let u=l[0],d=l[1],h=l[2];h!==null&&u.traverse(function(f){f.isSkinnedMesh&&f.bind(h,Vde)});for(let f=0,p=d.length;f<p;f++)u.add(d[f]);if(u.userData.pivot!==void 0&&d.length>0){let f=u.userData.pivot,p=d[0];u.pivot=new C().fromArray(f),u.position.x-=f[0],u.position.y-=f[1],u.position.z-=f[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(e){let t=this.json,i=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let s=t.nodes[e],o=s.name?r.createUniqueName(s.name):"",a=[],c=r._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&a.push(c),s.camera!==void 0&&a.push(r.getDependency("camera",s.camera).then(function(l){return r._getNodeRef(r.cameraCache,s.camera,l)})),r._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){a.push(l)}),this.nodeCache[e]=Promise.all(a).then(function(l){let u;if(s.isBone===!0?u=new Il:l.length>1?u=new Pn:l.length===1?u=l[0]:u=new Ut,u!==l[0])for(let d=0,h=l.length;d<h;d++)u.add(l[d]);if(s.name&&(u.userData.name=s.name,u.name=o),Rc(u,s),s.extensions&&Cf(i,u,s),s.matrix!==void 0){let d=new Oe;d.fromArray(s.matrix),u.applyMatrix4(d)}else s.translation!==void 0&&u.position.fromArray(s.translation),s.rotation!==void 0&&u.quaternion.fromArray(s.rotation),s.scale!==void 0&&u.scale.fromArray(s.scale);if(!r.associations.has(u))r.associations.set(u,{});else if(s.mesh!==void 0&&r.meshCache.refs[s.mesh]>1){let d=r.associations.get(u);r.associations.set(u,{...d})}return r.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){let t=this.extensions,i=this.json.scenes[e],r=this,s=new Pn;i.name&&(s.name=r.createUniqueName(i.name)),Rc(s,i),i.extensions&&Cf(t,s,i);let o=i.nodes||[],a=[];for(let c=0,l=o.length;c<l;c++)a.push(r.getDependency("node",o[c]));return Promise.all(a).then(function(c){for(let u=0,d=c.length;u<d;u++){let h=c[u];h.parent!==null?s.add(X1(h)):s.add(h)}let l=u=>{let d=new Map;for(let[h,f]of r.associations)(h instanceof bn||h instanceof Gt)&&d.set(h,f);return u.traverse(h=>{let f=r.associations.get(h);f!=null&&d.set(h,f)}),d};return r.associations=l(s),s})}_createAnimationTracks(e,t,i,r,s){let o=[],a=e.name?e.name:e.uuid,c=[];function l(f){f.morphTargetInfluences&&c.push(f.name?f.name:f.uuid)}Sd[s.path]===Sd.weights?(l(e),e.isGroup&&e.children.forEach(l)):c.push(a);let u;switch(Sd[s.path]){case Sd.weights:u=Lo;break;case Sd.rotation:u=Uo;break;case Sd.translation:case Sd.scale:u=$o;break;default:switch(i.itemSize){case 1:u=Lo;break;case 2:case 3:default:u=$o;break}break}let d=r.interpolation!==void 0?Ode[r.interpolation]:wl,h=this._getArrayFromAccessor(i);for(let f=0,p=c.length;f<p;f++){let g=new u(c[f]+"."+Sd[s.path],t.array,h,d);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),o.push(g)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let i=EP(t.constructor),r=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)r[s]=t[s]*i;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(i){let r=this instanceof Uo?wP:nE;return new r(this.times,this.values,this.getValueSize()/3,i)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function Hde(n,e,t){let i=e.attributes,r=new On;if(i.POSITION!==void 0){let a=t.json.accessors[i.POSITION],c=a.min,l=a.max;if(c!==void 0&&l!==void 0){if(r.set(new C(c[0],c[1],c[2]),new C(l[0],l[1],l[2])),a.normalized){let u=EP(Kg[a.componentType]);r.min.multiplyScalar(u),r.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let s=e.targets;if(s!==void 0){let a=new C,c=new C;for(let l=0,u=s.length;l<u;l++){let d=s[l];if(d.POSITION!==void 0){let h=t.json.accessors[d.POSITION],f=h.min,p=h.max;if(f!==void 0&&p!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(p[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(p[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(p[2]))),h.normalized){let g=EP(Kg[h.componentType]);c.multiplyScalar(g)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(a)}n.boundingBox=r;let o=new Hn;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,n.boundingSphere=o}function jH(n,e,t){let i=e.attributes,r=[];function s(o,a){return t.getDependency("accessor",o).then(function(c){n.setAttribute(a,c)})}for(let o in i){let a=SP[o]||o.toLowerCase();a in n.attributes||r.push(s(i[o],a))}if(e.indices!==void 0&&!n.index){let o=t.getDependency("accessor",e.indices).then(function(a){n.setIndex(a)});r.push(o)}return lt.workingColorSpace!==Zn&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${lt.workingColorSpace}" not supported.`),Rc(n,e),Hde(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?Ude(n,e.targets,t):n})}ms();var iE=class{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){let t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){let i=this.workersResolve[e];if(i&&i(t),this.queue.length){let{resolve:r,msg:s,transfer:o}=this.queue.shift();this.workersResolve[e]=r,this.workers[e].postMessage(s,o)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(i=>{let r=this._getIdleWorker();r!==-1?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=i,this.workers[r].postMessage(e,t)):this.queue.push({resolve:i,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}};var Rf=class{constructor(e,t,i,r){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,i),this._littleEndian=r,this._offset=0}_nextUint8(){let e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){let e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){let e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){let e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){let e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){let t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){let i=this._offset,r=0;for(;this._dataView.getUint8(this._offset)!==t&&r<e;)r++,this._offset++;return r<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+i,r)}},LFe=new Uint8Array([0]),gs=[171,75,84,88,32,50,48,187,13,10,26,10];function WH(n){return new TextDecoder().decode(n)}function qH(n){let e=new Uint8Array(n.buffer,n.byteOffset,gs.length);if(e[0]!==gs[0]||e[1]!==gs[1]||e[2]!==gs[2]||e[3]!==gs[3]||e[4]!==gs[4]||e[5]!==gs[5]||e[6]!==gs[6]||e[7]!==gs[7]||e[8]!==gs[8]||e[9]!==gs[9]||e[10]!==gs[10]||e[11]!==gs[11])throw new Error("Missing KTX 2.0 identifier.");let t={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},i=17*Uint32Array.BYTES_PER_ELEMENT,r=new Rf(n,gs.length,i,!0);t.vkFormat=r._nextUint32(),t.typeSize=r._nextUint32(),t.pixelWidth=r._nextUint32(),t.pixelHeight=r._nextUint32(),t.pixelDepth=r._nextUint32(),t.layerCount=r._nextUint32(),t.faceCount=r._nextUint32(),t.levelCount=r._nextUint32(),t.supercompressionScheme=r._nextUint32();let s=r._nextUint32(),o=r._nextUint32(),a=r._nextUint32(),c=r._nextUint32(),l=r._nextUint64(),u=r._nextUint64(),d=3*Math.max(t.levelCount,1)*8,h=new Rf(n,gs.length+i,d,!0);for(let ae=0,de=Math.max(t.levelCount,1);ae<de;ae++)t.levels.push({levelData:new Uint8Array(n.buffer,n.byteOffset+h._nextUint64(),h._nextUint64()),uncompressedByteLength:h._nextUint64()});let f=new Rf(n,s,o,!0);f._skip(4);let p=f._nextUint16(),g=f._nextUint16(),b=f._nextUint16(),A=f._nextUint16(),y={vendorId:p,descriptorType:g,versionNumber:b,colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},v=(A/4-6)/4;for(let ae=0;ae<v;ae++){let de={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};64&de.channelType?(de.sampleLower=f._nextInt32(),de.sampleUpper=f._nextInt32()):(de.sampleLower=f._nextUint32(),de.sampleUpper=f._nextUint32()),y.samples[ae]=de}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(y);let x=new Rf(n,a,c,!0);for(;x._offset<c;){let ae=x._nextUint32(),de=x._scan(ae),Be=WH(de);if(t.keyValue[Be]=x._nextUint8Array(ae-de.byteLength-1),Be.match(/^ktx/i)){let Ze=WH(t.keyValue[Be]);t.keyValue[Be]=Ze.substring(0,Ze.lastIndexOf("\0"))}x._skip(ae%4?4-ae%4:0)}if(u<=0)return t;let w=new Rf(n,l,u,!0),_=w._nextUint16(),E=w._nextUint16(),S=w._nextUint32(),M=w._nextUint32(),I=w._nextUint32(),R=w._nextUint32(),N=[];for(let ae=0,de=Math.max(t.levelCount,1);ae<de;ae++)N.push({imageFlags:w._nextUint32(),rgbSliceByteOffset:w._nextUint32(),rgbSliceByteLength:w._nextUint32(),alphaSliceByteOffset:w._nextUint32(),alphaSliceByteLength:w._nextUint32()});let P=l+w._offset,U=P+S,F=U+M,$=F+I,V=new Uint8Array(n.buffer,n.byteOffset+P,S),J=new Uint8Array(n.buffer,n.byteOffset+U,M),re=new Uint8Array(n.buffer,n.byteOffset+F,I),pe=new Uint8Array(n.buffer,n.byteOffset+$,R);return t.globalData={endpointCount:_,selectorCount:E,imageDescs:N,endpointsData:V,selectorsData:J,tablesData:re,extendedData:pe},t}var MP,Xl,CP,IP={env:{emscripten_notify_memory_growth:function(n){CP=new Uint8Array(Xl.exports.memory.buffer)}}},rE=class{init(){return MP||(MP=typeof fetch<"u"?fetch("data:application/wasm;base64,"+KH).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,IP)).then(this._init):WebAssembly.instantiate(Buffer.from(KH,"base64"),IP).then(this._init),MP)}_init(e){Xl=e.instance,IP.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Xl)throw new Error("ZSTDDecoder: Await .init() before decoding.");let i=e.byteLength,r=Xl.exports.malloc(i);CP.set(e,r),t=t||Number(Xl.exports.ZSTD_findDecompressedSize(r,i));let s=Xl.exports.malloc(t),o=Xl.exports.ZSTD_decompress(s,t,r,i),a=CP.slice(s,s+o);return Xl.exports.free(r),Xl.exports.free(s),a}},KH="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEE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";ms();var XH="display-p3",ZH="display-p3-linear";var GFe={...lt.spaces[rn],outputColorSpaceConfig:{drawingBufferColorSpace:rn,toneMappingMode:"extended"}};var RP=new WeakMap,BP=0,NP,Zl=class n extends ri{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new iE,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return console.warn('KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.'),await e.init(),this.detectSupport(e)}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-s3tc"),bptcSupported:e.hasFeature("texture-compression-bc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},typeof navigator<"u"&&typeof navigator.platform<"u"&&typeof navigator.userAgent<"u"&&navigator.platform.indexOf("Linux")>=0&&navigator.userAgent.indexOf("Firefox")>=0&&this.workerConfig.astcSupported&&this.workerConfig.etc2Supported&&this.workerConfig.bptcSupported&&this.workerConfig.dxtSupported&&(this.workerConfig.astcSupported=!1,this.workerConfig.etc2Supported=!1)),this}init(){if(!this.transcoderPending){let e=new hi(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);let t=e.loadAsync("basis_transcoder.js"),i=new hi(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);let r=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,r]).then(([s,o])=>{let a=n.BasisWorker.toString(),c=["/* constants */","let _EngineFormat = "+JSON.stringify(n.EngineFormat),"let _EngineType = "+JSON.stringify(n.EngineType),"let _TranscoderFormat = "+JSON.stringify(n.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(n.BasisFormat),"/* basis_transcoder.js */",s,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(`
|
|
4793
4793
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([c])),this.transcoderBinary=o,this.workerPool.setWorkerCreator(()=>{let l=new Worker(this.workerSourceURL),u=this.transcoderBinary.slice(0);return l.postMessage({type:"init",config:this.workerConfig,transcoderBinary:u},[u]),l})}),BP>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),BP++}return this.transcoderPending}load(e,t,i,r){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");let s=new hi(this.manager);s.setPath(this.path),s.setCrossOrigin(this.crossOrigin),s.setWithCredentials(this.withCredentials),s.setRequestHeader(this.requestHeader),s.setResponseType("arraybuffer"),s.load(e,o=>{this.parse(o,t,r)},i,r)}parse(e,t,i){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(RP.has(e))return RP.get(e).promise.then(t).catch(i);this._createTexture(e).then(r=>t?t(r):null).catch(i)}_createTextureFrom(e,t){let{type:i,error:r,data:{faces:s,width:o,height:a,format:c,type:l,dfdFlags:u}}=e;if(i==="error")return Promise.reject(r);let d;if(t.faceCount===6)d=new Uh(s,c,l);else{let h=s[0].mipmaps;d=t.layerCount>1?new Lh(h,o,a,t.layerCount,c,l):new ya(h,o,a,c,l)}return d.minFilter=s[0].mipmaps.length===1?ot:mn,d.magFilter=ot,d.generateMipmaps=!1,d.needsUpdate=!0,d.colorSpace=G9(t),d.premultiplyAlpha=!!(u&1),d}async _createTexture(e,t={}){let i=qH(new Uint8Array(e)),r=i.vkFormat===1000066e3&&i.dataFormatDescriptor[0].colorModel===167;if(!(i.vkFormat===0||r&&!this.workerConfig.astcHDRSupported))return Jde(i);let o=t,a=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:o},[e])).then(c=>this._createTextureFrom(c.data,i));return RP.set(e,{promise:a}),a}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),BP--}};Zl.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2};Zl.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25};Zl.EngineFormat={RGBAFormat:Jt,RGBA_ASTC_4x4_Format:$s,RGB_BPTC_UNSIGNED_Format:gd,RGBA_BPTC_Format:ao,RGBA_ETC2_EAC_Format:qo,RGBA_PVRTC_4BPPV1_Format:Qo,RGBA_S3TC_DXT5_Format:ps,RGB_ETC1_Format:Da,RGB_ETC2_Format:Wo,RGB_PVRTC_4BPPV1_Format:Sc,RGBA_S3TC_DXT1_Format:fs};Zl.EngineType={UnsignedByteType:ht,HalfFloatType:Yt,FloatType:Zt};Zl.BasisWorker=function(){let n,e,t,i=_EngineFormat,r=_EngineType,s=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",function(p){let g=p.data;switch(g.type){case"init":n=g.config,a(g.transcoderBinary);break;case"transcode":e.then(()=>{try{let{faces:b,buffers:A,width:y,height:v,hasAlpha:x,format:w,type:_,dfdFlags:E}=c(g.buffer);self.postMessage({type:"transcode",id:g.id,data:{faces:b,width:y,height:v,hasAlpha:x,format:w,type:_,dfdFlags:E}},A)}catch(b){console.error(b),self.postMessage({type:"error",id:g.id,error:b.message})}});break}});function a(p){e=new Promise(g=>{t={wasmBinary:p,onRuntimeInitialized:g},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function c(p){let g=new t.KTX2File(new Uint8Array(p));function b(){g.close(),g.delete()}if(!g.isValid())throw b(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let A;if(g.isUASTC())A=o.UASTC;else if(g.isETC1S())A=o.ETC1S;else if(g.isHDR())A=o.UASTC_HDR;else throw new Error("THREE.KTX2Loader: Unknown Basis encoding");let y=g.getWidth(),v=g.getHeight(),x=g.getLayers()||1,w=g.getLevels(),_=g.getFaces(),E=g.getHasAlpha(),S=g.getDFDFlags(),{transcoderFormat:M,engineFormat:I,engineType:R}=d(A,y,v,E);if(!y||!v||!w)throw b(),new Error("THREE.KTX2Loader: Invalid texture");if(!g.startTranscoding())throw b(),new Error("THREE.KTX2Loader: .startTranscoding failed");let N=[],P=[];for(let U=0;U<_;U++){let F=[];for(let $=0;$<w;$++){let V=[],J,re;for(let ae=0;ae<x;ae++){let de=g.getImageLevelInfo($,ae,U);U===0&&$===0&&ae===0&&(de.origWidth%4!==0||de.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),w>1?(J=de.origWidth,re=de.origHeight):(J=de.width,re=de.height);let Be=new Uint8Array(g.getImageTranscodedSizeInBytes($,ae,0,M)),Ze=g.transcodeImage(Be,$,ae,U,M,0,-1,-1);if(R===r.HalfFloatType&&(Be=new Uint16Array(Be.buffer,Be.byteOffset,Be.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!Ze)throw b(),new Error("THREE.KTX2Loader: .transcodeImage failed.");V.push(Be)}let pe=f(V);F.push({data:pe,width:J,height:re}),P.push(pe.buffer)}N.push({mipmaps:F,width:y,height:v,format:I,type:R})}return b(),{faces:N,buffers:P,width:y,height:v,hasAlpha:E,dfdFlags:S,format:I,type:R}}let l=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],engineType:[r.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],engineType:[r.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],engineType:[r.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],engineType:[r.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1],engineFormat:[i.RGB_ETC1_Format],engineType:[r.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],engineType:[r.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[i.RGB_BPTC_UNSIGNED_Format],engineType:[r.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[i.RGBAFormat,i.RGBAFormat],engineType:[r.UnsignedByteType,r.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[i.RGBAFormat],engineType:[r.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],u={[o.ETC1S]:l.filter(p=>p.basisFormat.includes(o.ETC1S)).sort((p,g)=>p.priorityETC1S-g.priorityETC1S),[o.UASTC]:l.filter(p=>p.basisFormat.includes(o.UASTC)).sort((p,g)=>p.priorityUASTC-g.priorityUASTC),[o.UASTC_HDR]:l.filter(p=>p.basisFormat.includes(o.UASTC_HDR)).sort((p,g)=>p.priorityHDR-g.priorityHDR)};function d(p,g,b,A){let y=u[p];for(let v=0;v<y.length;v++){let x=y[v];if(x.if&&!n[x.if]||!x.basisFormat.includes(p)||A&&x.transcoderFormat.length<2||x.needsPowerOfTwo&&!(h(g)&&h(b)))continue;let w=x.transcoderFormat[A?1:0],_=x.engineFormat[A?1:0],E=x.engineType[0];return{transcoderFormat:w,engineFormat:_,engineType:E}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}function h(p){return p<=2?!0:(p&p-1)===0&&p!==0}function f(p){if(p.length===1)return p[0];let g=0;for(let y=0;y<p.length;y++){let v=p[y];g+=v.byteLength}let b=new Uint8Array(g),A=0;for(let y=0;y<p.length;y++){let v=p[y];b.set(v,A),A+=v.byteLength}return b}};var Zde=new Set([Jt,ro,ti,qi]),kP={109:Jt,103:ti,100:qi,97:Jt,83:ti,76:qi,91:Jt,43:Jt,37:Jt,22:ti,16:ti,15:qi,9:qi,123:ro,122:ro,152:qo,148:Wo,153:Fa,154:Pa,155:so,156:Oa,1000066e3:$s,158:$s,157:$s,1000066004:oo,166:oo,165:oo,134:fs,133:fs,132:Us,131:Us,138:ps,137:ps,140:Ua,139:La,142:$a,141:co,146:ao,145:ao,1000054005:Qo,1000054001:Qo,1000054004:ka,1000054e3:ka},Bf={109:Zt,103:Zt,100:Zt,97:Yt,83:Yt,76:Yt,91:Ar,43:ht,37:ht,22:ht,16:ht,15:ht,9:ht,123:Ca,122:Ra,152:ht,148:ht,153:ht,154:ht,155:ht,156:ht,1000066e3:Yt,158:ht,157:ht,1000066004:Yt,166:ht,165:ht,134:ht,133:ht,132:ht,131:ht,138:ht,137:ht,140:ht,139:ht,142:ht,141:ht,146:ht,145:ht,1000054005:ht,1000054001:ht,1000054004:ht,1000054e3:ht};async function Jde(n){let{vkFormat:e}=n;if(kP[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat: "+e);Bf[e]===void 0&&console.warn('THREE.KTX2Loader: Missing ".type" for vkFormat: '+e);let t;n.supercompressionScheme===2&&(NP||(NP=new Promise(async o=>{let a=new rE;await a.init(),o(a)})),t=await NP);let i=[];for(let o=0;o<n.levels.length;o++){let a=Math.max(1,n.pixelWidth>>o),c=Math.max(1,n.pixelHeight>>o),l=n.pixelDepth?Math.max(1,n.pixelDepth>>o):0,u=n.levels[o],d;if(n.supercompressionScheme===0)d=u.levelData;else if(n.supercompressionScheme===2)d=t.decode(u.levelData,u.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let h;Bf[e]===Zt?h=new Float32Array(d.buffer,d.byteOffset,d.byteLength/Float32Array.BYTES_PER_ELEMENT):Bf[e]===Yt||Bf[e]===Ar?h=new Uint16Array(d.buffer,d.byteOffset,d.byteLength/Uint16Array.BYTES_PER_ELEMENT):Bf[e]===Ca||Bf[e]===Ra?h=new Uint32Array(d.buffer,d.byteOffset,d.byteLength/Uint32Array.BYTES_PER_ELEMENT):h=d,i.push({data:h,width:a,height:c,depth:l})}let r=n.levelCount===0||i.length>1,s;if(Zde.has(kP[e]))s=n.pixelDepth===0?new wn(i[0].data,n.pixelWidth,n.pixelHeight):new ko(i[0].data,n.pixelWidth,n.pixelHeight,n.pixelDepth),s.minFilter=r?Ta:Ot,s.magFilter=Ot,s.generateMipmaps=n.levelCount===0;else{if(n.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");s=new ya(i,n.pixelWidth,n.pixelHeight),s.minFilter=r?mn:ot,s.magFilter=ot}return s.mipmaps=i,s.type=Bf[e],s.format=kP[e],s.colorSpace=G9(n),s.needsUpdate=!0,Promise.resolve(s)}function G9(n){let e=n.dataFormatDescriptor[0];return e.colorPrimaries===1?e.transferFunction===2?rn:Zn:e.colorPrimaries===10?e.transferFunction===2?XH:ZH:e.colorPrimaries===0?fi:(console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),fi)}function tCe(n){return n.includes("/")||n.startsWith("./")||/^https?:/.test(n)}function P$(n,e,t={}){let i=s=>{let o=e?.[s];if(o!==void 0)return[new URL(o,n).href];if(tCe(s))return[new URL(s,n).href];let a=`assets/${s.replaceAll(".","/")}`,c=[new URL(`${a}/model.glb`,n).href];return t.variant!==void 0&&c.unshift(new URL(`${a}/model.${t.variant}.glb`,n).href),c},r=async(s,o)=>{let a=i(s);for(let c=0;c<a.length;c++){let l=a[c],u=await fetch(l,o?{signal:o}:void 0);if(u.ok)return u;if(u.status!==404||c===a.length-1)throw new Error(`asset "${s}": HTTP ${u.status} for ${l}`)}throw new Error(`asset "${s}": no candidate URL`)};return{async load(s,o){return(await r(s,o?.signal)).arrayBuffer()},async loadText(s,o){return(await r(s,o?.signal)).text()}}}var O$=class{provider;loader;loads=new Map;bases=new Set;disposedGeometries=new Set;disposedMaterials=new Set;pending=0;idleResolvers=[];disposed=!1;constructor(n,e){this.provider=n,this.loader=e}track(n){this.pending++;let e=()=>{if(this.pending--,this.pending===0)for(let t of this.idleResolvers.splice(0))t()};return n.then(e,e),n}base(n){let e=this.loads.get(n);return e===void 0&&(e=this.track(this.provider.load(n).then(t=>new Promise((i,r)=>{this.loader.parse(t,"",s=>i({scene:s.scene,clips:s.animations}),s=>r(s instanceof Error?s:new Error(String(s))))})).then(t=>(this.disposed?this.disposeLoaded(t):this.bases.add(t),t))),this.loads.set(n,e)),e}async instance(n,e){if(this.disposed)throw new Error("asset cache is disposed");let{scene:t,clips:i}=await this.base(n);if(this.disposed)throw new Error("asset cache is disposed");let r=e!==void 0?t.getObjectByName(e)??t:t;return{scene:X1(r),clips:i}}whenIdle(){return this.pending===0?Promise.resolve():new Promise(n=>{this.idleResolvers.push(n)})}clear(){for(let n of this.bases)this.disposeLoaded(n);this.bases.clear(),this.loads.clear()}dispose(){this.disposed||(this.disposed=!0,this.clear(),this.loader.dracoLoader?.dispose(),this.loader.ktx2Loader?.dispose())}disposeLoaded(n){n.scene.traverse(e=>{let t=e;if(!t.isMesh)return;this.disposedGeometries.has(t.geometry)||(this.disposedGeometries.add(t.geometry),t.geometry.dispose());let i=Array.isArray(t.material)?t.material:[t.material];for(let r of i)if(!this.disposedMaterials.has(r)){this.disposedMaterials.add(r);for(let s of Object.values(r))s instanceof Gt&&s.dispose();r.dispose()}})}};function nCe(n,e){for(let[t,i]of Object.entries(e.spawned))n.set(t,structuredClone(i));for(let[t,i]of Object.entries(e.changed)){let r=n.get(t)??{};for(let[s,o]of Object.entries(i))o!==void 0&&(r[s]=o);n.set(t,r)}for(let[t,i]of Object.entries(e.removedComponents)){let r=n.get(t);if(r!==void 0)for(let s of i)delete r[s]}for(let t of e.destroyed)n.delete(t)}function T7(n){let e=n.transform;if(e?.pos!==void 0)return{pos:e.pos,rot:e.rot??[0,0,0,1],...e.scale?{scale:e.scale}:{},...e.teleport===!0?{teleport:!0}:{}}}function iCe(n){let e=n.renderable;if(e===void 0&&n.glass!==void 0)return{kind:"glass",ref:"glass"};if(!(e?.kind===void 0||e.ref===void 0))return e}var rCe=class{mirror=new Map;bound=new Map;boundLights=new Map;boundEnvironment;environmentOwner;boundWeather;weatherOwner;currentTick;dirty=new Set;full=!1;visited=0;applyKeyframe(n){this.mirror.clear();for(let[e,t]of Object.entries(n.entities))this.mirror.set(e,structuredClone(t));this.currentTick=n.tick,this.full=!0,this.dirty.clear()}applyDelta(n){if(this.currentTick===void 0||n.baseTick!==this.currentTick)return!1;nCe(this.mirror,n);for(let e of Object.keys(n.spawned))this.dirty.add(e);for(let e of Object.keys(n.changed))this.dirty.add(e);for(let e of Object.keys(n.removedComponents))this.dirty.add(e);for(let e of n.destroyed)this.dirty.add(e);return this.currentTick=n.tick,!0}transforms(){let n=new Map;for(let[e,t]of this.mirror){let i=T7(t);i!==void 0&&n.set(e,i)}return n}transformChanges(n){let e=new Set(Object.keys(n.spawned));for(let[t,i]of Object.entries(n.changed))i.transform!==void 0&&e.add(t);for(let[t,i]of Object.entries(n.removedComponents))i.includes("transform")&&e.add(t);for(let t of n.destroyed)e.add(t);return new Map([...e].map(t=>[t,T7(this.mirror.get(t)??{})]))}get lastReconcileVisited(){return this.visited}reconcile(n){let e=this.full;if(e){this.visited=this.mirror.size;for(let t of this.mirror.keys())this.reconcileRenderable(n,t);for(let t of[...this.bound.keys()])this.mirror.has(t)||this.reconcileRenderable(n,t)}else{this.visited=this.dirty.size;for(let t of this.dirty)this.reconcileRenderable(n,t)}this.reconcileLights(n,e),this.reconcileEnvironment(n,e),this.reconcileWeather(n,e),this.dirty.clear(),this.full=!1}reconcileRenderable(n,e){let t=this.mirror.get(e),i=t===void 0?void 0:iCe(t);if(i===void 0){this.bound.has(e)&&(n.destroy(e),this.bound.delete(e));return}let r=JSON.stringify(i),s=this.bound.get(e);if(s===void 0?(n.create(e,i),this.bound.set(e,r)):s!==r&&(n.updateRenderable(e,i),this.bound.set(e,r)),n.setLivery?.(e,t?.livery),n.setGlass?.(e,t?.glass,t?.glassState),n.setModelSignals){let o=t?.["model.signals"];n.setModelSignals(e,o,g5(o?.sources,a=>t?.[a]))}}reconcileLights(n,e){if(n.createLight!==void 0)if(e){for(let t of this.mirror.keys())this.reconcileLight(n,t);for(let t of[...this.boundLights.keys()])this.mirror.has(t)||this.reconcileLight(n,t)}else for(let t of this.dirty)this.reconcileLight(n,t)}reconcileLight(n,e){let t=this.mirror.get(e)?.light;if(t?.type===void 0){this.boundLights.has(e)&&(n.destroyLight?.(e),this.boundLights.delete(e));return}let i=JSON.stringify(t),r=this.boundLights.get(e);r===void 0?(n.createLight?.(e,t),this.boundLights.set(e,i)):r!==i&&(n.updateLight?.(e,t),this.boundLights.set(e,i))}reconcileEnvironment(n,e){if(n.setEnvironment===void 0||!e&&!this.environmentTouched())return;let t,i;for(let[s,o]of this.mirror)if(o.environment!==void 0){t=o.environment,i=s;break}this.environmentOwner=i;let r=t!==void 0?JSON.stringify(t):void 0;r!==this.boundEnvironment&&(n.setEnvironment(t),this.boundEnvironment=r)}reconcileWeather(n,e){if(!n.setWeather||!e&&!(this.weatherOwner!==void 0&&this.dirty.has(this.weatherOwner))&&![...this.dirty].some(r=>this.mirror.get(r)?.weather!==void 0))return;let t;this.weatherOwner=void 0;for(let[r,s]of this.mirror)if(s.weather!==void 0){t=s.weather,this.weatherOwner=r;break}let i=t===void 0?void 0:JSON.stringify(t);i!==this.boundWeather&&(n.setWeather(t),this.boundWeather=i)}environmentTouched(){if(this.environmentOwner!==void 0&&this.dirty.has(this.environmentOwner))return!0;for(let n of this.dirty)if(this.mirror.get(n)?.environment!==void 0)return!0;return!1}boundIds(){return[...this.bound.keys()]}get tick(){return this.currentTick}has(n){return this.mirror.has(n)}get(n,e){let t=this.mirror.get(n)?.[e];return t===void 0?void 0:structuredClone(t)}peek(n,e){return this.mirror.get(n)?.[e]}entities(){return[...this.mirror.keys()]}components(n){let e=this.mirror.get(n);return e===void 0?[]:Object.keys(e)}};function sCe(n,e,t){switch(n.mode){case"follow":if(t===void 0)return;e.setCamera(oCe(n,t)),n.fov!==void 0&&e.setFov(n.fov);return;case"fixed":case"free-fly":e.setCamera({position:n.position,...n.lookAt!==void 0?{lookAt:n.lookAt}:{}}),n.fov!==void 0&&e.setFov(n.fov);return;case"top-down-ortho":e.setTopDownOrtho({center:n.center,viewHeight:n.viewHeight,...n.cameraHeight!==void 0?{cameraHeight:n.cameraHeight}:{}});return;default:return}}function oCe(n,e){let t=i=>{let[r,s,o]=i;if(n.space==="local"){let[a,c,l,u]=e.rot,d=2*(c*o-l*s),h=2*(l*r-a*o),f=2*(a*s-c*r);r+=u*d+c*f-l*h,s+=u*h+l*d-a*f,o+=u*f+a*h-c*d}return[e.pos[0]+r,e.pos[1]+s,e.pos[2]+o]};return{position:t(n.offset),lookAt:t(n.lookOffset)}}var FI={ambient:{sky:"#ffffff",ground:"#444455",intensity:1.1},sun:{direction:[5,10,7],color:"#ffffff",intensity:1.4}},$7="$environment";function Px(n){return n.children.find(e=>e.name===$7)}var aCe={low:1024,medium:2048,high:4096};function z7(n,e){n.setSky(e.sky,e.shadows??"off");let t=n.scene,i=Px(t);i!==void 0&&(i.traverse(c=>{c.isLight&&c.dispose()}),t.remove(i));let r=new Pn;r.name=$7;let s=e.ambient??FI.ambient;s!==void 0&&e.sky===void 0&&r.add(new zo(new le(s.sky??"#ffffff"),new le(s.ground??"#444455"),s.intensity??1.1));let o=e.shadows??"off",a=e.sun??FI.sun;if(a!==void 0&&e.sky===void 0){let c=new Si(new le(a.color??"#ffffff"),a.intensity??1.4),l=a.direction??[5,10,7];if(c.position.set(l[0],l[1],l[2]),c.userData.molenSun=!0,c.userData.molenSunDirection=new C(l[0],l[1],l[2]).normalize(),r.add(c.target),o!=="off"&&a.castShadow===!0){c.castShadow=!0;let u=aCe[o];c.shadow.mapSize.set(u,u),c.shadow.camera.near=.5,c.shadow.camera.far=500;let d=50;c.shadow.camera.left=-50,c.shadow.camera.right=d,c.shadow.camera.top=d,c.shadow.camera.bottom=-50}r.add(c)}t.add(r),n.three.shadowMap.enabled=o!=="off",n.three.shadowMap.type=o==="low"?Go:dd,n.three.setClearColor(e.background!==void 0?new le(e.background):n.defaultClearColor,1),t.fog=e.fog!==void 0?new $r(new le(e.fog.color),e.fog.near??1,e.fog.far??1e3):null,n.three.toneMapping=e.toneMapping==="aces"?Bl:e.toneMapping==="agx"?Nl:e.toneMapping==="neutral"?kl:yi,n.three.toneMappingExposure=e.exposure??1}KF();function cCe(n){if(!Number.isSafeInteger(n.width)||n.width<1||!Number.isSafeInteger(n.height)||n.height<1||!Number.isSafeInteger(n.width*n.height*4)||n.data.length!==n.width*n.height*4)throw new Error("Invalid baked material image: expected positive dimensions and matching RGBA8 data")}function M7(n,e){let t=n.data[e];for(let i=e+4;i<n.data.length;i+=4)if(n.data[i]!==t)return;return t/255}function VA(n,e,t){let i=new wn(new Uint8Array(n.data.buffer.slice(0)),n.width,n.height,Jt);return i.flipY=!1,t&&(i.colorSpace=rn),i.magFilter=e==="nearest"?Ot:ot,i.minFilter=e==="nearest"?Ot:ot,i.needsUpdate=!0,i}function I7(n){for(let i of Object.values(n.slots))i!==void 0&&cCe(i);if(n.meta.alphaCoverage&&(n.meta.alphaTest!==void 0||!n.slots.baseColor))throw new Error("alphaCoverage requires baseColor and cannot be combined with alphaTest");let e=new ii({roughness:1,metalness:1}),t=n.meta.filter;if(n.slots.baseColor!==void 0?e.map=VA(n.slots.baseColor,t,!0):(e.roughness=.6,e.metalness=0),n.slots.roughness!==void 0){let i=M7(n.slots.roughness,1);i===void 0?e.roughnessMap=VA(n.slots.roughness,t,!1):e.roughness*=i}if(n.slots.metalness!==void 0){let i=M7(n.slots.metalness,2);i===void 0?e.metalnessMap=VA(n.slots.metalness,t,!1):e.metalness*=i}else n.slots.baseColor!==void 0&&(e.metalness=0);if(n.slots.normal!==void 0&&(e.normalMap=VA(n.slots.normal,t,!1)),n.slots.emissive!==void 0&&(e.emissiveMap=VA(n.slots.emissive,t,!0),e.emissive=new le("#ffffff")),n.slots.ao!==void 0&&(e.aoMap=VA(n.slots.ao,t,!1)),n.meta.alphaTest!==void 0&&(e.alphaTest=n.meta.alphaTest,e.transparent=!1),n.meta.alphaCoverage){e.alphaTest=0,e.transparent=!0,e.depthWrite=!1;for(let i of[e.map,e.normalMap,e.roughnessMap,e.metalnessMap,e.emissiveMap,e.aoMap])!i||i.magFilter===Ot||(i.generateMipmaps=!0,i.minFilter=mn,i.needsUpdate=!0)}return e}var C7="#cccccc",R7="__grey";function B7(n){return new ii({color:new le(n),roughness:.6})}var Ux=class{provider;baker;cache=new Map;keyOf=new Map;refs=new Map;disposed=!1;disposedMaterials=new WeakSet;constructor(n=void 0,e=void 0){this.provider=n,this.baker=e}resolveSync(n){let e=n?.startsWith("palette:")===!0?n:R7,t=this.cache.get(e);if(t instanceof bn)return t;let i=B7(e===R7?C7:e.slice(8));return this.disposed||this.remember(e,i),i}isAsync(n){return n!==void 0&&(n.startsWith("matgraph:")||n.startsWith("pixelgrid:"))}async resolve(n){if(this.disposed)throw new Error("material resolver is disposed");let e=this.cache.get(n);if(e!==void 0)return e;let t=this.bake(n).catch(i=>(console.warn(`[molen] materialRef "${n}": ${i.message}`),B7(C7))).then(i=>(this.disposed||this.cache.get(n)!==t?this.disposeMaterial(i):this.remember(n,i),i));return this.cache.set(n,t),t}acquireSync(n){return this.retain(this.resolveSync(n))}async acquire(n){return this.retain(await this.resolve(n))}release(n){let e=this.refs.get(n);if(e===void 0)return;if(e>1){this.refs.set(n,e-1);return}this.refs.delete(n);let t=this.keyOf.get(n);t!==void 0&&(this.keyOf.delete(n),this.cache.get(t)===n&&this.cache.delete(t)),this.disposeMaterial(n)}retain(n){return this.disposed||this.refs.set(n,(this.refs.get(n)??0)+1),n}remember(n,e){this.cache.set(n,e),this.keyOf.set(e,n)}async bake(n){if(this.provider===void 0)throw new Error("no asset provider configured (ClientOptions.assets)");let e=n.indexOf(":"),t=n.slice(0,e),i=n.slice(e+1),r=JSON.parse(await this.provider.loadText(i));if(t==="matgraph"){let o=_S("matgraph",r);if(!o.ok)throw new Error(o.formatted);return I7(this.baker?await this.baker.bake("matgraph",o.value):LH(o.value))}let s=_S("pixelgrid",r);if(!s.ok)throw new Error(s.formatted);return I7(this.baker?await this.baker.bake("pixelgrid",s.value):UH(s.value))}dispose(){if(!this.disposed){this.disposed=!0;for(let n of this.cache.values())n instanceof bn?this.disposeMaterial(n):n.then(e=>this.disposeMaterial(e));this.cache.clear(),this.keyOf.clear(),this.refs.clear()}}disposeMaterial(n){if(!this.disposedMaterials.has(n)){this.disposedMaterials.add(n);for(let e of Object.values(n))e instanceof Gt&&e.dispose();n.dispose()}}};function lCe(n){return{molenCloudMap:{value:n},molenCloudShadow:{value:new qe(0,0,1,0)},molenCloudField:{value:new qe},molenCloudMix:{value:new qe},molenCloudFit:{value:new qe(.15,0,.35,0)}}}var uCe=`
|
|
4794
4794
|
uniform sampler2D molenCloudMap;
|