kitchen-simulator 4.4.1 → 4.4.2-new-json

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 (51) hide show
  1. package/es/LiteRenderer.js +15 -53
  2. package/es/catalog/factories/area-factory-3d.js +0 -4
  3. package/es/catalog/holes/door-double/door_double.png +0 -0
  4. package/es/catalog/holes/door-panic/panicDoor.png +0 -0
  5. package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  6. package/es/catalog/holes/gate/gate.jpg +0 -0
  7. package/es/catalog/holes/window-clear/texture.png +0 -0
  8. package/es/catalog/holes/window-cross/texture.png +0 -0
  9. package/es/catalog/holes/window-double-hung/texture.png +0 -0
  10. package/es/catalog/holes/window-vertical/texture.png +0 -0
  11. package/es/catalog/utils/item-loader.js +3 -22
  12. package/es/class/item.js +1 -1
  13. package/es/constants/catalog/skinPanel.js +9 -0
  14. package/es/constants.js +11 -13
  15. package/es/devLiteRenderer.js +91 -109
  16. package/es/mappings/external-events/mapExternalEventPayload.js +21 -0
  17. package/es/mappings/external-events/mappers/addItemMapper.js +86 -0
  18. package/es/mappings/external-events/mappers/ccdfMapper.js +101 -0
  19. package/es/mappings/external-events/mappers/changeDoorStyleMapper.js +65 -0
  20. package/es/mappings/holesToCatalog.js +139 -0
  21. package/es/models.js +3 -1
  22. package/es/utils/helper.js +18 -9
  23. package/es/utils/isolate-event-handler.js +621 -173
  24. package/es/utils/molding.js +20 -236
  25. package/es/utils/skinPanelEngine.js +230 -26
  26. package/lib/LiteRenderer.js +17 -55
  27. package/lib/catalog/factories/area-factory-3d.js +0 -4
  28. package/lib/catalog/holes/door-double/door_double.png +0 -0
  29. package/lib/catalog/holes/door-panic/panicDoor.png +0 -0
  30. package/lib/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  31. package/lib/catalog/holes/gate/gate.jpg +0 -0
  32. package/lib/catalog/holes/window-clear/texture.png +0 -0
  33. package/lib/catalog/holes/window-cross/texture.png +0 -0
  34. package/lib/catalog/holes/window-double-hung/texture.png +0 -0
  35. package/lib/catalog/holes/window-vertical/texture.png +0 -0
  36. package/lib/catalog/utils/item-loader.js +2 -21
  37. package/lib/class/item.js +1 -1
  38. package/lib/constants/catalog/skinPanel.js +15 -0
  39. package/lib/constants.js +16 -18
  40. package/lib/devLiteRenderer.js +93 -111
  41. package/lib/mappings/external-events/mapExternalEventPayload.js +26 -0
  42. package/lib/mappings/external-events/mappers/addItemMapper.js +92 -0
  43. package/lib/mappings/external-events/mappers/ccdfMapper.js +108 -0
  44. package/lib/mappings/external-events/mappers/changeDoorStyleMapper.js +72 -0
  45. package/lib/mappings/holesToCatalog.js +148 -0
  46. package/lib/models.js +3 -1
  47. package/lib/utils/helper.js +20 -9
  48. package/lib/utils/isolate-event-handler.js +620 -172
  49. package/lib/utils/molding.js +20 -237
  50. package/lib/utils/skinPanelEngine.js +232 -28
  51. package/package.json +1 -1
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  import { Map } from 'immutable';
9
- import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, MODE_DRAWING_LINE, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING, EXTERNAL_EVENT_PROJECT_SETTING, PROJECT_SETTING_OPTION, EXTERNAL_EVENT_SYNC_SCENE, INTERNAL_EVENT_SYNC_SCENE, EXTERNAL_EVENT_UPDATE_ATTRIBUTE, ATT_ITEM_POS, ATT_LINE_LENGTH, ATT_VERTEXT_ONE, ATT_VERTEXT_TWO, ATT_HOLE_OFFSET_A, ATT_HOLE_OFFSET_B, UNIT_CENTIMETER, UNIT_INCH, EXTERNAL_EVENT_UPDATE_PROPERTY, PROP_FLIP_DOOR_HANDLE, PROP_OPEN_DOORS, EXTERNAL_EVENT_LOAD_PROJECT, INTERNAL_EVENT_ITEMS_CATALOG, EXTERNAL_EVENT_ADD_HOLE, EXTERNAL_EVENT_CENTERING_2D, EXTERNAL_EVENT_DUPLICATE_ELEMENT, EXTERNAL_EVENT_DELETE_ELEMENT, ELEMENT_HOLE, ELEMENT_ITEM, ELEMENT_LINE, EXTERNAL_EVENT_REPLACE_CABINET, FINISHING_TYPE, EXTERNAL_EVENT_SET_FINISHING, EXTERNAL_EVENT_ROTATE_PAN, DOORSTYLE_SCOPE_SINGLE, DOORSTYLE_SCOPE_ALL, DOORSTYLE_SCOPE_MULTIPLE } from "../constants";
9
+ import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, MODE_DRAWING_LINE, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING, EXTERNAL_EVENT_PROJECT_SETTING, PROJECT_SETTING_OPTION, EXTERNAL_EVENT_SYNC_SCENE, INTERNAL_EVENT_SYNC_SCENE, EXTERNAL_EVENT_UPDATE_ATTRIBUTE, ATT_ITEM_POS, ATT_LINE_LENGTH, ATT_VERTEXT_ONE, ATT_VERTEXT_TWO, ATT_HOLE_OFFSET_A, ATT_HOLE_OFFSET_B, UNIT_CENTIMETER, UNIT_INCH, EXTERNAL_EVENT_UPDATE_PROPERTY, PROP_FLIP_DOOR_HANDLE, PROP_OPEN_DOORS, EXTERNAL_EVENT_LOAD_PROJECT, INTERNAL_EVENT_ITEMS_CATALOG, EXTERNAL_EVENT_ADD_HOLE, EXTERNAL_EVENT_CENTERING_2D, EXTERNAL_EVENT_DUPLICATE_ELEMENT, EXTERNAL_EVENT_DELETE_ELEMENT, ELEMENT_HOLE, ELEMENT_ITEM, ELEMENT_LINE, EXTERNAL_EVENT_REPLACE_CABINET, FINISHING_TYPE, EXTERNAL_EVENT_SET_FINISHING, EXTERNAL_EVENT_ROTATE_PAN, DOORSTYLE_SCOPE_SINGLE, DOORSTYLE_SCOPE_ALL, DOORSTYLE_SCOPE_MULTIPLE, DEFAULT_MOLDING_PIECE_LENGTH } from "../constants";
10
10
  import { isEmpty, updateViwer2D, centering2D } from "./helper";
11
11
  import exporter from "../catalog/utils/exporter";
12
12
  import { render2DItem, render3DItem, render3DApplianceItem, render3DLightingItem } from "../catalog/utils/item-loader";
@@ -18,6 +18,8 @@ import { getMoldingDataOfScene2 } from "./molding";
18
18
  import { Scene, State } from "../models";
19
19
  import { calcDistancesFromHoleToNearestOneOrWall } from "./geometry";
20
20
  import { computeSkinPanels } from "./skinPanelEngine";
21
+ import { mapExternalEventPayload } from "../mappings/external-events/mapExternalEventPayload";
22
+ import { ccdfMapper } from "../mappings/external-events/mappers/ccdfMapper";
21
23
  var PRECISION = 2;
22
24
 
23
25
  // ---- compatibility: supports old + optimized props shapes ----
@@ -40,7 +42,7 @@ var __svgCache = new Map(); // url -> Promise<svgData|null>
40
42
  function loadJSON(_x) {
41
43
  return _loadJSON.apply(this, arguments);
42
44
  }
43
- /***** Update cabinetPayloadData with updatedTempPlaceholders *****/
45
+ /********Parse TempPlaceholder from cabinetPayloadData **************/
44
46
  function _loadJSON() {
45
47
  _loadJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(path) {
46
48
  var p;
@@ -79,27 +81,408 @@ function _loadJSON() {
79
81
  }));
80
82
  return _loadJSON.apply(this, arguments);
81
83
  }
