import{an as u,h as d,ao as p,ap as h}from"./vendor-vue-ui.7850d25d.js";import{l as f}from"./app-core.0df0f3ff.js";import{l as b}from"./index.c514abbf.js";import{l as y}from"./index.d2306f7f.js";import{i as B}from"./helpers.abd75c5e.js";let a=null,l=null,c=null;class _{mountComponent=({name:n,component:e,rootContainer:t,data:i={},props:r={},useRouter:m=!1})=>{let s=null,o=u({name:n,data(){return i},render:()=>d(e,{...r})});return o=b(o),o=y(o),m&&(s=p({history:h(),routes:[{path:"/:pathMatch(.*)*",component:e}]}),o.use(s),s.app=o),f(o,s),o.mount(t),o};constructor(n){this.scoreBtn=n?.scoreBtn,this.limitModifiedDate=n?.limitModifiedDate,this.metabox=n?.metabox,this.injectStyles=n?.injectStyles,this.createElement=(e,t)=>{const i=document.createElement(e);for(const r in t)i.setAttribute(r,t[r]);return i},this.mountScoreBtn=()=>{if(this.scoreBtn){if(!this.scoreBtn.node.$wrapper.querySelector(`#${this.scoreBtn.node.attributes.id}`)){const e=this.createElement(this.scoreBtn.node.tag,this.scoreBtn.node.attributes);this.scoreBtn.node.$after?this.scoreBtn.node.$after.after(e):this.scoreBtn.node.$wrapper.insertAdjacentElement("beforeend",e)}a?.unmount(),a=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.mount=async()=>{if(this.mountScoreBtn(),this.limitModifiedDate){const e=t=>{t&&(t.querySelector(`#${this.limitModifiedDate.node.attributes.id}`)||t.insertAdjacentElement("beforeend",this.createElement(this.limitModifiedDate.node.tag,{...this.limitModifiedDate.node.attributes,class:this.limitModifiedDate.node.attributes?.class??t.querySelector('[role="menuitem"]')?.classList.value})),l?.unmount(),l=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(e):e(this.limitModifiedDate.node.$wrapper)}this.metabox&&(c?.unmount(),c=this.mountComponent({name:this.metabox.appName,component:this.metabox.component,rootContainer:this.metabox.rootContainer||"#aioseo-modal-portal",data:{tableContext:window.aioseo.currentPost.context,screenContext:this.metabox.screenContext||"metabox"},useRouter:!0})),this.injectStyles&&document.querySelectorAll('link[href*="all-in-one-seo-pack"]').forEach(t=>{B(t.href,t.id)})}}}export{_ as P};
