import{o as h,a as u,p as m,d as f,af as s,V as g}from"./app-bWy6VYs1.js";const v="vue-email-editor",E="2.1.5",l={name:v,version:E},y="https://editor.unlayer.com/embed.js?2",d=[];let c=!1;const b=t=>{const e=document.querySelectorAll("script");let i=!1;return e.forEach(r=>{r.src.includes(t)&&(i=!0)}),i},j=t=>{d.push(t)},n=()=>{if(c){let t;for(;t=d.shift();)t()}},S=(t,e=y)=>{if(j(t),b(e))n();else{const i=document.createElement("script");i.setAttribute("src",e),i.onload=()=>{c=!0,n()},document.head.appendChild(i)}};let I=0;const H=f({name:"EmailEditor",props:{editorId:String,minHeight:{type:String,default:"500px"},options:{type:Object,default:()=>({})},scriptUrl:String,appearance:Object,locale:String,projectId:Number,tools:Object},computed:{id(){return this.editorId||`editor-${++I}`}},setup(){return{editor:g(null),createSerializedEditor:t=>t?{...t,registerCallback:(e,i)=>{t.registerCallback(e,(r,o)=>{i(r,a=>{const p=s(a);o(p)})})}}:null}},mounted(){S(this.loadEditor.bind(this),this.scriptUrl)},methods:{loadEditor(){var t;const e=s(this.options)||{};this.appearance&&(e.appearance=s(this.appearance)),this.locale&&(e.locale=this.locale),this.projectId&&(e.projectId=this.projectId),this.tools&&(e.tools=s(this.tools));const i=unlayer.createEditor({...e,id:this.id,source:{name:l.name,version:l.version}});this.editor=this.createSerializedEditor(i),this.$emit("load"),(t=this.editor)==null||t.addEventListener("editor:ready",()=>{this.$emit("ready")})},exportHtml(t){var e;(e=this.editor)==null||e.exportHtml(t)},loadDesign(t){var e;(e=this.editor)==null||e.loadDesign(t)},saveDesign(t){var e;(e=this.editor)==null||e.saveDesign(t)}}}),x=(t,e)=>{const i=t.__vccOpts||t;for(const[r,o]of e)i[r]=o;return i},C=["id"];function O(t,e,i,r,o,a){return h(),u("div",{id:t.id,class:"unlayer-editor",style:m({minHeight:t.minHeight})},null,12,C)}const z=x(H,[["render",O],["__scopeId","data-v-95d7283d"]]);export{z as EmailEditor};
