@roomle/web-sdk 2.113.0-debug.12 → 3.0.0-alpha.2

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.
Files changed (55) hide show
  1. package/README.md +2 -0
  2. package/lib/{BufferGeometry-DxMNUz5W.mjs → BufferGeometry-hDR_qVnf.mjs} +2 -2
  3. package/lib/{BufferGeometry-DxMNUz5W.mjs.map → BufferGeometry-hDR_qVnf.mjs.map} +1 -1
  4. package/lib/ConfiguratorKernel.wasm +0 -0
  5. package/lib/{GLTFExporter-D6nmo8bl.mjs → GLTFExporter-BNq_1jiu.mjs} +16 -16
  6. package/lib/{GLTFExporter-D6nmo8bl.mjs.map → GLTFExporter-BNq_1jiu.mjs.map} +1 -1
  7. package/lib/{PointLightHelper-BfkYMbMn.mjs → PointLightHelper-BSVmJ40B.mjs} +12 -12
  8. package/lib/{PointLightHelper-BfkYMbMn.mjs.map → PointLightHelper-BSVmJ40B.mjs.map} +1 -1
  9. package/lib/RoomleCore.wasm +0 -0
  10. package/lib/RoomleToolsCore.wasm +0 -0
  11. package/lib/{SpotLightHelper-DgUtIhfr.mjs → SpotLightHelper-Ba5CDcvu.mjs} +3 -3
  12. package/lib/{SpotLightHelper-DgUtIhfr.mjs.map → SpotLightHelper-Ba5CDcvu.mjs.map} +1 -1
  13. package/lib/{USDZExporter-DolKgErZ.mjs → USDZExporter-BXUQSlKH.mjs} +2 -2
  14. package/lib/{USDZExporter-DolKgErZ.mjs.map → USDZExporter-BXUQSlKH.mjs.map} +1 -1
  15. package/lib/{banana-for-scale-DRVLP1E5.mjs → banana-for-scale-DSKC3F9W.mjs} +2 -2
  16. package/lib/{banana-for-scale-DRVLP1E5.mjs.map → banana-for-scale-DSKC3F9W.mjs.map} +1 -1
  17. package/lib/{component-dimensioning-DR-QAVWc.mjs → component-dimensioning-CDX04DA0.mjs} +2 -2
  18. package/lib/{component-dimensioning-DR-QAVWc.mjs.map → component-dimensioning-CDX04DA0.mjs.map} +1 -1
  19. package/lib/{continuous-drawing-helper-CYEmULFe.mjs → continuous-drawing-helper-Djeonu9R.mjs} +2 -2
  20. package/lib/{continuous-drawing-helper-CYEmULFe.mjs.map → continuous-drawing-helper-Djeonu9R.mjs.map} +1 -1
  21. package/lib/{homag-intelligence-Bq-oBRsz.mjs → homag-intelligence-CngVZKGu.mjs} +476 -336
  22. package/lib/homag-intelligence-CngVZKGu.mjs.map +1 -0
  23. package/lib/{imos-ix-poc-export-helper-qHVFmcvf.mjs → imos-ix-poc-export-helper-DcvR6WHi.mjs} +2 -2
  24. package/lib/{imos-ix-poc-export-helper-qHVFmcvf.mjs.map → imos-ix-poc-export-helper-DcvR6WHi.mjs.map} +1 -1
  25. package/lib/{index-JPCZ4gUe.mjs → index-1AA3oYQf.mjs} +3660 -3579
  26. package/lib/index-1AA3oYQf.mjs.map +1 -0
  27. package/lib/{material-viewer-BEGEyF_X.mjs → material-viewer-CjpNPN7U.mjs} +2 -2
  28. package/lib/material-viewer-CjpNPN7U.mjs.map +1 -0
  29. package/lib/roomle-sdk.d.ts +478 -271
  30. package/lib/roomle-sdk.js +11 -11
  31. package/lib/static/roomle-core-hsc/ConfiguratorKernel.wasm +0 -0
  32. package/lib/static/roomle-core-hsc/RoomleCore.wasm +0 -0
  33. package/lib/static/roomle-core-hsc/RoomleServiceCore.wasm +0 -0
  34. package/lib/static/roomle-core-hsc/RoomleToolsCore.wasm +0 -0
  35. package/lib/static/roomle-core-hsc/configuratorCoreInterface.d.ts +1 -0
  36. package/lib/static/roomle-core-hsc/embind/configuratorCoreInterface.d.ts +1 -0
  37. package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.d.ts +1 -0
  38. package/lib/static/roomle-core-hsc/package.json +1 -1
  39. package/lib/static/roomle-core-hsc/plannerCoreInterface.d.ts +1 -0
  40. package/lib/static/roomle-core-hsc/src/embind/configuratorCoreInterface.d.ts +1 -0
  41. package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.d.ts +1 -0
  42. package/lib/static/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
  43. package/lib/static/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
  44. package/lib/static/roomle-core-hsc/wasm_modern/RoomleServiceCore.wasm +0 -0
  45. package/lib/static/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
  46. package/lib/{stats-helper-DmMNmZ05.mjs → stats-helper-YfdBtF08.mjs} +2 -2
  47. package/lib/{stats-helper-DmMNmZ05.mjs.map → stats-helper-YfdBtF08.mjs.map} +1 -1
  48. package/lib/{three.webgpu-BHLDP7Yy.mjs → three.webgpu-BEGHg51m.mjs} +3 -3
  49. package/lib/{three.webgpu-BHLDP7Yy.mjs.map → three.webgpu-BEGHg51m.mjs.map} +1 -1
  50. package/lib/{tools-core-BjEVsNG6.mjs → tools-core-Bnq_egvf.mjs} +2 -2
  51. package/lib/{tools-core-BjEVsNG6.mjs.map → tools-core-Bnq_egvf.mjs.map} +1 -1
  52. package/package.json +1 -1
  53. package/lib/homag-intelligence-Bq-oBRsz.mjs.map +0 -1
  54. package/lib/index-JPCZ4gUe.mjs.map +0 -1
  55. package/lib/material-viewer-BEGEyF_X.mjs.map +0 -1
@@ -1,16 +1,16 @@
1
- import { A as _, J as g, K as A, N as L, O as R } from "./index-JPCZ4gUe.mjs";
1
+ import { A as _, J as g, K as I, N as L, O as A, Q as R } from "./index-1AA3oYQf.mjs";
2
2
  class O {
3
3
  }
