import{ap as u,h as d,aq as p,ar as f}from"./vendor-vue-ui.02763c14.js";import{l as h}from"./app-core.82d0a9b8.js";import{l as y}from"./index.01468dbf.js";import{l as b}from"./index.aa890c6d.js";import{i as M}from"./helpers.dd0df28e.js";let l=null,c=null,m=null;class _{mountComponent=({name:i,component:n,rootContainer:o,data:t={},props:r={},useRouter:s=!1})=>{let e=u({name:i,data(){return t},render:()=>d(n,{...r})});if(e=y(e),e=b(e),s){const a=p({history:f(),routes:[{path:"/:pathMatch(.*)*",component:n}]});e.use(a),a.app=e}return h(e),e.mount(o),e};constructor(i){this.scoreBtn=i?.scoreBtn,this.limitModifiedDate=i?.limitModifiedDate,this.metabox=i?.metabox,this.injectStyles=i?.injectStyles,this.mount=async()=>{const n=(o,t)=>{const r=document.createElement(o);for(const s in t)r.setAttribute(s,t[s]);return r};if(this.scoreBtn&&(this.scoreBtn.node.$wrapper.querySelector(`#${this.scoreBtn.node.attributes.id}`)||this.scoreBtn.node.$wrapper.insertAdjacentElement("beforeend",n(this.scoreBtn.node.tag,this.scoreBtn.node.attributes)),l?.unmount(),l=this.mountComponent({name:this.scoreBtn.appName,component:this.scoreBtn.component,rootContainer:this.scoreBtn.node.$wrapper.querySelector(`#${this.scoreBtn.node.attributes.id}`),props:{onClick(){document.dispatchEvent(new Event("aioseo-pagebuilder-toggle-modal"))}}})),this.limitModifiedDate){const o=t=>{t&&(t.querySelector(`#${this.limitModifiedDate.node.attributes.id}`)||t.insertAdjacentElement("beforeend",n(this.limitModifiedDate.node.tag,{...this.limitModifiedDate.node.attributes,class:this.limitModifiedDate.node.attributes?.class||t.querySelector('[role="menuitem"]')?.classList.value})),c?.unmount(),c=this.mountComponent({name:this.limitModifiedDate.appName,component:this.limitModifiedDate.component,rootContainer:t.querySelector(`#${this.limitModifiedDate.node.attributes.id}`),props:this.limitModifiedDate?.props||{}}))};this.limitModifiedDate.node?.mountLater?this.limitModifiedDate.node.mountLater(o):o(this.limitModifiedDate.node.$wrapper)}this.metabox&&(m?.unmount(),m=this.mountComponent({name:this.metabox.appName,component:this.metabox.component,rootContainer:"#aioseo-modal-portal",data:{tableContext:window.aioseo.currentPost.context,screenContext:"metabox"},useRouter:!0})),this.injectStyles&&document.querySelectorAll('link[href*="all-in-one-seo-pack"]').forEach(t=>{M(t.href,t.id)})}}}export{_ as P};
