@figurosity/consumer-three-dimension-tool 0.2.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,52 +1,46 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".tool-reset-button .qbtn{color:#333;font-weight:700}.debug-color{max-width:100px}.debug-color .swatch{height:20px;width:20px;border-radius:10px;border:1px solid #333}.debug-color .label{font-weight:700}.debug-value span{margin-top:2px;min-width:60px;font-size:11px}.debug-vector{min-width:130px}.debug-vector>div{font-size:10px}.debug-vector>div>span{min-width:20px;font-weight:700}.debug-boolean .indicator{margin-top:6px;margin-right:4px;height:10px;width:10px;border-radius:10px;border:1px solid #333;display:inline-block;background:red}.debug-boolean .indicator.on{background:#adff2f}.debug3D{position:absolute;z-index:14400;top:20px;left:40px;padding:20px;border:1px solid #ccc;border-radius:10px;background-color:#ffffffb3}.debug3D .color-square{display:inline-block;height:15px;width:15px;margin-bottom:-3px;border:1px dotted black}.three-dimension-tool{position:fixed;top:0;left:0;right:0;bottom:0;z-index:100}.three-dimension-tool .tres{width:100%;height:100vh}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- import { nextTick as Ht, watch as O, ref as ee, onUnmounted as Rt, computed as v, onMounted as Xt, openBlock as Je, createElementBlock as Yt, createCommentVNode as ht, createElementVNode as Qt, onBeforeMount as Wt, defineComponent as $, h, inject as Jt, useModel as eo, onBeforeUnmount as to, createBlock as it, unref as at, withCtx as ct, createVNode as oo, mergeModels as so } from "vue";
3
- import { Platform as ft, useQuasar as no, QBtn as Ot, QSeparator as Fe } from "quasar";
4
- import { CBaseButton as ne, CColorPickerPopup as qt, CExpansion as rt, CToggle as Ke, CSlider as dt, CDraggableDrawer as Qe, CBaseButtons as ro, CDraggableDrawers as lo, CToolPage as io } from "@figurosity/consumer-controls";
5
- import { defineStore as de, storeToRefs as I, getActivePinia as ao } from "pinia";
6
- import * as M from "three";
7
- import tt from "lodash.isequal";
1
+ (function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(".tool-reset-button .qbtn{color:#333;font-weight:700}:has(>.frozen-overlay){position:relative}.frozen-overlay{position:absolute;z-index:10;top:0;left:0;bottom:0;right:0}.debug-color{max-width:100px}.debug-color .swatch{height:20px;width:20px;border-radius:10px;border:1px solid #333}.debug-color .label{font-weight:700}.debug-value span{margin-top:2px;min-width:60px;font-size:11px}.debug-vector{min-width:130px}.debug-vector>div{font-size:10px}.debug-vector>div>span{min-width:20px;font-weight:700}.debug-boolean .indicator{margin-top:6px;margin-right:4px;height:10px;width:10px;border-radius:10px;border:1px solid #333;display:inline-block;background:red}.debug-boolean .indicator.on{background:#adff2f}.debug3D{position:absolute;z-index:14400;top:20px;left:40px;padding:20px;border:1px solid #ccc;border-radius:10px;background-color:#ffffffb3}.debug3D .color-square{display:inline-block;height:15px;width:15px;margin-bottom:-3px;border:1px dotted black}.three-dimension-tool{position:fixed;top:0;left:0;right:0;bottom:0;z-index:100}.three-dimension-tool .tres{width:100%;height:100vh}")),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ import { watch as j, ref as pe, nextTick as ls, onUnmounted as Ut, computed as C, onMounted as $t, openBlock as at, createElementBlock as cs, createCommentVNode as wt, createElementVNode as us, onBeforeMount as ds, defineComponent as V, h as d, withDirectives as ps, vShow as ms, inject as Ze, useModel as fs, onBeforeUnmount as hs, createBlock as vt, unref as bt, withCtx as yt, createVNode as gs, mergeModels as vs } from "vue";
3
+ import { Platform as Ct, useQuasar as bs, QBtn as qt, QSeparator as ve } from "quasar";
4
+ import { CBaseButton as me, CColorPickerPopup as ys, CExpansion as Ve, CToggle as Ht, CSlider as We, CBaseButtons as Jt, CDraggableDrawer as De, CDraggableDrawers as Ss, CToolPage as xs } from "@figurosity/consumer-controls";
5
+ import { defineStore as Ye, storeToRefs as N, getActivePinia as ws } from "pinia";
6
+ import * as I from "three";
7
+ import Qe from "lodash.isequal";
8
+ import { DEFAULT as lt, SKINS as xe, COLORS as oe, GRID as we, LIGHTS as de, RELATED as Ce, getConfig as Cs, useDynamicImages as Es } from "@figurosity/toolbox";
8
9
  import "three/examples/jsm/loaders/RGBELoader.js";
