export declare const INSTALL_WORLD_WALK_PROBE = "(() => {\n const G = globalThis;\n if (G.__vqaWW) return true;\n const A = () => G.__vqaAv;\n const W = { meshes: null, lod: null, prepared: [], saved: null, snaps: [] };\n const regionOf = (g) => g && g.attributes && (g.attributes._region || g.attributes._REGION);\n // The composer names a slot's meshes `compaddon:|` when it renames them; otherwise they keep the item\n // GLB's node names (an outfit filled per LOD). Either identifies the item.\n const nameMatches = (name, names) => {\n for (const n of names) {\n if (n.endsWith('|') && name.startsWith(n)) return true;\n if (name === n) return true;\n if (name.startsWith(n + '_') && /^(_\\d+)+$/.test(name.slice(n.length))) return true;\n }\n return false;\n };\n W.classify = (itemNames) => {\n const m = A().model(); m.updateMatrixWorld(true);\n const lod = m.getObjectByName('character-lod');\n let level = null;\n if (lod && lod.levels && lod.levels.length) {\n level = lod.getCurrentLevel ? lod.getCurrentLevel() : 0;\n W.lod = { obj: lod, auto: lod.autoUpdate, vis: lod.levels.map((l) => l.object.visible) };\n lod.autoUpdate = false;\n lod.levels.forEach((l, i) => { l.object.visible = i === level; });\n }\n m.updateMatrixWorld(true);\n const body = [], item = [], other = [];\n m.traverse((o) => {\n if (!o.isMesh || !o.geometry || !o.geometry.attributes || !o.geometry.attributes.position) return;\n if (!A().visible(o, m)) return;\n if (o.name && o.name.startsWith('__vqaww')) return;\n if (itemNames.length && nameMatches(o.name || '', itemNames)) item.push(o);\n else if (regionOf(o.geometry)) body.push(o);\n else other.push(o);\n });\n let fallback = false, bodyFallback = false;\n if (!item.length && !itemNames.length) { item.push(...other.splice(0)); fallback = true; }\n // A base with no baked regions (a VRM-style avatar used as a base): what it draws besides the item is its body.\n if (itemNames.length && !body.length && other.length) { body.push(...other.splice(0)); bodyFallback = true; }\n W.meshes = { body, item, other };\n const d = (o) => ({ name: o.name, skinned: !!o.isSkinnedMesh, verts: o.geometry.attributes.position.count, tris: o.geometry.index ? o.geometry.index.count / 3 : o.geometry.attributes.position.count / 3 });\n return { level, fallback, bodyFallback, body: body.map(d), item: item.map(d), other: other.map(d) };\n };\n const r5 = (v) => Math.round(v * 100000) / 100000;\n /** Posed vertex positions of one mesh in the body frame (flat). */\n const posed = (o, B) => {\n const V = A().V(); const tmp = new V();\n if (o.isSkinnedMesh && o.skeleton) o.skeleton.update();\n const pos = o.geometry.attributes.position; const e = o.matrixWorld.elements;\n const skinned = o.isSkinnedMesh && typeof o.getVertexPosition === 'function';\n const out = new Array(pos.count * 3);\n for (let i = 0; i < pos.count; i++) {\n let x, y, z;\n if (skinned) { o.getVertexPosition(i, tmp); x = tmp.x; y = tmp.y; z = tmp.z; } else { x = pos.getX(i); y = pos.getY(i); z = pos.getZ(i); }\n const wx = e[0] * x + e[4] * y + e[8] * z + e[12], wy = e[1] * x + e[5] * y + e[9] * z + e[13], wz = e[2] * x + e[6] * y + e[10] * z + e[14];\n const dx = wx - B.o.x, dy = wy - B.o.y, dz = wz - B.o.z;\n out[i * 3] = r5(dx * B.l.x + dz * B.l.z); out[i * 3 + 1] = r5(dy); out[i * 3 + 2] = r5(dx * B.f.x + dz * B.f.z);\n }\n return out;\n };\n const indexOf = (g) => { if (g.index) return Array.from(g.index.array); const n = g.attributes.position.count; const a = new Array(n); for (let i = 0; i < n; i++) a[i] = i; return a; };\n W.pull = (withIndex) => {\n const m = A().model(); m.updateMatrixWorld(true);\n if (G.__vqaFrozen) A().applyFrozen();\n const B = A().basis(); const V = A().V();\n const bones = {}; const parents = {};\n const sk = (W.meshes.body.find((o) => o.isSkinnedMesh) || W.meshes.item.find((o) => o.isSkinnedMesh) || {}).skeleton;\n if (sk) for (const b of sk.bones) { bones[b.name] = A().toBody(b.getWorldPosition(new V()), B).map(r5); parents[b.name] = b.parent && b.parent.isBone ? b.parent.name : null; }\n const body = W.meshes.body.map((o) => {\n const row = { name: o.name, pos: posed(o, B), index: indexOf(o.geometry) };\n if (o.isSkinnedMesh && o.skeleton && o.geometry.attributes.skinIndex && o.geometry.attributes.skinWeight) {\n const si = o.geometry.attributes.skinIndex, sw = o.geometry.attributes.skinWeight; const n = si.count; const bone = new Array(n);\n for (let i = 0; i < n; i++) {\n let best = -1, w = -1;\n for (let k = 0; k < 4; k++) { const wk = sw.getComponent ? sw.getComponent(i, k) : [sw.getX(i), sw.getY(i), sw.getZ(i), sw.getW(i)][k]; if (wk > w) { w = wk; best = si.getComponent ? si.getComponent(i, k) : [si.getX(i), si.getY(i), si.getZ(i), si.getW(i)][k]; } }\n const b = o.skeleton.bones[best]; bone[i] = b ? b.name : null;\n }\n row.bone = bone;\n }\n return row;\n });\n const item = W.meshes.item.map((o) => ({ name: o.name, pos: posed(o, B), index: withIndex === false ? null : indexOf(o.geometry) }));\n return { bones, parents, body, item };\n };\n W.snap = () => { const snap = []; A().model().traverse((o) => { if (o.isBone) snap.push([o, o.position.clone(), o.quaternion.clone(), o.scale.clone()]); }); W.snaps.push(snap); return W.snaps.length - 1; };\n W.use = (k) => { G.__vqaFrozen = k === null || k === undefined ? null : W.snaps[k]; if (G.__vqaFrozen) A().applyFrozen(); return true; };\n /** Build the sentinel overlay of each body mesh \u2014 its hidden triangles drawn again, and the drawn triangles deep inside\n * the garment's coverage \u2014 and, when some drawn triangles moved to the sentinel, its rest geometry without them.\n * rows: [{ name, sentinel: number[], rest: number[] | null }] */\n W.prepare = (rows) => {\n for (const p of W.prepared) { if (p.overlay && p.overlay.parent) p.overlay.parent.remove(p.overlay); }\n W.prepared = [];\n for (const r of rows) {\n const o = W.meshes.body.find((x) => x.name === r.name); if (!o) continue;\n const fork = (idx) => {\n const g = new o.geometry.constructor();\n for (const k of Object.keys(o.geometry.attributes)) g.setAttribute(k, o.geometry.attributes[k]);\n const I = o.geometry.index ? o.geometry.index.constructor : null;\n g.setIndex(I ? new I(new Uint32Array(idx), 1) : Array.from(idx));\n g.boundingSphere = o.geometry.boundingSphere; g.boundingBox = o.geometry.boundingBox;\n return g;\n };\n const base = Array.isArray(o.material) ? o.material[0] : o.material;\n const flat = (rgb) => { const mt = base.clone(); W.flatten(mt, rgb, true); mt.side = 2; return mt; };\n let overlay = null;\n if (r.sentinel.length) {\n overlay = new o.constructor(fork(r.sentinel), flat([1, 0, 1]));\n overlay.name = '__vqaww_sentinel';\n if (o.isSkinnedMesh) { overlay.bind(o.skeleton, o.bindMatrix); overlay.bindMode = o.bindMode; }\n overlay.position.copy(o.position); overlay.quaternion.copy(o.quaternion); overlay.scale.copy(o.scale);\n overlay.frustumCulled = false; overlay.visible = false; overlay.renderOrder = o.renderOrder;\n o.parent.add(overlay);\n }\n W.prepared.push({ mesh: o, overlay, rest: r.rest ? fork(r.rest) : null });\n }\n return W.prepared.length;\n };\n /** Turn a lit standard material into flat colour: black diffuse, the colour as unlit emissive, no reflections. The\n * colour map is kept only when the material cuts with alpha (so an alpha-cut hole stays a hole), never shown. */\n W.flatten = (mt, rgb, dropMap) => {\n if (mt.color) mt.color.setRGB(0, 0, 0);\n if (mt.emissive) mt.emissive.setRGB(rgb[0], rgb[1], rgb[2]);\n const cut = (mt.alphaTest || 0) > 0 || mt.transparent;\n if (dropMap || !cut) mt.map = null;\n mt.emissiveMap = null; mt.normalMap = null; mt.aoMap = null; mt.lightMap = null; mt.envMap = null; mt.envMapIntensity = 0;\n mt.emissiveIntensity = 1; mt.metalness = 0; mt.roughness = 1; mt.toneMapped = false; mt.fog = false;\n for (const k of ['clearcoat', 'sheen', 'transmission', 'iridescence', 'specularIntensity']) if (typeof mt[k] === 'number') mt[k] = 0;\n if (dropMap) { mt.transparent = false; mt.alphaTest = 0; mt.opacity = 1; }\n mt.needsUpdate = true;\n return mt;\n };\n const sceneOf = () => { let s = A().model(); while (s.parent) s = s.parent; return s; };\n W.pass = (mode) => {\n const m = A().model(); const scene = sceneOf();\n if (!W.saved) {\n // Everything the passes change, saved once and restored by 'off'.\n const vis = [];\n for (let o = m; o && o.parent; o = o.parent) for (const s of o.parent.children) if (s !== o && !s.isLight) vis.push([s, s.visible]);\n const mats = [];\n for (const o of [...W.meshes.body, ...W.meshes.item, ...W.meshes.other]) mats.push([o, o.material, o.visible]);\n W.saved = { vis, mats, background: scene.background, fog: scene.fog, geos: W.prepared.map((p) => [p.mesh, p.mesh.geometry]) };\n }\n const S = W.saved;\n const restore = () => {\n for (const [o, mt, v] of S.mats) { o.material = mt; o.visible = v; }\n for (const [o, g] of S.geos) o.geometry = g;\n for (const p of W.prepared) if (p.overlay) p.overlay.visible = false;\n };\n if (mode === 'off') {\n restore();\n for (const [s, v] of S.vis) s.visible = v;\n scene.background = S.background; scene.fog = S.fog;\n W.saved = null;\n return true;\n }\n restore();\n for (const [s] of S.vis) s.visible = false;\n const black = (S.background && S.background.isColor) ? S.background.clone() : (W.meshes.item[0] || W.meshes.body[0]).material.color.clone();\n black.setRGB(0, 0, 0); scene.background = black; scene.fog = null;\n const flatOf = (o, rgb, dropMap) => { const ms = Array.isArray(o.material) ? o.material : [o.material]; const f = ms.map((x) => W.flatten(x.clone(), rgb, dropMap)); o.material = Array.isArray(o.material) ? f : f[0]; return f; };\n if (mode === 'p1') {\n for (const o of W.meshes.item) flatOf(o, [0, 1, 0], false);\n for (const o of [...W.meshes.body, ...W.meshes.other]) flatOf(o, [0.18, 0.18, 0.18], true);\n for (const p of W.prepared) { if (p.rest) p.mesh.geometry = p.rest; if (p.overlay) p.overlay.visible = true; }\n } else if (mode === 'p2') {\n for (const o of [...W.meshes.body, ...W.meshes.other]) o.visible = false;\n for (const o of W.meshes.item) { const f = flatOf(o, [0, 1, 0], false); for (const x of f) x.side = 0; }\n }\n return true;\n };\n W.release = () => {\n if (W.saved) W.pass('off');\n for (const p of W.prepared) { if (p.overlay && p.overlay.parent) p.overlay.parent.remove(p.overlay); }\n W.prepared = [];\n if (W.lod) { W.lod.obj.autoUpdate = W.lod.auto; W.lod.obj.levels.forEach((l, i) => { l.object.visible = W.lod.vis[i]; }); W.lod = null; }\n G.__vqaFrozen = null;\n return true;\n };\n /** Resolve after n rendered frames. */\n W.frames = (n) => new Promise((res) => { let k = 0; const f = () => { if (++k >= n) res(k); else requestAnimationFrame(f); }; requestAnimationFrame(f); });\n G.__vqaWW = W;\n return true;\n})()";