You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
57 KiB
JavaScript
1 line
57 KiB
JavaScript
!function(){var e={184:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)){if(n.length){var i=a.apply(null,n);i&&e.push(i)}}else if("object"===o){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var l in n)r.call(n,l)&&n[l]&&e.push(l)}}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=jQuery,t=n.n(e),r=n(184),a=n.n(r),o=lodash,i=wp.i18n,l=wp.hooks,c=wp.components,s=wp.element,u=wp.plugins,m=wp.data,p=wp.editPost,h=wp.compose;function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}var d=["tabId","onClick","children","selected"];function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_(r.key),r)}}function k(e,t){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},k(e,t)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=v(e);if(t){var a=v(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return b(e)}(this,n)}}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function g(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e){var t=function(e,t){if("object"!==f(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===f(t)?t:String(t)}function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},E.apply(this,arguments)}function S(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var C=function(e){var t=e.tabId,n=e.onClick,r=e.children,a=e.selected,o=S(e,d);return wp.element.createElement(c.Button,E({role:"tab",tabIndex:a?null:-1,"aria-selected":a,id:t,onClick:n},o),r)},O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&k(e,t)}(l,e);var t,n,r,i=w(l);function l(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),g(b(e=i.apply(this,arguments)),"handleClick",(function(t){var n=e.props.onSelect,r=void 0===n?o.noop:n;e.setState({selected:t}),r(t)})),g(b(e),"onNavigate",(function(e,t){t.click()}));var t=e.props,n=t.tabs,r=t.initialTabName;return e.state={selected:r||(n.length>0?n[0].name:null)},e}return t=l,(n=[{key:"render",value:function(){var e=this,t=this.state.selected,n=this.props,r=n.activeClass,i=void 0===r?"is-active":r,l=n.className,s=n.instanceId,u=n.orientation,m=void 0===u?"horizontal":u,p=n.tabs,h=(0,o.find)(p,{name:t}),f=s+"-"+h.name,d=p.slice(4);return wp.element.createElement("div",{className:l},wp.element.createElement(c.NavigableMenu,{role:"tablist",orientation:m,onNavigate:this.onNavigate,className:"components-tab-panel__tabs "+t},p.slice(0,4).map((function(n){return wp.element.createElement(C,{className:a()("components-tab-panel__tabs-item",n.className,g({},i,n.name===t)),tabId:s+"-"+n.name,"aria-controls":s+"-"+n.name+"-view",selected:n.name===t,key:n.name,onClick:(0,o.partial)(e.handleClick,n.name)},n.title)})),d.map((function(n){return wp.element.createElement(C,{className:a()("components-tab-panel__tabs-item",n.className,g({},i,n.name===t)),tabId:s+"-"+n.name,"aria-controls":s+"-"+n.name+"-view",selected:n.name===t,key:n.name,onClick:(0,o.partial)(e.handleClick,n.name)},n.title)}))),h&&wp.element.createElement("div",{"aria-labelledby":f,role:"tabpanel",id:f+"-view",className:"components-tab-panel__tab-content"},this.props.children(h)))}}])&&y(t.prototype,n),r&&y(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(s.Component),P=(0,h.withInstanceId)(O),j=wp.apiFetch,N=n.n(j);function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function R(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(a=r.key,o=void 0,o=function(e,t){if("object"!==A(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==A(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"),"symbol"===A(o)?o:String(o)),r)}var a,o}function T(e,t){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},T(e,t)}function M(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=B(e);if(t){var a=B(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===A(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return I(e)}(this,n)}}function I(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},B(e)}var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&T(e,t)}(l,e);var t,n,r,a=M(l);function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=a.apply(this,arguments)).state={score:0},e.setState=e.setState.bind(I(e)),e}return t=l,(n=[{key:"render",value:function(){var e=this;return setTimeout((function(){e.setState({score:e.props.score})}),1e3),wp.element.createElement("div",{className:"rank-math-ca-score"},wp.element.createElement("div",{className:"score-text"},(0,i.__)("Score:","rank-math")," ",this.state.score,wp.element.createElement("span",null," / ",(0,i.__)("100","rank-math"))),wp.element.createElement("div",{className:"score-wrapper"},wp.element.createElement("span",{className:"score-dot",style:{left:((0,o.inRange)(this.state.score,0,5)?5:this.state.score)+"%"}})))}}])&&R(t.prototype,n),r&&R(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(s.Component),D=(0,h.compose)((0,m.withSelect)((function(e){var t=Object.values(e("rank-math").getContentAIScore());return{score:(0,o.round)((0,o.sum)(t)/t.length)}})))(x);function F(e){return 100<e?"bad-fk dark":80<e?"good-fk":50<e?"ok-fk":"bad-fk"}function K(e){return K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},K(e)}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(a=r.key,o=void 0,o=function(e,t){if("object"!==K(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==K(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"),"symbol"===K(o)?o:String(o)),r)}var a,o}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},U(e,t)}function q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=$(e);if(t){var a=$(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===K(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return W(e)}(this,n)}}function W(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$(e)}var z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t)}(c,e);var t,n,r,l=q(c);function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.apply(this,arguments)).state={activeTab:""},e.setState=e.setState.bind(W(e)),e}return t=c,n=[{key:"render",value:function(){return wp.element.createElement("div",{className:"rank-math-ca-recommendations"},this.getRecommendations(this.props.recommendations))}},{key:"getRecommendations",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=[];return(0,o.forEach)(e,(function(e,l){if("total"!==l){var c=(0,o.isUndefined)(e.total)?e:e.total,s=t.getPostStats(l),u=a()(l,{"has-children":!(0,o.isUndefined)(e.total),show:l===t.state.activeTab}),m=t.getScore(l,s,c,n),p=(0,o.ceil)(150*c/100);r.push(wp.element.createElement("div",{key:l,className:u+" "+F(m),onClick:function(){return t.setState({activeTab:t.state.activeTab!==l?l:""})},role:"presentation"},wp.element.createElement("h4",null,n?l:(0,o.startCase)(l)),n&&wp.element.createElement("span",null,s," / ",c),!n&&wp.element.createElement(React.Fragment,null,wp.element.createElement("strong",null,s),wp.element.createElement("span",{className:"desc"},(0,i.__)("Use","rank-math")," ",c," ",(0,i.__)("to","rank-math")," ",p)),(0,o.isObject)(e)&&t.getRecommendations(e,!0)))}})),n?wp.element.createElement("div",{className:"submenu"},r):r}},{key:"getPostStats",value:function(e){return(0,o.has)(this.props.postStats,e)?this.props.postStats[e]:0}},{key:"getScore",value:function(e,t,n,r){var a=t===n?100:t/n*100;if(0===n&&t<=2&&(a=100),r)return a>100&&a<=125?100:a;var o=a>80?100:t/n*80;return a>125&&"wordCount"!==e&&(o=0),this.props.updateAiScore(e,o),a>100&&"wordCount"===e||a>100&&a<=125?100:a}}],n&&L(t.prototype,n),r&&L(t,r),Object.defineProperty(t,"prototype",{writable:!1}),c}(s.Component),H=(0,h.compose)((0,m.withSelect)((function(e,t){var n=1518,r=12,a=2,i=5,l=3,c=0,s=0,u=0,m=8,p=19;if(t.hasCredits){var h=t.researcher.getResearch("wordCount"),f=rankMathEditor.assessor.analyzer.defaultAnalyses.contentHasAssets;n=h(t.content),r=(0,o.isUndefined)(f)||(0,o.isUndefined)(t.researcher.paper)?0:f.getImages(t.researcher.paper,t.content),a=(0,o.isUndefined)(f)?0:f.getVideos(t.content),i=(t.content.match(/<h2\b[^>]*>(.*?)<\/h2>/g)||[]).length,l=(t.content.match(/<h3\b[^>]*>(.*?)<\/h3>/g)||[]).length,c=(t.content.match(/<h4\b[^>]*>(.*?)<\/h4>/g)||[]).length,s=(t.content.match(/<h5\b[^>]*>(.*?)<\/h5>/g)||[]).length,u=(t.content.match(/<h6\b[^>]*>(.*?)<\/h6>/g)||[]).length;var d=t.researcher.getResearch("getLinkStats")(t.content);m=d.internalTotal,p=d.externalTotal}return{postStats:{wordCount:n,images:r,videos:a,mediaCount:r+a,h2:i,h3:l,h4:c,h5:s,h6:u,headingCount:i+l+c+s+u,internal:m,external:p,linkCount:m+p}}})))(z),J=rankMathAnalyzer;function Q(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=rankMath.links[e]||"";if(!n)return"#";if(!t)return n;var r={utm_source:"Plugin",utm_medium:encodeURIComponent(t),utm_campaign:"WP"};return n+"?"+Object.keys(r).map((function(e){return"".concat(e,"=").concat(r[e])})).join("&")}function Y(e){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Y(e)}function G(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(a=r.key,o=void 0,o=function(e,t){if("object"!==Y(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"),"symbol"===Y(o)?o:String(o)),r)}var a,o}function V(e,t){return V=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},V(e,t)}function X(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ee(e);if(t){var a=ee(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Z(e)}(this,n)}}function Z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ee(e){return ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ee(e)}var te=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&V(e,t)}(u,e);var t,n,r,l=X(u);function u(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(e=l.apply(this,arguments)).state={type:"content",selected:""},e.setState=e.setState.bind(Z(e)),e.initializeClipboard(e.setState),e}return t=u,n=[{key:"initializeClipboard",value:function(e){"function"==typeof ClipboardJS&&this.props.hasCredits&&new ClipboardJS(".rank-math-tooltip strong",{text:function(e){return e.getAttribute("data-key")}}).on("success",(function(){setTimeout((function(){e({selected:""})}),3e3)}))}},{key:"render",value:function(){var e=this;return wp.element.createElement(s.Fragment,null,wp.element.createElement(c.PanelBody,{initialOpen:!0},wp.element.createElement(c.SelectControl,{label:(0,i.__)("Use Keyword in","rank-math"),value:this.state.type,options:[{value:"content",label:(0,i.__)("Content","rank-math")},{value:"heading",label:(0,i.__)("Headings","rank-math")},{value:"title",label:(0,i.__)("SEO Title","rank-math")},{value:"description",label:(0,i.__)("SEO Description","rank-math")}],onChange:function(t){e.setState({type:t})}}),wp.element.createElement(c.Button,{className:"is-link",href:Q("content-ai-keywords","Sidebar Keywords KB Icon"),rel:"noreferrer",target:"_blank",id:"rank-math-help-icon",label:(0,i.__)("Know more about Keywords.","rank-math"),showTooltip:!0},"﹖"),wp.element.createElement(React.Fragment,null,wp.element.createElement("span",{className:"components-form-token-field__help"},(0,i.__)("Click on any keyword to copy it.","rank-math")),wp.element.createElement("br",null),(0,o.includes)(["title","description"],this.state.type)&&wp.element.createElement("span",{className:"components-form-token-field__help"},(0,i.__)("Please use only one or two keywords from here.","rank-math")),wp.element.createElement("ul",null,this.getKeywords())),this.getRelatedKeywords()))}},{key:"getRelatedKeywords",value:function(){var e=this;if("content"!==this.state.type||(0,o.isEmpty)(this.props.caData.data.related_keywords))return!1;var t=[];return(0,o.forEach)(this.props.caData.data.related_keywords,(function(n){t.push(wp.element.createElement("li",{className:"rank-math-tooltip show",onClick:function(){return e.setState({selected:n})},role:"presentation"},wp.element.createElement("strong",{"data-key":n},n),e.getTooltipContent({keyword:n},!0)))})),wp.element.createElement("div",{className:"rank-math-related-keywords"},wp.element.createElement("h3",null,(0,i.__)("Related Keywords","rank-math")),wp.element.createElement("ul",null,t))}},{key:"getKeywords",value:function(){var e=this;if((0,o.isEmpty)(this.props.caData.data.keywords))return wp.element.createElement("h3",{className:"no-data"},(0,i.__)("There are no recommended Keywords for this researched keyword.","rank-math"));var t=[];return this.contentAiScore={},(0,o.forEach)(this.props.caData.data.keywords,(function(n,r){(0,o.isEmpty)(n)||(e.contentAiScore[r]={},(0,o.forEach)(n,(function(n){if(!(0,o.isEmpty)(n.keyword)){var i=e.props.hasCredits?e.getCount(n.keyword,r):n.count,l=F(e.getScore(n.keyword,i,n.average,r)),c=a()("rank-math-tooltip",{show:e.state.type===r});t.push(wp.element.createElement("li",{className:c+" "+l,onClick:function(){return e.setState({selected:n.keyword})},role:"presentation"},wp.element.createElement("strong",{"data-key":n.keyword},n.keyword,wp.element.createElement("span",null,i," / ",n.average)),e.getTooltipContent(n)))}})))})),this.updateContentAiScore(),t}},{key:"updateContentAiScore",value:function(){var e=0,t=0;(0,o.forEach)(this.contentAiScore,(function(n,r){var a=Object.values(n),i=(0,o.sum)(a);"title"!==r&&"description"!==r||100!==(0,o.max)(a)||(i=100*a.length),e+=i,t+=a.length})),e/=t,(0,o.isNaN)(e)||this.props.updateAiScore("keywords",e)}},{key:"getScore",value:function(e,t,n,r){var a=t/n*100;return this.contentAiScore[r][e]=a>100?0:a>80?100:a,a}},{key:"getTooltipContent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.props.hasCredits)return this.state.selected===e.keyword?wp.element.createElement("span",{className:"rank-math-tooltip-data"},(0,i.__)("Copied","rank-math")):e.competition||e.cpc||e.search_volume?wp.element.createElement("span",{className:"rank-math-tooltip-data"},wp.element.createElement("span",null,(0,i.__)("Ad Competition:","rank-math")," ",(0,o.round)(100*e.competition)),wp.element.createElement("span",null,(0,i.__)("CPC:","rank-math")," $",(0,o.round)(e.cpc,2)),wp.element.createElement("span",null,(0,i.__)("Volume:","rank-math")," ",(0,o.round)(e.search_volume))):wp.element.createElement("span",{className:"rank-math-tooltip-data"},t?(0,i.__)("Click to copy keyword","rank-math"):(0,i.__)("No data available","rank-math"))}},{key:"getCount",value:function(e,t){var n=this.props.caData.content;if(e=(0,o.isString)(e)?J.Helpers.removeDiacritics(e).toLowerCase():e,"heading"===t){e=e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&");var r=new RegExp("<h[2-6][^>]*>.*?"+e+".*?</h[2-6]>","g"),a=n.match(r);return(0,o.isNull)(a)?0:a.length}return"title"===t&&(n=this.props.caData.title),"description"===t&&(n=this.props.caData.description),J.Helpers.cleanTagsOnly(n).split(e).length-1}}],n&&G(t.prototype,n),r&&G(t,r),Object.defineProperty(t,"prototype",{writable:!1}),u}(s.Component),ne=(0,h.compose)((0,m.withDispatch)((function(e){return{toggleEditor:function(){e("rank-math").toggleSnippetEditor(!0)}}})))(te),re=function(){return!((0,o.isNil)(window.wp)||(0,o.isNil)(wp.data)||(0,o.isNil)(wp.data.select("core/editor"))||!window.document.body.classList.contains("block-editor-page")||!(0,o.isFunction)(wp.data.select("core/editor").getEditedPostAttribute))};function ae(e){return ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ae(e)}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(a=r.key,o=void 0,o=function(e,t){if("object"!==ae(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==ae(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"),"symbol"===ae(o)?o:String(o)),r)}var a,o}function ie(e,t){return ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ie(e,t)}function le(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=se(e);if(t){var a=se(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===ae(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ce(e)}(this,n)}}function ce(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){return se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},se(e)}var ue=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ie(e,t)}(l,e);var t,n,r,a=le(l);function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=a.apply(this,arguments)).state={iconClass:"rm-icon-copy",selected:""},e.setState=e.setState.bind(ce(e)),e.initializeClipboard(e.setState),e}return t=l,(n=[{key:"initializeClipboard",value:function(e){var t=this;"function"==typeof ClipboardJS&&new ClipboardJS(".rank-math-copy-questions, .rank-math-questions-item h3",{text:function(e){if(!(0,o.isNull)(e.getAttribute("data-key")))return e.getAttribute("data-key");if(!re())return document.getElementById("rank-math-ca-questions-data").innerHTML;var n=[];return(0,o.forEach)(t.props.caData.data.related_questions,(function(e){n.push({id:(0,o.uniqueId)("faq-question-"),title:e,content:"",visible:!0})})),"\x3c!-- wp:rank-math/faq-block "+JSON.stringify({questions:n})+' --\x3e<div class="wp-block-rank-math-faq-block"></div>\x3c!-- /wp:rank-math/faq-block --\x3e'}}).on("success",(function(){setTimeout((function(){e({iconClass:"rm-icon-copy"})}),3e3)}))}},{key:"render",value:function(){var e=this,t=[];return(0,o.isEmpty)(this.props.caData.data.related_questions)?wp.element.createElement("h3",{className:"no-data"},(0,i.__)("There are no recommended Questions for this researched keyword.","rank-math")):((0,o.forEach)(this.props.caData.data.related_questions,(function(n,r){t.push(wp.element.createElement("div",{className:"rank-math-questions-item",key:r},wp.element.createElement("h3",{className:"rank-math-tooltip","data-key":n,onClick:function(){return e.setState({selected:n})},role:"presentation"},n,e.getTooltipContent(n))))})),wp.element.createElement(s.Fragment,null,wp.element.createElement(c.PanelBody,{initialOpen:!0},wp.element.createElement("div",{className:"rank-math-section-heading"},wp.element.createElement("h2",null,(0,i.__)("Related Questions","rank-math"),wp.element.createElement("a",{href:Q("content-ai-settings","Sidebar Questions KB Icon"),rel:"noreferrer",target:"_blank",id:"rank-math-help-icon",title:(0,i.__)("Know more about Questions.","rank-math")},"﹖")),wp.element.createElement(c.Button,{onClick:function(){e.setState({iconClass:"rm-icon-tick"})},className:"rank-math-copy-questions button-secondary rank-math-tooltip left"},wp.element.createElement("i",{className:"rm-icon "+this.state.iconClass}),wp.element.createElement("span",null,(0,i.__)("Copy this data as a FAQ Block.","rank-math")))),wp.element.createElement("span",{className:"components-form-token-field__help"},(0,i.__)("Click on any question to copy it.","rank-math")),wp.element.createElement("div",{id:"rank-math-ca-questions-data"},t))))}},{key:"getTooltipContent",value:function(e){return this.state.selected===e&&wp.element.createElement("span",{className:"rank-math-tooltip-data"},(0,i.__)("Copied","rank-math"))}}])&&oe(t.prototype,n),r&&oe(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(s.Component),me=ue,pe=function(e){var t=[];return(0,o.isEmpty)(e.caData.data.links)?wp.element.createElement("h3",{className:"no-data"},(0,i.__)("There are no recommended Links for this researched keyword.","rank-math")):((0,o.forEach)(e.caData.data.links,(function(e,n){return t.push(wp.element.createElement("li",{key:n},wp.element.createElement("a",{href:e,rel:"noreferrer",target:"_blank"},e)))})),wp.element.createElement(s.Fragment,null,wp.element.createElement(c.PanelBody,{initialOpen:!0},wp.element.createElement("div",{className:"rank-math-section-heading"},wp.element.createElement("h2",null,(0,i.__)("Related External Links","rank-math"),wp.element.createElement(c.Button,{className:"is-link",href:Q("content-ai-links","Sidebar Links KB Icon"),rel:"noreferrer",target:"_blank",id:"rank-math-help-icon",label:(0,i.__)("Know more about Links.","rank-math"),showTooltip:!0},"﹖")),wp.element.createElement("p",null,(0,i.__)("Use some of these external links in the content area. It is recommended to add","rank-math")," ",wp.element.createElement("a",{href:Q("about-and-mentions-schema","Use Some External Links"),rel:"noreferrer",target:"_blank"},(0,i.__)("about or mention Schema.","rank-math")))),wp.element.createElement("ul",null,t))))},he=function(e){"social"===e&&(0,m.dispatch)("rank-math").toggleSnippetEditor(!0)},fe=function(e){return wp.element.createElement(P,{className:"rank-math-contentai-tabs",activeClass:"is-active",tabs:[{name:"keywords",title:wp.element.createElement(s.Fragment,null,wp.element.createElement("span",null,(0,i.__)("Keywords","rank-math"))),view:ne,className:"rank-math-keywords-tab"},{name:"questions",title:wp.element.createElement(s.Fragment,null,wp.element.createElement("span",null,(0,i.__)("Questions","rank-math"))),view:me,className:"rank-math-questions-tab"},{name:"links",title:wp.element.createElement(s.Fragment,null,wp.element.createElement("span",null,(0,i.__)("Links","rank-math"))),view:pe,className:"rank-math-recommended-links-tab"}],onSelect:he,data:e},(function(t,n){return wp.element.createElement("div",{className:"rank-math-contentai-tab-content-"+t.name,key:n},(0,s.createElement)(t.view,e))}))},de=React;function ye(e){return e.startsWith("{{/")?{type:"componentClose",value:e.replace(/\W/g,"")}:e.endsWith("/}}")?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.startsWith("{{")?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}function ke(e,t){let n,r,a=[];for(let o=0;o<e.length;o++){const i=e[o];if("string"!==i.type){if(void 0===t[i.value])throw new Error(`Invalid interpolation, missing component node: \`${i.value}\``);if("object"!=typeof t[i.value])throw new Error(`Invalid interpolation, component node must be a ReactElement or null: \`${i.value}\``);if("componentClose"===i.type)throw new Error(`Missing opening component token: \`${i.value}\``);if("componentOpen"===i.type){n=t[i.value],r=o;break}a.push(t[i.value])}else a.push(i.value)}if(n){const o=function(e,t){const n=t[e];let r=0;for(let a=e+1;a<t.length;a++){const e=t[a];if(e.value===n.value){if("componentOpen"===e.type){r++;continue}if("componentClose"===e.type){if(0===r)return a;r--}}}throw new Error("Missing closing component token `"+n.value+"`")}(r,e),i=ke(e.slice(r+1,o),t),l=(0,de.cloneElement)(n,{},i);if(a.push(l),o<e.length-1){const n=ke(e.slice(o+1),t);a=a.concat(n)}}return a=a.filter(Boolean),0===a.length?null:1===a.length?a[0]:(0,de.createElement)(de.Fragment,null,...a)}function we(e){const{mixedString:t,components:n,throwErrors:r}=e;if(!n)return t;if("object"!=typeof n){if(r)throw new Error(`Interpolation Error: unable to process \`${t}\` because components is not an object`);return t}const a=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(ye)}(t);try{return ke(a,n)}catch(e){if(r)throw new Error(`Interpolation Error: unable to process \`${t}\` because of error \`${e.message}\``);return t}}var be=function(e){var t=e.tags,n=e.components,r=e.children;return n=n||{},!1===(0,o.isUndefined)(t)&&(t=t.split(",")).forEach((function(e){var t=e;n[e]=wp.element.createElement(t,null)})),we({mixedString:r,components:n})},ve=function(e,t){"free"===rankMath.contentAIPlan&&(t+="+Free+Plan");var n=new URLSearchParams({utm_source:"Plugin",utm_medium:t,utm_campaign:"WP"});return(0,o.includes)(e,"?")||(e+="?"),e+n.toString()},ge=function(e){var t=e.width,n=void 0===t?40:t,r=e.showProNotice,a=void 0!==r&&r,o=e.isBulkEdit,l=void 0!==o&&o,s=e.isResearch,u=void 0!==s&&s;if(a)return function(e){return wp.element.createElement("div",{id:"rank-math-pro-cta",className:"center rank-math-content-ai-warning-wrapper"},wp.element.createElement("div",{className:"rank-math-cta-box blue-ticks top-20 less-padding "+e},wp.element.createElement("h3",null,(0,i.__)("🔒 This is a PRO-Only Feature","rank-math")),wp.element.createElement("p",null,(0,i.__)("We are sorry but this feature is only available to Rank Math PRO/Business/Agency Users. Unlock this feature and many more by getting a Rank Math plan.","rank-math")),wp.element.createElement("ul",null,wp.element.createElement("li",null,(0,i.__)("Bulk Edit SEO Tags","rank-math")),wp.element.createElement("li",null,(0,i.__)("Advanced Google Analytics 4 Integration","rank-math")),wp.element.createElement("li",null,(0,i.__)("Keyword Rank Tracker","rank-math")),wp.element.createElement("li",null,(0,i.__)("Free Content AI Trial","rank-math")),wp.element.createElement("li",null,(0,i.__)("SEO Performance Email Reports","rank-math"))),wp.element.createElement(c.Button,{href:rankMath.links.pro,target:"_blank",className:"button button-primary is-green"},(0,i.__)("Learn More","rank-math"))))}(n);var m=rankMath.isUserRegistered,p=rankMath.contentAIPlan,h="free"===p,f=rankMath.contentAICredits>0,d=rankMath.contentAiMigrating;if(f&&u&&!h&&rankMath.contentAICredits<500&&(f=!1),m&&p&&f&&!d&&!h)return null;var y,k="width-"+n;return!m||!p||f&&h?wp.element.createElement("div",{id:"rank-math-pro-cta",className:"center rank-math-content-ai-warning-wrapper"},wp.element.createElement("div",{className:"rank-math-cta-box blue-ticks top-20 less-padding "+k},wp.element.createElement("h3",null,(0,i.__)("🚀 Supercharge Your Content With AI","rank-math")),wp.element.createElement("p",null,!m&&!l&&(0,i.__)("Start using Content AI by connecting your RankMath.com Account","rank-math"),m&&!p&&!l&&!h&&(0,i.__)("To access this Content AI feature, you need to have an active subscription plan.","rank-math"),m&&!l&&h&&(0,i.__)("To access this Content AI feature, you have to purchase a Content AI Subscription.","rank-math"),l&&(0,i.__)("You are one step away from unlocking this premium feature along with many more.","rank-math")),function(e,t,n){return t?wp.element.createElement("ul",null,wp.element.createElement("li",null,(0,i.__)("Bulk Update Your SEO Meta using AI","rank-math")),wp.element.createElement("li",null,(0,i.__)("Get Access to 40+ AI SEO Tools","rank-math")),wp.element.createElement("li",null,(0,i.__)("125+ Expert-Written Prompts","rank-math")),wp.element.createElement("li",null,(0,i.__)("1-Click Competitor Content Research","rank-math")),wp.element.createElement("li",null,(0,i.__)("1-Click WooCommerce Product Descriptions","rank-math"))):n?wp.element.createElement("ul",null,wp.element.createElement("li",null,(0,i.__)("1-Click Competitor Research","rank-math")),wp.element.createElement("li",null,(0,i.__)("On-Page SEO Suggestions","rank-math")),wp.element.createElement("li",null,(0,i.__)("1-Click Bulk SEO Meta","rank-math")),wp.element.createElement("li",null,(0,i.__)("125+ Pre-Built Prompts","rank-math")),wp.element.createElement("li",null,(0,i.__)("Multiple RankBot Sessions","rank-math"))):40===e?wp.element.createElement("ul",null,wp.element.createElement("li",null,(0,i.__)("1-Click SEO Content","rank-math")),wp.element.createElement("li",null,(0,i.__)("1-Click SEO Meta","rank-math")),wp.element.createElement("li",null,(0,i.__)("40+ Specialized AI Tools","rank-math")),wp.element.createElement("li",null,(0,i.__)("1-Click Competitor Research","rank-math")),wp.element.createElement("li",null,(0,i.__)("125+ Pre-Built Prompts","rank-math"))):wp.element.createElement("ul",null,wp.element.createElement("li",null,(0,i.__)("Gain access to 40+ advanced AI tools, empowering your content strategy.","rank-math")),wp.element.createElement("li",null,(0,i.__)("Experience the revolutionary AI-powered Content Editor for unparalleled efficiency.","rank-math")),wp.element.createElement("li",null,(0,i.__)("Engage with RankBot, your personal AI Chat Assistant, for real-time assistance.","rank-math")))}(n,l,h),!m&&wp.element.createElement(c.Button,{href:rankMath.connectSiteUrl,className:"button button-primary is-green"},(0,i.__)("Connect Now","rank-math")),m&&(!p||h)&&wp.element.createElement(c.Button,{href:ve(rankMath.links["content-ai"]+"?play-video=ioPeVIntJWw","Buy+Plan+Button"),className:"button button-primary is-green",target:"_blank"},(0,i.__)("Learn More","rank-math")))):d?wp.element.createElement("div",{id:"rank-math-pro-cta",className:"center rank-math-content-ai-warning-wrapper"},wp.element.createElement("div",{style:{textAlign:"center"},className:"rank-math-cta-box less-padding top-20 "+k},wp.element.createElement("h3",null,(0,i.__)("Server Maintenance Underway","rank-math")),wp.element.createElement("p",null,(0,i.__)("We are working on improving your Content AI experience. Please wait for 5 minutes and then refresh to start using the optimized Content AI. If you see this for more than 5 minutes, please ","rank-math"),wp.element.createElement("a",{href:rankMath.links.support,target:"_blank",rel:"noreferrer"},(0,i.__)("reach out to the support team.","rank-math")),(0,i.__)(" We are sorry for the inconvenience.","rank-math")))):wp.element.createElement("div",{id:"rank-math-pro-cta",className:"center rank-math-content-ai-warning-wrapper"},wp.element.createElement("div",{className:"rank-math-cta-box less-padding top-20 "+k},wp.element.createElement("h3",null,(0,i.__)("⛔️ Content AI Credit Alert!","rank-math")),wp.element.createElement("p",null,(y=rankMath.contentAIRefreshDate?rankMath.contentAIRefreshDate:"")?wp.element.createElement(be,{components:{strong:wp.element.createElement("strong",null)}},(0,i.sprintf)((0,i.__)("Your monthly Content AI credits have been fully utilized. You can wait till %s for your credits to refresh or upgrade to continue enjoying seamless content creation","rank-math"),"{{strong}}"+y+"{{/strong}}")):(0,i.__)("Your monthly Content AI credits have been fully utilized. To continue enjoying seamless content creation, simply click the button below to upgrade your plan and access more credits.","rank-math")),wp.element.createElement(c.Button,{href:ve(rankMath.links["content-ai"]+"?play-video=ioPeVIntJWw","Buy+Credits+Button"),className:"button button-primary is-green",target:"_blank"},(0,i.__)("Learn More","rank-math")),wp.element.createElement(c.Button,{variant:"link",href:ve(rankMath.links["content-ai-restore-credits"],"Buy+Credits+Button"),className:"button button-secondary",target:"_blank"},(0,i.__)("Missing Credits?","rank-math"))))};function _e(e){return _e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_e(e)}function Ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(a=r.key,o=void 0,o=function(e,t){if("object"!==_e(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==_e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"),"symbol"===_e(o)?o:String(o)),r)}var a,o}function Se(e,t){return Se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Se(e,t)}function Ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Pe(e);if(t){var a=Pe(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===_e(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Oe(e)}(this,n)}}function Oe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pe(e){return Pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pe(e)}var je=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Se(e,t)}(p,e);var n,r,u,m=Ce(p);function p(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),(e=m.apply(this,arguments)).state={keyword:e.props.keyword,showResearch:e.props.keyword!==rankMath.ca_keyword.keyword,country:e.props.country,credits:1,loading:!1},e.setState=e.setState.bind(Oe(e)),e}return n=p,(r=[{key:"render",value:function(){var e=(0,o.isEmpty)(rankMath.contentAIPlan)||"free"===rankMath.contentAIPlan,t=this.hasCredits(),n=!t||e,r=a()("rank-math-content-ai-data",{loading:this.state.loading,blurred:n}),l=this.props.data;return(n||"show_dummy_data"===l)&&(l=this.getDummyData()),wp.element.createElement(s.Fragment,null,wp.element.createElement(c.PanelBody,{className:"rank-math-content-ai-wrapper research",initialOpen:!0},wp.element.createElement(React.Fragment,null,!n&&this.getHeader(),!n&&this.keywordField(),wp.element.createElement("div",{className:r},wp.element.createElement("span",{className:"loader-text"},wp.element.createElement("span",null,(0,i.__)("Fetching Search Results","rank-math")),wp.element.createElement("span",null,(0,i.__)("Analysing Your Competitors","rank-math")),wp.element.createElement("span",null,(0,i.__)("Crunching the Numbers","rank-math")),wp.element.createElement("span",null,(0,i.__)("Cooking a Personalized SEO Plan","rank-math")),wp.element.createElement("span",null,(0,i.__)("Final Touches to the SEO Recommendations","rank-math"))),(0,o.isString)(l)&&wp.element.createElement("h3",{className:"no-data",dangerouslySetInnerHTML:{__html:l}}),!(0,o.isEmpty)(l)&&!(0,o.isString)(l)&&wp.element.createElement("div",null,wp.element.createElement("h3",{className:"rank-math-ca-section-title"},(0,i.__)("Content AI","rank-math"),wp.element.createElement("span",null,(0,i.__)("New!","rank-math")),wp.element.createElement(c.Button,{className:"is-link",href:Q("content-ai-settings","Sidebar KB Icon"),rel:"noreferrer",target:"_blank",id:"rank-math-help-icon",label:(0,i.__)("Content AI Knowledge Base.","rank-math"),showTooltip:!0},"﹖")),wp.element.createElement(D,null),wp.element.createElement(H,{recommendations:l.recommendations,hasCredits:t,content:this.props.content,researcher:this.props.researcher,updateAiScore:this.props.updateAiScore,hasThumbnail:this.props.hasThumbnail}),wp.element.createElement(fe,{caData:this.props,updateAiScore:this.props.updateAiScore,hasCredits:t}))),n&&wp.element.createElement(ge,{isResearch:!0}))))}},{key:"hasCredits",value:function(){return!(0,o.isEmpty)(this.props.data)||rankMath.isUserRegistered&&rankMath.ca_credits>=500}},{key:"getDummyData",value:function(){return{keywords:{content:{"rank math":{keyword:"rank math",average:17,count:12},"rank math vs yoast seo":{keyword:"rank math vs yoast seo",average:1,count:1},"what is rank math":{keyword:"what is rank math",average:1,count:1},"rank math schema":{keyword:"rank math schema",average:1,count:1},"rank math configuration":{keyword:"rank math configuration",average:1,count:1},"rank math pro version":{keyword:"rank math pro version",average:1,count:2},"rank math comparison":{keyword:"rank math comparison",average:1,count:1},"rank math for seo":{keyword:"rank math for seo",average:1,count:1},"seo by rank math":{keyword:"seo by rank math",average:1,count:0}}},related_keywords:["rank math plugin","rank math pricing","rank math vs yoast","rank math review","rank math premium","how to use rank math","rank math training","rank math woocommerce","wordpress seo plugin"],recommendations:{wordCount:1829,linkCount:{total:16},headingCount:{total:9},mediaCount:{total:18}}}}},{key:"getHeader",value:function(){var e=this;return wp.element.createElement("div",{className:"rank-math-ca-top-section"},(0,o.includes)(["elementor","divi"],rankMath.currentEditor)&&wp.element.createElement(c.Button,{onClick:function(){return t()(".rank-math-general-tab").trigger("click")}},wp.element.createElement("i",{className:"dashicons dashicons-arrow-left-alt"}),(0,i.__)("Back","rank-math")),wp.element.createElement(c.SelectControl,{value:this.state.country,onChange:function(t){return e.setState({country:t,showResearch:!0})},options:rankMath.countries}))}},{key:"keywordField",value:function(){var e=this;return wp.element.createElement("div",{className:"rank-math-ca-keywords-wrapper"},wp.element.createElement("div",{className:"rank-math-ca-credits-wrapper"},wp.element.createElement(c.TextControl,{label:(0,i.__)("Focus Keyword","rank-math"),value:this.state.keyword,onChange:function(t){return e.setState({keyword:t,showResearch:!0})},onKeyDown:function(e){"Enter"===e.key&&e.preventDefault()},help:(0,l.applyFilters)("rank_math_content_ai_help_text",wp.element.createElement(React.Fragment,null,(0,i.__)("Upgrade to buy more credits from ","rank-math"),wp.element.createElement("a",{href:Q("content-ai-pricing-tables","Sidebar Upgrade Text"),rel:"noreferrer",target:"_blank",title:(0,i.__)("Content AI Pricing.","rank-math")},(0,i.__)("here.","rank-math")))),placeholder:(0,i.__)("Suggested length 2-3 Words","rank-math")}),wp.element.createElement("div",{className:"help-text"},(0,i.__)("To learn how to use it","rank-math")," ",wp.element.createElement("a",{href:Q("content-ai-settings","Content AI Sidebar KB Link"),target:"_blank",rel:"noreferrer"},(0,i.__)("Click here","rank-math"))),!this.state.showResearch&&!this.state.loading&&!(0,o.isEmpty)(this.props.data)&&rankMath.ca_credits>=500&&wp.element.createElement(c.Button,{className:"rank-math-ca-force-update",onClick:function(){return e.props.researchKeyword(e.state,e.setState,!0)},label:(0,i.__)("Refresh will use 500 Credit.","rank-math"),showTooltip:!0},wp.element.createElement("i",{className:"dashicons dashicons-image-rotate"}))),this.state.showResearch&&wp.element.createElement(c.Button,{className:"is-primary",onClick:function(){return e.props.researchKeyword(e.state,e.setState)},label:(0,i.__)("500 credits will be used.","rank-math"),disabled:!this.state.keyword,showTooltip:!0},(0,i.__)("Research","rank-math")))}}])&&Ee(n.prototype,r),u&&Ee(n,u),Object.defineProperty(n,"prototype",{writable:!1}),p}(s.Component),Ne=(0,h.compose)((0,m.withSelect)((function(e){var t=rankMathEditor.assessor.analyzer.researcher,n=t.paper;return{data:e("rank-math").getKeywordsData(),keyword:(0,o.get)(rankMath.ca_keyword,"keyword",e("rank-math").getKeywords().split(",")[0]),country:(0,o.get)(rankMath.ca_keyword,"country",rankMath.contentAiCountry),researcher:t,content:(0,o.isUndefined)(n)?"":n.getTextLower(),title:(0,o.isUndefined)(n)?"":n.getTitle().toLowerCase(),description:(0,o.isUndefined)(n)?"":n.getDescription().toLowerCase(),hasThumbnail:(0,o.isUndefined)(n)?"":n.hasThumbnail(),score:e("rank-math").getContentAIScore()}})),(0,m.withDispatch)((function(e,t){return{researchKeyword:function(n,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n.force_update=a,n.objectID=rankMath.objectID,n.objectType=rankMath.objectType,r({showResearch:!1,loading:!0}),N()({method:"POST",path:"/rankmath/v1/ca/researchKeyword",data:n}).catch((function(e){r({loading:!1,showResearch:!0}),alert(e.message)})).then((function(n){r({loading:!1}),e("rank-math").updateKeywordsData(n.data),(0,o.isNull)(n.credits)||(0,o.isUndefined)(n.credits)||(r({credits:n.credits}),t.setCredits((0,o.isNumber)(n.credits)?n.credits:0)),(0,l.doAction)("rank_math_content_ai_changed",n.keyword)}))},updateAiScore:function(n,r){var a=t.score;a[n]=(0,o.round)(r,2),e("rank-math").updateAIScore(a)}}})))(je);function Ae(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Re(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Te(){var e,t=Ae((0,s.useState)(""),2),n=t[0],r=t[1],o=Ae((0,s.useState)(rankMath.ca_credits),2),u=o[0],m=o[1],p=a()("rank-math-tooltip update-credits",{loading:n});return wp.element.createElement(c.PanelBody,{className:"rank-math-content-ai-wrapper",initialOpen:!0},rankMath.isUserRegistered&&wp.element.createElement("div",{className:"rank-math-ca-credits"},wp.element.createElement(c.Button,{className:p,onClick:function(){r(!0),N()({method:"POST",path:"/rankmath/v1/ca/getCredits"}).catch((function(e){r(""),alert(e.message)})).then((function(e){e.error?alert(e.error):m(e),r("")}))}},wp.element.createElement("i",{className:"dashicons dashicons-image-rotate"}),wp.element.createElement("span",null,(0,i.__)("Click to refresh the available credits.","rank-math"))),wp.element.createElement("span",null,(0,i.__)("Credits","rank-math"))," ",wp.element.createElement("strong",{title:u},(e=u,Math.abs(e)>999?Math.sign(e)*(Math.abs(e)/1e3).toFixed(1)+"k":Math.sign(e)*Math.abs(e))),wp.element.createElement("a",{href:Q("content-ai-credits-usage","Sidebar Credits Tooltip Icon"),rel:"noreferrer",target:"_blank",id:"rank-math-help-icon",title:(0,i.__)("Know more about credits.","rank-math")},"﹖")),wp.element.createElement(P,{className:"rank-math-tabs",activeClass:"is-active",tabs:(0,l.applyFilters)("rank_math_content_ai_tabs",[{name:"content-ai",title:wp.element.createElement(s.Fragment,null,wp.element.createElement("i",{className:"rm-icon rm-icon-analyzer",title:(0,i.__)("Research","rank-math")}),wp.element.createElement("span",null,(0,i.__)("Research","rank-math"))),view:Ne,className:"rank-math-general-tab"}])},(function(e){return wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"rank-math-tab-content-"+e.name},(0,s.createElement)(e.view,{setCredits:m,hasContentAiError:!rankMath.isUserRegistered||!rankMath.contentAIPlan||!rankMath.contentAICredits||rankMath.contentAiMigrating})))})))}function Me(e){return Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Me(e)}function Ie(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Me(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Me(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Me(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Be=(0,m.withSelect)((function(e){var t=e("rank-math"),n=Object.values(t.getContentAIScore());return n=(0,o.isEmpty)(n)||!rankMath.isUserRegistered?rankMath.contentAiScore:(0,o.round)((0,o.sum)(n)/n.length),{isLoaded:t.isLoaded(),score:(0,o.isUndefined)(n)?0:n}}))((function(e){var t=e.isLoaded,n=e.score,r="free"===rankMath.contentAIPlan,o=a()("rank-math-toolbar-score content-ai-score",Ie(Ie(Ie({},F(n),!0),"loading",!t),"is-free",r));return wp.element.createElement("div",{className:o},r&&wp.element.createElement("span",{className:"rank-math-free-badge"},(0,i.__)("Free","rank-math")),wp.element.createElement("i",{className:"rm-icon rm-icon-content-ai"}),wp.element.createElement("span",{className:"content-ai-score"},n," / 100"))}));function xe(e){return xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xe(e)}function De(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(a=r.key,o=void 0,o=function(e,t){if("object"!==xe(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==xe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"),"symbol"===xe(o)?o:String(o)),r)}var a,o}var Fe=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rankMath.isUserRegistered&&(this.init=this.init.bind(this),this.contentLength=this.contentLength.bind(this),this.contentLengthBoundary=this.contentLengthBoundary.bind(this),this.keywordDensity=this.keywordDensity.bind(this),this.removeTests=this.removeTests.bind(this),this.researchesTests=rankMath.assessor.researchesTests,this.ca_keyword=rankMath.ca_keyword.keyword,(0,l.addAction)("rank_math_loaded","rank-math",this.init),(0,l.addAction)("rank_math_keyword_refresh","rank-math",this.init),(0,l.addAction)("rank_math_content_ai_changed","rank-math",this.init))}var t,n,r;return t=e,(n=[{key:"init",value:function(e){e&&(this.ca_keyword=e),this.keyword=rankMathEditor.assessor.getPrimaryKeyword(),this.data=(0,m.select)("rank-math").getKeywordsData(),(0,o.isEmpty)(this.data)||(this.filters(),this.removeTests(),e&&rankMathEditor.refresh("content"))}},{key:"removeTests",value:function(){if(this.ca_keyword===this.keyword){var e=this.data.recommendations;rankMath.assessor.researchesTests=(0,o.filter)(rankMath.assessor.researchesTests,(function(t){return!(!e.mediaCount&&"contentHasAssets"===t||!e.linkCount.internal&&"linksHasInternal"===t||!(e.linkCount.external||"linksHasExternals"!==t&&"linksNotAllExternals"!==t))}))}else rankMath.assessor.researchesTests=this.researchesTests}},{key:"filters",value:function(){(0,l.addFilter)("rankMath_analysis_contentLength","rank-math",this.contentLength),(0,l.addFilter)("rankMath_analysis_contentLength_boundaries","rank-math",this.contentLengthBoundary),(0,l.addFilter)("rankMath_analysis_keywordDensity","rank-math",this.keywordDensity)}},{key:"contentLength",value:function(e){if(this.ca_keyword!==this.keyword)return e;var t=this.data.recommendations.wordCount,n=(0,o.ceil)(150*t/100);return{hasScore:e.hasScore,failed:(0,i.sprintf)((0,i.__)("Content is %1$s words long. Consider using at least %2$s words.","rank-math"),"%1$d",t),tooltipText:(0,i.sprintf)((0,i.__)("Minimum recommended content length should be %1$d words.","rank-math"),t),emptyContent:(0,i.sprintf)((0,i.__)("Content should be %1$s long.","rank-math"),'<a href="https://rankmath.com/kb/score-100-in-tests/?utm_source=Plugin&utm_campaign=WP#overall-content-length" target="_blank">'+t+" - "+n+(0,i.__)(" words","rank-math")+"</a>")}}},{key:"contentLengthBoundary",value:function(e){if(this.ca_keyword!==this.keyword)return e;var t=this.data.recommendations.wordCount,n=(0,o.ceil)(150*t/100);return{recommended:{boundary:n,score:8},belowRecommended:{boundary:(0,o.ceil)(n/2),score:5},low:{boundary:t,score:2}}}},{key:"keywordDensity",value:function(e,t){if((0,o.isEmpty)(this.data.keywords.content)||(0,o.isEmpty)(this.data.keywords.content[this.keyword]))return e;var n=t/this.data.keywords.content[this.keyword].average*100;return n>80?1.1:100<n?2.5:80<n?1.1:50<n?.8:.5}}])&&De(t.prototype,n),r&&De(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),Ke=function(){var e=a()("button-secondary rank-math-content-ai",{"is-new":!rankMath.ca_viewed});return wp.element.createElement(c.Button,{className:e,onClick:function(){t()(".rank-math-toolbar-score.content-ai-score").length?t()(".rank-math-toolbar-score.content-ai-score").parent().trigger("click"):t()(".rank-math-content-ai-tab").trigger("click")}},wp.element.createElement("i",{className:"rm-icon rm-icon-content-ai"}),(0,i.__)("Content AI","rank-math"))};(0,l.addFilter)("rankMath.analytics.contentAI","rank-math",(function(){return Ke})),(0,l.addAction)("rank_math_loaded","rank-math",(function(){(0,l.addFilter)("rank_math_sidebar_tabs","rank-math",(function(e){return e.push({name:"contentAI",title:wp.element.createElement(s.Fragment,null,wp.element.createElement("i",{className:"rm-icon rm-icon-content-ai"}),wp.element.createElement("span",null,(0,i.__)("Content AI","rank-math"))),view:Te,className:"rank-math-content-ai-tab hidden is-active"}),e}));var e=document.getElementById("cmb2-metabox-rank_math_metabox_content_ai");if(e&&setTimeout((function(){(0,s.render)((0,s.createElement)(Te),e)}),1e3),"gutenberg"===rankMath.currentEditor){(0,u.registerPlugin)("rank-math-content-ai-box",{render:function(){var e=(0,m.select)("rank-math").getContentAIScore();return!(!(0,o.isEmpty)(e)||!(0,o.isEmpty)(rankMath.ca_keyword))&&wp.element.createElement(p.PluginPrePublishPanel,{title:(0,i.__)("Content AI","rank-math"),icon:"rm-icon rm-icon-content-ai",initialOpen:"true",className:"rank-math-content-ai-box"},wp.element.createElement("p",null,(0,i.__)("Improve your content with a personal Content AI.","rank-math")),wp.element.createElement(c.Button,{className:"button-primary",onClick:function(){t()(".editor-post-publish-panel__header-cancel-button button").trigger("click"),t()(".rank-math-toolbar-score").parent().hasClass("is-pressed")||t()(".rank-math-toolbar-score").trigger("click"),setTimeout((function(){t()(".rank-math-content-ai-tab").trigger("click")}),100)}},(0,i.__)("Improve Now","rank-math")))}});if((0,u.registerPlugin)("rank-math-content-ai",{icon:wp.element.createElement(Be,null),render:function(){return wp.element.createElement(s.Fragment,null,wp.element.createElement(p.PluginSidebarMoreMenuItem,{target:"seo-by-rank-math-content-ai-sidebar",icon:wp.element.createElement(Be,null)},(0,i.__)("Content AI","rank-math")),wp.element.createElement(p.PluginSidebar,{name:"seo-by-rank-math-content-ai-sidebar",title:"Content AI",className:"rank-math-sidebar-panel rank-math-sidebar-content-ai-panel"},wp.element.createElement(Te,null)))}}),(0,o.includes)(window.location.search,"tab=content-ai")){var n="rank-math-content-ai/seo-by-rank-math-content-ai-sidebar";(0,m.select)("core/edit-post").getActiveGeneralSidebarName()!==n&&(0,m.dispatch)("core/edit-post").openGeneralSidebar(n)}}"classic"!==rankMath.currentEditor&&t()(document).on("click",".rank-math-open-contentai",(function(e){return e.preventDefault(),t()(".rank-math-content-ai-tab").trigger("click"),!1})),new Fe}))}()}(); |