@roomle/web-sdk 2.112.0-alpha.2 → 2.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"homag-intelligence-B-l8gFNg.mjs","sources":["../../packages/homag-intelligence/src/rml-plugin.ts","../../packages/homag-intelligence/src/api.ts","../../../../src/configurator/embedding/types.ts","../../../common/src/utils/init-data.ts","../../../embedding-lib/src/embedding-lib.ts","../../packages/homag-intelligence/src/hi-object-selection.ts","../../packages/homag-intelligence/src/glue-logic.ts","../../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../../node_modules/uuid/dist/esm-browser/rng.js","../../../../node_modules/uuid/dist/esm-browser/native.js","../../../../node_modules/uuid/dist/esm-browser/v4.js","../../packages/homag-intelligence/src/callbacks.ts","../../packages/homag-intelligence/src/orders.ts","../../packages/homag-intelligence/src/debug-logging.ts","../../packages/homag-intelligence/src/homag-intelligence.ts"],"sourcesContent":["export abstract class RmlPlugin {\n public abstract init(...args: any[]): Promise<this>;\n}\n","import type { RoomDesignerRequests } from './glue-logic';\nimport type { MasterData, PosGroup } from './model/oc-scripts-domain.model';\nimport type { RoomlePlannerType } from '../../typings/external-objects';\nimport type { LoadExternalObjectOptions } from './external-object-api';\n\nexport interface ExternalObjectModuleIdMap {\n originalModuleId: string;\n newModuleId: string;\n}\n\nexport class RoomDesignerApi implements RoomDesignerRequests {\n private _roomlePlanner: RoomlePlannerType;\n\n constructor(roomlePlanner: RoomlePlannerType) {\n this._roomlePlanner = roomlePlanner;\n }\n\n public loadMasterData(masterData: MasterData) {\n this._roomlePlanner.loadExternalObjectMasterData(masterData);\n }\n\n public async loadPosGroups(\n posDataJson: PosGroup | PosGroup[],\n options: LoadExternalObjectOptions,\n ): Promise<void> {\n const posDataArray = Array.isArray(posDataJson)\n ? posDataJson\n : [posDataJson];\n await this._roomlePlanner.loadExternalObjectGroups(posDataArray, options);\n }\n\n public async selectGroup(groupId: string): Promise<void> {\n await this._roomlePlanner.selectExternalObjectGroup(groupId);\n }\n\n public async selectRoot(rootModuleId: string): Promise<void> {\n await this._roomlePlanner.selectExternalObjectRootModule(rootModuleId);\n }\n\n public async selectModule(\n rootModuleId: string,\n subModuleId: string,\n ): Promise<void> {\n await this._roomlePlanner.selectExternalObjectSubModule(\n rootModuleId,\n subModuleId,\n );\n }\n\n public openCloseGroup(\n groupOrRootModuleId: string,\n subModuleId: string | null,\n open: boolean,\n animate: boolean,\n ) {\n this._roomlePlanner.openOrCloseGeometryOfExternalObject(\n groupOrRootModuleId,\n subModuleId ?? null,\n open,\n animate,\n );\n return Promise.resolve();\n }\n\n public deleteGroup(groupId: string) {\n this._roomlePlanner.removeExternalObject(groupId);\n }\n\n public deleteRootModule(rootModuleId: string) {\n this._roomlePlanner.selectExternalObjectGroup(rootModuleId);\n }\n\n public async getPosDataOfAllGroups() {\n const groups =\n (await this._roomlePlanner.getExternalObjectGroups()) as PosGroup[];\n return groups;\n }\n\n public async getRoomInformation() {\n const rooms = await this._roomlePlanner.getExternalRoomInformation();\n return rooms;\n }\n\n public async saveExternalObjectSnapshot() {\n return this._roomlePlanner.saveExternalObjectSnapshot();\n }\n\n public async saveCurrentPlanSnapshot() {\n return this._roomlePlanner.saveCurrentPlanSnapshot();\n }\n\n public async renderPosDataImage(posDataJson: object) {\n const posDataArray = Array.isArray(posDataJson)\n ? posDataJson\n : [posDataJson];\n await this._roomlePlanner.renderImagesOfExternalObjectGroup(posDataArray);\n }\n}\n","import type {\n FeatureFlags,\n GlobalInitDataDefinition,\n InitDataDefinition,\n} from '@roomle/web-sdk/common-core/src/utils/shims';\nimport type {\n HexColorString,\n RapiConfiguratorSettings,\n RapiId,\n} from '@roomle/web-sdk/typings/rapi-types';\nimport type {\n Enumify,\n MEASUREMENT_UNIT,\n MEASUREMENT_SYSTEM,\n Nullable,\n} from '@/common/utils/types';\nimport type { ViewTypeState } from '@/common/store/sidebar-store';\nimport type { TutorialData } from '@/common/utils/types';\nimport type { KernelPartList } from '@roomle/web-sdk/typings/kernel';\nimport type {\n INTERACTION_NOTIFICATIONS,\n NOTIFICATIONS,\n} from '@/common/components/utils/-utils/notifications';\nimport type { SidebarEventTypes } from '@/common/composables/use-event-emitter-listener';\n\nexport interface ThumbnailsSettings {\n collapsed: { desktop: ViewTypeState; mobile: ViewTypeState };\n expanded: { desktop: ViewTypeState; mobile: ViewTypeState };\n}\n\nexport enum UI_BUTTON {\n AR = 'ar',\n PARTLIST = 'partlist',\n MULTISELECT = 'multiselect',\n DIMENSIONS = 'dimensions',\n FULLSCREEN = 'fullscreen',\n RESETCAMERA = 'resetcamera',\n RENDERIMAGE = 'renderimage',\n ADDONS = 'addons',\n REQUESTPRODUCT = 'requestproduct',\n REQUESTPLAN = 'requestplan',\n SAVEDRAFT = 'savedraft',\n STARTCONFIGURE = 'startconfigure',\n PAUSECONFIGURE = 'pauseconfigure',\n FIRST_PERSON = 'firstperson',\n EXPORT_3D = 'export3d',\n ROTATE = 'rotate',\n SNAPPING = 'snapping',\n UNDO = 'undo',\n REDO = 'redo',\n PARTLIST_PLANNER = 'partlist_planner',\n PARTLIST_PRINT = 'partlist_print',\n PRODUCTLIST = 'productlist',\n TWO_D_VIEW = '2dview',\n ADD_ROOM = 'add_room',\n STARTPLANNER = 'startPlanner',\n THREE_D_VIEW = '3dview',\n CLOSE_VIEW = 'close_view',\n ADD_TO_BASKET = 'add_to_basket',\n VIEW_MODE = 'view_mode',\n ADD_MEASUREMENT_LINE = 'add_measurement_line',\n HELP_CENTER = 'help_center',\n LOAD_PRODUCT = 'load_product',\n CONFIGURE_IN_ROOM = 'configure_in_room',\n SWAP_PRODUCT = 'swap_product',\n}\n\nexport enum UI_ELEMENTS {\n BOTTOM_BAR = 'bottom_bar',\n PARTLIST_BOUNDS = 'partlist_bounds',\n INTERACTION_NOTES = 'interaction_notes',\n PARAMETER_GROUPS = 'parameter_groups',\n}\n\nexport interface HelpCenterSetting {\n configurator?: boolean;\n roomdesigner?: boolean;\n disable?: boolean;\n}\n\ninterface UiFeatureFlags extends FeatureFlags {\n realPartList?: boolean;\n globalCallbacks?: boolean;\n mocAr?: boolean;\n wallAutoHeight?: boolean;\n enableTwoLevelCatalog?: boolean;\n\n /**\n * @hidden\n * @description ...\n */\n imosix?: boolean;\n /**\n * @hidden\n * @description ...\n */\n prodmanager?: boolean;\n /**\n * @hidden\n * @description Enables the open/close animation button in the flying menu - RML-13533\n */\n openCloseAnimation?: boolean;\n}\n\nexport interface VariantsMap {\n [key: string]: RapiId;\n}\n\nexport type LogLevelCanvasCoords = 'all' | 'click' | 'move';\n\nexport interface UiInitData\n extends InitDataDefinition,\n GlobalInitDataDefinition {\n /**\n * @description show and hide certain buttons\n */\n buttons?: {\n [UI_BUTTON.AR]?: boolean;\n [UI_BUTTON.PARTLIST]?: boolean;\n [UI_BUTTON.MULTISELECT]?: boolean;\n [UI_BUTTON.DIMENSIONS]?: boolean;\n [UI_BUTTON.FULLSCREEN]?: boolean;\n [UI_BUTTON.RESETCAMERA]?: boolean;\n [UI_BUTTON.RENDERIMAGE]?: boolean;\n [UI_BUTTON.ADDONS]?: boolean;\n [UI_BUTTON.REQUESTPRODUCT]?: boolean;\n [UI_BUTTON.REQUESTPLAN]?: boolean;\n [UI_BUTTON.SAVEDRAFT]?: boolean;\n [UI_BUTTON.LOAD_PRODUCT]?: boolean;\n [UI_BUTTON.STARTCONFIGURE]?: boolean;\n [UI_BUTTON.PAUSECONFIGURE]?: boolean;\n [UI_BUTTON.EXPORT_3D]?: boolean;\n [UI_BUTTON.ROTATE]?: boolean;\n [UI_BUTTON.SNAPPING]?: boolean;\n [UI_BUTTON.UNDO]?: boolean;\n [UI_BUTTON.REDO]?: boolean;\n [UI_BUTTON.TWO_D_VIEW]?: boolean;\n [UI_BUTTON.PARTLIST_PLANNER]?: boolean;\n [UI_BUTTON.PARTLIST_PRINT]?: boolean;\n [UI_BUTTON.PRODUCTLIST]?: boolean;\n [UI_BUTTON.ADD_ROOM]?: boolean;\n [UI_BUTTON.STARTPLANNER]?: boolean;\n [UI_BUTTON.THREE_D_VIEW]?: boolean;\n [UI_BUTTON.FIRST_PERSON]?: boolean;\n [UI_BUTTON.CLOSE_VIEW]?: boolean;\n [UI_BUTTON.ADD_TO_BASKET]?: boolean;\n [UI_BUTTON.VIEW_MODE]?: boolean;\n [UI_BUTTON.ADD_MEASUREMENT_LINE]?: boolean;\n [UI_BUTTON.HELP_CENTER]?: boolean;\n [UI_BUTTON.CONFIGURE_IN_ROOM]?: boolean;\n [UI_BUTTON.SWAP_PRODUCT]?: boolean;\n [key: string]: boolean | undefined;\n };\n\n /**\n * @description show and hide certain elements\n */\n elements?: {\n [UI_ELEMENTS.BOTTOM_BAR]?: boolean;\n [UI_ELEMENTS.PARTLIST_BOUNDS]?: boolean;\n [UI_ELEMENTS.INTERACTION_NOTES]?: boolean;\n [UI_ELEMENTS.PARAMETER_GROUPS]?: boolean;\n [key: string]: boolean | undefined;\n };\n\n /**\n * @description show and hide certain notifications\n */\n notifications?: {\n [NOTIFICATIONS.LOAD_IDB_CONFIG]?: boolean;\n [NOTIFICATIONS.FIRST_PERSON_CONTROLS]?: boolean;\n [NOTIFICATIONS.STOP_CONFIGURE_HINT]?: boolean;\n [NOTIFICATIONS.INTERACTION_NOTE]?: {\n [INTERACTION_NOTIFICATIONS.ROOT_ELEMENT]?: boolean;\n [INTERACTION_NOTIFICATIONS.CONFIRM_GHOSTS]?: boolean;\n [INTERACTION_NOTIFICATIONS.ADD_ELEMENT]?: boolean;\n [INTERACTION_NOTIFICATIONS.PARAMETER_CHANGED]?: boolean;\n };\n [key: string]: boolean | { [key: string]: boolean | undefined } | undefined;\n };\n\n /**\n * @description skin the embedding instance\n */\n skin?: EmbeddingSkin;\n\n /**\n * @description set the z-index of the embedding instance\n */\n zIndex?: number;\n\n /**\n * @internal\n * @description use a local version of the embedding\n */\n useLocalRoomle?: boolean;\n\n /**\n * @internal\n * @description use another server url for the embedding\n */\n overrideServerUrl?: string;\n\n /**\n * @deprecated\n * @description for details see deeplink, the only change is\n * that the placeholder is <CONF_ID> here instead\n * of #CONFIGURATIONID#\n */\n shareUrl?: string;\n\n /**\n * @description Set this parameter to use your custom share url.\n * The provided url has to contain a configuration id parameter (`#CONFIGURATIONID#`) which will be replaced with the real\n * configuration id.\n * default: not set -> use Roomle short url service (linking to roomle.com domain)\n * usage: http://www.example.com/configurator?id=#CONFIGURATIONID#\n */\n deeplink?: string;\n\n /**\n * @description Define to which variants you can switch from which root component id. This is a simple JS object which is\n * used like a map, e.g.: '\"usm:frame\": \"DB_Start_ohne_Element\"' now if a configuration with root component\n * usm:frame is loaded all the items from the tag \"DB_Start_ohne_Element\" are now shown as variants\n */\n variants?: VariantsMap;\n\n /**\n * @description if set to true you can load the configurator in an iframe.src but without any embedding lib\n * This is needed if you do not want to interact with the configurator and only want to use it\n * to view 3d content. Imagine it then as a <img> tag for 3d content\n */\n api?: boolean;\n\n /**\n * @description if this is set to true the \"save draft\" will be done by sending\n * an e-mail\n */\n emails?: boolean;\n\n /**\n * @description set this flag to true if you want to configure on small devices in landscape as well\n * this is relevant for things like Rubens Admin, where the configurator is embedded into a very\n * small div\n */\n mobileLandscape?: boolean;\n\n /**\n * @description set this flag to true if you want to group the part list by main components\n */\n groupPartList?: boolean;\n\n /**\n * @internal\n * @description this is an object which is for Roomle internal usage, we can set feature flags\n * so that we can ensure a smooth transition between different versions of our configurator\n */\n featureFlags?: UiFeatureFlags;\n\n /**\n * @description set this flag to false if the user did not give the consent to Analytics\n */\n gaConsent?: boolean;\n\n /**\n * @description override translations to change labels for some or all languages.\n * Example:\n *\n * ```\n * \"translations\": {\n * \"en\": {\n * \"params\": {\n * \"request-product\": \"Add to cart\",\n * }\n * }\n * }\n * ```\n *\n * You can find all labels here: [Base.json](../translate-labels)\n */\n translations?: any;\n\n /**\n * @description set this flag to false and global parameters are not applied when switching variants\n */\n applyCurrentGlobalParameters?: boolean;\n\n /**\n * @description set this flag to true if you want that a user can select more than one material category at once\n */\n materialMultiSelect?: boolean;\n\n /**\n * @description set this flag to true if you want to start the moc in configuring mode if there is only one object in the scene\n * @groups room-designer\n */\n startInDetail?: boolean;\n\n /**\n * @description use this param to initialize the configurator ui state, like opening certain views, camera modes, etc\n * @groups room-designer\n */\n state?: UiState;\n\n /**\n * @description define the root tag of your catalog\n * you can define multiple root tags by using []\n * e.g.: catalogRootTag[]=123&catalogRootTag[]=456\n * @groups room-designer\n */\n catalogRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the construction elements, default is \"construction_moc\" when moc=true and null otherwise\n * you can define multiple root tags by using []\n * e.g.: constructionRootTag[]=123&constructionRootTag[]=456\n * @groups room-designer\n */\n constructionRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used for floors\n * you can define multiple root tags by using []\n * e.g.: floorMaterialRootTag[]=123&floorMaterialRootTag[]=456\n * @groups room-designer\n */\n floorMaterialRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used for walls\n * you can define multiple root tags by using []\n * e.g.: wallMaterialRootTag[]=123&wallMaterialRootTag[]=456\n * @groups room-designer\n */\n wallMaterialRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used for doors\n * you can define multiple root tags by using []\n * e.g.: doorMaterialRootTag[]=123&doorMaterialRootTag[]=456\n * @groups room-designer\n */\n doorMaterialRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used for windows\n * you can define multiple root tags by using []\n * e.g.: windowMaterialRootTag[]=123&windowMaterialRootTag[]=456\n * @groups room-designer\n */\n windowMaterialRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used for objects\n * you can define multiple root tags by using []\n * e.g.: objectMaterialRootTag[]=123&objectMaterialRootTag[]=456\n * @groups room-designer\n */\n objectMaterialRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used, this sets\n * floorMaterialRootTag, wallMaterialRootTag, doorMaterialRootTag,\n * windowMaterialRootTag, objectMaterialRootTag\n * if they are not set\n * you can define multiple root tags by using []\n * e.g.: materialRootTag[]=123&materialRootTag[]=456\n * @groups room-designer\n */\n materialRootTag?: RapiId | RapiId[];\n\n /**\n * @description sets the measurement unit to be displayed in the planner and configurator UI.\n */\n unit?: Enumify<typeof MEASUREMENT_UNIT>;\n\n /**\n * @description sets the measurement unit to be displayed in the planner and configurator UI.\n * imperial sets measurementUnit to inches if no unit is passed\n * metric sets measurementUnit to cm if no unit is passed\n * if unit is not a metric unit (i.e. inch) but unitType=metric it will default to a metric unit (CM)\n * and vice-versa\n */\n measurementSystem?: Enumify<typeof MEASUREMENT_SYSTEM>;\n\n /**\n * @description the query param thumbnails will be converted to the following object:\n * ```\n * {\n * collapsed: { desktop: ViewTypeState; mobile: ViewTypeState };\n * expanded: { desktop: ViewTypeState; mobile: ViewTypeState };\n * }\n * ```\n *\n * You have separate options to specify the settings for the thumbnails e.g.:\n * ?thumbnails=big this sets all the values to \"big\" or you do:\n * ?thumbnails.collapsed=big&thumbnails.expanded=list this sets the collapsed\n * state to \"big\" and the expanded state to \"list\". Or you can specify the full\n * object like:\n * ?thumbnails.collapsed.desktop=big&thumbnails.collapsed.mobile=small&thumbnails.expanded.desktop=list&thumbnails.expanded.mobile=big\n *\n * the following values for ViewTypeState are valid: list | small | big\n * for the collapsed state list will have no effect and just be rendered like small.\n * On mobile collapsed will only use small\n */\n thumbnails?: ThumbnailsSettings;\n\n /**\n * @description start embedding instance only as viewer\n */\n viewer?: boolean;\n\n /**\n * @description use an external catalog (deprecated, use customView.extCatalog instead)\n * @deprecated\n * @groups room-designer\n */\n extCatalog?: string;\n\n /**\n * @description specify a custom font to be used. When using a custom font make sure you understand\n * the legal implications. For example: copyrigth law, data protection law, etc.\n * - source needs to be a valid url to a font file CSS.\n * Similar to what Google Fonts provides. For an example see:\n * https://fonts.googleapis.com/css?family=Lato:300,400,700&display=swap&subset=latin-ext\n * The font should provide the following weights: 300, 400, 700\n * If you use the URL as a query param make sure to use encodeURIComponent\n * - family needs to be a valid CSS font family name.\n * If you use font family as a query param make sure to use encodeURIComponent\n */\n fonts?: {\n source?: string;\n family?: string;\n };\n\n /**\n * @description Shows or hides the first person mode toggle button in the sidebar menu\n * @groups room-designer\n */\n firstPersonView?: boolean;\n\n /**\n * @description Specify which context (i.e room designer or configurator or neither) to show the tutorial/helpcenter\n * button in the sidebar.\n */\n helpcenter?: HelpCenterSetting;\n\n /**\n * @description Specify custom tutorials to be shown in the tutorial/helpcenter.\n * Should be of the following format:\n * [{\n * \"en\": { // mandatory\n * \"link\": \"SOME_LINK\",\n * \"label\": \"first step\",\n * \"desc\": \"some description\",\n * },\n * \"de\": { // optional\n * \"link\": \"SOME_LINK\",\n * \"label\": \"first step\",\n * \"desc\": \"some description\",\n * },\n * \"SOME_OTHER_LOCALE\": { // optional --> SOME_OTHER_LOCALE should be a valid locale from: https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes\n * \"link\": \"SOME_LINK\",\n * \"label\": \"first step\",\n * \"desc\": \"some description\",\n * },\n * \"scope\": \"room-designer\", // optional\n * \"platform\": \"desktop\" // optional\n * }]\n */\n customTutorials?: TutorialData[];\n\n /**\n * @description Enables saving changes to the current configuration and or plan to indexedDB storage locally in the\n * browser, reloading the page will prompt the user to restore the saved configuration/plan.\n * - The data saved in indexedDB is stored in a key-value pair under the database 'rml-idb' and the table\n * named 'rml-config-store' where the key consists of the current hostname (if inside an iframe it will be 'window.referrer'),\n * the configurator ID and the plan or configurator ID separated by underscores (_).\n * - This key format allows saved data to be scoped by the aforementioned IDs and hostname.\n * - The data stored in 'rml-config-store' follows the following format:\n * {\n * \"id\": \"example.com_exampleConfiguratorId_examplePlanOrConfigurationId\",\n * \"data\": \"<...configurationOrPlanDataString...>\",\n * \"lastModified\": \"2024-04-16T04:54:48.825Z\"\n * \"referrer\": \"example.com\"\n * }\n * - Any data in the 'rml-idb' database older than 30 days is removed automatically when the app loads.\n */\n saveToIdb?: boolean;\n\n /**\n * @description when the configurator/Room Designer is embedded into a too small space we start it in view\n * only mode, then the user has to click the \"start\" button and the configurator/Room Designer expands over\n * the whole window. This is great for UX, but it's not always ideal in every use case. Therefore, you can\n * force either behaviour by setting autoStart to true or false.\n *\n * default: true if screen with is bigger than 1024px otherwise false\n */\n autoStart?: boolean;\n\n /**\n * @internal\n * @description if set to true the coords of the clicks on the canvas will be logged to the console\n */\n logCanvasCoords?: LogLevelCanvasCoords;\n\n /**\n * @description For use with planner only, if set to true the room will be shown while configuring a configurable object.\n */\n configureInRoom?: boolean;\n\n /**\n * @internal\n * @description Keeps the interaction container collapsed.\n * This is only used if the room designer is embedded in the technical configurator. (BO PoC 2)\n */\n interactionsCollapsed?: boolean;\n\n /**\n * @description define when you want to show the search bar, currently we hide the search bar until there are more than 10 elements.\n * since it is a query param the value is a string. Please only provide a string that can be parseInt(x,10) otherwise it will be\n * undefined behavior\n */\n searchThreshold?: string;\n\n /**\n * @description Sets the rotation indicator to snap a plan object to the nearest supplied degree value while being rotated, default is 10 degrees.\n * Supplying 0 will allow the rotation indicator to rotate plan object freely.\n */\n rotationSnapDegrees?: number;\n\n /**\n * @description specify an url which can be used as src for an iframe\n */\n customView?: CustomViews;\n\n /**\n * @internal\n * @description specify if Room Designer functionality should be active\n */\n roomDesignerActive?: boolean;\n}\n\nexport interface UiState {\n /**\n * define which modes are active when starting the planner/MOC\n */\n mode?: 'room' | 'catalog';\n}\n\nexport interface EmbeddingSkin {\n 'primary-color'?: HexColorString;\n 'primary-color-in-rgb'?: HexColorString;\n 'color-on-primary'?: HexColorString;\n 'cta-color'?: HexColorString;\n 'color-on-cta'?: HexColorString;\n\n [key: string]: HexColorString | undefined;\n}\n\nexport interface ConfiguratorSettings extends RapiConfiguratorSettings {\n id: string;\n allowedHost: string;\n tenant: number;\n url: string;\n settings: UiInitData;\n}\n\ninterface PartlistPrintPayload {\n partList: KernelPartList[];\n price: Nullable<string>;\n label: string;\n bounds: string;\n catalogLabel: Nullable<string>;\n}\n\ntype CallbackPayloads = {\n [UI_BUTTON.PARTLIST_PRINT]: PartlistPrintPayload;\n};\n\ntype DefaultCallbackPayloads<T, U extends string> = {\n [K in U]: K extends keyof T ? T[K] : void;\n};\n\nexport type ButtonCallbackPayloads = DefaultCallbackPayloads<\n CallbackPayloads,\n UI_BUTTON\n>;\n\ninterface CustomViewSettingsBase<T> {\n options?: T;\n}\n\nexport interface CustomViewSettingsForOverlay<T>\n extends CustomViewSettingsBase<T> {\n overlay: boolean;\n}\n\nexport interface CustomViewSettingsForIframe<T>\n extends CustomViewSettingsBase<T> {\n url: string;\n}\n\nexport type CustomViewSettings<T> =\n | CustomViewSettingsForOverlay<T>\n | CustomViewSettingsForIframe<T>;\n\nexport interface CustomViews {\n itemSelection?: CustomViewSettings<object>;\n extCatalog?: CustomViewSettings<{\n showHeader: boolean;\n }>;\n}\n\nexport interface CustomViewsCallbacks {\n itemSelection: void;\n extCatalog: void;\n}\n\n// Idea is inspired by: https://roomle.slack.com/archives/GQD67DDC5/p1730291049755199\n// or: https://www.learningtypescript.com/articles/narrowing-function-parameters-with-rests-and-tuples\n// or: https://www.typescriptlang.org/play/?#code/C4TwDgpgBAogbhAdsAsgQzFAvFA3gKCigHtJEAuKRAVwFsAjCAJwG5CoBjAG2IGcJKvYEwCWiAOZsAvm3wB6OVFCRYCZAElEAM2LYoAbQDkpJIYA0VOoyYBdKAB8Dh7nwjmoQ0RJttl0eEjAmjp6BET6ANJQYlAA1hAgxFqqgehgNpT6EGrAiGi0AlARFtmBAIJM4ryUAchpkTY++FL68YnJtagYTex+UADCaFxc9GgcsXoAPOxEACpQEAAewEgAJrxxCUkpdRgWClCTALRQ82DEYsAbwLpomyAzUABKC8trG531s3YHx89Q50u110wAAFtA-OwAHwAClKyAAcvlCrMLKRgCJiIhqs8AJTYKFQOAXVb4fAcLFCKBoVarPQwmi0SiM6z4rCExlQADUllobAp2OAnCxHDQQpwMM8gmEYnEbMJnm5HmEsgFVNFw1G43pADo9fo8gU0WAMZSMjsgtpiLjKMSRHT2Xh2CJkgzkdgsDhjGRDPiwkRqbSYejMdjcSwoAdAKDkUAA7sQmLENoxRdR+EpwNBtgADEOU7PRDZiLTMJgQOkUphljjALgPAPCxCi4DBk2h3jhyOKQC8G4BSnagWjQIi4yYgqfTfRzeexBZERe0pfLwqrY9r9agUgWI+gLqgboKHq9Ln4vqdDbVxC4EB1PHErdN2J1NwAqmBIExBvwYbjO9G4wmkygFM0DTCFMxIZJczbfNC2iBcVwrBNqzXR4aVWe921-Ht+0HYdR3HMCVCnaCZ1g4tF0QlcazrdgpGaMkDhgRZ8jAK8oDTNBxAgckhhGMZYhhb1TAsABGAAGTsGykgM-wANSGe1KHE2C7hZZgeM1fjBJMRB3EMXhiAKAB9TxZV9CMuygPsoAAMSHEcgLHED02nDZQTQBAlF0RheWsaJki0EQmCpMA0CYZEViYWChN0jS+PGQTjzcCxDB0YhzOkmTFBjeSuEUqBUuIdKVOVLxxDirUBOcHgT1EgAmSTMqyqz+zsvDHIIkgSLcjyIW86BTIkfyByCkKwoi5hoqSwx8CAA\nexport type CustomViewCallbackInfo = {\n [K in keyof CustomViewsCallbacks]: [\n viewName: K,\n viewArgs: CustomViewsCallbacks[K],\n ];\n}[keyof CustomViewsCallbacks];\n\nexport type PossibleCustomViewSettings = CustomViews[keyof CustomViews];\n\nexport type PossibleCustomViews = keyof CustomViews;\nexport type PossibleCustomViewsAndMain = PossibleCustomViews | 'main';\n\nexport type SidebarEventCallbackInfo = {\n [K in keyof SidebarEventTypes]: SidebarEventTypes[K] extends void\n ? [viewName: K] | [viewName: K, viewArgs: void]\n : [viewName: K, viewArgs: SidebarEventTypes[K]];\n}[keyof SidebarEventTypes];\n","import { getHostname, isDemoHostname } from '#/common/src/utils/domain';\nimport { isIdAnItem } from '#/common/src/utils/id-inferrer';\n\nimport { getLanguage } from '#/common/src/utils/browser';\n\nimport { deepMergeCopy } from '#/common/src/utils/merge';\nimport { HANDSHAKE_MESSAGES } from '#/common/src/utils/embedding';\n\nimport {\n UI_ELEMENTS,\n type ConfiguratorSettings,\n type PossibleCustomViews,\n type PossibleCustomViewSettings,\n type UiInitData,\n} from '@/configurator/embedding/types';\nimport type { MessageHandler } from '#/common/src/utils/message-handler';\nimport type RapiAccess from '@roomle/web-sdk/common-core/src/rapi-access';\nimport type { Nullable } from '@/common/utils/types';\nimport type { RoomleSdkWrapper } from '@/configurator/business-logic/roomle-sdk-wrapper';\nimport { deepCopy } from '#/common/src/utils/json';\n\nexport const cleanUpInitData = (\n key: keyof UiInitData,\n initData: UiInitData,\n) => {\n if (Array.isArray(initData[key]) && initData[key].length === 0) {\n delete initData[key];\n }\n};\n\nexport const FALLBACK_INIT_DATA: UiInitData = {\n mobileLandscape: true,\n floorMaterialRootTag: 'materials_root',\n buttons: {\n renderimage: true,\n requestproduct: true,\n requestplan: true,\n load_product: true,\n partlist_print: true,\n },\n elements: {\n [UI_ELEMENTS.INTERACTION_NOTES]: true,\n },\n helpcenter: {\n roomdesigner: true,\n configurator: false,\n disable: false,\n },\n firstPersonView: true,\n saveToIdb: true,\n featureFlags: {\n mocAr: true,\n wallAutoHeight: false,\n openCloseAnimation: true,\n enableTwoLevelCatalog: false,\n webGpu: false,\n },\n rotationSnapDegrees: 10,\n interactionsCollapsed: false,\n};\n\nexport const CONFIGURATOR_IDLE = '(idle)';\n\n// not supporting IE11: https://caniuse.com/#feat=urlsearchparams\nexport const getInitData = (useFallbackId = true): UiInitData => {\n const urlParams = new URLSearchParams(window.location.search);\n // cast to any because it comes from URL params after this method initData\n // has the correct shape (types, names etc)\n // !!! WARNING THIS FETCHES THE PARAMETERS FROM THE QUERY STRING !!!\n // !!! THE QUERY STRINGS HAVE THE HIGHEST PRIO, IF YOU SET A FALLBACK !!!\n // !!! VALUE HERE IT WILL OVERRIDE ALL THE OTHER INIT DATA !!!\n\n // !!! SET DEFAULT VALUES INSIDE getFallbackInitData() !!!\n let initData: any = {};\n\n urlParams.forEach((value, key) => setProperty(initData, key, value));\n castInitData(initData);\n if (!useFallbackId) {\n return initData as UiInitData;\n }\n if (!initData.id) {\n initData.id = 'usm:frame';\n }\n if (initData.isItem === undefined) {\n initData.isItem = isIdAnItem(initData.id);\n }\n\n initData = mergeStringArrays(initData);\n\n return initData as UiInitData;\n};\n\nexport const castAndFixInitData = (initData: UiInitData): UiInitData => {\n castInitData(initData);\n if (initData?.customApiUrl) {\n initData.customApiUrl = decodeURIComponent(initData.customApiUrl);\n }\n\n if (initData.shareUrl) {\n initData.deeplink = initData.shareUrl.replace(\n LEGACY_SHARE_PLACEHOLDER,\n SHARE_PLACEHOLDER,\n );\n }\n return initData;\n};\n\nexport const mergeStringArrays = (initData: any): any => {\n const mergedInitData: { [key: string]: any } = {};\n\n try {\n for (const key in initData) {\n const [parsedKey, indexStr] = key.split('[');\n if (indexStr && indexStr.endsWith(']')) {\n const index = parseInt(indexStr.substring(0, indexStr.length - 1), 10);\n mergedInitData[parsedKey] = mergedInitData[parsedKey] || [];\n mergedInitData[parsedKey][index] = initData[key];\n } else {\n mergedInitData[key] = initData[key];\n }\n }\n } catch (e) {\n console.error('Failed to merge initData keys ', e);\n return initData;\n }\n\n return mergedInitData;\n};\n\nexport const castInitData = (obj: Nullable<{ [key: string]: any }>): void => {\n if (!obj) {\n return;\n }\n const keys = Object.keys(obj);\n for (const key of keys) {\n const value = obj[key];\n // need to type-check for null because typeof null evaluates to object\n // see here why this is like it is: https://2ality.com/2013/10/typeof-null.html\n if (!Array.isArray(value) && typeof value === 'object' && value !== null) {\n castInitData(value);\n }\n if (Array.isArray(value)) {\n for (const entry of value) {\n castInitData(entry);\n }\n }\n\n if (value === 'true' || value === 'false') {\n obj[key] = value === 'true';\n }\n }\n};\n\nexport const mergeInitData = (\n configuratorSettings:\n | ConfiguratorSettings\n | { id: string; settings: UiInitData },\n currentInitData: UiInitData,\n): UiInitData => {\n currentInitData.configuratorId = configuratorSettings.id;\n const remoteInitData = configuratorSettings.settings || {};\n // This is a performance optimization so we do not need to fetch\n // configurator settings twice\n if (\n !currentInitData.overrideTenant &&\n (configuratorSettings as ConfiguratorSettings).tenant\n ) {\n // use as any because we send tenant id as string but SDK requires to send a number\n // casting to number could become a problem when we change tenant IDs to something\n // random instead of a integer which is incremented\n (currentInitData as any).overrideTenant = (\n configuratorSettings as ConfiguratorSettings\n ).tenant;\n }\n return deepMergeCopy(remoteInitData, currentInitData);\n};\n\nexport const getEmbeddingInitData = async (\n messageHandler: MessageHandler,\n): Promise<UiInitData> => {\n const initData = await messageHandler.sendMessage(\n HANDSHAKE_MESSAGES.REQUEST_BOOT,\n );\n if (initData.id && initData.isItem === undefined) {\n initData.isItem = isIdAnItem(initData.id);\n }\n // @schobi check where we can set global-init-data so that it's also available for getConfiguratorSettings\n // sdkWrapper.setGlobalInitData(initData);\n // This code sets tenant correctly also for old embedding.js lib versions\n // if (!initData.overrideTenant && initData.configuratorId) {\n // const {tenant} = await rapiAccess.getConfiguratorSettings(initData.configuratorId) as ConfiguratorSettings;\n // if (tenant) {\n // initData.overrideTenant = tenant;\n // }\n // }\n return castAndFixInitData(initData);\n};\n\nexport const getRemoteInitData = async (\n rapiAccess: RapiAccess,\n): Promise<UiInitData> => {\n const {\n id,\n tenant,\n settings = {},\n } = (await rapiAccess.getConfiguratorSettings()) as ConfiguratorSettings;\n const remoteInitData = settings as UiInitData;\n remoteInitData.configuratorId = id;\n if (!remoteInitData.overrideTenant && tenant) {\n // use as any because we send tenant id as string but SDK requiers to send a number\n // casting to number could become a problem when we change tenant IDs to something\n // random instead of a integer which is incremented\n remoteInitData.overrideTenant = tenant;\n }\n return castAndFixInitData(remoteInitData);\n};\n\nexport const getFallbackInitData = () => {\n const fallbackInitData = deepCopy(FALLBACK_INIT_DATA);\n if (!fallbackInitData.locale) {\n fallbackInitData.locale = getLanguage();\n }\n if (fallbackInitData.id === CONFIGURATOR_IDLE) {\n delete fallbackInitData.id;\n }\n\n const hostname = getHostname();\n if (hostname && isDemoHostname(hostname)) {\n fallbackInitData.configuratorId = 'demoConfigurator';\n }\n\n fallbackInitData.customApiUrl = import.meta.env.VITE_RAPI_URL as string;\n fallbackInitData.emails = false;\n return fallbackInitData as UiInitData;\n};\n\nexport const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';\nexport const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';\n\n/**\n * combines init data in this order: query params > embedding > remote > fallback\n *\n * some exceptions to consider:\n * - tenant: when do we need the tenant and where do we get it from?\n *\n * @param messageHandler\n * @param sdkWrapper\n * @param queryParamsInitData\n */\nexport const combineInitData = async (\n messageHandler: Nullable<MessageHandler>,\n sdkWrapper: RoomleSdkWrapper,\n queryParamsInitData: UiInitData,\n): Promise<UiInitData> => {\n castAndFixInitData(queryParamsInitData);\n const fallbackInitData = getFallbackInitData();\n\n let embeddingInitData: Nullable<UiInitData> = null;\n if (messageHandler) {\n try {\n embeddingInitData = await getEmbeddingInitData(messageHandler);\n } catch (e) {\n console.error(e);\n }\n }\n\n sdkWrapper.setGlobalInitData(\n deepMergeCopy(\n deepMergeCopy(fallbackInitData, embeddingInitData),\n queryParamsInitData,\n ),\n );\n const rapiAccess = await sdkWrapper.getRapiAccess();\n\n const configuratorId =\n queryParamsInitData.configuratorId ||\n embeddingInitData?.configuratorId ||\n fallbackInitData.configuratorId;\n if (!configuratorId) {\n throw new Error(\n 'Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person',\n );\n }\n let remoteInitData: UiInitData = {};\n try {\n remoteInitData = await getRemoteInitData(rapiAccess);\n } catch (e) {\n console.error(e);\n }\n\n const finalInitData: UiInitData = deepMergeCopy(\n deepMergeCopy(\n deepMergeCopy(fallbackInitData, remoteInitData),\n embeddingInitData,\n ),\n queryParamsInitData,\n );\n\n for (const key of [\n 'catalogRootTag',\n 'constructionRootTag',\n 'materialRootTag',\n 'floorMaterialRootTag',\n 'wallMaterialRootTag',\n 'doorMaterialRootTag',\n 'windowMaterialRootTag',\n 'objectMaterialRootTag',\n ] as const) {\n cleanUpInitData(key, finalInitData);\n }\n if (!finalInitData.constructionRootTag && finalInitData.moc) {\n finalInitData.constructionRootTag =\n import.meta.env.VITE_DEFAULT_CONSTRUCTION_ROOT_TAG;\n }\n\n if (!finalInitData.wallMaterialRootTag && finalInitData.moc) {\n finalInitData.wallMaterialRootTag =\n import.meta.env.VITE_DEFAULT_WALL_MATERIALS_ROOT_TAG;\n }\n if (finalInitData.materialRootTag) {\n if (!finalInitData.floorMaterialRootTag) {\n finalInitData.floorMaterialRootTag = finalInitData.materialRootTag;\n }\n if (!finalInitData.wallMaterialRootTag) {\n finalInitData.wallMaterialRootTag = finalInitData.materialRootTag;\n }\n if (!finalInitData.doorMaterialRootTag) {\n finalInitData.doorMaterialRootTag = finalInitData.materialRootTag;\n }\n if (!finalInitData.windowMaterialRootTag) {\n finalInitData.windowMaterialRootTag = finalInitData.materialRootTag;\n }\n if (!finalInitData.objectMaterialRootTag) {\n finalInitData.objectMaterialRootTag = finalInitData.materialRootTag;\n }\n }\n\n if (finalInitData.thumbnails) {\n if (typeof finalInitData.thumbnails === 'string') {\n finalInitData.thumbnails = {\n collapsed: {\n desktop: finalInitData.thumbnails,\n mobile: finalInitData.thumbnails,\n },\n expanded: {\n desktop: finalInitData.thumbnails,\n mobile: finalInitData.thumbnails,\n },\n };\n }\n if (\n typeof finalInitData.thumbnails.collapsed === 'string' &&\n typeof finalInitData.thumbnails.expanded === 'string'\n ) {\n finalInitData.thumbnails = {\n collapsed: {\n desktop: finalInitData.thumbnails.collapsed,\n mobile: finalInitData.thumbnails.collapsed,\n },\n expanded: {\n desktop: finalInitData.thumbnails.expanded,\n mobile: finalInitData.thumbnails.expanded,\n },\n };\n }\n }\n\n if (finalInitData.extCatalog) {\n if (!finalInitData.customView) {\n finalInitData.customView = {};\n }\n finalInitData.customView.extCatalog = { url: finalInitData.extCatalog };\n }\n sdkWrapper.setGlobalInitData(finalInitData);\n return finalInitData;\n};\n\nexport const setProperty = (\n o: { [key: string]: any },\n path: string,\n value: any,\n) => {\n if (typeof o !== 'object') {\n return;\n }\n const parts = path.split('.');\n const last = parts.pop() as string;\n let actualObject = o;\n for (const p of parts) {\n if (!actualObject[p]) {\n actualObject[p] = {};\n }\n actualObject = actualObject[p];\n }\n if (last.endsWith('[]')) {\n if (value === undefined || value === '') {\n return;\n }\n const key = last.slice(0, -2);\n if (!actualObject[key]) {\n actualObject[key] = [];\n }\n actualObject[key].push(value);\n } else {\n actualObject[last] = value;\n }\n};\n\nexport const isCustomViewSettingsForIframe = (\n customViewSetting: PossibleCustomViewSettings,\n) => {\n return (\n customViewSetting &&\n 'url' in customViewSetting &&\n typeof customViewSetting.url === 'string'\n );\n};\n\nexport const hasCustomViewAsIframe = (initData: UiInitData): boolean => {\n if (\n !initData ||\n !initData.customView ||\n typeof initData.customView !== 'object'\n ) {\n return false;\n }\n\n const keys = Object.keys(initData.customView) as PossibleCustomViews[];\n for (const key of keys) {\n if (isCustomViewSettingsForIframe(initData.customView[key])) {\n return true;\n }\n }\n return false;\n};\n\nexport const setFeatureFlagsDefaults = (fallbackInitData: UiInitData) => {\n if (!fallbackInitData.featureFlags) {\n fallbackInitData.featureFlags = {};\n }\n if (typeof fallbackInitData.featureFlags.realPartList !== 'boolean') {\n fallbackInitData.featureFlags.realPartList = true;\n }\n if (typeof fallbackInitData.featureFlags.globalCallbacks !== 'boolean') {\n fallbackInitData.featureFlags.globalCallbacks = true;\n }\n if (typeof fallbackInitData.featureFlags.mocAr !== 'boolean') {\n fallbackInitData.featureFlags.mocAr = false;\n }\n};\n","import { MessageHandler } from '#/common/src/utils/message-handler';\nimport * as Comlink from 'comlink';\n\nimport {\n getConfiguratorSettings,\n HANDSHAKE_MESSAGES,\n WELL_KNOWN_MESSAGES,\n} from '#/common/src/utils/embedding';\n\nimport {\n castAndFixInitData,\n getFallbackInitData,\n mergeInitData,\n setFeatureFlagsDefaults,\n} from '#/common/src/utils/init-data';\n\nimport { isAndroid } from '@/common/utils/user-agent';\n\nimport { deepMerge } from '#/common/src/utils/merge';\n\n// Type only imports\n\nimport type {\n CustomViewCommunicationSide,\n EmbeddingCommand,\n} from '#/common/src/utils/message-handler';\nimport type {\n ConfiguratorSettings,\n PossibleCustomViews,\n UiInitData,\n} from '@/configurator/embedding/types';\nimport type { Nullable } from '@/common/utils/types';\nimport type ConfiguratorUiCallbacks from '@roomle/web-sdk/configurator-core/src/services/configurator-ui-callback';\nimport type RoomleConfigurator from '@roomle/web-sdk/configurator-core/src/roomle-configurator';\nimport type RoomleGLBViewer from '@roomle/web-sdk/glb-viewer-core/src/roomle-glb-viewer';\nimport type RoomlePlanner from '@roomle/web-sdk/planner-core/src/roomle-planner';\nimport type { DragIn } from '#/embedding-lib/src/plugins/drag-in';\nimport { Connector } from '#/embedding-lib/src/connector';\nimport { promiseWithResolvers } from '#/common/src/utils/promise';\nimport {\n MasterData,\n PosGroup,\n PosSaveData,\n} from '@roomle/web-sdk/homag-intelligence/src/model/oc-scripts-domain.model';\n\nconst setDefaultBehaviour = <T>(\n object: T,\n callbackName: keyof T,\n defaultBehaviour: () => void,\n) => {\n let customBehaviour: Nullable<() => void> = null;\n Object.defineProperty(object, callbackName, {\n get() {\n return customBehaviour || defaultBehaviour;\n },\n set(data: any) {\n if (!data?.mute) {\n console.warn(\n 'You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties',\n );\n console.warn('{ mute: true, value: () => void }');\n customBehaviour = data;\n } else {\n customBehaviour = data.value;\n }\n },\n });\n};\n\nconst calcVh = () => window.innerHeight * 0.01 + 'px'; // needed because of URL bar in android, inspired by: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/\nconst setCustomProp = (element: HTMLElement) => {\n if (!element) {\n return;\n }\n // Needed to wait for the next run loop otherwise data is wrong\n setTimeout(\n () => element.style.setProperty(RML_CUSTOM_PROPERTY_HEIGHT, calcVh()),\n 0,\n );\n};\n\nconst RML_STYLES_ID = 'rml-styles';\nconst RML_ANIMATION_DELAY = 450;\nconst RML_CUSTOM_PROPERTY_HEIGHT = '--rml-full-height';\n\nconst RML_CSS_CLASSES = {\n CONTAINER: 'rml-container',\n FILL: 'rml-fill',\n POSITION: 'rml-pos',\n TRANSITION: 'rml-transition',\n ANDROID_HEIGHT: 'rml-android-height',\n OVERFLOW_HIDDEN: 'rml-overflow-hidden',\n};\n\nconst globalSetupDone = new Map<HTMLElement, boolean>();\ninterface PluginMap {\n dragIn: typeof DragIn;\n}\n\nconst createGracefulProxy = <T extends object>(target: Partial<T>): T => {\n /**\n * The handler for the Proxy, containing the traps.\n */\n const handler: ProxyHandler<Partial<T>> = {\n /**\n * The 'get' trap is fired when a property is accessed on the proxy.\n * @param target The original object.\n * @param prop The name of the property being accessed.\n * @param receiver The proxy or an object that inherits from it.\n */\n get(target, prop, receiver) {\n // Use Reflect.get to retrieve the property value.\n // This correctly handles the `this` context and works for getters.\n // If the property doesn't exist, Reflect.get returns undefined.\n const value = Reflect.get(target, prop, receiver);\n\n // If the value is not undefined, the property exists on the target.\n // We return it directly. This works for implemented methods, regular\n // properties (strings, numbers, etc.), and properties set to `null`.\n if (value !== undefined) {\n return value;\n }\n\n // If the property is not found (value is undefined), we return a\n // no-op function and log a warning. This prevents runtime errors\n // when trying to invoke a missing method.\n console.warn(\n `[Homag Intelligence Callbacks] Method '${String(\n prop,\n )}' is not implemented. Executing a no-op.`,\n );\n\n // Return a function that does nothing and returns undefined.\n // @ts-ignore\n return (...args: any[]) => undefined;\n },\n };\n\n // Create and return the new Proxy. We cast it to T as an assertion\n // to the TypeScript compiler that our proxy will safely fulfill the\n // contract of the full interface T at runtime.\n return new Proxy(target, handler) as T;\n};\n\nexport const HI_PANEL_ACTION = {\n HIDE: 'hide',\n SHOW_ATTRIBUTES: 'attributes',\n SHOW_ARTICLES: 'articles',\n} as const;\nexport type HiPanelActionType =\n (typeof HI_PANEL_ACTION)[keyof typeof HI_PANEL_ACTION];\n\nexport interface HiCallbacks {\n /**\n * Requests the calculation script for the given library ID.\n * @param libraryId the ID of the library for which the calculation script is requested\n * @returns the calculation script as a string\n */\n onLoadJavascript: (libraryId: string) => Promise<string>;\n\n /**\n * Requests the master data for the given library ID.\n * @param libraryId the ID of the library for which the master data is requested\n * @returns the master data as a Promise\n */\n onLoadMasterData: (libraryId: string) => Promise<MasterData>;\n\n /**\n * Requests the article catalog for the given library ID.\n * @param libraryId the ID of the library for which the article catalog is requested\n * @returns the article catalog as a Promise\n */\n onLoadArticleCatalog: (libraryId: string) => Promise<any>;\n\n /**\n * Notifies the host application that a price calculation should be performed.\n * @param posGroups all groups in the plan\n */\n onPriceCalc?: (posGroups: PosGroup[]) => Promise<void>;\n\n /**\n * Retrieves the current external load data which has to be used to replace the existing groups in the plan.\n * @returns load data or null if no replacement is needed\n */\n onGetSavedPosGroupData?: () => Promise<PosSaveData | null>;\n\n /**\n * \"onCompletelyLoaded\" is invoked when the groups in the plan are completely loaded.\n */\n onPosGroupsCompletelyLoaded?: () => void;\n\n /**\n * \"onPosGroupAdded\" is invoked when a new group was created. (e.g. duplicate object)\n * @param groupData The new group data JSON.\n */\n onPosGroupAdded?: (posGroups: PosGroup[]) => Promise<void>;\n\n /**\n * \"onPosGroupChanged\" is invoked when a new group was modified and recalculated. (e.g. split, merge, change, attribute)\n *\n * @param groupData The new group data JSON.\n */\n onPosGroupChanged?: (posGroups: PosGroup[]) => Promise<void>;\n\n /**\n * \"onPosGroupDeleted\" is invoked when a group was delete. (e.g. delete button in scene)\n * @param groupData The ID of the group which was deleted.\n */\n onPosGroupDeleted?: (posGroupIds: string[]) => Promise<void>;\n\n /**\n * \"onShowHidePanel\" is invoked when a the content of the side panel should be changed or hidden.\n * @param panel The panel to show or hide.\n * @param posGroupId Optional ID of the selected group in case of SHOW_ATTRIBUTES.\n * @param rootModuleId Optional ID of the selected root module in case of SHOW_ATTRIBUTES.\n * @param subModuleId Optional ID of the selected sub module in case of SHOW_ATTRIBUTES.\n */\n onShowHidePanel?: (\n panel: HiPanelActionType,\n posGroupId?: string,\n rootModuleId?: string,\n subModuleId?: string,\n ) => void;\n\n /**\n * \"onSelectModule\" is invoked when a the selected object in the scene was changed.\n * @param posGroupId ID of the selected group\n * @param rootModuleId ID of the selected root module\n * @param subModuleId Optional id of the selected sub module\n */\n onSelectModule?: (\n posGroupId: string,\n rootModuleId: string,\n subModuleId?: string,\n ) => void;\n\n /**\n * Request the price for the given order data.\n * @param orderData order data\n * @returns price data\n */\n onFetchPrice?: (orderData: any) => Promise<any>;\n\n /**\n * \"onPlaceOrder\" is invoked when the user wants to place an order.\n * You can use this to send the order data to Order Manager or to a 3rd party service.\n * @param orderData\n */\n onPlaceOrder?: (orderData: any) => Promise<void>;\n\n /**\n * \"onLogMessage\" is invoked when the Homag Intelligence library wants to log a message.\n * You can use this to log messages in your own UI.\n * @param area\n * @param message\n */\n onLogMessage?: (area: string, message: string) => void;\n}\n\nexport type AvailablePlugins = {\n [K in keyof PluginMap]?: InstanceType<PluginMap[K]>; // Use InstanceType to get instance types\n};\n\nexport type PluginConstructors = {\n [K in keyof PluginMap]: PluginMap[K];\n};\n\nexport type PluginDefinitions = Array<\n | keyof AvailablePlugins\n | {\n name: keyof AvailablePlugins;\n loader: () => Promise<PluginConstructors[keyof PluginConstructors]>;\n }\n>;\n\nexport type RoomleConfiguratorApi = RoomleEmbeddingApi<\n RoomleConfigurator,\n ConfiguratorUiCallbacks\n>;\nexport type RoomleViewerApi = RoomleEmbeddingApi<\n RoomleGLBViewer,\n ConfiguratorUiCallbacks\n>;\nexport type RoomlePlannerApi = RoomleEmbeddingApi<\n RoomlePlanner,\n ConfiguratorUiCallbacks\n>;\n\nexport default class RoomleEmbeddingApi<\n SdkType,\n SdkCallbacks,\n> extends Connector<SdkType, SdkCallbacks> {\n public static createPlanner(\n configuratorId: string,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions = [],\n ): Promise<RoomlePlannerApi> {\n return this._create<RoomlePlanner, ConfiguratorUiCallbacks>(\n configuratorId,\n container,\n initData,\n plugins,\n );\n }\n\n public static async connect(\n customView: PossibleCustomViews,\n plugins: PluginDefinitions = [],\n ) {\n const instance = new Connector<\n RoomleConfigurator,\n ConfiguratorUiCallbacks\n >();\n instance.viewName = customView;\n const { resolve: resolveRegister, promise: promiseRegister } =\n promiseWithResolvers<void>();\n const { resolve: resolveSetup, promise: promiseSetup } =\n promiseWithResolvers<void>();\n\n const handleMessage = ({\n message,\n args,\n }: {\n message: string;\n args: any[];\n }) => {\n switch (message) {\n case WELL_KNOWN_MESSAGES.REGISTER_CUSTOM_VIEW_DONE:\n resolveRegister();\n break;\n case WELL_KNOWN_MESSAGES.RETURN_METHODS:\n instance.handleSetup(args[0]);\n resolveSetup();\n break;\n default:\n if (instance.isSetupDone) {\n return instance.executeMessage({ message, args });\n }\n }\n };\n const messageHandler = new MessageHandler(\n ('custom-view-' + customView) as CustomViewCommunicationSide,\n window,\n window.parent,\n handleMessage,\n );\n\n instance.setMessageHandler(messageHandler);\n const customViewName = [customView];\n messageHandler.sendMessage(\n WELL_KNOWN_MESSAGES.REGISTER_CUSTOM_VIEW,\n customViewName,\n );\n await promiseRegister;\n messageHandler.sendMessage(WELL_KNOWN_MESSAGES.GET_METHODS, customViewName);\n await promiseSetup;\n instance.setupPlugins(\n plugins,\n document.body as HTMLBodyElement,\n 'custom-view',\n );\n await Promise.allSettled(instance.pluginsLoaded);\n return instance;\n }\n\n /**\n * Method to create a new instance of a Roomle Configurator\n * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person\n * @param container DOM container in which the configurator should be placed\n * @param initData settings with which the configurator should be started\n */\n public static createConfigurator(\n configuratorId: string,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions = [],\n ): Promise<RoomleConfiguratorApi> {\n return this._create<RoomleConfigurator, ConfiguratorUiCallbacks>(\n configuratorId,\n container,\n initData,\n plugins,\n );\n }\n\n /**\n * Method to create a new instance of a Roomle Configurator\n * @deprecated please use \"createConfigurator\"\n * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person\n * @param container DOM container in which the configurator should be placed\n * @param initData settings with which the configurator should be started\n */\n public static create(\n configuratorId: string,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions,\n ): Promise<RoomleConfiguratorApi> {\n return this._create<RoomleConfigurator, ConfiguratorUiCallbacks>(\n configuratorId,\n container,\n initData,\n plugins,\n );\n }\n\n /**\n * Method to create a new instance of a Roomle Viewer\n * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person\n * @param container DOM container in which the configurator should be placed\n * @param initData settings with which the configurator should be started\n */\n public static createViewer(\n configuratorId: string,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions = [],\n ): Promise<RoomleViewerApi> {\n return this._create<RoomleGLBViewer, ConfiguratorUiCallbacks>(\n configuratorId,\n container,\n initData,\n plugins,\n );\n }\n\n private static hiMessageHandler: ((event: MessageEvent) => void) | null =\n null;\n\n public static setupHi(callbacks: HiCallbacks) {\n if (this.hiMessageHandler) {\n window.removeEventListener('message', this.hiMessageHandler);\n }\n this.hiMessageHandler = (event: MessageEvent) => {\n if (event.data.type === 'connect_hi' && event.data.port) {\n const port = event.data.port;\n port.start?.();\n Comlink.expose(createGracefulProxy<HiCallbacks>(callbacks), port);\n }\n };\n window.addEventListener('message', this.hiMessageHandler);\n }\n\n private static async _create<SdkType, SdkCallbacks>(\n configuratorId: string,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions,\n ): Promise<RoomleEmbeddingApi<SdkType, SdkCallbacks>> {\n return new Promise(async (resolve, reject) => {\n try {\n const fallbackInitData = deepMerge(\n getFallbackInitData(),\n castAndFixInitData(initData),\n ) as UiInitData;\n setFeatureFlagsDefaults(fallbackInitData);\n const configuratorSettings = await getConfiguratorSettings(\n configuratorId,\n fallbackInitData,\n );\n initData = mergeInitData(configuratorSettings, fallbackInitData);\n const instance = new this<SdkType, SdkCallbacks>(\n configuratorSettings,\n container,\n initData,\n plugins,\n resolve,\n );\n await Promise.allSettled(instance.pluginsLoaded);\n return instance;\n } catch (e) {\n return reject(e);\n }\n });\n }\n\n private _waitForIframe: (\n instance: RoomleEmbeddingApi<SdkType, SdkCallbacks>,\n ) => void;\n private _container: HTMLElement;\n private _configuratorSettings: ConfiguratorSettings;\n private _initData: UiInitData = {};\n private _iframe: HTMLIFrameElement;\n\n private constructor(\n settings: ConfiguratorSettings,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions,\n waitForIframe: (\n instance: RoomleEmbeddingApi<SdkType, SdkCallbacks>,\n ) => void,\n ) {\n super();\n if (!settings || typeof settings.id !== 'string') {\n throw new Error(\n 'Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person',\n );\n }\n if (globalSetupDone.has(container)) {\n throw new Error('There is already an instance on this DOM element');\n }\n const stylesAlreadyAdded = !!document.getElementById(RML_STYLES_ID);\n if (!stylesAlreadyAdded) {\n const zIndex = initData.zIndex || 9999999;\n const styles = document.createElement('style');\n styles.type = 'text/css';\n styles.id = RML_STYLES_ID;\n const cssTransition =\n 'transition:all ease-in-out ' + RML_ANIMATION_DELAY + 'ms;';\n const cssTransitionForAllBrowsers =\n ['-webkit-', '-o-'].reduce(\n (acc, browser) => (acc += browser + cssTransition),\n '',\n ) + cssTransition;\n const vh = calcVh();\n\n styles.innerHTML = `\n .${RML_CSS_CLASSES.CONTAINER}{${RML_CUSTOM_PROPERTY_HEIGHT}:${vh};}\n .${RML_CSS_CLASSES.POSITION}{position:fixed;top:0;left:0;z-index:${zIndex};opacity:0}\n .${RML_CSS_CLASSES.TRANSITION}{${cssTransitionForAllBrowsers}}\n .${RML_CSS_CLASSES.FILL}{width:100%;height:100%;opacity:1}\n .${RML_CSS_CLASSES.ANDROID_HEIGHT}{height:calc(var(${RML_CUSTOM_PROPERTY_HEIGHT},1vh)*100)}\n .${RML_CSS_CLASSES.OVERFLOW_HIDDEN}{overflow:hidden}\n `;\n document.head.appendChild(styles);\n }\n this._executeMessage = this._executeMessage.bind(this);\n const messageHandler = new MessageHandler(\n 'website',\n window,\n null,\n this._executeMessage,\n );\n this.setMessageHandler(messageHandler);\n this._onResize = this._onResize.bind(this);\n if (isAndroid()) {\n window.addEventListener('resize', this._onResize);\n }\n this._container = container;\n this._initData = initData;\n this._configuratorSettings = settings;\n const iframe = this._createIframe();\n this._onUseFullPage = this._onUseFullPage.bind(this);\n this._onBackToWebsite = this._onBackToWebsite.bind(this);\n this._waitForIframe = waitForIframe;\n this._container.appendChild(iframe);\n this._iframe = iframe;\n this.setupPlugins(plugins, this._iframe);\n globalSetupDone.set(container, true);\n }\n\n public teardown() {\n if (this._container) {\n globalSetupDone.delete(this._container);\n }\n const iframe = this._container.querySelector('iframe');\n if (iframe) {\n this._container.removeChild(iframe);\n }\n window.removeEventListener('resize', this._onResize);\n }\n\n private _createIframe() {\n const iframe = document.createElement('iframe');\n let url: string =\n this._configuratorSettings?.url || 'https://www.roomle.com/t/cp/';\n if (this._initData.useLocalRoomle) {\n url = location.href.replace('embedding.html', '');\n }\n if (location.href.includes('roomle.gitlab.io')) {\n url = location.href.replace('embedding.html', 'index.html');\n }\n\n if ((this._initData as any).overrideServerUrl) {\n url = (this._initData as any).overrideServerUrl;\n }\n\n iframe.src = url;\n iframe.classList.add(RML_CSS_CLASSES.CONTAINER);\n iframe.classList.add(RML_CSS_CLASSES.FILL);\n\n return iframe;\n }\n\n private _onResize(): void {\n setCustomProp(this._iframe);\n }\n\n private _onUseFullPage(): void {\n this._iframe.classList.add(RML_CSS_CLASSES.POSITION);\n document.documentElement.classList.add(RML_CSS_CLASSES.OVERFLOW_HIDDEN);\n window.document.body.classList.add(RML_CSS_CLASSES.OVERFLOW_HIDDEN);\n if (isAndroid()) {\n setCustomProp(this._iframe);\n this._iframe.classList.add(RML_CSS_CLASSES.ANDROID_HEIGHT);\n }\n }\n\n private _onBackToWebsite(): void {\n this._iframe.classList.remove(RML_CSS_CLASSES.POSITION);\n this._iframe.classList.remove(RML_CSS_CLASSES.ANDROID_HEIGHT);\n document.documentElement.classList.remove(RML_CSS_CLASSES.OVERFLOW_HIDDEN);\n window.document.body.classList.remove(RML_CSS_CLASSES.OVERFLOW_HIDDEN);\n }\n\n private _executeMessage(\n { message, args }: EmbeddingCommand,\n event: MessageEvent,\n ) /*: MessageExecutionResult */ {\n if (!event.source) {\n // @ts-ignore -- vite refactor\n return; // no source? just wait ;-)\n }\n if (event.source !== this._iframe?.contentWindow) {\n // @ts-ignore -- vite refactor\n return; // need to wait since response is not for the current iframe;\n }\n\n if (message === HANDSHAKE_MESSAGES.REQUEST_BOOT) {\n if (!this._messageHandler) {\n console.error('MessageHandler not set');\n return Promise.resolve({ error: 'MessageHandler not set' });\n }\n this._messageHandler.setOutgoingMessageBus(event.source);\n return Promise.resolve({ result: this._initData });\n }\n if (message === HANDSHAKE_MESSAGES.SETUP) {\n this.handleSetup(args[0]);\n setDefaultBehaviour(\n this.ui.callbacks,\n 'onUseFullPage',\n this._onUseFullPage,\n );\n setDefaultBehaviour(\n this.ui.callbacks,\n 'onBackToWebsite',\n this._onBackToWebsite,\n );\n\n this._waitForIframe(this);\n setTimeout(() => {\n if (!this._messageHandler) {\n console.error('MessageHandler not set');\n return;\n }\n this._messageHandler.sendMessage(HANDSHAKE_MESSAGES.WEBSITE_READY);\n }, 0); // Run it after the promise is resolved so everyone can subscribe\n return Promise.resolve({ result: null });\n }\n return this.executeMessage({ message, args });\n }\n}\n","import type { HiPanelActionType } from '../../../../embedding-lib/src/embedding-lib';\nimport {\n HI_PANEL_ACTION,\n type HiCallbacks,\n} from '../../../../embedding-lib/src/embedding-lib';\nimport { BASE_CONTEXT } from '../../common-core/src/main';\nimport type PlanElementViewModel from '../../common-core/src/view-model/plan-element-view-model';\nimport type { SELECTION_MODE } from '../../configurator-core/src/utils/selection-handler';\nimport type { SelectionPayload } from '../../planner-core/src/roomle-planner-ui-callback';\nimport type { CallbackObjectType } from '../../planner-core/src/utils/planner-scene-utils';\nimport type { CancelSelectionReasons } from '../../typings/planner';\n\nexport const HI_SELECTION_TYPE = {\n NONE: 'none',\n GROUP: 'group',\n ROOT_MODULE: 'rootModule',\n SUB_MODULE: 'subModule',\n} as const;\nexport type HiSelectionType =\n (typeof HI_SELECTION_TYPE)[keyof typeof HI_SELECTION_TYPE];\n\nexport const HI_SELECTION_MODE = {\n MULTI_SELECT: 'multiselect',\n TC_CONFIG: 'tc-config',\n RML_OBJECT: 'rml-object',\n} as const;\nexport type HiSelectionMode =\n (typeof HI_SELECTION_MODE)[keyof typeof HI_SELECTION_MODE];\n\ninterface HiSelection {\n type: HiSelectionType;\n groupId: string | null;\n rootModuleId: string | null;\n subModuleId: string | null;\n}\n\ninterface HiEmittedSelection {\n panel: HiPanelActionType | null;\n groupId: string | null;\n rootModuleId: string | null;\n subModuleId: string | null;\n}\n\nexport interface HiObjectSelectionApi {\n setSidebar(viewName: string): void;\n contextChanged(context: BASE_CONTEXT): void;\n groupOrModuleSelected(\n groupId: string,\n rootModuleId: string | null,\n subModuleId: string | null,\n ): void;\n componentSelectionCancel(reason: CancelSelectionReasons): void;\n selectionCancel(reason: CancelSelectionReasons): void;\n selectionChanged(\n selectionMode: SELECTION_MODE,\n objectType: CallbackObjectType,\n payload: SelectionPayload,\n _payloadPromise: Promise<SelectionPayload>,\n _planElementViewModel: PlanElementViewModel,\n ): void;\n}\n\nexport class HiObjectSelection implements HiObjectSelectionApi {\n private _callbacks: HiCallbacks | null = null;\n private _contextType: BASE_CONTEXT = BASE_CONTEXT.PLANNER;\n private _selectionMode: HiSelectionMode | null = null;\n private _hiSelection: HiSelection = {\n type: HI_SELECTION_TYPE.NONE,\n groupId: null,\n rootModuleId: null,\n subModuleId: null,\n };\n private _emittedSelection: HiEmittedSelection = {\n panel: null,\n groupId: null,\n rootModuleId: null,\n subModuleId: null,\n };\n\n constructor(callbacks: HiCallbacks | null) {\n this._callbacks = callbacks;\n }\n\n public setSidebar(viewName: string) {\n if (viewName === 'productSettings') {\n return;\n }\n if (viewName === 'catalog') {\n this._emitSelectionChange(HI_PANEL_ACTION.SHOW_ARTICLES);\n return;\n }\n this._emitSelectionChange(HI_PANEL_ACTION.HIDE);\n }\n\n public contextChanged(context: BASE_CONTEXT): void {\n this._contextType = context;\n if (context === BASE_CONTEXT.PLANNER) {\n this._resetSelection();\n }\n this._handleViewTypeChange();\n }\n\n public groupOrModuleSelected(\n groupId: string,\n rootModuleId: string | null,\n subModuleId: string | null,\n ) {\n this._selectionMode = HI_SELECTION_MODE.TC_CONFIG;\n this._hiSelection.groupId = groupId;\n this._hiSelection.rootModuleId = rootModuleId ?? null;\n this._hiSelection.subModuleId = subModuleId ?? null;\n if (this._hiSelection.rootModuleId && this._hiSelection.subModuleId) {\n this._hiSelection.type = HI_SELECTION_TYPE.SUB_MODULE;\n } else if (this._hiSelection.rootModuleId) {\n this._hiSelection.type = HI_SELECTION_TYPE.ROOT_MODULE;\n } else {\n this._hiSelection.type = HI_SELECTION_TYPE.GROUP;\n }\n this._handleViewTypeChange();\n }\n\n public componentSelectionCancel(reason: CancelSelectionReasons) {\n if (this._contextType !== BASE_CONTEXT.CONFIGURATOR) {\n return;\n }\n if (\n reason === 'click_outside' ||\n reason === 'isolation_mode_cancelled' ||\n reason === 'select_other'\n ) {\n return;\n }\n this._resetSelection();\n this._handleViewTypeChange();\n }\n\n public selectionCancel(reason: CancelSelectionReasons) {\n if (reason === 'select_other') {\n return;\n }\n this._resetSelection();\n this._handleViewTypeChange();\n }\n\n public selectionChanged(\n selectionMode: SELECTION_MODE,\n objectType: CallbackObjectType,\n payload: SelectionPayload,\n _payloadPromise: Promise<SelectionPayload>,\n _planElementViewModel: PlanElementViewModel,\n ) {\n this._selectionHandler(\n BASE_CONTEXT.PLANNER,\n selectionMode,\n objectType,\n payload,\n );\n }\n\n private _resetSelection() {\n this._selectionMode = null;\n }\n\n private _selectionHandler(\n initiatingContext: BASE_CONTEXT,\n mode: SELECTION_MODE,\n type: CallbackObjectType,\n payload: SelectionPayload,\n ): void {\n if (initiatingContext === BASE_CONTEXT.CONFIGURATOR) {\n return;\n }\n if (mode === HI_SELECTION_MODE.MULTI_SELECT) {\n this._selectionMode = mode;\n this._handleViewTypeChange();\n return;\n }\n if (\n type === 'external-configuration' &&\n payload.externalConfigurationType === HI_SELECTION_MODE.TC_CONFIG\n ) {\n this._selectionMode = HI_SELECTION_MODE.TC_CONFIG;\n } else {\n this._selectionMode = HI_SELECTION_MODE.RML_OBJECT;\n }\n this._handleViewTypeChange();\n }\n\n private _handleViewTypeChange() {\n let panelAction: HiPanelActionType = HI_PANEL_ACTION.SHOW_ARTICLES;\n if (\n this._selectionMode === HI_SELECTION_MODE.TC_CONFIG &&\n (this._contextType === BASE_CONTEXT.CONFIGURATOR ||\n this._hiSelection.type !== HI_SELECTION_TYPE.GROUP)\n ) {\n panelAction = HI_PANEL_ACTION.SHOW_ATTRIBUTES;\n }\n this._emitSelectionChange(panelAction);\n }\n\n private _emitSelectionChange(panelAction: HiPanelActionType) {\n if (this._emittedSelection.panel !== panelAction) {\n this._emittedSelection.panel = panelAction;\n const showAttributes = panelAction === HI_PANEL_ACTION.SHOW_ATTRIBUTES;\n this._emittedSelection.groupId = showAttributes\n ? this._hiSelection.groupId\n : null;\n this._emittedSelection.rootModuleId = showAttributes\n ? this._hiSelection.rootModuleId\n : null;\n this._emittedSelection.subModuleId = showAttributes\n ? this._hiSelection.subModuleId\n : null;\n this._callbacks?.onShowHidePanel(\n panelAction,\n this._emittedSelection.groupId,\n this._emittedSelection.rootModuleId,\n this._emittedSelection.subModuleId,\n );\n } else if (\n this._emittedSelection.panel === HI_PANEL_ACTION.SHOW_ATTRIBUTES &&\n (this._emittedSelection.groupId !== this._hiSelection.groupId ||\n this._emittedSelection.rootModuleId !==\n this._hiSelection.rootModuleId ||\n this._emittedSelection.subModuleId !== this._hiSelection.subModuleId)\n ) {\n this._emittedSelection.groupId = this._hiSelection.groupId ?? null;\n this._emittedSelection.rootModuleId =\n this._hiSelection.rootModuleId ?? null;\n this._emittedSelection.subModuleId =\n this._hiSelection.subModuleId ?? null;\n this._callbacks?.onSelectModule(\n this._emittedSelection.groupId,\n this._emittedSelection.rootModuleId,\n this._emittedSelection.subModuleId,\n );\n }\n }\n}\n","import type { HiCallbacks } from '../../../../embedding-lib/src/embedding-lib';\nimport type {\n ExternalModuleInformation,\n ExternalObjectGroup,\n ExternalObjectGroupPosition,\n ExternalObjectRootModule,\n ExternalObjectValidContainerModules,\n} from './external-object-api-callbacks';\nimport type {\n MasterData,\n PosModuleAttribute,\n PosContour,\n PosGroup,\n PosModuleData,\n PosModuleRootData,\n CheckDropDownEntry,\n CheckResult,\n PosSaveData,\n PosArticle,\n} from './model/oc-scripts-domain.model';\nimport {\n isExtObjId,\n removeExtObjIdPrefix,\n} from '../../common-core/src/utils/external-objects';\n\nimport {\n HiObjectSelection,\n type HiObjectSelectionApi,\n} from './hi-object-selection';\nimport { deepCopy } from '../../common-core/src/utils/common-utils';\nimport type {\n ExternalObjectSnapshotSaveResult,\n ExternalRoomInformation,\n LoadExternalObjectOptions,\n} from './external-object-api';\n\nexport interface LibraryIdAndLibraryData {\n libraryId?: string;\n libraryData?: LibraryData;\n}\n\nexport interface LibraryData {\n libraryId: string;\n get masterData(): MasterData | null;\n get posGroupVersion(): number;\n calculateGroup(posGroup: PosGroup): PosGroup;\n getOrderData(posGroup: PosGroup[], roomlePlannerId?: string): any;\n getAttributesDropDownValues(\n module: PosModuleData,\n attributeIds?: string | string[],\n ): Promise<Record<string, any[]>>;\n solveModuleAttributeConflict(\n module: PosModuleData,\n attributeName: string,\n value: string | number | boolean,\n ): PosModuleAttribute[] | undefined;\n getValidSubArticles(\n calculatedPosGroup: PosGroup,\n articles: PosArticle[],\n masterData: MasterData,\n ): PosArticle[];\n getValidContainerModulesForSubArticle(\n calculatedPosGroup: PosGroup,\n subArticle: PosArticle,\n masterData: MasterData,\n ): ExternalObjectValidContainerModules[];\n addSubArticle(\n targetPosGroup: PosGroup,\n article: PosArticle,\n rootId: string,\n parentModuleId: string,\n ): PosGroup;\n}\n\nexport interface RoomDesignerRequests {\n loadMasterData(masterData: MasterData): void;\n loadPosGroups(\n posDataJson: PosGroup | PosGroup[],\n options: LoadExternalObjectOptions,\n ): Promise<void>;\n selectGroup(groupId: string): Promise<void>;\n selectRoot(rootModuleId: string): Promise<void>;\n selectModule(rootModuleId: string, subModuleId: string): Promise<void>;\n openCloseGroup(\n groupOrRootModuleId: string,\n subModuleId: string | null,\n open: boolean,\n animate: boolean,\n ): void;\n deleteGroup(groupId: string): void;\n deleteRootModule(rootModuleId: string): void;\n getPosDataOfAllGroups(): Promise<PosGroup[]>;\n getRoomInformation(): Promise<ExternalRoomInformation>;\n saveExternalObjectSnapshot(): Promise<ExternalObjectSnapshotSaveResult | null>;\n}\n\nexport interface GlueLogic {\n hiCallbacks: HiCallbacks | null;\n hiObjectSelection: HiObjectSelectionApi;\n\n isLibraryLoaded(libraryId: string): boolean;\n getLibraryData(libraryId: string): LibraryData | null;\n addLibrary(libraryData: LibraryData): void;\n setPosDataForLoading(posData: PosSaveData | null): void;\n loadPosData(articleCatalogJson: any, libraryId: string): void;\n mergeGroups(\n targetGroup: ExternalObjectGroup,\n idsOfGroupsMerged: string | string[],\n idOfTargetRootModule: string,\n ): void;\n deleteRootModule(\n remainingGroup: ExternalObjectGroup,\n rootModuleIdToDelete: string,\n splitOffGroups: ExternalObjectGroup[],\n ): void;\n splitRootModuleFromGroup(\n splitGroup: ExternalObjectGroup,\n newGroupedRootModules: ExternalObjectGroup[],\n ): void;\n duplicateGroup(duplicatedGroup: ExternalObjectGroup): void;\n swapRootModule(\n groupId: string,\n rootModuleId: string,\n articleId: string,\n ): void;\n modifyAttribute(\n groupId: string,\n moduleIdObjects: ExternalModuleInformation[],\n attributeName: string,\n value: string,\n ): void;\n updateAttribute(\n rootModuleId: string,\n moduleId: string | null,\n attributeId: string,\n attributeValue: string | boolean,\n ): void;\n getVerifiedAttributeOptions(\n moduleId: string,\n attributeIds?: string | string[],\n ): Promise<Record<string, CheckResult> | undefined>;\n updateAdditionalInfo(rootModuleId: string, additionalInfo: string): void;\n findValidSubArticles(posGroupIds: string[] | string): PosArticle[];\n getValidContainerModulesForSubArticle(\n posGroupIds: string[] | string,\n subArticleId: string,\n ): ExternalObjectValidContainerModules[];\n addSubArticle(\n articleId: string,\n rootModuleId: string,\n parentModuleId: string,\n ): void;\n arrangeRootModulesOfGroup(changedGroup: ExternalObjectGroup): void;\n changedGroupPlanningSituation(changedGroup: ExternalObjectGroup): void;\n changedGroupFromHistory(historyGroup: PosGroup, reloadGroup: boolean): void;\n loadedGroup(posDataJson: PosGroup): void;\n groupsCompletelyLoaded(): void;\n removedGroup(groupId: string): void;\n openCloseGroup(groupId: string): void;\n getSaveDataGroups(): Promise<PosGroup[] | null>;\n newPosDataFromId(id: string): Promise<PosGroup>;\n newPosDataFromGroup(posDataJson: PosGroup): Promise<PosGroup>;\n getGroupDataForOrder(roomlePlannerId?: string): Promise<any>;\n savePlanSnapshot(): Promise<PlanSnapshot | null>;\n}\n\nexport interface PlanSnapshot {\n id: string;\n perspectiveImageLink: string;\n topImageLink: string;\n room3dLink: string;\n room3dFullLink: string;\n}\n\ninterface GroupItem {\n posDataJson: PosGroup;\n opened: boolean;\n}\n\nexport class GlueLogicImplementation implements GlueLogic {\n private _designerRequests: RoomDesignerRequests;\n private _libraryData: Map<string, LibraryData> = new Map();\n private _posDataForLoading: PosSaveData | null = null;\n private _posArticleMap: Map<string, PosArticle> = new Map();\n private _posSubArticleMap: Map<string, PosArticle> = new Map();\n private _groupMap: Map<string, GroupItem> = new Map();\n private _nextPosDataId: number = 1;\n private _hiCallbacks: HiCallbacks | null = null;\n private _hiObjectSelection: HiObjectSelectionApi;\n private _pendingGroupsToBeLoaded: PosGroup[] = [];\n private _planCompletelyLoaded: boolean = false;\n private _validSubArticles: PosArticle[] = [];\n\n public constructor(\n designerRequests: RoomDesignerRequests,\n hiCallbacks: HiCallbacks | null = null,\n ) {\n this._designerRequests = designerRequests;\n this._hiCallbacks = hiCallbacks;\n this._hiObjectSelection = new HiObjectSelection(hiCallbacks);\n }\n\n public get hiCallbacks(): HiCallbacks | null {\n return this._hiCallbacks;\n }\n\n public get hiObjectSelection(): HiObjectSelectionApi {\n return this._hiObjectSelection;\n }\n\n private _getGroup(groupId: string): GroupItem | undefined {\n return this._groupMap.get(groupId);\n }\n\n public getLibraryData(data: string | PosGroup): LibraryData | null {\n if (this._libraryData.size === 1) {\n return Array.from(this._libraryData.values())[0];\n }\n let libraryId: string | undefined;\n if (typeof data === 'string') {\n libraryId = data;\n } else {\n libraryId = this._getLibraryIdForPosData(data);\n }\n if (!this._libraryData.has(libraryId)) {\n console.error(`Library data for libraryId '${libraryId}' not found`);\n return null;\n }\n return this._libraryData.get(libraryId) ?? null;\n }\n\n public isLibraryLoaded(libraryId: string): boolean {\n return this._libraryData.has(libraryId);\n }\n\n public addLibrary(libraryData: LibraryData) {\n if (!this._libraryData.has(libraryData.libraryId)) {\n this._libraryData.set(libraryData.libraryId, libraryData);\n this._loadPendingGroup(libraryData.libraryId);\n }\n }\n\n public loadPosData(articleCatalogJson: any, libraryId: string) {\n // NOBILIA DEMO HACKS -- connect.homag.com sends differently shaped data.\n if (articleCatalogJson?.articles) {\n articleCatalogJson = articleCatalogJson.articles;\n }\n articleCatalogJson.forEach((posDataGroup: PosArticle) => {\n const articleId = (posDataGroup as any).id || posDataGroup.articleId;\n const posArticle = deepCopy(posDataGroup);\n posArticle.libraryId = libraryId;\n if (posArticle.isConfigDummy) {\n this._posSubArticleMap.set(articleId, posArticle);\n } else {\n this._posArticleMap.set(articleId, posArticle);\n }\n });\n }\n\n public setPosDataForLoading(posData: PosSaveData | null) {\n this._posDataForLoading = posData;\n const allPosGroups = Array.from(this._groupMap.values()).map(\n (groupItem) => groupItem.posDataJson,\n );\n this._groupMap.clear();\n for (const groupItem of allPosGroups) {\n this.loadedGroup(groupItem);\n }\n }\n\n public async getSaveDataGroups(): Promise<PosGroup[] | null> {\n return this._posDataForLoading?.groups ?? null;\n }\n\n public async newPosDataFromId(id: string): Promise<PosGroup> {\n if (isExtObjId(id)) {\n id = removeExtObjIdPrefix(id);\n }\n let posArticle: PosArticle | undefined;\n if (this._posArticleMap.has(id)) {\n posArticle = deepCopy(this._posArticleMap.get(id));\n } else if (this._posSubArticleMap.has(id)) {\n posArticle = deepCopy(this._posSubArticleMap.get(id));\n }\n if (!posArticle) {\n return undefined;\n }\n const posArticleGroup = posArticle as any as PosGroup;\n posArticleGroup.ver = this.getLibraryData(\n posArticleGroup.libraryId,\n )?.posGroupVersion;\n posArticleGroup.logMessages = [];\n // copy the needed properties from the article to the root modules\n posArticleGroup.roots.forEach((posArticleRoot: any) => {\n posArticleRoot.libraryId = posArticle.libraryId;\n posArticleRoot.catalog = posArticle.catalog;\n posArticleRoot.logMessages = [];\n // Take over the name from the selected article, if the root was not generated\n if (!posArticleRoot.isGenerated) {\n posArticleRoot.articleName = posArticle.articleName;\n posArticleRoot.articleId = posArticle.articleId;\n posArticleRoot.desc = posArticle.desc;\n posArticleRoot.imageUrl = posArticle.imageUrl;\n posArticleRoot.category = posArticle.category;\n }\n });\n const emulatorGroupItem = this._addNewGroup(posArticleGroup, false);\n this._groupsModified(emulatorGroupItem.posDataJson, [], []);\n return emulatorGroupItem.posDataJson as PosGroup;\n }\n\n public async newPosDataFromGroup(posDataJson: PosGroup): Promise<PosGroup> {\n const emulatorGroupItem = this._addNewGroup(posDataJson, false);\n this._groupsModified(emulatorGroupItem.posDataJson, [], []);\n return emulatorGroupItem.posDataJson;\n }\n\n public async selectGroup(groupId: string) {\n try {\n await this._designerRequests.selectGroup(groupId);\n } catch (error) {\n console.error(error);\n }\n }\n\n public async selectRoot(_groupId: any, rootId: string) {\n try {\n await this._designerRequests.selectRoot(rootId);\n } catch (error) {\n console.error(error);\n }\n }\n\n public async deleteRoot(_groupId: any, rootId: string) {\n try {\n await this._designerRequests.deleteRootModule(rootId);\n } catch (error) {\n console.error(error);\n }\n }\n\n public async selectSubModule(\n _groupId: any,\n rootId: string,\n moduleId: string,\n ) {\n try {\n await this._designerRequests.selectModule(rootId, moduleId);\n } catch (error) {\n console.error(error);\n }\n }\n\n public async openCloseGroup(groupId: string) {\n try {\n const emulatorGroupItem = this._getGroup(groupId);\n if (emulatorGroupItem) {\n const open = !emulatorGroupItem.opened;\n await this._designerRequests.openCloseGroup(groupId, null, open, false);\n emulatorGroupItem.opened = open;\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public deleteRootModule(\n remainingGroup: ExternalObjectGroup,\n rootModuleIdToDelete: string,\n splitOffGroups: ExternalObjectGroup[],\n ) {\n try {\n const originalGroupData = this._getGroup(remainingGroup.groupId);\n if (originalGroupData) {\n this._setGroupPosition(originalGroupData, remainingGroup);\n this._setGroupContour(originalGroupData, remainingGroup);\n this._setRootModulesPosition(originalGroupData, remainingGroup);\n const group = originalGroupData.posDataJson;\n group.roots = group.roots.filter(\n (root: { id: any }) => root.id !== rootModuleIdToDelete,\n );\n const newGroupsPosData = this._splitOffGroupsFromGroups(\n originalGroupData,\n splitOffGroups,\n );\n this._calculateAndUpdateGroupMap(originalGroupData);\n this._loadPosData(originalGroupData, newGroupsPosData);\n this._groupsModified(\n newGroupsPosData.map((g) => g.posDataJson),\n originalGroupData.posDataJson,\n [],\n );\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public duplicateGroup(duplicatedGroup: ExternalObjectGroup) {\n try {\n const originalGroupData = this._getGroup(duplicatedGroup?.groupId);\n if (originalGroupData) {\n const duplicatedPosDataJson = deepCopy(originalGroupData.posDataJson);\n duplicatedPosDataJson.roots = duplicatedPosDataJson.roots.filter(\n (root: { id: any }) =>\n duplicatedGroup.rootModules.find(\n (duplicatedRoot: ExternalObjectRootModule) =>\n duplicatedRoot.moduleId === root.id,\n ) !== undefined,\n );\n const groupItem = this._addNewGroup(duplicatedPosDataJson, false);\n this._setGroupPosition(groupItem, duplicatedGroup);\n this._designerRequests.loadPosGroups(groupItem.posDataJson, {\n findFreeSpaceInPlan: true,\n });\n this._groupsModified(groupItem.posDataJson, [], []);\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public mergeGroups(\n targetGroup: ExternalObjectGroup,\n idsOfGroupsMerged: string | string[],\n idOfTargetRootModule: string,\n ) {\n try {\n const sourceGroupIds = Array.isArray(idsOfGroupsMerged)\n ? idsOfGroupsMerged\n : [idsOfGroupsMerged];\n if (\n this._groupMap.has(targetGroup.groupId) &&\n sourceGroupIds.length > 0\n ) {\n const originalSourceGroupRoots = [];\n for (const sourceGroupId of sourceGroupIds) {\n const sourceGroupData = this._getGroup(sourceGroupId);\n if (sourceGroupData) {\n originalSourceGroupRoots.push(...sourceGroupData.posDataJson.roots);\n }\n }\n const nonGeneratedRoots = originalSourceGroupRoots.filter(\n (rootModule) => !rootModule.isGenerated,\n );\n const targetGroupData = this._getGroup(targetGroup.groupId);\n if (targetGroupData) {\n const existingRoot = targetGroupData.posDataJson.roots.find(\n (r: PosModuleRootData) => r.id === idOfTargetRootModule,\n );\n if (existingRoot) {\n this._applyImplicitRelevantAttributes(\n this._getLibraryIdForPosData(targetGroupData.posDataJson),\n existingRoot,\n nonGeneratedRoots,\n );\n }\n // We only must merge the non-generated roots, because the generated ones are already in the target group\n targetGroupData.posDataJson.roots.push(...nonGeneratedRoots);\n this._setGroupPosition(targetGroupData, targetGroup);\n this._setGroupContour(targetGroupData, targetGroup);\n this._setRootModulesPosition(targetGroupData, targetGroup);\n this._calculateAndUpdateGroupMap(targetGroupData);\n this._designerRequests.loadPosGroups(targetGroupData.posDataJson, {\n mergedGroups: sourceGroupIds,\n });\n const deletedGroups: string[] = [];\n for (const groupId of sourceGroupIds) {\n if (this._groupMap.has(groupId)) {\n this._groupMap.delete(groupId);\n deletedGroups.push(groupId);\n }\n }\n this._groupsModified([], targetGroupData.posDataJson, deletedGroups);\n }\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n private _applyImplicitRelevantAttributes(\n libraryId: string,\n sourceRootModule: PosModuleRootData,\n rootsToDock: string | any[],\n ) {\n const masterData = this.getLibraryData(libraryId)?.masterData;\n if (!masterData || !sourceRootModule || rootsToDock.length === 0) {\n return;\n }\n const mdModule = masterData.modules.find(\n (m: { id: any }) => m.id === sourceRootModule.name,\n );\n const implicitRelevantAttributes =\n mdModule?.assignedAttributes.filter(\n (a: any) =>\n masterData.attributes.find((attr: { id: any }) => attr.id === a)\n ?.implicitRelevant === true,\n ) ?? [];\n\n for (const rootToDock of rootsToDock) {\n const masterDataModule = masterData.modules.find(\n (m: { id: any }) => m.id === rootToDock.name,\n );\n\n for (const attributeId of implicitRelevantAttributes) {\n const sourceRootAttribute = sourceRootModule.attributes?.find(\n (a: { id: any }) => a.id === attributeId,\n );\n const rootToDockAttribute = masterDataModule?.assignedAttributes.find(\n (a: any) => a === attributeId,\n );\n if (!rootToDockAttribute) {\n continue;\n }\n\n const moduleAttribute = rootToDock.attributes?.find(\n (a: { id: any }) => a.id === attributeId,\n );\n if (moduleAttribute) {\n moduleAttribute.isInput = sourceRootAttribute?.isInput ?? false;\n if (moduleAttribute.isInput === true) {\n moduleAttribute.value = sourceRootAttribute?.value;\n }\n } else {\n if (sourceRootAttribute?.isInput ?? false) {\n rootToDock.attributes?.push({\n id: attributeId,\n value: sourceRootAttribute?.value,\n isInput: true,\n });\n }\n }\n }\n }\n }\n\n public splitRootModuleFromGroup(\n splitGroup: ExternalObjectGroup,\n newGroupedRootModules: ExternalObjectGroup[],\n ) {\n try {\n const originalGroupData = this._getGroup(splitGroup.groupId);\n if (originalGroupData) {\n this._setGroupPosition(originalGroupData, splitGroup);\n this._setGroupContour(originalGroupData, splitGroup);\n this._setRootModulesPosition(originalGroupData, splitGroup);\n const newGroups = Array.isArray(newGroupedRootModules)\n ? newGroupedRootModules\n : [newGroupedRootModules];\n const newGroupsPosData = this._splitOffGroupsFromGroups(\n originalGroupData,\n newGroups,\n );\n this._calculateAndUpdateGroupMap(originalGroupData);\n this._loadPosData(originalGroupData, newGroupsPosData);\n this._groupsModified(\n newGroupsPosData.map((g) => g.posDataJson),\n originalGroupData.posDataJson,\n [],\n );\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public arrangeRootModulesOfGroup(changedGroup: ExternalObjectGroup) {\n try {\n const originalGroupData = this._getGroup(changedGroup.groupId);\n if (originalGroupData) {\n for (const root of originalGroupData.posDataJson.roots) {\n changedGroup.rootModules\n .filter(\n (rootModule: { moduleId: any }) =>\n rootModule.moduleId === root.id,\n )\n .forEach((rootModule: ExternalObjectRootModule) => {\n root.articlePos = rootModule.pos;\n root.rotationY = rootModule.rotationY;\n });\n }\n const calculatedGroup =\n this._calculateAndUpdateGroupMap(originalGroupData);\n this._designerRequests.loadPosGroups(calculatedGroup, {});\n this._groupsModified([], calculatedGroup, []);\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public removedGroup(groupId: string) {\n try {\n if (this._groupMap.has(groupId)) {\n this._groupMap.delete(groupId);\n this._groupsModified([], [], groupId);\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public changedGroupFromHistory(historyGroup: PosGroup, reloadGroup: boolean) {\n try {\n const updatedGroup = this._calculate(historyGroup);\n const groupId = updatedGroup.id;\n const emulatorGroupItem = this._getGroup(groupId);\n if (emulatorGroupItem) {\n emulatorGroupItem.posDataJson = updatedGroup;\n } else {\n this._addGroupToMap(groupId, updatedGroup);\n }\n if (reloadGroup) {\n this._designerRequests.loadPosGroups(historyGroup, {});\n }\n this._groupsModified(\n emulatorGroupItem ? [] : [updatedGroup],\n emulatorGroupItem ? [updatedGroup] : [],\n [],\n );\n } catch (error) {\n console.error(error);\n }\n }\n\n public changedGroupPlanningSituation(changedGroup: ExternalObjectGroup) {\n try {\n const originalGroupData = this._getGroup(changedGroup.groupId);\n if (originalGroupData) {\n this._setGroupPosition(originalGroupData, changedGroup);\n this._setGroupContour(originalGroupData, changedGroup);\n const calculatedGroup =\n this._calculateAndUpdateGroupMap(originalGroupData);\n this._designerRequests.loadPosGroups(calculatedGroup, {});\n this._groupsModified([], calculatedGroup, []);\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public loadedGroup(posDataJson: PosGroup) {\n const libraryId = this._getLibraryIdForPosData(posDataJson);\n if (!this._libraryData.has(libraryId)) {\n this._pendingGroupsToBeLoaded.push(posDataJson);\n return;\n }\n this._loadedGroup(posDataJson);\n }\n\n private _loadPendingGroup(libraryId: string) {\n const groupsToBeLoaded = this._pendingGroupsToBeLoaded.filter(\n (group) => this._getLibraryIdForPosData(group) === libraryId,\n );\n this._pendingGroupsToBeLoaded = this._pendingGroupsToBeLoaded.filter(\n (group) => this._getLibraryIdForPosData(group) !== libraryId,\n );\n groupsToBeLoaded.forEach((group) => this._loadedGroup(group));\n if (this._pendingGroupsToBeLoaded.length === 0) {\n this._groupsCompletelyLoaded();\n }\n }\n\n private _loadedGroup(posDataJson: PosGroup) {\n if (!this._posDataForLoading) {\n this._recalculateLoadedGroup(posDataJson);\n return;\n }\n const posDataToBeLoaded = this._posDataForLoading.groups.find(\n (group) => group.id === posDataJson.id,\n );\n if (!posDataToBeLoaded) {\n this.removedGroup(posDataJson.id);\n this._designerRequests.deleteGroup(posDataJson.id);\n return;\n }\n const newPosData = deepCopy(posDataToBeLoaded);\n newPosData.ver = this.getLibraryData(posDataJson)?.posGroupVersion;\n if (posDataJson.pos !== undefined) {\n newPosData.pos = posDataJson.pos;\n }\n if (posDataJson.rotationY !== undefined) {\n newPosData.rotationY = posDataJson.rotationY;\n }\n this._recalculateLoadedGroup(newPosData);\n }\n\n public _recalculateLoadedGroup(posDataJson: PosGroup) {\n try {\n const groupId = posDataJson.id;\n const newGroupCreated = !this._groupMap.has(groupId);\n if (newGroupCreated) {\n this._addGroupToMap(groupId, posDataJson);\n }\n const groupData = this._getGroup(groupId);\n if (groupData) {\n const calculatedGroup = this._calculateAndUpdateGroupMap(groupData);\n this._designerRequests.loadPosGroups(calculatedGroup, {\n respondWithPositionInPlan: true,\n });\n this._groupsModified(\n newGroupCreated ? calculatedGroup : [],\n newGroupCreated ? [] : calculatedGroup,\n [],\n );\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public groupsCompletelyLoaded(): void {\n this._planCompletelyLoaded = true;\n this._groupsCompletelyLoaded();\n }\n\n private _groupsCompletelyLoaded() {\n if (\n this._planCompletelyLoaded &&\n this._libraryData.size > 0 &&\n this._pendingGroupsToBeLoaded.length === 0\n ) {\n this._hiCallbacks?.onPosGroupsCompletelyLoaded();\n }\n }\n\n public async getGroupDataForOrder(roomlePlannerId?: string) {\n try {\n const posGroups = Array.from(this._groupMap.values()).map(\n (groupItem) => groupItem.posDataJson,\n );\n // TEST: Add additional data for each position\n let cnt = 1;\n posGroups.forEach((posGroup: { roots: any[] }) => {\n posGroup.roots.forEach((root: { additionalText: string }) => {\n root.additionalText = 'Additional Text ' + cnt++;\n });\n });\n\n const groupData = this.getLibraryData(roomlePlannerId)?.getOrderData(\n posGroups,\n roomlePlannerId,\n );\n if (!groupData) {\n return null;\n }\n const roomInformation = await this._designerRequests.getRoomInformation();\n groupData.rooms = roomInformation?.rooms ?? [];\n return groupData;\n } catch (error) {\n console.error(error);\n return null;\n }\n }\n\n private _setGroupContour(\n emulatorGroupItem: GroupItem,\n changedGroupPosition: ExternalObjectGroup,\n ) {\n if (changedGroupPosition.contours) {\n emulatorGroupItem.posDataJson.contours =\n changedGroupPosition.contours as PosContour[];\n }\n }\n\n private _setGroupPosition(\n emulatorGroupItem: GroupItem,\n newGroupPosition: ExternalObjectGroupPosition,\n ) {\n const group = emulatorGroupItem.posDataJson;\n if (newGroupPosition.pos !== undefined) {\n group.pos = newGroupPosition.pos;\n }\n if (newGroupPosition.rotationY !== undefined) {\n group.rotationY = newGroupPosition.rotationY;\n }\n }\n\n private _setRootModulesPosition(\n emulatorGroupItem: GroupItem,\n rootModulePositions: ExternalObjectGroup,\n ) {\n for (const root of emulatorGroupItem.posDataJson.roots) {\n rootModulePositions.rootModules\n .filter(\n (rootModule: { moduleId: string }) => rootModule.moduleId === root.id,\n )\n .forEach((rootModule: ExternalObjectRootModule) => {\n root.articlePos = rootModule.pos;\n root.rotationY = rootModule.rotationY;\n });\n }\n }\n\n private _loadPosData(\n emulatorGroupItem: GroupItem,\n additionalGroupData: GroupItem[],\n ) {\n const loadPosData = deepCopy(emulatorGroupItem.posDataJson);\n const posDataCollection = Array.isArray(loadPosData)\n ? loadPosData\n : [loadPosData];\n for (const data of additionalGroupData ?? []) {\n posDataCollection.push(deepCopy(data.posDataJson));\n }\n this._designerRequests.loadPosGroups(posDataCollection, {});\n }\n\n private _splitOffGroupsFromGroups(\n originalGroupData: GroupItem | undefined,\n splitOffGroups: ExternalObjectGroup[],\n ): GroupItem[] {\n const newGroupsPosData: GroupItem[] = [];\n for (const newGroup of splitOffGroups ?? []) {\n const newGroupPosDataJson = this._splitOffRootModulesFromGroup(\n originalGroupData,\n newGroup,\n );\n const emulatorGroupItem = this._addNewGroup(newGroupPosDataJson, true);\n newGroupsPosData.push(emulatorGroupItem);\n }\n return newGroupsPosData;\n }\n\n private _splitOffRootModulesFromGroup(\n originalGroupData: GroupItem,\n newGroupedRootModules: ExternalObjectGroup,\n ): PosGroup {\n const splitOffRootModuleIds = newGroupedRootModules.rootModules.map(\n (root: { moduleId: any }) => root.moduleId,\n );\n const group = originalGroupData.posDataJson;\n const splitOffRootModules = group.roots.filter((root: { id: any }) =>\n splitOffRootModuleIds.includes(root.id),\n );\n group.roots = group.roots.filter(\n (root: { id: any }) => !splitOffRootModuleIds.includes(root.id),\n );\n for (const splitOffRootModule of splitOffRootModules) {\n newGroupedRootModules.rootModules\n .filter(\n (rootModule: { moduleId: any }) =>\n rootModule.moduleId === splitOffRootModule.id,\n )\n .forEach((rootModule: ExternalObjectRootModule) => {\n splitOffRootModule.articlePos = rootModule.pos;\n splitOffRootModule.rotationY = rootModule.rotationY;\n });\n }\n for (const remainingRoot of group.roots) {\n if (remainingRoot.isGenerated) {\n splitOffRootModules.push(deepCopy(remainingRoot));\n }\n }\n const newGroupPosDataJson: PosGroup = {\n id: undefined,\n libraryId: group.libraryId,\n pos: newGroupedRootModules.pos,\n rotationY: newGroupedRootModules.rotationY,\n roots: splitOffRootModules,\n ver: group.ver,\n logMessages: [],\n };\n return newGroupPosDataJson;\n }\n\n private _calculateNewGroup(posDataJson: PosGroup, keepRootModuleIDs: any) {\n this._replacesIDs(posDataJson, keepRootModuleIDs);\n return this._calculate(posDataJson);\n }\n\n private _getLibraryIdForPosData(posDataJson: PosGroup): string | undefined {\n if (posDataJson.libraryId) {\n return posDataJson.libraryId;\n }\n return posDataJson.roots.find((r: { libraryId: string }) => r.libraryId)\n ?.libraryId;\n }\n\n private _setSubmoduleImages(\n posDataModule: PosModuleData,\n masterData?: MasterData,\n ) {\n if (!masterData) {\n return;\n }\n if (!posDataModule.modules?.length) {\n return;\n }\n posDataModule.modules.forEach((subModule) => {\n const masterDataModule = masterData.modules.find(\n (m) => m.id === subModule.name,\n );\n if (masterDataModule) {\n subModule.imageUrl = masterDataModule.imageUrl;\n }\n this._setSubmoduleImages(subModule, masterData);\n });\n }\n\n private _calculateAndUpdateGroupMap(groupData: GroupItem) {\n const res = this._calculate(groupData.posDataJson);\n groupData.posDataJson = res;\n this._groupMap.set(groupData.posDataJson.id, groupData);\n return res;\n }\n\n private _addNewGroup(posDataJson: PosGroup, keepRootModuleIDs: boolean) {\n const calculatedPosDataJson = this._calculateNewGroup(\n posDataJson,\n keepRootModuleIDs,\n );\n return this._addGroupToMap(calculatedPosDataJson.id, calculatedPosDataJson);\n }\n\n private _addGroupToMap(groupId: string, posDataJson: any) {\n const emulatorGroupItem = {\n posDataJson,\n opened: false,\n };\n this._groupMap.set(groupId, emulatorGroupItem);\n return emulatorGroupItem;\n }\n\n public updateAttribute(\n rootModuleId: string,\n moduleId: string | null,\n attributeId: string,\n attributeValue: string | boolean,\n ): void {\n if (!rootModuleId) {\n return;\n }\n const emulatorGroup = Array.from(this._groupMap.entries()).find(\n ([, value]) => {\n return value.posDataJson.roots.some((root) => root.id === rootModuleId);\n },\n );\n if (!emulatorGroup) {\n throw new Error('PosGroup not found inside the calculated articles list');\n }\n const [, emulatorGroupItem] = emulatorGroup;\n if (emulatorGroupItem) {\n const modifiedGroups = this._modifyAttributeOfModules(\n emulatorGroupItem,\n moduleId ?? rootModuleId,\n attributeId,\n attributeValue,\n );\n this._designerRequests.loadPosGroups(modifiedGroups, {\n correctArrangement: true,\n });\n this._groupsModified([], modifiedGroups, []);\n }\n }\n\n public modifyAttribute(\n groupId: string,\n moduleIdObjects: ExternalModuleInformation[],\n attributeName: string,\n value: string,\n ) {\n const emulatorGroupItem = this._getGroup(groupId);\n if (emulatorGroupItem) {\n const moduleIds = moduleIdObjects.map(\n (obj) => obj.subModuleId ?? obj.rootModuleId,\n );\n const modifiedGroups = this._modifyAttributeOfModules(\n emulatorGroupItem,\n moduleIds,\n attributeName,\n value,\n );\n this._designerRequests.loadPosGroups(modifiedGroups, {\n correctArrangement: true,\n });\n this._groupsModified([], modifiedGroups, []);\n }\n }\n\n public async getVerifiedAttributeOptions(\n moduleId: string,\n attributeIds?: string | string[],\n ): Promise<Record<string, CheckResult> | undefined> {\n const moduleInfo = this._findModuleInAllGroups(moduleId);\n if (!moduleInfo) {\n console.error('Module not found inside the calculated articles list');\n return undefined;\n }\n if (!moduleInfo.module.checkAttributes) {\n return undefined;\n }\n let attributeOptions: Record<string, CheckDropDownEntry[] | undefined>;\n try {\n attributeOptions = await this.getLibraryData(\n moduleInfo.group,\n )?.getAttributesDropDownValues(moduleInfo.module, attributeIds);\n } catch (error) {\n console.error(error);\n }\n if (!attributeOptions) {\n return undefined;\n }\n const checkResults: Record<string, CheckResult> = {};\n for (const [attributeId, options] of Object.entries(attributeOptions)) {\n if (options && options.length > 0) {\n checkResults[attributeId] = {\n calcResult: options.map((entry: CheckDropDownEntry) => ({\n value: entry.value,\n kind: entry.kind,\n })),\n };\n }\n }\n return checkResults;\n }\n\n public updateAdditionalInfo(\n rootModuleId: string,\n additionalInfo: string,\n ): void {\n const moduleInfo = this._findRootModuleInAllGroups(rootModuleId);\n if (!moduleInfo) {\n console.error(\n 'Root module not found inside the calculated articles list',\n );\n return;\n }\n moduleInfo.rootModule.additionalText = additionalInfo;\n this._designerRequests.loadPosGroups(moduleInfo.group, {});\n this._groupsModified([], moduleInfo.group, []);\n }\n\n public async swapRootModule(\n groupId: string,\n rootModuleId: string,\n articleId: string,\n ): Promise<void> {\n const emulatorGroupItem = this._getGroup(groupId);\n if (!emulatorGroupItem) {\n return;\n }\n const group = emulatorGroupItem.posDataJson;\n const rootModuleToBeReplaced = group.roots.find(\n (root: { id: string }) => root.id === rootModuleId,\n );\n if (!rootModuleToBeReplaced) {\n return;\n }\n const newPosDataJson = await this.newPosDataFromId(articleId);\n const notGeneratedRoots = newPosDataJson.roots.filter(\n (root: PosModuleRootData) => !root.isGenerated,\n );\n if (!newPosDataJson || notGeneratedRoots.length !== 1) {\n return;\n }\n const newRootModule = notGeneratedRoots[0];\n if (rootModuleToBeReplaced) {\n this._applyImplicitRelevantAttributes(\n this._getLibraryIdForPosData(group),\n rootModuleToBeReplaced,\n [newRootModule],\n );\n }\n newRootModule.articlePos = rootModuleToBeReplaced.articlePos;\n newRootModule.rotationY = rootModuleToBeReplaced.rotationY;\n group.roots = group.roots.filter(\n (root: { id: any }) => root.id !== rootModuleId,\n );\n group.roots.push(newRootModule);\n const modifiedGroup = this._calculateAndUpdateGroupMap(emulatorGroupItem);\n const rootModuleMapping = {\n originalModuleId: rootModuleId,\n newModuleId: newRootModule.id,\n };\n this._designerRequests.loadPosGroups(modifiedGroup, {\n newAction: true,\n correctArrangement: true,\n moduleIdMap: [rootModuleMapping],\n });\n this._groupsModified([], modifiedGroup, []);\n }\n\n public _modifyAttributeOfModules(\n emulatorGroupItem: GroupItem,\n moduleIds: string[] | string,\n attributeId: string,\n value: string | boolean,\n ): PosGroup {\n const ids = Array.isArray(moduleIds) ? moduleIds : [moduleIds];\n const libraryData = this.getLibraryData(emulatorGroupItem.posDataJson);\n for (const moduleId of ids) {\n const module = this._findModule(\n emulatorGroupItem.posDataJson.roots,\n moduleId,\n );\n if (module && libraryData) {\n const conflictResults = libraryData.solveModuleAttributeConflict(\n module,\n attributeId,\n value,\n );\n this._setAttribute(module, attributeId, value);\n if (conflictResults && conflictResults.length > 0) {\n conflictResults.forEach((conflictResult) => {\n if (conflictResult.value !== undefined) {\n this._setAttribute(\n module,\n conflictResult.id,\n conflictResult.value,\n );\n }\n });\n }\n }\n }\n const res = this._calculateAndUpdateGroupMap(emulatorGroupItem);\n return res;\n }\n\n private _setAttribute(\n module: PosModuleData,\n attributeId: string,\n value: string | number | boolean,\n ): void {\n if (module.attributes && module.attributes.length > 0) {\n const attribute = module.attributes.find((a) => a.id === attributeId);\n if (attribute) {\n attribute.value = value;\n attribute.isInput = true;\n return;\n }\n }\n\n const attributeData = {\n id: attributeId,\n value: value,\n isInput: true,\n } as PosModuleAttribute;\n if (module.attributes) {\n module.attributes.push(attributeData);\n } else {\n module.attributes = [attributeData];\n }\n }\n\n public findValidSubArticles(posGroupIds: string[] | string): PosArticle[] {\n this._validSubArticles = [];\n const ids = Array.isArray(posGroupIds) ? posGroupIds : [posGroupIds];\n for (const id of ids) {\n const groupItem = this._getGroup(id);\n if (!groupItem) {\n continue;\n }\n const posGroup = groupItem.posDataJson;\n const { libraryId, libraryData } = this._getLibrary(posGroup);\n if (!libraryData) {\n continue;\n }\n const possibleSubArticles: PosArticle[] = Array.from(\n this._posSubArticleMap.values(),\n ).filter((article) => article.libraryId === libraryId);\n try {\n const setOfArticles = libraryData.getValidSubArticles(\n posGroup,\n possibleSubArticles,\n libraryData.masterData,\n );\n this._validSubArticles.push(...Array.from(setOfArticles));\n } catch (error) {\n console.error(error);\n }\n }\n return this._validSubArticles;\n }\n\n private _getValidSubArticle(articleId: string): PosArticle | null {\n const article = this._validSubArticles.find(\n (article) => article.articleId === articleId,\n );\n return article ?? null;\n }\n\n public getValidContainerModulesForSubArticle(\n posGroupIds: string[] | string,\n subArticleId: string,\n ): ExternalObjectValidContainerModules[] {\n const subArticle = this._getValidSubArticle(subArticleId);\n if (!subArticle) {\n return [];\n }\n const ids = Array.isArray(posGroupIds) ? posGroupIds : [posGroupIds];\n const validContainers: ExternalObjectValidContainerModules[] = [];\n for (const id of ids) {\n const groupItem = this._getGroup(id);\n if (!groupItem) {\n continue;\n }\n const posGroup = groupItem.posDataJson;\n const { libraryData } = this._getLibrary(posGroup);\n if (!libraryData) {\n continue;\n }\n try {\n const setOfContainers =\n libraryData.getValidContainerModulesForSubArticle(\n posGroup,\n subArticle,\n libraryData.masterData,\n );\n validContainers.push(...Array.from(setOfContainers));\n } catch (error) {\n console.error(error);\n }\n }\n return validContainers;\n }\n\n public addSubArticle(\n articleId: string,\n rootModuleId: string,\n parentModuleId: string,\n ): void {\n const article = this._getValidSubArticle(articleId);\n if (!article) {\n return;\n }\n const { group } = this._findRootModuleInAllGroups(rootModuleId);\n if (!group) {\n return;\n }\n const modifiedGroup = this._addSubArticle(\n group,\n article,\n rootModuleId,\n parentModuleId,\n );\n this._designerRequests.loadPosGroups(modifiedGroup, {});\n this._groupsModified([], modifiedGroup, []);\n }\n\n public async savePlanSnapshot(): Promise<PlanSnapshot | null> {\n const planSnapshot =\n await this._designerRequests.saveExternalObjectSnapshot();\n if (!planSnapshot) {\n console.error('Failed to save plan snapshot');\n return null;\n }\n return {\n id: planSnapshot.planSnapshotId,\n perspectiveImageLink: planSnapshot.perspectiveImageLink,\n topImageLink: planSnapshot.topImageLink,\n room3dLink: planSnapshot.objectGlbLink,\n room3dFullLink: planSnapshot.fullPlanGlbLink,\n };\n }\n\n private _findRootModuleInAllGroups(\n moduleId: string,\n ): { group: PosGroup; rootModule: PosModuleRootData } | undefined {\n for (const groupData of this._groupMap.values()) {\n const group = groupData.posDataJson;\n const rootModule = group.roots.find(\n (root: PosModuleRootData) => root.id === moduleId,\n );\n if (rootModule !== undefined) {\n return { group, rootModule };\n }\n }\n return undefined;\n }\n\n private _findModuleInAllGroups(\n moduleId: string,\n ): { group: PosGroup; module: PosModuleData } | undefined {\n for (const groupData of this._groupMap.values()) {\n const group = groupData.posDataJson;\n const module = this._findModule(group.roots, moduleId);\n if (module !== undefined) {\n return { group, module };\n }\n }\n return undefined;\n }\n\n private _findModule(\n modules: PosModuleData[],\n moduleId: string,\n ): PosModuleData | undefined {\n for (const module of modules) {\n if (module.id === moduleId) {\n return module;\n }\n if (module.modules && module.modules.length > 0) {\n const subMod = this._findModule(module.modules, moduleId);\n if (subMod !== undefined) {\n return subMod;\n }\n }\n }\n return undefined;\n }\n\n private _replacesIDs(\n posGroup: { id: string; roots: any },\n keepRootModuleIDs: any,\n ) {\n posGroup.id = this._getNextID();\n if (!keepRootModuleIDs) {\n for (const root of posGroup.roots) {\n this._replacesModuleIDs(root);\n }\n }\n }\n\n private _replacesModuleIDs(module: { id: string; modules: any }) {\n module.id = this._getNextID();\n if (module.modules) {\n for (const subModule of module.modules) {\n this._replacesModuleIDs(subModule);\n }\n }\n }\n\n private _getNextID() {\n if ((window as any).uuidv4) {\n return (window as any).uuidv4();\n }\n let id = (this._nextPosDataId++).toString();\n if (id.length < 4) {\n id = '0'.repeat(4 - id.length) + id;\n }\n return 'id' + id;\n }\n\n private async _groupsModified(\n addedPosGroups: PosGroup[] | PosGroup,\n changedPosGroups: PosGroup[] | PosGroup,\n deletedPosGroupIds: string[] | string,\n ) {\n const addedGroupsArray = Array.isArray(addedPosGroups)\n ? addedPosGroups\n : [addedPosGroups];\n if (addedGroupsArray.length > 0) {\n await this._hiCallbacks?.onPosGroupAdded(addedGroupsArray);\n }\n const changedGroupsArray = Array.isArray(changedPosGroups)\n ? changedPosGroups\n : [changedPosGroups];\n if (changedGroupsArray.length > 0) {\n await this._hiCallbacks?.onPosGroupChanged(changedGroupsArray);\n }\n const deletedPosGroupIdsArray = Array.isArray(deletedPosGroupIds)\n ? deletedPosGroupIds\n : [deletedPosGroupIds];\n if (deletedPosGroupIdsArray.length > 0) {\n await this._hiCallbacks?.onPosGroupDeleted(deletedPosGroupIdsArray);\n }\n this._calculatePrice();\n }\n\n private _calculatePrice() {\n const posGroups = Array.from(this._groupMap.values()).map(\n (groupData) => groupData.posDataJson,\n );\n this._hiCallbacks?.onPriceCalc(posGroups);\n }\n\n private _calculate(originalPosDataJson: PosGroup) {\n const { libraryId, libraryData } = this._getLibrary(originalPosDataJson);\n if (!libraryData) {\n return null;\n }\n const posGroup = deepCopy(originalPosDataJson);\n posGroup.libraryId = libraryId;\n if (posGroup.logMessages) {\n posGroup.logMessages = [];\n }\n\n let calculatedResult: PosGroup = posGroup;\n try {\n calculatedResult = libraryData.calculateGroup(posGroup);\n } catch (error) {\n console.error('Error calculating group:', error);\n }\n\n this._takeOverPropertiesFromOriginalGroup(\n libraryId,\n libraryData,\n originalPosDataJson,\n calculatedResult,\n );\n return calculatedResult;\n }\n\n private _addSubArticle(\n originalPosDataJson: PosGroup,\n article: PosArticle,\n rootId: string,\n parentModuleId: string,\n ) {\n const { libraryId, libraryData } = this._getLibrary(originalPosDataJson);\n if (!libraryData) {\n return null;\n }\n const posGroup = deepCopy(originalPosDataJson);\n posGroup.libraryId = libraryId;\n if (posGroup.logMessages) {\n posGroup.logMessages = [];\n }\n\n let calculatedResult: PosGroup = posGroup;\n try {\n calculatedResult = libraryData.addSubArticle(\n posGroup,\n article,\n rootId,\n parentModuleId,\n );\n calculatedResult = libraryData.calculateGroup(calculatedResult);\n } catch (error) {\n console.error('Error adding sub article to group:', error);\n }\n\n this._takeOverPropertiesFromOriginalGroup(\n libraryId,\n libraryData,\n originalPosDataJson,\n calculatedResult,\n );\n return calculatedResult;\n }\n\n private _getLibrary(posGroup: PosGroup): LibraryIdAndLibraryData {\n const libraryId = this._getLibraryIdForPosData(posGroup);\n const libraryData = this.getLibraryData(libraryId);\n return { libraryId, libraryData };\n }\n\n private _takeOverPropertiesFromOriginalGroup(\n libraryId: string,\n libraryData: LibraryData,\n originalArticleGroup: PosGroup,\n calculatedGroupData: PosGroup,\n ) {\n // take over thee position and rotation from the original data\n if (originalArticleGroup.pos !== undefined) {\n calculatedGroupData.pos = originalArticleGroup.pos;\n }\n if (originalArticleGroup.rotationY !== undefined) {\n calculatedGroupData.rotationY = originalArticleGroup.rotationY;\n }\n\n // take over the other properties from the original data\n const masterData = libraryData.masterData;\n calculatedGroupData.roots.forEach((root: PosModuleRootData) => {\n const posArticleGroupRoot = originalArticleGroup.roots.find(\n (r: { id: any }) => r.id === root.id,\n );\n const module = masterData?.modules.find((p) => p.id === root.name);\n\n root.libraryId = posArticleGroupRoot?.libraryId ?? libraryId;\n root.articleName =\n posArticleGroupRoot?.articleName ??\n posArticleGroupRoot?.articleId ??\n module?.name ??\n module?.id;\n root.articleId =\n posArticleGroupRoot?.articleId ??\n posArticleGroupRoot?.articleName ??\n module?.id ??\n module?.name;\n root.imageUrl = posArticleGroupRoot?.imageUrl ?? module?.imageUrl;\n root.desc = posArticleGroupRoot?.desc ?? module?.desc;\n root.category = posArticleGroupRoot?.category;\n root.additionalText = posArticleGroupRoot?.additionalText;\n if (root.canBeDeleted === undefined) {\n root.canBeDeleted = !root.isGenerated;\n }\n this._setSubmoduleImages(root, masterData);\n });\n }\n}\n","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n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0lBRUQsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDO0FBRUQsZUFBZSxTQUFTLENBQUMifQ==","let getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n getRandomValues = crypto.getRandomValues.bind(crypto);\n }\n return getRandomValues(rnds8);\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm5nLWJyb3dzZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcm5nLWJyb3dzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsSUFBSSxlQUEwRCxDQUFDO0FBRS9ELE1BQU0sS0FBSyxHQUFHLElBQUksVUFBVSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0FBRWpDLE1BQU0sQ0FBQyxPQUFPLFVBQVUsR0FBRztJQUV6QixJQUFJLENBQUMsZUFBZSxFQUFFLENBQUM7UUFDckIsSUFBSSxPQUFPLE1BQU0sS0FBSyxXQUFXLElBQUksQ0FBQyxNQUFNLENBQUMsZUFBZSxFQUFFLENBQUM7WUFDN0QsTUFBTSxJQUFJLEtBQUssQ0FDYiwwR0FBMEcsQ0FDM0csQ0FBQztRQUNKLENBQUM7UUFFRCxlQUFlLEdBQUcsTUFBTSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDeEQsQ0FBQztJQUVELE9BQU8sZUFBZSxDQUFDLEtBQUssQ0FBQyxDQUFDO0FBQ2hDLENBQUMifQ==","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmF0aXZlLWJyb3dzZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbmF0aXZlLWJyb3dzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLEdBQ2QsT0FBTyxNQUFNLEtBQUssV0FBVyxJQUFJLE1BQU0sQ0FBQyxVQUFVLElBQUksTUFBTSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUM7QUFFdkYsZUFBZSxFQUFFLFVBQVUsRUFBRSxDQUFDIn0=","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n const rnds = options.random || (options.rng || rng)();\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidjQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdjQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxNQUFNLE1BQU0sYUFBYSxDQUFDO0FBQ2pDLE9BQU8sR0FBRyxNQUFNLFVBQVUsQ0FBQztBQUMzQixPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFJakQsU0FBUyxFQUFFLENBQUMsT0FBeUIsRUFBRSxHQUFnQixFQUFFLE1BQWU7SUFDdEUsSUFBSSxNQUFNLENBQUMsVUFBVSxJQUFJLENBQUMsR0FBRyxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDMUMsT0FBTyxNQUFNLENBQUMsVUFBVSxFQUFFLENBQUM7SUFDN0IsQ0FBQztJQUVELE9BQU8sR0FBRyxPQUFPLElBQUksRUFBRSxDQUFDO0lBRXhCLE1BQU0sSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLElBQUksQ0FBQyxPQUFPLENBQUMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxFQUFFLENBQUM7SUFHdEQsSUFBSSxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxHQUFHLElBQUksQ0FBQyxHQUFHLElBQUksQ0FBQztJQUNsQyxJQUFJLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLEdBQUcsSUFBSSxDQUFDLEdBQUcsSUFBSSxDQUFDO0lBR2xDLElBQUksR0FBRyxFQUFFLENBQUM7UUFDUixNQUFNLEdBQUcsTUFBTSxJQUFJLENBQUMsQ0FBQztRQUVyQixLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsRUFBRSxFQUFFLEVBQUUsQ0FBQyxFQUFFLENBQUM7WUFDNUIsR0FBRyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsR0FBRyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDNUIsQ0FBQztRQUVELE9BQU8sR0FBRyxDQUFDO0lBQ2IsQ0FBQztJQUVELE9BQU8sZUFBZSxDQUFDLElBQUksQ0FBQyxDQUFDO0FBQy9CLENBQUM7QUFFRCxlQUFlLEVBQUUsQ0FBQyJ9","import type { GlueLogic } from './glue-logic';\nimport type RoomlePlanner from '../../planner-core/src/roomle-planner';\nimport type { BASE_CONTEXT } from '../../common-core/src/main';\nimport type { SELECTION_MODE } from '../../configurator-core/src/utils/selection-handler';\nimport type { CallbackObjectType } from '../../planner-core/src/utils/planner-scene-utils';\nimport type { SelectionPayload } from '../../planner-core/src/roomle-planner-ui-callback';\nimport type PlanElementViewModel from '../../common-core/src/view-model/plan-element-view-model';\nimport type { CancelSelectionReasons } from '../../typings/planner';\nimport type {\n ExternalModuleInformation,\n ExternalObjectGroup,\n} from './external-object-api-callbacks';\n\nexport const initCallbacks = (\n roomlePlanner: RoomlePlanner,\n gluLogic: GlueLogic,\n) => {\n // @ts-ignore -- bla\n roomlePlanner.callbacks.onMergeExternalObjectGroup = (\n targetGroup: ExternalObjectGroup,\n idsOfGroupsMerged: string | string[],\n idOfTargetRootModule: string,\n ) => {\n gluLogic.mergeGroups(targetGroup, idsOfGroupsMerged, idOfTargetRootModule);\n };\n // @ts-ignore -- bla\n roomlePlanner.callbacks.onSplitExternalObjectGroup = (\n splitGroup: ExternalObjectGroup,\n newGroupedRootModules: ExternalObjectGroup[],\n ) => {\n gluLogic.splitRootModuleFromGroup(splitGroup, newGroupedRootModules);\n };\n // @ts-ignore -- bla\n roomlePlanner.callbacks.onExternalObjectGroupArrangementChanged = (\n changedGroup: ExternalObjectGroup,\n ) => {\n gluLogic.arrangeRootModulesOfGroup(changedGroup);\n };\n\n roomlePlanner.callbacks.onDeleteExternalObjectGroup = (\n groupIdToDelete: string,\n ) => {\n gluLogic.removedGroup(groupIdToDelete);\n };\n // @ts-ignore -- bla\n roomlePlanner.callbacks.onDeleteExternalObjectRootModule = (\n remainingGroup: ExternalObjectGroup,\n rootModuleIdToDelete: string,\n splitOffGroups?: ExternalObjectGroup[],\n ) => {\n gluLogic.deleteRootModule(\n remainingGroup,\n rootModuleIdToDelete,\n splitOffGroups ?? [],\n );\n };\n\n roomlePlanner.callbacks.onDeleteExternalObjectSubModule = (\n _rootModuleId: string,\n _subModuleIdToDelete: string,\n ) => {\n // Currently not used in GlueLogic\n };\n\n roomlePlanner.callbacks.onDuplicateExternalObjectGroup = (\n _sourceGroupId: string,\n duplicatedGroup: ExternalObjectGroup,\n ) => {\n gluLogic.duplicateGroup(duplicatedGroup);\n };\n // @ts-ignore -- bla\n roomlePlanner.callbacks.onChangedExternalObjectGroupPlan = (\n group: ExternalObjectGroup,\n ) => {\n gluLogic.changedGroupPlanningSituation(group);\n };\n\n roomlePlanner.callbacks.onExternalObjectEnvironmentChanged = (\n _affectedGroupIds: string[],\n ) => {\n // Currently not used in GlueLogic\n };\n\n roomlePlanner.callbacks.onExternalObjectGroupChanged = (\n groupPosData: string,\n ) => {\n const groupPosDataJson = JSON.parse(groupPosData);\n gluLogic.changedGroupFromHistory(groupPosDataJson, false);\n };\n\n roomlePlanner.callbacks.onExternalObjectGroupLoaded = (\n groupPosData: string,\n ) => {\n const groupPosDataJson = JSON.parse(groupPosData);\n gluLogic.loadedGroup(groupPosDataJson);\n };\n\n roomlePlanner.callbacks.onExternalObjectAttributeChanged = (\n groupId: string,\n moduleIds: string | ExternalModuleInformation[] | null,\n attributeId: string,\n value: string,\n ) => {\n if (Array.isArray(moduleIds)) {\n gluLogic.modifyAttribute(groupId, moduleIds, attributeId, value);\n } else {\n gluLogic.modifyAttribute(\n groupId,\n [\n {\n groupId,\n rootModuleId: moduleIds as string,\n subModuleId: null,\n },\n ],\n attributeId,\n value,\n );\n }\n };\n\n roomlePlanner.callbacks.onCompletelyLoaded = () => {\n gluLogic.groupsCompletelyLoaded();\n };\n\n roomlePlanner.callbacks.onPlanSnapshotCreated = (..._args: any) => {\n // Currently not used in GlueLogic\n };\n\n roomlePlanner.callbacks.onExternalObjectModuleSelected = (\n groupId: string,\n rootModuleId: string | null,\n subModuleId: string | null,\n ) => {\n gluLogic.hiObjectSelection.groupOrModuleSelected(\n groupId,\n rootModuleId,\n subModuleId,\n );\n };\n\n roomlePlanner.callbacks.onContextChanged = (context: BASE_CONTEXT): void => {\n gluLogic.hiObjectSelection.contextChanged(context);\n };\n\n roomlePlanner.callbacks.onSelectionChange = (\n selectionMode: SELECTION_MODE,\n objectType: CallbackObjectType,\n payload: SelectionPayload,\n payloadPromise: Promise<SelectionPayload>,\n planElementViewModel: PlanElementViewModel,\n ): void => {\n gluLogic.hiObjectSelection.selectionChanged(\n selectionMode,\n objectType,\n payload,\n payloadPromise,\n planElementViewModel,\n );\n };\n\n roomlePlanner.callbacks.onSelectionCancel = (\n reason: CancelSelectionReasons,\n ): void => {\n gluLogic.hiObjectSelection.selectionCancel(reason);\n };\n};\n","import type RoomlePlanner from '../../planner-core/src/roomle-planner';\nimport type { GlueLogic } from './glue-logic';\nimport type { KernelPlanObject } from '../../typings/kernel';\n\nconst getISO8601Date = (date = new Date()) => {\n // Get the ISO string (in UTC)\n let isoString = date.toISOString();\n\n // Remove the 'Z' at the end which indicates UTC\n isoString = isoString.slice(0, -1);\n\n // Find the position of milliseconds\n const msPosition = isoString.lastIndexOf('.');\n\n // Get the base timestamp with 3 digits of milliseconds and extend with zeros\n let baseTimestamp = isoString;\n\n if (msPosition !== -1) {\n // Add 4 zeros to extend from 3 to 7 digits of precision\n baseTimestamp = isoString.substring(0, msPosition + 4) + '0000';\n }\n\n // Get timezone offset in minutes and convert to hours and minutes\n const offsetMinutes = date.getTimezoneOffset();\n const offsetHours = Math.abs(Math.floor(offsetMinutes / 60));\n const offsetMins = Math.abs(offsetMinutes % 60);\n\n // Format the offset as +HH:MM or -HH:MM\n const offsetSign = offsetMinutes <= 0 ? '+' : '-';\n const offsetString = `${offsetSign}${String(offsetHours).padStart(\n 2,\n '0',\n )}:${String(offsetMins).padStart(2, '0')}`;\n\n return baseTimestamp + offsetString;\n};\n\nexport const createEmptyOrder = () => {\n return {\n id: (window as any).uuidv4\n ? (window as any).uuidv4()\n : '00000000-0000-0000-0000-000000000000',\n state: 'New',\n orderNumber: '736362',\n orderName: 'Bedroom & bathroom 01',\n orderDescription: 'Lorem ipsum dolor sit amet...',\n project: 'Single family house Müller John',\n personInCharge: 'Joe',\n orderDate: getISO8601Date(),\n deliveryDatePlanned: getISO8601Date(\n new Date(Date.now() + 14 * 24 * 60 * 60 * 1000),\n ),\n addresses: [\n {\n type: 'Delivery, Billing',\n street: 'Musterstraße',\n houseNumber: '1',\n postalCode: '12345',\n city: 'Musterstadt',\n country: 'Deutschland',\n },\n ],\n customerName: 'Müller & Co.',\n customerNumber: '462642',\n createdAt: getISO8601Date(),\n changedAt: getISO8601Date(),\n changedBy: 'Selfish',\n items: [] as any[],\n };\n};\n\nconst _addMerchantPositions = async (\n roomlePlanner: RoomlePlanner,\n groupData: any,\n) => {\n const planOverview = await roomlePlanner.getPlanOverview();\n const count: Record<string, number> = {}; // key is id and value is count\n const itemIds = (\n planOverview.objects as unknown as KernelPlanObject[]\n ).reduce((acc: string[], item: any) => {\n if (item.catalogItemId) {\n if (!count[item.catalogItemId]) {\n count[item.catalogItemId] = 0;\n acc.push(item.catalogItemId);\n }\n count[item.catalogItemId]++;\n }\n return acc;\n }, []);\n const items =\n Array.isArray(itemIds) && itemIds.length > 0\n ? await roomlePlanner.getRapiAccess().getItems(itemIds)\n : [];\n const merchantItems = items.filter((item: any) => {\n if (item.manufacturerSKU !== undefined) {\n item.count = count[item.id];\n return true;\n }\n return false;\n });\n if (Array.isArray(merchantItems) && merchantItems.length > 0) {\n if (!groupData.items) {\n groupData.items = [];\n }\n let posNo = groupData.items.reduce((acc: number, item: any) => {\n if (item.items?.length) {\n return acc + item.items.length;\n }\n return acc;\n }, 0);\n merchantItems.forEach((item) => {\n const pos = {} as any;\n pos.type = 'Position';\n pos.name = (++posNo).toString();\n pos.articleNumber = item.manufacturerSKU;\n pos.articleName = item.label;\n pos.catalog = item.catalog;\n pos.quantity = item.count;\n pos.height = item.displayedHeight;\n pos.width = item.displayedWidth;\n pos.depth = item.displayedDepth;\n pos.color = item.basecolor;\n pos.procurementType = 'PTO';\n pos.additionalData = [];\n if (item.perspectiveImage) {\n pos.additionalData.push({\n category: 'ArticleImage',\n downloadUri: item.perspectiveImage,\n type: 'Image',\n });\n }\n groupData.items.push(pos);\n });\n }\n};\n\nexport default class Orders {\n private _roomlePlanner: RoomlePlanner;\n private _glueLogic: GlueLogic;\n\n constructor(roomlePlanner: RoomlePlanner, glueLogic: GlueLogic) {\n this._roomlePlanner = roomlePlanner;\n this._glueLogic = glueLogic;\n }\n\n public async placeOrder() {\n const planData = await this._glueLogic.savePlanSnapshot();\n if (!planData) {\n console.error('Could not save plan snapshot before placing order');\n return;\n }\n const hiCallbacks = this._glueLogic.hiCallbacks;\n\n let groupData = await this._glueLogic.getGroupDataForOrder(planData.id);\n let order = createEmptyOrder();\n order.items.push(groupData as never);\n\n const priceData = await hiCallbacks?.onFetchPrice(order);\n\n if (priceData) {\n order = priceData.orderData;\n groupData = order.items[0];\n } else {\n order.items.push(groupData as never);\n await _addMerchantPositions(this._roomlePlanner, groupData);\n }\n // Add the images to the group\n if (!Array.isArray(groupData.additionalData)) {\n groupData.additionalData = [];\n }\n if (planData.perspectiveImageLink) {\n groupData.additionalData.push({\n type: 'Image',\n category: 'OverviewImage',\n downloadUri: planData.perspectiveImageLink,\n });\n }\n if (planData.topImageLink) {\n groupData.additionalData.push({\n type: 'Image',\n category: 'AboveImage',\n downloadUri: planData.topImageLink,\n });\n }\n if (planData.room3dLink) {\n groupData.additionalData.push({\n type: 'ThreeD',\n category: 'ThreeDModel',\n downloadUri: planData.room3dLink,\n });\n }\n\n await hiCallbacks?.onPlaceOrder(order);\n }\n\n public async fetchPrice(planId?: string) {\n let groupData = await this._glueLogic.getGroupDataForOrder(planId);\n let order = createEmptyOrder();\n order.items.push(groupData as never);\n return this._glueLogic.hiCallbacks?.onFetchPrice(order);\n }\n}\n","import type { HiCallbacks } from '../../../../embedding-lib/src/embedding-lib';\nimport type {\n GlueLogic,\n LibraryData,\n PlanSnapshot,\n RoomDesignerRequests,\n} from './glue-logic';\nimport type { ExternalObjectGroup } from 'roomle-core-hsc/src/embind/plannerCoreInterface';\nimport type { ExternalModuleInformation } from '../../typings/kernel';\nimport type {\n CheckResult,\n PosArticle,\n PosGroup,\n PosSaveData,\n} from './model/oc-scripts-domain.model';\nimport type { HiObjectSelectionApi } from './hi-object-selection';\nimport type {\n ExternalObjectSnapshotSaveResult,\n ExternalRoomInformation,\n LoadExternalObjectOptions,\n} from './external-object-api';\nimport type { ExternalObjectValidContainerModules } from './external-object-api-callbacks';\n\nexport class GlueLayerRequestDebugLogging implements GlueLogic {\n private _glueLogic: GlueLogic;\n private _hiCallbacks: HiCallbacks;\n\n constructor(glueLogic: GlueLogic, hiCallbacks: HiCallbacks) {\n this._glueLogic = glueLogic;\n this._hiCallbacks = hiCallbacks;\n }\n\n public get hiCallbacks(): HiCallbacks | null {\n return this._hiCallbacks;\n }\n\n public get hiObjectSelection(): HiObjectSelectionApi {\n return this._glueLogic.hiObjectSelection;\n }\n\n private _logRequest(message: string, ...args: Array<string | null>) {\n let messageAndArgs = message;\n if (args) {\n args.forEach((item) => {\n messageAndArgs += ' ' + item;\n });\n }\n this._hiCallbacks.onLogMessage?.('HI REQUEST', messageAndArgs);\n }\n\n public isLibraryLoaded(libraryId: string): boolean {\n return this._glueLogic.isLibraryLoaded(libraryId);\n }\n\n public getLibraryData(libraryId: string): LibraryData | null {\n return this._glueLogic.getLibraryData(libraryId);\n }\n\n public addLibrary(libraryData: LibraryData): void {\n this._logRequest('addLibrary', libraryData.libraryId);\n this._glueLogic.addLibrary(libraryData);\n }\n\n public setPosDataForLoading(posData: PosSaveData | null): void {\n this._logRequest('setPosDataForLoading', posData ? 'set' : 'null');\n this._glueLogic.setPosDataForLoading(posData);\n }\n\n public loadPosData(articleCatalogJson: any, libraryId: string): void {\n this._logRequest('loadPosData', libraryId);\n this._glueLogic.loadPosData(articleCatalogJson, libraryId);\n }\n\n public mergeGroups(\n targetGroup: ExternalObjectGroup,\n idsOfGroupsMerged: string | string[],\n idOfTargetRootModule: string,\n ): void {\n this._logRequest(\n 'mergeGroups',\n targetGroup.groupId,\n JSON.stringify(idsOfGroupsMerged),\n idOfTargetRootModule,\n );\n this._glueLogic.mergeGroups(\n targetGroup,\n idsOfGroupsMerged,\n idOfTargetRootModule,\n );\n }\n\n public deleteRootModule(\n remainingGroup: ExternalObjectGroup,\n rootModuleIdToDelete: string,\n splitOffGroups: ExternalObjectGroup[],\n ): void {\n this._logRequest(\n 'deleteRootModule',\n JSON.stringify(remainingGroup),\n rootModuleIdToDelete,\n JSON.stringify(splitOffGroups),\n );\n this._glueLogic.deleteRootModule(\n remainingGroup,\n rootModuleIdToDelete,\n splitOffGroups,\n );\n }\n\n public splitRootModuleFromGroup(\n splitGroup: ExternalObjectGroup,\n newGroupedRootModules: ExternalObjectGroup[],\n ): void {\n this._logRequest(\n 'splitRootModuleFromGroup',\n JSON.stringify(splitGroup),\n JSON.stringify(newGroupedRootModules),\n );\n this._glueLogic.splitRootModuleFromGroup(splitGroup, newGroupedRootModules);\n }\n\n public duplicateGroup(duplicatedGroup: ExternalObjectGroup): void {\n this._logRequest('duplicateGroup', duplicatedGroup.groupId);\n this._glueLogic.duplicateGroup(duplicatedGroup);\n }\n\n public modifyAttribute(\n groupId: string,\n moduleIdObjects: ExternalModuleInformation[],\n attributeName: string,\n value: string,\n ): void {\n this._logRequest(\n 'modifyAttribute',\n groupId,\n JSON.stringify(moduleIdObjects),\n attributeName,\n value,\n );\n this._glueLogic.modifyAttribute(\n groupId,\n moduleIdObjects,\n attributeName,\n value,\n );\n }\n\n public updateAttribute(\n rootModuleId: string,\n moduleId: string | null,\n attributeId: string,\n attributeValue: string | boolean,\n ): void {\n this._logRequest(\n 'updateAttribute',\n rootModuleId,\n moduleId,\n attributeId,\n attributeValue.toString(),\n );\n this._glueLogic.updateAttribute(\n rootModuleId,\n moduleId,\n attributeId,\n attributeValue,\n );\n }\n\n public getVerifiedAttributeOptions(\n moduleId: string,\n attributeIds?: string | string[],\n ): Promise<Record<string, CheckResult> | undefined> {\n this._logRequest(\n 'getVerifiedAttributeOptions',\n moduleId,\n attributeIds ? JSON.stringify(attributeIds) : '[]',\n );\n return this._glueLogic.getVerifiedAttributeOptions(moduleId, attributeIds);\n }\n\n public updateAdditionalInfo(\n rootModuleId: string,\n additionalInfo: string,\n ): void {\n this._logRequest('updateAdditionalInfo', rootModuleId, additionalInfo);\n this._glueLogic.updateAdditionalInfo(rootModuleId, additionalInfo);\n }\n\n public findValidSubArticles(posGroupIds: string[] | string): PosArticle[] {\n this._logRequest(\n 'findValidSubArticles',\n Array.isArray(posGroupIds) ? JSON.stringify(posGroupIds) : posGroupIds,\n );\n return this._glueLogic.findValidSubArticles(posGroupIds);\n }\n\n public getValidContainerModulesForSubArticle(\n posGroupIds: string[] | string,\n subArticleId: string,\n ): ExternalObjectValidContainerModules[] {\n this._logRequest(\n 'getValidContainerModulesForSubArticle',\n Array.isArray(posGroupIds) ? JSON.stringify(posGroupIds) : posGroupIds,\n subArticleId,\n );\n return this._glueLogic.getValidContainerModulesForSubArticle(\n posGroupIds,\n subArticleId,\n );\n }\n\n public addSubArticle(\n articleId: string,\n rootModuleId: string,\n parentModuleId: string,\n ): void {\n this._logRequest('addSubArticle', articleId, rootModuleId, parentModuleId);\n this._glueLogic.addSubArticle(articleId, rootModuleId, parentModuleId);\n }\n\n public swapRootModule(\n groupId: string,\n rootModuleId: string,\n articleId: string,\n ): void {\n this._logRequest('swapRootModule', groupId, rootModuleId, articleId);\n this._glueLogic.swapRootModule(groupId, rootModuleId, articleId);\n }\n\n public arrangeRootModulesOfGroup(changedGroup: ExternalObjectGroup): void {\n this._logRequest('arrangeRootModulesOfGroup', JSON.stringify(changedGroup));\n this._glueLogic.arrangeRootModulesOfGroup(changedGroup);\n }\n\n public changedGroupPlanningSituation(\n changedGroup: ExternalObjectGroup,\n ): void {\n this._logRequest('changedGroupPlanningSituation', changedGroup.groupId);\n this._glueLogic.changedGroupPlanningSituation(changedGroup);\n }\n\n public changedGroupFromHistory(\n posDataJson: PosGroup,\n reloadGroup: boolean,\n ): void {\n this._logRequest(\n 'changedGroupFromHistory',\n posDataJson.id,\n reloadGroup.toString(),\n );\n this._glueLogic.changedGroupFromHistory(posDataJson, reloadGroup);\n }\n\n public loadedGroup(posDataJson: PosGroup): void {\n this._logRequest('loadedGroup', posDataJson.id);\n this._glueLogic.loadedGroup(posDataJson);\n }\n\n public groupsCompletelyLoaded(): void {\n this._logRequest('groupsCompletelyLoaded');\n this._glueLogic.groupsCompletelyLoaded();\n }\n\n public removedGroup(groupId: string): void {\n this._logRequest('removedGroup', groupId);\n this._glueLogic.removedGroup(groupId);\n }\n\n public openCloseGroup(groupId: string): void {\n this._logRequest('openCloseGroup', groupId);\n this._glueLogic.openCloseGroup(groupId);\n }\n\n public getSaveDataGroups(): Promise<PosGroup[] | null> {\n this._logRequest('getSaveDataGroups');\n return this._glueLogic.getSaveDataGroups();\n }\n\n public async newPosDataFromId(id: string): Promise<PosGroup> {\n this._logRequest('newPosDataFromId', id);\n return this._glueLogic.newPosDataFromId(id);\n }\n\n public async newPosDataFromGroup(posDataJson: PosGroup): Promise<PosGroup> {\n this._logRequest('newPosDataFromId', JSON.stringify(posDataJson));\n return this._glueLogic.newPosDataFromGroup(posDataJson);\n }\n\n public getGroupDataForOrder(roomlePlannerId?: string): Promise<any> {\n this._logRequest('getGroupDataForOrder', roomlePlannerId);\n return this._glueLogic.getGroupDataForOrder(roomlePlannerId);\n }\n\n public savePlanSnapshot(): Promise<PlanSnapshot | null> {\n this._logRequest('savePlanSnapshot');\n return this._glueLogic.savePlanSnapshot();\n }\n}\n\nexport class GlueLayerResponseDebugLogging implements RoomDesignerRequests {\n private _roomDesignerRequests: RoomDesignerRequests;\n private _hiCallbacks: HiCallbacks;\n\n constructor(\n roomDesignerRequests: RoomDesignerRequests,\n hiCallbacks: HiCallbacks,\n ) {\n this._roomDesignerRequests = roomDesignerRequests;\n this._hiCallbacks = hiCallbacks;\n }\n\n private _logResponse(message: string, ...args: Array<string | null>) {\n let messageAndArgs = message;\n if (args) {\n args.forEach((item) => {\n messageAndArgs += ' ' + item;\n });\n }\n this._hiCallbacks.onLogMessage?.('HI RESPONSE', messageAndArgs);\n }\n\n public loadMasterData(masterData: any): void {\n this._logResponse('loadMasterData');\n this._roomDesignerRequests.loadMasterData(masterData);\n }\n\n public async loadPosGroups(\n posDataJson: PosGroup | PosGroup[],\n options: LoadExternalObjectOptions,\n ): Promise<void> {\n const groupIds = Array.isArray(posDataJson)\n ? posDataJson.map((group) => group.id).join(',')\n : posDataJson.id;\n this._logResponse(\n 'loadPosGroups',\n groupIds,\n options.newAction?.toString() ?? 'false',\n options.findFreeSpaceInPlan?.toString() ?? 'false',\n options.correctArrangement?.toString() ?? 'false',\n options.moduleIdMap ? JSON.stringify(options.moduleIdMap) : '[]',\n options.mergedGroups ? JSON.stringify(options.mergedGroups) : '[]',\n options.respondWithPositionInPlan?.toString() ?? 'false',\n );\n return this._roomDesignerRequests.loadPosGroups(posDataJson, options);\n }\n\n public async selectGroup(groupId: string): Promise<void> {\n this._logResponse('selectGroup', groupId);\n return this._roomDesignerRequests.selectGroup(groupId);\n }\n\n public async selectRoot(rootModuleId: string): Promise<void> {\n this._logResponse('selectRoot', rootModuleId);\n return this._roomDesignerRequests.selectRoot(rootModuleId);\n }\n\n public async selectModule(\n rootModuleId: string,\n subModuleId: string,\n ): Promise<void> {\n this._logResponse('selectModule', rootModuleId, subModuleId);\n return this._roomDesignerRequests.selectModule(rootModuleId, subModuleId);\n }\n\n public openCloseGroup(\n groupOrRootModuleId: string,\n subModuleId: string | null,\n open: boolean,\n animate: boolean,\n ) {\n this._logResponse(\n 'openCloseGroup',\n groupOrRootModuleId,\n subModuleId,\n open.toString(),\n animate.toString(),\n );\n this._roomDesignerRequests.openCloseGroup(\n groupOrRootModuleId,\n subModuleId,\n open,\n animate,\n );\n return Promise.resolve();\n }\n\n public deleteGroup(groupId: string): void {\n this._logResponse('deleteGroup', groupId);\n return this._roomDesignerRequests.deleteGroup(groupId);\n }\n\n public deleteRootModule(rootModuleId: string): void {\n this._logResponse('deleteRootModule', rootModuleId);\n return this._roomDesignerRequests.deleteRootModule(rootModuleId);\n }\n\n public getPosDataOfAllGroups(): Promise<PosGroup[]> {\n this._logResponse('getPosDataOfAllGroups');\n return this._roomDesignerRequests.getPosDataOfAllGroups();\n }\n\n public getRoomInformation(): Promise<ExternalRoomInformation> {\n this._logResponse('getRoomInformation');\n return this._roomDesignerRequests.getRoomInformation();\n }\n\n public saveExternalObjectSnapshot(): Promise<ExternalObjectSnapshotSaveResult | null> {\n this._logResponse('saveExternalObjectSnapshot');\n return this._roomDesignerRequests.saveExternalObjectSnapshot();\n }\n}\n","import { RmlPlugin } from './rml-plugin';\nimport { RoomDesignerApi } from './api';\nimport type { GlueLogic } from './glue-logic';\nimport { GlueLogicImplementation, type LibraryData } from './glue-logic';\nimport { type HomagIntelligenceInitData } from './loader';\nimport { v4 as uuidv4 } from 'uuid';\nimport type {\n MasterData,\n PosArticle,\n PosGroup,\n PosModuleAttribute,\n PosModuleData,\n} from './model/oc-scripts-domain.model';\nimport { initCallbacks } from './callbacks';\nimport type RoomlePlanner from '../../planner-core/src/roomle-planner';\nimport Orders from './orders';\nimport type {\n ExternalConfiguration,\n ExternalItem,\n} from '../../typings/external-objects';\nimport type { HiTagCatalogCallbacks } from './hi-tag-catalog-callbacks';\nimport type { HiCallbacks } from '../../../../embedding-lib/src/embedding-lib';\nimport {\n GlueLayerRequestDebugLogging,\n GlueLayerResponseDebugLogging,\n} from './debug-logging';\nimport type { ExternalObjectValidContainerModules } from './external-object-api-callbacks';\n\ndeclare global {\n interface Window {\n uuidv4: () => string;\n }\n}\n\nconsole.warn('Homag Intelligence plugin is loaded.');\n\n// export const HOMAG_INTELLIGENCE_ENDPOINT = 'http://localhost:8080/proxy_request?url=';\n// export const HOMAG_INTELLIGENCE_ENDPOINT =\n// 'https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=';\n\nexport type ExternalObjects = Map<\n string,\n { id: string; label: string; items: any[] }\n>;\nexport type ExternalItems = Map<string, ExternalItem>;\nexport type ExternalConfigurations = Map<string, ExternalConfiguration>;\n\nexport class HomagIntelligence extends RmlPlugin {\n private _roomlePlanner: RoomlePlanner = null;\n private _api: RoomDesignerApi = null;\n private _glueLogic: GlueLogic = null;\n private _orders: Orders = null;\n\n constructor() {\n super();\n if (!window.uuidv4) {\n window.uuidv4 = uuidv4; // Ensure uuidv4 is available globally\n }\n }\n\n public async init(\n roomlePlanner: RoomlePlanner,\n hiOptions: HomagIntelligenceInitData,\n hiCallbacks: HiCallbacks,\n ): Promise<this> {\n this._roomlePlanner = roomlePlanner;\n this._roomlePlanner.setHomagIntelligence(this);\n this._api = new RoomDesignerApi(this._roomlePlanner);\n\n if (hiOptions?.debugLogging) {\n const api = new GlueLayerResponseDebugLogging(this._api, hiCallbacks);\n const glueLogic = new GlueLogicImplementation(api, hiCallbacks);\n this._glueLogic = new GlueLayerRequestDebugLogging(\n glueLogic,\n hiCallbacks,\n );\n } else {\n this._glueLogic = new GlueLogicImplementation(this._api, hiCallbacks);\n }\n initCallbacks(this._roomlePlanner, this._glueLogic);\n\n const savedPosGroupData =\n (await hiCallbacks.onGetSavedPosGroupData()) ?? null;\n this._glueLogic.setPosDataForLoading(savedPosGroupData);\n this._orders = new Orders(roomlePlanner, this._glueLogic);\n return this;\n }\n\n public async loadLibrary(libraryId: string) {\n if (!this._glueLogic) {\n throw new Error('GlueLogic not initialized');\n }\n const libraryData = await this._loadLibraryData(libraryId);\n this._glueLogic.addLibrary(libraryData);\n }\n\n public async loadCatalog(\n libraryId: string,\n articles: any,\n catalogCallbacks: HiTagCatalogCallbacks,\n ) {\n if (!this._glueLogic) {\n throw new Error('GlueLogic not initialized');\n }\n catalogCallbacks?.setEmulator(this._glueLogic);\n this._glueLogic.loadPosData(await articles, libraryId);\n }\n\n private async _loadLibraryData(libraryId: string): Promise<LibraryData> {\n if (this._glueLogic.isLibraryLoaded(libraryId)) {\n return this._glueLogic.getLibraryData(libraryId);\n }\n const hiCallbacks = this._glueLogic.hiCallbacks;\n const { masterData, libraryExports } = await this._requestHiLibrary(\n libraryId,\n hiCallbacks,\n );\n this._loadMasterData(masterData);\n const libraryData: LibraryData = {\n libraryId,\n masterData,\n posGroupVersion: 1,\n calculateGroup: (groupData: PosGroup): PosGroup => {\n return libraryExports.calc(groupData);\n },\n getOrderData: (groupData: PosGroup[], roomlePlannerId?: string): any => {\n return libraryExports.getOrderData(groupData, roomlePlannerId);\n },\n getAttributesDropDownValues: async (\n module: PosModuleData,\n attributeIds?: string | string[],\n ): Promise<Record<string, any[]>> => {\n const ids = attributeIds\n ? Array.isArray(attributeIds)\n ? attributeIds\n : [attributeIds]\n : module.attributes.map((attribute) => attribute.id);\n const attributeOptions: Record<string, any[]> = {};\n for (const attributeId of ids) {\n try {\n const options = libraryExports.getAttributesDropDownValues(\n module,\n attributeId,\n );\n attributeOptions[attributeId] = options;\n } catch (error) {\n console.error(error);\n attributeOptions[attributeId] = [];\n }\n }\n return attributeOptions;\n },\n solveModuleAttributeConflict: (\n module: PosModuleData,\n attributeName: string,\n value: string | number | boolean,\n ): PosModuleAttribute[] | undefined => {\n if (!libraryExports.solveModuleAttributeConflict) {\n return undefined;\n }\n const results = libraryExports.solveModuleAttributeConflict(\n module,\n attributeName,\n value,\n );\n return results;\n },\n getValidSubArticles(\n calculatedPosGroup: PosGroup,\n articles: PosArticle[],\n masterData: MasterData,\n ): PosArticle[] {\n if (!libraryExports.getValidSubArticles) {\n return [];\n }\n const results = libraryExports.getValidSubArticles(\n calculatedPosGroup,\n articles,\n masterData,\n );\n return results;\n },\n getValidContainerModulesForSubArticle(\n calculatedPosGroup: PosGroup,\n subArticle: PosArticle,\n masterData: MasterData,\n ): ExternalObjectValidContainerModules[] {\n if (!libraryExports.getValidContainerModulesForSubArticle) {\n return [];\n }\n const results = libraryExports.getValidContainerModulesForSubArticle(\n calculatedPosGroup,\n subArticle,\n masterData,\n );\n return results;\n },\n addSubArticle(\n targetPosGroup: PosGroup,\n article: PosArticle,\n rootId: string,\n parentModuleId: string,\n ): PosGroup {\n if (!libraryExports.addSubArticle) {\n return targetPosGroup;\n }\n const results = libraryExports.addSubArticle(\n targetPosGroup,\n article,\n rootId,\n parentModuleId,\n );\n return results;\n },\n };\n return libraryData;\n }\n\n public async _requestHiLibrary(\n libraryId: string,\n hiCallbacks: HiCallbacks,\n ): Promise<{\n masterData: MasterData;\n libraryExports: any;\n }> {\n if (!this._glueLogic) {\n throw new Error('GlueLogic not initialized');\n }\n const [masterData, calcScriptString] = await Promise.all([\n hiCallbacks.onLoadMasterData(libraryId),\n hiCallbacks.onLoadJavascript(libraryId),\n ]);\n const libraryExports = await this._initCalcScript(calcScriptString);\n return {\n masterData,\n libraryExports,\n };\n }\n\n private _loadMasterData(masterData: MasterData): void {\n if (!this._api) {\n throw new Error('API not initialized');\n }\n return this._api.loadMasterData(masterData);\n }\n\n private async _initCalcScript(scriptText: string): Promise<any> {\n try {\n window.exports = {};\n const blob = new Blob([scriptText], { type: 'text/javascript' });\n const blobUrl = URL.createObjectURL(blob);\n await import(blobUrl);\n URL.revokeObjectURL(blobUrl); // dispose of it when done\n return window.exports;\n } catch (e) {\n console.error(e);\n throw new Error('Failed to load calc.js!');\n }\n }\n\n public getGlueLogic(): GlueLogic {\n return this._glueLogic;\n }\n\n public async placeOrder() {\n await this._orders.placeOrder();\n }\n\n public async fetchPrice(planId?: string) {\n return this._orders.fetchPrice(planId);\n }\n}\n"],"names":["RmlPlugin","RoomDesignerApi","roomlePlanner","masterData","posDataJson","options","posDataArray","groupId","rootModuleId","subModuleId","groupOrRootModuleId","open","animate","UI_ELEMENTS","HI_PANEL_ACTION","HI_SELECTION_TYPE","HI_SELECTION_MODE","HiObjectSelection","callbacks","BASE_CONTEXT","viewName","context","reason","selectionMode","objectType","payload","_payloadPromise","_planElementViewModel","initiatingContext","mode","type","panelAction","showAttributes","GlueLogicImplementation","designerRequests","hiCallbacks","data","libraryId","libraryData","articleCatalogJson","posDataGroup","articleId","posArticle","deepCopy","posData","allPosGroups","groupItem","id","isExtObjId","removeExtObjIdPrefix","posArticleGroup","posArticleRoot","emulatorGroupItem","error","_groupId","rootId","moduleId","remainingGroup","rootModuleIdToDelete","splitOffGroups","originalGroupData","group","root","newGroupsPosData","g","duplicatedGroup","duplicatedPosDataJson","duplicatedRoot","targetGroup","idsOfGroupsMerged","idOfTargetRootModule","sourceGroupIds","originalSourceGroupRoots","sourceGroupId","sourceGroupData","nonGeneratedRoots","rootModule","targetGroupData","existingRoot","r","deletedGroups","sourceRootModule","rootsToDock","implicitRelevantAttributes","m","a","attr","rootToDock","masterDataModule","attributeId","sourceRootAttribute","moduleAttribute","splitGroup","newGroupedRootModules","newGroups","changedGroup","calculatedGroup","historyGroup","reloadGroup","updatedGroup","groupsToBeLoaded","posDataToBeLoaded","newPosData","newGroupCreated","groupData","roomlePlannerId","posGroups","cnt","posGroup","roomInformation","changedGroupPosition","newGroupPosition","rootModulePositions","additionalGroupData","loadPosData","posDataCollection","newGroup","newGroupPosDataJson","splitOffRootModuleIds","splitOffRootModules","splitOffRootModule","remainingRoot","keepRootModuleIDs","posDataModule","subModule","res","calculatedPosDataJson","attributeValue","emulatorGroup","value","modifiedGroups","moduleIdObjects","attributeName","moduleIds","obj","attributeIds","moduleInfo","attributeOptions","checkResults","entry","additionalInfo","rootModuleToBeReplaced","newPosDataJson","notGeneratedRoots","newRootModule","modifiedGroup","rootModuleMapping","ids","module","conflictResults","conflictResult","attribute","attributeData","posGroupIds","possibleSubArticles","article","setOfArticles","subArticleId","subArticle","validContainers","setOfContainers","parentModuleId","planSnapshot","modules","subMod","addedPosGroups","changedPosGroups","deletedPosGroupIds","addedGroupsArray","changedGroupsArray","deletedPosGroupIdsArray","originalPosDataJson","calculatedResult","originalArticleGroup","calculatedGroupData","posArticleGroupRoot","p","byteToHex","i","unsafeStringify","arr","offset","getRandomValues","rnds8","rng","randomUUID","native","v4","buf","rnds","initCallbacks","gluLogic","groupIdToDelete","_rootModuleId","_subModuleIdToDelete","_sourceGroupId","_affectedGroupIds","groupPosData","groupPosDataJson","_args","payloadPromise","planElementViewModel","getISO8601Date","date","isoString","msPosition","baseTimestamp","offsetMinutes","offsetHours","offsetMins","offsetString","createEmptyOrder","_addMerchantPositions","planOverview","count","itemIds","acc","item","merchantItems","posNo","pos","Orders","glueLogic","planData","order","priceData","planId","GlueLayerRequestDebugLogging","message","args","messageAndArgs","GlueLayerResponseDebugLogging","roomDesignerRequests","groupIds","HomagIntelligence","uuidv4","hiOptions","api","savedPosGroupData","articles","catalogCallbacks","libraryExports","calculatedPosGroup","targetPosGroup","calcScriptString","scriptText","blob","blobUrl"],"mappings":";AAAO,MAAeA,EAAU;AAEhC;ACQO,MAAMC,EAAgD;AAAA,EAG3D,YAAYC,GAAkC;AAC5C,SAAK,iBAAiBA;AAAA,EACxB;AAAA,EAEO,eAAeC,GAAwB;AAC5C,SAAK,eAAe,6BAA6BA,CAAU;AAAA,EAC7D;AAAA,EAEA,MAAa,cACXC,GACAC,GACe;AACf,UAAMC,IAAe,MAAM,QAAQF,CAAW,IAC1CA,IACA,CAACA,CAAW;AAChB,UAAM,KAAK,eAAe,yBAAyBE,GAAcD,CAAO;AAAA,EAC1E;AAAA,EAEA,MAAa,YAAYE,GAAgC;AACvD,UAAM,KAAK,eAAe,0BAA0BA,CAAO;AAAA,EAC7D;AAAA,EAEA,MAAa,WAAWC,GAAqC;AAC3D,UAAM,KAAK,eAAe,+BAA+BA,CAAY;AAAA,EACvE;AAAA,EAEA,MAAa,aACXA,GACAC,GACe;AACf,UAAM,KAAK,eAAe;AAAA,MACxBD;AAAA,MACAC;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEO,eACLC,GACAD,GACAE,GACAC,GACA;AACA,gBAAK,eAAe;AAAA,MAClBF;AAAA,MACAD,KAAe;AAAA,MACfE;AAAA,MACAC;AAAA,IAAA,GAEK,QAAQ,QAAA;AAAA,EACjB;AAAA,EAEO,YAAYL,GAAiB;AAClC,SAAK,eAAe,qBAAqBA,CAAO;AAAA,EAClD;AAAA,EAEO,iBAAiBC,GAAsB;AAC5C,SAAK,eAAe,0BAA0BA,CAAY;AAAA,EAC5D;AAAA,EAEA,MAAa,wBAAwB;AAGnC,WADG,MAAM,KAAK,eAAe,wBAAA;AAAA,EAE/B;AAAA,EAEA,MAAa,qBAAq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U,CAAA;AACjB,YAAMC,IAAO,IAAI,KAAK,CAACD,CAAU,GAAG,EAAE,MAAM,mBAAmB,GACzDE,IAAU,IAAI,gBAAgBD,CAAI;AACxC,mBAAM,OAAOC,IACb,IAAI,gBAAgBA,CAAO,GACpB,OAAO;AAAA,IAChB,SAAS,GAAG;AACV,oBAAQ,MAAM,CAAC,GACT,IAAI,MAAM,yBAAyB;AAAA,IAC3C;AAAA,EACF;AAAA,EAEO,eAA0B;AAC/B,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAa,aAAa;AACxB,UAAM,KAAK,QAAQ,WAAA;AAAA,EACrB;AAAA,EAEA,MAAa,WAAWrB,GAAiB;AACvC,WAAO,KAAK,QAAQ,WAAWA,CAAM;AAAA,EACvC;AACF;","x_google_ignoreList":[7,8,9,10]}
|
|
1
|
+
{"version":3,"file":"homag-intelligence-B-l8gFNg.mjs","sources":["../../packages/homag-intelligence/src/rml-plugin.ts","../../packages/homag-intelligence/src/api.ts","../../../../src/configurator/embedding/types.ts","../../../common/src/utils/init-data.ts","../../../embedding-lib/src/embedding-lib.ts","../../packages/homag-intelligence/src/hi-object-selection.ts","../../packages/homag-intelligence/src/glue-logic.ts","../../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../../node_modules/uuid/dist/esm-browser/rng.js","../../../../node_modules/uuid/dist/esm-browser/native.js","../../../../node_modules/uuid/dist/esm-browser/v4.js","../../packages/homag-intelligence/src/callbacks.ts","../../packages/homag-intelligence/src/orders.ts","../../packages/homag-intelligence/src/debug-logging.ts","../../packages/homag-intelligence/src/homag-intelligence.ts"],"sourcesContent":["export abstract class RmlPlugin {\n public abstract init(...args: any[]): Promise<this>;\n}\n","import type { RoomDesignerRequests } from './glue-logic';\nimport type { MasterData, PosGroup } from './model/oc-scripts-domain.model';\nimport type { RoomlePlannerType } from '../../typings/external-objects';\nimport type { LoadExternalObjectOptions } from './external-object-api';\n\nexport interface ExternalObjectModuleIdMap {\n originalModuleId: string;\n newModuleId: string;\n}\n\nexport class RoomDesignerApi implements RoomDesignerRequests {\n private _roomlePlanner: RoomlePlannerType;\n\n constructor(roomlePlanner: RoomlePlannerType) {\n this._roomlePlanner = roomlePlanner;\n }\n\n public loadMasterData(masterData: MasterData) {\n this._roomlePlanner.loadExternalObjectMasterData(masterData);\n }\n\n public async loadPosGroups(\n posDataJson: PosGroup | PosGroup[],\n options: LoadExternalObjectOptions,\n ): Promise<void> {\n const posDataArray = Array.isArray(posDataJson)\n ? posDataJson\n : [posDataJson];\n await this._roomlePlanner.loadExternalObjectGroups(posDataArray, options);\n }\n\n public async selectGroup(groupId: string): Promise<void> {\n await this._roomlePlanner.selectExternalObjectGroup(groupId);\n }\n\n public async selectRoot(rootModuleId: string): Promise<void> {\n await this._roomlePlanner.selectExternalObjectRootModule(rootModuleId);\n }\n\n public async selectModule(\n rootModuleId: string,\n subModuleId: string,\n ): Promise<void> {\n await this._roomlePlanner.selectExternalObjectSubModule(\n rootModuleId,\n subModuleId,\n );\n }\n\n public openCloseGroup(\n groupOrRootModuleId: string,\n subModuleId: string | null,\n open: boolean,\n animate: boolean,\n ) {\n this._roomlePlanner.openOrCloseGeometryOfExternalObject(\n groupOrRootModuleId,\n subModuleId ?? null,\n open,\n animate,\n );\n return Promise.resolve();\n }\n\n public deleteGroup(groupId: string) {\n this._roomlePlanner.removeExternalObject(groupId);\n }\n\n public deleteRootModule(rootModuleId: string) {\n this._roomlePlanner.selectExternalObjectGroup(rootModuleId);\n }\n\n public async getPosDataOfAllGroups() {\n const groups =\n (await this._roomlePlanner.getExternalObjectGroups()) as PosGroup[];\n return groups;\n }\n\n public async getRoomInformation() {\n const rooms = await this._roomlePlanner.getExternalRoomInformation();\n return rooms;\n }\n\n public async saveExternalObjectSnapshot() {\n return this._roomlePlanner.saveExternalObjectSnapshot();\n }\n\n public async saveCurrentPlanSnapshot() {\n return this._roomlePlanner.saveCurrentPlanSnapshot();\n }\n\n public async renderPosDataImage(posDataJson: object) {\n const posDataArray = Array.isArray(posDataJson)\n ? posDataJson\n : [posDataJson];\n await this._roomlePlanner.renderImagesOfExternalObjectGroup(posDataArray);\n }\n}\n","import type {\n FeatureFlags,\n GlobalInitDataDefinition,\n InitDataDefinition,\n} from '@roomle/web-sdk/common-core/src/utils/shims';\nimport type {\n HexColorString,\n RapiConfiguratorSettings,\n RapiId,\n} from '@roomle/web-sdk/typings/rapi-types';\nimport type {\n Enumify,\n MEASUREMENT_SYSTEM,\n MEASUREMENT_UNIT,\n Nullable,\n TutorialData,\n} from '@/common/utils/types';\nimport type { ViewTypeState } from '@/common/store/sidebar-store';\nimport type { KernelPartList } from '@roomle/web-sdk/typings/kernel';\nimport type {\n INTERACTION_NOTIFICATIONS,\n NOTIFICATIONS,\n} from '@/common/components/utils/-utils/notifications';\nimport type { SidebarEventTypes } from '@/common/composables/use-event-emitter-listener';\n\nexport interface ThumbnailsSettings {\n collapsed: { desktop: ViewTypeState; mobile: ViewTypeState };\n expanded: { desktop: ViewTypeState; mobile: ViewTypeState };\n}\n\nexport enum UI_BUTTON {\n AR = 'ar',\n PARTLIST = 'partlist',\n MULTISELECT = 'multiselect',\n DIMENSIONS = 'dimensions',\n FULLSCREEN = 'fullscreen',\n RESETCAMERA = 'resetcamera',\n RENDERIMAGE = 'renderimage',\n ADDONS = 'addons',\n REQUESTPRODUCT = 'requestproduct',\n REQUESTPLAN = 'requestplan',\n SAVEDRAFT = 'savedraft',\n STARTCONFIGURE = 'startconfigure',\n PAUSECONFIGURE = 'pauseconfigure',\n FIRST_PERSON = 'firstperson',\n EXPORT_3D = 'export3d',\n ROTATE = 'rotate',\n SNAPPING = 'snapping',\n UNDO = 'undo',\n REDO = 'redo',\n PARTLIST_PLANNER = 'partlist_planner',\n PARTLIST_PRINT = 'partlist_print',\n PRODUCTLIST = 'productlist',\n TWO_D_VIEW = '2dview',\n ADD_ROOM = 'add_room',\n STARTPLANNER = 'startPlanner',\n THREE_D_VIEW = '3dview',\n CLOSE_VIEW = 'close_view',\n ADD_TO_BASKET = 'add_to_basket',\n VIEW_MODE = 'view_mode',\n ADD_MEASUREMENT_LINE = 'add_measurement_line',\n HELP_CENTER = 'help_center',\n LOAD_PRODUCT = 'load_product',\n CONFIGURE_IN_ROOM = 'configure_in_room',\n SWAP_PRODUCT = 'swap_product',\n}\n\nexport enum UI_ELEMENTS {\n BOTTOM_BAR = 'bottom_bar',\n PARTLIST_BOUNDS = 'partlist_bounds',\n INTERACTION_NOTES = 'interaction_notes',\n PARAMETER_GROUPS = 'parameter_groups',\n}\n\nexport interface HelpCenterSetting {\n configurator?: boolean;\n roomdesigner?: boolean;\n disable?: boolean;\n}\n\ninterface UiFeatureFlags extends FeatureFlags {\n realPartList?: boolean;\n globalCallbacks?: boolean;\n mocAr?: boolean;\n wallAutoHeight?: boolean;\n enableTwoLevelCatalog?: boolean;\n\n /**\n * @hidden\n * @description ...\n */\n imosix?: boolean;\n /**\n * @hidden\n * @description ...\n */\n prodmanager?: boolean;\n /**\n * @hidden\n * @description Enables the open/close animation button in the flying menu - RML-13533\n */\n openCloseAnimation?: boolean;\n}\n\nexport interface VariantsMap {\n [key: string]: RapiId;\n}\n\nexport type LogLevelCanvasCoords = 'all' | 'click' | 'move';\n\nexport interface UiInitData\n extends InitDataDefinition,\n GlobalInitDataDefinition {\n /**\n * @description show and hide certain buttons\n */\n buttons?: {\n [UI_BUTTON.AR]?: boolean;\n [UI_BUTTON.PARTLIST]?: boolean;\n [UI_BUTTON.MULTISELECT]?: boolean;\n [UI_BUTTON.DIMENSIONS]?: boolean;\n [UI_BUTTON.FULLSCREEN]?: boolean;\n [UI_BUTTON.RESETCAMERA]?: boolean;\n [UI_BUTTON.RENDERIMAGE]?: boolean;\n [UI_BUTTON.ADDONS]?: boolean;\n [UI_BUTTON.REQUESTPRODUCT]?: boolean;\n [UI_BUTTON.REQUESTPLAN]?: boolean;\n [UI_BUTTON.SAVEDRAFT]?: boolean;\n [UI_BUTTON.LOAD_PRODUCT]?: boolean;\n [UI_BUTTON.STARTCONFIGURE]?: boolean;\n [UI_BUTTON.PAUSECONFIGURE]?: boolean;\n [UI_BUTTON.EXPORT_3D]?: boolean;\n [UI_BUTTON.ROTATE]?: boolean;\n [UI_BUTTON.SNAPPING]?: boolean;\n [UI_BUTTON.UNDO]?: boolean;\n [UI_BUTTON.REDO]?: boolean;\n [UI_BUTTON.TWO_D_VIEW]?: boolean;\n [UI_BUTTON.PARTLIST_PLANNER]?: boolean;\n [UI_BUTTON.PARTLIST_PRINT]?: boolean;\n [UI_BUTTON.PRODUCTLIST]?: boolean;\n [UI_BUTTON.ADD_ROOM]?: boolean;\n [UI_BUTTON.STARTPLANNER]?: boolean;\n [UI_BUTTON.THREE_D_VIEW]?: boolean;\n [UI_BUTTON.FIRST_PERSON]?: boolean;\n [UI_BUTTON.CLOSE_VIEW]?: boolean;\n [UI_BUTTON.ADD_TO_BASKET]?: boolean;\n [UI_BUTTON.VIEW_MODE]?: boolean;\n [UI_BUTTON.ADD_MEASUREMENT_LINE]?: boolean;\n [UI_BUTTON.HELP_CENTER]?: boolean;\n [UI_BUTTON.CONFIGURE_IN_ROOM]?: boolean;\n [UI_BUTTON.SWAP_PRODUCT]?: boolean;\n [key: string]: boolean | undefined;\n };\n\n /**\n * @description show and hide certain elements\n */\n elements?: {\n [UI_ELEMENTS.BOTTOM_BAR]?: boolean;\n [UI_ELEMENTS.PARTLIST_BOUNDS]?: boolean;\n [UI_ELEMENTS.INTERACTION_NOTES]?: boolean;\n [UI_ELEMENTS.PARAMETER_GROUPS]?: boolean;\n [key: string]: boolean | undefined;\n };\n\n /**\n * @description show and hide certain notifications\n */\n notifications?: {\n [NOTIFICATIONS.LOAD_IDB_CONFIG]?: boolean;\n [NOTIFICATIONS.FIRST_PERSON_CONTROLS]?: boolean;\n [NOTIFICATIONS.STOP_CONFIGURE_HINT]?: boolean;\n [NOTIFICATIONS.INTERACTION_NOTE]?: {\n [INTERACTION_NOTIFICATIONS.ROOT_ELEMENT]?: boolean;\n [INTERACTION_NOTIFICATIONS.CONFIRM_GHOSTS]?: boolean;\n [INTERACTION_NOTIFICATIONS.ADD_ELEMENT]?: boolean;\n [INTERACTION_NOTIFICATIONS.PARAMETER_CHANGED]?: boolean;\n };\n [key: string]: boolean | { [key: string]: boolean | undefined } | undefined;\n };\n\n /**\n * @description skin the embedding instance\n */\n skin?: EmbeddingSkin;\n\n /**\n * @description set the z-index of the embedding instance\n */\n zIndex?: number;\n\n /**\n * @internal\n * @description use a local version of the embedding\n */\n useLocalRoomle?: boolean;\n\n /**\n * @internal\n * @description use another server url for the embedding\n */\n overrideServerUrl?: string;\n\n /**\n * @deprecated\n * @description for details see deeplink, the only change is\n * that the placeholder is <CONF_ID> here instead\n * of #CONFIGURATIONID#\n */\n shareUrl?: string;\n\n /**\n * @description Set this parameter to use your custom share url.\n * The provided url has to contain a configuration id parameter (`#CONFIGURATIONID#`) which will be replaced with the real\n * configuration id.\n * default: not set -> use Roomle short url service (linking to roomle.com domain)\n * usage: http://www.example.com/configurator?id=#CONFIGURATIONID#\n */\n deeplink?: string;\n\n /**\n * @description Define to which variants you can switch from which root component id. This is a simple JS object which is\n * used like a map, e.g.: '\"usm:frame\": \"DB_Start_ohne_Element\"' now if a configuration with root component\n * usm:frame is loaded all the items from the tag \"DB_Start_ohne_Element\" are now shown as variants\n */\n variants?: VariantsMap;\n\n /**\n * @description if set to true you can load the configurator in an iframe.src but without any embedding lib\n * This is needed if you do not want to interact with the configurator and only want to use it\n * to view 3d content. Imagine it then as a <img> tag for 3d content\n */\n api?: boolean;\n\n /**\n * @description if this is set to true the \"save draft\" will be done by sending\n * an e-mail\n */\n emails?: boolean;\n\n /**\n * @description set this flag to true if you want to configure on small devices in landscape as well\n * this is relevant for things like Rubens Admin, where the configurator is embedded into a very\n * small div\n */\n mobileLandscape?: boolean;\n\n /**\n * @description set this flag to true if you want to group the part list by main components\n */\n groupPartList?: boolean;\n\n /**\n * @internal\n * @description this is an object which is for Roomle internal usage, we can set feature flags\n * so that we can ensure a smooth transition between different versions of our configurator\n */\n featureFlags?: UiFeatureFlags;\n\n /**\n * @description set this flag to false if the user did not give the consent to Analytics\n */\n gaConsent?: boolean;\n\n /**\n * @description override translations to change labels for some or all languages.\n * Example:\n *\n * ```\n * \"translations\": {\n * \"en\": {\n * \"params\": {\n * \"request-product\": \"Add to cart\",\n * }\n * }\n * }\n * ```\n *\n * You can find all labels here: [Base.json](../translate-labels)\n */\n translations?: any;\n\n /**\n * @description set this flag to false and global parameters are not applied when switching variants\n */\n applyCurrentGlobalParameters?: boolean;\n\n /**\n * @description set this flag to true if you want that a user can select more than one material category at once\n */\n materialMultiSelect?: boolean;\n\n /**\n * @description set this flag to true if you want to start the moc in configuring mode if there is only one object in the scene\n * @groups room-designer\n */\n startInDetail?: boolean;\n\n /**\n * @description set this flag to true if you want to load the configurator within the planner without being able to plan\n * @groups room-designer\n */\n plannerIsolationConfigurator?: boolean;\n\n /**\n * @description use this param to initialize the configurator ui state, like opening certain views, camera modes, etc\n * @groups room-designer\n */\n state?: UiState;\n\n /**\n * @description define the root tag of your catalog\n * you can define multiple root tags by using []\n * e.g.: catalogRootTag[]=123&catalogRootTag[]=456\n * @groups room-designer\n */\n catalogRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the construction elements, default is \"construction_moc\" when moc=true and null otherwise\n * you can define multiple root tags by using []\n * e.g.: constructionRootTag[]=123&constructionRootTag[]=456\n * @groups room-designer\n */\n constructionRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used for floors\n * you can define multiple root tags by using []\n * e.g.: floorMaterialRootTag[]=123&floorMaterialRootTag[]=456\n * @groups room-designer\n */\n floorMaterialRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used for walls\n * you can define multiple root tags by using []\n * e.g.: wallMaterialRootTag[]=123&wallMaterialRootTag[]=456\n * @groups room-designer\n */\n wallMaterialRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used for doors\n * you can define multiple root tags by using []\n * e.g.: doorMaterialRootTag[]=123&doorMaterialRootTag[]=456\n * @groups room-designer\n */\n doorMaterialRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used for windows\n * you can define multiple root tags by using []\n * e.g.: windowMaterialRootTag[]=123&windowMaterialRootTag[]=456\n * @groups room-designer\n */\n windowMaterialRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used for objects\n * you can define multiple root tags by using []\n * e.g.: objectMaterialRootTag[]=123&objectMaterialRootTag[]=456\n * @groups room-designer\n */\n objectMaterialRootTag?: RapiId | RapiId[];\n\n /**\n * @description define the root tag of the materials that can be used, this sets\n * floorMaterialRootTag, wallMaterialRootTag, doorMaterialRootTag,\n * windowMaterialRootTag, objectMaterialRootTag\n * if they are not set\n * you can define multiple root tags by using []\n * e.g.: materialRootTag[]=123&materialRootTag[]=456\n * @groups room-designer\n */\n materialRootTag?: RapiId | RapiId[];\n\n /**\n * @description sets the measurement unit to be displayed in the planner and configurator UI.\n */\n unit?: Enumify<typeof MEASUREMENT_UNIT>;\n\n /**\n * @description sets the measurement unit to be displayed in the planner and configurator UI.\n * imperial sets measurementUnit to inches if no unit is passed\n * metric sets measurementUnit to cm if no unit is passed\n * if unit is not a metric unit (i.e. inch) but unitType=metric it will default to a metric unit (CM)\n * and vice-versa\n */\n measurementSystem?: Enumify<typeof MEASUREMENT_SYSTEM>;\n\n /**\n * @description the query param thumbnails will be converted to the following object:\n * ```\n * {\n * collapsed: { desktop: ViewTypeState; mobile: ViewTypeState };\n * expanded: { desktop: ViewTypeState; mobile: ViewTypeState };\n * }\n * ```\n *\n * You have separate options to specify the settings for the thumbnails e.g.:\n * ?thumbnails=big this sets all the values to \"big\" or you do:\n * ?thumbnails.collapsed=big&thumbnails.expanded=list this sets the collapsed\n * state to \"big\" and the expanded state to \"list\". Or you can specify the full\n * object like:\n * ?thumbnails.collapsed.desktop=big&thumbnails.collapsed.mobile=small&thumbnails.expanded.desktop=list&thumbnails.expanded.mobile=big\n *\n * the following values for ViewTypeState are valid: list | small | big\n * for the collapsed state list will have no effect and just be rendered like small.\n * On mobile collapsed will only use small\n */\n thumbnails?: ThumbnailsSettings;\n\n /**\n * @description start embedding instance only as viewer\n */\n viewer?: boolean;\n\n /**\n * @description use an external catalog (deprecated, use customView.extCatalog instead)\n * @deprecated\n * @groups room-designer\n */\n extCatalog?: string;\n\n /**\n * @description specify a custom font to be used. When using a custom font make sure you understand\n * the legal implications. For example: copyrigth law, data protection law, etc.\n * - source needs to be a valid url to a font file CSS.\n * Similar to what Google Fonts provides. For an example see:\n * https://fonts.googleapis.com/css?family=Lato:300,400,700&display=swap&subset=latin-ext\n * The font should provide the following weights: 300, 400, 700\n * If you use the URL as a query param make sure to use encodeURIComponent\n * - family needs to be a valid CSS font family name.\n * If you use font family as a query param make sure to use encodeURIComponent\n */\n fonts?: {\n source?: string;\n family?: string;\n };\n\n /**\n * @description Shows or hides the first person mode toggle button in the sidebar menu\n * @groups room-designer\n */\n firstPersonView?: boolean;\n\n /**\n * @description Specify which context (i.e room designer or configurator or neither) to show the tutorial/helpcenter\n * button in the sidebar.\n */\n helpcenter?: HelpCenterSetting;\n\n /**\n * @description Specify custom tutorials to be shown in the tutorial/helpcenter.\n * Should be of the following format:\n * [{\n * \"en\": { // mandatory\n * \"link\": \"SOME_LINK\",\n * \"label\": \"first step\",\n * \"desc\": \"some description\",\n * },\n * \"de\": { // optional\n * \"link\": \"SOME_LINK\",\n * \"label\": \"first step\",\n * \"desc\": \"some description\",\n * },\n * \"SOME_OTHER_LOCALE\": { // optional --> SOME_OTHER_LOCALE should be a valid locale from: https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes\n * \"link\": \"SOME_LINK\",\n * \"label\": \"first step\",\n * \"desc\": \"some description\",\n * },\n * \"scope\": \"room-designer\", // optional\n * \"platform\": \"desktop\" // optional\n * }]\n */\n customTutorials?: TutorialData[];\n\n /**\n * @description Enables saving changes to the current configuration and or plan to indexedDB storage locally in the\n * browser, reloading the page will prompt the user to restore the saved configuration/plan.\n * - The data saved in indexedDB is stored in a key-value pair under the database 'rml-idb' and the table\n * named 'rml-config-store' where the key consists of the current hostname (if inside an iframe it will be 'window.referrer'),\n * the configurator ID and the plan or configurator ID separated by underscores (_).\n * - This key format allows saved data to be scoped by the aforementioned IDs and hostname.\n * - The data stored in 'rml-config-store' follows the following format:\n * {\n * \"id\": \"example.com_exampleConfiguratorId_examplePlanOrConfigurationId\",\n * \"data\": \"<...configurationOrPlanDataString...>\",\n * \"lastModified\": \"2024-04-16T04:54:48.825Z\"\n * \"referrer\": \"example.com\"\n * }\n * - Any data in the 'rml-idb' database older than 30 days is removed automatically when the app loads.\n */\n saveToIdb?: boolean;\n\n /**\n * @description when the configurator/Room Designer is embedded into a too small space we start it in view\n * only mode, then the user has to click the \"start\" button and the configurator/Room Designer expands over\n * the whole window. This is great for UX, but it's not always ideal in every use case. Therefore, you can\n * force either behaviour by setting autoStart to true or false.\n *\n * default: true if screen with is bigger than 1024px otherwise false\n */\n autoStart?: boolean;\n\n /**\n * @internal\n * @description if set to true the coords of the clicks on the canvas will be logged to the console\n */\n logCanvasCoords?: LogLevelCanvasCoords;\n\n /**\n * @description For use with planner only, if set to true the room will be shown while configuring a configurable object.\n */\n configureInRoom?: boolean;\n\n /**\n * @internal\n * @description Keeps the interaction container collapsed.\n * This is only used if the room designer is embedded in the technical configurator. (BO PoC 2)\n */\n interactionsCollapsed?: boolean;\n\n /**\n * @description define when you want to show the search bar, currently we hide the search bar until there are more than 10 elements.\n * since it is a query param the value is a string. Please only provide a string that can be parseInt(x,10) otherwise it will be\n * undefined behavior\n */\n searchThreshold?: string;\n\n /**\n * @description Sets the rotation indicator to snap a plan object to the nearest supplied degree value while being rotated, default is 10 degrees.\n * Supplying 0 will allow the rotation indicator to rotate plan object freely.\n */\n rotationSnapDegrees?: number;\n\n /**\n * @description specify an url which can be used as src for an iframe\n */\n customView?: CustomViews;\n\n /**\n * @internal\n * @description specify if Room Designer functionality should be active\n */\n roomDesignerActive?: boolean;\n}\n\nexport interface UiState {\n /**\n * define which modes are active when starting the planner/MOC\n */\n mode?: 'room' | 'catalog';\n}\n\nexport interface EmbeddingSkin {\n 'primary-color'?: HexColorString;\n 'primary-color-in-rgb'?: HexColorString;\n 'color-on-primary'?: HexColorString;\n 'cta-color'?: HexColorString;\n 'color-on-cta'?: HexColorString;\n\n [key: string]: HexColorString | undefined;\n}\n\nexport interface ConfiguratorSettings extends RapiConfiguratorSettings {\n id: string;\n allowedHost: string;\n tenant: number;\n url: string;\n settings: UiInitData;\n}\n\ninterface PartlistPrintPayload {\n partList: KernelPartList[];\n price: Nullable<string>;\n label: string;\n bounds: string;\n catalogLabel: Nullable<string>;\n}\n\ntype CallbackPayloads = {\n [UI_BUTTON.PARTLIST_PRINT]: PartlistPrintPayload;\n};\n\ntype DefaultCallbackPayloads<T, U extends string> = {\n [K in U]: K extends keyof T ? T[K] : void;\n};\n\nexport type ButtonCallbackPayloads = DefaultCallbackPayloads<\n CallbackPayloads,\n UI_BUTTON\n>;\n\ninterface CustomViewSettingsBase<T> {\n options?: T;\n}\n\nexport interface CustomViewSettingsForOverlay<T>\n extends CustomViewSettingsBase<T> {\n overlay: boolean;\n}\n\nexport interface CustomViewSettingsForIframe<T>\n extends CustomViewSettingsBase<T> {\n url: string;\n}\n\nexport type CustomViewSettings<T> =\n | CustomViewSettingsForOverlay<T>\n | CustomViewSettingsForIframe<T>;\n\nexport interface CustomViews {\n itemSelection?: CustomViewSettings<object>;\n extCatalog?: CustomViewSettings<{\n showHeader: boolean;\n }>;\n}\n\nexport interface CustomViewsCallbacks {\n itemSelection: void;\n extCatalog: void;\n}\n\n// Idea is inspired by: https://roomle.slack.com/archives/GQD67DDC5/p1730291049755199\n// or: https://www.learningtypescript.com/articles/narrowing-function-parameters-with-rests-and-tuples\n// or: https://www.typescriptlang.org/play/?#code/C4TwDgpgBAogbhAdsAsgQzFAvFA3gKCigHtJEAuKRAVwFsAjCAJwG5CoBjAG2IGcJKvYEwCWiAOZsAvm3wB6OVFCRYCZAElEAM2LYoAbQDkpJIYA0VOoyYBdKAB8Dh7nwjmoQ0RJttl0eEjAmjp6BET6ANJQYlAA1hAgxFqqgehgNpT6EGrAiGi0AlARFtmBAIJM4ryUAchpkTY++FL68YnJtagYTex+UADCaFxc9GgcsXoAPOxEACpQEAAewEgAJrxxCUkpdRgWClCTALRQ82DEYsAbwLpomyAzUABKC8trG531s3YHx89Q50u110wAAFtA-OwAHwAClKyAAcvlCrMLKRgCJiIhqs8AJTYKFQOAXVb4fAcLFCKBoVarPQwmi0SiM6z4rCExlQADUllobAp2OAnCxHDQQpwMM8gmEYnEbMJnm5HmEsgFVNFw1G43pADo9fo8gU0WAMZSMjsgtpiLjKMSRHT2Xh2CJkgzkdgsDhjGRDPiwkRqbSYejMdjcSwoAdAKDkUAA7sQmLENoxRdR+EpwNBtgADEOU7PRDZiLTMJgQOkUphljjALgPAPCxCi4DBk2h3jhyOKQC8G4BSnagWjQIi4yYgqfTfRzeexBZERe0pfLwqrY9r9agUgWI+gLqgboKHq9Ln4vqdDbVxC4EB1PHErdN2J1NwAqmBIExBvwYbjO9G4wmkygFM0DTCFMxIZJczbfNC2iBcVwrBNqzXR4aVWe921-Ht+0HYdR3HMCVCnaCZ1g4tF0QlcazrdgpGaMkDhgRZ8jAK8oDTNBxAgckhhGMZYhhb1TAsABGAAGTsGykgM-wANSGe1KHE2C7hZZgeM1fjBJMRB3EMXhiAKAB9TxZV9CMuygPsoAAMSHEcgLHED02nDZQTQBAlF0RheWsaJki0EQmCpMA0CYZEViYWChN0jS+PGQTjzcCxDB0YhzOkmTFBjeSuEUqBUuIdKVOVLxxDirUBOcHgT1EgAmSTMqyqz+zsvDHIIkgSLcjyIW86BTIkfyByCkKwoi5hoqSwx8CAA\nexport type CustomViewCallbackInfo = {\n [K in keyof CustomViewsCallbacks]: [\n viewName: K,\n viewArgs: CustomViewsCallbacks[K],\n ];\n}[keyof CustomViewsCallbacks];\n\nexport type PossibleCustomViewSettings = CustomViews[keyof CustomViews];\n\nexport type PossibleCustomViews = keyof CustomViews;\nexport type PossibleCustomViewsAndMain = PossibleCustomViews | 'main';\n\nexport type SidebarEventCallbackInfo = {\n [K in keyof SidebarEventTypes]: SidebarEventTypes[K] extends void\n ? [viewName: K] | [viewName: K, viewArgs: void]\n : [viewName: K, viewArgs: SidebarEventTypes[K]];\n}[keyof SidebarEventTypes];\n","import { getHostname, isDemoHostname } from '#/common/src/utils/domain';\nimport { isIdAnItem } from '#/common/src/utils/id-inferrer';\n\nimport { getLanguage } from '#/common/src/utils/browser';\n\nimport { deepMergeCopy } from '#/common/src/utils/merge';\nimport { HANDSHAKE_MESSAGES } from '#/common/src/utils/embedding';\n\nimport {\n UI_ELEMENTS,\n type ConfiguratorSettings,\n type PossibleCustomViews,\n type PossibleCustomViewSettings,\n type UiInitData,\n} from '@/configurator/embedding/types';\nimport type { MessageHandler } from '#/common/src/utils/message-handler';\nimport type RapiAccess from '@roomle/web-sdk/common-core/src/rapi-access';\nimport type { Nullable } from '@/common/utils/types';\nimport type { RoomleSdkWrapper } from '@/configurator/business-logic/roomle-sdk-wrapper';\nimport { deepCopy } from '#/common/src/utils/json';\n\nexport const cleanUpInitData = (\n key: keyof UiInitData,\n initData: UiInitData,\n) => {\n if (Array.isArray(initData[key]) && initData[key].length === 0) {\n delete initData[key];\n }\n};\n\nexport const FALLBACK_INIT_DATA: UiInitData = {\n mobileLandscape: true,\n floorMaterialRootTag: 'materials_root',\n buttons: {\n renderimage: true,\n requestproduct: true,\n requestplan: true,\n load_product: true,\n partlist_print: true,\n },\n elements: {\n [UI_ELEMENTS.INTERACTION_NOTES]: true,\n },\n helpcenter: {\n roomdesigner: true,\n configurator: false,\n disable: false,\n },\n firstPersonView: true,\n saveToIdb: true,\n featureFlags: {\n mocAr: true,\n wallAutoHeight: false,\n openCloseAnimation: true,\n enableTwoLevelCatalog: false,\n webGpu: false,\n },\n rotationSnapDegrees: 10,\n interactionsCollapsed: false,\n};\n\nexport const CONFIGURATOR_IDLE = '(idle)';\n\n// not supporting IE11: https://caniuse.com/#feat=urlsearchparams\nexport const getInitData = (useFallbackId = true): UiInitData => {\n const urlParams = new URLSearchParams(window.location.search);\n // cast to any because it comes from URL params after this method initData\n // has the correct shape (types, names etc)\n // !!! WARNING THIS FETCHES THE PARAMETERS FROM THE QUERY STRING !!!\n // !!! THE QUERY STRINGS HAVE THE HIGHEST PRIO, IF YOU SET A FALLBACK !!!\n // !!! VALUE HERE IT WILL OVERRIDE ALL THE OTHER INIT DATA !!!\n\n // !!! SET DEFAULT VALUES INSIDE getFallbackInitData() !!!\n let initData: any = {};\n\n urlParams.forEach((value, key) => setProperty(initData, key, value));\n castInitData(initData);\n if (!useFallbackId) {\n return initData as UiInitData;\n }\n if (!initData.id) {\n initData.id = 'usm:frame';\n }\n if (initData.isItem === undefined) {\n initData.isItem = isIdAnItem(initData.id);\n }\n\n initData = mergeStringArrays(initData);\n\n return initData as UiInitData;\n};\n\nexport const castAndFixInitData = (initData: UiInitData): UiInitData => {\n castInitData(initData);\n if (initData?.customApiUrl) {\n initData.customApiUrl = decodeURIComponent(initData.customApiUrl);\n }\n\n if (initData.shareUrl) {\n initData.deeplink = initData.shareUrl.replace(\n LEGACY_SHARE_PLACEHOLDER,\n SHARE_PLACEHOLDER,\n );\n }\n return initData;\n};\n\nexport const mergeStringArrays = (initData: any): any => {\n const mergedInitData: { [key: string]: any } = {};\n\n try {\n for (const key in initData) {\n const [parsedKey, indexStr] = key.split('[');\n if (indexStr && indexStr.endsWith(']')) {\n const index = parseInt(indexStr.substring(0, indexStr.length - 1), 10);\n mergedInitData[parsedKey] = mergedInitData[parsedKey] || [];\n mergedInitData[parsedKey][index] = initData[key];\n } else {\n mergedInitData[key] = initData[key];\n }\n }\n } catch (e) {\n console.error('Failed to merge initData keys ', e);\n return initData;\n }\n\n return mergedInitData;\n};\n\nexport const castInitData = (obj: Nullable<{ [key: string]: any }>): void => {\n if (!obj) {\n return;\n }\n const keys = Object.keys(obj);\n for (const key of keys) {\n const value = obj[key];\n // need to type-check for null because typeof null evaluates to object\n // see here why this is like it is: https://2ality.com/2013/10/typeof-null.html\n if (!Array.isArray(value) && typeof value === 'object' && value !== null) {\n castInitData(value);\n }\n if (Array.isArray(value)) {\n for (const entry of value) {\n castInitData(entry);\n }\n }\n\n if (value === 'true' || value === 'false') {\n obj[key] = value === 'true';\n }\n }\n};\n\nexport const mergeInitData = (\n configuratorSettings:\n | ConfiguratorSettings\n | { id: string; settings: UiInitData },\n currentInitData: UiInitData,\n): UiInitData => {\n currentInitData.configuratorId = configuratorSettings.id;\n const remoteInitData = configuratorSettings.settings || {};\n // This is a performance optimization so we do not need to fetch\n // configurator settings twice\n if (\n !currentInitData.overrideTenant &&\n (configuratorSettings as ConfiguratorSettings).tenant\n ) {\n // use as any because we send tenant id as string but SDK requires to send a number\n // casting to number could become a problem when we change tenant IDs to something\n // random instead of a integer which is incremented\n (currentInitData as any).overrideTenant = (\n configuratorSettings as ConfiguratorSettings\n ).tenant;\n }\n return deepMergeCopy(remoteInitData, currentInitData);\n};\n\nexport const getEmbeddingInitData = async (\n messageHandler: MessageHandler,\n): Promise<UiInitData> => {\n const initData = await messageHandler.sendMessage(\n HANDSHAKE_MESSAGES.REQUEST_BOOT,\n );\n if (initData.id && initData.isItem === undefined) {\n initData.isItem = isIdAnItem(initData.id);\n }\n // @schobi check where we can set global-init-data so that it's also available for getConfiguratorSettings\n // sdkWrapper.setGlobalInitData(initData);\n // This code sets tenant correctly also for old embedding.js lib versions\n // if (!initData.overrideTenant && initData.configuratorId) {\n // const {tenant} = await rapiAccess.getConfiguratorSettings(initData.configuratorId) as ConfiguratorSettings;\n // if (tenant) {\n // initData.overrideTenant = tenant;\n // }\n // }\n return castAndFixInitData(initData);\n};\n\nexport const getRemoteInitData = async (\n rapiAccess: RapiAccess,\n): Promise<UiInitData> => {\n const {\n id,\n tenant,\n settings = {},\n } = (await rapiAccess.getConfiguratorSettings()) as ConfiguratorSettings;\n const remoteInitData = settings as UiInitData;\n remoteInitData.configuratorId = id;\n if (!remoteInitData.overrideTenant && tenant) {\n // use as any because we send tenant id as string but SDK requiers to send a number\n // casting to number could become a problem when we change tenant IDs to something\n // random instead of a integer which is incremented\n remoteInitData.overrideTenant = tenant;\n }\n return castAndFixInitData(remoteInitData);\n};\n\nexport const getFallbackInitData = () => {\n const fallbackInitData = deepCopy(FALLBACK_INIT_DATA);\n if (!fallbackInitData.locale) {\n fallbackInitData.locale = getLanguage();\n }\n if (fallbackInitData.id === CONFIGURATOR_IDLE) {\n delete fallbackInitData.id;\n }\n\n const hostname = getHostname();\n if (hostname && isDemoHostname(hostname)) {\n fallbackInitData.configuratorId = 'demoConfigurator';\n }\n\n fallbackInitData.customApiUrl = import.meta.env.VITE_RAPI_URL as string;\n fallbackInitData.emails = false;\n return fallbackInitData as UiInitData;\n};\n\nexport const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';\nexport const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';\n\n/**\n * combines init data in this order: query params > embedding > remote > fallback\n *\n * some exceptions to consider:\n * - tenant: when do we need the tenant and where do we get it from?\n *\n * @param messageHandler\n * @param sdkWrapper\n * @param queryParamsInitData\n */\nexport const combineInitData = async (\n messageHandler: Nullable<MessageHandler>,\n sdkWrapper: RoomleSdkWrapper,\n queryParamsInitData: UiInitData,\n): Promise<UiInitData> => {\n castAndFixInitData(queryParamsInitData);\n const fallbackInitData = getFallbackInitData();\n\n let embeddingInitData: Nullable<UiInitData> = null;\n if (messageHandler) {\n try {\n embeddingInitData = await getEmbeddingInitData(messageHandler);\n } catch (e) {\n console.error(e);\n }\n }\n\n sdkWrapper.setGlobalInitData(\n deepMergeCopy(\n deepMergeCopy(fallbackInitData, embeddingInitData),\n queryParamsInitData,\n ),\n );\n const rapiAccess = await sdkWrapper.getRapiAccess();\n\n const configuratorId =\n queryParamsInitData.configuratorId ||\n embeddingInitData?.configuratorId ||\n fallbackInitData.configuratorId;\n if (!configuratorId) {\n throw new Error(\n 'Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person',\n );\n }\n let remoteInitData: UiInitData = {};\n try {\n remoteInitData = await getRemoteInitData(rapiAccess);\n } catch (e) {\n console.error(e);\n }\n\n const finalInitData: UiInitData = deepMergeCopy(\n deepMergeCopy(\n deepMergeCopy(fallbackInitData, remoteInitData),\n embeddingInitData,\n ),\n queryParamsInitData,\n );\n\n for (const key of [\n 'catalogRootTag',\n 'constructionRootTag',\n 'materialRootTag',\n 'floorMaterialRootTag',\n 'wallMaterialRootTag',\n 'doorMaterialRootTag',\n 'windowMaterialRootTag',\n 'objectMaterialRootTag',\n ] as const) {\n cleanUpInitData(key, finalInitData);\n }\n if (!finalInitData.constructionRootTag && finalInitData.moc) {\n finalInitData.constructionRootTag =\n import.meta.env.VITE_DEFAULT_CONSTRUCTION_ROOT_TAG;\n }\n\n if (!finalInitData.wallMaterialRootTag && finalInitData.moc) {\n finalInitData.wallMaterialRootTag =\n import.meta.env.VITE_DEFAULT_WALL_MATERIALS_ROOT_TAG;\n }\n if (finalInitData.materialRootTag) {\n if (!finalInitData.floorMaterialRootTag) {\n finalInitData.floorMaterialRootTag = finalInitData.materialRootTag;\n }\n if (!finalInitData.wallMaterialRootTag) {\n finalInitData.wallMaterialRootTag = finalInitData.materialRootTag;\n }\n if (!finalInitData.doorMaterialRootTag) {\n finalInitData.doorMaterialRootTag = finalInitData.materialRootTag;\n }\n if (!finalInitData.windowMaterialRootTag) {\n finalInitData.windowMaterialRootTag = finalInitData.materialRootTag;\n }\n if (!finalInitData.objectMaterialRootTag) {\n finalInitData.objectMaterialRootTag = finalInitData.materialRootTag;\n }\n }\n\n if (finalInitData.thumbnails) {\n if (typeof finalInitData.thumbnails === 'string') {\n finalInitData.thumbnails = {\n collapsed: {\n desktop: finalInitData.thumbnails,\n mobile: finalInitData.thumbnails,\n },\n expanded: {\n desktop: finalInitData.thumbnails,\n mobile: finalInitData.thumbnails,\n },\n };\n }\n if (\n typeof finalInitData.thumbnails.collapsed === 'string' &&\n typeof finalInitData.thumbnails.expanded === 'string'\n ) {\n finalInitData.thumbnails = {\n collapsed: {\n desktop: finalInitData.thumbnails.collapsed,\n mobile: finalInitData.thumbnails.collapsed,\n },\n expanded: {\n desktop: finalInitData.thumbnails.expanded,\n mobile: finalInitData.thumbnails.expanded,\n },\n };\n }\n }\n\n if (finalInitData.extCatalog) {\n if (!finalInitData.customView) {\n finalInitData.customView = {};\n }\n finalInitData.customView.extCatalog = { url: finalInitData.extCatalog };\n }\n sdkWrapper.setGlobalInitData(finalInitData);\n return finalInitData;\n};\n\nexport const setProperty = (\n o: { [key: string]: any },\n path: string,\n value: any,\n) => {\n if (typeof o !== 'object') {\n return;\n }\n const parts = path.split('.');\n const last = parts.pop() as string;\n let actualObject = o;\n for (const p of parts) {\n if (!actualObject[p]) {\n actualObject[p] = {};\n }\n actualObject = actualObject[p];\n }\n if (last.endsWith('[]')) {\n if (value === undefined || value === '') {\n return;\n }\n const key = last.slice(0, -2);\n if (!actualObject[key]) {\n actualObject[key] = [];\n }\n actualObject[key].push(value);\n } else {\n actualObject[last] = value;\n }\n};\n\nexport const isCustomViewSettingsForIframe = (\n customViewSetting: PossibleCustomViewSettings,\n) => {\n return (\n customViewSetting &&\n 'url' in customViewSetting &&\n typeof customViewSetting.url === 'string'\n );\n};\n\nexport const hasCustomViewAsIframe = (initData: UiInitData): boolean => {\n if (\n !initData ||\n !initData.customView ||\n typeof initData.customView !== 'object'\n ) {\n return false;\n }\n\n const keys = Object.keys(initData.customView) as PossibleCustomViews[];\n for (const key of keys) {\n if (isCustomViewSettingsForIframe(initData.customView[key])) {\n return true;\n }\n }\n return false;\n};\n\nexport const setFeatureFlagsDefaults = (fallbackInitData: UiInitData) => {\n if (!fallbackInitData.featureFlags) {\n fallbackInitData.featureFlags = {};\n }\n if (typeof fallbackInitData.featureFlags.realPartList !== 'boolean') {\n fallbackInitData.featureFlags.realPartList = true;\n }\n if (typeof fallbackInitData.featureFlags.globalCallbacks !== 'boolean') {\n fallbackInitData.featureFlags.globalCallbacks = true;\n }\n if (typeof fallbackInitData.featureFlags.mocAr !== 'boolean') {\n fallbackInitData.featureFlags.mocAr = false;\n }\n};\n","import { MessageHandler } from '#/common/src/utils/message-handler';\nimport * as Comlink from 'comlink';\n\nimport {\n getConfiguratorSettings,\n HANDSHAKE_MESSAGES,\n WELL_KNOWN_MESSAGES,\n} from '#/common/src/utils/embedding';\n\nimport {\n castAndFixInitData,\n getFallbackInitData,\n mergeInitData,\n setFeatureFlagsDefaults,\n} from '#/common/src/utils/init-data';\n\nimport { isAndroid } from '@/common/utils/user-agent';\n\nimport { deepMerge } from '#/common/src/utils/merge';\n\n// Type only imports\n\nimport type {\n CustomViewCommunicationSide,\n EmbeddingCommand,\n} from '#/common/src/utils/message-handler';\nimport type {\n ConfiguratorSettings,\n PossibleCustomViews,\n UiInitData,\n} from '@/configurator/embedding/types';\nimport type { Nullable } from '@/common/utils/types';\nimport type ConfiguratorUiCallbacks from '@roomle/web-sdk/configurator-core/src/services/configurator-ui-callback';\nimport type RoomleConfigurator from '@roomle/web-sdk/configurator-core/src/roomle-configurator';\nimport type RoomleGLBViewer from '@roomle/web-sdk/glb-viewer-core/src/roomle-glb-viewer';\nimport type RoomlePlanner from '@roomle/web-sdk/planner-core/src/roomle-planner';\nimport type { DragIn } from '#/embedding-lib/src/plugins/drag-in';\nimport { Connector } from '#/embedding-lib/src/connector';\nimport { promiseWithResolvers } from '#/common/src/utils/promise';\nimport {\n MasterData,\n PosGroup,\n PosSaveData,\n} from '@roomle/web-sdk/homag-intelligence/src/model/oc-scripts-domain.model';\n\nconst setDefaultBehaviour = <T>(\n object: T,\n callbackName: keyof T,\n defaultBehaviour: () => void,\n) => {\n let customBehaviour: Nullable<() => void> = null;\n Object.defineProperty(object, callbackName, {\n get() {\n return customBehaviour || defaultBehaviour;\n },\n set(data: any) {\n if (!data?.mute) {\n console.warn(\n 'You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties',\n );\n console.warn('{ mute: true, value: () => void }');\n customBehaviour = data;\n } else {\n customBehaviour = data.value;\n }\n },\n });\n};\n\nconst calcVh = () => window.innerHeight * 0.01 + 'px'; // needed because of URL bar in android, inspired by: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/\nconst setCustomProp = (element: HTMLElement) => {\n if (!element) {\n return;\n }\n // Needed to wait for the next run loop otherwise data is wrong\n setTimeout(\n () => element.style.setProperty(RML_CUSTOM_PROPERTY_HEIGHT, calcVh()),\n 0,\n );\n};\n\nconst RML_STYLES_ID = 'rml-styles';\nconst RML_ANIMATION_DELAY = 450;\nconst RML_CUSTOM_PROPERTY_HEIGHT = '--rml-full-height';\n\nconst RML_CSS_CLASSES = {\n CONTAINER: 'rml-container',\n FILL: 'rml-fill',\n POSITION: 'rml-pos',\n TRANSITION: 'rml-transition',\n ANDROID_HEIGHT: 'rml-android-height',\n OVERFLOW_HIDDEN: 'rml-overflow-hidden',\n};\n\nconst globalSetupDone = new Map<HTMLElement, boolean>();\ninterface PluginMap {\n dragIn: typeof DragIn;\n}\n\nconst createGracefulProxy = <T extends object>(target: Partial<T>): T => {\n /**\n * The handler for the Proxy, containing the traps.\n */\n const handler: ProxyHandler<Partial<T>> = {\n /**\n * The 'get' trap is fired when a property is accessed on the proxy.\n * @param target The original object.\n * @param prop The name of the property being accessed.\n * @param receiver The proxy or an object that inherits from it.\n */\n get(target, prop, receiver) {\n // Use Reflect.get to retrieve the property value.\n // This correctly handles the `this` context and works for getters.\n // If the property doesn't exist, Reflect.get returns undefined.\n const value = Reflect.get(target, prop, receiver);\n\n // If the value is not undefined, the property exists on the target.\n // We return it directly. This works for implemented methods, regular\n // properties (strings, numbers, etc.), and properties set to `null`.\n if (value !== undefined) {\n return value;\n }\n\n // If the property is not found (value is undefined), we return a\n // no-op function and log a warning. This prevents runtime errors\n // when trying to invoke a missing method.\n console.warn(\n `[Homag Intelligence Callbacks] Method '${String(\n prop,\n )}' is not implemented. Executing a no-op.`,\n );\n\n // Return a function that does nothing and returns undefined.\n // @ts-ignore\n return (...args: any[]) => undefined;\n },\n };\n\n // Create and return the new Proxy. We cast it to T as an assertion\n // to the TypeScript compiler that our proxy will safely fulfill the\n // contract of the full interface T at runtime.\n return new Proxy(target, handler) as T;\n};\n\nexport const HI_PANEL_ACTION = {\n HIDE: 'hide',\n SHOW_ATTRIBUTES: 'attributes',\n SHOW_ARTICLES: 'articles',\n} as const;\nexport type HiPanelActionType =\n (typeof HI_PANEL_ACTION)[keyof typeof HI_PANEL_ACTION];\n\nexport interface HiCallbacks {\n /**\n * Requests the calculation script for the given library ID.\n * @param libraryId the ID of the library for which the calculation script is requested\n * @returns the calculation script as a string\n */\n onLoadJavascript: (libraryId: string) => Promise<string>;\n\n /**\n * Requests the master data for the given library ID.\n * @param libraryId the ID of the library for which the master data is requested\n * @returns the master data as a Promise\n */\n onLoadMasterData: (libraryId: string) => Promise<MasterData>;\n\n /**\n * Requests the article catalog for the given library ID.\n * @param libraryId the ID of the library for which the article catalog is requested\n * @returns the article catalog as a Promise\n */\n onLoadArticleCatalog: (libraryId: string) => Promise<any>;\n\n /**\n * Notifies the host application that a price calculation should be performed.\n * @param posGroups all groups in the plan\n */\n onPriceCalc?: (posGroups: PosGroup[]) => Promise<void>;\n\n /**\n * Retrieves the current external load data which has to be used to replace the existing groups in the plan.\n * @returns load data or null if no replacement is needed\n */\n onGetSavedPosGroupData?: () => Promise<PosSaveData | null>;\n\n /**\n * \"onCompletelyLoaded\" is invoked when the groups in the plan are completely loaded.\n */\n onPosGroupsCompletelyLoaded?: () => void;\n\n /**\n * \"onPosGroupAdded\" is invoked when a new group was created. (e.g. duplicate object)\n * @param groupData The new group data JSON.\n */\n onPosGroupAdded?: (posGroups: PosGroup[]) => Promise<void>;\n\n /**\n * \"onPosGroupChanged\" is invoked when a new group was modified and recalculated. (e.g. split, merge, change, attribute)\n *\n * @param groupData The new group data JSON.\n */\n onPosGroupChanged?: (posGroups: PosGroup[]) => Promise<void>;\n\n /**\n * \"onPosGroupDeleted\" is invoked when a group was delete. (e.g. delete button in scene)\n * @param groupData The ID of the group which was deleted.\n */\n onPosGroupDeleted?: (posGroupIds: string[]) => Promise<void>;\n\n /**\n * \"onShowHidePanel\" is invoked when a the content of the side panel should be changed or hidden.\n * @param panel The panel to show or hide.\n * @param posGroupId Optional ID of the selected group in case of SHOW_ATTRIBUTES.\n * @param rootModuleId Optional ID of the selected root module in case of SHOW_ATTRIBUTES.\n * @param subModuleId Optional ID of the selected sub module in case of SHOW_ATTRIBUTES.\n */\n onShowHidePanel?: (\n panel: HiPanelActionType,\n posGroupId?: string,\n rootModuleId?: string,\n subModuleId?: string,\n ) => void;\n\n /**\n * \"onSelectModule\" is invoked when a the selected object in the scene was changed.\n * @param posGroupId ID of the selected group\n * @param rootModuleId ID of the selected root module\n * @param subModuleId Optional id of the selected sub module\n */\n onSelectModule?: (\n posGroupId: string,\n rootModuleId: string,\n subModuleId?: string,\n ) => void;\n\n /**\n * Request the price for the given order data.\n * @param orderData order data\n * @returns price data\n */\n onFetchPrice?: (orderData: any) => Promise<any>;\n\n /**\n * \"onPlaceOrder\" is invoked when the user wants to place an order.\n * You can use this to send the order data to Order Manager or to a 3rd party service.\n * @param orderData\n */\n onPlaceOrder?: (orderData: any) => Promise<void>;\n\n /**\n * \"onLogMessage\" is invoked when the Homag Intelligence library wants to log a message.\n * You can use this to log messages in your own UI.\n * @param area\n * @param message\n */\n onLogMessage?: (area: string, message: string) => void;\n}\n\nexport type AvailablePlugins = {\n [K in keyof PluginMap]?: InstanceType<PluginMap[K]>; // Use InstanceType to get instance types\n};\n\nexport type PluginConstructors = {\n [K in keyof PluginMap]: PluginMap[K];\n};\n\nexport type PluginDefinitions = Array<\n | keyof AvailablePlugins\n | {\n name: keyof AvailablePlugins;\n loader: () => Promise<PluginConstructors[keyof PluginConstructors]>;\n }\n>;\n\nexport type RoomleConfiguratorApi = RoomleEmbeddingApi<\n RoomleConfigurator,\n ConfiguratorUiCallbacks\n>;\nexport type RoomleViewerApi = RoomleEmbeddingApi<\n RoomleGLBViewer,\n ConfiguratorUiCallbacks\n>;\nexport type RoomlePlannerApi = RoomleEmbeddingApi<\n RoomlePlanner,\n ConfiguratorUiCallbacks\n>;\n\nexport default class RoomleEmbeddingApi<\n SdkType,\n SdkCallbacks,\n> extends Connector<SdkType, SdkCallbacks> {\n public static createPlanner(\n configuratorId: string,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions = [],\n ): Promise<RoomlePlannerApi> {\n return this._create<RoomlePlanner, ConfiguratorUiCallbacks>(\n configuratorId,\n container,\n initData,\n plugins,\n );\n }\n\n public static async connect(\n customView: PossibleCustomViews,\n plugins: PluginDefinitions = [],\n ) {\n const instance = new Connector<\n RoomleConfigurator,\n ConfiguratorUiCallbacks\n >();\n instance.viewName = customView;\n const { resolve: resolveRegister, promise: promiseRegister } =\n promiseWithResolvers<void>();\n const { resolve: resolveSetup, promise: promiseSetup } =\n promiseWithResolvers<void>();\n\n const handleMessage = ({\n message,\n args,\n }: {\n message: string;\n args: any[];\n }) => {\n switch (message) {\n case WELL_KNOWN_MESSAGES.REGISTER_CUSTOM_VIEW_DONE:\n resolveRegister();\n break;\n case WELL_KNOWN_MESSAGES.RETURN_METHODS:\n instance.handleSetup(args[0]);\n resolveSetup();\n break;\n default:\n if (instance.isSetupDone) {\n return instance.executeMessage({ message, args });\n }\n }\n };\n const messageHandler = new MessageHandler(\n ('custom-view-' + customView) as CustomViewCommunicationSide,\n window,\n window.parent,\n handleMessage,\n );\n\n instance.setMessageHandler(messageHandler);\n const customViewName = [customView];\n messageHandler.sendMessage(\n WELL_KNOWN_MESSAGES.REGISTER_CUSTOM_VIEW,\n customViewName,\n );\n await promiseRegister;\n messageHandler.sendMessage(WELL_KNOWN_MESSAGES.GET_METHODS, customViewName);\n await promiseSetup;\n instance.setupPlugins(\n plugins,\n document.body as HTMLBodyElement,\n 'custom-view',\n );\n await Promise.allSettled(instance.pluginsLoaded);\n return instance;\n }\n\n /**\n * Method to create a new instance of a Roomle Configurator\n * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person\n * @param container DOM container in which the configurator should be placed\n * @param initData settings with which the configurator should be started\n */\n public static createConfigurator(\n configuratorId: string,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions = [],\n ): Promise<RoomleConfiguratorApi> {\n return this._create<RoomleConfigurator, ConfiguratorUiCallbacks>(\n configuratorId,\n container,\n initData,\n plugins,\n );\n }\n\n /**\n * Method to create a new instance of a Roomle Configurator\n * @deprecated please use \"createConfigurator\"\n * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person\n * @param container DOM container in which the configurator should be placed\n * @param initData settings with which the configurator should be started\n */\n public static create(\n configuratorId: string,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions,\n ): Promise<RoomleConfiguratorApi> {\n return this._create<RoomleConfigurator, ConfiguratorUiCallbacks>(\n configuratorId,\n container,\n initData,\n plugins,\n );\n }\n\n /**\n * Method to create a new instance of a Roomle Viewer\n * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person\n * @param container DOM container in which the configurator should be placed\n * @param initData settings with which the configurator should be started\n */\n public static createViewer(\n configuratorId: string,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions = [],\n ): Promise<RoomleViewerApi> {\n return this._create<RoomleGLBViewer, ConfiguratorUiCallbacks>(\n configuratorId,\n container,\n initData,\n plugins,\n );\n }\n\n private static hiMessageHandler: ((event: MessageEvent) => void) | null =\n null;\n\n public static setupHi(callbacks: HiCallbacks) {\n if (this.hiMessageHandler) {\n window.removeEventListener('message', this.hiMessageHandler);\n }\n this.hiMessageHandler = (event: MessageEvent) => {\n if (event.data.type === 'connect_hi' && event.data.port) {\n const port = event.data.port;\n port.start?.();\n Comlink.expose(createGracefulProxy<HiCallbacks>(callbacks), port);\n }\n };\n window.addEventListener('message', this.hiMessageHandler);\n }\n\n private static async _create<SdkType, SdkCallbacks>(\n configuratorId: string,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions,\n ): Promise<RoomleEmbeddingApi<SdkType, SdkCallbacks>> {\n return new Promise(async (resolve, reject) => {\n try {\n const fallbackInitData = deepMerge(\n getFallbackInitData(),\n castAndFixInitData(initData),\n ) as UiInitData;\n setFeatureFlagsDefaults(fallbackInitData);\n const configuratorSettings = await getConfiguratorSettings(\n configuratorId,\n fallbackInitData,\n );\n initData = mergeInitData(configuratorSettings, fallbackInitData);\n const instance = new this<SdkType, SdkCallbacks>(\n configuratorSettings,\n container,\n initData,\n plugins,\n resolve,\n );\n await Promise.allSettled(instance.pluginsLoaded);\n return instance;\n } catch (e) {\n return reject(e);\n }\n });\n }\n\n private _waitForIframe: (\n instance: RoomleEmbeddingApi<SdkType, SdkCallbacks>,\n ) => void;\n private _container: HTMLElement;\n private _configuratorSettings: ConfiguratorSettings;\n private _initData: UiInitData = {};\n private _iframe: HTMLIFrameElement;\n\n private constructor(\n settings: ConfiguratorSettings,\n container: HTMLElement,\n initData: UiInitData,\n plugins: PluginDefinitions,\n waitForIframe: (\n instance: RoomleEmbeddingApi<SdkType, SdkCallbacks>,\n ) => void,\n ) {\n super();\n if (!settings || typeof settings.id !== 'string') {\n throw new Error(\n 'Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person',\n );\n }\n if (globalSetupDone.has(container)) {\n throw new Error('There is already an instance on this DOM element');\n }\n const stylesAlreadyAdded = !!document.getElementById(RML_STYLES_ID);\n if (!stylesAlreadyAdded) {\n const zIndex = initData.zIndex || 9999999;\n const styles = document.createElement('style');\n styles.type = 'text/css';\n styles.id = RML_STYLES_ID;\n const cssTransition =\n 'transition:all ease-in-out ' + RML_ANIMATION_DELAY + 'ms;';\n const cssTransitionForAllBrowsers =\n ['-webkit-', '-o-'].reduce(\n (acc, browser) => (acc += browser + cssTransition),\n '',\n ) + cssTransition;\n const vh = calcVh();\n\n styles.innerHTML = `\n .${RML_CSS_CLASSES.CONTAINER}{${RML_CUSTOM_PROPERTY_HEIGHT}:${vh};}\n .${RML_CSS_CLASSES.POSITION}{position:fixed;top:0;left:0;z-index:${zIndex};opacity:0}\n .${RML_CSS_CLASSES.TRANSITION}{${cssTransitionForAllBrowsers}}\n .${RML_CSS_CLASSES.FILL}{width:100%;height:100%;opacity:1}\n .${RML_CSS_CLASSES.ANDROID_HEIGHT}{height:calc(var(${RML_CUSTOM_PROPERTY_HEIGHT},1vh)*100)}\n .${RML_CSS_CLASSES.OVERFLOW_HIDDEN}{overflow:hidden}\n `;\n document.head.appendChild(styles);\n }\n this._executeMessage = this._executeMessage.bind(this);\n const messageHandler = new MessageHandler(\n 'website',\n window,\n null,\n this._executeMessage,\n );\n this.setMessageHandler(messageHandler);\n this._onResize = this._onResize.bind(this);\n if (isAndroid()) {\n window.addEventListener('resize', this._onResize);\n }\n this._container = container;\n this._initData = initData;\n this._configuratorSettings = settings;\n const iframe = this._createIframe();\n this._onUseFullPage = this._onUseFullPage.bind(this);\n this._onBackToWebsite = this._onBackToWebsite.bind(this);\n this._waitForIframe = waitForIframe;\n this._container.appendChild(iframe);\n this._iframe = iframe;\n this.setupPlugins(plugins, this._iframe);\n globalSetupDone.set(container, true);\n }\n\n public teardown() {\n if (this._container) {\n globalSetupDone.delete(this._container);\n }\n const iframe = this._container.querySelector('iframe');\n if (iframe) {\n this._container.removeChild(iframe);\n }\n window.removeEventListener('resize', this._onResize);\n }\n\n private _createIframe() {\n const iframe = document.createElement('iframe');\n let url: string =\n this._configuratorSettings?.url || 'https://www.roomle.com/t/cp/';\n if (this._initData.useLocalRoomle) {\n url = location.href.replace('embedding.html', '');\n }\n if (location.href.includes('roomle.gitlab.io')) {\n url = location.href.replace('embedding.html', 'index.html');\n }\n\n if ((this._initData as any).overrideServerUrl) {\n url = (this._initData as any).overrideServerUrl;\n }\n\n iframe.src = url;\n iframe.classList.add(RML_CSS_CLASSES.CONTAINER);\n iframe.classList.add(RML_CSS_CLASSES.FILL);\n\n return iframe;\n }\n\n private _onResize(): void {\n setCustomProp(this._iframe);\n }\n\n private _onUseFullPage(): void {\n this._iframe.classList.add(RML_CSS_CLASSES.POSITION);\n document.documentElement.classList.add(RML_CSS_CLASSES.OVERFLOW_HIDDEN);\n window.document.body.classList.add(RML_CSS_CLASSES.OVERFLOW_HIDDEN);\n if (isAndroid()) {\n setCustomProp(this._iframe);\n this._iframe.classList.add(RML_CSS_CLASSES.ANDROID_HEIGHT);\n }\n }\n\n private _onBackToWebsite(): void {\n this._iframe.classList.remove(RML_CSS_CLASSES.POSITION);\n this._iframe.classList.remove(RML_CSS_CLASSES.ANDROID_HEIGHT);\n document.documentElement.classList.remove(RML_CSS_CLASSES.OVERFLOW_HIDDEN);\n window.document.body.classList.remove(RML_CSS_CLASSES.OVERFLOW_HIDDEN);\n }\n\n private _executeMessage(\n { message, args }: EmbeddingCommand,\n event: MessageEvent,\n ) /*: MessageExecutionResult */ {\n if (!event.source) {\n // @ts-ignore -- vite refactor\n return; // no source? just wait ;-)\n }\n if (event.source !== this._iframe?.contentWindow) {\n // @ts-ignore -- vite refactor\n return; // need to wait since response is not for the current iframe;\n }\n\n if (message === HANDSHAKE_MESSAGES.REQUEST_BOOT) {\n if (!this._messageHandler) {\n console.error('MessageHandler not set');\n return Promise.resolve({ error: 'MessageHandler not set' });\n }\n this._messageHandler.setOutgoingMessageBus(event.source);\n return Promise.resolve({ result: this._initData });\n }\n if (message === HANDSHAKE_MESSAGES.SETUP) {\n this.handleSetup(args[0]);\n setDefaultBehaviour(\n this.ui.callbacks,\n 'onUseFullPage',\n this._onUseFullPage,\n );\n setDefaultBehaviour(\n this.ui.callbacks,\n 'onBackToWebsite',\n this._onBackToWebsite,\n );\n\n this._waitForIframe(this);\n setTimeout(() => {\n if (!this._messageHandler) {\n console.error('MessageHandler not set');\n return;\n }\n this._messageHandler.sendMessage(HANDSHAKE_MESSAGES.WEBSITE_READY);\n }, 0); // Run it after the promise is resolved so everyone can subscribe\n return Promise.resolve({ result: null });\n }\n return this.executeMessage({ message, args });\n }\n}\n","import type { HiPanelActionType } from '../../../../embedding-lib/src/embedding-lib';\nimport {\n HI_PANEL_ACTION,\n type HiCallbacks,\n} from '../../../../embedding-lib/src/embedding-lib';\nimport { BASE_CONTEXT } from '../../common-core/src/main';\nimport type PlanElementViewModel from '../../common-core/src/view-model/plan-element-view-model';\nimport type { SELECTION_MODE } from '../../configurator-core/src/utils/selection-handler';\nimport type { SelectionPayload } from '../../planner-core/src/roomle-planner-ui-callback';\nimport type { CallbackObjectType } from '../../planner-core/src/utils/planner-scene-utils';\nimport type { CancelSelectionReasons } from '../../typings/planner';\n\nexport const HI_SELECTION_TYPE = {\n NONE: 'none',\n GROUP: 'group',\n ROOT_MODULE: 'rootModule',\n SUB_MODULE: 'subModule',\n} as const;\nexport type HiSelectionType =\n (typeof HI_SELECTION_TYPE)[keyof typeof HI_SELECTION_TYPE];\n\nexport const HI_SELECTION_MODE = {\n MULTI_SELECT: 'multiselect',\n TC_CONFIG: 'tc-config',\n RML_OBJECT: 'rml-object',\n} as const;\nexport type HiSelectionMode =\n (typeof HI_SELECTION_MODE)[keyof typeof HI_SELECTION_MODE];\n\ninterface HiSelection {\n type: HiSelectionType;\n groupId: string | null;\n rootModuleId: string | null;\n subModuleId: string | null;\n}\n\ninterface HiEmittedSelection {\n panel: HiPanelActionType | null;\n groupId: string | null;\n rootModuleId: string | null;\n subModuleId: string | null;\n}\n\nexport interface HiObjectSelectionApi {\n setSidebar(viewName: string): void;\n contextChanged(context: BASE_CONTEXT): void;\n groupOrModuleSelected(\n groupId: string,\n rootModuleId: string | null,\n subModuleId: string | null,\n ): void;\n componentSelectionCancel(reason: CancelSelectionReasons): void;\n selectionCancel(reason: CancelSelectionReasons): void;\n selectionChanged(\n selectionMode: SELECTION_MODE,\n objectType: CallbackObjectType,\n payload: SelectionPayload,\n _payloadPromise: Promise<SelectionPayload>,\n _planElementViewModel: PlanElementViewModel,\n ): void;\n}\n\nexport class HiObjectSelection implements HiObjectSelectionApi {\n private _callbacks: HiCallbacks | null = null;\n private _contextType: BASE_CONTEXT = BASE_CONTEXT.PLANNER;\n private _selectionMode: HiSelectionMode | null = null;\n private _hiSelection: HiSelection = {\n type: HI_SELECTION_TYPE.NONE,\n groupId: null,\n rootModuleId: null,\n subModuleId: null,\n };\n private _emittedSelection: HiEmittedSelection = {\n panel: null,\n groupId: null,\n rootModuleId: null,\n subModuleId: null,\n };\n\n constructor(callbacks: HiCallbacks | null) {\n this._callbacks = callbacks;\n }\n\n public setSidebar(viewName: string) {\n if (viewName === 'productSettings') {\n return;\n }\n if (viewName === 'catalog') {\n this._emitSelectionChange(HI_PANEL_ACTION.SHOW_ARTICLES);\n return;\n }\n this._emitSelectionChange(HI_PANEL_ACTION.HIDE);\n }\n\n public contextChanged(context: BASE_CONTEXT): void {\n this._contextType = context;\n if (context === BASE_CONTEXT.PLANNER) {\n this._resetSelection();\n }\n this._handleViewTypeChange();\n }\n\n public groupOrModuleSelected(\n groupId: string,\n rootModuleId: string | null,\n subModuleId: string | null,\n ) {\n this._selectionMode = HI_SELECTION_MODE.TC_CONFIG;\n this._hiSelection.groupId = groupId;\n this._hiSelection.rootModuleId = rootModuleId ?? null;\n this._hiSelection.subModuleId = subModuleId ?? null;\n if (this._hiSelection.rootModuleId && this._hiSelection.subModuleId) {\n this._hiSelection.type = HI_SELECTION_TYPE.SUB_MODULE;\n } else if (this._hiSelection.rootModuleId) {\n this._hiSelection.type = HI_SELECTION_TYPE.ROOT_MODULE;\n } else {\n this._hiSelection.type = HI_SELECTION_TYPE.GROUP;\n }\n this._handleViewTypeChange();\n }\n\n public componentSelectionCancel(reason: CancelSelectionReasons) {\n if (this._contextType !== BASE_CONTEXT.CONFIGURATOR) {\n return;\n }\n if (\n reason === 'click_outside' ||\n reason === 'isolation_mode_cancelled' ||\n reason === 'select_other'\n ) {\n return;\n }\n this._resetSelection();\n this._handleViewTypeChange();\n }\n\n public selectionCancel(reason: CancelSelectionReasons) {\n if (reason === 'select_other') {\n return;\n }\n this._resetSelection();\n this._handleViewTypeChange();\n }\n\n public selectionChanged(\n selectionMode: SELECTION_MODE,\n objectType: CallbackObjectType,\n payload: SelectionPayload,\n _payloadPromise: Promise<SelectionPayload>,\n _planElementViewModel: PlanElementViewModel,\n ) {\n this._selectionHandler(\n BASE_CONTEXT.PLANNER,\n selectionMode,\n objectType,\n payload,\n );\n }\n\n private _resetSelection() {\n this._selectionMode = null;\n }\n\n private _selectionHandler(\n initiatingContext: BASE_CONTEXT,\n mode: SELECTION_MODE,\n type: CallbackObjectType,\n payload: SelectionPayload,\n ): void {\n if (initiatingContext === BASE_CONTEXT.CONFIGURATOR) {\n return;\n }\n if (mode === HI_SELECTION_MODE.MULTI_SELECT) {\n this._selectionMode = mode;\n this._handleViewTypeChange();\n return;\n }\n if (\n type === 'external-configuration' &&\n payload.externalConfigurationType === HI_SELECTION_MODE.TC_CONFIG\n ) {\n this._selectionMode = HI_SELECTION_MODE.TC_CONFIG;\n } else {\n this._selectionMode = HI_SELECTION_MODE.RML_OBJECT;\n }\n this._handleViewTypeChange();\n }\n\n private _handleViewTypeChange() {\n let panelAction: HiPanelActionType = HI_PANEL_ACTION.SHOW_ARTICLES;\n if (\n this._selectionMode === HI_SELECTION_MODE.TC_CONFIG &&\n (this._contextType === BASE_CONTEXT.CONFIGURATOR ||\n this._hiSelection.type !== HI_SELECTION_TYPE.GROUP)\n ) {\n panelAction = HI_PANEL_ACTION.SHOW_ATTRIBUTES;\n }\n this._emitSelectionChange(panelAction);\n }\n\n private _emitSelectionChange(panelAction: HiPanelActionType) {\n if (this._emittedSelection.panel !== panelAction) {\n this._emittedSelection.panel = panelAction;\n const showAttributes = panelAction === HI_PANEL_ACTION.SHOW_ATTRIBUTES;\n this._emittedSelection.groupId = showAttributes\n ? this._hiSelection.groupId\n : null;\n this._emittedSelection.rootModuleId = showAttributes\n ? this._hiSelection.rootModuleId\n : null;\n this._emittedSelection.subModuleId = showAttributes\n ? this._hiSelection.subModuleId\n : null;\n this._callbacks?.onShowHidePanel(\n panelAction,\n this._emittedSelection.groupId,\n this._emittedSelection.rootModuleId,\n this._emittedSelection.subModuleId,\n );\n } else if (\n this._emittedSelection.panel === HI_PANEL_ACTION.SHOW_ATTRIBUTES &&\n (this._emittedSelection.groupId !== this._hiSelection.groupId ||\n this._emittedSelection.rootModuleId !==\n this._hiSelection.rootModuleId ||\n this._emittedSelection.subModuleId !== this._hiSelection.subModuleId)\n ) {\n this._emittedSelection.groupId = this._hiSelection.groupId ?? null;\n this._emittedSelection.rootModuleId =\n this._hiSelection.rootModuleId ?? null;\n this._emittedSelection.subModuleId =\n this._hiSelection.subModuleId ?? null;\n this._callbacks?.onSelectModule(\n this._emittedSelection.groupId,\n this._emittedSelection.rootModuleId,\n this._emittedSelection.subModuleId,\n );\n }\n }\n}\n","import type { HiCallbacks } from '../../../../embedding-lib/src/embedding-lib';\nimport type {\n ExternalModuleInformation,\n ExternalObjectGroup,\n ExternalObjectGroupPosition,\n ExternalObjectRootModule,\n ExternalObjectValidContainerModules,\n} from './external-object-api-callbacks';\nimport type {\n MasterData,\n PosModuleAttribute,\n PosContour,\n PosGroup,\n PosModuleData,\n PosModuleRootData,\n CheckDropDownEntry,\n CheckResult,\n PosSaveData,\n PosArticle,\n} from './model/oc-scripts-domain.model';\nimport {\n isExtObjId,\n removeExtObjIdPrefix,\n} from '../../common-core/src/utils/external-objects';\n\nimport {\n HiObjectSelection,\n type HiObjectSelectionApi,\n} from './hi-object-selection';\nimport { deepCopy } from '../../common-core/src/utils/common-utils';\nimport type {\n ExternalObjectSnapshotSaveResult,\n ExternalRoomInformation,\n LoadExternalObjectOptions,\n} from './external-object-api';\n\nexport interface LibraryIdAndLibraryData {\n libraryId?: string;\n libraryData?: LibraryData;\n}\n\nexport interface LibraryData {\n libraryId: string;\n get masterData(): MasterData | null;\n get posGroupVersion(): number;\n calculateGroup(posGroup: PosGroup): PosGroup;\n getOrderData(posGroup: PosGroup[], roomlePlannerId?: string): any;\n getAttributesDropDownValues(\n module: PosModuleData,\n attributeIds?: string | string[],\n ): Promise<Record<string, any[]>>;\n solveModuleAttributeConflict(\n module: PosModuleData,\n attributeName: string,\n value: string | number | boolean,\n ): PosModuleAttribute[] | undefined;\n getValidSubArticles(\n calculatedPosGroup: PosGroup,\n articles: PosArticle[],\n masterData: MasterData,\n ): PosArticle[];\n getValidContainerModulesForSubArticle(\n calculatedPosGroup: PosGroup,\n subArticle: PosArticle,\n masterData: MasterData,\n ): ExternalObjectValidContainerModules[];\n addSubArticle(\n targetPosGroup: PosGroup,\n article: PosArticle,\n rootId: string,\n parentModuleId: string,\n ): PosGroup;\n}\n\nexport interface RoomDesignerRequests {\n loadMasterData(masterData: MasterData): void;\n loadPosGroups(\n posDataJson: PosGroup | PosGroup[],\n options: LoadExternalObjectOptions,\n ): Promise<void>;\n selectGroup(groupId: string): Promise<void>;\n selectRoot(rootModuleId: string): Promise<void>;\n selectModule(rootModuleId: string, subModuleId: string): Promise<void>;\n openCloseGroup(\n groupOrRootModuleId: string,\n subModuleId: string | null,\n open: boolean,\n animate: boolean,\n ): void;\n deleteGroup(groupId: string): void;\n deleteRootModule(rootModuleId: string): void;\n getPosDataOfAllGroups(): Promise<PosGroup[]>;\n getRoomInformation(): Promise<ExternalRoomInformation>;\n saveExternalObjectSnapshot(): Promise<ExternalObjectSnapshotSaveResult | null>;\n}\n\nexport interface GlueLogic {\n hiCallbacks: HiCallbacks | null;\n hiObjectSelection: HiObjectSelectionApi;\n\n isLibraryLoaded(libraryId: string): boolean;\n getLibraryData(libraryId: string): LibraryData | null;\n addLibrary(libraryData: LibraryData): void;\n setPosDataForLoading(posData: PosSaveData | null): void;\n loadPosData(articleCatalogJson: any, libraryId: string): void;\n mergeGroups(\n targetGroup: ExternalObjectGroup,\n idsOfGroupsMerged: string | string[],\n idOfTargetRootModule: string,\n ): void;\n deleteRootModule(\n remainingGroup: ExternalObjectGroup,\n rootModuleIdToDelete: string,\n splitOffGroups: ExternalObjectGroup[],\n ): void;\n splitRootModuleFromGroup(\n splitGroup: ExternalObjectGroup,\n newGroupedRootModules: ExternalObjectGroup[],\n ): void;\n duplicateGroup(duplicatedGroup: ExternalObjectGroup): void;\n swapRootModule(\n groupId: string,\n rootModuleId: string,\n articleId: string,\n ): void;\n modifyAttribute(\n groupId: string,\n moduleIdObjects: ExternalModuleInformation[],\n attributeName: string,\n value: string,\n ): void;\n updateAttribute(\n rootModuleId: string,\n moduleId: string | null,\n attributeId: string,\n attributeValue: string | boolean,\n ): void;\n getVerifiedAttributeOptions(\n moduleId: string,\n attributeIds?: string | string[],\n ): Promise<Record<string, CheckResult> | undefined>;\n updateAdditionalInfo(rootModuleId: string, additionalInfo: string): void;\n findValidSubArticles(posGroupIds: string[] | string): PosArticle[];\n getValidContainerModulesForSubArticle(\n posGroupIds: string[] | string,\n subArticleId: string,\n ): ExternalObjectValidContainerModules[];\n addSubArticle(\n articleId: string,\n rootModuleId: string,\n parentModuleId: string,\n ): void;\n arrangeRootModulesOfGroup(changedGroup: ExternalObjectGroup): void;\n changedGroupPlanningSituation(changedGroup: ExternalObjectGroup): void;\n changedGroupFromHistory(historyGroup: PosGroup, reloadGroup: boolean): void;\n loadedGroup(posDataJson: PosGroup): void;\n groupsCompletelyLoaded(): void;\n removedGroup(groupId: string): void;\n openCloseGroup(groupId: string): void;\n getSaveDataGroups(): Promise<PosGroup[] | null>;\n newPosDataFromId(id: string): Promise<PosGroup>;\n newPosDataFromGroup(posDataJson: PosGroup): Promise<PosGroup>;\n getGroupDataForOrder(roomlePlannerId?: string): Promise<any>;\n savePlanSnapshot(): Promise<PlanSnapshot | null>;\n}\n\nexport interface PlanSnapshot {\n id: string;\n perspectiveImageLink: string;\n topImageLink: string;\n room3dLink: string;\n room3dFullLink: string;\n}\n\ninterface GroupItem {\n posDataJson: PosGroup;\n opened: boolean;\n}\n\nexport class GlueLogicImplementation implements GlueLogic {\n private _designerRequests: RoomDesignerRequests;\n private _libraryData: Map<string, LibraryData> = new Map();\n private _posDataForLoading: PosSaveData | null = null;\n private _posArticleMap: Map<string, PosArticle> = new Map();\n private _posSubArticleMap: Map<string, PosArticle> = new Map();\n private _groupMap: Map<string, GroupItem> = new Map();\n private _nextPosDataId: number = 1;\n private _hiCallbacks: HiCallbacks | null = null;\n private _hiObjectSelection: HiObjectSelectionApi;\n private _pendingGroupsToBeLoaded: PosGroup[] = [];\n private _planCompletelyLoaded: boolean = false;\n private _validSubArticles: PosArticle[] = [];\n\n public constructor(\n designerRequests: RoomDesignerRequests,\n hiCallbacks: HiCallbacks | null = null,\n ) {\n this._designerRequests = designerRequests;\n this._hiCallbacks = hiCallbacks;\n this._hiObjectSelection = new HiObjectSelection(hiCallbacks);\n }\n\n public get hiCallbacks(): HiCallbacks | null {\n return this._hiCallbacks;\n }\n\n public get hiObjectSelection(): HiObjectSelectionApi {\n return this._hiObjectSelection;\n }\n\n private _getGroup(groupId: string): GroupItem | undefined {\n return this._groupMap.get(groupId);\n }\n\n public getLibraryData(data: string | PosGroup): LibraryData | null {\n if (this._libraryData.size === 1) {\n return Array.from(this._libraryData.values())[0];\n }\n let libraryId: string | undefined;\n if (typeof data === 'string') {\n libraryId = data;\n } else {\n libraryId = this._getLibraryIdForPosData(data);\n }\n if (!this._libraryData.has(libraryId)) {\n console.error(`Library data for libraryId '${libraryId}' not found`);\n return null;\n }\n return this._libraryData.get(libraryId) ?? null;\n }\n\n public isLibraryLoaded(libraryId: string): boolean {\n return this._libraryData.has(libraryId);\n }\n\n public addLibrary(libraryData: LibraryData) {\n if (!this._libraryData.has(libraryData.libraryId)) {\n this._libraryData.set(libraryData.libraryId, libraryData);\n this._loadPendingGroup(libraryData.libraryId);\n }\n }\n\n public loadPosData(articleCatalogJson: any, libraryId: string) {\n // NOBILIA DEMO HACKS -- connect.homag.com sends differently shaped data.\n if (articleCatalogJson?.articles) {\n articleCatalogJson = articleCatalogJson.articles;\n }\n articleCatalogJson.forEach((posDataGroup: PosArticle) => {\n const articleId = (posDataGroup as any).id || posDataGroup.articleId;\n const posArticle = deepCopy(posDataGroup);\n posArticle.libraryId = libraryId;\n if (posArticle.isConfigDummy) {\n this._posSubArticleMap.set(articleId, posArticle);\n } else {\n this._posArticleMap.set(articleId, posArticle);\n }\n });\n }\n\n public setPosDataForLoading(posData: PosSaveData | null) {\n this._posDataForLoading = posData;\n const allPosGroups = Array.from(this._groupMap.values()).map(\n (groupItem) => groupItem.posDataJson,\n );\n this._groupMap.clear();\n for (const groupItem of allPosGroups) {\n this.loadedGroup(groupItem);\n }\n }\n\n public async getSaveDataGroups(): Promise<PosGroup[] | null> {\n return this._posDataForLoading?.groups ?? null;\n }\n\n public async newPosDataFromId(id: string): Promise<PosGroup> {\n if (isExtObjId(id)) {\n id = removeExtObjIdPrefix(id);\n }\n let posArticle: PosArticle | undefined;\n if (this._posArticleMap.has(id)) {\n posArticle = deepCopy(this._posArticleMap.get(id));\n } else if (this._posSubArticleMap.has(id)) {\n posArticle = deepCopy(this._posSubArticleMap.get(id));\n }\n if (!posArticle) {\n return undefined;\n }\n const posArticleGroup = posArticle as any as PosGroup;\n posArticleGroup.ver = this.getLibraryData(\n posArticleGroup.libraryId,\n )?.posGroupVersion;\n posArticleGroup.logMessages = [];\n // copy the needed properties from the article to the root modules\n posArticleGroup.roots.forEach((posArticleRoot: any) => {\n posArticleRoot.libraryId = posArticle.libraryId;\n posArticleRoot.catalog = posArticle.catalog;\n posArticleRoot.logMessages = [];\n // Take over the name from the selected article, if the root was not generated\n if (!posArticleRoot.isGenerated) {\n posArticleRoot.articleName = posArticle.articleName;\n posArticleRoot.articleId = posArticle.articleId;\n posArticleRoot.desc = posArticle.desc;\n posArticleRoot.imageUrl = posArticle.imageUrl;\n posArticleRoot.category = posArticle.category;\n }\n });\n const emulatorGroupItem = this._addNewGroup(posArticleGroup, false);\n this._groupsModified(emulatorGroupItem.posDataJson, [], []);\n return emulatorGroupItem.posDataJson as PosGroup;\n }\n\n public async newPosDataFromGroup(posDataJson: PosGroup): Promise<PosGroup> {\n const emulatorGroupItem = this._addNewGroup(posDataJson, false);\n this._groupsModified(emulatorGroupItem.posDataJson, [], []);\n return emulatorGroupItem.posDataJson;\n }\n\n public async selectGroup(groupId: string) {\n try {\n await this._designerRequests.selectGroup(groupId);\n } catch (error) {\n console.error(error);\n }\n }\n\n public async selectRoot(_groupId: any, rootId: string) {\n try {\n await this._designerRequests.selectRoot(rootId);\n } catch (error) {\n console.error(error);\n }\n }\n\n public async deleteRoot(_groupId: any, rootId: string) {\n try {\n await this._designerRequests.deleteRootModule(rootId);\n } catch (error) {\n console.error(error);\n }\n }\n\n public async selectSubModule(\n _groupId: any,\n rootId: string,\n moduleId: string,\n ) {\n try {\n await this._designerRequests.selectModule(rootId, moduleId);\n } catch (error) {\n console.error(error);\n }\n }\n\n public async openCloseGroup(groupId: string) {\n try {\n const emulatorGroupItem = this._getGroup(groupId);\n if (emulatorGroupItem) {\n const open = !emulatorGroupItem.opened;\n await this._designerRequests.openCloseGroup(groupId, null, open, false);\n emulatorGroupItem.opened = open;\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public deleteRootModule(\n remainingGroup: ExternalObjectGroup,\n rootModuleIdToDelete: string,\n splitOffGroups: ExternalObjectGroup[],\n ) {\n try {\n const originalGroupData = this._getGroup(remainingGroup.groupId);\n if (originalGroupData) {\n this._setGroupPosition(originalGroupData, remainingGroup);\n this._setGroupContour(originalGroupData, remainingGroup);\n this._setRootModulesPosition(originalGroupData, remainingGroup);\n const group = originalGroupData.posDataJson;\n group.roots = group.roots.filter(\n (root: { id: any }) => root.id !== rootModuleIdToDelete,\n );\n const newGroupsPosData = this._splitOffGroupsFromGroups(\n originalGroupData,\n splitOffGroups,\n );\n this._calculateAndUpdateGroupMap(originalGroupData);\n this._loadPosData(originalGroupData, newGroupsPosData);\n this._groupsModified(\n newGroupsPosData.map((g) => g.posDataJson),\n originalGroupData.posDataJson,\n [],\n );\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public duplicateGroup(duplicatedGroup: ExternalObjectGroup) {\n try {\n const originalGroupData = this._getGroup(duplicatedGroup?.groupId);\n if (originalGroupData) {\n const duplicatedPosDataJson = deepCopy(originalGroupData.posDataJson);\n duplicatedPosDataJson.roots = duplicatedPosDataJson.roots.filter(\n (root: { id: any }) =>\n duplicatedGroup.rootModules.find(\n (duplicatedRoot: ExternalObjectRootModule) =>\n duplicatedRoot.moduleId === root.id,\n ) !== undefined,\n );\n const groupItem = this._addNewGroup(duplicatedPosDataJson, false);\n this._setGroupPosition(groupItem, duplicatedGroup);\n this._designerRequests.loadPosGroups(groupItem.posDataJson, {\n findFreeSpaceInPlan: true,\n });\n this._groupsModified(groupItem.posDataJson, [], []);\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public mergeGroups(\n targetGroup: ExternalObjectGroup,\n idsOfGroupsMerged: string | string[],\n idOfTargetRootModule: string,\n ) {\n try {\n const sourceGroupIds = Array.isArray(idsOfGroupsMerged)\n ? idsOfGroupsMerged\n : [idsOfGroupsMerged];\n if (\n this._groupMap.has(targetGroup.groupId) &&\n sourceGroupIds.length > 0\n ) {\n const originalSourceGroupRoots = [];\n for (const sourceGroupId of sourceGroupIds) {\n const sourceGroupData = this._getGroup(sourceGroupId);\n if (sourceGroupData) {\n originalSourceGroupRoots.push(...sourceGroupData.posDataJson.roots);\n }\n }\n const nonGeneratedRoots = originalSourceGroupRoots.filter(\n (rootModule) => !rootModule.isGenerated,\n );\n const targetGroupData = this._getGroup(targetGroup.groupId);\n if (targetGroupData) {\n const existingRoot = targetGroupData.posDataJson.roots.find(\n (r: PosModuleRootData) => r.id === idOfTargetRootModule,\n );\n if (existingRoot) {\n this._applyImplicitRelevantAttributes(\n this._getLibraryIdForPosData(targetGroupData.posDataJson),\n existingRoot,\n nonGeneratedRoots,\n );\n }\n // We only must merge the non-generated roots, because the generated ones are already in the target group\n targetGroupData.posDataJson.roots.push(...nonGeneratedRoots);\n this._setGroupPosition(targetGroupData, targetGroup);\n this._setGroupContour(targetGroupData, targetGroup);\n this._setRootModulesPosition(targetGroupData, targetGroup);\n this._calculateAndUpdateGroupMap(targetGroupData);\n this._designerRequests.loadPosGroups(targetGroupData.posDataJson, {\n mergedGroups: sourceGroupIds,\n });\n const deletedGroups: string[] = [];\n for (const groupId of sourceGroupIds) {\n if (this._groupMap.has(groupId)) {\n this._groupMap.delete(groupId);\n deletedGroups.push(groupId);\n }\n }\n this._groupsModified([], targetGroupData.posDataJson, deletedGroups);\n }\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n private _applyImplicitRelevantAttributes(\n libraryId: string,\n sourceRootModule: PosModuleRootData,\n rootsToDock: string | any[],\n ) {\n const masterData = this.getLibraryData(libraryId)?.masterData;\n if (!masterData || !sourceRootModule || rootsToDock.length === 0) {\n return;\n }\n const mdModule = masterData.modules.find(\n (m: { id: any }) => m.id === sourceRootModule.name,\n );\n const implicitRelevantAttributes =\n mdModule?.assignedAttributes.filter(\n (a: any) =>\n masterData.attributes.find((attr: { id: any }) => attr.id === a)\n ?.implicitRelevant === true,\n ) ?? [];\n\n for (const rootToDock of rootsToDock) {\n const masterDataModule = masterData.modules.find(\n (m: { id: any }) => m.id === rootToDock.name,\n );\n\n for (const attributeId of implicitRelevantAttributes) {\n const sourceRootAttribute = sourceRootModule.attributes?.find(\n (a: { id: any }) => a.id === attributeId,\n );\n const rootToDockAttribute = masterDataModule?.assignedAttributes.find(\n (a: any) => a === attributeId,\n );\n if (!rootToDockAttribute) {\n continue;\n }\n\n const moduleAttribute = rootToDock.attributes?.find(\n (a: { id: any }) => a.id === attributeId,\n );\n if (moduleAttribute) {\n moduleAttribute.isInput = sourceRootAttribute?.isInput ?? false;\n if (moduleAttribute.isInput === true) {\n moduleAttribute.value = sourceRootAttribute?.value;\n }\n } else {\n if (sourceRootAttribute?.isInput ?? false) {\n rootToDock.attributes?.push({\n id: attributeId,\n value: sourceRootAttribute?.value,\n isInput: true,\n });\n }\n }\n }\n }\n }\n\n public splitRootModuleFromGroup(\n splitGroup: ExternalObjectGroup,\n newGroupedRootModules: ExternalObjectGroup[],\n ) {\n try {\n const originalGroupData = this._getGroup(splitGroup.groupId);\n if (originalGroupData) {\n this._setGroupPosition(originalGroupData, splitGroup);\n this._setGroupContour(originalGroupData, splitGroup);\n this._setRootModulesPosition(originalGroupData, splitGroup);\n const newGroups = Array.isArray(newGroupedRootModules)\n ? newGroupedRootModules\n : [newGroupedRootModules];\n const newGroupsPosData = this._splitOffGroupsFromGroups(\n originalGroupData,\n newGroups,\n );\n this._calculateAndUpdateGroupMap(originalGroupData);\n this._loadPosData(originalGroupData, newGroupsPosData);\n this._groupsModified(\n newGroupsPosData.map((g) => g.posDataJson),\n originalGroupData.posDataJson,\n [],\n );\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public arrangeRootModulesOfGroup(changedGroup: ExternalObjectGroup) {\n try {\n const originalGroupData = this._getGroup(changedGroup.groupId);\n if (originalGroupData) {\n for (const root of originalGroupData.posDataJson.roots) {\n changedGroup.rootModules\n .filter(\n (rootModule: { moduleId: any }) =>\n rootModule.moduleId === root.id,\n )\n .forEach((rootModule: ExternalObjectRootModule) => {\n root.articlePos = rootModule.pos;\n root.rotationY = rootModule.rotationY;\n });\n }\n const calculatedGroup =\n this._calculateAndUpdateGroupMap(originalGroupData);\n this._designerRequests.loadPosGroups(calculatedGroup, {});\n this._groupsModified([], calculatedGroup, []);\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public removedGroup(groupId: string) {\n try {\n if (this._groupMap.has(groupId)) {\n this._groupMap.delete(groupId);\n this._groupsModified([], [], groupId);\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public changedGroupFromHistory(historyGroup: PosGroup, reloadGroup: boolean) {\n try {\n const updatedGroup = this._calculate(historyGroup);\n const groupId = updatedGroup.id;\n const emulatorGroupItem = this._getGroup(groupId);\n if (emulatorGroupItem) {\n emulatorGroupItem.posDataJson = updatedGroup;\n } else {\n this._addGroupToMap(groupId, updatedGroup);\n }\n if (reloadGroup) {\n this._designerRequests.loadPosGroups(historyGroup, {});\n }\n this._groupsModified(\n emulatorGroupItem ? [] : [updatedGroup],\n emulatorGroupItem ? [updatedGroup] : [],\n [],\n );\n } catch (error) {\n console.error(error);\n }\n }\n\n public changedGroupPlanningSituation(changedGroup: ExternalObjectGroup) {\n try {\n const originalGroupData = this._getGroup(changedGroup.groupId);\n if (originalGroupData) {\n this._setGroupPosition(originalGroupData, changedGroup);\n this._setGroupContour(originalGroupData, changedGroup);\n const calculatedGroup =\n this._calculateAndUpdateGroupMap(originalGroupData);\n this._designerRequests.loadPosGroups(calculatedGroup, {});\n this._groupsModified([], calculatedGroup, []);\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public loadedGroup(posDataJson: PosGroup) {\n const libraryId = this._getLibraryIdForPosData(posDataJson);\n if (!this._libraryData.has(libraryId)) {\n this._pendingGroupsToBeLoaded.push(posDataJson);\n return;\n }\n this._loadedGroup(posDataJson);\n }\n\n private _loadPendingGroup(libraryId: string) {\n const groupsToBeLoaded = this._pendingGroupsToBeLoaded.filter(\n (group) => this._getLibraryIdForPosData(group) === libraryId,\n );\n this._pendingGroupsToBeLoaded = this._pendingGroupsToBeLoaded.filter(\n (group) => this._getLibraryIdForPosData(group) !== libraryId,\n );\n groupsToBeLoaded.forEach((group) => this._loadedGroup(group));\n if (this._pendingGroupsToBeLoaded.length === 0) {\n this._groupsCompletelyLoaded();\n }\n }\n\n private _loadedGroup(posDataJson: PosGroup) {\n if (!this._posDataForLoading) {\n this._recalculateLoadedGroup(posDataJson);\n return;\n }\n const posDataToBeLoaded = this._posDataForLoading.groups.find(\n (group) => group.id === posDataJson.id,\n );\n if (!posDataToBeLoaded) {\n this.removedGroup(posDataJson.id);\n this._designerRequests.deleteGroup(posDataJson.id);\n return;\n }\n const newPosData = deepCopy(posDataToBeLoaded);\n newPosData.ver = this.getLibraryData(posDataJson)?.posGroupVersion;\n if (posDataJson.pos !== undefined) {\n newPosData.pos = posDataJson.pos;\n }\n if (posDataJson.rotationY !== undefined) {\n newPosData.rotationY = posDataJson.rotationY;\n }\n this._recalculateLoadedGroup(newPosData);\n }\n\n public _recalculateLoadedGroup(posDataJson: PosGroup) {\n try {\n const groupId = posDataJson.id;\n const newGroupCreated = !this._groupMap.has(groupId);\n if (newGroupCreated) {\n this._addGroupToMap(groupId, posDataJson);\n }\n const groupData = this._getGroup(groupId);\n if (groupData) {\n const calculatedGroup = this._calculateAndUpdateGroupMap(groupData);\n this._designerRequests.loadPosGroups(calculatedGroup, {\n respondWithPositionInPlan: true,\n });\n this._groupsModified(\n newGroupCreated ? calculatedGroup : [],\n newGroupCreated ? [] : calculatedGroup,\n [],\n );\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n public groupsCompletelyLoaded(): void {\n this._planCompletelyLoaded = true;\n this._groupsCompletelyLoaded();\n }\n\n private _groupsCompletelyLoaded() {\n if (\n this._planCompletelyLoaded &&\n this._libraryData.size > 0 &&\n this._pendingGroupsToBeLoaded.length === 0\n ) {\n this._hiCallbacks?.onPosGroupsCompletelyLoaded();\n }\n }\n\n public async getGroupDataForOrder(roomlePlannerId?: string) {\n try {\n const posGroups = Array.from(this._groupMap.values()).map(\n (groupItem) => groupItem.posDataJson,\n );\n // TEST: Add additional data for each position\n let cnt = 1;\n posGroups.forEach((posGroup: { roots: any[] }) => {\n posGroup.roots.forEach((root: { additionalText: string }) => {\n root.additionalText = 'Additional Text ' + cnt++;\n });\n });\n\n const groupData = this.getLibraryData(roomlePlannerId)?.getOrderData(\n posGroups,\n roomlePlannerId,\n );\n if (!groupData) {\n return null;\n }\n const roomInformation = await this._designerRequests.getRoomInformation();\n groupData.rooms = roomInformation?.rooms ?? [];\n return groupData;\n } catch (error) {\n console.error(error);\n return null;\n }\n }\n\n private _setGroupContour(\n emulatorGroupItem: GroupItem,\n changedGroupPosition: ExternalObjectGroup,\n ) {\n if (changedGroupPosition.contours) {\n emulatorGroupItem.posDataJson.contours =\n changedGroupPosition.contours as PosContour[];\n }\n }\n\n private _setGroupPosition(\n emulatorGroupItem: GroupItem,\n newGroupPosition: ExternalObjectGroupPosition,\n ) {\n const group = emulatorGroupItem.posDataJson;\n if (newGroupPosition.pos !== undefined) {\n group.pos = newGroupPosition.pos;\n }\n if (newGroupPosition.rotationY !== undefined) {\n group.rotationY = newGroupPosition.rotationY;\n }\n }\n\n private _setRootModulesPosition(\n emulatorGroupItem: GroupItem,\n rootModulePositions: ExternalObjectGroup,\n ) {\n for (const root of emulatorGroupItem.posDataJson.roots) {\n rootModulePositions.rootModules\n .filter(\n (rootModule: { moduleId: string }) => rootModule.moduleId === root.id,\n )\n .forEach((rootModule: ExternalObjectRootModule) => {\n root.articlePos = rootModule.pos;\n root.rotationY = rootModule.rotationY;\n });\n }\n }\n\n private _loadPosData(\n emulatorGroupItem: GroupItem,\n additionalGroupData: GroupItem[],\n ) {\n const loadPosData = deepCopy(emulatorGroupItem.posDataJson);\n const posDataCollection = Array.isArray(loadPosData)\n ? loadPosData\n : [loadPosData];\n for (const data of additionalGroupData ?? []) {\n posDataCollection.push(deepCopy(data.posDataJson));\n }\n this._designerRequests.loadPosGroups(posDataCollection, {});\n }\n\n private _splitOffGroupsFromGroups(\n originalGroupData: GroupItem | undefined,\n splitOffGroups: ExternalObjectGroup[],\n ): GroupItem[] {\n const newGroupsPosData: GroupItem[] = [];\n for (const newGroup of splitOffGroups ?? []) {\n const newGroupPosDataJson = this._splitOffRootModulesFromGroup(\n originalGroupData,\n newGroup,\n );\n const emulatorGroupItem = this._addNewGroup(newGroupPosDataJson, true);\n newGroupsPosData.push(emulatorGroupItem);\n }\n return newGroupsPosData;\n }\n\n private _splitOffRootModulesFromGroup(\n originalGroupData: GroupItem,\n newGroupedRootModules: ExternalObjectGroup,\n ): PosGroup {\n const splitOffRootModuleIds = newGroupedRootModules.rootModules.map(\n (root: { moduleId: any }) => root.moduleId,\n );\n const group = originalGroupData.posDataJson;\n const splitOffRootModules = group.roots.filter((root: { id: any }) =>\n splitOffRootModuleIds.includes(root.id),\n );\n group.roots = group.roots.filter(\n (root: { id: any }) => !splitOffRootModuleIds.includes(root.id),\n );\n for (const splitOffRootModule of splitOffRootModules) {\n newGroupedRootModules.rootModules\n .filter(\n (rootModule: { moduleId: any }) =>\n rootModule.moduleId === splitOffRootModule.id,\n )\n .forEach((rootModule: ExternalObjectRootModule) => {\n splitOffRootModule.articlePos = rootModule.pos;\n splitOffRootModule.rotationY = rootModule.rotationY;\n });\n }\n for (const remainingRoot of group.roots) {\n if (remainingRoot.isGenerated) {\n splitOffRootModules.push(deepCopy(remainingRoot));\n }\n }\n const newGroupPosDataJson: PosGroup = {\n id: undefined,\n libraryId: group.libraryId,\n pos: newGroupedRootModules.pos,\n rotationY: newGroupedRootModules.rotationY,\n roots: splitOffRootModules,\n ver: group.ver,\n logMessages: [],\n };\n return newGroupPosDataJson;\n }\n\n private _calculateNewGroup(posDataJson: PosGroup, keepRootModuleIDs: any) {\n this._replacesIDs(posDataJson, keepRootModuleIDs);\n return this._calculate(posDataJson);\n }\n\n private _getLibraryIdForPosData(posDataJson: PosGroup): string | undefined {\n if (posDataJson.libraryId) {\n return posDataJson.libraryId;\n }\n return posDataJson.roots.find((r: { libraryId: string }) => r.libraryId)\n ?.libraryId;\n }\n\n private _setSubmoduleImages(\n posDataModule: PosModuleData,\n masterData?: MasterData,\n ) {\n if (!masterData) {\n return;\n }\n if (!posDataModule.modules?.length) {\n return;\n }\n posDataModule.modules.forEach((subModule) => {\n const masterDataModule = masterData.modules.find(\n (m) => m.id === subModule.name,\n );\n if (masterDataModule) {\n subModule.imageUrl = masterDataModule.imageUrl;\n }\n this._setSubmoduleImages(subModule, masterData);\n });\n }\n\n private _calculateAndUpdateGroupMap(groupData: GroupItem) {\n const res = this._calculate(groupData.posDataJson);\n groupData.posDataJson = res;\n this._groupMap.set(groupData.posDataJson.id, groupData);\n return res;\n }\n\n private _addNewGroup(posDataJson: PosGroup, keepRootModuleIDs: boolean) {\n const calculatedPosDataJson = this._calculateNewGroup(\n posDataJson,\n keepRootModuleIDs,\n );\n return this._addGroupToMap(calculatedPosDataJson.id, calculatedPosDataJson);\n }\n\n private _addGroupToMap(groupId: string, posDataJson: any) {\n const emulatorGroupItem = {\n posDataJson,\n opened: false,\n };\n this._groupMap.set(groupId, emulatorGroupItem);\n return emulatorGroupItem;\n }\n\n public updateAttribute(\n rootModuleId: string,\n moduleId: string | null,\n attributeId: string,\n attributeValue: string | boolean,\n ): void {\n if (!rootModuleId) {\n return;\n }\n const emulatorGroup = Array.from(this._groupMap.entries()).find(\n ([, value]) => {\n return value.posDataJson.roots.some((root) => root.id === rootModuleId);\n },\n );\n if (!emulatorGroup) {\n throw new Error('PosGroup not found inside the calculated articles list');\n }\n const [, emulatorGroupItem] = emulatorGroup;\n if (emulatorGroupItem) {\n const modifiedGroups = this._modifyAttributeOfModules(\n emulatorGroupItem,\n moduleId ?? rootModuleId,\n attributeId,\n attributeValue,\n );\n this._designerRequests.loadPosGroups(modifiedGroups, {\n correctArrangement: true,\n });\n this._groupsModified([], modifiedGroups, []);\n }\n }\n\n public modifyAttribute(\n groupId: string,\n moduleIdObjects: ExternalModuleInformation[],\n attributeName: string,\n value: string,\n ) {\n const emulatorGroupItem = this._getGroup(groupId);\n if (emulatorGroupItem) {\n const moduleIds = moduleIdObjects.map(\n (obj) => obj.subModuleId ?? obj.rootModuleId,\n );\n const modifiedGroups = this._modifyAttributeOfModules(\n emulatorGroupItem,\n moduleIds,\n attributeName,\n value,\n );\n this._designerRequests.loadPosGroups(modifiedGroups, {\n correctArrangement: true,\n });\n this._groupsModified([], modifiedGroups, []);\n }\n }\n\n public async getVerifiedAttributeOptions(\n moduleId: string,\n attributeIds?: string | string[],\n ): Promise<Record<string, CheckResult> | undefined> {\n const moduleInfo = this._findModuleInAllGroups(moduleId);\n if (!moduleInfo) {\n console.error('Module not found inside the calculated articles list');\n return undefined;\n }\n if (!moduleInfo.module.checkAttributes) {\n return undefined;\n }\n let attributeOptions: Record<string, CheckDropDownEntry[] | undefined>;\n try {\n attributeOptions = await this.getLibraryData(\n moduleInfo.group,\n )?.getAttributesDropDownValues(moduleInfo.module, attributeIds);\n } catch (error) {\n console.error(error);\n }\n if (!attributeOptions) {\n return undefined;\n }\n const checkResults: Record<string, CheckResult> = {};\n for (const [attributeId, options] of Object.entries(attributeOptions)) {\n if (options && options.length > 0) {\n checkResults[attributeId] = {\n calcResult: options.map((entry: CheckDropDownEntry) => ({\n value: entry.value,\n kind: entry.kind,\n })),\n };\n }\n }\n return checkResults;\n }\n\n public updateAdditionalInfo(\n rootModuleId: string,\n additionalInfo: string,\n ): void {\n const moduleInfo = this._findRootModuleInAllGroups(rootModuleId);\n if (!moduleInfo) {\n console.error(\n 'Root module not found inside the calculated articles list',\n );\n return;\n }\n moduleInfo.rootModule.additionalText = additionalInfo;\n this._designerRequests.loadPosGroups(moduleInfo.group, {});\n this._groupsModified([], moduleInfo.group, []);\n }\n\n public async swapRootModule(\n groupId: string,\n rootModuleId: string,\n articleId: string,\n ): Promise<void> {\n const emulatorGroupItem = this._getGroup(groupId);\n if (!emulatorGroupItem) {\n return;\n }\n const group = emulatorGroupItem.posDataJson;\n const rootModuleToBeReplaced = group.roots.find(\n (root: { id: string }) => root.id === rootModuleId,\n );\n if (!rootModuleToBeReplaced) {\n return;\n }\n const newPosDataJson = await this.newPosDataFromId(articleId);\n const notGeneratedRoots = newPosDataJson.roots.filter(\n (root: PosModuleRootData) => !root.isGenerated,\n );\n if (!newPosDataJson || notGeneratedRoots.length !== 1) {\n return;\n }\n const newRootModule = notGeneratedRoots[0];\n if (rootModuleToBeReplaced) {\n this._applyImplicitRelevantAttributes(\n this._getLibraryIdForPosData(group),\n rootModuleToBeReplaced,\n [newRootModule],\n );\n }\n newRootModule.articlePos = rootModuleToBeReplaced.articlePos;\n newRootModule.rotationY = rootModuleToBeReplaced.rotationY;\n group.roots = group.roots.filter(\n (root: { id: any }) => root.id !== rootModuleId,\n );\n group.roots.push(newRootModule);\n const modifiedGroup = this._calculateAndUpdateGroupMap(emulatorGroupItem);\n const rootModuleMapping = {\n originalModuleId: rootModuleId,\n newModuleId: newRootModule.id,\n };\n this._designerRequests.loadPosGroups(modifiedGroup, {\n newAction: true,\n correctArrangement: true,\n moduleIdMap: [rootModuleMapping],\n });\n this._groupsModified([], modifiedGroup, []);\n }\n\n public _modifyAttributeOfModules(\n emulatorGroupItem: GroupItem,\n moduleIds: string[] | string,\n attributeId: string,\n value: string | boolean,\n ): PosGroup {\n const ids = Array.isArray(moduleIds) ? moduleIds : [moduleIds];\n const libraryData = this.getLibraryData(emulatorGroupItem.posDataJson);\n for (const moduleId of ids) {\n const module = this._findModule(\n emulatorGroupItem.posDataJson.roots,\n moduleId,\n );\n if (module && libraryData) {\n const conflictResults = libraryData.solveModuleAttributeConflict(\n module,\n attributeId,\n value,\n );\n this._setAttribute(module, attributeId, value);\n if (conflictResults && conflictResults.length > 0) {\n conflictResults.forEach((conflictResult) => {\n if (conflictResult.value !== undefined) {\n this._setAttribute(\n module,\n conflictResult.id,\n conflictResult.value,\n );\n }\n });\n }\n }\n }\n const res = this._calculateAndUpdateGroupMap(emulatorGroupItem);\n return res;\n }\n\n private _setAttribute(\n module: PosModuleData,\n attributeId: string,\n value: string | number | boolean,\n ): void {\n if (module.attributes && module.attributes.length > 0) {\n const attribute = module.attributes.find((a) => a.id === attributeId);\n if (attribute) {\n attribute.value = value;\n attribute.isInput = true;\n return;\n }\n }\n\n const attributeData = {\n id: attributeId,\n value: value,\n isInput: true,\n } as PosModuleAttribute;\n if (module.attributes) {\n module.attributes.push(attributeData);\n } else {\n module.attributes = [attributeData];\n }\n }\n\n public findValidSubArticles(posGroupIds: string[] | string): PosArticle[] {\n this._validSubArticles = [];\n const ids = Array.isArray(posGroupIds) ? posGroupIds : [posGroupIds];\n for (const id of ids) {\n const groupItem = this._getGroup(id);\n if (!groupItem) {\n continue;\n }\n const posGroup = groupItem.posDataJson;\n const { libraryId, libraryData } = this._getLibrary(posGroup);\n if (!libraryData) {\n continue;\n }\n const possibleSubArticles: PosArticle[] = Array.from(\n this._posSubArticleMap.values(),\n ).filter((article) => article.libraryId === libraryId);\n try {\n const setOfArticles = libraryData.getValidSubArticles(\n posGroup,\n possibleSubArticles,\n libraryData.masterData,\n );\n this._validSubArticles.push(...Array.from(setOfArticles));\n } catch (error) {\n console.error(error);\n }\n }\n return this._validSubArticles;\n }\n\n private _getValidSubArticle(articleId: string): PosArticle | null {\n const article = this._validSubArticles.find(\n (article) => article.articleId === articleId,\n );\n return article ?? null;\n }\n\n public getValidContainerModulesForSubArticle(\n posGroupIds: string[] | string,\n subArticleId: string,\n ): ExternalObjectValidContainerModules[] {\n const subArticle = this._getValidSubArticle(subArticleId);\n if (!subArticle) {\n return [];\n }\n const ids = Array.isArray(posGroupIds) ? posGroupIds : [posGroupIds];\n const validContainers: ExternalObjectValidContainerModules[] = [];\n for (const id of ids) {\n const groupItem = this._getGroup(id);\n if (!groupItem) {\n continue;\n }\n const posGroup = groupItem.posDataJson;\n const { libraryData } = this._getLibrary(posGroup);\n if (!libraryData) {\n continue;\n }\n try {\n const setOfContainers =\n libraryData.getValidContainerModulesForSubArticle(\n posGroup,\n subArticle,\n libraryData.masterData,\n );\n validContainers.push(...Array.from(setOfContainers));\n } catch (error) {\n console.error(error);\n }\n }\n return validContainers;\n }\n\n public addSubArticle(\n articleId: string,\n rootModuleId: string,\n parentModuleId: string,\n ): void {\n const article = this._getValidSubArticle(articleId);\n if (!article) {\n return;\n }\n const { group } = this._findRootModuleInAllGroups(rootModuleId);\n if (!group) {\n return;\n }\n const modifiedGroup = this._addSubArticle(\n group,\n article,\n rootModuleId,\n parentModuleId,\n );\n this._designerRequests.loadPosGroups(modifiedGroup, {});\n this._groupsModified([], modifiedGroup, []);\n }\n\n public async savePlanSnapshot(): Promise<PlanSnapshot | null> {\n const planSnapshot =\n await this._designerRequests.saveExternalObjectSnapshot();\n if (!planSnapshot) {\n console.error('Failed to save plan snapshot');\n return null;\n }\n return {\n id: planSnapshot.planSnapshotId,\n perspectiveImageLink: planSnapshot.perspectiveImageLink,\n topImageLink: planSnapshot.topImageLink,\n room3dLink: planSnapshot.objectGlbLink,\n room3dFullLink: planSnapshot.fullPlanGlbLink,\n };\n }\n\n private _findRootModuleInAllGroups(\n moduleId: string,\n ): { group: PosGroup; rootModule: PosModuleRootData } | undefined {\n for (const groupData of this._groupMap.values()) {\n const group = groupData.posDataJson;\n const rootModule = group.roots.find(\n (root: PosModuleRootData) => root.id === moduleId,\n );\n if (rootModule !== undefined) {\n return { group, rootModule };\n }\n }\n return undefined;\n }\n\n private _findModuleInAllGroups(\n moduleId: string,\n ): { group: PosGroup; module: PosModuleData } | undefined {\n for (const groupData of this._groupMap.values()) {\n const group = groupData.posDataJson;\n const module = this._findModule(group.roots, moduleId);\n if (module !== undefined) {\n return { group, module };\n }\n }\n return undefined;\n }\n\n private _findModule(\n modules: PosModuleData[],\n moduleId: string,\n ): PosModuleData | undefined {\n for (const module of modules) {\n if (module.id === moduleId) {\n return module;\n }\n if (module.modules && module.modules.length > 0) {\n const subMod = this._findModule(module.modules, moduleId);\n if (subMod !== undefined) {\n return subMod;\n }\n }\n }\n return undefined;\n }\n\n private _replacesIDs(\n posGroup: { id: string; roots: any },\n keepRootModuleIDs: any,\n ) {\n posGroup.id = this._getNextID();\n if (!keepRootModuleIDs) {\n for (const root of posGroup.roots) {\n this._replacesModuleIDs(root);\n }\n }\n }\n\n private _replacesModuleIDs(module: { id: string; modules: any }) {\n module.id = this._getNextID();\n if (module.modules) {\n for (const subModule of module.modules) {\n this._replacesModuleIDs(subModule);\n }\n }\n }\n\n private _getNextID() {\n if ((window as any).uuidv4) {\n return (window as any).uuidv4();\n }\n let id = (this._nextPosDataId++).toString();\n if (id.length < 4) {\n id = '0'.repeat(4 - id.length) + id;\n }\n return 'id' + id;\n }\n\n private async _groupsModified(\n addedPosGroups: PosGroup[] | PosGroup,\n changedPosGroups: PosGroup[] | PosGroup,\n deletedPosGroupIds: string[] | string,\n ) {\n const addedGroupsArray = Array.isArray(addedPosGroups)\n ? addedPosGroups\n : [addedPosGroups];\n if (addedGroupsArray.length > 0) {\n await this._hiCallbacks?.onPosGroupAdded(addedGroupsArray);\n }\n const changedGroupsArray = Array.isArray(changedPosGroups)\n ? changedPosGroups\n : [changedPosGroups];\n if (changedGroupsArray.length > 0) {\n await this._hiCallbacks?.onPosGroupChanged(changedGroupsArray);\n }\n const deletedPosGroupIdsArray = Array.isArray(deletedPosGroupIds)\n ? deletedPosGroupIds\n : [deletedPosGroupIds];\n if (deletedPosGroupIdsArray.length > 0) {\n await this._hiCallbacks?.onPosGroupDeleted(deletedPosGroupIdsArray);\n }\n this._calculatePrice();\n }\n\n private _calculatePrice() {\n const posGroups = Array.from(this._groupMap.values()).map(\n (groupData) => groupData.posDataJson,\n );\n this._hiCallbacks?.onPriceCalc(posGroups);\n }\n\n private _calculate(originalPosDataJson: PosGroup) {\n const { libraryId, libraryData } = this._getLibrary(originalPosDataJson);\n if (!libraryData) {\n return null;\n }\n const posGroup = deepCopy(originalPosDataJson);\n posGroup.libraryId = libraryId;\n if (posGroup.logMessages) {\n posGroup.logMessages = [];\n }\n\n let calculatedResult: PosGroup = posGroup;\n try {\n calculatedResult = libraryData.calculateGroup(posGroup);\n } catch (error) {\n console.error('Error calculating group:', error);\n }\n\n this._takeOverPropertiesFromOriginalGroup(\n libraryId,\n libraryData,\n originalPosDataJson,\n calculatedResult,\n );\n return calculatedResult;\n }\n\n private _addSubArticle(\n originalPosDataJson: PosGroup,\n article: PosArticle,\n rootId: string,\n parentModuleId: string,\n ) {\n const { libraryId, libraryData } = this._getLibrary(originalPosDataJson);\n if (!libraryData) {\n return null;\n }\n const posGroup = deepCopy(originalPosDataJson);\n posGroup.libraryId = libraryId;\n if (posGroup.logMessages) {\n posGroup.logMessages = [];\n }\n\n let calculatedResult: PosGroup = posGroup;\n try {\n calculatedResult = libraryData.addSubArticle(\n posGroup,\n article,\n rootId,\n parentModuleId,\n );\n calculatedResult = libraryData.calculateGroup(calculatedResult);\n } catch (error) {\n console.error('Error adding sub article to group:', error);\n }\n\n this._takeOverPropertiesFromOriginalGroup(\n libraryId,\n libraryData,\n originalPosDataJson,\n calculatedResult,\n );\n return calculatedResult;\n }\n\n private _getLibrary(posGroup: PosGroup): LibraryIdAndLibraryData {\n const libraryId = this._getLibraryIdForPosData(posGroup);\n const libraryData = this.getLibraryData(libraryId);\n return { libraryId, libraryData };\n }\n\n private _takeOverPropertiesFromOriginalGroup(\n libraryId: string,\n libraryData: LibraryData,\n originalArticleGroup: PosGroup,\n calculatedGroupData: PosGroup,\n ) {\n // take over thee position and rotation from the original data\n if (originalArticleGroup.pos !== undefined) {\n calculatedGroupData.pos = originalArticleGroup.pos;\n }\n if (originalArticleGroup.rotationY !== undefined) {\n calculatedGroupData.rotationY = originalArticleGroup.rotationY;\n }\n\n // take over the other properties from the original data\n const masterData = libraryData.masterData;\n calculatedGroupData.roots.forEach((root: PosModuleRootData) => {\n const posArticleGroupRoot = originalArticleGroup.roots.find(\n (r: { id: any }) => r.id === root.id,\n );\n const module = masterData?.modules.find((p) => p.id === root.name);\n\n root.libraryId = posArticleGroupRoot?.libraryId ?? libraryId;\n root.articleName =\n posArticleGroupRoot?.articleName ??\n posArticleGroupRoot?.articleId ??\n module?.name ??\n module?.id;\n root.articleId =\n posArticleGroupRoot?.articleId ??\n posArticleGroupRoot?.articleName ??\n module?.id ??\n module?.name;\n root.imageUrl = posArticleGroupRoot?.imageUrl ?? module?.imageUrl;\n root.desc = posArticleGroupRoot?.desc ?? module?.desc;\n root.category = posArticleGroupRoot?.category;\n root.additionalText = posArticleGroupRoot?.additionalText;\n if (root.canBeDeleted === undefined) {\n root.canBeDeleted = !root.isGenerated;\n }\n this._setSubmoduleImages(root, masterData);\n });\n }\n}\n","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5naWZ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3N0cmluZ2lmeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLFFBQVEsTUFBTSxlQUFlLENBQUM7QUFNckMsTUFBTSxTQUFTLEdBQWEsRUFBRSxDQUFDO0FBRS9CLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxHQUFHLEVBQUUsRUFBRSxDQUFDLEVBQUUsQ0FBQztJQUM3QixTQUFTLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxHQUFHLEtBQUssQ0FBQyxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUNwRCxDQUFDO0FBRUQsTUFBTSxVQUFVLGVBQWUsQ0FBQyxHQUFlLEVBQUUsTUFBTSxHQUFHLENBQUM7SUFNekQsT0FBTyxDQUNMLFNBQVMsQ0FBQyxHQUFHLENBQUMsTUFBTSxHQ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ENBQUMsR0FBRyxDQUFDLE1BQU0sR0FBRyxFQUFFLENBQUMsQ0FBQyxDQUM1QixDQUFDLFdBQVcsRUFBRSxDQUFDO0FBQ2xCLENBQUM7QUFFRCxTQUFTLFNBQVMsQ0FBQyxHQUFlLEVBQUUsTUFBTSxHQUFHLENBQUM7SUFDNUMsTUFBTSxJQUFJLEdBQUcsZUFBZSxDQUFDLEdBQUcsRUFBRSxNQUFNLENBQUMsQ0FBQztJQU8xQyxJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUM7UUFDcEIsTUFBTSxTQUFTLENBQUMsNkJBQTZCLENBQUMsQ0FBQztJQUNqRCxDQUFDO0lBRUQsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDO0FBRUQsZUFBZSxTQUFTLENBQUMifQ==","let getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n getRandomValues = crypto.getRandomValues.bind(crypto);\n }\n return getRandomValues(rnds8);\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm5nLWJyb3dzZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcm5nLWJyb3dzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsSUFBSSxlQUEwRCxDQUFDO0FBRS9ELE1BQU0sS0FBSyxHQUFHLElBQUksVUFBVSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0FBRWpDLE1BQU0sQ0FBQyxPQUFPLFVBQVUsR0FBRztJQUV6QixJQUFJLENBQUMsZUFBZSxFQUFFLENBQUM7UUFDckIsSUFBSSxPQUFPLE1BQU0sS0FBSyxXQUFXLElBQUksQ0FBQyxNQUFNLENBQUMsZUFBZSxFQUFFLENBQUM7WUFDN0QsTUFBTSxJQUFJLEtBQUssQ0FDYiwwR0FBMEcsQ0FDM0csQ0FBQztRQUNKLENBQUM7UUFFRCxlQUFlLEdBQUcsTUFBTSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDeEQsQ0FBQztJQUVELE9BQU8sZUFBZSxDQUFDLEtBQUssQ0FBQyxDQUFDO0FBQ2hDLENBQUMifQ==","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmF0aXZlLWJyb3dzZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbmF0aXZlLWJyb3dzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLEdBQ2QsT0FBTyxNQUFNLEtBQUssV0FBVyxJQUFJLE1BQU0sQ0FBQyxVQUFVLElBQUksTUFBTSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUM7QUFFdkYsZUFBZSxFQUFFLFVBQVUsRUFBRSxDQUFDIn0=","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n const rnds = options.random || (options.rng || rng)();\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidjQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNl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QUMsQ0FBQyxDQUFDLENBQUM7UUFDNUIsQ0FBQztRQUVELE9BQU8sR0FBRyxDQUFDO0lBQ2IsQ0FBQztJQUVELE9BQU8sZUFBZSxDQUFDLElBQUksQ0FBQyxDQUFDO0FBQy9CLENBQUM7QUFFRCxlQUFlLEVBQUUsQ0FBQyJ9","import type { GlueLogic } from './glue-logic';\nimport type RoomlePlanner from '../../planner-core/src/roomle-planner';\nimport type { BASE_CONTEXT } from '../../common-core/src/main';\nimport type { SELECTION_MODE } from '../../configurator-core/src/utils/selection-handler';\nimport type { CallbackObjectType } from '../../planner-core/src/utils/planner-scene-utils';\nimport type { SelectionPayload } from '../../planner-core/src/roomle-planner-ui-callback';\nimport type PlanElementViewModel from '../../common-core/src/view-model/plan-element-view-model';\nimport type { CancelSelectionReasons } from '../../typings/planner';\nimport type {\n ExternalModuleInformation,\n ExternalObjectGroup,\n} from './external-object-api-callbacks';\n\nexport const initCallbacks = (\n roomlePlanner: RoomlePlanner,\n gluLogic: GlueLogic,\n) => {\n // @ts-ignore -- bla\n roomlePlanner.callbacks.onMergeExternalObjectGroup = (\n targetGroup: ExternalObjectGroup,\n idsOfGroupsMerged: string | string[],\n idOfTargetRootModule: string,\n ) => {\n gluLogic.mergeGroups(targetGroup, idsOfGroupsMerged, idOfTargetRootModule);\n };\n // @ts-ignore -- bla\n roomlePlanner.callbacks.onSplitExternalObjectGroup = (\n splitGroup: ExternalObjectGroup,\n newGroupedRootModules: ExternalObjectGroup[],\n ) => {\n gluLogic.splitRootModuleFromGroup(splitGroup, newGroupedRootModules);\n };\n // @ts-ignore -- bla\n roomlePlanner.callbacks.onExternalObjectGroupArrangementChanged = (\n changedGroup: ExternalObjectGroup,\n ) => {\n gluLogic.arrangeRootModulesOfGroup(changedGroup);\n };\n\n roomlePlanner.callbacks.onDeleteExternalObjectGroup = (\n groupIdToDelete: string,\n ) => {\n gluLogic.removedGroup(groupIdToDelete);\n };\n // @ts-ignore -- bla\n roomlePlanner.callbacks.onDeleteExternalObjectRootModule = (\n remainingGroup: ExternalObjectGroup,\n rootModuleIdToDelete: string,\n splitOffGroups?: ExternalObjectGroup[],\n ) => {\n gluLogic.deleteRootModule(\n remainingGroup,\n rootModuleIdToDelete,\n splitOffGroups ?? [],\n );\n };\n\n roomlePlanner.callbacks.onDeleteExternalObjectSubModule = (\n _rootModuleId: string,\n _subModuleIdToDelete: string,\n ) => {\n // Currently not used in GlueLogic\n };\n\n roomlePlanner.callbacks.onDuplicateExternalObjectGroup = (\n _sourceGroupId: string,\n duplicatedGroup: ExternalObjectGroup,\n ) => {\n gluLogic.duplicateGroup(duplicatedGroup);\n };\n // @ts-ignore -- bla\n roomlePlanner.callbacks.onChangedExternalObjectGroupPlan = (\n group: ExternalObjectGroup,\n ) => {\n gluLogic.changedGroupPlanningSituation(group);\n };\n\n roomlePlanner.callbacks.onExternalObjectEnvironmentChanged = (\n _affectedGroupIds: string[],\n ) => {\n // Currently not used in GlueLogic\n };\n\n roomlePlanner.callbacks.onExternalObjectGroupChanged = (\n groupPosData: string,\n ) => {\n const groupPosDataJson = JSON.parse(groupPosData);\n gluLogic.changedGroupFromHistory(groupPosDataJson, false);\n };\n\n roomlePlanner.callbacks.onExternalObjectGroupLoaded = (\n groupPosData: string,\n ) => {\n const groupPosDataJson = JSON.parse(groupPosData);\n gluLogic.loadedGroup(groupPosDataJson);\n };\n\n roomlePlanner.callbacks.onExternalObjectAttributeChanged = (\n groupId: string,\n moduleIds: string | ExternalModuleInformation[] | null,\n attributeId: string,\n value: string,\n ) => {\n if (Array.isArray(moduleIds)) {\n gluLogic.modifyAttribute(groupId, moduleIds, attributeId, value);\n } else {\n gluLogic.modifyAttribute(\n groupId,\n [\n {\n groupId,\n rootModuleId: moduleIds as string,\n subModuleId: null,\n },\n ],\n attributeId,\n value,\n );\n }\n };\n\n roomlePlanner.callbacks.onCompletelyLoaded = () => {\n gluLogic.groupsCompletelyLoaded();\n };\n\n roomlePlanner.callbacks.onPlanSnapshotCreated = (..._args: any) => {\n // Currently not used in GlueLogic\n };\n\n roomlePlanner.callbacks.onExternalObjectModuleSelected = (\n groupId: string,\n rootModuleId: string | null,\n subModuleId: string | null,\n ) => {\n gluLogic.hiObjectSelection.groupOrModuleSelected(\n groupId,\n rootModuleId,\n subModuleId,\n );\n };\n\n roomlePlanner.callbacks.onContextChanged = (context: BASE_CONTEXT): void => {\n gluLogic.hiObjectSelection.contextChanged(context);\n };\n\n roomlePlanner.callbacks.onSelectionChange = (\n selectionMode: SELECTION_MODE,\n objectType: CallbackObjectType,\n payload: SelectionPayload,\n payloadPromise: Promise<SelectionPayload>,\n planElementViewModel: PlanElementViewModel,\n ): void => {\n gluLogic.hiObjectSelection.selectionChanged(\n selectionMode,\n objectType,\n payload,\n payloadPromise,\n planElementViewModel,\n );\n };\n\n roomlePlanner.callbacks.onSelectionCancel = (\n reason: CancelSelectionReasons,\n ): void => {\n gluLogic.hiObjectSelection.selectionCancel(reason);\n };\n};\n","import type RoomlePlanner from '../../planner-core/src/roomle-planner';\nimport type { GlueLogic } from './glue-logic';\nimport type { KernelPlanObject } from '../../typings/kernel';\n\nconst getISO8601Date = (date = new Date()) => {\n // Get the ISO string (in UTC)\n let isoString = date.toISOString();\n\n // Remove the 'Z' at the end which indicates UTC\n isoString = isoString.slice(0, -1);\n\n // Find the position of milliseconds\n const msPosition = isoString.lastIndexOf('.');\n\n // Get the base timestamp with 3 digits of milliseconds and extend with zeros\n let baseTimestamp = isoString;\n\n if (msPosition !== -1) {\n // Add 4 zeros to extend from 3 to 7 digits of precision\n baseTimestamp = isoString.substring(0, msPosition + 4) + '0000';\n }\n\n // Get timezone offset in minutes and convert to hours and minutes\n const offsetMinutes = date.getTimezoneOffset();\n const offsetHours = Math.abs(Math.floor(offsetMinutes / 60));\n const offsetMins = Math.abs(offsetMinutes % 60);\n\n // Format the offset as +HH:MM or -HH:MM\n const offsetSign = offsetMinutes <= 0 ? '+' : '-';\n const offsetString = `${offsetSign}${String(offsetHours).padStart(\n 2,\n '0',\n )}:${String(offsetMins).padStart(2, '0')}`;\n\n return baseTimestamp + offsetString;\n};\n\nexport const createEmptyOrder = () => {\n return {\n id: (window as any).uuidv4\n ? (window as any).uuidv4()\n : '00000000-0000-0000-0000-000000000000',\n state: 'New',\n orderNumber: '736362',\n orderName: 'Bedroom & bathroom 01',\n orderDescription: 'Lorem ipsum dolor sit amet...',\n project: 'Single family house Müller John',\n personInCharge: 'Joe',\n orderDate: getISO8601Date(),\n deliveryDatePlanned: getISO8601Date(\n new Date(Date.now() + 14 * 24 * 60 * 60 * 1000),\n ),\n addresses: [\n {\n type: 'Delivery, Billing',\n street: 'Musterstraße',\n houseNumber: '1',\n postalCode: '12345',\n city: 'Musterstadt',\n country: 'Deutschland',\n },\n ],\n customerName: 'Müller & Co.',\n customerNumber: '462642',\n createdAt: getISO8601Date(),\n changedAt: getISO8601Date(),\n changedBy: 'Selfish',\n items: [] as any[],\n };\n};\n\nconst _addMerchantPositions = async (\n roomlePlanner: RoomlePlanner,\n groupData: any,\n) => {\n const planOverview = await roomlePlanner.getPlanOverview();\n const count: Record<string, number> = {}; // key is id and value is count\n const itemIds = (\n planOverview.objects as unknown as KernelPlanObject[]\n ).reduce((acc: string[], item: any) => {\n if (item.catalogItemId) {\n if (!count[item.catalogItemId]) {\n count[item.catalogItemId] = 0;\n acc.push(item.catalogItemId);\n }\n count[item.catalogItemId]++;\n }\n return acc;\n }, []);\n const items =\n Array.isArray(itemIds) && itemIds.length > 0\n ? await roomlePlanner.getRapiAccess().getItems(itemIds)\n : [];\n const merchantItems = items.filter((item: any) => {\n if (item.manufacturerSKU !== undefined) {\n item.count = count[item.id];\n return true;\n }\n return false;\n });\n if (Array.isArray(merchantItems) && merchantItems.length > 0) {\n if (!groupData.items) {\n groupData.items = [];\n }\n let posNo = groupData.items.reduce((acc: number, item: any) => {\n if (item.items?.length) {\n return acc + item.items.length;\n }\n return acc;\n }, 0);\n merchantItems.forEach((item) => {\n const pos = {} as any;\n pos.type = 'Position';\n pos.name = (++posNo).toString();\n pos.articleNumber = item.manufacturerSKU;\n pos.articleName = item.label;\n pos.catalog = item.catalog;\n pos.quantity = item.count;\n pos.height = item.displayedHeight;\n pos.width = item.displayedWidth;\n pos.depth = item.displayedDepth;\n pos.color = item.basecolor;\n pos.procurementType = 'PTO';\n pos.additionalData = [];\n if (item.perspectiveImage) {\n pos.additionalData.push({\n category: 'ArticleImage',\n downloadUri: item.perspectiveImage,\n type: 'Image',\n });\n }\n groupData.items.push(pos);\n });\n }\n};\n\nexport default class Orders {\n private _roomlePlanner: RoomlePlanner;\n private _glueLogic: GlueLogic;\n\n constructor(roomlePlanner: RoomlePlanner, glueLogic: GlueLogic) {\n this._roomlePlanner = roomlePlanner;\n this._glueLogic = glueLogic;\n }\n\n public async placeOrder() {\n const planData = await this._glueLogic.savePlanSnapshot();\n if (!planData) {\n console.error('Could not save plan snapshot before placing order');\n return;\n }\n const hiCallbacks = this._glueLogic.hiCallbacks;\n\n let groupData = await this._glueLogic.getGroupDataForOrder(planData.id);\n let order = createEmptyOrder();\n order.items.push(groupData as never);\n\n const priceData = await hiCallbacks?.onFetchPrice(order);\n\n if (priceData) {\n order = priceData.orderData;\n groupData = order.items[0];\n } else {\n order.items.push(groupData as never);\n await _addMerchantPositions(this._roomlePlanner, groupData);\n }\n // Add the images to the group\n if (!Array.isArray(groupData.additionalData)) {\n groupData.additionalData = [];\n }\n if (planData.perspectiveImageLink) {\n groupData.additionalData.push({\n type: 'Image',\n category: 'OverviewImage',\n downloadUri: planData.perspectiveImageLink,\n });\n }\n if (planData.topImageLink) {\n groupData.additionalData.push({\n type: 'Image',\n category: 'AboveImage',\n downloadUri: planData.topImageLink,\n });\n }\n if (planData.room3dLink) {\n groupData.additionalData.push({\n type: 'ThreeD',\n category: 'ThreeDModel',\n downloadUri: planData.room3dLink,\n });\n }\n\n await hiCallbacks?.onPlaceOrder(order);\n }\n\n public async fetchPrice(planId?: string) {\n let groupData = await this._glueLogic.getGroupDataForOrder(planId);\n let order = createEmptyOrder();\n order.items.push(groupData as never);\n return this._glueLogic.hiCallbacks?.onFetchPrice(order);\n }\n}\n","import type { HiCallbacks } from '../../../../embedding-lib/src/embedding-lib';\nimport type {\n GlueLogic,\n LibraryData,\n PlanSnapshot,\n RoomDesignerRequests,\n} from './glue-logic';\nimport type { ExternalObjectGroup } from 'roomle-core-hsc/src/embind/plannerCoreInterface';\nimport type { ExternalModuleInformation } from '../../typings/kernel';\nimport type {\n CheckResult,\n PosArticle,\n PosGroup,\n PosSaveData,\n} from './model/oc-scripts-domain.model';\nimport type { HiObjectSelectionApi } from './hi-object-selection';\nimport type {\n ExternalObjectSnapshotSaveResult,\n ExternalRoomInformation,\n LoadExternalObjectOptions,\n} from './external-object-api';\nimport type { ExternalObjectValidContainerModules } from './external-object-api-callbacks';\n\nexport class GlueLayerRequestDebugLogging implements GlueLogic {\n private _glueLogic: GlueLogic;\n private _hiCallbacks: HiCallbacks;\n\n constructor(glueLogic: GlueLogic, hiCallbacks: HiCallbacks) {\n this._glueLogic = glueLogic;\n this._hiCallbacks = hiCallbacks;\n }\n\n public get hiCallbacks(): HiCallbacks | null {\n return this._hiCallbacks;\n }\n\n public get hiObjectSelection(): HiObjectSelectionApi {\n return this._glueLogic.hiObjectSelection;\n }\n\n private _logRequest(message: string, ...args: Array<string | null>) {\n let messageAndArgs = message;\n if (args) {\n args.forEach((item) => {\n messageAndArgs += ' ' + item;\n });\n }\n this._hiCallbacks.onLogMessage?.('HI REQUEST', messageAndArgs);\n }\n\n public isLibraryLoaded(libraryId: string): boolean {\n return this._glueLogic.isLibraryLoaded(libraryId);\n }\n\n public getLibraryData(libraryId: string): LibraryData | null {\n return this._glueLogic.getLibraryData(libraryId);\n }\n\n public addLibrary(libraryData: LibraryData): void {\n this._logRequest('addLibrary', libraryData.libraryId);\n this._glueLogic.addLibrary(libraryData);\n }\n\n public setPosDataForLoading(posData: PosSaveData | null): void {\n this._logRequest('setPosDataForLoading', posData ? 'set' : 'null');\n this._glueLogic.setPosDataForLoading(posData);\n }\n\n public loadPosData(articleCatalogJson: any, libraryId: string): void {\n this._logRequest('loadPosData', libraryId);\n this._glueLogic.loadPosData(articleCatalogJson, libraryId);\n }\n\n public mergeGroups(\n targetGroup: ExternalObjectGroup,\n idsOfGroupsMerged: string | string[],\n idOfTargetRootModule: string,\n ): void {\n this._logRequest(\n 'mergeGroups',\n targetGroup.groupId,\n JSON.stringify(idsOfGroupsMerged),\n idOfTargetRootModule,\n );\n this._glueLogic.mergeGroups(\n targetGroup,\n idsOfGroupsMerged,\n idOfTargetRootModule,\n );\n }\n\n public deleteRootModule(\n remainingGroup: ExternalObjectGroup,\n rootModuleIdToDelete: string,\n splitOffGroups: ExternalObjectGroup[],\n ): void {\n this._logRequest(\n 'deleteRootModule',\n JSON.stringify(remainingGroup),\n rootModuleIdToDelete,\n JSON.stringify(splitOffGroups),\n );\n this._glueLogic.deleteRootModule(\n remainingGroup,\n rootModuleIdToDelete,\n splitOffGroups,\n );\n }\n\n public splitRootModuleFromGroup(\n splitGroup: ExternalObjectGroup,\n newGroupedRootModules: ExternalObjectGroup[],\n ): void {\n this._logRequest(\n 'splitRootModuleFromGroup',\n JSON.stringify(splitGroup),\n JSON.stringify(newGroupedRootModules),\n );\n this._glueLogic.splitRootModuleFromGroup(splitGroup, newGroupedRootModules);\n }\n\n public duplicateGroup(duplicatedGroup: ExternalObjectGroup): void {\n this._logRequest('duplicateGroup', duplicatedGroup.groupId);\n this._glueLogic.duplicateGroup(duplicatedGroup);\n }\n\n public modifyAttribute(\n groupId: string,\n moduleIdObjects: ExternalModuleInformation[],\n attributeName: string,\n value: string,\n ): void {\n this._logRequest(\n 'modifyAttribute',\n groupId,\n JSON.stringify(moduleIdObjects),\n attributeName,\n value,\n );\n this._glueLogic.modifyAttribute(\n groupId,\n moduleIdObjects,\n attributeName,\n value,\n );\n }\n\n public updateAttribute(\n rootModuleId: string,\n moduleId: string | null,\n attributeId: string,\n attributeValue: string | boolean,\n ): void {\n this._logRequest(\n 'updateAttribute',\n rootModuleId,\n moduleId,\n attributeId,\n attributeValue.toString(),\n );\n this._glueLogic.updateAttribute(\n rootModuleId,\n moduleId,\n attributeId,\n attributeValue,\n );\n }\n\n public getVerifiedAttributeOptions(\n moduleId: string,\n attributeIds?: string | string[],\n ): Promise<Record<string, CheckResult> | undefined> {\n this._logRequest(\n 'getVerifiedAttributeOptions',\n moduleId,\n attributeIds ? JSON.stringify(attributeIds) : '[]',\n );\n return this._glueLogic.getVerifiedAttributeOptions(moduleId, attributeIds);\n }\n\n public updateAdditionalInfo(\n rootModuleId: string,\n additionalInfo: string,\n ): void {\n this._logRequest('updateAdditionalInfo', rootModuleId, additionalInfo);\n this._glueLogic.updateAdditionalInfo(rootModuleId, additionalInfo);\n }\n\n public findValidSubArticles(posGroupIds: string[] | string): PosArticle[] {\n this._logRequest(\n 'findValidSubArticles',\n Array.isArray(posGroupIds) ? JSON.stringify(posGroupIds) : posGroupIds,\n );\n return this._glueLogic.findValidSubArticles(posGroupIds);\n }\n\n public getValidContainerModulesForSubArticle(\n posGroupIds: string[] | string,\n subArticleId: string,\n ): ExternalObjectValidContainerModules[] {\n this._logRequest(\n 'getValidContainerModulesForSubArticle',\n Array.isArray(posGroupIds) ? JSON.stringify(posGroupIds) : posGroupIds,\n subArticleId,\n );\n return this._glueLogic.getValidContainerModulesForSubArticle(\n posGroupIds,\n subArticleId,\n );\n }\n\n public addSubArticle(\n articleId: string,\n rootModuleId: string,\n parentModuleId: string,\n ): void {\n this._logRequest('addSubArticle', articleId, rootModuleId, parentModuleId);\n this._glueLogic.addSubArticle(articleId, rootModuleId, parentModuleId);\n }\n\n public swapRootModule(\n groupId: string,\n rootModuleId: string,\n articleId: string,\n ): void {\n this._logRequest('swapRootModule', groupId, rootModuleId, articleId);\n this._glueLogic.swapRootModule(groupId, rootModuleId, articleId);\n }\n\n public arrangeRootModulesOfGroup(changedGroup: ExternalObjectGroup): void {\n this._logRequest('arrangeRootModulesOfGroup', JSON.stringify(changedGroup));\n this._glueLogic.arrangeRootModulesOfGroup(changedGroup);\n }\n\n public changedGroupPlanningSituation(\n changedGroup: ExternalObjectGroup,\n ): void {\n this._logRequest('changedGroupPlanningSituation', changedGroup.groupId);\n this._glueLogic.changedGroupPlanningSituation(changedGroup);\n }\n\n public changedGroupFromHistory(\n posDataJson: PosGroup,\n reloadGroup: boolean,\n ): void {\n this._logRequest(\n 'changedGroupFromHistory',\n posDataJson.id,\n reloadGroup.toString(),\n );\n this._glueLogic.changedGroupFromHistory(posDataJson, reloadGroup);\n }\n\n public loadedGroup(posDataJson: PosGroup): void {\n this._logRequest('loadedGroup', posDataJson.id);\n this._glueLogic.loadedGroup(posDataJson);\n }\n\n public groupsCompletelyLoaded(): void {\n this._logRequest('groupsCompletelyLoaded');\n this._glueLogic.groupsCompletelyLoaded();\n }\n\n public removedGroup(groupId: string): void {\n this._logRequest('removedGroup', groupId);\n this._glueLogic.removedGroup(groupId);\n }\n\n public openCloseGroup(groupId: string): void {\n this._logRequest('openCloseGroup', groupId);\n this._glueLogic.openCloseGroup(groupId);\n }\n\n public getSaveDataGroups(): Promise<PosGroup[] | null> {\n this._logRequest('getSaveDataGroups');\n return this._glueLogic.getSaveDataGroups();\n }\n\n public async newPosDataFromId(id: string): Promise<PosGroup> {\n this._logRequest('newPosDataFromId', id);\n return this._glueLogic.newPosDataFromId(id);\n }\n\n public async newPosDataFromGroup(posDataJson: PosGroup): Promise<PosGroup> {\n this._logRequest('newPosDataFromId', JSON.stringify(posDataJson));\n return this._glueLogic.newPosDataFromGroup(posDataJson);\n }\n\n public getGroupDataForOrder(roomlePlannerId?: string): Promise<any> {\n this._logRequest('getGroupDataForOrder', roomlePlannerId);\n return this._glueLogic.getGroupDataForOrder(roomlePlannerId);\n }\n\n public savePlanSnapshot(): Promise<PlanSnapshot | null> {\n this._logRequest('savePlanSnapshot');\n return this._glueLogic.savePlanSnapshot();\n }\n}\n\nexport class GlueLayerResponseDebugLogging implements RoomDesignerRequests {\n private _roomDesignerRequests: RoomDesignerRequests;\n private _hiCallbacks: HiCallbacks;\n\n constructor(\n roomDesignerRequests: RoomDesignerRequests,\n hiCallbacks: HiCallbacks,\n ) {\n this._roomDesignerRequests = roomDesignerRequests;\n this._hiCallbacks = hiCallbacks;\n }\n\n private _logResponse(message: string, ...args: Array<string | null>) {\n let messageAndArgs = message;\n if (args) {\n args.forEach((item) => {\n messageAndArgs += ' ' + item;\n });\n }\n this._hiCallbacks.onLogMessage?.('HI RESPONSE', messageAndArgs);\n }\n\n public loadMasterData(masterData: any): void {\n this._logResponse('loadMasterData');\n this._roomDesignerRequests.loadMasterData(masterData);\n }\n\n public async loadPosGroups(\n posDataJson: PosGroup | PosGroup[],\n options: LoadExternalObjectOptions,\n ): Promise<void> {\n const groupIds = Array.isArray(posDataJson)\n ? posDataJson.map((group) => group.id).join(',')\n : posDataJson.id;\n this._logResponse(\n 'loadPosGroups',\n groupIds,\n options.newAction?.toString() ?? 'false',\n options.findFreeSpaceInPlan?.toString() ?? 'false',\n options.correctArrangement?.toString() ?? 'false',\n options.moduleIdMap ? JSON.stringify(options.moduleIdMap) : '[]',\n options.mergedGroups ? JSON.stringify(options.mergedGroups) : '[]',\n options.respondWithPositionInPlan?.toString() ?? 'false',\n );\n return this._roomDesignerRequests.loadPosGroups(posDataJson, options);\n }\n\n public async selectGroup(groupId: string): Promise<void> {\n this._logResponse('selectGroup', groupId);\n return this._roomDesignerRequests.selectGroup(groupId);\n }\n\n public async selectRoot(rootModuleId: string): Promise<void> {\n this._logResponse('selectRoot', rootModuleId);\n return this._roomDesignerRequests.selectRoot(rootModuleId);\n }\n\n public async selectModule(\n rootModuleId: string,\n subModuleId: string,\n ): Promise<void> {\n this._logResponse('selectModule', rootModuleId, subModuleId);\n return this._roomDesignerRequests.selectModule(rootModuleId, subModuleId);\n }\n\n public openCloseGroup(\n groupOrRootModuleId: string,\n subModuleId: string | null,\n open: boolean,\n animate: boolean,\n ) {\n this._logResponse(\n 'openCloseGroup',\n groupOrRootModuleId,\n subModuleId,\n open.toString(),\n animate.toString(),\n );\n this._roomDesignerRequests.openCloseGroup(\n groupOrRootModuleId,\n subModuleId,\n open,\n animate,\n );\n return Promise.resolve();\n }\n\n public deleteGroup(groupId: string): void {\n this._logResponse('deleteGroup', groupId);\n return this._roomDesignerRequests.deleteGroup(groupId);\n }\n\n public deleteRootModule(rootModuleId: string): void {\n this._logResponse('deleteRootModule', rootModuleId);\n return this._roomDesignerRequests.deleteRootModule(rootModuleId);\n }\n\n public getPosDataOfAllGroups(): Promise<PosGroup[]> {\n this._logResponse('getPosDataOfAllGroups');\n return this._roomDesignerRequests.getPosDataOfAllGroups();\n }\n\n public getRoomInformation(): Promise<ExternalRoomInformation> {\n this._logResponse('getRoomInformation');\n return this._roomDesignerRequests.getRoomInformation();\n }\n\n public saveExternalObjectSnapshot(): Promise<ExternalObjectSnapshotSaveResult | null> {\n this._logResponse('saveExternalObjectSnapshot');\n return this._roomDesignerRequests.saveExternalObjectSnapshot();\n }\n}\n","import { RmlPlugin } from './rml-plugin';\nimport { RoomDesignerApi } from './api';\nimport type { GlueLogic } from './glue-logic';\nimport { GlueLogicImplementation, type LibraryData } from './glue-logic';\nimport { type HomagIntelligenceInitData } from './loader';\nimport { v4 as uuidv4 } from 'uuid';\nimport type {\n MasterData,\n PosArticle,\n PosGroup,\n PosModuleAttribute,\n PosModuleData,\n} from './model/oc-scripts-domain.model';\nimport { initCallbacks } from './callbacks';\nimport type RoomlePlanner from '../../planner-core/src/roomle-planner';\nimport Orders from './orders';\nimport type {\n ExternalConfiguration,\n ExternalItem,\n} from '../../typings/external-objects';\nimport type { HiTagCatalogCallbacks } from './hi-tag-catalog-callbacks';\nimport type { HiCallbacks } from '../../../../embedding-lib/src/embedding-lib';\nimport {\n GlueLayerRequestDebugLogging,\n GlueLayerResponseDebugLogging,\n} from './debug-logging';\nimport type { ExternalObjectValidContainerModules } from './external-object-api-callbacks';\n\ndeclare global {\n interface Window {\n uuidv4: () => string;\n }\n}\n\nconsole.warn('Homag Intelligence plugin is loaded.');\n\n// export const HOMAG_INTELLIGENCE_ENDPOINT = 'http://localhost:8080/proxy_request?url=';\n// export const HOMAG_INTELLIGENCE_ENDPOINT =\n// 'https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=';\n\nexport type ExternalObjects = Map<\n string,\n { id: string; label: string; items: any[] }\n>;\nexport type ExternalItems = Map<string, ExternalItem>;\nexport type ExternalConfigurations = Map<string, ExternalConfiguration>;\n\nexport class HomagIntelligence extends RmlPlugin {\n private _roomlePlanner: RoomlePlanner = null;\n private _api: RoomDesignerApi = null;\n private _glueLogic: GlueLogic = null;\n private _orders: Orders = null;\n\n constructor() {\n super();\n if (!window.uuidv4) {\n window.uuidv4 = uuidv4; // Ensure uuidv4 is available globally\n }\n }\n\n public async init(\n roomlePlanner: RoomlePlanner,\n hiOptions: HomagIntelligenceInitData,\n hiCallbacks: HiCallbacks,\n ): Promise<this> {\n this._roomlePlanner = roomlePlanner;\n this._roomlePlanner.setHomagIntelligence(this);\n this._api = new RoomDesignerApi(this._roomlePlanner);\n\n if (hiOptions?.debugLogging) {\n const api = new GlueLayerResponseDebugLogging(this._api, hiCallbacks);\n const glueLogic = new GlueLogicImplementation(api, hiCallbacks);\n this._glueLogic = new GlueLayerRequestDebugLogging(\n glueLogic,\n hiCallbacks,\n );\n } else {\n this._glueLogic = new GlueLogicImplementation(this._api, hiCallbacks);\n }\n initCallbacks(this._roomlePlanner, this._glueLogic);\n\n const savedPosGroupData =\n (await hiCallbacks.onGetSavedPosGroupData()) ?? null;\n this._glueLogic.setPosDataForLoading(savedPosGroupData);\n this._orders = new Orders(roomlePlanner, this._glueLogic);\n return this;\n }\n\n public async loadLibrary(libraryId: string) {\n if (!this._glueLogic) {\n throw new Error('GlueLogic not initialized');\n }\n const libraryData = await this._loadLibraryData(libraryId);\n this._glueLogic.addLibrary(libraryData);\n }\n\n public async loadCatalog(\n libraryId: string,\n articles: any,\n catalogCallbacks: HiTagCatalogCallbacks,\n ) {\n if (!this._glueLogic) {\n throw new Error('GlueLogic not initialized');\n }\n catalogCallbacks?.setEmulator(this._glueLogic);\n this._glueLogic.loadPosData(await articles, libraryId);\n }\n\n private async _loadLibraryData(libraryId: string): Promise<LibraryData> {\n if (this._glueLogic.isLibraryLoaded(libraryId)) {\n return this._glueLogic.getLibraryData(libraryId);\n }\n const hiCallbacks = this._glueLogic.hiCallbacks;\n const { masterData, libraryExports } = await this._requestHiLibrary(\n libraryId,\n hiCallbacks,\n );\n this._loadMasterData(masterData);\n const libraryData: LibraryData = {\n libraryId,\n masterData,\n posGroupVersion: 1,\n calculateGroup: (groupData: PosGroup): PosGroup => {\n return libraryExports.calc(groupData);\n },\n getOrderData: (groupData: PosGroup[], roomlePlannerId?: string): any => {\n return libraryExports.getOrderData(groupData, roomlePlannerId);\n },\n getAttributesDropDownValues: async (\n module: PosModuleData,\n attributeIds?: string | string[],\n ): Promise<Record<string, any[]>> => {\n const ids = attributeIds\n ? Array.isArray(attributeIds)\n ? attributeIds\n : [attributeIds]\n : module.attributes.map((attribute) => attribute.id);\n const attributeOptions: Record<string, any[]> = {};\n for (const attributeId of ids) {\n try {\n const options = libraryExports.getAttributesDropDownValues(\n module,\n attributeId,\n );\n attributeOptions[attributeId] = options;\n } catch (error) {\n console.error(error);\n attributeOptions[attributeId] = [];\n }\n }\n return attributeOptions;\n },\n solveModuleAttributeConflict: (\n module: PosModuleData,\n attributeName: string,\n value: string | number | boolean,\n ): PosModuleAttribute[] | undefined => {\n if (!libraryExports.solveModuleAttributeConflict) {\n return undefined;\n }\n const results = libraryExports.solveModuleAttributeConflict(\n module,\n attributeName,\n value,\n );\n return results;\n },\n getValidSubArticles(\n calculatedPosGroup: PosGroup,\n articles: PosArticle[],\n masterData: MasterData,\n ): PosArticle[] {\n if (!libraryExports.getValidSubArticles) {\n return [];\n }\n const results = libraryExports.getValidSubArticles(\n calculatedPosGroup,\n articles,\n masterData,\n );\n return results;\n },\n getValidContainerModulesForSubArticle(\n calculatedPosGroup: PosGroup,\n subArticle: PosArticle,\n masterData: MasterData,\n ): ExternalObjectValidContainerModules[] {\n if (!libraryExports.getValidContainerModulesForSubArticle) {\n return [];\n }\n const results = libraryExports.getValidContainerModulesForSubArticle(\n calculatedPosGroup,\n subArticle,\n masterData,\n );\n return results;\n },\n addSubArticle(\n targetPosGroup: PosGroup,\n article: PosArticle,\n rootId: string,\n parentModuleId: string,\n ): PosGroup {\n if (!libraryExports.addSubArticle) {\n return targetPosGroup;\n }\n const results = libraryExports.addSubArticle(\n targetPosGroup,\n article,\n rootId,\n parentModuleId,\n );\n return results;\n },\n };\n return libraryData;\n }\n\n public async _requestHiLibrary(\n libraryId: string,\n hiCallbacks: HiCallbacks,\n ): Promise<{\n masterData: MasterData;\n libraryExports: any;\n }> {\n if (!this._glueLogic) {\n throw new Error('GlueLogic not initialized');\n }\n const [masterData, calcScriptString] = await Promise.all([\n hiCallbacks.onLoadMasterData(libraryId),\n hiCallbacks.onLoadJavascript(libraryId),\n ]);\n const libraryExports = await this._initCalcScript(calcScriptString);\n return {\n masterData,\n libraryExports,\n };\n }\n\n private _loadMasterData(masterData: MasterData): void {\n if (!this._api) {\n throw new Error('API not initialized');\n }\n return this._api.loadMasterData(masterData);\n }\n\n private async _initCalcScript(scriptText: string): Promise<any> {\n try {\n window.exports = {};\n const blob = new Blob([scriptText], { type: 'text/javascript' });\n const blobUrl = URL.createObjectURL(blob);\n await import(blobUrl);\n URL.revokeObjectURL(blobUrl); // dispose of it when done\n return window.exports;\n } catch (e) {\n console.error(e);\n throw new Error('Failed to load calc.js!');\n }\n }\n\n public getGlueLogic(): GlueLogic {\n return this._glueLogic;\n }\n\n public async placeOrder() {\n await this._orders.placeOrder();\n }\n\n public async fetchPrice(planId?: string) {\n return this._orders.fetchPrice(planId);\n }\n}\n"],"names":["RmlPlugin","RoomDesignerApi","roomlePlanner","masterData","posDataJson","options","posDataArray","groupId","rootModuleId","subModuleId","groupOrRootModuleId","open","animate","UI_ELEMENTS","HI_PANEL_ACTION","HI_SELECTION_TYPE","HI_SELECTION_MODE","HiObjectSelection","callbacks","BASE_CONTEXT","viewName","context","reason","selectionMode","objectType","payload","_payloadPromise","_planElementViewModel","initiatingContext","mode","type","panelAction","showAttributes","GlueLogicImplementation","designerRequests","hiCallbacks","data","libraryId","libraryData","articleCatalogJson","posDataGroup","articleId","posArticle","deepCopy","posData","allPosGroups","groupItem","id","isExtObjId","removeExtObjIdPrefix","posArticleGroup","posArticleRoot","emulatorGroupItem","error","_groupId","rootId","moduleId","remainingGroup","rootModuleIdToDelete","splitOffGroups","originalGroupData","group","root","newGroupsPosData","g","duplicatedGroup","duplicatedPosDataJson","duplicatedRoot","targetGroup","idsOfGroupsMerged","idOfTargetRootModule","sourceGroupIds","originalSourceGroupRoots","sourceGroupId","sourceGroupData","nonGeneratedRoots","rootModule","targetGroupData","existingRoot","r","deletedGroups","sourceRootModule","rootsToDock","implicitRelevantAttributes","m","a","attr","rootToDock","masterDataModule","attributeId","sourceRootAttribute","moduleAttribute","splitGroup","newGroupedRootModules","newGroups","changedGroup","calculatedGroup","historyGroup","reloadGroup","updatedGroup","groupsToBeLoaded","posDataToBeLoaded","newPosData","newGroupCreated","groupData","roomlePlannerId","posGroups","cnt","posGroup","roomInformation","changedGroupPosition","newGroupPosition","rootModulePositions","additionalGroupData","loadPosData","posDataCollection","newGroup","newGroupPosDataJson","splitOffRootModuleIds","splitOffRootModules","splitOffRootModule","remainingRoot","keepRootModuleIDs","posDataModule","subModule","res","calculatedPosDataJson","attributeValue","emulatorGroup","value","modifiedGroups","moduleIdObjects","attributeName","moduleIds","obj","attributeIds","moduleInfo","attributeOptions","checkResults","entry","additionalInfo","rootModuleToBeReplaced","newPosDataJson","notGeneratedRoots","newRootModule","modifiedGroup","rootModuleMapping","ids","module","conflictResults","conflictResult","attribute","attributeData","posGroupIds","possibleSubArticles","article","setOfArticles","subArticleId","subArticle","validContainers","setOfContainers","parentModuleId","planSnapshot","modules","subMod","addedPosGroups","changedPosGroups","deletedPosGroupIds","addedGroupsArray","changedGroupsArray","deletedPosGroupIdsArray","originalPosDataJson","calculatedResult","originalArticleGroup","calculatedGroupData","posArticleGroupRoot","p","byteToHex","i","unsafeStringify","arr","offset","getRandomValues","rnds8","rng","randomUUID","native","v4","buf","rnds","initCallbacks","gluLogic","groupIdToDelete","_rootModuleId","_subModuleIdToDelete","_sourceGroupId","_affectedGroupIds","groupPosData","groupPosDataJson","_args","payloadPromise","planElementViewModel","getISO8601Date","date","isoString","msPosition","baseTimestamp","offsetMinutes","offsetHours","offsetMins","offsetString","createEmptyOrder","_addMerchantPositions","planOverview","count","itemIds","acc","item","merchantItems","posNo","pos","Orders","glueLogic","planData","order","priceData","planId","GlueLayerRequestDebugLogging","message","args","messageAndArgs","GlueLayerResponseDebugLogging","roomDesignerRequests","groupIds","HomagIntelligence","uuidv4","hiOptions","api","savedPosGroupData","articles","catalogCallbacks","libraryExports","calculatedPosGroup","targetPosGroup","calcScriptString","scriptText","blob","blobUrl"],"mappings":";AAAO,MAAeA,EAAU;AAEhC;ACQO,MAAMC,EAAgD;AAAA,EAG3D,YAAYC,GAAkC;AAC5C,SAAK,iBAAiBA;AAAA,EACxB;AAAA,EAEO,eAAeC,GAAwB;AAC5C,SAAK,eAAe,6BAA6BA,CAAU;AAAA,EAC7D;AAAA,EAEA,MAAa,cACXC,GACAC,GACe;AACf,UAAMC,IAAe,MAAM,QAAQF,CAAW,IAC1CA,IACA,CAACA,CAAW;AAChB,UAAM,KAAK,eAAe,yBAAyBE,GAAcD,CAAO;AAAA,EAC1E;AAAA,EAEA,MAAa,YAAYE,GAAgC;AACvD,UAAM,KAAK,eAAe,0BAA0BA,CAAO;AAAA,EAC7D;AAAA,EAEA,MAAa,WAAWC,GAAqC;AAC3D,UAAM,KAAK,eAAe,+BAA+BA,CAAY;AAAA,EACvE;AAAA,EAEA,MAAa,aACXA,GACAC,GACe;AACf,UAAM,KAAK,eAAe;AAAA,MACxBD;AAAA,MACAC;AAAA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