관리-도구
편집 파일: Seoboost.5c950c16.js
import{a as x,_ as W}from"./Caret.662da1f3.js";import{d as C,h as p,H as k}from"./index.5a710757.js";import{j as b}from"./helpers.f95d5840.js";import"./translations.12335a6a.js";import{e as A}from"./escapeRegex.e4a2b75d.js";import{l as K,n as R}from"./helpers.b97d7047.js";import{_ as o}from"./default-i18n.54b5d8cd.js";import{w as v,o as d,c as f,F as B,a as h,u as c,x as y,t as u,b as w,C as L,l as T,k as D,G as E}from"./runtime-dom.esm-bundler.6789c400.js";function F(t,e,s,r){if(typeof t[s]=="number"){if(r==="asc")return t[s]-e[s];if(r==="desc")return e[s]-t[s]}if(typeof t[s]=="string"){if(r==="asc")return t[s].localeCompare(e[s],"en",{sensitivity:"base"});if(r==="desc")return e[s].localeCompare(t[s],"en",{sensitivity:"base"})}return 0}const a="all-in-one-seo-pack",O=C("WritingAssistantStore",{state:()=>({loaded:!1,keywordText:"",report:{},contentAnalysis:{},analyzingContent:!1,error:null,processing:!1,polling:!1,postId:0,progress:{percent:0,text:""},progressRunning:!1,sortFilters:{optimizationWizard:{slug:"importance",sortDir:"desc",perPage:10,page:1,search:""},competitors:{slug:"googlePosition",sortDir:"asc",perPage:10,page:1,search:""}},seoBoost:{isLoggedIn:!1,loginUrl:""},userInfo:{},updating:{userInfo:!1,reportHistory:!1},reportHistory:[]}),getters:{isProcessing:t=>{var e,s;return(e=t.report)!=null&&e.uuid&&!t.error?parseInt((s=t.report)==null?void 0:s.progress)!==100:t.processing},processDone:t=>{var e;return parseInt((e=t.report)==null?void 0:e.progress)===100},getCompetitors:t=>t.report.competitors.competitors||[],getCompetitorsSearched:t=>{const e=t.sortFilters.competitors.search.toLowerCase();return t.getCompetitors.filter(s=>s.url.toLowerCase().includes(e)||s.title.toLowerCase().includes(e))},getCompetitorsPaged:t=>{const e=(t.sortFilters.competitors.page-1)*t.sortFilters.competitors.perPage,s=e+t.sortFilters.competitors.perPage;return t.getCompetitorsSearched.slice(e,s)},getCompetitorsPages:t=>Math.ceil(t.getCompetitorsSearched.length/t.sortFilters.competitors.perPage),getKeywordCompetitorsSummary:t=>t.report.competitors.summary||[],getKeywords:t=>t.report.keywords||[],getKeywordsSearched:t=>{const e=t.sortFilters.optimizationWizard.search.toLowerCase();return t.getKeywords.filter(s=>s.text.toLowerCase().includes(e))},getKeywordsPaged:t=>{const e=(t.sortFilters.optimizationWizard.page-1)*t.sortFilters.optimizationWizard.perPage,s=e+t.sortFilters.optimizationWizard.perPage;return t.getKeywordsSearched.slice(e,s)},getKeywordsPages:t=>Math.ceil(t.getKeywordsSearched.length/t.sortFilters.optimizationWizard.perPage),getContentAnalysis:t=>t.contentAnalysis||[],hasReport:t=>{var e;return t.report&&parseInt((e=t.report)==null?void 0:e.progress)===100}},actions:{processKeyword({keyword:t,country:e,language:s}){this.processing||(this.processing=!0,this.setReportProgress(0),this.error=null,p.post("/writing-assistant/process").send({postId:this.postId,keyword:t,country:e,language:s}).then(r=>{if(r.body.success===!1){this.processing=!1,this.error=r.body.error;return}this.keywordText=t,this.setReportProgress(5,o("processing keyword",a)+"..."),this.resetTables(),this.pollKeyword()}))},pollKeyword(){this.processing=!0,this.polling=!0,this.error=null,p.get("/writing-assistant/keyword/"+this.postId).then(t=>{var e;if(((e=t.body)==null?void 0:e.success)===!1){this.processing=!1,this.polling=!1,this.error=t.body.error,this.report={};return}if(this.startReportProgress(t.body.progress),parseInt(t.body.progress)===100){this.updateUserInfo(),this.updateReportHistory(),this.report=t.body||[],setTimeout(()=>{this.polling=!1,this.processing=!1,window.aioseoBus.$emit("writingAssistantAnalyzeContent")},2e3);return}setTimeout(()=>{this.pollKeyword()},8e3)})},openReport(t,e,s){this.processKeyword({keyword:t,country:e,language:s})},async analyzeContent(t){return this.analyzingContent?Promise.resolve():(this.analyzingContent=!0,p.post("/writing-assistant/content-analysis").send({title:K(),description:R(),content:t,postId:this.postId}).then(e=>{this.analyzingContent=!1,this.contentAnalysis=e.body||{}}))},async countContentKeywords(t){return!t||!this.getKeywords.length||(t=t.replace(/(<([^>]+)>)/gi," "),this.getKeywords.forEach(e=>{var s;e.contentCount=((s=t.match(new RegExp("\\b"+A(e.text)+"\\b","gmi")))==null?void 0:s.length)||0}),this.sortFilters.optimizationWizard.slug==="contentCount"&&this.doOptimizationWizardSort({slug:this.sortFilters.optimizationWizard.slug,order:this.sortFilters.optimizationWizard.sortDir})),Promise.resolve()},doOptimizationWizardSort(t){let e=(t==null?void 0:t.order)||"asc";!(t!=null&&t.order)&&t.slug===this.sortFilters.optimizationWizard.slug&&(e=this.sortFilters.optimizationWizard.sortDir==="asc"?"desc":"asc"),this.sortFilters.optimizationWizard.slug=t.slug,this.sortFilters.optimizationWizard.sortDir=e,this.getKeywords.sort((s,r)=>F(s,r,this.sortFilters.optimizationWizard.slug,this.sortFilters.optimizationWizard.sortDir))},doOptimizationWizardPerPage(t){this.sortFilters.optimizationWizard.page=1,this.sortFilters.optimizationWizard.perPage=t},doOptimizationWizardSearch(t){this.sortFilters.optimizationWizard.page=1,this.sortFilters.optimizationWizard.search=t},doCompetitorSort(t){let e="asc";t.slug===this.sortFilters.competitors.slug&&(e=this.sortFilters.competitors.sortDir==="asc"?"desc":"asc"),this.sortFilters.competitors.slug=t.slug,this.sortFilters.competitors.sortDir=e,this.getCompetitors.sort((s,r)=>F(s,r,this.sortFilters.competitors.slug,this.sortFilters.competitors.sortDir))},doCompetitorPerPage(t){this.sortFilters.competitors.page=1,this.sortFilters.competitors.perPage=t},doCompetitorSearch(t){this.sortFilters.competitors.page=1,this.sortFilters.competitors.search=t},newReport(){this.report={},this.contentAnalysis={},this.error=null},updateUserInfo(){this.updating.userInfo||(this.updating.userInfo=!0,p.get("/writing-assistant/user-info").then(t=>{var e;(e=t.body)!=null&&e.error||(this.userInfo=t.body||{}),this.updating.userInfo=!1}))},updateReportHistory(){this.updating.reportHistory||(this.updating.reportHistory=!0,p.get("/writing-assistant/report-history").then(t=>{var e;(e=t.body)!=null&&e.error||(this.reportHistory=t.body||{}),this.updating.reportHistory=!1}))},setUserLoggedIn(t){this.seoBoost.isLoggedIn=t,t&&(this.updateUserInfo(),this.isProcessing&&this.pollKeyword())},async startReportProgress(t){if(this.progressRunning)return;this.progressRunning=!0;const e=(i,n)=>Math.floor(Math.random()*(n-i+1)+i),s=[{percent:e(5,10),duration:2e3,text:o("querying search engines",a)+"..."},{percent:e(15,20),duration:5e3,text:o("fetching serps",a)+"..."},{percent:e(25,30),duration:6e3,text:o("analyzing serps",a)+"..."},{percent:e(35,40),duration:1e4,text:o("fetching competitor data",a)+"..."},{percent:e(45,50),duration:7e3,text:o("fetching keywords data",a)+"..."},{percent:e(55,60),duration:7e3,text:o("calculating keywords heading presence",a)+"..."},{percent:e(65,70),duration:7e3,text:o("calculating keywords use suggestions",a)+"..."},{percent:e(75,80),duration:7e3,text:o("calculating keywords importance",a)+"..."},{percent:e(85,90),duration:7e3,text:o("fetching keywords examples",a)+"..."},{percent:100,duration:1e3,text:o("fetching report",a)+"..."}];let r=0;for(const i of s.filter(n=>n.percent>=t))await new Promise(n=>{setTimeout(()=>{i.percent===100&&(i.percent=97,this.progressRunning=!1),this.setReportProgress(i.percent,i.text),t!==100&&p.post("/writing-assistant/set-report-progress").send({postId:this.postId,progress:i.percent}).then(g=>g.body),n()},r),r=i.duration})},setReportProgress(t,e="",s=0){setTimeout(()=>{this.progress.percent=t,this.progress.text=e},s)},resetTables(){this.sortFilters.optimizationWizard={slug:"importance",sortDir:"desc",perPage:10,page:1,search:""},this.sortFilters.competitors={slug:"googlePosition",sortDir:"asc",perPage:10,page:1,search:""}}}}),H=""+window.__aioseoDynamicImportPreload__("svg/login.ef411bdf.svg"),U=""+window.__aioseoDynamicImportPreload__("svg/icon-logo.3654cf89.svg"),N=["src"],M={class:"aioseo-seoboost-login__title"},V=h("br",null,null,-1),$={class:"aioseo-seoboost-login__description"},j=["src"],st={__name:"Seoboost",props:{buttonOnly:{type:Boolean,default:!1},buttonText:String,buttonType:{type:String,default:"blue"},buttonIcons:{type:Boolean,default:!0},openLogin:{type:Boolean,default:!1}},setup(t){const e="all-in-one-seo-pack",s=O(),r=k(),i={title:o("Elevate your SEO with AIOSEO Writing Assistant",e),title2:o("Now Integrated into SEOBoost",e),description:o("Experience the power of AI-driven writing assistance seamlessly integrated into SEOBoost. Login to enhance your content creation process and boost your search rankings.",e),login:o("Login to SEOBoost",e)},n=t;v(()=>n.openLogin,l=>{l&&g()});const g=()=>{const l=s.seoBoost.loginUrl||r.seoBoost.loginUrl,m=450,z=580,P=window.innerWidth/2-m/2,I=window.innerHeight/2-z/2,S=`width=${m},height=${z},resizable=no,scrollbars=no,status=no,location=no,toolbar=no,menubar=no`;window.open(l,"_blank",S).moveBy(P,I),window.addEventListener("message",_=>{_.origin===window.location.origin&&_.data==="seoboost-authenticated"&&(s.setUserLoggedIn(!0),r.setUserLoggedIn(!0))})};return(l,m)=>(d(),f("div",{class:E(["aioseo-seoboost-login",{"aioseo-seoboost-login--button-only":n.buttonOnly}])},[n.buttonOnly?w("",!0):(d(),f(B,{key:0},[h("img",{src:c(b)(c(H))},null,8,N),h("div",M,[y(u(i.title)+" ",1),V,y(" "+u(i.title2),1)]),h("div",$,u(i.description),1)],64)),L(c(W),{type:n.buttonType,onClick:g,size:"medium"},{default:T(()=>[n.buttonIcons?(d(),f("img",{key:0,src:c(b)(c(U))},null,8,j)):w("",!0),y(" "+u(n.buttonText||i.login)+" ",1),n.buttonIcons?(d(),D(c(x),{key:1})):w("",!0)]),_:1},8,["type"])],2))}};export{st as _,O as u};