@myop/react 0.0.31 → 0.0.33

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/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import { jsx as S, jsxs as Lt } from "react/jsx-runtime";
2
- import { useRef as O, useEffect as oe, useState as ie, useCallback as Pe } from "react";
3
- const Ot = `"use strict";var MyopSDK=(()=>{var ze=Object.defineProperty,ds=Object.defineProperties,cs=Object.getOwnPropertyDescriptor,ms=Object.getOwnPropertyDescriptors,ls=Object.getOwnPropertyNames,gn=Object.getOwnPropertySymbols;var un=Object.prototype.hasOwnProperty,fs=Object.prototype.propertyIsEnumerable;var Dt=(o,t,e)=>t in o?ze(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,h=(o,t)=>{for(var e in t||(t={}))un.call(t,e)&&Dt(o,e,t[e]);if(gn)for(var e of gn(t))fs.call(t,e)&&Dt(o,e,t[e]);return o},N=(o,t)=>ds(o,ms(t));var m=(o,t)=>()=>(o&&(t=o(o=0)),t);var ee=(o,t)=>{for(var e in t)ze(o,e,{get:t[e],enumerable:!0})},gs=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ls(t))!un.call(o,r)&&r!==e&&ze(o,r,{get:()=>t[r],enumerable:!(n=cs(t,r))||n.enumerable});return o};var us=o=>gs(ze({},"__esModule",{value:!0}),o);var s=(o,t,e)=>Dt(o,typeof t!="symbol"?t+"":t,e);var $e,Ue,Bt,z,te=m(()=>{"use strict";$e="__federation__",Ue="onLoad",Bt="moduleInstance",z=(o,t)=>{window[$e]&&window[$e][o]&&window[$e][o][Ue]&&window[$e][o][Ue]({[o]:t})}});var ue,Ne=m(()=>{ue="0.3.13"});var l,I=m(()=>{"use strict";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 T,ys,hs,Lt,Ot=m(()=>{"use strict";T=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),ys=o=>{let t=[...o].map(e=>e.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join("-")},hs=o=>{let t=o.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";let e=atob(t);return Uint8Array.from(e,n=>n.charCodeAt(0))},Lt=o=>{let t=hs(o);if(t.length%16!==0)throw new Error("Invalid input length");let e=[];for(let n=0;n<t.length;n+=16)e.push(ys(t.slice(n,n+16)));return e}});var hn,ne=m(()=>{"use strict";Ot();hn=o=>new Promise(t=>setTimeout(t,o))});var R,C,Pt,v,_,G,k=m(()=>{"use strict";ne();R=class{};s(R,"down","down"),s(R,"up","up");C=class{constructor(){s(this,"id",T());s(this,"myop",!0);s(this,"content");s(this,"source");s(this,"destination");s(this,"route");s(this,"ref");s(this,"direction");s(this,"cleanable",!1)}static create(...t){return new this(...t)}isTypeof(t){return t.messageType===this.messageType}},Pt=class extends C{constructor(e){super();this.ref=e}},v=class extends C{constructor(e){super();this.replayToHandler=e}},_=class extends C{constructor(e){super();this.handler=e;s(this,"handlerUniqueId",T())}},G=class o{constructor(t,e){this.refConfig=t;this.component=e;s(this,"myop",!0);s(this,"__nonProxied");this.__nonProxied=N(h({},this),{component:null})}static create(t,e,n){let r=e;return r||(r={id:"",name:"",description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}}),new o(r,n)}}});var Mn,Kt,oe,In=m(()=>{"use strict";k();Mn="ClickReplayMessage",Kt=class extends _{constructor(e,n){super(n);this.ref=e;s(this,"replyMessageKey",Mn);s(this,"messageType","BindClickMessage");s(this,"cleanable",!0)}},oe=class extends v{constructor(){super(...arguments);s(this,"messageType",Mn)}}});var At,Cn=m(()=>{"use strict";k();At=class extends C{constructor(e,n){super();this.ref=e;s(this,"messageType","ChangeTextMessage");this.content=n}}});var xn,Ms,Is,wn,D,se,Ft=m(()=>{"use strict";k();xn="ExecuteScriptReplyMessage",Ms=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,Is=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,wn=o=>{let t=o.match(Ms);if(t)return t[1]||t[3];{let e=o.match(Is);if(e)return e[1].trim()}},D=class extends _{constructor(e,n=()=>{},r){super(n);this.scriptInputs=r;s(this,"replyMessageKey",xn);s(this,"messageType","ExecuteScriptMessage");s(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=wn(this.content)}};s(D,"replierKey","send"),s(D,"completeStreamKey","completeStream");se=class extends v{constructor(e,n){super(e);this.replayToHandler=e;this.content=n;s(this,"messageType",xn)}}});var W,bn=m(()=>{"use strict";Ft();W=class extends D{constructor(e,n,r=()=>{}){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},r);this.scriptInputs=n;this.scriptInputs=N(h({},n),{_script:e.toString()})}}});var Sn,zt,re,Tn=m(()=>{"use strict";k();Sn="EventListenerCallbackMessage",zt=class extends _{constructor(e,n,r){super(r);this.ref=e;this.type=n;this.handler=r;s(this,"replyMessageKey",Sn);s(this,"messageType","AddEventListenerMessage");s(this,"cleanable",!0);s(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},re=class extends v{constructor(e,n){super(e);this.replayToHandler=e;this.e=n;s(this,"messageType",Sn);this.content={e:n}}}});var $t,En=m(()=>{"use strict";k();$t=class extends C{constructor(e,n,r){super();this.ref=e;this.name=n;this.value=r;s(this,"messageType","SetAttributeMessage")}}});var Rn,Ut,ie,Nt=m(()=>{"use strict";k();Rn="ElementValueReplayMessage",Ut=class extends _{constructor(e,n){super(n);this.ref=e;s(this,"replyMessageKey",Rn);s(this,"messageType","GetElementValueMessage")}},ie=class extends v{constructor(e){super();this.content=e;s(this,"messageType",Rn)}}});var Wt,vn=m(()=>{"use strict";k();Wt=class extends C{constructor(e,n){super();this.ref=e;s(this,"messageType","SetInnerHtml");this.content=n}}});var ye,Re,ae,_n=m(()=>{"use strict";k();ye=class extends C{constructor(e){super();s(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},Re=class extends ye{constructor(){super(...arguments);s(this,"messageType","InitResponse")}},ae=class extends C{constructor(){super(...arguments);s(this,"messageType","InitRequest")}}});var kn,ve,V,We=m(()=>{"use strict";k();kn="RefComponentCreatedMessage",ve=class extends _{constructor(e,n,r,i){super(i);this.refConfig=e;this.nestedComponentConfig=n;this.options=r;s(this,"replyMessageKey",kn);s(this,"messageType","CreateRefComponentMessage")}},V=class extends v{constructor(e,n,r){super(e);this.replayToHandler=e;this.nestedRefs=n;this.failed=r;s(this,"messageType",kn)}}});var _e,Vt=m(()=>{"use strict";k();_e=class extends C{constructor(e,n){super();this.destination=e;this.message=n;s(this,"messageType","EnvelopedMessage");let r=n;this.route=[e,...r.route?r.route:[]]}}});var Hn,qt,pe,Dn=m(()=>{"use strict";k();Hn="DetectedMyopRefsMessage",qt=class extends _{constructor(){super(...arguments);s(this,"messageType","DetectMyopRefsMessage");s(this,"replyMessageKey",Hn)}},pe=class extends v{constructor(e,n){super(e);this.replayToHandler=e;s(this,"messageType",Hn);this.content=n}isTypeof(e){return e.messageType===this.messageType}}});var Bn,jt,ke,Ln=m(()=>{"use strict";k();Bn="GetAttributeReplayMessage",jt=class extends _{constructor(e,n,r){super(r);this.ref=e;this.name=n;s(this,"replyMessageKey",Bn);s(this,"messageType","GetAttributeMessage")}},ke=class extends v{constructor(e){super();this.content=e;s(this,"messageType",Bn)}}});var K,On=m(()=>{"use strict";k();K=class extends C{constructor(e){super();this.method=e;s(this,"messageType","ExecuteComponentMethod")}}});var Gt,He,Pn=m(()=>{"use strict";k();Gt=class extends C{constructor(){super(...arguments);s(this,"messageType","SetMutationObserverMessage")}},He=class extends C{constructor(){super(...arguments);s(this,"messageType","MutationObserverMessage")}}});var Kn,De,Be,An=m(()=>{"use strict";k();Kn="CleanupReplayMessage",De=class extends _{constructor(e,n){super(n);this.cleanupForMessageId=e;s(this,"replyMessageKey",Kn);s(this,"messageType","CleanupMessage")}},Be=class extends v{constructor(e){super();this.customCleanup=e;s(this,"messageType",Kn)}}});var Le,Fn=m(()=>{"use strict";k();Le=class extends C{constructor(){super(...arguments);s(this,"messageType","DisposeMessage")}}});var Jt,Oe,zn=m(()=>{"use strict";k();Jt=class extends C{constructor(){super(...arguments);s(this,"cleanable",!0);s(this,"messageType","SetResizeObserverMessage")}},Oe=class extends C{constructor(){super(...arguments);s(this,"messageType","ResizeObserverMessage")}}});var he={};ee(he,{AddEventListenerMessage:()=>zt,BaseMyopMessage:()=>C,BindClickMessage:()=>Kt,ChangeTextMessage:()=>At,CleanupMessage:()=>De,CleanupReplayMessage:()=>Be,ClickReplayMessage:()=>oe,CreateRefComponentMessage:()=>ve,CustomRefMessage:()=>W,DetectMyopRefsMessage:()=>qt,DetectedMyopRefsMessage:()=>pe,DisposeMessage:()=>Le,ElementValueReplayMessage:()=>ie,EnvelopedMessage:()=>_e,EventListenerCallbackMessage:()=>re,ExecuteComponentMethod:()=>K,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>se,GetAttributeMessage:()=>jt,GetAttributeReplayMessage:()=>ke,GetElementValueMessage:()=>Ut,InitMessage:()=>ye,InitRequest:()=>ae,InitResponse:()=>Re,MessageDirection:()=>R,MutationObserverMessage:()=>He,MyopBindMessage:()=>_,MyopBindReplayMessage:()=>v,MyopElementMessage:()=>Pt,Ref:()=>G,RefComponentCreatedMessage:()=>V,ResizeObserverMessage:()=>Oe,SetAttributeMessage:()=>$t,SetInnerHtml:()=>Wt,SetMutationObserverMessage:()=>Gt,SetResizeObserverMessage:()=>Jt,stripFunction:()=>wn});var w=m(()=>{"use strict";k();In();Cn();Ft();bn();Tn();En();Nt();vn();_n();We();Vt();Dn();Nt();Ln();On();Pn();An();Fn();zn()});var J,Ve=m(()=>{"use strict";I();w();Pe();J=class{constructor(t,e,n){this.componentDefinition=t;this.container=e;s(this,"id","");s(this,"messageHandlers",{});s(this,"element");s(this,"_markedForDisposed",!1);s(this,"bind",(t,e)=>{this.messageHandlers[t]||(this.messageHandlers[t]=[]),this.messageHandlers[t].includes(e)||this.messageHandlers[t].push(e)});s(this,"bindWhen",(t,e,n)=>{if(!n)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[t]||(this.messageHandlers[t]=[]);let r=this.messageHandlers[t],i=a=>e(a)?(n(a),!0):!1;return r.push(i),()=>{let a=r.indexOf(i);a>-1&&r.splice(a,1)}});s(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});s(this,"isInitiated",!1);s(this,"_whenInitiatedResolve");s(this,"_whenInitiatedReject");s(this,"_whenInitiated",new Promise((t,e)=>{this._whenInitiatedResolve=t,this._whenInitiatedReject=e}));s(this,"initiated",()=>this._whenInitiated);s(this,"props",{});s(this,"refs",{});this.id=(n==null?void 0:n.id)||F.Instance().assignId(t);let r=n!=null&&n.timeout?n==null?void 0:n.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject("timeout_".concat(r," ").concat(this.id))},r),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(t){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=t}onMessageReceived(t){if(t.messageType===l.ExecuteComponentMethod){let n=t;return this[n.method]?this[n.method](n.content):console.log("method not found ".concat(n.method," on component"),this),!0}let e=this.messageHandlers[t.messageType];if(e&&e.length){let n=!1;return e.forEach(r=>{n=n||r(t)}),n}return!1}sendCleanupMessage(t){t.source=this.id,t.destination=this.id,t.direction=R.down;let e=this.bindWhen(t.replyMessageKey,r=>r.replayToHandler===t.handlerUniqueId,r=>{t.handler(r),e()}),n=t.handler;delete t.handler,this.send(t),t.handler=n}send(t){t.source||(t.source=this.id),t.destination||(t.destination=this.id),t.direction=R.down;let e;if(t.handler){let n=t;e=this.bindWhen(n.replyMessageKey,r=>r.replayToHandler===n.handlerUniqueId,n.handler),delete t.handler}return t.ref&&(t.ref=t.ref.__nonProxied||t.ref),t.cleanable?()=>{this.sendCleanupMessage(new De(t.id,n=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Le);let t=this.messageHandlers.onDispose;t&&t.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var Me,$n=m(()=>{"use strict";Me=class{constructor(t,e,n,r,i){this.myopId=t;this.htmlTagName=e;this.BoundingRect=n;this.offsetTop=r;this.offsetLeft=i;s(this,"type","MyopElementRef")}}});var Un,x,qe,Nn=m(()=>{"use strict";Un=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let t=await o;typeof t=="function"&&t()}},x=class{constructor(t){this.messageToHost=t}},qe=class extends x{constructor(e,n){super(e);this.messageToHost=e;this.context=n}}});var Yt,Ie,Wn=m(()=>{"use strict";I();b();w();Yt=class{constructor(t,e){this.id=t;this.context=e;s(this,"send",t=>{})}},Ie=class{constructor(){s(this,"messageToHandleAfterInit",[]);s(this,"components",{});s(this,"alwaysPassEnvelopesToHost",!1);s(this,"messageCleanupCache",{})}handleIncomeMessages(t){let e=t.data?t.data:t.detail;if(!(!e||!e.myop)){let n=e;if(n.direction!==R.down)return;if(n.messageType===l.DisposeMessage){n.destination&&delete this.components[n.destination];return}if(n.messageType===l.InitMessage){let r=n.content.id;if(this.components[r])return;this.components[r]=new Yt(r),this.messageToHost(new Re(r));return}if(n.messageType===l.EnvelopedMessage){let r=n,i=r.message;if(n=i,this.alwaysPassEnvelopesToHost||this.components[n.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===r.destination);if(p){p.send(i);return}}else return}if(n.messageType){if(n.messageType===l.CleanupMessage){let i=n,a=this.messageCleanupCache[i.cleanupForMessageId],p=new Be(!!a);p.destination=n.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],Un(a).then(()=>{this.messageToHost(p,i)}).catch(()=>{})):this.messageToHost(p,i);return}let r=!1;this.supportedHandlers.forEach(i=>{if(i.messageType===n.messageType){r=!0;let a=i.executor(n);if(n.cleanable&&a&&(this.messageCleanupCache[n.id]=a),a&&!n.cleanable)throw new Error("Cleanup handler generated for non-cleanable message. \\nmessageType - ".concat(n.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&&n.cleanable)throw new Error("No cleanup handler generated for a cleanable message. \\nmessageType - ".concat(n.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 q,de,we,Ce,ce,je,xe,b=m(()=>{"use strict";$n();Nn();Wn();q={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},de={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},we={message:"message",code:"code"},Ce=class{};s(Ce,"code","code"),s(Ce,"component","component");ce={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},je={Segment:"Segment",Promo:"Promo",AB:"AB"},xe=class{constructor(t,e){this.container=t;this.shadowRoot=e;s(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));s(this,"getRoot",()=>this.shadowRoot||this.container)}}});var Xt,Cs,Qt,P,me=m(()=>{"use strict";Xt=o=>o!==Object(o),Cs=o=>typeof o=="function",Qt=o=>{if(Xt(o))return!0;if(Cs(o)||Object.getPrototypeOf(o))return!1;for(let t in o){let e=o[t];if(typeof e=="object"){if(!Qt(e))return!1}else{if(Xt(e))continue;return!1}}return!0},P=(o,t={},e=!0,n=new WeakMap)=>{if(Xt(o))return o;if(Array.isArray(o)){if(n.has(o))return n.get(o);let r=[];n.set(o,r);for(let i=0;i<o.length;i++){let a=o[i];r[i]=P(a,t,e,n)}return r}if(o!==null&&typeof o=="object"){if(n.has(o))return n.get(o);let r={};n.set(o,r);for(let i in o){let a=typeof t=="boolean"?t:t[i];a&&(a===!0?(e?o[i]!==void 0:o[i])&&(r[i]=P(o[i],!0,e,n)):typeof a=="object"&&(r[i]=P(o[i],a,e,n)))}return r}return{}}});var Vn,qn=m(()=>{"use strict";Vn={notSerializableRefCall:(o,t)=>{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(t," \\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 Ke,jn=m(()=>{"use strict";Ve();w();Vt();Ke=class extends J{constructor(e,n,r){super(e,n.container,r);this.componentDefinition=e;this.parent=n;s(this,"send",e=>{let n=e.handler,r=super.send(e);return this.parent.send(new _e(this.id,e)),e.handler=n,r});s(this,"dispose",()=>{this.isInitiated&&this.send(new K("dispose")),super.dispose()})}hide(){this.send(new K("hide"))}show(){this.send(new K("show"))}inspect(){return this.send(new K("inspect"))}setHeightBasedOnDocumentElement(){this.send(new K("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new K("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var xs,Ge,Gn,Jn,Yn,ws,Zt,en,Je=m(()=>{"use strict";w();w();b();me();qn();jn();xs=(o,t,e)=>{let n=document.createElement("a");return n.textContent=o,n.style.position="relative",n.style.padding="0 5px",n.style.fontSize="14px",n.style.top="0",n.style.top="".concat(t,"px"),n.style.transform="translateX(-50%)",n.target="_blank",n.href="https://dashboard.myop.dev/dashboard/component/".concat(e.id),n},Ge=(o,t,e,n,r,i)=>{let a=xs("".concat(i.name," : ").concat(t),e,i);return n.insertBefore(a,r),r.style.border="1px solid #007BFF",r.style.display="block",()=>{r.style.border="unset",n.removeChild(a)}},Gn=(o,t,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(t,"\\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),Jn=(o,t,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(t,"\\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."))},Yn=(o,t,e)=>{let n=t.reduce((i,a)=>N(h({},i),{[a.name]:h({},a)}),{}),r={get:(i,a)=>{let p=n[a];if(Gn(p,a,o))return!1;if(p.behavior.type===we.code){if(e.loader.type===q.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return Jn(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(G.create(p.behavior.ref)),c.push(f=>{d(f)}),p.behavior.params&&c.push(...p.behavior.params);let g=he[p.behavior.message];o.send(new g(...c))}):null},set:(i,a,p)=>{let d=n[a];if(Gn(d,a,o))return!1;if(d.behavior.type===we.code){if(e.loader.type===q.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let g=d.behavior,f=o.element.contentWindow,u=g.remap||a;if(f[u]=p,u==="myop_cta_handler"&&f.__myop_cta_queue){let y=f.__myop_cta_queue;f.__myop_cta_queue=null,y.forEach(M=>{o.markedForDisposed||p(M.action,M.payload)})}return!0}return Jn(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(G.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let g=he[d.behavior.message];return o.send(new g(...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,r),o},ws=(o,t)=>new Proxy(o,{get(e,n){return e[n]?e[n]:(...i)=>new Promise(a=>{i.forEach(p=>{Qt(p)||Vn.notSerializableRefCall(n,p)}),t.send(new W(({ref:p,propName:d,functionArgs:c,makeSerializable:g})=>{if(p){let f=p[d];return g(typeof f=="function"?p[d](...c):f,!0)}return null},{elementId:e.refConfig.selector,propName:n,functionArgs:i},p=>{a(p.content)}))})},set(e,n,r){return t.send(new W(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:r,propName:n},i=>{})),!0}}),Zt=async(o,t,e,n)=>{let r=o.component;if(!r)throw new Error("cant createRefComponent with detached ref");return new Promise(async(i,a)=>{let p=new Ke(t.type,r,n);e.push(p),await r.initiated();let d=setTimeout(()=>{a("timeout")},5e3);r.send(new ve(o.refConfig,t,N(h({},n||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let g=e.find(f=>f.id==p.id);if(g!==p){r.refs[o.refConfig.name]=g,i(g);return}else p.setInitiated(),r.refs[o.refConfig.name]=p;c.nestedRefs.forEach(f=>{let u=t.instance.resolvedNestedComponents.find(M=>M.type.id===f.componentDefinitionId).type,y=new Ke(u,p);y.setInitiated(),p.refs[f.refName]=y,e.push(y)});try{await en(p,t,e,!0),r.setHeightBasedOnScrollHeight&&r.setHeightBasedOnScrollHeight(),i(p)}catch(f){a(f)}}))})},en=async(o,t,e,n=!1)=>{o.refs||(o.refs={});let r=Object.values(o.componentDefinition.refs).map(i=>new Promise(async(a,p)=>{var d;if(i.behavior.type==Ce.component){if(n){a();return}let c=i.behavior.componentId;c||(c=i.behavior.instance.componentId);let g=(d=t.instance.resolvedNestedComponents)==null?void 0:d.find(u=>u.type.id===c);if(!g)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let f=G.create("",i,o);try{let u=await Zt(f,g,e);o.refs[i.name]=u,a()}catch(u){p(u)}}else try{let c=G.create("",i,o);o.refs[i.name]=ws(c,o),a()}catch(c){}}));try{await Promise.all(r)}catch(i){throw i}}});var be,tn=m(()=>{"use strict";Ve();w();Je();I();be=class extends J{constructor(e,n,r,i,a){super(e,r,a);this.componentConfig=e;this.container=r;this.IframeElement=i;s(this,"cleanupInspect");s(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new D(()=>window.document.documentElement.scrollHeight,n=>{this.IframeElement.style.height="".concat(n.content,"px"),e()}))});s(this,"observeSizeBasedOnDocumentElement",()=>this.send(new D(({send:n})=>{let{height:r,width:i}=document.documentElement.getBoundingClientRect(),a=new ResizeObserver(()=>{let{height:p,width:d}=document.documentElement.getBoundingClientRect();n({height:p,width:d})});return a.observe(document.documentElement),a.observe(document.body),{height:r,width:i}},n=>{this.IframeElement.style.width="".concat(n.content.width,"px"),this.IframeElement.style.height="".concat(n.content.height,"px")})));s(this,"observeAutoSize",e=>{var Ee;let n=this.IframeElement,r=n.contentDocument;if(!r)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(O,U,ge)=>U!==void 0&&O<U?U:ge!==void 0&&O>ge?ge:O,a=O=>{if(O===void 0)return;if(typeof O=="number")return O;let U=parseFloat(O);return isNaN(U)?void 0:U},p=a(e==null?void 0:e.minWidth),d=a(e==null?void 0:e.maxWidth),c=a(e==null?void 0:e.minHeight),g=a(e==null?void 0:e.maxHeight),f=(Ee=e==null?void 0:e.loaderMinHeight)!=null?Ee:50,u=(e==null?void 0:e.explicitWidth)!==void 0,y=(e==null?void 0:e.explicitHeight)!==void 0,M=this.container.getBoundingClientRect(),le=M.width===0,Fe=M.height===0||M.height===f,j=(e!=null&&e.forceAutoSize||le)&&!u,H=(e!=null&&e.forceAutoSize||Fe)&&!y;if(!j&&!H)return()=>{};let A=()=>{var U;let O=n.contentDocument;if(O){let ge=O.documentElement.getBoundingClientRect(),cn=Math.ceil(ge.width),mn=Math.ceil(ge.height),ln=i(cn,p,d),fn=i(mn,c,g);j&&(n.style.width="".concat(ln,"px")),H&&(n.style.height="".concat(fn,"px"));let as=j&&d!==void 0&&cn>d,ps=H&&g!==void 0&&mn>g;O.documentElement.style.overflowX=as?"auto":"hidden",O.documentElement.style.overflowY=ps?"auto":"hidden",(U=e==null?void 0:e.onSizeChange)==null||U.call(e,{width:ln,height:fn,autoSizingWidth:j,autoSizingHeight:H})}};A();let fe=new ResizeObserver(A);return fe.observe(r.body),fe.observe(r.documentElement),()=>{fe.disconnect()}});s(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new D(()=>{let{height:n,width:r}=document.documentElement.getBoundingClientRect();return{height:n,width:r}},n=>{this.IframeElement.style.width="".concat(n.content.width,"px"),this.IframeElement.style.height="".concat(n.content.height,"px"),e()}))});s(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new D(()=>{let r=0;return r++,r--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+r+"px"},n=>{this.IframeElement.style.height=n.content,e()}))});s(this,"send",e=>{var i,a;let n=h({},e);if(n.messageType===l.ExecuteComponentMethod)return this[n.method](),()=>{};n.direction=R.down;let r=super.send(n);return(a=(i=this.IframeElement)==null?void 0:i.contentWindow)==null||a.postMessage(n,"*"),r});s(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});n.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=Ge(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 Y,Ye=m(()=>{"use strict";Y=class{constructor(){s(this,"appendChild",(t,e,n)=>{var r;if(n!=null&&n.relative){if(n.relative.direction==="before")return t.insertBefore(e,n.relative.child);if(n.relative.direction==="after"){let i=(r=n.relative.child)==null?void 0:r.nextSibling;return t.insertBefore(e,i||null)}}else return t.appendChild(e)})}}});var bs,Xe,Xn=m(()=>{"use strict";tn();Ye();ne();b();bs=(o,t,e)=>{let n=new URL(o);return n.searchParams.append(t,e),n.toString()},Xe=class extends Y{constructor(){super(...arguments);s(this,"type",q.IframeLoader);s(this,"load",async(e,n,r,i)=>{let a,p=n.loader;if((r==null?void 0:r.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,r),a=r,a.src=p.url;else{let d=T(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let g="\\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=g,i!=null&&i.elementAttributes&&Object.entries(i.elementAttributes).forEach(([u,y])=>{y===""||y===null||y===void 0?a.setAttribute(u,""):a.setAttribute(u,String(y))});let f=n.loader.url;i!=null&&i._hasParent&&(f=bs(f,"_myop-comp",d)),a.src=f,r.querySelector('[id^="myop-comp-"]')||(r.innerHTML=""),a=this.appendChild(r,a,i)}return new be(e,n,r,a,i)})}}});var Qe,nn=m(()=>{"use strict";Qe={webcomponent_message_key:"myop_webcomponent_message"}});var Se,on=m(()=>{"use strict";nn();Ve();Je();Se=class extends J{constructor(e,n,r,i,a){super(e,r,a);this.container=r;this.customElement=i;s(this,"cleanupInspect",()=>{});s(this,"send",e=>{let n=h({},e),r=super.send(n),i=new CustomEvent(Qe.webcomponent_message_key,{detail:n});try{this.customElement.dispatchEvent(i)}catch(a){console.log("error while trying to dispatchEvent",a)}return r});s(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i}inspect(){return this.cleanupInspect=Ge(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 sn,Ze,Qn=m(()=>{"use strict";on();Ye();ne();b();sn={},Ze=class extends Y{constructor(){super(...arguments);s(this,"type",q.WebComponentLoader);s(this,"load",async(e,n,r,i)=>{let a=n.loader;sn[a.url]?console.log("Module alreday loaded or in loading process"):sn[a.url]=new Promise((c,g)=>{let f=a.url,u=document.createElement("script");u.type="module",u.src=f,u.onload=()=>{c()},u.onerror=()=>{g()},document.head.appendChild(u)}),await sn[a.url],await hn(1);let p="myop-comp-".concat(T()),d=document.createElement(a.tag);return r.querySelector('[id^="myop-comp-"]')||(r.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(r,d,i),new Se(e,n,r,d,i)})}}});var E,$=m(()=>{"use strict";b();E=class extends qe{constructor(e,n){super(e);this.context=n;s(this,"executor",e=>{if(e.destination){let n=e.destination;if(this.context[n].context){let r=(i,a)=>{this.messageToHost(N(h({},i),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[n].context,r)}else debugger}else debugger})}}});var B,X=m(()=>{"use strict";B={id:"myop-id"}});var S,Zn,L=m(()=>{"use strict";X();S=(o,t)=>t.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),Zn=(o,t)=>{let e=S(o,t);return e.length?e.item(0):null}});var et,eo=m(()=>{"use strict";I();w();$();L();et=class extends E{constructor(){super(...arguments);s(this,"messageType",l.BindClickMessage);s(this,"innerExecutor",(e,n,r)=>{let i=S(e.ref,n.shadowRoot),a=[];return i.forEach(p=>{let d=()=>{r(new oe(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var tt,to=m(()=>{"use strict";I();$();L();tt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.ChangeTextMessage);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.textContent=e.content})})}}});var nt,no=m(()=>{"use strict";b();nt=class extends xe{constructor(e,n){super(e,n);this.container=e;this.shadowRoot=n}}});var ot,oo=m(()=>{"use strict";b();X();$();w();I();ot=class extends E{constructor(){super(...arguments);s(this,"innerExecutor",(e,n)=>{let r=n.shadowRoot.querySelectorAll("[".concat(B.id,"]")),i=[];r.forEach(a=>{let p=a.getAttribute(B.id);p&&i.push(new Me(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new pe(e.handlerUniqueId,i))});s(this,"messageType",l.DetectMyopRefsMessage)}}});var st,so=m(()=>{"use strict";I();$();L();st=class extends E{constructor(){super(...arguments);s(this,"messageType",l.SetAttributeMessage);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.setAttribute(e.name,e.value)})})}}});var rt,ro=m(()=>{"use strict";I();w();$();L();me();rt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.AddEventListenerMessage);s(this,"innerExecutor",(e,n,r)=>{let i=S(e.ref,n.shadowRoot),a=[];return i.forEach(p=>{let d=c=>{r(new re(e.handlerUniqueId,P(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var it,io=m(()=>{"use strict";I();X();Pe();We();$();it=class extends E{constructor(){super(...arguments);s(this,"messageType",l.CreateRefComponentMessage);s(this,"innerExecutor",(e,n,r)=>{(async()=>{let a=n.shadowRoot.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=F.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 g=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),f=[];Object.keys(g.refs).forEach(u=>{let y=g.refs[u];y=y.__nonProxied||y,y.componentDefinition&&f.push({refName:u,componentDefinitionId:y.componentDefinition.id})}),r(new V(e.handlerUniqueId,f))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var at,rn=m(()=>{"use strict";me();at=(o,t,e)=>{let n=o.scriptInputs?o.scriptInputs:{};n.makeSerializable=P,n.send=t,n.rootRef=e,n.__scriptInputs=n;let i=new Function("return (".concat(o.script,")(...arguments)"))(n);t(i)}});var pt,ao=m(()=>{"use strict";I();w();$();rn();pt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.ExecuteScriptMessage);s(this,"innerExecutor",(e,n,r)=>{at(e,a=>{r(new se(e.handlerUniqueId,a))},n)})}}});var po,dt,co=m(()=>{"use strict";I();w();$();L();X();me();po=o=>{if(!o)return null;if(o.tagName==="FORM"){let t=new FormData(o),e={formData:{},unmappedData:[]},n=o.querySelectorAll("input, select, textarea"),r=-1;return n.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:po(i),required:i.required,validity:P(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},dt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.GetElementValueMessage);s(this,"innerExecutor",(e,n,r)=>{S(e.ref,n.shadowRoot).forEach(a=>{r(new ie(po(a)),e)})})}}});var ct,mo=m(()=>{"use strict";I();$();L();ct=class extends E{constructor(){super(...arguments);s(this,"messageType",l.SetInnerHtml);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.innerHTML=e.content})})}}});var lo={};ee(lo,{WebComponentSDK:()=>Te});var Te,an=m(()=>{"use strict";b();I();nn();eo();to();no();oo();te();w();so();ro();io();ao();co();mo();Te=class extends Ie{constructor(){super(...arguments);s(this,"alwaysPassEnvelopesToHost",!0);s(this,"connectedCallback",(e,n)=>{e.addEventListener(Qe.webcomponent_message_key,r=>{let i=r.data?r.data:r.detail;if(!i||!i.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=i;if(this.handleIncomeMessages(r),a.messageType===l.InitMessage){let p=a.content.id;this.components[p].context=new nt(e,n)}}}),setTimeout(()=>{this.messageToHost(new ae)},1)});s(this,"messageToHost",(e,n)=>{e.direction=R.up,!e.replayToHandler&&(n!=null&&n.handlerUniqueId)&&(e.replayToHandler=n.handlerUniqueId),window.myop.hostSDK.send(e)});s(this,"supportedHandlers",[new tt(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new et(this.messageToHost,this.components),new ot(this.messageToHost,this.components),new st(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new pt(this.messageToHost,this.components),new dt(this.messageToHost,this.components),new it(this.messageToHost,this.components)]);s(this,"init",()=>{})}};z("WebComponentSDK",Te)});var fo=m(()=>{"use strict";an()});var go,uo=m(()=>{"use strict";go=""});function Ss(o,t){return class extends HTMLElement{connectedCallback(){let e=t===de.open?"open":"closed",n=this.attachShadow({mode:e});Mo().then(r=>{r.connectedCallback(this,n),n.innerHTML=o})}}}var ho,mt,Mo,Ts,Es,Rs,lt,Io=m(()=>{"use strict";on();Ye();ne();b();fo();tn();uo();ho=[],Mo=async()=>(mt||(mt=new Te,mt.init()),mt);Ts=(o,t,e)=>{customElements.define(o,Ss(t,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},Es=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),Rs=o=>(o=Es(o),o.replace(/_/g,"-")),lt=class extends Y{constructor(){super(...arguments);s(this,"type",q.HTMLLoader);s(this,"load",async(e,n,r,i)=>{let a=n.loader,p="myop-comp-".concat(T()),d;if(a.shadowRootMode===de.localFrame){let c=T(),g="myop-comp-".concat(c),f=document.createElement("iframe");f.id=g,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 "),r.querySelector('[id^="myop-comp-"]')||(r.innerHTML=""),f=this.appendChild(r,f,i);let u=f.contentDocument||f.contentWindow.document;u.open();let y=a.HTML;if(i!=null&&i._inspection){let H=new DOMParser().parseFromString(a.HTML,"text/html"),A=H.getElementById("myop_preview");A==null||A.removeAttribute("type");let fe=H.implementation.createHTMLDocument();fe.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let Ee=fe.body.firstChild;Ee&&H.head&&H.head.insertBefore(H.importNode(Ee,!0),H.head.firstChild),y=H.documentElement.outerHTML}else{let H=new DOMParser().parseFromString(a.HTML,"text/html"),A=H.getElementById("myop_preview");A&&(A.remove(),y=H.documentElement.outerHTML)}u.writeln(y);let M='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),le="<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(M).concat(le)),(i==null?void 0:i.data)!==void 0){let j="<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>",H=JSON.stringify(i.data).replace(/<\\/script/gi,"\\\\u003c/script"),A='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(H,";\\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(j+A)}u.close();let Fe=new be(e,n,r,f,i);return a.autoHeight&&(f.onload=()=>{Fe.observeSizeBasedOnDocumentElement()}),Fe}if(a.shadowRootMode===de.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,Mo().then(g=>{g.connectedCallback(d,d)})}else{let c=Rs(e.name+n.id);ho.includes(c)||(Ts(c,a.HTML,a.shadowRootMode),ho.push(c)),d=document.createElement(c)}return r.querySelector('[id^="myop-comp-"]')||(r.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(r,d,i),new Se(e,n,r,d,i)})}}});var Co,xo,wo=m(()=>{"use strict";ne();w();Co=(o,t,e)=>{let n="myop-css-".concat(T());return o.send(new D(({rootRef:r,_stylesheet:i,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let g in i){c+="".concat(g," { ");let f=i[g];for(let u in f)c+="".concat(u,": ").concat(f[u],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(r.shadowRoot||r.container).appendChild(d)},()=>{},{_stylesheet:t,_css:e||"",_tagId:n})),()=>{o.send(new D(({rootRef:r,_tagId:i})=>{let a=(r.shadowRoot||document).getElementById(i);a&&a.remove()},()=>{},{_tagId:n}))}},xo=(o,t)=>{let e="myop-css-".concat(T());return o.send(new D(({rootRef:n,_tagId:r,_link:i})=>{let a=document.createElement("link");a.id=r,a.rel="stylesheet",a.href=i,document.head.appendChild(a),(n.shadowRoot||n.container).appendChild(a)},()=>{},{_link:t,_tagId:e})),()=>{o.send(new D(({rootRef:n,_tagId:r})=>{let i=(n.shadowRoot||document).getElementById(r);i&&i.remove()},()=>{},{_tagId:e}))}}});var vs,pn,bo,So=m(()=>{"use strict";vs=(o,t)=>{let e=new RegExp(Object.keys(t).join("|"),"g");return o.replace(e,n=>(t[n]||n).toString())},pn=(o,t)=>{let e=o.loader;if(e.type!=="IframeLoader")throw new Error('iframeSkinUrlTokenizer received skin with loader type "'.concat(e.type,'", currently only "IframeLoader" is supported'));return o.loader=h({},o.loader),o.loader.url=vs(o.loader.url,t),o},bo=o=>async t=>pn(t,o)});var To,Eo,Ro=m(()=>{"use strict";w();To=(o,t,e)=>{o.send(new W(({ref:n,_className:r})=>{n==null||n.classList.add(r)},{elementId:e,_className:t}))},Eo=(o,t,e)=>{o.send(new W(({ref:n,_className:r})=>{n==null||n.classList.remove(r)},{elementId:e,_className:t}))}});var ut,ft,yt,gt,vo=m(()=>{"use strict";ne();ut=class ut{constructor(){s(this,"_runTimeInstanceId","runtime-instance-id-"+T());s(this,"_runTimeId","runtime-id-"+T());s(this,"_runTimeName","runtime-name-"+T());s(this,"id",this._runTimeId);s(this,"name",this._runTimeName);s(this,"description","");s(this,"loader",null);s(this,"withLoader",t=>(this.loader=t,this));s(this,"withHTMLLoader",t=>(t.type="HTMLLoader",this.loader=t,this));s(this,"build",()=>this)}};s(ut,"create",()=>new ut);ft=ut,yt=class yt{constructor(){s(this,"_runTimeInstanceId","runtime-instance-id-"+T());s(this,"_runTimeId","runtime-id-"+T());s(this,"_runTimeName","runtime-name-"+T());s(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});s(this,"name",this._runTimeName);s(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});s(this,"withInstance",t=>(this.instance=t,this));s(this,"withType",t=>(this.type=t,this));s(this,"withName",t=>(this.name=t,this));s(this,"withDefaultSkin",t=>(this.type.skins.push(t),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:t.id}},this));s(this,"withRef",t=>(this.type.refs.push(t),this));s(this,"withBasicRef",t=>{let e={id:"",name:t,description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}};return this.type.refs.push(e),this});s(this,"build",()=>JSON.parse(JSON.stringify(this)))}};s(yt,"create",()=>new yt);gt=yt});var _s,ht,ks,Hs,Q,Z,_o,ko=m(()=>{"use strict";b();_s=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:we.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:we.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),ht="__MYOP_CLOUD_REPOSITORY_MAIN__",ks=()=>{if(typeof window<"u")return window[ht];if(typeof globalThis<"u")return globalThis[ht]},Hs=o=>{typeof window<"u"&&(window[ht]=o),typeof globalThis<"u"&&(globalThis[ht]=o)},Q=class Q{constructor(t="https://cloud.myop.dev"){this._baseUrl=t;s(this,"variants",{});s(this,"preloadedComponents",{});s(this,"userFlows",{});s(this,"_defaultEnv","production")}static get Main(){let t=ks();return t||(Q._main||(Q._main=new Q,Hs(Q._main)),Q._main)}setEnvironment(t){this._defaultEnv=t}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,e,n){return e!==void 0||n!==void 0?"".concat(t,":").concat(e||this._defaultEnv,":").concat(n?"preview":"live")in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}async fetchComponentV2(t,e,n){let r=this.preloadedComponents[t],i=e!==void 0||n!==void 0,a,p;!i&&r?(a=r.env,p=r.preview):(a=e||this._defaultEnv,p=n===!0?!0:n===!1?!1:!e);let d="".concat(t,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:a,preview:p}),this.variants[d]=new Promise(async(c,g)=>{try{let f="".concat(this._baseUrl,"/consume?id=").concat(t,"&env=").concat(a);p&&(f+="&preview=true");let M=(await(await fetch(f)).json()).item;if(!M){g(new Error('Component "'.concat(t,'" not found')));return}if(!M.consume_variant||!M.consume_variant.length){g(new Error('Component "'.concat(t,'" has no implementation for environment "').concat(a,'"')));return}let le=_s(M);c(le)}catch(f){g(f)}})),await this.variants[d]}async fetchComponentV1(t,e){return e?(await this.fetchFlow(e)).components.find(r=>r.type.id===t):(await this.fetchAutoFlow(t)).components[0]}async fetchAutoFlow(t){return this.userFlows[t]||(this.userFlows[t]=new Promise(async(e,n)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(t,"&auto=true"))).json();e(i.item)}catch(r){n(r)}})),await this.userFlows[t]}async fetchFlow(t){return this.userFlows[t]||(this.userFlows[t]=new Promise(async(e,n)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(t,"&resolve=components"))).json();e(i.item)}catch(r){n(r)}})),await this.userFlows[t]}async fetchComponent(t,e){return this.fetchComponentV1(t,e)}};s(Q,"_main",null);Z=Q,_o=Z});var Ho,Do=m(()=>{"use strict";Ho=async o=>await o()});var dn={};ee(dn,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ft,addClass:()=>To,applyStylesheet:()=>Co,applyStylesheetLink:()=>xo,changeSkinUrlByTokenizer:()=>bo,createIframeSkinByTokenizer:()=>pn,exec:()=>Ho,removeClass:()=>Eo,v2_CloudRepository:()=>_o});var Mt=m(()=>{"use strict";wo();So();Ro();vo();ko();Do()});var Bo,Lo=m(()=>{"use strict";Ot();Mt();b();Bo=async o=>{try{let t=new URL(window.location.href),n=new URLSearchParams(t.search).get("myopOverride");if(n){let[r,...i]=Lt(n);switch(r){case"component":{let[a,p]=i,d=await Z.Main.fetchComponent(a);if(d&&d.type.skins.find(g=>g.id===p))return d.instance.skinSelector={type:ce.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=Lt(n),c=(await Z.Main.fetchFlow(a)).components.find(g=>g.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ce.Segmented&&c.instance.resolvedExperiences){let g=c.instance.resolvedExperiences.find(f=>f.id===p);if((g==null?void 0:g.type)===je.Segment){let f=g,y=c.instance.skinSelector.segments.find(M=>M.segmentId===f.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var Ko={};ee(Ko,{HostSDK:()=>F,hostSDK:()=>Po});var Oo,F,Po,Pe=m(()=>{"use strict";te();I();w();Xn();Qn();Je();b();Ne();Io();Lo();Oo="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",F=class{constructor(){s(this,"components2init",[]);s(this,"components",[]);s(this,"componentsLoaders",[]);s(this,"initiated",!1);s(this,"version",ue);s(this,"type2InstanceCount",{});s(this,"assignId",t=>(this.type2InstanceCount[t.id]||(this.type2InstanceCount[t.id]=0),"".concat(t.id,"_").concat(++this.type2InstanceCount[t.id])));s(this,"inspected",!1);s(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(t=>{t.inspect&&t.inspect()}))});s(this,"incomingMessageHandler",t=>{if(t.origin,document.location.origin,t.data.myop){if(t.data.direction!==R.up&&t.data.messageType!==l.EnvelopedMessage)return;let e=t.data;if(e.messageType===l.InitRequest){this.components2init.forEach(r=>{r.send(new ye(r.id))});return}if(e.messageType===l.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==e.content.id);let r=this.components.find(i=>{var a;return i.id===((a=e.content)==null?void 0:a.id)});r==null||r.setInitiated();return}if(e.messageType===l.EnvelopedMessage){let r=e,i=this.components.find(a=>a.id===r.destination);if(i){if(r.direction===R.down){r.message.messageType===K.name?i.onMessageReceived(r.message):(r.message.route=r.route,i.send(r.message));return}}else{let a=this.components.find(p=>p.id===r.message.destination);a&&a.send(r.message)}return}let n=this.components.find(r=>r.id===e.destination);if(!n){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e);return}if(n){if(n.onMessageReceived(e))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e)}}});s(this,"send",t=>{let e=new MessageEvent("",{data:t});this.incomingMessageHandler(e)});s(this,"init",t=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new Xe,new Ze,new lt];if(this.componentsLoaders=[...e],t){let n={};t.forEach(r=>{let i=new r(this.componentsLoaders);n[i.type]=i}),this.componentsLoaders.forEach(r=>{n[r.type]||(n[r.type]=r)}),this.componentsLoaders=Object.values(n)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});s(this,"_getSkinIdBySkinSelector",async(t,e=[],n)=>{var i;async function r(a,p){for(let d of a)if(await p(d))return d}switch(t.type){case"DedicatedSkin":case ce.Dedicated:return((i=t.skin)==null?void 0:i.id)||t.skins[0].id;case ce.Segmented:{let p=await r(t.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===je.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let f=c.segment,u=(n||{})[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""});s(this,"runSkinSelector",async(t,e)=>{let n=await this._getSkinIdBySkinSelector(t.instance.skinSelector,t.instance.resolvedExperiences,e);return t.type.skins.find(r=>r.id===n)});s(this,"loaderHooks");s(this,"loadComponent",async(t,e,n)=>{var g,f,u,y;if(!e){debugger;throw new Error("no container was found for this component")}let r=await Bo(t);r&&(t=r);let i=h(h({},(g=this.loaderHooks)!=null?g:{}),(f=n==null?void 0:n.hooks)!=null?f:{}),a=e;if(a.myop)if(a.component){t=h({},t),t.instance=h({},t.instance);let M=await this.runSkinSelector(t,i);if(!M)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(u=n==null?void 0:n.hooks)!=null&&u.afterSkinSelected&&(M=await n.hooks.afterSkinSelected(h({},M))),t.instance.skinSelector={type:ce.Dedicated,skin:M},n&&(n=h({},n),delete n.hooks),await Zt(a,t,this.components,n)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(t,i);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(y=n==null?void 0:n.hooks)!=null&&y.afterSkinSelected&&(p=await n.hooks.afterSkinSelected(h({},p)));let d=this.componentsLoaders.find(M=>M.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(t.type,p,e,n);c.isInitiated||this.components2init.push(c),c.bind("onDispose",()=>(this.components=this.components.filter(M=>M!==c),this.components2init=this.components2init.filter(M=>M!==c),!0)),this.components.push(c),(!n||n.connectProps!==!1)&&(c=Yn(c,t.type.props,p));try{await en(c,t,this.components)}catch(M){throw M}return n!=null&&n.skipInit||await c.initiated(),c});s(this,"navigate",async(t,e,n)=>{if(t.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(n!=null&&n.staged){let r=await this.loadComponent(e,t.container,h({hidden:!0,relative:{direction:"after",child:t.element}},n));return n.init&&await n.init(r),r.show(),t.dispose(),r}else{let r=t.element.nextSibling;return t.dispose(),this.loadComponent(e,t.container,h({relative:{direction:"before",child:r}},n))}})}};s(F,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Oo});if(!window.myop.hostSDK){let o=new F;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Oo}),window.myop.hostSDK=o}Po=window.myop.hostSDK;z("hostSDK",Po)});var It,Ao=m(()=>{"use strict";I();X();b();w();It=class extends x{constructor(){super(...arguments);s(this,"messageType",l.DetectMyopRefsMessage);s(this,"executor",e=>{let n=document.querySelectorAll("[".concat(B.id,"]")),r=[];n.forEach(i=>{let a=i.getAttribute(B.id);a&&r.push(new Me(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new pe(e.handlerUniqueId,r))})}}});var Ct,Fo=m(()=>{"use strict";I();b();w();L();Ct=class extends x{constructor(){super(...arguments);s(this,"messageType",l.BindClickMessage);s(this,"executor",e=>{let n=[];return S(e.ref,document).forEach(i=>{let a=()=>{this.messageToHost(new oe,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};n.push(p)}),()=>{n.forEach(i=>i())}})}}});var xt,zo=m(()=>{"use strict";I();b();L();xt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.ChangeTextMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.textContent=e.content})})}}});var wt,$o=m(()=>{"use strict";I();w();b();rn();wt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.ExecuteScriptMessage);s(this,"executor",e=>{at(e,r=>{this.messageToHost(new se(e.handlerUniqueId,r))},new xe(document.documentElement))})}}});var bt,Uo=m(()=>{"use strict";I();b();w();me();L();bt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.AddEventListenerMessage);s(this,"executor",e=>{let n=S(e.ref,document),r=[];return n.forEach(i=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new re(e.handlerUniqueId,P(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),r.push(()=>{i.removeEventListener(e.type,a)})}),()=>{r.forEach(i=>{i()})}})}}});var St,No=m(()=>{"use strict";I();b();L();St=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetAttributeMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.setAttribute(e.name,e.value)})})}}});var Tt,Wo=m(()=>{"use strict";I();X();b();Pe();We();Tt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.CreateRefComponentMessage);s(this,"executor",e=>{(async()=>{let r=document.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(r.length===1){let a=await F.Instance().loadComponent(e.nestedComponentConfig,r.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 V(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var Vo,qo=m(()=>{"use strict";Vo=(o,t)=>{if(!o){console.log("n");return}let e=window.MutationObserver||window.WebKitMutationObserver;if(!(!o||o.nodeType!==1))if(e){let n=new e(t),r={attributes:!0,childList:!0,subtree:!0};return n.observe(o,r),n}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",t,!1),o.addEventListener("DOMNodeRemoved",t,!1))}});var Et,jo=m(()=>{"use strict";I();w();b();qo();Et=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetMutationObserverMessage);s(this,"executor",e=>{e.source&&Vo(document.body,()=>{this.messageToHost(new He)})})}}});var Go,Rt,Jo=m(()=>{"use strict";I();X();b();w();me();L();Go=o=>{if(!o)return null;if(o.tagName==="FORM"){let t=new FormData(o),e={formData:{},unmappedData:[]},n=o.querySelectorAll("input, select, textarea"),r=-1;return n.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:Go(i),required:i.required,validity:P(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},Rt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.GetElementValueMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{this.messageToHost(new ie(Go(r)),e)})})}}});var vt,Yo=m(()=>{"use strict";I();b();w();L();vt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.GetAttributeMessage);s(this,"executor",e=>{let n=Zn(e.ref,document);n&&this.messageToHost(new ke(n.getAttribute(e.name)),e)})}}});var _t,Xo=m(()=>{"use strict";w();I();b();_t=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetResizeObserverMessage);s(this,"executor",e=>{let n=new ResizeObserver(r=>{this.messageToHost(new Oe)});return n.observe(document.body),()=>{n.disconnect()}})}}});var kt,Qo=m(()=>{"use strict";I();b();L();kt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetInnerHtml);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.innerHTML=e.content})})}}});var Zo={};ee(Zo,{IframeSDK:()=>Ht});var Ht,es=m(()=>{"use strict";b();Ao();Fo();zo();$o();te();Uo();No();w();Wo();jo();Jo();Ne();Yo();Xo();Qo();Ht=class extends Ie{constructor(){super();s(this,"version",ue);s(this,"messageToHost",(e,n)=>{var i;!e.replayToHandler&&(n!=null&&n.handlerUniqueId)&&(e.replayToHandler=n.handlerUniqueId);let r=Object.keys(this.components);e.destination||(n!=null&&n.route?e.destination=n.route[n.route.length-1]:e.destination=r[0]),e.source||(e.source=r[0]),e.direction=R.up,(i=window.parent)==null||i.postMessage(h({},e),"*")});s(this,"supportedHandlers",[new xt(this.messageToHost),new kt(this.messageToHost),new Ct(this.messageToHost),new It(this.messageToHost),new wt(this.messageToHost),new bt(this.messageToHost),new St(this.messageToHost),new Rt(this.messageToHost),new Et(this.messageToHost),new _t(this.messageToHost),new vt(this.messageToHost),new Tt(this.messageToHost)]);s(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new ae)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};z("IframeSDK",Ht)});var Bs={};var Ds,ts=m(()=>{"use strict";w();te();Ds=h({},he);z("MyopMessages",Ds)});var ns={};ee(ns,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ft,addClass:()=>To,applyStylesheet:()=>Co,applyStylesheetLink:()=>xo,changeSkinUrlByTokenizer:()=>bo,createIframeSkinByTokenizer:()=>pn,exec:()=>Ho,removeClass:()=>Eo,v2_CloudRepository:()=>_o});var os=m(()=>{"use strict";te();Mt();Mt();z("MyopHelpers",dn)});var As={};ee(As,{getHostModule:()=>ss,getIframeModule:()=>rs,getWebcomponentModule:()=>is});te();var yn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(yn=document.currentScript)==null?void 0:yn.src,t=o?o.split("/").slice(0,-1).join("/"):"";window.__federation__={__public_auto_path__:t,__use_public_auto_path__:!0,__public_path__:void 0,__loading_timeout__:5*1e3}}window.__federation__.load__federation__=(o,t,e)=>{if(window.__federation__[t])console.log("__federation__ module ".concat(t," already loaded.")),e(window.__federation__[t][Bt]);else{let n;window.__federation__[t]={},window.__federation__[t][Ue]=r=>{n&&(document.head.removeChild(n),n=null),window.__federation__[t][Bt]=r,e(r)},n=document.createElement("script"),n.type="module",n.src=o,n.async=!0,document.head.appendChild(n)}};Ne();console.log("myop root sdk - loaded",document.location.origin);var Ls="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",ss=()=>Promise.resolve().then(()=>(Pe(),Ko)),rs=()=>Promise.resolve().then(()=>(es(),Zo)),is=()=>Promise.resolve().then(()=>(an(),lo)),Os=()=>Promise.resolve().then(()=>(ts(),Bs)),Ps=()=>Promise.resolve().then(()=>(os(),ns)),Ae=o=>async()=>(await o()).get(),Ks={version:ue,getHostModule:Ae(ss),getIframeModule:Ae(rs),getWebcomponentModule:Ae(is),getMyopMessages:Ae(Os),getMyopHelpers:Ae(Ps)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ls});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=h({rootSDK:Ks},window.myop);return us(As);})();
1
+ import { jsx as T, jsxs as Pt } from "react/jsx-runtime";
2
+ import { useRef as O, useEffect as oe, useState as ie, useCallback as Be } from "react";
3
+ const At = `"use strict";var MyopSDK=(()=>{var Ue=Object.defineProperty,ls=Object.defineProperties,fs=Object.getOwnPropertyDescriptor,us=Object.getOwnPropertyDescriptors,gs=Object.getOwnPropertyNames,yn=Object.getOwnPropertySymbols;var hn=Object.prototype.hasOwnProperty,ys=Object.prototype.propertyIsEnumerable;var Bt=(o,n,e)=>n in o?Ue(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,h=(o,n)=>{for(var e in n||(n={}))hn.call(n,e)&&Bt(o,e,n[e]);if(yn)for(var e of yn(n))ys.call(n,e)&&Bt(o,e,n[e]);return o},U=(o,n)=>ls(o,us(n));var m=(o,n)=>()=>(o&&(n=o(o=0)),n);var ee=(o,n)=>{for(var e in n)Ue(o,e,{get:n[e],enumerable:!0})},hs=(o,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of gs(n))!hn.call(o,s)&&s!==e&&Ue(o,s,{get:()=>n[s],enumerable:!(t=fs(n,s))||t.enumerable});return o};var Ms=o=>hs(Ue({},"__esModule",{value:!0}),o);var r=(o,n,e)=>Bt(o,typeof n!="symbol"?n+"":n,e);var qe,Ve,Lt,F,te=m(()=>{"use strict";qe="__federation__",Ve="onLoad",Lt="moduleInstance",F=(o,n)=>{window[qe]&&window[qe][o]&&window[qe][o][Ve]&&window[qe][o][Ve]({[o]:n})}});var ye,je=m(()=>{ye="0.3.17"});var f,I=m(()=>{"use strict";f={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 E,Is,Cs,Pt,Ot=m(()=>{"use strict";E=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),Is=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("-")},Cs=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))},Pt=o=>{let n=Cs(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(Is(n.slice(t,t+16)));return e}});var In,ne=m(()=>{"use strict";Ot();In=o=>new Promise(n=>setTimeout(n,o))});var v,C,At,R,_,Y,k=m(()=>{"use strict";ne();v=class{};r(v,"down","down"),r(v,"up","up");C=class{constructor(){r(this,"id",E());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}},At=class extends C{constructor(e){super();this.ref=e}},R=class extends C{constructor(e){super();this.replayToHandler=e}},_=class extends C{constructor(e){super();this.handler=e;r(this,"handlerUniqueId",E())}},Y=class o{constructor(n,e){this.refConfig=n;this.component=e;r(this,"myop",!0);r(this,"__nonProxied");this.__nonProxied=U(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 Cn,Kt,oe,xn=m(()=>{"use strict";k();Cn="ClickReplayMessage",Kt=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",Cn);r(this,"messageType","BindClickMessage");r(this,"cleanable",!0)}},oe=class extends R{constructor(){super(...arguments);r(this,"messageType",Cn)}}});var $t,wn=m(()=>{"use strict";k();$t=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","ChangeTextMessage");this.content=t}}});var bn,xs,ws,Sn,D,se,Ft=m(()=>{"use strict";k();bn="ExecuteScriptReplyMessage",xs=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,ws=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,Sn=o=>{let n=o.match(xs);if(n)return n[1]||n[3];{let e=o.match(ws);if(e)return e[1].trim()}},D=class extends _{constructor(e,t=()=>{},s){super(t);this.scriptInputs=s;r(this,"replyMessageKey",bn);r(this,"messageType","ExecuteScriptMessage");r(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=Sn(this.content)}};r(D,"replierKey","send"),r(D,"completeStreamKey","completeStream");se=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;r(this,"messageType",bn)}}});var q,En=m(()=>{"use strict";Ft();q=class extends D{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=U(h({},t),{_script:e.toString()})}}});var Tn,zt,re,vn=m(()=>{"use strict";k();Tn="EventListenerCallbackMessage",zt=class extends _{constructor(e,t,s){super(s);this.ref=e;this.type=t;this.handler=s;r(this,"replyMessageKey",Tn);r(this,"messageType","AddEventListenerMessage");r(this,"cleanable",!0);r(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},re=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;r(this,"messageType",Tn);this.content={e:t}}}});var Wt,Rn=m(()=>{"use strict";k();Wt=class extends C{constructor(e,t,s){super();this.ref=e;this.name=t;this.value=s;r(this,"messageType","SetAttributeMessage")}}});var _n,Nt,ie,Ut=m(()=>{"use strict";k();_n="ElementValueReplayMessage",Nt=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",_n);r(this,"messageType","GetElementValueMessage")}},ie=class extends R{constructor(e){super();this.content=e;r(this,"messageType",_n)}}});var qt,kn=m(()=>{"use strict";k();qt=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","SetInnerHtml");this.content=t}}});var he,_e,ae,Hn=m(()=>{"use strict";k();he=class extends C{constructor(e){super();r(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},_e=class extends he{constructor(){super(...arguments);r(this,"messageType","InitResponse")}},ae=class extends C{constructor(){super(...arguments);r(this,"messageType","InitRequest")}}});var Dn,ke,V,Ge=m(()=>{"use strict";k();Dn="RefComponentCreatedMessage",ke=class extends _{constructor(e,t,s,i){super(i);this.refConfig=e;this.nestedComponentConfig=t;this.options=s;r(this,"replyMessageKey",Dn);r(this,"messageType","CreateRefComponentMessage")}},V=class extends R{constructor(e,t,s){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=s;r(this,"messageType",Dn)}}});var He,Vt=m(()=>{"use strict";k();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 Bn,jt,pe,Ln=m(()=>{"use strict";k();Bn="DetectedMyopRefsMessage",jt=class extends _{constructor(){super(...arguments);r(this,"messageType","DetectMyopRefsMessage");r(this,"replyMessageKey",Bn)}},pe=class extends R{constructor(e,t){super(e);this.replayToHandler=e;r(this,"messageType",Bn);this.content=t}isTypeof(e){return e.messageType===this.messageType}}});var Pn,Gt,De,On=m(()=>{"use strict";k();Pn="GetAttributeReplayMessage",Gt=class extends _{constructor(e,t,s){super(s);this.ref=e;this.name=t;r(this,"replyMessageKey",Pn);r(this,"messageType","GetAttributeMessage")}},De=class extends R{constructor(e){super();this.content=e;r(this,"messageType",Pn)}}});var A,An=m(()=>{"use strict";k();A=class extends C{constructor(e){super();this.method=e;r(this,"messageType","ExecuteComponentMethod")}}});var Yt,Be,Kn=m(()=>{"use strict";k();Yt=class extends C{constructor(){super(...arguments);r(this,"messageType","SetMutationObserverMessage")}},Be=class extends C{constructor(){super(...arguments);r(this,"messageType","MutationObserverMessage")}}});var $n,Le,Pe,Fn=m(()=>{"use strict";k();$n="CleanupReplayMessage",Le=class extends _{constructor(e,t){super(t);this.cleanupForMessageId=e;r(this,"replyMessageKey",$n);r(this,"messageType","CleanupMessage")}},Pe=class extends R{constructor(e){super();this.customCleanup=e;r(this,"messageType",$n)}}});var Oe,zn=m(()=>{"use strict";k();Oe=class extends C{constructor(){super(...arguments);r(this,"messageType","DisposeMessage")}}});var Qt,Ae,Wn=m(()=>{"use strict";k();Qt=class extends C{constructor(){super(...arguments);r(this,"cleanable",!0);r(this,"messageType","SetResizeObserverMessage")}},Ae=class extends C{constructor(){super(...arguments);r(this,"messageType","ResizeObserverMessage")}}});var Me={};ee(Me,{AddEventListenerMessage:()=>zt,BaseMyopMessage:()=>C,BindClickMessage:()=>Kt,ChangeTextMessage:()=>$t,CleanupMessage:()=>Le,CleanupReplayMessage:()=>Pe,ClickReplayMessage:()=>oe,CreateRefComponentMessage:()=>ke,CustomRefMessage:()=>q,DetectMyopRefsMessage:()=>jt,DetectedMyopRefsMessage:()=>pe,DisposeMessage:()=>Oe,ElementValueReplayMessage:()=>ie,EnvelopedMessage:()=>He,EventListenerCallbackMessage:()=>re,ExecuteComponentMethod:()=>A,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>se,GetAttributeMessage:()=>Gt,GetAttributeReplayMessage:()=>De,GetElementValueMessage:()=>Nt,InitMessage:()=>he,InitRequest:()=>ae,InitResponse:()=>_e,MessageDirection:()=>v,MutationObserverMessage:()=>Be,MyopBindMessage:()=>_,MyopBindReplayMessage:()=>R,MyopElementMessage:()=>At,Ref:()=>Y,RefComponentCreatedMessage:()=>V,ResizeObserverMessage:()=>Ae,SetAttributeMessage:()=>Wt,SetInnerHtml:()=>qt,SetMutationObserverMessage:()=>Yt,SetResizeObserverMessage:()=>Qt,stripFunction:()=>Sn});var w=m(()=>{"use strict";k();xn();wn();Ft();En();vn();Rn();Ut();kn();Hn();Ge();Vt();Ln();Ut();On();An();Kn();Fn();zn();Wn()});var z,Ke=m(()=>{"use strict";I();w();$e();z=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)||$.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===f.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=v.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=v.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 Le(n.id,t=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Oe);let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var Ie,Nn=m(()=>{"use strict";Ie=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 Un,x,Ye,qn=m(()=>{"use strict";Un=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let n=await o;typeof n=="function"&&n()}},x=class{constructor(n){this.messageToHost=n}},Ye=class extends x{constructor(e,t){super(e);this.messageToHost=e;this.context=t}}});var Jt,Ce,Vn=m(()=>{"use strict";I();b();w();Jt=class{constructor(n,e){this.id=n;this.context=e;r(this,"send",n=>{})}},Ce=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!==v.down)return;if(t.messageType===f.DisposeMessage){t.destination&&delete this.components[t.destination];return}if(t.messageType===f.InitMessage){let s=t.content.id;if(this.components[s])return;this.components[s]=new Jt(s),this.messageToHost(new _e(s));return}if(t.messageType===f.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===f.CleanupMessage){let i=t,a=this.messageCleanupCache[i.cleanupForMessageId],p=new Pe(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],Un(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 j,de,be,xe,ce,Qe,we,b=m(()=>{"use strict";Nn();qn();Vn();j={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},de={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},be={message:"message",code:"code"},xe=class{};r(xe,"code","code"),r(xe,"component","component");ce={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},Qe={Segment:"Segment",Promo:"Promo",AB:"AB"},we=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 Xt,bs,Zt,O,me=m(()=>{"use strict";Xt=o=>o!==Object(o),bs=o=>typeof o=="function",Zt=o=>{if(Xt(o))return!0;if(bs(o)||Object.getPrototypeOf(o))return!1;for(let n in o){let e=o[n];if(typeof e=="object"){if(!Zt(e))return!1}else{if(Xt(e))continue;return!1}}return!0},O=(o,n={},e=!0,t=new WeakMap)=>{if(Xt(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]=O(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]=O(o[i],!0,e,t)):typeof a=="object"&&(s[i]=O(o[i],a,e,t)))}return s}return{}}});var jn,Gn=m(()=>{"use strict";jn={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 Fe,Yn=m(()=>{"use strict";Ke();w();Vt();Fe=class extends z{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 A("dispose")),super.dispose()})}hide(){this.send(new A("hide"))}show(){this.send(new A("show"))}inspect(){return this.send(new A("inspect"))}setHeightBasedOnDocumentElement(){this.send(new A("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new A("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var le,en=m(()=>{"use strict";Ke();ze();le=class extends z{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=Se(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 Ss,Se,Qn,Jn,Xn,Es,tn,nn,ze=m(()=>{"use strict";w();w();b();me();Gn();Yn();en();Ss=(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},Se=(o,n,e,t,s,i)=>{let a=Ss("".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)}},Qn=(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),Jn=(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."))},Xn=(o,n,e)=>{let t=n.reduce((i,a)=>U(h({},i),{[a.name]:h({},a)}),{}),s={get:(i,a)=>{let p=t[a];if(Qn(p,a,o))return!1;if(p.behavior.type===be.code){if(o instanceof le)return(p.behavior.remap||a)==="myop_init_interface"?l=>{if(l===void 0)return o.getData();o.initWithData(l)}:void 0;if(e.loader.type===j.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return Jn(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(Y.create(p.behavior.ref)),c.push(u=>{d(u)}),p.behavior.params&&c.push(...p.behavior.params);let l=Me[p.behavior.message];o.send(new l(...c))}):null},set:(i,a,p)=>{let d=t[a];if(Qn(d,a,o))return!1;if(d.behavior.type===be.code){if(o instanceof le){let l=d.behavior.remap||a;if(l==="myop_cta_handler")return o.setCtaHandler(p),!0;if(l==="myop_init_interface")return o.initWithData(p),!0}if(e.loader.type===j.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let l=d.behavior,u=o.element.contentWindow,g=l.remap||a;if(u[g]=p,g==="myop_cta_handler"&&u.__myop_cta_queue){let y=u.__myop_cta_queue;u.__myop_cta_queue=null,y.forEach(M=>{o.markedForDisposed||p(M.action,M.payload)})}return!0}return Jn(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(Y.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let l=Me[d.behavior.message];return o.send(new l(...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},Es=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...i)=>new Promise(a=>{i.forEach(p=>{Zt(p)||jn.notSerializableRefCall(t,p)}),n.send(new q(({ref:p,propName:d,functionArgs:c,makeSerializable:l})=>{if(p){let u=p[d];return l(typeof u=="function"?p[d](...c):u,!0)}return null},{elementId:e.refConfig.selector,propName:t,functionArgs:i},p=>{a(p.content)}))})},set(e,t,s){return n.send(new q(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:s,propName:t},i=>{})),!0}}),tn=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 Fe(n.type,s,t);e.push(p),await s.initiated();let d=setTimeout(()=>{a("timeout")},5e3);s.send(new ke(o.refConfig,n,U(h({},t||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let l=e.find(u=>u.id==p.id);if(l!==p){s.refs[o.refConfig.name]=l,i(l);return}else p.setInitiated(),s.refs[o.refConfig.name]=p;c.nestedRefs.forEach(u=>{let g=n.instance.resolvedNestedComponents.find(M=>M.type.id===u.componentDefinitionId).type,y=new Fe(g,p);y.setInitiated(),p.refs[u.refName]=y,e.push(y)});try{await nn(p,n,e,!0),s.setHeightBasedOnScrollHeight&&s.setHeightBasedOnScrollHeight(),i(p)}catch(u){a(u)}}))})},nn=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==xe.component){if(t){a();return}let c=i.behavior.componentId;c||(c=i.behavior.instance.componentId);let l=(d=n.instance.resolvedNestedComponents)==null?void 0:d.find(g=>g.type.id===c);if(!l)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let u=Y.create("",i,o);try{let g=await tn(u,l,e);o.refs[i.name]=g,a()}catch(g){p(g)}}else try{let c=Y.create("",i,o);o.refs[i.name]=Es(c,o),a()}catch(c){}}));try{await Promise.all(s)}catch(i){throw i}}});var Ee,on=m(()=>{"use strict";Ke();w();ze();I();Ee=class extends z{constructor(e,t,s,i,a){super(e,s,a);this.componentConfig=e;this.container=s;this.IframeElement=i;r(this,"cleanupInspect");r(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new D(()=>window.document.documentElement.scrollHeight,t=>{this.IframeElement.style.height="".concat(t.content,"px"),e()}))});r(this,"observeSizeBasedOnDocumentElement",()=>this.send(new D(({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 Re;let t=this.IframeElement,s=t.contentDocument;if(!s)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(P,N,ge)=>N!==void 0&&P<N?N:ge!==void 0&&P>ge?ge:P,a=P=>{if(P===void 0)return;if(typeof P=="number")return P;let N=parseFloat(P);return isNaN(N)?void 0:N},p=a(e==null?void 0:e.minWidth),d=a(e==null?void 0:e.maxWidth),c=a(e==null?void 0:e.minHeight),l=a(e==null?void 0:e.maxHeight),u=(Re=e==null?void 0:e.loaderMinHeight)!=null?Re:50,g=(e==null?void 0:e.explicitWidth)!==void 0,y=(e==null?void 0:e.explicitHeight)!==void 0,M=this.container.getBoundingClientRect(),fe=M.width===0,Ne=M.height===0||M.height===u,G=(e!=null&&e.forceAutoSize||fe)&&!g,H=(e!=null&&e.forceAutoSize||Ne)&&!y;if(!G&&!H)return()=>{};let K=()=>{var N;let P=t.contentDocument;if(P){let ge=P.documentElement.getBoundingClientRect(),ln=Math.ceil(ge.width),fn=Math.ceil(ge.height),un=i(ln,p,d),gn=i(fn,c,l);G&&(t.style.width="".concat(un,"px")),H&&(t.style.height="".concat(gn,"px"));let cs=G&&d!==void 0&&ln>d,ms=H&&l!==void 0&&fn>l;P.documentElement.style.overflowX=cs?"auto":"hidden",P.documentElement.style.overflowY=ms?"auto":"hidden",(N=e==null?void 0:e.onSizeChange)==null||N.call(e,{width:un,height:gn,autoSizingWidth:G,autoSizingHeight:H})}};K();let ue=new ResizeObserver(K);return ue.observe(s.body),ue.observe(s.documentElement),()=>{ue.disconnect()}});r(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new D(()=>{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 D(()=>{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===f.ExecuteComponentMethod)return this[t.method](),()=>{};t.direction=v.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=Se(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===f.In.MutationObserverMessage||e.messageType===f.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var Q,Je=m(()=>{"use strict";Q=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 Ts,Xe,Zn=m(()=>{"use strict";on();Je();ne();b();Ts=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},Xe=class extends Q{constructor(){super(...arguments);r(this,"type",j.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=E(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let l="\\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=l,i!=null&&i.elementAttributes&&Object.entries(i.elementAttributes).forEach(([g,y])=>{y===""||y===null||y===void 0?a.setAttribute(g,""):a.setAttribute(g,String(y))});let u=t.loader.url;i!=null&&i._hasParent&&(u=Ts(u,"_myop-comp",d)),a.src=u,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),a=this.appendChild(s,a,i)}return new Ee(e,t,s,a,i)})}}});var Ze,sn=m(()=>{"use strict";Ze={webcomponent_message_key:"myop_webcomponent_message"}});var Te,rn=m(()=>{"use strict";sn();Ke();ze();Te=class extends z{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=Se(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 an,et,eo=m(()=>{"use strict";rn();Je();ne();b();an={},et=class extends Q{constructor(){super(...arguments);r(this,"type",j.WebComponentLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;an[a.url]?console.log("Module alreday loaded or in loading process"):an[a.url]=new Promise((c,l)=>{let u=a.url,g=document.createElement("script");g.type="module",g.src=u,g.onload=()=>{c()},g.onerror=()=>{l()},document.head.appendChild(g)}),await an[a.url],await In(1);let p="myop-comp-".concat(E()),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 Te(e,t,s,d,i)})}}});var T,W=m(()=>{"use strict";b();T=class extends Ye{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(U(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 B,J=m(()=>{"use strict";B={id:"myop-id"}});var S,to,L=m(()=>{"use strict";J();S=(o,n)=>n.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),to=(o,n)=>{let e=S(o,n);return e.length?e.item(0):null}});var tt,no=m(()=>{"use strict";I();w();W();L();tt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.BindClickMessage);r(this,"innerExecutor",(e,t,s)=>{let i=S(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=()=>{s(new oe(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var nt,oo=m(()=>{"use strict";I();W();L();nt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ChangeTextMessage);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.textContent=e.content})})}}});var ot,so=m(()=>{"use strict";b();ot=class extends we{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}}});var st,ro=m(()=>{"use strict";b();J();W();w();I();st=class extends T{constructor(){super(...arguments);r(this,"innerExecutor",(e,t)=>{let s=t.shadowRoot.querySelectorAll("[".concat(B.id,"]")),i=[];s.forEach(a=>{let p=a.getAttribute(B.id);p&&i.push(new Ie(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new pe(e.handlerUniqueId,i))});r(this,"messageType",f.DetectMyopRefsMessage)}}});var rt,io=m(()=>{"use strict";I();W();L();rt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.SetAttributeMessage);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.setAttribute(e.name,e.value)})})}}});var it,ao=m(()=>{"use strict";I();w();W();L();me();it=class extends T{constructor(){super(...arguments);r(this,"messageType",f.AddEventListenerMessage);r(this,"innerExecutor",(e,t,s)=>{let i=S(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=c=>{s(new re(e.handlerUniqueId,O(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var at,po=m(()=>{"use strict";I();J();$e();Ge();W();at=class extends T{constructor(){super(...arguments);r(this,"messageType",f.CreateRefComponentMessage);r(this,"innerExecutor",(e,t,s)=>{(async()=>{let a=t.shadowRoot.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=$.Instance(),d=p.components.find(g=>g.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let l=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),u=[];Object.keys(l.refs).forEach(g=>{let y=l.refs[g];y=y.__nonProxied||y,y.componentDefinition&&u.push({refName:g,componentDefinitionId:y.componentDefinition.id})}),s(new V(e.handlerUniqueId,u))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var pt,pn=m(()=>{"use strict";me();pt=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=O,t.send=n,t.rootRef=e,t.__scriptInputs=t;let i=new Function("return (".concat(o.script,")(...arguments)"))(t);n(i)}});var dt,co=m(()=>{"use strict";I();w();W();pn();dt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"innerExecutor",(e,t,s)=>{pt(e,a=>{s(new se(e.handlerUniqueId,a))},t)})}}});var mo,ct,lo=m(()=>{"use strict";I();w();W();L();J();me();mo=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(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:mo(i),required:i.required,validity:O(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},ct=class extends T{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"innerExecutor",(e,t,s)=>{S(e.ref,t.shadowRoot).forEach(a=>{s(new ie(mo(a)),e)})})}}});var mt,fo=m(()=>{"use strict";I();W();L();mt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.SetInnerHtml);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.innerHTML=e.content})})}}});var uo={};ee(uo,{WebComponentSDK:()=>ve});var ve,dn=m(()=>{"use strict";b();I();sn();no();oo();so();ro();te();w();io();ao();po();co();lo();fo();ve=class extends Ce{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===f.InitMessage){let p=a.content.id;this.components[p].context=new ot(e,t)}}}),setTimeout(()=>{this.messageToHost(new ae)},1)});r(this,"messageToHost",(e,t)=>{e.direction=v.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)});r(this,"supportedHandlers",[new nt(this.messageToHost,this.components),new mt(this.messageToHost,this.components),new tt(this.messageToHost,this.components),new st(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new it(this.messageToHost,this.components),new dt(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new at(this.messageToHost,this.components)]);r(this,"init",()=>{})}};F("WebComponentSDK",ve)});var go=m(()=>{"use strict";dn()});var yo,ho=m(()=>{"use strict";yo=""});function _s(o,n){return class extends HTMLElement{connectedCallback(){let e=n===de.open?"open":"closed",t=this.attachShadow({mode:e});xo().then(s=>{s.connectedCallback(this,t),t.innerHTML=o})}}}var vs,Rs,Io,Co,lt,xo,ks,Hs,Ds,ft,wo=m(()=>{"use strict";rn();en();Je();ne();b();go();on();ho();vs="<!-- myop-web-component -->",Rs="myop-web-component",Io=new Set,Co=[],xo=async()=>(lt||(lt=new ve,lt.init()),lt);ks=(o,n,e)=>{customElements.define(o,_s(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},Hs=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),Ds=o=>(o=Hs(o),o.replace(/_/g,"-")),ft=class extends Q{constructor(){super(...arguments);r(this,"type",j.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(E()),d;if(a.shadowRootMode===de.localFrame){let c=E(),l="myop-comp-".concat(c),u=document.createElement("iframe");u.id=l,u.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=""),u=this.appendChild(s,u,i);let g=u.contentDocument||u.contentWindow.document;g.open();let y=a.HTML;if(i!=null&&i._inspection){let H=new DOMParser().parseFromString(a.HTML,"text/html"),K=H.getElementById("myop_preview");K==null||K.removeAttribute("type");let ue=H.implementation.createHTMLDocument();ue.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let Re=ue.body.firstChild;Re&&H.head&&H.head.insertBefore(H.importNode(Re,!0),H.head.firstChild),y=H.documentElement.outerHTML}else if((i==null?void 0:i.data)!==void 0){let H=new DOMParser().parseFromString(a.HTML,"text/html"),K=H.getElementById("myop_preview");K&&(K.remove(),y=H.documentElement.outerHTML)}g.writeln(y);let M='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),fe="<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(g.writeln("".concat(M).concat(fe)),(i==null?void 0:i.data)!==void 0){let G="<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>",H=JSON.stringify(i.data).replace(/<\\/script/gi,"\\\\u003c/script"),K='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(H,";\\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>");g.writeln(G+K)}g.close();let Ne=new Ee(e,t,s,u,i);return a.autoHeight&&(u.onload=()=>{Ne.observeSizeBasedOnDocumentElement()}),Ne}if(a.shadowRootMode===de.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,xo().then(l=>{l.connectedCallback(d,d)})}else{let c=Ds(e.name+t.id);Co.includes(c)||(ks(c,a.HTML,a.shadowRootMode),Co.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 Te(e,t,s,d,i)})}isMyopWebComponent(e){return e.trimStart().startsWith(vs)}extractWebComponentScript(e){let i=new DOMParser().parseFromString(e,"text/html").getElementById(Rs);return(i==null?void 0:i.textContent)||null}executeWebComponentScript(e,t){if(Io.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),Io.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 l=window.__MYOP_TAG_NAME__;if(!l)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");c&&c!==l&&console.warn("[MyopWebComponent] __MYOP_TAG_NAME__ changed from ".concat(c," to ").concat(l));let u="myop-comp-".concat(E()),g=document.createElement(l);g.id=u,a!=null&&a.hidden&&(g.style.opacity="0",g.style.position="absolute",g.style.height="0",g.style.width="0",g.style.pointerEvents="none",g.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,g,a);let y=new le(e,t,s,g,l,a);return(a==null?void 0:a.data)!==void 0&&y.initWithData(a.data),console.log("[MyopWebComponent] Loaded <".concat(l,"> into container")),y}}});var bo,So,Eo=m(()=>{"use strict";ne();w();bo=(o,n,e)=>{let t="myop-css-".concat(E());return o.send(new D(({rootRef:s,_stylesheet:i,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let l in i){c+="".concat(l," { ");let u=i[l];for(let g in u)c+="".concat(g,": ").concat(u[g],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(s.shadowRoot||s.container).appendChild(d)},()=>{},{_stylesheet:n,_css:e||"",_tagId:t})),()=>{o.send(new D(({rootRef:s,_tagId:i})=>{let a=(s.shadowRoot||document).getElementById(i);a&&a.remove()},()=>{},{_tagId:t}))}},So=(o,n)=>{let e="myop-css-".concat(E());return o.send(new D(({rootRef:t,_tagId:s,_link:i})=>{let a=document.createElement("link");a.id=s,a.rel="stylesheet",a.href=i,document.head.appendChild(a),(t.shadowRoot||t.container).appendChild(a)},()=>{},{_link:n,_tagId:e})),()=>{o.send(new D(({rootRef:t,_tagId:s})=>{let i=(t.shadowRoot||document).getElementById(s);i&&i.remove()},()=>{},{_tagId:e}))}}});var Bs,cn,To,vo=m(()=>{"use strict";Bs=(o,n)=>{let e=new RegExp(Object.keys(n).join("|"),"g");return o.replace(e,t=>(n[t]||t).toString())},cn=(o,n)=>{let e=o.loader;if(e.type!=="IframeLoader")throw new Error('iframeSkinUrlTokenizer received skin with loader type "'.concat(e.type,'", currently only "IframeLoader" is supported'));return o.loader=h({},o.loader),o.loader.url=Bs(o.loader.url,n),o},To=o=>async n=>cn(n,o)});var Ro,_o,ko=m(()=>{"use strict";w();Ro=(o,n,e)=>{o.send(new q(({ref:t,_className:s})=>{t==null||t.classList.add(s)},{elementId:e,_className:n}))},_o=(o,n,e)=>{o.send(new q(({ref:t,_className:s})=>{t==null||t.classList.remove(s)},{elementId:e,_className:n}))}});var yt,ut,ht,gt,Ho=m(()=>{"use strict";ne();yt=class yt{constructor(){r(this,"_runTimeInstanceId","runtime-instance-id-"+E());r(this,"_runTimeId","runtime-id-"+E());r(this,"_runTimeName","runtime-name-"+E());r(this,"id",this._runTimeId);r(this,"name",this._runTimeName);r(this,"description","");r(this,"loader",null);r(this,"withLoader",n=>(this.loader=n,this));r(this,"withHTMLLoader",n=>(n.type="HTMLLoader",this.loader=n,this));r(this,"build",()=>this)}};r(yt,"create",()=>new yt);ut=yt,ht=class ht{constructor(){r(this,"_runTimeInstanceId","runtime-instance-id-"+E());r(this,"_runTimeId","runtime-id-"+E());r(this,"_runTimeName","runtime-name-"+E());r(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});r(this,"name",this._runTimeName);r(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});r(this,"withInstance",n=>(this.instance=n,this));r(this,"withType",n=>(this.type=n,this));r(this,"withName",n=>(this.name=n,this));r(this,"withDefaultSkin",n=>(this.type.skins.push(n),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:n.id}},this));r(this,"withRef",n=>(this.type.refs.push(n),this));r(this,"withBasicRef",n=>{let e={id:"",name:n,description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}};return this.type.refs.push(e),this});r(this,"build",()=>JSON.parse(JSON.stringify(this)))}};r(ht,"create",()=>new ht);gt=ht});var Ls,Mt,Ps,Os,X,Z,Do,Bo=m(()=>{"use strict";b();Ls=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:be.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:be.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),Mt="__MYOP_CLOUD_REPOSITORY_MAIN__",Ps=()=>{if(typeof window<"u")return window[Mt];if(typeof globalThis<"u")return globalThis[Mt]},Os=o=>{typeof window<"u"&&(window[Mt]=o),typeof globalThis<"u"&&(globalThis[Mt]=o)},X=class X{constructor(n="https://cloud.myop.dev"){this._baseUrl=n;r(this,"variants",{});r(this,"preloadedComponents",{});r(this,"userFlows",{});r(this,"_defaultEnv","production")}static get Main(){let n=Ps();return n||(X._main||(X._main=new X,Os(X._main)),X._main)}setEnvironment(n){this._defaultEnv=n}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;!i&&s?(a=s.env,p=s.preview):(a=e||this._defaultEnv,p=t===!0?!0:t===!1?!1:!e);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,l)=>{try{let u="".concat(this._baseUrl,"/consume?id=").concat(n,"&env=").concat(a);p&&(u+="&preview=true");let M=(await(await fetch(u)).json()).item;if(!M){l(new Error('Component "'.concat(n,'" not found')));return}if(!M.consume_variant||!M.consume_variant.length){l(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(a,'"')));return}let fe=Ls(M);c(fe)}catch(u){l(u)}})),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(X,"_main",null);Z=X,Do=Z});var Lo,Po=m(()=>{"use strict";Lo=async o=>await o()});var mn={};ee(mn,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ut,addClass:()=>Ro,applyStylesheet:()=>bo,applyStylesheetLink:()=>So,changeSkinUrlByTokenizer:()=>To,createIframeSkinByTokenizer:()=>cn,exec:()=>Lo,removeClass:()=>_o,v2_CloudRepository:()=>Do});var It=m(()=>{"use strict";Eo();vo();ko();Ho();Bo();Po()});var Oo,Ao=m(()=>{"use strict";Ot();It();b();Oo=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[s,...i]=Pt(t);switch(s){case"component":{let[a,p]=i,d=await Z.Main.fetchComponent(a);if(d&&d.type.skins.find(l=>l.id===p))return d.instance.skinSelector={type:ce.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=Pt(t),c=(await Z.Main.fetchFlow(a)).components.find(l=>l.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ce.Segmented&&c.instance.resolvedExperiences){let l=c.instance.resolvedExperiences.find(u=>u.id===p);if((l==null?void 0:l.type)===Qe.Segment){let u=l,y=c.instance.skinSelector.segments.find(M=>M.segmentId===u.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var Fo={};ee(Fo,{HostSDK:()=>$,hostSDK:()=>$o});var Ko,$,$o,$e=m(()=>{"use strict";te();I();w();Zn();eo();ze();b();je();wo();Ao();Ko="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",$=class{constructor(){r(this,"components2init",[]);r(this,"components",[]);r(this,"componentsLoaders",[]);r(this,"initiated",!1);r(this,"version",ye);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!==v.up&&n.data.messageType!==f.EnvelopedMessage)return;let e=n.data;if(e.messageType===f.InitRequest){this.components2init.forEach(s=>{s.send(new he(s.id))});return}if(e.messageType===f.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===f.EnvelopedMessage){let s=e,i=this.components.find(a=>a.id===s.destination);if(i){if(s.direction===v.down){s.message.messageType===A.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 Xe,new et,new ft];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 ce.Dedicated:return((i=n.skin)==null?void 0:i.id)||n.skins[0].id;case ce.Segmented:{let p=await s(n.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===Qe.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let u=c.segment,g=(t||{})[u.function];return g?await g():(console.warn("segmentId:".concat(d.segmentId,", ").concat(u.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 l,u,g,y;if(!e){debugger;throw new Error("no container was found for this component")}let s=await Oo(n);s&&(n=s);let i=h(h({},(l=this.loaderHooks)!=null?l:{}),(u=t==null?void 0:t.hooks)!=null?u:{}),a=e;if(a.myop)if(a.component){n=h({},n),n.instance=h({},n.instance);let M=await this.runSkinSelector(n,i);if(!M)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(g=t==null?void 0:t.hooks)!=null&&g.afterSkinSelected&&(M=await t.hooks.afterSkinSelected(h({},M))),n.instance.skinSelector={type:ce.Dedicated,skin:M},t&&(t=h({},t),delete t.hooks),await tn(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");(y=t==null?void 0:t.hooks)!=null&&y.afterSkinSelected&&(p=await t.hooks.afterSkinSelected(h({},p)));let d=this.componentsLoaders.find(M=>M.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(M=>M!==c),this.components2init=this.components2init.filter(M=>M!==c),!0)),this.components.push(c),(!t||t.connectProps!==!1)&&(c=Xn(c,n.type.props,p));try{await nn(c,n,this.components)}catch(M){throw M}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($,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ko});if(!window.myop.hostSDK){let o=new $;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ko}),window.myop.hostSDK=o}$o=window.myop.hostSDK;F("hostSDK",$o)});var Ct,zo=m(()=>{"use strict";I();J();b();w();Ct=class extends x{constructor(){super(...arguments);r(this,"messageType",f.DetectMyopRefsMessage);r(this,"executor",e=>{let t=document.querySelectorAll("[".concat(B.id,"]")),s=[];t.forEach(i=>{let a=i.getAttribute(B.id);a&&s.push(new Ie(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new pe(e.handlerUniqueId,s))})}}});var xt,Wo=m(()=>{"use strict";I();b();w();L();xt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.BindClickMessage);r(this,"executor",e=>{let t=[];return S(e.ref,document).forEach(i=>{let a=()=>{this.messageToHost(new oe,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(i=>i())}})}}});var wt,No=m(()=>{"use strict";I();b();L();wt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ChangeTextMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.textContent=e.content})})}}});var bt,Uo=m(()=>{"use strict";I();w();b();pn();bt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"executor",e=>{pt(e,s=>{this.messageToHost(new se(e.handlerUniqueId,s))},new we(document.documentElement))})}}});var St,qo=m(()=>{"use strict";I();b();w();me();L();St=class extends x{constructor(){super(...arguments);r(this,"messageType",f.AddEventListenerMessage);r(this,"executor",e=>{let t=S(e.ref,document),s=[];return t.forEach(i=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new re(e.handlerUniqueId,O(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),s.push(()=>{i.removeEventListener(e.type,a)})}),()=>{s.forEach(i=>{i()})}})}}});var Et,Vo=m(()=>{"use strict";I();b();L();Et=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetAttributeMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.setAttribute(e.name,e.value)})})}}});var Tt,jo=m(()=>{"use strict";I();J();b();$e();Ge();Tt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.CreateRefComponentMessage);r(this,"executor",e=>{(async()=>{let s=document.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(s.length===1){let a=await $.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 V(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var Go,Yo=m(()=>{"use strict";Go=(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 vt,Qo=m(()=>{"use strict";I();w();b();Yo();vt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetMutationObserverMessage);r(this,"executor",e=>{e.source&&Go(document.body,()=>{this.messageToHost(new Be)})})}}});var Jo,Rt,Xo=m(()=>{"use strict";I();J();b();w();me();L();Jo=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(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:Jo(i),required:i.required,validity:O(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},Rt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{this.messageToHost(new ie(Jo(s)),e)})})}}});var _t,Zo=m(()=>{"use strict";I();b();w();L();_t=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetAttributeMessage);r(this,"executor",e=>{let t=to(e.ref,document);t&&this.messageToHost(new De(t.getAttribute(e.name)),e)})}}});var kt,es=m(()=>{"use strict";w();I();b();kt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetResizeObserverMessage);r(this,"executor",e=>{let t=new ResizeObserver(s=>{this.messageToHost(new Ae)});return t.observe(document.body),()=>{t.disconnect()}})}}});var Ht,ts=m(()=>{"use strict";I();b();L();Ht=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetInnerHtml);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.innerHTML=e.content})})}}});var ns={};ee(ns,{IframeSDK:()=>Dt});var Dt,os=m(()=>{"use strict";b();zo();Wo();No();Uo();te();qo();Vo();w();jo();Qo();Xo();je();Zo();es();ts();Dt=class extends Ce{constructor(){super();r(this,"version",ye);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=v.up,(i=window.parent)==null||i.postMessage(h({},e),"*")});r(this,"supportedHandlers",[new wt(this.messageToHost),new Ht(this.messageToHost),new xt(this.messageToHost),new Ct(this.messageToHost),new bt(this.messageToHost),new St(this.messageToHost),new Et(this.messageToHost),new Rt(this.messageToHost),new vt(this.messageToHost),new kt(this.messageToHost),new _t(this.messageToHost),new Tt(this.messageToHost)]);r(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new ae)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};F("IframeSDK",Dt)});var Ks={};var As,ss=m(()=>{"use strict";w();te();As=h({},Me);F("MyopMessages",As)});var rs={};ee(rs,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ut,addClass:()=>Ro,applyStylesheet:()=>bo,applyStylesheetLink:()=>So,changeSkinUrlByTokenizer:()=>To,createIframeSkinByTokenizer:()=>cn,exec:()=>Lo,removeClass:()=>_o,v2_CloudRepository:()=>Do});var is=m(()=>{"use strict";te();It();It();F("MyopHelpers",mn)});var Ns={};ee(Ns,{getHostModule:()=>as,getIframeModule:()=>ps,getWebcomponentModule:()=>ds});te();var Mn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(Mn=document.currentScript)==null?void 0:Mn.src,n=o?o.split("/").slice(0,-1).join("/"):"";window.__federation__={__public_auto_path__:n,__use_public_auto_path__:!0,__public_path__:void 0,__loading_timeout__:5*1e3}}window.__federation__.load__federation__=(o,n,e)=>{if(window.__federation__[n])console.log("__federation__ module ".concat(n," already loaded.")),e(window.__federation__[n][Lt]);else{let t;window.__federation__[n]={},window.__federation__[n][Ve]=s=>{t&&(document.head.removeChild(t),t=null),window.__federation__[n][Lt]=s,e(s)},t=document.createElement("script"),t.type="module",t.src=o,t.async=!0,document.head.appendChild(t)}};je();console.log("myop root sdk - loaded",document.location.origin);var $s="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",as=()=>Promise.resolve().then(()=>($e(),Fo)),ps=()=>Promise.resolve().then(()=>(os(),ns)),ds=()=>Promise.resolve().then(()=>(dn(),uo)),Fs=()=>Promise.resolve().then(()=>(ss(),Ks)),zs=()=>Promise.resolve().then(()=>(is(),rs)),We=o=>async()=>(await o()).get(),Ws={version:ye,getHostModule:We(as),getIframeModule:We(ps),getWebcomponentModule:We(ds),getMyopMessages:We(Fs),getMyopHelpers:We(zs)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:$s});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=h({rootSDK:Ws},window.myop);return Ms(Ns);})();
4
4
  `;
5
- var Ve = Object.defineProperty, Pt = Object.defineProperties, At = Object.getOwnPropertyDescriptors, Ae = Object.getOwnPropertySymbols, Bt = Object.prototype.hasOwnProperty, Ft = Object.prototype.propertyIsEnumerable, Ie = (e, t, n) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, M = (e, t) => {
5
+ var Je = Object.defineProperty, Bt = Object.defineProperties, Ft = Object.getOwnPropertyDescriptors, Fe = Object.getOwnPropertySymbols, Nt = Object.prototype.hasOwnProperty, $t = Object.prototype.propertyIsEnumerable, Ie = (e, t, n) => t in e ? Je(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, M = (e, t) => {
6
6
  for (var n in t || (t = {}))
7
- Bt.call(t, n) && Ie(e, n, t[n]);
8
- if (Ae)
9
- for (var n of Ae(t))
10
- Ft.call(t, n) && Ie(e, n, t[n]);
7
+ Nt.call(t, n) && Ie(e, n, t[n]);
8
+ if (Fe)
9
+ for (var n of Fe(t))
10
+ $t.call(t, n) && Ie(e, n, t[n]);
11
11
  return e;
12
- }, ue = (e, t) => Pt(e, At(t)), $t = (e, t) => {
12
+ }, ue = (e, t) => Bt(e, Ft(t)), Wt = (e, t) => {
13
13
  for (var n in t)
14
- Ve(e, n, { get: t[n], enumerable: !0 });
15
- }, a = (e, t, n) => Ie(e, typeof t != "symbol" ? t + "" : t, n), y = (e, t, n) => new Promise((s, i) => {
14
+ Je(e, n, { get: t[n], enumerable: !0 });
15
+ }, a = (e, t, n) => Ie(e, typeof t != "symbol" ? t + "" : t, n), g = (e, t, n) => new Promise((s, i) => {
16
16
  var o = (l) => {
17
17
  try {
18
18
  c(n.next(l));
@@ -27,8 +27,8 @@ var Ve = Object.defineProperty, Pt = Object.defineProperties, At = Object.getOwn
27
27
  }
28
28
  }, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(o, r);
29
29
  c((n = n.apply(e, t)).next());
30
- }), ge = "__federation__", Be = "onLoad", Ge = (e, t) => {
31
- window[ge] && window[ge][e] && window[ge][e][Be] && window[ge][e][Be]({ [e]: t });
30
+ }), ye = "__federation__", Ne = "onLoad", Qe = (e, t) => {
31
+ window[ye] && window[ye][e] && window[ye][e][Ne] && window[ye][e][Ne]({ [e]: t });
32
32
  }, v = {
33
33
  //host to component
34
34
  InitRequest: "InitRequest",
@@ -54,46 +54,46 @@ var Ve = Object.defineProperty, Pt = Object.defineProperties, At = Object.getOwn
54
54
  ResizeObserverMessage: "ResizeObserverMessage"
55
55
  }
56
56
  }, Te = {};
57
- $t(Te, {
58
- AddEventListenerMessage: () => Gt,
57
+ Wt(Te, {
58
+ AddEventListenerMessage: () => Jt,
59
59
  BaseMyopMessage: () => b,
60
- BindClickMessage: () => qt,
61
- ChangeTextMessage: () => jt,
62
- CleanupMessage: () => mt,
63
- CleanupReplayMessage: () => ft,
64
- ClickReplayMessage: () => Xe,
65
- CreateRefComponentMessage: () => ct,
66
- CustomRefMessage: () => Se,
67
- DetectMyopRefsMessage: () => Qt,
68
- DetectedMyopRefsMessage: () => ut,
69
- DisposeMessage: () => gt,
70
- ElementValueReplayMessage: () => it,
71
- EnvelopedMessage: () => lt,
72
- EventListenerCallbackMessage: () => nt,
73
- ExecuteComponentMethod: () => $,
74
- ExecuteScriptMessage: () => K,
75
- ExecuteScriptReplyMessage: () => et,
76
- GetAttributeMessage: () => Zt,
77
- GetAttributeReplayMessage: () => en,
78
- GetElementValueMessage: () => Jt,
79
- InitMessage: () => He,
80
- InitRequest: () => rt,
81
- InitResponse: () => ot,
82
- MessageDirection: () => k,
83
- MutationObserverMessage: () => nn,
60
+ BindClickMessage: () => jt,
61
+ ChangeTextMessage: () => Vt,
62
+ CleanupMessage: () => gt,
63
+ CleanupReplayMessage: () => vt,
64
+ ClickReplayMessage: () => et,
65
+ CreateRefComponentMessage: () => ut,
66
+ CustomRefMessage: () => xe,
67
+ DetectMyopRefsMessage: () => en,
68
+ DetectedMyopRefsMessage: () => mt,
69
+ DisposeMessage: () => wt,
70
+ ElementValueReplayMessage: () => at,
71
+ EnvelopedMessage: () => ht,
72
+ EventListenerCallbackMessage: () => ot,
73
+ ExecuteComponentMethod: () => N,
74
+ ExecuteScriptMessage: () => $,
75
+ ExecuteScriptReplyMessage: () => st,
76
+ GetAttributeMessage: () => tn,
77
+ GetAttributeReplayMessage: () => nn,
78
+ GetElementValueMessage: () => Xt,
79
+ InitMessage: () => ke,
80
+ InitRequest: () => lt,
81
+ InitResponse: () => ct,
82
+ MessageDirection: () => D,
83
+ MutationObserverMessage: () => on,
84
84
  MyopBindMessage: () => A,
85
85
  MyopBindReplayMessage: () => P,
86
86
  MyopElementMessage: () => Ut,
87
87
  Ref: () => ae,
88
- RefComponentCreatedMessage: () => xe,
89
- ResizeObserverMessage: () => on,
90
- SetAttributeMessage: () => Yt,
91
- SetInnerHtml: () => Xt,
92
- SetMutationObserverMessage: () => tn,
93
- SetResizeObserverMessage: () => sn,
94
- stripFunction: () => Ze
88
+ RefComponentCreatedMessage: () => Re,
89
+ ResizeObserverMessage: () => an,
90
+ SetAttributeMessage: () => Qt,
91
+ SetInnerHtml: () => Zt,
92
+ SetMutationObserverMessage: () => sn,
93
+ SetResizeObserverMessage: () => rn,
94
+ stripFunction: () => nt
95
95
  });
96
- var J = () => "10000000-1000-4000-8000-100000000000".replace(
96
+ var j = () => "10000000-1000-4000-8000-100000000000".replace(
97
97
  /[018]/g,
98
98
  (e) => (+e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +e / 4).toString(16)
99
99
  ), Kt = (e) => {
@@ -105,25 +105,25 @@ var J = () => "10000000-1000-4000-8000-100000000000".replace(
105
105
  t.slice(16, 20),
106
106
  t.slice(20)
107
107
  ].join("-");
108
- }, Nt = (e) => {
108
+ }, zt = (e) => {
109
109
  let t = e.replace(/-/g, "+").replace(/_/g, "/");
110
110
  for (; t.length % 4; ) t += "=";
111
111
  const n = atob(t);
112
112
  return Uint8Array.from(n, (s) => s.charCodeAt(0));
113
- }, Fe = (e) => {
114
- const t = Nt(e);
113
+ }, $e = (e) => {
114
+ const t = zt(e);
115
115
  if (t.length % 16 !== 0) throw new Error("Invalid input length");
116
116
  const n = [];
117
117
  for (let s = 0; s < t.length; s += 16)
118
118
  n.push(Kt(t.slice(s, s + 16)));
119
119
  return n;
120
- }, zt = (e) => new Promise((t) => setTimeout(t, e)), k = class {
120
+ }, qt = (e) => new Promise((t) => setTimeout(t, e)), D = class {
121
121
  };
122
- a(k, "down", "down");
123
- a(k, "up", "up");
122
+ a(D, "down", "down");
123
+ a(D, "up", "up");
124
124
  var b = class {
125
125
  constructor() {
126
- a(this, "id", J()), a(this, "myop", !0), a(this, "content"), a(this, "source"), a(this, "destination"), a(this, "route"), a(this, "ref"), a(this, "direction"), a(this, "cleanable", !1);
126
+ a(this, "id", j()), a(this, "myop", !0), a(this, "content"), a(this, "source"), a(this, "destination"), a(this, "route"), a(this, "ref"), a(this, "direction"), a(this, "cleanable", !1);
127
127
  }
128
128
  static create(...t) {
129
129
  return new this(...t);
@@ -141,9 +141,9 @@ var b = class {
141
141
  }
142
142
  }, A = class extends b {
143
143
  constructor(t) {
144
- super(), this.handler = t, a(this, "handlerUniqueId", J());
144
+ super(), this.handler = t, a(this, "handlerUniqueId", j());
145
145
  }
146
- }, ae = class Ye {
146
+ }, ae = class Xe {
147
147
  constructor(t, n) {
148
148
  this.refConfig = t, this.component = n, a(this, "myop", !0), a(this, "__nonProxied"), this.__nonProxied = ue(M({}, this), {
149
149
  component: null
@@ -161,42 +161,42 @@ var b = class {
161
161
  behavior: {
162
162
  type: "code"
163
163
  }
164
- }), new Ye(i, s);
164
+ }), new Xe(i, s);
165
165
  }
166
- }, Je = "ClickReplayMessage", qt = class extends A {
166
+ }, Ze = "ClickReplayMessage", jt = class extends A {
167
167
  constructor(e, t) {
168
- super(t), this.ref = e, a(this, "replyMessageKey", Je), a(this, "messageType", "BindClickMessage"), a(this, "cleanable", !0);
168
+ super(t), this.ref = e, a(this, "replyMessageKey", Ze), a(this, "messageType", "BindClickMessage"), a(this, "cleanable", !0);
169
169
  }
170
- }, Xe = class extends P {
170
+ }, et = class extends P {
171
171
  constructor() {
172
- super(...arguments), a(this, "messageType", Je);
172
+ super(...arguments), a(this, "messageType", Ze);
173
173
  }
174
- }, jt = class extends b {
174
+ }, Vt = class extends b {
175
175
  constructor(e, t) {
176
176
  super(), this.ref = e, a(this, "messageType", "ChangeTextMessage"), this.content = t;
177
177
  }
178
- }, Qe = "ExecuteScriptReplyMessage", Wt = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, Vt = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, Ze = (e) => {
179
- let t = e.match(Wt);
178
+ }, tt = "ExecuteScriptReplyMessage", Gt = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, Yt = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, nt = (e) => {
179
+ let t = e.match(Gt);
180
180
  if (t)
181
181
  return t[1] || t[3];
182
182
  {
183
- let n = e.match(Vt);
183
+ let n = e.match(Yt);
184
184
  if (n)
185
185
  return n[1].trim();
186
186
  }
187
- }, K = class extends A {
187
+ }, $ = class extends A {
188
188
  constructor(t, n = () => {
189
189
  }, s) {
190
- super(n), this.scriptInputs = s, a(this, "replyMessageKey", Qe), a(this, "messageType", "ExecuteScriptMessage"), a(this, "script", ""), this.script = t.toString(), this.content = t.toString(), this.content = Ze(this.content);
190
+ super(n), this.scriptInputs = s, a(this, "replyMessageKey", tt), a(this, "messageType", "ExecuteScriptMessage"), a(this, "script", ""), this.script = t.toString(), this.content = t.toString(), this.content = nt(this.content);
191
191
  }
192
192
  };
193
- a(K, "replierKey", "send");
194
- a(K, "completeStreamKey", "completeStream");
195
- var et = class extends P {
193
+ a($, "replierKey", "send");
194
+ a($, "completeStreamKey", "completeStream");
195
+ var st = class extends P {
196
196
  constructor(e, t) {
197
- super(e), this.replayToHandler = e, this.content = t, a(this, "messageType", Qe);
197
+ super(e), this.replayToHandler = e, this.content = t, a(this, "messageType", tt);
198
198
  }
199
- }, Se = class extends K {
199
+ }, xe = class extends $ {
200
200
  constructor(e, t, n = () => {
201
201
  }) {
202
202
  super(({ rootRef: s, elementId: i, _script: o, __scriptInputs: r }) => {
@@ -207,117 +207,117 @@ var et = class extends P {
207
207
  _script: e.toString()
208
208
  });
209
209
  }
210
- }, tt = "EventListenerCallbackMessage", Gt = class extends A {
210
+ }, it = "EventListenerCallbackMessage", Jt = class extends A {
211
211
  // {} // empty
212
212
  constructor(e, t, n) {
213
- super(n), this.ref = e, this.type = t, this.handler = n, a(this, "replyMessageKey", tt), a(this, "messageType", "AddEventListenerMessage"), a(this, "cleanable", !0), a(this, "serializableSkeleton", !1);
213
+ super(n), this.ref = e, this.type = t, this.handler = n, a(this, "replyMessageKey", it), a(this, "messageType", "AddEventListenerMessage"), a(this, "cleanable", !0), a(this, "serializableSkeleton", !1);
214
214
  }
215
215
  withSerializableSkeleton(e) {
216
216
  return this.serializableSkeleton = e, this;
217
217
  }
218
- }, nt = class extends P {
218
+ }, ot = class extends P {
219
219
  constructor(e, t) {
220
- super(e), this.replayToHandler = e, this.e = t, a(this, "messageType", tt), this.content = {
220
+ super(e), this.replayToHandler = e, this.e = t, a(this, "messageType", it), this.content = {
221
221
  e: t
222
222
  };
223
223
  }
224
- }, Yt = class extends b {
224
+ }, Qt = class extends b {
225
225
  constructor(e, t, n) {
226
226
  super(), this.ref = e, this.name = t, this.value = n, a(this, "messageType", "SetAttributeMessage");
227
227
  }
228
- }, st = "ElementValueReplayMessage", Jt = class extends A {
228
+ }, rt = "ElementValueReplayMessage", Xt = class extends A {
229
229
  constructor(e, t) {
230
- super(t), this.ref = e, a(this, "replyMessageKey", st), a(this, "messageType", "GetElementValueMessage");
230
+ super(t), this.ref = e, a(this, "replyMessageKey", rt), a(this, "messageType", "GetElementValueMessage");
231
231
  }
232
- }, it = class extends P {
232
+ }, at = class extends P {
233
233
  constructor(e) {
234
- super(), this.content = e, a(this, "messageType", st);
234
+ super(), this.content = e, a(this, "messageType", rt);
235
235
  }
236
- }, Xt = class extends b {
236
+ }, Zt = class extends b {
237
237
  constructor(e, t) {
238
238
  super(), this.ref = e, a(this, "messageType", "SetInnerHtml"), this.content = t;
239
239
  }
240
- }, He = class extends b {
240
+ }, ke = class extends b {
241
241
  constructor(e) {
242
242
  super(), a(this, "messageType", "InitMessage"), this.content = { id: e };
243
243
  }
244
244
  isTypeof(e) {
245
245
  return e.messageType === this.messageType;
246
246
  }
247
- }, ot = class extends He {
247
+ }, ct = class extends ke {
248
248
  constructor() {
249
249
  super(...arguments), a(this, "messageType", "InitResponse");
250
250
  }
251
- }, rt = class extends b {
251
+ }, lt = class extends b {
252
252
  constructor() {
253
253
  super(...arguments), a(this, "messageType", "InitRequest");
254
254
  }
255
- }, at = "RefComponentCreatedMessage", ct = class extends A {
255
+ }, dt = "RefComponentCreatedMessage", ut = class extends A {
256
256
  constructor(e, t, n, s) {
257
- super(s), this.refConfig = e, this.nestedComponentConfig = t, this.options = n, a(this, "replyMessageKey", at), a(this, "messageType", "CreateRefComponentMessage");
257
+ super(s), this.refConfig = e, this.nestedComponentConfig = t, this.options = n, a(this, "replyMessageKey", dt), a(this, "messageType", "CreateRefComponentMessage");
258
258
  }
259
- }, xe = class extends P {
259
+ }, Re = class extends P {
260
260
  constructor(e, t, n) {
261
- super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed = n, a(this, "messageType", at);
261
+ super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed = n, a(this, "messageType", dt);
262
262
  }
263
- }, lt = class extends b {
263
+ }, ht = class extends b {
264
264
  constructor(e, t) {
265
265
  super(), this.destination = e, this.message = t, a(this, "messageType", "EnvelopedMessage");
266
266
  const n = t;
267
267
  this.route = [e, ...n.route ? n.route : []];
268
268
  }
269
- }, dt = "DetectedMyopRefsMessage", Qt = class extends A {
269
+ }, pt = "DetectedMyopRefsMessage", en = class extends A {
270
270
  constructor() {
271
- super(...arguments), a(this, "messageType", "DetectMyopRefsMessage"), a(this, "replyMessageKey", dt);
271
+ super(...arguments), a(this, "messageType", "DetectMyopRefsMessage"), a(this, "replyMessageKey", pt);
272
272
  }
273
- }, ut = class extends P {
273
+ }, mt = class extends P {
274
274
  constructor(e, t) {
275
- super(e), this.replayToHandler = e, a(this, "messageType", dt), this.content = t;
275
+ super(e), this.replayToHandler = e, a(this, "messageType", pt), this.content = t;
276
276
  }
277
277
  isTypeof(e) {
278
278
  return e.messageType === this.messageType;
279
279
  }
280
- }, ht = "GetAttributeReplayMessage", Zt = class extends A {
280
+ }, ft = "GetAttributeReplayMessage", tn = class extends A {
281
281
  constructor(e, t, n) {
282
- super(n), this.ref = e, this.name = t, a(this, "replyMessageKey", ht), a(this, "messageType", "GetAttributeMessage");
282
+ super(n), this.ref = e, this.name = t, a(this, "replyMessageKey", ft), a(this, "messageType", "GetAttributeMessage");
283
283
  }
284
- }, en = class extends P {
284
+ }, nn = class extends P {
285
285
  constructor(e) {
286
- super(), this.content = e, a(this, "messageType", ht);
286
+ super(), this.content = e, a(this, "messageType", ft);
287
287
  }
288
- }, $ = class extends b {
288
+ }, N = class extends b {
289
289
  constructor(e) {
290
290
  super(), this.method = e, a(this, "messageType", "ExecuteComponentMethod");
291
291
  }
292
- }, tn = class extends b {
292
+ }, sn = class extends b {
293
293
  constructor() {
294
294
  super(...arguments), a(this, "messageType", "SetMutationObserverMessage");
295
295
  }
296
- }, nn = class extends b {
296
+ }, on = class extends b {
297
297
  constructor() {
298
298
  super(...arguments), a(this, "messageType", "MutationObserverMessage");
299
299
  }
300
- }, pt = "CleanupReplayMessage", mt = class extends A {
300
+ }, yt = "CleanupReplayMessage", gt = class extends A {
301
301
  constructor(e, t) {
302
- super(t), this.cleanupForMessageId = e, a(this, "replyMessageKey", pt), a(this, "messageType", "CleanupMessage");
302
+ super(t), this.cleanupForMessageId = e, a(this, "replyMessageKey", yt), a(this, "messageType", "CleanupMessage");
303
303
  }
304
- }, ft = class extends P {
304
+ }, vt = class extends P {
305
305
  constructor(e) {
306
- super(), this.customCleanup = e, a(this, "messageType", pt);
306
+ super(), this.customCleanup = e, a(this, "messageType", yt);
307
307
  }
308
- }, gt = class extends b {
308
+ }, wt = class extends b {
309
309
  constructor() {
310
310
  super(...arguments), a(this, "messageType", "DisposeMessage");
311
311
  }
312
- }, sn = class extends b {
312
+ }, rn = class extends b {
313
313
  constructor() {
314
314
  super(...arguments), a(this, "cleanable", !0), a(this, "messageType", "SetResizeObserverMessage");
315
315
  }
316
- }, on = class extends b {
316
+ }, an = class extends b {
317
317
  constructor() {
318
318
  super(...arguments), a(this, "messageType", "ResizeObserverMessage");
319
319
  }
320
- }, ke = class {
320
+ }, Me = class {
321
321
  constructor(e, t, n) {
322
322
  this.componentDefinition = e, this.container = t, a(this, "id", ""), a(this, "messageHandlers", {}), a(this, "element"), a(this, "_markedForDisposed", !1), a(this, "bind", (i, o) => {
323
323
  this.messageHandlers[i] || (this.messageHandlers[i] = []), this.messageHandlers[i].includes(o) || this.messageHandlers[i].push(o);
@@ -334,7 +334,7 @@ var et = class extends P {
334
334
  this.isInitiated = !0, this._whenInitiatedResolve && this._whenInitiatedResolve();
335
335
  }), a(this, "isInitiated", !1), a(this, "_whenInitiatedResolve"), a(this, "_whenInitiatedReject"), a(this, "_whenInitiated", new Promise((i, o) => {
336
336
  this._whenInitiatedResolve = i, this._whenInitiatedReject = o;
337
- })), a(this, "initiated", () => this._whenInitiated), a(this, "props", {}), a(this, "refs", {}), this.id = (n == null ? void 0 : n.id) || Me.Instance().assignId(e);
337
+ })), a(this, "initiated", () => this._whenInitiated), a(this, "props", {}), a(this, "refs", {}), this.id = (n == null ? void 0 : n.id) || be.Instance().assignId(e);
338
338
  const s = n != null && n.timeout ? n == null ? void 0 : n.timeout : 5 * 1e3;
339
339
  setTimeout(() => {
340
340
  !this.isInitiated && this._whenInitiatedReject && !this._markedForDisposed && this._whenInitiatedReject(`timeout_${s} ${this.id}`);
@@ -365,21 +365,21 @@ var et = class extends P {
365
365
  return !1;
366
366
  }
367
367
  sendCleanupMessage(e) {
368
- e.source = this.id, e.destination = this.id, e.direction = k.down;
368
+ e.source = this.id, e.destination = this.id, e.direction = D.down;
369
369
  const t = this.bindWhen(e.replyMessageKey, (s) => s.replayToHandler === e.handlerUniqueId, (s) => {
370
370
  e.handler(s), t();
371
371
  }), n = e.handler;
372
372
  delete e.handler, this.send(e), e.handler = n;
373
373
  }
374
374
  send(e) {
375
- e.source || (e.source = this.id), e.destination || (e.destination = this.id), e.direction = k.down;
375
+ e.source || (e.source = this.id), e.destination || (e.destination = this.id), e.direction = D.down;
376
376
  let t;
377
377
  if (e.handler) {
378
378
  const n = e;
379
379
  t = this.bindWhen(n.replyMessageKey, (s) => s.replayToHandler === n.handlerUniqueId, n.handler), delete e.handler;
380
380
  }
381
381
  return e.ref && (e.ref = e.ref.__nonProxied || e.ref), e.cleanable ? () => {
382
- this.sendCleanupMessage(new mt(e.id, (n) => {
382
+ this.sendCleanupMessage(new gt(e.id, (n) => {
383
383
  })), t && t();
384
384
  } : () => {
385
385
  };
@@ -387,39 +387,39 @@ var et = class extends P {
387
387
  dispose() {
388
388
  if (this.markedForDisposed = !0, !this.isInitiated)
389
389
  return;
390
- console.log("disposing component", this.id), this.send(new gt());
390
+ console.log("disposing component", this.id), this.send(new wt());
391
391
  const e = this.messageHandlers.onDispose;
392
392
  e && e.forEach((t) => {
393
393
  t(null);
394
394
  }), this.messageHandlers = {}, this.id += "_disposed", this.isInitiated = !1;
395
395
  }
396
- }, rn = class {
396
+ }, cn = class {
397
397
  constructor(e, t, n, s, i) {
398
398
  this.myopId = e, this.htmlTagName = t, this.BoundingRect = n, this.offsetTop = s, this.offsetLeft = i, a(this, "type", "MyopElementRef");
399
399
  }
400
- }, an = (e) => y(void 0, null, function* () {
400
+ }, ln = (e) => g(void 0, null, function* () {
401
401
  if (typeof e == "function")
402
402
  e();
403
403
  else if (e instanceof Promise) {
404
404
  const t = yield e;
405
405
  typeof t == "function" && t();
406
406
  }
407
- }), cn = class {
407
+ }), dn = class {
408
408
  //TODO : add dispose method
409
409
  constructor(e) {
410
410
  this.messageToHost = e;
411
411
  }
412
- }, ln = class extends cn {
412
+ }, un = class extends dn {
413
413
  constructor(e, t) {
414
414
  super(e), this.messageToHost = e, this.context = t;
415
415
  }
416
- }, dn = class {
416
+ }, hn = class {
417
417
  //onMessageReceived: (msg: IMyopMessage) => void;
418
418
  constructor(e, t) {
419
419
  this.id = e, this.context = t, a(this, "send", (n) => {
420
420
  });
421
421
  }
422
- }, un = class {
422
+ }, pn = class {
423
423
  constructor() {
424
424
  a(this, "messageToHandleAfterInit", []), a(this, "components", {}), a(this, "alwaysPassEnvelopesToHost", !1), a(this, "messageCleanupCache", {});
425
425
  }
@@ -427,7 +427,7 @@ var et = class extends P {
427
427
  const t = e.data ? e.data : e.detail;
428
428
  if (!(!t || !t.myop)) {
429
429
  let n = t;
430
- if (n.direction !== k.down)
430
+ if (n.direction !== D.down)
431
431
  return;
432
432
  if (n.messageType === v.DisposeMessage) {
433
433
  n.destination && delete this.components[n.destination];
@@ -437,7 +437,7 @@ var et = class extends P {
437
437
  const s = n.content.id;
438
438
  if (this.components[s])
439
439
  return;
440
- this.components[s] = new dn(s), this.messageToHost(new ot(s));
440
+ this.components[s] = new hn(s), this.messageToHost(new ct(s));
441
441
  return;
442
442
  }
443
443
  if (n.messageType === v.EnvelopedMessage) {
@@ -458,8 +458,8 @@ var et = class extends P {
458
458
  }
459
459
  if (n.messageType) {
460
460
  if (n.messageType === v.CleanupMessage) {
461
- const s = n, i = this.messageCleanupCache[s.cleanupForMessageId], o = new ft(!!i);
462
- o.destination = n.destination, i ? (delete this.messageCleanupCache[s.cleanupForMessageId], an(i).then(() => {
461
+ const s = n, i = this.messageCleanupCache[s.cleanupForMessageId], o = new vt(!!i);
462
+ o.destination = n.destination, i ? (delete this.messageCleanupCache[s.cleanupForMessageId], ln(i).then(() => {
463
463
  this.messageToHost(o, s);
464
464
  }).catch(() => {
465
465
  })) : this.messageToHost(o, s);
@@ -496,10 +496,10 @@ To ensure cleanup properly set 'cleanable' true at message definition and return
496
496
  localFrame: "localFrame"
497
497
  }, ve = {
498
498
  code: "code"
499
- }, De = class {
499
+ }, Le = class {
500
500
  };
501
- a(De, "code", "code");
502
- a(De, "component", "component");
501
+ a(Le, "code", "code");
502
+ a(Le, "component", "component");
503
503
  var re = {
504
504
  Segmented: "Segmented",
505
505
  Dedicated: "Dedicated",
@@ -510,33 +510,33 @@ var re = {
510
510
  * @type {string}
511
511
  */
512
512
  Default: "Default"
513
- }, yt = {
513
+ }, _t = {
514
514
  Segment: "Segment",
515
515
  Promo: "Promo",
516
516
  AB: "AB"
517
- }, hn = class {
517
+ }, mn = class {
518
518
  constructor(e, t) {
519
519
  this.container = e, this.shadowRoot = t, a(this, "getRootDiv", () => (this.shadowRoot || this.container).querySelector("div")), a(this, "getRoot", () => this.shadowRoot || this.container);
520
520
  }
521
- }, Re = (e) => e !== Object(e), pn = (e) => typeof e == "function", vt = (e) => {
522
- if (Re(e))
521
+ }, He = (e) => e !== Object(e), fn = (e) => typeof e == "function", Mt = (e) => {
522
+ if (He(e))
523
523
  return !0;
524
- if (pn(e) || Object.getPrototypeOf(e))
524
+ if (fn(e) || Object.getPrototypeOf(e))
525
525
  return !1;
526
526
  for (const t in e) {
527
527
  const n = e[t];
528
528
  if (typeof n == "object") {
529
- if (!vt(n))
529
+ if (!Mt(n))
530
530
  return !1;
531
531
  } else {
532
- if (Re(n))
532
+ if (He(n))
533
533
  continue;
534
534
  return !1;
535
535
  }
536
536
  }
537
537
  return !0;
538
- }, Y = (e, t = {}, n = !0, s = /* @__PURE__ */ new WeakMap()) => {
539
- if (Re(e))
538
+ }, J = (e, t = {}, n = !0, s = /* @__PURE__ */ new WeakMap()) => {
539
+ if (He(e))
540
540
  return e;
541
541
  if (Array.isArray(e)) {
542
542
  if (s.has(e))
@@ -545,7 +545,7 @@ var re = {
545
545
  s.set(e, i);
546
546
  for (let o = 0; o < e.length; o++) {
547
547
  const r = e[o];
548
- i[o] = Y(r, t, n, s);
548
+ i[o] = J(r, t, n, s);
549
549
  }
550
550
  return i;
551
551
  }
@@ -556,12 +556,12 @@ var re = {
556
556
  s.set(e, i);
557
557
  for (const o in e) {
558
558
  const r = typeof t == "boolean" ? t : t[o];
559
- r && (r === !0 ? (n ? e[o] !== void 0 : e[o]) && (i[o] = Y(e[o], !0, n, s)) : typeof r == "object" && (i[o] = Y(e[o], r, n, s)));
559
+ r && (r === !0 ? (n ? e[o] !== void 0 : e[o]) && (i[o] = J(e[o], !0, n, s)) : typeof r == "object" && (i[o] = J(e[o], r, n, s)));
560
560
  }
561
561
  return i;
562
562
  }
563
563
  return {};
564
- }, mn = {
564
+ }, yn = {
565
565
  notSerializableRefCall: (e, t) => {
566
566
  throw new Error(`
567
567
  The input provided to '${e.toString()}' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation.
@@ -595,38 +595,94 @@ For more details on serialization and Myop message examples, refer to https://do
595
595
 
596
596
  `);
597
597
  }
598
- }, $e = class extends ke {
598
+ }, We = class extends Me {
599
599
  constructor(e, t, n) {
600
600
  super(e, t.container, n), this.componentDefinition = e, this.parent = t, a(this, "send", (s) => {
601
601
  const i = s.handler, o = super.send(s);
602
- return this.parent.send(new lt(this.id, s)), s.handler = i, o;
602
+ return this.parent.send(new ht(this.id, s)), s.handler = i, o;
603
603
  }), a(this, "dispose", () => {
604
- this.isInitiated && this.send(new $("dispose")), super.dispose();
604
+ this.isInitiated && this.send(new N("dispose")), super.dispose();
605
605
  });
606
606
  }
607
607
  hide() {
608
- this.send(new $("hide"));
608
+ this.send(new N("hide"));
609
609
  }
610
610
  show() {
611
- this.send(new $("show"));
611
+ this.send(new N("show"));
612
612
  }
613
613
  inspect() {
614
- return this.send(new $("inspect"));
614
+ return this.send(new N("inspect"));
615
615
  }
616
616
  setHeightBasedOnDocumentElement() {
617
- this.send(new $("setHeightBasedOnDocumentElement"));
617
+ this.send(new N("setHeightBasedOnDocumentElement"));
618
618
  }
619
619
  setHeightBasedOnScrollHeight() {
620
- this.send(new $("setHeightBasedOnScrollHeight"));
620
+ this.send(new N("setHeightBasedOnScrollHeight"));
621
621
  }
622
622
  onMessageReceived(e) {
623
623
  return super.onMessageReceived(e);
624
624
  }
625
- }, fn = (e, t, n) => {
625
+ }, De = class extends Me {
626
+ constructor(e, t, n, s, i, o) {
627
+ super(e, n, o), this.container = n, this.customElement = s, this.tagName = i, a(this, "ctaCleanup"), a(this, "_ctaHandler"), a(this, "_ctaQueue", []), a(this, "cleanupInspect", () => {
628
+ }), a(this, "send", (r) => {
629
+ const c = super.send(r);
630
+ return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead", r), c;
631
+ }), a(this, "dispose", () => {
632
+ var r;
633
+ this.ctaCleanup && this.ctaCleanup(), super.dispose(), (r = this.customElement.parentNode) == null || r.removeChild(this.customElement);
634
+ }), this.element = s, this.setInitiated();
635
+ }
636
+ inspect() {
637
+ return this.cleanupInspect = Oe(this.id, "MyopExtractedWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
638
+ }
639
+ hide() {
640
+ 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";
641
+ }
642
+ show() {
643
+ 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 = "";
644
+ }
645
+ /**
646
+ * Initialize the component with data by calling myop_init_interface directly
647
+ */
648
+ initWithData(e) {
649
+ typeof this.customElement.myop_init_interface == "function" && this.customElement.myop_init_interface(e);
650
+ }
651
+ /**
652
+ * Get current data from the component
653
+ */
654
+ getData() {
655
+ if (typeof this.customElement.myop_init_interface == "function")
656
+ return this.customElement.myop_init_interface();
657
+ }
658
+ /**
659
+ * Set CTA handler - unified API with iframe components.
660
+ * Called via props.myop_cta_handler = handler
661
+ */
662
+ setCtaHandler(e) {
663
+ if (this.ctaCleanup && this.ctaCleanup(), this._ctaHandler = e, this._ctaQueue.length > 0) {
664
+ const n = [...this._ctaQueue];
665
+ this._ctaQueue = [], n.forEach((s) => {
666
+ this.markedForDisposed || e(s.action, s.payload);
667
+ });
668
+ }
669
+ const t = (n) => {
670
+ var s;
671
+ const i = n;
672
+ (s = i.detail) != null && s.action && (this._ctaHandler && !this.markedForDisposed ? this._ctaHandler(i.detail.action, i.detail.payload) : this._ctaHandler || this._ctaQueue.push({
673
+ action: i.detail.action,
674
+ payload: i.detail.payload
675
+ }));
676
+ };
677
+ this.customElement.addEventListener("myop-cta", t), this.ctaCleanup = () => {
678
+ this.customElement.removeEventListener("myop-cta", t);
679
+ };
680
+ }
681
+ }, gn = (e, t, n) => {
626
682
  const s = document.createElement("a");
627
683
  return s.textContent = e, s.style.position = "relative", s.style.padding = "0 5px", s.style.fontSize = "14px", s.style.top = "0", s.style.top = `${t}px`, s.style.transform = "translateX(-50%)", s.target = "_blank", s.href = `https://dashboard.myop.dev/dashboard/component/${n.id}`, s;
628
- }, wt = (e, t, n, s, i, o) => {
629
- const r = fn(`${o.name} : ${t}`, n, o);
684
+ }, Oe = (e, t, n, s, i, o) => {
685
+ const r = gn(`${o.name} : ${t}`, n, o);
630
686
  return s.insertBefore(r, i), i.style.border = "1px solid #007BFF", i.style.display = "block", () => {
631
687
  i.style.border = "unset", s.removeChild(r);
632
688
  };
@@ -641,7 +697,7 @@ Prop Name: ${t}
641
697
  Component: ${n.componentDefinition.name}, ID: ${n.componentDefinition.id}
642
698
 
643
699
  For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${n.componentDefinition.id} or consult the developer guide.`
644
- ), !0), Ne = (e, t, n) => {
700
+ ), !0), ze = (e, t, n) => {
645
701
  console.error(
646
702
  `Error: Code Prop Not Supported
647
703
 
@@ -655,7 +711,7 @@ Component: ${n.componentDefinition.name}, ID: ${n.componentDefinition.id}
655
711
 
656
712
  For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${n.componentDefinition.id} or consult the developer guide.`
657
713
  );
658
- }, gn = (e, t, n) => {
714
+ }, vn = (e, t, n) => {
659
715
  const s = t.reduce((o, r) => ue(M({}, o), {
660
716
  [r.name]: M({}, r)
661
717
  }), {}), i = {
@@ -664,11 +720,17 @@ For more information, refer to the component page https://dashboard.myop.dev/das
664
720
  if (Ke(c, r, e))
665
721
  return !1;
666
722
  if (c.behavior.type === ve.code) {
723
+ if (e instanceof De)
724
+ return (c.behavior.remap || r) === "myop_init_interface" ? (u) => {
725
+ if (u === void 0)
726
+ return e.getData();
727
+ e.initWithData(u);
728
+ } : void 0;
667
729
  if (n.loader.type === ce.HTMLLoader && n.loader.shadowRootMode === le.localFrame) {
668
730
  const d = c.behavior;
669
731
  return e.element.contentWindow[d.remap || r];
670
732
  }
671
- return Ne(c, r, e), !1;
733
+ return ze(c, r, e), !1;
672
734
  }
673
735
  return c.mode === "output" ? new Promise((l) => {
674
736
  const d = [];
@@ -684,17 +746,24 @@ For more information, refer to the component page https://dashboard.myop.dev/das
684
746
  if (Ke(l, r, e))
685
747
  return !1;
686
748
  if (l.behavior.type === ve.code) {
749
+ if (e instanceof De) {
750
+ const u = l.behavior.remap || r;
751
+ if (u === "myop_cta_handler")
752
+ return e.setCtaHandler(c), !0;
753
+ if (u === "myop_init_interface")
754
+ return e.initWithData(c), !0;
755
+ }
687
756
  if (n.loader.type === ce.HTMLLoader && n.loader.shadowRootMode === le.localFrame) {
688
757
  const u = l.behavior, h = e.element.contentWindow, f = u.remap || r;
689
758
  if (h[f] = c, f === "myop_cta_handler" && h.__myop_cta_queue) {
690
- const g = h.__myop_cta_queue;
691
- h.__myop_cta_queue = null, g.forEach((m) => {
759
+ const y = h.__myop_cta_queue;
760
+ h.__myop_cta_queue = null, y.forEach((m) => {
692
761
  e.markedForDisposed || c(m.action, m.payload);
693
762
  });
694
763
  }
695
764
  return !0;
696
765
  }
697
- return Ne(l, r, e), !1;
766
+ return ze(l, r, e), !1;
698
767
  } else if (l.mode === "input")
699
768
  if (l.behavior.type === "message") {
700
769
  const d = [];
@@ -717,12 +786,12 @@ Check the documentation for valid behavior options.`
717
786
  }
718
787
  };
719
788
  return e.props = {}, e.props = new Proxy(e.props, i), e;
720
- }, yn = (e, t) => new Proxy(e, {
789
+ }, wn = (e, t) => new Proxy(e, {
721
790
  get(n, s) {
722
791
  return n[s] ? n[s] : (...o) => new Promise((r) => {
723
792
  o.forEach((c) => {
724
- vt(c) || mn.notSerializableRefCall(s, c);
725
- }), t.send(new Se(
793
+ Mt(c) || yn.notSerializableRefCall(s, c);
794
+ }), t.send(new xe(
726
795
  ({ ref: c, propName: l, functionArgs: d, makeSerializable: u }) => {
727
796
  if (c) {
728
797
  const h = c[l];
@@ -743,7 +812,7 @@ Check the documentation for valid behavior options.`
743
812
  });
744
813
  },
745
814
  set(n, s, i) {
746
- return t.send(new Se(
815
+ return t.send(new xe(
747
816
  ({ ref: o, propName: r, propValue: c }) => {
748
817
  o && (o[r] = c);
749
818
  },
@@ -757,24 +826,24 @@ Check the documentation for valid behavior options.`
757
826
  }
758
827
  )), !0;
759
828
  }
760
- }), _t = (e, t, n, s) => y(void 0, null, function* () {
829
+ }), bt = (e, t, n, s) => g(void 0, null, function* () {
761
830
  const i = e.component;
762
831
  if (!i)
763
832
  throw new Error("cant createRefComponent with detached ref");
764
- return new Promise((o, r) => y(void 0, null, function* () {
765
- const c = new $e(t.type, i, s);
833
+ return new Promise((o, r) => g(void 0, null, function* () {
834
+ const c = new We(t.type, i, s);
766
835
  n.push(c), yield i.initiated();
767
836
  const l = setTimeout(() => {
768
837
  r("timeout");
769
838
  }, 5e3);
770
- i.send(new ct(
839
+ i.send(new ut(
771
840
  e.refConfig,
772
841
  t,
773
842
  ue(M({}, s || {}), {
774
843
  id: c.id,
775
844
  _hasParent: !0
776
845
  }),
777
- (d) => y(void 0, null, function* () {
846
+ (d) => g(void 0, null, function* () {
778
847
  if (clearTimeout(l), d.failed) {
779
848
  r("CreateRefComponentMessage failed");
780
849
  return;
@@ -786,22 +855,22 @@ Check the documentation for valid behavior options.`
786
855
  } else
787
856
  c.setInitiated(), i.refs[e.refConfig.name] = c;
788
857
  d.nestedRefs.forEach((h) => {
789
- const f = t.instance.resolvedNestedComponents.find((m) => m.type.id === h.componentDefinitionId).type, g = new $e(f, c);
790
- g.setInitiated(), c.refs[h.refName] = g, n.push(g);
858
+ const f = t.instance.resolvedNestedComponents.find((m) => m.type.id === h.componentDefinitionId).type, y = new We(f, c);
859
+ y.setInitiated(), c.refs[h.refName] = y, n.push(y);
791
860
  });
792
861
  try {
793
- yield Mt(c, t, n, !0), i.setHeightBasedOnScrollHeight && i.setHeightBasedOnScrollHeight(), o(c);
862
+ yield Et(c, t, n, !0), i.setHeightBasedOnScrollHeight && i.setHeightBasedOnScrollHeight(), o(c);
794
863
  } catch (h) {
795
864
  r(h);
796
865
  }
797
866
  })
798
867
  ));
799
868
  }));
800
- }), Mt = (e, t, n, s = !1) => y(void 0, null, function* () {
869
+ }), Et = (e, t, n, s = !1) => g(void 0, null, function* () {
801
870
  e.refs || (e.refs = {});
802
- const i = Object.values(e.componentDefinition.refs).map((o) => new Promise((r, c) => y(void 0, null, function* () {
871
+ const i = Object.values(e.componentDefinition.refs).map((o) => new Promise((r, c) => g(void 0, null, function* () {
803
872
  var l;
804
- if (o.behavior.type == De.component) {
873
+ if (o.behavior.type == Le.component) {
805
874
  if (s) {
806
875
  r();
807
876
  return;
@@ -813,7 +882,7 @@ Check the documentation for valid behavior options.`
813
882
  throw new Error("componentConfig provided without nestedComponentConfig check the config object");
814
883
  const h = ae.create("", o, e);
815
884
  try {
816
- const f = yield _t(h, u, n);
885
+ const f = yield bt(h, u, n);
817
886
  e.refs[o.name] = f, r();
818
887
  } catch (f) {
819
888
  c(f);
@@ -821,7 +890,7 @@ Check the documentation for valid behavior options.`
821
890
  } else
822
891
  try {
823
892
  const d = ae.create("", o, e);
824
- e.refs[o.name] = yn(d, e), r();
893
+ e.refs[o.name] = wn(d, e), r();
825
894
  } catch {
826
895
  }
827
896
  })));
@@ -830,13 +899,13 @@ Check the documentation for valid behavior options.`
830
899
  } catch (o) {
831
900
  throw o;
832
901
  }
833
- }), bt = class extends ke {
902
+ }), Ct = class extends Me {
834
903
  constructor(e, t, n, s, i) {
835
904
  super(e, n, i), this.componentConfig = e, this.container = n, this.IframeElement = s, a(this, "cleanupInspect"), a(this, "setHeightBasedOnDocumentElement", () => {
836
- const o = this.send(new K(() => window.document.documentElement.scrollHeight, (r) => {
905
+ const o = this.send(new $(() => window.document.documentElement.scrollHeight, (r) => {
837
906
  this.IframeElement.style.height = `${r.content}px`, o();
838
907
  }));
839
- }), a(this, "observeSizeBasedOnDocumentElement", () => this.send(new K(({ send: r }) => {
908
+ }), a(this, "observeSizeBasedOnDocumentElement", () => this.send(new $(({ send: r }) => {
840
909
  const { height: c, width: l } = document.documentElement.getBoundingClientRect(), d = new ResizeObserver(() => {
841
910
  const { height: u, width: h } = document.documentElement.getBoundingClientRect();
842
911
  r({ height: u, width: h });
@@ -850,27 +919,27 @@ Check the documentation for valid behavior options.`
850
919
  if (!l)
851
920
  return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"), () => {
852
921
  };
853
- const d = (C, I, L) => I !== void 0 && C < I ? I : L !== void 0 && C > L ? L : C, u = (C) => {
922
+ const d = (C, S, L) => S !== void 0 && C < S ? S : L !== void 0 && C > L ? L : C, u = (C) => {
854
923
  if (C === void 0) return;
855
924
  if (typeof C == "number") return C;
856
- const I = parseFloat(C);
857
- return isNaN(I) ? void 0 : I;
858
- }, h = u(o == null ? void 0 : o.minWidth), f = u(o == null ? void 0 : o.maxWidth), g = u(o == null ? void 0 : o.minHeight), m = u(o == null ? void 0 : o.maxHeight), x = (r = o == null ? void 0 : o.loaderMinHeight) != null ? r : 50, w = (o == null ? void 0 : o.explicitWidth) !== void 0, E = (o == null ? void 0 : o.explicitHeight) !== void 0, R = this.container.getBoundingClientRect(), D = R.width === 0, he = R.height === 0 || R.height === x, W = (o != null && o.forceAutoSize || D) && !w, U = (o != null && o.forceAutoSize || he) && !E;
859
- if (!W && !U)
925
+ const S = parseFloat(C);
926
+ return isNaN(S) ? void 0 : S;
927
+ }, h = u(o == null ? void 0 : o.minWidth), f = u(o == null ? void 0 : o.maxWidth), y = u(o == null ? void 0 : o.minHeight), m = u(o == null ? void 0 : o.maxHeight), x = (r = o == null ? void 0 : o.loaderMinHeight) != null ? r : 50, w = (o == null ? void 0 : o.explicitWidth) !== void 0, E = (o == null ? void 0 : o.explicitHeight) !== void 0, R = this.container.getBoundingClientRect(), k = R.width === 0, he = R.height === 0 || R.height === x, V = (o != null && o.forceAutoSize || k) && !w, z = (o != null && o.forceAutoSize || he) && !E;
928
+ if (!V && !z)
860
929
  return () => {
861
930
  };
862
931
  const pe = () => {
863
932
  var C;
864
- const I = c.contentDocument;
865
- if (I) {
866
- const L = I.documentElement.getBoundingClientRect(), Q = Math.ceil(L.width), Z = Math.ceil(L.height), ee = d(Q, h, f), _ = d(Z, g, m);
867
- W && (c.style.width = `${ee}px`), U && (c.style.height = `${_}px`);
868
- const q = W && f !== void 0 && Q > f, T = U && m !== void 0 && Z > m;
869
- I.documentElement.style.overflowX = q ? "auto" : "hidden", I.documentElement.style.overflowY = T ? "auto" : "hidden", (C = o == null ? void 0 : o.onSizeChange) == null || C.call(o, {
933
+ const S = c.contentDocument;
934
+ if (S) {
935
+ const L = S.documentElement.getBoundingClientRect(), X = Math.ceil(L.width), Z = Math.ceil(L.height), ee = d(X, h, f), _ = d(Z, y, m);
936
+ V && (c.style.width = `${ee}px`), z && (c.style.height = `${_}px`);
937
+ const q = V && f !== void 0 && X > f, I = z && m !== void 0 && Z > m;
938
+ S.documentElement.style.overflowX = q ? "auto" : "hidden", S.documentElement.style.overflowY = I ? "auto" : "hidden", (C = o == null ? void 0 : o.onSizeChange) == null || C.call(o, {
870
939
  width: ee,
871
940
  height: _,
872
- autoSizingWidth: W,
873
- autoSizingHeight: U
941
+ autoSizingWidth: V,
942
+ autoSizingHeight: z
874
943
  });
875
944
  }
876
945
  };
@@ -880,14 +949,14 @@ Check the documentation for valid behavior options.`
880
949
  me.disconnect();
881
950
  };
882
951
  }), a(this, "setSizeBasedOnDocumentElement", () => {
883
- const o = this.send(new K(() => {
952
+ const o = this.send(new $(() => {
884
953
  const { height: r, width: c } = document.documentElement.getBoundingClientRect();
885
954
  return { height: r, width: c };
886
955
  }, (r) => {
887
956
  this.IframeElement.style.width = `${r.content.width}px`, this.IframeElement.style.height = `${r.content.height}px`, o();
888
957
  }));
889
958
  }), a(this, "setHeightBasedOnScrollHeight", () => {
890
- const o = this.send(new K(() => {
959
+ const o = this.send(new $(() => {
891
960
  let c = 0;
892
961
  return c++, c--, Math.max(
893
962
  Math.max(
@@ -905,7 +974,7 @@ Check the documentation for valid behavior options.`
905
974
  if (l.messageType === v.ExecuteComponentMethod)
906
975
  return this[l.method](), () => {
907
976
  };
908
- l.direction = k.down;
977
+ l.direction = D.down;
909
978
  const d = super.send(l);
910
979
  return (c = (r = this.IframeElement) == null ? void 0 : r.contentWindow) == null || c.postMessage(l, "*"), d;
911
980
  }), a(this, "dispose", () => {
@@ -915,7 +984,7 @@ Check the documentation for valid behavior options.`
915
984
  }), this.element = this.IframeElement;
916
985
  }
917
986
  inspect() {
918
- return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect = wt(this.id, "MyopIframeComponent", 10, this.container, this.IframeElement, this.componentDefinition), () => {
987
+ return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect = Oe(this.id, "MyopIframeComponent", 10, this.container, this.IframeElement, this.componentDefinition), () => {
919
988
  this.cleanupInspect(), this.cleanupInspect = void 0;
920
989
  });
921
990
  }
@@ -928,7 +997,7 @@ Check the documentation for valid behavior options.`
928
997
  onMessageReceived(e) {
929
998
  return e.messageType === v.In.MutationObserverMessage || e.messageType === v.In.ResizeObserverMessage ? (this.setHeightBasedOnScrollHeight(), !0) : super.onMessageReceived(e);
930
999
  }
931
- }, Le = class {
1000
+ }, Pe = class {
932
1001
  constructor() {
933
1002
  a(this, "appendChild", (e, t, n) => {
934
1003
  var s;
@@ -943,18 +1012,18 @@ Check the documentation for valid behavior options.`
943
1012
  return e.appendChild(t);
944
1013
  });
945
1014
  }
946
- }, vn = (e, t, n) => {
1015
+ }, _n = (e, t, n) => {
947
1016
  const s = new URL(e);
948
1017
  return s.searchParams.append(t, n), s.toString();
949
- }, wn = class extends Le {
1018
+ }, Mn = class extends Pe {
950
1019
  constructor() {
951
- super(...arguments), a(this, "type", ce.IframeLoader), a(this, "load", (e, t, n, s) => y(this, null, function* () {
1020
+ super(...arguments), a(this, "type", ce.IframeLoader), a(this, "load", (e, t, n, s) => g(this, null, function* () {
952
1021
  let i;
953
1022
  const o = t.loader;
954
1023
  if ((n == null ? void 0 : n.nodeName) === "IFRAME")
955
1024
  console.log("needs to load into an exsisting Iframe...", o.url, n), i = n, i.src = o.url;
956
1025
  else {
957
- const r = J(), c = `myop-comp-${r}`;
1026
+ const r = j(), c = `myop-comp-${r}`;
958
1027
  i = document.createElement("iframe"), i.id = c;
959
1028
  const l = `
960
1029
  padding: 0;
@@ -972,19 +1041,19 @@ Check the documentation for valid behavior options.`
972
1041
  h === "" || h === null || h === void 0 ? i.setAttribute(u, "") : i.setAttribute(u, String(h));
973
1042
  });
974
1043
  let d = t.loader.url;
975
- s != null && s._hasParent && (d = vn(d, "_myop-comp", r)), i.src = d, n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), i = this.appendChild(n, i, s);
1044
+ s != null && s._hasParent && (d = _n(d, "_myop-comp", r)), i.src = d, n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), i = this.appendChild(n, i, s);
976
1045
  }
977
- return new bt(e, t, n, i, s);
1046
+ return new Ct(e, t, n, i, s);
978
1047
  }));
979
1048
  }
980
- }, Et = {
1049
+ }, St = {
981
1050
  webcomponent_message_key: "myop_webcomponent_message"
982
- }, Ct = class extends ke {
1051
+ }, It = class extends Me {
983
1052
  constructor(e, t, n, s, i) {
984
1053
  super(e, n, i), this.container = n, this.customElement = s, a(this, "cleanupInspect", () => {
985
1054
  }), a(this, "send", (o) => {
986
1055
  let r = M({}, o);
987
- const c = super.send(r), l = new CustomEvent(Et.webcomponent_message_key, {
1056
+ const c = super.send(r), l = new CustomEvent(St.webcomponent_message_key, {
988
1057
  // @ts-ignore
989
1058
  detail: r
990
1059
  // bubbles: true,
@@ -1003,7 +1072,7 @@ Check the documentation for valid behavior options.`
1003
1072
  }), this.element = s;
1004
1073
  }
1005
1074
  inspect() {
1006
- return this.cleanupInspect = wt(this.id, "MyopWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
1075
+ return this.cleanupInspect = Oe(this.id, "MyopWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
1007
1076
  }
1008
1077
  hide() {
1009
1078
  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";
@@ -1011,24 +1080,24 @@ Check the documentation for valid behavior options.`
1011
1080
  show() {
1012
1081
  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 = "";
1013
1082
  }
1014
- }, Ce = {}, _n = class extends Le {
1083
+ }, Se = {}, bn = class extends Pe {
1015
1084
  constructor() {
1016
- super(...arguments), a(this, "type", ce.WebComponentLoader), a(this, "load", (e, t, n, s) => y(this, null, function* () {
1085
+ super(...arguments), a(this, "type", ce.WebComponentLoader), a(this, "load", (e, t, n, s) => g(this, null, function* () {
1017
1086
  const i = t.loader;
1018
- Ce[i.url] ? console.log("Module alreday loaded or in loading process") : Ce[i.url] = new Promise((c, l) => {
1087
+ Se[i.url] ? console.log("Module alreday loaded or in loading process") : Se[i.url] = new Promise((c, l) => {
1019
1088
  const d = i.url, u = document.createElement("script");
1020
1089
  u.type = "module", u.src = d, u.onload = () => {
1021
1090
  c();
1022
1091
  }, u.onerror = () => {
1023
1092
  l();
1024
1093
  }, document.head.appendChild(u);
1025
- }), yield Ce[i.url], yield zt(1);
1026
- let o = `myop-comp-${J()}`;
1094
+ }), yield Se[i.url], yield qt(1);
1095
+ let o = `myop-comp-${j()}`;
1027
1096
  const r = document.createElement(i.tag);
1028
- return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), r.id = o, s != null && s.hidden && (r.style.opacity = "0", r.style.position = "absolute", r.style.height = "0", r.style.width = "0", r.style.pointerEvents = "none", r.style.visibility = "hidden"), s != null && s._environment && (r._myopEnvironment = s == null ? void 0 : s._environment), this.appendChild(n, r, s), new Ct(e, t, n, r, s);
1097
+ return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), r.id = o, s != null && s.hidden && (r.style.opacity = "0", r.style.position = "absolute", r.style.height = "0", r.style.width = "0", r.style.pointerEvents = "none", r.style.visibility = "hidden"), s != null && s._environment && (r._myopEnvironment = s == null ? void 0 : s._environment), this.appendChild(n, r, s), new It(e, t, n, r, s);
1029
1098
  }));
1030
1099
  }
1031
- }, Mn = "0.3.13", B = class extends ln {
1100
+ }, En = "0.3.17", B = class extends un {
1032
1101
  constructor(e, t) {
1033
1102
  super(e), this.context = t, a(this, "executor", (n) => {
1034
1103
  if (n.destination) {
@@ -1049,13 +1118,13 @@ Check the documentation for valid behavior options.`
1049
1118
  }
1050
1119
  }, de = {
1051
1120
  id: "myop-id"
1052
- }, X = (e, t) => t.querySelectorAll(`[${de.id}='${e.refConfig.selector}']`), bn = class extends B {
1121
+ }, Q = (e, t) => t.querySelectorAll(`[${de.id}='${e.refConfig.selector}']`), Cn = class extends B {
1053
1122
  constructor() {
1054
1123
  super(...arguments), a(this, "messageType", v.BindClickMessage), a(this, "innerExecutor", (e, t, n) => {
1055
- const s = X(e.ref, t.shadowRoot), i = [];
1124
+ const s = Q(e.ref, t.shadowRoot), i = [];
1056
1125
  return s.forEach((o) => {
1057
1126
  const r = () => {
1058
- n(new Xe(e.handlerUniqueId));
1127
+ n(new et(e.handlerUniqueId));
1059
1128
  };
1060
1129
  o.addEventListener("click", r), i.push(() => {
1061
1130
  o.removeEventListener("click", r);
@@ -1065,44 +1134,44 @@ Check the documentation for valid behavior options.`
1065
1134
  };
1066
1135
  });
1067
1136
  }
1068
- }, En = class extends B {
1137
+ }, Sn = class extends B {
1069
1138
  constructor() {
1070
1139
  super(...arguments), a(this, "messageType", v.ChangeTextMessage), a(this, "innerExecutor", (e, t) => {
1071
- X(e.ref, t.shadowRoot).forEach((s) => {
1140
+ Q(e.ref, t.shadowRoot).forEach((s) => {
1072
1141
  s.textContent = e.content;
1073
1142
  });
1074
1143
  });
1075
1144
  }
1076
- }, Cn = class extends hn {
1145
+ }, In = class extends mn {
1077
1146
  constructor(e, t) {
1078
1147
  super(e, t), this.container = e, this.shadowRoot = t;
1079
1148
  }
1080
- }, In = class extends B {
1149
+ }, Tn = class extends B {
1081
1150
  constructor() {
1082
1151
  super(...arguments), a(this, "innerExecutor", (e, t) => {
1083
1152
  const n = t.shadowRoot.querySelectorAll(`[${de.id}]`);
1084
1153
  let s = [];
1085
1154
  n.forEach((i) => {
1086
1155
  const o = i.getAttribute(de.id);
1087
- o && s.push(new rn(o, i.tagName, i.getBoundingClientRect(), i.offsetTop, i.offsetLeft));
1088
- }), this.messageToHost(new ut(e.handlerUniqueId, s));
1156
+ o && s.push(new cn(o, i.tagName, i.getBoundingClientRect(), i.offsetTop, i.offsetLeft));
1157
+ }), this.messageToHost(new mt(e.handlerUniqueId, s));
1089
1158
  }), a(this, "messageType", v.DetectMyopRefsMessage);
1090
1159
  }
1091
- }, Tn = class extends B {
1160
+ }, xn = class extends B {
1092
1161
  constructor() {
1093
1162
  super(...arguments), a(this, "messageType", v.SetAttributeMessage), a(this, "innerExecutor", (e, t) => {
1094
- X(e.ref, t.shadowRoot).forEach((s) => {
1163
+ Q(e.ref, t.shadowRoot).forEach((s) => {
1095
1164
  s.setAttribute(e.name, e.value);
1096
1165
  });
1097
1166
  });
1098
1167
  }
1099
- }, Sn = class extends B {
1168
+ }, Rn = class extends B {
1100
1169
  constructor() {
1101
1170
  super(...arguments), a(this, "messageType", v.AddEventListenerMessage), a(this, "innerExecutor", (e, t, n) => {
1102
- const s = X(e.ref, t.shadowRoot), i = [];
1171
+ const s = Q(e.ref, t.shadowRoot), i = [];
1103
1172
  return s.forEach((o) => {
1104
1173
  const r = (c) => {
1105
- n(new nt(e.handlerUniqueId, Y(c, e.serializableSkeleton)));
1174
+ n(new ot(e.handlerUniqueId, J(c, e.serializableSkeleton)));
1106
1175
  };
1107
1176
  o.addEventListener(e.type, r), i.push(() => {
1108
1177
  o.removeEventListener(e.type, r);
@@ -1112,13 +1181,13 @@ Check the documentation for valid behavior options.`
1112
1181
  };
1113
1182
  });
1114
1183
  }
1115
- }, xn = class extends B {
1184
+ }, Hn = class extends B {
1116
1185
  constructor() {
1117
1186
  super(...arguments), a(this, "messageType", v.CreateRefComponentMessage), a(this, "innerExecutor", (e, t, n) => {
1118
- y(this, null, function* () {
1187
+ g(this, null, function* () {
1119
1188
  const i = t.shadowRoot.querySelectorAll(`[${de.id}='${e.refConfig.selector}']`);
1120
1189
  if (i.length === 1) {
1121
- const o = Me.Instance(), r = o.components.find((u) => u.id === e.options.id);
1190
+ const o = be.Instance(), r = o.components.find((u) => u.id === e.options.id);
1122
1191
  r && r.dispose();
1123
1192
  const c = o.components.indexOf(r);
1124
1193
  c !== -1 && o.components.splice(c, 1);
@@ -1133,28 +1202,28 @@ Check the documentation for valid behavior options.`
1133
1202
  refName: u,
1134
1203
  componentDefinitionId: h.componentDefinition.id
1135
1204
  });
1136
- }), n(new xe(e.handlerUniqueId, d));
1205
+ }), n(new Re(e.handlerUniqueId, d));
1137
1206
  } else {
1138
- console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new xe(e.handlerUniqueId, [], !0));
1207
+ console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new Re(e.handlerUniqueId, [], !0));
1139
1208
  debugger;
1140
1209
  }
1141
1210
  }).then();
1142
1211
  });
1143
1212
  }
1144
- }, Rn = (e, t, n) => {
1213
+ }, Dn = (e, t, n) => {
1145
1214
  const s = e.scriptInputs ? e.scriptInputs : {};
1146
- s.makeSerializable = Y, s.send = t, s.rootRef = n, s.__scriptInputs = s;
1215
+ s.makeSerializable = J, s.send = t, s.rootRef = n, s.__scriptInputs = s;
1147
1216
  const o = new Function(`return (${e.script})(...arguments)`)(s);
1148
1217
  t(o);
1149
- }, Hn = class extends B {
1218
+ }, kn = class extends B {
1150
1219
  constructor() {
1151
1220
  super(...arguments), a(this, "messageType", v.ExecuteScriptMessage), a(this, "innerExecutor", (e, t, n) => {
1152
- Rn(e, (i) => {
1153
- n(new et(e.handlerUniqueId, i));
1221
+ Dn(e, (i) => {
1222
+ n(new st(e.handlerUniqueId, i));
1154
1223
  }, t);
1155
1224
  });
1156
1225
  }
1157
- }, It = (e) => {
1226
+ }, Tt = (e) => {
1158
1227
  if (!e) return null;
1159
1228
  if (e.tagName === "FORM") {
1160
1229
  new FormData(e);
@@ -1169,9 +1238,9 @@ Check the documentation for valid behavior options.`
1169
1238
  const r = {
1170
1239
  id: s.id,
1171
1240
  name: o,
1172
- value: It(s),
1241
+ value: Tt(s),
1173
1242
  required: s.required,
1174
- validity: Y(s.validity, !0),
1243
+ validity: J(s.validity, !0),
1175
1244
  myopId: i
1176
1245
  };
1177
1246
  o ? t.formData[o] ? t.formData[o].value ? t.unmappedData.push(r) : (t.unmappedData.push(t.formData[o]), t.formData[o] = r) : t.formData[o] = r : t.unmappedData.push(r);
@@ -1179,26 +1248,26 @@ Check the documentation for valid behavior options.`
1179
1248
  }), t;
1180
1249
  }
1181
1250
  return e.type === "checkbox" || e.type === "radio" ? e.checked ? e.value : null : e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" ? e.value : e.isContentEditable ? e.innerText || e.textContent : null;
1182
- }, kn = class extends B {
1251
+ }, Ln = class extends B {
1183
1252
  constructor() {
1184
1253
  super(...arguments), a(this, "messageType", v.GetElementValueMessage), a(this, "innerExecutor", (e, t, n) => {
1185
- X(e.ref, t.shadowRoot).forEach((i) => {
1186
- n(new it(It(i)), e);
1254
+ Q(e.ref, t.shadowRoot).forEach((i) => {
1255
+ n(new at(Tt(i)), e);
1187
1256
  });
1188
1257
  });
1189
1258
  }
1190
- }, Dn = class extends B {
1259
+ }, On = class extends B {
1191
1260
  constructor() {
1192
1261
  super(...arguments), a(this, "messageType", v.SetInnerHtml), a(this, "innerExecutor", (e, t) => {
1193
- X(e.ref, t.shadowRoot).forEach((s) => {
1262
+ Q(e.ref, t.shadowRoot).forEach((s) => {
1194
1263
  s.innerHTML = e.content;
1195
1264
  });
1196
1265
  });
1197
1266
  }
1198
- }, Tt = class extends un {
1267
+ }, xt = class extends pn {
1199
1268
  constructor() {
1200
1269
  super(...arguments), a(this, "alwaysPassEnvelopesToHost", !0), a(this, "connectedCallback", (e, t) => {
1201
- e.addEventListener(Et.webcomponent_message_key, (n) => {
1270
+ e.addEventListener(St.webcomponent_message_key, (n) => {
1202
1271
  const s = n.data ? n.data : n.detail;
1203
1272
  if (!s || !s.myop) {
1204
1273
  debugger;
@@ -1207,52 +1276,54 @@ Check the documentation for valid behavior options.`
1207
1276
  const i = s;
1208
1277
  if (this.handleIncomeMessages(n), i.messageType === v.InitMessage) {
1209
1278
  const o = i.content.id;
1210
- this.components[o].context = new Cn(e, t);
1279
+ this.components[o].context = new In(e, t);
1211
1280
  }
1212
1281
  }
1213
1282
  }), setTimeout(() => {
1214
- this.messageToHost(new rt());
1283
+ this.messageToHost(new lt());
1215
1284
  }, 1);
1216
1285
  }), a(this, "messageToHost", (e, t) => {
1217
- e.direction = k.up, !e.replayToHandler && (t != null && t.handlerUniqueId) && (e.replayToHandler = t.handlerUniqueId), window.myop.hostSDK.send(e);
1286
+ e.direction = D.up, !e.replayToHandler && (t != null && t.handlerUniqueId) && (e.replayToHandler = t.handlerUniqueId), window.myop.hostSDK.send(e);
1218
1287
  }), a(this, "supportedHandlers", [
1219
- new En(this.messageToHost, this.components),
1220
- new Dn(this.messageToHost, this.components),
1221
- new bn(this.messageToHost, this.components),
1222
- new In(this.messageToHost, this.components),
1223
- new Tn(this.messageToHost, this.components),
1224
1288
  new Sn(this.messageToHost, this.components),
1225
- new Hn(this.messageToHost, this.components),
1289
+ new On(this.messageToHost, this.components),
1290
+ new Cn(this.messageToHost, this.components),
1291
+ new Tn(this.messageToHost, this.components),
1292
+ new xn(this.messageToHost, this.components),
1293
+ new Rn(this.messageToHost, this.components),
1226
1294
  new kn(this.messageToHost, this.components),
1295
+ new Ln(this.messageToHost, this.components),
1227
1296
  //
1228
- new xn(this.messageToHost, this.components)
1297
+ new Hn(this.messageToHost, this.components)
1229
1298
  ]), a(this, "init", () => {
1230
1299
  });
1231
1300
  }
1232
1301
  };
1233
- Ge("WebComponentSDK", Tt);
1234
- var ze = [], ye, St = () => y(void 0, null, function* () {
1235
- return ye || (ye = new Tt(), ye.init()), ye;
1302
+ Qe("WebComponentSDK", xt);
1303
+ var Pn = "<!-- myop-web-component -->", An = "myop-web-component", qe = /* @__PURE__ */ new Set(), Ue = [], ge, Rt = () => g(void 0, null, function* () {
1304
+ return ge || (ge = new xt(), ge.init()), ge;
1236
1305
  });
1237
- function Ln(e, t) {
1306
+ function Bn(e, t) {
1238
1307
  return class extends HTMLElement {
1239
1308
  connectedCallback() {
1240
1309
  const n = t === le.open ? "open" : "closed", s = this.attachShadow({ mode: n });
1241
- St().then((i) => {
1310
+ Rt().then((i) => {
1242
1311
  i.connectedCallback(this, s), s.innerHTML = e;
1243
1312
  });
1244
1313
  }
1245
1314
  };
1246
1315
  }
1247
- var On = (e, t, n) => {
1248
- customElements.define(e, Ln(t, n)), console.log(`define('${e}') was called, web component ready to use`);
1249
- }, Pn = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/(\d+)/g, "-$1").toLowerCase(), An = (e) => (e = Pn(e), e.replace(/_/g, "-")), Bn = class extends Le {
1316
+ var Fn = (e, t, n) => {
1317
+ customElements.define(e, Bn(t, n)), console.log(`define('${e}') was called, web component ready to use`);
1318
+ }, Nn = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/(\d+)/g, "-$1").toLowerCase(), $n = (e) => (e = Nn(e), e.replace(/_/g, "-")), Wn = class extends Pe {
1250
1319
  constructor() {
1251
- super(...arguments), a(this, "type", ce.HTMLLoader), a(this, "load", (e, t, n, s) => y(this, null, function* () {
1320
+ super(...arguments), a(this, "type", ce.HTMLLoader), a(this, "load", (e, t, n, s) => g(this, null, function* () {
1252
1321
  const i = t.loader;
1253
- let o = `myop-comp-${J()}`, r;
1322
+ if (this.isMyopWebComponent(i.HTML))
1323
+ return this.loadExtractedWebComponent(e, t, n, i.HTML, s);
1324
+ let o = `myop-comp-${j()}`, r;
1254
1325
  if (i.shadowRootMode === le.localFrame) {
1255
- const l = `myop-comp-${J()}`;
1326
+ const l = `myop-comp-${j()}`;
1256
1327
  let d = document.createElement("iframe");
1257
1328
  d.id = l, d.style.cssText = `
1258
1329
  display: block;
@@ -1280,14 +1351,14 @@ var On = (e, t, n) => {
1280
1351
  beforeKeysWindow,
1281
1352
  };
1282
1353
  <\/script>`;
1283
- const D = R.body.firstChild;
1284
- D && w.head && w.head.insertBefore(w.importNode(D, !0), w.head.firstChild), h = w.documentElement.outerHTML;
1285
- } else {
1354
+ const k = R.body.firstChild;
1355
+ k && w.head && w.head.insertBefore(w.importNode(k, !0), w.head.firstChild), h = w.documentElement.outerHTML;
1356
+ } else if ((s == null ? void 0 : s.data) !== void 0) {
1286
1357
  const w = new DOMParser().parseFromString(i.HTML, "text/html"), E = w.getElementById("myop_preview");
1287
1358
  E && (E.remove(), h = w.documentElement.outerHTML);
1288
1359
  }
1289
1360
  u.writeln(h);
1290
- const f = `<script>${Ot}<\/script>`;
1361
+ const f = `<script>${At}<\/script>`;
1291
1362
  if (u.writeln(`${f}<script>
1292
1363
  const __myop_init = async () => {
1293
1364
  const iframeModule = await MyopSDK.getIframeModule();
@@ -1366,24 +1437,75 @@ var On = (e, t, n) => {
1366
1437
  u.writeln(x + E);
1367
1438
  }
1368
1439
  u.close();
1369
- const m = new bt(e, t, n, d, s);
1440
+ const m = new Ct(e, t, n, d, s);
1370
1441
  return i.autoHeight && (d.onload = () => {
1371
1442
  m.observeSizeBasedOnDocumentElement();
1372
1443
  }), m;
1373
1444
  }
1374
1445
  if (i.shadowRootMode === le.none) {
1375
1446
  const c = document.createElement("template");
1376
- c.innerHTML = i.HTML, r = c.content.firstElementChild, St().then((l) => {
1447
+ c.innerHTML = i.HTML, r = c.content.firstElementChild, Rt().then((l) => {
1377
1448
  l.connectedCallback(r, r);
1378
1449
  });
1379
1450
  } else {
1380
- const c = An(e.name + t.id);
1381
- ze.includes(c) || (On(c, i.HTML, i.shadowRootMode), ze.push(c)), r = document.createElement(c);
1451
+ const c = $n(e.name + t.id);
1452
+ Ue.includes(c) || (Fn(c, i.HTML, i.shadowRootMode), Ue.push(c)), r = document.createElement(c);
1382
1453
  }
1383
- return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), r.id = o, s != null && s.hidden && (r.style.opacity = "0", r.style.position = "absolute", r.style.height = "0", r.style.width = "0", r.style.pointerEvents = "none", r.style.visibility = "hidden"), this.appendChild(n, r, s), new Ct(e, t, n, r, s);
1454
+ return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), r.id = o, s != null && s.hidden && (r.style.opacity = "0", r.style.position = "absolute", r.style.height = "0", r.style.width = "0", r.style.pointerEvents = "none", r.style.visibility = "hidden"), this.appendChild(n, r, s), new It(e, t, n, r, s);
1384
1455
  }));
1385
1456
  }
1386
- }, Fn = (e) => ({
1457
+ /**
1458
+ * Detect if HTML is a Myop Web Component (starts with marker comment)
1459
+ */
1460
+ isMyopWebComponent(e) {
1461
+ return e.trimStart().startsWith(Pn);
1462
+ }
1463
+ /**
1464
+ * Extract the web component script content from HTML
1465
+ */
1466
+ extractWebComponentScript(e) {
1467
+ const s = new DOMParser().parseFromString(e, "text/html").getElementById(An);
1468
+ return (s == null ? void 0 : s.textContent) || null;
1469
+ }
1470
+ /**
1471
+ * Execute the web component script on the host document
1472
+ */
1473
+ executeWebComponentScript(e, t) {
1474
+ if (qe.has(t)) {
1475
+ console.log(`[MyopWebComponent] Script already executed for ${t}, skipping`);
1476
+ return;
1477
+ }
1478
+ const n = document.createElement("script");
1479
+ n.textContent = e, n.id = `myop-extracted-${t}`, document.head.appendChild(n), qe.add(t), console.log(`[MyopWebComponent] Executed web component script: ${t}`);
1480
+ }
1481
+ /**
1482
+ * Load a Myop Web Component (extracted and run on host document)
1483
+ */
1484
+ loadExtractedWebComponent(e, t, n, s, i) {
1485
+ return g(this, null, function* () {
1486
+ const o = this.extractWebComponentScript(s);
1487
+ if (!o)
1488
+ throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');
1489
+ const r = `${e.id}-${t.id}`, c = window.__MYOP_TAG_NAME__;
1490
+ this.executeWebComponentScript(o, r);
1491
+ const l = window.__MYOP_TAG_NAME__;
1492
+ if (!l)
1493
+ throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");
1494
+ c && c !== l && console.warn(`[MyopWebComponent] __MYOP_TAG_NAME__ changed from ${c} to ${l}`);
1495
+ const d = `myop-comp-${j()}`, u = document.createElement(l);
1496
+ u.id = d, i != null && i.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"), n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), this.appendChild(n, u, i);
1497
+ const h = new De(
1498
+ e,
1499
+ t,
1500
+ n,
1501
+ u,
1502
+ l,
1503
+ i
1504
+ );
1505
+ return (i == null ? void 0 : i.data) !== void 0 && h.initWithData(i.data), console.log(`[MyopWebComponent] Loaded <${l}> into container`), h;
1506
+ });
1507
+ }
1508
+ }, Kn = (e) => ({
1387
1509
  instance: {
1388
1510
  id: "auto",
1389
1511
  componentId: e.componentId,
@@ -1431,20 +1553,20 @@ var On = (e, t, n) => {
1431
1553
  defaultSkin: 0
1432
1554
  },
1433
1555
  name: e.name
1434
- }), we = "__MYOP_CLOUD_REPOSITORY_MAIN__", $n = () => {
1556
+ }), we = "__MYOP_CLOUD_REPOSITORY_MAIN__", zn = () => {
1435
1557
  if (typeof window < "u")
1436
1558
  return window[we];
1437
1559
  if (typeof globalThis < "u")
1438
1560
  return globalThis[we];
1439
- }, Kn = (e) => {
1561
+ }, qn = (e) => {
1440
1562
  typeof window < "u" && (window[we] = e), typeof globalThis < "u" && (globalThis[we] = e);
1441
- }, xt = class V {
1563
+ }, Ht = class G {
1442
1564
  constructor(t = "https://cloud.myop.dev") {
1443
1565
  this._baseUrl = t, a(this, "variants", {}), a(this, "preloadedComponents", {}), a(this, "userFlows", {}), a(this, "_defaultEnv", "production");
1444
1566
  }
1445
1567
  static get Main() {
1446
- const t = $n();
1447
- return t || (V._main || (V._main = new V(), Kn(V._main)), V._main);
1568
+ const t = zn();
1569
+ return t || (G._main || (G._main = new G(), qn(G._main)), G._main);
1448
1570
  }
1449
1571
  /**
1450
1572
  * Set the default environment for this CloudRepository instance
@@ -1478,7 +1600,7 @@ var On = (e, t, n) => {
1478
1600
  * If env/preview not specified and component was preloaded, uses preloaded params
1479
1601
  */
1480
1602
  fetchComponentV2(t, n, s) {
1481
- return y(this, null, function* () {
1603
+ return g(this, null, function* () {
1482
1604
  const i = this.preloadedComponents[t], o = n !== void 0 || s !== void 0;
1483
1605
  let r, c;
1484
1606
  !o && i ? (r = i.env, c = i.preview) : (r = n || this._defaultEnv, c = s === !0 ? !0 : s === !1 ? !1 : !n);
@@ -1490,7 +1612,7 @@ var On = (e, t, n) => {
1490
1612
  cacheKey: l,
1491
1613
  cached: l in this.variants
1492
1614
  }), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: r, preview: c }), this.variants[l] = new Promise(
1493
- (d, u) => y(this, null, function* () {
1615
+ (d, u) => g(this, null, function* () {
1494
1616
  try {
1495
1617
  let h = `${this._baseUrl}/consume?id=${t}&env=${r}`;
1496
1618
  c && (h += "&preview=true");
@@ -1503,7 +1625,7 @@ var On = (e, t, n) => {
1503
1625
  u(new Error(`Component "${t}" has no implementation for environment "${r}"`));
1504
1626
  return;
1505
1627
  }
1506
- const x = Fn(m);
1628
+ const x = Kn(m);
1507
1629
  d(x);
1508
1630
  } catch (h) {
1509
1631
  u(h);
@@ -1517,14 +1639,14 @@ var On = (e, t, n) => {
1517
1639
  * Fetch a v1 component from a flow
1518
1640
  */
1519
1641
  fetchComponentV1(t, n) {
1520
- return y(this, null, function* () {
1642
+ return g(this, null, function* () {
1521
1643
  return n ? (yield this.fetchFlow(n)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
1522
1644
  });
1523
1645
  }
1524
1646
  fetchAutoFlow(t) {
1525
- return y(this, null, function* () {
1647
+ return g(this, null, function* () {
1526
1648
  return this.userFlows[t] || (this.userFlows[t] = new Promise(
1527
- (n, s) => y(this, null, function* () {
1649
+ (n, s) => g(this, null, function* () {
1528
1650
  try {
1529
1651
  const o = yield (yield fetch(
1530
1652
  `${this._baseUrl}/flow?id=${t}&auto=true`
@@ -1538,9 +1660,9 @@ var On = (e, t, n) => {
1538
1660
  });
1539
1661
  }
1540
1662
  fetchFlow(t) {
1541
- return y(this, null, function* () {
1663
+ return g(this, null, function* () {
1542
1664
  return this.userFlows[t] || (this.userFlows[t] = new Promise(
1543
- (n, s) => y(this, null, function* () {
1665
+ (n, s) => g(this, null, function* () {
1544
1666
  try {
1545
1667
  const o = yield (yield fetch(
1546
1668
  `${this._baseUrl}/flow?id=${t}&resolve=components`
@@ -1559,21 +1681,21 @@ var On = (e, t, n) => {
1559
1681
  * Defaults to v1 behavior for backward compatibility with existing code
1560
1682
  */
1561
1683
  fetchComponent(t, n) {
1562
- return y(this, null, function* () {
1684
+ return g(this, null, function* () {
1563
1685
  return this.fetchComponentV1(t, n);
1564
1686
  });
1565
1687
  }
1566
1688
  };
1567
- a(xt, "_main", null);
1568
- var Ue = xt, Nn = (e) => y(void 0, null, function* () {
1689
+ a(Ht, "_main", null);
1690
+ var je = Ht, Un = (e) => g(void 0, null, function* () {
1569
1691
  try {
1570
1692
  const t = new URL(window.location.href), s = new URLSearchParams(t.search).get("myopOverride");
1571
1693
  if (s) {
1572
- const [i, ...o] = Fe(s);
1694
+ const [i, ...o] = $e(s);
1573
1695
  switch (i) {
1574
1696
  case "component":
1575
1697
  {
1576
- const [r, c] = o, l = yield Ue.Main.fetchComponent(r);
1698
+ const [r, c] = o, l = yield je.Main.fetchComponent(r);
1577
1699
  if (l && l.type.skins.find((u) => u.id === c))
1578
1700
  return l.instance.skinSelector = {
1579
1701
  type: re.Dedicated,
@@ -1586,13 +1708,13 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
1586
1708
  // case 'flow': {
1587
1709
  default:
1588
1710
  {
1589
- const [r, c] = Fe(s), d = (yield Ue.Main.fetchFlow(r)).components.find((u) => u.type.id === e.type.id);
1711
+ const [r, c] = $e(s), d = (yield je.Main.fetchFlow(r)).components.find((u) => u.type.id === e.type.id);
1590
1712
  if (d && d.instance.skinSelector.type === re.Segmented && d.instance.resolvedExperiences) {
1591
1713
  const u = d.instance.resolvedExperiences.find((h) => h.id === c);
1592
- if ((u == null ? void 0 : u.type) === yt.Segment) {
1593
- const h = u, g = d.instance.skinSelector.segments.find((m) => m.segmentId === h.segment.id);
1594
- if (g)
1595
- return d.instance.skinSelector = g == null ? void 0 : g.skinSelector, d;
1714
+ if ((u == null ? void 0 : u.type) === _t.Segment) {
1715
+ const h = u, y = d.instance.skinSelector.segments.find((m) => m.segmentId === h.segment.id);
1716
+ if (y)
1717
+ return d.instance.skinSelector = y == null ? void 0 : y.skinSelector, d;
1596
1718
  }
1597
1719
  }
1598
1720
  }
@@ -1602,20 +1724,20 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
1602
1724
  } finally {
1603
1725
  return null;
1604
1726
  }
1605
- }), Rt = "https://cdn.myop.dev/sdk/next/myop_sdk.min.js", Me = class {
1727
+ }), Dt = "https://cdn.myop.dev/sdk/next/myop_sdk.min.js", be = class {
1606
1728
  constructor() {
1607
- a(this, "components2init", []), a(this, "components", []), a(this, "componentsLoaders", []), a(this, "initiated", !1), a(this, "version", Mn), a(this, "type2InstanceCount", {}), a(this, "assignId", (e) => (this.type2InstanceCount[e.id] || (this.type2InstanceCount[e.id] = 0), `${e.id}_${++this.type2InstanceCount[e.id]}`)), a(this, "inspected", !1), a(this, "inspect", () => {
1729
+ a(this, "components2init", []), a(this, "components", []), a(this, "componentsLoaders", []), a(this, "initiated", !1), a(this, "version", En), a(this, "type2InstanceCount", {}), a(this, "assignId", (e) => (this.type2InstanceCount[e.id] || (this.type2InstanceCount[e.id] = 0), `${e.id}_${++this.type2InstanceCount[e.id]}`)), a(this, "inspected", !1), a(this, "inspect", () => {
1608
1730
  this.inspected || (this.inspected = !0, this.components.forEach((e) => {
1609
1731
  e.inspect && e.inspect();
1610
1732
  }));
1611
1733
  }), a(this, "incomingMessageHandler", (e) => {
1612
1734
  if (e.origin, document.location.origin, e.data.myop) {
1613
- if (e.data.direction !== k.up && e.data.messageType !== v.EnvelopedMessage)
1735
+ if (e.data.direction !== D.up && e.data.messageType !== v.EnvelopedMessage)
1614
1736
  return;
1615
1737
  const t = e.data;
1616
1738
  if (t.messageType === v.InitRequest) {
1617
1739
  this.components2init.forEach((s) => {
1618
- s.send(new He(s.id));
1740
+ s.send(new ke(s.id));
1619
1741
  });
1620
1742
  return;
1621
1743
  }
@@ -1631,8 +1753,8 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
1631
1753
  if (t.messageType === v.EnvelopedMessage) {
1632
1754
  const s = t, i = this.components.find((o) => o.id === s.destination);
1633
1755
  if (i) {
1634
- if (s.direction === k.down) {
1635
- s.message.messageType === $.name ? i.onMessageReceived(s.message) : (s.message.route = s.route, i.send(s.message));
1756
+ if (s.direction === D.down) {
1757
+ s.message.messageType === N.name ? i.onMessageReceived(s.message) : (s.message.route = s.route, i.send(s.message));
1636
1758
  return;
1637
1759
  }
1638
1760
  } else {
@@ -1662,9 +1784,9 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
1662
1784
  if (this.initiated)
1663
1785
  throw new Error("hostSDK already initiated");
1664
1786
  const t = [
1665
- new wn(),
1666
- new _n(),
1667
- new Bn()
1787
+ new Mn(),
1788
+ new bn(),
1789
+ new Wn()
1668
1790
  ];
1669
1791
  if (this.componentsLoaders = [
1670
1792
  ...t
@@ -1682,10 +1804,10 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
1682
1804
  this.incomingMessageHandler,
1683
1805
  !1
1684
1806
  ), console.log("myop hostSDK initiated", document.location.href), this.initiated = !0;
1685
- }), a(this, "_getSkinIdBySkinSelector", (e, ...t) => y(this, [e, ...t], function* (n, s = [], i) {
1807
+ }), a(this, "_getSkinIdBySkinSelector", (e, ...t) => g(this, [e, ...t], function* (n, s = [], i) {
1686
1808
  var o;
1687
1809
  function r(c, l) {
1688
- return y(this, null, function* () {
1810
+ return g(this, null, function* () {
1689
1811
  for (const d of c)
1690
1812
  if (yield l(d))
1691
1813
  return d;
@@ -1699,14 +1821,14 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
1699
1821
  return ((o = n.skin) == null ? void 0 : o.id) || n.skins[0].id;
1700
1822
  case re.Segmented:
1701
1823
  {
1702
- const l = yield r(n.segments, (d) => y(this, null, function* () {
1824
+ const l = yield r(n.segments, (d) => g(this, null, function* () {
1703
1825
  if (d.segmentId === "Default")
1704
1826
  return !0;
1705
- const u = s.find((m) => m.type === yt.Segment ? m.segment.id === d.segmentId : !1);
1827
+ const u = s.find((m) => m.type === _t.Segment ? m.segment.id === d.segmentId : !1);
1706
1828
  if (!u)
1707
1829
  throw new Error("experience not found");
1708
- const f = u.segment, g = (i || {})[f.function];
1709
- return g ? yield g() : (console.warn(`segmentId:${d.segmentId}, ${f.function} function not provided !`), !1);
1830
+ const f = u.segment, y = (i || {})[f.function];
1831
+ return y ? yield y() : (console.warn(`segmentId:${d.segmentId}, ${f.function} function not provided !`), !1);
1710
1832
  }));
1711
1833
  if (l)
1712
1834
  return this._getSkinIdBySkinSelector(l.skinSelector, s);
@@ -1717,29 +1839,29 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
1717
1839
  debugger;
1718
1840
  }
1719
1841
  return "";
1720
- })), a(this, "runSkinSelector", (e, t) => y(this, null, function* () {
1842
+ })), a(this, "runSkinSelector", (e, t) => g(this, null, function* () {
1721
1843
  const n = yield this._getSkinIdBySkinSelector(e.instance.skinSelector, e.instance.resolvedExperiences, t);
1722
1844
  return e.type.skins.find((s) => s.id === n);
1723
- })), a(this, "loaderHooks"), a(this, "loadComponent", (e, t, n) => y(this, null, function* () {
1845
+ })), a(this, "loaderHooks"), a(this, "loadComponent", (e, t, n) => g(this, null, function* () {
1724
1846
  var s, i, o, r;
1725
1847
  if (!t) {
1726
1848
  debugger;
1727
1849
  throw new Error("no container was found for this component");
1728
1850
  }
1729
- const c = yield Nn(e);
1851
+ const c = yield Un(e);
1730
1852
  c && (e = c);
1731
1853
  const l = M(M({}, (s = this.loaderHooks) != null ? s : {}), (i = n == null ? void 0 : n.hooks) != null ? i : {}), d = t;
1732
1854
  if (d.myop)
1733
1855
  if (d.component) {
1734
1856
  e = M({}, e), e.instance = M({}, e.instance);
1735
- let g = yield this.runSkinSelector(e, l);
1736
- if (!g)
1857
+ let y = yield this.runSkinSelector(e, l);
1858
+ if (!y)
1737
1859
  throw new Error("runSkinSelector failed to choose skin, check the provided config");
1738
- return (o = n == null ? void 0 : n.hooks) != null && o.afterSkinSelected && (g = yield n.hooks.afterSkinSelected(M({}, g))), e.instance.skinSelector = {
1860
+ return (o = n == null ? void 0 : n.hooks) != null && o.afterSkinSelected && (y = yield n.hooks.afterSkinSelected(M({}, y))), e.instance.skinSelector = {
1739
1861
  type: re.Dedicated,
1740
- skin: g
1862
+ skin: y
1741
1863
  // skins: [selectedSkin]
1742
- }, n && (n = M({}, n), delete n.hooks), yield _t(d, e, this.components, n);
1864
+ }, n && (n = M({}, n), delete n.hooks), yield bt(d, e, this.components, n);
1743
1865
  } else
1744
1866
  throw new Error("load component got a detached ref.");
1745
1867
  t = t;
@@ -1747,20 +1869,20 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
1747
1869
  if (!u)
1748
1870
  throw new Error("runSkinSelector failed to choose skin, check the provided config");
1749
1871
  (r = n == null ? void 0 : n.hooks) != null && r.afterSkinSelected && (u = yield n.hooks.afterSkinSelected(M({}, u)));
1750
- const h = this.componentsLoaders.find((g) => g.type === u.loader.type);
1872
+ const h = this.componentsLoaders.find((y) => y.type === u.loader.type);
1751
1873
  if (!h) {
1752
1874
  debugger;
1753
1875
  throw new Error(`no loader "${u.loader.type}" was found for component`);
1754
1876
  }
1755
1877
  let f = yield h.load(e.type, u, t, n);
1756
- f.isInitiated || this.components2init.push(f), f.bind("onDispose", () => (this.components = this.components.filter((g) => g !== f), this.components2init = this.components2init.filter((g) => g !== f), !0)), this.components.push(f), (!n || n.connectProps !== !1) && (f = gn(f, e.type.props, u));
1878
+ f.isInitiated || this.components2init.push(f), f.bind("onDispose", () => (this.components = this.components.filter((y) => y !== f), this.components2init = this.components2init.filter((y) => y !== f), !0)), this.components.push(f), (!n || n.connectProps !== !1) && (f = vn(f, e.type.props, u));
1757
1879
  try {
1758
- yield Mt(f, e, this.components);
1759
- } catch (g) {
1760
- throw g;
1880
+ yield Et(f, e, this.components);
1881
+ } catch (y) {
1882
+ throw y;
1761
1883
  }
1762
1884
  return n != null && n.skipInit || (yield f.initiated()), f;
1763
- })), a(this, "navigate", (e, t, n) => y(this, null, function* () {
1885
+ })), a(this, "navigate", (e, t, n) => g(this, null, function* () {
1764
1886
  if (e.parent)
1765
1887
  throw new Error("Navigating on remote ref components is not implemented yet");
1766
1888
  if (n != null && n.staged) {
@@ -1781,40 +1903,40 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
1781
1903
  }));
1782
1904
  }
1783
1905
  };
1784
- a(Me, "Instance", () => window.myop.hostSDK);
1906
+ a(be, "Instance", () => window.myop.hostSDK);
1785
1907
  window.myop || (window.myop = {
1786
- __ROOT_SDK_PUBLIC_URL__: Rt
1908
+ __ROOT_SDK_PUBLIC_URL__: Dt
1787
1909
  });
1788
1910
  if (!window.myop.hostSDK) {
1789
- const e = new Me();
1911
+ const e = new be();
1790
1912
  e.init(), window.myop || (window.myop = {
1791
- __ROOT_SDK_PUBLIC_URL__: Rt
1913
+ __ROOT_SDK_PUBLIC_URL__: Dt
1792
1914
  }), window.myop.hostSDK = e;
1793
1915
  }
1794
- var Oe = window.myop.hostSDK;
1795
- Ge("hostSDK", Oe);
1796
- var zn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Un = "linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)", qn = {
1916
+ var Ae = window.myop.hostSDK;
1917
+ Qe("hostSDK", Ae);
1918
+ var jn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Vn = "linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)", Gn = {
1797
1919
  position: "absolute",
1798
1920
  top: 0,
1799
1921
  left: 0,
1800
1922
  right: 0,
1801
1923
  bottom: 0,
1802
1924
  zIndex: 1,
1803
- background: zn,
1925
+ background: jn,
1804
1926
  display: "flex",
1805
1927
  justifyContent: "center",
1806
1928
  alignItems: "center"
1807
- }, jn = {
1929
+ }, Yn = {
1808
1930
  position: "absolute",
1809
1931
  top: 0,
1810
1932
  left: 0,
1811
1933
  right: 0,
1812
1934
  bottom: 0,
1813
- background: Un,
1935
+ background: Vn,
1814
1936
  display: "flex",
1815
1937
  justifyContent: "center",
1816
1938
  alignItems: "center"
1817
- }, Wn = {
1939
+ }, Jn = {
1818
1940
  position: "absolute",
1819
1941
  top: 0,
1820
1942
  left: 0,
@@ -1824,7 +1946,7 @@ var zn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Un =
1824
1946
  display: "flex",
1825
1947
  justifyContent: "center",
1826
1948
  alignItems: "center"
1827
- }, Vn = Object.defineProperty, Gn = (e, t, n) => t in e ? Vn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, p = (e, t, n) => Gn(e, typeof t != "symbol" ? t + "" : t, n), F = (e, t, n) => new Promise((s, i) => {
1949
+ }, Qn = Object.defineProperty, Xn = (e, t, n) => t in e ? Qn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, p = (e, t, n) => Xn(e, typeof t != "symbol" ? t + "" : t, n), F = (e, t, n) => new Promise((s, i) => {
1828
1950
  var o = (l) => {
1829
1951
  try {
1830
1952
  c(n.next(l));
@@ -1839,12 +1961,12 @@ var zn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Un =
1839
1961
  }
1840
1962
  }, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(o, r);
1841
1963
  c((n = n.apply(e, t)).next());
1842
- }), N = () => "10000000-1000-4000-8000-100000000000".replace(
1964
+ }), W = () => "10000000-1000-4000-8000-100000000000".replace(
1843
1965
  /[018]/g,
1844
1966
  (e) => (+e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +e / 4).toString(16)
1845
- ), Yn = class {
1967
+ ), Zn = class {
1846
1968
  constructor() {
1847
- p(this, "id", N()), p(this, "myop", !0), p(this, "content"), p(this, "source"), p(this, "destination"), p(this, "route"), p(this, "ref"), p(this, "direction"), p(this, "cleanable", !1);
1969
+ p(this, "id", W()), p(this, "myop", !0), p(this, "content"), p(this, "source"), p(this, "destination"), p(this, "route"), p(this, "ref"), p(this, "direction"), p(this, "cleanable", !1);
1848
1970
  }
1849
1971
  static create(...e) {
1850
1972
  return new this(...e);
@@ -1852,36 +1974,36 @@ var zn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Un =
1852
1974
  isTypeof(e) {
1853
1975
  return e.messageType === this.messageType;
1854
1976
  }
1855
- }, Jn = class extends Yn {
1977
+ }, es = class extends Zn {
1856
1978
  constructor(e) {
1857
- super(), this.handler = e, p(this, "handlerUniqueId", N());
1979
+ super(), this.handler = e, p(this, "handlerUniqueId", W());
1858
1980
  }
1859
- }, Xn = "ExecuteScriptReplyMessage", Qn = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, Zn = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, es = (e) => {
1860
- let t = e.match(Qn);
1981
+ }, ts = "ExecuteScriptReplyMessage", ns = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, ss = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, is = (e) => {
1982
+ let t = e.match(ns);
1861
1983
  if (t)
1862
1984
  return t[1] || t[3];
1863
1985
  {
1864
- let n = e.match(Zn);
1986
+ let n = e.match(ss);
1865
1987
  if (n)
1866
1988
  return n[1].trim();
1867
1989
  }
1868
- }, Ht = class extends Jn {
1990
+ }, kt = class extends es {
1869
1991
  constructor(e, t = () => {
1870
1992
  }, n) {
1871
- super(t), this.scriptInputs = n, p(this, "replyMessageKey", Xn), p(this, "messageType", "ExecuteScriptMessage"), p(this, "script", ""), this.script = e.toString(), this.content = e.toString(), this.content = es(this.content);
1993
+ super(t), this.scriptInputs = n, p(this, "replyMessageKey", ts), p(this, "messageType", "ExecuteScriptMessage"), p(this, "script", ""), this.script = e.toString(), this.content = e.toString(), this.content = is(this.content);
1872
1994
  }
1873
1995
  };
1874
- p(Ht, "replierKey", "send");
1875
- p(Ht, "completeStreamKey", "completeStream");
1876
- var qe = class {
1996
+ p(kt, "replierKey", "send");
1997
+ p(kt, "completeStreamKey", "completeStream");
1998
+ var Ve = class {
1877
1999
  constructor() {
1878
- p(this, "_runTimeInstanceId", "runtime-instance-id-" + N()), p(this, "_runTimeId", "runtime-id-" + N()), p(this, "_runTimeName", "runtime-name-" + N()), p(this, "id", this._runTimeId), p(this, "name", this._runTimeName), p(this, "description", ""), p(this, "loader", null), p(this, "withLoader", (t) => (this.loader = t, this)), p(this, "withHTMLLoader", (t) => (t.type = "HTMLLoader", this.loader = t, this)), p(this, "build", () => this);
2000
+ p(this, "_runTimeInstanceId", "runtime-instance-id-" + W()), p(this, "_runTimeId", "runtime-id-" + W()), p(this, "_runTimeName", "runtime-name-" + W()), p(this, "id", this._runTimeId), p(this, "name", this._runTimeName), p(this, "description", ""), p(this, "loader", null), p(this, "withLoader", (t) => (this.loader = t, this)), p(this, "withHTMLLoader", (t) => (t.type = "HTMLLoader", this.loader = t, this)), p(this, "build", () => this);
1879
2001
  }
1880
2002
  };
1881
- p(qe, "create", () => new qe());
1882
- var je = class {
2003
+ p(Ve, "create", () => new Ve());
2004
+ var Ge = class {
1883
2005
  constructor() {
1884
- p(this, "_runTimeInstanceId", "runtime-instance-id-" + N()), p(this, "_runTimeId", "runtime-id-" + N()), p(this, "_runTimeName", "runtime-name-" + N()), p(this, "instance", {
2006
+ p(this, "_runTimeInstanceId", "runtime-instance-id-" + W()), p(this, "_runTimeId", "runtime-id-" + W()), p(this, "_runTimeName", "runtime-name-" + W()), p(this, "instance", {
1885
2007
  id: this._runTimeInstanceId,
1886
2008
  componentId: this._runTimeId,
1887
2009
  componentName: this._runTimeName,
@@ -1914,10 +2036,10 @@ var je = class {
1914
2036
  }), p(this, "build", () => JSON.parse(JSON.stringify(this)));
1915
2037
  }
1916
2038
  };
1917
- p(je, "create", () => new je());
1918
- var We = {
2039
+ p(Ge, "create", () => new Ge());
2040
+ var Ye = {
1919
2041
  code: "code"
1920
- }, ts = (e) => ({
2042
+ }, os = (e) => ({
1921
2043
  instance: {
1922
2044
  id: "auto",
1923
2045
  componentId: e.componentId,
@@ -1939,7 +2061,7 @@ var We = {
1939
2061
  name: "myop_init_interface",
1940
2062
  type: "any",
1941
2063
  behavior: {
1942
- type: We.code
2064
+ type: Ye.code
1943
2065
  }
1944
2066
  },
1945
2067
  {
@@ -1947,7 +2069,7 @@ var We = {
1947
2069
  name: "myop_cta_handler",
1948
2070
  type: "any",
1949
2071
  behavior: {
1950
- type: We.code
2072
+ type: Ye.code
1951
2073
  }
1952
2074
  }
1953
2075
  ],
@@ -1965,20 +2087,20 @@ var We = {
1965
2087
  defaultSkin: 0
1966
2088
  },
1967
2089
  name: e.name
1968
- }), _e = "__MYOP_CLOUD_REPOSITORY_MAIN__", ns = () => {
2090
+ }), _e = "__MYOP_CLOUD_REPOSITORY_MAIN__", rs = () => {
1969
2091
  if (typeof window < "u")
1970
2092
  return window[_e];
1971
2093
  if (typeof globalThis < "u")
1972
2094
  return globalThis[_e];
1973
- }, ss = (e) => {
2095
+ }, as = (e) => {
1974
2096
  typeof window < "u" && (window[_e] = e), typeof globalThis < "u" && (globalThis[_e] = e);
1975
- }, kt = class G {
2097
+ }, Lt = class Y {
1976
2098
  constructor(t = "https://cloud.myop.dev") {
1977
2099
  this._baseUrl = t, p(this, "variants", {}), p(this, "preloadedComponents", {}), p(this, "userFlows", {}), p(this, "_defaultEnv", "production");
1978
2100
  }
1979
2101
  static get Main() {
1980
- const t = ns();
1981
- return t || (G._main || (G._main = new G(), ss(G._main)), G._main);
2102
+ const t = rs();
2103
+ return t || (Y._main || (Y._main = new Y(), as(Y._main)), Y._main);
1982
2104
  }
1983
2105
  /**
1984
2106
  * Set the default environment for this CloudRepository instance
@@ -2037,7 +2159,7 @@ var We = {
2037
2159
  u(new Error(`Component "${t}" has no implementation for environment "${r}"`));
2038
2160
  return;
2039
2161
  }
2040
- const x = ts(m);
2162
+ const x = os(m);
2041
2163
  d(x);
2042
2164
  } catch (h) {
2043
2165
  u(h);
@@ -2098,9 +2220,9 @@ var We = {
2098
2220
  });
2099
2221
  }
2100
2222
  };
2101
- p(kt, "_main", null);
2102
- var be = kt;
2103
- const ys = (e) => {
2223
+ p(Lt, "_main", null);
2224
+ var Ee = Lt;
2225
+ const Ms = (e) => {
2104
2226
  const t = O(null), n = O(null), s = O(!1), i = O(null);
2105
2227
  return oe(() => {
2106
2228
  let o = !1;
@@ -2108,11 +2230,11 @@ const ys = (e) => {
2108
2230
  const r = async (c) => {
2109
2231
  s.current = !0;
2110
2232
  try {
2111
- const l = await be.Main.fetchComponent(
2233
+ const l = await Ee.Main.fetchComponent(
2112
2234
  c.componentId,
2113
2235
  c.flowId
2114
2236
  );
2115
- n.current = await Oe.loadComponent(
2237
+ n.current = await Ae.loadComponent(
2116
2238
  l,
2117
2239
  t.current,
2118
2240
  {
@@ -2145,7 +2267,7 @@ const ys = (e) => {
2145
2267
  return s.current ? i.current = { ...e } : r(e).then(), () => {
2146
2268
  o = !0, n.current && n.current.dispose();
2147
2269
  };
2148
- }, [e.flowId, e.componentId]), /* @__PURE__ */ S(
2270
+ }, [e.flowId, e.componentId]), /* @__PURE__ */ T(
2149
2271
  "div",
2150
2272
  {
2151
2273
  style: {
@@ -2155,14 +2277,14 @@ const ys = (e) => {
2155
2277
  ref: t
2156
2278
  }
2157
2279
  );
2158
- }, Dt = () => /* @__PURE__ */ S(
2280
+ }, Ot = () => /* @__PURE__ */ T(
2159
2281
  "svg",
2160
2282
  {
2161
2283
  width: "80",
2162
2284
  viewBox: "0 0 525 243",
2163
2285
  fill: "none",
2164
2286
  xmlns: "http://www.w3.org/2000/svg",
2165
- children: /* @__PURE__ */ S(
2287
+ children: /* @__PURE__ */ T(
2166
2288
  "path",
2167
2289
  {
2168
2290
  d: "M151.438 2.7168C177.625 2.76042 248.179 4.2832 300.4 56.7441C350.671 107.245 364.44 114.452 389.967 119.211C392.576 119.436 397.472 119.394 400.802 116.521C403.011 114.614 403.921 109.518 404.265 104.627V5.95996C404.265 4.85556 405.16 3.96023 406.265 3.95996H522.711C523.815 3.95996 524.711 4.85539 524.711 5.95996V122.405C524.711 123.51 523.815 124.405 522.711 124.405H421.998C418.579 124.728 413.852 125.627 410.974 128.095C407.879 130.748 407.042 137.805 406.845 142.661V240.414C406.845 241.436 406.111 242.292 405.093 242.38C366.548 245.717 277.079 228.462 235.837 173.668C202.909 129.919 173.882 122.474 151.458 122.077C150.354 122.058 149.459 121.164 149.459 120.06V4.71582C149.459 3.6114 150.334 2.71519 151.438 2.7168ZM62.2031 0C96.5566 0.000213148 124.405 27.8496 124.405 62.2031C124.405 96.5564 96.5564 124.405 62.2031 124.405C27.8496 124.405 0.000213175 96.5566 0 62.2031C0 27.8495 27.8495 0 62.2031 0Z",
@@ -2170,42 +2292,42 @@ const ys = (e) => {
2170
2292
  }
2171
2293
  )
2172
2294
  }
2173
- ), is = ({
2295
+ ), cs = ({
2174
2296
  opacity: e = 1,
2175
2297
  fadeDuration: t = 200,
2176
2298
  children: n
2177
2299
  }) => {
2178
2300
  if (n !== void 0) {
2179
2301
  const i = {
2180
- ...Wn,
2302
+ ...Jn,
2181
2303
  opacity: e,
2182
2304
  transition: `opacity ${t}ms ease-out`
2183
2305
  };
2184
- return /* @__PURE__ */ S("div", { style: i, children: n });
2306
+ return /* @__PURE__ */ T("div", { style: i, children: n });
2185
2307
  }
2186
2308
  const s = {
2187
- ...qn,
2309
+ ...Gn,
2188
2310
  opacity: e,
2189
2311
  transition: `opacity ${t}ms ease-out`
2190
2312
  };
2191
- return /* @__PURE__ */ S("div", { style: s, children: /* @__PURE__ */ S(Dt, {}) });
2192
- }, os = {
2313
+ return /* @__PURE__ */ T("div", { style: s, children: /* @__PURE__ */ T(Ot, {}) });
2314
+ }, ls = {
2193
2315
  position: "absolute",
2194
2316
  top: 0,
2195
2317
  left: 0,
2196
2318
  right: 0,
2197
2319
  bottom: 0
2198
- }, rs = ({ children: e }) => e !== void 0 ? /* @__PURE__ */ S("div", { style: os, children: e }) : /* @__PURE__ */ S("div", { style: jn, children: /* @__PURE__ */ S(Dt, {}) }), as = (e) => `on${e.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("")}`, vs = (e) => {
2199
- var C, I, L, Q, Z, ee;
2200
- const t = O(null), n = O(null), s = O(!1), i = O(null), o = e.componentId ? ls(e.componentId) : !1, [r, c] = ie(!o), [l, d] = ie(1), [u, h] = ie(!1), [f, g] = ie(!1), [m, x] = ie(void 0), w = e.autoSize ?? !1, E = O(!1), R = e.fadeDuration ?? 200, D = Pe(() => {
2320
+ }, ds = ({ children: e }) => e !== void 0 ? /* @__PURE__ */ T("div", { style: ls, children: e }) : /* @__PURE__ */ T("div", { style: Yn, children: /* @__PURE__ */ T(Ot, {}) }), us = (e) => `on${e.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("")}`, bs = (e) => {
2321
+ var C, S, L, X, Z, ee;
2322
+ const t = O(null), n = O(null), s = O(!1), i = O(null), o = e.componentId ? ps(e.componentId) : !1, [r, c] = ie(!o), [l, d] = ie(1), [u, h] = ie(!1), [f, y] = ie(!1), [m, x] = ie(void 0), w = e.autoSize ?? !1, E = O(!1), R = e.fadeDuration ?? 200, k = Be(() => {
2201
2323
  d(0), setTimeout(() => {
2202
2324
  c(!1);
2203
2325
  }, R);
2204
- }, [R]), he = Pe(
2326
+ }, [R]), he = Be(
2205
2327
  (_) => {
2206
- console.error("[MyopComponent] Error:", _), D(), h(!0), e.onError && e.onError(_);
2328
+ console.error("[MyopComponent] Error:", _), k(), h(!0), e.onError && e.onError(_);
2207
2329
  },
2208
- [D, e.onError]
2330
+ [k, e.onError]
2209
2331
  );
2210
2332
  oe(() => {
2211
2333
  E.current = !1;
@@ -2219,45 +2341,45 @@ const ys = (e) => {
2219
2341
  _ && _(e.data);
2220
2342
  }
2221
2343
  }, [e.data, f]), oe(() => {
2222
- var q, T, te, H, ne, j, se;
2344
+ var q, I, te, H, ne, U, se;
2223
2345
  if (!f || !((q = n.current) != null && q.observeAutoSize))
2224
2346
  return;
2225
2347
  let _ = !0;
2226
2348
  return n.current.observeAutoSize({
2227
- explicitWidth: (T = e.style) == null ? void 0 : T.width,
2349
+ explicitWidth: (I = e.style) == null ? void 0 : I.width,
2228
2350
  explicitHeight: (te = e.style) == null ? void 0 : te.height,
2229
2351
  minWidth: (H = e.style) == null ? void 0 : H.minWidth,
2230
2352
  maxWidth: (ne = e.style) == null ? void 0 : ne.maxWidth,
2231
- minHeight: (j = e.style) == null ? void 0 : j.minHeight,
2353
+ minHeight: (U = e.style) == null ? void 0 : U.minHeight,
2232
2354
  maxHeight: (se = e.style) == null ? void 0 : se.maxHeight,
2233
2355
  forceAutoSize: w,
2234
2356
  loaderMinHeight: 50,
2235
2357
  onSizeChange: (fe) => {
2236
- e.onSizeChange && e.onSizeChange(fe) === !1 || (x(fe), _ && (_ = !1, D()));
2358
+ e.onSizeChange && e.onSizeChange(fe) === !1 || (x(fe), _ && (_ = !1, k()));
2237
2359
  }
2238
2360
  });
2239
- }, [w, f, e.onSizeChange, (C = e.style) == null ? void 0 : C.width, (I = e.style) == null ? void 0 : I.height, (L = e.style) == null ? void 0 : L.minWidth, (Q = e.style) == null ? void 0 : Q.maxWidth, (Z = e.style) == null ? void 0 : Z.minHeight, (ee = e.style) == null ? void 0 : ee.maxHeight]), oe(() => {
2361
+ }, [w, f, e.onSizeChange, (C = e.style) == null ? void 0 : C.width, (S = e.style) == null ? void 0 : S.height, (L = e.style) == null ? void 0 : L.minWidth, (X = e.style) == null ? void 0 : X.maxWidth, (Z = e.style) == null ? void 0 : Z.minHeight, (ee = e.style) == null ? void 0 : ee.maxHeight]), oe(() => {
2240
2362
  let _ = !1;
2241
2363
  s.current = !(t != null && t.current);
2242
- const q = async (T) => {
2364
+ const q = async (I) => {
2243
2365
  var te;
2244
2366
  s.current = !0;
2245
2367
  try {
2246
- if (!T.componentId && !T.componentConfig) {
2368
+ if (!I.componentId && !I.componentConfig) {
2247
2369
  he("No component configuration provided");
2248
2370
  return;
2249
2371
  }
2250
- const H = await cs().fetchComponentV2(
2251
- T.componentId,
2252
- T.environment,
2253
- T.preview
2254
- ), ne = await Oe.loadComponent(
2372
+ const H = await hs().fetchComponentV2(
2373
+ I.componentId,
2374
+ I.environment,
2375
+ I.preview
2376
+ ), ne = await Ae.loadComponent(
2255
2377
  H,
2256
2378
  t.current,
2257
2379
  {
2258
- data: T.data,
2380
+ data: I.data,
2259
2381
  _environment: {
2260
- props: { ...T }
2382
+ props: { ...I }
2261
2383
  }
2262
2384
  }
2263
2385
  );
@@ -2269,15 +2391,15 @@ const ys = (e) => {
2269
2391
  n.current && n.current.dispose();
2270
2392
  return;
2271
2393
  }
2272
- if (await new Promise((j) => requestAnimationFrame(j)), _ || !n.current || n.current.markedForDisposed) {
2394
+ if (await new Promise((U) => requestAnimationFrame(U)), _ || !n.current || n.current.markedForDisposed) {
2273
2395
  n.current && !n.current.markedForDisposed && n.current.dispose();
2274
2396
  return;
2275
2397
  }
2276
- g(!0), w || D(), (te = n.current) != null && te.props && (n.current.props.myop_cta_handler = (j, se) => {
2277
- e.on && e.on(j, se);
2278
- const fe = as(j), Ee = e[fe];
2279
- typeof Ee == "function" && Ee(se);
2280
- }), T.onLoad && n.current && T.onLoad(n.current);
2398
+ y(!0), w || k(), (te = n.current) != null && te.props && (n.current.props.myop_cta_handler = (U, se) => {
2399
+ e.on && e.on(U, se);
2400
+ const fe = us(U), Ce = e[fe];
2401
+ typeof Ce == "function" && Ce(se);
2402
+ }), I.onLoad && n.current && I.onLoad(n.current);
2281
2403
  } catch (H) {
2282
2404
  _ || he((H == null ? void 0 : H.message) || "Unknown error");
2283
2405
  } finally {
@@ -2291,48 +2413,48 @@ const ys = (e) => {
2291
2413
  _ = !0, n.current && n.current.dispose();
2292
2414
  };
2293
2415
  }, [e.componentId]);
2294
- const W = r ? 50 : void 0, U = (m == null ? void 0 : m.autoSizingWidth) || (m == null ? void 0 : m.autoSizingHeight), pe = {
2416
+ const V = r ? 50 : void 0, z = (m == null ? void 0 : m.autoSizingWidth) || (m == null ? void 0 : m.autoSizingHeight), pe = {
2295
2417
  position: "relative",
2296
2418
  width: m != null && m.autoSizingWidth ? m.width : "100%",
2297
2419
  height: m != null && m.autoSizingHeight ? m.height : "100%",
2298
- minHeight: W,
2299
- overflow: U ? "hidden" : "inherit",
2420
+ minHeight: V,
2421
+ overflow: z ? "hidden" : "inherit",
2300
2422
  ...e.style
2301
2423
  };
2302
- return /* @__PURE__ */ Lt("div", { style: pe, children: [
2303
- /* @__PURE__ */ S("div", { ref: t, style: {
2424
+ return /* @__PURE__ */ Pt("div", { style: pe, children: [
2425
+ /* @__PURE__ */ T("div", { ref: t, style: {
2304
2426
  position: "absolute",
2305
2427
  inset: 0,
2306
- overflow: U ? "hidden" : void 0
2428
+ overflow: z ? "hidden" : void 0
2307
2429
  } }),
2308
- r && e.loader !== void 0 && /* @__PURE__ */ S(is, { opacity: l, fadeDuration: R, children: e.loader }),
2309
- u && /* @__PURE__ */ S(rs, { children: e.fallback })
2430
+ r && e.loader !== void 0 && /* @__PURE__ */ T(cs, { opacity: l, fadeDuration: R, children: e.loader }),
2431
+ u && /* @__PURE__ */ T(ds, { children: e.fallback })
2310
2432
  ] });
2311
2433
  };
2312
- let z = be.Main;
2313
- const cs = () => z, ls = (e, t, n) => z.isPreloaded(e, t, n), ws = (e) => z.getPreloadedParams(e), _s = () => {
2314
- z = new be("http://localhost:9292");
2315
- }, Ms = (e) => {
2316
- z = new be(e);
2317
- }, bs = (e) => {
2318
- z = e;
2319
- }, Es = (e) => {
2320
- z.setEnvironment(e);
2321
- }, Cs = async (e, t, n) => Promise.allSettled(
2322
- e.map((s) => z.fetchComponentV2(s, t, n))
2434
+ let K = Ee.Main;
2435
+ const hs = () => K, ps = (e, t, n) => K.isPreloaded(e, t, n), Es = (e) => K.getPreloadedParams(e), Cs = () => {
2436
+ K = new Ee("http://localhost:9292");
2437
+ }, Ss = (e) => {
2438
+ K = new Ee(e);
2439
+ }, Is = (e) => {
2440
+ K = e;
2441
+ }, Ts = (e) => {
2442
+ K.setEnvironment(e);
2443
+ }, xs = async (e, t, n) => Promise.allSettled(
2444
+ e.map((s) => K.fetchComponentV2(s, t, n))
2323
2445
  );
2324
2446
  export {
2325
- vs as MyopComponent,
2326
- ys as MyopContainer,
2327
- rs as MyopFallback,
2328
- is as MyopLoader,
2329
- vs as MyopV2Container,
2330
- _s as enableLocalDev,
2331
- cs as getCloudRepository,
2332
- ws as getPreloadedParams,
2333
- ls as isPreloaded,
2334
- Cs as preloadComponents,
2335
- bs as setCloudRepository,
2336
- Ms as setCloudRepositoryUrl,
2337
- Es as setEnvironment
2447
+ bs as MyopComponent,
2448
+ Ms as MyopContainer,
2449
+ ds as MyopFallback,
2450
+ cs as MyopLoader,
2451
+ bs as MyopV2Container,
2452
+ Cs as enableLocalDev,
2453
+ hs as getCloudRepository,
2454
+ Es as getPreloadedParams,
2455
+ ps as isPreloaded,
2456
+ xs as preloadComponents,
2457
+ Is as setCloudRepository,
2458
+ Ss as setCloudRepositoryUrl,
2459
+ Ts as setEnvironment
2338
2460
  };