@roomle/embedding-lib 5.32.0 → 5.33.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/md/web/embedding/CHANGELOG.md +38 -62
- package/package.json +1 -1
- package/packages/embedding-lib/src/embedding-lib.d.ts +1 -0
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/create-catalog.d.ts +1 -0
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/default-api-options.d.ts +6 -22
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/util.d.ts +6 -1
- package/packages/web-sdk/packages/common-core/mock/kernel-instances.d.ts +1 -0
- package/packages/web-sdk/packages/common-core/src/configurator-kernel-access.d.ts +2 -2
- package/packages/web-sdk/packages/configurator-core/mock/configurator-mock-data.d.ts +0 -2
- package/packages/web-sdk/packages/configurator-core/src/roomle-configurator.d.ts +2 -0
- package/packages/web-sdk/packages/configurator-core/src/webgl/configurator-scene-manager.d.ts +2 -0
- package/packages/web-sdk/packages/homag-intelligence/__tests__/hi-object-selection-test.d.ts +1 -0
- package/packages/web-sdk/packages/homag-intelligence/src/debug-logging.d.ts +2 -2
- package/packages/web-sdk/packages/homag-intelligence/src/glue-logic.d.ts +4 -4
- package/packages/web-sdk/packages/homag-intelligence/src/hi-object-selection.d.ts +9 -1
- package/packages/web-sdk/packages/homag-intelligence/src/loader.d.ts +4 -20
- package/packages/web-sdk/packages/homag-intelligence/src/model/oc-scripts-domain.model.d.ts +11 -8
- package/packages/web-sdk/packages/planner-core/src/webgl/planner-scene-manager.d.ts +3 -1
- package/packages/web-sdk/packages/typings/kernel.d.ts +6 -7
- package/packages/web-sdk/packages/typings/planner.d.ts +2 -2
- package/roomle-embedding-lib.es.js +22 -21
- package/roomle-embedding-lib.es.min.js +1 -1
- package/roomle-embedding-lib.umd.js +6 -6
- package/roomle-embedding-lib.umd.min.js +1 -1
- package/src/common/composables/use-configurator-actions-visibility.d.ts +1 -1
- package/src/configurator/business-logic/sdk-connector.d.ts +1 -0
- package/src/configurator/embedding/exposed-api.d.ts +5 -0
- package/src/planner/business-logic/sdk-connector-planner.d.ts +1 -0
|
@@ -1,70 +1,46 @@
|
|
|
1
|
-
## [5.
|
|
1
|
+
## [5.33.0-alpha.1](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.32.0...embedding-lib-v5.33.0-alpha.1) (2025-11-24)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Features
|
|
5
5
|
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* core api
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* core
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* get valid containers when sub article is selected ([eaeef6e](https://github.com/roomle-dev/roomle-ui/commit/eaeef6ec78309c51bf1a5817fb8673a5270cd4ac))
|
|
26
|
-
* getExternalObjectSnapshot api ([0b2f2d7](https://github.com/roomle-dev/roomle-ui/commit/0b2f2d7d7fb779f1ef07bca3354f3e31f5696ab7))
|
|
27
|
-
* glue logic - addSubArticle ([76f5bdc](https://github.com/roomle-dev/roomle-ui/commit/76f5bdcd3fbd3828d884bafee0fe2028bce7fb5c))
|
|
28
|
-
* glue logic - get valid containers for sub articles ([a829ccf](https://github.com/roomle-dev/roomle-ui/commit/a829ccfd2266a89dadb5b9a63f5eb87fd78d40b6))
|
|
29
|
-
* glue logic - get valid sub articles ([0f67084](https://github.com/roomle-dev/roomle-ui/commit/0f6708405dc81f342c5733aae40425ddaee9a73e))
|
|
30
|
-
* glue-layer - sub article requests ([451e3b1](https://github.com/roomle-dev/roomle-ui/commit/451e3b12217b75f986024b2aec175230a966482d))
|
|
31
|
-
* HI api - getExternalObjectValidSubArticles ([e21f623](https://github.com/roomle-dev/roomle-ui/commit/e21f623ae0c734c6151804d97a13a39493f33a28))
|
|
32
|
-
* hi library api for sub articles ([a273e65](https://github.com/roomle-dev/roomle-ui/commit/a273e65052d7d9f5936d3ee8bb0f56c67022562f))
|
|
33
|
-
* initially load group from save data if "startInDetail: true" ([a79bcb6](https://github.com/roomle-dev/roomle-ui/commit/a79bcb673b7f59ec9f5f16003981e840c3a2ede5))
|
|
34
|
-
* tidy-up core api - requestPreviewGeometry ([430f14d](https://github.com/roomle-dev/roomle-ui/commit/430f14dca912dffa859190b957e44e1bf935db07))
|
|
35
|
-
* update article types ([59de0c0](https://github.com/roomle-dev/roomle-ui/commit/59de0c0d4713557604642d3d06d2e02b835a15cb))
|
|
36
|
-
* update configurable object from history on undo/redo ([ef89aef](https://github.com/roomle-dev/roomle-ui/commit/ef89aef8be0f4da67116b3669382cfb0623c4c89))
|
|
37
|
-
* update external object group from history on undo/redo ([0ba38a9](https://github.com/roomle-dev/roomle-ui/commit/0ba38a9c800dd82fef278c1a2d5c10e8c7790d5f))
|
|
38
|
-
* **core:** upgrade to version 2.64.0-alpha.10 ([5086296](https://github.com/roomle-dev/roomle-ui/commit/5086296e1f9c6e41526468370294a9b693243394))
|
|
39
|
-
* **core:** upgrade to version 2.64.0-alpha.11 ([8da30f3](https://github.com/roomle-dev/roomle-ui/commit/8da30f36a2ff46c363c8311410617c97c62aa9db))
|
|
40
|
-
* **core:** upgrade to version 2.64.0-alpha.12 ([eaefd95](https://github.com/roomle-dev/roomle-ui/commit/eaefd95b4d34c7081da5c19ccffcc3680e91a1c9))
|
|
41
|
-
* **core:** upgrade to version 2.64.0-alpha.1 ([03314f1](https://github.com/roomle-dev/roomle-ui/commit/03314f1f61df1162e54cd828ea9caba17b4b8671))
|
|
42
|
-
* **core:** upgrade to version 2.64.0-alpha.2 ([783b045](https://github.com/roomle-dev/roomle-ui/commit/783b045fcc6d62434d3f2d554c47fb27b818243e))
|
|
43
|
-
* **core:** upgrade to version 2.64.0-alpha.3 ([3fcde79](https://github.com/roomle-dev/roomle-ui/commit/3fcde79f483fc0f7dddcd8140ff9292a1e5922e0))
|
|
44
|
-
* **core:** upgrade to version 2.64.0-alpha.4 ([b3afac3](https://github.com/roomle-dev/roomle-ui/commit/b3afac377fdfe47d9b4ec0f31cbcff8a89aec64d))
|
|
45
|
-
* **core:** upgrade to version 2.64.0-alpha.5 ([ace7bb0](https://github.com/roomle-dev/roomle-ui/commit/ace7bb017637379c72e747ad19d256a40f228a92))
|
|
46
|
-
* **core:** upgrade to version 2.64.0-alpha.6 ([8ab32d8](https://github.com/roomle-dev/roomle-ui/commit/8ab32d831a9f7c965fa6cd14a39b0a8dfa0aad02))
|
|
47
|
-
* **core:** upgrade to version 2.64.0-alpha.7 ([7bf70a6](https://github.com/roomle-dev/roomle-ui/commit/7bf70a649dce24de73fa1d34b517a3dcf182e4d0))
|
|
48
|
-
* **core:** upgrade to version 2.64.0-alpha.8 ([433f820](https://github.com/roomle-dev/roomle-ui/commit/433f820150e4e6d9b098c1ce93048bf9fe41ab1c))
|
|
49
|
-
* **core:** upgrade to version 2.64.0-alpha.9 ([61b7de7](https://github.com/roomle-dev/roomle-ui/commit/61b7de7538883e07eee8f330094d9b75dc3d602f))
|
|
6
|
+
* core api - getDrawnPoints ([5b92bd3](https://github.com/roomle-dev/roomle-ui/commit/5b92bd3bacc3d85e57af7f9efe6bc16e4ccac4fd))
|
|
7
|
+
* core api - removed externalComponent from possible children ([5efeb4b](https://github.com/roomle-dev/roomle-ui/commit/5efeb4b07b5c15b715c08d27457d36caff0d10f1))
|
|
8
|
+
* core api - valid container modules ([eeb3060](https://github.com/roomle-dev/roomle-ui/commit/eeb306085afbeefbf7f1822d0a6ee0336750cdd8))
|
|
9
|
+
* create possible children from sub articles ([7af9ea4](https://github.com/roomle-dev/roomle-ui/commit/7af9ea42ad8862e4a1fbe4ac98a5499ddad13536))
|
|
10
|
+
* distinguish between articles and sub-articles ([d9b2238](https://github.com/roomle-dev/roomle-ui/commit/d9b223815edfeecd343cd750aeb278c899005399))
|
|
11
|
+
* exposed api "loadPlanXml" ([6d490ba](https://github.com/roomle-dev/roomle-ui/commit/6d490bac91944f956a1e7b707a86dbea228fcea3))
|
|
12
|
+
* get valid sub articles for external object ([0a55b35](https://github.com/roomle-dev/roomle-ui/commit/0a55b35a29f45f02cf994701a3f05427763d047b))
|
|
13
|
+
* interface "HiObjectSelectionApi" for hi object selection ([be880ca](https://github.com/roomle-dev/roomle-ui/commit/be880cad7eba2c4326b649232c6279d7cfc071e5))
|
|
14
|
+
* removed deprecated core api ([64ae74b](https://github.com/roomle-dev/roomle-ui/commit/64ae74b4f90d50b74bb89857111247a2994f1ecc))
|
|
15
|
+
* request sub article geometry for preview ([4e487c3](https://github.com/roomle-dev/roomle-ui/commit/4e487c3aa68f3e3f5afb3365763eba3f001ae408))
|
|
16
|
+
* tidy-up permission to delete component ([b97dbc4](https://github.com/roomle-dev/roomle-ui/commit/b97dbc4ad7cc931f5a872be3e3fff8c86bd63a5f))
|
|
17
|
+
* trigger external docking preview via api ([999924a](https://github.com/roomle-dev/roomle-ui/commit/999924ae804911ce336a56c53a1d45b934b2c96e))
|
|
18
|
+
* update hi object model types ([098deef](https://github.com/roomle-dev/roomle-ui/commit/098deeff8682af334b5c3d47fb2789ec2b06f628))
|
|
19
|
+
* **core:** upgrade to version 2.65.0-alpha.1 ([171c863](https://github.com/roomle-dev/roomle-ui/commit/171c8633afb6c4292d462e8ec61138f5210692e5))
|
|
20
|
+
* **core:** upgrade to version 2.65.0-alpha.2 ([f4dfc54](https://github.com/roomle-dev/roomle-ui/commit/f4dfc54deb3b2c112e4e2a72347931dece4b5d16))
|
|
21
|
+
* **core:** upgrade to version 2.65.0-alpha.3 ([8a31b8b](https://github.com/roomle-dev/roomle-ui/commit/8a31b8b99bdbc84c48b09d4ac7603653455f1c40))
|
|
22
|
+
* **core:** upgrade to version 2.65.0-alpha.4 ([214ee4f](https://github.com/roomle-dev/roomle-ui/commit/214ee4fa8382252e7c2306d5df5a69428b42a989))
|
|
23
|
+
* **core:** upgrade to version 2.65.0-alpha.5 ([7927a07](https://github.com/roomle-dev/roomle-ui/commit/7927a07f1e2913307ee3520fcfc9f10526cdd075))
|
|
24
|
+
* use relative paths ([865a826](https://github.com/roomle-dev/roomle-ui/commit/865a8265fbc0642ead26f290a22b3fecdd59430c))
|
|
50
25
|
|
|
51
26
|
|
|
52
27
|
### Bug Fixes
|
|
53
28
|
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
29
|
+
* add missing build feature-flags command ([12336e9](https://github.com/roomle-dev/roomle-ui/commit/12336e9de4594b1359aad10d6bf784f0eb037803))
|
|
30
|
+
* article name of generated hi modules ([5556bd2](https://github.com/roomle-dev/roomle-ui/commit/5556bd2a5af526e8cb51127cc6a70197c74832e5))
|
|
31
|
+
* check for length, not for array presence ([9cb4a57](https://github.com/roomle-dev/roomle-ui/commit/9cb4a57d6edeffe4a74818b0152569b8308e0a1c))
|
|
32
|
+
* check possibleChild.articleId?.length ([5f6bb01](https://github.com/roomle-dev/roomle-ui/commit/5f6bb01f55dd87508ca8badb1db9890ff2bfbad1))
|
|
33
|
+
* copying attributes from article data to new group data ([f4ef254](https://github.com/roomle-dev/roomle-ui/commit/f4ef2547d721c63a653d87b1e883270dc071df18))
|
|
34
|
+
* error handling in loadPlanXml ([079e257](https://github.com/roomle-dev/roomle-ui/commit/079e257156fbdb05a224e101861238bab1266992))
|
|
35
|
+
* filter catalog articles ([392c05d](https://github.com/roomle-dev/roomle-ui/commit/392c05d90b6e22c3dd6c7e7ae87bc5fc3b377778))
|
|
36
|
+
* filter for the tag with visibilityStatus 2 ([464f136](https://github.com/roomle-dev/roomle-ui/commit/464f136e06d07a029c025d2c57e0dd19a2d6c664))
|
|
37
|
+
* glue-logic - add sub article ([60b7fdc](https://github.com/roomle-dev/roomle-ui/commit/60b7fdc0903a4d09470b1b6f69c1a280a40349cd))
|
|
38
|
+
* hi example subscription endpoint and catalog ([aefad46](https://github.com/roomle-dev/roomle-ui/commit/aefad462e482ad9d6446dc1d4c1a52ce310c8d41))
|
|
39
|
+
* hi undo/redo (messed up when merging) ([2dffbaa](https://github.com/roomle-dev/roomle-ui/commit/2dffbaa8cd503c44560b04bb7951e33ff9b4358c))
|
|
40
|
+
* make build work again ([1e22431](https://github.com/roomle-dev/roomle-ui/commit/1e22431f2bb1b445efb63c7f9e7d15587f0fe096))
|
|
41
|
+
* recalculate group after adding sub article ([f26894c](https://github.com/roomle-dev/roomle-ui/commit/f26894ca22d7a8bd885312de12fdd5f791e3b049))
|
|
42
|
+
* remove hi message handler before adding a new one ([632fdea](https://github.com/roomle-dev/roomle-ui/commit/632fdea46e1feea7e1b9d5b04e627f76bed91194))
|
|
43
|
+
* remove redundant explicit initialization ([02e3cdd](https://github.com/roomle-dev/roomle-ui/commit/02e3cdda41a49ebfb56bfcbc3b367b5b20e20c35))
|
|
44
|
+
* supply oncollapse to mobile search ([4abcda7](https://github.com/roomle-dev/roomle-ui/commit/4abcda7ad04a0854dd75cb66d898266619f61f17))
|
|
45
|
+
* tidy-up glue logic for taking over properties from the article to the group ([e4c875e](https://github.com/roomle-dev/roomle-ui/commit/e4c875e5ac12c93290a3941179477a2893d2ee69))
|
|
46
|
+
* visibility toggle not working on mobile ([1f8cae4](https://github.com/roomle-dev/roomle-ui/commit/1f8cae4f36af8cee87a1cd4e77c5cb47e203fd08))
|
package/package.json
CHANGED
|
@@ -138,6 +138,7 @@ export default class RoomleEmbeddingApi<SdkType, SdkCallbacks> extends Connector
|
|
|
138
138
|
* @param initData settings with which the configurator should be started
|
|
139
139
|
*/
|
|
140
140
|
static createViewer(configuratorId: string, container: HTMLElement, initData: UiInitData, plugins?: PluginDefinitions): Promise<RoomleViewerApi>;
|
|
141
|
+
private static hiMessageHandler;
|
|
141
142
|
static setupHi(callbacks: HiCallbacks): void;
|
|
142
143
|
private static _create;
|
|
143
144
|
private _waitForIframe;
|
package/packages/embedding-lib/src/examples/utils/homag-intelligence/default-api-options.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { ApiOptions } from '@roomle/web-sdk/homag-intelligence/src/loader';
|
|
2
|
+
|
|
3
|
+
interface TcOptions extends ApiOptions {
|
|
4
|
+
libraryId: string;
|
|
5
|
+
}
|
|
1
6
|
declare const _default: {
|
|
2
7
|
enableArrangementCorrection: boolean;
|
|
3
8
|
uiConfiguration: {
|
|
@@ -10,31 +15,10 @@ declare const _default: {
|
|
|
10
15
|
};
|
|
11
16
|
materialConfiguration: {
|
|
12
17
|
defaultMaterial: string;
|
|
13
|
-
replaceUnmappedMaterialsWithDefault: boolean;
|
|
14
|
-
materialMapping: any[];
|
|
15
18
|
};
|
|
16
19
|
debugConfiguration: {
|
|
17
20
|
createDebugGeometry: boolean;
|
|
18
21
|
};
|
|
19
|
-
tecConfigInfo:
|
|
20
|
-
baseUrlDebug: string;
|
|
21
|
-
/**
|
|
22
|
-
* If you do not want to use the proxy provided by Roomle
|
|
23
|
-
* uncomment the next three lines and comment the line
|
|
24
|
-
* which has the Roomle proxy URL in it.
|
|
25
|
-
* BE AWARE: That the example url dfteccdeveu01-app.azurewebsites.net
|
|
26
|
-
* only works if you requesting from localhost:3100 otherwise you
|
|
27
|
-
* will have CORS issues
|
|
28
|
-
*/
|
|
29
|
-
/** comment this line if you do not want to use the Roomle proxy */
|
|
30
|
-
baseUrl: string;
|
|
31
|
-
subscriptionId: string;
|
|
32
|
-
om: {
|
|
33
|
-
subscriptionId: string;
|
|
34
|
-
key: string;
|
|
35
|
-
importBaseUrl: string;
|
|
36
|
-
};
|
|
37
|
-
libraryId: string;
|
|
38
|
-
};
|
|
22
|
+
tecConfigInfo: TcOptions;
|
|
39
23
|
};
|
|
40
24
|
export default _default;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export declare const fetchJSONData: (url: string) => Promise<any>;
|
|
2
|
-
export declare const fetchDataWithAuthorization: (url: string, type:
|
|
2
|
+
export declare const fetchDataWithAuthorization: (url: string, type: 'json' | 'text', apiOptions: any, debug?: {
|
|
3
|
+
property: string;
|
|
4
|
+
}) => Promise<Response>;
|
|
5
|
+
export declare const loadArticleCatalog: (hiInitData: any) => Promise<any>;
|
|
6
|
+
export declare const loadMasterData: (hiInitData: any) => Promise<any>;
|
|
7
|
+
export declare const loadCalcScript: (hiInitData: any) => Promise<string>;
|
|
3
8
|
export declare const logInUi: (area: string, message: string, args?: (string | null)[]) => void;
|
|
4
9
|
export declare const logMessage: (message: string, ...args: (string | null)[]) => void;
|
|
5
10
|
export declare const logApiCall: (message: string) => void;
|
|
@@ -121,6 +121,7 @@ export declare const MOCK_MINIMAL_KERNEL_INSTANCE: {
|
|
|
121
121
|
getPlanComponentAnimations: () => KernelParameter[];
|
|
122
122
|
getComponent: () => any;
|
|
123
123
|
getPlanObjectPossibleChildren: () => KernelPossibleChild[];
|
|
124
|
+
getComponentOrModuleInformation: () => void;
|
|
124
125
|
};
|
|
125
126
|
export declare class MockConfiguratorKernel {
|
|
126
127
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as ConfiguratorContext } from './webgl/configurator-context';
|
|
2
|
-
import { DebugClient, KernelDockPairPreview, KernelObjectInformation, EmscriptenString, KernelAnimation, KernelComponent, KernelParameter, KernelParameterGroup, KernelVector3, PlanObject, VariantsList } from '../../typings/kernel';
|
|
2
|
+
import { DebugClient, KernelDockPairPreview, KernelObjectInformation, PossibleChildPreviewElement, EmscriptenString, KernelAnimation, KernelComponent, KernelParameter, KernelParameterGroup, KernelVector3, PlanObject, VariantsList } from '../../typings/kernel';
|
|
3
3
|
import { default as CommonKernelAccess, KERNEL_TYPE } from './services/common-kernel-access';
|
|
4
4
|
import { ArticleNumber, ConfigurationHash, ConfigurationString, RapiId, RapiPrice } from '../../typings/rapi-types';
|
|
5
5
|
import { CommonConfiguratorKernelCallbackI } from './common-configurator-kernel-callback';
|
|
@@ -54,7 +54,7 @@ export default class ConfiguratorKernelAccess extends CommonKernelAccess {
|
|
|
54
54
|
dockComponent(parentId: number, parentDockId: number, childId: number, childDockId: number): void;
|
|
55
55
|
changeUseOfHDGeometry(context: ConfiguratorContext, useHDGeometry: boolean): void;
|
|
56
56
|
webGlPreviewDockings(context: ConfiguratorContext, dragIn: boolean): void;
|
|
57
|
-
|
|
57
|
+
webGlPreviewDockingsForPlanObject(planObjectId: number, possibleChild: PossibleChildPreviewElement, dragIn: boolean): void;
|
|
58
58
|
previewDockingsWithDrag(componentId: number, planObjectId: number): void;
|
|
59
59
|
cancelDocking(componentId: number): void;
|
|
60
60
|
loadConfiguration(configuration: ConfigurationString): void;
|
|
@@ -4,8 +4,6 @@ export declare const USM_PARTLIST: any;
|
|
|
4
4
|
export declare const CUBE_PARTLIST: any;
|
|
5
5
|
export declare const USM_KERNEL_POSSIBLE_CHILD: KernelPossibleChild;
|
|
6
6
|
export declare const USM_KERNEL_IMPOSSIBLE_CHILD: KernelPossibleChild;
|
|
7
|
-
export declare const EXTERNAL_COMPONENT: KernelPossibleChild;
|
|
8
|
-
export declare const EXTERNAL_ITEM: KernelPossibleChild;
|
|
9
7
|
export declare const USM_RAPI_COMPONENT: {
|
|
10
8
|
externalIdentifier: string;
|
|
11
9
|
catalog: string;
|
|
@@ -668,6 +668,8 @@ export default class RoomleConfigurator<P extends readonly PluginName[] = readon
|
|
|
668
668
|
}>;
|
|
669
669
|
private _addAdditionalInfoToPossibleChildren;
|
|
670
670
|
private _getPossibleChildrenForKernelPossibleChildren;
|
|
671
|
+
private _addPossibleChildren;
|
|
672
|
+
private _getPossibleChildrenFromSubArticles;
|
|
671
673
|
/**
|
|
672
674
|
* returns unit formatter for formatting input und output values in scene
|
|
673
675
|
*/
|
package/packages/web-sdk/packages/configurator-core/src/webgl/configurator-scene-manager.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { default as GlobalInitData } from '../../../common-core/src/utils/global
|
|
|
23
23
|
import { CancelSelectionReasons } from '../../../typings/planner';
|
|
24
24
|
import { default as UnitFormatter } from '../services/unit-formatter';
|
|
25
25
|
import { AnimationLevelType } from '../utils/animation/animation-helper';
|
|
26
|
+
import { PosArticle } from '../../../homag-intelligence/src/model/oc-scripts-domain.model';
|
|
26
27
|
|
|
27
28
|
export default class ConfiguratorSceneManager extends SceneManager implements ConfiguratorViewModelCallbackI {
|
|
28
29
|
_creator_: string;
|
|
@@ -175,4 +176,5 @@ export default class ConfiguratorSceneManager extends SceneManager implements Co
|
|
|
175
176
|
private _showCustomComponentDimensions;
|
|
176
177
|
private _removeCustomComponentDimensions;
|
|
177
178
|
clearHighlighting(): void;
|
|
179
|
+
getExternalSubArticles(_id: number): PosArticle[];
|
|
178
180
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { GlueLogic, LibraryData, PlanSnapshot, RoomDesignerRequests } from './gl
|
|
|
3
3
|
import { ExternalObjectGroup } from 'roomle-core-hsc/src/embind/plannerCoreInterface';
|
|
4
4
|
import { ExternalModuleInformation } from '../../typings/kernel';
|
|
5
5
|
import { CheckResult, PosArticle, PosGroup, PosSaveData } from './model/oc-scripts-domain.model';
|
|
6
|
-
import {
|
|
6
|
+
import { HiObjectSelectionApi } from './hi-object-selection';
|
|
7
7
|
import { LoadExternalObjectOptions } from './external-object-api';
|
|
8
8
|
import { ExternalObjectValidContainerModules } from './external-object-api-callbacks';
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ export declare class GlueLayerRequestDebugLogging implements GlueLogic {
|
|
|
12
12
|
private _hiCallbacks;
|
|
13
13
|
constructor(glueLogic: GlueLogic, hiCallbacks: HiCallbacks);
|
|
14
14
|
get hiCallbacks(): HiCallbacks | null;
|
|
15
|
-
get hiObjectSelection():
|
|
15
|
+
get hiObjectSelection(): HiObjectSelectionApi;
|
|
16
16
|
private _logRequest;
|
|
17
17
|
isLibraryLoaded(libraryId: string): boolean;
|
|
18
18
|
getLibraryData(libraryId: string): LibraryData | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HiCallbacks } from '../../../../embedding-lib/src/embedding-lib';
|
|
2
2
|
import { ExternalModuleInformation, ExternalObjectGroup, ExternalObjectValidContainerModules } from './external-object-api-callbacks';
|
|
3
3
|
import { MasterData, PosModuleAttribute, PosGroup, PosModuleData, CheckResult, PosSaveData, PosArticle } from './model/oc-scripts-domain.model';
|
|
4
|
-
import {
|
|
4
|
+
import { HiObjectSelectionApi } from './hi-object-selection';
|
|
5
5
|
import { LoadExternalObjectOptions } from './external-object-api';
|
|
6
6
|
|
|
7
7
|
export interface LibraryIdAndLibraryData {
|
|
@@ -40,7 +40,7 @@ export interface RoomDesignerRequests {
|
|
|
40
40
|
}
|
|
41
41
|
export interface GlueLogic {
|
|
42
42
|
hiCallbacks: HiCallbacks | null;
|
|
43
|
-
hiObjectSelection:
|
|
43
|
+
hiObjectSelection: HiObjectSelectionApi;
|
|
44
44
|
isLibraryLoaded(libraryId: string): boolean;
|
|
45
45
|
getLibraryData(libraryId: string): LibraryData | null;
|
|
46
46
|
addLibrary(libraryData: LibraryData): void;
|
|
@@ -87,6 +87,7 @@ export declare class GlueLogicImplementation implements GlueLogic {
|
|
|
87
87
|
private _libraryData;
|
|
88
88
|
private _posDataForLoading;
|
|
89
89
|
private _posArticleMap;
|
|
90
|
+
private _posSubArticleMap;
|
|
90
91
|
private _groupMap;
|
|
91
92
|
private _nextPosDataId;
|
|
92
93
|
private _hiCallbacks;
|
|
@@ -96,7 +97,7 @@ export declare class GlueLogicImplementation implements GlueLogic {
|
|
|
96
97
|
private _validSubArticles;
|
|
97
98
|
constructor(designerRequests: RoomDesignerRequests, hiCallbacks?: HiCallbacks | null);
|
|
98
99
|
get hiCallbacks(): HiCallbacks | null;
|
|
99
|
-
get hiObjectSelection():
|
|
100
|
+
get hiObjectSelection(): HiObjectSelectionApi;
|
|
100
101
|
private _getGroup;
|
|
101
102
|
getLibraryData(data: string | PosGroup): LibraryData | null;
|
|
102
103
|
isLibraryLoaded(libraryId: string): boolean;
|
|
@@ -135,7 +136,6 @@ export declare class GlueLogicImplementation implements GlueLogic {
|
|
|
135
136
|
private _splitOffRootModulesFromGroup;
|
|
136
137
|
private _calculateNewGroup;
|
|
137
138
|
private _getLibraryIdForPosData;
|
|
138
|
-
private _populateRootFromMasterData;
|
|
139
139
|
private _setSubmoduleImages;
|
|
140
140
|
private _calculateAndUpdateGroupMap;
|
|
141
141
|
private _addNewGroup;
|
|
@@ -19,7 +19,15 @@ export declare const HI_SELECTION_MODE: {
|
|
|
19
19
|
readonly RML_OBJECT: "rml-object";
|
|
20
20
|
};
|
|
21
21
|
export type HiSelectionMode = (typeof HI_SELECTION_MODE)[keyof typeof HI_SELECTION_MODE];
|
|
22
|
-
export
|
|
22
|
+
export interface HiObjectSelectionApi {
|
|
23
|
+
setSidebar(viewName: string): void;
|
|
24
|
+
contextChanged(context: BASE_CONTEXT): void;
|
|
25
|
+
groupOrModuleSelected(groupId: string, rootModuleId: string | null, subModuleId: string | null): void;
|
|
26
|
+
componentSelectionCancel(reason: CancelSelectionReasons): void;
|
|
27
|
+
selectionCancel(reason: CancelSelectionReasons): void;
|
|
28
|
+
selectionChanged(selectionMode: SELECTION_MODE, objectType: CallbackObjectType, payload: SelectionPayload, _payloadPromise: Promise<SelectionPayload>, _planElementViewModel: PlanElementViewModel): void;
|
|
29
|
+
}
|
|
30
|
+
export declare class HiObjectSelection implements HiObjectSelectionApi {
|
|
23
31
|
private _callbacks;
|
|
24
32
|
private _contextType;
|
|
25
33
|
private _selectionMode;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { MasterData } from './model/oc-scripts-domain.model';
|
|
2
|
-
|
|
3
1
|
export interface HomagIntelligenceInitData {
|
|
4
2
|
libraryId: string;
|
|
5
3
|
serverOptions?: ApiOptions;
|
|
@@ -8,27 +6,13 @@ export interface HomagIntelligenceInitData {
|
|
|
8
6
|
export interface OrderManagerOptions {
|
|
9
7
|
key?: string;
|
|
10
8
|
importBaseUrl?: string;
|
|
9
|
+
subscriptionId?: string;
|
|
11
10
|
}
|
|
12
11
|
export interface ApiOptions {
|
|
13
12
|
subscriptionId: string;
|
|
14
|
-
om?: OrderManagerOptions;
|
|
15
13
|
endpointUrl?: string;
|
|
14
|
+
key?: string;
|
|
15
|
+
om?: OrderManagerOptions;
|
|
16
|
+
baseUrl?: string;
|
|
16
17
|
localUrl?: string;
|
|
17
18
|
}
|
|
18
|
-
export declare const fetchDataWithAuthorization: (url: string, type: 'json' | 'text', apiOptions: ApiOptions, debug?: {
|
|
19
|
-
property: string;
|
|
20
|
-
}) => Promise<Response>;
|
|
21
|
-
export declare const loadArticleCatalog: (apiOptions: HomagIntelligenceInitData) => Promise<any>;
|
|
22
|
-
export declare const loadMasterData: (apiOptions: HomagIntelligenceInitData) => Promise<MasterData>;
|
|
23
|
-
export declare const loadCalcScript: (apiOptions: HomagIntelligenceInitData) => Promise<string>;
|
|
24
|
-
export declare const getRequestSettings: (apiOptions: ApiOptions) => {
|
|
25
|
-
subscriptionId: string;
|
|
26
|
-
headers: {
|
|
27
|
-
headers: {
|
|
28
|
-
'Content-Type': string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
key: string;
|
|
32
|
-
importBaseUrl: string;
|
|
33
|
-
};
|
|
34
|
-
export declare const omRequest: (apiOptions: ApiOptions, body: any, url: string, debugStr?: string, extraHeaders?: {}) => Promise<any>;
|
|
@@ -9,7 +9,7 @@ export declare const enum UserRightLevel {
|
|
|
9
9
|
Master = 2
|
|
10
10
|
}
|
|
11
11
|
export declare const getUserRightLevel: (right?: PosUserRight | null) => UserRightLevel;
|
|
12
|
-
interface PosArticleInfo {
|
|
12
|
+
export interface PosArticleInfo {
|
|
13
13
|
/**
|
|
14
14
|
* Defined the library that is used / must match the MasterData
|
|
15
15
|
*/
|
|
@@ -31,6 +31,12 @@ interface PosArticleInfo {
|
|
|
31
31
|
category?: string;
|
|
32
32
|
isConfigDummy?: boolean;
|
|
33
33
|
}
|
|
34
|
+
export interface PosPositionInfo extends PosArticleInfo {
|
|
35
|
+
/**
|
|
36
|
+
* Additional text for this root module
|
|
37
|
+
*/
|
|
38
|
+
additionalText?: string;
|
|
39
|
+
}
|
|
34
40
|
export interface PosPartData {
|
|
35
41
|
id: string;
|
|
36
42
|
hidden?: boolean;
|
|
@@ -79,18 +85,16 @@ export interface PosModuleData {
|
|
|
79
85
|
id: string;
|
|
80
86
|
name: string;
|
|
81
87
|
modules?: PosModuleData[];
|
|
88
|
+
containers?: PosModuleData[];
|
|
82
89
|
parts?: PosPartData[];
|
|
83
90
|
imageUrl?: string;
|
|
84
91
|
attributes?: PosModuleAttribute[];
|
|
85
92
|
canBeDeleted?: boolean;
|
|
86
93
|
isGenerated?: boolean;
|
|
87
94
|
checkAttributes?: Map<string, string | number | boolean | undefined>;
|
|
95
|
+
articleInfo?: PosPositionInfo;
|
|
88
96
|
}
|
|
89
|
-
export interface PosModuleRootData extends PosModuleData,
|
|
90
|
-
/**
|
|
91
|
-
* Additional text for this root module
|
|
92
|
-
*/
|
|
93
|
-
additionalText?: string;
|
|
97
|
+
export interface PosModuleRootData extends PosModuleData, PosPositionInfo {
|
|
94
98
|
/**
|
|
95
99
|
* Position of this article; if not set it is always 0,0,0 (x/y/z)
|
|
96
100
|
*/
|
|
@@ -315,7 +319,6 @@ export interface CheckDropDownEntry {
|
|
|
315
319
|
}
|
|
316
320
|
export declare enum CheckDropDownEntryKind {
|
|
317
321
|
Normal = 0,
|
|
318
|
-
Conflicting = 1
|
|
319
|
-
Invalid = 2
|
|
322
|
+
Conflicting = 1
|
|
320
323
|
}
|
|
321
324
|
export {};
|
|
@@ -23,6 +23,7 @@ import { EMSConstant } from '../../../typings/planner-kernel-container';
|
|
|
23
23
|
import { default as InitData } from '../../../common-core/src/utils/init-data';
|
|
24
24
|
import { RoomleLightSource } from '../../../common-core/src/light/light-source';
|
|
25
25
|
import { HomagIntelligence } from '../../../homag-intelligence/src/homag-intelligence';
|
|
26
|
+
import { PosArticle } from '../../../homag-intelligence/src/model/oc-scripts-domain.model';
|
|
26
27
|
|
|
27
28
|
export declare function isLockedElement(planElementViewModel: PlanElementViewModel, initData: InitData): boolean;
|
|
28
29
|
declare const SET_WALL_MATERIAL_TYPE: {
|
|
@@ -236,7 +237,8 @@ export default class PlannerSceneManager extends ConfiguratorSceneManager implem
|
|
|
236
237
|
private _insertRapiItems;
|
|
237
238
|
insertRapiObjects(rapiIds: InsertItemIdInfo[]): Promise<InsertItemResult[]>;
|
|
238
239
|
private _saveConfiguration;
|
|
239
|
-
externalObjectRequestAddOnContainers(groupId: string, subArticleId: string): void
|
|
240
|
+
externalObjectRequestAddOnContainers(groupId: string, subArticleId: string): Promise<void>;
|
|
240
241
|
externalObjectAddSubArticle(subArticleId: string, rootModuleId: string, parentModuleId: string): void;
|
|
242
|
+
getExternalSubArticles(id: number): PosArticle[];
|
|
241
243
|
}
|
|
242
244
|
export {};
|
|
@@ -54,7 +54,6 @@ export interface ConfigurationObject extends Object {
|
|
|
54
54
|
[key: string]: any;
|
|
55
55
|
}
|
|
56
56
|
export interface KernelPossibleChild {
|
|
57
|
-
externalComponent: boolean;
|
|
58
57
|
componentId?: RapiId;
|
|
59
58
|
itemId?: RapiId;
|
|
60
59
|
isDefault?: boolean;
|
|
@@ -142,9 +141,14 @@ export interface UiKernelParameter extends KernelParameter {
|
|
|
142
141
|
};
|
|
143
142
|
additionalInfos?: AdditionalInfo[];
|
|
144
143
|
}
|
|
145
|
-
export interface
|
|
144
|
+
export interface PossibleChildPreviewElement {
|
|
145
|
+
id: string;
|
|
146
|
+
configuration?: ConfigurationString;
|
|
147
|
+
articleId?: string;
|
|
146
148
|
isItem: boolean;
|
|
147
149
|
isComponent: boolean;
|
|
150
|
+
}
|
|
151
|
+
export interface UiPossibleChild extends RapiElement, PossibleChildPreviewElement {
|
|
148
152
|
group: string;
|
|
149
153
|
possible: boolean;
|
|
150
154
|
subTags: UiPossibleChild[];
|
|
@@ -477,11 +481,6 @@ export interface KernelVariant {
|
|
|
477
481
|
currencySymbol: string;
|
|
478
482
|
parameterValues: KernelParameterValue[];
|
|
479
483
|
}
|
|
480
|
-
export interface KernelExternalObjectDocking {
|
|
481
|
-
groupId: string;
|
|
482
|
-
parentModuleId: string;
|
|
483
|
-
moduleName: string;
|
|
484
|
-
}
|
|
485
484
|
export interface ExternalModuleInformation {
|
|
486
485
|
groupId: string;
|
|
487
486
|
rootModuleId: string;
|
|
@@ -143,7 +143,7 @@ export interface ContinuousDrawingManager {
|
|
|
143
143
|
shouldShowCircle(): boolean;
|
|
144
144
|
isCorridorValid(): boolean;
|
|
145
145
|
getCorridor(): any;
|
|
146
|
-
getDrawnPoints():
|
|
146
|
+
getDrawnPoints(): PointArray;
|
|
147
147
|
CIRCLE_RADIUS: number;
|
|
148
148
|
}
|
|
149
149
|
interface Anchor {
|
|
@@ -179,7 +179,7 @@ export interface ExternalObjectLoadConfiguration {
|
|
|
179
179
|
export interface ExternalValidContainerModule {
|
|
180
180
|
containerModuleId: string;
|
|
181
181
|
parentModuleId: string;
|
|
182
|
-
|
|
182
|
+
rootId: string;
|
|
183
183
|
}
|
|
184
184
|
export interface PlanInteractionHandler {
|
|
185
185
|
init(reference: PlanInteractionHandler, zoomFactor: number, viewSnapDist: number, wallSnapMode: any, objectSnapMode: any, shouldSnap: boolean, drawingType: any): PlanInteractionHandler;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class P {
|
|
2
2
|
_side;
|
|
3
3
|
// for better debugging (who handles message? iframe or website?)
|
|
4
4
|
_incomingMessageBus = null;
|
|
@@ -108,11 +108,11 @@ class H {
|
|
|
108
108
|
* Copyright 2019 Google LLC
|
|
109
109
|
* SPDX-License-Identifier: Apache-2.0
|
|
110
110
|
*/
|
|
111
|
-
const B = Symbol("Comlink.proxy"), X = Symbol("Comlink.endpoint"), j = Symbol("Comlink.releaseProxy"),
|
|
111
|
+
const B = Symbol("Comlink.proxy"), X = Symbol("Comlink.endpoint"), j = Symbol("Comlink.releaseProxy"), M = Symbol("Comlink.finalizer"), w = Symbol("Comlink.thrown"), G = (e) => typeof e == "object" && e !== null || typeof e == "function", Z = {
|
|
112
112
|
canHandle: (e) => G(e) && e[B],
|
|
113
113
|
serialize(e) {
|
|
114
114
|
const { port1: t, port2: s } = new MessageChannel();
|
|
115
|
-
return
|
|
115
|
+
return H(e, t), [s, [s]];
|
|
116
116
|
},
|
|
117
117
|
deserialize(e) {
|
|
118
118
|
return e.start(), re(e);
|
|
@@ -143,7 +143,7 @@ function te(e, t) {
|
|
|
143
143
|
return !0;
|
|
144
144
|
return !1;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function H(e, t = globalThis, s = ["*"]) {
|
|
147
147
|
t.addEventListener("message", function r(n) {
|
|
148
148
|
if (!n || !n.data)
|
|
149
149
|
return;
|
|
@@ -174,7 +174,7 @@ function P(e, t = globalThis, s = ["*"]) {
|
|
|
174
174
|
case "ENDPOINT":
|
|
175
175
|
{
|
|
176
176
|
const { port1: d, port2: h } = new MessageChannel();
|
|
177
|
-
|
|
177
|
+
H(e, h), l = ae(d, [d]);
|
|
178
178
|
}
|
|
179
179
|
break;
|
|
180
180
|
case "RELEASE":
|
|
@@ -188,7 +188,7 @@ function P(e, t = globalThis, s = ["*"]) {
|
|
|
188
188
|
}
|
|
189
189
|
Promise.resolve(l).catch((u) => ({ value: u, [w]: 0 })).then((u) => {
|
|
190
190
|
const [g, d] = S(u);
|
|
191
|
-
t.postMessage(Object.assign(Object.assign({}, g), { id: o }), d), a === "RELEASE" && (t.removeEventListener("message", r), V(t),
|
|
191
|
+
t.postMessage(Object.assign(Object.assign({}, g), { id: o }), d), a === "RELEASE" && (t.removeEventListener("message", r), V(t), M in e && typeof e[M] == "function" && e[M]());
|
|
192
192
|
}).catch((u) => {
|
|
193
193
|
const [g, d] = S({
|
|
194
194
|
value: new TypeError("Unserializable return value"),
|
|
@@ -350,7 +350,7 @@ function p(e, t, s, r) {
|
|
|
350
350
|
function le() {
|
|
351
351
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
352
352
|
}
|
|
353
|
-
const
|
|
353
|
+
const T = ".", A = {
|
|
354
354
|
REQUEST_BOOT: "requestBoot",
|
|
355
355
|
SETUP: "setup",
|
|
356
356
|
WEBSITE_READY: "websiteReady"
|
|
@@ -458,8 +458,8 @@ const _e = (e) => JSON.parse(JSON.stringify(e)), Ee = {
|
|
|
458
458
|
rotationSnapDegrees: 10,
|
|
459
459
|
interactionsCollapsed: !1
|
|
460
460
|
}, we = "(idle)", ye = (e) => (I(e), e?.customApiUrl && (e.customApiUrl = decodeURIComponent(e.customApiUrl)), e.shareUrl && (e.deeplink = e.shareUrl.replace(
|
|
461
|
-
|
|
462
|
-
|
|
461
|
+
Me,
|
|
462
|
+
Te
|
|
463
463
|
)), e), I = (e) => {
|
|
464
464
|
if (!e)
|
|
465
465
|
return;
|
|
@@ -480,7 +480,7 @@ const _e = (e) => JSON.parse(JSON.stringify(e)), Ee = {
|
|
|
480
480
|
e.locale || (e.locale = me()), e.id === we && delete e.id;
|
|
481
481
|
const t = fe();
|
|
482
482
|
return t && he(t) && (e.configuratorId = "demoConfigurator"), e.customApiUrl = void 0, e.emails = !1, e;
|
|
483
|
-
},
|
|
483
|
+
}, Me = "<CONF_ID>", Te = "#CONFIGURATIONID#", Ae = (e) => {
|
|
484
484
|
e.featureFlags || (e.featureFlags = {}), typeof e.featureFlags.realPartList != "boolean" && (e.featureFlags.realPartList = !0), typeof e.featureFlags.globalCallbacks != "boolean" && (e.featureFlags.globalCallbacks = !0), typeof e.featureFlags.mocAr != "boolean" && (e.featureFlags.mocAr = !1);
|
|
485
485
|
}, D = () => /(android)/i.test(navigator.userAgent);
|
|
486
486
|
class x {
|
|
@@ -513,7 +513,7 @@ class x {
|
|
|
513
513
|
handleSetup(t) {
|
|
514
514
|
const { methods: s, callbacks: r } = t;
|
|
515
515
|
s.forEach((n) => {
|
|
516
|
-
const o = n.split(
|
|
516
|
+
const o = n.split(T), a = o[0], i = o[1];
|
|
517
517
|
this[a] || (this[a] = {}), this[a][i] = (function() {
|
|
518
518
|
if (!this._messageHandler) {
|
|
519
519
|
console.error("MessageHandler not set");
|
|
@@ -522,13 +522,13 @@ class x {
|
|
|
522
522
|
return this._messageHandler.sendMessage(n, [...arguments]);
|
|
523
523
|
}).bind(this);
|
|
524
524
|
}), r.forEach((n) => {
|
|
525
|
-
const o = n.split(
|
|
525
|
+
const o = n.split(T), a = o[0], i = o[1], c = o[2];
|
|
526
526
|
this[a] || (this[a] = {}), this[a][i] || (this[a][i] = {}), this[a][i][c] = () => {
|
|
527
527
|
};
|
|
528
528
|
}), this.isSetupDone = !0;
|
|
529
529
|
}
|
|
530
530
|
executeMessage({ message: t, args: s }) {
|
|
531
|
-
const r = t.split(
|
|
531
|
+
const r = t.split(T), n = r[0], o = r[1], a = r.length === 3 ? r[2] : null;
|
|
532
532
|
if (a && this[n][o][a]) {
|
|
533
533
|
const i = this[n][o][a](
|
|
534
534
|
...s
|
|
@@ -660,7 +660,7 @@ class Ne extends x {
|
|
|
660
660
|
if (r.isSetupDone)
|
|
661
661
|
return r.executeMessage({ message: g, args: d });
|
|
662
662
|
}
|
|
663
|
-
}, l = new
|
|
663
|
+
}, l = new P(
|
|
664
664
|
"custom-view-" + t,
|
|
665
665
|
window,
|
|
666
666
|
window.parent,
|
|
@@ -720,13 +720,14 @@ class Ne extends x {
|
|
|
720
720
|
n
|
|
721
721
|
);
|
|
722
722
|
}
|
|
723
|
+
static hiMessageHandler = null;
|
|
723
724
|
static setupHi(t) {
|
|
724
|
-
window.
|
|
725
|
+
this.hiMessageHandler && window.removeEventListener("message", this.hiMessageHandler), this.hiMessageHandler = (s) => {
|
|
725
726
|
if (s.data.type === "connect_hi" && s.data.port) {
|
|
726
727
|
const r = s.data.port;
|
|
727
|
-
r.start?.(),
|
|
728
|
+
r.start?.(), H(be(t), r);
|
|
728
729
|
}
|
|
729
|
-
});
|
|
730
|
+
}, window.addEventListener("message", this.hiMessageHandler);
|
|
730
731
|
}
|
|
731
732
|
static async _create(t, s, r, n) {
|
|
732
733
|
return new Promise(async (o, a) => {
|
|
@@ -735,7 +736,7 @@ class Ne extends x {
|
|
|
735
736
|
Se(),
|
|
736
737
|
ye(r)
|
|
737
738
|
);
|
|
738
|
-
|
|
739
|
+
Ae(i);
|
|
739
740
|
const c = await ue(
|
|
740
741
|
t,
|
|
741
742
|
i
|
|
@@ -783,7 +784,7 @@ class Ne extends x {
|
|
|
783
784
|
`, document.head.appendChild(u);
|
|
784
785
|
}
|
|
785
786
|
this._executeMessage = this._executeMessage.bind(this);
|
|
786
|
-
const i = new
|
|
787
|
+
const i = new P(
|
|
787
788
|
"website",
|
|
788
789
|
window,
|
|
789
790
|
null,
|
|
@@ -814,7 +815,7 @@ class Ne extends x {
|
|
|
814
815
|
}
|
|
815
816
|
_executeMessage({ message: t, args: s }, r) {
|
|
816
817
|
if (r.source && r.source === this._iframe?.contentWindow)
|
|
817
|
-
return t ===
|
|
818
|
+
return t === A.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(r.source), Promise.resolve({ result: this._initData })) : (console.error("MessageHandler not set"), Promise.resolve({ error: "MessageHandler not set" })) : t === A.SETUP ? (this.handleSetup(s[0]), F(
|
|
818
819
|
this.ui.callbacks,
|
|
819
820
|
"onUseFullPage",
|
|
820
821
|
this._onUseFullPage
|
|
@@ -827,7 +828,7 @@ class Ne extends x {
|
|
|
827
828
|
console.error("MessageHandler not set");
|
|
828
829
|
return;
|
|
829
830
|
}
|
|
830
|
-
this._messageHandler.sendMessage(
|
|
831
|
+
this._messageHandler.sendMessage(A.WEBSITE_READY);
|
|
831
832
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({ message: t, args: s });
|
|
832
833
|
}
|
|
833
834
|
}
|
|
@@ -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 n=new MessageChannel;n.port1.onmessage=e=>{if(!e||!e.data)return n.port1.close(),n.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 n.port1.close(),n.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),n.port1.close(),n.port2.close()};let a="";try{a=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(a,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&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=Symbol("Comlink.proxy"),s=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),i=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:e=>i(e)&&e[t],serialize(e){const{port1:t,port2:s}=new MessageChannel;return l(e,t),[s,[s]]},deserialize:e=>(e.start(),function(e){const t=new Map;return e.addEventListener("message",function(e){const{data:s}=e;if(!s||!s.id)return;const r=t.get(s.id);if(r)try{r(s)}finally{t.delete(s.id)}}),m(e,t,[],void 0)}(e))}],["throw",{canHandle:e=>i(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function l(e,s=globalThis,r=["*"]){s.addEventListener("message",function i(o){if(!o||!o.data)return;if(!function(e,t){for(const s of e)if(t===s||"*"===s||s instanceof RegExp&&s.test(t))return!0;return!1}(r,o.origin))return;const{id:u,type:g,path:d}=Object.assign({path:[]},o.data),h=(o.data.argumentList||[]).map(y);let m;try{const s=d.slice(0,-1).reduce((e,t)=>e[t],e),r=d.reduce((e,t)=>e[t],e);switch(g){case"GET":m=r;break;case"SET":s[d.slice(-1)[0]]=y(o.data.value),m=!0;break;case"APPLY":m=r.apply(s,h);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[t]:!0})}(new r(...h));break;case"ENDPOINT":{const{port1:t,port2:s}=new MessageChannel;l(e,s),m=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch(e=>({value:e,[a]:0})).then(t=>{const[r,a]=_(t);s.postMessage(Object.assign(Object.assign({},r),{id:u}),a),"RELEASE"===g&&(s.removeEventListener("message",i),c(s),n in e&&"function"==typeof e[n]&&e[n]())}).catch(e=>{const[t,r]=_({value:new TypeError("Unserializable return value"),[a]:0});s.postMessage(Object.assign(Object.assign({},t),{id:u}),r)})}),s.start&&s.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return b(e,new Map,{type:"RELEASE"}).then(()=>{c(e)})}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(d.get(e)||0)-1;d.set(e,t),0===t&&g(e)});function m(e,t,n=[],a=function(){}){let i=!1;const o=new Proxy(a,{get(s,a){if(u(i),a===r)return()=>{(function(e){h&&h.unregister(e)})(o),g(e),t.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const s=b(e,t,{type:"GET",path:n.map(e=>e.toString())}).then(y);return s.then.bind(s)}return m(e,t,[...n,a])},set(s,r,a){u(i);const[o,l]=_(a);return b(e,t,{type:"SET",path:[...n,r].map(e=>e.toString()),value:o},l).then(y)},apply(r,a,o){u(i);const l=n[n.length-1];if(l===s)return b(e,t,{type:"ENDPOINT"}).then(y);if("bind"===l)return m(e,t,n.slice(0,-1));const[c,g]=f(o);return b(e,t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:c},g).then(y)},construct(s,r){u(i);const[a,o]=f(r);return b(e,t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:a},o).then(y)}});return function(e,t){const s=(d.get(t)||0)+1;d.set(t,s),h&&h.register(e,t,e)}(o,e),o}function p(e){return Array.prototype.concat.apply([],e)}function f(e){const t=e.map(_);return[t.map(e=>e[0]),p(t.map(e=>e[1]))]}const w=new WeakMap;function _(e){for(const[t,s]of o)if(s.canHandle(e)){const[r,n]=s.serialize(e);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:e},w.get(e)||[]]}function y(e){switch(e.type){case"HANDLER":return o.get(e.name).deserialize(e.value);case"RAW":return e.value}}function b(e,t,s,r){return new Promise(n=>{const a=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(a,n),e.start&&e.start(),e.postMessage(Object.assign({id:a},s),r)})}const v=["127.0.0.1","localhost","0.0.0.0"],M=["language","browserLanguage","userLanguage","systemLanguage"],E=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=E(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var S=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(S||{});const T={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[S.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},O=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&&O(t),Array.isArray(t))for(const e of t)O(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},P=()=>/(android)/i.test(navigator.userAgent);class A{_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],n=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][n]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],n=s[1],a=3===s.length?s[2]:null;if(a&&this[r][n][a]){const e=this[r][n][a](...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:n})=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,n)=>{try{r.loader().then(a=>{const i=new a(this.ui,t,s,this.viewName);i.init().then(()=>{this.plugins[r.name]=i,e()},n)})}catch(e){n(e)}}))}}const L=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},N=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},k=()=>.01*window.innerHeight+"px",R=e=>{e&&setTimeout(()=>e.style.setProperty(C,k()),0)},I="rml-styles",C="--rml-full-height",x="rml-container",H="rml-fill",B="rml-pos",D="rml-android-height",U="rml-overflow-hidden",F=new Map,j={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"};class z extends A{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(t,s=[]){const r=new A;r.viewName=t;const{resolve:n,promise:a}=L(),{resolve:i,promise:o}=L(),l=new e("custom-view-"+t,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":n();break;case"returnMethods":r.handleSetup(t[0]),i();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[t];return l.sendMessage("registerCustomView",c),await a,l.sendMessage("getMethods",c),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 setupHi(e){window.addEventListener("message",t=>{if("connect_hi"===t.data.type&&t.data.port){const s=t.data.port;s.start?.(),l(new Proxy(e,{get(e,t,s){const r=Reflect.get(e,t,s);return void 0!==r?r:(...e)=>{}}}),s)}})}static async _create(e,t,s,r){return new Promise(async(n,a)=>{try{const a=E((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(T);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,s=M.length;e<s;e++){const s=t[M[e]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===e.id&&delete e.id;const t=(()=>{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 t&&(e=>!!(v.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(O(i=s),i?.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),i));(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)})(a);const o=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,n=s+"/configurators/"+e,a="roomle_portal_v2",i="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(n,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:i,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(e,a);s=((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 E(s,t)})(s,t)})(o,a);const l=new this(o,t,s,r,n);return await Promise.allSettled(l.pluginsLoaded),l}catch(e){return a(e)}var i})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,r,n,a){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(F.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(I)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=I;const s="transition:all ease-in-out 450ms;",n=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=k();t.innerHTML=`\n .${x}{${C}:${a};}\n .${B}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${n}}\n .${H}{width:100%;height:100%;opacity:1}\n .${D}{height:calc(var(${C},1vh)*100)}\n .${U}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const i=new e("website",window,null,this._executeMessage);this.setMessageHandler(i),this._onResize=this._onResize.bind(this),P()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=r,this._configuratorSettings=t;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(n,this._iframe),F.set(s,!0)}teardown(){this._container&&F.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(x),e.classList.add(H),e}_onResize(){R(this._iframe)}_onUseFullPage(){this._iframe.classList.add(B),document.documentElement.classList.add(U),window.document.body.classList.add(U),P()&&(R(this._iframe),this._iframe.classList.add(D))}_onBackToWebsite(){this._iframe.classList.remove(B),this._iframe.classList.remove(D),document.documentElement.classList.remove(U),window.document.body.classList.remove(U)}_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]),N(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),N(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{j as HI_PANEL_ACTION,z 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 n=new MessageChannel;n.port1.onmessage=e=>{if(!e||!e.data)return n.port1.close(),n.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 n.port1.close(),n.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),n.port1.close(),n.port2.close()};let a="";try{a=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(a,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&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=Symbol("Comlink.proxy"),s=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),i=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:e=>i(e)&&e[t],serialize(e){const{port1:t,port2:s}=new MessageChannel;return l(e,t),[s,[s]]},deserialize:e=>(e.start(),function(e){const t=new Map;return e.addEventListener("message",function(e){const{data:s}=e;if(!s||!s.id)return;const r=t.get(s.id);if(r)try{r(s)}finally{t.delete(s.id)}}),m(e,t,[],void 0)}(e))}],["throw",{canHandle:e=>i(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function l(e,s=globalThis,r=["*"]){s.addEventListener("message",function i(o){if(!o||!o.data)return;if(!function(e,t){for(const s of e)if(t===s||"*"===s||s instanceof RegExp&&s.test(t))return!0;return!1}(r,o.origin))return;const{id:u,type:g,path:d}=Object.assign({path:[]},o.data),h=(o.data.argumentList||[]).map(y);let m;try{const s=d.slice(0,-1).reduce((e,t)=>e[t],e),r=d.reduce((e,t)=>e[t],e);switch(g){case"GET":m=r;break;case"SET":s[d.slice(-1)[0]]=y(o.data.value),m=!0;break;case"APPLY":m=r.apply(s,h);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[t]:!0})}(new r(...h));break;case"ENDPOINT":{const{port1:t,port2:s}=new MessageChannel;l(e,s),m=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch(e=>({value:e,[a]:0})).then(t=>{const[r,a]=_(t);s.postMessage(Object.assign(Object.assign({},r),{id:u}),a),"RELEASE"===g&&(s.removeEventListener("message",i),c(s),n in e&&"function"==typeof e[n]&&e[n]())}).catch(e=>{const[t,r]=_({value:new TypeError("Unserializable return value"),[a]:0});s.postMessage(Object.assign(Object.assign({},t),{id:u}),r)})}),s.start&&s.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return b(e,new Map,{type:"RELEASE"}).then(()=>{c(e)})}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(d.get(e)||0)-1;d.set(e,t),0===t&&g(e)});function m(e,t,n=[],a=function(){}){let i=!1;const o=new Proxy(a,{get(s,a){if(u(i),a===r)return()=>{(function(e){h&&h.unregister(e)})(o),g(e),t.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const s=b(e,t,{type:"GET",path:n.map(e=>e.toString())}).then(y);return s.then.bind(s)}return m(e,t,[...n,a])},set(s,r,a){u(i);const[o,l]=_(a);return b(e,t,{type:"SET",path:[...n,r].map(e=>e.toString()),value:o},l).then(y)},apply(r,a,o){u(i);const l=n[n.length-1];if(l===s)return b(e,t,{type:"ENDPOINT"}).then(y);if("bind"===l)return m(e,t,n.slice(0,-1));const[c,g]=f(o);return b(e,t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:c},g).then(y)},construct(s,r){u(i);const[a,o]=f(r);return b(e,t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:a},o).then(y)}});return function(e,t){const s=(d.get(t)||0)+1;d.set(t,s),h&&h.register(e,t,e)}(o,e),o}function p(e){return Array.prototype.concat.apply([],e)}function f(e){const t=e.map(_);return[t.map(e=>e[0]),p(t.map(e=>e[1]))]}const w=new WeakMap;function _(e){for(const[t,s]of o)if(s.canHandle(e)){const[r,n]=s.serialize(e);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:e},w.get(e)||[]]}function y(e){switch(e.type){case"HANDLER":return o.get(e.name).deserialize(e.value);case"RAW":return e.value}}function b(e,t,s,r){return new Promise(n=>{const a=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(a,n),e.start&&e.start(),e.postMessage(Object.assign({id:a},s),r)})}const v=["127.0.0.1","localhost","0.0.0.0"],M=["language","browserLanguage","userLanguage","systemLanguage"],E=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=E(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var S=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(S||{});const T={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[S.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},O=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&&O(t),Array.isArray(t))for(const e of t)O(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},P=()=>/(android)/i.test(navigator.userAgent);class A{_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],n=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][n]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],n=s[1],a=3===s.length?s[2]:null;if(a&&this[r][n][a]){const e=this[r][n][a](...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:n})=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,n)=>{try{r.loader().then(a=>{const i=new a(this.ui,t,s,this.viewName);i.init().then(()=>{this.plugins[r.name]=i,e()},n)})}catch(e){n(e)}}))}}const L=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},N=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},k=()=>.01*window.innerHeight+"px",R=e=>{e&&setTimeout(()=>e.style.setProperty(C,k()),0)},I="rml-styles",C="--rml-full-height",H="rml-container",x="rml-fill",B="rml-pos",D="rml-android-height",U="rml-overflow-hidden",F=new Map,j={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"};class z extends A{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(t,s=[]){const r=new A;r.viewName=t;const{resolve:n,promise:a}=L(),{resolve:i,promise:o}=L(),l=new e("custom-view-"+t,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":n();break;case"returnMethods":r.handleSetup(t[0]),i();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[t];return l.sendMessage("registerCustomView",c),await a,l.sendMessage("getMethods",c),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 hiMessageHandler=null;static setupHi(e){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=t=>{if("connect_hi"===t.data.type&&t.data.port){const s=t.data.port;s.start?.(),l(new Proxy(e,{get(e,t,s){const r=Reflect.get(e,t,s);return void 0!==r?r:(...e)=>{}}}),s)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(e,t,s,r){return new Promise(async(n,a)=>{try{const a=E((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(T);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,s=M.length;e<s;e++){const s=t[M[e]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===e.id&&delete e.id;const t=(()=>{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 t&&(e=>!!(v.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(O(i=s),i?.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),i));(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)})(a);const o=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,n=s+"/configurators/"+e,a="roomle_portal_v2",i="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(n,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:i,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(e,a);s=((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 E(s,t)})(s,t)})(o,a);const l=new this(o,t,s,r,n);return await Promise.allSettled(l.pluginsLoaded),l}catch(e){return a(e)}var i})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,r,n,a){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(F.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(I)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=I;const s="transition:all ease-in-out 450ms;",n=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=k();t.innerHTML=`\n .${H}{${C}:${a};}\n .${B}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${n}}\n .${x}{width:100%;height:100%;opacity:1}\n .${D}{height:calc(var(${C},1vh)*100)}\n .${U}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const i=new e("website",window,null,this._executeMessage);this.setMessageHandler(i),this._onResize=this._onResize.bind(this),P()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=r,this._configuratorSettings=t;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(n,this._iframe),F.set(s,!0)}teardown(){this._container&&F.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(H),e.classList.add(x),e}_onResize(){R(this._iframe)}_onUseFullPage(){this._iframe.classList.add(B),document.documentElement.classList.add(U),window.document.body.classList.add(U),P()&&(R(this._iframe),this._iframe.classList.add(D))}_onBackToWebsite(){this._iframe.classList.remove(B),this._iframe.classList.remove(D),document.documentElement.classList.remove(U),window.document.body.classList.remove(U)}_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]),N(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),N(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{j as HI_PANEL_ACTION,z as default};
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/const tt=Symbol("Comlink.proxy"),Nt=Symbol("Comlink.endpoint"),xt=Symbol("Comlink.releaseProxy"),G=Symbol("Comlink.finalizer"),b=Symbol("Comlink.thrown"),et=s=>typeof s=="object"&&s!==null||typeof s=="function",Pt={canHandle:s=>et(s)&&s[tt],serialize(s){const{port1:t,port2:e}=new MessageChannel;return H(s,t),[e,[e]]},deserialize(s){return s.start(),Ut(s)}},Gt={canHandle:s=>et(s)&&b in s,serialize({value:s}){let t;return s instanceof Error?t={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:t={isError:!1,value:s},[t,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},st=new Map([["proxy",Pt],["throw",Gt]]);function Ht(s,t){for(const e of s)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function H(s,t=globalThis,e=["*"]){t.addEventListener("message",function r(n){if(!n||!n.data)return;if(!Ht(e,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:i,type:o,path:a}=Object.assign({path:[]},n.data),c=(n.data.argumentList||[]).map(p);let l;try{const u=a.slice(0,-1).reduce((h,g)=>h[g],s),d=a.reduce((h,g)=>h[g],s);switch(o){case"GET":l=d;break;case"SET":u[a.slice(-1)[0]]=p(n.data.value),l=!0;break;case"APPLY":l=d.apply(u,c);break;case"CONSTRUCT":{const h=new d(...c);l=Xt(h)}break;case"ENDPOINT":{const{port1:h,port2:g}=new MessageChannel;H(s,g),l=Wt(h,[h])}break;case"RELEASE":l=void 0;break;default:return}}catch(u){l={value:u,[b]:0}}Promise.resolve(l).catch(u=>({value:u,[b]:0})).then(u=>{const[d,h]=M(u);t.postMessage(Object.assign(Object.assign({},d),{id:i}),h),o==="RELEASE"&&(t.removeEventListener("message",r),rt(t),G in s&&typeof s[G]=="function"&&s[G]())}).catch(u=>{const[d,h]=M({value:new TypeError("Unserializable return value"),[b]:0});t.postMessage(Object.assign(Object.assign({},d),{id:i}),h)})}),t.start&&t.start()}function Ft(s){return s.constructor.name==="MessagePort"}function rt(s){Ft(s)&&s.close()}function Ut(s,t){const e=new Map;return s.addEventListener("message",function(n){const{data:i}=n;if(!i||!i.id)return;const o=e.get(i.id);if(o)try{o(i)}finally{e.delete(i.id)}}),F(s,e,[],t)}function I(s){if(s)throw new Error("Proxy has been released and is not useable")}function nt(s){return T(s,new Map,{type:"RELEASE"}).then(()=>{rt(s)})}const A=new WeakMap,O="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const t=(A.get(s)||0)-1;A.set(s,t),t===0&&nt(s)});function Bt(s,t){const e=(A.get(t)||0)+1;A.set(t,e),O&&O.register(s,t,s)}function Yt(s){O&&O.unregister(s)}function F(s,t,e=[],r=function(){}){let n=!1;const i=new Proxy(r,{get(o,a){if(I(n),a===xt)return()=>{Yt(i),nt(s),t.clear(),n=!0};if(a==="then"){if(e.length===0)return{then:()=>i};const c=T(s,t,{type:"GET",path:e.map(l=>l.toString())}).then(p);return c.then.bind(c)}return F(s,t,[...e,a])},set(o,a,c){I(n);const[l,u]=M(c);return T(s,t,{type:"SET",path:[...e,a].map(d=>d.toString()),value:l},u).then(p)},apply(o,a,c){I(n);const l=e[e.length-1];if(l===Nt)return T(s,t,{type:"ENDPOINT"}).then(p);if(l==="bind")return F(s,t,e.slice(0,-1));const[u,d]=it(c);return T(s,t,{type:"APPLY",path:e.map(h=>h.toString()),argumentList:u},d).then(p)},construct(o,a){I(n);const[c,l]=it(a);return T(s,t,{type:"CONSTRUCT",path:e.map(u=>u.toString()),argumentList:c},l).then(p)}});return Bt(i,s),i}function kt(s){return Array.prototype.concat.apply([],s)}function it(s){const t=s.map(M);return[t.map(e=>e[0]),kt(t.map(e=>e[1]))]}const ot=new WeakMap;function Wt(s,t){return ot.set(s,t),s}function Xt(s){return Object.assign(s,{[tt]:!0})}function M(s){for(const[t,e]of st)if(e.canHandle(s)){const[r,n]=e.serialize(s);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:s},ot.get(s)||[]]}function p(s){switch(s.type){case"HANDLER":return st.get(s.name).deserialize(s.value);case"RAW":return s.value}}function T(s,t,e,r){return new Promise(n=>{const i=zt();t.set(i,n),s.start&&s.start(),s.postMessage(Object.assign({id:i},e),r)})}function zt(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const U=".",B={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},R={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},$t=async(s,t)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const e=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,n=e+"/configurators/"+s,i="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+i),a=()=>{const d={apiKey:i,currentTenant:r,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:u}=await l.json();return u},Vt=()=>{try{return window.self!==window.top}catch{return!0}},jt=["127.0.0.1","localhost","0.0.0.0"],qt=()=>{const s=Vt();let t=window.location.href;if(s){if(!document.referrer)return null;t=document.referrer}const{hostname:e}=new URL(t);return e},Kt=s=>!!(jt.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),at=["language","browserLanguage","userLanguage","systemLanguage"],Jt=(s=null)=>{const t=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,r=at.length;e<r;e++){const n=t[at[e]];if(n)return n.substr(0,2)}return"en"},Qt=(s,t)=>{const e=JSON.parse(JSON.stringify(s));return Y(e,t)},Y=(s,t)=>{for(const e in t)try{t[e].constructor===Object?s[e]=Y(s[e],t[e]):s[e]=t[e]}catch{s[e]=t[e]}return s};var ct=(s=>(s.BOTTOM_BAR="bottom_bar",s.PARTLIST_BOUNDS="partlist_bounds",s.INTERACTION_NOTES="interaction_notes",s.PARAMETER_GROUPS="parameter_groups",s))(ct||{});const Zt=s=>JSON.parse(JSON.stringify(s)),te={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[ct.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},ee="(idle)",se=s=>(k(s),s?.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(ie,oe)),s),k=s=>{if(!s)return;const t=Object.keys(s);for(const e of t){const r=s[e];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&k(r),Array.isArray(r))for(const n of r)k(n);(r==="true"||r==="false")&&(s[e]=r==="true")}},re=(s,t)=>{t.configuratorId=s.id;const e=s.settings||{};return!t.overrideTenant&&s.tenant&&(t.overrideTenant=s.tenant),Qt(e,t)},ne=()=>{const s=Zt(te);s.locale||(s.locale=Jt()),s.id===ee&&delete s.id;const t=qt();return t&&Kt(t)&&(s.configuratorId="demoConfigurator"),s.customApiUrl=void 0,s.emails=!1,s},ie="<CONF_ID>",oe="#CONFIGURATIONID#",ae=s=>{s.featureFlags||(s.featureFlags={}),typeof s.featureFlags.realPartList!="boolean"&&(s.featureFlags.realPartList=!0),typeof s.featureFlags.globalCallbacks!="boolean"&&(s.featureFlags.globalCallbacks=!0),typeof s.featureFlags.mocAr!="boolean"&&(s.featureFlags.mocAr=!1)},lt=()=>/(android)/i.test(navigator.userAgent);class ut{_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:r}=t;e.forEach(n=>{const i=n.split(U),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)}),r.forEach(n=>{const i=n.split(U),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 r=t.split(U),n=r[0],i=r[1],o=r.length===3?r[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,r="website"){for(const n of t)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((i,o)=>{try{Promise.resolve().then(()=>me).then(({DragIn:a})=>{const c=new a(this.ui,e,r,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,r,this.viewName);c.init().then(()=>{this.plugins[n.name]=c,i()},o)})}catch(a){o(a)}}))}}const ht=()=>{let s,t;return{promise:new Promise((r,n)=>{s=r,t=n}),resolve:s,reject:t}},dt=(s,t,e)=>{let r=null;Object.defineProperty(s,t,{get(){return r||e},set(n){n?.mute?r=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 }"),r=n)}})},gt=()=>window.innerHeight*.01+"px",mt=s=>{s&&setTimeout(()=>s.style.setProperty(W,gt()),0)},_t="rml-styles",ce=450,W="--rml-full-height",m={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},X=new Map,le=s=>{const t={get(e,r,n){const i=Reflect.get(e,r,n);return i!==void 0?i:(console.warn(`[Homag Intelligence Callbacks] Method '${String(r)}' is not implemented. Executing a no-op.`),(...o)=>{})}};return new Proxy(s,t)},ue={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"};class he extends ut{static createPlanner(t,e,r,n=[]){return this._create(t,e,r,n)}static async connect(t,e=[]){const r=new ut;r.viewName=t;const{resolve:n,promise:i}=ht(),{resolve:o,promise:a}=ht(),c=({message:d,args:h})=>{switch(d){case R.REGISTER_CUSTOM_VIEW_DONE:n();break;case R.RETURN_METHODS:r.handleSetup(h[0]),o();break;default:if(r.isSetupDone)return r.executeMessage({message:d,args:h})}},l=new D("custom-view-"+t,window,window.parent,c);r.setMessageHandler(l);const u=[t];return l.sendMessage(R.REGISTER_CUSTOM_VIEW,u),await i,l.sendMessage(R.GET_METHODS,u),await a,r.setupPlugins(e,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(t,e,r,n=[]){return this._create(t,e,r,n)}static create(t,e,r,n){return this._create(t,e,r,n)}static createViewer(t,e,r,n=[]){return this._create(t,e,r,n)}static setupHi(t){window.addEventListener("message",e=>{if(e.data.type==="connect_hi"&&e.data.port){const r=e.data.port;r.start?.(),H(le(t),r)}})}static async _create(t,e,r,n){return new Promise(async(i,o)=>{try{const a=Y(ne(),se(r));ae(a);const c=await $t(t,a);r=re(c,a);const l=new this(c,e,r,n,i);return await Promise.allSettled(l.pluginsLoaded),l}catch(a){return o(a)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,e,r,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(X.has(e))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(_t)){const l=r.zIndex||9999999,u=document.createElement("style");u.type="text/css",u.id=_t;const d="transition:all ease-in-out "+ce+"ms;",h=["-webkit-","-o-"].reduce((E,f)=>E+=f+d,"")+d,g=gt();u.innerHTML=`
|
|
5
|
+
*/const tt=Symbol("Comlink.proxy"),Nt=Symbol("Comlink.endpoint"),xt=Symbol("Comlink.releaseProxy"),G=Symbol("Comlink.finalizer"),b=Symbol("Comlink.thrown"),et=s=>typeof s=="object"&&s!==null||typeof s=="function",Pt={canHandle:s=>et(s)&&s[tt],serialize(s){const{port1:t,port2:e}=new MessageChannel;return H(s,t),[e,[e]]},deserialize(s){return s.start(),Ut(s)}},Gt={canHandle:s=>et(s)&&b in s,serialize({value:s}){let t;return s instanceof Error?t={isError:!0,value:{message:s.message,name:s.name,stack:s.stack}}:t={isError:!1,value:s},[t,[]]},deserialize(s){throw s.isError?Object.assign(new Error(s.value.message),s.value):s.value}},st=new Map([["proxy",Pt],["throw",Gt]]);function Ht(s,t){for(const e of s)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function H(s,t=globalThis,e=["*"]){t.addEventListener("message",function r(n){if(!n||!n.data)return;if(!Ht(e,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:i,type:o,path:a}=Object.assign({path:[]},n.data),c=(n.data.argumentList||[]).map(p);let l;try{const u=a.slice(0,-1).reduce((h,g)=>h[g],s),d=a.reduce((h,g)=>h[g],s);switch(o){case"GET":l=d;break;case"SET":u[a.slice(-1)[0]]=p(n.data.value),l=!0;break;case"APPLY":l=d.apply(u,c);break;case"CONSTRUCT":{const h=new d(...c);l=Xt(h)}break;case"ENDPOINT":{const{port1:h,port2:g}=new MessageChannel;H(s,g),l=Wt(h,[h])}break;case"RELEASE":l=void 0;break;default:return}}catch(u){l={value:u,[b]:0}}Promise.resolve(l).catch(u=>({value:u,[b]:0})).then(u=>{const[d,h]=M(u);t.postMessage(Object.assign(Object.assign({},d),{id:i}),h),o==="RELEASE"&&(t.removeEventListener("message",r),rt(t),G in s&&typeof s[G]=="function"&&s[G]())}).catch(u=>{const[d,h]=M({value:new TypeError("Unserializable return value"),[b]:0});t.postMessage(Object.assign(Object.assign({},d),{id:i}),h)})}),t.start&&t.start()}function Ft(s){return s.constructor.name==="MessagePort"}function rt(s){Ft(s)&&s.close()}function Ut(s,t){const e=new Map;return s.addEventListener("message",function(n){const{data:i}=n;if(!i||!i.id)return;const o=e.get(i.id);if(o)try{o(i)}finally{e.delete(i.id)}}),F(s,e,[],t)}function I(s){if(s)throw new Error("Proxy has been released and is not useable")}function nt(s){return T(s,new Map,{type:"RELEASE"}).then(()=>{rt(s)})}const A=new WeakMap,O="FinalizationRegistry"in globalThis&&new FinalizationRegistry(s=>{const t=(A.get(s)||0)-1;A.set(s,t),t===0&&nt(s)});function Bt(s,t){const e=(A.get(t)||0)+1;A.set(t,e),O&&O.register(s,t,s)}function Yt(s){O&&O.unregister(s)}function F(s,t,e=[],r=function(){}){let n=!1;const i=new Proxy(r,{get(o,a){if(I(n),a===xt)return()=>{Yt(i),nt(s),t.clear(),n=!0};if(a==="then"){if(e.length===0)return{then:()=>i};const c=T(s,t,{type:"GET",path:e.map(l=>l.toString())}).then(p);return c.then.bind(c)}return F(s,t,[...e,a])},set(o,a,c){I(n);const[l,u]=M(c);return T(s,t,{type:"SET",path:[...e,a].map(d=>d.toString()),value:l},u).then(p)},apply(o,a,c){I(n);const l=e[e.length-1];if(l===Nt)return T(s,t,{type:"ENDPOINT"}).then(p);if(l==="bind")return F(s,t,e.slice(0,-1));const[u,d]=it(c);return T(s,t,{type:"APPLY",path:e.map(h=>h.toString()),argumentList:u},d).then(p)},construct(o,a){I(n);const[c,l]=it(a);return T(s,t,{type:"CONSTRUCT",path:e.map(u=>u.toString()),argumentList:c},l).then(p)}});return Bt(i,s),i}function kt(s){return Array.prototype.concat.apply([],s)}function it(s){const t=s.map(M);return[t.map(e=>e[0]),kt(t.map(e=>e[1]))]}const ot=new WeakMap;function Wt(s,t){return ot.set(s,t),s}function Xt(s){return Object.assign(s,{[tt]:!0})}function M(s){for(const[t,e]of st)if(e.canHandle(s)){const[r,n]=e.serialize(s);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:s},ot.get(s)||[]]}function p(s){switch(s.type){case"HANDLER":return st.get(s.name).deserialize(s.value);case"RAW":return s.value}}function T(s,t,e,r){return new Promise(n=>{const i=zt();t.set(i,n),s.start&&s.start(),s.postMessage(Object.assign({id:i},e),r)})}function zt(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const U=".",B={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},R={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},$t=async(s,t)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const e=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,n=e+"/configurators/"+s,i="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+i),a=()=>{const d={apiKey:i,currentTenant:r,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:u}=await l.json();return u},Vt=()=>{try{return window.self!==window.top}catch{return!0}},jt=["127.0.0.1","localhost","0.0.0.0"],qt=()=>{const s=Vt();let t=window.location.href;if(s){if(!document.referrer)return null;t=document.referrer}const{hostname:e}=new URL(t);return e},Kt=s=>!!(jt.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),at=["language","browserLanguage","userLanguage","systemLanguage"],Jt=(s=null)=>{const t=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,r=at.length;e<r;e++){const n=t[at[e]];if(n)return n.substr(0,2)}return"en"},Qt=(s,t)=>{const e=JSON.parse(JSON.stringify(s));return Y(e,t)},Y=(s,t)=>{for(const e in t)try{t[e].constructor===Object?s[e]=Y(s[e],t[e]):s[e]=t[e]}catch{s[e]=t[e]}return s};var ct=(s=>(s.BOTTOM_BAR="bottom_bar",s.PARTLIST_BOUNDS="partlist_bounds",s.INTERACTION_NOTES="interaction_notes",s.PARAMETER_GROUPS="parameter_groups",s))(ct||{});const Zt=s=>JSON.parse(JSON.stringify(s)),te={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[ct.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},ee="(idle)",se=s=>(k(s),s?.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(ie,oe)),s),k=s=>{if(!s)return;const t=Object.keys(s);for(const e of t){const r=s[e];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&k(r),Array.isArray(r))for(const n of r)k(n);(r==="true"||r==="false")&&(s[e]=r==="true")}},re=(s,t)=>{t.configuratorId=s.id;const e=s.settings||{};return!t.overrideTenant&&s.tenant&&(t.overrideTenant=s.tenant),Qt(e,t)},ne=()=>{const s=Zt(te);s.locale||(s.locale=Jt()),s.id===ee&&delete s.id;const t=qt();return t&&Kt(t)&&(s.configuratorId="demoConfigurator"),s.customApiUrl=void 0,s.emails=!1,s},ie="<CONF_ID>",oe="#CONFIGURATIONID#",ae=s=>{s.featureFlags||(s.featureFlags={}),typeof s.featureFlags.realPartList!="boolean"&&(s.featureFlags.realPartList=!0),typeof s.featureFlags.globalCallbacks!="boolean"&&(s.featureFlags.globalCallbacks=!0),typeof s.featureFlags.mocAr!="boolean"&&(s.featureFlags.mocAr=!1)},lt=()=>/(android)/i.test(navigator.userAgent);class ut{_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:r}=t;e.forEach(n=>{const i=n.split(U),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)}),r.forEach(n=>{const i=n.split(U),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 r=t.split(U),n=r[0],i=r[1],o=r.length===3?r[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,r="website"){for(const n of t)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((i,o)=>{try{Promise.resolve().then(()=>me).then(({DragIn:a})=>{const c=new a(this.ui,e,r,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,r,this.viewName);c.init().then(()=>{this.plugins[n.name]=c,i()},o)})}catch(a){o(a)}}))}}const ht=()=>{let s,t;return{promise:new Promise((r,n)=>{s=r,t=n}),resolve:s,reject:t}},dt=(s,t,e)=>{let r=null;Object.defineProperty(s,t,{get(){return r||e},set(n){n?.mute?r=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 }"),r=n)}})},gt=()=>window.innerHeight*.01+"px",mt=s=>{s&&setTimeout(()=>s.style.setProperty(W,gt()),0)},_t="rml-styles",ce=450,W="--rml-full-height",m={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},X=new Map,le=s=>{const t={get(e,r,n){const i=Reflect.get(e,r,n);return i!==void 0?i:(console.warn(`[Homag Intelligence Callbacks] Method '${String(r)}' is not implemented. Executing a no-op.`),(...o)=>{})}};return new Proxy(s,t)},ue={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"};class he extends ut{static createPlanner(t,e,r,n=[]){return this._create(t,e,r,n)}static async connect(t,e=[]){const r=new ut;r.viewName=t;const{resolve:n,promise:i}=ht(),{resolve:o,promise:a}=ht(),c=({message:d,args:h})=>{switch(d){case R.REGISTER_CUSTOM_VIEW_DONE:n();break;case R.RETURN_METHODS:r.handleSetup(h[0]),o();break;default:if(r.isSetupDone)return r.executeMessage({message:d,args:h})}},l=new D("custom-view-"+t,window,window.parent,c);r.setMessageHandler(l);const u=[t];return l.sendMessage(R.REGISTER_CUSTOM_VIEW,u),await i,l.sendMessage(R.GET_METHODS,u),await a,r.setupPlugins(e,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(t,e,r,n=[]){return this._create(t,e,r,n)}static create(t,e,r,n){return this._create(t,e,r,n)}static createViewer(t,e,r,n=[]){return this._create(t,e,r,n)}static hiMessageHandler=null;static setupHi(t){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=e=>{if(e.data.type==="connect_hi"&&e.data.port){const r=e.data.port;r.start?.(),H(le(t),r)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(t,e,r,n){return new Promise(async(i,o)=>{try{const a=Y(ne(),se(r));ae(a);const c=await $t(t,a);r=re(c,a);const l=new this(c,e,r,n,i);return await Promise.allSettled(l.pluginsLoaded),l}catch(a){return o(a)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,e,r,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(X.has(e))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(_t)){const l=r.zIndex||9999999,u=document.createElement("style");u.type="text/css",u.id=_t;const d="transition:all ease-in-out "+ce+"ms;",h=["-webkit-","-o-"].reduce((E,f)=>E+=f+d,"")+d,g=gt();u.innerHTML=`
|
|
6
6
|
.${m.CONTAINER}{${W}:${g};}
|
|
7
7
|
.${m.POSITION}{position:fixed;top:0;left:0;z-index:${l};opacity:0}
|
|
8
8
|
.${m.TRANSITION}{${h}}
|
|
9
9
|
.${m.FILL}{width:100%;height:100%;opacity:1}
|
|
10
10
|
.${m.ANDROID_HEIGHT}{height:calc(var(${W},1vh)*100)}
|
|
11
11
|
.${m.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
12
|
-
`,document.head.appendChild(u)}this._executeMessage=this._executeMessage.bind(this);const a=new D("website",window,null,this._executeMessage);this.setMessageHandler(a),this._onResize=this._onResize.bind(this),lt()&&window.addEventListener("resize",this._onResize),this._container=e,this._initData=r,this._configuratorSettings=t;const c=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=i,this._container.appendChild(c),this._iframe=c,this.setupPlugins(n,this._iframe),X.set(e,!0)}teardown(){this._container&&X.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(m.CONTAINER),t.classList.add(m.FILL),t}_onResize(){mt(this._iframe)}_onUseFullPage(){this._iframe.classList.add(m.POSITION),document.documentElement.classList.add(m.OVERFLOW_HIDDEN),window.document.body.classList.add(m.OVERFLOW_HIDDEN),lt()&&(mt(this._iframe),this._iframe.classList.add(m.ANDROID_HEIGHT))}_onBackToWebsite(){this._iframe.classList.remove(m.POSITION),this._iframe.classList.remove(m.ANDROID_HEIGHT),document.documentElement.classList.remove(m.OVERFLOW_HIDDEN),window.document.body.classList.remove(m.OVERFLOW_HIDDEN)}_executeMessage({message:t,args:e},r){if(r.source&&r.source===this._iframe?.contentWindow)return t===B.REQUEST_BOOT?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(r.source),Promise.resolve({result:this._initData})):(console.error("MessageHandler not set"),Promise.resolve({error:"MessageHandler not set"})):t===B.SETUP?(this.handleSetup(e[0]),dt(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),dt(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{if(!this._messageHandler){console.error("MessageHandler not set");return}this._messageHandler.sendMessage(B.WEBSITE_READY)},0),Promise.resolve({result:null})):this.executeMessage({message:t,args:e})}}class de{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,r,n){this._instance=t,this._mainDomElement=e,this._mode=r,this._viewName=n}async init(){return Promise.resolve()}}const
|
|
12
|
+
`,document.head.appendChild(u)}this._executeMessage=this._executeMessage.bind(this);const a=new D("website",window,null,this._executeMessage);this.setMessageHandler(a),this._onResize=this._onResize.bind(this),lt()&&window.addEventListener("resize",this._onResize),this._container=e,this._initData=r,this._configuratorSettings=t;const c=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=i,this._container.appendChild(c),this._iframe=c,this.setupPlugins(n,this._iframe),X.set(e,!0)}teardown(){this._container&&X.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(m.CONTAINER),t.classList.add(m.FILL),t}_onResize(){mt(this._iframe)}_onUseFullPage(){this._iframe.classList.add(m.POSITION),document.documentElement.classList.add(m.OVERFLOW_HIDDEN),window.document.body.classList.add(m.OVERFLOW_HIDDEN),lt()&&(mt(this._iframe),this._iframe.classList.add(m.ANDROID_HEIGHT))}_onBackToWebsite(){this._iframe.classList.remove(m.POSITION),this._iframe.classList.remove(m.ANDROID_HEIGHT),document.documentElement.classList.remove(m.OVERFLOW_HIDDEN),window.document.body.classList.remove(m.OVERFLOW_HIDDEN)}_executeMessage({message:t,args:e},r){if(r.source&&r.source===this._iframe?.contentWindow)return t===B.REQUEST_BOOT?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(r.source),Promise.resolve({result:this._initData})):(console.error("MessageHandler not set"),Promise.resolve({error:"MessageHandler not set"})):t===B.SETUP?(this.handleSetup(e[0]),dt(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),dt(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{if(!this._messageHandler){console.error("MessageHandler not set");return}this._messageHandler.sendMessage(B.WEBSITE_READY)},0),Promise.resolve({result:null})):this.executeMessage({message:t,args:e})}}class de{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,r,n){this._instance=t,this._mainDomElement=e,this._mode=r,this._viewName=n}async init(){return Promise.resolve()}}const v="rml-drag-in-styles",C="rml-drag-in-drag-element",L="rml-drag-in-overlay",N="rml-drag-in-drag-ghost",ft="rml-drag-in-fade-in",pt="rml-drag-in-fade-out",z={DISPLAY_NONE:"rml-display-none"},yt=.5,Et="250ms",Dt="forwards",Tt=`@keyframes ${ft} {from{opacity: 0;}to {opacity: ${yt};}}`,wt=`@keyframes ${pt} {from{opacity: ${yt};}to {opacity: 0;}}`,St=`${ft} ${Et} ${Dt}`,bt=`${pt} ${Et} ${Dt}`,x="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",$=112,V=112;class ge extends de{options={};_customDragSignal=new AbortController;_injectStyles(){if(!!!document.getElementById(v)){const e=document.createElement("style");e.type="text/css",e.id=v,e.innerHTML=`
|
|
13
13
|
.${z.DISPLAY_NONE}{display:none}
|
|
14
14
|
.${L}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}
|
|
15
15
|
.${N}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}
|
|
16
16
|
${Tt}
|
|
17
|
-
${
|
|
18
|
-
`,document.head.appendChild(e)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+N);e||(e=document.createElement("div"),e.classList.add(N),e.innerText=" ",t.appendChild(e))}constructor(t,e,r,n){super(t,e,r,n),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),this._mode==="website")try{const{DragInFromWebsiteStrategy:t}=await Promise.resolve().then(()=>
|
|
17
|
+
${wt}
|
|
18
|
+
`,document.head.appendChild(e)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+N);e||(e=document.createElement("div"),e.classList.add(N),e.innerText=" ",t.appendChild(e))}constructor(t,e,r,n){super(t,e,r,n),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),this._mode==="website")try{const{DragInFromWebsiteStrategy:t}=await Promise.resolve().then(()=>Se);this._strategy=new t(this._instance,this._mainDomElement,{settings:this.options,mode:"website"})}catch(t){throw console.error('Could not load Dragin strategy "FromWebsite"'),t}else if(this._mode==="custom-view")try{const{DragInFromCustomViewStrategy:t}=await Promise.resolve().then(()=>ve);this._strategy=new t(this._instance,this._mainDomElement,this.options,this._viewName)}catch(t){throw console.error('Could not load Dragin strategy "FromCustomView"'),t}else throw new Error("Unsupported mode")}get isDragging(){return this._strategy.isDragging}dragStart(t,e,r="rml_id"){this._strategy.dragStart(t,e,r)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,e,r="rml_id"){this._strategy.touchStart(t,e,r)}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:r,beforeUpdateGhost:n}){n&&this._strategy.beforeUpdateGhost(n);const i=this._customDragSignal.signal,o=l=>{l.target.getAttribute("data-rml-draggable")==="true"&&t(l)},a=l=>{this._strategy.releaseInput(l),this._strategy.isDragging&&e(l)},c=l=>{r(l)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(l=>{l.draggable=!1}),document.addEventListener("mousedown",o,{signal:i}),document.addEventListener("mouseup",a,{signal:i}),document.addEventListener("mousemove",c,{signal:i}),document.addEventListener("mouseleave",a,{signal:i}),document.addEventListener("touchstart",o,{signal:i}),document.addEventListener("touchend",a,{signal:i}),document.addEventListener("touchmove",c,{signal:i})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}const me=Object.freeze(Object.defineProperty({__proto__:null,DragIn:ge},Symbol.toStringTag,{value:"Module"}));class _e{_computedStyleCache=new Map;_maxLifetime=16;_cacheCleanInterval=null;constructor(t=16){this._maxLifetime=t}get(t){const e=this._computedStyleCache.get(t),r=Date.now();if(e&&r-e.updated<this._maxLifetime)return e.style;const n=getComputedStyle(t);return this._computedStyleCache.set(t,{style:n,updated:r}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(this._maxLifetime*1e3,5e3))),n}_cleanUpCache(){const t=Date.now();for(const[e,{updated:r}]of this._computedStyleCache.entries())t-r>=this._maxLifetime&&this._computedStyleCache.delete(e);this._computedStyleCache.size===0&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const y=s=>window.TouchEvent&&s instanceof window.TouchEvent;let j;const P=s=>(j||(j=new _e),j.get(s)),It=(s,t,e)=>{const r=parseFloat(s),n=window.devicePixelRatio||1;if(t==="px")return r;if(t==="%"){const o=e===document.documentElement?window.innerWidth:e.offsetWidth;return r/100*o}if(t==="rem"){const o=parseFloat(P(document.documentElement).fontSize);return r*o}if(t==="em"){const o=parseFloat(P(e).fontSize);return r*o}if(t==="vh"||t==="vw"||t==="vmin"||t==="vmax"){const o={vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)};return r/100*o[t]}const i={cm:37.7952755906,mm:3.77952755906,in:96};return t in i?r*i[t]*n:(console.warn("Unable to determine coordinates for drag-in. Therefore drag-in is not possible. Check the CSS that positions the iframe of Roomle"),0)},At=(s,t,e={x:0,y:0})=>{const r=s.getBoundingClientRect(),i=P(s).transform;let o=0,a=0;if(i!=="none"){const h=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,g=i.match(h);g&&(o=It(g[1],g[2],s),a=It(g[3],g[4],s))}const{clientX:c,clientY:l}=w(t,e),u=c-r.left-o+s.scrollLeft,d=l-r.top-a+s.scrollTop;return{x:u,y:d}},w=(s,t=null)=>{const{clientX:e,clientY:r}=y(s)?fe(s):s,n=e>0?e:t?t.x:e,i=r>0?r:t?t.y:r;return{clientX:n,clientY:i}},fe=s=>{if(s.touches.length){let{clientX:e,clientY:r}=s.touches[0];if(s.touches.length>1){const n=s.touches[1],i=n.clientX,o=n.clientY;e=(e+i)/2,r=(r+o)/2}return{clientX:e,clientY:r}}const t=s.changedTouches[0];return{clientX:t.clientX,clientY:t.clientY}},q=500,K=10,pe=100,Ot=15,J=(s,t=0)=>y(s)?{clientX:s.touches[t].clientX,clientY:s.touches[t].clientY}:{clientX:s.clientX,clientY:s.clientY},Mt=s=>s&&y(s)?s.touches.length>0:!0;class Rt{_touchDragTimeOut;_onTouchDragStart;_payload=null;_delay=q;_firstTouch=null;_lastTouch=null;_epsilon=K;constructor(t,{onTouchDragStart:e},r={}){this._payload=t,this._onTouchDragStart=e,this._delay=typeof r.delay=="number"?r.delay:q,this._epsilon=typeof r.epsilon=="number"?r.epsilon:K}onStart(t){Mt(t)&&(this._touchDragTimeOut||(this._firstTouch=J(t,y(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=J(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){Mt(t)&&(this._lastTouch=J(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 vt=(s,t,e=0,r=0)=>{const n=t.x+t.width+e,i=t.x-e,o=t.y+t.height+r,a=t.y-r,{x:c,y:l}=s;return c>=i&&c<=n&&l>=a&&l<=o},Ct=(s,t,e,r=0,n=0)=>{if(!(!e||!e.hiddenIn&&!e.visibleIn))return e.visibleIn?vt({x:s,y:t},e.visibleIn,r,n):e.hiddenIn?!vt({x:s,y:t},e.hiddenIn,-r,-n):!1},ye=()=>{if(!!!document.getElementById(v)){const t=document.createElement("style");t.type="text/css",t.id=v,t.innerHTML=`
|
|
19
19
|
${Tt}
|
|
20
|
-
${
|
|
21
|
-
`,document.head.appendChild(t)}},Ee=({x:s,y:t},e)=>{let r=document.getElementById(v);if(!r){if(r=document.createElement("div"),e.ghost?.element)r.appendChild(e.ghost.element);else{const n=document.createElement("img");n.src=e.ghost?.url||x,n.width=e.ghost?.width||$,n.height=e.ghost?.height||V,r.appendChild(n)}r.id=v,r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.willChange="transform",r.style.transform="translate3d(0, 0, 0)",r.style.zIndex="9999",r.style.opacity="0.5",vt(s,t,e.ghost||{},e.settings?.dragInOverlapX,e.settings?.dragInOverlapY)||(r.style.display="none"),r.style.pointerEvents="none",document.body.appendChild(r)}},De=({x:s,y:t},e)=>{const r=document.getElementById(v);if(!r)return;let n=e.ghost?.width,i=e.ghost?.height;typeof n>"u"&&(n=r.getBoundingClientRect().width||$),typeof i>"u"&&(i=r.getBoundingClientRect().height||V);const o=s-n/2,a=t-i/2;r.style.transform=`translate3d(${o}px, ${a}px, 0)`,e.ghost&&(vt(s,t,e.ghost,e.settings?.dragInOverlapX,e.settings?.dragInOverlapY)?r.style.animation!=wt&&(r.style.animation=wt):r.style.animation!=bt&&(r.style.animation=bt))};class Te{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,r){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!r.ghost?.external&&r.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{ye();const n={x:t,y:e};!r.ghost&&this._dragGhostElement&&(r.ghost={}),r.ghost&&!r.ghost.element&&this._dragGhostElement&&(r.ghost.element=this._dragGhostElement),Ee(n,r),De(n,r),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(v);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class Se{_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,r){this._instance=t,this._mainDomElement=e,this._options=r||{},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,r="rml_id"){const n=this._mainDomElement.parentNode;if(P(n).position!=="relative"){console.warn("Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly");return}this._mainDomElement.style.pointerEvents="none";let o=n.querySelector("."+L);o||(o=document.createElement("div"),o.classList.add(L),n.appendChild(o)),o.classList.remove(z.DISPLAY_NONE),e.target.getAttribute("draggable")||console.warn(`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`);const c=n.querySelector("."+N);this._currentDrag.event=e;const l=e.target,u=l.cloneNode(!0),d=l.getBoundingClientRect();u.style.width=`${d.width}px`,u.style.height=`${d.height}px`,this._currentDrag.ghost=new Te(u),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:h,clientY:g}=S(e,this._firefoxDragPosition);this._currentDrag.offset.x=h-d.left,this._currentDrag.offset.y=g-d.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(c,0,0);const{x:E,y:f}=At(n,this._currentDrag.event||e,this._firefoxDragPosition),w=Math.max(1,E),ve=Math.max(1,f);this.isDragging=!0,this._instance.dragInObject(t,w,ve,r)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:r,y:n}=At(e,t,this._firefoxDragPosition);if(r===0&&n===0)return;const i=Math.max(1,r),o=Math.max(1,n);if(i===1&&o===1)return;let a=i,c=o;if(y(t)){const f=this._options.settings?.fingerSize||0;a=Math.max(2,i+f),c=Math.max(2,o-f)}const{x:l,y:u,options:d}=this._onBeforeUpdateDrag(a,c,{}),h=d||{settings:{},ghost:{}};h.ghost||(h.ghost={}),h.ghost.visibleIn&&h.ghost.hiddenIn||(h.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const g=typeof l=="number"?l:a,E=typeof u=="number"?u:c;if(this._currentDrag.ghost){const{clientX:f,clientY:w}=S(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(f,w,h)}this._instance.updateDrag(g,E,{})}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("."+L);e&&e.classList.add(z.DISPLAY_NONE)}touchStart(t,e,r="rml_id"){e.preventDefault();const n=(o,a)=>{this.dragStart(t,a,r)},i={};typeof this._options?.settings?.touchDragDelay=="number"&&(i.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(i.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new Rt(void 0,{onTouchDragStart:n},i),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){}}const we=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:Se},Symbol.toStringTag,{value:"Module"})),be=s=>`[data-rml-custom-view="${s}"]`,Q=s=>{s.preventDefault(),s.stopPropagation()},Ie=(s,t,e,r)=>{const n=e-s,i=r-t;return Math.sqrt(n*n+i*i)};class Ae{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){this._epsilon=typeof e.epsilon=="number"?e.epsilon:Ot,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&Ie(this._startX,this._startY,this._lastX,this._lastY)>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 Z="data-rml-old-draggable",Oe=void 0,Lt=(s,t)=>{const e=y(s),r={delay:e?q:pe,epsilon:e?K:Ot};if(!t)return r;if(!e&&!(s instanceof MouseEvent))return console.warn("Unsupported event! It is not TouchEvent and also not MouseEvent"),r;const{delayKey:n,epsilonKey:i}=e?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return typeof t[n]=="number"&&(r.delay=t.touchDragDelay),typeof t[i]=="number"&&(r.epsilon=t.touchDragEpsilon),r},Me=s=>{let t="",e=$,r=V;if(!s)return{url:x,width:e,height:r};const n=s;if(n instanceof HTMLElement){const i=n.getBoundingClientRect(),o=n.getAttribute("data-rml-ghost-url"),a=n.getAttribute("data-rml-ghost-width"),c=n.getAttribute("data-rml-ghost-height");o?t=o:!o&&n instanceof HTMLImageElement&&n.src&&(t=n.src),t?(e=i.width,r=i.height):t=x,e=a?parseInt(a,10):e,r=c?parseInt(c,10):r}return{url:t||x,width:e,height:r}};class Re{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;constructor(t,e,r,n){this._instance=t,this._options=r||{},this._viewName=n,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,r="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(Z,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",Q),this._startTarget.addEventListener("dragstart",Q)),this._currentBb=await this._instance.getBoundingClientRect(be(this._viewName));const{clientX:n,clientY:i}=S(e),o=this._currentBb.x+n,a=this._currentBb.y+i;this.isDragging=!0,this._instance.dragInObject(t,o,a,r)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:r}=S(t),{url:n,width:i,height:o}=Me(this._startTarget),a=this._currentBb.x+e,c=this._currentBb.y+r,l=this._options||{},u={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:o},mode:"custom-view"},{x:d,y:h,options:g}=this._onBeforeUpdateDrag(a,c,u),E=typeof d=="number"?d:a,f=typeof h=="number"?h:c,w=g||u;this._instance.updateDrag(E,f,w)}_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,r){this._instance.disableEvents(),this._startTarget=e.target;const n=(i,o)=>{this._dragStart(t,o,r)};this._currentCustomDrag=y(e)?new Rt(Oe,{onTouchDragStart:n},Lt(e,this._options)):new Ae({onCustomDragStart:i=>this._dragStart(t,i,r)},Lt(e,this._options)),this._currentCustomDrag.onStart(e)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,e,r="rml_id"){this.dragStart(t,e,r)}touchMove(t){this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable=this._startTarget.getAttribute(Z)==="true",this._startTarget.removeAttribute(Z),this._startTarget.removeEventListener("dragstart",Q))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}const Ce=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:Re},Symbol.toStringTag,{value:"Module"}));_.HI_PANEL_ACTION=ue,_.default=he,Object.defineProperties(_,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
20
|
+
${wt}
|
|
21
|
+
`,document.head.appendChild(t)}},Ee=({x:s,y:t},e)=>{let r=document.getElementById(C);if(!r){if(r=document.createElement("div"),e.ghost?.element)r.appendChild(e.ghost.element);else{const n=document.createElement("img");n.src=e.ghost?.url||x,n.width=e.ghost?.width||$,n.height=e.ghost?.height||V,r.appendChild(n)}r.id=C,r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.willChange="transform",r.style.transform="translate3d(0, 0, 0)",r.style.zIndex="9999",r.style.opacity="0.5",Ct(s,t,e.ghost||{},e.settings?.dragInOverlapX,e.settings?.dragInOverlapY)||(r.style.display="none"),r.style.pointerEvents="none",document.body.appendChild(r)}},De=({x:s,y:t},e)=>{const r=document.getElementById(C);if(!r)return;let n=e.ghost?.width,i=e.ghost?.height;typeof n>"u"&&(n=r.getBoundingClientRect().width||$),typeof i>"u"&&(i=r.getBoundingClientRect().height||V);const o=s-n/2,a=t-i/2;r.style.transform=`translate3d(${o}px, ${a}px, 0)`,e.ghost&&(Ct(s,t,e.ghost,e.settings?.dragInOverlapX,e.settings?.dragInOverlapY)?r.style.animation!=St&&(r.style.animation=St):r.style.animation!=bt&&(r.style.animation=bt))};class Te{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,r){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!r.ghost?.external&&r.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{ye();const n={x:t,y:e};!r.ghost&&this._dragGhostElement&&(r.ghost={}),r.ghost&&!r.ghost.element&&this._dragGhostElement&&(r.ghost.element=this._dragGhostElement),Ee(n,r),De(n,r),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(C);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class we{_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,r){this._instance=t,this._mainDomElement=e,this._options=r||{},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,r="rml_id"){const n=this._mainDomElement.parentNode;if(P(n).position!=="relative"){console.warn("Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly");return}this._mainDomElement.style.pointerEvents="none";let o=n.querySelector("."+L);o||(o=document.createElement("div"),o.classList.add(L),n.appendChild(o)),o.classList.remove(z.DISPLAY_NONE),e.target.getAttribute("draggable")||console.warn(`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`);const c=n.querySelector("."+N);this._currentDrag.event=e;const l=e.target,u=l.cloneNode(!0),d=l.getBoundingClientRect();u.style.width=`${d.width}px`,u.style.height=`${d.height}px`,this._currentDrag.ghost=new Te(u),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:h,clientY:g}=w(e,this._firefoxDragPosition);this._currentDrag.offset.x=h-d.left,this._currentDrag.offset.y=g-d.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(c,0,0);const{x:E,y:f}=At(n,this._currentDrag.event||e,this._firefoxDragPosition),S=Math.max(1,E),Ce=Math.max(1,f);this.isDragging=!0,this._instance.dragInObject(t,S,Ce,r)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:r,y:n}=At(e,t,this._firefoxDragPosition);if(r===0&&n===0)return;const i=Math.max(1,r),o=Math.max(1,n);if(i===1&&o===1)return;let a=i,c=o;if(y(t)){const f=this._options.settings?.fingerSize||0;a=Math.max(2,i+f),c=Math.max(2,o-f)}const{x:l,y:u,options:d}=this._onBeforeUpdateDrag(a,c,{}),h=d||{settings:{},ghost:{}};h.ghost||(h.ghost={}),h.ghost.visibleIn&&h.ghost.hiddenIn||(h.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const g=typeof l=="number"?l:a,E=typeof u=="number"?u:c;if(this._currentDrag.ghost){const{clientX:f,clientY:S}=w(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(f,S,h)}this._instance.updateDrag(g,E,{})}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("."+L);e&&e.classList.add(z.DISPLAY_NONE)}touchStart(t,e,r="rml_id"){e.preventDefault();const n=(o,a)=>{this.dragStart(t,a,r)},i={};typeof this._options?.settings?.touchDragDelay=="number"&&(i.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(i.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new Rt(void 0,{onTouchDragStart:n},i),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){}}const Se=Object.freeze(Object.defineProperty({__proto__:null,DragInFromWebsiteStrategy:we},Symbol.toStringTag,{value:"Module"})),be=s=>`[data-rml-custom-view="${s}"]`,Q=s=>{s.preventDefault(),s.stopPropagation()},Ie=(s,t,e,r)=>{const n=e-s,i=r-t;return Math.sqrt(n*n+i*i)};class Ae{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){this._epsilon=typeof e.epsilon=="number"?e.epsilon:Ot,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&Ie(this._startX,this._startY,this._lastX,this._lastY)>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 Z="data-rml-old-draggable",Oe=void 0,Lt=(s,t)=>{const e=y(s),r={delay:e?q:pe,epsilon:e?K:Ot};if(!t)return r;if(!e&&!(s instanceof MouseEvent))return console.warn("Unsupported event! It is not TouchEvent and also not MouseEvent"),r;const{delayKey:n,epsilonKey:i}=e?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return typeof t[n]=="number"&&(r.delay=t.touchDragDelay),typeof t[i]=="number"&&(r.epsilon=t.touchDragEpsilon),r},Me=s=>{let t="",e=$,r=V;if(!s)return{url:x,width:e,height:r};const n=s;if(n instanceof HTMLElement){const i=n.getBoundingClientRect(),o=n.getAttribute("data-rml-ghost-url"),a=n.getAttribute("data-rml-ghost-width"),c=n.getAttribute("data-rml-ghost-height");o?t=o:!o&&n instanceof HTMLImageElement&&n.src&&(t=n.src),t?(e=i.width,r=i.height):t=x,e=a?parseInt(a,10):e,r=c?parseInt(c,10):r}return{url:t||x,width:e,height:r}};class Re{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;constructor(t,e,r,n){this._instance=t,this._options=r||{},this._viewName=n,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,r="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(Z,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",Q),this._startTarget.addEventListener("dragstart",Q)),this._currentBb=await this._instance.getBoundingClientRect(be(this._viewName));const{clientX:n,clientY:i}=w(e),o=this._currentBb.x+n,a=this._currentBb.y+i;this.isDragging=!0,this._instance.dragInObject(t,o,a,r)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:r}=w(t),{url:n,width:i,height:o}=Me(this._startTarget),a=this._currentBb.x+e,c=this._currentBb.y+r,l=this._options||{},u={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:o},mode:"custom-view"},{x:d,y:h,options:g}=this._onBeforeUpdateDrag(a,c,u),E=typeof d=="number"?d:a,f=typeof h=="number"?h:c,S=g||u;this._instance.updateDrag(E,f,S)}_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,r){this._instance.disableEvents(),this._startTarget=e.target;const n=(i,o)=>{this._dragStart(t,o,r)};this._currentCustomDrag=y(e)?new Rt(Oe,{onTouchDragStart:n},Lt(e,this._options)):new Ae({onCustomDragStart:i=>this._dragStart(t,i,r)},Lt(e,this._options)),this._currentCustomDrag.onStart(e)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,e,r="rml_id"){this.dragStart(t,e,r)}touchMove(t){this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable=this._startTarget.getAttribute(Z)==="true",this._startTarget.removeAttribute(Z),this._startTarget.removeEventListener("dragstart",Q))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}const ve=Object.freeze(Object.defineProperty({__proto__:null,DragInFromCustomViewStrategy:Re},Symbol.toStringTag,{value:"Module"}));_.HI_PANEL_ACTION=ue,_.default=he,Object.defineProperties(_,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t,e;t=this,e=function(t){"use strict";class e{_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 r=new MessageChannel;r.port1.onmessage=t=>{if(!t||!t.data)return r.port1.close(),r.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 r.port1.close(),r.port2.close(),this._prepareError(t),n(t)}e.error?n(e.error):void 0!==e.result?s(e.result):s(void 0),r.port1.close(),r.port2.close()};let i="";try{i=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(i,"*",[r.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&("string"==typeof t.data||"connect_hi"!==t.data.type)&&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 s=Symbol("Comlink.proxy"),n=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),i=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),o=t=>"object"==typeof t&&null!==t||"function"==typeof t,l={canHandle:t=>o(t)&&t[s],serialize(t){const{port1:e,port2:s}=new MessageChannel;return u(t,e),[s,[s]]},deserialize:t=>(t.start(),function(t){const e=new Map;return t.addEventListener("message",function(t){const{data:s}=t;if(!s||!s.id)return;const n=e.get(s.id);if(n)try{n(s)}finally{e.delete(s.id)}}),f(t,e,[],void 0)}(t))},c={canHandle:t=>o(t)&&a in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},h=new Map([["proxy",l],["throw",c]]);function u(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(o){if(!o||!o.data)return;if(!function(t,e){for(const s of t)if(e===s||"*"===s||s instanceof RegExp&&s.test(e))return!0;return!1}(n,o.origin))return;const{id:l,type:c,path:h}=Object.assign({path:[]},o.data),d=(o.data.argumentList||[]).map(D);let m;try{const e=h.slice(0,-1).reduce((t,e)=>t[e],t),n=h.reduce((t,e)=>t[e],t);switch(c){case"GET":m=n;break;case"SET":e[h.slice(-1)[0]]=D(o.data.value),m=!0;break;case"APPLY":m=n.apply(e,d);break;case"CONSTRUCT":m=function(t){return Object.assign(t,{[s]:!0})}(new n(...d));break;case"ENDPOINT":{const{port1:e,port2:s}=new MessageChannel;u(t,s),m=function(t,e){return v.set(t,e),t}(e,[e])}break;case"RELEASE":m=void 0;break;default:return}}catch(t){m={value:t,[a]:0}}Promise.resolve(m).catch(t=>({value:t,[a]:0})).then(s=>{const[n,a]=w(s);e.postMessage(Object.assign(Object.assign({},n),{id:l}),a),"RELEASE"===c&&(e.removeEventListener("message",r),g(e),i in t&&"function"==typeof t[i]&&t[i]())}).catch(t=>{const[s,n]=w({value:new TypeError("Unserializable return value"),[a]:0});e.postMessage(Object.assign(Object.assign({},s),{id:l}),n)})}),e.start&&e.start()}function g(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function d(t){if(t)throw new Error("Proxy has been released and is not useable")}function m(t){return E(t,new Map,{type:"RELEASE"}).then(()=>{g(t)})}const _=new WeakMap,p="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(_.get(t)||0)-1;_.set(t,e),0===e&&m(t)});function f(t,e,s=[],i=function(){}){let a=!1;const o=new Proxy(i,{get(n,i){if(d(a),i===r)return()=>{(function(t){p&&p.unregister(t)})(o),m(t),e.clear(),a=!0};if("then"===i){if(0===s.length)return{then:()=>o};const n=E(t,e,{type:"GET",path:s.map(t=>t.toString())}).then(D);return n.then.bind(n)}return f(t,e,[...s,i])},set(n,r,i){d(a);const[o,l]=w(i);return E(t,e,{type:"SET",path:[...s,r].map(t=>t.toString()),value:o},l).then(D)},apply(r,i,o){d(a);const l=s[s.length-1];if(l===n)return E(t,e,{type:"ENDPOINT"}).then(D);if("bind"===l)return f(t,e,s.slice(0,-1));const[c,h]=b(o);return E(t,e,{type:"APPLY",path:s.map(t=>t.toString()),argumentList:c},h).then(D)},construct(n,r){d(a);const[i,o]=b(r);return E(t,e,{type:"CONSTRUCT",path:s.map(t=>t.toString()),argumentList:i},o).then(D)}});return function(t,e){const s=(_.get(e)||0)+1;_.set(e,s),p&&p.register(t,e,t)}(o,t),o}function y(t){return Array.prototype.concat.apply([],t)}function b(t){const e=t.map(w);return[e.map(t=>t[0]),y(e.map(t=>t[1]))]}const v=new WeakMap;function w(t){for(const[e,s]of h)if(s.canHandle(t)){const[n,r]=s.serialize(t);return[{type:"HANDLER",name:e,value:n},r]}return[{type:"RAW",value:t},v.get(t)||[]]}function D(t){switch(t.type){case"HANDLER":return h.get(t.name).deserialize(t.value);case"RAW":return t.value}}function E(t,e,s,n){return new Promise(r=>{const i=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(i,r),t.start&&t.start(),t.postMessage(Object.assign({id:i},s),n)})}const T=["127.0.0.1","localhost","0.0.0.0"],S=["language","browserLanguage","userLanguage","systemLanguage"],x=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=x(t[s],e[s]):t[s]=e[s]}catch{t[s]=e[s]}return t};var I,M=((I=M||{}).BOTTOM_BAR="bottom_bar",I.PARTLIST_BOUNDS="partlist_bounds",I.INTERACTION_NOTES="interaction_notes",I.PARAMETER_GROUPS="parameter_groups",I);const C={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[M.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},A=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&&A(e),Array.isArray(e))for(const t of e)A(t);("true"===e||"false"===e)&&(t[s]="true"===e)}},L=()=>/(android)/i.test(navigator.userAgent);class O{_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],r=e[2];this[s]||(this[s]={}),this[s][n]||(this[s][n]={}),this[s][n][r]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split("."),n=s[0],r=s[1],i=3===s.length?s[2]:null;if(i&&this[n][r][i]){const t=this[n][r][i](...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(()=>at).then(({DragIn:r})=>{const i=new r(this.ui,e,s,this.viewName);i.init().then(()=>{this.plugins.dragIn=i,t()},n)})}catch(t){n(t)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((t,r)=>{try{n.loader().then(i=>{const a=new i(this.ui,e,s,this.viewName);a.init().then(()=>{this.plugins[n.name]=a,t()},r)})}catch(t){r(t)}}))}}const P=()=>{let t,e;return{promise:new Promise((s,n)=>{t=s,e=n}),resolve:t,reject:e}},B=(t,e,s)=>{let n=null;Object.defineProperty(t,e,{get:()=>n||s,set(t){n=t?.mute?t.value:t}})},F=()=>.01*window.innerHeight+"px",N=t=>{t&&setTimeout(()=>t.style.setProperty(k,F()),0)},R="rml-styles",k="--rml-full-height",U="rml-container",G="rml-fill",X="rml-pos",j="rml-android-height",H="rml-overflow-hidden",Y=new Map;class z{_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 $="rml-drag-in-styles",W="rml-drag-in-drag-element",q="rml-drag-in-overlay",J="rml-drag-in-drag-ghost",K="rml-drag-in-fade-in",V="rml-drag-in-fade-out",Q="rml-display-none",Z="250ms",tt="forwards",et=`@keyframes ${K} {from{opacity: 0;}to {opacity: 0.5;}}`,st=`@keyframes ${V} {from{opacity: 0.5;}to {opacity: 0;}}`,nt=`${K} ${Z} ${tt}`,rt=`${V} ${Z} ${tt}`,it="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",at=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends z{options={};_customDragSignal=new AbortController;_injectStyles(){if(!document.getElementById($)){const t=document.createElement("style");t.type="text/css",t.id=$,t.innerHTML=`\n .${Q}{display:none}\n .${q}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${J}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${et}\n ${st}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+J);e||(e=document.createElement("div"),e.classList.add(J),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(()=>wt);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(()=>xt);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 r=this._customDragSignal.signal,i=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",i,{signal:r}),document.addEventListener("mouseup",a,{signal:r}),document.addEventListener("mousemove",o,{signal:r}),document.addEventListener("mouseleave",a,{signal:r}),document.addEventListener("touchstart",i,{signal:r}),document.addEventListener("touchend",a,{signal:r}),document.addEventListener("touchmove",o,{signal:r})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));class ot{_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 lt=t=>window.TouchEvent&&t instanceof window.TouchEvent;let ct;const ht=t=>(ct||(ct=new ot),ct.get(t)),ut=(t,e,s)=>{const n=parseFloat(t),r=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(ht(document.documentElement).fontSize);if("em"===e)return n*parseFloat(ht(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 i={cm:37.7952755906,mm:3.77952755906,in:96};return e in i?n*i[e]*r:0},gt=(t,e,s={x:0,y:0})=>{const n=t.getBoundingClientRect(),r=ht(t).transform;let i=0,a=0;if("none"!==r){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,s=r.match(e);s&&(i=ut(s[1],s[2],t),a=ut(s[3],s[4],t))}const{clientX:o,clientY:l}=dt(e,s);return{x:o-n.left-i+t.scrollLeft,y:l-n.top-a+t.scrollTop}},dt=(t,e=null)=>{const{clientX:s,clientY:n}=lt(t)?mt(t):t;return{clientX:s>0?s:e?e.x:s,clientY:n>0?n:e?e.y:n}},mt=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}},_t=(t,e=0)=>lt(t)?{clientX:t.touches[e].clientX,clientY:t.touches[e].clientY}:{clientX:t.clientX,clientY:t.clientY},pt=t=>!t||!lt(t)||t.touches.length>0;class ft{_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){pt(t)&&(this._touchDragTimeOut||(this._firstTouch=_t(t,lt(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=_t(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){pt(t)&&(this._lastTouch=_t(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 yt=(t,e,s=0,n=0)=>{const r=e.x+e.width+s,i=e.x-s,a=e.y+e.height+n,o=e.y-n,{x:l,y:c}=t;return l>=i&&l<=r&&c>=o&&c<=a},bt=(t,e,s,n=0,r=0)=>{if(s&&(s.hiddenIn||s.visibleIn))return s.visibleIn?yt({x:t,y:e},s.visibleIn,n,r):!!s.hiddenIn&&!yt({x:t,y:e},s.hiddenIn,-n,-r)};class vt{_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($)){const t=document.createElement("style");t.type="text/css",t.id=$,t.innerHTML=`\n ${et}\n ${st}\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(W);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||it,t.width=s.ghost?.width||112,t.height=s.ghost?.height||112,n.appendChild(t)}n.id=W,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",bt(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(W);if(!n)return;let r=s.ghost?.width,i=s.ghost?.height;typeof r>"u"&&(r=n.getBoundingClientRect().width||112),typeof i>"u"&&(i=n.getBoundingClientRect().height||112);const a=t-r/2,o=e-i/2;n.style.transform=`translate3d(${a}px, ${o}px, 0)`,s.ghost&&(bt(t,e,s.ghost,s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)?n.style.animation!=nt&&(n.style.animation=nt):n.style.animation!=rt&&(n.style.animation=rt))})(n,s),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(W);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}const wt=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"!==ht(n).position)return;this._mainDomElement.style.pointerEvents="none";let r=n.querySelector("."+q);r||(r=document.createElement("div"),r.classList.add(q),n.appendChild(r)),r.classList.remove(Q),e.target.getAttribute("draggable");const i=n.querySelector("."+J);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 vt(o),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:c,clientY:h}=dt(e,this._firefoxDragPosition);this._currentDrag.offset.x=c-l.left,this._currentDrag.offset.y=h-l.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(i,0,0);const{x:u,y:g}=gt(n,this._currentDrag.event||e,this._firefoxDragPosition),d=Math.max(1,u),m=Math.max(1,g);this.isDragging=!0,this._instance.dragInObject(t,d,m,s)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:s,y:n}=gt(e,t,this._firefoxDragPosition);if(0===s&&0===n)return;const r=Math.max(1,s),i=Math.max(1,n);if(1===r&&1===i)return;let a=r,o=i;if(lt(t)){const t=this._options.settings?.fingerSize||0;a=Math.max(2,r+t),o=Math.max(2,i-t)}const{x:l,y:c,options:h}=this._onBeforeUpdateDrag(a,o,{}),u=h||{settings:{},ghost:{}};u.ghost||(u.ghost={}),u.ghost.visibleIn&&u.ghost.hiddenIn||(u.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const g="number"==typeof l?l:a,d="number"==typeof c?c:o;if(this._currentDrag.ghost){const{clientX:e,clientY:s}=dt(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,s,u)}this._instance.updateDrag(g,d,{})}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("."+q);e&&e.classList.add(Q)}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 ft(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"})),Dt=t=>{t.preventDefault(),t.stopPropagation()};class Et{_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 Tt="data-rml-old-draggable",St=(t,e)=>{const s=lt(t),n={delay:s?500:100,epsilon:s?10:15};if(!e)return n;if(!(s||t instanceof MouseEvent))return n;const{delayKey:r,epsilonKey:i}=s?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[r]&&(n.delay=e.touchDragDelay),"number"==typeof e[i]&&(n.epsilon=e.touchDragEpsilon),n},xt=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(Tt,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",Dt),this._startTarget.addEventListener("dragstart",Dt)),this._currentBb=await this._instance.getBoundingClientRect((()=>`[data-rml-custom-view="${this._viewName}"]`)());const{clientX:n,clientY:r}=dt(e),i=this._currentBb.x+n,a=this._currentBb.y+r;this.isDragging=!0,this._instance.dragInObject(t,i,a,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:s}=dt(t),{url:n,width:r,height:i}=(t=>{let e="",s=112,n=112;if(!t)return{url:it,width:s,height:n};const r=t;if(r instanceof HTMLElement){const t=r.getBoundingClientRect(),i=r.getAttribute("data-rml-ghost-url"),a=r.getAttribute("data-rml-ghost-width"),o=r.getAttribute("data-rml-ghost-height");i?e=i:!i&&r instanceof HTMLImageElement&&r.src&&(e=r.src),e?(s=t.width,n=t.height):e=it,s=a?parseInt(a,10):s,n=o?parseInt(o,10):n}return{url:e||it,width:s,height:n}})(this._startTarget),a=this._currentBb.x+e,o=this._currentBb.y+s,l=this._options||{},c={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:r,height:i},mode:"custom-view"},{x:h,y:u,options:g}=this._onBeforeUpdateDrag(a,o,c),d="number"==typeof h?h:a,m="number"==typeof u?u:o,_=g||c;this._instance.updateDrag(d,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=lt(e)?new ft(void 0,{onTouchDragStart:(e,n)=>{this._dragStart(t,n,s)}},St(e,this._options)):new Et({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(Tt),this._startTarget.removeAttribute(Tt),this._startTarget.removeEventListener("dragstart",Dt))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}},Symbol.toStringTag,{value:"Module"}));t.HI_PANEL_ACTION={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"},t.default=class extends O{static createPlanner(t,e,s,n=[]){return this._create(t,e,s,n)}static async connect(t,s=[]){const n=new O;n.viewName=t;const{resolve:r,promise:i}=P(),{resolve:a,promise:o}=P(),l=new e("custom-view-"+t,window,window.parent,({message:t,args:e})=>{switch(t){case"registerCustomViewDone":r();break;case"returnMethods":n.handleSetup(e[0]),a();break;default:if(n.isSetupDone)return n.executeMessage({message:t,args:e})}});n.setMessageHandler(l);const c=[t];return l.sendMessage("registerCustomView",c),await i,l.sendMessage("getMethods",c),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 setupHi(t){window.addEventListener("message",e=>{if("connect_hi"===e.data.type&&e.data.port){const s=e.data.port;s.start?.(),u((t=>new Proxy(t,{get(t,e,s){const n=Reflect.get(t,e,s);return void 0!==n?n:(...t)=>{}}}))(t),s)}})}static async _create(t,e,s,n){return new Promise(async(r,i)=>{try{const i=x((()=>{const t=(t=>JSON.parse(JSON.stringify(t)))(C);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,s=S.length;t<s;t++){const s=e[S[t]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const e=(()=>{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 e&&(t=>!!(T.includes(t)||t.endsWith("roomle.com")||t.endsWith("gitlab.io")||t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl=void 0,t.emails=!1,t})(),(t=>(A(t),t?.customApiUrl&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(s));(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)})(i);const a=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,r=s+"/configurators/"+t,i="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+i),o=new Request(r,{method:"GET",headers:new Headers({apiKey:i,currentTenant:n,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})(t,i);s=((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 x(s,e)})(s,e)})(a,i);const o=new this(a,e,s,n,r);return await Promise.allSettled(o.pluginsLoaded),o}catch(t){return i(t)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,n,r,i){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(Y.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(R)){const t=n.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id=R;const s="transition:all ease-in-out 450ms;",r=["-webkit-","-o-"].reduce((t,e)=>t+(e+s),"")+s,i=F();e.innerHTML=`\n .${U}{${k}:${i};}\n .${X}{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${r}}\n .${G}{width:100%;height:100%;opacity:1}\n .${j}{height:calc(var(${k},1vh)*100)}\n .${H}{overflow:hidden}\n `,document.head.appendChild(e)}this._executeMessage=this._executeMessage.bind(this);const a=new e("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=t;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=i,this._container.appendChild(o),this._iframe=o,this.setupPlugins(r,this._iframe),Y.set(s,!0)}teardown(){this._container&&Y.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(U),t.classList.add(G),t}_onResize(){N(this._iframe)}_onUseFullPage(){this._iframe.classList.add(X),document.documentElement.classList.add(H),window.document.body.classList.add(H),L()&&(N(this._iframe),this._iframe.classList.add(j))}_onBackToWebsite(){this._iframe.classList.remove(X),this._iframe.classList.remove(j),document.documentElement.classList.remove(H),window.document.body.classList.remove(H)}_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]),B(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),B(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.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&typeof module<"u"?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):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={}));
|
|
1
|
+
var t,e;t=this,e=function(t){"use strict";class e{_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 r=new MessageChannel;r.port1.onmessage=t=>{if(!t||!t.data)return r.port1.close(),r.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 r.port1.close(),r.port2.close(),this._prepareError(t),n(t)}e.error?n(e.error):void 0!==e.result?s(e.result):s(void 0),r.port1.close(),r.port2.close()};let i="";try{i=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(i,"*",[r.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&("string"==typeof t.data||"connect_hi"!==t.data.type)&&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 s=Symbol("Comlink.proxy"),n=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),i=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),o=t=>"object"==typeof t&&null!==t||"function"==typeof t,l={canHandle:t=>o(t)&&t[s],serialize(t){const{port1:e,port2:s}=new MessageChannel;return u(t,e),[s,[s]]},deserialize:t=>(t.start(),function(t){const e=new Map;return t.addEventListener("message",function(t){const{data:s}=t;if(!s||!s.id)return;const n=e.get(s.id);if(n)try{n(s)}finally{e.delete(s.id)}}),f(t,e,[],void 0)}(t))},c={canHandle:t=>o(t)&&a in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},h=new Map([["proxy",l],["throw",c]]);function u(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(o){if(!o||!o.data)return;if(!function(t,e){for(const s of t)if(e===s||"*"===s||s instanceof RegExp&&s.test(e))return!0;return!1}(n,o.origin))return;const{id:l,type:c,path:h}=Object.assign({path:[]},o.data),d=(o.data.argumentList||[]).map(D);let m;try{const e=h.slice(0,-1).reduce((t,e)=>t[e],t),n=h.reduce((t,e)=>t[e],t);switch(c){case"GET":m=n;break;case"SET":e[h.slice(-1)[0]]=D(o.data.value),m=!0;break;case"APPLY":m=n.apply(e,d);break;case"CONSTRUCT":m=function(t){return Object.assign(t,{[s]:!0})}(new n(...d));break;case"ENDPOINT":{const{port1:e,port2:s}=new MessageChannel;u(t,s),m=function(t,e){return v.set(t,e),t}(e,[e])}break;case"RELEASE":m=void 0;break;default:return}}catch(t){m={value:t,[a]:0}}Promise.resolve(m).catch(t=>({value:t,[a]:0})).then(s=>{const[n,a]=w(s);e.postMessage(Object.assign(Object.assign({},n),{id:l}),a),"RELEASE"===c&&(e.removeEventListener("message",r),g(e),i in t&&"function"==typeof t[i]&&t[i]())}).catch(t=>{const[s,n]=w({value:new TypeError("Unserializable return value"),[a]:0});e.postMessage(Object.assign(Object.assign({},s),{id:l}),n)})}),e.start&&e.start()}function g(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function d(t){if(t)throw new Error("Proxy has been released and is not useable")}function m(t){return E(t,new Map,{type:"RELEASE"}).then(()=>{g(t)})}const _=new WeakMap,p="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(_.get(t)||0)-1;_.set(t,e),0===e&&m(t)});function f(t,e,s=[],i=function(){}){let a=!1;const o=new Proxy(i,{get(n,i){if(d(a),i===r)return()=>{(function(t){p&&p.unregister(t)})(o),m(t),e.clear(),a=!0};if("then"===i){if(0===s.length)return{then:()=>o};const n=E(t,e,{type:"GET",path:s.map(t=>t.toString())}).then(D);return n.then.bind(n)}return f(t,e,[...s,i])},set(n,r,i){d(a);const[o,l]=w(i);return E(t,e,{type:"SET",path:[...s,r].map(t=>t.toString()),value:o},l).then(D)},apply(r,i,o){d(a);const l=s[s.length-1];if(l===n)return E(t,e,{type:"ENDPOINT"}).then(D);if("bind"===l)return f(t,e,s.slice(0,-1));const[c,h]=b(o);return E(t,e,{type:"APPLY",path:s.map(t=>t.toString()),argumentList:c},h).then(D)},construct(n,r){d(a);const[i,o]=b(r);return E(t,e,{type:"CONSTRUCT",path:s.map(t=>t.toString()),argumentList:i},o).then(D)}});return function(t,e){const s=(_.get(e)||0)+1;_.set(e,s),p&&p.register(t,e,t)}(o,t),o}function y(t){return Array.prototype.concat.apply([],t)}function b(t){const e=t.map(w);return[e.map(t=>t[0]),y(e.map(t=>t[1]))]}const v=new WeakMap;function w(t){for(const[e,s]of h)if(s.canHandle(t)){const[n,r]=s.serialize(t);return[{type:"HANDLER",name:e,value:n},r]}return[{type:"RAW",value:t},v.get(t)||[]]}function D(t){switch(t.type){case"HANDLER":return h.get(t.name).deserialize(t.value);case"RAW":return t.value}}function E(t,e,s,n){return new Promise(r=>{const i=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(i,r),t.start&&t.start(),t.postMessage(Object.assign({id:i},s),n)})}const T=["127.0.0.1","localhost","0.0.0.0"],S=["language","browserLanguage","userLanguage","systemLanguage"],M=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=M(t[s],e[s]):t[s]=e[s]}catch{t[s]=e[s]}return t};var x,I=((x=I||{}).BOTTOM_BAR="bottom_bar",x.PARTLIST_BOUNDS="partlist_bounds",x.INTERACTION_NOTES="interaction_notes",x.PARAMETER_GROUPS="parameter_groups",x);const C={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,webGpu:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},A=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&&A(e),Array.isArray(e))for(const t of e)A(t);("true"===e||"false"===e)&&(t[s]="true"===e)}},L=()=>/(android)/i.test(navigator.userAgent);class O{_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],r=e[2];this[s]||(this[s]={}),this[s][n]||(this[s][n]={}),this[s][n][r]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split("."),n=s[0],r=s[1],i=3===s.length?s[2]:null;if(i&&this[n][r][i]){const t=this[n][r][i](...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(()=>at).then(({DragIn:r})=>{const i=new r(this.ui,e,s,this.viewName);i.init().then(()=>{this.plugins.dragIn=i,t()},n)})}catch(t){n(t)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((t,r)=>{try{n.loader().then(i=>{const a=new i(this.ui,e,s,this.viewName);a.init().then(()=>{this.plugins[n.name]=a,t()},r)})}catch(t){r(t)}}))}}const P=()=>{let t,e;return{promise:new Promise((s,n)=>{t=s,e=n}),resolve:t,reject:e}},B=(t,e,s)=>{let n=null;Object.defineProperty(t,e,{get:()=>n||s,set(t){n=t?.mute?t.value:t}})},F=()=>.01*window.innerHeight+"px",N=t=>{t&&setTimeout(()=>t.style.setProperty(k,F()),0)},R="rml-styles",k="--rml-full-height",U="rml-container",G="rml-fill",H="rml-pos",X="rml-android-height",j="rml-overflow-hidden",Y=new Map;class z{_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 $="rml-drag-in-styles",W="rml-drag-in-drag-element",q="rml-drag-in-overlay",J="rml-drag-in-drag-ghost",K="rml-drag-in-fade-in",V="rml-drag-in-fade-out",Q="rml-display-none",Z="250ms",tt="forwards",et=`@keyframes ${K} {from{opacity: 0;}to {opacity: 0.5;}}`,st=`@keyframes ${V} {from{opacity: 0.5;}to {opacity: 0;}}`,nt=`${K} ${Z} ${tt}`,rt=`${V} ${Z} ${tt}`,it="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",at=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends z{options={};_customDragSignal=new AbortController;_injectStyles(){if(!document.getElementById($)){const t=document.createElement("style");t.type="text/css",t.id=$,t.innerHTML=`\n .${Q}{display:none}\n .${q}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${J}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${et}\n ${st}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+J);e||(e=document.createElement("div"),e.classList.add(J),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(()=>wt);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(()=>Mt);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 r=this._customDragSignal.signal,i=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",i,{signal:r}),document.addEventListener("mouseup",a,{signal:r}),document.addEventListener("mousemove",o,{signal:r}),document.addEventListener("mouseleave",a,{signal:r}),document.addEventListener("touchstart",i,{signal:r}),document.addEventListener("touchend",a,{signal:r}),document.addEventListener("touchmove",o,{signal:r})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));class ot{_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 lt=t=>window.TouchEvent&&t instanceof window.TouchEvent;let ct;const ht=t=>(ct||(ct=new ot),ct.get(t)),ut=(t,e,s)=>{const n=parseFloat(t),r=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(ht(document.documentElement).fontSize);if("em"===e)return n*parseFloat(ht(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 i={cm:37.7952755906,mm:3.77952755906,in:96};return e in i?n*i[e]*r:0},gt=(t,e,s={x:0,y:0})=>{const n=t.getBoundingClientRect(),r=ht(t).transform;let i=0,a=0;if("none"!==r){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,s=r.match(e);s&&(i=ut(s[1],s[2],t),a=ut(s[3],s[4],t))}const{clientX:o,clientY:l}=dt(e,s);return{x:o-n.left-i+t.scrollLeft,y:l-n.top-a+t.scrollTop}},dt=(t,e=null)=>{const{clientX:s,clientY:n}=lt(t)?mt(t):t;return{clientX:s>0?s:e?e.x:s,clientY:n>0?n:e?e.y:n}},mt=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}},_t=(t,e=0)=>lt(t)?{clientX:t.touches[e].clientX,clientY:t.touches[e].clientY}:{clientX:t.clientX,clientY:t.clientY},pt=t=>!t||!lt(t)||t.touches.length>0;class ft{_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){pt(t)&&(this._touchDragTimeOut||(this._firstTouch=_t(t,lt(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=_t(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){pt(t)&&(this._lastTouch=_t(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 yt=(t,e,s=0,n=0)=>{const r=e.x+e.width+s,i=e.x-s,a=e.y+e.height+n,o=e.y-n,{x:l,y:c}=t;return l>=i&&l<=r&&c>=o&&c<=a},bt=(t,e,s,n=0,r=0)=>{if(s&&(s.hiddenIn||s.visibleIn))return s.visibleIn?yt({x:t,y:e},s.visibleIn,n,r):!!s.hiddenIn&&!yt({x:t,y:e},s.hiddenIn,-n,-r)};class vt{_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($)){const t=document.createElement("style");t.type="text/css",t.id=$,t.innerHTML=`\n ${et}\n ${st}\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(W);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||it,t.width=s.ghost?.width||112,t.height=s.ghost?.height||112,n.appendChild(t)}n.id=W,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",bt(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(W);if(!n)return;let r=s.ghost?.width,i=s.ghost?.height;typeof r>"u"&&(r=n.getBoundingClientRect().width||112),typeof i>"u"&&(i=n.getBoundingClientRect().height||112);const a=t-r/2,o=e-i/2;n.style.transform=`translate3d(${a}px, ${o}px, 0)`,s.ghost&&(bt(t,e,s.ghost,s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)?n.style.animation!=nt&&(n.style.animation=nt):n.style.animation!=rt&&(n.style.animation=rt))})(n,s),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(W);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}const wt=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"!==ht(n).position)return;this._mainDomElement.style.pointerEvents="none";let r=n.querySelector("."+q);r||(r=document.createElement("div"),r.classList.add(q),n.appendChild(r)),r.classList.remove(Q),e.target.getAttribute("draggable");const i=n.querySelector("."+J);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 vt(o),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:c,clientY:h}=dt(e,this._firefoxDragPosition);this._currentDrag.offset.x=c-l.left,this._currentDrag.offset.y=h-l.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(i,0,0);const{x:u,y:g}=gt(n,this._currentDrag.event||e,this._firefoxDragPosition),d=Math.max(1,u),m=Math.max(1,g);this.isDragging=!0,this._instance.dragInObject(t,d,m,s)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:s,y:n}=gt(e,t,this._firefoxDragPosition);if(0===s&&0===n)return;const r=Math.max(1,s),i=Math.max(1,n);if(1===r&&1===i)return;let a=r,o=i;if(lt(t)){const t=this._options.settings?.fingerSize||0;a=Math.max(2,r+t),o=Math.max(2,i-t)}const{x:l,y:c,options:h}=this._onBeforeUpdateDrag(a,o,{}),u=h||{settings:{},ghost:{}};u.ghost||(u.ghost={}),u.ghost.visibleIn&&u.ghost.hiddenIn||(u.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const g="number"==typeof l?l:a,d="number"==typeof c?c:o;if(this._currentDrag.ghost){const{clientX:e,clientY:s}=dt(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,s,u)}this._instance.updateDrag(g,d,{})}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("."+q);e&&e.classList.add(Q)}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 ft(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"})),Dt=t=>{t.preventDefault(),t.stopPropagation()};class Et{_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 Tt="data-rml-old-draggable",St=(t,e)=>{const s=lt(t),n={delay:s?500:100,epsilon:s?10:15};if(!e)return n;if(!(s||t instanceof MouseEvent))return n;const{delayKey:r,epsilonKey:i}=s?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[r]&&(n.delay=e.touchDragDelay),"number"==typeof e[i]&&(n.epsilon=e.touchDragEpsilon),n},Mt=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(Tt,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",Dt),this._startTarget.addEventListener("dragstart",Dt)),this._currentBb=await this._instance.getBoundingClientRect((()=>`[data-rml-custom-view="${this._viewName}"]`)());const{clientX:n,clientY:r}=dt(e),i=this._currentBb.x+n,a=this._currentBb.y+r;this.isDragging=!0,this._instance.dragInObject(t,i,a,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:s}=dt(t),{url:n,width:r,height:i}=(t=>{let e="",s=112,n=112;if(!t)return{url:it,width:s,height:n};const r=t;if(r instanceof HTMLElement){const t=r.getBoundingClientRect(),i=r.getAttribute("data-rml-ghost-url"),a=r.getAttribute("data-rml-ghost-width"),o=r.getAttribute("data-rml-ghost-height");i?e=i:!i&&r instanceof HTMLImageElement&&r.src&&(e=r.src),e?(s=t.width,n=t.height):e=it,s=a?parseInt(a,10):s,n=o?parseInt(o,10):n}return{url:e||it,width:s,height:n}})(this._startTarget),a=this._currentBb.x+e,o=this._currentBb.y+s,l=this._options||{},c={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:r,height:i},mode:"custom-view"},{x:h,y:u,options:g}=this._onBeforeUpdateDrag(a,o,c),d="number"==typeof h?h:a,m="number"==typeof u?u:o,_=g||c;this._instance.updateDrag(d,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=lt(e)?new ft(void 0,{onTouchDragStart:(e,n)=>{this._dragStart(t,n,s)}},St(e,this._options)):new Et({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(Tt),this._startTarget.removeAttribute(Tt),this._startTarget.removeEventListener("dragstart",Dt))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}},Symbol.toStringTag,{value:"Module"}));t.HI_PANEL_ACTION={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"},t.default=class extends O{static createPlanner(t,e,s,n=[]){return this._create(t,e,s,n)}static async connect(t,s=[]){const n=new O;n.viewName=t;const{resolve:r,promise:i}=P(),{resolve:a,promise:o}=P(),l=new e("custom-view-"+t,window,window.parent,({message:t,args:e})=>{switch(t){case"registerCustomViewDone":r();break;case"returnMethods":n.handleSetup(e[0]),a();break;default:if(n.isSetupDone)return n.executeMessage({message:t,args:e})}});n.setMessageHandler(l);const c=[t];return l.sendMessage("registerCustomView",c),await i,l.sendMessage("getMethods",c),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 hiMessageHandler=null;static setupHi(t){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=e=>{if("connect_hi"===e.data.type&&e.data.port){const s=e.data.port;s.start?.(),u((t=>new Proxy(t,{get(t,e,s){const n=Reflect.get(t,e,s);return void 0!==n?n:(...t)=>{}}}))(t),s)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(t,e,s,n){return new Promise(async(r,i)=>{try{const i=M((()=>{const t=(t=>JSON.parse(JSON.stringify(t)))(C);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,s=S.length;t<s;t++){const s=e[S[t]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const e=(()=>{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 e&&(t=>!!(T.includes(t)||t.endsWith("roomle.com")||t.endsWith("gitlab.io")||t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl=void 0,t.emails=!1,t})(),(t=>(A(t),t?.customApiUrl&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(s));(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)})(i);const a=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,r=s+"/configurators/"+t,i="roomle_portal_v2",a="03-"+window.btoa((new Date).toISOString()+";anonymous;"+i),o=new Request(r,{method:"GET",headers:new Headers({apiKey:i,currentTenant:n,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})(t,i);s=((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 M(s,e)})(s,e)})(a,i);const o=new this(a,e,s,n,r);return await Promise.allSettled(o.pluginsLoaded),o}catch(t){return i(t)}})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,n,r,i){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(Y.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(R)){const t=n.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id=R;const s="transition:all ease-in-out 450ms;",r=["-webkit-","-o-"].reduce((t,e)=>t+(e+s),"")+s,i=F();e.innerHTML=`\n .${U}{${k}:${i};}\n .${H}{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${r}}\n .${G}{width:100%;height:100%;opacity:1}\n .${X}{height:calc(var(${k},1vh)*100)}\n .${j}{overflow:hidden}\n `,document.head.appendChild(e)}this._executeMessage=this._executeMessage.bind(this);const a=new e("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=t;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=i,this._container.appendChild(o),this._iframe=o,this.setupPlugins(r,this._iframe),Y.set(s,!0)}teardown(){this._container&&Y.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(U),t.classList.add(G),t}_onResize(){N(this._iframe)}_onUseFullPage(){this._iframe.classList.add(H),document.documentElement.classList.add(j),window.document.body.classList.add(j),L()&&(N(this._iframe),this._iframe.classList.add(X))}_onBackToWebsite(){this._iframe.classList.remove(H),this._iframe.classList.remove(X),document.documentElement.classList.remove(j),window.document.body.classList.remove(j)}_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]),B(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),B(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.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"object"==typeof exports&&typeof module<"u"?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):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={}));
|
|
@@ -2,7 +2,7 @@ import { SceneSelection } from '../../configurator/store/ui-state';
|
|
|
2
2
|
import { Nullable } from '../utils/types';
|
|
3
3
|
|
|
4
4
|
export declare const isExternalModuleSelection: (currentSelection: Nullable<SceneSelection>) => boolean;
|
|
5
|
-
export declare const isDeletePossible: (currentSelection: Nullable<SceneSelection
|
|
5
|
+
export declare const isDeletePossible: (currentSelection: Nullable<SceneSelection>, isReDockEnabled: boolean) => boolean;
|
|
6
6
|
export declare const useConfiguratorActionsVisibility: () => {
|
|
7
7
|
showStartConfiguring: import('vue').ComputedRef<boolean>;
|
|
8
8
|
showDelete: import('vue').ComputedRef<any>;
|
|
@@ -115,6 +115,7 @@ export declare class SdkConnector {
|
|
|
115
115
|
plan: Nullable<void> /** Nullable void reserved for later, just to indicate that we could also return something about the plan in the future */;
|
|
116
116
|
objectRuntimeId: Nullable<RuntimeId>;
|
|
117
117
|
}>;
|
|
118
|
+
loadPlanXml(xml: string): Promise<void>;
|
|
118
119
|
getStorage(): IdbManager;
|
|
119
120
|
saveConfigToIdb(): Promise<void>;
|
|
120
121
|
loadConfiguration(configurationId: string, initData?: UiInitData | undefined): Promise<Nullable<LoadResponse>>;
|
|
@@ -127,6 +127,11 @@ export declare class ExposedApi {
|
|
|
127
127
|
* @param rotation in radians
|
|
128
128
|
*/
|
|
129
129
|
insertObject(id: string, position?: Position3, rotation?: number): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Load a plan from an XML string into the planner scene
|
|
132
|
+
* @param xml - The plan XML string to load
|
|
133
|
+
*/
|
|
134
|
+
loadPlanXml(xml: string): Promise<void>;
|
|
130
135
|
/**
|
|
131
136
|
* Changes the currently selected parameter group to a parameter group containing the specified key.
|
|
132
137
|
* @param groupKey - parameterGroup key.
|
|
@@ -35,6 +35,7 @@ export declare class SdkConnectorPlanner extends Connector {
|
|
|
35
35
|
initPlanner(planner: RoomlePlannerWithExtObjs): Promise<void>;
|
|
36
36
|
loadPlan(id: RapiId): Promise<void>;
|
|
37
37
|
loadPlanBasedOnObjectId(id: RapiId): Promise<RuntimeId>;
|
|
38
|
+
loadPlanXml(xml: string): Promise<void>;
|
|
38
39
|
getObjects(): Promise<any>;
|
|
39
40
|
updateProductList(): Promise<void>;
|
|
40
41
|
onSelectionCancel(reason: CancelSelectionReasons): Promise<void>;
|