@myop/sdk 0.3.17 → 0.3.19
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/dist/bundled-declarations.d.ts +50 -0
- package/dist/cjs/_IframeSDK.736cc080.min.js +1 -0
- package/dist/cjs/{_IframeSDK.2444180b.js → _IframeSDK.b158be2e.js} +55 -13
- package/dist/cjs/_IframeSDK.b158be2e.js.map +7 -0
- package/dist/cjs/_MyopHelpers.19dc0df3.min.js +1 -0
- package/dist/cjs/{_MyopHelpers.a39f420c.js → _MyopHelpers.71a8a09b.js} +47 -1
- package/dist/cjs/_MyopHelpers.71a8a09b.js.map +7 -0
- package/dist/cjs/_WebComponentSDK.d0ae9e45.min.js +1 -0
- package/dist/cjs/{_WebComponentSDK.8ff8e8a2.js → _WebComponentSDK.fedea102.js} +52 -10
- package/dist/cjs/_WebComponentSDK.fedea102.js.map +7 -0
- package/dist/cjs/_hostSDK.1f707218.min.js +1 -0
- package/dist/cjs/{_hostSDK.8915b7f2.js → _hostSDK.898f6183.js} +52 -10
- package/dist/cjs/_hostSDK.898f6183.js.map +7 -0
- package/dist/cjs/myop_sdk.js +14 -14
- package/dist/cjs/myop_sdk.js.map +1 -1
- package/dist/cjs/myop_sdk.min.js +1 -1
- package/dist/cjs-bundled/myop_sdk.bundled.js +104 -14
- package/dist/cjs-bundled/myop_sdk.bundled.js.map +4 -4
- package/dist/cjs-bundled/myop_sdk.bundled.min.js +1 -1
- package/dist/module/Iframe/index.js +56 -14
- package/dist/module/Iframe/index.js.map +4 -4
- package/dist/module/SDK.js +104 -14
- package/dist/module/SDK.js.map +4 -4
- package/dist/module/common/index.d.ts +13 -0
- package/dist/module/common/index.js +1 -1
- package/dist/module/common/index.js.map +2 -2
- package/dist/module/embeddedSDK.js +1 -1
- package/dist/module/helpers/CloudRepository.d.ts +1 -0
- package/dist/module/helpers/cloudRepositoryHelpers.d.ts +12 -0
- package/dist/module/helpers/index.d.ts +1 -0
- package/dist/module/helpers/index.js +40 -2
- package/dist/module/helpers/index.js.map +3 -3
- package/dist/module/host/components/IMyopComponent.d.ts +13 -0
- package/dist/module/host/components/myopIframeComponent.d.ts +8 -0
- package/dist/module/host/embeddedSDK.js +1 -1
- package/dist/module/host/index.js +53 -11
- package/dist/module/host/index.js.map +3 -3
- package/dist/module/webcomponent/index.js +53 -11
- package/dist/module/webcomponent/index.js.map +3 -3
- package/package.json +1 -1
- package/dist/cjs/_IframeSDK.2444180b.js.map +0 -7
- package/dist/cjs/_IframeSDK.d5896709.min.js +0 -1
- package/dist/cjs/_MyopHelpers.a39f420c.js.map +0 -7
- package/dist/cjs/_MyopHelpers.eb1728bc.min.js +0 -1
- package/dist/cjs/_WebComponentSDK.87c5e31a.min.js +0 -1
- package/dist/cjs/_WebComponentSDK.8ff8e8a2.js.map +0 -7
- package/dist/cjs/_hostSDK.8915b7f2.js.map +0 -7
- package/dist/cjs/_hostSDK.fe79b132.min.js +0 -1
|
@@ -359,10 +359,23 @@ declare module "@myop/sdk/common" {
|
|
|
359
359
|
updatedOn?: string;
|
|
360
360
|
updatedBy?: string;
|
|
361
361
|
}
|
|
362
|
+
export interface ComponentAccess {
|
|
363
|
+
visibility: 'private' | 'unlisted' | 'public';
|
|
364
|
+
unlisted?: {
|
|
365
|
+
slug: string;
|
|
366
|
+
};
|
|
367
|
+
marketplace?: {
|
|
368
|
+
status: 'draft' | 'submitted' | 'claimed' | 'closed';
|
|
369
|
+
description: string;
|
|
370
|
+
contactEmail: string;
|
|
371
|
+
deadline: string;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
362
374
|
export interface v2_IComponentDefinitionConfig extends v2_IMyopStoredObject {
|
|
363
375
|
variants_ids: string[];
|
|
364
376
|
DTOs: v2_IDTO[];
|
|
365
377
|
tags: string[];
|
|
378
|
+
access?: ComponentAccess;
|
|
366
379
|
variants_names: string[];
|
|
367
380
|
variants_data: {
|
|
368
381
|
name: string;
|
|
@@ -1108,6 +1121,19 @@ declare module "@myop/sdk/host/components/IMyopComponent" {
|
|
|
1108
1121
|
* @returns Cleanup function to stop observing
|
|
1109
1122
|
*/
|
|
1110
1123
|
observeAutoSize?: (options?: AutoSizeOptions) => CleanupHandler;
|
|
1124
|
+
/**
|
|
1125
|
+
* Parsed myop:size meta tag from the component HTML.
|
|
1126
|
+
* Set by HTMLComponentLoader before iframe creation.
|
|
1127
|
+
* Used by the React host to determine sizing mode (fill vs content).
|
|
1128
|
+
*/
|
|
1129
|
+
sizeMeta?: {
|
|
1130
|
+
width?: string | number;
|
|
1131
|
+
height?: string | number;
|
|
1132
|
+
minWidth?: number;
|
|
1133
|
+
maxWidth?: number;
|
|
1134
|
+
minHeight?: number;
|
|
1135
|
+
maxHeight?: number;
|
|
1136
|
+
} | null;
|
|
1111
1137
|
parent?: IMyopComponent;
|
|
1112
1138
|
props: P;
|
|
1113
1139
|
refs: R;
|
|
@@ -1166,6 +1192,14 @@ declare module "@myop/sdk/host/components/myopIframeComponent" {
|
|
|
1166
1192
|
container: HTMLElement;
|
|
1167
1193
|
private IframeElement;
|
|
1168
1194
|
constructor(componentConfig: IComponentDefinitionConfig, skin: ISkinConfig, container: HTMLElement, IframeElement: HTMLIFrameElement, options?: loaderOptions);
|
|
1195
|
+
sizeMeta?: {
|
|
1196
|
+
width?: string | number;
|
|
1197
|
+
height?: string | number;
|
|
1198
|
+
minWidth?: number;
|
|
1199
|
+
maxWidth?: number;
|
|
1200
|
+
minHeight?: number;
|
|
1201
|
+
maxHeight?: number;
|
|
1202
|
+
} | null;
|
|
1169
1203
|
cleanupInspect?: CleanupHandler;
|
|
1170
1204
|
inspect(): CleanupHandler;
|
|
1171
1205
|
hide(): void;
|
|
@@ -1668,6 +1702,7 @@ declare module "@myop/sdk/helpers/CloudRepository" {
|
|
|
1668
1702
|
private preloadedComponents;
|
|
1669
1703
|
private userFlows;
|
|
1670
1704
|
private _defaultEnv;
|
|
1705
|
+
private _envExplicitlySet;
|
|
1671
1706
|
constructor(_baseUrl?: string);
|
|
1672
1707
|
/**
|
|
1673
1708
|
* Set the default environment for this CloudRepository instance
|
|
@@ -1715,6 +1750,20 @@ declare module "@myop/sdk/helpers/CloudRepository" {
|
|
|
1715
1750
|
declare module "@myop/sdk/helpers/exec" {
|
|
1716
1751
|
export const exec: (getter: any) => Promise<any>;
|
|
1717
1752
|
}
|
|
1753
|
+
declare module "@myop/sdk/helpers/cloudRepositoryHelpers" {
|
|
1754
|
+
import { CloudRepository } from "@myop/sdk/helpers/CloudRepository";
|
|
1755
|
+
export const getCloudRepository: () => CloudRepository;
|
|
1756
|
+
export const isPreloaded: (componentId: string, env?: string, preview?: boolean) => boolean;
|
|
1757
|
+
export const getPreloadedParams: (componentId: string) => {
|
|
1758
|
+
env: string;
|
|
1759
|
+
preview: boolean;
|
|
1760
|
+
};
|
|
1761
|
+
export const enableLocalDev: () => void;
|
|
1762
|
+
export const setCloudRepositoryUrl: (url: string) => void;
|
|
1763
|
+
export const setCloudRepository: (repository: CloudRepository) => void;
|
|
1764
|
+
export const setEnvironment: (env: string) => void;
|
|
1765
|
+
export const preloadComponents: (ids: string[], env?: string, preview?: boolean) => Promise<PromiseSettledResult<import("common").IComponentConfig>[]>;
|
|
1766
|
+
}
|
|
1718
1767
|
declare module "@myop/sdk/helpers" {
|
|
1719
1768
|
export * from "@myop/sdk/helpers/applyStylesheet";
|
|
1720
1769
|
export * from "@myop/sdk/helpers/iframeSkinUrlTokenizer";
|
|
@@ -1722,6 +1771,7 @@ declare module "@myop/sdk/helpers" {
|
|
|
1722
1771
|
export * from "@myop/sdk/helpers/configBuilder";
|
|
1723
1772
|
export * from "@myop/sdk/helpers/CloudRepository";
|
|
1724
1773
|
export * from "@myop/sdk/helpers/exec";
|
|
1774
|
+
export * from "@myop/sdk/helpers/cloudRepositoryHelpers";
|
|
1725
1775
|
}
|
|
1726
1776
|
declare module "@myop/sdk/host/myopOverride" {
|
|
1727
1777
|
import { IComponentConfig } from "@myop/sdk/common";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var $t=Object.defineProperty,Mn=Object.defineProperties;var Cn=Object.getOwnPropertyDescriptors;var Ft=Object.getOwnPropertySymbols;var In=Object.prototype.hasOwnProperty,xn=Object.prototype.propertyIsEnumerable;var dt=(o,n,e)=>n in o?$t(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,h=(o,n)=>{for(var e in n||(n={}))In.call(n,e)&&dt(o,e,n[e]);if(Ft)for(var e of Ft(n))xn.call(n,e)&&dt(o,e,n[e]);return o},A=(o,n)=>Mn(o,Cn(n));var bn=(o,n)=>{for(var e in n)$t(o,e,{get:n[e],enumerable:!0})};var r=(o,n,e)=>dt(o,typeof n!="symbol"?n+"":n,e);var re=class{constructor(n,e,t,s,i){this.myopId=n;this.htmlTagName=e;this.BoundingRect=t;this.offsetTop=s;this.offsetLeft=i;r(this,"type","MyopElementRef")}};var Wt=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let n=await o;typeof n=="function"&&n()}},M=class{constructor(n){this.messageToHost=n}},ve=class extends M{constructor(e,t){super(e);this.messageToHost=e;this.context=t}};var l={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",GetAttributeMessage:"GetAttributeMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",SetMutationObserverMessage:"SetMutationObserverMessage",SetResizeObserverMessage:"SetResizeObserverMessage",CleanupMessage:"CleanupMessage",In:{DetectedMyopRefsMessage:"DetectedMyopRefsMessage",ClickReplayMessage:"ClickReplayMessage",ExecuteScriptReplyMessage:"ExecuteScriptReplyMessage",EventListenerCallbackMessage:"EventListenerCallbackMessage",ElementValueReplayMessage:"ElementValueReplayMessage",GetAttributeReplayMessage:"GetAttributeReplayMessage",RefComponentCreatedMessage:"RefComponentCreatedMessage",EnvelopedMessage:"EnvelopedMessage",MutationObserverMessage:"MutationObserverMessage",CleanupReplayMessage:"CleanupReplayMessage",ResizeObserverMessage:"ResizeObserverMessage"}};var Re={};bn(Re,{AddEventListenerMessage:()=>ut,BaseMyopMessage:()=>C,BindClickMessage:()=>lt,ChangeTextMessage:()=>ft,CleanupMessage:()=>Ie,CleanupReplayMessage:()=>xe,ClickReplayMessage:()=>V,CreateRefComponentMessage:()=>ye,CustomRefMessage:()=>j,DetectMyopRefsMessage:()=>Mt,DetectedMyopRefsMessage:()=>X,DisposeMessage:()=>be,ElementValueReplayMessage:()=>Q,EnvelopedMessage:()=>he,EventListenerCallbackMessage:()=>Y,ExecuteComponentMethod:()=>B,ExecuteScriptMessage:()=>k,ExecuteScriptReplyMessage:()=>G,GetAttributeMessage:()=>Ct,GetAttributeReplayMessage:()=>Me,GetElementValueMessage:()=>yt,InitMessage:()=>ie,InitRequest:()=>J,InitResponse:()=>ge,MessageDirection:()=>b,MutationObserverMessage:()=>Ce,MyopBindMessage:()=>S,MyopBindReplayMessage:()=>w,MyopElementMessage:()=>mt,Ref:()=>N,RefComponentCreatedMessage:()=>K,ResizeObserverMessage:()=>we,SetAttributeMessage:()=>gt,SetInnerHtml:()=>ht,SetMutationObserverMessage:()=>It,SetResizeObserverMessage:()=>xt,stripFunction:()=>Vt});var _=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16));var wn=o=>{let n=[...o].map(e=>e.toString(16).padStart(2,"0")).join("");return[n.slice(0,8),n.slice(8,12),n.slice(12,16),n.slice(16,20),n.slice(20)].join("-")};var Sn=o=>{let n=o.replace(/-/g,"+").replace(/_/g,"/");for(;n.length%4;)n+="=";let e=atob(n);return Uint8Array.from(e,t=>t.charCodeAt(0))};var ct=o=>{let n=Sn(o);if(n.length%16!==0)throw new Error("Invalid input length");let e=[];for(let t=0;t<n.length;t+=16)e.push(wn(n.slice(t,t+16)));return e};var Nt=o=>new Promise(n=>setTimeout(n,o));var b=class{};r(b,"down","down"),r(b,"up","up");var C=class{constructor(){r(this,"id",_());r(this,"myop",!0);r(this,"content");r(this,"source");r(this,"destination");r(this,"route");r(this,"ref");r(this,"direction");r(this,"cleanable",!1)}static create(...n){return new this(...n)}isTypeof(n){return n.messageType===this.messageType}},mt=class extends C{constructor(e){super();this.ref=e}},w=class extends C{constructor(e){super();this.replayToHandler=e}},S=class extends C{constructor(e){super();this.handler=e;r(this,"handlerUniqueId",_())}},N=class o{constructor(n,e){this.refConfig=n;this.component=e;r(this,"myop",!0);r(this,"__nonProxied");this.__nonProxied=A(h({},this),{component:null})}static create(n,e,t){let s=e;return s||(s={id:"",name:"",description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}}),new o(s,t)}};var Ut="ClickReplayMessage",lt=class extends S{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",Ut);r(this,"messageType","BindClickMessage");r(this,"cleanable",!0)}},V=class extends w{constructor(){super(...arguments);r(this,"messageType",Ut)}};var ft=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","ChangeTextMessage");this.content=t}};var qt="ExecuteScriptReplyMessage",En=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,Tn=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,Vt=o=>{let n=o.match(En);if(n)return n[1]||n[3];{let e=o.match(Tn);if(e)return e[1].trim()}},k=class extends S{constructor(e,t=()=>{},s){super(t);this.scriptInputs=s;r(this,"replyMessageKey",qt);r(this,"messageType","ExecuteScriptMessage");r(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=Vt(this.content)}};r(k,"replierKey","send"),r(k,"completeStreamKey","completeStream");var G=class extends w{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;r(this,"messageType",qt)}};var j=class extends k{constructor(e,t,s=()=>{}){super(({rootRef:i,elementId:a,_script:p,__scriptInputs:d})=>{let c=(i.shadowRoot||i.container).querySelectorAll("[myop-id='".concat(a,"']"));return c.length?(d.ref=c[0],new Function("return (".concat(p,")(...arguments)"))(d)):null},s);this.scriptInputs=t;this.scriptInputs=A(h({},t),{_script:e.toString()})}};var Gt="EventListenerCallbackMessage",ut=class extends S{constructor(e,t,s){super(s);this.ref=e;this.type=t;this.handler=s;r(this,"replyMessageKey",Gt);r(this,"messageType","AddEventListenerMessage");r(this,"cleanable",!0);r(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},Y=class extends w{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;r(this,"messageType",Gt);this.content={e:t}}};var gt=class extends C{constructor(e,t,s){super();this.ref=e;this.name=t;this.value=s;r(this,"messageType","SetAttributeMessage")}};var jt="ElementValueReplayMessage",yt=class extends S{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",jt);r(this,"messageType","GetElementValueMessage")}},Q=class extends w{constructor(e){super();this.content=e;r(this,"messageType",jt)}};var ht=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","SetInnerHtml");this.content=t}};var ie=class extends C{constructor(e){super();r(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},ge=class extends ie{constructor(){super(...arguments);r(this,"messageType","InitResponse")}},J=class extends C{constructor(){super(...arguments);r(this,"messageType","InitRequest")}};var Yt="RefComponentCreatedMessage",ye=class extends S{constructor(e,t,s,i){super(i);this.refConfig=e;this.nestedComponentConfig=t;this.options=s;r(this,"replyMessageKey",Yt);r(this,"messageType","CreateRefComponentMessage")}},K=class extends w{constructor(e,t,s){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=s;r(this,"messageType",Yt)}};var he=class extends C{constructor(e,t){super();this.destination=e;this.message=t;r(this,"messageType","EnvelopedMessage");let s=t;this.route=[e,...s.route?s.route:[]]}};var Qt="DetectedMyopRefsMessage",Mt=class extends S{constructor(){super(...arguments);r(this,"messageType","DetectMyopRefsMessage");r(this,"replyMessageKey",Qt)}},X=class extends w{constructor(e,t){super(e);this.replayToHandler=e;r(this,"messageType",Qt);this.content=t}isTypeof(e){return e.messageType===this.messageType}};var Jt="GetAttributeReplayMessage",Ct=class extends S{constructor(e,t,s){super(s);this.ref=e;this.name=t;r(this,"replyMessageKey",Jt);r(this,"messageType","GetAttributeMessage")}},Me=class extends w{constructor(e){super();this.content=e;r(this,"messageType",Jt)}};var B=class extends C{constructor(e){super();this.method=e;r(this,"messageType","ExecuteComponentMethod")}};var It=class extends C{constructor(){super(...arguments);r(this,"messageType","SetMutationObserverMessage")}},Ce=class extends C{constructor(){super(...arguments);r(this,"messageType","MutationObserverMessage")}};var Xt="CleanupReplayMessage",Ie=class extends S{constructor(e,t){super(t);this.cleanupForMessageId=e;r(this,"replyMessageKey",Xt);r(this,"messageType","CleanupMessage")}},xe=class extends w{constructor(e){super();this.customCleanup=e;r(this,"messageType",Xt)}};var be=class extends C{constructor(){super(...arguments);r(this,"messageType","DisposeMessage")}};var xt=class extends C{constructor(){super(...arguments);r(this,"cleanable",!0);r(this,"messageType","SetResizeObserverMessage")}},we=class extends C{constructor(){super(...arguments);r(this,"messageType","ResizeObserverMessage")}};var bt=class{constructor(n,e){this.id=n;this.context=e;r(this,"send",n=>{})}},ae=class{constructor(){r(this,"messageToHandleAfterInit",[]);r(this,"components",{});r(this,"alwaysPassEnvelopesToHost",!1);r(this,"messageCleanupCache",{})}handleIncomeMessages(n){let e=n.data?n.data:n.detail;if(!(!e||!e.myop)){let t=e;if(t.direction!==b.down)return;if(t.messageType===l.DisposeMessage){t.destination&&delete this.components[t.destination];return}if(t.messageType===l.InitMessage){let s=t.content.id;if(this.components[s])return;this.components[s]=new bt(s),this.messageToHost(new ge(s));return}if(t.messageType===l.EnvelopedMessage){let s=t,i=s.message;if(t=i,this.alwaysPassEnvelopesToHost||this.components[t.destination]){let a=myop.hostSDK.components.find(d=>d.id===i.destination);if(a){a.send(i);return}let p=myop.hostSDK.components.find(d=>d.id===s.destination);if(p){p.send(i);return}}else return}if(t.messageType){if(t.messageType===l.CleanupMessage){let i=t,a=this.messageCleanupCache[i.cleanupForMessageId],p=new xe(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],Wt(a).then(()=>{this.messageToHost(p,i)}).catch(()=>{})):this.messageToHost(p,i);return}let s=!1;this.supportedHandlers.forEach(i=>{if(i.messageType===t.messageType){s=!0;let a=i.executor(t);if(t.cleanable&&a&&(this.messageCleanupCache[t.id]=a),a&&!t.cleanable)throw new Error("Cleanup handler generated for non-cleanable message. \nmessageType - ".concat(t.messageType,", handler executor was - ").concat(i.executor,"\n\nPlease review the message definition object & message handler.\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."));if(!a&&t.cleanable)throw new Error("No cleanup handler generated for a cleanable message. \nmessageType - ".concat(t.messageType,", handler executor was - ").concat(i.executor,"\n\nPlease review the message definition object & message handler.\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."))}})}else console.log("unsupported message type")}}};var z={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"};var Z={open:"open",closed:"closed",none:"none",localFrame:"localFrame"};var ce={message:"message",code:"code"},pe=class{};r(pe,"code","code"),r(pe,"component","component");var ee={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},_e={Segment:"Segment",Promo:"Promo",AB:"AB"},de=class{constructor(n,e){this.container=n;this.shadowRoot=e;r(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));r(this,"getRoot",()=>this.shadowRoot||this.container)}};var T={id:"myop-id"};var ke=class extends M{constructor(){super(...arguments);r(this,"messageType",l.DetectMyopRefsMessage);r(this,"executor",e=>{let t=document.querySelectorAll("[".concat(T.id,"]")),s=[];t.forEach(i=>{let a=i.getAttribute(T.id);a&&s.push(new re(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new X(e.handlerUniqueId,s))})}};var I=(o,n)=>n.querySelectorAll("[".concat(T.id,"='").concat(o.refConfig.selector,"']")),Zt=(o,n)=>{let e=I(o,n);return e.length?e.item(0):null};var He=class extends M{constructor(){super(...arguments);r(this,"messageType",l.BindClickMessage);r(this,"executor",e=>{let t=[];return I(e.ref,document).forEach(i=>{let a=()=>{this.messageToHost(new V,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(i=>i())}})}};var De=class extends M{constructor(){super(...arguments);r(this,"messageType",l.ChangeTextMessage);r(this,"executor",e=>{I(e.ref,document).forEach(s=>{s.textContent=e.content})})}};var wt=o=>o!==Object(o),vn=o=>typeof o=="function",St=o=>{if(wt(o))return!0;if(vn(o)||Object.getPrototypeOf(o))return!1;for(let n in o){let e=o[n];if(typeof e=="object"){if(!St(e))return!1}else{if(wt(e))continue;return!1}}return!0},H=(o,n={},e=!0,t=new WeakMap)=>{if(wt(o))return o;if(Array.isArray(o)){if(t.has(o))return t.get(o);let s=[];t.set(o,s);for(let i=0;i<o.length;i++){let a=o[i];s[i]=H(a,n,e,t)}return s}if(o!==null&&typeof o=="object"){if(t.has(o))return t.get(o);let s={};t.set(o,s);for(let i in o){let a=typeof n=="boolean"?n:n[i];a&&(a===!0?(e?o[i]!==void 0:o[i])&&(s[i]=H(o[i],!0,e,t)):typeof a=="object"&&(s[i]=H(o[i],a,e,t)))}return s}return{}};var Be=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=H,t.send=n,t.rootRef=e,t.__scriptInputs=t;let i=new Function("return (".concat(o.script,")(...arguments)"))(t);n(i)};var Le=class extends M{constructor(){super(...arguments);r(this,"messageType",l.ExecuteScriptMessage);r(this,"executor",e=>{Be(e,s=>{this.messageToHost(new G(e.handlerUniqueId,s))},new de(document.documentElement))})}};var Pe="__federation__",en="onLoad";var me=(o,n)=>{window[Pe]&&window[Pe][o]&&window[Pe][o][en]&&window[Pe][o][en]({[o]:n})};var Oe=class extends M{constructor(){super(...arguments);r(this,"messageType",l.AddEventListenerMessage);r(this,"executor",e=>{let t=I(e.ref,document),s=[];return t.forEach(i=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new Y(e.handlerUniqueId,H(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),s.push(()=>{i.removeEventListener(e.type,a)})}),()=>{s.forEach(i=>{i()})}})}};var Ae=class extends M{constructor(){super(...arguments);r(this,"messageType",l.SetAttributeMessage);r(this,"executor",e=>{I(e.ref,document).forEach(s=>{s.setAttribute(e.name,e.value)})})}};var L=class{constructor(n,e,t){this.componentDefinition=n;this.container=e;r(this,"id","");r(this,"messageHandlers",{});r(this,"element");r(this,"_markedForDisposed",!1);r(this,"bind",(n,e)=>{this.messageHandlers[n]||(this.messageHandlers[n]=[]),this.messageHandlers[n].includes(e)||this.messageHandlers[n].push(e)});r(this,"bindWhen",(n,e,t)=>{if(!t)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[n]||(this.messageHandlers[n]=[]);let s=this.messageHandlers[n],i=a=>e(a)?(t(a),!0):!1;return s.push(i),()=>{let a=s.indexOf(i);a>-1&&s.splice(a,1)}});r(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});r(this,"isInitiated",!1);r(this,"_whenInitiatedResolve");r(this,"_whenInitiatedReject");r(this,"_whenInitiated",new Promise((n,e)=>{this._whenInitiatedResolve=n,this._whenInitiatedReject=e}));r(this,"initiated",()=>this._whenInitiated);r(this,"props",{});r(this,"refs",{});this.id=(t==null?void 0:t.id)||P.Instance().assignId(n);let s=t!=null&&t.timeout?t==null?void 0:t.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject("timeout_".concat(s," ").concat(this.id))},s),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(n){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=n}onMessageReceived(n){if(n.messageType===l.ExecuteComponentMethod){let t=n;return this[t.method]?this[t.method](t.content):console.log("method not found ".concat(t.method," on component"),this),!0}let e=this.messageHandlers[n.messageType];if(e&&e.length){let t=!1;return e.forEach(s=>{t=t||s(n)}),t}return!1}sendCleanupMessage(n){n.source=this.id,n.destination=this.id,n.direction=b.down;let e=this.bindWhen(n.replyMessageKey,s=>s.replayToHandler===n.handlerUniqueId,s=>{n.handler(s),e()}),t=n.handler;delete n.handler,this.send(n),n.handler=t}send(n){n.source||(n.source=this.id),n.destination||(n.destination=this.id),n.direction=b.down;let e;if(n.handler){let t=n;e=this.bindWhen(t.replyMessageKey,s=>s.replayToHandler===t.handlerUniqueId,t.handler),delete n.handler}return n.ref&&(n.ref=n.ref.__nonProxied||n.ref),n.cleanable?()=>{this.sendCleanupMessage(new Ie(n.id,t=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new be);let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}};var tn={notSerializableRefCall:(o,n)=>{throw new Error("\nThe input provided to '".concat(o.toString(),"' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation. \nThe following types of data are considered non-serializable and cannot be processed:\n\n- Functions\n- DOM elements\n- Class instances\n- Circular references\n- Symbols\n- BigInt values\n\nIn the following execution we detected :\n~~~~~~~~\n").concat(n," \n~~~~~~~~\nas not serializable.\n\nTo resolve this issue, please ensure that all inputs passed to '").concat(o.toString(),"' are in a serializable format.\nThis typically includes primitive types (strings, numbers, booleans), arrays, and plain objects. \nIf you need to include complex data types, consider converting them to a serializable structure before passing them to the function.\nOr use Myop message that support it: CustomRefMessage, AddEventListenerMessage or ExecuteScriptMessage.\n\nSuggested Fix:\n1. Remove or replace non-serializable values from your input.\n2. If using objects, ensure they do not contain any functions or circular references.\n3. Convert any class instances to plain objects or JSON-compatible formats.\n4. Use dedicated Myop message.\n\nFor more details on serialization and Myop message examples, refer to https://docs.myop.dev.\n\n"))}};var Se=class extends L{constructor(e,t,s){super(e,t.container,s);this.componentDefinition=e;this.parent=t;r(this,"send",e=>{let t=e.handler,s=super.send(e);return this.parent.send(new he(this.id,e)),e.handler=t,s});r(this,"dispose",()=>{this.isInitiated&&this.send(new B("dispose")),super.dispose()})}hide(){this.send(new B("hide"))}show(){this.send(new B("show"))}inspect(){return this.send(new B("inspect"))}setHeightBasedOnDocumentElement(){this.send(new B("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new B("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}};var te=class extends L{constructor(e,t,s,i,a,p){super(e,s,p);this.container=s;this.customElement=i;this.tagName=a;r(this,"ctaCleanup");r(this,"_ctaHandler");r(this,"_ctaQueue",[]);r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=super.send(e);return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",e),t});r(this,"dispose",()=>{var e;this.ctaCleanup&&this.ctaCleanup(),super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i,this.setInitiated()}inspect(){return this.cleanupInspect=le(this.id,"MyopExtractedWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}initWithData(e){typeof this.customElement.myop_init_interface=="function"&&this.customElement.myop_init_interface(e)}getData(){if(typeof this.customElement.myop_init_interface=="function")return this.customElement.myop_init_interface()}setCtaHandler(e){if(this.ctaCleanup&&this.ctaCleanup(),this._ctaHandler=e,this._ctaQueue.length>0){let s=[...this._ctaQueue];this._ctaQueue=[],s.forEach(i=>{this.markedForDisposed||e(i.action,i.payload)})}let t=s=>{var a;let i=s;(a=i.detail)!=null&&a.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(i.detail.action,i.detail.payload):this._ctaHandler||this._ctaQueue.push({action:i.detail.action,payload:i.detail.payload}))};this.customElement.addEventListener("myop-cta",t),this.ctaCleanup=()=>{this.customElement.removeEventListener("myop-cta",t)}}};var Rn=(o,n,e)=>{let t=document.createElement("a");return t.textContent=o,t.style.position="relative",t.style.padding="0 5px",t.style.fontSize="14px",t.style.top="0",t.style.top="".concat(n,"px"),t.style.transform="translateX(-50%)",t.target="_blank",t.href="https://dashboard.myop.dev/dashboard/component/".concat(e.id),t},le=(o,n,e,t,s,i)=>{let a=Rn("".concat(i.name," : ").concat(n),e,i);return t.insertBefore(a,s),s.style.border="1px solid #007BFF",s.style.display="block",()=>{s.style.border="unset",t.removeChild(a)}},nn=(o,n,e)=>o?!1:(console.error("Error: Undefined Prop\n\nIt looks like you've tried to use a prop that hasn't been defined.\nPlease check the prop name for any typos or ensure that it is properly defined in the component's prop list.\n\n"+"Prop Name: ".concat(n,"\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\n\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide.")),!0),on=(o,n,e)=>{console.error("Error: Code Prop Not Supported\n\nCurrently, code props are only supported in local frame components.\n\u26A0\uFE0F This is a work in progress feature \u2014 code props will be supported in upcoming versions.\n\nIn the meantime, you can use message props.\n\n"+"Prop Name: ".concat(n,"\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\n\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide."))},sn=(o,n,e)=>{let t=n.reduce((i,a)=>A(h({},i),{[a.name]:h({},a)}),{}),s={get:(i,a)=>{let p=t[a];if(nn(p,a,o))return!1;if(p.behavior.type===ce.code){if(o instanceof te)return(p.behavior.remap||a)==="myop_init_interface"?m=>{if(m===void 0)return o.getData();o.initWithData(m)}:void 0;if(e.loader.type===z.HTMLLoader&&e.loader.shadowRootMode===Z.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return on(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(N.create(p.behavior.ref)),c.push(f=>{d(f)}),p.behavior.params&&c.push(...p.behavior.params);let m=Re[p.behavior.message];o.send(new m(...c))}):null},set:(i,a,p)=>{let d=t[a];if(nn(d,a,o))return!1;if(d.behavior.type===ce.code){if(o instanceof te){let m=d.behavior.remap||a;if(m==="myop_cta_handler")return o.setCtaHandler(p),!0;if(m==="myop_init_interface")return o.initWithData(p),!0}if(e.loader.type===z.HTMLLoader&&e.loader.shadowRootMode===Z.localFrame){let m=d.behavior,f=o.element.contentWindow,u=m.remap||a;if(f[u]=p,u==="myop_cta_handler"&&f.__myop_cta_queue){let g=f.__myop_cta_queue;f.__myop_cta_queue=null,g.forEach(y=>{o.markedForDisposed||p(y.action,y.payload)})}return!0}return on(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(N.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let m=Re[d.behavior.message];return o.send(new m(...c)),!0}else throw new Error("Error: Unsupported Behavior\n\nThe 'behavior' field provided is not supported.\n"+"Component: ".concat(o.componentDefinition.name,", ID: ").concat(o.componentDefinition.id,"\n\n")+"Prop Name: ".concat(a,"\n")+"Behavior Field: ".concat(d.behavior.type,"\n\n")+"Check the documentation for valid behavior options.");return!1}};return o.props={},o.props=new Proxy(o.props,s),o},_n=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...i)=>new Promise(a=>{i.forEach(p=>{St(p)||tn.notSerializableRefCall(t,p)}),n.send(new j(({ref:p,propName:d,functionArgs:c,makeSerializable:m})=>{if(p){let f=p[d];return m(typeof f=="function"?p[d](...c):f,!0)}return null},{elementId:e.refConfig.selector,propName:t,functionArgs:i},p=>{a(p.content)}))})},set(e,t,s){return n.send(new j(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:s,propName:t},i=>{})),!0}}),Et=async(o,n,e,t)=>{let s=o.component;if(!s)throw new Error("cant createRefComponent with detached ref");return new Promise(async(i,a)=>{let p=new Se(n.type,s,t);e.push(p),await s.initiated();let d=setTimeout(()=>{a("timeout")},5e3);s.send(new ye(o.refConfig,n,A(h({},t||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let m=e.find(f=>f.id==p.id);if(m!==p){s.refs[o.refConfig.name]=m,i(m);return}else p.setInitiated(),s.refs[o.refConfig.name]=p;c.nestedRefs.forEach(f=>{let u=n.instance.resolvedNestedComponents.find(y=>y.type.id===f.componentDefinitionId).type,g=new Se(u,p);g.setInitiated(),p.refs[f.refName]=g,e.push(g)});try{await Tt(p,n,e,!0),s.setHeightBasedOnScrollHeight&&s.setHeightBasedOnScrollHeight(),i(p)}catch(f){a(f)}}))})},Tt=async(o,n,e,t=!1)=>{o.refs||(o.refs={});let s=Object.values(o.componentDefinition.refs).map(i=>new Promise(async(a,p)=>{var d;if(i.behavior.type==pe.component){if(t){a();return}let c=i.behavior.componentId;c||(c=i.behavior.instance.componentId);let m=(d=n.instance.resolvedNestedComponents)==null?void 0:d.find(u=>u.type.id===c);if(!m)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let f=N.create("",i,o);try{let u=await Et(f,m,e);o.refs[i.name]=u,a()}catch(u){p(u)}}else try{let c=N.create("",i,o);o.refs[i.name]=_n(c,o),a()}catch(c){}}));try{await Promise.all(s)}catch(i){throw i}};var fe=class extends L{constructor(e,t,s,i,a){super(e,s,a);this.componentConfig=e;this.container=s;this.IframeElement=i;r(this,"sizeMeta");r(this,"cleanupInspect");r(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new k(()=>window.document.documentElement.scrollHeight,t=>{this.IframeElement.style.height="".concat(t.content,"px"),e()}))});r(this,"observeSizeBasedOnDocumentElement",()=>this.send(new k(({send:t})=>{let{height:s,width:i}=document.documentElement.getBoundingClientRect(),a=new ResizeObserver(()=>{let{height:p,width:d}=document.documentElement.getBoundingClientRect();t({height:p,width:d})});return a.observe(document.documentElement),a.observe(document.body),{height:s,width:i}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px")})));r(this,"observeAutoSize",e=>{var kt,Ht,Dt,Bt,Lt,Pt,Ot;let t=this.IframeElement,s=t.contentDocument;if(!s)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(E,D,se)=>D!==void 0&&E<D?D:se!==void 0&&E>se?se:E,a=E=>{if(E===void 0)return;if(typeof E=="number")return E;let D=parseFloat(E);return isNaN(D)?void 0:D},p=a(e==null?void 0:e.minWidth),d=a(e==null?void 0:e.maxWidth),c=a(e==null?void 0:e.minHeight),m=a(e==null?void 0:e.maxHeight),f=(kt=e==null?void 0:e.loaderMinHeight)!=null?kt:50,u=((Ht=this.sizeMeta)==null?void 0:Ht.width)==="100%"?"100%":void 0,g=((Dt=this.sizeMeta)==null?void 0:Dt.height)==="100%"?"100%":void 0,y=(Lt=(Bt=e==null?void 0:e.explicitWidth)!=null?Bt:u)!=null?Lt:"100%",F=(Pt=e==null?void 0:e.explicitHeight)!=null?Pt:g,Te=y!==void 0,oe=F!==void 0,$=this.container.getBoundingClientRect(),v=$.width===0,R=$.height===0||$.height===f,O=(e!=null&&e.forceAutoSize||v)&&!Te,W=(e!=null&&e.forceAutoSize||R)&&!oe;if(!O&&!W){let E=typeof y=="number"?y:void 0,D=typeof F=="number"?F:void 0;return(E!==void 0||D!==void 0)&&((Ot=e==null?void 0:e.onSizeChange)==null||Ot.call(e,{width:E,height:D,autoSizingWidth:!1,autoSizingHeight:!1})),()=>{}}let at=()=>{var D;let E=t.contentDocument;if(E){W&&(t.style.height="0px"),O&&(t.style.width="0px");let se=Math.ceil(E.documentElement.scrollWidth),At=Math.ceil(E.documentElement.scrollHeight),Kt=i(se,p,d),zt=i(At,c,m);O&&(t.style.width="".concat(Kt,"px")),W&&(t.style.height="".concat(zt,"px"));let yn=O&&d!==void 0&&se>d,hn=W&&m!==void 0&&At>m;E.documentElement.style.overflowX=yn?"auto":"",E.documentElement.style.overflowY=hn?"auto":"",(D=e==null?void 0:e.onSizeChange)==null||D.call(e,{width:Kt,height:zt,autoSizingWidth:O,autoSizingHeight:W})}};at();let pt=new ResizeObserver(at);pt.observe(s.body),pt.observe(s.documentElement);let _t=new MutationObserver(at);return _t.observe(s.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{pt.disconnect(),_t.disconnect()}});r(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new k(()=>{let{height:t,width:s}=document.documentElement.getBoundingClientRect();return{height:t,width:s}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px"),e()}))});r(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new k(()=>{let s=0;return s++,s--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+s+"px"},t=>{this.IframeElement.style.height=t.content,e()}))});r(this,"send",e=>{var i,a;let t=h({},e);if(t.messageType===l.ExecuteComponentMethod)return this[t.method](),()=>{};t.direction=b.down;let s=super.send(t);return(a=(i=this.IframeElement)==null?void 0:i.contentWindow)==null||a.postMessage(t,"*"),s});r(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});t.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=le(this.id,"MyopIframeComponent",10,this.container,this.IframeElement,this.componentDefinition),()=>{this.cleanupInspect(),this.cleanupInspect=void 0})}hide(){this.IframeElement.style.opacity="0",this.IframeElement.style.position="absolute",this.IframeElement.style.pointerEvents="none",this.IframeElement.style.visibility="hidden"}show(){this.IframeElement.style.opacity="1",this.IframeElement.style.position="unset",this.IframeElement.style.pointerEvents="all",this.IframeElement.style.visibility="visible"}onMessageReceived(e){return e.messageType===l.In.MutationObserverMessage||e.messageType===l.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}};var U=class{constructor(){r(this,"appendChild",(n,e,t)=>{var s;if(t!=null&&t.relative){if(t.relative.direction==="before")return n.insertBefore(e,t.relative.child);if(t.relative.direction==="after"){let i=(s=t.relative.child)==null?void 0:s.nextSibling;return n.insertBefore(e,i||null)}}else return n.appendChild(e)})}};var kn=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},Ke=class extends U{constructor(){super(...arguments);r(this,"type",z.IframeLoader);r(this,"load",async(e,t,s,i)=>{let a,p=t.loader;if((s==null?void 0:s.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,s),a=s,a.src=p.url;else{let d=_(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let m="\n padding: 0;\n margin: 0;\n position: absolute;\n inset: 0;\n height: ".concat(p.autoHeight||!p.height?"100%":p.height,";\n width: 100%;\n overflow: hidden;\n border: none;\n opacity: ").concat(i!=null&&i.hidden?"0":"1",";\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\n ");a.style.cssText=m,i!=null&&i.elementAttributes&&Object.entries(i.elementAttributes).forEach(([u,g])=>{g===""||g===null||g===void 0?a.setAttribute(u,""):a.setAttribute(u,String(g))});let f=t.loader.url;i!=null&&i._hasParent&&(f=kn(f,"_myop-comp",d)),a.src=f,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),a=this.appendChild(s,a,i)}return new fe(e,t,s,a,i)})}};var ze={webcomponent_message_key:"myop_webcomponent_message"};var ue=class extends L{constructor(e,t,s,i,a){super(e,s,a);this.container=s;this.customElement=i;r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=h({},e),s=super.send(t),i=new CustomEvent(ze.webcomponent_message_key,{detail:t});try{this.customElement.dispatchEvent(i)}catch(a){console.log("error while trying to dispatchEvent",a)}return s});r(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i}inspect(){return this.cleanupInspect=le(this.id,"MyopWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}};var vt={},Fe=class extends U{constructor(){super(...arguments);r(this,"type",z.WebComponentLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;vt[a.url]?console.log("Module alreday loaded or in loading process"):vt[a.url]=new Promise((c,m)=>{let f=a.url,u=document.createElement("script");u.type="module",u.src=f,u.onload=()=>{c()},u.onerror=()=>{m()},document.head.appendChild(u)}),await vt[a.url],await Nt(1);let p="myop-comp-".concat(_()),d=document.createElement(a.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),i!=null&&i._environment&&(d._myopEnvironment=i==null?void 0:i._environment),this.appendChild(s,d,i),new ue(e,t,s,d,i)})}};var $e="0.3.19";var x=class extends ve{constructor(e,t){super(e);this.context=t;r(this,"executor",e=>{if(e.destination){let t=e.destination;if(this.context[t].context){let s=(i,a)=>{this.messageToHost(A(h({},i),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[t].context,s)}else debugger}else debugger})}};var We=class extends x{constructor(){super(...arguments);r(this,"messageType",l.BindClickMessage);r(this,"innerExecutor",(e,t,s)=>{let i=I(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=()=>{s(new V(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}};var Ne=class extends x{constructor(){super(...arguments);r(this,"messageType",l.ChangeTextMessage);r(this,"innerExecutor",(e,t)=>{I(e.ref,t.shadowRoot).forEach(i=>{i.textContent=e.content})})}};var Ue=class extends de{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}};var qe=class extends x{constructor(){super(...arguments);r(this,"innerExecutor",(e,t)=>{let s=t.shadowRoot.querySelectorAll("[".concat(T.id,"]")),i=[];s.forEach(a=>{let p=a.getAttribute(T.id);p&&i.push(new re(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new X(e.handlerUniqueId,i))});r(this,"messageType",l.DetectMyopRefsMessage)}};var Ve=class extends x{constructor(){super(...arguments);r(this,"messageType",l.SetAttributeMessage);r(this,"innerExecutor",(e,t)=>{I(e.ref,t.shadowRoot).forEach(i=>{i.setAttribute(e.name,e.value)})})}};var Ge=class extends x{constructor(){super(...arguments);r(this,"messageType",l.AddEventListenerMessage);r(this,"innerExecutor",(e,t,s)=>{let i=I(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=c=>{s(new Y(e.handlerUniqueId,H(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}};var je=class extends x{constructor(){super(...arguments);r(this,"messageType",l.CreateRefComponentMessage);r(this,"innerExecutor",(e,t,s)=>{(async()=>{let a=t.shadowRoot.querySelectorAll("[".concat(T.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=P.Instance(),d=p.components.find(u=>u.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let m=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),f=[];Object.keys(m.refs).forEach(u=>{let g=m.refs[u];g=g.__nonProxied||g,g.componentDefinition&&f.push({refName:u,componentDefinitionId:g.componentDefinition.id})}),s(new K(e.handlerUniqueId,f))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new K(e.handlerUniqueId,[],!0));debugger}})().then()})}};var Ye=class extends x{constructor(){super(...arguments);r(this,"messageType",l.ExecuteScriptMessage);r(this,"innerExecutor",(e,t,s)=>{Be(e,a=>{s(new G(e.handlerUniqueId,a))},t)})}};var rn=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(T.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:rn(i),required:i.required,validity:H(i.validity,!0),myopId:a};p?e.formData[p]?e.formData[p].value?e.unmappedData.push(d):(e.unmappedData.push(e.formData[p]),e.formData[p]=d):e.formData[p]=d:e.unmappedData.push(d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},Qe=class extends x{constructor(){super(...arguments);r(this,"messageType",l.GetElementValueMessage);r(this,"innerExecutor",(e,t,s)=>{I(e.ref,t.shadowRoot).forEach(a=>{s(new Q(rn(a)),e)})})}};var Je=class extends x{constructor(){super(...arguments);r(this,"messageType",l.SetInnerHtml);r(this,"innerExecutor",(e,t)=>{I(e.ref,t.shadowRoot).forEach(i=>{i.innerHTML=e.content})})}};var Ee=class extends ae{constructor(){super(...arguments);r(this,"alwaysPassEnvelopesToHost",!0);r(this,"connectedCallback",(e,t)=>{e.addEventListener(ze.webcomponent_message_key,s=>{let i=s.data?s.data:s.detail;if(!i||!i.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=i;if(this.handleIncomeMessages(s),a.messageType===l.InitMessage){let p=a.content.id;this.components[p].context=new Ue(e,t)}}}),setTimeout(()=>{this.messageToHost(new J)},1)});r(this,"messageToHost",(e,t)=>{e.direction=b.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)});r(this,"supportedHandlers",[new Ne(this.messageToHost,this.components),new Je(this.messageToHost,this.components),new We(this.messageToHost,this.components),new qe(this.messageToHost,this.components),new Ve(this.messageToHost,this.components),new Ge(this.messageToHost,this.components),new Ye(this.messageToHost,this.components),new Qe(this.messageToHost,this.components),new je(this.messageToHost,this.components)]);r(this,"init",()=>{})}};me("WebComponentSDK",Ee);var an="";var Hn="<!-- myop-web-component -->",Dn="myop-web-component",dn=new Set,cn=[],Xe,mn=async()=>(Xe||(Xe=new Ee,Xe.init()),Xe);function Bn(o,n){return class extends HTMLElement{connectedCallback(){let e=n===Z.open?"open":"closed",t=this.attachShadow({mode:e});mn().then(s=>{s.connectedCallback(this,t),t.innerHTML=o})}}}var Ln=(o,n,e)=>{customElements.define(o,Bn(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},Pn=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\d+)/g,"-$1").toLowerCase(),On=o=>(o=Pn(o),o.replace(/_/g,"-"));var Ze=class extends U{constructor(){super(...arguments);r(this,"type",z.HTMLLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;if(this.isMyopWebComponent(a.HTML))return this.loadExtractedWebComponent(e,t,s,a.HTML,i);let p="myop-comp-".concat(_()),d;if(a.shadowRootMode===Z.localFrame){let c=_(),m="myop-comp-".concat(c),f=document.createElement("iframe");f.id=m,f.style.cssText="\n display: block;\n padding: 0;\n margin: 0;\n position: absolute;\n inset: 0;\n overflow: hidden;\n border: none;\n opacity: ".concat(i!=null&&i.hidden?"0":"1",";\n width: 100%;\n height: 100%;\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\n "),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),f=this.appendChild(s,f,i);let u=f.contentDocument||f.contentWindow.document;u.open();let g=null;{let R=new DOMParser().parseFromString(a.HTML,"text/html").querySelector('meta[name="myop:size"]');if(R)try{g=JSON.parse(R.getAttribute("content")||"{}")}catch(O){}}let y=a.HTML;if(i!=null&&i._inspection){let v=new DOMParser().parseFromString(a.HTML,"text/html"),R=v.getElementById("myop_preview");R==null||R.removeAttribute("type");let O=v.implementation.createHTMLDocument();O.body.innerHTML="<script>\n const beforeKeysWindow = new Set(Object.keys(window));\n window.myopState = {\n beforeKeysWindow,\n };\n <\/script>";let W=O.body.firstChild;W&&v.head&&v.head.insertBefore(v.importNode(W,!0),v.head.firstChild),y=v.documentElement.outerHTML}else if((i==null?void 0:i.data)!==void 0){let v=new DOMParser().parseFromString(a.HTML,"text/html"),R=v.getElementById("myop_preview");R&&(R.remove(),y=v.documentElement.outerHTML)}u.writeln(y);let F='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\/script>'),Te="<script>\n window.__federation__.__public_path__ = window.__federation__.__public_path__;\n const __myop_init = async () => {\n const {IframeSDK} = (await window.myop.rootSDK.getIframeModule());\n const sdk = new IframeSDK();\n sdk.init();\n }\n __myop_init().then();\n <\/script>";if(u.writeln("".concat(F).concat(Te)),(i==null?void 0:i.data)!==void 0){let $="<script>\n window.__myop_cta_queue = [];\n window.myop_cta_handler = function(action, payload) {\n window.__myop_cta_queue.push({action: action, payload: payload});\n };\n <\/script>",v=JSON.stringify(i.data).replace(/<\/script/gi,"\\u003c/script"),R='<script id="__myop_init_data_script">\n (function() {\n var data = '.concat(v,";\n var scriptEl = document.getElementById('__myop_init_data_script');\n\n var callInitInterface = function(fn) {\n var startTime = performance.now();\n // Mark as pre-injected data call for extension tracking\n window.__myop_init_preinjected = true;\n try {\n fn(data);\n } finally {\n window.__myop_init_preinjected = false;\n }\n var duration = performance.now() - startTime;\n\n // Notify extension via postMessage (init* = pre-injected)\n try {\n window.parent.postMessage({\n type: 'MYOP_PREINJECTED_INIT',\n payload: {\n data: data,\n duration: duration,\n timestamp: Date.now()\n }\n }, '*');\n } catch (e) {}\n\n // Cleanup: remove script tag and stored data\n if (scriptEl && scriptEl.parentNode) {\n scriptEl.parentNode.removeChild(scriptEl);\n }\n delete window.__myop_init_data;\n };\n\n if (typeof window.myop_init_interface === 'function') {\n // Function already exists - call immediately\n callInitInterface(window.myop_init_interface);\n } else {\n // Function not yet defined - store data and watch for definition\n window.__myop_init_data = data;\n\n var _original;\n Object.defineProperty(window, 'myop_init_interface', {\n configurable: true,\n enumerable: true,\n set: function(fn) {\n _original = fn;\n if (window.__myop_init_data !== undefined) {\n var storedData = window.__myop_init_data;\n delete window.__myop_init_data;\n callInitInterface(fn);\n }\n },\n get: function() {\n return _original;\n }\n });\n }\n })();\n <\/script>");u.writeln($+R)}u.close();let oe=new fe(e,t,s,f,i);return oe.sizeMeta=g,a.autoHeight&&(f.onload=()=>{oe.observeSizeBasedOnDocumentElement()}),oe}if(a.shadowRootMode===Z.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,mn().then(m=>{m.connectedCallback(d,d)})}else{let c=On(e.name+t.id);cn.includes(c)||(Ln(c,a.HTML,a.shadowRootMode),cn.push(c)),d=document.createElement(c)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),this.appendChild(s,d,i),new ue(e,t,s,d,i)})}isMyopWebComponent(e){return e.trimStart().startsWith(Hn)}extractWebComponentScript(e){let i=new DOMParser().parseFromString(e,"text/html").getElementById(Dn);return(i==null?void 0:i.textContent)||null}executeWebComponentScript(e,t){if(dn.has(t)){console.log("[MyopWebComponent] Script already executed for ".concat(t,", skipping"));return}let s=document.createElement("script");s.textContent=e,s.id="myop-extracted-".concat(t),document.head.appendChild(s),dn.add(t),console.log("[MyopWebComponent] Executed web component script: ".concat(t))}async loadExtractedWebComponent(e,t,s,i,a){let p=this.extractWebComponentScript(i);if(!p)throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');let d="".concat(e.id,"-").concat(t.id),c=window.__MYOP_TAG_NAME__;this.executeWebComponentScript(p,d);let m=window.__MYOP_TAG_NAME__;if(!m)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");c&&c!==m&&console.warn("[MyopWebComponent] __MYOP_TAG_NAME__ changed from ".concat(c," to ").concat(m));let f="myop-comp-".concat(_()),u=document.createElement(m);u.id=f,a!=null&&a.hidden&&(u.style.opacity="0",u.style.position="absolute",u.style.height="0",u.style.width="0",u.style.pointerEvents="none",u.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,u,a);let g=new te(e,t,s,u,m,a);return(a==null?void 0:a.data)!==void 0&&g.initWithData(a.data),console.log("[MyopWebComponent] Loaded <".concat(m,"> into container")),g}};var An=o=>({instance:{id:"auto",componentId:o.componentId,componentName:o.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:o.id,name:o.name,description:o.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:ce.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:ce.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),et="__MYOP_CLOUD_REPOSITORY_MAIN__",Kn=()=>{if(typeof window<"u")return window[et];if(typeof globalThis<"u")return globalThis[et]},zn=o=>{typeof window<"u"&&(window[et]=o),typeof globalThis<"u"&&(globalThis[et]=o)},q=class q{constructor(n="https://cloud.myop.dev"){this._baseUrl=n;r(this,"variants",{});r(this,"preloadedComponents",{});r(this,"userFlows",{});r(this,"_defaultEnv","production");r(this,"_envExplicitlySet",!1)}static get Main(){let n=Kn();return n||(q._main||(q._main=new q,zn(q._main)),q._main)}setEnvironment(n){this._defaultEnv=n,this._envExplicitlySet=!0}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(n,e,t){return e!==void 0||t!==void 0?"".concat(n,":").concat(e||this._defaultEnv,":").concat(t?"preview":"live")in this.variants:n in this.preloadedComponents}getPreloadedParams(n){return this.preloadedComponents[n]}async fetchComponentV2(n,e,t){let s=this.preloadedComponents[n],i=e!==void 0||t!==void 0,a,p;if(!i&&s)a=s.env,p=s.preview;else{a=e||this._defaultEnv;let c=e||this._envExplicitlySet;p=t===!0?!0:t===!1?!1:!c}let d="".concat(n,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:n.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[n]||(this.preloadedComponents[n]={env:a,preview:p}),this.variants[d]=new Promise(async(c,m)=>{try{let f="".concat(this._baseUrl,"/consume?id=").concat(n,"&env=").concat(a);p&&(f+="&preview=true");let y=(await(await fetch(f)).json()).item;if(!y){m(new Error('Component "'.concat(n,'" not found')));return}if(!y.consume_variant||!y.consume_variant.length){m(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(a,'"')));return}let F=An(y);c(F)}catch(f){m(f)}})),await this.variants[d]}async fetchComponentV1(n,e){return e?(await this.fetchFlow(e)).components.find(s=>s.type.id===n):(await this.fetchAutoFlow(n)).components[0]}async fetchAutoFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&auto=true"))).json();e(i.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&resolve=components"))).json();e(i.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchComponent(n,e){return this.fetchComponentV1(n,e)}};r(q,"_main",null);var ne=q;var Fd=ne.Main;var ln=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[s,...i]=ct(t);switch(s){case"component":{let[a,p]=i,d=await ne.Main.fetchComponent(a);if(d&&d.type.skins.find(m=>m.id===p))return d.instance.skinSelector={type:ee.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=ct(t),c=(await ne.Main.fetchFlow(a)).components.find(m=>m.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ee.Segmented&&c.instance.resolvedExperiences){let m=c.instance.resolvedExperiences.find(f=>f.id===p);if((m==null?void 0:m.type)===_e.Segment){let f=m,g=c.instance.skinSelector.segments.find(y=>y.segmentId===f.segment.id);if(g)return c.instance.skinSelector=g==null?void 0:g.skinSelector,c}}}break}}}finally{return null}};var fn="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",P=class{constructor(){r(this,"components2init",[]);r(this,"components",[]);r(this,"componentsLoaders",[]);r(this,"initiated",!1);r(this,"version",$e);r(this,"type2InstanceCount",{});r(this,"assignId",n=>(this.type2InstanceCount[n.id]||(this.type2InstanceCount[n.id]=0),"".concat(n.id,"_").concat(++this.type2InstanceCount[n.id])));r(this,"inspected",!1);r(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(n=>{n.inspect&&n.inspect()}))});r(this,"incomingMessageHandler",n=>{if(n.origin,document.location.origin,n.data.myop){if(n.data.direction!==b.up&&n.data.messageType!==l.EnvelopedMessage)return;let e=n.data;if(e.messageType===l.InitRequest){this.components2init.forEach(s=>{s.send(new ie(s.id))});return}if(e.messageType===l.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==e.content.id);let s=this.components.find(i=>{var a;return i.id===((a=e.content)==null?void 0:a.id)});s==null||s.setInitiated();return}if(e.messageType===l.EnvelopedMessage){let s=e,i=this.components.find(a=>a.id===s.destination);if(i){if(s.direction===b.down){s.message.messageType===B.name?i.onMessageReceived(s.message):(s.message.route=s.route,i.send(s.message));return}}else{let a=this.components.find(p=>p.id===s.message.destination);a&&a.send(s.message)}return}let t=this.components.find(s=>s.id===e.destination);if(!t){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e);return}if(t){if(t.onMessageReceived(e))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e)}}});r(this,"send",n=>{let e=new MessageEvent("",{data:n});this.incomingMessageHandler(e)});r(this,"init",n=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new Ke,new Fe,new Ze];if(this.componentsLoaders=[...e],n){let t={};n.forEach(s=>{let i=new s(this.componentsLoaders);t[i.type]=i}),this.componentsLoaders.forEach(s=>{t[s.type]||(t[s.type]=s)}),this.componentsLoaders=Object.values(t)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});r(this,"_getSkinIdBySkinSelector",async(n,e=[],t)=>{var i;async function s(a,p){for(let d of a)if(await p(d))return d}switch(n.type){case"DedicatedSkin":case ee.Dedicated:return((i=n.skin)==null?void 0:i.id)||n.skins[0].id;case ee.Segmented:{let p=await s(n.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(g=>g.type===_e.Segment?g.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let f=c.segment,u=(t||{})[f.function];return u?await u():(console.warn("segmentId:".concat(d.segmentId,", ").concat(f.function," function not provided !")),!1)});if(p)return this._getSkinIdBySkinSelector(p.skinSelector,e);debugger}break;default:debugger}return""});r(this,"runSkinSelector",async(n,e)=>{let t=await this._getSkinIdBySkinSelector(n.instance.skinSelector,n.instance.resolvedExperiences,e);return n.type.skins.find(s=>s.id===t)});r(this,"loaderHooks");r(this,"loadComponent",async(n,e,t)=>{var m,f,u,g;if(!e){debugger;throw new Error("no container was found for this component")}let s=await ln(n);s&&(n=s);let i=h(h({},(m=this.loaderHooks)!=null?m:{}),(f=t==null?void 0:t.hooks)!=null?f:{}),a=e;if(a.myop)if(a.component){n=h({},n),n.instance=h({},n.instance);let y=await this.runSkinSelector(n,i);if(!y)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(u=t==null?void 0:t.hooks)!=null&&u.afterSkinSelected&&(y=await t.hooks.afterSkinSelected(h({},y))),n.instance.skinSelector={type:ee.Dedicated,skin:y},t&&(t=h({},t),delete t.hooks),await Et(a,n,this.components,t)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(n,i);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(g=t==null?void 0:t.hooks)!=null&&g.afterSkinSelected&&(p=await t.hooks.afterSkinSelected(h({},p)));let d=this.componentsLoaders.find(y=>y.type===p.loader.type);if(!d){debugger;throw new Error('no loader "'.concat(p.loader.type,'" was found for component'))}let c=await d.load(n.type,p,e,t);c.isInitiated||this.components2init.push(c),c.bind("onDispose",()=>(this.components=this.components.filter(y=>y!==c),this.components2init=this.components2init.filter(y=>y!==c),!0)),this.components.push(c),(!t||t.connectProps!==!1)&&(c=sn(c,n.type.props,p));try{await Tt(c,n,this.components)}catch(y){throw y}return t!=null&&t.skipInit||await c.initiated(),c});r(this,"navigate",async(n,e,t)=>{if(n.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(t!=null&&t.staged){let s=await this.loadComponent(e,n.container,h({hidden:!0,relative:{direction:"after",child:n.element}},t));return t.init&&await t.init(s),s.show(),n.dispose(),s}else{let s=n.element.nextSibling;return n.dispose(),this.loadComponent(e,n.container,h({relative:{direction:"before",child:s}},t))}})}};r(P,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:fn});if(!window.myop.hostSDK){let o=new P;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:fn}),window.myop.hostSDK=o}var Fn=window.myop.hostSDK;me("hostSDK",Fn);var tt=class extends M{constructor(){super(...arguments);r(this,"messageType",l.CreateRefComponentMessage);r(this,"executor",e=>{(async()=>{let s=document.querySelectorAll("[".concat(T.id,"='").concat(e.refConfig.selector,"']"));if(s.length===1){let a=await P.Instance().loadComponent(e.nestedComponentConfig,s.item(0),e.options),p=[];Object.keys(a.refs).forEach(d=>{let c=a.refs[d];c=c.__nonProxied||c,c.componentDefinition&&p.push({refName:d,componentDefinitionId:c.componentDefinition.id})}),this.messageToHost(new K(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new K(e.handlerUniqueId,[],!0));debugger}})().then()})}};var un=(o,n)=>{if(!o){console.log("n");return}let e=window.MutationObserver||window.WebKitMutationObserver;if(!(!o||o.nodeType!==1))if(e){let t=new e(n),s={attributes:!0,childList:!0,subtree:!0};return t.observe(o,s),t}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",n,!1),o.addEventListener("DOMNodeRemoved",n,!1))};var nt=class extends M{constructor(){super(...arguments);r(this,"messageType",l.SetMutationObserverMessage);r(this,"executor",e=>{e.source&&un(document.body,()=>{this.messageToHost(new Ce)})})}};var gn=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(T.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:gn(i),required:i.required,validity:H(i.validity,!0),myopId:a};e.unmappedData.push(d),p&&(!e.formData[p]||!e.formData[p].value||d.value)&&(e.formData[p]=d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},ot=class extends M{constructor(){super(...arguments);r(this,"messageType",l.GetElementValueMessage);r(this,"executor",e=>{I(e.ref,document).forEach(s=>{this.messageToHost(new Q(gn(s)),e)})})}};var st=class extends M{constructor(){super(...arguments);r(this,"messageType",l.GetAttributeMessage);r(this,"executor",e=>{let t=Zt(e.ref,document);t&&this.messageToHost(new Me(t.getAttribute(e.name)),e)})}};var rt=class extends M{constructor(){super(...arguments);r(this,"messageType",l.SetResizeObserverMessage);r(this,"executor",e=>{let t=new ResizeObserver(s=>{this.messageToHost(new we)});return t.observe(document.body),()=>{t.disconnect()}})}};var it=class extends M{constructor(){super(...arguments);r(this,"messageType",l.SetInnerHtml);r(this,"executor",e=>{I(e.ref,document).forEach(s=>{s.innerHTML=e.content})})}};var Rt=class extends ae{constructor(){super();r(this,"version",$e);r(this,"messageToHost",(e,t)=>{var i;!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId);let s=Object.keys(this.components);e.destination||(t!=null&&t.route?e.destination=t.route[t.route.length-1]:e.destination=s[0]),e.source||(e.source=s[0]),e.direction=b.up,(i=window.parent)==null||i.postMessage(h({},e),"*")});r(this,"supportedHandlers",[new De(this.messageToHost),new it(this.messageToHost),new He(this.messageToHost),new ke(this.messageToHost),new Le(this.messageToHost),new Oe(this.messageToHost),new Ae(this.messageToHost),new ot(this.messageToHost),new nt(this.messageToHost),new rt(this.messageToHost),new st(this.messageToHost),new tt(this.messageToHost)]);r(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new J)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};me("IframeSDK",Rt);export{Rt as IframeSDK};
|
|
@@ -1585,6 +1585,7 @@ var MyopIframeComponent = class extends BaseMyopComponent {
|
|
|
1585
1585
|
this.componentConfig = componentConfig;
|
|
1586
1586
|
this.container = container;
|
|
1587
1587
|
this.IframeElement = IframeElement;
|
|
1588
|
+
__publicField(this, "sizeMeta");
|
|
1588
1589
|
__publicField(this, "cleanupInspect");
|
|
1589
1590
|
__publicField(this, "setHeightBasedOnDocumentElement", () => {
|
|
1590
1591
|
const cleanupHandler = this.send(new ExecuteScriptMessage(() => {
|
|
@@ -1617,7 +1618,7 @@ var MyopIframeComponent = class extends BaseMyopComponent {
|
|
|
1617
1618
|
* @returns Cleanup function to stop observing
|
|
1618
1619
|
*/
|
|
1619
1620
|
__publicField(this, "observeAutoSize", (options) => {
|
|
1620
|
-
var _a;
|
|
1621
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1621
1622
|
const iframe = this.IframeElement;
|
|
1622
1623
|
const doc = iframe.contentDocument;
|
|
1623
1624
|
if (!doc) {
|
|
@@ -1641,14 +1642,28 @@ var MyopIframeComponent = class extends BaseMyopComponent {
|
|
|
1641
1642
|
const minHeight = parseSize(options == null ? void 0 : options.minHeight);
|
|
1642
1643
|
const maxHeight = parseSize(options == null ? void 0 : options.maxHeight);
|
|
1643
1644
|
const loaderMinHeight = (_a = options == null ? void 0 : options.loaderMinHeight) != null ? _a : 50;
|
|
1644
|
-
const
|
|
1645
|
-
const
|
|
1645
|
+
const sizeMetaFillWidth = ((_b = this.sizeMeta) == null ? void 0 : _b.width) === "100%" ? "100%" : void 0;
|
|
1646
|
+
const sizeMetaFillHeight = ((_c = this.sizeMeta) == null ? void 0 : _c.height) === "100%" ? "100%" : void 0;
|
|
1647
|
+
const resolvedExplicitWidth = (_e = (_d = options == null ? void 0 : options.explicitWidth) != null ? _d : sizeMetaFillWidth) != null ? _e : "100%";
|
|
1648
|
+
const resolvedExplicitHeight = (_f = options == null ? void 0 : options.explicitHeight) != null ? _f : sizeMetaFillHeight;
|
|
1649
|
+
const hasExplicitWidth = resolvedExplicitWidth !== void 0;
|
|
1650
|
+
const hasExplicitHeight = resolvedExplicitHeight !== void 0;
|
|
1646
1651
|
const containerRect = this.container.getBoundingClientRect();
|
|
1647
1652
|
const collapsedWidth = containerRect.width === 0;
|
|
1648
1653
|
const collapsedHeight = containerRect.height === 0 || containerRect.height === loaderMinHeight;
|
|
1649
1654
|
const shouldAutoWidth = (options == null ? void 0 : options.forceAutoSize) ? !hasExplicitWidth : collapsedWidth && !hasExplicitWidth;
|
|
1650
1655
|
const shouldAutoHeight = (options == null ? void 0 : options.forceAutoSize) ? !hasExplicitHeight : collapsedHeight && !hasExplicitHeight;
|
|
1651
1656
|
if (!shouldAutoWidth && !shouldAutoHeight) {
|
|
1657
|
+
const explicitWidthPx = typeof resolvedExplicitWidth === "number" ? resolvedExplicitWidth : void 0;
|
|
1658
|
+
const explicitHeightPx = typeof resolvedExplicitHeight === "number" ? resolvedExplicitHeight : void 0;
|
|
1659
|
+
if (explicitWidthPx !== void 0 || explicitHeightPx !== void 0) {
|
|
1660
|
+
(_g = options == null ? void 0 : options.onSizeChange) == null ? void 0 : _g.call(options, {
|
|
1661
|
+
width: explicitWidthPx,
|
|
1662
|
+
height: explicitHeightPx,
|
|
1663
|
+
autoSizingWidth: false,
|
|
1664
|
+
autoSizingHeight: false
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1652
1667
|
return () => {
|
|
1653
1668
|
};
|
|
1654
1669
|
}
|
|
@@ -1656,9 +1671,14 @@ var MyopIframeComponent = class extends BaseMyopComponent {
|
|
|
1656
1671
|
var _a2;
|
|
1657
1672
|
const contentDoc = iframe.contentDocument;
|
|
1658
1673
|
if (contentDoc) {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1674
|
+
if (shouldAutoHeight) {
|
|
1675
|
+
iframe.style.height = "0px";
|
|
1676
|
+
}
|
|
1677
|
+
if (shouldAutoWidth) {
|
|
1678
|
+
iframe.style.width = "0px";
|
|
1679
|
+
}
|
|
1680
|
+
const contentWidth = Math.ceil(contentDoc.documentElement.scrollWidth);
|
|
1681
|
+
const contentHeight = Math.ceil(contentDoc.documentElement.scrollHeight);
|
|
1662
1682
|
const width = clamp(contentWidth, minWidth, maxWidth);
|
|
1663
1683
|
const height = clamp(contentHeight, minHeight, maxHeight);
|
|
1664
1684
|
if (shouldAutoWidth) {
|
|
@@ -1669,8 +1689,8 @@ var MyopIframeComponent = class extends BaseMyopComponent {
|
|
|
1669
1689
|
}
|
|
1670
1690
|
const isWidthConstrained = shouldAutoWidth && maxWidth !== void 0 && contentWidth > maxWidth;
|
|
1671
1691
|
const isHeightConstrained = shouldAutoHeight && maxHeight !== void 0 && contentHeight > maxHeight;
|
|
1672
|
-
contentDoc.documentElement.style.overflowX = isWidthConstrained ? "auto" : "
|
|
1673
|
-
contentDoc.documentElement.style.overflowY = isHeightConstrained ? "auto" : "
|
|
1692
|
+
contentDoc.documentElement.style.overflowX = isWidthConstrained ? "auto" : "";
|
|
1693
|
+
contentDoc.documentElement.style.overflowY = isHeightConstrained ? "auto" : "";
|
|
1674
1694
|
(_a2 = options == null ? void 0 : options.onSizeChange) == null ? void 0 : _a2.call(options, {
|
|
1675
1695
|
width,
|
|
1676
1696
|
height,
|
|
@@ -1683,8 +1703,11 @@ var MyopIframeComponent = class extends BaseMyopComponent {
|
|
|
1683
1703
|
const resizeObserver = new ResizeObserver(updateSize);
|
|
1684
1704
|
resizeObserver.observe(doc.body);
|
|
1685
1705
|
resizeObserver.observe(doc.documentElement);
|
|
1706
|
+
const mutationObserver = new MutationObserver(updateSize);
|
|
1707
|
+
mutationObserver.observe(doc.body, { childList: true, subtree: true, characterData: true, attributes: true });
|
|
1686
1708
|
return () => {
|
|
1687
1709
|
resizeObserver.disconnect();
|
|
1710
|
+
mutationObserver.disconnect();
|
|
1688
1711
|
};
|
|
1689
1712
|
});
|
|
1690
1713
|
__publicField(this, "setSizeBasedOnDocumentElement", () => {
|
|
@@ -1951,7 +1974,7 @@ var WebcomponentLoader = class extends BaseMyopLoader {
|
|
|
1951
1974
|
};
|
|
1952
1975
|
|
|
1953
1976
|
// version:myop-sdk-version
|
|
1954
|
-
var myop_sdk_version_default = "0.3.
|
|
1977
|
+
var myop_sdk_version_default = "0.3.19";
|
|
1955
1978
|
|
|
1956
1979
|
// src/webcomponent/messageHandlers/BaseWebComponentMessageHandler.ts
|
|
1957
1980
|
var BaseWebComponentMessageHandler = class extends BaseContextMessageHandler {
|
|
@@ -2338,6 +2361,18 @@ var HTMLComponentLoader = class extends BaseMyopLoader {
|
|
|
2338
2361
|
IframeElement = this.appendChild(container, IframeElement, options);
|
|
2339
2362
|
const doc = IframeElement.contentDocument || IframeElement.contentWindow.document;
|
|
2340
2363
|
doc.open();
|
|
2364
|
+
let parsedSizeMeta = null;
|
|
2365
|
+
{
|
|
2366
|
+
const _preParser = new DOMParser();
|
|
2367
|
+
const _preDoc = _preParser.parseFromString(loaderConfig.HTML, "text/html");
|
|
2368
|
+
const sizeMeta = _preDoc.querySelector('meta[name="myop:size"]');
|
|
2369
|
+
if (sizeMeta) {
|
|
2370
|
+
try {
|
|
2371
|
+
parsedSizeMeta = JSON.parse(sizeMeta.getAttribute("content") || "{}");
|
|
2372
|
+
} catch (e) {
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2341
2376
|
let HTML2Render = loaderConfig.HTML;
|
|
2342
2377
|
if (options == null ? void 0 : options._inspection) {
|
|
2343
2378
|
const parser = new DOMParser();
|
|
@@ -2372,6 +2407,7 @@ var HTMLComponentLoader = class extends BaseMyopLoader {
|
|
|
2372
2407
|
}
|
|
2373
2408
|
doc.close();
|
|
2374
2409
|
const comp = new MyopIframeComponent(componentDefinition, skin, container, IframeElement, options);
|
|
2410
|
+
comp.sizeMeta = parsedSizeMeta;
|
|
2375
2411
|
if (loaderConfig.autoHeight) {
|
|
2376
2412
|
IframeElement.onload = () => {
|
|
2377
2413
|
comp.observeSizeBasedOnDocumentElement();
|
|
@@ -2569,6 +2605,7 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2569
2605
|
// v1 cache
|
|
2570
2606
|
__publicField(this, "userFlows", {});
|
|
2571
2607
|
__publicField(this, "_defaultEnv", "production");
|
|
2608
|
+
__publicField(this, "_envExplicitlySet", false);
|
|
2572
2609
|
}
|
|
2573
2610
|
static get Main() {
|
|
2574
2611
|
const globalMain = getGlobalMain();
|
|
@@ -2586,6 +2623,7 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2586
2623
|
*/
|
|
2587
2624
|
setEnvironment(env) {
|
|
2588
2625
|
this._defaultEnv = env;
|
|
2626
|
+
this._envExplicitlySet = true;
|
|
2589
2627
|
}
|
|
2590
2628
|
/**
|
|
2591
2629
|
* Get the current default environment
|
|
@@ -2626,7 +2664,8 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2626
2664
|
usePreview = preloaded.preview;
|
|
2627
2665
|
} else {
|
|
2628
2666
|
env = environmentIdentifier || this._defaultEnv;
|
|
2629
|
-
|
|
2667
|
+
const hasEffectiveEnv = environmentIdentifier || this._envExplicitlySet;
|
|
2668
|
+
usePreview = preview === true ? true : preview === false ? false : !hasEffectiveEnv;
|
|
2630
2669
|
}
|
|
2631
2670
|
const cacheKey = "".concat(componentId, ":").concat(env, ":").concat(usePreview ? "preview" : "live");
|
|
2632
2671
|
console.log("[CloudRepository] fetchComponentV2", {
|
|
@@ -2729,6 +2768,9 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2729
2768
|
__publicField(_CloudRepository, "_main", null);
|
|
2730
2769
|
var CloudRepository = _CloudRepository;
|
|
2731
2770
|
|
|
2771
|
+
// src/helpers/cloudRepositoryHelpers.ts
|
|
2772
|
+
var _cloudRepository = CloudRepository.Main;
|
|
2773
|
+
|
|
2732
2774
|
// src/host/myopOverride.ts
|
|
2733
2775
|
var checkMyopOverride = async (componentConfig) => {
|
|
2734
2776
|
try {
|
|
@@ -3144,10 +3186,10 @@ var observeDOM = (obj, callback) => {
|
|
|
3144
3186
|
console.log("n");
|
|
3145
3187
|
return;
|
|
3146
3188
|
}
|
|
3147
|
-
let
|
|
3189
|
+
let MutationObserver2 = window.MutationObserver || window.WebKitMutationObserver;
|
|
3148
3190
|
if (!obj || obj.nodeType !== 1) return;
|
|
3149
|
-
if (
|
|
3150
|
-
const mutationObserver = new
|
|
3191
|
+
if (MutationObserver2) {
|
|
3192
|
+
const mutationObserver = new MutationObserver2(callback);
|
|
3151
3193
|
const config = { attributes: true, childList: true, subtree: true };
|
|
3152
3194
|
mutationObserver.observe(obj, config);
|
|
3153
3195
|
return mutationObserver;
|