Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.
JavaScript 3d3d-assets3d-modelingagent-skillsagent-toolsai-agentsasset-pipelinecligame-assetsglbgltfmcpmcp-servermodel-context-protocolprocedural-generationprocedural-modelingtext-to-3dthreejstypescript
build: record qualified delivery and organic integration runtime
Matt Kissingeread96ef7e7fa
diff --git a/dist/agent-run.mjs b/dist/agent-run.mjsindex 6585fbe8..28864596 100644--- a/dist/agent-run.mjs+++ b/dist/agent-run.mjs@@ -5756,6 +5756,63 @@ var init_geometry_catalog = __esm(() => {description: "Experimental positive-inside implicit field sampled into a solid mesh. Requires explicit bounds and resolution; checks grid size and actual evaluation count. Output has no UVs.",promptNotes: "Use async build and await. Smaller edgeLength increases cost sharply. This helper cannot stop a callback that never returns; the host evaluator process provides that boundary. Thin features and geometric accuracy require inspection.",example: "const blob = await implicitSurface(([x,y,z]) => 1-Math.hypot(x,y,z), { bounds: { min: [-1.2,-1.2,-1.2], max: [1.2,1.2,1.2] }, edgeLength: 0.15 });"+ },+ {+ name: "metaballSurface",+ signature: "await metaballSurface(spheres: { center: [x,y,z], radius }[], { bounds, edgeLength, blend?, maxCells?, maxEvaluations? })",+ returns: "Promise<THREE.BufferGeometry>",+ category: "geometry",+ description: "Experimental smooth union of spheres meshed through implicitSurface. Uses polynomial blending; output has no UVs.",+ promptNotes: "Prefer this over hand-rolling smoothUnion fields for creatures, blobs and rounded junctions. Match edgeLength to feature size.",+ example: "const body = await metaballSurface([{ center: [0,0.4,0], radius: 0.35 }, { center: [0.2,0.55,0], radius: 0.22 }], { bounds: { min: [-0.6,-0.1,-0.5], max: [0.6,1,0.5] }, edgeLength: 0.08 });"+ },+ {+ name: "taperedTube",+ signature: "taperedTube(path: [x,y,z][], radii: number[], opts?: { radialSegments?: 20, creaseAngle?: 180, cap?: true, closed?: false, up?, twist?, sectionScale?: [side,depth][] })",+ returns: "THREE.BufferGeometry",+ category: "curves",+ description: "Circular sweep with one radius per path station. Default creaseAngle 180 shades round profiles smoothly; sample splines with catmullRomPath first.",+ example: "const path = catmullRomPath([[0,0.5,0],[0.3,0.7,0],[0.5,0.4,0]], 6); const radii = path.map((_, i) => 0.08 - 0.06 * i / (path.length - 1)); const tail = taperedTube(path, radii);"+ },+ {+ name: "catmullRomPath",+ signature: "catmullRomPath(controlPoints: [x,y,z][], samplesPerSpan?: 8, closed?: false)",+ returns: "[x,y,z][]",+ category: "curves",+ description: "Samples a Catmull-Rom spline through waypoints. Open paths include both endpoints; closed paths omit the repeated endpoint for closed sweeps.",+ example: "const path = catmullRomPath([[0,0,0],[0.2,0.4,0.1],[0.5,0.2,0]], 10);"+ },+ {+ name: "spiralPath",+ signature: "spiralPath(opts: { center, radius, rise, turns, axis?, forward?, samples? })",+ returns: "[x,y,z][]",+ category: "curves",+ description: "Rising spiral for curled appendages, shrinking to 42% of the start radius. Returns samples + 1 stations; starts radius away from center.",+ example: "const curl = spiralPath({ center: [0,0.05,0], radius: 0.03, rise: 0.12, turns: 1.75, forward: [0,0,1] });"+ },+ {+ name: "smoothOrganic",+ signature: "smoothOrganic(geometry, opts?: { iterations?: 1, creaseAngle?: 55, preserveUV?: false })",+ returns: "THREE.BufferGeometry",+ category: "mesh-ops",+ description: "Runs subdivide then creaseNormals with organic-friendly defaults.",+ example: "const soft = smoothOrganic(tube, { iterations: 1, creaseAngle: 50 });"+ },+ {+ name: "smoothUnion",+ signature: "smoothUnion(a: number, b: number, blend: number)",+ returns: "number",+ category: "geometry",+ description: "Polynomial smooth maximum for positive-inside implicit fields. Compose inside implicitSurface callbacks.",+ example: "smoothUnion(sphereInside(p,[0,0,0],0.5), sphereInside(p,[0.3,0,0],0.4), 0.12)"+ },+ {+ name: "sphereInside",+ signature: "sphereInside(point: [x,y,z], center: [x,y,z], radius: number)",+ returns: "number",+ category: "geometry",+ description: "Positive-inside sphere field sample for implicitSurface. Returns radius minus distance to center.",+ example: "sphereInside(p, [0,0.4,0], 0.25)"}];});@@ -10154,6 +10211,9 @@ var init_requirements_report = __esm(() => {];});+// src/atomic-directory.ts+var init_atomic_directory = () => {};+// src/portable-sampler-runtime.tsimport {ClampToEdgeWrapping,@@ -12462,6 +12522,7 @@ async function createMaterialRecordV2(draft, options) {}var digest2 = (bytes) => `sha256:${createHash6("sha256").update(bytes).digest("hex")}`, encoder, identity = (manifest) => `${manifest.materialId}/${manifest.revisionId}`;var init_material_library_node = __esm(() => {+ init_atomic_directory();init_material_library();init_portable_sampler();init_portable_sampler_runtime();@@ -12490,9 +12551,44 @@ var init_rebuild_options = __esm(() => {});});+// src/evaluator/solid-diagnostic.ts+function validSolidFailureDetails(value) {+ if (!record6(value) || !keys(value, ["total", "truncated", "meshes"]) || !count3(value.total) || value.total < 1 || !Array.isArray(value.meshes) || value.meshes.length !== Math.min(value.total, MAX_SOLID_FAILURE_MESHES) || value.truncated !== value.total > value.meshes.length)+ return false;+ return value.meshes.every((mesh) => record6(mesh) && keys(mesh, [+ "childPath",+ "closed",+ "manifold",+ "orientation",+ "boundaryEdges",+ "nonManifoldEdges",+ "orientationConflicts"+ ]) && (mesh.childPath === null || Array.isArray(mesh.childPath) && mesh.childPath.length <= MAX_SOLID_FAILURE_PATH && mesh.childPath.every(count3)) && typeof mesh.closed === "boolean" && typeof mesh.manifold === "boolean" && typeof mesh.orientation === "string" && ["outward", "inward", "mixed"].includes(mesh.orientation) && count3(mesh.boundaryEdges) && count3(mesh.nonManifoldEdges) && count3(mesh.orientationConflicts));+}+function solidFailureAdvice(value) {+ if (!value || !validSolidFailureDetails(value))+ return "";+ const rows = value.meshes.map((mesh) => {+ const locator = mesh.childPath === null ? "mesh beyond the 64-level locator limit" : `root${mesh.childPath.map((index) => `.children[${index}]`).join("")}`;+ return `${locator}: closed=${mesh.closed}, manifold=${mesh.manifold}, orientation=${mesh.orientation}, boundaryEdges=${mesh.boundaryEdges}, nonManifoldEdges=${mesh.nonManifoldEdges}, orientationConflicts=${mesh.orientationConflicts}`;+ });+ return ` Required solid measurements (${value.meshes.length} of ${value.total} failing meshes): ${rows.join("; ")}. Child indices locate nodes in the authored build root before export; names are not forwarded. Read the retained source and check that node's geometryDiagnostics().solid.`;+}+var MAX_SOLID_FAILURE_MESHES = 4, MAX_SOLID_FAILURE_PATH = 64, RequiredSolidError, record6 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), keys = (value, names) => Object.keys(value).length === names.length && names.every((name) => Object.hasOwn(value, name)), count3 = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;+var init_solid_diagnostic = __esm(() => {+ init_authoring_diagnostic();+ RequiredSolidError = class RequiredSolidError extends AuthoringDiagnosticError {+ solid;+ constructor(solid, message) {+ super("REQUIRE_SOLID", message);+ this.solid = solid;+ }+ };+});+// src/qa/breadth-evidence.tsimport * as THREE6 from "three";-function record6(value) {+function record7(value) {return typeof value === "object" && value !== null && !Array.isArray(value);}function isMeshNode(value) {@@ -12502,10 +12598,10 @@ function isSpriteNode(value) {return value.isSprite === true;}function isTexture(value) {- return record6(value) && value.isTexture === true;+ return record7(value) && value.isTexture === true;}function isAnimationClip(value) {- return record6(value) && typeof value.name === "string" && typeof value.duration === "number" && Number.isFinite(value.duration) && Array.isArray(value.tracks);+ return record7(value) && typeof value.name === "string" && typeof value.duration === "number" && Number.isFinite(value.duration) && Array.isArray(value.tracks);}function localRenderableBox(rootInverse, node) {if (isSpriteNode(node)) {@@ -12769,7 +12865,7 @@ function shaderUniforms(materials) {const values = new Set;for (const material of materials) {const uniforms = material.uniforms;- if (record6(uniforms))+ if (record7(uniforms))for (const key of Object.keys(uniforms))values.add(key);}@@ -13195,14 +13291,14 @@ var init_registry = __esm(() => {// src/qa/breadth.tsfunction validModularJoinObservation(value) {- if (!record7(value))+ if (!record8(value))return false;return typeof value.aSocketId === "string" && value.aSocketId.length > 0 && typeof value.bSocketId === "string" && value.bSocketId.length > 0 && finiteTuple2(value.aWorldPosition, 3) && finiteTuple2(value.bWorldPosition, 3) && finiteTuple2(value.aWorldNormal, 3) && finiteTuple2(value.bWorldNormal, 3) && typeof value.relativeRotationDegrees === "number" && Number.isFinite(value.relativeRotationDegrees) && (value.toleranceMeters === undefined || typeof value.toleranceMeters === "number" && Number.isFinite(value.toleranceMeters) && value.toleranceMeters >= 0) && (value.normalToleranceDegrees === undefined || typeof value.normalToleranceDegrees === "number" && Number.isFinite(value.normalToleranceDegrees) && value.normalToleranceDegrees >= 0);}function validVfxArtifactEvidence(value) {- if (!record7(value) || value.schemaVersion !== 1)+ if (!record8(value) || value.schemaVersion !== 1)return false;- if (!record7(value.facing) || !record7(value.animation))+ if (!record8(value.facing) || !record8(value.animation))return false;if (!Array.isArray(value.materials))return false;@@ -13210,10 +13306,10 @@ function validVfxArtifactEvidence(value) {return false;if (!value.uniforms.every((name) => typeof name === "string" && name.length > 0))return false;- if (!value.clips.every((clip) => record7(clip) && typeof clip.name === "string" && clip.name.length > 0 && typeof clip.durationSeconds === "number" && Number.isFinite(clip.durationSeconds) && clip.durationSeconds >= 0)) {+ if (!value.clips.every((clip) => record8(clip) && typeof clip.name === "string" && clip.name.length > 0 && typeof clip.durationSeconds === "number" && Number.isFinite(clip.durationSeconds) && clip.durationSeconds >= 0)) {return false;}- return value.materials.every((material) => record7(material) && typeof material.id === "string" && material.id.length > 0 && ["card", "beam", "trail", "volume", "core"].includes(String(material.surfaceRole)) && ["opaque", "mask", "blend"].includes(String(material.alphaMode)) && (material.effectSurface === undefined || typeof material.effectSurface === "boolean") && typeof material.alphaData === "boolean" && typeof material.doubleSided === "boolean" && typeof material.screenAreaRatio === "number" && Number.isFinite(material.screenAreaRatio) && material.screenAreaRatio >= 0 && typeof material.transparentLayers === "number" && Number.isInteger(material.transparentLayers) && material.transparentLayers >= 0 && typeof material.textureMemoryBytes === "number" && Number.isInteger(material.textureMemoryBytes) && material.textureMemoryBytes >= 0);+ return value.materials.every((material) => record8(material) && typeof material.id === "string" && material.id.length > 0 && ["card", "beam", "trail", "volume", "core"].includes(String(material.surfaceRole)) && ["opaque", "mask", "blend"].includes(String(material.alphaMode)) && (material.effectSurface === undefined || typeof material.effectSurface === "boolean") && typeof material.alphaData === "boolean" && typeof material.doubleSided === "boolean" && typeof material.screenAreaRatio === "number" && Number.isFinite(material.screenAreaRatio) && material.screenAreaRatio >= 0 && typeof material.transparentLayers === "number" && Number.isInteger(material.transparentLayers) && material.transparentLayers >= 0 && typeof material.textureMemoryBytes === "number" && Number.isInteger(material.textureMemoryBytes) && material.textureMemoryBytes >= 0);}function artifactEvidence(context) {if (context.derivedEvidence?.source !== "engine-scene-analysis")@@ -13560,7 +13656,7 @@ function inspectAssetScope(context) {if (!scope)return [];const scopeObservation = context.derivedEvidence?.assetScope;- if (context.derivedEvidence?.source !== "engine-scene-analysis" || !record7(scopeObservation) || typeof scopeObservation.topLevelAssetRoots !== "number" || typeof scopeObservation.reusableMemberCount !== "number" || !Array.isArray(scopeObservation.sceneDressingRoles)) {+ if (context.derivedEvidence?.source !== "engine-scene-analysis" || !record8(scopeObservation) || typeof scopeObservation.topLevelAssetRoots !== "number" || typeof scopeObservation.reusableMemberCount !== "number" || !Array.isArray(scopeObservation.sceneDressingRoles)) {return [];}const result = assessAssetScopeV1(scope, scopeObservation);@@ -13621,7 +13717,7 @@ function evaluateAssetScopeQa(context) {derivedEvidence: context.derivedEvidence});}-var record7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), stable3 = (value) => Math.round(value * 1e6) / 1e6, finiteTuple2 = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), VFX_EXACT_QA_RULE, VFX_ADVISORY_QA_RULE, MODULAR_JOIN_QA_RULE, ASSET_SCOPE_QA_RULE, W7_BREADTH_QA_RULES;+var record8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), stable3 = (value) => Math.round(value * 1e6) / 1e6, finiteTuple2 = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), VFX_EXACT_QA_RULE, VFX_ADVISORY_QA_RULE, MODULAR_JOIN_QA_RULE, ASSET_SCOPE_QA_RULE, W7_BREADTH_QA_RULES;var init_breadth2 = __esm(() => {init_breadth();init_registry();@@ -25123,7 +25219,9 @@ function requireSolid(part) {}function assertRequiredSolids(root) {const problems = [];- const visit = (node) => {+ const meshes = [];+ let total = 0;+ const visit = (node, childPath) => {if (node.visible === false)return;const mesh = node;@@ -25137,15 +25235,29 @@ function assertRequiredSolids(root) {reasons.push(`not manifold (${report.nonManifoldEdges} edges shared by 3+ faces)`);if (solid.orientation !== "outward")reasons.push(solid.orientation === "mixed" ? `winding is mixed (${report.orientationConflicts} conflicting edges)` : `faces point inward (signed volume ${solid.signedVolume.toPrecision(4)})`);- if (reasons.length)- problems.push(`${mesh.name || "(unnamed mesh)"}: ${reasons.join(", ")}`);+ if (reasons.length) {+ total++;+ if (meshes.length < MAX_SOLID_FAILURE_MESHES) {+ problems.push(`${mesh.name || "(unnamed mesh)"}: ${reasons.join(", ")}`);+ meshes.push({+ childPath: childPath.length <= MAX_SOLID_FAILURE_PATH ? childPath : null,+ closed: solid.closed,+ manifold: solid.manifold,+ orientation: solid.orientation,+ boundaryEdges: report.boundaryEdges,+ nonManifoldEdges: report.nonManifoldEdges,+ orientationConflicts: report.orientationConflicts+ });+ }+ }}- for (const child of node.children)- visit(child);+ node.children.forEach((child, index) => {+ visit(child, [...childPath, index]);+ });};- visit(root);- if (problems.length)- throw new AuthoringDiagnosticError("REQUIRE_SOLID", `requireSolid: ${problems.length} marked mesh(es) are not closed, manifold, outward solids: ${problems.slice(0, 4).join("; ")}${problems.length > 4 ? "; ..." : ""}.`);+ visit(root, []);+ if (total)+ throw new RequiredSolidError({ total, truncated: total > meshes.length, meshes }, `requireSolid: ${total} marked mesh(es) are not closed, manifold, outward solids: ${problems.join("; ")}${total > meshes.length ? "; ..." : ""}.`);}var REQUIRE_SOLID_KEY = "kilnRequireSolid", marked = (node) => {for (let at = node;at; at = at.parent)@@ -25156,6 +25268,7 @@ var REQUIRE_SOLID_KEY = "kilnRequireSolid", marked = (node) => {var init_require_solid = __esm(() => {init_authoring_diagnostic();init_geometry();+ init_solid_diagnostic();});// src/user-data-extras.ts@@ -26311,7 +26424,7 @@ function normalizeBudget(spec) {fail8(`unknown field ${JSON.stringify(key)}.`);const triangles = {};if (typeof value.triangles === "number")- triangles.LOD0 = count3("triangles", value.triangles);+ triangles.LOD0 = count4("triangles", value.triangles);else if (value.triangles && typeof value.triangles === "object" && !Array.isArray(value.triangles)) {const entries = Object.entries(value.triangles);if (entries.length === 0)@@ -26319,7 +26432,7 @@ function normalizeBudget(spec) {for (const [tier, limit] of entries) {if (!/^LOD(0|[1-9][0-9]?)$/.test(tier))fail8(`triangles tier ${JSON.stringify(tier)} must be named LOD0, LOD1, ...`);- triangles[tier] = count3(`triangles.${tier}`, limit);+ triangles[tier] = count4(`triangles.${tier}`, limit);}} elsefail8("triangles must be a positive integer or a record of LOD tiers.");@@ -26327,7 +26440,7 @@ function normalizeBudget(spec) {return {schemaVersion: 1,triangles: ordered,- ...value.draws === undefined ? {} : { draws: count3("draws", value.draws) }+ ...value.draws === undefined ? {} : { draws: count4("draws", value.draws) }};}function defineBudget(spec, target) {@@ -26381,7 +26494,7 @@ function evaluateBudget(declaration, measuredLod0, chains) {}var KILN_BUDGET_KEY = "kilnBudgetV1", fail8 = (detail) => {throw new AuthoringDiagnosticError("DELIVERY_CONTRACT", `defineBudget(spec): ${detail}`);-}, count3 = (label, value) => {+}, count4 = (label, value) => {if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1)fail8(`${label} must be a positive integer, got ${String(value)}.`);return value;@@ -28656,8 +28769,166 @@ var init_profile = __esm(() => {};});-// src/uv-shapes.ts+// src/sdf.ts+function sphereInside(point, center, radius) {+ if (point.length !== 3 || !point.every(Number.isFinite))+ throw new Error("sphereInside point must be three finite numbers");+ if (!Number.isFinite(radius) || radius <= 0)+ throw new Error("sphereInside radius must be positive and finite");+ if (center.length !== 3 || !center.every(Number.isFinite))+ throw new Error("sphereInside center must be three finite numbers");+ return radius - Math.hypot(point[0] - center[0], point[1] - center[1], point[2] - center[2]);+}+function smoothUnion(a, b, blend) {+ if (!Number.isFinite(a) || !Number.isFinite(b))+ throw new Error("smoothUnion operands must be finite");+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("smoothUnion blend must be positive and finite");+ const h = Math.max(blend - Math.abs(a - b), 0) / blend;+ return Math.max(a, b) + h * h * blend / 4;+}+function smoothUnionSpheres(point, spheres, blend) {+ if (!spheres.length)+ throw new Error("smoothUnionSpheres needs at least one sphere");+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("smoothUnionSpheres blend must be positive and finite");+ let value = sphereInside(point, spheres[0].center, spheres[0].radius);+ for (let i = 1;i < spheres.length; i++) {+ const s = spheres[i];+ value = smoothUnion(value, sphereInside(point, s.center, s.radius), blend);+ }+ return value;+}++// src/organic.tsimport * as THREE41 from "three";+function assertSafePathCount(name, count) {+ if (!Number.isSafeInteger(count))+ throw new Error(`${name} derived sample count must be a safe integer; reduce sample counts.`);+}+async function metaballSurface(spheres, options) {+ if (!spheres.length)+ throw new Error("metaballSurface needs at least one sphere");+ let minRadius = Infinity;+ for (const s of spheres) {+ if (s.center.length !== 3 || !s.center.every(Number.isFinite))+ throw new Error("metaballSurface sphere center must be three finite numbers");+ if (!Number.isFinite(s.radius) || s.radius <= 0)+ throw new Error("metaballSurface sphere radius must be positive and finite");+ minRadius = Math.min(minRadius, s.radius);+ }+ const blend = options.blend ?? Math.max(minRadius * 0.35, 0.02);+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("metaballSurface blend must be positive and finite");+ const { bounds, ...rest } = options;+ const field = (p) => smoothUnionSpheres(p, spheres, blend);+ return implicitSurface(field, { bounds, ...rest });+}+function catmullRomPath(controlPoints, samplesPerSpan = 8, closed = false) {+ if (controlPoints.length < (closed ? 3 : 2))+ throw new Error("catmullRomPath needs at least two open or three closed control points");+ if (!Number.isSafeInteger(samplesPerSpan) || samplesPerSpan < 1)+ throw new Error("catmullRomPath samplesPerSpan must be a positive integer");+ const spans = closed ? controlPoints.length : controlPoints.length - 1;+ assertSafePathCount("catmullRomPath", spans * samplesPerSpan + 1);+ if (controlPoints.some((p) => p.length !== 3 || !p.every(Number.isFinite)))+ throw new Error("catmullRomPath control points must be finite [x,y,z] triples");+ const vectors = controlPoints.map((p) => new THREE41.Vector3(p[0], p[1], p[2]));+ const curve = new THREE41.CatmullRomCurve3(vectors, closed);+ const points = curve.getPoints(spans * samplesPerSpan);+ if (closed)+ points.pop();+ return points.map((v) => [v.x, v.y, v.z]);+}+function taperedTube(path, radii, options = {}) {+ const closed = options.closed ?? false;+ const stations = path;+ if (stations.length < (closed ? 3 : 2))+ throw new Error("taperedTube needs at least two open or three closed path points");+ if (radii.length !== stations.length)+ throw new Error("taperedTube radii must have one entry per path point");+ for (const r of radii) {+ if (!Number.isFinite(r) || r <= 0)+ throw new Error("taperedTube radii must be positive and finite");+ }+ const radialSegments = options.radialSegments ?? 20;+ const profile = circleProfile(1, radialSegments).map(([x, y]) => [x, y]);+ const scale = radii.map((r, i) => {+ const [side, depth] = options.sectionScale?.[i] ?? [1, 1];+ return [r * side, r * depth];+ });+ if (options.sectionScale && options.sectionScale.length !== stations.length)+ throw new Error("taperedTube sectionScale needs one [side, depth] pair per path point");+ const geo = sweepProfile(profile, [...stations], {+ cap: options.cap ?? true,+ closed,+ up: options.up,+ twist: options.twist ?? 0,+ scale,+ creaseAngle: options.creaseAngle ?? 180+ });+ return geo;+}+function spiralPath(options) {+ const {+ center,+ radius,+ rise,+ turns,+ axis = [0, 1, 0],+ forward = [0, 0, 1],+ samples = 24+ } = options;+ if (![radius, rise, turns].every((n) => Number.isFinite(n) && n > 0))+ throw new Error("spiralPath radius, rise and turns must be positive and finite");+ if (!Number.isSafeInteger(samples) || samples < 4)+ throw new Error("spiralPath samples must be an integer >= 4");+ assertSafePathCount("spiralPath", samples + 1);+ if (center.length !== 3 || !center.every(Number.isFinite))+ throw new Error("spiralPath center must be a finite [x,y,z] triple");+ if (axis.length !== 3 || forward.length !== 3 || ![...axis, ...forward].every(Number.isFinite))+ throw new Error("spiralPath axis and forward must be finite [x,y,z] triples");+ const up = new THREE41.Vector3(...axis);+ const fwd = new THREE41.Vector3(...forward);+ if (up.lengthSq() < 0.000000000001 || fwd.lengthSq() < 0.000000000001)+ throw new Error("spiralPath axis and forward must be nonzero");+ up.normalize();+ const horiz = fwd.clone().addScaledVector(up, -fwd.dot(up));+ if (horiz.lengthSq() < 0.000000000001)+ throw new Error("spiralPath forward must not be parallel to axis");+ horiz.normalize();+ const right = new THREE41.Vector3().crossVectors(up, horiz).normalize();+ const out = [];+ for (let i = 0;i <= samples; i++) {+ const u = i / samples;+ const theta = u * turns * Math.PI * 2;+ const r = radius * (1 - u * 0.58);+ const offset = horiz.clone().multiplyScalar(r * Math.cos(theta)).add(right.clone().multiplyScalar(r * Math.sin(theta)));+ const lift = up.clone().multiplyScalar(u * rise);+ out.push([+ center[0] + offset.x + lift.x,+ center[1] + offset.y + lift.y,+ center[2] + offset.z + lift.z+ ]);+ }+ return out;+}+function smoothOrganic(geometry, options = {}) {+ const iterations = options.iterations ?? 1;+ const preserveUV = options.preserveUV ?? false;+ const subdivided = subdivide(geometry, iterations, preserveUV ? { preserveUV: true } : undefined);+ return creaseNormals(subdivided, { angle: options.creaseAngle ?? 55 });+}+var init_organic = __esm(() => {+ init_geometry();+ init_implicit();+ init_profile();+ init_ops();+ init_sweep2();+});++// src/uv-shapes.ts+import * as THREE42 from "three";function remapUV(geo, options = {}) {if (!options || typeof options !== "object" || Array.isArray(options) || Object.keys(options).some((key) => !["scale", "offset"].includes(key))) {throw new Error("remapUV: options may contain only scale and offset.");@@ -28686,7 +28957,7 @@ function remapUV(geo, options = {}) {}const cloned = geo.clone();cloned.userData = structuredClone(geo.userData);- cloned.setAttribute("uv", new THREE41.Float32BufferAttribute(values, 2));+ cloned.setAttribute("uv", new THREE42.Float32BufferAttribute(values, 2));if ((scale[0] !== 1 || scale[1] !== 1) && cloned.hasAttribute("tangent")) {cloned.deleteAttribute("tangent");const previous = cloned.userData.kilnAttributeWarnings;@@ -28703,13 +28974,13 @@ function remapUV(geo, options = {}) {var init_uv_shapes = () => {};// src/texture-atlas.ts-import * as THREE42 from "three";+import * as THREE43 from "three";async function textureAtlas(input, options = {}) {const compiled = await compileTextureAtlasSpecV1(input, options);- const texture = new THREE42.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE42.RGBAFormat, THREE42.UnsignedByteType);+ const texture = new THREE43.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE43.RGBAFormat, THREE43.UnsignedByteType);texture.name = "Atlas";texture.flipY = false;- texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE42.SRGBColorSpace : THREE42.NoColorSpace;+ texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE43.SRGBColorSpace : THREE43.NoColorSpace;applyPortableSamplerV1(texture, compiled.spec.sampler);texture.userData.kilnAtlas = { spec: compiled.spec, manifest: compiled.manifest };texture.userData.kilnTexture = {@@ -28760,7 +29031,7 @@ function remapUVToAtlas(geometry, atlas, name, options) {bytes += buffer.byteLength;}} else {- bytes += attribute.array.byteLength * (attribute.constructor === THREE42.BufferAttribute || attribute.constructor === THREE42.InstancedBufferAttribute ? 1 : 2);+ bytes += attribute.array.byteLength * (attribute.constructor === THREE43.BufferAttribute || attribute.constructor === THREE43.InstancedBufferAttribute ? 1 : 2);}};for (const attr of Object.values(geometry.attributes))@@ -28984,7 +29255,7 @@ var init_portable_material_runtime = __esm(() => {});// src/uv-data.ts-import * as THREE43 from "three";+import * as THREE44 from "three";function validateAtlasRemap(mesh, inputIndex, sourceCount) {const count = mesh.vertexCount;if (!Number.isSafeInteger(count) || count < 1 || count > GEOMETRY_ALLOCATION_LIMITS.unwrapVertices)@@ -29019,7 +29290,7 @@ function remapUnwrapAttribute(attribute, oldIndexes) {for (let c = 0;c < attribute.itemSize; c++)array[i * attribute.itemSize + c] = attribute.array[oldIndexes[i] * stride + offset + c];}- const output = attribute.isFloat16BufferAttribute ? new THREE43.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE43.BufferAttribute(array, attribute.itemSize, attribute.normalized);+ const output = attribute.isFloat16BufferAttribute ? new THREE44.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE44.BufferAttribute(array, attribute.itemSize, attribute.normalized);output.name = attribute.name;output.setUsage(interleaved(attribute) ? attribute.data.usage : attribute.usage);if (!interleaved(attribute))@@ -29131,7 +29402,7 @@ var init_uv_data = __esm(() => {});// src/uv.ts-import * as THREE44 from "three";+import * as THREE45 from "three";async function getXatlas() {if (!_xatlasReady) {_xatlasReady = (async () => {@@ -29163,7 +29434,7 @@ async function autoUnwrap(geometry, opts = {}) {if (result.atlasCount !== 1 || !Number.isSafeInteger(result.width) || result.width <= 0 || !Number.isSafeInteger(result.height) || result.height <= 0)throw new Error("autoUnwrap: xatlas must return one valid atlas; multiple atlas pages are unsupported.");const remap = validateAtlasRemap(mesh, prepared.index, geometry.getAttribute("position").count);- const out = new THREE44.BufferGeometry;+ const out = new THREE45.BufferGeometry;for (const [name, attribute] of Object.entries(geometry.attributes)) {if (name === "uv" || name === "tangent" || name === "normal" && !prepared.useNormals)continue;@@ -29173,8 +29444,8 @@ async function autoUnwrap(geometry, opts = {}) {out.morphAttributes[name] = targets.map((attribute) => remapUnwrapAttribute(attribute, remap.oldIndexes));}out.morphTargetsRelative = geometry.morphTargetsRelative;- out.setIndex(new THREE44.BufferAttribute(new Uint32Array(remap.index), 1));- out.setAttribute("uv", new THREE44.BufferAttribute(new Float32Array(remap.uv), 2));+ out.setIndex(new THREE45.BufferAttribute(new Uint32Array(remap.index), 1));+ out.setAttribute("uv", new THREE45.BufferAttribute(new Float32Array(remap.uv), 2));out.name = geometry.name;out.groups = geometry.groups.map((group) => ({ ...group }));out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);@@ -29209,11 +29480,11 @@ function repairZeroNormals(geo) {if (broken.size === 0)return;const acc = new Float32Array(normal.count * 3);- const a = new THREE44.Vector3;- const b = new THREE44.Vector3;- const c = new THREE44.Vector3;- const face = new THREE44.Vector3;- const edge = new THREE44.Vector3;+ const a = new THREE45.Vector3;+ const b = new THREE45.Vector3;+ const c = new THREE45.Vector3;+ const face = new THREE45.Vector3;+ const edge = new THREE45.Vector3;for (let t = 0;t + 2 < index.count; t += 3) {const tri = [index.getX(t), index.getX(t + 1), index.getX(t + 2)];if (!tri.some((i) => broken.has(i)))@@ -29249,7 +29520,7 @@ var init_uv = __esm(() => {});// src/uv-project.ts-import * as THREE45 from "three";+import * as THREE46 from "three";function projectUV(geometry, options) {if (!options || typeof options !== "object" || Array.isArray(options) || !["planar", "box", "cylindrical"].includes(options.projection) || Object.keys(options).some((key) => !["projection", "frame", "seamDegrees", "angularRange", "caps"].includes(key)))throw new Error("projectUV: select an explicit planar, box or cylindrical projection with documented options.");@@ -29287,15 +29558,15 @@ function projectUV(geometry, options) {throw new Error("projectUV: index contains an invalid vertex reference.");}const points = [];- const bounds = new THREE45.Box3;+ const bounds = new THREE46.Box3;for (let i = 0;i < positions.count; i++) {- const point = new THREE45.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);+ const point = new THREE46.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);if (![point.x, point.y, point.z].every(Number.isFinite))throw new Error("projectUV: frame-local positions must be finite.");points.push(point);bounds.expandByPoint(point);}- const extent = bounds.getSize(new THREE45.Vector3);+ const extent = bounds.getSize(new THREE46.Vector3);const fit = (point, axis) => extent[axis] > 0 ? (point[axis] - bounds.min[axis]) / extent[axis] : 0.5;const outputUVs = new Float32Array(corners * 2);const startDegrees = options.angularRange?.[0] ?? options.seamDegrees ?? 180;@@ -29303,8 +29574,8 @@ function projectUV(geometry, options) {const sweep = (options.angularRange?.[1] ?? 360) * Math.PI / 180;const fullWrap = options.angularRange === undefined || options.angularRange[1] === 360;const wrap = (angle) => (angle % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);- const normal = new THREE45.Vector3;- const edge = new THREE45.Vector3;+ const normal = new THREE46.Vector3;+ const edge = new THREE46.Vector3;for (let i = 0;i < corners; i += 3) {const triangle = [0, 1, 2].map((offset) => points[index ? index.getX(i + offset) : i + offset]);normal.subVectors(triangle[1], triangle[0]).cross(edge.subVectors(triangle[2], triangle[0])).normalize();@@ -29351,7 +29622,7 @@ function projectUV(geometry, options) {const out = geometry.index ? geometry.toNonIndexed() : geometry.clone();out.userData = structuredClone(geometry.userData);out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);- out.setAttribute("uv", new THREE45.Float32BufferAttribute(outputUVs, 2));+ out.setAttribute("uv", new THREE46.Float32BufferAttribute(outputUVs, 2));if (out.hasAttribute("tangent")) {out.deleteAttribute("tangent");const previous = out.userData.kilnAttributeWarnings;@@ -29372,17 +29643,17 @@ var init_uv_project = __esm(() => {});// src/primitives.ts-import * as THREE46 from "three";+import * as THREE47 from "three";function vectorToTuple(v) {return [v.x, v.y, v.z];}function createRoot(name) {- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;return root;}function createPivot(name, position = [0, 0, 0], parent) {- const pivot = new THREE46.Object3D;+ const pivot = new THREE47.Object3D;pivot.name = `Joint_${name}`;pivot.position.set(...position);if (parent)@@ -29414,16 +29685,16 @@ function assertPartArgs(name, geometry2, material) {}function createPart(name, geometry2, material, options = {}) {assertPartArgs(name, geometry2, material);- const mesh = new THREE46.Mesh(geometry2, material);+ const mesh = new THREE47.Mesh(geometry2, material);mesh.name = `Mesh_${name}`;if (options.position)mesh.position.set(...options.position);if (options.rotation)- mesh.rotation.set(THREE46.MathUtils.degToRad(options.rotation[0]), THREE46.MathUtils.degToRad(options.rotation[1]), THREE46.MathUtils.degToRad(options.rotation[2]));+ mesh.rotation.set(THREE47.MathUtils.degToRad(options.rotation[0]), THREE47.MathUtils.degToRad(options.rotation[1]), THREE47.MathUtils.degToRad(options.rotation[2]));if (options.scale)mesh.scale.set(...options.scale);if (options.pivot) {- const pivot = new THREE46.Object3D;+ const pivot = new THREE47.Object3D;pivot.name = `Joint_${name}`;pivot.add(mesh);mesh.position.set(0, 0, 0);@@ -29446,7 +29717,7 @@ function capsuleGeo(radius, height, segments = 6) {assertDimension("capsuleGeo height (straight middle length)", height, true);assertDimension("capsuleGeo outer half-length", height / 2 + radius);assertPrimitiveSegments("capsuleGeo segments", segments, 3);- return new THREE46.CapsuleGeometry(radius, height, 2, segments);+ return new THREE47.CapsuleGeometry(radius, height, 2, segments);}function capsuleXGeo(radius, length, segments = 6) {const geo = capsuleGeo(radius, length, segments);@@ -29465,7 +29736,7 @@ function cylinderGeo(radiusTop, radiusBottom, height, segments = 8) {throw new RangeError("cylinderGeo requires at least one positive radius.");assertDimension("cylinderGeo height", height);assertPrimitiveSegments("cylinderGeo segments", segments, 3);- return new THREE46.CylinderGeometry(radiusTop, radiusBottom, height, segments);+ return new THREE47.CylinderGeometry(radiusTop, radiusBottom, height, segments);}function cylinderXGeo(radiusTop, radiusBottom, length, segments = 8) {const geo = cylinderGeo(radiusTop, radiusBottom, length, segments);@@ -29480,20 +29751,20 @@ function cylinderZGeo(radiusTop, radiusBottom, length, segments = 8) {function boxGeo(width, height, depth) {for (const [name, value] of Object.entries({ width, height, depth }))assertDimension(`boxGeo ${name} (use planeGeo for a sheet)`, value);- return new THREE46.BoxGeometry(width, height, depth);+ return new THREE47.BoxGeometry(width, height, depth);}function sphereGeo(radius, widthSegments = 8, heightSegments = 6) {assertDimension("sphereGeo radius", radius);assertPrimitiveSegments("sphereGeo widthSegments", widthSegments, 3);assertPrimitiveSegments("sphereGeo heightSegments", heightSegments, 2);assertPrimitiveGrid("sphereGeo", widthSegments, heightSegments);- return new THREE46.SphereGeometry(radius, widthSegments, heightSegments);+ return new THREE47.SphereGeometry(radius, widthSegments, heightSegments);}function coneGeo(radius, height, segments = 8) {assertDimension("coneGeo radius", radius);assertDimension("coneGeo height", height);assertPrimitiveSegments("coneGeo segments", segments, 3);- return new THREE46.ConeGeometry(radius, height, segments);+ return new THREE47.ConeGeometry(radius, height, segments);}function coneXGeo(radius, length, segments = 8) {const geo = coneGeo(radius, length, segments);@@ -29510,7 +29781,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {const segments = options.segments ?? 8;assertFiniteTriple("cylinderOnAxis center", center);assertFiniteTriple("cylinderOnAxis normal", normal);- const n = new THREE46.Vector3(normal[0], normal[1], normal[2]);+ const n = new THREE47.Vector3(normal[0], normal[1], normal[2]);const len = Math.hypot(...normal);if (len < 0.000001) {throw new Error(`cylinderOnAxis: normal must be a non-zero vector (got [${normal.join(",")}]).`);@@ -29518,7 +29789,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {const magnitude = Math.max(...normal.map(Math.abs));n.set(normal[0] / magnitude, normal[1] / magnitude, normal[2] / magnitude).normalize();const geo = cylinderGeo(radiusTop, radiusBottom, height, segments);- const q = new THREE46.Quaternion().setFromUnitVectors(new THREE46.Vector3(0, 1, 0), n);+ const q = new THREE47.Quaternion().setFromUnitVectors(new THREE47.Vector3(0, 1, 0), n);geo.applyQuaternion(q);geo.translate(center[0], center[1], center[2]);return geo;@@ -29540,7 +29811,7 @@ function torusGeo(radius, tube, radialSegments = 8, tubularSegments = 12) {assertPrimitiveSegments("torusGeo radialSegments", radialSegments, 3);assertPrimitiveSegments("torusGeo tubularSegments", tubularSegments, 3);assertPrimitiveGrid("torusGeo", radialSegments, tubularSegments);- return new THREE46.TorusGeometry(radius, tube, radialSegments, tubularSegments);+ return new THREE47.TorusGeometry(radius, tube, radialSegments, tubularSegments);}function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {assertDimension("planeGeo width", width);@@ -29548,14 +29819,14 @@ function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {assertPrimitiveSegments("planeGeo widthSegments", widthSegments, 1);assertPrimitiveSegments("planeGeo heightSegments", heightSegments, 1);assertPrimitiveGrid("planeGeo", widthSegments, heightSegments);- return new THREE46.PlaneGeometry(width, height, widthSegments, heightSegments);+ return new THREE47.PlaneGeometry(width, height, widthSegments, heightSegments);}function decalBox(width, height, depth = 0.01) {assertDimension("decalBox width", width);assertDimension("decalBox height", height);assertDimension("decalBox depth", depth, true);const d = Math.max(depth, 0.002);- return new THREE46.BoxGeometry(width, height, d);+ return new THREE47.BoxGeometry(width, height, d);}function validateCardFrame(name, width, height, yPivot) {assertDimension(`${name} width`, width);@@ -29569,7 +29840,7 @@ function foliageCardGeo(opts = {}) {const h = opts.height ?? 1;const yPivot = opts.yPivot ?? 0;validateCardFrame("foliageCardGeo", w, h, yPivot);- const geom = new THREE46.PlaneGeometry(w, h);+ const geom = new THREE47.PlaneGeometry(w, h);geom.translate(0, h * (0.5 - yPivot), 0);geom.userData["kilnGeometryRole"] = "foliageCard";return geom;@@ -29585,12 +29856,12 @@ function crossedQuadsGeo(opts = {}) {const geometries = [];for (let i = 0;i < planes; i++) {const angle = i / planes * Math.PI;- const quad = new THREE46.PlaneGeometry(w, h);+ const quad = new THREE47.PlaneGeometry(w, h);quad.translate(0, h * (0.5 - yPivot), 0);quad.rotateY(angle);geometries.push(quad);}- const out = new THREE46.BufferGeometry;+ const out = new THREE47.BufferGeometry;const posCount = geometries.reduce((sum, g) => sum + (g.attributes.position?.count ?? 0), 0);const positions = new Float32Array(posCount * 3);const normals = new Float32Array(posCount * 3);@@ -29617,9 +29888,9 @@ function crossedQuadsGeo(opts = {}) {}vOffset += p.count;}- out.setAttribute("position", new THREE46.BufferAttribute(positions, 3));- out.setAttribute("normal", new THREE46.BufferAttribute(normals, 3));- out.setAttribute("uv", new THREE46.BufferAttribute(uvs, 2));+ out.setAttribute("position", new THREE47.BufferAttribute(positions, 3));+ out.setAttribute("normal", new THREE47.BufferAttribute(normals, 3));+ out.setAttribute("uv", new THREE47.BufferAttribute(uvs, 2));out.setIndex(indices);out.userData["kilnGeometryRole"] = "foliageCard";return out;@@ -29634,7 +29905,7 @@ function octaGridPlane(opts) {const h = opts.height ?? 1;const yPivot = opts.yPivot ?? 0;validateCardFrame("octaGridPlane", w, h, yPivot);- const geom = new THREE46.PlaneGeometry(w, h);+ const geom = new THREE47.PlaneGeometry(w, h);geom.translate(0, h * (0.5 - yPivot), 0);const uv = geom.attributes.uv;const du = 1 / opts.tilesX;@@ -29730,8 +30001,8 @@ function wingGeo(options = {}) {7,6];- const geo = new THREE46.BufferGeometry;- geo.setAttribute("position", new THREE46.BufferAttribute(vertices, 3));+ const geo = new THREE47.BufferGeometry;+ geo.setAttribute("position", new THREE47.BufferAttribute(vertices, 3));geo.setIndex(tipChord === 0 ? [0, 1, 3, 4, 7, 5, 0, 2, 6, 0, 6, 4, 1, 5, 7, 1, 7, 3, 0, 4, 5, 0, 5, 1] : indices);geo.computeVertexNormals();return geo;@@ -29762,17 +30033,17 @@ function createWingPair(name, material, options) {};}function beamBetween(name, start, end, radius, material, options = {}) {- const a = new THREE46.Vector3(...start);- const b = new THREE46.Vector3(...end);+ const a = new THREE47.Vector3(...start);+ const b = new THREE47.Vector3(...end);const direction = b.clone().sub(a);const length = direction.length();if (length <= 0.0001) {throw new Error(`beamBetween("${name}"): start and end must be different points (got start=[${start.join(",")}], end=[${end.join(",")}], delta=${length.toExponential(2)}). Pick two distinct endpoints or switch to cylinderGeo with an explicit length + position.`);}- const mesh = new THREE46.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);+ const mesh = new THREE47.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);mesh.name = `Mesh_${name}`;mesh.position.copy(a.add(b).multiplyScalar(0.5));- mesh.quaternion.setFromUnitVectors(new THREE46.Vector3(0, 1, 0), direction.normalize());+ mesh.quaternion.setFromUnitVectors(new THREE47.Vector3(0, 1, 0), direction.normalize());if (options.parent)options.parent.add(mesh);return mesh;@@ -29781,11 +30052,11 @@ function snapTo(part, host, options = {}) {const overlap = options.overlap ?? 0.02;part.updateWorldMatrix(true, true);host.updateWorldMatrix(true, true);- const a = new THREE46.Box3().setFromObject(part);- const b = new THREE46.Box3().setFromObject(host);+ const a = new THREE47.Box3().setFromObject(part);+ const b = new THREE47.Box3().setFromObject(host);if (a.isEmpty() || b.isEmpty())return part;- const delta = new THREE46.Vector3;+ const delta = new THREE47.Vector3;for (const axis of ["x", "y", "z"]) {if (a.min[axis] > b.max[axis])delta[axis] = b.max[axis] - a.min[axis];@@ -29801,7 +30072,7 @@ function snapTo(part, host, options = {}) {delta[dominant] = -overlap;const parent = part.parent;if (parent) {- const p0 = new THREE46.Vector3;+ const p0 = new THREE47.Vector3;part.getWorldPosition(p0);const p1 = p0.clone().add(delta);const l0 = parent.worldToLocal(p0.clone());@@ -29836,8 +30107,8 @@ function createLadder(name, options) {throw new RangeError("createLadder rungCount must be an integer from 0 to 10000.");if (widthAxis !== "x" && widthAxis !== "z")throw new RangeError("createLadder widthAxis must be x or z.");- const bottomVec = new THREE46.Vector3;- const topVec = new THREE46.Vector3(...top).sub(new THREE46.Vector3(...bottom));+ const bottomVec = new THREE47.Vector3;+ const topVec = new THREE47.Vector3(...top).sub(new THREE47.Vector3(...bottom));const length = Math.hypot(topVec.x, topVec.y, topVec.z);assertDimension("createLadder endpoint distance", length);if (length <= 0.0001)@@ -29845,7 +30116,7 @@ function createLadder(name, options) {const along = topVec.clone().divideScalar(length);if (widthDirection !== undefined)assertFiniteTriple("createLadder widthDirection", widthDirection);- let across = widthDirection ? new THREE46.Vector3(...widthDirection) : widthAxis === "x" ? new THREE46.Vector3(1, 0, 0) : new THREE46.Vector3(0, 0, 1);+ let across = widthDirection ? new THREE47.Vector3(...widthDirection) : widthAxis === "x" ? new THREE47.Vector3(1, 0, 0) : new THREE47.Vector3(0, 0, 1);const largest = Math.max(Math.abs(across.x), Math.abs(across.y), Math.abs(across.z));if (!largest)throw new RangeError("createLadder widthDirection must be nonzero.");@@ -29855,19 +30126,19 @@ function createLadder(name, options) {if (widthDirection)throw new RangeError("createLadder widthDirection must not be parallel to the endpoints.");const axes = [- new THREE46.Vector3(1, 0, 0),- new THREE46.Vector3(0, 1, 0),- new THREE46.Vector3(0, 0, 1)+ new THREE47.Vector3(1, 0, 0),+ new THREE47.Vector3(0, 1, 0),+ new THREE47.Vector3(0, 0, 1)];across = axes.reduce((best, axis) => Math.abs(axis.dot(along)) < Math.abs(best.dot(along)) ? axis : best);across.addScaledVector(along, -across.dot(along));}across.normalize();const offset = across.clone().multiplyScalar(width / 2);- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;root.position.set(...bottom);- const rotation = new THREE46.Quaternion().setFromRotationMatrix(new THREE46.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();+ const rotation = new THREE47.Quaternion().setFromRotationMatrix(new THREE47.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();stampSemanticMetadataV1(root, {roles: ["ladder"],frames: [@@ -29907,7 +30178,7 @@ function wallWithOpening(name, material, options) {if (opening && openings)throw new TypeError("wallWithOpening: use opening or openings, not both.");const built = buildWallPanels(length, height, thickness, openings ?? (opening ? [opening] : []));- const group = new THREE46.Object3D;+ const group = new THREE47.Object3D;group.name = name;const panel = (suffix, lenStart, lenEnd, yLo, yHi) => {const segLen = lenEnd - lenStart;@@ -29938,7 +30209,7 @@ function room(name, material, options = {}) {parent} = options;const openings = options.openings ?? [{ wall: "front", kind: "door" }];- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;const wall = (suffix, len, axis, pos, which) => {const w = wallWithOpening(`${name}_Wall${suffix}`, material, {@@ -29992,7 +30263,7 @@ function createStairs(name, material, options) {if (Math.abs(totalRise) < 0.0001 || Math.abs(totalRun) < 0.0001) {throw new Error(`createStairs("${name}"): totalRise and totalRun must be non-zero (got rise=${totalRise}, run=${totalRun}).`);}- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;const stepRise = totalRise / steps;const stepRun = totalRun / steps;@@ -30022,7 +30293,7 @@ function requireColor(color, fn) {}function gameMaterial(color, options = {}) {requireColor(color, "gameMaterial");- return new THREE46.MeshStandardMaterial({+ return new THREE47.MeshStandardMaterial({color,metalness: options.metalness ?? 0,roughness: options.roughness ?? 0.8,@@ -30033,7 +30304,7 @@ function gameMaterial(color, options = {}) {}function basicMaterial(color, options = {}) {requireColor(color, "basicMaterial");- return new THREE46.MeshBasicMaterial({+ return new THREE47.MeshBasicMaterial({color,transparent: options.transparent ?? false,opacity: options.opacity ?? 1@@ -30041,18 +30312,18 @@ function basicMaterial(color, options = {}) {}function glassMaterial(color, options = {}) {requireColor(color, "glassMaterial");- return new THREE46.MeshStandardMaterial({+ return new THREE47.MeshStandardMaterial({color,transparent: true,opacity: options.opacity ?? 0.35,roughness: options.roughness ?? 0.1,metalness: options.metalness ?? 0,- side: THREE46.DoubleSide+ side: THREE47.DoubleSide});}function lambertMaterial(color, options = {}) {requireColor(color, "lambertMaterial");- return new THREE46.MeshLambertMaterial({+ return new THREE47.MeshLambertMaterial({color,flatShading: options.flatShading ?? true,emissive: options.emissive ?? 0@@ -30062,12 +30333,12 @@ function threeInterpolation(mode) {if (mode !== undefined && !TRACK_INTERPOLATIONS.includes(mode)) {throw new Error(`Animation interpolation must be one of ${TRACK_INTERPOLATIONS.join(", ")}.`);}- return mode === "STEP" ? THREE46.InterpolateDiscrete : THREE46.InterpolateLinear;+ return mode === "STEP" ? THREE47.InterpolateDiscrete : THREE47.InterpolateLinear;}function interpolatedTrack(Type, name, times, values, interpolation) {if (!isCubicInterpolation(interpolation))return new Type(name, times, values, threeInterpolation(interpolation));- const quaternion = Type === THREE46.QuaternionKeyframeTrack;+ const quaternion = Type === THREE47.QuaternionKeyframeTrack;return useCubicSpline(new Type(name, times, cubicSplineValues(times, values, quaternion ? 4 : 3, interpolation, quaternion)));}function animationNumber(value, label) {@@ -30121,15 +30392,15 @@ function rotationTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "rotation", interpolation);const times = [];const values = [];- const euler = new THREE46.Euler;- const quat = new THREE46.Quaternion;+ const euler = new THREE47.Euler;+ const quat = new THREE47.Quaternion;for (const kf of keyframes) {times.push(kf.time);- euler.set(THREE46.MathUtils.degToRad(kf.rotation[0]), THREE46.MathUtils.degToRad(kf.rotation[1]), THREE46.MathUtils.degToRad(kf.rotation[2]));+ euler.set(THREE47.MathUtils.degToRad(kf.rotation[0]), THREE47.MathUtils.degToRad(kf.rotation[1]), THREE47.MathUtils.degToRad(kf.rotation[2]));quat.setFromEuler(euler);values.push(quat.x, quat.y, quat.z, quat.w);}- return interpolatedTrack(THREE46.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);+ return interpolatedTrack(THREE47.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);}function positionTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "position", interpolation);@@ -30139,7 +30410,7 @@ function positionTrack(jointName, keyframes, interpolation) {times.push(kf.time);values.push(...kf.position);}- return interpolatedTrack(THREE46.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);+ return interpolatedTrack(THREE47.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);}function scaleTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "scale", interpolation);@@ -30149,7 +30420,7 @@ function scaleTrack(jointName, keyframes, interpolation) {times.push(kf.time);values.push(...kf.scale);}- return interpolatedTrack(THREE46.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);+ return interpolatedTrack(THREE47.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);}function createClip(name, duration, tracks, options) {if (typeof name !== "string" || !name.trim())@@ -30162,7 +30433,7 @@ function createClip(name, duration, tracks, options) {const loop = clipLoopOption(options);const names = new Set;for (const track of tracks) {- if (!(track instanceof THREE46.KeyframeTrack))+ if (!(track instanceof THREE47.KeyframeTrack))throw new Error("Animation clip tracks must be KeyframeTrack instances.");if (typeof track.name !== "string")throw new Error("Animation track target/channel must use a string name.");@@ -30176,12 +30447,12 @@ function createClip(name, duration, tracks, options) {throw new Error(`Duplicate animation target/channel: ${track.name}.`);names.add(track.name);const quaternion = channel === "quaternion";- const Type = quaternion ? THREE46.QuaternionKeyframeTrack : THREE46.VectorKeyframeTrack;+ const Type = quaternion ? THREE47.QuaternionKeyframeTrack : THREE47.VectorKeyframeTrack;if (!(track instanceof Type))throw new Error(`Animation channel ${channel} requires ${quaternion ? "QuaternionKeyframeTrack" : "VectorKeyframeTrack"}.`);const cubic = isCubicSplineTrack(track);const mode = track.getInterpolation();- if (!cubic && mode !== THREE46.InterpolateLinear && mode !== THREE46.InterpolateDiscrete) {+ if (!cubic && mode !== THREE47.InterpolateLinear && mode !== THREE47.InterpolateDiscrete) {throw new Error("Animation interpolation must be LINEAR, STEP or CUBICSPLINE (the glTF sampler modes); three.js smooth and Bezier interpolants have no glTF form.");}animationTimes(track.times, track.name);@@ -30204,7 +30475,7 @@ function createClip(name, duration, tracks, options) {throw new Error(`Animation clip duration ${duration} does not include every key of ${track.name}.`);}}- const clip = new THREE46.AnimationClip(name, duration, tracks);+ const clip = new THREE47.AnimationClip(name, duration, tracks);if (loop !== undefined)clip.userData.kilnLoopIntent = loop ? "loop" : "once";return clip;@@ -30281,12 +30552,12 @@ function createInstance(name, source, options = {}) {if (!sourceMesh) {throw new Error(`createInstance("${name}"): source "${source.name}" has no Mesh to clone from`);}- const mesh = new THREE46.Mesh(sourceMesh.geometry, sourceMesh.material);+ const mesh = new THREE47.Mesh(sourceMesh.geometry, sourceMesh.material);mesh.name = `Mesh_${name}`;if (options.position)mesh.position.set(...options.position);if (options.rotation)- mesh.rotation.set(THREE46.MathUtils.degToRad(options.rotation[0]), THREE46.MathUtils.degToRad(options.rotation[1]), THREE46.MathUtils.degToRad(options.rotation[2]));+ mesh.rotation.set(THREE47.MathUtils.degToRad(options.rotation[0]), THREE47.MathUtils.degToRad(options.rotation[1]), THREE47.MathUtils.degToRad(options.rotation[2]));if (options.scale)mesh.scale.set(...options.scale);if (options.parent)@@ -30518,6 +30789,13 @@ function buildSandboxGlobals(usage, options = {}) {bobbingAnimation: wrap("bobbingAnimation", bobbingAnimation),idleBreathing: wrap("idleBreathing", idleBreathing),implicitSurface: wrap("implicitSurface", implicitSurface),+ metaballSurface: wrap("metaballSurface", metaballSurface),+ catmullRomPath: wrap("catmullRomPath", catmullRomPath),+ spiralPath: wrap("spiralPath", spiralPath),+ taperedTube: wrap("taperedTube", taperedTube),+ smoothOrganic: wrap("smoothOrganic", smoothOrganic),+ smoothUnion: wrap("smoothUnion", smoothUnion),+ sphereInside: wrap("sphereInside", sphereInside),sweepProfile: wrap("sweepProfile", sweepProfile),loftProfiles: wrap("loftProfiles", loftProfiles),bend: wrap("bend", bend),@@ -30569,7 +30847,7 @@ function buildSandboxGlobals(usage, options = {}) {countMaterials: wrap("countMaterials", countMaterials),getJointNames: wrap("getJointNames", getJointNames),materialBudgetAdvisory: wrap("materialBudgetAdvisory", materialBudgetAdvisory),- THREE: THREE46,+ THREE: THREE47,Math,console: options.console ?? console};@@ -30601,6 +30879,7 @@ var init_primitives = __esm(() => {init_deform();init_sweep2();init_implicit();+ init_organic();init_profile();init_solids();init_procedural_texture();@@ -30628,6 +30907,7 @@ var init_primitives = __esm(() => {init_procedural_texture();init_assembly();init_implicit();+ init_organic();init_sweep2();init_deform();init_geometry();@@ -30940,7 +31220,7 @@ import {PropertyType as PropertyType4} from "@gltf-transform/core";import { createTransform, dequantizePrimitive, joinPrimitives } from "@gltf-transform/functions";-import * as THREE47 from "three";+import * as THREE48 from "three";function isSingular(matrix) {const e = matrix.elements;const scale = Math.hypot(e[0], e[1], e[2]) * Math.hypot(e[4], e[5], e[6]) * Math.hypot(e[8], e[9], e[10]);@@ -31058,10 +31338,10 @@ function reverseWinding(prim) {}}function bake(prim, matrix) {- const linear = new THREE47.Matrix3().setFromMatrix4(matrix);- const normalMatrix = new THREE47.Matrix3().getNormalMatrix(matrix);+ const linear = new THREE48.Matrix3().setFromMatrix4(matrix);+ const normalMatrix = new THREE48.Matrix3().getNormalMatrix(matrix);const mirrored = matrix.determinant() < 0;- const v = new THREE47.Vector3;+ const v = new THREE48.Vector3;const each = (semantic, apply) => {const attribute = prim.getAttribute(semantic);const element = [];@@ -31085,7 +31365,7 @@ function destinationOf(entries) {let best = Infinity;let bestScale = Infinity;for (const { node } of entries) {- const linear = new THREE47.Matrix3().setFromMatrix4(worldOf(node));+ const linear = new THREE48.Matrix3().setFromMatrix4(worldOf(node));const norm = Math.hypot(...linear.elements);const inverseNorm = Math.hypot(...linear.clone().invert().elements);const condition = norm * inverseNorm;@@ -31099,9 +31379,9 @@ function destinationOf(entries) {return chosen;}function checkPositionPrecision(input, output, sourceWorld, destinationWorld, reversed) {- const expected = new THREE47.Vector3;- const actual = new THREE47.Vector3;- const bounds = new THREE47.Box3;+ const expected = new THREE48.Vector3;+ const actual = new THREE48.Vector3;+ const bounds = new THREE48.Box3;const element = [];let error = 0;let magnitude = 0;@@ -31422,7 +31702,7 @@ function rigidMerge(options = {}, onSummary) {onSummary?.(summary);});}-var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE47.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {+var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE48.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {const indices = prim.getIndices();return indices ? [...prim.listAttributes(), indices] : prim.listAttributes();}, primitiveBytes = (primitives) => [...new Set(primitives.flatMap(accessorsOf))].reduce((sum, a) => sum + (a.getArray()?.byteLength ?? 0), 0), countPrimitives = (nodes) => [...nodes].reduce((sum, node) => sum + (node.getMesh()?.listPrimitives().length ?? 0), 0);@@ -32772,7 +33052,7 @@ var init_kit = __esm(() => {// src/texture-bake.tsimport { createHash as createHash8 } from "node:crypto";-import * as THREE48 from "three";+import * as THREE49 from "three";function readPixels(texture) {const image = texture.image;if (!image)@@ -32899,7 +33179,7 @@ async function bakeSceneTextures(root, warnings) {mime: "image/png",bytes};- const colorSpace = entry.texture.colorSpace === THREE48.SRGBColorSpace ? "srgb" : "linear";+ const colorSpace = entry.texture.colorSpace === THREE49.SRGBColorSpace ? "srgb" : "linear";const recipe = entry.texture.userData["kilnProcedural"];const primaryUsage = atlasRecord?.spec.usage ?? recipe?.usage ?? (entry.bindings.some(({ slot }) => slot === "roughnessMap") && entry.bindings.some(({ slot }) => slot === "metalnessMap") ? "metallicRoughness" : entry.bindings[0]?.usage ?? "albedo");if (!encoded)@@ -32982,10 +33262,10 @@ function computeTangentBasis(geometry) {}}const out = new Float32Array(vertexCount * 4);- const n = new THREE48.Vector3;- const t = new THREE48.Vector3;- const tmp = new THREE48.Vector3;- const tmp2 = new THREE48.Vector3;+ const n = new THREE49.Vector3;+ const t = new THREE49.Vector3;+ const tmp = new THREE49.Vector3;+ const tmp2 = new THREE49.Vector3;for (let v = 0;v < vertexCount; v++) {n.set(normal.getX(v), normal.getY(v), normal.getZ(v));t.set(tan1[v * 3], tan1[v * 3 + 1], tan1[v * 3 + 2]);@@ -33005,7 +33285,7 @@ function computeTangentBasis(geometry) {out[v * 4 + 2] = tmp.z;out[v * 4 + 3] = w;}- geometry.setAttribute("tangent", new THREE48.BufferAttribute(out, 4));+ geometry.setAttribute("tangent", new THREE49.BufferAttribute(out, 4));}function ensureNormalMapTangents(root, warnings) {let count = 0;@@ -33123,7 +33403,7 @@ var init_exporter_node = __esm(() => {});// src/views/character.ts-import * as THREE49 from "three";+import * as THREE50 from "three";function rounded(value) {const result = Math.round(value * 1e9) / 1e9;return Object.is(result, -0) ? 0 : result;@@ -33165,9 +33445,9 @@ function buildCharacterDiagnosticDescriptor(root, findings = []) {const invalidPaths = new Set(invalidFindingNodePaths);const joints = evidence.map((joint) => {const relative = rootInverse.clone().multiply(joint.node.matrixWorld);- const position = new THREE49.Vector3().setFromMatrixPosition(relative);- const forward = new THREE49.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);- const bend = new THREE49.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);+ const position = new THREE50.Vector3().setFromMatrixPosition(relative);+ const forward = new THREE50.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);+ const bend = new THREE50.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);const chainId = chainIdFor(joint.descriptor, descriptorByRole);return {role: joint.descriptor.role,@@ -34149,11 +34429,11 @@ import {PropertyBinding as PropertyBinding3,VectorKeyframeTrack as VectorKeyframeTrack2,Quaternion as Quaternion19,- Vector3 as Vector338,+ Vector3 as Vector339,InterpolateDiscrete as InterpolateDiscrete2,InterpolateLinear as InterpolateLinear2} from "three";-function record8(value) {+function record9(value) {return typeof value === "object" && value !== null && !Array.isArray(value);}function withLoopIntent(clip, intent) {@@ -34162,10 +34442,10 @@ function withLoopIntent(clip, intent) {return clip;}function reviewClipsFromExtras(extras) {- if (!record8(extras))+ if (!record9(extras))return;const envelope = extras[REVIEW_CLIPS_EXTRAS_KEY];- if (!record8(envelope) || envelope.version !== 1 && envelope.version !== 2 || !Array.isArray(envelope.clips)) {+ if (!record9(envelope) || envelope.version !== 1 && envelope.version !== 2 || !Array.isArray(envelope.clips)) {return;}const cubicAllowed = envelope.version === 2;@@ -34174,12 +34454,12 @@ function reviewClipsFromExtras(extras) {}let trackCount = 0;return envelope.clips.map((candidate) => {- if (!record8(candidate) || typeof candidate.name !== "string" || candidate.name.length > 256 || typeof candidate.duration !== "number" || !Number.isFinite(candidate.duration) || candidate.duration < 0 || !Array.isArray(candidate.tracks)) {+ if (!record9(candidate) || typeof candidate.name !== "string" || candidate.name.length > 256 || typeof candidate.duration !== "number" || !Number.isFinite(candidate.duration) || candidate.duration < 0 || !Array.isArray(candidate.tracks)) {throw new GlbGeometryFlatError("GLB_FLAT_PARSE_FAILED", "Invalid animation review clip.");}const tracks = candidate.tracks.map((track) => {trackCount++;- if (trackCount > REVIEW_CLIP_LIMITS.tracks || !record8(track) || typeof track.name !== "string" || track.name.length > 512 || !Array.isArray(track.times) || !Array.isArray(track.values) || track.interpolation !== undefined && track.interpolation !== "LINEAR" && track.interpolation !== "STEP" && !(cubicAllowed && track.interpolation === "CUBICSPLINE") || track.times.length > REVIEW_CLIP_LIMITS.samplesPerTrack || track.values.length > REVIEW_CLIP_LIMITS.valuesPerTrack || !track.times.every((value) => typeof value === "number" && Number.isFinite(value)) || !track.values.every((value) => typeof value === "number" && Number.isFinite(value))) {+ if (trackCount > REVIEW_CLIP_LIMITS.tracks || !record9(track) || typeof track.name !== "string" || track.name.length > 512 || !Array.isArray(track.times) || !Array.isArray(track.values) || track.interpolation !== undefined && track.interpolation !== "LINEAR" && track.interpolation !== "STEP" && !(cubicAllowed && track.interpolation === "CUBICSPLINE") || track.times.length > REVIEW_CLIP_LIMITS.samplesPerTrack || track.values.length > REVIEW_CLIP_LIMITS.valuesPerTrack || !track.times.every((value) => typeof value === "number" && Number.isFinite(value)) || !track.values.every((value) => typeof value === "number" && Number.isFinite(value))) {throw new GlbGeometryFlatError("GLB_FLAT_PARSE_FAILED", "Invalid animation review track.");}const property = track.name.slice(track.name.lastIndexOf(".") + 1);@@ -34333,7 +34613,7 @@ function instanceMatrices(node) {translations?.getElement(index, translation);rotations?.getElement(index, rotation);scales?.getElement(index, scale);- const local = new Matrix417().compose(new Vector338(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion19(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector338(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));+ const local = new Matrix417().compose(new Vector339(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion19(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector339(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));matrices.push(world.clone().multiply(local));}return { matrices, count };@@ -34440,7 +34720,7 @@ function localInstanceMatrices(node) {translations?.getElement(index, translation);rotations?.getElement(index, rotation);scales?.getElement(index, scale);- return new Matrix417().compose(new Vector338(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion19(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector338(...scales ? scale.slice(0, 3) : [1, 1, 1]));+ return new Matrix417().compose(new Vector339(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion19(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector339(...scales ? scale.slice(0, 3) : [1, 1, 1]));});}async function loadGlbReviewScene(bytes) {@@ -34522,10 +34802,14 @@ function reviewSceneFromDocument(document) {if (normal) {geometry.setAttribute("normal", new BufferAttribute12(Float32Array.from(decodedAccessor(normal)), 3));}- const uv = primitive.getAttribute("TEXCOORD_0");- if (uv) {- geometry.setAttribute("uv", new BufferAttribute12(Float32Array.from(decodedAccessor(uv)), 2));+ for (let channel = 0;channel < 4; channel++) {+ const uv = primitive.getAttribute(`TEXCOORD_${channel}`);+ if (uv)+ geometry.setAttribute(channel ? `uv${channel}` : "uv", new BufferAttribute12(Float32Array.from(decodedAccessor(uv)), 2));}+ const color = primitive.getAttribute("COLOR_0");+ if (color)+ geometry.setAttribute("color", new BufferAttribute12(Float32Array.from(decodedAccessor(color)), color.getElementSize()));const tangent = primitive.getAttribute("TANGENT");if (tangent) {geometry.setAttribute("tangent", new BufferAttribute12(Float32Array.from(decodedAccessor(tangent)), 4));@@ -34571,6 +34855,7 @@ function reviewSceneFromDocument(document) {geometry.setAttribute("skinWeight", new BufferAttribute12(Float32Array.from(decodedAccessor(skinWeights)), 4));}const threeMaterial = new MeshStandardMaterial5({+ vertexColors: color !== null,opacity: flat.opacity,transparent: flat.alphaMode === "BLEND",alphaTest: flat.alphaMode === "MASK" ? flat.alphaCutoff : 0,@@ -34755,6 +35040,7 @@ var init_glb = __esm(() => {// src/evaluator/handler.tsvar init_handler = __esm(() => {init_authoring_diagnostic();+ init_solid_diagnostic();init_render();init_run();init_protocol();@@ -34764,6 +35050,7 @@ var init_handler = __esm(() => {var DEFAULT_MAX_GLB_BYTES, DEFAULT_MAX_RESPONSE_BYTES, MAX_STDERR_BYTES;var init_subprocess = __esm(() => {init_authoring_diagnostic();+ init_solid_diagnostic();init_run();init_requirements_context();init_material_library_node();@@ -34807,7 +35094,7 @@ var init_renderer_id = __esm(() => {});// src/views/scene-raster.ts-import * as THREE50 from "three";+import * as THREE51 from "three";var DEG2;var init_scene_raster = __esm(() => {init_evaluator();@@ -34819,18 +35106,18 @@ var init_scene_raster = __esm(() => {});// src/views/vehicle.ts-import * as THREE51 from "three";+import * as THREE52 from "three";function hasRole2(node, prefix) {return readSemanticMetadataV1(node)?.roles.some((role) => role === prefix || role.startsWith(`${prefix}.`)) ?? false;}function chassisBounds(root, inverse) {- const bounds = new THREE51.Box3;+ const bounds = new THREE52.Box3;let found = false;root.traverse((node) => {if (!hasRole2(node, "chassis"))return;node.traverse((part) => {- if (!(part instanceof THREE51.Mesh) || !(part.geometry instanceof THREE51.BufferGeometry))+ if (!(part instanceof THREE52.Mesh) || !(part.geometry instanceof THREE52.BufferGeometry))return;part.geometry.computeBoundingBox();const box = part.geometry.boundingBox;@@ -34840,7 +35127,7 @@ function chassisBounds(root, inverse) {for (const x of [box.min.x, box.max.x])for (const y of [box.min.y, box.max.y])for (const z of [box.min.z, box.max.z]) {- bounds.expandByPoint(new THREE51.Vector3(x, y, z).applyMatrix4(matrix));+ bounds.expandByPoint(new THREE52.Vector3(x, y, z).applyMatrix4(matrix));found = true;}});@@ -34908,33 +35195,33 @@ function tagDiagnostic(node, role) {stampSemanticMetadataV1(node, { roles: [role] });}function rod(name, start, end, radius, color, role) {- const from = new THREE51.Vector3(...start);- const to = new THREE51.Vector3(...end);+ const from = new THREE52.Vector3(...start);+ const to = new THREE52.Vector3(...end);const direction = to.clone().sub(from);const length = direction.length();- const geometry = length > 0.000000001 ? new THREE51.CylinderGeometry(radius, radius, length, 8) : new THREE51.SphereGeometry(radius, 8, 6);- const result = new THREE51.Mesh(geometry, new THREE51.MeshBasicMaterial({ color }));+ const geometry = length > 0.000000001 ? new THREE52.CylinderGeometry(radius, radius, length, 8) : new THREE52.SphereGeometry(radius, 8, 6);+ const result = new THREE52.Mesh(geometry, new THREE52.MeshBasicMaterial({ color }));result.name = name;result.position.copy(from).add(to).multiplyScalar(0.5);if (length > 0.000000001) {- result.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));+ result.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));}tagDiagnostic(result, role);return result;}function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnostics(root)) {- const overlay = new THREE51.Group;+ const overlay = new THREE52.Group;overlay.name = "VehicleDiagnosticOverlay";const chassisSpan = descriptor.chassisBox ? Math.max(descriptor.chassisBox.max[0] - descriptor.chassisBox.min[0], descriptor.chassisBox.max[1] - descriptor.chassisBox.min[1], descriptor.chassisBox.max[2] - descriptor.chassisBox.min[2]) : 1;const thickness = Math.max(0.01, chassisSpan * 0.008);- const arrow = new THREE51.Group;+ const arrow = new THREE52.Group;arrow.name = "Diagnostic_Forward_+X";tagDiagnostic(arrow, "diagnostic.vehicle.forward");arrow.add(rod("Diagnostic_Forward_Shaft", descriptor.forwardArrow.start, [descriptor.forwardArrow.end[0] - 0.12, 0, 0], thickness, 16724804, "diagnostic.vehicle.forward"));- const arrowHead = new THREE51.Mesh(new THREE51.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE51.MeshBasicMaterial({ color: 16724804 }));+ const arrowHead = new THREE52.Mesh(new THREE52.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE52.MeshBasicMaterial({ color: 16724804 }));arrowHead.name = "Diagnostic_Forward_Head";arrowHead.position.set(descriptor.forwardArrow.end[0] - 0.12, 0, 0);- arrowHead.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 1, 0), new THREE51.Vector3(1, 0, 0));+ arrowHead.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 1, 0), new THREE52.Vector3(1, 0, 0));tagDiagnostic(arrowHead, "diagnostic.vehicle.forward");arrow.add(arrowHead);overlay.add(arrow);@@ -34942,18 +35229,18 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnooverlay.add(rod(`Diagnostic_Axle_${axle.id}`, axle.start, axle.end, thickness, 3386111, `diagnostic.vehicle.axle.${axle.id}`));}for (const wheel of descriptor.wheels) {- const ring = new THREE51.Mesh(new THREE51.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE51.MeshBasicMaterial({ color: 16763955 }));+ const ring = new THREE52.Mesh(new THREE52.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE52.MeshBasicMaterial({ color: 16763955 }));ring.name = `Diagnostic_Wheel_${wheel.id}`;ring.position.set(...wheel.center);- const axle = new THREE51.Vector3(...wheel.axle);+ const axle = new THREE52.Vector3(...wheel.axle);if (axle.lengthSq() > 0.000000000001) {- ring.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 0, 1), axle.normalize());+ ring.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 0, 1), axle.normalize());}tagDiagnostic(ring, `diagnostic.vehicle.wheel.${wheel.id}`);overlay.add(ring);}if (descriptor.chassisBox) {- const chassis = new THREE51.Group;+ const chassis = new THREE52.Group;chassis.name = "Diagnostic_ChassisBox";tagDiagnostic(chassis, "diagnostic.vehicle.chassis");const { min, max } = descriptor.chassisBox;@@ -34987,7 +35274,7 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnooverlay.add(chassis);}if (descriptor.supportPlaneY !== undefined) {- const plane = new THREE51.Group;+ const plane = new THREE52.Group;plane.name = "Diagnostic_SupportPlane";tagDiagnostic(plane, "diagnostic.vehicle.support-plane");const halfX = Math.max(1, ...descriptor.chassisBox ? [Math.abs(descriptor.chassisBox.min[0]), Math.abs(descriptor.chassisBox.max[0])] : [], ...descriptor.wheels.map((wheel) => Math.abs(wheel.center[0]) + wheel.radius)) + 0.2;@@ -35585,7 +35872,7 @@ var init_views = __esm(() => {});// src/views/character-capture.ts-import * as THREE52 from "three";+import * as THREE53 from "three";function drawLine2(rgb, width, height, from, to, color) {let x0 = Math.round(from[0]);let y0 = Math.round(from[1]);@@ -35622,22 +35909,22 @@ function drawCross(rgb, width, height, point, color, radius = 3) {}function projector(root, cameraId, size) {root.updateMatrixWorld(true);- const bounds = new THREE52.Box3().setFromObject(root);+ const bounds = new THREE53.Box3().setFromObject(root);if (bounds.isEmpty())- bounds.set(new THREE52.Vector3(-0.5, 0, -0.5), new THREE52.Vector3(0.5, 1, 0.5));- const center = bounds.getCenter(new THREE52.Vector3);- const camera = cameraId === "front" ? new THREE52.Vector3(1, 0, 0) : new THREE52.Vector3(0, 0, 1);- const upHint = new THREE52.Vector3(0, 1, 0);- const xAxis = new THREE52.Vector3().crossVectors(upHint, camera).normalize();- const yAxis = new THREE52.Vector3().crossVectors(camera, xAxis).normalize();+ bounds.set(new THREE53.Vector3(-0.5, 0, -0.5), new THREE53.Vector3(0.5, 1, 0.5));+ const center = bounds.getCenter(new THREE53.Vector3);+ const camera = cameraId === "front" ? new THREE53.Vector3(1, 0, 0) : new THREE53.Vector3(0, 0, 1);+ const upHint = new THREE53.Vector3(0, 1, 0);+ const xAxis = new THREE53.Vector3().crossVectors(upHint, camera).normalize();+ const yAxis = new THREE53.Vector3().crossVectors(camera, xAxis).normalize();let extent = 0.000001;for (let corner = 0;corner < 8; corner++) {- const point = new THREE52.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);+ const point = new THREE53.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);extent = Math.max(extent, Math.abs(point.dot(xAxis)), Math.abs(point.dot(yAxis)));}const scale = size * 0.45 / extent;return (assetPoint) => {- const world = new THREE52.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);+ const world = new THREE53.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);return [size / 2 + world.dot(xAxis) * scale, size / 2 - world.dot(yAxis) * scale];};}@@ -35763,7 +36050,7 @@ var init_character_capture = __esm(() => {});// src/render.ts-import * as THREE53 from "three";+import * as THREE54 from "three";import { Document, Logger } from "@gltf-transform/core";import { KHRMaterialsEmissiveStrength } from "@gltf-transform/extensions";import { dedup, instance, palette, weld as weld2, prune, mergeDocuments } from "@gltf-transform/functions";@@ -35983,7 +36270,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)} else if (stdMat.transparent) {mat.setAlphaMode("BLEND");}- if (stdMat.side === THREE53.DoubleSide) {+ if (stdMat.side === THREE54.DoubleSide) {mat.setDoubleSided(true);}if (stdMat.map) {@@ -36060,7 +36347,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)} else if (common.transparent || (common.opacity ?? 1) < 1) {mat.setAlphaMode("BLEND");}- if (threeMat.side === THREE53.DoubleSide)+ if (threeMat.side === THREE54.DoubleSide)mat.setDoubleSided(true);if (common.map && !mat.getBaseColorTexture()) {const texture = bridgeTexture(doc, common.map, textureCache);@@ -36210,7 +36497,7 @@ function bridgeNode(doc, buf, threeObj, matCache, nodeMap, meshCache, texCache,const cacheKey = `kiln-sprite-quad:${centerX}:${centerY}:${rotation}__${threeMat.uuid}`;let gtMesh = meshCache.get(cacheKey);if (!gtMesh) {- const geometry = new THREE53.PlaneGeometry(1, 1);+ const geometry = new THREE54.PlaneGeometry(1, 1);if (centerX !== 0.5 || centerY !== 0.5) {geometry.translate(0.5 - centerX, 0.5 - centerY, 0);}@@ -36234,9 +36521,9 @@ function animationInterpolation(track) {if (isCubicSplineTrack(track))return "CUBICSPLINE";const mode = track.getInterpolation();- if (mode === THREE53.InterpolateDiscrete)+ if (mode === THREE54.InterpolateDiscrete)return "STEP";- if (mode === THREE53.InterpolateLinear)+ if (mode === THREE54.InterpolateLinear)return "LINEAR";throw new Error(`Unsupported animation interpolation on ${track.name}; use LINEAR, STEP or CUBICSPLINE.`);}@@ -36796,8 +37083,8 @@ function collectMeshStats(root) {if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {return;}- const center = new THREE53.Vector3;- const size = new THREE53.Vector3;+ const center = new THREE54.Vector3;+ const size = new THREE54.Vector3;box.getCenter(center);box.getSize(size);out.push({@@ -36812,7 +37099,7 @@ function collectMeshStats(root) {return out;}function minimalGapVector(a, b) {- const v = new THREE53.Vector3;+ const v = new THREE54.Vector3;for (const axis of ["x", "y", "z"]) {if (a.min[axis] > b.max[axis])v[axis] = b.max[axis] - a.min[axis];@@ -36830,10 +37117,10 @@ function inspectSceneStructure(root, opts = {}) {return warnings;const cat = opts.category?.toLowerCase();if (cat === "vehicle" || cat === "weapon" || cat === "boat" || cat === "aircraft") {- const all = new THREE53.Box3;+ const all = new THREE54.Box3;for (const m of meshes)all.union(m.box);- const size = new THREE53.Vector3;+ const size = new THREE54.Vector3;all.getSize(size);if (cat === "aircraft") {if (size.y > size.x * 1.2) {@@ -36943,18 +37230,18 @@ var init_render = __esm(() => {init_texture_bake();engineIO = createGltfIO;GLTF_MIN_FILTER = {- [THREE53.NearestFilter]: 9728,- [THREE53.LinearFilter]: 9729,- [THREE53.NearestMipmapNearestFilter]: 9984,- [THREE53.LinearMipmapNearestFilter]: 9985,- [THREE53.NearestMipmapLinearFilter]: 9986,- [THREE53.LinearMipmapLinearFilter]: 9987- };- GLTF_MAG_FILTER = { [THREE53.NearestFilter]: 9728, [THREE53.LinearFilter]: 9729 };+ [THREE54.NearestFilter]: 9728,+ [THREE54.LinearFilter]: 9729,+ [THREE54.NearestMipmapNearestFilter]: 9984,+ [THREE54.LinearMipmapNearestFilter]: 9985,+ [THREE54.NearestMipmapLinearFilter]: 9986,+ [THREE54.LinearMipmapLinearFilter]: 9987+ };+ GLTF_MAG_FILTER = { [THREE54.NearestFilter]: 9728, [THREE54.LinearFilter]: 9729 };GLTF_WRAP = {- [THREE53.ClampToEdgeWrapping]: 33071,- [THREE53.MirroredRepeatWrapping]: 33648,- [THREE53.RepeatWrapping]: 10497+ [THREE54.ClampToEdgeWrapping]: 33071,+ [THREE54.MirroredRepeatWrapping]: 33648,+ [THREE54.RepeatWrapping]: 10497};REVIEW_CLIP_LIMITS2 = {clips: 32,@@ -36984,6 +37271,7 @@ var init_protocol = __esm(() => {init_material_library_node();init_material_library();init_rebuild_options();+ init_solid_diagnostic();MAX_EVALUATOR_CODE_BYTES = 512 * 1024;MAX_EVALUATOR_REQUEST_BYTES = 24 * 1024 * 1024;DEFAULT_EVALUATOR_MAX_GLB_BYTES = 16 * 1024 * 1024;@@ -37002,10 +37290,12 @@ var init_protocol = __esm(() => {EvaluatorPortError = class EvaluatorPortError extends Error {code;diagnostic;- constructor(code, message = evaluatorOutcomeMessage(code), diagnostic) {- super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);+ solid;+ constructor(code, message = evaluatorOutcomeMessage(code), diagnostic, solid) {+ super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}${solidFailureAdvice(solid)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);this.code = code;this.diagnostic = diagnostic;+ this.solid = solid;this.name = "EvaluatorPortError";}};@@ -37037,7 +37327,7 @@ import {KHRTextureBasisu as KHRTextureBasisu2} from "@gltf-transform/extensions";import { dedup as dedup2, quantize, reorder } from "@gltf-transform/functions";-import * as THREE54 from "three";+import * as THREE55 from "three";function meshSignature(mesh, ids) {const id = (property) => {if (!property)@@ -37145,8 +37435,8 @@ async function encodeKtx2(doc, encoder) {return { status: "encoded", textures: textures.length };}function decomposeDelta(before, after) {- const delta = new THREE54.Matrix4().fromArray(before).invert().multiply(new THREE54.Matrix4().fromArray(after));- const position = new THREE54.Vector3, quaternion = new THREE54.Quaternion, scale = new THREE54.Vector3;+ const delta = new THREE55.Matrix4().fromArray(before).invert().multiply(new THREE55.Matrix4().fromArray(after));+ const position = new THREE55.Vector3, quaternion = new THREE55.Quaternion, scale = new THREE55.Vector3;delta.decompose(position, quaternion, scale);return {scale: scale.x,@@ -37199,7 +37489,7 @@ async function deliverRuntimeThreeGlb(bytes, meshoptEncoder, options = {}) {const original = matrices.get(node);const moved = original === undefined;const split = moved || proxyNodes.has(node);- const reference = moved ? new THREE54.Matrix4().identity().toArray() : original;+ const reference = moved ? new THREE55.Matrix4().identity().toArray() : original;const current = [...node.getMatrix()];const { scale, offset } = decomposeDelta(reference, current);if (!moved && Math.abs(scale - 1) < 0.000000000001 && offset.every((v) => v === 0))@@ -37595,7 +37885,7 @@ async function captureViewsViaPort(port, glb, timeoutMs = DEFAULT_VIEW_RENDER_TIlet rendererId = "";const grid = await renderCaptureGrid(loaded.root, capture, async (input) => {execution?.signal?.throwIfAborted();- const derivative = await renderSceneToGLB(withoutHiddenMeshes(input.root), { derivative: true });+ const derivative = await renderSceneToGLB(withoutHiddenMeshes(input.root), { derivative: true, gltfExporter: "three" });const result = await captureViewPngsViaPort(port, derivative.bytes, timeoutMs, [input.view.dir], input.size, [input.camera], limits, input.backdrop, execution);if (!result.ok)throw new Error(result.reason);@@ -37697,12 +37987,12 @@ var exports_part_placement = {};__export(exports_part_placement, {createPartPlacementReader: () => createPartPlacementReader});-import * as THREE55 from "three";+import * as THREE56 from "three";function createPartPlacementReader(root) {const bounds = createPartBoundsReader(root);- const position = new THREE55.Vector3;- const quaternion = new THREE55.Quaternion;- const scale = new THREE55.Vector3;+ const position = new THREE56.Vector3;+ const quaternion = new THREE56.Quaternion;+ const scale = new THREE56.Vector3;return (node) => {node.matrixWorld.decompose(position, quaternion, scale);const box = bounds(node);@@ -37853,7 +38143,7 @@ var init_inspect = __esm(() => {});// src/views/measurement.ts-import { Box3 as Box326, Vector3 as Vector344 } from "three";+import { Box3 as Box326, Vector3 as Vector345 } from "three";function describeSubjectFrame(root, subject) {const selected = selectCameraSubject(root, subject);selected.node.updateWorldMatrix(true, true);@@ -37870,10 +38160,10 @@ function describeSubjectFrame(root, subject) {if (!attr)return;for (let i = 0;i < attr.count; i++)- local.expandByPoint(new Vector344().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));+ local.expandByPoint(new Vector345().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));});const box = (b) => b.isEmpty() ? null : { min: b.min.toArray(), max: b.max.toArray() };- const axis = (i) => new Vector344().setFromMatrixColumn(matrix, i).normalize().toArray();+ const axis = (i) => new Vector345().setFromMatrixColumn(matrix, i).normalize().toArray();return {path: selected.path,name: selected.name,@@ -37883,7 +38173,7 @@ function describeSubjectFrame(root, subject) {invertible,worldMatrix: matrix.toArray(),axes: { frame: "world", x: axis(0), y: axis(1), z: axis(2) },- origin: new Vector344().setFromMatrixPosition(matrix).toArray()+ origin: new Vector345().setFromMatrixPosition(matrix).toArray()};}function measureAttachment(root, input) {@@ -37896,7 +38186,7 @@ function measureAttachment(root, input) {return {path: selected.path,local: [...local],- world: new Vector344(...local).applyMatrix4(selected.node.matrixWorld).toArray()+ world: new Vector345(...local).applyMatrix4(selected.node.matrixWorld).toArray()};};const from = endpoint(input.from), to = endpoint(input.to);@@ -37906,7 +38196,7 @@ function measureAttachment(root, input) {method: "straight-line anchor distance",from,to,- distance: new Vector344(...from.world).distanceTo(new Vector344(...to.world))+ distance: new Vector345(...from.world).distanceTo(new Vector345(...to.world))};}var init_measurement = __esm(() => {@@ -37918,7 +38208,7 @@ import {PropertyType as PropertyType6} from "@gltf-transform/core";import { ALL_EXTENSIONS as ALL_EXTENSIONS2 } from "@gltf-transform/extensions";-import { Box3 as Box327, Matrix4 as Matrix419, Vector3 as Vector345 } from "three";+import { Box3 as Box327, Matrix4 as Matrix419, Vector3 as Vector346 } from "three";async function accessorFingerprint(accessor) {const array = accessor?.getArray();if (!accessor || !array)@@ -37937,7 +38227,7 @@ function bounds(box) {return box.isEmpty() ? null : {min: box.min.toArray(),max: box.max.toArray(),- size: box.getSize(new Vector345).toArray()+ size: box.getSize(new Vector346).toArray()};}async function digest3(bytes) {@@ -38009,7 +38299,7 @@ async function snapshot3(bytes) {if (!Number.isInteger(vertex) || vertex < 0 || vertex >= position.getCount())throw new Error("Revision comparison found an invalid vertex index.");position.getElement(vertex, element);- const point = new Vector345(...element).applyMatrix4(matrix);+ const point = new Vector346(...element).applyMatrix4(matrix);if (point.toArray().some((value) => !Number.isFinite(value)))throw new Error("Revision comparison requires finite positions.");own.expandByPoint(point);@@ -38203,7 +38493,7 @@ import {Matrix4 as Matrix420,Ray as Ray2,Triangle as Triangle2,- Vector3 as Vector346+ Vector3 as Vector347} from "three";function hierarchy(triangles) {const box = new Box328;@@ -38212,7 +38502,7 @@ function hierarchy(triangles) {const count = triangles.length;if (count <= 4)return { box, count, triangles };- const size = box.getSize(new Vector346);+ const size = box.getSize(new Vector347);const axis = size.x >= size.y && size.x >= size.z ? "x" : size.y >= size.z ? "y" : "z";const center = (triangle) => triangle.box.min[axis] / 2 + triangle.box.max[axis] / 2;triangles.sort((a, b) => center(a) - center(b));@@ -38264,7 +38554,7 @@ function collect(node, paths) {const id = index ? index.getX(i + offset) : i + offset;if (!Number.isSafeInteger(id) || id < 0 || id >= position.count)throw new Error("Surface distance encountered an invalid triangle index.");- const point = new Vector346().fromBufferAttribute(position, id).applyMatrix4(matrix);+ const point = new Vector347().fromBufferAttribute(position, id).applyMatrix4(matrix);if (![point.x, point.y, point.z].every(Number.isFinite))throw new Error("Surface distance encountered a non-finite world position.");return point;@@ -38323,10 +38613,10 @@ function trianglePair(a, b) {const av = [a.a, a.b, a.c], bv = [b.a, b.b, b.c];if (b.getArea() > 0)for (const p of av)- record(p, b.closestPointToPoint(p, new Vector346));+ record(p, b.closestPointToPoint(p, new Vector347));if (a.getArea() > 0)for (const q of bv)- record(a.closestPointToPoint(q, new Vector346), q);+ record(a.closestPointToPoint(q, new Vector347), q);for (let i = 0;i < 3; i++) {const p = av[i], q = av[(i + 1) % 3];for (let j = 0;j < 3; j++)@@ -38339,9 +38629,9 @@ function trianglePair(a, b) {const length = delta.length();if (length === 0)continue;- const hit = new Ray2(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector346);+ const hit = new Ray2(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector347);if (hit && origin.distanceTo(hit) <= length) {- const onFace = target.closestPointToPoint(hit, new Vector346);+ const onFace = target.closestPointToPoint(hit, new Vector347);if (vertices === av)record(hit, onFace);else@@ -38507,7 +38797,7 @@ __export(exports_draw_diagnostics, {});import { Primitive as Primitive3 } from "@gltf-transform/core";import { cloneDocument } from "@gltf-transform/functions";-import * as THREE56 from "three";+import * as THREE57 from "three";function withinLimits(doc) {const root = doc.getRoot();if (root.listNodes().length > MAX_NODES2 || root.listAccessors().length > 4096 || root.listMaterials().length > 2048 || root.listTextures().length > 256 || root.listScenes().length > 32 || doc.getGraph().listEdges().length > 32768)@@ -38560,7 +38850,7 @@ function collect2(doc, keep) {function overlaps(a, b) {if (Math.abs(a.normal.dot(b.normal)) < 1 - 0.00000001 || !a.bounds.intersectsBox(b.bounds))return false;- const tolerance = Math.max(a.bounds.getSize(new THREE56.Vector3).length(), b.bounds.getSize(new THREE56.Vector3).length(), 0.000000000001) * 0.000001;+ const tolerance = Math.max(a.bounds.getSize(new THREE57.Vector3).length(), b.bounds.getSize(new THREE57.Vector3).length(), 0.000000000001) * 0.000001;if (b.points.some((p) => Math.abs(a.normal.dot(p.clone().sub(a.points[0]))) > tolerance))return false;const normal = a.normal.toArray().map(Math.abs);@@ -38602,7 +38892,7 @@ function observe(uses) {unexaminedPrimitiveUses++;continue;}- const matrix = new THREE56.Matrix4().fromArray(node.getWorldMatrix());+ const matrix = new THREE57.Matrix4().fromArray(node.getWorldMatrix());if (primitive.getAttribute("TANGENT") && matrix.determinant() < 0)mirrored.set(part.id, part);const position = primitive.getAttribute("POSITION");@@ -38616,14 +38906,14 @@ function observe(uses) {const amount = Math.min(count, 8, MAX_SAMPLES - samples.length);for (let i = 0;i < amount; i++) {const start = Math.floor(i * count / amount) * 3;- const points = [0, 1, 2].map((j) => new THREE56.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));+ const points = [0, 1, 2].map((j) => new THREE57.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));const normal = points[1].clone().sub(points[0]).cross(points[2].clone().sub(points[0]));if (!Number.isFinite(normal.lengthSq()) || normal.lengthSq() === 0)continue;samples.push({points,normal: normal.normalize(),- bounds: new THREE56.Box3().setFromPoints(points),+ bounds: new THREE57.Box3().setFromPoints(points),part});}@@ -38697,7 +38987,26 @@ async function inspectDrawDiagnostics(bytes, options = {}) {if (bytes.byteLength > MAX_BYTES)return skipped("input-limit");try {- return analyzeDrawDiagnostics(await createGltfIO().readBinary(bytes), options);+ const io = createGltfIO();+ const json = await io.binaryToJSON(bytes);+ let expandedBytes = 0;+ let compressed = false;+ for (const view of json.json.bufferViews ?? []) {+ const extension = view.extensions?.["EXT_meshopt_compression"];+ compressed ||= extension !== undefined;+ const length = extension ? (extension.count ?? Number.NaN) * (extension.byteStride ?? Number.NaN) : view.byteLength;+ if (!Number.isSafeInteger(length) || length < 0)+ return skipped("unreadable-glb");+ expandedBytes += length;+ if (expandedBytes > MAX_BYTES)+ return skipped("input-limit");+ }+ if (compressed) {+ const { MeshoptDecoder } = await import("meshoptimizer");+ await MeshoptDecoder.ready;+ io.registerDependencies({ "meshopt.decoder": MeshoptDecoder });+ }+ return analyzeDrawDiagnostics(await io.readJSON(json), options);} catch {return skipped("unreadable-glb");}@@ -40395,6 +40704,70 @@ define2("implicitSurface", {"No CAD accuracy or thin-feature preservation guarantee; requires host execution limits."]});+define2("metaballSurface", {+ ...ownedGeometry,+ execution: "async",+ axes: "Sphere centers use XYZ; positive-inside smooth union.",+ origin: "Explicit sampling bounds min/max define the evaluated region.",+ parameters: [+ "One or more { center, radius } spheres; blend defaults to max(0.35 times the smallest radius, 0.02 scene units).",+ "Same bounds/edgeLength limits as implicitSurface.",+ "Uses implicitSurface defaults of 1,000,000 estimated cells and 8,000,000 field callbacks; explicit maxCells/maxEvaluations ceilings pass through unchanged."+ ],+ topology: ["Resolution-dependent manifold level set; review thin features."],+ preservation: ["No UVs; experimental metadata like implicitSurface."],+ cost: "Implicit grid cost times sphere count; maxEvaluations counts field callbacks, not individual sphere evaluations. Use the host evaluator for process/time limits."+}, {+ references: ["src/organic.ts", "src/implicit.ts"],+ tags: ["metaball", "blob", "organic"],+ aliases: ["smooth blob", "blended spheres"],+ intents: ["author a smooth organic solid from spheres"],+ stability: "experimental",+ related: [{ name: "implicitSurface", relation: "alternative" }]+});+define2("smoothUnion", {+ units: "Blend width uses asset-length units when composed into spatial fields.",+ axes: "Operands are scalar field samples, not mesh coordinates.",+ parameters: ["Finite operands; positive finite blend width."],+ topology: [noMesh],+ preservation: ["Pure scalar helper; no geometry output."],+ cost: "O(1) per sample."+}, {+ references: ["src/sdf.ts"],+ tags: ["sdf", "implicit", "blend"],+ intents: ["smoothly join two positive-inside fields"],+ related: [{ name: "implicitSurface", relation: "companion" }]+});+define2("sphereInside", {+ units: lengthUnits,+ axes: "Center and sample point use XYZ.",+ parameters: ["Positive finite radius; finite center and sample point."],+ topology: [noMesh],+ preservation: ["Scalar field sample only."],+ cost: "O(1) per sample."+}, {+ references: ["src/sdf.ts"],+ tags: ["sdf", "sphere", "field"],+ intents: ["sphere distance field for implicitSurface"],+ related: [{ name: "smoothUnion", relation: "companion" }]+});+define2("smoothOrganic", {+ ...ownedGeometry,+ parameters: [+ "Optional iterations (default 1), creaseAngle (default 55), preserveUV flag.",+ "Subject to subdivide admission budgets."+ ],+ preservation: [+ "Subdivision may drop legacy CSG provenance; creaseNormals invalidates tangents.",+ "Default position-only subdivision drops UVs and material groups; preserveUV: true retains supported corner attributes and material boundaries."+ ],+ cost: "Subdivide estimate applies before work begins."+}, {+ references: ["src/organic.ts", "src/ops.ts", "src/geometry.ts"],+ tags: ["subdivide", "normals", "organic"],+ intents: ["soften an authored mesh for creatures and plants"],+ related: [{ name: "subdivide", relation: "companion" }]+});var nodeFacts = {units: `${lengthUnits} explicit rotation triples use degrees unless stated otherwise.`,axes: "Three.js local XYZ; +Y is the normal up convention.",@@ -41706,6 +42079,69 @@ define2("pipeAlongPath", {{ name: "curveToMesh", relation: "alternative" }]});+define2("catmullRomPath", {+ units: lengthUnits,+ axes: "Control points and output use XYZ.",+ parameters: [+ "At least two open or three closed control points; positive integer samplesPerSpan.",+ "Open output has (controlPoints.length - 1) * samplesPerSpan + 1 stations including endpoints. Closed output has controlPoints.length * samplesPerSpan stations without a repeated endpoint.",+ "Derived sample counts must be safe integers; unsafe products are rejected before sampling."+ ],+ topology: [noMesh],+ preservation: ["Returns a point array for downstream sweeps."],+ cost: "Linear in control points × samplesPerSpan."+}, {+ references: ["src/organic.ts"],+ tags: ["path", "spline", "curve"],+ aliases: ["smooth path samples"],+ intents: ["sample a smooth curve through waypoints"],+ related: [+ { name: "taperedTube", relation: "companion" },+ { name: "sweepProfile", relation: "companion" }+ ]+});+define2("spiralPath", {+ units: lengthUnits,+ axes: "Center, axis, forward and output use XYZ.",+ origin: "Starts radius away from center in the projected forward direction; center is the spiral axis datum.",+ parameters: [+ "Positive radius, rise, and turns; optional sample count (>= 4).",+ "Finite nonzero axis and forward; forward must not be parallel to axis.",+ "Returns samples + 1 stations, rising by rise while radius shrinks linearly to 42% of its initial value.",+ "The derived samples + 1 count must be a safe integer."+ ],+ topology: [noMesh],+ preservation: ["Returns spiral polyline samples for taperedTube or sweepProfile."],+ cost: "Linear in samples."+}, {+ references: ["src/organic.ts"],+ tags: ["path", "spiral", "curve"],+ aliases: ["curl path", "prehensile tail path"],+ intents: ["sample a rising spiral for curled tails and tendrils"],+ related: [+ { name: "catmullRomPath", relation: "alternative" },+ { name: "taperedTube", relation: "companion" }+ ]+});+define2("taperedTube", {+ ...curveFacts,+ parameters: [+ "Polyline path with one positive radius per station.",+ "Closed paths omit the repeated endpoint, matching closed catmullRomPath output.",+ "Optional per-station sectionScale [side, depth] for elliptical cross-sections.",+ "Default creaseAngle 180 for round profiles; radialSegments default 20."+ ],+ preservation: ["UVs and normals like sweepProfile; smooth round shading by default."]+}, {+ references: ["src/organic.ts", "src/sweep.ts"],+ tags: ["tube", "taper", "organic"],+ aliases: ["varying radius tube"],+ intents: ["limb, tail, tentacle or branch with changing thickness"],+ related: [+ { name: "pipeAlongPath", relation: "alternative" },+ { name: "catmullRomPath", relation: "prerequisite" }+ ]+});define2("lathe", {...curveFacts,axes: "Profile x is radius, y is height; spins around Y.",@@ -43969,15 +44405,15 @@ var REQUIREMENTS = {},export: { required: ["projectId"] }};-var record9 = (description) => z15.record(z15.string(), z15.unknown()).optional().describe(description);+var record10 = (description) => z15.record(z15.string(), z15.unknown()).optional().describe(description);function projectToolInput(actions = PROJECT_ACTIONS) {return z15.strictObject({action: z15.enum(actions),projectId: projectIdSchema.optional().describe("get, update, export."),revisionId: projectRevisionIdSchema.optional().describe("get, export: an exact revision; omit for the current one."),expectedRevision: projectRevisionIdSchema.optional().describe("update: the revision being replaced; a stale value is a conflict."),- draft: record9(nestedRecordDescription("create: name, brief, design, inventory, deliveryProfiles, materialDependencies, references, reviews; optional projectId.", "shape:project-draft")),- patch: record9(nestedRecordDescription("update: the same top-level fields as draft; each supplied field replaces its previous value whole.", "shape:project-patch")),+ draft: record10(nestedRecordDescription("create: name, brief, design, inventory, deliveryProfiles, materialDependencies, references, reviews; optional projectId.", "shape:project-draft")),+ patch: record10(nestedRecordDescription("update: the same top-level fields as draft; each supplied field replaces its previous value whole.", "shape:project-patch")),profile: z15.enum(["editable", "runtime"]).optional().describe("export: editable (default) keeps source and resources; runtime is GLB plus metadata.")});}@@ -44328,7 +44764,7 @@ var MATERIAL_CONTRACT = {description: "Import complete normalized material records and embedded PNGs. Does not fetch URLs or execute source."}};-var record10 = (description) => z17.record(z17.string(), z17.unknown()).optional().describe(description);+var record11 = (description) => z17.record(z17.string(), z17.unknown()).optional().describe(description);var tag = z17.string().min(1).max(80).optional().describe("presets, list: keep one tag.");var materialToolInput = z17.strictObject({action: z17.enum(MATERIAL_ACTIONS),@@ -44340,8 +44776,8 @@ var materialToolInput = z17.strictObject({license: materialSourceSchema.shape.license.optional().describe("create-preset: spdx, url and attribution."),materialId: materialLibraryIdSchema.optional().describe("get: the id a project palette lists as resourceId; create-preset: optional id."),revisionId: materialLibraryHashSchema.optional().describe("get: the immutable revision; omitted, the material's only revision."),- draft: record10(nestedRecordDescription("create-procedural: legacy layered draft, or schemaVersion 2 with explicit samplers and RGBA/atlas recipes. Exact atlas sources must exist in this library.", "shape:material-draft")),- payload: record10(nestedRecordDescription("import: schemaVersion 1 or 2, complete normalized records and their exact dependencies with embedded PNG bytes.", "shape:material-import"))+ draft: record11(nestedRecordDescription("create-procedural: legacy layered draft, or schemaVersion 2 with explicit samplers and RGBA/atlas recipes. Exact atlas sources must exist in this library.", "shape:material-draft")),+ payload: record11(nestedRecordDescription("import: schemaVersion 1 or 2, complete normalized records and their exact dependencies with embedded PNG bytes.", "shape:material-import"))});var materialResult = (material) => ({ok: true,@@ -44950,7 +45386,7 @@ function createCachedEvaluatorPort(evaluator, options) {// src/tools/registry.tsinit_validation();-import * as THREE57 from "three";+import * as THREE58 from "three";// src/evaluator/source-check.tsinit_validation();@@ -45311,6 +45747,7 @@ async function renderDerivativeCell(input, context) {derivativeRoot = withoutHiddenMeshes(derivativeRoot);const rendered = await renderSceneToGLB(derivativeRoot, {derivative: true,+ gltfExporter: "three",requirements: toolRequirements(context).binding});await Promise.resolve().then(() => init_views());@@ -45551,8 +45988,8 @@ function collectSceneMetrics(root) {let meshes = 0;const materialSet = new Set;let lowestPart;- const box = new THREE57.Box3;- const point = new THREE57.Vector3;+ const box = new THREE58.Box3;+ const point = new THREE58.Vector3;root.updateWorldMatrix(true, true);root.traverseVisible((node) => {const n = node;@@ -45568,7 +46005,7 @@ function collectSceneMetrics(root) {const mesh = node;const position = mesh.geometry.getAttribute("position");const index = mesh.geometry.index;- const mb = new THREE57.Box3;+ const mb = new THREE58.Box3;if (position) {for (let i = 0;i < (index?.count ?? position.count); i++) {point.fromBufferAttribute(position, index ? index.getX(i) : i);@@ -45583,7 +46020,7 @@ function collectSceneMetrics(root) {});let bbox;if (!box.isEmpty()) {- const size = new THREE57.Vector3;+ const size = new THREE58.Vector3;box.getSize(size);bbox = {min: [box.min.x, box.min.y, box.min.z],diff --git a/dist/build.json b/dist/build.jsonindex 1d91094b..8e941e2d 100644--- a/dist/build.json+++ b/dist/build.json@@ -2,12 +2,12 @@"schemaVersion": 1,"entries": {"worker": {- "identity": "sha256:6faddbf66b4a18602b198937133dd80f696af99af525c2b58d82484d7c19f885",+ "identity": "sha256:817a2024b497ee4a1b3463bf6359e74ddd44b1324a137e75b5068d24233473d8","engineVersion": "1.2.3","toolchain": "[email protected]",- "sourceHash": "1831d3bf721f61f7ccde42f50b6db0d53fd29784a81d6457d8ca770ff5ae57c4",+ "sourceHash": "7fe5e0fee88daf30d23b2710f6542c24db5828043e473fa639f6b2c0294299b7","rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",- "dependencyHash": "bb179f2715f8fd9059898ef3a2028947e8f5f7e7979ad7eafe59d7a464c18f9f",+ "dependencyHash": "f17d705cc5de6856252c111542b8e179695cc81448eb1e2fc4d9a343ed42370a","dependencies": {"@gltf-transform/core": "4.5.1","@gltf-transform/extensions": "4.5.1",@@ -21,6 +21,7 @@"gltf-validator": "2.0.0-dev.3.10","jsonc-parser": "3.3.1","manifold-3d": "^3.5.4",+ "meshoptimizer": "1.1.1","minisearch": "7.2.0","pngjs": "7.0.0","sharp": "^0.35.5",@@ -36,15 +37,15 @@},"target": "node","file": "evaluator-worker.mjs",- "bundleHash": "sha256:ce531903d4338186657f50f079e2ecffa0dd3b04d7765d3f4daccd725bd66804"+ "bundleHash": "sha256:a79166bc5d349917ff0362837bb376e5e19e696fa04a314a246b0ef1e785ef68"},"agent-run": {- "identity": "sha256:6faddbf66b4a18602b198937133dd80f696af99af525c2b58d82484d7c19f885",+ "identity": "sha256:817a2024b497ee4a1b3463bf6359e74ddd44b1324a137e75b5068d24233473d8","engineVersion": "1.2.3","toolchain": "[email protected]",- "sourceHash": "1831d3bf721f61f7ccde42f50b6db0d53fd29784a81d6457d8ca770ff5ae57c4",+ "sourceHash": "7fe5e0fee88daf30d23b2710f6542c24db5828043e473fa639f6b2c0294299b7","rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",- "dependencyHash": "bb179f2715f8fd9059898ef3a2028947e8f5f7e7979ad7eafe59d7a464c18f9f",+ "dependencyHash": "f17d705cc5de6856252c111542b8e179695cc81448eb1e2fc4d9a343ed42370a","dependencies": {"@gltf-transform/core": "4.5.1","@gltf-transform/extensions": "4.5.1",@@ -58,6 +59,7 @@"gltf-validator": "2.0.0-dev.3.10","jsonc-parser": "3.3.1","manifold-3d": "^3.5.4",+ "meshoptimizer": "1.1.1","minisearch": "7.2.0","pngjs": "7.0.0","sharp": "^0.35.5",@@ -73,15 +75,15 @@},"target": "node","file": "agent-run.mjs",- "bundleHash": "sha256:5ddfb55fa50037292a1fba651157ac25d0593e8f721b9b6e3ec74d7a592e79f8"+ "bundleHash": "sha256:e177fb7ad95931b33b13af3a504187010db6ed9967e408eb2b2ebd9cc0affdf5"},"agent-providers": {- "identity": "sha256:6faddbf66b4a18602b198937133dd80f696af99af525c2b58d82484d7c19f885",+ "identity": "sha256:817a2024b497ee4a1b3463bf6359e74ddd44b1324a137e75b5068d24233473d8","engineVersion": "1.2.3","toolchain": "[email protected]",- "sourceHash": "1831d3bf721f61f7ccde42f50b6db0d53fd29784a81d6457d8ca770ff5ae57c4",+ "sourceHash": "7fe5e0fee88daf30d23b2710f6542c24db5828043e473fa639f6b2c0294299b7","rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",- "dependencyHash": "bb179f2715f8fd9059898ef3a2028947e8f5f7e7979ad7eafe59d7a464c18f9f",+ "dependencyHash": "f17d705cc5de6856252c111542b8e179695cc81448eb1e2fc4d9a343ed42370a","dependencies": {"@gltf-transform/core": "4.5.1","@gltf-transform/extensions": "4.5.1",@@ -95,6 +97,7 @@"gltf-validator": "2.0.0-dev.3.10","jsonc-parser": "3.3.1","manifold-3d": "^3.5.4",+ "meshoptimizer": "1.1.1","minisearch": "7.2.0","pngjs": "7.0.0","sharp": "^0.35.5",@@ -113,12 +116,12 @@"bundleHash": "sha256:9d6faf03d307321bc2e3bd5ce5bdee0bbbf61e0ebed8bfebfa1fb072287b83fa"},"mcp": {- "identity": "sha256:6faddbf66b4a18602b198937133dd80f696af99af525c2b58d82484d7c19f885",+ "identity": "sha256:817a2024b497ee4a1b3463bf6359e74ddd44b1324a137e75b5068d24233473d8","engineVersion": "1.2.3","toolchain": "[email protected]",- "sourceHash": "1831d3bf721f61f7ccde42f50b6db0d53fd29784a81d6457d8ca770ff5ae57c4",+ "sourceHash": "7fe5e0fee88daf30d23b2710f6542c24db5828043e473fa639f6b2c0294299b7","rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",- "dependencyHash": "bb179f2715f8fd9059898ef3a2028947e8f5f7e7979ad7eafe59d7a464c18f9f",+ "dependencyHash": "f17d705cc5de6856252c111542b8e179695cc81448eb1e2fc4d9a343ed42370a","dependencies": {"@gltf-transform/core": "4.5.1","@gltf-transform/extensions": "4.5.1",@@ -132,6 +135,7 @@"gltf-validator": "2.0.0-dev.3.10","jsonc-parser": "3.3.1","manifold-3d": "^3.5.4",+ "meshoptimizer": "1.1.1","minisearch": "7.2.0","pngjs": "7.0.0","sharp": "^0.35.5",@@ -150,12 +154,12 @@"bundleHash": "sha256:0976f6cbeb0fcb605b4cd473ade1b975e21962f407fe69a1f73d6ba1be314d0d"},"cli": {- "identity": "sha256:6faddbf66b4a18602b198937133dd80f696af99af525c2b58d82484d7c19f885",+ "identity": "sha256:817a2024b497ee4a1b3463bf6359e74ddd44b1324a137e75b5068d24233473d8","engineVersion": "1.2.3","toolchain": "[email protected]",- "sourceHash": "1831d3bf721f61f7ccde42f50b6db0d53fd29784a81d6457d8ca770ff5ae57c4",+ "sourceHash": "7fe5e0fee88daf30d23b2710f6542c24db5828043e473fa639f6b2c0294299b7","rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",- "dependencyHash": "bb179f2715f8fd9059898ef3a2028947e8f5f7e7979ad7eafe59d7a464c18f9f",+ "dependencyHash": "f17d705cc5de6856252c111542b8e179695cc81448eb1e2fc4d9a343ed42370a","dependencies": {"@gltf-transform/core": "4.5.1","@gltf-transform/extensions": "4.5.1",@@ -169,6 +173,7 @@"gltf-validator": "2.0.0-dev.3.10","jsonc-parser": "3.3.1","manifold-3d": "^3.5.4",+ "meshoptimizer": "1.1.1","minisearch": "7.2.0","pngjs": "7.0.0","sharp": "^0.35.5",@@ -184,15 +189,15 @@},"target": "node","file": "cli.mjs",- "bundleHash": "sha256:98ef08c58b3098b186f8192e87014b0e17737a749daaea61098f8a320c301e89"+ "bundleHash": "sha256:68581cbc0609611f0f21b4efc051d7b3ff81888740ff836025bbed278ccc017c"},"engine": {- "identity": "sha256:6faddbf66b4a18602b198937133dd80f696af99af525c2b58d82484d7c19f885",+ "identity": "sha256:817a2024b497ee4a1b3463bf6359e74ddd44b1324a137e75b5068d24233473d8","engineVersion": "1.2.3","toolchain": "[email protected]",- "sourceHash": "1831d3bf721f61f7ccde42f50b6db0d53fd29784a81d6457d8ca770ff5ae57c4",+ "sourceHash": "7fe5e0fee88daf30d23b2710f6542c24db5828043e473fa639f6b2c0294299b7","rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",- "dependencyHash": "bb179f2715f8fd9059898ef3a2028947e8f5f7e7979ad7eafe59d7a464c18f9f",+ "dependencyHash": "f17d705cc5de6856252c111542b8e179695cc81448eb1e2fc4d9a343ed42370a","dependencies": {"@gltf-transform/core": "4.5.1","@gltf-transform/extensions": "4.5.1",@@ -206,6 +211,7 @@"gltf-validator": "2.0.0-dev.3.10","jsonc-parser": "3.3.1","manifold-3d": "^3.5.4",+ "meshoptimizer": "1.1.1","minisearch": "7.2.0","pngjs": "7.0.0","sharp": "^0.35.5",@@ -221,7 +227,7 @@},"target": "node","file": "mcp-engine.mjs",- "bundleHash": "sha256:a000f617f641e857e4650109f23b088229d1baa2e1126995160475511e9c505e"+ "bundleHash": "sha256:6a5c2c4d6d06abfa981cf5db34fc3df26e10368e65ce920203337a39d941cdc0"}}}diff --git a/dist/cli.mjs b/dist/cli.mjsindex 1fa48767..4d500dc3 100644--- a/dist/cli.mjs+++ b/dist/cli.mjs@@ -220,6 +220,41 @@ var init_authoring_diagnostic = __esm(() => {};});+// src/evaluator/solid-diagnostic.ts+function validSolidFailureDetails(value) {+ if (!record(value) || !keys(value, ["total", "truncated", "meshes"]) || !count(value.total) || value.total < 1 || !Array.isArray(value.meshes) || value.meshes.length !== Math.min(value.total, MAX_SOLID_FAILURE_MESHES) || value.truncated !== value.total > value.meshes.length)+ return false;+ return value.meshes.every((mesh) => record(mesh) && keys(mesh, [+ "childPath",+ "closed",+ "manifold",+ "orientation",+ "boundaryEdges",+ "nonManifoldEdges",+ "orientationConflicts"+ ]) && (mesh.childPath === null || Array.isArray(mesh.childPath) && mesh.childPath.length <= MAX_SOLID_FAILURE_PATH && mesh.childPath.every(count)) && typeof mesh.closed === "boolean" && typeof mesh.manifold === "boolean" && typeof mesh.orientation === "string" && ["outward", "inward", "mixed"].includes(mesh.orientation) && count(mesh.boundaryEdges) && count(mesh.nonManifoldEdges) && count(mesh.orientationConflicts));+}+function solidFailureAdvice(value) {+ if (!value || !validSolidFailureDetails(value))+ return "";+ const rows = value.meshes.map((mesh) => {+ const locator = mesh.childPath === null ? "mesh beyond the 64-level locator limit" : `root${mesh.childPath.map((index) => `.children[${index}]`).join("")}`;+ return `${locator}: closed=${mesh.closed}, manifold=${mesh.manifold}, orientation=${mesh.orientation}, boundaryEdges=${mesh.boundaryEdges}, nonManifoldEdges=${mesh.nonManifoldEdges}, orientationConflicts=${mesh.orientationConflicts}`;+ });+ return ` Required solid measurements (${value.meshes.length} of ${value.total} failing meshes): ${rows.join("; ")}. Child indices locate nodes in the authored build root before export; names are not forwarded. Read the retained source and check that node's geometryDiagnostics().solid.`;+}+var MAX_SOLID_FAILURE_MESHES = 4, MAX_SOLID_FAILURE_PATH = 64, RequiredSolidError, record = (value) => value !== null && typeof value === "object" && !Array.isArray(value), keys = (value, names) => Object.keys(value).length === names.length && names.every((name) => Object.hasOwn(value, name)), count = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;+var init_solid_diagnostic = __esm(() => {+ init_authoring_diagnostic();+ RequiredSolidError = class RequiredSolidError extends AuthoringDiagnosticError {+ solid;+ constructor(solid, message) {+ super("REQUIRE_SOLID", message);+ this.solid = solid;+ }+ };+});+// src/qa/registry.tsimport { createHash } from "node:crypto";function canonicalCalibrationReportEvidence(report) {@@ -1217,7 +1252,7 @@ function assertProceduralJsonV3(input) {};visit(input, "recipe", 0);}-function record(value, allowed, path) {+function record2(value, allowed, path) {if (!value || typeof value !== "object" || Array.isArray(value))fail(`${path} must be a JSON object.`);const result = value;@@ -1250,7 +1285,7 @@ function rgba(value, path) {return c[3] === 0 ? [0, 0, 0, 0] : c;}function rectangle(value, path, kind) {- const r = record(value, ["x", "y", "width", "height", ...kind ? ["kind"] : []], path);+ const r = record2(value, ["x", "y", "width", "height", ...kind ? ["kind"] : []], path);return {x: integer2(r["x"], -4096, 4096, `${path}.x`),y: integer2(r["y"], -4096, 4096, `${path}.y`),@@ -1259,11 +1294,11 @@ function rectangle(value, path, kind) {};}function shape(value, path) {- const r = record(value, ["kind", "x", "y", "width", "height", "from", "to", "points"], path);+ const r = record2(value, ["kind", "x", "y", "width", "height", "from", "to", "points"], path);if (r["kind"] === "rectangle" || r["kind"] === "ellipse")return { kind: r["kind"], ...rectangle(r, path, r["kind"]) };if (r["kind"] === "polygon") {- record(r, ["kind", "points"], path);+ record2(r, ["kind", "points"], path);const points = r["points"];if (!Array.isArray(points) || points.length < 3 || points.length > MAX_PROCEDURAL_V3_VERTICES)fail(`${path}.points requires 3..${MAX_PROCEDURAL_V3_VERTICES} vertices.`);@@ -1273,7 +1308,7 @@ function shape(value, path) {};}if (r["kind"] === "line") {- record(r, ["kind", "from", "to", "width"], path);+ record2(r, ["kind", "from", "to", "width"], path);return {kind: "line",from: tuple(r["from"], 2, `${path}.from`, -4096, 4096),@@ -1309,7 +1344,7 @@ function proceduralClippedBoundsV3(s, width, height, dx = 0, dy = 0) {}function admitProceduralTextureSpecV3(input) {assertProceduralJsonV3(input);- const r = record(input, ["schemaVersion", "width", "height", "usage", "name", "background", "operations", "palette"], "recipe");+ const r = record2(input, ["schemaVersion", "width", "height", "usage", "name", "background", "operations", "palette"], "recipe");if (r["schemaVersion"] !== 3)fail("schemaVersion must be 3.");const width = integer2(r["width"], 4, MAX_PROCEDURAL_V3_EDGE, "width");@@ -1332,7 +1367,7 @@ function admitProceduralTextureSpecV3(input) {let legacyTransientBytes = 0;const operations = rawOps.map((value, i) => {const path = `operations[${i}]`;- const op = record(value, [+ const op = record2(value, ["op","shape","rgba",@@ -1346,8 +1381,8 @@ function admitProceduralTextureSpecV3(input) {"periodic"], path);if (op["op"] === "legacy-v2") {- record(op, ["op", "spec", "alpha", "opacity"], path);- const legacyRecord = record(op["spec"], ["schemaVersion", "size", "usage", "name", "layers"], `${path}.spec`);+ record2(op, ["op", "spec", "alpha", "opacity"], path);+ const legacyRecord = record2(op["spec"], ["schemaVersion", "size", "usage", "name", "layers"], `${path}.spec`);if (legacyRecord["schemaVersion"] !== 2)fail(`${path}.spec requires explicit schemaVersion 2.`);const spec = canonicalizeProceduralTextureSpecV2(legacyRecord);@@ -1367,7 +1402,7 @@ function admitProceduralTextureSpecV3(input) {const [x0, y0, x1, y1] = proceduralClippedBoundsV3(s, width, height);const area = Math.max(0, x1 - x0) * Math.max(0, y1 - y0);if (op["op"] === "mask") {- record(op, ["op", "shape", "alpha", "invert"], path);+ record2(op, ["op", "shape", "alpha", "invert"], path);work += texels + area * cost;return {op: "mask",@@ -1384,11 +1419,11 @@ function admitProceduralTextureSpecV3(input) {opacity: integer2(op["opacity"], 0, 255, `${path}.opacity`, 255)};if (op["op"] === "paint") {- record(op, ["op", "shape", "rgba", "opacity"], path);+ record2(op, ["op", "shape", "rgba", "opacity"], path);work += area * (cost + 1);return { op: "paint", ...paint };}- record(op, ["op", "shape", "rgba", "opacity", "count", "seed", "area", "periodic"], path);+ record2(op, ["op", "shape", "rgba", "opacity", "count", "seed", "area", "periodic"], path);if (!colorUsage)fail("stamps are supported only for color usages albedo and emissive.");const count = integer2(op["count"], 1, MAX_PROCEDURAL_V3_STAMPS, `${path}.count`);@@ -1413,7 +1448,7 @@ function admitProceduralTextureSpecV3(input) {if (r["palette"] !== undefined) {if (!colorUsage)fail("palette and dither are supported only for color usages albedo and emissive.");- const p = record(r["palette"], ["colors", "dither"], "palette");+ const p = record2(r["palette"], ["colors", "dither"], "palette");const colors = p["colors"];if (!Array.isArray(colors) || colors.length < 1 || colors.length > MAX_PROCEDURAL_V3_PALETTE)fail(`palette.colors requires 1..${MAX_PROCEDURAL_V3_PALETTE} entries.`);@@ -1537,7 +1572,7 @@ function preflight(input) {};visit(input, 0);}-function record2(value, fields, label) {+function record3(value, fields, label) {if (!value || typeof value !== "object" || Array.isArray(value))atlasFailure(`${label} must be a JSON object.`);const r = value;@@ -1556,7 +1591,7 @@ function hash(value, label) {return value;}function rect(value, label) {- const r = record2(value, ["x", "y", "width", "height"], label);+ const r = record3(value, ["x", "y", "width", "height"], label);return {x: integer3(r["x"], 0, 4096, `${label}.x`),y: integer3(r["y"], 0, 4096, `${label}.y`),@@ -1643,12 +1678,12 @@ function packAtlasRegionsV1(width, height, fixed, pending) {}function canonicalizeTextureAtlasSpecV1(input) {preflight(input);- const r = record2(input, ["schemaVersion", "width", "height", "usage", "sampler", "regions", "pack"], "atlas");+ const r = record3(input, ["schemaVersion", "width", "height", "usage", "sampler", "regions", "pack"], "atlas");if (r["schemaVersion"] !== 1)atlasFailure("schemaVersion must be 1.");let pack;if (r["pack"] !== undefined) {- const p = record2(r["pack"], ["edge", "gutter", "algorithm"], "pack");+ const p = record3(r["pack"], ["edge", "gutter", "algorithm"], "pack");if (!TEXTURE_ATLAS_PACK_EDGES.includes(p["edge"]))atlasFailure("pack.edge must be 1024 or 2048.");if (p["algorithm"] !== undefined && p["algorithm"] !== "maxrects")@@ -1670,7 +1705,7 @@ function canonicalizeTextureAtlasSpecV1(input) {atlasFailure(`regions must contain 1..${limits.regions} entries.`);const pending = [];const regions = r["regions"].map((value, i) => {- const q = record2(value, ["name", "content", "gutter", "edgeMode", "source", "crop", "packed"], `regions[${i}]`);+ const q = record3(value, ["name", "content", "gutter", "edgeMode", "source", "crop", "packed"], `regions[${i}]`);if (typeof q["name"] !== "string" || !/^[a-z][a-z0-9_-]{0,79}$/.test(q["name"]))atlasFailure("region name must be a stable lowercase identifier.");const explicit = q["content"] !== undefined;@@ -1685,11 +1720,11 @@ function canonicalizeTextureAtlasSpecV1(input) {atlasFailure("unsupported edgeMode.");if (edgeMode === "mask-rgb-dilate" && usage !== "albedo" && usage !== "emissive")atlasFailure("mask RGB dilation requires color usage.");- const s = record2(q["source"], ["kind", "spec", "resourceId", "pin", "expected"], "source");+ const s = record3(q["source"], ["kind", "spec", "resourceId", "pin", "expected"], "source");let source;let crop = q["crop"] === undefined ? undefined : rect(q["crop"], "crop");if (s["kind"] === "procedural") {- record2(s, ["kind", "spec"], "procedural source");+ record3(s, ["kind", "spec"], "procedural source");const admission = admitProceduralTextureSpecV3(s["spec"]);if (admission.spec.usage !== usage)atlasFailure("source usage does not match atlas usage.");@@ -1698,10 +1733,10 @@ function canonicalizeTextureAtlasSpecV1(input) {content ??= { x: 0, y: 0, width: crop.width, height: crop.height };assertAtlasCropV1(crop, content, admission.spec.width, admission.spec.height);} else if (s["kind"] === "resource") {- record2(s, ["kind", "resourceId", "pin", "expected"], "resource source");+ record3(s, ["kind", "resourceId", "pin", "expected"], "resource source");if (typeof s["resourceId"] !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9_.:/-]{0,199}$/.test(s["resourceId"]))atlasFailure("source resourceId must be an exact returned map ID.");- const p = record2(s["pin"], ["resourceId", "revisionId", "sha256"], "source pin");+ const p = record3(s["pin"], ["resourceId", "revisionId", "sha256"], "source pin");if (typeof p["resourceId"] !== "string" || !/^[a-z][a-z0-9_-]{0,79}$/.test(p["resourceId"]))atlasFailure("pin resourceId must be a material ID.");const revisionId = hash(p["revisionId"], "pin revisionId"), sha256 = hash(p["sha256"], "pin sha256");@@ -1709,7 +1744,7 @@ function canonicalizeTextureAtlasSpecV1(input) {atlasFailure("source pin revision/hash mismatch.");let expected;if (s["expected"] !== undefined) {- const e = record2(s["expected"], ["width", "height", "imageSha256", "decodedPixelHash"], "source expected");+ const e = record3(s["expected"], ["width", "height", "imageSha256", "decodedPixelHash"], "source expected");expected = {...e["width"] === undefined ? {} : { width: integer3(e["width"], 1, 4096, "expected.width") },...e["height"] === undefined ? {} : { height: integer3(e["height"], 1, 4096, "expected.height") },@@ -1808,7 +1843,7 @@ ${canonicalAtlasMetadataJsonV1({ width: spec.width, height: spec.height, origin:function validateTextureAtlasManifestV1(input, providedSpec) {preflight(input);const spec = canonicalizeTextureAtlasSpecV1(providedSpec);- const r = record2(input, [+ const r = record3(input, ["version","compilerId","width",@@ -1835,7 +1870,7 @@ function validateTextureAtlasManifestV1(input, providedSpec) {atlasFailure("manifest source/region inventory mismatch.");const dimensions = new Map;for (const sourceValue of r["sources"]) {- const s = record2(sourceValue, [+ const s = record3(sourceValue, ["id","kind","width",@@ -1853,12 +1888,12 @@ function validateTextureAtlasManifestV1(input, providedSpec) {const width = integer3(s["width"], 1, 4096, "manifest source width"), height = integer3(s["height"], 1, 4096, "manifest source height");hash(s["decodedPixelHash"], "manifest source decodedPixelHash");if (source.kind === "procedural") {- record2(s, ["id", "kind", "width", "height", "decodedPixelHash", "recipeHash", "compilerId"], "manifest procedural source");+ record3(s, ["id", "kind", "width", "height", "decodedPixelHash", "recipeHash", "compilerId"], "manifest procedural source");if (width !== source.spec.width || height !== source.spec.height || s["recipeHash"] !== hashProceduralTextureSpecV3(source.spec) || s["compilerId"] !== "kiln.procedural-rgba.v3.1")atlasFailure("manifest procedural source identity mismatch.");} else {- record2(s, ["id", "kind", "width", "height", "decodedPixelHash", "descriptor"], "manifest resource source");- const d = record2(s["descriptor"], [+ record3(s, ["id", "kind", "width", "height", "decodedPixelHash", "descriptor"], "manifest resource source");+ const d = record3(s["descriptor"], ["materialId","revisionId","resourceId",@@ -1893,7 +1928,7 @@ function validateTextureAtlasManifestV1(input, providedSpec) {dimensions.set(s["id"], { width, height });}for (let i = 0;i < spec.regions.length; i++) {- const region = spec.regions[i], v = record2(r["regions"][i], ["name", "content", "allocation", "crop", "sourceId"], "manifest region");+ const region = spec.regions[i], v = record3(r["regions"][i], ["name", "content", "allocation", "crop", "sourceId"], "manifest region");const sourceId = atlasSourceIdentityV1(region.source), size = dimensions.get(sourceId);const crop = region.crop ?? { x: 0, y: 0, width: size.width, height: size.height };assertAtlasCropV1(crop, region.content, size.width, size.height);@@ -3024,7 +3059,7 @@ function cloneVfxIntentV1(value) {}function validateVfxIntentV1(value) {const issues = [];- if (!record3(value)) {+ if (!record4(value)) {return {valid: false,issues: [{ code: "EXPECTED_OBJECT", path: "", message: "VfxIntentV1 must be an object." }]@@ -3065,7 +3100,7 @@ function validateVfxIntentV1(value) {message: "doubleSided must be boolean."});}- if (!record3(value.facing)) {+ if (!record4(value.facing)) {issues.push({ code: "INVALID_VFX_FACING", path: "facing", message: "facing is required." });} else {if (value.facing.source !== "explicit" && value.facing.source !== "inferred") {@@ -3106,7 +3141,7 @@ function validateVfxIntentV1(value) {});}}- if (!record3(value.animation)) {+ if (!record4(value.animation)) {issues.push({code: "INVALID_VFX_ANIMATION",path: "animation",@@ -3195,7 +3230,7 @@ function validateVfxIntentV1(value) {}}if (value.sidecar !== undefined) {- if (!record3(value.sidecar) || value.sidecar.kind !== "tsl" || !trimmed(value.sidecar.id) || !trimmed(value.sidecar.version)) {+ if (!record4(value.sidecar) || value.sidecar.kind !== "tsl" || !trimmed(value.sidecar.id) || !trimmed(value.sidecar.version)) {issues.push({code: "INVALID_VFX_SIDECAR",path: "sidecar",@@ -3258,7 +3293,7 @@ function normalizeVector(value) {}function validateModularKitContractV1(value) {const issues = [];- if (!record3(value)) {+ if (!record4(value)) {return {valid: false,issues: [@@ -3298,7 +3333,7 @@ function validateModularKitContractV1(value) {const ids = new Set;for (const [index, socket] of sockets.entries()) {const path = `sockets[${index}]`;- if (!record3(socket)) {+ if (!record4(socket)) {issues.push({ code: "INVALID_MODULAR_SOCKET", path, message: `${path} must be an object.` });continue;}@@ -3327,7 +3362,7 @@ function validateModularKitContractV1(value) {message: "compatibleTypes must contain strings."});}- if (!record3(socket.frame) || !finiteTuple(socket.frame.translation, 3) || !finiteTuple(socket.frame.rotation, 4)) {+ if (!record4(socket.frame) || !finiteTuple(socket.frame.translation, 3) || !finiteTuple(socket.frame.rotation, 4)) {issues.push({code: "INVALID_MODULAR_FRAME",path: `${path}.frame`,@@ -3426,7 +3461,7 @@ function evaluateModularJoinV1(kit, observation) {codes};}-var VFX_SUBTYPES, VFX_PORTABILITY_MODES, VFX_AXIS_DIRECTIONS, VFX_FACING_MODES, VFX_PLAYBACK_POLICIES, VFX_RUNTIME_DRIVERS, VFX_ENDPOINT_BEHAVIORS, record3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), trimmed = (value) => typeof value === "string" && value.length > 0 && value === value.trim(), enumValue = (values, value) => typeof value === "string" && values.includes(value), finitePositive = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, finiteNonNegative = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0, ASSET_SCOPES, KILN_DEFAULT_MODULAR_GRID, finiteTuple = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), stable = (value) => Math.round(value * 1e6) / 1e6, dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2], subtract = (a, b) => [+var VFX_SUBTYPES, VFX_PORTABILITY_MODES, VFX_AXIS_DIRECTIONS, VFX_FACING_MODES, VFX_PLAYBACK_POLICIES, VFX_RUNTIME_DRIVERS, VFX_ENDPOINT_BEHAVIORS, record4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), trimmed = (value) => typeof value === "string" && value.length > 0 && value === value.trim(), enumValue = (values, value) => typeof value === "string" && values.includes(value), finitePositive = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, finiteNonNegative = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0, ASSET_SCOPES, KILN_DEFAULT_MODULAR_GRID, finiteTuple = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), stable = (value) => Math.round(value * 1e6) / 1e6, dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2], subtract = (a, b) => [a[0] - b[0],a[1] - b[1],a[2] - b[2]@@ -12874,14 +12909,14 @@ var init_environment2 = __esm(() => {// src/qa/breadth.tsfunction validModularJoinObservation(value) {- if (!record4(value))+ if (!record5(value))return false;return typeof value.aSocketId === "string" && value.aSocketId.length > 0 && typeof value.bSocketId === "string" && value.bSocketId.length > 0 && finiteTuple2(value.aWorldPosition, 3) && finiteTuple2(value.bWorldPosition, 3) && finiteTuple2(value.aWorldNormal, 3) && finiteTuple2(value.bWorldNormal, 3) && typeof value.relativeRotationDegrees === "number" && Number.isFinite(value.relativeRotationDegrees) && (value.toleranceMeters === undefined || typeof value.toleranceMeters === "number" && Number.isFinite(value.toleranceMeters) && value.toleranceMeters >= 0) && (value.normalToleranceDegrees === undefined || typeof value.normalToleranceDegrees === "number" && Number.isFinite(value.normalToleranceDegrees) && value.normalToleranceDegrees >= 0);}function validVfxArtifactEvidence(value) {- if (!record4(value) || value.schemaVersion !== 1)+ if (!record5(value) || value.schemaVersion !== 1)return false;- if (!record4(value.facing) || !record4(value.animation))+ if (!record5(value.facing) || !record5(value.animation))return false;if (!Array.isArray(value.materials))return false;@@ -12889,10 +12924,10 @@ function validVfxArtifactEvidence(value) {return false;if (!value.uniforms.every((name) => typeof name === "string" && name.length > 0))return false;- if (!value.clips.every((clip) => record4(clip) && typeof clip.name === "string" && clip.name.length > 0 && typeof clip.durationSeconds === "number" && Number.isFinite(clip.durationSeconds) && clip.durationSeconds >= 0)) {+ if (!value.clips.every((clip) => record5(clip) && typeof clip.name === "string" && clip.name.length > 0 && typeof clip.durationSeconds === "number" && Number.isFinite(clip.durationSeconds) && clip.durationSeconds >= 0)) {return false;}- return value.materials.every((material) => record4(material) && typeof material.id === "string" && material.id.length > 0 && ["card", "beam", "trail", "volume", "core"].includes(String(material.surfaceRole)) && ["opaque", "mask", "blend"].includes(String(material.alphaMode)) && (material.effectSurface === undefined || typeof material.effectSurface === "boolean") && typeof material.alphaData === "boolean" && typeof material.doubleSided === "boolean" && typeof material.screenAreaRatio === "number" && Number.isFinite(material.screenAreaRatio) && material.screenAreaRatio >= 0 && typeof material.transparentLayers === "number" && Number.isInteger(material.transparentLayers) && material.transparentLayers >= 0 && typeof material.textureMemoryBytes === "number" && Number.isInteger(material.textureMemoryBytes) && material.textureMemoryBytes >= 0);+ return value.materials.every((material) => record5(material) && typeof material.id === "string" && material.id.length > 0 && ["card", "beam", "trail", "volume", "core"].includes(String(material.surfaceRole)) && ["opaque", "mask", "blend"].includes(String(material.alphaMode)) && (material.effectSurface === undefined || typeof material.effectSurface === "boolean") && typeof material.alphaData === "boolean" && typeof material.doubleSided === "boolean" && typeof material.screenAreaRatio === "number" && Number.isFinite(material.screenAreaRatio) && material.screenAreaRatio >= 0 && typeof material.transparentLayers === "number" && Number.isInteger(material.transparentLayers) && material.transparentLayers >= 0 && typeof material.textureMemoryBytes === "number" && Number.isInteger(material.textureMemoryBytes) && material.textureMemoryBytes >= 0);}function artifactEvidence(context) {if (context.derivedEvidence?.source !== "engine-scene-analysis")@@ -13239,7 +13274,7 @@ function inspectAssetScope(context) {if (!scope)return [];const scopeObservation = context.derivedEvidence?.assetScope;- if (context.derivedEvidence?.source !== "engine-scene-analysis" || !record4(scopeObservation) || typeof scopeObservation.topLevelAssetRoots !== "number" || typeof scopeObservation.reusableMemberCount !== "number" || !Array.isArray(scopeObservation.sceneDressingRoles)) {+ if (context.derivedEvidence?.source !== "engine-scene-analysis" || !record5(scopeObservation) || typeof scopeObservation.topLevelAssetRoots !== "number" || typeof scopeObservation.reusableMemberCount !== "number" || !Array.isArray(scopeObservation.sceneDressingRoles)) {return [];}const result = assessAssetScopeV1(scope, scopeObservation);@@ -13300,7 +13335,7 @@ function evaluateAssetScopeQa(context) {derivedEvidence: context.derivedEvidence});}-var record4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), stable6 = (value) => Math.round(value * 1e6) / 1e6, finiteTuple2 = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), VFX_EXACT_QA_RULE, VFX_ADVISORY_QA_RULE, MODULAR_JOIN_QA_RULE, ASSET_SCOPE_QA_RULE, W7_BREADTH_QA_RULES;+var record5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), stable6 = (value) => Math.round(value * 1e6) / 1e6, finiteTuple2 = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), VFX_EXACT_QA_RULE, VFX_ADVISORY_QA_RULE, MODULAR_JOIN_QA_RULE, ASSET_SCOPE_QA_RULE, W7_BREADTH_QA_RULES;var init_breadth2 = __esm(() => {init_breadth();init_registry();@@ -13352,7 +13387,7 @@ var init_breadth2 = __esm(() => {// src/qa/breadth-evidence.tsimport * as THREE20 from "three";-function record5(value) {+function record6(value) {return typeof value === "object" && value !== null && !Array.isArray(value);}function isMeshNode(value) {@@ -13362,10 +13397,10 @@ function isSpriteNode(value) {return value.isSprite === true;}function isTexture(value) {- return record5(value) && value.isTexture === true;+ return record6(value) && value.isTexture === true;}function isAnimationClip(value) {- return record5(value) && typeof value.name === "string" && typeof value.duration === "number" && Number.isFinite(value.duration) && Array.isArray(value.tracks);+ return record6(value) && typeof value.name === "string" && typeof value.duration === "number" && Number.isFinite(value.duration) && Array.isArray(value.tracks);}function localRenderableBox(rootInverse, node) {if (isSpriteNode(node)) {@@ -13629,7 +13664,7 @@ function shaderUniforms(materials) {const values = new Set;for (const material of materials) {const uniforms = material.uniforms;- if (record5(uniforms))+ if (record6(uniforms))for (const key of Object.keys(uniforms))values.add(key);}@@ -14214,14 +14249,14 @@ function createAssetRequirementsV1(input = {}) {...input});}-var text, positive2, nonnegative, count, names, marker, roof, structure, effects, requirements, AssetRequirementsV1Schema;+var text, positive2, nonnegative, count2, names, marker, roof, structure, effects, requirements, AssetRequirementsV1Schema;var init_requirements = __esm(() => {init_asset();init_breadth();text = z.string().refine((value) => value.trim().length > 0, { message: "Must be non-empty." });positive2 = z.number().finite().positive();nonnegative = z.number().finite().nonnegative();- count = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);+ count2 = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);names = z.array(text).refine((values) => new Set(values).size === values.length, {message: "Values must be unique."});@@ -14237,7 +14272,7 @@ var init_requirements = __esm(() => {structure = z.strictObject({subtype: text.optional(),enterable: z.boolean().optional(),- storeyCount: count.min(1).optional(),+ storeyCount: count2.min(1).optional(),interiorMode: z.enum(ARCHITECTURE_INTERIOR_MODES).optional(),roofMode: z.enum(ARCHITECTURE_ROOF_MODES).optional(),footprint: z.strictObject({ spanX: positive2, spanZ: positive2, units: z.literal("m") }).optional(),@@ -14285,8 +14320,8 @@ var init_requirements = __esm(() => {supportAssemblies: names.optional(),propulsionAssemblies: names.optional(),frontFrame: z.literal("+X").optional(),- wheelCount: count.optional(),- axleCount: count.optional(),+ wheelCount: count2.optional(),+ axleCount: count2.optional(),steering: z.enum(VEHICLE_STEERING_ARRANGEMENTS).optional(),supportPolicy: z.enum(VEHICLE_SUPPORT_POLICIES).optional(),animationAssemblies: names.optional()@@ -14616,6 +14651,32 @@ var init_requirements_context = __esm(() => {});});+// src/atomic-directory.ts+import { lstat as lstat2, rename as rename2 } from "node:fs/promises";+import { setTimeout as pause } from "node:timers/promises";+async function renameDirectoryAtomically(source, destination, controls = {}) {+ const renameOperation = controls.renameOperation ?? rename2;+ const platform = controls.platform ?? process.platform;+ const wait = controls.pause ?? pause;+ const delays = [20, 50, 100, 200, 400];+ for (let attempt = 0;; attempt++) {+ try {+ await renameOperation(source, destination);+ return;+ } catch (error) {+ const delay = delays[attempt];+ const code = error?.code;+ if (platform !== "win32" || delay === undefined || !["EPERM", "EACCES", "EBUSY"].includes(code ?? ""))+ throw error;+ const absent = await lstat2(destination).then(() => false, (statError) => statError.code === "ENOENT");+ if (!absent)+ throw error;+ await wait(delay);+ }+ }+}+var init_atomic_directory = () => {};+// src/material-authoring-schema.tsimport { z as z3 } from "zod";function makeMaterialAuthoringSchemas(legacyV2Schema, canonicalLegacyV2Schema = canonicalLegacyV2FieldSchema) {@@ -15075,7 +15136,7 @@ function validateMaterialRecordShapeAny(record) {}return manifest;}-var MATERIAL_LIBRARY_LIMITS, MATERIAL_LIBRARY_SLOTS, MATERIAL_LIBRARY_USAGE, slotNames, materialLibraryIdSchema, materialLibraryHashSchema, text3, url, materialSourceSchema, materialTransformSchema, color2, count2, layerCommon, materialProceduralSpecSchema, materialNormalDerivationSchema, proceduralSchema, parametersSchema, materialManifestSchema, proceduralMaterialDraftSchema, materialLibraryPayloadSchema, authoringSchemas, samplerSchema, v3SpecSchema, atlasSpecSchema, atlasManifestSchema, materialMapPinSchema, materialRecipeV2Schema, materialManifestV2Schema, materialManifestAnySchema, materialLibraryPayloadV2Schema, materialLibraryPayloadAnySchema, proceduralMaterialDraftV2Schema, proceduralMaterialDraftAnySchema;+var MATERIAL_LIBRARY_LIMITS, MATERIAL_LIBRARY_SLOTS, MATERIAL_LIBRARY_USAGE, slotNames, materialLibraryIdSchema, materialLibraryHashSchema, text3, url, materialSourceSchema, materialTransformSchema, color2, count3, layerCommon, materialProceduralSpecSchema, materialNormalDerivationSchema, proceduralSchema, parametersSchema, materialManifestSchema, proceduralMaterialDraftSchema, materialLibraryPayloadSchema, authoringSchemas, samplerSchema, v3SpecSchema, atlasSpecSchema, atlasManifestSchema, materialMapPinSchema, materialRecipeV2Schema, materialManifestV2Schema, materialManifestAnySchema, materialLibraryPayloadV2Schema, materialLibraryPayloadAnySchema, proceduralMaterialDraftV2Schema, proceduralMaterialDraftAnySchema;var init_material_library = __esm(() => {init_procedural_material_v2();init_procedural_texture_v3_contract();@@ -15147,7 +15208,7 @@ var init_material_library = __esm(() => {parameters: z4.record(z4.string().max(100), z4.union([z4.string().max(2000), z4.number().finite(), z4.boolean()])).optional()}).strict();color2 = z4.number().int().min(0).max(16777215);- count2 = z4.number().int().min(1).max(256);+ count3 = z4.number().int().min(1).max(256);layerCommon = {blend: z4.enum(["normal", "multiply", "screen", "overlay"]).default("normal"),opacity: z4.number().min(0).max(1).default(1)@@ -15171,14 +15232,14 @@ var init_material_library = __esm(() => {op: z4.literal("checker"),colorA: color2,colorB: color2,- squares: count2.default(8),+ squares: count3.default(8),...layerCommon}).strict(),z4.object({op: z4.literal("stripes"),colorA: color2,colorB: color2,- count: count2.default(8),+ count: count3.default(8),angleDeg: z4.number().min(-36000).max(36000).default(0),...layerCommon}).strict(),@@ -15193,8 +15254,8 @@ var init_material_library = __esm(() => {op: z4.literal("bricks"),brick: color2,mortar: color2,- rows: count2.default(8),- cols: count2.default(4),+ rows: count3.default(8),+ cols: count3.default(4),mortarWidth: z4.number().min(0).max(1).default(0.06),stagger: z4.number().min(0).max(1).default(0.5),...layerCommon@@ -15203,7 +15264,7 @@ var init_material_library = __esm(() => {op: z4.literal("noise"),colorA: color2,colorB: color2,- scale: count2.default(8),+ scale: count3.default(8),octaves: z4.number().int().min(1).max(6).default(3),seed: z4.number().int().min(-2147483648).max(2147483647).default(0),...layerCommon@@ -18602,7 +18663,7 @@ function assertJson(input) {if (new TextEncoder().encode(JSON.stringify(input)).length > PORTABLE_MATERIAL_V3_LIMITS.maxJsonBytes)fail6("JSON byte budget exceeded.");}-function record6(value, keys) {+function record7(value, keys) {if (!value || typeof value !== "object" || Array.isArray(value))fail6("expected a JSON object.");const result = value;@@ -18622,7 +18683,7 @@ function admitMaterial(input) {"alphaCutoff","doubleSided"];- const r = record6(input, ["schemaVersion", "model", "name", "textures", ...scalarKeys]);+ const r = record7(input, ["schemaVersion", "model", "name", "textures", ...scalarKeys]);if (r["schemaVersion"] !== 3 || r["model"] !== "pbrMetallicRoughness")fail6("requires schemaVersion 3 and model pbrMetallicRoughness.");const name = r["name"];@@ -18633,12 +18694,12 @@ function admitMaterial(input) {model: "pbrMetallicRoughness",...Object.fromEntries(scalarKeys.filter((k) => r[k] !== undefined).map((k) => [k, r[k]]))});- const refs = record6(r["textures"] ?? {}, Object.keys(PORTABLE_MATERIAL_SLOT_USAGE));+ const refs = record7(r["textures"] ?? {}, Object.keys(PORTABLE_MATERIAL_SLOT_USAGE));const textures = {};let texels = 0, work = 0, bytes = 0;for (const [key, value] of Object.entries(refs)) {const slot = key;- const ref = record6(value, ["kind", "spec", "resourceId", "sampler"]);+ const ref = record7(value, ["kind", "spec", "resourceId", "sampler"]);const sampler = canonicalizePortableSamplerV1(ref["sampler"]);if (ref["kind"] === "procedural") {if (ref["resourceId"] !== undefined)@@ -18711,7 +18772,7 @@ var init_procedural_material_v3 = __esm(() => {// src/material-library-node.tsimport { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypto";-import { lstat as lstat2, mkdir as mkdir2, readFile, readdir, realpath as realpath2, rename as rename2, rm, writeFile as writeFile2 } from "node:fs/promises";+import { lstat as lstat3, mkdir as mkdir2, readFile, readdir, realpath as realpath2, rm, writeFile as writeFile2 } from "node:fs/promises";import { dirname as dirname2, join as join2, relative, resolve as resolve4, sep } from "node:path";import sharp from "sharp";import { DataTexture as DataTexture3 } from "three";@@ -19024,7 +19085,7 @@ class FileMaterialLibrary {throw new Error("Invalid material path identity");current = join2(current, part);try {- const stat = await lstat2(current);+ const stat = await lstat3(current);if (stat.isSymbolicLink() || !stat.isDirectory())throw new Error("Material library requires real directories");const rel = relative(canonical, await realpath2(current));@@ -19039,7 +19100,7 @@ class FileMaterialLibrary {}async file(dir, name, limit) {const path = join2(dir, name);- const stat = await lstat2(path);+ const stat = await lstat3(path);if (!stat.isFile() || stat.isSymbolicLink() || stat.size > limit)throw new Error("Invalid material library file");return new Uint8Array(await readFile(path));@@ -19128,7 +19189,7 @@ class FileMaterialLibrary {flag: "wx"});try {- await rename2(stage, dest);+ await renameDirectoryAtomically(stage, dest);} catch (error) {const existing = await this.read(manifest.materialId, manifest.revisionId).catch(() => {return;@@ -19651,6 +19712,7 @@ async function createMaterialRecordV2(draft, options) {}var digest = (bytes) => `sha256:${createHash5("sha256").update(bytes).digest("hex")}`, encoder, identity = (manifest) => `${manifest.materialId}/${manifest.revisionId}`;var init_material_library_node = __esm(() => {+ init_atomic_directory();init_material_library();init_portable_sampler();init_portable_sampler_runtime();@@ -19897,7 +19959,7 @@ function validateRequirementsQaReport(input, context) {const fail = () => {throw new TypeError("Invalid neutral requirements QA report.");};- if (!record7(input) || input.kind !== "kiln.asset-qa-report" || input.schemaVersion !== 2 || input.qaProfile !== "asset.requirements.v1" || !/^sha256:[a-f0-9]{64}$/.test(String(input.policyHash)) || !/^sha256:[a-f0-9]{64}$/.test(String(input.adviceHash)) || !["accepted", "incomplete", "blocked"].includes(String(input.acceptance)) || !["pass", "warn", "block", "notEvaluated"].includes(String(input.disposition)) || !record7(input.dimensions) || !Array.isArray(input.rules) || !Array.isArray(input.unevaluatedRequirements))+ if (!record8(input) || input.kind !== "kiln.asset-qa-report" || input.schemaVersion !== 2 || input.qaProfile !== "asset.requirements.v1" || !/^sha256:[a-f0-9]{64}$/.test(String(input.policyHash)) || !/^sha256:[a-f0-9]{64}$/.test(String(input.adviceHash)) || !["accepted", "incomplete", "blocked"].includes(String(input.acceptance)) || !["pass", "warn", "block", "notEvaluated"].includes(String(input.disposition)) || !record8(input.dimensions) || !Array.isArray(input.rules) || !Array.isArray(input.unevaluatedRequirements))return fail();if (Object.keys(input).sort().join(",") !== ["kind",@@ -19919,12 +19981,12 @@ function validateRequirementsQaReport(input, context) {const evaluated = [];for (const dimension of REQUIREMENTS_QA_DIMENSIONS) {const value = input.dimensions[dimension];- if (!record7(value) || !["pass", "warn", "block", "notEvaluated"].includes(String(value.status)) || !Array.isArray(value.findings) || value.findings.length > 1000 || Object.keys(value).some((key) => !["status", "findings", "metrics"].includes(key)))+ if (!record8(value) || !["pass", "warn", "block", "notEvaluated"].includes(String(value.status)) || !Array.isArray(value.findings) || value.findings.length > 1000 || Object.keys(value).some((key) => !["status", "findings", "metrics"].includes(key)))return fail();if (value.status !== "notEvaluated")evaluated.push(dimension);for (const finding of value.findings) {- if (!record7(finding) || finding.dimension !== dimension || !isQaFinding({+ if (!record8(finding) || finding.dimension !== dimension || !isQaFinding({...finding,dimension: dimension === "requirementReadiness" ? "categoryReadiness" : dimension}))@@ -19932,7 +19994,7 @@ function validateRequirementsQaReport(input, context) {findings.push(finding);}if (value.metrics !== undefined) {- if (!record7(value.metrics) || !Object.values(value.metrics).every((metric) => metric === null || typeof metric === "string" || typeof metric === "boolean" || typeof metric === "number" && Number.isFinite(metric)))+ if (!record8(value.metrics) || !Object.values(value.metrics).every((metric) => metric === null || typeof metric === "string" || typeof metric === "boolean" || typeof metric === "number" && Number.isFinite(metric)))return fail();metrics[dimension] = value.metrics;}@@ -19940,14 +20002,14 @@ function validateRequirementsQaReport(input, context) {const known = new Set(REQUIREMENTS_RULE_MAP.map((rule) => rule.id));const ids = new Set;for (const rule of input.rules) {- if (!record7(rule) || typeof rule.id !== "string" || !known.has(rule.id) || ids.has(rule.id) || !["off", "observe", "warn", "enforce"].includes(String(rule.mode)) || !["evaluated", "notEvaluated", "notRequested"].includes(String(rule.status)))+ if (!record8(rule) || typeof rule.id !== "string" || !known.has(rule.id) || ids.has(rule.id) || !["off", "observe", "warn", "enforce"].includes(String(rule.mode)) || !["evaluated", "notEvaluated", "notRequested"].includes(String(rule.status)))return fail();ids.add(rule.id);}if (ids.size !== known.size)return fail();for (const unmet of input.unevaluatedRequirements)- if (!record7(unmet) || typeof unmet.key !== "string" || !Array.isArray(unmet.fields) || !unmet.fields.every((x) => typeof x === "string") || typeof unmet.reason !== "string")+ if (!record8(unmet) || typeof unmet.key !== "string" || !Array.isArray(unmet.fields) || !unmet.fields.every((x) => typeof x === "string") || typeof unmet.reason !== "string")return fail();const result = input;if (context) {@@ -19967,7 +20029,7 @@ function validateRequirementsQaReport(input, context) {}return result;}-var REQUIREMENTS_QA_DIMENSIONS, record7 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), canonical3 = (value) => Array.isArray(value) ? `[${value.map(canonical3).join(",")}]` : record7(value) ? `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonical3(value[key])}`).join(",")}}` : JSON.stringify(value);+var REQUIREMENTS_QA_DIMENSIONS, record8 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), canonical3 = (value) => Array.isArray(value) ? `[${value.map(canonical3).join(",")}]` : record8(value) ? `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonical3(value[key])}`).join(",")}}` : JSON.stringify(value);var init_requirements_report = __esm(() => {init_requirements_applicability();init_types();@@ -22839,7 +22901,9 @@ function requireSolid(part) {}function assertRequiredSolids(root) {const problems = [];- const visit = (node) => {+ const meshes = [];+ let total = 0;+ const visit = (node, childPath) => {if (node.visible === false)return;const mesh = node;@@ -22853,15 +22917,29 @@ function assertRequiredSolids(root) {reasons.push(`not manifold (${report.nonManifoldEdges} edges shared by 3+ faces)`);if (solid.orientation !== "outward")reasons.push(solid.orientation === "mixed" ? `winding is mixed (${report.orientationConflicts} conflicting edges)` : `faces point inward (signed volume ${solid.signedVolume.toPrecision(4)})`);- if (reasons.length)- problems.push(`${mesh.name || "(unnamed mesh)"}: ${reasons.join(", ")}`);+ if (reasons.length) {+ total++;+ if (meshes.length < MAX_SOLID_FAILURE_MESHES) {+ problems.push(`${mesh.name || "(unnamed mesh)"}: ${reasons.join(", ")}`);+ meshes.push({+ childPath: childPath.length <= MAX_SOLID_FAILURE_PATH ? childPath : null,+ closed: solid.closed,+ manifold: solid.manifold,+ orientation: solid.orientation,+ boundaryEdges: report.boundaryEdges,+ nonManifoldEdges: report.nonManifoldEdges,+ orientationConflicts: report.orientationConflicts+ });+ }+ }}- for (const child of node.children)- visit(child);+ node.children.forEach((child, index) => {+ visit(child, [...childPath, index]);+ });};- visit(root);- if (problems.length)- throw new AuthoringDiagnosticError("REQUIRE_SOLID", `requireSolid: ${problems.length} marked mesh(es) are not closed, manifold, outward solids: ${problems.slice(0, 4).join("; ")}${problems.length > 4 ? "; ..." : ""}.`);+ visit(root, []);+ if (total)+ throw new RequiredSolidError({ total, truncated: total > meshes.length, meshes }, `requireSolid: ${total} marked mesh(es) are not closed, manifold, outward solids: ${problems.join("; ")}${total > meshes.length ? "; ..." : ""}.`);}var REQUIRE_SOLID_KEY = "kilnRequireSolid", marked = (node) => {for (let at = node;at; at = at.parent)@@ -22872,6 +22950,7 @@ var REQUIRE_SOLID_KEY = "kilnRequireSolid", marked = (node) => {var init_require_solid = __esm(() => {init_authoring_diagnostic();init_geometry();+ init_solid_diagnostic();});// src/user-data-extras.ts@@ -24027,7 +24106,7 @@ function normalizeBudget(spec) {fail8(`unknown field ${JSON.stringify(key)}.`);const triangles = {};if (typeof value.triangles === "number")- triangles.LOD0 = count3("triangles", value.triangles);+ triangles.LOD0 = count4("triangles", value.triangles);else if (value.triangles && typeof value.triangles === "object" && !Array.isArray(value.triangles)) {const entries = Object.entries(value.triangles);if (entries.length === 0)@@ -24035,7 +24114,7 @@ function normalizeBudget(spec) {for (const [tier, limit] of entries) {if (!/^LOD(0|[1-9][0-9]?)$/.test(tier))fail8(`triangles tier ${JSON.stringify(tier)} must be named LOD0, LOD1, ...`);- triangles[tier] = count3(`triangles.${tier}`, limit);+ triangles[tier] = count4(`triangles.${tier}`, limit);}} elsefail8("triangles must be a positive integer or a record of LOD tiers.");@@ -24043,7 +24122,7 @@ function normalizeBudget(spec) {return {schemaVersion: 1,triangles: ordered,- ...value.draws === undefined ? {} : { draws: count3("draws", value.draws) }+ ...value.draws === undefined ? {} : { draws: count4("draws", value.draws) }};}function defineBudget(spec, target) {@@ -24097,7 +24176,7 @@ function evaluateBudget(declaration, measuredLod0, chains) {}var KILN_BUDGET_KEY = "kilnBudgetV1", fail8 = (detail) => {throw new AuthoringDiagnosticError("DELIVERY_CONTRACT", `defineBudget(spec): ${detail}`);-}, count3 = (label, value) => {+}, count4 = (label, value) => {if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1)fail8(`${label} must be a positive integer, got ${String(value)}.`);return value;@@ -26372,8 +26451,166 @@ var init_profile = __esm(() => {};});-// src/uv-shapes.ts+// src/sdf.ts+function sphereInside(point, center, radius) {+ if (point.length !== 3 || !point.every(Number.isFinite))+ throw new Error("sphereInside point must be three finite numbers");+ if (!Number.isFinite(radius) || radius <= 0)+ throw new Error("sphereInside radius must be positive and finite");+ if (center.length !== 3 || !center.every(Number.isFinite))+ throw new Error("sphereInside center must be three finite numbers");+ return radius - Math.hypot(point[0] - center[0], point[1] - center[1], point[2] - center[2]);+}+function smoothUnion(a, b, blend) {+ if (!Number.isFinite(a) || !Number.isFinite(b))+ throw new Error("smoothUnion operands must be finite");+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("smoothUnion blend must be positive and finite");+ const h = Math.max(blend - Math.abs(a - b), 0) / blend;+ return Math.max(a, b) + h * h * blend / 4;+}+function smoothUnionSpheres(point, spheres, blend) {+ if (!spheres.length)+ throw new Error("smoothUnionSpheres needs at least one sphere");+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("smoothUnionSpheres blend must be positive and finite");+ let value = sphereInside(point, spheres[0].center, spheres[0].radius);+ for (let i = 1;i < spheres.length; i++) {+ const s = spheres[i];+ value = smoothUnion(value, sphereInside(point, s.center, s.radius), blend);+ }+ return value;+}++// src/organic.tsimport * as THREE41 from "three";+function assertSafePathCount(name, count) {+ if (!Number.isSafeInteger(count))+ throw new Error(`${name} derived sample count must be a safe integer; reduce sample counts.`);+}+async function metaballSurface(spheres, options) {+ if (!spheres.length)+ throw new Error("metaballSurface needs at least one sphere");+ let minRadius = Infinity;+ for (const s of spheres) {+ if (s.center.length !== 3 || !s.center.every(Number.isFinite))+ throw new Error("metaballSurface sphere center must be three finite numbers");+ if (!Number.isFinite(s.radius) || s.radius <= 0)+ throw new Error("metaballSurface sphere radius must be positive and finite");+ minRadius = Math.min(minRadius, s.radius);+ }+ const blend = options.blend ?? Math.max(minRadius * 0.35, 0.02);+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("metaballSurface blend must be positive and finite");+ const { bounds, ...rest } = options;+ const field = (p) => smoothUnionSpheres(p, spheres, blend);+ return implicitSurface(field, { bounds, ...rest });+}+function catmullRomPath(controlPoints, samplesPerSpan = 8, closed = false) {+ if (controlPoints.length < (closed ? 3 : 2))+ throw new Error("catmullRomPath needs at least two open or three closed control points");+ if (!Number.isSafeInteger(samplesPerSpan) || samplesPerSpan < 1)+ throw new Error("catmullRomPath samplesPerSpan must be a positive integer");+ const spans = closed ? controlPoints.length : controlPoints.length - 1;+ assertSafePathCount("catmullRomPath", spans * samplesPerSpan + 1);+ if (controlPoints.some((p) => p.length !== 3 || !p.every(Number.isFinite)))+ throw new Error("catmullRomPath control points must be finite [x,y,z] triples");+ const vectors = controlPoints.map((p) => new THREE41.Vector3(p[0], p[1], p[2]));+ const curve = new THREE41.CatmullRomCurve3(vectors, closed);+ const points = curve.getPoints(spans * samplesPerSpan);+ if (closed)+ points.pop();+ return points.map((v) => [v.x, v.y, v.z]);+}+function taperedTube(path, radii, options = {}) {+ const closed = options.closed ?? false;+ const stations = path;+ if (stations.length < (closed ? 3 : 2))+ throw new Error("taperedTube needs at least two open or three closed path points");+ if (radii.length !== stations.length)+ throw new Error("taperedTube radii must have one entry per path point");+ for (const r of radii) {+ if (!Number.isFinite(r) || r <= 0)+ throw new Error("taperedTube radii must be positive and finite");+ }+ const radialSegments = options.radialSegments ?? 20;+ const profile = circleProfile(1, radialSegments).map(([x, y]) => [x, y]);+ const scale = radii.map((r, i) => {+ const [side, depth] = options.sectionScale?.[i] ?? [1, 1];+ return [r * side, r * depth];+ });+ if (options.sectionScale && options.sectionScale.length !== stations.length)+ throw new Error("taperedTube sectionScale needs one [side, depth] pair per path point");+ const geo = sweepProfile(profile, [...stations], {+ cap: options.cap ?? true,+ closed,+ up: options.up,+ twist: options.twist ?? 0,+ scale,+ creaseAngle: options.creaseAngle ?? 180+ });+ return geo;+}+function spiralPath(options) {+ const {+ center,+ radius,+ rise,+ turns,+ axis = [0, 1, 0],+ forward = [0, 0, 1],+ samples = 24+ } = options;+ if (![radius, rise, turns].every((n) => Number.isFinite(n) && n > 0))+ throw new Error("spiralPath radius, rise and turns must be positive and finite");+ if (!Number.isSafeInteger(samples) || samples < 4)+ throw new Error("spiralPath samples must be an integer >= 4");+ assertSafePathCount("spiralPath", samples + 1);+ if (center.length !== 3 || !center.every(Number.isFinite))+ throw new Error("spiralPath center must be a finite [x,y,z] triple");+ if (axis.length !== 3 || forward.length !== 3 || ![...axis, ...forward].every(Number.isFinite))+ throw new Error("spiralPath axis and forward must be finite [x,y,z] triples");+ const up = new THREE41.Vector3(...axis);+ const fwd = new THREE41.Vector3(...forward);+ if (up.lengthSq() < 0.000000000001 || fwd.lengthSq() < 0.000000000001)+ throw new Error("spiralPath axis and forward must be nonzero");+ up.normalize();+ const horiz = fwd.clone().addScaledVector(up, -fwd.dot(up));+ if (horiz.lengthSq() < 0.000000000001)+ throw new Error("spiralPath forward must not be parallel to axis");+ horiz.normalize();+ const right = new THREE41.Vector3().crossVectors(up, horiz).normalize();+ const out = [];+ for (let i = 0;i <= samples; i++) {+ const u = i / samples;+ const theta = u * turns * Math.PI * 2;+ const r = radius * (1 - u * 0.58);+ const offset = horiz.clone().multiplyScalar(r * Math.cos(theta)).add(right.clone().multiplyScalar(r * Math.sin(theta)));+ const lift = up.clone().multiplyScalar(u * rise);+ out.push([+ center[0] + offset.x + lift.x,+ center[1] + offset.y + lift.y,+ center[2] + offset.z + lift.z+ ]);+ }+ return out;+}+function smoothOrganic(geometry, options = {}) {+ const iterations = options.iterations ?? 1;+ const preserveUV = options.preserveUV ?? false;+ const subdivided = subdivide(geometry, iterations, preserveUV ? { preserveUV: true } : undefined);+ return creaseNormals(subdivided, { angle: options.creaseAngle ?? 55 });+}+var init_organic = __esm(() => {+ init_geometry();+ init_implicit();+ init_profile();+ init_ops();+ init_sweep2();+});++// src/uv-shapes.ts+import * as THREE42 from "three";function remapUV(geo, options = {}) {if (!options || typeof options !== "object" || Array.isArray(options) || Object.keys(options).some((key) => !["scale", "offset"].includes(key))) {throw new Error("remapUV: options may contain only scale and offset.");@@ -26402,7 +26639,7 @@ function remapUV(geo, options = {}) {}const cloned = geo.clone();cloned.userData = structuredClone(geo.userData);- cloned.setAttribute("uv", new THREE41.Float32BufferAttribute(values, 2));+ cloned.setAttribute("uv", new THREE42.Float32BufferAttribute(values, 2));if ((scale[0] !== 1 || scale[1] !== 1) && cloned.hasAttribute("tangent")) {cloned.deleteAttribute("tangent");const previous = cloned.userData.kilnAttributeWarnings;@@ -26419,13 +26656,13 @@ function remapUV(geo, options = {}) {var init_uv_shapes = () => {};// src/texture-atlas.ts-import * as THREE42 from "three";+import * as THREE43 from "three";async function textureAtlas(input, options = {}) {const compiled = await compileTextureAtlasSpecV1(input, options);- const texture = new THREE42.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE42.RGBAFormat, THREE42.UnsignedByteType);+ const texture = new THREE43.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE43.RGBAFormat, THREE43.UnsignedByteType);texture.name = "Atlas";texture.flipY = false;- texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE42.SRGBColorSpace : THREE42.NoColorSpace;+ texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE43.SRGBColorSpace : THREE43.NoColorSpace;applyPortableSamplerV1(texture, compiled.spec.sampler);texture.userData.kilnAtlas = { spec: compiled.spec, manifest: compiled.manifest };texture.userData.kilnTexture = {@@ -26476,7 +26713,7 @@ function remapUVToAtlas(geometry, atlas, name, options) {bytes += buffer.byteLength;}} else {- bytes += attribute.array.byteLength * (attribute.constructor === THREE42.BufferAttribute || attribute.constructor === THREE42.InstancedBufferAttribute ? 1 : 2);+ bytes += attribute.array.byteLength * (attribute.constructor === THREE43.BufferAttribute || attribute.constructor === THREE43.InstancedBufferAttribute ? 1 : 2);}};for (const attr of Object.values(geometry.attributes))@@ -26700,7 +26937,7 @@ var init_portable_material_runtime = __esm(() => {});// src/uv-data.ts-import * as THREE43 from "three";+import * as THREE44 from "three";function validateAtlasRemap(mesh, inputIndex, sourceCount) {const count = mesh.vertexCount;if (!Number.isSafeInteger(count) || count < 1 || count > GEOMETRY_ALLOCATION_LIMITS.unwrapVertices)@@ -26735,7 +26972,7 @@ function remapUnwrapAttribute(attribute, oldIndexes) {for (let c = 0;c < attribute.itemSize; c++)array[i * attribute.itemSize + c] = attribute.array[oldIndexes[i] * stride + offset + c];}- const output = attribute.isFloat16BufferAttribute ? new THREE43.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE43.BufferAttribute(array, attribute.itemSize, attribute.normalized);+ const output = attribute.isFloat16BufferAttribute ? new THREE44.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE44.BufferAttribute(array, attribute.itemSize, attribute.normalized);output.name = attribute.name;output.setUsage(interleaved(attribute) ? attribute.data.usage : attribute.usage);if (!interleaved(attribute))@@ -26847,7 +27084,7 @@ var init_uv_data = __esm(() => {});// src/uv.ts-import * as THREE44 from "three";+import * as THREE45 from "three";async function getXatlas() {if (!_xatlasReady) {_xatlasReady = (async () => {@@ -26879,7 +27116,7 @@ async function autoUnwrap(geometry, opts = {}) {if (result.atlasCount !== 1 || !Number.isSafeInteger(result.width) || result.width <= 0 || !Number.isSafeInteger(result.height) || result.height <= 0)throw new Error("autoUnwrap: xatlas must return one valid atlas; multiple atlas pages are unsupported.");const remap = validateAtlasRemap(mesh, prepared.index, geometry.getAttribute("position").count);- const out = new THREE44.BufferGeometry;+ const out = new THREE45.BufferGeometry;for (const [name, attribute] of Object.entries(geometry.attributes)) {if (name === "uv" || name === "tangent" || name === "normal" && !prepared.useNormals)continue;@@ -26889,8 +27126,8 @@ async function autoUnwrap(geometry, opts = {}) {out.morphAttributes[name] = targets.map((attribute) => remapUnwrapAttribute(attribute, remap.oldIndexes));}out.morphTargetsRelative = geometry.morphTargetsRelative;- out.setIndex(new THREE44.BufferAttribute(new Uint32Array(remap.index), 1));- out.setAttribute("uv", new THREE44.BufferAttribute(new Float32Array(remap.uv), 2));+ out.setIndex(new THREE45.BufferAttribute(new Uint32Array(remap.index), 1));+ out.setAttribute("uv", new THREE45.BufferAttribute(new Float32Array(remap.uv), 2));out.name = geometry.name;out.groups = geometry.groups.map((group) => ({ ...group }));out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);@@ -26925,11 +27162,11 @@ function repairZeroNormals(geo) {if (broken.size === 0)return;const acc = new Float32Array(normal.count * 3);- const a = new THREE44.Vector3;- const b = new THREE44.Vector3;- const c = new THREE44.Vector3;- const face = new THREE44.Vector3;- const edge = new THREE44.Vector3;+ const a = new THREE45.Vector3;+ const b = new THREE45.Vector3;+ const c = new THREE45.Vector3;+ const face = new THREE45.Vector3;+ const edge = new THREE45.Vector3;for (let t = 0;t + 2 < index.count; t += 3) {const tri = [index.getX(t), index.getX(t + 1), index.getX(t + 2)];if (!tri.some((i) => broken.has(i)))@@ -26965,7 +27202,7 @@ var init_uv = __esm(() => {});// src/uv-project.ts-import * as THREE45 from "three";+import * as THREE46 from "three";function projectUV(geometry, options) {if (!options || typeof options !== "object" || Array.isArray(options) || !["planar", "box", "cylindrical"].includes(options.projection) || Object.keys(options).some((key) => !["projection", "frame", "seamDegrees", "angularRange", "caps"].includes(key)))throw new Error("projectUV: select an explicit planar, box or cylindrical projection with documented options.");@@ -27003,15 +27240,15 @@ function projectUV(geometry, options) {throw new Error("projectUV: index contains an invalid vertex reference.");}const points = [];- const bounds = new THREE45.Box3;+ const bounds = new THREE46.Box3;for (let i = 0;i < positions.count; i++) {- const point = new THREE45.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);+ const point = new THREE46.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);if (![point.x, point.y, point.z].every(Number.isFinite))throw new Error("projectUV: frame-local positions must be finite.");points.push(point);bounds.expandByPoint(point);}- const extent = bounds.getSize(new THREE45.Vector3);+ const extent = bounds.getSize(new THREE46.Vector3);const fit = (point, axis) => extent[axis] > 0 ? (point[axis] - bounds.min[axis]) / extent[axis] : 0.5;const outputUVs = new Float32Array(corners * 2);const startDegrees = options.angularRange?.[0] ?? options.seamDegrees ?? 180;@@ -27019,8 +27256,8 @@ function projectUV(geometry, options) {const sweep = (options.angularRange?.[1] ?? 360) * Math.PI / 180;const fullWrap = options.angularRange === undefined || options.angularRange[1] === 360;const wrap = (angle) => (angle % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);- const normal = new THREE45.Vector3;- const edge = new THREE45.Vector3;+ const normal = new THREE46.Vector3;+ const edge = new THREE46.Vector3;for (let i = 0;i < corners; i += 3) {const triangle = [0, 1, 2].map((offset) => points[index ? index.getX(i + offset) : i + offset]);normal.subVectors(triangle[1], triangle[0]).cross(edge.subVectors(triangle[2], triangle[0])).normalize();@@ -27067,7 +27304,7 @@ function projectUV(geometry, options) {const out = geometry.index ? geometry.toNonIndexed() : geometry.clone();out.userData = structuredClone(geometry.userData);out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);- out.setAttribute("uv", new THREE45.Float32BufferAttribute(outputUVs, 2));+ out.setAttribute("uv", new THREE46.Float32BufferAttribute(outputUVs, 2));if (out.hasAttribute("tangent")) {out.deleteAttribute("tangent");const previous = out.userData.kilnAttributeWarnings;@@ -27088,17 +27325,17 @@ var init_uv_project = __esm(() => {});// src/primitives.ts-import * as THREE46 from "three";+import * as THREE47 from "three";function vectorToTuple(v) {return [v.x, v.y, v.z];}function createRoot(name) {- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;return root;}function createPivot(name, position = [0, 0, 0], parent) {- const pivot = new THREE46.Object3D;+ const pivot = new THREE47.Object3D;pivot.name = `Joint_${name}`;pivot.position.set(...position);if (parent)@@ -27130,16 +27367,16 @@ function assertPartArgs(name, geometry2, material) {}function createPart(name, geometry2, material, options = {}) {assertPartArgs(name, geometry2, material);- const mesh = new THREE46.Mesh(geometry2, material);+ const mesh = new THREE47.Mesh(geometry2, material);mesh.name = `Mesh_${name}`;if (options.position)mesh.position.set(...options.position);if (options.rotation)- mesh.rotation.set(THREE46.MathUtils.degToRad(options.rotation[0]), THREE46.MathUtils.degToRad(options.rotation[1]), THREE46.MathUtils.degToRad(options.rotation[2]));+ mesh.rotation.set(THREE47.MathUtils.degToRad(options.rotation[0]), THREE47.MathUtils.degToRad(options.rotation[1]), THREE47.MathUtils.degToRad(options.rotation[2]));if (options.scale)mesh.scale.set(...options.scale);if (options.pivot) {- const pivot = new THREE46.Object3D;+ const pivot = new THREE47.Object3D;pivot.name = `Joint_${name}`;pivot.add(mesh);mesh.position.set(0, 0, 0);@@ -27162,7 +27399,7 @@ function capsuleGeo(radius, height, segments = 6) {assertDimension("capsuleGeo height (straight middle length)", height, true);assertDimension("capsuleGeo outer half-length", height / 2 + radius);assertPrimitiveSegments("capsuleGeo segments", segments, 3);- return new THREE46.CapsuleGeometry(radius, height, 2, segments);+ return new THREE47.CapsuleGeometry(radius, height, 2, segments);}function capsuleXGeo(radius, length, segments = 6) {const geo = capsuleGeo(radius, length, segments);@@ -27181,7 +27418,7 @@ function cylinderGeo(radiusTop, radiusBottom, height, segments = 8) {throw new RangeError("cylinderGeo requires at least one positive radius.");assertDimension("cylinderGeo height", height);assertPrimitiveSegments("cylinderGeo segments", segments, 3);- return new THREE46.CylinderGeometry(radiusTop, radiusBottom, height, segments);+ return new THREE47.CylinderGeometry(radiusTop, radiusBottom, height, segments);}function cylinderXGeo(radiusTop, radiusBottom, length, segments = 8) {const geo = cylinderGeo(radiusTop, radiusBottom, length, segments);@@ -27196,20 +27433,20 @@ function cylinderZGeo(radiusTop, radiusBottom, length, segments = 8) {function boxGeo(width, height, depth) {for (const [name, value] of Object.entries({ width, height, depth }))assertDimension(`boxGeo ${name} (use planeGeo for a sheet)`, value);- return new THREE46.BoxGeometry(width, height, depth);+ return new THREE47.BoxGeometry(width, height, depth);}function sphereGeo(radius, widthSegments = 8, heightSegments = 6) {assertDimension("sphereGeo radius", radius);assertPrimitiveSegments("sphereGeo widthSegments", widthSegments, 3);assertPrimitiveSegments("sphereGeo heightSegments", heightSegments, 2);assertPrimitiveGrid("sphereGeo", widthSegments, heightSegments);- return new THREE46.SphereGeometry(radius, widthSegments, heightSegments);+ return new THREE47.SphereGeometry(radius, widthSegments, heightSegments);}function coneGeo(radius, height, segments = 8) {assertDimension("coneGeo radius", radius);assertDimension("coneGeo height", height);assertPrimitiveSegments("coneGeo segments", segments, 3);- return new THREE46.ConeGeometry(radius, height, segments);+ return new THREE47.ConeGeometry(radius, height, segments);}function coneXGeo(radius, length, segments = 8) {const geo = coneGeo(radius, length, segments);@@ -27226,7 +27463,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {const segments = options.segments ?? 8;assertFiniteTriple("cylinderOnAxis center", center);assertFiniteTriple("cylinderOnAxis normal", normal);- const n = new THREE46.Vector3(normal[0], normal[1], normal[2]);+ const n = new THREE47.Vector3(normal[0], normal[1], normal[2]);const len = Math.hypot(...normal);if (len < 0.000001) {throw new Error(`cylinderOnAxis: normal must be a non-zero vector (got [${normal.join(",")}]).`);@@ -27234,7 +27471,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {const magnitude = Math.max(...normal.map(Math.abs));n.set(normal[0] / magnitude, normal[1] / magnitude, normal[2] / magnitude).normalize();const geo = cylinderGeo(radiusTop, radiusBottom, height, segments);- const q = new THREE46.Quaternion().setFromUnitVectors(new THREE46.Vector3(0, 1, 0), n);+ const q = new THREE47.Quaternion().setFromUnitVectors(new THREE47.Vector3(0, 1, 0), n);geo.applyQuaternion(q);geo.translate(center[0], center[1], center[2]);return geo;@@ -27256,7 +27493,7 @@ function torusGeo(radius, tube, radialSegments = 8, tubularSegments = 12) {assertPrimitiveSegments("torusGeo radialSegments", radialSegments, 3);assertPrimitiveSegments("torusGeo tubularSegments", tubularSegments, 3);assertPrimitiveGrid("torusGeo", radialSegments, tubularSegments);- return new THREE46.TorusGeometry(radius, tube, radialSegments, tubularSegments);+ return new THREE47.TorusGeometry(radius, tube, radialSegments, tubularSegments);}function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {assertDimension("planeGeo width", width);@@ -27264,14 +27501,14 @@ function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {assertPrimitiveSegments("planeGeo widthSegments", widthSegments, 1);assertPrimitiveSegments("planeGeo heightSegments", heightSegments, 1);assertPrimitiveGrid("planeGeo", widthSegments, heightSegments);- return new THREE46.PlaneGeometry(width, height, widthSegments, heightSegments);+ return new THREE47.PlaneGeometry(width, height, widthSegments, heightSegments);}function decalBox(width, height, depth = 0.01) {assertDimension("decalBox width", width);assertDimension("decalBox height", height);assertDimension("decalBox depth", depth, true);const d = Math.max(depth, 0.002);- return new THREE46.BoxGeometry(width, height, d);+ return new THREE47.BoxGeometry(width, height, d);}function validateCardFrame(name, width, height, yPivot) {assertDimension(`${name} width`, width);@@ -27285,7 +27522,7 @@ function foliageCardGeo(opts = {}) {const h = opts.height ?? 1;const yPivot = opts.yPivot ?? 0;validateCardFrame("foliageCardGeo", w, h, yPivot);- const geom = new THREE46.PlaneGeometry(w, h);+ const geom = new THREE47.PlaneGeometry(w, h);geom.translate(0, h * (0.5 - yPivot), 0);geom.userData["kilnGeometryRole"] = "foliageCard";return geom;@@ -27301,12 +27538,12 @@ function crossedQuadsGeo(opts = {}) {const geometries = [];for (let i = 0;i < planes; i++) {const angle = i / planes * Math.PI;- const quad = new THREE46.PlaneGeometry(w, h);+ const quad = new THREE47.PlaneGeometry(w, h);quad.translate(0, h * (0.5 - yPivot), 0);quad.rotateY(angle);geometries.push(quad);}- const out = new THREE46.BufferGeometry;+ const out = new THREE47.BufferGeometry;const posCount = geometries.reduce((sum, g) => sum + (g.attributes.position?.count ?? 0), 0);const positions = new Float32Array(posCount * 3);const normals = new Float32Array(posCount * 3);@@ -27333,9 +27570,9 @@ function crossedQuadsGeo(opts = {}) {}vOffset += p.count;}- out.setAttribute("position", new THREE46.BufferAttribute(positions, 3));- out.setAttribute("normal", new THREE46.BufferAttribute(normals, 3));- out.setAttribute("uv", new THREE46.BufferAttribute(uvs, 2));+ out.setAttribute("position", new THREE47.BufferAttribute(positions, 3));+ out.setAttribute("normal", new THREE47.BufferAttribute(normals, 3));+ out.setAttribute("uv", new THREE47.BufferAttribute(uvs, 2));out.setIndex(indices);out.userData["kilnGeometryRole"] = "foliageCard";return out;@@ -27350,7 +27587,7 @@ function octaGridPlane(opts) {const h = opts.height ?? 1;const yPivot = opts.yPivot ?? 0;validateCardFrame("octaGridPlane", w, h, yPivot);- const geom = new THREE46.PlaneGeometry(w, h);+ const geom = new THREE47.PlaneGeometry(w, h);geom.translate(0, h * (0.5 - yPivot), 0);const uv = geom.attributes.uv;const du = 1 / opts.tilesX;@@ -27446,8 +27683,8 @@ function wingGeo(options = {}) {7,6];- const geo = new THREE46.BufferGeometry;- geo.setAttribute("position", new THREE46.BufferAttribute(vertices, 3));+ const geo = new THREE47.BufferGeometry;+ geo.setAttribute("position", new THREE47.BufferAttribute(vertices, 3));geo.setIndex(tipChord === 0 ? [0, 1, 3, 4, 7, 5, 0, 2, 6, 0, 6, 4, 1, 5, 7, 1, 7, 3, 0, 4, 5, 0, 5, 1] : indices);geo.computeVertexNormals();return geo;@@ -27478,17 +27715,17 @@ function createWingPair(name, material, options) {};}function beamBetween(name, start, end, radius, material, options = {}) {- const a = new THREE46.Vector3(...start);- const b = new THREE46.Vector3(...end);+ const a = new THREE47.Vector3(...start);+ const b = new THREE47.Vector3(...end);const direction = b.clone().sub(a);const length = direction.length();if (length <= 0.0001) {throw new Error(`beamBetween("${name}"): start and end must be different points (got start=[${start.join(",")}], end=[${end.join(",")}], delta=${length.toExponential(2)}). Pick two distinct endpoints or switch to cylinderGeo with an explicit length + position.`);}- const mesh = new THREE46.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);+ const mesh = new THREE47.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);mesh.name = `Mesh_${name}`;mesh.position.copy(a.add(b).multiplyScalar(0.5));- mesh.quaternion.setFromUnitVectors(new THREE46.Vector3(0, 1, 0), direction.normalize());+ mesh.quaternion.setFromUnitVectors(new THREE47.Vector3(0, 1, 0), direction.normalize());if (options.parent)options.parent.add(mesh);return mesh;@@ -27497,11 +27734,11 @@ function snapTo(part, host, options = {}) {const overlap = options.overlap ?? 0.02;part.updateWorldMatrix(true, true);host.updateWorldMatrix(true, true);- const a = new THREE46.Box3().setFromObject(part);- const b = new THREE46.Box3().setFromObject(host);+ const a = new THREE47.Box3().setFromObject(part);+ const b = new THREE47.Box3().setFromObject(host);if (a.isEmpty() || b.isEmpty())return part;- const delta = new THREE46.Vector3;+ const delta = new THREE47.Vector3;for (const axis of ["x", "y", "z"]) {if (a.min[axis] > b.max[axis])delta[axis] = b.max[axis] - a.min[axis];@@ -27517,7 +27754,7 @@ function snapTo(part, host, options = {}) {delta[dominant] = -overlap;const parent = part.parent;if (parent) {- const p0 = new THREE46.Vector3;+ const p0 = new THREE47.Vector3;part.getWorldPosition(p0);const p1 = p0.clone().add(delta);const l0 = parent.worldToLocal(p0.clone());@@ -27552,8 +27789,8 @@ function createLadder(name, options) {throw new RangeError("createLadder rungCount must be an integer from 0 to 10000.");if (widthAxis !== "x" && widthAxis !== "z")throw new RangeError("createLadder widthAxis must be x or z.");- const bottomVec = new THREE46.Vector3;- const topVec = new THREE46.Vector3(...top).sub(new THREE46.Vector3(...bottom));+ const bottomVec = new THREE47.Vector3;+ const topVec = new THREE47.Vector3(...top).sub(new THREE47.Vector3(...bottom));const length = Math.hypot(topVec.x, topVec.y, topVec.z);assertDimension("createLadder endpoint distance", length);if (length <= 0.0001)@@ -27561,7 +27798,7 @@ function createLadder(name, options) {const along = topVec.clone().divideScalar(length);if (widthDirection !== undefined)assertFiniteTriple("createLadder widthDirection", widthDirection);- let across = widthDirection ? new THREE46.Vector3(...widthDirection) : widthAxis === "x" ? new THREE46.Vector3(1, 0, 0) : new THREE46.Vector3(0, 0, 1);+ let across = widthDirection ? new THREE47.Vector3(...widthDirection) : widthAxis === "x" ? new THREE47.Vector3(1, 0, 0) : new THREE47.Vector3(0, 0, 1);const largest = Math.max(Math.abs(across.x), Math.abs(across.y), Math.abs(across.z));if (!largest)throw new RangeError("createLadder widthDirection must be nonzero.");@@ -27571,19 +27808,19 @@ function createLadder(name, options) {if (widthDirection)throw new RangeError("createLadder widthDirection must not be parallel to the endpoints.");const axes = [- new THREE46.Vector3(1, 0, 0),- new THREE46.Vector3(0, 1, 0),- new THREE46.Vector3(0, 0, 1)+ new THREE47.Vector3(1, 0, 0),+ new THREE47.Vector3(0, 1, 0),+ new THREE47.Vector3(0, 0, 1)];across = axes.reduce((best, axis) => Math.abs(axis.dot(along)) < Math.abs(best.dot(along)) ? axis : best);across.addScaledVector(along, -across.dot(along));}across.normalize();const offset = across.clone().multiplyScalar(width / 2);- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;root.position.set(...bottom);- const rotation = new THREE46.Quaternion().setFromRotationMatrix(new THREE46.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();+ const rotation = new THREE47.Quaternion().setFromRotationMatrix(new THREE47.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();stampSemanticMetadataV1(root, {roles: ["ladder"],frames: [@@ -27623,7 +27860,7 @@ function wallWithOpening(name, material, options) {if (opening && openings)throw new TypeError("wallWithOpening: use opening or openings, not both.");const built = buildWallPanels(length, height, thickness, openings ?? (opening ? [opening] : []));- const group = new THREE46.Object3D;+ const group = new THREE47.Object3D;group.name = name;const panel = (suffix, lenStart, lenEnd, yLo, yHi) => {const segLen = lenEnd - lenStart;@@ -27654,7 +27891,7 @@ function room(name, material, options = {}) {parent} = options;const openings = options.openings ?? [{ wall: "front", kind: "door" }];- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;const wall = (suffix, len, axis, pos, which) => {const w = wallWithOpening(`${name}_Wall${suffix}`, material, {@@ -27708,7 +27945,7 @@ function createStairs(name, material, options) {if (Math.abs(totalRise) < 0.0001 || Math.abs(totalRun) < 0.0001) {throw new Error(`createStairs("${name}"): totalRise and totalRun must be non-zero (got rise=${totalRise}, run=${totalRun}).`);}- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;const stepRise = totalRise / steps;const stepRun = totalRun / steps;@@ -27738,7 +27975,7 @@ function requireColor(color, fn) {}function gameMaterial(color, options = {}) {requireColor(color, "gameMaterial");- return new THREE46.MeshStandardMaterial({+ return new THREE47.MeshStandardMaterial({color,metalness: options.metalness ?? 0,roughness: options.roughness ?? 0.8,@@ -27749,7 +27986,7 @@ function gameMaterial(color, options = {}) {}function basicMaterial(color, options = {}) {requireColor(color, "basicMaterial");- return new THREE46.MeshBasicMaterial({+ return new THREE47.MeshBasicMaterial({color,transparent: options.transparent ?? false,opacity: options.opacity ?? 1@@ -27757,18 +27994,18 @@ function basicMaterial(color, options = {}) {}function glassMaterial(color, options = {}) {requireColor(color, "glassMaterial");- return new THREE46.MeshStandardMaterial({+ return new THREE47.MeshStandardMaterial({color,transparent: true,opacity: options.opacity ?? 0.35,roughness: options.roughness ?? 0.1,metalness: options.metalness ?? 0,- side: THREE46.DoubleSide+ side: THREE47.DoubleSide});}function lambertMaterial(color, options = {}) {requireColor(color, "lambertMaterial");- return new THREE46.MeshLambertMaterial({+ return new THREE47.MeshLambertMaterial({color,flatShading: options.flatShading ?? true,emissive: options.emissive ?? 0@@ -27778,12 +28015,12 @@ function threeInterpolation(mode) {if (mode !== undefined && !TRACK_INTERPOLATIONS.includes(mode)) {throw new Error(`Animation interpolation must be one of ${TRACK_INTERPOLATIONS.join(", ")}.`);}- return mode === "STEP" ? THREE46.InterpolateDiscrete : THREE46.InterpolateLinear;+ return mode === "STEP" ? THREE47.InterpolateDiscrete : THREE47.InterpolateLinear;}function interpolatedTrack(Type, name, times, values, interpolation) {if (!isCubicInterpolation(interpolation))return new Type(name, times, values, threeInterpolation(interpolation));- const quaternion = Type === THREE46.QuaternionKeyframeTrack;+ const quaternion = Type === THREE47.QuaternionKeyframeTrack;return useCubicSpline(new Type(name, times, cubicSplineValues(times, values, quaternion ? 4 : 3, interpolation, quaternion)));}function animationNumber(value, label) {@@ -27837,15 +28074,15 @@ function rotationTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "rotation", interpolation);const times = [];const values = [];- const euler = new THREE46.Euler;- const quat = new THREE46.Quaternion;+ const euler = new THREE47.Euler;+ const quat = new THREE47.Quaternion;for (const kf of keyframes) {times.push(kf.time);- euler.set(THREE46.MathUtils.degToRad(kf.rotation[0]), THREE46.MathUtils.degToRad(kf.rotation[1]), THREE46.MathUtils.degToRad(kf.rotation[2]));+ euler.set(THREE47.MathUtils.degToRad(kf.rotation[0]), THREE47.MathUtils.degToRad(kf.rotation[1]), THREE47.MathUtils.degToRad(kf.rotation[2]));quat.setFromEuler(euler);values.push(quat.x, quat.y, quat.z, quat.w);}- return interpolatedTrack(THREE46.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);+ return interpolatedTrack(THREE47.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);}function positionTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "position", interpolation);@@ -27855,7 +28092,7 @@ function positionTrack(jointName, keyframes, interpolation) {times.push(kf.time);values.push(...kf.position);}- return interpolatedTrack(THREE46.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);+ return interpolatedTrack(THREE47.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);}function scaleTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "scale", interpolation);@@ -27865,7 +28102,7 @@ function scaleTrack(jointName, keyframes, interpolation) {times.push(kf.time);values.push(...kf.scale);}- return interpolatedTrack(THREE46.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);+ return interpolatedTrack(THREE47.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);}function createClip(name, duration, tracks, options) {if (typeof name !== "string" || !name.trim())@@ -27878,7 +28115,7 @@ function createClip(name, duration, tracks, options) {const loop = clipLoopOption(options);const names = new Set;for (const track of tracks) {- if (!(track instanceof THREE46.KeyframeTrack))+ if (!(track instanceof THREE47.KeyframeTrack))throw new Error("Animation clip tracks must be KeyframeTrack instances.");if (typeof track.name !== "string")throw new Error("Animation track target/channel must use a string name.");@@ -27892,12 +28129,12 @@ function createClip(name, duration, tracks, options) {throw new Error(`Duplicate animation target/channel: ${track.name}.`);names.add(track.name);const quaternion = channel === "quaternion";- const Type = quaternion ? THREE46.QuaternionKeyframeTrack : THREE46.VectorKeyframeTrack;+ const Type = quaternion ? THREE47.QuaternionKeyframeTrack : THREE47.VectorKeyframeTrack;if (!(track instanceof Type))throw new Error(`Animation channel ${channel} requires ${quaternion ? "QuaternionKeyframeTrack" : "VectorKeyframeTrack"}.`);const cubic = isCubicSplineTrack(track);const mode = track.getInterpolation();- if (!cubic && mode !== THREE46.InterpolateLinear && mode !== THREE46.InterpolateDiscrete) {+ if (!cubic && mode !== THREE47.InterpolateLinear && mode !== THREE47.InterpolateDiscrete) {throw new Error("Animation interpolation must be LINEAR, STEP or CUBICSPLINE (the glTF sampler modes); three.js smooth and Bezier interpolants have no glTF form.");}animationTimes(track.times, track.name);@@ -27920,7 +28157,7 @@ function createClip(name, duration, tracks, options) {throw new Error(`Animation clip duration ${duration} does not include every key of ${track.name}.`);}}- const clip = new THREE46.AnimationClip(name, duration, tracks);+ const clip = new THREE47.AnimationClip(name, duration, tracks);if (loop !== undefined)clip.userData.kilnLoopIntent = loop ? "loop" : "once";return clip;@@ -27997,12 +28234,12 @@ function createInstance(name, source, options = {}) {if (!sourceMesh) {throw new Error(`createInstance("${name}"): source "${source.name}" has no Mesh to clone from`);}- const mesh = new THREE46.Mesh(sourceMesh.geometry, sourceMesh.material);+ const mesh = new THREE47.Mesh(sourceMesh.geometry, sourceMesh.material);mesh.name = `Mesh_${name}`;if (options.position)mesh.position.set(...options.position);if (options.rotation)- mesh.rotation.set(THREE46.MathUtils.degToRad(options.rotation[0]), THREE46.MathUtils.degToRad(options.rotation[1]), THREE46.MathUtils.degToRad(options.rotation[2]));+ mesh.rotation.set(THREE47.MathUtils.degToRad(options.rotation[0]), THREE47.MathUtils.degToRad(options.rotation[1]), THREE47.MathUtils.degToRad(options.rotation[2]));if (options.scale)mesh.scale.set(...options.scale);if (options.parent)@@ -28234,6 +28471,13 @@ function buildSandboxGlobals(usage, options = {}) {bobbingAnimation: wrap("bobbingAnimation", bobbingAnimation),idleBreathing: wrap("idleBreathing", idleBreathing),implicitSurface: wrap("implicitSurface", implicitSurface),+ metaballSurface: wrap("metaballSurface", metaballSurface),+ catmullRomPath: wrap("catmullRomPath", catmullRomPath),+ spiralPath: wrap("spiralPath", spiralPath),+ taperedTube: wrap("taperedTube", taperedTube),+ smoothOrganic: wrap("smoothOrganic", smoothOrganic),+ smoothUnion: wrap("smoothUnion", smoothUnion),+ sphereInside: wrap("sphereInside", sphereInside),sweepProfile: wrap("sweepProfile", sweepProfile),loftProfiles: wrap("loftProfiles", loftProfiles),bend: wrap("bend", bend),@@ -28285,7 +28529,7 @@ function buildSandboxGlobals(usage, options = {}) {countMaterials: wrap("countMaterials", countMaterials),getJointNames: wrap("getJointNames", getJointNames),materialBudgetAdvisory: wrap("materialBudgetAdvisory", materialBudgetAdvisory),- THREE: THREE46,+ THREE: THREE47,Math,console: options.console ?? console};@@ -28317,6 +28561,7 @@ var init_primitives = __esm(() => {init_deform();init_sweep2();init_implicit();+ init_organic();init_profile();init_solids();init_procedural_texture();@@ -28344,6 +28589,7 @@ var init_primitives = __esm(() => {init_procedural_texture();init_assembly();init_implicit();+ init_organic();init_sweep2();init_deform();init_geometry();@@ -28656,7 +28902,7 @@ import {PropertyType as PropertyType4} from "@gltf-transform/core";import { createTransform, dequantizePrimitive, joinPrimitives } from "@gltf-transform/functions";-import * as THREE47 from "three";+import * as THREE48 from "three";function isSingular(matrix) {const e = matrix.elements;const scale = Math.hypot(e[0], e[1], e[2]) * Math.hypot(e[4], e[5], e[6]) * Math.hypot(e[8], e[9], e[10]);@@ -28774,10 +29020,10 @@ function reverseWinding(prim) {}}function bake(prim, matrix) {- const linear = new THREE47.Matrix3().setFromMatrix4(matrix);- const normalMatrix = new THREE47.Matrix3().getNormalMatrix(matrix);+ const linear = new THREE48.Matrix3().setFromMatrix4(matrix);+ const normalMatrix = new THREE48.Matrix3().getNormalMatrix(matrix);const mirrored = matrix.determinant() < 0;- const v = new THREE47.Vector3;+ const v = new THREE48.Vector3;const each = (semantic, apply) => {const attribute = prim.getAttribute(semantic);const element = [];@@ -28801,7 +29047,7 @@ function destinationOf(entries) {let best = Infinity;let bestScale = Infinity;for (const { node } of entries) {- const linear = new THREE47.Matrix3().setFromMatrix4(worldOf(node));+ const linear = new THREE48.Matrix3().setFromMatrix4(worldOf(node));const norm = Math.hypot(...linear.elements);const inverseNorm = Math.hypot(...linear.clone().invert().elements);const condition = norm * inverseNorm;@@ -28815,9 +29061,9 @@ function destinationOf(entries) {return chosen;}function checkPositionPrecision(input, output, sourceWorld, destinationWorld, reversed) {- const expected = new THREE47.Vector3;- const actual = new THREE47.Vector3;- const bounds = new THREE47.Box3;+ const expected = new THREE48.Vector3;+ const actual = new THREE48.Vector3;+ const bounds = new THREE48.Box3;const element = [];let error = 0;let magnitude = 0;@@ -29138,7 +29384,7 @@ function rigidMerge(options = {}, onSummary) {onSummary?.(summary);});}-var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE47.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {+var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE48.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {const indices = prim.getIndices();return indices ? [...prim.listAttributes(), indices] : prim.listAttributes();}, primitiveBytes = (primitives) => [...new Set(primitives.flatMap(accessorsOf))].reduce((sum, a) => sum + (a.getArray()?.byteLength ?? 0), 0), countPrimitives = (nodes) => [...nodes].reduce((sum, node) => sum + (node.getMesh()?.listPrimitives().length ?? 0), 0);@@ -29310,6 +29556,63 @@ var init_geometry_catalog = __esm(() => {description: "Experimental positive-inside implicit field sampled into a solid mesh. Requires explicit bounds and resolution; checks grid size and actual evaluation count. Output has no UVs.",promptNotes: "Use async build and await. Smaller edgeLength increases cost sharply. This helper cannot stop a callback that never returns; the host evaluator process provides that boundary. Thin features and geometric accuracy require inspection.",example: "const blob = await implicitSurface(([x,y,z]) => 1-Math.hypot(x,y,z), { bounds: { min: [-1.2,-1.2,-1.2], max: [1.2,1.2,1.2] }, edgeLength: 0.15 });"+ },+ {+ name: "metaballSurface",+ signature: "await metaballSurface(spheres: { center: [x,y,z], radius }[], { bounds, edgeLength, blend?, maxCells?, maxEvaluations? })",+ returns: "Promise<THREE.BufferGeometry>",+ category: "geometry",+ description: "Experimental smooth union of spheres meshed through implicitSurface. Uses polynomial blending; output has no UVs.",+ promptNotes: "Prefer this over hand-rolling smoothUnion fields for creatures, blobs and rounded junctions. Match edgeLength to feature size.",+ example: "const body = await metaballSurface([{ center: [0,0.4,0], radius: 0.35 }, { center: [0.2,0.55,0], radius: 0.22 }], { bounds: { min: [-0.6,-0.1,-0.5], max: [0.6,1,0.5] }, edgeLength: 0.08 });"+ },+ {+ name: "taperedTube",+ signature: "taperedTube(path: [x,y,z][], radii: number[], opts?: { radialSegments?: 20, creaseAngle?: 180, cap?: true, closed?: false, up?, twist?, sectionScale?: [side,depth][] })",+ returns: "THREE.BufferGeometry",+ category: "curves",+ description: "Circular sweep with one radius per path station. Default creaseAngle 180 shades round profiles smoothly; sample splines with catmullRomPath first.",+ example: "const path = catmullRomPath([[0,0.5,0],[0.3,0.7,0],[0.5,0.4,0]], 6); const radii = path.map((_, i) => 0.08 - 0.06 * i / (path.length - 1)); const tail = taperedTube(path, radii);"+ },+ {+ name: "catmullRomPath",+ signature: "catmullRomPath(controlPoints: [x,y,z][], samplesPerSpan?: 8, closed?: false)",+ returns: "[x,y,z][]",+ category: "curves",+ description: "Samples a Catmull-Rom spline through waypoints. Open paths include both endpoints; closed paths omit the repeated endpoint for closed sweeps.",+ example: "const path = catmullRomPath([[0,0,0],[0.2,0.4,0.1],[0.5,0.2,0]], 10);"+ },+ {+ name: "spiralPath",+ signature: "spiralPath(opts: { center, radius, rise, turns, axis?, forward?, samples? })",+ returns: "[x,y,z][]",+ category: "curves",+ description: "Rising spiral for curled appendages, shrinking to 42% of the start radius. Returns samples + 1 stations; starts radius away from center.",+ example: "const curl = spiralPath({ center: [0,0.05,0], radius: 0.03, rise: 0.12, turns: 1.75, forward: [0,0,1] });"+ },+ {+ name: "smoothOrganic",+ signature: "smoothOrganic(geometry, opts?: { iterations?: 1, creaseAngle?: 55, preserveUV?: false })",+ returns: "THREE.BufferGeometry",+ category: "mesh-ops",+ description: "Runs subdivide then creaseNormals with organic-friendly defaults.",+ example: "const soft = smoothOrganic(tube, { iterations: 1, creaseAngle: 50 });"+ },+ {+ name: "smoothUnion",+ signature: "smoothUnion(a: number, b: number, blend: number)",+ returns: "number",+ category: "geometry",+ description: "Polynomial smooth maximum for positive-inside implicit fields. Compose inside implicitSurface callbacks.",+ example: "smoothUnion(sphereInside(p,[0,0,0],0.5), sphereInside(p,[0.3,0,0],0.4), 0.12)"+ },+ {+ name: "sphereInside",+ signature: "sphereInside(point: [x,y,z], center: [x,y,z], radius: number)",+ returns: "number",+ category: "geometry",+ description: "Positive-inside sphere field sample for implicitSurface. Returns radius minus distance to center.",+ example: "sphereInside(p, [0,0.4,0], 0.25)"}];});@@ -31579,7 +31882,7 @@ var init_kit = __esm(() => {// src/texture-bake.tsimport { createHash as createHash6 } from "node:crypto";-import * as THREE48 from "three";+import * as THREE49 from "three";function readPixels(texture) {const image = texture.image;if (!image)@@ -31706,7 +32009,7 @@ async function bakeSceneTextures(root, warnings) {mime: "image/png",bytes};- const colorSpace = entry.texture.colorSpace === THREE48.SRGBColorSpace ? "srgb" : "linear";+ const colorSpace = entry.texture.colorSpace === THREE49.SRGBColorSpace ? "srgb" : "linear";const recipe = entry.texture.userData["kilnProcedural"];const primaryUsage = atlasRecord?.spec.usage ?? recipe?.usage ?? (entry.bindings.some(({ slot }) => slot === "roughnessMap") && entry.bindings.some(({ slot }) => slot === "metalnessMap") ? "metallicRoughness" : entry.bindings[0]?.usage ?? "albedo");if (!encoded)@@ -31789,10 +32092,10 @@ function computeTangentBasis(geometry) {}}const out = new Float32Array(vertexCount * 4);- const n = new THREE48.Vector3;- const t = new THREE48.Vector3;- const tmp = new THREE48.Vector3;- const tmp2 = new THREE48.Vector3;+ const n = new THREE49.Vector3;+ const t = new THREE49.Vector3;+ const tmp = new THREE49.Vector3;+ const tmp2 = new THREE49.Vector3;for (let v = 0;v < vertexCount; v++) {n.set(normal.getX(v), normal.getY(v), normal.getZ(v));t.set(tan1[v * 3], tan1[v * 3 + 1], tan1[v * 3 + 2]);@@ -31812,7 +32115,7 @@ function computeTangentBasis(geometry) {out[v * 4 + 2] = tmp.z;out[v * 4 + 3] = w;}- geometry.setAttribute("tangent", new THREE48.BufferAttribute(out, 4));+ geometry.setAttribute("tangent", new THREE49.BufferAttribute(out, 4));}function ensureNormalMapTangents(root, warnings) {let count = 0;@@ -31930,7 +32233,7 @@ var init_exporter_node = __esm(() => {});// src/views/character.ts-import * as THREE49 from "three";+import * as THREE50 from "three";function rounded(value) {const result = Math.round(value * 1e9) / 1e9;return Object.is(result, -0) ? 0 : result;@@ -31972,9 +32275,9 @@ function buildCharacterDiagnosticDescriptor(root, findings = []) {const invalidPaths = new Set(invalidFindingNodePaths);const joints = evidence.map((joint) => {const relative = rootInverse.clone().multiply(joint.node.matrixWorld);- const position = new THREE49.Vector3().setFromMatrixPosition(relative);- const forward = new THREE49.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);- const bend = new THREE49.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);+ const position = new THREE50.Vector3().setFromMatrixPosition(relative);+ const forward = new THREE50.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);+ const bend = new THREE50.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);const chainId = chainIdFor(joint.descriptor, descriptorByRole);return {role: joint.descriptor.role,@@ -33386,7 +33689,7 @@ function prepareTriangleCoverage(ax, ay, bx, by, cx, cy, size) {}// src/views/raster.ts-import { Vector3 as Vector336 } from "three";+import { Vector3 as Vector337 } from "three";function orbitDir(azimuthDeg, elevationDeg) {const el = Math.min(MAX_ELEVATION_DEG, Math.max(MIN_ELEVATION_DEG, elevationDeg)) * Math.PI / 180;const az = azimuthDeg * Math.PI / 180;@@ -33421,7 +33724,7 @@ function updateSurfaceMatrices(root) {function surfaceVertexReader(mesh, position) {for (const bone of mesh.skeleton?.bones ?? [])bone.updateWorldMatrix?.(true, false);- const vertex = new Vector336;+ const vertex = new Vector337;if (mesh.getVertexPosition)return (index) => mesh.getVertexPosition(index, vertex);if (position.getX && position.getY && position.getZ)@@ -33831,7 +34134,7 @@ function cloneReviewScene(root, options = {}) {var init_scene_copy = () => {};// src/views/camera.ts-import { Vector3 as Vector337, Matrix4 as Matrix416, Euler as Euler5, Group as Group4 } from "three";+import { Vector3 as Vector338, Matrix4 as Matrix416, Euler as Euler5, Group as Group4 } from "three";function strict(value, keys, label) {for (const key of Object.keys(value))if (!keys.includes(key)) {@@ -33925,14 +34228,14 @@ function cameraFromBounds(bounds, dir, padding = 1, up, sceneBounds = bounds) {const z = vec(dir).normalize();if (!z.length())throw new Error("camera direction must be non-zero");- const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector337(0, 0, -1) : new Vector337(0, 1, 0);+ const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector338(0, 0, -1) : new Vector338(0, 1, 0);const x = hint.clone().cross(z).normalize();if (x.length() < 0.000000001)throw new Error("camera up must not be collinear with view");const y = z.clone().cross(x);let extent = 0.000001;for (let i = 0;i < 8; i++) {- const p = new Vector337((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);+ const p = new Vector338((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);extent = Math.max(extent, Math.abs(p.dot(x)), Math.abs(p.dot(y)));}const depthMin = bounds.min.map((v, i) => Math.min(v, sceneBounds.min[i]));@@ -34013,7 +34316,7 @@ function resolveAssetCamera(root, shot = {}) {if (relative !== "world") {const node = relative === "part" ? selected.node : rootNode;dir.transformDirection(node.matrixWorld);- up = tuple6(new Vector337(0, 1, 0).transformDirection(node.matrixWorld));+ up = tuple6(new Vector338(0, 1, 0).transformDirection(node.matrixWorld));}camera = cameraFromBounds(bounds, tuple6(dir), request.padding ?? 1.2, up, measureBounds(root));} else if (request.type === "explicit") {@@ -34060,7 +34363,7 @@ function resolveAssetCamera(root, shot = {}) {const position = vec(triple2(request.position, "position")).applyMatrix4(matrix);const target = request.target ? vec(triple2(request.target, "target")).applyMatrix4(matrix) : vec(bounds.min).add(vec(bounds.max)).multiplyScalar(0.5);const up = vec(triple2(request.up ?? [0, 1, 0], "up")).transformDirection(matrix);- const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector337().setFromMatrixPosition(matrix));+ const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector338().setFromMatrixPosition(matrix));const radius = vec(bounds.max).sub(vec(bounds.min)).length();camera = {version: "kiln.camera.v1",@@ -34189,11 +34492,11 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)}return result;};- const key = new Vector337(1.5, 2, 1).normalize();+ const key = new Vector338(1.5, 2, 1).normalize();const srgb = (n) => n <= 0.0031308 ? n * 12.92 : 1.055 * n ** (1 / 2.4) - 0.055;const ordered = compositingOrder(collectTriangles(root).tris, (px, py, pz) => camera.projection === "perspective" ? Math.hypot(px - position.x, py - position.y, pz - position.z) : (position.x - px) * z.x + (position.y - py) * z.y + (position.z - pz) * z.z);for (const tri of ordered) {- const world = [0, 1, 2].map((i) => new Vector337(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));+ const world = [0, 1, 2].map((i) => new Vector338(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));const normal = world[1].clone().sub(world[0]).cross(world[2].clone().sub(world[0])).normalize().multiplyScalar(tri.windingParity);const normalSign = visibleNormalSign(normal.dot(camera.projection === "perspective" ? position.clone().sub(world[0]) : z), tri.side, backfaceCull);if (normalSign === 0)@@ -34204,7 +34507,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)const color = tri.color.map((c) => Math.round(srgb(c * light) * 255));let polygon = world.map((p) => {const d = p.clone().sub(position);- return new Vector337(d.dot(x), d.dot(y), -d.dot(z));+ return new Vector338(d.dot(x), d.dot(y), -d.dot(z));});polygon = clip(clip(polygon, camera.near, true), camera.far, false);for (let t = 1;t < polygon.length - 1; t++) {@@ -34236,7 +34539,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)}return out;}-var vec = (a) => new Vector337(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;+var vec = (a) => new Vector338(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;var init_camera = __esm(() => {init_raster();init_background();@@ -35007,11 +35310,11 @@ import {PropertyBinding as PropertyBinding3,VectorKeyframeTrack as VectorKeyframeTrack2,Quaternion as Quaternion19,- Vector3 as Vector338,+ Vector3 as Vector339,InterpolateDiscrete as InterpolateDiscrete2,InterpolateLinear as InterpolateLinear2} from "three";-function record8(value) {+function record9(value) {return typeof value === "object" && value !== null && !Array.isArray(value);}function withLoopIntent(clip, intent) {@@ -35020,10 +35323,10 @@ function withLoopIntent(clip, intent) {return clip;}function reviewClipsFromExtras(extras) {- if (!record8(extras))+ if (!record9(extras))return;const envelope = extras[REVIEW_CLIPS_EXTRAS_KEY];- if (!record8(envelope) || envelope.version !== 1 && envelope.version !== 2 || !Array.isArray(envelope.clips)) {+ if (!record9(envelope) || envelope.version !== 1 && envelope.version !== 2 || !Array.isArray(envelope.clips)) {return;}const cubicAllowed = envelope.version === 2;@@ -35032,12 +35335,12 @@ function reviewClipsFromExtras(extras) {}let trackCount = 0;return envelope.clips.map((candidate) => {- if (!record8(candidate) || typeof candidate.name !== "string" || candidate.name.length > 256 || typeof candidate.duration !== "number" || !Number.isFinite(candidate.duration) || candidate.duration < 0 || !Array.isArray(candidate.tracks)) {+ if (!record9(candidate) || typeof candidate.name !== "string" || candidate.name.length > 256 || typeof candidate.duration !== "number" || !Number.isFinite(candidate.duration) || candidate.duration < 0 || !Array.isArray(candidate.tracks)) {throw new GlbGeometryFlatError("GLB_FLAT_PARSE_FAILED", "Invalid animation review clip.");}const tracks = candidate.tracks.map((track) => {trackCount++;- if (trackCount > REVIEW_CLIP_LIMITS.tracks || !record8(track) || typeof track.name !== "string" || track.name.length > 512 || !Array.isArray(track.times) || !Array.isArray(track.values) || track.interpolation !== undefined && track.interpolation !== "LINEAR" && track.interpolation !== "STEP" && !(cubicAllowed && track.interpolation === "CUBICSPLINE") || track.times.length > REVIEW_CLIP_LIMITS.samplesPerTrack || track.values.length > REVIEW_CLIP_LIMITS.valuesPerTrack || !track.times.every((value) => typeof value === "number" && Number.isFinite(value)) || !track.values.every((value) => typeof value === "number" && Number.isFinite(value))) {+ if (trackCount > REVIEW_CLIP_LIMITS.tracks || !record9(track) || typeof track.name !== "string" || track.name.length > 512 || !Array.isArray(track.times) || !Array.isArray(track.values) || track.interpolation !== undefined && track.interpolation !== "LINEAR" && track.interpolation !== "STEP" && !(cubicAllowed && track.interpolation === "CUBICSPLINE") || track.times.length > REVIEW_CLIP_LIMITS.samplesPerTrack || track.values.length > REVIEW_CLIP_LIMITS.valuesPerTrack || !track.times.every((value) => typeof value === "number" && Number.isFinite(value)) || !track.values.every((value) => typeof value === "number" && Number.isFinite(value))) {throw new GlbGeometryFlatError("GLB_FLAT_PARSE_FAILED", "Invalid animation review track.");}const property = track.name.slice(track.name.lastIndexOf(".") + 1);@@ -35191,7 +35494,7 @@ function instanceMatrices(node) {translations?.getElement(index, translation);rotations?.getElement(index, rotation);scales?.getElement(index, scale);- const local = new Matrix417().compose(new Vector338(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion19(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector338(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));+ const local = new Matrix417().compose(new Vector339(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion19(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector339(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));matrices.push(world.clone().multiply(local));}return { matrices, count };@@ -35298,7 +35601,7 @@ function localInstanceMatrices(node) {translations?.getElement(index, translation);rotations?.getElement(index, rotation);scales?.getElement(index, scale);- return new Matrix417().compose(new Vector338(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion19(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector338(...scales ? scale.slice(0, 3) : [1, 1, 1]));+ return new Matrix417().compose(new Vector339(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion19(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector339(...scales ? scale.slice(0, 3) : [1, 1, 1]));});}async function loadGlbReviewScene(bytes) {@@ -35380,10 +35683,14 @@ function reviewSceneFromDocument(document) {if (normal) {geometry.setAttribute("normal", new BufferAttribute12(Float32Array.from(decodedAccessor(normal)), 3));}- const uv = primitive.getAttribute("TEXCOORD_0");- if (uv) {- geometry.setAttribute("uv", new BufferAttribute12(Float32Array.from(decodedAccessor(uv)), 2));+ for (let channel = 0;channel < 4; channel++) {+ const uv = primitive.getAttribute(`TEXCOORD_${channel}`);+ if (uv)+ geometry.setAttribute(channel ? `uv${channel}` : "uv", new BufferAttribute12(Float32Array.from(decodedAccessor(uv)), 2));}+ const color = primitive.getAttribute("COLOR_0");+ if (color)+ geometry.setAttribute("color", new BufferAttribute12(Float32Array.from(decodedAccessor(color)), color.getElementSize()));const tangent = primitive.getAttribute("TANGENT");if (tangent) {geometry.setAttribute("tangent", new BufferAttribute12(Float32Array.from(decodedAccessor(tangent)), 4));@@ -35429,6 +35736,7 @@ function reviewSceneFromDocument(document) {geometry.setAttribute("skinWeight", new BufferAttribute12(Float32Array.from(decodedAccessor(skinWeights)), 4));}const threeMaterial = new MeshStandardMaterial5({+ vertexColors: color !== null,opacity: flat.opacity,transparent: flat.alphaMode === "BLEND",alphaTest: flat.alphaMode === "MASK" ? flat.alphaCutoff : 0,@@ -35613,6 +35921,7 @@ var init_glb = __esm(() => {// src/evaluator/handler.tsvar init_handler = __esm(() => {init_authoring_diagnostic();+ init_solid_diagnostic();init_render();init_run();init_protocol();@@ -35890,7 +36199,7 @@ var init_renderer_id = __esm(() => {});// src/views/scene-raster.ts-import * as THREE50 from "three";+import * as THREE51 from "three";var DEG2;var init_scene_raster = __esm(() => {init_evaluator();@@ -35902,18 +36211,18 @@ var init_scene_raster = __esm(() => {});// src/views/vehicle.ts-import * as THREE51 from "three";+import * as THREE52 from "three";function hasRole2(node, prefix) {return readSemanticMetadataV1(node)?.roles.some((role) => role === prefix || role.startsWith(`${prefix}.`)) ?? false;}function chassisBounds(root, inverse) {- const bounds = new THREE51.Box3;+ const bounds = new THREE52.Box3;let found = false;root.traverse((node) => {if (!hasRole2(node, "chassis"))return;node.traverse((part) => {- if (!(part instanceof THREE51.Mesh) || !(part.geometry instanceof THREE51.BufferGeometry))+ if (!(part instanceof THREE52.Mesh) || !(part.geometry instanceof THREE52.BufferGeometry))return;part.geometry.computeBoundingBox();const box = part.geometry.boundingBox;@@ -35923,7 +36232,7 @@ function chassisBounds(root, inverse) {for (const x of [box.min.x, box.max.x])for (const y of [box.min.y, box.max.y])for (const z of [box.min.z, box.max.z]) {- bounds.expandByPoint(new THREE51.Vector3(x, y, z).applyMatrix4(matrix));+ bounds.expandByPoint(new THREE52.Vector3(x, y, z).applyMatrix4(matrix));found = true;}});@@ -35991,33 +36300,33 @@ function tagDiagnostic(node, role) {stampSemanticMetadataV1(node, { roles: [role] });}function rod(name, start, end, radius, color, role) {- const from = new THREE51.Vector3(...start);- const to = new THREE51.Vector3(...end);+ const from = new THREE52.Vector3(...start);+ const to = new THREE52.Vector3(...end);const direction = to.clone().sub(from);const length = direction.length();- const geometry = length > 0.000000001 ? new THREE51.CylinderGeometry(radius, radius, length, 8) : new THREE51.SphereGeometry(radius, 8, 6);- const result = new THREE51.Mesh(geometry, new THREE51.MeshBasicMaterial({ color }));+ const geometry = length > 0.000000001 ? new THREE52.CylinderGeometry(radius, radius, length, 8) : new THREE52.SphereGeometry(radius, 8, 6);+ const result = new THREE52.Mesh(geometry, new THREE52.MeshBasicMaterial({ color }));result.name = name;result.position.copy(from).add(to).multiplyScalar(0.5);if (length > 0.000000001) {- result.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));+ result.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));}tagDiagnostic(result, role);return result;}function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnostics(root)) {- const overlay = new THREE51.Group;+ const overlay = new THREE52.Group;overlay.name = "VehicleDiagnosticOverlay";const chassisSpan = descriptor.chassisBox ? Math.max(descriptor.chassisBox.max[0] - descriptor.chassisBox.min[0], descriptor.chassisBox.max[1] - descriptor.chassisBox.min[1], descriptor.chassisBox.max[2] - descriptor.chassisBox.min[2]) : 1;const thickness = Math.max(0.01, chassisSpan * 0.008);- const arrow = new THREE51.Group;+ const arrow = new THREE52.Group;arrow.name = "Diagnostic_Forward_+X";tagDiagnostic(arrow, "diagnostic.vehicle.forward");arrow.add(rod("Diagnostic_Forward_Shaft", descriptor.forwardArrow.start, [descriptor.forwardArrow.end[0] - 0.12, 0, 0], thickness, 16724804, "diagnostic.vehicle.forward"));- const arrowHead = new THREE51.Mesh(new THREE51.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE51.MeshBasicMaterial({ color: 16724804 }));+ const arrowHead = new THREE52.Mesh(new THREE52.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE52.MeshBasicMaterial({ color: 16724804 }));arrowHead.name = "Diagnostic_Forward_Head";arrowHead.position.set(descriptor.forwardArrow.end[0] - 0.12, 0, 0);- arrowHead.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 1, 0), new THREE51.Vector3(1, 0, 0));+ arrowHead.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 1, 0), new THREE52.Vector3(1, 0, 0));tagDiagnostic(arrowHead, "diagnostic.vehicle.forward");arrow.add(arrowHead);overlay.add(arrow);@@ -36025,18 +36334,18 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnooverlay.add(rod(`Diagnostic_Axle_${axle.id}`, axle.start, axle.end, thickness, 3386111, `diagnostic.vehicle.axle.${axle.id}`));}for (const wheel of descriptor.wheels) {- const ring = new THREE51.Mesh(new THREE51.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE51.MeshBasicMaterial({ color: 16763955 }));+ const ring = new THREE52.Mesh(new THREE52.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE52.MeshBasicMaterial({ color: 16763955 }));ring.name = `Diagnostic_Wheel_${wheel.id}`;ring.position.set(...wheel.center);- const axle = new THREE51.Vector3(...wheel.axle);+ const axle = new THREE52.Vector3(...wheel.axle);if (axle.lengthSq() > 0.000000000001) {- ring.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 0, 1), axle.normalize());+ ring.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 0, 1), axle.normalize());}tagDiagnostic(ring, `diagnostic.vehicle.wheel.${wheel.id}`);overlay.add(ring);}if (descriptor.chassisBox) {- const chassis = new THREE51.Group;+ const chassis = new THREE52.Group;chassis.name = "Diagnostic_ChassisBox";tagDiagnostic(chassis, "diagnostic.vehicle.chassis");const { min, max } = descriptor.chassisBox;@@ -36070,7 +36379,7 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnooverlay.add(chassis);}if (descriptor.supportPlaneY !== undefined) {- const plane = new THREE51.Group;+ const plane = new THREE52.Group;plane.name = "Diagnostic_SupportPlane";tagDiagnostic(plane, "diagnostic.vehicle.support-plane");const halfX = Math.max(1, ...descriptor.chassisBox ? [Math.abs(descriptor.chassisBox.min[0]), Math.abs(descriptor.chassisBox.max[0])] : [], ...descriptor.wheels.map((wheel) => Math.abs(wheel.center[0]) + wheel.radius)) + 0.2;@@ -36668,7 +36977,7 @@ var init_views = __esm(() => {});// src/views/character-capture.ts-import * as THREE52 from "three";+import * as THREE53 from "three";function drawLine2(rgb, width, height, from, to, color) {let x0 = Math.round(from[0]);let y0 = Math.round(from[1]);@@ -36705,22 +37014,22 @@ function drawCross(rgb, width, height, point, color, radius = 3) {}function projector(root, cameraId, size) {root.updateMatrixWorld(true);- const bounds = new THREE52.Box3().setFromObject(root);+ const bounds = new THREE53.Box3().setFromObject(root);if (bounds.isEmpty())- bounds.set(new THREE52.Vector3(-0.5, 0, -0.5), new THREE52.Vector3(0.5, 1, 0.5));- const center = bounds.getCenter(new THREE52.Vector3);- const camera = cameraId === "front" ? new THREE52.Vector3(1, 0, 0) : new THREE52.Vector3(0, 0, 1);- const upHint = new THREE52.Vector3(0, 1, 0);- const xAxis = new THREE52.Vector3().crossVectors(upHint, camera).normalize();- const yAxis = new THREE52.Vector3().crossVectors(camera, xAxis).normalize();+ bounds.set(new THREE53.Vector3(-0.5, 0, -0.5), new THREE53.Vector3(0.5, 1, 0.5));+ const center = bounds.getCenter(new THREE53.Vector3);+ const camera = cameraId === "front" ? new THREE53.Vector3(1, 0, 0) : new THREE53.Vector3(0, 0, 1);+ const upHint = new THREE53.Vector3(0, 1, 0);+ const xAxis = new THREE53.Vector3().crossVectors(upHint, camera).normalize();+ const yAxis = new THREE53.Vector3().crossVectors(camera, xAxis).normalize();let extent = 0.000001;for (let corner = 0;corner < 8; corner++) {- const point = new THREE52.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);+ const point = new THREE53.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);extent = Math.max(extent, Math.abs(point.dot(xAxis)), Math.abs(point.dot(yAxis)));}const scale = size * 0.45 / extent;return (assetPoint) => {- const world = new THREE52.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);+ const world = new THREE53.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);return [size / 2 + world.dot(xAxis) * scale, size / 2 - world.dot(yAxis) * scale];};}@@ -36846,7 +37155,7 @@ var init_character_capture = __esm(() => {});// src/render.ts-import * as THREE53 from "three";+import * as THREE54 from "three";import { Document, Logger } from "@gltf-transform/core";import { KHRMaterialsEmissiveStrength } from "@gltf-transform/extensions";import { dedup, instance, palette, weld as weld2, prune, mergeDocuments } from "@gltf-transform/functions";@@ -37066,7 +37375,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)} else if (stdMat.transparent) {mat.setAlphaMode("BLEND");}- if (stdMat.side === THREE53.DoubleSide) {+ if (stdMat.side === THREE54.DoubleSide) {mat.setDoubleSided(true);}if (stdMat.map) {@@ -37143,7 +37452,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)} else if (common.transparent || (common.opacity ?? 1) < 1) {mat.setAlphaMode("BLEND");}- if (threeMat.side === THREE53.DoubleSide)+ if (threeMat.side === THREE54.DoubleSide)mat.setDoubleSided(true);if (common.map && !mat.getBaseColorTexture()) {const texture = bridgeTexture(doc, common.map, textureCache);@@ -37293,7 +37602,7 @@ function bridgeNode(doc, buf, threeObj, matCache, nodeMap, meshCache, texCache,const cacheKey = `kiln-sprite-quad:${centerX}:${centerY}:${rotation}__${threeMat.uuid}`;let gtMesh = meshCache.get(cacheKey);if (!gtMesh) {- const geometry = new THREE53.PlaneGeometry(1, 1);+ const geometry = new THREE54.PlaneGeometry(1, 1);if (centerX !== 0.5 || centerY !== 0.5) {geometry.translate(0.5 - centerX, 0.5 - centerY, 0);}@@ -37317,9 +37626,9 @@ function animationInterpolation(track) {if (isCubicSplineTrack(track))return "CUBICSPLINE";const mode = track.getInterpolation();- if (mode === THREE53.InterpolateDiscrete)+ if (mode === THREE54.InterpolateDiscrete)return "STEP";- if (mode === THREE53.InterpolateLinear)+ if (mode === THREE54.InterpolateLinear)return "LINEAR";throw new Error(`Unsupported animation interpolation on ${track.name}; use LINEAR, STEP or CUBICSPLINE.`);}@@ -37889,8 +38198,8 @@ function collectMeshStats(root) {if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {return;}- const center = new THREE53.Vector3;- const size = new THREE53.Vector3;+ const center = new THREE54.Vector3;+ const size = new THREE54.Vector3;box.getCenter(center);box.getSize(size);out.push({@@ -37905,7 +38214,7 @@ function collectMeshStats(root) {return out;}function minimalGapVector(a, b) {- const v = new THREE53.Vector3;+ const v = new THREE54.Vector3;for (const axis of ["x", "y", "z"]) {if (a.min[axis] > b.max[axis])v[axis] = b.max[axis] - a.min[axis];@@ -37923,10 +38232,10 @@ function inspectSceneStructure(root, opts = {}) {return warnings;const cat = opts.category?.toLowerCase();if (cat === "vehicle" || cat === "weapon" || cat === "boat" || cat === "aircraft") {- const all = new THREE53.Box3;+ const all = new THREE54.Box3;for (const m of meshes)all.union(m.box);- const size = new THREE53.Vector3;+ const size = new THREE54.Vector3;all.getSize(size);if (cat === "aircraft") {if (size.y > size.x * 1.2) {@@ -38036,18 +38345,18 @@ var init_render = __esm(() => {init_texture_bake();engineIO = createGltfIO;GLTF_MIN_FILTER = {- [THREE53.NearestFilter]: 9728,- [THREE53.LinearFilter]: 9729,- [THREE53.NearestMipmapNearestFilter]: 9984,- [THREE53.LinearMipmapNearestFilter]: 9985,- [THREE53.NearestMipmapLinearFilter]: 9986,- [THREE53.LinearMipmapLinearFilter]: 9987- };- GLTF_MAG_FILTER = { [THREE53.NearestFilter]: 9728, [THREE53.LinearFilter]: 9729 };+ [THREE54.NearestFilter]: 9728,+ [THREE54.LinearFilter]: 9729,+ [THREE54.NearestMipmapNearestFilter]: 9984,+ [THREE54.LinearMipmapNearestFilter]: 9985,+ [THREE54.NearestMipmapLinearFilter]: 9986,+ [THREE54.LinearMipmapLinearFilter]: 9987+ };+ GLTF_MAG_FILTER = { [THREE54.NearestFilter]: 9728, [THREE54.LinearFilter]: 9729 };GLTF_WRAP = {- [THREE53.ClampToEdgeWrapping]: 33071,- [THREE53.MirroredRepeatWrapping]: 33648,- [THREE53.RepeatWrapping]: 10497+ [THREE54.ClampToEdgeWrapping]: 33071,+ [THREE54.MirroredRepeatWrapping]: 33648,+ [THREE54.RepeatWrapping]: 10497};REVIEW_CLIP_LIMITS2 = {clips: 32,@@ -38136,7 +38445,7 @@ function decodeEvaluatorResultV2(json, maxGlbBytes, expectedRequestId) {if (!value.ok) {if (value.render !== undefined)return fail9("result");- if (!isRecord6(value.error) || !hasExactKeys(value.error, ["code", "message", "qa", "diagnostic"])) {+ if (!isRecord6(value.error) || !hasExactKeys(value.error, ["code", "message", "qa", "diagnostic", "solid"])) {return fail9("result");}const codes = [@@ -38155,6 +38464,8 @@ function decodeEvaluatorResultV2(json, maxGlbBytes, expectedRequestId) {}if (value.error.diagnostic !== undefined && (value.error.code !== "EXECUTION_REJECTED" || value.error.diagnostic !== "UNBOUND_VARIABLE" && value.error.diagnostic !== "GEAR_RADII_ORDER" && value.error.diagnostic !== "ROUNDED_BOX_RADIUS" && value.error.diagnostic !== "PROCEDURAL_TEXTURE_UNKNOWN_KEY" && value.error.diagnostic !== "PROCEDURAL_TEXTURE_BLEND" && value.error.diagnostic !== "PROCEDURAL_TEXTURE_V3_CONTRACT" && value.error.diagnostic !== "PORTABLE_MATERIAL_V3_CONTRACT" && value.error.diagnostic !== "TEXTURE_ATLAS_CONTRACT" && value.error.diagnostic !== "MATERIAL_FRACTION_RANGE" && value.error.diagnostic !== "MATERIAL_RECIPE_TEXTURE_BINDING" && value.error.diagnostic !== "PORTABLE_TEXTURE_REFERENCE" && value.error.diagnostic !== "PORTABLE_COLOR_ARGUMENT" && value.error.diagnostic !== "PARAMETRIC_PERIODIC_ENDPOINT" && value.error.diagnostic !== "PROFILE_HOLES_UNSUPPORTED" && value.error.diagnostic !== "PROFILE_BEVEL_COLLAPSE" && value.error.diagnostic !== "PROFILE_CORRESPONDENCE_COLLAPSE" && value.error.diagnostic !== "REMOVED_HELPER" && value.error.diagnostic !== "TUBE_RADIUS" && value.error.diagnostic !== "TAPER_CONE_AXIS" && value.error.diagnostic !== "SOLID_FLOAT32_COLLAPSE" && value.error.diagnostic !== "MESH_DATA_NONFINITE" && value.error.diagnostic !== "MATERIAL_ALPHA_MODE" && value.error.diagnostic !== "MATERIAL_COLOR_ARGUMENT" && value.error.diagnostic !== "PART_NAME_ARGUMENT" && value.error.diagnostic !== "PART_GEOMETRY_ARGUMENT" && value.error.diagnostic !== "PART_MATERIAL_ARGUMENT" && value.error.diagnostic !== "MATERIAL_PACKED_CHANNELS" && value.error.diagnostic !== "UNINITIALIZED_BINDING" && value.error.diagnostic !== "BUILD_RESULT" && value.error.diagnostic !== "MATERIAL_RECIPE_OVERRIDE" && value.error.diagnostic !== "PROGRAM_TYPE_ERROR" && value.error.diagnostic !== "PROGRAM_RANGE_ERROR" && value.error.diagnostic !== "LOD_SET" && value.error.diagnostic !== "OPEN_SHELL" && value.error.diagnostic !== "DELIVERY_CONTRACT" && value.error.diagnostic !== "REQUIRE_SOLID" && value.error.diagnostic !== "EXPORT_MATERIAL_SIDE_UNSUPPORTED" && value.error.diagnostic !== "BONE_CHAIN_ARGUMENT" && value.error.diagnostic !== "SKIN_BINDING_ARGUMENT"))return fail9("result");+ if (value.error.solid !== undefined && (value.error.diagnostic !== "REQUIRE_SOLID" || !validSolidFailureDetails(value.error.solid)))+ return fail9("result");if (value.error.qa !== undefined) {if (value.error.code !== "QA_BLOCKED" || !isRecord6(value.error.qa) || !hasExactKeys(value.error.qa, ["report", "stage", "gltfValidation"]) || !validRequirementsQaReport(value.error.qa.report) || !["scene", "final-glb"].includes(String(value.error.qa.stage)) || value.error.qa.gltfValidation !== undefined && !validGltfValidation(value.error.qa.gltfValidation)) {return fail9("result");@@ -38265,6 +38576,7 @@ var init_protocol = __esm(() => {init_material_library_node();init_material_library();init_rebuild_options();+ init_solid_diagnostic();MAX_EVALUATOR_CODE_BYTES = 512 * 1024;MAX_EVALUATOR_REQUEST_BYTES = 24 * 1024 * 1024;DEFAULT_EVALUATOR_MAX_GLB_BYTES = 16 * 1024 * 1024;@@ -38283,10 +38595,12 @@ var init_protocol = __esm(() => {EvaluatorPortError = class EvaluatorPortError extends Error {code;diagnostic;- constructor(code, message = evaluatorOutcomeMessage(code), diagnostic) {- super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);+ solid;+ constructor(code, message = evaluatorOutcomeMessage(code), diagnostic, solid) {+ super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}${solidFailureAdvice(solid)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);this.code = code;this.diagnostic = diagnostic;+ this.solid = solid;this.name = "EvaluatorPortError";}};@@ -38460,7 +38774,7 @@ async function renderGLBViaProcessLaunch(code, options = {}, controls = {}, launfinish(new AssetQaBlockedError(result.error.qa.report, result.error.qa.stage, result.error.qa.gltfValidation));return;}- finish(new EvaluatorSubprocessError(result.error.code, evaluatorOutcomeMessage(result.error.code), result.error.diagnostic));+ finish(new EvaluatorSubprocessError(result.error.code, evaluatorOutcomeMessage(result.error.code), result.error.diagnostic, result.error.solid));return;}finish(undefined, result.render);@@ -38478,6 +38792,7 @@ async function renderGLBViaSubprocess(code, options = {}, controls = {}) {var DEFAULT_DEADLINE_MS = 60000, DEFAULT_MAX_GLB_BYTES, DEFAULT_MAX_RESPONSE_BYTES, MAX_STDERR_BYTES, EvaluatorSubprocessError;var init_subprocess = __esm(() => {init_authoring_diagnostic();+ init_solid_diagnostic();init_run();init_requirements_context();init_material_library_node();@@ -38487,10 +38802,12 @@ var init_subprocess = __esm(() => {MAX_STDERR_BYTES = 16 * 1024;EvaluatorSubprocessError = class EvaluatorSubprocessError extends Error {diagnostic;+ solid;code;- constructor(code, message, diagnostic) {- super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);+ constructor(code, message, diagnostic, solid) {+ super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}${solidFailureAdvice(solid)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);this.diagnostic = diagnostic;+ this.solid = solid;this.name = "EvaluatorSubprocessError";this.code = code;}@@ -38601,7 +38918,7 @@ __export(exports_program_store_node, {FileProgramStore: () => FileProgramStore,localProgramStore: () => localProgramStore});-import { link as link2, lstat as lstat3, mkdir as mkdir3, readFile as readFile2, readdir as readdir2, stat as stat2, unlink as unlink2, writeFile as writeFile3 } from "node:fs/promises";+import { link as link2, lstat as lstat4, mkdir as mkdir3, readFile as readFile2, readdir as readdir2, stat as stat2, unlink as unlink2, writeFile as writeFile3 } from "node:fs/promises";import { randomUUID as randomUUID3 } from "node:crypto";import { join as join4 } from "node:path";@@ -38658,7 +38975,7 @@ class FileProgramStore {async readHandle(handle) {const path = join4(this.directory, "refs", `${handle}.ref`);try {- const info = await lstat3(path);+ const info = await lstat4(path);if (!info.isFile() || info.size !== 71)throw new Error(`Program handle integrity check failed: ${handle}`);const canonical = await readFile2(path, "utf8");@@ -39019,7 +39336,7 @@ var init_build_cache_node = __esm(() => {// src/runtime-identity.tsimport { createHash as createHash11 } from "node:crypto";-import { lstat as lstat4, readFile as readFile4, readdir as readdir4, realpath as realpath3, stat as stat4 } from "node:fs/promises";+import { lstat as lstat5, readFile as readFile4, readdir as readdir4, realpath as realpath3, stat as stat4 } from "node:fs/promises";import { createRequire } from "node:module";import { dirname as dirname4, join as join6, relative as relative2 } from "node:path";async function installedRuntimeIdentity(root, limits = {}) {@@ -39075,7 +39392,7 @@ async function installedRuntimeIdentity(root, limits = {}) {for (const modules of require2.resolve.paths(name) ?? []) {const candidate = join6(modules, name);try {- await lstat4(candidate);+ await lstat5(candidate);} catch (error) {if (error.code === "ENOENT")continue;@@ -39353,7 +39670,7 @@ var init_projects = __esm(() => {// src/projects-node.tsimport { createHash as createHash12, randomUUID as randomUUID5 } from "node:crypto";-import { link as link3, lstat as lstat5, mkdir as mkdir5, open as open3, readdir as readdir5, realpath as realpath4, unlink as unlink4 } from "node:fs/promises";+import { link as link3, lstat as lstat6, mkdir as mkdir5, open as open3, readdir as readdir5, realpath as realpath4, unlink as unlink4 } from "node:fs/promises";import { join as join7, relative as relative3, resolve as resolve7, sep as sep2 } from "node:path";function sequenceOf(revisionId) {projectRevisionIdSchema.parse(revisionId);@@ -39390,7 +39707,7 @@ class FileProjectStore {if (!exists(error))throw error;});- const info = await lstat5(path);+ const info = await lstat6(path);if (info.isSymbolicLink())throw new Error("Project symlinks are not supported");if (!info.isDirectory())@@ -39417,7 +39734,7 @@ class FileProjectStore {}async load(projectId, directory, sequence) {const path = join7(directory, filename(sequence));- const info = await lstat5(path);+ const info = await lstat6(path);if (!info.isFile() || info.isSymbolicLink() || info.size > MAX_PROJECT_BYTES)throw new Error("Invalid or oversized project revision file");const handle = await open3(path, "r");@@ -39889,7 +40206,7 @@ import { createHash as createHash13, randomUUID as randomUUID6 } from "node:crypimport {link as link4,mkdir as mkdir6,- lstat as lstat6,+ lstat as lstat7,readdir as readdir6,readFile as readFile5,rename as rename4,@@ -40108,7 +40425,7 @@ class FileLiveReview {if (!collision(error))throw error;});- const info = await lstat6(path);+ const info = await lstat7(path);if (!info.isDirectory() || info.isSymbolicLink())throw new Error("Unsafe live directory");const rel = relative4(canonical, await realpath5(path));@@ -40117,7 +40434,7 @@ class FileLiveReview {}}async boundedFile(path, limit) {- const info = await lstat6(path);+ const info = await lstat7(path);if (!info.isFile() || info.isSymbolicLink() || info.size > limit)throw new Error("Invalid live file");const data = new Uint8Array(await readFile5(path));@@ -40145,7 +40462,7 @@ class FileLiveReview {if (!collision(error))throw error;});- const info = await lstat6(directory);+ const info = await lstat7(directory);if (!info.isDirectory() || info.isSymbolicLink())throw new Error("Unsafe live lock directory");const candidate = join9(directory, `.candidate-${process.pid}-${token}.tmp`);@@ -40166,7 +40483,7 @@ class FileLiveReview {if (latest) {try {const prior = z9.object({ pid: z9.number().int().positive(), token: z9.string().uuid() }).strict().parse(JSON.parse(new TextDecoder().decode(await this.boundedFile(join9(directory, latest), 1024))));- const released = await lstat6(join9(directory, `${latest}.released`)).then((entry) => {+ const released = await lstat7(join9(directory, `${latest}.released`)).then((entry) => {if (!entry.isFile() || entry.isSymbolicLink() || entry.size !== 0)throw new Error("Invalid lock release");return true;@@ -40453,7 +40770,7 @@ class FileLiveReview {async record(operationId) {await this.root();const directory = this.path(operationId);- const info = await lstat6(directory);+ const info = await lstat7(directory);if (!info.isDirectory() || info.isSymbolicLink())throw new Error("Unsafe live directory");const raw = JSON.parse(new TextDecoder().decode(await this.boundedFile(join9(directory, "record.json"), metadataLimit)));@@ -40475,7 +40792,7 @@ class FileLiveReview {throw new Error("Invalid artifact descriptor");if (state.operation.captures.some((file) => !/^capture-\d{1,2}\.png$/.test(file.name)))throw new Error("Invalid capture descriptor");- state.operation.pinned = await lstat6(join9(directory, "pinned")).then((s) => {+ state.operation.pinned = await lstat7(join9(directory, "pinned")).then((s) => {if (!s.isFile() || s.isSymbolicLink())throw new Error("Invalid live pin");return true;@@ -40497,7 +40814,7 @@ class FileLiveReview {for (const entry of await readdir6(directory, { withFileTypes: true })) {if (!entry.isFile() || entry.isSymbolicLink())throw new Error("Invalid live directory entry");- bytes += (await lstat6(join9(directory, entry.name))).size;+ bytes += (await lstat7(join9(directory, entry.name))).size;}this.storedSizes.set(state, bytes);return state;@@ -40612,7 +40929,7 @@ class FileLiveReview {if (!collision(error))throw error;});- if ((await lstat6(directory)).isSymbolicLink())+ if ((await lstat7(directory)).isSymbolicLink())throw new Error("Unsafe live directory");for (const [name, data] of Object.entries(blobs))await this.atomic(join9(directory, name), data);@@ -40621,7 +40938,7 @@ class FileLiveReview {}async remove(operationId) {const directory = this.path(operationId);- const info = await lstat6(directory);+ const info = await lstat7(directory);if (!info.isDirectory() || info.isSymbolicLink())throw new Error("Unsafe live directory");await rm2(directory, { recursive: true, force: true });@@ -40776,32 +41093,6 @@ var init_asset_materials_node = __esm(() => {init_material_library_node();});-// src/atomic-directory.ts-import { lstat as lstat7, rename as rename5 } from "node:fs/promises";-import { setTimeout as pause } from "node:timers/promises";-async function renameDirectoryAtomically(source, destination, controls = {}) {- const renameOperation = controls.renameOperation ?? rename5;- const platform = controls.platform ?? process.platform;- const wait = controls.pause ?? pause;- const delays = [20, 50, 100, 200, 400];- for (let attempt = 0;; attempt++) {- try {- await renameOperation(source, destination);- return;- } catch (error) {- const delay = delays[attempt];- const code = error?.code;- if (platform !== "win32" || delay === undefined || !["EPERM", "EACCES", "EBUSY"].includes(code ?? ""))- throw error;- const absent = await lstat7(destination).then(() => false, (statError) => statError.code === "ENOENT");- if (!absent)- throw error;- await wait(delay);- }- }-}-var init_atomic_directory = () => {};-// src/assets-node.tsvar exports_assets_node = {};__export(exports_assets_node, {@@ -41149,7 +41440,7 @@ import {KHRTextureBasisu as KHRTextureBasisu2} from "@gltf-transform/extensions";import { dedup as dedup2, quantize, reorder } from "@gltf-transform/functions";-import * as THREE54 from "three";+import * as THREE55 from "three";function meshSignature(mesh, ids) {const id = (property) => {if (!property)@@ -41257,8 +41548,8 @@ async function encodeKtx2(doc, encoder) {return { status: "encoded", textures: textures.length };}function decomposeDelta(before, after) {- const delta = new THREE54.Matrix4().fromArray(before).invert().multiply(new THREE54.Matrix4().fromArray(after));- const position = new THREE54.Vector3, quaternion = new THREE54.Quaternion, scale = new THREE54.Vector3;+ const delta = new THREE55.Matrix4().fromArray(before).invert().multiply(new THREE55.Matrix4().fromArray(after));+ const position = new THREE55.Vector3, quaternion = new THREE55.Quaternion, scale = new THREE55.Vector3;delta.decompose(position, quaternion, scale);return {scale: scale.x,@@ -41311,7 +41602,7 @@ async function deliverRuntimeThreeGlb(bytes, meshoptEncoder, options = {}) {const original = matrices.get(node);const moved = original === undefined;const split = moved || proxyNodes.has(node);- const reference = moved ? new THREE54.Matrix4().identity().toArray() : original;+ const reference = moved ? new THREE55.Matrix4().identity().toArray() : original;const current = [...node.getMatrix()];const { scale, offset } = decomposeDelta(reference, current);if (!moved && Math.abs(scale - 1) < 0.000000000001 && offset.every((v) => v === 0))@@ -43743,6 +44034,70 @@ var init_helper_contracts = __esm(() => {"No CAD accuracy or thin-feature preservation guarantee; requires host execution limits."]});+ define2("metaballSurface", {+ ...ownedGeometry,+ execution: "async",+ axes: "Sphere centers use XYZ; positive-inside smooth union.",+ origin: "Explicit sampling bounds min/max define the evaluated region.",+ parameters: [+ "One or more { center, radius } spheres; blend defaults to max(0.35 times the smallest radius, 0.02 scene units).",+ "Same bounds/edgeLength limits as implicitSurface.",+ "Uses implicitSurface defaults of 1,000,000 estimated cells and 8,000,000 field callbacks; explicit maxCells/maxEvaluations ceilings pass through unchanged."+ ],+ topology: ["Resolution-dependent manifold level set; review thin features."],+ preservation: ["No UVs; experimental metadata like implicitSurface."],+ cost: "Implicit grid cost times sphere count; maxEvaluations counts field callbacks, not individual sphere evaluations. Use the host evaluator for process/time limits."+ }, {+ references: ["src/organic.ts", "src/implicit.ts"],+ tags: ["metaball", "blob", "organic"],+ aliases: ["smooth blob", "blended spheres"],+ intents: ["author a smooth organic solid from spheres"],+ stability: "experimental",+ related: [{ name: "implicitSurface", relation: "alternative" }]+ });+ define2("smoothUnion", {+ units: "Blend width uses asset-length units when composed into spatial fields.",+ axes: "Operands are scalar field samples, not mesh coordinates.",+ parameters: ["Finite operands; positive finite blend width."],+ topology: [noMesh],+ preservation: ["Pure scalar helper; no geometry output."],+ cost: "O(1) per sample."+ }, {+ references: ["src/sdf.ts"],+ tags: ["sdf", "implicit", "blend"],+ intents: ["smoothly join two positive-inside fields"],+ related: [{ name: "implicitSurface", relation: "companion" }]+ });+ define2("sphereInside", {+ units: lengthUnits,+ axes: "Center and sample point use XYZ.",+ parameters: ["Positive finite radius; finite center and sample point."],+ topology: [noMesh],+ preservation: ["Scalar field sample only."],+ cost: "O(1) per sample."+ }, {+ references: ["src/sdf.ts"],+ tags: ["sdf", "sphere", "field"],+ intents: ["sphere distance field for implicitSurface"],+ related: [{ name: "smoothUnion", relation: "companion" }]+ });+ define2("smoothOrganic", {+ ...ownedGeometry,+ parameters: [+ "Optional iterations (default 1), creaseAngle (default 55), preserveUV flag.",+ "Subject to subdivide admission budgets."+ ],+ preservation: [+ "Subdivision may drop legacy CSG provenance; creaseNormals invalidates tangents.",+ "Default position-only subdivision drops UVs and material groups; preserveUV: true retains supported corner attributes and material boundaries."+ ],+ cost: "Subdivide estimate applies before work begins."+ }, {+ references: ["src/organic.ts", "src/ops.ts", "src/geometry.ts"],+ tags: ["subdivide", "normals", "organic"],+ intents: ["soften an authored mesh for creatures and plants"],+ related: [{ name: "subdivide", relation: "companion" }]+ });nodeFacts = {units: `${lengthUnits} explicit rotation triples use degrees unless stated otherwise.`,axes: "Three.js local XYZ; +Y is the normal up convention.",@@ -45053,6 +45408,69 @@ var init_helper_contracts = __esm(() => {{ name: "curveToMesh", relation: "alternative" }]});+ define2("catmullRomPath", {+ units: lengthUnits,+ axes: "Control points and output use XYZ.",+ parameters: [+ "At least two open or three closed control points; positive integer samplesPerSpan.",+ "Open output has (controlPoints.length - 1) * samplesPerSpan + 1 stations including endpoints. Closed output has controlPoints.length * samplesPerSpan stations without a repeated endpoint.",+ "Derived sample counts must be safe integers; unsafe products are rejected before sampling."+ ],+ topology: [noMesh],+ preservation: ["Returns a point array for downstream sweeps."],+ cost: "Linear in control points × samplesPerSpan."+ }, {+ references: ["src/organic.ts"],+ tags: ["path", "spline", "curve"],+ aliases: ["smooth path samples"],+ intents: ["sample a smooth curve through waypoints"],+ related: [+ { name: "taperedTube", relation: "companion" },+ { name: "sweepProfile", relation: "companion" }+ ]+ });+ define2("spiralPath", {+ units: lengthUnits,+ axes: "Center, axis, forward and output use XYZ.",+ origin: "Starts radius away from center in the projected forward direction; center is the spiral axis datum.",+ parameters: [+ "Positive radius, rise, and turns; optional sample count (>= 4).",+ "Finite nonzero axis and forward; forward must not be parallel to axis.",+ "Returns samples + 1 stations, rising by rise while radius shrinks linearly to 42% of its initial value.",+ "The derived samples + 1 count must be a safe integer."+ ],+ topology: [noMesh],+ preservation: ["Returns spiral polyline samples for taperedTube or sweepProfile."],+ cost: "Linear in samples."+ }, {+ references: ["src/organic.ts"],+ tags: ["path", "spiral", "curve"],+ aliases: ["curl path", "prehensile tail path"],+ intents: ["sample a rising spiral for curled tails and tendrils"],+ related: [+ { name: "catmullRomPath", relation: "alternative" },+ { name: "taperedTube", relation: "companion" }+ ]+ });+ define2("taperedTube", {+ ...curveFacts,+ parameters: [+ "Polyline path with one positive radius per station.",+ "Closed paths omit the repeated endpoint, matching closed catmullRomPath output.",+ "Optional per-station sectionScale [side, depth] for elliptical cross-sections.",+ "Default creaseAngle 180 for round profiles; radialSegments default 20."+ ],+ preservation: ["UVs and normals like sweepProfile; smooth round shading by default."]+ }, {+ references: ["src/organic.ts", "src/sweep.ts"],+ tags: ["tube", "taper", "organic"],+ aliases: ["varying radius tube"],+ intents: ["limb, tail, tentacle or branch with changing thickness"],+ related: [+ { name: "pipeAlongPath", relation: "alternative" },+ { name: "catmullRomPath", relation: "prerequisite" }+ ]+ });define2("lathe", {...curveFacts,axes: "Profile x is radius, y is height; spins around Y.",@@ -47357,8 +47775,8 @@ function projectToolInput(actions = PROJECT_ACTIONS) {projectId: projectIdSchema.optional().describe("get, update, export."),revisionId: projectRevisionIdSchema.optional().describe("get, export: an exact revision; omit for the current one."),expectedRevision: projectRevisionIdSchema.optional().describe("update: the revision being replaced; a stale value is a conflict."),- draft: record9(nestedRecordDescription("create: name, brief, design, inventory, deliveryProfiles, materialDependencies, references, reviews; optional projectId.", "shape:project-draft")),- patch: record9(nestedRecordDescription("update: the same top-level fields as draft; each supplied field replaces its previous value whole.", "shape:project-patch")),+ draft: record10(nestedRecordDescription("create: name, brief, design, inventory, deliveryProfiles, materialDependencies, references, reviews; optional projectId.", "shape:project-draft")),+ patch: record10(nestedRecordDescription("update: the same top-level fields as draft; each supplied field replaces its previous value whole.", "shape:project-patch")),profile: z17.enum(["editable", "runtime"]).optional().describe("export: editable (default) keeps source and resources; runtime is GLB plus metadata.")});}@@ -47420,7 +47838,7 @@ function createKilnProjectDef(store, bundleReader) {}}}-var PROJECT_ACTIONS, REQUIREMENTS, record9 = (description) => z17.record(z17.string(), z17.unknown()).optional().describe(description);+var PROJECT_ACTIONS, REQUIREMENTS, record10 = (description) => z17.record(z17.string(), z17.unknown()).optional().describe(description);var init_projects2 = __esm(() => {init_projects();PROJECT_ACTIONS = ["list", "get", "create", "update", "export"];@@ -47782,7 +48200,7 @@ function createKilnMaterialDef(library, presentation = "grouped") {}};}-var MATERIAL_ACTIONS, MATERIAL_CONTRACT, record10 = (description) => z19.record(z19.string(), z19.unknown()).optional().describe(description), tag, materialToolInput, materialResult = (material) => ({+var MATERIAL_ACTIONS, MATERIAL_CONTRACT, record11 = (description) => z19.record(z19.string(), z19.unknown()).optional().describe(description), tag, materialToolInput, materialResult = (material) => ({ok: true,material,portableSpec: materialLibraryPortableSpec(material)@@ -47845,8 +48263,8 @@ var init_materials = __esm(() => {license: materialSourceSchema.shape.license.optional().describe("create-preset: spdx, url and attribution."),materialId: materialLibraryIdSchema.optional().describe("get: the id a project palette lists as resourceId; create-preset: optional id."),revisionId: materialLibraryHashSchema.optional().describe("get: the immutable revision; omitted, the material's only revision."),- draft: record10(nestedRecordDescription("create-procedural: legacy layered draft, or schemaVersion 2 with explicit samplers and RGBA/atlas recipes. Exact atlas sources must exist in this library.", "shape:material-draft")),- payload: record10(nestedRecordDescription("import: schemaVersion 1 or 2, complete normalized records and their exact dependencies with embedded PNG bytes.", "shape:material-import"))+ draft: record11(nestedRecordDescription("create-procedural: legacy layered draft, or schemaVersion 2 with explicit samplers and RGBA/atlas recipes. Exact atlas sources must exist in this library.", "shape:material-draft")),+ payload: record11(nestedRecordDescription("import: schemaVersion 1 or 2, complete normalized records and their exact dependencies with embedded PNG bytes.", "shape:material-import"))});});@@ -48487,7 +48905,7 @@ async function captureViewsViaPort(port, glb, timeoutMs = DEFAULT_VIEW_RENDER_TIlet rendererId = "";const grid = await renderCaptureGrid(loaded.root, capture, async (input) => {execution?.signal?.throwIfAborted();- const derivative = await renderSceneToGLB(withoutHiddenMeshes(input.root), { derivative: true });+ const derivative = await renderSceneToGLB(withoutHiddenMeshes(input.root), { derivative: true, gltfExporter: "three" });const result = await captureViewPngsViaPort(port, derivative.bytes, timeoutMs, [input.view.dir], input.size, [input.camera], limits, input.backdrop, execution);if (!result.ok)throw new Error(result.reason);@@ -48589,12 +49007,12 @@ var exports_part_placement = {};__export(exports_part_placement, {createPartPlacementReader: () => createPartPlacementReader});-import * as THREE55 from "three";+import * as THREE56 from "three";function createPartPlacementReader(root) {const bounds = createPartBoundsReader(root);- const position = new THREE55.Vector3;- const quaternion = new THREE55.Quaternion;- const scale = new THREE55.Vector3;+ const position = new THREE56.Vector3;+ const quaternion = new THREE56.Quaternion;+ const scale = new THREE56.Vector3;return (node) => {node.matrixWorld.decompose(position, quaternion, scale);const box = bounds(node);@@ -48745,7 +49163,7 @@ var init_inspect = __esm(() => {});// src/views/measurement.ts-import { Box3 as Box326, Vector3 as Vector344 } from "three";+import { Box3 as Box326, Vector3 as Vector345 } from "three";function describeSubjectFrame(root, subject) {const selected = selectCameraSubject(root, subject);selected.node.updateWorldMatrix(true, true);@@ -48762,10 +49180,10 @@ function describeSubjectFrame(root, subject) {if (!attr)return;for (let i = 0;i < attr.count; i++)- local.expandByPoint(new Vector344().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));+ local.expandByPoint(new Vector345().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));});const box = (b) => b.isEmpty() ? null : { min: b.min.toArray(), max: b.max.toArray() };- const axis = (i) => new Vector344().setFromMatrixColumn(matrix, i).normalize().toArray();+ const axis = (i) => new Vector345().setFromMatrixColumn(matrix, i).normalize().toArray();return {path: selected.path,name: selected.name,@@ -48775,7 +49193,7 @@ function describeSubjectFrame(root, subject) {invertible,worldMatrix: matrix.toArray(),axes: { frame: "world", x: axis(0), y: axis(1), z: axis(2) },- origin: new Vector344().setFromMatrixPosition(matrix).toArray()+ origin: new Vector345().setFromMatrixPosition(matrix).toArray()};}function measureAttachment(root, input) {@@ -48788,7 +49206,7 @@ function measureAttachment(root, input) {return {path: selected.path,local: [...local],- world: new Vector344(...local).applyMatrix4(selected.node.matrixWorld).toArray()+ world: new Vector345(...local).applyMatrix4(selected.node.matrixWorld).toArray()};};const from = endpoint(input.from), to = endpoint(input.to);@@ -48798,7 +49216,7 @@ function measureAttachment(root, input) {method: "straight-line anchor distance",from,to,- distance: new Vector344(...from.world).distanceTo(new Vector344(...to.world))+ distance: new Vector345(...from.world).distanceTo(new Vector345(...to.world))};}var init_measurement = __esm(() => {@@ -48810,7 +49228,7 @@ import {PropertyType as PropertyType6} from "@gltf-transform/core";import { ALL_EXTENSIONS as ALL_EXTENSIONS2 } from "@gltf-transform/extensions";-import { Box3 as Box327, Matrix4 as Matrix419, Vector3 as Vector345 } from "three";+import { Box3 as Box327, Matrix4 as Matrix419, Vector3 as Vector346 } from "three";async function accessorFingerprint(accessor) {const array = accessor?.getArray();if (!accessor || !array)@@ -48829,7 +49247,7 @@ function bounds(box) {return box.isEmpty() ? null : {min: box.min.toArray(),max: box.max.toArray(),- size: box.getSize(new Vector345).toArray()+ size: box.getSize(new Vector346).toArray()};}async function digest7(bytes) {@@ -48901,7 +49319,7 @@ async function snapshot3(bytes) {if (!Number.isInteger(vertex) || vertex < 0 || vertex >= position.getCount())throw new Error("Revision comparison found an invalid vertex index.");position.getElement(vertex, element);- const point = new Vector345(...element).applyMatrix4(matrix);+ const point = new Vector346(...element).applyMatrix4(matrix);if (point.toArray().some((value) => !Number.isFinite(value)))throw new Error("Revision comparison requires finite positions.");own.expandByPoint(point);@@ -49095,7 +49513,7 @@ import {Matrix4 as Matrix420,Ray as Ray2,Triangle as Triangle2,- Vector3 as Vector346+ Vector3 as Vector347} from "three";function hierarchy(triangles) {const box = new Box328;@@ -49104,7 +49522,7 @@ function hierarchy(triangles) {const count = triangles.length;if (count <= 4)return { box, count, triangles };- const size = box.getSize(new Vector346);+ const size = box.getSize(new Vector347);const axis = size.x >= size.y && size.x >= size.z ? "x" : size.y >= size.z ? "y" : "z";const center = (triangle) => triangle.box.min[axis] / 2 + triangle.box.max[axis] / 2;triangles.sort((a, b) => center(a) - center(b));@@ -49156,7 +49574,7 @@ function collect(node, paths) {const id = index ? index.getX(i + offset) : i + offset;if (!Number.isSafeInteger(id) || id < 0 || id >= position.count)throw new Error("Surface distance encountered an invalid triangle index.");- const point = new Vector346().fromBufferAttribute(position, id).applyMatrix4(matrix);+ const point = new Vector347().fromBufferAttribute(position, id).applyMatrix4(matrix);if (![point.x, point.y, point.z].every(Number.isFinite))throw new Error("Surface distance encountered a non-finite world position.");return point;@@ -49215,10 +49633,10 @@ function trianglePair(a, b) {const av = [a.a, a.b, a.c], bv = [b.a, b.b, b.c];if (b.getArea() > 0)for (const p of av)- record(p, b.closestPointToPoint(p, new Vector346));+ record(p, b.closestPointToPoint(p, new Vector347));if (a.getArea() > 0)for (const q of bv)- record(a.closestPointToPoint(q, new Vector346), q);+ record(a.closestPointToPoint(q, new Vector347), q);for (let i = 0;i < 3; i++) {const p = av[i], q = av[(i + 1) % 3];for (let j = 0;j < 3; j++)@@ -49231,9 +49649,9 @@ function trianglePair(a, b) {const length = delta.length();if (length === 0)continue;- const hit = new Ray2(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector346);+ const hit = new Ray2(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector347);if (hit && origin.distanceTo(hit) <= length) {- const onFace = target.closestPointToPoint(hit, new Vector346);+ const onFace = target.closestPointToPoint(hit, new Vector347);if (vertices === av)record(hit, onFace);else@@ -49399,7 +49817,7 @@ __export(exports_draw_diagnostics, {});import { Primitive as Primitive3 } from "@gltf-transform/core";import { cloneDocument } from "@gltf-transform/functions";-import * as THREE56 from "three";+import * as THREE57 from "three";function withinLimits(doc) {const root = doc.getRoot();if (root.listNodes().length > MAX_NODES2 || root.listAccessors().length > 4096 || root.listMaterials().length > 2048 || root.listTextures().length > 256 || root.listScenes().length > 32 || doc.getGraph().listEdges().length > 32768)@@ -49452,7 +49870,7 @@ function collect2(doc, keep) {function overlaps(a, b) {if (Math.abs(a.normal.dot(b.normal)) < 1 - 0.00000001 || !a.bounds.intersectsBox(b.bounds))return false;- const tolerance = Math.max(a.bounds.getSize(new THREE56.Vector3).length(), b.bounds.getSize(new THREE56.Vector3).length(), 0.000000000001) * 0.000001;+ const tolerance = Math.max(a.bounds.getSize(new THREE57.Vector3).length(), b.bounds.getSize(new THREE57.Vector3).length(), 0.000000000001) * 0.000001;if (b.points.some((p) => Math.abs(a.normal.dot(p.clone().sub(a.points[0]))) > tolerance))return false;const normal = a.normal.toArray().map(Math.abs);@@ -49494,7 +49912,7 @@ function observe(uses) {unexaminedPrimitiveUses++;continue;}- const matrix = new THREE56.Matrix4().fromArray(node.getWorldMatrix());+ const matrix = new THREE57.Matrix4().fromArray(node.getWorldMatrix());if (primitive.getAttribute("TANGENT") && matrix.determinant() < 0)mirrored.set(part.id, part);const position = primitive.getAttribute("POSITION");@@ -49508,14 +49926,14 @@ function observe(uses) {const amount = Math.min(count, 8, MAX_SAMPLES - samples.length);for (let i = 0;i < amount; i++) {const start = Math.floor(i * count / amount) * 3;- const points = [0, 1, 2].map((j) => new THREE56.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));+ const points = [0, 1, 2].map((j) => new THREE57.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));const normal = points[1].clone().sub(points[0]).cross(points[2].clone().sub(points[0]));if (!Number.isFinite(normal.lengthSq()) || normal.lengthSq() === 0)continue;samples.push({points,normal: normal.normalize(),- bounds: new THREE56.Box3().setFromPoints(points),+ bounds: new THREE57.Box3().setFromPoints(points),part});}@@ -49589,7 +50007,26 @@ async function inspectDrawDiagnostics(bytes, options = {}) {if (bytes.byteLength > MAX_BYTES)return skipped("input-limit");try {- return analyzeDrawDiagnostics(await createGltfIO().readBinary(bytes), options);+ const io = createGltfIO();+ const json = await io.binaryToJSON(bytes);+ let expandedBytes = 0;+ let compressed = false;+ for (const view of json.json.bufferViews ?? []) {+ const extension = view.extensions?.["EXT_meshopt_compression"];+ compressed ||= extension !== undefined;+ const length = extension ? (extension.count ?? Number.NaN) * (extension.byteStride ?? Number.NaN) : view.byteLength;+ if (!Number.isSafeInteger(length) || length < 0)+ return skipped("unreadable-glb");+ expandedBytes += length;+ if (expandedBytes > MAX_BYTES)+ return skipped("input-limit");+ }+ if (compressed) {+ const { MeshoptDecoder } = await import("meshoptimizer");+ await MeshoptDecoder.ready;+ io.registerDependencies({ "meshopt.decoder": MeshoptDecoder });+ }+ return analyzeDrawDiagnostics(await io.readJSON(json), options);} catch {return skipped("unreadable-glb");}@@ -49749,7 +50186,7 @@ var init_asset_widget = __esm(() => {// src/tools/registry.tsimport { z as z24 } from "zod";-import * as THREE57 from "three";+import * as THREE58 from "three";function proceduralTextureMaterialContract(rendered, context) {const required = [...new Set(context.requiredProceduralTextureUsages ?? [])];if (required.length === 0)@@ -49835,6 +50272,7 @@ async function renderDerivativeCell(input, context) {derivativeRoot = withoutHiddenMeshes(derivativeRoot);const rendered = await renderSceneToGLB(derivativeRoot, {derivative: true,+ gltfExporter: "three",requirements: toolRequirements(context).binding});await Promise.resolve().then(() => init_views());@@ -50029,8 +50467,8 @@ function collectSceneMetrics(root) {let meshes = 0;const materialSet = new Set;let lowestPart;- const box = new THREE57.Box3;- const point = new THREE57.Vector3;+ const box = new THREE58.Box3;+ const point = new THREE58.Vector3;root.updateWorldMatrix(true, true);root.traverseVisible((node) => {const n = node;@@ -50046,7 +50484,7 @@ function collectSceneMetrics(root) {const mesh = node;const position = mesh.geometry.getAttribute("position");const index = mesh.geometry.index;- const mb = new THREE57.Box3;+ const mb = new THREE58.Box3;if (position) {for (let i = 0;i < (index?.count ?? position.count); i++) {point.fromBufferAttribute(position, index ? index.getX(i) : i);@@ -50061,7 +50499,7 @@ function collectSceneMetrics(root) {});let bbox;if (!box.isEmpty()) {- const size = new THREE57.Vector3;+ const size = new THREE58.Vector3;box.getSize(size);bbox = {min: [box.min.x, box.min.y, box.min.z],@@ -52498,7 +52936,7 @@ __export(exports_asset_cli, {ASSET_USAGE: () => ASSET_USAGE,assetMain: () => assetMain});-import { readFile as readFile10, writeFile as writeFile8, stat as stat6, mkdir as mkdir9, rename as rename6 } from "node:fs/promises";+import { readFile as readFile10, writeFile as writeFile8, stat as stat6, mkdir as mkdir9, rename as rename5 } from "node:fs/promises";import { basename, resolve as resolve13, dirname as dirname9, isAbsolute as isAbsolute2 } from "node:path";import { randomUUID as randomUUID9 } from "node:crypto";import { createHash as createHash18 } from "node:crypto";@@ -52606,7 +53044,7 @@ async function assetMain(argv) {await mkdir9(dirname9(path), { recursive: true });const temporary = `${path}.${randomUUID9()}.tmp`;await writeFile8(temporary, JSON.stringify(roots, null, 2), { flag: "wx" });- await rename6(temporary, path);+ await rename5(temporary, path);console.log(`Collection ${name}: ${roots[name]}. Restart running MCP/viewer processes to load it.`);} else {const collections = library.collections().map((entry) => ({ ...entry, directory: library.directory(entry.id) }));diff --git a/dist/evaluator-worker.mjs b/dist/evaluator-worker.mjsindex 3e3029b3..7285a555 100644--- a/dist/evaluator-worker.mjs+++ b/dist/evaluator-worker.mjs@@ -133,6 +133,41 @@ var init_authoring_diagnostic = __esm(() => {};});+// src/evaluator/solid-diagnostic.ts+function validSolidFailureDetails(value) {+ if (!record(value) || !keys(value, ["total", "truncated", "meshes"]) || !count(value.total) || value.total < 1 || !Array.isArray(value.meshes) || value.meshes.length !== Math.min(value.total, MAX_SOLID_FAILURE_MESHES) || value.truncated !== value.total > value.meshes.length)+ return false;+ return value.meshes.every((mesh) => record(mesh) && keys(mesh, [+ "childPath",+ "closed",+ "manifold",+ "orientation",+ "boundaryEdges",+ "nonManifoldEdges",+ "orientationConflicts"+ ]) && (mesh.childPath === null || Array.isArray(mesh.childPath) && mesh.childPath.length <= MAX_SOLID_FAILURE_PATH && mesh.childPath.every(count)) && typeof mesh.closed === "boolean" && typeof mesh.manifold === "boolean" && typeof mesh.orientation === "string" && ["outward", "inward", "mixed"].includes(mesh.orientation) && count(mesh.boundaryEdges) && count(mesh.nonManifoldEdges) && count(mesh.orientationConflicts));+}+function solidFailureAdvice(value) {+ if (!value || !validSolidFailureDetails(value))+ return "";+ const rows = value.meshes.map((mesh) => {+ const locator = mesh.childPath === null ? "mesh beyond the 64-level locator limit" : `root${mesh.childPath.map((index) => `.children[${index}]`).join("")}`;+ return `${locator}: closed=${mesh.closed}, manifold=${mesh.manifold}, orientation=${mesh.orientation}, boundaryEdges=${mesh.boundaryEdges}, nonManifoldEdges=${mesh.nonManifoldEdges}, orientationConflicts=${mesh.orientationConflicts}`;+ });+ return ` Required solid measurements (${value.meshes.length} of ${value.total} failing meshes): ${rows.join("; ")}. Child indices locate nodes in the authored build root before export; names are not forwarded. Read the retained source and check that node's geometryDiagnostics().solid.`;+}+var MAX_SOLID_FAILURE_MESHES = 4, MAX_SOLID_FAILURE_PATH = 64, RequiredSolidError, record = (value) => value !== null && typeof value === "object" && !Array.isArray(value), keys = (value, names) => Object.keys(value).length === names.length && names.every((name) => Object.hasOwn(value, name)), count = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;+var init_solid_diagnostic = __esm(() => {+ init_authoring_diagnostic();+ RequiredSolidError = class RequiredSolidError extends AuthoringDiagnosticError {+ solid;+ constructor(solid, message) {+ super("REQUIRE_SOLID", message);+ this.solid = solid;+ }+ };+});+// src/contracts/breadth.tsfunction cloneVfxIntentV1(value) {return {@@ -148,7 +183,7 @@ function cloneVfxIntentV1(value) {}function validateVfxIntentV1(value) {const issues = [];- if (!record(value)) {+ if (!record2(value)) {return {valid: false,issues: [{ code: "EXPECTED_OBJECT", path: "", message: "VfxIntentV1 must be an object." }]@@ -189,7 +224,7 @@ function validateVfxIntentV1(value) {message: "doubleSided must be boolean."});}- if (!record(value.facing)) {+ if (!record2(value.facing)) {issues.push({ code: "INVALID_VFX_FACING", path: "facing", message: "facing is required." });} else {if (value.facing.source !== "explicit" && value.facing.source !== "inferred") {@@ -230,7 +265,7 @@ function validateVfxIntentV1(value) {});}}- if (!record(value.animation)) {+ if (!record2(value.animation)) {issues.push({code: "INVALID_VFX_ANIMATION",path: "animation",@@ -319,7 +354,7 @@ function validateVfxIntentV1(value) {}}if (value.sidecar !== undefined) {- if (!record(value.sidecar) || value.sidecar.kind !== "tsl" || !trimmed(value.sidecar.id) || !trimmed(value.sidecar.version)) {+ if (!record2(value.sidecar) || value.sidecar.kind !== "tsl" || !trimmed(value.sidecar.id) || !trimmed(value.sidecar.version)) {issues.push({code: "INVALID_VFX_SIDECAR",path: "sidecar",@@ -382,7 +417,7 @@ function normalizeVector(value) {}function validateModularKitContractV1(value) {const issues = [];- if (!record(value)) {+ if (!record2(value)) {return {valid: false,issues: [@@ -422,7 +457,7 @@ function validateModularKitContractV1(value) {const ids = new Set;for (const [index, socket] of sockets.entries()) {const path = `sockets[${index}]`;- if (!record(socket)) {+ if (!record2(socket)) {issues.push({ code: "INVALID_MODULAR_SOCKET", path, message: `${path} must be an object.` });continue;}@@ -451,7 +486,7 @@ function validateModularKitContractV1(value) {message: "compatibleTypes must contain strings."});}- if (!record(socket.frame) || !finiteTuple(socket.frame.translation, 3) || !finiteTuple(socket.frame.rotation, 4)) {+ if (!record2(socket.frame) || !finiteTuple(socket.frame.translation, 3) || !finiteTuple(socket.frame.rotation, 4)) {issues.push({code: "INVALID_MODULAR_FRAME",path: `${path}.frame`,@@ -550,7 +585,7 @@ function evaluateModularJoinV1(kit, observation) {codes};}-var VFX_SUBTYPES, VFX_PORTABILITY_MODES, VFX_AXIS_DIRECTIONS, VFX_FACING_MODES, VFX_PLAYBACK_POLICIES, VFX_RUNTIME_DRIVERS, VFX_ENDPOINT_BEHAVIORS, record = (value) => typeof value === "object" && value !== null && !Array.isArray(value), trimmed = (value) => typeof value === "string" && value.length > 0 && value === value.trim(), enumValue = (values, value) => typeof value === "string" && values.includes(value), finitePositive = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, finiteNonNegative = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0, ASSET_SCOPES, KILN_DEFAULT_MODULAR_GRID, finiteTuple = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), stable = (value) => Math.round(value * 1e6) / 1e6, dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2], subtract = (a, b) => [+var VFX_SUBTYPES, VFX_PORTABILITY_MODES, VFX_AXIS_DIRECTIONS, VFX_FACING_MODES, VFX_PLAYBACK_POLICIES, VFX_RUNTIME_DRIVERS, VFX_ENDPOINT_BEHAVIORS, record2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), trimmed = (value) => typeof value === "string" && value.length > 0 && value === value.trim(), enumValue = (values, value) => typeof value === "string" && values.includes(value), finitePositive = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, finiteNonNegative = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0, ASSET_SCOPES, KILN_DEFAULT_MODULAR_GRID, finiteTuple = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), stable = (value) => Math.round(value * 1e6) / 1e6, dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2], subtract = (a, b) => [a[0] - b[0],a[1] - b[1],a[2] - b[2]@@ -670,14 +705,14 @@ function createAssetRequirementsV1(input = {}) {...input});}-var text, positive, nonnegative, count, names, marker, roof, structure, effects, requirements, AssetRequirementsV1Schema;+var text, positive, nonnegative, count2, names, marker, roof, structure, effects, requirements, AssetRequirementsV1Schema;var init_requirements = __esm(() => {init_asset();init_breadth();text = z.string().refine((value) => value.trim().length > 0, { message: "Must be non-empty." });positive = z.number().finite().positive();nonnegative = z.number().finite().nonnegative();- count = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);+ count2 = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);names = z.array(text).refine((values) => new Set(values).size === values.length, {message: "Values must be unique."});@@ -693,7 +728,7 @@ var init_requirements = __esm(() => {structure = z.strictObject({subtype: text.optional(),enterable: z.boolean().optional(),- storeyCount: count.min(1).optional(),+ storeyCount: count2.min(1).optional(),interiorMode: z.enum(ARCHITECTURE_INTERIOR_MODES).optional(),roofMode: z.enum(ARCHITECTURE_ROOF_MODES).optional(),footprint: z.strictObject({ spanX: positive, spanZ: positive, units: z.literal("m") }).optional(),@@ -741,8 +776,8 @@ var init_requirements = __esm(() => {supportAssemblies: names.optional(),propulsionAssemblies: names.optional(),frontFrame: z.literal("+X").optional(),- wheelCount: count.optional(),- axleCount: count.optional(),+ wheelCount: count2.optional(),+ axleCount: count2.optional(),steering: z.enum(VEHICLE_STEERING_ARRANGEMENTS).optional(),supportPolicy: z.enum(VEHICLE_SUPPORT_POLICIES).optional(),animationAssemblies: names.optional()@@ -1511,7 +1546,7 @@ var init_animation_spline = __esm(() => {// src/qa/breadth-evidence.tsimport * as THREE from "three";-function record2(value) {+function record3(value) {return typeof value === "object" && value !== null && !Array.isArray(value);}function isMeshNode(value) {@@ -1521,10 +1556,10 @@ function isSpriteNode(value) {return value.isSprite === true;}function isTexture(value) {- return record2(value) && value.isTexture === true;+ return record3(value) && value.isTexture === true;}function isAnimationClip(value) {- return record2(value) && typeof value.name === "string" && typeof value.duration === "number" && Number.isFinite(value.duration) && Array.isArray(value.tracks);+ return record3(value) && typeof value.name === "string" && typeof value.duration === "number" && Number.isFinite(value.duration) && Array.isArray(value.tracks);}function localRenderableBox(rootInverse, node) {if (isSpriteNode(node)) {@@ -1788,7 +1823,7 @@ function shaderUniforms(materials) {const values = new Set;for (const material of materials) {const uniforms = material.uniforms;- if (record2(uniforms))+ if (record3(uniforms))for (const key of Object.keys(uniforms))values.add(key);}@@ -2214,14 +2249,14 @@ var init_registry = __esm(() => {// src/qa/breadth.tsfunction validModularJoinObservation(value) {- if (!record3(value))+ if (!record4(value))return false;return typeof value.aSocketId === "string" && value.aSocketId.length > 0 && typeof value.bSocketId === "string" && value.bSocketId.length > 0 && finiteTuple2(value.aWorldPosition, 3) && finiteTuple2(value.bWorldPosition, 3) && finiteTuple2(value.aWorldNormal, 3) && finiteTuple2(value.bWorldNormal, 3) && typeof value.relativeRotationDegrees === "number" && Number.isFinite(value.relativeRotationDegrees) && (value.toleranceMeters === undefined || typeof value.toleranceMeters === "number" && Number.isFinite(value.toleranceMeters) && value.toleranceMeters >= 0) && (value.normalToleranceDegrees === undefined || typeof value.normalToleranceDegrees === "number" && Number.isFinite(value.normalToleranceDegrees) && value.normalToleranceDegrees >= 0);}function validVfxArtifactEvidence(value) {- if (!record3(value) || value.schemaVersion !== 1)+ if (!record4(value) || value.schemaVersion !== 1)return false;- if (!record3(value.facing) || !record3(value.animation))+ if (!record4(value.facing) || !record4(value.animation))return false;if (!Array.isArray(value.materials))return false;@@ -2229,10 +2264,10 @@ function validVfxArtifactEvidence(value) {return false;if (!value.uniforms.every((name) => typeof name === "string" && name.length > 0))return false;- if (!value.clips.every((clip) => record3(clip) && typeof clip.name === "string" && clip.name.length > 0 && typeof clip.durationSeconds === "number" && Number.isFinite(clip.durationSeconds) && clip.durationSeconds >= 0)) {+ if (!value.clips.every((clip) => record4(clip) && typeof clip.name === "string" && clip.name.length > 0 && typeof clip.durationSeconds === "number" && Number.isFinite(clip.durationSeconds) && clip.durationSeconds >= 0)) {return false;}- return value.materials.every((material) => record3(material) && typeof material.id === "string" && material.id.length > 0 && ["card", "beam", "trail", "volume", "core"].includes(String(material.surfaceRole)) && ["opaque", "mask", "blend"].includes(String(material.alphaMode)) && (material.effectSurface === undefined || typeof material.effectSurface === "boolean") && typeof material.alphaData === "boolean" && typeof material.doubleSided === "boolean" && typeof material.screenAreaRatio === "number" && Number.isFinite(material.screenAreaRatio) && material.screenAreaRatio >= 0 && typeof material.transparentLayers === "number" && Number.isInteger(material.transparentLayers) && material.transparentLayers >= 0 && typeof material.textureMemoryBytes === "number" && Number.isInteger(material.textureMemoryBytes) && material.textureMemoryBytes >= 0);+ return value.materials.every((material) => record4(material) && typeof material.id === "string" && material.id.length > 0 && ["card", "beam", "trail", "volume", "core"].includes(String(material.surfaceRole)) && ["opaque", "mask", "blend"].includes(String(material.alphaMode)) && (material.effectSurface === undefined || typeof material.effectSurface === "boolean") && typeof material.alphaData === "boolean" && typeof material.doubleSided === "boolean" && typeof material.screenAreaRatio === "number" && Number.isFinite(material.screenAreaRatio) && material.screenAreaRatio >= 0 && typeof material.transparentLayers === "number" && Number.isInteger(material.transparentLayers) && material.transparentLayers >= 0 && typeof material.textureMemoryBytes === "number" && Number.isInteger(material.textureMemoryBytes) && material.textureMemoryBytes >= 0);}function artifactEvidence(context) {if (context.derivedEvidence?.source !== "engine-scene-analysis")@@ -2579,7 +2614,7 @@ function inspectAssetScope(context) {if (!scope)return [];const scopeObservation = context.derivedEvidence?.assetScope;- if (context.derivedEvidence?.source !== "engine-scene-analysis" || !record3(scopeObservation) || typeof scopeObservation.topLevelAssetRoots !== "number" || typeof scopeObservation.reusableMemberCount !== "number" || !Array.isArray(scopeObservation.sceneDressingRoles)) {+ if (context.derivedEvidence?.source !== "engine-scene-analysis" || !record4(scopeObservation) || typeof scopeObservation.topLevelAssetRoots !== "number" || typeof scopeObservation.reusableMemberCount !== "number" || !Array.isArray(scopeObservation.sceneDressingRoles)) {return [];}const result = assessAssetScopeV1(scope, scopeObservation);@@ -2640,7 +2675,7 @@ function evaluateAssetScopeQa(context) {derivedEvidence: context.derivedEvidence});}-var record3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), stable3 = (value) => Math.round(value * 1e6) / 1e6, finiteTuple2 = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), VFX_EXACT_QA_RULE, VFX_ADVISORY_QA_RULE, MODULAR_JOIN_QA_RULE, ASSET_SCOPE_QA_RULE, W7_BREADTH_QA_RULES;+var record4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), stable3 = (value) => Math.round(value * 1e6) / 1e6, finiteTuple2 = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), VFX_EXACT_QA_RULE, VFX_ADVISORY_QA_RULE, MODULAR_JOIN_QA_RULE, ASSET_SCOPE_QA_RULE, W7_BREADTH_QA_RULES;var init_breadth2 = __esm(() => {init_breadth();init_registry();@@ -4063,7 +4098,7 @@ function assertProceduralJsonV3(input) {};visit(input, "recipe", 0);}-function record4(value, allowed, path) {+function record5(value, allowed, path) {if (!value || typeof value !== "object" || Array.isArray(value))fail(`${path} must be a JSON object.`);const result = value;@@ -4096,7 +4131,7 @@ function rgba(value, path) {return c[3] === 0 ? [0, 0, 0, 0] : c;}function rectangle(value, path, kind) {- const r = record4(value, ["x", "y", "width", "height", ...kind ? ["kind"] : []], path);+ const r = record5(value, ["x", "y", "width", "height", ...kind ? ["kind"] : []], path);return {x: integer2(r["x"], -4096, 4096, `${path}.x`),y: integer2(r["y"], -4096, 4096, `${path}.y`),@@ -4105,11 +4140,11 @@ function rectangle(value, path, kind) {};}function shape(value, path) {- const r = record4(value, ["kind", "x", "y", "width", "height", "from", "to", "points"], path);+ const r = record5(value, ["kind", "x", "y", "width", "height", "from", "to", "points"], path);if (r["kind"] === "rectangle" || r["kind"] === "ellipse")return { kind: r["kind"], ...rectangle(r, path, r["kind"]) };if (r["kind"] === "polygon") {- record4(r, ["kind", "points"], path);+ record5(r, ["kind", "points"], path);const points = r["points"];if (!Array.isArray(points) || points.length < 3 || points.length > MAX_PROCEDURAL_V3_VERTICES)fail(`${path}.points requires 3..${MAX_PROCEDURAL_V3_VERTICES} vertices.`);@@ -4119,7 +4154,7 @@ function shape(value, path) {};}if (r["kind"] === "line") {- record4(r, ["kind", "from", "to", "width"], path);+ record5(r, ["kind", "from", "to", "width"], path);return {kind: "line",from: tuple(r["from"], 2, `${path}.from`, -4096, 4096),@@ -4155,7 +4190,7 @@ function proceduralClippedBoundsV3(s, width, height, dx = 0, dy = 0) {}function admitProceduralTextureSpecV3(input) {assertProceduralJsonV3(input);- const r = record4(input, ["schemaVersion", "width", "height", "usage", "name", "background", "operations", "palette"], "recipe");+ const r = record5(input, ["schemaVersion", "width", "height", "usage", "name", "background", "operations", "palette"], "recipe");if (r["schemaVersion"] !== 3)fail("schemaVersion must be 3.");const width = integer2(r["width"], 4, MAX_PROCEDURAL_V3_EDGE, "width");@@ -4178,7 +4213,7 @@ function admitProceduralTextureSpecV3(input) {let legacyTransientBytes = 0;const operations = rawOps.map((value, i) => {const path = `operations[${i}]`;- const op = record4(value, [+ const op = record5(value, ["op","shape","rgba",@@ -4192,8 +4227,8 @@ function admitProceduralTextureSpecV3(input) {"periodic"], path);if (op["op"] === "legacy-v2") {- record4(op, ["op", "spec", "alpha", "opacity"], path);- const legacyRecord = record4(op["spec"], ["schemaVersion", "size", "usage", "name", "layers"], `${path}.spec`);+ record5(op, ["op", "spec", "alpha", "opacity"], path);+ const legacyRecord = record5(op["spec"], ["schemaVersion", "size", "usage", "name", "layers"], `${path}.spec`);if (legacyRecord["schemaVersion"] !== 2)fail(`${path}.spec requires explicit schemaVersion 2.`);const spec = canonicalizeProceduralTextureSpecV2(legacyRecord);@@ -4213,7 +4248,7 @@ function admitProceduralTextureSpecV3(input) {const [x0, y0, x1, y1] = proceduralClippedBoundsV3(s, width, height);const area = Math.max(0, x1 - x0) * Math.max(0, y1 - y0);if (op["op"] === "mask") {- record4(op, ["op", "shape", "alpha", "invert"], path);+ record5(op, ["op", "shape", "alpha", "invert"], path);work += texels + area * cost;return {op: "mask",@@ -4230,11 +4265,11 @@ function admitProceduralTextureSpecV3(input) {opacity: integer2(op["opacity"], 0, 255, `${path}.opacity`, 255)};if (op["op"] === "paint") {- record4(op, ["op", "shape", "rgba", "opacity"], path);+ record5(op, ["op", "shape", "rgba", "opacity"], path);work += area * (cost + 1);return { op: "paint", ...paint };}- record4(op, ["op", "shape", "rgba", "opacity", "count", "seed", "area", "periodic"], path);+ record5(op, ["op", "shape", "rgba", "opacity", "count", "seed", "area", "periodic"], path);if (!colorUsage)fail("stamps are supported only for color usages albedo and emissive.");const count = integer2(op["count"], 1, MAX_PROCEDURAL_V3_STAMPS, `${path}.count`);@@ -4259,7 +4294,7 @@ function admitProceduralTextureSpecV3(input) {if (r["palette"] !== undefined) {if (!colorUsage)fail("palette and dither are supported only for color usages albedo and emissive.");- const p = record4(r["palette"], ["colors", "dither"], "palette");+ const p = record5(r["palette"], ["colors", "dither"], "palette");const colors = p["colors"];if (!Array.isArray(colors) || colors.length < 1 || colors.length > MAX_PROCEDURAL_V3_PALETTE)fail(`palette.colors requires 1..${MAX_PROCEDURAL_V3_PALETTE} entries.`);@@ -4383,7 +4418,7 @@ function preflight(input) {};visit(input, 0);}-function record5(value, fields, label) {+function record6(value, fields, label) {if (!value || typeof value !== "object" || Array.isArray(value))atlasFailure(`${label} must be a JSON object.`);const r = value;@@ -4402,7 +4437,7 @@ function hash2(value, label) {return value;}function rect(value, label) {- const r = record5(value, ["x", "y", "width", "height"], label);+ const r = record6(value, ["x", "y", "width", "height"], label);return {x: integer3(r["x"], 0, 4096, `${label}.x`),y: integer3(r["y"], 0, 4096, `${label}.y`),@@ -4489,12 +4524,12 @@ function packAtlasRegionsV1(width, height, fixed, pending) {}function canonicalizeTextureAtlasSpecV1(input) {preflight(input);- const r = record5(input, ["schemaVersion", "width", "height", "usage", "sampler", "regions", "pack"], "atlas");+ const r = record6(input, ["schemaVersion", "width", "height", "usage", "sampler", "regions", "pack"], "atlas");if (r["schemaVersion"] !== 1)atlasFailure("schemaVersion must be 1.");let pack;if (r["pack"] !== undefined) {- const p = record5(r["pack"], ["edge", "gutter", "algorithm"], "pack");+ const p = record6(r["pack"], ["edge", "gutter", "algorithm"], "pack");if (!TEXTURE_ATLAS_PACK_EDGES.includes(p["edge"]))atlasFailure("pack.edge must be 1024 or 2048.");if (p["algorithm"] !== undefined && p["algorithm"] !== "maxrects")@@ -4516,7 +4551,7 @@ function canonicalizeTextureAtlasSpecV1(input) {atlasFailure(`regions must contain 1..${limits.regions} entries.`);const pending = [];const regions = r["regions"].map((value, i) => {- const q = record5(value, ["name", "content", "gutter", "edgeMode", "source", "crop", "packed"], `regions[${i}]`);+ const q = record6(value, ["name", "content", "gutter", "edgeMode", "source", "crop", "packed"], `regions[${i}]`);if (typeof q["name"] !== "string" || !/^[a-z][a-z0-9_-]{0,79}$/.test(q["name"]))atlasFailure("region name must be a stable lowercase identifier.");const explicit = q["content"] !== undefined;@@ -4531,11 +4566,11 @@ function canonicalizeTextureAtlasSpecV1(input) {atlasFailure("unsupported edgeMode.");if (edgeMode === "mask-rgb-dilate" && usage !== "albedo" && usage !== "emissive")atlasFailure("mask RGB dilation requires color usage.");- const s = record5(q["source"], ["kind", "spec", "resourceId", "pin", "expected"], "source");+ const s = record6(q["source"], ["kind", "spec", "resourceId", "pin", "expected"], "source");let source;let crop = q["crop"] === undefined ? undefined : rect(q["crop"], "crop");if (s["kind"] === "procedural") {- record5(s, ["kind", "spec"], "procedural source");+ record6(s, ["kind", "spec"], "procedural source");const admission = admitProceduralTextureSpecV3(s["spec"]);if (admission.spec.usage !== usage)atlasFailure("source usage does not match atlas usage.");@@ -4544,10 +4579,10 @@ function canonicalizeTextureAtlasSpecV1(input) {content ??= { x: 0, y: 0, width: crop.width, height: crop.height };assertAtlasCropV1(crop, content, admission.spec.width, admission.spec.height);} else if (s["kind"] === "resource") {- record5(s, ["kind", "resourceId", "pin", "expected"], "resource source");+ record6(s, ["kind", "resourceId", "pin", "expected"], "resource source");if (typeof s["resourceId"] !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9_.:/-]{0,199}$/.test(s["resourceId"]))atlasFailure("source resourceId must be an exact returned map ID.");- const p = record5(s["pin"], ["resourceId", "revisionId", "sha256"], "source pin");+ const p = record6(s["pin"], ["resourceId", "revisionId", "sha256"], "source pin");if (typeof p["resourceId"] !== "string" || !/^[a-z][a-z0-9_-]{0,79}$/.test(p["resourceId"]))atlasFailure("pin resourceId must be a material ID.");const revisionId = hash2(p["revisionId"], "pin revisionId"), sha256 = hash2(p["sha256"], "pin sha256");@@ -4555,7 +4590,7 @@ function canonicalizeTextureAtlasSpecV1(input) {atlasFailure("source pin revision/hash mismatch.");let expected;if (s["expected"] !== undefined) {- const e = record5(s["expected"], ["width", "height", "imageSha256", "decodedPixelHash"], "source expected");+ const e = record6(s["expected"], ["width", "height", "imageSha256", "decodedPixelHash"], "source expected");expected = {...e["width"] === undefined ? {} : { width: integer3(e["width"], 1, 4096, "expected.width") },...e["height"] === undefined ? {} : { height: integer3(e["height"], 1, 4096, "expected.height") },@@ -4654,7 +4689,7 @@ ${canonicalAtlasMetadataJsonV1({ width: spec.width, height: spec.height, origin:function validateTextureAtlasManifestV1(input, providedSpec) {preflight(input);const spec = canonicalizeTextureAtlasSpecV1(providedSpec);- const r = record5(input, [+ const r = record6(input, ["version","compilerId","width",@@ -4681,7 +4716,7 @@ function validateTextureAtlasManifestV1(input, providedSpec) {atlasFailure("manifest source/region inventory mismatch.");const dimensions = new Map;for (const sourceValue of r["sources"]) {- const s = record5(sourceValue, [+ const s = record6(sourceValue, ["id","kind","width",@@ -4699,12 +4734,12 @@ function validateTextureAtlasManifestV1(input, providedSpec) {const width = integer3(s["width"], 1, 4096, "manifest source width"), height = integer3(s["height"], 1, 4096, "manifest source height");hash2(s["decodedPixelHash"], "manifest source decodedPixelHash");if (source.kind === "procedural") {- record5(s, ["id", "kind", "width", "height", "decodedPixelHash", "recipeHash", "compilerId"], "manifest procedural source");+ record6(s, ["id", "kind", "width", "height", "decodedPixelHash", "recipeHash", "compilerId"], "manifest procedural source");if (width !== source.spec.width || height !== source.spec.height || s["recipeHash"] !== hashProceduralTextureSpecV3(source.spec) || s["compilerId"] !== "kiln.procedural-rgba.v3.1")atlasFailure("manifest procedural source identity mismatch.");} else {- record5(s, ["id", "kind", "width", "height", "decodedPixelHash", "descriptor"], "manifest resource source");- const d = record5(s["descriptor"], [+ record6(s, ["id", "kind", "width", "height", "decodedPixelHash", "descriptor"], "manifest resource source");+ const d = record6(s["descriptor"], ["materialId","revisionId","resourceId",@@ -4739,7 +4774,7 @@ function validateTextureAtlasManifestV1(input, providedSpec) {dimensions.set(s["id"], { width, height });}for (let i = 0;i < spec.regions.length; i++) {- const region = spec.regions[i], v = record5(r["regions"][i], ["name", "content", "allocation", "crop", "sourceId"], "manifest region");+ const region = spec.regions[i], v = record6(r["regions"][i], ["name", "content", "allocation", "crop", "sourceId"], "manifest region");const sourceId = atlasSourceIdentityV1(region.source), size = dimensions.get(sourceId);const crop = region.crop ?? { x: 0, y: 0, width: size.width, height: size.height };assertAtlasCropV1(crop, region.content, size.width, size.height);@@ -16453,7 +16488,9 @@ function requireSolid(part) {}function assertRequiredSolids(root) {const problems = [];- const visit = (node) => {+ const meshes = [];+ let total = 0;+ const visit = (node, childPath) => {if (node.visible === false)return;const mesh = node;@@ -16467,15 +16504,29 @@ function assertRequiredSolids(root) {reasons.push(`not manifold (${report.nonManifoldEdges} edges shared by 3+ faces)`);if (solid.orientation !== "outward")reasons.push(solid.orientation === "mixed" ? `winding is mixed (${report.orientationConflicts} conflicting edges)` : `faces point inward (signed volume ${solid.signedVolume.toPrecision(4)})`);- if (reasons.length)- problems.push(`${mesh.name || "(unnamed mesh)"}: ${reasons.join(", ")}`);+ if (reasons.length) {+ total++;+ if (meshes.length < MAX_SOLID_FAILURE_MESHES) {+ problems.push(`${mesh.name || "(unnamed mesh)"}: ${reasons.join(", ")}`);+ meshes.push({+ childPath: childPath.length <= MAX_SOLID_FAILURE_PATH ? childPath : null,+ closed: solid.closed,+ manifold: solid.manifold,+ orientation: solid.orientation,+ boundaryEdges: report.boundaryEdges,+ nonManifoldEdges: report.nonManifoldEdges,+ orientationConflicts: report.orientationConflicts+ });+ }+ }}- for (const child of node.children)- visit(child);+ node.children.forEach((child, index) => {+ visit(child, [...childPath, index]);+ });};- visit(root);- if (problems.length)- throw new AuthoringDiagnosticError("REQUIRE_SOLID", `requireSolid: ${problems.length} marked mesh(es) are not closed, manifold, outward solids: ${problems.slice(0, 4).join("; ")}${problems.length > 4 ? "; ..." : ""}.`);+ visit(root, []);+ if (total)+ throw new RequiredSolidError({ total, truncated: total > meshes.length, meshes }, `requireSolid: ${total} marked mesh(es) are not closed, manifold, outward solids: ${problems.join("; ")}${total > meshes.length ? "; ..." : ""}.`);}var REQUIRE_SOLID_KEY = "kilnRequireSolid", marked = (node) => {for (let at = node;at; at = at.parent)@@ -16486,6 +16537,7 @@ var REQUIRE_SOLID_KEY = "kilnRequireSolid", marked = (node) => {var init_require_solid = __esm(() => {init_authoring_diagnostic();init_geometry();+ init_solid_diagnostic();});// src/user-data-extras.ts@@ -17532,7 +17584,7 @@ function normalizeBudget(spec) {fail7(`unknown field ${JSON.stringify(key)}.`);const triangles = {};if (typeof value.triangles === "number")- triangles.LOD0 = count2("triangles", value.triangles);+ triangles.LOD0 = count3("triangles", value.triangles);else if (value.triangles && typeof value.triangles === "object" && !Array.isArray(value.triangles)) {const entries = Object.entries(value.triangles);if (entries.length === 0)@@ -17540,7 +17592,7 @@ function normalizeBudget(spec) {for (const [tier, limit] of entries) {if (!/^LOD(0|[1-9][0-9]?)$/.test(tier))fail7(`triangles tier ${JSON.stringify(tier)} must be named LOD0, LOD1, ...`);- triangles[tier] = count2(`triangles.${tier}`, limit);+ triangles[tier] = count3(`triangles.${tier}`, limit);}} elsefail7("triangles must be a positive integer or a record of LOD tiers.");@@ -17548,7 +17600,7 @@ function normalizeBudget(spec) {return {schemaVersion: 1,triangles: ordered,- ...value.draws === undefined ? {} : { draws: count2("draws", value.draws) }+ ...value.draws === undefined ? {} : { draws: count3("draws", value.draws) }};}function defineBudget(spec, target) {@@ -17602,7 +17654,7 @@ function evaluateBudget(declaration, measuredLod0, chains) {}var KILN_BUDGET_KEY = "kilnBudgetV1", fail7 = (detail) => {throw new AuthoringDiagnosticError("DELIVERY_CONTRACT", `defineBudget(spec): ${detail}`);-}, count2 = (label, value) => {+}, count3 = (label, value) => {if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1)fail7(`${label} must be a positive integer, got ${String(value)}.`);return value;@@ -19877,6 +19929,164 @@ var init_profile = __esm(() => {};});+// src/sdf.ts+function sphereInside(point, center, radius) {+ if (point.length !== 3 || !point.every(Number.isFinite))+ throw new Error("sphereInside point must be three finite numbers");+ if (!Number.isFinite(radius) || radius <= 0)+ throw new Error("sphereInside radius must be positive and finite");+ if (center.length !== 3 || !center.every(Number.isFinite))+ throw new Error("sphereInside center must be three finite numbers");+ return radius - Math.hypot(point[0] - center[0], point[1] - center[1], point[2] - center[2]);+}+function smoothUnion(a, b, blend) {+ if (!Number.isFinite(a) || !Number.isFinite(b))+ throw new Error("smoothUnion operands must be finite");+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("smoothUnion blend must be positive and finite");+ const h = Math.max(blend - Math.abs(a - b), 0) / blend;+ return Math.max(a, b) + h * h * blend / 4;+}+function smoothUnionSpheres(point, spheres, blend) {+ if (!spheres.length)+ throw new Error("smoothUnionSpheres needs at least one sphere");+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("smoothUnionSpheres blend must be positive and finite");+ let value = sphereInside(point, spheres[0].center, spheres[0].radius);+ for (let i = 1;i < spheres.length; i++) {+ const s = spheres[i];+ value = smoothUnion(value, sphereInside(point, s.center, s.radius), blend);+ }+ return value;+}++// src/organic.ts+import * as THREE38 from "three";+function assertSafePathCount(name, count) {+ if (!Number.isSafeInteger(count))+ throw new Error(`${name} derived sample count must be a safe integer; reduce sample counts.`);+}+async function metaballSurface(spheres, options) {+ if (!spheres.length)+ throw new Error("metaballSurface needs at least one sphere");+ let minRadius = Infinity;+ for (const s of spheres) {+ if (s.center.length !== 3 || !s.center.every(Number.isFinite))+ throw new Error("metaballSurface sphere center must be three finite numbers");+ if (!Number.isFinite(s.radius) || s.radius <= 0)+ throw new Error("metaballSurface sphere radius must be positive and finite");+ minRadius = Math.min(minRadius, s.radius);+ }+ const blend = options.blend ?? Math.max(minRadius * 0.35, 0.02);+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("metaballSurface blend must be positive and finite");+ const { bounds, ...rest } = options;+ const field = (p) => smoothUnionSpheres(p, spheres, blend);+ return implicitSurface(field, { bounds, ...rest });+}+function catmullRomPath(controlPoints, samplesPerSpan = 8, closed = false) {+ if (controlPoints.length < (closed ? 3 : 2))+ throw new Error("catmullRomPath needs at least two open or three closed control points");+ if (!Number.isSafeInteger(samplesPerSpan) || samplesPerSpan < 1)+ throw new Error("catmullRomPath samplesPerSpan must be a positive integer");+ const spans = closed ? controlPoints.length : controlPoints.length - 1;+ assertSafePathCount("catmullRomPath", spans * samplesPerSpan + 1);+ if (controlPoints.some((p) => p.length !== 3 || !p.every(Number.isFinite)))+ throw new Error("catmullRomPath control points must be finite [x,y,z] triples");+ const vectors = controlPoints.map((p) => new THREE38.Vector3(p[0], p[1], p[2]));+ const curve = new THREE38.CatmullRomCurve3(vectors, closed);+ const points = curve.getPoints(spans * samplesPerSpan);+ if (closed)+ points.pop();+ return points.map((v) => [v.x, v.y, v.z]);+}+function taperedTube(path, radii, options = {}) {+ const closed = options.closed ?? false;+ const stations = path;+ if (stations.length < (closed ? 3 : 2))+ throw new Error("taperedTube needs at least two open or three closed path points");+ if (radii.length !== stations.length)+ throw new Error("taperedTube radii must have one entry per path point");+ for (const r of radii) {+ if (!Number.isFinite(r) || r <= 0)+ throw new Error("taperedTube radii must be positive and finite");+ }+ const radialSegments = options.radialSegments ?? 20;+ const profile = circleProfile(1, radialSegments).map(([x, y]) => [x, y]);+ const scale = radii.map((r, i) => {+ const [side, depth] = options.sectionScale?.[i] ?? [1, 1];+ return [r * side, r * depth];+ });+ if (options.sectionScale && options.sectionScale.length !== stations.length)+ throw new Error("taperedTube sectionScale needs one [side, depth] pair per path point");+ const geo = sweepProfile(profile, [...stations], {+ cap: options.cap ?? true,+ closed,+ up: options.up,+ twist: options.twist ?? 0,+ scale,+ creaseAngle: options.creaseAngle ?? 180+ });+ return geo;+}+function spiralPath(options) {+ const {+ center,+ radius,+ rise,+ turns,+ axis = [0, 1, 0],+ forward = [0, 0, 1],+ samples = 24+ } = options;+ if (![radius, rise, turns].every((n) => Number.isFinite(n) && n > 0))+ throw new Error("spiralPath radius, rise and turns must be positive and finite");+ if (!Number.isSafeInteger(samples) || samples < 4)+ throw new Error("spiralPath samples must be an integer >= 4");+ assertSafePathCount("spiralPath", samples + 1);+ if (center.length !== 3 || !center.every(Number.isFinite))+ throw new Error("spiralPath center must be a finite [x,y,z] triple");+ if (axis.length !== 3 || forward.length !== 3 || ![...axis, ...forward].every(Number.isFinite))+ throw new Error("spiralPath axis and forward must be finite [x,y,z] triples");+ const up = new THREE38.Vector3(...axis);+ const fwd = new THREE38.Vector3(...forward);+ if (up.lengthSq() < 0.000000000001 || fwd.lengthSq() < 0.000000000001)+ throw new Error("spiralPath axis and forward must be nonzero");+ up.normalize();+ const horiz = fwd.clone().addScaledVector(up, -fwd.dot(up));+ if (horiz.lengthSq() < 0.000000000001)+ throw new Error("spiralPath forward must not be parallel to axis");+ horiz.normalize();+ const right = new THREE38.Vector3().crossVectors(up, horiz).normalize();+ const out = [];+ for (let i = 0;i <= samples; i++) {+ const u = i / samples;+ const theta = u * turns * Math.PI * 2;+ const r = radius * (1 - u * 0.58);+ const offset = horiz.clone().multiplyScalar(r * Math.cos(theta)).add(right.clone().multiplyScalar(r * Math.sin(theta)));+ const lift = up.clone().multiplyScalar(u * rise);+ out.push([+ center[0] + offset.x + lift.x,+ center[1] + offset.y + lift.y,+ center[2] + offset.z + lift.z+ ]);+ }+ return out;+}+function smoothOrganic(geometry, options = {}) {+ const iterations = options.iterations ?? 1;+ const preserveUV = options.preserveUV ?? false;+ const subdivided = subdivide(geometry, iterations, preserveUV ? { preserveUV: true } : undefined);+ return creaseNormals(subdivided, { angle: options.creaseAngle ?? 55 });+}+var init_organic = __esm(() => {+ init_geometry();+ init_implicit();+ init_profile();+ init_ops();+ init_sweep2();+});+// src/procedural-texture-v2-compiler.tsfunction hash22(x, y, seed) {let h = Math.imul(x, 374761393) + Math.imul(y, 668265263) + Math.imul(seed, 1274126177) | 0;@@ -20182,7 +20392,7 @@ var init_procedural_texture_v3 = __esm(() => {});// src/procedural-texture.ts-import * as THREE38 from "three";+import * as THREE39 from "three";function proceduralTextureSchemaVersion(input) {if (!input || typeof input !== "object" || Array.isArray(input))throw new ProceduralTextureError("proceduralTexture requires a plain JSON object.", "PROCEDURAL_TEXTURE_V3_CONTRACT");@@ -20203,14 +20413,14 @@ function proceduralTexture(spec) {if (proceduralTextureSchemaVersion(spec) === 3) {const compiled = compileProceduralTextureSpecV3(spec);const { width, height, usage, name } = compiled.spec;- const tex = new THREE38.DataTexture(compiled.pixels, width, height, THREE38.RGBAFormat, THREE38.UnsignedByteType);+ const tex = new THREE39.DataTexture(compiled.pixels, width, height, THREE39.RGBAFormat, THREE39.UnsignedByteType);if (name)tex.name = name;- tex.colorSpace = usage === "albedo" || usage === "emissive" ? THREE38.SRGBColorSpace : THREE38.NoColorSpace;- tex.wrapS = THREE38.RepeatWrapping;- tex.wrapT = THREE38.RepeatWrapping;- tex.minFilter = THREE38.LinearMipmapLinearFilter;- tex.magFilter = THREE38.LinearFilter;+ tex.colorSpace = usage === "albedo" || usage === "emissive" ? THREE39.SRGBColorSpace : THREE39.NoColorSpace;+ tex.wrapS = THREE39.RepeatWrapping;+ tex.wrapT = THREE39.RepeatWrapping;+ tex.minFilter = THREE39.LinearMipmapLinearFilter;+ tex.magFilter = THREE39.LinearFilter;tex.generateMipmaps = true;tex.needsUpdate = true;tex.userData["kilnProcedural"] = {@@ -20223,14 +20433,14 @@ function proceduralTexture(spec) {}const compiled = compileProceduralTextureSpecV2(spec);const { size, usage, name, layers } = compiled.spec;- const tex = new THREE38.DataTexture(compiled.pixels, size, size, THREE38.RGBAFormat, THREE38.UnsignedByteType);+ const tex = new THREE39.DataTexture(compiled.pixels, size, size, THREE39.RGBAFormat, THREE39.UnsignedByteType);if (name)tex.name = name;- tex.colorSpace = usage === "albedo" || usage === "emissive" ? THREE38.SRGBColorSpace : THREE38.NoColorSpace;- tex.wrapS = THREE38.RepeatWrapping;- tex.wrapT = THREE38.RepeatWrapping;- tex.minFilter = THREE38.LinearMipmapLinearFilter;- tex.magFilter = THREE38.LinearFilter;+ tex.colorSpace = usage === "albedo" || usage === "emissive" ? THREE39.SRGBColorSpace : THREE39.NoColorSpace;+ tex.wrapS = THREE39.RepeatWrapping;+ tex.wrapT = THREE39.RepeatWrapping;+ tex.minFilter = THREE39.LinearMipmapLinearFilter;+ tex.magFilter = THREE39.LinearFilter;tex.generateMipmaps = true;tex.needsUpdate = true;tex.userData["kilnProcedural"] = {@@ -20284,13 +20494,13 @@ function normalMapFromHeight(source, opts = {}) {out[o + 3] = 255;}}- const tex = new THREE38.DataTexture(out, width, height, THREE38.RGBAFormat, THREE38.UnsignedByteType);+ const tex = new THREE39.DataTexture(out, width, height, THREE39.RGBAFormat, THREE39.UnsignedByteType);tex.name = opts.name ?? (source.name ? `${source.name}_Normal` : "");- tex.colorSpace = THREE38.NoColorSpace;- tex.wrapS = THREE38.RepeatWrapping;- tex.wrapT = THREE38.RepeatWrapping;- tex.minFilter = THREE38.LinearMipmapLinearFilter;- tex.magFilter = THREE38.LinearFilter;+ tex.colorSpace = THREE39.NoColorSpace;+ tex.wrapS = THREE39.RepeatWrapping;+ tex.wrapT = THREE39.RepeatWrapping;+ tex.minFilter = THREE39.LinearMipmapLinearFilter;+ tex.magFilter = THREE39.LinearFilter;tex.generateMipmaps = true;tex.needsUpdate = true;return tex;@@ -20305,7 +20515,7 @@ var init_procedural_texture = __esm(() => {});// src/textures.ts-import * as THREE39 from "three";+import * as THREE40 from "three";async function loadTexture(source, opts = {}) {let bytes;if (typeof source === "string") {@@ -20326,7 +20536,7 @@ async function loadTexture(source, opts = {}) {if (!meta.width || !meta.height) {throw new Error("loadTexture: could not read image dimensions");}- const tex = new THREE39.DataTexture(new Uint8Array(data), meta.width, meta.height, THREE39.RGBAFormat, THREE39.UnsignedByteType);+ const tex = new THREE40.DataTexture(new Uint8Array(data), meta.width, meta.height, THREE40.RGBAFormat, THREE40.UnsignedByteType);const usage = opts.usage ?? "albedo";const colorSpace = usage === "albedo" || usage === "emissive" ? "srgb" : "linear";let hasAlpha = false;@@ -20336,14 +20546,14 @@ async function loadTexture(source, opts = {}) {break;}}- tex.colorSpace = colorSpace === "srgb" ? THREE39.SRGBColorSpace : THREE39.NoColorSpace;+ tex.colorSpace = colorSpace === "srgb" ? THREE40.SRGBColorSpace : THREE40.NoColorSpace;if (opts.name)tex.name = opts.name;tex.needsUpdate = true;- tex.wrapS = THREE39.RepeatWrapping;- tex.wrapT = THREE39.RepeatWrapping;- tex.minFilter = THREE39.LinearMipmapLinearFilter;- tex.magFilter = THREE39.LinearFilter;+ tex.wrapS = THREE40.RepeatWrapping;+ tex.wrapT = THREE40.RepeatWrapping;+ tex.minFilter = THREE40.LinearMipmapLinearFilter;+ tex.magFilter = THREE40.LinearFilter;tex.generateMipmaps = true;tex.userData["encoded"] = {mime,@@ -20378,17 +20588,17 @@ function requireTextureUsage(texture, usage) {if (meta && meta.usage !== usage) {throw new TypeError(`Texture ${JSON.stringify(texture.name || "(unnamed)")} was loaded for ${meta.usage}, not ${usage}.`);}- texture.colorSpace = usage === "albedo" || usage === "emissive" ? THREE39.SRGBColorSpace : THREE39.NoColorSpace;+ texture.colorSpace = usage === "albedo" || usage === "emissive" ? THREE40.SRGBColorSpace : THREE40.NoColorSpace;}function pbrMaterial(opts = {}) {- const mat = new THREE39.MeshStandardMaterial;+ const mat = new THREE40.MeshStandardMaterial;const isTex = (v) => !!v?.isTexture;if (isTex(opts.albedo)) {requireTextureUsage(opts.albedo, "albedo");mat.map = opts.albedo;- mat.color = new THREE39.Color(16777215);+ mat.color = new THREE40.Color(16777215);} else if (opts.albedo !== undefined) {- mat.color = new THREE39.Color(opts.albedo);+ mat.color = new THREE40.Color(opts.albedo);}if (opts.normal) {requireTextureUsage(opts.normal, "normal");@@ -20426,9 +20636,9 @@ function pbrMaterial(opts = {}) {if (isTex(opts.emissive)) {requireTextureUsage(opts.emissive, "emissive");mat.emissiveMap = opts.emissive;- mat.emissive = new THREE39.Color(16777215);+ mat.emissive = new THREE40.Color(16777215);} else if (opts.emissive !== undefined) {- mat.emissive = new THREE39.Color(opts.emissive);+ mat.emissive = new THREE40.Color(opts.emissive);}if (opts.emissiveIntensity !== undefined) {mat.emissiveIntensity = opts.emissiveIntensity;@@ -20460,7 +20670,7 @@ function pbrMaterial(opts = {}) {mat.transparent = true;}if (opts.doubleSided)- mat.side = THREE39.DoubleSide;+ mat.side = THREE40.DoubleSide;mat.userData["kilnMaterial"] = {alphaMode,...alphaMode === "mask" ? { alphaCutoff: mat.alphaTest } : {},@@ -20752,7 +20962,7 @@ var init_texture_atlas_pixels = __esm(() => {});// src/uv-shapes.ts-import * as THREE40 from "three";+import * as THREE41 from "three";function remapUV(geo, options = {}) {if (!options || typeof options !== "object" || Array.isArray(options) || Object.keys(options).some((key) => !["scale", "offset"].includes(key))) {throw new Error("remapUV: options may contain only scale and offset.");@@ -20781,7 +20991,7 @@ function remapUV(geo, options = {}) {}const cloned = geo.clone();cloned.userData = structuredClone(geo.userData);- cloned.setAttribute("uv", new THREE40.Float32BufferAttribute(values, 2));+ cloned.setAttribute("uv", new THREE41.Float32BufferAttribute(values, 2));if ((scale[0] !== 1 || scale[1] !== 1) && cloned.hasAttribute("tangent")) {cloned.deleteAttribute("tangent");const previous = cloned.userData.kilnAttributeWarnings;@@ -20798,13 +21008,13 @@ function remapUV(geo, options = {}) {var init_uv_shapes = () => {};// src/texture-atlas.ts-import * as THREE41 from "three";+import * as THREE42 from "three";async function textureAtlas(input, options = {}) {const compiled = await compileTextureAtlasSpecV1(input, options);- const texture = new THREE41.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE41.RGBAFormat, THREE41.UnsignedByteType);+ const texture = new THREE42.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE42.RGBAFormat, THREE42.UnsignedByteType);texture.name = "Atlas";texture.flipY = false;- texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE41.SRGBColorSpace : THREE41.NoColorSpace;+ texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE42.SRGBColorSpace : THREE42.NoColorSpace;applyPortableSamplerV1(texture, compiled.spec.sampler);texture.userData.kilnAtlas = { spec: compiled.spec, manifest: compiled.manifest };texture.userData.kilnTexture = {@@ -20855,7 +21065,7 @@ function remapUVToAtlas(geometry, atlas, name, options) {bytes += buffer.byteLength;}} else {- bytes += attribute.array.byteLength * (attribute.constructor === THREE41.BufferAttribute || attribute.constructor === THREE41.InstancedBufferAttribute ? 1 : 2);+ bytes += attribute.array.byteLength * (attribute.constructor === THREE42.BufferAttribute || attribute.constructor === THREE42.InstancedBufferAttribute ? 1 : 2);}};for (const attr of Object.values(geometry.attributes))@@ -23011,7 +23221,7 @@ var init_material_resources = __esm(() => {});// src/material-recipe-runtime.ts-import * as THREE42 from "three";+import * as THREE43 from "three";async function applyMaterialRecipeV1(request, options = {}) {const resolved = resolveMaterialRecipeV1(request);const cache = options.cache ?? DEFAULT_APPROVED_TEXTURE_CACHE;@@ -23034,9 +23244,9 @@ async function applyMaterialRecipeV1(request, options = {}) {};const material = pbrMaterial(materialOptions);material.name = options.name ?? request.id;- material.color.setRGB(resolved.baseColorFactor[0], resolved.baseColorFactor[1], resolved.baseColorFactor[2], THREE42.LinearSRGBColorSpace);+ material.color.setRGB(resolved.baseColorFactor[0], resolved.baseColorFactor[1], resolved.baseColorFactor[2], THREE43.LinearSRGBColorSpace);material.opacity = resolved.baseColorFactor[3];- material.emissive.setRGB(resolved.emissiveFactor[0], resolved.emissiveFactor[1], resolved.emissiveFactor[2], THREE42.LinearSRGBColorSpace);+ material.emissive.setRGB(resolved.emissiveFactor[0], resolved.emissiveFactor[1], resolved.emissiveFactor[2], THREE43.LinearSRGBColorSpace);const resources = [...loaded.values()].map((entry) => entry.provenance).sort((a, b) => `${a.resourceId}:${a.usage}`.localeCompare(`${b.resourceId}:${b.usage}`));const provenance = {schemaVersion: 1,@@ -23186,7 +23396,7 @@ function assertJson(input) {if (new TextEncoder().encode(JSON.stringify(input)).length > PORTABLE_MATERIAL_V3_LIMITS.maxJsonBytes)fail8("JSON byte budget exceeded.");}-function record6(value, keys) {+function record7(value, keys) {if (!value || typeof value !== "object" || Array.isArray(value))fail8("expected a JSON object.");const result = value;@@ -23206,7 +23416,7 @@ function admitMaterial(input) {"alphaCutoff","doubleSided"];- const r = record6(input, ["schemaVersion", "model", "name", "textures", ...scalarKeys]);+ const r = record7(input, ["schemaVersion", "model", "name", "textures", ...scalarKeys]);if (r["schemaVersion"] !== 3 || r["model"] !== "pbrMetallicRoughness")fail8("requires schemaVersion 3 and model pbrMetallicRoughness.");const name = r["name"];@@ -23217,12 +23427,12 @@ function admitMaterial(input) {model: "pbrMetallicRoughness",...Object.fromEntries(scalarKeys.filter((k) => r[k] !== undefined).map((k) => [k, r[k]]))});- const refs = record6(r["textures"] ?? {}, Object.keys(PORTABLE_MATERIAL_SLOT_USAGE));+ const refs = record7(r["textures"] ?? {}, Object.keys(PORTABLE_MATERIAL_SLOT_USAGE));const textures = {};let texels = 0, work = 0, bytes = 0;for (const [key, value] of Object.entries(refs)) {const slot = key;- const ref = record6(value, ["kind", "spec", "resourceId", "sampler"]);+ const ref = record7(value, ["kind", "spec", "resourceId", "sampler"]);const sampler = canonicalizePortableSamplerV1(ref["sampler"]);if (ref["kind"] === "procedural") {if (ref["resourceId"] !== undefined)@@ -23472,7 +23682,7 @@ var init_portable_material_runtime = __esm(() => {});// src/uv-data.ts-import * as THREE43 from "three";+import * as THREE44 from "three";function validateAtlasRemap(mesh, inputIndex, sourceCount) {const count = mesh.vertexCount;if (!Number.isSafeInteger(count) || count < 1 || count > GEOMETRY_ALLOCATION_LIMITS.unwrapVertices)@@ -23507,7 +23717,7 @@ function remapUnwrapAttribute(attribute, oldIndexes) {for (let c = 0;c < attribute.itemSize; c++)array[i * attribute.itemSize + c] = attribute.array[oldIndexes[i] * stride + offset + c];}- const output = attribute.isFloat16BufferAttribute ? new THREE43.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE43.BufferAttribute(array, attribute.itemSize, attribute.normalized);+ const output = attribute.isFloat16BufferAttribute ? new THREE44.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE44.BufferAttribute(array, attribute.itemSize, attribute.normalized);output.name = attribute.name;output.setUsage(interleaved(attribute) ? attribute.data.usage : attribute.usage);if (!interleaved(attribute))@@ -23619,7 +23829,7 @@ var init_uv_data = __esm(() => {});// src/uv.ts-import * as THREE44 from "three";+import * as THREE45 from "three";async function getXatlas() {if (!_xatlasReady) {_xatlasReady = (async () => {@@ -23651,7 +23861,7 @@ async function autoUnwrap(geometry, opts = {}) {if (result.atlasCount !== 1 || !Number.isSafeInteger(result.width) || result.width <= 0 || !Number.isSafeInteger(result.height) || result.height <= 0)throw new Error("autoUnwrap: xatlas must return one valid atlas; multiple atlas pages are unsupported.");const remap = validateAtlasRemap(mesh, prepared.index, geometry.getAttribute("position").count);- const out = new THREE44.BufferGeometry;+ const out = new THREE45.BufferGeometry;for (const [name, attribute] of Object.entries(geometry.attributes)) {if (name === "uv" || name === "tangent" || name === "normal" && !prepared.useNormals)continue;@@ -23661,8 +23871,8 @@ async function autoUnwrap(geometry, opts = {}) {out.morphAttributes[name] = targets.map((attribute) => remapUnwrapAttribute(attribute, remap.oldIndexes));}out.morphTargetsRelative = geometry.morphTargetsRelative;- out.setIndex(new THREE44.BufferAttribute(new Uint32Array(remap.index), 1));- out.setAttribute("uv", new THREE44.BufferAttribute(new Float32Array(remap.uv), 2));+ out.setIndex(new THREE45.BufferAttribute(new Uint32Array(remap.index), 1));+ out.setAttribute("uv", new THREE45.BufferAttribute(new Float32Array(remap.uv), 2));out.name = geometry.name;out.groups = geometry.groups.map((group) => ({ ...group }));out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);@@ -23697,11 +23907,11 @@ function repairZeroNormals(geo) {if (broken.size === 0)return;const acc = new Float32Array(normal.count * 3);- const a = new THREE44.Vector3;- const b = new THREE44.Vector3;- const c = new THREE44.Vector3;- const face = new THREE44.Vector3;- const edge = new THREE44.Vector3;+ const a = new THREE45.Vector3;+ const b = new THREE45.Vector3;+ const c = new THREE45.Vector3;+ const face = new THREE45.Vector3;+ const edge = new THREE45.Vector3;for (let t = 0;t + 2 < index.count; t += 3) {const tri = [index.getX(t), index.getX(t + 1), index.getX(t + 2)];if (!tri.some((i) => broken.has(i)))@@ -23737,7 +23947,7 @@ var init_uv = __esm(() => {});// src/uv-project.ts-import * as THREE45 from "three";+import * as THREE46 from "three";function projectUV(geometry, options) {if (!options || typeof options !== "object" || Array.isArray(options) || !["planar", "box", "cylindrical"].includes(options.projection) || Object.keys(options).some((key) => !["projection", "frame", "seamDegrees", "angularRange", "caps"].includes(key)))throw new Error("projectUV: select an explicit planar, box or cylindrical projection with documented options.");@@ -23775,15 +23985,15 @@ function projectUV(geometry, options) {throw new Error("projectUV: index contains an invalid vertex reference.");}const points = [];- const bounds = new THREE45.Box3;+ const bounds = new THREE46.Box3;for (let i = 0;i < positions.count; i++) {- const point = new THREE45.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);+ const point = new THREE46.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);if (![point.x, point.y, point.z].every(Number.isFinite))throw new Error("projectUV: frame-local positions must be finite.");points.push(point);bounds.expandByPoint(point);}- const extent = bounds.getSize(new THREE45.Vector3);+ const extent = bounds.getSize(new THREE46.Vector3);const fit = (point, axis) => extent[axis] > 0 ? (point[axis] - bounds.min[axis]) / extent[axis] : 0.5;const outputUVs = new Float32Array(corners * 2);const startDegrees = options.angularRange?.[0] ?? options.seamDegrees ?? 180;@@ -23791,8 +24001,8 @@ function projectUV(geometry, options) {const sweep = (options.angularRange?.[1] ?? 360) * Math.PI / 180;const fullWrap = options.angularRange === undefined || options.angularRange[1] === 360;const wrap = (angle) => (angle % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);- const normal = new THREE45.Vector3;- const edge = new THREE45.Vector3;+ const normal = new THREE46.Vector3;+ const edge = new THREE46.Vector3;for (let i = 0;i < corners; i += 3) {const triangle = [0, 1, 2].map((offset) => points[index ? index.getX(i + offset) : i + offset]);normal.subVectors(triangle[1], triangle[0]).cross(edge.subVectors(triangle[2], triangle[0])).normalize();@@ -23839,7 +24049,7 @@ function projectUV(geometry, options) {const out = geometry.index ? geometry.toNonIndexed() : geometry.clone();out.userData = structuredClone(geometry.userData);out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);- out.setAttribute("uv", new THREE45.Float32BufferAttribute(outputUVs, 2));+ out.setAttribute("uv", new THREE46.Float32BufferAttribute(outputUVs, 2));if (out.hasAttribute("tangent")) {out.deleteAttribute("tangent");const previous = out.userData.kilnAttributeWarnings;@@ -23860,17 +24070,17 @@ var init_uv_project = __esm(() => {});// src/primitives.ts-import * as THREE46 from "three";+import * as THREE47 from "three";function vectorToTuple(v) {return [v.x, v.y, v.z];}function createRoot(name) {- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;return root;}function createPivot(name, position = [0, 0, 0], parent) {- const pivot = new THREE46.Object3D;+ const pivot = new THREE47.Object3D;pivot.name = `Joint_${name}`;pivot.position.set(...position);if (parent)@@ -23902,16 +24112,16 @@ function assertPartArgs(name, geometry2, material) {}function createPart(name, geometry2, material, options = {}) {assertPartArgs(name, geometry2, material);- const mesh = new THREE46.Mesh(geometry2, material);+ const mesh = new THREE47.Mesh(geometry2, material);mesh.name = `Mesh_${name}`;if (options.position)mesh.position.set(...options.position);if (options.rotation)- mesh.rotation.set(THREE46.MathUtils.degToRad(options.rotation[0]), THREE46.MathUtils.degToRad(options.rotation[1]), THREE46.MathUtils.degToRad(options.rotation[2]));+ mesh.rotation.set(THREE47.MathUtils.degToRad(options.rotation[0]), THREE47.MathUtils.degToRad(options.rotation[1]), THREE47.MathUtils.degToRad(options.rotation[2]));if (options.scale)mesh.scale.set(...options.scale);if (options.pivot) {- const pivot = new THREE46.Object3D;+ const pivot = new THREE47.Object3D;pivot.name = `Joint_${name}`;pivot.add(mesh);mesh.position.set(0, 0, 0);@@ -23934,7 +24144,7 @@ function capsuleGeo(radius, height, segments = 6) {assertDimension("capsuleGeo height (straight middle length)", height, true);assertDimension("capsuleGeo outer half-length", height / 2 + radius);assertPrimitiveSegments("capsuleGeo segments", segments, 3);- return new THREE46.CapsuleGeometry(radius, height, 2, segments);+ return new THREE47.CapsuleGeometry(radius, height, 2, segments);}function capsuleXGeo(radius, length, segments = 6) {const geo = capsuleGeo(radius, length, segments);@@ -23953,7 +24163,7 @@ function cylinderGeo(radiusTop, radiusBottom, height, segments = 8) {throw new RangeError("cylinderGeo requires at least one positive radius.");assertDimension("cylinderGeo height", height);assertPrimitiveSegments("cylinderGeo segments", segments, 3);- return new THREE46.CylinderGeometry(radiusTop, radiusBottom, height, segments);+ return new THREE47.CylinderGeometry(radiusTop, radiusBottom, height, segments);}function cylinderXGeo(radiusTop, radiusBottom, length, segments = 8) {const geo = cylinderGeo(radiusTop, radiusBottom, length, segments);@@ -23968,20 +24178,20 @@ function cylinderZGeo(radiusTop, radiusBottom, length, segments = 8) {function boxGeo(width, height, depth) {for (const [name, value] of Object.entries({ width, height, depth }))assertDimension(`boxGeo ${name} (use planeGeo for a sheet)`, value);- return new THREE46.BoxGeometry(width, height, depth);+ return new THREE47.BoxGeometry(width, height, depth);}function sphereGeo(radius, widthSegments = 8, heightSegments = 6) {assertDimension("sphereGeo radius", radius);assertPrimitiveSegments("sphereGeo widthSegments", widthSegments, 3);assertPrimitiveSegments("sphereGeo heightSegments", heightSegments, 2);assertPrimitiveGrid("sphereGeo", widthSegments, heightSegments);- return new THREE46.SphereGeometry(radius, widthSegments, heightSegments);+ return new THREE47.SphereGeometry(radius, widthSegments, heightSegments);}function coneGeo(radius, height, segments = 8) {assertDimension("coneGeo radius", radius);assertDimension("coneGeo height", height);assertPrimitiveSegments("coneGeo segments", segments, 3);- return new THREE46.ConeGeometry(radius, height, segments);+ return new THREE47.ConeGeometry(radius, height, segments);}function coneXGeo(radius, length, segments = 8) {const geo = coneGeo(radius, length, segments);@@ -23998,7 +24208,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {const segments = options.segments ?? 8;assertFiniteTriple("cylinderOnAxis center", center);assertFiniteTriple("cylinderOnAxis normal", normal);- const n = new THREE46.Vector3(normal[0], normal[1], normal[2]);+ const n = new THREE47.Vector3(normal[0], normal[1], normal[2]);const len = Math.hypot(...normal);if (len < 0.000001) {throw new Error(`cylinderOnAxis: normal must be a non-zero vector (got [${normal.join(",")}]).`);@@ -24006,7 +24216,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {const magnitude = Math.max(...normal.map(Math.abs));n.set(normal[0] / magnitude, normal[1] / magnitude, normal[2] / magnitude).normalize();const geo = cylinderGeo(radiusTop, radiusBottom, height, segments);- const q = new THREE46.Quaternion().setFromUnitVectors(new THREE46.Vector3(0, 1, 0), n);+ const q = new THREE47.Quaternion().setFromUnitVectors(new THREE47.Vector3(0, 1, 0), n);geo.applyQuaternion(q);geo.translate(center[0], center[1], center[2]);return geo;@@ -24028,7 +24238,7 @@ function torusGeo(radius, tube, radialSegments = 8, tubularSegments = 12) {assertPrimitiveSegments("torusGeo radialSegments", radialSegments, 3);assertPrimitiveSegments("torusGeo tubularSegments", tubularSegments, 3);assertPrimitiveGrid("torusGeo", radialSegments, tubularSegments);- return new THREE46.TorusGeometry(radius, tube, radialSegments, tubularSegments);+ return new THREE47.TorusGeometry(radius, tube, radialSegments, tubularSegments);}function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {assertDimension("planeGeo width", width);@@ -24036,14 +24246,14 @@ function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {assertPrimitiveSegments("planeGeo widthSegments", widthSegments, 1);assertPrimitiveSegments("planeGeo heightSegments", heightSegments, 1);assertPrimitiveGrid("planeGeo", widthSegments, heightSegments);- return new THREE46.PlaneGeometry(width, height, widthSegments, heightSegments);+ return new THREE47.PlaneGeometry(width, height, widthSegments, heightSegments);}function decalBox(width, height, depth = 0.01) {assertDimension("decalBox width", width);assertDimension("decalBox height", height);assertDimension("decalBox depth", depth, true);const d = Math.max(depth, 0.002);- return new THREE46.BoxGeometry(width, height, d);+ return new THREE47.BoxGeometry(width, height, d);}function validateCardFrame(name, width, height, yPivot) {assertDimension(`${name} width`, width);@@ -24057,7 +24267,7 @@ function foliageCardGeo(opts = {}) {const h = opts.height ?? 1;const yPivot = opts.yPivot ?? 0;validateCardFrame("foliageCardGeo", w, h, yPivot);- const geom = new THREE46.PlaneGeometry(w, h);+ const geom = new THREE47.PlaneGeometry(w, h);geom.translate(0, h * (0.5 - yPivot), 0);geom.userData["kilnGeometryRole"] = "foliageCard";return geom;@@ -24073,12 +24283,12 @@ function crossedQuadsGeo(opts = {}) {const geometries = [];for (let i = 0;i < planes; i++) {const angle = i / planes * Math.PI;- const quad = new THREE46.PlaneGeometry(w, h);+ const quad = new THREE47.PlaneGeometry(w, h);quad.translate(0, h * (0.5 - yPivot), 0);quad.rotateY(angle);geometries.push(quad);}- const out = new THREE46.BufferGeometry;+ const out = new THREE47.BufferGeometry;const posCount = geometries.reduce((sum, g) => sum + (g.attributes.position?.count ?? 0), 0);const positions = new Float32Array(posCount * 3);const normals = new Float32Array(posCount * 3);@@ -24105,9 +24315,9 @@ function crossedQuadsGeo(opts = {}) {}vOffset += p.count;}- out.setAttribute("position", new THREE46.BufferAttribute(positions, 3));- out.setAttribute("normal", new THREE46.BufferAttribute(normals, 3));- out.setAttribute("uv", new THREE46.BufferAttribute(uvs, 2));+ out.setAttribute("position", new THREE47.BufferAttribute(positions, 3));+ out.setAttribute("normal", new THREE47.BufferAttribute(normals, 3));+ out.setAttribute("uv", new THREE47.BufferAttribute(uvs, 2));out.setIndex(indices);out.userData["kilnGeometryRole"] = "foliageCard";return out;@@ -24122,7 +24332,7 @@ function octaGridPlane(opts) {const h = opts.height ?? 1;const yPivot = opts.yPivot ?? 0;validateCardFrame("octaGridPlane", w, h, yPivot);- const geom = new THREE46.PlaneGeometry(w, h);+ const geom = new THREE47.PlaneGeometry(w, h);geom.translate(0, h * (0.5 - yPivot), 0);const uv = geom.attributes.uv;const du = 1 / opts.tilesX;@@ -24218,8 +24428,8 @@ function wingGeo(options = {}) {7,6];- const geo = new THREE46.BufferGeometry;- geo.setAttribute("position", new THREE46.BufferAttribute(vertices, 3));+ const geo = new THREE47.BufferGeometry;+ geo.setAttribute("position", new THREE47.BufferAttribute(vertices, 3));geo.setIndex(tipChord === 0 ? [0, 1, 3, 4, 7, 5, 0, 2, 6, 0, 6, 4, 1, 5, 7, 1, 7, 3, 0, 4, 5, 0, 5, 1] : indices);geo.computeVertexNormals();return geo;@@ -24250,17 +24460,17 @@ function createWingPair(name, material, options) {};}function beamBetween(name, start, end, radius, material, options = {}) {- const a = new THREE46.Vector3(...start);- const b = new THREE46.Vector3(...end);+ const a = new THREE47.Vector3(...start);+ const b = new THREE47.Vector3(...end);const direction = b.clone().sub(a);const length = direction.length();if (length <= 0.0001) {throw new Error(`beamBetween("${name}"): start and end must be different points (got start=[${start.join(",")}], end=[${end.join(",")}], delta=${length.toExponential(2)}). Pick two distinct endpoints or switch to cylinderGeo with an explicit length + position.`);}- const mesh = new THREE46.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);+ const mesh = new THREE47.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);mesh.name = `Mesh_${name}`;mesh.position.copy(a.add(b).multiplyScalar(0.5));- mesh.quaternion.setFromUnitVectors(new THREE46.Vector3(0, 1, 0), direction.normalize());+ mesh.quaternion.setFromUnitVectors(new THREE47.Vector3(0, 1, 0), direction.normalize());if (options.parent)options.parent.add(mesh);return mesh;@@ -24269,11 +24479,11 @@ function snapTo(part, host, options = {}) {const overlap = options.overlap ?? 0.02;part.updateWorldMatrix(true, true);host.updateWorldMatrix(true, true);- const a = new THREE46.Box3().setFromObject(part);- const b = new THREE46.Box3().setFromObject(host);+ const a = new THREE47.Box3().setFromObject(part);+ const b = new THREE47.Box3().setFromObject(host);if (a.isEmpty() || b.isEmpty())return part;- const delta = new THREE46.Vector3;+ const delta = new THREE47.Vector3;for (const axis of ["x", "y", "z"]) {if (a.min[axis] > b.max[axis])delta[axis] = b.max[axis] - a.min[axis];@@ -24289,7 +24499,7 @@ function snapTo(part, host, options = {}) {delta[dominant] = -overlap;const parent = part.parent;if (parent) {- const p0 = new THREE46.Vector3;+ const p0 = new THREE47.Vector3;part.getWorldPosition(p0);const p1 = p0.clone().add(delta);const l0 = parent.worldToLocal(p0.clone());@@ -24324,8 +24534,8 @@ function createLadder(name, options) {throw new RangeError("createLadder rungCount must be an integer from 0 to 10000.");if (widthAxis !== "x" && widthAxis !== "z")throw new RangeError("createLadder widthAxis must be x or z.");- const bottomVec = new THREE46.Vector3;- const topVec = new THREE46.Vector3(...top).sub(new THREE46.Vector3(...bottom));+ const bottomVec = new THREE47.Vector3;+ const topVec = new THREE47.Vector3(...top).sub(new THREE47.Vector3(...bottom));const length = Math.hypot(topVec.x, topVec.y, topVec.z);assertDimension("createLadder endpoint distance", length);if (length <= 0.0001)@@ -24333,7 +24543,7 @@ function createLadder(name, options) {const along = topVec.clone().divideScalar(length);if (widthDirection !== undefined)assertFiniteTriple("createLadder widthDirection", widthDirection);- let across = widthDirection ? new THREE46.Vector3(...widthDirection) : widthAxis === "x" ? new THREE46.Vector3(1, 0, 0) : new THREE46.Vector3(0, 0, 1);+ let across = widthDirection ? new THREE47.Vector3(...widthDirection) : widthAxis === "x" ? new THREE47.Vector3(1, 0, 0) : new THREE47.Vector3(0, 0, 1);const largest = Math.max(Math.abs(across.x), Math.abs(across.y), Math.abs(across.z));if (!largest)throw new RangeError("createLadder widthDirection must be nonzero.");@@ -24343,19 +24553,19 @@ function createLadder(name, options) {if (widthDirection)throw new RangeError("createLadder widthDirection must not be parallel to the endpoints.");const axes = [- new THREE46.Vector3(1, 0, 0),- new THREE46.Vector3(0, 1, 0),- new THREE46.Vector3(0, 0, 1)+ new THREE47.Vector3(1, 0, 0),+ new THREE47.Vector3(0, 1, 0),+ new THREE47.Vector3(0, 0, 1)];across = axes.reduce((best, axis) => Math.abs(axis.dot(along)) < Math.abs(best.dot(along)) ? axis : best);across.addScaledVector(along, -across.dot(along));}across.normalize();const offset = across.clone().multiplyScalar(width / 2);- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;root.position.set(...bottom);- const rotation = new THREE46.Quaternion().setFromRotationMatrix(new THREE46.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();+ const rotation = new THREE47.Quaternion().setFromRotationMatrix(new THREE47.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();stampSemanticMetadataV1(root, {roles: ["ladder"],frames: [@@ -24395,7 +24605,7 @@ function wallWithOpening(name, material, options) {if (opening && openings)throw new TypeError("wallWithOpening: use opening or openings, not both.");const built = buildWallPanels(length, height, thickness, openings ?? (opening ? [opening] : []));- const group = new THREE46.Object3D;+ const group = new THREE47.Object3D;group.name = name;const panel = (suffix, lenStart, lenEnd, yLo, yHi) => {const segLen = lenEnd - lenStart;@@ -24426,7 +24636,7 @@ function room(name, material, options = {}) {parent} = options;const openings = options.openings ?? [{ wall: "front", kind: "door" }];- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;const wall = (suffix, len, axis, pos, which) => {const w = wallWithOpening(`${name}_Wall${suffix}`, material, {@@ -24480,7 +24690,7 @@ function createStairs(name, material, options) {if (Math.abs(totalRise) < 0.0001 || Math.abs(totalRun) < 0.0001) {throw new Error(`createStairs("${name}"): totalRise and totalRun must be non-zero (got rise=${totalRise}, run=${totalRun}).`);}- const root = new THREE46.Object3D;+ const root = new THREE47.Object3D;root.name = name;const stepRise = totalRise / steps;const stepRun = totalRun / steps;@@ -24510,7 +24720,7 @@ function requireColor(color, fn) {}function gameMaterial(color, options = {}) {requireColor(color, "gameMaterial");- return new THREE46.MeshStandardMaterial({+ return new THREE47.MeshStandardMaterial({color,metalness: options.metalness ?? 0,roughness: options.roughness ?? 0.8,@@ -24521,7 +24731,7 @@ function gameMaterial(color, options = {}) {}function basicMaterial(color, options = {}) {requireColor(color, "basicMaterial");- return new THREE46.MeshBasicMaterial({+ return new THREE47.MeshBasicMaterial({color,transparent: options.transparent ?? false,opacity: options.opacity ?? 1@@ -24529,18 +24739,18 @@ function basicMaterial(color, options = {}) {}function glassMaterial(color, options = {}) {requireColor(color, "glassMaterial");- return new THREE46.MeshStandardMaterial({+ return new THREE47.MeshStandardMaterial({color,transparent: true,opacity: options.opacity ?? 0.35,roughness: options.roughness ?? 0.1,metalness: options.metalness ?? 0,- side: THREE46.DoubleSide+ side: THREE47.DoubleSide});}function lambertMaterial(color, options = {}) {requireColor(color, "lambertMaterial");- return new THREE46.MeshLambertMaterial({+ return new THREE47.MeshLambertMaterial({color,flatShading: options.flatShading ?? true,emissive: options.emissive ?? 0@@ -24550,12 +24760,12 @@ function threeInterpolation(mode) {if (mode !== undefined && !TRACK_INTERPOLATIONS.includes(mode)) {throw new Error(`Animation interpolation must be one of ${TRACK_INTERPOLATIONS.join(", ")}.`);}- return mode === "STEP" ? THREE46.InterpolateDiscrete : THREE46.InterpolateLinear;+ return mode === "STEP" ? THREE47.InterpolateDiscrete : THREE47.InterpolateLinear;}function interpolatedTrack(Type, name, times, values, interpolation) {if (!isCubicInterpolation(interpolation))return new Type(name, times, values, threeInterpolation(interpolation));- const quaternion = Type === THREE46.QuaternionKeyframeTrack;+ const quaternion = Type === THREE47.QuaternionKeyframeTrack;return useCubicSpline(new Type(name, times, cubicSplineValues(times, values, quaternion ? 4 : 3, interpolation, quaternion)));}function animationNumber(value, label) {@@ -24609,15 +24819,15 @@ function rotationTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "rotation", interpolation);const times = [];const values = [];- const euler = new THREE46.Euler;- const quat = new THREE46.Quaternion;+ const euler = new THREE47.Euler;+ const quat = new THREE47.Quaternion;for (const kf of keyframes) {times.push(kf.time);- euler.set(THREE46.MathUtils.degToRad(kf.rotation[0]), THREE46.MathUtils.degToRad(kf.rotation[1]), THREE46.MathUtils.degToRad(kf.rotation[2]));+ euler.set(THREE47.MathUtils.degToRad(kf.rotation[0]), THREE47.MathUtils.degToRad(kf.rotation[1]), THREE47.MathUtils.degToRad(kf.rotation[2]));quat.setFromEuler(euler);values.push(quat.x, quat.y, quat.z, quat.w);}- return interpolatedTrack(THREE46.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);+ return interpolatedTrack(THREE47.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);}function positionTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "position", interpolation);@@ -24627,7 +24837,7 @@ function positionTrack(jointName, keyframes, interpolation) {times.push(kf.time);values.push(...kf.position);}- return interpolatedTrack(THREE46.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);+ return interpolatedTrack(THREE47.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);}function scaleTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "scale", interpolation);@@ -24637,7 +24847,7 @@ function scaleTrack(jointName, keyframes, interpolation) {times.push(kf.time);values.push(...kf.scale);}- return interpolatedTrack(THREE46.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);+ return interpolatedTrack(THREE47.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);}function createClip(name, duration, tracks, options) {if (typeof name !== "string" || !name.trim())@@ -24650,7 +24860,7 @@ function createClip(name, duration, tracks, options) {const loop = clipLoopOption(options);const names = new Set;for (const track of tracks) {- if (!(track instanceof THREE46.KeyframeTrack))+ if (!(track instanceof THREE47.KeyframeTrack))throw new Error("Animation clip tracks must be KeyframeTrack instances.");if (typeof track.name !== "string")throw new Error("Animation track target/channel must use a string name.");@@ -24664,12 +24874,12 @@ function createClip(name, duration, tracks, options) {throw new Error(`Duplicate animation target/channel: ${track.name}.`);names.add(track.name);const quaternion = channel === "quaternion";- const Type = quaternion ? THREE46.QuaternionKeyframeTrack : THREE46.VectorKeyframeTrack;+ const Type = quaternion ? THREE47.QuaternionKeyframeTrack : THREE47.VectorKeyframeTrack;if (!(track instanceof Type))throw new Error(`Animation channel ${channel} requires ${quaternion ? "QuaternionKeyframeTrack" : "VectorKeyframeTrack"}.`);const cubic = isCubicSplineTrack(track);const mode = track.getInterpolation();- if (!cubic && mode !== THREE46.InterpolateLinear && mode !== THREE46.InterpolateDiscrete) {+ if (!cubic && mode !== THREE47.InterpolateLinear && mode !== THREE47.InterpolateDiscrete) {throw new Error("Animation interpolation must be LINEAR, STEP or CUBICSPLINE (the glTF sampler modes); three.js smooth and Bezier interpolants have no glTF form.");}animationTimes(track.times, track.name);@@ -24692,7 +24902,7 @@ function createClip(name, duration, tracks, options) {throw new Error(`Animation clip duration ${duration} does not include every key of ${track.name}.`);}}- const clip = new THREE46.AnimationClip(name, duration, tracks);+ const clip = new THREE47.AnimationClip(name, duration, tracks);if (loop !== undefined)clip.userData.kilnLoopIntent = loop ? "loop" : "once";return clip;@@ -24769,12 +24979,12 @@ function createInstance(name, source, options = {}) {if (!sourceMesh) {throw new Error(`createInstance("${name}"): source "${source.name}" has no Mesh to clone from`);}- const mesh = new THREE46.Mesh(sourceMesh.geometry, sourceMesh.material);+ const mesh = new THREE47.Mesh(sourceMesh.geometry, sourceMesh.material);mesh.name = `Mesh_${name}`;if (options.position)mesh.position.set(...options.position);if (options.rotation)- mesh.rotation.set(THREE46.MathUtils.degToRad(options.rotation[0]), THREE46.MathUtils.degToRad(options.rotation[1]), THREE46.MathUtils.degToRad(options.rotation[2]));+ mesh.rotation.set(THREE47.MathUtils.degToRad(options.rotation[0]), THREE47.MathUtils.degToRad(options.rotation[1]), THREE47.MathUtils.degToRad(options.rotation[2]));if (options.scale)mesh.scale.set(...options.scale);if (options.parent)@@ -25006,6 +25216,13 @@ function buildSandboxGlobals(usage, options = {}) {bobbingAnimation: wrap("bobbingAnimation", bobbingAnimation),idleBreathing: wrap("idleBreathing", idleBreathing),implicitSurface: wrap("implicitSurface", implicitSurface),+ metaballSurface: wrap("metaballSurface", metaballSurface),+ catmullRomPath: wrap("catmullRomPath", catmullRomPath),+ spiralPath: wrap("spiralPath", spiralPath),+ taperedTube: wrap("taperedTube", taperedTube),+ smoothOrganic: wrap("smoothOrganic", smoothOrganic),+ smoothUnion: wrap("smoothUnion", smoothUnion),+ sphereInside: wrap("sphereInside", sphereInside),sweepProfile: wrap("sweepProfile", sweepProfile),loftProfiles: wrap("loftProfiles", loftProfiles),bend: wrap("bend", bend),@@ -25057,7 +25274,7 @@ function buildSandboxGlobals(usage, options = {}) {countMaterials: wrap("countMaterials", countMaterials),getJointNames: wrap("getJointNames", getJointNames),materialBudgetAdvisory: wrap("materialBudgetAdvisory", materialBudgetAdvisory),- THREE: THREE46,+ THREE: THREE47,Math,console: options.console ?? console};@@ -25089,6 +25306,7 @@ var init_primitives = __esm(() => {init_deform();init_sweep2();init_implicit();+ init_organic();init_profile();init_solids();init_procedural_texture();@@ -25116,6 +25334,7 @@ var init_primitives = __esm(() => {init_procedural_texture();init_assembly();init_implicit();+ init_organic();init_sweep2();init_deform();init_geometry();@@ -25442,7 +25661,7 @@ import {PropertyType as PropertyType4} from "@gltf-transform/core";import { createTransform, dequantizePrimitive, joinPrimitives } from "@gltf-transform/functions";-import * as THREE47 from "three";+import * as THREE48 from "three";function isSingular(matrix) {const e = matrix.elements;const scale = Math.hypot(e[0], e[1], e[2]) * Math.hypot(e[4], e[5], e[6]) * Math.hypot(e[8], e[9], e[10]);@@ -25560,10 +25779,10 @@ function reverseWinding(prim) {}}function bake(prim, matrix) {- const linear = new THREE47.Matrix3().setFromMatrix4(matrix);- const normalMatrix = new THREE47.Matrix3().getNormalMatrix(matrix);+ const linear = new THREE48.Matrix3().setFromMatrix4(matrix);+ const normalMatrix = new THREE48.Matrix3().getNormalMatrix(matrix);const mirrored = matrix.determinant() < 0;- const v = new THREE47.Vector3;+ const v = new THREE48.Vector3;const each = (semantic, apply) => {const attribute = prim.getAttribute(semantic);const element = [];@@ -25587,7 +25806,7 @@ function destinationOf(entries) {let best = Infinity;let bestScale = Infinity;for (const { node } of entries) {- const linear = new THREE47.Matrix3().setFromMatrix4(worldOf(node));+ const linear = new THREE48.Matrix3().setFromMatrix4(worldOf(node));const norm = Math.hypot(...linear.elements);const inverseNorm = Math.hypot(...linear.clone().invert().elements);const condition = norm * inverseNorm;@@ -25601,9 +25820,9 @@ function destinationOf(entries) {return chosen;}function checkPositionPrecision(input, output, sourceWorld, destinationWorld, reversed) {- const expected = new THREE47.Vector3;- const actual = new THREE47.Vector3;- const bounds = new THREE47.Box3;+ const expected = new THREE48.Vector3;+ const actual = new THREE48.Vector3;+ const bounds = new THREE48.Box3;const element = [];let error = 0;let magnitude = 0;@@ -25924,7 +26143,7 @@ function rigidMerge(options = {}, onSummary) {onSummary?.(summary);});}-var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE47.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {+var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE48.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {const indices = prim.getIndices();return indices ? [...prim.listAttributes(), indices] : prim.listAttributes();}, primitiveBytes = (primitives) => [...new Set(primitives.flatMap(accessorsOf))].reduce((sum, a) => sum + (a.getArray()?.byteLength ?? 0), 0), countPrimitives = (nodes) => [...nodes].reduce((sum, node) => sum + (node.getMesh()?.listPrimitives().length ?? 0), 0);@@ -26096,6 +26315,63 @@ var init_geometry_catalog = __esm(() => {description: "Experimental positive-inside implicit field sampled into a solid mesh. Requires explicit bounds and resolution; checks grid size and actual evaluation count. Output has no UVs.",promptNotes: "Use async build and await. Smaller edgeLength increases cost sharply. This helper cannot stop a callback that never returns; the host evaluator process provides that boundary. Thin features and geometric accuracy require inspection.",example: "const blob = await implicitSurface(([x,y,z]) => 1-Math.hypot(x,y,z), { bounds: { min: [-1.2,-1.2,-1.2], max: [1.2,1.2,1.2] }, edgeLength: 0.15 });"+ },+ {+ name: "metaballSurface",+ signature: "await metaballSurface(spheres: { center: [x,y,z], radius }[], { bounds, edgeLength, blend?, maxCells?, maxEvaluations? })",+ returns: "Promise<THREE.BufferGeometry>",+ category: "geometry",+ description: "Experimental smooth union of spheres meshed through implicitSurface. Uses polynomial blending; output has no UVs.",+ promptNotes: "Prefer this over hand-rolling smoothUnion fields for creatures, blobs and rounded junctions. Match edgeLength to feature size.",+ example: "const body = await metaballSurface([{ center: [0,0.4,0], radius: 0.35 }, { center: [0.2,0.55,0], radius: 0.22 }], { bounds: { min: [-0.6,-0.1,-0.5], max: [0.6,1,0.5] }, edgeLength: 0.08 });"+ },+ {+ name: "taperedTube",+ signature: "taperedTube(path: [x,y,z][], radii: number[], opts?: { radialSegments?: 20, creaseAngle?: 180, cap?: true, closed?: false, up?, twist?, sectionScale?: [side,depth][] })",+ returns: "THREE.BufferGeometry",+ category: "curves",+ description: "Circular sweep with one radius per path station. Default creaseAngle 180 shades round profiles smoothly; sample splines with catmullRomPath first.",+ example: "const path = catmullRomPath([[0,0.5,0],[0.3,0.7,0],[0.5,0.4,0]], 6); const radii = path.map((_, i) => 0.08 - 0.06 * i / (path.length - 1)); const tail = taperedTube(path, radii);"+ },+ {+ name: "catmullRomPath",+ signature: "catmullRomPath(controlPoints: [x,y,z][], samplesPerSpan?: 8, closed?: false)",+ returns: "[x,y,z][]",+ category: "curves",+ description: "Samples a Catmull-Rom spline through waypoints. Open paths include both endpoints; closed paths omit the repeated endpoint for closed sweeps.",+ example: "const path = catmullRomPath([[0,0,0],[0.2,0.4,0.1],[0.5,0.2,0]], 10);"+ },+ {+ name: "spiralPath",+ signature: "spiralPath(opts: { center, radius, rise, turns, axis?, forward?, samples? })",+ returns: "[x,y,z][]",+ category: "curves",+ description: "Rising spiral for curled appendages, shrinking to 42% of the start radius. Returns samples + 1 stations; starts radius away from center.",+ example: "const curl = spiralPath({ center: [0,0.05,0], radius: 0.03, rise: 0.12, turns: 1.75, forward: [0,0,1] });"+ },+ {+ name: "smoothOrganic",+ signature: "smoothOrganic(geometry, opts?: { iterations?: 1, creaseAngle?: 55, preserveUV?: false })",+ returns: "THREE.BufferGeometry",+ category: "mesh-ops",+ description: "Runs subdivide then creaseNormals with organic-friendly defaults.",+ example: "const soft = smoothOrganic(tube, { iterations: 1, creaseAngle: 50 });"+ },+ {+ name: "smoothUnion",+ signature: "smoothUnion(a: number, b: number, blend: number)",+ returns: "number",+ category: "geometry",+ description: "Polynomial smooth maximum for positive-inside implicit fields. Compose inside implicitSurface callbacks.",+ example: "smoothUnion(sphereInside(p,[0,0,0],0.5), sphereInside(p,[0.3,0,0],0.4), 0.12)"+ },+ {+ name: "sphereInside",+ signature: "sphereInside(point: [x,y,z], center: [x,y,z], radius: number)",+ returns: "number",+ category: "geometry",+ description: "Positive-inside sphere field sample for implicitSurface. Returns radius minus distance to center.",+ example: "sphereInside(p, [0,0.4,0], 0.25)"}];});@@ -27567,7 +27843,7 @@ var init_kit = __esm(() => {// src/texture-bake.tsimport { createHash as createHash5 } from "node:crypto";-import * as THREE48 from "three";+import * as THREE49 from "three";function readPixels(texture) {const image = texture.image;if (!image)@@ -27694,7 +27970,7 @@ async function bakeSceneTextures(root, warnings) {mime: "image/png",bytes};- const colorSpace = entry.texture.colorSpace === THREE48.SRGBColorSpace ? "srgb" : "linear";+ const colorSpace = entry.texture.colorSpace === THREE49.SRGBColorSpace ? "srgb" : "linear";const recipe = entry.texture.userData["kilnProcedural"];const primaryUsage = atlasRecord?.spec.usage ?? recipe?.usage ?? (entry.bindings.some(({ slot }) => slot === "roughnessMap") && entry.bindings.some(({ slot }) => slot === "metalnessMap") ? "metallicRoughness" : entry.bindings[0]?.usage ?? "albedo");if (!encoded)@@ -27777,10 +28053,10 @@ function computeTangentBasis(geometry) {}}const out = new Float32Array(vertexCount * 4);- const n = new THREE48.Vector3;- const t = new THREE48.Vector3;- const tmp = new THREE48.Vector3;- const tmp2 = new THREE48.Vector3;+ const n = new THREE49.Vector3;+ const t = new THREE49.Vector3;+ const tmp = new THREE49.Vector3;+ const tmp2 = new THREE49.Vector3;for (let v = 0;v < vertexCount; v++) {n.set(normal.getX(v), normal.getY(v), normal.getZ(v));t.set(tan1[v * 3], tan1[v * 3 + 1], tan1[v * 3 + 2]);@@ -27800,7 +28076,7 @@ function computeTangentBasis(geometry) {out[v * 4 + 2] = tmp.z;out[v * 4 + 3] = w;}- geometry.setAttribute("tangent", new THREE48.BufferAttribute(out, 4));+ geometry.setAttribute("tangent", new THREE49.BufferAttribute(out, 4));}function ensureNormalMapTangents(root, warnings) {let count = 0;@@ -27918,7 +28194,7 @@ var init_exporter_node = __esm(() => {});// src/views/character.ts-import * as THREE49 from "three";+import * as THREE50 from "three";function rounded(value) {const result = Math.round(value * 1e9) / 1e9;return Object.is(result, -0) ? 0 : result;@@ -27960,9 +28236,9 @@ function buildCharacterDiagnosticDescriptor(root, findings = []) {const invalidPaths = new Set(invalidFindingNodePaths);const joints = evidence.map((joint) => {const relative = rootInverse.clone().multiply(joint.node.matrixWorld);- const position = new THREE49.Vector3().setFromMatrixPosition(relative);- const forward = new THREE49.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);- const bend = new THREE49.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);+ const position = new THREE50.Vector3().setFromMatrixPosition(relative);+ const forward = new THREE50.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);+ const bend = new THREE50.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);const chainId = chainIdFor(joint.descriptor, descriptorByRole);return {role: joint.descriptor.role,@@ -29225,7 +29501,7 @@ function prepareTriangleCoverage(ax, ay, bx, by, cx, cy, size) {}// src/views/raster.ts-import { Vector3 as Vector336 } from "three";+import { Vector3 as Vector337 } from "three";function orbitDir(azimuthDeg, elevationDeg) {const el = Math.min(MAX_ELEVATION_DEG, Math.max(MIN_ELEVATION_DEG, elevationDeg)) * Math.PI / 180;const az = azimuthDeg * Math.PI / 180;@@ -29249,7 +29525,7 @@ function updateSurfaceMatrices(root) {function surfaceVertexReader(mesh, position) {for (const bone of mesh.skeleton?.bones ?? [])bone.updateWorldMatrix?.(true, false);- const vertex = new Vector336;+ const vertex = new Vector337;if (mesh.getVertexPosition)return (index) => mesh.getVertexPosition(index, vertex);if (position.getX && position.getY && position.getZ)@@ -29526,7 +29802,7 @@ import {var init_scene_copy = () => {};// src/views/camera.ts-import { Vector3 as Vector337, Matrix4 as Matrix416, Euler as Euler5, Group as Group4 } from "three";+import { Vector3 as Vector338, Matrix4 as Matrix416, Euler as Euler5, Group as Group4 } from "three";function strict(value, keys, label) {for (const key of Object.keys(value))if (!keys.includes(key)) {@@ -29620,14 +29896,14 @@ function cameraFromBounds(bounds, dir, padding = 1, up, sceneBounds = bounds) {const z = vec(dir).normalize();if (!z.length())throw new Error("camera direction must be non-zero");- const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector337(0, 0, -1) : new Vector337(0, 1, 0);+ const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector338(0, 0, -1) : new Vector338(0, 1, 0);const x = hint.clone().cross(z).normalize();if (x.length() < 0.000000001)throw new Error("camera up must not be collinear with view");const y = z.clone().cross(x);let extent = 0.000001;for (let i = 0;i < 8; i++) {- const p = new Vector337((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);+ const p = new Vector338((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);extent = Math.max(extent, Math.abs(p.dot(x)), Math.abs(p.dot(y)));}const depthMin = bounds.min.map((v, i) => Math.min(v, sceneBounds.min[i]));@@ -29708,7 +29984,7 @@ function resolveAssetCamera(root, shot = {}) {if (relative !== "world") {const node = relative === "part" ? selected.node : rootNode;dir.transformDirection(node.matrixWorld);- up = tuple6(new Vector337(0, 1, 0).transformDirection(node.matrixWorld));+ up = tuple6(new Vector338(0, 1, 0).transformDirection(node.matrixWorld));}camera = cameraFromBounds(bounds, tuple6(dir), request.padding ?? 1.2, up, measureBounds(root));} else if (request.type === "explicit") {@@ -29755,7 +30031,7 @@ function resolveAssetCamera(root, shot = {}) {const position = vec(triple2(request.position, "position")).applyMatrix4(matrix);const target = request.target ? vec(triple2(request.target, "target")).applyMatrix4(matrix) : vec(bounds.min).add(vec(bounds.max)).multiplyScalar(0.5);const up = vec(triple2(request.up ?? [0, 1, 0], "up")).transformDirection(matrix);- const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector337().setFromMatrixPosition(matrix));+ const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector338().setFromMatrixPosition(matrix));const radius = vec(bounds.max).sub(vec(bounds.min)).length();camera = {version: "kiln.camera.v1",@@ -29868,11 +30144,11 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)}return result;};- const key = new Vector337(1.5, 2, 1).normalize();+ const key = new Vector338(1.5, 2, 1).normalize();const srgb = (n) => n <= 0.0031308 ? n * 12.92 : 1.055 * n ** (1 / 2.4) - 0.055;const ordered = compositingOrder(collectTriangles(root).tris, (px, py, pz) => camera.projection === "perspective" ? Math.hypot(px - position.x, py - position.y, pz - position.z) : (position.x - px) * z.x + (position.y - py) * z.y + (position.z - pz) * z.z);for (const tri of ordered) {- const world = [0, 1, 2].map((i) => new Vector337(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));+ const world = [0, 1, 2].map((i) => new Vector338(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));const normal = world[1].clone().sub(world[0]).cross(world[2].clone().sub(world[0])).normalize().multiplyScalar(tri.windingParity);const normalSign = visibleNormalSign(normal.dot(camera.projection === "perspective" ? position.clone().sub(world[0]) : z), tri.side, backfaceCull);if (normalSign === 0)@@ -29883,7 +30159,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)const color = tri.color.map((c) => Math.round(srgb(c * light) * 255));let polygon = world.map((p) => {const d = p.clone().sub(position);- return new Vector337(d.dot(x), d.dot(y), -d.dot(z));+ return new Vector338(d.dot(x), d.dot(y), -d.dot(z));});polygon = clip(clip(polygon, camera.near, true), camera.far, false);for (let t = 1;t < polygon.length - 1; t++) {@@ -29915,7 +30191,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)}return out;}-var vec = (a) => new Vector337(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;+var vec = (a) => new Vector338(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;var init_camera = __esm(() => {init_raster();init_background();@@ -30026,7 +30302,7 @@ import {PropertyBinding as PropertyBinding3,VectorKeyframeTrack as VectorKeyframeTrack2,Quaternion as Quaternion19,- Vector3 as Vector338,+ Vector3 as Vector339,InterpolateDiscrete as InterpolateDiscrete2,InterpolateLinear as InterpolateLinear2} from "three";@@ -30056,6 +30332,9 @@ var init_glb = __esm(() => {];});+// src/atomic-directory.ts+var init_atomic_directory = () => {};+// src/material-authoring-schema.tsimport { z as z4 } from "zod";function makeMaterialAuthoringSchemas(legacyV2Schema, canonicalLegacyV2Schema = canonicalLegacyV2FieldSchema) {@@ -30485,7 +30764,7 @@ function validateMaterialRecordShapeAny(record) {}return manifest;}-var MATERIAL_LIBRARY_LIMITS, MATERIAL_LIBRARY_SLOTS, MATERIAL_LIBRARY_USAGE, slotNames, materialLibraryIdSchema, materialLibraryHashSchema, text3, url, materialSourceSchema, materialTransformSchema, color2, count3, layerCommon, materialProceduralSpecSchema, materialNormalDerivationSchema, proceduralSchema, parametersSchema, materialManifestSchema, proceduralMaterialDraftSchema, materialLibraryPayloadSchema, authoringSchemas, samplerSchema, v3SpecSchema, atlasSpecSchema, atlasManifestSchema, materialMapPinSchema, materialRecipeV2Schema, materialManifestV2Schema, materialManifestAnySchema, materialLibraryPayloadV2Schema, materialLibraryPayloadAnySchema, proceduralMaterialDraftV2Schema, proceduralMaterialDraftAnySchema;+var MATERIAL_LIBRARY_LIMITS, MATERIAL_LIBRARY_SLOTS, MATERIAL_LIBRARY_USAGE, slotNames, materialLibraryIdSchema, materialLibraryHashSchema, text3, url, materialSourceSchema, materialTransformSchema, color2, count4, layerCommon, materialProceduralSpecSchema, materialNormalDerivationSchema, proceduralSchema, parametersSchema, materialManifestSchema, proceduralMaterialDraftSchema, materialLibraryPayloadSchema, authoringSchemas, samplerSchema, v3SpecSchema, atlasSpecSchema, atlasManifestSchema, materialMapPinSchema, materialRecipeV2Schema, materialManifestV2Schema, materialManifestAnySchema, materialLibraryPayloadV2Schema, materialLibraryPayloadAnySchema, proceduralMaterialDraftV2Schema, proceduralMaterialDraftAnySchema;var init_material_library = __esm(() => {init_procedural_material_v2();init_procedural_texture_v3_contract();@@ -30557,7 +30836,7 @@ var init_material_library = __esm(() => {parameters: z5.record(z5.string().max(100), z5.union([z5.string().max(2000), z5.number().finite(), z5.boolean()])).optional()}).strict();color2 = z5.number().int().min(0).max(16777215);- count3 = z5.number().int().min(1).max(256);+ count4 = z5.number().int().min(1).max(256);layerCommon = {blend: z5.enum(["normal", "multiply", "screen", "overlay"]).default("normal"),opacity: z5.number().min(0).max(1).default(1)@@ -30581,14 +30860,14 @@ var init_material_library = __esm(() => {op: z5.literal("checker"),colorA: color2,colorB: color2,- squares: count3.default(8),+ squares: count4.default(8),...layerCommon}).strict(),z5.object({op: z5.literal("stripes"),colorA: color2,colorB: color2,- count: count3.default(8),+ count: count4.default(8),angleDeg: z5.number().min(-36000).max(36000).default(0),...layerCommon}).strict(),@@ -30603,8 +30882,8 @@ var init_material_library = __esm(() => {op: z5.literal("bricks"),brick: color2,mortar: color2,- rows: count3.default(8),- cols: count3.default(4),+ rows: count4.default(8),+ cols: count4.default(4),mortarWidth: z5.number().min(0).max(1).default(0.06),stagger: z5.number().min(0).max(1).default(0.5),...layerCommon@@ -30613,7 +30892,7 @@ var init_material_library = __esm(() => {op: z5.literal("noise"),colorA: color2,colorB: color2,- scale: count3.default(8),+ scale: count4.default(8),octaves: z5.number().int().min(1).max(6).default(3),seed: z5.number().int().min(-2147483648).max(2147483647).default(0),...layerCommon@@ -31324,6 +31603,7 @@ async function decodeMaterialLibraryPayload(value) {}var digest = (bytes) => `sha256:${createHash6("sha256").update(bytes).digest("hex")}`, encoder, identity = (manifest) => `${manifest.materialId}/${manifest.revisionId}`;var init_material_library_node = __esm(() => {+ init_atomic_directory();init_material_library();init_portable_sampler();init_portable_sampler_runtime();@@ -31456,6 +31736,7 @@ var init_protocol = __esm(() => {init_material_library_node();init_material_library();init_rebuild_options();+ init_solid_diagnostic();MAX_EVALUATOR_CODE_BYTES = 512 * 1024;MAX_EVALUATOR_REQUEST_BYTES = 24 * 1024 * 1024;DEFAULT_EVALUATOR_MAX_GLB_BYTES = 16 * 1024 * 1024;@@ -31474,10 +31755,12 @@ var init_protocol = __esm(() => {EvaluatorPortError = class EvaluatorPortError extends Error {code;diagnostic;- constructor(code, message = evaluatorOutcomeMessage(code), diagnostic) {- super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);+ solid;+ constructor(code, message = evaluatorOutcomeMessage(code), diagnostic, solid) {+ super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}${solidFailureAdvice(solid)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);this.code = code;this.diagnostic = diagnostic;+ this.solid = solid;this.name = "EvaluatorPortError";}};@@ -31487,6 +31770,7 @@ var init_protocol = __esm(() => {var DEFAULT_MAX_GLB_BYTES, DEFAULT_MAX_RESPONSE_BYTES, MAX_STDERR_BYTES;var init_subprocess = __esm(() => {init_authoring_diagnostic();+ init_solid_diagnostic();init_run();init_requirements_context();init_material_library_node();@@ -31533,7 +31817,7 @@ var init_renderer_id = __esm(() => {});// src/views/scene-raster.ts-import * as THREE50 from "three";+import * as THREE51 from "three";var DEG2;var init_scene_raster = __esm(() => {init_evaluator();@@ -31545,18 +31829,18 @@ var init_scene_raster = __esm(() => {});// src/views/vehicle.ts-import * as THREE51 from "three";+import * as THREE52 from "three";function hasRole2(node, prefix) {return readSemanticMetadataV1(node)?.roles.some((role) => role === prefix || role.startsWith(`${prefix}.`)) ?? false;}function chassisBounds(root, inverse) {- const bounds = new THREE51.Box3;+ const bounds = new THREE52.Box3;let found = false;root.traverse((node) => {if (!hasRole2(node, "chassis"))return;node.traverse((part) => {- if (!(part instanceof THREE51.Mesh) || !(part.geometry instanceof THREE51.BufferGeometry))+ if (!(part instanceof THREE52.Mesh) || !(part.geometry instanceof THREE52.BufferGeometry))return;part.geometry.computeBoundingBox();const box = part.geometry.boundingBox;@@ -31566,7 +31850,7 @@ function chassisBounds(root, inverse) {for (const x of [box.min.x, box.max.x])for (const y of [box.min.y, box.max.y])for (const z of [box.min.z, box.max.z]) {- bounds.expandByPoint(new THREE51.Vector3(x, y, z).applyMatrix4(matrix));+ bounds.expandByPoint(new THREE52.Vector3(x, y, z).applyMatrix4(matrix));found = true;}});@@ -31634,33 +31918,33 @@ function tagDiagnostic(node, role) {stampSemanticMetadataV1(node, { roles: [role] });}function rod(name, start, end, radius, color, role) {- const from = new THREE51.Vector3(...start);- const to = new THREE51.Vector3(...end);+ const from = new THREE52.Vector3(...start);+ const to = new THREE52.Vector3(...end);const direction = to.clone().sub(from);const length = direction.length();- const geometry = length > 0.000000001 ? new THREE51.CylinderGeometry(radius, radius, length, 8) : new THREE51.SphereGeometry(radius, 8, 6);- const result = new THREE51.Mesh(geometry, new THREE51.MeshBasicMaterial({ color }));+ const geometry = length > 0.000000001 ? new THREE52.CylinderGeometry(radius, radius, length, 8) : new THREE52.SphereGeometry(radius, 8, 6);+ const result = new THREE52.Mesh(geometry, new THREE52.MeshBasicMaterial({ color }));result.name = name;result.position.copy(from).add(to).multiplyScalar(0.5);if (length > 0.000000001) {- result.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));+ result.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));}tagDiagnostic(result, role);return result;}function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnostics(root)) {- const overlay = new THREE51.Group;+ const overlay = new THREE52.Group;overlay.name = "VehicleDiagnosticOverlay";const chassisSpan = descriptor.chassisBox ? Math.max(descriptor.chassisBox.max[0] - descriptor.chassisBox.min[0], descriptor.chassisBox.max[1] - descriptor.chassisBox.min[1], descriptor.chassisBox.max[2] - descriptor.chassisBox.min[2]) : 1;const thickness = Math.max(0.01, chassisSpan * 0.008);- const arrow = new THREE51.Group;+ const arrow = new THREE52.Group;arrow.name = "Diagnostic_Forward_+X";tagDiagnostic(arrow, "diagnostic.vehicle.forward");arrow.add(rod("Diagnostic_Forward_Shaft", descriptor.forwardArrow.start, [descriptor.forwardArrow.end[0] - 0.12, 0, 0], thickness, 16724804, "diagnostic.vehicle.forward"));- const arrowHead = new THREE51.Mesh(new THREE51.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE51.MeshBasicMaterial({ color: 16724804 }));+ const arrowHead = new THREE52.Mesh(new THREE52.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE52.MeshBasicMaterial({ color: 16724804 }));arrowHead.name = "Diagnostic_Forward_Head";arrowHead.position.set(descriptor.forwardArrow.end[0] - 0.12, 0, 0);- arrowHead.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 1, 0), new THREE51.Vector3(1, 0, 0));+ arrowHead.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 1, 0), new THREE52.Vector3(1, 0, 0));tagDiagnostic(arrowHead, "diagnostic.vehicle.forward");arrow.add(arrowHead);overlay.add(arrow);@@ -31668,18 +31952,18 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnooverlay.add(rod(`Diagnostic_Axle_${axle.id}`, axle.start, axle.end, thickness, 3386111, `diagnostic.vehicle.axle.${axle.id}`));}for (const wheel of descriptor.wheels) {- const ring = new THREE51.Mesh(new THREE51.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE51.MeshBasicMaterial({ color: 16763955 }));+ const ring = new THREE52.Mesh(new THREE52.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE52.MeshBasicMaterial({ color: 16763955 }));ring.name = `Diagnostic_Wheel_${wheel.id}`;ring.position.set(...wheel.center);- const axle = new THREE51.Vector3(...wheel.axle);+ const axle = new THREE52.Vector3(...wheel.axle);if (axle.lengthSq() > 0.000000000001) {- ring.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 0, 1), axle.normalize());+ ring.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 0, 1), axle.normalize());}tagDiagnostic(ring, `diagnostic.vehicle.wheel.${wheel.id}`);overlay.add(ring);}if (descriptor.chassisBox) {- const chassis = new THREE51.Group;+ const chassis = new THREE52.Group;chassis.name = "Diagnostic_ChassisBox";tagDiagnostic(chassis, "diagnostic.vehicle.chassis");const { min, max } = descriptor.chassisBox;@@ -31713,7 +31997,7 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnooverlay.add(chassis);}if (descriptor.supportPlaneY !== undefined) {- const plane = new THREE51.Group;+ const plane = new THREE52.Group;plane.name = "Diagnostic_SupportPlane";tagDiagnostic(plane, "diagnostic.vehicle.support-plane");const halfX = Math.max(1, ...descriptor.chassisBox ? [Math.abs(descriptor.chassisBox.min[0]), Math.abs(descriptor.chassisBox.max[0])] : [], ...descriptor.wheels.map((wheel) => Math.abs(wheel.center[0]) + wheel.radius)) + 0.2;@@ -32042,7 +32326,7 @@ var init_views = __esm(() => {});// src/views/character-capture.ts-import * as THREE52 from "three";+import * as THREE53 from "three";function drawLine2(rgb, width, height, from, to, color) {let x0 = Math.round(from[0]);let y0 = Math.round(from[1]);@@ -32079,22 +32363,22 @@ function drawCross(rgb, width, height, point, color, radius = 3) {}function projector(root, cameraId, size) {root.updateMatrixWorld(true);- const bounds = new THREE52.Box3().setFromObject(root);+ const bounds = new THREE53.Box3().setFromObject(root);if (bounds.isEmpty())- bounds.set(new THREE52.Vector3(-0.5, 0, -0.5), new THREE52.Vector3(0.5, 1, 0.5));- const center = bounds.getCenter(new THREE52.Vector3);- const camera = cameraId === "front" ? new THREE52.Vector3(1, 0, 0) : new THREE52.Vector3(0, 0, 1);- const upHint = new THREE52.Vector3(0, 1, 0);- const xAxis = new THREE52.Vector3().crossVectors(upHint, camera).normalize();- const yAxis = new THREE52.Vector3().crossVectors(camera, xAxis).normalize();+ bounds.set(new THREE53.Vector3(-0.5, 0, -0.5), new THREE53.Vector3(0.5, 1, 0.5));+ const center = bounds.getCenter(new THREE53.Vector3);+ const camera = cameraId === "front" ? new THREE53.Vector3(1, 0, 0) : new THREE53.Vector3(0, 0, 1);+ const upHint = new THREE53.Vector3(0, 1, 0);+ const xAxis = new THREE53.Vector3().crossVectors(upHint, camera).normalize();+ const yAxis = new THREE53.Vector3().crossVectors(camera, xAxis).normalize();let extent = 0.000001;for (let corner = 0;corner < 8; corner++) {- const point = new THREE52.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);+ const point = new THREE53.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);extent = Math.max(extent, Math.abs(point.dot(xAxis)), Math.abs(point.dot(yAxis)));}const scale = size * 0.45 / extent;return (assetPoint) => {- const world = new THREE52.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);+ const world = new THREE53.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);return [size / 2 + world.dot(xAxis) * scale, size / 2 - world.dot(yAxis) * scale];};}@@ -32220,7 +32504,7 @@ var init_character_capture = __esm(() => {});// src/render.ts-import * as THREE53 from "three";+import * as THREE54 from "three";import { Document, Logger } from "@gltf-transform/core";import { KHRMaterialsEmissiveStrength } from "@gltf-transform/extensions";import { dedup, instance, palette, weld as weld2, prune, mergeDocuments } from "@gltf-transform/functions";@@ -32440,7 +32724,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)} else if (stdMat.transparent) {mat.setAlphaMode("BLEND");}- if (stdMat.side === THREE53.DoubleSide) {+ if (stdMat.side === THREE54.DoubleSide) {mat.setDoubleSided(true);}if (stdMat.map) {@@ -32517,7 +32801,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)} else if (common.transparent || (common.opacity ?? 1) < 1) {mat.setAlphaMode("BLEND");}- if (threeMat.side === THREE53.DoubleSide)+ if (threeMat.side === THREE54.DoubleSide)mat.setDoubleSided(true);if (common.map && !mat.getBaseColorTexture()) {const texture = bridgeTexture(doc, common.map, textureCache);@@ -32667,7 +32951,7 @@ function bridgeNode(doc, buf, threeObj, matCache, nodeMap, meshCache, texCache,const cacheKey = `kiln-sprite-quad:${centerX}:${centerY}:${rotation}__${threeMat.uuid}`;let gtMesh = meshCache.get(cacheKey);if (!gtMesh) {- const geometry = new THREE53.PlaneGeometry(1, 1);+ const geometry = new THREE54.PlaneGeometry(1, 1);if (centerX !== 0.5 || centerY !== 0.5) {geometry.translate(0.5 - centerX, 0.5 - centerY, 0);}@@ -32691,9 +32975,9 @@ function animationInterpolation(track) {if (isCubicSplineTrack(track))return "CUBICSPLINE";const mode = track.getInterpolation();- if (mode === THREE53.InterpolateDiscrete)+ if (mode === THREE54.InterpolateDiscrete)return "STEP";- if (mode === THREE53.InterpolateLinear)+ if (mode === THREE54.InterpolateLinear)return "LINEAR";throw new Error(`Unsupported animation interpolation on ${track.name}; use LINEAR, STEP or CUBICSPLINE.`);}@@ -33253,8 +33537,8 @@ function collectMeshStats(root) {if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {return;}- const center = new THREE53.Vector3;- const size = new THREE53.Vector3;+ const center = new THREE54.Vector3;+ const size = new THREE54.Vector3;box.getCenter(center);box.getSize(size);out.push({@@ -33269,7 +33553,7 @@ function collectMeshStats(root) {return out;}function minimalGapVector(a, b) {- const v = new THREE53.Vector3;+ const v = new THREE54.Vector3;for (const axis of ["x", "y", "z"]) {if (a.min[axis] > b.max[axis])v[axis] = b.max[axis] - a.min[axis];@@ -33287,10 +33571,10 @@ function inspectSceneStructure(root, opts = {}) {return warnings;const cat = opts.category?.toLowerCase();if (cat === "vehicle" || cat === "weapon" || cat === "boat" || cat === "aircraft") {- const all = new THREE53.Box3;+ const all = new THREE54.Box3;for (const m of meshes)all.union(m.box);- const size = new THREE53.Vector3;+ const size = new THREE54.Vector3;all.getSize(size);if (cat === "aircraft") {if (size.y > size.x * 1.2) {@@ -33400,18 +33684,18 @@ var init_render = __esm(() => {init_texture_bake();engineIO = createGltfIO;GLTF_MIN_FILTER = {- [THREE53.NearestFilter]: 9728,- [THREE53.LinearFilter]: 9729,- [THREE53.NearestMipmapNearestFilter]: 9984,- [THREE53.LinearMipmapNearestFilter]: 9985,- [THREE53.NearestMipmapLinearFilter]: 9986,- [THREE53.LinearMipmapLinearFilter]: 9987- };- GLTF_MAG_FILTER = { [THREE53.NearestFilter]: 9728, [THREE53.LinearFilter]: 9729 };+ [THREE54.NearestFilter]: 9728,+ [THREE54.LinearFilter]: 9729,+ [THREE54.NearestMipmapNearestFilter]: 9984,+ [THREE54.LinearMipmapNearestFilter]: 9985,+ [THREE54.NearestMipmapLinearFilter]: 9986,+ [THREE54.LinearMipmapLinearFilter]: 9987+ };+ GLTF_MAG_FILTER = { [THREE54.NearestFilter]: 9728, [THREE54.LinearFilter]: 9729 };GLTF_WRAP = {- [THREE53.ClampToEdgeWrapping]: 33071,- [THREE53.MirroredRepeatWrapping]: 33648,- [THREE53.RepeatWrapping]: 10497+ [THREE54.ClampToEdgeWrapping]: 33071,+ [THREE54.MirroredRepeatWrapping]: 33648,+ [THREE54.RepeatWrapping]: 10497};REVIEW_CLIP_LIMITS = {clips: 32,@@ -33422,7 +33706,7 @@ var init_render = __esm(() => {});// src/evaluator/handler.ts-function failure(requestId, code, diagnostic, qa) {+function failure(requestId, code, diagnostic, qa, solid) {return {version: EVALUATOR_RESULT_VERSION,requestId,@@ -33431,7 +33715,8 @@ function failure(requestId, code, diagnostic, qa) {code,message: evaluatorOutcomeMessage(code),...qa ? { qa } : {},- ...diagnostic ? { diagnostic } : {}+ ...diagnostic ? { diagnostic } : {},+ ...solid ? { solid } : {}}};}@@ -33482,7 +33767,7 @@ async function evaluateEvaluatorRequestV2(requestJson, dependencies = {}, contro} else if (error instanceof EvaluatorPortError && error.code === "DEADLINE_EXCEEDED") {wire = failure(request.requestId, "DEADLINE_EXCEEDED");} else {- wire = failure(request.requestId, "EXECUTION_REJECTED", programErrorDiagnostic(error));+ wire = failure(request.requestId, "EXECUTION_REJECTED", programErrorDiagnostic(error), undefined, error instanceof RequiredSolidError && validSolidFailureDetails(error.solid) ? error.solid : undefined);}} finally {clearTimeout(timer);@@ -33495,6 +33780,7 @@ async function evaluateEvaluatorRequestV2(requestJson, dependencies = {}, contro}var init_handler = __esm(() => {init_authoring_diagnostic();+ init_solid_diagnostic();init_render();init_run();init_protocol();diff --git a/dist/mcp-engine.mjs b/dist/mcp-engine.mjsindex 8a961e08..cd19911f 100644--- a/dist/mcp-engine.mjs+++ b/dist/mcp-engine.mjs@@ -2444,6 +2444,32 @@ var init_assets = __esm(() => {allowedFiles = new Set(["asset.glb", "source.kiln.js", "preview.png"]);});+// src/atomic-directory.ts+import { lstat, rename } from "node:fs/promises";+import { setTimeout as pause } from "node:timers/promises";+async function renameDirectoryAtomically(source, destination, controls = {}) {+ const renameOperation = controls.renameOperation ?? rename;+ const platform = controls.platform ?? process.platform;+ const wait = controls.pause ?? pause;+ const delays = [20, 50, 100, 200, 400];+ for (let attempt = 0;; attempt++) {+ try {+ await renameOperation(source, destination);+ return;+ } catch (error) {+ const delay = delays[attempt];+ const code = error?.code;+ if (platform !== "win32" || delay === undefined || !["EPERM", "EACCES", "EBUSY"].includes(code ?? ""))+ throw error;+ const absent = await lstat(destination).then(() => false, (statError) => statError.code === "ENOENT");+ if (!absent)+ throw error;+ await wait(delay);+ }+ }+}+var init_atomic_directory = () => {};+// src/portable-sampler-runtime.tsimport {ClampToEdgeWrapping,@@ -5793,7 +5819,7 @@ var init_procedural_material_v3 = __esm(() => {// src/material-library-node.tsimport { createHash as createHash2, randomUUID } from "node:crypto";-import { lstat, mkdir, readFile, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";+import { lstat as lstat2, mkdir, readFile, readdir, realpath, rm, writeFile } from "node:fs/promises";import { dirname as dirname2, join as join2, relative, resolve as resolve2, sep } from "node:path";import sharp from "sharp";import { DataTexture as DataTexture3 } from "three";@@ -6106,7 +6132,7 @@ class FileMaterialLibrary {throw new Error("Invalid material path identity");current = join2(current, part);try {- const stat = await lstat(current);+ const stat = await lstat2(current);if (stat.isSymbolicLink() || !stat.isDirectory())throw new Error("Material library requires real directories");const rel = relative(canonical, await realpath(current));@@ -6121,7 +6147,7 @@ class FileMaterialLibrary {}async file(dir, name, limit) {const path = join2(dir, name);- const stat = await lstat(path);+ const stat = await lstat2(path);if (!stat.isFile() || stat.isSymbolicLink() || stat.size > limit)throw new Error("Invalid material library file");return new Uint8Array(await readFile(path));@@ -6210,7 +6236,7 @@ class FileMaterialLibrary {flag: "wx"});try {- await rename(stage, dest);+ await renameDirectoryAtomically(stage, dest);} catch (error) {const existing = await this.read(manifest.materialId, manifest.revisionId).catch(() => {return;@@ -6733,6 +6759,7 @@ async function createMaterialRecordV2(draft, options) {}var digest = (bytes) => `sha256:${createHash2("sha256").update(bytes).digest("hex")}`, encoder, identity = (manifest) => `${manifest.materialId}/${manifest.revisionId}`;var init_material_library_node = __esm(() => {+ init_atomic_directory();init_material_library();init_portable_sampler();init_portable_sampler_runtime();@@ -9155,6 +9182,41 @@ var init_assets_resources = __esm(() => {};});+// src/evaluator/solid-diagnostic.ts+function validSolidFailureDetails(value) {+ if (!record5(value) || !keys(value, ["total", "truncated", "meshes"]) || !count2(value.total) || value.total < 1 || !Array.isArray(value.meshes) || value.meshes.length !== Math.min(value.total, MAX_SOLID_FAILURE_MESHES) || value.truncated !== value.total > value.meshes.length)+ return false;+ return value.meshes.every((mesh) => record5(mesh) && keys(mesh, [+ "childPath",+ "closed",+ "manifold",+ "orientation",+ "boundaryEdges",+ "nonManifoldEdges",+ "orientationConflicts"+ ]) && (mesh.childPath === null || Array.isArray(mesh.childPath) && mesh.childPath.length <= MAX_SOLID_FAILURE_PATH && mesh.childPath.every(count2)) && typeof mesh.closed === "boolean" && typeof mesh.manifold === "boolean" && typeof mesh.orientation === "string" && ["outward", "inward", "mixed"].includes(mesh.orientation) && count2(mesh.boundaryEdges) && count2(mesh.nonManifoldEdges) && count2(mesh.orientationConflicts));+}+function solidFailureAdvice(value) {+ if (!value || !validSolidFailureDetails(value))+ return "";+ const rows = value.meshes.map((mesh) => {+ const locator = mesh.childPath === null ? "mesh beyond the 64-level locator limit" : `root${mesh.childPath.map((index) => `.children[${index}]`).join("")}`;+ return `${locator}: closed=${mesh.closed}, manifold=${mesh.manifold}, orientation=${mesh.orientation}, boundaryEdges=${mesh.boundaryEdges}, nonManifoldEdges=${mesh.nonManifoldEdges}, orientationConflicts=${mesh.orientationConflicts}`;+ });+ return ` Required solid measurements (${value.meshes.length} of ${value.total} failing meshes): ${rows.join("; ")}. Child indices locate nodes in the authored build root before export; names are not forwarded. Read the retained source and check that node's geometryDiagnostics().solid.`;+}+var MAX_SOLID_FAILURE_MESHES = 4, MAX_SOLID_FAILURE_PATH = 64, RequiredSolidError, record5 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), keys = (value, names) => Object.keys(value).length === names.length && names.every((name) => Object.hasOwn(value, name)), count2 = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;+var init_solid_diagnostic = __esm(() => {+ init_authoring_diagnostic();+ RequiredSolidError = class RequiredSolidError extends AuthoringDiagnosticError {+ solid;+ constructor(solid, message) {+ super("REQUIRE_SOLID", message);+ this.solid = solid;+ }+ };+});+// src/qa/registry.tsimport { createHash as createHash8 } from "node:crypto";function canonicalCalibrationReportEvidence(report) {@@ -18304,14 +18366,14 @@ var init_environment2 = __esm(() => {// src/qa/breadth.tsfunction validModularJoinObservation(value) {- if (!record5(value))+ if (!record6(value))return false;return typeof value.aSocketId === "string" && value.aSocketId.length > 0 && typeof value.bSocketId === "string" && value.bSocketId.length > 0 && finiteTuple2(value.aWorldPosition, 3) && finiteTuple2(value.bWorldPosition, 3) && finiteTuple2(value.aWorldNormal, 3) && finiteTuple2(value.bWorldNormal, 3) && typeof value.relativeRotationDegrees === "number" && Number.isFinite(value.relativeRotationDegrees) && (value.toleranceMeters === undefined || typeof value.toleranceMeters === "number" && Number.isFinite(value.toleranceMeters) && value.toleranceMeters >= 0) && (value.normalToleranceDegrees === undefined || typeof value.normalToleranceDegrees === "number" && Number.isFinite(value.normalToleranceDegrees) && value.normalToleranceDegrees >= 0);}function validVfxArtifactEvidence(value) {- if (!record5(value) || value.schemaVersion !== 1)+ if (!record6(value) || value.schemaVersion !== 1)return false;- if (!record5(value.facing) || !record5(value.animation))+ if (!record6(value.facing) || !record6(value.animation))return false;if (!Array.isArray(value.materials))return false;@@ -18319,10 +18381,10 @@ function validVfxArtifactEvidence(value) {return false;if (!value.uniforms.every((name) => typeof name === "string" && name.length > 0))return false;- if (!value.clips.every((clip) => record5(clip) && typeof clip.name === "string" && clip.name.length > 0 && typeof clip.durationSeconds === "number" && Number.isFinite(clip.durationSeconds) && clip.durationSeconds >= 0)) {+ if (!value.clips.every((clip) => record6(clip) && typeof clip.name === "string" && clip.name.length > 0 && typeof clip.durationSeconds === "number" && Number.isFinite(clip.durationSeconds) && clip.durationSeconds >= 0)) {return false;}- return value.materials.every((material) => record5(material) && typeof material.id === "string" && material.id.length > 0 && ["card", "beam", "trail", "volume", "core"].includes(String(material.surfaceRole)) && ["opaque", "mask", "blend"].includes(String(material.alphaMode)) && (material.effectSurface === undefined || typeof material.effectSurface === "boolean") && typeof material.alphaData === "boolean" && typeof material.doubleSided === "boolean" && typeof material.screenAreaRatio === "number" && Number.isFinite(material.screenAreaRatio) && material.screenAreaRatio >= 0 && typeof material.transparentLayers === "number" && Number.isInteger(material.transparentLayers) && material.transparentLayers >= 0 && typeof material.textureMemoryBytes === "number" && Number.isInteger(material.textureMemoryBytes) && material.textureMemoryBytes >= 0);+ return value.materials.every((material) => record6(material) && typeof material.id === "string" && material.id.length > 0 && ["card", "beam", "trail", "volume", "core"].includes(String(material.surfaceRole)) && ["opaque", "mask", "blend"].includes(String(material.alphaMode)) && (material.effectSurface === undefined || typeof material.effectSurface === "boolean") && typeof material.alphaData === "boolean" && typeof material.doubleSided === "boolean" && typeof material.screenAreaRatio === "number" && Number.isFinite(material.screenAreaRatio) && material.screenAreaRatio >= 0 && typeof material.transparentLayers === "number" && Number.isInteger(material.transparentLayers) && material.transparentLayers >= 0 && typeof material.textureMemoryBytes === "number" && Number.isInteger(material.textureMemoryBytes) && material.textureMemoryBytes >= 0);}function artifactEvidence(context) {if (context.derivedEvidence?.source !== "engine-scene-analysis")@@ -18669,7 +18731,7 @@ function inspectAssetScope(context) {if (!scope)return [];const scopeObservation = context.derivedEvidence?.assetScope;- if (context.derivedEvidence?.source !== "engine-scene-analysis" || !record5(scopeObservation) || typeof scopeObservation.topLevelAssetRoots !== "number" || typeof scopeObservation.reusableMemberCount !== "number" || !Array.isArray(scopeObservation.sceneDressingRoles)) {+ if (context.derivedEvidence?.source !== "engine-scene-analysis" || !record6(scopeObservation) || typeof scopeObservation.topLevelAssetRoots !== "number" || typeof scopeObservation.reusableMemberCount !== "number" || !Array.isArray(scopeObservation.sceneDressingRoles)) {return [];}const result = assessAssetScopeV1(scope, scopeObservation);@@ -18730,7 +18792,7 @@ function evaluateAssetScopeQa(context) {derivedEvidence: context.derivedEvidence});}-var record5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), stable6 = (value) => Math.round(value * 1e6) / 1e6, finiteTuple2 = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), VFX_EXACT_QA_RULE, VFX_ADVISORY_QA_RULE, MODULAR_JOIN_QA_RULE, ASSET_SCOPE_QA_RULE, W7_BREADTH_QA_RULES;+var record6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), stable6 = (value) => Math.round(value * 1e6) / 1e6, finiteTuple2 = (value, length) => Array.isArray(value) && value.length === length && value.every((component) => typeof component === "number" && Number.isFinite(component)), VFX_EXACT_QA_RULE, VFX_ADVISORY_QA_RULE, MODULAR_JOIN_QA_RULE, ASSET_SCOPE_QA_RULE, W7_BREADTH_QA_RULES;var init_breadth2 = __esm(() => {init_breadth();init_registry();@@ -18782,7 +18844,7 @@ var init_breadth2 = __esm(() => {// src/qa/breadth-evidence.tsimport * as THREE26 from "three";-function record6(value) {+function record7(value) {return typeof value === "object" && value !== null && !Array.isArray(value);}function isMeshNode(value) {@@ -18792,10 +18854,10 @@ function isSpriteNode(value) {return value.isSprite === true;}function isTexture(value) {- return record6(value) && value.isTexture === true;+ return record7(value) && value.isTexture === true;}function isAnimationClip(value) {- return record6(value) && typeof value.name === "string" && typeof value.duration === "number" && Number.isFinite(value.duration) && Array.isArray(value.tracks);+ return record7(value) && typeof value.name === "string" && typeof value.duration === "number" && Number.isFinite(value.duration) && Array.isArray(value.tracks);}function localRenderableBox(rootInverse, node) {if (isSpriteNode(node)) {@@ -19059,7 +19121,7 @@ function shaderUniforms(materials) {const values = new Set;for (const material of materials) {const uniforms = material.uniforms;- if (record6(uniforms))+ if (record7(uniforms))for (const key of Object.keys(uniforms))values.add(key);}@@ -19641,14 +19703,14 @@ function createAssetRequirementsV1(input = {}) {...input});}-var text2, positive2, nonnegative, count2, names, marker, roof, structure, effects, requirements, AssetRequirementsV1Schema;+var text2, positive2, nonnegative, count3, names, marker, roof, structure, effects, requirements, AssetRequirementsV1Schema;var init_requirements = __esm(() => {init_asset();init_breadth();text2 = z5.string().refine((value) => value.trim().length > 0, { message: "Must be non-empty." });positive2 = z5.number().finite().positive();nonnegative = z5.number().finite().nonnegative();- count2 = z5.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);+ count3 = z5.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);names = z5.array(text2).refine((values) => new Set(values).size === values.length, {message: "Values must be unique."});@@ -19664,7 +19726,7 @@ var init_requirements = __esm(() => {structure = z5.strictObject({subtype: text2.optional(),enterable: z5.boolean().optional(),- storeyCount: count2.min(1).optional(),+ storeyCount: count3.min(1).optional(),interiorMode: z5.enum(ARCHITECTURE_INTERIOR_MODES).optional(),roofMode: z5.enum(ARCHITECTURE_ROOF_MODES).optional(),footprint: z5.strictObject({ spanX: positive2, spanZ: positive2, units: z5.literal("m") }).optional(),@@ -19712,8 +19774,8 @@ var init_requirements = __esm(() => {supportAssemblies: names.optional(),propulsionAssemblies: names.optional(),frontFrame: z5.literal("+X").optional(),- wheelCount: count2.optional(),- axleCount: count2.optional(),+ wheelCount: count3.optional(),+ axleCount: count3.optional(),steering: z5.enum(VEHICLE_STEERING_ARRANGEMENTS).optional(),supportPolicy: z5.enum(VEHICLE_SUPPORT_POLICIES).optional(),animationAssemblies: names.optional()@@ -20243,7 +20305,7 @@ function validateRequirementsQaReport(input, context) {const fail = () => {throw new TypeError("Invalid neutral requirements QA report.");};- if (!record7(input) || input.kind !== "kiln.asset-qa-report" || input.schemaVersion !== 2 || input.qaProfile !== "asset.requirements.v1" || !/^sha256:[a-f0-9]{64}$/.test(String(input.policyHash)) || !/^sha256:[a-f0-9]{64}$/.test(String(input.adviceHash)) || !["accepted", "incomplete", "blocked"].includes(String(input.acceptance)) || !["pass", "warn", "block", "notEvaluated"].includes(String(input.disposition)) || !record7(input.dimensions) || !Array.isArray(input.rules) || !Array.isArray(input.unevaluatedRequirements))+ if (!record8(input) || input.kind !== "kiln.asset-qa-report" || input.schemaVersion !== 2 || input.qaProfile !== "asset.requirements.v1" || !/^sha256:[a-f0-9]{64}$/.test(String(input.policyHash)) || !/^sha256:[a-f0-9]{64}$/.test(String(input.adviceHash)) || !["accepted", "incomplete", "blocked"].includes(String(input.acceptance)) || !["pass", "warn", "block", "notEvaluated"].includes(String(input.disposition)) || !record8(input.dimensions) || !Array.isArray(input.rules) || !Array.isArray(input.unevaluatedRequirements))return fail();if (Object.keys(input).sort().join(",") !== ["kind",@@ -20265,12 +20327,12 @@ function validateRequirementsQaReport(input, context) {const evaluated = [];for (const dimension of REQUIREMENTS_QA_DIMENSIONS) {const value = input.dimensions[dimension];- if (!record7(value) || !["pass", "warn", "block", "notEvaluated"].includes(String(value.status)) || !Array.isArray(value.findings) || value.findings.length > 1000 || Object.keys(value).some((key) => !["status", "findings", "metrics"].includes(key)))+ if (!record8(value) || !["pass", "warn", "block", "notEvaluated"].includes(String(value.status)) || !Array.isArray(value.findings) || value.findings.length > 1000 || Object.keys(value).some((key) => !["status", "findings", "metrics"].includes(key)))return fail();if (value.status !== "notEvaluated")evaluated.push(dimension);for (const finding of value.findings) {- if (!record7(finding) || finding.dimension !== dimension || !isQaFinding({+ if (!record8(finding) || finding.dimension !== dimension || !isQaFinding({...finding,dimension: dimension === "requirementReadiness" ? "categoryReadiness" : dimension}))@@ -20278,7 +20340,7 @@ function validateRequirementsQaReport(input, context) {findings.push(finding);}if (value.metrics !== undefined) {- if (!record7(value.metrics) || !Object.values(value.metrics).every((metric) => metric === null || typeof metric === "string" || typeof metric === "boolean" || typeof metric === "number" && Number.isFinite(metric)))+ if (!record8(value.metrics) || !Object.values(value.metrics).every((metric) => metric === null || typeof metric === "string" || typeof metric === "boolean" || typeof metric === "number" && Number.isFinite(metric)))return fail();metrics[dimension] = value.metrics;}@@ -20286,14 +20348,14 @@ function validateRequirementsQaReport(input, context) {const known = new Set(REQUIREMENTS_RULE_MAP.map((rule) => rule.id));const ids = new Set;for (const rule of input.rules) {- if (!record7(rule) || typeof rule.id !== "string" || !known.has(rule.id) || ids.has(rule.id) || !["off", "observe", "warn", "enforce"].includes(String(rule.mode)) || !["evaluated", "notEvaluated", "notRequested"].includes(String(rule.status)))+ if (!record8(rule) || typeof rule.id !== "string" || !known.has(rule.id) || ids.has(rule.id) || !["off", "observe", "warn", "enforce"].includes(String(rule.mode)) || !["evaluated", "notEvaluated", "notRequested"].includes(String(rule.status)))return fail();ids.add(rule.id);}if (ids.size !== known.size)return fail();for (const unmet of input.unevaluatedRequirements)- if (!record7(unmet) || typeof unmet.key !== "string" || !Array.isArray(unmet.fields) || !unmet.fields.every((x) => typeof x === "string") || typeof unmet.reason !== "string")+ if (!record8(unmet) || typeof unmet.key !== "string" || !Array.isArray(unmet.fields) || !unmet.fields.every((x) => typeof x === "string") || typeof unmet.reason !== "string")return fail();const result = input;if (context) {@@ -20313,7 +20375,7 @@ function validateRequirementsQaReport(input, context) {}return result;}-var REQUIREMENTS_QA_DIMENSIONS, record7 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), canonical3 = (value) => Array.isArray(value) ? `[${value.map(canonical3).join(",")}]` : record7(value) ? `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonical3(value[key])}`).join(",")}}` : JSON.stringify(value);+var REQUIREMENTS_QA_DIMENSIONS, record8 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), canonical3 = (value) => Array.isArray(value) ? `[${value.map(canonical3).join(",")}]` : record8(value) ? `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonical3(value[key])}`).join(",")}}` : JSON.stringify(value);var init_requirements_report = __esm(() => {init_requirements_applicability();init_types();@@ -22403,7 +22465,9 @@ function requireSolid(part) {}function assertRequiredSolids(root) {const problems = [];- const visit = (node) => {+ const meshes = [];+ let total = 0;+ const visit = (node, childPath) => {if (node.visible === false)return;const mesh = node;@@ -22417,15 +22481,29 @@ function assertRequiredSolids(root) {reasons.push(`not manifold (${report.nonManifoldEdges} edges shared by 3+ faces)`);if (solid.orientation !== "outward")reasons.push(solid.orientation === "mixed" ? `winding is mixed (${report.orientationConflicts} conflicting edges)` : `faces point inward (signed volume ${solid.signedVolume.toPrecision(4)})`);- if (reasons.length)- problems.push(`${mesh.name || "(unnamed mesh)"}: ${reasons.join(", ")}`);+ if (reasons.length) {+ total++;+ if (meshes.length < MAX_SOLID_FAILURE_MESHES) {+ problems.push(`${mesh.name || "(unnamed mesh)"}: ${reasons.join(", ")}`);+ meshes.push({+ childPath: childPath.length <= MAX_SOLID_FAILURE_PATH ? childPath : null,+ closed: solid.closed,+ manifold: solid.manifold,+ orientation: solid.orientation,+ boundaryEdges: report.boundaryEdges,+ nonManifoldEdges: report.nonManifoldEdges,+ orientationConflicts: report.orientationConflicts+ });+ }+ }}- for (const child of node.children)- visit(child);+ node.children.forEach((child, index) => {+ visit(child, [...childPath, index]);+ });};- visit(root);- if (problems.length)- throw new AuthoringDiagnosticError("REQUIRE_SOLID", `requireSolid: ${problems.length} marked mesh(es) are not closed, manifold, outward solids: ${problems.slice(0, 4).join("; ")}${problems.length > 4 ? "; ..." : ""}.`);+ visit(root, []);+ if (total)+ throw new RequiredSolidError({ total, truncated: total > meshes.length, meshes }, `requireSolid: ${total} marked mesh(es) are not closed, manifold, outward solids: ${problems.join("; ")}${total > meshes.length ? "; ..." : ""}.`);}var REQUIRE_SOLID_KEY = "kilnRequireSolid", marked = (node) => {for (let at = node;at; at = at.parent)@@ -22436,6 +22514,7 @@ var REQUIRE_SOLID_KEY = "kilnRequireSolid", marked = (node) => {var init_require_solid = __esm(() => {init_authoring_diagnostic();init_geometry();+ init_solid_diagnostic();});// src/user-data-extras.ts@@ -23591,7 +23670,7 @@ function normalizeBudget(spec) {fail8(`unknown field ${JSON.stringify(key)}.`);const triangles = {};if (typeof value.triangles === "number")- triangles.LOD0 = count3("triangles", value.triangles);+ triangles.LOD0 = count4("triangles", value.triangles);else if (value.triangles && typeof value.triangles === "object" && !Array.isArray(value.triangles)) {const entries = Object.entries(value.triangles);if (entries.length === 0)@@ -23599,7 +23678,7 @@ function normalizeBudget(spec) {for (const [tier, limit] of entries) {if (!/^LOD(0|[1-9][0-9]?)$/.test(tier))fail8(`triangles tier ${JSON.stringify(tier)} must be named LOD0, LOD1, ...`);- triangles[tier] = count3(`triangles.${tier}`, limit);+ triangles[tier] = count4(`triangles.${tier}`, limit);}} elsefail8("triangles must be a positive integer or a record of LOD tiers.");@@ -23607,7 +23686,7 @@ function normalizeBudget(spec) {return {schemaVersion: 1,triangles: ordered,- ...value.draws === undefined ? {} : { draws: count3("draws", value.draws) }+ ...value.draws === undefined ? {} : { draws: count4("draws", value.draws) }};}function defineBudget(spec, target) {@@ -23661,7 +23740,7 @@ function evaluateBudget(declaration, measuredLod0, chains) {}var KILN_BUDGET_KEY = "kilnBudgetV1", fail8 = (detail) => {throw new AuthoringDiagnosticError("DELIVERY_CONTRACT", `defineBudget(spec): ${detail}`);-}, count3 = (label, value) => {+}, count4 = (label, value) => {if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1)fail8(`${label} must be a positive integer, got ${String(value)}.`);return value;@@ -25936,8 +26015,166 @@ var init_profile = __esm(() => {};});-// src/uv-shapes.ts+// src/sdf.ts+function sphereInside(point, center, radius) {+ if (point.length !== 3 || !point.every(Number.isFinite))+ throw new Error("sphereInside point must be three finite numbers");+ if (!Number.isFinite(radius) || radius <= 0)+ throw new Error("sphereInside radius must be positive and finite");+ if (center.length !== 3 || !center.every(Number.isFinite))+ throw new Error("sphereInside center must be three finite numbers");+ return radius - Math.hypot(point[0] - center[0], point[1] - center[1], point[2] - center[2]);+}+function smoothUnion(a, b, blend) {+ if (!Number.isFinite(a) || !Number.isFinite(b))+ throw new Error("smoothUnion operands must be finite");+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("smoothUnion blend must be positive and finite");+ const h = Math.max(blend - Math.abs(a - b), 0) / blend;+ return Math.max(a, b) + h * h * blend / 4;+}+function smoothUnionSpheres(point, spheres, blend) {+ if (!spheres.length)+ throw new Error("smoothUnionSpheres needs at least one sphere");+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("smoothUnionSpheres blend must be positive and finite");+ let value = sphereInside(point, spheres[0].center, spheres[0].radius);+ for (let i = 1;i < spheres.length; i++) {+ const s = spheres[i];+ value = smoothUnion(value, sphereInside(point, s.center, s.radius), blend);+ }+ return value;+}++// src/organic.tsimport * as THREE42 from "three";+function assertSafePathCount(name, count) {+ if (!Number.isSafeInteger(count))+ throw new Error(`${name} derived sample count must be a safe integer; reduce sample counts.`);+}+async function metaballSurface(spheres, options) {+ if (!spheres.length)+ throw new Error("metaballSurface needs at least one sphere");+ let minRadius = Infinity;+ for (const s of spheres) {+ if (s.center.length !== 3 || !s.center.every(Number.isFinite))+ throw new Error("metaballSurface sphere center must be three finite numbers");+ if (!Number.isFinite(s.radius) || s.radius <= 0)+ throw new Error("metaballSurface sphere radius must be positive and finite");+ minRadius = Math.min(minRadius, s.radius);+ }+ const blend = options.blend ?? Math.max(minRadius * 0.35, 0.02);+ if (!Number.isFinite(blend) || blend <= 0)+ throw new Error("metaballSurface blend must be positive and finite");+ const { bounds, ...rest } = options;+ const field = (p) => smoothUnionSpheres(p, spheres, blend);+ return implicitSurface(field, { bounds, ...rest });+}+function catmullRomPath(controlPoints, samplesPerSpan = 8, closed = false) {+ if (controlPoints.length < (closed ? 3 : 2))+ throw new Error("catmullRomPath needs at least two open or three closed control points");+ if (!Number.isSafeInteger(samplesPerSpan) || samplesPerSpan < 1)+ throw new Error("catmullRomPath samplesPerSpan must be a positive integer");+ const spans = closed ? controlPoints.length : controlPoints.length - 1;+ assertSafePathCount("catmullRomPath", spans * samplesPerSpan + 1);+ if (controlPoints.some((p) => p.length !== 3 || !p.every(Number.isFinite)))+ throw new Error("catmullRomPath control points must be finite [x,y,z] triples");+ const vectors = controlPoints.map((p) => new THREE42.Vector3(p[0], p[1], p[2]));+ const curve = new THREE42.CatmullRomCurve3(vectors, closed);+ const points = curve.getPoints(spans * samplesPerSpan);+ if (closed)+ points.pop();+ return points.map((v) => [v.x, v.y, v.z]);+}+function taperedTube(path, radii, options = {}) {+ const closed = options.closed ?? false;+ const stations = path;+ if (stations.length < (closed ? 3 : 2))+ throw new Error("taperedTube needs at least two open or three closed path points");+ if (radii.length !== stations.length)+ throw new Error("taperedTube radii must have one entry per path point");+ for (const r of radii) {+ if (!Number.isFinite(r) || r <= 0)+ throw new Error("taperedTube radii must be positive and finite");+ }+ const radialSegments = options.radialSegments ?? 20;+ const profile = circleProfile(1, radialSegments).map(([x, y]) => [x, y]);+ const scale = radii.map((r, i) => {+ const [side, depth] = options.sectionScale?.[i] ?? [1, 1];+ return [r * side, r * depth];+ });+ if (options.sectionScale && options.sectionScale.length !== stations.length)+ throw new Error("taperedTube sectionScale needs one [side, depth] pair per path point");+ const geo = sweepProfile(profile, [...stations], {+ cap: options.cap ?? true,+ closed,+ up: options.up,+ twist: options.twist ?? 0,+ scale,+ creaseAngle: options.creaseAngle ?? 180+ });+ return geo;+}+function spiralPath(options) {+ const {+ center,+ radius,+ rise,+ turns,+ axis = [0, 1, 0],+ forward = [0, 0, 1],+ samples = 24+ } = options;+ if (![radius, rise, turns].every((n) => Number.isFinite(n) && n > 0))+ throw new Error("spiralPath radius, rise and turns must be positive and finite");+ if (!Number.isSafeInteger(samples) || samples < 4)+ throw new Error("spiralPath samples must be an integer >= 4");+ assertSafePathCount("spiralPath", samples + 1);+ if (center.length !== 3 || !center.every(Number.isFinite))+ throw new Error("spiralPath center must be a finite [x,y,z] triple");+ if (axis.length !== 3 || forward.length !== 3 || ![...axis, ...forward].every(Number.isFinite))+ throw new Error("spiralPath axis and forward must be finite [x,y,z] triples");+ const up = new THREE42.Vector3(...axis);+ const fwd = new THREE42.Vector3(...forward);+ if (up.lengthSq() < 0.000000000001 || fwd.lengthSq() < 0.000000000001)+ throw new Error("spiralPath axis and forward must be nonzero");+ up.normalize();+ const horiz = fwd.clone().addScaledVector(up, -fwd.dot(up));+ if (horiz.lengthSq() < 0.000000000001)+ throw new Error("spiralPath forward must not be parallel to axis");+ horiz.normalize();+ const right = new THREE42.Vector3().crossVectors(up, horiz).normalize();+ const out = [];+ for (let i = 0;i <= samples; i++) {+ const u = i / samples;+ const theta = u * turns * Math.PI * 2;+ const r = radius * (1 - u * 0.58);+ const offset = horiz.clone().multiplyScalar(r * Math.cos(theta)).add(right.clone().multiplyScalar(r * Math.sin(theta)));+ const lift = up.clone().multiplyScalar(u * rise);+ out.push([+ center[0] + offset.x + lift.x,+ center[1] + offset.y + lift.y,+ center[2] + offset.z + lift.z+ ]);+ }+ return out;+}+function smoothOrganic(geometry, options = {}) {+ const iterations = options.iterations ?? 1;+ const preserveUV = options.preserveUV ?? false;+ const subdivided = subdivide(geometry, iterations, preserveUV ? { preserveUV: true } : undefined);+ return creaseNormals(subdivided, { angle: options.creaseAngle ?? 55 });+}+var init_organic = __esm(() => {+ init_geometry();+ init_implicit();+ init_profile();+ init_ops();+ init_sweep2();+});++// src/uv-shapes.ts+import * as THREE43 from "three";function remapUV(geo, options = {}) {if (!options || typeof options !== "object" || Array.isArray(options) || Object.keys(options).some((key) => !["scale", "offset"].includes(key))) {throw new Error("remapUV: options may contain only scale and offset.");@@ -25966,7 +26203,7 @@ function remapUV(geo, options = {}) {}const cloned = geo.clone();cloned.userData = structuredClone(geo.userData);- cloned.setAttribute("uv", new THREE42.Float32BufferAttribute(values, 2));+ cloned.setAttribute("uv", new THREE43.Float32BufferAttribute(values, 2));if ((scale[0] !== 1 || scale[1] !== 1) && cloned.hasAttribute("tangent")) {cloned.deleteAttribute("tangent");const previous = cloned.userData.kilnAttributeWarnings;@@ -25983,13 +26220,13 @@ function remapUV(geo, options = {}) {var init_uv_shapes = () => {};// src/texture-atlas.ts-import * as THREE43 from "three";+import * as THREE44 from "three";async function textureAtlas(input, options = {}) {const compiled = await compileTextureAtlasSpecV1(input, options);- const texture = new THREE43.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE43.RGBAFormat, THREE43.UnsignedByteType);+ const texture = new THREE44.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE44.RGBAFormat, THREE44.UnsignedByteType);texture.name = "Atlas";texture.flipY = false;- texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE43.SRGBColorSpace : THREE43.NoColorSpace;+ texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE44.SRGBColorSpace : THREE44.NoColorSpace;applyPortableSamplerV1(texture, compiled.spec.sampler);texture.userData.kilnAtlas = { spec: compiled.spec, manifest: compiled.manifest };texture.userData.kilnTexture = {@@ -26040,7 +26277,7 @@ function remapUVToAtlas(geometry, atlas, name, options) {bytes += buffer.byteLength;}} else {- bytes += attribute.array.byteLength * (attribute.constructor === THREE43.BufferAttribute || attribute.constructor === THREE43.InstancedBufferAttribute ? 1 : 2);+ bytes += attribute.array.byteLength * (attribute.constructor === THREE44.BufferAttribute || attribute.constructor === THREE44.InstancedBufferAttribute ? 1 : 2);}};for (const attr of Object.values(geometry.attributes))@@ -26264,7 +26501,7 @@ var init_portable_material_runtime = __esm(() => {});// src/uv-data.ts-import * as THREE44 from "three";+import * as THREE45 from "three";function validateAtlasRemap(mesh, inputIndex, sourceCount) {const count = mesh.vertexCount;if (!Number.isSafeInteger(count) || count < 1 || count > GEOMETRY_ALLOCATION_LIMITS.unwrapVertices)@@ -26299,7 +26536,7 @@ function remapUnwrapAttribute(attribute, oldIndexes) {for (let c = 0;c < attribute.itemSize; c++)array[i * attribute.itemSize + c] = attribute.array[oldIndexes[i] * stride + offset + c];}- const output = attribute.isFloat16BufferAttribute ? new THREE44.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE44.BufferAttribute(array, attribute.itemSize, attribute.normalized);+ const output = attribute.isFloat16BufferAttribute ? new THREE45.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE45.BufferAttribute(array, attribute.itemSize, attribute.normalized);output.name = attribute.name;output.setUsage(interleaved(attribute) ? attribute.data.usage : attribute.usage);if (!interleaved(attribute))@@ -26411,7 +26648,7 @@ var init_uv_data = __esm(() => {});// src/uv.ts-import * as THREE45 from "three";+import * as THREE46 from "three";async function getXatlas() {if (!_xatlasReady) {_xatlasReady = (async () => {@@ -26443,7 +26680,7 @@ async function autoUnwrap(geometry, opts = {}) {if (result.atlasCount !== 1 || !Number.isSafeInteger(result.width) || result.width <= 0 || !Number.isSafeInteger(result.height) || result.height <= 0)throw new Error("autoUnwrap: xatlas must return one valid atlas; multiple atlas pages are unsupported.");const remap = validateAtlasRemap(mesh, prepared.index, geometry.getAttribute("position").count);- const out = new THREE45.BufferGeometry;+ const out = new THREE46.BufferGeometry;for (const [name, attribute] of Object.entries(geometry.attributes)) {if (name === "uv" || name === "tangent" || name === "normal" && !prepared.useNormals)continue;@@ -26453,8 +26690,8 @@ async function autoUnwrap(geometry, opts = {}) {out.morphAttributes[name] = targets.map((attribute) => remapUnwrapAttribute(attribute, remap.oldIndexes));}out.morphTargetsRelative = geometry.morphTargetsRelative;- out.setIndex(new THREE45.BufferAttribute(new Uint32Array(remap.index), 1));- out.setAttribute("uv", new THREE45.BufferAttribute(new Float32Array(remap.uv), 2));+ out.setIndex(new THREE46.BufferAttribute(new Uint32Array(remap.index), 1));+ out.setAttribute("uv", new THREE46.BufferAttribute(new Float32Array(remap.uv), 2));out.name = geometry.name;out.groups = geometry.groups.map((group) => ({ ...group }));out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);@@ -26489,11 +26726,11 @@ function repairZeroNormals(geo) {if (broken.size === 0)return;const acc = new Float32Array(normal.count * 3);- const a = new THREE45.Vector3;- const b = new THREE45.Vector3;- const c = new THREE45.Vector3;- const face = new THREE45.Vector3;- const edge = new THREE45.Vector3;+ const a = new THREE46.Vector3;+ const b = new THREE46.Vector3;+ const c = new THREE46.Vector3;+ const face = new THREE46.Vector3;+ const edge = new THREE46.Vector3;for (let t = 0;t + 2 < index.count; t += 3) {const tri = [index.getX(t), index.getX(t + 1), index.getX(t + 2)];if (!tri.some((i) => broken.has(i)))@@ -26529,7 +26766,7 @@ var init_uv = __esm(() => {});// src/uv-project.ts-import * as THREE46 from "three";+import * as THREE47 from "three";function projectUV(geometry, options) {if (!options || typeof options !== "object" || Array.isArray(options) || !["planar", "box", "cylindrical"].includes(options.projection) || Object.keys(options).some((key) => !["projection", "frame", "seamDegrees", "angularRange", "caps"].includes(key)))throw new Error("projectUV: select an explicit planar, box or cylindrical projection with documented options.");@@ -26567,15 +26804,15 @@ function projectUV(geometry, options) {throw new Error("projectUV: index contains an invalid vertex reference.");}const points = [];- const bounds = new THREE46.Box3;+ const bounds = new THREE47.Box3;for (let i = 0;i < positions.count; i++) {- const point = new THREE46.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);+ const point = new THREE47.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);if (![point.x, point.y, point.z].every(Number.isFinite))throw new Error("projectUV: frame-local positions must be finite.");points.push(point);bounds.expandByPoint(point);}- const extent = bounds.getSize(new THREE46.Vector3);+ const extent = bounds.getSize(new THREE47.Vector3);const fit = (point, axis) => extent[axis] > 0 ? (point[axis] - bounds.min[axis]) / extent[axis] : 0.5;const outputUVs = new Float32Array(corners * 2);const startDegrees = options.angularRange?.[0] ?? options.seamDegrees ?? 180;@@ -26583,8 +26820,8 @@ function projectUV(geometry, options) {const sweep = (options.angularRange?.[1] ?? 360) * Math.PI / 180;const fullWrap = options.angularRange === undefined || options.angularRange[1] === 360;const wrap = (angle) => (angle % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);- const normal = new THREE46.Vector3;- const edge = new THREE46.Vector3;+ const normal = new THREE47.Vector3;+ const edge = new THREE47.Vector3;for (let i = 0;i < corners; i += 3) {const triangle = [0, 1, 2].map((offset) => points[index ? index.getX(i + offset) : i + offset]);normal.subVectors(triangle[1], triangle[0]).cross(edge.subVectors(triangle[2], triangle[0])).normalize();@@ -26631,7 +26868,7 @@ function projectUV(geometry, options) {const out = geometry.index ? geometry.toNonIndexed() : geometry.clone();out.userData = structuredClone(geometry.userData);out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);- out.setAttribute("uv", new THREE46.Float32BufferAttribute(outputUVs, 2));+ out.setAttribute("uv", new THREE47.Float32BufferAttribute(outputUVs, 2));if (out.hasAttribute("tangent")) {out.deleteAttribute("tangent");const previous = out.userData.kilnAttributeWarnings;@@ -26652,17 +26889,17 @@ var init_uv_project = __esm(() => {});// src/primitives.ts-import * as THREE47 from "three";+import * as THREE48 from "three";function vectorToTuple(v) {return [v.x, v.y, v.z];}function createRoot(name) {- const root = new THREE47.Object3D;+ const root = new THREE48.Object3D;root.name = name;return root;}function createPivot(name, position = [0, 0, 0], parent) {- const pivot = new THREE47.Object3D;+ const pivot = new THREE48.Object3D;pivot.name = `Joint_${name}`;pivot.position.set(...position);if (parent)@@ -26694,16 +26931,16 @@ function assertPartArgs(name, geometry2, material) {}function createPart(name, geometry2, material, options = {}) {assertPartArgs(name, geometry2, material);- const mesh = new THREE47.Mesh(geometry2, material);+ const mesh = new THREE48.Mesh(geometry2, material);mesh.name = `Mesh_${name}`;if (options.position)mesh.position.set(...options.position);if (options.rotation)- mesh.rotation.set(THREE47.MathUtils.degToRad(options.rotation[0]), THREE47.MathUtils.degToRad(options.rotation[1]), THREE47.MathUtils.degToRad(options.rotation[2]));+ mesh.rotation.set(THREE48.MathUtils.degToRad(options.rotation[0]), THREE48.MathUtils.degToRad(options.rotation[1]), THREE48.MathUtils.degToRad(options.rotation[2]));if (options.scale)mesh.scale.set(...options.scale);if (options.pivot) {- const pivot = new THREE47.Object3D;+ const pivot = new THREE48.Object3D;pivot.name = `Joint_${name}`;pivot.add(mesh);mesh.position.set(0, 0, 0);@@ -26726,7 +26963,7 @@ function capsuleGeo(radius, height, segments = 6) {assertDimension("capsuleGeo height (straight middle length)", height, true);assertDimension("capsuleGeo outer half-length", height / 2 + radius);assertPrimitiveSegments("capsuleGeo segments", segments, 3);- return new THREE47.CapsuleGeometry(radius, height, 2, segments);+ return new THREE48.CapsuleGeometry(radius, height, 2, segments);}function capsuleXGeo(radius, length, segments = 6) {const geo = capsuleGeo(radius, length, segments);@@ -26745,7 +26982,7 @@ function cylinderGeo(radiusTop, radiusBottom, height, segments = 8) {throw new RangeError("cylinderGeo requires at least one positive radius.");assertDimension("cylinderGeo height", height);assertPrimitiveSegments("cylinderGeo segments", segments, 3);- return new THREE47.CylinderGeometry(radiusTop, radiusBottom, height, segments);+ return new THREE48.CylinderGeometry(radiusTop, radiusBottom, height, segments);}function cylinderXGeo(radiusTop, radiusBottom, length, segments = 8) {const geo = cylinderGeo(radiusTop, radiusBottom, length, segments);@@ -26760,20 +26997,20 @@ function cylinderZGeo(radiusTop, radiusBottom, length, segments = 8) {function boxGeo(width, height, depth) {for (const [name, value] of Object.entries({ width, height, depth }))assertDimension(`boxGeo ${name} (use planeGeo for a sheet)`, value);- return new THREE47.BoxGeometry(width, height, depth);+ return new THREE48.BoxGeometry(width, height, depth);}function sphereGeo(radius, widthSegments = 8, heightSegments = 6) {assertDimension("sphereGeo radius", radius);assertPrimitiveSegments("sphereGeo widthSegments", widthSegments, 3);assertPrimitiveSegments("sphereGeo heightSegments", heightSegments, 2);assertPrimitiveGrid("sphereGeo", widthSegments, heightSegments);- return new THREE47.SphereGeometry(radius, widthSegments, heightSegments);+ return new THREE48.SphereGeometry(radius, widthSegments, heightSegments);}function coneGeo(radius, height, segments = 8) {assertDimension("coneGeo radius", radius);assertDimension("coneGeo height", height);assertPrimitiveSegments("coneGeo segments", segments, 3);- return new THREE47.ConeGeometry(radius, height, segments);+ return new THREE48.ConeGeometry(radius, height, segments);}function coneXGeo(radius, length, segments = 8) {const geo = coneGeo(radius, length, segments);@@ -26790,7 +27027,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {const segments = options.segments ?? 8;assertFiniteTriple("cylinderOnAxis center", center);assertFiniteTriple("cylinderOnAxis normal", normal);- const n = new THREE47.Vector3(normal[0], normal[1], normal[2]);+ const n = new THREE48.Vector3(normal[0], normal[1], normal[2]);const len = Math.hypot(...normal);if (len < 0.000001) {throw new Error(`cylinderOnAxis: normal must be a non-zero vector (got [${normal.join(",")}]).`);@@ -26798,7 +27035,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {const magnitude = Math.max(...normal.map(Math.abs));n.set(normal[0] / magnitude, normal[1] / magnitude, normal[2] / magnitude).normalize();const geo = cylinderGeo(radiusTop, radiusBottom, height, segments);- const q = new THREE47.Quaternion().setFromUnitVectors(new THREE47.Vector3(0, 1, 0), n);+ const q = new THREE48.Quaternion().setFromUnitVectors(new THREE48.Vector3(0, 1, 0), n);geo.applyQuaternion(q);geo.translate(center[0], center[1], center[2]);return geo;@@ -26820,7 +27057,7 @@ function torusGeo(radius, tube, radialSegments = 8, tubularSegments = 12) {assertPrimitiveSegments("torusGeo radialSegments", radialSegments, 3);assertPrimitiveSegments("torusGeo tubularSegments", tubularSegments, 3);assertPrimitiveGrid("torusGeo", radialSegments, tubularSegments);- return new THREE47.TorusGeometry(radius, tube, radialSegments, tubularSegments);+ return new THREE48.TorusGeometry(radius, tube, radialSegments, tubularSegments);}function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {assertDimension("planeGeo width", width);@@ -26828,14 +27065,14 @@ function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {assertPrimitiveSegments("planeGeo widthSegments", widthSegments, 1);assertPrimitiveSegments("planeGeo heightSegments", heightSegments, 1);assertPrimitiveGrid("planeGeo", widthSegments, heightSegments);- return new THREE47.PlaneGeometry(width, height, widthSegments, heightSegments);+ return new THREE48.PlaneGeometry(width, height, widthSegments, heightSegments);}function decalBox(width, height, depth = 0.01) {assertDimension("decalBox width", width);assertDimension("decalBox height", height);assertDimension("decalBox depth", depth, true);const d = Math.max(depth, 0.002);- return new THREE47.BoxGeometry(width, height, d);+ return new THREE48.BoxGeometry(width, height, d);}function validateCardFrame(name, width, height, yPivot) {assertDimension(`${name} width`, width);@@ -26849,7 +27086,7 @@ function foliageCardGeo(opts = {}) {const h = opts.height ?? 1;const yPivot = opts.yPivot ?? 0;validateCardFrame("foliageCardGeo", w, h, yPivot);- const geom = new THREE47.PlaneGeometry(w, h);+ const geom = new THREE48.PlaneGeometry(w, h);geom.translate(0, h * (0.5 - yPivot), 0);geom.userData["kilnGeometryRole"] = "foliageCard";return geom;@@ -26865,12 +27102,12 @@ function crossedQuadsGeo(opts = {}) {const geometries = [];for (let i = 0;i < planes; i++) {const angle = i / planes * Math.PI;- const quad = new THREE47.PlaneGeometry(w, h);+ const quad = new THREE48.PlaneGeometry(w, h);quad.translate(0, h * (0.5 - yPivot), 0);quad.rotateY(angle);geometries.push(quad);}- const out = new THREE47.BufferGeometry;+ const out = new THREE48.BufferGeometry;const posCount = geometries.reduce((sum, g) => sum + (g.attributes.position?.count ?? 0), 0);const positions = new Float32Array(posCount * 3);const normals = new Float32Array(posCount * 3);@@ -26897,9 +27134,9 @@ function crossedQuadsGeo(opts = {}) {}vOffset += p.count;}- out.setAttribute("position", new THREE47.BufferAttribute(positions, 3));- out.setAttribute("normal", new THREE47.BufferAttribute(normals, 3));- out.setAttribute("uv", new THREE47.BufferAttribute(uvs, 2));+ out.setAttribute("position", new THREE48.BufferAttribute(positions, 3));+ out.setAttribute("normal", new THREE48.BufferAttribute(normals, 3));+ out.setAttribute("uv", new THREE48.BufferAttribute(uvs, 2));out.setIndex(indices);out.userData["kilnGeometryRole"] = "foliageCard";return out;@@ -26914,7 +27151,7 @@ function octaGridPlane(opts) {const h = opts.height ?? 1;const yPivot = opts.yPivot ?? 0;validateCardFrame("octaGridPlane", w, h, yPivot);- const geom = new THREE47.PlaneGeometry(w, h);+ const geom = new THREE48.PlaneGeometry(w, h);geom.translate(0, h * (0.5 - yPivot), 0);const uv = geom.attributes.uv;const du = 1 / opts.tilesX;@@ -27010,8 +27247,8 @@ function wingGeo(options = {}) {7,6];- const geo = new THREE47.BufferGeometry;- geo.setAttribute("position", new THREE47.BufferAttribute(vertices, 3));+ const geo = new THREE48.BufferGeometry;+ geo.setAttribute("position", new THREE48.BufferAttribute(vertices, 3));geo.setIndex(tipChord === 0 ? [0, 1, 3, 4, 7, 5, 0, 2, 6, 0, 6, 4, 1, 5, 7, 1, 7, 3, 0, 4, 5, 0, 5, 1] : indices);geo.computeVertexNormals();return geo;@@ -27042,17 +27279,17 @@ function createWingPair(name, material, options) {};}function beamBetween(name, start, end, radius, material, options = {}) {- const a = new THREE47.Vector3(...start);- const b = new THREE47.Vector3(...end);+ const a = new THREE48.Vector3(...start);+ const b = new THREE48.Vector3(...end);const direction = b.clone().sub(a);const length = direction.length();if (length <= 0.0001) {throw new Error(`beamBetween("${name}"): start and end must be different points (got start=[${start.join(",")}], end=[${end.join(",")}], delta=${length.toExponential(2)}). Pick two distinct endpoints or switch to cylinderGeo with an explicit length + position.`);}- const mesh = new THREE47.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);+ const mesh = new THREE48.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);mesh.name = `Mesh_${name}`;mesh.position.copy(a.add(b).multiplyScalar(0.5));- mesh.quaternion.setFromUnitVectors(new THREE47.Vector3(0, 1, 0), direction.normalize());+ mesh.quaternion.setFromUnitVectors(new THREE48.Vector3(0, 1, 0), direction.normalize());if (options.parent)options.parent.add(mesh);return mesh;@@ -27061,11 +27298,11 @@ function snapTo(part, host, options = {}) {const overlap = options.overlap ?? 0.02;part.updateWorldMatrix(true, true);host.updateWorldMatrix(true, true);- const a = new THREE47.Box3().setFromObject(part);- const b = new THREE47.Box3().setFromObject(host);+ const a = new THREE48.Box3().setFromObject(part);+ const b = new THREE48.Box3().setFromObject(host);if (a.isEmpty() || b.isEmpty())return part;- const delta = new THREE47.Vector3;+ const delta = new THREE48.Vector3;for (const axis of ["x", "y", "z"]) {if (a.min[axis] > b.max[axis])delta[axis] = b.max[axis] - a.min[axis];@@ -27081,7 +27318,7 @@ function snapTo(part, host, options = {}) {delta[dominant] = -overlap;const parent = part.parent;if (parent) {- const p0 = new THREE47.Vector3;+ const p0 = new THREE48.Vector3;part.getWorldPosition(p0);const p1 = p0.clone().add(delta);const l0 = parent.worldToLocal(p0.clone());@@ -27116,8 +27353,8 @@ function createLadder(name, options) {throw new RangeError("createLadder rungCount must be an integer from 0 to 10000.");if (widthAxis !== "x" && widthAxis !== "z")throw new RangeError("createLadder widthAxis must be x or z.");- const bottomVec = new THREE47.Vector3;- const topVec = new THREE47.Vector3(...top).sub(new THREE47.Vector3(...bottom));+ const bottomVec = new THREE48.Vector3;+ const topVec = new THREE48.Vector3(...top).sub(new THREE48.Vector3(...bottom));const length = Math.hypot(topVec.x, topVec.y, topVec.z);assertDimension("createLadder endpoint distance", length);if (length <= 0.0001)@@ -27125,7 +27362,7 @@ function createLadder(name, options) {const along = topVec.clone().divideScalar(length);if (widthDirection !== undefined)assertFiniteTriple("createLadder widthDirection", widthDirection);- let across = widthDirection ? new THREE47.Vector3(...widthDirection) : widthAxis === "x" ? new THREE47.Vector3(1, 0, 0) : new THREE47.Vector3(0, 0, 1);+ let across = widthDirection ? new THREE48.Vector3(...widthDirection) : widthAxis === "x" ? new THREE48.Vector3(1, 0, 0) : new THREE48.Vector3(0, 0, 1);const largest = Math.max(Math.abs(across.x), Math.abs(across.y), Math.abs(across.z));if (!largest)throw new RangeError("createLadder widthDirection must be nonzero.");@@ -27135,19 +27372,19 @@ function createLadder(name, options) {if (widthDirection)throw new RangeError("createLadder widthDirection must not be parallel to the endpoints.");const axes = [- new THREE47.Vector3(1, 0, 0),- new THREE47.Vector3(0, 1, 0),- new THREE47.Vector3(0, 0, 1)+ new THREE48.Vector3(1, 0, 0),+ new THREE48.Vector3(0, 1, 0),+ new THREE48.Vector3(0, 0, 1)];across = axes.reduce((best, axis) => Math.abs(axis.dot(along)) < Math.abs(best.dot(along)) ? axis : best);across.addScaledVector(along, -across.dot(along));}across.normalize();const offset = across.clone().multiplyScalar(width / 2);- const root = new THREE47.Object3D;+ const root = new THREE48.Object3D;root.name = name;root.position.set(...bottom);- const rotation = new THREE47.Quaternion().setFromRotationMatrix(new THREE47.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();+ const rotation = new THREE48.Quaternion().setFromRotationMatrix(new THREE48.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();stampSemanticMetadataV1(root, {roles: ["ladder"],frames: [@@ -27187,7 +27424,7 @@ function wallWithOpening(name, material, options) {if (opening && openings)throw new TypeError("wallWithOpening: use opening or openings, not both.");const built = buildWallPanels(length, height, thickness, openings ?? (opening ? [opening] : []));- const group = new THREE47.Object3D;+ const group = new THREE48.Object3D;group.name = name;const panel = (suffix, lenStart, lenEnd, yLo, yHi) => {const segLen = lenEnd - lenStart;@@ -27218,7 +27455,7 @@ function room(name, material, options = {}) {parent} = options;const openings = options.openings ?? [{ wall: "front", kind: "door" }];- const root = new THREE47.Object3D;+ const root = new THREE48.Object3D;root.name = name;const wall = (suffix, len, axis, pos, which) => {const w = wallWithOpening(`${name}_Wall${suffix}`, material, {@@ -27272,7 +27509,7 @@ function createStairs(name, material, options) {if (Math.abs(totalRise) < 0.0001 || Math.abs(totalRun) < 0.0001) {throw new Error(`createStairs("${name}"): totalRise and totalRun must be non-zero (got rise=${totalRise}, run=${totalRun}).`);}- const root = new THREE47.Object3D;+ const root = new THREE48.Object3D;root.name = name;const stepRise = totalRise / steps;const stepRun = totalRun / steps;@@ -27302,7 +27539,7 @@ function requireColor(color, fn) {}function gameMaterial(color, options = {}) {requireColor(color, "gameMaterial");- return new THREE47.MeshStandardMaterial({+ return new THREE48.MeshStandardMaterial({color,metalness: options.metalness ?? 0,roughness: options.roughness ?? 0.8,@@ -27313,7 +27550,7 @@ function gameMaterial(color, options = {}) {}function basicMaterial(color, options = {}) {requireColor(color, "basicMaterial");- return new THREE47.MeshBasicMaterial({+ return new THREE48.MeshBasicMaterial({color,transparent: options.transparent ?? false,opacity: options.opacity ?? 1@@ -27321,18 +27558,18 @@ function basicMaterial(color, options = {}) {}function glassMaterial(color, options = {}) {requireColor(color, "glassMaterial");- return new THREE47.MeshStandardMaterial({+ return new THREE48.MeshStandardMaterial({color,transparent: true,opacity: options.opacity ?? 0.35,roughness: options.roughness ?? 0.1,metalness: options.metalness ?? 0,- side: THREE47.DoubleSide+ side: THREE48.DoubleSide});}function lambertMaterial(color, options = {}) {requireColor(color, "lambertMaterial");- return new THREE47.MeshLambertMaterial({+ return new THREE48.MeshLambertMaterial({color,flatShading: options.flatShading ?? true,emissive: options.emissive ?? 0@@ -27342,12 +27579,12 @@ function threeInterpolation(mode) {if (mode !== undefined && !TRACK_INTERPOLATIONS.includes(mode)) {throw new Error(`Animation interpolation must be one of ${TRACK_INTERPOLATIONS.join(", ")}.`);}- return mode === "STEP" ? THREE47.InterpolateDiscrete : THREE47.InterpolateLinear;+ return mode === "STEP" ? THREE48.InterpolateDiscrete : THREE48.InterpolateLinear;}function interpolatedTrack(Type, name, times, values, interpolation) {if (!isCubicInterpolation(interpolation))return new Type(name, times, values, threeInterpolation(interpolation));- const quaternion = Type === THREE47.QuaternionKeyframeTrack;+ const quaternion = Type === THREE48.QuaternionKeyframeTrack;return useCubicSpline(new Type(name, times, cubicSplineValues(times, values, quaternion ? 4 : 3, interpolation, quaternion)));}function animationNumber(value, label) {@@ -27401,15 +27638,15 @@ function rotationTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "rotation", interpolation);const times = [];const values = [];- const euler = new THREE47.Euler;- const quat = new THREE47.Quaternion;+ const euler = new THREE48.Euler;+ const quat = new THREE48.Quaternion;for (const kf of keyframes) {times.push(kf.time);- euler.set(THREE47.MathUtils.degToRad(kf.rotation[0]), THREE47.MathUtils.degToRad(kf.rotation[1]), THREE47.MathUtils.degToRad(kf.rotation[2]));+ euler.set(THREE48.MathUtils.degToRad(kf.rotation[0]), THREE48.MathUtils.degToRad(kf.rotation[1]), THREE48.MathUtils.degToRad(kf.rotation[2]));quat.setFromEuler(euler);values.push(quat.x, quat.y, quat.z, quat.w);}- return interpolatedTrack(THREE47.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);+ return interpolatedTrack(THREE48.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);}function positionTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "position", interpolation);@@ -27419,7 +27656,7 @@ function positionTrack(jointName, keyframes, interpolation) {times.push(kf.time);values.push(...kf.position);}- return interpolatedTrack(THREE47.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);+ return interpolatedTrack(THREE48.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);}function scaleTrack(jointName, keyframes, interpolation) {animationKeys(jointName, keyframes, "scale", interpolation);@@ -27429,7 +27666,7 @@ function scaleTrack(jointName, keyframes, interpolation) {times.push(kf.time);values.push(...kf.scale);}- return interpolatedTrack(THREE47.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);+ return interpolatedTrack(THREE48.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);}function createClip(name, duration, tracks, options) {if (typeof name !== "string" || !name.trim())@@ -27442,7 +27679,7 @@ function createClip(name, duration, tracks, options) {const loop = clipLoopOption(options);const names = new Set;for (const track of tracks) {- if (!(track instanceof THREE47.KeyframeTrack))+ if (!(track instanceof THREE48.KeyframeTrack))throw new Error("Animation clip tracks must be KeyframeTrack instances.");if (typeof track.name !== "string")throw new Error("Animation track target/channel must use a string name.");@@ -27456,12 +27693,12 @@ function createClip(name, duration, tracks, options) {throw new Error(`Duplicate animation target/channel: ${track.name}.`);names.add(track.name);const quaternion = channel === "quaternion";- const Type = quaternion ? THREE47.QuaternionKeyframeTrack : THREE47.VectorKeyframeTrack;+ const Type = quaternion ? THREE48.QuaternionKeyframeTrack : THREE48.VectorKeyframeTrack;if (!(track instanceof Type))throw new Error(`Animation channel ${channel} requires ${quaternion ? "QuaternionKeyframeTrack" : "VectorKeyframeTrack"}.`);const cubic = isCubicSplineTrack(track);const mode = track.getInterpolation();- if (!cubic && mode !== THREE47.InterpolateLinear && mode !== THREE47.InterpolateDiscrete) {+ if (!cubic && mode !== THREE48.InterpolateLinear && mode !== THREE48.InterpolateDiscrete) {throw new Error("Animation interpolation must be LINEAR, STEP or CUBICSPLINE (the glTF sampler modes); three.js smooth and Bezier interpolants have no glTF form.");}animationTimes(track.times, track.name);@@ -27484,7 +27721,7 @@ function createClip(name, duration, tracks, options) {throw new Error(`Animation clip duration ${duration} does not include every key of ${track.name}.`);}}- const clip = new THREE47.AnimationClip(name, duration, tracks);+ const clip = new THREE48.AnimationClip(name, duration, tracks);if (loop !== undefined)clip.userData.kilnLoopIntent = loop ? "loop" : "once";return clip;@@ -27561,12 +27798,12 @@ function createInstance(name, source, options = {}) {if (!sourceMesh) {throw new Error(`createInstance("${name}"): source "${source.name}" has no Mesh to clone from`);}- const mesh = new THREE47.Mesh(sourceMesh.geometry, sourceMesh.material);+ const mesh = new THREE48.Mesh(sourceMesh.geometry, sourceMesh.material);mesh.name = `Mesh_${name}`;if (options.position)mesh.position.set(...options.position);if (options.rotation)- mesh.rotation.set(THREE47.MathUtils.degToRad(options.rotation[0]), THREE47.MathUtils.degToRad(options.rotation[1]), THREE47.MathUtils.degToRad(options.rotation[2]));+ mesh.rotation.set(THREE48.MathUtils.degToRad(options.rotation[0]), THREE48.MathUtils.degToRad(options.rotation[1]), THREE48.MathUtils.degToRad(options.rotation[2]));if (options.scale)mesh.scale.set(...options.scale);if (options.parent)@@ -27798,6 +28035,13 @@ function buildSandboxGlobals(usage, options = {}) {bobbingAnimation: wrap("bobbingAnimation", bobbingAnimation),idleBreathing: wrap("idleBreathing", idleBreathing),implicitSurface: wrap("implicitSurface", implicitSurface),+ metaballSurface: wrap("metaballSurface", metaballSurface),+ catmullRomPath: wrap("catmullRomPath", catmullRomPath),+ spiralPath: wrap("spiralPath", spiralPath),+ taperedTube: wrap("taperedTube", taperedTube),+ smoothOrganic: wrap("smoothOrganic", smoothOrganic),+ smoothUnion: wrap("smoothUnion", smoothUnion),+ sphereInside: wrap("sphereInside", sphereInside),sweepProfile: wrap("sweepProfile", sweepProfile),loftProfiles: wrap("loftProfiles", loftProfiles),bend: wrap("bend", bend),@@ -27849,7 +28093,7 @@ function buildSandboxGlobals(usage, options = {}) {countMaterials: wrap("countMaterials", countMaterials),getJointNames: wrap("getJointNames", getJointNames),materialBudgetAdvisory: wrap("materialBudgetAdvisory", materialBudgetAdvisory),- THREE: THREE47,+ THREE: THREE48,Math,console: options.console ?? console};@@ -27881,6 +28125,7 @@ var init_primitives = __esm(() => {init_deform();init_sweep2();init_implicit();+ init_organic();init_profile();init_solids();init_procedural_texture();@@ -27908,6 +28153,7 @@ var init_primitives = __esm(() => {init_procedural_texture();init_assembly();init_implicit();+ init_organic();init_sweep2();init_deform();init_geometry();@@ -28220,7 +28466,7 @@ import {PropertyType as PropertyType5} from "@gltf-transform/core";import { createTransform, dequantizePrimitive, joinPrimitives } from "@gltf-transform/functions";-import * as THREE48 from "three";+import * as THREE49 from "three";function isSingular(matrix) {const e = matrix.elements;const scale = Math.hypot(e[0], e[1], e[2]) * Math.hypot(e[4], e[5], e[6]) * Math.hypot(e[8], e[9], e[10]);@@ -28338,10 +28584,10 @@ function reverseWinding(prim) {}}function bake(prim, matrix) {- const linear = new THREE48.Matrix3().setFromMatrix4(matrix);- const normalMatrix = new THREE48.Matrix3().getNormalMatrix(matrix);+ const linear = new THREE49.Matrix3().setFromMatrix4(matrix);+ const normalMatrix = new THREE49.Matrix3().getNormalMatrix(matrix);const mirrored = matrix.determinant() < 0;- const v = new THREE48.Vector3;+ const v = new THREE49.Vector3;const each = (semantic, apply) => {const attribute = prim.getAttribute(semantic);const element = [];@@ -28365,7 +28611,7 @@ function destinationOf(entries) {let best = Infinity;let bestScale = Infinity;for (const { node } of entries) {- const linear = new THREE48.Matrix3().setFromMatrix4(worldOf(node));+ const linear = new THREE49.Matrix3().setFromMatrix4(worldOf(node));const norm = Math.hypot(...linear.elements);const inverseNorm = Math.hypot(...linear.clone().invert().elements);const condition = norm * inverseNorm;@@ -28379,9 +28625,9 @@ function destinationOf(entries) {return chosen;}function checkPositionPrecision(input, output, sourceWorld, destinationWorld, reversed) {- const expected = new THREE48.Vector3;- const actual = new THREE48.Vector3;- const bounds = new THREE48.Box3;+ const expected = new THREE49.Vector3;+ const actual = new THREE49.Vector3;+ const bounds = new THREE49.Box3;const element = [];let error = 0;let magnitude = 0;@@ -28702,7 +28948,7 @@ function rigidMerge(options = {}, onSummary) {onSummary?.(summary);});}-var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE48.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType5.NODE).length, accessorsOf = (prim) => {+var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE49.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType5.NODE).length, accessorsOf = (prim) => {const indices = prim.getIndices();return indices ? [...prim.listAttributes(), indices] : prim.listAttributes();}, primitiveBytes = (primitives) => [...new Set(primitives.flatMap(accessorsOf))].reduce((sum, a) => sum + (a.getArray()?.byteLength ?? 0), 0), countPrimitives = (nodes) => [...nodes].reduce((sum, node) => sum + (node.getMesh()?.listPrimitives().length ?? 0), 0);@@ -28874,6 +29120,63 @@ var init_geometry_catalog = __esm(() => {description: "Experimental positive-inside implicit field sampled into a solid mesh. Requires explicit bounds and resolution; checks grid size and actual evaluation count. Output has no UVs.",promptNotes: "Use async build and await. Smaller edgeLength increases cost sharply. This helper cannot stop a callback that never returns; the host evaluator process provides that boundary. Thin features and geometric accuracy require inspection.",example: "const blob = await implicitSurface(([x,y,z]) => 1-Math.hypot(x,y,z), { bounds: { min: [-1.2,-1.2,-1.2], max: [1.2,1.2,1.2] }, edgeLength: 0.15 });"+ },+ {+ name: "metaballSurface",+ signature: "await metaballSurface(spheres: { center: [x,y,z], radius }[], { bounds, edgeLength, blend?, maxCells?, maxEvaluations? })",+ returns: "Promise<THREE.BufferGeometry>",+ category: "geometry",+ description: "Experimental smooth union of spheres meshed through implicitSurface. Uses polynomial blending; output has no UVs.",+ promptNotes: "Prefer this over hand-rolling smoothUnion fields for creatures, blobs and rounded junctions. Match edgeLength to feature size.",+ example: "const body = await metaballSurface([{ center: [0,0.4,0], radius: 0.35 }, { center: [0.2,0.55,0], radius: 0.22 }], { bounds: { min: [-0.6,-0.1,-0.5], max: [0.6,1,0.5] }, edgeLength: 0.08 });"+ },+ {+ name: "taperedTube",+ signature: "taperedTube(path: [x,y,z][], radii: number[], opts?: { radialSegments?: 20, creaseAngle?: 180, cap?: true, closed?: false, up?, twist?, sectionScale?: [side,depth][] })",+ returns: "THREE.BufferGeometry",+ category: "curves",+ description: "Circular sweep with one radius per path station. Default creaseAngle 180 shades round profiles smoothly; sample splines with catmullRomPath first.",+ example: "const path = catmullRomPath([[0,0.5,0],[0.3,0.7,0],[0.5,0.4,0]], 6); const radii = path.map((_, i) => 0.08 - 0.06 * i / (path.length - 1)); const tail = taperedTube(path, radii);"+ },+ {+ name: "catmullRomPath",+ signature: "catmullRomPath(controlPoints: [x,y,z][], samplesPerSpan?: 8, closed?: false)",+ returns: "[x,y,z][]",+ category: "curves",+ description: "Samples a Catmull-Rom spline through waypoints. Open paths include both endpoints; closed paths omit the repeated endpoint for closed sweeps.",+ example: "const path = catmullRomPath([[0,0,0],[0.2,0.4,0.1],[0.5,0.2,0]], 10);"+ },+ {+ name: "spiralPath",+ signature: "spiralPath(opts: { center, radius, rise, turns, axis?, forward?, samples? })",+ returns: "[x,y,z][]",+ category: "curves",+ description: "Rising spiral for curled appendages, shrinking to 42% of the start radius. Returns samples + 1 stations; starts radius away from center.",+ example: "const curl = spiralPath({ center: [0,0.05,0], radius: 0.03, rise: 0.12, turns: 1.75, forward: [0,0,1] });"+ },+ {+ name: "smoothOrganic",+ signature: "smoothOrganic(geometry, opts?: { iterations?: 1, creaseAngle?: 55, preserveUV?: false })",+ returns: "THREE.BufferGeometry",+ category: "mesh-ops",+ description: "Runs subdivide then creaseNormals with organic-friendly defaults.",+ example: "const soft = smoothOrganic(tube, { iterations: 1, creaseAngle: 50 });"+ },+ {+ name: "smoothUnion",+ signature: "smoothUnion(a: number, b: number, blend: number)",+ returns: "number",+ category: "geometry",+ description: "Polynomial smooth maximum for positive-inside implicit fields. Compose inside implicitSurface callbacks.",+ example: "smoothUnion(sphereInside(p,[0,0,0],0.5), sphereInside(p,[0.3,0,0],0.4), 0.12)"+ },+ {+ name: "sphereInside",+ signature: "sphereInside(point: [x,y,z], center: [x,y,z], radius: number)",+ returns: "number",+ category: "geometry",+ description: "Positive-inside sphere field sample for implicitSurface. Returns radius minus distance to center.",+ example: "sphereInside(p, [0,0.4,0], 0.25)"}];});@@ -31143,7 +31446,7 @@ var init_kit = __esm(() => {// src/texture-bake.tsimport { createHash as createHash11 } from "node:crypto";-import * as THREE49 from "three";+import * as THREE50 from "three";function readPixels(texture) {const image = texture.image;if (!image)@@ -31270,7 +31573,7 @@ async function bakeSceneTextures(root, warnings) {mime: "image/png",bytes};- const colorSpace = entry.texture.colorSpace === THREE49.SRGBColorSpace ? "srgb" : "linear";+ const colorSpace = entry.texture.colorSpace === THREE50.SRGBColorSpace ? "srgb" : "linear";const recipe = entry.texture.userData["kilnProcedural"];const primaryUsage = atlasRecord?.spec.usage ?? recipe?.usage ?? (entry.bindings.some(({ slot }) => slot === "roughnessMap") && entry.bindings.some(({ slot }) => slot === "metalnessMap") ? "metallicRoughness" : entry.bindings[0]?.usage ?? "albedo");if (!encoded)@@ -31353,10 +31656,10 @@ function computeTangentBasis(geometry) {}}const out = new Float32Array(vertexCount * 4);- const n = new THREE49.Vector3;- const t = new THREE49.Vector3;- const tmp = new THREE49.Vector3;- const tmp2 = new THREE49.Vector3;+ const n = new THREE50.Vector3;+ const t = new THREE50.Vector3;+ const tmp = new THREE50.Vector3;+ const tmp2 = new THREE50.Vector3;for (let v = 0;v < vertexCount; v++) {n.set(normal.getX(v), normal.getY(v), normal.getZ(v));t.set(tan1[v * 3], tan1[v * 3 + 1], tan1[v * 3 + 2]);@@ -31376,7 +31679,7 @@ function computeTangentBasis(geometry) {out[v * 4 + 2] = tmp.z;out[v * 4 + 3] = w;}- geometry.setAttribute("tangent", new THREE49.BufferAttribute(out, 4));+ geometry.setAttribute("tangent", new THREE50.BufferAttribute(out, 4));}function ensureNormalMapTangents(root, warnings) {let count = 0;@@ -31494,7 +31797,7 @@ var init_exporter_node = __esm(() => {});// src/views/character.ts-import * as THREE50 from "three";+import * as THREE51 from "three";function rounded(value) {const result = Math.round(value * 1e9) / 1e9;return Object.is(result, -0) ? 0 : result;@@ -31536,9 +31839,9 @@ function buildCharacterDiagnosticDescriptor(root, findings = []) {const invalidPaths = new Set(invalidFindingNodePaths);const joints = evidence.map((joint) => {const relative = rootInverse.clone().multiply(joint.node.matrixWorld);- const position = new THREE50.Vector3().setFromMatrixPosition(relative);- const forward = new THREE50.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);- const bend = new THREE50.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);+ const position = new THREE51.Vector3().setFromMatrixPosition(relative);+ const forward = new THREE51.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);+ const bend = new THREE51.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);const chainId = chainIdFor(joint.descriptor, descriptorByRole);return {role: joint.descriptor.role,@@ -32923,7 +33226,7 @@ function prepareTriangleCoverage(ax, ay, bx, by, cx, cy, size) {}// src/views/raster.ts-import { Vector3 as Vector337 } from "three";+import { Vector3 as Vector338 } from "three";function orbitDir(azimuthDeg, elevationDeg) {const el = Math.min(MAX_ELEVATION_DEG, Math.max(MIN_ELEVATION_DEG, elevationDeg)) * Math.PI / 180;const az = azimuthDeg * Math.PI / 180;@@ -32958,7 +33261,7 @@ function updateSurfaceMatrices(root) {function surfaceVertexReader(mesh, position) {for (const bone of mesh.skeleton?.bones ?? [])bone.updateWorldMatrix?.(true, false);- const vertex = new Vector337;+ const vertex = new Vector338;if (mesh.getVertexPosition)return (index) => mesh.getVertexPosition(index, vertex);if (position.getX && position.getY && position.getZ)@@ -33368,7 +33671,7 @@ function cloneReviewScene(root, options = {}) {var init_scene_copy = () => {};// src/views/camera.ts-import { Vector3 as Vector338, Matrix4 as Matrix417, Euler as Euler5, Group as Group4 } from "three";+import { Vector3 as Vector339, Matrix4 as Matrix417, Euler as Euler5, Group as Group4 } from "three";function strict(value, keys, label) {for (const key of Object.keys(value))if (!keys.includes(key)) {@@ -33462,14 +33765,14 @@ function cameraFromBounds(bounds, dir, padding = 1, up, sceneBounds = bounds) {const z = vec(dir).normalize();if (!z.length())throw new Error("camera direction must be non-zero");- const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector338(0, 0, -1) : new Vector338(0, 1, 0);+ const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector339(0, 0, -1) : new Vector339(0, 1, 0);const x = hint.clone().cross(z).normalize();if (x.length() < 0.000000001)throw new Error("camera up must not be collinear with view");const y = z.clone().cross(x);let extent = 0.000001;for (let i = 0;i < 8; i++) {- const p = new Vector338((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);+ const p = new Vector339((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);extent = Math.max(extent, Math.abs(p.dot(x)), Math.abs(p.dot(y)));}const depthMin = bounds.min.map((v, i) => Math.min(v, sceneBounds.min[i]));@@ -33550,7 +33853,7 @@ function resolveAssetCamera(root, shot = {}) {if (relative !== "world") {const node = relative === "part" ? selected.node : rootNode;dir.transformDirection(node.matrixWorld);- up = tuple6(new Vector338(0, 1, 0).transformDirection(node.matrixWorld));+ up = tuple6(new Vector339(0, 1, 0).transformDirection(node.matrixWorld));}camera = cameraFromBounds(bounds, tuple6(dir), request.padding ?? 1.2, up, measureBounds(root));} else if (request.type === "explicit") {@@ -33597,7 +33900,7 @@ function resolveAssetCamera(root, shot = {}) {const position = vec(triple2(request.position, "position")).applyMatrix4(matrix);const target = request.target ? vec(triple2(request.target, "target")).applyMatrix4(matrix) : vec(bounds.min).add(vec(bounds.max)).multiplyScalar(0.5);const up = vec(triple2(request.up ?? [0, 1, 0], "up")).transformDirection(matrix);- const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector338().setFromMatrixPosition(matrix));+ const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector339().setFromMatrixPosition(matrix));const radius = vec(bounds.max).sub(vec(bounds.min)).length();camera = {version: "kiln.camera.v1",@@ -33726,11 +34029,11 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)}return result;};- const key = new Vector338(1.5, 2, 1).normalize();+ const key = new Vector339(1.5, 2, 1).normalize();const srgb = (n) => n <= 0.0031308 ? n * 12.92 : 1.055 * n ** (1 / 2.4) - 0.055;const ordered = compositingOrder(collectTriangles(root).tris, (px, py, pz) => camera.projection === "perspective" ? Math.hypot(px - position.x, py - position.y, pz - position.z) : (position.x - px) * z.x + (position.y - py) * z.y + (position.z - pz) * z.z);for (const tri of ordered) {- const world = [0, 1, 2].map((i) => new Vector338(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));+ const world = [0, 1, 2].map((i) => new Vector339(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));const normal = world[1].clone().sub(world[0]).cross(world[2].clone().sub(world[0])).normalize().multiplyScalar(tri.windingParity);const normalSign = visibleNormalSign(normal.dot(camera.projection === "perspective" ? position.clone().sub(world[0]) : z), tri.side, backfaceCull);if (normalSign === 0)@@ -33741,7 +34044,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)const color = tri.color.map((c) => Math.round(srgb(c * light) * 255));let polygon = world.map((p) => {const d = p.clone().sub(position);- return new Vector338(d.dot(x), d.dot(y), -d.dot(z));+ return new Vector339(d.dot(x), d.dot(y), -d.dot(z));});polygon = clip(clip(polygon, camera.near, true), camera.far, false);for (let t = 1;t < polygon.length - 1; t++) {@@ -33773,7 +34076,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)}return out;}-var vec = (a) => new Vector338(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;+var vec = (a) => new Vector339(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;var init_camera = __esm(() => {init_raster();init_background();@@ -34544,11 +34847,11 @@ import {PropertyBinding as PropertyBinding3,VectorKeyframeTrack as VectorKeyframeTrack2,Quaternion as Quaternion20,- Vector3 as Vector339,+ Vector3 as Vector340,InterpolateDiscrete as InterpolateDiscrete2,InterpolateLinear as InterpolateLinear2} from "three";-function record8(value) {+function record9(value) {return typeof value === "object" && value !== null && !Array.isArray(value);}function withLoopIntent(clip, intent) {@@ -34557,10 +34860,10 @@ function withLoopIntent(clip, intent) {return clip;}function reviewClipsFromExtras(extras) {- if (!record8(extras))+ if (!record9(extras))return;const envelope = extras[REVIEW_CLIPS_EXTRAS_KEY];- if (!record8(envelope) || envelope.version !== 1 && envelope.version !== 2 || !Array.isArray(envelope.clips)) {+ if (!record9(envelope) || envelope.version !== 1 && envelope.version !== 2 || !Array.isArray(envelope.clips)) {return;}const cubicAllowed = envelope.version === 2;@@ -34569,12 +34872,12 @@ function reviewClipsFromExtras(extras) {}let trackCount = 0;return envelope.clips.map((candidate) => {- if (!record8(candidate) || typeof candidate.name !== "string" || candidate.name.length > 256 || typeof candidate.duration !== "number" || !Number.isFinite(candidate.duration) || candidate.duration < 0 || !Array.isArray(candidate.tracks)) {+ if (!record9(candidate) || typeof candidate.name !== "string" || candidate.name.length > 256 || typeof candidate.duration !== "number" || !Number.isFinite(candidate.duration) || candidate.duration < 0 || !Array.isArray(candidate.tracks)) {throw new GlbGeometryFlatError("GLB_FLAT_PARSE_FAILED", "Invalid animation review clip.");}const tracks = candidate.tracks.map((track) => {trackCount++;- if (trackCount > REVIEW_CLIP_LIMITS.tracks || !record8(track) || typeof track.name !== "string" || track.name.length > 512 || !Array.isArray(track.times) || !Array.isArray(track.values) || track.interpolation !== undefined && track.interpolation !== "LINEAR" && track.interpolation !== "STEP" && !(cubicAllowed && track.interpolation === "CUBICSPLINE") || track.times.length > REVIEW_CLIP_LIMITS.samplesPerTrack || track.values.length > REVIEW_CLIP_LIMITS.valuesPerTrack || !track.times.every((value) => typeof value === "number" && Number.isFinite(value)) || !track.values.every((value) => typeof value === "number" && Number.isFinite(value))) {+ if (trackCount > REVIEW_CLIP_LIMITS.tracks || !record9(track) || typeof track.name !== "string" || track.name.length > 512 || !Array.isArray(track.times) || !Array.isArray(track.values) || track.interpolation !== undefined && track.interpolation !== "LINEAR" && track.interpolation !== "STEP" && !(cubicAllowed && track.interpolation === "CUBICSPLINE") || track.times.length > REVIEW_CLIP_LIMITS.samplesPerTrack || track.values.length > REVIEW_CLIP_LIMITS.valuesPerTrack || !track.times.every((value) => typeof value === "number" && Number.isFinite(value)) || !track.values.every((value) => typeof value === "number" && Number.isFinite(value))) {throw new GlbGeometryFlatError("GLB_FLAT_PARSE_FAILED", "Invalid animation review track.");}const property = track.name.slice(track.name.lastIndexOf(".") + 1);@@ -34728,7 +35031,7 @@ function instanceMatrices(node) {translations?.getElement(index, translation);rotations?.getElement(index, rotation);scales?.getElement(index, scale);- const local = new Matrix418().compose(new Vector339(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion20(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector339(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));+ const local = new Matrix418().compose(new Vector340(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion20(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector340(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));matrices.push(world.clone().multiply(local));}return { matrices, count };@@ -34835,7 +35138,7 @@ function localInstanceMatrices(node) {translations?.getElement(index, translation);rotations?.getElement(index, rotation);scales?.getElement(index, scale);- return new Matrix418().compose(new Vector339(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion20(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector339(...scales ? scale.slice(0, 3) : [1, 1, 1]));+ return new Matrix418().compose(new Vector340(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion20(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector340(...scales ? scale.slice(0, 3) : [1, 1, 1]));});}async function loadGlbReviewScene(bytes) {@@ -34917,10 +35220,14 @@ function reviewSceneFromDocument(document) {if (normal) {geometry.setAttribute("normal", new BufferAttribute12(Float32Array.from(decodedAccessor(normal)), 3));}- const uv = primitive.getAttribute("TEXCOORD_0");- if (uv) {- geometry.setAttribute("uv", new BufferAttribute12(Float32Array.from(decodedAccessor(uv)), 2));+ for (let channel = 0;channel < 4; channel++) {+ const uv = primitive.getAttribute(`TEXCOORD_${channel}`);+ if (uv)+ geometry.setAttribute(channel ? `uv${channel}` : "uv", new BufferAttribute12(Float32Array.from(decodedAccessor(uv)), 2));}+ const color = primitive.getAttribute("COLOR_0");+ if (color)+ geometry.setAttribute("color", new BufferAttribute12(Float32Array.from(decodedAccessor(color)), color.getElementSize()));const tangent = primitive.getAttribute("TANGENT");if (tangent) {geometry.setAttribute("tangent", new BufferAttribute12(Float32Array.from(decodedAccessor(tangent)), 4));@@ -34966,6 +35273,7 @@ function reviewSceneFromDocument(document) {geometry.setAttribute("skinWeight", new BufferAttribute12(Float32Array.from(decodedAccessor(skinWeights)), 4));}const threeMaterial = new MeshStandardMaterial5({+ vertexColors: color !== null,opacity: flat.opacity,transparent: flat.alphaMode === "BLEND",alphaTest: flat.alphaMode === "MASK" ? flat.alphaCutoff : 0,@@ -35150,6 +35458,7 @@ var init_glb = __esm(() => {// src/evaluator/handler.tsvar init_handler = __esm(() => {init_authoring_diagnostic();+ init_solid_diagnostic();init_render();init_run();init_protocol();@@ -35427,7 +35736,7 @@ var init_renderer_id = __esm(() => {});// src/views/scene-raster.ts-import * as THREE51 from "three";+import * as THREE52 from "three";var DEG2;var init_scene_raster = __esm(() => {init_evaluator();@@ -35439,18 +35748,18 @@ var init_scene_raster = __esm(() => {});// src/views/vehicle.ts-import * as THREE52 from "three";+import * as THREE53 from "three";function hasRole2(node, prefix) {return readSemanticMetadataV1(node)?.roles.some((role) => role === prefix || role.startsWith(`${prefix}.`)) ?? false;}function chassisBounds(root, inverse) {- const bounds = new THREE52.Box3;+ const bounds = new THREE53.Box3;let found = false;root.traverse((node) => {if (!hasRole2(node, "chassis"))return;node.traverse((part) => {- if (!(part instanceof THREE52.Mesh) || !(part.geometry instanceof THREE52.BufferGeometry))+ if (!(part instanceof THREE53.Mesh) || !(part.geometry instanceof THREE53.BufferGeometry))return;part.geometry.computeBoundingBox();const box = part.geometry.boundingBox;@@ -35460,7 +35769,7 @@ function chassisBounds(root, inverse) {for (const x of [box.min.x, box.max.x])for (const y of [box.min.y, box.max.y])for (const z of [box.min.z, box.max.z]) {- bounds.expandByPoint(new THREE52.Vector3(x, y, z).applyMatrix4(matrix));+ bounds.expandByPoint(new THREE53.Vector3(x, y, z).applyMatrix4(matrix));found = true;}});@@ -35528,33 +35837,33 @@ function tagDiagnostic(node, role) {stampSemanticMetadataV1(node, { roles: [role] });}function rod(name, start, end, radius, color, role) {- const from = new THREE52.Vector3(...start);- const to = new THREE52.Vector3(...end);+ const from = new THREE53.Vector3(...start);+ const to = new THREE53.Vector3(...end);const direction = to.clone().sub(from);const length = direction.length();- const geometry = length > 0.000000001 ? new THREE52.CylinderGeometry(radius, radius, length, 8) : new THREE52.SphereGeometry(radius, 8, 6);- const result = new THREE52.Mesh(geometry, new THREE52.MeshBasicMaterial({ color }));+ const geometry = length > 0.000000001 ? new THREE53.CylinderGeometry(radius, radius, length, 8) : new THREE53.SphereGeometry(radius, 8, 6);+ const result = new THREE53.Mesh(geometry, new THREE53.MeshBasicMaterial({ color }));result.name = name;result.position.copy(from).add(to).multiplyScalar(0.5);if (length > 0.000000001) {- result.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));+ result.quaternion.setFromUnitVectors(new THREE53.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));}tagDiagnostic(result, role);return result;}function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnostics(root)) {- const overlay = new THREE52.Group;+ const overlay = new THREE53.Group;overlay.name = "VehicleDiagnosticOverlay";const chassisSpan = descriptor.chassisBox ? Math.max(descriptor.chassisBox.max[0] - descriptor.chassisBox.min[0], descriptor.chassisBox.max[1] - descriptor.chassisBox.min[1], descriptor.chassisBox.max[2] - descriptor.chassisBox.min[2]) : 1;const thickness = Math.max(0.01, chassisSpan * 0.008);- const arrow = new THREE52.Group;+ const arrow = new THREE53.Group;arrow.name = "Diagnostic_Forward_+X";tagDiagnostic(arrow, "diagnostic.vehicle.forward");arrow.add(rod("Diagnostic_Forward_Shaft", descriptor.forwardArrow.start, [descriptor.forwardArrow.end[0] - 0.12, 0, 0], thickness, 16724804, "diagnostic.vehicle.forward"));- const arrowHead = new THREE52.Mesh(new THREE52.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE52.MeshBasicMaterial({ color: 16724804 }));+ const arrowHead = new THREE53.Mesh(new THREE53.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE53.MeshBasicMaterial({ color: 16724804 }));arrowHead.name = "Diagnostic_Forward_Head";arrowHead.position.set(descriptor.forwardArrow.end[0] - 0.12, 0, 0);- arrowHead.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 1, 0), new THREE52.Vector3(1, 0, 0));+ arrowHead.quaternion.setFromUnitVectors(new THREE53.Vector3(0, 1, 0), new THREE53.Vector3(1, 0, 0));tagDiagnostic(arrowHead, "diagnostic.vehicle.forward");arrow.add(arrowHead);overlay.add(arrow);@@ -35562,18 +35871,18 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnooverlay.add(rod(`Diagnostic_Axle_${axle.id}`, axle.start, axle.end, thickness, 3386111, `diagnostic.vehicle.axle.${axle.id}`));}for (const wheel of descriptor.wheels) {- const ring = new THREE52.Mesh(new THREE52.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE52.MeshBasicMaterial({ color: 16763955 }));+ const ring = new THREE53.Mesh(new THREE53.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE53.MeshBasicMaterial({ color: 16763955 }));ring.name = `Diagnostic_Wheel_${wheel.id}`;ring.position.set(...wheel.center);- const axle = new THREE52.Vector3(...wheel.axle);+ const axle = new THREE53.Vector3(...wheel.axle);if (axle.lengthSq() > 0.000000000001) {- ring.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 0, 1), axle.normalize());+ ring.quaternion.setFromUnitVectors(new THREE53.Vector3(0, 0, 1), axle.normalize());}tagDiagnostic(ring, `diagnostic.vehicle.wheel.${wheel.id}`);overlay.add(ring);}if (descriptor.chassisBox) {- const chassis = new THREE52.Group;+ const chassis = new THREE53.Group;chassis.name = "Diagnostic_ChassisBox";tagDiagnostic(chassis, "diagnostic.vehicle.chassis");const { min, max } = descriptor.chassisBox;@@ -35607,7 +35916,7 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnooverlay.add(chassis);}if (descriptor.supportPlaneY !== undefined) {- const plane = new THREE52.Group;+ const plane = new THREE53.Group;plane.name = "Diagnostic_SupportPlane";tagDiagnostic(plane, "diagnostic.vehicle.support-plane");const halfX = Math.max(1, ...descriptor.chassisBox ? [Math.abs(descriptor.chassisBox.min[0]), Math.abs(descriptor.chassisBox.max[0])] : [], ...descriptor.wheels.map((wheel) => Math.abs(wheel.center[0]) + wheel.radius)) + 0.2;@@ -36205,7 +36514,7 @@ var init_views = __esm(() => {});// src/views/character-capture.ts-import * as THREE53 from "three";+import * as THREE54 from "three";function drawLine2(rgb, width, height, from, to, color) {let x0 = Math.round(from[0]);let y0 = Math.round(from[1]);@@ -36242,22 +36551,22 @@ function drawCross(rgb, width, height, point, color, radius = 3) {}function projector(root, cameraId, size) {root.updateMatrixWorld(true);- const bounds = new THREE53.Box3().setFromObject(root);+ const bounds = new THREE54.Box3().setFromObject(root);if (bounds.isEmpty())- bounds.set(new THREE53.Vector3(-0.5, 0, -0.5), new THREE53.Vector3(0.5, 1, 0.5));- const center = bounds.getCenter(new THREE53.Vector3);- const camera = cameraId === "front" ? new THREE53.Vector3(1, 0, 0) : new THREE53.Vector3(0, 0, 1);- const upHint = new THREE53.Vector3(0, 1, 0);- const xAxis = new THREE53.Vector3().crossVectors(upHint, camera).normalize();- const yAxis = new THREE53.Vector3().crossVectors(camera, xAxis).normalize();+ bounds.set(new THREE54.Vector3(-0.5, 0, -0.5), new THREE54.Vector3(0.5, 1, 0.5));+ const center = bounds.getCenter(new THREE54.Vector3);+ const camera = cameraId === "front" ? new THREE54.Vector3(1, 0, 0) : new THREE54.Vector3(0, 0, 1);+ const upHint = new THREE54.Vector3(0, 1, 0);+ const xAxis = new THREE54.Vector3().crossVectors(upHint, camera).normalize();+ const yAxis = new THREE54.Vector3().crossVectors(camera, xAxis).normalize();let extent = 0.000001;for (let corner = 0;corner < 8; corner++) {- const point = new THREE53.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);+ const point = new THREE54.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);extent = Math.max(extent, Math.abs(point.dot(xAxis)), Math.abs(point.dot(yAxis)));}const scale = size * 0.45 / extent;return (assetPoint) => {- const world = new THREE53.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);+ const world = new THREE54.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);return [size / 2 + world.dot(xAxis) * scale, size / 2 - world.dot(yAxis) * scale];};}@@ -36383,7 +36692,7 @@ var init_character_capture = __esm(() => {});// src/render.ts-import * as THREE54 from "three";+import * as THREE55 from "three";import { Document, Logger as Logger2 } from "@gltf-transform/core";import { KHRMaterialsEmissiveStrength } from "@gltf-transform/extensions";import { dedup as dedup2, instance, palette, weld as weld2, prune, mergeDocuments } from "@gltf-transform/functions";@@ -36603,7 +36912,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)} else if (stdMat.transparent) {mat.setAlphaMode("BLEND");}- if (stdMat.side === THREE54.DoubleSide) {+ if (stdMat.side === THREE55.DoubleSide) {mat.setDoubleSided(true);}if (stdMat.map) {@@ -36680,7 +36989,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)} else if (common.transparent || (common.opacity ?? 1) < 1) {mat.setAlphaMode("BLEND");}- if (threeMat.side === THREE54.DoubleSide)+ if (threeMat.side === THREE55.DoubleSide)mat.setDoubleSided(true);if (common.map && !mat.getBaseColorTexture()) {const texture = bridgeTexture(doc, common.map, textureCache);@@ -36830,7 +37139,7 @@ function bridgeNode(doc, buf, threeObj, matCache, nodeMap, meshCache, texCache,const cacheKey = `kiln-sprite-quad:${centerX}:${centerY}:${rotation}__${threeMat.uuid}`;let gtMesh = meshCache.get(cacheKey);if (!gtMesh) {- const geometry = new THREE54.PlaneGeometry(1, 1);+ const geometry = new THREE55.PlaneGeometry(1, 1);if (centerX !== 0.5 || centerY !== 0.5) {geometry.translate(0.5 - centerX, 0.5 - centerY, 0);}@@ -36854,9 +37163,9 @@ function animationInterpolation(track) {if (isCubicSplineTrack(track))return "CUBICSPLINE";const mode = track.getInterpolation();- if (mode === THREE54.InterpolateDiscrete)+ if (mode === THREE55.InterpolateDiscrete)return "STEP";- if (mode === THREE54.InterpolateLinear)+ if (mode === THREE55.InterpolateLinear)return "LINEAR";throw new Error(`Unsupported animation interpolation on ${track.name}; use LINEAR, STEP or CUBICSPLINE.`);}@@ -37426,8 +37735,8 @@ function collectMeshStats(root) {if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {return;}- const center = new THREE54.Vector3;- const size = new THREE54.Vector3;+ const center = new THREE55.Vector3;+ const size = new THREE55.Vector3;box.getCenter(center);box.getSize(size);out.push({@@ -37442,7 +37751,7 @@ function collectMeshStats(root) {return out;}function minimalGapVector(a, b) {- const v = new THREE54.Vector3;+ const v = new THREE55.Vector3;for (const axis of ["x", "y", "z"]) {if (a.min[axis] > b.max[axis])v[axis] = b.max[axis] - a.min[axis];@@ -37460,10 +37769,10 @@ function inspectSceneStructure(root, opts = {}) {return warnings;const cat = opts.category?.toLowerCase();if (cat === "vehicle" || cat === "weapon" || cat === "boat" || cat === "aircraft") {- const all = new THREE54.Box3;+ const all = new THREE55.Box3;for (const m of meshes)all.union(m.box);- const size = new THREE54.Vector3;+ const size = new THREE55.Vector3;all.getSize(size);if (cat === "aircraft") {if (size.y > size.x * 1.2) {@@ -37573,18 +37882,18 @@ var init_render = __esm(() => {init_texture_bake();engineIO = createGltfIO;GLTF_MIN_FILTER = {- [THREE54.NearestFilter]: 9728,- [THREE54.LinearFilter]: 9729,- [THREE54.NearestMipmapNearestFilter]: 9984,- [THREE54.LinearMipmapNearestFilter]: 9985,- [THREE54.NearestMipmapLinearFilter]: 9986,- [THREE54.LinearMipmapLinearFilter]: 9987- };- GLTF_MAG_FILTER = { [THREE54.NearestFilter]: 9728, [THREE54.LinearFilter]: 9729 };+ [THREE55.NearestFilter]: 9728,+ [THREE55.LinearFilter]: 9729,+ [THREE55.NearestMipmapNearestFilter]: 9984,+ [THREE55.LinearMipmapNearestFilter]: 9985,+ [THREE55.NearestMipmapLinearFilter]: 9986,+ [THREE55.LinearMipmapLinearFilter]: 9987+ };+ GLTF_MAG_FILTER = { [THREE55.NearestFilter]: 9728, [THREE55.LinearFilter]: 9729 };GLTF_WRAP = {- [THREE54.ClampToEdgeWrapping]: 33071,- [THREE54.MirroredRepeatWrapping]: 33648,- [THREE54.RepeatWrapping]: 10497+ [THREE55.ClampToEdgeWrapping]: 33071,+ [THREE55.MirroredRepeatWrapping]: 33648,+ [THREE55.RepeatWrapping]: 10497};REVIEW_CLIP_LIMITS2 = {clips: 32,@@ -37673,7 +37982,7 @@ function decodeEvaluatorResultV2(json, maxGlbBytes, expectedRequestId) {if (!value.ok) {if (value.render !== undefined)return fail9("result");- if (!isRecord5(value.error) || !hasExactKeys(value.error, ["code", "message", "qa", "diagnostic"])) {+ if (!isRecord5(value.error) || !hasExactKeys(value.error, ["code", "message", "qa", "diagnostic", "solid"])) {return fail9("result");}const codes = [@@ -37692,6 +38001,8 @@ function decodeEvaluatorResultV2(json, maxGlbBytes, expectedRequestId) {}if (value.error.diagnostic !== undefined && (value.error.code !== "EXECUTION_REJECTED" || value.error.diagnostic !== "UNBOUND_VARIABLE" && value.error.diagnostic !== "GEAR_RADII_ORDER" && value.error.diagnostic !== "ROUNDED_BOX_RADIUS" && value.error.diagnostic !== "PROCEDURAL_TEXTURE_UNKNOWN_KEY" && value.error.diagnostic !== "PROCEDURAL_TEXTURE_BLEND" && value.error.diagnostic !== "PROCEDURAL_TEXTURE_V3_CONTRACT" && value.error.diagnostic !== "PORTABLE_MATERIAL_V3_CONTRACT" && value.error.diagnostic !== "TEXTURE_ATLAS_CONTRACT" && value.error.diagnostic !== "MATERIAL_FRACTION_RANGE" && value.error.diagnostic !== "MATERIAL_RECIPE_TEXTURE_BINDING" && value.error.diagnostic !== "PORTABLE_TEXTURE_REFERENCE" && value.error.diagnostic !== "PORTABLE_COLOR_ARGUMENT" && value.error.diagnostic !== "PARAMETRIC_PERIODIC_ENDPOINT" && value.error.diagnostic !== "PROFILE_HOLES_UNSUPPORTED" && value.error.diagnostic !== "PROFILE_BEVEL_COLLAPSE" && value.error.diagnostic !== "PROFILE_CORRESPONDENCE_COLLAPSE" && value.error.diagnostic !== "REMOVED_HELPER" && value.error.diagnostic !== "TUBE_RADIUS" && value.error.diagnostic !== "TAPER_CONE_AXIS" && value.error.diagnostic !== "SOLID_FLOAT32_COLLAPSE" && value.error.diagnostic !== "MESH_DATA_NONFINITE" && value.error.diagnostic !== "MATERIAL_ALPHA_MODE" && value.error.diagnostic !== "MATERIAL_COLOR_ARGUMENT" && value.error.diagnostic !== "PART_NAME_ARGUMENT" && value.error.diagnostic !== "PART_GEOMETRY_ARGUMENT" && value.error.diagnostic !== "PART_MATERIAL_ARGUMENT" && value.error.diagnostic !== "MATERIAL_PACKED_CHANNELS" && value.error.diagnostic !== "UNINITIALIZED_BINDING" && value.error.diagnostic !== "BUILD_RESULT" && value.error.diagnostic !== "MATERIAL_RECIPE_OVERRIDE" && value.error.diagnostic !== "PROGRAM_TYPE_ERROR" && value.error.diagnostic !== "PROGRAM_RANGE_ERROR" && value.error.diagnostic !== "LOD_SET" && value.error.diagnostic !== "OPEN_SHELL" && value.error.diagnostic !== "DELIVERY_CONTRACT" && value.error.diagnostic !== "REQUIRE_SOLID" && value.error.diagnostic !== "EXPORT_MATERIAL_SIDE_UNSUPPORTED" && value.error.diagnostic !== "BONE_CHAIN_ARGUMENT" && value.error.diagnostic !== "SKIN_BINDING_ARGUMENT"))return fail9("result");+ if (value.error.solid !== undefined && (value.error.diagnostic !== "REQUIRE_SOLID" || !validSolidFailureDetails(value.error.solid)))+ return fail9("result");if (value.error.qa !== undefined) {if (value.error.code !== "QA_BLOCKED" || !isRecord5(value.error.qa) || !hasExactKeys(value.error.qa, ["report", "stage", "gltfValidation"]) || !validRequirementsQaReport(value.error.qa.report) || !["scene", "final-glb"].includes(String(value.error.qa.stage)) || value.error.qa.gltfValidation !== undefined && !validGltfValidation(value.error.qa.gltfValidation)) {return fail9("result");@@ -37802,6 +38113,7 @@ var init_protocol = __esm(() => {init_material_library_node();init_material_library();init_rebuild_options();+ init_solid_diagnostic();MAX_EVALUATOR_CODE_BYTES = 512 * 1024;MAX_EVALUATOR_REQUEST_BYTES = 24 * 1024 * 1024;DEFAULT_EVALUATOR_MAX_GLB_BYTES = 16 * 1024 * 1024;@@ -37820,10 +38132,12 @@ var init_protocol = __esm(() => {EvaluatorPortError = class EvaluatorPortError extends Error {code;diagnostic;- constructor(code, message = evaluatorOutcomeMessage(code), diagnostic) {- super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);+ solid;+ constructor(code, message = evaluatorOutcomeMessage(code), diagnostic, solid) {+ super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}${solidFailureAdvice(solid)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);this.code = code;this.diagnostic = diagnostic;+ this.solid = solid;this.name = "EvaluatorPortError";}};@@ -37997,7 +38311,7 @@ async function renderGLBViaProcessLaunch(code, options = {}, controls = {}, launfinish(new AssetQaBlockedError(result.error.qa.report, result.error.qa.stage, result.error.qa.gltfValidation));return;}- finish(new EvaluatorSubprocessError(result.error.code, evaluatorOutcomeMessage(result.error.code), result.error.diagnostic));+ finish(new EvaluatorSubprocessError(result.error.code, evaluatorOutcomeMessage(result.error.code), result.error.diagnostic, result.error.solid));return;}finish(undefined, result.render);@@ -38015,6 +38329,7 @@ async function renderGLBViaSubprocess(code, options = {}, controls = {}) {var DEFAULT_DEADLINE_MS = 60000, DEFAULT_MAX_GLB_BYTES, DEFAULT_MAX_RESPONSE_BYTES, MAX_STDERR_BYTES, EvaluatorSubprocessError;var init_subprocess = __esm(() => {init_authoring_diagnostic();+ init_solid_diagnostic();init_run();init_requirements_context();init_material_library_node();@@ -38024,10 +38339,12 @@ var init_subprocess = __esm(() => {MAX_STDERR_BYTES = 16 * 1024;EvaluatorSubprocessError = class EvaluatorSubprocessError extends Error {diagnostic;+ solid;code;- constructor(code, message, diagnostic) {- super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);+ constructor(code, message, diagnostic, solid) {+ super(diagnostic ? `${message} ${authoringDiagnosticAdvice(diagnostic)}${solidFailureAdvice(solid)}` : code === "EXECUTION_REJECTED" ? `${message} ${EXECUTION_REJECTED_ADVICE}` : message);this.diagnostic = diagnostic;+ this.solid = solid;this.name = "EvaluatorSubprocessError";this.code = code;}@@ -38563,7 +38880,7 @@ async function captureViewsViaPort(port, glb, timeoutMs = DEFAULT_VIEW_RENDER_TIlet rendererId = "";const grid = await renderCaptureGrid(loaded.root, capture, async (input) => {execution?.signal?.throwIfAborted();- const derivative = await renderSceneToGLB(withoutHiddenMeshes(input.root), { derivative: true });+ const derivative = await renderSceneToGLB(withoutHiddenMeshes(input.root), { derivative: true, gltfExporter: "three" });const result = await captureViewPngsViaPort(port, derivative.bytes, timeoutMs, [input.view.dir], input.size, [input.camera], limits, input.backdrop, execution);if (!result.ok)throw new Error(result.reason);@@ -38665,12 +38982,12 @@ var exports_part_placement = {};__export(exports_part_placement, {createPartPlacementReader: () => createPartPlacementReader});-import * as THREE55 from "three";+import * as THREE56 from "three";function createPartPlacementReader(root) {const bounds = createPartBoundsReader(root);- const position = new THREE55.Vector3;- const quaternion = new THREE55.Quaternion;- const scale = new THREE55.Vector3;+ const position = new THREE56.Vector3;+ const quaternion = new THREE56.Quaternion;+ const scale = new THREE56.Vector3;return (node) => {node.matrixWorld.decompose(position, quaternion, scale);const box = bounds(node);@@ -38821,7 +39138,7 @@ var init_inspect = __esm(() => {});// src/views/measurement.ts-import { Box3 as Box326, Vector3 as Vector344 } from "three";+import { Box3 as Box326, Vector3 as Vector345 } from "three";function describeSubjectFrame(root, subject) {const selected = selectCameraSubject(root, subject);selected.node.updateWorldMatrix(true, true);@@ -38838,10 +39155,10 @@ function describeSubjectFrame(root, subject) {if (!attr)return;for (let i = 0;i < attr.count; i++)- local.expandByPoint(new Vector344().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));+ local.expandByPoint(new Vector345().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));});const box = (b) => b.isEmpty() ? null : { min: b.min.toArray(), max: b.max.toArray() };- const axis = (i) => new Vector344().setFromMatrixColumn(matrix, i).normalize().toArray();+ const axis = (i) => new Vector345().setFromMatrixColumn(matrix, i).normalize().toArray();return {path: selected.path,name: selected.name,@@ -38851,7 +39168,7 @@ function describeSubjectFrame(root, subject) {invertible,worldMatrix: matrix.toArray(),axes: { frame: "world", x: axis(0), y: axis(1), z: axis(2) },- origin: new Vector344().setFromMatrixPosition(matrix).toArray()+ origin: new Vector345().setFromMatrixPosition(matrix).toArray()};}function measureAttachment(root, input) {@@ -38864,7 +39181,7 @@ function measureAttachment(root, input) {return {path: selected.path,local: [...local],- world: new Vector344(...local).applyMatrix4(selected.node.matrixWorld).toArray()+ world: new Vector345(...local).applyMatrix4(selected.node.matrixWorld).toArray()};};const from = endpoint(input.from), to = endpoint(input.to);@@ -38874,7 +39191,7 @@ function measureAttachment(root, input) {method: "straight-line anchor distance",from,to,- distance: new Vector344(...from.world).distanceTo(new Vector344(...to.world))+ distance: new Vector345(...from.world).distanceTo(new Vector345(...to.world))};}var init_measurement = __esm(() => {@@ -38886,7 +39203,7 @@ import {PropertyType as PropertyType6} from "@gltf-transform/core";import { ALL_EXTENSIONS as ALL_EXTENSIONS2 } from "@gltf-transform/extensions";-import { Box3 as Box327, Matrix4 as Matrix419, Vector3 as Vector345 } from "three";+import { Box3 as Box327, Matrix4 as Matrix419, Vector3 as Vector346 } from "three";async function accessorFingerprint(accessor) {const array = accessor?.getArray();if (!accessor || !array)@@ -38905,7 +39222,7 @@ function bounds(box) {return box.isEmpty() ? null : {min: box.min.toArray(),max: box.max.toArray(),- size: box.getSize(new Vector345).toArray()+ size: box.getSize(new Vector346).toArray()};}async function digest8(bytes) {@@ -38977,7 +39294,7 @@ async function snapshot3(bytes) {if (!Number.isInteger(vertex) || vertex < 0 || vertex >= position.getCount())throw new Error("Revision comparison found an invalid vertex index.");position.getElement(vertex, element);- const point = new Vector345(...element).applyMatrix4(matrix);+ const point = new Vector346(...element).applyMatrix4(matrix);if (point.toArray().some((value) => !Number.isFinite(value)))throw new Error("Revision comparison requires finite positions.");own.expandByPoint(point);@@ -39171,7 +39488,7 @@ import {Matrix4 as Matrix420,Ray as Ray2,Triangle as Triangle2,- Vector3 as Vector346+ Vector3 as Vector347} from "three";function hierarchy(triangles) {const box = new Box328;@@ -39180,7 +39497,7 @@ function hierarchy(triangles) {const count = triangles.length;if (count <= 4)return { box, count, triangles };- const size = box.getSize(new Vector346);+ const size = box.getSize(new Vector347);const axis = size.x >= size.y && size.x >= size.z ? "x" : size.y >= size.z ? "y" : "z";const center = (triangle) => triangle.box.min[axis] / 2 + triangle.box.max[axis] / 2;triangles.sort((a, b) => center(a) - center(b));@@ -39232,7 +39549,7 @@ function collect(node, paths) {const id = index ? index.getX(i + offset) : i + offset;if (!Number.isSafeInteger(id) || id < 0 || id >= position.count)throw new Error("Surface distance encountered an invalid triangle index.");- const point = new Vector346().fromBufferAttribute(position, id).applyMatrix4(matrix);+ const point = new Vector347().fromBufferAttribute(position, id).applyMatrix4(matrix);if (![point.x, point.y, point.z].every(Number.isFinite))throw new Error("Surface distance encountered a non-finite world position.");return point;@@ -39291,10 +39608,10 @@ function trianglePair(a, b) {const av = [a.a, a.b, a.c], bv = [b.a, b.b, b.c];if (b.getArea() > 0)for (const p of av)- record(p, b.closestPointToPoint(p, new Vector346));+ record(p, b.closestPointToPoint(p, new Vector347));if (a.getArea() > 0)for (const q of bv)- record(a.closestPointToPoint(q, new Vector346), q);+ record(a.closestPointToPoint(q, new Vector347), q);for (let i = 0;i < 3; i++) {const p = av[i], q = av[(i + 1) % 3];for (let j = 0;j < 3; j++)@@ -39307,9 +39624,9 @@ function trianglePair(a, b) {const length = delta.length();if (length === 0)continue;- const hit = new Ray2(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector346);+ const hit = new Ray2(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector347);if (hit && origin.distanceTo(hit) <= length) {- const onFace = target.closestPointToPoint(hit, new Vector346);+ const onFace = target.closestPointToPoint(hit, new Vector347);if (vertices === av)record(hit, onFace);else@@ -39475,7 +39792,7 @@ __export(exports_draw_diagnostics, {});import { Primitive as Primitive3 } from "@gltf-transform/core";import { cloneDocument } from "@gltf-transform/functions";-import * as THREE56 from "three";+import * as THREE57 from "three";function withinLimits(doc) {const root = doc.getRoot();if (root.listNodes().length > MAX_NODES2 || root.listAccessors().length > 4096 || root.listMaterials().length > 2048 || root.listTextures().length > 256 || root.listScenes().length > 32 || doc.getGraph().listEdges().length > 32768)@@ -39528,7 +39845,7 @@ function collect2(doc, keep) {function overlaps(a, b) {if (Math.abs(a.normal.dot(b.normal)) < 1 - 0.00000001 || !a.bounds.intersectsBox(b.bounds))return false;- const tolerance = Math.max(a.bounds.getSize(new THREE56.Vector3).length(), b.bounds.getSize(new THREE56.Vector3).length(), 0.000000000001) * 0.000001;+ const tolerance = Math.max(a.bounds.getSize(new THREE57.Vector3).length(), b.bounds.getSize(new THREE57.Vector3).length(), 0.000000000001) * 0.000001;if (b.points.some((p) => Math.abs(a.normal.dot(p.clone().sub(a.points[0]))) > tolerance))return false;const normal = a.normal.toArray().map(Math.abs);@@ -39570,7 +39887,7 @@ function observe(uses) {unexaminedPrimitiveUses++;continue;}- const matrix = new THREE56.Matrix4().fromArray(node.getWorldMatrix());+ const matrix = new THREE57.Matrix4().fromArray(node.getWorldMatrix());if (primitive.getAttribute("TANGENT") && matrix.determinant() < 0)mirrored.set(part.id, part);const position = primitive.getAttribute("POSITION");@@ -39584,14 +39901,14 @@ function observe(uses) {const amount = Math.min(count, 8, MAX_SAMPLES - samples.length);for (let i = 0;i < amount; i++) {const start = Math.floor(i * count / amount) * 3;- const points = [0, 1, 2].map((j) => new THREE56.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));+ const points = [0, 1, 2].map((j) => new THREE57.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));const normal = points[1].clone().sub(points[0]).cross(points[2].clone().sub(points[0]));if (!Number.isFinite(normal.lengthSq()) || normal.lengthSq() === 0)continue;samples.push({points,normal: normal.normalize(),- bounds: new THREE56.Box3().setFromPoints(points),+ bounds: new THREE57.Box3().setFromPoints(points),part});}@@ -39665,7 +39982,26 @@ async function inspectDrawDiagnostics(bytes, options = {}) {if (bytes.byteLength > MAX_BYTES)return skipped("input-limit");try {- return analyzeDrawDiagnostics(await createGltfIO().readBinary(bytes), options);+ const io = createGltfIO();+ const json = await io.binaryToJSON(bytes);+ let expandedBytes = 0;+ let compressed = false;+ for (const view of json.json.bufferViews ?? []) {+ const extension = view.extensions?.["EXT_meshopt_compression"];+ compressed ||= extension !== undefined;+ const length = extension ? (extension.count ?? Number.NaN) * (extension.byteStride ?? Number.NaN) : view.byteLength;+ if (!Number.isSafeInteger(length) || length < 0)+ return skipped("unreadable-glb");+ expandedBytes += length;+ if (expandedBytes > MAX_BYTES)+ return skipped("input-limit");+ }+ if (compressed) {+ const { MeshoptDecoder } = await import("meshoptimizer");+ await MeshoptDecoder.ready;+ io.registerDependencies({ "meshopt.decoder": MeshoptDecoder });+ }+ return analyzeDrawDiagnostics(await io.readJSON(json), options);} catch {return skipped("unreadable-glb");}@@ -39812,32 +40148,8 @@ async function resolveSavedAssetMaterials(asset, library) {});}-// src/atomic-directory.ts-import { lstat as lstat2, rename as rename2 } from "node:fs/promises";-import { setTimeout as pause } from "node:timers/promises";-async function renameDirectoryAtomically(source, destination, controls = {}) {- const renameOperation = controls.renameOperation ?? rename2;- const platform = controls.platform ?? process.platform;- const wait = controls.pause ?? pause;- const delays = [20, 50, 100, 200, 400];- for (let attempt = 0;; attempt++) {- try {- await renameOperation(source, destination);- return;- } catch (error) {- const delay = delays[attempt];- const code = error?.code;- if (platform !== "win32" || delay === undefined || !["EPERM", "EACCES", "EBUSY"].includes(code ?? ""))- throw error;- const absent = await lstat2(destination).then(() => false, (statError) => statError.code === "ENOENT");- if (!absent)- throw error;- await wait(delay);- }- }-}-// src/assets-node.ts+init_atomic_directory();var digest2 = (bytes) => `sha256:${createHash3("sha256").update(bytes).digest("hex")}`;function assertMaterialAllocation(records) {let bytes = 0;@@ -40858,7 +41170,7 @@ import {lstat as lstat4,readdir as readdir3,readFile as readFile3,- rename as rename3,+ rename as rename2,rm as rm3,unlink,writeFile as writeFile3,@@ -41141,7 +41453,7 @@ class FileLiveReview {const temporary = `${path}.${randomUUID3()}.tmp`;try {await writeFile3(temporary, bytes, { flag: "wx", mode: 384 });- await rename3(temporary, path);+ await rename2(temporary, path);} finally {await unlink(temporary).catch((error) => {if (!missing(error))@@ -42113,7 +42425,7 @@ import {mkdir as mkdir5,readFile as readFile5,readdir as readdir5,- rename as rename4,+ rename as rename3,stat as stat2,unlink as unlink3,utimes,@@ -42167,7 +42479,7 @@ class FileBuildCache {const temporary = join10(this.directory, `.write-${randomUUID5()}`);await writeFile5(temporary, bytes, { encoding: "utf8", flag: "wx", mode: 384 });try {- await rename4(temporary, path);+ await rename3(temporary, path);} finally {await unlink3(temporary).catch(() => {});}@@ -44507,6 +44819,70 @@ define2("implicitSurface", {"No CAD accuracy or thin-feature preservation guarantee; requires host execution limits."]});+define2("metaballSurface", {+ ...ownedGeometry,+ execution: "async",+ axes: "Sphere centers use XYZ; positive-inside smooth union.",+ origin: "Explicit sampling bounds min/max define the evaluated region.",+ parameters: [+ "One or more { center, radius } spheres; blend defaults to max(0.35 times the smallest radius, 0.02 scene units).",+ "Same bounds/edgeLength limits as implicitSurface.",+ "Uses implicitSurface defaults of 1,000,000 estimated cells and 8,000,000 field callbacks; explicit maxCells/maxEvaluations ceilings pass through unchanged."+ ],+ topology: ["Resolution-dependent manifold level set; review thin features."],+ preservation: ["No UVs; experimental metadata like implicitSurface."],+ cost: "Implicit grid cost times sphere count; maxEvaluations counts field callbacks, not individual sphere evaluations. Use the host evaluator for process/time limits."+}, {+ references: ["src/organic.ts", "src/implicit.ts"],+ tags: ["metaball", "blob", "organic"],+ aliases: ["smooth blob", "blended spheres"],+ intents: ["author a smooth organic solid from spheres"],+ stability: "experimental",+ related: [{ name: "implicitSurface", relation: "alternative" }]+});+define2("smoothUnion", {+ units: "Blend width uses asset-length units when composed into spatial fields.",+ axes: "Operands are scalar field samples, not mesh coordinates.",+ parameters: ["Finite operands; positive finite blend width."],+ topology: [noMesh],+ preservation: ["Pure scalar helper; no geometry output."],+ cost: "O(1) per sample."+}, {+ references: ["src/sdf.ts"],+ tags: ["sdf", "implicit", "blend"],+ intents: ["smoothly join two positive-inside fields"],+ related: [{ name: "implicitSurface", relation: "companion" }]+});+define2("sphereInside", {+ units: lengthUnits,+ axes: "Center and sample point use XYZ.",+ parameters: ["Positive finite radius; finite center and sample point."],+ topology: [noMesh],+ preservation: ["Scalar field sample only."],+ cost: "O(1) per sample."+}, {+ references: ["src/sdf.ts"],+ tags: ["sdf", "sphere", "field"],+ intents: ["sphere distance field for implicitSurface"],+ related: [{ name: "smoothUnion", relation: "companion" }]+});+define2("smoothOrganic", {+ ...ownedGeometry,+ parameters: [+ "Optional iterations (default 1), creaseAngle (default 55), preserveUV flag.",+ "Subject to subdivide admission budgets."+ ],+ preservation: [+ "Subdivision may drop legacy CSG provenance; creaseNormals invalidates tangents.",+ "Default position-only subdivision drops UVs and material groups; preserveUV: true retains supported corner attributes and material boundaries."+ ],+ cost: "Subdivide estimate applies before work begins."+}, {+ references: ["src/organic.ts", "src/ops.ts", "src/geometry.ts"],+ tags: ["subdivide", "normals", "organic"],+ intents: ["soften an authored mesh for creatures and plants"],+ related: [{ name: "subdivide", relation: "companion" }]+});var nodeFacts = {units: `${lengthUnits} explicit rotation triples use degrees unless stated otherwise.`,axes: "Three.js local XYZ; +Y is the normal up convention.",@@ -45818,6 +46194,69 @@ define2("pipeAlongPath", {{ name: "curveToMesh", relation: "alternative" }]});+define2("catmullRomPath", {+ units: lengthUnits,+ axes: "Control points and output use XYZ.",+ parameters: [+ "At least two open or three closed control points; positive integer samplesPerSpan.",+ "Open output has (controlPoints.length - 1) * samplesPerSpan + 1 stations including endpoints. Closed output has controlPoints.length * samplesPerSpan stations without a repeated endpoint.",+ "Derived sample counts must be safe integers; unsafe products are rejected before sampling."+ ],+ topology: [noMesh],+ preservation: ["Returns a point array for downstream sweeps."],+ cost: "Linear in control points × samplesPerSpan."+}, {+ references: ["src/organic.ts"],+ tags: ["path", "spline", "curve"],+ aliases: ["smooth path samples"],+ intents: ["sample a smooth curve through waypoints"],+ related: [+ { name: "taperedTube", relation: "companion" },+ { name: "sweepProfile", relation: "companion" }+ ]+});+define2("spiralPath", {+ units: lengthUnits,+ axes: "Center, axis, forward and output use XYZ.",+ origin: "Starts radius away from center in the projected forward direction; center is the spiral axis datum.",+ parameters: [+ "Positive radius, rise, and turns; optional sample count (>= 4).",+ "Finite nonzero axis and forward; forward must not be parallel to axis.",+ "Returns samples + 1 stations, rising by rise while radius shrinks linearly to 42% of its initial value.",+ "The derived samples + 1 count must be a safe integer."+ ],+ topology: [noMesh],+ preservation: ["Returns spiral polyline samples for taperedTube or sweepProfile."],+ cost: "Linear in samples."+}, {+ references: ["src/organic.ts"],+ tags: ["path", "spiral", "curve"],+ aliases: ["curl path", "prehensile tail path"],+ intents: ["sample a rising spiral for curled tails and tendrils"],+ related: [+ { name: "catmullRomPath", relation: "alternative" },+ { name: "taperedTube", relation: "companion" }+ ]+});+define2("taperedTube", {+ ...curveFacts,+ parameters: [+ "Polyline path with one positive radius per station.",+ "Closed paths omit the repeated endpoint, matching closed catmullRomPath output.",+ "Optional per-station sectionScale [side, depth] for elliptical cross-sections.",+ "Default creaseAngle 180 for round profiles; radialSegments default 20."+ ],+ preservation: ["UVs and normals like sweepProfile; smooth round shading by default."]+}, {+ references: ["src/organic.ts", "src/sweep.ts"],+ tags: ["tube", "taper", "organic"],+ aliases: ["varying radius tube"],+ intents: ["limb, tail, tentacle or branch with changing thickness"],+ related: [+ { name: "pipeAlongPath", relation: "alternative" },+ { name: "catmullRomPath", relation: "prerequisite" }+ ]+});define2("lathe", {...curveFacts,axes: "Profile x is radius, y is height; spins around Y.",@@ -48085,15 +48524,15 @@ var REQUIREMENTS = {},export: { required: ["projectId"] }};-var record9 = (description) => z17.record(z17.string(), z17.unknown()).optional().describe(description);+var record10 = (description) => z17.record(z17.string(), z17.unknown()).optional().describe(description);function projectToolInput(actions = PROJECT_ACTIONS) {return z17.strictObject({action: z17.enum(actions),projectId: projectIdSchema.optional().describe("get, update, export."),revisionId: projectRevisionIdSchema.optional().describe("get, export: an exact revision; omit for the current one."),expectedRevision: projectRevisionIdSchema.optional().describe("update: the revision being replaced; a stale value is a conflict."),- draft: record9(nestedRecordDescription("create: name, brief, design, inventory, deliveryProfiles, materialDependencies, references, reviews; optional projectId.", "shape:project-draft")),- patch: record9(nestedRecordDescription("update: the same top-level fields as draft; each supplied field replaces its previous value whole.", "shape:project-patch")),+ draft: record10(nestedRecordDescription("create: name, brief, design, inventory, deliveryProfiles, materialDependencies, references, reviews; optional projectId.", "shape:project-draft")),+ patch: record10(nestedRecordDescription("update: the same top-level fields as draft; each supplied field replaces its previous value whole.", "shape:project-patch")),profile: z17.enum(["editable", "runtime"]).optional().describe("export: editable (default) keeps source and resources; runtime is GLB plus metadata.")});}@@ -48444,7 +48883,7 @@ var MATERIAL_CONTRACT = {description: "Import complete normalized material records and embedded PNGs. Does not fetch URLs or execute source."}};-var record10 = (description) => z19.record(z19.string(), z19.unknown()).optional().describe(description);+var record11 = (description) => z19.record(z19.string(), z19.unknown()).optional().describe(description);var tag = z19.string().min(1).max(80).optional().describe("presets, list: keep one tag.");var materialToolInput = z19.strictObject({action: z19.enum(MATERIAL_ACTIONS),@@ -48456,8 +48895,8 @@ var materialToolInput = z19.strictObject({license: materialSourceSchema.shape.license.optional().describe("create-preset: spdx, url and attribution."),materialId: materialLibraryIdSchema.optional().describe("get: the id a project palette lists as resourceId; create-preset: optional id."),revisionId: materialLibraryHashSchema.optional().describe("get: the immutable revision; omitted, the material's only revision."),- draft: record10(nestedRecordDescription("create-procedural: legacy layered draft, or schemaVersion 2 with explicit samplers and RGBA/atlas recipes. Exact atlas sources must exist in this library.", "shape:material-draft")),- payload: record10(nestedRecordDescription("import: schemaVersion 1 or 2, complete normalized records and their exact dependencies with embedded PNG bytes.", "shape:material-import"))+ draft: record11(nestedRecordDescription("create-procedural: legacy layered draft, or schemaVersion 2 with explicit samplers and RGBA/atlas recipes. Exact atlas sources must exist in this library.", "shape:material-draft")),+ payload: record11(nestedRecordDescription("import: schemaVersion 1 or 2, complete normalized records and their exact dependencies with embedded PNG bytes.", "shape:material-import"))});var materialResult = (material) => ({ok: true,@@ -49037,7 +49476,7 @@ init_render();init_requirements_context();init_evaluator();init_material_resources();-import * as THREE57 from "three";+import * as THREE58 from "three";// src/edit-buffer.tsclass KilnDraftBuffer {@@ -49354,6 +49793,7 @@ async function renderDerivativeCell(input, context) {derivativeRoot = withoutHiddenMeshes(derivativeRoot);const rendered = await renderSceneToGLB(derivativeRoot, {derivative: true,+ gltfExporter: "three",requirements: toolRequirements(context).binding});await Promise.resolve().then(() => init_views());@@ -49594,8 +50034,8 @@ function collectSceneMetrics(root) {let meshes = 0;const materialSet = new Set;let lowestPart;- const box = new THREE57.Box3;- const point = new THREE57.Vector3;+ const box = new THREE58.Box3;+ const point = new THREE58.Vector3;root.updateWorldMatrix(true, true);root.traverseVisible((node) => {const n = node;@@ -49611,7 +50051,7 @@ function collectSceneMetrics(root) {const mesh = node;const position = mesh.geometry.getAttribute("position");const index = mesh.geometry.index;- const mb = new THREE57.Box3;+ const mb = new THREE58.Box3;if (position) {for (let i = 0;i < (index?.count ?? position.count); i++) {point.fromBufferAttribute(position, index ? index.getX(i) : i);@@ -49626,7 +50066,7 @@ function collectSceneMetrics(root) {});let bbox;if (!box.isEmpty()) {- const size = new THREE57.Vector3;+ const size = new THREE58.Vector3;box.getSize(size);bbox = {min: [box.min.x, box.min.y, box.min.z],