@cristiancosano/pallet-builder 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +293 -0
- package/dist/App.d.ts +4 -0
- package/dist/components/controls/CameraControls/CameraControls.d.ts +16 -0
- package/dist/components/controls/CameraControls/index.d.ts +2 -0
- package/dist/components/controls/CameraTracker/CameraTracker.d.ts +8 -0
- package/dist/components/controls/CameraTracker/index.d.ts +2 -0
- package/dist/components/controls/MiniMap/MiniMap.d.ts +20 -0
- package/dist/components/controls/MiniMap/index.d.ts +2 -0
- package/dist/components/controls/ViewControls/ViewControls.d.ts +8 -0
- package/dist/components/controls/ViewControls/index.d.ts +2 -0
- package/dist/components/controls/index.d.ts +8 -0
- package/dist/components/environments/TruckEnvironment/TruckEnvironment.d.ts +11 -0
- package/dist/components/environments/TruckEnvironment/index.d.ts +2 -0
- package/dist/components/environments/WarehouseEnvironment/WarehouseEnvironment.d.ts +10 -0
- package/dist/components/environments/WarehouseEnvironment/index.d.ts +2 -0
- package/dist/components/environments/index.d.ts +4 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/primitives/Box/Box.d.ts +14 -0
- package/dist/components/primitives/Box/index.d.ts +2 -0
- package/dist/components/primitives/Label/Label.d.ts +10 -0
- package/dist/components/primitives/Label/index.d.ts +2 -0
- package/dist/components/primitives/Pallet/Pallet.d.ts +9 -0
- package/dist/components/primitives/Pallet/index.d.ts +2 -0
- package/dist/components/primitives/Separator/Separator.d.ts +7 -0
- package/dist/components/primitives/Separator/index.d.ts +2 -0
- package/dist/components/primitives/StackedPallet/StackedPallet.d.ts +16 -0
- package/dist/components/primitives/StackedPallet/index.d.ts +2 -0
- package/dist/components/primitives/index.d.ts +10 -0
- package/dist/components/scenes/PalletScene/PalletScene.d.ts +21 -0
- package/dist/components/scenes/PalletScene/index.d.ts +2 -0
- package/dist/components/scenes/TruckScene/TruckScene.d.ts +24 -0
- package/dist/components/scenes/TruckScene/index.d.ts +2 -0
- package/dist/components/scenes/WarehouseScene/WarehouseScene.d.ts +20 -0
- package/dist/components/scenes/WarehouseScene/index.d.ts +2 -0
- package/dist/components/scenes/index.d.ts +6 -0
- package/dist/context/PresetContext.d.ts +8 -0
- package/dist/core/constants.d.ts +16 -0
- package/dist/core/entities/Box.d.ts +15 -0
- package/dist/core/entities/Pallet.d.ts +10 -0
- package/dist/core/entities/PalletFloor.d.ts +9 -0
- package/dist/core/entities/PlacedBox.d.ts +10 -0
- package/dist/core/entities/PlacedPallet.d.ts +8 -0
- package/dist/core/entities/Room.d.ts +10 -0
- package/dist/core/entities/Separator.d.ts +8 -0
- package/dist/core/entities/StackedPallet.d.ts +9 -0
- package/dist/core/entities/Truck.d.ts +12 -0
- package/dist/core/entities/Warehouse.d.ts +7 -0
- package/dist/core/entities/index.d.ts +11 -0
- package/dist/core/factories/BoxFactory.d.ts +7 -0
- package/dist/core/factories/PalletFactory.d.ts +23 -0
- package/dist/core/factories/TruckFactory.d.ts +7 -0
- package/dist/core/factories/index.d.ts +3 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/packing/BinPacking3D.d.ts +8 -0
- package/dist/core/packing/ColumnStrategy.d.ts +8 -0
- package/dist/core/packing/PackingStrategy.d.ts +14 -0
- package/dist/core/packing/TypeGroupStrategy.d.ts +8 -0
- package/dist/core/packing/index.d.ts +5 -0
- package/dist/core/packing/registry.d.ts +11 -0
- package/dist/core/presets/ScenePreset.d.ts +56 -0
- package/dist/core/presets/index.d.ts +2 -0
- package/dist/core/types.d.ts +75 -0
- package/dist/core/validation/bounds.d.ts +9 -0
- package/dist/core/validation/collision.d.ts +8 -0
- package/dist/core/validation/gravity.d.ts +3 -0
- package/dist/core/validation/index.d.ts +7 -0
- package/dist/core/validation/polygon.d.ts +5 -0
- package/dist/core/validation/stability.d.ts +7 -0
- package/dist/core/validation/stacking.d.ts +9 -0
- package/dist/core/validation/weight.d.ts +9 -0
- package/dist/examples/index.d.ts +5 -0
- package/dist/examples/store/useExampleStore.d.ts +54 -0
- package/dist/examples/views/PalletBuilder.d.ts +1 -0
- package/dist/examples/views/TruckViewer.d.ts +1 -0
- package/dist/examples/views/WarehouseViewer.d.ts +1 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/useCameraPosition.d.ts +6 -0
- package/dist/hooks/usePackingStrategy.d.ts +12 -0
- package/dist/hooks/usePalletMetrics.d.ts +9 -0
- package/dist/hooks/usePhysicsValidation.d.ts +16 -0
- package/dist/hooks/useWarehouseValidation.d.ts +9 -0
- package/dist/lib.d.ts +56 -0
- package/dist/main.d.ts +1 -0
- package/dist/objects/box.glb +0 -0
- package/dist/objects/pallet.glb +0 -0
- package/dist/pallet-builder.css +1 -0
- package/dist/pallet-builder.js +2611 -0
- package/dist/pallet-builder.js.map +1 -0
- package/dist/textures/crate_diffuse.png +0 -0
- package/dist/textures/pallet_planks.png +0 -0
- package/dist/vite.svg +1 -0
- package/dist/warehouse.hdr +0 -0
- package/package.json +70 -0
|
@@ -0,0 +1,2611 @@
|
|
|
1
|
+
import De, { createContext as Ge, useContext as Ve, useMemo as k, useCallback as H, memo as V, useRef as Ee, useEffect as fe, useState as ae } from "react";
|
|
2
|
+
import { Html as ke, OrbitControls as Xe } from "@react-three/drei";
|
|
3
|
+
import * as $ from "three";
|
|
4
|
+
import { useThree as Ae, Canvas as pe } from "@react-three/fiber";
|
|
5
|
+
const L = {
|
|
6
|
+
WOOD: "WOOD",
|
|
7
|
+
PLASTIC: "PLASTIC",
|
|
8
|
+
METAL: "METAL",
|
|
9
|
+
COMPOSITE: "COMPOSITE"
|
|
10
|
+
}, me = {
|
|
11
|
+
CARDBOARD: "CARDBOARD",
|
|
12
|
+
WOOD: "WOOD",
|
|
13
|
+
PLASTIC: "PLASTIC"
|
|
14
|
+
}, ie = {
|
|
15
|
+
BOX: "BOX",
|
|
16
|
+
REFRIGERATED: "REFRIGERATED",
|
|
17
|
+
FLATBED: "FLATBED",
|
|
18
|
+
TAUTLINER: "TAUTLINER",
|
|
19
|
+
CUSTOM: "CUSTOM"
|
|
20
|
+
}, ue = {
|
|
21
|
+
/** Palet EUR/EPAL — Estándar europeo (1200×800×144mm, ISO 6780) */
|
|
22
|
+
EUR: {
|
|
23
|
+
dimensions: { width: 1200, height: 144, depth: 800 },
|
|
24
|
+
material: L.WOOD,
|
|
25
|
+
maxWeight: 1e3,
|
|
26
|
+
maxStackHeight: 2200,
|
|
27
|
+
weight: 25
|
|
28
|
+
},
|
|
29
|
+
/** Palet GMA/Americano — Estándar norteamericano (1219×1016×145mm, 48"×40") */
|
|
30
|
+
GMA: {
|
|
31
|
+
dimensions: { width: 1219, height: 145, depth: 1016 },
|
|
32
|
+
material: L.WOOD,
|
|
33
|
+
maxWeight: 1200,
|
|
34
|
+
maxStackHeight: 2200,
|
|
35
|
+
weight: 30
|
|
36
|
+
},
|
|
37
|
+
/** Palet UK Standard — Reino Unido (1200×1000×150mm) */
|
|
38
|
+
UK: {
|
|
39
|
+
dimensions: { width: 1200, height: 150, depth: 1e3 },
|
|
40
|
+
material: L.WOOD,
|
|
41
|
+
maxWeight: 1e3,
|
|
42
|
+
maxStackHeight: 2200,
|
|
43
|
+
weight: 28
|
|
44
|
+
},
|
|
45
|
+
/** Palet asiático estándar — Asia Pallet (1100×1100×150mm, ISO 6780) */
|
|
46
|
+
ASIA: {
|
|
47
|
+
dimensions: { width: 1100, height: 150, depth: 1100 },
|
|
48
|
+
material: L.WOOD,
|
|
49
|
+
maxWeight: 1e3,
|
|
50
|
+
maxStackHeight: 2200,
|
|
51
|
+
weight: 28
|
|
52
|
+
},
|
|
53
|
+
/** Palet australiano estándar — Australia (1165×1165×150mm) */
|
|
54
|
+
AUSTRALIAN: {
|
|
55
|
+
dimensions: { width: 1165, height: 150, depth: 1165 },
|
|
56
|
+
material: L.WOOD,
|
|
57
|
+
maxWeight: 1e3,
|
|
58
|
+
maxStackHeight: 2200,
|
|
59
|
+
weight: 29
|
|
60
|
+
},
|
|
61
|
+
/** Medio palet EUR — Half European Pallet (800×600×144mm) */
|
|
62
|
+
HALF_EUR: {
|
|
63
|
+
dimensions: { width: 800, height: 144, depth: 600 },
|
|
64
|
+
material: L.WOOD,
|
|
65
|
+
maxWeight: 500,
|
|
66
|
+
maxStackHeight: 2200,
|
|
67
|
+
weight: 12
|
|
68
|
+
},
|
|
69
|
+
/** Cuarto de palet EUR — Quarter European Pallet (600×400×144mm) */
|
|
70
|
+
QUARTER_EUR: {
|
|
71
|
+
dimensions: { width: 600, height: 144, depth: 400 },
|
|
72
|
+
material: L.WOOD,
|
|
73
|
+
maxWeight: 250,
|
|
74
|
+
maxStackHeight: 2200,
|
|
75
|
+
weight: 6
|
|
76
|
+
},
|
|
77
|
+
/** Palet ISO 1 — ISO 6780 (1200×1000×150mm) */
|
|
78
|
+
ISO_1: {
|
|
79
|
+
dimensions: { width: 1200, height: 150, depth: 1e3 },
|
|
80
|
+
material: L.WOOD,
|
|
81
|
+
maxWeight: 1e3,
|
|
82
|
+
maxStackHeight: 2200,
|
|
83
|
+
weight: 28
|
|
84
|
+
},
|
|
85
|
+
/** Palet ISO 2 — ISO 6780 (1200×800×144mm, equivalente a EUR) */
|
|
86
|
+
ISO_2: {
|
|
87
|
+
dimensions: { width: 1200, height: 144, depth: 800 },
|
|
88
|
+
material: L.WOOD,
|
|
89
|
+
maxWeight: 1e3,
|
|
90
|
+
maxStackHeight: 2200,
|
|
91
|
+
weight: 25
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
ue.GMA;
|
|
95
|
+
const Ze = {
|
|
96
|
+
[ie.BOX]: {
|
|
97
|
+
dimensions: { width: 2480, height: 2700, depth: 13600 },
|
|
98
|
+
maxWeight: 24e3
|
|
99
|
+
},
|
|
100
|
+
[ie.REFRIGERATED]: {
|
|
101
|
+
dimensions: { width: 2440, height: 2590, depth: 13100 },
|
|
102
|
+
maxWeight: 22e3
|
|
103
|
+
},
|
|
104
|
+
[ie.FLATBED]: {
|
|
105
|
+
dimensions: { width: 2480, height: 2700, depth: 13600 },
|
|
106
|
+
maxWeight: 25e3
|
|
107
|
+
},
|
|
108
|
+
[ie.TAUTLINER]: {
|
|
109
|
+
dimensions: { width: 2480, height: 2700, depth: 13600 },
|
|
110
|
+
maxWeight: 24e3
|
|
111
|
+
}
|
|
112
|
+
}, At = {
|
|
113
|
+
thickness: 10,
|
|
114
|
+
// mm
|
|
115
|
+
weight: 2
|
|
116
|
+
// kg
|
|
117
|
+
}, Y = {
|
|
118
|
+
MM_TO_M: 1e-3,
|
|
119
|
+
M_TO_MM: 1e3
|
|
120
|
+
}, Ne = 1, Me = 0.6, Oe = 0.9, Le = {
|
|
121
|
+
id: "unstyled",
|
|
122
|
+
name: "Sin estilo",
|
|
123
|
+
box: {
|
|
124
|
+
color: "#e07b39",
|
|
125
|
+
roughness: 0.6,
|
|
126
|
+
metalness: 0.1,
|
|
127
|
+
opacity: 1
|
|
128
|
+
},
|
|
129
|
+
pallet: {
|
|
130
|
+
color: "#c4a26e",
|
|
131
|
+
edgeColor: "#8b7355",
|
|
132
|
+
roughness: 0.85,
|
|
133
|
+
metalness: 0.05
|
|
134
|
+
},
|
|
135
|
+
separator: {
|
|
136
|
+
colorOverride: null,
|
|
137
|
+
roughness: 0.8
|
|
138
|
+
},
|
|
139
|
+
selection: {
|
|
140
|
+
selectedColor: "#ff0000",
|
|
141
|
+
highlightedColor: "#42a5f5"
|
|
142
|
+
},
|
|
143
|
+
warehouse: {
|
|
144
|
+
floorColor: "#8a8a8a",
|
|
145
|
+
floorRoughness: 0.8,
|
|
146
|
+
wallColor: "#d0d0d0",
|
|
147
|
+
wallOpacity: 0.4,
|
|
148
|
+
ambientIntensity: 0.4,
|
|
149
|
+
directionalIntensity: 0.8,
|
|
150
|
+
showGrid: !0,
|
|
151
|
+
gridColor: "#666666",
|
|
152
|
+
gridSecondaryColor: "#999999"
|
|
153
|
+
},
|
|
154
|
+
truck: {
|
|
155
|
+
floorColor: "#8a7e72",
|
|
156
|
+
wallColor: "#b0b0b0",
|
|
157
|
+
wallOpacity: 0.35,
|
|
158
|
+
showGrid: !0,
|
|
159
|
+
gridColor: "#666666",
|
|
160
|
+
gridSecondaryColor: "#999999",
|
|
161
|
+
cabColor: "#3a5f8a",
|
|
162
|
+
chassisColor: "#2a2a2a",
|
|
163
|
+
wheelColor: "#1a1a1a"
|
|
164
|
+
}
|
|
165
|
+
}, Ie = {
|
|
166
|
+
id: "industrial",
|
|
167
|
+
name: "Industrial",
|
|
168
|
+
box: {
|
|
169
|
+
color: "#d4895a",
|
|
170
|
+
roughness: 0.7,
|
|
171
|
+
metalness: 0.05,
|
|
172
|
+
opacity: 1
|
|
173
|
+
},
|
|
174
|
+
pallet: {
|
|
175
|
+
color: "#a8854a",
|
|
176
|
+
edgeColor: "#6b5030",
|
|
177
|
+
roughness: 0.9,
|
|
178
|
+
metalness: 0.02
|
|
179
|
+
},
|
|
180
|
+
separator: {
|
|
181
|
+
colorOverride: null,
|
|
182
|
+
roughness: 0.85
|
|
183
|
+
},
|
|
184
|
+
selection: {
|
|
185
|
+
selectedColor: "#e53935",
|
|
186
|
+
highlightedColor: "#29b6f6"
|
|
187
|
+
},
|
|
188
|
+
warehouse: {
|
|
189
|
+
floorColor: "#5c5c5c",
|
|
190
|
+
floorRoughness: 0.92,
|
|
191
|
+
wallColor: "#b0b8be",
|
|
192
|
+
wallOpacity: 0.5,
|
|
193
|
+
ambientIntensity: 0.5,
|
|
194
|
+
directionalIntensity: 1,
|
|
195
|
+
showGrid: !0,
|
|
196
|
+
gridColor: "#4a4a4a",
|
|
197
|
+
gridSecondaryColor: "#6a6a6a"
|
|
198
|
+
},
|
|
199
|
+
truck: {
|
|
200
|
+
floorColor: "#6e6358",
|
|
201
|
+
wallColor: "#9eaab4",
|
|
202
|
+
wallOpacity: 0.4,
|
|
203
|
+
showGrid: !0,
|
|
204
|
+
gridColor: "#4a4a4a",
|
|
205
|
+
gridSecondaryColor: "#6a6a6a",
|
|
206
|
+
cabColor: "#2e4a6b",
|
|
207
|
+
chassisColor: "#1e1e1e",
|
|
208
|
+
wheelColor: "#111111"
|
|
209
|
+
}
|
|
210
|
+
}, Ye = {
|
|
211
|
+
unstyled: Le,
|
|
212
|
+
industrial: Ie
|
|
213
|
+
}, xe = Ie;
|
|
214
|
+
var re = { exports: {} }, ee = {};
|
|
215
|
+
var Pe;
|
|
216
|
+
function Ue() {
|
|
217
|
+
if (Pe) return ee;
|
|
218
|
+
Pe = 1;
|
|
219
|
+
var o = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
220
|
+
function t(i, n, r) {
|
|
221
|
+
var a = null;
|
|
222
|
+
if (r !== void 0 && (a = "" + r), n.key !== void 0 && (a = "" + n.key), "key" in n) {
|
|
223
|
+
r = {};
|
|
224
|
+
for (var f in n)
|
|
225
|
+
f !== "key" && (r[f] = n[f]);
|
|
226
|
+
} else r = n;
|
|
227
|
+
return n = r.ref, {
|
|
228
|
+
$$typeof: o,
|
|
229
|
+
type: i,
|
|
230
|
+
key: a,
|
|
231
|
+
ref: n !== void 0 ? n : null,
|
|
232
|
+
props: r
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
return ee.Fragment = e, ee.jsx = t, ee.jsxs = t, ee;
|
|
236
|
+
}
|
|
237
|
+
var te = {};
|
|
238
|
+
var Re;
|
|
239
|
+
function Fe() {
|
|
240
|
+
return Re || (Re = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
241
|
+
function o(m) {
|
|
242
|
+
if (m == null) return null;
|
|
243
|
+
if (typeof m == "function")
|
|
244
|
+
return m.$$typeof === R ? null : m.displayName || m.name || null;
|
|
245
|
+
if (typeof m == "string") return m;
|
|
246
|
+
switch (m) {
|
|
247
|
+
case h:
|
|
248
|
+
return "Fragment";
|
|
249
|
+
case T:
|
|
250
|
+
return "Profiler";
|
|
251
|
+
case j:
|
|
252
|
+
return "StrictMode";
|
|
253
|
+
case _:
|
|
254
|
+
return "Suspense";
|
|
255
|
+
case y:
|
|
256
|
+
return "SuspenseList";
|
|
257
|
+
case E:
|
|
258
|
+
return "Activity";
|
|
259
|
+
}
|
|
260
|
+
if (typeof m == "object")
|
|
261
|
+
switch (typeof m.tag == "number" && console.error(
|
|
262
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
263
|
+
), m.$$typeof) {
|
|
264
|
+
case d:
|
|
265
|
+
return "Portal";
|
|
266
|
+
case b:
|
|
267
|
+
return m.displayName || "Context";
|
|
268
|
+
case z:
|
|
269
|
+
return (m._context.displayName || "Context") + ".Consumer";
|
|
270
|
+
case M:
|
|
271
|
+
var C = m.render;
|
|
272
|
+
return m = m.displayName, m || (m = C.displayName || C.name || "", m = m !== "" ? "ForwardRef(" + m + ")" : "ForwardRef"), m;
|
|
273
|
+
case w:
|
|
274
|
+
return C = m.displayName || null, C !== null ? C : o(m.type) || "Memo";
|
|
275
|
+
case S:
|
|
276
|
+
C = m._payload, m = m._init;
|
|
277
|
+
try {
|
|
278
|
+
return o(m(C));
|
|
279
|
+
} catch {
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
function e(m) {
|
|
285
|
+
return "" + m;
|
|
286
|
+
}
|
|
287
|
+
function t(m) {
|
|
288
|
+
try {
|
|
289
|
+
e(m);
|
|
290
|
+
var C = !1;
|
|
291
|
+
} catch {
|
|
292
|
+
C = !0;
|
|
293
|
+
}
|
|
294
|
+
if (C) {
|
|
295
|
+
C = console;
|
|
296
|
+
var I = C.error, W = typeof Symbol == "function" && Symbol.toStringTag && m[Symbol.toStringTag] || m.constructor.name || "Object";
|
|
297
|
+
return I.call(
|
|
298
|
+
C,
|
|
299
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
300
|
+
W
|
|
301
|
+
), e(m);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function i(m) {
|
|
305
|
+
if (m === h) return "<>";
|
|
306
|
+
if (typeof m == "object" && m !== null && m.$$typeof === S)
|
|
307
|
+
return "<...>";
|
|
308
|
+
try {
|
|
309
|
+
var C = o(m);
|
|
310
|
+
return C ? "<" + C + ">" : "<...>";
|
|
311
|
+
} catch {
|
|
312
|
+
return "<...>";
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function n() {
|
|
316
|
+
var m = O.A;
|
|
317
|
+
return m === null ? null : m.getOwner();
|
|
318
|
+
}
|
|
319
|
+
function r() {
|
|
320
|
+
return Error("react-stack-top-frame");
|
|
321
|
+
}
|
|
322
|
+
function a(m) {
|
|
323
|
+
if (P.call(m, "key")) {
|
|
324
|
+
var C = Object.getOwnPropertyDescriptor(m, "key").get;
|
|
325
|
+
if (C && C.isReactWarning) return !1;
|
|
326
|
+
}
|
|
327
|
+
return m.key !== void 0;
|
|
328
|
+
}
|
|
329
|
+
function f(m, C) {
|
|
330
|
+
function I() {
|
|
331
|
+
N || (N = !0, console.error(
|
|
332
|
+
"%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://react.dev/link/special-props)",
|
|
333
|
+
C
|
|
334
|
+
));
|
|
335
|
+
}
|
|
336
|
+
I.isReactWarning = !0, Object.defineProperty(m, "key", {
|
|
337
|
+
get: I,
|
|
338
|
+
configurable: !0
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function g() {
|
|
342
|
+
var m = o(this.type);
|
|
343
|
+
return U[m] || (U[m] = !0, console.error(
|
|
344
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
345
|
+
)), m = this.props.ref, m !== void 0 ? m : null;
|
|
346
|
+
}
|
|
347
|
+
function v(m, C, I, W, ne, de) {
|
|
348
|
+
var B = I.ref;
|
|
349
|
+
return m = {
|
|
350
|
+
$$typeof: l,
|
|
351
|
+
type: m,
|
|
352
|
+
key: C,
|
|
353
|
+
props: I,
|
|
354
|
+
_owner: W
|
|
355
|
+
}, (B !== void 0 ? B : null) !== null ? Object.defineProperty(m, "ref", {
|
|
356
|
+
enumerable: !1,
|
|
357
|
+
get: g
|
|
358
|
+
}) : Object.defineProperty(m, "ref", { enumerable: !1, value: null }), m._store = {}, Object.defineProperty(m._store, "validated", {
|
|
359
|
+
configurable: !1,
|
|
360
|
+
enumerable: !1,
|
|
361
|
+
writable: !0,
|
|
362
|
+
value: 0
|
|
363
|
+
}), Object.defineProperty(m, "_debugInfo", {
|
|
364
|
+
configurable: !1,
|
|
365
|
+
enumerable: !1,
|
|
366
|
+
writable: !0,
|
|
367
|
+
value: null
|
|
368
|
+
}), Object.defineProperty(m, "_debugStack", {
|
|
369
|
+
configurable: !1,
|
|
370
|
+
enumerable: !1,
|
|
371
|
+
writable: !0,
|
|
372
|
+
value: ne
|
|
373
|
+
}), Object.defineProperty(m, "_debugTask", {
|
|
374
|
+
configurable: !1,
|
|
375
|
+
enumerable: !1,
|
|
376
|
+
writable: !0,
|
|
377
|
+
value: de
|
|
378
|
+
}), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
|
|
379
|
+
}
|
|
380
|
+
function u(m, C, I, W, ne, de) {
|
|
381
|
+
var B = C.children;
|
|
382
|
+
if (B !== void 0)
|
|
383
|
+
if (W)
|
|
384
|
+
if (A(B)) {
|
|
385
|
+
for (W = 0; W < B.length; W++)
|
|
386
|
+
x(B[W]);
|
|
387
|
+
Object.freeze && Object.freeze(B);
|
|
388
|
+
} else
|
|
389
|
+
console.error(
|
|
390
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
391
|
+
);
|
|
392
|
+
else x(B);
|
|
393
|
+
if (P.call(C, "key")) {
|
|
394
|
+
B = o(m);
|
|
395
|
+
var Q = Object.keys(C).filter(function(Be) {
|
|
396
|
+
return Be !== "key";
|
|
397
|
+
});
|
|
398
|
+
W = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", J[B + W] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
399
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
400
|
+
let props = %s;
|
|
401
|
+
<%s {...props} />
|
|
402
|
+
React keys must be passed directly to JSX without using spread:
|
|
403
|
+
let props = %s;
|
|
404
|
+
<%s key={someKey} {...props} />`,
|
|
405
|
+
W,
|
|
406
|
+
B,
|
|
407
|
+
Q,
|
|
408
|
+
B
|
|
409
|
+
), J[B + W] = !0);
|
|
410
|
+
}
|
|
411
|
+
if (B = null, I !== void 0 && (t(I), B = "" + I), a(C) && (t(C.key), B = "" + C.key), "key" in C) {
|
|
412
|
+
I = {};
|
|
413
|
+
for (var he in C)
|
|
414
|
+
he !== "key" && (I[he] = C[he]);
|
|
415
|
+
} else I = C;
|
|
416
|
+
return B && f(
|
|
417
|
+
I,
|
|
418
|
+
typeof m == "function" ? m.displayName || m.name || "Unknown" : m
|
|
419
|
+
), v(
|
|
420
|
+
m,
|
|
421
|
+
B,
|
|
422
|
+
I,
|
|
423
|
+
n(),
|
|
424
|
+
ne,
|
|
425
|
+
de
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
function x(m) {
|
|
429
|
+
p(m) ? m._store && (m._store.validated = 1) : typeof m == "object" && m !== null && m.$$typeof === S && (m._payload.status === "fulfilled" ? p(m._payload.value) && m._payload.value._store && (m._payload.value._store.validated = 1) : m._store && (m._store.validated = 1));
|
|
430
|
+
}
|
|
431
|
+
function p(m) {
|
|
432
|
+
return typeof m == "object" && m !== null && m.$$typeof === l;
|
|
433
|
+
}
|
|
434
|
+
var c = De, l = /* @__PURE__ */ Symbol.for("react.transitional.element"), d = /* @__PURE__ */ Symbol.for("react.portal"), h = /* @__PURE__ */ Symbol.for("react.fragment"), j = /* @__PURE__ */ Symbol.for("react.strict_mode"), T = /* @__PURE__ */ Symbol.for("react.profiler"), z = /* @__PURE__ */ Symbol.for("react.consumer"), b = /* @__PURE__ */ Symbol.for("react.context"), M = /* @__PURE__ */ Symbol.for("react.forward_ref"), _ = /* @__PURE__ */ Symbol.for("react.suspense"), y = /* @__PURE__ */ Symbol.for("react.suspense_list"), w = /* @__PURE__ */ Symbol.for("react.memo"), S = /* @__PURE__ */ Symbol.for("react.lazy"), E = /* @__PURE__ */ Symbol.for("react.activity"), R = /* @__PURE__ */ Symbol.for("react.client.reference"), O = c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, P = Object.prototype.hasOwnProperty, A = Array.isArray, G = console.createTask ? console.createTask : function() {
|
|
435
|
+
return null;
|
|
436
|
+
};
|
|
437
|
+
c = {
|
|
438
|
+
react_stack_bottom_frame: function(m) {
|
|
439
|
+
return m();
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
var N, U = {}, F = c.react_stack_bottom_frame.bind(
|
|
443
|
+
c,
|
|
444
|
+
r
|
|
445
|
+
)(), X = G(i(r)), J = {};
|
|
446
|
+
te.Fragment = h, te.jsx = function(m, C, I) {
|
|
447
|
+
var W = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
448
|
+
return u(
|
|
449
|
+
m,
|
|
450
|
+
C,
|
|
451
|
+
I,
|
|
452
|
+
!1,
|
|
453
|
+
W ? Error("react-stack-top-frame") : F,
|
|
454
|
+
W ? G(i(m)) : X
|
|
455
|
+
);
|
|
456
|
+
}, te.jsxs = function(m, C, I) {
|
|
457
|
+
var W = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
458
|
+
return u(
|
|
459
|
+
m,
|
|
460
|
+
C,
|
|
461
|
+
I,
|
|
462
|
+
!0,
|
|
463
|
+
W ? Error("react-stack-top-frame") : F,
|
|
464
|
+
W ? G(i(m)) : X
|
|
465
|
+
);
|
|
466
|
+
};
|
|
467
|
+
})()), te;
|
|
468
|
+
}
|
|
469
|
+
var _e;
|
|
470
|
+
function He() {
|
|
471
|
+
return _e || (_e = 1, process.env.NODE_ENV === "production" ? re.exports = Ue() : re.exports = Fe()), re.exports;
|
|
472
|
+
}
|
|
473
|
+
var s = He();
|
|
474
|
+
const $e = Ge(xe);
|
|
475
|
+
function ve({ preset: o, children: e }) {
|
|
476
|
+
const t = k(() => o ? typeof o == "string" ? Ye[o] ?? xe : o : xe, [o]);
|
|
477
|
+
return /* @__PURE__ */ s.jsx($e.Provider, { value: t, children: e });
|
|
478
|
+
}
|
|
479
|
+
function ce() {
|
|
480
|
+
return Ve($e);
|
|
481
|
+
}
|
|
482
|
+
function le(o) {
|
|
483
|
+
let e = 0;
|
|
484
|
+
for (const t of o.floors) {
|
|
485
|
+
e += t.pallet.dimensions.height;
|
|
486
|
+
const i = t.boxes.reduce((n, r) => {
|
|
487
|
+
const a = r.position.y + r.box.dimensions.height;
|
|
488
|
+
return Math.max(n, a);
|
|
489
|
+
}, 0);
|
|
490
|
+
e += i, t.separatorAbove && (e += t.separatorAbove.dimensions.height);
|
|
491
|
+
}
|
|
492
|
+
return e;
|
|
493
|
+
}
|
|
494
|
+
function we(o) {
|
|
495
|
+
let e = 0;
|
|
496
|
+
for (const t of o.floors)
|
|
497
|
+
e += t.pallet.weight, e += t.boxes.reduce((i, n) => i + n.box.weight, 0), t.separatorAbove && (e += t.separatorAbove.weight);
|
|
498
|
+
return e;
|
|
499
|
+
}
|
|
500
|
+
function qe(o, e) {
|
|
501
|
+
const t = e || o.id, i = o.floors.map((n, r) => {
|
|
502
|
+
const a = n.boxes.map((f, g) => {
|
|
503
|
+
const v = `${t}:f${r}:b${g}`, u = (x) => x.map((p) => {
|
|
504
|
+
const c = n.boxes.findIndex((l) => l.id === p);
|
|
505
|
+
return c >= 0 ? `${t}:f${r}:b${c}` : p;
|
|
506
|
+
});
|
|
507
|
+
return {
|
|
508
|
+
...f,
|
|
509
|
+
id: v,
|
|
510
|
+
supportedBy: u(f.supportedBy),
|
|
511
|
+
supporting: u(f.supporting)
|
|
512
|
+
};
|
|
513
|
+
});
|
|
514
|
+
return {
|
|
515
|
+
...n,
|
|
516
|
+
boxes: a
|
|
517
|
+
};
|
|
518
|
+
});
|
|
519
|
+
return {
|
|
520
|
+
...o,
|
|
521
|
+
floors: i
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
function D(o) {
|
|
525
|
+
let e = o.box.dimensions.width, t = o.box.dimensions.depth;
|
|
526
|
+
const i = o.box.dimensions.height;
|
|
527
|
+
return (o.rotation.y === 90 || o.rotation.y === 270) && ([e, t] = [t, e]), {
|
|
528
|
+
minX: o.position.x,
|
|
529
|
+
maxX: o.position.x + e,
|
|
530
|
+
minY: o.position.y,
|
|
531
|
+
maxY: o.position.y + i,
|
|
532
|
+
minZ: o.position.z,
|
|
533
|
+
maxZ: o.position.z + t
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
function oe(o) {
|
|
537
|
+
const e = o.stackedPallet, t = e.floors[0].pallet, i = t.dimensions.width, n = t.dimensions.depth, r = le(e), a = o.yRotation * Math.PI / 180, f = Math.cos(a), g = Math.sin(a), u = [
|
|
538
|
+
{ x: 0, z: 0 },
|
|
539
|
+
{ x: i, z: 0 },
|
|
540
|
+
{ x: i, z: n },
|
|
541
|
+
{ x: 0, z: n }
|
|
542
|
+
].map((d) => ({
|
|
543
|
+
x: o.position.x + d.x * f + d.z * g,
|
|
544
|
+
z: o.position.z - d.x * g + d.z * f
|
|
545
|
+
})), x = Math.min(...u.map((d) => d.x)), p = Math.max(...u.map((d) => d.x)), c = Math.min(...u.map((d) => d.z)), l = Math.max(...u.map((d) => d.z));
|
|
546
|
+
return {
|
|
547
|
+
minX: x,
|
|
548
|
+
maxX: p,
|
|
549
|
+
minY: o.position.y,
|
|
550
|
+
maxY: o.position.y + r,
|
|
551
|
+
minZ: c,
|
|
552
|
+
maxZ: l
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
function ye(o, e, t = Ne) {
|
|
556
|
+
return o.minX < e.maxX - t && o.maxX > e.minX + t && o.minY < e.maxY - t && o.maxY > e.minY + t && o.minZ < e.maxZ - t && o.maxZ > e.minZ + t;
|
|
557
|
+
}
|
|
558
|
+
function Je(o) {
|
|
559
|
+
const e = [];
|
|
560
|
+
for (let t = 0; t < o.length; t++)
|
|
561
|
+
for (let i = t + 1; i < o.length; i++) {
|
|
562
|
+
const n = D(o[t]), r = D(o[i]);
|
|
563
|
+
ye(n, r) && e.push({
|
|
564
|
+
code: "BR-002",
|
|
565
|
+
severity: "error",
|
|
566
|
+
message: `Colisión entre cajas ${o[t].id} y ${o[i].id}`,
|
|
567
|
+
involvedIds: [o[t].id, o[i].id]
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
return { isValid: e.length === 0, violations: e };
|
|
571
|
+
}
|
|
572
|
+
function Qe(o) {
|
|
573
|
+
const e = [];
|
|
574
|
+
for (let t = 0; t < o.length; t++)
|
|
575
|
+
for (let i = t + 1; i < o.length; i++) {
|
|
576
|
+
const n = oe(o[t]), r = oe(o[i]);
|
|
577
|
+
ye(n, r) && e.push({
|
|
578
|
+
code: "BR-003",
|
|
579
|
+
severity: "error",
|
|
580
|
+
message: `Colisión entre palets ${o[t].id} y ${o[i].id}`,
|
|
581
|
+
involvedIds: [o[t].id, o[i].id]
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
return { isValid: e.length === 0, violations: e };
|
|
585
|
+
}
|
|
586
|
+
function Ke(o, e) {
|
|
587
|
+
const t = [], i = D(o);
|
|
588
|
+
return (i.minX < 0 || i.maxX > e.dimensions.width) && t.push({
|
|
589
|
+
code: "BR-001",
|
|
590
|
+
severity: "error",
|
|
591
|
+
message: `Caja ${o.id} sobresale por el eje X del palet`,
|
|
592
|
+
involvedIds: [o.id, e.id]
|
|
593
|
+
}), (i.minZ < 0 || i.maxZ > e.dimensions.depth) && t.push({
|
|
594
|
+
code: "BR-001",
|
|
595
|
+
severity: "error",
|
|
596
|
+
message: `Caja ${o.id} sobresale por el eje Z del palet`,
|
|
597
|
+
involvedIds: [o.id, e.id]
|
|
598
|
+
}), i.maxY > e.maxStackHeight && t.push({
|
|
599
|
+
code: "BR-001",
|
|
600
|
+
severity: "error",
|
|
601
|
+
message: `Caja ${o.id} excede la altura máxima de apilamiento del palet`,
|
|
602
|
+
involvedIds: [o.id, e.id]
|
|
603
|
+
}), { isValid: t.length === 0, violations: t };
|
|
604
|
+
}
|
|
605
|
+
function et(o, e) {
|
|
606
|
+
const t = [];
|
|
607
|
+
for (const i of o) {
|
|
608
|
+
const n = Ke(i, e);
|
|
609
|
+
t.push(...n.violations);
|
|
610
|
+
}
|
|
611
|
+
return { isValid: t.length === 0, violations: t };
|
|
612
|
+
}
|
|
613
|
+
function tt(o, e) {
|
|
614
|
+
const t = [], i = oe(o), n = e.dimensions;
|
|
615
|
+
return (i.minX < 0 || i.maxX > n.width) && t.push({
|
|
616
|
+
code: "BR-402",
|
|
617
|
+
severity: "error",
|
|
618
|
+
message: `Palet ${o.id} sobresale por el ancho del camión`,
|
|
619
|
+
involvedIds: [o.id, e.id]
|
|
620
|
+
}), (i.minZ < 0 || i.maxZ > n.depth) && t.push({
|
|
621
|
+
code: "BR-402",
|
|
622
|
+
severity: "error",
|
|
623
|
+
message: `Palet ${o.id} sobresale por la profundidad del camión`,
|
|
624
|
+
involvedIds: [o.id, e.id]
|
|
625
|
+
}), i.maxY > n.height && t.push({
|
|
626
|
+
code: "BR-404",
|
|
627
|
+
severity: "error",
|
|
628
|
+
message: `Palet ${o.id} excede la altura del camión`,
|
|
629
|
+
involvedIds: [o.id, e.id]
|
|
630
|
+
}), { isValid: t.length === 0, violations: t };
|
|
631
|
+
}
|
|
632
|
+
function Ot(o, e) {
|
|
633
|
+
const t = [], i = oe(o);
|
|
634
|
+
return i.maxY > e && t.push({
|
|
635
|
+
code: "BR-403",
|
|
636
|
+
severity: "error",
|
|
637
|
+
message: `Palet ${o.id} excede el techo de la estancia (${i.maxY}mm > ${e}mm)`,
|
|
638
|
+
involvedIds: [o.id]
|
|
639
|
+
}), { isValid: t.length === 0, violations: t };
|
|
640
|
+
}
|
|
641
|
+
function it(o) {
|
|
642
|
+
const e = [], t = o.boxes.reduce((n, r) => n + r.box.weight, 0), i = o.pallet.maxWeight;
|
|
643
|
+
return t > i ? e.push({
|
|
644
|
+
code: "BR-101",
|
|
645
|
+
severity: "error",
|
|
646
|
+
message: `Peso de cajas (${t.toFixed(1)}kg) excede el máximo del palet (${i}kg)`,
|
|
647
|
+
involvedIds: [o.pallet.id]
|
|
648
|
+
}) : t > i * Oe && e.push({
|
|
649
|
+
code: "BR-101",
|
|
650
|
+
severity: "warning",
|
|
651
|
+
message: `Peso de cajas (${t.toFixed(1)}kg) supera el 90% del máximo del palet (${i}kg)`,
|
|
652
|
+
involvedIds: [o.pallet.id]
|
|
653
|
+
}), { isValid: e.filter((n) => n.severity === "error").length === 0, violations: e };
|
|
654
|
+
}
|
|
655
|
+
function It(o) {
|
|
656
|
+
const e = [], t = o.pallets.reduce(
|
|
657
|
+
(i, n) => i + we(n.stackedPallet),
|
|
658
|
+
0
|
|
659
|
+
);
|
|
660
|
+
return t > o.maxWeight ? e.push({
|
|
661
|
+
code: "BR-102",
|
|
662
|
+
severity: "error",
|
|
663
|
+
message: `Peso total (${t.toFixed(1)}kg) excede el máximo del camión (${o.maxWeight}kg)`,
|
|
664
|
+
involvedIds: [o.id]
|
|
665
|
+
}) : t > o.maxWeight * Oe && e.push({
|
|
666
|
+
code: "BR-102",
|
|
667
|
+
severity: "warning",
|
|
668
|
+
message: `Peso total (${t.toFixed(1)}kg) supera el 90% del máximo del camión (${o.maxWeight}kg)`,
|
|
669
|
+
involvedIds: [o.id]
|
|
670
|
+
}), { isValid: e.filter((i) => i.severity === "error").length === 0, violations: e };
|
|
671
|
+
}
|
|
672
|
+
function ot(o) {
|
|
673
|
+
const e = [];
|
|
674
|
+
for (const t of o) {
|
|
675
|
+
if (!t.box.fragile) continue;
|
|
676
|
+
const i = t.box.fragilityMaxWeight ?? 0, n = st(t, o);
|
|
677
|
+
n > i && e.push({
|
|
678
|
+
code: "BR-103",
|
|
679
|
+
severity: "error",
|
|
680
|
+
message: `Caja frágil ${t.id} soporta ${n.toFixed(1)}kg (máx: ${i}kg)`,
|
|
681
|
+
involvedIds: [t.id]
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
return { isValid: e.length === 0, violations: e };
|
|
685
|
+
}
|
|
686
|
+
function st(o, e) {
|
|
687
|
+
const t = D(o);
|
|
688
|
+
let i = 0;
|
|
689
|
+
for (const n of e) {
|
|
690
|
+
if (n.id === o.id) continue;
|
|
691
|
+
const r = D(n);
|
|
692
|
+
r.minY >= t.maxY - 1 && r.minX < t.maxX && r.maxX > t.minX && r.minZ < t.maxZ && r.maxZ > t.minZ && (i += n.box.weight);
|
|
693
|
+
}
|
|
694
|
+
return i;
|
|
695
|
+
}
|
|
696
|
+
function nt(o, e) {
|
|
697
|
+
const t = [];
|
|
698
|
+
if (e.length === 0) return { isValid: !0, violations: t };
|
|
699
|
+
const i = e.reduce((g, v) => g + v.box.weight, 0);
|
|
700
|
+
if (i === 0) return { isValid: !0, violations: t };
|
|
701
|
+
let n = 0, r = 0;
|
|
702
|
+
for (const g of e) {
|
|
703
|
+
const v = D(g), u = (v.minX + v.maxX) / 2, x = (v.minZ + v.maxZ) / 2;
|
|
704
|
+
n += u * g.box.weight, r += x * g.box.weight;
|
|
705
|
+
}
|
|
706
|
+
n /= i, r /= i;
|
|
707
|
+
const a = o.dimensions.width / 2, f = o.dimensions.depth / 2;
|
|
708
|
+
return (Math.abs(n - a) > o.dimensions.width / 6 || Math.abs(r - f) > o.dimensions.depth / 6) && t.push({
|
|
709
|
+
code: "BR-104",
|
|
710
|
+
severity: "warning",
|
|
711
|
+
message: `Centro de gravedad descentrado (${n.toFixed(0)}, ${r.toFixed(0)}) respecto al centro del palet`,
|
|
712
|
+
involvedIds: [o.id]
|
|
713
|
+
}), { isValid: !0, violations: t };
|
|
714
|
+
}
|
|
715
|
+
function rt(o) {
|
|
716
|
+
const e = [];
|
|
717
|
+
for (const t of o) {
|
|
718
|
+
if (t.box.stackable) continue;
|
|
719
|
+
const i = D(t);
|
|
720
|
+
for (const n of o) {
|
|
721
|
+
if (n.id === t.id) continue;
|
|
722
|
+
const r = D(n);
|
|
723
|
+
r.minY >= i.maxY - 1 && r.minX < i.maxX && r.maxX > i.minX && r.minZ < i.maxZ && r.maxZ > i.minZ && e.push({
|
|
724
|
+
code: "BR-201",
|
|
725
|
+
severity: "error",
|
|
726
|
+
message: `Caja ${n.id} apilada sobre caja no apilable ${t.id}`,
|
|
727
|
+
involvedIds: [t.id, n.id]
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return { isValid: e.length === 0, violations: e };
|
|
732
|
+
}
|
|
733
|
+
function at(o) {
|
|
734
|
+
const e = [];
|
|
735
|
+
for (const t of o) {
|
|
736
|
+
const i = D(t), n = (i.maxX - i.minX) * (i.maxZ - i.minZ);
|
|
737
|
+
for (const r of o) {
|
|
738
|
+
if (r.id === t.id) continue;
|
|
739
|
+
const a = D(r);
|
|
740
|
+
if (a.minY < i.maxY - 1 || a.minX >= i.maxX || a.maxX <= i.minX || a.minZ >= i.maxZ || a.maxZ <= i.minZ) continue;
|
|
741
|
+
const f = (a.maxX - a.minX) * (a.maxZ - a.minZ);
|
|
742
|
+
r.box.weight > t.box.weight * 1.5 && f > n * 1.2 && e.push({
|
|
743
|
+
code: "BR-203",
|
|
744
|
+
severity: "warning",
|
|
745
|
+
message: `Pirámide invertida: caja ${r.id} (${r.box.weight}kg) sobre caja ${t.id} (${t.box.weight}kg)`,
|
|
746
|
+
involvedIds: [t.id, r.id]
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
return { isValid: !0, violations: e };
|
|
751
|
+
}
|
|
752
|
+
function $t(o) {
|
|
753
|
+
const e = [];
|
|
754
|
+
if (o.floors.length <= 1) return { isValid: !0, violations: e };
|
|
755
|
+
const t = o.floors[0].pallet;
|
|
756
|
+
for (let i = 1; i < o.floors.length; i++) {
|
|
757
|
+
const n = o.floors[i].pallet;
|
|
758
|
+
(n.dimensions.width !== t.dimensions.width || n.dimensions.depth !== t.dimensions.depth) && e.push({
|
|
759
|
+
code: "BR-301",
|
|
760
|
+
severity: "error",
|
|
761
|
+
message: `Piso ${i}: dimensiones (${n.dimensions.width}×${n.dimensions.depth}) distintas a la base (${t.dimensions.width}×${t.dimensions.depth})`,
|
|
762
|
+
involvedIds: [t.id, n.id]
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
return { isValid: e.length === 0, violations: e };
|
|
766
|
+
}
|
|
767
|
+
function Wt(o) {
|
|
768
|
+
const e = [];
|
|
769
|
+
for (let t = 0; t < o.floors.length - 1; t++)
|
|
770
|
+
o.floors[t].separatorAbove || e.push({
|
|
771
|
+
code: "BR-302",
|
|
772
|
+
severity: "error",
|
|
773
|
+
message: `Falta separador entre piso ${t} y piso ${t + 1}`,
|
|
774
|
+
involvedIds: [o.id]
|
|
775
|
+
});
|
|
776
|
+
return { isValid: e.length === 0, violations: e };
|
|
777
|
+
}
|
|
778
|
+
function Bt(o, e) {
|
|
779
|
+
const t = [], i = le(o);
|
|
780
|
+
return i > e && t.push({
|
|
781
|
+
code: "BR-303",
|
|
782
|
+
severity: "error",
|
|
783
|
+
message: `Altura del stack (${i}mm) excede la del contenedor (${e}mm)`,
|
|
784
|
+
involvedIds: [o.id]
|
|
785
|
+
}), { isValid: t.length === 0, violations: t };
|
|
786
|
+
}
|
|
787
|
+
function Dt(o) {
|
|
788
|
+
const e = [], t = we(o), i = o.floors[0].pallet.maxWeight, n = t - o.floors[0].pallet.weight;
|
|
789
|
+
return n > i && e.push({
|
|
790
|
+
code: "BR-304",
|
|
791
|
+
severity: "error",
|
|
792
|
+
message: `Peso de carga del stack (${n.toFixed(1)}kg) excede la capacidad del palet base (${i}kg)`,
|
|
793
|
+
involvedIds: [o.id]
|
|
794
|
+
}), { isValid: e.length === 0, violations: e };
|
|
795
|
+
}
|
|
796
|
+
function ct(o) {
|
|
797
|
+
const e = [];
|
|
798
|
+
for (const t of o) {
|
|
799
|
+
const i = D(t);
|
|
800
|
+
if (i.minY <= 1) continue;
|
|
801
|
+
const n = (i.maxX - i.minX) * (i.maxZ - i.minZ);
|
|
802
|
+
let r = 0;
|
|
803
|
+
for (const a of o) {
|
|
804
|
+
if (a.id === t.id) continue;
|
|
805
|
+
const f = D(a);
|
|
806
|
+
if (Math.abs(f.maxY - i.minY) > 2) continue;
|
|
807
|
+
const g = Math.max(0, Math.min(i.maxX, f.maxX) - Math.max(i.minX, f.minX)), v = Math.max(0, Math.min(i.maxZ, f.maxZ) - Math.max(i.minZ, f.minZ));
|
|
808
|
+
r += g * v;
|
|
809
|
+
}
|
|
810
|
+
n > 0 && r / n < Me && e.push({
|
|
811
|
+
code: "BR-004",
|
|
812
|
+
severity: "error",
|
|
813
|
+
message: `Caja ${t.id} sin soporte suficiente (${(r / n * 100).toFixed(0)}% < ${Me * 100}%)`,
|
|
814
|
+
involvedIds: [t.id]
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
return { isValid: e.length === 0, violations: e };
|
|
818
|
+
}
|
|
819
|
+
function q(o) {
|
|
820
|
+
if (o.length === 0) return { x: 0, y: 0, z: 0 };
|
|
821
|
+
let e = 0, t = 0, i = 0, n = 0;
|
|
822
|
+
for (const r of o) {
|
|
823
|
+
const a = D(r), f = (a.minX + a.maxX) / 2, g = (a.minY + a.maxY) / 2, v = (a.minZ + a.maxZ) / 2, u = r.box.weight;
|
|
824
|
+
t += f * u, i += g * u, n += v * u, e += u;
|
|
825
|
+
}
|
|
826
|
+
return e === 0 ? { x: 0, y: 0, z: 0 } : {
|
|
827
|
+
x: t / e,
|
|
828
|
+
y: i / e,
|
|
829
|
+
z: n / e
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
function se(o, e) {
|
|
833
|
+
if (e.length === 0) return 100;
|
|
834
|
+
const t = q(e), i = o.dimensions.width / 2, n = o.dimensions.depth / 2, r = Math.abs(t.x - i) / (o.dimensions.width / 2), a = Math.abs(t.z - n) / (o.dimensions.depth / 2), f = Math.max(0, 100 - (r + a) * 50), g = e.reduce((x, p) => {
|
|
835
|
+
const c = D(p);
|
|
836
|
+
return Math.max(x, c.maxY);
|
|
837
|
+
}, 0), v = g > 0 ? t.y / g : 0, u = Math.max(0, 100 - Math.max(0, v - 0.5) * 100);
|
|
838
|
+
return Math.round(f * 0.7 + u * 0.3);
|
|
839
|
+
}
|
|
840
|
+
function lt(o, e) {
|
|
841
|
+
const t = [];
|
|
842
|
+
if (e.length === 0) return { isValid: !0, violations: t };
|
|
843
|
+
const i = q(e);
|
|
844
|
+
return (i.x < 0 || i.x > o.dimensions.width || i.z < 0 || i.z > o.dimensions.depth) && t.push({
|
|
845
|
+
code: "BR-502",
|
|
846
|
+
severity: "error",
|
|
847
|
+
message: `Centro de gravedad (${i.x.toFixed(0)}, ${i.z.toFixed(0)}) fuera del palet`,
|
|
848
|
+
involvedIds: [o.id]
|
|
849
|
+
}), { isValid: t.length === 0, violations: t };
|
|
850
|
+
}
|
|
851
|
+
function dt(o, e) {
|
|
852
|
+
const t = [];
|
|
853
|
+
if (e.length === 0) return { isValid: !0, violations: t };
|
|
854
|
+
const i = se(o, e);
|
|
855
|
+
i < 50 ? t.push({
|
|
856
|
+
code: "BR-501",
|
|
857
|
+
severity: "error",
|
|
858
|
+
message: `Score de estabilidad bajo (${i}/100, mínimo: 50)`,
|
|
859
|
+
involvedIds: [o.id]
|
|
860
|
+
}) : i < 70 && t.push({
|
|
861
|
+
code: "BR-501",
|
|
862
|
+
severity: "warning",
|
|
863
|
+
message: `Score de estabilidad mejorable (${i}/100, recomendado: ≥70)`,
|
|
864
|
+
involvedIds: [o.id]
|
|
865
|
+
});
|
|
866
|
+
const n = q(e), r = e.reduce((a, f) => Math.max(a, D(f).maxY), 0);
|
|
867
|
+
return r > 0 && n.y > r * 0.6 && t.push({
|
|
868
|
+
code: "BR-503",
|
|
869
|
+
severity: "warning",
|
|
870
|
+
message: `Centro de gravedad alto (${n.y.toFixed(0)}mm, ${(n.y / r * 100).toFixed(0)}% de la altura)`,
|
|
871
|
+
involvedIds: [o.id]
|
|
872
|
+
}), { isValid: t.filter((a) => a.severity === "error").length === 0, violations: t };
|
|
873
|
+
}
|
|
874
|
+
function ht(o, e) {
|
|
875
|
+
let t = !1;
|
|
876
|
+
const i = e.length;
|
|
877
|
+
for (let n = 0, r = i - 1; n < i; r = n++) {
|
|
878
|
+
const a = e[n].x, f = e[n].z, g = e[r].x, v = e[r].z;
|
|
879
|
+
f > o.z != v > o.z && o.x < (g - a) * (o.z - f) / (v - f) + a && (t = !t);
|
|
880
|
+
}
|
|
881
|
+
return t;
|
|
882
|
+
}
|
|
883
|
+
function We(o, e) {
|
|
884
|
+
const t = [], i = oe(o), n = [
|
|
885
|
+
{ x: i.minX, z: i.minZ },
|
|
886
|
+
{ x: i.maxX, z: i.minZ },
|
|
887
|
+
{ x: i.maxX, z: i.maxZ },
|
|
888
|
+
{ x: i.minX, z: i.maxZ }
|
|
889
|
+
];
|
|
890
|
+
for (const r of n)
|
|
891
|
+
if (!ht(r, e.floorPolygon)) {
|
|
892
|
+
t.push({
|
|
893
|
+
code: "BR-401",
|
|
894
|
+
severity: "error",
|
|
895
|
+
message: `Palet ${o.id} fuera de la estancia ${e.name} en (${r.x}, ${r.z})`,
|
|
896
|
+
involvedIds: [o.id, e.id]
|
|
897
|
+
});
|
|
898
|
+
break;
|
|
899
|
+
}
|
|
900
|
+
return i.maxY > e.ceilingHeight && t.push({
|
|
901
|
+
code: "BR-403",
|
|
902
|
+
severity: "error",
|
|
903
|
+
message: `Palet ${o.id} excede el techo de la estancia ${e.name}`,
|
|
904
|
+
involvedIds: [o.id, e.id]
|
|
905
|
+
}), { isValid: t.length === 0, violations: t };
|
|
906
|
+
}
|
|
907
|
+
class mt {
|
|
908
|
+
id = "column";
|
|
909
|
+
name = "Columnas por tipo";
|
|
910
|
+
pack(e, t) {
|
|
911
|
+
const i = [], n = [], r = /* @__PURE__ */ new Map();
|
|
912
|
+
for (const c of e) {
|
|
913
|
+
const l = c.type ?? c.sku ?? "default";
|
|
914
|
+
r.has(l) || r.set(l, []), r.get(l).push(c);
|
|
915
|
+
}
|
|
916
|
+
let a = 0, f = 0;
|
|
917
|
+
for (const [, c] of r) {
|
|
918
|
+
if (c.length === 0) continue;
|
|
919
|
+
const l = c[0], d = l.dimensions.width, h = l.dimensions.depth, j = l.dimensions.height;
|
|
920
|
+
if (a + d > t.dimensions.width) {
|
|
921
|
+
n.push(...c);
|
|
922
|
+
continue;
|
|
923
|
+
}
|
|
924
|
+
let T = 0, z = 0, b = 0;
|
|
925
|
+
for (; b < c.length; ) {
|
|
926
|
+
const M = c[b];
|
|
927
|
+
if (T + h > t.dimensions.depth) {
|
|
928
|
+
if (T = 0, z += j, z + j > t.maxStackHeight) {
|
|
929
|
+
n.push(...c.slice(b));
|
|
930
|
+
break;
|
|
931
|
+
}
|
|
932
|
+
continue;
|
|
933
|
+
}
|
|
934
|
+
i.push({
|
|
935
|
+
id: `placed-${++f}`,
|
|
936
|
+
box: M,
|
|
937
|
+
position: { x: a, y: z, z: T },
|
|
938
|
+
rotation: { x: 0, y: 0, z: 0 },
|
|
939
|
+
supportedBy: [],
|
|
940
|
+
supporting: []
|
|
941
|
+
}), T += h, b++;
|
|
942
|
+
}
|
|
943
|
+
a += d;
|
|
944
|
+
}
|
|
945
|
+
const g = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, v = i.reduce((c, l) => {
|
|
946
|
+
const d = l.box.dimensions;
|
|
947
|
+
return c + d.width * d.height * d.depth;
|
|
948
|
+
}, 0), u = i.reduce((c, l) => c + l.box.weight, 0), x = q(i), p = se(t, i);
|
|
949
|
+
return {
|
|
950
|
+
placements: i,
|
|
951
|
+
metrics: {
|
|
952
|
+
volumeUtilization: g > 0 ? v / g : 0,
|
|
953
|
+
weightUtilization: t.maxWeight > 0 ? u / t.maxWeight : 0,
|
|
954
|
+
centerOfGravity: x,
|
|
955
|
+
stabilityScore: p
|
|
956
|
+
},
|
|
957
|
+
unplacedBoxes: n
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
class ut {
|
|
962
|
+
id = "bin-packing-3d";
|
|
963
|
+
name = "Bin Packing 3D (FFD Height)";
|
|
964
|
+
pack(e, t) {
|
|
965
|
+
const i = [], n = [], r = [...e].sort((x, p) => {
|
|
966
|
+
const c = x.dimensions.width * x.dimensions.height * x.dimensions.depth;
|
|
967
|
+
return p.dimensions.width * p.dimensions.height * p.dimensions.depth - c;
|
|
968
|
+
}), a = [
|
|
969
|
+
{
|
|
970
|
+
x: 0,
|
|
971
|
+
y: 0,
|
|
972
|
+
z: 0,
|
|
973
|
+
width: t.dimensions.width,
|
|
974
|
+
height: t.maxStackHeight,
|
|
975
|
+
depth: t.dimensions.depth
|
|
976
|
+
}
|
|
977
|
+
];
|
|
978
|
+
let f = 0;
|
|
979
|
+
for (const x of r) {
|
|
980
|
+
let p = !1;
|
|
981
|
+
const c = [
|
|
982
|
+
{ w: x.dimensions.width, h: x.dimensions.height, d: x.dimensions.depth, rot: 0 },
|
|
983
|
+
{ w: x.dimensions.depth, h: x.dimensions.height, d: x.dimensions.width, rot: 90 }
|
|
984
|
+
];
|
|
985
|
+
for (let l = 0; l < a.length && !p; l++) {
|
|
986
|
+
const d = a[l];
|
|
987
|
+
for (const h of c)
|
|
988
|
+
if (h.w <= d.width && h.h <= d.height && h.d <= d.depth) {
|
|
989
|
+
const j = {
|
|
990
|
+
id: `placed-${++f}`,
|
|
991
|
+
box: x,
|
|
992
|
+
position: { x: d.x, y: d.y, z: d.z },
|
|
993
|
+
rotation: { x: 0, y: h.rot, z: 0 },
|
|
994
|
+
supportedBy: [],
|
|
995
|
+
supporting: []
|
|
996
|
+
}, T = D(j);
|
|
997
|
+
if (!i.some(
|
|
998
|
+
(b) => ye(D(b), T)
|
|
999
|
+
)) {
|
|
1000
|
+
i.push(j), p = !0, a.splice(l, 1), d.width - h.w > 0 && a.push({
|
|
1001
|
+
x: d.x + h.w,
|
|
1002
|
+
y: d.y,
|
|
1003
|
+
z: d.z,
|
|
1004
|
+
width: d.width - h.w,
|
|
1005
|
+
height: d.height,
|
|
1006
|
+
depth: d.depth
|
|
1007
|
+
}), d.height - h.h > 0 && a.push({
|
|
1008
|
+
x: d.x,
|
|
1009
|
+
y: d.y + h.h,
|
|
1010
|
+
z: d.z,
|
|
1011
|
+
width: h.w,
|
|
1012
|
+
height: d.height - h.h,
|
|
1013
|
+
depth: h.d
|
|
1014
|
+
}), d.depth - h.d > 0 && a.push({
|
|
1015
|
+
x: d.x,
|
|
1016
|
+
y: d.y,
|
|
1017
|
+
z: d.z + h.d,
|
|
1018
|
+
width: h.w,
|
|
1019
|
+
height: d.height,
|
|
1020
|
+
depth: d.depth - h.d
|
|
1021
|
+
}), a.sort((b, M) => b.y - M.y || b.x - M.x || b.z - M.z);
|
|
1022
|
+
break;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
p || n.push(x);
|
|
1027
|
+
}
|
|
1028
|
+
const g = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, v = i.reduce((x, p) => {
|
|
1029
|
+
const c = p.box.dimensions;
|
|
1030
|
+
return x + c.width * c.height * c.depth;
|
|
1031
|
+
}, 0), u = i.reduce((x, p) => x + p.box.weight, 0);
|
|
1032
|
+
return {
|
|
1033
|
+
placements: i,
|
|
1034
|
+
metrics: {
|
|
1035
|
+
volumeUtilization: g > 0 ? v / g : 0,
|
|
1036
|
+
weightUtilization: t.maxWeight > 0 ? u / t.maxWeight : 0,
|
|
1037
|
+
centerOfGravity: q(i),
|
|
1038
|
+
stabilityScore: se(t, i)
|
|
1039
|
+
},
|
|
1040
|
+
unplacedBoxes: n
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
class xt {
|
|
1045
|
+
id = "type-group";
|
|
1046
|
+
name = "Agrupación por tipo";
|
|
1047
|
+
pack(e, t) {
|
|
1048
|
+
const i = [], n = [], r = [...e].sort((l, d) => {
|
|
1049
|
+
const h = l.type ?? l.sku ?? "z", j = d.type ?? d.sku ?? "z";
|
|
1050
|
+
return h !== j ? h.localeCompare(j) : l.fragile !== d.fragile ? l.fragile ? 1 : -1 : d.weight - l.weight;
|
|
1051
|
+
});
|
|
1052
|
+
let a = 0, f = 0, g = 0, v = 0, u = 0;
|
|
1053
|
+
for (const l of r) {
|
|
1054
|
+
const d = l.dimensions.width, h = l.dimensions.height, j = l.dimensions.depth;
|
|
1055
|
+
if (a + d > t.dimensions.width && (a = 0, f += v > 0 ? j : 0), f + j > t.dimensions.depth && (a = 0, f = 0, g += v, v = 0), g + h > t.maxStackHeight) {
|
|
1056
|
+
n.push(l);
|
|
1057
|
+
continue;
|
|
1058
|
+
}
|
|
1059
|
+
if (a + d > t.dimensions.width) {
|
|
1060
|
+
n.push(l);
|
|
1061
|
+
continue;
|
|
1062
|
+
}
|
|
1063
|
+
if (f + j > t.dimensions.depth) {
|
|
1064
|
+
n.push(l);
|
|
1065
|
+
continue;
|
|
1066
|
+
}
|
|
1067
|
+
i.push({
|
|
1068
|
+
id: `placed-${++u}`,
|
|
1069
|
+
box: l,
|
|
1070
|
+
position: { x: a, y: g, z: f },
|
|
1071
|
+
rotation: { x: 0, y: 0, z: 0 },
|
|
1072
|
+
supportedBy: [],
|
|
1073
|
+
supporting: []
|
|
1074
|
+
}), a += d, v = Math.max(v, h);
|
|
1075
|
+
}
|
|
1076
|
+
const x = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, p = i.reduce((l, d) => {
|
|
1077
|
+
const h = d.box.dimensions;
|
|
1078
|
+
return l + h.width * h.height * h.depth;
|
|
1079
|
+
}, 0), c = i.reduce((l, d) => l + d.box.weight, 0);
|
|
1080
|
+
return {
|
|
1081
|
+
placements: i,
|
|
1082
|
+
metrics: {
|
|
1083
|
+
volumeUtilization: x > 0 ? p / x : 0,
|
|
1084
|
+
weightUtilization: t.maxWeight > 0 ? c / t.maxWeight : 0,
|
|
1085
|
+
centerOfGravity: q(i),
|
|
1086
|
+
stabilityScore: se(t, i)
|
|
1087
|
+
},
|
|
1088
|
+
unplacedBoxes: n
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
class gt {
|
|
1093
|
+
strategies = /* @__PURE__ */ new Map();
|
|
1094
|
+
constructor() {
|
|
1095
|
+
this.register(new mt()), this.register(new ut()), this.register(new xt());
|
|
1096
|
+
}
|
|
1097
|
+
register(e) {
|
|
1098
|
+
this.strategies.set(e.id, e);
|
|
1099
|
+
}
|
|
1100
|
+
get(e) {
|
|
1101
|
+
const t = this.strategies.get(e);
|
|
1102
|
+
if (!t)
|
|
1103
|
+
throw new Error(`Packing strategy "${e}" not found. Available: ${this.listIds().join(", ")}`);
|
|
1104
|
+
return t;
|
|
1105
|
+
}
|
|
1106
|
+
list() {
|
|
1107
|
+
return Array.from(this.strategies.values());
|
|
1108
|
+
}
|
|
1109
|
+
listIds() {
|
|
1110
|
+
return Array.from(this.strategies.keys());
|
|
1111
|
+
}
|
|
1112
|
+
has(e) {
|
|
1113
|
+
return this.strategies.has(e);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
const ft = new gt();
|
|
1117
|
+
let pt = 0;
|
|
1118
|
+
function Te() {
|
|
1119
|
+
return `pallet-${++pt}`;
|
|
1120
|
+
}
|
|
1121
|
+
class Z {
|
|
1122
|
+
// ═══ Palets estándar internacionales ═══════════════════════════
|
|
1123
|
+
/** Palet EUR/EPAL — Estándar europeo (1200×800×144mm, ISO 6780, madera, 1000kg) */
|
|
1124
|
+
static euro(e) {
|
|
1125
|
+
return Z.fromPreset("EUR", e);
|
|
1126
|
+
}
|
|
1127
|
+
/** Palet GMA — Estándar norteamericano (1219×1016×145mm, 48"×40", madera, 1200kg) */
|
|
1128
|
+
static gma(e) {
|
|
1129
|
+
return Z.fromPreset("GMA", e);
|
|
1130
|
+
}
|
|
1131
|
+
/** @deprecated Use gma() instead. Alias para compatibilidad. */
|
|
1132
|
+
static american(e) {
|
|
1133
|
+
return Z.gma(e);
|
|
1134
|
+
}
|
|
1135
|
+
/** Palet UK Standard — Reino Unido (1200×1000×150mm, madera, 1000kg) */
|
|
1136
|
+
static uk(e) {
|
|
1137
|
+
return Z.fromPreset("UK", e);
|
|
1138
|
+
}
|
|
1139
|
+
/** Palet Asia — Estándar asiático (1100×1100×150mm, ISO 6780, madera, 1000kg) */
|
|
1140
|
+
static asia(e) {
|
|
1141
|
+
return Z.fromPreset("ASIA", e);
|
|
1142
|
+
}
|
|
1143
|
+
/** Palet australiano — Estándar de Australia (1165×1165×150mm, madera, 1000kg) */
|
|
1144
|
+
static australian(e) {
|
|
1145
|
+
return Z.fromPreset("AUSTRALIAN", e);
|
|
1146
|
+
}
|
|
1147
|
+
/** Medio palet EUR — Half European Pallet (800×600×144mm, madera, 500kg) */
|
|
1148
|
+
static halfEuro(e) {
|
|
1149
|
+
return Z.fromPreset("HALF_EUR", e);
|
|
1150
|
+
}
|
|
1151
|
+
/** Cuarto de palet EUR — Quarter European Pallet (600×400×144mm, madera, 250kg) */
|
|
1152
|
+
static quarterEuro(e) {
|
|
1153
|
+
return Z.fromPreset("QUARTER_EUR", e);
|
|
1154
|
+
}
|
|
1155
|
+
/** Palet ISO 1 — ISO 6780 (1200×1000×150mm, igual que UK) */
|
|
1156
|
+
static iso1(e) {
|
|
1157
|
+
return Z.fromPreset("ISO_1", e);
|
|
1158
|
+
}
|
|
1159
|
+
/** Palet ISO 2 — ISO 6780 (1200×800×144mm, equivalente a EUR) */
|
|
1160
|
+
static iso2(e) {
|
|
1161
|
+
return Z.fromPreset("ISO_2", e);
|
|
1162
|
+
}
|
|
1163
|
+
// ═══ Método genérico desde preset ═════════════════════════════
|
|
1164
|
+
/**
|
|
1165
|
+
* Crea un palet desde un preset por su clave
|
|
1166
|
+
* @param presetKey - Clave del preset (EUR, GMA, UK, ASIA, etc.)
|
|
1167
|
+
* @param overrides - Propiedades a sobrescribir
|
|
1168
|
+
*/
|
|
1169
|
+
static fromPreset(e, t) {
|
|
1170
|
+
const i = ue[e];
|
|
1171
|
+
if (!i)
|
|
1172
|
+
throw new Error(`Unknown pallet preset: ${e}`);
|
|
1173
|
+
return {
|
|
1174
|
+
id: Te(),
|
|
1175
|
+
dimensions: { ...i.dimensions },
|
|
1176
|
+
material: i.material,
|
|
1177
|
+
maxWeight: i.maxWeight,
|
|
1178
|
+
maxStackHeight: i.maxStackHeight,
|
|
1179
|
+
weight: i.weight,
|
|
1180
|
+
metadata: { preset: e },
|
|
1181
|
+
...t
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
// ═══ Palet custom ══════════════════════════════════════════════
|
|
1185
|
+
/** Palet custom con dimensiones arbitrarias */
|
|
1186
|
+
static custom(e, t) {
|
|
1187
|
+
return {
|
|
1188
|
+
id: Te(),
|
|
1189
|
+
dimensions: { ...e },
|
|
1190
|
+
material: L.WOOD,
|
|
1191
|
+
maxWeight: 1e3,
|
|
1192
|
+
maxStackHeight: 2200,
|
|
1193
|
+
weight: 25,
|
|
1194
|
+
metadata: {},
|
|
1195
|
+
...t
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
// ═══ Utilidades ════════════════════════════════════════════════
|
|
1199
|
+
/**
|
|
1200
|
+
* Lista todos los presets disponibles con sus características
|
|
1201
|
+
*/
|
|
1202
|
+
static listPresets() {
|
|
1203
|
+
return Object.entries(ue).map(([e, t]) => ({
|
|
1204
|
+
key: e,
|
|
1205
|
+
dimensions: t.dimensions,
|
|
1206
|
+
maxWeight: t.maxWeight,
|
|
1207
|
+
weight: t.weight
|
|
1208
|
+
}));
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
let vt = 0;
|
|
1212
|
+
function ze() {
|
|
1213
|
+
return `truck-${++vt}`;
|
|
1214
|
+
}
|
|
1215
|
+
class Gt {
|
|
1216
|
+
/** Crea un camión a partir de un preset de tipo */
|
|
1217
|
+
static fromPreset(e, t) {
|
|
1218
|
+
const i = Ze[e];
|
|
1219
|
+
return {
|
|
1220
|
+
id: ze(),
|
|
1221
|
+
name: `Camión ${e}`,
|
|
1222
|
+
truckType: e,
|
|
1223
|
+
dimensions: { ...i.dimensions },
|
|
1224
|
+
maxWeight: i.maxWeight,
|
|
1225
|
+
pallets: [],
|
|
1226
|
+
metadata: {},
|
|
1227
|
+
...t
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
/** Crea un camión custom con dimensiones y peso arbitrarios */
|
|
1231
|
+
static custom(e, t, i) {
|
|
1232
|
+
return {
|
|
1233
|
+
id: ze(),
|
|
1234
|
+
name: "Camión Custom",
|
|
1235
|
+
truckType: ie.CUSTOM,
|
|
1236
|
+
dimensions: { ...e },
|
|
1237
|
+
maxWeight: t,
|
|
1238
|
+
pallets: [],
|
|
1239
|
+
metadata: {},
|
|
1240
|
+
...i
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
let wt = 0;
|
|
1245
|
+
function yt() {
|
|
1246
|
+
return `box-${++wt}`;
|
|
1247
|
+
}
|
|
1248
|
+
class ge {
|
|
1249
|
+
/** Crea una caja con valores por defecto razonables */
|
|
1250
|
+
static create(e, t) {
|
|
1251
|
+
return {
|
|
1252
|
+
id: yt(),
|
|
1253
|
+
dimensions: { ...e },
|
|
1254
|
+
weight: 5,
|
|
1255
|
+
fragile: !1,
|
|
1256
|
+
stackable: !0,
|
|
1257
|
+
metadata: {},
|
|
1258
|
+
...t
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
/** Caja frágil con peso máximo encima */
|
|
1262
|
+
static fragile(e, t, i) {
|
|
1263
|
+
return ge.create(e, {
|
|
1264
|
+
fragile: !0,
|
|
1265
|
+
fragilityMaxWeight: t,
|
|
1266
|
+
...i
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
/** Caja pesada y no apilable */
|
|
1270
|
+
static heavy(e, t, i) {
|
|
1271
|
+
return ge.create(e, {
|
|
1272
|
+
weight: t,
|
|
1273
|
+
stackable: !1,
|
|
1274
|
+
...i
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
function Vt(o, e) {
|
|
1279
|
+
return k(() => {
|
|
1280
|
+
const t = Je(o), i = et(o, e), r = it({ pallet: e, boxes: o }), a = ct(o), f = rt(o), g = at(o), v = dt(e, o), u = lt(e, o), x = ot(o), p = nt(e, o), c = [...f.violations, ...g.violations], l = [...v.violations, ...u.violations], d = [
|
|
1281
|
+
...t.violations,
|
|
1282
|
+
...i.violations,
|
|
1283
|
+
...r.violations,
|
|
1284
|
+
...a.violations,
|
|
1285
|
+
...c,
|
|
1286
|
+
...l,
|
|
1287
|
+
...x.violations,
|
|
1288
|
+
...p.violations
|
|
1289
|
+
];
|
|
1290
|
+
return {
|
|
1291
|
+
isValid: d.filter((h) => h.severity === "error").length === 0,
|
|
1292
|
+
violations: d,
|
|
1293
|
+
collisions: t,
|
|
1294
|
+
bounds: i,
|
|
1295
|
+
weight: r,
|
|
1296
|
+
gravity: a,
|
|
1297
|
+
stacking: {
|
|
1298
|
+
isValid: f.isValid,
|
|
1299
|
+
violations: c
|
|
1300
|
+
},
|
|
1301
|
+
stability: {
|
|
1302
|
+
isValid: v.isValid && u.isValid,
|
|
1303
|
+
violations: l
|
|
1304
|
+
},
|
|
1305
|
+
fragile: x,
|
|
1306
|
+
distribution: p
|
|
1307
|
+
};
|
|
1308
|
+
}, [o, e]);
|
|
1309
|
+
}
|
|
1310
|
+
function Xt(o) {
|
|
1311
|
+
return k(() => {
|
|
1312
|
+
if (!o || o.floors.length === 0)
|
|
1313
|
+
return {
|
|
1314
|
+
volumeUtilization: 0,
|
|
1315
|
+
weightUtilization: 0,
|
|
1316
|
+
centerOfGravity: { x: 0, y: 0, z: 0 },
|
|
1317
|
+
stabilityScore: 100,
|
|
1318
|
+
totalHeight: 0,
|
|
1319
|
+
totalWeight: 0,
|
|
1320
|
+
boxCount: 0,
|
|
1321
|
+
floorCount: 0
|
|
1322
|
+
};
|
|
1323
|
+
const e = le(o), t = we(o), i = o.floors[0].pallet, n = o.floors.flatMap((x) => x.boxes), r = n.length, a = o.floors.length, f = i.dimensions.width * i.maxStackHeight * i.dimensions.depth, g = n.reduce((x, p) => {
|
|
1324
|
+
const c = p.box.dimensions;
|
|
1325
|
+
return x + c.width * c.height * c.depth;
|
|
1326
|
+
}, 0), v = q(n), u = se(i, n);
|
|
1327
|
+
return {
|
|
1328
|
+
volumeUtilization: f > 0 ? g / f : 0,
|
|
1329
|
+
weightUtilization: i.maxWeight > 0 ? t / i.maxWeight : 0,
|
|
1330
|
+
centerOfGravity: v,
|
|
1331
|
+
stabilityScore: u,
|
|
1332
|
+
totalHeight: e,
|
|
1333
|
+
totalWeight: t,
|
|
1334
|
+
boxCount: r,
|
|
1335
|
+
floorCount: a
|
|
1336
|
+
};
|
|
1337
|
+
}, [o]);
|
|
1338
|
+
}
|
|
1339
|
+
function Zt(o, e = ft) {
|
|
1340
|
+
const t = k(
|
|
1341
|
+
() => e.list().map((n) => ({ id: n.id, name: n.name })),
|
|
1342
|
+
[e]
|
|
1343
|
+
), i = H(
|
|
1344
|
+
(n, r) => e.get(o).pack(n, r),
|
|
1345
|
+
[o, e]
|
|
1346
|
+
);
|
|
1347
|
+
return { availableStrategies: t, pack: i };
|
|
1348
|
+
}
|
|
1349
|
+
function Nt(o) {
|
|
1350
|
+
return k(() => {
|
|
1351
|
+
const e = [];
|
|
1352
|
+
for (const n of o.pallets) {
|
|
1353
|
+
const r = We(n, o);
|
|
1354
|
+
e.push(...r.violations);
|
|
1355
|
+
}
|
|
1356
|
+
const t = Qe(o.pallets), i = [
|
|
1357
|
+
...e,
|
|
1358
|
+
...t.violations
|
|
1359
|
+
];
|
|
1360
|
+
return {
|
|
1361
|
+
isValid: i.filter((n) => n.severity === "error").length === 0,
|
|
1362
|
+
violations: i,
|
|
1363
|
+
palletInRoom: {
|
|
1364
|
+
isValid: e.length === 0,
|
|
1365
|
+
violations: e
|
|
1366
|
+
},
|
|
1367
|
+
palletCollisions: t
|
|
1368
|
+
};
|
|
1369
|
+
}, [o]);
|
|
1370
|
+
}
|
|
1371
|
+
const bt = V(function({
|
|
1372
|
+
placedBox: e,
|
|
1373
|
+
selected: t = !1,
|
|
1374
|
+
highlighted: i = !1,
|
|
1375
|
+
showLabel: n = !1,
|
|
1376
|
+
color: r,
|
|
1377
|
+
opacity: a,
|
|
1378
|
+
selectedColor: f,
|
|
1379
|
+
highlightedColor: g,
|
|
1380
|
+
onClick: v,
|
|
1381
|
+
onHover: u
|
|
1382
|
+
}) {
|
|
1383
|
+
const x = Ee(null), p = ce(), { box: c, position: l, rotation: d } = e, h = Y.MM_TO_M, j = r ?? c.color ?? p.box.color, T = a ?? p.box.opacity, z = f ?? p.selection.selectedColor, b = g ?? p.selection.highlightedColor;
|
|
1384
|
+
let M = c.dimensions.width, _ = c.dimensions.depth;
|
|
1385
|
+
(d.y === 90 || d.y === 270) && ([M, _] = [_, M]);
|
|
1386
|
+
const y = k(
|
|
1387
|
+
() => [M * h, c.dimensions.height * h, _ * h],
|
|
1388
|
+
[M, _, c.dimensions.height, h]
|
|
1389
|
+
), w = k(
|
|
1390
|
+
() => new $.Vector3(
|
|
1391
|
+
l.x * h + y[0] / 2,
|
|
1392
|
+
l.y * h + y[1] / 2,
|
|
1393
|
+
l.z * h + y[2] / 2
|
|
1394
|
+
),
|
|
1395
|
+
[l, y, h]
|
|
1396
|
+
), S = t ? z : i ? b : null, E = H(
|
|
1397
|
+
(P) => {
|
|
1398
|
+
P.stopPropagation(), v?.(e.id);
|
|
1399
|
+
},
|
|
1400
|
+
[v, e.id]
|
|
1401
|
+
), R = H(
|
|
1402
|
+
(P) => {
|
|
1403
|
+
P.stopPropagation(), u?.(e.id);
|
|
1404
|
+
},
|
|
1405
|
+
[u, e.id]
|
|
1406
|
+
), O = H(() => {
|
|
1407
|
+
u?.(null);
|
|
1408
|
+
}, [u]);
|
|
1409
|
+
return /* @__PURE__ */ s.jsxs("group", { children: [
|
|
1410
|
+
/* @__PURE__ */ s.jsxs(
|
|
1411
|
+
"mesh",
|
|
1412
|
+
{
|
|
1413
|
+
ref: x,
|
|
1414
|
+
position: w,
|
|
1415
|
+
onClick: E,
|
|
1416
|
+
onPointerOver: R,
|
|
1417
|
+
onPointerOut: O,
|
|
1418
|
+
castShadow: !0,
|
|
1419
|
+
receiveShadow: !0,
|
|
1420
|
+
children: [
|
|
1421
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: y }),
|
|
1422
|
+
/* @__PURE__ */ s.jsx(
|
|
1423
|
+
"meshStandardMaterial",
|
|
1424
|
+
{
|
|
1425
|
+
color: j,
|
|
1426
|
+
transparent: T < 1,
|
|
1427
|
+
opacity: T,
|
|
1428
|
+
roughness: p.box.roughness,
|
|
1429
|
+
metalness: p.box.metalness
|
|
1430
|
+
}
|
|
1431
|
+
)
|
|
1432
|
+
]
|
|
1433
|
+
}
|
|
1434
|
+
),
|
|
1435
|
+
S && /* @__PURE__ */ s.jsxs("mesh", { position: w, children: [
|
|
1436
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: y }),
|
|
1437
|
+
/* @__PURE__ */ s.jsx(
|
|
1438
|
+
"meshBasicMaterial",
|
|
1439
|
+
{
|
|
1440
|
+
color: S,
|
|
1441
|
+
wireframe: !0,
|
|
1442
|
+
wireframeLinewidth: 1,
|
|
1443
|
+
transparent: !0,
|
|
1444
|
+
opacity: 0.9,
|
|
1445
|
+
depthTest: !1
|
|
1446
|
+
}
|
|
1447
|
+
)
|
|
1448
|
+
] }),
|
|
1449
|
+
S && /* @__PURE__ */ s.jsxs("lineSegments", { position: w, renderOrder: 999, children: [
|
|
1450
|
+
/* @__PURE__ */ s.jsx("edgesGeometry", { args: [new $.BoxGeometry(...y)] }),
|
|
1451
|
+
/* @__PURE__ */ s.jsx("lineBasicMaterial", { color: S })
|
|
1452
|
+
] }),
|
|
1453
|
+
n && /* @__PURE__ */ s.jsx(
|
|
1454
|
+
ke,
|
|
1455
|
+
{
|
|
1456
|
+
position: [w.x, w.y + y[1] / 2 + 0.05, w.z],
|
|
1457
|
+
center: !0,
|
|
1458
|
+
style: {
|
|
1459
|
+
background: "rgba(0,0,0,0.75)",
|
|
1460
|
+
color: "white",
|
|
1461
|
+
padding: "2px 6px",
|
|
1462
|
+
borderRadius: "3px",
|
|
1463
|
+
fontSize: "11px",
|
|
1464
|
+
whiteSpace: "nowrap",
|
|
1465
|
+
pointerEvents: "none"
|
|
1466
|
+
},
|
|
1467
|
+
children: c.sku ?? c.type ?? c.id
|
|
1468
|
+
}
|
|
1469
|
+
)
|
|
1470
|
+
] });
|
|
1471
|
+
}), jt = V(function({
|
|
1472
|
+
pallet: e,
|
|
1473
|
+
position: t = { x: 0, y: 0, z: 0 },
|
|
1474
|
+
color: i,
|
|
1475
|
+
edgeColor: n
|
|
1476
|
+
}) {
|
|
1477
|
+
const r = ce(), a = i ?? r.pallet.color, f = n ?? r.pallet.edgeColor, g = Y.MM_TO_M, v = e.dimensions, u = k(
|
|
1478
|
+
() => [v.width * g, v.height * g, v.depth * g],
|
|
1479
|
+
[v, g]
|
|
1480
|
+
), x = k(
|
|
1481
|
+
() => new $.Vector3(
|
|
1482
|
+
t.x * g + u[0] / 2,
|
|
1483
|
+
t.y * g + u[1] / 2,
|
|
1484
|
+
t.z * g + u[2] / 2
|
|
1485
|
+
),
|
|
1486
|
+
[t, u, g]
|
|
1487
|
+
);
|
|
1488
|
+
return /* @__PURE__ */ s.jsxs("group", { children: [
|
|
1489
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: x, castShadow: !0, receiveShadow: !0, children: [
|
|
1490
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: u }),
|
|
1491
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: a, roughness: r.pallet.roughness, metalness: r.pallet.metalness })
|
|
1492
|
+
] }),
|
|
1493
|
+
/* @__PURE__ */ s.jsxs("lineSegments", { position: x, children: [
|
|
1494
|
+
/* @__PURE__ */ s.jsx("edgesGeometry", { args: [new $.BoxGeometry(...u)] }),
|
|
1495
|
+
/* @__PURE__ */ s.jsx("lineBasicMaterial", { color: f })
|
|
1496
|
+
] })
|
|
1497
|
+
] });
|
|
1498
|
+
}), St = {
|
|
1499
|
+
[me.CARDBOARD]: "#b5926b",
|
|
1500
|
+
[me.WOOD]: "#c4a26e",
|
|
1501
|
+
[me.PLASTIC]: "#90a4ae"
|
|
1502
|
+
}, Ct = V(function({
|
|
1503
|
+
separator: e,
|
|
1504
|
+
position: t = { x: 0, y: 0, z: 0 }
|
|
1505
|
+
}) {
|
|
1506
|
+
const i = Y.MM_TO_M, n = e.dimensions, r = k(
|
|
1507
|
+
() => [n.width * i, n.height * i, n.depth * i],
|
|
1508
|
+
[n, i]
|
|
1509
|
+
), a = k(
|
|
1510
|
+
() => new $.Vector3(
|
|
1511
|
+
t.x * i + r[0] / 2,
|
|
1512
|
+
t.y * i + r[1] / 2,
|
|
1513
|
+
t.z * i + r[2] / 2
|
|
1514
|
+
),
|
|
1515
|
+
[t, r, i]
|
|
1516
|
+
), f = St[e.material];
|
|
1517
|
+
return /* @__PURE__ */ s.jsxs("mesh", { position: a, receiveShadow: !0, children: [
|
|
1518
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: r }),
|
|
1519
|
+
/* @__PURE__ */ s.jsx(
|
|
1520
|
+
"meshStandardMaterial",
|
|
1521
|
+
{
|
|
1522
|
+
color: f,
|
|
1523
|
+
roughness: 0.9,
|
|
1524
|
+
metalness: 0,
|
|
1525
|
+
transparent: !0,
|
|
1526
|
+
opacity: 0.85
|
|
1527
|
+
}
|
|
1528
|
+
)
|
|
1529
|
+
] });
|
|
1530
|
+
}), be = V(
|
|
1531
|
+
function({
|
|
1532
|
+
stackedPallet: e,
|
|
1533
|
+
position: t = { x: 0, y: 0, z: 0 },
|
|
1534
|
+
yRotation: i = 0,
|
|
1535
|
+
palletId: n,
|
|
1536
|
+
selectedBoxId: r,
|
|
1537
|
+
highlightedBoxId: a,
|
|
1538
|
+
selectedColor: f,
|
|
1539
|
+
highlightedColor: g,
|
|
1540
|
+
showLabels: v = !1,
|
|
1541
|
+
onBoxClick: u,
|
|
1542
|
+
onBoxHover: x
|
|
1543
|
+
}) {
|
|
1544
|
+
const p = k(
|
|
1545
|
+
() => qe(e, n),
|
|
1546
|
+
[e, n]
|
|
1547
|
+
), c = Y.MM_TO_M, l = k(() => i * Math.PI / 180, [i]), d = k(() => {
|
|
1548
|
+
const h = [];
|
|
1549
|
+
let j = 0;
|
|
1550
|
+
for (const T of p.floors) {
|
|
1551
|
+
h.push(j), j += T.pallet.dimensions.height;
|
|
1552
|
+
const z = T.boxes.reduce(
|
|
1553
|
+
(b, M) => Math.max(b, M.position.y + M.box.dimensions.height),
|
|
1554
|
+
0
|
|
1555
|
+
);
|
|
1556
|
+
j += z, T.separatorAbove && (j += T.separatorAbove.dimensions.height);
|
|
1557
|
+
}
|
|
1558
|
+
return h;
|
|
1559
|
+
}, [p]);
|
|
1560
|
+
return /* @__PURE__ */ s.jsx(
|
|
1561
|
+
"group",
|
|
1562
|
+
{
|
|
1563
|
+
position: [t.x * c, t.y * c, t.z * c],
|
|
1564
|
+
rotation: [0, l, 0],
|
|
1565
|
+
children: p.floors.map((h, j) => {
|
|
1566
|
+
const T = d[j], z = T + h.pallet.dimensions.height;
|
|
1567
|
+
return /* @__PURE__ */ s.jsxs("group", { children: [
|
|
1568
|
+
/* @__PURE__ */ s.jsx(
|
|
1569
|
+
jt,
|
|
1570
|
+
{
|
|
1571
|
+
pallet: h.pallet,
|
|
1572
|
+
position: { x: 0, y: T, z: 0 }
|
|
1573
|
+
}
|
|
1574
|
+
),
|
|
1575
|
+
h.boxes.map((b) => /* @__PURE__ */ s.jsx(
|
|
1576
|
+
bt,
|
|
1577
|
+
{
|
|
1578
|
+
placedBox: {
|
|
1579
|
+
...b,
|
|
1580
|
+
position: {
|
|
1581
|
+
x: b.position.x,
|
|
1582
|
+
y: b.position.y + z,
|
|
1583
|
+
z: b.position.z
|
|
1584
|
+
}
|
|
1585
|
+
},
|
|
1586
|
+
selected: r === b.id,
|
|
1587
|
+
highlighted: a === b.id,
|
|
1588
|
+
selectedColor: f,
|
|
1589
|
+
highlightedColor: g,
|
|
1590
|
+
showLabel: v,
|
|
1591
|
+
onClick: u,
|
|
1592
|
+
onHover: x
|
|
1593
|
+
},
|
|
1594
|
+
b.id
|
|
1595
|
+
)),
|
|
1596
|
+
h.separatorAbove && /* @__PURE__ */ s.jsx(
|
|
1597
|
+
Ct,
|
|
1598
|
+
{
|
|
1599
|
+
separator: h.separatorAbove,
|
|
1600
|
+
position: {
|
|
1601
|
+
x: 0,
|
|
1602
|
+
y: z + h.boxes.reduce(
|
|
1603
|
+
(b, M) => Math.max(b, M.position.y + M.box.dimensions.height),
|
|
1604
|
+
0
|
|
1605
|
+
),
|
|
1606
|
+
z: 0
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
)
|
|
1610
|
+
] }, `floor-${j}`);
|
|
1611
|
+
})
|
|
1612
|
+
}
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1615
|
+
), Lt = V(function({
|
|
1616
|
+
text: e,
|
|
1617
|
+
position: t,
|
|
1618
|
+
visible: i = !0,
|
|
1619
|
+
fontSize: n = 12,
|
|
1620
|
+
color: r = "white",
|
|
1621
|
+
background: a = "rgba(0,0,0,0.75)"
|
|
1622
|
+
}) {
|
|
1623
|
+
if (!i) return null;
|
|
1624
|
+
const f = Y.MM_TO_M;
|
|
1625
|
+
return /* @__PURE__ */ s.jsx(
|
|
1626
|
+
ke,
|
|
1627
|
+
{
|
|
1628
|
+
position: [t.x * f, t.y * f, t.z * f],
|
|
1629
|
+
center: !0,
|
|
1630
|
+
style: {
|
|
1631
|
+
background: a,
|
|
1632
|
+
color: r,
|
|
1633
|
+
padding: "2px 8px",
|
|
1634
|
+
borderRadius: "4px",
|
|
1635
|
+
fontSize: `${n}px`,
|
|
1636
|
+
whiteSpace: "nowrap",
|
|
1637
|
+
pointerEvents: "none",
|
|
1638
|
+
userSelect: "none"
|
|
1639
|
+
},
|
|
1640
|
+
children: e
|
|
1641
|
+
}
|
|
1642
|
+
);
|
|
1643
|
+
}), Mt = V(
|
|
1644
|
+
function({
|
|
1645
|
+
room: e,
|
|
1646
|
+
floorColor: t,
|
|
1647
|
+
wallColor: i,
|
|
1648
|
+
showGrid: n,
|
|
1649
|
+
children: r
|
|
1650
|
+
}) {
|
|
1651
|
+
const a = ce(), f = t ?? a.warehouse.floorColor, g = i ?? a.warehouse.wallColor, v = n ?? a.warehouse.showGrid, u = Y.MM_TO_M, x = e.ceilingHeight * u, { shape: p, minX: c, maxX: l, minZ: d, maxZ: h } = k(() => {
|
|
1652
|
+
const y = e.floorPolygon;
|
|
1653
|
+
let w = 1 / 0, S = -1 / 0, E = 1 / 0, R = -1 / 0;
|
|
1654
|
+
for (const P of y)
|
|
1655
|
+
w = Math.min(w, P.x * u), S = Math.max(S, P.x * u), E = Math.min(E, P.z * u), R = Math.max(R, P.z * u);
|
|
1656
|
+
const O = new $.Shape();
|
|
1657
|
+
O.moveTo(y[0].x * u, -y[0].z * u);
|
|
1658
|
+
for (let P = 1; P < y.length; P++)
|
|
1659
|
+
O.lineTo(y[P].x * u, -y[P].z * u);
|
|
1660
|
+
return O.closePath(), { shape: O, minX: w, maxX: S, minZ: E, maxZ: R };
|
|
1661
|
+
}, [e.floorPolygon, u]), j = k(() => {
|
|
1662
|
+
const y = e.floorPolygon, w = [], S = [];
|
|
1663
|
+
for (let R = 0; R < y.length; R++) {
|
|
1664
|
+
const O = y[R], P = y[(R + 1) % y.length], A = R * 4;
|
|
1665
|
+
w.push(
|
|
1666
|
+
O.x * u,
|
|
1667
|
+
0,
|
|
1668
|
+
O.z * u,
|
|
1669
|
+
P.x * u,
|
|
1670
|
+
0,
|
|
1671
|
+
P.z * u,
|
|
1672
|
+
P.x * u,
|
|
1673
|
+
x,
|
|
1674
|
+
P.z * u,
|
|
1675
|
+
O.x * u,
|
|
1676
|
+
x,
|
|
1677
|
+
O.z * u
|
|
1678
|
+
), S.push(
|
|
1679
|
+
A,
|
|
1680
|
+
A + 1,
|
|
1681
|
+
A + 2,
|
|
1682
|
+
A,
|
|
1683
|
+
A + 2,
|
|
1684
|
+
A + 3
|
|
1685
|
+
);
|
|
1686
|
+
}
|
|
1687
|
+
const E = new $.BufferGeometry();
|
|
1688
|
+
return E.setAttribute("position", new $.Float32BufferAttribute(w, 3)), E.setIndex(S), E.computeVertexNormals(), E;
|
|
1689
|
+
}, [e.floorPolygon, x, u]), T = l - c, z = h - d, b = (c + l) / 2, M = (d + h) / 2, _ = k(() => {
|
|
1690
|
+
if (!v) return null;
|
|
1691
|
+
const y = 0.5, w = 0.01, S = [];
|
|
1692
|
+
for (let R = c; R <= l; R += y)
|
|
1693
|
+
S.push(R, w, d, R, w, h);
|
|
1694
|
+
for (let R = d; R <= h; R += y)
|
|
1695
|
+
S.push(c, w, R, l, w, R);
|
|
1696
|
+
const E = new $.BufferGeometry();
|
|
1697
|
+
return E.setAttribute("position", new $.Float32BufferAttribute(S, 3)), E;
|
|
1698
|
+
}, [v, c, l, d, h]);
|
|
1699
|
+
return /* @__PURE__ */ s.jsxs("group", { children: [
|
|
1700
|
+
/* @__PURE__ */ s.jsxs("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -5e-3, 0], receiveShadow: !0, children: [
|
|
1701
|
+
/* @__PURE__ */ s.jsx("shapeGeometry", { args: [p] }),
|
|
1702
|
+
/* @__PURE__ */ s.jsx(
|
|
1703
|
+
"meshStandardMaterial",
|
|
1704
|
+
{
|
|
1705
|
+
color: f,
|
|
1706
|
+
side: $.DoubleSide,
|
|
1707
|
+
roughness: a.warehouse.floorRoughness
|
|
1708
|
+
}
|
|
1709
|
+
)
|
|
1710
|
+
] }),
|
|
1711
|
+
/* @__PURE__ */ s.jsx("mesh", { geometry: j, position: [0, 0, 0], receiveShadow: !0, children: /* @__PURE__ */ s.jsx(
|
|
1712
|
+
"meshStandardMaterial",
|
|
1713
|
+
{
|
|
1714
|
+
color: g,
|
|
1715
|
+
side: $.DoubleSide,
|
|
1716
|
+
roughness: 0.7,
|
|
1717
|
+
transparent: !0,
|
|
1718
|
+
opacity: a.warehouse.wallOpacity
|
|
1719
|
+
}
|
|
1720
|
+
) }),
|
|
1721
|
+
v && _ && /* @__PURE__ */ s.jsx("lineSegments", { geometry: _, children: /* @__PURE__ */ s.jsx(
|
|
1722
|
+
"lineBasicMaterial",
|
|
1723
|
+
{
|
|
1724
|
+
color: a.warehouse.gridColor,
|
|
1725
|
+
opacity: 0.5,
|
|
1726
|
+
transparent: !0,
|
|
1727
|
+
depthWrite: !1
|
|
1728
|
+
}
|
|
1729
|
+
) }),
|
|
1730
|
+
/* @__PURE__ */ s.jsx("ambientLight", { intensity: a.warehouse.ambientIntensity }),
|
|
1731
|
+
/* @__PURE__ */ s.jsx(
|
|
1732
|
+
"directionalLight",
|
|
1733
|
+
{
|
|
1734
|
+
position: [b + T, x * 0.8, M + z],
|
|
1735
|
+
intensity: a.warehouse.directionalIntensity,
|
|
1736
|
+
castShadow: !0,
|
|
1737
|
+
"shadow-mapSize-width": 1024,
|
|
1738
|
+
"shadow-mapSize-height": 1024
|
|
1739
|
+
}
|
|
1740
|
+
),
|
|
1741
|
+
/* @__PURE__ */ s.jsx(
|
|
1742
|
+
"pointLight",
|
|
1743
|
+
{
|
|
1744
|
+
position: [b, x * 0.9, M],
|
|
1745
|
+
intensity: 0.5,
|
|
1746
|
+
distance: Math.max(T, z) * 2
|
|
1747
|
+
}
|
|
1748
|
+
),
|
|
1749
|
+
r
|
|
1750
|
+
] });
|
|
1751
|
+
}
|
|
1752
|
+
), K = V(function({ position: e, radius: t, width: i, color: n }) {
|
|
1753
|
+
return /* @__PURE__ */ s.jsxs("group", { position: e, children: [
|
|
1754
|
+
/* @__PURE__ */ s.jsxs("mesh", { rotation: [0, 0, Math.PI / 2], castShadow: !0, children: [
|
|
1755
|
+
/* @__PURE__ */ s.jsx("cylinderGeometry", { args: [t, t, i, 24] }),
|
|
1756
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: n, roughness: 0.9, metalness: 0.1 })
|
|
1757
|
+
] }),
|
|
1758
|
+
/* @__PURE__ */ s.jsxs("mesh", { rotation: [0, 0, Math.PI / 2], children: [
|
|
1759
|
+
/* @__PURE__ */ s.jsx("cylinderGeometry", { args: [t * 0.55, t * 0.55, i + 5e-3, 16] }),
|
|
1760
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: "#888888", roughness: 0.3, metalness: 0.7 })
|
|
1761
|
+
] })
|
|
1762
|
+
] });
|
|
1763
|
+
}), Pt = V(function({
|
|
1764
|
+
truck: e,
|
|
1765
|
+
showGrid: t,
|
|
1766
|
+
wallOpacity: i = 0.3,
|
|
1767
|
+
showRoof: n = !1,
|
|
1768
|
+
showSideWalls: r = !0,
|
|
1769
|
+
children: a
|
|
1770
|
+
}) {
|
|
1771
|
+
const g = ce().truck, v = t ?? g.showGrid, u = Y.MM_TO_M, x = e.dimensions.width * u, p = e.dimensions.height * u, c = e.dimensions.depth * u, l = 0.05, d = 0.08, h = 0.28, j = 0.18, T = 0.15, z = 0.25, b = h + T, M = b + h + 0.1, _ = M + z / 2 + d / 2, y = x + l * 2, w = x * 0.65, S = p * 0.85, E = 0.15, R = c + l + E, O = _, P = k(() => {
|
|
1772
|
+
if (!v) return null;
|
|
1773
|
+
const G = 0.5, N = _ + 2e-3, U = [];
|
|
1774
|
+
for (let X = 0; X <= x; X += G)
|
|
1775
|
+
U.push(X, N, 0, X, N, c);
|
|
1776
|
+
for (let X = 0; X <= c; X += G)
|
|
1777
|
+
U.push(0, N, X, x, N, X);
|
|
1778
|
+
const F = new $.BufferGeometry();
|
|
1779
|
+
return F.setAttribute("position", new $.Float32BufferAttribute(U, 3)), F;
|
|
1780
|
+
}, [v, x, c, _]), A = k(
|
|
1781
|
+
() => /* @__PURE__ */ s.jsx(
|
|
1782
|
+
"meshStandardMaterial",
|
|
1783
|
+
{
|
|
1784
|
+
color: g.wallColor,
|
|
1785
|
+
roughness: 0.5,
|
|
1786
|
+
metalness: 0.3,
|
|
1787
|
+
transparent: i < 1,
|
|
1788
|
+
opacity: i,
|
|
1789
|
+
side: $.DoubleSide,
|
|
1790
|
+
depthWrite: i >= 0.95
|
|
1791
|
+
}
|
|
1792
|
+
),
|
|
1793
|
+
[g.wallColor, i]
|
|
1794
|
+
);
|
|
1795
|
+
return /* @__PURE__ */ s.jsxs("group", { children: [
|
|
1796
|
+
/* @__PURE__ */ s.jsxs(
|
|
1797
|
+
"mesh",
|
|
1798
|
+
{
|
|
1799
|
+
position: [x / 2, _, c / 2],
|
|
1800
|
+
rotation: [-Math.PI / 2, 0, 0],
|
|
1801
|
+
receiveShadow: !0,
|
|
1802
|
+
children: [
|
|
1803
|
+
/* @__PURE__ */ s.jsx("planeGeometry", { args: [x, c] }),
|
|
1804
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.floorColor, roughness: 0.85 })
|
|
1805
|
+
]
|
|
1806
|
+
}
|
|
1807
|
+
),
|
|
1808
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [x / 2, _ - d / 2, c / 2], castShadow: !0, receiveShadow: !0, children: [
|
|
1809
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [x + l * 2, d, c + l] }),
|
|
1810
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.floorColor, roughness: 0.85, metalness: 0.1 })
|
|
1811
|
+
] }),
|
|
1812
|
+
r && /* @__PURE__ */ s.jsxs("mesh", { position: [-l / 2, _ + p / 2, c / 2], castShadow: !0, children: [
|
|
1813
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [l, p, c + l] }),
|
|
1814
|
+
A
|
|
1815
|
+
] }),
|
|
1816
|
+
r && /* @__PURE__ */ s.jsxs("mesh", { position: [x + l / 2, _ + p / 2, c / 2], castShadow: !0, children: [
|
|
1817
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [l, p, c + l] }),
|
|
1818
|
+
A
|
|
1819
|
+
] }),
|
|
1820
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [x / 2, _ + p / 2, c + l / 2], castShadow: !0, children: [
|
|
1821
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [x + l * 2, p, l] }),
|
|
1822
|
+
A
|
|
1823
|
+
] }),
|
|
1824
|
+
n && /* @__PURE__ */ s.jsxs("mesh", { position: [x / 2, _ + p, c / 2], castShadow: !0, children: [
|
|
1825
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [x + l * 2, l, c + l] }),
|
|
1826
|
+
A
|
|
1827
|
+
] }),
|
|
1828
|
+
v && P && /* @__PURE__ */ s.jsx("lineSegments", { geometry: P, children: /* @__PURE__ */ s.jsx(
|
|
1829
|
+
"lineBasicMaterial",
|
|
1830
|
+
{
|
|
1831
|
+
color: g.gridColor,
|
|
1832
|
+
opacity: 0.5,
|
|
1833
|
+
transparent: !0,
|
|
1834
|
+
depthWrite: !1
|
|
1835
|
+
}
|
|
1836
|
+
) }),
|
|
1837
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [x * 0.25, M, (c + w + E) / 2], castShadow: !0, children: [
|
|
1838
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [0.12, z, c + w + E] }),
|
|
1839
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
1840
|
+
] }),
|
|
1841
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [x * 0.75, M, (c + w + E) / 2], castShadow: !0, children: [
|
|
1842
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [0.12, z, c + w + E] }),
|
|
1843
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
1844
|
+
] }),
|
|
1845
|
+
[0.15, 0.35, 0.55, 0.75, 0.95].map((G) => /* @__PURE__ */ s.jsxs("mesh", { position: [x / 2, M, c * G], castShadow: !0, children: [
|
|
1846
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [x * 0.6, 0.06, 0.06] }),
|
|
1847
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.chassisColor, roughness: 0.7, metalness: 0.5 })
|
|
1848
|
+
] }, G)),
|
|
1849
|
+
/* @__PURE__ */ s.jsx(K, { position: [-j / 2 - l, b, c * 0.12], radius: h, width: j, color: g.wheelColor }),
|
|
1850
|
+
/* @__PURE__ */ s.jsx(K, { position: [x + j / 2 + l, b, c * 0.12], radius: h, width: j, color: g.wheelColor }),
|
|
1851
|
+
/* @__PURE__ */ s.jsx(K, { position: [-j / 2 - l, b, c * 0.22], radius: h, width: j, color: g.wheelColor }),
|
|
1852
|
+
/* @__PURE__ */ s.jsx(K, { position: [x + j / 2 + l, b, c * 0.22], radius: h, width: j, color: g.wheelColor }),
|
|
1853
|
+
/* @__PURE__ */ s.jsx(K, { position: [-j / 2 - l, b, R + w * 0.5], radius: h, width: j, color: g.wheelColor }),
|
|
1854
|
+
/* @__PURE__ */ s.jsx(K, { position: [x + j / 2 + l, b, R + w * 0.5], radius: h, width: j, color: g.wheelColor }),
|
|
1855
|
+
/* @__PURE__ */ s.jsxs("group", { position: [x / 2, O, R], children: [
|
|
1856
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [0, S / 2, w / 2], castShadow: !0, receiveShadow: !0, children: [
|
|
1857
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [y, S, w] }),
|
|
1858
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.cabColor, roughness: 0.4, metalness: 0.3 })
|
|
1859
|
+
] }),
|
|
1860
|
+
/* @__PURE__ */ s.jsxs(
|
|
1861
|
+
"mesh",
|
|
1862
|
+
{
|
|
1863
|
+
position: [0, S * 0.6, w + 0.01],
|
|
1864
|
+
castShadow: !0,
|
|
1865
|
+
children: [
|
|
1866
|
+
/* @__PURE__ */ s.jsx("planeGeometry", { args: [y * 0.75, S * 0.4] }),
|
|
1867
|
+
/* @__PURE__ */ s.jsx(
|
|
1868
|
+
"meshStandardMaterial",
|
|
1869
|
+
{
|
|
1870
|
+
color: "#88bbdd",
|
|
1871
|
+
transparent: !0,
|
|
1872
|
+
opacity: 0.5,
|
|
1873
|
+
roughness: 0.1,
|
|
1874
|
+
metalness: 0.6,
|
|
1875
|
+
side: $.DoubleSide
|
|
1876
|
+
}
|
|
1877
|
+
)
|
|
1878
|
+
]
|
|
1879
|
+
}
|
|
1880
|
+
),
|
|
1881
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [-y / 2 - 0.01, S * 0.6, w * 0.55], rotation: [0, Math.PI / 2, 0], children: [
|
|
1882
|
+
/* @__PURE__ */ s.jsx("planeGeometry", { args: [w * 0.5, S * 0.3] }),
|
|
1883
|
+
/* @__PURE__ */ s.jsx(
|
|
1884
|
+
"meshStandardMaterial",
|
|
1885
|
+
{
|
|
1886
|
+
color: "#88bbdd",
|
|
1887
|
+
transparent: !0,
|
|
1888
|
+
opacity: 0.4,
|
|
1889
|
+
roughness: 0.1,
|
|
1890
|
+
metalness: 0.6,
|
|
1891
|
+
side: $.DoubleSide
|
|
1892
|
+
}
|
|
1893
|
+
)
|
|
1894
|
+
] }),
|
|
1895
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [y / 2 + 0.01, S * 0.6, w * 0.55], rotation: [0, -Math.PI / 2, 0], children: [
|
|
1896
|
+
/* @__PURE__ */ s.jsx("planeGeometry", { args: [w * 0.5, S * 0.3] }),
|
|
1897
|
+
/* @__PURE__ */ s.jsx(
|
|
1898
|
+
"meshStandardMaterial",
|
|
1899
|
+
{
|
|
1900
|
+
color: "#88bbdd",
|
|
1901
|
+
transparent: !0,
|
|
1902
|
+
opacity: 0.4,
|
|
1903
|
+
roughness: 0.1,
|
|
1904
|
+
metalness: 0.6,
|
|
1905
|
+
side: $.DoubleSide
|
|
1906
|
+
}
|
|
1907
|
+
)
|
|
1908
|
+
] }),
|
|
1909
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [0, S + 0.04, w / 2], children: [
|
|
1910
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [y * 0.95, 0.08, w * 0.9] }),
|
|
1911
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.cabColor, roughness: 0.4, metalness: 0.3 })
|
|
1912
|
+
] }),
|
|
1913
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [0, S + 0.25, w * 0.1], rotation: [-0.3, 0, 0], children: [
|
|
1914
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [y * 0.9, 0.04, w * 0.5] }),
|
|
1915
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.cabColor, roughness: 0.4, metalness: 0.3 })
|
|
1916
|
+
] }),
|
|
1917
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [-y * 0.35, S * 0.2, w + 0.02], children: [
|
|
1918
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [y * 0.15, 0.08, 0.02] }),
|
|
1919
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: "#ffffcc", emissive: "#ffffaa", emissiveIntensity: 0.3 })
|
|
1920
|
+
] }),
|
|
1921
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [y * 0.35, S * 0.2, w + 0.02], children: [
|
|
1922
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [y * 0.15, 0.08, 0.02] }),
|
|
1923
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: "#ffffcc", emissive: "#ffffaa", emissiveIntensity: 0.3 })
|
|
1924
|
+
] }),
|
|
1925
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [0, 0.06, w + 0.04], castShadow: !0, children: [
|
|
1926
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [y * 1.02, 0.12, 0.06] }),
|
|
1927
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.chassisColor, roughness: 0.5, metalness: 0.6 })
|
|
1928
|
+
] })
|
|
1929
|
+
] }),
|
|
1930
|
+
[-1, 1].map((G) => /* @__PURE__ */ s.jsxs(
|
|
1931
|
+
"mesh",
|
|
1932
|
+
{
|
|
1933
|
+
position: [
|
|
1934
|
+
G === -1 ? -l - j * 0.5 : x + l + j * 0.5,
|
|
1935
|
+
b + h * 0.6,
|
|
1936
|
+
c * 0.17
|
|
1937
|
+
],
|
|
1938
|
+
castShadow: !0,
|
|
1939
|
+
children: [
|
|
1940
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [j + 0.04, 0.04, h * 2.5] }),
|
|
1941
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.chassisColor, roughness: 0.6, metalness: 0.4 })
|
|
1942
|
+
]
|
|
1943
|
+
},
|
|
1944
|
+
`fender-rear-${G}`
|
|
1945
|
+
)),
|
|
1946
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [-l / 2 + 0.01, _ + p * 0.3, -0.01], children: [
|
|
1947
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [0.08, 0.12, 0.02] }),
|
|
1948
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: "#ff3333", emissive: "#ff0000", emissiveIntensity: 0.3 })
|
|
1949
|
+
] }),
|
|
1950
|
+
/* @__PURE__ */ s.jsxs("mesh", { position: [x + l / 2 - 0.01, _ + p * 0.3, -0.01], children: [
|
|
1951
|
+
/* @__PURE__ */ s.jsx("boxGeometry", { args: [0.08, 0.12, 0.02] }),
|
|
1952
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: "#ff3333", emissive: "#ff0000", emissiveIntensity: 0.3 })
|
|
1953
|
+
] }),
|
|
1954
|
+
/* @__PURE__ */ s.jsx("ambientLight", { intensity: 0.45 }),
|
|
1955
|
+
/* @__PURE__ */ s.jsx(
|
|
1956
|
+
"directionalLight",
|
|
1957
|
+
{
|
|
1958
|
+
position: [x / 2, _ + p * 1.5, c * 0.8],
|
|
1959
|
+
intensity: 0.75,
|
|
1960
|
+
castShadow: !0,
|
|
1961
|
+
"shadow-mapSize-width": 1024,
|
|
1962
|
+
"shadow-mapSize-height": 1024
|
|
1963
|
+
}
|
|
1964
|
+
),
|
|
1965
|
+
/* @__PURE__ */ s.jsx("pointLight", { position: [x / 2, _ + p * 0.7, c / 2], intensity: 0.35 }),
|
|
1966
|
+
/* @__PURE__ */ s.jsx("pointLight", { position: [x / 2, _ + p * 0.9, c * 0.3], intensity: 0.25 }),
|
|
1967
|
+
/* @__PURE__ */ s.jsx("group", { position: [0, _, 0], children: a })
|
|
1968
|
+
] });
|
|
1969
|
+
});
|
|
1970
|
+
function Rt(o, e, t) {
|
|
1971
|
+
if (!t)
|
|
1972
|
+
return {
|
|
1973
|
+
perspective: [3, 3, 3],
|
|
1974
|
+
isometric: [4, 4, 4],
|
|
1975
|
+
top: [0, 5, 0],
|
|
1976
|
+
front: [0, 1.5, 5],
|
|
1977
|
+
side: [5, 1.5, 0]
|
|
1978
|
+
}[o];
|
|
1979
|
+
const { width: i, height: n, depth: r } = t, [a, f, g] = e, u = Math.sqrt(i ** 2 + n ** 2 + r ** 2) * 3;
|
|
1980
|
+
switch (o) {
|
|
1981
|
+
case "perspective":
|
|
1982
|
+
return [
|
|
1983
|
+
a + u * 0.6,
|
|
1984
|
+
f + u * 0.5,
|
|
1985
|
+
g + u * 0.6
|
|
1986
|
+
];
|
|
1987
|
+
case "isometric":
|
|
1988
|
+
return [
|
|
1989
|
+
a + u * 0.577,
|
|
1990
|
+
f + u * 0.577,
|
|
1991
|
+
g + u * 0.577
|
|
1992
|
+
];
|
|
1993
|
+
case "top":
|
|
1994
|
+
return [a, f + Math.max(u, n * 2), g];
|
|
1995
|
+
case "front":
|
|
1996
|
+
return [a, f + n * 0.5, g + Math.max(u, r * 1.5)];
|
|
1997
|
+
case "side":
|
|
1998
|
+
return [a + Math.max(u, i * 1.5), f + n * 0.5, g];
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
const je = V(function({
|
|
2002
|
+
preset: e = "perspective",
|
|
2003
|
+
autoRotate: t = !1,
|
|
2004
|
+
enablePan: i = !0,
|
|
2005
|
+
enableZoom: n = !0,
|
|
2006
|
+
target: r = [0, 0, 0],
|
|
2007
|
+
minDistance: a = 0.5,
|
|
2008
|
+
maxDistance: f = 50,
|
|
2009
|
+
sceneSize: g
|
|
2010
|
+
}) {
|
|
2011
|
+
const { camera: v } = Ae(), u = Ee(null);
|
|
2012
|
+
return fe(() => {
|
|
2013
|
+
const x = Rt(e, r, g), p = new $.Vector3(x[0], x[1], x[2]), c = new $.Vector3(...r), l = v.position.clone(), d = 1e3, h = Date.now(), j = () => {
|
|
2014
|
+
const T = Date.now() - h, z = Math.min(T / d, 1), b = 1 - Math.pow(1 - z, 3);
|
|
2015
|
+
v.position.lerpVectors(l, p, b), u.current && (u.current.target.lerp(c, b), u.current.update()), z < 1 && requestAnimationFrame(j);
|
|
2016
|
+
};
|
|
2017
|
+
j();
|
|
2018
|
+
}, [e, g, v, r]), /* @__PURE__ */ s.jsx(
|
|
2019
|
+
Xe,
|
|
2020
|
+
{
|
|
2021
|
+
ref: u,
|
|
2022
|
+
target: r,
|
|
2023
|
+
autoRotate: t,
|
|
2024
|
+
autoRotateSpeed: 0.5,
|
|
2025
|
+
enablePan: i,
|
|
2026
|
+
enableZoom: n,
|
|
2027
|
+
enableRotate: !0,
|
|
2028
|
+
minDistance: a,
|
|
2029
|
+
maxDistance: f,
|
|
2030
|
+
enableDamping: !0,
|
|
2031
|
+
dampingFactor: 0.05,
|
|
2032
|
+
rotateSpeed: 0.5,
|
|
2033
|
+
zoomSpeed: 0.8,
|
|
2034
|
+
panSpeed: 0.5,
|
|
2035
|
+
makeDefault: !0
|
|
2036
|
+
}
|
|
2037
|
+
);
|
|
2038
|
+
}), _t = {
|
|
2039
|
+
perspective: { label: "Perspectiva", icon: "📐" },
|
|
2040
|
+
isometric: { label: "Isométrica", icon: "🔲" },
|
|
2041
|
+
top: { label: "Superior", icon: "⬇️" },
|
|
2042
|
+
front: { label: "Frontal", icon: "➡️" },
|
|
2043
|
+
side: { label: "Lateral", icon: "⬅️" }
|
|
2044
|
+
};
|
|
2045
|
+
V(function({
|
|
2046
|
+
currentPreset: e,
|
|
2047
|
+
onPresetChange: t,
|
|
2048
|
+
position: i = "top-right"
|
|
2049
|
+
}) {
|
|
2050
|
+
const n = ["perspective", "isometric", "top", "front", "side"];
|
|
2051
|
+
return /* @__PURE__ */ s.jsxs("div", { className: `view-controls view-controls--${i}`, children: [
|
|
2052
|
+
/* @__PURE__ */ s.jsx("div", { className: "view-controls__title", children: "Vista" }),
|
|
2053
|
+
/* @__PURE__ */ s.jsx("div", { className: "view-controls__buttons", children: n.map((r) => {
|
|
2054
|
+
const { label: a, icon: f } = _t[r], g = e === r;
|
|
2055
|
+
return /* @__PURE__ */ s.jsxs(
|
|
2056
|
+
"button",
|
|
2057
|
+
{
|
|
2058
|
+
className: `view-controls__button ${g ? "view-controls__button--active" : ""}`,
|
|
2059
|
+
onClick: () => t(r),
|
|
2060
|
+
title: a,
|
|
2061
|
+
"aria-label": a,
|
|
2062
|
+
children: [
|
|
2063
|
+
/* @__PURE__ */ s.jsx("span", { className: "view-controls__icon", role: "img", "aria-hidden": "true", children: f }),
|
|
2064
|
+
/* @__PURE__ */ s.jsx("span", { className: "view-controls__label", children: a })
|
|
2065
|
+
]
|
|
2066
|
+
},
|
|
2067
|
+
r
|
|
2068
|
+
);
|
|
2069
|
+
}) })
|
|
2070
|
+
] });
|
|
2071
|
+
});
|
|
2072
|
+
const Se = V(function({
|
|
2073
|
+
sceneWidth: e,
|
|
2074
|
+
sceneDepth: t,
|
|
2075
|
+
sceneType: i,
|
|
2076
|
+
floorPolygon: n,
|
|
2077
|
+
cameraPosition: r,
|
|
2078
|
+
targetPosition: a,
|
|
2079
|
+
position: f = "bottom-left"
|
|
2080
|
+
}) {
|
|
2081
|
+
const u = k(() => 130 / Math.max(e, t), [e, t]), x = (h, j) => ({
|
|
2082
|
+
x: 10 + h * u,
|
|
2083
|
+
y: 10 + j * u
|
|
2084
|
+
}), p = k(() => i !== "warehouse" || !n || n.length === 0 ? "" : `M ${n.map((j) => {
|
|
2085
|
+
const T = x(j.x, j.z);
|
|
2086
|
+
return `${T.x},${T.y}`;
|
|
2087
|
+
}).join(" L ")} Z`, [i, n, u]), c = k(() => {
|
|
2088
|
+
if (i !== "truck") return null;
|
|
2089
|
+
const h = x(0, 0);
|
|
2090
|
+
return {
|
|
2091
|
+
x: h.x,
|
|
2092
|
+
y: h.y,
|
|
2093
|
+
width: e * u,
|
|
2094
|
+
height: t * u
|
|
2095
|
+
};
|
|
2096
|
+
}, [i, e, t, u]), l = r ? x(r.x, r.z) : null, d = a ? x(a.x, a.z) : null;
|
|
2097
|
+
return /* @__PURE__ */ s.jsxs("div", { className: `minimap minimap--${f}`, children: [
|
|
2098
|
+
/* @__PURE__ */ s.jsx("div", { className: "minimap__title", children: "Mapa" }),
|
|
2099
|
+
/* @__PURE__ */ s.jsxs(
|
|
2100
|
+
"svg",
|
|
2101
|
+
{
|
|
2102
|
+
className: "minimap__canvas",
|
|
2103
|
+
width: 150,
|
|
2104
|
+
height: 150,
|
|
2105
|
+
viewBox: "0 0 150 150",
|
|
2106
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2107
|
+
children: [
|
|
2108
|
+
/* @__PURE__ */ s.jsx("rect", { width: 150, height: 150, fill: "#1a1a2e" }),
|
|
2109
|
+
i === "warehouse" && p && /* @__PURE__ */ s.jsx("path", { d: p, fill: "rgba(96, 165, 250, 0.15)", stroke: "#60a5fa", strokeWidth: "2" }),
|
|
2110
|
+
i === "truck" && c && /* @__PURE__ */ s.jsx(
|
|
2111
|
+
"rect",
|
|
2112
|
+
{
|
|
2113
|
+
x: c.x,
|
|
2114
|
+
y: c.y,
|
|
2115
|
+
width: c.width,
|
|
2116
|
+
height: c.height,
|
|
2117
|
+
fill: "rgba(96, 165, 250, 0.15)",
|
|
2118
|
+
stroke: "#60a5fa",
|
|
2119
|
+
strokeWidth: "2"
|
|
2120
|
+
}
|
|
2121
|
+
),
|
|
2122
|
+
/* @__PURE__ */ s.jsx("defs", { children: /* @__PURE__ */ s.jsx(
|
|
2123
|
+
"pattern",
|
|
2124
|
+
{
|
|
2125
|
+
id: "minimap-grid",
|
|
2126
|
+
width: u,
|
|
2127
|
+
height: u,
|
|
2128
|
+
patternUnits: "userSpaceOnUse",
|
|
2129
|
+
children: /* @__PURE__ */ s.jsx(
|
|
2130
|
+
"path",
|
|
2131
|
+
{
|
|
2132
|
+
d: `M ${u} 0 L 0 0 0 ${u}`,
|
|
2133
|
+
fill: "none",
|
|
2134
|
+
stroke: "rgba(255, 255, 255, 0.08)",
|
|
2135
|
+
strokeWidth: "0.5"
|
|
2136
|
+
}
|
|
2137
|
+
)
|
|
2138
|
+
}
|
|
2139
|
+
) }),
|
|
2140
|
+
i === "truck" && c && /* @__PURE__ */ s.jsx(
|
|
2141
|
+
"rect",
|
|
2142
|
+
{
|
|
2143
|
+
x: c.x,
|
|
2144
|
+
y: c.y,
|
|
2145
|
+
width: c.width,
|
|
2146
|
+
height: c.height,
|
|
2147
|
+
fill: "url(#minimap-grid)"
|
|
2148
|
+
}
|
|
2149
|
+
),
|
|
2150
|
+
d && /* @__PURE__ */ s.jsxs("g", { children: [
|
|
2151
|
+
/* @__PURE__ */ s.jsx("circle", { cx: d.x, cy: d.y, r: "3", fill: "#f87171", opacity: "0.6" }),
|
|
2152
|
+
/* @__PURE__ */ s.jsx("circle", { cx: d.x, cy: d.y, r: "5", fill: "none", stroke: "#f87171", strokeWidth: "1.5" })
|
|
2153
|
+
] }),
|
|
2154
|
+
l && /* @__PURE__ */ s.jsxs("g", { children: [
|
|
2155
|
+
/* @__PURE__ */ s.jsx("circle", { cx: l.x, cy: l.y, r: "4", fill: "#60a5fa" }),
|
|
2156
|
+
d && /* @__PURE__ */ s.jsx(
|
|
2157
|
+
"line",
|
|
2158
|
+
{
|
|
2159
|
+
x1: l.x,
|
|
2160
|
+
y1: l.y,
|
|
2161
|
+
x2: d.x,
|
|
2162
|
+
y2: d.y,
|
|
2163
|
+
stroke: "#60a5fa",
|
|
2164
|
+
strokeWidth: "1",
|
|
2165
|
+
strokeDasharray: "2,2",
|
|
2166
|
+
opacity: "0.6"
|
|
2167
|
+
}
|
|
2168
|
+
)
|
|
2169
|
+
] })
|
|
2170
|
+
]
|
|
2171
|
+
}
|
|
2172
|
+
),
|
|
2173
|
+
/* @__PURE__ */ s.jsxs("div", { className: "minimap__legend", children: [
|
|
2174
|
+
/* @__PURE__ */ s.jsxs("div", { className: "minimap__legend-item", children: [
|
|
2175
|
+
/* @__PURE__ */ s.jsx("span", { className: "minimap__legend-dot minimap__legend-dot--camera" }),
|
|
2176
|
+
/* @__PURE__ */ s.jsx("span", { className: "minimap__legend-text", children: "Cámara" })
|
|
2177
|
+
] }),
|
|
2178
|
+
/* @__PURE__ */ s.jsxs("div", { className: "minimap__legend-item", children: [
|
|
2179
|
+
/* @__PURE__ */ s.jsx("span", { className: "minimap__legend-dot minimap__legend-dot--target" }),
|
|
2180
|
+
/* @__PURE__ */ s.jsx("span", { className: "minimap__legend-text", children: "Objetivo" })
|
|
2181
|
+
] })
|
|
2182
|
+
] })
|
|
2183
|
+
] });
|
|
2184
|
+
});
|
|
2185
|
+
function Tt() {
|
|
2186
|
+
const { camera: o } = Ae(), [e, t] = ae({
|
|
2187
|
+
x: o.position.x,
|
|
2188
|
+
y: o.position.y,
|
|
2189
|
+
z: o.position.z
|
|
2190
|
+
});
|
|
2191
|
+
return fe(() => {
|
|
2192
|
+
let i;
|
|
2193
|
+
const n = () => {
|
|
2194
|
+
t({
|
|
2195
|
+
x: o.position.x,
|
|
2196
|
+
y: o.position.y,
|
|
2197
|
+
z: o.position.z
|
|
2198
|
+
}), i = requestAnimationFrame(n);
|
|
2199
|
+
};
|
|
2200
|
+
return i = requestAnimationFrame(n), () => {
|
|
2201
|
+
i && cancelAnimationFrame(i);
|
|
2202
|
+
};
|
|
2203
|
+
}, [o]), e;
|
|
2204
|
+
}
|
|
2205
|
+
function Ce({ onPositionChange: o }) {
|
|
2206
|
+
const e = Tt();
|
|
2207
|
+
return fe(() => {
|
|
2208
|
+
o(e);
|
|
2209
|
+
}, [e, o]), null;
|
|
2210
|
+
}
|
|
2211
|
+
const Yt = V(function({
|
|
2212
|
+
stackedPallet: e,
|
|
2213
|
+
preset: t,
|
|
2214
|
+
selectedBoxId: i,
|
|
2215
|
+
highlightedBoxId: n,
|
|
2216
|
+
selectedColor: r,
|
|
2217
|
+
highlightedColor: a,
|
|
2218
|
+
showLabels: f = !1,
|
|
2219
|
+
cameraPreset: g = "perspective",
|
|
2220
|
+
showGrid: v = !0,
|
|
2221
|
+
showMiniMap: u = !1,
|
|
2222
|
+
onBoxClick: x,
|
|
2223
|
+
onBoxHover: p,
|
|
2224
|
+
children: c,
|
|
2225
|
+
style: l
|
|
2226
|
+
}) {
|
|
2227
|
+
const d = Y.MM_TO_M, h = e.floors[0]?.pallet, [j, T] = ae({ x: 0, z: 0 }), z = H((w) => {
|
|
2228
|
+
T({ x: w.x, z: w.z });
|
|
2229
|
+
}, []), b = k(() => h ? {
|
|
2230
|
+
width: h.dimensions.width * d,
|
|
2231
|
+
height: le(e) * d,
|
|
2232
|
+
depth: h.dimensions.depth * d
|
|
2233
|
+
} : { width: 1.2, height: 1, depth: 0.8 }, [h, e, d]), M = k(() => {
|
|
2234
|
+
const w = h ? h.dimensions.width * d / 2 : 0, S = h ? h.dimensions.depth * d / 2 : 0, E = b.height / 2;
|
|
2235
|
+
return [w, E, S];
|
|
2236
|
+
}, [h, d, b.height]), _ = k(() => {
|
|
2237
|
+
const S = Math.sqrt(
|
|
2238
|
+
b.width ** 2 + b.height ** 2 + b.depth ** 2
|
|
2239
|
+
) * 3.5;
|
|
2240
|
+
return [
|
|
2241
|
+
M[0] + S * 0.7,
|
|
2242
|
+
M[1] + S * 0.6,
|
|
2243
|
+
M[2] + S * 0.7
|
|
2244
|
+
];
|
|
2245
|
+
}, [M, b]), y = k(() => {
|
|
2246
|
+
if (!v || !h) return null;
|
|
2247
|
+
const w = h.dimensions.width * d, S = h.dimensions.depth * d, E = 0.2, R = 1e-3, O = [];
|
|
2248
|
+
for (let A = 0; A <= w; A += E)
|
|
2249
|
+
O.push(A, R, 0, A, R, S);
|
|
2250
|
+
for (let A = 0; A <= S; A += E)
|
|
2251
|
+
O.push(0, R, A, w, R, A);
|
|
2252
|
+
const P = new $.BufferGeometry();
|
|
2253
|
+
return P.setAttribute("position", new $.Float32BufferAttribute(O, 3)), P;
|
|
2254
|
+
}, [v, h, d]);
|
|
2255
|
+
return /* @__PURE__ */ s.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
2256
|
+
/* @__PURE__ */ s.jsx(
|
|
2257
|
+
pe,
|
|
2258
|
+
{
|
|
2259
|
+
shadows: !0,
|
|
2260
|
+
camera: {
|
|
2261
|
+
position: _,
|
|
2262
|
+
fov: 45,
|
|
2263
|
+
near: 0.01,
|
|
2264
|
+
far: 100
|
|
2265
|
+
},
|
|
2266
|
+
style: { width: "100%", height: "100%", ...l },
|
|
2267
|
+
children: /* @__PURE__ */ s.jsxs(ve, { preset: t, children: [
|
|
2268
|
+
/* @__PURE__ */ s.jsx("ambientLight", { intensity: 0.4 }),
|
|
2269
|
+
/* @__PURE__ */ s.jsx(
|
|
2270
|
+
"directionalLight",
|
|
2271
|
+
{
|
|
2272
|
+
position: [5, 8, 5],
|
|
2273
|
+
intensity: 0.8,
|
|
2274
|
+
castShadow: !0,
|
|
2275
|
+
"shadow-mapSize-width": 1024,
|
|
2276
|
+
"shadow-mapSize-height": 1024
|
|
2277
|
+
}
|
|
2278
|
+
),
|
|
2279
|
+
/* @__PURE__ */ s.jsx("hemisphereLight", { intensity: 0.3, color: "#ffffff", groundColor: "#444444" }),
|
|
2280
|
+
/* @__PURE__ */ s.jsx(
|
|
2281
|
+
je,
|
|
2282
|
+
{
|
|
2283
|
+
preset: g,
|
|
2284
|
+
target: M,
|
|
2285
|
+
sceneSize: b,
|
|
2286
|
+
minDistance: 0.3,
|
|
2287
|
+
maxDistance: Math.max(b.width, b.height, b.depth) * 4
|
|
2288
|
+
}
|
|
2289
|
+
),
|
|
2290
|
+
/* @__PURE__ */ s.jsx(Ce, { onPositionChange: z }),
|
|
2291
|
+
/* @__PURE__ */ s.jsxs("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [M[0], -2e-3, M[2]], receiveShadow: !0, children: [
|
|
2292
|
+
/* @__PURE__ */ s.jsx("planeGeometry", { args: [
|
|
2293
|
+
h ? h.dimensions.width * d * 1.5 : 3,
|
|
2294
|
+
h ? h.dimensions.depth * d * 1.5 : 3
|
|
2295
|
+
] }),
|
|
2296
|
+
/* @__PURE__ */ s.jsx("meshStandardMaterial", { color: "#e0e0e0", roughness: 0.9 })
|
|
2297
|
+
] }),
|
|
2298
|
+
v && y && /* @__PURE__ */ s.jsx("lineSegments", { geometry: y, children: /* @__PURE__ */ s.jsx(
|
|
2299
|
+
"lineBasicMaterial",
|
|
2300
|
+
{
|
|
2301
|
+
color: "#aaaaaa",
|
|
2302
|
+
opacity: 0.5,
|
|
2303
|
+
transparent: !0,
|
|
2304
|
+
depthWrite: !1
|
|
2305
|
+
}
|
|
2306
|
+
) }),
|
|
2307
|
+
/* @__PURE__ */ s.jsx(
|
|
2308
|
+
be,
|
|
2309
|
+
{
|
|
2310
|
+
stackedPallet: e,
|
|
2311
|
+
selectedBoxId: i,
|
|
2312
|
+
highlightedBoxId: n,
|
|
2313
|
+
selectedColor: r,
|
|
2314
|
+
highlightedColor: a,
|
|
2315
|
+
showLabels: f,
|
|
2316
|
+
onBoxClick: x,
|
|
2317
|
+
onBoxHover: p
|
|
2318
|
+
}
|
|
2319
|
+
),
|
|
2320
|
+
c
|
|
2321
|
+
] })
|
|
2322
|
+
}
|
|
2323
|
+
),
|
|
2324
|
+
u && h && /* @__PURE__ */ s.jsx(
|
|
2325
|
+
Se,
|
|
2326
|
+
{
|
|
2327
|
+
sceneWidth: b.width,
|
|
2328
|
+
sceneDepth: b.depth,
|
|
2329
|
+
sceneType: "truck",
|
|
2330
|
+
cameraPosition: j,
|
|
2331
|
+
targetPosition: { x: M[0], z: M[2] },
|
|
2332
|
+
position: "bottom-left"
|
|
2333
|
+
}
|
|
2334
|
+
)
|
|
2335
|
+
] });
|
|
2336
|
+
}), Ut = V(function({
|
|
2337
|
+
truck: e,
|
|
2338
|
+
preset: t,
|
|
2339
|
+
selectedBoxId: i,
|
|
2340
|
+
highlightedBoxId: n,
|
|
2341
|
+
selectedColor: r,
|
|
2342
|
+
highlightedColor: a,
|
|
2343
|
+
showLabels: f = !1,
|
|
2344
|
+
showGrid: g,
|
|
2345
|
+
wallOpacity: v = 0.3,
|
|
2346
|
+
showRoof: u = !1,
|
|
2347
|
+
showSideWalls: x = !0,
|
|
2348
|
+
cameraPreset: p = "perspective",
|
|
2349
|
+
showMiniMap: c = !1,
|
|
2350
|
+
onBoxClick: l,
|
|
2351
|
+
onBoxHover: d,
|
|
2352
|
+
children: h,
|
|
2353
|
+
style: j
|
|
2354
|
+
}) {
|
|
2355
|
+
const [T, z] = ae({ x: 0, z: 0 }), b = H((P) => {
|
|
2356
|
+
z({ x: P.x, z: P.z });
|
|
2357
|
+
}, []), M = Y.MM_TO_M, _ = e.dimensions.width * M, y = e.dimensions.height * M, w = e.dimensions.depth * M, S = k(
|
|
2358
|
+
() => [_ / 2, y / 2, w / 2],
|
|
2359
|
+
[_, y, w]
|
|
2360
|
+
), E = k(
|
|
2361
|
+
() => ({ width: _, height: y, depth: w }),
|
|
2362
|
+
[_, y, w]
|
|
2363
|
+
), R = k(() => [_ * 0.8, y * 1.2, w * 0.4], [_, y, w]), O = k(() => e.pallets.filter((P) => {
|
|
2364
|
+
const A = tt(P, e);
|
|
2365
|
+
return A.isValid ? !0 : (console.error(
|
|
2366
|
+
`[TruckScene] Palet "${P.id}" fuera de los límites del camión.`,
|
|
2367
|
+
"Violaciones:",
|
|
2368
|
+
A.violations
|
|
2369
|
+
), !1);
|
|
2370
|
+
}), [e]);
|
|
2371
|
+
return /* @__PURE__ */ s.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
2372
|
+
/* @__PURE__ */ s.jsx(
|
|
2373
|
+
pe,
|
|
2374
|
+
{
|
|
2375
|
+
shadows: !0,
|
|
2376
|
+
camera: {
|
|
2377
|
+
position: R,
|
|
2378
|
+
fov: 45,
|
|
2379
|
+
near: 0.01,
|
|
2380
|
+
far: 200
|
|
2381
|
+
},
|
|
2382
|
+
style: { width: "100%", height: "100%", ...j },
|
|
2383
|
+
children: /* @__PURE__ */ s.jsxs(ve, { preset: t, children: [
|
|
2384
|
+
/* @__PURE__ */ s.jsx(
|
|
2385
|
+
je,
|
|
2386
|
+
{
|
|
2387
|
+
preset: p,
|
|
2388
|
+
target: S,
|
|
2389
|
+
sceneSize: E,
|
|
2390
|
+
maxDistance: Math.max(_, y, w) * 3,
|
|
2391
|
+
minDistance: 0.5
|
|
2392
|
+
}
|
|
2393
|
+
),
|
|
2394
|
+
/* @__PURE__ */ s.jsx(Ce, { onPositionChange: b }),
|
|
2395
|
+
/* @__PURE__ */ s.jsxs(
|
|
2396
|
+
Pt,
|
|
2397
|
+
{
|
|
2398
|
+
truck: e,
|
|
2399
|
+
showGrid: g,
|
|
2400
|
+
wallOpacity: v,
|
|
2401
|
+
showRoof: u,
|
|
2402
|
+
showSideWalls: x,
|
|
2403
|
+
children: [
|
|
2404
|
+
O.map((P) => /* @__PURE__ */ s.jsx(
|
|
2405
|
+
be,
|
|
2406
|
+
{
|
|
2407
|
+
stackedPallet: P.stackedPallet,
|
|
2408
|
+
position: P.position,
|
|
2409
|
+
yRotation: P.yRotation,
|
|
2410
|
+
palletId: P.id,
|
|
2411
|
+
selectedBoxId: i,
|
|
2412
|
+
highlightedBoxId: n,
|
|
2413
|
+
selectedColor: r,
|
|
2414
|
+
highlightedColor: a,
|
|
2415
|
+
showLabels: f,
|
|
2416
|
+
onBoxClick: l,
|
|
2417
|
+
onBoxHover: d
|
|
2418
|
+
},
|
|
2419
|
+
P.id
|
|
2420
|
+
)),
|
|
2421
|
+
h
|
|
2422
|
+
]
|
|
2423
|
+
}
|
|
2424
|
+
)
|
|
2425
|
+
] })
|
|
2426
|
+
}
|
|
2427
|
+
),
|
|
2428
|
+
c && /* @__PURE__ */ s.jsx(
|
|
2429
|
+
Se,
|
|
2430
|
+
{
|
|
2431
|
+
sceneWidth: _,
|
|
2432
|
+
sceneDepth: w,
|
|
2433
|
+
sceneType: "truck",
|
|
2434
|
+
cameraPosition: T,
|
|
2435
|
+
targetPosition: { x: S[0], z: S[2] },
|
|
2436
|
+
position: "bottom-left"
|
|
2437
|
+
}
|
|
2438
|
+
)
|
|
2439
|
+
] });
|
|
2440
|
+
}), Ft = V(function({
|
|
2441
|
+
room: e,
|
|
2442
|
+
preset: t,
|
|
2443
|
+
selectedBoxId: i,
|
|
2444
|
+
highlightedBoxId: n,
|
|
2445
|
+
selectedColor: r,
|
|
2446
|
+
highlightedColor: a,
|
|
2447
|
+
showLabels: f = !1,
|
|
2448
|
+
cameraPreset: g = "perspective",
|
|
2449
|
+
showMiniMap: v = !1,
|
|
2450
|
+
onBoxClick: u,
|
|
2451
|
+
onBoxHover: x,
|
|
2452
|
+
children: p,
|
|
2453
|
+
style: c
|
|
2454
|
+
}) {
|
|
2455
|
+
const l = Y.MM_TO_M, [d, h] = ae({ x: 0, z: 0 }), j = H((y) => {
|
|
2456
|
+
h({ x: y.x, z: y.z });
|
|
2457
|
+
}, []), { target: T, sceneSize: z, initialCameraPosition: b } = k(() => {
|
|
2458
|
+
const y = e.floorPolygon;
|
|
2459
|
+
let w = 1 / 0, S = -1 / 0, E = 1 / 0, R = -1 / 0;
|
|
2460
|
+
for (const C of y)
|
|
2461
|
+
w = Math.min(w, C.x * l), S = Math.max(S, C.x * l), E = Math.min(E, C.z * l), R = Math.max(R, C.z * l);
|
|
2462
|
+
const O = S - w, P = R - E, A = e.ceilingHeight * l, G = (w + S) / 2, N = (E + R) / 2, U = [G, A / 2, N], F = { width: O, height: A, depth: P }, J = Math.sqrt(O ** 2 + A ** 2 + P ** 2) * 0.8, m = [
|
|
2463
|
+
G + J * 0.6,
|
|
2464
|
+
A + J * 0.5,
|
|
2465
|
+
N + J * 0.6
|
|
2466
|
+
];
|
|
2467
|
+
return {
|
|
2468
|
+
target: U,
|
|
2469
|
+
sceneSize: F,
|
|
2470
|
+
initialCameraPosition: m
|
|
2471
|
+
};
|
|
2472
|
+
}, [e.floorPolygon, e.ceilingHeight, l]), M = k(() => e.floorPolygon.map((y) => ({ x: y.x * l, z: y.z * l })), [e.floorPolygon, l]), _ = k(() => e.pallets.filter((y) => {
|
|
2473
|
+
const w = We(y, e);
|
|
2474
|
+
return w.isValid ? !0 : (console.error(
|
|
2475
|
+
`[WarehouseScene] Palet "${y.id}" fuera de los límites de la estancia "${e.name}".`,
|
|
2476
|
+
"Violaciones:",
|
|
2477
|
+
w.violations
|
|
2478
|
+
), !1);
|
|
2479
|
+
}), [e]);
|
|
2480
|
+
return /* @__PURE__ */ s.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
2481
|
+
/* @__PURE__ */ s.jsx(
|
|
2482
|
+
pe,
|
|
2483
|
+
{
|
|
2484
|
+
shadows: !0,
|
|
2485
|
+
camera: {
|
|
2486
|
+
position: b,
|
|
2487
|
+
fov: 45,
|
|
2488
|
+
near: 0.01,
|
|
2489
|
+
far: 300
|
|
2490
|
+
},
|
|
2491
|
+
style: { width: "100%", height: "100%", ...c },
|
|
2492
|
+
children: /* @__PURE__ */ s.jsxs(ve, { preset: t, children: [
|
|
2493
|
+
/* @__PURE__ */ s.jsx(
|
|
2494
|
+
je,
|
|
2495
|
+
{
|
|
2496
|
+
preset: g,
|
|
2497
|
+
target: T,
|
|
2498
|
+
sceneSize: z,
|
|
2499
|
+
maxDistance: Math.max(z.width, z.height, z.depth) * 4,
|
|
2500
|
+
minDistance: 0.5
|
|
2501
|
+
}
|
|
2502
|
+
),
|
|
2503
|
+
/* @__PURE__ */ s.jsx(Ce, { onPositionChange: j }),
|
|
2504
|
+
/* @__PURE__ */ s.jsxs(Mt, { room: e, children: [
|
|
2505
|
+
_.map((y) => /* @__PURE__ */ s.jsx(
|
|
2506
|
+
be,
|
|
2507
|
+
{
|
|
2508
|
+
stackedPallet: y.stackedPallet,
|
|
2509
|
+
position: y.position,
|
|
2510
|
+
yRotation: y.yRotation,
|
|
2511
|
+
palletId: y.id,
|
|
2512
|
+
selectedBoxId: i,
|
|
2513
|
+
highlightedBoxId: n,
|
|
2514
|
+
selectedColor: r,
|
|
2515
|
+
highlightedColor: a,
|
|
2516
|
+
showLabels: f,
|
|
2517
|
+
onBoxClick: u,
|
|
2518
|
+
onBoxHover: x
|
|
2519
|
+
},
|
|
2520
|
+
y.id
|
|
2521
|
+
)),
|
|
2522
|
+
p
|
|
2523
|
+
] })
|
|
2524
|
+
] })
|
|
2525
|
+
}
|
|
2526
|
+
),
|
|
2527
|
+
v && /* @__PURE__ */ s.jsx(
|
|
2528
|
+
Se,
|
|
2529
|
+
{
|
|
2530
|
+
sceneWidth: z.width,
|
|
2531
|
+
sceneDepth: z.depth,
|
|
2532
|
+
sceneType: "warehouse",
|
|
2533
|
+
floorPolygon: M,
|
|
2534
|
+
cameraPosition: d,
|
|
2535
|
+
targetPosition: { x: T[0], z: T[2] },
|
|
2536
|
+
position: "bottom-left"
|
|
2537
|
+
}
|
|
2538
|
+
)
|
|
2539
|
+
] });
|
|
2540
|
+
});
|
|
2541
|
+
export {
|
|
2542
|
+
ut as BinPacking3DStrategy,
|
|
2543
|
+
bt as BoxComponent,
|
|
2544
|
+
ge as BoxFactory,
|
|
2545
|
+
Ne as COLLISION_TOLERANCE,
|
|
2546
|
+
je as CameraControlsComponent,
|
|
2547
|
+
mt as ColumnStrategy,
|
|
2548
|
+
xe as DEFAULT_PRESET,
|
|
2549
|
+
Lt as Label,
|
|
2550
|
+
Me as MIN_SUPPORT_PERCENTAGE,
|
|
2551
|
+
Ie as PRESET_INDUSTRIAL,
|
|
2552
|
+
Le as PRESET_UNSTYLED,
|
|
2553
|
+
gt as PackingRegistry,
|
|
2554
|
+
jt as PalletComponent,
|
|
2555
|
+
Z as PalletFactory,
|
|
2556
|
+
L as PalletMaterial,
|
|
2557
|
+
Yt as PalletScene,
|
|
2558
|
+
ve as PresetProvider,
|
|
2559
|
+
Ye as SCENE_PRESETS,
|
|
2560
|
+
At as SEPARATOR_DEFAULTS,
|
|
2561
|
+
ue as STANDARD_PALLETS,
|
|
2562
|
+
Ct as SeparatorComponent,
|
|
2563
|
+
me as SeparatorMaterial,
|
|
2564
|
+
be as StackedPalletComponent,
|
|
2565
|
+
Ze as TRUCK_PRESETS,
|
|
2566
|
+
Pt as TruckEnvironment,
|
|
2567
|
+
Gt as TruckFactory,
|
|
2568
|
+
Ut as TruckScene,
|
|
2569
|
+
ie as TruckType,
|
|
2570
|
+
xt as TypeGroupStrategy,
|
|
2571
|
+
Y as UNITS,
|
|
2572
|
+
Oe as WEIGHT_WARNING_THRESHOLD,
|
|
2573
|
+
Mt as WarehouseEnvironment,
|
|
2574
|
+
Ft as WarehouseScene,
|
|
2575
|
+
ye as aabbIntersects,
|
|
2576
|
+
q as calculateCenterOfGravity,
|
|
2577
|
+
se as calculateStabilityScore,
|
|
2578
|
+
ft as defaultRegistry,
|
|
2579
|
+
qe as ensureUniqueBoxIds,
|
|
2580
|
+
D as getBoxBoundingBox,
|
|
2581
|
+
oe as getPalletBoundingBox,
|
|
2582
|
+
le as getStackedPalletTotalHeight,
|
|
2583
|
+
we as getStackedPalletTotalWeight,
|
|
2584
|
+
ht as pointInPolygon,
|
|
2585
|
+
Zt as usePackingStrategy,
|
|
2586
|
+
Xt as usePalletMetrics,
|
|
2587
|
+
Vt as usePhysicsValidation,
|
|
2588
|
+
ce as usePreset,
|
|
2589
|
+
Nt as useWarehouseValidation,
|
|
2590
|
+
et as validateAllBoxesInPalletBounds,
|
|
2591
|
+
Ke as validateBoxInPalletBounds,
|
|
2592
|
+
rt as validateBoxStackability,
|
|
2593
|
+
lt as validateCogInsideSupport,
|
|
2594
|
+
ot as validateFragileLoad,
|
|
2595
|
+
at as validateInvertedPyramid,
|
|
2596
|
+
Je as validateNoBoxCollisions,
|
|
2597
|
+
Qe as validateNoPalletCollisions,
|
|
2598
|
+
Ot as validatePalletHeight,
|
|
2599
|
+
We as validatePalletInRoom,
|
|
2600
|
+
tt as validatePalletInTruck,
|
|
2601
|
+
it as validatePalletWeight,
|
|
2602
|
+
Wt as validateSeparators,
|
|
2603
|
+
dt as validateStability,
|
|
2604
|
+
$t as validateStackDimensions,
|
|
2605
|
+
Bt as validateStackHeight,
|
|
2606
|
+
Dt as validateStackWeight,
|
|
2607
|
+
ct as validateSupport,
|
|
2608
|
+
It as validateTruckWeight,
|
|
2609
|
+
nt as validateWeightDistribution
|
|
2610
|
+
};
|
|
2611
|
+
//# sourceMappingURL=pallet-builder.js.map
|