@wix/cli-app 1.1.106 → 1.1.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{AddPermissionCommand-QEKDCRQW.js → AddPermissionCommand-W3TQTL3X.js} +2 -2
- package/build/{DevCommand-736A5TG3.js → DevCommand-3HZJQQIQ.js} +10 -10
- package/build/{DevCommand-736A5TG3.js.map → DevCommand-3HZJQQIQ.js.map} +1 -1
- package/build/{GenerateCommand-F6WNIVZH.js → GenerateCommand-UQ3JHQTJ.js} +47 -8
- package/build/GenerateCommand-UQ3JHQTJ.js.map +1 -0
- package/build/{LogsCommand-POFQ7L7U.js → LogsCommand-JHADSYUE.js} +3 -3
- package/build/PreviewCommand-WBQRDP7K.js +19 -0
- package/build/ReleaseCommand-3KDJB3KZ.js +23 -0
- package/build/{ServeCommand-LLCIQQ4X.js → ServeCommand-IPKP6PJ2.js} +3 -3
- package/build/{build-HZ5SXQHP.js → build-LZ3CJXNM.js} +6 -6
- package/build/{chunk-2X5STX6V.js → chunk-6OQZW27N.js} +8 -2
- package/build/{chunk-2X5STX6V.js.map → chunk-6OQZW27N.js.map} +1 -1
- package/build/{chunk-VDPMGGS6.js → chunk-7KESMWRI.js} +13 -7
- package/build/{chunk-VDPMGGS6.js.map → chunk-7KESMWRI.js.map} +1 -1
- package/build/{chunk-NWQVBGCX.js → chunk-BER5YRAG.js} +2 -2
- package/build/{chunk-XPAQVBEL.js → chunk-FO7ABKNR.js} +3 -3
- package/build/{chunk-BINOF7AQ.js → chunk-HAUIN5OS.js} +36 -60
- package/build/chunk-HAUIN5OS.js.map +1 -0
- package/build/{chunk-FWWBKP43.js → chunk-IGC7QYU5.js} +2 -2
- package/build/{chunk-BFLRYBN2.js → chunk-LOVLYP4H.js} +5 -5
- package/build/{chunk-VMKXYUIA.js → chunk-LWOWN5OI.js} +5 -5
- package/build/{chunk-7QAX4LBK.js → chunk-MAZMH6ES.js} +6 -6
- package/build/{chunk-G32WRBNI.js → chunk-OKHXUGGH.js} +2 -2
- package/build/{chunk-T5HHDBBR.js → chunk-PBROWK34.js} +8 -2
- package/build/{chunk-T5HHDBBR.js.map → chunk-PBROWK34.js.map} +1 -1
- package/build/{chunk-7JLHWVDX.js → chunk-PFAJ5ETM.js} +2 -2
- package/build/{chunk-XW5CZ6RF.js → chunk-RDXTHRJ4.js} +14 -2
- package/build/{chunk-XW5CZ6RF.js.map → chunk-RDXTHRJ4.js.map} +1 -1
- package/build/{chunk-4TQGXVYE.js → chunk-UEUJOHB4.js} +3 -3
- package/build/{chunk-4IYY6ZGZ.js → chunk-UN2TQTOP.js} +375 -200
- package/build/chunk-UN2TQTOP.js.map +1 -0
- package/build/{chunk-5Y7LGHZ6.js → chunk-UPQ6AZFY.js} +2 -2
- package/build/{chunk-E6VEU7TV.js → chunk-W5SE5OVE.js} +210 -334
- package/build/{chunk-E6VEU7TV.js.map → chunk-W5SE5OVE.js.map} +1 -1
- package/build/{chunk-PEMPZ5MM.js → chunk-Z4NG6X6T.js} +2 -2
- package/build/cloudflare-runtime/entry.js +256 -32
- package/build/cloudflare-runtime/getRegisteredExtensions.js +252 -28
- package/build/index.js +24 -24
- package/build/platform-sdk/chunk-J3SVE4GM.js +2 -0
- package/build/platform-sdk/chunk-J3SVE4GM.js.map +1 -0
- package/build/platform-sdk/chunk-J7RIIVO6.js +2 -0
- package/build/platform-sdk/chunk-J7RIIVO6.js.map +1 -0
- package/build/platform-sdk/chunk-RHDUKNAJ.js +2 -0
- package/build/platform-sdk/chunk-RHDUKNAJ.js.map +1 -0
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/dashboard.js.map +1 -1
- package/build/platform-sdk/editor.js +2 -2
- package/build/platform-sdk/editor.js.map +1 -1
- package/build/platform-sdk/sdk-context.js +1 -1
- package/build/platform-sdk/sdk-context.js.map +1 -1
- package/build/platform-sdk/site.js +1 -1
- package/build/{preview-R6YTZ7DV.js → preview-OVNN2RP4.js} +13 -13
- package/build/{release-IJJ3EB2C.js → release-OMLRH2VC.js} +15 -15
- package/build/{render-command-FJOPHPRO.js → render-command-DIMIKL4B.js} +6 -6
- package/package.json +6 -6
- package/build/GenerateCommand-F6WNIVZH.js.map +0 -1
- package/build/PreviewCommand-DGVLJIC5.js +0 -19
- package/build/ReleaseCommand-BK665XSD.js +0 -23
- package/build/chunk-4IYY6ZGZ.js.map +0 -1
- package/build/chunk-BINOF7AQ.js.map +0 -1
- package/build/platform-sdk/chunk-BBFFXVJD.js +0 -2
- package/build/platform-sdk/chunk-BBFFXVJD.js.map +0 -1
- package/build/platform-sdk/chunk-MAZR75DI.js +0 -2
- package/build/platform-sdk/chunk-MAZR75DI.js.map +0 -1
- package/build/platform-sdk/chunk-NHYZDMR5.js +0 -2
- package/build/platform-sdk/chunk-NHYZDMR5.js.map +0 -1
- /package/build/{AddPermissionCommand-QEKDCRQW.js.map → AddPermissionCommand-W3TQTL3X.js.map} +0 -0
- /package/build/{LogsCommand-POFQ7L7U.js.map → LogsCommand-JHADSYUE.js.map} +0 -0
- /package/build/{PreviewCommand-DGVLJIC5.js.map → PreviewCommand-WBQRDP7K.js.map} +0 -0
- /package/build/{ReleaseCommand-BK665XSD.js.map → ReleaseCommand-3KDJB3KZ.js.map} +0 -0
- /package/build/{ServeCommand-LLCIQQ4X.js.map → ServeCommand-IPKP6PJ2.js.map} +0 -0
- /package/build/{build-HZ5SXQHP.js.map → build-LZ3CJXNM.js.map} +0 -0
- /package/build/{chunk-NWQVBGCX.js.map → chunk-BER5YRAG.js.map} +0 -0
- /package/build/{chunk-XPAQVBEL.js.map → chunk-FO7ABKNR.js.map} +0 -0
- /package/build/{chunk-FWWBKP43.js.map → chunk-IGC7QYU5.js.map} +0 -0
- /package/build/{chunk-BFLRYBN2.js.map → chunk-LOVLYP4H.js.map} +0 -0
- /package/build/{chunk-VMKXYUIA.js.map → chunk-LWOWN5OI.js.map} +0 -0
- /package/build/{chunk-7QAX4LBK.js.map → chunk-MAZMH6ES.js.map} +0 -0
- /package/build/{chunk-G32WRBNI.js.map → chunk-OKHXUGGH.js.map} +0 -0
- /package/build/{chunk-7JLHWVDX.js.map → chunk-PFAJ5ETM.js.map} +0 -0
- /package/build/{chunk-4TQGXVYE.js.map → chunk-UEUJOHB4.js.map} +0 -0
- /package/build/{chunk-5Y7LGHZ6.js.map → chunk-UPQ6AZFY.js.map} +0 -0
- /package/build/{chunk-PEMPZ5MM.js.map → chunk-Z4NG6X6T.js.map} +0 -0
- /package/build/{preview-R6YTZ7DV.js.map → preview-OVNN2RP4.js.map} +0 -0
- /package/build/{release-IJJ3EB2C.js.map → release-OMLRH2VC.js.map} +0 -0
- /package/build/{render-command-FJOPHPRO.js.map → render-command-DIMIKL4B.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/@babel/runtime/helpers/esm/extends.js","../../../node_modules/@wix/dashboard/src/internal.tsx","../../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../node_modules/@wix/dashboard/src/types/addSitePlugin.ts","../../../node_modules/@wix/dashboard/src/sdk.ts","../../../node_modules/@wix/dashboard/src/dashboardHostModule.ts","../../../node_modules/comlink/src/comlink.ts","../../../node_modules/@wix/communication-channel/src/serialization.ts","../../../node_modules/@wix/communication-channel/src/index.ts","../../../node_modules/@wix/dashboard/src/helpers/registerHeightReporter.ts","../../../node_modules/@wix/dashboard/src/helpers/isWixOrigin.ts","../../../node_modules/@wix/dashboard/src/helpers/registerOnBeforeUnload.ts","../../../node_modules/@wix/dashboard/src/helpers/essentials.ts","../../../node_modules/@wix/dashboard/src/hostPlatform.ts","../../../node_modules/@wix/dashboard/src/index.ts"],"sourcesContent":["function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","// eslint-disable-next-line import/no-extraneous-dependencies\nimport React, { ComponentType, useEffect, useState } from 'react';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { createClient } from '@wix/sdk';\nimport { dashboard, type RemoteHost, type LocalHost } from './index';\n\nconst useBeforeRenderEffect = <T extends unknown>(\n effect: () => T,\n effectCondition: (lastEffectResult: T) => boolean,\n): T => {\n const [lastEffectResult, setState] = useState(() => effect());\n if (effectCondition(lastEffectResult)) {\n setState(effect());\n }\n return lastEffectResult;\n};\n\nexport const withContextualWixClient = <P extends {} = {}>(\n Component: ComponentType<P>,\n): ComponentType<P & { host?: LocalHost }> => {\n return (ownPropsWithHost) => {\n const { host, compProps } = useHostAndProps(ownPropsWithHost);\n\n useBeforeRenderEffect(\n () => {\n createClient({\n auth: dashboard.auth(),\n host,\n }).enableContext('module');\n return host;\n },\n (lastHost) => lastHost !== host,\n );\n\n return compProps ? <Component host={host} {...compProps} /> : null;\n };\n};\n\nconst useHostAndProps = <P extends {}>(\n ownPropsWithHost: P & { host?: LocalHost },\n):\n | { host: LocalHost; compProps: P }\n | {\n host: RemoteHost;\n compProps: P | undefined;\n } => {\n const { host: maybeLocalHost, ...ownProps } = ownPropsWithHost;\n\n const { host, hostType } = useBeforeRenderEffect(\n () =>\n maybeLocalHost\n ? { host: maybeLocalHost, hostType: 'local' as const }\n : { host: dashboard.host(), hostType: 'remote' as const },\n (lastResult) => !!maybeLocalHost && maybeLocalHost !== lastResult.host,\n );\n\n const [hostProps, setHostProps] = useState<P | undefined>(undefined);\n\n useEffect(() => {\n if (hostType === 'local') {\n return;\n }\n\n const observeResult = host.channel.observeState((newPropsFromHost: any) => {\n setHostProps((newPropsFromHost || {}) as P);\n });\n\n const cleanup = async () => {\n (await observeResult).disconnect();\n host.close();\n };\n\n return () => {\n cleanup();\n };\n }, [host, hostType]);\n\n return hostType === 'local'\n ? { host, compProps: ownProps as P }\n : {\n host,\n compProps: hostProps ? { ...hostProps, ...ownProps } : undefined,\n };\n};\n","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","type SuccessResult = {\n type: 'SUCCESS';\n};\n\ntype ErrorResult = {\n type: 'ERROR';\n data: {\n error: { message: string; code: number };\n };\n};\n\nexport type AddSitePluginModalResult = SuccessResult | ErrorResult;\n\nexport class AddSitePluginModalError extends Error {\n code: number;\n constructor({ message, code }: { message: string; code: number }) {\n super(message);\n this.message = message;\n this.code = code;\n }\n}\n\nexport type AddSitePlugin = (\n pluginId: string,\n options?: {\n placement?: {\n appDefinitionId: string;\n widgetId: string;\n slotId: string;\n };\n },\n) => Promise<void>;\n","import {\n CloseModal,\n GetAccessToken,\n GetLanguage,\n GetPageUrl,\n Host,\n Navigate,\n ObserveState,\n OnBeforeUnload,\n OpenModal,\n ShowToast,\n RequestFeedback,\n SetPageTitle,\n NavigateBack,\n OnLayerStateChange,\n ProviderOpenModal,\n OpenMediaManager,\n} from './types';\nimport {\n AddSitePlugin,\n AddSitePluginModalError,\n AddSitePluginModalResult,\n} from './types/addSitePlugin';\nimport { InstallApp } from './types/installApp';\nimport { GetDashboardMenuPlugins, GetDashboardPlugins } from './types/slots';\nimport { GetWidget } from './types/widget';\nimport { GetSiteInfo } from './types/getSiteInfo';\n\nexport const createSDKBuilders = () => {\n const showToast =\n ({ channel }: Host): ShowToast =>\n (...args) => {\n const handle = channel.showToast(...args);\n const remove = () => Promise.resolve(handle).then((h) => h.remove());\n return { remove };\n };\n\n const observeState =\n ({ channel }: Host): ObserveState =>\n (...args) => {\n const handle = (channel.observeState as ObserveState)(\n ...args,\n ) as ReturnType<Host['channel']['observeState']>; // this temporary casting is needed because it seems that typescript can't handle this by itself.\n const disconnect = () =>\n Promise.resolve(handle).then((h) => h.disconnect());\n return { disconnect };\n };\n\n const navigate =\n ({ channel }: Host): Navigate =>\n (...args) => {\n return channel.navigate(...args);\n };\n\n const navigateBack =\n ({ channel }: Host): NavigateBack =>\n () => {\n return channel.navigateBack();\n };\n\n const openModal =\n ({ channel }: Host): OpenModal =>\n (modalInfo, modalParams?) => {\n const [modalId, params]: Parameters<ProviderOpenModal> =\n typeof modalInfo === 'string'\n ? [modalInfo, modalParams]\n : [modalInfo.modalId, modalInfo.params];\n\n const handle = channel.openModal(modalId, params);\n return {\n modalClosed: Promise.resolve(handle).then((h) => h.modalClosed),\n };\n };\n\n const closeModal =\n ({ channel }: Host): CloseModal =>\n (closeData) => {\n if (closeData === undefined) {\n return channel.closeModal();\n }\n const filteredArg = JSON.parse(JSON.stringify(closeData));\n return channel.closeModal(filteredArg);\n };\n\n const getAccessToken =\n ({ channel }: Host): GetAccessToken =>\n () => {\n return channel.getAccessToken();\n };\n\n const getPageUrl =\n ({ channel }: Host): GetPageUrl =>\n (...args) => {\n return channel.getPageUrl(...args);\n };\n\n const openMediaManager =\n ({ channel }: Host): OpenMediaManager =>\n (...args) => {\n return channel.openMediaManager(...args);\n };\n\n const addSitePlugin =\n ({ channel }: Host): AddSitePlugin =>\n (pluginId, options) => {\n const PLUGINS_DASHBOARD_MODAL_ID = '802c76e4-b381-4bb3-9152-96acabbf3194';\n const additionalParams = options?.placement || {};\n const handle = channel.openModal(PLUGINS_DASHBOARD_MODAL_ID, {\n ...additionalParams,\n pluginId,\n action: 'populate',\n });\n return Promise.resolve(handle)\n .then(\n (h) => h.modalClosed as unknown as Promise<AddSitePluginModalResult>,\n )\n .then((resp) => {\n if (resp?.type === undefined) {\n throw new AddSitePluginModalError({\n message: 'Aborted by user',\n code: 3006,\n });\n }\n if (resp?.type === 'ERROR') {\n throw new AddSitePluginModalError(resp.data.error);\n }\n });\n };\n\n const onBeforeUnload =\n ({ channel }: Host): OnBeforeUnload =>\n (...args) => {\n return channel.onBeforeUnload(...args);\n };\n\n const setPageTitle =\n ({ channel }: Host): SetPageTitle =>\n (pageTitle: string | null) => {\n return channel.setPageTitle(pageTitle);\n };\n\n const getLanguage = (host: Host): GetLanguage => {\n let language: string | null = null;\n return async () => {\n if (language) {\n return language;\n }\n let observeStateResult = null as ReturnType<ObserveState> | null;\n language = await new Promise<string>((resolve) => {\n observeStateResult = observeState(host)((_, envState) => {\n resolve(envState.language);\n });\n });\n observeStateResult?.disconnect();\n return language;\n };\n };\n\n const requestFeedback =\n ({ channel }: Host): RequestFeedback =>\n (...args) => {\n return channel.requestFeedback(...args);\n };\n\n const onLayerStateChange =\n ({ channel }: Host): OnLayerStateChange =>\n (...args) => {\n const resultOrPromise = channel.onLayerStateChange(...args);\n const remove = () =>\n Promise.resolve(resultOrPromise).then((h) => h.remove());\n return { remove };\n };\n\n const installApp = ({ channel }: Host): InstallApp => channel.installApp;\n\n const getWidget =\n ({ channel }: Host): GetWidget =>\n (...args) => {\n if ('getWidget' in channel) {\n return channel.getWidget(...args);\n } else {\n throw new Error('Unsupported');\n }\n };\n\n const getDashboardPlugins =\n ({ channel }: Host): GetDashboardPlugins =>\n (...args) => {\n if ('getDashboardPlugins' in channel) {\n return channel.getDashboardPlugins(...args);\n } else {\n throw new Error('Unsupported');\n }\n };\n\n const getDashboardMenuPlugins =\n ({ channel }: Host): GetDashboardMenuPlugins =>\n (...args) => {\n if ('getDashboardMenuPlugins' in channel) {\n return channel.getDashboardMenuPlugins(...args);\n } else {\n throw new Error('Unsupported');\n }\n };\n\n const getSiteInfo = ({ channel }: Host): GetSiteInfo => channel.getSiteInfo;\n\n return {\n showToast,\n observeState,\n navigate,\n navigateBack,\n openModal,\n closeModal,\n getAccessToken,\n getPageUrl,\n openMediaManager,\n addSitePlugin,\n onBeforeUnload,\n setPageTitle,\n getLanguage,\n requestFeedback,\n onLayerStateChange,\n installApp,\n getSiteInfo,\n getWidget,\n getDashboardPlugins,\n getDashboardMenuPlugins,\n };\n};\n","import { createHostModule } from '@wix/sdk-runtime/host-modules';\nimport type { AuthenticationStrategy } from '@wix/sdk-types';\nimport { createSDKBuilders } from './sdk';\nimport type { CreateHost, Host, SDK } from './types';\n\nexport const createDashboardModule = ({\n createHost,\n}: {\n createHost: CreateHost;\n}) => {\n const dashboardSDKBuilders = createSDKBuilders();\n return {\n ...createHostModule<Host, SDK>(dashboardSDKBuilders),\n host: createHost,\n auth: () => {\n return {\n getAuthHeaders: async (host) => {\n const getAccessToken = dashboardSDKBuilders.getAccessToken(host);\n return {\n headers: {\n Authorization: await getAccessToken(),\n },\n };\n },\n } as AuthenticationStrategy<Host>;\n },\n };\n};\n","/**\n * Copyright 2019 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Endpoint,\n EventSource,\n Message,\n MessageType,\n PostMessageWithOrigin,\n WireValue,\n WireValueType,\n} from \"./protocol\";\nexport { Endpoint };\n\nexport const proxyMarker = Symbol(\"Comlink.proxy\");\nexport const createEndpoint = Symbol(\"Comlink.endpoint\");\nexport const releaseProxy = Symbol(\"Comlink.releaseProxy\");\n\nconst throwMarker = Symbol(\"Comlink.thrown\");\n\n/**\n * Interface of values that were marked to be proxied with `comlink.proxy()`.\n * Can also be implemented by classes.\n */\nexport interface ProxyMarked {\n [proxyMarker]: true;\n}\n\n/**\n * Takes a type and wraps it in a Promise, if it not already is one.\n * This is to avoid `Promise<Promise<T>>`.\n *\n * This is the inverse of `Unpromisify<T>`.\n */\ntype Promisify<T> = T extends Promise<unknown> ? T : Promise<T>;\n/**\n * Takes a type that may be Promise and unwraps the Promise type.\n * If `P` is not a Promise, it returns `P`.\n *\n * This is the inverse of `Promisify<T>`.\n */\ntype Unpromisify<P> = P extends Promise<infer T> ? T : P;\n\n/**\n * Takes the raw type of a remote property and returns the type that is visible to the local thread on the proxy.\n *\n * Note: This needs to be its own type alias, otherwise it will not distribute over unions.\n * See https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types\n */\ntype RemoteProperty<T> =\n // If the value is a method, comlink will proxy it automatically.\n // Objects are only proxied if they are marked to be proxied.\n // Otherwise, the property is converted to a Promise that resolves the cloned value.\n T extends Function | ProxyMarked ? Remote<T> : Promisify<T>;\n\n/**\n * Takes the raw type of a property as a remote thread would see it through a proxy (e.g. when passed in as a function\n * argument) and returns the type that the local thread has to supply.\n *\n * This is the inverse of `RemoteProperty<T>`.\n *\n * Note: This needs to be its own type alias, otherwise it will not distribute over unions. See\n * https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types\n */\ntype LocalProperty<T> = T extends Function | ProxyMarked\n ? Local<T>\n : Unpromisify<T>;\n\n/**\n * Proxies `T` if it is a `ProxyMarked`, clones it otherwise (as handled by structured cloning and transfer handlers).\n */\nexport type ProxyOrClone<T> = T extends ProxyMarked ? Remote<T> : T;\n/**\n * Inverse of `ProxyOrClone<T>`.\n */\nexport type UnproxyOrClone<T> = T extends RemoteObject<ProxyMarked>\n ? Local<T>\n : T;\n\n/**\n * Takes the raw type of a remote object in the other thread and returns the type as it is visible to the local thread\n * when proxied with `Comlink.proxy()`.\n *\n * This does not handle call signatures, which is handled by the more general `Remote<T>` type.\n *\n * @template T The raw type of a remote object as seen in the other thread.\n */\nexport type RemoteObject<T> = { [P in keyof T]: RemoteProperty<T[P]> };\n/**\n * Takes the type of an object as a remote thread would see it through a proxy (e.g. when passed in as a function\n * argument) and returns the type that the local thread has to supply.\n *\n * This does not handle call signatures, which is handled by the more general `Local<T>` type.\n *\n * This is the inverse of `RemoteObject<T>`.\n *\n * @template T The type of a proxied object.\n */\nexport type LocalObject<T> = { [P in keyof T]: LocalProperty<T[P]> };\n\n/**\n * Additional special comlink methods available on each proxy returned by `Comlink.wrap()`.\n */\nexport interface ProxyMethods {\n [createEndpoint]: () => Promise<MessagePort>;\n [releaseProxy]: () => void;\n}\n\n/**\n * Takes the raw type of a remote object, function or class in the other thread and returns the type as it is visible to\n * the local thread from the proxy return value of `Comlink.wrap()` or `Comlink.proxy()`.\n */\nexport type Remote<T> =\n // Handle properties\n RemoteObject<T> &\n // Handle call signature (if present)\n (T extends (...args: infer TArguments) => infer TReturn\n ? (\n ...args: { [I in keyof TArguments]: UnproxyOrClone<TArguments[I]> }\n ) => Promisify<ProxyOrClone<Unpromisify<TReturn>>>\n : unknown) &\n // Handle construct signature (if present)\n // The return of construct signatures is always proxied (whether marked or not)\n (T extends { new (...args: infer TArguments): infer TInstance }\n ? {\n new (\n ...args: {\n [I in keyof TArguments]: UnproxyOrClone<TArguments[I]>;\n }\n ): Promisify<Remote<TInstance>>;\n }\n : unknown) &\n // Include additional special comlink methods available on the proxy.\n ProxyMethods;\n\n/**\n * Expresses that a type can be either a sync or async.\n */\ntype MaybePromise<T> = Promise<T> | T;\n\n/**\n * Takes the raw type of a remote object, function or class as a remote thread would see it through a proxy (e.g. when\n * passed in as a function argument) and returns the type the local thread has to supply.\n *\n * This is the inverse of `Remote<T>`. It takes a `Remote<T>` and returns its original input `T`.\n */\nexport type Local<T> =\n // Omit the special proxy methods (they don't need to be supplied, comlink adds them)\n Omit<LocalObject<T>, keyof ProxyMethods> &\n // Handle call signatures (if present)\n (T extends (...args: infer TArguments) => infer TReturn\n ? (\n ...args: { [I in keyof TArguments]: ProxyOrClone<TArguments[I]> }\n ) => // The raw function could either be sync or async, but is always proxied automatically\n MaybePromise<UnproxyOrClone<Unpromisify<TReturn>>>\n : unknown) &\n // Handle construct signature (if present)\n // The return of construct signatures is always proxied (whether marked or not)\n (T extends { new (...args: infer TArguments): infer TInstance }\n ? {\n new (\n ...args: {\n [I in keyof TArguments]: ProxyOrClone<TArguments[I]>;\n }\n ): // The raw constructor could either be sync or async, but is always proxied automatically\n MaybePromise<Local<Unpromisify<TInstance>>>;\n }\n : unknown);\n\nconst isObject = (val: unknown): val is object =>\n (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n\n/**\n * Customizes the serialization of certain values as determined by `canHandle()`.\n *\n * @template T The input type being handled by this transfer handler.\n * @template S The serialized type sent over the wire.\n */\nexport interface TransferHandler<T, S> {\n /**\n * Gets called for every value to determine whether this transfer handler\n * should serialize the value, which includes checking that it is of the right\n * type (but can perform checks beyond that as well).\n */\n canHandle(value: unknown): value is T;\n\n /**\n * Gets called with the value if `canHandle()` returned `true` to produce a\n * value that can be sent in a message, consisting of structured-cloneable\n * values and/or transferrable objects.\n */\n serialize(value: T): [S, Transferable[]];\n\n /**\n * Gets called to deserialize an incoming value that was serialized in the\n * other thread with this transfer handler (known through the name it was\n * registered under).\n */\n deserialize(value: S): T;\n}\n\n/**\n * Internal transfer handle to handle objects marked to proxy.\n */\nconst proxyTransferHandler: TransferHandler<object, MessagePort> = {\n canHandle: (val): val is ProxyMarked =>\n isObject(val) && (val as ProxyMarked)[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n};\n\ninterface ThrownValue {\n [throwMarker]: unknown; // just needs to be present\n value: unknown;\n}\ntype SerializedThrownValue =\n | { isError: true; value: Error }\n | { isError: false; value: unknown };\n\n/**\n * Internal transfer handler to handle thrown exceptions.\n */\nconst throwTransferHandler: TransferHandler<\n ThrownValue,\n SerializedThrownValue\n> = {\n canHandle: (value): value is ThrownValue =>\n isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized: SerializedThrownValue;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n } else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(\n new Error(serialized.value.message),\n serialized.value\n );\n }\n throw serialized.value;\n },\n};\n\n/**\n * Allows customizing the serialization of certain values.\n */\nexport const transferHandlers = new Map<\n string,\n TransferHandler<unknown, unknown>\n>([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler],\n]);\n\nexport function expose(obj: any, ep: Endpoint = self as any) {\n ep.addEventListener(\"message\", function callback(ev: MessageEvent) {\n if (!ev || !ev.data) {\n return;\n }\n const { id, type, path } = {\n path: [] as string[],\n ...(ev.data as Message),\n };\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case MessageType.GET:\n {\n returnValue = rawValue;\n }\n break;\n case MessageType.SET:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case MessageType.APPLY:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case MessageType.CONSTRUCT:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case MessageType.ENDPOINT:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case MessageType.RELEASE:\n {\n returnValue = undefined;\n }\n break;\n }\n } catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage({ ...wireValue, id }, transferables);\n if (type === MessageType.RELEASE) {\n // detach and deactive after sending release response above.\n ep.removeEventListener(\"message\", callback as any);\n closeEndPoint(ep);\n }\n });\n } as any);\n if (ep.start) {\n ep.start();\n }\n}\n\nfunction isMessagePort(endpoint: Endpoint): endpoint is MessagePort {\n return endpoint.constructor.name === \"MessagePort\";\n}\n\nfunction closeEndPoint(endpoint: Endpoint) {\n if (isMessagePort(endpoint)) endpoint.close();\n}\n\nexport function wrap<T>(ep: Endpoint, target?: any): Remote<T> {\n return createProxy<T>(ep, [], target) as any;\n}\n\nfunction throwIfProxyReleased(isReleased: boolean) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n}\n\nfunction createProxy<T>(\n ep: Endpoint,\n path: (string | number | symbol)[] = [],\n target: object = function () {}\n): Remote<T> {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n return requestResponseMessage(ep, {\n type: MessageType.RELEASE,\n path: path.map((p) => p.toString()),\n }).then(() => {\n closeEndPoint(ep);\n isProxyReleased = true;\n });\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, {\n type: MessageType.GET,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(\n ep,\n {\n type: MessageType.SET,\n path: [...path, prop].map((p) => p.toString()),\n value,\n },\n transferables\n ).then(fromWireValue) as any;\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if ((last as any) === createEndpoint) {\n return requestResponseMessage(ep, {\n type: MessageType.ENDPOINT,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === \"bind\") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(\n ep,\n {\n type: MessageType.APPLY,\n path: path.map((p) => p.toString()),\n argumentList,\n },\n transferables\n ).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(\n ep,\n {\n type: MessageType.CONSTRUCT,\n path: path.map((p) => p.toString()),\n argumentList,\n },\n transferables\n ).then(fromWireValue);\n },\n });\n return proxy as any;\n}\n\nfunction myFlat<T>(arr: (T | T[])[]): T[] {\n return Array.prototype.concat.apply([], arr);\n}\n\nfunction processArguments(argumentList: any[]): [WireValue[], Transferable[]] {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n}\n\nconst transferCache = new WeakMap<any, Transferable[]>();\nexport function transfer(obj: any, transfers: Transferable[]) {\n transferCache.set(obj, transfers);\n return obj;\n}\n\nexport function proxy<T>(obj: T): T & ProxyMarked {\n return Object.assign(obj, { [proxyMarker]: true }) as any;\n}\n\nexport function windowEndpoint(\n w: PostMessageWithOrigin,\n context: EventSource = self,\n targetOrigin = \"*\"\n): Endpoint {\n return {\n postMessage: (msg: any, transferables: Transferable[]) =>\n w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context),\n };\n}\n\nfunction toWireValue(value: any): [WireValue, Transferable[]] {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: WireValueType.HANDLER,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: WireValueType.RAW,\n value,\n },\n transferCache.get(value) || [],\n ];\n}\n\nfunction fromWireValue(value: WireValue): any {\n switch (value.type) {\n case WireValueType.HANDLER:\n return transferHandlers.get(value.name)!.deserialize(value.value);\n case WireValueType.RAW:\n return value.value;\n }\n}\n\nfunction requestResponseMessage(\n ep: Endpoint,\n msg: Message,\n transfers?: Transferable[]\n): Promise<WireValue> {\n return new Promise((resolve) => {\n const id = generateUUID();\n ep.addEventListener(\"message\", function l(ev: MessageEvent) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener(\"message\", l as any);\n resolve(ev.data);\n } as any);\n if (ep.start) {\n ep.start();\n }\n ep.postMessage({ id, ...msg }, transfers);\n });\n}\n\nfunction generateUUID(): string {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join(\"-\");\n}\n","import { proxy } from 'comlink';\n\nconst proxyCallbackMarker = '__proxyCallbackId__wixSDK__';\nconst proxyPromiseMarker = '__proxyPromiseId__wixSDK__';\ntype SerializedReturnValue = {\n proxies: ProxiesCollector;\n clonables: any;\n};\nexport type ProxiesCollector = {\n callbacks: { [key: string]: Function };\n promises: { [key: string]: Promise<any> };\n};\n\nexport const serializeAllMethodsIn = <T extends {}>(sdk: T) => {\n return wrapMethodsWithProxy(sdk, (originalMethod) => {\n return async (...args: any) => {\n const [proxies, argsNoProxies] = extractProxies(args);\n const originalResult = await originalMethod(\n proxy(proxies),\n argsNoProxies,\n );\n return deserializeReturnValue(originalResult);\n };\n });\n};\n\nexport const deserializeAllMethodsIn = <T extends {}>(api: T) => {\n return wrapMethodsWithProxy(api, (originalMethod) => {\n return (proxies: ProxiesCollector, args: any[]) => {\n const argsWithProxies = insertProxies(proxies, args);\n const originalRun = originalMethod(...argsWithProxies);\n return serializeReturnValue(originalRun);\n };\n });\n};\n\nconst serializeReturnValue = async (\n value: any,\n): Promise<SerializedReturnValue> => {\n const [proxies, clonables] = extractProxies(await value);\n return proxy({ proxies, clonables });\n};\n\nconst deserializeReturnValue = async (value: any) => {\n return insertProxies(value?.proxies, await value?.clonables);\n};\n\nconst extractProxies = (data: any): [ProxiesCollector, any] => {\n const walker = (proxies: ProxiesCollector, val: any): any => {\n if (isPromise(val)) {\n const proxyId = uniqueId();\n proxies.promises[proxyId] = val;\n return { [proxyPromiseMarker]: proxyId };\n }\n\n if (isFunction(val)) {\n const proxyId = uniqueId();\n proxies.callbacks[proxyId] = (\n innerProxies: ProxiesCollector,\n argsAsArray: any[],\n ) => {\n const argsWithProxies = insertProxies(innerProxies, argsAsArray);\n const exec = val(...argsWithProxies);\n return serializeReturnValue(exec);\n };\n return { [proxyCallbackMarker]: proxyId };\n }\n\n if (Array.isArray(val)) {\n return val.map((i: any) => walker(proxies, i));\n }\n if (isObject(val)) {\n return mapObjectValues(val, (i: any) => walker(proxies, i));\n }\n\n return val;\n };\n\n const proxies: ProxiesCollector = { promises: {}, callbacks: {} };\n const dataWithoutProxies = walker(proxies, data);\n return [proxies, dataWithoutProxies];\n};\n\nconst insertProxies = (proxies: ProxiesCollector, data: any): any => {\n if (Array.isArray(data)) {\n return data.map((i: any) => insertProxies(proxies, i));\n }\n\n if (isObject(data) && data.hasOwnProperty(proxyPromiseMarker)) {\n const promiseId = (data as any)[proxyPromiseMarker];\n return proxies.promises[promiseId];\n }\n\n if (isObject(data) && data.hasOwnProperty(proxyCallbackMarker)) {\n const callbackId = (data as any)[proxyCallbackMarker];\n // passing args in spread syntax to comlink proxy generates problem when transpiling to old JS version\n // so pass it as array and handle it on the deserialization level:\n return async (...args: any) => {\n const [innerProxies, argsNoProxies] = extractProxies(args);\n const exec = await proxies.callbacks[callbackId](\n proxy(innerProxies),\n argsNoProxies,\n );\n return deserializeReturnValue(exec);\n };\n }\n\n if (isObject(data)) {\n return mapObjectValues(data, (i: any) => insertProxies(proxies, i));\n }\n\n return data;\n};\n\nconst wrapMethodsWithProxy = <T extends Record<string, Function>>(\n obj: T,\n callback: (originalMethod: Function) => Function,\n) => {\n return new Proxy<T>(obj, {\n get(target: any, prop: any) {\n if (!target[prop]) {\n return () => {\n throw new Error(\n `Serialization error occurred while accessing ${prop} property of ${target}`,\n );\n };\n }\n return callback(target[prop]);\n },\n });\n};\n\nconst isPromise = (val: any): val is Promise<any> => val instanceof Promise;\nconst isObject = (val: any): val is object =>\n val && typeof val === 'object' && !isPromise(val);\nconst isFunction = (val: any): val is Function => typeof val === 'function';\nconst mapObjectValues = (obj: object, callback: Function) => {\n const mapEntries = ([key, value]: [string, any]) => [key, callback(value)];\n return Object.fromEntries(Object.entries(obj).map(mapEntries));\n};\nconst uniqueId = (() => {\n let counter = 0;\n return () => ++counter;\n})();\n","import {\n deserializeAllMethodsIn,\n serializeAllMethodsIn,\n} from './serialization';\nimport { wrap, expose, releaseProxy, Remote } from 'comlink';\n\nexport const handshakeCode = 'wix-sdk-bo-hello-handshake';\nexport type PostMessage = (\n message: object,\n targetOrigin: string,\n transfer: Transferable[],\n) => void;\n\nexport type OpenedChannel<A> = Remote<A>;\n\n/**\n * Initializes a new channel with a target.\n * @param postMessage - Target's function to receive messages.\n * @param origin - Target's origin.\n */\nexport const open = <API extends {}>({\n postMessage,\n origin,\n}: {\n postMessage: PostMessage;\n origin: string;\n}): {\n channel: OpenedChannel<API>;\n close: () => void;\n} => {\n const { port1: widgetPort, port2: hostPort } = new MessageChannel();\n const protocolVersion = '1.0.0';\n const message = {\n code: handshakeCode,\n version: protocolVersion,\n port: hostPort,\n };\n postMessage(message, origin, [hostPort]);\n const channel = serializeAllMethodsIn(wrap<API>(widgetPort));\n\n return {\n channel,\n close: () => channel[releaseProxy](),\n };\n};\n\n/**\n * Serves api as a response over the communication channel to given port.\n * @param api - The api object that has the methods inside it.\n * @param port - The port on which the channel was initiated and needs to receive the api.\n */\nexport const serve = <API extends {}>({\n api,\n port,\n}: {\n api: API;\n port: MessagePort;\n}) => {\n expose(deserializeAllMethodsIn(api), port);\n};\n","import { ProviderAPI } from '../types';\nimport { OpenedChannel } from '@wix/communication-channel';\n\nexport const registerHeightReporter = (\n bridge: OpenedChannel<ProviderAPI>,\n container: HTMLElement,\n) => {\n const update = () => bridge.updateHeight(container.offsetHeight);\n const resizeObserver = new ResizeObserver(update);\n resizeObserver.observe(container);\n return () => resizeObserver.disconnect();\n};\n","const origins = ['https://manage.wix.com', 'https://manage.editorx.com'];\nconst allowedOrigins = new Set(origins);\nexport const isWixOrigin = (origin: string) => allowedOrigins.has(origin);\n","import { OpenedChannel } from '@wix/communication-channel';\nimport { ProviderAPI, OnBeforeUnload } from '../types';\n\nexport const registerBeforeUnloadHandler = (\n channel: OpenedChannel<ProviderAPI>,\n) => {\n const eventTarget = new EventTarget();\n const isInWorker = typeof window === 'undefined';\n\n const onIframeBeforeUnload = (event: BeforeUnloadEvent) => {\n const shouldUnloadWithoutConfirmation = eventTarget.dispatchEvent(\n new CustomEvent('beforeunload', {\n cancelable: true,\n }),\n );\n\n if (!shouldUnloadWithoutConfirmation) {\n event.preventDefault();\n event.returnValue = true; // Chrome requires returnValue to be set\n }\n };\n\n const onBeforeUnloadHandle = channel.onBeforeUnload(onIframeBeforeUnload);\n\n const clearBeforeUnloadHandler = () => {\n if (!isInWorker) {\n window.removeEventListener('beforeunload', onIframeBeforeUnload);\n }\n onBeforeUnloadHandle.then(({ remove }) => remove());\n };\n if (!isInWorker) {\n window.addEventListener('beforeunload', onIframeBeforeUnload);\n window.addEventListener('unload', clearBeforeUnloadHandler);\n }\n\n const onBeforeUnload: OnBeforeUnload = (callback) => {\n eventTarget.addEventListener('beforeunload', callback);\n\n const remove = () => {\n eventTarget.removeEventListener('beforeunload', callback);\n };\n\n return { remove };\n };\n\n return { onBeforeUnload, clearBeforeUnloadHandler };\n};\n","function safeParseEssentials(essentials?: string | null) {\n if (!essentials) {\n return undefined;\n }\n try {\n return JSON.parse(decodeURIComponent(essentials));\n } catch (e) {\n console.warn(\n 'Failed to parse \"essentials\" query parameter. Make sure to run the code inside a supported Wix App extension.',\n e,\n );\n return undefined;\n }\n}\n\nexport function getEssentialsFromQueryParams(queryParams: URLSearchParams) {\n return queryParams.has('essentials')\n ? safeParseEssentials(queryParams.get('essentials'))\n : undefined;\n}\n","import { open } from '@wix/communication-channel';\nimport { getMonitoringClientFunction } from '@wix/monitoring-browser-sdk-host';\nimport { CreateHost, ProviderAPI, OnBeforeUnload } from './types';\nimport { registerHeightReporter } from './helpers/registerHeightReporter';\nimport { isWixOrigin } from './helpers/isWixOrigin';\nimport { registerBeforeUnloadHandler } from './helpers/registerOnBeforeUnload';\nimport { getEssentialsFromQueryParams } from './helpers/essentials';\nimport { GetSiteInfo } from './types/getSiteInfo';\n\ndeclare global {\n interface Window {\n Sentry?: any;\n }\n}\n\nexport const createHost: CreateHost = function (config = {}) {\n // when full url is provided (worker case) use it and ignore own location search\n const searchString =\n (config.fullUrl && new URL(config.fullUrl).search) ||\n (typeof window !== 'undefined' && window.location.search) ||\n '';\n const queryParams = new URLSearchParams(searchString);\n const origin = config.origin || queryParams.get('origin') || '';\n const postMessage =\n config.postMessage || window.parent.postMessage.bind(window.parent);\n\n if (!isWixOrigin(origin)) {\n throw new Error(\n `Wix Dashboard SDK: Unable to establish a connection with the Wix dashboard. Please ensure that you are running your app within the Wix dashboard.`,\n );\n }\n\n const { channel, close } = open<ProviderAPI>({ postMessage, origin });\n const closeMethods = [close];\n\n if (config.autoHeightUpdate === undefined || config.autoHeightUpdate) {\n const element = config.autoHeightElement || document.documentElement;\n const clearHeightReport = registerHeightReporter(channel, element);\n closeMethods.push(() => clearHeightReport());\n }\n\n const { onBeforeUnload, clearBeforeUnloadHandler } =\n registerBeforeUnloadHandler(channel);\n closeMethods.push(clearBeforeUnloadHandler);\n\n const siteInfo = parseSiteInfo(queryParams.get('siteInfo') || '');\n const getSiteInfoSync: GetSiteInfo = () => siteInfo;\n\n const channelProxy = new Proxy(channel, {\n get(target, prop, receiver) {\n if (prop === 'onBeforeUnload') {\n return onBeforeUnload;\n }\n if (prop === 'getSiteInfo') {\n return getSiteInfoSync;\n }\n return Reflect.get(target, prop, receiver);\n },\n }) as typeof channel & {\n onBeforeUnload: OnBeforeUnload;\n getSiteInfo: GetSiteInfo; // keeping it sync\n };\n\n const { monitoring, ...essentials } =\n getEssentialsFromQueryParams(queryParams) || {};\n\n const getMonitoringClient = getMonitoringClientFunction({\n hostContext: monitoring?.context,\n monitoringConfig: monitoring?.config,\n sentrySDK: typeof window !== 'undefined' ? window.Sentry : undefined,\n });\n\n return {\n channel: channelProxy,\n close: () => closeMethods.forEach((method) => method()),\n getMonitoringClient,\n essentials,\n };\n};\n\nconst parseSiteInfo = (siteInfo: string) => {\n try {\n return JSON.parse(decodeURIComponent(siteInfo));\n } catch (e) {\n console.warn(\n 'Failed to parse \"siteInfo\" query parameter. Make sure to run the code inside a supported Wix App extension.',\n e,\n );\n return {};\n }\n};\n","import { createDashboardModule } from './dashboardHostModule';\nimport { createHost } from './hostPlatform';\n\nexport const dashboard = createDashboardModule({\n createHost,\n});\n\nexport * from './types';\n"],"mappings":"2KAAA,SAASA,GAAW,CAClB,OAAOA,EAAW,OAAO,OAAS,OAAO,OAAO,KAAK,EAAI,SAAUC,EAAG,CACpE,QAASC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CACzC,IAAIC,EAAI,UAAUD,CAAC,EACnB,QAAS,KAAKC,GAAI,CAAC,GAAG,eAAe,KAAKA,EAAG,CAAC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AAItB,GACzB,IACEoB,EACI,CAAEX,KAAMW,EAAgBE,SAAU,OAAiB,EACnD,CAAEb,KAAMK,EAAUL,KAAK,EAAGa,SAAU,QAAkB,EAC3DC,GAAe,CAAC,CAACH,GAAkBA,IAAmBG,EAAWd,IACpE,EAEM,CAACe,EAAWC,CAAY,EAAIpB,GAAwBqB,MAAS,EAEnEC,OAAAA,GAAU,IAAM,CACd,GAAIL,IAAa,QACf,OAGF,IAAMM,EAAgBnB,EAAKoB,QAAQC,aAAcC,GAA0B,CACzEN,EAAcM,GAAoB,CAAC,CAAO,CAC5C,CAAC,EAEKC,EAAU,SAAY,EACzB,MAAMJ,GAAeK,WAAW,EACjCxB,EAAKyB,MAAM,CACb,EAEA,MAAO,IAAM,CACXF,EAAQ,CACV,CACF,EAAG,CAACvB,EAAMa,CAAQ,CAAC,EAEZA,IAAa,QAChB,CAAEb,KAAAA,EAAMC,UAAWW,CAAc,EACjC,CACEZ,KAAAA,EACAC,UAAWc,EAAY,CAAE,GAAGA,EAAW,GAAGH,CAAS,EAAIK,MACzD,CACN","names":["_extends","n","e","t","React","useEffect","useState","_typeof","o","toPrimitive","t","r","_typeof","e","i","toPropertyKey","t","i","toPrimitive","_typeof","_defineProperty","r","t","toPropertyKey","AddSitePluginModalError","Error","constructor","_ref","message","code","_defineProperty","createSDKBuilders","showToast","_ref","channel","handle","arguments","remove","Promise","resolve","then","h","observeState","_ref2","disconnect","navigate","_ref3","navigateBack","_ref4","openModal","_ref5","modalInfo","modalParams","modalId","params","modalClosed","closeModal","_ref6","closeData","undefined","filteredArg","JSON","parse","stringify","getAccessToken","_ref7","getPageUrl","_ref8","openMediaManager","_ref9","addSitePlugin","_ref10","pluginId","options","PLUGINS_DASHBOARD_MODAL_ID","additionalParams","placement","action","resp","type","AddSitePluginModalError","message","code","data","error","onBeforeUnload","_ref11","setPageTitle","_ref12","pageTitle","getLanguage","host","language","_observeStateResult","observeStateResult","_","envState","requestFeedback","_ref13","onLayerStateChange","_ref14","resultOrPromise","installApp","_ref15","getSiteInfo","_ref19","getWidget","_ref16","Error","getDashboardPlugins","_ref17","getDashboardMenuPlugins","_ref18","createDashboardModule","_ref","createHost","dashboardSDKBuilders","createSDKBuilders","createHostModule","host","auth","getAuthHeaders","headers","Authorization","getAccessToken","proxyMarker","createEndpoint","releaseProxy","throwMarker","isObject","val","proxyTransferHandler","obj","port1","port2","expose","port","wrap","throwTransferHandler","value","serialized","transferHandlers","ep","callback","ev","id","type","path","argumentList","fromWireValue","returnValue","parent","prop","rawValue","proxy","transfer","wireValue","transferables","toWireValue","closeEndPoint","isMessagePort","endpoint","target","createProxy","throwIfProxyReleased","isReleased","isProxyReleased","_target","requestResponseMessage","p","r","_thisArg","rawArgumentList","last","processArguments","myFlat","arr","processed","v","transferCache","transfers","toWireValue","value","name","handler","transferHandlers","serializedValue","transferables","transferCache","fromWireValue","requestResponseMessage","ep","msg","transfers","resolve","id","generateUUID","l","ev","proxyCallbackMarker","proxyPromiseMarker","serializeAllMethodsIn","sdk","wrapMethodsWithProxy","originalMethod","_len","arguments","length","args","Array","_key","proxies","argsNoProxies","extractProxies","originalResult","proxy","deserializeReturnValue","serializeReturnValue","value","proxies","clonables","extractProxies","proxy","deserializeReturnValue","insertProxies","data","walker","val","isPromise","proxyId","uniqueId","promises","proxyPromiseMarker","isFunction","callbacks","innerProxies","argsAsArray","argsWithProxies","exec","proxyCallbackMarker","Array","isArray","map","i","isObject","mapObjectValues","dataWithoutProxies","hasOwnProperty","promiseId","callbackId","_len2","arguments","length","args","_key2","argsNoProxies","wrapMethodsWithProxy","obj","callback","Proxy","get","target","prop","Error","Promise","mapEntries","_ref","key","Object","fromEntries","entries","counter","handshakeCode","open","_ref","postMessage","origin","port1","widgetPort","port2","hostPort","MessageChannel","code","version","port","channel","serializeAllMethodsIn","wrap","close","releaseProxy","registerHeightReporter","bridge","container","update","updateHeight","offsetHeight","resizeObserver","ResizeObserver","observe","disconnect","origins","allowedOrigins","Set","isWixOrigin","origin","has","registerBeforeUnloadHandler","channel","eventTarget","EventTarget","isInWorker","window","onIframeBeforeUnload","event","dispatchEvent","CustomEvent","cancelable","preventDefault","returnValue","onBeforeUnloadHandle","onBeforeUnload","clearBeforeUnloadHandler","removeEventListener","then","_ref","remove","addEventListener","callback","safeParseEssentials","essentials","JSON","parse","decodeURIComponent","e","console","warn","getEssentialsFromQueryParams","queryParams","has","get","undefined","createHost","config","searchString","fullUrl","URL","search","window","location","queryParams","URLSearchParams","origin","get","postMessage","parent","bind","isWixOrigin","Error","channel","close","open","closeMethods","autoHeightUpdate","undefined","element","autoHeightElement","document","documentElement","clearHeightReport","registerHeightReporter","push","onBeforeUnload","clearBeforeUnloadHandler","registerBeforeUnloadHandler","siteInfo","parseSiteInfo","getSiteInfoSync","channelProxy","Proxy","target","prop","receiver","Reflect","monitoring","essentials","getEssentialsFromQueryParams","getMonitoringClient","getMonitoringClientFunction","hostContext","context","monitoringConfig","sentrySDK","Sentry","forEach","method","JSON","parse","decodeURIComponent","e","console","warn","dashboard","createDashboardModule","createHost","useBeforeRenderEffect","effect","effectCondition","lastEffectResult","setState","useState","withContextualWixClient","Component","ownPropsWithHost","host","compProps","useHostAndProps","createClient","auth","dashboard","enableContext","lastHost","React","createElement","_extends","maybeLocalHost","ownProps","hostType","lastResult","hostProps","setHostProps","undefined","useEffect","observeResult","channel","observeState","newPropsFromHost","cleanup","disconnect","close"]}
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@babel/runtime/helpers/esm/extends.js","../../../node_modules/@wix/dashboard/src/internal.tsx","../../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../node_modules/@wix/dashboard/src/types/addSitePlugin.ts","../../../node_modules/@wix/dashboard/src/sdk.ts","../../../node_modules/@wix/dashboard/src/dashboardHostModule.ts","../../../node_modules/comlink/src/comlink.ts","../../../node_modules/@wix/communication-channel/src/serialization.ts","../../../node_modules/@wix/communication-channel/src/index.ts","../../../node_modules/@wix/dashboard/src/helpers/registerHeightReporter.ts","../../../node_modules/@wix/dashboard/src/helpers/isWixOrigin.ts","../../../node_modules/@wix/dashboard/src/helpers/registerOnBeforeUnload.ts","../../../node_modules/@wix/dashboard/src/helpers/essentials.ts","../../../node_modules/@wix/dashboard/src/helpers/showError.ts","../../../node_modules/@wix/dashboard/src/hostPlatform.ts","../../../node_modules/@wix/dashboard/src/index.ts"],"sourcesContent":["function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","// eslint-disable-next-line import/no-extraneous-dependencies\nimport React, { ComponentType, useEffect, useState } from 'react';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { createClient } from '@wix/sdk';\nimport { dashboard, type RemoteHost, type LocalHost } from './index';\n\nconst useBeforeRenderEffect = <T extends unknown>(\n effect: () => T,\n effectCondition: (lastEffectResult: T) => boolean,\n): T => {\n const [lastEffectResult, setState] = useState(() => effect());\n if (effectCondition(lastEffectResult)) {\n setState(effect());\n }\n return lastEffectResult;\n};\n\nexport const withContextualWixClient = <P extends {} = {}>(\n Component: ComponentType<P>,\n): ComponentType<P & { host?: LocalHost }> => {\n return (ownPropsWithHost) => {\n const { host, compProps } = useHostAndProps(ownPropsWithHost);\n\n useBeforeRenderEffect(\n () => {\n createClient({\n auth: dashboard.auth(),\n host,\n }).enableContext('module');\n return host;\n },\n (lastHost) => lastHost !== host,\n );\n\n return compProps ? <Component host={host} {...compProps} /> : null;\n };\n};\n\nconst useHostAndProps = <P extends {}>(\n ownPropsWithHost: P & { host?: LocalHost },\n):\n | { host: LocalHost; compProps: P }\n | {\n host: RemoteHost;\n compProps: P | undefined;\n } => {\n const { host: maybeLocalHost, ...ownProps } = ownPropsWithHost;\n\n const { host, hostType } = useBeforeRenderEffect(\n () =>\n maybeLocalHost\n ? { host: maybeLocalHost, hostType: 'local' as const }\n : { host: dashboard.host(), hostType: 'remote' as const },\n (lastResult) => !!maybeLocalHost && maybeLocalHost !== lastResult.host,\n );\n\n const [hostProps, setHostProps] = useState<P | undefined>(undefined);\n\n useEffect(() => {\n if (hostType === 'local') {\n return;\n }\n\n const observeResult = host.channel.observeState((newPropsFromHost: any) => {\n setHostProps((newPropsFromHost || {}) as P);\n });\n\n const cleanup = async () => {\n (await observeResult).disconnect();\n host.close();\n };\n\n return () => {\n cleanup();\n };\n }, [host, hostType]);\n\n return hostType === 'local'\n ? { host, compProps: ownProps as P }\n : {\n host,\n compProps: hostProps ? { ...hostProps, ...ownProps } : undefined,\n };\n};\n","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","type SuccessResult = {\n type: 'SUCCESS';\n};\n\ntype ErrorResult = {\n type: 'ERROR';\n data: {\n error: { message: string; code: number };\n };\n};\n\nexport type AddSitePluginModalResult = SuccessResult | ErrorResult;\n\nexport class AddSitePluginModalError extends Error {\n code: number;\n constructor({ message, code }: { message: string; code: number }) {\n super(message);\n this.message = message;\n this.code = code;\n }\n}\n\nexport type AddSitePlugin = (\n pluginId: string,\n options?: {\n placement?: {\n appDefinitionId: string;\n widgetId: string;\n slotId: string;\n };\n },\n) => Promise<void>;\n","import {\n CloseModal,\n GetAccessToken,\n GetLanguage,\n GetPageUrl,\n Host,\n Navigate,\n ObserveState,\n OnBeforeUnload,\n OpenModal,\n ShowToast,\n RequestFeedback,\n SetPageTitle,\n NavigateBack,\n OnLayerStateChange,\n ProviderOpenModal,\n OpenMediaManager,\n} from './types';\nimport {\n AddSitePlugin,\n AddSitePluginModalError,\n AddSitePluginModalResult,\n} from './types/addSitePlugin';\nimport { InstallApp } from './types/installApp';\nimport { GetDashboardMenuPlugins, GetDashboardPlugins } from './types/slots';\nimport { GetWidget } from './types/widget';\nimport { GetSiteInfo } from './types/getSiteInfo';\n\nexport const createSDKBuilders = () => {\n const showToast =\n ({ channel }: Host): ShowToast =>\n (...args) => {\n const handle = channel.showToast(...args);\n const remove = () => Promise.resolve(handle).then((h) => h.remove());\n return { remove };\n };\n\n const observeState =\n ({ channel }: Host): ObserveState =>\n (...args) => {\n const handle = (channel.observeState as ObserveState)(\n ...args,\n ) as ReturnType<Host['channel']['observeState']>; // this temporary casting is needed because it seems that typescript can't handle this by itself.\n const disconnect = () =>\n Promise.resolve(handle).then((h) => h.disconnect());\n return { disconnect };\n };\n\n const navigate =\n ({ channel }: Host): Navigate =>\n (...args) => {\n return channel.navigate(...args);\n };\n\n const navigateBack =\n ({ channel }: Host): NavigateBack =>\n () => {\n return channel.navigateBack();\n };\n\n const openModal =\n ({ channel }: Host): OpenModal =>\n (modalInfo, modalParams?) => {\n const [modalId, params]: Parameters<ProviderOpenModal> =\n typeof modalInfo === 'string'\n ? [modalInfo, modalParams]\n : [modalInfo.modalId, modalInfo.params];\n\n const handle = channel.openModal(modalId, params);\n return {\n modalClosed: Promise.resolve(handle).then((h) => h.modalClosed),\n };\n };\n\n const closeModal =\n ({ channel }: Host): CloseModal =>\n (closeData) => {\n if (closeData === undefined) {\n return channel.closeModal();\n }\n const filteredArg = JSON.parse(JSON.stringify(closeData));\n return channel.closeModal(filteredArg);\n };\n\n const getAccessToken =\n ({ channel }: Host): GetAccessToken =>\n () => {\n return channel.getAccessToken();\n };\n\n const getPageUrl =\n ({ channel }: Host): GetPageUrl =>\n (...args) => {\n return channel.getPageUrl(...args);\n };\n\n const openMediaManager =\n ({ channel }: Host): OpenMediaManager =>\n (...args) => {\n return channel.openMediaManager(...args);\n };\n\n const addSitePlugin =\n ({ channel }: Host): AddSitePlugin =>\n (pluginId, options) => {\n const PLUGINS_DASHBOARD_MODAL_ID = '802c76e4-b381-4bb3-9152-96acabbf3194';\n const additionalParams = options?.placement || {};\n const handle = channel.openModal(PLUGINS_DASHBOARD_MODAL_ID, {\n ...additionalParams,\n pluginId,\n action: 'populate',\n });\n return Promise.resolve(handle)\n .then(\n (h) => h.modalClosed as unknown as Promise<AddSitePluginModalResult>,\n )\n .then((resp) => {\n if (resp?.type === undefined) {\n throw new AddSitePluginModalError({\n message: 'Aborted by user',\n code: 3006,\n });\n }\n if (resp?.type === 'ERROR') {\n throw new AddSitePluginModalError(resp.data.error);\n }\n });\n };\n\n const onBeforeUnload =\n ({ channel }: Host): OnBeforeUnload =>\n (...args) => {\n return channel.onBeforeUnload(...args);\n };\n\n const setPageTitle =\n ({ channel }: Host): SetPageTitle =>\n (pageTitle: string | null) => {\n return channel.setPageTitle(pageTitle);\n };\n\n const getLanguage = (host: Host): GetLanguage => {\n let language: string | null = null;\n return async () => {\n if (language) {\n return language;\n }\n let observeStateResult = null as ReturnType<ObserveState> | null;\n language = await new Promise<string>((resolve) => {\n observeStateResult = observeState(host)((_, envState) => {\n resolve(envState.language);\n });\n });\n observeStateResult?.disconnect();\n return language;\n };\n };\n\n const requestFeedback =\n ({ channel }: Host): RequestFeedback =>\n (...args) => {\n return channel.requestFeedback(...args);\n };\n\n const onLayerStateChange =\n ({ channel }: Host): OnLayerStateChange =>\n (...args) => {\n const resultOrPromise = channel.onLayerStateChange(...args);\n const remove = () =>\n Promise.resolve(resultOrPromise).then((h) => h.remove());\n return { remove };\n };\n\n const installApp = ({ channel }: Host): InstallApp => channel.installApp;\n\n const getWidget =\n ({ channel }: Host): GetWidget =>\n (...args) => {\n if ('getWidget' in channel) {\n return channel.getWidget(...args);\n } else {\n throw new Error('Unsupported');\n }\n };\n\n const getDashboardPlugins =\n ({ channel }: Host): GetDashboardPlugins =>\n (...args) => {\n if ('getDashboardPlugins' in channel) {\n return channel.getDashboardPlugins(...args);\n } else {\n throw new Error('Unsupported');\n }\n };\n\n const getDashboardMenuPlugins =\n ({ channel }: Host): GetDashboardMenuPlugins =>\n (...args) => {\n if ('getDashboardMenuPlugins' in channel) {\n return channel.getDashboardMenuPlugins(...args);\n } else {\n throw new Error('Unsupported');\n }\n };\n\n const getSiteInfo = ({ channel }: Host): GetSiteInfo => channel.getSiteInfo;\n\n return {\n showToast,\n observeState,\n navigate,\n navigateBack,\n openModal,\n closeModal,\n getAccessToken,\n getPageUrl,\n openMediaManager,\n addSitePlugin,\n onBeforeUnload,\n setPageTitle,\n getLanguage,\n requestFeedback,\n onLayerStateChange,\n installApp,\n getSiteInfo,\n getWidget,\n getDashboardPlugins,\n getDashboardMenuPlugins,\n };\n};\n","import { createHostModule } from '@wix/sdk-runtime/host-modules';\nimport type { AuthenticationStrategy } from '@wix/sdk-types';\nimport { createSDKBuilders } from './sdk';\nimport type { CreateHost, Host, SDK } from './types';\n\nexport const createDashboardModule = ({\n createHost,\n}: {\n createHost: CreateHost;\n}) => {\n const dashboardSDKBuilders = createSDKBuilders();\n return {\n ...createHostModule<Host, SDK>(dashboardSDKBuilders),\n host: createHost,\n auth: () => {\n return {\n getAuthHeaders: async (host) => {\n const getAccessToken = dashboardSDKBuilders.getAccessToken(host);\n return {\n headers: {\n Authorization: await getAccessToken(),\n },\n };\n },\n } as AuthenticationStrategy<Host>;\n },\n };\n};\n","/**\n * Copyright 2019 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Endpoint,\n EventSource,\n Message,\n MessageType,\n PostMessageWithOrigin,\n WireValue,\n WireValueType,\n} from \"./protocol\";\nexport { Endpoint };\n\nexport const proxyMarker = Symbol(\"Comlink.proxy\");\nexport const createEndpoint = Symbol(\"Comlink.endpoint\");\nexport const releaseProxy = Symbol(\"Comlink.releaseProxy\");\n\nconst throwMarker = Symbol(\"Comlink.thrown\");\n\n/**\n * Interface of values that were marked to be proxied with `comlink.proxy()`.\n * Can also be implemented by classes.\n */\nexport interface ProxyMarked {\n [proxyMarker]: true;\n}\n\n/**\n * Takes a type and wraps it in a Promise, if it not already is one.\n * This is to avoid `Promise<Promise<T>>`.\n *\n * This is the inverse of `Unpromisify<T>`.\n */\ntype Promisify<T> = T extends Promise<unknown> ? T : Promise<T>;\n/**\n * Takes a type that may be Promise and unwraps the Promise type.\n * If `P` is not a Promise, it returns `P`.\n *\n * This is the inverse of `Promisify<T>`.\n */\ntype Unpromisify<P> = P extends Promise<infer T> ? T : P;\n\n/**\n * Takes the raw type of a remote property and returns the type that is visible to the local thread on the proxy.\n *\n * Note: This needs to be its own type alias, otherwise it will not distribute over unions.\n * See https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types\n */\ntype RemoteProperty<T> =\n // If the value is a method, comlink will proxy it automatically.\n // Objects are only proxied if they are marked to be proxied.\n // Otherwise, the property is converted to a Promise that resolves the cloned value.\n T extends Function | ProxyMarked ? Remote<T> : Promisify<T>;\n\n/**\n * Takes the raw type of a property as a remote thread would see it through a proxy (e.g. when passed in as a function\n * argument) and returns the type that the local thread has to supply.\n *\n * This is the inverse of `RemoteProperty<T>`.\n *\n * Note: This needs to be its own type alias, otherwise it will not distribute over unions. See\n * https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types\n */\ntype LocalProperty<T> = T extends Function | ProxyMarked\n ? Local<T>\n : Unpromisify<T>;\n\n/**\n * Proxies `T` if it is a `ProxyMarked`, clones it otherwise (as handled by structured cloning and transfer handlers).\n */\nexport type ProxyOrClone<T> = T extends ProxyMarked ? Remote<T> : T;\n/**\n * Inverse of `ProxyOrClone<T>`.\n */\nexport type UnproxyOrClone<T> = T extends RemoteObject<ProxyMarked>\n ? Local<T>\n : T;\n\n/**\n * Takes the raw type of a remote object in the other thread and returns the type as it is visible to the local thread\n * when proxied with `Comlink.proxy()`.\n *\n * This does not handle call signatures, which is handled by the more general `Remote<T>` type.\n *\n * @template T The raw type of a remote object as seen in the other thread.\n */\nexport type RemoteObject<T> = { [P in keyof T]: RemoteProperty<T[P]> };\n/**\n * Takes the type of an object as a remote thread would see it through a proxy (e.g. when passed in as a function\n * argument) and returns the type that the local thread has to supply.\n *\n * This does not handle call signatures, which is handled by the more general `Local<T>` type.\n *\n * This is the inverse of `RemoteObject<T>`.\n *\n * @template T The type of a proxied object.\n */\nexport type LocalObject<T> = { [P in keyof T]: LocalProperty<T[P]> };\n\n/**\n * Additional special comlink methods available on each proxy returned by `Comlink.wrap()`.\n */\nexport interface ProxyMethods {\n [createEndpoint]: () => Promise<MessagePort>;\n [releaseProxy]: () => void;\n}\n\n/**\n * Takes the raw type of a remote object, function or class in the other thread and returns the type as it is visible to\n * the local thread from the proxy return value of `Comlink.wrap()` or `Comlink.proxy()`.\n */\nexport type Remote<T> =\n // Handle properties\n RemoteObject<T> &\n // Handle call signature (if present)\n (T extends (...args: infer TArguments) => infer TReturn\n ? (\n ...args: { [I in keyof TArguments]: UnproxyOrClone<TArguments[I]> }\n ) => Promisify<ProxyOrClone<Unpromisify<TReturn>>>\n : unknown) &\n // Handle construct signature (if present)\n // The return of construct signatures is always proxied (whether marked or not)\n (T extends { new (...args: infer TArguments): infer TInstance }\n ? {\n new (\n ...args: {\n [I in keyof TArguments]: UnproxyOrClone<TArguments[I]>;\n }\n ): Promisify<Remote<TInstance>>;\n }\n : unknown) &\n // Include additional special comlink methods available on the proxy.\n ProxyMethods;\n\n/**\n * Expresses that a type can be either a sync or async.\n */\ntype MaybePromise<T> = Promise<T> | T;\n\n/**\n * Takes the raw type of a remote object, function or class as a remote thread would see it through a proxy (e.g. when\n * passed in as a function argument) and returns the type the local thread has to supply.\n *\n * This is the inverse of `Remote<T>`. It takes a `Remote<T>` and returns its original input `T`.\n */\nexport type Local<T> =\n // Omit the special proxy methods (they don't need to be supplied, comlink adds them)\n Omit<LocalObject<T>, keyof ProxyMethods> &\n // Handle call signatures (if present)\n (T extends (...args: infer TArguments) => infer TReturn\n ? (\n ...args: { [I in keyof TArguments]: ProxyOrClone<TArguments[I]> }\n ) => // The raw function could either be sync or async, but is always proxied automatically\n MaybePromise<UnproxyOrClone<Unpromisify<TReturn>>>\n : unknown) &\n // Handle construct signature (if present)\n // The return of construct signatures is always proxied (whether marked or not)\n (T extends { new (...args: infer TArguments): infer TInstance }\n ? {\n new (\n ...args: {\n [I in keyof TArguments]: ProxyOrClone<TArguments[I]>;\n }\n ): // The raw constructor could either be sync or async, but is always proxied automatically\n MaybePromise<Local<Unpromisify<TInstance>>>;\n }\n : unknown);\n\nconst isObject = (val: unknown): val is object =>\n (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n\n/**\n * Customizes the serialization of certain values as determined by `canHandle()`.\n *\n * @template T The input type being handled by this transfer handler.\n * @template S The serialized type sent over the wire.\n */\nexport interface TransferHandler<T, S> {\n /**\n * Gets called for every value to determine whether this transfer handler\n * should serialize the value, which includes checking that it is of the right\n * type (but can perform checks beyond that as well).\n */\n canHandle(value: unknown): value is T;\n\n /**\n * Gets called with the value if `canHandle()` returned `true` to produce a\n * value that can be sent in a message, consisting of structured-cloneable\n * values and/or transferrable objects.\n */\n serialize(value: T): [S, Transferable[]];\n\n /**\n * Gets called to deserialize an incoming value that was serialized in the\n * other thread with this transfer handler (known through the name it was\n * registered under).\n */\n deserialize(value: S): T;\n}\n\n/**\n * Internal transfer handle to handle objects marked to proxy.\n */\nconst proxyTransferHandler: TransferHandler<object, MessagePort> = {\n canHandle: (val): val is ProxyMarked =>\n isObject(val) && (val as ProxyMarked)[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n};\n\ninterface ThrownValue {\n [throwMarker]: unknown; // just needs to be present\n value: unknown;\n}\ntype SerializedThrownValue =\n | { isError: true; value: Error }\n | { isError: false; value: unknown };\n\n/**\n * Internal transfer handler to handle thrown exceptions.\n */\nconst throwTransferHandler: TransferHandler<\n ThrownValue,\n SerializedThrownValue\n> = {\n canHandle: (value): value is ThrownValue =>\n isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized: SerializedThrownValue;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n } else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(\n new Error(serialized.value.message),\n serialized.value\n );\n }\n throw serialized.value;\n },\n};\n\n/**\n * Allows customizing the serialization of certain values.\n */\nexport const transferHandlers = new Map<\n string,\n TransferHandler<unknown, unknown>\n>([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler],\n]);\n\nexport function expose(obj: any, ep: Endpoint = self as any) {\n ep.addEventListener(\"message\", function callback(ev: MessageEvent) {\n if (!ev || !ev.data) {\n return;\n }\n const { id, type, path } = {\n path: [] as string[],\n ...(ev.data as Message),\n };\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case MessageType.GET:\n {\n returnValue = rawValue;\n }\n break;\n case MessageType.SET:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case MessageType.APPLY:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case MessageType.CONSTRUCT:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case MessageType.ENDPOINT:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case MessageType.RELEASE:\n {\n returnValue = undefined;\n }\n break;\n }\n } catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage({ ...wireValue, id }, transferables);\n if (type === MessageType.RELEASE) {\n // detach and deactive after sending release response above.\n ep.removeEventListener(\"message\", callback as any);\n closeEndPoint(ep);\n }\n });\n } as any);\n if (ep.start) {\n ep.start();\n }\n}\n\nfunction isMessagePort(endpoint: Endpoint): endpoint is MessagePort {\n return endpoint.constructor.name === \"MessagePort\";\n}\n\nfunction closeEndPoint(endpoint: Endpoint) {\n if (isMessagePort(endpoint)) endpoint.close();\n}\n\nexport function wrap<T>(ep: Endpoint, target?: any): Remote<T> {\n return createProxy<T>(ep, [], target) as any;\n}\n\nfunction throwIfProxyReleased(isReleased: boolean) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n}\n\nfunction createProxy<T>(\n ep: Endpoint,\n path: (string | number | symbol)[] = [],\n target: object = function () {}\n): Remote<T> {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n return requestResponseMessage(ep, {\n type: MessageType.RELEASE,\n path: path.map((p) => p.toString()),\n }).then(() => {\n closeEndPoint(ep);\n isProxyReleased = true;\n });\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, {\n type: MessageType.GET,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(\n ep,\n {\n type: MessageType.SET,\n path: [...path, prop].map((p) => p.toString()),\n value,\n },\n transferables\n ).then(fromWireValue) as any;\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if ((last as any) === createEndpoint) {\n return requestResponseMessage(ep, {\n type: MessageType.ENDPOINT,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === \"bind\") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(\n ep,\n {\n type: MessageType.APPLY,\n path: path.map((p) => p.toString()),\n argumentList,\n },\n transferables\n ).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(\n ep,\n {\n type: MessageType.CONSTRUCT,\n path: path.map((p) => p.toString()),\n argumentList,\n },\n transferables\n ).then(fromWireValue);\n },\n });\n return proxy as any;\n}\n\nfunction myFlat<T>(arr: (T | T[])[]): T[] {\n return Array.prototype.concat.apply([], arr);\n}\n\nfunction processArguments(argumentList: any[]): [WireValue[], Transferable[]] {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n}\n\nconst transferCache = new WeakMap<any, Transferable[]>();\nexport function transfer(obj: any, transfers: Transferable[]) {\n transferCache.set(obj, transfers);\n return obj;\n}\n\nexport function proxy<T>(obj: T): T & ProxyMarked {\n return Object.assign(obj, { [proxyMarker]: true }) as any;\n}\n\nexport function windowEndpoint(\n w: PostMessageWithOrigin,\n context: EventSource = self,\n targetOrigin = \"*\"\n): Endpoint {\n return {\n postMessage: (msg: any, transferables: Transferable[]) =>\n w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context),\n };\n}\n\nfunction toWireValue(value: any): [WireValue, Transferable[]] {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: WireValueType.HANDLER,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: WireValueType.RAW,\n value,\n },\n transferCache.get(value) || [],\n ];\n}\n\nfunction fromWireValue(value: WireValue): any {\n switch (value.type) {\n case WireValueType.HANDLER:\n return transferHandlers.get(value.name)!.deserialize(value.value);\n case WireValueType.RAW:\n return value.value;\n }\n}\n\nfunction requestResponseMessage(\n ep: Endpoint,\n msg: Message,\n transfers?: Transferable[]\n): Promise<WireValue> {\n return new Promise((resolve) => {\n const id = generateUUID();\n ep.addEventListener(\"message\", function l(ev: MessageEvent) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener(\"message\", l as any);\n resolve(ev.data);\n } as any);\n if (ep.start) {\n ep.start();\n }\n ep.postMessage({ id, ...msg }, transfers);\n });\n}\n\nfunction generateUUID(): string {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join(\"-\");\n}\n","import { proxy } from 'comlink';\n\nconst proxyCallbackMarker = '__proxyCallbackId__wixSDK__';\nconst proxyPromiseMarker = '__proxyPromiseId__wixSDK__';\ntype SerializedReturnValue = {\n proxies: ProxiesCollector;\n clonables: any;\n};\nexport type ProxiesCollector = {\n callbacks: { [key: string]: Function };\n promises: { [key: string]: Promise<any> };\n};\n\nexport const serializeAllMethodsIn = <T extends {}>(sdk: T) => {\n return wrapMethodsWithProxy(sdk, (originalMethod) => {\n return async (...args: any) => {\n const [proxies, argsNoProxies] = extractProxies(args);\n const originalResult = await originalMethod(\n proxy(proxies),\n argsNoProxies,\n );\n return deserializeReturnValue(originalResult);\n };\n });\n};\n\nexport const deserializeAllMethodsIn = <T extends {}>(api: T) => {\n return wrapMethodsWithProxy(api, (originalMethod) => {\n return (proxies: ProxiesCollector, args: any[]) => {\n const argsWithProxies = insertProxies(proxies, args);\n const originalRun = originalMethod(...argsWithProxies);\n return serializeReturnValue(originalRun);\n };\n });\n};\n\nconst serializeReturnValue = async (\n value: any,\n): Promise<SerializedReturnValue> => {\n const [proxies, clonables] = extractProxies(await value);\n return proxy({ proxies, clonables });\n};\n\nconst deserializeReturnValue = async (value: any) => {\n return insertProxies(value?.proxies, await value?.clonables);\n};\n\nconst extractProxies = (data: any): [ProxiesCollector, any] => {\n const walker = (proxies: ProxiesCollector, val: any): any => {\n if (isPromise(val)) {\n const proxyId = uniqueId();\n proxies.promises[proxyId] = val;\n return { [proxyPromiseMarker]: proxyId };\n }\n\n if (isFunction(val)) {\n const proxyId = uniqueId();\n proxies.callbacks[proxyId] = (\n innerProxies: ProxiesCollector,\n argsAsArray: any[],\n ) => {\n const argsWithProxies = insertProxies(innerProxies, argsAsArray);\n const exec = val(...argsWithProxies);\n return serializeReturnValue(exec);\n };\n return { [proxyCallbackMarker]: proxyId };\n }\n\n if (Array.isArray(val)) {\n return val.map((i: any) => walker(proxies, i));\n }\n if (isObject(val)) {\n return mapObjectValues(val, (i: any) => walker(proxies, i));\n }\n\n return val;\n };\n\n const proxies: ProxiesCollector = { promises: {}, callbacks: {} };\n const dataWithoutProxies = walker(proxies, data);\n return [proxies, dataWithoutProxies];\n};\n\nconst insertProxies = (proxies: ProxiesCollector, data: any): any => {\n if (Array.isArray(data)) {\n return data.map((i: any) => insertProxies(proxies, i));\n }\n\n if (isObject(data) && data.hasOwnProperty(proxyPromiseMarker)) {\n const promiseId = (data as any)[proxyPromiseMarker];\n return proxies.promises[promiseId];\n }\n\n if (isObject(data) && data.hasOwnProperty(proxyCallbackMarker)) {\n const callbackId = (data as any)[proxyCallbackMarker];\n // passing args in spread syntax to comlink proxy generates problem when transpiling to old JS version\n // so pass it as array and handle it on the deserialization level:\n return async (...args: any) => {\n const [innerProxies, argsNoProxies] = extractProxies(args);\n const exec = await proxies.callbacks[callbackId](\n proxy(innerProxies),\n argsNoProxies,\n );\n return deserializeReturnValue(exec);\n };\n }\n\n if (isObject(data)) {\n return mapObjectValues(data, (i: any) => insertProxies(proxies, i));\n }\n\n return data;\n};\n\nconst wrapMethodsWithProxy = <T extends Record<string, Function>>(\n obj: T,\n callback: (originalMethod: Function) => Function,\n) => {\n return new Proxy<T>(obj, {\n get(target: any, prop: any) {\n if (!target[prop]) {\n return () => {\n throw new Error(\n `Serialization error occurred while accessing ${prop} property of ${target}`,\n );\n };\n }\n return callback(target[prop]);\n },\n });\n};\n\nconst isPromise = (val: any): val is Promise<any> => val instanceof Promise;\nconst isObject = (val: any): val is object =>\n val && typeof val === 'object' && !isPromise(val);\nconst isFunction = (val: any): val is Function => typeof val === 'function';\nconst mapObjectValues = (obj: object, callback: Function) => {\n const mapEntries = ([key, value]: [string, any]) => [key, callback(value)];\n return Object.fromEntries(Object.entries(obj).map(mapEntries));\n};\nconst uniqueId = (() => {\n let counter = 0;\n return () => ++counter;\n})();\n","import {\n deserializeAllMethodsIn,\n serializeAllMethodsIn,\n} from './serialization';\nimport { wrap, expose, releaseProxy, Remote } from 'comlink';\n\nexport const handshakeCode = 'wix-sdk-bo-hello-handshake';\nexport type PostMessage = (\n message: object,\n targetOrigin: string,\n transfer: Transferable[],\n) => void;\n\nexport type OpenedChannel<A> = Remote<A>;\n\n/**\n * Initializes a new channel with a target.\n * @param postMessage - Target's function to receive messages.\n * @param origin - Target's origin.\n */\nexport const open = <API extends {}>({\n postMessage,\n origin,\n}: {\n postMessage: PostMessage;\n origin: string;\n}): {\n channel: OpenedChannel<API>;\n close: () => void;\n} => {\n const { port1: widgetPort, port2: hostPort } = new MessageChannel();\n const protocolVersion = '1.0.0';\n const message = {\n code: handshakeCode,\n version: protocolVersion,\n port: hostPort,\n };\n postMessage(message, origin, [hostPort]);\n const channel = serializeAllMethodsIn(wrap<API>(widgetPort));\n\n return {\n channel,\n close: () => channel[releaseProxy](),\n };\n};\n\n/**\n * Serves api as a response over the communication channel to given port.\n * @param api - The api object that has the methods inside it.\n * @param port - The port on which the channel was initiated and needs to receive the api.\n */\nexport const serve = <API extends {}>({\n api,\n port,\n}: {\n api: API;\n port: MessagePort;\n}) => {\n expose(deserializeAllMethodsIn(api), port);\n};\n","import { ProviderAPI } from '../types';\nimport { OpenedChannel } from '@wix/communication-channel';\n\nexport const registerHeightReporter = (\n bridge: OpenedChannel<ProviderAPI>,\n container: HTMLElement,\n) => {\n const update = () => bridge.updateHeight(container.offsetHeight);\n const resizeObserver = new ResizeObserver(update);\n resizeObserver.observe(container);\n return () => resizeObserver.disconnect();\n};\n","const origins = ['https://manage.wix.com', 'https://manage.editorx.com'];\nconst allowedOrigins = new Set(origins);\nexport const isWixOrigin = (origin: string) => allowedOrigins.has(origin);\n","import { OpenedChannel } from '@wix/communication-channel';\nimport { ProviderAPI, OnBeforeUnload } from '../types';\n\nexport const registerBeforeUnloadHandler = (\n channel: OpenedChannel<ProviderAPI>,\n) => {\n const eventTarget = new EventTarget();\n const isInWorker = typeof window === 'undefined';\n\n const onIframeBeforeUnload = (event: BeforeUnloadEvent) => {\n const shouldUnloadWithoutConfirmation = eventTarget.dispatchEvent(\n new CustomEvent('beforeunload', {\n cancelable: true,\n }),\n );\n\n if (!shouldUnloadWithoutConfirmation) {\n event.preventDefault();\n event.returnValue = true; // Chrome requires returnValue to be set\n }\n };\n\n const onBeforeUnloadHandle = channel.onBeforeUnload(onIframeBeforeUnload);\n\n const clearBeforeUnloadHandler = () => {\n if (!isInWorker) {\n window.removeEventListener('beforeunload', onIframeBeforeUnload);\n }\n onBeforeUnloadHandle.then(({ remove }) => remove());\n };\n if (!isInWorker) {\n window.addEventListener('beforeunload', onIframeBeforeUnload);\n window.addEventListener('unload', clearBeforeUnloadHandler);\n }\n\n const onBeforeUnload: OnBeforeUnload = (callback) => {\n eventTarget.addEventListener('beforeunload', callback);\n\n const remove = () => {\n eventTarget.removeEventListener('beforeunload', callback);\n };\n\n return { remove };\n };\n\n return { onBeforeUnload, clearBeforeUnloadHandler };\n};\n","function safeParseEssentials(essentials?: string | null) {\n if (!essentials) {\n return undefined;\n }\n try {\n return JSON.parse(decodeURIComponent(essentials));\n } catch (e) {\n console.warn(\n 'Failed to parse \"essentials\" query parameter. Make sure to run the code inside a supported Wix App extension.',\n e,\n );\n return undefined;\n }\n}\n\nexport function getEssentialsFromQueryParams(queryParams: URLSearchParams) {\n return queryParams.has('essentials')\n ? safeParseEssentials(queryParams.get('essentials'))\n : undefined;\n}\n","import type { Host } from '@wix/sdk-types';\nimport { OpenedChannel } from '@wix/communication-channel';\nimport { ProviderAPI } from '../types';\n\nexport const showError =\n (channel: OpenedChannel<ProviderAPI>): Host['showError'] =>\n ({ message, action, requestId }) => {\n if (!message) {\n return;\n }\n\n channel.showToast({\n type: 'error',\n details:\n requestId != null\n ? {\n requestId,\n }\n : undefined,\n message,\n action: action && {\n ...action,\n removeToastOnClick: true,\n uiType: 'link',\n },\n });\n };\n","import { open } from '@wix/communication-channel';\nimport { getMonitoringClientFunction } from '@wix/monitoring-browser-sdk-host';\nimport { CreateHost, ProviderAPI, OnBeforeUnload } from './types';\nimport { registerHeightReporter } from './helpers/registerHeightReporter';\nimport { isWixOrigin } from './helpers/isWixOrigin';\nimport { registerBeforeUnloadHandler } from './helpers/registerOnBeforeUnload';\nimport { getEssentialsFromQueryParams } from './helpers/essentials';\nimport { GetSiteInfo } from './types/getSiteInfo';\nimport type { AdminHost } from '@wix/admin';\nimport { showError } from './helpers/showError';\n\ndeclare global {\n interface Window {\n Sentry?: any;\n }\n}\n\nexport const createHost: CreateHost = function (config = {}) {\n // when full url is provided (worker case) use it and ignore own location search\n const searchString =\n (config.fullUrl && new URL(config.fullUrl).search) ||\n (typeof window !== 'undefined' && window.location.search) ||\n '';\n const queryParams = new URLSearchParams(searchString);\n const origin = config.origin || queryParams.get('origin') || '';\n const postMessage =\n config.postMessage || window.parent.postMessage.bind(window.parent);\n\n if (!isWixOrigin(origin)) {\n throw new Error(\n `Wix Dashboard SDK: Unable to establish a connection with the Wix dashboard. Please ensure that you are running your app within the Wix dashboard.`,\n );\n }\n\n const { channel, close } = open<ProviderAPI>({ postMessage, origin });\n const closeMethods = [close];\n\n if (config.autoHeightUpdate === undefined || config.autoHeightUpdate) {\n const element = config.autoHeightElement || document.documentElement;\n const clearHeightReport = registerHeightReporter(channel, element);\n closeMethods.push(() => clearHeightReport());\n }\n\n const { onBeforeUnload, clearBeforeUnloadHandler } =\n registerBeforeUnloadHandler(channel);\n closeMethods.push(clearBeforeUnloadHandler);\n\n const siteInfo = parseEncodedJson(\n queryParams.get('siteInfo') || '',\n 'siteInfo',\n );\n const getSiteInfoSync: GetSiteInfo = () => siteInfo;\n\n const contextIds = parseEncodedJson(\n queryParams.get('contextIds') || '',\n 'contextIds',\n );\n const getContextIdsSync: AdminHost['admin']['getContextIds'] = () =>\n contextIds;\n const hasAdminOnHost = !!contextIds; // when specs.wosbm.addAdminToDashboardHost merged, need to delete\n\n const channelProxy = new Proxy(channel, {\n get(target, prop, receiver) {\n if (prop === 'onBeforeUnload') {\n return onBeforeUnload;\n }\n if (prop === 'getSiteInfo') {\n return getSiteInfoSync;\n }\n return Reflect.get(target, prop, receiver);\n },\n }) as typeof channel & {\n onBeforeUnload: OnBeforeUnload;\n getSiteInfo: GetSiteInfo; // keeping it sync\n } & Omit<typeof channel, 'getContextIds'>;\n\n const admin = {\n getContextIds: getContextIdsSync, // keeping it sync\n openItemSelector: () => {\n throw new Error('openItemSelector is not implemented');\n },\n };\n\n const { monitoring, ...essentials } =\n getEssentialsFromQueryParams(queryParams) || {};\n\n const getMonitoringClient = getMonitoringClientFunction({\n hostContext: monitoring?.context,\n monitoringConfig: monitoring?.config,\n sentrySDK: typeof window !== 'undefined' ? window.Sentry : undefined,\n });\n\n return {\n channel: channelProxy,\n close: () => closeMethods.forEach((method) => method()),\n getMonitoringClient,\n essentials,\n ...(hasAdminOnHost && { admin }), // when specs.wosbm.addAdminToDashboardHost merged, need to add unconditionally\n showError: showError(channel),\n };\n};\n\nconst parseEncodedJson = (json: string, paramName: string) => {\n try {\n return JSON.parse(decodeURIComponent(json));\n } catch (e) {\n console.warn(\n `Failed to parse ${paramName} query parameter. Make sure to run the code inside a supported Wix App extension.`,\n e,\n );\n return {};\n }\n};\n","import { createDashboardModule } from './dashboardHostModule';\nimport { createHost } from './hostPlatform';\n\nexport const dashboard = createDashboardModule({\n createHost,\n});\n\nexport * from './types';\n"],"mappings":"2KAAA,SAASA,GAAW,CAClB,OAAOA,EAAW,OAAO,OAAS,OAAO,OAAO,KAAK,EAAI,SAAUC,EAAG,CACpE,QAASC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CACzC,IAAIC,EAAI,UAAUD,CAAC,EACnB,QAAS,KAAKC,GAAI,CAAC,GAAG,eAAe,KAAKA,EAAG,CAAC,IAAMF,EAAE,CAAC,EAAIE,EAAE,CAAC,EAChE,CACA,OAAOF,CACT,EAAGD,EAAS,MAAM,KAAM,SAAS,CACnC,CCPA,OAAOI,IAAwBC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ASH,EAAO,CAAC,EAEZE,CACT,EAEaG,GACXC,GAEQC,GAAqB,CAC3B,GAAM,CAAEC,KAAAA,EAAMC,UAAAA,CAAU,EAAIC,GAAgBH,CAAgB,EAE5DR,OAAAA,GACE,KACEY,EAAa,CACXC,KAAMC,EAAUD,KAAK,EACrBJ,KAAAA,CACF,CAAC,EAAEM,cAAc,QAAQ,EAClBN,GAERO,GAAaA,IAAaP,CAC7B,EAEOC,EAAYO,GAAAC,cAACX,EAASY,EAAA,CAACV,KAAMA,CAAK,EAAKC,CAAS,CAAG,EAAI,IAChE,EAGIC,GACJH,GAMO,CACP,GAAM,CAAEC,KAAMW,EAAgB,GAAGC,CAAS,EAAIb,EAExC,CAAEC,KAAAA,EAAMa,SAAAA,CAAS,EAAItB,GACzB,IACEoB,EACI,CAAEX,KAAMW,EAAgBE,SAAU,OAAiB,EACnD,CAAEb,KAAMK,EAAUL,KAAK,EAAGa,SAAU,QAAkB,EAC3DC,GAAe,CAAC,CAACH,GAAkBA,IAAmBG,EAAWd,IACpE,EAEM,CAACe,EAAWC,CAAY,EAAIpB,GAAwBqB,MAAS,EAEnEC,OAAAA,GAAU,IAAM,CACd,GAAIL,IAAa,QACf,OAGF,IAAMM,EAAgBnB,EAAKoB,QAAQC,aAAcC,GAA0B,CACzEN,EAAcM,GAAoB,CAAC,CAAO,CAC5C,CAAC,EAEKC,EAAU,SAAY,EACzB,MAAMJ,GAAeK,WAAW,EACjCxB,EAAKyB,MAAM,CACb,EAEA,MAAO,IAAM,CACXF,EAAQ,CACV,CACF,EAAG,CAACvB,EAAMa,CAAQ,CAAC,EAEZA,IAAa,QAChB,CAAEb,KAAAA,EAAMC,UAAWW,CAAc,EACjC,CACEZ,KAAAA,EACAC,UAAWc,EAAY,CAAE,GAAGA,EAAW,GAAGH,CAAS,EAAIK,MACzD,CACN","names":["_extends","n","e","t","React","useEffect","useState","_typeof","o","toPrimitive","t","r","_typeof","e","i","toPropertyKey","t","i","toPrimitive","_typeof","_defineProperty","r","t","toPropertyKey","AddSitePluginModalError","Error","constructor","_ref","message","code","_defineProperty","createSDKBuilders","showToast","_ref","channel","handle","arguments","remove","Promise","resolve","then","h","observeState","_ref2","disconnect","navigate","_ref3","navigateBack","_ref4","openModal","_ref5","modalInfo","modalParams","modalId","params","modalClosed","closeModal","_ref6","closeData","undefined","filteredArg","JSON","parse","stringify","getAccessToken","_ref7","getPageUrl","_ref8","openMediaManager","_ref9","addSitePlugin","_ref10","pluginId","options","PLUGINS_DASHBOARD_MODAL_ID","additionalParams","placement","action","resp","type","AddSitePluginModalError","message","code","data","error","onBeforeUnload","_ref11","setPageTitle","_ref12","pageTitle","getLanguage","host","language","_observeStateResult","observeStateResult","_","envState","requestFeedback","_ref13","onLayerStateChange","_ref14","resultOrPromise","installApp","_ref15","getSiteInfo","_ref19","getWidget","_ref16","Error","getDashboardPlugins","_ref17","getDashboardMenuPlugins","_ref18","createDashboardModule","_ref","createHost","dashboardSDKBuilders","createSDKBuilders","createHostModule","host","auth","getAuthHeaders","headers","Authorization","getAccessToken","proxyMarker","createEndpoint","releaseProxy","throwMarker","isObject","val","proxyTransferHandler","obj","port1","port2","expose","port","wrap","throwTransferHandler","value","serialized","transferHandlers","ep","callback","ev","id","type","path","argumentList","fromWireValue","returnValue","parent","prop","rawValue","proxy","transfer","wireValue","transferables","toWireValue","closeEndPoint","isMessagePort","endpoint","target","createProxy","throwIfProxyReleased","isReleased","isProxyReleased","_target","requestResponseMessage","p","r","_thisArg","rawArgumentList","last","processArguments","myFlat","arr","processed","v","transferCache","transfers","toWireValue","value","name","handler","transferHandlers","serializedValue","transferables","transferCache","fromWireValue","requestResponseMessage","ep","msg","transfers","resolve","id","generateUUID","l","ev","proxyCallbackMarker","proxyPromiseMarker","serializeAllMethodsIn","sdk","wrapMethodsWithProxy","originalMethod","_len","arguments","length","args","Array","_key","proxies","argsNoProxies","extractProxies","originalResult","proxy","deserializeReturnValue","serializeReturnValue","value","proxies","clonables","extractProxies","proxy","deserializeReturnValue","insertProxies","data","walker","val","isPromise","proxyId","uniqueId","promises","proxyPromiseMarker","isFunction","callbacks","innerProxies","argsAsArray","argsWithProxies","exec","proxyCallbackMarker","Array","isArray","map","i","isObject","mapObjectValues","dataWithoutProxies","hasOwnProperty","promiseId","callbackId","_len2","arguments","length","args","_key2","argsNoProxies","wrapMethodsWithProxy","obj","callback","Proxy","get","target","prop","Error","Promise","mapEntries","_ref","key","Object","fromEntries","entries","counter","handshakeCode","open","_ref","postMessage","origin","port1","widgetPort","port2","hostPort","MessageChannel","code","version","port","channel","serializeAllMethodsIn","wrap","close","releaseProxy","registerHeightReporter","bridge","container","update","updateHeight","offsetHeight","resizeObserver","ResizeObserver","observe","disconnect","origins","allowedOrigins","Set","isWixOrigin","origin","has","registerBeforeUnloadHandler","channel","eventTarget","EventTarget","isInWorker","window","onIframeBeforeUnload","event","dispatchEvent","CustomEvent","cancelable","preventDefault","returnValue","onBeforeUnloadHandle","onBeforeUnload","clearBeforeUnloadHandler","removeEventListener","then","_ref","remove","addEventListener","callback","safeParseEssentials","essentials","JSON","parse","decodeURIComponent","e","console","warn","getEssentialsFromQueryParams","queryParams","has","get","undefined","showError","channel","_ref","message","action","requestId","showToast","type","details","undefined","removeToastOnClick","uiType","createHost","config","searchString","fullUrl","URL","search","window","location","queryParams","URLSearchParams","origin","get","postMessage","parent","bind","isWixOrigin","Error","channel","close","open","closeMethods","autoHeightUpdate","undefined","element","autoHeightElement","document","documentElement","clearHeightReport","registerHeightReporter","push","onBeforeUnload","clearBeforeUnloadHandler","registerBeforeUnloadHandler","siteInfo","parseEncodedJson","getSiteInfoSync","contextIds","getContextIdsSync","hasAdminOnHost","channelProxy","Proxy","target","prop","receiver","Reflect","admin","getContextIds","openItemSelector","monitoring","essentials","getEssentialsFromQueryParams","getMonitoringClient","getMonitoringClientFunction","hostContext","context","monitoringConfig","sentrySDK","Sentry","forEach","method","showError","json","paramName","JSON","parse","decodeURIComponent","e","console","warn","dashboard","createDashboardModule","createHost","useBeforeRenderEffect","effect","effectCondition","lastEffectResult","setState","useState","withContextualWixClient","Component","ownPropsWithHost","host","compProps","useHostAndProps","createClient","auth","dashboard","enableContext","lastHost","React","createElement","_extends","maybeLocalHost","ownProps","hostType","lastResult","hostProps","setHostProps","undefined","useEffect","observeResult","channel","observeState","newPropsFromHost","cleanup","disconnect","close"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as be,b as Ee}from"./chunk-
|
|
1
|
+
import{a as be,b as Ee}from"./chunk-J7RIIVO6.js";import{a as ve}from"./chunk-RHDUKNAJ.js";import"./chunk-J3SVE4GM.js";import{c as Qe,d as Ze}from"./chunk-7EYXEF6M.js";import{b as ye,d as we,e as Xe,f as l,g as a,h,i as w,j as d}from"./chunk-SBZEOPXX.js";var xe=ye(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.EventType=void 0;var Ce;(function(i){i.removeAppCompleted="removeAppCompleted",i.componentSelectionChanged="componentSelectionChanged",i.appInstalled="appInstalled",i.appUpdateCompleted="appUpdateCompleted"})(Ce||(lt.EventType=Ce={}))});var Ot=ye(g=>{"use strict";var ti=g&&g.__createBinding||(Object.create?function(i,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(i,n,s)}:function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]}),ei=g&&g.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),ii=g&&g.__importStar||function(){var i=function(t){return i=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},i(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=i(t),s=0;s<n.length;s++)n[s]!=="default"&&ti(e,t,n[s]);return ei(e,t),e}}();Object.defineProperty(g,"__esModule",{value:!0});g.EventType=g.WixSDKTypes=void 0;var ni=ii((Ze(),Xe(Qe)));g.WixSDKTypes=ni;var si=xe();Object.defineProperty(g,"EventType",{enumerable:!0,get:function(){return si.EventType}})});var V=we(Ot(),1);var S=class S{constructor(){l(this,"uid",0);l(this,"callbacks",new Map);l(this,"inTransaction",!1);l(this,"isSilent",!1);l(this,"queue",[])}silent(t=!0){this.isSilent=t}startTransaction(){this.inTransaction=!0}commit(){this.inTransaction=!1;let t=this.queue;this.queue=[],this.isSilent||t.forEach(e=>{this.notify(e)})}notify(t){this.isSilent||(this.inTransaction?this.queue.push(t):this.callbacks.forEach(e=>{e(t)}))}subscribe(t){let e=this.uid++;return this.callbacks.set(e,t),()=>{this.callbacks.delete(e)}}notifyWithStep(t,e){this.notify({...t,meta:{...t.meta,step:e}})}async withEvent(t,e){let n=e();if(n&&n.hasOwnProperty("then"))try{return this.notifyWithStep(t,S.EventSteps.Start),n=await n,this.notifyWithStep(t,S.EventSteps.End),n}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},S.EventSteps.Error),s}else return this.notify(t),n}};l(S,"biEvents",{PLATFORM_WORKER_SPAWN:123,PLATFORM_APP_RUNNER_INIT_APP_API:124,PLATFORM_APP_RUNNER_RUN_APP:125,PLATFORM_APP_RUNNER_REMOVE_APP:126,PLATFORM_WORKER_APP_BUNDLE_LOAD:127,PLATFORM_WORKER_APP_BUNDLE_EXECUTE:128,PLATFORM_IFRAME_INIT:129,PLATFORM_APP_API_INIT:130,PLATFORM_APP_API_GET:131}),l(S,"EventSteps",{Start:"start",End:"end",Error:"error"});var kt=S,ht=(i=>(i.WorkerSpawn="WorkerSpawn",i.HostEvent="HostEvent",i.ApplicationsSpecsReceived="ApplicationsSpecsReceived",i.InitApplicationApi="InitApplicationApi",i.RunApplication="RunApplication",i.getApplicationApi="getApplicationApi",i.IframeInit="IframeInit",i))(ht||{}),Lt=(i=>(i.EditorReady="EditorReady",i))(Lt||{});var v=(i=>(i.ApplicationInit="ApplicationInit",i.ApplicationExecute="ApplicationExecute",i.ApplicationRemoved="ApplicationRemoved",i.ApplicationLoad="ApplicationLoad",i.ApplicationApiInit="ApplicationApiInit",i.CustomEvent="CustomEvent",i.HostEvent="HostEvent",i.EditorReady="EditorReady",i))(v||{}),Ft=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:E.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:E.biEvents.PLATFORM_WORKER_APP_BUNDLE_LOAD,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationExecuteEvent(t,e){return{type:"ApplicationExecute",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:E.biEvents.PLATFORM_WORKER_APP_BUNDLE_EXECUTE,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationApiInitEvent(t,e){return{type:"ApplicationApiInit",payload:{appDefinitionId:t},meta:{bi:{evid:E.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},E=class extends kt{constructor(){super(...arguments);l(this,"factories",new Ft)}},pt=class pt{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ht.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);pt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};l(pt,"allowedEvents",[V.EventType.componentSelectionChanged,V.EventType.appInstalled,V.EventType.appUpdateCompleted,V.EventType.removeAppCompleted]);var Me=pt;var A=class i extends Error{constructor(e,n,s){let r=e?` ${e}`:"",o=`[${s}]#${n}`;super(`${o}.${r}`);l(this,"state",{});l(this,"displayName");l(this,"prefix");l(this,"errorMessage");l(this,"parent");l(this,"messages",[]);l(this,"code");this.displayName=o,this.errorMessage=e,this.prefix=s,this.code=n,this.name=o,Object.defineProperty(this,"message",{get:()=>this.getDisplayMessage()}),Error.captureStackTrace&&Error.captureStackTrace(this,i)}get parentError(){let e=this.parent;if(!e)return null;if(this.parent instanceof i)return this.parent;let n=e.name??"[Unknown Error]";return{getBreadcrumbs(){return[n]},getMessage(){return[n,e.message??"unknown error message"].join(`
|
|
2
2
|
`)}}}getDisplayMessage(){return[(this.parentError?this.getBreadcrumbs():[]).join(" -> "),this.getMessage()].filter(n=>n.trim().length).join(`
|
|
3
3
|
`)}getMessage(){let e=Object.entries(this.state).reduce((c,[p,u])=>(u&&c.push(` \u2013 ${p}: ${u}`),c),[]).join(`
|
|
4
4
|
`),n=this.messages.reduce((c,p)=>(c.push(` - ${p.join(" ")}`),c),[]).join(`
|
|
5
5
|
`),s=this.parentError,r=s?["",s.getMessage(),""].join(`
|
|
6
6
|
`):"",o=this.errorMessage?`${this.displayName}: ${this.errorMessage}`:this.displayName;return[r,o,e,n].filter(c=>c.trim().length).join(`
|
|
7
|
-
`)}getBreadcrumbs(){let e=this.parentError;return e?[...e.getBreadcrumbs(),this.displayName]:[this.displayName]}withParentError(e){return this.parent=e,this}withMessage(...e){return this.messages.push(e),this}};function b(i){return function t(e,n=""){let s=new i(n,e);return Error.captureStackTrace&&Error.captureStackTrace(s,t),s}}var Ut=class extends A{constructor(e,n){super(e,n,"Editor Platform Internal Error");l(this,"state",{})}withHost(e){return this.state={...this.state,host:e},this}},ri=b(Ut);var W=(i=>(i.IncorrectEnvironment="IncorrectEnvironment",i))(W||{}),Wt=class extends A{constructor(e,n){super(e,n,"EP Context Error");l(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},J=b(Wt);async function oi(i,t){if(!i?.type)return i;switch(i.type){case"componentSelectionChanged":let e=i.componentRefs||[],n=await Promise.all(e.map(s=>t.components.getComponent(s)));return{type:i.type,components:n};default:return i}}var $t=class{constructor(t,e,n){l(this,"events");l(this,"subscribe");l(this,"commit");l(this,"startTransaction");l(this,"silent");this.appDefinitionId=t,this.privateAPI=n,this.events=e,this.subscribe=e.subscribe.bind(e),this.commit=e.commit.bind(e),this.startTransaction=e.startTransaction.bind(e),this.silent=e.silent.bind(e)}notify(t){this.events.notify({type:t.type,payload:t.payload,meta:{appDefinitionId:this.appDefinitionId}})}notifyCustomEvent(t,e){this.notify({type:v.CustomEvent,payload:{...e,type:t}})}addEventListener(t,e){return this.events.subscribe(async n=>{let s=n.meta?.appDefinitionId===this.appDefinitionId||n.meta?.appDefinitionId===null,r=()=>oi(n.payload,this.privateAPI);t==="*"?e(await r()):n.type===v.CustomEvent?t===n.payload?.type&&!s&&e(await r()):n.type===v.HostEvent&&t===n.payload?.type&&s&&e(await r())})}},ai=200,ci=50,O,qt,Te,dt=class{constructor(t){h(this,O);l(this,"injectionUUID");l(this,"injectionUUID_Deprecated");this.injectionUUID_Deprecated=`__${t}_CONTEXT_INJECTION_STATUS_KEY`,this.injectionUUID=`__${t}_CONTEXT_INJECTION_STATUS_KEY#0.1`,d(this,O,qt).call(this)||d(this,O,Te).call(this)}resolveInjected(){globalThis[this.injectionUUID]?.resolve()}waitInjected(){return new Promise((t,e)=>{let n=!1,s,r=0,o=()=>{n||(s=setTimeout(()=>{if(r++,r<ci){r%10===0&&console.log(J(W.IncorrectEnvironment,"contexts are not resolved, still re-trying").withMessage(`try number ${r}`).message),o();return}if(!n){let c=J(W.IncorrectEnvironment,"contexts are not resolved, threw by timeout");e(c)}},ai))};o(),d(this,O,qt).call(this)?.then(()=>{n=!0,clearTimeout(s),t()})})}};O=new WeakSet,qt=function(){return globalThis[this.injectionUUID]?.promise},Te=function(){let t,e=new Promise(n=>{t=n});globalThis[this.injectionUUID]={promise:e,resolve:t},globalThis[this.injectionUUID_Deprecated]=new Promise(n=>{e.then(n)})};var jt="__ENVIRONMENT_CONTEXT_KEY",Pt=(i=>(i.Worker="Worker",i.Frame="Frame",i.ComponentPanel="ComponentPanel",i))(Pt||{}),ut=class ut{constructor(t){this.environmentContext=t}static async inject(t){if(globalThis[jt])throw J(W.IncorrectEnvironment,"Environment context already exists and should not be overridden");globalThis[jt]=new ut(t),this.status.resolveInjected()}static async getInstance(){return await this.status.waitInjected(),globalThis[jt]}getPrivateAPI(){return this.environmentContext.privateApi}getEvents(){return this.environmentContext.events}getApplicationAPIs(){return this.environmentContext.applicationAPIs??{}}getEnvironment(){return this.environmentContext.environment}};l(ut,"status",new dt("environment"));var N=ut,Y="__APPLICATION_CONTEXT_KEY",ft=class ft{constructor(t,e){l(this,"events");this.context=t,this.environment=e,this.events=new $t(t.appDefinitionId?t.appDefinitionId:null,this.environment.getEvents(),this.environment.getPrivateAPI())}static async inject(t){if(globalThis[Y])throw J(W.IncorrectEnvironment,"Application context already exists and should not be overridden");globalThis[Y]=new ft(t,await N.getInstance()),this.status.resolveInjected()}static async getInstance(){return typeof __APPLICATION_CONTEXT_KEY<"u"?__APPLICATION_CONTEXT_KEY:(await this.status.waitInjected(),globalThis[Y])}getContext(){return this.context}getAppDefinitionId(){return this.context.appDefinitionId}getManifestContextId(){return this.context.manifestContextId}getEvents(){return this.events}getEnvironmentContext(){return this.environment}getPrivateAPI(){return this.environment.getPrivateAPI()}getPrivateApplicationAPI(){let t=this.getAppDefinitionId();if(!t)throw J(W.IncorrectEnvironment,"appDefinitionId is not available");return this.environment.getApplicationAPIs()[t]}};l(ft,"status",new dt("application"));var y=ft;var Ke=we(Ot());var tt=i=>`"editor-platform-transport": ${i}`,De=i=>tt(`[Internal Error] ${i}`),Se="\u0192",Ne="\u2202",Oe="_get_",ke="_set_",It="+",Re="-",Ht="\xB7",Xt="\xD7",Qt="\xB0",Fe=i=>i[0]===Xt?"":i,_e=i=>i===null||typeof i>"u"||typeof i=="symbol"||typeof i=="number"||typeof i=="boolean"||typeof i=="function"||typeof i=="string",li=i=>!!i&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof Set)&&!(i instanceof Map),pi=i=>$(i.split(Ht)),$=i=>i.map(Fe).filter(Boolean).join(".");function xt(i,t){return{marker:i,...t}}var hi=xt("A",{shouldUse:i=>Array.isArray(i),serialize:(i,t)=>{i.length?i.forEach((e,n)=>{t(`${n}`,e)}):t("",Qt)},deserialize:{create:()=>[],has:(i,t)=>!(typeof i[t]>"u"),append:(i,t,e)=>{i.push(e)}}}),di=xt("M",{shouldUse:i=>i instanceof Map,serialize:(i,t)=>{i.forEach((e,n)=>{t(n,e)})},deserialize:{create:()=>new Map,has:(i,t)=>i.has(t),append:(i,t,e)=>{i.set(t,e)}}}),ui=xt("S",{shouldUse:i=>i instanceof Set,serialize:(i,t)=>{let e=0;i.forEach(n=>{t(`${e++}`,n)})},deserialize:{create:()=>new Set,has:(i,t)=>i.has(t),append:(i,t,e)=>{i.add(e)}}}),zt=xt("O",{shouldUse:i=>typeof i=="object",serialize:(i,t)=>{let e=n=>{let r=Reflect.ownKeys(n).filter(c=>c!=="constructor").filter(c=>typeof c!="symbol");r.length?r.filter(c=>c!=="constructor").filter(c=>typeof c!="symbol").forEach(c=>{let p=Reflect.get(i,c);t(c,p)}):t("",Qt);let o=Reflect.getPrototypeOf(n);!o||o?.hasOwnProperty("__proto__")||e(o)};e(i)},deserialize:{create:()=>({}),has:(i,t)=>!!i[t],append:(i,t,e)=>{i[t]=e}}}),Le=[hi,ui,di];function fi(i,t){let e=i;for(;e;){let n=Object.getOwnPropertyDescriptor(e,t);if(n)return n;e=Reflect.getPrototypeOf(e)}return null}function Pi(i,t){let e=new WeakMap,n=r=>{let o=r.slice(1).map(Fe).filter(Boolean);return o.slice(1).reduce((c,p)=>({context:c.context[c.pointer],pointer:p}),{context:i,pointer:o[0]})},s=(r,o=[])=>{if(e.has(r)&&e.get(r)?.some(u=>o.join(".").startsWith(u))){t(o,{...n(o),value:"[Circular]"});return}if(r&&!_e(r)&&(e.has(r)&&e.set(r,[]),e.set(r,[...e.get(r)??[],o.join(".")])),_e(r)){t(o,{...n(o),value:r});return}let c=Le.find(p=>p.shouldUse(r))??zt;if(c){c.serialize(r,(p,u)=>{s(u,[...o,`${Xt}${c.marker}`,p])});return}};return s(i)}var Ii=(i,t)=>{if(!li(i))throw new Error(tt("only objects are serializable at the root level"));let e={data:[]},n=(r,o)=>{e.data.push([r,o])},s=(r,o)=>{t(pi(r),(...c)=>o.context[o.pointer](...c)),n(r,Se)};return Pi(i,(r,{value:o,context:c,pointer:p})=>{let u=r.slice(1).join(Ht),f=fi(c,p);if(f?.get||f?.set){f?.get&&t($([...r,Oe]),()=>c[p]),f?.set&&t($([...r,ke]),V=>{c[p]=V});let D=[f?.get?It:Re,f?.set?It:Re];n(u,`${Ne}${D.join("")}`)}else typeof o=="function"?s(u,{context:c,pointer:p}):n(u,o)}),e},gi=(i,t)=>typeof i!="object"||i===null?i:i.data.reduce((e,[n,s])=>{let r=e,o=n.split(Ht),c=zt,p=null;for(let u=0;u<o.length;u++){let f=o[u];if(f[0]===Xt){let D=c.deserialize.has(r,p);if(c=[zt,...Le].find(V=>V.marker===f[1]),!c)throw new Error(tt(`unknown marker "${f[1]}"`));D||(r[p]=c.deserialize.create()),r=r[p]}else p=f}if(s?.toString()===Qt)return e;if(s?.toString()===Se)c.deserialize.append(r,p,t($(o)));else if(s?.toString()[0]===Ne){let u=s?.toString()[1]===It,f=s?.toString()[2]===It,D={};if(u){let V=t($([...o,Oe]));D.get=()=>V()}f&&(D.set=t($([...o,ke]))),Object.defineProperty(r,p,D)}else c.deserialize.append(r,p,s);return e},{[Symbol("transferred object")]:`${(JSON.stringify(i.data).length/1024).toFixed(2)}Kb`});function Ue(){let i=globalThis.performance;if(i&&i.now)return i.now();let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=e.length,s=0,r=10;for(;s<r;)t+=e.charAt(Math.floor(Math.random()*n)),s+=1;return t}var X=(i=>(i.ExposeAPI="ExposeAPI",i.Call="Call",i.Response="Response",i.Cleanup="Cleanup",i))(X||{}),T=class i{constructor(t,e){l(this,"correlationId",`M-${Ue()}`);l(this,"parentCorrelationId");this.type=t,this.payload=e}withParentCorrelationId(t){return this.parentCorrelationId=t,this}serialize(t){return JSON.stringify({parentCorrelationId:this.parentCorrelationId,correlationId:this.correlationId,type:this.type,payload:Ii(this.payload,(e,n)=>{t(this.correlationId,e,n)})})}static fromEvent(t,e){let n=JSON.parse(t);return new i(n.type,gi(n.payload,s=>e(n.correlationId,s))).withParentCorrelationId(n.correlationId)}},Bt=class extends T{constructor(t){super("Cleanup",t)}},Vt=class extends T{constructor(t){super("Response",t)}},gt=class extends T{constructor(t){super("Response",t)}},Gt=class extends T{constructor(t){super("Call",t)}},Kt=(i,t)=>`${i}_${t}`,bt,Et,q,C,Yt=class{constructor(t){h(this,bt,new FinalizationRegistry(t=>{this.postMessage(new Bt(t))}));h(this,Et,{[X.Cleanup]:t=>{let e=t.payload.functionMarkerKey,n=t.payload.callId;delete a(this,q)[e],n&&delete a(this,C)[n]},[X.Response]:async t=>{let e=t.payload.callId,n=t.payload.errorMessage;if(n)if(t.payload.errorStack){let r=new Error(n);r.stack=t.payload.errorStack,a(this,C)[e]?.reject(r)}else a(this,C)[e]?.reject(n);else{let s=t.payload.response;a(this,C)[e]?.resolve(s)}delete a(this,C)[e]},[X.Call]:async t=>{let e=t.payload.functionMarkerKey,n=a(this,q)[e];if(!n){this.postMessage(new gt({callId:t.payload.callId,errorMessage:tt("function is not available")}));return}try{let s=await n.value(...t.payload.props??[]);this.postMessage(new Vt({callId:t.payload.callId,response:s}))}catch(s){this.postMessage(new gt({callId:t.payload.callId,errorMessage:s.message,errorStack:s.stack}))}}});h(this,q,{});h(this,C,{});l(this,"queue",[]);this.port=t,this.port.onmessage=e=>{this.onMessage(e)}}onMessage(t){let e=T.fromEvent(t.data,(n,s)=>{let r=this.replaceTransferredFunction(n,s);return a(this,bt).register(r,{functionMarkerKey:Kt(n,s)}),r});a(this,Et)[e.type]?.(e),this.messageEvents[e.type]?.(e)}postMessage(t){this.port.postMessage(t.serialize(this.registerTransferredFunction.bind(this)))}registerTransferredFunction(t,e,n){let s=Kt(t,e);a(this,q)[s]={path:e,value:n}}replaceTransferredFunction(t,e){return(...n)=>{let s=`CALL-${crypto.randomUUID()}`;return this.postMessage(new Gt({callId:s,functionMarkerKey:Kt(t,e),props:n})),new Promise((r,o)=>{a(this,C)[s]={resolve:r,reject:o}})}}flush(){this.queue.forEach(t=>{this.postMessage(t)}),this.queue=[]}};bt=new WeakMap,Et=new WeakMap,q=new WeakMap,C=new WeakMap;var mt=class extends Yt{constructor(){super(...arguments);l(this,"messageEvents",{})}expose(e){if(!e.type)throw new Error(tt('wrong exposed API instance, "type" property is required'));this.queue.push(new T(X.ExposeAPI,e)),this.flush()}};var H=(i=>(i.Ping="EDITOR_PLATFORM_TRANSPORT_EVENT:__Ping",i.RequestPort="EDITOR_PLATFORM_TRANSPORT_EVENT:__RequestPort",i.Pong="EDITOR_PLATFORM_TRANSPORT_EVENT:__Pong",i.Port="EDITOR_PLATFORM_TRANSPORT_EVENT:__Port",i))(H||{});var K,M,Ct,je,Jt=class{constructor(t,e){h(this,Ct);h(this,K,new Set);h(this,M);this.postMessage=t,this.onMessage=e}setActivePort(t){this.dispose(),w(this,M,t),d(this,Ct,je).call(this)}dispose(){a(this,M)&&(a(this,M).close(),a(this,M).onmessage=null)}onHandshake(t){return a(this,K).add(t),()=>{a(this,K).delete(t)}}};K=new WeakMap,M=new WeakMap,Ct=new WeakSet,je=function(){let t=a(this,M);if(!t){console.warn(De("port is required no notify onHandshake listeners"));return}a(this,K).forEach(e=>e(t))};var Q,Z,R,We,$e,qe,At=class extends Jt{constructor(e,n){super(e,n);h(this,R);h(this,Q,!1);h(this,Z,`consumer-${Ue()}`);d(this,R,We).call(this);let s={type:H.Ping};e(JSON.stringify(s))}};Q=new WeakMap,Z=new WeakMap,R=new WeakSet,We=function(){this.onMessage(e=>{try{let n=JSON.parse(e.data);switch(n.type){case H.Pong:{d(this,R,$e).call(this);break}case H.Port:{d(this,R,qe).call(this,n.targetMemberId,e.ports?.[0]);break}}}catch{}})},$e=function(){if(a(this,Q))return;w(this,Q,!0);let e={type:H.RequestPort,memberId:a(this,Z)};this.postMessage(JSON.stringify(e))},qe=function(e,n){if(e===a(this,Z)){if(!n)throw new Error(De("no port at consumer handshake"));this.setActivePort(n)}};var yt=class{get onConnect(){return this.handshake.onHandshake.bind(this.handshake)}},wt=class i extends yt{constructor(){super(...arguments);l(this,"handshake",new At(e=>{globalThis.parent.postMessage(e,"*")},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new mt(s).expose(e)})}};var vt=class i extends yt{constructor(){super(...arguments);l(this,"handshake",new At(e=>{globalThis.postMessage(e)},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new mt(s).expose(e)})}};var Mt=class{constructor(t){this.platformAppEvents=t}notify(t){switch(t.type){case Lt.EditorReady:this.platformAppEvents.notify({...t,type:v.EditorReady});break;case ht.HostEvent:this.platformAppEvents.notify({...t,type:v.HostEvent});break}}subscribe(t){this.platformAppEvents.subscribe(e=>{t(e)})}},re=(i=>(i.Frame="PLATFORM_FRAME_API",i.Worker="PLATFORM_WORKER_API",i))(re||{}),Tt=class{constructor(t,e){this.type=t,this.envType=e}async injectEnvironmentContext({events:t,privateApi:e}){await N.inject({environment:this.envType,events:t,privateApi:e,applicationAPIs:{}})}async injectApplicationContext(t){await y.inject(t)}},mi={classic:"https://www.unpkg.com/@wix/design-system/dist/statics/tokens-default.global.css",studio:"https://www.unpkg.com/@wix/design-system/dist/statics/tokens-studio.global.css"},et,it,_t,nt,Dt,ze,te=class extends Tt{constructor(){super(re.Frame,Pt.Frame);h(this,Dt);h(this,et,new E);h(this,it,new Mt(a(this,et)));h(this,_t);h(this,nt);d(this,Dt,ze).call(this)}async initEnvironment(e){let{applicationPrivateAPI:n,privateAPI:s,context:r}=e,o=e.context?.appDefinitionId??e.appDefinitionId,c=e.context?e.context:{appDefinitionId:o};w(this,nt,n),w(this,_t,s),await this.injectEnvironmentContext({privateApi:s,events:a(this,et),applicationAPIs:o?{[o]:a(this,nt)}:{}}),await this.injectApplicationContext(c)}notify(e){a(this,it).notify(e)}subscribe(e){a(this,it).subscribe(e)}};et=new WeakMap,it=new WeakMap,_t=new WeakMap,nt=new WeakMap,Dt=new WeakSet,ze=function(){if(typeof globalThis?.document?.head?.prepend=="function"){let n=new URL(globalThis.location.href).searchParams.get("editorType")==="CLASSIC"?"classic":"studio",s=mi[n],r=s&&!!document.querySelectorAll(`link[type="text/css"][href="${s}"]`)?.length;if(s&&!r){let o=document.createElement("link");o.setAttribute("rel","stylesheet"),o.setAttribute("type","text/css"),o.setAttribute("href",s),globalThis.document.head.prepend(o)}}};var _=(i=>(i.ApplicationLoadError="ApplicationLoadError",i.ApplicationFetchError="ApplicationFetchError",i.ApplicationExecuteError="ApplicationExecuteError",i))(_||{}),ee=class extends A{constructor(e,n){super(e,n,"EP Application Container Error");l(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}withApiMethod(e){return this.state={...this.state,apiMethod:e},this}withApiType(e){return this.state={...this.state,apiType:e},this}},k=b(ee),Ai="__APPLICATION_REGISTRY_KEY";async function yi(i,t,e){let n=new Function(Y,Ai,e),s,r=o=>{if(s)throw k(_.ApplicationExecuteError,"Application registry called more than once").withAppDefinitionId(t.appDefinitionId);if(o.type!==t.type)throw k(_.ApplicationExecuteError,"Application has different type").withMessage("expected type",t.type).withMessage("received type",o.type);s=o};try{let o={...t};n.call(null,new y(o,await N.getInstance()),r)}catch(o){throw k(_.ApplicationExecuteError,o.message).withAppDefinitionId(t.appDefinitionId).withParentError(o)}return new Promise((o,c)=>{let p=i.subscribe(u=>{let f=setTimeout(()=>{clearTimeout(f),p(),s||c(k(_.ApplicationExecuteError,"Application registry was not called, threw by timeout").withAppDefinitionId(t.appDefinitionId))},5e3);u.type===v.ApplicationInit&&u.meta.appDefinitionId===t.appDefinitionId&&(clearTimeout(f),p(),s||c(k(_.ApplicationExecuteError,"Application registry was not called").withAppDefinitionId(t.appDefinitionId)),o({instance:s}))})})}var F,st,P,ie=class{constructor(t,e){h(this,F,{});h(this,st);h(this,P);w(this,st,t),w(this,P,e),a(this,P).subscribe(n=>{switch(n.type){case v.HostEvent:{n.payload.type===Ke.EventType.removeAppCompleted&&a(this,P).withEvent(a(this,P).factories.createApplicationRemovedEvent(n.payload.appDefinitionId),()=>this.removeApplication(n.payload.appDefinitionId));break}}})}async runApplication(t){let e=await this.loadApplication(t),n=await this.executeApplication(t,e);return this.setApplication(t.appDefinitionId,n),n}setApplication(t,e){a(this,F)[t]=e,a(this,P).withEvent(a(this,P).factories.createApplicationApiInitEvent(t,e?.api?.private?"private":"public"),()=>{a(this,st).applicationManager.setApplication(e)})}getApplication(t){return a(this,F)[t]}getAppDefinitionIds(){return Object.keys(a(this,F))}removeApplication(t){delete a(this,F)[t]}async loadApplication(t){let e=t.url;return a(this,P).withEvent(a(this,P).factories.createApplicationLoadEvent(t,e),async()=>{try{return await this.loadApplicationBundle(e)}catch(n){throw k(_.ApplicationLoadError).withUrl(e).withAppDefinitionId(t.appDefinitionId).withParentError(n)}})}async loadApplicationBundle(t){let e=await fetch(t,{method:"GET"});if(!(e.status>=200&&e.status<=299))throw k(_.ApplicationFetchError).withUrl(t);return e.text()}async executeApplication(t,e){return a(this,P).withEvent(a(this,P).factories.createApplicationExecuteEvent(t,t.url),async()=>{let{instance:n}=await yi(a(this,P),t,e);return n})}};F=new WeakMap,st=new WeakMap,P=new WeakMap;var z,rt,ot,L,at,ne=class extends Tt{constructor(){super(re.Worker,Pt.Worker);h(this,z,new E);h(this,rt,new Mt(a(this,z)));h(this,ot,null);h(this,L);h(this,at,[])}create(){}async initEnvironment(e){let{buildPrivateAPI:n}=e;w(this,L,await n({type:"EDITOR_ADDON"})),await this.injectEnvironmentContext({events:a(this,z),privateApi:a(this,L),applicationAPIs:{}}),w(this,ot,new ie(a(this,L),a(this,z))),a(this,at).forEach(s=>s(this))}async notify(e){await this.waitReady(),a(this,rt).notify(e)}subscribe(e){a(this,rt).subscribe(e)}async runApplication(e){await this.waitReady(),await a(this,ot).runApplication(e)}waitReady(){return new Promise(e=>{if(a(this,L))return e(this);a(this,at).push(e)})}};z=new WeakMap,rt=new WeakMap,ot=new WeakMap,L=new WeakMap,at=new WeakMap;var Zt="$_EP_TRANSPORT_ENV_CONTEXT_GUARD",B,Be,Ve,Rt=class{constructor(){h(this,B)}isEnvironmentApiExposed(){return!!globalThis[Zt]}async getContexts(){let[t,e]=await Promise.all([N.getInstance(),y.getInstance()]);return{environmentContext:t,applicationContext:e}}expose(){if(this.isEnvironmentApiExposed())return;let t=typeof importScripts=="function",e=globalThis.self&&globalThis.top&&globalThis.self!==globalThis.top;t?(d(this,B,Be).call(this),globalThis[Zt]=!0):e&&(d(this,B,Ve).call(this),globalThis[Zt]=!0)}};B=new WeakSet,Be=function(){vt.exposeAPI(new ne)},Ve=function(){wt.exposeAPI(new te)};var se=class extends A{constructor(e,n){super(e,n,"EP EnvironmentAPI Error");l(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Xi=b(se);new Rt().expose();var oe=class extends A{constructor(e,n){super(e,n,"Auth Strategy Error");l(this,"state",{})}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Ge=b(oe);function wi(i,t){let e=Date.now(),n=i?new Date(i).getTime():null;return n&&n-e>t}var vi=30*60*1e3,bi=()=>{let i;return{getAuthHeaders:async()=>{let t=await y.getInstance(),e=t.getAppDefinitionId(),n=t.getPrivateAPI();if(!e)throw Ge("EmptyAppDefinitionId");return(!i||wi(i.expires,vi))&&(i=await n.auth.getAccessToken(e,await n.info.getMetaSiteId())),i?.token?{headers:{Authorization:i.token}}:(console.error(Ge("EmptyAppAuthInstance").withAppDefinitionId(e)),{headers:{Authorization:""}})}}},I=class i{constructor(t,e=[]){this.ShapeConstructor=t,this.selectedMethods=e}withPublicMethod(t){return new i(this.ShapeConstructor,[...this.selectedMethods,t])}build(){if(!this.selectedMethods.length)throw new Error("methods are not defined for the SDK shape");let t=this.selectedMethods.reduce((e,n)=>({...e,[n]:s=>{let r=new this.ShapeConstructor(s?.applicationContext);return r[n]?r[n].bind(r):()=>{console.error(`"${n}" is not defined in the SDK shape`)}}}),{});return be(t)}},ae=class extends A{constructor(t,e){super(t,e,"Base SDK Error")}},Ei=b(ae),g=class{constructor(t=null){this.overriddenApplicationContext=t}getApplicationContext(){return this.overriddenApplicationContext?this.overriddenApplicationContext:y.getInstance()}async getAppDefinitionId(){return(await this.getApplicationContext()).getAppDefinitionId()}async getManifestContextId(){return(await this.getApplicationContext()).getManifestContextId()}async getRequiredManifestContextId(){let t=await this.getManifestContextId();if(!t)throw Ei("ManifestContextIdRequired");return t}async getEnvironmentContext(){return(await this.getApplicationContext()).getEnvironmentContext()}async getPlatformPrivateAPI(){return(await this.getApplicationContext()).getPrivateAPI()}},ce=class extends g{async getPrivateAPI(){return(await this.getApplicationContext()).getPrivateApplicationAPI()}async getPublicAPI(t){return(await this.getPlatformPrivateAPI()).applicationManager.getPublicApplicationAPI(t)}async getAppInstance(){return(await this.getPlatformPrivateAPI()).info.getAppInstance(await this.getAppDefinitionId())}},on=new I(ce).withPublicMethod("getPrivateAPI").withPublicMethod("getPublicAPI").withPublicMethod("getAppInstance").build(),Nt=class extends g{async addEventListener(t,e){return(await this.getApplicationContext()).getEvents().addEventListener(t,e)}},an=new I(Nt).withPublicMethod("addEventListener").build(),le=class extends g{async getSelection(){let t=await this.getPlatformPrivateAPI(),e=await t.components.getSelectedComponents();return Promise.all(e.map(n=>t.components.getComponent(n)))}async onSelectionChange(t){new Nt(this.getApplicationContext()).addEventListener("componentSelectionChanged",n=>{t(n.components)})}},cn=new I(le).withPublicMethod("onSelectionChange").withPublicMethod("getSelection").build(),pe=class extends g{async getViewMode(){return(await this.getPlatformPrivateAPI()).info.getViewMode()}async getLanguageCode(){return(await this.getPlatformPrivateAPI()).info.getLanguageCode()}async getSiteDirection(){return(await this.getPlatformPrivateAPI()).info.getSiteDirection()}async siteHasCustomClasses(){return(await this.getPlatformPrivateAPI()).info.siteHasCustomClasses()}},ln=new I(pe).withPublicMethod("getViewMode").withPublicMethod("getLanguageCode").withPublicMethod("getSiteDirection").withPublicMethod("siteHasCustomClasses").build(),ct=(i=>(i.UndefinedCompRef="UndefinedCompRef",i.NotAvailableMethod="NotAvailableMethod",i))(ct||{}),he=class extends A{constructor(t,e){super(t,e,"Widget Error")}},St=b(he),Je="underline";function Ci(i){return i.map(t=>He({font:t}).family).filter(Boolean)}function He(i){let t={family:void 0,size:void 0};if(i?.font){let{variableName:e,fallbackValue:n}=xi(i.font);t.cssVariableName=e;let s=n.match(/(?:(["']).*?\1|\S)+/g)||[];for(let r=0;r<s.length;r++){let o=s[r];switch(o){case"bold":t.bold=!0;break;case"italic":t.italic=!0;break;default:o?.endsWith("px")?t.size=parseInt(o,10):r===s.length-1?t.family=o:t.family=(t.family||"")+" "+o}}}return i?.textDecoration&&(t.underline=i.textDecoration===Je),t.family=t.family?.trim().replace(/['"]+/g,""),t}function xi(i){let t=i.trim(),e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{variableName:e[1],fallbackValue:e[2]?.trim()??""}:{variableName:void 0,fallbackValue:t}}var j=class i{constructor(t,e){this.compRef=t,this.privateAPI=e}async getProp(t){return(await this.privateAPI.refComponents.getProps(this.compRef))?.[t]}async setProp(t,e){await this.privateAPI.refComponents.setProps(this.compRef,{[t]:e})}async getDesignPreset(){return this.privateAPI.designPresets.getDesignPresetName(this.compRef)}async setDesignPreset(t){await this.privateAPI.designPresets.setDesignPresetByName(this.compRef,t)}async getNestedWidget(t){let e=await this.privateAPI.refComponents.findComponentBySelector(this.compRef,t);return e?new i(e,this.privateAPI):null}},x,U,de=class extends g{constructor(){super(...arguments);h(this,x)}async setPreloadFonts(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);if(await n.refComponents.isRefComponent(s))throw St(ct.NotAvailableMethod,"not available for the current component type");let r=Ci(e);await n.customElement.setPreloadFonts(s,r)}async getProp(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);return await n.refComponents.isRefComponent(s)?new j(s,n).getProp(e):n.customElement.getAttribute(s,e)}async setProp(e,n){let s=await this.getPlatformPrivateAPI(),r=await d(this,x,U).call(this);if(await s.refComponents.isRefComponent(r))return new j(r,s).setProp(e,n);await s.customElement.setAttribute(r,e,n)}async getDesignPreset(){let e=await this.getPlatformPrivateAPI(),n=await d(this,x,U).call(this);if(!await e.refComponents.isRefComponent(n))throw St(ct.NotAvailableMethod,"not available for the current component type");return new j(n,e).getDesignPreset()}async setDesignPreset(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);if(!await n.refComponents.isRefComponent(s))throw St(ct.NotAvailableMethod,"not available for the current component type");return new j(s,n).setDesignPreset(e)}async getNestedWidget(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);return new j(s,n).getNestedWidget(e)}};x=new WeakSet,U=async function(){let s=(await(await this.getPlatformPrivateAPI()).components.getSelectedComponents())[0];if(!s)throw St(ct.UndefinedCompRef);return s};var Mi=new I(de).withPublicMethod("getNestedWidget").withPublicMethod("setDesignPreset").withPublicMethod("getDesignPreset").withPublicMethod("setProp").withPublicMethod("getProp").withPublicMethod("setPreloadFonts"),pn=Mi.build();function Ti(i){return`${i.cssVariableName?`var(${i.cssVariableName}, `:""}${i.italic?"italic ":""}${i.bold?"bold ":""}${i.size||16}px ${i.family?.split(",").map(t=>`"${t.replace(/['"]+/g,"")}"`).join(",")||"serif"}${i.cssVariableName?")":""}`}function Ri(i){if(!i)return null;let t=i,e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{cssVariableName:e[1],color:e[2]}:{color:t}}function Ye(i){return i?i.cssVariableName?`var(${i.cssVariableName}, ${i.color})`:i.color:""}var _i={transformFontInternalValue:i=>{if(i){let{theme:t,cssVariableName:e,bold:n,italic:s,underline:r,...o}=i;return{...o,style:{bold:n,italic:s,underline:r},editorKey:e||t||""}}else return{editorKey:"font_7",family:"helvetica-w01-roman",size:16,style:{}}}},ue=class extends g{async selectColor(t,e){let n=await this.getPlatformPrivateAPI(),s=Ri(t),r=Ye(s);return await n.inputs.openColorPicker({color:s?.cssVariableName||s?.theme||s?.color},({color:o,theme:c,cssVariableTheme:p})=>{s={color:o,theme:c,cssVariableName:p},r=Ye(s),e?.onChange?.(r)}),r}async selectFont(t,e){let n=await this.getPlatformPrivateAPI(),s=He(t),r=t;return await n.inputs.openFontPickerV2({...e,panelSectionsDefinition:{htmlTag:"hidden"},componentStyle:_i.transformFontInternalValue(s)},(o,c)=>{r={font:Ti(o),textDecoration:o.underline?Je:void 0},e?.onChange?.(r)}),r}},hn=new I(ue).withPublicMethod("selectColor").withPublicMethod("selectFont").build(),fe=class extends g{async openLanguageSupportPanel(){return(await this.getPlatformPrivateAPI()).panels.openLanguageSupportPanel()}async openFontsUploadPanel(){return(await this.getPlatformPrivateAPI()).panels.openFontsUploadPanel()}},dn=new I(fe).withPublicMethod("openLanguageSupportPanel").withPublicMethod("openFontsUploadPanel").build(),Pe=class extends g{async openDashboardModal(t){return(await this.getPlatformPrivateAPI()).panels.openDashboardPanel(await this.getAppDefinitionId(),t)}},un=new I(Pe).withPublicMethod("openDashboardModal").build(),Ie=class extends g{async getStyleDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyleDefinitions(e)}async getStyles(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyles(e)}async setStyles(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setStyles(n,t)}async getDataDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getDataDefinitions(e)}async getData(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getData(e)}async setData(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setData(n,t)}async getPresetDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getPresetDefinitions(e)}async getAppliedPreset(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getAppliedPreset(e)}async applyPreset(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.applyPreset(n,t)}async getState(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getState(e)}async setState(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setState(n,t)}async getStateDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStateDefinitions(e)}async onChange(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.onContextualManifestChange(n,t)}async selectFont(t){try{let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return await e.builderComponent.selectFont(n,{...t,showWeights:!0})}catch{}}async selectFontFamily(t){try{let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return await e.builderComponent.selectFont(n,{...t,showWeights:!1})}catch{}}async selectMedia(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectMedia(n,t)}async selectLink(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectLink(n,t)}async selectColor(t){let e=await this.getPlatformPrivateAPI();try{let n=await this.getRequiredManifestContextId();return await e.builderComponent.selectColor(n,t)}catch{}}async selectFontWeight(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectFontWeight(n,t)}},fn=new I(Ie).withPublicMethod("getDataDefinitions").withPublicMethod("getData").withPublicMethod("setData").withPublicMethod("getStyleDefinitions").withPublicMethod("getStyles").withPublicMethod("setStyles").withPublicMethod("getPresetDefinitions").withPublicMethod("getAppliedPreset").withPublicMethod("applyPreset").withPublicMethod("getState").withPublicMethod("setState").withPublicMethod("onChange").withPublicMethod("getStateDefinitions").withPublicMethod("selectFont").withPublicMethod("selectFontFamily").withPublicMethod("selectMedia").withPublicMethod("selectLink").withPublicMethod("selectColor").withPublicMethod("selectFontWeight").build(),ge=class extends g{async get(t){return(await this.getPlatformPrivateAPI()).userPreferences.get(await this.getAppDefinitionId(),t)}async set(t){return(await this.getPlatformPrivateAPI()).userPreferences.set(await this.getAppDefinitionId(),t)}},Pn=new I(ge).withPublicMethod("set").withPublicMethod("get").build(),me=class extends g{async getData(){return(await this.getPlatformPrivateAPI()).externalPanels.getData()}async setData(t){return(await this.getPlatformPrivateAPI()).externalPanels.setData(t)}async getStyle(){return(await this.getPlatformPrivateAPI()).externalPanels.getStyle()}async setStyle(t){return(await this.getPlatformPrivateAPI()).externalPanels.setStyle(t)}async getTheme(){return(await this.getPlatformPrivateAPI()).externalPanels.getTheme()}async selectMedia(){return(await this.getPlatformPrivateAPI()).externalPanels.selectMedia()}async selectLink(...t){return(await this.getPlatformPrivateAPI()).externalPanels.selectLink(...t)}async selectColor(...t){return async()=>(await this.getPlatformPrivateAPI()).externalPanels.selectColor(...t)}async translate(t,e){return(await this.getPlatformPrivateAPI()).externalPanels.translate(t,e)}},In=new I(me).withPublicMethod("getTheme").withPublicMethod("getData").withPublicMethod("getStyle").withPublicMethod("selectColor").withPublicMethod("selectLink").withPublicMethod("selectMedia").withPublicMethod("setData").withPublicMethod("setStyle").withPublicMethod("translate").build(),Di=()=>{let i=new URLSearchParams(window.location.search),t=i.has("essentials")?JSON.parse(i.get("essentials")):void 0,{monitoring:e,...n}=t||{},s=i.get("appDefinitionId"),{context:r,config:o}=e||{},c=Ee({hostContext:{appId:s,...r},monitoringConfig:o,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{environment:{},applicationContext:y.getInstance(),channel:{observeState:async()=>({disconnect(){}})},getMonitoringClient:c,essentials:n}},Si=()=>({environment:{},applicationContext:y.getInstance(),channel:{observeState:async()=>({disconnect(){}})}}),Ae={host:()=>typeof importScripts=="function"?Si():Di(),auth:bi};var wn=()=>{let i=Ae.host(),t=Ae.auth();ve({auth:t,host:i}).enableContext("module")};export{wn as enableClient};
|
|
7
|
+
`)}getBreadcrumbs(){let e=this.parentError;return e?[...e.getBreadcrumbs(),this.displayName]:[this.displayName]}withParentError(e){return this.parent=e,this}withMessage(...e){return this.messages.push(e),this}};function b(i){return function t(e,n=""){let s=new i(n,e);return Error.captureStackTrace&&Error.captureStackTrace(s,t),s}}var Ut=class extends A{constructor(e,n){super(e,n,"Editor Platform Internal Error");l(this,"state",{})}withHost(e){return this.state={...this.state,host:e},this}},ri=b(Ut);var W=(i=>(i.IncorrectEnvironment="IncorrectEnvironment",i))(W||{}),Wt=class extends A{constructor(e,n){super(e,n,"EP Context Error");l(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},J=b(Wt);async function oi(i,t){if(!i?.type)return i;switch(i.type){case"componentSelectionChanged":let e=i.componentRefs||[],n=await Promise.all(e.map(s=>t.components.getComponent(s)));return{type:i.type,components:n};default:return i}}var $t=class{constructor(t,e,n){l(this,"events");l(this,"subscribe");l(this,"commit");l(this,"startTransaction");l(this,"silent");this.appDefinitionId=t,this.privateAPI=n,this.events=e,this.subscribe=e.subscribe.bind(e),this.commit=e.commit.bind(e),this.startTransaction=e.startTransaction.bind(e),this.silent=e.silent.bind(e)}notify(t){this.events.notify({type:t.type,payload:t.payload,meta:{appDefinitionId:this.appDefinitionId}})}notifyCustomEvent(t,e){this.notify({type:v.CustomEvent,payload:{...e,type:t}})}addEventListener(t,e){return this.events.subscribe(async n=>{let s=n.meta?.appDefinitionId===this.appDefinitionId||n.meta?.appDefinitionId===null,r=()=>oi(n.payload,this.privateAPI);t==="*"?e(await r()):n.type===v.CustomEvent?t===n.payload?.type&&!s&&e(await r()):n.type===v.HostEvent&&t===n.payload?.type&&s&&e(await r())})}},ai=200,ci=50,O,qt,Te,dt=class{constructor(t){h(this,O);l(this,"injectionUUID");l(this,"injectionUUID_Deprecated");this.injectionUUID_Deprecated=`__${t}_CONTEXT_INJECTION_STATUS_KEY`,this.injectionUUID=`__${t}_CONTEXT_INJECTION_STATUS_KEY#0.1`,d(this,O,qt).call(this)||d(this,O,Te).call(this)}resolveInjected(){globalThis[this.injectionUUID]?.resolve()}waitInjected(){return new Promise((t,e)=>{let n=!1,s,r=0,o=()=>{n||(s=setTimeout(()=>{if(r++,r<ci){r%10===0&&console.log(J(W.IncorrectEnvironment,"contexts are not resolved, still re-trying").withMessage(`try number ${r}`).message),o();return}if(!n){let c=J(W.IncorrectEnvironment,"contexts are not resolved, threw by timeout");e(c)}},ai))};o(),d(this,O,qt).call(this)?.then(()=>{n=!0,clearTimeout(s),t()})})}};O=new WeakSet,qt=function(){return globalThis[this.injectionUUID]?.promise},Te=function(){let t,e=new Promise(n=>{t=n});globalThis[this.injectionUUID]={promise:e,resolve:t},globalThis[this.injectionUUID_Deprecated]=new Promise(n=>{e.then(n)})};var jt="__ENVIRONMENT_CONTEXT_KEY",Pt=(i=>(i.Worker="Worker",i.Frame="Frame",i.ComponentPanel="ComponentPanel",i))(Pt||{}),ut=class ut{constructor(t){this.environmentContext=t}static async inject(t){if(globalThis[jt])throw J(W.IncorrectEnvironment,"Environment context already exists and should not be overridden");globalThis[jt]=new ut(t),this.status.resolveInjected()}static async getInstance(){return await this.status.waitInjected(),globalThis[jt]}getPrivateAPI(){return this.environmentContext.privateApi}getEvents(){return this.environmentContext.events}getApplicationAPIs(){return this.environmentContext.applicationAPIs??{}}getEnvironment(){return this.environmentContext.environment}};l(ut,"status",new dt("environment"));var N=ut,Y="__APPLICATION_CONTEXT_KEY",ft=class ft{constructor(t,e){l(this,"events");this.context=t,this.environment=e,this.events=new $t(t.appDefinitionId?t.appDefinitionId:null,this.environment.getEvents(),this.environment.getPrivateAPI())}static async inject(t){if(globalThis[Y])throw J(W.IncorrectEnvironment,"Application context already exists and should not be overridden");globalThis[Y]=new ft(t,await N.getInstance()),this.status.resolveInjected()}static async getInstance(){return typeof __APPLICATION_CONTEXT_KEY<"u"?__APPLICATION_CONTEXT_KEY:(await this.status.waitInjected(),globalThis[Y])}getContext(){return this.context}getAppDefinitionId(){return this.context.appDefinitionId}getManifestContextId(){return this.context.manifestContextId}getEvents(){return this.events}getEnvironmentContext(){return this.environment}getPrivateAPI(){return this.environment.getPrivateAPI()}getPrivateApplicationAPI(){let t=this.getAppDefinitionId();if(!t)throw J(W.IncorrectEnvironment,"appDefinitionId is not available");return this.environment.getApplicationAPIs()[t]}};l(ft,"status",new dt("application"));var y=ft;var Ke=we(Ot());var tt=i=>`"editor-platform-transport": ${i}`,De=i=>tt(`[Internal Error] ${i}`),Se="\u0192",Ne="\u2202",Oe="_get_",ke="_set_",mt="+",Re="-",Ht="\xB7",Xt="\xD7",Qt="\xB0",Fe=i=>i[0]===Xt?"":i,_e=i=>i===null||typeof i>"u"||typeof i=="symbol"||typeof i=="number"||typeof i=="boolean"||typeof i=="function"||typeof i=="string",li=i=>!!i&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof Set)&&!(i instanceof Map),pi=i=>$(i.split(Ht)),$=i=>i.map(Fe).filter(Boolean).join(".");function xt(i,t){return{marker:i,...t}}var hi=xt("A",{shouldUse:i=>Array.isArray(i),serialize:(i,t)=>{i.length?i.forEach((e,n)=>{t(`${n}`,e)}):t("",Qt)},deserialize:{create:()=>[],has:(i,t)=>!(typeof i[t]>"u"),append:(i,t,e)=>{i.push(e)}}}),di=xt("M",{shouldUse:i=>i instanceof Map,serialize:(i,t)=>{i.forEach((e,n)=>{t(n,e)})},deserialize:{create:()=>new Map,has:(i,t)=>i.has(t),append:(i,t,e)=>{i.set(t,e)}}}),ui=xt("S",{shouldUse:i=>i instanceof Set,serialize:(i,t)=>{let e=0;i.forEach(n=>{t(`${e++}`,n)})},deserialize:{create:()=>new Set,has:(i,t)=>i.has(t),append:(i,t,e)=>{i.add(e)}}}),zt=xt("O",{shouldUse:i=>typeof i=="object",serialize:(i,t)=>{let e=n=>{let r=Reflect.ownKeys(n).filter(c=>c!=="constructor").filter(c=>typeof c!="symbol");r.length?r.filter(c=>c!=="constructor").filter(c=>typeof c!="symbol").forEach(c=>{let p=Reflect.get(i,c);t(c,p)}):t("",Qt);let o=Reflect.getPrototypeOf(n);!o||o?.hasOwnProperty("__proto__")||e(o)};e(i)},deserialize:{create:()=>({}),has:(i,t)=>!!i[t],append:(i,t,e)=>{i[t]=e}}}),Le=[hi,ui,di];function fi(i,t){let e=i;for(;e;){let n=Object.getOwnPropertyDescriptor(e,t);if(n)return n;e=Reflect.getPrototypeOf(e)}return null}function Pi(i,t){let e=new WeakMap,n=r=>{let o=r.slice(1).map(Fe).filter(Boolean);return o.slice(1).reduce((c,p)=>({context:c.context[c.pointer],pointer:p}),{context:i,pointer:o[0]})},s=(r,o=[])=>{if(e.has(r)&&e.get(r)?.some(u=>o.join(".").startsWith(u))){t(o,{...n(o),value:"[Circular]"});return}if(r&&!_e(r)&&(e.has(r)&&e.set(r,[]),e.set(r,[...e.get(r)??[],o.join(".")])),_e(r)){t(o,{...n(o),value:r});return}let c=Le.find(p=>p.shouldUse(r))??zt;if(c){c.serialize(r,(p,u)=>{s(u,[...o,`${Xt}${c.marker}`,p])});return}};return s(i)}var mi=(i,t)=>{if(!li(i))throw new Error(tt("only objects are serializable at the root level"));let e={data:[]},n=(r,o)=>{e.data.push([r,o])},s=(r,o)=>{t(pi(r),(...c)=>o.context[o.pointer](...c)),n(r,Se)};return Pi(i,(r,{value:o,context:c,pointer:p})=>{let u=r.slice(1).join(Ht),f=fi(c,p);if(f?.get||f?.set){f?.get&&t($([...r,Oe]),()=>c[p]),f?.set&&t($([...r,ke]),G=>{c[p]=G});let D=[f?.get?mt:Re,f?.set?mt:Re];n(u,`${Ne}${D.join("")}`)}else typeof o=="function"?s(u,{context:c,pointer:p}):n(u,o)}),e},Ii=(i,t)=>typeof i!="object"||i===null?i:i.data.reduce((e,[n,s])=>{let r=e,o=n.split(Ht),c=zt,p=null;for(let u=0;u<o.length;u++){let f=o[u];if(f[0]===Xt){let D=c.deserialize.has(r,p);if(c=[zt,...Le].find(G=>G.marker===f[1]),!c)throw new Error(tt(`unknown marker "${f[1]}"`));D||(r[p]=c.deserialize.create()),r=r[p]}else p=f}if(s?.toString()===Qt)return e;if(s?.toString()===Se)c.deserialize.append(r,p,t($(o)));else if(s?.toString()[0]===Ne){let u=s?.toString()[1]===mt,f=s?.toString()[2]===mt,D={};if(u){let G=t($([...o,Oe]));D.get=()=>G()}f&&(D.set=t($([...o,ke]))),Object.defineProperty(r,p,D)}else c.deserialize.append(r,p,s);return e},{[Symbol("transferred object")]:`${(JSON.stringify(i.data).length/1024).toFixed(2)}Kb`});function Ue(){let i=globalThis.performance;if(i&&i.now)return i.now();let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=e.length,s=0,r=10;for(;s<r;)t+=e.charAt(Math.floor(Math.random()*n)),s+=1;return t}var X=(i=>(i.ExposeAPI="ExposeAPI",i.Call="Call",i.Response="Response",i.Cleanup="Cleanup",i))(X||{}),T=class i{constructor(t,e){l(this,"correlationId",`M-${Ue()}`);l(this,"parentCorrelationId");this.type=t,this.payload=e}withParentCorrelationId(t){return this.parentCorrelationId=t,this}serialize(t){return JSON.stringify({parentCorrelationId:this.parentCorrelationId,correlationId:this.correlationId,type:this.type,payload:mi(this.payload,(e,n)=>{t(this.correlationId,e,n)})})}static fromEvent(t,e){let n=JSON.parse(t);return new i(n.type,Ii(n.payload,s=>e(n.correlationId,s))).withParentCorrelationId(n.correlationId)}},Bt=class extends T{constructor(t){super("Cleanup",t)}},Gt=class extends T{constructor(t){super("Response",t)}},It=class extends T{constructor(t){super("Response",t)}},Vt=class extends T{constructor(t){super("Call",t)}},Kt=(i,t)=>`${i}_${t}`,bt,Et,q,C,Yt=class{constructor(t){h(this,bt,new FinalizationRegistry(t=>{this.postMessage(new Bt(t))}));h(this,Et,{[X.Cleanup]:t=>{let e=t.payload.functionMarkerKey,n=t.payload.callId;delete a(this,q)[e],n&&delete a(this,C)[n]},[X.Response]:async t=>{let e=t.payload.callId,n=t.payload.errorMessage;if(n)if(t.payload.errorStack){let r=new Error(n);r.stack=t.payload.errorStack,a(this,C)[e]?.reject(r)}else a(this,C)[e]?.reject(n);else{let s=t.payload.response;a(this,C)[e]?.resolve(s)}delete a(this,C)[e]},[X.Call]:async t=>{let e=t.payload.functionMarkerKey,n=a(this,q)[e];if(!n){this.postMessage(new It({callId:t.payload.callId,errorMessage:tt("function is not available")}));return}try{let s=await n.value(...t.payload.props??[]);this.postMessage(new Gt({callId:t.payload.callId,response:s}))}catch(s){this.postMessage(new It({callId:t.payload.callId,errorMessage:s.message,errorStack:s.stack}))}}});h(this,q,{});h(this,C,{});l(this,"queue",[]);this.port=t,this.port.onmessage=e=>{this.onMessage(e)}}onMessage(t){let e=T.fromEvent(t.data,(n,s)=>{let r=this.replaceTransferredFunction(n,s);return a(this,bt).register(r,{functionMarkerKey:Kt(n,s)}),r});a(this,Et)[e.type]?.(e),this.messageEvents[e.type]?.(e)}postMessage(t){this.port.postMessage(t.serialize(this.registerTransferredFunction.bind(this)))}registerTransferredFunction(t,e,n){let s=Kt(t,e);a(this,q)[s]={path:e,value:n}}replaceTransferredFunction(t,e){return(...n)=>{let s=`CALL-${crypto.randomUUID()}`;return this.postMessage(new Vt({callId:s,functionMarkerKey:Kt(t,e),props:n})),new Promise((r,o)=>{a(this,C)[s]={resolve:r,reject:o}})}}flush(){this.queue.forEach(t=>{this.postMessage(t)}),this.queue=[]}};bt=new WeakMap,Et=new WeakMap,q=new WeakMap,C=new WeakMap;var gt=class extends Yt{constructor(){super(...arguments);l(this,"messageEvents",{})}expose(e){if(!e.type)throw new Error(tt('wrong exposed API instance, "type" property is required'));this.queue.push(new T(X.ExposeAPI,e)),this.flush()}};var H=(i=>(i.Ping="EDITOR_PLATFORM_TRANSPORT_EVENT:__Ping",i.RequestPort="EDITOR_PLATFORM_TRANSPORT_EVENT:__RequestPort",i.Pong="EDITOR_PLATFORM_TRANSPORT_EVENT:__Pong",i.Port="EDITOR_PLATFORM_TRANSPORT_EVENT:__Port",i))(H||{});var K,M,Ct,je,Jt=class{constructor(t,e){h(this,Ct);h(this,K,new Set);h(this,M);this.postMessage=t,this.onMessage=e}setActivePort(t){this.dispose(),w(this,M,t),d(this,Ct,je).call(this)}dispose(){a(this,M)&&(a(this,M).close(),a(this,M).onmessage=null)}onHandshake(t){return a(this,K).add(t),()=>{a(this,K).delete(t)}}};K=new WeakMap,M=new WeakMap,Ct=new WeakSet,je=function(){let t=a(this,M);if(!t){console.warn(De("port is required no notify onHandshake listeners"));return}a(this,K).forEach(e=>e(t))};var Q,Z,R,We,$e,qe,At=class extends Jt{constructor(e,n){super(e,n);h(this,R);h(this,Q,!1);h(this,Z,`consumer-${Ue()}`);d(this,R,We).call(this);let s={type:H.Ping};e(JSON.stringify(s))}};Q=new WeakMap,Z=new WeakMap,R=new WeakSet,We=function(){this.onMessage(e=>{try{let n=JSON.parse(e.data);switch(n.type){case H.Pong:{d(this,R,$e).call(this);break}case H.Port:{d(this,R,qe).call(this,n.targetMemberId,e.ports?.[0]);break}}}catch{}})},$e=function(){if(a(this,Q))return;w(this,Q,!0);let e={type:H.RequestPort,memberId:a(this,Z)};this.postMessage(JSON.stringify(e))},qe=function(e,n){if(e===a(this,Z)){if(!n)throw new Error(De("no port at consumer handshake"));this.setActivePort(n)}};var yt=class{get onConnect(){return this.handshake.onHandshake.bind(this.handshake)}},wt=class i extends yt{constructor(){super(...arguments);l(this,"handshake",new At(e=>{globalThis.parent.postMessage(e,"*")},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new gt(s).expose(e)})}};var vt=class i extends yt{constructor(){super(...arguments);l(this,"handshake",new At(e=>{globalThis.postMessage(e)},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new gt(s).expose(e)})}};var Mt=class{constructor(t){this.platformAppEvents=t}notify(t){switch(t.type){case Lt.EditorReady:this.platformAppEvents.notify({...t,type:v.EditorReady});break;case ht.HostEvent:this.platformAppEvents.notify({...t,type:v.HostEvent});break}}subscribe(t){this.platformAppEvents.subscribe(e=>{t(e)})}},re=(i=>(i.Frame="PLATFORM_FRAME_API",i.Worker="PLATFORM_WORKER_API",i))(re||{}),Tt=class{constructor(t,e){this.type=t,this.envType=e}async injectEnvironmentContext({events:t,privateApi:e}){await N.inject({environment:this.envType,events:t,privateApi:e,applicationAPIs:{}})}async injectApplicationContext(t){await y.inject(t)}},gi={classic:"https://www.unpkg.com/@wix/design-system/dist/statics/tokens-default.global.css",studio:"https://www.unpkg.com/@wix/design-system/dist/statics/tokens-studio.global.css"},et,it,_t,nt,Dt,ze,te=class extends Tt{constructor(){super(re.Frame,Pt.Frame);h(this,Dt);h(this,et,new E);h(this,it,new Mt(a(this,et)));h(this,_t);h(this,nt);d(this,Dt,ze).call(this)}async initEnvironment(e){let{applicationPrivateAPI:n,privateAPI:s,context:r}=e,o=e.context?.appDefinitionId??e.appDefinitionId,c=e.context?e.context:{appDefinitionId:o};w(this,nt,n),w(this,_t,s),await this.injectEnvironmentContext({privateApi:s,events:a(this,et),applicationAPIs:o?{[o]:a(this,nt)}:{}}),await this.injectApplicationContext(c)}notify(e){a(this,it).notify(e)}subscribe(e){a(this,it).subscribe(e)}};et=new WeakMap,it=new WeakMap,_t=new WeakMap,nt=new WeakMap,Dt=new WeakSet,ze=function(){if(typeof globalThis?.document?.head?.prepend=="function"){let n=new URL(globalThis.location.href).searchParams.get("editorType")==="CLASSIC"?"classic":"studio",s=gi[n],r=s&&!!document.querySelectorAll(`link[type="text/css"][href="${s}"]`)?.length;if(s&&!r){let o=document.createElement("link");o.setAttribute("rel","stylesheet"),o.setAttribute("type","text/css"),o.setAttribute("href",s),globalThis.document.head.prepend(o)}}};var _=(i=>(i.ApplicationLoadError="ApplicationLoadError",i.ApplicationFetchError="ApplicationFetchError",i.ApplicationExecuteError="ApplicationExecuteError",i))(_||{}),ee=class extends A{constructor(e,n){super(e,n,"EP Application Container Error");l(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}withApiMethod(e){return this.state={...this.state,apiMethod:e},this}withApiType(e){return this.state={...this.state,apiType:e},this}},k=b(ee),Ai="__APPLICATION_REGISTRY_KEY";async function yi(i,t,e){let n=new Function(Y,Ai,e),s,r=o=>{if(s)throw k(_.ApplicationExecuteError,"Application registry called more than once").withAppDefinitionId(t.appDefinitionId);if(o.type!==t.type)throw k(_.ApplicationExecuteError,"Application has different type").withMessage("expected type",t.type).withMessage("received type",o.type);s=o};try{let o={...t};n.call(null,new y(o,await N.getInstance()),r)}catch(o){throw k(_.ApplicationExecuteError,o.message).withAppDefinitionId(t.appDefinitionId).withParentError(o)}return new Promise((o,c)=>{let p=i.subscribe(u=>{let f=setTimeout(()=>{clearTimeout(f),p(),s||c(k(_.ApplicationExecuteError,"Application registry was not called, threw by timeout").withAppDefinitionId(t.appDefinitionId))},5e3);u.type===v.ApplicationInit&&u.meta.appDefinitionId===t.appDefinitionId&&(clearTimeout(f),p(),s||c(k(_.ApplicationExecuteError,"Application registry was not called").withAppDefinitionId(t.appDefinitionId)),o({instance:s}))})})}var F,st,P,ie=class{constructor(t,e){h(this,F,{});h(this,st);h(this,P);w(this,st,t),w(this,P,e),a(this,P).subscribe(n=>{switch(n.type){case v.HostEvent:{n.payload.type===Ke.EventType.removeAppCompleted&&a(this,P).withEvent(a(this,P).factories.createApplicationRemovedEvent(n.payload.appDefinitionId),()=>this.removeApplication(n.payload.appDefinitionId));break}}})}async runApplication(t){let e=await this.loadApplication(t),n=await this.executeApplication(t,e);return this.setApplication(t.appDefinitionId,n),n}setApplication(t,e){a(this,F)[t]=e,a(this,P).withEvent(a(this,P).factories.createApplicationApiInitEvent(t,e?.api?.private?"private":"public"),()=>{a(this,st).applicationManager.setApplication(e)})}getApplication(t){return a(this,F)[t]}getAppDefinitionIds(){return Object.keys(a(this,F))}removeApplication(t){delete a(this,F)[t]}async loadApplication(t){let e=t.url;return a(this,P).withEvent(a(this,P).factories.createApplicationLoadEvent(t,e),async()=>{try{return await this.loadApplicationBundle(e)}catch(n){throw k(_.ApplicationLoadError).withUrl(e).withAppDefinitionId(t.appDefinitionId).withParentError(n)}})}async loadApplicationBundle(t){let e=await fetch(t,{method:"GET"});if(!(e.status>=200&&e.status<=299))throw k(_.ApplicationFetchError).withUrl(t);return e.text()}async executeApplication(t,e){return a(this,P).withEvent(a(this,P).factories.createApplicationExecuteEvent(t,t.url),async()=>{let{instance:n}=await yi(a(this,P),t,e);return n})}};F=new WeakMap,st=new WeakMap,P=new WeakMap;var z,rt,ot,L,at,ne=class extends Tt{constructor(){super(re.Worker,Pt.Worker);h(this,z,new E);h(this,rt,new Mt(a(this,z)));h(this,ot,null);h(this,L);h(this,at,[])}create(){}async initEnvironment(e){let{buildPrivateAPI:n}=e;w(this,L,await n({type:"EDITOR_ADDON"})),await this.injectEnvironmentContext({events:a(this,z),privateApi:a(this,L),applicationAPIs:{}}),w(this,ot,new ie(a(this,L),a(this,z))),a(this,at).forEach(s=>s(this))}async notify(e){await this.waitReady(),a(this,rt).notify(e)}subscribe(e){a(this,rt).subscribe(e)}async runApplication(e){await this.waitReady(),await a(this,ot).runApplication(e)}waitReady(){return new Promise(e=>{if(a(this,L))return e(this);a(this,at).push(e)})}};z=new WeakMap,rt=new WeakMap,ot=new WeakMap,L=new WeakMap,at=new WeakMap;var Zt="$_EP_TRANSPORT_ENV_CONTEXT_GUARD",B,Be,Ge,Rt=class{constructor(){h(this,B)}isEnvironmentApiExposed(){return!!globalThis[Zt]}async getContexts(){let[t,e]=await Promise.all([N.getInstance(),y.getInstance()]);return{environmentContext:t,applicationContext:e}}expose(){if(this.isEnvironmentApiExposed())return;let t=typeof importScripts=="function",e=globalThis.self&&globalThis.top&&globalThis.self!==globalThis.top;t?(d(this,B,Be).call(this),globalThis[Zt]=!0):e&&(d(this,B,Ge).call(this),globalThis[Zt]=!0)}};B=new WeakSet,Be=function(){vt.exposeAPI(new ne)},Ge=function(){wt.exposeAPI(new te)};var se=class extends A{constructor(e,n){super(e,n,"EP EnvironmentAPI Error");l(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Xi=b(se);new Rt().expose();var oe=class extends A{constructor(e,n){super(e,n,"Auth Strategy Error");l(this,"state",{})}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Ve=b(oe);function wi(i,t){let e=Date.now(),n=i?new Date(i).getTime():null;return n&&n-e>t}var vi=30*60*1e3,bi=()=>{let i;return{getAuthHeaders:async()=>{let t=await y.getInstance(),e=t.getAppDefinitionId(),n=t.getPrivateAPI();if(!e)throw Ve("EmptyAppDefinitionId");return(!i||wi(i.expires,vi))&&(i=await n.auth.getAccessToken(e,await n.info.getMetaSiteId())),i?.token?{headers:{Authorization:i.token}}:(console.error(Ve("EmptyAppAuthInstance").withAppDefinitionId(e)),{headers:{Authorization:""}})}}},m=class i{constructor(t,e=[]){this.ShapeConstructor=t,this.selectedMethods=e}withPublicMethod(t){return new i(this.ShapeConstructor,[...this.selectedMethods,t])}build(){if(!this.selectedMethods.length)throw new Error("methods are not defined for the SDK shape");let t=this.selectedMethods.reduce((e,n)=>({...e,[n]:s=>{let r=new this.ShapeConstructor(s?.applicationContext);return r[n]?r[n].bind(r):()=>{console.error(`"${n}" is not defined in the SDK shape`)}}}),{});return be(t)}},ae=class extends A{constructor(t,e){super(t,e,"Base SDK Error")}},Ei=b(ae),I=class{constructor(t=null){this.overriddenApplicationContext=t}getApplicationContext(){return this.overriddenApplicationContext?this.overriddenApplicationContext:y.getInstance()}async getAppDefinitionId(){return(await this.getApplicationContext()).getAppDefinitionId()}async getManifestContextId(){return(await this.getApplicationContext()).getManifestContextId()}async getRequiredManifestContextId(){let t=await this.getManifestContextId();if(!t)throw Ei("ManifestContextIdRequired");return t}async getEnvironmentContext(){return(await this.getApplicationContext()).getEnvironmentContext()}async getPlatformPrivateAPI(){return(await this.getApplicationContext()).getPrivateAPI()}},ce=class extends I{async getPrivateAPI(){return(await this.getApplicationContext()).getPrivateApplicationAPI()}async getPublicAPI(t){return(await this.getPlatformPrivateAPI()).applicationManager.getPublicApplicationAPI(t)}async getAppInstance(){return(await this.getPlatformPrivateAPI()).info.getAppInstance(await this.getAppDefinitionId())}},on=new m(ce).withPublicMethod("getPrivateAPI").withPublicMethod("getPublicAPI").withPublicMethod("getAppInstance").build(),Nt=class extends I{async addEventListener(t,e){return(await this.getApplicationContext()).getEvents().addEventListener(t,e)}},an=new m(Nt).withPublicMethod("addEventListener").build(),le=class extends I{async getSelection(){let t=await this.getPlatformPrivateAPI(),e=await t.components.getSelectedComponents();return Promise.all(e.map(n=>t.components.getComponent(n)))}async onSelectionChange(t){new Nt(this.getApplicationContext()).addEventListener("componentSelectionChanged",n=>{t(n.components)})}},cn=new m(le).withPublicMethod("onSelectionChange").withPublicMethod("getSelection").build(),pe=class extends I{async getViewMode(){return(await this.getPlatformPrivateAPI()).info.getViewMode()}async getLanguageCode(){return(await this.getPlatformPrivateAPI()).info.getLanguageCode()}async getSiteDirection(){return(await this.getPlatformPrivateAPI()).info.getSiteDirection()}async siteHasCustomClasses(){return(await this.getPlatformPrivateAPI()).info.siteHasCustomClasses()}async getThemeCustomProperties(t){return(await this.getPlatformPrivateAPI()).builderComponent.getThemeCustomProperties(t)}},ln=new m(pe).withPublicMethod("getViewMode").withPublicMethod("getLanguageCode").withPublicMethod("getSiteDirection").withPublicMethod("siteHasCustomClasses").withPublicMethod("getThemeCustomProperties").build(),ct=(i=>(i.UndefinedCompRef="UndefinedCompRef",i.NotAvailableMethod="NotAvailableMethod",i))(ct||{}),he=class extends A{constructor(t,e){super(t,e,"Widget Error")}},St=b(he),Je="underline";function Ci(i){return i.map(t=>He({font:t}).family).filter(Boolean)}function He(i){let t={family:void 0,size:void 0};if(i?.font){let{variableName:e,fallbackValue:n}=xi(i.font);t.cssVariableName=e;let s=n.match(/(?:(["']).*?\1|\S)+/g)||[];for(let r=0;r<s.length;r++){let o=s[r];switch(o){case"bold":t.bold=!0;break;case"italic":t.italic=!0;break;default:o?.endsWith("px")?t.size=parseInt(o,10):r===s.length-1?t.family=o:t.family=(t.family||"")+" "+o}}}return i?.textDecoration&&(t.underline=i.textDecoration===Je),t.family=t.family?.trim().replace(/['"]+/g,""),t}function xi(i){let t=i.trim(),e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{variableName:e[1],fallbackValue:e[2]?.trim()??""}:{variableName:void 0,fallbackValue:t}}var j=class i{constructor(t,e){this.compRef=t,this.privateAPI=e}async getProp(t){return(await this.privateAPI.refComponents.getProps(this.compRef))?.[t]}async setProp(t,e){await this.privateAPI.refComponents.setProps(this.compRef,{[t]:e})}async getDesignPreset(){return this.privateAPI.designPresets.getDesignPresetName(this.compRef)}async setDesignPreset(t){await this.privateAPI.designPresets.setDesignPresetByName(this.compRef,t)}async getNestedWidget(t){let e=await this.privateAPI.refComponents.findComponentBySelector(this.compRef,t);return e?new i(e,this.privateAPI):null}},x,U,de=class extends I{constructor(){super(...arguments);h(this,x)}async setPreloadFonts(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);if(await n.refComponents.isRefComponent(s))throw St(ct.NotAvailableMethod,"not available for the current component type");let r=Ci(e);await n.customElement.setPreloadFonts(s,r)}async getProp(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);return await n.refComponents.isRefComponent(s)?new j(s,n).getProp(e):n.customElement.getAttribute(s,e)}async setProp(e,n){let s=await this.getPlatformPrivateAPI(),r=await d(this,x,U).call(this);if(await s.refComponents.isRefComponent(r))return new j(r,s).setProp(e,n);await s.customElement.setAttribute(r,e,n)}async getDesignPreset(){let e=await this.getPlatformPrivateAPI(),n=await d(this,x,U).call(this);if(!await e.refComponents.isRefComponent(n))throw St(ct.NotAvailableMethod,"not available for the current component type");return new j(n,e).getDesignPreset()}async setDesignPreset(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);if(!await n.refComponents.isRefComponent(s))throw St(ct.NotAvailableMethod,"not available for the current component type");return new j(s,n).setDesignPreset(e)}async getNestedWidget(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);return new j(s,n).getNestedWidget(e)}};x=new WeakSet,U=async function(){let s=(await(await this.getPlatformPrivateAPI()).components.getSelectedComponents())[0];if(!s)throw St(ct.UndefinedCompRef);return s};var Mi=new m(de).withPublicMethod("getNestedWidget").withPublicMethod("setDesignPreset").withPublicMethod("getDesignPreset").withPublicMethod("setProp").withPublicMethod("getProp").withPublicMethod("setPreloadFonts"),pn=Mi.build();function Ti(i){return`${i.cssVariableName?`var(${i.cssVariableName}, `:""}${i.italic?"italic ":""}${i.bold?"bold ":""}${i.size||16}px ${i.family?.split(",").map(t=>`"${t.replace(/['"]+/g,"")}"`).join(",")||"serif"}${i.cssVariableName?")":""}`}function Ri(i){if(!i)return null;let t=i,e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{cssVariableName:e[1],color:e[2]}:{color:t}}function Ye(i){return i?i.cssVariableName?`var(${i.cssVariableName}, ${i.color})`:i.color:""}var _i={transformFontInternalValue:i=>{if(i){let{theme:t,cssVariableName:e,bold:n,italic:s,underline:r,...o}=i;return{...o,style:{bold:n,italic:s,underline:r},editorKey:e||t||""}}else return{editorKey:"font_7",family:"helvetica-w01-roman",size:16,style:{}}}},ue=class extends I{async selectColor(t,e){let n=await this.getPlatformPrivateAPI(),s=Ri(t),r=Ye(s);return await n.inputs.openColorPicker({color:s?.cssVariableName||s?.theme||s?.color},({color:o,theme:c,cssVariableTheme:p})=>{s={color:o,theme:c,cssVariableName:p},r=Ye(s),e?.onChange?.(r)}),r}async selectFont(t,e){let n=await this.getPlatformPrivateAPI(),s=He(t),r=t;return await n.inputs.openFontPickerV2({...e,panelSectionsDefinition:{htmlTag:"hidden"},componentStyle:_i.transformFontInternalValue(s)},(o,c)=>{r={font:Ti(o),textDecoration:o.underline?Je:void 0},e?.onChange?.(r)}),r}},hn=new m(ue).withPublicMethod("selectColor").withPublicMethod("selectFont").build(),fe=class extends I{async openLanguageSupportPanel(){return(await this.getPlatformPrivateAPI()).panels.openLanguageSupportPanel()}async openFontsUploadPanel(){return(await this.getPlatformPrivateAPI()).panels.openFontsUploadPanel()}},dn=new m(fe).withPublicMethod("openLanguageSupportPanel").withPublicMethod("openFontsUploadPanel").build(),Pe=class extends I{async openDashboardModal(t){return(await this.getPlatformPrivateAPI()).panels.openDashboardPanel(await this.getAppDefinitionId(),t)}},un=new m(Pe).withPublicMethod("openDashboardModal").build(),me=class extends I{async getStyleDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyleDefinitions(e)}async getStyles(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyles(e)}async setStyles({cssProperties:t,cssCustomProperties:e}={}){let n=await this.getPlatformPrivateAPI(),s=await this.getRequiredManifestContextId();return n.builderComponent.setStyles(s,{cssProperties:t,cssCustomProperties:e})}async removeStyles({cssPropertiesKeys:t,cssCustomPropertiesKeys:e}={}){let n=await this.getPlatformPrivateAPI(),s=await this.getRequiredManifestContextId();return n.builderComponent.removeStyles(s,{cssPropertiesKeys:t,cssCustomPropertiesKeys:e})}async getDataDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getDataDefinitions(e)}async getData(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getData(e)}async getResolvedData({dataItemKey:t}){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.getResolvedData(n,{dataItemKey:t})}async setData(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setData(n,t)}async getPresetDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getPresetDefinitions(e)}async getAppliedPreset(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getAppliedPreset(e)}async applyPreset(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.applyPreset(n,t)}async getDisplayGroupDefinitions(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.getDisplayGroupDefinitions(n,t)}async getState(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getState(e)}async setState(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setState(n,t)}async getStateDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStateDefinitions(e)}async onChange(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.onContextualManifestChange(n,t)}async selectFont(t){try{let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return await e.builderComponent.selectFont(n,{...t,showWeights:!0})}catch{}}async selectFontFamily(t){try{let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return await e.builderComponent.selectFont(n,{...t,showWeights:!1})}catch{}}async selectMedia(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectMedia(n,t)}async selectLink(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectLink(n,t)}async selectColor(t){let e=await this.getPlatformPrivateAPI();try{let n=await this.getRequiredManifestContextId();return await e.builderComponent.selectColor(n,t)}catch{}}async selectFontWeight(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectFontWeight(n,t)}async selectTextTheme(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectTextTheme(n,t)}},fn=new m(me).withPublicMethod("getDataDefinitions").withPublicMethod("getData").withPublicMethod("getResolvedData").withPublicMethod("setData").withPublicMethod("getStyleDefinitions").withPublicMethod("getStyles").withPublicMethod("setStyles").withPublicMethod("removeStyles").withPublicMethod("getPresetDefinitions").withPublicMethod("getAppliedPreset").withPublicMethod("applyPreset").withPublicMethod("getDisplayGroupDefinitions").withPublicMethod("getState").withPublicMethod("setState").withPublicMethod("onChange").withPublicMethod("getStateDefinitions").withPublicMethod("selectFont").withPublicMethod("selectFontFamily").withPublicMethod("selectMedia").withPublicMethod("selectLink").withPublicMethod("selectColor").withPublicMethod("selectFontWeight").withPublicMethod("selectTextTheme").build(),Ie=class extends I{async get(t){return(await this.getPlatformPrivateAPI()).userPreferences.get(await this.getAppDefinitionId(),t)}async set(t){return(await this.getPlatformPrivateAPI()).userPreferences.set(await this.getAppDefinitionId(),t)}},Pn=new m(Ie).withPublicMethod("set").withPublicMethod("get").build(),ge=class extends I{async getData(){return(await this.getPlatformPrivateAPI()).externalPanels.getData()}async setData(t){return(await this.getPlatformPrivateAPI()).externalPanels.setData(t)}async getStyle(){return(await this.getPlatformPrivateAPI()).externalPanels.getStyle()}async setStyle(t){return(await this.getPlatformPrivateAPI()).externalPanels.setStyle(t)}async getTheme(){return(await this.getPlatformPrivateAPI()).externalPanels.getTheme()}async selectMedia(){return(await this.getPlatformPrivateAPI()).externalPanels.selectMedia()}async selectLink(...t){return(await this.getPlatformPrivateAPI()).externalPanels.selectLink(...t)}async selectColor(...t){return async()=>(await this.getPlatformPrivateAPI()).externalPanels.selectColor(...t)}async translate(t,e){return(await this.getPlatformPrivateAPI()).externalPanels.translate(t,e)}},mn=new m(ge).withPublicMethod("getTheme").withPublicMethod("getData").withPublicMethod("getStyle").withPublicMethod("selectColor").withPublicMethod("selectLink").withPublicMethod("selectMedia").withPublicMethod("setData").withPublicMethod("setStyle").withPublicMethod("translate").build(),Di=()=>{let i=new URLSearchParams(window.location.search),t=i.has("essentials")?JSON.parse(i.get("essentials")):void 0,{monitoring:e,...n}=t||{},s=i.get("appDefinitionId"),{context:r,config:o}=e||{},c=Ee({hostContext:{appId:s,...r},monitoringConfig:o,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{environment:{},applicationContext:y.getInstance(),channel:{observeState:async()=>({disconnect(){}})},getMonitoringClient:c,essentials:n}},Si=()=>({environment:{},applicationContext:y.getInstance(),channel:{observeState:async()=>({disconnect(){}})}}),Ae={host:()=>typeof importScripts=="function"?Si():Di(),auth:bi};var wn=()=>{let i=Ae.host(),t=Ae.auth();ve({auth:t,host:i}).enableContext("module")};export{wn as enableClient};
|
|
8
8
|
//# sourceMappingURL=editor.js.map
|