82
- function updateCabinetPayload(_x2) {
84
+ function parseTempPlaceholdersFromCabinetPayload(_x2) {
85
+ return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
86
+ }
87
+ /***** Update cabinetPayloadData with updatedTempPlaceholders *****/
88
+ function _parseTempPlaceholdersFromCabinetPayload() {
89
+ _parseTempPlaceholdersFromCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
90
+ var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, tempPlaceholdersData, _loop, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, k, _cabinetPayload$struc3, _t2, _t3, _t4;
91
+ return _regeneratorRuntime.wrap(function (_context5) {
92
+ while (1) switch (_context5.prev = _context5.next) {
93
+ case 0:
94
+ link = '';
95
+ keys = Object.keys(cabinetPayload.structure_json);
96
+ temp = [];
97
+ i = 0;
98
+ case 1:
99
+ if (!(i < keys.length)) {
100
+ _context5.next = 4;
101
+ break;
102
+ }
103
+ if (!((_cabinetPayload$struc = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc !== void 0 && (_cabinetPayload$struc = _cabinetPayload$struc.toString()) !== null && _cabinetPayload$struc !== void 0 && _cabinetPayload$struc.includes('.gltf') && (_cabinetPayload$struc2 = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc2 !== void 0 && (_cabinetPayload$struc2 = _cabinetPayload$struc2.toString()) !== null && _cabinetPayload$struc2 !== void 0 && _cabinetPayload$struc2.startsWith('http'))) {
104
+ _context5.next = 3;
105
+ break;
106
+ }
107
+ link = cabinetPayload.structure_json[keys[i]];
108
+ _t2 = temp;
109
+ _t3 = keys[i];
110
+ _context5.next = 2;
111
+ return loadJSON(link);
112
+ case 2:
113
+ _t4 = _context5.sent;
114
+ _t2.push.call(_t2, {
115
+ name: _t3,
116
+ data: _t4
117
+ });
118
+ case 3:
119
+ i++;
120
+ _context5.next = 1;
121
+ break;
122
+ case 4:
123
+ tempPlaceholdersData = [];
124
+ _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop(k) {
125
+ var el;
126
+ return _regeneratorRuntime.wrap(function (_context4) {
127
+ while (1) switch (_context4.prev = _context4.next) {
128
+ case 0:
129
+ el = cabinetPayload.structure_json.tempPlaceholders[k].id;
130
+ tempData = {};
131
+ doorKey = 0;
132
+ drawerKey = 0;
133
+ fixedKey = 0;
134
+ doorPHs = 0;
135
+ drawerPHs = 0;
136
+ has_single_door = false;
137
+ fixedPHs = 0;
138
+ temp.forEach(function (t, index) {
139
+ var nodes = t.data.nodes;
140
+ if (nodes === undefined) {
141
+ nodes = [];
142
+ }
143
+ var tempPlaceholders = nodes.filter(function (element) {
144
+ return element.name.startsWith('ph_');
145
+ });
146
+ tempPlaceholders.sort(function (a, b) {
147
+ return a.name > b.name ? 1 : -1;
148
+ });
149
+ if (tempPlaceholders.length > 0) {
150
+ if (t.name === 'base') {
151
+ tempPlaceholders.map(function (element) {
152
+ var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
153
+ if (sink_match && sink_match.length >= 2) {
154
+ var _process$env$API_URL, _cabinetPayload$struc4;
155
+ tempData['sink'] = tempData['sink'] || [];
156
+ tempData['sink'].push(element.name);
157
+ var sink_url = (_process$env$API_URL = process.env.API_URL) !== null && _process$env$API_URL !== void 0 ? _process$env$API_URL :
158
+ // server url from 3DTool env
159
+ import.meta.env.VITE_APP_API_URL + // server url from Host env
160
+ "/uploads/assets/default/".concat(sink_match[1], ".gltf");
161
+ if (cabinetPayload !== null && cabinetPayload !== void 0 && (_cabinetPayload$struc4 = cabinetPayload.structure_json) !== null && _cabinetPayload$struc4 !== void 0 && (_cabinetPayload$struc4 = _cabinetPayload$struc4.tempPlaceholders[k]) !== null && _cabinetPayload$struc4 !== void 0 && _cabinetPayload$struc4.structure) cabinetPayload.structure_json.tempPlaceholders[k].structure.sink = sink_url;
162
+ } else if (temp.some(function (felement) {
163
+ return felement.name.includes('base_drawer');
164
+ }) && element.name.includes('interior_drawer')) {
165
+ var objCnt = temp.filter(function (felement) {
166
+ return felement.name.includes('base_drawer') && !felement.name.includes('_door');
167
+ }).length;
168
+ var phCnt = tempPlaceholders.filter(function (felement) {
169
+ return felement.name.includes('interior');
170
+ }).length;
171
+ drawerPHs = phCnt;
172
+ if (objCnt === 1 || phCnt % objCnt !== 0) {
173
+ if (tempData['base_drawer_1'] === undefined) {
174
+ tempData['base_drawer_1'] = [];
175
+ }
176
+ tempData['base_drawer_1'].push(element.name);
177
+ drawerKey++;
178
+ } else if (objCnt > 1 && phCnt % objCnt === 0) {
179
+ if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
180
+ tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
181
+ }
182
+ tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
183
+ drawerKey++;
184
+ }
185
+ } else if (temp.some(function (felement) {
186
+ return felement.name.includes('base_door');
187
+ }) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
188
+ var _objCnt = temp.filter(function (felement) {
189
+ return felement.name.includes('base_door');
190
+ }).length;
191
+ var _phCnt = tempPlaceholders.filter(function (felement) {
192
+ return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
193
+ }).length;
194
+ doorPHs = _phCnt;
195
+ if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
196
+ if (tempData['base_door_1'] === undefined) {
197
+ tempData['base_door_1'] = [];
198
+ }
199
+ tempData['base_door_1'].push(element.name);
200
+ doorKey++;
201
+ } else if (_objCnt > 1) {
202
+ if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
203
+ tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
204
+ }
205
+ tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
206
+ doorKey++;
207
+ }
208
+ } else if (temp.some(function (felement) {
209
+ return felement.name.includes('base_fixed_drawer_door');
210
+ }) && element.name.includes('_drawer_door_fixed')) {
211
+ var _objCnt2 = temp.filter(function (felement) {
212
+ return felement.name.includes('base_fixed_drawer_door');
213
+ }).length;
214
+ var _phCnt2 = tempPlaceholders.filter(function (felement) {
215
+ return felement.name.includes('_drawer_door_fixed');
216
+ }).length;
217
+ fixedPHs = _phCnt2;
218
+ if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
219
+ if (tempData['base_fixed_drawer_door_1'] === undefined) {
220
+ tempData['base_fixed_drawer_door_1'] = [];
221
+ }
222
+ tempData['base_fixed_drawer_door_1'].push(element.name);
223
+ fixedKey++;
224
+ } else if (_objCnt2 > 1) {
225
+ if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
226
+ tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
227
+ }
228
+ tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
229
+ fixedKey++;
230
+ }
231
+ }
232
+ });
233
+ } else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
234
+ var objCnt = temp.filter(function (felement) {
235
+ return felement.name.includes('base_drawer') && !felement.name.includes('_door');
236
+ }).length;
237
+ if (objCnt === 1 || drawerPHs % objCnt !== 0) {
238
+ if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
239
+ //get drawer door handle placeholders
240
+ var ph_temp = temp.find(function (felement) {
241
+ return felement.name === 'base_drawer_door_1';
242
+ });
243
+ if (ph_temp != undefined) {
244
+ var ph_drawer_door_handle = ph_temp.data.nodes;
245
+ ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
246
+ return element.name.startsWith('ph_') && element.name.includes('handle');
247
+ });
248
+ for (var w = 0; w < drawerPHs; w++) {
249
+ if (!tempData['base_drawer_door_1'].some(function (el) {
250
+ return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
251
+ })) {
252
+ tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
253
+ //add drawer door handle placeholders
254
+ if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
255
+ if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
256
+ }
257
+ }
258
+ }
259
+ } else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
260
+ if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
261
+ //get drawer door handle placeholders
262
+ var ph_temp = temp.find(function (felement) {
263
+ return felement.name === 'base_drawer_door' + t.name.slice(-2);
264
+ });
265
+ if (ph_temp != undefined) {
266
+ var ph_drawer_door_handle = ph_temp.data.nodes;
267
+ ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
268
+ return element.name.startsWith('ph_') && element.name.includes('handle');
269
+ });
270
+ tempPlaceholders.forEach(function (element) {
271
+ if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
272
+ return el === t.name + '/' + element.name;
273
+ })) {
274
+ tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
275
+ //add drawer door handle placeholders
276
+ if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
277
+ if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle' + t.name.slice(-2)].push('base_drawer_door' + t.name.slice(-2) + '/' + ph_drawer_door_handle[0].name);
278
+ }
279
+ });
280
+ }
281
+ }
282
+ } else if (t.name.includes('base_door')) {
283
+ var _objCnt3 = temp.filter(function (felement) {
284
+ return felement.name.includes('base_door');
285
+ }).length;
286
+ tempPlaceholders = tempPlaceholders.filter(function (el) {
287
+ return el.name.includes('handle');
288
+ });
289
+ if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
290
+ if (tempData['door_handle_1'] === undefined) {
291
+ tempData['door_handle_1'] = [];
292
+ }
293
+ var _loop2 = function _loop2() {
294
+ var phname = tempPlaceholders[0].name;
295
+ var newph = undefined;
296
+ if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
297
+ newph = tempPlaceholders.find(function (el) {
298
+ return el.name.isRightPlaceholder();
299
+ });
300
+ }
301
+ if (tempData['base_door_1'][_w].isRightPlaceholder()) {
302
+ newph = tempPlaceholders.find(function (el) {
303
+ return el.name.isLeftPlaceholder();
304
+ });
305
+ }
306
+ if (newph != undefined) {
307
+ phname = newph.name;
308
+ }
309
+ if (doorPHs === 1 && tempPlaceholders.find(function (el) {
310
+ return el.name.isLeftPlaceholder();
311
+ }) != undefined && tempPlaceholders.find(function (el) {
312
+ return el.name.isRightPlaceholder();
313
+ }) != undefined) {
314
+ has_single_door = true;
315
+ }
316
+ if (!tempData['door_handle_1'].some(function (el) {
317
+ return el === 'door_handle_1/' + phname;
318
+ })) {
319
+ tempData['door_handle_1'].push('base_door_1/' + phname);
320
+ }
321
+ };
322
+ for (var _w = 0; _w < doorPHs; _w++) {
323
+ _loop2();
324
+ }
325
+ } else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
326
+ if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
327
+ var phname = tempPlaceholders[0].name;
328
+ var newph = undefined;
329
+ var blAdd = true;
330
+ if (cabinetPayload.is_corner) {
331
+ if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
332
+ newph = tempPlaceholders.find(function (el) {
333
+ return el.name.isLeftPlaceholder();
334
+ });
335
+ } else {
336
+ blAdd = false;
337
+ }
338
+ } else {
339
+ if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
340
+ newph = tempPlaceholders.find(function (el) {
341
+ return el.name.isRightPlaceholder();
342
+ });
343
+ }
344
+ if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
345
+ newph = tempPlaceholders.find(function (el) {
346
+ return el.name.isLeftPlaceholder();
347
+ });
348
+ }
349
+ }
350
+ if (blAdd) {
351
+ if (newph != undefined) {
352
+ phname = newph.name;
353
+ }
354
+ if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
355
+ return el === t.name + '/' + phname;
356
+ })) {
357
+ tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
358
+ }
359
+ }
360
+ }
361
+ } else if (t.name.includes('base_fixed_drawer_door')) {
362
+ var _objCnt4 = temp.filter(function (felement) {
363
+ return felement.name.includes('base_fixed_drawer_door');
364
+ }).length;
365
+ tempPlaceholders = tempPlaceholders.filter(function (el) {
366
+ return el.name.includes('handle');
367
+ });
368
+ if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
369
+ if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
370
+ var _loop3 = function _loop3() {
371
+ var phname = tempPlaceholders[0].name;
372
+ var newph = undefined;
373
+ if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
374
+ newph = tempPlaceholders.find(function (el) {
375
+ return el.name.isRightPlaceholder();
376
+ });
377
+ }
378
+ if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
379
+ newph = tempPlaceholders.find(function (el) {
380
+ return el.name.isLeftPlaceholder();
381
+ });
382
+ }
383
+ if (newph != undefined) {
384
+ phname = newph.name;
385
+ }
386
+ if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
387
+ return el === 'fixed_drawer_door_handle_1/' + phname;
388
+ })) {
389
+ tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
390
+ }
391
+ };
392
+ for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
393
+ _loop3();
394
+ }
395
+ } else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
396
+ if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
397
+ tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
398
+ }
399
+ var _phname = tempPlaceholders[0].name;
400
+ var _newph = undefined;
401
+ if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
402
+ _newph = tempPlaceholders.find(function (el) {
403
+ return el.name.isRightPlaceholder();
404
+ });
405
+ }
406
+ if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
407
+ _newph = tempPlaceholders.find(function (el) {
408
+ return el.name.isLeftPlaceholder();
409
+ });
410
+ }
411
+ if (_newph != undefined) {
412
+ _phname = _newph.name;
413
+ }
414
+ if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
415
+ return el === t.name + '/' + _phname;
416
+ })) {
417
+ tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
418
+ }
419
+ }
420
+ }
421
+ }
422
+ });
423
+ tempPlaceholdersData.push({
424
+ id: parseInt(el, 10),
425
+ placeholders: tempData,
426
+ structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
427
+ });
428
+ case 1:
429
+ case "end":
430
+ return _context4.stop();
431
+ }
432
+ }, _loop);
433
+ });
434
+ k = 0;
435
+ case 5:
436
+ if (!(k < (cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$struc3 = cabinetPayload.structure_json) === null || _cabinetPayload$struc3 === void 0 || (_cabinetPayload$struc3 = _cabinetPayload$struc3.tempPlaceholders) === null || _cabinetPayload$struc3 === void 0 ? void 0 : _cabinetPayload$struc3.length))) {
437
+ _context5.next = 7;
438
+ break;
439
+ }
440
+ return _context5.delegateYield(_loop(k), "t0", 6);
441
+ case 6:
442
+ k++;
443
+ _context5.next = 5;
444
+ break;
445
+ case 7:
446
+ return _context5.abrupt("return", tempPlaceholdersData);
447
+ case 8:
448
+ case "end":
449
+ return _context5.stop();
450
+ }
451
+ }, _callee4);
452
+ }));
453
+ return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
454
+ }
455
+ function updateCabinetPayload(_x3) {
83
456
  return _updateCabinetPayload.apply(this, arguments);
84
457
  }