9
- import { DEFAULT as ot, COLORS as oe, GRID as xe, LIGHTS as ve, RELATED as we } from "@figurosity/toolbox";
10
- import { OrbitControls as co } from "three/examples/jsm/controls/OrbitControls.js";
11
- import { mergeVertices as Bt, mergeGeometries as uo } from "three/examples/jsm/utils/BufferGeometryUtils.js";
12
- import { RoundedBoxGeometry as po } from "three/examples/jsm/geometries/RoundedBoxGeometry.js";
13
- import { GLTFLoader as mo } from "three/examples/jsm/loaders/GLTFLoader.js";
14
- import { DRACOLoader as ho } from "three/examples/jsm/loaders/DRACOLoader.js";
15
- function be(e) {
16
- const t = e.startsWith("#") ? e.slice(1) : e;
17
- return parseInt(t, 16);
18
- }
19
- function ce(e) {
20
- return `#${e.toString(16).padStart(6, "0")}`;
21
- }
22
- const ut = new M.Vector3(), Mt = (e) => {
23
- const t = new M.Box3().setFromObject(e);
10
+ import { RoomEnvironment as Is } from "three/examples/jsm/environments/RoomEnvironment.js";
11
+ import { OrbitControls as Ds } from "three/examples/jsm/controls/OrbitControls.js";
12
+ import { mergeVertices as Rt, mergeGeometries as ks } from "three/examples/jsm/utils/BufferGeometryUtils.js";
13
+ import { RoundedBoxGeometry as Ts } from "three/examples/jsm/geometries/RoundedBoxGeometry.js";
14
+ import { GLTFLoader as Ms } from "three/examples/jsm/loaders/GLTFLoader.js";
15
+ import { DRACOLoader as As } from "three/examples/jsm/loaders/DRACOLoader.js";
16
+ const Bs = "tool:switched", zs = "pose:viewed", Ps = "skin:changed", St = new I.Vector3(), Vt = (e) => {
17
+ const t = new I.Box3().setFromObject(e);
24
18
  console.log("box", t);
25
- const o = t.getSize(new M.Vector3()), s = new M.Vector3(
19
+ const s = t.getSize(new I.Vector3()), n = new I.Vector3(
26
20
  (t.min.x + t.max.x) / 2,
27
21
  (t.min.y + t.max.y) / 2,
28
22
  (t.min.z + t.max.z) / 2
29
23
  );
30
- console.log("center", s);
31
- let n = t.min.y;
32
- return console.log("bottom", n), Math.abs(n) < -0.01 && (n = fo(e)), console.log("bottom", n), {
24
+ console.log("center", n);
25
+ let r = t.min.y;
26
+ return console.log("bottom", r), Math.abs(r) < -0.01 && (r = Ls(e)), console.log("bottom", r), {
33
27
  box: t,
34
- size: o,
35
- center: s,
36
- bottom: n,
28
+ size: s,
29
+ center: n,
30
+ bottom: r,
37
31
  top: t.max.y
38
32
  };
39
- }, fo = (e) => {
33
+ }, Ls = (e) => {
40
34
  let t = 1 / 0;
41
- return e.updateMatrixWorld(!0), e.traverse((o) => {
42
- var n, r;
43
- if (!o.isMesh) return;
44
- const s = (r = (n = o.geometry) == null ? void 0 : n.attributes) == null ? void 0 : r.position;
45
- if (s)
46
- for (let l = 0; l < s.count; l++)
47
- ut.fromBufferAttribute(s, l), ut.applyMatrix4(o.matrixWorld), t = Math.min(t, ut.y);
35
+ return e.updateMatrixWorld(!0), e.traverse((s) => {
36
+ var r, i;
37
+ if (!s.isMesh) return;
38
+ const n = (i = (r = s.geometry) == null ? void 0 : r.attributes) == null ? void 0 : i.position;
39
+ if (n)
40
+ for (let o = 0; o < n.count; o++)
41
+ St.fromBufferAttribute(n, o), St.applyMatrix4(s.matrixWorld), t = Math.min(t, St.y);
48
42
  }), t;
49
- }, _t = (e) => ({
43
+ }, Kt = (e) => ({
50
44
  box: {
51
45
  min: {
52
46
  x: e.box.min.x,
@@ -71,72 +65,33 @@ const ut = new M.Vector3(), Mt = (e) => {
71
65
  },
72
66
  bottom: e.bottom,
73
67
  top: e.top
74
- }), go = "smooth", vo = [
75
- "#141111",
76
- "#3E251E",
77
- "#633C30",
78
- "#A56F57",
79
- "#CC9E86",
80
- "#543F2E",
81
- "#7C5B48",
82
- "#98775B",
83
- "#AD8B6B",
84
- "#BFA282",
85
- "#794524",
86
- "#8F603E",
87
- "#B08057",
88
- "#D7A56F",
89
- "#F7DBA2",
90
- "#673E28",
91
- "#C5815E",
92
- "#D59671",
93
- "#EFB698",
94
- "#F5D2C0",
95
- "#6E453A",
96
- "#996C5E",
97
- "#C88D7D",
98
- "#E7B09E",
99
- "#EEC1AE",
100
- "#432B26",
101
- "#88635A",
102
- "#BA8C82",
103
- "#EBBAB6",
104
- "#F7D2C8",
105
- "#796362",
106
- "#8F7277",
107
- "#C399A0",
108
- "#E3C7CB",
109
- "#E6D1D2",
110
- "#684C4B",
111
- "#98807B",
112
- "#BDACA8",
113
- "#DACDC9",
114
- "#E5E4E3"
115
- ], bo = (e) => ({
68
+ }), Wt = "smooth", Rs = (e) => ({
116
69
  id: e.id,
117
70
  uuid: e.uuid ?? null,
118
71
  basePoseId: e.basePoseId ?? null,
119
72
  skinId: e.skinId ?? null,
73
+ // Skin slug — host overrides the row's own `slug` (basePose slug) with
74
+ // the resolved skin slug before sending the envelope, so the lib can
75
+ // read this field to drive the skin selector.
76
+ slug: e.slug ?? null,
120
77
  poseId: e.poseId ?? null,
121
78
  url: e.glbPathWebp || e.glbPath || null,
122
- color: e.color ?? 16777215,
123
79
  bounds: e.bounds ?? null
124
- }), ye = de("3d-glbs", {
80
+ }), fe = Ye("3d-glbs", {
125
81
  state: () => ({
126
- models: {},
127
- palette: vo
82
+ models: {}
128
83
  }),
129
84
  getters: {
130
85
  selectedId() {
131
- return p().selected;
86
+ return M().selected;
132
87
  },
133
88
  poseId(e) {
134
- var o, s;
135
- const t = p().selected;
136
- return (s = (o = e.models) == null ? void 0 : o[t]) == null ? void 0 : s.poseId;
89
+ var s, n;
90
+ const t = M().selected;
91
+ return (n = (s = e.models) == null ? void 0 : s[t]) == null ? void 0 : n.poseId;
137
92
  },
138
93
  model(e) {
139
- const t = p().selected;
94
+ const t = M().selected;
140
95
  return t && e.models[t] ? e.models[t] : null;
141
96
  },
142
97
  url() {
@@ -146,232 +101,380 @@ const ut = new M.Vector3(), Mt = (e) => {
146
101
  bounds() {
147
102
  var e;
148
103
  return (e = this.model) == null ? void 0 : e.bounds;
149
- },
150
- color() {
151
- var e;
152
- return ((e = this.model) == null ? void 0 : e.color) || 16777215;
153
- },
154
- colorHex() {
155
- var e;
156
- return (e = this.model) != null && e.color ? ce(this.model.color) : "#fefefe";
157
- },
158
- changed(e) {
159
- var o, s, n, r;
160
- const t = p().selected;
161
- return (s = (o = e.models) == null ? void 0 : o[t]) != null && s.color ? ((r = (n = e.models) == null ? void 0 : n[t]) == null ? void 0 : r.color) !== 16777215 : !1;
162
104
  }
163
105
  },
164
106
  actions: {
165
- resetColor() {
166
- const e = p().selected;
167
- this.models[e] && (this.models[e].color = 16777215);
168
- },
169
107
  setBounds(e) {
170
- const t = p().selected;
171
- this.models[t] && (this.models[t].bounds = _t(e));
172
- },
173
- setColorHex(e) {
174
- const t = p().selected;
175
- this.models[t] && (this.models[t].color = be(e));
108
+ const t = M().selected;
109
+ this.models[t] && (this.models[t].bounds = Kt(e));
176
110
  },
177
111
  setSubjectsFromResponse(e) {
178
- var s;
179
- const t = ((s = e == null ? void 0 : e.entities) == null ? void 0 : s.glb) || {}, o = {};
180
- return Object.keys(t).forEach((n) => {
181
- o[n] = bo(t[n]);
182
- }), this.models = { ...this.models, ...o }, this.selectDefaultGlbId(e);
112
+ var n;
113
+ const t = ((n = e == null ? void 0 : e.entities) == null ? void 0 : n.glb) || {}, s = {};
114
+ return Object.keys(t).forEach((r) => {
115
+ s[r] = Rs(t[r]);
116
+ }), this.models = { ...this.models, ...s }, this.selectDefaultGlbId(e);
183
117
  },
184
118
  // Picks the GLB id whose skin slug matches DEFAULT_SKIN_SLUG, falls
185
119
  // back to result.glb[0], or null when no GLBs are available.
186
120
  selectDefaultGlbId(e) {
187
- var l, a, c;
188
- const t = Array.isArray((l = e == null ? void 0 : e.result) == null ? void 0 : l.glb) ? e.result.glb : [];
121
+ var o, c, a;
122
+ const t = Array.isArray((o = e == null ? void 0 : e.result) == null ? void 0 : o.glb) ? e.result.glb : [];
189
123
  if (t.length === 0) return null;
190
- const o = ((a = e == null ? void 0 : e.entities) == null ? void 0 : a.skins) || {}, s = ((c = e == null ? void 0 : e.entities) == null ? void 0 : c.glb) || {}, r = t.find((u) => {
191
- var b, f;
192
- const g = (b = s[u]) == null ? void 0 : b.skinId;
193
- return g != null && ((f = o[g]) == null ? void 0 : f.slug) === go;
124
+ const s = ((c = e == null ? void 0 : e.entities) == null ? void 0 : c.skins) || {}, n = ((a = e == null ? void 0 : e.entities) == null ? void 0 : a.glb) || {}, i = t.find((u) => {
125
+ var P, w;
126
+ const p = (P = n[u]) == null ? void 0 : P.skinId;
127
+ return p != null && ((w = s[p]) == null ? void 0 : w.slug) === Wt;
194
128
  }) ?? t[0];
195
- return typeof r == "string" ? parseInt(r, 10) : r;
129
+ return typeof i == "string" ? parseInt(i, 10) : i;
196
130
  }
197
131
  }
198
- }), gt = { visible: !0, opacity: 1, color: 16711422, texture: "none" }, kt = (e = {}) => ({ ...gt, ...e }), Ve = de("3d-ground", {
132
+ });
133
+ function et(e) {
134
+ const t = e.startsWith("#") ? e.slice(1) : e;
135
+ return parseInt(t, 16);
136
+ }
137
+ function ue(e) {
138
+ return `#${e.toString(16).padStart(6, "0")}`;
139
+ }
140
+ const tt = ({
141
+ storeId: e,
142
+ defaultValues: t = {},
143
+ state: s = {},
144
+ getters: n = {},
145
+ actions: r = {},
146
+ keyBy: i = "selected"
147
+ }) => Ye(e, {
199
148
  state: () => ({
149
+ loading: !1,
200
150
  models: {},
201
- offset: -0.75
151
+ // Bumped by `restore()` so callers outside the lib (the
152
+ // consumer-app's `useViewerUrlSync` ?v= apply path) can trigger
153
+ // a re-apply into three.js. Stores whose state already flows
154
+ // through reactive watchers (grid/scene/ground) ignore this; the
155
+ // ones that don't (controls, lights orbit) use it as the only
156
+ // signal that the host did a `restore()` and the three.js camera
157
+ // needs to be re-driven from the store. See ThreeDimensionTool
158
+ // for the watcher and the rationale.
159
+ applyRevision: 0,
160
+ ...s
202
161
  }),
203
162
  getters: {
204
- changed(e) {
205
- var o, s;
206
- const t = p().selected;
207
- return ((s = (o = e.models) == null ? void 0 : o[t]) == null ? void 0 : s.color) !== 16711422;
163
+ keyId() {
164
+ return M()[i];
208
165
  },
209
- property() {
210
- return (e, t = null) => {
211
- var o;
212
- return ((o = this.selectedModel) == null ? void 0 : o[e]) ?? t;
213
- };
166
+ model(o) {
167
+ return o.models[M()[i]];
214
168
  },
215
- selectedId() {
216
- return p().selected;
169
+ exists(o) {
170
+ return typeof o.models[M()[i]] < "u";
217
171
  },
218
- selectedModel(e) {
219
- const t = this.selectedId;
220
- return e.models[t] ?? null;
172
+ selectedModel(o) {
173
+ return o.models[M()[i]] ?? null;
221
174
  },
222
175
  mergedModel() {
223
- return { ...gt, ...this.selectedModel ?? {} };
224
- },
225
- model(e) {
226
- const o = p().selected;
227
- return o && e.models[o] ? e.models[o] : null;
176
+ return { ...t, ...this.selectedModel ?? {} };
228
177
  },
229
- color() {
230
- return this.mergedModel.color;
178
+ propertyById(o) {
179
+ return (c, a, u = null) => o.models[c] && a in o.models[c] ? o.models[c][a] : u;
231
180
  },
232
- colorHex() {
233
- return ce(this.mergedModel.color);
181
+ propertyChangedById() {
182
+ return (o, c) => this.propertyById(o, c) !== t[c];
234
183
  },
235
- opacity() {
236
- return this.mergedModel.opacity;
184
+ propertyChanged(o) {
185
+ const c = M()[i];
186
+ return (a) => o.models[c] ? this.propertyById(c, a) !== t[a] : !1;
237
187
  },
238
- texture() {
239
- return this.mergedModel.texture;
188
+ property() {
189
+ const o = M()[i];
190
+ return (c, a = t[c]) => this.propertyById(o, c, a);
240
191
  },
241
- visible() {
242
- return this.mergedModel.visible;
243
- }
192
+ ...n
244
193
  },
245
194
  actions: {
246
- reset() {
247
- const e = p().selected;
248
- this.models[e] = kt();
195
+ initModel(o) {
196
+ o != null && (typeof this.models[o] < "u" || this.$patch((c) => {
197
+ c.models[o] = { ...t };
198
+ }));
249
199
  },
250
200
  ensureSelectedModel() {
251
- const e = p().selected;
252
- return this.models[e] || (this.models[e] = { ...gt }), this.models[e];
201
+ const o = M()[i];
202
+ return o == null ? null : (this.models[o] || (this.models[o] = { ...t }), this.models[o]);
253
203
  },
254
- patchSelected(e) {
255
- const t = this.ensureSelectedModel();
256
- Object.assign(t, e);
204
+ setPropertyById(o, c, a) {
205
+ o != null && (this.models[o] || this.initModel(o), this.$patch({
206
+ models: {
207
+ [o]: { ...this.models[o], [c]: a }
208
+ }
209
+ }));
257
210
  },
258
- setProperty(e, t) {
259
- const o = this.ensureSelectedModel();
260
- o[e] = t;
211
+ setProperty(o, c) {
212
+ const a = M()[i];
213
+ a != null && (this.models[a] || this.initModel(a), this.$patch({
214
+ models: {
215
+ [a]: { ...this.models[a], [o]: c }
216
+ }
217
+ }));
261
218
  },
262
- setColor(e) {
263
- this.setProperty("color", e);
219
+ patchSelected(o) {
220
+ const c = this.ensureSelectedModel();
221
+ c && Object.assign(c, o);
264
222
  },
265
- setColorHex(e) {
266
- this.setProperty("color", be(e));
223
+ reset() {
224
+ const o = M()[i];
225
+ o != null && this.$patch((c) => {
226
+ c.models[o] = { ...t };
227
+ });
267
228
  },
268
- setTexture(e) {
269
- this.setProperty("texture", e);
229
+ resetProperty(o) {
230
+ const c = M()[i];
231
+ c != null && this.models[c] && this.$patch({
232
+ models: {
233
+ [c]: {
234
+ ...this.models[c],
235
+ [o]: t[o]
236
+ }
237
+ }
238
+ });
270
239
  },
271
- setVisible(e) {
272
- this.setProperty("visible", e);
240
+ // Capture the active model's tunable state as a plain object. Used
241
+ // by the save+freeze flow (consumer-app `composeViewState`) and the
242
+ // URL `?v=` writer in `useViewerUrlSync` to encode the current view.
243
+ // Returns null when there's no active bucket so the caller can omit
244
+ // the slot from the payload rather than encode a stale snapshot.
245
+ snapshot() {
246
+ const o = M()[i];
247
+ return o == null || !this.models[o] ? null : JSON.parse(JSON.stringify(this.models[o]));
248
+ },
249
+ // Apply a snapshot from the save+freeze payload back onto the
250
+ // active bucket. Missing keys fall through to defaultValues; the
251
+ // caller passes the same shape `snapshot()` produced.
252
+ restore(o) {
253
+ if (o == null || typeof o != "object") return;
254
+ const c = M()[i];
255
+ if (c == null) return;
256
+ const a = JSON.parse(JSON.stringify(o));
257
+ this.$patch((u) => {
258
+ u.models[c] = { ...t, ...a }, u.framed && (u.framed[c] = !0), u.applyRevision = (u.applyRevision || 0) + 1;
259
+ });
273
260
  },
274
- setGroundFromResponse(e) {
275
- this.models[e] || (this.models[e] = kt());
276
- }
261
+ ...r
262
+ }
263
+ }), Xt = {
264
+ visible: !0,
265
+ opacity: 1,
266
+ color: 16711422,
267
+ texture: "none"
268
+ }, Vs = {
269
+ changed() {
270
+ return this.exists ? !Qe(this.mergedModel, Xt) : !1;
271
+ },
272
+ color() {
273
+ return this.property("color");
274
+ },
275
+ colorHex() {
276
+ return ue(this.property("color"));
277
+ },
278
+ opacity() {
279
+ return this.property("opacity");
280
+ },
281
+ texture() {
282
+ return this.property("texture");
283
+ },
284
+ visible() {
285
+ return this.property("visible");
286
+ }
287
+ }, Fs = {
288
+ init() {
289
+ this.initModel(this.keyId);
290
+ },
291
+ setColor(e) {
292
+ this.setProperty("color", e);
293
+ },
294
+ setColorHex(e) {
295
+ this.setProperty("color", et(e));
296
+ },
297
+ setTexture(e) {
298
+ this.setProperty("texture", e);
299
+ },
300
+ setVisible(e) {
301
+ this.setProperty("visible", e);
277
302
  }
278
- }), Xe = {
303
+ }, Fe = tt({
304
+ storeId: "3d-ground",
305
+ defaultValues: Xt,
306
+ state: { offset: -0.75 },
307
+ getters: Vs,
308
+ actions: Fs,
309
+ keyBy: "basePoseId"
310
+ }), _s = {
279
311
  color: 16777215,
280
312
  visible: !0,
281
313
  debug: !1,
282
314
  shadow: !0,
283
- opacity: 1,
284
315
  visualization: !0
285
- }, pt = (e = {}) => ({ ...Xe, ...e }), ge = {
316
+ }, Pe = 0, se = 1, Et = 1.25, It = 3, ot = (e, t, s) => Math.max(t, Math.min(s, e)), Gs = 1.25, Le = (e = {}) => ({ ..._s, ...e }), ze = {
286
317
  advanced: !1,
287
318
  move: !1,
288
319
  position: { x: 0, y: 0, z: 1.5 },
289
320
  quaternion: { x: 0, y: 0, z: 0, w: 1 },
290
321
  target: { x: 0, y: 0, z: 0 }
291
- }, Et = (e = {}) => ({ ...ge, ...e }), Be = de("3d-lights", {
322
+ }, Ft = ["advanced", "move"], nt = (e = {}) => ({ ...ze, ...e }), js = {
323
+ ambientScale: se,
324
+ userScale: se
325
+ }, rt = (e = {}) => ({ ...js, ...e }), xt = () => ({
326
+ key: Le(),
327
+ fill: Le({ shadow: !0 }),
328
+ back: Le({ shadow: !0 })
329
+ }), he = Ye("3d-lights", {
292
330
  state: () => ({
293
331
  lights: {},
294
332
  options: {},
333
+ scales: {},
334
+ seeds: {},
335
+ // basePoseId -> true once frameToBounds + syncToStore have landed
336
+ // on this basePose's lights rig. Explicit flag rather than an
337
+ // inferred sentinel so the bounds watcher's framing decision
338
+ // doesn't depend on whether option fields happen to look default.
339
+ framed: {},
295
340
  collection: ["key", "fill", "back"],
296
- debug: !1
341
+ debug: !1,
342
+ // Bumped by `restore()` so ThreeDimensionTool can detect that the
343
+ // host (consumer-app's tier-3 ?v= save-load) pushed new state in,
344
+ // and re-activate lights/camera modes to drive the OrbitControls
345
+ // rig from the just-restored options/lights/scales slots. The
346
+ // intensity sliders and per-spot color watchers fire on slot
347
+ // mutations directly, but the rig position (in options.position/
348
+ // quaternion/target/radius) only flows through `applyFromStore`
349
+ // and needs the explicit re-activation signal.
350
+ applyRevision: 0
297
351
  }),
298
352
  getters: {
353
+ bpId() {
354
+ return M().basePoseId;
355
+ },
356
+ skinId() {
357
+ return M().selected;
358
+ },
359
+ // The reset button reflects "user has tweaked something on the
360
+ // active skin." Toggles + rig are per-basePose; sliders are
361
+ // per-skin. Rig-orbit fields are written by syncToStore every
362
+ // animate tick and would otherwise read as "changed" immediately
363
+ // after the GLB loads, so they're excluded — only the user-visible
364
+ // toggles + the active skin's slider values count.
299
365
  changed(e) {
300
- const o = p().selected, s = !tt(e.options[o], ge), n = {
301
- key: { ...Xe },
302
- fill: { ...Xe },
303
- back: { ...Xe }
304
- }, r = !tt(e.lights[o], n);
305
- return s || r;
366
+ const t = e.options[this.bpId];
367
+ if (t && Ft.some((n) => !Qe(t[n], ze[n])))
368
+ return !0;
369
+ const s = e.scales[this.skinId];
370
+ return !!(s && (s.ambientScale !== se || s.userScale !== se));
371
+ },
372
+ // Has frameToBounds + syncToStore landed on this basePose's
373
+ // lights rig? Set by markFramed() from the bounds watcher in
374
+ // ThreeDimensionTool. Used by the GLB load path: a basePose the
375
+ // user has already framed applies the persisted rig instead of
376
+ // reframing on every skin swap.
377
+ hasRig(e) {
378
+ return !!e.framed[this.bpId];
306
379
  },
307
380
  move(e) {
308
- var s;
309
- const o = p().selected;
310
- return ((s = e.options[o]) == null ? void 0 : s.move) || !1;
381
+ var t;
382
+ return ((t = e.options[this.bpId]) == null ? void 0 : t.move) || !1;
311
383
  },
312
384
  advancedMode(e) {
385
+ var t;
386
+ return ((t = e.options[this.bpId]) == null ? void 0 : t.advanced) || !1;
387
+ },
388
+ // Re-clamp on read so persisted values from a session before the
389
+ // per-source ceilings landed (when both maxed at 2.0) don't sit
390
+ // above the new AMBIENT_SCALE_MAX / USER_SCALE_MAX.
391
+ ambientScale(e) {
313
392
  var s;
314
- const o = p().selected;
315
- return ((s = e.options[o]) == null ? void 0 : s.advanced) || !1;
393
+ const t = ((s = e.scales[this.skinId]) == null ? void 0 : s.ambientScale) ?? se;
394
+ return ot(t, Pe, Et);
316
395
  },
317
- position(e) {
396
+ userScale(e) {
318
397
  var s;
319
- const o = p().selected;
320
- return ((s = e.options[o]) == null ? void 0 : s.position) || ge.position;
398
+ const t = ((s = e.scales[this.skinId]) == null ? void 0 : s.userScale) ?? se;
399
+ return ot(t, Pe, It);
400
+ },
401
+ position(e) {
402
+ var t;
403
+ return ((t = e.options[this.bpId]) == null ? void 0 : t.position) || ze.position;
321
404
  },
322
405
  quaternion(e) {
323
- var s;
324
- const o = p().selected;
325
- return ((s = e.options[o]) == null ? void 0 : s.quaternion) || ge.quaternion;
406
+ var t;
407
+ return ((t = e.options[this.bpId]) == null ? void 0 : t.quaternion) || ze.quaternion;
326
408
  },
327
409
  target(e) {
328
- var s;
329
- const o = p().selected;
330
- return ((s = e.options[o]) == null ? void 0 : s.target) || ge.target;
410
+ var t;
411
+ return ((t = e.options[this.bpId]) == null ? void 0 : t.target) || ze.target;
331
412
  },
332
413
  radius(e) {
333
- var s;
334
- const o = p().selected;
335
- return ((s = e.options[o]) == null ? void 0 : s.radius) || ge.radius;
414
+ var t;
415
+ return (t = e.options[this.bpId]) == null ? void 0 : t.radius;
336
416
  },
337
417
  property(e) {
338
- return (t, o = null, s = null) => {
339
- const r = p().selected;
340
- return !e.lights[r] || !e.lights[r][t] || !(o in e.lights[r][t]) ? s : e.lights[r][t][o];
418
+ return (t, s = null, n = null) => {
419
+ const r = e.lights[this.bpId];
420
+ return !r || !r[t] || !(s in r[t]) ? n : r[t][s];
341
421
  };
342
422
  },
343
423
  colorHex(e) {
344
424
  return (t) => {
345
- const s = p().selected;
346
- return !e.lights[s] || !e.lights[s][t] ? "#ffffff" : ce(e.lights[s][t].color);
425
+ const s = e.lights[this.bpId];
426
+ return !s || !s[t] ? "#ffffff" : ue(s[t].color);
347
427
  };
348
428
  },
349
429
  lightKeys(e) {
350
- const o = p().selected;
351
- return Object.keys(e.lights[o]);
430
+ return Object.keys(e.lights[this.bpId] || {});
352
431
  },
353
- isVisible(e) {
354
- return (t) => e.move && (this.advancedMode === !0 && this.property(t, "visible") || t === "key");
432
+ isVisible() {
433
+ return () => this.move;
355
434
  }
356
435
  },
357
436
  actions: {
358
437
  reset() {
359
- const e = p().selected;
360
- this.options[e] = { ...ge }, this.collection.forEach(
361
- (t) => this.lights[e][t] = { ...Xe }
362
- );
438
+ const e = this.bpId, t = this.skinId;
439
+ if (e == null) return;
440
+ this.options[e] || (this.options[e] = nt()), Ft.forEach((n) => this.options[e][n] = ze[n]), t != null && (this.scales[t] || (this.scales[t] = rt()), this.scales[t].ambientScale = se, this.scales[t].userScale = se);
441
+ const s = this.seeds[t];
442
+ s ? this.lights[e] = {
443
+ key: { ...s.key },
444
+ fill: { ...s.fill },
445
+ back: { ...s.back }
446
+ } : this.lights[e] = xt();
447
+ },
448
+ // Seed per-skin lights from the recipe and warm the per-basePose
449
+ // user-state buckets if absent. The recipe is always rewritten
450
+ // (different skin = different intensities); lights[bpId] and
451
+ // options[bpId] are only initialized on first entry into the
452
+ // basePose bucket so user state — color picks, rig position —
453
+ // survives subsequent skin swaps within the same basePose.
454
+ // scales[skinId] is per-skin and warmed once per skin.
455
+ seedFromRecipe(e, t) {
456
+ const s = ((t == null ? void 0 : t.spotIntensity) ?? 1) * Gs, n = (t == null ? void 0 : t.ambientIntensity) ?? 0, r = (t == null ? void 0 : t.envIntensity) ?? 1;
457
+ this.seeds[e] = {
458
+ key: Le({ intensity: s }),
459
+ fill: Le({ intensity: s, shadow: !0 }),
460
+ back: Le({ intensity: s, shadow: !0 }),
461
+ ambient: { intensity: n },
462
+ env: { intensity: r }
463
+ }, e != null && !this.scales[e] && (this.scales[e] = rt());
464
+ const i = this.bpId;
465
+ i != null && (this.lights[i] || (this.lights[i] = xt()), this.options[i] || (this.options[i] = nt()));
363
466
  },
364
467
  ensureSelectedOptions() {
365
- const e = p().selected;
366
- return this.options[e] || (this.options[e] = { ...ge }), this.options[e];
468
+ const e = this.bpId;
469
+ return e == null ? null : (this.options[e] || (this.options[e] = nt()), this.options[e]);
367
470
  },
368
- patchSelected(e) {
369
- const t = this.ensureSelectedOptions();
370
- Object.assign(t, e);
471
+ ensureSelectedScales() {
472
+ const e = this.skinId;
473
+ return e == null ? null : (this.scales[e] || (this.scales[e] = rt()), this.scales[e]);
371
474
  },
372
475
  setControlProperty(e, t) {
373
- const o = this.ensureSelectedOptions();
374
- o[e] = t;
476
+ const s = this.ensureSelectedOptions();
477
+ s && (s[e] = t);
375
478
  },
376
479
  setPosition(e) {
377
480
  this.setControlProperty("position", e);
@@ -386,169 +489,174 @@ const ut = new M.Vector3(), Mt = (e) => {
386
489
  this.setControlProperty("radius", e);
387
490
  },
388
491
  setMove(e = !1) {
389
- const o = p().selected;
390
- this.options[o].move = e;
492
+ this.initLights();
493
+ const t = this.ensureSelectedOptions();
494
+ t && (t.move = e);
391
495
  },
392
496
  setAdvanced(e = !1) {
393
- const o = p().selected;
497
+ const t = this.bpId;
498
+ if (t == null) return;
499
+ const s = this.ensureSelectedOptions();
500
+ if (!s) return;
394
501
  if (e === !0) {
395
- this.options[o].advanced = !0;
502
+ s.advanced = !0;
396
503
  return;
397
504
  }
398
- this.options[o].advanced = !1;
399
- const s = this.lights[o].key;
400
- this.lightKeys.forEach((n) => {
401
- n !== "key" && (this.lights[o][n].color = s.color);
505
+ s.advanced = !1;
506
+ const n = this.lights[t];
507
+ if (!n) return;
508
+ const r = n.key;
509
+ this.collection.forEach((i) => {
510
+ i !== "key" && (n[i].color = r.color);
402
511
  });
403
512
  },
404
- setControlOptions(e, t, o = null) {
405
- o === null && (o = p().selected), this.options[o] || (this.options[o] = Et());
406
- const s = e.position.clone(), n = e.quaternion.clone(), r = t.target.clone();
407
- this.options[o].position = { x: s.x, y: s.y, z: s.z }, this.options[o].quaternion = { x: n.x, y: n.y, z: n.z, w: n.w }, this.options[o].target = { x: r.x, y: r.y, z: r.z };
408
- },
409
513
  setColorHex(e, t) {
410
- var l;
411
- const s = p().selected, n = this.lights[s], r = be(t);
412
- if (((l = this.options[s]) == null ? void 0 : l.advanced) === !0) {
514
+ var i;
515
+ this.initLights();
516
+ const s = this.bpId;
517
+ if (s == null) return;
518
+ const n = this.lights[s];
519
+ if (!n) return;
520
+ const r = et(t);
521
+ if (((i = this.options[s]) == null ? void 0 : i.advanced) === !0) {
413
522
  n[e].color = r;
414
523
  return;
415
524
  }
416
- this.collection.forEach((a) => {
417
- n[a].color = r;
525
+ this.collection.forEach((o) => {
526
+ n[o].color = r;
418
527
  });
419
528
  },
420
- setProperty(e, t, o) {
421
- const n = p().selected;
422
- this.lights[n][e][t] = o;
529
+ setProperty(e, t, s) {
530
+ this.initLights();
531
+ const n = this.bpId;
532
+ if (n == null) return;
533
+ const r = this.lights[n];
534
+ r && (r[e][t] = s);
535
+ },
536
+ setAmbientScale(e) {
537
+ this.initLights();
538
+ const t = this.ensureSelectedScales();
539
+ t && (t.ambientScale = ot(e, Pe, Et));
540
+ },
541
+ setUserScale(e) {
542
+ this.initLights();
543
+ const t = this.ensureSelectedScales();
544
+ t && (t.userScale = ot(e, Pe, It));
423
545
  },
424
546
  initLights() {
425
- const t = p().selected;
426
- this.lights[t] || (this.lights[t] = {
427
- key: pt(),
428
- fill: pt({ shadow: !0 }),
429
- back: pt({ shadow: !0 })
430
- }), this.options[t] || (this.options[t] = Et());
547
+ const e = this.bpId, t = this.skinId;
548
+ t != null && !this.scales[t] && (this.scales[t] = rt()), e != null && (this.lights[e] || (this.lights[e] = xt()), this.options[e] || (this.options[e] = nt()));
549
+ },
550
+ markFramed() {
551
+ const e = this.bpId;
552
+ e != null && (this.framed[e] = !0);
553
+ },
554
+ // Capture the active basePose + skin's tunable lighting state for
555
+ // the save+freeze flow. Skips `seeds` (per-skin recipe baselines —
556
+ // rewritten on every GLB load, not user state) and `framed` (a
557
+ // session flag, not view-state). The three returned slots match
558
+ // exactly what `restore()` writes back.
559
+ //
560
+ // lights — per-spot color/visible/shadow for the active basePose
561
+ // options — rig position/quaternion/target/radius + toggles
562
+ // scales — ambient/user intensity sliders for the active skin
563
+ // only (per "skip per-skin transfer" rule — saves don't
564
+ // carry maps across skins).
565
+ snapshot() {
566
+ const e = this.bpId, t = this.skinId;
567
+ if (e == null) return null;
568
+ const s = this.lights[e] ? JSON.parse(JSON.stringify(this.lights[e])) : null, n = this.options[e] ? JSON.parse(JSON.stringify(this.options[e])) : null, r = t != null && this.scales[t] ? JSON.parse(JSON.stringify(this.scales[t])) : null;
569
+ return !s && !n && !r ? null : { lights: s, options: n, scales: r };
570
+ },
571
+ restore(e) {
572
+ if (e == null || typeof e != "object") return;
573
+ const t = this.bpId, s = this.skinId;
574
+ t != null && (e.lights && (this.lights = { ...this.lights, [t]: JSON.parse(JSON.stringify(e.lights)) }), e.options && (this.options = { ...this.options, [t]: JSON.parse(JSON.stringify(e.options)) }), e.scales && s != null && (this.scales = { ...this.scales, [s]: JSON.parse(JSON.stringify(e.scales)) }), this.framed[t] = !0, this.applyRevision = (this.applyRevision || 0) + 1);
431
575
  }
432
576
  }
433
- }), Ye = {
577
+ }), Zt = {
434
578
  position: { x: 0, y: 0.39999999999999986, z: 1.5 },
435
579
  quaternion: { x: -0.12993279108591813, y: 0, z: 0, w: 0.9915228034698058 },
436
580
  target: { x: 0, y: 0, z: 0 },
437
581
  radius: 1.5
438
- }, At = (e = {}) => ({ ...Ye, ...e }), Ct = de("3d-controls", {
439
- state: () => ({
440
- models: {}
441
- }),
442
- getters: {
443
- changed(e) {
444
- var s;
445
- const o = p().selected;
446
- return (s = e.models) != null && s[o] ? !tt(e.models[o], Ye) : !1;
447
- },
448
- property() {
449
- return (e, t = null) => {
450
- var o;
451
- return ((o = this.selectedModel) == null ? void 0 : o[e]) ?? t;
452
- };
453
- },
454
- selectedId() {
455
- return p().selected;
456
- },
457
- selectedModel(e) {
458
- const t = this.selectedId;
459
- return e.models[t] ?? null;
460
- },
461
- mergedModel() {
462
- return { ...Ye, ...this.selectedModel ?? {} };
463
- },
464
- position() {
465
- return this.mergedModel.position;
466
- },
467
- quaternion() {
468
- return this.mergedModel.quaternion;
469
- },
470
- target() {
471
- return this.mergedModel.target;
472
- },
473
- radius() {
474
- return this.mergedModel.radius;
475
- }
582
+ }, Os = {
583
+ changed() {
584
+ return this.exists ? !Qe(this.mergedModel, Zt) : !1;
476
585
  },
477
- actions: {
478
- reset() {
479
- const e = p().selected;
480
- this.models[e] = { ...Ye };
481
- },
482
- ensureSelectedModel() {
483
- const e = p().selected;
484
- return this.models[e] || (this.models[e] = { ...Ye }), this.models[e];
485
- },
486
- patchSelected(e) {
487
- const t = this.ensureSelectedModel();
488
- Object.assign(t, e);
489
- },
490
- setProperty(e, t) {
491
- const o = this.ensureSelectedModel();
492
- o[e] = t;
493
- },
494
- setPosition(e) {
495
- this.setProperty("position", e);
496
- },
497
- setQuaternion(e) {
498
- this.setProperty("quaternion", e);
499
- },
500
- setTarget(e) {
501
- this.setProperty("target", e);
502
- },
503
- setRadius(e) {
504
- this.setProperty("radius", e);
505
- },
506
- setControlOptions(e, t, o = null) {
507
- o === null && (o = p().selected), this.models[o] || (this.models[o] = At());
508
- const s = e.position.clone(), n = e.quaternion.clone(), r = t.target.clone();
509
- this.models[o].position = { x: s.x, y: s.y, z: s.z }, this.models[o].quaternion = { x: n.x, y: n.y, z: n.z, w: n.w }, this.models[o].target = { x: r.x, y: r.y, z: r.z };
510
- },
511
- initControls() {
512
- const t = p().selected;
513
- t && !this.models[t] && (this.models[t] = At());
514
- }
586
+ // Has frameToBounds + syncToStore landed on this basePose's
587
+ // bucket? An explicit per-basePose flag, set by markFramed() from
588
+ // the bounds watcher in ThreeDimensionTool. We can't infer this by
589
+ // comparing position to defaults: applyFromStore normalizes the
590
+ // default direction and scales by radius, so syncToStore writes a
591
+ // position that's close to but not exactly equal to defaults, and
592
+ // happens every animate frame — by the time bounds arrive, a
593
+ // value-based check would already read "rigged" on a fresh basePose
594
+ // and skip the initial framing.
595
+ hasRig(e) {
596
+ return !!e.framed[this.keyId];
597
+ },
598
+ position() {
599
+ return this.mergedModel.position;
600
+ },
601
+ quaternion() {
602
+ return this.mergedModel.quaternion;
603
+ },
604
+ target() {
605
+ return this.mergedModel.target;
606
+ },
607
+ radius() {
608
+ return this.mergedModel.radius;
609
+ }
610
+ }, Ns = {
611
+ initControls() {
612
+ this.initModel(this.keyId);
613
+ },
614
+ markFramed() {
615
+ const e = this.keyId;
616
+ e != null && (this.framed[e] = !0);
617
+ },
618
+ setPosition(e) {
619
+ this.setProperty("position", e);
620
+ },
621
+ setQuaternion(e) {
622
+ this.setProperty("quaternion", e);
623
+ },
624
+ setTarget(e) {
625
+ this.setProperty("target", e);
626
+ },
627
+ setRadius(e) {
628
+ this.setProperty("radius", e);
515
629
  }
516
- }), vt = {
630
+ }, pt = tt({
631
+ storeId: "3d-controls",
632
+ defaultValues: Zt,
633
+ state: { framed: {} },
634
+ getters: Os,
635
+ actions: Ns,
636
+ keyBy: "basePoseId"
637
+ }), Us = {
517
638
  color: 16711422
518
- }, zt = (e = {}) => ({ ...vt, ...e }), lt = de("3d-scene", {
519
- state: () => ({
520
- models: {}
521
- }),
522
- getters: {
523
- changed(e) {
524
- var s, n;
525
- const o = p().selected;
526
- return ((n = (s = e.models) == null ? void 0 : s[o]) == null ? void 0 : n.color) !== 16711422;
527
- },
528
- colorHex(e) {
529
- var n;
530
- const o = p().selected, s = (n = e.models[o]) == null ? void 0 : n.color;
531
- return ce(s || vt.color);
532
- }
639
+ }, $s = {
640
+ changed() {
641
+ return this.propertyChanged("color");
533
642
  },
534
- actions: {
535
- reset() {
536
- const t = p().selected;
537
- this.models[t] = { ...vt };
538
- },
539
- selectedId() {
540
- return p().selected;
541
- },
542
- setColorHex(e) {
543
- const o = p().selected;
544
- this.models[o] || (this.models[o] = zt()), this.models[o].color = be(e);
545
- },
546
- init() {
547
- const t = p().selected;
548
- this.models[t] || (this.models[t] = zt());
549
- }
643
+ colorHex() {
644
+ return ue(this.property("color"));
645
+ }
646
+ }, qs = {
647
+ init() {
648
+ this.initModel(this.keyId);
649
+ },
650
+ setColorHex(e) {
651
+ this.setProperty("color", et(e));
550
652
  }
551
- }), Te = {
653
+ }, mt = tt({
654
+ storeId: "3d-scene",
655
+ defaultValues: Us,
656
+ getters: $s,
657
+ actions: qs,
658
+ keyBy: "basePoseId"
659
+ }), Yt = {
552
660
  show: !1,
553
661
  front: !1,
554
662
  back: !1,
@@ -558,90 +666,34 @@ const ut = new M.Vector3(), Mt = (e) => {
558
666
  bottom: !1,
559
667
  divisions: 6,
560
668
  opacity: 0.5,
561
- size: 2,
562
- lineColor: 13421772,
563
- centerLineColor: 16711680
564
- }, yo = (e = {}) => ({ ...Te, ...e }), Me = de("3d-grid", {
565
- state: () => ({
566
- models: {}
567
- }),
568
- getters: {
569
- changed(e) {
570
- const o = p().selected;
571
- return console.log("state.models[id]", e.models[o]), console.log("defaults", Te), !tt(e.models[o], Te);
572
- },
573
- property() {
574
- return (e, t = null) => {
575
- var o;
576
- return ((o = this.selectedModel) == null ? void 0 : o[e]) ?? t;
577
- };
578
- },
579
- selectedId() {
580
- return p().selected;
581
- },
582
- selectedModel(e) {
583
- const t = this.selectedId;
584
- return e.models[t] ?? null;
585
- },
586
- mergedModel() {
587
- return { ...Te, ...this.selectedModel ?? {} };
588
- },
589
- show() {
590
- return this.mergedModel.show;
591
- },
592
- lineColor() {
593
- return this.mergedModel.lineColor;
594
- },
595
- centerLineColor() {
596
- return this.mergedModel.centerLineColor;
597
- },
598
- opacity() {
599
- return this.mergedModel.opacity;
600
- },
601
- size() {
602
- return this.mergedModel.size;
603
- },
604
- divisions() {
605
- return this.mergedModel.divisions;
606
- },
607
- lineColorHex() {
608
- return ce(this.mergedModel.lineColor);
609
- },
610
- centerLineColorHex() {
611
- return ce(this.mergedModel.centerLineColor);
612
- }
669
+ size: 2
670
+ }, Hs = {
671
+ changed() {
672
+ return !Qe(this.mergedModel, Yt);
613
673
  },
614
- actions: {
615
- reset() {
616
- const t = p().selected;
617
- this.models[t] = { ...Te }, Ht(() => {
618
- this.models[t].show = !1;
619
- });
620
- },
621
- ensureSelectedModel() {
622
- const e = p().selected;
623
- return this.models[e] || (this.models[e] = { ...Te }), this.models[e];
624
- },
625
- patchSelected(e) {
626
- const t = this.ensureSelectedModel();
627
- Object.assign(t, e);
628
- },
629
- setProperty(e, t) {
630
- const o = this.ensureSelectedModel();
631
- o[e] = t;
632
- },
633
- setLineColorHex(e) {
634
- this.setProperty("lineColor", be(e));
635
- },
636
- setCenterLineColorHex(e) {
637
- this.setProperty("centerLineColor", be(e));
638
- },
639
- init() {
640
- const t = p().selected;
641
- this.models[t] || (this.models[t] = yo());
642
- }
674
+ show() {
675
+ return this.property("show");
676
+ },
677
+ opacity() {
678
+ return this.property("opacity");
679
+ },
680
+ size() {
681
+ return this.property("size");
682
+ },
683
+ divisions() {
684
+ return this.property("divisions");
685
+ }
686
+ }, Js = {
687
+ init() {
688
+ this.initModel(this.keyId);
643
689
  }
644
- }), So = [
690
+ }, ke = tt({
691
+ storeId: "3d-grid",
692
+ defaultValues: Yt,
693
+ getters: Hs,
694
+ actions: Js,
695
+ keyBy: "basePoseId"
696
+ }), Ks = [
645
697
  "#141111",
646
698
  "#3E251E",
647
699
  "#633C30",
@@ -682,74 +734,167 @@ const ut = new M.Vector3(), Mt = (e) => {
682
734
  "#BDACA8",
683
735
  "#DACDC9",
684
736
  "#E5E4E3"
685
- ], bt = "background", et = "subject", yt = "ground", Tt = {
686
- [et]: 16711422,
687
- [bt]: 16777215,
688
- [yt]: 12961221
689
- }, Ut = de("3d-colors", {
690
- state: () => ({
691
- models: {},
692
- palette: So
693
- }),
694
- getters: {
695
- property() {
696
- return (e, t = null) => {
697
- var o;
698
- return ((o = this.selectedModel) == null ? void 0 : o[e]) ?? t;
699
- };
700
- },
701
- selectedId() {
702
- return p().selected;
703
- },
704
- selectedModel(e) {
705
- const t = this.selectedId;
706
- return e.models[t] ?? null;
707
- },
708
- mergedModel() {
709
- return { ...Tt, ...this.selectedModel ?? {} };
710
- },
711
- model(e) {
712
- const o = p().selected;
713
- return o && e.models[o] ? e.models[o] : null;
714
- },
715
- subjectHex() {
716
- return this.getHexColor(et);
717
- },
718
- groundHex() {
719
- return this.getHexColor(yt);
720
- },
721
- backgroundHex() {
722
- return this.getHexColor(bt);
723
- }
737
+ ], Dt = "background", kt = "subject", Tt = "ground", Qt = {
738
+ [kt]: 16711422,
739
+ [Dt]: 16777215,
740
+ [Tt]: 12961221
741
+ }, Ws = {
742
+ changed() {
743
+ return this.exists ? !Qe(this.mergedModel, Qt) : !1;
724
744
  },
725
- actions: {
726
- initModel(e) {
727
- this.models[e] = { ...Tt };
728
- },
729
- getHexColor(e) {
730
- const o = p().selected;
731
- if (!this.models[o] || !this.models[o][e]) return "#F0F0F0";
732
- const s = this.models[o][e];
733
- return ce(s);
734
- },
735
- setHexColor(e = et, t = "#e6e6e6") {
736
- const s = p().selected;
737
- !this.models[s] || !this.models[s][e] || (this.models[s][e] = be(t));
738
- },
739
- setSubjectHex(e) {
740
- this.setHexColor(et, e);
741
- },
742
- setGroundHex(e) {
743
- this.setHexColor(yt, e);
745
+ subjectHex() {
746
+ return ue(this.property(kt));
747
+ },
748
+ groundHex() {
749
+ return ue(this.property(Tt));
750
+ },
751
+ backgroundHex() {
752
+ return ue(this.property(Dt));
753
+ },
754
+ getHexColor() {
755
+ return (e) => ue(this.property(e, "#F0F0F0"));
756
+ }
757
+ }, Xs = {
758
+ setHexColor(e, t) {
759
+ this.setProperty(e, et(t));
760
+ },
761
+ setSubjectHex(e) {
762
+ this.setHexColor(kt, e);
763
+ },
764
+ setGroundHex(e) {
765
+ this.setHexColor(Tt, e);
766
+ },
767
+ setBackgroundHex(e) {
768
+ this.setHexColor(Dt, e);
769
+ }
770
+ }, Mt = tt({
771
+ storeId: "3d-colors",
772
+ defaultValues: Qt,
773
+ state: { palette: Ks },
774
+ getters: Ws,
775
+ actions: Xs,
776
+ keyBy: "basePoseId"
777
+ });
778
+ let ee = null, Ge = null;
779
+ const Re = () => {
780
+ const e = M(), { aspect: t, width: s, height: n } = N(e), r = (c = { x: 0, y: 0.8, z: 1.5 }) => (console.debug("useCamera init"), ee ? (console.debug("view camera already inited"), ee) : (ee = new I.PerspectiveCamera(75, t.value, 0.1, 100), e.loaded.camera = !0, ee)), i = () => {
781
+ if (ee)
782
+ return ee;
783
+ };
784
+ return Ge = j(
785
+ () => t.value,
786
+ (c) => {
787
+ if (!ee) {
788
+ r();
789
+ return;
790
+ }
791
+ ee.aspect = c, ee.updateProjectionMatrix();
792
+ }
793
+ ), {
794
+ init: r,
795
+ getCamera: i,
796
+ dispose: () => {
797
+ Ge == null || Ge(), Ge = null, ee = null;
798
+ }
799
+ };
800
+ };
801
+ let W = null, be = null, ye = null, je = null;
802
+ const Ie = () => {
803
+ const e = mt(), t = M(), { colorHex: s } = N(e), n = () => (console.debug("useScene init"), W ? (console.debug("scene already inited"), W) : (W = new I.Scene(), i(s.value), t.loaded.scene = !0, W)), r = () => {
804
+ if (W)
805
+ return W;
806
+ }, i = (a) => {
807
+ if (!W) throw new Error("Scene has not been initialized");
808
+ W.background = new I.Color(a);
809
+ }, o = (a) => {
810
+ if (!W) throw new Error("Scene has not been initialized");
811
+ if (!a) throw new Error("Renderer required to build environment");
812
+ be || (ye = new I.PMREMGenerator(a), ye.compileEquirectangularShader(), be = ye.fromScene(new Is(), 0.04).texture, W.environment = be);
813
+ };
814
+ return je = j(
815
+ () => s.value,
816
+ (a) => i(a)
817
+ ), {
818
+ init: n,
819
+ get: r,
820
+ dispose: () => {
821
+ t.loaded.scene = !1, je == null || je(), je = null, W && (W.traverse((a) => {
822
+ var u, p;
823
+ a.isMesh && ((u = a.geometry) == null || u.dispose(), Array.isArray(a.material) ? a.material.forEach((P) => P == null ? void 0 : P.dispose()) : (p = a.material) == null || p.dispose());
824
+ }), W.clear(), W = null, be == null || be.dispose(), ye == null || ye.dispose(), be = null, ye = null);
744
825
  },
745
- setBackgroundHex(e) {
746
- this.setHexColor(bt, e);
826
+ setBackgroundColor: i,
827
+ setEnvironment: o
828
+ };
829
+ };
830
+ let L = null, Oe = null, Ne = null;
831
+ const Xe = () => {
832
+ const e = M(), { get: t } = Ie(), { getCamera: s } = Re(), { width: n, height: r, subjectLoaded: i } = N(e);
833
+ function o(w) {
834
+ return console.debug("useRenderer init"), L ? (console.debug("renderer already inited"), L) : (L = new I.WebGLRenderer({ antialias: !0, alpha: !0, preserveDrawingBuffer: !0 }), L.setSize(n.value, r.value), L.toneMapping = I.ACESFilmicToneMapping, L.toneMappingExposure = 0.8, L.shadowMap.enabled = !0, L.shadowMap.type = I.PCFSoftShadowMap, L.outputColorSpace = I.SRGBColorSpace, w && w.appendChild(L.domElement), e.loaded.renderer = !0, L);
835
+ }
836
+ const c = () => {
837
+ if (!L) throw new Error("Renderer has not been initialized");
838
+ return L;
839
+ }, a = (w) => {
840
+ L && (L.toneMappingExposure = w);
841
+ }, u = () => {
842
+ const w = t(), m = s();
843
+ !w || !m || L.render(w, m);
844
+ };
845
+ async function p({ size: w = 1024, format: m = "jpeg", quality: g = 0.85 } = {}) {
846
+ if (!L) throw new Error("Renderer has not been initialized");
847
+ const y = t(), x = s();
848
+ if (!y || !x) throw new Error("Scene or camera not ready");
849
+ const v = L.getSize(new I.Vector2()), k = L.getPixelRatio(), R = x.aspect;
850
+ try {
851
+ L.setPixelRatio(1), L.setSize(w, w, !1), x.aspect = 1, x.updateProjectionMatrix(), L.render(y, x);
852
+ const F = m === "png" ? "image/png" : "image/jpeg";
853
+ return await new Promise(($, K) => {
854
+ L.domElement.toBlob(
855
+ (b) => b ? $(b) : K(new Error("toBlob returned null")),
856
+ F,
857
+ m === "jpeg" ? g : void 0
858
+ );
859
+ });
860
+ } finally {
861
+ L.setPixelRatio(k), L.setSize(v.x, v.y, !1), x.aspect = R, x.updateProjectionMatrix(), L.render(y, x);
747
862
  }
748
863
  }
749
- }), p = de("3d", {
864
+ Oe = j(
865
+ () => [n.value, r.value],
866
+ ([w, m]) => {
867
+ !w || !m || !L || L.setSize(w, m);
868
+ }
869
+ ), Ne = j(
870
+ () => i.value,
871
+ () => u()
872
+ );
873
+ function P() {
874
+ console.debug("renderer disposed"), e.loaded.renderer = !1, Oe == null || Oe(), Ne == null || Ne(), Oe = null, Ne = null, L && (L.domElement.parentElement && L.domElement.parentElement.removeChild(L.domElement), L.dispose(), L = null);
875
+ }
876
+ return {
877
+ init: o,
878
+ get: c,
879
+ dispose: P,
880
+ render: u,
881
+ setExposure: a,
882
+ captureSnapshot: p
883
+ };
884
+ }, M = Ye("3d", {
750
885
  state: () => ({
751
886
  // models: {},
752
887
  selected: null,
888
+ // Identifies the per-session bucket for stores keyed by basePoseId
889
+ // (3d-grid, and future basePose-scoped 3D stores) so they survive
890
+ // skin/GLB swaps within the same basePose. Set in setFromResponse
891
+ // from the host envelope's result.basePoseId. Mirrors use360Store's
892
+ // basePoseId field — see GitHub #149 / #145.
893
+ basePoseId: null,
894
+ // Per-set thumbnail UUID from the host envelope. Used by the skins
895
+ // selector to render preview thumbnails against the dynamic-images
896
+ // server's /sets/{uuid}/.../{slug}.webp pattern.
897
+ setUuid: null,
753
898
  width: 0,
754
899
  height: 0,
755
900
  loaded: {
@@ -768,12 +913,16 @@ const ut = new M.Vector3(), Mt = (e) => {
768
913
  }),
769
914
  getters: {
770
915
  active(e) {
771
- var o, s;
772
- const t = ft.is.mobile ? ot : oe;
773
- return ((s = (o = this.models) == null ? void 0 : o[e.selected]) == null ? void 0 : s.active) || t;
916
+ var s, n;
917
+ const t = Ct.is.mobile ? lt : xe;
918
+ return ((n = (s = this.models) == null ? void 0 : s[e.selected]) == null ? void 0 : n.active) || t;
774
919
  },
775
920
  aspect(e) {
776
921
  return e.height > 0 ? e.width / e.height : 0;
922
+ },
923
+ isFrozen(e) {
924
+ var t;
925
+ return ((t = this.appFreezeStore) == null ? void 0 : t.isFrozen(e.basePoseId)) || !1;
777
926
  }
778
927
  },
779
928
  actions: {
@@ -785,6 +934,13 @@ const ut = new M.Vector3(), Mt = (e) => {
785
934
  var t;
786
935
  return ((t = this.appPaywallStore) == null ? void 0 : t.block(e)) || !0;
787
936
  },
937
+ pokeFreeze() {
938
+ var e;
939
+ (e = this.appFreezeStore) == null || e.poke(this.basePoseId);
940
+ },
941
+ captureSnapshot(e) {
942
+ return Xe().captureSnapshot(e);
943
+ },
788
944
  isExpanded(e = []) {
789
945
  return e = Array.isArray(e) ? e : [e], e.includes(this.active);
790
946
  },
@@ -793,120 +949,101 @@ const ut = new M.Vector3(), Mt = (e) => {
793
949
  },
794
950
  subscribe(e) {
795
951
  const t = this;
796
- e.$on("glb:loaded", (o) => {
797
- t.setFromResponse(o);
952
+ e.$on("glb:loaded", (s) => {
953
+ t.setFromResponse(s);
798
954
  });
799
955
  },
800
956
  setFromResponse(e) {
801
- var u;
802
- const t = Ut(), o = Ct(), s = Me(), n = Ve(), r = Be(), l = lt(), c = ye().setSubjectsFromResponse(e);
803
- if (c == null) {
957
+ var u, p, P;
958
+ const t = Mt(), s = pt(), n = ke(), r = Fe(), i = he(), o = mt(), a = fe().setSubjectsFromResponse(e);
959
+ if (this.setUuid = ((u = e == null ? void 0 : e.result) == null ? void 0 : u.setUuid) ?? null, this.basePoseId = ((p = e == null ? void 0 : e.result) == null ? void 0 : p.basePoseId) ?? null, a == null) {
804
960
  this.selected = null;
805
961
  return;
806
962
  }
807
- this.selected = c, t.initModel(c), r.initLights(), n.setGroundFromResponse(c), o.initControls(), s.init(), l.init(), this.models[c] || (this.models[c] = {}), (u = this.models[c]) != null && u.active || (this.models[c].active = ft.is.mobile ? ot : oe);
963
+ this.selected = a, t.initModel(this.basePoseId), i.initLights(), r.init(), s.initControls(), n.init(), o.init(), this.models[a] || (this.models[a] = {}), (P = this.models[a]) != null && P.active || (this.models[a].active = Ct.is.mobile ? lt : xe);
808
964
  }
809
965
  }
810
966
  });
811
- let ie = null, Pe = null;
812
- const Le = () => {
813
- const e = p(), { aspect: t, width: o, height: s } = I(e), n = (a = { x: 0, y: 0.8, z: 1.5 }) => (console.debug("useCamera init"), ie ? (console.debug("view camera already inited"), ie) : (ie = new M.PerspectiveCamera(75, t.value, 0.1, 100), e.loaded.camera = !0, ie)), r = () => {
814
- if (ie)
815
- return ie;
816
- };
817
- return Pe = O(
818
- () => t.value,
819
- (a) => {
820
- if (!ie) {
821
- n();
822
- return;
823
- }
824
- ie.aspect = a, ie.updateProjectionMatrix();
825
- }
826
- ), {
827
- init: n,
828
- getCamera: r,
829
- dispose: () => {
830
- Pe == null || Pe(), Pe = null, ie = null;
831
- }
832
- };
833
- };
834
- let se = null;
835
- const st = () => {
836
- const e = ee(!1), t = ee({
967
+ let Q = null;
968
+ const ct = () => {
969
+ const e = pe(!1), t = pe({
837
970
  mode: null,
838
971
  camera: null,
839
972
  // camera (or your lights-camera)
840
973
  store: null
841
974
  // pinia store with position/quaternion/target
842
- }), o = (b, f = {}) => {
843
- if (console.debug("useOrbitControlsBase init"), se)
844
- return console.debug("controls already inited"), se;
845
- const E = new M.Object3D();
846
- return se = new co(E, b.domElement), n(f), se;
847
- }, s = () => {
848
- if (!se) throw new Error("OrbitControls not initialized");
849
- return se;
850
- }, n = (b = {}) => {
851
- const f = s();
852
- f.enableDamping = b.enableDamping ?? !0, f.dampingFactor = b.dampingFactor ?? 0.5, f.rotateSpeed = b.rotateSpeed ?? 0.2, f.enableZoom = b.enableZoom ?? !0, f.minDistance = b.minDistance ?? 0.5, f.maxDistance = b.maxDistance ?? 6;
853
- }, r = ({ mode: b, camera: f, store: E, options: D }) => {
854
- const y = s();
855
- if (!f) throw new Error(`setMode(${b}): camera is required`);
856
- if (!E) throw new Error(`setMode(${b}): store is required`);
857
- y.object = f, n(D), t.value = { mode: b, camera: f, store: E }, c(), y.update();
858
- }, l = () => {
859
- se && se.update();
860
- }, a = () => {
861
- const b = s(), { camera: f, store: E } = t.value;
862
- !f || !E || e.value || (E.setPosition({ ...f.position }), E.setQuaternion({ ...f.quaternion }), E.setTarget({ ...b.target }), E.setRadius(f.position.distanceTo(b.target)));
975
+ }), s = (m, g = {}) => {
976
+ if (console.debug("useOrbitControlsBase init"), Q)
977
+ return console.debug("controls already inited"), Q;
978
+ const y = new I.Object3D();
979
+ return Q = new Ds(y, m.domElement), r(g), Q;
980
+ }, n = () => {
981
+ if (!Q) throw new Error("OrbitControls not initialized");
982
+ return Q;
983
+ }, r = (m = {}) => {
984
+ const g = n();
985
+ g.enableDamping = m.enableDamping ?? !0, g.dampingFactor = m.dampingFactor ?? 0.5, g.rotateSpeed = m.rotateSpeed ?? 0.2, g.enableZoom = m.enableZoom ?? !0, g.minDistance = m.minDistance ?? 0.5, g.maxDistance = m.maxDistance ?? 6, g.panSpeed = m.panSpeed ?? 1;
986
+ }, i = ({ mode: m, camera: g, store: y, options: x }) => {
987
+ const v = n();
988
+ if (!g) throw new Error(`setMode(${m}): camera is required`);
989
+ if (!y) throw new Error(`setMode(${m}): store is required`);
990
+ v.object = g, r(x), t.value = { mode: m, camera: g, store: y }, a(), v.update();
991
+ }, o = () => {
992
+ Q && Q.update();
863
993
  }, c = () => {
864
- const b = s(), { camera: f, store: E } = t.value;
865
- if (!f || !E) return;
994
+ const m = n(), { camera: g, store: y } = t.value;
995
+ !g || !y || e.value || (y.setPosition({ ...g.position }), y.setQuaternion({ ...g.quaternion }), y.setTarget({ ...m.target }), y.setRadius(g.position.distanceTo(m.target)));
996
+ }, a = () => {
997
+ const m = n(), { camera: g, store: y } = t.value;
998
+ if (!g || !y) return;
866
999
  e.value = !0;
867
- const { position: D, quaternion: y, target: k, radius: S } = E;
868
- b.target.set(k.x, k.y, k.z);
869
- const w = new M.Vector3(
870
- D.x - k.x,
871
- D.y - k.y,
872
- D.z - k.z
1000
+ const { position: x, quaternion: v, target: k, radius: R } = y;
1001
+ m.target.set(k.x, k.y, k.z);
1002
+ const F = new I.Vector3(
1003
+ x.x - k.x,
1004
+ x.y - k.y,
1005
+ x.z - k.z
873
1006
  ).normalize();
874
- f.position.copy(b.target).add(w.multiplyScalar(S)), f.quaternion.set(
875
- y.x,
876
- y.y,
877
- y.z,
878
- y.w
879
- ), b.update(), e.value = !1;
880
- };
1007
+ g.position.copy(m.target).add(F.multiplyScalar(R)), g.quaternion.set(
1008
+ v.x,
1009
+ v.y,
1010
+ v.z,
1011
+ v.w
1012
+ ), m.update(), e.value = !1;
1013
+ }, u = 0, p = 0.1;
881
1014
  return {
882
- init: o,
883
- get: s,
884
- setMode: r,
885
- update: l,
886
- syncToStore: a,
887
- applyFromStore: c,
888
- frameToBounds: (b, f = 1.75, E = 0.02) => {
889
- const D = s(), { camera: y } = t.value;
890
- if (!y || !b) return;
891
- const k = new M.Vector3(
892
- b.center.x,
893
- b.center.y + b.size.y * E,
894
- b.center.z
1015
+ init: s,
1016
+ get: n,
1017
+ setMode: i,
1018
+ update: o,
1019
+ syncToStore: c,
1020
+ applyFromStore: a,
1021
+ frameToBounds: (m, g = 1.75) => {
1022
+ const y = n(), { camera: x } = t.value;
1023
+ if (!x || !m) return;
1024
+ const v = new I.Vector3(
1025
+ m.center.x,
1026
+ m.center.y + m.size.y * u,
1027
+ m.center.z
895
1028
  );
896
- console.log("bounds", b);
897
- const S = Math.max(b.size.x, b.size.y, b.size.z), w = M.MathUtils.degToRad(y.fov);
898
- let F = S / 2 / Math.tan(w / 2) * f;
899
- D.target.copy(k), y.position.set(k.x, k.y, k.z + F), y.near = F / 100, y.far = F * 100, y.updateProjectionMatrix(), D.update();
1029
+ console.log("bounds", m);
1030
+ const k = Math.max(m.size.x, m.size.y, m.size.z), R = I.MathUtils.degToRad(x.fov);
1031
+ let F = k / 2 / Math.tan(R / 2) * g;
1032
+ y.target.copy(v), x.position.set(
1033
+ v.x,
1034
+ v.y + m.size.y * p,
1035
+ v.z + F
1036
+ ), x.near = F / 100, x.far = F * 100, x.updateProjectionMatrix(), y.update();
900
1037
  },
901
1038
  dispose: () => {
902
- console.debug("controls disposed"), se && (se.dispose(), se = null, t.value = { mode: null, camera: null, store: null });
1039
+ console.debug("controls disposed"), Q && (Q.dispose(), Q = null, t.value = { mode: null, camera: null, store: null });
903
1040
  }
904
1041
  };
905
- }, xt = () => {
906
- const { getCamera: e } = Le(), t = Ct(), o = st();
1042
+ }, At = () => {
1043
+ const { getCamera: e } = Re(), t = pt(), s = ct();
907
1044
  return {
908
1045
  activate: () => {
909
- o.setMode({
1046
+ s.setMode({
910
1047
  mode: "camera",
911
1048
  camera: e(),
912
1049
  store: t,
@@ -915,37 +1052,13 @@ const st = () => {
915
1052
  minDistance: 0.5,
916
1053
  maxDistance: 6
917
1054
  }
918
- });
919
- },
920
- frameToBounds: o.frameToBounds,
921
- syncToStore: o.syncToStore,
922
- applyFromStore: o.applyFromStore
923
- };
924
- };
925
- let te = null, Ge = null;
926
- const De = () => {
927
- const e = lt(), t = p(), { colorHex: o } = I(e), s = () => (console.debug("useScene init"), te ? (console.debug("scene already inited"), te) : (te = new M.Scene(), r(o.value), t.loaded.scene = !0, te)), n = () => {
928
- if (te)
929
- return te;
930
- }, r = (a) => {
931
- if (!te) throw new Error("Scene has not been initialized");
932
- te.background = new M.Color(a);
933
- };
934
- return Ge = O(
935
- () => o.value,
936
- (a) => r(a)
937
- ), {
938
- init: s,
939
- get: n,
940
- dispose: () => {
941
- t.loaded.scene = !1, Ge == null || Ge(), Ge = null, te && (te.traverse((a) => {
942
- var c, u;
943
- a.isMesh && ((c = a.geometry) == null || c.dispose(), Array.isArray(a.material) ? a.material.forEach((g) => g == null ? void 0 : g.dispose()) : (u = a.material) == null || u.dispose());
944
- }), te.clear(), te = null);
1055
+ });
945
1056
  },
946
- setBackgroundColor: r
1057
+ frameToBounds: s.frameToBounds,
1058
+ syncToStore: s.syncToStore,
1059
+ applyFromStore: s.applyFromStore
947
1060
  };
948
- }, Co = {
1061
+ }, Zs = {
949
1062
  asphalt: {
950
1063
  ao: "ao.jpg",
951
1064
  color: "color.jpg",
@@ -981,544 +1094,560 @@ const De = () => {
981
1094
  repeat: 100
982
1095
  }
983
1096
  };
984
- let z = null, He = null, Re = null, Oe = null;
985
- const Lt = () => {
986
- const e = Ve(), { get: t } = De(), { getCamera: o } = Le(), {
987
- visible: s,
988
- color: n,
989
- texture: r,
990
- offset: l
991
- } = I(e), a = () => {
992
- if (console.debug("useGround init"), z)
993
- return console.debug("ground already inited"), z;
994
- const D = t(), y = new M.PlaneGeometry(100, 100), k = new M.Color(n.value || 16777215), S = new M.MeshStandardMaterial({
995
- color: k,
1097
+ let A = null, Ue = null, $e = null, qe = null;
1098
+ const _t = () => {
1099
+ const e = Fe(), { get: t } = Ie(), { getCamera: s } = Re(), {
1100
+ visible: n,
1101
+ color: r,
1102
+ texture: i,
1103
+ offset: o
1104
+ } = N(e), c = () => {
1105
+ if (console.debug("useGround init"), A)
1106
+ return console.debug("ground already inited"), A;
1107
+ const g = t(), y = new I.PlaneGeometry(100, 100), x = new I.Color(r.value || 16777215), v = new I.MeshStandardMaterial({
1108
+ color: x,
996
1109
  // Default to white
997
- side: M.DoubleSide,
1110
+ side: I.DoubleSide,
998
1111
  roughness: 0.4,
999
1112
  metalness: 0.3,
1000
- emissive: k,
1113
+ emissive: x,
1001
1114
  emissiveIntensity: 0.05
1002
1115
  // tweak 0.1–0.6
1003
1116
  });
1004
- return z = new M.Mesh(y, S), z.rotation.x = -Math.PI / 2, z.receiveShadow = !0, z.visible = s.value, D.add(z), He = O(
1005
- () => s.value,
1006
- () => c()
1007
- ), Re = O(
1117
+ return A = new I.Mesh(y, v), A.rotation.x = -Math.PI / 2, A.receiveShadow = !0, A.visible = n.value, g.add(A), Ue = j(
1008
1118
  () => n.value,
1009
- (w) => f(w)
1010
- ), Oe = O(
1119
+ () => a()
1120
+ ), $e = j(
1011
1121
  () => r.value,
1012
- (w) => g(w)
1013
- ), z;
1122
+ (k) => w(k)
1123
+ ), qe = j(
1124
+ () => i.value,
1125
+ (k) => p(k)
1126
+ ), A;
1014
1127
  };
1015
- function c() {
1016
- if (o().position.y < z.position.y) {
1017
- z.visible = !1;
1128
+ function a() {
1129
+ if (s().position.y < A.position.y) {
1130
+ A.visible = !1;
1018
1131
  return;
1019
1132
  }
1020
- z.visible = s.value;
1133
+ A.visible = n.value;
1021
1134
  }
1022
- function u(D, y = 1, k = 1) {
1023
- return new M.TextureLoader().load(D, (F) => {
1024
- F.wrapS = M.RepeatWrapping, F.wrapT = M.RepeatWrapping, F.repeat.set(y, k), F.needsUpdate = !0;
1135
+ function u(g, y = 1, x = 1) {
1136
+ return new I.TextureLoader().load(g, (R) => {
1137
+ R.wrapS = I.RepeatWrapping, R.wrapT = I.RepeatWrapping, R.repeat.set(y, x), R.needsUpdate = !0;
1025
1138
  });
1026
1139
  }
1027
- const g = (D) => {
1028
- if (!z) throw new Error("Ground has not been initialized");
1029
- const y = Co[D];
1140
+ const p = (g) => {
1141
+ if (!A) throw new Error("Ground has not been initialized");
1142
+ const y = Zs[g];
1030
1143
  if (!y)
1031
- z.material.map = null, z.material.normalMap = null, z.material.displacementMap = null, z.material.roughnessMap = null, z.material.aoMap = null, z.material.metalnessMap = null, z.material.needsUpdate = !0;
1144
+ A.material.map = null, A.material.normalMap = null, A.material.displacementMap = null, A.material.roughnessMap = null, A.material.aoMap = null, A.material.metalnessMap = null, A.material.needsUpdate = !0;
1032
1145
  else {
1033
- const k = `https://static.figurosity.com/3d/textures/${D}/`, S = y.repeat;
1034
- z.material.map = u(
1035
- `${k}${y.color}`,
1036
- S,
1037
- S
1038
- ), z.material.normalMap = u(
1039
- `${k}${y.normal}`,
1040
- S,
1041
- S
1042
- ), z.material.displacementMap = u(
1043
- `${k}${y.displacement}`,
1044
- S,
1045
- S
1046
- ), z.material.roughnessMap = u(
1047
- `${k}${y.roughness}`,
1048
- S,
1049
- S
1050
- ), z.material.aoMap = u(
1051
- `${k}${y.ao}`,
1052
- S,
1053
- S
1054
- ), y.metalness && (z.material.metalnessMap = u(
1055
- `${k}${y.metalness}`,
1056
- S,
1057
- S
1058
- )), z.material.displacementScale = 0.1, z.material.displacementBias = -0.05, z.material.needsUpdate = !0;
1146
+ const x = `https://static.figurosity.com/3d/textures/${g}/`, v = y.repeat;
1147
+ A.material.map = u(
1148
+ `${x}${y.color}`,
1149
+ v,
1150
+ v
1151
+ ), A.material.normalMap = u(
1152
+ `${x}${y.normal}`,
1153
+ v,
1154
+ v
1155
+ ), A.material.displacementMap = u(
1156
+ `${x}${y.displacement}`,
1157
+ v,
1158
+ v
1159
+ ), A.material.roughnessMap = u(
1160
+ `${x}${y.roughness}`,
1161
+ v,
1162
+ v
1163
+ ), A.material.aoMap = u(
1164
+ `${x}${y.ao}`,
1165
+ v,
1166
+ v
1167
+ ), y.metalness && (A.material.metalnessMap = u(
1168
+ `${x}${y.metalness}`,
1169
+ v,
1170
+ v
1171
+ )), A.material.displacementScale = 0.1, A.material.displacementBias = -0.05, A.material.needsUpdate = !0;
1059
1172
  }
1060
- z.position.y = l.value, z.geometry.computeBoundingBox(), z.geometry.computeVertexNormals();
1061
- }, b = () => {
1062
- if (!z) throw new Error("Ground has not been initialized");
1063
- return z;
1064
- }, f = (D) => {
1065
- if (!z) throw new Error("Ground has not been initialized");
1066
- z.material.color.set(D);
1173
+ A.position.y = o.value, A.geometry.computeBoundingBox(), A.geometry.computeVertexNormals();
1174
+ }, P = () => {
1175
+ if (!A) throw new Error("Ground has not been initialized");
1176
+ return A;
1177
+ }, w = (g) => {
1178
+ if (!A) throw new Error("Ground has not been initialized");
1179
+ A.material.color.set(g);
1067
1180
  };
1068
- return { init: a, get: b, setColor: f, updateVisibility: c, dispose: () => {
1069
- var y, k;
1070
- if (He == null || He(), Re == null || Re(), Oe == null || Oe(), He = null, Re = null, Oe = null, !z) return;
1071
- const D = t();
1072
- D == null || D.remove(z), (y = z.geometry) == null || y.dispose(), Array.isArray(z.material) ? z.material.forEach((S) => S == null ? void 0 : S.dispose()) : (k = z.material) == null || k.dispose(), z = null;
1181
+ return { init: c, get: P, setColor: w, updateVisibility: a, dispose: () => {
1182
+ var y, x;
1183
+ if (Ue == null || Ue(), $e == null || $e(), qe == null || qe(), Ue = null, $e = null, qe = null, !A) return;
1184
+ const g = t();
1185
+ g == null || g.remove(A), (y = A.geometry) == null || y.dispose(), Array.isArray(A.material) ? A.material.forEach((v) => v == null ? void 0 : v.dispose()) : (x = A.material) == null || x.dispose(), A = null;
1073
1186
  } };
1074
- }, xo = (e, t = 16711422) => {
1075
- const o = new po(0.1, 0.1, 0.1, 6, 0.01), s = 0.1, n = 0.05, r = new M.ConeGeometry(n, s, 32);
1076
- o.index || o.setIndex(
1187
+ }, Ys = (e, t = 16711422) => {
1188
+ const s = new Ts(0.1, 0.1, 0.1, 6, 0.01), n = 0.1, r = 0.05, i = new I.ConeGeometry(r, n, 32);
1189
+ s.index || s.setIndex(
1077
1190
  Array.from(
1078
- { length: o.attributes.position.count },
1079
- (u, g) => g
1191
+ { length: s.attributes.position.count },
1192
+ (u, p) => p
1080
1193
  )
1081
- ), r.index || r.setIndex(
1194
+ ), i.index || i.setIndex(
1082
1195
  Array.from(
1083
- { length: r.attributes.position.count },
1084
- (u, g) => g
1196
+ { length: i.attributes.position.count },
1197
+ (u, p) => p
1085
1198
  )
1086
- ), r.rotateX(-Math.PI / 2), r.translate(0, 0, s / 2), Bt(o), Bt(r);
1087
- const l = uo([o, r]), a = new M.MeshBasicMaterial({
1199
+ ), i.rotateX(-Math.PI / 2), i.translate(0, 0, n / 2), Rt(s), Rt(i);
1200
+ const o = ks([s, i]), c = new I.MeshBasicMaterial({
1088
1201
  color: t,
1089
1202
  transparent: !0,
1090
1203
  opacity: 0.8
1091
- }), c = new M.Mesh(l, a);
1092
- if (c.position.set(0, 0, 0), c.rotateX(Math.PI), e && e.target) {
1093
- const u = new M.Vector3();
1094
- e.target.getWorldPosition(u), c.lookAt(u);
1204
+ }), a = new I.Mesh(o, c);
1205
+ if (a.position.set(0, 0, 0), a.rotateX(Math.PI), e && e.target) {
1206
+ const u = new I.Vector3();
1207
+ e.target.getWorldPosition(u), a.lookAt(u);
1095
1208
  }
1096
- return c.position.copy(e.position), c;
1209
+ return a.position.copy(e.position), a;
1097
1210
  };
1098
- let We = {}, ae = {}, X = {}, mt = {}, Ce = {}, ke = null, pe = null, qe = [], Ee = /* @__PURE__ */ new Map();
1099
- const nt = () => {
1100
- const e = p(), t = Be(), o = ye();
1101
- ee(!1);
1102
- const { subjectLoaded: s, width: n, height: r, selected: l } = I(e), { debug: a, collection: c, advancedMode: u, move: g } = I(t), { get: b } = De(), f = t.property, E = () => {
1103
- if (pe)
1104
- return console.warn("lights camera already inited"), pe;
1105
- const d = b();
1106
- return ke = y(), pe = k(), c.value.forEach((i) => {
1107
- const x = i === "key" ? pe : d, { group: V, light: A, directional: j, visualization: L } = S(
1108
- i,
1109
- x
1110
- );
1111
- X[i] = A, We[i] = V, mt[i] = j, Ce[i] = L, X[i].castShadow = !0, X[i].angle = Math.PI / 8, X[i].penumbra = 0.2, X[i].shadow.camera.near = 0.5, X[i].shadow.camera.far = 12, X[i].shadow.focus = 0.9, X[i].shadow.mapSize.set(4096, 4096), X[i].shadow.bias = -2e-4, X[i].shadow.normalBias = 0.02, X[i].shadow.radius = 2, X[i].shadow.camera.updateProjectionMatrix();
1112
- }), q(), C(), pe;
1113
- }, D = () => {
1114
- if (!pe)
1115
- throw new Error("Light camera not initialized.");
1116
- return pe;
1211
+ let it = {}, ne = {}, q = {}, ie = {}, Te = null, ae = null, Me = [], Ae = /* @__PURE__ */ new Map();
1212
+ const ut = () => {
1213
+ const e = M(), t = he(), s = fe();
1214
+ pe(!1);
1215
+ const { subjectLoaded: n, width: r, height: i, selected: o, basePoseId: c } = N(e), { debug: a, collection: u, advancedMode: p, move: P } = N(t), { get: w } = Ie(), m = t.property, g = () => {
1216
+ if (ae)
1217
+ return console.warn("lights camera already inited"), ae;
1218
+ const S = w();
1219
+ return Te = v(), ae = k(), u.value.forEach((l) => {
1220
+ const f = l === "key" ? ae : S, { group: T, light: D, visualization: E } = R(l, f);
1221
+ q[l] = D, it[l] = T, ie[l] = E, q[l].castShadow = !0, q[l].angle = Math.PI / 4, q[l].penumbra = 0.5, q[l].shadow.camera.near = 0.5, q[l].shadow.camera.far = 12, q[l].shadow.focus = 0.9, q[l].shadow.mapSize.set(4096, 4096), q[l].shadow.bias = -2e-4, q[l].shadow.normalBias = 0.02, q[l].shadow.radius = 2, q[l].shadow.camera.updateProjectionMatrix();
1222
+ }), G(), Y(), ae;
1117
1223
  }, y = () => {
1118
- const d = b(), i = new M.AmbientLight(f("key", "color"), 0.75);
1119
- return d.add(i), i;
1224
+ if (!ae)
1225
+ throw new Error("Light camera not initialized.");
1226
+ return ae;
1227
+ }, x = (S) => {
1228
+ S && (Object.values(q).forEach((l) => l == null ? void 0 : l.color.set(S)), Object.values(ie).forEach((l) => {
1229
+ var f;
1230
+ return (f = l == null ? void 0 : l.material) == null ? void 0 : f.color.set(S);
1231
+ }));
1232
+ }, v = () => {
1233
+ const S = w(), l = new I.AmbientLight(16777215, 0.2);
1234
+ return S.add(l), l;
1120
1235
  }, k = () => {
1121
- const d = b(), i = new M.PerspectiveCamera(
1236
+ const S = w(), l = new I.PerspectiveCamera(
1122
1237
  75,
1123
- n.value / r.value,
1238
+ r.value / i.value,
1124
1239
  0.1,
1125
1240
  100
1126
1241
  );
1127
- return i.position.set(0, 0, 1.5), d.add(i), i;
1242
+ return l.position.set(0, 0, 1.5), S.add(l), l;
1128
1243
  };
1129
- function S(d, i = null) {
1130
- const x = b(), V = new M.Group(), A = new M.SpotLight(
1131
- f(d, "color"),
1132
- f(d, "opacity")
1244
+ function R(S, l = null) {
1245
+ const f = w(), T = new I.Group(), D = new I.SpotLight(
1246
+ m(S, "color"),
1247
+ m(S, "intensity")
1133
1248
  );
1134
- A.position.set(0, 0, 0);
1135
- const j = new M.DirectionalLight(f(d, "color"), 0.2);
1136
- j.position.set(0, 0, 4), F(), A.target.position.set(0, 1, 0), A.target.updateMatrixWorld(), x.add(A.target), V.add(A), V.add(j);
1137
- const L = xo(
1138
- A,
1139
- f(d, "visualizationColor")
1140
- ), P = t.isVisible(d);
1141
- return L.visible = P, V.add(L), i.add(V), { group: V, light: A, directional: j, visualization: L };
1249
+ D.position.set(0, 0, 0), $(), D.target.position.set(0, 1, 0), D.target.updateMatrixWorld(), f.add(D.target), T.add(D);
1250
+ const E = Ys(
1251
+ D,
1252
+ m(S, "visualizationColor")
1253
+ ), O = t.isVisible(S);
1254
+ return E.visible = O, T.add(E), l.add(T), { group: T, light: D, visualization: E };
1142
1255
  }
1143
- const w = () => {
1144
- F(), Z(), U();
1145
- }, F = () => {
1146
- ke && ke.color.set(f("key", "color"));
1147
- const d = t.lights[l.value];
1148
- d && Object.keys(d).forEach((i) => {
1149
- const x = X[i];
1150
- if (!x) return;
1151
- const V = f(i, "color"), A = f(i, "visible"), j = f(i, "opacity"), L = f(i, "shadow") || !1;
1152
- if (V && x.color.set(V), x.visible = A, j != null && (x.intensity = j), x.castShadow = L, L) {
1153
- const P = f(i, "shadowSettings", {});
1154
- x.shadow.mapSize.set(
1155
- P.width || 1024,
1156
- P.height || 1024
1157
- ), x.shadow.camera.near = P.near || 0.5, x.shadow.camera.far = P.far || 50, x.shadow.needsUpdate = !0;
1256
+ const F = () => {
1257
+ $(), K(), b();
1258
+ }, $ = () => {
1259
+ if (!t.lights[c.value]) return;
1260
+ const l = t.seeds[o.value], f = t.ambientScale, T = t.userScale;
1261
+ if (Te && (l != null && l.ambient) && (Te.intensity = l.ambient.intensity * f), l != null && l.env) {
1262
+ const D = w();
1263
+ D && (D.environmentIntensity = l.env.intensity * f);
1264
+ }
1265
+ u.value.forEach((D) => {
1266
+ const E = q[D];
1267
+ if (!E) return;
1268
+ const O = m(D, "color"), ge = m(D, "visible"), J = m(D, "shadow") || !1;
1269
+ if (O && E.color.set(O), E.visible = ge, l != null && l[D] && (E.intensity = l[D].intensity * T), E.castShadow = J, J) {
1270
+ const re = m(D, "shadowSettings", {});
1271
+ E.shadow.mapSize.set(
1272
+ re.width || 1024,
1273
+ re.height || 1024
1274
+ ), E.shadow.camera.near = re.near || 0.5, E.shadow.camera.far = re.far || 50, E.shadow.needsUpdate = !0;
1158
1275
  }
1159
1276
  });
1160
- }, Z = () => {
1161
- const d = t.lights[l.value];
1162
- d && Object.keys(d).forEach((i) => {
1163
- if (!Ce[i]) return console.warn(`${i} does not exist`);
1164
- const x = t.isVisible(i);
1165
- Ce[i].visible = x, Ce[i].material.color.set(f(i, "color"));
1277
+ }, K = () => {
1278
+ t.lights[c.value] && u.value.forEach((l) => {
1279
+ if (!ie[l]) return console.warn(`${l} does not exist`);
1280
+ const f = t.isVisible(l);
1281
+ ie[l].visible = f, ie[l].material.color.set(m(l, "color"));
1166
1282
  });
1167
- }, U = () => {
1168
- const d = t.lights[l.value];
1169
- d && Object.keys(d).forEach((i) => {
1170
- const x = f(i, "debug") || a.value;
1171
- !ae[i] && x && (ae[i] = Y(i, X[i]), X[i].add(ae[i])), ae[i] && !x && (ae[i] = Q(ae[i]));
1283
+ }, b = () => {
1284
+ t.lights[c.value] && u.value.forEach((l) => {
1285
+ const f = m(l, "debug") || a.value;
1286
+ !ne[l] && f && (ne[l] = h(l, q[l]), q[l].add(ne[l])), ne[l] && !f && (ne[l] = B(ne[l]));
1172
1287
  });
1173
- }, Y = (d, i) => {
1174
- const x = b(), V = new M.SpotLightHelper(
1175
- i,
1176
- f(d, "visualizationColor")
1288
+ }, h = (S, l) => {
1289
+ const f = w(), T = new I.SpotLightHelper(
1290
+ l,
1291
+ m(S, "visualizationColor")
1177
1292
  );
1178
- return x.add(V), V;
1179
- }, Q = (d) => {
1180
- const i = b();
1181
- if (!(!i || !d))
1182
- return i.remove(d), d.dispose(), d = null, d;
1183
- }, q = () => {
1184
- const d = D(), i = o.bounds;
1185
- if (!i) return;
1186
- const x = new M.Vector3(
1187
- i.center.x,
1188
- i.center.y,
1189
- // + bounds.size.y + 0.05,
1190
- i.center.z
1191
- ), V = new M.Vector3().subVectors(x, d.position).normalize(), A = new M.Vector3(
1192
- V.x,
1293
+ return f.add(T), T;
1294
+ }, B = (S) => {
1295
+ const l = w();
1296
+ if (!(!l || !S))
1297
+ return l.remove(S), S.dispose(), S = null, S;
1298
+ }, G = () => {
1299
+ const S = y();
1300
+ if (!s.bounds) return;
1301
+ const f = t.target, T = new I.Vector3(f.x, f.y, f.z), D = new I.Vector3().subVectors(T, S.position).normalize(), E = new I.Vector3(
1302
+ D.x,
1193
1303
  0,
1194
- V.z
1195
- ).normalize(), j = new M.Vector3(
1196
- -A.z,
1304
+ D.z
1305
+ ).normalize(), O = new I.Vector3(
1306
+ -E.z,
1197
1307
  0,
1198
- A.x
1199
- ), P = 2 * d.position.distanceTo(x) / Math.sqrt(3), W = 1, _ = x.clone().add(j.clone().multiplyScalar(-P / W)).add(V.clone().multiplyScalar(Math.sqrt(3) * P / 2)), K = x.clone().add(j.clone().multiplyScalar(P / W)).add(V.clone().multiplyScalar(Math.sqrt(3) * P / 2));
1200
- We.fill.position.copy(_), We.back.position.copy(K), c.value.forEach((re) => {
1201
- var N, le, ue;
1202
- const m = X[re];
1203
- m.shadow.needsUpdate = !0, m.target.position.copy(x), m.target.updateMatrixWorld(), (N = Ce[re]) == null || N.lookAt(x), (ue = (le = ae[re]) == null ? void 0 : le.update) == null || ue.call(le);
1204
- });
1205
- }, B = (d) => {
1206
- const i = t.lights[d];
1207
- if (!i) return;
1208
- const x = `watcher-${d}`;
1209
- if (Ee.has(x)) return;
1210
- const V = [];
1211
- Object.keys(i).forEach((j) => {
1212
- var L, P;
1213
- (L = i[j]) != null && L.color && V.push(() => i[j].color), (P = i[j]) != null && P.visible && V.push(() => i[j].visible);
1308
+ E.x
1309
+ ), J = 2 * S.position.distanceTo(T) / Math.sqrt(3), re = 1, _e = T.clone().add(O.clone().multiplyScalar(-J / re)).add(D.clone().multiplyScalar(Math.sqrt(3) * J / 2)), as = T.clone().add(O.clone().multiplyScalar(J / re)).add(D.clone().multiplyScalar(Math.sqrt(3) * J / 2));
1310
+ it.fill.position.copy(_e), it.back.position.copy(as), u.value.forEach((ht) => {
1311
+ var Pt, st, Lt;
1312
+ const gt = q[ht];
1313
+ gt.shadow.needsUpdate = !0, gt.target.position.copy(T), gt.target.updateMatrixWorld(), (Pt = ie[ht]) == null || Pt.lookAt(T), (Lt = (st = ne[ht]) == null ? void 0 : st.update) == null || Lt.call(st);
1214
1314
  });
1215
- const A = O(
1216
- () => V.map((j) => j()),
1217
- w,
1315
+ }, z = (S) => {
1316
+ const l = `watcher-${S}`;
1317
+ if (Ae.has(l)) return;
1318
+ const f = j(
1319
+ () => [t.lights[S], t.options[S]],
1320
+ F,
1218
1321
  { deep: !0 }
1219
1322
  );
1220
- Ee.set(x, A);
1221
- }, T = (d) => {
1222
- const i = `watcher-${d}`, x = Ee.get(i);
1223
- x && (x(), Ee.delete(i));
1224
- }, C = () => {
1225
- qe.push(
1226
- O(
1227
- () => [u.value, l.value, g.value],
1228
- () => w()
1323
+ Ae.set(l, f);
1324
+ }, U = (S) => {
1325
+ const l = `watcher-${S}`, f = Ae.get(l);
1326
+ f && (f(), Ae.delete(l));
1327
+ }, Y = () => {
1328
+ Me.push(
1329
+ j(
1330
+ () => [p.value, o.value, P.value],
1331
+ () => F()
1332
+ )
1333
+ ), Me.push(
1334
+ j(
1335
+ () => [t.ambientScale, t.userScale],
1336
+ () => F()
1229
1337
  )
1230
- ), qe.push(
1231
- O(
1232
- () => s.value,
1233
- (d) => {
1234
- d === !0 && q();
1338
+ ), Me.push(
1339
+ j(
1340
+ () => n.value,
1341
+ (S) => {
1342
+ S === !0 && G();
1235
1343
  }
1236
1344
  )
1237
- ), qe.push(
1238
- O(
1239
- () => l.value,
1240
- (d, i) => {
1241
- i && T(i), d != null && (B(d), Ht(w));
1345
+ ), Me.push(
1346
+ j(
1347
+ () => c.value,
1348
+ (S, l) => {
1349
+ l && U(l), S != null && (z(S), ls(F));
1242
1350
  },
1243
1351
  { immediate: !0 }
1244
1352
  )
1245
1353
  );
1246
1354
  };
1247
1355
  return {
1248
- init: E,
1249
- updatePosition: q,
1250
- getCamera: D,
1356
+ init: g,
1357
+ updatePosition: G,
1358
+ getCamera: y,
1251
1359
  dispose: () => {
1252
- const d = b();
1253
- d && (qe.forEach((i) => i()), qe = [], Ee.forEach((i) => i()), Ee.clear(), Object.values(X).forEach((i) => d.remove(i)), Object.values(mt).forEach((i) => d.remove(i)), Object.values(ae).forEach((i) => d.remove(i)), Object.values(Ce).forEach((i) => {
1254
- var x, V, A, j;
1255
- d.remove(i), (V = (x = i.geometry) == null ? void 0 : x.dispose) == null || V.call(x), (j = (A = i.material) == null ? void 0 : A.dispose) == null || j.call(A);
1256
- }), ke && d.remove(ke), We = {}, ae = {}, X = {}, mt = {}, Ce = {}, ke = null, pe = null);
1257
- }
1360
+ const S = w();
1361
+ S && (Me.forEach((l) => l()), Me = [], Ae.forEach((l) => l()), Ae.clear(), Object.values(q).forEach((l) => S.remove(l)), Object.values(ne).forEach((l) => S.remove(l)), Object.values(ie).forEach((l) => {
1362
+ var f, T, D, E;
1363
+ S.remove(l), (T = (f = l.geometry) == null ? void 0 : f.dispose) == null || T.call(f), (E = (D = l.material) == null ? void 0 : D.dispose) == null || E.call(D);
1364
+ }), Te && S.remove(Te), it = {}, ne = {}, q = {}, ie = {}, Te = null, ae = null);
1365
+ },
1366
+ applyColorPreview: x,
1367
+ applyFromStore: F
1258
1368
  };
1259
- }, wt = () => {
1260
- const e = Be(), t = st(), { getCamera: o } = nt();
1369
+ }, Qs = 0.4, eo = 0.25, Bt = () => {
1370
+ const e = he(), t = ct(), { getCamera: s } = ut();
1261
1371
  return {
1262
1372
  activate: () => {
1263
1373
  t.setMode({
1264
1374
  mode: "lights",
1265
- camera: o(),
1375
+ camera: s(),
1266
1376
  store: e,
1267
1377
  options: {
1268
1378
  enableZoom: !0,
1269
1379
  minDistance: 0.5,
1270
- maxDistance: 10
1380
+ maxDistance: 10,
1381
+ // Invert OrbitControls' "drag the world" pan so shift+drag
1382
+ // translates the rig in the direction of the drag — matches
1383
+ // the user's "I'm moving the lights" mental model.
1384
+ panSpeed: -1
1271
1385
  }
1272
1386
  });
1273
1387
  },
1274
- frameToBounds: t.frameToBounds,
1388
+ frameToBounds: (i, o = 1.75) => {
1389
+ if (!i) return;
1390
+ const c = t.get(), a = s(), u = new I.Vector3(
1391
+ i.center.x,
1392
+ i.center.y + i.size.y * Qs,
1393
+ i.center.z
1394
+ ), p = Math.max(i.size.x, i.size.y, i.size.z), P = I.MathUtils.degToRad(a.fov), w = p / 2 / Math.tan(P / 2) * o;
1395
+ c.target.copy(u), a.position.set(u.x, u.y + i.size.y * eo, u.z + w), a.near = w / 100, a.far = w * 100, a.updateProjectionMatrix(), c.update();
1396
+ },
1275
1397
  syncToStore: t.syncToStore,
1276
1398
  applyFromStore: t.applyFromStore
1277
1399
  };
1278
1400
  };
1279
- let me = null;
1280
- const wo = () => {
1401
+ let le = null;
1402
+ const to = () => {
1281
1403
  const e = () => {
1282
- const o = p();
1283
- return me = new M.LoadingManager(), me.onStart = function(s) {
1284
- o.loading.active = !0, o.loading.url = s, o.loading.percent = 0;
1285
- }, me.onError = () => {
1286
- o.loading.active = !1, o.loading.url = null;
1287
- }, me.onLoad = function() {
1288
- o.loading.active = !1, o.loading.url = null, o.loading.percent = 100;
1289
- }, me.onProgress = function(s, n, r) {
1290
- o.loading.percent = Math.round(n / r * 100);
1291
- }, me;
1292
- };
1293
- return { get: () => (me || e(), me) };
1294
- };
1295
- let R = null, _e = null, Ue = null;
1296
- const St = () => {
1297
- const e = p(), { get: t } = De(), { getCamera: o } = Le(), { width: s, height: n, subjectLoaded: r } = I(e);
1298
- function l(g) {
1299
- return console.debug("useRenderer init"), R ? (console.debug("renderer already inited"), R) : (R = new M.WebGLRenderer({ antialias: !0, alpha: !0 }), R.setSize(s.value, n.value), R.toneMapping = M.ACESFilmicToneMapping, R.toneMappingExposure = 1.2, R.shadowMap.enabled = !0, R.shadowMap.type = M.PCFSoftShadowMap, R.gammaFactor = 2.2, R.gammaOutput = !0, R.outputColorSpace = M.SRGBColorSpace, g && g.appendChild(R.domElement), e.loaded.renderer = !0, R);
1300
- }
1301
- const a = () => {
1302
- if (!R) throw new Error("Renderer has not been initialized");
1303
- return R;
1304
- }, c = () => {
1305
- const g = t(), b = o();
1306
- !g || !b || R.render(g, b);
1307
- };
1308
- _e = O(
1309
- () => [s.value, n.value],
1310
- ([g, b]) => {
1311
- !g || !b || !R || R.setSize(g, b);
1312
- }
1313
- ), Ue = O(
1314
- () => r.value,
1315
- () => c()
1316
- );
1317
- function u() {
1318
- console.debug("renderer disposed"), e.loaded.renderer = !1, _e == null || _e(), Ue == null || Ue(), _e = null, Ue = null, R && (R.domElement.parentElement && R.domElement.parentElement.removeChild(R.domElement), R.dispose(), R = null);
1319
- }
1320
- return {
1321
- init: l,
1322
- get: a,
1323
- dispose: u,
1324
- render: c
1404
+ const s = M();
1405
+ return le = new I.LoadingManager(), le.onStart = function(n) {
1406
+ s.loading.active = !0, s.loading.url = n, s.loading.percent = 0;
1407
+ }, le.onError = () => {
1408
+ s.loading.active = !1, s.loading.url = null;
1409
+ }, le.onLoad = function() {
1410
+ s.loading.active = !1, s.loading.url = null, s.loading.percent = 100;
1411
+ }, le.onProgress = function(n, r, i) {
1412
+ s.loading.percent = Math.round(r / i * 100);
1413
+ }, le;
1325
1414
  };
1326
- }, Vt = (e, t, o = {}) => {
1327
- const { removeSpecular: s = !1, removeShininess: n = !1 } = o;
1328
- e && e.traverse((r) => {
1329
- if (!r.isMesh) return;
1330
- (Array.isArray(r.material) ? r.material : [r.material]).forEach((a) => {
1331
- a && (a.color && a.color.set(t), s && a.specular && a.specular.set(0), n && typeof a.shininess == "number" && (a.shininess = 0), a.needsUpdate = !0);
1415
+ return { get: () => (le || e(), le) };
1416
+ }, so = /hair|lash|brow|eye|cornea|sclera|iris|pupil|tear|teeth|tongue|mouth|gum|lip|nail/i, oo = (e, t, s = {}) => {
1417
+ const { removeSpecular: n = !1, removeShininess: r = !1 } = s;
1418
+ e && e.traverse((i) => {
1419
+ if (!i.isMesh) return;
1420
+ (Array.isArray(i.material) ? i.material : [i.material]).forEach((c) => {
1421
+ if (!c) return;
1422
+ const a = `${i.name} ${c.name || ""}`;
1423
+ so.test(a) || (c.color && c.color.set(t), n && c.specular && c.specular.set(0), r && typeof c.shininess == "number" && (c.shininess = 0), c.needsUpdate = !0);
1332
1424
  });
1333
1425
  });
1334
- }, Do = 1, Bo = "https://www.gstatic.com/draco/v1/decoders/";
1335
- let he = null, fe = null, Ae, ze, jt = 0;
1336
- const Ft = () => {
1337
- const { get: e } = wo(), t = ye(), o = p(), s = Ve(), { selected: n } = I(o), { color: r, url: l } = I(t), { offset: a } = I(s), { getCamera: c } = Le(), { get: u } = De(), { render: g } = St(), b = (S) => {
1338
- const { frameToBounds: w } = xt(), { frameToBounds: F } = wt(), Z = ++jt;
1339
- o.subjectLoaded = !1, f();
1340
- const U = e();
1341
- fe || (fe = new ho(U), fe.setDecoderPath(Bo));
1342
- const Y = new mo(U);
1343
- Y.setDRACOLoader(fe), Y.setWithCredentials(!0), Y.manager.setURLModifier((Q) => Q), Y.load(S, (Q) => {
1344
- const q = Q == null ? void 0 : Q.scene;
1345
- if (Z !== jt) {
1346
- q == null || q.traverse((i) => {
1347
- var V;
1348
- if (!i.isMesh) return;
1349
- (V = i.geometry) == null || V.dispose();
1350
- const x = i.material;
1351
- Array.isArray(x) ? x.forEach((A) => A == null ? void 0 : A.dispose()) : x == null || x.dispose();
1426
+ }, no = 1, ro = "https://www.gstatic.com/draco/v1/decoders/", dt = {
1427
+ roughnessFloor: 0.85,
1428
+ metalness: null,
1429
+ envMapIntensity: null,
1430
+ applyTint: !0,
1431
+ exposure: 0.8,
1432
+ ambientIntensity: 0.2,
1433
+ spotIntensity: 1,
1434
+ envIntensity: 1
1435
+ }, io = {
1436
+ nude: { ...dt },
1437
+ // Smooth ships with no texture maps — pure-white sculpting reference.
1438
+ // All "detail" has to come from form-revealing shading on the
1439
+ // geometry, not from albedo. Same metalness=1 Diffeomorphic bug as
1440
+ // muscle; flipping to 0 restores diffuse. Studio-marble lighting:
1441
+ // strong directional spots, very low ambient and env fill, lower
1442
+ // exposure so lit surfaces don't saturate to white. The contrast
1443
+ // between lit and unlit faces is what makes form readable.
1444
+ smooth: {
1445
+ ...dt,
1446
+ roughnessFloor: 0.3,
1447
+ metalness: 0,
1448
+ envMapIntensity: 0.02,
1449
+ exposure: 0.5,
1450
+ ambientIntensity: 0
1451
+ },
1452
+ muscle: {
1453
+ roughnessFloor: 0.9,
1454
+ metalness: 0,
1455
+ envMapIntensity: 0,
1456
+ applyTint: !1,
1457
+ exposure: 0.2,
1458
+ ambientIntensity: 0.5,
1459
+ spotIntensity: 0.3,
1460
+ envIntensity: 1
1461
+ }
1462
+ };
1463
+ let Se = null, ce = null, Be, Gt = 0, te = dt;
1464
+ const jt = () => {
1465
+ const { get: e } = to(), t = fe(), s = M(), n = Fe(), r = Mt(), { selected: i } = N(s), { url: o } = N(t), { subjectHex: c } = N(r), { offset: a } = N(n), { getCamera: u } = Re(), { get: p } = Ie(), { render: P } = Xe(), w = (v) => {
1466
+ const { setExposure: k } = Xe(), R = he(), F = ++Gt;
1467
+ s.subjectLoaded = !1, m();
1468
+ const $ = e();
1469
+ ce || (ce = new As($), ce.setDecoderPath(ro));
1470
+ const K = new Ms($);
1471
+ K.setDRACOLoader(ce), K.setWithCredentials(!0), K.manager.setURLModifier((b) => b), K.load(v, (b) => {
1472
+ var S;
1473
+ const h = b == null ? void 0 : b.scene;
1474
+ if (F !== Gt) {
1475
+ h == null || h.traverse((l) => {
1476
+ var T;
1477
+ if (!l.isMesh) return;
1478
+ (T = l.geometry) == null || T.dispose();
1479
+ const f = l.material;
1480
+ Array.isArray(f) ? f.forEach((D) => D == null ? void 0 : D.dispose()) : f == null || f.dispose();
1352
1481
  });
1353
1482
  return;
1354
1483
  }
1355
- if (!q)
1484
+ if (!h)
1356
1485
  return;
1357
- he = q;
1358
- const B = u(), T = c(), C = new M.Group();
1359
- C.name = "GLBSubject", C.add(q), q.traverse((i) => {
1360
- i.isMesh && (i.castShadow = !0, i.receiveShadow = !0);
1361
- }), Vt(q, r.value), q.scale.setScalar(Do), q.updateMatrixWorld(!0);
1362
- const G = Mt(q);
1363
- C.position.y -= G.bottom, C.updateMatrixWorld(!0), B.add(C), he = C;
1364
- const d = Mt(C);
1365
- t.setBounds(d), g(B, T), w(d), F(d), o.subjectLoaded = !0;
1486
+ Se = h, te = io[(S = t.model) == null ? void 0 : S.slug] || dt, k(te.exposure), R.seedFromRecipe(s.selected, te);
1487
+ const B = p(), G = u(), z = new I.Group();
1488
+ z.name = "GLBSubject", z.add(h);
1489
+ const U = /brow|lash/i;
1490
+ h.traverse((l) => {
1491
+ if (!l.isMesh) return;
1492
+ l.castShadow = !0, l.receiveShadow = !0;
1493
+ const f = Array.isArray(l.material) ? l.material : [l.material], T = `${l.name} ${f.map((E) => E == null ? void 0 : E.name).join(" ")}`, D = U.test(T);
1494
+ f.forEach((E) => {
1495
+ E && (te.roughnessFloor !== null && typeof E.roughness == "number" && (E.roughness = Math.max(
1496
+ E.roughness,
1497
+ te.roughnessFloor
1498
+ )), te.metalness !== null && typeof E.metalness == "number" && (E.metalness = te.metalness), te.envMapIntensity !== null && typeof E.envMapIntensity == "number" && (E.envMapIntensity = te.envMapIntensity), E.transparent && D && (E.alphaTest = 0.2, E.depthWrite = !0), E.needsUpdate = !0);
1499
+ });
1500
+ }), te.applyTint && oo(h, c.value), h.scale.setScalar(no), h.updateMatrixWorld(!0);
1501
+ const Y = Vt(h);
1502
+ z.position.y -= Y.bottom, z.updateMatrixWorld(!0), B.add(z), Se = z;
1503
+ const X = Vt(z);
1504
+ t.setBounds(X), P(B, G), s.subjectLoaded = !0;
1366
1505
  });
1367
- }, f = () => {
1368
- if (!he) return;
1369
- u().remove(he), he.traverse((w) => {
1370
- var Z;
1371
- if (!w.isMesh) return;
1372
- (Z = w.geometry) == null || Z.dispose();
1373
- const F = w.material;
1374
- Array.isArray(F) ? F.forEach((U) => U == null ? void 0 : U.dispose()) : F == null || F.dispose();
1375
- }), he = null, o.subjectLoaded = !1;
1376
- }, E = (S) => {
1377
- Vt(he, S);
1378
- }, D = () => he, y = () => {
1379
- if (Ae || ze) {
1506
+ }, m = () => {
1507
+ if (!Se) return;
1508
+ p().remove(Se), Se.traverse((k) => {
1509
+ var F;
1510
+ if (!k.isMesh) return;
1511
+ (F = k.geometry) == null || F.dispose();
1512
+ const R = k.material;
1513
+ Array.isArray(R) ? R.forEach(($) => $ == null ? void 0 : $.dispose()) : R == null || R.dispose();
1514
+ }), Se = null, s.subjectLoaded = !1;
1515
+ }, g = () => Se, y = () => {
1516
+ if (Be) {
1380
1517
  console.warn("useGLB.init() called more than once");
1381
1518
  return;
1382
1519
  }
1383
- Ae = O(
1384
- () => n.value,
1385
- (S, w) => {
1386
- !S || S === w || l.value && b(l.value);
1520
+ Be = j(
1521
+ () => i.value,
1522
+ (v, k) => {
1523
+ !v || v === k || o.value && w(o.value);
1387
1524
  },
1388
1525
  { immediate: !0 }
1389
- ), ze = O(
1390
- () => r.value,
1391
- (S) => E(S)
1392
1526
  );
1393
- }, k = () => {
1394
- Ae == null || Ae(), ze == null || ze(), Ae = null, ze = null, f(), fe == null || fe.dispose(), fe = null;
1527
+ }, x = () => {
1528
+ Be == null || Be(), Be = null, m(), ce == null || ce.dispose(), ce = null;
1395
1529
  };
1396
- return Rt(() => {
1397
- k();
1398
- }), { init: y, get: D, dispose: k, updateColor: E };
1399
- }, Mo = (e, t, o = 500) => {
1400
- const s = e.material;
1401
- s.transparent = !0;
1402
- const n = s.opacity, r = performance.now(), l = (a) => {
1403
- const c = a - r, u = Math.min(c / o, 1), g = n + (t - n) * u;
1404
- s.opacity = g, u < 1 && requestAnimationFrame(l);
1530
+ return Ut(() => {
1531
+ x();
1532
+ }), { init: y, get: g, dispose: x };
1533
+ }, ao = (e, t, s = 500) => {
1534
+ const n = e.material;
1535
+ n.transparent = !0;
1536
+ const r = n.opacity, i = performance.now(), o = (c) => {
1537
+ const a = c - i, u = Math.min(a / s, 1), p = r + (t - r) * u;
1538
+ n.opacity = p, u < 1 && requestAnimationFrame(o);
1405
1539
  };
1406
- requestAnimationFrame(l);
1407
- };
1408
- let H = null, Ie = null, $e = null, Ne = null, Ze = null;
1409
- const Pt = () => {
1410
- const e = Me(), t = Ve(), o = ye(), { show: s, lineColor: n, centerLineColor: r, divisions: l, size: a, opacity: c } = I(e), { offset: u } = I(t), { bounds: g } = I(o), { get: b } = De(), f = () => {
1411
- const B = Z(n.value), T = Z(r.value), { positions: C, colors: G } = E({
1412
- size: a.value,
1413
- divisions: l.value,
1414
- color: B,
1415
- centerColor: T
1416
- }), d = D(C, G), i = y(c.value);
1417
- return new M.LineSegments(d, i);
1418
- }, E = ({ size: B, divisions: T, color: C, centerColor: G }) => {
1419
- const d = B / 2, i = B / T, x = [], V = [], A = Math.floor(T / 2), j = (L, P, W, _) => {
1420
- x.push(L, P, W);
1421
- const K = _ ? G : C;
1422
- V.push(K.r, K.g, K.b);
1540
+ requestAnimationFrame(o);
1541
+ }, lo = 34815;
1542
+ let _ = null, He = null, Je = null, Ke = null;
1543
+ const Ot = () => {
1544
+ const e = ke(), t = Fe(), s = fe(), { show: n, divisions: r, size: i, opacity: o } = N(e), { offset: c } = N(t), { bounds: a } = N(s), { get: u } = Ie(), p = () => {
1545
+ const b = k(lo), h = b, { positions: B, colors: G } = P({
1546
+ size: i.value,
1547
+ divisions: r.value,
1548
+ color: b,
1549
+ centerColor: h
1550
+ }), z = w(B, G), U = m(o.value);
1551
+ return new I.LineSegments(z, U);
1552
+ }, P = ({ size: b, divisions: h, color: B, centerColor: G }) => {
1553
+ const z = b / 2, U = b / h, Y = [], X = [], S = Math.floor(h / 2), l = (f, T, D, E) => {
1554
+ Y.push(f, T, D);
1555
+ const O = E ? G : B;
1556
+ X.push(O.r, O.g, O.b);
1423
1557
  };
1424
- for (let L = 0; L <= T; L++) {
1425
- const P = -d + L * i, W = L === A;
1426
- for (let _ = 0; _ <= T; _++) {
1427
- const K = -d + _ * i, m = W || _ === A;
1428
- j(-d, P, K, m), j(+d, P, K, m);
1558
+ for (let f = 0; f <= h; f++) {
1559
+ const T = -z + f * U, D = f === S;
1560
+ for (let E = 0; E <= h; E++) {
1561
+ const O = -z + E * U, J = D || E === S;
1562
+ l(-z, T, O, J), l(+z, T, O, J);
1429
1563
  }
1430
1564
  }
1431
- for (let L = 0; L <= T; L++) {
1432
- const P = -d + L * i, W = L === A;
1433
- for (let _ = 0; _ <= T; _++) {
1434
- const K = -d + _ * i, m = W || _ === A;
1435
- j(P, -d, K, m), j(P, +d, K, m);
1565
+ for (let f = 0; f <= h; f++) {
1566
+ const T = -z + f * U, D = f === S;
1567
+ for (let E = 0; E <= h; E++) {
1568
+ const O = -z + E * U, J = D || E === S;
1569
+ l(T, -z, O, J), l(T, +z, O, J);
1436
1570
  }
1437
1571
  }
1438
- for (let L = 0; L <= T; L++) {
1439
- const P = -d + L * i, W = L === A;
1440
- for (let _ = 0; _ <= T; _++) {
1441
- const K = -d + _ * i, m = W || _ === A;
1442
- j(P, K, -d, m), j(P, K, +d, m);
1572
+ for (let f = 0; f <= h; f++) {
1573
+ const T = -z + f * U, D = f === S;
1574
+ for (let E = 0; E <= h; E++) {
1575
+ const O = -z + E * U, J = D || E === S;
1576
+ l(T, O, -z, J), l(T, O, +z, J);
1443
1577
  }
1444
1578
  }
1445
- return { positions: x, colors: V };
1446
- }, D = (B, T) => {
1447
- const C = new M.BufferGeometry();
1448
- return C.setAttribute(
1579
+ return { positions: Y, colors: X };
1580
+ }, w = (b, h) => {
1581
+ const B = new I.BufferGeometry();
1582
+ return B.setAttribute(
1449
1583
  "position",
1450
- new M.Float32BufferAttribute(B, 3)
1451
- ), C.setAttribute("color", new M.Float32BufferAttribute(T, 3)), C;
1452
- }, y = (B) => new M.LineBasicMaterial({
1584
+ new I.Float32BufferAttribute(b, 3)
1585
+ ), B.setAttribute("color", new I.Float32BufferAttribute(h, 3)), B;
1586
+ }, m = (b) => new I.LineBasicMaterial({
1453
1587
  transparent: !0,
1454
- opacity: B,
1588
+ opacity: b,
1455
1589
  depthWrite: !1,
1456
- blending: M.NormalBlending,
1457
- vertexColors: !1
1458
- }), k = () => {
1459
- H && F(s.value);
1460
- }, S = () => {
1461
- const B = b();
1462
- H = f(n.value), Q(), B.add(H), w(0);
1463
- }, w = (B) => {
1464
- H && (H.material.transparent = !0, B = s.value ? B : 0, H.material.opacity = B);
1465
- }, F = (B) => {
1466
- const T = B ? c.value : 0;
1467
- Mo(H, T, 500);
1468
- }, Z = (B) => ({
1469
- r: (B >> 16 & 255) / 255,
1470
- g: (B >> 8 & 255) / 255,
1471
- b: (B & 255) / 255
1472
- }), U = (B, T) => {
1473
- if (!H) return;
1474
- const C = Z(B), G = Z(T), d = H.geometry.attributes.color, i = H.geometry.attributes.position, x = i.count, V = a.value / 2, A = a.value / l.value, j = Math.floor(l.value / 2);
1475
- for (let L = 0; L < x; L++) {
1476
- const P = i.getX(L), W = i.getY(L), _ = i.getZ(L), K = Math.round((P + V) / A), re = Math.round((W + V) / A), m = Math.round((_ + V) / A), le = K === j || re === j || m === j ? C : G;
1477
- d.setXYZ(L, le.r, le.g, le.b);
1590
+ blending: I.NormalBlending,
1591
+ vertexColors: !0
1592
+ }), g = () => {
1593
+ _ && v(n.value);
1594
+ }, y = () => {
1595
+ const b = u();
1596
+ _ = p(), $(), b.add(_), x(0);
1597
+ }, x = (b) => {
1598
+ _ && (_.material.transparent = !0, b = n.value ? b : 0, _.material.opacity = b);
1599
+ }, v = (b) => {
1600
+ const h = b ? o.value : 0;
1601
+ ao(_, h, 500);
1602
+ }, k = (b) => ({
1603
+ r: (b >> 16 & 255) / 255,
1604
+ g: (b >> 8 & 255) / 255,
1605
+ b: (b & 255) / 255
1606
+ }), R = (b, h) => {
1607
+ if (!_) return;
1608
+ const B = k(b), G = k(h), z = _.geometry.attributes.color, U = _.geometry.attributes.position, Y = U.count, X = i.value / 2, S = i.value / r.value, l = Math.floor(r.value / 2);
1609
+ for (let f = 0; f < Y; f++) {
1610
+ const T = U.getX(f), D = U.getY(f), E = U.getZ(f), O = Math.round((T + X) / S), ge = Math.round((D + X) / S), J = Math.round((E + X) / S), _e = O === l || ge === l || J === l ? B : G;
1611
+ z.setXYZ(f, _e.r, _e.g, _e.b);
1478
1612
  }
1479
- d.needsUpdate = !0;
1480
- }, Y = () => {
1481
- const B = b();
1482
- H && (B.remove(H), H.geometry.dispose(), H.material.dispose(), H = null), H = f(n.value), Q(), B.add(H);
1483
- }, Q = () => {
1484
- var T;
1485
- const B = ((T = g.value) == null ? void 0 : T.bottom) || 0;
1486
- H.position.set(0, B + a.value / 2 + 7e-3, 0);
1613
+ z.needsUpdate = !0;
1614
+ }, F = () => {
1615
+ const b = u();
1616
+ _ && (b.remove(_), _.geometry.dispose(), _.material.dispose(), _ = null), _ = p(), $(), b.add(_);
1617
+ }, $ = () => {
1618
+ var h;
1619
+ const b = ((h = a.value) == null ? void 0 : h.bottom) || 0;
1620
+ _.position.set(0, b + i.value / 2 + 7e-3, 0);
1487
1621
  };
1488
- return Ie = O(
1489
- () => [a.value, l.value],
1490
- ([B, T], [C, G]) => {
1491
- B === C && T === G || (Y(), k());
1622
+ return He = j(
1623
+ () => [i.value, r.value],
1624
+ ([b, h], [B, G]) => {
1625
+ b === B && h === G || (F(), g());
1492
1626
  },
1493
1627
  { flush: "post" }
1494
- ), $e = O(
1495
- () => s.value,
1628
+ ), Je = j(
1629
+ () => n.value,
1496
1630
  () => {
1497
- k();
1631
+ g();
1498
1632
  },
1499
1633
  { flush: "post" }
1500
- ), Ne = O(
1501
- () => c.value,
1502
- (B) => {
1503
- w(B);
1634
+ ), Ke = j(
1635
+ () => o.value,
1636
+ (b) => {
1637
+ x(b);
1504
1638
  },
1505
1639
  { flush: "post" }
1506
- ), Ze = O(
1507
- () => [n.value, r.value],
1508
- ([B, T]) => {
1509
- U(T, B);
1510
- }
1511
1640
  ), {
1512
- init: S,
1513
- showHideGrid: F,
1514
- updateGridColors: U,
1641
+ init: y,
1642
+ showHideGrid: v,
1643
+ updateGridColors: R,
1515
1644
  dispose: () => {
1516
- var T, C;
1517
- const B = b();
1518
- Ie == null || Ie(), $e == null || $e(), Ne == null || Ne(), Ze == null || Ze(), Ie = null, $e = null, Ne = null, Ze = null, H && (B.remove(H), (T = H.geometry) == null || T.dispose(), Array.isArray(H.material) ? H.material.forEach((G) => G == null ? void 0 : G.dispose()) : (C = H.material) == null || C.dispose(), H = null);
1645
+ var h, B;
1646
+ const b = u();
1647
+ He == null || He(), Je == null || Je(), Ke == null || Ke(), He = null, Je = null, Ke = null, _ && (b.remove(_), (h = _.geometry) == null || h.dispose(), Array.isArray(_.material) ? _.material.forEach((G) => G == null ? void 0 : G.dispose()) : (B = _.material) == null || B.dispose(), _ = null);
1519
1648
  }
1520
1649
  };
1521
- }, ko = { class: "three-dimension-tool" }, Eo = ["data-id"], Ao = /* @__PURE__ */ Object.assign({
1650
+ }, co = { class: "three-dimension-tool" }, uo = ["data-id"], po = /* @__PURE__ */ Object.assign({
1522
1651
  name: "ThreeDimensionTool",
1523
1652
  slug: "three-dimension-tool",
1524
1653
  inheritAttrs: !1
@@ -1529,200 +1658,207 @@ const Pt = () => {
1529
1658
  },
1530
1659
  setup(e) {
1531
1660
  const t = e;
1532
- let o = null;
1533
- const s = v(() => Number(t.id)), n = p(), r = Be(), l = ye(), { move: a } = I(r), c = ee(null), u = ee(!1);
1534
- let g, b, f;
1535
- const E = st(), D = xt(), y = wt(), { init: k } = De(), { init: S } = St(), { init: w } = Le(), { init: F, updateVisibility: Z } = Lt(), { init: U, updatePosition: Y } = nt(), { init: Q } = Ft(), { init: q } = Pt(), B = () => {
1536
- if (!c.value || u.value) {
1661
+ let s = null;
1662
+ const n = C(() => Number(t.id)), r = M(), i = pt(), o = he(), c = fe(), { move: a } = N(o), { isFrozen: u } = N(r), p = pe(null), P = pe(!1);
1663
+ let w, m, g;
1664
+ const y = ct(), x = At(), v = Bt(), { init: k, setEnvironment: R } = Ie(), { init: F } = Xe(), { init: $ } = Re(), { init: K, updateVisibility: b } = _t(), { init: h, updatePosition: B } = ut(), { init: G } = jt(), { init: z } = Ot(), U = () => {
1665
+ if (!p.value || P.value) {
1537
1666
  console.warn("Canvas element not found");
1538
1667
  return;
1539
1668
  }
1540
- u.value = !0, f = k(), b = S(c.value), Q(), g = w(), U(), q(), F(), E.init(b), T();
1541
- }, T = () => {
1542
- u.value && (a.value !== o && (o = a.value, a.value ? y.activate() : D.activate()), E.update(), a.value ? (Y(), y.syncToStore()) : D.syncToStore(), Z(), b.render(f, g), requestAnimationFrame(T));
1543
- }, C = () => {
1544
- if (c.value) {
1545
- const G = window.innerWidth, d = window.innerHeight;
1546
- n.$patch({ width: G, height: d }), c.value.style.height = d + "px";
1669
+ P.value = !0, g = k(), m = F(p.value), R(m), G(), w = $(), h(), z(), K(), y.init(m), Y();
1670
+ }, Y = () => {
1671
+ P.value && (a.value !== s && (s = a.value, a.value ? v.activate() : x.activate()), y.update(), a.value ? (B(), v.syncToStore()) : x.syncToStore(), b(), m.render(g, w), requestAnimationFrame(Y));
1672
+ }, X = () => {
1673
+ if (p.value) {
1674
+ const l = window.innerWidth, f = window.innerHeight;
1675
+ r.$patch({ width: l, height: f }), p.value.style.height = f + "px";
1547
1676
  }
1677
+ }, S = () => {
1678
+ u.value && r.pokeFreeze();
1548
1679
  };
1549
- return Xt(() => {
1550
- console.log("onMounted", c.value), B(), window.addEventListener("resize", C), C();
1551
- }), O(
1552
- () => l.bounds,
1553
- (G) => {
1554
- G && (E.frameToBounds(G), y.activate(), y.frameToBounds(G), y.syncToStore(), D.activate(), D.frameToBounds(G), D.syncToStore());
1680
+ return j(u, (l) => {
1681
+ var T;
1682
+ const f = (T = y.get) == null ? void 0 : T.call(y);
1683
+ f && (f.enabled = !l);
1684
+ }), j(
1685
+ () => [i.applyRevision, o.applyRevision],
1686
+ () => {
1687
+ P.value && (v.activate(), B(), x.activate());
1688
+ }
1689
+ ), $t(() => {
1690
+ var l;
1691
+ console.log("onMounted", p.value), U(), window.addEventListener("resize", X), X(), (l = p.value) == null || l.addEventListener("pointerdown", S, !0);
1692
+ }), j(
1693
+ () => c.bounds,
1694
+ (l) => {
1695
+ l && (v.activate(), o.hasRig || (v.frameToBounds(l), v.syncToStore(), o.markFramed()), x.activate(), i.hasRig || (x.frameToBounds(l), x.syncToStore(), i.markFramed()));
1555
1696
  }
1556
- ), O(
1557
- () => n.subjectLoaded,
1558
- (G) => {
1559
- if (!G) return;
1560
- const d = l.bounds;
1561
- if (!d) return;
1562
- E.frameToBounds(d);
1563
- const i = E.get();
1564
- i.update(), i.saveState();
1697
+ ), j(
1698
+ () => r.subjectLoaded,
1699
+ (l) => {
1700
+ if (!l) return;
1701
+ const f = c.bounds;
1702
+ if (!f) return;
1703
+ i.hasRig || (y.frameToBounds(f), i.markFramed());
1704
+ const T = y.get();
1705
+ T.update(), T.saveState();
1565
1706
  }
1566
- ), Rt(() => {
1567
- console.debug("ThreeDimensionTool unMounted"), window.removeEventListener("resize", this), u.value = !1, Ft().dispose(), Pt().dispose(), Lt().dispose(), nt().dispose(), st().dispose(), Le().dispose(), De().dispose(), St().dispose();
1568
- }), (G, d) => (Je(), Yt("div", ko, [
1569
- ht("", !0),
1570
- Qt("div", {
1707
+ ), Ut(() => {
1708
+ var l;
1709
+ console.debug("ThreeDimensionTool unMounted"), window.removeEventListener("resize", this), (l = p.value) == null || l.removeEventListener("pointerdown", S, !0), P.value = !1, jt().dispose(), Ot().dispose(), _t().dispose(), ut().dispose(), ct().dispose(), Re().dispose(), Ie().dispose(), Xe().dispose();
1710
+ }), (l, f) => (at(), cs("div", co, [
1711
+ wt("", !0),
1712
+ us("div", {
1571
1713
  class: "tres",
1572
1714
  ref_key: "tres",
1573
- ref: c,
1574
- "data-id": s.value
1575
- }, null, 8, Eo)
1715
+ ref: p,
1716
+ "data-id": n.value
1717
+ }, null, 8, uo)
1576
1718
  ]));
1577
1719
  }
1578
- }), Gt = /* @__PURE__ */ Object.assign({ "../i18n/en-US/index.js": () => import("./index-CIql5zKW.js") }), J = (e = "../i18n") => {
1579
- const t = no(), o = ee({}), s = v(() => t.lang.isoName || "en-US"), n = async () => {
1580
- const r = `${e}/${s.value}/index.js`;
1581
- if (Gt[r])
1720
+ }), Nt = /* @__PURE__ */ Object.assign({ "../i18n/en-US/index.js": () => import("./index-CwHAnjEe.js") }), H = (e = "../i18n") => {
1721
+ const t = bs(), s = pe({}), n = C(() => t.lang.isoName || "en-US"), r = async () => {
1722
+ const i = `${e}/${n.value}/index.js`;
1723
+ if (Nt[i])
1582
1724
  try {
1583
- const l = await Gt[r]();
1584
- l.default && Object.assign(o.value, l.default);
1585
- } catch (l) {
1586
- console.error(`Error loading i18n for ${s.value}`, l);
1725
+ const o = await Nt[i]();
1726
+ o.default && Object.assign(s.value, o.default);
1727
+ } catch (o) {
1728
+ console.error(`Error loading i18n for ${n.value}`, o);
1587
1729
  }
1588
1730
  else
1589
- console.error(`Module not found: ${r}`);
1731
+ console.error(`Module not found: ${i}`);
1590
1732
  };
1591
- return O(
1592
- () => s.value,
1733
+ return j(
1734
+ () => n.value,
1593
1735
  () => {
1594
- n();
1736
+ r();
1595
1737
  },
1596
1738
  { immediate: !0 }
1597
- ), Wt(() => {
1598
- n();
1599
- }), { lang: o };
1600
- }, Se = ({ tab: e = oe, store: t, options: o = [] }) => {
1601
- const s = ao(), n = p(s), r = v({
1602
- get: () => n.isExpanded(o),
1603
- set: (c) => {
1604
- c && n.setActive(e);
1739
+ ), ds(() => {
1740
+ r();
1741
+ }), { lang: s };
1742
+ }, Ee = 26, Z = ({ tab: e = oe, store: t, options: s = [] }) => {
1743
+ const n = ws(), r = M(n), i = C({
1744
+ get: () => r.isExpanded(s),
1745
+ set: (a) => {
1746
+ a && r.setActive(e);
1605
1747
  }
1606
- }), l = v(() => t && t.changed);
1607
- return { click: () => n.setActive(e), expanded: r, selected: l };
1608
- }, Dt = $({
1748
+ }), o = C(() => t && t.changed);
1749
+ return { click: () => r.setActive(e), expanded: i, selected: o };
1750
+ }, zt = V({
1609
1751
  name: "ToolResetButton",
1610
1752
  props: {
1611
1753
  label: { type: String, required: !1, default: "Reset" },
1612
1754
  disable: Boolean
1613
1755
  },
1614
1756
  emits: ["click"],
1615
- setup(e, { slots: t, emit: o }) {
1616
- function s() {
1617
- o("click");
1618
- }
1757
+ setup(e, { slots: t, emit: s }) {
1619
1758
  function n() {
1620
- const r = {
1759
+ s("click");
1760
+ }
1761
+ function r() {
1762
+ const i = {
1621
1763
  label: e.label,
1622
1764
  class: "full-width",
1623
1765
  flat: !0,
1624
- onClick: s,
1766
+ onClick: n,
1625
1767
  disable: e.disable
1626
1768
  };
1627
- return h("div", { class: "tool-reset-button q-pa-md" }, h(Ot, r));
1769
+ return d("div", { class: "tool-reset-button q-pa-md" }, d(qt, i));
1628
1770
  }
1629
- return () => n();
1771
+ return () => r();
1772
+ }
1773
+ }), ft = V({
1774
+ name: "FrozenOverlay",
1775
+ setup() {
1776
+ const e = M(), { isFrozen: t } = N(e);
1777
+ function s() {
1778
+ return ps(d("div", {
1779
+ class: "frozen-overlay",
1780
+ onClick: () => e.pokeFreeze()
1781
+ }, []), [[ms, t.value]]);
1782
+ }
1783
+ return () => s();
1630
1784
  }
1631
- }), It = $({
1785
+ }), es = V({
1632
1786
  name: "TdColorsSection",
1633
- setup(e, { slots: t, emit: o }) {
1634
- const { lang: s } = J(), n = p(), r = lt(), l = ye(), a = Ve(), { active: c } = I(n), u = ee(!1), g = ee(!1), b = ee(!1), f = v(
1635
- () => {
1636
- var C;
1637
- return (C = s.value.td) == null ? void 0 : C.components.colors.items.background;
1638
- }
1639
- ), E = v(
1787
+ setup(e, { slots: t, emit: s }) {
1788
+ const { lang: n } = H(), r = M(), i = mt(), o = Fe(), { active: c } = N(r), a = pe(!1), u = pe(!1), p = C(
1640
1789
  () => {
1641
- var C;
1642
- return (C = s.value.td) == null ? void 0 : C.components.colors.items.subject;
1790
+ var b;
1791
+ return (b = n.value.td) == null ? void 0 : b.components.colors.items.background;
1643
1792
  }
1644
- ), D = v(
1793
+ ), P = C(
1645
1794
  () => {
1646
- var C;
1647
- return (C = s.value.td) == null ? void 0 : C.components.colors.items.ground;
1795
+ var b;
1796
+ return (b = n.value.td) == null ? void 0 : b.components.colors.items.ground;
1648
1797
  }
1649
- ), y = v(() => ({
1650
- key: E.value,
1651
- label: E.value,
1652
- type: "none",
1653
- icon: "f_subject",
1654
- size: "sm",
1655
- color: l.colorHex,
1656
- onClick: () => g.value = !0
1657
- })), k = v(() => ({
1658
- key: f.value,
1659
- label: f.value,
1798
+ ), w = C(() => ({
1799
+ key: p.value,
1800
+ label: p.value,
1660
1801
  type: "none",
1661
1802
  icon: "f_scene",
1662
1803
  size: "sm",
1663
- color: r.colorHex,
1664
- onClick: () => u.value = !0
1665
- })), S = v(() => ({
1666
- key: D.value,
1667
- label: D.value,
1804
+ color: i.colorHex,
1805
+ onClick: () => a.value = !0
1806
+ })), m = C(() => ({
1807
+ key: P.value,
1808
+ label: P.value,
1668
1809
  type: "none",
1669
1810
  icon: "f_ground",
1670
1811
  size: "sm",
1671
- color: a.colorHex,
1672
- onClick: () => b.value = !0
1673
- })), w = v({
1674
- get: () => b.value || u.value || g.value,
1675
- set: (C) => b.value = u.value = g.value = !1
1676
- }), F = v({
1677
- get: () => b.value ? a.colorHex : u.value ? r.colorHex : l.colorHex,
1678
- set: (C) => {
1679
- if (console.log("showGround", b.value), b.value) {
1680
- console.log("val", C), a.setColorHex(C);
1681
- return;
1682
- }
1812
+ color: o.colorHex,
1813
+ onClick: () => u.value = !0
1814
+ })), g = C({
1815
+ get: () => u.value || a.value,
1816
+ set: (b) => u.value = a.value = !1
1817
+ }), y = C({
1818
+ get: () => u.value ? o.colorHex : i.colorHex,
1819
+ set: (b) => {
1683
1820
  if (u.value) {
1684
- r.setColorHex(C);
1821
+ o.setColorHex(b);
1685
1822
  return;
1686
1823
  }
1687
- l.setColorHex(C);
1824
+ i.setColorHex(b);
1688
1825
  }
1689
- }), Z = v(() => ({
1826
+ }), x = C(() => ({
1690
1827
  class: "td-colors-tool q-pa-xs row justify-center items-center q-gutter-md",
1691
- style: w.value ? "display: none" : ""
1692
- })), U = v(() => ({
1693
- modelValue: F.value,
1694
- "onUpdate:modelValue": (C) => F.value = C,
1695
- show: w.value,
1696
- "onUpdate:show": (C) => w.value = C,
1697
- label: Y.value
1698
- })), Y = v(() => b.value ? D.value : u.value ? f.value : E.value), Q = () => {
1699
- r.reset(), l.resetColor(), a.reset();
1700
- }, q = v(() => l.changed || a.changed || r.changed), B = v(() => ({
1828
+ style: g.value ? "display: none" : ""
1829
+ })), v = C(() => ({
1830
+ modelValue: y.value,
1831
+ "onUpdate:modelValue": (b) => y.value = b,
1832
+ show: g.value,
1833
+ "onUpdate:show": (b) => g.value = b,
1834
+ label: k.value
1835
+ })), k = C(() => u.value ? P.value : p.value), R = () => {
1836
+ i.reset(), o.reset();
1837
+ }, F = C(() => o.changed || i.changed), $ = C(() => ({
1701
1838
  label: "Reset Colors",
1702
- onClick: Q,
1703
- style: w.value ? "display: none" : "",
1704
- disable: !q.value
1839
+ onClick: R,
1840
+ style: g.value ? "display: none" : "",
1841
+ disable: !F.value
1705
1842
  }));
1706
- O(c, (C) => {
1707
- C !== oe && (w.value = !1);
1843
+ j(c, (b) => {
1844
+ b !== oe && (g.value = !1);
1708
1845
  });
1709
- function T() {
1710
- return h("div", {
1846
+ function K() {
1847
+ return d("div", {
1711
1848
  class: "full-width"
1712
- // style: pickerShow.value ? 'display: none' : '',
1713
1849
  }, [
1714
- h("div", Z.value, [
1715
- h(ne, y.value),
1716
- h(ne, k.value),
1717
- h(ne, S.value)
1850
+ d(ft),
1851
+ d("div", x.value, [
1852
+ d(me, w.value),
1853
+ d(me, m.value)
1718
1854
  ]),
1719
- h(Dt, B.value),
1720
- h(qt, U.value)
1855
+ d(zt, $.value),
1856
+ d(ys, v.value)
1721
1857
  ]);
1722
1858
  }
1723
- return () => T();
1859
+ return () => K();
1724
1860
  }
1725
- }), zo = $({
1861
+ }), mo = V({
1726
1862
  name: "TdColorsExpansion",
1727
1863
  props: {
1728
1864
  modelValue: { type: Number, default: 0 },
@@ -1730,101 +1866,103 @@ const Pt = () => {
1730
1866
  label: { type: String, required: !1 }
1731
1867
  },
1732
1868
  emits: ["click", "update:modelValue"],
1733
- setup(e, { slots: t, emit: o }) {
1734
- const { lang: s } = J(), n = Ut(), { expanded: r, selected: l } = Se({
1735
- store: n,
1869
+ setup(e, { slots: t, emit: s }) {
1870
+ const { lang: n } = H(), r = Mt(), { expanded: i, selected: o } = Z({
1871
+ store: r,
1736
1872
  options: oe,
1737
1873
  tab: oe
1738
- }), a = v(() => {
1874
+ }), c = C(() => {
1739
1875
  var u;
1740
- return (u = s.value.td) == null ? void 0 : u.components.colors.title;
1876
+ return (u = n.value.td) == null ? void 0 : u.components.colors.title;
1741
1877
  });
1742
- v({
1878
+ C({
1743
1879
  get: () => e.modelValue,
1744
- set: (u) => o("update:modelValue", u)
1880
+ set: (u) => s("update:modelValue", u)
1745
1881
  });
1746
- function c() {
1882
+ function a() {
1747
1883
  const u = {
1748
1884
  class: "td-colors-expansion",
1749
1885
  "data-cy": "td-colors-expansion",
1750
- modelValue: r.value,
1751
- "onUpdate:modelValue": (g) => r.value = g,
1752
- label: a.value,
1753
- selected: l.value,
1886
+ modelValue: i.value,
1887
+ "onUpdate:modelValue": (p) => i.value = p,
1888
+ label: c.value,
1889
+ selected: o.value,
1754
1890
  icon: "f_palette"
1755
1891
  };
1756
- return h(rt, u, () => h(It));
1892
+ return d(Ve, u, () => d(es));
1757
1893
  }
1758
- return () => c();
1894
+ return () => a();
1759
1895
  }
1760
- }), $t = $({
1896
+ }), ts = V({
1761
1897
  name: "TdGridSection",
1762
- setup(e, { slots: t, emit: o }) {
1763
- const { lang: s } = J(), n = Me(), r = v(
1898
+ setup(e, { slots: t, emit: s }) {
1899
+ const { lang: n } = H(), r = ke(), i = C(
1764
1900
  () => {
1765
- var f, E;
1766
- return l.value ? ((f = s.value.td) == null ? void 0 : f.components.grid.toggle.off) || "" : ((E = s.value.td) == null ? void 0 : E.components.grid.toggle.on) || "";
1901
+ var w, m;
1902
+ return o.value ? ((w = n.value.td) == null ? void 0 : w.components.grid.toggle.off) || "" : ((m = n.value.td) == null ? void 0 : m.components.grid.toggle.on) || "";
1767
1903
  }
1768
- ), l = v({
1769
- get: () => n.show,
1770
- set: (f) => n.setProperty("show", f)
1771
- }), a = v({
1772
- get: () => n.opacity,
1773
- set: (f) => n.setProperty("opacity", f)
1774
- }), c = v({
1775
- get: () => n.size,
1776
- set: (f) => n.setProperty("size", f)
1777
- }), u = v({
1778
- get: () => n.divisions,
1779
- set: (f) => n.setProperty("divisions", f)
1780
- }), g = v(() => ({
1904
+ ), o = C({
1905
+ get: () => r.show,
1906
+ set: (w) => r.setProperty("show", w)
1907
+ }), c = C({
1908
+ get: () => r.opacity,
1909
+ set: (w) => r.setProperty("opacity", w)
1910
+ }), a = C({
1911
+ get: () => r.size,
1912
+ set: (w) => r.setProperty("size", w)
1913
+ }), u = C({
1914
+ get: () => r.divisions,
1915
+ set: (w) => r.setProperty("divisions", w)
1916
+ }), p = C(() => ({
1781
1917
  label: "Reset Grid",
1782
- disable: !n.changed,
1783
- onClick: n.reset
1918
+ disable: !r.changed,
1919
+ onClick: r.reset
1784
1920
  }));
1785
- function b() {
1786
- const f = {
1921
+ function P() {
1922
+ const w = {
1787
1923
  class: "td-grid-tool"
1788
- }, E = {
1924
+ }, m = {
1789
1925
  access: "grd",
1790
1926
  // drawer: !props.noIcons,
1791
- modelValue: l.value,
1792
- "onUpdate:modelValue": (w) => l.value = w,
1793
- label: r.value
1927
+ modelValue: o.value,
1928
+ "onUpdate:modelValue": (k) => o.value = k,
1929
+ label: i.value
1794
1930
  // dark: props.dark,
1795
1931
  // disable: props.disable,
1796
1932
  // hasAccess: props.hasAccess,
1797
1933
  // onBlockAccess: emitBlockAccess,
1798
- }, D = {
1934
+ }, g = {
1799
1935
  title: "Opacity",
1800
1936
  icon: "f_opacity",
1801
1937
  min: 1,
1802
1938
  max: 100,
1803
1939
  initial: 50,
1804
- modelValue: a.value * 100,
1805
- "onUpdate:modelValue": (w) => a.value = w / 100
1940
+ modelValue: c.value * 100,
1941
+ "onUpdate:modelValue": (k) => c.value = k / 100
1806
1942
  }, y = {
1807
1943
  title: "Size",
1808
1944
  icon: "f_size",
1809
1945
  min: 100,
1810
1946
  max: 300,
1811
1947
  initial: 200,
1812
- modelValue: c.value * 100,
1813
- "onUpdate:modelValue": (w) => c.value = w / 100
1814
- }, k = {
1948
+ modelValue: a.value * 100,
1949
+ "onUpdate:modelValue": (k) => a.value = k / 100
1950
+ }, x = {
1815
1951
  title: "Number of lines",
1816
1952
  icon: "f_grid",
1817
1953
  min: 2,
1818
1954
  max: 10,
1955
+ // Even-only so a grid line always passes through the model's center
1956
+ step: 2,
1819
1957
  initial: 6,
1820
1958
  modelValue: u.value,
1821
- "onUpdate:modelValue": (w) => u.value = w
1822
- }, S = [h(Ke, E)];
1823
- return l.value && (S.push(h(dt, y)), S.push(h(dt, k)), S.push(h(dt, D)), S.push(h(Dt, g.value))), h("div", f, S);
1959
+ "onUpdate:modelValue": (k) => u.value = k
1960
+ }, v = [d(ft), d(Ht, m)];
1961
+ return o.value && (v.push(d(We, y)), v.push(d(We, x)), v.push(d(We, g)), v.push(d(zt, p.value))), d("div", w, v);
1824
1962
  }
1825
- return () => b();
1963
+ return () => P();
1826
1964
  }
1827
- }), To = $({
1965
+ }), fo = V({
1828
1966
  name: "TdGridExpansion",
1829
1967
  props: {
1830
1968
  modelValue: { type: Number, default: 0 },
@@ -1832,34 +1970,34 @@ const Pt = () => {
1832
1970
  label: { type: String, required: !1 }
1833
1971
  },
1834
1972
  emits: ["click", "update:modelValue"],
1835
- setup(e, { slots: t, emit: o }) {
1836
- const { lang: s } = J(), n = Me(), { expanded: r, selected: l } = Se({
1837
- store: n,
1838
- options: xe,
1839
- tab: xe
1840
- }), a = v(() => {
1973
+ setup(e, { slots: t, emit: s }) {
1974
+ const { lang: n } = H(), r = ke(), { expanded: i, selected: o } = Z({
1975
+ store: r,
1976
+ options: we,
1977
+ tab: we
1978
+ }), c = C(() => {
1841
1979
  var u;
1842
- return (u = s.value.td) == null ? void 0 : u.components.grid.title;
1980
+ return (u = n.value.td) == null ? void 0 : u.components.grid.title;
1843
1981
  });
1844
- v({
1982
+ C({
1845
1983
  get: () => e.modelValue,
1846
- set: (u) => o("update:modelValue", u)
1984
+ set: (u) => s("update:modelValue", u)
1847
1985
  });
1848
- function c() {
1986
+ function a() {
1849
1987
  const u = {
1850
1988
  class: "td-colors-expansion",
1851
1989
  "data-cy": "td-colors-expansion",
1852
- modelValue: r.value,
1853
- "onUpdate:modelValue": (g) => r.value = g,
1854
- label: a.value,
1855
- selected: l.value,
1990
+ modelValue: i.value,
1991
+ "onUpdate:modelValue": (p) => i.value = p,
1992
+ label: c.value,
1993
+ selected: o.value,
1856
1994
  icon: "f_grid"
1857
1995
  };
1858
- return h(rt, u, () => h($t));
1996
+ return d(Ve, u, () => d(ts));
1859
1997
  }
1860
- return () => c();
1998
+ return () => a();
1861
1999
  }
1862
- }), Nt = $({
2000
+ }), ss = V({
1863
2001
  name: "TdLightsSection",
1864
2002
  props: {
1865
2003
  modelValue: { type: Number, default: 0 },
@@ -1867,172 +2005,91 @@ const Pt = () => {
1867
2005
  label: { type: String, required: !1 }
1868
2006
  },
1869
2007
  emits: ["click", "update:modelValue"],
1870
- setup(e, { slots: t, emit: o }) {
1871
- const { lang: s } = J(), n = Be(), r = p(), l = nt(), { active: a } = I(r), c = v({
1872
- get: () => n.advancedMode,
1873
- set: (m) => n.setAdvanced(m)
1874
- }), u = v({
1875
- get: () => n.move,
1876
- set: (m) => n.setMove(m)
1877
- }), g = v(
1878
- () => {
1879
- var m, N;
1880
- return n.advancedMode ? ((m = s.value.td) == null ? void 0 : m.components.lights.toggles.advanced.off) || "" : ((N = s.value.td) == null ? void 0 : N.components.lights.toggles.advanced.on) || "";
1881
- }
1882
- ), b = v(() => ({
1883
- modelValue: c.value,
1884
- "onUpdate:modelValue": (m) => c.value = m,
1885
- label: g.value
1886
- })), f = v(
1887
- () => {
1888
- var m, N;
1889
- return n.move ? ((m = s.value.td) == null ? void 0 : m.components.lights.toggles.position.off) || "" : ((N = s.value.td) == null ? void 0 : N.components.lights.toggles.position.on) || "";
1890
- }
1891
- ), E = v(() => ({
1892
- modelValue: u.value,
1893
- "onUpdate:modelValue": (m) => u.value = m,
1894
- label: f.value
1895
- })), D = v(
1896
- () => {
1897
- var m;
1898
- return ((m = s.value.td) == null ? void 0 : m.components.lights.color) || "";
1899
- }
1900
- ), y = ee(!1), k = v(() => ({
1901
- key: D.value,
1902
- label: D.value,
1903
- type: "none",
1904
- icon: "f_bulb_light",
1905
- size: "sm",
1906
- color: n.colorHex("key"),
1907
- onClick: () => y.value = !0
1908
- })), S = v(
1909
- () => {
1910
- var m;
1911
- return ((m = s.value.td) == null ? void 0 : m.components.lights.labels.key) || "";
1912
- }
1913
- ), w = ee(!1), F = v({
1914
- get: () => n.colorHex("key"),
1915
- set: (m) => n.setColorHex("key", m)
1916
- }), Z = v(() => ({
1917
- key: S.value,
1918
- label: S.value,
1919
- type: "none",
1920
- icon: "f_bulb_key",
1921
- size: "sm",
1922
- color: F.value,
1923
- onClick: () => w.value = !0
1924
- })), U = v(
2008
+ setup() {
2009
+ const { lang: e } = H(), t = he(), s = M(), n = fe(), r = ut(), i = Bt(), o = At(), { active: c } = N(s), a = C({
2010
+ get: () => t.move,
2011
+ set: (h) => t.setMove(h)
2012
+ }), u = C(
1925
2013
  () => {
1926
- var m;
1927
- return ((m = s.value.td) == null ? void 0 : m.components.lights.labels.back) || "";
2014
+ var h, B;
2015
+ return t.move ? ((h = e.value.td) == null ? void 0 : h.components.lights.toggles.position.off) || "" : ((B = e.value.td) == null ? void 0 : B.components.lights.toggles.position.on) || "";
1928
2016
  }
1929
- ), Y = ee(!1), Q = v({
1930
- get: () => n.colorHex("back"),
1931
- set: (m) => n.setColorHex("back", m)
1932
- }), q = v(() => ({
1933
- key: U.value,
1934
- label: U.value,
1935
- type: "none",
1936
- icon: "f_bulb_back",
1937
- size: "sm",
1938
- color: Q.value,
1939
- onClick: () => Y.value = !0,
1940
- disable: !T.value
1941
- })), B = v(
1942
- () => {
1943
- var m, N;
1944
- return T.value ? ((m = s.value.td) == null ? void 0 : m.components.lights.toggles.back.off) || "" : ((N = s.value.td) == null ? void 0 : N.components.lights.toggles.back.on) || "";
1945
- }
1946
- ), T = v({
1947
- get: () => n.property("back", "visible", !0),
1948
- set: (m) => n.setProperty("back", "visible", m)
1949
- }), C = v(() => ({
1950
- modelValue: T.value,
1951
- "onUpdate:modelValue": (m) => T.value = m,
1952
- label: B.value
1953
- })), G = v(
2017
+ ), p = C(() => ({
2018
+ modelValue: a.value,
2019
+ "onUpdate:modelValue": (h) => a.value = h,
2020
+ label: u.value
2021
+ })), P = C(
1954
2022
  () => {
1955
- var m;
1956
- return ((m = s.value.td) == null ? void 0 : m.components.lights.labels.fill) || "";
2023
+ var h;
2024
+ return ((h = e.value.td) == null ? void 0 : h.components.lights.ambientIntensity) || "";
1957
2025
  }
1958
- ), d = ee(!1), i = v({
1959
- get: () => n.colorHex("fill"),
1960
- set: (m) => n.setColorHex("fill", m)
1961
- }), x = v(() => ({
1962
- key: G.value,
1963
- label: G.value,
1964
- type: "none",
1965
- icon: "f_bulb_fill",
1966
- size: "sm",
1967
- color: i.value,
1968
- onClick: () => d.value = !0,
1969
- disable: !A.value
1970
- })), V = v(
2026
+ ), w = C(
1971
2027
  () => {
1972
- var m, N;
1973
- return A.value ? ((m = s.value.td) == null ? void 0 : m.components.lights.toggles.fill.off) || "" : ((N = s.value.td) == null ? void 0 : N.components.lights.toggles.fill.on) || "";
2028
+ var h;
2029
+ return ((h = e.value.td) == null ? void 0 : h.components.lights.userIntensity) || "";
1974
2030
  }
1975
- ), A = v({
1976
- get: () => n.property("fill", "visible", !0),
1977
- set: (m) => n.setProperty("fill", "visible", m)
1978
- }), j = v(() => ({
1979
- modelValue: A.value,
1980
- "onUpdate:modelValue": (m) => A.value = m,
1981
- label: V.value
1982
- })), L = v({
1983
- get: () => y.value || w.value || d.value || Y.value,
1984
- set: (m) => y.value = w.value = d.value = Y.value = !1
1985
- }), P = v({
1986
- get: () => y.value || w.value ? n.colorHex("key") : d.value ? n.colorHex("fill") : n.colorHex("back"),
1987
- set: (m) => {
1988
- if (y.value || w.value) {
1989
- n.setColorHex("key", m);
1990
- return;
1991
- }
1992
- if (d.value) {
1993
- n.setColorHex("fill", m);
1994
- return;
1995
- }
1996
- n.setColorHex("back", m);
2031
+ ), m = 0, g = 50, y = 100, x = (h, B, G) => ({
2032
+ toSlider: (z) => z <= B ? m + (z - h) / (B - h) * (g - m) : g + (z - B) / (G - B) * (y - g),
2033
+ fromSlider: (z) => z <= g ? h + (z - m) / (g - m) * (B - h) : B + (z - g) / (y - g) * (G - B)
2034
+ }), v = x(
2035
+ Pe,
2036
+ se,
2037
+ Et
2038
+ ), k = x(
2039
+ Pe,
2040
+ se,
2041
+ It
2042
+ ), R = (h, B, G, z) => ({
2043
+ title: h,
2044
+ icon: "f_brightness",
2045
+ min: m,
2046
+ max: y,
2047
+ modelValue: B.toSlider(G),
2048
+ "onUpdate:modelValue": (U) => {
2049
+ z(B.fromSlider(U));
1997
2050
  }
1998
- }), W = v(() => ({
1999
- modelValue: P.value,
2000
- "onUpdate:modelValue": (m) => P.value = m,
2001
- show: L.value,
2002
- "onUpdate:show": (m) => L.value = m,
2003
- label: _.value
2004
- })), _ = v(() => y.value ? D.value : w.value ? S.value : d.value ? G.value : U.value), K = v(() => ({
2051
+ }), F = C(
2052
+ () => R(
2053
+ P.value,
2054
+ v,
2055
+ t.ambientScale,
2056
+ (h) => t.setAmbientScale(h)
2057
+ )
2058
+ ), $ = C(
2059
+ () => R(
2060
+ w.value,
2061
+ k,
2062
+ t.userScale,
2063
+ (h) => t.setUserScale(h)
2064
+ )
2065
+ ), K = C(() => ({
2005
2066
  label: "Reset Lights",
2006
- disable: !n.changed,
2067
+ disable: !t.changed,
2007
2068
  onClick: () => {
2008
- n.reset(), l.applyFromStore();
2069
+ var B;
2070
+ t.reset();
2071
+ const h = n.bounds;
2072
+ h && (i.activate(), i.frameToBounds(h), i.syncToStore(), o.activate()), (B = r.applyFromStore) == null || B.call(r);
2009
2073
  }
2010
2074
  }));
2011
- O(c, (m) => {
2012
- m || (A.value = !0, T.value = !0);
2013
- }), O(a, (m) => {
2014
- m !== ve && (L.value = !1, u.value = !1);
2075
+ j(c, (h) => {
2076
+ h !== de && (a.value = !1);
2015
2077
  });
2016
- function re() {
2017
- const m = {
2078
+ function b() {
2079
+ const h = {
2018
2080
  class: "td-lights-tool"
2019
- };
2020
- let N = [];
2021
- if (L.value)
2022
- N = [h(qt, W.value)];
2023
- else {
2024
- const le = {
2025
- class: "td-colors-tool q-pa-xs row justify-center items-center q-gutter-md"
2026
- }, ue = [];
2027
- c.value ? (ue.push(h(ne, Z.value)), ue.push(h(ne, x.value)), ue.push(h(ne, q.value))) : ue.push(h(ne, k.value));
2028
- const je = [];
2029
- je.push(h(Ke, E.value)), c.value && (je.push(h(Ke, j.value)), je.push(h(Ke, C.value))), je.push(h(Ke, b.value)), N = [h("div", le, ue), ...je], N.push(h(Dt, K.value));
2030
- }
2031
- return h("div", m, N);
2081
+ }, B = [
2082
+ d(ft),
2083
+ d(Ht, p.value),
2084
+ d(We, F.value),
2085
+ d(We, $.value),
2086
+ d(zt, K.value)
2087
+ ];
2088
+ return d("div", h, B);
2032
2089
  }
2033
- return () => re();
2090
+ return () => b();
2034
2091
  }
2035
- }), Lo = $({
2092
+ }), ho = V({
2036
2093
  name: "TdLightExpansion",
2037
2094
  props: {
2038
2095
  modelValue: { type: Number, default: 0 },
@@ -2040,70 +2097,207 @@ const Pt = () => {
2040
2097
  label: { type: String, required: !1 }
2041
2098
  },
2042
2099
  emits: ["click", "update:modelValue"],
2043
- setup(e, { slots: t, emit: o }) {
2044
- const { lang: s } = J(), n = Be(), { expanded: r, selected: l } = Se({
2045
- store: n,
2046
- options: ve,
2047
- tab: ve
2048
- }), a = v(() => {
2100
+ setup(e, { slots: t, emit: s }) {
2101
+ const { lang: n } = H(), r = he(), { expanded: i, selected: o } = Z({
2102
+ store: r,
2103
+ options: de,
2104
+ tab: de
2105
+ }), c = C(() => {
2049
2106
  var u;
2050
- return (u = s.value.td) == null ? void 0 : u.components.lights.title;
2107
+ return (u = n.value.td) == null ? void 0 : u.components.lights.title;
2051
2108
  });
2052
- v({
2109
+ C({
2053
2110
  get: () => e.modelValue,
2054
- set: (u) => o("update:modelValue", u)
2111
+ set: (u) => s("update:modelValue", u)
2055
2112
  });
2056
- function c() {
2113
+ function a() {
2057
2114
  const u = {
2058
2115
  class: "td-lights-expansion",
2059
2116
  "data-cy": "td-lights-expansion",
2060
- modelValue: r.value,
2061
- "onUpdate:modelValue": (g) => r.value = g,
2062
- label: a.value,
2063
- selected: l.value,
2117
+ modelValue: i.value,
2118
+ "onUpdate:modelValue": (p) => i.value = p,
2119
+ label: c.value,
2120
+ selected: o.value,
2064
2121
  icon: "f_bulb_light"
2065
2122
  };
2066
- return h(rt, u, () => h(Nt));
2123
+ return d(Ve, u, () => d(ss));
2067
2124
  }
2068
- return () => c();
2125
+ return () => a();
2069
2126
  }
2070
- }), Zt = $({
2127
+ }), os = V({
2071
2128
  name: "TdRelatedSection",
2072
- setup(e, { slots: t, emit: o }) {
2073
- const s = Symbol.for("RelatedThreeDSection"), n = Jt(s), r = p(), l = ye(), { poseId: a } = I(l);
2074
- function c() {
2075
- const u = {
2129
+ setup() {
2130
+ const e = Symbol.for("RelatedSection"), t = Ze(e);
2131
+ function s() {
2132
+ const n = {
2076
2133
  class: "td-related-section q-mx-lg q-my-sm"
2077
- }, g = [];
2078
- return n && a.value && g.push(
2079
- h(n, {
2080
- id: a.value,
2081
- glbId: r.selected
2082
- })
2083
- ), h("div", u, g);
2134
+ }, r = [];
2135
+ return t && r.push(d(t)), d("div", n, r);
2084
2136
  }
2085
- return () => c();
2137
+ return () => s();
2086
2138
  }
2087
- }), Vo = $({
2139
+ }), go = V({
2088
2140
  name: "TdRelatedExpansion",
2089
- setup(e, { slots: t, emit: o }) {
2090
- const { expanded: s } = Se({
2091
- options: we,
2092
- tab: we
2093
- }), n = v(() => "Related");
2094
- function r() {
2095
- const l = {
2141
+ setup(e, { slots: t, emit: s }) {
2142
+ const { expanded: n } = Z({
2143
+ options: Ce,
2144
+ tab: Ce
2145
+ }), r = C(() => "Related");
2146
+ function i() {
2147
+ const o = {
2096
2148
  class: "td-related-expansion",
2097
- modelValue: s.value,
2098
- "onUpdate:modelValue": (a) => s.value = a,
2099
- label: n.value,
2149
+ modelValue: n.value,
2150
+ "onUpdate:modelValue": (c) => n.value = c,
2151
+ label: r.value,
2100
2152
  icon: "f_related"
2101
2153
  };
2102
- return h(rt, l, () => h(Zt));
2154
+ return d(Ve, o, () => d(os));
2103
2155
  }
2104
- return () => r();
2156
+ return () => i();
2105
2157
  }
2106
- }), Kt = $({
2158
+ }), ns = V({
2159
+ name: "TdSavedSection",
2160
+ setup() {
2161
+ const e = Symbol.for("SavedSection"), t = Ze(e);
2162
+ function s() {
2163
+ return t ? d("div", {
2164
+ class: "td-saved-section q-mx-lg q-my-sm"
2165
+ }, [d(t)]) : null;
2166
+ }
2167
+ return () => s();
2168
+ }
2169
+ }), vo = V({
2170
+ name: "TdSavedExpansion",
2171
+ setup() {
2172
+ const { expanded: e } = Z({
2173
+ options: Ee,
2174
+ tab: Ee
2175
+ }), t = C(() => "Saved");
2176
+ function s() {
2177
+ const n = {
2178
+ class: "td-saved-expansion",
2179
+ modelValue: e.value,
2180
+ "onUpdate:modelValue": (r) => e.value = r,
2181
+ label: t.value,
2182
+ icon: "f_save"
2183
+ };
2184
+ return d(Ve, n, () => d(ns));
2185
+ }
2186
+ return () => s();
2187
+ }
2188
+ });
2189
+ function bo() {
2190
+ const { freeServer: e, paidServer: t } = Cs();
2191
+ return Es({ freeServer: e, paidServer: t });
2192
+ }
2193
+ const yo = Symbol.for("activity-tracking"), So = ["nude", "muscle", "smooth"];
2194
+ function xo() {
2195
+ const e = M(), t = fe(), s = Ze(yo, null), { getThumbnail: n } = bo();
2196
+ return { skins: C(() => {
2197
+ const i = e.setUuid, o = e.selected, c = {};
2198
+ return Object.values(t.models).forEach((a) => {
2199
+ !(a != null && a.slug) || c[a.slug] || (c[a.slug] = a);
2200
+ }), So.filter((a) => c[a]).map((a) => {
2201
+ const u = c[a];
2202
+ return {
2203
+ id: u.id,
2204
+ slug: a,
2205
+ name: a,
2206
+ imageUrl: i ? n({ type: "sets", uuid: i, image: a }) : null,
2207
+ selected: u.id === o,
2208
+ click: () => {
2209
+ e.selected = u.id, s == null || s.trackEvent(Ps, { value: a });
2210
+ }
2211
+ };
2212
+ });
2213
+ }) };
2214
+ }
2215
+ const wo = V({
2216
+ name: "TdSkinButton",
2217
+ props: {
2218
+ id: { type: Number, required: !0 },
2219
+ slug: { type: String, required: !0 },
2220
+ label: { type: String, default: "" },
2221
+ image: { type: String, default: null },
2222
+ selected: { type: Boolean, default: !1 },
2223
+ size: { type: String, default: "sm" }
2224
+ },
2225
+ emits: ["click"],
2226
+ setup(e, { emit: t }) {
2227
+ const s = C(() => ({
2228
+ margin: "3px",
2229
+ marginBottom: e.size === "sm" ? "40px" : "30px"
2230
+ }));
2231
+ function n() {
2232
+ const r = {
2233
+ class: `td-${e.slug}-button td-skin-button`,
2234
+ key: e.id,
2235
+ label: e.label,
2236
+ image: e.image,
2237
+ size: e.size,
2238
+ style: s.value,
2239
+ type: "radio",
2240
+ dark: !0,
2241
+ selected: e.selected,
2242
+ onClick: () => t("click")
2243
+ };
2244
+ return d(me, r);
2245
+ }
2246
+ return () => n();
2247
+ }
2248
+ }), rs = V({
2249
+ name: "TdSkinsSection",
2250
+ props: { size: { type: String, default: "sm" } },
2251
+ setup(e) {
2252
+ const { skins: t } = xo(), { lang: s } = H();
2253
+ function n() {
2254
+ const r = [d(ft)];
2255
+ return t.value.forEach((i) => {
2256
+ var o, c;
2257
+ r.push(
2258
+ d(wo, {
2259
+ id: i.id,
2260
+ slug: i.slug,
2261
+ label: ((c = (o = s.value.td) == null ? void 0 : o.components.skins.items) == null ? void 0 : c[i.slug]) ?? i.slug,
2262
+ image: i.imageUrl,
2263
+ selected: i.selected,
2264
+ size: e.size,
2265
+ onClick: i.click
2266
+ })
2267
+ );
2268
+ }), d(Jt, {}, () => r);
2269
+ }
2270
+ return () => n();
2271
+ }
2272
+ }), Co = V({
2273
+ name: "TdSkinsExpansion",
2274
+ setup() {
2275
+ const { lang: e } = H(), t = fe(), { expanded: s } = Z({
2276
+ options: xe,
2277
+ tab: xe
2278
+ }), n = C(() => {
2279
+ var c;
2280
+ const o = (c = t.model) == null ? void 0 : c.slug;
2281
+ return !!o && o !== Wt;
2282
+ }), r = C(() => {
2283
+ var o;
2284
+ return (o = e.value.td) == null ? void 0 : o.components.skins.title;
2285
+ });
2286
+ function i() {
2287
+ const o = {
2288
+ class: "td-skins-expansion",
2289
+ "data-cy": "td-skins-expansion",
2290
+ modelValue: s.value,
2291
+ "onUpdate:modelValue": (c) => s.value = c,
2292
+ label: r.value,
2293
+ selected: n.value,
2294
+ icon: "f_shirt"
2295
+ };
2296
+ return d(Ve, o, () => d(rs, { size: "sm", class: "q-py-sm" }));
2297
+ }
2298
+ return () => i();
2299
+ }
2300
+ }), Eo = V({
2107
2301
  name: "TdButtons",
2108
2302
  props: {
2109
2303
  modelValue: { type: Number, default: 0 },
@@ -2115,309 +2309,400 @@ const Pt = () => {
2115
2309
  }
2116
2310
  },
2117
2311
  emits: ["click", "update:modelValue"],
2118
- setup(e, { slots: t, emit: o }) {
2119
- const s = xt(), n = wt(), r = Ct(), l = Ve(), a = Be(), c = lt(), u = ye(), { changed: g } = I(r), { changed: b } = I(l), { changed: f } = I(a), { changed: E } = I(c), { changed: D } = I(u), y = v(() => !(g.value || b.value || f.value || E.value || D.value));
2120
- function k() {
2121
- r.reset(), l.reset(), a.reset(), c.reset(), u.resetColor(), s.applyFromStore(), n.applyFromStore();
2312
+ setup(e, { slots: t, emit: s }) {
2313
+ const n = At(), r = Bt(), i = pt(), o = Fe(), c = he(), a = mt(), { changed: u } = N(i), { changed: p } = N(o), { changed: P } = N(c), { changed: w } = N(a), m = C(() => !(u.value || p.value || P.value || w.value));
2314
+ function g() {
2315
+ i.reset(), o.reset(), c.reset(), a.reset(), n.applyFromStore(), r.applyFromStore();
2122
2316
  }
2123
- const S = (F) => F.preventDefault();
2124
- function w() {
2125
- const Z = {
2126
- style: v(() => e.fixed ? "position: fixed;bottom: 0; left: 0; right: 0;border-top: 1px solid var(--grey-300)" : ""),
2317
+ const y = (v) => v.preventDefault();
2318
+ function x() {
2319
+ const k = {
2320
+ style: C(() => e.fixed ? "position: fixed;bottom: 0; left: 0; right: 0;border-top: 1px solid var(--grey-300)" : ""),
2127
2321
  class: "row justify-center items-center q-pa-md"
2128
- }, U = {
2322
+ }, R = {
2129
2323
  class: "td-reset-button",
2130
2324
  label: "Reset All",
2131
- onClick: k,
2132
- onKeyup: S,
2325
+ onClick: g,
2326
+ onKeyup: y,
2133
2327
  rounded: !0,
2134
2328
  unelevated: !0,
2135
2329
  outline: !0,
2136
- disable: y.value
2330
+ disable: m.value
2137
2331
  };
2138
- return h("div", Z, [h(Ot, U)]);
2332
+ return d("div", k, [d(qt, R)]);
2139
2333
  }
2140
- return () => w();
2334
+ return () => x();
2141
2335
  }
2142
- }), jo = $({
2143
- name: "TdExpansions",
2144
- setup(e, { slots: t, emit: o }) {
2336
+ }), is = V({
2337
+ name: "TdPoseButtonsSection",
2338
+ setup() {
2339
+ const e = Symbol.for("PoseButtonsSection"), t = Ze(e, null);
2145
2340
  function s() {
2146
- return h("div", {
2341
+ const n = {
2342
+ class: "td-pose-buttons-section"
2343
+ }, r = [];
2344
+ return t && r.push(d(t)), d("div", n, r);
2345
+ }
2346
+ return () => s();
2347
+ }
2348
+ }), Io = V({
2349
+ name: "TdExpansions",
2350
+ setup(e, { slots: t, emit: s }) {
2351
+ function n() {
2352
+ return d("div", {
2147
2353
  class: "td-expansions",
2148
- onClick: (r) => r.stopPropagation(),
2354
+ onClick: (i) => i.stopPropagation(),
2149
2355
  style: "padding-bottom: 60px; position: relative "
2150
2356
  }, [
2151
- // h(TsPoseButtonsSection),
2152
- h(Fe),
2153
- h(zo),
2154
- h(Fe),
2155
- h(To),
2156
- h(Fe),
2157
- h(Lo),
2158
- h(Fe),
2357
+ d(is),
2358
+ d(ve),
2359
+ d(Co),
2360
+ d(ve),
2361
+ d(mo),
2362
+ d(ve),
2363
+ d(fo),
2364
+ d(ve),
2365
+ d(ho),
2366
+ d(ve),
2159
2367
  // h(TsGridExpansion),
2160
2368
  // h(QSeparator),
2161
2369
  // h(TsAdjustmentExpansion),
2162
- h(Vo),
2163
- h(Fe),
2370
+ d(go),
2371
+ d(ve),
2372
+ d(vo),
2373
+ d(ve),
2164
2374
  // h('div', {}, store.loading.percent),
2165
- h(Kt)
2375
+ d(Eo)
2166
2376
  ]);
2167
2377
  }
2168
- return () => s();
2378
+ return () => n();
2169
2379
  }
2170
- }), Fo = $({
2380
+ }), Do = V({
2171
2381
  name: "TdColorsButton",
2172
2382
  props: { size: String },
2173
2383
  setup(e, {}) {
2174
- const t = Me(), o = p(), s = v(() => (o == null ? void 0 : o.hasAccess("grd")) || !1), { lang: n } = J(), r = v(() => {
2175
- var g;
2176
- return (g = n.value.td) == null ? void 0 : g.controls.colors.iconTitle;
2177
- }), { click: l, selected: a } = Se({
2384
+ const t = ke(), s = M(), n = C(() => (s == null ? void 0 : s.hasAccess("grd")) || !1), { lang: r } = H(), i = C(() => {
2385
+ var p;
2386
+ return (p = r.value.td) == null ? void 0 : p.controls.colors.iconTitle;
2387
+ }), { click: o, selected: c } = Z({
2178
2388
  store: t,
2179
2389
  options: oe,
2180
2390
  tab: oe
2181
2391
  });
2182
- function c(g) {
2183
- return o.block(g);
2392
+ function a(p) {
2393
+ return s.block(p);
2184
2394
  }
2185
2395
  function u() {
2186
- const g = {
2187
- hasAccess: s.value,
2188
- selected: a.value,
2189
- onClick: l,
2190
- onBlockAccess: c,
2396
+ const p = {
2397
+ hasAccess: n.value,
2398
+ selected: c.value,
2399
+ onClick: o,
2400
+ onBlockAccess: a,
2191
2401
  size: e.size,
2192
2402
  "data-id": oe,
2193
2403
  name: "colors",
2194
2404
  type: "none",
2195
2405
  icon: "f_palette",
2196
- label: r.value
2406
+ label: i.value
2197
2407
  };
2198
- return h(ne, g, () => []);
2408
+ return d(me, p, () => []);
2199
2409
  }
2200
2410
  return () => u();
2201
2411
  }
2202
- }), Po = $({
2412
+ }), ko = V({
2203
2413
  name: "TdGridButton",
2204
2414
  props: { size: String },
2205
2415
  setup(e, {}) {
2206
- const t = Me(), o = p(), s = v(() => (o == null ? void 0 : o.hasAccess("grd")) || !1), { lang: n } = J(), r = v(() => {
2207
- var g;
2208
- return (g = n.value.td) == null ? void 0 : g.controls.grid.iconTitle;
2209
- }), { click: l, selected: a } = Se({
2416
+ const t = ke(), s = M(), n = C(() => (s == null ? void 0 : s.hasAccess("grd")) || !1), { lang: r } = H(), i = C(() => {
2417
+ var p;
2418
+ return (p = r.value.td) == null ? void 0 : p.controls.grid.iconTitle;
2419
+ }), { click: o, selected: c } = Z({
2210
2420
  store: t,
2211
- options: xe,
2212
- tab: xe
2421
+ options: we,
2422
+ tab: we
2213
2423
  });
2214
- function c(g) {
2215
- return o.block(g);
2424
+ function a(p) {
2425
+ return s.block(p);
2216
2426
  }
2217
2427
  function u() {
2218
- const g = {
2219
- hasAccess: s.value,
2220
- selected: a.value,
2221
- onClick: l,
2222
- onBlockAccess: c,
2428
+ const p = {
2429
+ hasAccess: n.value,
2430
+ selected: c.value,
2431
+ onClick: o,
2432
+ onBlockAccess: a,
2223
2433
  size: e.size,
2224
- "data-id": xe,
2434
+ "data-id": we,
2225
2435
  name: "grid",
2226
2436
  type: "none",
2227
2437
  icon: "f_grid",
2228
- label: r.value
2438
+ label: i.value
2229
2439
  };
2230
- return h(ne, g, () => []);
2440
+ return d(me, p, () => []);
2231
2441
  }
2232
2442
  return () => u();
2233
2443
  }
2234
- }), Go = $({
2444
+ }), To = V({
2235
2445
  name: "TdLightsButton",
2236
2446
  props: { size: String },
2237
2447
  setup(e, {}) {
2238
- const t = Me(), o = p(), s = v(() => (o == null ? void 0 : o.hasAccess("grd")) || !1), { lang: n } = J(), r = v(() => {
2239
- var g;
2240
- return (g = n.value.td) == null ? void 0 : g.controls.lights.iconTitle;
2241
- }), { click: l, selected: a } = Se({
2448
+ const t = ke(), s = M(), n = C(() => (s == null ? void 0 : s.hasAccess("grd")) || !1), { lang: r } = H(), i = C(() => {
2449
+ var p;
2450
+ return (p = r.value.td) == null ? void 0 : p.controls.lights.iconTitle;
2451
+ }), { click: o, selected: c } = Z({
2242
2452
  store: t,
2243
- options: ve,
2244
- tab: ve
2453
+ options: de,
2454
+ tab: de
2245
2455
  });
2246
- function c(g) {
2247
- return o.block(g);
2456
+ function a(p) {
2457
+ return s.block(p);
2248
2458
  }
2249
2459
  function u() {
2250
- const g = {
2251
- hasAccess: s.value,
2252
- selected: a.value,
2253
- onClick: l,
2254
- onBlockAccess: c,
2460
+ const p = {
2461
+ hasAccess: n.value,
2462
+ selected: c.value,
2463
+ onClick: o,
2464
+ onBlockAccess: a,
2255
2465
  size: e.size,
2256
- "data-id": ve,
2466
+ "data-id": de,
2257
2467
  name: "lights",
2258
2468
  type: "none",
2259
2469
  icon: "f_bulb_light",
2260
- label: r.value
2470
+ label: i.value
2261
2471
  };
2262
- return h(ne, g, () => []);
2472
+ return d(me, p, () => []);
2263
2473
  }
2264
2474
  return () => u();
2265
2475
  }
2266
- }), Ho = $({
2476
+ }), Mo = V({
2267
2477
  name: "TsAdjustmentsButton",
2268
2478
  props: { size: String },
2269
2479
  setup(e, {}) {
2270
- const t = p(), { lang: o } = J(), s = v(() => {
2271
- var c;
2272
- return (c = o.value.td) == null ? void 0 : c.controls.related.iconTitle;
2273
- }), { click: n, selected: r } = Se({
2274
- options: we,
2275
- tab: we
2480
+ const t = M(), { lang: s } = H(), n = C(() => {
2481
+ var a;
2482
+ return (a = s.value.td) == null ? void 0 : a.controls.related.iconTitle;
2483
+ }), { click: r, selected: i } = Z({
2484
+ options: Ce,
2485
+ tab: Ce
2276
2486
  });
2277
- function l(c) {
2278
- return t.block(c);
2487
+ function o(a) {
2488
+ return t.block(a);
2279
2489
  }
2280
- function a() {
2281
- const c = {
2490
+ function c() {
2491
+ const a = {
2282
2492
  hasAccess: !0,
2283
- selected: r.value,
2284
- onClick: n,
2285
- onBlockAccess: l,
2286
- "data-id": we,
2493
+ selected: i.value,
2494
+ onClick: r,
2495
+ onBlockAccess: o,
2496
+ "data-id": Ce,
2287
2497
  size: e.size,
2288
2498
  name: "related",
2289
2499
  icon: "f_related",
2290
2500
  type: "none",
2291
- label: s.value
2501
+ label: n.value
2292
2502
  };
2293
- return h(ne, c, () => []);
2503
+ return d(me, a, () => []);
2294
2504
  }
2295
- return () => a();
2505
+ return () => c();
2506
+ }
2507
+ }), Ao = V({
2508
+ name: "TdSavedButton",
2509
+ props: { size: String },
2510
+ setup(e) {
2511
+ const t = M(), { lang: s } = H(), n = C(
2512
+ () => {
2513
+ var a, u;
2514
+ return ((u = (a = s.value.td) == null ? void 0 : a.controls.saved) == null ? void 0 : u.iconTitle) || "Saved";
2515
+ }
2516
+ ), { click: r, selected: i } = Z({
2517
+ options: Ee,
2518
+ tab: Ee
2519
+ });
2520
+ function o(a) {
2521
+ return t.block(a);
2522
+ }
2523
+ function c() {
2524
+ const a = {
2525
+ hasAccess: !0,
2526
+ selected: i.value,
2527
+ onClick: r,
2528
+ onBlockAccess: o,
2529
+ "data-id": Ee,
2530
+ size: e.size,
2531
+ name: "saved",
2532
+ icon: "f_save",
2533
+ type: "none",
2534
+ label: n.value
2535
+ };
2536
+ return d(me, a, () => []);
2537
+ }
2538
+ return () => c();
2296
2539
  }
2297
- }), Ro = $({
2298
- name: "TsDefaultDrawer",
2540
+ }), Bo = V({
2541
+ name: "TdDefaultDrawer",
2299
2542
  props: {},
2300
2543
  emits: ["click"],
2301
- setup(e, { slots: t, emit: o }) {
2302
- const s = p(), n = "q-ma-xs";
2303
- function r(l) {
2544
+ setup() {
2545
+ const e = M(), t = "q-ma-xs";
2546
+ function s(n) {
2304
2547
  return {
2305
- class: n,
2548
+ class: t,
2306
2549
  size: "sm",
2307
- onClick: () => s.setActive(l)
2550
+ onClick: () => e.setActive(n)
2308
2551
  };
2309
2552
  }
2310
- return () => h(
2311
- Qe,
2312
- { name: ot },
2553
+ return () => d(
2554
+ De,
2555
+ { name: lt },
2313
2556
  {
2314
- default: () => h(ro, {}, () => [
2315
- h(Fo, r(oe)),
2316
- h(Po, r(xe)),
2317
- h(Go, r(ve)),
2318
- h(Ho, r(we))
2557
+ default: () => d(Jt, {}, () => [
2558
+ d(Do, s(oe)),
2559
+ d(ko, s(we)),
2560
+ d(To, s(de)),
2561
+ d(Mo, s(Ce)),
2562
+ d(Ao, s(Ee))
2319
2563
  ]),
2320
- secondary: () => h(Kt, { fixed: !1 })
2564
+ secondary: () => d(is)
2321
2565
  }
2322
2566
  );
2323
2567
  }
2324
- }), Oo = $({
2568
+ }), zo = V({
2325
2569
  name: "TdGridDrawer",
2326
- setup(e, { slots: t, emit: o }) {
2327
- const { lang: s } = J(), n = v(() => {
2328
- var l;
2329
- return (l = s.value.td) == null ? void 0 : l.controls.grid.title;
2570
+ setup(e, { slots: t, emit: s }) {
2571
+ const { lang: n } = H(), r = C(() => {
2572
+ var o;
2573
+ return (o = n.value.td) == null ? void 0 : o.controls.grid.title;
2330
2574
  });
2331
- function r() {
2332
- const l = {
2575
+ function i() {
2576
+ const o = {
2333
2577
  class: "td-grid-drawer",
2334
- name: xe,
2335
- label: n.value
2578
+ name: we,
2579
+ label: r.value
2336
2580
  };
2337
- return h(Qe, l, () => h($t));
2581
+ return d(De, o, () => d(ts));
2338
2582
  }
2339
- return () => r();
2583
+ return () => i();
2340
2584
  }
2341
- }), qo = $({
2585
+ }), Po = V({
2342
2586
  name: "TdRelatedDrawer",
2343
- setup(e, { slots: t, emit: o }) {
2344
- const { lang: s } = J(), n = v(() => {
2345
- var l;
2346
- return (l = s.value.td) == null ? void 0 : l.controls.related.title;
2587
+ setup(e, { slots: t, emit: s }) {
2588
+ const { lang: n } = H(), r = C(() => {
2589
+ var o;
2590
+ return (o = n.value.td) == null ? void 0 : o.controls.related.title;
2347
2591
  });
2348
- function r() {
2349
- const l = {
2592
+ function i() {
2593
+ const o = {
2350
2594
  class: "td-related-drawer",
2351
- name: we,
2352
- label: n.value
2595
+ name: Ce,
2596
+ label: r.value
2353
2597
  };
2354
- return h(Qe, l, () => h(Zt));
2598
+ return d(De, o, () => d(os));
2355
2599
  }
2356
- return () => r();
2600
+ return () => i();
2601
+ }
2602
+ }), Lo = V({
2603
+ name: "TdSavedDrawer",
2604
+ setup() {
2605
+ const { lang: e } = H(), t = C(() => {
2606
+ var n, r;
2607
+ return ((r = (n = e.value.td) == null ? void 0 : n.controls.saved) == null ? void 0 : r.title) || "Saved";
2608
+ });
2609
+ function s() {
2610
+ const n = {
2611
+ class: "td-saved-drawer",
2612
+ name: Ee,
2613
+ label: t.value
2614
+ };
2615
+ return d(De, n, () => d(ns));
2616
+ }
2617
+ return () => s();
2357
2618
  }
2358
- }), _o = $({
2619
+ }), Ro = V({
2359
2620
  name: "TdLightsDrawer",
2360
- setup(e, { slots: t, emit: o }) {
2361
- const { lang: s } = J(), n = v(() => {
2362
- var l;
2363
- return (l = s.value.td) == null ? void 0 : l.controls.lights.title;
2621
+ setup(e, { slots: t, emit: s }) {
2622
+ const { lang: n } = H(), r = C(() => {
2623
+ var o;
2624
+ return (o = n.value.td) == null ? void 0 : o.controls.lights.title;
2364
2625
  });
2365
- function r() {
2366
- const l = {
2626
+ function i() {
2627
+ const o = {
2367
2628
  class: "td-lights-drawer",
2368
- name: ve,
2369
- label: n.value
2629
+ name: de,
2630
+ label: r.value
2370
2631
  };
2371
- return h(Qe, l, () => h(Nt));
2632
+ return d(De, o, () => d(ss));
2372
2633
  }
2373
- return () => r();
2634
+ return () => i();
2374
2635
  }
2375
- }), Uo = $({
2636
+ }), Vo = V({
2376
2637
  name: "TdLightsDrawer",
2377
- setup(e, { slots: t, emit: o }) {
2378
- const { lang: s } = J(), n = v(() => {
2379
- var l;
2380
- return (l = s.value.td) == null ? void 0 : l.controls.colors.title;
2638
+ setup(e, { slots: t, emit: s }) {
2639
+ const { lang: n } = H(), r = C(() => {
2640
+ var o;
2641
+ return (o = n.value.td) == null ? void 0 : o.controls.colors.title;
2381
2642
  });
2382
- function r() {
2383
- const l = {
2643
+ function i() {
2644
+ const o = {
2384
2645
  class: "td-colors-drawer",
2385
2646
  name: oe,
2386
- label: n.value
2647
+ label: r.value
2387
2648
  };
2388
- return h(Qe, l, () => h(It));
2649
+ return d(De, o, () => d(es));
2389
2650
  }
2390
- return () => r();
2651
+ return () => i();
2652
+ }
2653
+ }), Fo = V({
2654
+ name: "TdSkinsDrawer",
2655
+ setup() {
2656
+ const { lang: e } = H(), { expanded: t } = Z({
2657
+ options: xe,
2658
+ tab: xe
2659
+ }), s = C(() => {
2660
+ var r;
2661
+ return (r = e.value.td) == null ? void 0 : r.controls.skins.title;
2662
+ });
2663
+ function n() {
2664
+ const r = {
2665
+ class: "td-skins-drawer",
2666
+ name: xe,
2667
+ label: s.value,
2668
+ modelValue: t.value,
2669
+ "onUpdate:modelValue": (i) => t.value = i
2670
+ };
2671
+ return d(De, r, () => d(rs));
2672
+ }
2673
+ return () => n();
2391
2674
  }
2392
- }), Io = $({
2675
+ }), _o = V({
2393
2676
  name: "TsDrawers",
2394
- setup(e, { slots: t, emit: o }) {
2395
- const s = p(), n = v({
2396
- get: () => s.active,
2397
- set: (l) => s.setActive(l)
2677
+ setup(e, { slots: t, emit: s }) {
2678
+ const n = M(), r = C({
2679
+ get: () => n.active,
2680
+ set: (o) => n.setActive(o)
2398
2681
  });
2399
- function r() {
2400
- const l = {
2401
- modelValue: n.value,
2402
- "onUpdate:modelValue": (a) => n.value = a
2682
+ function i() {
2683
+ const o = {
2684
+ modelValue: r.value,
2685
+ "onUpdate:modelValue": (c) => r.value = c
2403
2686
  };
2404
- return h(lo, l, () => [
2405
- h(Ro),
2406
- h(_o),
2407
- h(Uo),
2408
- h(Oo),
2409
- h(qo)
2687
+ return d(Ss, o, () => [
2688
+ d(Bo),
2689
+ d(Fo),
2690
+ d(Ro),
2691
+ d(Vo),
2692
+ d(zo),
2693
+ d(Po),
2694
+ d(Lo)
2410
2695
  ]);
2411
2696
  }
2412
- return () => r();
2697
+ return () => i();
2413
2698
  }
2414
- }), ns = /* @__PURE__ */ Object.assign({
2699
+ }), Qo = /* @__PURE__ */ Object.assign({
2415
2700
  name: "TdPage",
2416
2701
  slug: "td-page",
2417
2702
  inheritAttrs: !1
2418
2703
  }, {
2419
2704
  __name: "TdPage",
2420
- props: /* @__PURE__ */ so({
2705
+ props: /* @__PURE__ */ vs({
2421
2706
  id: Number
2422
2707
  }, {
2423
2708
  miniState: { type: Boolean },
@@ -2425,29 +2710,41 @@ const Pt = () => {
2425
2710
  }),
2426
2711
  emits: ["update:miniState"],
2427
2712
  setup(e) {
2428
- const t = e, o = p(), s = v(() => Number(t.id)), n = eo(e, "miniState");
2429
- return to(() => {
2430
- o.setActive(ft.is.mobile ? ot : oe);
2431
- }), (r, l) => (Je(), it(at(io), {
2713
+ const t = e, s = Symbol.for("activity-tracking"), n = M(), r = Ze(s, null), i = C(() => Number(t.id)), o = fs(e, "miniState"), c = (a) => {
2714
+ a && (r == null || r.trackEvent(zs, {
2715
+ glb_id: n.selected || null,
2716
+ base_pose_id: a
2717
+ }));
2718
+ };
2719
+ return $t(async () => {
2720
+ r && (await r.beginExplore(), r.trackEvent(Bs, { from: null, to: "3d" }), n.basePoseId && (r.beginSegment(String(n.basePoseId)), c(n.basePoseId)));
2721
+ }), j(
2722
+ () => n.basePoseId,
2723
+ (a, u) => {
2724
+ !a || a === u || (r == null || r.beginSegment(String(a)), c(a));
2725
+ }
2726
+ ), hs(() => {
2727
+ n.setActive(Ct.is.mobile ? lt : oe), r == null || r.end();
2728
+ }), (a, u) => (at(), vt(bt(xs), {
2432
2729
  class: "three-dimension-page",
2433
- miniState: n.value,
2434
- "onUpdate:miniState": l[0] || (l[0] = (a) => n.value = a),
2730
+ miniState: o.value,
2731
+ "onUpdate:miniState": u[0] || (u[0] = (p) => o.value = p),
2435
2732
  "no-drawer-padding": !0,
2436
2733
  title: "3D Viewer"
2437
2734
  }, {
2438
- toolDrawer: ct(() => [
2439
- r.$q.platform.is.mobile ? ht("", !0) : (Je(), it(at(jo), { key: 0 }))
2735
+ toolDrawer: yt(() => [
2736
+ a.$q.platform.is.mobile ? wt("", !0) : (at(), vt(bt(Io), { key: 0 }))
2440
2737
  ]),
2441
- bottomDrawer: ct(() => [
2442
- r.$q.platform.is.mobile ? (Je(), it(at(Io), { key: 0 })) : ht("", !0)
2738
+ bottomDrawer: yt(() => [
2739
+ a.$q.platform.is.mobile ? (at(), vt(bt(_o), { key: 0 })) : wt("", !0)
2443
2740
  ]),
2444
- default: ct(() => [
2445
- oo(Ao, { id: s.value }, null, 8, ["id"])
2741
+ default: yt(() => [
2742
+ gs(po, { id: i.value }, null, 8, ["id"])
2446
2743
  ]),
2447
2744
  _: 1
2448
2745
  }, 8, ["miniState"]));
2449
2746
  }
2450
- }), $o = [
2747
+ }), Go = [
2451
2748
  "#141111",
2452
2749
  "#3E251E",
2453
2750
  "#633C30",
@@ -2488,29 +2785,29 @@ const Pt = () => {
2488
2785
  "#BDACA8",
2489
2786
  "#DACDC9",
2490
2787
  "#E5E4E3"
2491
- ], rs = de("3d-fbxs", {
2788
+ ], en = Ye("3d-fbxs", {
2492
2789
  state: () => ({
2493
2790
  models: {},
2494
2791
  loadingUrl: null,
2495
- palette: $o
2792
+ palette: Go
2496
2793
  }),
2497
2794
  getters: {
2498
2795
  changed(e) {
2499
- var s, n, r, l, a;
2500
- const o = p().selected;
2501
- return console.log("fbx model", (s = e.models) == null ? void 0 : s[o]), (r = (n = e.models) == null ? void 0 : n[o]) != null && r.color ? ((a = (l = e.models) == null ? void 0 : l[o]) == null ? void 0 : a.color) !== 16777215 : !1;
2796
+ var n, r, i, o, c;
2797
+ const s = M().selected;
2798
+ return console.log("fbx model", (n = e.models) == null ? void 0 : n[s]), (i = (r = e.models) == null ? void 0 : r[s]) != null && i.color ? ((c = (o = e.models) == null ? void 0 : o[s]) == null ? void 0 : c.color) !== 16777215 : !1;
2502
2799
  },
2503
2800
  selectedId() {
2504
- return p().selected;
2801
+ return M().selected;
2505
2802
  },
2506
2803
  poseId(e) {
2507
- var s, n;
2508
- const o = p().selected;
2509
- return (n = (s = e.models) == null ? void 0 : s[o]) == null ? void 0 : n.poseId;
2804
+ var n, r;
2805
+ const s = M().selected;
2806
+ return (r = (n = e.models) == null ? void 0 : n[s]) == null ? void 0 : r.poseId;
2510
2807
  },
2511
2808
  model(e) {
2512
- const o = p().selected;
2513
- return o && e.models[o] ? e.models[o] : null;
2809
+ const s = M().selected;
2810
+ return s && e.models[s] ? e.models[s] : null;
2514
2811
  },
2515
2812
  url() {
2516
2813
  var e;
@@ -2526,37 +2823,37 @@ const Pt = () => {
2526
2823
  },
2527
2824
  colorHex() {
2528
2825
  var e;
2529
- return (e = this.model) != null && e.color ? ce(this.model.color) : "#fefefe";
2826
+ return (e = this.model) != null && e.color ? ue(this.model.color) : "#fefefe";
2530
2827
  }
2531
2828
  },
2532
2829
  actions: {
2533
2830
  resetColor() {
2534
- const t = p().selected;
2831
+ const t = M().selected;
2535
2832
  this.models[t].color = 16777215;
2536
2833
  },
2537
2834
  setBounds(e) {
2538
- const o = p().selected;
2539
- this.models[o].bounds = _t(e);
2835
+ const s = M().selected;
2836
+ this.models[s].bounds = Kt(e);
2540
2837
  },
2541
2838
  setSubjectsFromResponse(e) {
2542
2839
  const t = e.entities.fbx;
2543
2840
  this.models = { ...this.models, ...t };
2544
2841
  },
2545
2842
  setColorHex(e) {
2546
- const o = p().selected;
2547
- this.models[o].color = be(e);
2843
+ const s = M().selected;
2844
+ this.models[s].color = et(e);
2548
2845
  }
2549
2846
  }
2550
2847
  });
2551
2848
  export {
2552
- ns as TdPage,
2553
- p as use3dStore,
2554
- Ut as useColorsStore,
2555
- Ct as useControlsStore,
2556
- rs as useFBXStore,
2557
- ye as useGLBStore,
2558
- Me as useGridStore,
2559
- Ve as useGroundStore,
2560
- Be as useLightsStore,
2561
- lt as useSceneStore
2849
+ Qo as TdPage,
2850
+ M as use3dStore,
2851
+ Mt as useColorsStore,
2852
+ pt as useControlsStore,
2853
+ en as useFBXStore,
2854
+ fe as useGLBStore,
2855
+ ke as useGridStore,
2856
+ Fe as useGroundStore,
2857
+ he as useLightsStore,
2858
+ mt as useSceneStore
2562
2859
  };