@tomorrowevening/hermes 0.0.35 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hermes.cjs.js +144 -0
- package/dist/hermes.esm.js +3849 -0
- package/dist/hermes.umd.js +144 -0
- package/dist/style.css +1 -1
- package/package.json +20 -16
- package/src/core/Application.ts +111 -0
- package/src/core/RemoteController.ts +60 -0
- package/src/core/remote/BaseRemote.ts +16 -0
- package/src/core/remote/RemoteComponents.ts +45 -0
- package/src/core/remote/RemoteTheatre.ts +300 -0
- package/src/core/remote/RemoteThree.ts +143 -0
- package/src/core/remote/RemoteTweakpane.ts +194 -0
- package/src/core/types.ts +56 -0
- package/src/editor/Editor.tsx +20 -0
- package/src/editor/components/Draggable.tsx +40 -0
- package/src/editor/components/DraggableItem.tsx +22 -0
- package/src/editor/components/Dropdown.tsx +38 -0
- package/src/editor/components/DropdownItem.tsx +64 -0
- package/src/editor/components/NavButton.tsx +11 -0
- package/src/editor/components/content.ts +2 -0
- package/src/editor/components/icons/CloseIcon.tsx +7 -0
- package/src/editor/components/icons/DragIcon.tsx +9 -0
- package/src/editor/components/types.ts +41 -0
- package/src/editor/global.ts +20 -0
- package/src/editor/multiView/CameraWindow.tsx +74 -0
- package/src/editor/multiView/InfiniteGridHelper.ts +24 -0
- package/src/editor/multiView/InfiniteGridMaterial.ts +127 -0
- package/src/editor/multiView/MultiView.scss +101 -0
- package/src/editor/multiView/MultiView.tsx +636 -0
- package/src/editor/multiView/MultiViewData.ts +59 -0
- package/src/editor/multiView/UVMaterial.ts +55 -0
- package/src/editor/scss/_debug.scss +58 -0
- package/src/editor/scss/_draggable.scss +43 -0
- package/src/editor/scss/_dropdown.scss +84 -0
- package/src/editor/scss/_sidePanel.scss +278 -0
- package/src/editor/scss/_theme.scss +9 -0
- package/src/editor/scss/index.scss +67 -0
- package/src/editor/sidePanel/Accordion.tsx +41 -0
- package/src/editor/sidePanel/ChildObject.tsx +57 -0
- package/src/editor/sidePanel/ContainerObject.tsx +11 -0
- package/src/editor/sidePanel/SidePanel.tsx +64 -0
- package/src/editor/sidePanel/ToggleBtn.tsx +27 -0
- package/src/editor/sidePanel/inspector/Inspector.tsx +119 -0
- package/src/editor/sidePanel/inspector/InspectorField.tsx +198 -0
- package/src/editor/sidePanel/inspector/InspectorGroup.tsx +50 -0
- package/src/editor/sidePanel/inspector/SceneInspector.tsx +84 -0
- package/src/editor/sidePanel/inspector/inspector.scss +161 -0
- package/src/editor/sidePanel/inspector/utils/InspectAnimation.tsx +102 -0
- package/src/editor/sidePanel/inspector/utils/InspectCamera.tsx +75 -0
- package/src/editor/sidePanel/inspector/utils/InspectLight.tsx +62 -0
- package/src/editor/sidePanel/inspector/utils/InspectMaterial.tsx +710 -0
- package/src/editor/sidePanel/inspector/utils/InspectTransform.tsx +113 -0
- package/src/editor/sidePanel/types.ts +130 -0
- package/src/editor/sidePanel/utils.ts +278 -0
- package/src/editor/utils.ts +117 -0
- package/src/example/CustomEditor.tsx +78 -0
- package/src/example/components/App.css +6 -0
- package/src/example/components/App.tsx +246 -0
- package/src/example/constants.ts +52 -0
- package/src/example/index.scss +45 -0
- package/src/example/main.tsx +37 -0
- package/src/example/three/BaseScene.ts +42 -0
- package/src/example/three/CustomMaterial.ts +72 -0
- package/src/example/three/FBXAnimation.ts +26 -0
- package/src/example/three/Scene1.ts +225 -0
- package/src/example/three/Scene2.ts +138 -0
- package/src/example/three/loader.ts +110 -0
- package/src/index.ts +27 -0
- package/src/vite-env.d.ts +1 -0
- package/dist/hermes.js +0 -3901
- package/dist/hermes.umd.cjs +0 -144
@@ -0,0 +1,3849 @@
|
|
1
|
+
import { PositionalAudio as Hn, EventDispatcher as un, Texture as dn, CubeTexture as Wn, RepeatWrapping as Kt, ShaderMaterial as fn, GLSL3 as qn, DoubleSide as hn, Color as Tt, Mesh as Kn, PlaneGeometry as Xn, FrontSide as Zn, BackSide as Jn, NoBlending as Qn, NormalBlending as ea, AdditiveBlending as ta, SubtractiveBlending as na, MultiplyBlending as aa, CustomBlending as ia, AddEquation as ra, SubtractEquation as oa, ReverseSubtractEquation as sa, MinEquation as ca, MaxEquation as la, ZeroFactor as pn, OneFactor as mn, SrcColorFactor as vn, OneMinusSrcColorFactor as gn, SrcAlphaFactor as bn, OneMinusSrcAlphaFactor as yn, DstAlphaFactor as En, OneMinusDstAlphaFactor as Cn, DstColorFactor as xn, OneMinusDstColorFactor as Sn, SrcAlphaSaturateFactor as ua, ConstantColorFactor as wn, OneMinusConstantColorFactor as On, ConstantAlphaFactor as Mn, OneMinusConstantAlphaFactor as Tn, Matrix4 as da, Vector3 as X, Euler as fa, Ray as ha, Plane as pa, MathUtils as ma, MOUSE as He, TOUCH as We, Quaternion as Xt, Spherical as Zt, Vector2 as ue, PerspectiveCamera as zt, MeshDepthMaterial as va, MeshNormalMaterial as ga, MeshBasicMaterial as ba, OrthographicCamera as Rn, Scene as Pn, Group as ya, AxesHelper as An, WebGLRenderer as Ea, Raycaster as Ca, CameraHelper as xa } from "three";
|
2
|
+
import { getProject as Sa, createRafDriver as wa } from "@theatre/core";
|
3
|
+
import ct from "@theatre/studio";
|
4
|
+
import { Pane as Oa } from "tweakpane";
|
5
|
+
import * as Ma from "@tweakpane/plugin-essentials";
|
6
|
+
import kn, { useState as oe, useRef as ye, useEffect as Be, Component as Ta, forwardRef as Ra } from "react";
|
7
|
+
import { Reorder as _n } from "framer-motion";
|
8
|
+
function lt(t) {
|
9
|
+
return t.substring(0, 1).toUpperCase() + t.substring(1);
|
10
|
+
}
|
11
|
+
function $i(t, n, a) {
|
12
|
+
return Math.min(n, Math.max(t, a));
|
13
|
+
}
|
14
|
+
function zi(t, n) {
|
15
|
+
const a = t - n;
|
16
|
+
return Math.sqrt(a * a);
|
17
|
+
}
|
18
|
+
function Pa() {
|
19
|
+
return Math.round(Math.random() * 1e6).toString();
|
20
|
+
}
|
21
|
+
function Aa(t) {
|
22
|
+
return t.r !== void 0 && t.g !== void 0 && t.b !== void 0;
|
23
|
+
}
|
24
|
+
function ka(t) {
|
25
|
+
const n = Math.round(t.r * 255), a = Math.round(t.g * 255), e = Math.round(t.b * 255), o = (u) => {
|
26
|
+
const d = u.toString(16);
|
27
|
+
return d.length === 1 ? "0" + d : d;
|
28
|
+
}, s = o(n), p = o(a), c = o(e);
|
29
|
+
return "#" + s + p + c;
|
30
|
+
}
|
31
|
+
function Ft(t, n = 1) {
|
32
|
+
return Number(t.toFixed(n));
|
33
|
+
}
|
34
|
+
let Yt = 0;
|
35
|
+
const _a = () => {
|
36
|
+
Yt = 0;
|
37
|
+
}, jn = (t) => {
|
38
|
+
if (!t)
|
39
|
+
return;
|
40
|
+
let n = t.name.replace(" ", "");
|
41
|
+
n.length === 0 && (n = `obj_${Yt}`, Yt++), t.parent !== null && (n = `${t.parent.uuid}.${n}`), t.uuid = n, t.children.forEach((a) => {
|
42
|
+
jn(a);
|
43
|
+
});
|
44
|
+
}, Yi = (t) => {
|
45
|
+
t?.dispose();
|
46
|
+
}, ja = (t) => {
|
47
|
+
t && (Array.isArray(t) ? t.forEach((n) => n.dispose()) : t.dispose());
|
48
|
+
}, Dn = (t) => {
|
49
|
+
if (t) {
|
50
|
+
for (; t.children.length > 0; ) {
|
51
|
+
const n = t.children[0];
|
52
|
+
n instanceof Hn ? (n.pause(), n.parent && n.parent.remove(n)) : Dn(n);
|
53
|
+
}
|
54
|
+
if (t.parent && t.parent.remove(t), t.isMesh) {
|
55
|
+
const n = t;
|
56
|
+
n.geometry?.dispose(), ja(n.material);
|
57
|
+
}
|
58
|
+
t.dispose !== void 0 && t.dispose();
|
59
|
+
}
|
60
|
+
};
|
61
|
+
class Gi {
|
62
|
+
components = /* @__PURE__ */ new Map();
|
63
|
+
listen;
|
64
|
+
// Protected
|
65
|
+
_debugEnabled;
|
66
|
+
broadcastChannel = void 0;
|
67
|
+
webSocket = void 0;
|
68
|
+
_mode = "app";
|
69
|
+
_connected = !1;
|
70
|
+
useBC = !1;
|
71
|
+
constructor(n, a, e = !0, o = "editor") {
|
72
|
+
this.editor = a && document.location.hash.search(o) > -1, this._debugEnabled = a, a && (this.useBC = e, e ? (this.broadcastChannel = new BroadcastChannel(n), this.broadcastChannel.addEventListener("message", this.messageHandler)) : (this.webSocket = new WebSocket(n), this.webSocket.addEventListener("open", this.openHandler), this.webSocket.addEventListener("close", this.closeHandler), this.webSocket.addEventListener("message", this.messageHandler)));
|
73
|
+
}
|
74
|
+
addComponent(n, a) {
|
75
|
+
this.components.set(n, a);
|
76
|
+
}
|
77
|
+
dispose() {
|
78
|
+
this.broadcastChannel !== void 0 && this.broadcastChannel.removeEventListener("message", this.messageHandler), this.webSocket !== void 0 && (this.webSocket.removeEventListener("open", this.openHandler), this.webSocket.removeEventListener("close", this.closeHandler), this.webSocket.removeEventListener("message", this.messageHandler)), this.components.forEach((n) => {
|
79
|
+
n.dispose();
|
80
|
+
}), this.components.clear();
|
81
|
+
}
|
82
|
+
// Remote
|
83
|
+
send(n) {
|
84
|
+
this._mode !== n.target && (this.useBC ? this.broadcastChannel?.postMessage(n) : this._connected && this.webSocket?.send(JSON.stringify(n)));
|
85
|
+
}
|
86
|
+
messageHandler = (n) => {
|
87
|
+
this.listen !== void 0 && (this.useBC ? this.listen(n.data) : this.listen(JSON.parse(n.data)));
|
88
|
+
};
|
89
|
+
openHandler = () => {
|
90
|
+
this._connected = !0;
|
91
|
+
};
|
92
|
+
closeHandler = () => {
|
93
|
+
this._connected = !1;
|
94
|
+
};
|
95
|
+
// Getters / Setters
|
96
|
+
get connected() {
|
97
|
+
return this._connected;
|
98
|
+
}
|
99
|
+
get debugEnabled() {
|
100
|
+
return this._debugEnabled;
|
101
|
+
}
|
102
|
+
get mode() {
|
103
|
+
return this._mode;
|
104
|
+
}
|
105
|
+
get isApp() {
|
106
|
+
return this._mode === "app";
|
107
|
+
}
|
108
|
+
get editor() {
|
109
|
+
return this._mode === "editor";
|
110
|
+
}
|
111
|
+
set editor(n) {
|
112
|
+
n && (this._mode = "editor", document.title += " - Editor");
|
113
|
+
}
|
114
|
+
}
|
115
|
+
const _ = new un(), j = {
|
116
|
+
CUSTOM: "ToolEvents::custom",
|
117
|
+
// Components
|
118
|
+
SELECT_DROPDOWN: "ToolEvents::selectDropdown",
|
119
|
+
DRAG_UPDATE: "ToolEvents::dragUpdate",
|
120
|
+
// SceneHierarchy
|
121
|
+
SET_SCENE: "ToolEvents::setScene",
|
122
|
+
GET_OBJECT: "ToolEvents::getObject",
|
123
|
+
SET_OBJECT: "ToolEvents::setObject",
|
124
|
+
UPDATE_OBJECT: "ToolEvents::updateObject",
|
125
|
+
CREATE_TEXTURE: "ToolEvents::createTexture",
|
126
|
+
REQUEST_METHOD: "ToolEvents::requestMethod",
|
127
|
+
// MultiView
|
128
|
+
ADD_CAMERA: "ToolEvents::addCamera",
|
129
|
+
REMOVE_CAMERA: "ToolEvents::removeCamera"
|
130
|
+
};
|
131
|
+
class Rt {
|
132
|
+
app;
|
133
|
+
constructor(n) {
|
134
|
+
this.app = n;
|
135
|
+
}
|
136
|
+
dispose() {
|
137
|
+
}
|
138
|
+
}
|
139
|
+
class Da extends Rt {
|
140
|
+
selectDropdown(n, a) {
|
141
|
+
this.app.send({
|
142
|
+
event: "selectComponent",
|
143
|
+
target: "app",
|
144
|
+
data: {
|
145
|
+
dropdown: n,
|
146
|
+
value: a
|
147
|
+
}
|
148
|
+
});
|
149
|
+
}
|
150
|
+
updateDropdown(n, a) {
|
151
|
+
this.app.send({
|
152
|
+
event: "draggableListUpdate",
|
153
|
+
target: "app",
|
154
|
+
data: {
|
155
|
+
dropdown: n,
|
156
|
+
value: a
|
157
|
+
}
|
158
|
+
});
|
159
|
+
}
|
160
|
+
}
|
161
|
+
function Ia(t, n) {
|
162
|
+
switch (n.event) {
|
163
|
+
case "selectComponent":
|
164
|
+
_.dispatchEvent({ type: j.SELECT_DROPDOWN, value: n.data });
|
165
|
+
break;
|
166
|
+
case "draggableListUpdate":
|
167
|
+
_.dispatchEvent({ type: j.DRAG_UPDATE, value: n.data });
|
168
|
+
break;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
const In = () => {
|
172
|
+
};
|
173
|
+
class Oe extends Rt {
|
174
|
+
project;
|
175
|
+
sheets = /* @__PURE__ */ new Map();
|
176
|
+
sheetObjects = /* @__PURE__ */ new Map();
|
177
|
+
sheetObjectCBs = /* @__PURE__ */ new Map();
|
178
|
+
sheetObjectUnsubscribe = /* @__PURE__ */ new Map();
|
179
|
+
static rafDriver = null;
|
180
|
+
init(n, a) {
|
181
|
+
return this.project = Sa(n, a), this.project.ready;
|
182
|
+
}
|
183
|
+
dispose() {
|
184
|
+
this.project = void 0, this.sheets = /* @__PURE__ */ new Map(), this.sheetObjects = /* @__PURE__ */ new Map(), this.sheetObjectCBs = /* @__PURE__ */ new Map(), this.sheetObjectUnsubscribe = /* @__PURE__ */ new Map();
|
185
|
+
}
|
186
|
+
sheet(n) {
|
187
|
+
if (this.project === void 0) {
|
188
|
+
console.error("Theatre Project hasn't been created yet.");
|
189
|
+
return;
|
190
|
+
}
|
191
|
+
let a = this.sheets.get(n);
|
192
|
+
return a !== void 0 || (a = this.project?.sheet(n), this.sheets.set(n, a)), a;
|
193
|
+
}
|
194
|
+
playSheet(n, a) {
|
195
|
+
this.sheet(n)?.sequence.play(a), this.app.send({
|
196
|
+
event: "playSheet",
|
197
|
+
target: "editor",
|
198
|
+
data: {
|
199
|
+
sheet: n,
|
200
|
+
value: a
|
201
|
+
}
|
202
|
+
});
|
203
|
+
}
|
204
|
+
pauseSheet(n) {
|
205
|
+
this.sheet(n)?.sequence.pause(), this.app.send({
|
206
|
+
event: "pauseSheet",
|
207
|
+
target: "editor",
|
208
|
+
data: {
|
209
|
+
sheet: n
|
210
|
+
}
|
211
|
+
});
|
212
|
+
}
|
213
|
+
clearSheetObjects(n) {
|
214
|
+
this.sheetObjects.forEach((a, e) => {
|
215
|
+
e.search(`${n}_`) > -1 && this.unsubscribe(a);
|
216
|
+
});
|
217
|
+
}
|
218
|
+
sheetObject(n, a, e, o) {
|
219
|
+
if (this.project === void 0) {
|
220
|
+
console.error("Theatre Project hasn't been created yet.");
|
221
|
+
return;
|
222
|
+
}
|
223
|
+
const s = this.sheet(n);
|
224
|
+
if (s === void 0)
|
225
|
+
return;
|
226
|
+
const p = `${n}_${a}`;
|
227
|
+
let c = this.sheetObjects.get(p);
|
228
|
+
c !== void 0 ? c = s.object(a, { ...e, ...c.value }, { reconfigure: !0 }) : c = s.object(a, e), this.sheetObjects.set(p, c), this.sheetObjectCBs.set(p, o !== void 0 ? o : In);
|
229
|
+
const u = c.onValuesChange((d) => {
|
230
|
+
if (this.app.editor) {
|
231
|
+
for (const b in d) {
|
232
|
+
const E = d[b];
|
233
|
+
typeof E == "object" && Aa(E) && (d[b] = {
|
234
|
+
r: E.r,
|
235
|
+
g: E.g,
|
236
|
+
b: E.b,
|
237
|
+
a: E.a
|
238
|
+
});
|
239
|
+
}
|
240
|
+
this.app.send({
|
241
|
+
event: "updateSheetObject",
|
242
|
+
target: "app",
|
243
|
+
data: {
|
244
|
+
sheet: n,
|
245
|
+
sheetObject: p,
|
246
|
+
values: d
|
247
|
+
}
|
248
|
+
});
|
249
|
+
}
|
250
|
+
const v = this.sheetObjectCBs.get(p);
|
251
|
+
v !== void 0 && v(d);
|
252
|
+
});
|
253
|
+
return this.sheetObjectUnsubscribe.set(p, u), c;
|
254
|
+
}
|
255
|
+
unsubscribe(n) {
|
256
|
+
if (this.project === void 0) {
|
257
|
+
console.error("Theatre Project hasn't been created yet.");
|
258
|
+
return;
|
259
|
+
}
|
260
|
+
const a = n.address.sheetId, e = n.address.objectKey;
|
261
|
+
this.sheets.get(a)?.detachObject(e);
|
262
|
+
const s = `${a}_${e}`, p = this.sheetObjectUnsubscribe.get(s);
|
263
|
+
p !== void 0 && (this.sheetObjects.delete(s), this.sheetObjectCBs.delete(s), this.sheetObjectUnsubscribe.delete(s), p());
|
264
|
+
}
|
265
|
+
static getRafDriver() {
|
266
|
+
return Oe.rafDriver || (Oe.rafDriver = wa()), Oe.rafDriver;
|
267
|
+
}
|
268
|
+
}
|
269
|
+
let we;
|
270
|
+
function La(t, n) {
|
271
|
+
t.components.forEach((a) => {
|
272
|
+
if (a instanceof Oe) {
|
273
|
+
let e;
|
274
|
+
const o = a;
|
275
|
+
switch (n.event) {
|
276
|
+
case "setSheet":
|
277
|
+
e = o.sheets.get(n.data.sheet), e !== void 0 && (we = e, ct.setSelection([e]));
|
278
|
+
break;
|
279
|
+
case "setSheetObject":
|
280
|
+
e = o.sheetObjects.get(`${n.data.sheet}_${n.data.key}`), e !== void 0 && ct.setSelection([e]);
|
281
|
+
break;
|
282
|
+
case "updateSheetObject":
|
283
|
+
e = o.sheets.get(n.data.sheet), e !== void 0 && e.sequence.pause(), e = o.sheetObjectCBs.get(n.data.sheetObject), e !== void 0 && e(n.data.values);
|
284
|
+
break;
|
285
|
+
case "updateTimeline":
|
286
|
+
e = o.sheets.get(n.data.sheet), we !== void 0 && (we.sequence.position = n.data.position);
|
287
|
+
break;
|
288
|
+
}
|
289
|
+
}
|
290
|
+
});
|
291
|
+
}
|
292
|
+
function Na(t) {
|
293
|
+
if (t.editor) {
|
294
|
+
let n;
|
295
|
+
t.components.forEach((s) => {
|
296
|
+
s instanceof Oe && (n = s);
|
297
|
+
}), ct.ui.restore(), ct.onSelectionChange((s) => {
|
298
|
+
s.length < 1 || s.forEach((p) => {
|
299
|
+
let c = p.address.sheetId, u = "setSheet", d = {};
|
300
|
+
switch (p.type) {
|
301
|
+
case "Theatre_Sheet_PublicAPI":
|
302
|
+
u = "setSheet", d = {
|
303
|
+
sheet: p.address.sheetId
|
304
|
+
}, we = n.sheets.get(p.address.sheetId);
|
305
|
+
break;
|
306
|
+
case "Theatre_SheetObject_PublicAPI":
|
307
|
+
u = "setSheetObject", c += `_${p.address.objectKey}`, d = {
|
308
|
+
id: c,
|
309
|
+
sheet: p.address.sheetId,
|
310
|
+
key: p.address.objectKey
|
311
|
+
};
|
312
|
+
break;
|
313
|
+
}
|
314
|
+
t.send({ event: u, target: "app", data: d });
|
315
|
+
});
|
316
|
+
});
|
317
|
+
let a = 0;
|
318
|
+
const e = () => {
|
319
|
+
if (we !== void 0 && a !== we.sequence.position) {
|
320
|
+
a = we.sequence.position;
|
321
|
+
const s = we;
|
322
|
+
t.send({
|
323
|
+
event: "updateTimeline",
|
324
|
+
target: "app",
|
325
|
+
data: {
|
326
|
+
position: a,
|
327
|
+
sheet: s.address.sheetId
|
328
|
+
}
|
329
|
+
});
|
330
|
+
}
|
331
|
+
}, o = () => {
|
332
|
+
e(), requestAnimationFrame(o);
|
333
|
+
};
|
334
|
+
e(), o();
|
335
|
+
} else
|
336
|
+
ct.ui.hide();
|
337
|
+
}
|
338
|
+
function Fa(t, n) {
|
339
|
+
t.editor && t.components.forEach((a) => {
|
340
|
+
if (a instanceof Oe) {
|
341
|
+
const e = a;
|
342
|
+
switch (n.event) {
|
343
|
+
case "playSheet":
|
344
|
+
e.sheet(n.data.sheet)?.sequence.play(n.data.value);
|
345
|
+
break;
|
346
|
+
case "pauseSheet":
|
347
|
+
e.sheet(n.data.sheet)?.sequence.pause();
|
348
|
+
break;
|
349
|
+
}
|
350
|
+
return;
|
351
|
+
}
|
352
|
+
});
|
353
|
+
}
|
354
|
+
function Ba(t) {
|
355
|
+
if (t.name === "cameras")
|
356
|
+
return "camera";
|
357
|
+
if (t.name === "interactive")
|
358
|
+
return "interactive";
|
359
|
+
if (t.name === "lights")
|
360
|
+
return "light";
|
361
|
+
if (t.name === "ui")
|
362
|
+
return "ui";
|
363
|
+
if (t.name === "utils")
|
364
|
+
return "utils";
|
365
|
+
const n = t.type;
|
366
|
+
return n.search("Helper") > -1 ? "icon_utils" : n.search("Camera") > -1 ? "camera" : n.search("Light") > -1 ? "light" : "obj3D";
|
367
|
+
}
|
368
|
+
function Ln(t) {
|
369
|
+
const n = {
|
370
|
+
name: t.name,
|
371
|
+
type: t.type,
|
372
|
+
uuid: t.uuid,
|
373
|
+
children: []
|
374
|
+
};
|
375
|
+
return t.children.forEach((a) => {
|
376
|
+
n.children.push(Ln(a));
|
377
|
+
}), n;
|
378
|
+
}
|
379
|
+
function Ua(t) {
|
380
|
+
const n = {};
|
381
|
+
for (const a in t) {
|
382
|
+
const e = t[a].value;
|
383
|
+
n[a] = { value: e }, e === null ? n[a].value = { src: "" } : e.isTexture && (n[a].value = { src: e.image.src });
|
384
|
+
}
|
385
|
+
return n;
|
386
|
+
}
|
387
|
+
function $a(t) {
|
388
|
+
switch (t) {
|
389
|
+
case "blendSrcAlpha":
|
390
|
+
case "blendDstAlpha":
|
391
|
+
case "blendEquationAlpha":
|
392
|
+
case "clippingPlanes":
|
393
|
+
case "shadowSide":
|
394
|
+
case "precision":
|
395
|
+
return !0;
|
396
|
+
}
|
397
|
+
return !1;
|
398
|
+
}
|
399
|
+
function qe(t) {
|
400
|
+
const n = {};
|
401
|
+
for (const a in t) {
|
402
|
+
if (a.substring(0, 1) === "_" || a.substring(0, 2) === "is" || $a(a))
|
403
|
+
continue;
|
404
|
+
const e = typeof t[a], o = t[a];
|
405
|
+
switch (e) {
|
406
|
+
case "boolean":
|
407
|
+
case "number":
|
408
|
+
case "string":
|
409
|
+
n[a] = o;
|
410
|
+
break;
|
411
|
+
case "object":
|
412
|
+
if (o !== null)
|
413
|
+
if (n[a] = o, o.isTexture)
|
414
|
+
if (o instanceof dn) {
|
415
|
+
const s = o.source.toJSON();
|
416
|
+
n[a] = { src: s.url };
|
417
|
+
} else
|
418
|
+
o instanceof Wn && (console.log("env map"), console.log(o.source.data), console.log(o.source.toJSON()), n[a] = { src: "" });
|
419
|
+
else
|
420
|
+
a === "uniforms" && (n[a] = Ua(n[a]));
|
421
|
+
else
|
422
|
+
n[a] = { src: "" };
|
423
|
+
break;
|
424
|
+
}
|
425
|
+
}
|
426
|
+
return n;
|
427
|
+
}
|
428
|
+
function Bt(t) {
|
429
|
+
t.updateMatrix();
|
430
|
+
const n = {
|
431
|
+
name: t.name,
|
432
|
+
type: t.type,
|
433
|
+
uuid: t.uuid,
|
434
|
+
visible: t.visible,
|
435
|
+
matrix: t.matrix.elements,
|
436
|
+
animations: [],
|
437
|
+
material: void 0,
|
438
|
+
perspectiveCameraInfo: void 0,
|
439
|
+
orthographicCameraInfo: void 0,
|
440
|
+
lightInfo: void 0
|
441
|
+
};
|
442
|
+
t.animations.forEach((e) => {
|
443
|
+
n.animations.push({
|
444
|
+
name: e.name,
|
445
|
+
duration: e.duration,
|
446
|
+
blendMode: e.blendMode
|
447
|
+
});
|
448
|
+
});
|
449
|
+
const a = t.type.toLowerCase();
|
450
|
+
if (a.search("mesh") > -1) {
|
451
|
+
const e = t;
|
452
|
+
if (Array.isArray(e.material)) {
|
453
|
+
const o = [];
|
454
|
+
e.material.forEach((s) => {
|
455
|
+
o.push(qe(s));
|
456
|
+
}), n.material = o;
|
457
|
+
} else
|
458
|
+
n.material = qe(e.material);
|
459
|
+
} else if (a.search("points") > -1) {
|
460
|
+
const e = t;
|
461
|
+
if (Array.isArray(e.material)) {
|
462
|
+
const o = [];
|
463
|
+
e.material.forEach((s) => {
|
464
|
+
o.push(qe(s));
|
465
|
+
}), n.material = o;
|
466
|
+
} else
|
467
|
+
n.material = qe(e.material);
|
468
|
+
} else if (a.search("line") > -1) {
|
469
|
+
const e = t;
|
470
|
+
if (Array.isArray(e.material)) {
|
471
|
+
const o = [];
|
472
|
+
e.material.forEach((s) => {
|
473
|
+
o.push(qe(s));
|
474
|
+
}), n.material = o;
|
475
|
+
} else
|
476
|
+
n.material = qe(e.material);
|
477
|
+
} else
|
478
|
+
a.search("camera") > -1 ? t.type === "PerspectiveCamera" ? n.perspectiveCameraInfo = {
|
479
|
+
fov: t.fov,
|
480
|
+
zoom: t.zoom,
|
481
|
+
near: t.near,
|
482
|
+
far: t.far,
|
483
|
+
focus: t.focus,
|
484
|
+
aspect: t.aspect,
|
485
|
+
filmGauge: t.filmGauge,
|
486
|
+
filmOffset: t.filmOffset
|
487
|
+
} : t.type === "OrthographicCamera" && (n.orthographicCameraInfo = {
|
488
|
+
zoom: t.zoom,
|
489
|
+
near: t.near,
|
490
|
+
far: t.far,
|
491
|
+
left: t.left,
|
492
|
+
right: t.right,
|
493
|
+
top: t.top,
|
494
|
+
bottom: t.bottom
|
495
|
+
}) : a.search("light") > -1 && (n.lightInfo = {
|
496
|
+
color: t.color,
|
497
|
+
intensity: t.intensity,
|
498
|
+
decay: t.decay,
|
499
|
+
distance: t.distance,
|
500
|
+
angle: t.angle,
|
501
|
+
penumbra: t.penumbra,
|
502
|
+
groundColor: t.groundColor
|
503
|
+
});
|
504
|
+
return n;
|
505
|
+
}
|
506
|
+
function za(t, n) {
|
507
|
+
const a = n.split(".");
|
508
|
+
switch (a.length) {
|
509
|
+
case 1:
|
510
|
+
return t[a[0]];
|
511
|
+
case 2:
|
512
|
+
return t[a[0]][a[1]];
|
513
|
+
case 3:
|
514
|
+
return t[a[0]][a[1]][a[2]];
|
515
|
+
case 4:
|
516
|
+
return t[a[0]][a[1]][a[2]][a[3]];
|
517
|
+
case 5:
|
518
|
+
return t[a[0]][a[1]][a[2]][a[3]][a[4]];
|
519
|
+
case 6:
|
520
|
+
return t[a[0]][a[1]][a[2]][a[3]][a[4]][a[5]];
|
521
|
+
}
|
522
|
+
}
|
523
|
+
function ee(t, n, a) {
|
524
|
+
const e = n.split(".");
|
525
|
+
switch (e.length) {
|
526
|
+
case 1:
|
527
|
+
t[e[0]] = a;
|
528
|
+
break;
|
529
|
+
case 2:
|
530
|
+
t[e[0]][e[1]] = a;
|
531
|
+
break;
|
532
|
+
case 3:
|
533
|
+
t[e[0]][e[1]][e[2]] = a;
|
534
|
+
break;
|
535
|
+
case 4:
|
536
|
+
t[e[0]][e[1]][e[2]][e[3]] = a;
|
537
|
+
break;
|
538
|
+
case 5:
|
539
|
+
t[e[0]][e[1]][e[2]][e[3]][e[4]] = a;
|
540
|
+
break;
|
541
|
+
}
|
542
|
+
}
|
543
|
+
function Gt(t) {
|
544
|
+
return new Promise((n, a) => {
|
545
|
+
const e = new Image();
|
546
|
+
e.onload = () => {
|
547
|
+
const o = new dn(e);
|
548
|
+
o.wrapS = Kt, o.wrapT = Kt, o.needsUpdate = !0, n(o);
|
549
|
+
}, e.onerror = a, e.src = t;
|
550
|
+
});
|
551
|
+
}
|
552
|
+
class Ya extends Rt {
|
553
|
+
scene = void 0;
|
554
|
+
getObject(n) {
|
555
|
+
this.app.debugEnabled && this.app.send({
|
556
|
+
event: "getObject",
|
557
|
+
target: "app",
|
558
|
+
data: n
|
559
|
+
});
|
560
|
+
}
|
561
|
+
setObject(n) {
|
562
|
+
const a = Bt(n);
|
563
|
+
this.app.send({
|
564
|
+
event: "setObject",
|
565
|
+
target: "editor",
|
566
|
+
data: a
|
567
|
+
});
|
568
|
+
}
|
569
|
+
requestMethod(n, a, e, o) {
|
570
|
+
this.app.send({
|
571
|
+
event: "requestMethod",
|
572
|
+
target: "app",
|
573
|
+
data: {
|
574
|
+
uuid: n,
|
575
|
+
key: a,
|
576
|
+
value: e,
|
577
|
+
subitem: o
|
578
|
+
}
|
579
|
+
});
|
580
|
+
}
|
581
|
+
updateObject(n, a, e) {
|
582
|
+
this.app.send({
|
583
|
+
event: "updateObject",
|
584
|
+
target: "app",
|
585
|
+
data: {
|
586
|
+
uuid: n,
|
587
|
+
key: a,
|
588
|
+
value: e
|
589
|
+
}
|
590
|
+
});
|
591
|
+
}
|
592
|
+
createTexture(n, a, e) {
|
593
|
+
this.app.send({
|
594
|
+
event: "createTexture",
|
595
|
+
target: "app",
|
596
|
+
data: {
|
597
|
+
uuid: n,
|
598
|
+
key: a,
|
599
|
+
value: e
|
600
|
+
}
|
601
|
+
});
|
602
|
+
}
|
603
|
+
setScene(n) {
|
604
|
+
if (n === void 0 || (this.scene = n, !this.app.debugEnabled))
|
605
|
+
return;
|
606
|
+
_a(), jn(this.scene);
|
607
|
+
const a = Ln(this.scene);
|
608
|
+
this.app.send({
|
609
|
+
event: "setScene",
|
610
|
+
target: "editor",
|
611
|
+
data: a
|
612
|
+
});
|
613
|
+
}
|
614
|
+
addCamera(n) {
|
615
|
+
if (!this.app.debugEnabled)
|
616
|
+
return;
|
617
|
+
const a = Bt(n);
|
618
|
+
this.app.send({
|
619
|
+
event: "addCamera",
|
620
|
+
target: "editor",
|
621
|
+
data: a
|
622
|
+
});
|
623
|
+
}
|
624
|
+
removeCamera(n) {
|
625
|
+
if (!this.app.debugEnabled)
|
626
|
+
return;
|
627
|
+
const a = Bt(n);
|
628
|
+
this.app.send({
|
629
|
+
event: "removeCamera",
|
630
|
+
target: "editor",
|
631
|
+
data: a
|
632
|
+
});
|
633
|
+
}
|
634
|
+
}
|
635
|
+
function Ga(t, n) {
|
636
|
+
switch (n.event) {
|
637
|
+
case "getObject":
|
638
|
+
_.dispatchEvent({ type: j.GET_OBJECT, value: n.data });
|
639
|
+
break;
|
640
|
+
case "updateObject":
|
641
|
+
_.dispatchEvent({ type: j.UPDATE_OBJECT, value: n.data });
|
642
|
+
break;
|
643
|
+
case "createTexture":
|
644
|
+
_.dispatchEvent({ type: j.CREATE_TEXTURE, value: n.data });
|
645
|
+
break;
|
646
|
+
case "requestMethod":
|
647
|
+
_.dispatchEvent({ type: j.REQUEST_METHOD, value: n.data });
|
648
|
+
break;
|
649
|
+
}
|
650
|
+
}
|
651
|
+
function Va(t, n) {
|
652
|
+
switch (n.event) {
|
653
|
+
case "setObject":
|
654
|
+
_.dispatchEvent({ type: j.SET_OBJECT, value: n.data });
|
655
|
+
break;
|
656
|
+
case "setScene":
|
657
|
+
_.dispatchEvent({ type: j.SET_SCENE, value: n.data });
|
658
|
+
break;
|
659
|
+
case "addCamera":
|
660
|
+
_.dispatchEvent({ type: j.ADD_CAMERA, value: n.data });
|
661
|
+
break;
|
662
|
+
case "removeCamera":
|
663
|
+
_.dispatchEvent({ type: j.REMOVE_CAMERA, value: n.data });
|
664
|
+
break;
|
665
|
+
}
|
666
|
+
}
|
667
|
+
class Nn extends Rt {
|
668
|
+
bindCBs;
|
669
|
+
buttonCBs;
|
670
|
+
pane = void 0;
|
671
|
+
appCallbacks = 0;
|
672
|
+
editorCallbacks = 0;
|
673
|
+
inspectorFolder = void 0;
|
674
|
+
constructor(n) {
|
675
|
+
super(n), this.bindCBs = /* @__PURE__ */ new Map(), this.buttonCBs = /* @__PURE__ */ new Map(), n.editor && this.createGUI();
|
676
|
+
}
|
677
|
+
createGUI() {
|
678
|
+
this.pane = new Oa({ title: "GUI" }), this.pane.registerPlugin(Ma);
|
679
|
+
}
|
680
|
+
dispose() {
|
681
|
+
this.bindCBs.clear(), this.buttonCBs.clear(), this.appCallbacks = 0, this.editorCallbacks = 0, this.app.editor && (this.pane?.dispose(), this.pane = void 0);
|
682
|
+
}
|
683
|
+
addFolder(n, a = void 0, e = void 0) {
|
684
|
+
if (this.app.editor)
|
685
|
+
return this.pane === void 0 && this.createGUI(), (e !== void 0 ? e : this.pane).addFolder({
|
686
|
+
title: n,
|
687
|
+
...a
|
688
|
+
});
|
689
|
+
this.app.send({
|
690
|
+
event: "addFolder",
|
691
|
+
target: "app",
|
692
|
+
data: {
|
693
|
+
name: n,
|
694
|
+
params: a,
|
695
|
+
parent: e
|
696
|
+
}
|
697
|
+
});
|
698
|
+
}
|
699
|
+
get bindID() {
|
700
|
+
return `debug_${Math.max(this.appCallbacks, this.editorCallbacks)}`;
|
701
|
+
}
|
702
|
+
// Binding
|
703
|
+
bind(n, a, e, o = void 0) {
|
704
|
+
const s = this.bindID, p = e.onChange !== void 0 ? e.onChange : In;
|
705
|
+
this.bindCBs.set(s, p), this.app.editor ? (this.pane === void 0 && this.createGUI(), (o !== void 0 ? o : this.pane).addBinding(n, a, e).on("change", (u) => {
|
706
|
+
this.app.send({
|
707
|
+
event: "updateBind",
|
708
|
+
target: "app",
|
709
|
+
data: {
|
710
|
+
id: s,
|
711
|
+
value: u.value
|
712
|
+
}
|
713
|
+
});
|
714
|
+
}), this.editorCallbacks++) : (this.app.send({
|
715
|
+
event: "bindObject",
|
716
|
+
target: "app",
|
717
|
+
data: {
|
718
|
+
id: s,
|
719
|
+
name: a,
|
720
|
+
params: e,
|
721
|
+
parent: o
|
722
|
+
}
|
723
|
+
}), this.appCallbacks++);
|
724
|
+
}
|
725
|
+
triggerBind(n, a) {
|
726
|
+
const e = this.bindCBs.get(n);
|
727
|
+
e !== void 0 ? e(a) : console.warn(`No callback for: ${n}`, a);
|
728
|
+
}
|
729
|
+
// Buttons
|
730
|
+
button(n, a, e = void 0) {
|
731
|
+
const o = this.bindID;
|
732
|
+
this.buttonCBs.set(o, a), this.app.editor ? (this.pane === void 0 && this.createGUI(), (e !== void 0 ? e : this.pane).addButton({ title: n }).on("click", () => {
|
733
|
+
this.app.send({
|
734
|
+
event: "clickButton",
|
735
|
+
target: "app",
|
736
|
+
data: {
|
737
|
+
id: o
|
738
|
+
}
|
739
|
+
});
|
740
|
+
}), this.editorCallbacks++) : (this.app.send({
|
741
|
+
event: "addButton",
|
742
|
+
target: "app",
|
743
|
+
data: {
|
744
|
+
id: o,
|
745
|
+
name: n,
|
746
|
+
callback: a,
|
747
|
+
parent: e
|
748
|
+
}
|
749
|
+
}), this.appCallbacks++);
|
750
|
+
}
|
751
|
+
triggerButton(n) {
|
752
|
+
const a = this.buttonCBs.get(n);
|
753
|
+
a !== void 0 && a();
|
754
|
+
}
|
755
|
+
// Inspector
|
756
|
+
createInspector() {
|
757
|
+
this.inspectorFolder = this.addFolder("Inspector", this.pane);
|
758
|
+
}
|
759
|
+
clearInspector() {
|
760
|
+
const n = this.inspectorFolder.children.length - 1;
|
761
|
+
for (let a = n; a > -1; --a)
|
762
|
+
this.inspectorFolder.remove(this.inspectorFolder.children[a]);
|
763
|
+
}
|
764
|
+
}
|
765
|
+
function Ha(t, n) {
|
766
|
+
t.components.forEach((a) => {
|
767
|
+
if (a instanceof Nn) {
|
768
|
+
const e = a;
|
769
|
+
switch (n.event) {
|
770
|
+
case "addFolder":
|
771
|
+
e.addFolder(n.data.name, n.data.params, n.data.parent);
|
772
|
+
break;
|
773
|
+
case "bindObject":
|
774
|
+
e.bind(n.data.name, n.data.params, n.data.parent);
|
775
|
+
break;
|
776
|
+
case "updateBind":
|
777
|
+
e.triggerBind(n.data.id, n.data.value);
|
778
|
+
break;
|
779
|
+
case "addButton":
|
780
|
+
e.button(n.data.name, n.data.callback, n.data.parent);
|
781
|
+
break;
|
782
|
+
case "clickButton":
|
783
|
+
e.triggerButton(n.data.id);
|
784
|
+
break;
|
785
|
+
}
|
786
|
+
return;
|
787
|
+
}
|
788
|
+
});
|
789
|
+
}
|
790
|
+
var Vt = { exports: {} }, it = {};
|
791
|
+
/**
|
792
|
+
* @license React
|
793
|
+
* react-jsx-runtime.production.min.js
|
794
|
+
*
|
795
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
796
|
+
*
|
797
|
+
* This source code is licensed under the MIT license found in the
|
798
|
+
* LICENSE file in the root directory of this source tree.
|
799
|
+
*/
|
800
|
+
var Jt;
|
801
|
+
function Wa() {
|
802
|
+
if (Jt)
|
803
|
+
return it;
|
804
|
+
Jt = 1;
|
805
|
+
var t = kn, n = Symbol.for("react.element"), a = Symbol.for("react.fragment"), e = Object.prototype.hasOwnProperty, o = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
806
|
+
function p(c, u, d) {
|
807
|
+
var v, b = {}, E = null, x = null;
|
808
|
+
d !== void 0 && (E = "" + d), u.key !== void 0 && (E = "" + u.key), u.ref !== void 0 && (x = u.ref);
|
809
|
+
for (v in u)
|
810
|
+
e.call(u, v) && !s.hasOwnProperty(v) && (b[v] = u[v]);
|
811
|
+
if (c && c.defaultProps)
|
812
|
+
for (v in u = c.defaultProps, u)
|
813
|
+
b[v] === void 0 && (b[v] = u[v]);
|
814
|
+
return { $$typeof: n, type: c, key: E, ref: x, props: b, _owner: o.current };
|
815
|
+
}
|
816
|
+
return it.Fragment = a, it.jsx = p, it.jsxs = p, it;
|
817
|
+
}
|
818
|
+
var rt = {};
|
819
|
+
/**
|
820
|
+
* @license React
|
821
|
+
* react-jsx-runtime.development.js
|
822
|
+
*
|
823
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
824
|
+
*
|
825
|
+
* This source code is licensed under the MIT license found in the
|
826
|
+
* LICENSE file in the root directory of this source tree.
|
827
|
+
*/
|
828
|
+
var Qt;
|
829
|
+
function qa() {
|
830
|
+
return Qt || (Qt = 1, process.env.NODE_ENV !== "production" && function() {
|
831
|
+
var t = kn, n = Symbol.for("react.element"), a = Symbol.for("react.portal"), e = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), p = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), M = Symbol.iterator, k = "@@iterator";
|
832
|
+
function H(i) {
|
833
|
+
if (i === null || typeof i != "object")
|
834
|
+
return null;
|
835
|
+
var h = M && i[M] || i[k];
|
836
|
+
return typeof h == "function" ? h : null;
|
837
|
+
}
|
838
|
+
var B = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
839
|
+
function S(i) {
|
840
|
+
{
|
841
|
+
for (var h = arguments.length, g = new Array(h > 1 ? h - 1 : 0), C = 1; C < h; C++)
|
842
|
+
g[C - 1] = arguments[C];
|
843
|
+
z("error", i, g);
|
844
|
+
}
|
845
|
+
}
|
846
|
+
function z(i, h, g) {
|
847
|
+
{
|
848
|
+
var C = B.ReactDebugCurrentFrame, D = C.getStackAddendum();
|
849
|
+
D !== "" && (h += "%s", g = g.concat([D]));
|
850
|
+
var F = g.map(function(A) {
|
851
|
+
return String(A);
|
852
|
+
});
|
853
|
+
F.unshift("Warning: " + h), Function.prototype.apply.call(console[i], console, F);
|
854
|
+
}
|
855
|
+
}
|
856
|
+
var Ee = !1, le = !1, se = !1, f = !1, m = !1, w;
|
857
|
+
w = Symbol.for("react.module.reference");
|
858
|
+
function P(i) {
|
859
|
+
return !!(typeof i == "string" || typeof i == "function" || i === e || i === s || m || i === o || i === d || i === v || f || i === x || Ee || le || se || typeof i == "object" && i !== null && (i.$$typeof === E || i.$$typeof === b || i.$$typeof === p || i.$$typeof === c || i.$$typeof === u || // This needs to include all possible module reference object
|
860
|
+
// types supported by any Flight configuration anywhere since
|
861
|
+
// we don't know which Flight build this will end up being used
|
862
|
+
// with.
|
863
|
+
i.$$typeof === w || i.getModuleId !== void 0));
|
864
|
+
}
|
865
|
+
function Y(i, h, g) {
|
866
|
+
var C = i.displayName;
|
867
|
+
if (C)
|
868
|
+
return C;
|
869
|
+
var D = h.displayName || h.name || "";
|
870
|
+
return D !== "" ? g + "(" + D + ")" : g;
|
871
|
+
}
|
872
|
+
function U(i) {
|
873
|
+
return i.displayName || "Context";
|
874
|
+
}
|
875
|
+
function $(i) {
|
876
|
+
if (i == null)
|
877
|
+
return null;
|
878
|
+
if (typeof i.tag == "number" && S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof i == "function")
|
879
|
+
return i.displayName || i.name || null;
|
880
|
+
if (typeof i == "string")
|
881
|
+
return i;
|
882
|
+
switch (i) {
|
883
|
+
case e:
|
884
|
+
return "Fragment";
|
885
|
+
case a:
|
886
|
+
return "Portal";
|
887
|
+
case s:
|
888
|
+
return "Profiler";
|
889
|
+
case o:
|
890
|
+
return "StrictMode";
|
891
|
+
case d:
|
892
|
+
return "Suspense";
|
893
|
+
case v:
|
894
|
+
return "SuspenseList";
|
895
|
+
}
|
896
|
+
if (typeof i == "object")
|
897
|
+
switch (i.$$typeof) {
|
898
|
+
case c:
|
899
|
+
var h = i;
|
900
|
+
return U(h) + ".Consumer";
|
901
|
+
case p:
|
902
|
+
var g = i;
|
903
|
+
return U(g._context) + ".Provider";
|
904
|
+
case u:
|
905
|
+
return Y(i, i.render, "ForwardRef");
|
906
|
+
case b:
|
907
|
+
var C = i.displayName || null;
|
908
|
+
return C !== null ? C : $(i.type) || "Memo";
|
909
|
+
case E: {
|
910
|
+
var D = i, F = D._payload, A = D._init;
|
911
|
+
try {
|
912
|
+
return $(A(F));
|
913
|
+
} catch {
|
914
|
+
return null;
|
915
|
+
}
|
916
|
+
}
|
917
|
+
}
|
918
|
+
return null;
|
919
|
+
}
|
920
|
+
var I = Object.assign, W = 0, q, T, N, J, me, Ce, ft;
|
921
|
+
function Xe() {
|
922
|
+
}
|
923
|
+
Xe.__reactDisabledLog = !0;
|
924
|
+
function At() {
|
925
|
+
{
|
926
|
+
if (W === 0) {
|
927
|
+
q = console.log, T = console.info, N = console.warn, J = console.error, me = console.group, Ce = console.groupCollapsed, ft = console.groupEnd;
|
928
|
+
var i = {
|
929
|
+
configurable: !0,
|
930
|
+
enumerable: !0,
|
931
|
+
value: Xe,
|
932
|
+
writable: !0
|
933
|
+
};
|
934
|
+
Object.defineProperties(console, {
|
935
|
+
info: i,
|
936
|
+
log: i,
|
937
|
+
warn: i,
|
938
|
+
error: i,
|
939
|
+
group: i,
|
940
|
+
groupCollapsed: i,
|
941
|
+
groupEnd: i
|
942
|
+
});
|
943
|
+
}
|
944
|
+
W++;
|
945
|
+
}
|
946
|
+
}
|
947
|
+
function kt() {
|
948
|
+
{
|
949
|
+
if (W--, W === 0) {
|
950
|
+
var i = {
|
951
|
+
configurable: !0,
|
952
|
+
enumerable: !0,
|
953
|
+
writable: !0
|
954
|
+
};
|
955
|
+
Object.defineProperties(console, {
|
956
|
+
log: I({}, i, {
|
957
|
+
value: q
|
958
|
+
}),
|
959
|
+
info: I({}, i, {
|
960
|
+
value: T
|
961
|
+
}),
|
962
|
+
warn: I({}, i, {
|
963
|
+
value: N
|
964
|
+
}),
|
965
|
+
error: I({}, i, {
|
966
|
+
value: J
|
967
|
+
}),
|
968
|
+
group: I({}, i, {
|
969
|
+
value: me
|
970
|
+
}),
|
971
|
+
groupCollapsed: I({}, i, {
|
972
|
+
value: Ce
|
973
|
+
}),
|
974
|
+
groupEnd: I({}, i, {
|
975
|
+
value: ft
|
976
|
+
})
|
977
|
+
});
|
978
|
+
}
|
979
|
+
W < 0 && S("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
980
|
+
}
|
981
|
+
}
|
982
|
+
var Ze = B.ReactCurrentDispatcher, Je;
|
983
|
+
function ze(i, h, g) {
|
984
|
+
{
|
985
|
+
if (Je === void 0)
|
986
|
+
try {
|
987
|
+
throw Error();
|
988
|
+
} catch (D) {
|
989
|
+
var C = D.stack.trim().match(/\n( *(at )?)/);
|
990
|
+
Je = C && C[1] || "";
|
991
|
+
}
|
992
|
+
return `
|
993
|
+
` + Je + i;
|
994
|
+
}
|
995
|
+
}
|
996
|
+
var Ye = !1, Me;
|
997
|
+
{
|
998
|
+
var ht = typeof WeakMap == "function" ? WeakMap : Map;
|
999
|
+
Me = new ht();
|
1000
|
+
}
|
1001
|
+
function pt(i, h) {
|
1002
|
+
if (!i || Ye)
|
1003
|
+
return "";
|
1004
|
+
{
|
1005
|
+
var g = Me.get(i);
|
1006
|
+
if (g !== void 0)
|
1007
|
+
return g;
|
1008
|
+
}
|
1009
|
+
var C;
|
1010
|
+
Ye = !0;
|
1011
|
+
var D = Error.prepareStackTrace;
|
1012
|
+
Error.prepareStackTrace = void 0;
|
1013
|
+
var F;
|
1014
|
+
F = Ze.current, Ze.current = null, At();
|
1015
|
+
try {
|
1016
|
+
if (h) {
|
1017
|
+
var A = function() {
|
1018
|
+
throw Error();
|
1019
|
+
};
|
1020
|
+
if (Object.defineProperty(A.prototype, "props", {
|
1021
|
+
set: function() {
|
1022
|
+
throw Error();
|
1023
|
+
}
|
1024
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
1025
|
+
try {
|
1026
|
+
Reflect.construct(A, []);
|
1027
|
+
} catch (ve) {
|
1028
|
+
C = ve;
|
1029
|
+
}
|
1030
|
+
Reflect.construct(i, [], A);
|
1031
|
+
} else {
|
1032
|
+
try {
|
1033
|
+
A.call();
|
1034
|
+
} catch (ve) {
|
1035
|
+
C = ve;
|
1036
|
+
}
|
1037
|
+
i.call(A.prototype);
|
1038
|
+
}
|
1039
|
+
} else {
|
1040
|
+
try {
|
1041
|
+
throw Error();
|
1042
|
+
} catch (ve) {
|
1043
|
+
C = ve;
|
1044
|
+
}
|
1045
|
+
i();
|
1046
|
+
}
|
1047
|
+
} catch (ve) {
|
1048
|
+
if (ve && C && typeof ve.stack == "string") {
|
1049
|
+
for (var R = ve.stack.split(`
|
1050
|
+
`), ce = C.stack.split(`
|
1051
|
+
`), Z = R.length - 1, Q = ce.length - 1; Z >= 1 && Q >= 0 && R[Z] !== ce[Q]; )
|
1052
|
+
Q--;
|
1053
|
+
for (; Z >= 1 && Q >= 0; Z--, Q--)
|
1054
|
+
if (R[Z] !== ce[Q]) {
|
1055
|
+
if (Z !== 1 || Q !== 1)
|
1056
|
+
do
|
1057
|
+
if (Z--, Q--, Q < 0 || R[Z] !== ce[Q]) {
|
1058
|
+
var he = `
|
1059
|
+
` + R[Z].replace(" at new ", " at ");
|
1060
|
+
return i.displayName && he.includes("<anonymous>") && (he = he.replace("<anonymous>", i.displayName)), typeof i == "function" && Me.set(i, he), he;
|
1061
|
+
}
|
1062
|
+
while (Z >= 1 && Q >= 0);
|
1063
|
+
break;
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
} finally {
|
1067
|
+
Ye = !1, Ze.current = F, kt(), Error.prepareStackTrace = D;
|
1068
|
+
}
|
1069
|
+
var Ve = i ? i.displayName || i.name : "", qt = Ve ? ze(Ve) : "";
|
1070
|
+
return typeof i == "function" && Me.set(i, qt), qt;
|
1071
|
+
}
|
1072
|
+
function _t(i, h, g) {
|
1073
|
+
return pt(i, !1);
|
1074
|
+
}
|
1075
|
+
function mt(i) {
|
1076
|
+
var h = i.prototype;
|
1077
|
+
return !!(h && h.isReactComponent);
|
1078
|
+
}
|
1079
|
+
function Te(i, h, g) {
|
1080
|
+
if (i == null)
|
1081
|
+
return "";
|
1082
|
+
if (typeof i == "function")
|
1083
|
+
return pt(i, mt(i));
|
1084
|
+
if (typeof i == "string")
|
1085
|
+
return ze(i);
|
1086
|
+
switch (i) {
|
1087
|
+
case d:
|
1088
|
+
return ze("Suspense");
|
1089
|
+
case v:
|
1090
|
+
return ze("SuspenseList");
|
1091
|
+
}
|
1092
|
+
if (typeof i == "object")
|
1093
|
+
switch (i.$$typeof) {
|
1094
|
+
case u:
|
1095
|
+
return _t(i.render);
|
1096
|
+
case b:
|
1097
|
+
return Te(i.type, h, g);
|
1098
|
+
case E: {
|
1099
|
+
var C = i, D = C._payload, F = C._init;
|
1100
|
+
try {
|
1101
|
+
return Te(F(D), h, g);
|
1102
|
+
} catch {
|
1103
|
+
}
|
1104
|
+
}
|
1105
|
+
}
|
1106
|
+
return "";
|
1107
|
+
}
|
1108
|
+
var Re = Object.prototype.hasOwnProperty, vt = {}, gt = B.ReactDebugCurrentFrame;
|
1109
|
+
function Pe(i) {
|
1110
|
+
if (i) {
|
1111
|
+
var h = i._owner, g = Te(i.type, i._source, h ? h.type : null);
|
1112
|
+
gt.setExtraStackFrame(g);
|
1113
|
+
} else
|
1114
|
+
gt.setExtraStackFrame(null);
|
1115
|
+
}
|
1116
|
+
function Qe(i, h, g, C, D) {
|
1117
|
+
{
|
1118
|
+
var F = Function.call.bind(Re);
|
1119
|
+
for (var A in i)
|
1120
|
+
if (F(i, A)) {
|
1121
|
+
var R = void 0;
|
1122
|
+
try {
|
1123
|
+
if (typeof i[A] != "function") {
|
1124
|
+
var ce = Error((C || "React class") + ": " + g + " type `" + A + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof i[A] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
1125
|
+
throw ce.name = "Invariant Violation", ce;
|
1126
|
+
}
|
1127
|
+
R = i[A](h, A, C, g, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
1128
|
+
} catch (Z) {
|
1129
|
+
R = Z;
|
1130
|
+
}
|
1131
|
+
R && !(R instanceof Error) && (Pe(D), S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", C || "React class", g, A, typeof R), Pe(null)), R instanceof Error && !(R.message in vt) && (vt[R.message] = !0, Pe(D), S("Failed %s type: %s", g, R.message), Pe(null));
|
1132
|
+
}
|
1133
|
+
}
|
1134
|
+
}
|
1135
|
+
var Ae = Array.isArray;
|
1136
|
+
function et(i) {
|
1137
|
+
return Ae(i);
|
1138
|
+
}
|
1139
|
+
function jt(i) {
|
1140
|
+
{
|
1141
|
+
var h = typeof Symbol == "function" && Symbol.toStringTag, g = h && i[Symbol.toStringTag] || i.constructor.name || "Object";
|
1142
|
+
return g;
|
1143
|
+
}
|
1144
|
+
}
|
1145
|
+
function bt(i) {
|
1146
|
+
try {
|
1147
|
+
return yt(i), !1;
|
1148
|
+
} catch {
|
1149
|
+
return !0;
|
1150
|
+
}
|
1151
|
+
}
|
1152
|
+
function yt(i) {
|
1153
|
+
return "" + i;
|
1154
|
+
}
|
1155
|
+
function Et(i) {
|
1156
|
+
if (bt(i))
|
1157
|
+
return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", jt(i)), yt(i);
|
1158
|
+
}
|
1159
|
+
var xe = B.ReactCurrentOwner, tt = {
|
1160
|
+
key: !0,
|
1161
|
+
ref: !0,
|
1162
|
+
__self: !0,
|
1163
|
+
__source: !0
|
1164
|
+
}, nt, Ct, Ge;
|
1165
|
+
Ge = {};
|
1166
|
+
function Dt(i) {
|
1167
|
+
if (Re.call(i, "ref")) {
|
1168
|
+
var h = Object.getOwnPropertyDescriptor(i, "ref").get;
|
1169
|
+
if (h && h.isReactWarning)
|
1170
|
+
return !1;
|
1171
|
+
}
|
1172
|
+
return i.ref !== void 0;
|
1173
|
+
}
|
1174
|
+
function It(i) {
|
1175
|
+
if (Re.call(i, "key")) {
|
1176
|
+
var h = Object.getOwnPropertyDescriptor(i, "key").get;
|
1177
|
+
if (h && h.isReactWarning)
|
1178
|
+
return !1;
|
1179
|
+
}
|
1180
|
+
return i.key !== void 0;
|
1181
|
+
}
|
1182
|
+
function xt(i, h) {
|
1183
|
+
if (typeof i.ref == "string" && xe.current && h && xe.current.stateNode !== h) {
|
1184
|
+
var g = $(xe.current.type);
|
1185
|
+
Ge[g] || (S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', $(xe.current.type), i.ref), Ge[g] = !0);
|
1186
|
+
}
|
1187
|
+
}
|
1188
|
+
function Se(i, h) {
|
1189
|
+
{
|
1190
|
+
var g = function() {
|
1191
|
+
nt || (nt = !0, S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
|
1192
|
+
};
|
1193
|
+
g.isReactWarning = !0, Object.defineProperty(i, "key", {
|
1194
|
+
get: g,
|
1195
|
+
configurable: !0
|
1196
|
+
});
|
1197
|
+
}
|
1198
|
+
}
|
1199
|
+
function Wt(i, h) {
|
1200
|
+
{
|
1201
|
+
var g = function() {
|
1202
|
+
Ct || (Ct = !0, S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
|
1203
|
+
};
|
1204
|
+
g.isReactWarning = !0, Object.defineProperty(i, "ref", {
|
1205
|
+
get: g,
|
1206
|
+
configurable: !0
|
1207
|
+
});
|
1208
|
+
}
|
1209
|
+
}
|
1210
|
+
var r = function(i, h, g, C, D, F, A) {
|
1211
|
+
var R = {
|
1212
|
+
// This tag allows us to uniquely identify this as a React Element
|
1213
|
+
$$typeof: n,
|
1214
|
+
// Built-in properties that belong on the element
|
1215
|
+
type: i,
|
1216
|
+
key: h,
|
1217
|
+
ref: g,
|
1218
|
+
props: A,
|
1219
|
+
// Record the component responsible for creating this element.
|
1220
|
+
_owner: F
|
1221
|
+
};
|
1222
|
+
return R._store = {}, Object.defineProperty(R._store, "validated", {
|
1223
|
+
configurable: !1,
|
1224
|
+
enumerable: !1,
|
1225
|
+
writable: !0,
|
1226
|
+
value: !1
|
1227
|
+
}), Object.defineProperty(R, "_self", {
|
1228
|
+
configurable: !1,
|
1229
|
+
enumerable: !1,
|
1230
|
+
writable: !1,
|
1231
|
+
value: C
|
1232
|
+
}), Object.defineProperty(R, "_source", {
|
1233
|
+
configurable: !1,
|
1234
|
+
enumerable: !1,
|
1235
|
+
writable: !1,
|
1236
|
+
value: D
|
1237
|
+
}), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R;
|
1238
|
+
};
|
1239
|
+
function y(i, h, g, C, D) {
|
1240
|
+
{
|
1241
|
+
var F, A = {}, R = null, ce = null;
|
1242
|
+
g !== void 0 && (Et(g), R = "" + g), It(h) && (Et(h.key), R = "" + h.key), Dt(h) && (ce = h.ref, xt(h, D));
|
1243
|
+
for (F in h)
|
1244
|
+
Re.call(h, F) && !tt.hasOwnProperty(F) && (A[F] = h[F]);
|
1245
|
+
if (i && i.defaultProps) {
|
1246
|
+
var Z = i.defaultProps;
|
1247
|
+
for (F in Z)
|
1248
|
+
A[F] === void 0 && (A[F] = Z[F]);
|
1249
|
+
}
|
1250
|
+
if (R || ce) {
|
1251
|
+
var Q = typeof i == "function" ? i.displayName || i.name || "Unknown" : i;
|
1252
|
+
R && Se(A, Q), ce && Wt(A, Q);
|
1253
|
+
}
|
1254
|
+
return r(i, R, ce, D, C, xe.current, A);
|
1255
|
+
}
|
1256
|
+
}
|
1257
|
+
var O = B.ReactCurrentOwner, L = B.ReactDebugCurrentFrame;
|
1258
|
+
function K(i) {
|
1259
|
+
if (i) {
|
1260
|
+
var h = i._owner, g = Te(i.type, i._source, h ? h.type : null);
|
1261
|
+
L.setExtraStackFrame(g);
|
1262
|
+
} else
|
1263
|
+
L.setExtraStackFrame(null);
|
1264
|
+
}
|
1265
|
+
var de;
|
1266
|
+
de = !1;
|
1267
|
+
function ae(i) {
|
1268
|
+
return typeof i == "object" && i !== null && i.$$typeof === n;
|
1269
|
+
}
|
1270
|
+
function Lt() {
|
1271
|
+
{
|
1272
|
+
if (O.current) {
|
1273
|
+
var i = $(O.current.type);
|
1274
|
+
if (i)
|
1275
|
+
return `
|
1276
|
+
|
1277
|
+
Check the render method of \`` + i + "`.";
|
1278
|
+
}
|
1279
|
+
return "";
|
1280
|
+
}
|
1281
|
+
}
|
1282
|
+
function Nt(i) {
|
1283
|
+
{
|
1284
|
+
if (i !== void 0) {
|
1285
|
+
var h = i.fileName.replace(/^.*[\\\/]/, ""), g = i.lineNumber;
|
1286
|
+
return `
|
1287
|
+
|
1288
|
+
Check your code at ` + h + ":" + g + ".";
|
1289
|
+
}
|
1290
|
+
return "";
|
1291
|
+
}
|
1292
|
+
}
|
1293
|
+
var at = {};
|
1294
|
+
function pe(i) {
|
1295
|
+
{
|
1296
|
+
var h = Lt();
|
1297
|
+
if (!h) {
|
1298
|
+
var g = typeof i == "string" ? i : i.displayName || i.name;
|
1299
|
+
g && (h = `
|
1300
|
+
|
1301
|
+
Check the top-level render call using <` + g + ">.");
|
1302
|
+
}
|
1303
|
+
return h;
|
1304
|
+
}
|
1305
|
+
}
|
1306
|
+
function fe(i, h) {
|
1307
|
+
{
|
1308
|
+
if (!i._store || i._store.validated || i.key != null)
|
1309
|
+
return;
|
1310
|
+
i._store.validated = !0;
|
1311
|
+
var g = pe(h);
|
1312
|
+
if (at[g])
|
1313
|
+
return;
|
1314
|
+
at[g] = !0;
|
1315
|
+
var C = "";
|
1316
|
+
i && i._owner && i._owner !== O.current && (C = " It was passed a child from " + $(i._owner.type) + "."), K(i), S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', g, C), K(null);
|
1317
|
+
}
|
1318
|
+
}
|
1319
|
+
function ke(i, h) {
|
1320
|
+
{
|
1321
|
+
if (typeof i != "object")
|
1322
|
+
return;
|
1323
|
+
if (et(i))
|
1324
|
+
for (var g = 0; g < i.length; g++) {
|
1325
|
+
var C = i[g];
|
1326
|
+
ae(C) && fe(C, h);
|
1327
|
+
}
|
1328
|
+
else if (ae(i))
|
1329
|
+
i._store && (i._store.validated = !0);
|
1330
|
+
else if (i) {
|
1331
|
+
var D = H(i);
|
1332
|
+
if (typeof D == "function" && D !== i.entries)
|
1333
|
+
for (var F = D.call(i), A; !(A = F.next()).done; )
|
1334
|
+
ae(A.value) && fe(A.value, h);
|
1335
|
+
}
|
1336
|
+
}
|
1337
|
+
}
|
1338
|
+
function _e(i) {
|
1339
|
+
{
|
1340
|
+
var h = i.type;
|
1341
|
+
if (h == null || typeof h == "string")
|
1342
|
+
return;
|
1343
|
+
var g;
|
1344
|
+
if (typeof h == "function")
|
1345
|
+
g = h.propTypes;
|
1346
|
+
else if (typeof h == "object" && (h.$$typeof === u || // Note: Memo only checks outer props here.
|
1347
|
+
// Inner props are checked in the reconciler.
|
1348
|
+
h.$$typeof === b))
|
1349
|
+
g = h.propTypes;
|
1350
|
+
else
|
1351
|
+
return;
|
1352
|
+
if (g) {
|
1353
|
+
var C = $(h);
|
1354
|
+
Qe(g, i.props, "prop", C, i);
|
1355
|
+
} else if (h.PropTypes !== void 0 && !de) {
|
1356
|
+
de = !0;
|
1357
|
+
var D = $(h);
|
1358
|
+
S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", D || "Unknown");
|
1359
|
+
}
|
1360
|
+
typeof h.getDefaultProps == "function" && !h.getDefaultProps.isReactClassApproved && S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
1361
|
+
}
|
1362
|
+
}
|
1363
|
+
function je(i) {
|
1364
|
+
{
|
1365
|
+
for (var h = Object.keys(i.props), g = 0; g < h.length; g++) {
|
1366
|
+
var C = h[g];
|
1367
|
+
if (C !== "children" && C !== "key") {
|
1368
|
+
K(i), S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", C), K(null);
|
1369
|
+
break;
|
1370
|
+
}
|
1371
|
+
}
|
1372
|
+
i.ref !== null && (K(i), S("Invalid attribute `ref` supplied to `React.Fragment`."), K(null));
|
1373
|
+
}
|
1374
|
+
}
|
1375
|
+
function De(i, h, g, C, D, F) {
|
1376
|
+
{
|
1377
|
+
var A = P(i);
|
1378
|
+
if (!A) {
|
1379
|
+
var R = "";
|
1380
|
+
(i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (R += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
1381
|
+
var ce = Nt(D);
|
1382
|
+
ce ? R += ce : R += Lt();
|
1383
|
+
var Z;
|
1384
|
+
i === null ? Z = "null" : et(i) ? Z = "array" : i !== void 0 && i.$$typeof === n ? (Z = "<" + ($(i.type) || "Unknown") + " />", R = " Did you accidentally export a JSX literal instead of a component?") : Z = typeof i, S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Z, R);
|
1385
|
+
}
|
1386
|
+
var Q = y(i, h, g, D, F);
|
1387
|
+
if (Q == null)
|
1388
|
+
return Q;
|
1389
|
+
if (A) {
|
1390
|
+
var he = h.children;
|
1391
|
+
if (he !== void 0)
|
1392
|
+
if (C)
|
1393
|
+
if (et(he)) {
|
1394
|
+
for (var Ve = 0; Ve < he.length; Ve++)
|
1395
|
+
ke(he[Ve], i);
|
1396
|
+
Object.freeze && Object.freeze(he);
|
1397
|
+
} else
|
1398
|
+
S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
1399
|
+
else
|
1400
|
+
ke(he, i);
|
1401
|
+
}
|
1402
|
+
return i === e ? je(Q) : _e(Q), Q;
|
1403
|
+
}
|
1404
|
+
}
|
1405
|
+
function zn(i, h, g) {
|
1406
|
+
return De(i, h, g, !0);
|
1407
|
+
}
|
1408
|
+
function Yn(i, h, g) {
|
1409
|
+
return De(i, h, g, !1);
|
1410
|
+
}
|
1411
|
+
var Gn = Yn, Vn = zn;
|
1412
|
+
rt.Fragment = e, rt.jsx = Gn, rt.jsxs = Vn;
|
1413
|
+
}()), rt;
|
1414
|
+
}
|
1415
|
+
process.env.NODE_ENV === "production" ? Vt.exports = Wa() : Vt.exports = qa();
|
1416
|
+
var l = Vt.exports;
|
1417
|
+
function Fn(t) {
|
1418
|
+
return t.title.search("<") > -1 ? /* @__PURE__ */ l.jsx("button", { className: "svg", dangerouslySetInnerHTML: { __html: t.title } }) : /* @__PURE__ */ l.jsx("button", { children: t.title });
|
1419
|
+
}
|
1420
|
+
const Ka = /* @__PURE__ */ l.jsxs("svg", { className: "closeIcon", width: "14", height: "14", fill: "none", stroke: "#666666", strokeMiterlimit: "10", children: [
|
1421
|
+
/* @__PURE__ */ l.jsx("circle", { cx: "7", cy: "7", r: "6" }),
|
1422
|
+
/* @__PURE__ */ l.jsx("line", { x1: "4", y1: "4", x2: "10", y2: "10" }),
|
1423
|
+
/* @__PURE__ */ l.jsx("line", { x1: "4", y1: "10", x2: "10", y2: "4" })
|
1424
|
+
] }), Xa = /* @__PURE__ */ l.jsx("svg", { className: "dragIcon", width: "14", height: "14", fill: "#666666", stroke: "none", children: /* @__PURE__ */ l.jsx(
|
1425
|
+
"path",
|
1426
|
+
{
|
1427
|
+
d: `M10.43,4H3.57C3.26,4,3,4.22,3,4.5v1C3,5.78,3.26,6,3.57,6h6.86C10.74,6,11,5.78,11,5.5v-1
|
1428
|
+
C11,4.22,10.74,4,10.43,4z M10.43,8H3.57C3.26,8,3,8.22,3,8.5v1C3,9.78,3.26,10,3.57,10h6.86C10.74,10,11,9.78,11,9.5v-1
|
1429
|
+
C11,8.22,10.74,8,10.43,8z`
|
1430
|
+
}
|
1431
|
+
) });
|
1432
|
+
function Za(t) {
|
1433
|
+
return /* @__PURE__ */ l.jsx(_n.Item, { value: t.title, children: /* @__PURE__ */ l.jsxs("div", { children: [
|
1434
|
+
Xa,
|
1435
|
+
/* @__PURE__ */ l.jsx("span", { children: t.title }),
|
1436
|
+
/* @__PURE__ */ l.jsx("button", { className: "closeIcon", onClick: () => {
|
1437
|
+
t.onDelete(t.index);
|
1438
|
+
}, children: Ka })
|
1439
|
+
] }) }, t.title);
|
1440
|
+
}
|
1441
|
+
function Ja(t) {
|
1442
|
+
const [n, a] = oe(!1), [e, o] = oe(t.options), s = (d) => {
|
1443
|
+
t.onDragComplete(d), o(d);
|
1444
|
+
}, p = (d) => {
|
1445
|
+
const v = [...e];
|
1446
|
+
v.splice(d, 1), s(v);
|
1447
|
+
}, c = [];
|
1448
|
+
e.forEach((d, v) => {
|
1449
|
+
c.push(/* @__PURE__ */ l.jsx(Za, { index: v, title: d, onDelete: p }, d));
|
1450
|
+
});
|
1451
|
+
let u = "dropdown draggable";
|
1452
|
+
return t.subdropdown && (u += " subdropdown"), /* @__PURE__ */ l.jsxs("div", { className: u, onMouseEnter: () => a(!0), onMouseLeave: () => a(!1), children: [
|
1453
|
+
/* @__PURE__ */ l.jsx(Fn, { title: t.title }),
|
1454
|
+
/* @__PURE__ */ l.jsx(_n.Group, { axis: "y", values: e, onReorder: s, style: { visibility: n ? "visible" : "hidden" }, children: c })
|
1455
|
+
] });
|
1456
|
+
}
|
1457
|
+
function Qa(t) {
|
1458
|
+
const [n, a] = oe(!1), e = [];
|
1459
|
+
t.options.map((s, p) => {
|
1460
|
+
t.onSelect !== void 0 && (s.onSelect = t.onSelect), e.push(/* @__PURE__ */ l.jsx(ei, { option: s }, p));
|
1461
|
+
});
|
1462
|
+
let o = "dropdown";
|
1463
|
+
return t.subdropdown && (o += " subdropdown"), /* @__PURE__ */ l.jsxs(
|
1464
|
+
"div",
|
1465
|
+
{
|
1466
|
+
className: o,
|
1467
|
+
onMouseEnter: () => a(!0),
|
1468
|
+
onMouseLeave: () => a(!1),
|
1469
|
+
children: [
|
1470
|
+
/* @__PURE__ */ l.jsx(Fn, { title: t.title }),
|
1471
|
+
/* @__PURE__ */ l.jsx(
|
1472
|
+
"ul",
|
1473
|
+
{
|
1474
|
+
style: { visibility: n ? "visible" : "hidden" },
|
1475
|
+
children: e
|
1476
|
+
}
|
1477
|
+
)
|
1478
|
+
]
|
1479
|
+
}
|
1480
|
+
);
|
1481
|
+
}
|
1482
|
+
function ei(t) {
|
1483
|
+
const { option: n } = t, [a, e] = oe("");
|
1484
|
+
let o;
|
1485
|
+
switch (n.type) {
|
1486
|
+
case "draggable":
|
1487
|
+
o = /* @__PURE__ */ l.jsx(
|
1488
|
+
Ja,
|
1489
|
+
{
|
1490
|
+
title: n.title,
|
1491
|
+
options: n.value,
|
1492
|
+
onDragComplete: (s) => {
|
1493
|
+
n.onDragComplete !== void 0 && n.onDragComplete(s);
|
1494
|
+
},
|
1495
|
+
subdropdown: !0
|
1496
|
+
}
|
1497
|
+
);
|
1498
|
+
break;
|
1499
|
+
case "dropdown":
|
1500
|
+
o = /* @__PURE__ */ l.jsx(
|
1501
|
+
Qa,
|
1502
|
+
{
|
1503
|
+
title: n.title,
|
1504
|
+
options: n.value,
|
1505
|
+
onSelect: n.onSelect,
|
1506
|
+
subdropdown: !0
|
1507
|
+
}
|
1508
|
+
);
|
1509
|
+
break;
|
1510
|
+
case "option":
|
1511
|
+
o = /* @__PURE__ */ l.jsx(
|
1512
|
+
"button",
|
1513
|
+
{
|
1514
|
+
onClick: () => {
|
1515
|
+
n.onSelect !== void 0 && n.onSelect(n.value), n.selectable && (a !== n.title ? e(n.title) : e(""));
|
1516
|
+
},
|
1517
|
+
children: n.title
|
1518
|
+
}
|
1519
|
+
);
|
1520
|
+
break;
|
1521
|
+
}
|
1522
|
+
return /* @__PURE__ */ l.jsx("li", { className: a === n.title ? "selected" : "", children: o }, Pa());
|
1523
|
+
}
|
1524
|
+
function Vi(t) {
|
1525
|
+
const n = [], a = [];
|
1526
|
+
t.components.forEach((s) => {
|
1527
|
+
s instanceof Da ? n.push(Ia) : s instanceof Oe ? (n.push(La), a.push(Fa), Na(t)) : s instanceof Ya ? (n.push(Ga), a.push(Va)) : s instanceof Nn && n.push(Ha);
|
1528
|
+
});
|
1529
|
+
function e(s) {
|
1530
|
+
switch (n.forEach((p) => p(t, s)), s.event) {
|
1531
|
+
case "custom":
|
1532
|
+
_.dispatchEvent({ type: j.CUSTOM, value: s.data });
|
1533
|
+
break;
|
1534
|
+
}
|
1535
|
+
}
|
1536
|
+
function o(s) {
|
1537
|
+
switch (a.forEach((p) => p(t, s)), s.event) {
|
1538
|
+
case "custom":
|
1539
|
+
_.dispatchEvent({ type: j.CUSTOM, value: s.data });
|
1540
|
+
break;
|
1541
|
+
}
|
1542
|
+
}
|
1543
|
+
t.listen = (s) => {
|
1544
|
+
s.target === "editor" ? o(s) : e(s);
|
1545
|
+
};
|
1546
|
+
}
|
1547
|
+
const ti = `out vec3 worldPosition;
|
1548
|
+
uniform float uDistance;
|
1549
|
+
|
1550
|
+
void main() {
|
1551
|
+
// Scale the plane by the drawing distance
|
1552
|
+
worldPosition = position.xzy * uDistance;
|
1553
|
+
worldPosition.xz += cameraPosition.xz;
|
1554
|
+
|
1555
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(worldPosition, 1.0);
|
1556
|
+
}`, ni = `out vec4 fragColor;
|
1557
|
+
in vec3 worldPosition;
|
1558
|
+
|
1559
|
+
uniform float uDivisions;
|
1560
|
+
uniform float uScale;
|
1561
|
+
uniform vec3 uColor;
|
1562
|
+
uniform float uDistance;
|
1563
|
+
uniform float uSubgridOpacity;
|
1564
|
+
uniform float uGridOpacity;
|
1565
|
+
|
1566
|
+
float getGrid(float gapSize) {
|
1567
|
+
vec2 worldPositionByDivision = worldPosition.xz / gapSize;
|
1568
|
+
|
1569
|
+
// Inverted, 0 where line, >1 where there's no line
|
1570
|
+
// We use the worldPosition (which in this case we use similarly to UVs) differential to control the anti-aliasing
|
1571
|
+
// We need to do the -0.5)-0.5 trick because the result fades out from 0 to 1, and we want both
|
1572
|
+
// worldPositionByDivision == 0.3 and worldPositionByDivision == 0.7 to result in the same fade, i.e. 0.3,
|
1573
|
+
// otherwise only one side of the line will be anti-aliased
|
1574
|
+
vec2 grid = abs(fract(worldPositionByDivision-0.5)-0.5) / fwidth(worldPositionByDivision) / 2.0;
|
1575
|
+
float gridLine = min(grid.x, grid.y);
|
1576
|
+
|
1577
|
+
// Uninvert and clamp
|
1578
|
+
return 1.0 - min(gridLine, 1.0);
|
1579
|
+
}
|
1580
|
+
|
1581
|
+
void main() {
|
1582
|
+
float cameraDistanceToGridPlane = distance(cameraPosition.y, worldPosition.y);
|
1583
|
+
float cameraDistanceToFragmentOnGridPlane = distance(cameraPosition.xz, worldPosition.xz);
|
1584
|
+
|
1585
|
+
// The size of the grid and subgrid are powers of each other and they are determined based on camera distance.
|
1586
|
+
// The current grid will become the next subgrid when it becomes too small, and its next power becomes the new grid.
|
1587
|
+
float subGridPower = pow(uDivisions, floor(log(cameraDistanceToGridPlane) / log(uDivisions)));
|
1588
|
+
float gridPower = subGridPower * uDivisions;
|
1589
|
+
|
1590
|
+
// If we want to fade both the grid and its subgrid, we need to displays 3 different opacities, with the next grid being the third
|
1591
|
+
float nextGridPower = gridPower * uDivisions;
|
1592
|
+
|
1593
|
+
// 1 where grid, 0 where no grid
|
1594
|
+
float subgrid = getGrid(subGridPower * uScale);
|
1595
|
+
float grid = getGrid(gridPower * uScale);
|
1596
|
+
float nextGrid = getGrid(nextGridPower * uScale);
|
1597
|
+
|
1598
|
+
// Where we are between the introduction of the current grid power and when we switch to the next grid power
|
1599
|
+
float stepPercentage = (cameraDistanceToGridPlane - subGridPower)/(gridPower - subGridPower);
|
1600
|
+
|
1601
|
+
// The last x percentage of the current step over which we want to fade
|
1602
|
+
float fadeRange = 0.3;
|
1603
|
+
|
1604
|
+
// We calculate the fade percentage from the step percentage and the fade range
|
1605
|
+
float fadePercentage = max(stepPercentage - 1.0 + fadeRange, 0.0) / fadeRange;
|
1606
|
+
|
1607
|
+
// Set base opacity based on how close we are to the drawing distance, with a cubic falloff
|
1608
|
+
float baseOpacity = subgrid * pow(1.0 - min(cameraDistanceToFragmentOnGridPlane / uDistance, 1.0), 3.0);
|
1609
|
+
|
1610
|
+
// Shade the subgrid
|
1611
|
+
fragColor = vec4(uColor.rgb, (baseOpacity - fadePercentage) * uSubgridOpacity);
|
1612
|
+
|
1613
|
+
// Somewhat arbitrary additional fade coefficient to counter anti-aliasing popping when switching between grid powers
|
1614
|
+
float fadeCoefficient = 0.5;
|
1615
|
+
|
1616
|
+
// Shade the grid
|
1617
|
+
fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity - fadePercentage * (uGridOpacity - uSubgridOpacity) * fadeCoefficient, grid);
|
1618
|
+
|
1619
|
+
// Shade the next grid
|
1620
|
+
fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity, nextGrid);
|
1621
|
+
|
1622
|
+
if (fragColor.a <= 0.0) discard;
|
1623
|
+
}`;
|
1624
|
+
class ai extends fn {
|
1625
|
+
constructor(n) {
|
1626
|
+
super({
|
1627
|
+
extensions: {
|
1628
|
+
derivatives: !0
|
1629
|
+
},
|
1630
|
+
glslVersion: qn,
|
1631
|
+
side: hn,
|
1632
|
+
transparent: !0,
|
1633
|
+
uniforms: {
|
1634
|
+
uScale: {
|
1635
|
+
value: n?.scale !== void 0 ? n?.scale : 0.1
|
1636
|
+
},
|
1637
|
+
uDivisions: {
|
1638
|
+
value: n?.divisions !== void 0 ? n?.divisions : 10
|
1639
|
+
},
|
1640
|
+
uColor: {
|
1641
|
+
value: n?.color !== void 0 ? n?.color : new Tt(16777215)
|
1642
|
+
},
|
1643
|
+
uDistance: {
|
1644
|
+
value: n?.distance !== void 0 ? n?.distance : 1e4
|
1645
|
+
},
|
1646
|
+
uSubgridOpacity: {
|
1647
|
+
value: n?.subgridOpacity !== void 0 ? n?.subgridOpacity : 0.15
|
1648
|
+
},
|
1649
|
+
uGridOpacity: {
|
1650
|
+
value: n?.gridOpacity !== void 0 ? n?.gridOpacity : 0.25
|
1651
|
+
}
|
1652
|
+
},
|
1653
|
+
vertexShader: ti,
|
1654
|
+
fragmentShader: ni,
|
1655
|
+
name: "InfiniteGrid",
|
1656
|
+
depthWrite: !1
|
1657
|
+
});
|
1658
|
+
}
|
1659
|
+
}
|
1660
|
+
class ii extends Kn {
|
1661
|
+
gridMaterial;
|
1662
|
+
constructor() {
|
1663
|
+
const n = new ai();
|
1664
|
+
super(new Xn(2, 2), n), this.gridMaterial = n, this.frustumCulled = !1, this.name = "InfiniteGridHelper", this.position.y = 0.1;
|
1665
|
+
}
|
1666
|
+
update() {
|
1667
|
+
this.gridMaterial.needsUpdate = !0;
|
1668
|
+
}
|
1669
|
+
}
|
1670
|
+
const ri = `#include <common>
|
1671
|
+
#include <batching_pars_vertex>
|
1672
|
+
#include <uv_pars_vertex>
|
1673
|
+
#include <color_pars_vertex>
|
1674
|
+
#include <morphtarget_pars_vertex>
|
1675
|
+
#include <skinning_pars_vertex>
|
1676
|
+
#include <logdepthbuf_pars_vertex>
|
1677
|
+
#include <clipping_planes_pars_vertex>
|
1678
|
+
|
1679
|
+
void main() {
|
1680
|
+
#include <uv_vertex>
|
1681
|
+
#include <color_vertex>
|
1682
|
+
#include <morphcolor_vertex>
|
1683
|
+
#include <batching_vertex>
|
1684
|
+
|
1685
|
+
#if defined ( USE_SKINNING )
|
1686
|
+
#include <beginnormal_vertex>
|
1687
|
+
#include <morphnormal_vertex>
|
1688
|
+
#include <skinbase_vertex>
|
1689
|
+
#include <skinnormal_vertex>
|
1690
|
+
#include <defaultnormal_vertex>
|
1691
|
+
#endif
|
1692
|
+
|
1693
|
+
#include <begin_vertex>
|
1694
|
+
#include <morphtarget_vertex>
|
1695
|
+
#include <skinning_vertex>
|
1696
|
+
#include <project_vertex>
|
1697
|
+
#include <logdepthbuf_vertex>
|
1698
|
+
#include <clipping_planes_vertex>
|
1699
|
+
#include <worldpos_vertex>
|
1700
|
+
}`, oi = `
|
1701
|
+
#include <common>
|
1702
|
+
#include <uv_pars_fragment>
|
1703
|
+
#include <clipping_planes_pars_fragment>
|
1704
|
+
|
1705
|
+
void main() {
|
1706
|
+
#include <clipping_planes_fragment>
|
1707
|
+
gl_FragColor = vec4(vec3(vUv, 0.0), 1.0);
|
1708
|
+
}`;
|
1709
|
+
class si extends fn {
|
1710
|
+
constructor() {
|
1711
|
+
super({
|
1712
|
+
defines: {
|
1713
|
+
USE_UV: ""
|
1714
|
+
},
|
1715
|
+
vertexShader: ri,
|
1716
|
+
fragmentShader: oi
|
1717
|
+
});
|
1718
|
+
}
|
1719
|
+
}
|
1720
|
+
function Ht(t) {
|
1721
|
+
const [n, a] = oe(t.open !== void 0 ? t.open : !0), e = !n || t.children === void 0;
|
1722
|
+
return /* @__PURE__ */ l.jsxs("div", { className: `accordion ${e ? "hide" : ""}`, children: [
|
1723
|
+
/* @__PURE__ */ l.jsxs(
|
1724
|
+
"button",
|
1725
|
+
{
|
1726
|
+
className: "toggle",
|
1727
|
+
onClick: () => {
|
1728
|
+
const o = !n;
|
1729
|
+
t.onToggle !== void 0 && t.onToggle(o), a(o);
|
1730
|
+
},
|
1731
|
+
children: [
|
1732
|
+
/* @__PURE__ */ l.jsx(
|
1733
|
+
"p",
|
1734
|
+
{
|
1735
|
+
className: `status ${n ? "open" : ""}`,
|
1736
|
+
children: "Toggle"
|
1737
|
+
}
|
1738
|
+
),
|
1739
|
+
/* @__PURE__ */ l.jsx("p", { className: "label", children: lt(t.label) })
|
1740
|
+
]
|
1741
|
+
}
|
1742
|
+
),
|
1743
|
+
t.button,
|
1744
|
+
/* @__PURE__ */ l.jsx("div", { className: n ? "open" : "", children: /* @__PURE__ */ l.jsx("div", { children: t.children }) })
|
1745
|
+
] });
|
1746
|
+
}
|
1747
|
+
function Bn(t) {
|
1748
|
+
const [n, a] = oe(!1), e = t.child.children.length > 0, o = [];
|
1749
|
+
return t.child.children.length > 0 && t.child.children.map((s) => {
|
1750
|
+
o.push(/* @__PURE__ */ l.jsx(Bn, { child: s, three: t.three }, Math.random()));
|
1751
|
+
}), /* @__PURE__ */ l.jsxs("div", { className: "childObject", children: [
|
1752
|
+
/* @__PURE__ */ l.jsxs("div", { className: "child", children: [
|
1753
|
+
e ? /* @__PURE__ */ l.jsx(
|
1754
|
+
"button",
|
1755
|
+
{
|
1756
|
+
className: "status",
|
1757
|
+
style: {
|
1758
|
+
backgroundPositionX: n ? "-14px" : "2px"
|
1759
|
+
},
|
1760
|
+
onClick: () => {
|
1761
|
+
a(!n);
|
1762
|
+
}
|
1763
|
+
}
|
1764
|
+
) : null,
|
1765
|
+
/* @__PURE__ */ l.jsx(
|
1766
|
+
"button",
|
1767
|
+
{
|
1768
|
+
className: "name",
|
1769
|
+
style: {
|
1770
|
+
left: e ? "20px" : "5px"
|
1771
|
+
},
|
1772
|
+
onClick: () => {
|
1773
|
+
t.three.getObject(t.child.uuid), n || a(!0);
|
1774
|
+
},
|
1775
|
+
children: t.child.name.length > 0 ? `${t.child.name} (${t.child.type})` : `${t.child.type}::${t.child.uuid}`
|
1776
|
+
}
|
1777
|
+
),
|
1778
|
+
/* @__PURE__ */ l.jsx("div", { className: `icon ${Ba(t.child)}` })
|
1779
|
+
] }),
|
1780
|
+
/* @__PURE__ */ l.jsx("div", { className: n ? "open" : "", children: /* @__PURE__ */ l.jsx("div", { className: "container", children: o }) })
|
1781
|
+
] }, Math.random());
|
1782
|
+
}
|
1783
|
+
function ci(t) {
|
1784
|
+
const n = [];
|
1785
|
+
return t.child.children.map((a) => {
|
1786
|
+
n.push(/* @__PURE__ */ l.jsx(Bn, { child: a, three: t.three }, Math.random()));
|
1787
|
+
}), /* @__PURE__ */ l.jsx("div", { className: `scene ${t.class !== void 0 ? t.class : ""}`, children: n });
|
1788
|
+
}
|
1789
|
+
const li = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";
|
1790
|
+
function ui(t) {
|
1791
|
+
return "items" in t;
|
1792
|
+
}
|
1793
|
+
function Ue(t) {
|
1794
|
+
const n = [];
|
1795
|
+
return t.items.forEach((a) => {
|
1796
|
+
ui(a) ? n.push(
|
1797
|
+
/* @__PURE__ */ l.jsx(Ue, { title: lt(a.title), items: a.items }, Math.random())
|
1798
|
+
) : n.push(
|
1799
|
+
/* @__PURE__ */ l.jsx(
|
1800
|
+
st,
|
1801
|
+
{
|
1802
|
+
title: a.title,
|
1803
|
+
prop: a.prop,
|
1804
|
+
value: a.value,
|
1805
|
+
type: a.type,
|
1806
|
+
min: a.min,
|
1807
|
+
max: a.max,
|
1808
|
+
step: a.step,
|
1809
|
+
disabled: a.disabled,
|
1810
|
+
options: a.options,
|
1811
|
+
onChange: (e, o) => {
|
1812
|
+
a.onChange !== void 0 && a.onChange(e, o);
|
1813
|
+
}
|
1814
|
+
},
|
1815
|
+
Math.random()
|
1816
|
+
)
|
1817
|
+
);
|
1818
|
+
}), /* @__PURE__ */ l.jsx(Ht, { label: t.title, open: t.expanded === !0, children: n });
|
1819
|
+
}
|
1820
|
+
function di(t) {
|
1821
|
+
return !(t === "alphaHash" || t === "alphaToCoverage" || t === "attenuationDistance" || t === "blendDstAlpha" || t === "colorWrite" || t === "combine" || t === "defaultAttributeValues" || t === "depthFunc" || t === "forceSinglePass" || t === "glslVersion" || t === "linecap" || t === "linejoin" || t === "linewidth" || t === "normalMapType" || t === "precision" || t === "premultipliedAlpha" || t === "shadowSide" || t === "toneMapped" || t === "uniformsGroups" || t === "uniformsNeedUpdate" || t === "userData" || t === "vertexColors" || t === "version" || t === "wireframeLinecap" || t === "wireframeLinejoin" || t === "wireframeLinewidth" || t.slice(0, 4) === "clip" || t.slice(0, 7) === "polygon" || t.slice(0, 7) === "stencil" || t.slice(0, 2) === "is");
|
1822
|
+
}
|
1823
|
+
function Ie(t) {
|
1824
|
+
switch (t) {
|
1825
|
+
case "alphaMap":
|
1826
|
+
return "Alpha Map";
|
1827
|
+
case "anisotropyMap":
|
1828
|
+
return "Anisotropy Map";
|
1829
|
+
case "anisotropyRotation":
|
1830
|
+
return "Anisotropy Rotation";
|
1831
|
+
case "aoMap":
|
1832
|
+
return "AO Map";
|
1833
|
+
case "aoMapIntensity":
|
1834
|
+
return "AO Map Intensity";
|
1835
|
+
case "attenuationColor":
|
1836
|
+
return "Attenuation Color";
|
1837
|
+
case "blendAlpha":
|
1838
|
+
return "Blend Alpha";
|
1839
|
+
case "blendColor":
|
1840
|
+
return "Blend Color";
|
1841
|
+
case "blendDst":
|
1842
|
+
return "Blend Dst";
|
1843
|
+
case "blendDstAlpha":
|
1844
|
+
return "Blend Dst Alha";
|
1845
|
+
case "blendEquation":
|
1846
|
+
return "Blend Equation";
|
1847
|
+
case "blendEquationAlpha":
|
1848
|
+
return "Blend Equation Alpha";
|
1849
|
+
case "blending":
|
1850
|
+
return "Blending";
|
1851
|
+
case "blendSrc":
|
1852
|
+
return "Blend Src";
|
1853
|
+
case "blendSrcAlpha":
|
1854
|
+
return "Blend Src Alpha";
|
1855
|
+
case "bumpMap":
|
1856
|
+
return "Bump Map";
|
1857
|
+
case "bumpScale":
|
1858
|
+
return "Bump Scale";
|
1859
|
+
case "clearcoatMap":
|
1860
|
+
return "Clearcoat Map";
|
1861
|
+
case "clearcoatNormalMap":
|
1862
|
+
return "Clearcoat Normal Map";
|
1863
|
+
case "clearcoatNormalScale":
|
1864
|
+
return "Clearcoat Normal Scale";
|
1865
|
+
case "clearcoatRoughness":
|
1866
|
+
return "Clearcoat Roughness";
|
1867
|
+
case "clearcoatRoughnessMap":
|
1868
|
+
return "Clearcoat Roughness Map";
|
1869
|
+
case "color":
|
1870
|
+
return "Color";
|
1871
|
+
case "defines":
|
1872
|
+
return "Defines";
|
1873
|
+
case "depthTest":
|
1874
|
+
return "Depth Test";
|
1875
|
+
case "depthWrite":
|
1876
|
+
return "Depth Write";
|
1877
|
+
case "displacementBias":
|
1878
|
+
return "Displacement Bias";
|
1879
|
+
case "displacementMap":
|
1880
|
+
return "Displacement Map";
|
1881
|
+
case "displacementScale":
|
1882
|
+
return "Displacement Scale";
|
1883
|
+
case "dithering":
|
1884
|
+
return "Dithering";
|
1885
|
+
case "emissive":
|
1886
|
+
return "Emissive";
|
1887
|
+
case "emissiveMap":
|
1888
|
+
return "Emissive Map";
|
1889
|
+
case "emissiveIntensity":
|
1890
|
+
return "Emissive Intensity";
|
1891
|
+
case "envMap":
|
1892
|
+
return "Environment Map";
|
1893
|
+
case "envMapIntensity":
|
1894
|
+
return "Environment Map Intensity";
|
1895
|
+
case "extensions":
|
1896
|
+
return "Extensions";
|
1897
|
+
case "flatShading":
|
1898
|
+
return "Flat Shading";
|
1899
|
+
case "fragmentShader":
|
1900
|
+
return "Fragment Shader";
|
1901
|
+
case "fog":
|
1902
|
+
return "Fog";
|
1903
|
+
case "gradientMap":
|
1904
|
+
return "Gradient Map";
|
1905
|
+
case "ior":
|
1906
|
+
return "IOR";
|
1907
|
+
case "iridescenceIOR":
|
1908
|
+
return "Iridescence IOR";
|
1909
|
+
case "iridescenceMap":
|
1910
|
+
return "Iridescence Map";
|
1911
|
+
case "iridescenceThicknessMap":
|
1912
|
+
return "Iridescence Thickness Map";
|
1913
|
+
case "iridescenceThicknessRange":
|
1914
|
+
return "Iridescence Thickness Range";
|
1915
|
+
case "lights":
|
1916
|
+
return "Lights";
|
1917
|
+
case "lightMap":
|
1918
|
+
return "Light Map";
|
1919
|
+
case "lightMapIntensity":
|
1920
|
+
return "Light Map Intensity";
|
1921
|
+
case "map":
|
1922
|
+
return "Map";
|
1923
|
+
case "matcap":
|
1924
|
+
return "Matcap";
|
1925
|
+
case "metalness":
|
1926
|
+
return "Metalness";
|
1927
|
+
case "metalnessMap":
|
1928
|
+
return "Metalness Map";
|
1929
|
+
case "name":
|
1930
|
+
return "Name";
|
1931
|
+
case "normalMap":
|
1932
|
+
return "Normal Map";
|
1933
|
+
case "normalScale":
|
1934
|
+
return "Normal Scale";
|
1935
|
+
case "opacity":
|
1936
|
+
return "Opacity";
|
1937
|
+
case "reflectivity":
|
1938
|
+
return "Reflectivity";
|
1939
|
+
case "refractionRatio":
|
1940
|
+
return "Refraction Ratio";
|
1941
|
+
case "roughness":
|
1942
|
+
return "Roughness";
|
1943
|
+
case "roughnessMap":
|
1944
|
+
return "Roughness Map";
|
1945
|
+
case "sheenColor":
|
1946
|
+
return "Sheen Color";
|
1947
|
+
case "sheenColorMap":
|
1948
|
+
return "Sheen Color Map";
|
1949
|
+
case "sheenRoughness":
|
1950
|
+
return "Sheen Roughness";
|
1951
|
+
case "sheenRoughnessMap":
|
1952
|
+
return "Sheen Roughness Map";
|
1953
|
+
case "shininess":
|
1954
|
+
return "Shininess";
|
1955
|
+
case "side":
|
1956
|
+
return "Side";
|
1957
|
+
case "size":
|
1958
|
+
return "Size";
|
1959
|
+
case "sizeAttenuation":
|
1960
|
+
return "Size Attenuation";
|
1961
|
+
case "specular":
|
1962
|
+
return "Specular";
|
1963
|
+
case "specularColor":
|
1964
|
+
return "Specular Color";
|
1965
|
+
case "specularColorMap":
|
1966
|
+
return "Specular Color Map";
|
1967
|
+
case "specularIntensity":
|
1968
|
+
return "Specular Intensity";
|
1969
|
+
case "specularIntensityMap":
|
1970
|
+
return "Specular Map Intensity";
|
1971
|
+
case "thickness":
|
1972
|
+
return "Thickness";
|
1973
|
+
case "thicknessMap":
|
1974
|
+
return "Thickness Map";
|
1975
|
+
case "transmission":
|
1976
|
+
return "Transmission";
|
1977
|
+
case "transmissionMap":
|
1978
|
+
return "Transmission Map";
|
1979
|
+
case "transparent":
|
1980
|
+
return "Transparent";
|
1981
|
+
case "type":
|
1982
|
+
return "Type";
|
1983
|
+
case "uuid":
|
1984
|
+
return "UUID";
|
1985
|
+
case "uniforms":
|
1986
|
+
return "Uniforms";
|
1987
|
+
case "vertexShader":
|
1988
|
+
return "Vertex Shader";
|
1989
|
+
case "visible":
|
1990
|
+
return "Visible";
|
1991
|
+
case "wireframe":
|
1992
|
+
return "Wireframe";
|
1993
|
+
}
|
1994
|
+
return t;
|
1995
|
+
}
|
1996
|
+
function fi(t) {
|
1997
|
+
return t.toLowerCase().search("intensity") > -1 || t === "anisotropyRotation" || t === "blendAlpha" || t === "bumpScale" || t === "clearcoatRoughness" || t === "displacementBias" || t === "displacementScale" || t === "metalness" || t === "opacity" || t === "reflectivity" || t === "refractionRatio" || t === "roughness" || t === "sheenRoughness" || t === "thickness";
|
1998
|
+
}
|
1999
|
+
function hi() {
|
2000
|
+
const t = document.createElement("input");
|
2001
|
+
return t.type = "file", new Promise((n, a) => {
|
2002
|
+
t.addEventListener("change", function() {
|
2003
|
+
if (t.files === null)
|
2004
|
+
a();
|
2005
|
+
else {
|
2006
|
+
const e = t.files[0], o = new FileReader();
|
2007
|
+
o.onload = function(s) {
|
2008
|
+
n(s.target.result);
|
2009
|
+
}, o.readAsDataURL(e);
|
2010
|
+
}
|
2011
|
+
}), t.click();
|
2012
|
+
});
|
2013
|
+
}
|
2014
|
+
const pi = [
|
2015
|
+
{
|
2016
|
+
title: "Front",
|
2017
|
+
value: Zn
|
2018
|
+
},
|
2019
|
+
{
|
2020
|
+
title: "Back",
|
2021
|
+
value: Jn
|
2022
|
+
},
|
2023
|
+
{
|
2024
|
+
title: "Double",
|
2025
|
+
value: hn
|
2026
|
+
}
|
2027
|
+
], mi = [
|
2028
|
+
{
|
2029
|
+
title: "No Blending",
|
2030
|
+
value: Qn
|
2031
|
+
},
|
2032
|
+
{
|
2033
|
+
title: "Normal",
|
2034
|
+
value: ea
|
2035
|
+
},
|
2036
|
+
{
|
2037
|
+
title: "Additive",
|
2038
|
+
value: ta
|
2039
|
+
},
|
2040
|
+
{
|
2041
|
+
title: "Subtractive",
|
2042
|
+
value: na
|
2043
|
+
},
|
2044
|
+
{
|
2045
|
+
title: "Multiply",
|
2046
|
+
value: aa
|
2047
|
+
},
|
2048
|
+
{
|
2049
|
+
title: "Custom",
|
2050
|
+
value: ia
|
2051
|
+
}
|
2052
|
+
], vi = [
|
2053
|
+
{
|
2054
|
+
title: "Add",
|
2055
|
+
value: ra
|
2056
|
+
},
|
2057
|
+
{
|
2058
|
+
title: "Subtract",
|
2059
|
+
value: oa
|
2060
|
+
},
|
2061
|
+
{
|
2062
|
+
title: "Reverse Subtract",
|
2063
|
+
value: sa
|
2064
|
+
},
|
2065
|
+
{
|
2066
|
+
title: "Min",
|
2067
|
+
value: ca
|
2068
|
+
},
|
2069
|
+
{
|
2070
|
+
title: "Max",
|
2071
|
+
value: la
|
2072
|
+
}
|
2073
|
+
], gi = [
|
2074
|
+
{
|
2075
|
+
title: "Zero",
|
2076
|
+
valye: pn
|
2077
|
+
},
|
2078
|
+
{
|
2079
|
+
title: "One",
|
2080
|
+
valye: mn
|
2081
|
+
},
|
2082
|
+
{
|
2083
|
+
title: "Src Color",
|
2084
|
+
valye: vn
|
2085
|
+
},
|
2086
|
+
{
|
2087
|
+
title: "One Minus Src Color",
|
2088
|
+
valye: gn
|
2089
|
+
},
|
2090
|
+
{
|
2091
|
+
title: "Src Alpha",
|
2092
|
+
valye: bn
|
2093
|
+
},
|
2094
|
+
{
|
2095
|
+
title: "One Minus Src Alpha",
|
2096
|
+
valye: yn
|
2097
|
+
},
|
2098
|
+
{
|
2099
|
+
title: "Dst Alpha",
|
2100
|
+
valye: En
|
2101
|
+
},
|
2102
|
+
{
|
2103
|
+
title: "One Minus Dst Alpha",
|
2104
|
+
valye: Cn
|
2105
|
+
},
|
2106
|
+
{
|
2107
|
+
title: "Dst Color",
|
2108
|
+
valye: xn
|
2109
|
+
},
|
2110
|
+
{
|
2111
|
+
title: "One Minus Dst Color",
|
2112
|
+
valye: Sn
|
2113
|
+
},
|
2114
|
+
{
|
2115
|
+
title: "Src Alpha Saturate",
|
2116
|
+
valye: ua
|
2117
|
+
},
|
2118
|
+
{
|
2119
|
+
title: "Constant Color",
|
2120
|
+
valye: wn
|
2121
|
+
},
|
2122
|
+
{
|
2123
|
+
title: "One Minus Constant Color",
|
2124
|
+
valye: On
|
2125
|
+
},
|
2126
|
+
{
|
2127
|
+
title: "Constant Alpha",
|
2128
|
+
valye: Mn
|
2129
|
+
},
|
2130
|
+
{
|
2131
|
+
title: "One Minus Constant Alpha",
|
2132
|
+
valye: Tn
|
2133
|
+
}
|
2134
|
+
], bi = [
|
2135
|
+
{
|
2136
|
+
title: "Zero",
|
2137
|
+
valye: pn
|
2138
|
+
},
|
2139
|
+
{
|
2140
|
+
title: "One",
|
2141
|
+
valye: mn
|
2142
|
+
},
|
2143
|
+
{
|
2144
|
+
title: "Src Color",
|
2145
|
+
valye: vn
|
2146
|
+
},
|
2147
|
+
{
|
2148
|
+
title: "One Minus Src Color",
|
2149
|
+
valye: gn
|
2150
|
+
},
|
2151
|
+
{
|
2152
|
+
title: "Src Alpha",
|
2153
|
+
valye: bn
|
2154
|
+
},
|
2155
|
+
{
|
2156
|
+
title: "One Minus Src Alpha",
|
2157
|
+
valye: yn
|
2158
|
+
},
|
2159
|
+
{
|
2160
|
+
title: "Dst Alpha",
|
2161
|
+
valye: En
|
2162
|
+
},
|
2163
|
+
{
|
2164
|
+
title: "One Minus Dst Alpha",
|
2165
|
+
valye: Cn
|
2166
|
+
},
|
2167
|
+
{
|
2168
|
+
title: "Dst Color",
|
2169
|
+
valye: xn
|
2170
|
+
},
|
2171
|
+
{
|
2172
|
+
title: "One Minus Dst Color",
|
2173
|
+
valye: Sn
|
2174
|
+
},
|
2175
|
+
{
|
2176
|
+
title: "Constant Color",
|
2177
|
+
valye: wn
|
2178
|
+
},
|
2179
|
+
{
|
2180
|
+
title: "One Minus Constant Color",
|
2181
|
+
valye: On
|
2182
|
+
},
|
2183
|
+
{
|
2184
|
+
title: "Constant Alpha",
|
2185
|
+
valye: Mn
|
2186
|
+
},
|
2187
|
+
{
|
2188
|
+
title: "One Minus Constant Alpha",
|
2189
|
+
valye: Tn
|
2190
|
+
}
|
2191
|
+
];
|
2192
|
+
function ot(t, n) {
|
2193
|
+
t.needsUpdate = !0, t.type = "option", t.options = n;
|
2194
|
+
}
|
2195
|
+
function en(t, n, a) {
|
2196
|
+
const e = [];
|
2197
|
+
for (const o in t) {
|
2198
|
+
if (!di(o))
|
2199
|
+
continue;
|
2200
|
+
const s = typeof t[o], p = t[o];
|
2201
|
+
if (s === "boolean" || s === "number" || s === "string") {
|
2202
|
+
const c = {
|
2203
|
+
title: Ie(o),
|
2204
|
+
prop: o,
|
2205
|
+
type: s,
|
2206
|
+
value: p,
|
2207
|
+
min: void 0,
|
2208
|
+
max: void 0,
|
2209
|
+
needsUpdate: s === "boolean",
|
2210
|
+
onChange: (d, v) => {
|
2211
|
+
a.updateObject(n.uuid, `material.${d}`, v), c.needsUpdate && a.updateObject(n.uuid, "material.needsUpdate", !0);
|
2212
|
+
const b = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2213
|
+
b !== void 0 && ee(b, `material.${d}`, v);
|
2214
|
+
}
|
2215
|
+
};
|
2216
|
+
switch (o) {
|
2217
|
+
case "blending":
|
2218
|
+
ot(c, mi);
|
2219
|
+
break;
|
2220
|
+
case "blendDst":
|
2221
|
+
ot(c, bi);
|
2222
|
+
break;
|
2223
|
+
case "blendEquation":
|
2224
|
+
ot(c, vi);
|
2225
|
+
break;
|
2226
|
+
case "blendSrc":
|
2227
|
+
ot(c, gi);
|
2228
|
+
break;
|
2229
|
+
case "side":
|
2230
|
+
ot(c, pi);
|
2231
|
+
break;
|
2232
|
+
}
|
2233
|
+
fi(o) && (c.value = Number(p), c.type = "range", c.min = 0, c.max = 1, c.step = 0.01);
|
2234
|
+
const u = s === "string" && (o === "vertexShader" || o === "fragmentShader");
|
2235
|
+
u && (c.disabled = !1, c.latest = c.value, c.onChange = (d, v) => {
|
2236
|
+
c.latest = v;
|
2237
|
+
}), e.push(c), u && e.push({
|
2238
|
+
title: `${lt(o)} - Update`,
|
2239
|
+
type: "button",
|
2240
|
+
onChange: () => {
|
2241
|
+
a.updateObject(n.uuid, `material.${o}`, c.latest), a.updateObject(n.uuid, "material.needsUpdate", !0);
|
2242
|
+
const d = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2243
|
+
d !== void 0 && (ee(d, `material.${o}`, c.latest), d.material.needsUpdate = !0);
|
2244
|
+
}
|
2245
|
+
});
|
2246
|
+
} else if (s === "object")
|
2247
|
+
if (p.isColor)
|
2248
|
+
e.push({
|
2249
|
+
title: Ie(o),
|
2250
|
+
prop: o,
|
2251
|
+
type: "color",
|
2252
|
+
value: p,
|
2253
|
+
onChange: (c, u) => {
|
2254
|
+
const d = new Tt(u);
|
2255
|
+
a.updateObject(n.uuid, `material.${c}`, d);
|
2256
|
+
const v = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2257
|
+
v !== void 0 && ee(v, `material.${c}`, d);
|
2258
|
+
}
|
2259
|
+
});
|
2260
|
+
else if (Array.isArray(p)) {
|
2261
|
+
const c = [];
|
2262
|
+
for (const u in p)
|
2263
|
+
c.push({
|
2264
|
+
title: `${u}`,
|
2265
|
+
type: `${typeof p[u]}`,
|
2266
|
+
value: p[u],
|
2267
|
+
onChange: (d, v) => {
|
2268
|
+
a.updateObject(n.uuid, `material.${o}`, v);
|
2269
|
+
const b = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2270
|
+
b !== void 0 && ee(b, `material.${o}`, v);
|
2271
|
+
}
|
2272
|
+
});
|
2273
|
+
e.push({
|
2274
|
+
title: Ie(o),
|
2275
|
+
items: c
|
2276
|
+
});
|
2277
|
+
} else {
|
2278
|
+
const c = [];
|
2279
|
+
for (const u in p) {
|
2280
|
+
const d = p[u];
|
2281
|
+
switch (typeof d) {
|
2282
|
+
case "boolean":
|
2283
|
+
case "number":
|
2284
|
+
case "string":
|
2285
|
+
u === "src" ? e.push({
|
2286
|
+
title: Ie(o),
|
2287
|
+
type: "image",
|
2288
|
+
value: d,
|
2289
|
+
onChange: (b, E) => {
|
2290
|
+
a.createTexture(n.uuid, `material.${o}`, E);
|
2291
|
+
const x = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2292
|
+
x !== void 0 && Gt(E).then((M) => {
|
2293
|
+
ee(x, `material.${o}`, M), ee(x, "material.needsUpdate", !0);
|
2294
|
+
});
|
2295
|
+
}
|
2296
|
+
}) : c.push({
|
2297
|
+
title: `${Ie(u)}`,
|
2298
|
+
prop: `material.${o}.${u}`,
|
2299
|
+
type: `${typeof t[o][u]}`,
|
2300
|
+
value: p[u],
|
2301
|
+
onChange: (b, E) => {
|
2302
|
+
a.updateObject(n.uuid, `material.${o}.${u}`, E);
|
2303
|
+
const x = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2304
|
+
x !== void 0 && ee(x, `material.${o}.${u}`, E);
|
2305
|
+
}
|
2306
|
+
});
|
2307
|
+
break;
|
2308
|
+
case "object":
|
2309
|
+
if (d.value !== void 0 && d.value.src !== void 0)
|
2310
|
+
c.push({
|
2311
|
+
title: Ie(u),
|
2312
|
+
type: "image",
|
2313
|
+
value: d.value.src,
|
2314
|
+
onChange: (b, E) => {
|
2315
|
+
a.createTexture(n.uuid, `material.${o}.${u}.value`, p);
|
2316
|
+
const x = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2317
|
+
x !== void 0 && Gt(E).then((M) => {
|
2318
|
+
ee(x, `material.${o}.${u}.value`, M);
|
2319
|
+
});
|
2320
|
+
}
|
2321
|
+
});
|
2322
|
+
else if (o === "uniforms") {
|
2323
|
+
const b = d.value, E = (x, M, k) => ({
|
2324
|
+
title: x,
|
2325
|
+
type: "number",
|
2326
|
+
value: k,
|
2327
|
+
step: 0.01,
|
2328
|
+
onChange: (H, B) => {
|
2329
|
+
const S = `material.uniforms.${u}.value.${M}`;
|
2330
|
+
a.updateObject(n.uuid, S, B);
|
2331
|
+
const z = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2332
|
+
z !== void 0 && ee(z, S, B);
|
2333
|
+
}
|
2334
|
+
});
|
2335
|
+
if (typeof d.value == "number")
|
2336
|
+
c.push({
|
2337
|
+
title: u,
|
2338
|
+
type: "number",
|
2339
|
+
value: d.value,
|
2340
|
+
onChange: (x, M) => {
|
2341
|
+
const k = `material.${o}.${x}.value`;
|
2342
|
+
a.updateObject(n.uuid, k, M);
|
2343
|
+
const H = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2344
|
+
H !== void 0 && ee(H, k, M);
|
2345
|
+
}
|
2346
|
+
});
|
2347
|
+
else if (b.r !== void 0 && b.g !== void 0 && b.b !== void 0)
|
2348
|
+
c.push({
|
2349
|
+
title: u,
|
2350
|
+
type: "color",
|
2351
|
+
value: d.value,
|
2352
|
+
onChange: (x, M) => {
|
2353
|
+
const k = new Tt(M), H = `material.${o}.${x}.value`;
|
2354
|
+
a.updateObject(n.uuid, H, k);
|
2355
|
+
const B = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2356
|
+
B !== void 0 && ee(B, H, k);
|
2357
|
+
}
|
2358
|
+
});
|
2359
|
+
else if (b.x !== void 0 && b.y !== void 0 && b.z === void 0 && b.w === void 0)
|
2360
|
+
c.push(
|
2361
|
+
{
|
2362
|
+
title: u,
|
2363
|
+
items: [
|
2364
|
+
E("X", "x", d.value.x),
|
2365
|
+
E("Y", "y", d.value.y)
|
2366
|
+
]
|
2367
|
+
}
|
2368
|
+
);
|
2369
|
+
else if (b.x !== void 0 && b.y !== void 0 && b.z !== void 0 && b.w === void 0)
|
2370
|
+
c.push(
|
2371
|
+
{
|
2372
|
+
title: u,
|
2373
|
+
items: [
|
2374
|
+
E("X", "x", d.value.x),
|
2375
|
+
E("Y", "y", d.value.y),
|
2376
|
+
E("Z", "z", d.value.z)
|
2377
|
+
]
|
2378
|
+
}
|
2379
|
+
);
|
2380
|
+
else if (b.x !== void 0 && b.y !== void 0 && b.z !== void 0 && b.w !== void 0)
|
2381
|
+
c.push(
|
2382
|
+
{
|
2383
|
+
title: u,
|
2384
|
+
items: [
|
2385
|
+
E("X", "x", d.value.x),
|
2386
|
+
E("Y", "y", d.value.y),
|
2387
|
+
E("Z", "z", d.value.z),
|
2388
|
+
E("W", "w", d.value.w)
|
2389
|
+
]
|
2390
|
+
}
|
2391
|
+
);
|
2392
|
+
else if (b.elements !== void 0) {
|
2393
|
+
const x = b.elements, M = [];
|
2394
|
+
for (let k = 0; k < x.length; k++)
|
2395
|
+
M.push(E(k.toString(), k.toString(), x[k]));
|
2396
|
+
c.push(
|
2397
|
+
{
|
2398
|
+
title: u,
|
2399
|
+
items: M
|
2400
|
+
}
|
2401
|
+
);
|
2402
|
+
} else
|
2403
|
+
console.log(">>> need to add this format:", u, b);
|
2404
|
+
} else
|
2405
|
+
c.push({
|
2406
|
+
title: u,
|
2407
|
+
type: `${typeof d.value}`,
|
2408
|
+
value: d.value,
|
2409
|
+
onChange: (b, E) => {
|
2410
|
+
a.updateObject(n.uuid, `material.${o}.${u}.value`, E);
|
2411
|
+
const x = a.scene?.getObjectByProperty("uuid", n.uuid);
|
2412
|
+
x !== void 0 && ee(x, `material.${o}.${u}.value`, E);
|
2413
|
+
}
|
2414
|
+
});
|
2415
|
+
break;
|
2416
|
+
}
|
2417
|
+
}
|
2418
|
+
c.length > 0 && e.push({
|
2419
|
+
title: Ie(o),
|
2420
|
+
items: c
|
2421
|
+
});
|
2422
|
+
}
|
2423
|
+
else
|
2424
|
+
p !== void 0 && console.log("other:", o, s, p);
|
2425
|
+
}
|
2426
|
+
return e.sort((o, s) => o.title < s.title ? -1 : o.title > s.title ? 1 : 0), e.push({
|
2427
|
+
title: "Update Material",
|
2428
|
+
type: "button",
|
2429
|
+
onChange: () => {
|
2430
|
+
a.updateObject(n.uuid, "material.needsUpdate", !0);
|
2431
|
+
}
|
2432
|
+
}), e;
|
2433
|
+
}
|
2434
|
+
function yi(t, n) {
|
2435
|
+
const a = t.material;
|
2436
|
+
if (Array.isArray(a)) {
|
2437
|
+
const e = [], o = a.length;
|
2438
|
+
for (let s = 0; s < o; s++)
|
2439
|
+
e.push(
|
2440
|
+
/* @__PURE__ */ l.jsx(
|
2441
|
+
Ue,
|
2442
|
+
{
|
2443
|
+
title: `Material ${s}`,
|
2444
|
+
items: en(a[s], t, n)
|
2445
|
+
},
|
2446
|
+
`Material ${s}`
|
2447
|
+
)
|
2448
|
+
);
|
2449
|
+
return /* @__PURE__ */ l.jsx(l.Fragment, { children: e });
|
2450
|
+
} else
|
2451
|
+
return /* @__PURE__ */ l.jsx(
|
2452
|
+
Ue,
|
2453
|
+
{
|
2454
|
+
title: "Material",
|
2455
|
+
items: en(a, t, n)
|
2456
|
+
}
|
2457
|
+
);
|
2458
|
+
}
|
2459
|
+
function st(t) {
|
2460
|
+
let n = t.value;
|
2461
|
+
n !== void 0 && n.isColor !== void 0 && (n = ka(t.value));
|
2462
|
+
const [a, e] = oe(n), o = ye(null), s = ye(null), p = ye(null);
|
2463
|
+
Be(() => {
|
2464
|
+
let v = !1, b = -1, E = 0, x = Number(a);
|
2465
|
+
const M = (z) => {
|
2466
|
+
v = !0, E = x, b = z.clientX;
|
2467
|
+
}, k = (z) => {
|
2468
|
+
if (!v)
|
2469
|
+
return;
|
2470
|
+
const Ee = t.step !== void 0 ? t.step : 1, le = (z.clientX - b) * Ee;
|
2471
|
+
x = Number((E + le).toFixed(4)), s.current !== null && (s.current.value = x.toString()), t.onChange !== void 0 && t.onChange(t.prop !== void 0 ? t.prop : t.title, x);
|
2472
|
+
}, H = () => {
|
2473
|
+
v = !1;
|
2474
|
+
}, B = () => {
|
2475
|
+
v = !1;
|
2476
|
+
}, S = t.type === "number";
|
2477
|
+
return S && (o.current?.addEventListener("mousedown", M, !1), document.addEventListener("mouseup", H, !1), document.addEventListener("mousemove", k, !1), document.addEventListener("contextmenu", B, !1)), () => {
|
2478
|
+
S && (o.current?.removeEventListener("mousedown", M), document.removeEventListener("mouseup", H), document.removeEventListener("mousemove", k), document.removeEventListener("contextmenu", B));
|
2479
|
+
};
|
2480
|
+
}, [a]);
|
2481
|
+
const c = t.type === "string" && (a.length > 100 || a.search(`
|
2482
|
+
`) > -1), u = c || t.type === "image", d = (v) => {
|
2483
|
+
let b = v.target.value;
|
2484
|
+
t.type === "boolean" ? b = v.target.checked : t.type === "option" && (b = t.options[b].value), e(b), t.onChange !== void 0 && t.onChange(t.prop !== void 0 ? t.prop : t.title, b);
|
2485
|
+
};
|
2486
|
+
return /* @__PURE__ */ l.jsxs("div", { className: `field ${u ? "block" : ""}`, children: [
|
2487
|
+
t.type !== "button" && /* @__PURE__ */ l.jsx("label", { ref: o, children: lt(t.title) }, "fieldLabel"),
|
2488
|
+
t.type === "string" && !c && /* @__PURE__ */ l.jsx(
|
2489
|
+
"input",
|
2490
|
+
{
|
2491
|
+
type: "text",
|
2492
|
+
disabled: t.disabled,
|
2493
|
+
onChange: d,
|
2494
|
+
value: a
|
2495
|
+
}
|
2496
|
+
),
|
2497
|
+
t.type === "string" && c && /* @__PURE__ */ l.jsx(
|
2498
|
+
"textarea",
|
2499
|
+
{
|
2500
|
+
cols: 50,
|
2501
|
+
rows: 10,
|
2502
|
+
disabled: t.disabled !== void 0 ? t.disabled : !0,
|
2503
|
+
onChange: d,
|
2504
|
+
value: a
|
2505
|
+
}
|
2506
|
+
),
|
2507
|
+
t.type === "boolean" && /* @__PURE__ */ l.jsx(
|
2508
|
+
"input",
|
2509
|
+
{
|
2510
|
+
type: "checkbox",
|
2511
|
+
disabled: t.disabled,
|
2512
|
+
onChange: d,
|
2513
|
+
checked: a
|
2514
|
+
}
|
2515
|
+
),
|
2516
|
+
t.type === "number" && /* @__PURE__ */ l.jsx(
|
2517
|
+
"input",
|
2518
|
+
{
|
2519
|
+
ref: s,
|
2520
|
+
type: "number",
|
2521
|
+
value: a,
|
2522
|
+
min: t.min,
|
2523
|
+
max: t.max,
|
2524
|
+
step: t.step,
|
2525
|
+
disabled: t.disabled,
|
2526
|
+
onChange: d
|
2527
|
+
}
|
2528
|
+
),
|
2529
|
+
t.type === "range" && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
2530
|
+
/* @__PURE__ */ l.jsx("input", { type: "text", value: a.toString(), onChange: d, disabled: t.disabled, className: "min" }),
|
2531
|
+
/* @__PURE__ */ l.jsx(
|
2532
|
+
"input",
|
2533
|
+
{
|
2534
|
+
disabled: t.disabled,
|
2535
|
+
type: "range",
|
2536
|
+
value: a,
|
2537
|
+
min: t.min,
|
2538
|
+
max: t.max,
|
2539
|
+
step: t.step,
|
2540
|
+
onChange: d
|
2541
|
+
}
|
2542
|
+
)
|
2543
|
+
] }),
|
2544
|
+
t.type === "color" && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
2545
|
+
/* @__PURE__ */ l.jsx("input", { type: "text", value: a.toString(), onChange: d, disabled: t.disabled, className: "color" }),
|
2546
|
+
/* @__PURE__ */ l.jsx("input", { type: "color", value: a, onChange: d, disabled: t.disabled })
|
2547
|
+
] }),
|
2548
|
+
t.type === "button" && /* @__PURE__ */ l.jsx(
|
2549
|
+
"button",
|
2550
|
+
{
|
2551
|
+
disabled: t.disabled,
|
2552
|
+
onClick: () => {
|
2553
|
+
t.onChange !== void 0 && t.onChange(t.prop !== void 0 ? t.prop : t.title, !0);
|
2554
|
+
},
|
2555
|
+
children: t.title
|
2556
|
+
}
|
2557
|
+
),
|
2558
|
+
t.type === "image" && /* @__PURE__ */ l.jsx("img", { ref: p, onClick: () => {
|
2559
|
+
hi().then((v) => {
|
2560
|
+
p.current.src = v, t.onChange !== void 0 && t.onChange(t.prop !== void 0 ? t.prop : t.title, v);
|
2561
|
+
});
|
2562
|
+
}, src: a.length > 0 ? a : li }),
|
2563
|
+
t.type === "option" && /* @__PURE__ */ l.jsx(l.Fragment, { children: /* @__PURE__ */ l.jsx("select", { onChange: d, disabled: t.disabled, defaultValue: t.value, children: t.options?.map((v, b) => /* @__PURE__ */ l.jsx("option", { value: v.value, children: lt(v.title) }, b)) }) })
|
2564
|
+
] });
|
2565
|
+
}
|
2566
|
+
function tn(t) {
|
2567
|
+
switch (t) {
|
2568
|
+
case "fov":
|
2569
|
+
return "FOV";
|
2570
|
+
case "zoom":
|
2571
|
+
return "Zoom";
|
2572
|
+
case "near":
|
2573
|
+
return "Near";
|
2574
|
+
case "far":
|
2575
|
+
return "Far";
|
2576
|
+
case "focus":
|
2577
|
+
return "Focus";
|
2578
|
+
case "aspect":
|
2579
|
+
return "Aspect";
|
2580
|
+
case "filmGauge":
|
2581
|
+
return "Film Gauge";
|
2582
|
+
case "filmOffset":
|
2583
|
+
return "Film Offset";
|
2584
|
+
case "left":
|
2585
|
+
return "Left";
|
2586
|
+
case "right":
|
2587
|
+
return "Right";
|
2588
|
+
case "top":
|
2589
|
+
return "Top";
|
2590
|
+
case "bottom":
|
2591
|
+
return "Bottom";
|
2592
|
+
}
|
2593
|
+
return t;
|
2594
|
+
}
|
2595
|
+
function Ei(t, n) {
|
2596
|
+
const a = [];
|
2597
|
+
if (t.perspectiveCameraInfo !== void 0)
|
2598
|
+
for (const e in t.perspectiveCameraInfo)
|
2599
|
+
a.push({
|
2600
|
+
title: tn(e),
|
2601
|
+
prop: e,
|
2602
|
+
type: "number",
|
2603
|
+
step: 0.01,
|
2604
|
+
value: t.perspectiveCameraInfo[e],
|
2605
|
+
onChange: (o, s) => {
|
2606
|
+
n.updateObject(t.uuid, o, s), n.requestMethod(t.uuid, "updateProjectionMatrix");
|
2607
|
+
const p = n.scene?.getObjectByProperty("uuid", t.uuid);
|
2608
|
+
p !== void 0 && (ee(p, o, s), p.updateProjectionMatrix());
|
2609
|
+
}
|
2610
|
+
});
|
2611
|
+
else if (t.orthographicCameraInfo !== void 0)
|
2612
|
+
for (const e in t.orthographicCameraInfo)
|
2613
|
+
a.push({
|
2614
|
+
title: tn(e),
|
2615
|
+
prop: e,
|
2616
|
+
type: "number",
|
2617
|
+
step: 0.01,
|
2618
|
+
value: t.perspectiveCameraInfo[e],
|
2619
|
+
onChange: (o, s) => {
|
2620
|
+
n.updateObject(t.uuid, o, s), n.requestMethod(t.uuid, "updateProjectionMatrix");
|
2621
|
+
const p = n.scene?.getObjectByProperty("uuid", t.uuid);
|
2622
|
+
p !== void 0 && (ee(p, o, s), p.updateProjectionMatrix());
|
2623
|
+
}
|
2624
|
+
});
|
2625
|
+
return /* @__PURE__ */ l.jsx(
|
2626
|
+
Ue,
|
2627
|
+
{
|
2628
|
+
title: "Camera",
|
2629
|
+
items: a
|
2630
|
+
}
|
2631
|
+
);
|
2632
|
+
}
|
2633
|
+
const Ci = Math.PI / 180, xi = 180 / Math.PI;
|
2634
|
+
function Ke(t, n, a, e, o) {
|
2635
|
+
return e + (t - n) * (o - e) / (a - n);
|
2636
|
+
}
|
2637
|
+
function Si(t) {
|
2638
|
+
return t * Ci;
|
2639
|
+
}
|
2640
|
+
function Ut(t) {
|
2641
|
+
return t * xi;
|
2642
|
+
}
|
2643
|
+
function wi(t, n) {
|
2644
|
+
const a = new da();
|
2645
|
+
a.elements = t.matrix;
|
2646
|
+
const e = new X(), o = new fa(), s = new X();
|
2647
|
+
t.uuid.length > 0 && (e.setFromMatrixPosition(a), o.setFromRotationMatrix(a), s.setFromMatrixScale(a));
|
2648
|
+
const p = (u, d) => {
|
2649
|
+
n.updateObject(t.uuid, u, d);
|
2650
|
+
const v = n.scene?.getObjectByProperty("uuid", t.uuid);
|
2651
|
+
v !== void 0 && ee(v, u, d);
|
2652
|
+
}, c = (u, d) => {
|
2653
|
+
p(u, Si(d));
|
2654
|
+
};
|
2655
|
+
return /* @__PURE__ */ l.jsx(
|
2656
|
+
Ue,
|
2657
|
+
{
|
2658
|
+
title: "Transform",
|
2659
|
+
items: [
|
2660
|
+
{
|
2661
|
+
title: "Position X",
|
2662
|
+
prop: "position.x",
|
2663
|
+
type: "number",
|
2664
|
+
value: e.x,
|
2665
|
+
onChange: p
|
2666
|
+
},
|
2667
|
+
{
|
2668
|
+
title: "Position Y",
|
2669
|
+
prop: "position.y",
|
2670
|
+
type: "number",
|
2671
|
+
value: e.y,
|
2672
|
+
onChange: p
|
2673
|
+
},
|
2674
|
+
{
|
2675
|
+
title: "Position Z",
|
2676
|
+
prop: "position.z",
|
2677
|
+
type: "number",
|
2678
|
+
value: e.z,
|
2679
|
+
onChange: p
|
2680
|
+
},
|
2681
|
+
{
|
2682
|
+
title: "Rotation X",
|
2683
|
+
prop: "rotation.x",
|
2684
|
+
type: "number",
|
2685
|
+
value: Ft(Ut(o.x)),
|
2686
|
+
min: -360,
|
2687
|
+
max: 360,
|
2688
|
+
step: 0.1,
|
2689
|
+
onChange: c
|
2690
|
+
},
|
2691
|
+
{
|
2692
|
+
title: "Rotation Y",
|
2693
|
+
prop: "rotation.y",
|
2694
|
+
type: "number",
|
2695
|
+
value: Ft(Ut(o.y)),
|
2696
|
+
min: -360,
|
2697
|
+
max: 360,
|
2698
|
+
step: 0.1,
|
2699
|
+
onChange: c
|
2700
|
+
},
|
2701
|
+
{
|
2702
|
+
title: "Rotation Z",
|
2703
|
+
prop: "rotation.z",
|
2704
|
+
type: "number",
|
2705
|
+
value: Ft(Ut(o.z)),
|
2706
|
+
min: -360,
|
2707
|
+
max: 360,
|
2708
|
+
step: 0.1,
|
2709
|
+
onChange: c
|
2710
|
+
},
|
2711
|
+
{
|
2712
|
+
title: "Scale X",
|
2713
|
+
prop: "scale.x",
|
2714
|
+
type: "number",
|
2715
|
+
value: s.x,
|
2716
|
+
step: 0.01,
|
2717
|
+
onChange: p
|
2718
|
+
},
|
2719
|
+
{
|
2720
|
+
title: "Scale Y",
|
2721
|
+
prop: "scale.y",
|
2722
|
+
type: "number",
|
2723
|
+
value: s.y,
|
2724
|
+
step: 0.01,
|
2725
|
+
onChange: p
|
2726
|
+
},
|
2727
|
+
{
|
2728
|
+
title: "Scale Z",
|
2729
|
+
prop: "scale.z",
|
2730
|
+
type: "number",
|
2731
|
+
value: s.z,
|
2732
|
+
step: 0.01,
|
2733
|
+
onChange: p
|
2734
|
+
}
|
2735
|
+
]
|
2736
|
+
}
|
2737
|
+
);
|
2738
|
+
}
|
2739
|
+
function nn(t) {
|
2740
|
+
switch (t) {
|
2741
|
+
case "color":
|
2742
|
+
return "Color";
|
2743
|
+
case "intensity":
|
2744
|
+
return "Intensity";
|
2745
|
+
case "decay":
|
2746
|
+
return "Decay";
|
2747
|
+
case "distance":
|
2748
|
+
return "Distance";
|
2749
|
+
case "angle":
|
2750
|
+
return "Angle";
|
2751
|
+
case "penumbra":
|
2752
|
+
return "Penumbra";
|
2753
|
+
case "groundColor":
|
2754
|
+
return "Ground Color";
|
2755
|
+
}
|
2756
|
+
return t;
|
2757
|
+
}
|
2758
|
+
function Oi(t, n) {
|
2759
|
+
const a = [];
|
2760
|
+
if (t.lightInfo !== void 0)
|
2761
|
+
for (const e in t.lightInfo) {
|
2762
|
+
const o = t.lightInfo[e];
|
2763
|
+
o !== void 0 && (o.isColor !== void 0 ? a.push({
|
2764
|
+
title: nn(e),
|
2765
|
+
prop: e,
|
2766
|
+
type: "color",
|
2767
|
+
value: o,
|
2768
|
+
onChange: (s, p) => {
|
2769
|
+
const c = new Tt(p);
|
2770
|
+
n.updateObject(t.uuid, s, c);
|
2771
|
+
const u = n.scene?.getObjectByProperty("uuid", t.uuid);
|
2772
|
+
u !== void 0 && ee(u, s, c);
|
2773
|
+
}
|
2774
|
+
}) : a.push({
|
2775
|
+
title: nn(e),
|
2776
|
+
prop: e,
|
2777
|
+
type: typeof o,
|
2778
|
+
value: o,
|
2779
|
+
step: typeof o == "number" ? 0.01 : void 0,
|
2780
|
+
onChange: (s, p) => {
|
2781
|
+
n.updateObject(t.uuid, s, p);
|
2782
|
+
const c = n.scene?.getObjectByProperty("uuid", t.uuid);
|
2783
|
+
c !== void 0 && ee(c, s, p);
|
2784
|
+
}
|
2785
|
+
}));
|
2786
|
+
}
|
2787
|
+
return /* @__PURE__ */ l.jsx(
|
2788
|
+
Ue,
|
2789
|
+
{
|
2790
|
+
title: "Light",
|
2791
|
+
items: a
|
2792
|
+
}
|
2793
|
+
);
|
2794
|
+
}
|
2795
|
+
function Mi(t, n) {
|
2796
|
+
const a = [], e = [];
|
2797
|
+
let o = 0;
|
2798
|
+
t.animations.forEach((c) => {
|
2799
|
+
o = Math.max(o, c.duration), c.duration > 0 && e.push({
|
2800
|
+
title: c.name,
|
2801
|
+
items: [
|
2802
|
+
{
|
2803
|
+
title: "Duration",
|
2804
|
+
type: "number",
|
2805
|
+
value: c.duration,
|
2806
|
+
disabled: !0
|
2807
|
+
},
|
2808
|
+
{
|
2809
|
+
title: "Blend Mode",
|
2810
|
+
type: "option",
|
2811
|
+
disabled: !0,
|
2812
|
+
options: [
|
2813
|
+
{
|
2814
|
+
title: "Normal",
|
2815
|
+
value: 2500
|
2816
|
+
},
|
2817
|
+
{
|
2818
|
+
title: "Additive",
|
2819
|
+
value: 2501
|
2820
|
+
}
|
2821
|
+
]
|
2822
|
+
}
|
2823
|
+
]
|
2824
|
+
});
|
2825
|
+
}), a.push({
|
2826
|
+
title: "Animations",
|
2827
|
+
items: e
|
2828
|
+
});
|
2829
|
+
const s = n.scene?.getObjectByProperty("uuid", t.uuid);
|
2830
|
+
let p = !1;
|
2831
|
+
if (s !== void 0) {
|
2832
|
+
const c = s.mixer;
|
2833
|
+
if (p = c !== void 0, p) {
|
2834
|
+
const u = [
|
2835
|
+
{
|
2836
|
+
title: "Time Scale",
|
2837
|
+
type: "range",
|
2838
|
+
value: c.timeScale,
|
2839
|
+
step: 0.01,
|
2840
|
+
min: -1,
|
2841
|
+
max: 2,
|
2842
|
+
onChange: (d, v) => {
|
2843
|
+
c.timeScale = v, n.updateObject(t.uuid, "mixer.timeScale", v);
|
2844
|
+
}
|
2845
|
+
}
|
2846
|
+
];
|
2847
|
+
u.push({
|
2848
|
+
title: "Stop All",
|
2849
|
+
type: "button",
|
2850
|
+
onChange: () => {
|
2851
|
+
c.stopAllAction(), n.requestMethod(t.uuid, "stopAllAction", void 0, "mixer");
|
2852
|
+
}
|
2853
|
+
}), a.push({
|
2854
|
+
title: "Mixer",
|
2855
|
+
items: u
|
2856
|
+
});
|
2857
|
+
}
|
2858
|
+
}
|
2859
|
+
return /* @__PURE__ */ l.jsx(Ue, { title: "Animation", items: a });
|
2860
|
+
}
|
2861
|
+
const Un = {
|
2862
|
+
name: "",
|
2863
|
+
uuid: "",
|
2864
|
+
type: "",
|
2865
|
+
visible: !1,
|
2866
|
+
matrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
2867
|
+
animations: [],
|
2868
|
+
material: void 0,
|
2869
|
+
perspectiveCameraInfo: void 0,
|
2870
|
+
orthographicCameraInfo: void 0,
|
2871
|
+
lightInfo: void 0
|
2872
|
+
};
|
2873
|
+
let te = { ...Un };
|
2874
|
+
function Ti(t) {
|
2875
|
+
const [n, a] = oe(-1);
|
2876
|
+
Be(() => {
|
2877
|
+
function p(u) {
|
2878
|
+
te = { ...u.value }, a(Date.now());
|
2879
|
+
}
|
2880
|
+
function c() {
|
2881
|
+
te = { ...Un }, a(Date.now());
|
2882
|
+
}
|
2883
|
+
return _.addEventListener(j.SET_SCENE, c), _.addEventListener(j.SET_OBJECT, p), () => {
|
2884
|
+
_.removeEventListener(j.SET_SCENE, c), _.removeEventListener(j.SET_OBJECT, p);
|
2885
|
+
};
|
2886
|
+
}, []);
|
2887
|
+
const e = te.type.toLowerCase(), o = te.animations.length > 0 || te.mixer !== void 0, s = e.search("mesh") > -1 || e.search("line") > -1 || e.search("points") > -1;
|
2888
|
+
return /* @__PURE__ */ l.jsx(Ht, { label: "Inspector", children: /* @__PURE__ */ l.jsx("div", { id: "Inspector", className: t.class, children: te.uuid.length > 0 && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
2889
|
+
/* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
2890
|
+
/* @__PURE__ */ l.jsx(
|
2891
|
+
st,
|
2892
|
+
{
|
2893
|
+
type: "string",
|
2894
|
+
title: "Name",
|
2895
|
+
prop: "name",
|
2896
|
+
value: te.name,
|
2897
|
+
disabled: !0
|
2898
|
+
}
|
2899
|
+
),
|
2900
|
+
/* @__PURE__ */ l.jsx(
|
2901
|
+
st,
|
2902
|
+
{
|
2903
|
+
type: "string",
|
2904
|
+
title: "Type",
|
2905
|
+
prop: "type",
|
2906
|
+
value: te.type,
|
2907
|
+
disabled: !0
|
2908
|
+
}
|
2909
|
+
),
|
2910
|
+
/* @__PURE__ */ l.jsx(
|
2911
|
+
st,
|
2912
|
+
{
|
2913
|
+
type: "string",
|
2914
|
+
title: "UUID",
|
2915
|
+
prop: "uuid",
|
2916
|
+
value: te.uuid,
|
2917
|
+
disabled: !0
|
2918
|
+
}
|
2919
|
+
),
|
2920
|
+
/* @__PURE__ */ l.jsx(
|
2921
|
+
st,
|
2922
|
+
{
|
2923
|
+
type: "boolean",
|
2924
|
+
title: "Visible",
|
2925
|
+
prop: "visible",
|
2926
|
+
value: te.visible,
|
2927
|
+
onChange: (p, c) => {
|
2928
|
+
t.three.updateObject(te.uuid, p, c);
|
2929
|
+
const u = t.three.scene?.getObjectByProperty("uuid", te.uuid);
|
2930
|
+
u !== void 0 && ee(u, p, c);
|
2931
|
+
}
|
2932
|
+
}
|
2933
|
+
)
|
2934
|
+
] }),
|
2935
|
+
/* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
2936
|
+
wi(te, t.three),
|
2937
|
+
o ? Mi(te, t.three) : null,
|
2938
|
+
e.search("camera") > -1 ? Ei(te, t.three) : null,
|
2939
|
+
e.search("light") > -1 ? Oi(te, t.three) : null,
|
2940
|
+
s ? yi(te, t.three) : null
|
2941
|
+
] })
|
2942
|
+
] }) }, n) }, "Inspector");
|
2943
|
+
}
|
2944
|
+
class Hi extends Ta {
|
2945
|
+
three;
|
2946
|
+
constructor(n) {
|
2947
|
+
super(n), this.state = {
|
2948
|
+
scene: n.scene !== void 0 ? n.scene : null
|
2949
|
+
}, this.three = n.three, _.addEventListener(j.SET_SCENE, this.setScene);
|
2950
|
+
}
|
2951
|
+
componentWillUnmount() {
|
2952
|
+
_.removeEventListener(j.SET_SCENE, this.setScene);
|
2953
|
+
}
|
2954
|
+
render() {
|
2955
|
+
const n = this.componentState.scene !== null, a = "Hierarchy - " + (n ? `${this.componentState.scene?.name}` : "No Scene");
|
2956
|
+
return /* @__PURE__ */ l.jsx("div", { id: "SidePanel", children: /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
2957
|
+
/* @__PURE__ */ l.jsx(Ht, { label: a, open: !0, children: /* @__PURE__ */ l.jsx(l.Fragment, { children: n && /* @__PURE__ */ l.jsx(ci, { child: this.componentState.scene, three: this.three }) }) }),
|
2958
|
+
/* @__PURE__ */ l.jsx(Ti, { three: this.three })
|
2959
|
+
] }) }, "SidePanel");
|
2960
|
+
}
|
2961
|
+
// Private
|
2962
|
+
setScene = (n) => {
|
2963
|
+
this.setState(() => ({
|
2964
|
+
scene: n.value
|
2965
|
+
}));
|
2966
|
+
};
|
2967
|
+
// Getters / Setters
|
2968
|
+
get componentState() {
|
2969
|
+
return this.state;
|
2970
|
+
}
|
2971
|
+
}
|
2972
|
+
function Wi(t) {
|
2973
|
+
function n() {
|
2974
|
+
return t.three.scene === void 0 ? (console.log("No scene:", t.three), !1) : !0;
|
2975
|
+
}
|
2976
|
+
const a = (c) => {
|
2977
|
+
if (!n())
|
2978
|
+
return;
|
2979
|
+
const u = t.three.scene?.getObjectByProperty("uuid", c.value);
|
2980
|
+
u !== void 0 && t.three.setObject(u);
|
2981
|
+
}, e = (c, u, d) => {
|
2982
|
+
if (!n())
|
2983
|
+
return;
|
2984
|
+
const v = t.three.scene?.getObjectByProperty("uuid", c);
|
2985
|
+
v !== void 0 && ee(v, u, d);
|
2986
|
+
}, o = (c) => {
|
2987
|
+
if (!n())
|
2988
|
+
return;
|
2989
|
+
const u = c.value, { key: d, value: v, uuid: b } = u;
|
2990
|
+
e(b, d, v);
|
2991
|
+
}, s = (c) => {
|
2992
|
+
if (!n())
|
2993
|
+
return;
|
2994
|
+
const u = c.value;
|
2995
|
+
Gt(u.value).then((d) => {
|
2996
|
+
e(u.uuid, u.key, d), e(u.uuid, "material.needsUpdate", !0);
|
2997
|
+
});
|
2998
|
+
}, p = (c) => {
|
2999
|
+
if (!n())
|
3000
|
+
return;
|
3001
|
+
const { key: u, uuid: d, value: v, subitem: b } = c.value, E = t.three.scene?.getObjectByProperty("uuid", d);
|
3002
|
+
if (E !== void 0)
|
3003
|
+
try {
|
3004
|
+
b !== void 0 ? za(E, b)[u](v) : E[u](v);
|
3005
|
+
} catch (x) {
|
3006
|
+
console.log("Error requesting method:"), console.log(x), console.log(u), console.log(v);
|
3007
|
+
}
|
3008
|
+
};
|
3009
|
+
return Be(() => (_.addEventListener(j.GET_OBJECT, a), _.addEventListener(j.UPDATE_OBJECT, o), _.addEventListener(j.CREATE_TEXTURE, s), _.addEventListener(j.REQUEST_METHOD, p), () => {
|
3010
|
+
_.removeEventListener(j.GET_OBJECT, a), _.removeEventListener(j.UPDATE_OBJECT, o), _.removeEventListener(j.CREATE_TEXTURE, s), _.removeEventListener(j.REQUEST_METHOD, p);
|
3011
|
+
}), []), null;
|
3012
|
+
}
|
3013
|
+
const an = { type: "change" }, $t = { type: "start" }, rn = { type: "end" }, St = new ha(), on = new pa(), Ri = Math.cos(70 * ma.DEG2RAD);
|
3014
|
+
class Pi extends un {
|
3015
|
+
constructor(n, a) {
|
3016
|
+
super(), this.object = n, this.domElement = a, this.domElement.style.touchAction = "none", this.enabled = !0, this.target = new X(), this.cursor = new X(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: He.ROTATE, MIDDLE: He.DOLLY, RIGHT: He.PAN }, this.touches = { ONE: We.ROTATE, TWO: We.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this.getPolarAngle = function() {
|
3017
|
+
return c.phi;
|
3018
|
+
}, this.getAzimuthalAngle = function() {
|
3019
|
+
return c.theta;
|
3020
|
+
}, this.getDistance = function() {
|
3021
|
+
return this.object.position.distanceTo(this.target);
|
3022
|
+
}, this.listenToKeyEvents = function(r) {
|
3023
|
+
r.addEventListener("keydown", tt), this._domElementKeyEvents = r;
|
3024
|
+
}, this.stopListenToKeyEvents = function() {
|
3025
|
+
this._domElementKeyEvents.removeEventListener("keydown", tt), this._domElementKeyEvents = null;
|
3026
|
+
}, this.saveState = function() {
|
3027
|
+
e.target0.copy(e.target), e.position0.copy(e.object.position), e.zoom0 = e.object.zoom;
|
3028
|
+
}, this.reset = function() {
|
3029
|
+
e.target.copy(e.target0), e.object.position.copy(e.position0), e.object.zoom = e.zoom0, e.object.updateProjectionMatrix(), e.dispatchEvent(an), e.update(), s = o.NONE;
|
3030
|
+
}, this.update = function() {
|
3031
|
+
const r = new X(), y = new Xt().setFromUnitVectors(n.up, new X(0, 1, 0)), O = y.clone().invert(), L = new X(), K = new Xt(), de = new X(), ae = 2 * Math.PI;
|
3032
|
+
return function(Nt = null) {
|
3033
|
+
const at = e.object.position;
|
3034
|
+
r.copy(at).sub(e.target), r.applyQuaternion(y), c.setFromVector3(r), e.autoRotate && s === o.NONE && U(P(Nt)), e.enableDamping ? (c.theta += u.theta * e.dampingFactor, c.phi += u.phi * e.dampingFactor) : (c.theta += u.theta, c.phi += u.phi);
|
3035
|
+
let pe = e.minAzimuthAngle, fe = e.maxAzimuthAngle;
|
3036
|
+
isFinite(pe) && isFinite(fe) && (pe < -Math.PI ? pe += ae : pe > Math.PI && (pe -= ae), fe < -Math.PI ? fe += ae : fe > Math.PI && (fe -= ae), pe <= fe ? c.theta = Math.max(pe, Math.min(fe, c.theta)) : c.theta = c.theta > (pe + fe) / 2 ? Math.max(pe, c.theta) : Math.min(fe, c.theta)), c.phi = Math.max(e.minPolarAngle, Math.min(e.maxPolarAngle, c.phi)), c.makeSafe(), e.enableDamping === !0 ? e.target.addScaledVector(v, e.dampingFactor) : e.target.add(v), e.target.sub(e.cursor), e.target.clampLength(e.minTargetRadius, e.maxTargetRadius), e.target.add(e.cursor), e.zoomToCursor && se || e.object.isOrthographicCamera ? c.radius = me(c.radius) : c.radius = me(c.radius * d), r.setFromSpherical(c), r.applyQuaternion(O), at.copy(e.target).add(r), e.object.lookAt(e.target), e.enableDamping === !0 ? (u.theta *= 1 - e.dampingFactor, u.phi *= 1 - e.dampingFactor, v.multiplyScalar(1 - e.dampingFactor)) : (u.set(0, 0, 0), v.set(0, 0, 0));
|
3037
|
+
let ke = !1;
|
3038
|
+
if (e.zoomToCursor && se) {
|
3039
|
+
let _e = null;
|
3040
|
+
if (e.object.isPerspectiveCamera) {
|
3041
|
+
const je = r.length();
|
3042
|
+
_e = me(je * d);
|
3043
|
+
const De = je - _e;
|
3044
|
+
e.object.position.addScaledVector(Ee, De), e.object.updateMatrixWorld();
|
3045
|
+
} else if (e.object.isOrthographicCamera) {
|
3046
|
+
const je = new X(le.x, le.y, 0);
|
3047
|
+
je.unproject(e.object), e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / d)), e.object.updateProjectionMatrix(), ke = !0;
|
3048
|
+
const De = new X(le.x, le.y, 0);
|
3049
|
+
De.unproject(e.object), e.object.position.sub(De).add(je), e.object.updateMatrixWorld(), _e = r.length();
|
3050
|
+
} else
|
3051
|
+
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), e.zoomToCursor = !1;
|
3052
|
+
_e !== null && (this.screenSpacePanning ? e.target.set(0, 0, -1).transformDirection(e.object.matrix).multiplyScalar(_e).add(e.object.position) : (St.origin.copy(e.object.position), St.direction.set(0, 0, -1).transformDirection(e.object.matrix), Math.abs(e.object.up.dot(St.direction)) < Ri ? n.lookAt(e.target) : (on.setFromNormalAndCoplanarPoint(e.object.up, e.target), St.intersectPlane(on, e.target))));
|
3053
|
+
} else
|
3054
|
+
e.object.isOrthographicCamera && (ke = d !== 1, ke && (e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / d)), e.object.updateProjectionMatrix()));
|
3055
|
+
return d = 1, se = !1, ke || L.distanceToSquared(e.object.position) > p || 8 * (1 - K.dot(e.object.quaternion)) > p || de.distanceToSquared(e.target) > 0 ? (e.dispatchEvent(an), L.copy(e.object.position), K.copy(e.object.quaternion), de.copy(e.target), !0) : !1;
|
3056
|
+
};
|
3057
|
+
}(), this.dispose = function() {
|
3058
|
+
e.domElement.removeEventListener("contextmenu", Ge), e.domElement.removeEventListener("pointerdown", Pe), e.domElement.removeEventListener("pointercancel", Ae), e.domElement.removeEventListener("wheel", bt), e.domElement.removeEventListener("pointermove", Qe), e.domElement.removeEventListener("pointerup", Ae), e._domElementKeyEvents !== null && (e._domElementKeyEvents.removeEventListener("keydown", tt), e._domElementKeyEvents = null);
|
3059
|
+
};
|
3060
|
+
const e = this, o = {
|
3061
|
+
NONE: -1,
|
3062
|
+
ROTATE: 0,
|
3063
|
+
DOLLY: 1,
|
3064
|
+
PAN: 2,
|
3065
|
+
TOUCH_ROTATE: 3,
|
3066
|
+
TOUCH_PAN: 4,
|
3067
|
+
TOUCH_DOLLY_PAN: 5,
|
3068
|
+
TOUCH_DOLLY_ROTATE: 6
|
3069
|
+
};
|
3070
|
+
let s = o.NONE;
|
3071
|
+
const p = 1e-6, c = new Zt(), u = new Zt();
|
3072
|
+
let d = 1;
|
3073
|
+
const v = new X(), b = new ue(), E = new ue(), x = new ue(), M = new ue(), k = new ue(), H = new ue(), B = new ue(), S = new ue(), z = new ue(), Ee = new X(), le = new ue();
|
3074
|
+
let se = !1;
|
3075
|
+
const f = [], m = {};
|
3076
|
+
let w = !1;
|
3077
|
+
function P(r) {
|
3078
|
+
return r !== null ? 2 * Math.PI / 60 * e.autoRotateSpeed * r : 2 * Math.PI / 60 / 60 * e.autoRotateSpeed;
|
3079
|
+
}
|
3080
|
+
function Y(r) {
|
3081
|
+
const y = Math.abs(r * 0.01);
|
3082
|
+
return Math.pow(0.95, e.zoomSpeed * y);
|
3083
|
+
}
|
3084
|
+
function U(r) {
|
3085
|
+
u.theta -= r;
|
3086
|
+
}
|
3087
|
+
function $(r) {
|
3088
|
+
u.phi -= r;
|
3089
|
+
}
|
3090
|
+
const I = function() {
|
3091
|
+
const r = new X();
|
3092
|
+
return function(O, L) {
|
3093
|
+
r.setFromMatrixColumn(L, 0), r.multiplyScalar(-O), v.add(r);
|
3094
|
+
};
|
3095
|
+
}(), W = function() {
|
3096
|
+
const r = new X();
|
3097
|
+
return function(O, L) {
|
3098
|
+
e.screenSpacePanning === !0 ? r.setFromMatrixColumn(L, 1) : (r.setFromMatrixColumn(L, 0), r.crossVectors(e.object.up, r)), r.multiplyScalar(O), v.add(r);
|
3099
|
+
};
|
3100
|
+
}(), q = function() {
|
3101
|
+
const r = new X();
|
3102
|
+
return function(O, L) {
|
3103
|
+
const K = e.domElement;
|
3104
|
+
if (e.object.isPerspectiveCamera) {
|
3105
|
+
const de = e.object.position;
|
3106
|
+
r.copy(de).sub(e.target);
|
3107
|
+
let ae = r.length();
|
3108
|
+
ae *= Math.tan(e.object.fov / 2 * Math.PI / 180), I(2 * O * ae / K.clientHeight, e.object.matrix), W(2 * L * ae / K.clientHeight, e.object.matrix);
|
3109
|
+
} else
|
3110
|
+
e.object.isOrthographicCamera ? (I(O * (e.object.right - e.object.left) / e.object.zoom / K.clientWidth, e.object.matrix), W(L * (e.object.top - e.object.bottom) / e.object.zoom / K.clientHeight, e.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), e.enablePan = !1);
|
3111
|
+
};
|
3112
|
+
}();
|
3113
|
+
function T(r) {
|
3114
|
+
e.object.isPerspectiveCamera || e.object.isOrthographicCamera ? d /= r : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
|
3115
|
+
}
|
3116
|
+
function N(r) {
|
3117
|
+
e.object.isPerspectiveCamera || e.object.isOrthographicCamera ? d *= r : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
|
3118
|
+
}
|
3119
|
+
function J(r, y) {
|
3120
|
+
if (!e.zoomToCursor)
|
3121
|
+
return;
|
3122
|
+
se = !0;
|
3123
|
+
const O = e.domElement.getBoundingClientRect(), L = r - O.left, K = y - O.top, de = O.width, ae = O.height;
|
3124
|
+
le.x = L / de * 2 - 1, le.y = -(K / ae) * 2 + 1, Ee.set(le.x, le.y, 1).unproject(e.object).sub(e.object.position).normalize();
|
3125
|
+
}
|
3126
|
+
function me(r) {
|
3127
|
+
return Math.max(e.minDistance, Math.min(e.maxDistance, r));
|
3128
|
+
}
|
3129
|
+
function Ce(r) {
|
3130
|
+
b.set(r.clientX, r.clientY);
|
3131
|
+
}
|
3132
|
+
function ft(r) {
|
3133
|
+
J(r.clientX, r.clientX), B.set(r.clientX, r.clientY);
|
3134
|
+
}
|
3135
|
+
function Xe(r) {
|
3136
|
+
M.set(r.clientX, r.clientY);
|
3137
|
+
}
|
3138
|
+
function At(r) {
|
3139
|
+
E.set(r.clientX, r.clientY), x.subVectors(E, b).multiplyScalar(e.rotateSpeed);
|
3140
|
+
const y = e.domElement;
|
3141
|
+
U(2 * Math.PI * x.x / y.clientHeight), $(2 * Math.PI * x.y / y.clientHeight), b.copy(E), e.update();
|
3142
|
+
}
|
3143
|
+
function kt(r) {
|
3144
|
+
S.set(r.clientX, r.clientY), z.subVectors(S, B), z.y > 0 ? T(Y(z.y)) : z.y < 0 && N(Y(z.y)), B.copy(S), e.update();
|
3145
|
+
}
|
3146
|
+
function Ze(r) {
|
3147
|
+
k.set(r.clientX, r.clientY), H.subVectors(k, M).multiplyScalar(e.panSpeed), q(H.x, H.y), M.copy(k), e.update();
|
3148
|
+
}
|
3149
|
+
function Je(r) {
|
3150
|
+
J(r.clientX, r.clientY), r.deltaY < 0 ? N(Y(r.deltaY)) : r.deltaY > 0 && T(Y(r.deltaY)), e.update();
|
3151
|
+
}
|
3152
|
+
function ze(r) {
|
3153
|
+
let y = !1;
|
3154
|
+
switch (r.code) {
|
3155
|
+
case e.keys.UP:
|
3156
|
+
r.ctrlKey || r.metaKey || r.shiftKey ? $(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : q(0, e.keyPanSpeed), y = !0;
|
3157
|
+
break;
|
3158
|
+
case e.keys.BOTTOM:
|
3159
|
+
r.ctrlKey || r.metaKey || r.shiftKey ? $(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : q(0, -e.keyPanSpeed), y = !0;
|
3160
|
+
break;
|
3161
|
+
case e.keys.LEFT:
|
3162
|
+
r.ctrlKey || r.metaKey || r.shiftKey ? U(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : q(e.keyPanSpeed, 0), y = !0;
|
3163
|
+
break;
|
3164
|
+
case e.keys.RIGHT:
|
3165
|
+
r.ctrlKey || r.metaKey || r.shiftKey ? U(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : q(-e.keyPanSpeed, 0), y = !0;
|
3166
|
+
break;
|
3167
|
+
}
|
3168
|
+
y && (r.preventDefault(), e.update());
|
3169
|
+
}
|
3170
|
+
function Ye(r) {
|
3171
|
+
if (f.length === 1)
|
3172
|
+
b.set(r.pageX, r.pageY);
|
3173
|
+
else {
|
3174
|
+
const y = Se(r), O = 0.5 * (r.pageX + y.x), L = 0.5 * (r.pageY + y.y);
|
3175
|
+
b.set(O, L);
|
3176
|
+
}
|
3177
|
+
}
|
3178
|
+
function Me(r) {
|
3179
|
+
if (f.length === 1)
|
3180
|
+
M.set(r.pageX, r.pageY);
|
3181
|
+
else {
|
3182
|
+
const y = Se(r), O = 0.5 * (r.pageX + y.x), L = 0.5 * (r.pageY + y.y);
|
3183
|
+
M.set(O, L);
|
3184
|
+
}
|
3185
|
+
}
|
3186
|
+
function ht(r) {
|
3187
|
+
const y = Se(r), O = r.pageX - y.x, L = r.pageY - y.y, K = Math.sqrt(O * O + L * L);
|
3188
|
+
B.set(0, K);
|
3189
|
+
}
|
3190
|
+
function pt(r) {
|
3191
|
+
e.enableZoom && ht(r), e.enablePan && Me(r);
|
3192
|
+
}
|
3193
|
+
function _t(r) {
|
3194
|
+
e.enableZoom && ht(r), e.enableRotate && Ye(r);
|
3195
|
+
}
|
3196
|
+
function mt(r) {
|
3197
|
+
if (f.length == 1)
|
3198
|
+
E.set(r.pageX, r.pageY);
|
3199
|
+
else {
|
3200
|
+
const O = Se(r), L = 0.5 * (r.pageX + O.x), K = 0.5 * (r.pageY + O.y);
|
3201
|
+
E.set(L, K);
|
3202
|
+
}
|
3203
|
+
x.subVectors(E, b).multiplyScalar(e.rotateSpeed);
|
3204
|
+
const y = e.domElement;
|
3205
|
+
U(2 * Math.PI * x.x / y.clientHeight), $(2 * Math.PI * x.y / y.clientHeight), b.copy(E);
|
3206
|
+
}
|
3207
|
+
function Te(r) {
|
3208
|
+
if (f.length === 1)
|
3209
|
+
k.set(r.pageX, r.pageY);
|
3210
|
+
else {
|
3211
|
+
const y = Se(r), O = 0.5 * (r.pageX + y.x), L = 0.5 * (r.pageY + y.y);
|
3212
|
+
k.set(O, L);
|
3213
|
+
}
|
3214
|
+
H.subVectors(k, M).multiplyScalar(e.panSpeed), q(H.x, H.y), M.copy(k);
|
3215
|
+
}
|
3216
|
+
function Re(r) {
|
3217
|
+
const y = Se(r), O = r.pageX - y.x, L = r.pageY - y.y, K = Math.sqrt(O * O + L * L);
|
3218
|
+
S.set(0, K), z.set(0, Math.pow(S.y / B.y, e.zoomSpeed)), T(z.y), B.copy(S);
|
3219
|
+
const de = (r.pageX + y.x) * 0.5, ae = (r.pageY + y.y) * 0.5;
|
3220
|
+
J(de, ae);
|
3221
|
+
}
|
3222
|
+
function vt(r) {
|
3223
|
+
e.enableZoom && Re(r), e.enablePan && Te(r);
|
3224
|
+
}
|
3225
|
+
function gt(r) {
|
3226
|
+
e.enableZoom && Re(r), e.enableRotate && mt(r);
|
3227
|
+
}
|
3228
|
+
function Pe(r) {
|
3229
|
+
e.enabled !== !1 && (f.length === 0 && (e.domElement.setPointerCapture(r.pointerId), e.domElement.addEventListener("pointermove", Qe), e.domElement.addEventListener("pointerup", Ae)), Dt(r), r.pointerType === "touch" ? nt(r) : et(r));
|
3230
|
+
}
|
3231
|
+
function Qe(r) {
|
3232
|
+
e.enabled !== !1 && (r.pointerType === "touch" ? Ct(r) : jt(r));
|
3233
|
+
}
|
3234
|
+
function Ae(r) {
|
3235
|
+
switch (It(r), f.length) {
|
3236
|
+
case 0:
|
3237
|
+
e.domElement.releasePointerCapture(r.pointerId), e.domElement.removeEventListener("pointermove", Qe), e.domElement.removeEventListener("pointerup", Ae), e.dispatchEvent(rn), s = o.NONE;
|
3238
|
+
break;
|
3239
|
+
case 1:
|
3240
|
+
const y = f[0], O = m[y];
|
3241
|
+
nt({ pointerId: y, pageX: O.x, pageY: O.y });
|
3242
|
+
break;
|
3243
|
+
}
|
3244
|
+
}
|
3245
|
+
function et(r) {
|
3246
|
+
let y;
|
3247
|
+
switch (r.button) {
|
3248
|
+
case 0:
|
3249
|
+
y = e.mouseButtons.LEFT;
|
3250
|
+
break;
|
3251
|
+
case 1:
|
3252
|
+
y = e.mouseButtons.MIDDLE;
|
3253
|
+
break;
|
3254
|
+
case 2:
|
3255
|
+
y = e.mouseButtons.RIGHT;
|
3256
|
+
break;
|
3257
|
+
default:
|
3258
|
+
y = -1;
|
3259
|
+
}
|
3260
|
+
switch (y) {
|
3261
|
+
case He.DOLLY:
|
3262
|
+
if (e.enableZoom === !1)
|
3263
|
+
return;
|
3264
|
+
ft(r), s = o.DOLLY;
|
3265
|
+
break;
|
3266
|
+
case He.ROTATE:
|
3267
|
+
if (r.ctrlKey || r.metaKey || r.shiftKey) {
|
3268
|
+
if (e.enablePan === !1)
|
3269
|
+
return;
|
3270
|
+
Xe(r), s = o.PAN;
|
3271
|
+
} else {
|
3272
|
+
if (e.enableRotate === !1)
|
3273
|
+
return;
|
3274
|
+
Ce(r), s = o.ROTATE;
|
3275
|
+
}
|
3276
|
+
break;
|
3277
|
+
case He.PAN:
|
3278
|
+
if (r.ctrlKey || r.metaKey || r.shiftKey) {
|
3279
|
+
if (e.enableRotate === !1)
|
3280
|
+
return;
|
3281
|
+
Ce(r), s = o.ROTATE;
|
3282
|
+
} else {
|
3283
|
+
if (e.enablePan === !1)
|
3284
|
+
return;
|
3285
|
+
Xe(r), s = o.PAN;
|
3286
|
+
}
|
3287
|
+
break;
|
3288
|
+
default:
|
3289
|
+
s = o.NONE;
|
3290
|
+
}
|
3291
|
+
s !== o.NONE && e.dispatchEvent($t);
|
3292
|
+
}
|
3293
|
+
function jt(r) {
|
3294
|
+
switch (s) {
|
3295
|
+
case o.ROTATE:
|
3296
|
+
if (e.enableRotate === !1)
|
3297
|
+
return;
|
3298
|
+
At(r);
|
3299
|
+
break;
|
3300
|
+
case o.DOLLY:
|
3301
|
+
if (e.enableZoom === !1)
|
3302
|
+
return;
|
3303
|
+
kt(r);
|
3304
|
+
break;
|
3305
|
+
case o.PAN:
|
3306
|
+
if (e.enablePan === !1)
|
3307
|
+
return;
|
3308
|
+
Ze(r);
|
3309
|
+
break;
|
3310
|
+
}
|
3311
|
+
}
|
3312
|
+
function bt(r) {
|
3313
|
+
e.enabled === !1 || e.enableZoom === !1 || s !== o.NONE || (r.preventDefault(), e.dispatchEvent($t), Je(yt(r)), e.dispatchEvent(rn));
|
3314
|
+
}
|
3315
|
+
function yt(r) {
|
3316
|
+
const y = r.deltaMode, O = {
|
3317
|
+
clientX: r.clientX,
|
3318
|
+
clientY: r.clientY,
|
3319
|
+
deltaY: r.deltaY
|
3320
|
+
};
|
3321
|
+
switch (y) {
|
3322
|
+
case 1:
|
3323
|
+
O.deltaY *= 16;
|
3324
|
+
break;
|
3325
|
+
case 2:
|
3326
|
+
O.deltaY *= 100;
|
3327
|
+
break;
|
3328
|
+
}
|
3329
|
+
return r.ctrlKey && !w && (O.deltaY *= 10), O;
|
3330
|
+
}
|
3331
|
+
function Et(r) {
|
3332
|
+
r.key === "Control" && (w = !0, e.domElement.getRootNode().addEventListener("keyup", xe, { passive: !0, capture: !0 }));
|
3333
|
+
}
|
3334
|
+
function xe(r) {
|
3335
|
+
r.key === "Control" && (w = !1, e.domElement.getRootNode().removeEventListener("keyup", xe, { passive: !0, capture: !0 }));
|
3336
|
+
}
|
3337
|
+
function tt(r) {
|
3338
|
+
e.enabled === !1 || e.enablePan === !1 || ze(r);
|
3339
|
+
}
|
3340
|
+
function nt(r) {
|
3341
|
+
switch (xt(r), f.length) {
|
3342
|
+
case 1:
|
3343
|
+
switch (e.touches.ONE) {
|
3344
|
+
case We.ROTATE:
|
3345
|
+
if (e.enableRotate === !1)
|
3346
|
+
return;
|
3347
|
+
Ye(r), s = o.TOUCH_ROTATE;
|
3348
|
+
break;
|
3349
|
+
case We.PAN:
|
3350
|
+
if (e.enablePan === !1)
|
3351
|
+
return;
|
3352
|
+
Me(r), s = o.TOUCH_PAN;
|
3353
|
+
break;
|
3354
|
+
default:
|
3355
|
+
s = o.NONE;
|
3356
|
+
}
|
3357
|
+
break;
|
3358
|
+
case 2:
|
3359
|
+
switch (e.touches.TWO) {
|
3360
|
+
case We.DOLLY_PAN:
|
3361
|
+
if (e.enableZoom === !1 && e.enablePan === !1)
|
3362
|
+
return;
|
3363
|
+
pt(r), s = o.TOUCH_DOLLY_PAN;
|
3364
|
+
break;
|
3365
|
+
case We.DOLLY_ROTATE:
|
3366
|
+
if (e.enableZoom === !1 && e.enableRotate === !1)
|
3367
|
+
return;
|
3368
|
+
_t(r), s = o.TOUCH_DOLLY_ROTATE;
|
3369
|
+
break;
|
3370
|
+
default:
|
3371
|
+
s = o.NONE;
|
3372
|
+
}
|
3373
|
+
break;
|
3374
|
+
default:
|
3375
|
+
s = o.NONE;
|
3376
|
+
}
|
3377
|
+
s !== o.NONE && e.dispatchEvent($t);
|
3378
|
+
}
|
3379
|
+
function Ct(r) {
|
3380
|
+
switch (xt(r), s) {
|
3381
|
+
case o.TOUCH_ROTATE:
|
3382
|
+
if (e.enableRotate === !1)
|
3383
|
+
return;
|
3384
|
+
mt(r), e.update();
|
3385
|
+
break;
|
3386
|
+
case o.TOUCH_PAN:
|
3387
|
+
if (e.enablePan === !1)
|
3388
|
+
return;
|
3389
|
+
Te(r), e.update();
|
3390
|
+
break;
|
3391
|
+
case o.TOUCH_DOLLY_PAN:
|
3392
|
+
if (e.enableZoom === !1 && e.enablePan === !1)
|
3393
|
+
return;
|
3394
|
+
vt(r), e.update();
|
3395
|
+
break;
|
3396
|
+
case o.TOUCH_DOLLY_ROTATE:
|
3397
|
+
if (e.enableZoom === !1 && e.enableRotate === !1)
|
3398
|
+
return;
|
3399
|
+
gt(r), e.update();
|
3400
|
+
break;
|
3401
|
+
default:
|
3402
|
+
s = o.NONE;
|
3403
|
+
}
|
3404
|
+
}
|
3405
|
+
function Ge(r) {
|
3406
|
+
e.enabled !== !1 && r.preventDefault();
|
3407
|
+
}
|
3408
|
+
function Dt(r) {
|
3409
|
+
f.push(r.pointerId);
|
3410
|
+
}
|
3411
|
+
function It(r) {
|
3412
|
+
delete m[r.pointerId];
|
3413
|
+
for (let y = 0; y < f.length; y++)
|
3414
|
+
if (f[y] == r.pointerId) {
|
3415
|
+
f.splice(y, 1);
|
3416
|
+
return;
|
3417
|
+
}
|
3418
|
+
}
|
3419
|
+
function xt(r) {
|
3420
|
+
let y = m[r.pointerId];
|
3421
|
+
y === void 0 && (y = new ue(), m[r.pointerId] = y), y.set(r.pageX, r.pageY);
|
3422
|
+
}
|
3423
|
+
function Se(r) {
|
3424
|
+
const y = r.pointerId === f[0] ? f[1] : f[0];
|
3425
|
+
return m[y];
|
3426
|
+
}
|
3427
|
+
e.domElement.addEventListener("contextmenu", Ge), e.domElement.addEventListener("pointerdown", Pe), e.domElement.addEventListener("pointercancel", Ae), e.domElement.addEventListener("wheel", bt, { passive: !1 }), e.domElement.getRootNode().addEventListener("keydown", Et, { passive: !0, capture: !0 }), this.update();
|
3428
|
+
}
|
3429
|
+
}
|
3430
|
+
const Mt = (t) => {
|
3431
|
+
const [n, a] = oe(t.options[t.index]), e = () => {
|
3432
|
+
t.onToggle(!t.open);
|
3433
|
+
}, o = (s) => {
|
3434
|
+
s !== n && (t.onSelect(s), a(s)), t.onToggle(!1);
|
3435
|
+
};
|
3436
|
+
return /* @__PURE__ */ l.jsxs("div", { className: `dropdown ${t.up === !0 ? "up" : ""}`, children: [
|
3437
|
+
/* @__PURE__ */ l.jsx("div", { className: "dropdown-toggle", onClick: e, children: n }),
|
3438
|
+
t.open && /* @__PURE__ */ l.jsx("ul", { className: "dropdown-menu", children: t.options.map((s) => /* @__PURE__ */ l.jsx("li", { onClick: () => o(s), children: s }, s)) })
|
3439
|
+
] });
|
3440
|
+
}, Le = Ra(function(n, a) {
|
3441
|
+
const [e, o] = oe(!1), s = n.options.indexOf(n.camera.name);
|
3442
|
+
return /* @__PURE__ */ l.jsxs("div", { className: "CameraWindow", children: [
|
3443
|
+
/* @__PURE__ */ l.jsx("div", { ref: a, className: "clickable", onClick: () => {
|
3444
|
+
e && o(!1);
|
3445
|
+
} }),
|
3446
|
+
/* @__PURE__ */ l.jsx(
|
3447
|
+
Mt,
|
3448
|
+
{
|
3449
|
+
index: s,
|
3450
|
+
open: e,
|
3451
|
+
options: n.options,
|
3452
|
+
onSelect: n.onSelect,
|
3453
|
+
onToggle: (p) => {
|
3454
|
+
o(p);
|
3455
|
+
},
|
3456
|
+
up: !0
|
3457
|
+
}
|
3458
|
+
)
|
3459
|
+
] });
|
3460
|
+
}), sn = [
|
3461
|
+
"Single",
|
3462
|
+
"Side by Side",
|
3463
|
+
"Stacked",
|
3464
|
+
"Quad"
|
3465
|
+
], ne = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ new Map(), ge = /* @__PURE__ */ new Map();
|
3466
|
+
function $e(t, n) {
|
3467
|
+
const a = new Rn(-100, 100, 100, -100, 50, 3e3);
|
3468
|
+
return a.name = t, a.position.copy(n), a.lookAt(0, 0, 0), ne.set(t, a), a;
|
3469
|
+
}
|
3470
|
+
$e("Top", new X(0, 1e3, 0));
|
3471
|
+
$e("Bottom", new X(0, -1e3, 0));
|
3472
|
+
$e("Left", new X(-1e3, 0, 0));
|
3473
|
+
$e("Right", new X(1e3, 0, 0));
|
3474
|
+
$e("Front", new X(0, 0, 1e3));
|
3475
|
+
$e("Back", new X(0, 0, -1e3));
|
3476
|
+
$e("Orthographic", new X(1e3, 1e3, 1e3));
|
3477
|
+
const Pt = new zt(60, 1, 50, 3e3);
|
3478
|
+
Pt.name = "Debug";
|
3479
|
+
Pt.position.set(500, 500, 500);
|
3480
|
+
Pt.lookAt(0, 0, 0);
|
3481
|
+
ne.set("Debug", Pt);
|
3482
|
+
const cn = [
|
3483
|
+
"Renderer",
|
3484
|
+
"Depth",
|
3485
|
+
"Normals",
|
3486
|
+
"UVs",
|
3487
|
+
"Wireframe"
|
3488
|
+
], Ai = new va(), ki = new ga(), _i = new si(), ji = new ba({
|
3489
|
+
opacity: 0.33,
|
3490
|
+
transparent: !0,
|
3491
|
+
wireframe: !0
|
3492
|
+
});
|
3493
|
+
let wt = "Renderer";
|
3494
|
+
const V = new Pn();
|
3495
|
+
V.name = "Debug Scene";
|
3496
|
+
let be = new Pn();
|
3497
|
+
V.add(be);
|
3498
|
+
const dt = new ya();
|
3499
|
+
dt.name = "helpers";
|
3500
|
+
V.add(dt);
|
3501
|
+
const Di = new ii();
|
3502
|
+
dt.add(Di);
|
3503
|
+
const $n = new An(500);
|
3504
|
+
$n.name = "axisHelper";
|
3505
|
+
dt.add($n);
|
3506
|
+
const ut = new An(100);
|
3507
|
+
ut.name = "interactionHelper";
|
3508
|
+
dt.add(ut);
|
3509
|
+
ut.visible = !1;
|
3510
|
+
let Ot = !1, G = ne.get("Debug"), re = ne.get("Orthographic"), Ne = ne.get("Front"), Fe = ne.get("Top"), ln = !1;
|
3511
|
+
function qi(t) {
|
3512
|
+
const [n, a] = oe(t.mode !== void 0 ? t.mode : "Single"), [e, o] = oe(null), [s, p] = oe(!1), [c, u] = oe(!1), [d, v] = oe(!1), [, b] = oe(Date.now()), E = ye(null), x = ye(null), M = ye(null), k = ye(null), H = ye(null), B = ye(null), S = (f, m) => {
|
3513
|
+
const w = ie.get(f.name);
|
3514
|
+
w !== void 0 && w.dispose(), ie.delete(f.name);
|
3515
|
+
const P = ge.get(f.name);
|
3516
|
+
P !== void 0 && (V.remove(P), P.dispose()), ge.delete(f.name);
|
3517
|
+
const Y = new Pi(f, m);
|
3518
|
+
switch (Y.enableDamping = !0, Y.dampingFactor = 0.05, f.name) {
|
3519
|
+
case "Top":
|
3520
|
+
case "Bottom":
|
3521
|
+
case "Left":
|
3522
|
+
case "Right":
|
3523
|
+
case "Front":
|
3524
|
+
case "Back":
|
3525
|
+
Y.enableRotate = !1;
|
3526
|
+
break;
|
3527
|
+
}
|
3528
|
+
if (ie.set(f.name, Y), f instanceof zt) {
|
3529
|
+
const U = new xa(f);
|
3530
|
+
ge.set(f.name, U), V.add(U);
|
3531
|
+
}
|
3532
|
+
}, z = (f) => {
|
3533
|
+
const m = ge.get(f.name);
|
3534
|
+
m !== void 0 && (V.remove(m), m.dispose(), ge.delete(f.name));
|
3535
|
+
const w = ie.get(f.name);
|
3536
|
+
w !== void 0 && (w.dispose(), ie.delete(f.name));
|
3537
|
+
}, Ee = () => {
|
3538
|
+
ie.forEach((f, m) => {
|
3539
|
+
f.dispose();
|
3540
|
+
const w = ge.get(m);
|
3541
|
+
w !== void 0 && (V.remove(w), w.dispose()), ge.delete(m), ie.delete(m);
|
3542
|
+
}), ie.clear(), ge.clear();
|
3543
|
+
}, le = () => {
|
3544
|
+
switch (n) {
|
3545
|
+
case "Single":
|
3546
|
+
S(G, M.current);
|
3547
|
+
break;
|
3548
|
+
case "Side by Side":
|
3549
|
+
case "Stacked":
|
3550
|
+
S(G, M.current), S(re, k.current);
|
3551
|
+
break;
|
3552
|
+
case "Quad":
|
3553
|
+
S(G, M.current), S(re, k.current), S(Ne, H.current), S(Fe, B.current);
|
3554
|
+
break;
|
3555
|
+
}
|
3556
|
+
};
|
3557
|
+
Be(() => {
|
3558
|
+
const f = new Ea({
|
3559
|
+
canvas: E.current,
|
3560
|
+
stencil: !1
|
3561
|
+
});
|
3562
|
+
f.autoClear = !1, f.shadowMap.enabled = !0, f.setPixelRatio(devicePixelRatio), f.setClearColor(0), o(f);
|
3563
|
+
}, []), Be(() => {
|
3564
|
+
const f = (P) => {
|
3565
|
+
Dn(be), V.remove(be);
|
3566
|
+
const Y = t.scenes.get(P.value.name);
|
3567
|
+
if (Y !== void 0) {
|
3568
|
+
const U = new Y();
|
3569
|
+
t.onSceneSet !== void 0 && t.onSceneSet(U), be = U, t.three.scene = be, V.add(be), ln = !0;
|
3570
|
+
}
|
3571
|
+
}, m = (P) => {
|
3572
|
+
const Y = P.value, U = t.three.scene?.getObjectByProperty("uuid", Y.uuid);
|
3573
|
+
U !== void 0 && ne.set(Y.name, U), b(Date.now());
|
3574
|
+
}, w = (P) => {
|
3575
|
+
ne.delete(P.value.name), b(Date.now());
|
3576
|
+
};
|
3577
|
+
return _.addEventListener(j.SET_SCENE, f), _.addEventListener(j.ADD_CAMERA, m), _.addEventListener(j.REMOVE_CAMERA, w), () => {
|
3578
|
+
_.removeEventListener(j.SET_SCENE, f), _.removeEventListener(j.ADD_CAMERA, m), _.removeEventListener(j.REMOVE_CAMERA, w);
|
3579
|
+
};
|
3580
|
+
}, []), Be(() => {
|
3581
|
+
if (e === null)
|
3582
|
+
return;
|
3583
|
+
let f = window.innerWidth, m = window.innerHeight, w = Math.floor(f / 2), P = Math.floor(m / 2), Y = -1;
|
3584
|
+
const U = () => {
|
3585
|
+
f = window.innerWidth - 300, m = window.innerHeight, w = Math.floor(f / 2), P = Math.floor(m / 2), e.setSize(f, m);
|
3586
|
+
let T = f, N = m;
|
3587
|
+
switch (n) {
|
3588
|
+
case "Side by Side":
|
3589
|
+
T = w, N = m;
|
3590
|
+
break;
|
3591
|
+
case "Stacked":
|
3592
|
+
T = f, N = P;
|
3593
|
+
break;
|
3594
|
+
case "Quad":
|
3595
|
+
T = w, N = P;
|
3596
|
+
break;
|
3597
|
+
}
|
3598
|
+
ne.forEach((J) => {
|
3599
|
+
J instanceof Rn ? (J.left = T / -2, J.right = T / 2, J.top = N / 2, J.bottom = N / -2, J.updateProjectionMatrix()) : J instanceof zt && (J.aspect = T / N, J.updateProjectionMatrix(), ge.get(J.name)?.update());
|
3600
|
+
});
|
3601
|
+
}, $ = () => {
|
3602
|
+
e.setViewport(0, 0, f, m), e.setScissor(0, 0, f, m), e.render(V, G);
|
3603
|
+
}, I = () => {
|
3604
|
+
if (n === "Side by Side")
|
3605
|
+
e.setViewport(0, 0, w, m), e.setScissor(0, 0, w, m), e.render(V, G), e.setViewport(w, 0, w, m), e.setScissor(w, 0, w, m), e.render(V, re);
|
3606
|
+
else {
|
3607
|
+
const T = m - P;
|
3608
|
+
e.setViewport(0, T, f, P), e.setScissor(0, T, f, P), e.render(V, G), e.setViewport(0, 0, f, P), e.setScissor(0, 0, f, P), e.render(V, re);
|
3609
|
+
}
|
3610
|
+
}, W = () => {
|
3611
|
+
let T = 0, N = 0;
|
3612
|
+
N = m - P, T = 0, e.setViewport(T, N, w, P), e.setScissor(T, N, w, P), e.render(V, G), T = w, e.setViewport(T, N, w, P), e.setScissor(T, N, w, P), e.render(V, re), N = 0, T = 0, e.setViewport(T, N, w, P), e.setScissor(T, N, w, P), e.render(V, Ne), T = w, e.setViewport(T, N, w, P), e.setScissor(T, N, w, P), e.render(V, Fe);
|
3613
|
+
}, q = () => {
|
3614
|
+
switch (ie.forEach((T) => {
|
3615
|
+
T.update();
|
3616
|
+
}), t.onSceneUpdate !== void 0 && ln && t.onSceneUpdate(be), e.clear(), n) {
|
3617
|
+
case "Single":
|
3618
|
+
$();
|
3619
|
+
break;
|
3620
|
+
case "Side by Side":
|
3621
|
+
case "Stacked":
|
3622
|
+
I();
|
3623
|
+
break;
|
3624
|
+
case "Quad":
|
3625
|
+
W();
|
3626
|
+
break;
|
3627
|
+
}
|
3628
|
+
Y = requestAnimationFrame(q);
|
3629
|
+
};
|
3630
|
+
return le(), window.addEventListener("resize", U), U(), q(), () => {
|
3631
|
+
window.removeEventListener("resize", U), cancelAnimationFrame(Y), Y = -1;
|
3632
|
+
};
|
3633
|
+
}, [n, e]), Be(() => {
|
3634
|
+
if (e !== null) {
|
3635
|
+
const f = new Ca(), m = new ue(), w = ($, I, W, q) => {
|
3636
|
+
switch (n) {
|
3637
|
+
case "Quad":
|
3638
|
+
$ < W ? I < q ? f.setFromCamera(m, G) : f.setFromCamera(m, Ne) : I < q ? f.setFromCamera(m, re) : f.setFromCamera(m, Fe);
|
3639
|
+
break;
|
3640
|
+
case "Side by Side":
|
3641
|
+
$ < W ? f.setFromCamera(m, G) : f.setFromCamera(m, re);
|
3642
|
+
break;
|
3643
|
+
case "Single":
|
3644
|
+
f.setFromCamera(m, G);
|
3645
|
+
break;
|
3646
|
+
case "Stacked":
|
3647
|
+
I < q ? f.setFromCamera(m, G) : f.setFromCamera(m, re);
|
3648
|
+
break;
|
3649
|
+
}
|
3650
|
+
}, P = ($) => {
|
3651
|
+
if (!Ot)
|
3652
|
+
return;
|
3653
|
+
const I = new ue();
|
3654
|
+
e.getSize(I);
|
3655
|
+
const W = Math.min($.clientX, I.x), q = Math.min($.clientY, I.y);
|
3656
|
+
m.x = Ke(W, 0, I.x, -1, 1), m.y = Ke(q, 0, I.y, 1, -1);
|
3657
|
+
const T = I.x / 2, N = I.y / 2, J = () => {
|
3658
|
+
W < T ? m.x = Ke(W, 0, T, -1, 1) : m.x = Ke(W, T, I.x, -1, 1);
|
3659
|
+
}, me = () => {
|
3660
|
+
q < N ? m.y = Ke(q, 0, N, 1, -1) : m.y = Ke(q, N, I.y, 1, -1);
|
3661
|
+
};
|
3662
|
+
switch (n) {
|
3663
|
+
case "Quad":
|
3664
|
+
J(), me();
|
3665
|
+
break;
|
3666
|
+
case "Side by Side":
|
3667
|
+
J();
|
3668
|
+
break;
|
3669
|
+
case "Stacked":
|
3670
|
+
me(), me();
|
3671
|
+
break;
|
3672
|
+
}
|
3673
|
+
w(W, q, T, N);
|
3674
|
+
const Ce = f.intersectObjects(be.children);
|
3675
|
+
Ce.length > 0 && ut.position.copy(Ce[0].point);
|
3676
|
+
}, Y = ($) => {
|
3677
|
+
if (!Ot)
|
3678
|
+
return;
|
3679
|
+
const I = new ue();
|
3680
|
+
if (e.getSize(I), $.clientX >= I.x)
|
3681
|
+
return;
|
3682
|
+
P($);
|
3683
|
+
const W = f.intersectObjects(be.children);
|
3684
|
+
W.length > 0 && t.three.getObject(W[0].object.uuid);
|
3685
|
+
}, U = x.current;
|
3686
|
+
return U.addEventListener("mousemove", P, !1), U.addEventListener("click", Y, !1), () => {
|
3687
|
+
U.removeEventListener("mousemove", P), U.removeEventListener("click", Y);
|
3688
|
+
};
|
3689
|
+
}
|
3690
|
+
}, [n, e]);
|
3691
|
+
const se = [];
|
3692
|
+
return ne.forEach((f, m) => {
|
3693
|
+
se.push(m);
|
3694
|
+
}), /* @__PURE__ */ l.jsxs("div", { className: "multiview", children: [
|
3695
|
+
/* @__PURE__ */ l.jsx("canvas", { ref: E }),
|
3696
|
+
/* @__PURE__ */ l.jsxs("div", { className: `cameras ${n === "Single" || n === "Stacked" ? "single" : ""}`, ref: x, children: [
|
3697
|
+
n === "Single" && /* @__PURE__ */ l.jsx(l.Fragment, { children: /* @__PURE__ */ l.jsx(Le, { camera: G, options: se, ref: M, onSelect: (f) => {
|
3698
|
+
ie.get(G.name)?.dispose();
|
3699
|
+
const m = ne.get(f);
|
3700
|
+
m !== void 0 && (z(G), G = m, S(m, M.current));
|
3701
|
+
} }) }),
|
3702
|
+
(n === "Side by Side" || n === "Stacked") && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
3703
|
+
/* @__PURE__ */ l.jsx(Le, { camera: G, options: se, ref: M, onSelect: (f) => {
|
3704
|
+
ie.get(G.name)?.dispose();
|
3705
|
+
const m = ne.get(f);
|
3706
|
+
m !== void 0 && (z(G), G = m, S(m, M.current));
|
3707
|
+
} }),
|
3708
|
+
/* @__PURE__ */ l.jsx(Le, { camera: re, options: se, ref: k, onSelect: (f) => {
|
3709
|
+
ie.get(re.name)?.dispose();
|
3710
|
+
const m = ne.get(f);
|
3711
|
+
m !== void 0 && (z(re), re = m, S(m, k.current));
|
3712
|
+
} })
|
3713
|
+
] }),
|
3714
|
+
n === "Quad" && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
3715
|
+
/* @__PURE__ */ l.jsx(Le, { camera: G, options: se, ref: M, onSelect: (f) => {
|
3716
|
+
ie.get(G.name)?.dispose();
|
3717
|
+
const m = ne.get(f);
|
3718
|
+
m !== void 0 && (z(G), G = m, S(m, M.current));
|
3719
|
+
} }),
|
3720
|
+
/* @__PURE__ */ l.jsx(Le, { camera: re, options: se, ref: k, onSelect: (f) => {
|
3721
|
+
ie.get(re.name)?.dispose();
|
3722
|
+
const m = ne.get(f);
|
3723
|
+
m !== void 0 && (z(re), re = m, S(m, k.current));
|
3724
|
+
} }),
|
3725
|
+
/* @__PURE__ */ l.jsx(Le, { camera: Ne, options: se, ref: H, onSelect: (f) => {
|
3726
|
+
ie.get(Ne.name)?.dispose();
|
3727
|
+
const m = ne.get(f);
|
3728
|
+
m !== void 0 && (z(Ne), Ne = m, S(m, H.current));
|
3729
|
+
} }),
|
3730
|
+
/* @__PURE__ */ l.jsx(Le, { camera: Fe, options: se, ref: B, onSelect: (f) => {
|
3731
|
+
ie.get(Fe.name)?.dispose();
|
3732
|
+
const m = ne.get(f);
|
3733
|
+
m !== void 0 && (z(Fe), Fe = m, S(m, B.current));
|
3734
|
+
} })
|
3735
|
+
] })
|
3736
|
+
] }),
|
3737
|
+
/* @__PURE__ */ l.jsxs("div", { className: "settings", children: [
|
3738
|
+
/* @__PURE__ */ l.jsx(
|
3739
|
+
Mt,
|
3740
|
+
{
|
3741
|
+
index: sn.indexOf(n),
|
3742
|
+
options: sn,
|
3743
|
+
onSelect: (f) => {
|
3744
|
+
f !== n && (Ee(), a(f));
|
3745
|
+
},
|
3746
|
+
open: s,
|
3747
|
+
onToggle: (f) => {
|
3748
|
+
p(f), c && u(!1), d && v(!1);
|
3749
|
+
}
|
3750
|
+
}
|
3751
|
+
),
|
3752
|
+
/* @__PURE__ */ l.jsx(
|
3753
|
+
Mt,
|
3754
|
+
{
|
3755
|
+
index: cn.indexOf(wt),
|
3756
|
+
options: cn,
|
3757
|
+
onSelect: (f) => {
|
3758
|
+
if (f !== wt)
|
3759
|
+
switch (wt = f, wt) {
|
3760
|
+
case "Depth":
|
3761
|
+
V.overrideMaterial = Ai;
|
3762
|
+
break;
|
3763
|
+
case "Normals":
|
3764
|
+
V.overrideMaterial = ki;
|
3765
|
+
break;
|
3766
|
+
default:
|
3767
|
+
case "Renderer":
|
3768
|
+
V.overrideMaterial = null;
|
3769
|
+
break;
|
3770
|
+
case "Wireframe":
|
3771
|
+
V.overrideMaterial = ji;
|
3772
|
+
break;
|
3773
|
+
case "UVs":
|
3774
|
+
V.overrideMaterial = _i;
|
3775
|
+
break;
|
3776
|
+
}
|
3777
|
+
},
|
3778
|
+
open: c,
|
3779
|
+
onToggle: (f) => {
|
3780
|
+
s && p(!1), u(f), d && v(!1);
|
3781
|
+
}
|
3782
|
+
}
|
3783
|
+
),
|
3784
|
+
/* @__PURE__ */ l.jsx(
|
3785
|
+
Mt,
|
3786
|
+
{
|
3787
|
+
index: 0,
|
3788
|
+
options: [
|
3789
|
+
"Orbit Mode",
|
3790
|
+
"Selection Mode"
|
3791
|
+
],
|
3792
|
+
onSelect: (f) => {
|
3793
|
+
Ot = f === "Selection Mode", ut.visible = Ot;
|
3794
|
+
},
|
3795
|
+
open: d,
|
3796
|
+
onToggle: (f) => {
|
3797
|
+
s && p(!1), c && u(!1), v(f);
|
3798
|
+
}
|
3799
|
+
}
|
3800
|
+
)
|
3801
|
+
] })
|
3802
|
+
] });
|
3803
|
+
}
|
3804
|
+
function Ki(t) {
|
3805
|
+
return /* @__PURE__ */ l.jsxs("div", { className: "editor", ref: t.ref, style: t.style, children: [
|
3806
|
+
/* @__PURE__ */ l.jsx("header", { children: t.header }),
|
3807
|
+
t.children,
|
3808
|
+
/* @__PURE__ */ l.jsx("footer", { children: t.footer })
|
3809
|
+
] });
|
3810
|
+
}
|
3811
|
+
export {
|
3812
|
+
Ht as Accordion,
|
3813
|
+
Gi as Application,
|
3814
|
+
Rt as BaseRemote,
|
3815
|
+
Bn as ChildObject,
|
3816
|
+
ci as ContainerObject,
|
3817
|
+
Ja as Draggable,
|
3818
|
+
Za as DraggableItem,
|
3819
|
+
Qa as Dropdown,
|
3820
|
+
ei as DropdownItem,
|
3821
|
+
Ki as Editor,
|
3822
|
+
ii as InfiniteGridHelper,
|
3823
|
+
Ti as Inspector,
|
3824
|
+
qi as MultiView,
|
3825
|
+
Fn as NavButton,
|
3826
|
+
Da as RemoteComponents,
|
3827
|
+
Vi as RemoteController,
|
3828
|
+
Oe as RemoteTheatre,
|
3829
|
+
Ya as RemoteThree,
|
3830
|
+
Nn as RemoteTweakpane,
|
3831
|
+
Wi as SceneInspector,
|
3832
|
+
Hi as SidePanel,
|
3833
|
+
j as ToolEvents,
|
3834
|
+
si as UVMaterial,
|
3835
|
+
lt as capitalize,
|
3836
|
+
$i as clamp,
|
3837
|
+
ka as colorToHex,
|
3838
|
+
_ as debugDispatcher,
|
3839
|
+
Dn as dispose,
|
3840
|
+
ja as disposeMaterial,
|
3841
|
+
Yi as disposeTexture,
|
3842
|
+
zi as distance,
|
3843
|
+
jn as hierarchyUUID,
|
3844
|
+
Aa as isColor,
|
3845
|
+
Pa as randomID,
|
3846
|
+
_a as resetThreeObjects,
|
3847
|
+
Ft as round,
|
3848
|
+
Yt as totalThreeObjects
|
3849
|
+
};
|