85
458
  function _updateCabinetPayload() {
86
- _updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
87
- var cabinetPayloadKeys, i, _cabinetPayload$cabin, _cabinetPayload$cabin2;
88
- return _regeneratorRuntime.wrap(function (_context4) {
89
- while (1) switch (_context4.prev = _context4.next) {
459
+ _updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(cabinetPayload) {
460
+ var tempPlaceholders, cabinetPayloadKeys, i;
461
+ return _regeneratorRuntime.wrap(function (_context6) {
462
+ while (1) switch (_context6.prev = _context6.next) {
90
463
  case 0:
464
+ tempPlaceholders = [];
465
+ _context6.next = 1;
466
+ return parseTempPlaceholdersFromCabinetPayload(cabinetPayload);
467
+ case 1:
468
+ tempPlaceholders = _context6.sent;
91
469
  cabinetPayloadKeys = Object.keys(cabinetPayload);
92
470
  for (i = 0; i < cabinetPayloadKeys.length; i++) {
93
471
  if (cabinetPayloadKeys[i] === 'structure_json') {
94
- cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] = (_cabinetPayload$cabin = (_cabinetPayload$cabin2 = cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'][0]) === null || _cabinetPayload$cabin2 === void 0 ? void 0 : _cabinetPayload$cabin2.placeholders) !== null && _cabinetPayload$cabin !== void 0 ? _cabinetPayload$cabin : [];
472
+ // cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] =
473
+ // cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'][0]
474
+ // ?.placeholders ?? [];
475
+
476
+ cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] = tempPlaceholders[0].placeholders;
477
+ cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] = tempPlaceholders;
95
478
  }
96
479
  }
97
- return _context4.abrupt("return", cabinetPayload);
98
- case 1:
480
+ return _context6.abrupt("return", cabinetPayload);
481
+ case 2:
99
482
  case "end":
100
- return _context4.stop();
483
+ return _context6.stop();
101
484
  }
102
- }, _callee4);
485
+ }, _callee5);
103
486
  }));
104
487
  return _updateCabinetPayload.apply(this, arguments);
105
488
  }
@@ -171,34 +554,34 @@ var loadSVGsByItem = /*#__PURE__*/function () {
171
554
  }
172
555
  }, _callee2);
173
556
  }));
174
- return function loadSVGsByItem(_x3) {
557
+ return function loadSVGsByItem(_x4) {
175
558
  return _ref.apply(this, arguments);
176
559
  };
177
560
  }();
