@myop/react 0.0.38 → 0.0.39

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,35 +1,35 @@
1
- import { jsx as R, jsxs as Ut } from "react/jsx-runtime";
2
- import { useRef as B, useEffect as ue, useState as ne, useCallback as je } from "react";
3
- const qt = `"use strict";var MyopSDK=(()=>{var qe=Object.defineProperty,Os=Object.defineProperties,As=Object.getOwnPropertyDescriptor,Ks=Object.getOwnPropertyDescriptors,zs=Object.getOwnPropertyNames,kn=Object.getOwnPropertySymbols;var Hn=Object.prototype.hasOwnProperty,$s=Object.prototype.propertyIsEnumerable;var Pt=(o,n,e)=>n in o?qe(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,M=(o,n)=>{for(var e in n||(n={}))Hn.call(n,e)&&Pt(o,e,n[e]);if(kn)for(var e of kn(n))$s.call(n,e)&&Pt(o,e,n[e]);return o},U=(o,n)=>Os(o,Ks(n));var l=(o,n)=>()=>(o&&(n=o(o=0)),n);var ee=(o,n)=>{for(var e in n)qe(o,e,{get:n[e],enumerable:!0})},Fs=(o,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of zs(n))!Hn.call(o,s)&&s!==e&&qe(o,s,{get:()=>n[s],enumerable:!(t=As(n,s))||t.enumerable});return o};var Ws=o=>Fs(qe({},"__esModule",{value:!0}),o);var i=(o,n,e)=>Pt(o,typeof n!="symbol"?n+"":n,e);var Ve,je,Ot,F,te=l(()=>{"use strict";Ve="__federation__",je="onLoad",Ot="moduleInstance",F=(o,n)=>{window[Ve]&&window[Ve][o]&&window[Ve][o][je]&&window[Ve][o][je]({[o]:n})}});var ge,Ge=l(()=>{ge="0.3.21"});var g,C=l(()=>{"use strict";g={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,Ns,Us,At,Kt=l(()=>{"use strict";E=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),Ns=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("-")},Us=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))},At=o=>{let n=Us(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(Ns(n.slice(t,t+16)));return e}});var Bn,ne=l(()=>{"use strict";Kt();Bn=o=>new Promise(n=>setTimeout(n,o))});var _,I,zt,R,k,G,H=l(()=>{"use strict";ne();_=class{};i(_,"down","down"),i(_,"up","up");I=class{constructor(){i(this,"id",E());i(this,"myop",!0);i(this,"content");i(this,"source");i(this,"destination");i(this,"route");i(this,"ref");i(this,"direction");i(this,"cleanable",!1)}static create(...n){return new this(...n)}isTypeof(n){return n.messageType===this.messageType}},zt=class extends I{constructor(e){super();this.ref=e}},R=class extends I{constructor(e){super();this.replayToHandler=e}},k=class extends I{constructor(e){super();this.handler=e;i(this,"handlerUniqueId",E())}},G=class o{constructor(n,e){this.refConfig=n;this.component=e;i(this,"myop",!0);i(this,"__nonProxied");this.__nonProxied=U(M({},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 Ln,$t,oe,Pn=l(()=>{"use strict";H();Ln="ClickReplayMessage",$t=class extends k{constructor(e,t){super(t);this.ref=e;i(this,"replyMessageKey",Ln);i(this,"messageType","BindClickMessage");i(this,"cleanable",!0)}},oe=class extends R{constructor(){super(...arguments);i(this,"messageType",Ln)}}});var Ft,On=l(()=>{"use strict";H();Ft=class extends I{constructor(e,t){super();this.ref=e;i(this,"messageType","ChangeTextMessage");this.content=t}}});var An,qs,Vs,Kn,D,se,Wt=l(()=>{"use strict";H();An="ExecuteScriptReplyMessage",qs=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,Vs=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,Kn=o=>{let n=o.match(qs);if(n)return n[1]||n[3];{let e=o.match(Vs);if(e)return e[1].trim()}},D=class extends k{constructor(e,t=()=>{},s){super(t);this.scriptInputs=s;i(this,"replyMessageKey",An);i(this,"messageType","ExecuteScriptMessage");i(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=Kn(this.content)}};i(D,"replierKey","send"),i(D,"completeStreamKey","completeStream");se=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;i(this,"messageType",An)}}});var q,zn=l(()=>{"use strict";Wt();q=class extends D{constructor(e,t,s=()=>{}){super(({rootRef:r,elementId:a,_script:p,__scriptInputs:d})=>{let m=(r.shadowRoot||r.container).querySelectorAll("[myop-id='".concat(a,"']"));return m.length?(d.ref=m[0],new Function("return (".concat(p,")(...arguments)"))(d)):null},s);this.scriptInputs=t;this.scriptInputs=U(M({},t),{_script:e.toString()})}}});var $n,Nt,ie,Fn=l(()=>{"use strict";H();$n="EventListenerCallbackMessage",Nt=class extends k{constructor(e,t,s){super(s);this.ref=e;this.type=t;this.handler=s;i(this,"replyMessageKey",$n);i(this,"messageType","AddEventListenerMessage");i(this,"cleanable",!0);i(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},ie=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;i(this,"messageType",$n);this.content={e:t}}}});var Ut,Wn=l(()=>{"use strict";H();Ut=class extends I{constructor(e,t,s){super();this.ref=e;this.name=t;this.value=s;i(this,"messageType","SetAttributeMessage")}}});var Nn,qt,re,Vt=l(()=>{"use strict";H();Nn="ElementValueReplayMessage",qt=class extends k{constructor(e,t){super(t);this.ref=e;i(this,"replyMessageKey",Nn);i(this,"messageType","GetElementValueMessage")}},re=class extends R{constructor(e){super();this.content=e;i(this,"messageType",Nn)}}});var jt,Un=l(()=>{"use strict";H();jt=class extends I{constructor(e,t){super();this.ref=e;i(this,"messageType","SetInnerHtml");this.content=t}}});var ye,He,ae,qn=l(()=>{"use strict";H();ye=class extends I{constructor(e){super();i(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},He=class extends ye{constructor(){super(...arguments);i(this,"messageType","InitResponse")}},ae=class extends I{constructor(){super(...arguments);i(this,"messageType","InitRequest")}}});var Vn,De,V,Ye=l(()=>{"use strict";H();Vn="RefComponentCreatedMessage",De=class extends k{constructor(e,t,s,r){super(r);this.refConfig=e;this.nestedComponentConfig=t;this.options=s;i(this,"replyMessageKey",Vn);i(this,"messageType","CreateRefComponentMessage")}},V=class extends R{constructor(e,t,s){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=s;i(this,"messageType",Vn)}}});var Be,Gt=l(()=>{"use strict";H();Be=class extends I{constructor(e,t){super();this.destination=e;this.message=t;i(this,"messageType","EnvelopedMessage");let s=t;this.route=[e,...s.route?s.route:[]]}}});var jn,Yt,pe,Gn=l(()=>{"use strict";H();jn="DetectedMyopRefsMessage",Yt=class extends k{constructor(){super(...arguments);i(this,"messageType","DetectMyopRefsMessage");i(this,"replyMessageKey",jn)}},pe=class extends R{constructor(e,t){super(e);this.replayToHandler=e;i(this,"messageType",jn);this.content=t}isTypeof(e){return e.messageType===this.messageType}}});var Yn,Qt,Le,Qn=l(()=>{"use strict";H();Yn="GetAttributeReplayMessage",Qt=class extends k{constructor(e,t,s){super(s);this.ref=e;this.name=t;i(this,"replyMessageKey",Yn);i(this,"messageType","GetAttributeMessage")}},Le=class extends R{constructor(e){super();this.content=e;i(this,"messageType",Yn)}}});var A,Jn=l(()=>{"use strict";H();A=class extends I{constructor(e){super();this.method=e;i(this,"messageType","ExecuteComponentMethod")}}});var Jt,Pe,Xn=l(()=>{"use strict";H();Jt=class extends I{constructor(){super(...arguments);i(this,"messageType","SetMutationObserverMessage")}},Pe=class extends I{constructor(){super(...arguments);i(this,"messageType","MutationObserverMessage")}}});var Zn,Oe,Ae,eo=l(()=>{"use strict";H();Zn="CleanupReplayMessage",Oe=class extends k{constructor(e,t){super(t);this.cleanupForMessageId=e;i(this,"replyMessageKey",Zn);i(this,"messageType","CleanupMessage")}},Ae=class extends R{constructor(e){super();this.customCleanup=e;i(this,"messageType",Zn)}}});var Ke,to=l(()=>{"use strict";H();Ke=class extends I{constructor(){super(...arguments);i(this,"messageType","DisposeMessage")}}});var Xt,ze,no=l(()=>{"use strict";H();Xt=class extends I{constructor(){super(...arguments);i(this,"cleanable",!0);i(this,"messageType","SetResizeObserverMessage")}},ze=class extends I{constructor(){super(...arguments);i(this,"messageType","ResizeObserverMessage")}}});var he={};ee(he,{AddEventListenerMessage:()=>Nt,BaseMyopMessage:()=>I,BindClickMessage:()=>$t,ChangeTextMessage:()=>Ft,CleanupMessage:()=>Oe,CleanupReplayMessage:()=>Ae,ClickReplayMessage:()=>oe,CreateRefComponentMessage:()=>De,CustomRefMessage:()=>q,DetectMyopRefsMessage:()=>Yt,DetectedMyopRefsMessage:()=>pe,DisposeMessage:()=>Ke,ElementValueReplayMessage:()=>re,EnvelopedMessage:()=>Be,EventListenerCallbackMessage:()=>ie,ExecuteComponentMethod:()=>A,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>se,GetAttributeMessage:()=>Qt,GetAttributeReplayMessage:()=>Le,GetElementValueMessage:()=>qt,InitMessage:()=>ye,InitRequest:()=>ae,InitResponse:()=>He,MessageDirection:()=>_,MutationObserverMessage:()=>Pe,MyopBindMessage:()=>k,MyopBindReplayMessage:()=>R,MyopElementMessage:()=>zt,Ref:()=>G,RefComponentCreatedMessage:()=>V,ResizeObserverMessage:()=>ze,SetAttributeMessage:()=>Ut,SetInnerHtml:()=>jt,SetMutationObserverMessage:()=>Jt,SetResizeObserverMessage:()=>Xt,stripFunction:()=>Kn});var b=l(()=>{"use strict";H();Pn();On();Wt();zn();Fn();Wn();Vt();Un();qn();Ye();Gt();Gn();Vt();Qn();Jn();Xn();eo();to();no()});var W,$e=l(()=>{"use strict";C();b();Fe();W=class{constructor(n,e,t){this.componentDefinition=n;this.container=e;i(this,"id","");i(this,"messageHandlers",{});i(this,"element");i(this,"_markedForDisposed",!1);i(this,"bind",(n,e)=>{this.messageHandlers[n]||(this.messageHandlers[n]=[]),this.messageHandlers[n].includes(e)||this.messageHandlers[n].push(e)});i(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],r=a=>e(a)?(t(a),!0):!1;return s.push(r),()=>{let a=s.indexOf(r);a>-1&&s.splice(a,1)}});i(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});i(this,"isInitiated",!1);i(this,"_whenInitiatedResolve");i(this,"_whenInitiatedReject");i(this,"_whenInitiated",new Promise((n,e)=>{this._whenInitiatedResolve=n,this._whenInitiatedReject=e}));i(this,"initiated",()=>this._whenInitiated);i(this,"props",{});i(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===g.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=_.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=_.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 Oe(n.id,t=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Ke);let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var Me,oo=l(()=>{"use strict";Me=class{constructor(n,e,t,s,r){this.myopId=n;this.htmlTagName=e;this.BoundingRect=t;this.offsetTop=s;this.offsetLeft=r;i(this,"type","MyopElementRef")}}});var so,x,Qe,io=l(()=>{"use strict";so=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}},Qe=class extends x{constructor(e,t){super(e);this.messageToHost=e;this.context=t}}});var Zt,Ce,ro=l(()=>{"use strict";C();w();b();Zt=class{constructor(n,e){this.id=n;this.context=e;i(this,"send",n=>{})}},Ce=class{constructor(){i(this,"messageToHandleAfterInit",[]);i(this,"components",{});i(this,"alwaysPassEnvelopesToHost",!1);i(this,"messageCleanupCache",{})}handleIncomeMessages(n){let e=n.data?n.data:n.detail;if(!(!e||!e.myop)){let t=e;if(t.direction!==_.down)return;if(t.messageType===g.DisposeMessage){t.destination&&delete this.components[t.destination];return}if(t.messageType===g.InitMessage){let s=t.content.id;if(this.components[s])return;this.components[s]=new Zt(s),this.messageToHost(new He(s));return}if(t.messageType===g.EnvelopedMessage){let s=t,r=s.message;if(t=r,this.alwaysPassEnvelopesToHost||this.components[t.destination]){let a=myop.hostSDK.components.find(d=>d.id===r.destination);if(a){a.send(r);return}let p=myop.hostSDK.components.find(d=>d.id===s.destination);if(p){p.send(r);return}}else return}if(t.messageType){if(t.messageType===g.CleanupMessage){let r=t,a=this.messageCleanupCache[r.cleanupForMessageId],p=new Ae(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[r.cleanupForMessageId],so(a).then(()=>{this.messageToHost(p,r)}).catch(()=>{})):this.messageToHost(p,r);return}let s=!1;this.supportedHandlers.forEach(r=>{if(r.messageType===t.messageType){s=!0;let a=r.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(r.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(r.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,Ie,ce,Je,xe,w=l(()=>{"use strict";oo();io();ro();j={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},de={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},be={message:"message",code:"code"},Ie=class{};i(Ie,"code","code"),i(Ie,"component","component");ce={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},Je={Segment:"Segment",Promo:"Promo",AB:"AB"},xe=class{constructor(n,e){this.container=n;this.shadowRoot=e;i(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));i(this,"getRoot",()=>this.shadowRoot||this.container)}}});var en,js,tn,O,me=l(()=>{"use strict";en=o=>o!==Object(o),js=o=>typeof o=="function",tn=o=>{if(en(o))return!0;if(js(o)||Object.getPrototypeOf(o))return!1;for(let n in o){let e=o[n];if(typeof e=="object"){if(!tn(e))return!1}else{if(en(e))continue;return!1}}return!0},O=(o,n={},e=!0,t=new WeakMap)=>{if(en(o))return o;if(Array.isArray(o)){if(t.has(o))return t.get(o);let s=[];t.set(o,s);for(let r=0;r<o.length;r++){let a=o[r];s[r]=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 r in o){let a=typeof n=="boolean"?n:n[r];a&&(a===!0?(e?o[r]!==void 0:o[r])&&(s[r]=O(o[r],!0,e,t)):typeof a=="object"&&(s[r]=O(o[r],a,e,t)))}return s}return{}}});var ao,po=l(()=>{"use strict";ao={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 We,co=l(()=>{"use strict";$e();b();Gt();We=class extends W{constructor(e,t,s){super(e,t.container,s);this.componentDefinition=e;this.parent=t;i(this,"send",e=>{let t=e.handler,s=super.send(e);return this.parent.send(new Be(this.id,e)),e.handler=t,s});i(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,nn=l(()=>{"use strict";$e();Ne();le=class extends W{constructor(e,t,s,r,a,p){super(e,s,p);this.container=s;this.customElement=r;this.tagName=a;i(this,"ctaCleanup");i(this,"_ctaHandler");i(this,"_ctaQueue",[]);i(this,"cleanupInspect",()=>{});i(this,"send",e=>{let t=super.send(e);return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",e),t});i(this,"dispose",()=>{var e;this.ctaCleanup&&this.ctaCleanup(),super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=r,this.setInitiated()}inspect(){return this.cleanupInspect=we(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(r=>{this.markedForDisposed||e(r.action,r.payload)})}let t=s=>{var a;let r=s;(a=r.detail)!=null&&a.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(r.detail.action,r.detail.payload):this._ctaHandler||this._ctaQueue.push({action:r.detail.action,payload:r.detail.payload}))};this.customElement.addEventListener("myop-cta",t),this.ctaCleanup=()=>{this.customElement.removeEventListener("myop-cta",t)}}}});var Gs,we,mo,lo,fo,Ys,on,sn,Ne=l(()=>{"use strict";b();b();w();me();po();co();nn();Gs=(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},we=(o,n,e,t,s,r)=>{let a=Gs("".concat(r.name," : ").concat(n),e,r);return t.insertBefore(a,s),s.style.border="1px solid #007BFF",s.style.display="block",()=>{s.style.border="unset",t.removeChild(a)}},mo=(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),lo=(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."))},fo=(o,n,e)=>{let t=n.reduce((r,a)=>U(M({},r),{[a.name]:M({},a)}),{}),s={get:(r,a)=>{let p=t[a];if(mo(p,a,o))return!1;if(p.behavior.type===be.code){if(o instanceof le)return(p.behavior.remap||a)==="myop_init_interface"?u=>{if(u===void 0)return o.getData();o.initWithData(u)}:void 0;if(e.loader.type===j.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let m=p.behavior;return o.element.contentWindow[m.remap||a]}return lo(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let m=[];p.behavior.ref&&m.push(G.create(p.behavior.ref)),m.push(f=>{d(f)}),p.behavior.params&&m.push(...p.behavior.params);let u=he[p.behavior.message];o.send(new u(...m))}):null},set:(r,a,p)=>{let d=t[a];if(mo(d,a,o))return!1;if(d.behavior.type===be.code){if(o instanceof le){let u=d.behavior.remap||a;if(u==="myop_cta_handler")return o.setCtaHandler(p),!0;if(u==="myop_init_interface")return o.initWithData(p),!0}if(e.loader.type===j.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let u=d.behavior,f=o.element.contentWindow,c=u.remap||a;if(f[c]=p,c==="myop_cta_handler"&&f.__myop_cta_queue){let y=f.__myop_cta_queue;f.__myop_cta_queue=null,y.forEach(h=>{o.markedForDisposed||p(h.action,h.payload)})}return!0}return lo(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let m=[];d.behavior.ref&&m.push(G.create(d.behavior.ref)),m.push(p),d.behavior.params&&m.push(...d.behavior.params);let u=he[d.behavior.message];return o.send(new u(...m)),!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},Ys=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...r)=>new Promise(a=>{r.forEach(p=>{tn(p)||ao.notSerializableRefCall(t,p)}),n.send(new q(({ref:p,propName:d,functionArgs:m,makeSerializable:u})=>{if(p){let f=p[d];return u(typeof f=="function"?p[d](...m):f,!0)}return null},{elementId:e.refConfig.selector,propName:t,functionArgs:r},p=>{a(p.content)}))})},set(e,t,s){return n.send(new q(({ref:r,propName:a,propValue:p})=>{r&&(r[a]=p)},{elementId:e.refConfig.selector,propValue:s,propName:t},r=>{})),!0}}),on=async(o,n,e,t)=>{let s=o.component;if(!s)throw new Error("cant createRefComponent with detached ref");return new Promise(async(r,a)=>{let p=new We(n.type,s,t);e.push(p),await s.initiated();let d=setTimeout(()=>{a("timeout")},5e3);s.send(new De(o.refConfig,n,U(M({},t||{}),{id:p.id,_hasParent:!0}),async m=>{if(clearTimeout(d),m.failed){a("CreateRefComponentMessage failed");return}let u=e.find(f=>f.id==p.id);if(u!==p){s.refs[o.refConfig.name]=u,r(u);return}else p.setInitiated(),s.refs[o.refConfig.name]=p;m.nestedRefs.forEach(f=>{let c=n.instance.resolvedNestedComponents.find(h=>h.type.id===f.componentDefinitionId).type,y=new We(c,p);y.setInitiated(),p.refs[f.refName]=y,e.push(y)});try{await sn(p,n,e,!0),s.setHeightBasedOnScrollHeight&&s.setHeightBasedOnScrollHeight(),r(p)}catch(f){a(f)}}))})},sn=async(o,n,e,t=!1)=>{o.refs||(o.refs={});let s=Object.values(o.componentDefinition.refs).map(r=>new Promise(async(a,p)=>{var d;if(r.behavior.type==Ie.component){if(t){a();return}let m=r.behavior.componentId;m||(m=r.behavior.instance.componentId);let u=(d=n.instance.resolvedNestedComponents)==null?void 0:d.find(c=>c.type.id===m);if(!u)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let f=G.create("",r,o);try{let c=await on(f,u,e);o.refs[r.name]=c,a()}catch(c){p(c)}}else try{let m=G.create("",r,o);o.refs[r.name]=Ys(m,o),a()}catch(m){}}));try{await Promise.all(s)}catch(r){throw r}}});var Se,rn=l(()=>{"use strict";$e();b();Ne();C();Se=class extends W{constructor(e,t,s,r,a){super(e,s,a);this.componentConfig=e;this.container=s;this.IframeElement=r;i(this,"_autoSizeCleanup");i(this,"_autoSizeOptions");i(this,"_autoSizeUpdate");i(this,"sizeMeta");i(this,"cleanupInspect");i(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new D(()=>window.document.documentElement.scrollHeight,t=>{this.IframeElement.style.height="".concat(t.content,"px"),e()}))});i(this,"observeSizeBasedOnDocumentElement",()=>this.send(new D(({send:t})=>{let{height:s,width:r}=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:r}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px")})));i(this,"observeAutoSize",e=>{if(this._autoSizeOptions=e,this._autoSizeCleanup&&this._autoSizeUpdate)return this._autoSizeUpdate(),this._autoSizeCleanup;let t=this.IframeElement,s=t.contentDocument;if(!s)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let r=(f,c,y)=>c!==void 0&&f<c?c:y!==void 0&&f>y?y:f,a=f=>{if(f===void 0)return;if(typeof f=="number")return f;let c=parseFloat(f);return isNaN(c)?void 0:c},p=()=>{var In,xn,bn,wn,Sn,En,Tn,vn;let f=t.contentDocument;if(!f)return;let c=this._autoSizeOptions,y=a(c==null?void 0:c.minWidth),h=a(c==null?void 0:c.maxWidth),fe=a(c==null?void 0:c.minHeight),ve=a(c==null?void 0:c.maxHeight),Z=(In=c==null?void 0:c.loaderMinHeight)!=null?In:50,ue=((xn=this.sizeMeta)==null?void 0:xn.width)==="100%"?"100%":void 0,L=((bn=this.sizeMeta)==null?void 0:bn.height)==="100%"?"100%":void 0,v=(Sn=(wn=c==null?void 0:c.explicitWidth)!=null?wn:ue)!=null?Sn:"100%",z=(En=c==null?void 0:c.explicitHeight)!=null?En:L,_e=v!==void 0,gn=z!==void 0,Lt=this.container.getBoundingClientRect(),Ds=Lt.width===0,Bs=Lt.height===0||Lt.height===Z,Re=(c!=null&&c.forceAutoSize||Ds)&&!_e,ke=(c!=null&&c.forceAutoSize||Bs)&&!gn;if(!Re&&!ke){t.style.width=typeof v=="number"?"".concat(v,"px"):"100%",t.style.height=typeof z=="number"?"".concat(z,"px"):"100%";let _n=typeof v=="number"?v:void 0,Rn=typeof z=="number"?z:void 0;(_n!==void 0||Rn!==void 0)&&((Tn=c==null?void 0:c.onSizeChange)==null||Tn.call(c,{width:_n,height:Rn,autoSizingWidth:!1,autoSizingHeight:!1}));return}ke&&(t.style.height="0px"),Re&&(t.style.width="0px");let yn=Math.ceil(Math.max(f.documentElement.scrollWidth,f.body.scrollWidth)),hn=Math.ceil(Math.max(f.documentElement.scrollHeight,f.body.scrollHeight)),Mn=r(yn,y,h),Cn=r(hn,fe,ve);Re?t.style.width="".concat(Mn,"px"):t.style.width=typeof v=="number"?"".concat(v,"px"):"100%",ke?t.style.height="".concat(Cn,"px"):t.style.height=typeof z=="number"?"".concat(z,"px"):"100%";let Ls=Re&&h!==void 0&&yn>h,Ps=ke&&ve!==void 0&&hn>ve;f.documentElement.style.overflowX=Ls?"auto":"",f.documentElement.style.overflowY=Ps?"auto":"",(vn=c==null?void 0:c.onSizeChange)==null||vn.call(c,{width:Mn,height:Cn,autoSizingWidth:Re,autoSizingHeight:ke})};p(),this._autoSizeUpdate=p;let d=new ResizeObserver(p);d.observe(s.body),d.observe(s.documentElement);let m=new MutationObserver(p);m.observe(s.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let u=()=>{d.disconnect(),m.disconnect(),this._autoSizeUpdate=void 0,this._autoSizeCleanup=void 0};return this._autoSizeCleanup=u,u});i(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()}))});i(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()}))});i(this,"send",e=>{var r,a;let t=M({},e);if(t.messageType===g.ExecuteComponentMethod)return this[t.method](),()=>{};t.direction=_.down;let s=super.send(t);return(a=(r=this.IframeElement)==null?void 0:r.contentWindow)==null||a.postMessage(t,"*"),s});i(this,"dispose",()=>{this._autoSizeCleanup&&(this._autoSizeCleanup(),this._autoSizeCleanup=void 0),this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=we(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===g.In.MutationObserverMessage||e.messageType===g.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var Y,Xe=l(()=>{"use strict";Y=class{constructor(){i(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 r=(s=t.relative.child)==null?void 0:s.nextSibling;return n.insertBefore(e,r||null)}}else return n.appendChild(e)})}}});var Qs,Ze,uo=l(()=>{"use strict";rn();Xe();ne();w();Qs=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},Ze=class extends Y{constructor(){super(...arguments);i(this,"type",j.IframeLoader);i(this,"load",async(e,t,s,r)=>{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(),m="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=m;let u="\\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(r!=null&&r.hidden?"0":"1",";\\n pointer-events: ").concat(r!=null&&r.hidden?"none":"all",";\\n ");a.style.cssText=u,r!=null&&r.elementAttributes&&Object.entries(r.elementAttributes).forEach(([c,y])=>{y===""||y===null||y===void 0?a.setAttribute(c,""):a.setAttribute(c,String(y))});let f=t.loader.url;r!=null&&r._hasParent&&(f=Qs(f,"_myop-comp",d)),a.src=f,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),a=this.appendChild(s,a,r)}return new Se(e,t,s,a,r)})}}});var et,an=l(()=>{"use strict";et={webcomponent_message_key:"myop_webcomponent_message"}});var Ee,pn=l(()=>{"use strict";an();$e();Ne();Ee=class extends W{constructor(e,t,s,r,a){super(e,s,a);this.container=s;this.customElement=r;i(this,"cleanupInspect",()=>{});i(this,"send",e=>{let t=M({},e),s=super.send(t),r=new CustomEvent(et.webcomponent_message_key,{detail:t});try{this.customElement.dispatchEvent(r)}catch(a){console.log("error while trying to dispatchEvent",a)}return s});i(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=r}inspect(){return this.cleanupInspect=we(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 dn,tt,go=l(()=>{"use strict";pn();Xe();ne();w();dn={},tt=class extends Y{constructor(){super(...arguments);i(this,"type",j.WebComponentLoader);i(this,"load",async(e,t,s,r)=>{let a=t.loader;dn[a.url]?console.log("Module alreday loaded or in loading process"):dn[a.url]=new Promise((m,u)=>{let f=a.url,c=document.createElement("script");c.type="module",c.src=f,c.onload=()=>{m()},c.onerror=()=>{u()},document.head.appendChild(c)}),await dn[a.url],await Bn(1);let p="myop-comp-".concat(E()),d=document.createElement(a.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,r!=null&&r.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"),r!=null&&r._environment&&(d._myopEnvironment=r==null?void 0:r._environment),this.appendChild(s,d,r),new Ee(e,t,s,d,r)})}}});var T,N=l(()=>{"use strict";w();T=class extends Qe{constructor(e,t){super(e);this.context=t;i(this,"executor",e=>{if(e.destination){let t=e.destination;if(this.context[t].context){let s=(r,a)=>{this.messageToHost(U(M({},r),{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,Q=l(()=>{"use strict";B={id:"myop-id"}});var S,yo,P=l(()=>{"use strict";Q();S=(o,n)=>n.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),yo=(o,n)=>{let e=S(o,n);return e.length?e.item(0):null}});var nt,ho=l(()=>{"use strict";C();b();N();P();nt=class extends T{constructor(){super(...arguments);i(this,"messageType",g.BindClickMessage);i(this,"innerExecutor",(e,t,s)=>{let r=S(e.ref,t.shadowRoot),a=[];return r.forEach(p=>{let d=()=>{s(new oe(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var ot,Mo=l(()=>{"use strict";C();N();P();ot=class extends T{constructor(){super(...arguments);i(this,"messageType",g.ChangeTextMessage);i(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(r=>{r.textContent=e.content})})}}});var st,Co=l(()=>{"use strict";w();st=class extends xe{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}}});var it,Io=l(()=>{"use strict";w();Q();N();b();C();it=class extends T{constructor(){super(...arguments);i(this,"innerExecutor",(e,t)=>{let s=t.shadowRoot.querySelectorAll("[".concat(B.id,"]")),r=[];s.forEach(a=>{let p=a.getAttribute(B.id);p&&r.push(new Me(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new pe(e.handlerUniqueId,r))});i(this,"messageType",g.DetectMyopRefsMessage)}}});var rt,xo=l(()=>{"use strict";C();N();P();rt=class extends T{constructor(){super(...arguments);i(this,"messageType",g.SetAttributeMessage);i(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(r=>{r.setAttribute(e.name,e.value)})})}}});var at,bo=l(()=>{"use strict";C();b();N();P();me();at=class extends T{constructor(){super(...arguments);i(this,"messageType",g.AddEventListenerMessage);i(this,"innerExecutor",(e,t,s)=>{let r=S(e.ref,t.shadowRoot),a=[];return r.forEach(p=>{let d=m=>{s(new ie(e.handlerUniqueId,O(m,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var pt,wo=l(()=>{"use strict";C();Q();Fe();Ye();N();pt=class extends T{constructor(){super(...arguments);i(this,"messageType",g.CreateRefComponentMessage);i(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(c=>c.id===e.options.id);d&&d.dispose();let m=p.components.indexOf(d);m!==-1&&p.components.splice(m,1);let u=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),f=[];Object.keys(u.refs).forEach(c=>{let y=u.refs[c];y=y.__nonProxied||y,y.componentDefinition&&f.push({refName:c,componentDefinitionId:y.componentDefinition.id})}),s(new V(e.handlerUniqueId,f))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var dt,cn=l(()=>{"use strict";me();dt=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=O,t.send=n,t.rootRef=e,t.__scriptInputs=t;let r=new Function("return (".concat(o.script,")(...arguments)"))(t);n(r)}});var ct,So=l(()=>{"use strict";C();b();N();cn();ct=class extends T{constructor(){super(...arguments);i(this,"messageType",g.ExecuteScriptMessage);i(this,"innerExecutor",(e,t,s)=>{dt(e,a=>{s(new se(e.handlerUniqueId,a))},t)})}}});var Eo,mt,To=l(()=>{"use strict";C();b();N();P();Q();me();Eo=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(r=>{if(typeof r.value=="string"){let a=r.getAttribute(B.id),p=r.getAttribute("name"),d={id:r.id,name:p,value:Eo(r),required:r.required,validity:O(r.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},mt=class extends T{constructor(){super(...arguments);i(this,"messageType",g.GetElementValueMessage);i(this,"innerExecutor",(e,t,s)=>{S(e.ref,t.shadowRoot).forEach(a=>{s(new re(Eo(a)),e)})})}}});var lt,vo=l(()=>{"use strict";C();N();P();lt=class extends T{constructor(){super(...arguments);i(this,"messageType",g.SetInnerHtml);i(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(r=>{r.innerHTML=e.content})})}}});var _o={};ee(_o,{WebComponentSDK:()=>Te});var Te,mn=l(()=>{"use strict";w();C();an();ho();Mo();Co();Io();te();b();xo();bo();wo();So();To();vo();Te=class extends Ce{constructor(){super(...arguments);i(this,"alwaysPassEnvelopesToHost",!0);i(this,"connectedCallback",(e,t)=>{e.addEventListener(et.webcomponent_message_key,s=>{let r=s.data?s.data:s.detail;if(!r||!r.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=r;if(this.handleIncomeMessages(s),a.messageType===g.InitMessage){let p=a.content.id;this.components[p].context=new st(e,t)}}}),setTimeout(()=>{this.messageToHost(new ae)},1)});i(this,"messageToHost",(e,t)=>{e.direction=_.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)});i(this,"supportedHandlers",[new ot(this.messageToHost,this.components),new lt(this.messageToHost,this.components),new nt(this.messageToHost,this.components),new it(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new at(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new mt(this.messageToHost,this.components),new pt(this.messageToHost,this.components)]);i(this,"init",()=>{})}};F("WebComponentSDK",Te)});var Ro=l(()=>{"use strict";mn()});var ko,Ho=l(()=>{"use strict";ko=""});function Zs(o,n){return class extends HTMLElement{connectedCallback(){let e=n===de.open?"open":"closed",t=this.attachShadow({mode:e});Po().then(s=>{s.connectedCallback(this,t),t.innerHTML=o})}}}var Js,Xs,Bo,Lo,ft,Po,ei,ti,ni,ut,Oo=l(()=>{"use strict";pn();nn();Xe();ne();w();Ro();rn();Ho();Js="<!-- myop-web-component -->",Xs="myop-web-component",Bo=new Set,Lo=[],Po=async()=>(ft||(ft=new Te,ft.init()),ft);ei=(o,n,e)=>{customElements.define(o,Zs(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},ti=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),ni=o=>(o=ti(o),o.replace(/_/g,"-")),ut=class extends Y{constructor(){super(...arguments);i(this,"type",j.HTMLLoader);i(this,"load",async(e,t,s,r)=>{let a=t.loader;if(this.isMyopWebComponent(a.HTML))return this.loadExtractedWebComponent(e,t,s,a.HTML,r);let p="myop-comp-".concat(E()),d;if(a.shadowRootMode===de.localFrame){let m=E(),u="myop-comp-".concat(m),f=document.createElement("iframe");f.id=u,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(r!=null&&r.hidden?"0":"1",";\\n width: 100%;\\n height: 100%;\\n pointer-events: ").concat(r!=null&&r.hidden?"none":"all",";\\n "),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),f=this.appendChild(s,f,r);let c=f.contentDocument||f.contentWindow.document;c.open();let y=null;{let v=new DOMParser().parseFromString(a.HTML,"text/html").querySelector('meta[name="myop:size"]');if(v)try{y=JSON.parse(v.getAttribute("content")||"{}")}catch(z){}}let h=a.HTML;if(r!=null&&r._inspection){let L=new DOMParser().parseFromString(a.HTML,"text/html"),v=L.getElementById("myop_preview");v==null||v.removeAttribute("type");let z=L.implementation.createHTMLDocument();z.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let _e=z.body.firstChild;_e&&L.head&&L.head.insertBefore(L.importNode(_e,!0),L.head.firstChild),h=L.documentElement.outerHTML}else if((r==null?void 0:r.data)!==void 0){let L=new DOMParser().parseFromString(a.HTML,"text/html"),v=L.getElementById("myop_preview");v&&(v.remove(),h=L.documentElement.outerHTML)}c.writeln(h);let fe='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),ve="<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(c.writeln("".concat(fe).concat(ve)),(r==null?void 0:r.data)!==void 0){let ue="<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>",L=JSON.stringify(r.data).replace(/<\\/script/gi,"\\\\u003c/script"),v='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(L,";\\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>");c.writeln(ue+v)}c.close();let Z=new Se(e,t,s,f,r);return Z.sizeMeta=y,Z.initiated().then(()=>{Z.observeAutoSize({forceAutoSize:!0}),r!=null&&r.hidden||Z.show()}),Z}if(a.shadowRootMode===de.none){let m=document.createElement("template");m.innerHTML=a.HTML,d=m.content.firstElementChild,Po().then(u=>{u.connectedCallback(d,d)})}else{let m=ni(e.name+t.id);Lo.includes(m)||(ei(m,a.HTML,a.shadowRootMode),Lo.push(m)),d=document.createElement(m)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,r!=null&&r.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,r),new Ee(e,t,s,d,r)})}isMyopWebComponent(e){return e.trimStart().startsWith(Js)}extractWebComponentScript(e){let r=new DOMParser().parseFromString(e,"text/html").getElementById(Xs);return(r==null?void 0:r.textContent)||null}executeWebComponentScript(e,t){if(Bo.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),Bo.add(t),console.log("[MyopWebComponent] Executed web component script: ".concat(t))}async loadExtractedWebComponent(e,t,s,r,a){let p=this.extractWebComponentScript(r);if(!p)throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');let d="".concat(e.id,"-").concat(t.id),m=window.__MYOP_TAG_NAME__;this.executeWebComponentScript(p,d);let u=window.__MYOP_TAG_NAME__;if(!u)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");m&&m!==u&&console.warn("[MyopWebComponent] __MYOP_TAG_NAME__ changed from ".concat(m," to ").concat(u));let f="myop-comp-".concat(E()),c=document.createElement(u);c.id=f,a!=null&&a.hidden&&(c.style.opacity="0",c.style.position="absolute",c.style.height="0",c.style.width="0",c.style.pointerEvents="none",c.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,c,a);let y=new le(e,t,s,c,u,a);return(a==null?void 0:a.data)!==void 0&&y.initWithData(a.data),console.log("[MyopWebComponent] Loaded <".concat(u,"> into container")),y}}});var Ao,Ko,zo=l(()=>{"use strict";ne();b();Ao=(o,n,e)=>{let t="myop-css-".concat(E());return o.send(new D(({rootRef:s,_stylesheet:r,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let m=p;for(let u in r){m+="".concat(u," { ");let f=r[u];for(let c in f)m+="".concat(c,": ").concat(f[c],"; ");m+="} "}d.appendChild(document.createTextNode(m)),d.id=a,(s.shadowRoot||s.container).appendChild(d)},()=>{},{_stylesheet:n,_css:e||"",_tagId:t})),()=>{o.send(new D(({rootRef:s,_tagId:r})=>{let a=(s.shadowRoot||document).getElementById(r);a&&a.remove()},()=>{},{_tagId:t}))}},Ko=(o,n)=>{let e="myop-css-".concat(E());return o.send(new D(({rootRef:t,_tagId:s,_link:r})=>{let a=document.createElement("link");a.id=s,a.rel="stylesheet",a.href=r,document.head.appendChild(a),(t.shadowRoot||t.container).appendChild(a)},()=>{},{_link:n,_tagId:e})),()=>{o.send(new D(({rootRef:t,_tagId:s})=>{let r=(t.shadowRoot||document).getElementById(s);r&&r.remove()},()=>{},{_tagId:e}))}}});var oi,ln,$o,Fo=l(()=>{"use strict";oi=(o,n)=>{let e=new RegExp(Object.keys(n).join("|"),"g");return o.replace(e,t=>(n[t]||t).toString())},ln=(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=M({},o.loader),o.loader.url=oi(o.loader.url,n),o},$o=o=>async n=>ln(n,o)});var Wo,No,Uo=l(()=>{"use strict";b();Wo=(o,n,e)=>{o.send(new q(({ref:t,_className:s})=>{t==null||t.classList.add(s)},{elementId:e,_className:n}))},No=(o,n,e)=>{o.send(new q(({ref:t,_className:s})=>{t==null||t.classList.remove(s)},{elementId:e,_className:n}))}});var ht,gt,Mt,yt,qo=l(()=>{"use strict";ne();ht=class ht{constructor(){i(this,"_runTimeInstanceId","runtime-instance-id-"+E());i(this,"_runTimeId","runtime-id-"+E());i(this,"_runTimeName","runtime-name-"+E());i(this,"id",this._runTimeId);i(this,"name",this._runTimeName);i(this,"description","");i(this,"loader",null);i(this,"withLoader",n=>(this.loader=n,this));i(this,"withHTMLLoader",n=>(n.type="HTMLLoader",this.loader=n,this));i(this,"build",()=>this)}};i(ht,"create",()=>new ht);gt=ht,Mt=class Mt{constructor(){i(this,"_runTimeInstanceId","runtime-instance-id-"+E());i(this,"_runTimeId","runtime-id-"+E());i(this,"_runTimeName","runtime-name-"+E());i(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});i(this,"name",this._runTimeName);i(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});i(this,"withInstance",n=>(this.instance=n,this));i(this,"withType",n=>(this.type=n,this));i(this,"withName",n=>(this.name=n,this));i(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));i(this,"withRef",n=>(this.type.refs.push(n),this));i(this,"withBasicRef",n=>{let e={id:"",name:n,description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}};return this.type.refs.push(e),this});i(this,"build",()=>JSON.parse(JSON.stringify(this)))}};i(Mt,"create",()=>new Mt);yt=Mt});var si,Ct,ii,ri,J,K,Vo,fn=l(()=>{"use strict";w();si=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}),Ct="__MYOP_CLOUD_REPOSITORY_MAIN__",ii=()=>{if(typeof window<"u")return window[Ct];if(typeof globalThis<"u")return globalThis[Ct]},ri=o=>{typeof window<"u"&&(window[Ct]=o),typeof globalThis<"u"&&(globalThis[Ct]=o)},J=class J{constructor(n="https://cloud.myop.dev"){this._baseUrl=n;i(this,"variants",{});i(this,"preloadedComponents",{});i(this,"userFlows",{});i(this,"_defaultEnv","production");i(this,"_envExplicitlySet",!1)}static get Main(){let n=ii();return n||(J._main||(J._main=new J,ri(J._main)),J._main)}setEnvironment(n){this._defaultEnv=n,this._envExplicitlySet=!0}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(n,e,t){return e!==void 0||t!==void 0?"".concat(n,":").concat(e||this._defaultEnv,":").concat(t?"preview":"live")in this.variants:n in this.preloadedComponents}getPreloadedParams(n){return this.preloadedComponents[n]}async fetchComponentV2(n,e,t){let s=this.preloadedComponents[n],r=e!==void 0||t!==void 0,a,p;if(!r&&s)a=s.env,p=s.preview;else{a=e||this._defaultEnv;let m=e||this._envExplicitlySet;p=t===!0?!0:t===!1?!1:!m}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(m,u)=>{try{let f="".concat(this._baseUrl,"/consume?id=").concat(n,"&env=").concat(a);p&&(f+="&preview=true");let h=(await(await fetch(f)).json()).item;if(!h){u(new Error('Component "'.concat(n,'" not found')));return}if(!h.consume_variant||!h.consume_variant.length){u(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(a,'"')));return}let fe=si(h);m(fe)}catch(f){u(f)}})),await this.variants[d]}async fetchComponentV1(n,e){return e?(await this.fetchFlow(e)).components.find(s=>s.type.id===n):(await this.fetchAutoFlow(n)).components[0]}async fetchAutoFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let r=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&auto=true"))).json();e(r.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 r=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&resolve=components"))).json();e(r.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchComponent(n,e){return this.fetchComponentV1(n,e)}};i(J,"_main",null);K=J,Vo=K});var jo,Go=l(()=>{"use strict";jo=async o=>await o()});var X,Yo,Qo,Jo,Xo,Zo,es,ts,ns,os=l(()=>{"use strict";fn();X=K.Main,Yo=()=>X,Qo=(o,n,e)=>X.isPreloaded(o,n,e),Jo=o=>X.getPreloadedParams(o),Xo=()=>{X=new K("http://localhost:9292")},Zo=o=>{X=new K(o)},es=o=>{X=o},ts=o=>{X.setEnvironment(o)},ns=async(o,n,e)=>Promise.allSettled(o.map(t=>X.fetchComponentV2(t,n,e)))});var un={};ee(un,{CloudRepository:()=>K,ComponentConfig:()=>yt,SkinConfig:()=>gt,addClass:()=>Wo,applyStylesheet:()=>Ao,applyStylesheetLink:()=>Ko,changeSkinUrlByTokenizer:()=>$o,createIframeSkinByTokenizer:()=>ln,enableLocalDev:()=>Xo,exec:()=>jo,getCloudRepository:()=>Yo,getPreloadedParams:()=>Jo,isPreloaded:()=>Qo,preloadComponents:()=>ns,removeClass:()=>No,setCloudRepository:()=>es,setCloudRepositoryUrl:()=>Zo,setEnvironment:()=>ts,v2_CloudRepository:()=>Vo});var It=l(()=>{"use strict";zo();Fo();Uo();qo();fn();Go();os()});var ss,is=l(()=>{"use strict";Kt();It();w();ss=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[s,...r]=At(t);switch(s){case"component":{let[a,p]=r,d=await K.Main.fetchComponent(a);if(d&&d.type.skins.find(u=>u.id===p))return d.instance.skinSelector={type:ce.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=At(t),m=(await K.Main.fetchFlow(a)).components.find(u=>u.type.id===o.type.id);if(m&&m.instance.skinSelector.type===ce.Segmented&&m.instance.resolvedExperiences){let u=m.instance.resolvedExperiences.find(f=>f.id===p);if((u==null?void 0:u.type)===Je.Segment){let f=u,y=m.instance.skinSelector.segments.find(h=>h.segmentId===f.segment.id);if(y)return m.instance.skinSelector=y==null?void 0:y.skinSelector,m}}}break}}}finally{return null}}});var ps={};ee(ps,{HostSDK:()=>$,hostSDK:()=>as});var rs,$,as,Fe=l(()=>{"use strict";te();C();b();uo();go();Ne();w();Ge();Oo();is();rs="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",$=class{constructor(){i(this,"components2init",[]);i(this,"components",[]);i(this,"componentsLoaders",[]);i(this,"initiated",!1);i(this,"version",ge);i(this,"type2InstanceCount",{});i(this,"assignId",n=>(this.type2InstanceCount[n.id]||(this.type2InstanceCount[n.id]=0),"".concat(n.id,"_").concat(++this.type2InstanceCount[n.id])));i(this,"inspected",!1);i(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(n=>{n.inspect&&n.inspect()}))});i(this,"incomingMessageHandler",n=>{if(n.origin,document.location.origin,n.data.myop){if(n.data.direction!==_.up&&n.data.messageType!==g.EnvelopedMessage)return;let e=n.data;if(e.messageType===g.InitRequest){this.components2init.forEach(s=>{s.send(new ye(s.id))});return}if(e.messageType===g.InitResponse){this.components2init=this.components2init.filter(r=>r.id!==e.content.id);let s=this.components.find(r=>{var a;return r.id===((a=e.content)==null?void 0:a.id)});s==null||s.setInitiated();return}if(e.messageType===g.EnvelopedMessage){let s=e,r=this.components.find(a=>a.id===s.destination);if(r){if(s.direction===_.down){s.message.messageType===A.name?r.onMessageReceived(s.message):(s.message.route=s.route,r.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)}}});i(this,"send",n=>{let e=new MessageEvent("",{data:n});this.incomingMessageHandler(e)});i(this,"init",n=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new Ze,new tt,new ut];if(this.componentsLoaders=[...e],n){let t={};n.forEach(s=>{let r=new s(this.componentsLoaders);t[r.type]=r}),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});i(this,"_getSkinIdBySkinSelector",async(n,e=[],t)=>{var r;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((r=n.skin)==null?void 0:r.id)||n.skins[0].id;case ce.Segmented:{let p=await s(n.segments,async d=>{if(d.segmentId==="Default")return!0;let m=e.find(y=>y.type===Je.Segment?y.segment.id===d.segmentId:!1);if(!m)throw new Error("experience not found");let f=m.segment,c=(t||{})[f.function];return c?await c():(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""});i(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)});i(this,"loaderHooks");i(this,"loadComponent",async(n,e,t)=>{var u,f,c,y;if(!e){debugger;throw new Error("no container was found for this component")}let s=await ss(n);s&&(n=s);let r=M(M({},(u=this.loaderHooks)!=null?u:{}),(f=t==null?void 0:t.hooks)!=null?f:{}),a=e;if(a.myop)if(a.component){n=M({},n),n.instance=M({},n.instance);let h=await this.runSkinSelector(n,r);if(!h)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(c=t==null?void 0:t.hooks)!=null&&c.afterSkinSelected&&(h=await t.hooks.afterSkinSelected(M({},h))),n.instance.skinSelector={type:ce.Dedicated,skin:h},t&&(t=M({},t),delete t.hooks),await on(a,n,this.components,t)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(n,r);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(M({},p)));let d=this.componentsLoaders.find(h=>h.type===p.loader.type);if(!d){debugger;throw new Error('no loader "'.concat(p.loader.type,'" was found for component'))}let m=await d.load(n.type,p,e,t);m.isInitiated||this.components2init.push(m),m.bind("onDispose",()=>(this.components=this.components.filter(h=>h!==m),this.components2init=this.components2init.filter(h=>h!==m),!0)),this.components.push(m),(!t||t.connectProps!==!1)&&(m=fo(m,n.type.props,p));try{await sn(m,n,this.components)}catch(h){throw h}return t!=null&&t.skipInit||await m.initiated(),m});i(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,M({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,M({relative:{direction:"before",child:s}},t))}})}};i($,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:rs});if(!window.myop.hostSDK){let o=new $;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:rs}),window.myop.hostSDK=o}as=window.myop.hostSDK;F("hostSDK",as)});var xt,ds=l(()=>{"use strict";C();Q();w();b();xt=class extends x{constructor(){super(...arguments);i(this,"messageType",g.DetectMyopRefsMessage);i(this,"executor",e=>{let t=document.querySelectorAll("[".concat(B.id,"]")),s=[];t.forEach(r=>{let a=r.getAttribute(B.id);a&&s.push(new Me(a,r.tagName,r.getBoundingClientRect()))}),this.messageToHost(new pe(e.handlerUniqueId,s))})}}});var bt,cs=l(()=>{"use strict";C();w();b();P();bt=class extends x{constructor(){super(...arguments);i(this,"messageType",g.BindClickMessage);i(this,"executor",e=>{let t=[];return S(e.ref,document).forEach(r=>{let a=()=>{this.messageToHost(new oe,e)};r.addEventListener("click",a);let p=()=>{r.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(r=>r())}})}}});var wt,ms=l(()=>{"use strict";C();w();P();wt=class extends x{constructor(){super(...arguments);i(this,"messageType",g.ChangeTextMessage);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.textContent=e.content})})}}});var St,ls=l(()=>{"use strict";C();b();w();cn();St=class extends x{constructor(){super(...arguments);i(this,"messageType",g.ExecuteScriptMessage);i(this,"executor",e=>{dt(e,s=>{this.messageToHost(new se(e.handlerUniqueId,s))},new xe(document.documentElement))})}}});var Et,fs=l(()=>{"use strict";C();w();b();me();P();Et=class extends x{constructor(){super(...arguments);i(this,"messageType",g.AddEventListenerMessage);i(this,"executor",e=>{let t=S(e.ref,document),s=[];return t.forEach(r=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new ie(e.handlerUniqueId,O(p,e.serializableSkeleton)))})};r.addEventListener(e.type,a),s.push(()=>{r.removeEventListener(e.type,a)})}),()=>{s.forEach(r=>{r()})}})}}});var Tt,us=l(()=>{"use strict";C();w();P();Tt=class extends x{constructor(){super(...arguments);i(this,"messageType",g.SetAttributeMessage);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.setAttribute(e.name,e.value)})})}}});var vt,gs=l(()=>{"use strict";C();Q();w();Fe();Ye();vt=class extends x{constructor(){super(...arguments);i(this,"messageType",g.CreateRefComponentMessage);i(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 m=a.refs[d];m=m.__nonProxied||m,m.componentDefinition&&p.push({refName:d,componentDefinitionId:m.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 ys,hs=l(()=>{"use strict";ys=(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 _t,Ms=l(()=>{"use strict";C();b();w();hs();_t=class extends x{constructor(){super(...arguments);i(this,"messageType",g.SetMutationObserverMessage);i(this,"executor",e=>{e.source&&ys(document.body,()=>{this.messageToHost(new Pe)})})}}});var Cs,Rt,Is=l(()=>{"use strict";C();Q();w();b();me();P();Cs=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(r=>{if(typeof r.value=="string"){let a=r.getAttribute(B.id),p=r.getAttribute("name"),d={id:r.id,name:p,value:Cs(r),required:r.required,validity:O(r.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);i(this,"messageType",g.GetElementValueMessage);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{this.messageToHost(new re(Cs(s)),e)})})}}});var kt,xs=l(()=>{"use strict";C();w();b();P();kt=class extends x{constructor(){super(...arguments);i(this,"messageType",g.GetAttributeMessage);i(this,"executor",e=>{let t=yo(e.ref,document);t&&this.messageToHost(new Le(t.getAttribute(e.name)),e)})}}});var Ht,bs=l(()=>{"use strict";b();C();w();Ht=class extends x{constructor(){super(...arguments);i(this,"messageType",g.SetResizeObserverMessage);i(this,"executor",e=>{let t=new ResizeObserver(s=>{this.messageToHost(new ze)});return t.observe(document.body),()=>{t.disconnect()}})}}});var Dt,ws=l(()=>{"use strict";C();w();P();Dt=class extends x{constructor(){super(...arguments);i(this,"messageType",g.SetInnerHtml);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.innerHTML=e.content})})}}});var Ss={};ee(Ss,{IframeSDK:()=>Bt});var Bt,Es=l(()=>{"use strict";w();ds();cs();ms();ls();te();fs();us();b();gs();Ms();Is();Ge();xs();bs();ws();Bt=class extends Ce{constructor(){super();i(this,"version",ge);i(this,"messageToHost",(e,t)=>{var r;!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=_.up,(r=window.parent)==null||r.postMessage(M({},e),"*")});i(this,"supportedHandlers",[new wt(this.messageToHost),new Dt(this.messageToHost),new bt(this.messageToHost),new xt(this.messageToHost),new St(this.messageToHost),new Et(this.messageToHost),new Tt(this.messageToHost),new Rt(this.messageToHost),new _t(this.messageToHost),new Ht(this.messageToHost),new kt(this.messageToHost),new vt(this.messageToHost)]);i(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new ae)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};F("IframeSDK",Bt)});var pi={};var ai,Ts=l(()=>{"use strict";b();te();ai=M({},he);F("MyopMessages",ai)});var vs={};ee(vs,{CloudRepository:()=>K,ComponentConfig:()=>yt,SkinConfig:()=>gt,addClass:()=>Wo,applyStylesheet:()=>Ao,applyStylesheetLink:()=>Ko,changeSkinUrlByTokenizer:()=>$o,createIframeSkinByTokenizer:()=>ln,enableLocalDev:()=>Xo,exec:()=>jo,getCloudRepository:()=>Yo,getPreloadedParams:()=>Jo,isPreloaded:()=>Qo,preloadComponents:()=>ns,removeClass:()=>No,setCloudRepository:()=>es,setCloudRepositoryUrl:()=>Zo,setEnvironment:()=>ts,v2_CloudRepository:()=>Vo});var _s=l(()=>{"use strict";te();It();It();F("MyopHelpers",un)});var fi={};ee(fi,{getHostModule:()=>Rs,getIframeModule:()=>ks,getWebcomponentModule:()=>Hs});te();var Dn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(Dn=document.currentScript)==null?void 0:Dn.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][Ot]);else{let t;window.__federation__[n]={},window.__federation__[n][je]=s=>{t&&(document.head.removeChild(t),t=null),window.__federation__[n][Ot]=s,e(s)},t=document.createElement("script"),t.type="module",t.src=o,t.async=!0,document.head.appendChild(t)}};Ge();console.log("myop root sdk - loaded",document.location.origin);var di="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",Rs=()=>Promise.resolve().then(()=>(Fe(),ps)),ks=()=>Promise.resolve().then(()=>(Es(),Ss)),Hs=()=>Promise.resolve().then(()=>(mn(),_o)),ci=()=>Promise.resolve().then(()=>(Ts(),pi)),mi=()=>Promise.resolve().then(()=>(_s(),vs)),Ue=o=>async()=>(await o()).get(),li={version:ge,getHostModule:Ue(Rs),getIframeModule:Ue(ks),getWebcomponentModule:Ue(Hs),getMyopMessages:Ue(ci),getMyopHelpers:Ue(mi)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:di});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=M({rootSDK:li},window.myop);return Ws(fi);})();
1
+ import { jsx as L, jsxs as tn } from "react/jsx-runtime";
2
+ import { useRef as N, useEffect as he, useState as se, useCallback as et } from "react";
3
+ const nn = `"use strict";var MyopSDK=(()=>{var Ye=Object.defineProperty,Ys=Object.defineProperties,Qs=Object.getOwnPropertyDescriptor,Js=Object.getOwnPropertyDescriptors,Xs=Object.getOwnPropertyNames,zn=Object.getOwnPropertySymbols;var $n=Object.prototype.hasOwnProperty,Zs=Object.prototype.propertyIsEnumerable;var Nt=(o,n,e)=>n in o?Ye(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,M=(o,n)=>{for(var e in n||(n={}))$n.call(n,e)&&Nt(o,e,n[e]);if(zn)for(var e of zn(n))Zs.call(n,e)&&Nt(o,e,n[e]);return o},V=(o,n)=>Ys(o,Js(n));var m=(o,n)=>()=>(o&&(n=o(o=0)),n);var se=(o,n)=>{for(var e in n)Ye(o,e,{get:n[e],enumerable:!0})},ei=(o,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of Xs(n))!$n.call(o,s)&&s!==e&&Ye(o,s,{get:()=>n[s],enumerable:!(t=Qs(n,s))||t.enumerable});return o};var ti=o=>ei(Ye({},"__esModule",{value:!0}),o);var i=(o,n,e)=>Nt(o,typeof n!="symbol"?n+"":n,e);var Qe,Je,Ut,F,ie=m(()=>{"use strict";Qe="__federation__",Je="onLoad",Ut="moduleInstance",F=(o,n)=>{window[Qe]&&window[Qe][o]&&window[Qe][o][Je]&&window[Qe][o][Je]({[o]:n})}});var Ce,Xe=m(()=>{Ce="0.3.22"});var u,C=m(()=>{"use strict";u={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,ni,oi,qt,Vt=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)),ni=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("-")},oi=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))},qt=o=>{let n=oi(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(ni(n.slice(t,t+16)));return e}});var Fn,re=m(()=>{"use strict";Vt();Fn=o=>new Promise(n=>setTimeout(n,o))});var v,I,Gt,_,R,J,H=m(()=>{"use strict";re();v=class{};i(v,"down","down"),i(v,"up","up");I=class{constructor(){i(this,"id",E());i(this,"myop",!0);i(this,"content");i(this,"source");i(this,"destination");i(this,"route");i(this,"ref");i(this,"direction");i(this,"cleanable",!1)}static create(...n){return new this(...n)}isTypeof(n){return n.messageType===this.messageType}},Gt=class extends I{constructor(e){super();this.ref=e}},_=class extends I{constructor(e){super();this.replayToHandler=e}},R=class extends I{constructor(e){super();this.handler=e;i(this,"handlerUniqueId",E())}},J=class o{constructor(n,e){this.refConfig=n;this.component=e;i(this,"myop",!0);i(this,"__nonProxied");this.__nonProxied=V(M({},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 Nn,jt,ae,Un=m(()=>{"use strict";H();Nn="ClickReplayMessage",jt=class extends R{constructor(e,t){super(t);this.ref=e;i(this,"replyMessageKey",Nn);i(this,"messageType","BindClickMessage");i(this,"cleanable",!0)}},ae=class extends _{constructor(){super(...arguments);i(this,"messageType",Nn)}}});var Yt,qn=m(()=>{"use strict";H();Yt=class extends I{constructor(e,t){super();this.ref=e;i(this,"messageType","ChangeTextMessage");this.content=t}}});var Vn,si,ii,Gn,k,pe,Qt=m(()=>{"use strict";H();Vn="ExecuteScriptReplyMessage",si=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,ii=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,Gn=o=>{let n=o.match(si);if(n)return n[1]||n[3];{let e=o.match(ii);if(e)return e[1].trim()}},k=class extends R{constructor(e,t=()=>{},s){super(t);this.scriptInputs=s;i(this,"replyMessageKey",Vn);i(this,"messageType","ExecuteScriptMessage");i(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=Gn(this.content)}};i(k,"replierKey","send"),i(k,"completeStreamKey","completeStream");pe=class extends _{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;i(this,"messageType",Vn)}}});var G,jn=m(()=>{"use strict";Qt();G=class extends k{constructor(e,t,s=()=>{}){super(({rootRef:r,elementId:a,_script:p,__scriptInputs:d})=>{let c=(r.shadowRoot||r.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=V(M({},t),{_script:e.toString()})}}});var Yn,Jt,de,Qn=m(()=>{"use strict";H();Yn="EventListenerCallbackMessage",Jt=class extends R{constructor(e,t,s){super(s);this.ref=e;this.type=t;this.handler=s;i(this,"replyMessageKey",Yn);i(this,"messageType","AddEventListenerMessage");i(this,"cleanable",!0);i(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},de=class extends _{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;i(this,"messageType",Yn);this.content={e:t}}}});var Xt,Jn=m(()=>{"use strict";H();Xt=class extends I{constructor(e,t,s){super();this.ref=e;this.name=t;this.value=s;i(this,"messageType","SetAttributeMessage")}}});var Xn,Zt,ce,en=m(()=>{"use strict";H();Xn="ElementValueReplayMessage",Zt=class extends R{constructor(e,t){super(t);this.ref=e;i(this,"replyMessageKey",Xn);i(this,"messageType","GetElementValueMessage")}},ce=class extends _{constructor(e){super();this.content=e;i(this,"messageType",Xn)}}});var tn,Zn=m(()=>{"use strict";H();tn=class extends I{constructor(e,t){super();this.ref=e;i(this,"messageType","SetInnerHtml");this.content=t}}});var Ie,Be,me,eo=m(()=>{"use strict";H();Ie=class extends I{constructor(e){super();i(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},Be=class extends Ie{constructor(){super(...arguments);i(this,"messageType","InitResponse")}},me=class extends I{constructor(){super(...arguments);i(this,"messageType","InitRequest")}}});var to,Le,j,Ze=m(()=>{"use strict";H();to="RefComponentCreatedMessage",Le=class extends R{constructor(e,t,s,r){super(r);this.refConfig=e;this.nestedComponentConfig=t;this.options=s;i(this,"replyMessageKey",to);i(this,"messageType","CreateRefComponentMessage")}},j=class extends _{constructor(e,t,s){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=s;i(this,"messageType",to)}}});var Pe,nn=m(()=>{"use strict";H();Pe=class extends I{constructor(e,t){super();this.destination=e;this.message=t;i(this,"messageType","EnvelopedMessage");let s=t;this.route=[e,...s.route?s.route:[]]}}});var no,on,le,oo=m(()=>{"use strict";H();no="DetectedMyopRefsMessage",on=class extends R{constructor(){super(...arguments);i(this,"messageType","DetectMyopRefsMessage");i(this,"replyMessageKey",no)}},le=class extends _{constructor(e,t){super(e);this.replayToHandler=e;i(this,"messageType",no);this.content=t}isTypeof(e){return e.messageType===this.messageType}}});var so,sn,Oe,io=m(()=>{"use strict";H();so="GetAttributeReplayMessage",sn=class extends R{constructor(e,t,s){super(s);this.ref=e;this.name=t;i(this,"replyMessageKey",so);i(this,"messageType","GetAttributeMessage")}},Oe=class extends _{constructor(e){super();this.content=e;i(this,"messageType",so)}}});var A,ro=m(()=>{"use strict";H();A=class extends I{constructor(e){super();this.method=e;i(this,"messageType","ExecuteComponentMethod")}}});var rn,Ae,ao=m(()=>{"use strict";H();rn=class extends I{constructor(){super(...arguments);i(this,"messageType","SetMutationObserverMessage")}},Ae=class extends I{constructor(){super(...arguments);i(this,"messageType","MutationObserverMessage")}}});var po,Ke,ze,co=m(()=>{"use strict";H();po="CleanupReplayMessage",Ke=class extends R{constructor(e,t){super(t);this.cleanupForMessageId=e;i(this,"replyMessageKey",po);i(this,"messageType","CleanupMessage")}},ze=class extends _{constructor(e){super();this.customCleanup=e;i(this,"messageType",po)}}});var $e,mo=m(()=>{"use strict";H();$e=class extends I{constructor(){super(...arguments);i(this,"messageType","DisposeMessage")}}});var an,We,lo=m(()=>{"use strict";H();an=class extends I{constructor(){super(...arguments);i(this,"cleanable",!0);i(this,"messageType","SetResizeObserverMessage")}},We=class extends I{constructor(){super(...arguments);i(this,"messageType","ResizeObserverMessage")}}});var xe={};se(xe,{AddEventListenerMessage:()=>Jt,BaseMyopMessage:()=>I,BindClickMessage:()=>jt,ChangeTextMessage:()=>Yt,CleanupMessage:()=>Ke,CleanupReplayMessage:()=>ze,ClickReplayMessage:()=>ae,CreateRefComponentMessage:()=>Le,CustomRefMessage:()=>G,DetectMyopRefsMessage:()=>on,DetectedMyopRefsMessage:()=>le,DisposeMessage:()=>$e,ElementValueReplayMessage:()=>ce,EnvelopedMessage:()=>Pe,EventListenerCallbackMessage:()=>de,ExecuteComponentMethod:()=>A,ExecuteScriptMessage:()=>k,ExecuteScriptReplyMessage:()=>pe,GetAttributeMessage:()=>sn,GetAttributeReplayMessage:()=>Oe,GetElementValueMessage:()=>Zt,InitMessage:()=>Ie,InitRequest:()=>me,InitResponse:()=>Be,MessageDirection:()=>v,MutationObserverMessage:()=>Ae,MyopBindMessage:()=>R,MyopBindReplayMessage:()=>_,MyopElementMessage:()=>Gt,Ref:()=>J,RefComponentCreatedMessage:()=>j,ResizeObserverMessage:()=>We,SetAttributeMessage:()=>Xt,SetInnerHtml:()=>tn,SetMutationObserverMessage:()=>rn,SetResizeObserverMessage:()=>an,stripFunction:()=>Gn});var b=m(()=>{"use strict";H();Un();qn();Qt();jn();Qn();Jn();en();Zn();eo();Ze();nn();oo();en();io();ro();ao();co();mo();lo()});var N,Fe=m(()=>{"use strict";C();b();Ne();N=class{constructor(n,e,t){this.componentDefinition=n;this.container=e;i(this,"id","");i(this,"messageHandlers",{});i(this,"element");i(this,"_markedForDisposed",!1);i(this,"bind",(n,e)=>{this.messageHandlers[n]||(this.messageHandlers[n]=[]),this.messageHandlers[n].includes(e)||this.messageHandlers[n].push(e)});i(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],r=a=>e(a)?(t(a),!0):!1;return s.push(r),()=>{let a=s.indexOf(r);a>-1&&s.splice(a,1)}});i(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});i(this,"isInitiated",!1);i(this,"_whenInitiatedResolve");i(this,"_whenInitiatedReject");i(this,"_whenInitiated",new Promise((n,e)=>{this._whenInitiatedResolve=n,this._whenInitiatedReject=e}));i(this,"initiated",()=>this._whenInitiated);i(this,"props",{});i(this,"refs",{});this.id=(t==null?void 0:t.id)||z.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===u.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 Ke(n.id,t=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new $e);let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var be,fo=m(()=>{"use strict";be=class{constructor(n,e,t,s,r){this.myopId=n;this.htmlTagName=e;this.BoundingRect=t;this.offsetTop=s;this.offsetLeft=r;i(this,"type","MyopElementRef")}}});var uo,x,et,go=m(()=>{"use strict";uo=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}},et=class extends x{constructor(e,t){super(e);this.messageToHost=e;this.context=t}}});var pn,we,yo=m(()=>{"use strict";C();w();b();pn=class{constructor(n,e){this.id=n;this.context=e;i(this,"send",n=>{})}},we=class{constructor(){i(this,"messageToHandleAfterInit",[]);i(this,"components",{});i(this,"alwaysPassEnvelopesToHost",!1);i(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===u.DisposeMessage){t.destination&&delete this.components[t.destination];return}if(t.messageType===u.InitMessage){let s=t.content.id;if(this.components[s])return;this.components[s]=new pn(s),this.messageToHost(new Be(s));return}if(t.messageType===u.EnvelopedMessage){let s=t,r=s.message;if(t=r,this.alwaysPassEnvelopesToHost||this.components[t.destination]){let a=myop.hostSDK.components.find(d=>d.id===r.destination);if(a){a.send(r);return}let p=myop.hostSDK.components.find(d=>d.id===s.destination);if(p){p.send(r);return}}else return}if(t.messageType){if(t.messageType===u.CleanupMessage){let r=t,a=this.messageCleanupCache[r.cleanupForMessageId],p=new ze(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[r.cleanupForMessageId],uo(a).then(()=>{this.messageToHost(p,r)}).catch(()=>{})):this.messageToHost(p,r);return}let s=!1;this.supportedHandlers.forEach(r=>{if(r.messageType===t.messageType){s=!0;let a=r.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(r.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(r.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 Y,fe,Te,Se,ue,tt,Ee,w=m(()=>{"use strict";fo();go();yo();Y={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},fe={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},Te={message:"message",code:"code"},Se=class{};i(Se,"code","code"),i(Se,"component","component");ue={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},tt={Segment:"Segment",Promo:"Promo",AB:"AB"},Ee=class{constructor(n,e){this.container=n;this.shadowRoot=e;i(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));i(this,"getRoot",()=>this.shadowRoot||this.container)}}});var dn,ri,cn,O,ge=m(()=>{"use strict";dn=o=>o!==Object(o),ri=o=>typeof o=="function",cn=o=>{if(dn(o))return!0;if(ri(o)||Object.getPrototypeOf(o))return!1;for(let n in o){let e=o[n];if(typeof e=="object"){if(!cn(e))return!1}else{if(dn(e))continue;return!1}}return!0},O=(o,n={},e=!0,t=new WeakMap)=>{if(dn(o))return o;if(Array.isArray(o)){if(t.has(o))return t.get(o);let s=[];t.set(o,s);for(let r=0;r<o.length;r++){let a=o[r];s[r]=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 r in o){let a=typeof n=="boolean"?n:n[r];a&&(a===!0?(e?o[r]!==void 0:o[r])&&(s[r]=O(o[r],!0,e,t)):typeof a=="object"&&(s[r]=O(o[r],a,e,t)))}return s}return{}}});var ho,Mo=m(()=>{"use strict";ho={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 Ue,Co=m(()=>{"use strict";Fe();b();nn();Ue=class extends N{constructor(e,t,s){super(e,t.container,s);this.componentDefinition=e;this.parent=t;i(this,"send",e=>{let t=e.handler,s=super.send(e);return this.parent.send(new Pe(this.id,e)),e.handler=t,s});i(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 ye,mn=m(()=>{"use strict";Fe();qe();ye=class extends N{constructor(e,t,s,r,a,p){super(e,s,p);this.container=s;this.customElement=r;this.tagName=a;i(this,"ctaCleanup");i(this,"_ctaHandler");i(this,"_ctaQueue",[]);i(this,"cleanupInspect",()=>{});i(this,"send",e=>{let t=super.send(e);return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",e),t});i(this,"dispose",()=>{var e;this.ctaCleanup&&this.ctaCleanup(),super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=r,this.setInitiated()}inspect(){return this.cleanupInspect=ve(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(r=>{this.markedForDisposed||e(r.action,r.payload)})}let t=s=>{var a;let r=s;(a=r.detail)!=null&&a.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(r.detail.action,r.detail.payload):this._ctaHandler||this._ctaQueue.push({action:r.detail.action,payload:r.detail.payload}))};this.customElement.addEventListener("myop-cta",t),this.ctaCleanup=()=>{this.customElement.removeEventListener("myop-cta",t)}}}});var ai,ve,Io,xo,bo,pi,ln,fn,qe=m(()=>{"use strict";b();b();w();ge();Mo();Co();mn();ai=(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},ve=(o,n,e,t,s,r)=>{let a=ai("".concat(r.name," : ").concat(n),e,r);return t.insertBefore(a,s),s.style.border="1px solid #007BFF",s.style.display="block",()=>{s.style.border="unset",t.removeChild(a)}},Io=(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),xo=(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."))},bo=(o,n,e)=>{let t=n.reduce((r,a)=>V(M({},r),{[a.name]:M({},a)}),{}),s={get:(r,a)=>{let p=t[a];if(Io(p,a,o))return!1;if(p.behavior.type===Te.code){if(o instanceof ye)return(p.behavior.remap||a)==="myop_init_interface"?f=>{if(f===void 0)return o.getData();o.initWithData(f)}:void 0;if(e.loader.type===Y.HTMLLoader&&e.loader.shadowRootMode===fe.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return xo(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(J.create(p.behavior.ref)),c.push(g=>{d(g)}),p.behavior.params&&c.push(...p.behavior.params);let f=xe[p.behavior.message];o.send(new f(...c))}):null},set:(r,a,p)=>{let d=t[a];if(Io(d,a,o))return!1;if(d.behavior.type===Te.code){if(o instanceof ye){let f=d.behavior.remap||a;if(f==="myop_cta_handler")return o.setCtaHandler(p),!0;if(f==="myop_init_interface")return o.initWithData(p),!0}if(e.loader.type===Y.HTMLLoader&&e.loader.shadowRootMode===fe.localFrame){let f=d.behavior,g=o.element.contentWindow,h=f.remap||a;if(g[h]=p,h==="myop_cta_handler"&&g.__myop_cta_queue){let y=g.__myop_cta_queue;g.__myop_cta_queue=null,y.forEach(l=>{o.markedForDisposed||p(l.action,l.payload)})}return!0}return xo(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(J.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let f=xe[d.behavior.message];return o.send(new f(...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},pi=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...r)=>new Promise(a=>{r.forEach(p=>{cn(p)||ho.notSerializableRefCall(t,p)}),n.send(new G(({ref:p,propName:d,functionArgs:c,makeSerializable:f})=>{if(p){let g=p[d];return f(typeof g=="function"?p[d](...c):g,!0)}return null},{elementId:e.refConfig.selector,propName:t,functionArgs:r},p=>{a(p.content)}))})},set(e,t,s){return n.send(new G(({ref:r,propName:a,propValue:p})=>{r&&(r[a]=p)},{elementId:e.refConfig.selector,propValue:s,propName:t},r=>{})),!0}}),ln=async(o,n,e,t)=>{let s=o.component;if(!s)throw new Error("cant createRefComponent with detached ref");return new Promise(async(r,a)=>{let p=new Ue(n.type,s,t);e.push(p),await s.initiated();let d=setTimeout(()=>{a("timeout")},5e3);s.send(new Le(o.refConfig,n,V(M({},t||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let f=e.find(g=>g.id==p.id);if(f!==p){s.refs[o.refConfig.name]=f,r(f);return}else p.setInitiated(),s.refs[o.refConfig.name]=p;c.nestedRefs.forEach(g=>{let h=n.instance.resolvedNestedComponents.find(l=>l.type.id===g.componentDefinitionId).type,y=new Ue(h,p);y.setInitiated(),p.refs[g.refName]=y,e.push(y)});try{await fn(p,n,e,!0),s.setHeightBasedOnScrollHeight&&s.setHeightBasedOnScrollHeight(),r(p)}catch(g){a(g)}}))})},fn=async(o,n,e,t=!1)=>{o.refs||(o.refs={});let s=Object.values(o.componentDefinition.refs).map(r=>new Promise(async(a,p)=>{var d;if(r.behavior.type==Se.component){if(t){a();return}let c=r.behavior.componentId;c||(c=r.behavior.instance.componentId);let f=(d=n.instance.resolvedNestedComponents)==null?void 0:d.find(h=>h.type.id===c);if(!f)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let g=J.create("",r,o);try{let h=await ln(g,f,e);o.refs[r.name]=h,a()}catch(h){p(h)}}else try{let c=J.create("",r,o);o.refs[r.name]=pi(c,o),a()}catch(c){}}));try{await Promise.all(s)}catch(r){throw r}}});var _e,un=m(()=>{"use strict";Fe();b();qe();C();_e=class extends N{constructor(e,t,s,r,a){super(e,s,a);this.componentConfig=e;this.container=s;this.IframeElement=r;i(this,"_autoSizeCleanup");i(this,"_autoSizeOptions");i(this,"_autoSizeUpdate");i(this,"sizeMeta");i(this,"cleanupInspect");i(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new k(()=>window.document.documentElement.scrollHeight,t=>{this.IframeElement.style.height="".concat(t.content,"px"),e()}))});i(this,"observeSizeBasedOnDocumentElement",()=>this.send(new k(({send:t})=>{let{height:s,width:r}=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:r}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px")})));i(this,"observeAutoSize",e=>{if(this._autoSizeOptions=e,this._autoSizeCleanup&&this._autoSizeUpdate)return this._autoSizeUpdate(),this._autoSizeCleanup;let t=this.IframeElement,s=t.contentDocument;if(!s)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let r=(y,l,$)=>l!==void 0&&y<l?l:$!==void 0&&y>$?$:y,a=y=>{if(y===void 0)return;if(typeof y=="number")return y;let l=parseFloat(y);return isNaN(l)?void 0:l},p=()=>{var kn,Dn,Bn,Ln,Pn,On,An,Kn;let y=t.contentDocument;if(!y)return;let l=this._autoSizeOptions,$=a(l==null?void 0:l.minWidth),ke=a(l==null?void 0:l.maxWidth),ne=a(l==null?void 0:l.minHeight),Q=a(l==null?void 0:l.maxHeight),B=(kn=l==null?void 0:l.loaderMinHeight)!=null?kn:50,P=((Dn=this.sizeMeta)==null?void 0:Dn.width)==="100%"?"100%":void 0,De=((Bn=this.sizeMeta)==null?void 0:Bn.height)==="100%"?"100%":void 0,W=(Pn=(Ln=l==null?void 0:l.explicitWidth)!=null?Ln:P)!=null?Pn:"100%",oe=(On=l==null?void 0:l.explicitHeight)!=null?On:De,wn=W!==void 0,Sn=oe!==void 0,Kt=this.container.getBoundingClientRect(),Ws=Kt.width===0,Fs=Kt.height===0||Kt.height===B,he=(l!=null&&l.forceAutoSize||Ws)&&!wn,Me=(l!=null&&l.forceAutoSize||Fs)&&!Sn;if(!he&&!Me){t.style.width=typeof W=="number"?"".concat(W,"px"):"100%",t.style.height=typeof oe=="number"?"".concat(oe,"px"):"100%";let Ge=typeof W=="number"?W:void 0,je=typeof oe=="number"?oe:void 0;(Ge!==void 0||je!==void 0)&&((An=l==null?void 0:l.onSizeChange)==null||An.call(l,{width:Ge,height:je,autoSizingWidth:!1,autoSizingHeight:!1}));return}let Ns=t.style.transition,q=this.container,Us=q.style.transition;t.style.transition="none",q.style.transition="none";let En=t.getBoundingClientRect().height,Tn=t.getBoundingClientRect().width,vn=Math.ceil(Math.max(y.documentElement.scrollHeight,y.body.scrollHeight)),_n=Math.ceil(Math.max(y.documentElement.scrollWidth,y.body.scrollWidth)),zt=_n,$t=vn,qs=Me&&vn>En+1,Vs=he&&_n>Tn+1,Wt=Me&&!qs,Ft=he&&!Vs;if(Wt||Ft){let Ge=q.style.minHeight,je=q.style.minWidth;Wt&&(q.style.minHeight="".concat(En,"px")),Ft&&(q.style.minWidth="".concat(Tn,"px")),Wt&&(t.style.height="0px"),Ft&&(t.style.width="0px"),zt=Math.ceil(Math.max(y.documentElement.scrollWidth,y.body.scrollWidth)),$t=Math.ceil(Math.max(y.documentElement.scrollHeight,y.body.scrollHeight)),q.style.minHeight=Ge,q.style.minWidth=je}let Rn=r(zt,$,ke),Hn=r($t,ne,Q);he?t.style.width="".concat(Rn,"px"):t.style.width=typeof W=="number"?"".concat(W,"px"):"100%",Me?t.style.height="".concat(Hn,"px"):t.style.height=typeof oe=="number"?"".concat(oe,"px"):"100%",t.offsetHeight,t.style.transition=Ns,q.style.transition=Us;let Gs=he&&ke!==void 0&&zt>ke,js=Me&&Q!==void 0&&$t>Q;y.documentElement.style.overflowX=Gs?"auto":"",y.documentElement.style.overflowY=js?"auto":"",(Kn=l==null?void 0:l.onSizeChange)==null||Kn.call(l,{width:Rn,height:Hn,autoSizingWidth:he,autoSizingHeight:Me})};p(),this._autoSizeUpdate=p;let d,c=()=>{d===void 0&&(d=requestAnimationFrame(()=>{d=void 0,p()}))},f=new ResizeObserver(()=>c());f.observe(s.body),f.observe(s.documentElement);let g=new MutationObserver(()=>c());g.observe(s.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let h=()=>{f.disconnect(),g.disconnect(),d!==void 0&&(cancelAnimationFrame(d),d=void 0),this._autoSizeUpdate=void 0,this._autoSizeCleanup=void 0};return this._autoSizeCleanup=h,h});i(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new k(()=>{let{height:t,width:s}=document.documentElement.getBoundingClientRect();return{height:t,width:s}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px"),e()}))});i(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new k(()=>{let s=0;return s++,s--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+s+"px"},t=>{this.IframeElement.style.height=t.content,e()}))});i(this,"send",e=>{var r,a;let t=M({},e);if(t.messageType===u.ExecuteComponentMethod)return this[t.method](),()=>{};t.direction=v.down;let s=super.send(t);return(a=(r=this.IframeElement)==null?void 0:r.contentWindow)==null||a.postMessage(t,"*"),s});i(this,"dispose",()=>{this._autoSizeCleanup&&(this._autoSizeCleanup(),this._autoSizeCleanup=void 0),this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=ve(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===u.In.MutationObserverMessage||e.messageType===u.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var X,nt=m(()=>{"use strict";X=class{constructor(){i(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 r=(s=t.relative.child)==null?void 0:s.nextSibling;return n.insertBefore(e,r||null)}}else return n.appendChild(e)})}}});var di,ot,wo=m(()=>{"use strict";un();nt();re();w();di=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},ot=class extends X{constructor(){super(...arguments);i(this,"type",Y.IframeLoader);i(this,"load",async(e,t,s,r)=>{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 f="\\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(r!=null&&r.hidden?"0":"1",";\\n pointer-events: ").concat(r!=null&&r.hidden?"none":"all",";\\n ");a.style.cssText=f,r!=null&&r.elementAttributes&&Object.entries(r.elementAttributes).forEach(([h,y])=>{y===""||y===null||y===void 0?a.setAttribute(h,""):a.setAttribute(h,String(y))});let g=t.loader.url;r!=null&&r._hasParent&&(g=di(g,"_myop-comp",d)),a.src=g,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),a=this.appendChild(s,a,r)}return new _e(e,t,s,a,r)})}}});var st,gn=m(()=>{"use strict";st={webcomponent_message_key:"myop_webcomponent_message"}});var Re,yn=m(()=>{"use strict";gn();Fe();qe();Re=class extends N{constructor(e,t,s,r,a){super(e,s,a);this.container=s;this.customElement=r;i(this,"cleanupInspect",()=>{});i(this,"send",e=>{let t=M({},e),s=super.send(t),r=new CustomEvent(st.webcomponent_message_key,{detail:t});try{this.customElement.dispatchEvent(r)}catch(a){console.log("error while trying to dispatchEvent",a)}return s});i(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=r}inspect(){return this.cleanupInspect=ve(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 hn,it,So=m(()=>{"use strict";yn();nt();re();w();hn={},it=class extends X{constructor(){super(...arguments);i(this,"type",Y.WebComponentLoader);i(this,"load",async(e,t,s,r)=>{let a=t.loader;hn[a.url]?console.log("Module alreday loaded or in loading process"):hn[a.url]=new Promise((c,f)=>{let g=a.url,h=document.createElement("script");h.type="module",h.src=g,h.onload=()=>{c()},h.onerror=()=>{f()},document.head.appendChild(h)}),await hn[a.url],await Fn(1);let p="myop-comp-".concat(E()),d=document.createElement(a.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,r!=null&&r.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"),r!=null&&r._environment&&(d._myopEnvironment=r==null?void 0:r._environment),this.appendChild(s,d,r),new Re(e,t,s,d,r)})}}});var T,U=m(()=>{"use strict";w();T=class extends et{constructor(e,t){super(e);this.context=t;i(this,"executor",e=>{if(e.destination){let t=e.destination;if(this.context[t].context){let s=(r,a)=>{this.messageToHost(V(M({},r),{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 D,Z=m(()=>{"use strict";D={id:"myop-id"}});var S,Eo,L=m(()=>{"use strict";Z();S=(o,n)=>n.querySelectorAll("[".concat(D.id,"='").concat(o.refConfig.selector,"']")),Eo=(o,n)=>{let e=S(o,n);return e.length?e.item(0):null}});var rt,To=m(()=>{"use strict";C();b();U();L();rt=class extends T{constructor(){super(...arguments);i(this,"messageType",u.BindClickMessage);i(this,"innerExecutor",(e,t,s)=>{let r=S(e.ref,t.shadowRoot),a=[];return r.forEach(p=>{let d=()=>{s(new ae(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var at,vo=m(()=>{"use strict";C();U();L();at=class extends T{constructor(){super(...arguments);i(this,"messageType",u.ChangeTextMessage);i(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(r=>{r.textContent=e.content})})}}});var pt,_o=m(()=>{"use strict";w();pt=class extends Ee{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}}});var dt,Ro=m(()=>{"use strict";w();Z();U();b();C();dt=class extends T{constructor(){super(...arguments);i(this,"innerExecutor",(e,t)=>{let s=t.shadowRoot.querySelectorAll("[".concat(D.id,"]")),r=[];s.forEach(a=>{let p=a.getAttribute(D.id);p&&r.push(new be(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new le(e.handlerUniqueId,r))});i(this,"messageType",u.DetectMyopRefsMessage)}}});var ct,Ho=m(()=>{"use strict";C();U();L();ct=class extends T{constructor(){super(...arguments);i(this,"messageType",u.SetAttributeMessage);i(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(r=>{r.setAttribute(e.name,e.value)})})}}});var mt,ko=m(()=>{"use strict";C();b();U();L();ge();mt=class extends T{constructor(){super(...arguments);i(this,"messageType",u.AddEventListenerMessage);i(this,"innerExecutor",(e,t,s)=>{let r=S(e.ref,t.shadowRoot),a=[];return r.forEach(p=>{let d=c=>{s(new de(e.handlerUniqueId,O(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var lt,Do=m(()=>{"use strict";C();Z();Ne();Ze();U();lt=class extends T{constructor(){super(...arguments);i(this,"messageType",u.CreateRefComponentMessage);i(this,"innerExecutor",(e,t,s)=>{(async()=>{let a=t.shadowRoot.querySelectorAll("[".concat(D.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=z.Instance(),d=p.components.find(h=>h.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let f=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),g=[];Object.keys(f.refs).forEach(h=>{let y=f.refs[h];y=y.__nonProxied||y,y.componentDefinition&&g.push({refName:h,componentDefinitionId:y.componentDefinition.id})}),s(new j(e.handlerUniqueId,g))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new j(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var ft,Mn=m(()=>{"use strict";ge();ft=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=O,t.send=n,t.rootRef=e,t.__scriptInputs=t;let r=new Function("return (".concat(o.script,")(...arguments)"))(t);n(r)}});var ut,Bo=m(()=>{"use strict";C();b();U();Mn();ut=class extends T{constructor(){super(...arguments);i(this,"messageType",u.ExecuteScriptMessage);i(this,"innerExecutor",(e,t,s)=>{ft(e,a=>{s(new pe(e.handlerUniqueId,a))},t)})}}});var Lo,gt,Po=m(()=>{"use strict";C();b();U();L();Z();ge();Lo=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(r=>{if(typeof r.value=="string"){let a=r.getAttribute(D.id),p=r.getAttribute("name"),d={id:r.id,name:p,value:Lo(r),required:r.required,validity:O(r.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},gt=class extends T{constructor(){super(...arguments);i(this,"messageType",u.GetElementValueMessage);i(this,"innerExecutor",(e,t,s)=>{S(e.ref,t.shadowRoot).forEach(a=>{s(new ce(Lo(a)),e)})})}}});var yt,Oo=m(()=>{"use strict";C();U();L();yt=class extends T{constructor(){super(...arguments);i(this,"messageType",u.SetInnerHtml);i(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(r=>{r.innerHTML=e.content})})}}});var Ao={};se(Ao,{WebComponentSDK:()=>He});var He,Cn=m(()=>{"use strict";w();C();gn();To();vo();_o();Ro();ie();b();Ho();ko();Do();Bo();Po();Oo();He=class extends we{constructor(){super(...arguments);i(this,"alwaysPassEnvelopesToHost",!0);i(this,"connectedCallback",(e,t)=>{e.addEventListener(st.webcomponent_message_key,s=>{let r=s.data?s.data:s.detail;if(!r||!r.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=r;if(this.handleIncomeMessages(s),a.messageType===u.InitMessage){let p=a.content.id;this.components[p].context=new pt(e,t)}}}),setTimeout(()=>{this.messageToHost(new me)},1)});i(this,"messageToHost",(e,t)=>{e.direction=v.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)});i(this,"supportedHandlers",[new at(this.messageToHost,this.components),new yt(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new dt(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new mt(this.messageToHost,this.components),new ut(this.messageToHost,this.components),new gt(this.messageToHost,this.components),new lt(this.messageToHost,this.components)]);i(this,"init",()=>{})}};F("WebComponentSDK",He)});var Ko=m(()=>{"use strict";Cn()});var zo,$o=m(()=>{"use strict";zo=""});function li(o,n){return class extends HTMLElement{connectedCallback(){let e=n===fe.open?"open":"closed",t=this.attachShadow({mode:e});Uo().then(s=>{s.connectedCallback(this,t),t.innerHTML=o})}}}var ci,mi,Fo,No,ht,Uo,fi,ui,gi,Mt,qo=m(()=>{"use strict";yn();mn();nt();re();w();Ko();un();$o();ci="<!-- myop-web-component -->",mi="myop-web-component",Fo=new Set,No=[],Uo=async()=>(ht||(ht=new He,ht.init()),ht);fi=(o,n,e)=>{customElements.define(o,li(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},ui=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),gi=o=>(o=ui(o),o.replace(/_/g,"-")),Mt=class extends X{constructor(){super(...arguments);i(this,"type",Y.HTMLLoader);i(this,"load",async(e,t,s,r)=>{let a=t.loader;if(this.isMyopWebComponent(a.HTML))return this.loadExtractedWebComponent(e,t,s,a.HTML,r);let p="myop-comp-".concat(E()),d;if(a.shadowRootMode===fe.localFrame){let c=E(),f="myop-comp-".concat(c),g=document.createElement("iframe");g.id=f,g.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(r!=null&&r.hidden?"0":"1",";\\n width: 100%;\\n height: 100%;\\n pointer-events: ").concat(r!=null&&r.hidden?"none":"all",";\\n "),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),g=this.appendChild(s,g,r);let h=g.contentDocument||g.contentWindow.document;h.open();let y=null;{let P=new DOMParser().parseFromString(a.HTML,"text/html").querySelector('meta[name="myop:size"]');if(P)try{y=JSON.parse(P.getAttribute("content")||"{}")}catch(De){}}let l=a.HTML;if(r!=null&&r._inspection){let B=new DOMParser().parseFromString(a.HTML,"text/html"),P=B.getElementById("myop_preview");P==null||P.removeAttribute("type");let De=B.implementation.createHTMLDocument();De.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let W=De.body.firstChild;W&&B.head&&B.head.insertBefore(B.importNode(W,!0),B.head.firstChild),l=B.documentElement.outerHTML}else if((r==null?void 0:r.data)!==void 0){let B=new DOMParser().parseFromString(a.HTML,"text/html"),P=B.getElementById("myop_preview");P&&(P.remove(),l=B.documentElement.outerHTML)}h.writeln(l);let $='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),ke="<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(h.writeln("".concat($).concat(ke)),(r==null?void 0:r.data)!==void 0){let Q="<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>",B=JSON.stringify(r.data).replace(/<\\/script/gi,"\\\\u003c/script"),P='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(B,";\\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>");h.writeln(Q+P)}h.close();let ne=new _e(e,t,s,g,r);return ne.sizeMeta=y,ne.initiated().then(()=>{ne.observeAutoSize({forceAutoSize:!0}),r!=null&&r.hidden||ne.show()}),ne}if(a.shadowRootMode===fe.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,Uo().then(f=>{f.connectedCallback(d,d)})}else{let c=gi(e.name+t.id);No.includes(c)||(fi(c,a.HTML,a.shadowRootMode),No.push(c)),d=document.createElement(c)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,r!=null&&r.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,r),new Re(e,t,s,d,r)})}isMyopWebComponent(e){return e.trimStart().startsWith(ci)}extractWebComponentScript(e){let r=new DOMParser().parseFromString(e,"text/html").getElementById(mi);return(r==null?void 0:r.textContent)||null}executeWebComponentScript(e,t){if(Fo.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),Fo.add(t),console.log("[MyopWebComponent] Executed web component script: ".concat(t))}async loadExtractedWebComponent(e,t,s,r,a){let p=this.extractWebComponentScript(r);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 f=window.__MYOP_TAG_NAME__;if(!f)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");c&&c!==f&&console.warn("[MyopWebComponent] __MYOP_TAG_NAME__ changed from ".concat(c," to ").concat(f));let g="myop-comp-".concat(E()),h=document.createElement(f);h.id=g,a!=null&&a.hidden&&(h.style.opacity="0",h.style.position="absolute",h.style.height="0",h.style.width="0",h.style.pointerEvents="none",h.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,h,a);let y=new ye(e,t,s,h,f,a);return(a==null?void 0:a.data)!==void 0&&y.initWithData(a.data),console.log("[MyopWebComponent] Loaded <".concat(f,"> into container")),y}}});var Vo,Go,jo=m(()=>{"use strict";re();b();Vo=(o,n,e)=>{let t="myop-css-".concat(E());return o.send(new k(({rootRef:s,_stylesheet:r,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let f in r){c+="".concat(f," { ");let g=r[f];for(let h in g)c+="".concat(h,": ").concat(g[h],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(s.shadowRoot||s.container).appendChild(d)},()=>{},{_stylesheet:n,_css:e||"",_tagId:t})),()=>{o.send(new k(({rootRef:s,_tagId:r})=>{let a=(s.shadowRoot||document).getElementById(r);a&&a.remove()},()=>{},{_tagId:t}))}},Go=(o,n)=>{let e="myop-css-".concat(E());return o.send(new k(({rootRef:t,_tagId:s,_link:r})=>{let a=document.createElement("link");a.id=s,a.rel="stylesheet",a.href=r,document.head.appendChild(a),(t.shadowRoot||t.container).appendChild(a)},()=>{},{_link:n,_tagId:e})),()=>{o.send(new k(({rootRef:t,_tagId:s})=>{let r=(t.shadowRoot||document).getElementById(s);r&&r.remove()},()=>{},{_tagId:e}))}}});var yi,In,Yo,Qo=m(()=>{"use strict";yi=(o,n)=>{let e=new RegExp(Object.keys(n).join("|"),"g");return o.replace(e,t=>(n[t]||t).toString())},In=(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=M({},o.loader),o.loader.url=yi(o.loader.url,n),o},Yo=o=>async n=>In(n,o)});var Jo,Xo,Zo=m(()=>{"use strict";b();Jo=(o,n,e)=>{o.send(new G(({ref:t,_className:s})=>{t==null||t.classList.add(s)},{elementId:e,_className:n}))},Xo=(o,n,e)=>{o.send(new G(({ref:t,_className:s})=>{t==null||t.classList.remove(s)},{elementId:e,_className:n}))}});var xt,Ct,bt,It,es=m(()=>{"use strict";re();xt=class xt{constructor(){i(this,"_runTimeInstanceId","runtime-instance-id-"+E());i(this,"_runTimeId","runtime-id-"+E());i(this,"_runTimeName","runtime-name-"+E());i(this,"id",this._runTimeId);i(this,"name",this._runTimeName);i(this,"description","");i(this,"loader",null);i(this,"withLoader",n=>(this.loader=n,this));i(this,"withHTMLLoader",n=>(n.type="HTMLLoader",this.loader=n,this));i(this,"build",()=>this)}};i(xt,"create",()=>new xt);Ct=xt,bt=class bt{constructor(){i(this,"_runTimeInstanceId","runtime-instance-id-"+E());i(this,"_runTimeId","runtime-id-"+E());i(this,"_runTimeName","runtime-name-"+E());i(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});i(this,"name",this._runTimeName);i(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});i(this,"withInstance",n=>(this.instance=n,this));i(this,"withType",n=>(this.type=n,this));i(this,"withName",n=>(this.name=n,this));i(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));i(this,"withRef",n=>(this.type.refs.push(n),this));i(this,"withBasicRef",n=>{let e={id:"",name:n,description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}};return this.type.refs.push(e),this});i(this,"build",()=>JSON.parse(JSON.stringify(this)))}};i(bt,"create",()=>new bt);It=bt});var hi,wt,Mi,Ci,ee,K,ts,xn=m(()=>{"use strict";w();hi=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:Te.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:Te.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),wt="__MYOP_CLOUD_REPOSITORY_MAIN__",Mi=()=>{if(typeof window<"u")return window[wt];if(typeof globalThis<"u")return globalThis[wt]},Ci=o=>{typeof window<"u"&&(window[wt]=o),typeof globalThis<"u"&&(globalThis[wt]=o)},ee=class ee{constructor(n="https://cloud.myop.dev"){this._baseUrl=n;i(this,"variants",{});i(this,"preloadedComponents",{});i(this,"userFlows",{});i(this,"_defaultEnv","production");i(this,"_envExplicitlySet",!1)}static get Main(){let n=Mi();return n||(ee._main||(ee._main=new ee,Ci(ee._main)),ee._main)}setEnvironment(n){this._defaultEnv=n,this._envExplicitlySet=!0}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(n,e,t){return e!==void 0||t!==void 0?"".concat(n,":").concat(e||this._defaultEnv,":").concat(t?"preview":"live")in this.variants:n in this.preloadedComponents}getPreloadedParams(n){return this.preloadedComponents[n]}async fetchComponentV2(n,e,t){let s=this.preloadedComponents[n],r=e!==void 0||t!==void 0,a,p;if(!r&&s)a=s.env,p=s.preview;else{a=e||this._defaultEnv;let c=e||this._envExplicitlySet;p=t===!0?!0:t===!1?!1:!c}let d="".concat(n,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:n.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[n]||(this.preloadedComponents[n]={env:a,preview:p}),this.variants[d]=new Promise(async(c,f)=>{try{let g="".concat(this._baseUrl,"/consume?id=").concat(n,"&env=").concat(a);p&&(g+="&preview=true");let l=(await(await fetch(g)).json()).item;if(!l){f(new Error('Component "'.concat(n,'" not found')));return}if(!l.consume_variant||!l.consume_variant.length){f(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(a,'"')));return}let $=hi(l);c($)}catch(g){f(g)}})),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 r=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&auto=true"))).json();e(r.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 r=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&resolve=components"))).json();e(r.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchComponent(n,e){return this.fetchComponentV1(n,e)}};i(ee,"_main",null);K=ee,ts=K});var ns,os=m(()=>{"use strict";ns=async o=>await o()});var te,ss,is,rs,as,ps,ds,cs,ms,ls=m(()=>{"use strict";xn();te=K.Main,ss=()=>te,is=(o,n,e)=>te.isPreloaded(o,n,e),rs=o=>te.getPreloadedParams(o),as=()=>{te=new K("http://localhost:9292")},ps=o=>{te=new K(o)},ds=o=>{te=o},cs=o=>{te.setEnvironment(o)},ms=async(o,n,e)=>Promise.allSettled(o.map(t=>te.fetchComponentV2(t,n,e)))});var bn={};se(bn,{CloudRepository:()=>K,ComponentConfig:()=>It,SkinConfig:()=>Ct,addClass:()=>Jo,applyStylesheet:()=>Vo,applyStylesheetLink:()=>Go,changeSkinUrlByTokenizer:()=>Yo,createIframeSkinByTokenizer:()=>In,enableLocalDev:()=>as,exec:()=>ns,getCloudRepository:()=>ss,getPreloadedParams:()=>rs,isPreloaded:()=>is,preloadComponents:()=>ms,removeClass:()=>Xo,setCloudRepository:()=>ds,setCloudRepositoryUrl:()=>ps,setEnvironment:()=>cs,v2_CloudRepository:()=>ts});var St=m(()=>{"use strict";jo();Qo();Zo();es();xn();os();ls()});var fs,us=m(()=>{"use strict";Vt();St();w();fs=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[s,...r]=qt(t);switch(s){case"component":{let[a,p]=r,d=await K.Main.fetchComponent(a);if(d&&d.type.skins.find(f=>f.id===p))return d.instance.skinSelector={type:ue.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=qt(t),c=(await K.Main.fetchFlow(a)).components.find(f=>f.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ue.Segmented&&c.instance.resolvedExperiences){let f=c.instance.resolvedExperiences.find(g=>g.id===p);if((f==null?void 0:f.type)===tt.Segment){let g=f,y=c.instance.skinSelector.segments.find(l=>l.segmentId===g.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var hs={};se(hs,{HostSDK:()=>z,hostSDK:()=>ys});var gs,z,ys,Ne=m(()=>{"use strict";ie();C();b();wo();So();qe();w();Xe();qo();us();gs="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",z=class{constructor(){i(this,"components2init",[]);i(this,"components",[]);i(this,"componentsLoaders",[]);i(this,"initiated",!1);i(this,"version",Ce);i(this,"type2InstanceCount",{});i(this,"assignId",n=>(this.type2InstanceCount[n.id]||(this.type2InstanceCount[n.id]=0),"".concat(n.id,"_").concat(++this.type2InstanceCount[n.id])));i(this,"inspected",!1);i(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(n=>{n.inspect&&n.inspect()}))});i(this,"incomingMessageHandler",n=>{if(n.origin,document.location.origin,n.data.myop){if(n.data.direction!==v.up&&n.data.messageType!==u.EnvelopedMessage)return;let e=n.data;if(e.messageType===u.InitRequest){this.components2init.forEach(s=>{s.send(new Ie(s.id))});return}if(e.messageType===u.InitResponse){this.components2init=this.components2init.filter(r=>r.id!==e.content.id);let s=this.components.find(r=>{var a;return r.id===((a=e.content)==null?void 0:a.id)});s==null||s.setInitiated();return}if(e.messageType===u.EnvelopedMessage){let s=e,r=this.components.find(a=>a.id===s.destination);if(r){if(s.direction===v.down){s.message.messageType===A.name?r.onMessageReceived(s.message):(s.message.route=s.route,r.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)}}});i(this,"send",n=>{let e=new MessageEvent("",{data:n});this.incomingMessageHandler(e)});i(this,"init",n=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new ot,new it,new Mt];if(this.componentsLoaders=[...e],n){let t={};n.forEach(s=>{let r=new s(this.componentsLoaders);t[r.type]=r}),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});i(this,"_getSkinIdBySkinSelector",async(n,e=[],t)=>{var r;async function s(a,p){for(let d of a)if(await p(d))return d}switch(n.type){case"DedicatedSkin":case ue.Dedicated:return((r=n.skin)==null?void 0:r.id)||n.skins[0].id;case ue.Segmented:{let p=await s(n.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===tt.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let g=c.segment,h=(t||{})[g.function];return h?await h():(console.warn("segmentId:".concat(d.segmentId,", ").concat(g.function," function not provided !")),!1)});if(p)return this._getSkinIdBySkinSelector(p.skinSelector,e);debugger}break;default:debugger}return""});i(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)});i(this,"loaderHooks");i(this,"loadComponent",async(n,e,t)=>{var f,g,h,y;if(!e){debugger;throw new Error("no container was found for this component")}let s=await fs(n);s&&(n=s);let r=M(M({},(f=this.loaderHooks)!=null?f:{}),(g=t==null?void 0:t.hooks)!=null?g:{}),a=e;if(a.myop)if(a.component){n=M({},n),n.instance=M({},n.instance);let l=await this.runSkinSelector(n,r);if(!l)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(h=t==null?void 0:t.hooks)!=null&&h.afterSkinSelected&&(l=await t.hooks.afterSkinSelected(M({},l))),n.instance.skinSelector={type:ue.Dedicated,skin:l},t&&(t=M({},t),delete t.hooks),await ln(a,n,this.components,t)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(n,r);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(M({},p)));let d=this.componentsLoaders.find(l=>l.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(l=>l!==c),this.components2init=this.components2init.filter(l=>l!==c),!0)),this.components.push(c),(!t||t.connectProps!==!1)&&(c=bo(c,n.type.props,p));try{await fn(c,n,this.components)}catch(l){throw l}return t!=null&&t.skipInit||await c.initiated(),c});i(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,M({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,M({relative:{direction:"before",child:s}},t))}})}};i(z,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:gs});if(!window.myop.hostSDK){let o=new z;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:gs}),window.myop.hostSDK=o}ys=window.myop.hostSDK;F("hostSDK",ys)});var Et,Ms=m(()=>{"use strict";C();Z();w();b();Et=class extends x{constructor(){super(...arguments);i(this,"messageType",u.DetectMyopRefsMessage);i(this,"executor",e=>{let t=document.querySelectorAll("[".concat(D.id,"]")),s=[];t.forEach(r=>{let a=r.getAttribute(D.id);a&&s.push(new be(a,r.tagName,r.getBoundingClientRect()))}),this.messageToHost(new le(e.handlerUniqueId,s))})}}});var Tt,Cs=m(()=>{"use strict";C();w();b();L();Tt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.BindClickMessage);i(this,"executor",e=>{let t=[];return S(e.ref,document).forEach(r=>{let a=()=>{this.messageToHost(new ae,e)};r.addEventListener("click",a);let p=()=>{r.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(r=>r())}})}}});var vt,Is=m(()=>{"use strict";C();w();L();vt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.ChangeTextMessage);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.textContent=e.content})})}}});var _t,xs=m(()=>{"use strict";C();b();w();Mn();_t=class extends x{constructor(){super(...arguments);i(this,"messageType",u.ExecuteScriptMessage);i(this,"executor",e=>{ft(e,s=>{this.messageToHost(new pe(e.handlerUniqueId,s))},new Ee(document.documentElement))})}}});var Rt,bs=m(()=>{"use strict";C();w();b();ge();L();Rt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.AddEventListenerMessage);i(this,"executor",e=>{let t=S(e.ref,document),s=[];return t.forEach(r=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new de(e.handlerUniqueId,O(p,e.serializableSkeleton)))})};r.addEventListener(e.type,a),s.push(()=>{r.removeEventListener(e.type,a)})}),()=>{s.forEach(r=>{r()})}})}}});var Ht,ws=m(()=>{"use strict";C();w();L();Ht=class extends x{constructor(){super(...arguments);i(this,"messageType",u.SetAttributeMessage);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.setAttribute(e.name,e.value)})})}}});var kt,Ss=m(()=>{"use strict";C();Z();w();Ne();Ze();kt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.CreateRefComponentMessage);i(this,"executor",e=>{(async()=>{let s=document.querySelectorAll("[".concat(D.id,"='").concat(e.refConfig.selector,"']"));if(s.length===1){let a=await z.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 j(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new j(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var Es,Ts=m(()=>{"use strict";Es=(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 Dt,vs=m(()=>{"use strict";C();b();w();Ts();Dt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.SetMutationObserverMessage);i(this,"executor",e=>{e.source&&Es(document.body,()=>{this.messageToHost(new Ae)})})}}});var _s,Bt,Rs=m(()=>{"use strict";C();Z();w();b();ge();L();_s=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(r=>{if(typeof r.value=="string"){let a=r.getAttribute(D.id),p=r.getAttribute("name"),d={id:r.id,name:p,value:_s(r),required:r.required,validity:O(r.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},Bt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.GetElementValueMessage);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{this.messageToHost(new ce(_s(s)),e)})})}}});var Lt,Hs=m(()=>{"use strict";C();w();b();L();Lt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.GetAttributeMessage);i(this,"executor",e=>{let t=Eo(e.ref,document);t&&this.messageToHost(new Oe(t.getAttribute(e.name)),e)})}}});var Pt,ks=m(()=>{"use strict";b();C();w();Pt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.SetResizeObserverMessage);i(this,"executor",e=>{let t=new ResizeObserver(s=>{this.messageToHost(new We)});return t.observe(document.body),()=>{t.disconnect()}})}}});var Ot,Ds=m(()=>{"use strict";C();w();L();Ot=class extends x{constructor(){super(...arguments);i(this,"messageType",u.SetInnerHtml);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.innerHTML=e.content})})}}});var Bs={};se(Bs,{IframeSDK:()=>At});var At,Ls=m(()=>{"use strict";w();Ms();Cs();Is();xs();ie();bs();ws();b();Ss();vs();Rs();Xe();Hs();ks();Ds();At=class extends we{constructor(){super();i(this,"version",Ce);i(this,"messageToHost",(e,t)=>{var r;!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,(r=window.parent)==null||r.postMessage(M({},e),"*")});i(this,"supportedHandlers",[new vt(this.messageToHost),new Ot(this.messageToHost),new Tt(this.messageToHost),new Et(this.messageToHost),new _t(this.messageToHost),new Rt(this.messageToHost),new Ht(this.messageToHost),new Bt(this.messageToHost),new Dt(this.messageToHost),new Pt(this.messageToHost),new Lt(this.messageToHost),new kt(this.messageToHost)]);i(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new me)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};F("IframeSDK",At)});var xi={};var Ii,Ps=m(()=>{"use strict";b();ie();Ii=M({},xe);F("MyopMessages",Ii)});var Os={};se(Os,{CloudRepository:()=>K,ComponentConfig:()=>It,SkinConfig:()=>Ct,addClass:()=>Jo,applyStylesheet:()=>Vo,applyStylesheetLink:()=>Go,changeSkinUrlByTokenizer:()=>Yo,createIframeSkinByTokenizer:()=>In,enableLocalDev:()=>as,exec:()=>ns,getCloudRepository:()=>ss,getPreloadedParams:()=>rs,isPreloaded:()=>is,preloadComponents:()=>ms,removeClass:()=>Xo,setCloudRepository:()=>ds,setCloudRepositoryUrl:()=>ps,setEnvironment:()=>cs,v2_CloudRepository:()=>ts});var As=m(()=>{"use strict";ie();St();St();F("MyopHelpers",bn)});var Ti={};se(Ti,{getHostModule:()=>Ks,getIframeModule:()=>zs,getWebcomponentModule:()=>$s});ie();var Wn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(Wn=document.currentScript)==null?void 0:Wn.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][Ut]);else{let t;window.__federation__[n]={},window.__federation__[n][Je]=s=>{t&&(document.head.removeChild(t),t=null),window.__federation__[n][Ut]=s,e(s)},t=document.createElement("script"),t.type="module",t.src=o,t.async=!0,document.head.appendChild(t)}};Xe();console.log("myop root sdk - loaded",document.location.origin);var bi="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",Ks=()=>Promise.resolve().then(()=>(Ne(),hs)),zs=()=>Promise.resolve().then(()=>(Ls(),Bs)),$s=()=>Promise.resolve().then(()=>(Cn(),Ao)),wi=()=>Promise.resolve().then(()=>(Ps(),xi)),Si=()=>Promise.resolve().then(()=>(As(),Os)),Ve=o=>async()=>(await o()).get(),Ei={version:Ce,getHostModule:Ve(Ks),getIframeModule:Ve(zs),getWebcomponentModule:Ve($s),getMyopMessages:Ve(wi),getMyopHelpers:Ve(Si)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:bi});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=M({rootSDK:Ei},window.myop);return ti(Ti);})();
4
4
  `;
5
- var it = Object.defineProperty, jt = Object.defineProperties, Vt = Object.getOwnPropertyDescriptors, Ve = Object.getOwnPropertySymbols, Gt = Object.prototype.hasOwnProperty, Yt = Object.prototype.propertyIsEnumerable, Le = (e, t, s) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, E = (e, t) => {
6
- for (var s in t || (t = {}))
7
- Gt.call(t, s) && Le(e, s, t[s]);
8
- if (Ve)
9
- for (var s of Ve(t))
10
- Yt.call(t, s) && Le(e, s, t[s]);
5
+ var ht = Object.defineProperty, sn = Object.defineProperties, on = Object.getOwnPropertyDescriptors, tt = Object.getOwnPropertySymbols, rn = Object.prototype.hasOwnProperty, an = Object.prototype.propertyIsEnumerable, Ne = (e, t, n) => t in e ? ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, S = (e, t) => {
6
+ for (var n in t || (t = {}))
7
+ rn.call(t, n) && Ne(e, n, t[n]);
8
+ if (tt)
9
+ for (var n of tt(t))
10
+ an.call(t, n) && Ne(e, n, t[n]);
11
11
  return e;
12
- }, ge = (e, t) => jt(e, Vt(t)), Jt = (e, t) => {
13
- for (var s in t)
14
- it(e, s, { get: t[s], enumerable: !0 });
15
- }, r = (e, t, s) => Le(e, typeof t != "symbol" ? t + "" : t, s), v = (e, t, s) => new Promise((n, i) => {
16
- var a = (c) => {
12
+ }, ve = (e, t) => sn(e, on(t)), cn = (e, t) => {
13
+ for (var n in t)
14
+ ht(e, n, { get: t[n], enumerable: !0 });
15
+ }, r = (e, t, n) => Ne(e, typeof t != "symbol" ? t + "" : t, n), v = (e, t, n) => new Promise((s, i) => {
16
+ var a = (l) => {
17
17
  try {
18
- l(s.next(c));
18
+ c(n.next(l));
19
19
  } catch (d) {
20
20
  i(d);
21
21
  }
22
- }, o = (c) => {
22
+ }, o = (l) => {
23
23
  try {
24
- l(s.throw(c));
24
+ c(n.throw(l));
25
25
  } catch (d) {
26
26
  i(d);
27
27
  }
28
- }, l = (c) => c.done ? n(c.value) : Promise.resolve(c.value).then(a, o);
29
- l((s = s.apply(e, t)).next());
30
- }), be = "__federation__", Ge = "onLoad", ot = (e, t) => {
31
- window[be] && window[be][e] && window[be][e][Ge] && window[be][e][Ge]({ [e]: t });
32
- }, w = {
28
+ }, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(a, o);
29
+ c((n = n.apply(e, t)).next());
30
+ }), Ie = "__federation__", nt = "onLoad", pt = (e, t) => {
31
+ window[Ie] && window[Ie][e] && window[Ie][e][nt] && window[Ie][e][nt]({ [e]: t });
32
+ }, M = {
33
33
  //host to component
34
34
  InitRequest: "InitRequest",
35
35
  InitResponse: "InitResponse",
@@ -53,51 +53,51 @@ var it = Object.defineProperty, jt = Object.defineProperties, Vt = Object.getOwn
53
53
  MutationObserverMessage: "MutationObserverMessage",
54
54
  ResizeObserverMessage: "ResizeObserverMessage"
55
55
  }
56
- }, Oe = {};
57
- Jt(Oe, {
58
- AddEventListenerMessage: () => os,
56
+ }, $e = {};
57
+ cn($e, {
58
+ AddEventListenerMessage: () => gn,
59
59
  BaseMyopMessage: () => x,
60
- BindClickMessage: () => ts,
61
- ChangeTextMessage: () => ss,
62
- CleanupMessage: () => St,
63
- CleanupReplayMessage: () => xt,
64
- ClickReplayMessage: () => lt,
65
- CreateRefComponentMessage: () => wt,
66
- CustomRefMessage: () => Pe,
67
- DetectMyopRefsMessage: () => cs,
68
- DetectedMyopRefsMessage: () => bt,
69
- DisposeMessage: () => Tt,
70
- ElementValueReplayMessage: () => ft,
71
- EnvelopedMessage: () => _t,
72
- EventListenerCallbackMessage: () => pt,
73
- ExecuteComponentMethod: () => j,
74
- ExecuteScriptMessage: () => V,
75
- ExecuteScriptReplyMessage: () => ut,
76
- GetAttributeMessage: () => ds,
77
- GetAttributeReplayMessage: () => us,
78
- GetElementValueMessage: () => as,
79
- InitMessage: () => Be,
80
- InitRequest: () => gt,
81
- InitResponse: () => yt,
82
- MessageDirection: () => z,
83
- MutationObserverMessage: () => ps,
60
+ BindClickMessage: () => pn,
61
+ ChangeTextMessage: () => mn,
62
+ CleanupMessage: () => Lt,
63
+ CleanupReplayMessage: () => Ot,
64
+ ClickReplayMessage: () => yt,
65
+ CreateRefComponentMessage: () => Tt,
66
+ CustomRefMessage: () => We,
67
+ DetectMyopRefsMessage: () => Mn,
68
+ DetectedMyopRefsMessage: () => Rt,
69
+ DisposeMessage: () => Pt,
70
+ ElementValueReplayMessage: () => Et,
71
+ EnvelopedMessage: () => It,
72
+ EventListenerCallbackMessage: () => Mt,
73
+ ExecuteComponentMethod: () => q,
74
+ ExecuteScriptMessage: () => j,
75
+ ExecuteScriptReplyMessage: () => wt,
76
+ GetAttributeMessage: () => bn,
77
+ GetAttributeReplayMessage: () => En,
78
+ GetElementValueMessage: () => wn,
79
+ InitMessage: () => Ve,
80
+ InitRequest: () => St,
81
+ InitResponse: () => Ct,
82
+ MessageDirection: () => P,
83
+ MutationObserverMessage: () => Sn,
84
84
  MyopBindMessage: () => W,
85
85
  MyopBindReplayMessage: () => $,
86
- MyopElementMessage: () => es,
87
- Ref: () => pe,
88
- RefComponentCreatedMessage: () => Ae,
89
- ResizeObserverMessage: () => fs,
90
- SetAttributeMessage: () => rs,
91
- SetInnerHtml: () => ls,
92
- SetMutationObserverMessage: () => hs,
93
- SetResizeObserverMessage: () => ms,
94
- stripFunction: () => dt
86
+ MyopElementMessage: () => hn,
87
+ Ref: () => me,
88
+ RefComponentCreatedMessage: () => Ke,
89
+ ResizeObserverMessage: () => Tn,
90
+ SetAttributeMessage: () => vn,
91
+ SetInnerHtml: () => _n,
92
+ SetMutationObserverMessage: () => Cn,
93
+ SetResizeObserverMessage: () => xn,
94
+ stripFunction: () => vt
95
95
  });
96
- var te = () => "10000000-1000-4000-8000-100000000000".replace(
96
+ var Z = () => "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
- ), Qt = (e) => {
100
- const t = [...e].map((s) => s.toString(16).padStart(2, "0")).join("");
99
+ ), ln = (e) => {
100
+ const t = [...e].map((n) => n.toString(16).padStart(2, "0")).join("");
101
101
  return [
102
102
  t.slice(0, 8),
103
103
  t.slice(8, 12),
@@ -105,25 +105,25 @@ var te = () => "10000000-1000-4000-8000-100000000000".replace(
105
105
  t.slice(16, 20),
106
106
  t.slice(20)
107
107
  ].join("-");
108
- }, Xt = (e) => {
108
+ }, dn = (e) => {
109
109
  let t = e.replace(/-/g, "+").replace(/_/g, "/");
110
110
  for (; t.length % 4; ) t += "=";
111
- const s = atob(t);
112
- return Uint8Array.from(s, (n) => n.charCodeAt(0));
113
- }, Ye = (e) => {
114
- const t = Xt(e);
111
+ const n = atob(t);
112
+ return Uint8Array.from(n, (s) => s.charCodeAt(0));
113
+ }, st = (e) => {
114
+ const t = dn(e);
115
115
  if (t.length % 16 !== 0) throw new Error("Invalid input length");
116
- const s = [];
117
- for (let n = 0; n < t.length; n += 16)
118
- s.push(Qt(t.slice(n, n + 16)));
119
- return s;
120
- }, Zt = (e) => new Promise((t) => setTimeout(t, e)), z = class {
116
+ const n = [];
117
+ for (let s = 0; s < t.length; s += 16)
118
+ n.push(ln(t.slice(s, s + 16)));
119
+ return n;
120
+ }, un = (e) => new Promise((t) => setTimeout(t, e)), P = class {
121
121
  };
122
- r(z, "down", "down");
123
- r(z, "up", "up");
122
+ r(P, "down", "down");
123
+ r(P, "up", "up");
124
124
  var x = class {
125
125
  constructor() {
126
- r(this, "id", te()), 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);
126
+ r(this, "id", Z()), 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);
127
127
  }
128
128
  static create(...t) {
129
129
  return new this(...t);
@@ -131,7 +131,7 @@ var x = class {
131
131
  isTypeof(t) {
132
132
  return t.messageType === this.messageType;
133
133
  }
134
- }, es = class extends x {
134
+ }, hn = class extends x {
135
135
  constructor(e) {
136
136
  super(), this.ref = e;
137
137
  }
@@ -141,17 +141,17 @@ var x = class {
141
141
  }
142
142
  }, W = class extends x {
143
143
  constructor(t) {
144
- super(), this.handler = t, r(this, "handlerUniqueId", te());
144
+ super(), this.handler = t, r(this, "handlerUniqueId", Z());
145
145
  }
146
- }, pe = class rt {
147
- constructor(t, s) {
148
- this.refConfig = t, this.component = s, r(this, "myop", !0), r(this, "__nonProxied"), this.__nonProxied = ge(E({}, this), {
146
+ }, me = class mt {
147
+ constructor(t, n) {
148
+ this.refConfig = t, this.component = n, r(this, "myop", !0), r(this, "__nonProxied"), this.__nonProxied = ve(S({}, this), {
149
149
  component: null
150
150
  // in order to be serializable
151
151
  });
152
152
  }
153
- static create(t, s, n) {
154
- let i = s;
153
+ static create(t, n, s) {
154
+ let i = n;
155
155
  return i || (i = {
156
156
  id: "",
157
157
  name: "",
@@ -161,184 +161,184 @@ var x = class {
161
161
  behavior: {
162
162
  type: "code"
163
163
  }
164
- }), new rt(i, n);
164
+ }), new mt(i, s);
165
165
  }
166
- }, at = "ClickReplayMessage", ts = class extends W {
166
+ }, ft = "ClickReplayMessage", pn = class extends W {
167
167
  constructor(e, t) {
168
- super(t), this.ref = e, r(this, "replyMessageKey", at), r(this, "messageType", "BindClickMessage"), r(this, "cleanable", !0);
168
+ super(t), this.ref = e, r(this, "replyMessageKey", ft), r(this, "messageType", "BindClickMessage"), r(this, "cleanable", !0);
169
169
  }
170
- }, lt = class extends $ {
170
+ }, yt = class extends $ {
171
171
  constructor() {
172
- super(...arguments), r(this, "messageType", at);
172
+ super(...arguments), r(this, "messageType", ft);
173
173
  }
174
- }, ss = class extends x {
174
+ }, mn = class extends x {
175
175
  constructor(e, t) {
176
176
  super(), this.ref = e, r(this, "messageType", "ChangeTextMessage"), this.content = t;
177
177
  }
178
- }, ct = "ExecuteScriptReplyMessage", ns = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, is = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, dt = (e) => {
179
- let t = e.match(ns);
178
+ }, gt = "ExecuteScriptReplyMessage", fn = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, yn = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, vt = (e) => {
179
+ let t = e.match(fn);
180
180
  if (t)
181
181
  return t[1] || t[3];
182
182
  {
183
- let s = e.match(is);
184
- if (s)
185
- return s[1].trim();
183
+ let n = e.match(yn);
184
+ if (n)
185
+ return n[1].trim();
186
186
  }
187
- }, V = class extends W {
188
- constructor(t, s = () => {
189
- }, n) {
190
- super(s), this.scriptInputs = n, r(this, "replyMessageKey", ct), r(this, "messageType", "ExecuteScriptMessage"), r(this, "script", ""), this.script = t.toString(), this.content = t.toString(), this.content = dt(this.content);
187
+ }, j = class extends W {
188
+ constructor(t, n = () => {
189
+ }, s) {
190
+ super(n), this.scriptInputs = s, r(this, "replyMessageKey", gt), r(this, "messageType", "ExecuteScriptMessage"), r(this, "script", ""), this.script = t.toString(), this.content = t.toString(), this.content = vt(this.content);
191
191
  }
192
192
  };
193
- r(V, "replierKey", "send");
194
- r(V, "completeStreamKey", "completeStream");
195
- var ut = class extends $ {
193
+ r(j, "replierKey", "send");
194
+ r(j, "completeStreamKey", "completeStream");
195
+ var wt = class extends $ {
196
196
  constructor(e, t) {
197
- super(e), this.replayToHandler = e, this.content = t, r(this, "messageType", ct);
197
+ super(e), this.replayToHandler = e, this.content = t, r(this, "messageType", gt);
198
198
  }
199
- }, Pe = class extends V {
200
- constructor(e, t, s = () => {
199
+ }, We = class extends j {
200
+ constructor(e, t, n = () => {
201
201
  }) {
202
- super(({ rootRef: n, elementId: i, _script: a, __scriptInputs: o }) => {
203
- const l = (n.shadowRoot || n.container).querySelectorAll(`[myop-id='${i}']`);
204
- return l.length ? (o.ref = l[0], new Function(`return (${a})(...arguments)`)(o)) : null;
205
- }, s), this.scriptInputs = t, this.scriptInputs = ge(E({}, t), {
202
+ super(({ rootRef: s, elementId: i, _script: a, __scriptInputs: o }) => {
203
+ const c = (s.shadowRoot || s.container).querySelectorAll(`[myop-id='${i}']`);
204
+ return c.length ? (o.ref = c[0], new Function(`return (${a})(...arguments)`)(o)) : null;
205
+ }, n), this.scriptInputs = t, this.scriptInputs = ve(S({}, t), {
206
206
  //_script: stripFunction(script.toString()),
207
207
  _script: e.toString()
208
208
  });
209
209
  }
210
- }, ht = "EventListenerCallbackMessage", os = class extends W {
210
+ }, _t = "EventListenerCallbackMessage", gn = class extends W {
211
211
  // {} // empty
212
- constructor(e, t, s) {
213
- super(s), this.ref = e, this.type = t, this.handler = s, r(this, "replyMessageKey", ht), r(this, "messageType", "AddEventListenerMessage"), r(this, "cleanable", !0), r(this, "serializableSkeleton", !1);
212
+ constructor(e, t, n) {
213
+ super(n), this.ref = e, this.type = t, this.handler = n, r(this, "replyMessageKey", _t), r(this, "messageType", "AddEventListenerMessage"), r(this, "cleanable", !0), r(this, "serializableSkeleton", !1);
214
214
  }
215
215
  withSerializableSkeleton(e) {
216
216
  return this.serializableSkeleton = e, this;
217
217
  }
218
- }, pt = class extends $ {
218
+ }, Mt = class extends $ {
219
219
  constructor(e, t) {
220
- super(e), this.replayToHandler = e, this.e = t, r(this, "messageType", ht), this.content = {
220
+ super(e), this.replayToHandler = e, this.e = t, r(this, "messageType", _t), this.content = {
221
221
  e: t
222
222
  };
223
223
  }
224
- }, rs = class extends x {
225
- constructor(e, t, s) {
226
- super(), this.ref = e, this.name = t, this.value = s, r(this, "messageType", "SetAttributeMessage");
224
+ }, vn = class extends x {
225
+ constructor(e, t, n) {
226
+ super(), this.ref = e, this.name = t, this.value = n, r(this, "messageType", "SetAttributeMessage");
227
227
  }
228
- }, mt = "ElementValueReplayMessage", as = class extends W {
228
+ }, bt = "ElementValueReplayMessage", wn = class extends W {
229
229
  constructor(e, t) {
230
- super(t), this.ref = e, r(this, "replyMessageKey", mt), r(this, "messageType", "GetElementValueMessage");
230
+ super(t), this.ref = e, r(this, "replyMessageKey", bt), r(this, "messageType", "GetElementValueMessage");
231
231
  }
232
- }, ft = class extends $ {
232
+ }, Et = class extends $ {
233
233
  constructor(e) {
234
- super(), this.content = e, r(this, "messageType", mt);
234
+ super(), this.content = e, r(this, "messageType", bt);
235
235
  }
236
- }, ls = class extends x {
236
+ }, _n = class extends x {
237
237
  constructor(e, t) {
238
238
  super(), this.ref = e, r(this, "messageType", "SetInnerHtml"), this.content = t;
239
239
  }
240
- }, Be = class extends x {
240
+ }, Ve = class extends x {
241
241
  constructor(e) {
242
242
  super(), r(this, "messageType", "InitMessage"), this.content = { id: e };
243
243
  }
244
244
  isTypeof(e) {
245
245
  return e.messageType === this.messageType;
246
246
  }
247
- }, yt = class extends Be {
247
+ }, Ct = class extends Ve {
248
248
  constructor() {
249
249
  super(...arguments), r(this, "messageType", "InitResponse");
250
250
  }
251
- }, gt = class extends x {
251
+ }, St = class extends x {
252
252
  constructor() {
253
253
  super(...arguments), r(this, "messageType", "InitRequest");
254
254
  }
255
- }, vt = "RefComponentCreatedMessage", wt = class extends W {
256
- constructor(e, t, s, n) {
257
- super(n), this.refConfig = e, this.nestedComponentConfig = t, this.options = s, r(this, "replyMessageKey", vt), r(this, "messageType", "CreateRefComponentMessage");
255
+ }, xt = "RefComponentCreatedMessage", Tt = class extends W {
256
+ constructor(e, t, n, s) {
257
+ super(s), this.refConfig = e, this.nestedComponentConfig = t, this.options = n, r(this, "replyMessageKey", xt), r(this, "messageType", "CreateRefComponentMessage");
258
258
  }
259
- }, Ae = class extends $ {
260
- constructor(e, t, s) {
261
- super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed = s, r(this, "messageType", vt);
259
+ }, Ke = class extends $ {
260
+ constructor(e, t, n) {
261
+ super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed = n, r(this, "messageType", xt);
262
262
  }
263
- }, _t = class extends x {
263
+ }, It = class extends x {
264
264
  constructor(e, t) {
265
265
  super(), this.destination = e, this.message = t, r(this, "messageType", "EnvelopedMessage");
266
- const s = t;
267
- this.route = [e, ...s.route ? s.route : []];
266
+ const n = t;
267
+ this.route = [e, ...n.route ? n.route : []];
268
268
  }
269
- }, Mt = "DetectedMyopRefsMessage", cs = class extends W {
269
+ }, Ht = "DetectedMyopRefsMessage", Mn = class extends W {
270
270
  constructor() {
271
- super(...arguments), r(this, "messageType", "DetectMyopRefsMessage"), r(this, "replyMessageKey", Mt);
271
+ super(...arguments), r(this, "messageType", "DetectMyopRefsMessage"), r(this, "replyMessageKey", Ht);
272
272
  }
273
- }, bt = class extends $ {
273
+ }, Rt = class extends $ {
274
274
  constructor(e, t) {
275
- super(e), this.replayToHandler = e, r(this, "messageType", Mt), this.content = t;
275
+ super(e), this.replayToHandler = e, r(this, "messageType", Ht), this.content = t;
276
276
  }
277
277
  isTypeof(e) {
278
278
  return e.messageType === this.messageType;
279
279
  }
280
- }, Et = "GetAttributeReplayMessage", ds = class extends W {
281
- constructor(e, t, s) {
282
- super(s), this.ref = e, this.name = t, r(this, "replyMessageKey", Et), r(this, "messageType", "GetAttributeMessage");
280
+ }, Dt = "GetAttributeReplayMessage", bn = class extends W {
281
+ constructor(e, t, n) {
282
+ super(n), this.ref = e, this.name = t, r(this, "replyMessageKey", Dt), r(this, "messageType", "GetAttributeMessage");
283
283
  }
284
- }, us = class extends $ {
284
+ }, En = class extends $ {
285
285
  constructor(e) {
286
- super(), this.content = e, r(this, "messageType", Et);
286
+ super(), this.content = e, r(this, "messageType", Dt);
287
287
  }
288
- }, j = class extends x {
288
+ }, q = class extends x {
289
289
  constructor(e) {
290
290
  super(), this.method = e, r(this, "messageType", "ExecuteComponentMethod");
291
291
  }
292
- }, hs = class extends x {
292
+ }, Cn = class extends x {
293
293
  constructor() {
294
294
  super(...arguments), r(this, "messageType", "SetMutationObserverMessage");
295
295
  }
296
- }, ps = class extends x {
296
+ }, Sn = class extends x {
297
297
  constructor() {
298
298
  super(...arguments), r(this, "messageType", "MutationObserverMessage");
299
299
  }
300
- }, Ct = "CleanupReplayMessage", St = class extends W {
300
+ }, kt = "CleanupReplayMessage", Lt = class extends W {
301
301
  constructor(e, t) {
302
- super(t), this.cleanupForMessageId = e, r(this, "replyMessageKey", Ct), r(this, "messageType", "CleanupMessage");
302
+ super(t), this.cleanupForMessageId = e, r(this, "replyMessageKey", kt), r(this, "messageType", "CleanupMessage");
303
303
  }
304
- }, xt = class extends $ {
304
+ }, Ot = class extends $ {
305
305
  constructor(e) {
306
- super(), this.customCleanup = e, r(this, "messageType", Ct);
306
+ super(), this.customCleanup = e, r(this, "messageType", kt);
307
307
  }
308
- }, Tt = class extends x {
308
+ }, Pt = class extends x {
309
309
  constructor() {
310
310
  super(...arguments), r(this, "messageType", "DisposeMessage");
311
311
  }
312
- }, ms = class extends x {
312
+ }, xn = class extends x {
313
313
  constructor() {
314
314
  super(...arguments), r(this, "cleanable", !0), r(this, "messageType", "SetResizeObserverMessage");
315
315
  }
316
- }, fs = class extends x {
316
+ }, Tn = class extends x {
317
317
  constructor() {
318
318
  super(...arguments), r(this, "messageType", "ResizeObserverMessage");
319
319
  }
320
- }, Te = class {
321
- constructor(e, t, s) {
320
+ }, Le = class {
321
+ constructor(e, t, n) {
322
322
  this.componentDefinition = e, this.container = t, r(this, "id", ""), r(this, "messageHandlers", {}), r(this, "element"), r(this, "_markedForDisposed", !1), r(this, "bind", (i, a) => {
323
323
  this.messageHandlers[i] || (this.messageHandlers[i] = []), this.messageHandlers[i].includes(a) || this.messageHandlers[i].push(a);
324
324
  }), r(this, "bindWhen", (i, a, o) => {
325
325
  if (!o)
326
326
  throw new Error("can't use component.bindWhen without an handler");
327
327
  this.messageHandlers[i] || (this.messageHandlers[i] = []);
328
- const l = this.messageHandlers[i], c = (d) => a(d) ? (o(d), !0) : !1;
329
- return l.push(c), () => {
330
- const d = l.indexOf(c);
331
- d > -1 && l.splice(d, 1);
328
+ const c = this.messageHandlers[i], l = (d) => a(d) ? (o(d), !0) : !1;
329
+ return c.push(l), () => {
330
+ const d = c.indexOf(l);
331
+ d > -1 && c.splice(d, 1);
332
332
  };
333
333
  }), r(this, "setInitiated", () => {
334
334
  this.isInitiated = !0, this._whenInitiatedResolve && this._whenInitiatedResolve();
335
335
  }), r(this, "isInitiated", !1), r(this, "_whenInitiatedResolve"), r(this, "_whenInitiatedReject"), r(this, "_whenInitiated", new Promise((i, a) => {
336
336
  this._whenInitiatedResolve = i, this._whenInitiatedReject = a;
337
- })), r(this, "initiated", () => this._whenInitiated), r(this, "props", {}), r(this, "refs", {}), this.id = (s == null ? void 0 : s.id) || Ie.Instance().assignId(e);
338
- const n = s != null && s.timeout ? s == null ? void 0 : s.timeout : 5 * 1e3;
337
+ })), r(this, "initiated", () => this._whenInitiated), r(this, "props", {}), r(this, "refs", {}), this.id = (n == null ? void 0 : n.id) || Oe.Instance().assignId(e);
338
+ const s = n != null && n.timeout ? n == null ? void 0 : n.timeout : 5 * 1e3;
339
339
  setTimeout(() => {
340
- !this.isInitiated && this._whenInitiatedReject && !this._markedForDisposed && this._whenInitiatedReject(`timeout_${n} ${this.id}`);
341
- }, n), this.initiated().then(() => {
340
+ !this.isInitiated && this._whenInitiatedReject && !this._markedForDisposed && this._whenInitiatedReject(`timeout_${s} ${this.id}`);
341
+ }, s), this.initiated().then(() => {
342
342
  window.myop.hostSDK.inspected && this.inspect();
343
343
  });
344
344
  }
@@ -351,35 +351,35 @@ var ut = class extends $ {
351
351
  this._markedForDisposed = e;
352
352
  }
353
353
  onMessageReceived(e) {
354
- if (e.messageType === w.ExecuteComponentMethod) {
355
- const s = e;
356
- return this[s.method] ? this[s.method](s.content) : console.log(`method not found ${s.method} on component`, this), !0;
354
+ if (e.messageType === M.ExecuteComponentMethod) {
355
+ const n = e;
356
+ return this[n.method] ? this[n.method](n.content) : console.log(`method not found ${n.method} on component`, this), !0;
357
357
  }
358
358
  const t = this.messageHandlers[e.messageType];
359
359
  if (t && t.length) {
360
- let s = !1;
361
- return t.forEach((n) => {
362
- s = s || n(e);
363
- }), s;
360
+ let n = !1;
361
+ return t.forEach((s) => {
362
+ n = n || s(e);
363
+ }), n;
364
364
  }
365
365
  return !1;
366
366
  }
367
367
  sendCleanupMessage(e) {
368
- e.source = this.id, e.destination = this.id, e.direction = z.down;
369
- const t = this.bindWhen(e.replyMessageKey, (n) => n.replayToHandler === e.handlerUniqueId, (n) => {
370
- e.handler(n), t();
371
- }), s = e.handler;
372
- delete e.handler, this.send(e), e.handler = s;
368
+ e.source = this.id, e.destination = this.id, e.direction = P.down;
369
+ const t = this.bindWhen(e.replyMessageKey, (s) => s.replayToHandler === e.handlerUniqueId, (s) => {
370
+ e.handler(s), t();
371
+ }), n = e.handler;
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 = z.down;
375
+ e.source || (e.source = this.id), e.destination || (e.destination = this.id), e.direction = P.down;
376
376
  let t;
377
377
  if (e.handler) {
378
- const s = e;
379
- t = this.bindWhen(s.replyMessageKey, (n) => n.replayToHandler === s.handlerUniqueId, s.handler), delete e.handler;
378
+ const n = e;
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 St(e.id, (s) => {
382
+ this.sendCleanupMessage(new Lt(e.id, (n) => {
383
383
  })), t && t();
384
384
  } : () => {
385
385
  };
@@ -387,68 +387,68 @@ var ut = class extends $ {
387
387
  dispose() {
388
388
  if (this.markedForDisposed = !0, !this.isInitiated)
389
389
  return;
390
- console.log("disposing component", this.id), this.send(new Tt());
390
+ console.log("disposing component", this.id), this.send(new Pt());
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
- }, ys = class {
397
- constructor(e, t, s, n, i) {
398
- this.myopId = e, this.htmlTagName = t, this.BoundingRect = s, this.offsetTop = n, this.offsetLeft = i, r(this, "type", "MyopElementRef");
396
+ }, In = class {
397
+ constructor(e, t, n, s, i) {
398
+ this.myopId = e, this.htmlTagName = t, this.BoundingRect = n, this.offsetTop = s, this.offsetLeft = i, r(this, "type", "MyopElementRef");
399
399
  }
400
- }, gs = (e) => v(void 0, null, function* () {
400
+ }, Hn = (e) => v(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
- }), vs = class {
407
+ }), Rn = class {
408
408
  //TODO : add dispose method
409
409
  constructor(e) {
410
410
  this.messageToHost = e;
411
411
  }
412
- }, ws = class extends vs {
412
+ }, Dn = class extends Rn {
413
413
  constructor(e, t) {
414
414
  super(e), this.messageToHost = e, this.context = t;
415
415
  }
416
- }, _s = class {
416
+ }, kn = class {
417
417
  //onMessageReceived: (msg: IMyopMessage) => void;
418
418
  constructor(e, t) {
419
- this.id = e, this.context = t, r(this, "send", (s) => {
419
+ this.id = e, this.context = t, r(this, "send", (n) => {
420
420
  });
421
421
  }
422
- }, Ms = class {
422
+ }, Ln = class {
423
423
  constructor() {
424
424
  r(this, "messageToHandleAfterInit", []), r(this, "components", {}), r(this, "alwaysPassEnvelopesToHost", !1), r(this, "messageCleanupCache", {});
425
425
  }
426
426
  handleIncomeMessages(e) {
427
427
  const t = e.data ? e.data : e.detail;
428
428
  if (!(!t || !t.myop)) {
429
- let s = t;
430
- if (s.direction !== z.down)
429
+ let n = t;
430
+ if (n.direction !== P.down)
431
431
  return;
432
- if (s.messageType === w.DisposeMessage) {
433
- s.destination && delete this.components[s.destination];
432
+ if (n.messageType === M.DisposeMessage) {
433
+ n.destination && delete this.components[n.destination];
434
434
  return;
435
435
  }
436
- if (s.messageType === w.InitMessage) {
437
- const n = s.content.id;
438
- if (this.components[n])
436
+ if (n.messageType === M.InitMessage) {
437
+ const s = n.content.id;
438
+ if (this.components[s])
439
439
  return;
440
- this.components[n] = new _s(n), this.messageToHost(new yt(n));
440
+ this.components[s] = new kn(s), this.messageToHost(new Ct(s));
441
441
  return;
442
442
  }
443
- if (s.messageType === w.EnvelopedMessage) {
444
- const n = s, i = n.message;
445
- if (s = i, this.alwaysPassEnvelopesToHost || this.components[s.destination]) {
446
- const a = myop.hostSDK.components.find((l) => l.id === i.destination);
443
+ if (n.messageType === M.EnvelopedMessage) {
444
+ const s = n, i = s.message;
445
+ if (n = i, this.alwaysPassEnvelopesToHost || this.components[n.destination]) {
446
+ const a = myop.hostSDK.components.find((c) => c.id === i.destination);
447
447
  if (a) {
448
448
  a.send(i);
449
449
  return;
450
450
  }
451
- const o = myop.hostSDK.components.find((l) => l.id === n.destination);
451
+ const o = myop.hostSDK.components.find((c) => c.id === s.destination);
452
452
  if (o) {
453
453
  o.send(i);
454
454
  return;
@@ -456,27 +456,27 @@ var ut = class extends $ {
456
456
  } else
457
457
  return;
458
458
  }
459
- if (s.messageType) {
460
- if (s.messageType === w.CleanupMessage) {
461
- const n = s, i = this.messageCleanupCache[n.cleanupForMessageId], a = new xt(!!i);
462
- a.destination = s.destination, i ? (delete this.messageCleanupCache[n.cleanupForMessageId], gs(i).then(() => {
463
- this.messageToHost(a, n);
459
+ if (n.messageType) {
460
+ if (n.messageType === M.CleanupMessage) {
461
+ const s = n, i = this.messageCleanupCache[s.cleanupForMessageId], a = new Ot(!!i);
462
+ a.destination = n.destination, i ? (delete this.messageCleanupCache[s.cleanupForMessageId], Hn(i).then(() => {
463
+ this.messageToHost(a, s);
464
464
  }).catch(() => {
465
- })) : this.messageToHost(a, n);
465
+ })) : this.messageToHost(a, s);
466
466
  return;
467
467
  }
468
- this.supportedHandlers.forEach((n) => {
469
- if (n.messageType === s.messageType) {
470
- const i = n.executor(s);
471
- if (s.cleanable && i && (this.messageCleanupCache[s.id] = i), i && !s.cleanable)
468
+ this.supportedHandlers.forEach((s) => {
469
+ if (s.messageType === n.messageType) {
470
+ const i = s.executor(n);
471
+ if (n.cleanable && i && (this.messageCleanupCache[n.id] = i), i && !n.cleanable)
472
472
  throw new Error(`Cleanup handler generated for non-cleanable message.
473
- messageType - ${s.messageType}, handler executor was - ${n.executor}
473
+ messageType - ${n.messageType}, handler executor was - ${s.executor}
474
474
 
475
475
  Please review the message definition object & message handler.
476
476
  To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`);
477
- if (!i && s.cleanable)
477
+ if (!i && n.cleanable)
478
478
  throw new Error(`No cleanup handler generated for a cleanable message.
479
- messageType - ${s.messageType}, handler executor was - ${n.executor}
479
+ messageType - ${n.messageType}, handler executor was - ${s.executor}
480
480
 
481
481
  Please review the message definition object & message handler.
482
482
  To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`);
@@ -486,21 +486,21 @@ To ensure cleanup properly set 'cleanable' true at message definition and return
486
486
  console.log("unsupported message type");
487
487
  }
488
488
  }
489
- }, me = {
489
+ }, fe = {
490
490
  IframeLoader: "IframeLoader",
491
491
  WebComponentLoader: "WebComponentLoader",
492
492
  HTMLLoader: "HTMLLoader"
493
- }, fe = {
493
+ }, ye = {
494
494
  open: "open",
495
495
  none: "none",
496
496
  localFrame: "localFrame"
497
- }, Ce = {
497
+ }, Re = {
498
498
  code: "code"
499
- }, $e = class {
499
+ }, Ge = class {
500
500
  };
501
- r($e, "code", "code");
502
- r($e, "component", "component");
503
- var he = {
501
+ r(Ge, "code", "code");
502
+ r(Ge, "component", "component");
503
+ var pe = {
504
504
  Segmented: "Segmented",
505
505
  Dedicated: "Dedicated",
506
506
  /**
@@ -510,58 +510,58 @@ var he = {
510
510
  * @type {string}
511
511
  */
512
512
  Default: "Default"
513
- }, It = {
513
+ }, At = {
514
514
  Segment: "Segment",
515
515
  Promo: "Promo",
516
516
  AB: "AB"
517
- }, bs = class {
517
+ }, On = class {
518
518
  constructor(e, t) {
519
519
  this.container = e, this.shadowRoot = t, r(this, "getRootDiv", () => (this.shadowRoot || this.container).querySelector("div")), r(this, "getRoot", () => this.shadowRoot || this.container);
520
520
  }
521
- }, ze = (e) => e !== Object(e), Es = (e) => typeof e == "function", Rt = (e) => {
522
- if (ze(e))
521
+ }, Ue = (e) => e !== Object(e), Pn = (e) => typeof e == "function", zt = (e) => {
522
+ if (Ue(e))
523
523
  return !0;
524
- if (Es(e) || Object.getPrototypeOf(e))
524
+ if (Pn(e) || Object.getPrototypeOf(e))
525
525
  return !1;
526
526
  for (const t in e) {
527
- const s = e[t];
528
- if (typeof s == "object") {
529
- if (!Rt(s))
527
+ const n = e[t];
528
+ if (typeof n == "object") {
529
+ if (!zt(n))
530
530
  return !1;
531
531
  } else {
532
- if (ze(s))
532
+ if (Ue(n))
533
533
  continue;
534
534
  return !1;
535
535
  }
536
536
  }
537
537
  return !0;
538
- }, re = (e, t = {}, s = !0, n = /* @__PURE__ */ new WeakMap()) => {
539
- if (ze(e))
538
+ }, re = (e, t = {}, n = !0, s = /* @__PURE__ */ new WeakMap()) => {
539
+ if (Ue(e))
540
540
  return e;
541
541
  if (Array.isArray(e)) {
542
- if (n.has(e))
543
- return n.get(e);
542
+ if (s.has(e))
543
+ return s.get(e);
544
544
  const i = [];
545
- n.set(e, i);
545
+ s.set(e, i);
546
546
  for (let a = 0; a < e.length; a++) {
547
547
  const o = e[a];
548
- i[a] = re(o, t, s, n);
548
+ i[a] = re(o, t, n, s);
549
549
  }
550
550
  return i;
551
551
  }
552
552
  if (e !== null && typeof e == "object") {
553
- if (n.has(e))
554
- return n.get(e);
553
+ if (s.has(e))
554
+ return s.get(e);
555
555
  const i = {};
556
- n.set(e, i);
556
+ s.set(e, i);
557
557
  for (const a in e) {
558
558
  const o = typeof t == "boolean" ? t : t[a];
559
- o && (o === !0 ? (s ? e[a] !== void 0 : e[a]) && (i[a] = re(e[a], !0, s, n)) : typeof o == "object" && (i[a] = re(e[a], o, s, n)));
559
+ o && (o === !0 ? (n ? e[a] !== void 0 : e[a]) && (i[a] = re(e[a], !0, n, s)) : typeof o == "object" && (i[a] = re(e[a], o, n, s)));
560
560
  }
561
561
  return i;
562
562
  }
563
563
  return {};
564
- }, Cs = {
564
+ }, An = {
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,46 +595,46 @@ For more details on serialization and Myop message examples, refer to https://do
595
595
 
596
596
  `);
597
597
  }
598
- }, Je = class extends Te {
599
- constructor(e, t, s) {
600
- super(e, t.container, s), this.componentDefinition = e, this.parent = t, r(this, "send", (n) => {
601
- const i = n.handler, a = super.send(n);
602
- return this.parent.send(new _t(this.id, n)), n.handler = i, a;
598
+ }, it = class extends Le {
599
+ constructor(e, t, n) {
600
+ super(e, t.container, n), this.componentDefinition = e, this.parent = t, r(this, "send", (s) => {
601
+ const i = s.handler, a = super.send(s);
602
+ return this.parent.send(new It(this.id, s)), s.handler = i, a;
603
603
  }), r(this, "dispose", () => {
604
- this.isInitiated && this.send(new j("dispose")), super.dispose();
604
+ this.isInitiated && this.send(new q("dispose")), super.dispose();
605
605
  });
606
606
  }
607
607
  hide() {
608
- this.send(new j("hide"));
608
+ this.send(new q("hide"));
609
609
  }
610
610
  show() {
611
- this.send(new j("show"));
611
+ this.send(new q("show"));
612
612
  }
613
613
  inspect() {
614
- return this.send(new j("inspect"));
614
+ return this.send(new q("inspect"));
615
615
  }
616
616
  setHeightBasedOnDocumentElement() {
617
- this.send(new j("setHeightBasedOnDocumentElement"));
617
+ this.send(new q("setHeightBasedOnDocumentElement"));
618
618
  }
619
619
  setHeightBasedOnScrollHeight() {
620
- this.send(new j("setHeightBasedOnScrollHeight"));
620
+ this.send(new q("setHeightBasedOnScrollHeight"));
621
621
  }
622
622
  onMessageReceived(e) {
623
623
  return super.onMessageReceived(e);
624
624
  }
625
- }, Fe = class extends Te {
626
- constructor(e, t, s, n, i, a) {
627
- super(e, s, a), this.container = s, this.customElement = n, this.tagName = i, r(this, "ctaCleanup"), r(this, "_ctaHandler"), r(this, "_ctaQueue", []), r(this, "cleanupInspect", () => {
625
+ }, qe = class extends Le {
626
+ constructor(e, t, n, s, i, a) {
627
+ super(e, n, a), this.container = n, this.customElement = s, this.tagName = i, r(this, "ctaCleanup"), r(this, "_ctaHandler"), r(this, "_ctaQueue", []), r(this, "cleanupInspect", () => {
628
628
  }), r(this, "send", (o) => {
629
- const l = super.send(o);
630
- return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead", o), l;
629
+ const c = super.send(o);
630
+ return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead", o), c;
631
631
  }), r(this, "dispose", () => {
632
632
  var o;
633
633
  this.ctaCleanup && this.ctaCleanup(), super.dispose(), (o = this.customElement.parentNode) == null || o.removeChild(this.customElement);
634
- }), this.element = n, this.setInitiated();
634
+ }), this.element = s, this.setInitiated();
635
635
  }
636
636
  inspect() {
637
- return this.cleanupInspect = We(this.id, "MyopExtractedWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
637
+ return this.cleanupInspect = Ye(this.id, "MyopExtractedWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
638
638
  }
639
639
  hide() {
640
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";
@@ -661,15 +661,15 @@ For more details on serialization and Myop message examples, refer to https://do
661
661
  */
662
662
  setCtaHandler(e) {
663
663
  if (this.ctaCleanup && this.ctaCleanup(), this._ctaHandler = e, this._ctaQueue.length > 0) {
664
- const s = [...this._ctaQueue];
665
- this._ctaQueue = [], s.forEach((n) => {
666
- this.markedForDisposed || e(n.action, n.payload);
664
+ const n = [...this._ctaQueue];
665
+ this._ctaQueue = [], n.forEach((s) => {
666
+ this.markedForDisposed || e(s.action, s.payload);
667
667
  });
668
668
  }
669
- const t = (s) => {
670
- var n;
671
- const i = s;
672
- (n = i.detail) != null && n.action && (this._ctaHandler && !this.markedForDisposed ? this._ctaHandler(i.detail.action, i.detail.payload) : this._ctaHandler || this._ctaQueue.push({
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
673
  action: i.detail.action,
674
674
  payload: i.detail.payload
675
675
  }));
@@ -678,15 +678,15 @@ For more details on serialization and Myop message examples, refer to https://do
678
678
  this.customElement.removeEventListener("myop-cta", t);
679
679
  };
680
680
  }
681
- }, Ss = (e, t, s) => {
682
- const n = document.createElement("a");
683
- return n.textContent = e, n.style.position = "relative", n.style.padding = "0 5px", n.style.fontSize = "14px", n.style.top = "0", n.style.top = `${t}px`, n.style.transform = "translateX(-50%)", n.target = "_blank", n.href = `https://dashboard.myop.dev/dashboard/component/${s.id}`, n;
684
- }, We = (e, t, s, n, i, a) => {
685
- const o = Ss(`${a.name} : ${t}`, s, a);
686
- return n.insertBefore(o, i), i.style.border = "1px solid #007BFF", i.style.display = "block", () => {
687
- i.style.border = "unset", n.removeChild(o);
681
+ }, zn = (e, t, n) => {
682
+ const s = document.createElement("a");
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;
684
+ }, Ye = (e, t, n, s, i, a) => {
685
+ const o = zn(`${a.name} : ${t}`, n, a);
686
+ return s.insertBefore(o, i), i.style.border = "1px solid #007BFF", i.style.display = "block", () => {
687
+ i.style.border = "unset", s.removeChild(o);
688
688
  };
689
- }, Qe = (e, t, s) => e ? !1 : (console.error(
689
+ }, ot = (e, t, n) => e ? !1 : (console.error(
690
690
  // throw new Error(
691
691
  `Error: Undefined Prop
692
692
 
@@ -694,10 +694,10 @@ It looks like you've tried to use a prop that hasn't been defined.
694
694
  Please check the prop name for any typos or ensure that it is properly defined in the component's prop list.
695
695
 
696
696
  Prop Name: ${t}
697
- Component: ${s.componentDefinition.name}, ID: ${s.componentDefinition.id}
697
+ Component: ${n.componentDefinition.name}, ID: ${n.componentDefinition.id}
698
698
 
699
- For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${s.componentDefinition.id} or consult the developer guide.`
700
- ), !0), Xe = (e, t, s) => {
699
+ For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${n.componentDefinition.id} or consult the developer guide.`
700
+ ), !0), rt = (e, t, n) => {
701
701
  console.error(
702
702
  `Error: Code Prop Not Supported
703
703
 
@@ -707,68 +707,68 @@ Currently, code props are only supported in local frame components.
707
707
  In the meantime, you can use message props.
708
708
 
709
709
  Prop Name: ${t}
710
- Component: ${s.componentDefinition.name}, ID: ${s.componentDefinition.id}
710
+ Component: ${n.componentDefinition.name}, ID: ${n.componentDefinition.id}
711
711
 
712
- For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${s.componentDefinition.id} or consult the developer guide.`
712
+ For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${n.componentDefinition.id} or consult the developer guide.`
713
713
  );
714
- }, xs = (e, t, s) => {
715
- const n = t.reduce((a, o) => ge(E({}, a), {
716
- [o.name]: E({}, o)
714
+ }, Fn = (e, t, n) => {
715
+ const s = t.reduce((a, o) => ve(S({}, a), {
716
+ [o.name]: S({}, o)
717
717
  }), {}), i = {
718
718
  get: (a, o) => {
719
- const l = n[o];
720
- if (Qe(l, o, e))
719
+ const c = s[o];
720
+ if (ot(c, o, e))
721
721
  return !1;
722
- if (l.behavior.type === Ce.code) {
723
- if (e instanceof Fe)
724
- return (l.behavior.remap || o) === "myop_init_interface" ? (u) => {
722
+ if (c.behavior.type === Re.code) {
723
+ if (e instanceof qe)
724
+ return (c.behavior.remap || o) === "myop_init_interface" ? (u) => {
725
725
  if (u === void 0)
726
726
  return e.getData();
727
727
  e.initWithData(u);
728
728
  } : void 0;
729
- if (s.loader.type === me.HTMLLoader && s.loader.shadowRootMode === fe.localFrame) {
730
- const d = l.behavior;
729
+ if (n.loader.type === fe.HTMLLoader && n.loader.shadowRootMode === ye.localFrame) {
730
+ const d = c.behavior;
731
731
  return e.element.contentWindow[d.remap || o];
732
732
  }
733
- return Xe(l, o, e), !1;
733
+ return rt(c, o, e), !1;
734
734
  }
735
- return l.mode === "output" ? new Promise((c) => {
735
+ return c.mode === "output" ? new Promise((l) => {
736
736
  const d = [];
737
- l.behavior.ref && d.push(pe.create(l.behavior.ref)), d.push((h) => {
738
- c(h);
739
- }), l.behavior.params && d.push(...l.behavior.params);
740
- const u = Oe[l.behavior.message];
737
+ c.behavior.ref && d.push(me.create(c.behavior.ref)), d.push((h) => {
738
+ l(h);
739
+ }), c.behavior.params && d.push(...c.behavior.params);
740
+ const u = $e[c.behavior.message];
741
741
  e.send(new u(...d));
742
742
  }) : null;
743
743
  },
744
- set: (a, o, l) => {
745
- const c = n[o];
746
- if (Qe(c, o, e))
744
+ set: (a, o, c) => {
745
+ const l = s[o];
746
+ if (ot(l, o, e))
747
747
  return !1;
748
- if (c.behavior.type === Ce.code) {
749
- if (e instanceof Fe) {
750
- const u = c.behavior.remap || o;
748
+ if (l.behavior.type === Re.code) {
749
+ if (e instanceof qe) {
750
+ const u = l.behavior.remap || o;
751
751
  if (u === "myop_cta_handler")
752
- return e.setCtaHandler(l), !0;
752
+ return e.setCtaHandler(c), !0;
753
753
  if (u === "myop_init_interface")
754
- return e.initWithData(l), !0;
754
+ return e.initWithData(c), !0;
755
755
  }
756
- if (s.loader.type === me.HTMLLoader && s.loader.shadowRootMode === fe.localFrame) {
757
- const u = c.behavior, h = e.element.contentWindow, f = u.remap || o;
758
- if (h[f] = l, f === "myop_cta_handler" && h.__myop_cta_queue) {
756
+ if (n.loader.type === fe.HTMLLoader && n.loader.shadowRootMode === ye.localFrame) {
757
+ const u = l.behavior, h = e.element.contentWindow, m = u.remap || o;
758
+ if (h[m] = c, m === "myop_cta_handler" && h.__myop_cta_queue) {
759
759
  const y = h.__myop_cta_queue;
760
- h.__myop_cta_queue = null, y.forEach((m) => {
761
- e.markedForDisposed || l(m.action, m.payload);
760
+ h.__myop_cta_queue = null, y.forEach((f) => {
761
+ e.markedForDisposed || c(f.action, f.payload);
762
762
  });
763
763
  }
764
764
  return !0;
765
765
  }
766
- return Xe(c, o, e), !1;
767
- } else if (c.mode === "input")
768
- if (c.behavior.type === "message") {
766
+ return rt(l, o, e), !1;
767
+ } else if (l.mode === "input")
768
+ if (l.behavior.type === "message") {
769
769
  const d = [];
770
- c.behavior.ref && d.push(pe.create(c.behavior.ref)), d.push(l), c.behavior.params && d.push(...c.behavior.params);
771
- const u = Oe[c.behavior.message];
770
+ l.behavior.ref && d.push(me.create(l.behavior.ref)), d.push(c), l.behavior.params && d.push(...l.behavior.params);
771
+ const u = $e[l.behavior.message];
772
772
  return e.send(new u(...d)), !0;
773
773
  } else
774
774
  throw new Error(
@@ -778,7 +778,7 @@ The 'behavior' field provided is not supported.
778
778
  Component: ${e.componentDefinition.name}, ID: ${e.componentDefinition.id}
779
779
 
780
780
  Prop Name: ${o}
781
- Behavior Field: ${c.behavior.type}
781
+ Behavior Field: ${l.behavior.type}
782
782
 
783
783
  Check the documentation for valid behavior options.`
784
784
  );
@@ -786,111 +786,111 @@ Check the documentation for valid behavior options.`
786
786
  }
787
787
  };
788
788
  return e.props = {}, e.props = new Proxy(e.props, i), e;
789
- }, Ts = (e, t) => new Proxy(e, {
790
- get(s, n) {
791
- return s[n] ? s[n] : (...a) => new Promise((o) => {
792
- a.forEach((l) => {
793
- Rt(l) || Cs.notSerializableRefCall(n, l);
794
- }), t.send(new Pe(
795
- ({ ref: l, propName: c, functionArgs: d, makeSerializable: u }) => {
796
- if (l) {
797
- const h = l[c];
798
- return u(typeof h == "function" ? l[c](...d) : h, !0);
789
+ }, Bn = (e, t) => new Proxy(e, {
790
+ get(n, s) {
791
+ return n[s] ? n[s] : (...a) => new Promise((o) => {
792
+ a.forEach((c) => {
793
+ zt(c) || An.notSerializableRefCall(s, c);
794
+ }), t.send(new We(
795
+ ({ ref: c, propName: l, functionArgs: d, makeSerializable: u }) => {
796
+ if (c) {
797
+ const h = c[l];
798
+ return u(typeof h == "function" ? c[l](...d) : h, !0);
799
799
  }
800
800
  return null;
801
801
  },
802
802
  {
803
803
  //TODO : turn it to config
804
- elementId: s.refConfig.selector,
805
- propName: n,
804
+ elementId: n.refConfig.selector,
805
+ propName: s,
806
806
  functionArgs: a
807
807
  },
808
- (l) => {
809
- o(l.content);
808
+ (c) => {
809
+ o(c.content);
810
810
  }
811
811
  ));
812
812
  });
813
813
  },
814
- set(s, n, i) {
815
- return t.send(new Pe(
816
- ({ ref: a, propName: o, propValue: l }) => {
817
- a && (a[o] = l);
814
+ set(n, s, i) {
815
+ return t.send(new We(
816
+ ({ ref: a, propName: o, propValue: c }) => {
817
+ a && (a[o] = c);
818
818
  },
819
819
  {
820
820
  //TODO : fix that
821
- elementId: s.refConfig.selector,
821
+ elementId: n.refConfig.selector,
822
822
  propValue: i,
823
- propName: n
823
+ propName: s
824
824
  },
825
825
  (a) => {
826
826
  }
827
827
  )), !0;
828
828
  }
829
- }), Ht = (e, t, s, n) => v(void 0, null, function* () {
829
+ }), Ft = (e, t, n, s) => v(void 0, null, function* () {
830
830
  const i = e.component;
831
831
  if (!i)
832
832
  throw new Error("cant createRefComponent with detached ref");
833
833
  return new Promise((a, o) => v(void 0, null, function* () {
834
- const l = new Je(t.type, i, n);
835
- s.push(l), yield i.initiated();
836
- const c = setTimeout(() => {
834
+ const c = new it(t.type, i, s);
835
+ n.push(c), yield i.initiated();
836
+ const l = setTimeout(() => {
837
837
  o("timeout");
838
838
  }, 5e3);
839
- i.send(new wt(
839
+ i.send(new Tt(
840
840
  e.refConfig,
841
841
  t,
842
- ge(E({}, n || {}), {
843
- id: l.id,
842
+ ve(S({}, s || {}), {
843
+ id: c.id,
844
844
  _hasParent: !0
845
845
  }),
846
846
  (d) => v(void 0, null, function* () {
847
- if (clearTimeout(c), d.failed) {
847
+ if (clearTimeout(l), d.failed) {
848
848
  o("CreateRefComponentMessage failed");
849
849
  return;
850
850
  }
851
- const u = s.find((h) => h.id == l.id);
852
- if (u !== l) {
851
+ const u = n.find((h) => h.id == c.id);
852
+ if (u !== c) {
853
853
  i.refs[e.refConfig.name] = u, a(u);
854
854
  return;
855
855
  } else
856
- l.setInitiated(), i.refs[e.refConfig.name] = l;
856
+ c.setInitiated(), i.refs[e.refConfig.name] = c;
857
857
  d.nestedRefs.forEach((h) => {
858
- const f = t.instance.resolvedNestedComponents.find((m) => m.type.id === h.componentDefinitionId).type, y = new Je(f, l);
859
- y.setInitiated(), l.refs[h.refName] = y, s.push(y);
858
+ const m = t.instance.resolvedNestedComponents.find((f) => f.type.id === h.componentDefinitionId).type, y = new it(m, c);
859
+ y.setInitiated(), c.refs[h.refName] = y, n.push(y);
860
860
  });
861
861
  try {
862
- yield Dt(l, t, s, !0), i.setHeightBasedOnScrollHeight && i.setHeightBasedOnScrollHeight(), a(l);
862
+ yield Bt(c, t, n, !0), i.setHeightBasedOnScrollHeight && i.setHeightBasedOnScrollHeight(), a(c);
863
863
  } catch (h) {
864
864
  o(h);
865
865
  }
866
866
  })
867
867
  ));
868
868
  }));
869
- }), Dt = (e, t, s, n = !1) => v(void 0, null, function* () {
869
+ }), Bt = (e, t, n, s = !1) => v(void 0, null, function* () {
870
870
  e.refs || (e.refs = {});
871
- const i = Object.values(e.componentDefinition.refs).map((a) => new Promise((o, l) => v(void 0, null, function* () {
872
- var c;
873
- if (a.behavior.type == $e.component) {
874
- if (n) {
871
+ const i = Object.values(e.componentDefinition.refs).map((a) => new Promise((o, c) => v(void 0, null, function* () {
872
+ var l;
873
+ if (a.behavior.type == Ge.component) {
874
+ if (s) {
875
875
  o();
876
876
  return;
877
877
  }
878
878
  let d = a.behavior.componentId;
879
879
  d || (d = a.behavior.instance.componentId);
880
- const u = (c = t.instance.resolvedNestedComponents) == null ? void 0 : c.find((f) => f.type.id === d);
880
+ const u = (l = t.instance.resolvedNestedComponents) == null ? void 0 : l.find((m) => m.type.id === d);
881
881
  if (!u)
882
882
  throw new Error("componentConfig provided without nestedComponentConfig check the config object");
883
- const h = pe.create("", a, e);
883
+ const h = me.create("", a, e);
884
884
  try {
885
- const f = yield Ht(h, u, s);
886
- e.refs[a.name] = f, o();
887
- } catch (f) {
888
- l(f);
885
+ const m = yield Ft(h, u, n);
886
+ e.refs[a.name] = m, o();
887
+ } catch (m) {
888
+ c(m);
889
889
  }
890
890
  } else
891
891
  try {
892
- const d = pe.create("", a, e);
893
- e.refs[a.name] = Ts(d, e), o();
892
+ const d = me.create("", a, e);
893
+ e.refs[a.name] = Bn(d, e), o();
894
894
  } catch {
895
895
  }
896
896
  })));
@@ -899,103 +899,116 @@ Check the documentation for valid behavior options.`
899
899
  } catch (a) {
900
900
  throw a;
901
901
  }
902
- }), kt = class extends Te {
903
- constructor(e, t, s, n, i) {
904
- super(e, s, i), this.componentConfig = e, this.container = s, this.IframeElement = n, r(this, "_autoSizeCleanup"), r(this, "_autoSizeOptions"), r(this, "_autoSizeUpdate"), r(this, "sizeMeta"), r(this, "cleanupInspect"), r(this, "setHeightBasedOnDocumentElement", () => {
905
- const a = this.send(new V(() => window.document.documentElement.scrollHeight, (o) => {
902
+ }), Nt = class extends Le {
903
+ constructor(e, t, n, s, i) {
904
+ super(e, n, i), this.componentConfig = e, this.container = n, this.IframeElement = s, r(this, "_autoSizeCleanup"), r(this, "_autoSizeOptions"), r(this, "_autoSizeUpdate"), r(this, "sizeMeta"), r(this, "cleanupInspect"), r(this, "setHeightBasedOnDocumentElement", () => {
905
+ const a = this.send(new j(() => window.document.documentElement.scrollHeight, (o) => {
906
906
  this.IframeElement.style.height = `${o.content}px`, a();
907
907
  }));
908
- }), r(this, "observeSizeBasedOnDocumentElement", () => this.send(new V(({ send: o }) => {
909
- const { height: l, width: c } = document.documentElement.getBoundingClientRect(), d = new ResizeObserver(() => {
908
+ }), r(this, "observeSizeBasedOnDocumentElement", () => this.send(new j(({ send: o }) => {
909
+ const { height: c, width: l } = document.documentElement.getBoundingClientRect(), d = new ResizeObserver(() => {
910
910
  const { height: u, width: h } = document.documentElement.getBoundingClientRect();
911
911
  o({ height: u, width: h });
912
912
  });
913
- return d.observe(document.documentElement), d.observe(document.body), { height: l, width: c };
913
+ return d.observe(document.documentElement), d.observe(document.body), { height: c, width: l };
914
914
  }, (o) => {
915
915
  this.IframeElement.style.width = `${o.content.width}px`, this.IframeElement.style.height = `${o.content.height}px`;
916
916
  }))), r(this, "observeAutoSize", (a) => {
917
917
  if (this._autoSizeOptions = a, this._autoSizeCleanup && this._autoSizeUpdate)
918
918
  return this._autoSizeUpdate(), this._autoSizeCleanup;
919
- const o = this.IframeElement, l = o.contentDocument;
920
- if (!l)
919
+ const o = this.IframeElement, c = o.contentDocument;
920
+ if (!c)
921
921
  return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"), () => {
922
922
  };
923
- const c = (m, _, C) => _ !== void 0 && m < _ ? _ : C !== void 0 && m > C ? C : m, d = (m) => {
924
- if (m === void 0) return;
925
- if (typeof m == "number") return m;
926
- const _ = parseFloat(m);
927
- return isNaN(_) ? void 0 : _;
923
+ const l = (b, w, E) => w !== void 0 && b < w ? w : E !== void 0 && b > E ? E : b, d = (b) => {
924
+ if (b === void 0) return;
925
+ if (typeof b == "number") return b;
926
+ const w = parseFloat(b);
927
+ return isNaN(w) ? void 0 : w;
928
928
  }, u = () => {
929
- var m, _, C, b, T, k, F, J;
930
- const L = o.contentDocument;
931
- if (!L) return;
932
- const g = this._autoSizeOptions, He = d(g == null ? void 0 : g.minWidth), Q = d(g == null ? void 0 : g.maxWidth), le = d(g == null ? void 0 : g.minHeight), se = d(g == null ? void 0 : g.maxHeight), ve = (m = g == null ? void 0 : g.loaderMinHeight) != null ? m : 50, we = ((_ = this.sizeMeta) == null ? void 0 : _.width) === "100%" ? "100%" : void 0, _e = ((C = this.sizeMeta) == null ? void 0 : C.height) === "100%" ? "100%" : void 0, O = (T = (b = g == null ? void 0 : g.explicitWidth) != null ? b : we) != null ? T : "100%", P = (k = g == null ? void 0 : g.explicitHeight) != null ? k : _e, M = O !== void 0, U = P !== void 0, S = this.container.getBoundingClientRect(), X = S.width === 0, Z = S.height === 0 || S.height === ve, H = (g != null && g.forceAutoSize || X) && !M, D = (g != null && g.forceAutoSize || Z) && !U;
933
- if (!H && !D) {
934
- o.style.width = typeof O == "number" ? `${O}px` : "100%", o.style.height = typeof P == "number" ? `${P}px` : "100%";
935
- const ee = typeof O == "number" ? O : void 0, de = typeof P == "number" ? P : void 0;
936
- (ee !== void 0 || de !== void 0) && ((F = g == null ? void 0 : g.onSizeChange) == null || F.call(g, {
937
- width: ee,
938
- height: de,
929
+ var b, w, E, O, A, Y, ce, le;
930
+ const H = o.contentDocument;
931
+ if (!H) return;
932
+ const g = this._autoSizeOptions, de = d(g == null ? void 0 : g.minWidth), ee = d(g == null ? void 0 : g.maxWidth), we = d(g == null ? void 0 : g.minHeight), te = d(g == null ? void 0 : g.maxHeight), _e = (b = g == null ? void 0 : g.loaderMinHeight) != null ? b : 50, Me = ((w = this.sizeMeta) == null ? void 0 : w.width) === "100%" ? "100%" : void 0, be = ((E = this.sizeMeta) == null ? void 0 : E.height) === "100%" ? "100%" : void 0, _ = (A = (O = g == null ? void 0 : g.explicitWidth) != null ? O : Me) != null ? A : "100%", R = (Y = g == null ? void 0 : g.explicitHeight) != null ? Y : be, T = _ !== void 0, U = R !== void 0, z = this.container.getBoundingClientRect(), J = z.width === 0, Q = z.height === 0 || z.height === _e, C = (g != null && g.forceAutoSize || J) && !T, D = (g != null && g.forceAutoSize || Q) && !U;
933
+ if (!C && !D) {
934
+ o.style.width = typeof _ == "number" ? `${_}px` : "100%", o.style.height = typeof R == "number" ? `${R}px` : "100%";
935
+ const xe = typeof _ == "number" ? _ : void 0, Te = typeof R == "number" ? R : void 0;
936
+ (xe !== void 0 || Te !== void 0) && ((ce = g == null ? void 0 : g.onSizeChange) == null || ce.call(g, {
937
+ width: xe,
938
+ height: Te,
939
939
  autoSizingWidth: !1,
940
940
  autoSizingHeight: !1
941
941
  }));
942
942
  return;
943
943
  }
944
- D && (o.style.height = "0px"), H && (o.style.width = "0px");
945
- const I = Math.ceil(Math.max(L.documentElement.scrollWidth, L.body.scrollWidth)), q = Math.ceil(Math.max(L.documentElement.scrollHeight, L.body.scrollHeight)), A = c(I, He, Q), ce = c(q, le, se);
946
- H ? o.style.width = `${A}px` : o.style.width = typeof O == "number" ? `${O}px` : "100%", D ? o.style.height = `${ce}px` : o.style.height = typeof P == "number" ? `${P}px` : "100%";
947
- const Me = H && Q !== void 0 && I > Q, De = D && se !== void 0 && q > se;
948
- L.documentElement.style.overflowX = Me ? "auto" : "", L.documentElement.style.overflowY = De ? "auto" : "", (J = g == null ? void 0 : g.onSizeChange) == null || J.call(g, {
949
- width: A,
950
- height: ce,
951
- autoSizingWidth: H,
944
+ const F = o.style.transition, k = this.container, Ee = k.style.transition;
945
+ o.style.transition = "none", k.style.transition = "none";
946
+ const Ce = o.getBoundingClientRect().height, X = o.getBoundingClientRect().width, ue = Math.ceil(Math.max(H.documentElement.scrollHeight, H.body.scrollHeight)), Se = Math.ceil(Math.max(H.documentElement.scrollWidth, H.body.scrollWidth));
947
+ let ne = Se, Ae = ue;
948
+ const Qt = D && ue > Ce + 1, Xt = C && Se > X + 1, ze = D && !Qt, Fe = C && !Xt;
949
+ if (ze || Fe) {
950
+ const xe = k.style.minHeight, Te = k.style.minWidth;
951
+ ze && (k.style.minHeight = `${Ce}px`), Fe && (k.style.minWidth = `${X}px`), ze && (o.style.height = "0px"), Fe && (o.style.width = "0px"), ne = Math.ceil(Math.max(H.documentElement.scrollWidth, H.body.scrollWidth)), Ae = Math.ceil(Math.max(H.documentElement.scrollHeight, H.body.scrollHeight)), k.style.minHeight = xe, k.style.minWidth = Te;
952
+ }
953
+ const Xe = l(ne, de, ee), Ze = l(Ae, we, te);
954
+ C ? o.style.width = `${Xe}px` : o.style.width = typeof _ == "number" ? `${_}px` : "100%", D ? o.style.height = `${Ze}px` : o.style.height = typeof R == "number" ? `${R}px` : "100%", o.offsetHeight, o.style.transition = F, k.style.transition = Ee;
955
+ const Zt = C && ee !== void 0 && ne > ee, en = D && te !== void 0 && Ae > te;
956
+ H.documentElement.style.overflowX = Zt ? "auto" : "", H.documentElement.style.overflowY = en ? "auto" : "", (le = g == null ? void 0 : g.onSizeChange) == null || le.call(g, {
957
+ width: Xe,
958
+ height: Ze,
959
+ autoSizingWidth: C,
952
960
  autoSizingHeight: D
953
961
  });
954
962
  };
955
963
  u(), this._autoSizeUpdate = u;
956
- const h = new ResizeObserver(u);
957
- h.observe(l.body), h.observe(l.documentElement);
958
- const f = new MutationObserver(u);
959
- f.observe(l.body, { childList: !0, subtree: !0, characterData: !0, attributes: !0 });
960
- const y = () => {
961
- h.disconnect(), f.disconnect(), this._autoSizeUpdate = void 0, this._autoSizeCleanup = void 0;
964
+ let h;
965
+ const m = () => {
966
+ h === void 0 && (h = requestAnimationFrame(() => {
967
+ h = void 0, u();
968
+ }));
969
+ }, y = new ResizeObserver(() => m());
970
+ y.observe(c.body), y.observe(c.documentElement);
971
+ const f = new MutationObserver(() => m());
972
+ f.observe(c.body, { childList: !0, subtree: !0, characterData: !0, attributes: !0 });
973
+ const I = () => {
974
+ y.disconnect(), f.disconnect(), h !== void 0 && (cancelAnimationFrame(h), h = void 0), this._autoSizeUpdate = void 0, this._autoSizeCleanup = void 0;
962
975
  };
963
- return this._autoSizeCleanup = y, y;
976
+ return this._autoSizeCleanup = I, I;
964
977
  }), r(this, "setSizeBasedOnDocumentElement", () => {
965
- const a = this.send(new V(() => {
966
- const { height: o, width: l } = document.documentElement.getBoundingClientRect();
967
- return { height: o, width: l };
978
+ const a = this.send(new j(() => {
979
+ const { height: o, width: c } = document.documentElement.getBoundingClientRect();
980
+ return { height: o, width: c };
968
981
  }, (o) => {
969
982
  this.IframeElement.style.width = `${o.content.width}px`, this.IframeElement.style.height = `${o.content.height}px`, a();
970
983
  }));
971
984
  }), r(this, "setHeightBasedOnScrollHeight", () => {
972
- const a = this.send(new V(() => {
973
- let l = 0;
974
- return l++, l--, Math.max(
985
+ const a = this.send(new j(() => {
986
+ let c = 0;
987
+ return c++, c--, Math.max(
975
988
  Math.max(
976
989
  window.document.body.clientHeight,
977
990
  window.document.body.scrollHeight
978
991
  ),
979
992
  window.document.body.offsetHeight
980
- ) + l + "px";
993
+ ) + c + "px";
981
994
  }, (o) => {
982
995
  this.IframeElement.style.height = o.content, a();
983
996
  }));
984
997
  }), r(this, "send", (a) => {
985
- var o, l;
986
- let c = E({}, a);
987
- if (c.messageType === w.ExecuteComponentMethod)
988
- return this[c.method](), () => {
998
+ var o, c;
999
+ let l = S({}, a);
1000
+ if (l.messageType === M.ExecuteComponentMethod)
1001
+ return this[l.method](), () => {
989
1002
  };
990
- c.direction = z.down;
991
- const d = super.send(c);
992
- return (l = (o = this.IframeElement) == null ? void 0 : o.contentWindow) == null || l.postMessage(c, "*"), d;
1003
+ l.direction = P.down;
1004
+ const d = super.send(l);
1005
+ return (c = (o = this.IframeElement) == null ? void 0 : o.contentWindow) == null || c.postMessage(l, "*"), d;
993
1006
  }), r(this, "dispose", () => {
994
1007
  this._autoSizeCleanup && (this._autoSizeCleanup(), this._autoSizeCleanup = void 0), this.cleanupInspect && this.cleanupInspect(), super.dispose(), this.IframeElement.parentNode.removeChild(this.IframeElement);
995
1008
  }), this.element = this.IframeElement;
996
1009
  }
997
1010
  inspect() {
998
- return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect = We(this.id, "MyopIframeComponent", 10, this.container, this.IframeElement, this.componentDefinition), () => {
1011
+ return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect = Ye(this.id, "MyopIframeComponent", 10, this.container, this.IframeElement, this.componentDefinition), () => {
999
1012
  this.cleanupInspect(), this.cleanupInspect = void 0;
1000
1013
  });
1001
1014
  }
@@ -1006,37 +1019,37 @@ Check the documentation for valid behavior options.`
1006
1019
  this.IframeElement.style.opacity = "1", this.IframeElement.style.position = "unset", this.IframeElement.style.pointerEvents = "all", this.IframeElement.style.visibility = "visible";
1007
1020
  }
1008
1021
  onMessageReceived(e) {
1009
- return e.messageType === w.In.MutationObserverMessage || e.messageType === w.In.ResizeObserverMessage ? (this.setHeightBasedOnScrollHeight(), !0) : super.onMessageReceived(e);
1022
+ return e.messageType === M.In.MutationObserverMessage || e.messageType === M.In.ResizeObserverMessage ? (this.setHeightBasedOnScrollHeight(), !0) : super.onMessageReceived(e);
1010
1023
  }
1011
- }, Ke = class {
1024
+ }, Je = class {
1012
1025
  constructor() {
1013
- r(this, "appendChild", (e, t, s) => {
1014
- var n;
1015
- if (s != null && s.relative) {
1016
- if (s.relative.direction === "before")
1017
- return e.insertBefore(t, s.relative.child);
1018
- if (s.relative.direction === "after") {
1019
- const i = (n = s.relative.child) == null ? void 0 : n.nextSibling;
1026
+ r(this, "appendChild", (e, t, n) => {
1027
+ var s;
1028
+ if (n != null && n.relative) {
1029
+ if (n.relative.direction === "before")
1030
+ return e.insertBefore(t, n.relative.child);
1031
+ if (n.relative.direction === "after") {
1032
+ const i = (s = n.relative.child) == null ? void 0 : s.nextSibling;
1020
1033
  return e.insertBefore(t, i || null);
1021
1034
  }
1022
1035
  } else
1023
1036
  return e.appendChild(t);
1024
1037
  });
1025
1038
  }
1026
- }, Is = (e, t, s) => {
1027
- const n = new URL(e);
1028
- return n.searchParams.append(t, s), n.toString();
1029
- }, Rs = class extends Ke {
1039
+ }, Nn = (e, t, n) => {
1040
+ const s = new URL(e);
1041
+ return s.searchParams.append(t, n), s.toString();
1042
+ }, $n = class extends Je {
1030
1043
  constructor() {
1031
- super(...arguments), r(this, "type", me.IframeLoader), r(this, "load", (e, t, s, n) => v(this, null, function* () {
1044
+ super(...arguments), r(this, "type", fe.IframeLoader), r(this, "load", (e, t, n, s) => v(this, null, function* () {
1032
1045
  let i;
1033
1046
  const a = t.loader;
1034
- if ((s == null ? void 0 : s.nodeName) === "IFRAME")
1035
- console.log("needs to load into an exsisting Iframe...", a.url, s), i = s, i.src = a.url;
1047
+ if ((n == null ? void 0 : n.nodeName) === "IFRAME")
1048
+ console.log("needs to load into an exsisting Iframe...", a.url, n), i = n, i.src = a.url;
1036
1049
  else {
1037
- const o = te(), l = `myop-comp-${o}`;
1038
- i = document.createElement("iframe"), i.id = l;
1039
- const c = `
1050
+ const o = Z(), c = `myop-comp-${o}`;
1051
+ i = document.createElement("iframe"), i.id = c;
1052
+ const l = `
1040
1053
  padding: 0;
1041
1054
  margin: 0;
1042
1055
  position: absolute;
@@ -1045,26 +1058,26 @@ Check the documentation for valid behavior options.`
1045
1058
  width: 100%;
1046
1059
  overflow: hidden;
1047
1060
  border: none;
1048
- opacity: ${n != null && n.hidden ? "0" : "1"};
1049
- pointer-events: ${n != null && n.hidden ? "none" : "all"};
1061
+ opacity: ${s != null && s.hidden ? "0" : "1"};
1062
+ pointer-events: ${s != null && s.hidden ? "none" : "all"};
1050
1063
  `;
1051
- i.style.cssText = c, n != null && n.elementAttributes && Object.entries(n.elementAttributes).forEach(([u, h]) => {
1064
+ i.style.cssText = l, s != null && s.elementAttributes && Object.entries(s.elementAttributes).forEach(([u, h]) => {
1052
1065
  h === "" || h === null || h === void 0 ? i.setAttribute(u, "") : i.setAttribute(u, String(h));
1053
1066
  });
1054
1067
  let d = t.loader.url;
1055
- n != null && n._hasParent && (d = Is(d, "_myop-comp", o)), i.src = d, s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), i = this.appendChild(s, i, n);
1068
+ s != null && s._hasParent && (d = Nn(d, "_myop-comp", o)), i.src = d, n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), i = this.appendChild(n, i, s);
1056
1069
  }
1057
- return new kt(e, t, s, i, n);
1070
+ return new Nt(e, t, n, i, s);
1058
1071
  }));
1059
1072
  }
1060
- }, Lt = {
1073
+ }, $t = {
1061
1074
  webcomponent_message_key: "myop_webcomponent_message"
1062
- }, Ot = class extends Te {
1063
- constructor(e, t, s, n, i) {
1064
- super(e, s, i), this.container = s, this.customElement = n, r(this, "cleanupInspect", () => {
1075
+ }, Wt = class extends Le {
1076
+ constructor(e, t, n, s, i) {
1077
+ super(e, n, i), this.container = n, this.customElement = s, r(this, "cleanupInspect", () => {
1065
1078
  }), r(this, "send", (a) => {
1066
- let o = E({}, a);
1067
- const l = super.send(o), c = new CustomEvent(Lt.webcomponent_message_key, {
1079
+ let o = S({}, a);
1080
+ const c = super.send(o), l = new CustomEvent($t.webcomponent_message_key, {
1068
1081
  // @ts-ignore
1069
1082
  detail: o
1070
1083
  // bubbles: true,
@@ -1072,18 +1085,18 @@ Check the documentation for valid behavior options.`
1072
1085
  // composed: true
1073
1086
  });
1074
1087
  try {
1075
- this.customElement.dispatchEvent(c);
1088
+ this.customElement.dispatchEvent(l);
1076
1089
  } catch (d) {
1077
1090
  console.log("error while trying to dispatchEvent", d);
1078
1091
  }
1079
- return l;
1092
+ return c;
1080
1093
  }), r(this, "dispose", () => {
1081
1094
  var a;
1082
1095
  super.dispose(), (a = this.customElement.parentNode) == null || a.removeChild(this.customElement);
1083
- }), this.element = n;
1096
+ }), this.element = s;
1084
1097
  }
1085
1098
  inspect() {
1086
- return this.cleanupInspect = We(this.id, "MyopWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
1099
+ return this.cleanupInspect = Ye(this.id, "MyopWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
1087
1100
  }
1088
1101
  hide() {
1089
1102
  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";
@@ -1091,51 +1104,51 @@ Check the documentation for valid behavior options.`
1091
1104
  show() {
1092
1105
  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 = "";
1093
1106
  }
1094
- }, ke = {}, Hs = class extends Ke {
1107
+ }, Be = {}, Wn = class extends Je {
1095
1108
  constructor() {
1096
- super(...arguments), r(this, "type", me.WebComponentLoader), r(this, "load", (e, t, s, n) => v(this, null, function* () {
1109
+ super(...arguments), r(this, "type", fe.WebComponentLoader), r(this, "load", (e, t, n, s) => v(this, null, function* () {
1097
1110
  const i = t.loader;
1098
- ke[i.url] ? console.log("Module alreday loaded or in loading process") : ke[i.url] = new Promise((l, c) => {
1111
+ Be[i.url] ? console.log("Module alreday loaded or in loading process") : Be[i.url] = new Promise((c, l) => {
1099
1112
  const d = i.url, u = document.createElement("script");
1100
1113
  u.type = "module", u.src = d, u.onload = () => {
1101
- l();
1102
- }, u.onerror = () => {
1103
1114
  c();
1115
+ }, u.onerror = () => {
1116
+ l();
1104
1117
  }, document.head.appendChild(u);
1105
- }), yield ke[i.url], yield Zt(1);
1106
- let a = `myop-comp-${te()}`;
1118
+ }), yield Be[i.url], yield un(1);
1119
+ let a = `myop-comp-${Z()}`;
1107
1120
  const o = document.createElement(i.tag);
1108
- return s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), o.id = a, n != null && n.hidden && (o.style.opacity = "0", o.style.position = "absolute", o.style.height = "0", o.style.width = "0", o.style.pointerEvents = "none", o.style.visibility = "hidden"), n != null && n._environment && (o._myopEnvironment = n == null ? void 0 : n._environment), this.appendChild(s, o, n), new Ot(e, t, s, o, n);
1121
+ return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), o.id = a, s != null && s.hidden && (o.style.opacity = "0", o.style.position = "absolute", o.style.height = "0", o.style.width = "0", o.style.pointerEvents = "none", o.style.visibility = "hidden"), s != null && s._environment && (o._myopEnvironment = s == null ? void 0 : s._environment), this.appendChild(n, o, s), new Wt(e, t, n, o, s);
1109
1122
  }));
1110
1123
  }
1111
- }, Ds = "0.3.21", K = class extends ws {
1124
+ }, Kn = "0.3.22", K = class extends Dn {
1112
1125
  constructor(e, t) {
1113
- super(e), this.context = t, r(this, "executor", (s) => {
1114
- if (s.destination) {
1115
- const n = s.destination;
1116
- if (this.context[n].context) {
1126
+ super(e), this.context = t, r(this, "executor", (n) => {
1127
+ if (n.destination) {
1128
+ const s = n.destination;
1129
+ if (this.context[s].context) {
1117
1130
  const i = (a, o) => {
1118
- this.messageToHost(ge(E({}, a), {
1119
- source: s.destination ? s.destination : s.source,
1120
- destination: s.source ? s.source : s.destination
1131
+ this.messageToHost(ve(S({}, a), {
1132
+ source: n.destination ? n.destination : n.source,
1133
+ destination: n.source ? n.source : n.destination
1121
1134
  }), o);
1122
1135
  };
1123
- return this.innerExecutor(s, this.context[n].context, i);
1136
+ return this.innerExecutor(n, this.context[s].context, i);
1124
1137
  } else
1125
1138
  debugger;
1126
1139
  } else
1127
1140
  debugger;
1128
1141
  });
1129
1142
  }
1130
- }, ye = {
1143
+ }, ge = {
1131
1144
  id: "myop-id"
1132
- }, ae = (e, t) => t.querySelectorAll(`[${ye.id}='${e.refConfig.selector}']`), ks = class extends K {
1145
+ }, ae = (e, t) => t.querySelectorAll(`[${ge.id}='${e.refConfig.selector}']`), Un = class extends K {
1133
1146
  constructor() {
1134
- super(...arguments), r(this, "messageType", w.BindClickMessage), r(this, "innerExecutor", (e, t, s) => {
1135
- const n = ae(e.ref, t.shadowRoot), i = [];
1136
- return n.forEach((a) => {
1147
+ super(...arguments), r(this, "messageType", M.BindClickMessage), r(this, "innerExecutor", (e, t, n) => {
1148
+ const s = ae(e.ref, t.shadowRoot), i = [];
1149
+ return s.forEach((a) => {
1137
1150
  const o = () => {
1138
- s(new lt(e.handlerUniqueId));
1151
+ n(new yt(e.handlerUniqueId));
1139
1152
  };
1140
1153
  a.addEventListener("click", o), i.push(() => {
1141
1154
  a.removeEventListener("click", o);
@@ -1145,44 +1158,44 @@ Check the documentation for valid behavior options.`
1145
1158
  };
1146
1159
  });
1147
1160
  }
1148
- }, Ls = class extends K {
1161
+ }, qn = class extends K {
1149
1162
  constructor() {
1150
- super(...arguments), r(this, "messageType", w.ChangeTextMessage), r(this, "innerExecutor", (e, t) => {
1151
- ae(e.ref, t.shadowRoot).forEach((n) => {
1152
- n.textContent = e.content;
1163
+ super(...arguments), r(this, "messageType", M.ChangeTextMessage), r(this, "innerExecutor", (e, t) => {
1164
+ ae(e.ref, t.shadowRoot).forEach((s) => {
1165
+ s.textContent = e.content;
1153
1166
  });
1154
1167
  });
1155
1168
  }
1156
- }, Os = class extends bs {
1169
+ }, jn = class extends On {
1157
1170
  constructor(e, t) {
1158
1171
  super(e, t), this.container = e, this.shadowRoot = t;
1159
1172
  }
1160
- }, Ps = class extends K {
1173
+ }, Vn = class extends K {
1161
1174
  constructor() {
1162
1175
  super(...arguments), r(this, "innerExecutor", (e, t) => {
1163
- const s = t.shadowRoot.querySelectorAll(`[${ye.id}]`);
1164
- let n = [];
1165
- s.forEach((i) => {
1166
- const a = i.getAttribute(ye.id);
1167
- a && n.push(new ys(a, i.tagName, i.getBoundingClientRect(), i.offsetTop, i.offsetLeft));
1168
- }), this.messageToHost(new bt(e.handlerUniqueId, n));
1169
- }), r(this, "messageType", w.DetectMyopRefsMessage);
1170
- }
1171
- }, As = class extends K {
1176
+ const n = t.shadowRoot.querySelectorAll(`[${ge.id}]`);
1177
+ let s = [];
1178
+ n.forEach((i) => {
1179
+ const a = i.getAttribute(ge.id);
1180
+ a && s.push(new In(a, i.tagName, i.getBoundingClientRect(), i.offsetTop, i.offsetLeft));
1181
+ }), this.messageToHost(new Rt(e.handlerUniqueId, s));
1182
+ }), r(this, "messageType", M.DetectMyopRefsMessage);
1183
+ }
1184
+ }, Gn = class extends K {
1172
1185
  constructor() {
1173
- super(...arguments), r(this, "messageType", w.SetAttributeMessage), r(this, "innerExecutor", (e, t) => {
1174
- ae(e.ref, t.shadowRoot).forEach((n) => {
1175
- n.setAttribute(e.name, e.value);
1186
+ super(...arguments), r(this, "messageType", M.SetAttributeMessage), r(this, "innerExecutor", (e, t) => {
1187
+ ae(e.ref, t.shadowRoot).forEach((s) => {
1188
+ s.setAttribute(e.name, e.value);
1176
1189
  });
1177
1190
  });
1178
1191
  }
1179
- }, zs = class extends K {
1192
+ }, Yn = class extends K {
1180
1193
  constructor() {
1181
- super(...arguments), r(this, "messageType", w.AddEventListenerMessage), r(this, "innerExecutor", (e, t, s) => {
1182
- const n = ae(e.ref, t.shadowRoot), i = [];
1183
- return n.forEach((a) => {
1184
- const o = (l) => {
1185
- s(new pt(e.handlerUniqueId, re(l, e.serializableSkeleton)));
1194
+ super(...arguments), r(this, "messageType", M.AddEventListenerMessage), r(this, "innerExecutor", (e, t, n) => {
1195
+ const s = ae(e.ref, t.shadowRoot), i = [];
1196
+ return s.forEach((a) => {
1197
+ const o = (c) => {
1198
+ n(new Mt(e.handlerUniqueId, re(c, e.serializableSkeleton)));
1186
1199
  };
1187
1200
  a.addEventListener(e.type, o), i.push(() => {
1188
1201
  a.removeEventListener(e.type, o);
@@ -1192,49 +1205,49 @@ Check the documentation for valid behavior options.`
1192
1205
  };
1193
1206
  });
1194
1207
  }
1195
- }, Fs = class extends K {
1208
+ }, Jn = class extends K {
1196
1209
  constructor() {
1197
- super(...arguments), r(this, "messageType", w.CreateRefComponentMessage), r(this, "innerExecutor", (e, t, s) => {
1210
+ super(...arguments), r(this, "messageType", M.CreateRefComponentMessage), r(this, "innerExecutor", (e, t, n) => {
1198
1211
  v(this, null, function* () {
1199
- const i = t.shadowRoot.querySelectorAll(`[${ye.id}='${e.refConfig.selector}']`);
1212
+ const i = t.shadowRoot.querySelectorAll(`[${ge.id}='${e.refConfig.selector}']`);
1200
1213
  if (i.length === 1) {
1201
- const a = Ie.Instance(), o = a.components.find((u) => u.id === e.options.id);
1214
+ const a = Oe.Instance(), o = a.components.find((u) => u.id === e.options.id);
1202
1215
  o && o.dispose();
1203
- const l = a.components.indexOf(o);
1204
- l !== -1 && a.components.splice(l, 1);
1205
- const c = yield a.loadComponent(
1216
+ const c = a.components.indexOf(o);
1217
+ c !== -1 && a.components.splice(c, 1);
1218
+ const l = yield a.loadComponent(
1206
1219
  e.nestedComponentConfig,
1207
1220
  i.item(0),
1208
1221
  e.options
1209
1222
  ), d = [];
1210
- Object.keys(c.refs).forEach((u) => {
1211
- let h = c.refs[u];
1223
+ Object.keys(l.refs).forEach((u) => {
1224
+ let h = l.refs[u];
1212
1225
  h = h.__nonProxied || h, h.componentDefinition && d.push({
1213
1226
  refName: u,
1214
1227
  componentDefinitionId: h.componentDefinition.id
1215
1228
  });
1216
- }), s(new Ae(e.handlerUniqueId, d));
1229
+ }), n(new Ke(e.handlerUniqueId, d));
1217
1230
  } else {
1218
- console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new Ae(e.handlerUniqueId, [], !0));
1231
+ console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new Ke(e.handlerUniqueId, [], !0));
1219
1232
  debugger;
1220
1233
  }
1221
1234
  }).then();
1222
1235
  });
1223
1236
  }
1224
- }, Ns = (e, t, s) => {
1225
- const n = e.scriptInputs ? e.scriptInputs : {};
1226
- n.makeSerializable = re, n.send = t, n.rootRef = s, n.__scriptInputs = n;
1227
- const a = new Function(`return (${e.script})(...arguments)`)(n);
1237
+ }, Qn = (e, t, n) => {
1238
+ const s = e.scriptInputs ? e.scriptInputs : {};
1239
+ s.makeSerializable = re, s.send = t, s.rootRef = n, s.__scriptInputs = s;
1240
+ const a = new Function(`return (${e.script})(...arguments)`)(s);
1228
1241
  t(a);
1229
- }, Bs = class extends K {
1242
+ }, Xn = class extends K {
1230
1243
  constructor() {
1231
- super(...arguments), r(this, "messageType", w.ExecuteScriptMessage), r(this, "innerExecutor", (e, t, s) => {
1232
- Ns(e, (i) => {
1233
- s(new ut(e.handlerUniqueId, i));
1244
+ super(...arguments), r(this, "messageType", M.ExecuteScriptMessage), r(this, "innerExecutor", (e, t, n) => {
1245
+ Qn(e, (i) => {
1246
+ n(new wt(e.handlerUniqueId, i));
1234
1247
  }, t);
1235
1248
  });
1236
1249
  }
1237
- }, Pt = (e) => {
1250
+ }, Kt = (e) => {
1238
1251
  if (!e) return null;
1239
1252
  if (e.tagName === "FORM") {
1240
1253
  new FormData(e);
@@ -1242,16 +1255,16 @@ Check the documentation for valid behavior options.`
1242
1255
  formData: {},
1243
1256
  unmappedData: []
1244
1257
  };
1245
- return e.querySelectorAll("input, select, textarea").forEach((n) => {
1246
- if (typeof n.value == "string") {
1247
- const i = n.getAttribute(ye.id);
1248
- let a = n.getAttribute("name");
1258
+ return e.querySelectorAll("input, select, textarea").forEach((s) => {
1259
+ if (typeof s.value == "string") {
1260
+ const i = s.getAttribute(ge.id);
1261
+ let a = s.getAttribute("name");
1249
1262
  const o = {
1250
- id: n.id,
1263
+ id: s.id,
1251
1264
  name: a,
1252
- value: Pt(n),
1253
- required: n.required,
1254
- validity: re(n.validity, !0),
1265
+ value: Kt(s),
1266
+ required: s.required,
1267
+ validity: re(s.validity, !0),
1255
1268
  myopId: i
1256
1269
  };
1257
1270
  a ? t.formData[a] ? t.formData[a].value ? t.unmappedData.push(o) : (t.unmappedData.push(t.formData[a]), t.formData[a] = o) : t.formData[a] = o : t.unmappedData.push(o);
@@ -1259,84 +1272,84 @@ Check the documentation for valid behavior options.`
1259
1272
  }), t;
1260
1273
  }
1261
1274
  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;
1262
- }, $s = class extends K {
1275
+ }, Zn = class extends K {
1263
1276
  constructor() {
1264
- super(...arguments), r(this, "messageType", w.GetElementValueMessage), r(this, "innerExecutor", (e, t, s) => {
1277
+ super(...arguments), r(this, "messageType", M.GetElementValueMessage), r(this, "innerExecutor", (e, t, n) => {
1265
1278
  ae(e.ref, t.shadowRoot).forEach((i) => {
1266
- s(new ft(Pt(i)), e);
1279
+ n(new Et(Kt(i)), e);
1267
1280
  });
1268
1281
  });
1269
1282
  }
1270
- }, Ws = class extends K {
1283
+ }, es = class extends K {
1271
1284
  constructor() {
1272
- super(...arguments), r(this, "messageType", w.SetInnerHtml), r(this, "innerExecutor", (e, t) => {
1273
- ae(e.ref, t.shadowRoot).forEach((n) => {
1274
- n.innerHTML = e.content;
1285
+ super(...arguments), r(this, "messageType", M.SetInnerHtml), r(this, "innerExecutor", (e, t) => {
1286
+ ae(e.ref, t.shadowRoot).forEach((s) => {
1287
+ s.innerHTML = e.content;
1275
1288
  });
1276
1289
  });
1277
1290
  }
1278
- }, At = class extends Ms {
1291
+ }, Ut = class extends Ln {
1279
1292
  constructor() {
1280
1293
  super(...arguments), r(this, "alwaysPassEnvelopesToHost", !0), r(this, "connectedCallback", (e, t) => {
1281
- e.addEventListener(Lt.webcomponent_message_key, (s) => {
1282
- const n = s.data ? s.data : s.detail;
1283
- if (!n || !n.myop) {
1294
+ e.addEventListener($t.webcomponent_message_key, (n) => {
1295
+ const s = n.data ? n.data : n.detail;
1296
+ if (!s || !s.myop) {
1284
1297
  debugger;
1285
1298
  throw new Error("recvied webcomponent_message with wrong type");
1286
1299
  } else {
1287
- const i = n;
1288
- if (this.handleIncomeMessages(s), i.messageType === w.InitMessage) {
1300
+ const i = s;
1301
+ if (this.handleIncomeMessages(n), i.messageType === M.InitMessage) {
1289
1302
  const a = i.content.id;
1290
- this.components[a].context = new Os(e, t);
1303
+ this.components[a].context = new jn(e, t);
1291
1304
  }
1292
1305
  }
1293
1306
  }), setTimeout(() => {
1294
- this.messageToHost(new gt());
1307
+ this.messageToHost(new St());
1295
1308
  }, 1);
1296
1309
  }), r(this, "messageToHost", (e, t) => {
1297
- e.direction = z.up, !e.replayToHandler && (t != null && t.handlerUniqueId) && (e.replayToHandler = t.handlerUniqueId), window.myop.hostSDK.send(e);
1310
+ e.direction = P.up, !e.replayToHandler && (t != null && t.handlerUniqueId) && (e.replayToHandler = t.handlerUniqueId), window.myop.hostSDK.send(e);
1298
1311
  }), r(this, "supportedHandlers", [
1299
- new Ls(this.messageToHost, this.components),
1300
- new Ws(this.messageToHost, this.components),
1301
- new ks(this.messageToHost, this.components),
1302
- new Ps(this.messageToHost, this.components),
1303
- new As(this.messageToHost, this.components),
1304
- new zs(this.messageToHost, this.components),
1305
- new Bs(this.messageToHost, this.components),
1306
- new $s(this.messageToHost, this.components),
1312
+ new qn(this.messageToHost, this.components),
1313
+ new es(this.messageToHost, this.components),
1314
+ new Un(this.messageToHost, this.components),
1315
+ new Vn(this.messageToHost, this.components),
1316
+ new Gn(this.messageToHost, this.components),
1317
+ new Yn(this.messageToHost, this.components),
1318
+ new Xn(this.messageToHost, this.components),
1319
+ new Zn(this.messageToHost, this.components),
1307
1320
  //
1308
- new Fs(this.messageToHost, this.components)
1321
+ new Jn(this.messageToHost, this.components)
1309
1322
  ]), r(this, "init", () => {
1310
1323
  });
1311
1324
  }
1312
1325
  };
1313
- ot("WebComponentSDK", At);
1314
- var Ks = "<!-- myop-web-component -->", Us = "myop-web-component", Ze = /* @__PURE__ */ new Set(), et = [], Ee, zt = () => v(void 0, null, function* () {
1315
- return Ee || (Ee = new At(), Ee.init()), Ee;
1326
+ pt("WebComponentSDK", Ut);
1327
+ var ts = "<!-- myop-web-component -->", ns = "myop-web-component", at = /* @__PURE__ */ new Set(), ct = [], He, qt = () => v(void 0, null, function* () {
1328
+ return He || (He = new Ut(), He.init()), He;
1316
1329
  });
1317
- function qs(e, t) {
1330
+ function ss(e, t) {
1318
1331
  return class extends HTMLElement {
1319
1332
  connectedCallback() {
1320
- const s = t === fe.open ? "open" : "closed", n = this.attachShadow({ mode: s });
1321
- zt().then((i) => {
1322
- i.connectedCallback(this, n), n.innerHTML = e;
1333
+ const n = t === ye.open ? "open" : "closed", s = this.attachShadow({ mode: n });
1334
+ qt().then((i) => {
1335
+ i.connectedCallback(this, s), s.innerHTML = e;
1323
1336
  });
1324
1337
  }
1325
1338
  };
1326
1339
  }
1327
- var js = (e, t, s) => {
1328
- customElements.define(e, qs(t, s)), console.log(`define('${e}') was called, web component ready to use`);
1329
- }, Vs = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/(\d+)/g, "-$1").toLowerCase(), Gs = (e) => (e = Vs(e), e.replace(/_/g, "-")), Ys = class extends Ke {
1340
+ var is = (e, t, n) => {
1341
+ customElements.define(e, ss(t, n)), console.log(`define('${e}') was called, web component ready to use`);
1342
+ }, os = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/(\d+)/g, "-$1").toLowerCase(), rs = (e) => (e = os(e), e.replace(/_/g, "-")), as = class extends Je {
1330
1343
  constructor() {
1331
- super(...arguments), r(this, "type", me.HTMLLoader), r(this, "load", (e, t, s, n) => v(this, null, function* () {
1344
+ super(...arguments), r(this, "type", fe.HTMLLoader), r(this, "load", (e, t, n, s) => v(this, null, function* () {
1332
1345
  const i = t.loader;
1333
1346
  if (this.isMyopWebComponent(i.HTML))
1334
- return this.loadExtractedWebComponent(e, t, s, i.HTML, n);
1335
- let a = `myop-comp-${te()}`, o;
1336
- if (i.shadowRootMode === fe.localFrame) {
1337
- const c = `myop-comp-${te()}`;
1347
+ return this.loadExtractedWebComponent(e, t, n, i.HTML, s);
1348
+ let a = `myop-comp-${Z()}`, o;
1349
+ if (i.shadowRootMode === ye.localFrame) {
1350
+ const l = `myop-comp-${Z()}`;
1338
1351
  let d = document.createElement("iframe");
1339
- d.id = c, d.style.cssText = `
1352
+ d.id = l, d.style.cssText = `
1340
1353
  display: block;
1341
1354
  padding: 0;
1342
1355
  margin: 0;
@@ -1344,41 +1357,41 @@ var js = (e, t, s) => {
1344
1357
  inset: 0;
1345
1358
  overflow: hidden;
1346
1359
  border: none;
1347
- opacity: ${n != null && n.hidden ? "0" : "1"};
1360
+ opacity: ${s != null && s.hidden ? "0" : "1"};
1348
1361
  width: 100%;
1349
1362
  height: 100%;
1350
- pointer-events: ${n != null && n.hidden ? "none" : "all"};
1351
- `, s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), d = this.appendChild(s, d, n);
1363
+ pointer-events: ${s != null && s.hidden ? "none" : "all"};
1364
+ `, n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), d = this.appendChild(n, d, s);
1352
1365
  const u = d.contentDocument || d.contentWindow.document;
1353
1366
  u.open();
1354
1367
  let h = null;
1355
1368
  {
1356
- const T = new DOMParser().parseFromString(i.HTML, "text/html").querySelector('meta[name="myop:size"]');
1357
- if (T)
1369
+ const E = new DOMParser().parseFromString(i.HTML, "text/html").querySelector('meta[name="myop:size"]');
1370
+ if (E)
1358
1371
  try {
1359
- h = JSON.parse(T.getAttribute("content") || "{}");
1372
+ h = JSON.parse(E.getAttribute("content") || "{}");
1360
1373
  } catch {
1361
1374
  }
1362
1375
  }
1363
- let f = i.HTML;
1364
- if (n != null && n._inspection) {
1365
- const b = new DOMParser().parseFromString(i.HTML, "text/html"), T = b.getElementById("myop_preview");
1366
- T == null || T.removeAttribute("type");
1367
- const k = b.implementation.createHTMLDocument();
1368
- k.body.innerHTML = `<script>
1376
+ let m = i.HTML;
1377
+ if (s != null && s._inspection) {
1378
+ const w = new DOMParser().parseFromString(i.HTML, "text/html"), E = w.getElementById("myop_preview");
1379
+ E == null || E.removeAttribute("type");
1380
+ const O = w.implementation.createHTMLDocument();
1381
+ O.body.innerHTML = `<script>
1369
1382
  const beforeKeysWindow = new Set(Object.keys(window));
1370
1383
  window.myopState = {
1371
1384
  beforeKeysWindow,
1372
1385
  };
1373
1386
  <\/script>`;
1374
- const F = k.body.firstChild;
1375
- F && b.head && b.head.insertBefore(b.importNode(F, !0), b.head.firstChild), f = b.documentElement.outerHTML;
1376
- } else if ((n == null ? void 0 : n.data) !== void 0) {
1377
- const b = new DOMParser().parseFromString(i.HTML, "text/html"), T = b.getElementById("myop_preview");
1378
- T && (T.remove(), f = b.documentElement.outerHTML);
1387
+ const A = O.body.firstChild;
1388
+ A && w.head && w.head.insertBefore(w.importNode(A, !0), w.head.firstChild), m = w.documentElement.outerHTML;
1389
+ } else if ((s == null ? void 0 : s.data) !== void 0) {
1390
+ const w = new DOMParser().parseFromString(i.HTML, "text/html"), E = w.getElementById("myop_preview");
1391
+ E && (E.remove(), m = w.documentElement.outerHTML);
1379
1392
  }
1380
- u.writeln(f);
1381
- const y = `<script>${qt}<\/script>`;
1393
+ u.writeln(m);
1394
+ const y = `<script>${nn}<\/script>`;
1382
1395
  if (u.writeln(`${y}<script>
1383
1396
  const __myop_init = async () => {
1384
1397
  const iframeModule = await MyopSDK.getIframeModule();
@@ -1387,15 +1400,15 @@ var js = (e, t, s) => {
1387
1400
  sdk.init();
1388
1401
  }
1389
1402
  __myop_init().then();
1390
- <\/script>`), (n == null ? void 0 : n.data) !== void 0) {
1391
- const C = `<script>
1403
+ <\/script>`), (s == null ? void 0 : s.data) !== void 0) {
1404
+ const b = `<script>
1392
1405
  window.__myop_cta_queue = [];
1393
1406
  window.myop_cta_handler = function(action, payload) {
1394
1407
  window.__myop_cta_queue.push({action: action, payload: payload});
1395
1408
  };
1396
- <\/script>`, T = `<script id="__myop_init_data_script">
1409
+ <\/script>`, E = `<script id="__myop_init_data_script">
1397
1410
  (function() {
1398
- var data = ${JSON.stringify(n.data).replace(/<\/script/gi, "\\u003c/script")};
1411
+ var data = ${JSON.stringify(s.data).replace(/<\/script/gi, "\\u003c/script")};
1399
1412
  var scriptEl = document.getElementById('__myop_init_data_script');
1400
1413
 
1401
1414
  var callInitInterface = function(fn) {
@@ -1454,78 +1467,78 @@ var js = (e, t, s) => {
1454
1467
  }
1455
1468
  })();
1456
1469
  <\/script>`;
1457
- u.writeln(C + T);
1470
+ u.writeln(b + E);
1458
1471
  }
1459
1472
  u.close();
1460
- const _ = new kt(e, t, s, d, n);
1461
- return _.sizeMeta = h, _.initiated().then(() => {
1462
- _.observeAutoSize({ forceAutoSize: !0 }), n != null && n.hidden || _.show();
1463
- }), _;
1473
+ const I = new Nt(e, t, n, d, s);
1474
+ return I.sizeMeta = h, I.initiated().then(() => {
1475
+ I.observeAutoSize({ forceAutoSize: !0 }), s != null && s.hidden || I.show();
1476
+ }), I;
1464
1477
  }
1465
- if (i.shadowRootMode === fe.none) {
1466
- const l = document.createElement("template");
1467
- l.innerHTML = i.HTML, o = l.content.firstElementChild, zt().then((c) => {
1468
- c.connectedCallback(o, o);
1478
+ if (i.shadowRootMode === ye.none) {
1479
+ const c = document.createElement("template");
1480
+ c.innerHTML = i.HTML, o = c.content.firstElementChild, qt().then((l) => {
1481
+ l.connectedCallback(o, o);
1469
1482
  });
1470
1483
  } else {
1471
- const l = Gs(e.name + t.id);
1472
- et.includes(l) || (js(l, i.HTML, i.shadowRootMode), et.push(l)), o = document.createElement(l);
1484
+ const c = rs(e.name + t.id);
1485
+ ct.includes(c) || (is(c, i.HTML, i.shadowRootMode), ct.push(c)), o = document.createElement(c);
1473
1486
  }
1474
- return s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), o.id = a, n != null && n.hidden && (o.style.opacity = "0", o.style.position = "absolute", o.style.height = "0", o.style.width = "0", o.style.pointerEvents = "none", o.style.visibility = "hidden"), this.appendChild(s, o, n), new Ot(e, t, s, o, n);
1487
+ return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), o.id = a, s != null && s.hidden && (o.style.opacity = "0", o.style.position = "absolute", o.style.height = "0", o.style.width = "0", o.style.pointerEvents = "none", o.style.visibility = "hidden"), this.appendChild(n, o, s), new Wt(e, t, n, o, s);
1475
1488
  }));
1476
1489
  }
1477
1490
  /**
1478
1491
  * Detect if HTML is a Myop Web Component (starts with marker comment)
1479
1492
  */
1480
1493
  isMyopWebComponent(e) {
1481
- return e.trimStart().startsWith(Ks);
1494
+ return e.trimStart().startsWith(ts);
1482
1495
  }
1483
1496
  /**
1484
1497
  * Extract the web component script content from HTML
1485
1498
  */
1486
1499
  extractWebComponentScript(e) {
1487
- const n = new DOMParser().parseFromString(e, "text/html").getElementById(Us);
1488
- return (n == null ? void 0 : n.textContent) || null;
1500
+ const s = new DOMParser().parseFromString(e, "text/html").getElementById(ns);
1501
+ return (s == null ? void 0 : s.textContent) || null;
1489
1502
  }
1490
1503
  /**
1491
1504
  * Execute the web component script on the host document
1492
1505
  */
1493
1506
  executeWebComponentScript(e, t) {
1494
- if (Ze.has(t)) {
1507
+ if (at.has(t)) {
1495
1508
  console.log(`[MyopWebComponent] Script already executed for ${t}, skipping`);
1496
1509
  return;
1497
1510
  }
1498
- const s = document.createElement("script");
1499
- s.textContent = e, s.id = `myop-extracted-${t}`, document.head.appendChild(s), Ze.add(t), console.log(`[MyopWebComponent] Executed web component script: ${t}`);
1511
+ const n = document.createElement("script");
1512
+ n.textContent = e, n.id = `myop-extracted-${t}`, document.head.appendChild(n), at.add(t), console.log(`[MyopWebComponent] Executed web component script: ${t}`);
1500
1513
  }
1501
1514
  /**
1502
1515
  * Load a Myop Web Component (extracted and run on host document)
1503
1516
  */
1504
- loadExtractedWebComponent(e, t, s, n, i) {
1517
+ loadExtractedWebComponent(e, t, n, s, i) {
1505
1518
  return v(this, null, function* () {
1506
- const a = this.extractWebComponentScript(n);
1519
+ const a = this.extractWebComponentScript(s);
1507
1520
  if (!a)
1508
1521
  throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');
1509
- const o = `${e.id}-${t.id}`, l = window.__MYOP_TAG_NAME__;
1522
+ const o = `${e.id}-${t.id}`, c = window.__MYOP_TAG_NAME__;
1510
1523
  this.executeWebComponentScript(a, o);
1511
- const c = window.__MYOP_TAG_NAME__;
1512
- if (!c)
1524
+ const l = window.__MYOP_TAG_NAME__;
1525
+ if (!l)
1513
1526
  throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");
1514
- l && l !== c && console.warn(`[MyopWebComponent] __MYOP_TAG_NAME__ changed from ${l} to ${c}`);
1515
- const d = `myop-comp-${te()}`, u = document.createElement(c);
1516
- 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"), s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), this.appendChild(s, u, i);
1517
- const h = new Fe(
1527
+ c && c !== l && console.warn(`[MyopWebComponent] __MYOP_TAG_NAME__ changed from ${c} to ${l}`);
1528
+ const d = `myop-comp-${Z()}`, u = document.createElement(l);
1529
+ 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);
1530
+ const h = new qe(
1518
1531
  e,
1519
1532
  t,
1520
- s,
1533
+ n,
1521
1534
  u,
1522
- c,
1535
+ l,
1523
1536
  i
1524
1537
  );
1525
- return (i == null ? void 0 : i.data) !== void 0 && h.initWithData(i.data), console.log(`[MyopWebComponent] Loaded <${c}> into container`), h;
1538
+ return (i == null ? void 0 : i.data) !== void 0 && h.initWithData(i.data), console.log(`[MyopWebComponent] Loaded <${l}> into container`), h;
1526
1539
  });
1527
1540
  }
1528
- }, Js = (e) => ({
1541
+ }, cs = (e) => ({
1529
1542
  instance: {
1530
1543
  id: "auto",
1531
1544
  componentId: e.componentId,
@@ -1547,7 +1560,7 @@ var js = (e, t, s) => {
1547
1560
  name: "myop_init_interface",
1548
1561
  type: "any",
1549
1562
  behavior: {
1550
- type: Ce.code
1563
+ type: Re.code
1551
1564
  }
1552
1565
  },
1553
1566
  {
@@ -1555,7 +1568,7 @@ var js = (e, t, s) => {
1555
1568
  name: "myop_cta_handler",
1556
1569
  type: "any",
1557
1570
  behavior: {
1558
- type: Ce.code
1571
+ type: Re.code
1559
1572
  }
1560
1573
  }
1561
1574
  ],
@@ -1573,20 +1586,20 @@ var js = (e, t, s) => {
1573
1586
  defaultSkin: 0
1574
1587
  },
1575
1588
  name: e.name
1576
- }), Se = "__MYOP_CLOUD_REPOSITORY_MAIN__", Qs = () => {
1589
+ }), De = "__MYOP_CLOUD_REPOSITORY_MAIN__", ls = () => {
1577
1590
  if (typeof window < "u")
1578
- return window[Se];
1591
+ return window[De];
1579
1592
  if (typeof globalThis < "u")
1580
- return globalThis[Se];
1581
- }, Xs = (e) => {
1582
- typeof window < "u" && (window[Se] = e), typeof globalThis < "u" && (globalThis[Se] = e);
1583
- }, Ft = class ie {
1593
+ return globalThis[De];
1594
+ }, ds = (e) => {
1595
+ typeof window < "u" && (window[De] = e), typeof globalThis < "u" && (globalThis[De] = e);
1596
+ }, jt = class ie {
1584
1597
  constructor(t = "https://cloud.myop.dev") {
1585
1598
  this._baseUrl = t, r(this, "variants", {}), r(this, "preloadedComponents", {}), r(this, "userFlows", {}), r(this, "_defaultEnv", "production"), r(this, "_envExplicitlySet", !1);
1586
1599
  }
1587
1600
  static get Main() {
1588
- const t = Qs();
1589
- return t || (ie._main || (ie._main = new ie(), Xs(ie._main)), ie._main);
1601
+ const t = ls();
1602
+ return t || (ie._main || (ie._main = new ie(), ds(ie._main)), ie._main);
1590
1603
  }
1591
1604
  /**
1592
1605
  * Set the default environment for this CloudRepository instance
@@ -1605,8 +1618,8 @@ var js = (e, t, s) => {
1605
1618
  * Check if a component is already cached/preloaded (v2)
1606
1619
  * If env and preview are not provided, checks if ANY version is preloaded
1607
1620
  */
1608
- isPreloaded(t, s, n) {
1609
- return s !== void 0 || n !== void 0 ? `${t}:${s || this._defaultEnv}:${n ? "preview" : "live"}` in this.variants : t in this.preloadedComponents;
1621
+ isPreloaded(t, n, s) {
1622
+ return n !== void 0 || s !== void 0 ? `${t}:${n || this._defaultEnv}:${s ? "preview" : "live"}` in this.variants : t in this.preloadedComponents;
1610
1623
  }
1611
1624
  /**
1612
1625
  * Get the preloaded params for a component (if preloaded)
@@ -1619,67 +1632,67 @@ var js = (e, t, s) => {
1619
1632
  * Fetch a v2 component config
1620
1633
  * If env/preview not specified and component was preloaded, uses preloaded params
1621
1634
  */
1622
- fetchComponentV2(t, s, n) {
1635
+ fetchComponentV2(t, n, s) {
1623
1636
  return v(this, null, function* () {
1624
- const i = this.preloadedComponents[t], a = s !== void 0 || n !== void 0;
1625
- let o, l;
1637
+ const i = this.preloadedComponents[t], a = n !== void 0 || s !== void 0;
1638
+ let o, c;
1626
1639
  if (!a && i)
1627
- o = i.env, l = i.preview;
1640
+ o = i.env, c = i.preview;
1628
1641
  else {
1629
- o = s || this._defaultEnv;
1630
- const d = s || this._envExplicitlySet;
1631
- l = n === !0 ? !0 : n === !1 ? !1 : !d;
1642
+ o = n || this._defaultEnv;
1643
+ const d = n || this._envExplicitlySet;
1644
+ c = s === !0 ? !0 : s === !1 ? !1 : !d;
1632
1645
  }
1633
- const c = `${t}:${o}:${l ? "preview" : "live"}`;
1646
+ const l = `${t}:${o}:${c ? "preview" : "live"}`;
1634
1647
  return console.log("[CloudRepository] fetchComponentV2", {
1635
1648
  componentId: t.slice(0, 8) + "...",
1636
1649
  env: o,
1637
- usePreview: l,
1638
- cacheKey: c,
1639
- cached: c in this.variants
1640
- }), this.variants[c] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: o, preview: l }), this.variants[c] = new Promise(
1650
+ usePreview: c,
1651
+ cacheKey: l,
1652
+ cached: l in this.variants
1653
+ }), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: o, preview: c }), this.variants[l] = new Promise(
1641
1654
  (d, u) => v(this, null, function* () {
1642
1655
  try {
1643
1656
  let h = `${this._baseUrl}/consume?id=${t}&env=${o}`;
1644
- l && (h += "&preview=true");
1645
- const m = (yield (yield fetch(h)).json()).item;
1646
- if (!m) {
1657
+ c && (h += "&preview=true");
1658
+ const f = (yield (yield fetch(h)).json()).item;
1659
+ if (!f) {
1647
1660
  u(new Error(`Component "${t}" not found`));
1648
1661
  return;
1649
1662
  }
1650
- if (!m.consume_variant || !m.consume_variant.length) {
1663
+ if (!f.consume_variant || !f.consume_variant.length) {
1651
1664
  u(new Error(`Component "${t}" has no implementation for environment "${o}"`));
1652
1665
  return;
1653
1666
  }
1654
- const _ = Js(m);
1655
- d(_);
1667
+ const I = cs(f);
1668
+ d(I);
1656
1669
  } catch (h) {
1657
1670
  u(h);
1658
1671
  }
1659
1672
  })
1660
- )), yield this.variants[c];
1673
+ )), yield this.variants[l];
1661
1674
  });
1662
1675
  }
1663
1676
  // ============ V1 Methods (Legacy) ============
1664
1677
  /**
1665
1678
  * Fetch a v1 component from a flow
1666
1679
  */
1667
- fetchComponentV1(t, s) {
1680
+ fetchComponentV1(t, n) {
1668
1681
  return v(this, null, function* () {
1669
- return s ? (yield this.fetchFlow(s)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
1682
+ return n ? (yield this.fetchFlow(n)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
1670
1683
  });
1671
1684
  }
1672
1685
  fetchAutoFlow(t) {
1673
1686
  return v(this, null, function* () {
1674
1687
  return this.userFlows[t] || (this.userFlows[t] = new Promise(
1675
- (s, n) => v(this, null, function* () {
1688
+ (n, s) => v(this, null, function* () {
1676
1689
  try {
1677
1690
  const a = yield (yield fetch(
1678
1691
  `${this._baseUrl}/flow?id=${t}&auto=true`
1679
1692
  )).json();
1680
- s(a.item);
1693
+ n(a.item);
1681
1694
  } catch (i) {
1682
- n(i);
1695
+ s(i);
1683
1696
  }
1684
1697
  })
1685
1698
  )), yield this.userFlows[t];
@@ -1688,14 +1701,14 @@ var js = (e, t, s) => {
1688
1701
  fetchFlow(t) {
1689
1702
  return v(this, null, function* () {
1690
1703
  return this.userFlows[t] || (this.userFlows[t] = new Promise(
1691
- (s, n) => v(this, null, function* () {
1704
+ (n, s) => v(this, null, function* () {
1692
1705
  try {
1693
1706
  const a = yield (yield fetch(
1694
1707
  `${this._baseUrl}/flow?id=${t}&resolve=components`
1695
1708
  )).json();
1696
- s(a.item);
1709
+ n(a.item);
1697
1710
  } catch (i) {
1698
- n(i);
1711
+ s(i);
1699
1712
  }
1700
1713
  })
1701
1714
  )), yield this.userFlows[t];
@@ -1706,41 +1719,41 @@ var js = (e, t, s) => {
1706
1719
  * @deprecated Use fetchComponentV2 or fetchComponentV1 explicitly
1707
1720
  * Defaults to v1 behavior for backward compatibility with existing code
1708
1721
  */
1709
- fetchComponent(t, s) {
1722
+ fetchComponent(t, n) {
1710
1723
  return v(this, null, function* () {
1711
- return this.fetchComponentV1(t, s);
1724
+ return this.fetchComponentV1(t, n);
1712
1725
  });
1713
1726
  }
1714
1727
  };
1715
- r(Ft, "_main", null);
1716
- var Ne = Ft;
1717
- Ne.Main;
1718
- var Zs = (e) => v(void 0, null, function* () {
1728
+ r(jt, "_main", null);
1729
+ var je = jt;
1730
+ je.Main;
1731
+ var us = (e) => v(void 0, null, function* () {
1719
1732
  try {
1720
- const t = new URL(window.location.href), n = new URLSearchParams(t.search).get("myopOverride");
1721
- if (n) {
1722
- const [i, ...a] = Ye(n);
1733
+ const t = new URL(window.location.href), s = new URLSearchParams(t.search).get("myopOverride");
1734
+ if (s) {
1735
+ const [i, ...a] = st(s);
1723
1736
  switch (i) {
1724
1737
  case "component":
1725
1738
  {
1726
- const [o, l] = a, c = yield Ne.Main.fetchComponent(o);
1727
- if (c && c.type.skins.find((u) => u.id === l))
1728
- return c.instance.skinSelector = {
1729
- type: he.Dedicated,
1739
+ const [o, c] = a, l = yield je.Main.fetchComponent(o);
1740
+ if (l && l.type.skins.find((u) => u.id === c))
1741
+ return l.instance.skinSelector = {
1742
+ type: pe.Dedicated,
1730
1743
  skin: {
1731
- id: l
1744
+ id: c
1732
1745
  }
1733
- }, c;
1746
+ }, l;
1734
1747
  }
1735
1748
  break;
1736
1749
  // case 'flow': {
1737
1750
  default:
1738
1751
  {
1739
- const [o, l] = Ye(n), d = (yield Ne.Main.fetchFlow(o)).components.find((u) => u.type.id === e.type.id);
1740
- if (d && d.instance.skinSelector.type === he.Segmented && d.instance.resolvedExperiences) {
1741
- const u = d.instance.resolvedExperiences.find((h) => h.id === l);
1742
- if ((u == null ? void 0 : u.type) === It.Segment) {
1743
- const h = u, y = d.instance.skinSelector.segments.find((m) => m.segmentId === h.segment.id);
1752
+ const [o, c] = st(s), d = (yield je.Main.fetchFlow(o)).components.find((u) => u.type.id === e.type.id);
1753
+ if (d && d.instance.skinSelector.type === pe.Segmented && d.instance.resolvedExperiences) {
1754
+ const u = d.instance.resolvedExperiences.find((h) => h.id === c);
1755
+ if ((u == null ? void 0 : u.type) === At.Segment) {
1756
+ const h = u, y = d.instance.skinSelector.segments.find((f) => f.segmentId === h.segment.id);
1744
1757
  if (y)
1745
1758
  return d.instance.skinSelector = y == null ? void 0 : y.skinSelector, d;
1746
1759
  }
@@ -1752,52 +1765,52 @@ var Zs = (e) => v(void 0, null, function* () {
1752
1765
  } finally {
1753
1766
  return null;
1754
1767
  }
1755
- }), Nt = "https://cdn.myop.dev/sdk/next/myop_sdk.min.js", Ie = class {
1768
+ }), Vt = "https://cdn.myop.dev/sdk/next/myop_sdk.min.js", Oe = class {
1756
1769
  constructor() {
1757
- r(this, "components2init", []), r(this, "components", []), r(this, "componentsLoaders", []), r(this, "initiated", !1), r(this, "version", Ds), r(this, "type2InstanceCount", {}), r(this, "assignId", (e) => (this.type2InstanceCount[e.id] || (this.type2InstanceCount[e.id] = 0), `${e.id}_${++this.type2InstanceCount[e.id]}`)), r(this, "inspected", !1), r(this, "inspect", () => {
1770
+ r(this, "components2init", []), r(this, "components", []), r(this, "componentsLoaders", []), r(this, "initiated", !1), r(this, "version", Kn), r(this, "type2InstanceCount", {}), r(this, "assignId", (e) => (this.type2InstanceCount[e.id] || (this.type2InstanceCount[e.id] = 0), `${e.id}_${++this.type2InstanceCount[e.id]}`)), r(this, "inspected", !1), r(this, "inspect", () => {
1758
1771
  this.inspected || (this.inspected = !0, this.components.forEach((e) => {
1759
1772
  e.inspect && e.inspect();
1760
1773
  }));
1761
1774
  }), r(this, "incomingMessageHandler", (e) => {
1762
1775
  if (e.origin, document.location.origin, e.data.myop) {
1763
- if (e.data.direction !== z.up && e.data.messageType !== w.EnvelopedMessage)
1776
+ if (e.data.direction !== P.up && e.data.messageType !== M.EnvelopedMessage)
1764
1777
  return;
1765
1778
  const t = e.data;
1766
- if (t.messageType === w.InitRequest) {
1767
- this.components2init.forEach((n) => {
1768
- n.send(new Be(n.id));
1779
+ if (t.messageType === M.InitRequest) {
1780
+ this.components2init.forEach((s) => {
1781
+ s.send(new Ve(s.id));
1769
1782
  });
1770
1783
  return;
1771
1784
  }
1772
- if (t.messageType === w.InitResponse) {
1785
+ if (t.messageType === M.InitResponse) {
1773
1786
  this.components2init = this.components2init.filter((i) => i.id !== t.content.id);
1774
- const n = this.components.find((i) => {
1787
+ const s = this.components.find((i) => {
1775
1788
  var a;
1776
1789
  return i.id === ((a = t.content) == null ? void 0 : a.id);
1777
1790
  });
1778
- n == null || n.setInitiated();
1791
+ s == null || s.setInitiated();
1779
1792
  return;
1780
1793
  }
1781
- if (t.messageType === w.EnvelopedMessage) {
1782
- const n = t, i = this.components.find((a) => a.id === n.destination);
1794
+ if (t.messageType === M.EnvelopedMessage) {
1795
+ const s = t, i = this.components.find((a) => a.id === s.destination);
1783
1796
  if (i) {
1784
- if (n.direction === z.down) {
1785
- n.message.messageType === j.name ? i.onMessageReceived(n.message) : (n.message.route = n.route, i.send(n.message));
1797
+ if (s.direction === P.down) {
1798
+ s.message.messageType === q.name ? i.onMessageReceived(s.message) : (s.message.route = s.route, i.send(s.message));
1786
1799
  return;
1787
1800
  }
1788
1801
  } else {
1789
- const a = this.components.find((o) => o.id === n.message.destination);
1790
- a && a.send(n.message);
1802
+ const a = this.components.find((o) => o.id === s.message.destination);
1803
+ a && a.send(s.message);
1791
1804
  }
1792
1805
  return;
1793
1806
  }
1794
- const s = this.components.find((n) => n.id === t.destination);
1795
- if (!s) {
1807
+ const n = this.components.find((s) => s.id === t.destination);
1808
+ if (!n) {
1796
1809
  window.myop.IframeSDK && window.myop.IframeSDK.messageToHost(t);
1797
1810
  return;
1798
1811
  }
1799
- if (s) {
1800
- if (s.onMessageReceived(t))
1812
+ if (n) {
1813
+ if (n.onMessageReceived(t))
1801
1814
  return;
1802
1815
  window.myop.IframeSDK && window.myop.IframeSDK.messageToHost(t);
1803
1816
  }
@@ -1812,54 +1825,54 @@ var Zs = (e) => v(void 0, null, function* () {
1812
1825
  if (this.initiated)
1813
1826
  throw new Error("hostSDK already initiated");
1814
1827
  const t = [
1815
- new Rs(),
1816
- new Hs(),
1817
- new Ys()
1828
+ new $n(),
1829
+ new Wn(),
1830
+ new as()
1818
1831
  ];
1819
1832
  if (this.componentsLoaders = [
1820
1833
  ...t
1821
1834
  ], e) {
1822
- const s = {};
1823
- e.forEach((n) => {
1824
- const i = new n(this.componentsLoaders);
1825
- s[i.type] = i;
1826
- }), this.componentsLoaders.forEach((n) => {
1827
- s[n.type] || (s[n.type] = n);
1828
- }), this.componentsLoaders = Object.values(s);
1835
+ const n = {};
1836
+ e.forEach((s) => {
1837
+ const i = new s(this.componentsLoaders);
1838
+ n[i.type] = i;
1839
+ }), this.componentsLoaders.forEach((s) => {
1840
+ n[s.type] || (n[s.type] = s);
1841
+ }), this.componentsLoaders = Object.values(n);
1829
1842
  }
1830
1843
  window.addEventListener(
1831
1844
  "message",
1832
1845
  this.incomingMessageHandler,
1833
1846
  !1
1834
1847
  ), console.log("myop hostSDK initiated", document.location.href), this.initiated = !0;
1835
- }), r(this, "_getSkinIdBySkinSelector", (e, ...t) => v(this, [e, ...t], function* (s, n = [], i) {
1848
+ }), r(this, "_getSkinIdBySkinSelector", (e, ...t) => v(this, [e, ...t], function* (n, s = [], i) {
1836
1849
  var a;
1837
- function o(l, c) {
1850
+ function o(c, l) {
1838
1851
  return v(this, null, function* () {
1839
- for (const d of l)
1840
- if (yield c(d))
1852
+ for (const d of c)
1853
+ if (yield l(d))
1841
1854
  return d;
1842
1855
  });
1843
1856
  }
1844
- switch (s.type) {
1857
+ switch (n.type) {
1845
1858
  // @ts-ignore
1846
1859
  case "DedicatedSkin":
1847
1860
  //backward compatibility
1848
- case he.Dedicated:
1849
- return ((a = s.skin) == null ? void 0 : a.id) || s.skins[0].id;
1850
- case he.Segmented:
1861
+ case pe.Dedicated:
1862
+ return ((a = n.skin) == null ? void 0 : a.id) || n.skins[0].id;
1863
+ case pe.Segmented:
1851
1864
  {
1852
- const c = yield o(s.segments, (d) => v(this, null, function* () {
1865
+ const l = yield o(n.segments, (d) => v(this, null, function* () {
1853
1866
  if (d.segmentId === "Default")
1854
1867
  return !0;
1855
- const u = n.find((m) => m.type === It.Segment ? m.segment.id === d.segmentId : !1);
1868
+ const u = s.find((f) => f.type === At.Segment ? f.segment.id === d.segmentId : !1);
1856
1869
  if (!u)
1857
1870
  throw new Error("experience not found");
1858
- const f = u.segment, y = (i || {})[f.function];
1859
- return y ? yield y() : (console.warn(`segmentId:${d.segmentId}, ${f.function} function not provided !`), !1);
1871
+ const m = u.segment, y = (i || {})[m.function];
1872
+ return y ? yield y() : (console.warn(`segmentId:${d.segmentId}, ${m.function} function not provided !`), !1);
1860
1873
  }));
1861
- if (c)
1862
- return this._getSkinIdBySkinSelector(c.skinSelector, n);
1874
+ if (l)
1875
+ return this._getSkinIdBySkinSelector(l.skinSelector, s);
1863
1876
  debugger;
1864
1877
  }
1865
1878
  break;
@@ -1868,103 +1881,103 @@ var Zs = (e) => v(void 0, null, function* () {
1868
1881
  }
1869
1882
  return "";
1870
1883
  })), r(this, "runSkinSelector", (e, t) => v(this, null, function* () {
1871
- const s = yield this._getSkinIdBySkinSelector(e.instance.skinSelector, e.instance.resolvedExperiences, t);
1872
- return e.type.skins.find((n) => n.id === s);
1873
- })), r(this, "loaderHooks"), r(this, "loadComponent", (e, t, s) => v(this, null, function* () {
1874
- var n, i, a, o;
1884
+ const n = yield this._getSkinIdBySkinSelector(e.instance.skinSelector, e.instance.resolvedExperiences, t);
1885
+ return e.type.skins.find((s) => s.id === n);
1886
+ })), r(this, "loaderHooks"), r(this, "loadComponent", (e, t, n) => v(this, null, function* () {
1887
+ var s, i, a, o;
1875
1888
  if (!t) {
1876
1889
  debugger;
1877
1890
  throw new Error("no container was found for this component");
1878
1891
  }
1879
- const l = yield Zs(e);
1880
- l && (e = l);
1881
- const c = E(E({}, (n = this.loaderHooks) != null ? n : {}), (i = s == null ? void 0 : s.hooks) != null ? i : {}), d = t;
1892
+ const c = yield us(e);
1893
+ c && (e = c);
1894
+ const l = S(S({}, (s = this.loaderHooks) != null ? s : {}), (i = n == null ? void 0 : n.hooks) != null ? i : {}), d = t;
1882
1895
  if (d.myop)
1883
1896
  if (d.component) {
1884
- e = E({}, e), e.instance = E({}, e.instance);
1885
- let y = yield this.runSkinSelector(e, c);
1897
+ e = S({}, e), e.instance = S({}, e.instance);
1898
+ let y = yield this.runSkinSelector(e, l);
1886
1899
  if (!y)
1887
1900
  throw new Error("runSkinSelector failed to choose skin, check the provided config");
1888
- return (a = s == null ? void 0 : s.hooks) != null && a.afterSkinSelected && (y = yield s.hooks.afterSkinSelected(E({}, y))), e.instance.skinSelector = {
1889
- type: he.Dedicated,
1901
+ return (a = n == null ? void 0 : n.hooks) != null && a.afterSkinSelected && (y = yield n.hooks.afterSkinSelected(S({}, y))), e.instance.skinSelector = {
1902
+ type: pe.Dedicated,
1890
1903
  skin: y
1891
1904
  // skins: [selectedSkin]
1892
- }, s && (s = E({}, s), delete s.hooks), yield Ht(d, e, this.components, s);
1905
+ }, n && (n = S({}, n), delete n.hooks), yield Ft(d, e, this.components, n);
1893
1906
  } else
1894
1907
  throw new Error("load component got a detached ref.");
1895
1908
  t = t;
1896
- let u = yield this.runSkinSelector(e, c);
1909
+ let u = yield this.runSkinSelector(e, l);
1897
1910
  if (!u)
1898
1911
  throw new Error("runSkinSelector failed to choose skin, check the provided config");
1899
- (o = s == null ? void 0 : s.hooks) != null && o.afterSkinSelected && (u = yield s.hooks.afterSkinSelected(E({}, u)));
1912
+ (o = n == null ? void 0 : n.hooks) != null && o.afterSkinSelected && (u = yield n.hooks.afterSkinSelected(S({}, u)));
1900
1913
  const h = this.componentsLoaders.find((y) => y.type === u.loader.type);
1901
1914
  if (!h) {
1902
1915
  debugger;
1903
1916
  throw new Error(`no loader "${u.loader.type}" was found for component`);
1904
1917
  }
1905
- let f = yield h.load(e.type, u, t, s);
1906
- 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), (!s || s.connectProps !== !1) && (f = xs(f, e.type.props, u));
1918
+ let m = yield h.load(e.type, u, t, n);
1919
+ m.isInitiated || this.components2init.push(m), m.bind("onDispose", () => (this.components = this.components.filter((y) => y !== m), this.components2init = this.components2init.filter((y) => y !== m), !0)), this.components.push(m), (!n || n.connectProps !== !1) && (m = Fn(m, e.type.props, u));
1907
1920
  try {
1908
- yield Dt(f, e, this.components);
1921
+ yield Bt(m, e, this.components);
1909
1922
  } catch (y) {
1910
1923
  throw y;
1911
1924
  }
1912
- return s != null && s.skipInit || (yield f.initiated()), f;
1913
- })), r(this, "navigate", (e, t, s) => v(this, null, function* () {
1925
+ return n != null && n.skipInit || (yield m.initiated()), m;
1926
+ })), r(this, "navigate", (e, t, n) => v(this, null, function* () {
1914
1927
  if (e.parent)
1915
1928
  throw new Error("Navigating on remote ref components is not implemented yet");
1916
- if (s != null && s.staged) {
1917
- let n = yield this.loadComponent(t, e.container, E({
1929
+ if (n != null && n.staged) {
1930
+ let s = yield this.loadComponent(t, e.container, S({
1918
1931
  hidden: !0,
1919
1932
  relative: { direction: "after", child: e.element }
1920
- }, s));
1921
- return s.init && (yield s.init(n)), n.show(), e.dispose(), n;
1933
+ }, n));
1934
+ return n.init && (yield n.init(s)), s.show(), e.dispose(), s;
1922
1935
  } else {
1923
- const n = e.element.nextSibling;
1924
- return e.dispose(), this.loadComponent(t, e.container, E({
1936
+ const s = e.element.nextSibling;
1937
+ return e.dispose(), this.loadComponent(t, e.container, S({
1925
1938
  relative: {
1926
1939
  direction: "before",
1927
- child: n
1940
+ child: s
1928
1941
  }
1929
- }, s));
1942
+ }, n));
1930
1943
  }
1931
1944
  }));
1932
1945
  }
1933
1946
  };
1934
- r(Ie, "Instance", () => window.myop.hostSDK);
1947
+ r(Oe, "Instance", () => window.myop.hostSDK);
1935
1948
  window.myop || (window.myop = {
1936
- __ROOT_SDK_PUBLIC_URL__: Nt
1949
+ __ROOT_SDK_PUBLIC_URL__: Vt
1937
1950
  });
1938
1951
  if (!window.myop.hostSDK) {
1939
- const e = new Ie();
1952
+ const e = new Oe();
1940
1953
  e.init(), window.myop || (window.myop = {
1941
- __ROOT_SDK_PUBLIC_URL__: Nt
1954
+ __ROOT_SDK_PUBLIC_URL__: Vt
1942
1955
  }), window.myop.hostSDK = e;
1943
1956
  }
1944
- var Ue = window.myop.hostSDK;
1945
- ot("hostSDK", Ue);
1946
- var en = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", tn = "linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)", sn = {
1957
+ var Qe = window.myop.hostSDK;
1958
+ pt("hostSDK", Qe);
1959
+ var hs = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", ps = "linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)", ms = {
1947
1960
  position: "absolute",
1948
1961
  top: 0,
1949
1962
  left: 0,
1950
1963
  right: 0,
1951
1964
  bottom: 0,
1952
1965
  zIndex: 1,
1953
- background: en,
1966
+ background: hs,
1954
1967
  display: "flex",
1955
1968
  justifyContent: "center",
1956
1969
  alignItems: "center"
1957
- }, nn = {
1970
+ }, fs = {
1958
1971
  position: "absolute",
1959
1972
  top: 0,
1960
1973
  left: 0,
1961
1974
  right: 0,
1962
1975
  bottom: 0,
1963
- background: tn,
1976
+ background: ps,
1964
1977
  display: "flex",
1965
1978
  justifyContent: "center",
1966
1979
  alignItems: "center"
1967
- }, on = {
1980
+ }, ys = {
1968
1981
  position: "absolute",
1969
1982
  top: 0,
1970
1983
  left: 0,
@@ -1974,27 +1987,27 @@ var en = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", tn =
1974
1987
  display: "flex",
1975
1988
  justifyContent: "center",
1976
1989
  alignItems: "center"
1977
- }, rn = Object.defineProperty, an = (e, t, s) => t in e ? rn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, p = (e, t, s) => an(e, typeof t != "symbol" ? t + "" : t, s), N = (e, t, s) => new Promise((n, i) => {
1978
- var a = (c) => {
1990
+ }, gs = Object.defineProperty, vs = (e, t, n) => t in e ? gs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, p = (e, t, n) => vs(e, typeof t != "symbol" ? t + "" : t, n), B = (e, t, n) => new Promise((s, i) => {
1991
+ var a = (l) => {
1979
1992
  try {
1980
- l(s.next(c));
1993
+ c(n.next(l));
1981
1994
  } catch (d) {
1982
1995
  i(d);
1983
1996
  }
1984
- }, o = (c) => {
1997
+ }, o = (l) => {
1985
1998
  try {
1986
- l(s.throw(c));
1999
+ c(n.throw(l));
1987
2000
  } catch (d) {
1988
2001
  i(d);
1989
2002
  }
1990
- }, l = (c) => c.done ? n(c.value) : Promise.resolve(c.value).then(a, o);
1991
- l((s = s.apply(e, t)).next());
1992
- }), G = () => "10000000-1000-4000-8000-100000000000".replace(
2003
+ }, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(a, o);
2004
+ c((n = n.apply(e, t)).next());
2005
+ }), V = () => "10000000-1000-4000-8000-100000000000".replace(
1993
2006
  /[018]/g,
1994
2007
  (e) => (+e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +e / 4).toString(16)
1995
- ), ln = class {
2008
+ ), ws = class {
1996
2009
  constructor() {
1997
- p(this, "id", G()), 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);
2010
+ p(this, "id", V()), 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);
1998
2011
  }
1999
2012
  static create(...e) {
2000
2013
  return new this(...e);
@@ -2002,36 +2015,36 @@ var en = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", tn =
2002
2015
  isTypeof(e) {
2003
2016
  return e.messageType === this.messageType;
2004
2017
  }
2005
- }, cn = class extends ln {
2018
+ }, _s = class extends ws {
2006
2019
  constructor(e) {
2007
- super(), this.handler = e, p(this, "handlerUniqueId", G());
2020
+ super(), this.handler = e, p(this, "handlerUniqueId", V());
2008
2021
  }
2009
- }, dn = "ExecuteScriptReplyMessage", un = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, hn = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, pn = (e) => {
2010
- let t = e.match(un);
2022
+ }, Ms = "ExecuteScriptReplyMessage", bs = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, Es = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, Cs = (e) => {
2023
+ let t = e.match(bs);
2011
2024
  if (t)
2012
2025
  return t[1] || t[3];
2013
2026
  {
2014
- let s = e.match(hn);
2015
- if (s)
2016
- return s[1].trim();
2027
+ let n = e.match(Es);
2028
+ if (n)
2029
+ return n[1].trim();
2017
2030
  }
2018
- }, Bt = class extends cn {
2031
+ }, Gt = class extends _s {
2019
2032
  constructor(e, t = () => {
2020
- }, s) {
2021
- super(t), this.scriptInputs = s, p(this, "replyMessageKey", dn), p(this, "messageType", "ExecuteScriptMessage"), p(this, "script", ""), this.script = e.toString(), this.content = e.toString(), this.content = pn(this.content);
2033
+ }, n) {
2034
+ super(t), this.scriptInputs = n, p(this, "replyMessageKey", Ms), p(this, "messageType", "ExecuteScriptMessage"), p(this, "script", ""), this.script = e.toString(), this.content = e.toString(), this.content = Cs(this.content);
2022
2035
  }
2023
2036
  };
2024
- p(Bt, "replierKey", "send");
2025
- p(Bt, "completeStreamKey", "completeStream");
2026
- var tt = class {
2037
+ p(Gt, "replierKey", "send");
2038
+ p(Gt, "completeStreamKey", "completeStream");
2039
+ var lt = class {
2027
2040
  constructor() {
2028
- p(this, "_runTimeInstanceId", "runtime-instance-id-" + G()), p(this, "_runTimeId", "runtime-id-" + G()), p(this, "_runTimeName", "runtime-name-" + G()), 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);
2041
+ p(this, "_runTimeInstanceId", "runtime-instance-id-" + V()), p(this, "_runTimeId", "runtime-id-" + V()), p(this, "_runTimeName", "runtime-name-" + V()), 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);
2029
2042
  }
2030
2043
  };
2031
- p(tt, "create", () => new tt());
2032
- var st = class {
2044
+ p(lt, "create", () => new lt());
2045
+ var dt = class {
2033
2046
  constructor() {
2034
- p(this, "_runTimeInstanceId", "runtime-instance-id-" + G()), p(this, "_runTimeId", "runtime-id-" + G()), p(this, "_runTimeName", "runtime-name-" + G()), p(this, "instance", {
2047
+ p(this, "_runTimeInstanceId", "runtime-instance-id-" + V()), p(this, "_runTimeId", "runtime-id-" + V()), p(this, "_runTimeName", "runtime-name-" + V()), p(this, "instance", {
2035
2048
  id: this._runTimeInstanceId,
2036
2049
  componentId: this._runTimeId,
2037
2050
  componentName: this._runTimeName,
@@ -2050,7 +2063,7 @@ var st = class {
2050
2063
  id: t.id
2051
2064
  }
2052
2065
  }, this)), p(this, "withRef", (t) => (this.type.refs.push(t), this)), p(this, "withBasicRef", (t) => {
2053
- const s = {
2066
+ const n = {
2054
2067
  id: "",
2055
2068
  name: t,
2056
2069
  description: "",
@@ -2060,14 +2073,14 @@ var st = class {
2060
2073
  type: "code"
2061
2074
  }
2062
2075
  };
2063
- return this.type.refs.push(s), this;
2076
+ return this.type.refs.push(n), this;
2064
2077
  }), p(this, "build", () => JSON.parse(JSON.stringify(this)));
2065
2078
  }
2066
2079
  };
2067
- p(st, "create", () => new st());
2068
- var nt = {
2080
+ p(dt, "create", () => new dt());
2081
+ var ut = {
2069
2082
  code: "code"
2070
- }, mn = (e) => ({
2083
+ }, Ss = (e) => ({
2071
2084
  instance: {
2072
2085
  id: "auto",
2073
2086
  componentId: e.componentId,
@@ -2089,7 +2102,7 @@ var nt = {
2089
2102
  name: "myop_init_interface",
2090
2103
  type: "any",
2091
2104
  behavior: {
2092
- type: nt.code
2105
+ type: ut.code
2093
2106
  }
2094
2107
  },
2095
2108
  {
@@ -2097,7 +2110,7 @@ var nt = {
2097
2110
  name: "myop_cta_handler",
2098
2111
  type: "any",
2099
2112
  behavior: {
2100
- type: nt.code
2113
+ type: ut.code
2101
2114
  }
2102
2115
  }
2103
2116
  ],
@@ -2115,20 +2128,20 @@ var nt = {
2115
2128
  defaultSkin: 0
2116
2129
  },
2117
2130
  name: e.name
2118
- }), xe = "__MYOP_CLOUD_REPOSITORY_MAIN__", fn = () => {
2131
+ }), ke = "__MYOP_CLOUD_REPOSITORY_MAIN__", xs = () => {
2119
2132
  if (typeof window < "u")
2120
- return window[xe];
2133
+ return window[ke];
2121
2134
  if (typeof globalThis < "u")
2122
- return globalThis[xe];
2123
- }, yn = (e) => {
2124
- typeof window < "u" && (window[xe] = e), typeof globalThis < "u" && (globalThis[xe] = e);
2125
- }, $t = class oe {
2135
+ return globalThis[ke];
2136
+ }, Ts = (e) => {
2137
+ typeof window < "u" && (window[ke] = e), typeof globalThis < "u" && (globalThis[ke] = e);
2138
+ }, Yt = class oe {
2126
2139
  constructor(t = "https://cloud.myop.dev") {
2127
2140
  this._baseUrl = t, p(this, "variants", {}), p(this, "preloadedComponents", {}), p(this, "userFlows", {}), p(this, "_defaultEnv", "production"), p(this, "_envExplicitlySet", !1);
2128
2141
  }
2129
2142
  static get Main() {
2130
- const t = fn();
2131
- return t || (oe._main || (oe._main = new oe(), yn(oe._main)), oe._main);
2143
+ const t = xs();
2144
+ return t || (oe._main || (oe._main = new oe(), Ts(oe._main)), oe._main);
2132
2145
  }
2133
2146
  /**
2134
2147
  * Set the default environment for this CloudRepository instance
@@ -2147,8 +2160,8 @@ var nt = {
2147
2160
  * Check if a component is already cached/preloaded (v2)
2148
2161
  * If env and preview are not provided, checks if ANY version is preloaded
2149
2162
  */
2150
- isPreloaded(t, s, n) {
2151
- return s !== void 0 || n !== void 0 ? `${t}:${s || this._defaultEnv}:${n ? "preview" : "live"}` in this.variants : t in this.preloadedComponents;
2163
+ isPreloaded(t, n, s) {
2164
+ return n !== void 0 || s !== void 0 ? `${t}:${n || this._defaultEnv}:${s ? "preview" : "live"}` in this.variants : t in this.preloadedComponents;
2152
2165
  }
2153
2166
  /**
2154
2167
  * Get the preloaded params for a component (if preloaded)
@@ -2161,83 +2174,83 @@ var nt = {
2161
2174
  * Fetch a v2 component config
2162
2175
  * If env/preview not specified and component was preloaded, uses preloaded params
2163
2176
  */
2164
- fetchComponentV2(t, s, n) {
2165
- return N(this, null, function* () {
2166
- const i = this.preloadedComponents[t], a = s !== void 0 || n !== void 0;
2167
- let o, l;
2177
+ fetchComponentV2(t, n, s) {
2178
+ return B(this, null, function* () {
2179
+ const i = this.preloadedComponents[t], a = n !== void 0 || s !== void 0;
2180
+ let o, c;
2168
2181
  if (!a && i)
2169
- o = i.env, l = i.preview;
2182
+ o = i.env, c = i.preview;
2170
2183
  else {
2171
- o = s || this._defaultEnv;
2172
- const d = s || this._envExplicitlySet;
2173
- l = n === !0 ? !0 : n === !1 ? !1 : !d;
2184
+ o = n || this._defaultEnv;
2185
+ const d = n || this._envExplicitlySet;
2186
+ c = s === !0 ? !0 : s === !1 ? !1 : !d;
2174
2187
  }
2175
- const c = `${t}:${o}:${l ? "preview" : "live"}`;
2188
+ const l = `${t}:${o}:${c ? "preview" : "live"}`;
2176
2189
  return console.log("[CloudRepository] fetchComponentV2", {
2177
2190
  componentId: t.slice(0, 8) + "...",
2178
2191
  env: o,
2179
- usePreview: l,
2180
- cacheKey: c,
2181
- cached: c in this.variants
2182
- }), this.variants[c] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: o, preview: l }), this.variants[c] = new Promise(
2183
- (d, u) => N(this, null, function* () {
2192
+ usePreview: c,
2193
+ cacheKey: l,
2194
+ cached: l in this.variants
2195
+ }), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: o, preview: c }), this.variants[l] = new Promise(
2196
+ (d, u) => B(this, null, function* () {
2184
2197
  try {
2185
2198
  let h = `${this._baseUrl}/consume?id=${t}&env=${o}`;
2186
- l && (h += "&preview=true");
2187
- const m = (yield (yield fetch(h)).json()).item;
2188
- if (!m) {
2199
+ c && (h += "&preview=true");
2200
+ const f = (yield (yield fetch(h)).json()).item;
2201
+ if (!f) {
2189
2202
  u(new Error(`Component "${t}" not found`));
2190
2203
  return;
2191
2204
  }
2192
- if (!m.consume_variant || !m.consume_variant.length) {
2205
+ if (!f.consume_variant || !f.consume_variant.length) {
2193
2206
  u(new Error(`Component "${t}" has no implementation for environment "${o}"`));
2194
2207
  return;
2195
2208
  }
2196
- const _ = mn(m);
2197
- d(_);
2209
+ const I = Ss(f);
2210
+ d(I);
2198
2211
  } catch (h) {
2199
2212
  u(h);
2200
2213
  }
2201
2214
  })
2202
- )), yield this.variants[c];
2215
+ )), yield this.variants[l];
2203
2216
  });
2204
2217
  }
2205
2218
  // ============ V1 Methods (Legacy) ============
2206
2219
  /**
2207
2220
  * Fetch a v1 component from a flow
2208
2221
  */
2209
- fetchComponentV1(t, s) {
2210
- return N(this, null, function* () {
2211
- return s ? (yield this.fetchFlow(s)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
2222
+ fetchComponentV1(t, n) {
2223
+ return B(this, null, function* () {
2224
+ return n ? (yield this.fetchFlow(n)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
2212
2225
  });
2213
2226
  }
2214
2227
  fetchAutoFlow(t) {
2215
- return N(this, null, function* () {
2228
+ return B(this, null, function* () {
2216
2229
  return this.userFlows[t] || (this.userFlows[t] = new Promise(
2217
- (s, n) => N(this, null, function* () {
2230
+ (n, s) => B(this, null, function* () {
2218
2231
  try {
2219
2232
  const a = yield (yield fetch(
2220
2233
  `${this._baseUrl}/flow?id=${t}&auto=true`
2221
2234
  )).json();
2222
- s(a.item);
2235
+ n(a.item);
2223
2236
  } catch (i) {
2224
- n(i);
2237
+ s(i);
2225
2238
  }
2226
2239
  })
2227
2240
  )), yield this.userFlows[t];
2228
2241
  });
2229
2242
  }
2230
2243
  fetchFlow(t) {
2231
- return N(this, null, function* () {
2244
+ return B(this, null, function* () {
2232
2245
  return this.userFlows[t] || (this.userFlows[t] = new Promise(
2233
- (s, n) => N(this, null, function* () {
2246
+ (n, s) => B(this, null, function* () {
2234
2247
  try {
2235
2248
  const a = yield (yield fetch(
2236
2249
  `${this._baseUrl}/flow?id=${t}&resolve=components`
2237
2250
  )).json();
2238
- s(a.item);
2251
+ n(a.item);
2239
2252
  } catch (i) {
2240
- n(i);
2253
+ s(i);
2241
2254
  }
2242
2255
  })
2243
2256
  )), yield this.userFlows[t];
@@ -2248,45 +2261,45 @@ var nt = {
2248
2261
  * @deprecated Use fetchComponentV2 or fetchComponentV1 explicitly
2249
2262
  * Defaults to v1 behavior for backward compatibility with existing code
2250
2263
  */
2251
- fetchComponent(t, s) {
2252
- return N(this, null, function* () {
2253
- return this.fetchComponentV1(t, s);
2264
+ fetchComponent(t, n) {
2265
+ return B(this, null, function* () {
2266
+ return this.fetchComponentV1(t, n);
2254
2267
  });
2255
2268
  }
2256
2269
  };
2257
- p($t, "_main", null);
2258
- var Re = $t, Y = Re.Main, gn = () => Y, vn = (e, t, s) => Y.isPreloaded(e, t, s), Hn = (e) => Y.getPreloadedParams(e), Dn = () => {
2259
- Y = new Re("http://localhost:9292");
2260
- }, kn = (e) => {
2261
- Y = new Re(e);
2262
- }, Ln = (e) => {
2263
- Y = e;
2264
- }, On = (e) => {
2265
- Y.setEnvironment(e);
2266
- }, Pn = (e, t, s) => N(void 0, null, function* () {
2270
+ p(Yt, "_main", null);
2271
+ var Pe = Yt, G = Pe.Main, Is = () => G, Hs = (e, t, n) => G.isPreloaded(e, t, n), $s = (e) => G.getPreloadedParams(e), Ws = () => {
2272
+ G = new Pe("http://localhost:9292");
2273
+ }, Ks = (e) => {
2274
+ G = new Pe(e);
2275
+ }, Us = (e) => {
2276
+ G = e;
2277
+ }, qs = (e) => {
2278
+ G.setEnvironment(e);
2279
+ }, js = (e, t, n) => B(void 0, null, function* () {
2267
2280
  return Promise.allSettled(
2268
- e.map((n) => Y.fetchComponentV2(n, t, s))
2281
+ e.map((s) => G.fetchComponentV2(s, t, n))
2269
2282
  );
2270
2283
  });
2271
- const An = (e) => {
2272
- const t = B(null), s = B(null), n = B(!1), i = B(null);
2273
- return ue(() => {
2284
+ const Vs = (e) => {
2285
+ const t = N(null), n = N(null), s = N(!1), i = N(null);
2286
+ return he(() => {
2274
2287
  let a = !1;
2275
- n.current = !(t != null && t.current);
2276
- const o = async (l) => {
2277
- n.current = !0;
2288
+ s.current = !(t != null && t.current);
2289
+ const o = async (c) => {
2290
+ s.current = !0;
2278
2291
  try {
2279
- const c = await Re.Main.fetchComponent(
2280
- l.componentId,
2281
- l.flowId
2292
+ const l = await Pe.Main.fetchComponent(
2293
+ c.componentId,
2294
+ c.flowId
2282
2295
  );
2283
- s.current = await Ue.loadComponent(
2284
- c,
2296
+ n.current = await Qe.loadComponent(
2297
+ l,
2285
2298
  t.current,
2286
2299
  {
2287
2300
  _environment: {
2288
2301
  // // inputs: { ...attrs, ...props },
2289
- props: { ...l }
2302
+ props: { ...c }
2290
2303
  // slots: slotList,
2291
2304
  // context: instance?.appContext,
2292
2305
  // vueContainerRef: myopContainer,
@@ -2301,19 +2314,19 @@ const An = (e) => {
2301
2314
  // }
2302
2315
  }
2303
2316
  }
2304
- ), a ? s.current && s.current.dispose() : l.onReady && l.onReady(s.current);
2317
+ ), a ? n.current && n.current.dispose() : c.onReady && c.onReady(n.current);
2305
2318
  } catch {
2306
2319
  } finally {
2307
- if (n.current = !1, i.current !== null && !a) {
2308
- const c = i.current;
2309
- i.current = null, await o(c);
2320
+ if (s.current = !1, i.current !== null && !a) {
2321
+ const l = i.current;
2322
+ i.current = null, await o(l);
2310
2323
  }
2311
2324
  }
2312
2325
  };
2313
- return n.current ? i.current = { ...e } : o(e).then(), () => {
2314
- a = !0, s.current && s.current.dispose();
2326
+ return s.current ? i.current = { ...e } : o(e).then(), () => {
2327
+ a = !0, n.current && n.current.dispose();
2315
2328
  };
2316
- }, [e.flowId, e.componentId]), /* @__PURE__ */ R(
2329
+ }, [e.flowId, e.componentId]), /* @__PURE__ */ L(
2317
2330
  "div",
2318
2331
  {
2319
2332
  style: {
@@ -2323,14 +2336,14 @@ const An = (e) => {
2323
2336
  ref: t
2324
2337
  }
2325
2338
  );
2326
- }, Wt = () => /* @__PURE__ */ R(
2339
+ }, Jt = () => /* @__PURE__ */ L(
2327
2340
  "svg",
2328
2341
  {
2329
2342
  width: "80",
2330
2343
  viewBox: "0 0 525 243",
2331
2344
  fill: "none",
2332
2345
  xmlns: "http://www.w3.org/2000/svg",
2333
- children: /* @__PURE__ */ R(
2346
+ children: /* @__PURE__ */ L(
2334
2347
  "path",
2335
2348
  {
2336
2349
  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",
@@ -2338,170 +2351,170 @@ const An = (e) => {
2338
2351
  }
2339
2352
  )
2340
2353
  }
2341
- ), wn = ({
2354
+ ), Rs = ({
2342
2355
  opacity: e = 1,
2343
2356
  fadeDuration: t = 200,
2344
- children: s
2357
+ children: n
2345
2358
  }) => {
2346
- if (s !== void 0) {
2359
+ if (n !== void 0) {
2347
2360
  const i = {
2348
- ...on,
2361
+ ...ys,
2349
2362
  opacity: e,
2350
2363
  transition: `opacity ${t}ms ease-out`
2351
2364
  };
2352
- return /* @__PURE__ */ R("div", { style: i, children: s });
2365
+ return /* @__PURE__ */ L("div", { style: i, children: n });
2353
2366
  }
2354
- const n = {
2355
- ...sn,
2367
+ const s = {
2368
+ ...ms,
2356
2369
  opacity: e,
2357
2370
  transition: `opacity ${t}ms ease-out`
2358
2371
  };
2359
- return /* @__PURE__ */ R("div", { style: n, children: /* @__PURE__ */ R(Wt, {}) });
2360
- }, _n = {
2372
+ return /* @__PURE__ */ L("div", { style: s, children: /* @__PURE__ */ L(Jt, {}) });
2373
+ }, Ds = {
2361
2374
  position: "absolute",
2362
2375
  top: 0,
2363
2376
  left: 0,
2364
2377
  right: 0,
2365
2378
  bottom: 0
2366
- }, Mn = ({ children: e }) => e !== void 0 ? /* @__PURE__ */ R("div", { style: _n, children: e }) : /* @__PURE__ */ R("div", { style: nn, children: /* @__PURE__ */ R(Wt, {}) }), bn = (e) => `on${e.split("-").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("")}`, zn = (e) => {
2367
- var se, ve, we, _e, O, P;
2368
- const t = B(null), s = B(null), n = B(!1), i = B(null), a = e.componentId ? vn(e.componentId) : !1, [o, l] = ne(!a), [c, d] = ne(1), [u, h] = ne(!1), [f, y] = ne(!1), [m, _] = ne(void 0), C = e.autoSize ?? !0, [b, T] = ne({ fillWidth: !1, fillHeight: !1 }), k = B(!1), F = e.fadeDuration ?? 200, J = je(() => {
2379
+ }, ks = ({ children: e }) => e !== void 0 ? /* @__PURE__ */ L("div", { style: Ds, children: e }) : /* @__PURE__ */ L("div", { style: fs, children: /* @__PURE__ */ L(Jt, {}) }), Ls = (e) => `on${e.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("")}`, Gs = (e) => {
2380
+ var ee, we, te, _e, Me, be;
2381
+ const t = N(null), n = N(null), s = N(!1), i = N(null), a = e.componentId ? Hs(e.componentId) : !1, [o, c] = se(!a), [l, d] = se(1), [u, h] = se(!1), [m, y] = se(!1), [f, I] = se(void 0), b = e.autoSize ?? !0, [w, E] = se({ fillWidth: !1, fillHeight: !1 }), O = N(!1), A = e.fadeDuration ?? 200, Y = et(() => {
2369
2382
  d(0), setTimeout(() => {
2370
- l(!1);
2371
- }, F);
2372
- }, [F]), L = je(
2373
- (M) => {
2374
- console.error("[MyopComponent] Error:", M), J(), h(!0), e.onError && e.onError(M);
2383
+ c(!1);
2384
+ }, A);
2385
+ }, [A]), ce = et(
2386
+ (_) => {
2387
+ console.error("[MyopComponent] Error:", _), Y(), h(!0), e.onError && e.onError(_);
2375
2388
  },
2376
- [J, e.onError]
2389
+ [Y, e.onError]
2377
2390
  );
2378
- ue(() => {
2379
- k.current = !1;
2380
- }, [e.componentId]), ue(() => {
2381
- if (f && e.data !== void 0 && s.current) {
2382
- if (!k.current) {
2383
- k.current = !0;
2391
+ he(() => {
2392
+ O.current = !1;
2393
+ }, [e.componentId]), he(() => {
2394
+ if (m && e.data !== void 0 && n.current) {
2395
+ if (!O.current) {
2396
+ O.current = !0;
2384
2397
  return;
2385
2398
  }
2386
- const M = s.current.props.myop_init_interface;
2387
- M && M(e.data);
2399
+ const _ = n.current.props.myop_init_interface;
2400
+ _ && _(e.data);
2388
2401
  }
2389
- }, [e.data, f]), ue(() => {
2390
- var U, S, X, Z, H, D, I;
2391
- if (!f || !((U = s.current) != null && U.observeAutoSize))
2402
+ }, [e.data, m]), he(() => {
2403
+ var R, T, U, z, J, Q, C;
2404
+ if (!m || !((R = n.current) != null && R.observeAutoSize))
2392
2405
  return;
2393
- let M = !0;
2394
- return s.current.observeAutoSize({
2406
+ let _ = !0;
2407
+ return n.current.observeAutoSize({
2395
2408
  // SDK resolves: host props → sizeMeta → defaults (width: "100%", height: auto-size)
2396
- explicitWidth: (S = e.style) == null ? void 0 : S.width,
2397
- explicitHeight: (X = e.style) == null ? void 0 : X.height,
2398
- minWidth: (Z = e.style) == null ? void 0 : Z.minWidth,
2399
- maxWidth: (H = e.style) == null ? void 0 : H.maxWidth,
2400
- minHeight: (D = e.style) == null ? void 0 : D.minHeight,
2401
- maxHeight: (I = e.style) == null ? void 0 : I.maxHeight,
2402
- forceAutoSize: C,
2409
+ explicitWidth: (T = e.style) == null ? void 0 : T.width,
2410
+ explicitHeight: (U = e.style) == null ? void 0 : U.height,
2411
+ minWidth: (z = e.style) == null ? void 0 : z.minWidth,
2412
+ maxWidth: (J = e.style) == null ? void 0 : J.maxWidth,
2413
+ minHeight: (Q = e.style) == null ? void 0 : Q.minHeight,
2414
+ maxHeight: (C = e.style) == null ? void 0 : C.maxHeight,
2415
+ forceAutoSize: b,
2403
2416
  loaderMinHeight: 50,
2404
- onSizeChange: (q) => {
2405
- e.onSizeChange && e.onSizeChange(q) === !1 || (_(q), M && (M = !1, J()));
2417
+ onSizeChange: (D) => {
2418
+ e.onSizeChange && e.onSizeChange(D) === !1 || (I(D), _ && (_ = !1, Y()));
2406
2419
  }
2407
2420
  });
2408
- }, [C, f, e.onSizeChange, (se = e.style) == null ? void 0 : se.width, (ve = e.style) == null ? void 0 : ve.height, (we = e.style) == null ? void 0 : we.minWidth, (_e = e.style) == null ? void 0 : _e.maxWidth, (O = e.style) == null ? void 0 : O.minHeight, (P = e.style) == null ? void 0 : P.maxHeight]), ue(() => {
2409
- let M = !1;
2410
- n.current = !(t != null && t.current);
2411
- const U = async (S) => {
2412
- var X, Z, H, D;
2413
- n.current = !0;
2421
+ }, [b, m, e.onSizeChange, (ee = e.style) == null ? void 0 : ee.width, (we = e.style) == null ? void 0 : we.height, (te = e.style) == null ? void 0 : te.minWidth, (_e = e.style) == null ? void 0 : _e.maxWidth, (Me = e.style) == null ? void 0 : Me.minHeight, (be = e.style) == null ? void 0 : be.maxHeight]), he(() => {
2422
+ let _ = !1;
2423
+ s.current = !(t != null && t.current);
2424
+ const R = async (T) => {
2425
+ var U, z, J, Q;
2426
+ s.current = !0;
2414
2427
  try {
2415
- if (!S.componentId && !S.componentConfig) {
2416
- L("No component configuration provided");
2428
+ if (!T.componentId && !T.componentConfig) {
2429
+ ce("No component configuration provided");
2417
2430
  return;
2418
2431
  }
2419
- const I = await gn().fetchComponentV2(
2420
- S.componentId,
2421
- S.environment,
2422
- S.preview
2423
- ), q = await Ue.loadComponent(
2424
- I,
2432
+ const C = await Is().fetchComponentV2(
2433
+ T.componentId,
2434
+ T.environment,
2435
+ T.preview
2436
+ ), D = await Qe.loadComponent(
2437
+ C,
2425
2438
  t.current,
2426
2439
  {
2427
- data: S.data,
2440
+ data: T.data,
2428
2441
  _environment: {
2429
- props: { ...S }
2442
+ props: { ...T }
2430
2443
  }
2431
2444
  }
2432
2445
  );
2433
- if (M) {
2434
- q.dispose();
2446
+ if (_) {
2447
+ D.dispose();
2435
2448
  return;
2436
2449
  }
2437
- if (s.current = q, await s.current.initiated(), M) {
2438
- s.current && s.current.dispose();
2450
+ if (n.current = D, await n.current.initiated(), _) {
2451
+ n.current && n.current.dispose();
2439
2452
  return;
2440
2453
  }
2441
- if (await new Promise((ee) => requestAnimationFrame(ee)), M || !s.current || s.current.markedForDisposed) {
2442
- s.current && !s.current.markedForDisposed && s.current.dispose();
2454
+ if (await new Promise((X) => requestAnimationFrame(X)), _ || !n.current || n.current.markedForDisposed) {
2455
+ n.current && !n.current.markedForDisposed && n.current.dispose();
2443
2456
  return;
2444
2457
  }
2445
2458
  y(!0);
2446
- const A = (X = s.current) == null ? void 0 : X.sizeMeta, ce = (A == null ? void 0 : A.width) === "100%", Me = (A == null ? void 0 : A.height) === "100%";
2447
- T({ fillWidth: ce, fillHeight: Me });
2448
- const De = (ce || ((Z = e.style) == null ? void 0 : Z.width)) && (Me || ((H = e.style) == null ? void 0 : H.height));
2449
- (!C || De) && J(), (D = s.current) != null && D.props && (s.current.props.myop_cta_handler = (ee, de) => {
2450
- e.on && e.on(ee, de);
2451
- const Kt = bn(ee), qe = e[Kt];
2452
- typeof qe == "function" && qe(de);
2453
- }), S.onLoad && s.current && S.onLoad(s.current);
2454
- } catch (I) {
2455
- M || L((I == null ? void 0 : I.message) || "Unknown error");
2459
+ const F = (U = n.current) == null ? void 0 : U.sizeMeta, k = (F == null ? void 0 : F.width) === "100%", Ee = (F == null ? void 0 : F.height) === "100%";
2460
+ E({ fillWidth: k, fillHeight: Ee });
2461
+ const Ce = (k || ((z = e.style) == null ? void 0 : z.width)) && (Ee || ((J = e.style) == null ? void 0 : J.height));
2462
+ (!b || Ce) && Y(), (Q = n.current) != null && Q.props && (n.current.props.myop_cta_handler = (X, ue) => {
2463
+ e.on && e.on(X, ue);
2464
+ const Se = Ls(X), ne = e[Se];
2465
+ typeof ne == "function" && ne(ue);
2466
+ }), T.onLoad && n.current && T.onLoad(n.current);
2467
+ } catch (C) {
2468
+ _ || ce((C == null ? void 0 : C.message) || "Unknown error");
2456
2469
  } finally {
2457
- if (n.current = !1, i.current !== null && !M) {
2458
- const I = i.current;
2459
- i.current = null, await U(I);
2470
+ if (s.current = !1, i.current !== null && !_) {
2471
+ const C = i.current;
2472
+ i.current = null, await R(C);
2460
2473
  }
2461
2474
  }
2462
2475
  };
2463
- return n.current ? i.current = { ...e } : U(e).then(), () => {
2464
- M = !0, s.current && s.current.dispose();
2476
+ return s.current ? i.current = { ...e } : R(e).then(), () => {
2477
+ _ = !0, n.current && n.current.dispose();
2465
2478
  };
2466
2479
  }, [e.componentId]);
2467
- const g = o ? 50 : void 0, He = !C || !f || b.fillHeight;
2468
- let Q, le;
2469
- return He ? (Q = {
2480
+ const le = o ? 50 : void 0, H = !b || !m || w.fillHeight;
2481
+ let g, de;
2482
+ return H ? (g = {
2470
2483
  position: "relative",
2471
2484
  width: "100%",
2472
2485
  height: "100%",
2473
- minHeight: g,
2486
+ minHeight: le,
2474
2487
  ...e.style
2475
- }, le = {
2488
+ }, de = {
2476
2489
  position: "absolute",
2477
2490
  inset: 0
2478
- }) : (Q = {
2491
+ }) : (g = {
2479
2492
  position: "relative",
2480
- width: m != null && m.autoSizingWidth ? m.width : "100%",
2481
- height: (m == null ? void 0 : m.height) ?? void 0,
2482
- minHeight: g,
2493
+ width: f != null && f.autoSizingWidth ? f.width : "100%",
2494
+ height: (f == null ? void 0 : f.height) ?? void 0,
2495
+ minHeight: le,
2483
2496
  ...e.style
2484
- }, le = {
2497
+ }, de = {
2485
2498
  width: "100%",
2486
- height: (m == null ? void 0 : m.height) ?? void 0
2487
- }), /* @__PURE__ */ Ut("div", { style: Q, children: [
2488
- /* @__PURE__ */ R("div", { ref: t, style: le }),
2489
- o && e.loader !== void 0 && /* @__PURE__ */ R(wn, { opacity: c, fadeDuration: F, children: e.loader }),
2490
- u && /* @__PURE__ */ R(Mn, { children: e.fallback })
2499
+ height: (f == null ? void 0 : f.height) ?? void 0
2500
+ }), /* @__PURE__ */ tn("div", { style: g, children: [
2501
+ /* @__PURE__ */ L("div", { ref: t, style: de }),
2502
+ o && e.loader !== void 0 && /* @__PURE__ */ L(Rs, { opacity: l, fadeDuration: A, children: e.loader }),
2503
+ u && /* @__PURE__ */ L(ks, { children: e.fallback })
2491
2504
  ] });
2492
2505
  };
2493
2506
  export {
2494
- zn as MyopComponent,
2495
- An as MyopContainer,
2496
- Mn as MyopFallback,
2497
- wn as MyopLoader,
2498
- zn as MyopV2Container,
2499
- Dn as enableLocalDev,
2500
- gn as getCloudRepository,
2501
- Hn as getPreloadedParams,
2502
- vn as isPreloaded,
2503
- Pn as preloadComponents,
2504
- Ln as setCloudRepository,
2505
- kn as setCloudRepositoryUrl,
2506
- On as setEnvironment
2507
+ Gs as MyopComponent,
2508
+ Vs as MyopContainer,
2509
+ ks as MyopFallback,
2510
+ Rs as MyopLoader,
2511
+ Gs as MyopV2Container,
2512
+ Ws as enableLocalDev,
2513
+ Is as getCloudRepository,
2514
+ $s as getPreloadedParams,
2515
+ Hs as isPreloaded,
2516
+ js as preloadComponents,
2517
+ Us as setCloudRepository,
2518
+ Ks as setCloudRepositoryUrl,
2519
+ qs as setEnvironment
2507
2520
  };