@roomle/embedding-lib 5.26.0 → 5.27.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 (25) hide show
  1. package/docs/md/web/embedding/CHANGELOG.md +10 -42
  2. package/package.json +1 -1
  3. package/packages/web-sdk/packages/configurator-core/src/roomle-configurator.d.ts +11 -0
  4. package/packages/web-sdk/packages/configurator-core/src/services/configurator-ui-callback.d.ts +2 -0
  5. package/packages/web-sdk/packages/configurator-core/src/utils/component-dimensioning-helper.d.ts +44 -2
  6. package/packages/web-sdk/packages/configurator-core/src/utils/component-raycast-helper.d.ts +6 -1
  7. package/packages/web-sdk/packages/configurator-core/src/utils/dimensioning-helper.d.ts +1 -0
  8. package/packages/web-sdk/packages/configurator-core/src/webgl/configurator-scene-manager.d.ts +9 -0
  9. package/packages/web-sdk/packages/homag-intelligence/src/api.d.ts +1 -0
  10. package/packages/web-sdk/packages/homag-intelligence/src/emulator.d.ts +3 -2
  11. package/packages/web-sdk/packages/homag-intelligence/src/model/oc-scripts-domain.model.d.ts +3 -1
  12. package/packages/web-sdk/packages/planner-core/src/external-object-api.d.ts +9 -0
  13. package/packages/web-sdk/packages/planner-core/src/roomle-planner.d.ts +3 -2
  14. package/packages/web-sdk/packages/planner-core/src/services/planner-kernel-access.d.ts +1 -0
  15. package/packages/web-sdk/packages/planner-core/src/utils/measurements.d.ts +38 -0
  16. package/packages/web-sdk/packages/planner-core/src/webgl/planner-scene-manager.d.ts +0 -2
  17. package/packages/web-sdk/packages/typings/planner.d.ts +7 -0
  18. package/roomle-embedding-lib.es.js +1 -1
  19. package/roomle-embedding-lib.es.min.js +1 -1
  20. package/roomle-embedding-lib.umd.js +1 -1
  21. package/roomle-embedding-lib.umd.min.js +1 -1
  22. package/src/configurator/components/DimensionLabels.vue.d.ts +2 -0
  23. package/src/configurator/components/parameters/ParameterGroupButton.vue.d.ts +1 -1
  24. package/src/configurator/store/ui-state.d.ts +2 -0
  25. package/src/planner/components/overlays/product-settings/ProductRangeControl.vue.d.ts +1 -1
