@haiyue/animation-spec 0.2.2 → 0.3.0
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/README.md +1 -1
- package/SPECIFICATION.md +13 -3
- package/bin/hya-live2d-convert.mjs +0 -0
- package/bin/hya-lottie-convert.mjs +0 -0
- package/dist/chunks/binary-Btol_e09.js +1 -0
- package/dist/chunks/clip-baked-D9PAhUfD.js +1 -0
- package/dist/chunks/expression-sAWA2ssN.js +1 -0
- package/dist/chunks/parser-DiexwIBc.js +1 -0
- package/dist/cubism.js +1 -1
- package/dist/hya-production.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/live2d/clip-baked.js +1 -1
- package/dist/live2d.js +1 -1
- package/dist/lottie.d.ts +1 -1
- package/dist/lottie.js +1 -1
- package/dist/native3d.d.ts +1 -1
- package/dist/native3d.js +1 -1
- package/dist/shared.d.ts +78 -3
- package/package.json +1 -1
- package/schema/animation-3d.contract.json +124 -28
- package/schema/animation.schema.json +2 -1
- package/dist/chunks/binary-DvuTJ_hy.js +0 -1
- package/dist/chunks/clip-baked-Dv-wjX9d.js +0 -1
- package/dist/chunks/expression-D1cKtNwM.js +0 -1
package/dist/native3d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e}from"./chunks/extensions-DxL4AxOC.js";import{parseAnimation as t}from"./index.js";import"./chunks/errors-Bzs3GOD9.js";import"./chunks/expression-D1cKtNwM.js";import"./chunks/binary-DvuTJ_hy.js";const n="org.haiyue.animation-3d@1",a="haiyue-animation-3d@1",r="haiyue-animation3d-clip@1",i="haiyue-animation3d-state-machine@1";class o extends Error{code;path;name="Native3DAnimationFormatError";constructor(e,t,n){super(`${t} (${n})`),this.code=e,this.path=n}}const s=`$.extensions.${n}`,d=new Set(["model/gltf-binary","model/gltf+json"]),c=new Set(["blob","file","javascript"]),m=Object.freeze({maxMaterials:1e4,maxNodes:1e5,maxComponents:2e5,maxClips:1e4,maxTracks:2e5,maxKeyframes:5e6,maxParticleCapacity:2e6,maxStateMachineDepth:64});function l(e={},t){return Object.freeze({id:n,validateDocument(n){t?.(u(n,e))}})}function p(a,r={}){const i=new e;let m;i.register(l(r,e=>{m=e}));const p={..._(r),extensions:i,...void 0===r.copyFloatData?{}:{copyFloatData:r.copyFloatData}},u=t(a,p);if(!m)throw new o("E_ANIMATION_3D_INVALID_PAYLOAD",`Required extension "${n}" has no document payload.`,s);return function(e,t){1===e.extensionsUsed.length&&e.extensionsUsed[0]===n&&1===e.extensionsRequired.length&&e.extensionsRequired[0]===n||Y(`Native 3D carrier must use and require only "${n}".`,"$.extensionsRequired");e.nodes.length>0&&Y("Native 3D carrier cannot contain core 2D nodes.","$.nodes","E_ANIMATION_3D_MIXED_DIMENSIONS");e.tracks.length>0&&Y("Native 3D carrier cannot contain core 2D tracks.","$.tracks","E_ANIMATION_3D_MIXED_DIMENSIONS");e.canvas.width===t.viewport.width&&e.canvas.height===t.viewport.height||Y("Core canvas and native 3D viewport dimensions must match.",`${s}.viewport`);for(let n=0;n<t.nodes.length;n++){const a=t.nodes[n],r=a.start??0;(r>e.duration||r+(a.duration??e.duration-r)>e.duration+1e-6)&&Y("Node time range must fit inside composition duration.",`${s}.nodes[${n}]`)}for(let n=0;n<t.clips.length;n++)t.clips[n].duration>e.duration+1e-6&&Y("Clip duration must fit inside composition duration.",`${s}.clips[${n}].duration`)}(u,m),function(e,t){const n=new Map(e.map(e=>[e.id,e]));for(let t=0;t<e.length;t++){const n=L(e[t].uri);n&&c.has(n)&&Y(`Delivery URI scheme "${n}:" is forbidden.`,`$.resources[${t}].uri`,"E_ANIMATION_3D_UNKNOWN_RESOURCE")}for(let e=0;e<t.materials.length;e++){const a=t.materials[e];for(const t of["baseColorTexture","normalTexture","metallicRoughnessTexture","emissiveTexture"]){const r=a[t];if(void 0===r)continue;const i=n.get(r);i&&"image"===i.type||Y(`Material texture "${r}" must reference an image resource.`,`${s}.materials[${e}].${t}`,"E_ANIMATION_3D_UNKNOWN_RESOURCE")}}for(let e=0;e<t.nodes.length;e++){const a=t.nodes[e];for(let t=0;t<a.components.length;t++){const r=a.components[t],i=`${s}.nodes[${e}].components[${t}]`;if("model3d"===r.kind){const e=n.get(r.resource);e&&"binary"===e.type&&e.mimeType&&d.has(e.mimeType)||Y(`Model "${r.resource}" must reference a binary glTF/GLB resource.`,`${i}.resource`,"E_ANIMATION_3D_UNKNOWN_RESOURCE")}if("particle3d"===r.kind&&void 0!==r.descriptor.textureResource){const e=n.get(r.descriptor.textureResource);e&&"image"===e.type||Y(`Particle texture "${r.descriptor.textureResource}" must reference an image resource.`,`${i}.descriptor.textureResource`,"E_ANIMATION_3D_UNKNOWN_RESOURCE")}}}}(u.resources,m),Object.freeze({document:u,payload:m,resources:u.resources})}function u(e,t={}){const n=function(e){return Object.freeze({maxMaterials:v(e.maxMaterials,m.maxMaterials,"maxMaterials"),maxNodes:v(e.maxNodes,m.maxNodes,"maxNodes"),maxComponents:v(e.maxComponents,m.maxComponents,"maxComponents"),maxClips:v(e.maxClips,m.maxClips,"maxClips"),maxTracks:v(e.maxTracks,m.maxTracks,"maxTracks"),maxKeyframes:v(e.maxKeyframes,m.maxKeyframes,"maxKeyframes"),maxParticleCapacity:v(e.maxParticleCapacity,m.maxParticleCapacity,"maxParticleCapacity"),maxStateMachineDepth:v(e.maxStateMachineDepth,m.maxStateMachineDepth,"maxStateMachineDepth")})}(t),o=A(e,s,["format","mode","coordinateSystem","viewport","materials","nodes","clips"],["format","mode","coordinateSystem","viewport","materials","nodes","clips","stateMachine"]);P(o.format,a,`${s}.format`),P(o.mode,"native-3d",`${s}.mode`);const d=function(e,t){const n=A(e,t,["handedness","upAxis","forwardAxis","unit","angles","rotationStorage"],["handedness","upAxis","forwardAxis","unit","angles","rotationStorage"]);return P(n.handedness,"right",`${t}.handedness`),P(n.upAxis,"+y",`${t}.upAxis`),P(n.forwardAxis,"-z",`${t}.forwardAxis`),P(n.unit,"meter",`${t}.unit`),P(n.angles,"radian",`${t}.angles`),P(n.rotationStorage,"normalized-xyzw-quaternion",`${t}.rotationStorage`),Object.freeze({handedness:"right",upAxis:"+y",forwardAxis:"-z",unit:"meter",angles:"radian",rotationStorage:"normalized-xyzw-quaternion"})}(o.coordinateSystem,`${s}.coordinateSystem`),c=function(e,t){const n=A(e,t,["width","height"],["width","height"]);return Object.freeze({width:D(n.width,`${t}.width`),height:D(n.height,`${t}.height`)})}(o.viewport,`${s}.viewport`),l=b(o.materials,`${s}.materials`);B(l.length,n.maxMaterials,"materials",`${s}.materials`);const p=new Set,u=l.map((e,t)=>{const n=function(e,t){const n=A(e,t,["id","name","baseColorFactor","metallicFactor","roughnessFactor","emissiveFactor","alphaMode","doubleSided"],["id","name","baseColorFactor","metallicFactor","roughnessFactor","emissiveFactor","alphaMode","alphaCutoff","doubleSided","baseColorTexture","normalTexture","metallicRoughnessTexture","emissiveTexture"]);return Object.freeze({id:w(n.id,`${t}.id`),name:R(n.name,`${t}.name`),baseColorFactor:O(n.baseColorFactor,`${t}.baseColorFactor`,0,1),metallicFactor:C(n.metallicFactor,`${t}.metallicFactor`,0,1),roughnessFactor:C(n.roughnessFactor,`${t}.roughnessFactor`,0,1),emissiveFactor:T(n.emissiveFactor,`${t}.emissiveFactor`,0),alphaMode:F(n.alphaMode,["opaque","mask","blend"],`${t}.alphaMode`),...void 0===n.alphaCutoff?{}:{alphaCutoff:C(n.alphaCutoff,`${t}.alphaCutoff`,0,1)},doubleSided:U(n.doubleSided,`${t}.doubleSided`),...G(n,t,["baseColorTexture","normalTexture","metallicRoughnessTexture","emissiveTexture"])})}(e,`${s}.materials[${t}]`);return H(p,n.id,`${s}.materials[${t}].id`,"material"),n}),_=b(o.nodes,`${s}.nodes`);B(_.length,n.maxNodes,"nodes",`${s}.nodes`);const x=new Set,y=new Set;let S=0,E=0;const X=_.map((e,t)=>{const a=`${s}.nodes[${t}]`,r=function(e,t){const n=A(e,t,["id","name","transform","components"],["id","name","parent","start","duration","transform","components"]),a=b(n.components,`${t}.components`).map((e,n)=>function(e,t){const n=A(e,t).kind;if("camera3d"===n){const a=A(e,t,["id","kind","projection"],["id","kind","projection"]);return Object.freeze({id:w(a.id,`${t}.id`),kind:n,projection:f(a.projection,`${t}.projection`)})}if("primitive3d"===n){const a=A(e,t,["id","kind","primitive","materialId"],["id","kind","primitive","materialId"]);return Object.freeze({id:w(a.id,`${t}.id`),kind:n,primitive:F(a.primitive,["box","sphere","plane","cylinder","cone"],`${t}.primitive`),materialId:w(a.materialId,`${t}.materialId`)})}if("model3d"===n){const a=A(e,t,["id","kind","resource"],["id","kind","resource","materialOverrides"]),r=void 0===a.materialOverrides?void 0:b(a.materialOverrides,`${t}.materialOverrides`).map((e,n)=>{const a=`${t}.materialOverrides[${n}]`,r=A(e,a,["slot","materialId"],["slot","materialId"]);return Object.freeze({slot:w(r.slot,`${a}.slot`),materialId:w(r.materialId,`${a}.materialId`)})});return Object.freeze({id:w(a.id,`${t}.id`),kind:n,resource:w(a.resource,`${t}.resource`),...r?{materialOverrides:Object.freeze(r)}:{}})}if("particle3d"===n){const a=A(e,t,["id","kind","descriptor"],["id","kind","descriptor"]);return Object.freeze({id:w(a.id,`${t}.id`),kind:n,descriptor:h(a.descriptor,`${t}.descriptor`)})}Y(`Unsupported component kind "${String(n)}".`,`${t}.kind`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}(e,`${t}.components[${n}]`));return Object.freeze({id:w(n.id,`${t}.id`),name:R(n.name,`${t}.name`),...void 0===n.parent?{}:{parent:w(n.parent,`${t}.parent`)},...void 0===n.start?{}:{start:z(n.start,`${t}.start`)},...void 0===n.duration?{}:{duration:D(n.duration,`${t}.duration`)},transform:$(n.transform,`${t}.transform`),components:Object.freeze(a)})}(e,a);H(x,r.id,`${a}.id`,"node");for(let e=0;e<r.components.length;e++){const t=r.components[e];H(y,t.id,`${a}.components[${e}].id`,"component"),S++,"particle3d"===t.kind&&(E+=t.descriptor.maxParticles)}return B(S,n.maxComponents,"components",`${a}.components`),B(E,n.maxParticleCapacity,"particle capacity",`${a}.components`),r});!function(e,t,n){const a=new Map(e.map(e=>[e.id,e]));for(let a=0;a<e.length;a++){const r=e[a];void 0===r.parent||t.has(r.parent)||Y(`Node parent "${r.parent}" does not exist.`,`${s}.nodes[${a}].parent`,"E_ANIMATION_3D_BINDING_MISMATCH"),r.parent===r.id&&Y("Node cannot parent itself.",`${s}.nodes[${a}].parent`,"E_ANIMATION_3D_BINDING_MISMATCH");for(let e=0;e<r.components.length;e++){const t=r.components[e],i=`${s}.nodes[${a}].components[${e}]`;if("primitive3d"!==t.kind||n.has(t.materialId)||Y(`Primitive material "${t.materialId}" does not exist.`,`${i}.materialId`,"E_ANIMATION_3D_UNKNOWN_RESOURCE"),"model3d"===t.kind)for(let e=0;e<(t.materialOverrides?.length??0);e++){const a=t.materialOverrides[e].materialId;n.has(a)||Y(`Material override "${a}" does not exist.`,`${i}.materialOverrides[${e}].materialId`,"E_ANIMATION_3D_UNKNOWN_RESOURCE")}}}for(const t of e){const e=new Set;let n=t;for(;n?.parent;)e.has(n.id)&&Y("Node hierarchy contains a cycle.",`${s}.nodes`,"E_ANIMATION_3D_BINDING_MISMATCH"),e.add(n.id),n=a.get(n.parent)}}(X,x,p);const L=b(o.clips,`${s}.clips`);B(L.length,n.maxClips,"clips",`${s}.clips`);const K=new Set,W=new Set;let J=0,Q=0;const Z=L.map((e,t)=>{const a=`${s}.clips[${t}]`,i=function(e,t){const n=A(e,t,["format","id","name","duration","tracks","events"],["format","id","name","duration","tracks","events"]);P(n.format,r,`${t}.format`);const a=D(n.duration,`${t}.duration`),i=new Set,o=b(n.tracks,`${t}.tracks`).map((e,n)=>{const r=`${t}.tracks[${n}]`,o=function(e,t,n){const a=A(e,t,["id","binding","interpolation","times","values"],["id","binding","interpolation","times","values"]),r=function(e,t){const n=A(e,t),a=function(e,t){const n=A(e,t).kind;if("node-id"===n){const a=A(e,t,["kind","nodeId"],["kind","nodeId"]);return Object.freeze({kind:n,nodeId:w(a.nodeId,`${t}.nodeId`)})}if("node-path"===n){const a=b(A(e,t,["kind","segments"],["kind","segments"]).segments,`${t}.segments`);return 0===a.length&&Y("Node path must contain at least one segment.",`${t}.segments`),Object.freeze({kind:n,segments:Object.freeze(a.map((e,n)=>w(e,`${t}.segments[${n}]`)))})}if("slot"===n){const a=A(e,t,["kind","slot"],["kind","slot"]);return Object.freeze({kind:n,slot:w(a.slot,`${t}.slot`)})}Y(`Unsupported binding target "${String(n)}".`,`${t}.kind`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}(n.target,`${t}.target`),r=w(n.id,`${t}.id`);if("transform.translation"===n.path||"transform.scale"===n.path){const i=A(e,t,["id","target","path","valueType","valueSize"],["id","target","path","valueType","valueSize"]);return P(i.valueType,"vec3",`${t}.valueType`),P(i.valueSize,3,`${t}.valueSize`,"E_ANIMATION_3D_BINDING_MISMATCH"),Object.freeze({id:r,target:a,path:n.path,valueType:"vec3",valueSize:3})}if("transform.rotation"===n.path){const i=A(e,t,["id","target","path","valueType","valueSize"],["id","target","path","valueType","valueSize"]);return P(i.valueType,"quaternion",`${t}.valueType`),P(i.valueSize,4,`${t}.valueSize`,"E_ANIMATION_3D_BINDING_MISMATCH"),Object.freeze({id:r,target:a,path:n.path,valueType:"quaternion",valueSize:4})}if("morph.weights"===n.path){const i=A(e,t,["id","target","path","valueType","valueSize"],["id","target","path","valueType","valueSize"]);return P(i.valueType,"weights",`${t}.valueType`),Object.freeze({id:r,target:a,path:n.path,valueType:"weights",valueSize:j(i.valueSize,`${t}.valueSize`,1,65536)})}if("property"===n.path){const n=A(e,t,["id","target","path","component","property","valueType","valueSize"],["id","target","path","component","property","valueType","valueSize"]),i=F(n.component,["material3d","camera3d"],`${t}.component`),o=F(n.property,["baseColorFactor","metallicFactor","roughnessFactor","emissiveFactor","alphaCutoff","fovYRadians","near","far","orthoHeight"],`${t}.property`),s=function(e,t,n){const a={baseColorFactor:["vec4",4],metallicFactor:["scalar",1],roughnessFactor:["scalar",1],emissiveFactor:["vec3",3],alphaCutoff:["scalar",1]},r={fovYRadians:["scalar",1],near:["scalar",1],far:["scalar",1],orthoHeight:["scalar",1]},i="material3d"===e?a[t]:r[t];i||Y(`Property "${t}" is not valid for ${e}.`,n,"E_ANIMATION_3D_BINDING_MISMATCH");return{valueType:i[0],valueSize:i[1]}}(i,o,`${t}.property`);return P(n.valueType,s.valueType,`${t}.valueType`,"E_ANIMATION_3D_BINDING_MISMATCH"),P(n.valueSize,s.valueSize,`${t}.valueSize`,"E_ANIMATION_3D_BINDING_MISMATCH"),Object.freeze({id:r,target:a,path:"property",component:i,property:o,...s})}Y(`Unsupported binding path "${String(n.path)}".`,`${t}.path`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}(a.binding,`${t}.binding`),i=F(a.interpolation,["step","linear","cubic-spline"],`${t}.interpolation`),o=M(a.times,`${t}.times`,1);for(let e=0;e<o.length;e++){const a=o[e];(a<0||a>n)&&Y("Track time must lie within clip duration.",`${t}.times[${e}]`,"E_ANIMATION_3D_BINDING_MISMATCH"),e>0&&a<=o[e-1]&&Y("Track times must be strictly increasing.",`${t}.times[${e}]`,"E_ANIMATION_3D_BINDING_MISMATCH")}const s=M(a.values,`${t}.values`,1),d=o.length*r.valueSize*("cubic-spline"===i?3:1);s.length!==d&&Y(`Track values length ${s.length} does not match expected ${d}.`,`${t}.values`,"E_ANIMATION_3D_BINDING_MISMATCH");"transform.rotation"===r.path&&function(e,t,n,a){const r="cubic-spline"===n?12:4,i="cubic-spline"===n?4:0;for(let n=0;n<t;n++)g(e.slice(n*r+i,n*r+i+4),`${a}[${n*r+i}]`)}(s,o.length,i,`${t}.values`);return Object.freeze({id:w(a.id,`${t}.id`),binding:r,interpolation:i,times:o,values:s})}(e,r,a);return H(i,o.id,`${r}.id`,"track"),o}),s=new Set,d=b(n.events,`${t}.events`).map((e,n)=>{const r=`${t}.events[${n}]`,i=function(e,t,n){const a=A(e,t,["id","time","name"],["id","time","name","payload"]),r=z(a.time,`${t}.time`);r>n&&Y("Event time must lie within clip duration.",`${t}.time`);return Object.freeze({id:w(a.id,`${t}.id`),time:r,name:w(a.name,`${t}.name`),...void 0===a.payload?{}:{payload:V(a.payload,`${t}.payload`)}})}(e,r,a);return H(s,i.id,`${r}.id`,"event"),i});return Object.freeze({format:r,id:w(n.id,`${t}.id`),name:R(n.name,`${t}.name`),duration:a,tracks:Object.freeze(o),events:Object.freeze(d)})}(e,a);H(K,i.id,`${a}.id`,"clip"),J+=i.tracks.length,Q+=i.tracks.reduce((e,t)=>e+t.times.length,0),B(J,n.maxTracks,"tracks",`${a}.tracks`),B(Q,n.maxKeyframes,"keyframes",`${a}.tracks`);const o=new Set;for(let e=0;e<i.tracks.length;e++){const t=i.tracks[e];H(o,t.binding.id,`${a}.tracks[${e}].binding.id`,"binding"),W.add(t.binding.id),N(t.binding,X,p,`${a}.tracks[${e}].binding`)}return i}),ee=void 0===o.stateMachine||null===o.stateMachine?o.stateMachine:function(e,t,n){const a=A(e,t,["format","id","name","parameters","layers"],["format","id","name","parameters","layers"]);P(a.format,i,`${t}.format`);const r=new Set,o=b(a.parameters,`${t}.parameters`).map((e,n)=>{const a=`${t}.parameters[${n}]`,i=function(e,t){const n=A(e,t),a=w(n.name,`${t}.name`);if("trigger"===n.type)return A(e,t,["name","type"],["name","type"]),Object.freeze({name:a,type:"trigger"});if(A(e,t,["name","type","defaultValue"],["name","type","defaultValue"]),"float"===n.type)return Object.freeze({name:a,type:"float",defaultValue:k(n.defaultValue,`${t}.defaultValue`)});if("integer"===n.type)return Object.freeze({name:a,type:"integer",defaultValue:j(n.defaultValue,`${t}.defaultValue`,Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)});if("boolean"===n.type)return Object.freeze({name:a,type:"boolean",defaultValue:U(n.defaultValue,`${t}.defaultValue`)});Y(`Unsupported parameter type "${String(n.type)}".`,`${t}.type`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}(e,a);return H(r,i.name,`${a}.name`,"state-machine parameter"),i}),s=new Set,d=b(a.layers,`${t}.layers`).map((e,a)=>{const r=`${t}.layers[${a}]`,i=function(e,t,n){const a=A(e,t,["id","name","initialStateId","states","transitions"],["id","name","initialStateId","states","transitions","blendMode","weight","mask"]),r=new Set,i=b(a.states,`${t}.states`).map((e,a)=>{const i=`${t}.states[${a}]`,o=function(e,t,n){const a=A(e,t,["id","name","motion"],["id","name","motion","speed","speedParameter","loop"]);return Object.freeze({id:w(a.id,`${t}.id`),name:R(a.name,`${t}.name`),motion:I(a.motion,`${t}.motion`,0,n),...void 0===a.speed?{}:{speed:k(a.speed,`${t}.speed`)},...void 0===a.speedParameter?{}:{speedParameter:w(a.speedParameter,`${t}.speedParameter`)},...void 0===a.loop?{}:{loop:F(a.loop,["once","repeat","ping-pong"],`${t}.loop`)}})}(e,i,n);return H(r,o.id,`${i}.id`,"state"),o}),o=new Set,s=b(a.transitions,`${t}.transitions`).map((e,n)=>{const a=`${t}.transitions[${n}]`,r=function(e,t){const n=A(e,t,["id","from","to","conditions","duration"],["id","from","to","conditions","duration","hasExitTime","exitTime","destinationOffset","interruption"]),a=b(n.conditions,`${t}.conditions`).map((e,n)=>function(e,t){const n=A(e,t,["parameter","operator"],["parameter","operator","value"]),a=F(n.operator,["greater","greater-or-equal","less","less-or-equal","equal","not-equal","is-true","is-false","triggered"],`${t}.operator`);return Object.freeze({parameter:w(n.parameter,`${t}.parameter`),operator:a,...void 0===n.value?{}:{value:"boolean"==typeof n.value?n.value:k(n.value,`${t}.value`)}})}(e,`${t}.conditions[${n}]`));return Object.freeze({id:w(n.id,`${t}.id`),from:w(n.from,`${t}.from`),to:w(n.to,`${t}.to`),conditions:Object.freeze(a),duration:z(n.duration,`${t}.duration`),...void 0===n.hasExitTime?{}:{hasExitTime:U(n.hasExitTime,`${t}.hasExitTime`)},...void 0===n.exitTime?{}:{exitTime:z(n.exitTime,`${t}.exitTime`)},...void 0===n.destinationOffset?{}:{destinationOffset:z(n.destinationOffset,`${t}.destinationOffset`)},...void 0===n.interruption?{}:{interruption:F(n.interruption,["none","source","destination","source-then-destination","destination-then-source"],`${t}.interruption`)}})}(e,a);return H(o,r.id,`${a}.id`,"transition"),r}),d=void 0===a.mask?void 0:function(e,t){const n=A(e,t,[],["include","exclude"]),a=(e,t)=>{const n=new Set;return Object.freeze(b(e,t).map((e,a)=>{const r=w(e,`${t}[${a}]`);return H(n,r,`${t}[${a}]`,"mask binding"),r}))};return Object.freeze({...void 0===n.include?{}:{include:a(n.include,`${t}.include`)},...void 0===n.exclude?{}:{exclude:a(n.exclude,`${t}.exclude`)}})}(a.mask,`${t}.mask`);return Object.freeze({id:w(a.id,`${t}.id`),name:R(a.name,`${t}.name`),initialStateId:w(a.initialStateId,`${t}.initialStateId`),states:Object.freeze(i),transitions:Object.freeze(s),...void 0===a.blendMode?{}:{blendMode:F(a.blendMode,["override","additive"],`${t}.blendMode`)},...void 0===a.weight?{}:{weight:C(a.weight,`${t}.weight`,0,1)},...d?{mask:d}:{}})}(e,r,n);return H(s,i.id,`${r}.id`,"state-machine layer"),i});return Object.freeze({format:i,id:w(a.id,`${t}.id`),name:R(a.name,`${t}.name`),parameters:Object.freeze(o),layers:Object.freeze(d)})}(o.stateMachine,`${s}.stateMachine`,n.maxStateMachineDepth);return ee&&function(e,t,n,a){const r=new Set(e.parameters.map(e=>e.name)),i=(e,n)=>{if("clip"!==e.kind)for(let t=0;t<e.children.length;t++)i(e.children[t].motion,`${n}.children[${t}].motion`);else t.has(e.clipId)||Y(`Motion clip "${e.clipId}" does not exist.`,`${n}.clipId`,"E_ANIMATION_3D_BINDING_MISMATCH")};for(let t=0;t<e.layers.length;t++){const o=e.layers[t],s=`${a}.layers[${t}]`,d=new Set(o.states.map(e=>e.id));d.has(o.initialStateId)||Y(`Initial state "${o.initialStateId}" does not exist.`,`${s}.initialStateId`,"E_ANIMATION_3D_BINDING_MISMATCH");for(let e=0;e<o.states.length;e++){const t=o.states[e];i(t.motion,`${s}.states[${e}].motion`),t.speedParameter&&!r.has(t.speedParameter)&&Y(`Speed parameter "${t.speedParameter}" does not exist.`,`${s}.states[${e}].speedParameter`,"E_ANIMATION_3D_BINDING_MISMATCH")}for(let e=0;e<o.transitions.length;e++){const t=o.transitions[e],n=`${s}.transitions[${e}]`;"*"===t.from||d.has(t.from)||Y(`Transition source "${t.from}" does not exist.`,`${n}.from`,"E_ANIMATION_3D_BINDING_MISMATCH"),d.has(t.to)||Y(`Transition destination "${t.to}" does not exist.`,`${n}.to`,"E_ANIMATION_3D_BINDING_MISMATCH");for(let e=0;e<t.conditions.length;e++)r.has(t.conditions[e].parameter)||Y(`Condition parameter "${t.conditions[e].parameter}" does not exist.`,`${n}.conditions[${e}].parameter`,"E_ANIMATION_3D_BINDING_MISMATCH")}for(const[e,t]of[["include",o.mask?.include],["exclude",o.mask?.exclude]])for(let a=0;a<(t?.length??0);a++)n.has(t[a])||Y(`Mask binding "${t[a]}" does not exist.`,`${s}.mask.${e}[${a}]`,"E_ANIMATION_3D_BINDING_MISMATCH")}}(ee,K,W,`${s}.stateMachine`),q({format:a,mode:"native-3d",coordinateSystem:d,viewport:c,materials:u,nodes:X,clips:Z,...void 0===o.stateMachine?{}:{stateMachine:ee??null}})}function $(e,t){const n=A(e,t,["translation","rotation","scale"],["translation","rotation","scale"]),a=O(n.rotation,`${t}.rotation`);return g(a,`${t}.rotation`),Object.freeze({translation:T(n.translation,`${t}.translation`),rotation:a,scale:T(n.scale,`${t}.scale`)})}function f(e,t){const n=A(e,t).kind;if("perspective"===n){const a=A(e,t,["kind","fovYRadians","near","far"],["kind","fovYRadians","near","far"]),r=D(a.near,`${t}.near`),i=D(a.far,`${t}.far`);return i<=r&&Y("Camera far must be greater than near.",`${t}.far`),Object.freeze({kind:n,fovYRadians:C(a.fovYRadians,`${t}.fovYRadians`,Number.MIN_VALUE,Math.PI,!1),near:r,far:i})}if("orthographic"===n){const a=A(e,t,["kind","orthoHeight","near","far"],["kind","orthoHeight","near","far"]),r=z(a.near,`${t}.near`),i=D(a.far,`${t}.far`);return i<=r&&Y("Camera far must be greater than near.",`${t}.far`),Object.freeze({kind:n,orthoHeight:D(a.orthoHeight,`${t}.orthoHeight`),near:r,far:i})}Y(`Unsupported camera projection "${String(n)}".`,`${t}.kind`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}function h(e,t){const n=["maxParticles","emissionRate","burst","duration","loop","seed","lifetime","speed","direction","spread","gravity","startSize","endSize","rotation","angularVelocity","startColor","endColor","shape","blendMode","radial","opacity","depthTest","depthWrite","sortMode"],a=A(e,t,n,[...n,"shapeSize","shapeRadius","textureResource"]);return Object.freeze({maxParticles:j(a.maxParticles,`${t}.maxParticles`,1,1e6),emissionRate:z(a.emissionRate,`${t}.emissionRate`),burst:j(a.burst,`${t}.burst`,0,1e6),duration:D(a.duration,`${t}.duration`),loop:U(a.loop,`${t}.loop`),seed:j(a.seed,`${t}.seed`,Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),lifetime:E(a.lifetime,`${t}.lifetime`,0),speed:E(a.speed,`${t}.speed`),direction:T(a.direction,`${t}.direction`),spread:C(a.spread,`${t}.spread`,0,Math.PI),gravity:T(a.gravity,`${t}.gravity`),startSize:E(a.startSize,`${t}.startSize`,0),endSize:E(a.endSize,`${t}.endSize`,0),rotation:E(a.rotation,`${t}.rotation`),angularVelocity:E(a.angularVelocity,`${t}.angularVelocity`),startColor:O(a.startColor,`${t}.startColor`,0,1),endColor:O(a.endColor,`${t}.endColor`,0,1),shape:F(a.shape,["point","box","sphere"],`${t}.shape`),...void 0===a.shapeSize?{}:{shapeSize:T(a.shapeSize,`${t}.shapeSize`,0)},...void 0===a.shapeRadius?{}:{shapeRadius:z(a.shapeRadius,`${t}.shapeRadius`)},blendMode:F(a.blendMode,["normal","additive"],`${t}.blendMode`),...void 0===a.textureResource?{}:{textureResource:w(a.textureResource,`${t}.textureResource`)},radial:U(a.radial,`${t}.radial`),opacity:C(a.opacity,`${t}.opacity`,0,1),depthTest:U(a.depthTest,`${t}.depthTest`),depthWrite:U(a.depthWrite,`${t}.depthWrite`),sortMode:F(a.sortMode,["none","back-to-front"],`${t}.sortMode`)})}function I(e,t,n,a){n>=a&&B(n+1,a,"state-machine motion depth",t);const r=A(e,t);if("clip"===r.kind){const n=A(e,t,["kind","clipId"],["kind","clipId"]);return Object.freeze({kind:"clip",clipId:w(n.clipId,`${t}.clipId`)})}if("blend-1d"===r.kind){const r=A(e,t,["kind","parameter","children"],["kind","parameter","children"]),i=x(r.children,`${t}.children`).map((e,r)=>{const i=`${t}.children[${r}]`,o=A(e,i,["threshold","motion"],["threshold","motion"]);return Object.freeze({threshold:k(o.threshold,`${i}.threshold`),motion:I(o.motion,`${i}.motion`,n+1,a)})});return Object.freeze({kind:"blend-1d",parameter:w(r.parameter,`${t}.parameter`),children:Object.freeze(i)})}if("blend-2d"===r.kind){const r=A(e,t,["kind","algorithm","parameterX","parameterY","children"],["kind","algorithm","parameterX","parameterY","children"]),i=x(r.children,`${t}.children`).map((e,r)=>{const i=`${t}.children[${r}]`,o=A(e,i,["position","motion"],["position","motion"]);return Object.freeze({position:y(o.position,`${i}.position`),motion:I(o.motion,`${i}.motion`,n+1,a)})});return Object.freeze({kind:"blend-2d",algorithm:F(r.algorithm,["cartesian","directional"],`${t}.algorithm`),parameterX:w(r.parameterX,`${t}.parameterX`),parameterY:w(r.parameterY,`${t}.parameterY`),children:Object.freeze(i)})}Y(`Unsupported motion kind "${String(r.kind)}".`,`${t}.kind`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}function N(e,t,n,a){const r=new Map(t.map(e=>[e.id,e])),i=e.target;"node-id"!==i.kind||r.has(i.nodeId)||Y(`Binding node "${i.nodeId}" does not exist.`,`${a}.target.nodeId`,"E_ANIMATION_3D_BINDING_MISMATCH"),"node-path"!==i.kind||r.has(i.segments[0])||Y(`Binding node path root "${i.segments[0]}" does not exist.`,`${a}.target.segments[0]`,"E_ANIMATION_3D_BINDING_MISMATCH"),"property"===e.path&&"material3d"===e.component&&("slot"===i.kind&&n.has(i.slot)||Y("Material property bindings require a material-id slot target.",`${a}.target`,"E_ANIMATION_3D_BINDING_MISMATCH")),"property"===e.path&&"camera3d"===e.component&&("node-id"===i.kind&&r.get(i.nodeId)?.components.some(e=>"camera3d"===e.kind)||Y("Camera property bindings require a node-id target with Camera3D.",`${a}.target`,"E_ANIMATION_3D_BINDING_MISMATCH"))}function g(e,t){const n=Math.hypot(...e);Math.abs(n-1)>1e-4&&Y("Quaternion must be normalized XYZW.",t,"E_ANIMATION_3D_BINDING_MISMATCH")}function _(e){const t=["maxInputBytes","maxMetadataBytes","maxNodes","maxComponents","maxTracks","maxKeyframes","maxResources","maxPathValues","maxTextCharacters","maxParticleCapacity"],n={};for(const a of t)void 0!==e[a]&&(n[a]=e[a]);return n}function v(e,t,n){if(void 0===e)return t;if(!Number.isSafeInteger(e)||e<=0)throw new RangeError(`${n} must be a positive safe integer.`);return e}function A(e,t,n=[],a){e&&"object"==typeof e&&!Array.isArray(e)||Y("Expected an object.",t);const r=e;for(const e of n)e in r||Y(`Missing required property "${e}".`,`${t}.${e}`);if(a){const e=new Set(a);for(const n of Object.keys(r))e.has(n)||Y(`Unknown property "${n}".`,`${t}.${n}`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}return r}function b(e,t){return Array.isArray(e)||Y("Expected an array.",t),e}function x(e,t){const n=b(e,t);return 0===n.length&&Y("Expected at least one item.",t),n}function M(e,t,n=0){const a=b(e,t);return a.length<n&&Y(`Expected at least ${n} numeric value(s).`,t),Object.freeze(a.map((e,n)=>k(e,`${t}[${n}]`)))}function y(e,t){return S(e,t,2)}function T(e,t,n=-Number.MAX_VALUE,a=Number.MAX_VALUE){return S(e,t,3,n,a)}function O(e,t,n=-Number.MAX_VALUE,a=Number.MAX_VALUE){return S(e,t,4,n,a)}function S(e,t,n,a=-Number.MAX_VALUE,r=Number.MAX_VALUE){const i=b(e,t);return i.length!==n&&Y(`Expected exactly ${n} numbers.`,t),Object.freeze(i.map((e,n)=>C(e,`${t}[${n}]`,a,r)))}function E(e,t,n=-Number.MAX_VALUE){if(Array.isArray(e)){const a=S(e,t,2,n);return a[0]>a[1]&&Y("Range minimum cannot exceed maximum.",t),a}return C(e,t,n)}function k(e,t){return"number"==typeof e&&Number.isFinite(e)||Y("Expected a finite number.",t),e}function D(e,t){const n=k(e,t);return n<=0&&Y("Expected a positive number.",t),n}function z(e,t){const n=k(e,t);return n<0&&Y("Expected a non-negative number.",t),n}function C(e,t,n,a=Number.MAX_VALUE,r=!0){const i=k(e,t);return(i<n||(r?i>a:i>=a))&&Y(`Expected a number in ${r?"[":"("}${n}, ${a}${r?"]":")"}.`,t),i}function j(e,t,n,a){return("number"!=typeof e||!Number.isSafeInteger(e)||e<n||e>a)&&Y(`Expected a safe integer in [${n}, ${a}].`,t),e}function R(e,t){return"string"!=typeof e&&Y("Expected a string.",t),e}function w(e,t){const n=R(e,t);return 0===n.length&&Y("Expected a non-empty string.",t),n}function U(e,t){return"boolean"!=typeof e&&Y("Expected a boolean.",t),e}function F(e,t,n){return"string"==typeof e&&t.includes(e)||Y(`Expected one of ${t.join(", ")}.`,n),e}function P(e,t,n,a="E_ANIMATION_3D_INVALID_PAYLOAD"){e!==t&&Y(`Expected ${JSON.stringify(t)}.`,n,a)}function H(e,t,n,a){e.has(t)&&Y(`Duplicate ${a} id "${t}".`,n,"E_ANIMATION_3D_BINDING_MISMATCH"),e.add(t)}function B(e,t,n,a){e>t&&Y(`${n} count ${e} exceeds limit ${t}.`,a,"E_ANIMATION_3D_LIMIT_EXCEEDED")}function G(e,t,n){const a={};for(const r of n)void 0!==e[r]&&(a[r]=w(e[r],`${t}.${r}`));return a}function V(e,t,n=0){n>64&&B(n,64,"event payload depth",t);const a=A(e,t),r={};for(const[e,i]of Object.entries(a))r[e]=X(i,`${t}.${e}`,n+1);return Object.freeze(r)}function X(e,t,n){return null===e||"string"==typeof e||"boolean"==typeof e?e:"number"==typeof e?k(e,t):Array.isArray(e)?Object.freeze(e.map((e,a)=>X(e,`${t}[${a}]`,n+1))):V(e,t,n)}function L(e){const t=/^([a-z][a-z0-9+.-]*):/i.exec(e);return t?.[1]?.toLowerCase()??null}function q(e){if(e&&"object"==typeof e&&!Object.isFrozen(e)){for(const t of Object.values(e))q(t);Object.freeze(e)}return e}function Y(e,t,n="E_ANIMATION_3D_INVALID_PAYLOAD"){throw new o(n,e,t)}export{n as NATIVE_3D_ANIMATION_EXTENSION_ID,a as NATIVE_3D_ANIMATION_FORMAT,r as NATIVE_3D_CLIP_FORMAT,i as NATIVE_3D_STATE_MACHINE_FORMAT,o as Native3DAnimationFormatError,l as createNative3DAnimationExtensionHandler,p as parseNative3DAnimation,u as parseNative3DAnimationPayload};//# sourceMappingURL=native3d.js.map
|
|
1
|
+
import{A as e}from"./chunks/extensions-DxL4AxOC.js";import{p as t}from"./chunks/parser-DiexwIBc.js";import"./chunks/errors-Bzs3GOD9.js";import"./chunks/binary-Btol_e09.js";import"./chunks/expression-sAWA2ssN.js";const a="org.haiyue.animation-3d@1",n="haiyue-animation-3d@1",r="haiyue-animation3d-clip@1",i="haiyue-animation3d-state-machine@1";class o extends Error{code;path;name="Native3DAnimationFormatError";constructor(e,t,a){super(`${t} (${a})`),this.code=e,this.path=a}}const s=`$.extensions.${a}`,d=new Set(["model/gltf-binary","model/gltf+json"]),c=new Set(["blob","file","javascript"]),m=Object.freeze({maxMaterials:1e4,maxNodes:1e5,maxComponents:2e5,maxClips:1e4,maxTracks:2e5,maxKeyframes:5e6,maxParticleCapacity:2e6,maxStateMachineDepth:64});function l(e={},t){return Object.freeze({id:a,validateDocument(a){t?.(u(a,e))}})}function p(n,r={}){const i=new e;let m;i.register(l(r,e=>{m=e}));const p={..._(r),extensions:i,...void 0===r.copyFloatData?{}:{copyFloatData:r.copyFloatData}},u=t(n,p);if(!m)throw new o("E_ANIMATION_3D_INVALID_PAYLOAD",`Required extension "${a}" has no document payload.`,s);return function(e,t){1===e.extensionsUsed.length&&e.extensionsUsed[0]===a&&1===e.extensionsRequired.length&&e.extensionsRequired[0]===a||Y(`Native 3D carrier must use and require only "${a}".`,"$.extensionsRequired");e.nodes.length>0&&Y("Native 3D carrier cannot contain core 2D nodes.","$.nodes","E_ANIMATION_3D_MIXED_DIMENSIONS");e.tracks.length>0&&Y("Native 3D carrier cannot contain core 2D tracks.","$.tracks","E_ANIMATION_3D_MIXED_DIMENSIONS");e.canvas.width===t.viewport.width&&e.canvas.height===t.viewport.height||Y("Core canvas and native 3D viewport dimensions must match.",`${s}.viewport`);for(let a=0;a<t.nodes.length;a++){const n=t.nodes[a],r=n.start??0;(r>e.duration||r+(n.duration??e.duration-r)>e.duration+1e-6)&&Y("Node time range must fit inside composition duration.",`${s}.nodes[${a}]`)}for(let a=0;a<t.clips.length;a++)t.clips[a].duration>e.duration+1e-6&&Y("Clip duration must fit inside composition duration.",`${s}.clips[${a}].duration`)}(u,m),function(e,t){const a=new Map(e.map(e=>[e.id,e]));for(let t=0;t<e.length;t++){const a=L(e[t].uri);a&&c.has(a)&&Y(`Delivery URI scheme "${a}:" is forbidden.`,`$.resources[${t}].uri`,"E_ANIMATION_3D_UNKNOWN_RESOURCE")}for(let e=0;e<t.materials.length;e++){const n=t.materials[e];for(const t of["baseColorTexture","normalTexture","metallicRoughnessTexture","emissiveTexture"]){const r=n[t];if(void 0===r)continue;const i=a.get(r);i&&"image"===i.type||Y(`Material texture "${r}" must reference an image resource.`,`${s}.materials[${e}].${t}`,"E_ANIMATION_3D_UNKNOWN_RESOURCE")}}for(let e=0;e<t.nodes.length;e++){const n=t.nodes[e];for(let t=0;t<n.components.length;t++){const r=n.components[t],i=`${s}.nodes[${e}].components[${t}]`;if("model3d"===r.kind){const e=a.get(r.resource);e&&"binary"===e.type&&e.mimeType&&d.has(e.mimeType)||Y(`Model "${r.resource}" must reference a binary glTF/GLB resource.`,`${i}.resource`,"E_ANIMATION_3D_UNKNOWN_RESOURCE")}if("particle3d"===r.kind&&void 0!==r.descriptor.textureResource){const e=a.get(r.descriptor.textureResource);e&&"image"===e.type||Y(`Particle texture "${r.descriptor.textureResource}" must reference an image resource.`,`${i}.descriptor.textureResource`,"E_ANIMATION_3D_UNKNOWN_RESOURCE")}}}}(u.resources,m),Object.freeze({document:u,payload:m,resources:u.resources})}function u(e,t={}){const a=function(e){return Object.freeze({maxMaterials:v(e.maxMaterials,m.maxMaterials,"maxMaterials"),maxNodes:v(e.maxNodes,m.maxNodes,"maxNodes"),maxComponents:v(e.maxComponents,m.maxComponents,"maxComponents"),maxClips:v(e.maxClips,m.maxClips,"maxClips"),maxTracks:v(e.maxTracks,m.maxTracks,"maxTracks"),maxKeyframes:v(e.maxKeyframes,m.maxKeyframes,"maxKeyframes"),maxParticleCapacity:v(e.maxParticleCapacity,m.maxParticleCapacity,"maxParticleCapacity"),maxStateMachineDepth:v(e.maxStateMachineDepth,m.maxStateMachineDepth,"maxStateMachineDepth")})}(t),o=A(e,s,["format","mode","coordinateSystem","viewport","materials","nodes","clips"],["format","mode","coordinateSystem","viewport","materials","nodes","clips","stateMachine"]);P(o.format,n,`${s}.format`),P(o.mode,"native-3d",`${s}.mode`);const d=function(e,t){const a=A(e,t,["handedness","upAxis","forwardAxis","unit","angles","rotationStorage"],["handedness","upAxis","forwardAxis","unit","angles","rotationStorage"]);return P(a.handedness,"right",`${t}.handedness`),P(a.upAxis,"+y",`${t}.upAxis`),P(a.forwardAxis,"-z",`${t}.forwardAxis`),P(a.unit,"meter",`${t}.unit`),P(a.angles,"radian",`${t}.angles`),P(a.rotationStorage,"normalized-xyzw-quaternion",`${t}.rotationStorage`),Object.freeze({handedness:"right",upAxis:"+y",forwardAxis:"-z",unit:"meter",angles:"radian",rotationStorage:"normalized-xyzw-quaternion"})}(o.coordinateSystem,`${s}.coordinateSystem`),c=function(e,t){const a=A(e,t,["width","height"],["width","height"]);return Object.freeze({width:D(a.width,`${t}.width`),height:D(a.height,`${t}.height`)})}(o.viewport,`${s}.viewport`),l=b(o.materials,`${s}.materials`);B(l.length,a.maxMaterials,"materials",`${s}.materials`);const p=new Set,u=l.map((e,t)=>{const a=function(e,t){const a=A(e,t,["id","name","baseColorFactor","metallicFactor","roughnessFactor","emissiveFactor","alphaMode","doubleSided"],["id","name","baseColorFactor","metallicFactor","roughnessFactor","emissiveFactor","alphaMode","alphaCutoff","doubleSided","baseColorTexture","normalTexture","metallicRoughnessTexture","emissiveTexture"]);return Object.freeze({id:w(a.id,`${t}.id`),name:R(a.name,`${t}.name`),baseColorFactor:O(a.baseColorFactor,`${t}.baseColorFactor`,0,1),metallicFactor:C(a.metallicFactor,`${t}.metallicFactor`,0,1),roughnessFactor:C(a.roughnessFactor,`${t}.roughnessFactor`,0,1),emissiveFactor:T(a.emissiveFactor,`${t}.emissiveFactor`,0),alphaMode:F(a.alphaMode,["opaque","mask","blend"],`${t}.alphaMode`),...void 0===a.alphaCutoff?{}:{alphaCutoff:C(a.alphaCutoff,`${t}.alphaCutoff`,0,1)},doubleSided:U(a.doubleSided,`${t}.doubleSided`),...G(a,t,["baseColorTexture","normalTexture","metallicRoughnessTexture","emissiveTexture"])})}(e,`${s}.materials[${t}]`);return H(p,a.id,`${s}.materials[${t}].id`,"material"),a}),_=b(o.nodes,`${s}.nodes`);B(_.length,a.maxNodes,"nodes",`${s}.nodes`);const x=new Set,y=new Set;let S=0,E=0;const X=_.map((e,t)=>{const n=`${s}.nodes[${t}]`,r=function(e,t){const a=A(e,t,["id","name","transform","components"],["id","name","parent","start","duration","transform","components"]),n=b(a.components,`${t}.components`).map((e,a)=>function(e,t){const a=A(e,t).kind;if("camera3d"===a){const n=A(e,t,["id","kind","projection"],["id","kind","projection"]);return Object.freeze({id:w(n.id,`${t}.id`),kind:a,projection:f(n.projection,`${t}.projection`)})}if("primitive3d"===a){const n=A(e,t,["id","kind","primitive","materialId"],["id","kind","primitive","materialId"]);return Object.freeze({id:w(n.id,`${t}.id`),kind:a,primitive:F(n.primitive,["box","sphere","plane","cylinder","cone"],`${t}.primitive`),materialId:w(n.materialId,`${t}.materialId`)})}if("model3d"===a){const n=A(e,t,["id","kind","resource"],["id","kind","resource","materialOverrides"]),r=void 0===n.materialOverrides?void 0:b(n.materialOverrides,`${t}.materialOverrides`).map((e,a)=>{const n=`${t}.materialOverrides[${a}]`,r=A(e,n,["slot","materialId"],["slot","materialId"]);return Object.freeze({slot:w(r.slot,`${n}.slot`),materialId:w(r.materialId,`${n}.materialId`)})});return Object.freeze({id:w(n.id,`${t}.id`),kind:a,resource:w(n.resource,`${t}.resource`),...r?{materialOverrides:Object.freeze(r)}:{}})}if("particle3d"===a){const n=A(e,t,["id","kind","descriptor"],["id","kind","descriptor"]);return Object.freeze({id:w(n.id,`${t}.id`),kind:a,descriptor:h(n.descriptor,`${t}.descriptor`)})}Y(`Unsupported component kind "${String(a)}".`,`${t}.kind`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}(e,`${t}.components[${a}]`));return Object.freeze({id:w(a.id,`${t}.id`),name:R(a.name,`${t}.name`),...void 0===a.parent?{}:{parent:w(a.parent,`${t}.parent`)},...void 0===a.start?{}:{start:z(a.start,`${t}.start`)},...void 0===a.duration?{}:{duration:D(a.duration,`${t}.duration`)},transform:$(a.transform,`${t}.transform`),components:Object.freeze(n)})}(e,n);H(x,r.id,`${n}.id`,"node");for(let e=0;e<r.components.length;e++){const t=r.components[e];H(y,t.id,`${n}.components[${e}].id`,"component"),S++,"particle3d"===t.kind&&(E+=t.descriptor.maxParticles)}return B(S,a.maxComponents,"components",`${n}.components`),B(E,a.maxParticleCapacity,"particle capacity",`${n}.components`),r});!function(e,t,a){const n=new Map(e.map(e=>[e.id,e]));for(let n=0;n<e.length;n++){const r=e[n];void 0===r.parent||t.has(r.parent)||Y(`Node parent "${r.parent}" does not exist.`,`${s}.nodes[${n}].parent`,"E_ANIMATION_3D_BINDING_MISMATCH"),r.parent===r.id&&Y("Node cannot parent itself.",`${s}.nodes[${n}].parent`,"E_ANIMATION_3D_BINDING_MISMATCH");for(let e=0;e<r.components.length;e++){const t=r.components[e],i=`${s}.nodes[${n}].components[${e}]`;if("primitive3d"!==t.kind||a.has(t.materialId)||Y(`Primitive material "${t.materialId}" does not exist.`,`${i}.materialId`,"E_ANIMATION_3D_UNKNOWN_RESOURCE"),"model3d"===t.kind)for(let e=0;e<(t.materialOverrides?.length??0);e++){const n=t.materialOverrides[e].materialId;a.has(n)||Y(`Material override "${n}" does not exist.`,`${i}.materialOverrides[${e}].materialId`,"E_ANIMATION_3D_UNKNOWN_RESOURCE")}}}for(const t of e){const e=new Set;let a=t;for(;a?.parent;)e.has(a.id)&&Y("Node hierarchy contains a cycle.",`${s}.nodes`,"E_ANIMATION_3D_BINDING_MISMATCH"),e.add(a.id),a=n.get(a.parent)}}(X,x,p);const L=b(o.clips,`${s}.clips`);B(L.length,a.maxClips,"clips",`${s}.clips`);const K=new Set,W=new Set;let J=0,Q=0;const Z=L.map((e,t)=>{const n=`${s}.clips[${t}]`,i=function(e,t){const a=A(e,t,["format","id","name","duration","tracks","events"],["format","id","name","duration","tracks","events"]);P(a.format,r,`${t}.format`);const n=D(a.duration,`${t}.duration`),i=new Set,o=b(a.tracks,`${t}.tracks`).map((e,a)=>{const r=`${t}.tracks[${a}]`,o=function(e,t,a){const n=A(e,t,["id","binding","interpolation","times","values"],["id","binding","interpolation","times","values"]),r=function(e,t){const a=A(e,t),n=function(e,t){const a=A(e,t).kind;if("node-id"===a){const n=A(e,t,["kind","nodeId"],["kind","nodeId"]);return Object.freeze({kind:a,nodeId:w(n.nodeId,`${t}.nodeId`)})}if("node-path"===a){const n=b(A(e,t,["kind","segments"],["kind","segments"]).segments,`${t}.segments`);return 0===n.length&&Y("Node path must contain at least one segment.",`${t}.segments`),Object.freeze({kind:a,segments:Object.freeze(n.map((e,a)=>w(e,`${t}.segments[${a}]`)))})}if("slot"===a){const n=A(e,t,["kind","slot"],["kind","slot"]);return Object.freeze({kind:a,slot:w(n.slot,`${t}.slot`)})}Y(`Unsupported binding target "${String(a)}".`,`${t}.kind`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}(a.target,`${t}.target`),r=w(a.id,`${t}.id`);if("transform.translation"===a.path||"transform.scale"===a.path){const i=A(e,t,["id","target","path","valueType","valueSize"],["id","target","path","valueType","valueSize"]);return P(i.valueType,"vec3",`${t}.valueType`),P(i.valueSize,3,`${t}.valueSize`,"E_ANIMATION_3D_BINDING_MISMATCH"),Object.freeze({id:r,target:n,path:a.path,valueType:"vec3",valueSize:3})}if("transform.rotation"===a.path){const i=A(e,t,["id","target","path","valueType","valueSize"],["id","target","path","valueType","valueSize"]);return P(i.valueType,"quaternion",`${t}.valueType`),P(i.valueSize,4,`${t}.valueSize`,"E_ANIMATION_3D_BINDING_MISMATCH"),Object.freeze({id:r,target:n,path:a.path,valueType:"quaternion",valueSize:4})}if("morph.weights"===a.path){const i=A(e,t,["id","target","path","valueType","valueSize"],["id","target","path","valueType","valueSize"]);return P(i.valueType,"weights",`${t}.valueType`),Object.freeze({id:r,target:n,path:a.path,valueType:"weights",valueSize:j(i.valueSize,`${t}.valueSize`,1,65536)})}if("property"===a.path){const a=A(e,t,["id","target","path","component","property","valueType","valueSize"],["id","target","path","component","property","valueType","valueSize"]),i=F(a.component,["material3d","camera3d"],`${t}.component`),o=F(a.property,["baseColorFactor","metallicFactor","roughnessFactor","emissiveFactor","alphaCutoff","fovYRadians","near","far","orthoHeight"],`${t}.property`),s=function(e,t,a){const n={baseColorFactor:["vec4",4],metallicFactor:["scalar",1],roughnessFactor:["scalar",1],emissiveFactor:["vec3",3],alphaCutoff:["scalar",1]},r={fovYRadians:["scalar",1],near:["scalar",1],far:["scalar",1],orthoHeight:["scalar",1]},i="material3d"===e?n[t]:r[t];i||Y(`Property "${t}" is not valid for ${e}.`,a,"E_ANIMATION_3D_BINDING_MISMATCH");return{valueType:i[0],valueSize:i[1]}}(i,o,`${t}.property`);return P(a.valueType,s.valueType,`${t}.valueType`,"E_ANIMATION_3D_BINDING_MISMATCH"),P(a.valueSize,s.valueSize,`${t}.valueSize`,"E_ANIMATION_3D_BINDING_MISMATCH"),Object.freeze({id:r,target:n,path:"property",component:i,property:o,...s})}Y(`Unsupported binding path "${String(a.path)}".`,`${t}.path`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}(n.binding,`${t}.binding`),i=F(n.interpolation,["step","linear","cubic-spline"],`${t}.interpolation`),o=M(n.times,`${t}.times`,1);for(let e=0;e<o.length;e++){const n=o[e];(n<0||n>a)&&Y("Track time must lie within clip duration.",`${t}.times[${e}]`,"E_ANIMATION_3D_BINDING_MISMATCH"),e>0&&n<=o[e-1]&&Y("Track times must be strictly increasing.",`${t}.times[${e}]`,"E_ANIMATION_3D_BINDING_MISMATCH")}const s=M(n.values,`${t}.values`,1),d=o.length*r.valueSize*("cubic-spline"===i?3:1);s.length!==d&&Y(`Track values length ${s.length} does not match expected ${d}.`,`${t}.values`,"E_ANIMATION_3D_BINDING_MISMATCH");"transform.rotation"===r.path&&function(e,t,a,n){const r="cubic-spline"===a?12:4,i="cubic-spline"===a?4:0;for(let a=0;a<t;a++)g(e.slice(a*r+i,a*r+i+4),`${n}[${a*r+i}]`)}(s,o.length,i,`${t}.values`);return Object.freeze({id:w(n.id,`${t}.id`),binding:r,interpolation:i,times:o,values:s})}(e,r,n);return H(i,o.id,`${r}.id`,"track"),o}),s=new Set,d=b(a.events,`${t}.events`).map((e,a)=>{const r=`${t}.events[${a}]`,i=function(e,t,a){const n=A(e,t,["id","time","name"],["id","time","name","payload"]),r=z(n.time,`${t}.time`);r>a&&Y("Event time must lie within clip duration.",`${t}.time`);return Object.freeze({id:w(n.id,`${t}.id`),time:r,name:w(n.name,`${t}.name`),...void 0===n.payload?{}:{payload:V(n.payload,`${t}.payload`)}})}(e,r,n);return H(s,i.id,`${r}.id`,"event"),i});return Object.freeze({format:r,id:w(a.id,`${t}.id`),name:R(a.name,`${t}.name`),duration:n,tracks:Object.freeze(o),events:Object.freeze(d)})}(e,n);H(K,i.id,`${n}.id`,"clip"),J+=i.tracks.length,Q+=i.tracks.reduce((e,t)=>e+t.times.length,0),B(J,a.maxTracks,"tracks",`${n}.tracks`),B(Q,a.maxKeyframes,"keyframes",`${n}.tracks`);const o=new Set;for(let e=0;e<i.tracks.length;e++){const t=i.tracks[e];H(o,t.binding.id,`${n}.tracks[${e}].binding.id`,"binding"),W.add(t.binding.id),N(t.binding,X,p,`${n}.tracks[${e}].binding`)}return i}),ee=void 0===o.stateMachine||null===o.stateMachine?o.stateMachine:function(e,t,a){const n=A(e,t,["format","id","name","parameters","layers"],["format","id","name","parameters","layers"]);P(n.format,i,`${t}.format`);const r=new Set,o=b(n.parameters,`${t}.parameters`).map((e,a)=>{const n=`${t}.parameters[${a}]`,i=function(e,t){const a=A(e,t),n=w(a.name,`${t}.name`);if("trigger"===a.type)return A(e,t,["name","type"],["name","type"]),Object.freeze({name:n,type:"trigger"});if(A(e,t,["name","type","defaultValue"],["name","type","defaultValue"]),"float"===a.type)return Object.freeze({name:n,type:"float",defaultValue:k(a.defaultValue,`${t}.defaultValue`)});if("integer"===a.type)return Object.freeze({name:n,type:"integer",defaultValue:j(a.defaultValue,`${t}.defaultValue`,Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)});if("boolean"===a.type)return Object.freeze({name:n,type:"boolean",defaultValue:U(a.defaultValue,`${t}.defaultValue`)});Y(`Unsupported parameter type "${String(a.type)}".`,`${t}.type`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}(e,n);return H(r,i.name,`${n}.name`,"state-machine parameter"),i}),s=new Set,d=b(n.layers,`${t}.layers`).map((e,n)=>{const r=`${t}.layers[${n}]`,i=function(e,t,a){const n=A(e,t,["id","name","initialStateId","states","transitions"],["id","name","initialStateId","states","transitions","blendMode","weight","mask"]),r=new Set,i=b(n.states,`${t}.states`).map((e,n)=>{const i=`${t}.states[${n}]`,o=function(e,t,a){const n=A(e,t,["id","name","motion"],["id","name","motion","speed","speedParameter","loop"]);return Object.freeze({id:w(n.id,`${t}.id`),name:R(n.name,`${t}.name`),motion:I(n.motion,`${t}.motion`,0,a),...void 0===n.speed?{}:{speed:k(n.speed,`${t}.speed`)},...void 0===n.speedParameter?{}:{speedParameter:w(n.speedParameter,`${t}.speedParameter`)},...void 0===n.loop?{}:{loop:F(n.loop,["once","repeat","ping-pong"],`${t}.loop`)}})}(e,i,a);return H(r,o.id,`${i}.id`,"state"),o}),o=new Set,s=b(n.transitions,`${t}.transitions`).map((e,a)=>{const n=`${t}.transitions[${a}]`,r=function(e,t){const a=A(e,t,["id","from","to","conditions","duration"],["id","from","to","conditions","duration","hasExitTime","exitTime","destinationOffset","interruption"]),n=b(a.conditions,`${t}.conditions`).map((e,a)=>function(e,t){const a=A(e,t,["parameter","operator"],["parameter","operator","value"]),n=F(a.operator,["greater","greater-or-equal","less","less-or-equal","equal","not-equal","is-true","is-false","triggered"],`${t}.operator`);return Object.freeze({parameter:w(a.parameter,`${t}.parameter`),operator:n,...void 0===a.value?{}:{value:"boolean"==typeof a.value?a.value:k(a.value,`${t}.value`)}})}(e,`${t}.conditions[${a}]`));return Object.freeze({id:w(a.id,`${t}.id`),from:w(a.from,`${t}.from`),to:w(a.to,`${t}.to`),conditions:Object.freeze(n),duration:z(a.duration,`${t}.duration`),...void 0===a.hasExitTime?{}:{hasExitTime:U(a.hasExitTime,`${t}.hasExitTime`)},...void 0===a.exitTime?{}:{exitTime:z(a.exitTime,`${t}.exitTime`)},...void 0===a.destinationOffset?{}:{destinationOffset:z(a.destinationOffset,`${t}.destinationOffset`)},...void 0===a.interruption?{}:{interruption:F(a.interruption,["none","source","destination","source-then-destination","destination-then-source"],`${t}.interruption`)}})}(e,n);return H(o,r.id,`${n}.id`,"transition"),r}),d=void 0===n.mask?void 0:function(e,t){const a=A(e,t,[],["include","exclude"]),n=(e,t)=>{const a=new Set;return Object.freeze(b(e,t).map((e,n)=>{const r=w(e,`${t}[${n}]`);return H(a,r,`${t}[${n}]`,"mask binding"),r}))};return Object.freeze({...void 0===a.include?{}:{include:n(a.include,`${t}.include`)},...void 0===a.exclude?{}:{exclude:n(a.exclude,`${t}.exclude`)}})}(n.mask,`${t}.mask`);return Object.freeze({id:w(n.id,`${t}.id`),name:R(n.name,`${t}.name`),initialStateId:w(n.initialStateId,`${t}.initialStateId`),states:Object.freeze(i),transitions:Object.freeze(s),...void 0===n.blendMode?{}:{blendMode:F(n.blendMode,["override","additive"],`${t}.blendMode`)},...void 0===n.weight?{}:{weight:C(n.weight,`${t}.weight`,0,1)},...d?{mask:d}:{}})}(e,r,a);return H(s,i.id,`${r}.id`,"state-machine layer"),i});return Object.freeze({format:i,id:w(n.id,`${t}.id`),name:R(n.name,`${t}.name`),parameters:Object.freeze(o),layers:Object.freeze(d)})}(o.stateMachine,`${s}.stateMachine`,a.maxStateMachineDepth);return ee&&function(e,t,a,n){const r=new Set(e.parameters.map(e=>e.name)),i=(e,a)=>{if("clip"!==e.kind)for(let t=0;t<e.children.length;t++)i(e.children[t].motion,`${a}.children[${t}].motion`);else t.has(e.clipId)||Y(`Motion clip "${e.clipId}" does not exist.`,`${a}.clipId`,"E_ANIMATION_3D_BINDING_MISMATCH")};for(let t=0;t<e.layers.length;t++){const o=e.layers[t],s=`${n}.layers[${t}]`,d=new Set(o.states.map(e=>e.id));d.has(o.initialStateId)||Y(`Initial state "${o.initialStateId}" does not exist.`,`${s}.initialStateId`,"E_ANIMATION_3D_BINDING_MISMATCH");for(let e=0;e<o.states.length;e++){const t=o.states[e];i(t.motion,`${s}.states[${e}].motion`),t.speedParameter&&!r.has(t.speedParameter)&&Y(`Speed parameter "${t.speedParameter}" does not exist.`,`${s}.states[${e}].speedParameter`,"E_ANIMATION_3D_BINDING_MISMATCH")}for(let e=0;e<o.transitions.length;e++){const t=o.transitions[e],a=`${s}.transitions[${e}]`;"*"===t.from||d.has(t.from)||Y(`Transition source "${t.from}" does not exist.`,`${a}.from`,"E_ANIMATION_3D_BINDING_MISMATCH"),d.has(t.to)||Y(`Transition destination "${t.to}" does not exist.`,`${a}.to`,"E_ANIMATION_3D_BINDING_MISMATCH");for(let e=0;e<t.conditions.length;e++)r.has(t.conditions[e].parameter)||Y(`Condition parameter "${t.conditions[e].parameter}" does not exist.`,`${a}.conditions[${e}].parameter`,"E_ANIMATION_3D_BINDING_MISMATCH")}for(const[e,t]of[["include",o.mask?.include],["exclude",o.mask?.exclude]])for(let n=0;n<(t?.length??0);n++)a.has(t[n])||Y(`Mask binding "${t[n]}" does not exist.`,`${s}.mask.${e}[${n}]`,"E_ANIMATION_3D_BINDING_MISMATCH")}}(ee,K,W,`${s}.stateMachine`),q({format:n,mode:"native-3d",coordinateSystem:d,viewport:c,materials:u,nodes:X,clips:Z,...void 0===o.stateMachine?{}:{stateMachine:ee??null}})}function $(e,t){const a=A(e,t,["translation","rotation","scale"],["translation","rotation","scale"]),n=O(a.rotation,`${t}.rotation`);return g(n,`${t}.rotation`),Object.freeze({translation:T(a.translation,`${t}.translation`),rotation:n,scale:T(a.scale,`${t}.scale`)})}function f(e,t){const a=A(e,t).kind;if("perspective"===a){const n=A(e,t,["kind","fovYRadians","near","far"],["kind","fovYRadians","near","far"]),r=D(n.near,`${t}.near`),i=D(n.far,`${t}.far`);return i<=r&&Y("Camera far must be greater than near.",`${t}.far`),Object.freeze({kind:a,fovYRadians:C(n.fovYRadians,`${t}.fovYRadians`,Number.MIN_VALUE,Math.PI,!1),near:r,far:i})}if("orthographic"===a){const n=A(e,t,["kind","orthoHeight","near","far"],["kind","orthoHeight","near","far"]),r=z(n.near,`${t}.near`),i=D(n.far,`${t}.far`);return i<=r&&Y("Camera far must be greater than near.",`${t}.far`),Object.freeze({kind:a,orthoHeight:D(n.orthoHeight,`${t}.orthoHeight`),near:r,far:i})}Y(`Unsupported camera projection "${String(a)}".`,`${t}.kind`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}function h(e,t){const a=["maxParticles","emissionRate","burst","duration","loop","seed","lifetime","speed","direction","spread","gravity","startSize","endSize","rotation","angularVelocity","startColor","endColor","shape","blendMode","radial","opacity","depthTest","depthWrite","sortMode"],n=A(e,t,a,[...a,"shapeSize","shapeRadius","textureResource"]);return Object.freeze({maxParticles:j(n.maxParticles,`${t}.maxParticles`,1,1e6),emissionRate:z(n.emissionRate,`${t}.emissionRate`),burst:j(n.burst,`${t}.burst`,0,1e6),duration:D(n.duration,`${t}.duration`),loop:U(n.loop,`${t}.loop`),seed:j(n.seed,`${t}.seed`,Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),lifetime:E(n.lifetime,`${t}.lifetime`,0),speed:E(n.speed,`${t}.speed`),direction:T(n.direction,`${t}.direction`),spread:C(n.spread,`${t}.spread`,0,Math.PI),gravity:T(n.gravity,`${t}.gravity`),startSize:E(n.startSize,`${t}.startSize`,0),endSize:E(n.endSize,`${t}.endSize`,0),rotation:E(n.rotation,`${t}.rotation`),angularVelocity:E(n.angularVelocity,`${t}.angularVelocity`),startColor:O(n.startColor,`${t}.startColor`,0,1),endColor:O(n.endColor,`${t}.endColor`,0,1),shape:F(n.shape,["point","box","sphere"],`${t}.shape`),...void 0===n.shapeSize?{}:{shapeSize:T(n.shapeSize,`${t}.shapeSize`,0)},...void 0===n.shapeRadius?{}:{shapeRadius:z(n.shapeRadius,`${t}.shapeRadius`)},blendMode:F(n.blendMode,["normal","additive"],`${t}.blendMode`),...void 0===n.textureResource?{}:{textureResource:w(n.textureResource,`${t}.textureResource`)},radial:U(n.radial,`${t}.radial`),opacity:C(n.opacity,`${t}.opacity`,0,1),depthTest:U(n.depthTest,`${t}.depthTest`),depthWrite:U(n.depthWrite,`${t}.depthWrite`),sortMode:F(n.sortMode,["none","back-to-front"],`${t}.sortMode`)})}function I(e,t,a,n){a>=n&&B(a+1,n,"state-machine motion depth",t);const r=A(e,t);if("clip"===r.kind){const a=A(e,t,["kind","clipId"],["kind","clipId"]);return Object.freeze({kind:"clip",clipId:w(a.clipId,`${t}.clipId`)})}if("blend-1d"===r.kind){const r=A(e,t,["kind","parameter","children"],["kind","parameter","children"]),i=x(r.children,`${t}.children`).map((e,r)=>{const i=`${t}.children[${r}]`,o=A(e,i,["threshold","motion"],["threshold","motion"]);return Object.freeze({threshold:k(o.threshold,`${i}.threshold`),motion:I(o.motion,`${i}.motion`,a+1,n)})});return Object.freeze({kind:"blend-1d",parameter:w(r.parameter,`${t}.parameter`),children:Object.freeze(i)})}if("blend-2d"===r.kind){const r=A(e,t,["kind","algorithm","parameterX","parameterY","children"],["kind","algorithm","parameterX","parameterY","children"]),i=x(r.children,`${t}.children`).map((e,r)=>{const i=`${t}.children[${r}]`,o=A(e,i,["position","motion"],["position","motion"]);return Object.freeze({position:y(o.position,`${i}.position`),motion:I(o.motion,`${i}.motion`,a+1,n)})});return Object.freeze({kind:"blend-2d",algorithm:F(r.algorithm,["cartesian","directional"],`${t}.algorithm`),parameterX:w(r.parameterX,`${t}.parameterX`),parameterY:w(r.parameterY,`${t}.parameterY`),children:Object.freeze(i)})}Y(`Unsupported motion kind "${String(r.kind)}".`,`${t}.kind`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}function N(e,t,a,n){const r=new Map(t.map(e=>[e.id,e])),i=e.target;"node-id"!==i.kind||r.has(i.nodeId)||Y(`Binding node "${i.nodeId}" does not exist.`,`${n}.target.nodeId`,"E_ANIMATION_3D_BINDING_MISMATCH"),"node-path"!==i.kind||r.has(i.segments[0])||Y(`Binding node path root "${i.segments[0]}" does not exist.`,`${n}.target.segments[0]`,"E_ANIMATION_3D_BINDING_MISMATCH"),"property"===e.path&&"material3d"===e.component&&("slot"===i.kind&&a.has(i.slot)||Y("Material property bindings require a material-id slot target.",`${n}.target`,"E_ANIMATION_3D_BINDING_MISMATCH")),"property"===e.path&&"camera3d"===e.component&&("node-id"===i.kind&&r.get(i.nodeId)?.components.some(e=>"camera3d"===e.kind)||Y("Camera property bindings require a node-id target with Camera3D.",`${n}.target`,"E_ANIMATION_3D_BINDING_MISMATCH"))}function g(e,t){const a=Math.hypot(...e);Math.abs(a-1)>1e-4&&Y("Quaternion must be normalized XYZW.",t,"E_ANIMATION_3D_BINDING_MISMATCH")}function _(e){const t=["maxInputBytes","maxMetadataBytes","maxNodes","maxComponents","maxTracks","maxKeyframes","maxResources","maxPathValues","maxTextCharacters","maxParticleCapacity"],a={};for(const n of t)void 0!==e[n]&&(a[n]=e[n]);return a}function v(e,t,a){if(void 0===e)return t;if(!Number.isSafeInteger(e)||e<=0)throw new RangeError(`${a} must be a positive safe integer.`);return e}function A(e,t,a=[],n){e&&"object"==typeof e&&!Array.isArray(e)||Y("Expected an object.",t);const r=e;for(const e of a)e in r||Y(`Missing required property "${e}".`,`${t}.${e}`);if(n){const e=new Set(n);for(const a of Object.keys(r))e.has(a)||Y(`Unknown property "${a}".`,`${t}.${a}`,"E_ANIMATION_3D_UNSUPPORTED_FEATURE")}return r}function b(e,t){return Array.isArray(e)||Y("Expected an array.",t),e}function x(e,t){const a=b(e,t);return 0===a.length&&Y("Expected at least one item.",t),a}function M(e,t,a=0){const n=b(e,t);return n.length<a&&Y(`Expected at least ${a} numeric value(s).`,t),Object.freeze(n.map((e,a)=>k(e,`${t}[${a}]`)))}function y(e,t){return S(e,t,2)}function T(e,t,a=-Number.MAX_VALUE,n=Number.MAX_VALUE){return S(e,t,3,a,n)}function O(e,t,a=-Number.MAX_VALUE,n=Number.MAX_VALUE){return S(e,t,4,a,n)}function S(e,t,a,n=-Number.MAX_VALUE,r=Number.MAX_VALUE){const i=b(e,t);return i.length!==a&&Y(`Expected exactly ${a} numbers.`,t),Object.freeze(i.map((e,a)=>C(e,`${t}[${a}]`,n,r)))}function E(e,t,a=-Number.MAX_VALUE){if(Array.isArray(e)){const n=S(e,t,2,a);return n[0]>n[1]&&Y("Range minimum cannot exceed maximum.",t),n}return C(e,t,a)}function k(e,t){return"number"==typeof e&&Number.isFinite(e)||Y("Expected a finite number.",t),e}function D(e,t){const a=k(e,t);return a<=0&&Y("Expected a positive number.",t),a}function z(e,t){const a=k(e,t);return a<0&&Y("Expected a non-negative number.",t),a}function C(e,t,a,n=Number.MAX_VALUE,r=!0){const i=k(e,t);return(i<a||(r?i>n:i>=n))&&Y(`Expected a number in ${r?"[":"("}${a}, ${n}${r?"]":")"}.`,t),i}function j(e,t,a,n){return("number"!=typeof e||!Number.isSafeInteger(e)||e<a||e>n)&&Y(`Expected a safe integer in [${a}, ${n}].`,t),e}function R(e,t){return"string"!=typeof e&&Y("Expected a string.",t),e}function w(e,t){const a=R(e,t);return 0===a.length&&Y("Expected a non-empty string.",t),a}function U(e,t){return"boolean"!=typeof e&&Y("Expected a boolean.",t),e}function F(e,t,a){return"string"==typeof e&&t.includes(e)||Y(`Expected one of ${t.join(", ")}.`,a),e}function P(e,t,a,n="E_ANIMATION_3D_INVALID_PAYLOAD"){e!==t&&Y(`Expected ${JSON.stringify(t)}.`,a,n)}function H(e,t,a,n){e.has(t)&&Y(`Duplicate ${n} id "${t}".`,a,"E_ANIMATION_3D_BINDING_MISMATCH"),e.add(t)}function B(e,t,a,n){e>t&&Y(`${a} count ${e} exceeds limit ${t}.`,n,"E_ANIMATION_3D_LIMIT_EXCEEDED")}function G(e,t,a){const n={};for(const r of a)void 0!==e[r]&&(n[r]=w(e[r],`${t}.${r}`));return n}function V(e,t,a=0){a>64&&B(a,64,"event payload depth",t);const n=A(e,t),r={};for(const[e,i]of Object.entries(n))r[e]=X(i,`${t}.${e}`,a+1);return Object.freeze(r)}function X(e,t,a){return null===e||"string"==typeof e||"boolean"==typeof e?e:"number"==typeof e?k(e,t):Array.isArray(e)?Object.freeze(e.map((e,n)=>X(e,`${t}[${n}]`,a+1))):V(e,t,a)}function L(e){const t=/^([a-z][a-z0-9+.-]*):/i.exec(e);return t?.[1]?.toLowerCase()??null}function q(e){if(e&&"object"==typeof e&&!Object.isFrozen(e)){for(const t of Object.values(e))q(t);Object.freeze(e)}return e}function Y(e,t,a="E_ANIMATION_3D_INVALID_PAYLOAD"){throw new o(a,e,t)}export{a as NATIVE_3D_ANIMATION_EXTENSION_ID,n as NATIVE_3D_ANIMATION_FORMAT,r as NATIVE_3D_CLIP_FORMAT,i as NATIVE_3D_STATE_MACHINE_FORMAT,o as Native3DAnimationFormatError,l as createNative3DAnimationExtensionHandler,p as parseNative3DAnimation,u as parseNative3DAnimationPayload};//# sourceMappingURL=native3d.js.map
|
package/dist/shared.d.ts
CHANGED
|
@@ -214,6 +214,18 @@ interface AnimationSafeExpressionContext {
|
|
|
214
214
|
declare function evaluateSafeExpression(program: Readonly<AnimationSafeExpressionProgram>, context: Readonly<AnimationSafeExpressionContext>): string;
|
|
215
215
|
declare function safeExpressionDataResources(program: Readonly<AnimationSafeExpressionProgram>): readonly string[];
|
|
216
216
|
|
|
217
|
+
declare const ANIMATION_PROCEDURAL_RASTER_EXTENSION_ID: "org.haiyue.procedural-raster@1";
|
|
218
|
+
/** Sandboxed native software material. No image frames or authoring runtime are needed. */
|
|
219
|
+
interface AnimationProceduralRasterComponent {
|
|
220
|
+
readonly type: typeof ANIMATION_PROCEDURAL_RASTER_EXTENSION_ID;
|
|
221
|
+
readonly abi: 'wasm32-rgba-v1';
|
|
222
|
+
/** Base64 WASM algorithm; imports are closed pure math/abort, memory is at most 16 MiB. */
|
|
223
|
+
readonly module: string;
|
|
224
|
+
readonly size: readonly [number, number];
|
|
225
|
+
readonly position?: readonly [number, number];
|
|
226
|
+
readonly parameters: readonly number[];
|
|
227
|
+
readonly frameRate: number;
|
|
228
|
+
}
|
|
217
229
|
declare const ANIMATION_FORMAT: "haiyue-animation";
|
|
218
230
|
declare const ANIMATION_VERSION: "1.0";
|
|
219
231
|
declare const ANIMATION_MIME_TYPE: "application/vnd.haiyue.animation";
|
|
@@ -413,6 +425,8 @@ interface AnimationAudioComponent {
|
|
|
413
425
|
loop?: boolean;
|
|
414
426
|
startOffset?: number;
|
|
415
427
|
playbackRate?: number;
|
|
428
|
+
/** Buffer uses shared decoded audio; stream keeps the browser media element and encoded source. */
|
|
429
|
+
playbackProfile?: 'buffer' | 'stream';
|
|
416
430
|
}
|
|
417
431
|
interface AnimationExtensionComponent {
|
|
418
432
|
/** A namespaced component id such as `org.example.particle@1`. */
|
|
@@ -564,7 +578,7 @@ interface AnimationDropShadowEffect {
|
|
|
564
578
|
readonly blurTrack?: AnimationVectorValueTrack;
|
|
565
579
|
}
|
|
566
580
|
type AnimationLayerEffect = AnimationTintEffect | AnimationFillEffect | AnimationOpacityEffect | AnimationColorMatrixEffect | AnimationBlurEffect | AnimationDropShadowEffect;
|
|
567
|
-
type AnimationComponent = AnimationShape2DComponent | AnimationPath2DComponent | AnimationSprite2DComponent | AnimationText2DComponent | AnimationParticle2DComponent | AnimationAudioComponent | AnimationVectorShapeComponent | AnimationExtensionComponent;
|
|
581
|
+
type AnimationComponent = AnimationProceduralRasterComponent | AnimationShape2DComponent | AnimationPath2DComponent | AnimationSprite2DComponent | AnimationText2DComponent | AnimationParticle2DComponent | AnimationAudioComponent | AnimationVectorShapeComponent | AnimationExtensionComponent;
|
|
568
582
|
type AnimationCompositeKind = 'mask' | 'matte';
|
|
569
583
|
type AnimationCompositeMode = 'alpha' | 'alpha-inverted' | 'luma' | 'luma-inverted';
|
|
570
584
|
type AnimationCompositeOperation = 'add' | 'subtract' | 'intersect' | 'difference';
|
|
@@ -2425,6 +2439,67 @@ interface HyaStateMachineExtension {
|
|
|
2425
2439
|
/** Strictly validates and freezes the built-in HYA state-machine extension. */
|
|
2426
2440
|
declare function parseHyaStateMachineExtension(value: unknown, compositionDuration: number, path?: string): HyaStateMachineExtension;
|
|
2427
2441
|
|
|
2442
|
+
/** Canonical byte identity shared by animation, layout, audio and resource packs. */
|
|
2443
|
+
interface HyaResourceIntegrity {
|
|
2444
|
+
readonly algorithm: 'sha256';
|
|
2445
|
+
readonly digest: string;
|
|
2446
|
+
}
|
|
2447
|
+
type HyaResourceSource = Readonly<{
|
|
2448
|
+
kind: 'embedded';
|
|
2449
|
+
data: Uint8Array;
|
|
2450
|
+
integrity?: HyaResourceIntegrity;
|
|
2451
|
+
}> | Readonly<{
|
|
2452
|
+
kind: 'referenced';
|
|
2453
|
+
uri: string;
|
|
2454
|
+
integrity?: HyaResourceIntegrity;
|
|
2455
|
+
}> | Readonly<{
|
|
2456
|
+
kind: 'hosted';
|
|
2457
|
+
key: string;
|
|
2458
|
+
fallbackAsset?: string;
|
|
2459
|
+
integrity?: HyaResourceIntegrity;
|
|
2460
|
+
}>;
|
|
2461
|
+
interface HyaResourceDescriptor {
|
|
2462
|
+
readonly id: string;
|
|
2463
|
+
readonly kind: 'image' | 'audio' | 'binary';
|
|
2464
|
+
readonly mediaType?: string;
|
|
2465
|
+
readonly source: HyaResourceSource;
|
|
2466
|
+
}
|
|
2467
|
+
declare function encodeHyaBase64(bytes: Uint8Array): string;
|
|
2468
|
+
declare function decodeHyaBase64(value: string, maxBytes?: number): Uint8Array;
|
|
2469
|
+
declare function normalizeHyaResourceIntegrity(value: unknown): HyaResourceIntegrity;
|
|
2470
|
+
declare function hyaResourceIntegritySri(value: unknown): string;
|
|
2471
|
+
declare function decodeHyaDataUri(uri: string, maxBytes?: number): Readonly<{
|
|
2472
|
+
mediaType: string;
|
|
2473
|
+
bytes: Uint8Array;
|
|
2474
|
+
}>;
|
|
2475
|
+
declare function encodeHyaDataUri(bytes: Uint8Array, mediaType: string): string;
|
|
2476
|
+
declare function normalizeHyaResourceSource(value: unknown, maxBytes?: number): HyaResourceSource;
|
|
2477
|
+
declare function describeHyaResource(resource: Readonly<{
|
|
2478
|
+
id: string;
|
|
2479
|
+
type: 'image' | 'audio' | 'binary';
|
|
2480
|
+
uri: string;
|
|
2481
|
+
mimeType?: string;
|
|
2482
|
+
integrity?: string;
|
|
2483
|
+
}>): HyaResourceDescriptor;
|
|
2484
|
+
/** Synchronous, platform-neutral SHA-256; avoids a Node/DOM dependency in the codec. */
|
|
2485
|
+
declare function hyaResourceSha256(bytes: Uint8Array): string;
|
|
2486
|
+
|
|
2487
|
+
interface HyaResourcePackEntry {
|
|
2488
|
+
readonly id: string;
|
|
2489
|
+
readonly data: ArrayBuffer;
|
|
2490
|
+
}
|
|
2491
|
+
interface HyaResourcePack {
|
|
2492
|
+
readonly entries: readonly string[];
|
|
2493
|
+
readonly blobCount: number;
|
|
2494
|
+
readonly embeddedBytes: number;
|
|
2495
|
+
read(id: string): ArrayBuffer;
|
|
2496
|
+
}
|
|
2497
|
+
/** Self-contained library. Logical IDs are independent of content-addressed physical byte blobs. */
|
|
2498
|
+
declare function encodeHyaResourcePack(entries: readonly HyaResourcePackEntry[], options?: AnimationParseOptions): ArrayBuffer;
|
|
2499
|
+
declare function isHyaResourcePack(buffer: ArrayBuffer): boolean;
|
|
2500
|
+
/** Retains one bounded immutable snapshot; reading an entry reconstructs a standalone v3 HYA. */
|
|
2501
|
+
declare function decodeHyaResourcePack(input: ArrayBuffer, options?: AnimationParseOptions): HyaResourcePack;
|
|
2502
|
+
|
|
2428
2503
|
interface LottieConversionDiagnostic {
|
|
2429
2504
|
readonly severity: 'warning' | 'error';
|
|
2430
2505
|
readonly code: string;
|
|
@@ -2787,5 +2862,5 @@ declare function parseNative3DAnimation(source: Native3DAnimationSource, options
|
|
|
2787
2862
|
/** Validates and canonicalizes the extension before any runtime allocation. */
|
|
2788
2863
|
declare function parseNative3DAnimationPayload(value: unknown, options?: Native3DAnimationParseOptions): Native3DAnimationPayload;
|
|
2789
2864
|
|
|
2790
|
-
export { DEFORMABLE_MESH_2D_MAX_MASK_REFERENCES as $, CUBISM_CAPTURE_FRAME_OPERATIONS as C, CubismClipBakedAdapter as J, combineCubismCaptureClips as T, convertCubismCaptureToHya as U, listCubismModel3Motions as V, runCubismClipBakedConversion as W, sampleCubismMotion3 as X, DEFORMABLE_MESH_2D_DATA_FORMAT as Y, DEFORMABLE_MESH_2D_DATA_VERSION as Z, DEFORMABLE_MESH_2D_EXTENSION_ID as _, parseHyaInteraction as a$, createDeformableMesh2DFormatHandler as a7, createDeformableMesh2DFormatRegistry as a8, decodeDeformableMesh2DData as a9, InteractionDiagnostic as aF, LayoutDiagnostic as aI, SemanticsDiagnostic as aN, StateMachineV2Diagnostic as aQ, decodeResponsiveLayoutDocument as aS, encodeHyaComposition as aT, encodeResponsiveLayoutDocument as aU, isResponsiveLayoutBinary as aV, migrateHyaStateMachineV1 as aW, negotiateHyaComposition as aX, parseHyaAudioEvents as aY, parseHyaComposition as aZ, parseHyaDataBinding as a_, encodeDeformableMesh2DData as aa, isDeformableMesh2DBinary as ab, AudioEventDiagnostic as ac, DEFAULT_HYA_COMPOSITION_LIMITS as af, DataBindingDiagnostic as ag, HYA_COMPOSITION_FORMAT as ak, HYA_COMPOSITION_VERSION as al, HyaCompositionError as ap, parseHyaSemantics as b0, parseHyaStateMachineV2 as b1, parseResponsiveLayoutDocument as b2, ANIMATION_FILE_EXTENSION as b3, ANIMATION_FORMAT as b4, ANIMATION_MIME_TYPE as b5,
|
|
2791
|
-
export type { CubismCaptureConversionOptions as A, CubismCaptureConversionResult as B, CubismCaptureDiagnostic as D, CubismCaptureFrame as E, CubismCaptureSet as F, CubismCaptureSetOptions as G, CubismCaptureTexture as H, CubismCapturedDrawable as I, CubismClipBakedConversionOptions as K, CubismClipBakedRecipe as L, CubismClipBakedSource as M, CubismDrawableCapture as N, OfflineConversionAdapter as O, CubismModel3MotionReference as P, CubismMotion3 as Q, CubismMotion3Curve as R, CubismMotion3Sample as S, OfflineConversionAdapterContext as a, DeformableMesh2DBlendMode as a0, DeformableMesh2DComponent as a1, DeformableMesh2DDataSource as a2, DeformableMesh2DDrawableSource as a3, DeformableMesh2DParseLimits as a4, ParsedDeformableMesh2DData as a5, ParsedDeformableMesh2DDrawable as a6, HyaInteractionDocument as aA, HyaSemanticsDocument as aB, HyaStateMachineV1MigrationOptions as aC, HyaStateMachineV1MigrationResult as aD, HyaStateMachineV2Document as aE, InteractionDiagnosticCode as aG, InteractionParseOptions as aH, LayoutDiagnosticCode as aJ, LayoutParseOptions as aK, ParseStateMachineV2Options as aL, ResponsiveLayoutDocument as aM, SemanticsDiagnosticCode as aO, SemanticsParseOptions as aP, StateMachineV2DiagnosticCode as aR, AudioEventDiagnosticCode as ad, AudioEventParseOptions as ae, DataBindingDiagnosticCode as ah, DataBindingParseOptions as ai, DataValue as aj, HyaAudioEventDocument as am, HyaCompositionDiagnostic as an, HyaCompositionDocument as ao, HyaCompositionErrorCode as aq, HyaCompositionLimits as ar, HyaCompositionParseOptions as as, HyaCompositionParseResult as at, HyaCompositionPart as au, HyaCompositionPartValidator as av, HyaCompositionPlan as aw, HyaCompositionTarget as ax, HyaCompositionValue as ay, HyaDataBindingDocument as az, OfflineConversionArtifact as b,
|
|
2865
|
+
export { DEFORMABLE_MESH_2D_MAX_MASK_REFERENCES as $, CUBISM_CAPTURE_FRAME_OPERATIONS as C, CubismClipBakedAdapter as J, combineCubismCaptureClips as T, convertCubismCaptureToHya as U, listCubismModel3Motions as V, runCubismClipBakedConversion as W, sampleCubismMotion3 as X, DEFORMABLE_MESH_2D_DATA_FORMAT as Y, DEFORMABLE_MESH_2D_DATA_VERSION as Z, DEFORMABLE_MESH_2D_EXTENSION_ID as _, parseHyaInteraction as a$, createDeformableMesh2DFormatHandler as a7, createDeformableMesh2DFormatRegistry as a8, decodeDeformableMesh2DData as a9, InteractionDiagnostic as aF, LayoutDiagnostic as aI, SemanticsDiagnostic as aN, StateMachineV2Diagnostic as aQ, decodeResponsiveLayoutDocument as aS, encodeHyaComposition as aT, encodeResponsiveLayoutDocument as aU, isResponsiveLayoutBinary as aV, migrateHyaStateMachineV1 as aW, negotiateHyaComposition as aX, parseHyaAudioEvents as aY, parseHyaComposition as aZ, parseHyaDataBinding as a_, encodeDeformableMesh2DData as aa, isDeformableMesh2DBinary as ab, AudioEventDiagnostic as ac, DEFAULT_HYA_COMPOSITION_LIMITS as af, DataBindingDiagnostic as ag, HYA_COMPOSITION_FORMAT as ak, HYA_COMPOSITION_VERSION as al, HyaCompositionError as ap, parseHyaSemantics as b0, parseHyaStateMachineV2 as b1, parseResponsiveLayoutDocument as b2, ANIMATION_FILE_EXTENSION as b3, ANIMATION_FORMAT as b4, ANIMATION_MIME_TYPE as b5, ANIMATION_PROCEDURAL_RASTER_EXTENSION_ID as b6, ANIMATION_VECTOR_SHAPE_EXTENSION_ID as b7, ANIMATION_VERSION as b8, AnimationExtensionRegistry as bs, AnimationFormatError as bw, NATIVE_3D_ANIMATION_FORMAT as c$, HYA_SAFE_EXPRESSION_VERSION as c5, HYA_STATE_MACHINE_CHANNEL_REGISTRY as c6, HYA_STATE_MACHINE_EXTENSION_ID as c7, encodeAnimationBinary as cA, encodeHyaBase64 as cB, encodeHyaDataUri as cC, encodeHyaResourcePack as cD, evaluateSafeExpression as cE, extensionIdFromComponentType as cF, hyaResourceIntegritySri as cG, hyaResourceSha256 as cH, hyaStateMachineChannelCapability as cI, isAnimationBinary as cJ, isHyaResourcePack as cK, normalizeHyaResourceIntegrity as cL, normalizeHyaResourceSource as cM, parseAnimation as cN, parseHyaStateMachineExtension as cO, safeExpressionDataResources as cP, validateExtensionId as cQ, convertLottie as cX, convertLottieDocument as cY, inspectLottieFonts as cZ, NATIVE_3D_ANIMATION_EXTENSION_ID as c_, decodeAnimationBinary as cv, decodeHyaBase64 as cw, decodeHyaDataUri as cx, decodeHyaResourcePack as cy, describeHyaResource as cz, NATIVE_3D_CLIP_FORMAT as d0, NATIVE_3D_STATE_MACHINE_FORMAT as d1, Native3DAnimationFormatError as d3, createNative3DAnimationExtensionHandler as dD, parseNative3DAnimation as dE, parseNative3DAnimationPayload as dF, OfflineConversionError as f, runOfflineConversion as r, stableStringify as s, CUBISM_CLIP_BAKED_UPDATE_ORDER as t, CUBISM_DRAWABLE_CAPTURE_FORMAT as u, CUBISM_DRAWABLE_CAPTURE_VERSION as v, CubismCaptureConversionError as z };
|
|
2866
|
+
export type { CubismCaptureConversionOptions as A, CubismCaptureConversionResult as B, CubismCaptureDiagnostic as D, CubismCaptureFrame as E, CubismCaptureSet as F, CubismCaptureSetOptions as G, CubismCaptureTexture as H, CubismCapturedDrawable as I, CubismClipBakedConversionOptions as K, CubismClipBakedRecipe as L, CubismClipBakedSource as M, CubismDrawableCapture as N, OfflineConversionAdapter as O, CubismModel3MotionReference as P, CubismMotion3 as Q, CubismMotion3Curve as R, CubismMotion3Sample as S, OfflineConversionAdapterContext as a, DeformableMesh2DBlendMode as a0, DeformableMesh2DComponent as a1, DeformableMesh2DDataSource as a2, DeformableMesh2DDrawableSource as a3, DeformableMesh2DParseLimits as a4, ParsedDeformableMesh2DData as a5, ParsedDeformableMesh2DDrawable as a6, HyaInteractionDocument as aA, HyaSemanticsDocument as aB, HyaStateMachineV1MigrationOptions as aC, HyaStateMachineV1MigrationResult as aD, HyaStateMachineV2Document as aE, InteractionDiagnosticCode as aG, InteractionParseOptions as aH, LayoutDiagnosticCode as aJ, LayoutParseOptions as aK, ParseStateMachineV2Options as aL, ResponsiveLayoutDocument as aM, SemanticsDiagnosticCode as aO, SemanticsParseOptions as aP, StateMachineV2DiagnosticCode as aR, AudioEventDiagnosticCode as ad, AudioEventParseOptions as ae, DataBindingDiagnosticCode as ah, DataBindingParseOptions as ai, DataValue as aj, HyaAudioEventDocument as am, HyaCompositionDiagnostic as an, HyaCompositionDocument as ao, HyaCompositionErrorCode as aq, HyaCompositionLimits as ar, HyaCompositionParseOptions as as, HyaCompositionParseResult as at, HyaCompositionPart as au, HyaCompositionPartValidator as av, HyaCompositionPlan as aw, HyaCompositionTarget as ax, HyaCompositionValue as ay, HyaDataBindingDocument as az, OfflineConversionArtifact as b, AnimationVectorFeather as b$, AnimationAudioComponent as b9, AnimationLayerEffect as bA, AnimationNode as bB, AnimationOpacityEffect as bC, AnimationParseLimits as bD, AnimationParseOptions as bE, AnimationParticle2DComponent as bF, AnimationPath2DComponent as bG, AnimationPathCommand as bH, AnimationProceduralRasterComponent as bI, AnimationResource as bJ, AnimationSafeExpressionContext as bK, AnimationSafeExpressionInstruction as bL, AnimationSafeExpressionProgram as bM, AnimationShape2DComponent as bN, AnimationSource as bO, AnimationSprite2DComponent as bP, AnimationText2DComponent as bQ, AnimationTextAnimator as bR, AnimationTextDocumentKeyframe as bS, AnimationTextRangeSelector as bT, AnimationTextSelectorShape as bU, AnimationTextSelectorUnits as bV, AnimationTextStyleRun as bW, AnimationTintEffect as bX, AnimationTrack as bY, AnimationTrackProperty as bZ, AnimationTransform2D as b_, AnimationAudioResource as ba, AnimationBinaryResource as bb, AnimationBlurEffect as bc, AnimationCanvas as bd, AnimationColorMatrixEffect as be, AnimationComponent as bf, AnimationComposite as bg, AnimationCompositeKind as bh, AnimationCompositeLayer as bi, AnimationCompositeMode as bj, AnimationCompositeOperation as bk, AnimationCompositeStack as bl, AnimationCoordinateSystem as bm, AnimationDocument as bn, AnimationDropShadowEffect as bo, AnimationEndBehavior as bp, AnimationExtensionComponent as bq, AnimationExtensionHandler as br, AnimationExtensionValidationContext as bt, AnimationFillEffect as bu, AnimationFillRule as bv, AnimationFormatErrorCode as bx, AnimationImageResource as by, AnimationInterpolation as bz, OfflineConversionAssetRequest as c, AnimationVectorGradientPaint as c0, AnimationVectorShapeComponent as c1, AnimationVectorSolidPaint as c2, AnimationVectorStrokePaint as c3, AnimationVectorValueTrack as c4, HyaAnimationClipRange as c8, HyaResourceDescriptor as c9, LottieConversionDiagnostic as cR, LottieConversionOptions as cS, LottieConversionResult as cT, LottieFontMetrics as cU, LottieFontRequirement as cV, LottieWebFontMapping as cW, HyaResourceIntegrity as ca, HyaResourcePack as cb, HyaResourcePackEntry as cc, HyaResourceSource as cd, HyaStateMachineBindingMask as ce, HyaStateMachineBlendMode as cf, HyaStateMachineChannelCapability as cg, HyaStateMachineChannelId as ch, HyaStateMachineChannelKind as ci, HyaStateMachineChannelSupport as cj, HyaStateMachineCondition as ck, HyaStateMachineDefinition as cl, HyaStateMachineExtension as cm, HyaStateMachineLayer as cn, HyaStateMachineLoopMode as co, HyaStateMachineMotion as cp, HyaStateMachineParameter as cq, HyaStateMachineState as cr, HyaStateMachineTransition as cs, ParsedAnimation as ct, ParsedAnimationTrack as cu, OfflineConversionDiagnostic as d, Native3DAnimationDiagnosticCode as d2, Native3DAnimationParseOptions as d4, Native3DAnimationPayload as d5, Native3DAnimationSource as d6, Native3DBinding as d7, Native3DBindingTarget as d8, Native3DCameraComponent as d9, Native3DVec4 as dA, Native3DViewport as dB, ParsedNative3DAnimation as dC, Native3DCameraProjection as da, Native3DClip as db, Native3DComponent as dc, Native3DCoordinateSystem as dd, Native3DEvent as de, Native3DMaterial as df, Native3DModelComponent as dg, Native3DNode as dh, Native3DParseLimits as di, Native3DParticleComponent as dj, Native3DParticleDescriptor as dk, Native3DPrimitiveComponent as dl, Native3DQuaternion as dm, Native3DScalarRange as dn, Native3DStateMachine as dp, Native3DStateMachineCondition as dq, Native3DStateMachineLayer as dr, Native3DStateMachineMotion as ds, Native3DStateMachineParameter as dt, Native3DStateMachineState as du, Native3DStateMachineTransition as dv, Native3DTrack as dw, Native3DTransform as dx, Native3DVec2 as dy, Native3DVec3 as dz, OfflineConversionEncodeInput as e, OfflineConversionFrameOperations as g, OfflineConversionHost as h, OfflineConversionMode as i, OfflineConversionPipelineOptions as j, OfflineConversionPipelineResult as k, OfflineConversionRecipe as l, OfflineConversionReport as m, OfflineConversionResolvedAsset as n, OfflineConversionSamplingOptions as o, OfflineConversionSession as p, OfflineConversionTransaction as q, CubismBuildTimeEvaluator as w, CubismCaptureClipInput as x, CubismCaptureClipRange as y };
|
package/package.json
CHANGED
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
"required": true,
|
|
9
9
|
"carrierFormat": "haiyue-animation",
|
|
10
10
|
"carrierVersion": "1.0",
|
|
11
|
-
"binaryWriteVersion":
|
|
12
|
-
"binaryReadVersions": [
|
|
11
|
+
"binaryWriteVersion": 3,
|
|
12
|
+
"binaryReadVersions": [
|
|
13
|
+
3
|
|
14
|
+
],
|
|
13
15
|
"coreNodesPolicy": "must-be-empty",
|
|
14
16
|
"coreTracksPolicy": "must-be-empty"
|
|
15
17
|
},
|
|
@@ -52,7 +54,11 @@
|
|
|
52
54
|
"engineRootExportChange": false
|
|
53
55
|
},
|
|
54
56
|
"bindings": {
|
|
55
|
-
"targets": [
|
|
57
|
+
"targets": [
|
|
58
|
+
"node-id",
|
|
59
|
+
"node-path",
|
|
60
|
+
"slot"
|
|
61
|
+
],
|
|
56
62
|
"paths": [
|
|
57
63
|
"transform.translation",
|
|
58
64
|
"transform.rotation",
|
|
@@ -60,28 +66,70 @@
|
|
|
60
66
|
"morph.weights",
|
|
61
67
|
"property"
|
|
62
68
|
],
|
|
63
|
-
"interpolations": [
|
|
69
|
+
"interpolations": [
|
|
70
|
+
"step",
|
|
71
|
+
"linear",
|
|
72
|
+
"cubic-spline"
|
|
73
|
+
],
|
|
64
74
|
"materialComponent": "material3d",
|
|
65
75
|
"materialProperties": {
|
|
66
|
-
"baseColorFactor": {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
76
|
+
"baseColorFactor": {
|
|
77
|
+
"valueType": "vec4",
|
|
78
|
+
"valueSize": 4
|
|
79
|
+
},
|
|
80
|
+
"metallicFactor": {
|
|
81
|
+
"valueType": "scalar",
|
|
82
|
+
"valueSize": 1
|
|
83
|
+
},
|
|
84
|
+
"roughnessFactor": {
|
|
85
|
+
"valueType": "scalar",
|
|
86
|
+
"valueSize": 1
|
|
87
|
+
},
|
|
88
|
+
"emissiveFactor": {
|
|
89
|
+
"valueType": "vec3",
|
|
90
|
+
"valueSize": 3
|
|
91
|
+
},
|
|
92
|
+
"alphaCutoff": {
|
|
93
|
+
"valueType": "scalar",
|
|
94
|
+
"valueSize": 1
|
|
95
|
+
}
|
|
71
96
|
},
|
|
72
97
|
"cameraComponent": "camera3d",
|
|
73
98
|
"cameraProperties": {
|
|
74
|
-
"fovYRadians": {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
99
|
+
"fovYRadians": {
|
|
100
|
+
"valueType": "scalar",
|
|
101
|
+
"valueSize": 1
|
|
102
|
+
},
|
|
103
|
+
"near": {
|
|
104
|
+
"valueType": "scalar",
|
|
105
|
+
"valueSize": 1
|
|
106
|
+
},
|
|
107
|
+
"far": {
|
|
108
|
+
"valueType": "scalar",
|
|
109
|
+
"valueSize": 1
|
|
110
|
+
},
|
|
111
|
+
"orthoHeight": {
|
|
112
|
+
"valueType": "scalar",
|
|
113
|
+
"valueSize": 1
|
|
114
|
+
}
|
|
78
115
|
}
|
|
79
116
|
},
|
|
80
117
|
"resources": {
|
|
81
118
|
"modelCoreType": "binary",
|
|
82
|
-
"modelMimeTypes": [
|
|
83
|
-
|
|
84
|
-
|
|
119
|
+
"modelMimeTypes": [
|
|
120
|
+
"model/gltf-binary",
|
|
121
|
+
"model/gltf+json"
|
|
122
|
+
],
|
|
123
|
+
"deliveryUriSchemes": [
|
|
124
|
+
"package-relative",
|
|
125
|
+
"https",
|
|
126
|
+
"data"
|
|
127
|
+
],
|
|
128
|
+
"forbiddenDeliveryUriSchemes": [
|
|
129
|
+
"blob",
|
|
130
|
+
"file",
|
|
131
|
+
"javascript"
|
|
132
|
+
],
|
|
85
133
|
"packageAssetPath": "assets/<sha256>.<ext>",
|
|
86
134
|
"packageManifest": "manifest.json",
|
|
87
135
|
"packageDeterministic": true,
|
|
@@ -114,17 +162,65 @@
|
|
|
114
162
|
}
|
|
115
163
|
],
|
|
116
164
|
"diagnostics": [
|
|
117
|
-
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
|
|
165
|
+
{
|
|
166
|
+
"code": "E_ANIMATION_INVALID_BINARY",
|
|
167
|
+
"path": "$",
|
|
168
|
+
"meaning": "unknown-or-invalid-container-version"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"code": "E_ANIMATION_UNSUPPORTED_VERSION",
|
|
172
|
+
"path": "$.version",
|
|
173
|
+
"meaning": "unsupported-core-document-version"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"code": "E_ANIMATION_MISSING_EXTENSION",
|
|
177
|
+
"path": "$.extensionsRequired",
|
|
178
|
+
"meaning": "missing-or-unknown-required-extension-major"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"code": "E_ANIMATION_3D_INVALID_PAYLOAD",
|
|
182
|
+
"path": "$.extensions.org.haiyue.animation-3d@1",
|
|
183
|
+
"meaning": "invalid-3d-extension-payload"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"code": "E_ANIMATION_3D_MIXED_DIMENSIONS",
|
|
187
|
+
"path": "$.nodes",
|
|
188
|
+
"meaning": "2d-core-content-present-in-3d-carrier"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"code": "E_ANIMATION_3D_UNSUPPORTED_FEATURE",
|
|
192
|
+
"path": "$.extensions.org.haiyue.animation-3d@1",
|
|
193
|
+
"meaning": "recognized-but-unsupported-3d-feature"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"code": "E_ANIMATION_3D_UNKNOWN_RESOURCE",
|
|
197
|
+
"path": "$.extensions.org.haiyue.animation-3d@1.nodes",
|
|
198
|
+
"meaning": "missing-model-material-or-texture-reference"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"code": "E_ANIMATION_3D_BINDING_MISMATCH",
|
|
202
|
+
"path": "$.extensions.org.haiyue.animation-3d@1.clips",
|
|
203
|
+
"meaning": "binding-value-width-or-target-mismatch"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"code": "E_ANIMATION_3D_LIMIT_EXCEEDED",
|
|
207
|
+
"path": "$.extensions.org.haiyue.animation-3d@1",
|
|
208
|
+
"meaning": "3d-allocation-budget-exceeded"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"code": "E_PROJECT_INVALID_FORMAT",
|
|
212
|
+
"path": "$.format",
|
|
213
|
+
"meaning": "unknown-project-family"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"code": "E_PROJECT_UNSUPPORTED_VERSION",
|
|
217
|
+
"path": "$.schemaVersion",
|
|
218
|
+
"meaning": "unsupported-project-schema-version"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"code": "E_PROJECT_MIXED_DIMENSIONS",
|
|
222
|
+
"path": "$.mode",
|
|
223
|
+
"meaning": "mixed-project-mode-is-not-supported"
|
|
224
|
+
}
|
|
129
225
|
]
|
|
130
226
|
}
|
|
@@ -274,7 +274,8 @@
|
|
|
274
274
|
"volume": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
275
275
|
"loop": { "type": "boolean" },
|
|
276
276
|
"startOffset": { "type": "number", "minimum": 0 },
|
|
277
|
-
"playbackRate": { "type": "number", "exclusiveMinimum": 0 }
|
|
277
|
+
"playbackRate": { "type": "number", "exclusiveMinimum": 0 },
|
|
278
|
+
"playbackProfile": { "enum": ["buffer", "stream"], "default": "buffer" }
|
|
278
279
|
},
|
|
279
280
|
"additionalProperties": false
|
|
280
281
|
},
|