@myop/vue 0.0.22 → 0.0.23
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/components/MyopVueComponent.vue.d.ts +18 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2231 -0
- package/dist/index.umd.cjs +111 -0
- package/dist/vite.svg +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
(function($,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):($=typeof globalThis<"u"?globalThis:$||self,f($["@myop/vue"]={},$.Vue))})(this,function($,f){"use strict";var qt=Object.defineProperty,jt=(e,t,s)=>t in e?qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,p=(e,t,s)=>jt(e,typeof t!="symbol"?t+"":t,s),z=(e,t,s)=>new Promise((n,i)=>{var o=l=>{try{c(s.next(l))}catch(d){i(d)}},r=l=>{try{c(s.throw(l))}catch(d){i(d)}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,r);c((s=s.apply(e,t)).next())}),R=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),Wt=class{constructor(){p(this,"id",R()),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)}static create(...t){return new this(...t)}isTypeof(t){return t.messageType===this.messageType}},Gt=class extends Wt{constructor(t){super(),this.handler=t,p(this,"handlerUniqueId",R())}},Jt="ExecuteScriptReplyMessage",Yt=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,Xt=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,Qt=e=>{let t=e.match(Yt);if(t)return t[1]||t[3];{let s=e.match(Xt);if(s)return s[1].trim()}},$e=class extends Gt{constructor(t,s=()=>{},n){super(s),this.scriptInputs=n,p(this,"replyMessageKey",Jt),p(this,"messageType","ExecuteScriptMessage"),p(this,"script",""),this.script=t.toString(),this.content=t.toString(),this.content=Qt(this.content)}};p($e,"replierKey","send"),p($e,"completeStreamKey","completeStream");var Pe=class{constructor(){p(this,"_runTimeInstanceId","runtime-instance-id-"+R()),p(this,"_runTimeId","runtime-id-"+R()),p(this,"_runTimeName","runtime-name-"+R()),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)}};p(Pe,"create",()=>new Pe);var Le=class{constructor(){p(this,"_runTimeInstanceId","runtime-instance-id-"+R()),p(this,"_runTimeId","runtime-id-"+R()),p(this,"_runTimeName","runtime-name-"+R()),p(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null}),p(this,"name",this._runTimeName),p(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0}),p(this,"withInstance",t=>(this.instance=t,this)),p(this,"withType",t=>(this.type=t,this)),p(this,"withName",t=>(this.name=t,this)),p(this,"withDefaultSkin",t=>(this.type.skins.push(t),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:t.id}},this)),p(this,"withRef",t=>(this.type.refs.push(t),this)),p(this,"withBasicRef",t=>{const s={id:"",name:t,description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}};return this.type.refs.push(s),this}),p(this,"build",()=>JSON.parse(JSON.stringify(this)))}};p(Le,"create",()=>new Le);var le=class{constructor(t="https://cloud.myop.dev"){this._baseUrl=t,p(this,"userFlows",{})}fetchComponent(t,s){return z(this,null,function*(){return s?(yield this.fetchFlow(s)).components.find(i=>i.type.id===t):(yield this.fetchAutoFlow(t)).components[0]})}fetchAutoFlow(t){return z(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((s,n)=>z(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&auto=true`)).json();s(o.item)}catch(i){n(i)}}))),yield this.userFlows[t]})}fetchFlow(t){return z(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((s,n)=>z(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&resolve=components`)).json();s(o.item)}catch(i){n(i)}}))),yield this.userFlows[t]})}};p(le,"Main",new le);var Zt=le,Fe=Object.defineProperty,es=Object.defineProperties,ts=Object.getOwnPropertyDescriptors,Ae=Object.getOwnPropertySymbols,ss=Object.prototype.hasOwnProperty,ns=Object.prototype.propertyIsEnumerable,de=(e,t,s)=>t in e?Fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,y=(e,t)=>{for(var s in t||(t={}))ss.call(t,s)&&de(e,s,t[s]);if(Ae)for(var s of Ae(t))ns.call(t,s)&&de(e,s,t[s]);return e},U=(e,t)=>es(e,ts(t)),is=(e,t)=>{for(var s in t)Fe(e,s,{get:t[s],enumerable:!0})},a=(e,t,s)=>de(e,typeof t!="symbol"?t+"":t,s),w=(e,t,s)=>new Promise((n,i)=>{var o=l=>{try{c(s.next(l))}catch(d){i(d)}},r=l=>{try{c(s.throw(l))}catch(d){i(d)}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,r);c((s=s.apply(e,t)).next())}),Y="__federation__",Ve="onLoad",Be=(e,t)=>{window[Y]&&window[Y][e]&&window[Y][e][Ve]&&window[Y][e][Ve]({[e]:t})},m={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",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",CleanupMessage:"CleanupMessage",In:{MutationObserverMessage:"MutationObserverMessage",ResizeObserverMessage:"ResizeObserverMessage"}},ue={};is(ue,{AddEventListenerMessage:()=>us,BaseMyopMessage:()=>v,BindClickMessage:()=>as,ChangeTextMessage:()=>cs,CleanupMessage:()=>rt,CleanupReplayMessage:()=>at,ClickReplayMessage:()=>ze,CreateRefComponentMessage:()=>et,CustomRefMessage:()=>he,DetectMyopRefsMessage:()=>ms,DetectedMyopRefsMessage:()=>nt,DisposeMessage:()=>ct,ElementValueReplayMessage:()=>Ye,EnvelopedMessage:()=>tt,EventListenerCallbackMessage:()=>Ge,ExecuteComponentMethod:()=>k,ExecuteScriptMessage:()=>H,ExecuteScriptReplyMessage:()=>je,GetAttributeMessage:()=>gs,GetAttributeReplayMessage:()=>ys,GetElementValueMessage:()=>ps,InitMessage:()=>pe,InitRequest:()=>Qe,InitResponse:()=>Xe,MessageDirection:()=>E,MutationObserverMessage:()=>vs,MyopBindMessage:()=>I,MyopBindReplayMessage:()=>S,MyopElementMessage:()=>rs,Ref:()=>q,RefComponentCreatedMessage:()=>fe,ResizeObserverMessage:()=>_s,SetAttributeMessage:()=>hs,SetInnerHtml:()=>fs,SetMutationObserverMessage:()=>ws,SetResizeObserverMessage:()=>Ms,stripFunction:()=>qe});var L=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),os=e=>new Promise(t=>setTimeout(t,e)),E=class{};a(E,"down","down"),a(E,"up","up");var v=class{constructor(){a(this,"id",L()),a(this,"myop",!0),a(this,"content"),a(this,"source"),a(this,"destination"),a(this,"route"),a(this,"ref"),a(this,"direction"),a(this,"cleanable",!1)}static create(...e){return new this(...e)}isTypeof(e){return e.messageType===this.messageType}},rs=class extends v{constructor(e){super(),this.ref=e}},S=class extends v{constructor(e){super(),this.replayToHandler=e}},I=class extends v{constructor(e){super(),this.handler=e,a(this,"handlerUniqueId",L())}},q=class Ut{constructor(t,s){this.refConfig=t,this.component=s,a(this,"myop",!0),a(this,"__nonProxied"),this.__nonProxied=U(y({},this),{component:null})}static create(t,s,n){let i=s;return i||(i={id:"",name:"",description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}}),new Ut(i,n)}},Ke="ClickReplayMessage",as=class extends I{constructor(e,t){super(t),this.ref=e,a(this,"replyMessageKey",Ke),a(this,"messageType","BindClickMessage"),a(this,"cleanable",!0)}},ze=class extends S{constructor(){super(...arguments),a(this,"messageType",Ke)}},cs=class extends v{constructor(e,t){super(),this.ref=e,a(this,"messageType","ChangeTextMessage"),this.content=t}},Ue="ExecuteScriptReplyMessage",ls=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,ds=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,qe=e=>{let t=e.match(ls);if(t)return t[1]||t[3];{let s=e.match(ds);if(s)return s[1].trim()}},H=class extends I{constructor(e,t=()=>{},s){super(t),this.scriptInputs=s,a(this,"replyMessageKey",Ue),a(this,"messageType","ExecuteScriptMessage"),a(this,"script",""),this.script=e.toString(),this.content=e.toString(),this.content=qe(this.content)}};a(H,"replierKey","send"),a(H,"completeStreamKey","completeStream");var je=class extends S{constructor(e,t){super(e),this.replayToHandler=e,this.content=t,a(this,"messageType",Ue)}},he=class extends H{constructor(e,t,s=()=>{}){super(({rootRef:n,elementId:i,_script:o,__scriptInputs:r})=>{const c=(n.shadowRoot||n.container).querySelectorAll(`[myop-id='${i}']`);return c.length?(r.ref=c[0],new Function(`return (${o})(...arguments)`)(r)):null},s),this.scriptInputs=t,this.scriptInputs=U(y({},t),{_script:e.toString()})}},We="EventListenerCallbackMessage",us=class extends I{constructor(e,t,s){super(s),this.ref=e,this.type=t,this.handler=s,a(this,"replyMessageKey",We),a(this,"messageType","AddEventListenerMessage"),a(this,"cleanable",!0),a(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},Ge=class extends S{constructor(e,t){super(e),this.replayToHandler=e,this.e=t,a(this,"messageType",We),this.content={e:t}}},hs=class extends v{constructor(e,t,s){super(),this.ref=e,this.name=t,this.value=s,a(this,"messageType","SetAttributeMessage")}},Je="ElementValueReplayMessage",ps=class extends I{constructor(e,t){super(t),this.ref=e,a(this,"replyMessageKey",Je),a(this,"messageType","GetElementValueMessage")}},Ye=class extends S{constructor(e){super(),this.content=e,a(this,"messageType",Je)}},fs=class extends v{constructor(e,t){super(),this.ref=e,a(this,"messageType","SetInnerHtml"),this.content=t}},pe=class extends v{constructor(e){super(),a(this,"messageType","InitMessage"),this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},Xe=class extends pe{constructor(){super(...arguments),a(this,"messageType","InitResponse")}},Qe=class extends v{constructor(){super(...arguments),a(this,"messageType","InitRequest")}},Ze="RefComponentCreatedMessage",et=class extends I{constructor(e,t,s,n){super(n),this.refConfig=e,this.nestedComponentConfig=t,this.options=s,a(this,"replyMessageKey",Ze),a(this,"messageType","CreateRefComponentMessage")}},fe=class extends S{constructor(e,t,s){super(e),this.replayToHandler=e,this.nestedRefs=t,this.failed=s,a(this,"messageType",Ze)}},tt=class extends v{constructor(e,t){super(),this.destination=e,this.message=t,a(this,"messageType","EnvelopedMessage");const s=t;this.route=[e,...s.route?s.route:[]]}},st="DetectedMyopRefsMessage",ms=class extends I{constructor(){super(...arguments),a(this,"messageType","DetectMyopRefsMessage"),a(this,"replyMessageKey",st)}},nt=class extends S{constructor(e,t){super(e),this.replayToHandler=e,a(this,"messageType",st),this.content=t}isTypeof(e){return e.messageType===this.messageType}},it="GetAttributeReplayMessage",gs=class extends I{constructor(e,t,s){super(s),this.ref=e,this.name=t,a(this,"replyMessageKey",it),a(this,"messageType","GetAttributeMessage")}},ys=class extends S{constructor(e){super(),this.content=e,a(this,"messageType",it)}},k=class extends v{constructor(e){super(),this.method=e,a(this,"messageType","ExecuteComponentMethod")}},ws=class extends v{constructor(){super(...arguments),a(this,"messageType","SetMutationObserverMessage")}},vs=class extends v{constructor(){super(...arguments),a(this,"messageType","MutationObserverMessage")}},ot="CleanupReplayMessage",rt=class extends I{constructor(e,t){super(t),this.cleanupForMessageId=e,a(this,"replyMessageKey",ot),a(this,"messageType","CleanupMessage")}},at=class extends S{constructor(e){super(),this.customCleanup=e,a(this,"messageType",ot)}},ct=class extends v{constructor(){super(...arguments),a(this,"messageType","DisposeMessage")}},Ms=class extends v{constructor(){super(...arguments),a(this,"cleanable",!0),a(this,"messageType","SetResizeObserverMessage")}},_s=class extends v{constructor(){super(...arguments),a(this,"messageType","ResizeObserverMessage")}},me=class{constructor(e,t,s){this.componentDefinition=e,this.container=t,a(this,"id",""),a(this,"messageHandlers",{}),a(this,"element"),a(this,"_markedForDisposed",!1),a(this,"bind",(i,o)=>{this.messageHandlers[i]||(this.messageHandlers[i]=[]),this.messageHandlers[i].includes(o)||this.messageHandlers[i].push(o)}),a(this,"bindWhen",(i,o,r)=>{if(!r)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[i]||(this.messageHandlers[i]=[]);const c=this.messageHandlers[i],l=d=>o(d)?(r(d),!0):!1;return c.push(l),()=>{const d=c.indexOf(l);d>-1&&c.splice(d,1)}}),a(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()}),a(this,"isInitiated",!1),a(this,"_whenInitiatedResolve"),a(this,"_whenInitiatedReject"),a(this,"_whenInitiated",new Promise((i,o)=>{this._whenInitiatedResolve=i,this._whenInitiatedReject=o})),a(this,"initiated",()=>this._whenInitiated),a(this,"props",{}),a(this,"refs",{}),this.id=(s==null?void 0:s.id)||Q.Instance().assignId(e);const n=s!=null&&s.timeout?s==null?void 0:s.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject(`timeout_${n} ${this.id}`)},n),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(e){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=e}onMessageReceived(e){if(e.messageType===m.ExecuteComponentMethod){const s=e;return this[s.method]?this[s.method](s.content):console.log(`method not found ${s.method} on component`,this),!0}const t=this.messageHandlers[e.messageType];if(t&&t.length){let s=!1;return t.forEach(n=>{s=s||n(e)}),s}return!1}sendCleanupMessage(e){e.source=this.id,e.destination=this.id,e.direction=E.down;const t=this.bindWhen(e.replyMessageKey,n=>n.replayToHandler===e.handlerUniqueId,n=>{e.handler(n),t()}),s=e.handler;delete e.handler,this.send(e),e.handler=s}send(e){e.source||(e.source=this.id),e.destination||(e.destination=this.id),e.direction=E.down;let t;if(e.handler){const s=e;t=this.bindWhen(s.replyMessageKey,n=>n.replayToHandler===s.handlerUniqueId,s.handler),delete e.handler}return e.ref&&(e.ref=e.ref.__nonProxied||e.ref),e.cleanable?()=>{this.sendCleanupMessage(new rt(e.id,s=>{})),t&&t()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new ct);const e=this.messageHandlers.onDispose;e&&e.forEach(t=>{t(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}},Es=class{constructor(e,t,s,n,i){this.myopId=e,this.htmlTagName=t,this.BoundingRect=s,this.offsetTop=n,this.offsetLeft=i,a(this,"type","MyopElementRef")}},bs=e=>w(void 0,null,function*(){if(typeof e=="function")e();else if(e instanceof Promise){const t=yield e;typeof t=="function"&&t()}}),Cs=class{constructor(e){this.messageToHost=e}},Ss=class extends Cs{constructor(e,t){super(e),this.messageToHost=e,this.context=t}},Is=class{constructor(e,t){this.id=e,this.context=t,a(this,"send",s=>{})}},Ts=class{constructor(){a(this,"messageToHandleAfterInit",[]),a(this,"components",{}),a(this,"alwaysPassEnvelopesToHost",!1),a(this,"messageCleanupCache",{})}handleIncomeMessages(e){const t=e.data?e.data:e.detail;if(!(!t||!t.myop)){let s=t;if(s.direction!==E.down)return;if(s.messageType===m.DisposeMessage){s.destination&&delete this.components[s.destination];return}if(s.messageType===m.InitMessage){const n=s.content.id;if(this.components[n])return;this.components[n]=new Is(n),this.messageToHost(new Xe(n));return}if(s.messageType===m.EnvelopedMessage){const n=s,i=n.message;if(s=i,this.alwaysPassEnvelopesToHost||this.components[s.destination]){const o=myop.hostSDK.components.find(c=>c.id===i.destination);if(o){o.send(i);return}const r=myop.hostSDK.components.find(c=>c.id===n.destination);if(r){r.send(i);return}}else return}if(s.messageType){if(s.messageType===m.CleanupMessage){const n=s,i=this.messageCleanupCache[n.cleanupForMessageId],o=new at(!!i);o.destination=s.destination,i?(delete this.messageCleanupCache[n.cleanupForMessageId],bs(i).then(()=>{this.messageToHost(o,n)}).catch(()=>{})):this.messageToHost(o,n);return}this.supportedHandlers.forEach(n=>{if(n.messageType===s.messageType){const i=n.executor(s);if(s.cleanable&&i&&(this.messageCleanupCache[s.id]=i),i&&!s.cleanable)throw new Error(`Cleanup handler generated for non-cleanable message.
|
|
2
|
+
messageType - ${s.messageType}, handler executor was - ${n.executor}
|
|
3
|
+
|
|
4
|
+
Please review the message definition object & message handler.
|
|
5
|
+
To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`);if(!i&&s.cleanable)throw new Error(`No cleanup handler generated for a cleanable message.
|
|
6
|
+
messageType - ${s.messageType}, handler executor was - ${n.executor}
|
|
7
|
+
|
|
8
|
+
Please review the message definition object & message handler.
|
|
9
|
+
To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`)}})}else console.log("unsupported message type")}}},ge={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader"},ye={open:"open",none:"none",localFrame:"localFrame"},we=class{};a(we,"code","code"),a(we,"component","component");var ve={Segmented:"Segmented",Dedicated:"Dedicated"},xs={Segment:"Segment"},Rs=class{constructor(e,t){this.container=e,this.shadowRoot=t,a(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div")),a(this,"getRoot",()=>this.shadowRoot||this.container)}},Me=e=>e!==Object(e),Hs=e=>typeof e=="function",lt=e=>{if(Me(e))return!0;if(Hs(e)||Object.getPrototypeOf(e))return!1;for(const t in e){const s=e[t];if(typeof s=="object"){if(!lt(s))return!1}else{if(Me(s))continue;return!1}}return!0},F=(e,t={},s=!0,n=new WeakMap)=>{if(Me(e))return e;if(Array.isArray(e)){if(n.has(e))return n.get(e);const i=[];n.set(e,i);for(let o=0;o<e.length;o++){const r=e[o];i[o]=F(r,t,s,n)}return i}if(e!==null&&typeof e=="object"){if(n.has(e))return n.get(e);const i={};n.set(e,i);for(const o in e){const r=typeof t=="boolean"?t:t[o];r&&(r===!0?(s?e[o]!==void 0:e[o])&&(i[o]=F(e[o],!0,s,n)):typeof r=="object"&&(i[o]=F(e[o],r,s,n)))}return i}return{}},ks={notSerializableRefCall:(e,t)=>{throw new Error(`
|
|
10
|
+
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.
|
|
11
|
+
The following types of data are considered non-serializable and cannot be processed:
|
|
12
|
+
|
|
13
|
+
- Functions
|
|
14
|
+
- DOM elements
|
|
15
|
+
- Class instances
|
|
16
|
+
- Circular references
|
|
17
|
+
- Symbols
|
|
18
|
+
- BigInt values
|
|
19
|
+
|
|
20
|
+
In the following execution we detected :
|
|
21
|
+
~~~~~~~~
|
|
22
|
+
${t}
|
|
23
|
+
~~~~~~~~
|
|
24
|
+
as not serializable.
|
|
25
|
+
|
|
26
|
+
To resolve this issue, please ensure that all inputs passed to '${e.toString()}' are in a serializable format.
|
|
27
|
+
This typically includes primitive types (strings, numbers, booleans), arrays, and plain objects.
|
|
28
|
+
If you need to include complex data types, consider converting them to a serializable structure before passing them to the function.
|
|
29
|
+
Or use Myop message that support it: CustomRefMessage, AddEventListenerMessage or ExecuteScriptMessage.
|
|
30
|
+
|
|
31
|
+
Suggested Fix:
|
|
32
|
+
1. Remove or replace non-serializable values from your input.
|
|
33
|
+
2. If using objects, ensure they do not contain any functions or circular references.
|
|
34
|
+
3. Convert any class instances to plain objects or JSON-compatible formats.
|
|
35
|
+
4. Use dedicated Myop message.
|
|
36
|
+
|
|
37
|
+
For more details on serialization and Myop message examples, refer to https://docs.myop.dev.
|
|
38
|
+
|
|
39
|
+
`)}},dt=class extends me{constructor(e,t,s){super(e,t.container,s),this.componentDefinition=e,this.parent=t,a(this,"send",n=>{const i=n.handler,o=super.send(n);return this.parent.send(new tt(this.id,n)),n.handler=i,o}),a(this,"dispose",()=>{this.isInitiated&&this.send(new k("dispose")),super.dispose()})}hide(){this.send(new k("hide"))}show(){this.send(new k("show"))}inspect(){return this.send(new k("inspect"))}setHeightBasedOnDocumentElement(){this.send(new k("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new k("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}},Os=(e,t,s)=>{const n=document.createElement("a");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},ut=(e,t,s,n,i,o)=>{const r=Os(`${o.name} : ${t}`,s,o);return n.insertBefore(r,i),i.style.border="1px solid #007BFF",i.style.display="block",()=>{i.style.border="unset",n.removeChild(r)}},Ds=(e,t)=>{const s=t.reduce((i,o)=>U(y({},i),{[o.name]:y({},o)}),{}),n={get:(i,o)=>{const r=s[o];return r.mode==="output"?new Promise(c=>{const l=[];r.behavior.ref&&l.push(q.create(r.behavior.ref)),l.push(u=>{c(u)}),r.behavior.params&&l.push(...r.behavior.params);const d=ue[r.behavior.message];e.send(new d(...l))}):null},set:(i,o,r)=>{const c=s[o];if(!c)throw new Error(`Error: Undefined Prop
|
|
40
|
+
|
|
41
|
+
It looks like you've tried to use a prop that hasn't been defined.
|
|
42
|
+
Please check the prop name for any typos or ensure that it is properly defined in the component's prop list.
|
|
43
|
+
|
|
44
|
+
Prop Name: ${o}
|
|
45
|
+
Component: ${e.componentDefinition.name}, ID: ${e.componentDefinition.id}
|
|
46
|
+
|
|
47
|
+
For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${e.componentDefinition.id} or consult the developer guide.`);if(c.mode==="input")if(c.behavior.type==="message"){const l=[];c.behavior.ref&&l.push(q.create(c.behavior.ref)),l.push(r),c.behavior.params&&l.push(...c.behavior.params);const d=ue[c.behavior.message];return e.send(new d(...l)),!0}else throw new Error(`Error: Unsupported Behavior
|
|
48
|
+
|
|
49
|
+
The 'behavior' field provided is not supported.
|
|
50
|
+
Component: ${e.componentDefinition.name}, ID: ${e.componentDefinition.id}
|
|
51
|
+
|
|
52
|
+
Prop Name: ${o}
|
|
53
|
+
Behavior Field: ${c.behavior.type}
|
|
54
|
+
|
|
55
|
+
Check the documentation for valid behavior options.`);return!1}};return e.props={},e.props=new Proxy(e.props,n),e},Ns=(e,t)=>new Proxy(e,{get(s,n){return s[n]?s[n]:(...o)=>new Promise(r=>{o.forEach(c=>{lt(c)||ks.notSerializableRefCall(n,c)}),t.send(new he(({ref:c,propName:l,functionArgs:d,makeSerializable:u})=>{if(c){const h=c[l];return u(typeof h=="function"?c[l](...d):h,!0)}return null},{elementId:s.refConfig.selector,propName:n,functionArgs:o},c=>{r(c.content)}))})},set(s,n,i){return t.send(new he(({ref:o,propName:r,propValue:c})=>{o&&(o[r]=c)},{elementId:s.refConfig.selector,propValue:i,propName:n},o=>{})),!0}}),ht=(e,t,s,n)=>w(void 0,null,function*(){const i=e.component;if(!i)throw new Error("cant createRefComponent with detached ref");return new Promise((o,r)=>w(void 0,null,function*(){const c=new dt(t.type,i,n);s.push(c),yield i.initiated();const l=setTimeout(()=>{r("timeout")},5e3);i.send(new et(e.refConfig,t,U(y({},n||{}),{id:c.id,_hasParent:!0}),d=>w(void 0,null,function*(){if(clearTimeout(l),d.failed){r("CreateRefComponentMessage failed");return}const u=s.find(h=>h.id==c.id);if(u!==c){i.refs[e.refConfig.name]=u,o(u);return}else c.setInitiated(),i.refs[e.refConfig.name]=c;d.nestedRefs.forEach(h=>{const g=t.instance.resolvedNestedComponents.find(J=>J.type.id===h.componentDefinitionId).type,_=new dt(g,c);_.setInitiated(),c.refs[h.refName]=_,s.push(_)});try{yield pt(c,t,s,!0),i.setHeightBasedOnScrollHeight&&i.setHeightBasedOnScrollHeight(),o(c)}catch(h){r(h)}})))}))}),pt=(e,t,s,n=!1)=>w(void 0,null,function*(){e.refs||(e.refs={});const i=Object.values(e.componentDefinition.refs).map(o=>new Promise((r,c)=>w(void 0,null,function*(){var l;if(o.behavior.type==we.component){if(n){r();return}let d=o.behavior.componentId;d||(d=o.behavior.instance.componentId);const u=(l=t.instance.resolvedNestedComponents)==null?void 0:l.find(g=>g.type.id===d);if(!u)throw new Error("componentConfig provided without nestedComponentConfig check the config object");const h=q.create("",o,e);try{const g=yield ht(h,u,s);e.refs[o.name]=g,r()}catch(g){c(g)}}else try{const d=q.create("",o,e);e.refs[o.name]=Ns(d,e),r()}catch{}})));try{yield Promise.all(i)}catch(o){throw o}}),ft=class extends me{constructor(e,t,s,n,i){super(e,s,i),this.componentConfig=e,this.container=s,this.IframeElement=n,a(this,"cleanupInspect"),a(this,"setHeightBasedOnDocumentElement",()=>{const o=this.send(new H(()=>window.document.documentElement.scrollHeight,r=>{this.IframeElement.style.height=`${r.content}px`,o()}))}),a(this,"observeSizeBasedOnDocumentElement",()=>{this.send(new H(({send:o})=>{const{height:r,width:c}=document.documentElement.getBoundingClientRect(),l=new ResizeObserver(()=>{const{height:d,width:u}=document.documentElement.getBoundingClientRect();o({height:d,width:u})});return l.observe(document.documentElement),l.observe(document.body),{height:r,width:c}},o=>{this.IframeElement.style.width=`${o.content.width}px`,this.IframeElement.style.height=`${o.content.height}px`}))}),a(this,"setSizeBasedOnDocumentElement",()=>{const o=this.send(new H(()=>{const{height:r,width:c}=document.documentElement.getBoundingClientRect();return{height:r,width:c}},r=>{this.IframeElement.style.width=`${r.content.width}px`,this.IframeElement.style.height=`${r.content.height}px`,o()}))}),a(this,"setHeightBasedOnScrollHeight",()=>{const o=this.send(new H(()=>{let c=0;return c++,c--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+c+"px"},r=>{this.IframeElement.style.height=r.content,o()}))}),a(this,"send",o=>{var r,c;let l=y({},o);if(l.messageType===m.ExecuteComponentMethod)return this[l.method](),()=>{};l.direction=E.down;const d=super.send(l);return(c=(r=this.IframeElement)==null?void 0:r.contentWindow)==null||c.postMessage(l,"*"),d}),a(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)}),t.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=ut(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===m.In.MutationObserverMessage||e.messageType===m.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}},_e=class{constructor(){a(this,"appendChild",(e,t,s)=>{var n;if(s!=null&&s.relative){if(s.relative.direction==="before")return e.insertBefore(t,s.relative.child);if(s.relative.direction==="after"){const i=(n=s.relative.child)==null?void 0:n.nextSibling;return e.insertBefore(t,i||null)}}else return e.appendChild(t)})}},$s=(e,t,s)=>{const n=new URL(e);return n.searchParams.append(t,s),n.toString()},Ps=class extends _e{constructor(){super(...arguments),a(this,"type",ge.IframeLoader),a(this,"load",(e,t,s,n)=>w(this,null,function*(){let i;const o=t.loader;if((s==null?void 0:s.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",o.url,s),i=s,i.src=o.url;else{const r=L(),c=`myop-comp-${r}`;i=document.createElement("iframe"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),n!=null&&n.hidden&&(i.style.visibility="hidden"),i=this.appendChild(s,i,n);let l=t.loader.url;n!=null&&n._hasParent&&(l=$s(l,"_myop-comp",r));let d="";n!=null&&n.elementAttributes&&(d=Object.entries(n==null?void 0:n.elementAttributes).map(([u,h])=>h===""||h===null||h===void 0?u:`${u}="${String(h)}"`).join(" ")),i.outerHTML=`<iframe
|
|
56
|
+
id="${c}"
|
|
57
|
+
style="
|
|
58
|
+
padding: 0;
|
|
59
|
+
margin: 0;
|
|
60
|
+
height: ${o.autoHeight||!o.height?"":o.height};
|
|
61
|
+
width : 100%;
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
border: none;
|
|
64
|
+
opacity: ${n!=null&&n.hidden?"0":"1"};
|
|
65
|
+
position: ${n!=null&&n.hidden?"absolute":"static"};
|
|
66
|
+
pointer-events: ${n!=null&&n.hidden?"none":"all"};
|
|
67
|
+
"
|
|
68
|
+
src="${l}"
|
|
69
|
+
${d}
|
|
70
|
+
></iframe>`,i=s.querySelector(`#${c}`)}return new ft(e,t,s,i,n)}))}},mt={webcomponent_message_key:"myop_webcomponent_message"},gt=class extends me{constructor(e,t,s,n,i){super(e,s,i),this.container=s,this.customElement=n,a(this,"cleanupInspect",()=>{}),a(this,"send",o=>{let r=y({},o);const c=super.send(r),l=new CustomEvent(mt.webcomponent_message_key,{detail:r});try{this.customElement.dispatchEvent(l)}catch(d){console.log("error while trying to dispatchEvent",d)}return c}),a(this,"dispose",()=>{var o;super.dispose(),(o=this.customElement.parentNode)==null||o.removeChild(this.customElement)}),this.element=n}inspect(){return this.cleanupInspect=ut(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=""}},Ee={},Ls=class extends _e{constructor(){super(...arguments),a(this,"type",ge.WebComponentLoader),a(this,"load",(e,t,s,n)=>w(this,null,function*(){const i=t.loader;Ee[i.url]?console.log("Module alreday loaded or in loading process"):Ee[i.url]=new Promise((c,l)=>{const d=i.url,u=document.createElement("script");u.type="module",u.src=d,u.onload=()=>{c()},u.onerror=()=>{l()},document.head.appendChild(u)}),yield Ee[i.url],yield os(1);let o=`myop-comp-${L()}`;const r=document.createElement(i.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),r.id=o,n!=null&&n.hidden&&(r.style.opacity="0",r.style.position="absolute",r.style.height="0",r.style.width="0",r.style.pointerEvents="none",r.style.visibility="hidden"),n!=null&&n._environment&&(r._myopEnvironment=n==null?void 0:n._environment),this.appendChild(s,r,n),new gt(e,t,s,r,n)}))}},Fs="0.1.36",T=class extends Ss{constructor(e,t){super(e),this.context=t,a(this,"executor",s=>{if(s.destination){const n=s.destination;if(this.context[n].context){const i=(o,r)=>{this.messageToHost(U(y({},o),{source:s.destination?s.destination:s.source,destination:s.source?s.source:s.destination}),r)};return this.innerExecutor(s,this.context[n].context,i)}else debugger}else debugger})}},j={id:"myop-id"},A=(e,t)=>t.querySelectorAll(`[${j.id}='${e.refConfig.selector}']`),As=class extends T{constructor(){super(...arguments),a(this,"messageType",m.BindClickMessage),a(this,"innerExecutor",(e,t,s)=>{const n=A(e.ref,t.shadowRoot),i=[];return n.forEach(o=>{const r=()=>{s(new ze(e.handlerUniqueId))};o.addEventListener("click",r),i.push(()=>{o.removeEventListener("click",r)})}),()=>{i.forEach(o=>o())}})}},Vs=class extends T{constructor(){super(...arguments),a(this,"messageType",m.ChangeTextMessage),a(this,"innerExecutor",(e,t)=>{A(e.ref,t.shadowRoot).forEach(n=>{n.textContent=e.content})})}},Bs=class extends Rs{constructor(e,t){super(e,t),this.container=e,this.shadowRoot=t}},Ks=class extends T{constructor(){super(...arguments),a(this,"innerExecutor",(e,t)=>{const s=t.shadowRoot.querySelectorAll(`[${j.id}]`);let n=[];s.forEach(i=>{const o=i.getAttribute(j.id);o&&n.push(new Es(o,i.tagName,i.getBoundingClientRect(),i.offsetTop,i.offsetLeft))}),this.messageToHost(new nt(e.handlerUniqueId,n))}),a(this,"messageType",m.DetectMyopRefsMessage)}},zs=class extends T{constructor(){super(...arguments),a(this,"messageType",m.SetAttributeMessage),a(this,"innerExecutor",(e,t)=>{A(e.ref,t.shadowRoot).forEach(n=>{n.setAttribute(e.name,e.value)})})}},Us=class extends T{constructor(){super(...arguments),a(this,"messageType",m.AddEventListenerMessage),a(this,"innerExecutor",(e,t,s)=>{const n=A(e.ref,t.shadowRoot),i=[];return n.forEach(o=>{const r=c=>{s(new Ge(e.handlerUniqueId,F(c,e.serializableSkeleton)))};o.addEventListener(e.type,r),i.push(()=>{o.removeEventListener(e.type,r)})}),()=>{i.forEach(o=>o())}})}},qs=class extends T{constructor(){super(...arguments),a(this,"messageType",m.CreateRefComponentMessage),a(this,"innerExecutor",(e,t,s)=>{w(this,null,function*(){const i=t.shadowRoot.querySelectorAll(`[${j.id}='${e.refConfig.selector}']`);if(i.length===1){const o=Q.Instance(),r=o.components.find(u=>u.id===e.options.id);r&&r.dispose();const c=o.components.indexOf(r);c!==-1&&o.components.splice(c,1);const l=yield o.loadComponent(e.nestedComponentConfig,i.item(0),e.options),d=[];Object.keys(l.refs).forEach(u=>{let h=l.refs[u];h=h.__nonProxied||h,h.componentDefinition&&d.push({refName:u,componentDefinitionId:h.componentDefinition.id})}),s(new fe(e.handlerUniqueId,d))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new fe(e.handlerUniqueId,[],!0));debugger}}).then()})}},js=(e,t,s)=>{const n=e.scriptInputs?e.scriptInputs:{};n.makeSerializable=F,n.send=t,n.rootRef=s,n.__scriptInputs=n;const o=new Function(`return (${e.script})(...arguments)`)(n);t(o)},Ws=class extends T{constructor(){super(...arguments),a(this,"messageType",m.ExecuteScriptMessage),a(this,"innerExecutor",(e,t,s)=>{js(e,i=>{s(new je(e.handlerUniqueId,i))},t)})}},yt=e=>{if(!e)return null;if(e.tagName==="FORM"){new FormData(e);const t={formData:{},unmappedData:[]};return e.querySelectorAll("input, select, textarea").forEach(n=>{if(typeof n.value=="string"){const i=n.getAttribute(j.id);let o=n.getAttribute("name");const r={id:n.id,name:o,value:yt(n),required:n.required,validity:F(n.validity,!0),myopId:i};o?t.formData[o]?t.formData[o].value?t.unmappedData.push(r):(t.unmappedData.push(t.formData[o]),t.formData[o]=r):t.formData[o]=r:t.unmappedData.push(r)}}),t}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},Gs=class extends T{constructor(){super(...arguments),a(this,"messageType",m.GetElementValueMessage),a(this,"innerExecutor",(e,t,s)=>{A(e.ref,t.shadowRoot).forEach(i=>{s(new Ye(yt(i)),e)})})}},Js=class extends T{constructor(){super(...arguments),a(this,"messageType",m.SetInnerHtml),a(this,"innerExecutor",(e,t)=>{A(e.ref,t.shadowRoot).forEach(n=>{n.innerHTML=e.content})})}},wt=class extends Ts{constructor(){super(...arguments),a(this,"alwaysPassEnvelopesToHost",!0),a(this,"connectedCallback",(e,t)=>{e.addEventListener(mt.webcomponent_message_key,s=>{const n=s.data?s.data:s.detail;if(!n||!n.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{const i=n;if(this.handleIncomeMessages(s),i.messageType===m.InitMessage){const o=i.content.id;this.components[o].context=new Bs(e,t)}}}),setTimeout(()=>{this.messageToHost(new Qe)},1)}),a(this,"messageToHost",(e,t)=>{e.direction=E.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)}),a(this,"supportedHandlers",[new Vs(this.messageToHost,this.components),new Js(this.messageToHost,this.components),new As(this.messageToHost,this.components),new Ks(this.messageToHost,this.components),new zs(this.messageToHost,this.components),new Us(this.messageToHost,this.components),new Ws(this.messageToHost,this.components),new Gs(this.messageToHost,this.components),new qs(this.messageToHost,this.components)]),a(this,"init",()=>{})}};Be("WebComponentSDK",wt);var vt=[],X,Mt=()=>w(void 0,null,function*(){return X||(X=new wt,X.init()),X});function Ys(e,t){return class extends HTMLElement{connectedCallback(){const s=t===ye.open?"open":"closed",n=this.attachShadow({mode:s});Mt().then(i=>{i.connectedCallback(this,n),n.innerHTML=e})}}}var Xs=(e,t,s)=>{customElements.define(e,Ys(t,s)),console.log(`define('${e}') was called, web component ready to use`)},Qs=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\d+)/g,"-$1").toLowerCase(),Zs=e=>(e=Qs(e),e.replace(/_/g,"-")),en=class extends _e{constructor(){super(...arguments),a(this,"type",ge.HTMLLoader),a(this,"load",(e,t,s,n)=>w(this,null,function*(){const i=t.loader;let o=`myop-comp-${L()}`,r;if(i.shadowRootMode===ye.localFrame){const l=`myop-comp-${L()}`;let d=document.createElement("iframe");s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),n!=null&&n.hidden&&(d.style.visibility="hidden"),d=this.appendChild(s,d,n),d.id=l,d.setAttribute("style",`
|
|
71
|
+
padding: 0;
|
|
72
|
+
margin: 0;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
border: none;
|
|
75
|
+
opacity: ${n!=null&&n.hidden?"0":"1"};
|
|
76
|
+
width: 100%;
|
|
77
|
+
height: 100%;
|
|
78
|
+
position: ${n!=null&&n.hidden?"absolute":"static"};
|
|
79
|
+
pointer-events: ${n!=null&&n.hidden?"none":"all"};
|
|
80
|
+
`),s.appendChild(d);const u=d.contentDocument||d.contentWindow.document;u.open(),u.writeln(i.HTML),u.writeln(`<script src="${window.myop.__ROOT_SDK_PUBLIC_URL__}"><\/script>
|
|
81
|
+
<script>
|
|
82
|
+
window.__federation__ =
|
|
83
|
+
{ ...window.__federation__,
|
|
84
|
+
//TODO : get from ENV at build time,
|
|
85
|
+
// inject value to module at build time
|
|
86
|
+
// today we doing so just for the CJS version
|
|
87
|
+
__public_path__ :'https://cdn.myop.dev/sdk/next',
|
|
88
|
+
...${JSON.stringify(window.__federation__)}};
|
|
89
|
+
const init = async () => {
|
|
90
|
+
const {IframeSDK} = (await window.myop.rootSDK.getIframeModule());
|
|
91
|
+
const sdk = new IframeSDK()
|
|
92
|
+
sdk.init();
|
|
93
|
+
}
|
|
94
|
+
init().then();
|
|
95
|
+
<\/script>`),u.close();const h=new ft(e,t,s,d,n);return d.onload=()=>{h.observeSizeBasedOnDocumentElement()},h}if(i.shadowRootMode===ye.none){const c=document.createElement("template");c.innerHTML=i.HTML,r=c.content.firstElementChild,Mt().then(l=>{l.connectedCallback(r,r)})}else{const c=Zs(e.name+t.id);vt.includes(c)||(Xs(c,i.HTML,i.shadowRootMode),vt.push(c)),r=document.createElement(c)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),r.id=o,n!=null&&n.hidden&&(r.style.opacity="0",r.style.position="absolute",r.style.height="0",r.style.width="0",r.style.pointerEvents="none",r.style.visibility="hidden"),this.appendChild(s,r,n),new gt(e,t,s,r,n)}))}},_t="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",Q=class{constructor(){a(this,"components2init",[]),a(this,"components",[]),a(this,"componentsLoaders",[]),a(this,"initiated",!1),a(this,"version",Fs),a(this,"type2InstanceCount",{}),a(this,"assignId",e=>(this.type2InstanceCount[e.id]||(this.type2InstanceCount[e.id]=0),`${e.id}_${++this.type2InstanceCount[e.id]}`)),a(this,"inspected",!1),a(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(e=>{e.inspect&&e.inspect()}))}),a(this,"incomingMessageHandler",e=>{if(e.origin,document.location.origin,e.data.myop){if(e.data.direction!==E.up&&e.data.messageType!==m.EnvelopedMessage)return;const t=e.data;if(t.messageType===m.InitRequest){this.components2init.forEach(n=>{n.send(new pe(n.id))});return}if(t.messageType===m.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==t.content.id);const n=this.components.find(i=>{var o;return i.id===((o=t.content)==null?void 0:o.id)});n==null||n.setInitiated();return}if(t.messageType===m.EnvelopedMessage){const n=t,i=this.components.find(o=>o.id===n.destination);if(i){if(n.direction===E.down){n.message.messageType===k.name?i.onMessageReceived(n.message):(n.message.route=n.route,i.send(n.message));return}}else{const o=this.components.find(r=>r.id===n.message.destination);o&&o.send(n.message)}return}const s=this.components.find(n=>n.id===t.destination);if(!s){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t);return}if(s){if(s.onMessageReceived(t))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t)}}}),a(this,"send",e=>{const t=new MessageEvent("",{data:e});this.incomingMessageHandler(t)}),a(this,"init",e=>{if(this.initiated)throw new Error("hostSDK already initiated");const t=[new Ps,new Ls,new en];if(this.componentsLoaders=[...t],e){const s={};e.forEach(n=>{const i=new n(this.componentsLoaders);s[i.type]=i}),this.componentsLoaders.forEach(n=>{s[n.type]||(s[n.type]=n)}),this.componentsLoaders=Object.values(s)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0}),a(this,"_getSkinIdBySkinSelector",(e,...t)=>w(this,[e,...t],function*(s,n=[],i){var o;function r(c,l){return w(this,null,function*(){for(const d of c)if(yield l(d))return d})}switch(s.type){case"DedicatedSkin":case ve.Dedicated:return((o=s.skin)==null?void 0:o.id)||s.skins[0].id;case ve.Segmented:{const l=yield r(s.segments,d=>w(this,null,function*(){if(d.segmentId==="Default")return!0;const u=n.find(J=>J.type===xs.Segment?J.segment.id===d.segmentId:!1);if(!u)throw new Error("experience not found");const g=u.segment,_=(i||{})[g.function];return _?yield _():(console.warn(`segmentId:${d.segmentId}, ${g.function} function not provided !`),!1)}));if(l)return this._getSkinIdBySkinSelector(l.skinSelector,n);debugger}break;default:debugger}return""})),a(this,"runSkinSelector",(e,t)=>w(this,null,function*(){const s=yield this._getSkinIdBySkinSelector(e.instance.skinSelector,e.instance.resolvedExperiences,t);return e.type.skins.find(n=>n.id===s)})),a(this,"loaderHooks"),a(this,"loadComponent",(e,t,s)=>w(this,null,function*(){var n,i,o,r;if(!t){debugger;throw new Error("no container was found for this component")}const c=t;if(c.myop)if(c.component){e=y({},e),e.instance=y({},e.instance);const h=y(y({},(n=this.loaderHooks)!=null?n:{}),(i=s==null?void 0:s.hooks)!=null?i:{});let g=yield this.runSkinSelector(e,h);if(!g)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(o=s==null?void 0:s.hooks)!=null&&o.afterSkinSelected&&(g=yield s.hooks.afterSkinSelected(y({},g))),e.instance.skinSelector={type:ve.Dedicated,skin:g},s&&(s=y({},s),delete s.hooks),yield ht(c,e,this.components,s)}else throw new Error("load component got a detached ref.");t=t;let l=yield this.runSkinSelector(e,s==null?void 0:s.hooks);if(!l)throw new Error("runSkinSelector failed to choose skin, check the provided config");(r=s==null?void 0:s.hooks)!=null&&r.afterSkinSelected&&(l=yield s.hooks.afterSkinSelected(y({},l)));const d=this.componentsLoaders.find(h=>h.type===l.loader.type);if(!d){debugger;throw new Error(`no loader "${l.loader.type}" was found for component`)}let u=yield d.load(e.type,l,t,s);u.isInitiated||this.components2init.push(u),u.bind("onDispose",()=>(this.components=this.components.filter(h=>h!==u),this.components2init=this.components2init.filter(h=>h!==u),!0)),this.components.push(u),s!=null&&s.connectProps&&(u=Ds(u,e.type.props));try{yield pt(u,e,this.components)}catch(h){throw h}return s!=null&&s.skipInit||(yield u.initiated()),u})),a(this,"navigate",(e,t,s)=>w(this,null,function*(){if(e.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(s!=null&&s.staged){let n=yield this.loadComponent(t,e.container,y({hidden:!0,relative:{direction:"after",child:e.element}},s));return s.init&&(yield s.init(n)),n.show(),e.dispose(),n}else{const n=e.element.nextSibling;return e.dispose(),this.loadComponent(t,e.container,y({relative:{direction:"before",child:n}},s))}}))}};if(a(Q,"Instance",()=>window.myop.hostSDK),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:_t}),!window.myop.hostSDK){const e=new Q;e.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:_t}),window.myop.hostSDK=e}var Et=window.myop.hostSDK;Be("hostSDK",Et);/**
|
|
96
|
+
* @vue/shared v3.5.17
|
|
97
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
98
|
+
* @license MIT
|
|
99
|
+
**/const tn=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const bt=()=>{},sn=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),be=Object.assign,b=Array.isArray,C=e=>typeof e=="function",O=e=>typeof e=="string",nn=e=>typeof e=="symbol",W=e=>e!==null&&typeof e=="object",on=e=>(W(e)||C(e))&&C(e.then)&&C(e.catch),Ct=e=>{const t=Object.create(null);return s=>t[s]||(t[s]=e(s))},rn=Ct(e=>e.charAt(0).toUpperCase()+e.slice(1)),an=Ct(e=>e?`on${rn(e)}`:"");let St;const Z=()=>St||(St=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ce(e){if(b(e)){const t={};for(let s=0;s<e.length;s++){const n=e[s],i=O(n)?un(n):Ce(n);if(i)for(const o in i)t[o]=i[o]}return t}else if(O(e)||W(e))return e}const cn=/;(?![^(]*\))/g,ln=/:([^]+)/,dn=/\/\*[^]*?\*\//g;function un(e){const t={};return e.replace(dn,"").split(cn).forEach(s=>{if(s){const n=s.split(ln);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function Se(e){let t="";if(O(e))t=e;else if(b(e))for(let s=0;s<e.length;s++){const n=Se(e[s]);n&&(t+=n+" ")}else if(W(e))for(const s in e)e[s]&&(t+=s+" ");return t.trim()}/**
|
|
100
|
+
* @vue/reactivity v3.5.17
|
|
101
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
102
|
+
* @license MIT
|
|
103
|
+
**/Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),Symbol(process.env.NODE_ENV!=="production"?"Array iterate":""),new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(nn));function Ie(e){return e?!!e.__v_raw:!1}function ee(e){const t=e&&e.__v_raw;return t?ee(t):e}function It(e){return e?e.__v_isRef===!0:!1}/**
|
|
104
|
+
* @vue/runtime-core v3.5.17
|
|
105
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
106
|
+
* @license MIT
|
|
107
|
+
**/const P=[];function hn(e){P.push(e)}function pn(){P.pop()}let Te=!1;function D(e,...t){if(Te)return;Te=!0;const s=P.length?P[P.length-1].component:null,n=s&&s.appContext.config.warnHandler,i=fn();if(n)te(n,s,11,[e+t.map(o=>{var r,c;return(c=(r=o.toString)==null?void 0:r.call(o))!=null?c:JSON.stringify(o)}).join(""),s&&s.proxy,i.map(({vnode:o})=>`at <${Kt(s,o.type)}>`).join(`
|
|
108
|
+
`),i]);else{const o=[`[Vue warn]: ${e}`,...t];i.length&&o.push(`
|
|
109
|
+
`,...mn(i)),console.warn(...o)}Te=!1}function fn(){let e=P[P.length-1];if(!e)return[];const t=[];for(;e;){const s=t[0];s&&s.vnode===e?s.recurseCount++:t.push({vnode:e,recurseCount:0});const n=e.component&&e.component.parent;e=n&&n.vnode}return t}function mn(e){const t=[];return e.forEach((s,n)=>{t.push(...n===0?[]:[`
|
|
110
|
+
`],...gn(s))}),t}function gn({vnode:e,recurseCount:t}){const s=t>0?`... (${t} recursive calls)`:"",n=e.component?e.component.parent==null:!1,i=` at <${Kt(e.component,e.type,n)}`,o=">"+s;return e.props?[i,...yn(e.props),o]:[i+o]}function yn(e){const t=[],s=Object.keys(e);return s.slice(0,3).forEach(n=>{t.push(...Tt(n,e[n]))}),s.length>3&&t.push(" ..."),t}function Tt(e,t,s){return O(t)?(t=JSON.stringify(t),s?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?s?t:[`${e}=${t}`]:It(t)?(t=Tt(e,ee(t.value),!0),s?t:[`${e}=Ref<`,t,">"]):C(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=ee(t),s?t:[`${e}=`,t])}const xe={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function te(e,t,s,n){try{return n?e(...n):e()}catch(i){Re(i,t,s)}}function xt(e,t,s,n){if(C(e)){const i=te(e,t,s,n);return i&&on(i)&&i.catch(o=>{Re(o,t,s)}),i}if(b(e)){const i=[];for(let o=0;o<e.length;o++)i.push(xt(e[o],t,s,n));return i}else process.env.NODE_ENV!=="production"&&D(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof e}`)}function Re(e,t,s,n=!0){const i=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:r}=t&&t.appContext.config||tn;if(t){let c=t.parent;const l=t.proxy,d=process.env.NODE_ENV!=="production"?xe[s]:`https://vuejs.org/error-reference/#runtime-${s}`;for(;c;){const u=c.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](e,l,d)===!1)return}c=c.parent}if(o){te(o,null,10,[e,l,d]);return}}wn(e,s,i,n,r)}function wn(e,t,s,n=!0,i=!1){if(process.env.NODE_ENV!=="production"){const o=xe[t];if(s&&hn(s),D(`Unhandled error${o?` during execution of ${o}`:""}`),s&&pn(),n)throw e;console.error(e)}else{if(i)throw e;console.error(e)}}const M=[];let x=-1;const V=[];let N=null,B=0;const vn=Promise.resolve();let He=null;const Mn=100;function _n(e){let t=x+1,s=M.length;for(;t<s;){const n=t+s>>>1,i=M[n],o=G(i);o<e||o===e&&i.flags&2?t=n+1:s=n}return t}function En(e){if(!(e.flags&1)){const t=G(e),s=M[M.length-1];!s||!(e.flags&2)&&t>=G(s)?M.push(e):M.splice(_n(t),0,e),e.flags|=1,Rt()}}function Rt(){He||(He=vn.then(Ht))}function bn(e){b(e)?V.push(...e):N&&e.id===-1?N.splice(B+1,0,e):e.flags&1||(V.push(e),e.flags|=1),Rt()}function Cn(e){if(V.length){const t=[...new Set(V)].sort((s,n)=>G(s)-G(n));if(V.length=0,N){N.push(...t);return}for(N=t,process.env.NODE_ENV!=="production"&&(e=e||new Map),B=0;B<N.length;B++){const s=N[B];process.env.NODE_ENV!=="production"&&kt(e,s)||(s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2)}N=null,B=0}}const G=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Ht(e){process.env.NODE_ENV!=="production"&&(e=e||new Map);const t=process.env.NODE_ENV!=="production"?s=>kt(e,s):bt;try{for(x=0;x<M.length;x++){const s=M[x];if(s&&!(s.flags&8)){if(process.env.NODE_ENV!=="production"&&t(s))continue;s.flags&4&&(s.flags&=-2),te(s,s.i,s.i?15:14),s.flags&4||(s.flags&=-2)}}}finally{for(;x<M.length;x++){const s=M[x];s&&(s.flags&=-2)}x=-1,M.length=0,Cn(e),He=null,(M.length||V.length)&&Ht(e)}}function kt(e,t){const s=e.get(t)||0;if(s>Mn){const n=t.i,i=n&&Bt(n.type);return Re(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return e.set(t,s+1),!1}const ke=new Map;process.env.NODE_ENV!=="production"&&(Z().__VUE_HMR_RUNTIME__={createRecord:Oe(Sn),rerender:Oe(In),reload:Oe(Tn)});const se=new Map;function Sn(e,t){return se.has(e)?!1:(se.set(e,{initialDef:ne(t),instances:new Set}),!0)}function ne(e){return zt(e)?e.__vccOpts:e}function In(e,t){const s=se.get(e);s&&(s.initialDef.render=t,[...s.instances].forEach(n=>{t&&(n.render=t,ne(n.type).render=t),n.renderCache=[],n.update()}))}function Tn(e,t){const s=se.get(e);if(!s)return;t=ne(t),Ot(s.initialDef,t);const n=[...s.instances];for(let i=0;i<n.length;i++){const o=n[i],r=ne(o.type);let c=ke.get(r);c||(r!==s.initialDef&&Ot(r,t),ke.set(r,c=new Set)),c.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(c.add(o),o.ceReload(t.styles),c.delete(o)):o.parent?En(()=>{o.parent.update(),c.delete(o)}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(r)}bn(()=>{ke.clear()})}function Ot(e,t){be(e,t);for(const s in e)s!=="__file"&&!(s in t)&&delete e[s]}function Oe(e){return(t,s)=>{try{return e(t,s)}catch(n){console.error(n),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let K,ie=[];function Dt(e,t){var s,n;K=e,K?(K.enabled=!0,ie.forEach(({event:i,args:o})=>K.emit(i,...o)),ie=[]):typeof window<"u"&&window.HTMLElement&&!((n=(s=window.navigator)==null?void 0:s.userAgent)!=null&&n.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{Dt(o,t)}),setTimeout(()=>{K||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,ie=[])},3e3)):ie=[]}let oe=null,xn=null;const Rn=e=>e.__isTeleport;function Nt(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Nt(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}Z().requestIdleCallback,Z().cancelIdleCallback;function Hn(e,t,s=ce,n=!1){if(s){const i=s[e]||(s[e]=[]),o=t.__weh||(t.__weh=(...r)=>{const c=qn(s),l=xt(t,s,e,r);return c(),l});return n?i.unshift(o):i.push(o),o}else if(process.env.NODE_ENV!=="production"){const i=an(xe[e].replace(/ hook$/,""));D(`${i} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const kn=(e=>(t,s=ce)=>{(!Vt||e==="sp")&&Hn(e,(...n)=>t(...n),s)})("u"),On=Symbol.for("v-ndc"),Dn={};process.env.NODE_ENV!=="production"&&(Dn.ownKeys=e=>(D("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(e)));const Nn={},$t=e=>Object.getPrototypeOf(e)===Nn,$n=e=>e.__isSuspense,Pt=Symbol.for("v-fgt"),Pn=Symbol.for("v-txt"),Ln=Symbol.for("v-cmt");function Fn(e){return e?e.__v_isVNode===!0:!1}const An=(...e)=>Ft(...e),Lt=({key:e})=>e??null,re=({ref:e,ref_key:t,ref_for:s})=>(typeof e=="number"&&(e=""+e),e!=null?O(e)||It(e)||C(e)?{i:oe,r:e,k:t,f:!!s}:e:null);function Vn(e,t=null,s=null,n=0,i=null,o=e===Pt?0:1,r=!1,c=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Lt(t),ref:t&&re(t),scopeId:xn,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:n,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:oe};return c?(De(l,s),o&128&&e.normalize(l)):s&&(l.shapeFlag|=O(s)?8:16),process.env.NODE_ENV!=="production"&&l.key!==l.key&&D("VNode created with invalid key (NaN). VNode type:",l.type),l}const Bn=process.env.NODE_ENV!=="production"?An:Ft;function Ft(e,t=null,s=null,n=0,i=null,o=!1){if((!e||e===On)&&(process.env.NODE_ENV!=="production"&&!e&&D(`Invalid vnode type when creating vnode: ${e}.`),e=Ln),Fn(e)){const c=ae(e,t,!0);return s&&De(c,s),c.patchFlag=-2,c}if(zt(e)&&(e=e.__vccOpts),t){t=Kn(t);let{class:c,style:l}=t;c&&!O(c)&&(t.class=Se(c)),W(l)&&(Ie(l)&&!b(l)&&(l=be({},l)),t.style=Ce(l))}const r=O(e)?1:$n(e)?128:Rn(e)?64:W(e)?4:C(e)?2:0;return process.env.NODE_ENV!=="production"&&r&4&&Ie(e)&&(e=ee(e),D("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
|
|
111
|
+
Component that was made reactive: `,e)),Vn(e,t,s,n,i,r,o,!0)}function Kn(e){return e?Ie(e)||$t(e)?be({},e):e:null}function ae(e,t,s=!1,n=!1){const{props:i,ref:o,patchFlag:r,children:c,transition:l}=e,d=t?Un(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&Lt(d),ref:t&&t.ref?s&&o?b(o)?o.concat(re(t)):[o,re(t)]:re(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:process.env.NODE_ENV!=="production"&&r===-1&&b(c)?c.map(At):c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Pt?r===-1?16:r|16:r,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ae(e.ssContent),ssFallback:e.ssFallback&&ae(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&n&&Nt(u,l.clone(u)),u}function At(e){const t=ae(e);return b(e.children)&&(t.children=e.children.map(At)),t}function zn(e=" ",t=0){return Bn(Pn,null,e,t)}function De(e,t){let s=0;const{shapeFlag:n}=e;if(t==null)t=null;else if(b(t))s=16;else if(typeof t=="object")if(n&65){const i=t.default;i&&(i._c&&(i._d=!1),De(e,i()),i._c&&(i._d=!0));return}else s=32,!t._&&!$t(t)&&(t._ctx=oe);else C(t)?(t={default:t,_ctx:oe},s=32):(t=String(t),n&64?(s=16,t=[zn(t)]):s=8);e.children=t,e.shapeFlag|=s}function Un(...e){const t={};for(let s=0;s<e.length;s++){const n=e[s];for(const i in n)if(i==="class")t.class!==n.class&&(t.class=Se([t.class,n.class]));else if(i==="style")t.style=Ce([t.style,n.style]);else if(sn(i)){const o=t[i],r=n[i];r&&o!==r&&!(b(o)&&o.includes(r))&&(t[i]=o?[].concat(o,r):r)}else i!==""&&(t[i]=n[i])}return t}let ce=null,Ne;{const e=Z(),t=(s,n)=>{let i;return(i=e[s])||(i=e[s]=[]),i.push(n),o=>{i.length>1?i.forEach(r=>r(o)):i[0](o)}};Ne=t("__VUE_INSTANCE_SETTERS__",s=>ce=s),t("__VUE_SSR_SETTERS__",s=>Vt=s)}const qn=e=>{const t=ce;return Ne(e),e.scope.on(),()=>{e.scope.off(),Ne(t)}};let Vt=!1;process.env.NODE_ENV;const jn=/(?:^|[-_])(\w)/g,Wn=e=>e.replace(jn,t=>t.toUpperCase()).replace(/[-_]/g,"");function Bt(e,t=!0){return C(e)?e.displayName||e.name:e.name||t&&e.__name}function Kt(e,t,s=!1){let n=Bt(t);if(!n&&t.__file){const i=t.__file.match(/([^/\\]+)\.\w+$/);i&&(n=i[1])}if(!n&&e&&e.parent){const i=o=>{for(const r in o)if(o[r]===t)return r};n=i(e.components||e.parent.type.components)||i(e.appContext.components)}return n?Wn(n):s?"App":"Anonymous"}function zt(e){return C(e)&&"__vccOpts"in e}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;const Gn=f.defineComponent({inheritAttrs:!0,__name:"MyopVueComponent",props:{flowId:{},componentId:{},onReady:{type:Function}},setup(e,{expose:t}){const s=e,n=f.useAttrs(),i=f.useSlots(),o=f.ref(null),r=f.ref(!0),c=f.ref(null),l=f.ref(null),d=f.getCurrentInstance(),u=f.ref(null);kn(()=>{l&&l.value&&l.value(n)}),f.onMounted(async()=>{if(o.value){const g=await Zt.Main.fetchComponent(s.componentId,s.flowId);c.value=await Et.loadComponent(g,o==null?void 0:o.value,{_environment:{props:n,slots:i,context:d==null?void 0:d.appContext,vueContainerRef:o,defineUpdater:_=>{l.value=_},defineInnerVueComponentRef:_=>{u.value=_.value}}}),r.value=!1,s.onReady&&s.onReady(c.value,u.value)}});const h=f.reactive({});return t(h),f.watchEffect(()=>{Object.assign(h,u.value)}),(g,_)=>(f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",f.mergeProps(f.unref(n),{ref_key:"myopContainer",ref:o}),null,16),r.value?f.renderSlot(g.$slots,"loading",{key:0}):f.createCommentVNode("",!0)],64))}});$.MyopContainer=Gn,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|