178
- function addItemToCatalog(_x4, _x5, _x6, _x7) {
561
+ function addItemToCatalog(_x5, _x6, _x7, _x8) {
179
562
  return _addItemToCatalog.apply(this, arguments);
180
563
  } // Get attributs of current selected element
181
564
  function _addItemToCatalog() {
182
- _addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(element, state, catalogInstance, projectActions) {
565
+ _addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(element, state, catalogInstance, projectActions) {
183
566
  var _elementJs, _elementJs3;
184
567
  var elementJs, outlineSVGData, _state$getIn, _elementJs$structure_, _elementJs$structure_2, _elementJs$structure_3, cds, _cds$find, _elementJs2, currentCdsId, cdsIdx, ttph, updatedStructureJson, catalogElements, catalogElementKeys, catalogItem, k, _catalogElements$cata, tempPlaceholderArray, _catalogItem$structur, newTempPlaceholderArray, mergedTempPlaceholder;
185
- return _regeneratorRuntime.wrap(function (_context5) {
186
- while (1) switch (_context5.prev = _context5.next) {
568
+ return _regeneratorRuntime.wrap(function (_context7) {
569
+ while (1) switch (_context7.prev = _context7.next) {
187
570
  case 0:
188
571
  if (!isEmpty(element === null || element === void 0 ? void 0 : element.name)) {
189
- _context5.next = 1;
572
+ _context7.next = 1;
190
573
  break;
191
574
  }
192
- return _context5.abrupt("return");
575
+ return _context7.abrupt("return");
193
576
  case 1:
194
577
  // clone element
195
578
  elementJs = Object.assign({}, element); // if (isEmpty(catalog?.elements[element.name])) {
196
- _context5.next = 2;
579
+ _context7.next = 2;
197
580
  return loadSVGsByItem(elementJs);
198
581
  case 2:
199
- outlineSVGData = _context5.sent;
582
+ outlineSVGData = _context7.sent;
200
583
  if (!(((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet')) {
201
- _context5.next = 4;
584
+ _context7.next = 4;
202
585
  break;
203
586
  }
204
587
  // move the tempPlaceholder of current door style to first of tempPlaceholders array
@@ -226,13 +609,13 @@ function _addItemToCatalog() {
226
609
  }
227
610
  });
228
611
  if (isEmpty((_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.tempPlaceholders)) {
229
- _context5.next = 4;
612
+ _context7.next = 4;
230
613
  break;
231
614
  }
232
- _context5.next = 3;
615
+ _context7.next = 3;
233
616
  return updateCabinetPayload(elementJs);
234
617
  case 3:
235
- elementJs = _context5.sent;
618
+ elementJs = _context7.sent;
236
619
  case 4:
237
620
  elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
238
621
  outlineSVGData: outlineSVGData,
@@ -249,18 +632,18 @@ function _addItemToCatalog() {
249
632
  k = 0;
250
633
  case 5:
251
634
  if (!(k < catalogElementKeys.length)) {
252
- _context5.next = 7;
635
+ _context7.next = 7;
253
636
  break;
254
637
  }
255
638
  if (!(((_catalogElements$cata = catalogElements[catalogElementKeys[k]]) === null || _catalogElements$cata === void 0 ? void 0 : _catalogElements$cata.itemID) === elementJs.itemID)) {
256
- _context5.next = 6;
639
+ _context7.next = 6;
257
640
  break;
258
641
  }
259
642
  catalogItem = catalogElements[catalogElementKeys[k]];
260
- return _context5.abrupt("continue", 7);
643
+ return _context7.abrupt("continue", 7);
261
644
  case 6:
262
645
  k++;
263
- _context5.next = 5;
646
+ _context7.next = 5;
264
647
  break;
265
648
  case 7:
266
649
  // get old tempPlaceholder array from catalog item
@@ -291,9 +674,9 @@ function _addItemToCatalog() {
291
674
  }
292
675
  case 8:
293
676
  case "end":
294
- return _context5.stop();
677
+ return _context7.stop();
295
678
  }
296
- }, _callee5);
679
+ }, _callee6);
297
680
  }));
298
681
  return _addItemToCatalog.apply(this, arguments);
299
682
  }
@@ -653,15 +1036,15 @@ function getElement(objProps, state) {
653
1036
  }
654
1037
  return curObject;
655
1038
  }
656
- function loadMoldingSvg(_x8) {
1039
+ function loadMoldingSvg(_x9) {
657
1040
  return _loadMoldingSvg.apply(this, arguments);
658
1041
  }
659
1042
  function _loadMoldingSvg() {
660
- _loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(molding) {
661
- return _regeneratorRuntime.wrap(function (_context6) {
662
- while (1) switch (_context6.prev = _context6.next) {
1043
+ _loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(molding) {
1044
+ return _regeneratorRuntime.wrap(function (_context8) {
1045
+ while (1) switch (_context8.prev = _context8.next) {
663
1046
  case 0:
664
- return _context6.abrupt("return", new Promise(function (resolve, reject) {
1047
+ return _context8.abrupt("return", new Promise(function (resolve, reject) {
665
1048
  var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
666
1049
  if (!url) {
667
1050
  // Skip if no SVG URL available
@@ -683,9 +1066,9 @@ function _loadMoldingSvg() {
683
1066
  }));
684
1067
  case 1:
685
1068
  case "end":
686
- return _context6.stop();
1069
+ return _context8.stop();
687
1070
  }
688
- }, _callee6);
1071
+ }, _callee7);
689
1072
  }));
690
1073
  return _loadMoldingSvg.apply(this, arguments);
691
1074
  }
@@ -801,68 +1184,124 @@ function moveAndRotatePan2D3D(eventType, props, payload, state) {
801
1184
  }
802
1185
  }
803
1186
  }
804
- function mergeSameElements(projectItemsCatalog) {
805
- var result = [];
806
- var _loop = function _loop(i) {
807
- var idx = result.findIndex(function (v) {
808
- return v.itemID === projectItemsCatalog[i].itemID;
809
- });
810
- if (idx < 0) result.push(projectItemsCatalog[i]);else {
811
- var _loop2 = function _loop2(j) {
812
- var _result$idx$structure, _result$idx$structure2;
813
- var idx2 = (_result$idx$structure = result[idx].structure_json) === null || _result$idx$structure === void 0 || (_result$idx$structure = _result$idx$structure.tempPlaceholders) === null || _result$idx$structure === void 0 ? void 0 : _result$idx$structure.findIndex(function (v) {
814
- return v.id === projectItemsCatalog[i].structure_json.tempPlaceholders[j].id;
815
- });
816
- if (idx2 < 0) (_result$idx$structure2 = result[idx].structure_json) === null || _result$idx$structure2 === void 0 || (_result$idx$structure2 = _result$idx$structure2.tempPlaceholders) === null || _result$idx$structure2 === void 0 || _result$idx$structure2.push(projectItemsCatalog[i].structure_json.tempPlaceholders[j]);else result[idx].structure_json.tempPlaceholders[idx2] = projectItemsCatalog[i].structure_json.tempPlaceholders[j];
817
- };
818
- for (var j = 0; j < ((_projectItemsCatalog$ = projectItemsCatalog[i].structure_json) === null || _projectItemsCatalog$ === void 0 || (_projectItemsCatalog$ = _projectItemsCatalog$.tempPlaceholders) === null || _projectItemsCatalog$ === void 0 ? void 0 : _projectItemsCatalog$.length); j++) {
819
- var _projectItemsCatalog$;
820
- _loop2(j);
1187
+ function mergeSameElements(_x0) {
1188
+ return _mergeSameElements.apply(this, arguments);
1189
+ }
1190
+ function _mergeSameElements() {
1191
+ _mergeSameElements = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(projectItemsCatalog) {
1192
+ var result, _loop4, i;
1193
+ return _regeneratorRuntime.wrap(function (_context1) {
1194
+ while (1) switch (_context1.prev = _context1.next) {
1195
+ case 0:
1196
+ result = [];
1197
+ _loop4 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop4(i) {
1198
+ var idx, _loop5, j, _projectItemsCatalog$;
1199
+ return _regeneratorRuntime.wrap(function (_context0) {
1200
+ while (1) switch (_context0.prev = _context0.next) {
1201
+ case 0:
1202
+ idx = result.findIndex(function (v) {
1203
+ return v.itemID === projectItemsCatalog[i].itemID;
1204
+ });
1205
+ if (!(idx < 0)) {
1206
+ _context0.next = 1;
1207
+ break;
1208
+ }
1209
+ result.push(projectItemsCatalog[i]);
1210
+ _context0.next = 4;
1211
+ break;
1212
+ case 1:
1213
+ _loop5 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop5(j) {
1214
+ var _result$idx$structure, _result$idx$structure2;
1215
+ var idx2;
1216
+ return _regeneratorRuntime.wrap(function (_context9) {
1217
+ while (1) switch (_context9.prev = _context9.next) {
1218
+ case 0:
1219
+ idx2 = (_result$idx$structure = result[idx].structure_json) === null || _result$idx$structure === void 0 || (_result$idx$structure = _result$idx$structure.tempPlaceholders) === null || _result$idx$structure === void 0 ? void 0 : _result$idx$structure.findIndex(function (v) {
1220
+ return v.id === projectItemsCatalog[i].structure_json.tempPlaceholders[j].id;
1221
+ });
1222
+ if (idx2 < 0) (_result$idx$structure2 = result[idx].structure_json) === null || _result$idx$structure2 === void 0 || (_result$idx$structure2 = _result$idx$structure2.tempPlaceholders) === null || _result$idx$structure2 === void 0 || _result$idx$structure2.push(projectItemsCatalog[i].structure_json.tempPlaceholders[j]);else result[idx].structure_json.tempPlaceholders[idx2] = projectItemsCatalog[i].structure_json.tempPlaceholders[j];
1223
+ case 1:
1224
+ case "end":
1225
+ return _context9.stop();
1226
+ }
1227
+ }, _loop5);
1228
+ });
1229
+ j = 0;
1230
+ case 2:
1231
+ if (!(j < ((_projectItemsCatalog$ = projectItemsCatalog[i].structure_json) === null || _projectItemsCatalog$ === void 0 || (_projectItemsCatalog$ = _projectItemsCatalog$.tempPlaceholders) === null || _projectItemsCatalog$ === void 0 ? void 0 : _projectItemsCatalog$.length))) {
1232
+ _context0.next = 4;
1233
+ break;
1234
+ }
1235
+ return _context0.delegateYield(_loop5(j), "t0", 3);
1236
+ case 3:
1237
+ j++;
1238
+ _context0.next = 2;
1239
+ break;
1240
+ case 4:
1241
+ case "end":
1242
+ return _context0.stop();
1243
+ }
1244
+ }, _loop4);
1245
+ });
1246
+ i = 0;
1247
+ case 1:
1248
+ if (!(i < (projectItemsCatalog === null || projectItemsCatalog === void 0 ? void 0 : projectItemsCatalog.length))) {
1249
+ _context1.next = 3;
1250
+ break;
1251
+ }
1252
+ return _context1.delegateYield(_loop4(i), "t0", 2);
1253
+ case 2:
1254
+ i++;
1255
+ _context1.next = 1;
1256
+ break;
1257
+ case 3:
1258
+ return _context1.abrupt("return", result);
1259
+ case 4:
1260
+ case "end":
1261
+ return _context1.stop();
821
1262
  }
822
- }
823
- };
824
- for (var i = 0; i < (projectItemsCatalog === null || projectItemsCatalog === void 0 ? void 0 : projectItemsCatalog.length); i++) {
825
- _loop(i);
826
- }
827
- return result;
1263
+ }, _callee8);
1264
+ }));
1265
+ return _mergeSameElements.apply(this, arguments);
828
1266
  }
829
- export function handleExternalEvent(_x9) {
1267
+ export function handleExternalEvent(_x1) {
830
1268
  return _handleExternalEvent.apply(this, arguments);
831
1269
  }
832
1270
  function _handleExternalEvent() {
833
- _handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(props) {
1271
+ _handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(props) {
834
1272
  var _evt$payload3, _evt$payload4;
835
- var evt, state, layerId, layer, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop3, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _evt$payload5, doorStyle, itemCDS, applyScope, _evt$payload5$itemIds, itemIds, _layerId, allItems, targetItems, idSet, selectedItemIds, _cdsItems, _loop4, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, measurementUnit, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven3, sceneData, currentTexture, _t2, _t3, _t4;
836
- return _regeneratorRuntime.wrap(function (_context1) {
837
- while (1) switch (_context1.prev = _context1.next) {
1273
+ var state, evt, layerId, layer, catalog, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop6, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _evt$payload5, doorStyle, applyScope, itemCDS, _evt$payload5$itemIds, itemIds, _layerId, allItems, targetItems, idSet, selectedItemIds, ccdf_list, _loop7, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, measurementUnit, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _layer$doorStyle, _currentTexture, _props$configData$mol, _props$configData, _props$configData$ski, _props$configData2, _props$onInternalEven3, sceneData, currentTexture, moldingPieceLength, skinPanelExclusionSKUs, _t5, _t6, _t7;
1274
+ return _regeneratorRuntime.wrap(function (_context14) {
1275
+ while (1) switch (_context14.prev = _context14.next) {
838
1276
  case 0:
839
1277
  // console.log('***external event****', props.externalEvent);
840
- evt = props.externalEvent;
841
1278
  state = getPlannerStateFromProps(props);
842
1279
  if (state) {
843
- _context1.next = 1;
1280
+ _context14.next = 1;
844
1281
  break;
845
1282
  }
846
- return _context1.abrupt("return");
1283
+ return _context14.abrupt("return");
847
1284
  case 1:
1285
+ evt = mapExternalEventPayload(props.externalEvent, state);
848
1286
  layerId = state.getIn(['scene', 'selectedLayer']);
849
1287
  layer = state.getIn(['scene', 'layers', layerId]);
850
- _t2 = evt === null || evt === void 0 ? void 0 : evt.type;
851
- _context1.next = _t2 === EXTERNAL_EVENT_LOAD_PROJECT ? 2 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 7 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 8 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 9 : _t2 === EXTERNAL_EVENT_ADD_WALL ? 10 : _t2 === EXTERNAL_EVENT_ADD_ITEM ? 11 : _t2 === EXTERNAL_EVENT_ADD_HOLE ? 14 : _t2 === EXTERNAL_EVENT_ROTATE_PAN ? 15 : _t2 === EXTERNAL_EVENT_MOVE_PAN ? 15 : _t2 === EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t2 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t2 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 25 : _t2 === EXTERNAL_EVENT_ZOOM_IN ? 26 : _t2 === EXTERNAL_EVENT_ZOOM_OUT ? 27 : _t2 === EXTERNAL_EVENT_CENTERING_2D ? 28 : _t2 === EXTERNAL_EVENT_UNDO ? 29 : _t2 === EXTERNAL_EVENT_REDO ? 30 : _t2 === EXTERNAL_EVENT_SET_MOLDING ? 31 : _t2 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 33 : _t2 === EXTERNAL_EVENT_DELETE_ELEMENT ? 34 : _t2 === EXTERNAL_EVENT_PROJECT_SETTING ? 35 : _t2 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 44 : _t2 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 44 : _t2 === EXTERNAL_EVENT_REPLACE_CABINET ? 45 : _t2 === EXTERNAL_EVENT_SET_FINISHING ? 47 : _t2 === EXTERNAL_EVENT_SYNC_SCENE ? 48 : 49;
1288
+ catalog = state.catalog.toJS();
1289
+ _t5 = evt === null || evt === void 0 ? void 0 : evt.type;
1290
+ _context14.next = _t5 === EXTERNAL_EVENT_LOAD_PROJECT ? 2 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 7 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 8 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 9 : _t5 === EXTERNAL_EVENT_ADD_WALL ? 10 : _t5 === EXTERNAL_EVENT_ADD_ITEM ? 11 : _t5 === EXTERNAL_EVENT_ADD_HOLE ? 14 : _t5 === EXTERNAL_EVENT_ROTATE_PAN ? 15 : _t5 === EXTERNAL_EVENT_MOVE_PAN ? 15 : _t5 === EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t5 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t5 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 25 : _t5 === EXTERNAL_EVENT_ZOOM_IN ? 26 : _t5 === EXTERNAL_EVENT_ZOOM_OUT ? 27 : _t5 === EXTERNAL_EVENT_CENTERING_2D ? 28 : _t5 === EXTERNAL_EVENT_UNDO ? 29 : _t5 === EXTERNAL_EVENT_REDO ? 30 : _t5 === EXTERNAL_EVENT_SET_MOLDING ? 31 : _t5 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 33 : _t5 === EXTERNAL_EVENT_DELETE_ELEMENT ? 34 : _t5 === EXTERNAL_EVENT_PROJECT_SETTING ? 35 : _t5 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 44 : _t5 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 44 : _t5 === EXTERNAL_EVENT_REPLACE_CABINET ? 45 : _t5 === EXTERNAL_EVENT_SET_FINISHING ? 47 : _t5 === EXTERNAL_EVENT_SYNC_SCENE ? 48 : 49;
852
1291
  break;
853
1292
  case 2:
854
1293
  if (!(evt !== null && evt !== void 0 && evt.payload)) {
855
- _context1.next = 6;
1294
+ _context14.next = 6;
856
1295
  break;
857
1296
  }
858
1297
  // prepare item data request
859
1298
  cdsItems = [];
860
1299
  itemKeys = evt !== null && evt !== void 0 && (_evt$payload = evt.payload) !== null && _evt$payload !== void 0 && (_evt$payload = _evt$payload.layers['layer-1']) !== null && _evt$payload !== void 0 && _evt$payload.items ? Object.keys(evt.payload.layers['layer-1'].items) : [];
861
- _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3() {
1300
+ _loop6 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop6() {
862
1301
  var _evt$payload2, _it$properties, _it$properties2, _it$properties3, _it$doorStyle2;
863
1302
  var it;
864
- return _regeneratorRuntime.wrap(function (_context8) {
865
- while (1) switch (_context8.prev = _context8.next) {
1303
+ return _regeneratorRuntime.wrap(function (_context11) {
1304
+ while (1) switch (_context11.prev = _context11.next) {
866
1305
  case 0:
867
1306
  it = evt === null || evt === void 0 || (_evt$payload2 = evt.payload) === null || _evt$payload2 === void 0 || (_evt$payload2 = _evt$payload2.layers['layer-1']) === null || _evt$payload2 === void 0 ? void 0 : _evt$payload2.items[itemKeys[i]]; //////// check altitude of item property and change length from _length (convert length from 'in' fo 'cm')
868
1307
  if (it !== null && it !== void 0 && (_it$properties = it.properties) !== null && _it$properties !== void 0 && (_it$properties = _it$properties.altitude) !== null && _it$properties !== void 0 && _it$properties.length && it !== null && it !== void 0 && (_it$properties2 = it.properties) !== null && _it$properties2 !== void 0 && (_it$properties2 = _it$properties2.altitude) !== null && _it$properties2 !== void 0 && _it$properties2._unit && it !== null && it !== void 0 && (_it$properties3 = it.properties) !== null && _it$properties3 !== void 0 && (_it$properties3 = _it$properties3.altitude) !== null && _it$properties3 !== void 0 && _it$properties3._length && it.properties.altitude.length !== convert(it.properties.altitude._length).from(it.properties.altitude._unit).to('cm')) {
@@ -883,20 +1322,20 @@ function _handleExternalEvent() {
883
1322
  });
884
1323
  case 1:
885
1324
  case "end":
886
- return _context8.stop();
1325
+ return _context11.stop();
887
1326
  }
888
- }, _loop3);
1327
+ }, _loop6);
889
1328
  });
890
1329
  i = 0;
891
1330
  case 3:
892
1331
  if (!(i < itemKeys.length)) {
893
- _context1.next = 5;
1332
+ _context14.next = 5;
894
1333
  break;
895
1334
  }
896
- return _context1.delegateYield(_loop3(), "t0", 4);
1335
+ return _context14.delegateYield(_loop6(), "t0", 4);
897
1336
  case 4:
898
1337
  i++;
899
- _context1.next = 3;
1338
+ _context14.next = 3;
900
1339
  break;
901
1340
  case 5:
902
1341
  newScene = new Scene(evt === null || evt === void 0 ? void 0 : evt.payload);
@@ -911,63 +1350,63 @@ function _handleExternalEvent() {
911
1350
  cdsItems: cdsItems
912
1351
  }
913
1352
  }, /*#__PURE__*/function () {
914
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(result) {
1353
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(result) {
915
1354
  var rt, _i;
916
- return _regeneratorRuntime.wrap(function (_context7) {
917
- while (1) switch (_context7.prev = _context7.next) {
1355
+ return _regeneratorRuntime.wrap(function (_context10) {
1356
+ while (1) switch (_context10.prev = _context10.next) {
918
1357
  case 0:
919
1358
  rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
920
1359
  _i = 0;
921
1360
  case 1:
922
1361
  if (!(_i < (rt === null || rt === void 0 ? void 0 : rt.length))) {
923
- _context7.next = 3;
1362
+ _context10.next = 3;
924
1363
  break;
925
1364
  }
926
- _context7.next = 2;
1365
+ _context10.next = 2;
927
1366
  return addItemToCatalog(rt[_i], tempState, props.catalog, props.projectActions);
928
1367
  case 2:
929
1368
  _i++;
930
- _context7.next = 1;
1369
+ _context10.next = 1;
931
1370
  break;
932
1371
  case 3:
933
1372
  props.projectActions.loadProject(evt.payload);
934
1373
  case 4:
935
1374
  case "end":
936
- return _context7.stop();
1375
+ return _context10.stop();
937
1376
  }
938
- }, _callee7);
1377
+ }, _callee9);
939
1378
  }));
940
- return function (_x0) {
1379
+ return function (_x10) {
941
1380
  return _ref3.apply(this, arguments);
942
1381
  };
943
1382
  }());
944
1383
  } else props.projectActions.loadProject(evt.payload);
945
1384
  case 6:
946
- return _context1.abrupt("continue", 49);
1385
+ return _context14.abrupt("continue", 49);
947
1386
  case 7:
948
1387
  props.projectActions.unselectAll();
949
1388
  props.projectActions.setMode(MODE_IDLE_3D);
950
- return _context1.abrupt("continue", 49);
1389
+ return _context14.abrupt("continue", 49);
951
1390
  case 8:
952
1391
  props.projectActions.setMode(MODE_IDLE);
953
- return _context1.abrupt("continue", 49);
1392
+ return _context14.abrupt("continue", 49);
954
1393
  case 9:
955
1394
  sLineCnt = layer.selected.lines.size;
956
1395
  if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW);
957
- return _context1.abrupt("continue", 49);
1396
+ return _context14.abrupt("continue", 49);
958
1397
  case 10:
959
1398
  if (state.mode === MODE_IDLE || state.mode === MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
960
1399
  props.projectActions.setMode(MODE_IDLE);
961
1400
  props.linesActions.selectToolDrawingLine('wall');
962
1401
  }
963
- return _context1.abrupt("continue", 49);
1402
+ return _context14.abrupt("continue", 49);
964
1403
  case 11:
965
1404
  if (isEmpty(evt === null || evt === void 0 ? void 0 : evt.payload)) {
966
- _context1.next = 13;
1405
+ _context14.next = 13;
967
1406
  break;
968
1407
  }
969
1408
  element = evt.payload;
970
- _context1.next = 12;
1409
+ _context14.next = 12;
971
1410
  return addItemToCatalog(element, state, props.catalog, props.projectActions);
972
1411
  case 12:
973
1412
  // start drawing item
@@ -991,20 +1430,20 @@ function _handleExternalEvent() {
991
1430
  props.projectActions.pushLastSelectedCatalogElementToHistory(element);
992
1431
  props.projectActions.setIsCabinetDrawing(true);
993
1432
  case 13:
994
- return _context1.abrupt("continue", 49);
1433
+ return _context14.abrupt("continue", 49);
995
1434
  case 14:
996
1435
  ARRAY_3D_MODES.includes(state.mode) ? props.holesActions.selectToolDrawingHole3D(evt === null || evt === void 0 || (_evt$payload3 = evt.payload) === null || _evt$payload3 === void 0 ? void 0 : _evt$payload3.holeName) : props.holesActions.selectToolDrawingHole(evt === null || evt === void 0 || (_evt$payload4 = evt.payload) === null || _evt$payload4 === void 0 ? void 0 : _evt$payload4.holeName);
997
- return _context1.abrupt("continue", 49);
1436
+ return _context14.abrupt("continue", 49);
998
1437
  case 15:
999
1438
  moveAndRotatePan2D3D(evt.type, props, evt.payload, state);
1000
- return _context1.abrupt("continue", 49);
1439
+ return _context14.abrupt("continue", 49);
1001
1440
  case 16:
1002
1441
  defaulTitle = 'Untitle';
1003
1442
  props.projectActions.newProject();
1004
1443
  props.projectActions.rename(defaulTitle);
1005
- return _context1.abrupt("continue", 49);
1444
+ return _context14.abrupt("continue", 49);
1006
1445
  case 17:
1007
- _evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, itemCDS = _evt$payload5.itemCDS, applyScope = _evt$payload5.applyScope, _evt$payload5$itemIds = _evt$payload5.itemIds, itemIds = _evt$payload5$itemIds === void 0 ? [] : _evt$payload5$itemIds;
1446
+ _evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, applyScope = _evt$payload5.applyScope, itemCDS = _evt$payload5.itemCDS, _evt$payload5$itemIds = _evt$payload5.itemIds, itemIds = _evt$payload5$itemIds === void 0 ? [] : _evt$payload5$itemIds;
1008
1447
  _layerId = state.getIn(['scene', 'selectedLayer']);
1009
1448
  allItems = state.getIn(['scene', 'layers', _layerId, 'items']).toJS();
1010
1449
  targetItems = []; // Prepare idSet for SINGLE or MULTIPLE
@@ -1017,108 +1456,114 @@ function _handleExternalEvent() {
1017
1456
  // itemIds contains item.id (instance IDs)
1018
1457
  idSet = new Set(itemIds);
1019
1458
  }
1020
- _t3 = applyScope;
1021
- _context1.next = _t3 === DOORSTYLE_SCOPE_ALL ? 18 : _t3 === DOORSTYLE_SCOPE_SINGLE ? 19 : _t3 === DOORSTYLE_SCOPE_MULTIPLE ? 19 : 20;
1459
+ _t6 = applyScope;
1460
+ _context14.next = _t6 === DOORSTYLE_SCOPE_ALL ? 18 : _t6 === DOORSTYLE_SCOPE_SINGLE ? 19 : _t6 === DOORSTYLE_SCOPE_MULTIPLE ? 19 : 20;
1022
1461
  break;
1023
1462
  case 18:
1024
1463
  targetItems = Object.values(allItems);
1025
- return _context1.abrupt("continue", 21);
1464
+ return _context14.abrupt("continue", 21);
1026
1465
  case 19:
1027
1466
  targetItems = Object.values(allItems).filter(function (item) {
1028
1467
  var _idSet;
1029
1468
  return (_idSet = idSet) === null || _idSet === void 0 ? void 0 : _idSet.has(item.id);
1030
1469
  });
1031
- return _context1.abrupt("continue", 21);
1470
+ return _context14.abrupt("continue", 21);
1032
1471
  case 20:
1033
- return _context1.abrupt("continue", 21);
1472
+ return _context14.abrupt("continue", 21);
1034
1473
  case 21:
1035
- _cdsItems = [];
1036
- _loop4 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop4() {
1037
- var _itemCDS$find;
1038
- var item, cdsId;
1039
- return _regeneratorRuntime.wrap(function (_context0) {
1040
- while (1) switch (_context0.prev = _context0.next) {
1474
+ ccdf_list = [];
1475
+ _loop7 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop7() {
1476
+ var item;
1477
+ return _regeneratorRuntime.wrap(function (_context13) {
1478
+ while (1) switch (_context13.prev = _context13.next) {
1041
1479
  case 0:
1042
1480
  item = targetItems[_i2];
1043
- cdsId = (_itemCDS$find = itemCDS.find(function (itCDS) {
1044
- return itCDS.itemID === item.itemID;
1045
- })) === null || _itemCDS$find === void 0 ? void 0 : _itemCDS$find.cabinet_door_style_id;
1046
- if (cdsId && !_cdsItems.some(function (v) {
1047
- return item.itemID === v.itemID && item.name === v.name && cdsId === v.cdsId;
1481
+ if (!ccdf_list.some(function (v) {
1482
+ return item.itemID === v.itemID && item.name === v.name && doorStyle.id === v.doorFinishId;
1048
1483
  })) {
1049
- _cdsItems.push({
1484
+ ccdf_list.push({
1050
1485
  itemID: item.itemID,
1051
1486
  prototype: item.prototype,
1052
1487
  category: item.category,
1053
1488
  name: item.name,
1054
1489
  type: item.type,
1055
1490
  sku_number: item.sku_number,
1056
- cdsId: cdsId
1491
+ doorFinishId: doorStyle.id
1057
1492
  });
1058
1493
  }
1059
1494
  case 1:
1060
1495
  case "end":
1061
- return _context0.stop();
1496
+ return _context13.stop();
1062
1497
  }
1063
- }, _loop4);
1498
+ }, _loop7);
1064
1499
  });
1065
1500
  _i2 = 0;
1066
1501
  case 22:
1067
1502
  if (!(_i2 < targetItems.length)) {
1068
- _context1.next = 24;
1503
+ _context14.next = 24;
1069
1504
  break;
1070
1505
  }
1071
- return _context1.delegateYield(_loop4(), "t1", 23);
1506
+ return _context14.delegateYield(_loop7(), "t1", 23);
1072
1507
  case 23:
1073
1508
  _i2++;
1074
- _context1.next = 22;
1509
+ _context14.next = 22;
1075
1510
  break;
1076
1511
  case 24:
1077
- if (_cdsItems.length > 0) {
1512
+ if (ccdf_list.length > 0) {
1078
1513
  (_props$onInternalEven2 = props.onInternalEvent) === null || _props$onInternalEven2 === void 0 || _props$onInternalEven2.call(props, {
1079
1514
  type: INTERNAL_EVENT_ITEMS_CATALOG,
1080
1515
  value: {
1081
- cdsItems: _cdsItems
1516
+ ccdf_list: ccdf_list
1082
1517
  }
1083
- }, /*#__PURE__*/function () {
1084
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(result) {
1085
- var rt, _i3;
1086
- return _regeneratorRuntime.wrap(function (_context9) {
1087
- while (1) switch (_context9.prev = _context9.next) {
1518
+ },
1519
+ /*#__PURE__*/
1520
+ // result is ccdf_list
1521
+ function () {
1522
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(result) {
1523
+ var mappedCabinetDefinitionList, rt, _i3;
1524
+ return _regeneratorRuntime.wrap(function (_context12) {
1525
+ while (1) switch (_context12.prev = _context12.next) {
1088
1526
  case 0:
1089
- rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
1090
- _i3 = 0;
1527
+ _context12.next = 1;
1528
+ return ccdfMapper(result.ccdf_list, layer, catalog);
1091
1529
  case 1:
1530
+ mappedCabinetDefinitionList = _context12.sent;
1531
+ _context12.next = 2;
1532
+ return mergeSameElements(mappedCabinetDefinitionList);
1533
+ case 2:
1534
+ rt = _context12.sent;
1535
+ _i3 = 0;
1536
+ case 3:
1092
1537
  if (!(_i3 < (rt === null || rt === void 0 ? void 0 : rt.length))) {
1093
- _context9.next = 3;
1538
+ _context12.next = 5;
1094
1539
  break;
1095
1540
  }
1096
- _context9.next = 2;
1541
+ _context12.next = 4;
1097
1542
  return addItemToCatalog(rt[_i3], state, props.catalog, props.projectActions);
1098
- case 2:
1543
+ case 4:
1099
1544
  _i3++;
1100
- _context9.next = 1;
1545
+ _context12.next = 3;
1101
1546
  break;
1102
- case 3:
1547
+ case 5:
1103
1548
  props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
1104
- case 4:
1549
+ case 6:
1105
1550
  case "end":
1106
- return _context9.stop();
1551
+ return _context12.stop();
1107
1552
  }
1108
- }, _callee8);
1553
+ }, _callee0);
1109
1554
  }));
1110
- return function (_x1) {
1555
+ return function (_x11) {
1111
1556
  return _ref4.apply(this, arguments);
1112
1557
  };
1113
1558
  }());
1114
1559
  } else {
1115
1560
  props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
1116
1561
  }
1117
- return _context1.abrupt("continue", 49);
1562
+ return _context14.abrupt("continue", 49);
1118
1563
  case 25:
1119
1564
  _evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, measurementUnit = _evt$payload6.measurementUnit, _doorStyle = _evt$payload6.doorStyle;
1120
1565
  props.projectActions.createRoomWithShape(roomShapeType, width, height, measurementUnit, _doorStyle);
1121
- return _context1.abrupt("continue", 49);
1566
+ return _context14.abrupt("continue", 49);
1122
1567
  case 26:
1123
1568
  value = state.getIn(['viewer2D']).toJS();
1124
1569
  value.a += 0.1;
@@ -1126,7 +1571,7 @@ function _handleExternalEvent() {
1126
1571
  value.e -= value.SVGWidth * 0.1 / 2;
1127
1572
  value.f -= value.SVGHeight * 0.1 / 2;
1128
1573
  updateViwer2D(value, props.viewer2DActions);
1129
- return _context1.abrupt("continue", 49);
1574
+ return _context14.abrupt("continue", 49);
1130
1575
  case 27:
1131
1576
  _value = state.getIn(['viewer2D']).toJS();
1132
1577
  _value.a -= 0.1;
@@ -1134,62 +1579,62 @@ function _handleExternalEvent() {
1134
1579
  _value.e += _value.SVGWidth * 0.1 / 2;
1135
1580
  _value.f += _value.SVGHeight * 0.1 / 2;
1136
1581
  updateViwer2D(_value, props.viewer2DActions);
1137
- return _context1.abrupt("continue", 49);
1582
+ return _context14.abrupt("continue", 49);
1138
1583
  case 28:
1139
1584
  centering2D(state, props.viewer2DActions);
1140
- return _context1.abrupt("continue", 49);
1585
+ return _context14.abrupt("continue", 49);
1141
1586
  case 29:
1142
1587
  props.projectActions.undo();
1143
- return _context1.abrupt("continue", 49);
1588
+ return _context14.abrupt("continue", 49);
1144
1589
  case 30:
1145
1590
  props.projectActions.redo();
1146
- return _context1.abrupt("continue", 49);
1591
+ return _context14.abrupt("continue", 49);
1147
1592
  case 31:
1148
1593
  _evt$payload7 = evt.payload, moldingInfo = _evt$payload7.moldingInfo, isGlobal = _evt$payload7.isGlobal;
1149
- _context1.next = 32;
1594
+ _context14.next = 32;
1150
1595
  return loadMoldingSvg(moldingInfo);
1151
1596
  case 32:
1152
1597
  props.itemsActions.setMolding(moldingInfo, isGlobal);
1153
- return _context1.abrupt("continue", 49);
1598
+ return _context14.abrupt("continue", 49);
1154
1599
  case 33:
1155
1600
  distElement = getElement(evt.payload, state);
1156
1601
  if (distElement) props.itemsActions.duplicateSelected(distElement, props.onInternalEvent);
1157
- return _context1.abrupt("continue", 49);
1602
+ return _context14.abrupt("continue", 49);
1158
1603
  case 34:
1159
1604
  _distElement = getElement(evt.payload, state);
1160
1605
  if (_distElement) props.projectActions.remove(_distElement);
1161
- return _context1.abrupt("continue", 49);
1606
+ return _context14.abrupt("continue", 49);
1162
1607
  case 35:
1163
1608
  _evt$payload8 = evt.payload, option = _evt$payload8.option, _value2 = _evt$payload8.value;
1164
- _t4 = option;
1165
- _context1.next = _t4 === PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 36 : _t4 === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 37 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 38 : _t4 === PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 39 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 40 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 41 : 42;
1609
+ _t7 = option;
1610
+ _context14.next = _t7 === PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 36 : _t7 === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 37 : _t7 === PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 38 : _t7 === PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 39 : _t7 === PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 40 : _t7 === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 41 : 42;
1166
1611
  break;
1167
1612
  case 36:
1168
1613
  props.viewer2DActions.updateCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(_value2));
1169
1614
  props.viewer2DActions.updateCeilHeightUnit(_value2);
1170
1615
  props.viewer3DActions.update3DCeilHeightUnit(_value2);
1171
1616
  props.viewer3DActions.update3DCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(_value2));
1172
- return _context1.abrupt("continue", 43);
1617
+ return _context14.abrupt("continue", 43);
1173
1618
  case 37:
1174
1619
  props.viewer2DActions.updateCeilHeight(_value2);
1175
1620
  props.viewer3DActions.update3DCeilHeight(_value2);
1176
- return _context1.abrupt("continue", 43);
1621
+ return _context14.abrupt("continue", 43);
1177
1622
  case 38:
1178
1623
  props.viewer2DActions.changeWallLengthMeasure(_value2);
1179
- return _context1.abrupt("continue", 43);
1624
+ return _context14.abrupt("continue", 43);
1180
1625
  case 39:
1181
1626
  props.viewer2DActions.changeBaseCabinetMeasure(_value2);
1182
- return _context1.abrupt("continue", 43);
1627
+ return _context14.abrupt("continue", 43);
1183
1628
  case 40:
1184
1629
  props.viewer2DActions.changeWallCabinetMeasure(_value2);
1185
- return _context1.abrupt("continue", 43);
1630
+ return _context14.abrupt("continue", 43);
1186
1631
  case 41:
1187
1632
  props.viewer2DActions.changeWindowDoorMeasure(_value2);
1188
- return _context1.abrupt("continue", 43);
1633
+ return _context14.abrupt("continue", 43);
1189
1634
  case 42:
1190
- return _context1.abrupt("continue", 43);
1635
+ return _context14.abrupt("continue", 43);
1191
1636
  case 43:
1192
- return _context1.abrupt("continue", 49);
1637
+ return _context14.abrupt("continue", 49);
1193
1638
  case 44:
1194
1639
  _layerId2 = state.getIn(['scene', 'selectedLayer']);
1195
1640
  _layer = state.getIn(['scene', 'layers', _layerId2]);
@@ -1197,13 +1642,13 @@ function _handleExternalEvent() {
1197
1642
  for (_i4 = 0; _i4 < selectedLines.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1198
1643
  for (_i5 = 0; _i5 < selectedHoles.size; _i5++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1199
1644
  for (_i6 = 0; _i6 < selectedItems.size; _i6++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1200
- return _context1.abrupt("continue", 49);
1645
+ return _context14.abrupt("continue", 49);
1201
1646
  case 45:
1202
1647
  _layerID = state.scene.selectedLayer;
1203
1648
  _layer2 = state.scene.getIn(['layers', _layerID]).toJS();
1204
1649
  orginalItemInfo = evt === null || evt === void 0 || (_evt$payload9 = evt.payload) === null || _evt$payload9 === void 0 ? void 0 : _evt$payload9.orginalItemInfo;
1205
1650
  originalItem = _layer2 === null || _layer2 === void 0 ? void 0 : _layer2.items[orginalItemInfo.id];
1206
- _context1.next = 46;
1651
+ _context14.next = 46;
1207
1652
  return addItemToCatalog(evt.payload.replaceItemInfo, state, props.catalog, props.projectActions);
1208
1653
  case 46:
1209
1654
  originalItemPos = {
@@ -1220,17 +1665,20 @@ function _handleExternalEvent() {
1220
1665
  }
1221
1666
  };
1222
1667
  props.itemsActions.replaceItem(originalItemPos, originalItem, replaceItem);
1223
- return _context1.abrupt("continue", 49);
1668
+ return _context14.abrupt("continue", 49);
1224
1669
  case 47:
1225
1670
  setFinishing(props, state, evt.payload);
1226
- return _context1.abrupt("continue", 49);
1671
+ return _context14.abrupt("continue", 49);
1227
1672
  case 48:
1228
1673
  sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
1229
- currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
1230
- sceneData.layers[layerId].moldingData = getMoldingDataOfScene2(layer, props.catalog, currentTexture);
1674
+ currentTexture = (_layer$doorStyle = layer === null || layer === void 0 ? void 0 : layer.doorStyle) !== null && _layer$doorStyle !== void 0 ? _layer$doorStyle : props.state.doorStyle;
1675
+ if (!isEmpty(currentTexture) && Map.isMap(currentTexture)) currentTexture = (_currentTexture = currentTexture) === null || _currentTexture === void 0 ? void 0 : _currentTexture.toJS();
1676
+ moldingPieceLength = (_props$configData$mol = props === null || props === void 0 || (_props$configData = props.configData) === null || _props$configData === void 0 ? void 0 : _props$configData.moldingPieceLength) !== null && _props$configData$mol !== void 0 ? _props$configData$mol : DEFAULT_MOLDING_PIECE_LENGTH;
1677
+ sceneData.layers[layerId].moldingData = getMoldingDataOfScene2(layer, props.catalog, currentTexture, moldingPieceLength);
1231
1678
 
1232
1679
  // get skin panel data
1233
- sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer);
1680
+ skinPanelExclusionSKUs = (_props$configData$ski = props === null || props === void 0 || (_props$configData2 = props.configData) === null || _props$configData2 === void 0 ? void 0 : _props$configData2.skinPanelExclusionSKUs) !== null && _props$configData$ski !== void 0 ? _props$configData$ski : [];
1681
+ sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer, skinPanelExclusionSKUs, props.catalog);
1234
1682
 
1235
1683
  // send scene object from 3DTool to HostApp using internalEvent
1236
1684
  (_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
@@ -1239,12 +1687,12 @@ function _handleExternalEvent() {
1239
1687
  scene: sceneData
1240
1688
  }
1241
1689
  });
1242
- return _context1.abrupt("continue", 49);
1690
+ return _context14.abrupt("continue", 49);
1243
1691
  case 49:
1244
1692
  case "end":
1245
- return _context1.stop();
1693
+ return _context14.stop();
1246
1694
  }
1247
- }, _callee9);
1695
+ }, _callee1);
1248
1696
  }));
1249
1697
  return _handleExternalEvent.apply(this, arguments);
1250
1698
  }