@cristiancosano/pallet-builder 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
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";
1
+ import Le, { createContext as Ge, useContext as Ve, useMemo as k, useCallback as q, memo as V, useRef as Ee, useEffect as pe, useState as ae } from "react";
2
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 = {
3
+ import * as B from "three";
4
+ import { useThree as Ae, Canvas as fe } from "@react-three/fiber";
5
+ const N = {
6
6
  WOOD: "WOOD",
7
7
  PLASTIC: "PLASTIC",
8
8
  METAL: "METAL",
@@ -11,7 +11,7 @@ const L = {
11
11
  CARDBOARD: "CARDBOARD",
12
12
  WOOD: "WOOD",
13
13
  PLASTIC: "PLASTIC"
14
- }, ie = {
14
+ }, oe = {
15
15
  BOX: "BOX",
16
16
  REFRIGERATED: "REFRIGERATED",
17
17
  FLATBED: "FLATBED",
@@ -21,7 +21,7 @@ const L = {
21
21
  /** Palet EUR/EPAL — Estándar europeo (1200×800×144mm, ISO 6780) */
22
22
  EUR: {
23
23
  dimensions: { width: 1200, height: 144, depth: 800 },
24
- material: L.WOOD,
24
+ material: N.WOOD,
25
25
  maxWeight: 1e3,
26
26
  maxStackHeight: 2200,
27
27
  weight: 25
@@ -29,7 +29,7 @@ const L = {
29
29
  /** Palet GMA/Americano — Estándar norteamericano (1219×1016×145mm, 48"×40") */
30
30
  GMA: {
31
31
  dimensions: { width: 1219, height: 145, depth: 1016 },
32
- material: L.WOOD,
32
+ material: N.WOOD,
33
33
  maxWeight: 1200,
34
34
  maxStackHeight: 2200,
35
35
  weight: 30
@@ -37,7 +37,7 @@ const L = {
37
37
  /** Palet UK Standard — Reino Unido (1200×1000×150mm) */
38
38
  UK: {
39
39
  dimensions: { width: 1200, height: 150, depth: 1e3 },
40
- material: L.WOOD,
40
+ material: N.WOOD,
41
41
  maxWeight: 1e3,
42
42
  maxStackHeight: 2200,
43
43
  weight: 28
@@ -45,7 +45,7 @@ const L = {
45
45
  /** Palet asiático estándar — Asia Pallet (1100×1100×150mm, ISO 6780) */
46
46
  ASIA: {
47
47
  dimensions: { width: 1100, height: 150, depth: 1100 },
48
- material: L.WOOD,
48
+ material: N.WOOD,
49
49
  maxWeight: 1e3,
50
50
  maxStackHeight: 2200,
51
51
  weight: 28
@@ -53,7 +53,7 @@ const L = {
53
53
  /** Palet australiano estándar — Australia (1165×1165×150mm) */
54
54
  AUSTRALIAN: {
55
55
  dimensions: { width: 1165, height: 150, depth: 1165 },
56
- material: L.WOOD,
56
+ material: N.WOOD,
57
57
  maxWeight: 1e3,
58
58
  maxStackHeight: 2200,
59
59
  weight: 29
@@ -61,7 +61,7 @@ const L = {
61
61
  /** Medio palet EUR — Half European Pallet (800×600×144mm) */
62
62
  HALF_EUR: {
63
63
  dimensions: { width: 800, height: 144, depth: 600 },
64
- material: L.WOOD,
64
+ material: N.WOOD,
65
65
  maxWeight: 500,
66
66
  maxStackHeight: 2200,
67
67
  weight: 12
@@ -69,7 +69,7 @@ const L = {
69
69
  /** Cuarto de palet EUR — Quarter European Pallet (600×400×144mm) */
70
70
  QUARTER_EUR: {
71
71
  dimensions: { width: 600, height: 144, depth: 400 },
72
- material: L.WOOD,
72
+ material: N.WOOD,
73
73
  maxWeight: 250,
74
74
  maxStackHeight: 2200,
75
75
  weight: 6
@@ -77,7 +77,7 @@ const L = {
77
77
  /** Palet ISO 1 — ISO 6780 (1200×1000×150mm) */
78
78
  ISO_1: {
79
79
  dimensions: { width: 1200, height: 150, depth: 1e3 },
80
- material: L.WOOD,
80
+ material: N.WOOD,
81
81
  maxWeight: 1e3,
82
82
  maxStackHeight: 2200,
83
83
  weight: 28
@@ -85,7 +85,7 @@ const L = {
85
85
  /** Palet ISO 2 — ISO 6780 (1200×800×144mm, equivalente a EUR) */
86
86
  ISO_2: {
87
87
  dimensions: { width: 1200, height: 144, depth: 800 },
88
- material: L.WOOD,
88
+ material: N.WOOD,
89
89
  maxWeight: 1e3,
90
90
  maxStackHeight: 2200,
91
91
  weight: 25
@@ -93,31 +93,31 @@ const L = {
93
93
  };
94
94
  ue.GMA;
95
95
  const Ze = {
96
- [ie.BOX]: {
96
+ [oe.BOX]: {
97
97
  dimensions: { width: 2480, height: 2700, depth: 13600 },
98
98
  maxWeight: 24e3
99
99
  },
100
- [ie.REFRIGERATED]: {
100
+ [oe.REFRIGERATED]: {
101
101
  dimensions: { width: 2440, height: 2590, depth: 13100 },
102
102
  maxWeight: 22e3
103
103
  },
104
- [ie.FLATBED]: {
104
+ [oe.FLATBED]: {
105
105
  dimensions: { width: 2480, height: 2700, depth: 13600 },
106
106
  maxWeight: 25e3
107
107
  },
108
- [ie.TAUTLINER]: {
108
+ [oe.TAUTLINER]: {
109
109
  dimensions: { width: 2480, height: 2700, depth: 13600 },
110
110
  maxWeight: 24e3
111
111
  }
112
- }, At = {
112
+ }, It = {
113
113
  thickness: 10,
114
114
  // mm
115
115
  weight: 2
116
116
  // kg
117
- }, Y = {
117
+ }, U = {
118
118
  MM_TO_M: 1e-3,
119
119
  M_TO_MM: 1e3
120
- }, Ne = 1, Me = 0.6, Oe = 0.9, Le = {
120
+ }, De = 1, ze = 0.6, Ie = 0.9, Ne = {
121
121
  id: "unstyled",
122
122
  name: "Sin estilo",
123
123
  box: {
@@ -162,7 +162,7 @@ const Ze = {
162
162
  chassisColor: "#2a2a2a",
163
163
  wheelColor: "#1a1a1a"
164
164
  }
165
- }, Ie = {
165
+ }, Oe = {
166
166
  id: "industrial",
167
167
  name: "Industrial",
168
168
  box: {
@@ -207,195 +207,195 @@ const Ze = {
207
207
  chassisColor: "#1e1e1e",
208
208
  wheelColor: "#111111"
209
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;
210
+ }, Ue = {
211
+ unstyled: Ne,
212
+ industrial: Oe
213
+ }, xe = Oe;
214
+ var re = { exports: {} }, te = {};
215
+ var Ce;
216
+ function He() {
217
+ if (Ce) return te;
218
+ Ce = 1;
219
219
  var o = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
220
- function t(i, n, r) {
220
+ function t(i, s, n) {
221
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, {
222
+ if (n !== void 0 && (a = "" + n), s.key !== void 0 && (a = "" + s.key), "key" in s) {
223
+ n = {};
224
+ for (var c in s)
225
+ c !== "key" && (n[c] = s[c]);
226
+ } else n = s;
227
+ return s = n.ref, {
228
228
  $$typeof: o,
229
229
  type: i,
230
230
  key: a,
231
- ref: n !== void 0 ? n : null,
232
- props: r
231
+ ref: s !== void 0 ? s : null,
232
+ props: n
233
233
  };
234
234
  }
235
- return ee.Fragment = e, ee.jsx = t, ee.jsxs = t, ee;
235
+ return te.Fragment = e, te.jsx = t, te.jsxs = t, te;
236
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:
237
+ var ie = {};
238
+ var Pe;
239
+ function Ye() {
240
+ return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && (function() {
241
+ function o(f) {
242
+ if (f == null) return null;
243
+ if (typeof f == "function")
244
+ return f.$$typeof === T ? null : f.displayName || f.name || null;
245
+ if (typeof f == "string") return f;
246
+ switch (f) {
247
+ case d:
248
248
  return "Fragment";
249
- case T:
250
- return "Profiler";
251
249
  case j:
250
+ return "Profiler";
251
+ case b:
252
252
  return "StrictMode";
253
- case _:
253
+ case z:
254
254
  return "Suspense";
255
255
  case y:
256
256
  return "SuspenseList";
257
257
  case E:
258
258
  return "Activity";
259
259
  }
260
- if (typeof m == "object")
261
- switch (typeof m.tag == "number" && console.error(
260
+ if (typeof f == "object")
261
+ switch (typeof f.tag == "number" && console.error(
262
262
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
263
- ), m.$$typeof) {
264
- case d:
263
+ ), f.$$typeof) {
264
+ case u:
265
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
266
  case S:
276
- C = m._payload, m = m._init;
267
+ return f.displayName || "Context";
268
+ case _:
269
+ return (f._context.displayName || "Context") + ".Consumer";
270
+ case C:
271
+ var P = f.render;
272
+ return f = f.displayName, f || (f = P.displayName || P.name || "", f = f !== "" ? "ForwardRef(" + f + ")" : "ForwardRef"), f;
273
+ case v:
274
+ return P = f.displayName || null, P !== null ? P : o(f.type) || "Memo";
275
+ case M:
276
+ P = f._payload, f = f._init;
277
277
  try {
278
- return o(m(C));
278
+ return o(f(P));
279
279
  } catch {
280
280
  }
281
281
  }
282
282
  return null;
283
283
  }
284
- function e(m) {
285
- return "" + m;
284
+ function e(f) {
285
+ return "" + f;
286
286
  }
287
- function t(m) {
287
+ function t(f) {
288
288
  try {
289
- e(m);
290
- var C = !1;
289
+ e(f);
290
+ var P = !1;
291
291
  } catch {
292
- C = !0;
292
+ P = !0;
293
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,
294
+ if (P) {
295
+ P = console;
296
+ var O = P.error, W = typeof Symbol == "function" && Symbol.toStringTag && f[Symbol.toStringTag] || f.constructor.name || "Object";
297
+ return O.call(
298
+ P,
299
299
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
300
300
  W
301
- ), e(m);
301
+ ), e(f);
302
302
  }
303
303
  }
304
- function i(m) {
305
- if (m === h) return "<>";
306
- if (typeof m == "object" && m !== null && m.$$typeof === S)
304
+ function i(f) {
305
+ if (f === d) return "<>";
306
+ if (typeof f == "object" && f !== null && f.$$typeof === M)
307
307
  return "<...>";
308
308
  try {
309
- var C = o(m);
310
- return C ? "<" + C + ">" : "<...>";
309
+ var P = o(f);
310
+ return P ? "<" + P + ">" : "<...>";
311
311
  } catch {
312
312
  return "<...>";
313
313
  }
314
314
  }
315
- function n() {
316
- var m = O.A;
317
- return m === null ? null : m.getOwner();
315
+ function s() {
316
+ var f = I.A;
317
+ return f === null ? null : f.getOwner();
318
318
  }
319
- function r() {
319
+ function n() {
320
320
  return Error("react-stack-top-frame");
321
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;
322
+ function a(f) {
323
+ if (R.call(f, "key")) {
324
+ var P = Object.getOwnPropertyDescriptor(f, "key").get;
325
+ if (P && P.isReactWarning) return !1;
326
326
  }
327
- return m.key !== void 0;
327
+ return f.key !== void 0;
328
328
  }
329
- function f(m, C) {
330
- function I() {
331
- N || (N = !0, console.error(
329
+ function c(f, P) {
330
+ function O() {
331
+ D || (D = !0, console.error(
332
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
333
+ P
334
334
  ));
335
335
  }
336
- I.isReactWarning = !0, Object.defineProperty(m, "key", {
337
- get: I,
336
+ O.isReactWarning = !0, Object.defineProperty(f, "key", {
337
+ get: O,
338
338
  configurable: !0
339
339
  });
340
340
  }
341
- function g() {
342
- var m = o(this.type);
343
- return U[m] || (U[m] = !0, console.error(
341
+ function l() {
342
+ var f = o(this.type);
343
+ return H[f] || (H[f] = !0, console.error(
344
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;
345
+ )), f = this.props.ref, f !== void 0 ? f : null;
346
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,
347
+ function p(f, P, O, W, ne, de) {
348
+ var $ = O.ref;
349
+ return f = {
350
+ $$typeof: x,
351
+ type: f,
352
+ key: P,
353
+ props: O,
354
354
  _owner: W
355
- }, (B !== void 0 ? B : null) !== null ? Object.defineProperty(m, "ref", {
355
+ }, ($ !== void 0 ? $ : null) !== null ? Object.defineProperty(f, "ref", {
356
356
  enumerable: !1,
357
- get: g
358
- }) : Object.defineProperty(m, "ref", { enumerable: !1, value: null }), m._store = {}, Object.defineProperty(m._store, "validated", {
357
+ get: l
358
+ }) : Object.defineProperty(f, "ref", { enumerable: !1, value: null }), f._store = {}, Object.defineProperty(f._store, "validated", {
359
359
  configurable: !1,
360
360
  enumerable: !1,
361
361
  writable: !0,
362
362
  value: 0
363
- }), Object.defineProperty(m, "_debugInfo", {
363
+ }), Object.defineProperty(f, "_debugInfo", {
364
364
  configurable: !1,
365
365
  enumerable: !1,
366
366
  writable: !0,
367
367
  value: null
368
- }), Object.defineProperty(m, "_debugStack", {
368
+ }), Object.defineProperty(f, "_debugStack", {
369
369
  configurable: !1,
370
370
  enumerable: !1,
371
371
  writable: !0,
372
372
  value: ne
373
- }), Object.defineProperty(m, "_debugTask", {
373
+ }), Object.defineProperty(f, "_debugTask", {
374
374
  configurable: !1,
375
375
  enumerable: !1,
376
376
  writable: !0,
377
377
  value: de
378
- }), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
378
+ }), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
379
379
  }
380
- function u(m, C, I, W, ne, de) {
381
- var B = C.children;
382
- if (B !== void 0)
380
+ function h(f, P, O, W, ne, de) {
381
+ var $ = P.children;
382
+ if ($ !== void 0)
383
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);
384
+ if (A($)) {
385
+ for (W = 0; W < $.length; W++)
386
+ g($[W]);
387
+ Object.freeze && Object.freeze($);
388
388
  } else
389
389
  console.error(
390
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
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";
392
+ else g($);
393
+ if (R.call(P, "key")) {
394
+ $ = o(f);
395
+ var Q = Object.keys(P).filter(function($e) {
396
+ return $e !== "key";
397
397
  });
398
- W = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", J[B + W] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
398
+ W = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", J[$ + W] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
399
399
  `A props object containing a "key" prop is being spread into JSX:
400
400
  let props = %s;
401
401
  <%s {...props} />
@@ -403,116 +403,116 @@ React keys must be passed directly to JSX without using spread:
403
403
  let props = %s;
404
404
  <%s key={someKey} {...props} />`,
405
405
  W,
406
- B,
406
+ $,
407
407
  Q,
408
- B
409
- ), J[B + W] = !0);
408
+ $
409
+ ), J[$ + W] = !0);
410
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(),
411
+ if ($ = null, O !== void 0 && (t(O), $ = "" + O), a(P) && (t(P.key), $ = "" + P.key), "key" in P) {
412
+ O = {};
413
+ for (var he in P)
414
+ he !== "key" && (O[he] = P[he]);
415
+ } else O = P;
416
+ return $ && c(
417
+ O,
418
+ typeof f == "function" ? f.displayName || f.name || "Unknown" : f
419
+ ), p(
420
+ f,
421
+ $,
422
+ O,
423
+ s(),
424
424
  ne,
425
425
  de
426
426
  );
427
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));
428
+ function g(f) {
429
+ w(f) ? f._store && (f._store.validated = 1) : typeof f == "object" && f !== null && f.$$typeof === M && (f._payload.status === "fulfilled" ? w(f._payload.value) && f._payload.value._store && (f._payload.value._store.validated = 1) : f._store && (f._store.validated = 1));
430
430
  }
431
- function p(m) {
432
- return typeof m == "object" && m !== null && m.$$typeof === l;
431
+ function w(f) {
432
+ return typeof f == "object" && f !== null && f.$$typeof === x;
433
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() {
434
+ var m = Le, x = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), b = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), _ = /* @__PURE__ */ Symbol.for("react.consumer"), S = /* @__PURE__ */ Symbol.for("react.context"), C = /* @__PURE__ */ Symbol.for("react.forward_ref"), z = /* @__PURE__ */ Symbol.for("react.suspense"), y = /* @__PURE__ */ Symbol.for("react.suspense_list"), v = /* @__PURE__ */ Symbol.for("react.memo"), M = /* @__PURE__ */ Symbol.for("react.lazy"), E = /* @__PURE__ */ Symbol.for("react.activity"), T = /* @__PURE__ */ Symbol.for("react.client.reference"), I = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, R = Object.prototype.hasOwnProperty, A = Array.isArray, G = console.createTask ? console.createTask : function() {
435
435
  return null;
436
436
  };
437
- c = {
438
- react_stack_bottom_frame: function(m) {
439
- return m();
437
+ m = {
438
+ react_stack_bottom_frame: function(f) {
439
+ return f();
440
440
  }
441
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,
442
+ var D, H = {}, F = m.react_stack_bottom_frame.bind(
443
+ m,
444
+ n
445
+ )(), X = G(i(n)), J = {};
446
+ ie.Fragment = d, ie.jsx = function(f, P, O) {
447
+ var W = 1e4 > I.recentlyCreatedOwnerStacks++;
448
+ return h(
449
+ f,
450
+ P,
451
+ O,
452
452
  !1,
453
453
  W ? Error("react-stack-top-frame") : F,
454
- W ? G(i(m)) : X
454
+ W ? G(i(f)) : X
455
455
  );
456
- }, te.jsxs = function(m, C, I) {
457
- var W = 1e4 > O.recentlyCreatedOwnerStacks++;
458
- return u(
459
- m,
460
- C,
461
- I,
456
+ }, ie.jsxs = function(f, P, O) {
457
+ var W = 1e4 > I.recentlyCreatedOwnerStacks++;
458
+ return h(
459
+ f,
460
+ P,
461
+ O,
462
462
  !0,
463
463
  W ? Error("react-stack-top-frame") : F,
464
- W ? G(i(m)) : X
464
+ W ? G(i(f)) : X
465
465
  );
466
466
  };
467
- })()), te;
467
+ })()), ie;
468
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;
469
+ var Re;
470
+ function Fe() {
471
+ return Re || (Re = 1, process.env.NODE_ENV === "production" ? re.exports = He() : re.exports = Ye()), re.exports;
472
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 });
473
+ var r = Fe();
474
+ const Be = Ge(xe);
475
+ function we({ preset: o, children: e }) {
476
+ const t = k(() => o ? typeof o == "string" ? Ue[o] ?? xe : o : xe, [o]);
477
+ return /* @__PURE__ */ r.jsx(Be.Provider, { value: t, children: e });
478
478
  }
479
479
  function ce() {
480
- return Ve($e);
480
+ return Ve(Be);
481
481
  }
482
482
  function le(o) {
483
483
  let e = 0;
484
484
  for (const t of o.floors) {
485
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);
486
+ const i = t.boxes.reduce((s, n) => {
487
+ const a = n.position.y + n.box.dimensions.height;
488
+ return Math.max(s, a);
489
489
  }, 0);
490
490
  e += i, t.separatorAbove && (e += t.separatorAbove.dimensions.height);
491
491
  }
492
492
  return e;
493
493
  }
494
- function we(o) {
494
+ function ye(o) {
495
495
  let e = 0;
496
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);
497
+ e += t.pallet.weight, e += t.boxes.reduce((i, s) => i + s.box.weight, 0), t.separatorAbove && (e += t.separatorAbove.weight);
498
498
  return e;
499
499
  }
500
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;
501
+ const t = e || o.id, i = o.floors.map((s, n) => {
502
+ const a = s.boxes.map((c, l) => {
503
+ const p = `${t}:f${n}:b${l}`, h = (g) => g.map((w) => {
504
+ const m = s.boxes.findIndex((x) => x.id === w);
505
+ return m >= 0 ? `${t}:f${n}:b${m}` : w;
506
506
  });
507
507
  return {
508
- ...f,
509
- id: v,
510
- supportedBy: u(f.supportedBy),
511
- supporting: u(f.supporting)
508
+ ...c,
509
+ id: p,
510
+ supportedBy: h(c.supportedBy),
511
+ supporting: h(c.supporting)
512
512
  };
513
513
  });
514
514
  return {
515
- ...n,
515
+ ...s,
516
516
  boxes: a
517
517
  };
518
518
  });
@@ -521,7 +521,7 @@ function qe(o, e) {
521
521
  floors: i
522
522
  };
523
523
  }
524
- function D(o) {
524
+ function L(o) {
525
525
  let e = o.box.dimensions.width, t = o.box.dimensions.depth;
526
526
  const i = o.box.dimensions.height;
527
527
  return (o.rotation.y === 90 || o.rotation.y === 270) && ([e, t] = [t, e]), {
@@ -533,34 +533,34 @@ function D(o) {
533
533
  maxZ: o.position.z + t
534
534
  };
535
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 = [
536
+ function se(o) {
537
+ const e = o.stackedPallet, t = e.floors[0].pallet, i = t.dimensions.width, s = t.dimensions.depth, n = le(e), a = o.yRotation * Math.PI / 180, c = Math.cos(a), l = Math.sin(a), h = [
538
538
  { x: 0, z: 0 },
539
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));
540
+ { x: i, z: s },
541
+ { x: 0, z: s }
542
+ ].map((u) => ({
543
+ x: o.position.x + u.x * c + u.z * l,
544
+ z: o.position.z - u.x * l + u.z * c
545
+ })), g = Math.min(...h.map((u) => u.x)), w = Math.max(...h.map((u) => u.x)), m = Math.min(...h.map((u) => u.z)), x = Math.max(...h.map((u) => u.z));
546
546
  return {
547
- minX: x,
548
- maxX: p,
547
+ minX: g,
548
+ maxX: w,
549
549
  minY: o.position.y,
550
- maxY: o.position.y + r,
551
- minZ: c,
552
- maxZ: l
550
+ maxY: o.position.y + n,
551
+ minZ: m,
552
+ maxZ: x
553
553
  };
554
554
  }
555
- function ye(o, e, t = Ne) {
555
+ function ve(o, e, t = De) {
556
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
557
  }
558
558
  function Je(o) {
559
559
  const e = [];
560
560
  for (let t = 0; t < o.length; t++)
561
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({
562
+ const s = L(o[t]), n = L(o[i]);
563
+ ve(s, n) && e.push({
564
564
  code: "BR-002",
565
565
  severity: "error",
566
566
  message: `Colisión entre cajas ${o[t].id} y ${o[i].id}`,
@@ -573,8 +573,8 @@ function Qe(o) {
573
573
  const e = [];
574
574
  for (let t = 0; t < o.length; t++)
575
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({
576
+ const s = se(o[t]), n = se(o[i]);
577
+ ve(s, n) && e.push({
578
578
  code: "BR-003",
579
579
  severity: "error",
580
580
  message: `Colisión entre palets ${o[t].id} y ${o[i].id}`,
@@ -584,7 +584,7 @@ function Qe(o) {
584
584
  return { isValid: e.length === 0, violations: e };
585
585
  }
586
586
  function Ke(o, e) {
587
- const t = [], i = D(o);
587
+ const t = [], i = L(o);
588
588
  return (i.minX < 0 || i.maxX > e.dimensions.width) && t.push({
589
589
  code: "BR-001",
590
590
  severity: "error",
@@ -605,24 +605,24 @@ function Ke(o, e) {
605
605
  function et(o, e) {
606
606
  const t = [];
607
607
  for (const i of o) {
608
- const n = Ke(i, e);
609
- t.push(...n.violations);
608
+ const s = Ke(i, e);
609
+ t.push(...s.violations);
610
610
  }
611
611
  return { isValid: t.length === 0, violations: t };
612
612
  }
613
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({
614
+ const t = [], i = se(o), s = e.dimensions;
615
+ return (i.minX < 0 || i.maxX > s.width) && t.push({
616
616
  code: "BR-402",
617
617
  severity: "error",
618
618
  message: `Palet ${o.id} sobresale por el ancho del camión`,
619
619
  involvedIds: [o.id, e.id]
620
- }), (i.minZ < 0 || i.maxZ > n.depth) && t.push({
620
+ }), (i.minZ < 0 || i.maxZ > s.depth) && t.push({
621
621
  code: "BR-402",
622
622
  severity: "error",
623
623
  message: `Palet ${o.id} sobresale por la profundidad del camión`,
624
624
  involvedIds: [o.id, e.id]
625
- }), i.maxY > n.height && t.push({
625
+ }), i.maxY > s.height && t.push({
626
626
  code: "BR-404",
627
627
  severity: "error",
628
628
  message: `Palet ${o.id} excede la altura del camión`,
@@ -630,7 +630,7 @@ function tt(o, e) {
630
630
  }), { isValid: t.length === 0, violations: t };
631
631
  }
632
632
  function Ot(o, e) {
633
- const t = [], i = oe(o);
633
+ const t = [], i = se(o);
634
634
  return i.maxY > e && t.push({
635
635
  code: "BR-403",
636
636
  severity: "error",
@@ -639,22 +639,22 @@ function Ot(o, e) {
639
639
  }), { isValid: t.length === 0, violations: t };
640
640
  }
641
641
  function it(o) {
642
- const e = [], t = o.boxes.reduce((n, r) => n + r.box.weight, 0), i = o.pallet.maxWeight;
642
+ const e = [], t = o.boxes.reduce((s, n) => s + n.box.weight, 0), i = o.pallet.maxWeight;
643
643
  return t > i ? e.push({
644
644
  code: "BR-101",
645
645
  severity: "error",
646
646
  message: `Peso de cajas (${t.toFixed(1)}kg) excede el máximo del palet (${i}kg)`,
647
647
  involvedIds: [o.pallet.id]
648
- }) : t > i * Oe && e.push({
648
+ }) : t > i * Ie && e.push({
649
649
  code: "BR-101",
650
650
  severity: "warning",
651
651
  message: `Peso de cajas (${t.toFixed(1)}kg) supera el 90% del máximo del palet (${i}kg)`,
652
652
  involvedIds: [o.pallet.id]
653
- }), { isValid: e.filter((n) => n.severity === "error").length === 0, violations: e };
653
+ }), { isValid: e.filter((s) => s.severity === "error").length === 0, violations: e };
654
654
  }
655
- function It(o) {
655
+ function Bt(o) {
656
656
  const e = [], t = o.pallets.reduce(
657
- (i, n) => i + we(n.stackedPallet),
657
+ (i, s) => i + ye(s.stackedPallet),
658
658
  0
659
659
  );
660
660
  return t > o.maxWeight ? e.push({
@@ -662,7 +662,7 @@ function It(o) {
662
662
  severity: "error",
663
663
  message: `Peso total (${t.toFixed(1)}kg) excede el máximo del camión (${o.maxWeight}kg)`,
664
664
  involvedIds: [o.id]
665
- }) : t > o.maxWeight * Oe && e.push({
665
+ }) : t > o.maxWeight * Ie && e.push({
666
666
  code: "BR-102",
667
667
  severity: "warning",
668
668
  message: `Peso total (${t.toFixed(1)}kg) supera el 90% del máximo del camión (${o.maxWeight}kg)`,
@@ -673,42 +673,42 @@ function ot(o) {
673
673
  const e = [];
674
674
  for (const t of o) {
675
675
  if (!t.box.fragile) continue;
676
- const i = t.box.fragilityMaxWeight ?? 0, n = st(t, o);
677
- n > i && e.push({
676
+ const i = t.box.fragilityMaxWeight ?? 0, s = st(t, o);
677
+ s > i && e.push({
678
678
  code: "BR-103",
679
679
  severity: "error",
680
- message: `Caja frágil ${t.id} soporta ${n.toFixed(1)}kg (máx: ${i}kg)`,
680
+ message: `Caja frágil ${t.id} soporta ${s.toFixed(1)}kg (máx: ${i}kg)`,
681
681
  involvedIds: [t.id]
682
682
  });
683
683
  }
684
684
  return { isValid: e.length === 0, violations: e };
685
685
  }
686
686
  function st(o, e) {
687
- const t = D(o);
687
+ const t = L(o);
688
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);
689
+ for (const s of e) {
690
+ if (s.id === o.id) continue;
691
+ const n = L(s);
692
+ n.minY >= t.maxY - 1 && n.minX < t.maxX && n.maxX > t.minX && n.minZ < t.maxZ && n.maxZ > t.minZ && (i += s.box.weight);
693
693
  }
694
694
  return i;
695
695
  }
696
696
  function nt(o, e) {
697
697
  const t = [];
698
698
  if (e.length === 0) return { isValid: !0, violations: t };
699
- const i = e.reduce((g, v) => g + v.box.weight, 0);
699
+ const i = e.reduce((l, p) => l + p.box.weight, 0);
700
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({
701
+ let s = 0, n = 0;
702
+ for (const l of e) {
703
+ const p = L(l), h = (p.minX + p.maxX) / 2, g = (p.minZ + p.maxZ) / 2;
704
+ s += h * l.box.weight, n += g * l.box.weight;
705
+ }
706
+ s /= i, n /= i;
707
+ const a = o.dimensions.width / 2, c = o.dimensions.depth / 2;
708
+ return (Math.abs(s - a) > o.dimensions.width / 6 || Math.abs(n - c) > o.dimensions.depth / 6) && t.push({
709
709
  code: "BR-104",
710
710
  severity: "warning",
711
- message: `Centro de gravedad descentrado (${n.toFixed(0)}, ${r.toFixed(0)}) respecto al centro del palet`,
711
+ message: `Centro de gravedad descentrado (${s.toFixed(0)}, ${n.toFixed(0)}) respecto al centro del palet`,
712
712
  involvedIds: [o.id]
713
713
  }), { isValid: !0, violations: t };
714
714
  }
@@ -716,15 +716,15 @@ function rt(o) {
716
716
  const e = [];
717
717
  for (const t of o) {
718
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({
719
+ const i = L(t);
720
+ for (const s of o) {
721
+ if (s.id === t.id) continue;
722
+ const n = L(s);
723
+ n.minY >= i.maxY - 1 && n.minX < i.maxX && n.maxX > i.minX && n.minZ < i.maxZ && n.maxZ > i.minZ && e.push({
724
724
  code: "BR-201",
725
725
  severity: "error",
726
- message: `Caja ${n.id} apilada sobre caja no apilable ${t.id}`,
727
- involvedIds: [t.id, n.id]
726
+ message: `Caja ${s.id} apilada sobre caja no apilable ${t.id}`,
727
+ involvedIds: [t.id, s.id]
728
728
  });
729
729
  }
730
730
  }
@@ -733,38 +733,38 @@ function rt(o) {
733
733
  function at(o) {
734
734
  const e = [];
735
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);
736
+ const i = L(t), s = (i.maxX - i.minX) * (i.maxZ - i.minZ);
737
+ for (const n of o) {
738
+ if (n.id === t.id) continue;
739
+ const a = L(n);
740
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({
741
+ const c = (a.maxX - a.minX) * (a.maxZ - a.minZ);
742
+ n.box.weight > t.box.weight * 1.5 && c > s * 1.2 && e.push({
743
743
  code: "BR-203",
744
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]
745
+ message: `Pirámide invertida: caja ${n.id} (${n.box.weight}kg) sobre caja ${t.id} (${t.box.weight}kg)`,
746
+ involvedIds: [t.id, n.id]
747
747
  });
748
748
  }
749
749
  }
750
750
  return { isValid: !0, violations: e };
751
751
  }
752
- function $t(o) {
752
+ function Wt(o) {
753
753
  const e = [];
754
754
  if (o.floors.length <= 1) return { isValid: !0, violations: e };
755
755
  const t = o.floors[0].pallet;
756
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({
757
+ const s = o.floors[i].pallet;
758
+ (s.dimensions.width !== t.dimensions.width || s.dimensions.depth !== t.dimensions.depth) && e.push({
759
759
  code: "BR-301",
760
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]
761
+ message: `Piso ${i}: dimensiones (${s.dimensions.width}×${s.dimensions.depth}) distintas a la base (${t.dimensions.width}×${t.dimensions.depth})`,
762
+ involvedIds: [t.id, s.id]
763
763
  });
764
764
  }
765
765
  return { isValid: e.length === 0, violations: e };
766
766
  }
767
- function Wt(o) {
767
+ function $t(o) {
768
768
  const e = [];
769
769
  for (let t = 0; t < o.floors.length - 1; t++)
770
770
  o.floors[t].separatorAbove || e.push({
@@ -775,7 +775,7 @@ function Wt(o) {
775
775
  });
776
776
  return { isValid: e.length === 0, violations: e };
777
777
  }
778
- function Bt(o, e) {
778
+ function Lt(o, e) {
779
779
  const t = [], i = le(o);
780
780
  return i > e && t.push({
781
781
  code: "BR-303",
@@ -784,63 +784,63 @@ function Bt(o, e) {
784
784
  involvedIds: [o.id]
785
785
  }), { isValid: t.length === 0, violations: t };
786
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({
787
+ function Gt(o) {
788
+ const e = [], t = ye(o), i = o.floors[0].pallet.maxWeight, s = t - o.floors[0].pallet.weight;
789
+ return s > i && e.push({
790
790
  code: "BR-304",
791
791
  severity: "error",
792
- message: `Peso de carga del stack (${n.toFixed(1)}kg) excede la capacidad del palet base (${i}kg)`,
792
+ message: `Peso de carga del stack (${s.toFixed(1)}kg) excede la capacidad del palet base (${i}kg)`,
793
793
  involvedIds: [o.id]
794
794
  }), { isValid: e.length === 0, violations: e };
795
795
  }
796
796
  function ct(o) {
797
797
  const e = [];
798
798
  for (const t of o) {
799
- const i = D(t);
799
+ const i = L(t);
800
800
  if (i.minY <= 1) continue;
801
- const n = (i.maxX - i.minX) * (i.maxZ - i.minZ);
802
- let r = 0;
801
+ const s = (i.maxX - i.minX) * (i.maxZ - i.minZ);
802
+ let n = 0;
803
803
  for (const a of o) {
804
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;
805
+ const c = L(a);
806
+ if (Math.abs(c.maxY - i.minY) > 2) continue;
807
+ const l = Math.max(0, Math.min(i.maxX, c.maxX) - Math.max(i.minX, c.minX)), p = Math.max(0, Math.min(i.maxZ, c.maxZ) - Math.max(i.minZ, c.minZ));
808
+ n += l * p;
809
809
  }
810
- n > 0 && r / n < Me && e.push({
810
+ s > 0 && n / s < ze && e.push({
811
811
  code: "BR-004",
812
812
  severity: "error",
813
- message: `Caja ${t.id} sin soporte suficiente (${(r / n * 100).toFixed(0)}% < ${Me * 100}%)`,
813
+ message: `Caja ${t.id} sin soporte suficiente (${(n / s * 100).toFixed(0)}% < ${ze * 100}%)`,
814
814
  involvedIds: [t.id]
815
815
  });
816
816
  }
817
817
  return { isValid: e.length === 0, violations: e };
818
818
  }
819
- function q(o) {
819
+ function Y(o) {
820
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;
821
+ let e = 0, t = 0, i = 0, s = 0;
822
+ for (const n of o) {
823
+ const a = L(n), c = (a.minX + a.maxX) / 2, l = (a.minY + a.maxY) / 2, p = (a.minZ + a.maxZ) / 2, h = n.box.weight;
824
+ t += c * h, i += l * h, s += p * h, e += h;
825
825
  }
826
826
  return e === 0 ? { x: 0, y: 0, z: 0 } : {
827
827
  x: t / e,
828
828
  y: i / e,
829
- z: n / e
829
+ z: s / e
830
830
  };
831
831
  }
832
- function se(o, e) {
832
+ function ee(o, e) {
833
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);
834
+ const t = Y(e), i = o.dimensions.width / 2, s = o.dimensions.depth / 2, n = Math.abs(t.x - i) / (o.dimensions.width / 2), a = Math.abs(t.z - s) / (o.dimensions.depth / 2), c = Math.max(0, 100 - (n + a) * 50), l = e.reduce((g, w) => {
835
+ const m = L(w);
836
+ return Math.max(g, m.maxY);
837
+ }, 0), p = l > 0 ? t.y / l : 0, h = Math.max(0, 100 - Math.max(0, p - 0.5) * 100);
838
+ return Math.round(c * 0.7 + h * 0.3);
839
839
  }
840
840
  function lt(o, e) {
841
841
  const t = [];
842
842
  if (e.length === 0) return { isValid: !0, violations: t };
843
- const i = q(e);
843
+ const i = Y(e);
844
844
  return (i.x < 0 || i.x > o.dimensions.width || i.z < 0 || i.z > o.dimensions.depth) && t.push({
845
845
  code: "BR-502",
846
846
  severity: "error",
@@ -851,7 +851,7 @@ function lt(o, e) {
851
851
  function dt(o, e) {
852
852
  const t = [];
853
853
  if (e.length === 0) return { isValid: !0, violations: t };
854
- const i = se(o, e);
854
+ const i = ee(o, e);
855
855
  i < 50 ? t.push({
856
856
  code: "BR-501",
857
857
  severity: "error",
@@ -863,36 +863,36 @@ function dt(o, e) {
863
863
  message: `Score de estabilidad mejorable (${i}/100, recomendado: ≥70)`,
864
864
  involvedIds: [o.id]
865
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({
866
+ const s = Y(e), n = e.reduce((a, c) => Math.max(a, L(c).maxY), 0);
867
+ return n > 0 && s.y > n * 0.6 && t.push({
868
868
  code: "BR-503",
869
869
  severity: "warning",
870
- message: `Centro de gravedad alto (${n.y.toFixed(0)}mm, ${(n.y / r * 100).toFixed(0)}% de la altura)`,
870
+ message: `Centro de gravedad alto (${s.y.toFixed(0)}mm, ${(s.y / n * 100).toFixed(0)}% de la altura)`,
871
871
  involvedIds: [o.id]
872
872
  }), { isValid: t.filter((a) => a.severity === "error").length === 0, violations: t };
873
873
  }
874
874
  function ht(o, e) {
875
875
  let t = !1;
876
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);
877
+ for (let s = 0, n = i - 1; s < i; n = s++) {
878
+ const a = e[s].x, c = e[s].z, l = e[n].x, p = e[n].z;
879
+ c > o.z != p > o.z && o.x < (l - a) * (o.z - c) / (p - c) + a && (t = !t);
880
880
  }
881
881
  return t;
882
882
  }
883
883
  function We(o, e) {
884
- const t = [], i = oe(o), n = [
884
+ const t = [], i = se(o), s = [
885
885
  { x: i.minX, z: i.minZ },
886
886
  { x: i.maxX, z: i.minZ },
887
887
  { x: i.maxX, z: i.maxZ },
888
888
  { x: i.minX, z: i.maxZ }
889
889
  ];
890
- for (const r of n)
891
- if (!ht(r, e.floorPolygon)) {
890
+ for (const n of s)
891
+ if (!ht(n, e.floorPolygon)) {
892
892
  t.push({
893
893
  code: "BR-401",
894
894
  severity: "error",
895
- message: `Palet ${o.id} fuera de la estancia ${e.name} en (${r.x}, ${r.z})`,
895
+ message: `Palet ${o.id} fuera de la estancia ${e.name} en (${n.x}, ${n.z})`,
896
896
  involvedIds: [o.id, e.id]
897
897
  });
898
898
  break;
@@ -908,53 +908,53 @@ class mt {
908
908
  id = "column";
909
909
  name = "Columnas por tipo";
910
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);
911
+ const i = [], s = [], n = /* @__PURE__ */ new Map();
912
+ for (const m of e) {
913
+ const x = m.type ?? m.sku ?? "default";
914
+ n.has(x) || n.set(x, []), n.get(x).push(m);
915
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);
916
+ let a = 0, c = 0;
917
+ for (const [, m] of n) {
918
+ if (m.length === 0) continue;
919
+ const x = m[0], u = x.dimensions.width, d = x.dimensions.depth, b = x.dimensions.height;
920
+ if (a + u > t.dimensions.width) {
921
+ s.push(...m);
922
922
  continue;
923
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));
924
+ let j = 0, _ = 0, S = 0;
925
+ for (; S < m.length; ) {
926
+ const C = m[S];
927
+ if (j + d > t.dimensions.depth) {
928
+ if (j = 0, _ += b, _ + b > t.maxStackHeight) {
929
+ s.push(...m.slice(S));
930
930
  break;
931
931
  }
932
932
  continue;
933
933
  }
934
934
  i.push({
935
- id: `placed-${++f}`,
936
- box: M,
937
- position: { x: a, y: z, z: T },
935
+ id: `placed-${++c}`,
936
+ box: C,
937
+ position: { x: a, y: _, z: j },
938
938
  rotation: { x: 0, y: 0, z: 0 },
939
939
  supportedBy: [],
940
940
  supporting: []
941
- }), T += h, b++;
941
+ }), j += d, S++;
942
942
  }
943
- a += d;
943
+ a += u;
944
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);
945
+ const l = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, p = i.reduce((m, x) => {
946
+ const u = x.box.dimensions;
947
+ return m + u.width * u.height * u.depth;
948
+ }, 0), h = i.reduce((m, x) => m + x.box.weight, 0), g = Y(i), w = ee(t, i);
949
949
  return {
950
950
  placements: i,
951
951
  metrics: {
952
- volumeUtilization: g > 0 ? v / g : 0,
953
- weightUtilization: t.maxWeight > 0 ? u / t.maxWeight : 0,
954
- centerOfGravity: x,
955
- stabilityScore: p
952
+ volumeUtilization: l > 0 ? p / l : 0,
953
+ weightUtilization: t.maxWeight > 0 ? h / t.maxWeight : 0,
954
+ centerOfGravity: g,
955
+ stabilityScore: w
956
956
  },
957
- unplacedBoxes: n
957
+ unplacedBoxes: s
958
958
  };
959
959
  }
960
960
  }
@@ -962,9 +962,9 @@ class ut {
962
962
  id = "bin-packing-3d";
963
963
  name = "Bin Packing 3D (FFD Height)";
964
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;
965
+ const i = [], s = [], n = [...e].sort((g, w) => {
966
+ const m = g.dimensions.width * g.dimensions.height * g.dimensions.depth;
967
+ return w.dimensions.width * w.dimensions.height * w.dimensions.depth - m;
968
968
  }), a = [
969
969
  {
970
970
  x: 0,
@@ -975,69 +975,69 @@ class ut {
975
975
  depth: t.dimensions.depth
976
976
  }
977
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 }
978
+ let c = 0;
979
+ for (const g of n) {
980
+ let w = !1;
981
+ const m = [
982
+ { w: g.dimensions.width, h: g.dimensions.height, d: g.dimensions.depth, rot: 0 },
983
+ { w: g.dimensions.depth, h: g.dimensions.height, d: g.dimensions.width, rot: 90 }
984
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 },
985
+ for (let x = 0; x < a.length && !w; x++) {
986
+ const u = a[x];
987
+ for (const d of m)
988
+ if (d.w <= u.width && d.h <= u.height && d.d <= u.depth) {
989
+ const b = {
990
+ id: `placed-${++c}`,
991
+ box: g,
992
+ position: { x: u.x, y: u.y, z: u.z },
993
+ rotation: { x: 0, y: d.rot, z: 0 },
994
994
  supportedBy: [],
995
995
  supporting: []
996
- }, T = D(j);
996
+ }, j = L(b);
997
997
  if (!i.some(
998
- (b) => ye(D(b), T)
998
+ (S) => ve(L(S), j)
999
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);
1000
+ i.push(b), w = !0, a.splice(x, 1), u.width - d.w > 0 && a.push({
1001
+ x: u.x + d.w,
1002
+ y: u.y,
1003
+ z: u.z,
1004
+ width: u.width - d.w,
1005
+ height: u.height,
1006
+ depth: u.depth
1007
+ }), u.height - d.h > 0 && a.push({
1008
+ x: u.x,
1009
+ y: u.y + d.h,
1010
+ z: u.z,
1011
+ width: d.w,
1012
+ height: u.height - d.h,
1013
+ depth: d.d
1014
+ }), u.depth - d.d > 0 && a.push({
1015
+ x: u.x,
1016
+ y: u.y,
1017
+ z: u.z + d.d,
1018
+ width: d.w,
1019
+ height: u.height,
1020
+ depth: u.depth - d.d
1021
+ }), a.sort((S, C) => S.y - C.y || S.x - C.x || S.z - C.z);
1022
1022
  break;
1023
1023
  }
1024
1024
  }
1025
1025
  }
1026
- p || n.push(x);
1026
+ w || s.push(g);
1027
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);
1028
+ const l = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, p = i.reduce((g, w) => {
1029
+ const m = w.box.dimensions;
1030
+ return g + m.width * m.height * m.depth;
1031
+ }, 0), h = i.reduce((g, w) => g + w.box.weight, 0);
1032
1032
  return {
1033
1033
  placements: i,
1034
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)
1035
+ volumeUtilization: l > 0 ? p / l : 0,
1036
+ weightUtilization: t.maxWeight > 0 ? h / t.maxWeight : 0,
1037
+ centerOfGravity: Y(i),
1038
+ stabilityScore: ee(t, i)
1039
1039
  },
1040
- unplacedBoxes: n
1040
+ unplacedBoxes: s
1041
1041
  };
1042
1042
  }
1043
1043
  }
@@ -1045,54 +1045,576 @@ class xt {
1045
1045
  id = "type-group";
1046
1046
  name = "Agrupación por tipo";
1047
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;
1048
+ const i = [], s = [], n = [...e].sort((x, u) => {
1049
+ const d = x.type ?? x.sku ?? "z", b = u.type ?? u.sku ?? "z";
1050
+ return d !== b ? d.localeCompare(b) : x.fragile !== u.fragile ? x.fragile ? 1 : -1 : u.weight - x.weight;
1051
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);
1052
+ let a = 0, c = 0, l = 0, p = 0, h = 0;
1053
+ for (const x of n) {
1054
+ const u = x.dimensions.width, d = x.dimensions.height, b = x.dimensions.depth;
1055
+ if (a + u > t.dimensions.width && (a = 0, c += p > 0 ? b : 0), c + b > t.dimensions.depth && (a = 0, c = 0, l += p, p = 0), l + d > t.maxStackHeight) {
1056
+ s.push(x);
1057
1057
  continue;
1058
1058
  }
1059
- if (a + d > t.dimensions.width) {
1060
- n.push(l);
1059
+ if (a + u > t.dimensions.width) {
1060
+ s.push(x);
1061
1061
  continue;
1062
1062
  }
1063
- if (f + j > t.dimensions.depth) {
1064
- n.push(l);
1063
+ if (c + b > t.dimensions.depth) {
1064
+ s.push(x);
1065
1065
  continue;
1066
1066
  }
1067
1067
  i.push({
1068
- id: `placed-${++u}`,
1069
- box: l,
1070
- position: { x: a, y: g, z: f },
1068
+ id: `placed-${++h}`,
1069
+ box: x,
1070
+ position: { x: a, y: l, z: c },
1071
1071
  rotation: { x: 0, y: 0, z: 0 },
1072
1072
  supportedBy: [],
1073
1073
  supporting: []
1074
- }), a += d, v = Math.max(v, h);
1074
+ }), a += u, p = Math.max(p, d);
1075
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);
1076
+ const g = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, w = i.reduce((x, u) => {
1077
+ const d = u.box.dimensions;
1078
+ return x + d.width * d.height * d.depth;
1079
+ }, 0), m = i.reduce((x, u) => x + u.box.weight, 0);
1080
1080
  return {
1081
1081
  placements: i,
1082
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)
1083
+ volumeUtilization: g > 0 ? w / g : 0,
1084
+ weightUtilization: t.maxWeight > 0 ? m / t.maxWeight : 0,
1085
+ centerOfGravity: Y(i),
1086
+ stabilityScore: ee(t, i)
1087
1087
  },
1088
- unplacedBoxes: n
1088
+ unplacedBoxes: s
1089
1089
  };
1090
1090
  }
1091
1091
  }
1092
1092
  class gt {
1093
+ id = "material-grouping";
1094
+ name = "Material & Product Grouping";
1095
+ /**
1096
+ * Packs boxes into a pallet using layer-based approach with material ordering
1097
+ *
1098
+ * @param boxes - Boxes to pack
1099
+ * @param pallet - Target pallet
1100
+ * @returns Packing result with placements and metrics
1101
+ */
1102
+ pack(e, t) {
1103
+ if (e.length === 0)
1104
+ return this.emptyResult();
1105
+ const i = this.sortBoxes(e), s = this.groupByMaterialWeight(i), a = this.buildLayers(s, t).flatMap((p) => p.placements), c = e.filter(
1106
+ (p) => !a.some((h) => h.box.id === p.id)
1107
+ ), l = this.calculateMetrics(a, t);
1108
+ return {
1109
+ placements: a,
1110
+ metrics: l,
1111
+ unplacedBoxes: c
1112
+ };
1113
+ }
1114
+ // ─── Phase 1: Sorting ──────────────────────────────────────────────
1115
+ /**
1116
+ * Sorts boxes by multiple criteria:
1117
+ * 1. Material weight (descending) - more resistant boxes first
1118
+ * 2. Product (alphabetical) - group same products together
1119
+ * 3. Base area (descending) - larger boxes first for stable base
1120
+ * 4. Height (descending) - taller boxes first for better layer filling
1121
+ *
1122
+ * @param boxes - Boxes to sort
1123
+ * @returns Sorted boxes array
1124
+ */
1125
+ sortBoxes(e) {
1126
+ return [...e].sort((t, i) => {
1127
+ const s = t.materialWeight ?? 5, n = i.materialWeight ?? 5;
1128
+ if (s !== n)
1129
+ return n - s;
1130
+ const a = t.product ?? "", c = i.product ?? "";
1131
+ if (a !== c)
1132
+ return a.localeCompare(c);
1133
+ const l = t.dimensions.width * t.dimensions.depth, p = i.dimensions.width * i.dimensions.depth;
1134
+ return l !== p ? p - l : i.dimensions.height - t.dimensions.height;
1135
+ });
1136
+ }
1137
+ /**
1138
+ * Groups boxes by material weight for layer construction
1139
+ *
1140
+ * @param boxes - Sorted boxes
1141
+ * @returns Map of material weight → boxes with that weight
1142
+ */
1143
+ groupByMaterialWeight(e) {
1144
+ const t = /* @__PURE__ */ new Map();
1145
+ for (const i of e) {
1146
+ const s = i.materialWeight ?? 5;
1147
+ t.has(s) || t.set(s, []), t.get(s).push(i);
1148
+ }
1149
+ return new Map([...t.entries()].sort((i, s) => s[0] - i[0]));
1150
+ }
1151
+ // ─── Phase 2: Layer Construction ──────────────────────────────────
1152
+ /**
1153
+ * Builds layers from bottom to top, processing each material weight group
1154
+ *
1155
+ * @param materialGroups - Boxes grouped by material weight
1156
+ * @param pallet - Target pallet
1157
+ * @returns Array of layers
1158
+ */
1159
+ buildLayers(e, t) {
1160
+ const i = [], s = /* @__PURE__ */ new Map(), n = [];
1161
+ let a = 0;
1162
+ for (const [, c] of e) {
1163
+ let l = [...c];
1164
+ for (; l.length > 0; ) {
1165
+ const p = this.buildNextLayer(
1166
+ l,
1167
+ t,
1168
+ a,
1169
+ s,
1170
+ n
1171
+ );
1172
+ if (p.placements.length === 0)
1173
+ break;
1174
+ i.push(p), n.push(...p.placements), a += p.height;
1175
+ const h = new Set(p.placements.map((g) => g.box.id));
1176
+ if (l = l.filter((g) => !h.has(g.id)), a >= t.maxStackHeight)
1177
+ break;
1178
+ }
1179
+ }
1180
+ return i;
1181
+ }
1182
+ /**
1183
+ * Builds the next layer using available boxes
1184
+ *
1185
+ * Strategy:
1186
+ * 1. Try uniform height layer with 100% coverage
1187
+ * 2. If not possible, try mixed height layer
1188
+ * 3. If still not possible, use partial coverage (last resort)
1189
+ *
1190
+ * @param availableBoxes - Boxes available for this layer
1191
+ * @param pallet - Target pallet
1192
+ * @param currentY - Current vertical position
1193
+ * @param occupiedColumns - Track which (x,z) positions have which product
1194
+ * @param allPreviousPlacements - All placements from previous layers (for support calculation)
1195
+ * @returns Constructed layer
1196
+ */
1197
+ buildNextLayer(e, t, i, s, n) {
1198
+ const a = this.tryUniformHeightLayer(
1199
+ e,
1200
+ t,
1201
+ i,
1202
+ s,
1203
+ n
1204
+ );
1205
+ if (a && a.coverage >= 95)
1206
+ return a;
1207
+ const c = this.tryMixedHeightLayer(
1208
+ e,
1209
+ t,
1210
+ i,
1211
+ s,
1212
+ n
1213
+ );
1214
+ return c && c.coverage >= 95 ? c : ((a?.coverage ?? 0) > (c?.coverage ?? 0) ? a : c) ?? this.emptyLayer(i);
1215
+ }
1216
+ /**
1217
+ * Attempts to create a layer with boxes of uniform height
1218
+ *
1219
+ * @param boxes - Available boxes
1220
+ * @param pallet - Target pallet
1221
+ * @param currentY - Current vertical position
1222
+ * @param occupiedColumns - Occupied column tracker
1223
+ * @param allPreviousPlacements - All placements from previous layers
1224
+ * @returns Layer or null if not possible
1225
+ */
1226
+ tryUniformHeightLayer(e, t, i, s, n) {
1227
+ const a = /* @__PURE__ */ new Map();
1228
+ for (const l of e) {
1229
+ const p = l.dimensions.height;
1230
+ a.has(p) || a.set(p, []), a.get(p).push(l);
1231
+ }
1232
+ const c = [...a.entries()].sort(
1233
+ (l, p) => p[1].length - l[1].length
1234
+ );
1235
+ for (const [l, p] of c) {
1236
+ if (i + l > t.maxStackHeight)
1237
+ continue;
1238
+ const h = this.placeBoxesInLayer(
1239
+ p,
1240
+ t,
1241
+ i,
1242
+ l,
1243
+ s,
1244
+ n
1245
+ );
1246
+ if (h.coverage >= 95)
1247
+ return h;
1248
+ }
1249
+ return null;
1250
+ }
1251
+ /**
1252
+ * Attempts to create a layer with boxes of mixed heights
1253
+ *
1254
+ * @param boxes - Available boxes
1255
+ * @param pallet - Target pallet
1256
+ * @param currentY - Current vertical position
1257
+ * @param occupiedColumns - Occupied column tracker
1258
+ * @param allPreviousPlacements - All placements from previous layers
1259
+ * @returns Layer or null if not possible
1260
+ */
1261
+ tryMixedHeightLayer(e, t, i, s, n) {
1262
+ return this.placeBoxesInLayer(
1263
+ e,
1264
+ t,
1265
+ i,
1266
+ null,
1267
+ s,
1268
+ n
1269
+ );
1270
+ }
1271
+ // ─── Phase 3: Maximal Rectangles 2D Packing ───────────────────────
1272
+ /**
1273
+ * Places boxes in a layer using Maximal Rectangles algorithm
1274
+ *
1275
+ * @param boxes - Boxes to place
1276
+ * @param pallet - Target pallet
1277
+ * @param currentY - Y coordinate of this layer
1278
+ * @param targetHeight - If specified, only use boxes of this height
1279
+ * @param occupiedColumns - Track product columns
1280
+ * @param allPreviousPlacements - All placements from previous layers (for support calculation)
1281
+ * @returns Constructed layer
1282
+ */
1283
+ placeBoxesInLayer(e, t, i, s, n, a) {
1284
+ const c = [
1285
+ {
1286
+ x: 0,
1287
+ z: 0,
1288
+ width: t.dimensions.width,
1289
+ depth: t.dimensions.depth
1290
+ }
1291
+ ], l = [], h = [...this.groupByProduct(e).entries()].sort(
1292
+ (u, d) => d[1].length - u[1].length
1293
+ );
1294
+ let g = 0;
1295
+ for (const [u, d] of h) {
1296
+ const b = s ? d.filter((j) => j.dimensions.height === s) : d;
1297
+ for (const j of b) {
1298
+ if (i + j.dimensions.height > t.maxStackHeight)
1299
+ continue;
1300
+ const _ = [
1301
+ {
1302
+ width: j.dimensions.width,
1303
+ depth: j.dimensions.depth,
1304
+ rotation: 0
1305
+ },
1306
+ {
1307
+ width: j.dimensions.depth,
1308
+ depth: j.dimensions.width,
1309
+ rotation: 90
1310
+ }
1311
+ ];
1312
+ for (const S of _) {
1313
+ const C = [
1314
+ ...a,
1315
+ ...l
1316
+ ], z = this.findBestRectangle(
1317
+ S,
1318
+ c,
1319
+ n,
1320
+ u,
1321
+ i,
1322
+ C
1323
+ );
1324
+ if (z) {
1325
+ const y = {
1326
+ id: `placed-${++g}`,
1327
+ box: j,
1328
+ position: { x: z.x, y: i, z: z.z },
1329
+ rotation: { x: 0, y: S.rotation, z: 0 },
1330
+ supportedBy: [],
1331
+ supporting: []
1332
+ };
1333
+ l.push(y), this.updateOccupiedColumns(
1334
+ n,
1335
+ z.x,
1336
+ z.z,
1337
+ u
1338
+ ), this.updateFreeRectangles(
1339
+ c,
1340
+ z,
1341
+ S.width,
1342
+ S.depth
1343
+ );
1344
+ break;
1345
+ }
1346
+ }
1347
+ }
1348
+ }
1349
+ const w = t.dimensions.width * t.dimensions.depth, m = l.reduce((u, d) => {
1350
+ const b = d.rotation.y === 90 ? d.box.dimensions.depth : d.box.dimensions.width, j = d.rotation.y === 90 ? d.box.dimensions.width : d.box.dimensions.depth;
1351
+ return u + b * j;
1352
+ }, 0), x = l.length > 0 ? Math.max(...l.map((u) => u.box.dimensions.height)) : 0;
1353
+ return {
1354
+ y: i,
1355
+ height: x,
1356
+ placements: l,
1357
+ coverage: m / w * 100
1358
+ };
1359
+ }
1360
+ /**
1361
+ * Finds the best free rectangle for a box using scoring
1362
+ *
1363
+ * @param boxDims - Box dimensions (with rotation applied)
1364
+ * @param freeRectangles - Available free spaces
1365
+ * @param occupiedColumns - Product column tracker
1366
+ * @param product - Product identifier
1367
+ * @param currentY - Current layer Y position
1368
+ * @param existingPlacements - Already placed boxes in this layer and below
1369
+ * @param pallet - Pallet dimensions
1370
+ * @returns Best rectangle or null if none fit
1371
+ */
1372
+ findBestRectangle(e, t, i, s, n, a) {
1373
+ let c = null, l = -1 / 0;
1374
+ for (const p of t)
1375
+ if (e.width <= p.width && e.depth <= p.depth) {
1376
+ const h = this.calculateSupportArea(
1377
+ p.x,
1378
+ p.z,
1379
+ e.width,
1380
+ e.depth,
1381
+ n,
1382
+ a
1383
+ ), g = e.width * e.depth;
1384
+ if (h / g < 0.7 || this.boxExtendsBeyondLowerLayer(
1385
+ p.x,
1386
+ p.z,
1387
+ e.width,
1388
+ e.depth,
1389
+ n,
1390
+ a
1391
+ ))
1392
+ continue;
1393
+ const m = this.scoreRectangle(
1394
+ p,
1395
+ e,
1396
+ i,
1397
+ s
1398
+ );
1399
+ m > l && (l = m, c = p);
1400
+ }
1401
+ return c;
1402
+ }
1403
+ /**
1404
+ * Calculates the area of support a box would have at a given position
1405
+ *
1406
+ * @param x - X position of box
1407
+ * @param z - Z position of box
1408
+ * @param width - Width of box
1409
+ * @param depth - Depth of box
1410
+ * @param currentY - Y position where box will be placed
1411
+ * @param existingPlacements - Boxes already placed in current and previous layers
1412
+ * @param pallet - Pallet dimensions
1413
+ * @returns Supported area in mm²
1414
+ */
1415
+ calculateSupportArea(e, t, i, s, n, a) {
1416
+ let c = 0;
1417
+ if (n === 0)
1418
+ return i * s;
1419
+ for (const l of a) {
1420
+ const p = l.rotation.y === 90 ? l.box.dimensions.depth : l.box.dimensions.width, h = l.rotation.y === 90 ? l.box.dimensions.width : l.box.dimensions.depth, g = l.position.y + l.box.dimensions.height;
1421
+ if (Math.abs(g - n) > 1)
1422
+ continue;
1423
+ const m = this.calculateRectangleIntersection(
1424
+ e,
1425
+ t,
1426
+ i,
1427
+ s,
1428
+ l.position.x,
1429
+ l.position.z,
1430
+ p,
1431
+ h
1432
+ );
1433
+ c += m;
1434
+ }
1435
+ return c;
1436
+ }
1437
+ /**
1438
+ * Calculates intersection area between two rectangles
1439
+ *
1440
+ * @returns Intersection area in mm²
1441
+ */
1442
+ calculateRectangleIntersection(e, t, i, s, n, a, c, l) {
1443
+ const p = Math.max(0, Math.min(e + i, n + c) - Math.max(e, n)), h = Math.max(0, Math.min(t + s, a + l) - Math.max(t, a));
1444
+ return p * h;
1445
+ }
1446
+ /**
1447
+ * Checks if a box would extend beyond the footprint of boxes in the layer directly below
1448
+ *
1449
+ * This ensures that boxes in upper layers are always stacked on top of lower boxes,
1450
+ * preventing boxes from "hanging" over edges when there's available space in the lower layer.
1451
+ *
1452
+ * @param x - X position of box
1453
+ * @param z - Z position of box
1454
+ * @param width - Width of box
1455
+ * @param depth - Depth of box
1456
+ * @param currentY - Y position where box will be placed
1457
+ * @param existingPlacements - Boxes already placed in current and previous layers
1458
+ * @returns true if box extends beyond lower layer footprint
1459
+ */
1460
+ boxExtendsBeyondLowerLayer(e, t, i, s, n, a) {
1461
+ if (n === 0)
1462
+ return !1;
1463
+ const c = a.filter((d) => {
1464
+ const b = d.position.y + d.box.dimensions.height;
1465
+ return Math.abs(b - n) <= 1;
1466
+ });
1467
+ if (c.length === 0)
1468
+ return !0;
1469
+ let l = 1 / 0, p = -1 / 0, h = 1 / 0, g = -1 / 0;
1470
+ for (const d of c) {
1471
+ const b = d.rotation.y === 90 ? d.box.dimensions.depth : d.box.dimensions.width, j = d.rotation.y === 90 ? d.box.dimensions.width : d.box.dimensions.depth;
1472
+ l = Math.min(l, d.position.x), p = Math.max(p, d.position.x + b), h = Math.min(h, d.position.z), g = Math.max(g, d.position.z + j);
1473
+ }
1474
+ const w = e + i, m = t + s, x = 1;
1475
+ return e < l - x || w > p + x || t < h - x || m > g + x;
1476
+ }
1477
+ /**
1478
+ * Scores a rectangle position based on multiple criteria
1479
+ *
1480
+ * Higher score = better position
1481
+ *
1482
+ * @param rect - Free rectangle
1483
+ * @param boxDims - Box dimensions
1484
+ * @param occupiedColumns - Product column tracker
1485
+ * @param product - Product identifier
1486
+ * @returns Score value
1487
+ */
1488
+ scoreRectangle(e, t, i, s) {
1489
+ let n = 0;
1490
+ const a = `${e.x},${e.z}`;
1491
+ i.get(a) === s && (n += 100), i.has(a) && i.get(a) !== s && (n -= 50);
1492
+ const c = e.width * e.depth - t.width * t.depth;
1493
+ return n += 50 / (1 + c / 1e4), n += 30 / (1 + e.x / 1e3 + e.z / 1e3), n;
1494
+ }
1495
+ /**
1496
+ * Updates free rectangles after placing a box (Maximal Rectangles algorithm)
1497
+ *
1498
+ * @param freeRects - Current free rectangles
1499
+ * @param usedRect - Rectangle being used by the new box
1500
+ * @param boxWidth - Width of placed box
1501
+ * @param boxDepth - Depth of placed box
1502
+ */
1503
+ updateFreeRectangles(e, t, i, s) {
1504
+ const n = [];
1505
+ for (let a = e.length - 1; a >= 0; a--) {
1506
+ const c = e[a];
1507
+ this.rectanglesIntersect(c, t, i, s) && (e.splice(a, 1), t.x > c.x && n.push({
1508
+ x: c.x,
1509
+ z: c.z,
1510
+ width: t.x - c.x,
1511
+ depth: c.depth
1512
+ }), t.x + i < c.x + c.width && n.push({
1513
+ x: t.x + i,
1514
+ z: c.z,
1515
+ width: c.x + c.width - (t.x + i),
1516
+ depth: c.depth
1517
+ }), t.z > c.z && n.push({
1518
+ x: c.x,
1519
+ z: c.z,
1520
+ width: c.width,
1521
+ depth: t.z - c.z
1522
+ }), t.z + s < c.z + c.depth && n.push({
1523
+ x: c.x,
1524
+ z: t.z + s,
1525
+ width: c.width,
1526
+ depth: c.z + c.depth - (t.z + s)
1527
+ }));
1528
+ }
1529
+ e.push(...n), this.removeContainedRectangles(e);
1530
+ }
1531
+ /**
1532
+ * Checks if two rectangles intersect
1533
+ */
1534
+ rectanglesIntersect(e, t, i, s) {
1535
+ return !(t.x + i <= e.x || t.x >= e.x + e.width || t.z + s <= e.z || t.z >= e.z + e.depth);
1536
+ }
1537
+ /**
1538
+ * Removes rectangles that are fully contained within other rectangles
1539
+ */
1540
+ removeContainedRectangles(e) {
1541
+ for (let t = e.length - 1; t >= 0; t--) {
1542
+ const i = e[t];
1543
+ for (let s = 0; s < e.length; s++) {
1544
+ if (t === s) continue;
1545
+ const n = e[s];
1546
+ if (i.x >= n.x && i.z >= n.z && i.x + i.width <= n.x + n.width && i.z + i.depth <= n.z + n.depth) {
1547
+ e.splice(t, 1);
1548
+ break;
1549
+ }
1550
+ }
1551
+ }
1552
+ }
1553
+ /**
1554
+ * Updates the occupied columns map after placing a box
1555
+ */
1556
+ updateOccupiedColumns(e, t, i, s) {
1557
+ const n = `${t},${i}`;
1558
+ e.has(n) || e.set(n, s);
1559
+ }
1560
+ // ─── Utility Methods ───────────────────────────────────────────────
1561
+ /**
1562
+ * Groups boxes by product identifier
1563
+ */
1564
+ groupByProduct(e) {
1565
+ const t = /* @__PURE__ */ new Map();
1566
+ for (const i of e) {
1567
+ const s = i.product ?? "default";
1568
+ t.has(s) || t.set(s, []), t.get(s).push(i);
1569
+ }
1570
+ return t;
1571
+ }
1572
+ /**
1573
+ * Creates an empty layer
1574
+ */
1575
+ emptyLayer(e) {
1576
+ return {
1577
+ y: e,
1578
+ height: 0,
1579
+ placements: [],
1580
+ coverage: 0
1581
+ };
1582
+ }
1583
+ /**
1584
+ * Creates an empty packing result
1585
+ */
1586
+ emptyResult() {
1587
+ return {
1588
+ placements: [],
1589
+ metrics: {
1590
+ volumeUtilization: 0,
1591
+ weightUtilization: 0,
1592
+ centerOfGravity: { x: 0, y: 0, z: 0 },
1593
+ stabilityScore: 100
1594
+ },
1595
+ unplacedBoxes: []
1596
+ };
1597
+ }
1598
+ /**
1599
+ * Calculates packing metrics
1600
+ */
1601
+ calculateMetrics(e, t) {
1602
+ const i = t.dimensions.width * t.maxStackHeight * t.dimensions.depth, s = e.reduce((a, c) => {
1603
+ const l = c.box.dimensions;
1604
+ return a + l.width * l.height * l.depth;
1605
+ }, 0), n = e.reduce((a, c) => a + c.box.weight, 0);
1606
+ return {
1607
+ volumeUtilization: i > 0 ? s / i : 0,
1608
+ weightUtilization: t.maxWeight > 0 ? n / t.maxWeight : 0,
1609
+ centerOfGravity: Y(e),
1610
+ stabilityScore: ee(t, e)
1611
+ };
1612
+ }
1613
+ }
1614
+ class pt {
1093
1615
  strategies = /* @__PURE__ */ new Map();
1094
1616
  constructor() {
1095
- this.register(new mt()), this.register(new ut()), this.register(new xt());
1617
+ this.register(new mt()), this.register(new ut()), this.register(new xt()), this.register(new gt());
1096
1618
  }
1097
1619
  register(e) {
1098
1620
  this.strategies.set(e.id, e);
@@ -1113,10 +1635,10 @@ class gt {
1113
1635
  return this.strategies.has(e);
1114
1636
  }
1115
1637
  }
1116
- const ft = new gt();
1117
- let pt = 0;
1638
+ const ft = new pt();
1639
+ let wt = 0;
1118
1640
  function Te() {
1119
- return `pallet-${++pt}`;
1641
+ return `pallet-${++wt}`;
1120
1642
  }
1121
1643
  class Z {
1122
1644
  // ═══ Palets estándar internacionales ═══════════════════════════
@@ -1187,7 +1709,7 @@ class Z {
1187
1709
  return {
1188
1710
  id: Te(),
1189
1711
  dimensions: { ...e },
1190
- material: L.WOOD,
1712
+ material: N.WOOD,
1191
1713
  maxWeight: 1e3,
1192
1714
  maxStackHeight: 2200,
1193
1715
  weight: 25,
@@ -1208,16 +1730,16 @@ class Z {
1208
1730
  }));
1209
1731
  }
1210
1732
  }
1211
- let vt = 0;
1212
- function ze() {
1213
- return `truck-${++vt}`;
1733
+ let yt = 0;
1734
+ function _e() {
1735
+ return `truck-${++yt}`;
1214
1736
  }
1215
- class Gt {
1737
+ class Vt {
1216
1738
  /** Crea un camión a partir de un preset de tipo */
1217
1739
  static fromPreset(e, t) {
1218
1740
  const i = Ze[e];
1219
1741
  return {
1220
- id: ze(),
1742
+ id: _e(),
1221
1743
  name: `Camión ${e}`,
1222
1744
  truckType: e,
1223
1745
  dimensions: { ...i.dimensions },
@@ -1230,9 +1752,9 @@ class Gt {
1230
1752
  /** Crea un camión custom con dimensiones y peso arbitrarios */
1231
1753
  static custom(e, t, i) {
1232
1754
  return {
1233
- id: ze(),
1755
+ id: _e(),
1234
1756
  name: "Camión Custom",
1235
- truckType: ie.CUSTOM,
1757
+ truckType: oe.CUSTOM,
1236
1758
  dimensions: { ...e },
1237
1759
  maxWeight: t,
1238
1760
  pallets: [],
@@ -1241,73 +1763,119 @@ class Gt {
1241
1763
  };
1242
1764
  }
1243
1765
  }
1244
- let wt = 0;
1245
- function yt() {
1246
- return `box-${++wt}`;
1766
+ let vt = 0;
1767
+ function bt() {
1768
+ return `box-${++vt}`;
1247
1769
  }
1248
1770
  class ge {
1249
- /** Crea una caja con valores por defecto razonables */
1771
+ /**
1772
+ * Creates a box with default values
1773
+ *
1774
+ * @param dims - Box dimensions in millimeters
1775
+ * @param opts - Optional overrides for any Box property
1776
+ * @returns A new Box instance with defaults applied
1777
+ *
1778
+ * @example
1779
+ * const box = BoxFactory.create(
1780
+ * { width: 600, height: 400, depth: 400 },
1781
+ * { product: 'PROD-A', materialWeight: 6 }
1782
+ * )
1783
+ */
1250
1784
  static create(e, t) {
1251
1785
  return {
1252
- id: yt(),
1786
+ id: bt(),
1253
1787
  dimensions: { ...e },
1254
1788
  weight: 5,
1789
+ materialWeight: 5,
1790
+ // Default: medium resistance
1255
1791
  fragile: !1,
1256
1792
  stackable: !0,
1257
1793
  metadata: {},
1258
1794
  ...t
1259
1795
  };
1260
1796
  }
1261
- /** Caja frágil con peso máximo encima */
1797
+ /**
1798
+ * Creates a fragile box with maximum weight limit
1799
+ *
1800
+ * @param dims - Box dimensions in millimeters
1801
+ * @param fragilityMaxWeight - Maximum weight (kg) this box can support on top
1802
+ * @param opts - Optional overrides
1803
+ * @returns A fragile Box instance
1804
+ *
1805
+ * @example
1806
+ * const fragileBox = BoxFactory.fragile(
1807
+ * { width: 400, height: 300, depth: 300 },
1808
+ * 10, // Can support max 10kg on top
1809
+ * { materialWeight: 0, product: 'PROD-FRAGILE' }
1810
+ * )
1811
+ */
1262
1812
  static fragile(e, t, i) {
1263
1813
  return ge.create(e, {
1264
1814
  fragile: !0,
1265
1815
  fragilityMaxWeight: t,
1816
+ materialWeight: 0,
1817
+ // Fragile boxes go on top
1266
1818
  ...i
1267
1819
  });
1268
1820
  }
1269
- /** Caja pesada y no apilable */
1821
+ /**
1822
+ * Creates a heavy, non-stackable box
1823
+ *
1824
+ * @param dims - Box dimensions in millimeters
1825
+ * @param weight - Box weight in kilograms
1826
+ * @param opts - Optional overrides
1827
+ * @returns A heavy Box instance
1828
+ *
1829
+ * @example
1830
+ * const heavyBox = BoxFactory.heavy(
1831
+ * { width: 800, height: 600, depth: 600 },
1832
+ * 50, // 50kg
1833
+ * { materialWeight: 8, product: 'PROD-HEAVY' }
1834
+ * )
1835
+ */
1270
1836
  static heavy(e, t, i) {
1271
1837
  return ge.create(e, {
1272
1838
  weight: t,
1273
1839
  stackable: !1,
1840
+ materialWeight: 8,
1841
+ // Heavy boxes have high resistance
1274
1842
  ...i
1275
1843
  });
1276
1844
  }
1277
1845
  }
1278
- function Vt(o, e) {
1846
+ function Xt(o, e) {
1279
1847
  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 = [
1848
+ const t = Je(o), i = et(o, e), n = it({ pallet: e, boxes: o }), a = ct(o), c = rt(o), l = at(o), p = dt(e, o), h = lt(e, o), g = ot(o), w = nt(e, o), m = [...c.violations, ...l.violations], x = [...p.violations, ...h.violations], u = [
1281
1849
  ...t.violations,
1282
1850
  ...i.violations,
1283
- ...r.violations,
1851
+ ...n.violations,
1284
1852
  ...a.violations,
1285
- ...c,
1286
- ...l,
1287
- ...x.violations,
1288
- ...p.violations
1853
+ ...m,
1854
+ ...x,
1855
+ ...g.violations,
1856
+ ...w.violations
1289
1857
  ];
1290
1858
  return {
1291
- isValid: d.filter((h) => h.severity === "error").length === 0,
1292
- violations: d,
1859
+ isValid: u.filter((d) => d.severity === "error").length === 0,
1860
+ violations: u,
1293
1861
  collisions: t,
1294
1862
  bounds: i,
1295
- weight: r,
1863
+ weight: n,
1296
1864
  gravity: a,
1297
1865
  stacking: {
1298
- isValid: f.isValid,
1299
- violations: c
1866
+ isValid: c.isValid,
1867
+ violations: m
1300
1868
  },
1301
1869
  stability: {
1302
- isValid: v.isValid && u.isValid,
1303
- violations: l
1870
+ isValid: p.isValid && h.isValid,
1871
+ violations: x
1304
1872
  },
1305
- fragile: x,
1306
- distribution: p
1873
+ fragile: g,
1874
+ distribution: w
1307
1875
  };
1308
1876
  }, [o, e]);
1309
1877
  }
1310
- function Xt(o) {
1878
+ function Zt(o) {
1311
1879
  return k(() => {
1312
1880
  if (!o || o.floors.length === 0)
1313
1881
  return {
@@ -1320,28 +1888,28 @@ function Xt(o) {
1320
1888
  boxCount: 0,
1321
1889
  floorCount: 0
1322
1890
  };
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);
1891
+ const e = le(o), t = ye(o), i = o.floors[0].pallet, s = o.floors.flatMap((g) => g.boxes), n = s.length, a = o.floors.length, c = i.dimensions.width * i.maxStackHeight * i.dimensions.depth, l = s.reduce((g, w) => {
1892
+ const m = w.box.dimensions;
1893
+ return g + m.width * m.height * m.depth;
1894
+ }, 0), p = Y(s), h = ee(i, s);
1327
1895
  return {
1328
- volumeUtilization: f > 0 ? g / f : 0,
1896
+ volumeUtilization: c > 0 ? l / c : 0,
1329
1897
  weightUtilization: i.maxWeight > 0 ? t / i.maxWeight : 0,
1330
- centerOfGravity: v,
1331
- stabilityScore: u,
1898
+ centerOfGravity: p,
1899
+ stabilityScore: h,
1332
1900
  totalHeight: e,
1333
1901
  totalWeight: t,
1334
- boxCount: r,
1902
+ boxCount: n,
1335
1903
  floorCount: a
1336
1904
  };
1337
1905
  }, [o]);
1338
1906
  }
1339
- function Zt(o, e = ft) {
1907
+ function Dt(o, e = ft) {
1340
1908
  const t = k(
1341
- () => e.list().map((n) => ({ id: n.id, name: n.name })),
1909
+ () => e.list().map((s) => ({ id: s.id, name: s.name })),
1342
1910
  [e]
1343
- ), i = H(
1344
- (n, r) => e.get(o).pack(n, r),
1911
+ ), i = q(
1912
+ (s, n) => e.get(o).pack(s, n),
1345
1913
  [o, e]
1346
1914
  );
1347
1915
  return { availableStrategies: t, pack: i };
@@ -1349,16 +1917,16 @@ function Zt(o, e = ft) {
1349
1917
  function Nt(o) {
1350
1918
  return k(() => {
1351
1919
  const e = [];
1352
- for (const n of o.pallets) {
1353
- const r = We(n, o);
1354
- e.push(...r.violations);
1920
+ for (const s of o.pallets) {
1921
+ const n = We(s, o);
1922
+ e.push(...n.violations);
1355
1923
  }
1356
1924
  const t = Qe(o.pallets), i = [
1357
1925
  ...e,
1358
1926
  ...t.violations
1359
1927
  ];
1360
1928
  return {
1361
- isValid: i.filter((n) => n.severity === "error").length === 0,
1929
+ isValid: i.filter((s) => s.severity === "error").length === 0,
1362
1930
  violations: i,
1363
1931
  palletInRoom: {
1364
1932
  isValid: e.length === 0,
@@ -1368,76 +1936,87 @@ function Nt(o) {
1368
1936
  };
1369
1937
  }, [o]);
1370
1938
  }
1371
- const bt = V(function({
1939
+ const St = V(function({
1372
1940
  placedBox: e,
1373
1941
  selected: t = !1,
1374
1942
  highlighted: i = !1,
1375
- showLabel: n = !1,
1376
- color: r,
1943
+ showLabel: s = !1,
1944
+ color: n,
1377
1945
  opacity: a,
1378
- selectedColor: f,
1379
- highlightedColor: g,
1380
- onClick: v,
1381
- onHover: u
1946
+ selectedColor: c,
1947
+ highlightedColor: l,
1948
+ onClick: p,
1949
+ onHover: h
1382
1950
  }) {
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]);
1951
+ const g = Ee(null), w = ce(), { box: m, position: x, rotation: u } = e, d = U.MM_TO_M, b = n ?? m.color ?? w.box.color, j = a ?? w.box.opacity, _ = c ?? w.selection.selectedColor, S = l ?? w.selection.highlightedColor;
1952
+ let C = m.dimensions.width, z = m.dimensions.depth;
1953
+ (u.y === 90 || u.y === 270) && ([C, z] = [z, C]);
1386
1954
  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
1955
+ () => [C * d, m.dimensions.height * d, z * d],
1956
+ [C, z, m.dimensions.height, d]
1957
+ ), v = k(
1958
+ () => new B.Vector3(
1959
+ x.x * d + y[0] / 2,
1960
+ x.y * d + y[1] / 2,
1961
+ x.z * d + y[2] / 2
1394
1962
  ),
1395
- [l, y, h]
1396
- ), S = t ? z : i ? b : null, E = H(
1397
- (P) => {
1398
- P.stopPropagation(), v?.(e.id);
1963
+ [x, y, d]
1964
+ ), M = t ? _ : i ? S : null, E = q(
1965
+ (R) => {
1966
+ R.stopPropagation(), p?.(e.id);
1399
1967
  },
1400
- [v, e.id]
1401
- ), R = H(
1402
- (P) => {
1403
- P.stopPropagation(), u?.(e.id);
1968
+ [p, e.id]
1969
+ ), T = q(
1970
+ (R) => {
1971
+ R.stopPropagation(), h?.(e.id);
1404
1972
  },
1405
- [u, e.id]
1406
- ), O = H(() => {
1407
- u?.(null);
1408
- }, [u]);
1409
- return /* @__PURE__ */ s.jsxs("group", { children: [
1410
- /* @__PURE__ */ s.jsxs(
1973
+ [h, e.id]
1974
+ ), I = q(() => {
1975
+ h?.(null);
1976
+ }, [h]);
1977
+ return /* @__PURE__ */ r.jsxs("group", { children: [
1978
+ /* @__PURE__ */ r.jsxs(
1411
1979
  "mesh",
1412
1980
  {
1413
- ref: x,
1414
- position: w,
1981
+ ref: g,
1982
+ position: v,
1415
1983
  onClick: E,
1416
- onPointerOver: R,
1417
- onPointerOut: O,
1984
+ onPointerOver: T,
1985
+ onPointerOut: I,
1418
1986
  castShadow: !0,
1419
1987
  receiveShadow: !0,
1420
1988
  children: [
1421
- /* @__PURE__ */ s.jsx("boxGeometry", { args: y }),
1422
- /* @__PURE__ */ s.jsx(
1989
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: y }),
1990
+ /* @__PURE__ */ r.jsx(
1423
1991
  "meshStandardMaterial",
1424
1992
  {
1425
- color: j,
1426
- transparent: T < 1,
1427
- opacity: T,
1428
- roughness: p.box.roughness,
1429
- metalness: p.box.metalness
1993
+ color: b,
1994
+ transparent: j < 1,
1995
+ opacity: j,
1996
+ roughness: w.box.roughness,
1997
+ metalness: w.box.metalness
1430
1998
  }
1431
1999
  )
1432
2000
  ]
1433
2001
  }
1434
2002
  ),
1435
- S && /* @__PURE__ */ s.jsxs("mesh", { position: w, children: [
1436
- /* @__PURE__ */ s.jsx("boxGeometry", { args: y }),
1437
- /* @__PURE__ */ s.jsx(
2003
+ /* @__PURE__ */ r.jsxs("lineSegments", { position: v, children: [
2004
+ /* @__PURE__ */ r.jsx("edgesGeometry", { args: [new B.BoxGeometry(...y)] }),
2005
+ /* @__PURE__ */ r.jsx(
2006
+ "lineBasicMaterial",
2007
+ {
2008
+ color: M ?? "#000000",
2009
+ opacity: M ? 1 : 0.4,
2010
+ transparent: !0
2011
+ }
2012
+ )
2013
+ ] }),
2014
+ M && /* @__PURE__ */ r.jsxs("mesh", { position: v, children: [
2015
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: y }),
2016
+ /* @__PURE__ */ r.jsx(
1438
2017
  "meshBasicMaterial",
1439
2018
  {
1440
- color: S,
2019
+ color: M,
1441
2020
  wireframe: !0,
1442
2021
  wireframeLinewidth: 1,
1443
2022
  transparent: !0,
@@ -1446,14 +2025,10 @@ const bt = V(function({
1446
2025
  }
1447
2026
  )
1448
2027
  ] }),
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(
2028
+ s && /* @__PURE__ */ r.jsx(
1454
2029
  ke,
1455
2030
  {
1456
- position: [w.x, w.y + y[1] / 2 + 0.05, w.z],
2031
+ position: [v.x, v.y + y[1] / 2 + 0.05, v.z],
1457
2032
  center: !0,
1458
2033
  style: {
1459
2034
  background: "rgba(0,0,0,0.75)",
@@ -1464,7 +2039,7 @@ const bt = V(function({
1464
2039
  whiteSpace: "nowrap",
1465
2040
  pointerEvents: "none"
1466
2041
  },
1467
- children: c.sku ?? c.type ?? c.id
2042
+ children: m.sku ?? m.type ?? m.id
1468
2043
  }
1469
2044
  )
1470
2045
  ] });
@@ -1472,54 +2047,54 @@ const bt = V(function({
1472
2047
  pallet: e,
1473
2048
  position: t = { x: 0, y: 0, z: 0 },
1474
2049
  color: i,
1475
- edgeColor: n
2050
+ edgeColor: s
1476
2051
  }) {
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
2052
+ const n = ce(), a = i ?? n.pallet.color, c = s ?? n.pallet.edgeColor, l = U.MM_TO_M, p = e.dimensions, h = k(
2053
+ () => [p.width * l, p.height * l, p.depth * l],
2054
+ [p, l]
2055
+ ), g = k(
2056
+ () => new B.Vector3(
2057
+ t.x * l + h[0] / 2,
2058
+ t.y * l + h[1] / 2,
2059
+ t.z * l + h[2] / 2
1485
2060
  ),
1486
- [t, u, g]
2061
+ [t, h, l]
1487
2062
  );
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 })
2063
+ return /* @__PURE__ */ r.jsxs("group", { children: [
2064
+ /* @__PURE__ */ r.jsxs("mesh", { position: g, castShadow: !0, receiveShadow: !0, children: [
2065
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: h }),
2066
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: a, roughness: n.pallet.roughness, metalness: n.pallet.metalness })
1492
2067
  ] }),
1493
- /* @__PURE__ */ s.jsxs("lineSegments", { position: x, children: [
1494
- /* @__PURE__ */ s.jsx("edgesGeometry", { args: [new $.BoxGeometry(...u)] }),
1495
- /* @__PURE__ */ s.jsx("lineBasicMaterial", { color: f })
2068
+ /* @__PURE__ */ r.jsxs("lineSegments", { position: g, children: [
2069
+ /* @__PURE__ */ r.jsx("edgesGeometry", { args: [new B.BoxGeometry(...h)] }),
2070
+ /* @__PURE__ */ r.jsx("lineBasicMaterial", { color: c })
1496
2071
  ] })
1497
2072
  ] });
1498
- }), St = {
2073
+ }), Mt = {
1499
2074
  [me.CARDBOARD]: "#b5926b",
1500
2075
  [me.WOOD]: "#c4a26e",
1501
2076
  [me.PLASTIC]: "#90a4ae"
1502
- }, Ct = V(function({
2077
+ }, zt = V(function({
1503
2078
  separator: e,
1504
2079
  position: t = { x: 0, y: 0, z: 0 }
1505
2080
  }) {
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]
2081
+ const i = U.MM_TO_M, s = e.dimensions, n = k(
2082
+ () => [s.width * i, s.height * i, s.depth * i],
2083
+ [s, i]
1509
2084
  ), 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
2085
+ () => new B.Vector3(
2086
+ t.x * i + n[0] / 2,
2087
+ t.y * i + n[1] / 2,
2088
+ t.z * i + n[2] / 2
1514
2089
  ),
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(
2090
+ [t, n, i]
2091
+ ), c = Mt[e.material];
2092
+ return /* @__PURE__ */ r.jsxs("mesh", { position: a, receiveShadow: !0, children: [
2093
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: n }),
2094
+ /* @__PURE__ */ r.jsx(
1520
2095
  "meshStandardMaterial",
1521
2096
  {
1522
- color: f,
2097
+ color: c,
1523
2098
  roughness: 0.9,
1524
2099
  metalness: 0,
1525
2100
  transparent: !0,
@@ -1532,107 +2107,107 @@ const bt = V(function({
1532
2107
  stackedPallet: e,
1533
2108
  position: t = { x: 0, y: 0, z: 0 },
1534
2109
  yRotation: i = 0,
1535
- palletId: n,
1536
- selectedBoxId: r,
2110
+ palletId: s,
2111
+ selectedBoxId: n,
1537
2112
  highlightedBoxId: a,
1538
- selectedColor: f,
1539
- highlightedColor: g,
1540
- showLabels: v = !1,
1541
- onBoxClick: u,
1542
- onBoxHover: x
2113
+ selectedColor: c,
2114
+ highlightedColor: l,
2115
+ showLabels: p = !1,
2116
+ onBoxClick: h,
2117
+ onBoxHover: g
1543
2118
  }) {
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),
2119
+ const w = k(
2120
+ () => qe(e, s),
2121
+ [e, s]
2122
+ ), m = U.MM_TO_M, x = k(() => i * Math.PI / 180, [i]), u = k(() => {
2123
+ const d = [];
2124
+ let b = 0;
2125
+ for (const j of w.floors) {
2126
+ d.push(b), b += j.pallet.dimensions.height;
2127
+ const _ = j.boxes.reduce(
2128
+ (S, C) => Math.max(S, C.position.y + C.box.dimensions.height),
1554
2129
  0
1555
2130
  );
1556
- j += z, T.separatorAbove && (j += T.separatorAbove.dimensions.height);
2131
+ b += _, j.separatorAbove && (b += j.separatorAbove.dimensions.height);
1557
2132
  }
1558
- return h;
1559
- }, [p]);
1560
- return /* @__PURE__ */ s.jsx(
2133
+ return d;
2134
+ }, [w]);
2135
+ return /* @__PURE__ */ r.jsx(
1561
2136
  "group",
1562
2137
  {
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(
2138
+ position: [t.x * m, t.y * m, t.z * m],
2139
+ rotation: [0, x, 0],
2140
+ children: w.floors.map((d, b) => {
2141
+ const j = u[b], _ = j + d.pallet.dimensions.height;
2142
+ return /* @__PURE__ */ r.jsxs("group", { children: [
2143
+ /* @__PURE__ */ r.jsx(
1569
2144
  jt,
1570
2145
  {
1571
- pallet: h.pallet,
1572
- position: { x: 0, y: T, z: 0 }
2146
+ pallet: d.pallet,
2147
+ position: { x: 0, y: j, z: 0 }
1573
2148
  }
1574
2149
  ),
1575
- h.boxes.map((b) => /* @__PURE__ */ s.jsx(
1576
- bt,
2150
+ d.boxes.map((S) => /* @__PURE__ */ r.jsx(
2151
+ St,
1577
2152
  {
1578
2153
  placedBox: {
1579
- ...b,
2154
+ ...S,
1580
2155
  position: {
1581
- x: b.position.x,
1582
- y: b.position.y + z,
1583
- z: b.position.z
2156
+ x: S.position.x,
2157
+ y: S.position.y + _,
2158
+ z: S.position.z
1584
2159
  }
1585
2160
  },
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
2161
+ selected: n === S.id,
2162
+ highlighted: a === S.id,
2163
+ selectedColor: c,
2164
+ highlightedColor: l,
2165
+ showLabel: p,
2166
+ onClick: h,
2167
+ onHover: g
1593
2168
  },
1594
- b.id
2169
+ S.id
1595
2170
  )),
1596
- h.separatorAbove && /* @__PURE__ */ s.jsx(
1597
- Ct,
2171
+ d.separatorAbove && /* @__PURE__ */ r.jsx(
2172
+ zt,
1598
2173
  {
1599
- separator: h.separatorAbove,
2174
+ separator: d.separatorAbove,
1600
2175
  position: {
1601
2176
  x: 0,
1602
- y: z + h.boxes.reduce(
1603
- (b, M) => Math.max(b, M.position.y + M.box.dimensions.height),
2177
+ y: _ + d.boxes.reduce(
2178
+ (S, C) => Math.max(S, C.position.y + C.box.dimensions.height),
1604
2179
  0
1605
2180
  ),
1606
2181
  z: 0
1607
2182
  }
1608
2183
  }
1609
2184
  )
1610
- ] }, `floor-${j}`);
2185
+ ] }, `floor-${b}`);
1611
2186
  })
1612
2187
  }
1613
2188
  );
1614
2189
  }
1615
- ), Lt = V(function({
2190
+ ), Ut = V(function({
1616
2191
  text: e,
1617
2192
  position: t,
1618
2193
  visible: i = !0,
1619
- fontSize: n = 12,
1620
- color: r = "white",
2194
+ fontSize: s = 12,
2195
+ color: n = "white",
1621
2196
  background: a = "rgba(0,0,0,0.75)"
1622
2197
  }) {
1623
2198
  if (!i) return null;
1624
- const f = Y.MM_TO_M;
1625
- return /* @__PURE__ */ s.jsx(
2199
+ const c = U.MM_TO_M;
2200
+ return /* @__PURE__ */ r.jsx(
1626
2201
  ke,
1627
2202
  {
1628
- position: [t.x * f, t.y * f, t.z * f],
2203
+ position: [t.x * c, t.y * c, t.z * c],
1629
2204
  center: !0,
1630
2205
  style: {
1631
2206
  background: a,
1632
- color: r,
2207
+ color: n,
1633
2208
  padding: "2px 8px",
1634
2209
  borderRadius: "4px",
1635
- fontSize: `${n}px`,
2210
+ fontSize: `${s}px`,
1636
2211
  whiteSpace: "nowrap",
1637
2212
  pointerEvents: "none",
1638
2213
  userSelect: "none"
@@ -1640,42 +2215,42 @@ const bt = V(function({
1640
2215
  children: e
1641
2216
  }
1642
2217
  );
1643
- }), Mt = V(
2218
+ }), Ct = V(
1644
2219
  function({
1645
2220
  room: e,
1646
2221
  floorColor: t,
1647
2222
  wallColor: i,
1648
- showGrid: n,
1649
- children: r
2223
+ showGrid: s,
2224
+ children: n
1650
2225
  }) {
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(() => {
2226
+ const a = ce(), c = t ?? a.warehouse.floorColor, l = i ?? a.warehouse.wallColor, p = s ?? a.warehouse.showGrid, h = U.MM_TO_M, g = e.ceilingHeight * h, { shape: w, minX: m, maxX: x, minZ: u, maxZ: d } = k(() => {
1652
2227
  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,
2228
+ let v = 1 / 0, M = -1 / 0, E = 1 / 0, T = -1 / 0;
2229
+ for (const R of y)
2230
+ v = Math.min(v, R.x * h), M = Math.max(M, R.x * h), E = Math.min(E, R.z * h), T = Math.max(T, R.z * h);
2231
+ const I = new B.Shape();
2232
+ I.moveTo(y[0].x * h, -y[0].z * h);
2233
+ for (let R = 1; R < y.length; R++)
2234
+ I.lineTo(y[R].x * h, -y[R].z * h);
2235
+ return I.closePath(), { shape: I, minX: v, maxX: M, minZ: E, maxZ: T };
2236
+ }, [e.floorPolygon, h]), b = k(() => {
2237
+ const y = e.floorPolygon, v = [], M = [];
2238
+ for (let T = 0; T < y.length; T++) {
2239
+ const I = y[T], R = y[(T + 1) % y.length], A = T * 4;
2240
+ v.push(
2241
+ I.x * h,
1667
2242
  0,
1668
- O.z * u,
1669
- P.x * u,
2243
+ I.z * h,
2244
+ R.x * h,
1670
2245
  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(
2246
+ R.z * h,
2247
+ R.x * h,
2248
+ g,
2249
+ R.z * h,
2250
+ I.x * h,
2251
+ g,
2252
+ I.z * h
2253
+ ), M.push(
1679
2254
  A,
1680
2255
  A + 1,
1681
2256
  A + 2,
@@ -1684,41 +2259,41 @@ const bt = V(function({
1684
2259
  A + 3
1685
2260
  );
1686
2261
  }
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(
2262
+ const E = new B.BufferGeometry();
2263
+ return E.setAttribute("position", new B.Float32BufferAttribute(v, 3)), E.setIndex(M), E.computeVertexNormals(), E;
2264
+ }, [e.floorPolygon, g, h]), j = x - m, _ = d - u, S = (m + x) / 2, C = (u + d) / 2, z = k(() => {
2265
+ if (!p) return null;
2266
+ const y = 0.5, v = 0.01, M = [];
2267
+ for (let T = m; T <= x; T += y)
2268
+ M.push(T, v, u, T, v, d);
2269
+ for (let T = u; T <= d; T += y)
2270
+ M.push(m, v, T, x, v, T);
2271
+ const E = new B.BufferGeometry();
2272
+ return E.setAttribute("position", new B.Float32BufferAttribute(M, 3)), E;
2273
+ }, [p, m, x, u, d]);
2274
+ return /* @__PURE__ */ r.jsxs("group", { children: [
2275
+ /* @__PURE__ */ r.jsxs("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -5e-3, 0], receiveShadow: !0, children: [
2276
+ /* @__PURE__ */ r.jsx("shapeGeometry", { args: [w] }),
2277
+ /* @__PURE__ */ r.jsx(
1703
2278
  "meshStandardMaterial",
1704
2279
  {
1705
- color: f,
1706
- side: $.DoubleSide,
2280
+ color: c,
2281
+ side: B.DoubleSide,
1707
2282
  roughness: a.warehouse.floorRoughness
1708
2283
  }
1709
2284
  )
1710
2285
  ] }),
1711
- /* @__PURE__ */ s.jsx("mesh", { geometry: j, position: [0, 0, 0], receiveShadow: !0, children: /* @__PURE__ */ s.jsx(
2286
+ /* @__PURE__ */ r.jsx("mesh", { geometry: b, position: [0, 0, 0], receiveShadow: !0, children: /* @__PURE__ */ r.jsx(
1712
2287
  "meshStandardMaterial",
1713
2288
  {
1714
- color: g,
1715
- side: $.DoubleSide,
2289
+ color: l,
2290
+ side: B.DoubleSide,
1716
2291
  roughness: 0.7,
1717
2292
  transparent: !0,
1718
2293
  opacity: a.warehouse.wallOpacity
1719
2294
  }
1720
2295
  ) }),
1721
- v && _ && /* @__PURE__ */ s.jsx("lineSegments", { geometry: _, children: /* @__PURE__ */ s.jsx(
2296
+ p && z && /* @__PURE__ */ r.jsx("lineSegments", { geometry: z, children: /* @__PURE__ */ r.jsx(
1722
2297
  "lineBasicMaterial",
1723
2298
  {
1724
2299
  color: a.warehouse.gridColor,
@@ -1727,144 +2302,144 @@ const bt = V(function({
1727
2302
  depthWrite: !1
1728
2303
  }
1729
2304
  ) }),
1730
- /* @__PURE__ */ s.jsx("ambientLight", { intensity: a.warehouse.ambientIntensity }),
1731
- /* @__PURE__ */ s.jsx(
2305
+ /* @__PURE__ */ r.jsx("ambientLight", { intensity: a.warehouse.ambientIntensity }),
2306
+ /* @__PURE__ */ r.jsx(
1732
2307
  "directionalLight",
1733
2308
  {
1734
- position: [b + T, x * 0.8, M + z],
2309
+ position: [S + j, g * 0.8, C + _],
1735
2310
  intensity: a.warehouse.directionalIntensity,
1736
2311
  castShadow: !0,
1737
2312
  "shadow-mapSize-width": 1024,
1738
2313
  "shadow-mapSize-height": 1024
1739
2314
  }
1740
2315
  ),
1741
- /* @__PURE__ */ s.jsx(
2316
+ /* @__PURE__ */ r.jsx(
1742
2317
  "pointLight",
1743
2318
  {
1744
- position: [b, x * 0.9, M],
2319
+ position: [S, g * 0.9, C],
1745
2320
  intensity: 0.5,
1746
- distance: Math.max(T, z) * 2
2321
+ distance: Math.max(j, _) * 2
1747
2322
  }
1748
2323
  ),
1749
- r
2324
+ n
1750
2325
  ] });
1751
2326
  }
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 })
2327
+ ), K = V(function({ position: e, radius: t, width: i, color: s }) {
2328
+ return /* @__PURE__ */ r.jsxs("group", { position: e, children: [
2329
+ /* @__PURE__ */ r.jsxs("mesh", { rotation: [0, 0, Math.PI / 2], castShadow: !0, children: [
2330
+ /* @__PURE__ */ r.jsx("cylinderGeometry", { args: [t, t, i, 24] }),
2331
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: s, roughness: 0.9, metalness: 0.1 })
1757
2332
  ] }),
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 })
2333
+ /* @__PURE__ */ r.jsxs("mesh", { rotation: [0, 0, Math.PI / 2], children: [
2334
+ /* @__PURE__ */ r.jsx("cylinderGeometry", { args: [t * 0.55, t * 0.55, i + 5e-3, 16] }),
2335
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#888888", roughness: 0.3, metalness: 0.7 })
1761
2336
  ] })
1762
2337
  ] });
1763
2338
  }), Pt = V(function({
1764
2339
  truck: e,
1765
2340
  showGrid: t,
1766
2341
  wallOpacity: i = 0.3,
1767
- showRoof: n = !1,
1768
- showSideWalls: r = !0,
2342
+ showRoof: s = !1,
2343
+ showSideWalls: n = !0,
1769
2344
  children: a
1770
2345
  }) {
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(
2346
+ const l = ce().truck, p = t ?? l.showGrid, h = U.MM_TO_M, g = e.dimensions.width * h, w = e.dimensions.height * h, m = e.dimensions.depth * h, x = 0.05, u = 0.08, d = 0.28, b = 0.18, j = 0.15, _ = 0.25, S = d + j, C = S + d + 0.1, z = C + _ / 2 + u / 2, y = g + x * 2, v = g * 0.65, M = w * 0.85, E = 0.15, T = m + x + E, I = z, R = k(() => {
2347
+ if (!p) return null;
2348
+ const G = 0.5, D = z + 2e-3, H = [];
2349
+ for (let X = 0; X <= g; X += G)
2350
+ H.push(X, D, 0, X, D, m);
2351
+ for (let X = 0; X <= m; X += G)
2352
+ H.push(0, D, X, g, D, X);
2353
+ const F = new B.BufferGeometry();
2354
+ return F.setAttribute("position", new B.Float32BufferAttribute(H, 3)), F;
2355
+ }, [p, g, m, z]), A = k(
2356
+ () => /* @__PURE__ */ r.jsx(
1782
2357
  "meshStandardMaterial",
1783
2358
  {
1784
- color: g.wallColor,
2359
+ color: l.wallColor,
1785
2360
  roughness: 0.5,
1786
2361
  metalness: 0.3,
1787
2362
  transparent: i < 1,
1788
2363
  opacity: i,
1789
- side: $.DoubleSide,
2364
+ side: B.DoubleSide,
1790
2365
  depthWrite: i >= 0.95
1791
2366
  }
1792
2367
  ),
1793
- [g.wallColor, i]
2368
+ [l.wallColor, i]
1794
2369
  );
1795
- return /* @__PURE__ */ s.jsxs("group", { children: [
1796
- /* @__PURE__ */ s.jsxs(
2370
+ return /* @__PURE__ */ r.jsxs("group", { children: [
2371
+ /* @__PURE__ */ r.jsxs(
1797
2372
  "mesh",
1798
2373
  {
1799
- position: [x / 2, _, c / 2],
2374
+ position: [g / 2, z, m / 2],
1800
2375
  rotation: [-Math.PI / 2, 0, 0],
1801
2376
  receiveShadow: !0,
1802
2377
  children: [
1803
- /* @__PURE__ */ s.jsx("planeGeometry", { args: [x, c] }),
1804
- /* @__PURE__ */ s.jsx("meshStandardMaterial", { color: g.floorColor, roughness: 0.85 })
2378
+ /* @__PURE__ */ r.jsx("planeGeometry", { args: [g, m] }),
2379
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.floorColor, roughness: 0.85 })
1805
2380
  ]
1806
2381
  }
1807
2382
  ),
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 })
2383
+ /* @__PURE__ */ r.jsxs("mesh", { position: [g / 2, z - u / 2, m / 2], castShadow: !0, receiveShadow: !0, children: [
2384
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [g + x * 2, u, m + x] }),
2385
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.floorColor, roughness: 0.85, metalness: 0.1 })
1811
2386
  ] }),
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] }),
2387
+ n && /* @__PURE__ */ r.jsxs("mesh", { position: [-x / 2, z + w / 2, m / 2], castShadow: !0, children: [
2388
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [x, w, m + x] }),
1814
2389
  A
1815
2390
  ] }),
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] }),
2391
+ n && /* @__PURE__ */ r.jsxs("mesh", { position: [g + x / 2, z + w / 2, m / 2], castShadow: !0, children: [
2392
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [x, w, m + x] }),
1818
2393
  A
1819
2394
  ] }),
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] }),
2395
+ /* @__PURE__ */ r.jsxs("mesh", { position: [g / 2, z + w / 2, m + x / 2], castShadow: !0, children: [
2396
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [g + x * 2, w, x] }),
1822
2397
  A
1823
2398
  ] }),
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] }),
2399
+ s && /* @__PURE__ */ r.jsxs("mesh", { position: [g / 2, z + w, m / 2], castShadow: !0, children: [
2400
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [g + x * 2, x, m + x] }),
1826
2401
  A
1827
2402
  ] }),
1828
- v && P && /* @__PURE__ */ s.jsx("lineSegments", { geometry: P, children: /* @__PURE__ */ s.jsx(
2403
+ p && R && /* @__PURE__ */ r.jsx("lineSegments", { geometry: R, children: /* @__PURE__ */ r.jsx(
1829
2404
  "lineBasicMaterial",
1830
2405
  {
1831
- color: g.gridColor,
2406
+ color: l.gridColor,
1832
2407
  opacity: 0.5,
1833
2408
  transparent: !0,
1834
2409
  depthWrite: !1
1835
2410
  }
1836
2411
  ) }),
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 })
2412
+ /* @__PURE__ */ r.jsxs("mesh", { position: [g * 0.25, C, (m + v + E) / 2], castShadow: !0, children: [
2413
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12, _, m + v + E] }),
2414
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.7, metalness: 0.5 })
1840
2415
  ] }),
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 })
2416
+ /* @__PURE__ */ r.jsxs("mesh", { position: [g * 0.75, C, (m + v + E) / 2], castShadow: !0, children: [
2417
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [0.12, _, m + v + E] }),
2418
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.7, metalness: 0.5 })
1844
2419
  ] }),
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 })
2420
+ [0.15, 0.35, 0.55, 0.75, 0.95].map((G) => /* @__PURE__ */ r.jsxs("mesh", { position: [g / 2, C, m * G], castShadow: !0, children: [
2421
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [g * 0.6, 0.06, 0.06] }),
2422
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.7, metalness: 0.5 })
1848
2423
  ] }, 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 })
2424
+ /* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S, m * 0.12], radius: d, width: b, color: l.wheelColor }),
2425
+ /* @__PURE__ */ r.jsx(K, { position: [g + b / 2 + x, S, m * 0.12], radius: d, width: b, color: l.wheelColor }),
2426
+ /* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S, m * 0.22], radius: d, width: b, color: l.wheelColor }),
2427
+ /* @__PURE__ */ r.jsx(K, { position: [g + b / 2 + x, S, m * 0.22], radius: d, width: b, color: l.wheelColor }),
2428
+ /* @__PURE__ */ r.jsx(K, { position: [-b / 2 - x, S, T + v * 0.5], radius: d, width: b, color: l.wheelColor }),
2429
+ /* @__PURE__ */ r.jsx(K, { position: [g + b / 2 + x, S, T + v * 0.5], radius: d, width: b, color: l.wheelColor }),
2430
+ /* @__PURE__ */ r.jsxs("group", { position: [g / 2, I, T], children: [
2431
+ /* @__PURE__ */ r.jsxs("mesh", { position: [0, M / 2, v / 2], castShadow: !0, receiveShadow: !0, children: [
2432
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [y, M, v] }),
2433
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.cabColor, roughness: 0.4, metalness: 0.3 })
1859
2434
  ] }),
1860
- /* @__PURE__ */ s.jsxs(
2435
+ /* @__PURE__ */ r.jsxs(
1861
2436
  "mesh",
1862
2437
  {
1863
- position: [0, S * 0.6, w + 0.01],
2438
+ position: [0, M * 0.6, v + 0.01],
1864
2439
  castShadow: !0,
1865
2440
  children: [
1866
- /* @__PURE__ */ s.jsx("planeGeometry", { args: [y * 0.75, S * 0.4] }),
1867
- /* @__PURE__ */ s.jsx(
2441
+ /* @__PURE__ */ r.jsx("planeGeometry", { args: [y * 0.75, M * 0.4] }),
2442
+ /* @__PURE__ */ r.jsx(
1868
2443
  "meshStandardMaterial",
1869
2444
  {
1870
2445
  color: "#88bbdd",
@@ -1872,15 +2447,15 @@ const bt = V(function({
1872
2447
  opacity: 0.5,
1873
2448
  roughness: 0.1,
1874
2449
  metalness: 0.6,
1875
- side: $.DoubleSide
2450
+ side: B.DoubleSide
1876
2451
  }
1877
2452
  )
1878
2453
  ]
1879
2454
  }
1880
2455
  ),
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(
2456
+ /* @__PURE__ */ r.jsxs("mesh", { position: [-y / 2 - 0.01, M * 0.6, v * 0.55], rotation: [0, Math.PI / 2, 0], children: [
2457
+ /* @__PURE__ */ r.jsx("planeGeometry", { args: [v * 0.5, M * 0.3] }),
2458
+ /* @__PURE__ */ r.jsx(
1884
2459
  "meshStandardMaterial",
1885
2460
  {
1886
2461
  color: "#88bbdd",
@@ -1888,13 +2463,13 @@ const bt = V(function({
1888
2463
  opacity: 0.4,
1889
2464
  roughness: 0.1,
1890
2465
  metalness: 0.6,
1891
- side: $.DoubleSide
2466
+ side: B.DoubleSide
1892
2467
  }
1893
2468
  )
1894
2469
  ] }),
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(
2470
+ /* @__PURE__ */ r.jsxs("mesh", { position: [y / 2 + 0.01, M * 0.6, v * 0.55], rotation: [0, -Math.PI / 2, 0], children: [
2471
+ /* @__PURE__ */ r.jsx("planeGeometry", { args: [v * 0.5, M * 0.3] }),
2472
+ /* @__PURE__ */ r.jsx(
1898
2473
  "meshStandardMaterial",
1899
2474
  {
1900
2475
  color: "#88bbdd",
@@ -1902,69 +2477,69 @@ const bt = V(function({
1902
2477
  opacity: 0.4,
1903
2478
  roughness: 0.1,
1904
2479
  metalness: 0.6,
1905
- side: $.DoubleSide
2480
+ side: B.DoubleSide
1906
2481
  }
1907
2482
  )
1908
2483
  ] }),
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 })
2484
+ /* @__PURE__ */ r.jsxs("mesh", { position: [0, M + 0.04, v / 2], children: [
2485
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.95, 0.08, v * 0.9] }),
2486
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.cabColor, roughness: 0.4, metalness: 0.3 })
1912
2487
  ] }),
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 })
2488
+ /* @__PURE__ */ r.jsxs("mesh", { position: [0, M + 0.25, v * 0.1], rotation: [-0.3, 0, 0], children: [
2489
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.9, 0.04, v * 0.5] }),
2490
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.cabColor, roughness: 0.4, metalness: 0.3 })
1916
2491
  ] }),
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 })
2492
+ /* @__PURE__ */ r.jsxs("mesh", { position: [-y * 0.35, M * 0.2, v + 0.02], children: [
2493
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.15, 0.08, 0.02] }),
2494
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#ffffcc", emissive: "#ffffaa", emissiveIntensity: 0.3 })
1920
2495
  ] }),
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 })
2496
+ /* @__PURE__ */ r.jsxs("mesh", { position: [y * 0.35, M * 0.2, v + 0.02], children: [
2497
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 0.15, 0.08, 0.02] }),
2498
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#ffffcc", emissive: "#ffffaa", emissiveIntensity: 0.3 })
1924
2499
  ] }),
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 })
2500
+ /* @__PURE__ */ r.jsxs("mesh", { position: [0, 0.06, v + 0.04], castShadow: !0, children: [
2501
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [y * 1.02, 0.12, 0.06] }),
2502
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.5, metalness: 0.6 })
1928
2503
  ] })
1929
2504
  ] }),
1930
- [-1, 1].map((G) => /* @__PURE__ */ s.jsxs(
2505
+ [-1, 1].map((G) => /* @__PURE__ */ r.jsxs(
1931
2506
  "mesh",
1932
2507
  {
1933
2508
  position: [
1934
- G === -1 ? -l - j * 0.5 : x + l + j * 0.5,
1935
- b + h * 0.6,
1936
- c * 0.17
2509
+ G === -1 ? -x - b * 0.5 : g + x + b * 0.5,
2510
+ S + d * 0.6,
2511
+ m * 0.17
1937
2512
  ],
1938
2513
  castShadow: !0,
1939
2514
  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 })
2515
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [b + 0.04, 0.04, d * 2.5] }),
2516
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: l.chassisColor, roughness: 0.6, metalness: 0.4 })
1942
2517
  ]
1943
2518
  },
1944
2519
  `fender-rear-${G}`
1945
2520
  )),
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 })
2521
+ /* @__PURE__ */ r.jsxs("mesh", { position: [-x / 2 + 0.01, z + w * 0.3, -0.01], children: [
2522
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [0.08, 0.12, 0.02] }),
2523
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#ff3333", emissive: "#ff0000", emissiveIntensity: 0.3 })
1949
2524
  ] }),
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 })
2525
+ /* @__PURE__ */ r.jsxs("mesh", { position: [g + x / 2 - 0.01, z + w * 0.3, -0.01], children: [
2526
+ /* @__PURE__ */ r.jsx("boxGeometry", { args: [0.08, 0.12, 0.02] }),
2527
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#ff3333", emissive: "#ff0000", emissiveIntensity: 0.3 })
1953
2528
  ] }),
1954
- /* @__PURE__ */ s.jsx("ambientLight", { intensity: 0.45 }),
1955
- /* @__PURE__ */ s.jsx(
2529
+ /* @__PURE__ */ r.jsx("ambientLight", { intensity: 0.45 }),
2530
+ /* @__PURE__ */ r.jsx(
1956
2531
  "directionalLight",
1957
2532
  {
1958
- position: [x / 2, _ + p * 1.5, c * 0.8],
2533
+ position: [g / 2, z + w * 1.5, m * 0.8],
1959
2534
  intensity: 0.75,
1960
2535
  castShadow: !0,
1961
2536
  "shadow-mapSize-width": 1024,
1962
2537
  "shadow-mapSize-height": 1024
1963
2538
  }
1964
2539
  ),
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 })
2540
+ /* @__PURE__ */ r.jsx("pointLight", { position: [g / 2, z + w * 0.7, m / 2], intensity: 0.35 }),
2541
+ /* @__PURE__ */ r.jsx("pointLight", { position: [g / 2, z + w * 0.9, m * 0.3], intensity: 0.25 }),
2542
+ /* @__PURE__ */ r.jsx("group", { position: [0, z, 0], children: a })
1968
2543
  ] });
1969
2544
  });
1970
2545
  function Rt(o, e, t) {
@@ -1976,57 +2551,57 @@ function Rt(o, e, t) {
1976
2551
  front: [0, 1.5, 5],
1977
2552
  side: [5, 1.5, 0]
1978
2553
  }[o];
1979
- const { width: i, height: n, depth: r } = t, [a, f, g] = e, u = Math.sqrt(i ** 2 + n ** 2 + r ** 2) * 3;
2554
+ const { width: i, height: s, depth: n } = t, [a, c, l] = e, h = Math.sqrt(i ** 2 + s ** 2 + n ** 2) * 3;
1980
2555
  switch (o) {
1981
2556
  case "perspective":
1982
2557
  return [
1983
- a + u * 0.6,
1984
- f + u * 0.5,
1985
- g + u * 0.6
2558
+ a + h * 0.6,
2559
+ c + h * 0.5,
2560
+ l + h * 0.6
1986
2561
  ];
1987
2562
  case "isometric":
1988
2563
  return [
1989
- a + u * 0.577,
1990
- f + u * 0.577,
1991
- g + u * 0.577
2564
+ a + h * 0.577,
2565
+ c + h * 0.577,
2566
+ l + h * 0.577
1992
2567
  ];
1993
2568
  case "top":
1994
- return [a, f + Math.max(u, n * 2), g];
2569
+ return [a, c + Math.max(h, s * 2), l];
1995
2570
  case "front":
1996
- return [a, f + n * 0.5, g + Math.max(u, r * 1.5)];
2571
+ return [a, c + s * 0.5, l + Math.max(h, n * 1.5)];
1997
2572
  case "side":
1998
- return [a + Math.max(u, i * 1.5), f + n * 0.5, g];
2573
+ return [a + Math.max(h, i * 1.5), c + s * 0.5, l];
1999
2574
  }
2000
2575
  }
2001
- const je = V(function({
2576
+ const Se = V(function({
2002
2577
  preset: e = "perspective",
2003
2578
  autoRotate: t = !1,
2004
2579
  enablePan: i = !0,
2005
- enableZoom: n = !0,
2006
- target: r = [0, 0, 0],
2580
+ enableZoom: s = !0,
2581
+ target: n = [0, 0, 0],
2007
2582
  minDistance: a = 0.5,
2008
- maxDistance: f = 50,
2009
- sceneSize: g
2583
+ maxDistance: c = 50,
2584
+ sceneSize: l
2010
2585
  }) {
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);
2586
+ const { camera: p } = Ae(), h = Ee(null);
2587
+ return pe(() => {
2588
+ const g = Rt(e, n, l), w = new B.Vector3(g[0], g[1], g[2]), m = new B.Vector3(...n), x = p.position.clone(), u = 1e3, d = Date.now(), b = () => {
2589
+ const j = Date.now() - d, _ = Math.min(j / u, 1), S = 1 - Math.pow(1 - _, 3);
2590
+ p.position.lerpVectors(x, w, S), h.current && (h.current.target.lerp(m, S), h.current.update()), _ < 1 && requestAnimationFrame(b);
2016
2591
  };
2017
- j();
2018
- }, [e, g, v, r]), /* @__PURE__ */ s.jsx(
2592
+ b();
2593
+ }, [e, l, p, n]), /* @__PURE__ */ r.jsx(
2019
2594
  Xe,
2020
2595
  {
2021
- ref: u,
2022
- target: r,
2596
+ ref: h,
2597
+ target: n,
2023
2598
  autoRotate: t,
2024
2599
  autoRotateSpeed: 0.5,
2025
2600
  enablePan: i,
2026
- enableZoom: n,
2601
+ enableZoom: s,
2027
2602
  enableRotate: !0,
2028
2603
  minDistance: a,
2029
- maxDistance: f,
2604
+ maxDistance: c,
2030
2605
  enableDamping: !0,
2031
2606
  dampingFactor: 0.05,
2032
2607
  rotateSpeed: 0.5,
@@ -2035,7 +2610,7 @@ const je = V(function({
2035
2610
  makeDefault: !0
2036
2611
  }
2037
2612
  );
2038
- }), _t = {
2613
+ }), Tt = {
2039
2614
  perspective: { label: "Perspectiva", icon: "📐" },
2040
2615
  isometric: { label: "Isométrica", icon: "🔲" },
2041
2616
  top: { label: "Superior", icon: "⬇️" },
@@ -2047,56 +2622,56 @@ V(function({
2047
2622
  onPresetChange: t,
2048
2623
  position: i = "top-right"
2049
2624
  }) {
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(
2625
+ const s = ["perspective", "isometric", "top", "front", "side"];
2626
+ return /* @__PURE__ */ r.jsxs("div", { className: `view-controls view-controls--${i}`, children: [
2627
+ /* @__PURE__ */ r.jsx("div", { className: "view-controls__title", children: "Vista" }),
2628
+ /* @__PURE__ */ r.jsx("div", { className: "view-controls__buttons", children: s.map((n) => {
2629
+ const { label: a, icon: c } = Tt[n], l = e === n;
2630
+ return /* @__PURE__ */ r.jsxs(
2056
2631
  "button",
2057
2632
  {
2058
- className: `view-controls__button ${g ? "view-controls__button--active" : ""}`,
2059
- onClick: () => t(r),
2633
+ className: `view-controls__button ${l ? "view-controls__button--active" : ""}`,
2634
+ onClick: () => t(n),
2060
2635
  title: a,
2061
2636
  "aria-label": a,
2062
2637
  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 })
2638
+ /* @__PURE__ */ r.jsx("span", { className: "view-controls__icon", role: "img", "aria-hidden": "true", children: c }),
2639
+ /* @__PURE__ */ r.jsx("span", { className: "view-controls__label", children: a })
2065
2640
  ]
2066
2641
  },
2067
- r
2642
+ n
2068
2643
  );
2069
2644
  }) })
2070
2645
  ] });
2071
2646
  });
2072
- const Se = V(function({
2647
+ const je = V(function({
2073
2648
  sceneWidth: e,
2074
2649
  sceneDepth: t,
2075
2650
  sceneType: i,
2076
- floorPolygon: n,
2077
- cameraPosition: r,
2651
+ floorPolygon: s,
2652
+ cameraPosition: n,
2078
2653
  targetPosition: a,
2079
- position: f = "bottom-left"
2654
+ position: c = "bottom-left"
2080
2655
  }) {
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(() => {
2656
+ const h = k(() => 130 / Math.max(e, t), [e, t]), g = (d, b) => ({
2657
+ x: 10 + d * h,
2658
+ y: 10 + b * h
2659
+ }), w = k(() => i !== "warehouse" || !s || s.length === 0 ? "" : `M ${s.map((b) => {
2660
+ const j = g(b.x, b.z);
2661
+ return `${j.x},${j.y}`;
2662
+ }).join(" L ")} Z`, [i, s, h]), m = k(() => {
2088
2663
  if (i !== "truck") return null;
2089
- const h = x(0, 0);
2664
+ const d = g(0, 0);
2090
2665
  return {
2091
- x: h.x,
2092
- y: h.y,
2093
- width: e * u,
2094
- height: t * u
2666
+ x: d.x,
2667
+ y: d.y,
2668
+ width: e * h,
2669
+ height: t * h
2095
2670
  };
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(
2671
+ }, [i, e, t, h]), x = n ? g(n.x, n.z) : null, u = a ? g(a.x, a.z) : null;
2672
+ return /* @__PURE__ */ r.jsxs("div", { className: `minimap minimap--${c}`, children: [
2673
+ /* @__PURE__ */ r.jsx("div", { className: "minimap__title", children: "Mapa" }),
2674
+ /* @__PURE__ */ r.jsxs(
2100
2675
  "svg",
2101
2676
  {
2102
2677
  className: "minimap__canvas",
@@ -2105,31 +2680,31 @@ const Se = V(function({
2105
2680
  viewBox: "0 0 150 150",
2106
2681
  xmlns: "http://www.w3.org/2000/svg",
2107
2682
  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(
2683
+ /* @__PURE__ */ r.jsx("rect", { width: 150, height: 150, fill: "#1a1a2e" }),
2684
+ i === "warehouse" && w && /* @__PURE__ */ r.jsx("path", { d: w, fill: "rgba(96, 165, 250, 0.15)", stroke: "#60a5fa", strokeWidth: "2" }),
2685
+ i === "truck" && m && /* @__PURE__ */ r.jsx(
2111
2686
  "rect",
2112
2687
  {
2113
- x: c.x,
2114
- y: c.y,
2115
- width: c.width,
2116
- height: c.height,
2688
+ x: m.x,
2689
+ y: m.y,
2690
+ width: m.width,
2691
+ height: m.height,
2117
2692
  fill: "rgba(96, 165, 250, 0.15)",
2118
2693
  stroke: "#60a5fa",
2119
2694
  strokeWidth: "2"
2120
2695
  }
2121
2696
  ),
2122
- /* @__PURE__ */ s.jsx("defs", { children: /* @__PURE__ */ s.jsx(
2697
+ /* @__PURE__ */ r.jsx("defs", { children: /* @__PURE__ */ r.jsx(
2123
2698
  "pattern",
2124
2699
  {
2125
2700
  id: "minimap-grid",
2126
- width: u,
2127
- height: u,
2701
+ width: h,
2702
+ height: h,
2128
2703
  patternUnits: "userSpaceOnUse",
2129
- children: /* @__PURE__ */ s.jsx(
2704
+ children: /* @__PURE__ */ r.jsx(
2130
2705
  "path",
2131
2706
  {
2132
- d: `M ${u} 0 L 0 0 0 ${u}`,
2707
+ d: `M ${h} 0 L 0 0 0 ${h}`,
2133
2708
  fill: "none",
2134
2709
  stroke: "rgba(255, 255, 255, 0.08)",
2135
2710
  strokeWidth: "0.5"
@@ -2137,29 +2712,29 @@ const Se = V(function({
2137
2712
  )
2138
2713
  }
2139
2714
  ) }),
2140
- i === "truck" && c && /* @__PURE__ */ s.jsx(
2715
+ i === "truck" && m && /* @__PURE__ */ r.jsx(
2141
2716
  "rect",
2142
2717
  {
2143
- x: c.x,
2144
- y: c.y,
2145
- width: c.width,
2146
- height: c.height,
2718
+ x: m.x,
2719
+ y: m.y,
2720
+ width: m.width,
2721
+ height: m.height,
2147
2722
  fill: "url(#minimap-grid)"
2148
2723
  }
2149
2724
  ),
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" })
2725
+ u && /* @__PURE__ */ r.jsxs("g", { children: [
2726
+ /* @__PURE__ */ r.jsx("circle", { cx: u.x, cy: u.y, r: "3", fill: "#f87171", opacity: "0.6" }),
2727
+ /* @__PURE__ */ r.jsx("circle", { cx: u.x, cy: u.y, r: "5", fill: "none", stroke: "#f87171", strokeWidth: "1.5" })
2153
2728
  ] }),
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(
2729
+ x && /* @__PURE__ */ r.jsxs("g", { children: [
2730
+ /* @__PURE__ */ r.jsx("circle", { cx: x.x, cy: x.y, r: "4", fill: "#60a5fa" }),
2731
+ u && /* @__PURE__ */ r.jsx(
2157
2732
  "line",
2158
2733
  {
2159
- x1: l.x,
2160
- y1: l.y,
2161
- x2: d.x,
2162
- y2: d.y,
2734
+ x1: x.x,
2735
+ y1: x.y,
2736
+ x2: u.x,
2737
+ y2: u.y,
2163
2738
  stroke: "#60a5fa",
2164
2739
  strokeWidth: "1",
2165
2740
  strokeDasharray: "2,2",
@@ -2170,103 +2745,103 @@ const Se = V(function({
2170
2745
  ]
2171
2746
  }
2172
2747
  ),
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" })
2748
+ /* @__PURE__ */ r.jsxs("div", { className: "minimap__legend", children: [
2749
+ /* @__PURE__ */ r.jsxs("div", { className: "minimap__legend-item", children: [
2750
+ /* @__PURE__ */ r.jsx("span", { className: "minimap__legend-dot minimap__legend-dot--camera" }),
2751
+ /* @__PURE__ */ r.jsx("span", { className: "minimap__legend-text", children: "Cámara" })
2177
2752
  ] }),
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" })
2753
+ /* @__PURE__ */ r.jsxs("div", { className: "minimap__legend-item", children: [
2754
+ /* @__PURE__ */ r.jsx("span", { className: "minimap__legend-dot minimap__legend-dot--target" }),
2755
+ /* @__PURE__ */ r.jsx("span", { className: "minimap__legend-text", children: "Objetivo" })
2181
2756
  ] })
2182
2757
  ] })
2183
2758
  ] });
2184
2759
  });
2185
- function Tt() {
2760
+ function _t() {
2186
2761
  const { camera: o } = Ae(), [e, t] = ae({
2187
2762
  x: o.position.x,
2188
2763
  y: o.position.y,
2189
2764
  z: o.position.z
2190
2765
  });
2191
- return fe(() => {
2766
+ return pe(() => {
2192
2767
  let i;
2193
- const n = () => {
2768
+ const s = () => {
2194
2769
  t({
2195
2770
  x: o.position.x,
2196
2771
  y: o.position.y,
2197
2772
  z: o.position.z
2198
- }), i = requestAnimationFrame(n);
2773
+ }), i = requestAnimationFrame(s);
2199
2774
  };
2200
- return i = requestAnimationFrame(n), () => {
2775
+ return i = requestAnimationFrame(s), () => {
2201
2776
  i && cancelAnimationFrame(i);
2202
2777
  };
2203
2778
  }, [o]), e;
2204
2779
  }
2205
- function Ce({ onPositionChange: o }) {
2206
- const e = Tt();
2207
- return fe(() => {
2780
+ function Me({ onPositionChange: o }) {
2781
+ const e = _t();
2782
+ return pe(() => {
2208
2783
  o(e);
2209
2784
  }, [e, o]), null;
2210
2785
  }
2211
- const Yt = V(function({
2786
+ const Ht = V(function({
2212
2787
  stackedPallet: e,
2213
2788
  preset: t,
2214
2789
  selectedBoxId: i,
2215
- highlightedBoxId: n,
2216
- selectedColor: r,
2790
+ highlightedBoxId: s,
2791
+ selectedColor: n,
2217
2792
  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
2793
+ showLabels: c = !1,
2794
+ cameraPreset: l = "perspective",
2795
+ showGrid: p = !0,
2796
+ showMiniMap: h = !1,
2797
+ onBoxClick: g,
2798
+ onBoxHover: w,
2799
+ children: m,
2800
+ style: x
2226
2801
  }) {
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
2802
+ const u = U.MM_TO_M, d = e.floors[0]?.pallet, [b, j] = ae({ x: 0, z: 0 }), _ = q((v) => {
2803
+ j({ x: v.x, z: v.z });
2804
+ }, []), S = k(() => d ? {
2805
+ width: d.dimensions.width * u,
2806
+ height: le(e) * u,
2807
+ depth: d.dimensions.depth * u
2808
+ } : { width: 1.2, height: 1, depth: 0.8 }, [d, e, u]), C = k(() => {
2809
+ const v = d ? d.dimensions.width * u / 2 : 0, M = d ? d.dimensions.depth * u / 2 : 0, E = S.height / 2;
2810
+ return [v, E, M];
2811
+ }, [d, u, S.height]), z = k(() => {
2812
+ const M = Math.sqrt(
2813
+ S.width ** 2 + S.height ** 2 + S.depth ** 2
2239
2814
  ) * 3.5;
2240
2815
  return [
2241
- M[0] + S * 0.7,
2242
- M[1] + S * 0.6,
2243
- M[2] + S * 0.7
2816
+ C[0] + M * 0.7,
2817
+ C[1] + M * 0.6,
2818
+ C[2] + M * 0.7
2244
2819
  ];
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,
2820
+ }, [C, S]), y = k(() => {
2821
+ if (!p || !d) return null;
2822
+ const v = d.dimensions.width * u, M = d.dimensions.depth * u, E = 0.2, T = 1e-3, I = [];
2823
+ for (let A = 0; A <= v; A += E)
2824
+ I.push(A, T, 0, A, T, M);
2825
+ for (let A = 0; A <= M; A += E)
2826
+ I.push(0, T, A, v, T, A);
2827
+ const R = new B.BufferGeometry();
2828
+ return R.setAttribute("position", new B.Float32BufferAttribute(I, 3)), R;
2829
+ }, [p, d, u]);
2830
+ return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
2831
+ /* @__PURE__ */ r.jsx(
2832
+ fe,
2258
2833
  {
2259
2834
  shadows: !0,
2260
2835
  camera: {
2261
- position: _,
2836
+ position: z,
2262
2837
  fov: 45,
2263
2838
  near: 0.01,
2264
2839
  far: 100
2265
2840
  },
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(
2841
+ style: { width: "100%", height: "100%", ...x },
2842
+ children: /* @__PURE__ */ r.jsxs(we, { preset: t, children: [
2843
+ /* @__PURE__ */ r.jsx("ambientLight", { intensity: 0.4 }),
2844
+ /* @__PURE__ */ r.jsx(
2270
2845
  "directionalLight",
2271
2846
  {
2272
2847
  position: [5, 8, 5],
@@ -2276,26 +2851,26 @@ const Yt = V(function({
2276
2851
  "shadow-mapSize-height": 1024
2277
2852
  }
2278
2853
  ),
2279
- /* @__PURE__ */ s.jsx("hemisphereLight", { intensity: 0.3, color: "#ffffff", groundColor: "#444444" }),
2280
- /* @__PURE__ */ s.jsx(
2281
- je,
2854
+ /* @__PURE__ */ r.jsx("hemisphereLight", { intensity: 0.3, color: "#ffffff", groundColor: "#444444" }),
2855
+ /* @__PURE__ */ r.jsx(
2856
+ Se,
2282
2857
  {
2283
- preset: g,
2284
- target: M,
2285
- sceneSize: b,
2858
+ preset: l,
2859
+ target: C,
2860
+ sceneSize: S,
2286
2861
  minDistance: 0.3,
2287
- maxDistance: Math.max(b.width, b.height, b.depth) * 4
2862
+ maxDistance: Math.max(S.width, S.height, S.depth) * 4
2288
2863
  }
2289
2864
  ),
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
2865
+ /* @__PURE__ */ r.jsx(Me, { onPositionChange: _ }),
2866
+ /* @__PURE__ */ r.jsxs("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [C[0], -2e-3, C[2]], receiveShadow: !0, children: [
2867
+ /* @__PURE__ */ r.jsx("planeGeometry", { args: [
2868
+ d ? d.dimensions.width * u * 1.5 : 3,
2869
+ d ? d.dimensions.depth * u * 1.5 : 3
2295
2870
  ] }),
2296
- /* @__PURE__ */ s.jsx("meshStandardMaterial", { color: "#e0e0e0", roughness: 0.9 })
2871
+ /* @__PURE__ */ r.jsx("meshStandardMaterial", { color: "#e0e0e0", roughness: 0.9 })
2297
2872
  ] }),
2298
- v && y && /* @__PURE__ */ s.jsx("lineSegments", { geometry: y, children: /* @__PURE__ */ s.jsx(
2873
+ p && y && /* @__PURE__ */ r.jsx("lineSegments", { geometry: y, children: /* @__PURE__ */ r.jsx(
2299
2874
  "lineBasicMaterial",
2300
2875
  {
2301
2876
  color: "#aaaaaa",
@@ -2304,135 +2879,135 @@ const Yt = V(function({
2304
2879
  depthWrite: !1
2305
2880
  }
2306
2881
  ) }),
2307
- /* @__PURE__ */ s.jsx(
2882
+ /* @__PURE__ */ r.jsx(
2308
2883
  be,
2309
2884
  {
2310
2885
  stackedPallet: e,
2311
2886
  selectedBoxId: i,
2312
- highlightedBoxId: n,
2313
- selectedColor: r,
2887
+ highlightedBoxId: s,
2888
+ selectedColor: n,
2314
2889
  highlightedColor: a,
2315
- showLabels: f,
2316
- onBoxClick: x,
2317
- onBoxHover: p
2890
+ showLabels: c,
2891
+ onBoxClick: g,
2892
+ onBoxHover: w
2318
2893
  }
2319
2894
  ),
2320
- c
2895
+ m
2321
2896
  ] })
2322
2897
  }
2323
2898
  ),
2324
- u && h && /* @__PURE__ */ s.jsx(
2325
- Se,
2899
+ h && d && /* @__PURE__ */ r.jsx(
2900
+ je,
2326
2901
  {
2327
- sceneWidth: b.width,
2328
- sceneDepth: b.depth,
2902
+ sceneWidth: S.width,
2903
+ sceneDepth: S.depth,
2329
2904
  sceneType: "truck",
2330
- cameraPosition: j,
2331
- targetPosition: { x: M[0], z: M[2] },
2905
+ cameraPosition: b,
2906
+ targetPosition: { x: C[0], z: C[2] },
2332
2907
  position: "bottom-left"
2333
2908
  }
2334
2909
  )
2335
2910
  ] });
2336
- }), Ut = V(function({
2911
+ }), Yt = V(function({
2337
2912
  truck: e,
2338
2913
  preset: t,
2339
2914
  selectedBoxId: i,
2340
- highlightedBoxId: n,
2341
- selectedColor: r,
2915
+ highlightedBoxId: s,
2916
+ selectedColor: n,
2342
2917
  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
2918
+ showLabels: c = !1,
2919
+ showGrid: l,
2920
+ wallOpacity: p = 0.3,
2921
+ showRoof: h = !1,
2922
+ showSideWalls: g = !0,
2923
+ cameraPreset: w = "perspective",
2924
+ showMiniMap: m = !1,
2925
+ onBoxClick: x,
2926
+ onBoxHover: u,
2927
+ children: d,
2928
+ style: b
2354
2929
  }) {
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]
2930
+ const [j, _] = ae({ x: 0, z: 0 }), S = q((R) => {
2931
+ _({ x: R.x, z: R.z });
2932
+ }, []), C = U.MM_TO_M, z = e.dimensions.width * C, y = e.dimensions.height * C, v = e.dimensions.depth * C, M = k(
2933
+ () => [z / 2, y / 2, v / 2],
2934
+ [z, y, v]
2360
2935
  ), 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);
2936
+ () => ({ width: z, height: y, depth: v }),
2937
+ [z, y, v]
2938
+ ), T = k(() => [z * 0.8, y * 1.2, v * 0.4], [z, y, v]), I = k(() => e.pallets.filter((R) => {
2939
+ const A = tt(R, e);
2365
2940
  return A.isValid ? !0 : (console.error(
2366
- `[TruckScene] Palet "${P.id}" fuera de los límites del camión.`,
2941
+ `[TruckScene] Palet "${R.id}" fuera de los límites del camión.`,
2367
2942
  "Violaciones:",
2368
2943
  A.violations
2369
2944
  ), !1);
2370
2945
  }), [e]);
2371
- return /* @__PURE__ */ s.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
2372
- /* @__PURE__ */ s.jsx(
2373
- pe,
2946
+ return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
2947
+ /* @__PURE__ */ r.jsx(
2948
+ fe,
2374
2949
  {
2375
2950
  shadows: !0,
2376
2951
  camera: {
2377
- position: R,
2952
+ position: T,
2378
2953
  fov: 45,
2379
2954
  near: 0.01,
2380
2955
  far: 200
2381
2956
  },
2382
- style: { width: "100%", height: "100%", ...j },
2383
- children: /* @__PURE__ */ s.jsxs(ve, { preset: t, children: [
2384
- /* @__PURE__ */ s.jsx(
2385
- je,
2957
+ style: { width: "100%", height: "100%", ...b },
2958
+ children: /* @__PURE__ */ r.jsxs(we, { preset: t, children: [
2959
+ /* @__PURE__ */ r.jsx(
2960
+ Se,
2386
2961
  {
2387
- preset: p,
2388
- target: S,
2962
+ preset: w,
2963
+ target: M,
2389
2964
  sceneSize: E,
2390
- maxDistance: Math.max(_, y, w) * 3,
2965
+ maxDistance: Math.max(z, y, v) * 3,
2391
2966
  minDistance: 0.5
2392
2967
  }
2393
2968
  ),
2394
- /* @__PURE__ */ s.jsx(Ce, { onPositionChange: b }),
2395
- /* @__PURE__ */ s.jsxs(
2969
+ /* @__PURE__ */ r.jsx(Me, { onPositionChange: S }),
2970
+ /* @__PURE__ */ r.jsxs(
2396
2971
  Pt,
2397
2972
  {
2398
2973
  truck: e,
2399
- showGrid: g,
2400
- wallOpacity: v,
2401
- showRoof: u,
2402
- showSideWalls: x,
2974
+ showGrid: l,
2975
+ wallOpacity: p,
2976
+ showRoof: h,
2977
+ showSideWalls: g,
2403
2978
  children: [
2404
- O.map((P) => /* @__PURE__ */ s.jsx(
2979
+ I.map((R) => /* @__PURE__ */ r.jsx(
2405
2980
  be,
2406
2981
  {
2407
- stackedPallet: P.stackedPallet,
2408
- position: P.position,
2409
- yRotation: P.yRotation,
2410
- palletId: P.id,
2982
+ stackedPallet: R.stackedPallet,
2983
+ position: R.position,
2984
+ yRotation: R.yRotation,
2985
+ palletId: R.id,
2411
2986
  selectedBoxId: i,
2412
- highlightedBoxId: n,
2413
- selectedColor: r,
2987
+ highlightedBoxId: s,
2988
+ selectedColor: n,
2414
2989
  highlightedColor: a,
2415
- showLabels: f,
2416
- onBoxClick: l,
2417
- onBoxHover: d
2990
+ showLabels: c,
2991
+ onBoxClick: x,
2992
+ onBoxHover: u
2418
2993
  },
2419
- P.id
2994
+ R.id
2420
2995
  )),
2421
- h
2996
+ d
2422
2997
  ]
2423
2998
  }
2424
2999
  )
2425
3000
  ] })
2426
3001
  }
2427
3002
  ),
2428
- c && /* @__PURE__ */ s.jsx(
2429
- Se,
3003
+ m && /* @__PURE__ */ r.jsx(
3004
+ je,
2430
3005
  {
2431
- sceneWidth: _,
2432
- sceneDepth: w,
3006
+ sceneWidth: z,
3007
+ sceneDepth: v,
2433
3008
  sceneType: "truck",
2434
- cameraPosition: T,
2435
- targetPosition: { x: S[0], z: S[2] },
3009
+ cameraPosition: j,
3010
+ targetPosition: { x: M[0], z: M[2] },
2436
3011
  position: "bottom-left"
2437
3012
  }
2438
3013
  )
@@ -2441,68 +3016,68 @@ const Yt = V(function({
2441
3016
  room: e,
2442
3017
  preset: t,
2443
3018
  selectedBoxId: i,
2444
- highlightedBoxId: n,
2445
- selectedColor: r,
3019
+ highlightedBoxId: s,
3020
+ selectedColor: n,
2446
3021
  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
3022
+ showLabels: c = !1,
3023
+ cameraPreset: l = "perspective",
3024
+ showMiniMap: p = !1,
3025
+ onBoxClick: h,
3026
+ onBoxHover: g,
3027
+ children: w,
3028
+ style: m
2454
3029
  }) {
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(() => {
3030
+ const x = U.MM_TO_M, [u, d] = ae({ x: 0, z: 0 }), b = q((y) => {
3031
+ d({ x: y.x, z: y.z });
3032
+ }, []), { target: j, sceneSize: _, initialCameraPosition: S } = k(() => {
2458
3033
  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 = [
3034
+ let v = 1 / 0, M = -1 / 0, E = 1 / 0, T = -1 / 0;
3035
+ for (const P of y)
3036
+ v = Math.min(v, P.x * x), M = Math.max(M, P.x * x), E = Math.min(E, P.z * x), T = Math.max(T, P.z * x);
3037
+ const I = M - v, R = T - E, A = e.ceilingHeight * x, G = (v + M) / 2, D = (E + T) / 2, H = [G, A / 2, D], F = { width: I, height: A, depth: R }, J = Math.sqrt(I ** 2 + A ** 2 + R ** 2) * 0.8, f = [
2463
3038
  G + J * 0.6,
2464
3039
  A + J * 0.5,
2465
- N + J * 0.6
3040
+ D + J * 0.6
2466
3041
  ];
2467
3042
  return {
2468
- target: U,
3043
+ target: H,
2469
3044
  sceneSize: F,
2470
- initialCameraPosition: m
3045
+ initialCameraPosition: f
2471
3046
  };
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(
3047
+ }, [e.floorPolygon, e.ceilingHeight, x]), C = k(() => e.floorPolygon.map((y) => ({ x: y.x * x, z: y.z * x })), [e.floorPolygon, x]), z = k(() => e.pallets.filter((y) => {
3048
+ const v = We(y, e);
3049
+ return v.isValid ? !0 : (console.error(
2475
3050
  `[WarehouseScene] Palet "${y.id}" fuera de los límites de la estancia "${e.name}".`,
2476
3051
  "Violaciones:",
2477
- w.violations
3052
+ v.violations
2478
3053
  ), !1);
2479
3054
  }), [e]);
2480
- return /* @__PURE__ */ s.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
2481
- /* @__PURE__ */ s.jsx(
2482
- pe,
3055
+ return /* @__PURE__ */ r.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
3056
+ /* @__PURE__ */ r.jsx(
3057
+ fe,
2483
3058
  {
2484
3059
  shadows: !0,
2485
3060
  camera: {
2486
- position: b,
3061
+ position: S,
2487
3062
  fov: 45,
2488
3063
  near: 0.01,
2489
3064
  far: 300
2490
3065
  },
2491
- style: { width: "100%", height: "100%", ...c },
2492
- children: /* @__PURE__ */ s.jsxs(ve, { preset: t, children: [
2493
- /* @__PURE__ */ s.jsx(
2494
- je,
3066
+ style: { width: "100%", height: "100%", ...m },
3067
+ children: /* @__PURE__ */ r.jsxs(we, { preset: t, children: [
3068
+ /* @__PURE__ */ r.jsx(
3069
+ Se,
2495
3070
  {
2496
- preset: g,
2497
- target: T,
2498
- sceneSize: z,
2499
- maxDistance: Math.max(z.width, z.height, z.depth) * 4,
3071
+ preset: l,
3072
+ target: j,
3073
+ sceneSize: _,
3074
+ maxDistance: Math.max(_.width, _.height, _.depth) * 4,
2500
3075
  minDistance: 0.5
2501
3076
  }
2502
3077
  ),
2503
- /* @__PURE__ */ s.jsx(Ce, { onPositionChange: j }),
2504
- /* @__PURE__ */ s.jsxs(Mt, { room: e, children: [
2505
- _.map((y) => /* @__PURE__ */ s.jsx(
3078
+ /* @__PURE__ */ r.jsx(Me, { onPositionChange: b }),
3079
+ /* @__PURE__ */ r.jsxs(Ct, { room: e, children: [
3080
+ z.map((y) => /* @__PURE__ */ r.jsx(
2506
3081
  be,
2507
3082
  {
2508
3083
  stackedPallet: y.stackedPallet,
@@ -2510,29 +3085,29 @@ const Yt = V(function({
2510
3085
  yRotation: y.yRotation,
2511
3086
  palletId: y.id,
2512
3087
  selectedBoxId: i,
2513
- highlightedBoxId: n,
2514
- selectedColor: r,
3088
+ highlightedBoxId: s,
3089
+ selectedColor: n,
2515
3090
  highlightedColor: a,
2516
- showLabels: f,
2517
- onBoxClick: u,
2518
- onBoxHover: x
3091
+ showLabels: c,
3092
+ onBoxClick: h,
3093
+ onBoxHover: g
2519
3094
  },
2520
3095
  y.id
2521
3096
  )),
2522
- p
3097
+ w
2523
3098
  ] })
2524
3099
  ] })
2525
3100
  }
2526
3101
  ),
2527
- v && /* @__PURE__ */ s.jsx(
2528
- Se,
3102
+ p && /* @__PURE__ */ r.jsx(
3103
+ je,
2529
3104
  {
2530
- sceneWidth: z.width,
2531
- sceneDepth: z.depth,
3105
+ sceneWidth: _.width,
3106
+ sceneDepth: _.depth,
2532
3107
  sceneType: "warehouse",
2533
- floorPolygon: M,
2534
- cameraPosition: d,
2535
- targetPosition: { x: T[0], z: T[2] },
3108
+ floorPolygon: C,
3109
+ cameraPosition: u,
3110
+ targetPosition: { x: j[0], z: j[2] },
2536
3111
  position: "bottom-left"
2537
3112
  }
2538
3113
  )
@@ -2540,51 +3115,51 @@ const Yt = V(function({
2540
3115
  });
2541
3116
  export {
2542
3117
  ut as BinPacking3DStrategy,
2543
- bt as BoxComponent,
3118
+ St as BoxComponent,
2544
3119
  ge as BoxFactory,
2545
- Ne as COLLISION_TOLERANCE,
2546
- je as CameraControlsComponent,
3120
+ De as COLLISION_TOLERANCE,
3121
+ Se as CameraControlsComponent,
2547
3122
  mt as ColumnStrategy,
2548
3123
  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,
3124
+ Ut as Label,
3125
+ ze as MIN_SUPPORT_PERCENTAGE,
3126
+ Oe as PRESET_INDUSTRIAL,
3127
+ Ne as PRESET_UNSTYLED,
3128
+ pt as PackingRegistry,
2554
3129
  jt as PalletComponent,
2555
3130
  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,
3131
+ N as PalletMaterial,
3132
+ Ht as PalletScene,
3133
+ we as PresetProvider,
3134
+ Ue as SCENE_PRESETS,
3135
+ It as SEPARATOR_DEFAULTS,
2561
3136
  ue as STANDARD_PALLETS,
2562
- Ct as SeparatorComponent,
3137
+ zt as SeparatorComponent,
2563
3138
  me as SeparatorMaterial,
2564
3139
  be as StackedPalletComponent,
2565
3140
  Ze as TRUCK_PRESETS,
2566
3141
  Pt as TruckEnvironment,
2567
- Gt as TruckFactory,
2568
- Ut as TruckScene,
2569
- ie as TruckType,
3142
+ Vt as TruckFactory,
3143
+ Yt as TruckScene,
3144
+ oe as TruckType,
2570
3145
  xt as TypeGroupStrategy,
2571
- Y as UNITS,
2572
- Oe as WEIGHT_WARNING_THRESHOLD,
2573
- Mt as WarehouseEnvironment,
3146
+ U as UNITS,
3147
+ Ie as WEIGHT_WARNING_THRESHOLD,
3148
+ Ct as WarehouseEnvironment,
2574
3149
  Ft as WarehouseScene,
2575
- ye as aabbIntersects,
2576
- q as calculateCenterOfGravity,
2577
- se as calculateStabilityScore,
3150
+ ve as aabbIntersects,
3151
+ Y as calculateCenterOfGravity,
3152
+ ee as calculateStabilityScore,
2578
3153
  ft as defaultRegistry,
2579
3154
  qe as ensureUniqueBoxIds,
2580
- D as getBoxBoundingBox,
2581
- oe as getPalletBoundingBox,
3155
+ L as getBoxBoundingBox,
3156
+ se as getPalletBoundingBox,
2582
3157
  le as getStackedPalletTotalHeight,
2583
- we as getStackedPalletTotalWeight,
3158
+ ye as getStackedPalletTotalWeight,
2584
3159
  ht as pointInPolygon,
2585
- Zt as usePackingStrategy,
2586
- Xt as usePalletMetrics,
2587
- Vt as usePhysicsValidation,
3160
+ Dt as usePackingStrategy,
3161
+ Zt as usePalletMetrics,
3162
+ Xt as usePhysicsValidation,
2588
3163
  ce as usePreset,
2589
3164
  Nt as useWarehouseValidation,
2590
3165
  et as validateAllBoxesInPalletBounds,
@@ -2599,13 +3174,13 @@ export {
2599
3174
  We as validatePalletInRoom,
2600
3175
  tt as validatePalletInTruck,
2601
3176
  it as validatePalletWeight,
2602
- Wt as validateSeparators,
3177
+ $t as validateSeparators,
2603
3178
  dt as validateStability,
2604
- $t as validateStackDimensions,
2605
- Bt as validateStackHeight,
2606
- Dt as validateStackWeight,
3179
+ Wt as validateStackDimensions,
3180
+ Lt as validateStackHeight,
3181
+ Gt as validateStackWeight,
2607
3182
  ct as validateSupport,
2608
- It as validateTruckWeight,
3183
+ Bt as validateTruckWeight,
2609
3184
  nt as validateWeightDistribution
2610
3185
  };
2611
3186
  //# sourceMappingURL=pallet-builder.js.map