4
4
  const f = {
5
5
  HIDE: "hide",
6
6
  SHOW_ATTRIBUTES: "attributes",
7
7
  SHOW_ARTICLES: "articles"
8
- }, y = {
8
+ }, b = {
9
9
  NONE: "none",
10
10
  GROUP: "group",
11
11
  ROOT_MODULE: "rootModule",
12
12
  SUB_MODULE: "subModule"
13
- }, b = {
13
+ }, m = {
14
14
  MULTI_SELECT: "multiselect",
15
15
  TC_CONFIG: "tc-config",
16
16
  RML_OBJECT: "rml-object"
@@ -18,7 +18,7 @@ const f = {
18
18
  class w {
19
19
  constructor(t) {
20
20
  this._callbacks = null, this._contextType = _.PLANNER, this._selectionMode = null, this._hiSelection = {
21
- type: y.NONE,
21
+ type: b.NONE,
22
22
  groupId: null,
23
23
  rootModuleId: null,
24
24
  subModuleId: null
@@ -42,7 +42,7 @@ class w {
42
42
  this._contextType = t, t === _.PLANNER && this._resetSelection(), this._handleViewTypeChange();
43
43
  }
44
44
  groupOrModuleSelected(t, e, o) {
45
- this._selectionMode = b.TC_CONFIG, this._hiSelection.groupId = t, this._hiSelection.rootModuleId = e ?? null, this._hiSelection.subModuleId = o ?? null, this._hiSelection.rootModuleId && this._hiSelection.subModuleId ? this._hiSelection.type = y.SUB_MODULE : this._hiSelection.rootModuleId ? this._hiSelection.type = y.ROOT_MODULE : this._hiSelection.type = y.GROUP, this._handleViewTypeChange();
45
+ this._selectionMode = m.TC_CONFIG, this._hiSelection.groupId = t, this._hiSelection.rootModuleId = e ?? null, this._hiSelection.subModuleId = o ?? null, this._hiSelection.rootModuleId && this._hiSelection.subModuleId ? this._hiSelection.type = b.SUB_MODULE : this._hiSelection.rootModuleId ? this._hiSelection.type = b.ROOT_MODULE : this._hiSelection.type = b.GROUP, this._handleViewTypeChange();
46
46
  }
47
47
  componentSelectionCancel(t) {
48
48
  this._contextType === _.CONFIGURATOR && (t === "click_outside" || t === "isolation_mode_cancelled" || t === "select_other" || (this._resetSelection(), this._handleViewTypeChange()));
@@ -50,7 +50,7 @@ class w {
50
50
  selectionCancel(t) {
51
51
  t !== "select_other" && (this._resetSelection(), this._handleViewTypeChange());
52
52
  }
53
- selectionChanged(t, e, o, s, r) {
53
+ selectionChanged(t, e, o, r, s) {
54
54
  this._selectionHandler(
55
55
  _.PLANNER,
56
56
  t,
@@ -61,18 +61,18 @@ class w {
61
61
  _resetSelection() {
62
62
  this._selectionMode = null;
63
63
  }
64
- _selectionHandler(t, e, o, s) {
64
+ _selectionHandler(t, e, o, r) {
65
65
  if (t !== _.CONFIGURATOR) {
66
- if (e === b.MULTI_SELECT) {
66
+ if (e === m.MULTI_SELECT) {
67
67
  this._selectionMode = e, this._handleViewTypeChange();
68
68
  return;
69
69
  }
70
- o === "external-configuration" && s.externalConfigurationType === b.TC_CONFIG ? this._selectionMode = b.TC_CONFIG : this._selectionMode = b.RML_OBJECT, this._handleViewTypeChange();
70
+ o === "external-configuration" && r.externalConfigurationType === m.TC_CONFIG ? this._selectionMode = m.TC_CONFIG : this._selectionMode = m.RML_OBJECT, this._handleViewTypeChange();
71
71
  }
72
72
  }
73
73
  _handleViewTypeChange() {
74
74
  let t = f.SHOW_ARTICLES;
75
- this._selectionMode === b.TC_CONFIG && (this._contextType === _.CONFIGURATOR || this._hiSelection.type !== y.GROUP) && (t = f.SHOW_ATTRIBUTES), this._emitSelectionChange(t);
75
+ this._selectionMode === m.TC_CONFIG && (this._contextType === _.CONFIGURATOR || this._hiSelection.type !== b.GROUP) && (t = f.SHOW_ATTRIBUTES), this._emitSelectionChange(t);
76
76
  }
77
77
  _emitSelectionChange(t) {
78
78
  if (this._emittedSelection.panel !== t) {
@@ -91,7 +91,7 @@ class w {
91
91
  ));
92
92
  }
93
93
  }
94
- class D {
94
+ class M {
95
95
  constructor(t, e = null) {
96
96
  this._libraryData = /* @__PURE__ */ new Map(), this._posDataForLoading = null, this._posArticleMap = /* @__PURE__ */ new Map(), this._posSubArticleMap = /* @__PURE__ */ new Map(), this._groupMap = /* @__PURE__ */ new Map(), this._nextPosDataId = 1, this._hiCallbacks = null, this._pendingGroupsToBeLoaded = [], this._planCompletelyLoaded = !1, this._validSubArticles = [], this._designerRequests = t, this._hiCallbacks = e, this._hiObjectSelection = new w(e);
97
97
  }
@@ -118,8 +118,8 @@ class D {
118
118
  }
119
119
  loadPosData(t, e) {
120
120
  t?.articles && (t = t.articles), t.forEach((o) => {
121
- const s = o.id || o.articleId, r = g(o);
122
- r.libraryId = e, r.isConfigDummy ? this._posSubArticleMap.set(s, r) : this._posArticleMap.set(s, r);
121
+ const r = o.id || o.articleId, s = g(o);
122
+ s.libraryId = e, s.isConfigDummy ? this._posSubArticleMap.set(r, s) : this._posArticleMap.set(r, s);
123
123
  });
124
124
  }
125
125
  setPosDataForLoading(t) {
@@ -135,18 +135,18 @@ class D {
135
135
  return this._posDataForLoading?.groups ?? null;
136
136
  }
137
137
  async newPosDataFromId(t) {
138
- A(t) && (t = L(t));
138
+ I(t) && (t = L(t));
139
139
  let e = !1, o;
140
140
  if (this._posArticleMap.has(t) ? o = g(this._posArticleMap.get(t)) : this._posSubArticleMap.has(t) && (e = !0, o = g(this._posSubArticleMap.get(t))), !o)
141
141
  return;
142
- const s = o;
143
- s.ver = this.getLibraryData(
144
- s.libraryId
145
- )?.posGroupVersion, s.logMessages = [], s.roots.forEach((i) => {
142
+ const r = o;
143
+ r.ver = this.getLibraryData(
144
+ r.libraryId
145
+ )?.posGroupVersion, r.logMessages = [], r.roots.forEach((i) => {
146
146
  i.libraryId = o.libraryId, i.catalog = o.catalog, i.logMessages = [], i.isGenerated || (i.articleName = o.articleName, i.articleId = o.articleId, i.desc = o.desc, i.imageUrl = o.imageUrl, i.category = o.category);
147
147
  });
148
- let r;
149
- return e ? r = this._calculateNewGroup(s, !1) : (r = this._addNewGroup(s, !1).posDataJson, this._groupsModified(r, [], [])), r;
148
+ let s;
149
+ return e ? s = this._calculateNewGroup(r, !1) : (s = this._addNewGroup(r, !1).posDataJson, this._groupsModified(s, [], [])), s;
150
150
  }
151
151
  async newPosDataFromGroup(t) {
152
152
  const e = this._addNewGroup(t, !1);
@@ -176,8 +176,8 @@ class D {
176
176
  async selectSubModule(t, e, o) {
177
177
  try {
178
178
  await this._designerRequests.selectModule(e, o);
179
- } catch (s) {
180
- console.error(s);
179
+ } catch (r) {
180
+ console.error(r);
181
181
  }
182
182
  }
183
183
  async openCloseGroup(t) {
@@ -193,25 +193,25 @@ class D {
193
193
  }
194
194
  deleteRootModule(t, e, o) {
195
195
  try {
196
- const s = this._getGroup(t.groupId);
197
- if (s) {
198
- this._setGroupPosition(s, t), this._setGroupContour(s, t), this._setRootModulesPosition(s, t);
199
- const r = s.posDataJson;
200
- r.roots = r.roots.filter(
196
+ const r = this._getGroup(t.groupId);
197
+ if (r) {
198
+ this._setGroupPosition(r, t), this._setGroupContour(r, t), this._setRootModulesPosition(r, t);
199
+ const s = r.posDataJson;
200
+ s.roots = s.roots.filter(
201
201
  (a) => a.id !== e
202
202
  );
203
203
  const i = this._splitOffGroupsFromGroups(
204
- s,
204
+ r,
205
205
  o
206
206
  );
207
- this._calculateAndUpdateGroupMap(s), this._loadPosData(s, i), this._groupsModified(
207
+ this._calculateAndUpdateGroupMap(r), this._loadPosData(r, i), this._groupsModified(
208
208
  i.map((a) => a.posDataJson),
209
- s.posDataJson,
209
+ r.posDataJson,
210
210
  []
211
211
  );
212
212
  }
213
- } catch (s) {
214
- console.error(s);
213
+ } catch (r) {
214
+ console.error(r);
215
215
  }
216
216
  }
217
217
  duplicateGroup(t) {
@@ -220,14 +220,14 @@ class D {
220
220
  if (e) {
221
221
  const o = g(e.posDataJson);
222
222
  o.roots = o.roots.filter(
223
- (r) => t.rootModules.find(
224
- (i) => i.moduleId === r.id
223
+ (s) => t.rootModules.find(
224
+ (i) => i.moduleId === s.id
225
225
  ) !== void 0
226
226
  );
227
- const s = this._addNewGroup(o, !1);
228
- this._setGroupPosition(s, t), this._designerRequests.loadPosGroups(s.posDataJson, {
227
+ const r = this._addNewGroup(o, !1);
228
+ this._setGroupPosition(r, t), this._designerRequests.loadPosGroups(r.posDataJson, {
229
229
  findFreeSpaceInPlan: !0
230
- }), this._groupsModified(s.posDataJson, [], []);
230
+ }), this._groupsModified(r.posDataJson, [], []);
231
231
  }
232
232
  } catch (e) {
233
233
  console.error(e);
@@ -235,14 +235,14 @@ class D {
235
235
  }
236
236
  mergeGroups(t, e, o) {
237
237
  try {
238
- const s = Array.isArray(e) ? e : [e];
239
- if (this._groupMap.has(t.groupId) && s.length > 0) {
240
- const r = [];
241
- for (const n of s) {
238
+ const r = Array.isArray(e) ? e : [e];
239
+ if (this._groupMap.has(t.groupId) && r.length > 0) {
240
+ const s = [];
241
+ for (const n of r) {
242
242
  const l = this._getGroup(n);
243
- l && r.push(...l.posDataJson.roots);
243
+ l && s.push(...l.posDataJson.roots);
244
244
  }
245
- const i = r.filter(
245
+ const i = s.filter(
246
246
  (n) => !n.isGenerated
247
247
  ), a = this._getGroup(t.groupId);
248
248
  if (a) {
@@ -254,41 +254,41 @@ class D {
254
254
  n,
255
255
  i
256
256
  ), a.posDataJson.roots.push(...i), this._setGroupPosition(a, t), this._setGroupContour(a, t), this._setRootModulesPosition(a, t), this._calculateAndUpdateGroupMap(a), this._designerRequests.loadPosGroups(a.posDataJson, {
257
- mergedGroups: s
257
+ mergedGroups: r
258
258
  });
259
259
  const l = [];
260
- for (const d of s)
260
+ for (const d of r)
261
261
  this._groupMap.has(d) && (this._groupMap.delete(d), l.push(d));
262
262
  this._groupsModified([], a.posDataJson, l);
263
263
  }
264
264
  }
265
- } catch (s) {
266
- console.error(s);
265
+ } catch (r) {
266
+ console.error(r);
267
267
  }
268
268
  }
269
269
  _applyImplicitRelevantAttributes(t, e, o) {
270
- const s = this.getLibraryData(t)?.masterData;
271
- if (!s || !e || o.length === 0)
270
+ const r = this.getLibraryData(t)?.masterData;
271
+ if (!r || !e || o.length === 0)
272
272
  return;
273
- const i = s.modules.find(
273
+ const i = r.modules.find(
274
274
  (a) => a.id === e.name
275
275
  )?.assignedAttributes.filter(
276
- (a) => s.attributes.find((n) => n.id === a)?.implicitRelevant === !0
276
+ (a) => r.attributes.find((n) => n.id === a)?.implicitRelevant === !0
277
277
  ) ?? [];
278
278
  for (const a of o) {
279
- const n = s.modules.find(
279
+ const n = r.modules.find(
280
280
  (l) => l.id === a.name
281
281
  );
282
282
  for (const l of i) {
283
283
  const d = e.attributes?.find(
284
- (m) => m.id === l
284
+ (y) => y.id === l
285
285
  );
286
286
  if (!n?.assignedAttributes.find(
287
- (m) => m === l
287
+ (y) => y === l
288
288
  ))
289
289
  continue;
290
290
  const p = a.attributes?.find(
291
- (m) => m.id === l
291
+ (y) => y.id === l
292
292
  );
293
293
  p ? (p.isInput = d?.isInput ?? !1, p.isInput === !0 && (p.value = d?.value)) : (d?.isInput ?? !1) && a.attributes?.push({
294
294
  id: l,
@@ -303,12 +303,12 @@ class D {
303
303
  const o = this._getGroup(t.groupId);
304
304
  if (o) {
305
305
  this._setGroupPosition(o, t), this._setGroupContour(o, t), this._setRootModulesPosition(o, t);
306
- const s = Array.isArray(e) ? e : [e], r = this._splitOffGroupsFromGroups(
306
+ const r = Array.isArray(e) ? e : [e], s = this._splitOffGroupsFromGroups(
307
307
  o,
308
- s
308
+ r
309
309
  );
310
- this._calculateAndUpdateGroupMap(o), this._loadPosData(o, r), this._groupsModified(
311
- r.map((i) => i.posDataJson),
310
+ this._calculateAndUpdateGroupMap(o), this._loadPosData(o, s), this._groupsModified(
311
+ s.map((i) => i.posDataJson),
312
312
  o.posDataJson,
313
313
  []
314
314
  );
@@ -321,11 +321,11 @@ class D {
321
321
  try {
322
322
  const e = this._getGroup(t.groupId);
323
323
  if (e) {
324
- for (const s of e.posDataJson.roots)
324
+ for (const r of e.posDataJson.roots)
325
325
  t.rootModules.filter(
326
- (r) => r.moduleId === s.id
327
- ).forEach((r) => {
328
- s.articlePos = r.pos, s.rotationY = r.rotationY;
326
+ (s) => s.moduleId === r.id
327
+ ).forEach((s) => {
328
+ r.articlePos = s.pos, r.rotationY = s.rotationY;
329
329
  });
330
330
  const o = this._calculateAndUpdateGroupMap(e);
331
331
  this._designerRequests.loadPosGroups(o, {}), this._groupsModified([], o, []);
@@ -343,10 +343,10 @@ class D {
343
343
  }
344
344
  changedGroupFromHistory(t, e) {
345
345
  try {
346
- const o = this._calculate(t), s = o.id, r = this._getGroup(s);
347
- r ? r.posDataJson = o : this._addGroupToMap(s, o), e && this._designerRequests.loadPosGroups(t, {}), this._groupsModified(
348
- r ? [] : [o],
349
- r ? [o] : [],
346
+ const o = this._calculate(t), r = o.id, s = this._getGroup(r);
347
+ s ? s.posDataJson = o : this._addGroupToMap(r, o), e && this._designerRequests.loadPosGroups(t, {}), this._groupsModified(
348
+ s ? [] : [o],
349
+ s ? [o] : [],
350
350
  []
351
351
  );
352
352
  } catch (o) {
@@ -387,7 +387,7 @@ class D {
387
387
  return;
388
388
  }
389
389
  const e = this._posDataForLoading.groups.find(
390
- (s) => s.id === t.id
390
+ (r) => r.id === t.id
391
391
  );
392
392
  if (!e) {
393
393
  this.removedGroup(t.id), this._designerRequests.deleteGroup(t.id);
@@ -400,14 +400,14 @@ class D {
400
400
  try {
401
401
  const e = t.id, o = !this._groupMap.has(e);
402
402
  o && this._addGroupToMap(e, t);
403
- const s = this._getGroup(e);
404
- if (s) {
405
- const r = this._calculateAndUpdateGroupMap(s);
406
- this._designerRequests.loadPosGroups(r, {
403
+ const r = this._getGroup(e);
404
+ if (r) {
405
+ const s = this._calculateAndUpdateGroupMap(r);
406
+ this._designerRequests.loadPosGroups(s, {
407
407
  respondWithPositionInPlan: !0
408
408
  }), this._groupsModified(
409
- o ? r : [],
410
- o ? [] : r,
409
+ o ? s : [],
410
+ o ? [] : s,
411
411
  []
412
412
  );
413
413
  }
@@ -432,14 +432,12 @@ class D {
432
432
  a.additionalText = "Additional Text " + o++;
433
433
  });
434
434
  });
435
- const s = this.getLibraryData(t)?.getOrderData(
435
+ const r = await this._designerRequests.getRoomInformation(), s = this.getLibraryData(t)?.getOrderData(
436
436
  e,
437
- t
437
+ t,
438
+ r?.rooms ?? []
438
439
  );
439
- if (!s)
440
- return null;
441
- const r = await this._designerRequests.getRoomInformation();
442
- return s.rooms = r?.rooms ?? [], s;
440
+ return s || null;
443
441
  } catch (e) {
444
442
  return console.error(e), null;
445
443
  }
@@ -454,24 +452,24 @@ class D {
454
452
  _setRootModulesPosition(t, e) {
455
453
  for (const o of t.posDataJson.roots)
456
454
  e.rootModules.filter(
457
- (s) => s.moduleId === o.id
458
- ).forEach((s) => {
459
- o.articlePos = s.pos, o.rotationY = s.rotationY;
455
+ (r) => r.moduleId === o.id
456
+ ).forEach((r) => {
457
+ o.articlePos = r.pos, o.rotationY = r.rotationY;
460
458
  });
461
459
  }
462
460
  _loadPosData(t, e) {
463
- const o = g(t.posDataJson), s = Array.isArray(o) ? o : [o];
464
- for (const r of e ?? [])
465
- s.push(g(r.posDataJson));
466
- this._designerRequests.loadPosGroups(s, {});
461
+ const o = g(t.posDataJson), r = Array.isArray(o) ? o : [o];
462
+ for (const s of e ?? [])
463
+ r.push(g(s.posDataJson));
464
+ this._designerRequests.loadPosGroups(r, {});
467
465
  }
468
466
  _splitOffGroupsFromGroups(t, e) {
469
467
  const o = [];
470
- for (const s of e ?? []) {
471
- const r = this._splitOffRootModulesFromGroup(
468
+ for (const r of e ?? []) {
469
+ const s = this._splitOffRootModulesFromGroup(
472
470
  t,
473
- s
474
- ), i = this._addNewGroup(r, !0);
471
+ r
472
+ ), i = this._addNewGroup(s, !0);
475
473
  o.push(i);
476
474
  }
477
475
  return o;
@@ -479,27 +477,27 @@ class D {
479
477
  _splitOffRootModulesFromGroup(t, e) {
480
478
  const o = e.rootModules.map(
481
479
  (a) => a.moduleId
482
- ), s = t.posDataJson, r = s.roots.filter(
480
+ ), r = t.posDataJson, s = r.roots.filter(
483
481
  (a) => o.includes(a.id)
484
482
  );
485
- s.roots = s.roots.filter(
483
+ r.roots = r.roots.filter(
486
484
  (a) => !o.includes(a.id)
487
485
  );
488
- for (const a of r)
486
+ for (const a of s)
489
487
  e.rootModules.filter(
490
488
  (n) => n.moduleId === a.id
491
489
  ).forEach((n) => {
492
490
  a.articlePos = n.pos, a.rotationY = n.rotationY;
493
491
  });
494
- for (const a of s.roots)
495
- a.isGenerated && r.push(g(a));
492
+ for (const a of r.roots)
493
+ a.isGenerated && s.push(g(a));
496
494
  return {
497
495
  id: void 0,
498
- libraryId: s.libraryId,
496
+ libraryId: r.libraryId,
499
497
  pos: e.pos,
500
498
  rotationY: e.rotationY,
501
- roots: r,
502
- ver: s.ver,
499
+ roots: s,
500
+ ver: r.ver,
503
501
  logMessages: []
504
502
  };
505
503
  }
@@ -511,10 +509,10 @@ class D {
511
509
  }
512
510
  _setSubmoduleImages(t, e) {
513
511
  e && t.modules?.length && t.modules.forEach((o) => {
514
- const s = e.modules.find(
515
- (r) => r.id === o.name
512
+ const r = e.modules.find(
513
+ (s) => s.id === o.name
516
514
  );
517
- s && (o.imageUrl = s.imageUrl), this._setSubmoduleImages(o, e);
515
+ r && (o.imageUrl = r.imageUrl), this._setSubmoduleImages(o, e);
518
516
  });
519
517
  }
520
518
  _calculateAndUpdateGroupMap(t) {
@@ -535,37 +533,37 @@ class D {
535
533
  };
536
534
  return this._groupMap.set(t, o), o;
537
535
  }
538
- updateAttribute(t, e, o, s) {
536
+ updateAttribute(t, e, o, r) {
539
537
  if (!t)
540
538
  return;
541
- const r = Array.from(this._groupMap.entries()).find(
539
+ const s = Array.from(this._groupMap.entries()).find(
542
540
  ([, a]) => a.posDataJson.roots.some((n) => n.id === t)
543
541
  );
544
- if (!r)
542
+ if (!s)
545
543
  throw new Error("PosGroup not found inside the calculated articles list");
546
- const [, i] = r;
544
+ const [, i] = s;
547
545
  if (i) {
548
546
  const a = this._modifyAttributeOfModules(
549
547
  i,
550
548
  e ?? t,
551
549
  o,
552
- s
550
+ r
553
551
  );
554
552
  this._designerRequests.loadPosGroups(a, {
555
553
  correctArrangement: !0
556
554
  }), this._groupsModified([], a, []);
557
555
  }
558
556
  }
559
- modifyAttribute(t, e, o, s) {
560
- const r = this._getGroup(t);
561
- if (r) {
557
+ modifyAttribute(t, e, o, r) {
558
+ const s = this._getGroup(t);
559
+ if (s) {
562
560
  const i = e.map(
563
561
  (n) => n.subModuleId ?? n.rootModuleId
564
562
  ), a = this._modifyAttributeOfModules(
565
- r,
563
+ s,
566
564
  i,
567
565
  o,
568
- s
566
+ r
569
567
  );
570
568
  this._designerRequests.loadPosGroups(a, {
571
569
  correctArrangement: !0
@@ -580,26 +578,136 @@ class D {
580
578
  }
581
579
  if (!o.module.checkAttributes)
582
580
  return;
583
- let s;
581
+ let r;
584
582
  try {
585
- s = await this.getLibraryData(
583
+ r = await this.getLibraryData(
586
584
  o.group
587
585
  )?.getAttributesDropDownValues(o.module, e);
588
586
  } catch (i) {
589
587
  console.error(i);
590
588
  }
591
- if (!s)
589
+ if (!r)
592
590
  return;
593
- const r = {};
594
- for (const [i, a] of Object.entries(s))
595
- a && a.length > 0 && (r[i] = {
591
+ const s = {};
592
+ for (const [i, a] of Object.entries(r))
593
+ a && a.length > 0 && (s[i] = {
596
594
  calcResult: a.map((n) => ({
597
595
  value: n.value,
598
596
  kind: n.kind
599
597
  }))
600
598
  });
599
+ return s;
600
+ }
601
+ async getVerifiedGroupAttributeOptions(t, e) {
602
+ const o = this._getGroup(t);
603
+ if (!o) {
604
+ console.error("Group not found");
605
+ return;
606
+ }
607
+ const r = this.getLibraryData(o.posDataJson);
608
+ if (!r || !r.masterData)
609
+ return;
610
+ const s = e ? Array.isArray(e) ? e : [e] : [], i = this._groupAttributesByModule(
611
+ o,
612
+ r,
613
+ s
614
+ );
615
+ if (i.size === 0)
616
+ return;
617
+ const a = await this._collectAllOptionsPerAttribute(
618
+ i,
619
+ r
620
+ );
621
+ return this._calculateCombinedResults(a);
622
+ }
623
+ _groupAttributesByModule(t, e, o) {
624
+ const r = /* @__PURE__ */ new Map();
625
+ for (const s of o) {
626
+ const i = [];
627
+ for (const a of t.posDataJson.roots)
628
+ this._collectModulesWithAttribute(
629
+ a,
630
+ s,
631
+ e.masterData,
632
+ i
633
+ );
634
+ for (const a of i) {
635
+ const n = r.get(a.id);
636
+ n ? n.attributeIds.push(s) : r.set(a.id, {
637
+ module: a,
638
+ attributeIds: [s]
639
+ });
640
+ }
641
+ }
601
642
  return r;
602
643
  }
644
+ async _collectAllOptionsPerAttribute(t, e) {
645
+ const o = /* @__PURE__ */ new Map();
646
+ for (const { module: r, attributeIds: s } of t.values())
647
+ if (r.checkAttributes)
648
+ try {
649
+ const i = await e.getAttributesDropDownValues(
650
+ r,
651
+ s
652
+ );
653
+ if (!i)
654
+ continue;
655
+ for (const a of s) {
656
+ const n = i[a];
657
+ if (n && n.length > 0) {
658
+ let l = o.get(a);
659
+ l || (l = /* @__PURE__ */ new Map(), o.set(a, l));
660
+ for (const d of n) {
661
+ const h = l.get(d.value);
662
+ h ? l.set(
663
+ d.value,
664
+ this._getMoreRestrictedKind(h, d.kind)
665
+ ) : l.set(d.value, d.kind);
666
+ }
667
+ }
668
+ }
669
+ } catch (i) {
670
+ console.error(i);
671
+ }
672
+ return o;
673
+ }
674
+ _calculateCombinedResults(t) {
675
+ const e = {};
676
+ for (const [o, r] of t.entries()) {
677
+ const s = [];
678
+ for (const [i, a] of r.entries())
679
+ s.push({ value: i, kind: a });
680
+ s.sort(
681
+ (i, a) => this._getKindRank(i.kind) - this._getKindRank(a.kind)
682
+ ), s.length > 0 && (e[o] = { calcResult: s });
683
+ }
684
+ return Object.keys(e).length > 0 ? e : void 0;
685
+ }
686
+ _getKindRank(t) {
687
+ switch (t) {
688
+ case A.Normal:
689
+ return 0;
690
+ case A.Conflicting:
691
+ return 1;
692
+ case A.Invalid:
693
+ return 2;
694
+ default:
695
+ return 3;
696
+ }
697
+ }
698
+ _getMoreRestrictedKind(t, e) {
699
+ return this._getKindRank(t) > this._getKindRank(e) ? t : e;
700
+ }
701
+ _collectModulesWithAttribute(t, e, o, r) {
702
+ if (o.modules.find((i) => i.id === t.name)?.assignedAttributes.includes(e) && r.push(t), t.modules)
703
+ for (const i of t.modules)
704
+ this._collectModulesWithAttribute(
705
+ i,
706
+ e,
707
+ o,
708
+ r
709
+ );
710
+ }
603
711
  updateAdditionalInfo(t, e) {
604
712
  const o = this._findRootModuleInAllGroups(t);
605
713
  if (!o) {
@@ -611,10 +719,10 @@ class D {
611
719
  o.rootModule.additionalText = e, this._designerRequests.loadPosGroups(o.group, {}), this._groupsModified([], o.group, []);
612
720
  }
613
721
  async swapRootModule(t, e, o) {
614
- const s = this._getGroup(t);
615
- if (!s)
722
+ const r = this._getGroup(t);
723
+ if (!r)
616
724
  return;
617
- const r = s.posDataJson, i = r.roots.find(
725
+ const s = r.posDataJson, i = s.roots.find(
618
726
  (p) => p.id === e
619
727
  );
620
728
  if (!i)
@@ -626,13 +734,13 @@ class D {
626
734
  return;
627
735
  const l = n[0];
628
736
  i && this._applyImplicitRelevantAttributes(
629
- this._getLibraryIdForPosData(r),
737
+ this._getLibraryIdForPosData(s),
630
738
  i,
631
739
  [l]
632
- ), l.articlePos = i.articlePos, l.rotationY = i.rotationY, r.roots = r.roots.filter(
740
+ ), l.articlePos = i.articlePos, l.rotationY = i.rotationY, s.roots = s.roots.filter(
633
741
  (p) => p.id !== e
634
- ), r.roots.push(l);
635
- const d = this._calculateAndUpdateGroupMap(s), h = {
742
+ ), s.roots.push(l);
743
+ const d = this._calculateAndUpdateGroupMap(r), h = {
636
744
  originalModuleId: e,
637
745
  newModuleId: l.id
638
746
  };
@@ -642,9 +750,9 @@ class D {
642
750
  moduleIdMap: [h]
643
751
  }), this._groupsModified([], d, []);
644
752
  }
645
- _modifyAttributeOfModules(t, e, o, s) {
646
- const r = Array.isArray(e) ? e : [e], i = this.getLibraryData(t.posDataJson);
647
- for (const n of r) {
753
+ _modifyAttributeOfModules(t, e, o, r) {
754
+ const s = Array.isArray(e) ? e : [e], i = this.getLibraryData(t.posDataJson);
755
+ for (const n of s) {
648
756
  const l = this._findModule(
649
757
  t.posDataJson.roots,
650
758
  n
@@ -653,9 +761,9 @@ class D {
653
761
  const d = i.solveModuleAttributeConflict(
654
762
  l,
655
763
  o,
656
- s
764
+ r
657
765
  );
658
- this._setAttribute(l, o, s), d && d.length > 0 && d.forEach((h) => {
766
+ this._setAttribute(l, o, r), d && d.length > 0 && d.forEach((h) => {
659
767
  h.value !== void 0 && this._setAttribute(
660
768
  l,
661
769
  h.id,
@@ -668,27 +776,27 @@ class D {
668
776
  }
669
777
  _setAttribute(t, e, o) {
670
778
  if (t.attributes && t.attributes.length > 0) {
671
- const r = t.attributes.find((i) => i.id === e);
672
- if (r) {
673
- r.value = o, r.isInput = !0;
779
+ const s = t.attributes.find((i) => i.id === e);
780
+ if (s) {
781
+ s.value = o, s.isInput = !0;
674
782
  return;
675
783
  }
676
784
  }
677
- const s = {
785
+ const r = {
678
786
  id: e,
679
787
  value: o,
680
788
  isInput: !0
681
789
  };
682
- t.attributes ? t.attributes.push(s) : t.attributes = [s];
790
+ t.attributes ? t.attributes.push(r) : t.attributes = [r];
683
791
  }
684
792
  findValidSubArticles(t) {
685
793
  this._validSubArticles = [];
686
794
  const e = Array.isArray(t) ? t : [t];
687
795
  for (const o of e) {
688
- const s = this._getGroup(o);
689
- if (!s)
796
+ const r = this._getGroup(o);
797
+ if (!r)
690
798
  continue;
691
- const r = s.posDataJson, { libraryId: i, libraryData: a } = this._getLibrary(r);
799
+ const s = r.posDataJson, { libraryId: i, libraryData: a } = this._getLibrary(s);
692
800
  if (!a)
693
801
  continue;
694
802
  const n = Array.from(
@@ -696,7 +804,7 @@ class D {
696
804
  ).filter((l) => l.libraryId === i);
697
805
  try {
698
806
  const l = a.getValidSubArticles(
699
- r,
807
+ s,
700
808
  n,
701
809
  a.masterData
702
810
  );
@@ -716,8 +824,8 @@ class D {
716
824
  const o = this._getValidSubArticle(e);
717
825
  if (!o)
718
826
  return [];
719
- const s = Array.isArray(t) ? t : [t], r = [];
720
- for (const i of s) {
827
+ const r = Array.isArray(t) ? t : [t], s = [];
828
+ for (const i of r) {
721
829
  const a = this._getGroup(i);
722
830
  if (!a)
723
831
  continue;
@@ -729,52 +837,58 @@ class D {
729
837
  o,
730
838
  l.masterData
731
839
  );
732
- r.push(...Array.from(d));
840
+ s.push(...Array.from(d));
733
841
  } catch (d) {
734
842
  console.error(d);
735
843
  }
736
844
  }
737
- return r;
845
+ return s;
738
846
  }
739
847
  addSubArticle(t, e, o) {
740
- const s = this._getValidSubArticle(t);
741
- if (!s)
742
- return;
743
- const { group: r } = this._findRootModuleInAllGroups(e);
848
+ const r = this._getValidSubArticle(t);
744
849
  if (!r)
745
850
  return;
851
+ const { group: s } = this._findRootModuleInAllGroups(e);
852
+ if (!s)
853
+ return;
746
854
  const i = this._addSubArticle(
747
- r,
748
855
  s,
856
+ r,
749
857
  e,
750
858
  o
751
859
  );
752
860
  this._designerRequests.loadPosGroups(i, {}), this._groupsModified([], i, []);
753
861
  }
754
- async savePlanSnapshot() {
755
- const t = await this._designerRequests.saveExternalObjectSnapshot();
756
- return t ? {
757
- id: t.planSnapshotId,
758
- perspectiveImageLink: t.perspectiveImageLink,
759
- topImageLink: t.topImageLink,
760
- room3dLink: t.objectGlbLink,
761
- room3dFullLink: t.fullPlanGlbLink
762
- } : (console.error("Failed to save plan snapshot"), null);
862
+ deleteSubArticles(t, e) {
863
+ const o = this._getGroup(t);
864
+ if (!o)
865
+ return;
866
+ const r = o.posDataJson, s = Array.isArray(e) ? e : [e];
867
+ let i = r;
868
+ for (const a of s) {
869
+ const n = this._findSubModule(i.roots, a);
870
+ n && (i = this._deleteSubArticle(
871
+ i,
872
+ n.rootModule.id,
873
+ n.module.id
874
+ ));
875
+ }
876
+ this._designerRequests.loadPosGroups(i, {}), this._groupsModified([], i, []);
763
877
  }
764
878
  _findRootModuleInAllGroups(t) {
765
879
  for (const e of this._groupMap.values()) {
766
- const o = e.posDataJson, s = o.roots.find(
767
- (r) => r.id === t
880
+ const o = e.posDataJson, r = o.roots.find(
881
+ (s) => s.id === t
768
882
  );
769
- if (s !== void 0)
770
- return { group: o, rootModule: s };
883
+ if (r !== void 0)
884
+ return { group: o, rootModule: r };
771
885
  }
772
886
  }
773
887
  _findModuleInAllGroups(t) {
774
888
  for (const e of this._groupMap.values()) {
775
- const o = e.posDataJson, s = this._findModule(o.roots, t);
776
- if (s !== void 0)
777
- return { group: o, module: s };
889
+ const o = e.posDataJson, r = this._findModule(o.roots, t);
890
+ if (r !== void 0)
891
+ return { group: o, module: r };
778
892
  }
779
893
  }
780
894
  _findModule(t, e) {
@@ -782,9 +896,20 @@ class D {
782
896
  if (o.id === e)
783
897
  return o;
784
898
  if (o.modules && o.modules.length > 0) {
785
- const s = this._findModule(o.modules, e);
786
- if (s !== void 0)
787
- return s;
899
+ const r = this._findModule(o.modules, e);
900
+ if (r !== void 0)
901
+ return r;
902
+ }
903
+ }
904
+ }
905
+ _findSubModule(t, e) {
906
+ for (const o of t) {
907
+ if (o.id === e)
908
+ return { rootModule: o, module: o };
909
+ if (o.modules && o.modules.length > 0) {
910
+ const r = this._findSubModule(o.modules, e);
911
+ if (r !== void 0)
912
+ return { rootModule: o, module: r.module };
788
913
  }
789
914
  }
790
915
  }
@@ -805,10 +930,10 @@ class D {
805
930
  return t.length < 4 && (t = "0".repeat(4 - t.length) + t), "id" + t;
806
931
  }
807
932
  async _groupsModified(t, e, o) {
808
- const s = Array.isArray(t) ? t : [t];
809
- s.length > 0 && await this._hiCallbacks?.onPosGroupAdded(s);
810
- const r = Array.isArray(e) ? e : [e];
811
- r.length > 0 && await this._hiCallbacks?.onPosGroupChanged(r);
933
+ const r = Array.isArray(t) ? t : [t];
934
+ r.length > 0 && await this._hiCallbacks?.onPosGroupAdded(r);
935
+ const s = Array.isArray(e) ? e : [e];
936
+ s.length > 0 && await this._hiCallbacks?.onPosGroupChanged(s);
812
937
  const i = Array.isArray(o) ? o : [o];
813
938
  i.length > 0 && await this._hiCallbacks?.onPosGroupDeleted(i), this._calculatePrice();
814
939
  }
@@ -819,167 +944,151 @@ class D {
819
944
  this._hiCallbacks?.onPriceCalc(t);
820
945
  }
821
946
  _calculate(t) {
822
- const { libraryId: e, libraryData: o } = this._getLibrary(t);
823
- if (!o)
824
- return null;
825
- const s = g(t);
826
- s.libraryId = e, s.logMessages && (s.logMessages = []);
827
- let r = s;
828
- try {
829
- r = o.calculateGroup(s);
830
- } catch (i) {
831
- console.error("Error calculating group:", i);
832
- }
833
- return this._takeOverPropertiesFromOriginalGroup(
834
- e,
835
- o,
947
+ const e = this._updatePosData(
836
948
  t,
837
- r
838
- ), r;
949
+ (o, r) => {
950
+ try {
951
+ return r.calculateGroup(o);
952
+ } catch (s) {
953
+ console.error("Error adding sub article to group:", s);
954
+ }
955
+ return o;
956
+ }
957
+ );
958
+ return e || null;
839
959
  }
840
- _addSubArticle(t, e, o, s) {
841
- const { libraryId: r, libraryData: i } = this._getLibrary(t);
842
- if (!i)
960
+ _addSubArticle(t, e, o, r) {
961
+ const s = this._updatePosData(
962
+ t,
963
+ (i, a) => {
964
+ try {
965
+ const n = a.addSubArticle(
966
+ i,
967
+ e,
968
+ o,
969
+ r
970
+ );
971
+ return a.calculateGroup(n);
972
+ } catch (n) {
973
+ console.error("Error adding sub article to group:", n);
974
+ }
975
+ return i;
976
+ }
977
+ );
978
+ return s ? (this._addGroupToMap(s.id, s), s) : null;
979
+ }
980
+ _deleteSubArticle(t, e, o) {
981
+ const r = this._updatePosData(
982
+ t,
983
+ (s, i) => {
984
+ try {
985
+ const a = i.deleteSubArticle(
986
+ s,
987
+ e,
988
+ o
989
+ );
990
+ return i.calculateGroup(a);
991
+ } catch (a) {
992
+ console.error("Error adding sub article to group:", a);
993
+ }
994
+ return s;
995
+ }
996
+ );
997
+ return r ? (this._addGroupToMap(r.id, r), r) : null;
998
+ }
999
+ _updatePosData(t, e) {
1000
+ const { libraryId: o, libraryData: r } = this._getLibrary(t);
1001
+ if (!r)
843
1002
  return null;
844
- const a = g(t);
845
- a.libraryId = r, a.logMessages && (a.logMessages = []);
846
- let n = a;
847
- try {
848
- n = i.addSubArticle(
849
- a,
850
- e,
851
- o,
852
- s
853
- ), n = i.calculateGroup(n);
854
- } catch (l) {
855
- console.error("Error adding sub article to group:", l);
856
- }
1003
+ const s = g(t);
1004
+ s.libraryId = o, s.logMessages && (s.logMessages = []);
1005
+ const i = e(s, r);
857
1006
  return this._takeOverPropertiesFromOriginalGroup(
1007
+ o,
858
1008
  r,
859
- i,
860
1009
  t,
861
- n
862
- ), this._addGroupToMap(n.id, n), n;
1010
+ i
1011
+ ), i;
863
1012
  }
864
1013
  _getLibrary(t) {
865
1014
  const e = this._getLibraryIdForPosData(t), o = this.getLibraryData(e);
866
1015
  return { libraryId: e, libraryData: o };
867
1016
  }
868
- _takeOverPropertiesFromOriginalGroup(t, e, o, s) {
869
- o.pos !== void 0 && (s.pos = o.pos), o.rotationY !== void 0 && (s.rotationY = o.rotationY);
870
- const r = e.masterData;
871
- s.roots.forEach((i) => {
1017
+ _takeOverPropertiesFromOriginalGroup(t, e, o, r) {
1018
+ o.pos !== void 0 && (r.pos = o.pos), o.rotationY !== void 0 && (r.rotationY = o.rotationY);
1019
+ const s = e.masterData;
1020
+ r.roots.forEach((i) => {
872
1021
  const a = o.roots.find(
873
1022
  (l) => l.id === i.id
874
- ), n = r?.modules.find((l) => l.id === i.name);
875
- i.libraryId = a?.libraryId ?? t, i.articleName = a?.articleName ?? a?.articleId ?? n?.name ?? n?.id, i.articleId = a?.articleId ?? a?.articleName ?? n?.id ?? n?.name, i.imageUrl = a?.imageUrl ?? n?.imageUrl, i.desc = a?.desc ?? n?.desc, i.category = a?.category, i.additionalText = a?.additionalText, i.canBeDeleted === void 0 && (i.canBeDeleted = !i.isGenerated), this._setSubmoduleImages(i, r);
1023
+ ), n = s?.modules.find((l) => l.id === i.name);
1024
+ i.libraryId = a?.libraryId ?? t, i.articleName = a?.articleName ?? a?.articleId ?? n?.name ?? n?.id, i.articleId = a?.articleId ?? a?.articleName ?? n?.id ?? n?.name, i.imageUrl = a?.imageUrl ?? n?.imageUrl, i.desc = a?.desc ?? n?.desc, i.category = a?.category, i.additionalText = a?.additionalText, i.canBeDeleted === void 0 && (i.canBeDeleted = !i.isGenerated), this._setSubmoduleImages(i, s);
876
1025
  });
877
1026
  }
878
1027
  }
879
1028
  const c = [];
880
1029
  for (let u = 0; u < 256; ++u)
881
1030
  c.push((u + 256).toString(16).slice(1));
882
- function C(u, t = 0) {
1031
+ function P(u, t = 0) {
883
1032
  return (c[u[t + 0]] + c[u[t + 1]] + c[u[t + 2]] + c[u[t + 3]] + "-" + c[u[t + 4]] + c[u[t + 5]] + "-" + c[u[t + 6]] + c[u[t + 7]] + "-" + c[u[t + 8]] + c[u[t + 9]] + "-" + c[u[t + 10]] + c[u[t + 11]] + c[u[t + 12]] + c[u[t + 13]] + c[u[t + 14]] + c[u[t + 15]]).toLowerCase();
884
1033
  }
885
- let S;
886
- const P = new Uint8Array(16);
1034
+ let D;
1035
+ const C = new Uint8Array(16);
887
1036
  function v() {
888
- if (!S) {
1037
+ if (!D) {
889
1038
  if (typeof crypto > "u" || !crypto.getRandomValues)
890
1039
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
891
- S = crypto.getRandomValues.bind(crypto);
1040
+ D = crypto.getRandomValues.bind(crypto);
892
1041
  }
893
- return S(P);
1042
+ return D(C);
894
1043
  }
895
- const E = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), M = { randomUUID: E };
896
- function T(u, t, e) {
897
- if (M.randomUUID && !t && !u)
898
- return M.randomUUID();
1044
+ const T = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), G = { randomUUID: T };
1045
+ function E(u, t, e) {
1046
+ if (G.randomUUID && !t && !u)
1047
+ return G.randomUUID();
899
1048
  u = u || {};
900
1049
  const o = u.random || (u.rng || v)();
901
1050
  if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, t) {
902
1051
  e = e || 0;
903
- for (let s = 0; s < 16; ++s)
904
- t[e + s] = o[s];
1052
+ for (let r = 0; r < 16; ++r)
1053
+ t[e + r] = o[r];
905
1054
  return t;
906
1055
  }
907
- return C(o);
1056
+ return P(o);
908
1057
  }
909
1058
  const F = (u, t) => {
910
- u.callbacks.onMergeExternalObjectGroup = (e, o, s) => {
911
- t.mergeGroups(e, o, s);
912
- }, u.callbacks.onSplitExternalObjectGroup = (e, o) => {
913
- t.splitRootModuleFromGroup(e, o);
914
- }, u.callbacks.onExternalObjectGroupArrangementChanged = (e) => {
915
- t.arrangeRootModulesOfGroup(e);
916
- }, u.callbacks.onDeleteExternalObjectGroup = (e) => {
917
- t.removedGroup(e);
918
- }, u.callbacks.onDeleteExternalObjectRootModule = (e, o, s) => {
919
- t.deleteRootModule(
920
- e,
921
- o,
922
- s ?? []
923
- );
924
- }, u.callbacks.onDeleteExternalObjectSubModule = (e, o) => {
925
- }, u.callbacks.onDuplicateExternalObjectGroup = (e, o) => {
926
- t.duplicateGroup(o);
927
- }, u.callbacks.onChangedExternalObjectGroupPlan = (e) => {
928
- t.changedGroupPlanningSituation(e);
929
- }, u.callbacks.onExternalObjectEnvironmentChanged = (e) => {
930
- }, u.callbacks.onExternalObjectGroupChanged = (e) => {
931
- const o = JSON.parse(e);
932
- t.changedGroupFromHistory(o, !1);
933
- }, u.callbacks.onExternalObjectGroupLoaded = (e) => {
934
- const o = JSON.parse(e);
935
- t.loadedGroup(o);
936
- }, u.callbacks.onExternalObjectAttributeChanged = (e, o, s, r) => {
937
- Array.isArray(o) ? t.modifyAttribute(e, o, s, r) : t.modifyAttribute(
938
- e,
939
- [
940
- {
941
- groupId: e,
942
- rootModuleId: o,
943
- subModuleId: null
944
- }
945
- ],
946
- s,
947
- r
948
- );
949
- }, u.callbacks.onCompletelyLoaded = () => {
1059
+ u.callbacks.onCompletelyLoaded = () => {
950
1060
  t.groupsCompletelyLoaded();
951
- }, u.callbacks.onPlanSnapshotCreated = (...e) => {
952
- }, u.callbacks.onExternalObjectModuleSelected = (e, o, s) => {
1061
+ }, u.callbacks.onExternalObjectModuleSelected = (e, o, r) => {
953
1062
  t.hiObjectSelection.groupOrModuleSelected(
954
1063
  e,
955
1064
  o,
956
- s
1065
+ r
957
1066
  );
958
1067
  }, u.callbacks.onContextChanged = (e) => {
959
1068
  t.hiObjectSelection.contextChanged(e);
960
- }, u.callbacks.onSelectionChange = (e, o, s, r, i) => {
1069
+ }, u.callbacks.onSelectionChange = (e, o, r, s, i) => {
961
1070
  t.hiObjectSelection.selectionChanged(
962
1071
  e,
963
1072
  o,
964
- s,
965
1073
  r,
1074
+ s,
966
1075
  i
967
1076
  );
968
1077
  }, u.callbacks.onSelectionCancel = (e) => {
969
1078
  t.hiObjectSelection.selectionCancel(e);
970
1079
  };
971
- }, G = (u = /* @__PURE__ */ new Date()) => {
1080
+ }, S = (u = /* @__PURE__ */ new Date()) => {
972
1081
  let t = u.toISOString();
973
1082
  t = t.slice(0, -1);
974
1083
  const e = t.lastIndexOf(".");
975
1084
  let o = t;
976
1085
  e !== -1 && (o = t.substring(0, e + 4) + "0000");
977
- const s = u.getTimezoneOffset(), r = Math.abs(Math.floor(s / 60)), i = Math.abs(s % 60), n = `${s <= 0 ? "+" : "-"}${String(r).padStart(
1086
+ const r = u.getTimezoneOffset(), s = Math.abs(Math.floor(r / 60)), i = Math.abs(r % 60), n = `${r <= 0 ? "+" : "-"}${String(s).padStart(
978
1087
  2,
979
1088
  "0"
980
1089
  )}:${String(i).padStart(2, "0")}`;
981
1090
  return o + n;
982
- }, I = () => ({
1091
+ }, q = () => ({
983
1092
  id: window.uuidv4 ? window.uuidv4() : "00000000-0000-0000-0000-000000000000",
984
1093
  state: "New",
985
1094
  orderNumber: "736362",
@@ -987,8 +1096,8 @@ const F = (u, t) => {
987
1096
  orderDescription: "Lorem ipsum dolor sit amet...",
988
1097
  project: "Single family house Müller John",
989
1098
  personInCharge: "Joe",
990
- orderDate: G(),
991
- deliveryDatePlanned: G(
1099
+ orderDate: S(),
1100
+ deliveryDatePlanned: S(
992
1101
  new Date(Date.now() + 336 * 60 * 60 * 1e3)
993
1102
  ),
994
1103
  addresses: [
@@ -1003,12 +1112,12 @@ const F = (u, t) => {
1003
1112
  ],
1004
1113
  customerName: "Müller & Co.",
1005
1114
  customerNumber: "462642",
1006
- createdAt: G(),
1007
- changedAt: G(),
1115
+ createdAt: S(),
1116
+ changedAt: S(),
1008
1117
  changedBy: "Selfish",
1009
1118
  items: []
1010
- }), q = async (u, t) => {
1011
- const e = await u.getPlanOverview(), o = {}, s = e.objects.reduce((a, n) => (n.catalogItemId && (o[n.catalogItemId] || (o[n.catalogItemId] = 0, a.push(n.catalogItemId)), o[n.catalogItemId]++), a), []), i = (Array.isArray(s) && s.length > 0 ? await u.getRapiAccess().getItems(s) : []).filter((a) => a.manufacturerSKU !== void 0 ? (a.count = o[a.id], !0) : !1);
1119
+ }), N = async (u, t) => {
1120
+ const e = await u.getPlanOverview(), o = {}, r = e.objects.reduce((a, n) => (n.catalogItemId && (o[n.catalogItemId] || (o[n.catalogItemId] = 0, a.push(n.catalogItemId)), o[n.catalogItemId]++), a), []), i = (Array.isArray(r) && r.length > 0 ? await u.getRapiAccess().getItems(r) : []).filter((a) => a.manufacturerSKU !== void 0 ? (a.count = o[a.id], !0) : !1);
1012
1121
  if (Array.isArray(i) && i.length > 0) {
1013
1122
  t.items || (t.items = []);
1014
1123
  let a = t.items.reduce((n, l) => l.items?.length ? n + l.items.length : n, 0);
@@ -1022,37 +1131,47 @@ const F = (u, t) => {
1022
1131
  });
1023
1132
  }
1024
1133
  };
1025
- class N {
1134
+ class U {
1026
1135
  constructor(t, e) {
1027
1136
  this._roomlePlanner = t, this._glueLogic = e;
1028
1137
  }
1029
- async placeOrder(t = !0) {
1030
- const e = await this._glueLogic.savePlanSnapshot();
1031
- if (!e) {
1138
+ async fetchPrice(t, e) {
1139
+ let o = await this._glueLogic.getGroupDataForOrder(t);
1140
+ return await this._fetchOrderDataWithPrice(o, e);
1141
+ }
1142
+ async placeOrder(t = !0, e) {
1143
+ const o = await this._roomlePlanner.saveExternalObjectSnapshot();
1144
+ if (!o) {
1032
1145
  console.error("Could not save plan snapshot before placing order");
1033
1146
  return;
1034
1147
  }
1035
- const o = this._glueLogic.hiCallbacks;
1036
- let s = await this._glueLogic.getGroupDataForOrder(e.id), r = I();
1037
- r.items.push(s);
1038
- const i = t ? await o?.onFetchPrice(r) : null;
1039
- i ? (r = i.orderData, s = r.items[0]) : (r.items.push(s), await q(this._roomlePlanner, s)), Array.isArray(s.additionalData) || (s.additionalData = []), e.perspectiveImageLink && s.additionalData.push({
1148
+ let r = t ? await this._fetchOrderDataWithPrice(o.orderData, e) : null, s;
1149
+ r ? s = r.orderData : (s = this._createOrder(e), s.items.push(o.orderData), await N(this._roomlePlanner, o.orderData)), this._addAdditionalDataToOrder(s.items[0], o), await this._glueLogic.hiCallbacks?.onPlaceOrder(s);
1150
+ }
1151
+ _addAdditionalDataToOrder(t, e) {
1152
+ Array.isArray(t.additionalData) || (t.additionalData = []), e.perspectiveImageLink && t.additionalData.push({
1040
1153
  type: "Image",
1041
1154
  category: "OverviewImage",
1042
1155
  downloadUri: e.perspectiveImageLink
1043
- }), e.topImageLink && s.additionalData.push({
1156
+ }), e.topImageLink && t.additionalData.push({
1044
1157
  type: "Image",
1045
1158
  category: "AboveImage",
1046
1159
  downloadUri: e.topImageLink
1047
- }), e.room3dLink && s.additionalData.push({
1160
+ }), e.objectGlbLink && t.additionalData.push({
1048
1161
  type: "ThreeD",
1049
1162
  category: "ThreeDModel",
1050
- downloadUri: e.room3dLink
1051
- }), await o?.onPlaceOrder(r);
1163
+ downloadUri: e.objectGlbLink
1164
+ });
1052
1165
  }
1053
- async fetchPrice(t) {
1054
- let e = await this._glueLogic.getGroupDataForOrder(t), o = I();
1055
- return o.items.push(e), this._glueLogic.hiCallbacks?.onFetchPrice(o);
1166
+ async _fetchOrderDataWithPrice(t, e) {
1167
+ let o = this._createOrder(e);
1168
+ return o.items.push(t), this._glueLogic.hiCallbacks?.onFetchPrice(o);
1169
+ }
1170
+ _createOrder(t) {
1171
+ return t ? {
1172
+ ...t,
1173
+ items: []
1174
+ } : q();
1056
1175
  }
1057
1176
  }
1058
1177
  class k {
@@ -1067,8 +1186,8 @@ class k {
1067
1186
  }
1068
1187
  _logRequest(t, ...e) {
1069
1188
  let o = t;
1070
- e && e.forEach((s) => {
1071
- o += " " + s;
1189
+ e && e.forEach((r) => {
1190
+ o += " " + r;
1072
1191
  }), this._hiCallbacks.onLogMessage?.("HI REQUEST", o);
1073
1192
  }
1074
1193
  isLibraryLoaded(t) {
@@ -1120,32 +1239,32 @@ class k {
1120
1239
  duplicateGroup(t) {
1121
1240
  this._logRequest("duplicateGroup", t.groupId), this._glueLogic.duplicateGroup(t);
1122
1241
  }
1123
- modifyAttribute(t, e, o, s) {
1242
+ modifyAttribute(t, e, o, r) {
1124
1243
  this._logRequest(
1125
1244
  "modifyAttribute",
1126
1245
  t,
1127
1246
  JSON.stringify(e),
1128
1247
  o,
1129
- s
1248
+ r
1130
1249
  ), this._glueLogic.modifyAttribute(
1131
1250
  t,
1132
1251
  e,
1133
1252
  o,
1134
- s
1253
+ r
1135
1254
  );
1136
1255
  }
1137
- updateAttribute(t, e, o, s) {
1256
+ updateAttribute(t, e, o, r) {
1138
1257
  this._logRequest(
1139
1258
  "updateAttribute",
1140
1259
  t,
1141
1260
  e,
1142
1261
  o,
1143
- s.toString()
1262
+ r.toString()
1144
1263
  ), this._glueLogic.updateAttribute(
1145
1264
  t,
1146
1265
  e,
1147
1266
  o,
1148
- s
1267
+ r
1149
1268
  );
1150
1269
  }
1151
1270
  getVerifiedAttributeOptions(t, e) {
@@ -1155,6 +1274,16 @@ class k {
1155
1274
  e ? JSON.stringify(e) : "[]"
1156
1275
  ), this._glueLogic.getVerifiedAttributeOptions(t, e);
1157
1276
  }
1277
+ getVerifiedGroupAttributeOptions(t, e) {
1278
+ return this._logRequest(
1279
+ "getVerifiedGroupAttributeOptions",
1280
+ t,
1281
+ e ? JSON.stringify(e) : "[]"
1282
+ ), this._glueLogic.getVerifiedGroupAttributeOptions(
1283
+ t,
1284
+ e
1285
+ );
1286
+ }
1158
1287
  updateAdditionalInfo(t, e) {
1159
1288
  this._logRequest("updateAdditionalInfo", t, e), this._glueLogic.updateAdditionalInfo(t, e);
1160
1289
  }
@@ -1177,6 +1306,13 @@ class k {
1177
1306
  addSubArticle(t, e, o) {
1178
1307
  this._logRequest("addSubArticle", t, e, o), this._glueLogic.addSubArticle(t, e, o);
1179
1308
  }
1309
+ deleteSubArticles(t, e) {
1310
+ this._logRequest(
1311
+ "deleteSubArticles",
1312
+ t,
1313
+ Array.isArray(e) ? JSON.stringify(e) : e
1314
+ ), this._glueLogic.deleteSubArticles(t, e);
1315
+ }
1180
1316
  swapRootModule(t, e, o) {
1181
1317
  this._logRequest("swapRootModule", t, e, o), this._glueLogic.swapRootModule(t, e, o);
1182
1318
  }
@@ -1217,25 +1353,22 @@ class k {
1217
1353
  getGroupDataForOrder(t) {
1218
1354
  return this._logRequest("getGroupDataForOrder", t), this._glueLogic.getGroupDataForOrder(t);
1219
1355
  }
1220
- savePlanSnapshot() {
1221
- return this._logRequest("savePlanSnapshot"), this._glueLogic.savePlanSnapshot();
1222
- }
1223
1356
  }
1224
- class U {
1357
+ class V {
1225
1358
  constructor(t, e) {
1226
1359
  this._roomDesignerRequests = t, this._hiCallbacks = e;
1227
1360
  }
1228
1361
  _logResponse(t, ...e) {
1229
1362
  let o = t;
1230
- e && e.forEach((s) => {
1231
- o += " " + s;
1363
+ e && e.forEach((r) => {
1364
+ o += " " + r;
1232
1365
  }), this._hiCallbacks.onLogMessage?.("HI RESPONSE", o);
1233
1366
  }
1234
1367
  loadMasterData(t) {
1235
1368
  this._logResponse("loadMasterData"), this._roomDesignerRequests.loadMasterData(t);
1236
1369
  }
1237
1370
  async loadPosGroups(t, e) {
1238
- const o = Array.isArray(t) ? t.map((s) => s.id).join(",") : t.id;
1371
+ const o = Array.isArray(t) ? t.map((r) => r.id).join(",") : t.id;
1239
1372
  return this._logResponse(
1240
1373
  "loadPosGroups",
1241
1374
  o,
@@ -1256,18 +1389,18 @@ class U {
1256
1389
  async selectModule(t, e) {
1257
1390
  return this._logResponse("selectModule", t, e), this._roomDesignerRequests.selectModule(t, e);
1258
1391
  }
1259
- openCloseGroup(t, e, o, s) {
1392
+ openCloseGroup(t, e, o, r) {
1260
1393
  return this._logResponse(
1261
1394
  "openCloseGroup",
1262
1395
  t,
1263
1396
  e,
1264
1397
  o.toString(),
1265
- s.toString()
1398
+ r.toString()
1266
1399
  ), this._roomDesignerRequests.openCloseGroup(
1267
1400
  t,
1268
1401
  e,
1269
1402
  o,
1270
- s
1403
+ r
1271
1404
  ), Promise.resolve();
1272
1405
  }
1273
1406
  deleteGroup(t) {
@@ -1287,22 +1420,22 @@ class U {
1287
1420
  }
1288
1421
  }
1289
1422
  console.warn("Homag Intelligence plugin is loaded.");
1290
- class J extends O {
1423
+ class x extends O {
1291
1424
  constructor() {
1292
- super(), this._roomlePlanner = null, this._api = null, this._glueLogic = null, this._orders = null, window.uuidv4 || (window.uuidv4 = T);
1425
+ super(), this._roomlePlanner = null, this._api = null, this._glueLogic = null, this._orders = null, window.uuidv4 || (window.uuidv4 = E);
1293
1426
  }
1294
1427
  async init(t, e, o) {
1295
1428
  if (this._roomlePlanner = t, this._roomlePlanner.setHomagIntelligence(this), this._api = new R(this._roomlePlanner), e?.debugLogging) {
1296
- const r = new U(this._api, o), i = new D(r, o);
1429
+ const s = new V(this._api, o), i = new M(s, o);
1297
1430
  this._glueLogic = new k(
1298
1431
  i,
1299
1432
  o
1300
1433
  );
1301
1434
  } else
1302
- this._glueLogic = new D(this._api, o);
1435
+ this._glueLogic = new M(this._api, o);
1303
1436
  F(this._roomlePlanner, this._glueLogic);
1304
- const s = await o.onGetSavedPosGroupData() ?? null;
1305
- return this._glueLogic.setPosDataForLoading(s), this._orders = new N(t, this._glueLogic), this;
1437
+ const r = await o.onGetSavedPosGroupData() ?? null;
1438
+ return this._glueLogic.setPosDataForLoading(r), this._orders = new U(t, this._glueLogic), this;
1306
1439
  }
1307
1440
  async loadLibrary(t) {
1308
1441
  if (!this._glueLogic)
@@ -1318,7 +1451,7 @@ class J extends O {
1318
1451
  async _loadLibraryData(t) {
1319
1452
  if (this._glueLogic.isLibraryLoaded(t))
1320
1453
  return this._glueLogic.getLibraryData(t);
1321
- const e = this._glueLogic.hiCallbacks, { masterData: o, libraryExports: s } = await this._requestHiLibrary(
1454
+ const e = this._glueLogic.hiCallbacks, { masterData: o, libraryExports: r } = await this._requestHiLibrary(
1322
1455
  t,
1323
1456
  e
1324
1457
  );
@@ -1326,13 +1459,13 @@ class J extends O {
1326
1459
  libraryId: t,
1327
1460
  masterData: o,
1328
1461
  posGroupVersion: 1,
1329
- calculateGroup: (i) => s.calc(i),
1330
- getOrderData: (i, a) => s.getOrderData(i, a),
1462
+ calculateGroup: (i) => r.calc(i),
1463
+ getOrderData: (i, a, n) => r.getOrderData(i, a, n),
1331
1464
  getAttributesDropDownValues: async (i, a) => {
1332
1465
  const n = a ? Array.isArray(a) ? a : [a] : i.attributes.map((d) => d.id), l = {};
1333
1466
  for (const d of n)
1334
1467
  try {
1335
- const h = s.getAttributesDropDownValues(
1468
+ const h = r.getAttributesDropDownValues(
1336
1469
  i,
1337
1470
  d
1338
1471
  );
@@ -1342,45 +1475,52 @@ class J extends O {
1342
1475
  }
1343
1476
  return l;
1344
1477
  },
1345
- solveModuleAttributeConflict: (i, a, n) => s.solveModuleAttributeConflict ? s.solveModuleAttributeConflict(
1478
+ solveModuleAttributeConflict: (i, a, n) => r.solveModuleAttributeConflict ? r.solveModuleAttributeConflict(
1346
1479
  i,
1347
1480
  a,
1348
1481
  n
1349
1482
  ) : void 0,
1350
1483
  getValidSubArticles(i, a, n) {
1351
- return s.getValidSubArticles ? s.getValidSubArticles(
1484
+ return r.getValidSubArticles ? r.getValidSubArticles(
1352
1485
  i,
1353
1486
  a,
1354
1487
  n
1355
1488
  ) : [];
1356
1489
  },
1357
1490
  getValidContainerModulesForSubArticle(i, a, n) {
1358
- return s.getValidContainerModulesForSubArticle ? s.getValidContainerModulesForSubArticle(
1491
+ return r.getValidContainerModulesForSubArticle ? r.getValidContainerModulesForSubArticle(
1359
1492
  i,
1360
1493
  a,
1361
1494
  n
1362
1495
  ) : [];
1363
1496
  },
1364
1497
  addSubArticle(i, a, n, l) {
1365
- return s.addSubArticle ? s.addSubArticle(
1498
+ return r.addSubArticle ? r.addSubArticle(
1366
1499
  i,
1367
1500
  a,
1368
1501
  n,
1369
1502
  l
1370
1503
  ) : i;
1504
+ },
1505
+ deleteSubArticle(i, a, n) {
1506
+ return r.deleteSubArticle ? r.deleteSubArticle(
1507
+ i,
1508
+ a,
1509
+ n
1510
+ ) : i;
1371
1511
  }
1372
1512
  };
1373
1513
  }
1374
1514
  async _requestHiLibrary(t, e) {
1375
1515
  if (!this._glueLogic)
1376
1516
  throw new Error("GlueLogic not initialized");
1377
- const [o, s] = await Promise.all([
1517
+ const [o, r] = await Promise.all([
1378
1518
  e.onLoadMasterData(t),
1379
1519
  e.onLoadJavascript(t)
1380
- ]), r = await this._initCalcScript(s);
1520
+ ]), s = await this._initCalcScript(r);
1381
1521
  return {
1382
1522
  masterData: o,
1383
- libraryExports: r
1523
+ libraryExports: s
1384
1524
  };
1385
1525
  }
1386
1526
  _loadMasterData(t) {
@@ -1400,14 +1540,14 @@ class J extends O {
1400
1540
  getGlueLogic() {
1401
1541
  return this._glueLogic;
1402
1542
  }
1403
- async placeOrder(t = !0) {
1404
- await this._orders.placeOrder(t);
1543
+ async placeOrder(t = !0, e) {
1544
+ await this._orders.placeOrder(t, e);
1405
1545
  }
1406
- async fetchPrice(t) {
1407
- return this._orders.fetchPrice(t);
1546
+ async fetchPrice(t, e) {
1547
+ return this._orders.fetchPrice(t, e);
1408
1548
  }
1409
1549
  }
1410
1550
  export {
1411
- J as HomagIntelligence
1551
+ x as HomagIntelligence
1412
1552
  };
1413
- //# sourceMappingURL=homag-intelligence-Bq-oBRsz.mjs.map
1553
+ //# sourceMappingURL=homag-intelligence-CngVZKGu.mjs.map