@@ -1,50 +1,18 @@
1
- ## [5.26.0](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.25.0...embedding-lib-v5.26.0) (2025-08-26)
1
+ ## [5.27.0-alpha.2](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.27.0-alpha.1...embedding-lib-v5.27.0-alpha.2) (2025-09-02)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * Desktop Room Designer - Catalog management new levels ([4eb4179](https://github.com/roomle-dev/roomle-ui/commit/4eb41797f5c032b75bf2b085f9c5d1e7a8287283))
7
- * mobile view, expanding grid views, collapsing, hiding on selection change ([e09153e](https://github.com/roomle-dev/roomle-ui/commit/e09153e2ccc4dd79fdff13342fa332325463d05a))
8
- * router based grid view concept ([18c7968](https://github.com/roomle-dev/roomle-ui/commit/18c79687167c6d05d1d7c549aea451c872d0a335))
9
- * unregistering components ([8e707a0](https://github.com/roomle-dev/roomle-ui/commit/8e707a002cd822d57e9a87acd6073f5ce0319f5c))
10
- * working router view layering system ([447b929](https://github.com/roomle-dev/roomle-ui/commit/447b929dad11aa98fb84e4f59e3fdba21d4d428f))
6
+ * add recasting for measurement labels to check if the associated line is occluded ([094c80d](https://github.com/roomle-dev/roomle-ui/commit/094c80df3ec9267398f5987943e0cb132d946ff4))
7
+ * move the dimensions label from SDK to UI ([fed29f6](https://github.com/roomle-dev/roomle-ui/commit/fed29f6c3b9e5eec3faab3996bfeace271c5c05a))
8
+ * smart positions of measurements label and add collision detection between labels ([ebf82c6](https://github.com/roomle-dev/roomle-ui/commit/ebf82c63c6b9a52e939c799d6b9b8f1becff3d6b))
9
+ * **core:** upgrade to version 2.59.0-alpha.4 ([d370635](https://github.com/roomle-dev/roomle-ui/commit/d3706359b12d6d258d51d8a8466ef143e7951644))
10
+ * **core:** upgrade to version 2.59.0-alpha.5 ([92227a9](https://github.com/roomle-dev/roomle-ui/commit/92227a93bead21f191cd33711ed936426e5ed4b3))
11
+ * **core:** upgrade to version 2.59.0-alpha.6 ([222e9b0](https://github.com/roomle-dev/roomle-ui/commit/222e9b008715e1de03bed9c3306e4eb32ffe0949))
11
12
 
12
13
 
13
14
  ### Bug Fixes
14
15
 
15
- * add glu layer mocks to tests ([1d7f967](https://github.com/roomle-dev/roomle-ui/commit/1d7f9673ac2ccab62b12fc4e3da29f8b8750847b))
16
- * add hack comments ([0d49f18](https://github.com/roomle-dev/roomle-ui/commit/0d49f188613675ccbef154701aa7a3bb3d216251))
17
- * broken drawer behavior on stop configuring while grid view is open ([0c3ff29](https://github.com/roomle-dev/roomle-ui/commit/0c3ff29706ffbdc72be5896a192ac7e0e2cd1442))
18
- * configurator sidebar addon panels ([c04cede](https://github.com/roomle-dev/roomle-ui/commit/c04cededcdc633a196841cac5cd1a89bebb223d3))
19
- * decouple slider value and pause mobile sidebar rendering ([0133047](https://github.com/roomle-dev/roomle-ui/commit/0133047468667d3bc430b3d944b17941f808d8a1))
20
- * e2e passing ([a3763a4](https://github.com/roomle-dev/roomle-ui/commit/a3763a466aadc7ea1f6488e2c6c4e2dafa79a975))
21
- * failing tests ([bf62d13](https://github.com/roomle-dev/roomle-ui/commit/bf62d13b068e92ee124b155ed549f95eb7ff4646))
22
- * feedback fixes ([1085a8c](https://github.com/roomle-dev/roomle-ui/commit/1085a8cdb7737c6f9296449d54680778e27fa579))
23
- * get the catalog showing in the demo ([1138ea6](https://github.com/roomle-dev/roomle-ui/commit/1138ea60ec99043b5776bda25d622a6b509715e2))
24
- * grid view preview elements resorting ([f4f83fb](https://github.com/roomle-dev/roomle-ui/commit/f4f83fb88e0b1c03d0a7e4e99e8f6d9b69f75349))
25
- * hide flying menu on configurator when we animate the camera ([9c771b6](https://github.com/roomle-dev/roomle-ui/commit/9c771b6e293b00e5dbdbae28435962ce1232a925))
26
- * infinite loop on dragging ext obj ([0f925f7](https://github.com/roomle-dev/roomle-ui/commit/0f925f741013ff7ab0bff11aeb3383c8d2c74456))
27
- * labels and interaction bugs ([3e7eedf](https://github.com/roomle-dev/roomle-ui/commit/3e7eedfec5fa8acdb97365db435dc29ce43051fa))
28
- * lint ([43cb27e](https://github.com/roomle-dev/roomle-ui/commit/43cb27e19ac9c0674b692f800048780ccbb52156))
29
- * loading states on variants, active tab bug ([7e8bd10](https://github.com/roomle-dev/roomle-ui/commit/7e8bd109199747f699fef8598892b44140525213))
30
- * make breadcrumb show only on scroll down ([f4de08d](https://github.com/roomle-dev/roomle-ui/commit/f4de08d7d1f8cd013f8eebe457a8d815ed906749))
31
- * material picker ordering ([cc5dcc2](https://github.com/roomle-dev/roomle-ui/commit/cc5dcc2986801328c3603a546d1cbd82160d9f8f))
32
- * merge master ([576491b](https://github.com/roomle-dev/roomle-ui/commit/576491b0fe09c2e105c0b7dd47336f5d1a5f61b2))
33
- * missing import ([2fa496a](https://github.com/roomle-dev/roomle-ui/commit/2fa496acb32aab93c6559225c197075ddba650dd))
34
- * mobile touch start on range sliders ([32ae540](https://github.com/roomle-dev/roomle-ui/commit/32ae540f64278b1b4c056907befa3e5cc764eec5))
35
- * part list scrolling ([b536269](https://github.com/roomle-dev/roomle-ui/commit/b536269b0703ed276fe53f104848a37b889ef6d1))
36
- * re-add semantic-release package ([2fa5967](https://github.com/roomle-dev/roomle-ui/commit/2fa5967bb896ee1f194d0ac9d65fe2eef9fbae62))
37
- * redo removal of uuid ([0cb2869](https://github.com/roomle-dev/roomle-ui/commit/0cb28693f43c1979969e8fbe26e8ae2f288383d4))
38
- * redo removal of uuid ([474751e](https://github.com/roomle-dev/roomle-ui/commit/474751e01a0b8e48f53076324ccc0c77c47e9158))
39
- * removal of unused code ([e184154](https://github.com/roomle-dev/roomle-ui/commit/e184154b89ba598376f06373934316b736fe94ce))
40
- * remove duplicate deps ([c5bdec6](https://github.com/roomle-dev/roomle-ui/commit/c5bdec628e610dd1365e6ca73216a4c086127280))
41
- * revert ([0c99e68](https://github.com/roomle-dev/roomle-ui/commit/0c99e68529b58ea0a10179ddd47025995630b7b5))
42
- * selection highlight visible on snapshot ([8bc47ea](https://github.com/roomle-dev/roomle-ui/commit/8bc47ea5338f8e5e85dedf358a77020d90a8a4bf))
43
- * semantic release again ([52aa5cd](https://github.com/roomle-dev/roomle-ui/commit/52aa5cdd54c72fe52c0746ff9d239a49f8319adb))
44
- * tabbed nav ids ([64b6a6a](https://github.com/roomle-dev/roomle-ui/commit/64b6a6a84cf33d25000007666a50633a3218885b))
45
- * tabbed nav scroller ([6b72823](https://github.com/roomle-dev/roomle-ui/commit/6b72823557e5cc543219fcd2dca3d3cb779c84a1))
46
- * testparty mobile fixes pt 1 ([845ecba](https://github.com/roomle-dev/roomle-ui/commit/845ecba69ae7f705c0d7e17e84934a0895200d15))
47
- * types after merge ([eadccb2](https://github.com/roomle-dev/roomle-ui/commit/eadccb25d3265fc55e345ba0af2ea3833f7ba166))
48
- * various ([b351a18](https://github.com/roomle-dev/roomle-ui/commit/b351a183eb8cd1c4617ac7f29d3efeeee605e57b))
49
- * wall indicator angle ([73e55d5](https://github.com/roomle-dev/roomle-ui/commit/73e55d509bf6f65af9c0409775fc19f8bc70e324))
50
- * working demo ([871d467](https://github.com/roomle-dev/roomle-ui/commit/871d467254aa633cb14d180fca0b0cbb69b80bcd))
16
+ * dimensioning artifact after zoom in ([7a36d6a](https://github.com/roomle-dev/roomle-ui/commit/7a36d6a18c30ed6cae3a10df9c09485d368e838e))
17
+ * position of dragged in element when in 2d ([e96a5f9](https://github.com/roomle-dev/roomle-ui/commit/e96a5f95d4279ea9908c8b96a1d30a175cedddbf))
18
+ * regenerate lines on camera move 90 degrees ([b089c2e](https://github.com/roomle-dev/roomle-ui/commit/b089c2efe72f3c51d38311d88991bf8e275cdde2))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "5.26.0",
3
+ "version": "5.27.0-alpha.2",
4
4
  "description": "This is a small library which can be used to communicate with the Roomle Configurator",
5
5
  "type": "module",
6
6
  "main": "./roomle-embedding-lib.umd.js",
@@ -142,6 +142,10 @@ export default class RoomleConfigurator<P extends readonly PluginName[] = readon
142
142
  * Remove/cancel all dockings/ghosts
143
143
  */
144
144
  cancelDockings(): void;
145
+ /**
146
+ * Update addons for the current selection
147
+ */
148
+ updateAddons(): void;
145
149
  /**
146
150
  * Deletes the currently selected component if possible
147
151
  */
@@ -707,5 +711,12 @@ export default class RoomleConfigurator<P extends readonly PluginName[] = readon
707
711
  * Resumes all input event listeners on the canvas.
708
712
  */
709
713
  resumeInputListeners(): void;
714
+ /**
715
+ * Directly updates a component parameter.
716
+ * @param runtimeId - The runtime ID of the component to update.
717
+ * @param parameterKey - The key of the parameter to update.
718
+ * @param value - The new value to set for the parameter.
719
+ */
720
+ updateComponentParameter(runtimeId: number, parameterKey: string, value: string): void;
710
721
  }
711
722
  export {};
@@ -9,6 +9,7 @@ import { RoomleComponent } from '../../../common-core/src/webgl/roomle-component
9
9
  import { ConfiguratorDebugCallbacks } from '../configurator-debug-api';
10
10
  import { CancelSelectionReasons } from '../../../typings/planner';
11
11
  import { ExternalConfiguration } from '../../../typings/external-objects';
12
+ import { DimensionLabelsTransferable } from '../../../planner-core/src/utils/measurements';
12
13
 
13
14
  export type ComponentAction = 'edit' | 'add';
14
15
  export type ComponentType = 'preview' | 'component';
@@ -243,6 +244,7 @@ export default class ConfiguratorUiCallbacks extends UiCallback implements Confi
243
244
  * @param rootComponentLabel
244
245
  */
245
246
  onConfigurationLabelChange: (catalogName: string, rapiItemLabel: string, rootComponentLabel: string) => void;
247
+ onDimensionLabelsUpdated: (labels: DimensionLabelsTransferable | null) => void;
246
248
  /**
247
249
  * When kernel failed to load a mesh
248
250
  */
@@ -1,7 +1,17 @@
1
1
  import { RoomleComponent } from '../../../common-core/src/webgl/roomle-component-factory';
2
2
  import { Context } from '../../../common-core/src/di/context';
3
- import { PerspectiveCamera } from 'three';
3
+ import { OrthographicCamera, Vector3, PerspectiveCamera } from 'three';
4
+ import { Dimensioning, DimensioningAxis } from '../../../typings/kernel';
4
5
 
6
+ export interface DimensionLabelData {
7
+ id: string;
8
+ value: number;
9
+ level: number;
10
+ maxLevel: number;
11
+ dimensioning: Dimensioning;
12
+ axis: DimensioningAxis | undefined;
13
+ interactionKey?: string;
14
+ }
5
15
  export default class ComponentDimensioningHelper implements Context {
6
16
  _creator_: string;
7
17
  private _plannerKernelAccess;
@@ -9,9 +19,28 @@ export default class ComponentDimensioningHelper implements Context {
9
19
  private _camera;
10
20
  private _activeComponents;
11
21
  private _componentDimensioningsExist;
22
+ private _dimensionDataMap;
23
+ private _dimensionObjects;
24
+ private _lastCameraDirection;
25
+ private _regenerationThreshold;
12
26
  constructor(creator: string);
27
+ regenerateDimensions(component: RoomleComponent, updateRenderer?: () => void): Promise<boolean>;
28
+ needsDimensionRegeneration(camera: PerspectiveCamera | OrthographicCamera): boolean;
13
29
  setCamera(camera: PerspectiveCamera): void;
14
- add(component: RoomleComponent, updateRenderer?: () => void): boolean;
30
+ add(component: RoomleComponent, updateRenderer?: () => void): Promise<boolean>;
31
+ /**
32
+ * Get dimension data for a component
33
+ */
34
+ getDimensionData(componentId: number): DimensionLabelData[];
35
+ /**
36
+ * Extract label data from dimension objects
37
+ * This gets the actual calculated positions and values from the Three.js objects
38
+ */
39
+ getLabelData(): DimensionLabelData[];
40
+ /**
41
+ * Get dimension objects to extract their current state
42
+ */
43
+ getDimensionObjects(componentId: number): any[];
15
44
  private _assembleDimensionings;
16
45
  private _findAxis;
17
46
  private _mapDimensioningToAxis;
@@ -22,4 +51,17 @@ export default class ComponentDimensioningHelper implements Context {
22
51
  hasComponentDimensions(): boolean;
23
52
  reset(): Promise<void>;
24
53
  invalidateDimensioningsCache(componentRuntimeId?: number): void;
54
+ /**
55
+ * Get all active components for iteration
56
+ */
57
+ getActiveComponents(): RoomleComponent[];
58
+ updateDimensionVisibility(componentId: number): void;
59
+ /**
60
+ * Get the center of the main dimension line (not extension lines)
61
+ */
62
+ getDimensionLineCenter(componentId: number, dimensionIndex: number): Vector3 | null;
63
+ /**
64
+ * Ensure dimension objects are ready
65
+ */
66
+ ensureDimensionObjectsReady(componentId: number): void;
25
67
  }
@@ -1,7 +1,7 @@
1
1
  import { RoomleComponent } from '../../../common-core/src/webgl/roomle-component-factory';
2
2
  import { default as ConfiguratorSceneEventHandler } from '../webgl/configurator-scene-event-handler';
3
3
  import { default as ConfiguratorViewModel } from '../../../common-core/src/view-model/configurator-view-model';
4
- import { Object3D, PerspectiveCamera } from 'three';
4
+ import { Object3D, PerspectiveCamera, Vector3 } from 'three';
5
5
 
6
6
  export default class ComponentRaycastHelper {
7
7
  private _object;
@@ -20,4 +20,9 @@ export default class ComponentRaycastHelper {
20
20
  areAllPreviewsVisible(configuratorViewModel: ConfiguratorViewModel): boolean;
21
21
  areAllComponentsInFrustum(previews: RoomleComponent[]): boolean;
22
22
  checkPreviewVisibility(configuratorViewModel: ConfiguratorViewModel): void;
23
+ isComponentMeasurementLabelOccluded(labelWorldPos: Vector3, component: RoomleComponent): boolean;
24
+ checkMultipleLabelOcclusion(labelPositions: Array<{
25
+ id: string;
26
+ worldPos: Vector3;
27
+ }>, component: RoomleComponent): Set<string>;
23
28
  }
@@ -39,6 +39,7 @@ export default class DimensioningHelper {
39
39
  removeFromObject(object: Object3D): void;
40
40
  addToUiScene(uiScene: Scene): void;
41
41
  removeFromUiScene(uiScene: Scene): void;
42
+ private _isCameraInsideOrTooClose;
42
43
  private _getWidthEdge;
43
44
  private _getDepthEdge;
44
45
  private _getHeightEdge;
@@ -22,12 +22,14 @@ import { default as CameraBehaviour3d } from '../../../common-core/src/cameracon
22
22
  import { default as GlobalInitData } from '../../../common-core/src/utils/global-init-data';
23
23
  import { CancelSelectionReasons } from '../../../typings/planner';
24
24
  import { ExternalConfiguration } from '../../../typings/external-objects';
25
+ import { default as UnitFormatter } from '../services/unit-formatter';
25
26
 
26
27
  export default class ConfiguratorSceneManager extends SceneManager implements ConfiguratorViewModelCallbackI {
27
28
  _creator_: string;
28
29
  private _configuratorInputManager;
29
30
  private _configuratorMeshGenerator;
30
31
  private _memoryManager;
32
+ protected _unitFormatter: UnitFormatter;
31
33
  protected _configuratorContext: ConfiguratorContext;
32
34
  private _componentDimensioningHelper;
33
35
  private _configuratorHistory;
@@ -42,6 +44,7 @@ export default class ConfiguratorSceneManager extends SceneManager implements Co
42
44
  private _sceneEventHandler;
43
45
  private _currentComponent;
44
46
  private _isComponentDimensionsVisible;
47
+ private _dimensionUpdateDebounced;
45
48
  constructor(creator: string, offset: CanvasOffset, mode: Enumify<typeof CAMERA_TYPE>);
46
49
  private _initOptionalModules;
47
50
  protected _changeCameraBehaviour(cameraBehaviour: CameraBehaviour): void;
@@ -56,6 +59,7 @@ export default class ConfiguratorSceneManager extends SceneManager implements Co
56
59
  private _showDockings;
57
60
  cancelDockings(): void;
58
61
  private _cancelDockings;
62
+ updateAddons(): void;
59
63
  private _onHoverOn;
60
64
  private _onHoverOff;
61
65
  private _highlightComponent;
@@ -117,6 +121,11 @@ export default class ConfiguratorSceneManager extends SceneManager implements Co
117
121
  showDimensions(): Promise<void>;
118
122
  private _initDimensions;
119
123
  hideDimensions(): void;
124
+ private _updateComponentDimensionLabels;
125
+ /**
126
+ * Resolve label collisions by hiding lower priority overlapping labels
127
+ */
128
+ private _resolveCollisions;
120
129
  loadSceneSettings(sceneSetting: SceneSettings): Promise<void>;
121
130
  protected onCameraChanged(): void;
122
131
  requestDockingsPreview(userInitiated: boolean, possibleChild?: UiPossibleChild, dragEvent?: DragEvent, dragIn?: boolean): void;
@@ -14,6 +14,7 @@ export declare class RoomDesignerApi implements RoomDesignerRequests {
14
14
  deleteGroup(groupId: string, wasMerged?: boolean): Promise<void>;
15
15
  deleteRootModule(rootModuleId: string): Promise<void>;
16
16
  getPosDataOfAllGroups(): Promise<PosGroup[]>;
17
+ getRoomInformation(): Promise<import('../../planner-core/src/external-object-api').ExternalRoomInformation>;
17
18
  generatePlanSnapshot(): Promise<void>;
18
19
  saveExternalObjectSnapshot(): Promise<import('../../typings/rapi-types').RapiPlanSnapshotGetDataWith3dUrls>;
19
20
  saveCurrentPlanSnapshot(): Promise<import('../../typings/rapi-types').RapiPlanSnapshotGetData>;
@@ -5,7 +5,7 @@ export interface LibraryData {
5
5
  get masterData(): MasterData | null;
6
6
  get posGroupVersion(): number;
7
7
  calculateGroup(posGroup: PosGroup): PosGroup;
8
- getOrderData(posGroup: PosGroup[], roomlePlannerId?: string): PosGroup;
8
+ getOrderData(posGroup: PosGroup[], roomlePlannerId?: string): any;
9
9
  getAttributesDropDownValues(module: PosModuleRootData): Promise<any>;
10
10
  solveModuleAttributeConflict(module: PosModuleData, attributeName: string, value: string | number | boolean): PosModuleAttribute[] | undefined;
11
11
  }
@@ -19,6 +19,7 @@ export interface RoomDesignerRequests {
19
19
  deleteGroup(groupId: string, wasMerged?: boolean): Promise<void>;
20
20
  deleteRootModule(rootModuleId: string): Promise<void>;
21
21
  getPosDataOfAllGroups(): Promise<PosGroup[]>;
22
+ getRoomInformation(): Promise<any>;
22
23
  generatePlanSnapshot(): Promise<void>;
23
24
  saveExternalObjectSnapshot(): Promise<any>;
24
25
  saveCurrentPlanSnapshot(): Promise<any>;
@@ -76,7 +77,7 @@ export declare class Emulator implements GlueLogic {
76
77
  changedGroup(posDataJson: PosGroup): void;
77
78
  changedGroupPlanningSituation(changedGroup: ExternalObjectGroup): void;
78
79
  loadedGroup(posDataJson: PosGroup): void;
79
- getGroupDataForOrder(roomlePlannerId?: string): Promise<PosGroup>;
80
+ getGroupDataForOrder(roomlePlannerId?: string): Promise<any>;
80
81
  private _setGroupContour;
81
82
  private _setGroupPosition;
82
83
  private _setRootModulesPosition;
@@ -146,8 +146,10 @@ export interface PosContourSegment {
146
146
  cmd: string;
147
147
  x: number;
148
148
  y: number;
149
- angle: number;
149
+ angle?: number;
150
150
  type?: string;
151
+ height?: number;
152
+ thickness?: number;
151
153
  }
152
154
  export interface PosContour {
153
155
  level: number;
@@ -1,3 +1,5 @@
1
+ import { PosContour } from '../../homag-intelligence/src/model/oc-scripts-domain.model';
2
+
1
3
  export interface ExternalObjectUiSliderRange {
2
4
  min: number;
3
5
  max: number;
@@ -30,6 +32,9 @@ export interface ExternalObjectApiConfiguration {
30
32
  materialConfiguration?: ExternalObjectMaterialConfiguration;
31
33
  debugConfiguration?: ExternalObjectDebugConfiguration;
32
34
  }
35
+ export interface ExternalRoomInformation {
36
+ rooms: PosContour[];
37
+ }
33
38
  export interface ExternalObjectAPI {
34
39
  /**
35
40
  * With "configureExternalObjectApi" the default representation of the objects and UI and
@@ -110,5 +115,9 @@ export interface ExternalObjectAPI {
110
115
  * "getExternalObjectGroups" returns all groups of external objects modules (PosData) that are currently loaded in the plan.
111
116
  */
112
117
  getExternalObjectGroups(): Promise<object[]>;
118
+ /**
119
+ * "getExternalRoomInformation" returns the room information for currently loaded in the plan.
120
+ */
121
+ getExternalRoomInformation(): Promise<ExternalRoomInformation>;
113
122
  }
114
123
  export declare const getDefaultExternalObjectApiConfiguration: () => Promise<ExternalObjectApiConfiguration>;
@@ -21,7 +21,7 @@ import { default as PlanElementViewModel } from '../../common-core/src/view-mode
21
21
  import { default as WallPlanElementViewModel } from './view-model/wall-plan-element-view-model';
22
22
  import { default as ConfiguratorContext } from '../../common-core/src/webgl/configurator-context';
23
23
  import { default as IdbManager } from '../../common-core/src/services/idb-manager';
24
- import { ExternalObjectAPI, ExternalObjectApiConfiguration } from './external-object-api';
24
+ import { ExternalObjectAPI, ExternalObjectApiConfiguration, ExternalRoomInformation } from './external-object-api';
25
25
  import { GlobalCallback } from '../../common-core/src/services/global-callback';
26
26
  import { ExternalGroupData, ExternalObject, ExtObjId } from '../../typings/external-objects';
27
27
  import { PluginName } from '../../configurator-core/src/utils/plugin-types';
@@ -435,6 +435,7 @@ export default class RoomlePlanner<P extends readonly PluginName[] = readonly []
435
435
  private _selectPlanObject;
436
436
  private _getSelectedPlanObjectComponent;
437
437
  getExternalObjectGroups(): Promise<object[]>;
438
+ getExternalRoomInformation(): Promise<ExternalRoomInformation>;
438
439
  /**
439
440
  * @internal
440
441
  * Use this callbacks to hook in your functionality
@@ -524,6 +525,6 @@ export default class RoomlePlanner<P extends readonly PluginName[] = readonly []
524
525
  newPosDataFromId(id: string): any;
525
526
  sendToOM(withPrice?: boolean): Promise<void>;
526
527
  fetchPrice(planId?: string): Promise<any>;
527
- getOrderManagerGroupData(planId?: string): Promise<import('../../homag-intelligence/src/model/oc-scripts-domain.model').PosGroup>;
528
+ getOrderManagerGroupData(planId?: string): Promise<any>;
528
529
  getRapiAccess(): RapiAccess;
529
530
  }
@@ -112,4 +112,5 @@ export default class PlannerKernelAccess extends ConfiguratorKernelAccess {
112
112
  private _externalPlanComponentDeleted;
113
113
  dockExternalObjectComponent(parentId: number, parentDockId: number, childId: number, childDockId: number): void;
114
114
  configureExternalObjectApi(externalObjectSettings?: ExternalObjectApiConfiguration): Promise<void>;
115
+ setComponentParameter(componentId: number, interactionKey: string, newValue: any): void;
115
116
  }
@@ -97,6 +97,30 @@ export interface DimensionDefinition<Vector2Type = Vector3 | Position2, Vector3T
97
97
  isCurrentlyDrawn?: boolean;
98
98
  attic?: AtticDimension<Vector2Type, Vector3Type>;
99
99
  }
100
+ export interface DimensionLabelsTransferable {
101
+ labels: DimensionLabel[];
102
+ componentId: number;
103
+ }
104
+ export interface DimensionLabel {
105
+ id: string;
106
+ value: number;
107
+ formattedValue?: string;
108
+ position: {
109
+ x: number;
110
+ y: number;
111
+ };
112
+ level: number;
113
+ angle?: number;
114
+ maxLevel: number;
115
+ isVisible: boolean;
116
+ axisKey?: string;
117
+ interactionKey?: string | null;
118
+ direction?: {
119
+ x: number;
120
+ y: number;
121
+ z: number;
122
+ } | null;
123
+ }
100
124
  export declare const transformMeasurement: (measurement: MeasurementBase<Vector3, Vector3>) => MeasurementBase<Position2, Position3>;
101
125
  export declare const calculateWallPlanPoints: (planObject: WallPlanObject | ConstructionPlanObject, preferredSide: LeftOrRightWallSide) => {
102
126
  from: Vector3;
@@ -118,3 +142,17 @@ export declare const getWallCenterPoints: (planViewModel: ConstructionPlanObject
118
142
  wallFromCenterPoint: Vector3;
119
143
  wallToCenterPoint: Vector3;
120
144
  };
145
+ /**
146
+ * Check if two labels collide in screen space (Case of component dimensions labels)
147
+ */
148
+ export declare const labelsCollide: (label1: {
149
+ position: {
150
+ x: number;
151
+ y: number;
152
+ };
153
+ }, label2: {
154
+ position: {
155
+ x: number;
156
+ y: number;
157
+ };
158
+ }, width: number, height: number, padding: number) => boolean;
@@ -13,7 +13,6 @@ import { CameraParameter } from '../../../common-core/src/cameracontrol/camera-c
13
13
  import { default as PlanViewModel } from '../view-model/plan-view-model';
14
14
  import { default as ConfiguratorSceneManager } from '../../../configurator-core/src/webgl/configurator-scene-manager';
15
15
  import { default as WallPlanElementViewModel } from '../view-model/wall-plan-element-view-model';
16
- import { default as UnitFormatter } from '../../../configurator-core/src/services/unit-formatter';
17
16
  import { Enumify } from '../../../common-core/src/types';
18
17
  import { Object3D, Box3 } from 'three';
19
18
  import { CameraTarget, PrepareImageOptions } from '../../../common-core/src/webgl/image-renderer';
@@ -34,7 +33,6 @@ export default class PlannerSceneManager extends ConfiguratorSceneManager implem
34
33
  private _plannerInputManager;
35
34
  private _roomlePlannerUiCallback;
36
35
  private _localStorageHelper;
37
- protected _unitFormatter: UnitFormatter;
38
36
  private _plannerSceneEventHandler;
39
37
  private _roomlePlannerCallback;
40
38
  private _itemsLoadingStatePromises;
@@ -3,6 +3,7 @@ import { DrawingType, KernelPlanObjectList, PlanObjectList, ResizingAnchor, Snap
3
3
  import { Position2 } from '../common-core/src/common-interfaces';
4
4
  import { Enumify } from '../common-core/src/types';
5
5
  import { ConstructionObjectDoorArchArray } from 'roomle-core-hsc/src/embind/plannerCoreInterface';
6
+ import { PosContour } from '../homag-intelligence/src/model/oc-scripts-domain.model';
6
7
 
7
8
  import * as ems from './ems';
8
9
  declare const EmsArray: typeof ems.EmsArray;
@@ -299,6 +300,11 @@ export interface RoomLightSourceDistribution {
299
300
  }
300
301
  declare class RoomLightSourceDistributionArray extends EmsArray<RoomLightSourceDistribution> {
301
302
  }
303
+ declare class RoomGeometryArray extends EmsArray<PosContour> {
304
+ }
305
+ export interface RoomInformation {
306
+ rooms: RoomGeometryArray;
307
+ }
302
308
  export interface PlanModelViewHelper {
303
309
  getPlanOverview(planObject: KernelObject): PlanOverview;
304
310
  getPlanObject(plan: Plan, aRuntimeId: number): KernelPlanObject;
@@ -308,6 +314,7 @@ export interface PlanModelViewHelper {
308
314
  getExternalComponentModuleIdsForSelection(plan: Plan, groupOrRootModuleId: string, subModuleId: string): ExternalModuleInformation;
309
315
  requestMesh3d(element: PlanElement): void;
310
316
  getExternalObjectGroups(plan: Plan): KernelObjectConfigurationArray;
317
+ getExternalRoomInformation(plan: Plan): RoomInformation;
311
318
  calculateLightSourceDistribution(plan: Plan, lightSourceConfiguration: LightSourceConfiguration): RoomLightSourceDistributionArray;
312
319
  }
313
320
  export interface PlanNode extends KernelObject {
@@ -204,7 +204,7 @@ const k = (s) => JSON.parse(JSON.stringify(s)), G = {
204
204
  featureFlags: {
205
205
  mocAr: !0,
206
206
  wallAutoHeight: !1,
207
- openCloseAnimation: !1,
207
+ openCloseAnimation: !0,
208
208
  enableTwoLevelCatalog: !1
209
209
  },
210
210
  rotationSnapDegrees: 10,
@@ -1 +1 @@
1
- class e{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=e=>{if(!e||!e.data)return i.port1.close(),i.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return i.port1.close(),i.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),i.port1.close(),i.port2.close()};let n="";try{n=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(n,"*",[i.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const t=["127.0.0.1","localhost","0.0.0.0"],s=["language","browserLanguage","userLanguage","systemLanguage"],r=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=r(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var i=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(i||{});const n={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[i.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!1,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},a=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&a(t),Array.isArray(t))for(const e of t)a(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},o=()=>/(android)/i.test(navigator.userAgent);class l{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split("."),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split("."),s=t[0],r=t[1],i=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][i]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],i=s[1],n=3===s.length?s[2]:null;if(n&&this[r][i][n]){const e=this[r][i][n](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./drag-in-BmoiEqfA.mjs").then(e=>e.l).then(({DragIn:i})=>{const n=new i(this.ui,t,s,this.viewName);n.init().then(()=>{this.plugins.dragIn=n,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,i)=>{try{r.loader().then(n=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins[r.name]=a,e()},i)})}catch(e){i(e)}}))}}const c=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},u=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},g=()=>.01*window.innerHeight+"px",d=e=>{e&&setTimeout(()=>e.style.setProperty(m,g()),0)},h="rml-styles",m="--rml-full-height",p="rml-container",f="rml-fill",_="rml-pos",w="rml-android-height",y="rml-overflow-hidden",b=new Map;class M extends l{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(t,s=[]){const r=new l;r.viewName=t;const{resolve:i,promise:n}=c(),{resolve:a,promise:o}=c(),u=new e("custom-view-"+t,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":i();break;case"returnMethods":r.handleSetup(t[0]),a();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(u);const g=[t];return u.sendMessage("registerCustomView",g),await n,u.sendMessage("getMethods",g),await o,r.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static async _create(e,i,o,l){return new Promise(async(c,u)=>{try{const u=r((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(n);e.locale||(e.locale=((e=null)=>{const t=window.navigator;if(e)return e.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,r=s.length;e<r;e++){const r=t[s[e]];if(r)return r.substr(0,2)}return"en"})()),"(idle)"===e.id&&delete e.id;const r=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return r&&(e=>!!(t.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(r)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(a(g=o),g?.customApiUrl&&(g.customApiUrl=decodeURIComponent(g.customApiUrl)),g.shareUrl&&(g.deeplink=g.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),g));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(u);const d=await(async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,i=s+"/configurators/"+e,n="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+n),o=new Request(i,{method:"GET",headers:new Headers({apiKey:n,currentTenant:r,locale:"en",language:"en",device:1,token:a,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(e,u);o=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return r(s,t)})(s,t)})(d,u);const h=new this(d,i,o,l,c);return await Promise.allSettled(h.pluginsLoaded),h}catch(e){return u(e)}var g})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,r,i,n){if(super(),!t||"string"!=typeof t.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(b.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(h)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=h;const s="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,n=g();t.innerHTML=`\n .${p}{${m}:${n};}\n .${_}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${f}{width:100%;height:100%;opacity:1}\n .${w}{height:calc(var(${m},1vh)*100)}\n .${y}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const a=new e("website",window,null,this._executeMessage);this.setMessageHandler(a),this._onResize=this._onResize.bind(this),o()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=r,this._configuratorSettings=t;const l=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=n,this._container.appendChild(l),this._iframe=l,this.setupPlugins(i,this._iframe),b.set(s,!0)}teardown(){this._container&&b.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(t=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(t=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(t=this._initData.overrideServerUrl),e.src=t,e.classList.add(p),e.classList.add(f),e}_onResize(){d(this._iframe)}_onUseFullPage(){this._iframe.classList.add(_),document.documentElement.classList.add(y),window.document.body.classList.add(y),o()&&(d(this._iframe),this._iframe.classList.add(w))}_onBackToWebsite(){this._iframe.classList.remove(_),this._iframe.classList.remove(w),document.documentElement.classList.remove(y),window.document.body.classList.remove(y)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===e?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===e?(this.handleSetup(t[0]),u(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),u(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{M as default};
1
+ class e{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=e=>{if(!e||!e.data)return i.port1.close(),i.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return i.port1.close(),i.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),i.port1.close(),i.port2.close()};let n="";try{n=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(n,"*",[i.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const t=["127.0.0.1","localhost","0.0.0.0"],s=["language","browserLanguage","userLanguage","systemLanguage"],r=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=r(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var i=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(i||{});const n={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[i.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},a=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&a(t),Array.isArray(t))for(const e of t)a(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},o=()=>/(android)/i.test(navigator.userAgent);class l{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split("."),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split("."),s=t[0],r=t[1],i=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][i]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],i=s[1],n=3===s.length?s[2]:null;if(n&&this[r][i][n]){const e=this[r][i][n](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./drag-in-BmoiEqfA.mjs").then(e=>e.l).then(({DragIn:i})=>{const n=new i(this.ui,t,s,this.viewName);n.init().then(()=>{this.plugins.dragIn=n,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,i)=>{try{r.loader().then(n=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins[r.name]=a,e()},i)})}catch(e){i(e)}}))}}const c=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},u=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},g=()=>.01*window.innerHeight+"px",d=e=>{e&&setTimeout(()=>e.style.setProperty(m,g()),0)},h="rml-styles",m="--rml-full-height",p="rml-container",f="rml-fill",_="rml-pos",w="rml-android-height",y="rml-overflow-hidden",b=new Map;class M extends l{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(t,s=[]){const r=new l;r.viewName=t;const{resolve:i,promise:n}=c(),{resolve:a,promise:o}=c(),u=new e("custom-view-"+t,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":i();break;case"returnMethods":r.handleSetup(t[0]),a();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(u);const g=[t];return u.sendMessage("registerCustomView",g),await n,u.sendMessage("getMethods",g),await o,r.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static async _create(e,i,o,l){return new Promise(async(c,u)=>{try{const u=r((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(n);e.locale||(e.locale=((e=null)=>{const t=window.navigator;if(e)return e.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,r=s.length;e<r;e++){const r=t[s[e]];if(r)return r.substr(0,2)}return"en"})()),"(idle)"===e.id&&delete e.id;const r=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return r&&(e=>!!(t.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(r)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(a(g=o),g?.customApiUrl&&(g.customApiUrl=decodeURIComponent(g.customApiUrl)),g.shareUrl&&(g.deeplink=g.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),g));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(u);const d=await(async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,i=s+"/configurators/"+e,n="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+n),o=new Request(i,{method:"GET",headers:new Headers({apiKey:n,currentTenant:r,locale:"en",language:"en",device:1,token:a,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(e,u);o=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return r(s,t)})(s,t)})(d,u);const h=new this(d,i,o,l,c);return await Promise.allSettled(h.pluginsLoaded),h}catch(e){return u(e)}var g})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,r,i,n){if(super(),!t||"string"!=typeof t.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(b.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(h)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=h;const s="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,n=g();t.innerHTML=`\n .${p}{${m}:${n};}\n .${_}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${f}{width:100%;height:100%;opacity:1}\n .${w}{height:calc(var(${m},1vh)*100)}\n .${y}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const a=new e("website",window,null,this._executeMessage);this.setMessageHandler(a),this._onResize=this._onResize.bind(this),o()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=r,this._configuratorSettings=t;const l=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=n,this._container.appendChild(l),this._iframe=l,this.setupPlugins(i,this._iframe),b.set(s,!0)}teardown(){this._container&&b.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(t=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(t=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(t=this._initData.overrideServerUrl),e.src=t,e.classList.add(p),e.classList.add(f),e}_onResize(){d(this._iframe)}_onUseFullPage(){this._iframe.classList.add(_),document.documentElement.classList.add(y),window.document.body.classList.add(y),o()&&(d(this._iframe),this._iframe.classList.add(w))}_onBackToWebsite(){this._iframe.classList.remove(_),this._iframe.classList.remove(w),document.documentElement.classList.remove(y),window.document.body.classList.remove(y)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===e?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===e?(this.handleSetup(t[0]),u(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),u(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{M as default};
@@ -1,4 +1,4 @@
1
- (function(m,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(m=typeof globalThis<"u"?globalThis:m||self,m["roomle-embedding-lib"]=m["roomle-embedding-lib"]||{},m["roomle-embedding-lib"].umd=m["roomle-embedding-lib"].umd||{},m["roomle-embedding-lib"].umd.js=p())})(this,function(){"use strict";class m{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(t,e,s,n){this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=s,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((s,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=a=>{if(!a||!a.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let c;try{c=JSON.parse(a.data)}catch(l){return i.port1.close(),i.port2.close(),this._prepareError(l),n(l)}c.error?n(c.error):c.result!==void 0?s(c.result):s(void 0),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(o,"*",[i.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const s=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const n=this._execMessage(s,t);if(n===void 0)return;n.then((i={})=>{let o,a;typeof i=="object"&&i!==null&&(o=i.error,a=i.result),o?e.postMessage(JSON.stringify({error:o})):a!==void 0?e.postMessage(JSON.stringify({result:a})):e.postMessage(JSON.stringify({result:i}))},i=>{e.postMessage(JSON.stringify({error:this._prepareError(i)}))})}catch(s){e.postMessage(JSON.stringify({error:this._prepareError(s)}))}}_prepareError(t){if(typeof t=="string"){const e=this._side+": "+t;return console.error(e),e}return t.message=this._side+": "+t.message,console.error(t),t.message}}const p=".",R={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},S={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},mt=async(r,t)=>{if(typeof r!="string")throw new Error('Configurator ID is not a string type: "'+typeof r+'"');const e=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",s=t.overrideTenant||9,n=e+"/configurators/"+r,i="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+i),a=()=>{const d={apiKey:i,currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"};return new Headers(d)},c=new Request(n,{method:"GET",headers:a(),mode:"cors",cache:"default"}),l=await fetch(c),{configurator:h}=await l.json();return h},ft=()=>{try{return window.self!==window.top}catch{return!0}},pt=["127.0.0.1","localhost","0.0.0.0"],yt=()=>{const r=ft();let t=window.location.href;if(r){if(!document.referrer)return null;t=document.referrer}const{hostname:e}=new URL(t);return e},Dt=r=>!!(pt.includes(r)||r.endsWith("roomle.com")||r.endsWith("gitlab.io")||r.endsWith("gitlab.com")),W=["language","browserLanguage","userLanguage","systemLanguage"],Et=(r=null)=>{const t=window.navigator;if(r)return r.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,s=W.length;e<s;e++){const n=t[W[e]];if(n)return n.substr(0,2)}return"en"},Tt=(r,t)=>{const e=JSON.parse(JSON.stringify(r));return M(e,t)},M=(r,t)=>{for(const e in t)try{t[e].constructor===Object?r[e]=M(r[e],t[e]):r[e]=t[e]}catch{r[e]=t[e]}return r};var $=(r=>(r.BOTTOM_BAR="bottom_bar",r.PARTLIST_BOUNDS="partlist_bounds",r.INTERACTION_NOTES="interaction_notes",r.PARAMETER_GROUPS="parameter_groups",r))($||{});const St=r=>JSON.parse(JSON.stringify(r)),It={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[$.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!1,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},wt="(idle)",At=r=>(C(r),r?.customApiUrl&&(r.customApiUrl=decodeURIComponent(r.customApiUrl)),r.shareUrl&&(r.deeplink=r.shareUrl.replace(vt,Rt)),r),C=r=>{if(!r)return;const t=Object.keys(r);for(const e of t){const s=r[e];if(!Array.isArray(s)&&typeof s=="object"&&s!==null&&C(s),Array.isArray(s))for(const n of s)C(n);(s==="true"||s==="false")&&(r[e]=s==="true")}},bt=(r,t)=>{t.configuratorId=r.id;const e=r.settings||{};return!t.overrideTenant&&r.tenant&&(t.overrideTenant=r.tenant),Tt(e,t)},Ot=()=>{const r=St(It);r.locale||(r.locale=Et()),r.id===wt&&delete r.id;const t=yt();return t&&Dt(t)&&(r.configuratorId="demoConfigurator"),r.customApiUrl=void 0,r.emails=!1,r},vt="<CONF_ID>",Rt="#CONFIGURATIONID#",Mt=r=>{r.featureFlags||(r.featureFlags={}),typeof r.featureFlags.realPartList!="boolean"&&(r.featureFlags.realPartList=!0),typeof r.featureFlags.globalCallbacks!="boolean"&&(r.featureFlags.globalCallbacks=!0),typeof r.featureFlags.mocAr!="boolean"&&(r.featureFlags.mocAr=!1)},k=()=>/(android)/i.test(navigator.userAgent);class z{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(t){this._messageHandler=t}handleSetup(t){const{methods:e,callbacks:s}=t;e.forEach(n=>{const i=n.split(p),o=i[0],a=i[1];this[o]||(this[o]={}),this[o][a]=(function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(n,[...arguments])}).bind(this)}),s.forEach(n=>{const i=n.split(p),o=i[0],a=i[1],c=i[2];this[o]||(this[o]={}),this[o][a]||(this[o][a]={}),this[o][a][c]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split(p),n=s[0],i=s[1],o=s.length===3?s[2]:null;if(o&&this[n][i][o]){const a=this[n][i][o](...e);return a instanceof Promise?a.then(c=>({result:c})):a!==void 0?Promise.resolve({result:a}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}setupPlugins(t,e,s="website"){for(const n of t)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((i,o)=>{try{Promise.resolve().then(()=>Gt).then(({DragIn:a})=>{const c=new a(this.ui,e,s,this.viewName);c.init().then(()=>{this.plugins.dragIn=c,i()},o)})}catch(a){o(a)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((i,o)=>{try{n.loader().then(a=>{const c=new a(this.ui,e,s,this.viewName);c.init().then(()=>{this.plugins[n.name]=c,i()},o)})}catch(a){o(a)}}))}}const V=()=>{let r,t;return{promise:new Promise((s,n)=>{r=s,t=n}),resolve:r,reject:t}},q=(r,t,e)=>{let s=null;Object.defineProperty(r,t,{get(){return s||e},set(n){n?.mute?s=n.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),s=n)}})},K=()=>window.innerHeight*.01+"px",J=r=>{r&&setTimeout(()=>r.style.setProperty(L,K()),0)},j="rml-styles",Ct=450,L="--rml-full-height",g={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},N=new Map;class Lt extends z{static createPlanner(t,e,s,n=[]){return this._create(t,e,s,n)}static async connect(t,e=[]){const s=new z;s.viewName=t;const{resolve:n,promise:i}=V(),{resolve:o,promise:a}=V(),c=({message:d,args:u})=>{switch(d){case S.REGISTER_CUSTOM_VIEW_DONE:n();break;case S.RETURN_METHODS:s.handleSetup(u[0]),o();break;default:if(s.isSetupDone)return s.executeMessage({message:d,args:u})}},l=new m("custom-view-"+t,window,window.parent,c);s.setMessageHandler(l);const h=[t];return l.sendMessage(S.REGISTER_CUSTOM_VIEW,h),await i,l.sendMessage(S.GET_METHODS,h),await a,s.setupPlugins(e,document.body,"custom-view"),await Promise.allSettled(s.pluginsLoaded),s}static createConfigurator(t,e,s,n=[]){return this._create(t,e,s,n)}static create(t,e,s,n){return this._create(t,e,s,n)}static createViewer(t,e,s,n=[]){return this._create(t,e,s,n)}static async _create(t,e,s,n){return new Promise(async(i,o)=>{try{const a=M(Ot(),At(s));Mt(a);const c=await mt(t,a);s=bt(c,a);const l=new this(c,e,s,n,i);return await Promise.allSettled(l.pluginsLoaded),l}catch(a){return o(a)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,e,s,n,i){if(super(),!t||typeof t.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(N.has(e))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(j)){const l=s.zIndex||9999999,h=document.createElement("style");h.type="text/css",h.id=j;const d="transition:all ease-in-out "+Ct+"ms;",u=["-webkit-","-o-"].reduce((D,f)=>D+=f+d,"")+d,_=K();h.innerHTML=`
1
+ (function(m,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(m=typeof globalThis<"u"?globalThis:m||self,m["roomle-embedding-lib"]=m["roomle-embedding-lib"]||{},m["roomle-embedding-lib"].umd=m["roomle-embedding-lib"].umd||{},m["roomle-embedding-lib"].umd.js=p())})(this,function(){"use strict";class m{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(t,e,s,n){this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=s,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((s,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=a=>{if(!a||!a.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let c;try{c=JSON.parse(a.data)}catch(l){return i.port1.close(),i.port2.close(),this._prepareError(l),n(l)}c.error?n(c.error):c.result!==void 0?s(c.result):s(void 0),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(o,"*",[i.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const s=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const n=this._execMessage(s,t);if(n===void 0)return;n.then((i={})=>{let o,a;typeof i=="object"&&i!==null&&(o=i.error,a=i.result),o?e.postMessage(JSON.stringify({error:o})):a!==void 0?e.postMessage(JSON.stringify({result:a})):e.postMessage(JSON.stringify({result:i}))},i=>{e.postMessage(JSON.stringify({error:this._prepareError(i)}))})}catch(s){e.postMessage(JSON.stringify({error:this._prepareError(s)}))}}_prepareError(t){if(typeof t=="string"){const e=this._side+": "+t;return console.error(e),e}return t.message=this._side+": "+t.message,console.error(t),t.message}}const p=".",R={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},S={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},mt=async(r,t)=>{if(typeof r!="string")throw new Error('Configurator ID is not a string type: "'+typeof r+'"');const e=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",s=t.overrideTenant||9,n=e+"/configurators/"+r,i="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+i),a=()=>{const d={apiKey:i,currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"};return new Headers(d)},c=new Request(n,{method:"GET",headers:a(),mode:"cors",cache:"default"}),l=await fetch(c),{configurator:h}=await l.json();return h},ft=()=>{try{return window.self!==window.top}catch{return!0}},pt=["127.0.0.1","localhost","0.0.0.0"],yt=()=>{const r=ft();let t=window.location.href;if(r){if(!document.referrer)return null;t=document.referrer}const{hostname:e}=new URL(t);return e},Dt=r=>!!(pt.includes(r)||r.endsWith("roomle.com")||r.endsWith("gitlab.io")||r.endsWith("gitlab.com")),W=["language","browserLanguage","userLanguage","systemLanguage"],Et=(r=null)=>{const t=window.navigator;if(r)return r.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,s=W.length;e<s;e++){const n=t[W[e]];if(n)return n.substr(0,2)}return"en"},Tt=(r,t)=>{const e=JSON.parse(JSON.stringify(r));return M(e,t)},M=(r,t)=>{for(const e in t)try{t[e].constructor===Object?r[e]=M(r[e],t[e]):r[e]=t[e]}catch{r[e]=t[e]}return r};var $=(r=>(r.BOTTOM_BAR="bottom_bar",r.PARTLIST_BOUNDS="partlist_bounds",r.INTERACTION_NOTES="interaction_notes",r.PARAMETER_GROUPS="parameter_groups",r))($||{});const St=r=>JSON.parse(JSON.stringify(r)),It={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[$.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},wt="(idle)",At=r=>(C(r),r?.customApiUrl&&(r.customApiUrl=decodeURIComponent(r.customApiUrl)),r.shareUrl&&(r.deeplink=r.shareUrl.replace(vt,Rt)),r),C=r=>{if(!r)return;const t=Object.keys(r);for(const e of t){const s=r[e];if(!Array.isArray(s)&&typeof s=="object"&&s!==null&&C(s),Array.isArray(s))for(const n of s)C(n);(s==="true"||s==="false")&&(r[e]=s==="true")}},bt=(r,t)=>{t.configuratorId=r.id;const e=r.settings||{};return!t.overrideTenant&&r.tenant&&(t.overrideTenant=r.tenant),Tt(e,t)},Ot=()=>{const r=St(It);r.locale||(r.locale=Et()),r.id===wt&&delete r.id;const t=yt();return t&&Dt(t)&&(r.configuratorId="demoConfigurator"),r.customApiUrl=void 0,r.emails=!1,r},vt="<CONF_ID>",Rt="#CONFIGURATIONID#",Mt=r=>{r.featureFlags||(r.featureFlags={}),typeof r.featureFlags.realPartList!="boolean"&&(r.featureFlags.realPartList=!0),typeof r.featureFlags.globalCallbacks!="boolean"&&(r.featureFlags.globalCallbacks=!0),typeof r.featureFlags.mocAr!="boolean"&&(r.featureFlags.mocAr=!1)},k=()=>/(android)/i.test(navigator.userAgent);class z{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(t){this._messageHandler=t}handleSetup(t){const{methods:e,callbacks:s}=t;e.forEach(n=>{const i=n.split(p),o=i[0],a=i[1];this[o]||(this[o]={}),this[o][a]=(function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(n,[...arguments])}).bind(this)}),s.forEach(n=>{const i=n.split(p),o=i[0],a=i[1],c=i[2];this[o]||(this[o]={}),this[o][a]||(this[o][a]={}),this[o][a][c]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split(p),n=s[0],i=s[1],o=s.length===3?s[2]:null;if(o&&this[n][i][o]){const a=this[n][i][o](...e);return a instanceof Promise?a.then(c=>({result:c})):a!==void 0?Promise.resolve({result:a}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}setupPlugins(t,e,s="website"){for(const n of t)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((i,o)=>{try{Promise.resolve().then(()=>Gt).then(({DragIn:a})=>{const c=new a(this.ui,e,s,this.viewName);c.init().then(()=>{this.plugins.dragIn=c,i()},o)})}catch(a){o(a)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((i,o)=>{try{n.loader().then(a=>{const c=new a(this.ui,e,s,this.viewName);c.init().then(()=>{this.plugins[n.name]=c,i()},o)})}catch(a){o(a)}}))}}const V=()=>{let r,t;return{promise:new Promise((s,n)=>{r=s,t=n}),resolve:r,reject:t}},q=(r,t,e)=>{let s=null;Object.defineProperty(r,t,{get(){return s||e},set(n){n?.mute?s=n.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),s=n)}})},K=()=>window.innerHeight*.01+"px",J=r=>{r&&setTimeout(()=>r.style.setProperty(L,K()),0)},j="rml-styles",Ct=450,L="--rml-full-height",g={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},N=new Map;class Lt extends z{static createPlanner(t,e,s,n=[]){return this._create(t,e,s,n)}static async connect(t,e=[]){const s=new z;s.viewName=t;const{resolve:n,promise:i}=V(),{resolve:o,promise:a}=V(),c=({message:d,args:u})=>{switch(d){case S.REGISTER_CUSTOM_VIEW_DONE:n();break;case S.RETURN_METHODS:s.handleSetup(u[0]),o();break;default:if(s.isSetupDone)return s.executeMessage({message:d,args:u})}},l=new m("custom-view-"+t,window,window.parent,c);s.setMessageHandler(l);const h=[t];return l.sendMessage(S.REGISTER_CUSTOM_VIEW,h),await i,l.sendMessage(S.GET_METHODS,h),await a,s.setupPlugins(e,document.body,"custom-view"),await Promise.allSettled(s.pluginsLoaded),s}static createConfigurator(t,e,s,n=[]){return this._create(t,e,s,n)}static create(t,e,s,n){return this._create(t,e,s,n)}static createViewer(t,e,s,n=[]){return this._create(t,e,s,n)}static async _create(t,e,s,n){return new Promise(async(i,o)=>{try{const a=M(Ot(),At(s));Mt(a);const c=await mt(t,a);s=bt(c,a);const l=new this(c,e,s,n,i);return await Promise.allSettled(l.pluginsLoaded),l}catch(a){return o(a)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,e,s,n,i){if(super(),!t||typeof t.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(N.has(e))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(j)){const l=s.zIndex||9999999,h=document.createElement("style");h.type="text/css",h.id=j;const d="transition:all ease-in-out "+Ct+"ms;",u=["-webkit-","-o-"].reduce((D,f)=>D+=f+d,"")+d,_=K();h.innerHTML=`
2
2
  .${g.CONTAINER}{${L}:${_};}
3
3
  .${g.POSITION}{position:fixed;top:0;left:0;z-index:${l};opacity:0}
4
4
  .${g.TRANSITION}{${u}}
@@ -1 +1 @@
1
- var t,e;t=this,e=function(){"use strict";class t{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(t,e,s,n){this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=s,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((s,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=t=>{if(!t||!t.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return i.port1.close(),i.port2.close(),this._prepareError(t),n(t)}e.error?n(e.error):void 0!==e.result?s(e.result):s(void 0),i.port1.close(),i.port2.close()};let r="";try{r=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(r,"*",[i.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const s=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const n=this._execMessage(s,t);if(void 0===n)return;n.then((t={})=>{let s,n;"object"==typeof t&&null!==t&&(s=t.error,n=t.result),s?e.postMessage(JSON.stringify({error:s})):void 0!==n?e.postMessage(JSON.stringify({result:n})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this._prepareError(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this._prepareError(t)}))}}_prepareError(t){return"string"==typeof t?this._side+": "+t:(t.message=this._side+": "+t.message,t.message)}}const e=["127.0.0.1","localhost","0.0.0.0"],s=["language","browserLanguage","userLanguage","systemLanguage"],n=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=n(t[s],e[s]):t[s]=e[s]}catch{t[s]=e[s]}return t};var i,r=((i=r||{}).BOTTOM_BAR="bottom_bar",i.PARTLIST_BOUNDS="partlist_bounds",i.INTERACTION_NOTES="interaction_notes",i.PARAMETER_GROUPS="parameter_groups",i);const a={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[r.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!1,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},o=t=>{if(!t)return;const e=Object.keys(t);for(const s of e){const e=t[s];if(!Array.isArray(e)&&"object"==typeof e&&null!==e&&o(e),Array.isArray(e))for(const t of e)o(t);("true"===e||"false"===e)&&(t[s]="true"===e)}},l=()=>/(android)/i.test(navigator.userAgent);class h{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(t){this._messageHandler=t}handleSetup(t){const{methods:e,callbacks:s}=t;e.forEach(t=>{const e=t.split("."),s=e[0],n=e[1];this[s]||(this[s]={}),this[s][n]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(t,[...arguments])}.bind(this)}),s.forEach(t=>{const e=t.split("."),s=e[0],n=e[1],i=e[2];this[s]||(this[s]={}),this[s][n]||(this[s][n]={}),this[s][n][i]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split("."),n=s[0],i=s[1],r=3===s.length?s[2]:null;if(r&&this[n][i][r]){const t=this[n][i][r](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}setupPlugins(t,e,s="website"){for(const n of t)"string"==typeof n&&"dragIn"===n?this.pluginsLoaded.push(new Promise((t,n)=>{try{Promise.resolve().then(()=>N).then(({DragIn:i})=>{const r=new i(this.ui,e,s,this.viewName);r.init().then(()=>{this.plugins.dragIn=r,t()},n)})}catch(t){n(t)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((t,i)=>{try{n.loader().then(r=>{const a=new r(this.ui,e,s,this.viewName);a.init().then(()=>{this.plugins[n.name]=a,t()},i)})}catch(t){i(t)}}))}}const c=()=>{let t,e;return{promise:new Promise((s,n)=>{t=s,e=n}),resolve:t,reject:e}},g=(t,e,s)=>{let n=null;Object.defineProperty(t,e,{get:()=>n||s,set(t){n=t?.mute?t.value:t}})},d=()=>.01*window.innerHeight+"px",u=t=>{t&&setTimeout(()=>t.style.setProperty(_,d()),0)},m="rml-styles",_="--rml-full-height",p="rml-container",f="rml-fill",y="rml-pos",v="rml-android-height",b="rml-overflow-hidden",w=new Map;class D{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,s,n){this._instance=t,this._mainDomElement=e,this._mode=s,this._viewName=n}async init(){return Promise.resolve()}}const E="rml-drag-in-styles",T="rml-drag-in-drag-element",S="rml-drag-in-overlay",x="rml-drag-in-drag-ghost",I="rml-drag-in-fade-in",M="rml-drag-in-fade-out",C="rml-display-none",A="250ms",L="forwards",O=`@keyframes ${I} {from{opacity: 0;}to {opacity: 0.5;}}`,B=`@keyframes ${M} {from{opacity: 0.5;}to {opacity: 0;}}`,P=`${I} ${A} ${L}`,F=`${M} ${A} ${L}`,U="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",N=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends D{options={};_customDragSignal=new AbortController;_injectStyles(){if(!document.getElementById(E)){const t=document.createElement("style");t.type="text/css",t.id=E,t.innerHTML=`\n .${C}{display:none}\n .${S}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${x}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${O}\n ${B}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+x);e||(e=document.createElement("div"),e.classList.add(x),e.innerText=" ",t.appendChild(e))}constructor(t,e,s,n){super(t,e,s,n),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await Promise.resolve().then(()=>Q);this._strategy=new t(this._instance,this._mainDomElement,{settings:this.options,mode:"website"})}catch(t){throw t}else{if("custom-view"!==this._mode)throw new Error("Unsupported mode");try{const{DragInFromCustomViewStrategy:t}=await Promise.resolve().then(()=>nt);this._strategy=new t(this._instance,this._mainDomElement,this.options,this._viewName)}catch(t){throw t}}}get isDragging(){return this._strategy.isDragging}dragStart(t,e,s="rml_id"){this._strategy.dragStart(t,e,s)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,e,s="rml_id"){this._strategy.touchStart(t,e,s)}touchMove(t){this._strategy.touchMove(t)}touchEnd(){this._strategy.touchEnd()}dispose(){this._strategy.dispose()}beforeUpdateGhost(t){this._strategy.beforeUpdateGhost(t)}registerCustomDrag({customDragStart:t,customDragEnd:e,customDragUpdate:s,beforeUpdateGhost:n}){n&&this._strategy.beforeUpdateGhost(n);const i=this._customDragSignal.signal,r=e=>{"true"===e.target.getAttribute("data-rml-draggable")&&t(e)},a=t=>{this._strategy.releaseInput(t),this._strategy.isDragging&&e(t)},o=t=>{s(t)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(t=>{t.draggable=!1}),document.addEventListener("mousedown",r,{signal:i}),document.addEventListener("mouseup",a,{signal:i}),document.addEventListener("mousemove",o,{signal:i}),document.addEventListener("mouseleave",a,{signal:i}),document.addEventListener("touchstart",r,{signal:i}),document.addEventListener("touchend",a,{signal:i}),document.addEventListener("touchmove",o,{signal:i})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));class R{_computedStyleCache=new Map;_maxLifetime=16;_cacheCleanInterval=null;constructor(t=16){this._maxLifetime=t}get(t){const e=this._computedStyleCache.get(t),s=Date.now();if(e&&s-e.updated<this._maxLifetime)return e.style;const n=getComputedStyle(t);return this._computedStyleCache.set(t,{style:n,updated:s}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(1e3*this._maxLifetime,5e3))),n}_cleanUpCache(){const t=Date.now();for(const[e,{updated:s}]of this._computedStyleCache.entries())t-s>=this._maxLifetime&&this._computedStyleCache.delete(e);0===this._computedStyleCache.size&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const X=t=>window.TouchEvent&&t instanceof window.TouchEvent;let k;const G=t=>(k||(k=new R),k.get(t)),Y=(t,e,s)=>{const n=parseFloat(t),i=window.devicePixelRatio||1;if("px"===e)return n;if("%"===e)return n/100*(s===document.documentElement?window.innerWidth:s.offsetWidth);if("rem"===e)return n*parseFloat(G(document.documentElement).fontSize);if("em"===e)return n*parseFloat(G(s).fontSize);if("vh"===e||"vw"===e||"vmin"===e||"vmax"===e)return n/100*{vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)}[e];const r={cm:37.7952755906,mm:3.77952755906,in:96};return e in r?n*r[e]*i:0},$=(t,e,s={x:0,y:0})=>{const n=t.getBoundingClientRect(),i=G(t).transform;let r=0,a=0;if("none"!==i){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,s=i.match(e);s&&(r=Y(s[1],s[2],t),a=Y(s[3],s[4],t))}const{clientX:o,clientY:l}=j(e,s);return{x:o-n.left-r+t.scrollLeft,y:l-n.top-a+t.scrollTop}},j=(t,e=null)=>{const{clientX:s,clientY:n}=X(t)?H(t):t;return{clientX:s>0?s:e?e.x:s,clientY:n>0?n:e?e.y:n}},H=t=>{if(t.touches.length){let{clientX:e,clientY:s}=t.touches[0];if(t.touches.length>1){const n=t.touches[1];e=(e+n.clientX)/2,s=(s+n.clientY)/2}return{clientX:e,clientY:s}}const e=t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},z=(t,e=0)=>X(t)?{clientX:t.touches[e].clientX,clientY:t.touches[e].clientY}:{clientX:t.clientX,clientY:t.clientY},W=t=>!t||!X(t)||t.touches.length>0;class q{_touchDragTimeOut;_onTouchDragStart;_payload=null;_delay=500;_firstTouch=null;_lastTouch=null;_epsilon=10;constructor(t,{onTouchDragStart:e},s={}){this._payload=t,this._onTouchDragStart=e,this._delay="number"==typeof s.delay?s.delay:500,this._epsilon="number"==typeof s.epsilon?s.epsilon:10}onStart(t){W(t)&&(this._touchDragTimeOut||(this._firstTouch=z(t,X(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=z(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){W(t)&&(this._lastTouch=z(t))}_clearTimeout(){this._touchDragTimeOut&&(clearTimeout(this._touchDragTimeOut),this._touchDragTimeOut=null)}_resetTouches(){this._clearTimeout(),this._lastTouch=null,this._firstTouch=null,this._payload=null}_checkXDistance(t){return()=>{if(!this._firstTouch||!this._lastTouch)return;let e=!1;e=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,e&&(this._onTouchDragStart(this._payload,t),this._resetTouches())}}}const J=(t,e,s=0,n=0)=>{const i=e.x+e.width+s,r=e.x-s,a=e.y+e.height+n,o=e.y-n,{x:l,y:h}=t;return l>=r&&l<=i&&h>=o&&h<=a},K=(t,e,s,n=0,i=0)=>{if(s&&(s.hiddenIn||s.visibleIn))return s.visibleIn?J({x:t,y:e},s.visibleIn,n,i):!!s.hiddenIn&&!J({x:t,y:e},s.hiddenIn,-n,-i)};class V{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,s){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!s.ghost?.external&&s.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(E)){const t=document.createElement("style");t.type="text/css",t.id=E,t.innerHTML=`\n ${O}\n ${B}\n `,document.head.appendChild(t)}})();const n={x:t,y:e};!s.ghost&&this._dragGhostElement&&(s.ghost={}),s.ghost&&!s.ghost.element&&this._dragGhostElement&&(s.ghost.element=this._dragGhostElement),(({x:t,y:e},s)=>{let n=document.getElementById(T);if(!n){if(n=document.createElement("div"),s.ghost?.element)n.appendChild(s.ghost.element);else{const t=document.createElement("img");t.src=s.ghost?.url||U,t.width=s.ghost?.width||112,t.height=s.ghost?.height||112,n.appendChild(t)}n.id=T,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.willChange="transform",n.style.transform="translate3d(0, 0, 0)",n.style.zIndex="9999",n.style.opacity="0.5",K(t,e,s.ghost||{},s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)||(n.style.display="none"),n.style.pointerEvents="none",document.body.appendChild(n)}})(n,s),(({x:t,y:e},s)=>{const n=document.getElementById(T);if(!n)return;let i=s.ghost?.width,r=s.ghost?.height;typeof i>"u"&&(i=n.getBoundingClientRect().width||112),typeof r>"u"&&(r=n.getBoundingClientRect().height||112);const a=t-i/2,o=e-r/2;n.style.transform=`translate3d(${a}px, ${o}px, 0)`,s.ghost&&(K(t,e,s.ghost,s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)?n.style.animation!=P&&(n.style.animation=P):n.style.animation!=F&&(n.style.animation=F))})(n,s),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(T);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}const Q=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:class{_options={};_instance;_mainDomElement;_currentDrag={};_currentTouch=null;_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_firefoxFallback=t=>{if(!this._currentDrag.event)return;t.preventDefault();const e=t||window.event;this._firefoxDragPosition.x=e.pageX||0,this._firefoxDragPosition.y=e.pageY||0};constructor(t,e,s){this._instance=t,this._mainDomElement=e,this._options=s||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,s="rml_id"){const n=this._mainDomElement.parentNode;if("relative"!==G(n).position)return;this._mainDomElement.style.pointerEvents="none";let i=n.querySelector("."+S);i||(i=document.createElement("div"),i.classList.add(S),n.appendChild(i)),i.classList.remove(C),e.target.getAttribute("draggable");const r=n.querySelector("."+x);this._currentDrag.event=e;const a=e.target,o=a.cloneNode(!0),l=a.getBoundingClientRect();o.style.width=`${l.width}px`,o.style.height=`${l.height}px`,this._currentDrag.ghost=new V(o),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:h,clientY:c}=j(e,this._firefoxDragPosition);this._currentDrag.offset.x=h-l.left,this._currentDrag.offset.y=c-l.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(r,0,0);const{x:g,y:d}=$(n,this._currentDrag.event||e,this._firefoxDragPosition),u=Math.max(1,g),m=Math.max(1,d);this.isDragging=!0,this._instance.dragInObject(t,u,m,s)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:s,y:n}=$(e,t,this._firefoxDragPosition);if(0===s&&0===n)return;const i=Math.max(1,s),r=Math.max(1,n);if(1===i&&1===r)return;let a=i,o=r;if(X(t)){const t=this._options.settings?.fingerSize||0;a=Math.max(2,i+t),o=Math.max(2,r-t)}const{x:l,y:h,options:c}=this._onBeforeUpdateDrag(a,o,{}),g=c||{settings:{},ghost:{}};g.ghost||(g.ghost={}),g.ghost.visibleIn&&g.ghost.hiddenIn||(g.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const d="number"==typeof l?l:a,u="number"==typeof h?h:o;if(this._currentDrag.ghost){const{clientX:e,clientY:s}=j(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,s,g)}this._instance.updateDrag(d,u,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const e=t.querySelector("."+S);e&&e.classList.add(C)}touchStart(t,e,s="rml_id"){e.preventDefault();const n={};"number"==typeof this._options?.settings?.touchDragDelay&&(n.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(n.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new q(void 0,{onTouchDragStart:(e,n)=>{this.dragStart(t,n,s)}},n),this._currentTouch.onStart(e)}touchMove(t){this._currentTouch&&this._currentTouch.onMove(t),this._currentDrag.event&&this.dragUpdate(t)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(t){}}},Symbol.toStringTag,{value:"Module"})),Z=t=>{t.preventDefault(),t.stopPropagation()};class tt{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){this._epsilon="number"==typeof e.epsilon?e.epsilon:15,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,e)=>{const s=this._lastX-t,n=this._lastY-e;return Math.sqrt(s*s+n*n)})(this._startX,this._startY)>this._epsilon&&(this._onCustomDragStart(t),this._isWaiting=!1)}onStart(t){this._startX=t.clientX,this._startY=t.clientY,this.onMove(t),this._isWaiting=!0}onEnd(){this._reset()}_reset(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._isWaiting=!1}}const et="data-rml-old-draggable",st=(t,e)=>{const s=X(t),n={delay:s?500:100,epsilon:s?10:15};if(!e)return n;if(!(s||t instanceof MouseEvent))return n;const{delayKey:i,epsilonKey:r}=s?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[i]&&(n.delay=e.touchDragDelay),"number"==typeof e[r]&&(n.epsilon=e.touchDragEpsilon),n},nt=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:class{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;constructor(t,e,s,n){this._instance=t,this._options=s||{},this._viewName=n,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,s="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(et,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",Z),this._startTarget.addEventListener("dragstart",Z)),this._currentBb=await this._instance.getBoundingClientRect((()=>`[data-rml-custom-view="${this._viewName}"]`)());const{clientX:n,clientY:i}=j(e),r=this._currentBb.x+n,a=this._currentBb.y+i;this.isDragging=!0,this._instance.dragInObject(t,r,a,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:s}=j(t),{url:n,width:i,height:r}=(t=>{let e="",s=112,n=112;if(!t)return{url:U,width:s,height:n};const i=t;if(i instanceof HTMLElement){const t=i.getBoundingClientRect(),r=i.getAttribute("data-rml-ghost-url"),a=i.getAttribute("data-rml-ghost-width"),o=i.getAttribute("data-rml-ghost-height");r?e=r:!r&&i instanceof HTMLImageElement&&i.src&&(e=i.src),e?(s=t.width,n=t.height):e=U,s=a?parseInt(a,10):s,n=o?parseInt(o,10):n}return{url:e||U,width:s,height:n}})(this._startTarget),a=this._currentBb.x+e,o=this._currentBb.y+s,l=this._options||{},h={ghost:{visibleIn:{x:this._currentBb.x-(l.dragInOverlapX||0),y:this._currentBb.y+(l.dragInOverlapY||0),width:this._currentBb.width+(l.dragInOverlapX||0),height:this._currentBb.height+(l.dragInOverlapY||0)},url:n,width:i,height:r},mode:"custom-view"},{x:c,y:g,options:d}=this._onBeforeUpdateDrag(a,o,h),u="number"==typeof c?c:a,m="number"==typeof g?g:o,_=d||h;this._instance.updateDrag(u,m,_)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._instance.dragInObjectEnd()}dragStart(t,e,s){this._instance.disableEvents(),this._startTarget=e.target,this._currentCustomDrag=X(e)?new q(void 0,{onTouchDragStart:(e,n)=>{this._dragStart(t,n,s)}},st(e,this._options)):new tt({onCustomDragStart:e=>this._dragStart(t,e,s)},st(e,this._options)),this._currentCustomDrag.onStart(e)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,e,s="rml_id"){this.dragStart(t,e,s)}touchMove(t){this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable="true"===this._startTarget.getAttribute(et),this._startTarget.removeAttribute(et),this._startTarget.removeEventListener("dragstart",Z))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}},Symbol.toStringTag,{value:"Module"}));return class extends h{static createPlanner(t,e,s,n=[]){return this._create(t,e,s,n)}static async connect(e,s=[]){const n=new h;n.viewName=e;const{resolve:i,promise:r}=c(),{resolve:a,promise:o}=c(),l=new t("custom-view-"+e,window,window.parent,({message:t,args:e})=>{switch(t){case"registerCustomViewDone":i();break;case"returnMethods":n.handleSetup(e[0]),a();break;default:if(n.isSetupDone)return n.executeMessage({message:t,args:e})}});n.setMessageHandler(l);const g=[e];return l.sendMessage("registerCustomView",g),await r,l.sendMessage("getMethods",g),await o,n.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(n.pluginsLoaded),n}static createConfigurator(t,e,s,n=[]){return this._create(t,e,s,n)}static create(t,e,s,n){return this._create(t,e,s,n)}static createViewer(t,e,s,n=[]){return this._create(t,e,s,n)}static async _create(t,i,r,l){return new Promise(async(h,c)=>{try{const c=n((()=>{const t=(t=>JSON.parse(JSON.stringify(t)))(a);t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,n=s.length;t<n;t++){const n=e[s[t]];if(n)return n.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const n=(()=>{const t=(()=>{try{return window.self!==window.top}catch{return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:s}=new URL(e);return s})();return n&&(t=>!!(e.includes(t)||t.endsWith("roomle.com")||t.endsWith("gitlab.io")||t.endsWith("gitlab.com")))(n)&&(t.configuratorId="demoConfigurator"),t.customApiUrl=void 0,t.emails=!1,t})(),(t=>(o(t),t?.customApiUrl&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(r));(t=>{t.featureFlags||(t.featureFlags={}),"boolean"!=typeof t.featureFlags.realPartList&&(t.featureFlags.realPartList=!0),"boolean"!=typeof t.featureFlags.globalCallbacks&&(t.featureFlags.globalCallbacks=!0),"boolean"!=typeof t.featureFlags.mocAr&&(t.featureFlags.mocAr=!1)})(c);const g=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const s=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",n=e.overrideTenant||9,i=s+"/configurators/"+t,r="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+r),o=new Request(i,{method:"GET",headers:new Headers({apiKey:r,currentTenant:n,locale:"en",language:"en",device:1,token:a,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:h}=await l.json();return h})(t,c);r=((t,e)=>{e.configuratorId=t.id;const s=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const s=JSON.parse(JSON.stringify(t));return n(s,e)})(s,e)})(g,c);const d=new this(g,i,r,l,h);return await Promise.allSettled(d.pluginsLoaded),d}catch(t){return c(t)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(e,s,n,i,r){if(super(),!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(w.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(m)){const t=n.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id=m;const s="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+s),"")+s,r=d();e.innerHTML=`\n .${p}{${_}:${r};}\n .${y}{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .${f}{width:100%;height:100%;opacity:1}\n .${v}{height:calc(var(${_},1vh)*100)}\n .${b}{overflow:hidden}\n `,document.head.appendChild(e)}this._executeMessage=this._executeMessage.bind(this);const a=new t("website",window,null,this._executeMessage);this.setMessageHandler(a),this._onResize=this._onResize.bind(this),l()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=n,this._configuratorSettings=e;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=r,this._container.appendChild(o),this._iframe=o,this.setupPlugins(i,this._iframe),w.set(s,!0)}teardown(){this._container&&w.delete(this._container);const t=this._container.querySelector("iframe");t&&this._container.removeChild(t),window.removeEventListener("resize",this._onResize)}_createIframe(){const t=document.createElement("iframe");let e=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(e=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(e=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(e=this._initData.overrideServerUrl),t.src=e,t.classList.add(p),t.classList.add(f),t}_onResize(){u(this._iframe)}_onUseFullPage(){this._iframe.classList.add(y),document.documentElement.classList.add(b),window.document.body.classList.add(b),l()&&(u(this._iframe),this._iframe.classList.add(v))}_onBackToWebsite(){this._iframe.classList.remove(y),this._iframe.classList.remove(v),document.documentElement.classList.remove(b),window.document.body.classList.remove(b)}_executeMessage({message:t,args:e},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===t?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===t?(this.handleSetup(e[0]),g(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),g(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:t,args:e})}}},"object"==typeof exports&&typeof module<"u"?module.exports=e():"function"==typeof define&&define.amd?define(e):((t=typeof globalThis<"u"?globalThis:t||self)["roomle-embedding-lib"]=t["roomle-embedding-lib"]||{},t["roomle-embedding-lib"].umd=t["roomle-embedding-lib"].umd||{},t["roomle-embedding-lib"].umd.min=t["roomle-embedding-lib"].umd.min||{},t["roomle-embedding-lib"].umd.min.js=e());
1
+ var t,e;t=this,e=function(){"use strict";class t{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(t,e,s,n){this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=s,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((s,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=t=>{if(!t||!t.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return i.port1.close(),i.port2.close(),this._prepareError(t),n(t)}e.error?n(e.error):void 0!==e.result?s(e.result):s(void 0),i.port1.close(),i.port2.close()};let r="";try{r=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(r,"*",[i.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const s=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const n=this._execMessage(s,t);if(void 0===n)return;n.then((t={})=>{let s,n;"object"==typeof t&&null!==t&&(s=t.error,n=t.result),s?e.postMessage(JSON.stringify({error:s})):void 0!==n?e.postMessage(JSON.stringify({result:n})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this._prepareError(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this._prepareError(t)}))}}_prepareError(t){return"string"==typeof t?this._side+": "+t:(t.message=this._side+": "+t.message,t.message)}}const e=["127.0.0.1","localhost","0.0.0.0"],s=["language","browserLanguage","userLanguage","systemLanguage"],n=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=n(t[s],e[s]):t[s]=e[s]}catch{t[s]=e[s]}return t};var i,r=((i=r||{}).BOTTOM_BAR="bottom_bar",i.PARTLIST_BOUNDS="partlist_bounds",i.INTERACTION_NOTES="interaction_notes",i.PARAMETER_GROUPS="parameter_groups",i);const a={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[r.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},o=t=>{if(!t)return;const e=Object.keys(t);for(const s of e){const e=t[s];if(!Array.isArray(e)&&"object"==typeof e&&null!==e&&o(e),Array.isArray(e))for(const t of e)o(t);("true"===e||"false"===e)&&(t[s]="true"===e)}},l=()=>/(android)/i.test(navigator.userAgent);class h{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(t){this._messageHandler=t}handleSetup(t){const{methods:e,callbacks:s}=t;e.forEach(t=>{const e=t.split("."),s=e[0],n=e[1];this[s]||(this[s]={}),this[s][n]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(t,[...arguments])}.bind(this)}),s.forEach(t=>{const e=t.split("."),s=e[0],n=e[1],i=e[2];this[s]||(this[s]={}),this[s][n]||(this[s][n]={}),this[s][n][i]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split("."),n=s[0],i=s[1],r=3===s.length?s[2]:null;if(r&&this[n][i][r]){const t=this[n][i][r](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}setupPlugins(t,e,s="website"){for(const n of t)"string"==typeof n&&"dragIn"===n?this.pluginsLoaded.push(new Promise((t,n)=>{try{Promise.resolve().then(()=>N).then(({DragIn:i})=>{const r=new i(this.ui,e,s,this.viewName);r.init().then(()=>{this.plugins.dragIn=r,t()},n)})}catch(t){n(t)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((t,i)=>{try{n.loader().then(r=>{const a=new r(this.ui,e,s,this.viewName);a.init().then(()=>{this.plugins[n.name]=a,t()},i)})}catch(t){i(t)}}))}}const c=()=>{let t,e;return{promise:new Promise((s,n)=>{t=s,e=n}),resolve:t,reject:e}},g=(t,e,s)=>{let n=null;Object.defineProperty(t,e,{get:()=>n||s,set(t){n=t?.mute?t.value:t}})},d=()=>.01*window.innerHeight+"px",u=t=>{t&&setTimeout(()=>t.style.setProperty(_,d()),0)},m="rml-styles",_="--rml-full-height",p="rml-container",f="rml-fill",y="rml-pos",v="rml-android-height",b="rml-overflow-hidden",w=new Map;class D{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,s,n){this._instance=t,this._mainDomElement=e,this._mode=s,this._viewName=n}async init(){return Promise.resolve()}}const E="rml-drag-in-styles",T="rml-drag-in-drag-element",S="rml-drag-in-overlay",x="rml-drag-in-drag-ghost",I="rml-drag-in-fade-in",M="rml-drag-in-fade-out",C="rml-display-none",A="250ms",L="forwards",O=`@keyframes ${I} {from{opacity: 0;}to {opacity: 0.5;}}`,B=`@keyframes ${M} {from{opacity: 0.5;}to {opacity: 0;}}`,P=`${I} ${A} ${L}`,F=`${M} ${A} ${L}`,U="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",N=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends D{options={};_customDragSignal=new AbortController;_injectStyles(){if(!document.getElementById(E)){const t=document.createElement("style");t.type="text/css",t.id=E,t.innerHTML=`\n .${C}{display:none}\n .${S}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${x}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${O}\n ${B}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+x);e||(e=document.createElement("div"),e.classList.add(x),e.innerText=" ",t.appendChild(e))}constructor(t,e,s,n){super(t,e,s,n),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await Promise.resolve().then(()=>Q);this._strategy=new t(this._instance,this._mainDomElement,{settings:this.options,mode:"website"})}catch(t){throw t}else{if("custom-view"!==this._mode)throw new Error("Unsupported mode");try{const{DragInFromCustomViewStrategy:t}=await Promise.resolve().then(()=>nt);this._strategy=new t(this._instance,this._mainDomElement,this.options,this._viewName)}catch(t){throw t}}}get isDragging(){return this._strategy.isDragging}dragStart(t,e,s="rml_id"){this._strategy.dragStart(t,e,s)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,e,s="rml_id"){this._strategy.touchStart(t,e,s)}touchMove(t){this._strategy.touchMove(t)}touchEnd(){this._strategy.touchEnd()}dispose(){this._strategy.dispose()}beforeUpdateGhost(t){this._strategy.beforeUpdateGhost(t)}registerCustomDrag({customDragStart:t,customDragEnd:e,customDragUpdate:s,beforeUpdateGhost:n}){n&&this._strategy.beforeUpdateGhost(n);const i=this._customDragSignal.signal,r=e=>{"true"===e.target.getAttribute("data-rml-draggable")&&t(e)},a=t=>{this._strategy.releaseInput(t),this._strategy.isDragging&&e(t)},o=t=>{s(t)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(t=>{t.draggable=!1}),document.addEventListener("mousedown",r,{signal:i}),document.addEventListener("mouseup",a,{signal:i}),document.addEventListener("mousemove",o,{signal:i}),document.addEventListener("mouseleave",a,{signal:i}),document.addEventListener("touchstart",r,{signal:i}),document.addEventListener("touchend",a,{signal:i}),document.addEventListener("touchmove",o,{signal:i})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));class R{_computedStyleCache=new Map;_maxLifetime=16;_cacheCleanInterval=null;constructor(t=16){this._maxLifetime=t}get(t){const e=this._computedStyleCache.get(t),s=Date.now();if(e&&s-e.updated<this._maxLifetime)return e.style;const n=getComputedStyle(t);return this._computedStyleCache.set(t,{style:n,updated:s}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(1e3*this._maxLifetime,5e3))),n}_cleanUpCache(){const t=Date.now();for(const[e,{updated:s}]of this._computedStyleCache.entries())t-s>=this._maxLifetime&&this._computedStyleCache.delete(e);0===this._computedStyleCache.size&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const X=t=>window.TouchEvent&&t instanceof window.TouchEvent;let k;const G=t=>(k||(k=new R),k.get(t)),Y=(t,e,s)=>{const n=parseFloat(t),i=window.devicePixelRatio||1;if("px"===e)return n;if("%"===e)return n/100*(s===document.documentElement?window.innerWidth:s.offsetWidth);if("rem"===e)return n*parseFloat(G(document.documentElement).fontSize);if("em"===e)return n*parseFloat(G(s).fontSize);if("vh"===e||"vw"===e||"vmin"===e||"vmax"===e)return n/100*{vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)}[e];const r={cm:37.7952755906,mm:3.77952755906,in:96};return e in r?n*r[e]*i:0},$=(t,e,s={x:0,y:0})=>{const n=t.getBoundingClientRect(),i=G(t).transform;let r=0,a=0;if("none"!==i){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,s=i.match(e);s&&(r=Y(s[1],s[2],t),a=Y(s[3],s[4],t))}const{clientX:o,clientY:l}=j(e,s);return{x:o-n.left-r+t.scrollLeft,y:l-n.top-a+t.scrollTop}},j=(t,e=null)=>{const{clientX:s,clientY:n}=X(t)?H(t):t;return{clientX:s>0?s:e?e.x:s,clientY:n>0?n:e?e.y:n}},H=t=>{if(t.touches.length){let{clientX:e,clientY:s}=t.touches[0];if(t.touches.length>1){const n=t.touches[1];e=(e+n.clientX)/2,s=(s+n.clientY)/2}return{clientX:e,clientY:s}}const e=t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},z=(t,e=0)=>X(t)?{clientX:t.touches[e].clientX,clientY:t.touches[e].clientY}:{clientX:t.clientX,clientY:t.clientY},W=t=>!t||!X(t)||t.touches.length>0;class q{_touchDragTimeOut;_onTouchDragStart;_payload=null;_delay=500;_firstTouch=null;_lastTouch=null;_epsilon=10;constructor(t,{onTouchDragStart:e},s={}){this._payload=t,this._onTouchDragStart=e,this._delay="number"==typeof s.delay?s.delay:500,this._epsilon="number"==typeof s.epsilon?s.epsilon:10}onStart(t){W(t)&&(this._touchDragTimeOut||(this._firstTouch=z(t,X(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=z(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){W(t)&&(this._lastTouch=z(t))}_clearTimeout(){this._touchDragTimeOut&&(clearTimeout(this._touchDragTimeOut),this._touchDragTimeOut=null)}_resetTouches(){this._clearTimeout(),this._lastTouch=null,this._firstTouch=null,this._payload=null}_checkXDistance(t){return()=>{if(!this._firstTouch||!this._lastTouch)return;let e=!1;e=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,e&&(this._onTouchDragStart(this._payload,t),this._resetTouches())}}}const J=(t,e,s=0,n=0)=>{const i=e.x+e.width+s,r=e.x-s,a=e.y+e.height+n,o=e.y-n,{x:l,y:h}=t;return l>=r&&l<=i&&h>=o&&h<=a},K=(t,e,s,n=0,i=0)=>{if(s&&(s.hiddenIn||s.visibleIn))return s.visibleIn?J({x:t,y:e},s.visibleIn,n,i):!!s.hiddenIn&&!J({x:t,y:e},s.hiddenIn,-n,-i)};class V{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,s){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!s.ghost?.external&&s.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(E)){const t=document.createElement("style");t.type="text/css",t.id=E,t.innerHTML=`\n ${O}\n ${B}\n `,document.head.appendChild(t)}})();const n={x:t,y:e};!s.ghost&&this._dragGhostElement&&(s.ghost={}),s.ghost&&!s.ghost.element&&this._dragGhostElement&&(s.ghost.element=this._dragGhostElement),(({x:t,y:e},s)=>{let n=document.getElementById(T);if(!n){if(n=document.createElement("div"),s.ghost?.element)n.appendChild(s.ghost.element);else{const t=document.createElement("img");t.src=s.ghost?.url||U,t.width=s.ghost?.width||112,t.height=s.ghost?.height||112,n.appendChild(t)}n.id=T,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.willChange="transform",n.style.transform="translate3d(0, 0, 0)",n.style.zIndex="9999",n.style.opacity="0.5",K(t,e,s.ghost||{},s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)||(n.style.display="none"),n.style.pointerEvents="none",document.body.appendChild(n)}})(n,s),(({x:t,y:e},s)=>{const n=document.getElementById(T);if(!n)return;let i=s.ghost?.width,r=s.ghost?.height;typeof i>"u"&&(i=n.getBoundingClientRect().width||112),typeof r>"u"&&(r=n.getBoundingClientRect().height||112);const a=t-i/2,o=e-r/2;n.style.transform=`translate3d(${a}px, ${o}px, 0)`,s.ghost&&(K(t,e,s.ghost,s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)?n.style.animation!=P&&(n.style.animation=P):n.style.animation!=F&&(n.style.animation=F))})(n,s),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(T);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}const Q=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:class{_options={};_instance;_mainDomElement;_currentDrag={};_currentTouch=null;_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_firefoxFallback=t=>{if(!this._currentDrag.event)return;t.preventDefault();const e=t||window.event;this._firefoxDragPosition.x=e.pageX||0,this._firefoxDragPosition.y=e.pageY||0};constructor(t,e,s){this._instance=t,this._mainDomElement=e,this._options=s||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,s="rml_id"){const n=this._mainDomElement.parentNode;if("relative"!==G(n).position)return;this._mainDomElement.style.pointerEvents="none";let i=n.querySelector("."+S);i||(i=document.createElement("div"),i.classList.add(S),n.appendChild(i)),i.classList.remove(C),e.target.getAttribute("draggable");const r=n.querySelector("."+x);this._currentDrag.event=e;const a=e.target,o=a.cloneNode(!0),l=a.getBoundingClientRect();o.style.width=`${l.width}px`,o.style.height=`${l.height}px`,this._currentDrag.ghost=new V(o),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:h,clientY:c}=j(e,this._firefoxDragPosition);this._currentDrag.offset.x=h-l.left,this._currentDrag.offset.y=c-l.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(r,0,0);const{x:g,y:d}=$(n,this._currentDrag.event||e,this._firefoxDragPosition),u=Math.max(1,g),m=Math.max(1,d);this.isDragging=!0,this._instance.dragInObject(t,u,m,s)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:s,y:n}=$(e,t,this._firefoxDragPosition);if(0===s&&0===n)return;const i=Math.max(1,s),r=Math.max(1,n);if(1===i&&1===r)return;let a=i,o=r;if(X(t)){const t=this._options.settings?.fingerSize||0;a=Math.max(2,i+t),o=Math.max(2,r-t)}const{x:l,y:h,options:c}=this._onBeforeUpdateDrag(a,o,{}),g=c||{settings:{},ghost:{}};g.ghost||(g.ghost={}),g.ghost.visibleIn&&g.ghost.hiddenIn||(g.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const d="number"==typeof l?l:a,u="number"==typeof h?h:o;if(this._currentDrag.ghost){const{clientX:e,clientY:s}=j(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,s,g)}this._instance.updateDrag(d,u,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const e=t.querySelector("."+S);e&&e.classList.add(C)}touchStart(t,e,s="rml_id"){e.preventDefault();const n={};"number"==typeof this._options?.settings?.touchDragDelay&&(n.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(n.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new q(void 0,{onTouchDragStart:(e,n)=>{this.dragStart(t,n,s)}},n),this._currentTouch.onStart(e)}touchMove(t){this._currentTouch&&this._currentTouch.onMove(t),this._currentDrag.event&&this.dragUpdate(t)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(t){}}},Symbol.toStringTag,{value:"Module"})),Z=t=>{t.preventDefault(),t.stopPropagation()};class tt{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){this._epsilon="number"==typeof e.epsilon?e.epsilon:15,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,e)=>{const s=this._lastX-t,n=this._lastY-e;return Math.sqrt(s*s+n*n)})(this._startX,this._startY)>this._epsilon&&(this._onCustomDragStart(t),this._isWaiting=!1)}onStart(t){this._startX=t.clientX,this._startY=t.clientY,this.onMove(t),this._isWaiting=!0}onEnd(){this._reset()}_reset(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._isWaiting=!1}}const et="data-rml-old-draggable",st=(t,e)=>{const s=X(t),n={delay:s?500:100,epsilon:s?10:15};if(!e)return n;if(!(s||t instanceof MouseEvent))return n;const{delayKey:i,epsilonKey:r}=s?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[i]&&(n.delay=e.touchDragDelay),"number"==typeof e[r]&&(n.epsilon=e.touchDragEpsilon),n},nt=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:class{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;constructor(t,e,s,n){this._instance=t,this._options=s||{},this._viewName=n,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,s="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(et,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",Z),this._startTarget.addEventListener("dragstart",Z)),this._currentBb=await this._instance.getBoundingClientRect((()=>`[data-rml-custom-view="${this._viewName}"]`)());const{clientX:n,clientY:i}=j(e),r=this._currentBb.x+n,a=this._currentBb.y+i;this.isDragging=!0,this._instance.dragInObject(t,r,a,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:s}=j(t),{url:n,width:i,height:r}=(t=>{let e="",s=112,n=112;if(!t)return{url:U,width:s,height:n};const i=t;if(i instanceof HTMLElement){const t=i.getBoundingClientRect(),r=i.getAttribute("data-rml-ghost-url"),a=i.getAttribute("data-rml-ghost-width"),o=i.getAttribute("data-rml-ghost-height");r?e=r:!r&&i instanceof HTMLImageElement&&i.src&&(e=i.src),e?(s=t.width,n=t.height):e=U,s=a?parseInt(a,10):s,n=o?parseInt(o,10):n}return{url:e||U,width:s,height:n}})(this._startTarget),a=this._currentBb.x+e,o=this._currentBb.y+s,l=this._options||{},h={ghost:{visibleIn:{x:this._currentBb.x-(l.dragInOverlapX||0),y:this._currentBb.y+(l.dragInOverlapY||0),width:this._currentBb.width+(l.dragInOverlapX||0),height:this._currentBb.height+(l.dragInOverlapY||0)},url:n,width:i,height:r},mode:"custom-view"},{x:c,y:g,options:d}=this._onBeforeUpdateDrag(a,o,h),u="number"==typeof c?c:a,m="number"==typeof g?g:o,_=d||h;this._instance.updateDrag(u,m,_)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._instance.dragInObjectEnd()}dragStart(t,e,s){this._instance.disableEvents(),this._startTarget=e.target,this._currentCustomDrag=X(e)?new q(void 0,{onTouchDragStart:(e,n)=>{this._dragStart(t,n,s)}},st(e,this._options)):new tt({onCustomDragStart:e=>this._dragStart(t,e,s)},st(e,this._options)),this._currentCustomDrag.onStart(e)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,e,s="rml_id"){this.dragStart(t,e,s)}touchMove(t){this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable="true"===this._startTarget.getAttribute(et),this._startTarget.removeAttribute(et),this._startTarget.removeEventListener("dragstart",Z))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}},Symbol.toStringTag,{value:"Module"}));return class extends h{static createPlanner(t,e,s,n=[]){return this._create(t,e,s,n)}static async connect(e,s=[]){const n=new h;n.viewName=e;const{resolve:i,promise:r}=c(),{resolve:a,promise:o}=c(),l=new t("custom-view-"+e,window,window.parent,({message:t,args:e})=>{switch(t){case"registerCustomViewDone":i();break;case"returnMethods":n.handleSetup(e[0]),a();break;default:if(n.isSetupDone)return n.executeMessage({message:t,args:e})}});n.setMessageHandler(l);const g=[e];return l.sendMessage("registerCustomView",g),await r,l.sendMessage("getMethods",g),await o,n.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(n.pluginsLoaded),n}static createConfigurator(t,e,s,n=[]){return this._create(t,e,s,n)}static create(t,e,s,n){return this._create(t,e,s,n)}static createViewer(t,e,s,n=[]){return this._create(t,e,s,n)}static async _create(t,i,r,l){return new Promise(async(h,c)=>{try{const c=n((()=>{const t=(t=>JSON.parse(JSON.stringify(t)))(a);t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,n=s.length;t<n;t++){const n=e[s[t]];if(n)return n.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const n=(()=>{const t=(()=>{try{return window.self!==window.top}catch{return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:s}=new URL(e);return s})();return n&&(t=>!!(e.includes(t)||t.endsWith("roomle.com")||t.endsWith("gitlab.io")||t.endsWith("gitlab.com")))(n)&&(t.configuratorId="demoConfigurator"),t.customApiUrl=void 0,t.emails=!1,t})(),(t=>(o(t),t?.customApiUrl&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(r));(t=>{t.featureFlags||(t.featureFlags={}),"boolean"!=typeof t.featureFlags.realPartList&&(t.featureFlags.realPartList=!0),"boolean"!=typeof t.featureFlags.globalCallbacks&&(t.featureFlags.globalCallbacks=!0),"boolean"!=typeof t.featureFlags.mocAr&&(t.featureFlags.mocAr=!1)})(c);const g=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const s=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",n=e.overrideTenant||9,i=s+"/configurators/"+t,r="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+r),o=new Request(i,{method:"GET",headers:new Headers({apiKey:r,currentTenant:n,locale:"en",language:"en",device:1,token:a,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:h}=await l.json();return h})(t,c);r=((t,e)=>{e.configuratorId=t.id;const s=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const s=JSON.parse(JSON.stringify(t));return n(s,e)})(s,e)})(g,c);const d=new this(g,i,r,l,h);return await Promise.allSettled(d.pluginsLoaded),d}catch(t){return c(t)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(e,s,n,i,r){if(super(),!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(w.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(m)){const t=n.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id=m;const s="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+s),"")+s,r=d();e.innerHTML=`\n .${p}{${_}:${r};}\n .${y}{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .${f}{width:100%;height:100%;opacity:1}\n .${v}{height:calc(var(${_},1vh)*100)}\n .${b}{overflow:hidden}\n `,document.head.appendChild(e)}this._executeMessage=this._executeMessage.bind(this);const a=new t("website",window,null,this._executeMessage);this.setMessageHandler(a),this._onResize=this._onResize.bind(this),l()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=n,this._configuratorSettings=e;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=r,this._container.appendChild(o),this._iframe=o,this.setupPlugins(i,this._iframe),w.set(s,!0)}teardown(){this._container&&w.delete(this._container);const t=this._container.querySelector("iframe");t&&this._container.removeChild(t),window.removeEventListener("resize",this._onResize)}_createIframe(){const t=document.createElement("iframe");let e=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(e=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(e=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(e=this._initData.overrideServerUrl),t.src=e,t.classList.add(p),t.classList.add(f),t}_onResize(){u(this._iframe)}_onUseFullPage(){this._iframe.classList.add(y),document.documentElement.classList.add(b),window.document.body.classList.add(b),l()&&(u(this._iframe),this._iframe.classList.add(v))}_onBackToWebsite(){this._iframe.classList.remove(y),this._iframe.classList.remove(v),document.documentElement.classList.remove(b),window.document.body.classList.remove(b)}_executeMessage({message:t,args:e},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===t?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===t?(this.handleSetup(e[0]),g(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),g(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:t,args:e})}}},"object"==typeof exports&&typeof module<"u"?module.exports=e():"function"==typeof define&&define.amd?define(e):((t=typeof globalThis<"u"?globalThis:t||self)["roomle-embedding-lib"]=t["roomle-embedding-lib"]||{},t["roomle-embedding-lib"].umd=t["roomle-embedding-lib"].umd||{},t["roomle-embedding-lib"].umd.min=t["roomle-embedding-lib"].umd.min||{},t["roomle-embedding-lib"].umd.min.js=e());
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -15,9 +15,9 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
15
15
  adjustIcon?: boolean;
16
16
  isSelected?: boolean;
17
17
  }> & Readonly<{}>, {
18
+ isVisible: boolean;
18
19
  onClick: () => void;
19
20
  isSelected: boolean;
20
- isVisible: boolean;
21
21
  showText: boolean;
22
22
  adjustIcon: boolean;
23
23
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>, {
@@ -9,6 +9,7 @@ import { RapiTagForUi } from '@roomle/web-sdk/typings/rapi-types';
9
9
  import { GridViewVariantElement } from '../components/grid-view/-utils/GridViewHelper';
10
10
  import { WallDimensionTransferable } from '@roomle/web-sdk/planner-core/src/view-model/wall-plan-element-view-model';
11
11
  import { PlanObjectPosition } from '@roomle/web-sdk/typings/planner';
12
+ import { DimensionLabelsTransferable } from '@roomle/web-sdk/planner-core/src/utils/measurements';
12
13
 
13
14
  export type EnsurePrefix<T extends string> = Record<string, `${T}${string}`>;
14
15
  type UiStateIdentifier = EnsurePrefix<'UI_STATE_'>;
@@ -71,6 +72,7 @@ export interface UiState extends SharedUiState {
71
72
  isInIframe: boolean;
72
73
  firstTimeRoomView: boolean;
73
74
  currentInteractionView: Enumify<typeof INTERACTION_VIEW_TYPE>;
75
+ dimensionLabels: Nullable<DimensionLabelsTransferable>;
74
76
  }
75
77
  export declare const UI_STATE_MUTATIONS: UiStateIdentifier;
76
78
  export declare const UI_STATE_ACTIONS: UiStateIdentifier;
@@ -240,8 +240,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
240
240
  isString: BooleanConstructor;
241
241
  disabled: BooleanConstructor;
242
242
  }>> & Readonly<{}>, {
243
- disabled: boolean;
244
243
  isString: boolean;
244
+ disabled: boolean;
245
245
  }, {}, {
246
246
  NumericInput: import('vue').DefineComponent<{
247
247
  valueLabel: string;