OwlCyberSecurity - MANAGER
Edit File: RobotsEditor.26419b6c.js
import{G as te}from"./constants.a8a14dc3.js";import{k as oe,m as se,g as re,b as ie,u as ne,l as z}from"./index.7377ee90.js";import{l as le}from"./license.bf6b339a.js";import{h as L,g as ae}from"./helpers.53868b98.js";import{e as de}from"./regex.8a6101c0.js";import{u as ce}from"./Network.1877ef7c.js";import{C as J,_ as ue,b as be}from"./Caret.a21d4ca8.js";import{B as me}from"./Editor.9cb3bfe8.js";import{C as he}from"./Card.7fa0e19d.js";import{C as pe}from"./Index.65753742.js";import{C as fe,S as _e}from"./Upload.c2690039.js";import{C as we}from"./SettingsRow.ac18ea66.js";import{D as ge,S as xe}from"./vuedraggable.umd.7f7b0bb2.js";import{_ as Re,a as ve}from"./UnwantedBots.1dd73511.js";import"./translations.d159963e.js";import{_ as j}from"./_plugin-vue_export-helper.eefbdd86.js";import{_ as l,s as I,a as ke}from"./default-i18n.20001971.js";import{v as _,o as x,c as T,F as U,J as B,k as V,l as g,a as n,t as p,b as y,C as d,x as k,G as Te,Q as M,R as q,E as D}from"./runtime-dom.esm-bundler.5c3c7d72.js";import{S as Se}from"./Plus.426117bd.js";import{S as ye}from"./Ellipse.e3ae0692.js";import{S as Ie}from"./External.c9d4f255.js";import{S as Ce}from"./index.b359096c.js";import"./upperFirst.2cd99bdd.js";import"./_stringToArray.f9ddb970.js";import"./toString.f0787db8.js";import"./isEqual.96d3394c.js";import"./_baseIsEqual.aba7ca44.js";import"./_getTag.1e50d0c4.js";import"./_baseClone.76efb8f9.js";import"./_arrayEach.6af5abac.js";import"./Tooltip.73441134.js";import"./Slide.39c07c03.js";import"./params.af7ed354.js";import"./Row.df38a5f6.js";import"./RadioToggle.333e7750.js";import"./Checkbox.6db0b9ed.js";import"./Checkmark.e40641dd.js";const Oe=e=>{const t=[];return Object.keys(e).forEach(r=>{r&&(t.push(`User-agent: ${r}`),Object.keys(e[r]).forEach(i=>{const[o,s]=e[r][i].split(":").map(h=>h.trim());t.push(`${o.charAt(0).toUpperCase()+o.slice(1)}: ${s}`)}),t.push(""))}),t.join(`\r `)},E=e=>{const t={};return e.forEach(r=>{const i=JSON.parse(r);if(!(!i.userAgent||!i.fieldValue)){if(!t[i.userAgent]){t[i.userAgent]=[`${i.directive}: ${i.fieldValue}`];return}t[i.userAgent].push(`${i.directive}: ${i.fieldValue}`)}}),t},Ae=e=>{const t=[],r=/^\/.*$/,i=(c,f,b,R,u={})=>{const v=`${R.tableIndex}${R.userAgent}${R.directive}${R.fieldValue}`;return c.find(w=>b==="defaultRuleOverride"&&w.hash===v&&w.message===b)||(c.push({type:f,message:b,hash:v,isNetworkIndex:u.isNetworkIndex,previewIndex:u.previewIndex,sourcePreviewIndex:(u==null?void 0:u.sourcePreviewIndex)||null,conflictingIndex:(u==null?void 0:u.conflictingIndex)||null,duplicateIndex:(u==null?void 0:u.duplicateIndex)||null,equivalentIndex:(u==null?void 0:u.equivalentIndex)||null,overriddenIndex:(u==null?void 0:u.overriddenIndex)||null}),t.push((u==null?void 0:u.overriddenIndex)||null)),c},o=(c,f)=>c+f;let s=[],h=0;for(const c in e){h=o(h,2);for(const[f,b]of Object.entries(e[c])){const[R,u]=[b.directive,b.fieldValue];if(!R||!u)continue;let v=h;for(let w=parseInt(f)+1;w<e[c].length;w++){const[O,A]=[e[c][w].directive,e[c][w].fieldValue];if(!(!O||!A)){if(h=o(h,1),`${R}${u}`==`${O}${A}`&&(s=i(s,"red","duplicateRule",e[c][w],{previewIndex:h,sourcePreviewIndex:v,isNetworkIndex:b.networkLevel,duplicateIndex:b.tableIndex})),R.match(/disallow|allow/i)&&O.match(/disallow|allow/i)){R!==O&&u===A&&(b.default?(t.includes(b.tableIndex)||v--,s=i(s,"yellow","defaultRuleOverride",e[c][w],{previewIndex:h,isNetworkIndex:b.networkLevel,overriddenIndex:b.tableIndex})):s=i(s,b.networkLevel?"yellow":"red","conflictingPath",e[c][w],{previewIndex:h,sourcePreviewIndex:b.networkLevel?null:v,isNetworkIndex:b.networkLevel,conflictingIndex:b.tableIndex}));const P=new RegExp(`^${de(A.replace(/\*+$/g,""))}$`);A.indexOf("*")!==-1&&u.match(P)&&(s=i(s,"red","equivalentPath",e[c][w],{previewIndex:h,sourcePreviewIndex:v,isNetworkIndex:b.networkLevel,equivalentIndex:b.tableIndex}))}R==="crawl-delay"&&O==="crawl-delay"&&u!==A&&(s=i(s,"red","conflictingCrawlDelay",e[c][w],{previewIndex:h,sourcePreviewIndex:v,isNetworkIndex:b.networkLevel,conflictingIndex:b.tableIndex}))}}if(h=v,R.match(/^clean-param/i)){const[w,O]=u.split(/\s+/).map(A=>A.trim());(!w||w.match(r)||O&&!O.match(r))&&(s=i(s,"red","invalidCleanParam",b,{previewIndex:h}))}if(R.match(/^crawl-delay/i)){const w=Number(u);(isNaN(w)||1>w)&&(s=i(s,"red","invalidCrawlDelay",b,{previewIndex:h}))}h=o(h,1)}}if(s.length)throw s;return!0},C="all-in-one-seo-pack",Ne={components:{CoreAlert:J},props:{errors:{type:Array,required:!0}},data(){return{strings:{allowTakesPrecedence:l('The "Allow" rule takes precedence.',C),fromTheNetwork:l("from the network level",C),invalidCleanParam:l("Clean-param must start with at least one param which is optionally followed by one path.",C),invalidCrawlDelay:l("Crawl-delay must be a number starting from 1.",C),conflictingCrawlDelay:l('For some crawlers, encountering conflicting "Crawl-delay" might lead to unpredictable behavior.',C),networkRuleTakesPrecedence:l("The network rule takes precedence.",C)}}},computed:{errorsByType(){return this.errors.reduce((e,t)=>(e[t.type]||(e[t.type]=[]),e[t.type].push(t),e),{})}},methods:{getErrorMessage(e){return e.message==="duplicateRule"?I(l("This rule is a duplicate of rule #%1$s%2$s.",C),e.duplicateIndex,e.isNetworkIndex?` (${this.strings.fromTheNetwork})`:""):e.message==="equivalentPath"?I(l("Equivalent to rule #%1$s%2$s. The trailing wildcard is ignored.",C),e.equivalentIndex,e.isNetworkIndex?` (${this.strings.fromTheNetwork})`:""):e.message==="conflictingPath"?I(l("This rule conflicts with rule #%1$s%2$s.%3$s",C),e.conflictingIndex,e.isNetworkIndex?` (${this.strings.fromTheNetwork})`:"",e.isNetworkIndex?` ${this.strings.networkRuleTakesPrecedence}`:` ${this.strings.allowTakesPrecedence}`):e.message==="defaultRuleOverride"?I(l("This rule overrides the default rule #%1$s%2$s.",C),e.overriddenIndex,e.isNetworkIndex?` (${this.strings.fromTheNetwork})`:""):e.message==="conflictingCrawlDelay"?I(l("This rule conflicts with rule #%1$s%2$s.%3$s",C),e.conflictingIndex,e.isNetworkIndex?` (${this.strings.fromTheNetwork})`:"",` ${this.strings.conflictingCrawlDelay}`):this.strings[e.message]}}},De={key:0,class:"robots-editor-rule-error-alert"};function Ve(e,t,r,i,o,s){const h=_("core-alert");return r.errors.length?(x(),T("div",De,[(x(!0),T(U,null,B(s.errorsByType,(c,f)=>(x(),V(h,{key:f+"-errors",type:f,size:"small"},{default:g(()=>[(x(!0),T(U,null,B(c,(b,R)=>(x(),T("div",{key:R},[n("b",null,p(s.getErrorMessage(b)),1)]))),128))]),_:2},1032,["type"]))),128))])):y("",!0)}const Ue=j(Ne,[["render",Ve]]),m="all-in-one-seo-pack",Pe={setup(){const{isMainSite:e}=ce();return{licenseStore:oe(),networkStore:se(),notificationsStore:re(),optionsStore:ie(),rootStore:ne(),GLOBAL_STRINGS:te,isMainSite:e,links:z}},components:{BaseButton:ue,BaseEditor:me,CoreAlert:J,CoreCard:he,CoreLoader:be,CoreModal:pe,CoreNetworkSiteSelector:fe,CoreSettingsRow:we,Draggable:ge,PreventCrawling:Re,RuleErrors:Ue,SvgCirclePlus:Se,SvgDrag:xe,SvgEllipse:ye,SvgExternal:Ie,SvgTrash:Ce,SvgUpload:_e,UnwantedBots:ve},data(){var e;return{defaultRules:((e=this.rootStore.aioseo.data.robots)==null?void 0:e.defaultRules)||{},directiveOptions:[{value:"allow",label:"Allow"},{value:"disallow",label:"Disallow"},{value:"clean-param",label:"Clean-param"},{value:"crawl-delay",label:"Crawl-delay"}],errors:{deleteRobotsTxt:null,importAndDeleteRobotsTxt:null,importRobotsTxt:null,importRobotsTxtFromUrl:null,pasteRobotsTxtText:null,tableRule:[]},forceRobotsDetectedAlert:!1,inputImportRobotsTxtFromUrl:"",inputPasteRobotsTxtText:"",license:le,loading:{btnDeleteRobotsTxt:!1,btnImportAndDeleteRobotsTxt:!1,btnImportRobotsTxt:!1,cardOverlay:!1},showImportModal:!1,previousUnwantedBots:{googleAdsBot:!1,googleGeminiVertexAiBots:!1,openAiGptBot:!1,commonCrawlCcBot:!1},strings:{addRule:l("Add Rule",m),allow:l("Allow",m),customRobotsPreview:l("Custom Robots.txt Preview",m),deleteRule:l("Delete Rule",m),description:I(l("The robots.txt editor in %1$s allows you to set up a robots.txt file for your site that will override the default robots.txt file that WordPress creates. By creating a robots.txt file with %2$s you have greater control over the instructions you give web crawlers about your site.",m),"AIOSEO","AIOSEO"),description2:I(l("Just like WordPress, %1$s generates a dynamic file so there is no static file to be found on your server. The content of the robots.txt file is stored in your WordPress database.",m),"All in One SEO"),directive:l("Directive",m),disallow:l("Disallow",m),enableCustomRobots:l("Enable Custom Robots.txt",m),importAndDelete:l("Import and Delete",m),importFromUrl:l("Import from URL",m),importRobots:l("Import Robots.txt",m),networkAlert:l("These custom robots.txt rules will apply globally to your entire network. To adjust the robots.txt rules for an individual site, please choose it in the list above.",m),networkAlertLite:l("These custom robots.txt rules will apply globally to your entire network. To adjust the robots.txt rules for an individual site, please visit the dashboard for that site directly and update the settings there.",m),invalidRobotsTxtUrl:l("Invalid robots.txt URL.",m),openRobotsTxt:l("Open Robots.txt",m),pasteRobotsText:l("Paste Robots.txt text",m),userAgentNotFound:l("No User-agent found in the content beginning.",m),pasteUrl:l("https://any-domain.com/robots.txt",m),physicalRobotsFound:I(l("%1$s has detected a physical robots.txt file in the root folder of your WordPress installation. We recommend removing this file as it could cause conflicts with WordPress' dynamically generated one. %2$s can import this file and delete it, or you can simply delete it.",m),"AIOSEO","AIOSEO"),robotsEditor:l("Robots.txt Editor",m),selectSite:l("Select Site",m),userAgent:l("User Agent",m)}}},watch:{"networkStore.currentSite"(){this.processFetchSiteRobots()},"getOptions.enable"(){this.validateRules(),this.maybeForceRobotsDetectedAlert()}},computed:{btnImportRobotsTxtDisabled(){return!this.inputImportRobotsTxtFromUrl&&!this.inputPasteRobotsTxtText?!0:this.errors.importRobotsTxtFromUrl||this.errors.pasteRobotsTxtText},getOptions(){var e;return((e=this.networkStore.currentSite)==null?void 0:e.blog_id)==="network"?this.networkStore.getNetworkRobots:this.optionsStore.options.tools.robots},inputCustomRobotsTxtPreview(){let e=null;const t=`\r `+this.rootStore.aioseo.data.robots.sitemapUrls.filter(i=>0<i.length).join(`\r `),r=this.isNetworkSite&&this.optionsStore.networkOptions.tools.robots.enable?E(this.networkStore.getNetworkRobots.rules):{};return e=this.getOptions.enable?this.mergeRuleset(this.defaultRules,this.mergeRuleset(r,E(this.networkStore.networkRobots.rules)),!0):this.mergeRuleset(this.defaultRules,this.mergeRuleset(r,E(this.readOnlyRules))),e=Oe(e)+t,e.replace(/<[^>]*>/g,"")},isNetworkSite(){var e;return this.rootStore.aioseo.data.isMultisite&&((e=this.networkStore.currentSite)==null?void 0:e.blog_id)!=="network"},isValidRobotsSite(){var t;return new URL(this.robotsTxtUrl).pathname.match(/^\/robots.txt\/?/)?this.rootStore.aioseo.data.subdomain||((t=this.networkStore.currentSite)==null?void 0:t.blog_id)==="network"||this.isMainSite(this.networkStore.currentSite.domain,this.networkStore.currentSite.path)||!this.rootStore.aioseo.data.isNetworkAdmin&&this.rootStore.aioseo.data.mainSite:!1},missingRewriteRules(){const e=l("It looks like you are missing the proper rewrite rules for the robots.txt file.",m);let t="";if(this.rootStore.aioseo.data.server.match(/apache|litespeed/)){const r=this.rootStore.aioseo.data.server==="apache"?"Apache":"LiteSpeed";t=I(l("It appears that your server is running on %1$s, so the fix should be as simple as checking the %2$scorrect .htaccess implementation on wordpress.org%3$s.",m),r,'<a href="https://wordpress.org/support/article/htaccess/" target="_blank">',"</a>")}else this.rootStore.aioseo.data.server==="nginx"&&(t=I(l("It appears that your server is running on nginx, so the fix will most likely require adding the correct rewrite rules to our nginx configuration. %1$sCheck our documentation for more information%2$s.",m),'<a href="'+z.getDocUrl("robotsRewrite")+'" target="_blank">',"</a>"));return e+" "+t},parsedCustomRules(){const e=[];for(const t of this.networkStore.networkRobots.rules.values()){const r=JSON.parse(t);e.push({userAgent:r.userAgent,directive:r.directive,fieldValue:r.fieldValue,default:!1,networkLevel:!1})}return e},parsedDefaultRules(){const e=[];return Object.keys(this.defaultRules).forEach(t=>{for(const r of this.defaultRules[t].values()){const[i,o]=r.split(":").map(s=>s.trim());e.push({userAgent:t,directive:i,fieldValue:o,default:!0,networkLevel:!1})}}),e},parsedNetworkRules(){const e=this.isNetworkSite&&this.optionsStore.networkOptions.tools.robots.enable?this.networkStore.getNetworkRobots.rules:{},t=[];if(Object.keys(e).length)for(const r of e.values()){const i=JSON.parse(r);t.push({userAgent:i.userAgent,directive:i.directive,fieldValue:i.fieldValue,default:!1,networkLevel:!0})}return t},robotsPreviewErrorLabel(){const e=this.errors.tableRule.length?this.errors.tableRule.filter(i=>i.type==="red"):[];if(!e.length)return"";const t=L(e,"previewIndex"),r=ae(t).length;return I(ke("%1$s Error","%1$s Errors",r,m),r)},robotsTxtUrl(){var e,t;return((e=this.networkStore.currentSite)==null?void 0:e.blog_id)!=="network"&&((t=this.networkStore.currentSite)!=null&&t.domain)?`${this.rootStore.aioseo.data.isSsl?"https://":"http://"}${this.networkStore.currentSite.domain}${this.networkStore.currentSite.path}robots.txt`:this.rootStore.aioseo.urls.robotsTxtUrl},subdirectoryAlert(){return this.isNetworkSite?I(l("This site is running in a sub-directory of your main site located at %1$s. Your robots.txt file should only appear in the root directory of that site.",m),'<a href="'+this.rootStore.aioseo.urls.mainSiteUrl+'" target="_blank"><strong>'+this.rootStore.aioseo.urls.mainSiteUrl+"</strong></a>"):l("This site runs in a sub-directory. The robots.txt file must be located at the root of the website host to which it applies.",m)},showRobotsDetectedAlert(){return this.getOptions.robotsDetected||this.forceRobotsDetectedAlert},tableRules:{get(){return this.networkStore.networkRobots.rules.map(e=>JSON.parse(e))},set(e){const t=[];e.forEach(r=>{t.push(JSON.stringify({...r}))}),this.networkStore.networkRobots.rules=t}},readOnlyRules(){return this.networkStore.networkRobots.rules.filter(e=>JSON.parse(e).readOnly)}},methods:{addRow(){this.networkStore.networkRobots.rules.push(JSON.stringify({userAgent:null,directive:"allow",fieldValue:null,readOnly:!1})),this.$nextTick(()=>{document.querySelector(".robots-editor-table__body .robots-editor-table__row:last-child input").focus()})},deleteRow(e){this.networkStore.networkRobots.rules.splice(e,1)},getTableIndexedRuleset(){const e=[],t=[],r=[...this.parsedDefaultRules,...this.parsedNetworkRules,...this.parsedCustomRules];let i=this.parsedDefaultRules.length,o=0;return r.forEach(s=>{s.tableIndex=s.networkLevel?++i:++o,t.push(s)}),t.forEach(s=>{if(!e[s.userAgent]){e[s.userAgent]=[s];return}e[s.userAgent].push(s)}),e},getTableRuleErrors(e,t){return this.errors.tableRule.length?this.errors.tableRule.filter(r=>r.hash===`${e}${t.userAgent}${t.directive}${t.fieldValue}`):[]},hasTableRuleError(e,t){return this.errors.tableRule.find(r=>{const i=e===(r.duplicateIndex||r.equivalentIndex||r.conflictingIndex)&&!r.isNetworkIndex,o=r.hash===`${e}${t.userAgent}${t.directive}${t.fieldValue}`;return i||o})||!1},hideRobotsDetected(){this.getOptions.robotsDetected=!1,this.optionsStore.saveChanges()},maybeForceRobotsDetectedAlert(){this.getOptions.enable||(this.forceRobotsDetectedAlert=!1),this.getOptions.enable&&this.rootStore.aioseo.data.robots.hasPhysicalRobots&&(this.forceRobotsDetectedAlert=!0)},mergeRuleset(e,t,r=!1){const i={...e};return Object.keys(t).forEach(o=>{if(!(o in i)){i[o]=t[o];return}for(const s of t[o].values()){const[h,c]=s.split(":").map(f=>f.trim());if(h.match(/disallow|allow/i)){const f=h==="disallow"?"allow":"disallow",b=i[o].indexOf(`${f}: ${c}`);b!==-1&&(r?i[o]=i[o].filter((R,u)=>u!==b):t[o]=t[o].filter(R=>R!==`${h}: ${c}`))}}i[o]=[...i[o],...t[o]]}),i},onChangeInputImportRobotsTxtFromUrl(e){this.inputImportRobotsTxtFromUrl=e,this.errors.importRobotsTxtFromUrl=null,e&&!e.match(/^https?:\/\/.{2,}\..{2,}\/robots\.txt$/)&&(this.errors.importRobotsTxtFromUrl=this.strings.invalidRobotsTxtUrl)},onChangeInputPasteRobotsTxtText(e){this.inputPasteRobotsTxtText=e.replace(/#[^\n\r]*/g,""),this.errors.pasteRobotsTxtText=null,this.inputPasteRobotsTxtText&&!this.inputPasteRobotsTxtText.match(/^\s*user-agent:\s*./gi)&&(this.errors.pasteRobotsTxtText=this.strings.userAgentNotFound)},onClickBtnDeleteRobotsTxt(){this.loading.btnDeleteRobotsTxt=!0,this.notificationsStore.processButtonAction("tools/delete-robots-txt").then(()=>window.location.reload()).catch(e=>{var t,r;this.loading.btnDeleteRobotsTxt=!1,this.errors.deleteRobotsTxt=((r=(t=e==null?void 0:e.response)==null?void 0:t.body)==null?void 0:r.message)||null})},onClickBtnImportAndDeleteRobotsTxt(){this.loading.btnImportAndDeleteRobotsTxt=!0,this.processImportRobotsTxt("static").then(()=>{window.location.reload()}).catch(e=>{var t,r;this.loading.btnImportAndDeleteRobotsTxt=!1,this.errors.importAndDeleteRobotsTxt=((r=(t=e==null?void 0:e.response)==null?void 0:t.body)==null?void 0:r.message)||null})},onClickBtnImportRobotsTxt(e){this.loading.btnImportRobotsTxt=!0,this.processImportRobotsTxt(e).then(()=>window.location.reload()).catch(t=>{var r,i;this.loading.btnImportRobotsTxt=!1,this.errors.importRobotsTxt=((i=(r=t==null?void 0:t.response)==null?void 0:r.body)==null?void 0:i.message)||null})},processFetchSiteRobots(){this.loading.cardOverlay=!0,this.networkStore.fetchSiteRobots(this.networkStore.currentSite.blog_id).then(()=>this.loading.cardOverlay=!1)},processImportRobotsTxt(e){var t;return this.networkStore.importRobotsTxt({source:e,url:this.inputImportRobotsTxtFromUrl,text:this.inputPasteRobotsTxtText,blogId:((t=this.networkStore.currentSite)==null?void 0:t.blog_id)||null})},sanitizeDirectiveValue(e,t,r){return r=decodeURIComponent(r.trim()),r&&(r=r.replace(/[><]/,""),t==="userAgent"&&(r=r.replace(/([^a-z0-9\-_*,.\s])/gi,""),r=r.replace(/\s+/g," ")),t==="fieldValue"&&e.directive.match(/allow|disallow/)&&(r=r.indexOf("*")===0&&1<r.length?r:"/"+r.replace(/(^\/+)/,"")),r)},async updateRule(e,t,r,i){this.networkStore.networkRobots.rules.splice(i,1,JSON.stringify(e)),await this.$nextTick(),e[t]=this.sanitizeDirectiveValue(e,t,r),this.networkStore.networkRobots.rules.splice(i,1,JSON.stringify(e))},validateRules(){if(!this.getOptions.enable)return this.errors.tableRule=[],!1;try{Ae(this.getTableIndexedRuleset()),this.errors.tableRule=[]}catch(e){this.errors.tableRule=e,this.$nextTick(()=>{var c;const t=this.errors.tableRule.length?this.errors.tableRule.filter(f=>f.type==="red"):[],r=((c=this.$refs["input-custom-robots-txt-preview"])==null?void 0:c.$el.querySelector(".ql-editor"))||null;if(!r)return!1;const i=r.querySelectorAll("p"),o=L(t,"previewIndex"),s=L(t,"sourcePreviewIndex"),h=[...new Set([...o,...s])];for(const f of h)i[f-1]&&i[f-1].classList.add("has-error")})}}},beforeUnmount(){window.aioseoBus.$off("validate-robots-txt")},mounted(){this.validateRules(),this.maybeForceRobotsDetectedAlert(),window.aioseoBus.$on("validate-robots-txt",()=>{this.validateRules()})}},Le={class:"aioseo-tools-robots-editor"},Ee={key:0,class:"aioseo-settings-row"},Be={class:"settings-name"},Fe={class:"name small-margin"},Ge={class:"settings-content"},ze={class:"aioseo-settings-row"},Me={class:"description"},qe={class:"description"},Je=["innerHTML"],je={key:1,class:"aioseo-settings-row"},He={class:"description"},We={class:"buttons description"},Qe={key:2,class:"aioseo-settings-row"},Ye={class:"aioseo-settings-row"},Ke={class:"settings-content"},Xe={class:"robots-editor-table"},Ze={class:"robots-editor-table__header"},$e={class:"robots-editor-table__row"},et=n("div",{class:"robots-editor-table__column"},"#",-1),tt={class:"robots-editor-table__column"},ot={class:"robots-editor-table__column"},st={class:"robots-editor-table__column"},rt=n("div",{class:"robots-editor-table__column"},null,-1),it={class:"robots-editor-table__body"},nt={class:"robots-editor-table__column"},lt={class:"robots-editor-table__column"},at={class:"robots-editor-table__column"},dt={class:"robots-editor-table__column"},ct=n("div",{class:"robots-editor-table__column"},null,-1),ut={class:"robots-editor-table__column robots-editor-table__column--truncate"},bt={class:"robots-editor-table__column"},mt={class:"robots-editor-table__column"},ht={class:"robots-editor-table__column"},pt={key:0,class:"robots-editor-table__column robots-editor-table__column--actions"},ft=["onClick","title"],_t={class:"robots-editor-table__footer"},wt={class:"buttons"},gt={class:"unwanted-bots-wrapper"},xt={class:"aioseo-settings-row aioseo-settings-row--preview-robots no-margin"},Rt={class:"settings-name"},vt={class:"name"},kt={key:0,class:"aioseo-error"},Tt={class:"settings-content"},St={key:0,class:"aioseo-settings-row no-margin no-border"},yt=["data-or"],It={class:"settings-name"},Ct={class:"name small-margin"},Ot={class:"settings-content settings-content--gap"},At={class:"aioseo-settings-row"},Nt={class:"settings-name"},Dt={class:"name small-margin"},Vt={class:"settings-content settings-content--gap"},Ut={class:"buttons"},Pt={key:5,class:"loader-overlay"};function Lt(e,t,r,i,o,s){const h=_("core-network-site-selector"),c=_("core-alert"),f=_("base-button"),b=_("svg-external"),R=_("core-settings-row"),u=_("base-toggle"),v=_("base-input"),w=_("base-select"),O=_("svg-trash"),A=_("svg-drag"),P=_("rule-errors"),H=_("draggable"),W=_("svg-circle-plus"),Q=_("svg-upload"),Y=_("unwanted-bots"),K=_("prevent-crawling"),X=_("svg-ellipse"),F=_("base-editor"),Z=_("core-modal"),$=_("core-loader"),ee=_("core-card");return x(),T("div",Le,[d(ee,{slug:"robotsEditor","header-text":o.strings.robotsEditor},{default:g(()=>{var G;return[i.rootStore.aioseo.data.isNetworkAdmin&&!i.licenseStore.isUnlicensed&&o.license.hasCoreFeature("tools","network-tools-robots")?(x(),T("div",Ee,[n("div",Be,[n("div",Fe,p(o.strings.selectSite),1)]),n("div",Ge,[d(h,{onSelectedSite:t[0]||(t[0]=a=>{i.networkStore.currentSite=a}),"follow-selected-site":"","show-network":""})])])):y("",!0),n("div",ze,[((G=i.networkStore.currentSite)==null?void 0:G.blog_id)==="network"?(x(),V(c,{key:0},{default:g(()=>[k(p(i.licenseStore.isUnlicensed||!o.license.hasCoreFeature("tools","network-tools-robots")?o.strings.networkAlertLite:o.strings.networkAlert),1)]),_:1})):y("",!0),n("p",Me,p(o.strings.description),1),n("p",qe,[k(p(o.strings.description2)+" ",1),n("span",{innerHTML:i.links.getDocLink(i.GLOBAL_STRINGS.learnMore,"robotsEditor",!0)},null,8,Je)])]),i.rootStore.aioseo.data.robots.hasPhysicalRobots&&s.showRobotsDetectedAlert?(x(),T("div",je,[o.errors.importAndDeleteRobotsTxt||o.errors.deleteRobotsTxt?(x(),V(c,{key:0,type:"red"},{default:g(()=>[k(p(o.errors.importAndDeleteRobotsTxt||o.errors.deleteRobotsTxt),1)]),_:1})):y("",!0),d(c,{type:"red","show-close":!s.getOptions.enable,onCloseAlert:s.hideRobotsDetected},{default:g(()=>[n("p",He,p(o.strings.physicalRobotsFound),1),n("p",We,[d(f,{type:"blue",size:"medium",onClick:s.onClickBtnImportAndDeleteRobotsTxt,loading:o.loading.btnImportAndDeleteRobotsTxt},{default:g(()=>[k(p(o.strings.importAndDelete),1)]),_:1},8,["onClick","loading"]),d(f,{type:"blue",size:"medium",onClick:s.onClickBtnDeleteRobotsTxt,loading:o.loading.btnDeleteRobotsTxt},{default:g(()=>[k(p(i.GLOBAL_STRINGS.delete),1)]),_:1},8,["onClick","loading"])])]),_:1},8,["show-close","onCloseAlert"])])):y("",!0),i.rootStore.aioseo.data.robots.rewriteExists?y("",!0):(x(),T("div",Qe,[d(c,{type:"red",innerHTML:s.missingRewriteRules},null,8,["innerHTML"])])),s.isValidRobotsSite?(x(),T(U,{key:3},[d(R,{name:i.GLOBAL_STRINGS.preview},{content:g(()=>[d(f,{size:"medium",type:"blue",tag:"a",href:s.robotsTxtUrl,target:"_blank"},{default:g(()=>[d(b,{width:"14"}),k(" "+p(o.strings.openRobotsTxt),1)]),_:1},8,["href"])]),_:1},8,["name"]),d(R,{name:o.strings.enableCustomRobots,class:"no-border no-margin"},{content:g(()=>[d(u,{modelValue:s.getOptions.enable,"onUpdate:modelValue":t[1]||(t[1]=a=>s.getOptions.enable=a)},null,8,["modelValue"])]),_:1},8,["name"]),n("div",Ye,[n("div",Ke,[n("div",Xe,[n("div",Ze,[n("div",$e,[et,n("div",tt,p(o.strings.userAgent),1),n("div",ot,p(o.strings.directive),1),n("div",st,p(i.GLOBAL_STRINGS.value),1),rt])]),n("div",it,[(x(!0),T(U,null,B(s.parsedDefaultRules,(a,N)=>(x(),T("div",{key:N,class:"robots-editor-table__row robots-editor-table__row--stripe"},[n("div",nt,p(N+1),1),n("div",lt,[d(v,{modelValue:a.userAgent,disabled:a.default,size:"medium"},null,8,["modelValue","disabled"])]),n("div",at,[d(w,{modelValue:o.directiveOptions.find(S=>S.value===a.directive),options:[],disabled:a.default,size:"medium"},null,8,["modelValue","disabled"])]),n("div",dt,[d(v,{modelValue:a.fieldValue,disabled:a.default,size:"medium"},null,8,["modelValue","disabled"])]),ct]))),128)),d(H,{handle:".aioseo-drag-wrapper",modelValue:s.tableRules,"onUpdate:modelValue":t[3]||(t[3]=a=>s.tableRules=a),"item-key":e.$.uid.toString(),class:"draggable-rules",draggable:".robots-editor-table__row--draggable"},{item:g(({element:a,index:N})=>[n("div",{class:Te(["robots-editor-table__row robots-editor-table__row--stripe",[{"aioseo-error":s.hasTableRuleError(N+s.parsedDefaultRules.length+1,a)},{"robots-editor-table__row--draggable":!a.readOnly}]])},[n("div",ut,p(N+s.parsedDefaultRules.length+1),1),n("div",bt,[d(v,{modelValue:a.userAgent,"onUpdate:modelValue":S=>a.userAgent=S,spellcheck:!1,disabled:!s.getOptions.enable||a.readOnly,onChange:S=>s.updateRule(a,"userAgent",S,N),size:"medium"},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])]),n("div",mt,[d(w,{modelValue:o.directiveOptions.find(S=>S.value===a.directive),options:o.directiveOptions,disabled:!s.getOptions.enable||a.readOnly,"onUpdate:modelValue":S=>s.updateRule(a,"directive",S.value,N),size:"medium"},null,8,["modelValue","options","disabled","onUpdate:modelValue"])]),n("div",ht,[d(v,{modelValue:a.fieldValue,"onUpdate:modelValue":S=>a.fieldValue=S,spellcheck:!1,disabled:!s.getOptions.enable||a.readOnly,onChange:S=>s.updateRule(a,"fieldValue",S,N),size:"medium"},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])]),a.readOnly?y("",!0):(x(),T("div",pt,[M(n("a",{onClick:D(S=>s.deleteRow(N),["prevent"]),href:"#",role:"button",class:"btn-delete-rule aioseo-outline",title:o.strings.deleteRule},[d(O,{width:"20"})],8,ft),[[q,s.getOptions.enable]]),M(n("a",{onClick:t[2]||(t[2]=D(()=>{},["prevent"])),href:"#",role:"button",class:"aioseo-drag-wrapper aioseo-outline"},[d(A,{width:"20"})],512),[[q,s.getOptions.enable]])])),d(P,{errors:s.getTableRuleErrors(N+s.parsedDefaultRules.length+1,a),class:"robots-editor-table__column robots-editor-table__column--rule-error"},null,8,["errors"])],2)]),_:1},8,["modelValue","item-key"])]),n("div",_t,[n("div",wt,[d(f,{onClick:D(s.addRow,["exact"]),disabled:!s.getOptions.enable,class:"btn-add-rule",type:"black",size:"small"},{default:g(()=>[d(W,{width:"14"}),k(" "+p(o.strings.addRule),1)]),_:1},8,["onClick","disabled"]),d(f,{onClick:t[4]||(t[4]=D(a=>o.showImportModal=!0,["prevent"])),disabled:!s.getOptions.enable,type:"black",size:"small"},{default:g(()=>[d(Q,{width:"14"}),k(" "+p(i.GLOBAL_STRINGS.import),1)]),_:1},8,["disabled"])])])])])]),n("div",gt,[d(Y,{showAlert:!1,showDescription:!1})]),d(K,{showAlert:!1}),n("div",xt,[n("div",Rt,[n("div",vt,[k(p(o.strings.customRobotsPreview)+" ",1),s.robotsPreviewErrorLabel?(x(),T("div",kt,[d(X,{width:"8"}),n("span",null,p(s.robotsPreviewErrorLabel),1)])):y("",!0)])]),n("div",Tt,[d(F,{modelValue:s.inputCustomRobotsTxtPreview,"line-numbers":!0,disabled:"","force-updates":"",monospace:"",ref:"input-custom-robots-txt-preview"},null,8,["modelValue"])])])],64)):(x(),V(c,{key:4,innerHTML:s.subdirectoryAlert},null,8,["innerHTML"])),d(Z,{show:o.showImportModal,onClose:t[10]||(t[10]=a=>o.showImportModal=!1),classes:["aioseo-robots-import-modal"]},{headerTitle:g(()=>[k(p(o.strings.importRobots),1)]),body:g(()=>[o.errors.importRobotsTxt?(x(),T("div",St,[d(c,{type:"red","show-close":"",onCloseAlert:t[5]||(t[5]=a=>o.errors.importRobotsTxt=null)},{default:g(()=>[k(p(o.errors.importRobotsTxt),1)]),_:1})])):y("",!0),n("div",{class:"aioseo-settings-row aioseo-settings-row--or","data-or":i.GLOBAL_STRINGS.or},[n("div",It,[n("div",Ct,p(o.strings.importFromUrl),1)]),n("div",Ot,[d(v,{modelValue:o.inputImportRobotsTxtFromUrl,"onUpdate:modelValue":t[6]||(t[6]=a=>s.onChangeInputImportRobotsTxtFromUrl(a)),placeholder:o.strings.pasteUrl,disabled:!!o.inputPasteRobotsTxtText,type:"url",size:"medium"},null,8,["modelValue","placeholder","disabled"]),o.errors.importRobotsTxtFromUrl?(x(),V(c,{key:0,type:"red",size:"small"},{default:g(()=>[k(p(o.errors.importRobotsTxtFromUrl),1)]),_:1})):y("",!0)])],8,yt),n("div",At,[n("div",Nt,[n("div",Dt,p(o.strings.pasteRobotsText),1)]),n("div",Vt,[d(F,{modelValue:o.inputPasteRobotsTxtText,"onUpdate:modelValue":t[7]||(t[7]=a=>s.onChangeInputPasteRobotsTxtText(a)),"line-numbers":!0,"minimum-line-numbers":10,disabled:!!o.inputImportRobotsTxtFromUrl,spellcheck:!1,monospace:""},null,8,["modelValue","disabled"]),o.errors.pasteRobotsTxtText?(x(),V(c,{key:0,type:"red",size:"small"},{default:g(()=>[k(p(o.errors.pasteRobotsTxtText),1)]),_:1})):y("",!0)])])]),footer:g(()=>[n("div",Ut,[d(f,{onClick:t[8]||(t[8]=D(a=>o.showImportModal=!1,["exact"])),type:"gray",size:"medium"},{default:g(()=>[k(p(i.GLOBAL_STRINGS.cancel),1)]),_:1}),d(f,{onClick:t[9]||(t[9]=D(a=>s.onClickBtnImportRobotsTxt(o.inputImportRobotsTxtFromUrl?"url":"text"),["exact"])),loading:o.loading.btnImportRobotsTxt,disabled:!!s.btnImportRobotsTxtDisabled,type:"blue",size:"medium"},{default:g(()=>[k(p(i.GLOBAL_STRINGS.import),1)]),_:1},8,["loading","disabled"])])]),_:1},8,["show"]),o.loading.cardOverlay?(x(),T("div",Pt,[d($)])):y("",!0)]}),_:1},8,["header-text"])])}const Ro=j(Pe,[["render",Lt]]);export{Ro as default};