diff --git a/Build/resources/javascript/Components/FleschReadingScore.js b/Build/resources/javascript/Components/FleschReadingScore.js new file mode 100644 index 00000000..ab07ba2f --- /dev/null +++ b/Build/resources/javascript/Components/FleschReadingScore.js @@ -0,0 +1,137 @@ +import React, {useMemo} from 'react'; +import {connect} from 'react-redux'; +import LoadingIndicator from './LoadingIndicator'; +import { InsightsCard } from '@yoast/components'; +import { DIFFICULTY } from "yoastseo"; +import { __ } from '@wordpress/i18n'; + +// See @wordpress-seo/packages/js/src/insights/src/components/flesch-reading-ease.js + +/** + * Returns the difficulty feedback string (e.g. 'very easy') + * + * @param {DIFFICULTY} difficulty The Flesch reading ease difficulty. + * + * @returns {string} The difficulty feedback string. + */ +function getDifficultyFeedback( difficulty ) { + switch ( difficulty ) { + case DIFFICULTY.NO_DATA: + return __( "no data", "wordpress-seo" ); + case DIFFICULTY.VERY_EASY: + return __( "very easy", "wordpress-seo" ); + case DIFFICULTY.EASY: + return __( "easy", "wordpress-seo" ); + case DIFFICULTY.FAIRLY_EASY: + return __( "fairly easy", "wordpress-seo" ); + case DIFFICULTY.OKAY: + return __( "okay", "wordpress-seo" ); + case DIFFICULTY.FAIRLY_DIFFICULT: + return __( "fairly difficult", "wordpress-seo" ); + case DIFFICULTY.DIFFICULT: + return __( "difficult", "wordpress-seo" ); + case DIFFICULTY.VERY_DIFFICULT: + return __( "very difficult", "wordpress-seo" ); + } +} + +/** + * Returns the call to action. + * + * @param {DIFFICULTY} difficulty The Flesch reading ease difficulty. + * + * @returns {string} The call to action. + */ +function getCallToAction( difficulty ) { + switch ( difficulty ) { + case DIFFICULTY.FAIRLY_DIFFICULT: + case DIFFICULTY.DIFFICULT: + case DIFFICULTY.VERY_DIFFICULT: + return __( "Try to make shorter sentences, using less difficult words to improve readability", "wordpress-seo" ); + case DIFFICULTY.NO_DATA: + return __( "Continue writing to get insight into the readability of your text!", "wordpress-seo" ); + default: + return __( "Good job!", "wordpress-seo" ); + } +} + +/** + * Generates the description given a score and difficulty. + * + * @param {number} score The flesch reading ease score. + * @param {DIFFICULTY} difficulty The flesch reading ease difficulty. + * + * @returns {string} The description. + */ +function getDescription( score, difficulty ) { + // A score of -1 signals that no valid FRE was calculated. + if ( score === -1 ) { + return sprintf( + __( + "Your text should be slightly longer to calculate your Flesch reading ease score.", + "wordpress-seo" + ) + ); + } + return sprintf( + __( + "The copy scores %1$s in the test, which is considered %2$s to read.", + "wordpress-seo" + ), + score, + getDifficultyFeedback( difficulty ) + ); +} + +/** + * Retrieves the description as a React element. + * + * @param {number} score The Flesch reading ease score. + * @param {DIFFICULTY} difficulty The difficulty. + * @param {string} link The link to the call to action. + * + * @returns {JSX.Element} The React element. + */ +function getDescriptionElement( score, difficulty, link ) { + const callToAction = getCallToAction( difficulty ); + return + {getDescription(score, difficulty)} +   + {difficulty >= DIFFICULTY.FAIRLY_DIFFICULT + ? {callToAction + "."} + : callToAction + } + ; +} + +const FleschReadingScore = ({flesch}) => { + if (flesch) { + let score = flesch.result.score; + + const description = useMemo(() => { + return getDescriptionElement(score, flesch.result.difficulty, 'https://yoa.st/34s'); + }) + + if ( score === -1 ) { + score = "?"; + } + + return + } + return +} + +const mapStateToProps = (state) => { + return { + ...state.flesch + } +} + +export default connect(mapStateToProps)(FleschReadingScore); diff --git a/Build/resources/javascript/Components/Insights.js b/Build/resources/javascript/Components/Insights.js index b2348327..c10fe061 100644 --- a/Build/resources/javascript/Components/Insights.js +++ b/Build/resources/javascript/Components/Insights.js @@ -1,22 +1,12 @@ import React from 'react'; import {connect} from 'react-redux'; import LoadingIndicator from './LoadingIndicator'; +import { WordOccurrenceInsights } from '@yoast/components'; const Insights = ({insights}) => { if (insights) { let keywords = insights.result.slice(0, 20); - return ( -
    - {keywords.map((word) => { - return ( -
  1. - {word.getStem()} ({word.getOccurrences()}) -
  2. - ); - })} -
- ); + return } return } diff --git a/Build/resources/javascript/analysis/refreshAnalysis.js b/Build/resources/javascript/analysis/refreshAnalysis.js index 5d15fec0..62144137 100644 --- a/Build/resources/javascript/analysis/refreshAnalysis.js +++ b/Build/resources/javascript/analysis/refreshAnalysis.js @@ -3,6 +3,7 @@ import measureTextWidth from '../helpers/measureTextWidth'; import {analyzeData} from '../redux/actions/analysis'; import {getRelevantWords} from '../redux/actions/relevantWords'; import {getInsights} from "../redux/actions/insights"; +import {getFleschReadingScore} from "../redux/actions/flesch"; export default function refreshAnalysis(worker, store) { const state = store.getState(); @@ -20,6 +21,7 @@ export default function refreshAnalysis(worker, store) { return Promise.all([ store.dispatch(analyzeData(worker, paper, YoastConfig.relatedKeyphrases)), store.dispatch(getRelevantWords(worker, paper)), - store.dispatch(getInsights(worker, paper)) + store.dispatch(getInsights(worker, paper)), + store.dispatch(getFleschReadingScore(worker, paper)), ]); } diff --git a/Build/resources/javascript/plugin.js b/Build/resources/javascript/plugin.js index 60017319..21b6ebce 100644 --- a/Build/resources/javascript/plugin.js +++ b/Build/resources/javascript/plugin.js @@ -10,6 +10,7 @@ import TitleProgressBar from './Components/TitleProgressBar'; import DescriptionProgressBar from './Components/DescriptionProgressBar'; import LinkingSuggestions from "./Components/LinkingSuggestions"; import Insights from "./Components/Insights"; +import FleschReadingScore from "./Components/FleschReadingScore"; import store from './redux/store'; import {getContent, updateContent} from './redux/actions/content'; import {setFocusKeyword} from './redux/actions/focusKeyword'; @@ -222,6 +223,11 @@ let YoastPlugin = { const insightsRoot = createRoot(container); insightsRoot.render(); }); + + document.querySelectorAll('[data-yoast-flesch]').forEach(container => { + const fleschRoot = createRoot(container); + fleschRoot.render(); + }); }, initCornerstone: () => { diff --git a/Build/resources/javascript/redux/actions/flesch.js b/Build/resources/javascript/redux/actions/flesch.js new file mode 100644 index 00000000..23bb7a8f --- /dev/null +++ b/Build/resources/javascript/redux/actions/flesch.js @@ -0,0 +1,17 @@ +export const GET_FLESCH_REQUEST = 'GET_FLESCH_REQUEST'; +export const GET_FLESCH_SUCCESS = 'GET_FLESCH_SUCCESS'; + +export function getFleschReadingScore(worker, paper) { + return dispatch => { + dispatch({type: GET_FLESCH_REQUEST}); + + return worker + .runResearch('getFleschReadingScore', paper) + .then((results) => { + dispatch({type: GET_FLESCH_SUCCESS, payload: results}); + }).catch((error) => { + console.error('An error occured while analyzing the text:'); + console.error(error); + }); + }; +} diff --git a/Build/resources/javascript/redux/actions/index.js b/Build/resources/javascript/redux/actions/index.js index ebd0add9..012c47eb 100644 --- a/Build/resources/javascript/redux/actions/index.js +++ b/Build/resources/javascript/redux/actions/index.js @@ -4,6 +4,7 @@ import {setFocusKeywordSynonyms} from './focusKeywordSynonyms'; import {analyzeData} from "./analysis"; import {getRelevantWords} from "./relevantWords"; import {getInsights} from "./insights"; +import {getFleschReadingScore} from "./flesch"; import {getLinkingSuggestions} from "./linkingSuggestions"; export default { @@ -13,5 +14,6 @@ export default { analyzeData, getRelevantWords, getInsights, + getFleschReadingScore, getLinkingSuggestions }; diff --git a/Build/resources/javascript/redux/reducers/flesch.js b/Build/resources/javascript/redux/reducers/flesch.js new file mode 100644 index 00000000..1f3bff94 --- /dev/null +++ b/Build/resources/javascript/redux/reducers/flesch.js @@ -0,0 +1,19 @@ +import {GET_FLESCH_REQUEST, GET_FLESCH_SUCCESS} from '../actions/flesch'; + +const initialState = { + isCheckingFlesch: false, + words: [] +}; + +function fleschReducer (state = initialState, action) { + switch(action.type) { + case GET_FLESCH_REQUEST: + return {...state, isCheckingFlesch: true}; + case GET_FLESCH_SUCCESS: + return {...state, isCheckingFlesch: false, flesch: action.payload}; + default: + return state; + } +} + +export default fleschReducer; diff --git a/Build/resources/javascript/redux/reducers/index.js b/Build/resources/javascript/redux/reducers/index.js index 35a397d1..51c4b599 100644 --- a/Build/resources/javascript/redux/reducers/index.js +++ b/Build/resources/javascript/redux/reducers/index.js @@ -4,6 +4,7 @@ import focusKeywordSynonyms from './focusKeywordSynonyms'; import analysis from './analysis'; import relevantWords from './relevantWords'; import insights from "./insights"; +import flesch from "./flesch"; import linkingSuggestions from "./linkingSuggestions"; export default { content, @@ -12,5 +13,6 @@ export default { analysis, relevantWords, insights, + flesch, linkingSuggestions } diff --git a/Build/resources/sass/yoast.scss b/Build/resources/sass/yoast.scss index ca1158f6..0958da27 100644 --- a/Build/resources/sass/yoast.scss +++ b/Build/resources/sass/yoast.scss @@ -157,15 +157,90 @@ div.yoast-analysis { } .yoastSeo-insights { - ol { - padding: 0; - margin: 1em 2em; - } - a { font-weight: bold; } a:hover { text-decoration: underline; } + + .yoast-field-group__title { + font-weight: 600; + } + + .yoast-help { + margin-left: 5px; + + &__icon svg { + fill: #707070; + height: 12px; + transition: all 150ms ease-out; + width: 12px; + } + + &:focus svg, &:hover svg { + fill: #000; + } + } + + .screen-reader-text { + position: absolute; + left: -10000px; + top: auto; + width: 1px; + height: 1px; + overflow: hidden; + } + + .yoast-data-model { + width: 300px; + padding: 3px 0 0 0; + list-style: none; + } + + .yoast-data-model li { + line-height: 1.8; + padding: 0 8px; + position: relative; + z-index: 2; + font-weight: 600; + } + + .yoast-data-model span { + float: right; + font-weight: 400; + } + + .yoast-data-model li + li { + margin-top: 9px; + } + + .yoast-data-model li:after { + position: absolute; + left: 0; + height: 20px; + background: var(--typo3-surface-container-info, #d5eef6); + content: ""; + width: var(--yoast-width); + z-index: -1; + } + + .yoast-insights-card { + &__content { + padding-top: 5px; + display: flex; + } + &__score { + flex-shrink: 0; + margin-right: 2em; + } + &__amount { + display: block; + font-size: 3.5em; + line-height: 1; + } + &__description { + max-width: 600px; + } + } } diff --git a/Classes/Service/TcaService.php b/Classes/Service/TcaService.php index a2b02844..706c52b5 100644 --- a/Classes/Service/TcaService.php +++ b/Classes/Service/TcaService.php @@ -109,7 +109,6 @@ protected function addDefaultFields(): void ], ], 'tx_yoastseo_insights' => [ - 'label' => self::LL_PREFIX_TCA . 'pages.fields.tx_yoastseo_insights', 'exclude' => true, 'config' => [ 'type' => 'none', diff --git a/Resources/Private/Language/TCA.xlf b/Resources/Private/Language/TCA.xlf index 63b829bc..b62eb697 100644 --- a/Resources/Private/Language/TCA.xlf +++ b/Resources/Private/Language/TCA.xlf @@ -24,15 +24,6 @@ Focus keywords - - Prominent words - - - The following words occur the most in the content. These give an indication of what your content focuses on. If the words differ a lot from your topic, you might want to rewrite your content accordingly. - - - ultimate guide to keyword research to learn more about keyword research and keyword strategy.]]> - Advanced robot instructions diff --git a/Resources/Private/Templates/TCA/Insights.html b/Resources/Private/Templates/TCA/Insights.html index aef55666..d651b1c3 100644 --- a/Resources/Private/Templates/TCA/Insights.html +++ b/Resources/Private/Templates/TCA/Insights.html @@ -1,13 +1,8 @@
-
- -
-
- - - -
+
+
+
diff --git a/Resources/Public/CSS/yoast.min.css b/Resources/Public/CSS/yoast.min.css index d43bf1b5..db486785 100644 --- a/Resources/Public/CSS/yoast.min.css +++ b/Resources/Public/CSS/yoast.min.css @@ -1 +1 @@ -.yoast-seo{background-color:var(--module-bg,#fff);padding:15px}#yoast-snippet-preview-container{background-color:var(--module-bg,#fff)!important}#yoast-snippet-preview-container div:first-child>div:first-child,#yoast-snippet-preview-container div:nth-child(2)>div{color:var(--module-color,#000)!important}.yoast-seo-snippet-header{background-color:var(--module-docheader-bg,#eee);border-radius:5px;color:var(--module-color,#000);padding:5px}.yoast-seo-snippet-header-premium{float:right}.yoast-seo-snippet-header-premium a{margin-left:5px;text-decoration:underline}.yoast-seo-snippet-header-premium a i{color:#a4286a;margin-right:5px}.yoast-seo-score-bar{margin-bottom:15px}.yoast-seo-score-bar--analysis{margin-right:20px}.yoast-seo-score-bar--analysis.yoast-seo-page{cursor:pointer}.yoast-seo-score-bar--analysis svg{vertical-align:middle}.yoast-seo-snippet-error{color:#dc3232;padding:10px;text-align:center}.yoast-seo-snippet-error a{color:#dc3232;text-decoration:underline}.spinner{margin:50px auto;text-align:center;width:70px}.spinner>div{animation:sk-bouncedelay 1.4s ease-in-out infinite both;background-color:#ccc;border-radius:100%;display:inline-block;height:18px;width:18px}.spinner .bounce1{animation-delay:-.32s}.spinner .bounce2{animation-delay:-.16s}@keyframes sk-bouncedelay{0%,80%,to{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.yoast-seo-snippet-preview{border:1px solid #ccc;padding:15px}.yoast-seo-snippet-preview-styling{min-height:235px}.yoast-seo-snippet-preview-styling fieldset legend{border-bottom:0!important;font-size:12px!important}.yoast-seo-snippet-preview-styling fieldset label{font-size:12px!important;font-weight:400}div.yoast-analysis button{background-color:inherit!important;font-size:12px!important}div.yoast-analysis button:disabled{display:none}div.yoast-analysis div:not(.bounce){background-color:inherit!important}div.yoast-analysis a{text-decoration:underline}.yoastSeo-insights ol{margin:1em 2em;padding:0}.yoastSeo-insights a{font-weight:700}.yoastSeo-insights a:hover{text-decoration:underline} +.yoast-seo{background-color:var(--module-bg,#fff);padding:15px}#yoast-snippet-preview-container{background-color:var(--module-bg,#fff)!important}#yoast-snippet-preview-container div:first-child>div:first-child,#yoast-snippet-preview-container div:nth-child(2)>div{color:var(--module-color,#000)!important}.yoast-seo-snippet-header{background-color:var(--module-docheader-bg,#eee);border-radius:5px;color:var(--module-color,#000);padding:5px}.yoast-seo-snippet-header-premium{float:right}.yoast-seo-snippet-header-premium a{margin-left:5px;text-decoration:underline}.yoast-seo-snippet-header-premium a i{color:#a4286a;margin-right:5px}.yoast-seo-score-bar{margin-bottom:15px}.yoast-seo-score-bar--analysis{margin-right:20px}.yoast-seo-score-bar--analysis.yoast-seo-page{cursor:pointer}.yoast-seo-score-bar--analysis svg{vertical-align:middle}.yoast-seo-snippet-error{color:#dc3232;padding:10px;text-align:center}.yoast-seo-snippet-error a{color:#dc3232;text-decoration:underline}.spinner{margin:50px auto;text-align:center;width:70px}.spinner>div{animation:sk-bouncedelay 1.4s ease-in-out infinite both;background-color:#ccc;border-radius:100%;display:inline-block;height:18px;width:18px}.spinner .bounce1{animation-delay:-.32s}.spinner .bounce2{animation-delay:-.16s}@keyframes sk-bouncedelay{0%,80%,to{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.yoast-seo-snippet-preview{border:1px solid #ccc;padding:15px}.yoast-seo-snippet-preview-styling{min-height:235px}.yoast-seo-snippet-preview-styling fieldset legend{border-bottom:0!important;font-size:12px!important}.yoast-seo-snippet-preview-styling fieldset label{font-size:12px!important;font-weight:400}div.yoast-analysis button{background-color:inherit!important;font-size:12px!important}div.yoast-analysis button:disabled{display:none}div.yoast-analysis div:not(.bounce){background-color:inherit!important}div.yoast-analysis a{text-decoration:underline}.yoastSeo-insights a{font-weight:700}.yoastSeo-insights a:hover{text-decoration:underline}.yoastSeo-insights .yoast-field-group__title{font-weight:600}.yoastSeo-insights .yoast-help{margin-left:5px}.yoastSeo-insights .yoast-help__icon svg{fill:#707070;height:12px;transition:all .15s ease-out;width:12px}.yoastSeo-insights .yoast-help:focus svg,.yoastSeo-insights .yoast-help:hover svg{fill:#000}.yoastSeo-insights .screen-reader-text{height:1px;left:-10000px;overflow:hidden;position:absolute;top:auto;width:1px}.yoastSeo-insights .yoast-data-model{list-style:none;padding:3px 0 0;width:300px}.yoastSeo-insights .yoast-data-model li{font-weight:600;line-height:1.8;padding:0 8px;position:relative;z-index:2}.yoastSeo-insights .yoast-data-model span{float:right;font-weight:400}.yoastSeo-insights .yoast-data-model li+li{margin-top:9px}.yoastSeo-insights .yoast-data-model li:after{background:var(--typo3-surface-container-info,#d5eef6);content:"";height:20px;left:0;position:absolute;width:var(--yoast-width);z-index:-1}.yoastSeo-insights .yoast-insights-card__content{display:flex;padding-top:5px}.yoastSeo-insights .yoast-insights-card__score{flex-shrink:0;margin-right:2em}.yoastSeo-insights .yoast-insights-card__amount{display:block;font-size:3.5em;line-height:1}.yoastSeo-insights .yoast-insights-card__description{max-width:600px} diff --git a/Resources/Public/JavaScript/dist/plugin.js b/Resources/Public/JavaScript/dist/plugin.js index 35d0e30b..e9de4561 100644 --- a/Resources/Public/JavaScript/dist/plugin.js +++ b/Resources/Public/JavaScript/dist/plugin.js @@ -3378,4 +3378,4 @@ i=(0,ee.__)("Your site language is set to %s. If this is not correct, contact yo padding: 8px 0; color: ${fn.$color_blue} } -`;class pc extends e.Component{renderCollapsible(t,n,r){return(0,e.createElement)(uc,{initialIsOpen:!0,title:`${t} (${r.length})`,prefixIcon:{icon:"angle-up",color:fn.$color_grey_dark,size:"18px"},prefixIconCollapsed:{icon:"angle-down",color:fn.$color_grey_dark,size:"18px"},suffixIcon:null,suffixIconCollapsed:null,headingProps:{level:n,fontSize:"13px",fontWeight:"bold"}},(0,e.createElement)(cc,{results:r,marksButtonActivatedResult:this.props.activeMarker,marksButtonStatus:this.props.marksButtonStatus,marksButtonClassName:this.props.marksButtonClassName,onMarksButtonClick:this.props.onMarkButtonClick}))}render(){const{problemsResults:t,improvementsResults:n,goodResults:r,considerationsResults:o,errorsResults:i,headingLevel:a}=this.props,s=i.length,c=t.length,l=n.length,u=o.length,p=r.length;return(0,e.createElement)(lc,null,s>0&&this.renderCollapsible((0,ee.__)("Errors","yoast-components"),a,i),c>0&&this.renderCollapsible((0,ee.__)("Problems","yoast-components"),a,t),l>0&&this.renderCollapsible((0,ee.__)("Improvements","yoast-components"),a,n),u>0&&this.renderCollapsible((0,ee.__)("Considerations","yoast-components"),a,o),p>0&&this.renderCollapsible((0,ee.__)("Good results","yoast-components"),a,r))}}pc.propTypes={onMarkButtonClick:a().func,problemsResults:a().array,improvementsResults:a().array,goodResults:a().array,considerationsResults:a().array,errorsResults:a().array,headingLevel:a().number,marksButtonStatus:a().string,marksButtonClassName:a().string,activeMarker:a().string},pc.defaultProps={onMarkButtonClick:()=>{},problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[],errorsResults:[],headingLevel:4,marksButtonStatus:"enabled",marksButtonClassName:"",activeMarker:""};const dc=pc;var fc=o(37091);const bc=JSON.parse('{"s6":"#dc3232","vb":"#ee7c1b","Yy":"#7ad03a","ct":"#008a00","Wh":"#dc3232","nk":"#64a60a","t_":"#a0a5aa"}'),{scoreToRating:hc}=fc.interpreters;function Mc(e,t=""){const n=e.getIdentifier(),r={score:e.score,rating:hc(e.score),hasMarks:e.hasMarks(),marker:e.getMarker(),id:n,text:e.text,markerId:t.length>0?`${t}:${n}`:n};return"ok"===r.rating&&(r.rating="OK"),r}function mc(e,t){switch(e.rating){case"error":t.errorsResults.push(e);break;case"feedback":t.considerationsResults.push(e);break;case"bad":t.problemsResults.push(e);break;case"OK":t.improvementsResults.push(e);break;case"good":t.goodResults.push(e)}return t}function gc(e){let t="";switch(e){case"readability":t=(0,ee.__)("Readability analysis:","wordpress-seo");break;case"seo":t=(0,ee.__)("SEO analysis:","wordpress-seo")}return t}const zc=(e,t,n)=>void 0!==n?e.result[t][n]:e.result[t],Oc=I((e=>({content:e.content,analysis:e.analysis,keyword:e.focusKeyword})))((({content:t,analysis:n,keyword:r,resultType:o,resultSubtype:i})=>{const[a,s]=(0,e.useState)({currentAnalysis:!1,mappedResults:{}});if((0,e.useEffect)((()=>{if(null!==n.result[o]){let e=function(e,t=""){let n={errorsResults:[],problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[]};if(!e)return n;for(let r=0;r({content:e.content,analysis:e.analysis})))((({content:t,analysis:n,resultType:r,resultSubtype:o,text:i})=>{const{scoreToRating:a}=fc.interpreters;if(!1===t.isFetching&&!1===n.isAnalyzing&&zc(n,r,o)){let t=zc(n,r,o).score/10,s=function(e){let t={icon:"seo-score-none",color:bc.t_};switch(e){case"loading":t={icon:"loading-spinner",color:bc.nk};break;case"good":t={icon:"seo-score-good",color:bc.ct};break;case"ok":t={icon:"seo-score-ok",color:bc.vb};break;case"bad":t={icon:"seo-score-bad",color:bc.Wh}}return t}(a(t));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ac.SvgIcon,{icon:s.icon,color:s.color})," ","true"===i?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:`score-label-${r}`},gc(r))," ",(0,e.createElement)("span",null,function(e){let t="-";switch(e){case"good":t=(0,ee.__)("Good","wordpress-seo");break;case"ok":t=(0,ee.__)("OK","wordpress-seo");break;case"bad":t=(0,ee.__)("Needs improvement","wordpress-seo")}return t}(a(t)))):"")}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ac.SvgIcon,{icon:"circle",color:"#bebebe"})," ","true"===i?(0,e.createElement)("span",{className:`score-label-${r}`},gc(r)):"")}));function yc(e){return e>=7?bc.Yy:e>=5?bc.vb:bc.s6}const _c="yoast-measurement-element";function qc(e){let t=document.getElementById(_c);return t||(t=function(){const e=document.createElement("div");return e.id=_c,e.style.position="absolute",e.style.left="-9999em",e.style.top=0,e.style.height=0,e.style.overflow="hidden",e.style.fontFamily="Arial",e.style.fontSize="18px",e.style.fontWeight="400",document.body.appendChild(e),e}()),t.innerText=e,t.offsetWidth}const Ec=e=>{const t=qc(e),n=new fc.assessments.seo.PageTitleWidthAssessment,r=n.calculateScore(t);return{max:n.getMaximumLength(),actual:t,score:r}},wc=I((e=>({...e.content})))((({title:t=""})=>{const[n,r]=(0,e.useState)({progress:null,title:""});return(0,e.useEffect)((()=>{r((e=>({...e,progress:Ec(t),title:t})))}),[t]),null!==n.progress?(0,e.createElement)(Ac.ProgressBar,{min:0,max:n.progress.max,value:n.progress.actual,progressColor:yc(n.progress.score)}):(0,e.createElement)(e.Fragment,null)})),Tc=(e,t)=>{let n=e.length;""!==t&&n>0&&(n+=t.length+3);const r=new fc.assessments.seo.MetaDescriptionLengthAssessment,o=r.calculateScore(n);return{max:r.getMaximumLength(),actual:n,score:o}},Sc=I((e=>({...e.content})))((({description:t="",date:n=""})=>{const[r,o]=(0,e.useState)({progress:null,description:""});return(0,e.useEffect)((()=>{o((e=>({...e,progress:Tc(t,n),description:t})))}),[t]),null!==r.progress?(0,e.createElement)(Ac.ProgressBar,{min:0,max:r.progress.max,value:r.progress.actual,progressColor:yc(r.progress.score)}):(0,e.createElement)(e.Fragment,null)})),Lc=I((e=>({...e.linkingSuggestions})))((({suggestions:t,isCheckingLinkingSuggestions:n})=>n?(0,e.createElement)(Q,null):t.links&&t.links.length>0?(0,e.createElement)("table",{className:"table",style:{width:"auto"}},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,"Label"),(0,e.createElement)("th",null,"Record"),(0,e.createElement)("th",null,"Linked")),t.links.map((t=>(0,e.createElement)("tr",{key:t.recordType+t.id},(0,e.createElement)("td",null,t.label," ",1===parseInt(t.cornerstone)&&"*"),(0,e.createElement)("td",null,t.recordType," [uid=",t.id,"]"),(0,e.createElement)("td",{className:"text-center"},t.active?(0,e.createElement)("button",{className:"btn btn-success btn-sm"}," ✓ "):(0,e.createElement)("button",{className:"btn btn-danger btn-sm"}," ✗ "))))))):(0,e.createElement)("div",{className:"alert alert-info"},"No results found, make sure you have more than 100 words to analyze.",(0,e.createElement)("br",null),"If there's enough content to analyze, it may be that no other content relates to the current content."))),kc=I((e=>({...e.insights})))((({insights:t})=>{if(t){let n=t.result.slice(0,20);return(0,e.createElement)("ol",{className:"yoast-keyword-suggestions__list"},n.map((t=>(0,e.createElement)("li",{key:t.getStem(),className:"yoast-keyword-suggestions__item"},(0,e.createElement)("strong",null,t.getStem())," (",t.getOccurrences(),")"))))}return(0,e.createElement)(Q,null)}));function Rc(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var xc=Rc();xc.withExtraArgument=Rc;const Wc=xc;var Cc=o(78964);const Nc="GET_CONTENT_REQUEST",Dc="GET_CONTENT_SUCCESS",Ic="GET_CONTENT_ERROR",Pc="UPDATE_CONTENT";function Bc(e){return void 0!==e.title&&(e.title=Cc.strings.stripHTMLTags(e.title)),void 0!==e.description&&(e.description=Cc.strings.stripHTMLTags(e.description)),{type:Pc,payload:e}}const jc={isFetching:!1};let Fc=[];const Hc="SET_FOCUS_KEYWORD";function Yc(e){return{type:Hc,keyword:e}}const Uc="SET_FOCUS_KEYWORD_SYNONYMS";function Xc(e){return{type:Uc,synonyms:e}}const $c="ANALYZE_DATA_REQUEST",Gc="ANALYZE_DATA_SUCCESS",Vc=e=>{const{scoreToRating:t}=fc.interpreters;void 0!==YoastConfig.data&&void 0!==YoastConfig.urls.saveScores&&fetch(YoastConfig.urls.saveScores,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:YoastConfig.data.table,uid:YoastConfig.data.uid,languageId:YoastConfig.data.languageId,readabilityScore:t(e.result.readability.score/10),seoScore:t(e.result.seo[""].score/10)})})},Kc=e=>{console.error("An error occured while analyzing the text:"),console.error(e)};function Qc(e,t,n=void 0){return r=>{if(r({type:$c}),void 0!==n&&"object"==typeof n&&Object.keys(n).length>0)return e.analyze(t).then((o=>{Vc(o),e.analyzeRelatedKeywords(t,n).then((e=>{o.result.seo={...o.result.seo,...e.result.seo},r({type:Gc,payload:o})})).catch((e=>Kc(e)))})).catch((e=>Kc(e)));let o;return o=void 0===n?e.analyze(t):e.analyzeRelatedKeywords(t,n),o.then((e=>{Vc(e),r({type:Gc,payload:e})})).catch((e=>Kc(e)))}}const Jc={isAnalyzing:!1,result:{readability:{results:[]},seo:{results:[]}}},Zc="GET_RELEVANTWORDS_REQUEST",el="GET_RELEVANTWORDS_SUCCESS";function tl(e,t){return n=>(n({type:Zc}),e.runResearch("getProminentWordsForInternalLinking",t).then((e=>{n({type:el,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const nl={isCheckingRelevantWords:!1,words:[]},rl="GET_INSIGHTS_REQUEST",ol="GET_INSIGHTS_SUCCESS";function il(e,t){return n=>(n({type:rl}),e.runResearch("getProminentWordsForInsights",t).then((e=>{n({type:ol,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const al={isCheckingInsights:!1,words:[]},sl="GET_LINKINGSUGGESTIONS_SUCCESS",cl={isCheckingLinkingSuggestions:!0,suggestions:[]},ll={content:function e(t=jc,n){switch(n.type){case Nc:return{...t,isFetching:!0};case Dc:YoastConfig.pageTitlePrepend=n.payload.pageTitlePrepend,YoastConfig.pageTitleAppend=n.payload.pageTitleAppend;let r={...t,isFetching:!1,...n.payload};return Fc.forEach((t=>{r=e(r,t)})),Fc=[],r;case Ic:return{...t,isFetching:!1,error:n.error};case Pc:return t.isFetching?(Fc.push(n),t):{...t,isFetching:!1,...n.payload};default:return t}},focusKeyword:(e="",t)=>t.type===Hc?t.keyword:e,focusKeywordSynonyms:(e="",t)=>t.type===Uc?t.synonyms:e,analysis:function(e=Jc,t){switch(t.type){case $c:return{...e,isAnalyzing:!0};case Gc:return{...e,isAnalyzing:!1,...t.payload};default:return e}},relevantWords:function(e=nl,t){switch(t.type){case Zc:return{...e,isCheckingRelevantWords:!0};case el:return{...e,isCheckingRelevantWords:!1,relevantWords:t.payload};default:return e}},insights:function(e=al,t){switch(t.type){case rl:return{...e,isCheckingInsights:!0};case ol:return{...e,isCheckingInsights:!1,insights:t.payload};default:return e}},linkingSuggestions:function(e=cl,t){return t.type===sl?{...e,isCheckingLinkingSuggestions:!1,suggestions:t.payload}:e}},ul=(0,T.y$)((0,T.HY)(ll),(0,T.Tw)(Wc)),pl=document.createElement("div");document.body.appendChild(pl);const dl=ul;let fl={_yoastWorker:null,_progressBarInitialized:!1,init:function(){"undefined"!=typeof YoastConfig&&(void 0!==YoastConfig.data&&void 0!==YoastConfig.data.uid&&bl.init(),void 0!==YoastConfig.urls.linkingSuggestions&&hl.init(YoastConfig.urls.linkingSuggestions),void 0!==YoastConfig.urls.indexPages&&Ml.init())},setWorker:function(e,t="en_US"){null!==fl._yoastWorker&&fl._yoastWorker._worker.terminate(),fl._yoastWorker=function(e,t){const n=new fc.AnalysisWorkerWrapper((0,fc.createWorker)(YoastConfig.urls.workerUrl));return n.initialize({locale:t,contentAnalysisActive:!0,keywordAnalysisActive:!0,useKeywordDistribution:!0,useCornerstone:e,logLevel:"ERROR",translations:YoastConfig.translations,defaultQueryParams:null}),n}(e,t)},setLocales:function(){if((0,ee.setLocaleData)({"":{"yoast-components":{}}},"yoast-components"),YoastConfig.translations)for(let e of YoastConfig.translations)(0,ee.setLocaleData)(e.locale_data["wordpress-seo"],e.domain);else(0,ee.setLocaleData)({"":{"wordpress-seo":{}}},"wordpress-seo")},postRequest:(e,t)=>fetch(e,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},bl={init:()=>{fl.setWorker(YoastConfig.isCornerstoneContent),fl.setLocales(),dl.dispatch(Yc(YoastConfig.focusKeyphrase.keyword)),dl.dispatch(Xc(YoastConfig.focusKeyphrase.synonyms)),bl.initContentAnalysis(),bl.initStatusIcon(),bl.initScoreBars(),bl.initTCA(),bl.initSnippetPreviewAndInsights(),bl.initCornerstone(),bl.initProgressBars(),bl.initFocusKeyword(),bl.initRelatedFocusKeywords(),bl.initSeoTitle()},initContentAnalysis:()=>{dl.dispatch((e=>(e({type:Nc}),fetch(YoastConfig.urls.previewUrl).then((e=>e.json())).then((t=>{e({type:Dc,payload:t})})).catch((t=>{e({type:Ic,payload:t,error:!0})}))))).then((e=>(fl.setWorker(YoastConfig.isCornerstoneContent,dl.getState().content.locale),bl.refreshAnalysis()))).then((n=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis"),"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(n).render((0,e.createElement)(l,{store:dl},(0,e.createElement)(Oc,{...r})))})),dl.dispatch(function(e,t,n,r,o,i){return a=>{let s=e.relevantWords.result.prominentWords.slice(0,25),c={};s.forEach((function(e){c[e.getStem()]=e.getOccurrences()})),i&&fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({words:c,uid:t,pid:n,languageId:r,table:o})}),a({type:"SAVE_RELEVANTWORDS_SUCCESS"})}}(dl.getState().relevantWords,YoastConfig.data.uid,YoastConfig.data.pid,YoastConfig.data.languageId,YoastConfig.data.table,YoastConfig.urls.prominentWords))}))},initStatusIcon:()=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis");let o=n.closest(".form-section");if(null===o)return;let i=o.querySelector("h4"),a=document.createElement("span");if(null!=i)a.classList.add("yoast-seo-status-icon"),i.prepend(a);else{let e=n.closest(".panel");null!==e&&(i=e.querySelector(".t3js-icon"),a.style.cssText="top: 3px; position: relative;",i.replaceWith(a))}"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(a).render((0,e.createElement)(l,{store:dl},(0,e.createElement)(vc,{...r,text:"false"})))}))},initScoreBars:()=>{document.querySelectorAll(".yoast-seo-score-bar--analysis").forEach((n=>{let r=n.getAttribute("data-yoast-analysis-type");const o={},i={};o.resultType="readability",i.resultType="seo",i.resultSubtype="";const a=(0,t.H)(n);"readability"===r&&a.render((0,e.createElement)(l,{store:dl},(0,e.createElement)(vc,{...o,text:"true"}))),"seo"===r&&a.render((0,e.createElement)(l,{store:dl},(0,e.createElement)(vc,{...i,text:"true"})))}))},initTCA:()=>{void 0!==YoastConfig.TCA&&1===YoastConfig.TCA&&document.querySelectorAll("h1").forEach((n=>{const r={},o={};r.resultType="readability",o.resultType="seo",o.resultSubtype="";let i=document.createElement("div");i.classList.add("yoast-seo-score-bar");let a=document.createElement("span");a.classList.add("yoast-seo-score-bar--analysis"),a.classList.add("yoast-seo-tca"),i.append(a);let s=document.createElement("span");s.classList.add("yoast-seo-score-bar--analysis"),s.classList.add("yoast-seo-tca"),i.append(s),n.parentNode.insertBefore(i,n.nextSibling),(0,t.H)(a).render((0,e.createElement)(l,{store:dl},(0,e.createElement)(vc,{...r,text:"true"}))),(0,t.H)(s).render((0,e.createElement)(l,{store:dl},(0,e.createElement)(vc,{...o,text:"true"})))}))},initSnippetPreviewAndInsights:()=>{document.querySelectorAll("[data-yoast-snippetpreview]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:dl},(0,e.createElement)(ce,null)))})),document.querySelectorAll("[data-yoast-insights]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:dl},(0,e.createElement)(kc,null)))}))},initCornerstone:()=>{let e=bl.getFormEngineElement("cornerstone");null!==e&&e.addEventListener("change",(function(){fl.setWorker(this.checked),bl.refreshAnalysis()}))},initProgressBars:()=>{let n=bl.getFormEngineElement("title"),r=bl.getFormEngineElement("description");null!==n&&null!==r&&(bl._progressBarInitialized=!0,[{input:n,component:(0,e.createElement)(wc,null),storeKey:"title"},{input:r,component:(0,e.createElement)(Sc,null),storeKey:"description"}].forEach((n=>{if(n.input){let r=document.createElement("div");bl.addProgressContainer(n.input,r),n.input.addEventListener("input",(0,K.debounce)((e=>{let t=n.input.value,r=bl.getFormEngineElement("pageTitle").value;""===t&&(t=r),"title"===n.storeKey&&(t=bl.getTitleValue(t)),dl.dispatch(Bc({[n.storeKey]:t}))}),100)),n.input.addEventListener("change",(e=>{bl.refreshAnalysis()})),(0,t.H)(r).render((0,e.createElement)(l,{store:dl},n.component))}})))},addProgressContainer:(e,t)=>{let n=e.closest(".form-wizards-wrap");if("grid"===window.getComputedStyle(n).getPropertyValue("display")){t.style.gridArea="bottom";let n=e.closest(".form-control-wrap");n.style.maxWidth&&(t.style.maxWidth=n.style.maxWidth),e.closest(".form-control-wrap").after(t)}else e.after(t)},initFocusKeyword:()=>{bl.getFormEngineElements("focusKeyword").forEach((e=>{e.addEventListener("input",(0,K.debounce)((t=>{dl.dispatch(Yc(e.value)),bl.refreshAnalysis()}),500))})),bl.getFormEngineElements("focusKeywordSynonyms").forEach((e=>{e.addEventListener("input",(0,K.debounce)((t=>{dl.dispatch(Xc(e.value)),bl.refreshAnalysis()}),500))}))},initRelatedFocusKeywords:()=>{if("undefined"==typeof YoastConfig||void 0===YoastConfig.fieldSelectors||void 0===YoastConfig.fieldSelectors.relatedKeyword)return;let n=document.querySelector(`#${YoastConfig.fieldSelectors.relatedKeyword}`);null!==n&&n.querySelectorAll(".panel-heading").forEach((n=>{n.addEventListener("click",(0,K.debounce)((n=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis"),"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(n).render((0,e.createElement)(l,{store:dl},(0,e.createElement)(Oc,{...r})))}))}),2e3))}))},initSeoTitle:()=>{let e=bl.getFieldSelector("title"),t=bl.getFieldSelector("pageTitle");if(!1===e||!1===t)return;let n=bl.getFormEngineElement("pageTitle");n&&n.addEventListener("change",(function(e){bl.setSeoTitlePlaceholder()})),window.addEventListener("load",(function(e){bl.setSeoTitlePlaceholder()})),document.querySelectorAll("li.t3js-tabmenu-item").forEach((e=>{e.innerHTML.includes("SEO")&&e.addEventListener("click",(0,K.debounce)((e=>{!1===bl._progressBarInitialized&&bl.initProgressBars();let t=bl.getFormEngineElement("title"),n=t.value,r=bl.getFormEngineElement("pageTitle").value;t.setAttribute("placeholder",r),""===n&&(n=r),n=bl.getTitleValue(n),dl.dispatch(Bc({title:n+" "}))}),100))}))},getTitleValue:e=>(void 0!==YoastConfig.pageTitlePrepend&&null!==YoastConfig.pageTitlePrepend&&""!==YoastConfig.pageTitlePrepend&&(e=YoastConfig.pageTitlePrepend+e),void 0!==YoastConfig.pageTitleAppend&&null!==YoastConfig.pageTitleAppend&&""!==YoastConfig.pageTitleAppend&&(e+=YoastConfig.pageTitleAppend),e),setSeoTitlePlaceholder:()=>{let e=bl.getFormEngineElement("title"),t=bl.getFormEngineElement("pageTitle");if(e&&t){let n=t.value;e.setAttribute("placeholder",n)}},getFieldSelector:e=>void 0!==YoastConfig.fieldSelectors&&void 0!==YoastConfig.fieldSelectors[e]&&YoastConfig.fieldSelectors[e],getFormEngineElement:e=>{let t=bl.getFieldSelector(e);return!1===t?null:document.querySelector(`[data-formengine-input-name="${t}"]`)},getFormEngineElements:e=>{let t=bl.getFieldSelector(e);return!1===t?[]:document.querySelectorAll(`[data-formengine-input-name="${t}"]`)},refreshAnalysis:()=>function(e,t){const n=t.getState(),r=n.content,o=new fc.Paper(r.body,{keyword:n.focusKeyword,title:r.title,synonyms:n.focusKeywordSynonyms,description:r.description,locale:r.locale,titleWidth:qc(r.title)});return Promise.all([t.dispatch(Qc(e,o,YoastConfig.relatedKeyphrases)),t.dispatch(tl(e,o)),t.dispatch(il(e,o))])}(fl._yoastWorker,dl)},hl={_url:null,_updateInterval:null,init:n=>{hl._url=n,fl.setWorker(!1,YoastConfig.linkingSuggestions.locale),document.querySelectorAll("[data-yoast-linking-suggestions]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:dl},(0,e.createElement)(Lc,null)))})),hl._updateInterval=setInterval((()=>{hl.checkLinkingSuggestions()}),1e3)},checkLinkingSuggestions:()=>{let e=hl.getCKEditorContent();null!==e&&(dl.dispatch(function(e,t,n){return r=>{const o=new fc.Paper(t,{locale:YoastConfig.linkingSuggestions.locale});return e.runResearch("getProminentWordsForInternalLinking",o).then((e=>{let o=e.result.prominentWords.slice(0,5);fetch(n,{method:"post",headers:new Headers,body:JSON.stringify({words:o,excludedPage:YoastConfig.linkingSuggestions.excludedPage,languageId:YoastConfig.data.languageId,content:t})}).then((e=>e.json())).then((e=>{r({type:sl,payload:e})})).catch((e=>{console.error("An error occured while analyzing the linking suggestions:"),console.error(e)}))}))}}(fl._yoastWorker,e,hl._url)),clearInterval(hl._updateInterval),hl._updateInterval=setInterval((()=>{hl.checkLinkingSuggestions()}),1e4))},getCKEditorContent:()=>{if(document.getElementsByTagName("typo3-rte-ckeditor-ckeditor5").length>0){const e=document.querySelectorAll(".ck-editor__editable");let t="",n=!1;for(let r in e)void 0!==e[r].ckeditorInstance&&(n=!0,t+=e[r].ckeditorInstance.getData());return!1===n?null:t}{if("undefined"==typeof CKEDITOR)return null;let e="";for(let t in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(t)&&(e+=CKEDITOR.instances[t].getData());return e}}},Ml={_progressCache:[],init:()=>{document.querySelectorAll(".js-crawler-index").forEach((e=>{e.addEventListener("click",(t=>{Ml.startIndex(e.dataset.site,e.dataset.language)}))}))},startIndex:(e,t)=>{Ml.setButtonsDisableStatus(!0),document.querySelector("#saved-progress-"+e+"-"+t).remove();let n=document.querySelector("#progress-"+e+"-"+t);n.classList.remove("hide");let r=n.querySelector(".js-crawler-pages-progress"),o=n.querySelector(".js-crawler-pages-success");fl.postRequest(YoastConfig.urls.determinePages,{site:e,language:t}).then((e=>e.json())).then((n=>{void 0!==n.error?(r.innerHTML=n.error,r.classList.remove("alert-info"),r.classList.add("alert-danger")):(r.classList.add("hide"),o.classList.remove("hide"),o.innerHTML=o.innerHTML.replace("%d",n.amount),Ml.runIndex(e,t))}))},setButtonsDisableStatus:e=>{document.querySelectorAll(".js-crawler-button").forEach((t=>{t.disabled=e}))},runIndex:(e,t)=>{let n=document.querySelector("#progress-"+e+"-"+t).querySelector(".js-crawler-progress-bar");fl.postRequest(YoastConfig.urls.indexPages,{site:e,language:t,offset:void 0!==Ml._progressCache[e+"-"+t]?parseInt(Ml._progressCache[e+"-"+t]):0}).then((e=>e.json())).then((async r=>{void 0!==r.status?(Ml.setButtonsDisableStatus(!1),n.classList.remove("progress-bar-info"),n.classList.add("progress-bar-success"),n.style.width="100%",n.innerHTML=r.total+" pages have been indexed."):(Ml._progressCache[e+"-"+t]=parseInt(r.nextOffset),await Ml.process(e,t,r,n),Ml.runIndex(e,t,r))}))},process:async(e,t,n,r)=>{let o=n.current,i=n.total,a=Math.round(o/i*100);Ml.updateProgressBar(r,o,i,a);for(let e in n.pages)if(n.pages.hasOwnProperty(e)){let s=n.pages[e],c=await fl.postRequest(YoastConfig.urls.preview,{pageId:s,languageId:t,additionalGetVars:""});if(c.ok){let e=await c.json();await Ml.processRelevantWords(s,t,e),o++,a=Math.round(o/i*100),Ml.updateProgressBar(r,o,i,a)}}},processRelevantWords:(e,t,n)=>{fl.setWorker(!1,n.locale);let r=new fc.Paper(n.body,{title:n.title,description:n.description,locale:n.locale});return fl._yoastWorker.runResearch("getProminentWordsForInternalLinking",r).then((async n=>{await Ml.saveRelevantWords(e,t,n)}))},saveRelevantWords:(e,t,n)=>{let r=n.result.prominentWords.slice(0,25),o={};r.forEach((e=>{o[e.getStem()]=e.getOccurrences()})),fl.postRequest(YoastConfig.urls.prominentWords,{words:o,uid:e,languageId:t,table:"pages"})},updateProgressBar:(e,t,n,r)=>{e.innerText=t+"/"+n,e.style.width=r+"%"}};fl.init()})()})(); \ No newline at end of file +`;class pc extends e.Component{renderCollapsible(t,n,r){return(0,e.createElement)(uc,{initialIsOpen:!0,title:`${t} (${r.length})`,prefixIcon:{icon:"angle-up",color:fn.$color_grey_dark,size:"18px"},prefixIconCollapsed:{icon:"angle-down",color:fn.$color_grey_dark,size:"18px"},suffixIcon:null,suffixIconCollapsed:null,headingProps:{level:n,fontSize:"13px",fontWeight:"bold"}},(0,e.createElement)(cc,{results:r,marksButtonActivatedResult:this.props.activeMarker,marksButtonStatus:this.props.marksButtonStatus,marksButtonClassName:this.props.marksButtonClassName,onMarksButtonClick:this.props.onMarkButtonClick}))}render(){const{problemsResults:t,improvementsResults:n,goodResults:r,considerationsResults:o,errorsResults:i,headingLevel:a}=this.props,s=i.length,c=t.length,l=n.length,u=o.length,p=r.length;return(0,e.createElement)(lc,null,s>0&&this.renderCollapsible((0,ee.__)("Errors","yoast-components"),a,i),c>0&&this.renderCollapsible((0,ee.__)("Problems","yoast-components"),a,t),l>0&&this.renderCollapsible((0,ee.__)("Improvements","yoast-components"),a,n),u>0&&this.renderCollapsible((0,ee.__)("Considerations","yoast-components"),a,o),p>0&&this.renderCollapsible((0,ee.__)("Good results","yoast-components"),a,r))}}pc.propTypes={onMarkButtonClick:a().func,problemsResults:a().array,improvementsResults:a().array,goodResults:a().array,considerationsResults:a().array,errorsResults:a().array,headingLevel:a().number,marksButtonStatus:a().string,marksButtonClassName:a().string,activeMarker:a().string},pc.defaultProps={onMarkButtonClick:()=>{},problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[],errorsResults:[],headingLevel:4,marksButtonStatus:"enabled",marksButtonClassName:"",activeMarker:""};const dc=pc;var fc=o(37091);const bc=JSON.parse('{"s6":"#dc3232","vb":"#ee7c1b","Yy":"#7ad03a","ct":"#008a00","Wh":"#dc3232","nk":"#64a60a","t_":"#a0a5aa"}'),{scoreToRating:hc}=fc.interpreters;function Mc(e,t=""){const n=e.getIdentifier(),r={score:e.score,rating:hc(e.score),hasMarks:e.hasMarks(),marker:e.getMarker(),id:n,text:e.text,markerId:t.length>0?`${t}:${n}`:n};return"ok"===r.rating&&(r.rating="OK"),r}function mc(e,t){switch(e.rating){case"error":t.errorsResults.push(e);break;case"feedback":t.considerationsResults.push(e);break;case"bad":t.problemsResults.push(e);break;case"OK":t.improvementsResults.push(e);break;case"good":t.goodResults.push(e)}return t}function gc(e){let t="";switch(e){case"readability":t=(0,ee.__)("Readability analysis:","wordpress-seo");break;case"seo":t=(0,ee.__)("SEO analysis:","wordpress-seo")}return t}const zc=(e,t,n)=>void 0!==n?e.result[t][n]:e.result[t],Oc=I((e=>({content:e.content,analysis:e.analysis,keyword:e.focusKeyword})))((({content:t,analysis:n,keyword:r,resultType:o,resultSubtype:i})=>{const[a,s]=(0,e.useState)({currentAnalysis:!1,mappedResults:{}});if((0,e.useEffect)((()=>{if(null!==n.result[o]){let e=function(e,t=""){let n={errorsResults:[],problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[]};if(!e)return n;for(let r=0;r({content:e.content,analysis:e.analysis})))((({content:t,analysis:n,resultType:r,resultSubtype:o,text:i})=>{const{scoreToRating:a}=fc.interpreters;if(!1===t.isFetching&&!1===n.isAnalyzing&&zc(n,r,o)){let t=zc(n,r,o).score/10,s=function(e){let t={icon:"seo-score-none",color:bc.t_};switch(e){case"loading":t={icon:"loading-spinner",color:bc.nk};break;case"good":t={icon:"seo-score-good",color:bc.ct};break;case"ok":t={icon:"seo-score-ok",color:bc.vb};break;case"bad":t={icon:"seo-score-bad",color:bc.Wh}}return t}(a(t));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ac.SvgIcon,{icon:s.icon,color:s.color})," ","true"===i?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:`score-label-${r}`},gc(r))," ",(0,e.createElement)("span",null,function(e){let t="-";switch(e){case"good":t=(0,ee.__)("Good","wordpress-seo");break;case"ok":t=(0,ee.__)("OK","wordpress-seo");break;case"bad":t=(0,ee.__)("Needs improvement","wordpress-seo")}return t}(a(t)))):"")}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ac.SvgIcon,{icon:"circle",color:"#bebebe"})," ","true"===i?(0,e.createElement)("span",{className:`score-label-${r}`},gc(r)):"")}));function yc(e){return e>=7?bc.Yy:e>=5?bc.vb:bc.s6}const _c="yoast-measurement-element";function qc(e){let t=document.getElementById(_c);return t||(t=function(){const e=document.createElement("div");return e.id=_c,e.style.position="absolute",e.style.left="-9999em",e.style.top=0,e.style.height=0,e.style.overflow="hidden",e.style.fontFamily="Arial",e.style.fontSize="18px",e.style.fontWeight="400",document.body.appendChild(e),e}()),t.innerText=e,t.offsetWidth}const Ec=e=>{const t=qc(e),n=new fc.assessments.seo.PageTitleWidthAssessment,r=n.calculateScore(t);return{max:n.getMaximumLength(),actual:t,score:r}},wc=I((e=>({...e.content})))((({title:t=""})=>{const[n,r]=(0,e.useState)({progress:null,title:""});return(0,e.useEffect)((()=>{r((e=>({...e,progress:Ec(t),title:t})))}),[t]),null!==n.progress?(0,e.createElement)(Ac.ProgressBar,{min:0,max:n.progress.max,value:n.progress.actual,progressColor:yc(n.progress.score)}):(0,e.createElement)(e.Fragment,null)})),Tc=(e,t)=>{let n=e.length;""!==t&&n>0&&(n+=t.length+3);const r=new fc.assessments.seo.MetaDescriptionLengthAssessment,o=r.calculateScore(n);return{max:r.getMaximumLength(),actual:n,score:o}},Sc=I((e=>({...e.content})))((({description:t="",date:n=""})=>{const[r,o]=(0,e.useState)({progress:null,description:""});return(0,e.useEffect)((()=>{o((e=>({...e,progress:Tc(t,n),description:t})))}),[t]),null!==r.progress?(0,e.createElement)(Ac.ProgressBar,{min:0,max:r.progress.max,value:r.progress.actual,progressColor:yc(r.progress.score)}):(0,e.createElement)(e.Fragment,null)})),Lc=I((e=>({...e.linkingSuggestions})))((({suggestions:t,isCheckingLinkingSuggestions:n})=>n?(0,e.createElement)(Q,null):t.links&&t.links.length>0?(0,e.createElement)("table",{className:"table",style:{width:"auto"}},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,"Label"),(0,e.createElement)("th",null,"Record"),(0,e.createElement)("th",null,"Linked")),t.links.map((t=>(0,e.createElement)("tr",{key:t.recordType+t.id},(0,e.createElement)("td",null,t.label," ",1===parseInt(t.cornerstone)&&"*"),(0,e.createElement)("td",null,t.recordType," [uid=",t.id,"]"),(0,e.createElement)("td",{className:"text-center"},t.active?(0,e.createElement)("button",{className:"btn btn-success btn-sm"}," ✓ "):(0,e.createElement)("button",{className:"btn btn-danger btn-sm"}," ✗ "))))))):(0,e.createElement)("div",{className:"alert alert-info"},"No results found, make sure you have more than 100 words to analyze.",(0,e.createElement)("br",null),"If there's enough content to analyze, it may be that no other content relates to the current content."))),kc=I((e=>({...e.insights})))((({insights:t})=>{if(t){let n=t.result.slice(0,20);return(0,e.createElement)(Ac.WordOccurrenceInsights,{words:n,researchArticleLink:"https://yoa.st/keyword-research-metabox"})}return(0,e.createElement)(Q,null)}));function Rc(t,n,r){const o=function(e){switch(e){case fc.DIFFICULTY.FAIRLY_DIFFICULT:case fc.DIFFICULTY.DIFFICULT:case fc.DIFFICULTY.VERY_DIFFICULT:return(0,ee.__)("Try to make shorter sentences, using less difficult words to improve readability","wordpress-seo");case fc.DIFFICULTY.NO_DATA:return(0,ee.__)("Continue writing to get insight into the readability of your text!","wordpress-seo");default:return(0,ee.__)("Good job!","wordpress-seo")}}(n);return(0,e.createElement)("span",null,function(e,t){return-1===e?sprintf((0,ee.__)("Your text should be slightly longer to calculate your Flesch reading ease score.","wordpress-seo")):sprintf((0,ee.__)("The copy scores %1$s in the test, which is considered %2$s to read.","wordpress-seo"),e,function(e){switch(e){case fc.DIFFICULTY.NO_DATA:return(0,ee.__)("no data","wordpress-seo");case fc.DIFFICULTY.VERY_EASY:return(0,ee.__)("very easy","wordpress-seo");case fc.DIFFICULTY.EASY:return(0,ee.__)("easy","wordpress-seo");case fc.DIFFICULTY.FAIRLY_EASY:return(0,ee.__)("fairly easy","wordpress-seo");case fc.DIFFICULTY.OKAY:return(0,ee.__)("okay","wordpress-seo");case fc.DIFFICULTY.FAIRLY_DIFFICULT:return(0,ee.__)("fairly difficult","wordpress-seo");case fc.DIFFICULTY.DIFFICULT:return(0,ee.__)("difficult","wordpress-seo");case fc.DIFFICULTY.VERY_DIFFICULT:return(0,ee.__)("very difficult","wordpress-seo")}}(t))}(t,n)," ",n>=fc.DIFFICULTY.FAIRLY_DIFFICULT?(0,e.createElement)("a",{href:r,target:"_blank",rel:"noopener noreferrer"},o+"."):o)}const xc=I((e=>({...e.flesch})))((({flesch:t})=>{if(t){let n=t.result.score;const r=(0,e.useMemo)((()=>Rc(n,t.result.difficulty,"https://yoa.st/34s")));return-1===n&&(n="?"),(0,e.createElement)(Ac.InsightsCard,{amount:n,unit:(0,ee.__)("out of 100","wordpress-seo"),title:(0,ee.__)("Flesch reading ease","wordpress-seo"),linkTo:"https://yoa.st/34r",linkText:(0,ee.__)("Learn more about Flesch reading ease","wordpress-seo"),description:r})}return(0,e.createElement)(Q,null)}));function Wc(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var Cc=Wc();Cc.withExtraArgument=Wc;const Nc=Cc;var Dc=o(78964);const Ic="GET_CONTENT_REQUEST",Pc="GET_CONTENT_SUCCESS",Bc="GET_CONTENT_ERROR",jc="UPDATE_CONTENT";function Fc(e){return void 0!==e.title&&(e.title=Dc.strings.stripHTMLTags(e.title)),void 0!==e.description&&(e.description=Dc.strings.stripHTMLTags(e.description)),{type:jc,payload:e}}const Hc={isFetching:!1};let Yc=[];const Uc="SET_FOCUS_KEYWORD";function Xc(e){return{type:Uc,keyword:e}}const $c="SET_FOCUS_KEYWORD_SYNONYMS";function Gc(e){return{type:$c,synonyms:e}}const Vc="ANALYZE_DATA_REQUEST",Kc="ANALYZE_DATA_SUCCESS",Qc=e=>{const{scoreToRating:t}=fc.interpreters;void 0!==YoastConfig.data&&void 0!==YoastConfig.urls.saveScores&&fetch(YoastConfig.urls.saveScores,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:YoastConfig.data.table,uid:YoastConfig.data.uid,languageId:YoastConfig.data.languageId,readabilityScore:t(e.result.readability.score/10),seoScore:t(e.result.seo[""].score/10)})})},Jc=e=>{console.error("An error occured while analyzing the text:"),console.error(e)};function Zc(e,t,n=void 0){return r=>{if(r({type:Vc}),void 0!==n&&"object"==typeof n&&Object.keys(n).length>0)return e.analyze(t).then((o=>{Qc(o),e.analyzeRelatedKeywords(t,n).then((e=>{o.result.seo={...o.result.seo,...e.result.seo},r({type:Kc,payload:o})})).catch((e=>Jc(e)))})).catch((e=>Jc(e)));let o;return o=void 0===n?e.analyze(t):e.analyzeRelatedKeywords(t,n),o.then((e=>{Qc(e),r({type:Kc,payload:e})})).catch((e=>Jc(e)))}}const el={isAnalyzing:!1,result:{readability:{results:[]},seo:{results:[]}}},tl="GET_RELEVANTWORDS_REQUEST",nl="GET_RELEVANTWORDS_SUCCESS";function rl(e,t){return n=>(n({type:tl}),e.runResearch("getProminentWordsForInternalLinking",t).then((e=>{n({type:nl,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const ol={isCheckingRelevantWords:!1,words:[]},il="GET_INSIGHTS_REQUEST",al="GET_INSIGHTS_SUCCESS";function sl(e,t){return n=>(n({type:il}),e.runResearch("getProminentWordsForInsights",t).then((e=>{n({type:al,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const cl={isCheckingInsights:!1,words:[]},ll="GET_FLESCH_REQUEST",ul="GET_FLESCH_SUCCESS";function pl(e,t){return n=>(n({type:ll}),e.runResearch("getFleschReadingScore",t).then((e=>{n({type:ul,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const dl={isCheckingFlesch:!1,words:[]},fl="GET_LINKINGSUGGESTIONS_SUCCESS",bl={isCheckingLinkingSuggestions:!0,suggestions:[]},hl={content:function e(t=Hc,n){switch(n.type){case Ic:return{...t,isFetching:!0};case Pc:YoastConfig.pageTitlePrepend=n.payload.pageTitlePrepend,YoastConfig.pageTitleAppend=n.payload.pageTitleAppend;let r={...t,isFetching:!1,...n.payload};return Yc.forEach((t=>{r=e(r,t)})),Yc=[],r;case Bc:return{...t,isFetching:!1,error:n.error};case jc:return t.isFetching?(Yc.push(n),t):{...t,isFetching:!1,...n.payload};default:return t}},focusKeyword:(e="",t)=>t.type===Uc?t.keyword:e,focusKeywordSynonyms:(e="",t)=>t.type===$c?t.synonyms:e,analysis:function(e=el,t){switch(t.type){case Vc:return{...e,isAnalyzing:!0};case Kc:return{...e,isAnalyzing:!1,...t.payload};default:return e}},relevantWords:function(e=ol,t){switch(t.type){case tl:return{...e,isCheckingRelevantWords:!0};case nl:return{...e,isCheckingRelevantWords:!1,relevantWords:t.payload};default:return e}},insights:function(e=cl,t){switch(t.type){case il:return{...e,isCheckingInsights:!0};case al:return{...e,isCheckingInsights:!1,insights:t.payload};default:return e}},flesch:function(e=dl,t){switch(t.type){case ll:return{...e,isCheckingFlesch:!0};case ul:return{...e,isCheckingFlesch:!1,flesch:t.payload};default:return e}},linkingSuggestions:function(e=bl,t){return t.type===fl?{...e,isCheckingLinkingSuggestions:!1,suggestions:t.payload}:e}},Ml=(0,T.y$)((0,T.HY)(hl),(0,T.Tw)(Nc)),ml=document.createElement("div");document.body.appendChild(ml);const gl=Ml;let zl={_yoastWorker:null,_progressBarInitialized:!1,init:function(){"undefined"!=typeof YoastConfig&&(void 0!==YoastConfig.data&&void 0!==YoastConfig.data.uid&&Ol.init(),void 0!==YoastConfig.urls.linkingSuggestions&&Al.init(YoastConfig.urls.linkingSuggestions),void 0!==YoastConfig.urls.indexPages&&vl.init())},setWorker:function(e,t="en_US"){null!==zl._yoastWorker&&zl._yoastWorker._worker.terminate(),zl._yoastWorker=function(e,t){const n=new fc.AnalysisWorkerWrapper((0,fc.createWorker)(YoastConfig.urls.workerUrl));return n.initialize({locale:t,contentAnalysisActive:!0,keywordAnalysisActive:!0,useKeywordDistribution:!0,useCornerstone:e,logLevel:"ERROR",translations:YoastConfig.translations,defaultQueryParams:null}),n}(e,t)},setLocales:function(){if((0,ee.setLocaleData)({"":{"yoast-components":{}}},"yoast-components"),YoastConfig.translations)for(let e of YoastConfig.translations)(0,ee.setLocaleData)(e.locale_data["wordpress-seo"],e.domain);else(0,ee.setLocaleData)({"":{"wordpress-seo":{}}},"wordpress-seo")},postRequest:(e,t)=>fetch(e,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},Ol={init:()=>{zl.setWorker(YoastConfig.isCornerstoneContent),zl.setLocales(),gl.dispatch(Xc(YoastConfig.focusKeyphrase.keyword)),gl.dispatch(Gc(YoastConfig.focusKeyphrase.synonyms)),Ol.initContentAnalysis(),Ol.initStatusIcon(),Ol.initScoreBars(),Ol.initTCA(),Ol.initSnippetPreviewAndInsights(),Ol.initCornerstone(),Ol.initProgressBars(),Ol.initFocusKeyword(),Ol.initRelatedFocusKeywords(),Ol.initSeoTitle()},initContentAnalysis:()=>{gl.dispatch((e=>(e({type:Ic}),fetch(YoastConfig.urls.previewUrl).then((e=>e.json())).then((t=>{e({type:Pc,payload:t})})).catch((t=>{e({type:Bc,payload:t,error:!0})}))))).then((e=>(zl.setWorker(YoastConfig.isCornerstoneContent,gl.getState().content.locale),Ol.refreshAnalysis()))).then((n=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis"),"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(Oc,{...r})))})),gl.dispatch(function(e,t,n,r,o,i){return a=>{let s=e.relevantWords.result.prominentWords.slice(0,25),c={};s.forEach((function(e){c[e.getStem()]=e.getOccurrences()})),i&&fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({words:c,uid:t,pid:n,languageId:r,table:o})}),a({type:"SAVE_RELEVANTWORDS_SUCCESS"})}}(gl.getState().relevantWords,YoastConfig.data.uid,YoastConfig.data.pid,YoastConfig.data.languageId,YoastConfig.data.table,YoastConfig.urls.prominentWords))}))},initStatusIcon:()=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis");let o=n.closest(".form-section");if(null===o)return;let i=o.querySelector("h4"),a=document.createElement("span");if(null!=i)a.classList.add("yoast-seo-status-icon"),i.prepend(a);else{let e=n.closest(".panel");null!==e&&(i=e.querySelector(".t3js-icon"),a.style.cssText="top: 3px; position: relative;",i.replaceWith(a))}"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(a).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(vc,{...r,text:"false"})))}))},initScoreBars:()=>{document.querySelectorAll(".yoast-seo-score-bar--analysis").forEach((n=>{let r=n.getAttribute("data-yoast-analysis-type");const o={},i={};o.resultType="readability",i.resultType="seo",i.resultSubtype="";const a=(0,t.H)(n);"readability"===r&&a.render((0,e.createElement)(l,{store:gl},(0,e.createElement)(vc,{...o,text:"true"}))),"seo"===r&&a.render((0,e.createElement)(l,{store:gl},(0,e.createElement)(vc,{...i,text:"true"})))}))},initTCA:()=>{void 0!==YoastConfig.TCA&&1===YoastConfig.TCA&&document.querySelectorAll("h1").forEach((n=>{const r={},o={};r.resultType="readability",o.resultType="seo",o.resultSubtype="";let i=document.createElement("div");i.classList.add("yoast-seo-score-bar");let a=document.createElement("span");a.classList.add("yoast-seo-score-bar--analysis"),a.classList.add("yoast-seo-tca"),i.append(a);let s=document.createElement("span");s.classList.add("yoast-seo-score-bar--analysis"),s.classList.add("yoast-seo-tca"),i.append(s),n.parentNode.insertBefore(i,n.nextSibling),(0,t.H)(a).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(vc,{...r,text:"true"}))),(0,t.H)(s).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(vc,{...o,text:"true"})))}))},initSnippetPreviewAndInsights:()=>{document.querySelectorAll("[data-yoast-snippetpreview]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(ce,null)))})),document.querySelectorAll("[data-yoast-insights]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(kc,null)))})),document.querySelectorAll("[data-yoast-flesch]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(xc,null)))}))},initCornerstone:()=>{let e=Ol.getFormEngineElement("cornerstone");null!==e&&e.addEventListener("change",(function(){zl.setWorker(this.checked),Ol.refreshAnalysis()}))},initProgressBars:()=>{let n=Ol.getFormEngineElement("title"),r=Ol.getFormEngineElement("description");null!==n&&null!==r&&(Ol._progressBarInitialized=!0,[{input:n,component:(0,e.createElement)(wc,null),storeKey:"title"},{input:r,component:(0,e.createElement)(Sc,null),storeKey:"description"}].forEach((n=>{if(n.input){let r=document.createElement("div");Ol.addProgressContainer(n.input,r),n.input.addEventListener("input",(0,K.debounce)((e=>{let t=n.input.value,r=Ol.getFormEngineElement("pageTitle").value;""===t&&(t=r),"title"===n.storeKey&&(t=Ol.getTitleValue(t)),gl.dispatch(Fc({[n.storeKey]:t}))}),100)),n.input.addEventListener("change",(e=>{Ol.refreshAnalysis()})),(0,t.H)(r).render((0,e.createElement)(l,{store:gl},n.component))}})))},addProgressContainer:(e,t)=>{let n=e.closest(".form-wizards-wrap");if("grid"===window.getComputedStyle(n).getPropertyValue("display")){t.style.gridArea="bottom";let n=e.closest(".form-control-wrap");n.style.maxWidth&&(t.style.maxWidth=n.style.maxWidth),e.closest(".form-control-wrap").after(t)}else e.after(t)},initFocusKeyword:()=>{Ol.getFormEngineElements("focusKeyword").forEach((e=>{e.addEventListener("input",(0,K.debounce)((t=>{gl.dispatch(Xc(e.value)),Ol.refreshAnalysis()}),500))})),Ol.getFormEngineElements("focusKeywordSynonyms").forEach((e=>{e.addEventListener("input",(0,K.debounce)((t=>{gl.dispatch(Gc(e.value)),Ol.refreshAnalysis()}),500))}))},initRelatedFocusKeywords:()=>{if("undefined"==typeof YoastConfig||void 0===YoastConfig.fieldSelectors||void 0===YoastConfig.fieldSelectors.relatedKeyword)return;let n=document.querySelector(`#${YoastConfig.fieldSelectors.relatedKeyword}`);null!==n&&n.querySelectorAll(".panel-heading").forEach((n=>{n.addEventListener("click",(0,K.debounce)((n=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis"),"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(Oc,{...r})))}))}),2e3))}))},initSeoTitle:()=>{let e=Ol.getFieldSelector("title"),t=Ol.getFieldSelector("pageTitle");if(!1===e||!1===t)return;let n=Ol.getFormEngineElement("pageTitle");n&&n.addEventListener("change",(function(e){Ol.setSeoTitlePlaceholder()})),window.addEventListener("load",(function(e){Ol.setSeoTitlePlaceholder()})),document.querySelectorAll("li.t3js-tabmenu-item").forEach((e=>{e.innerHTML.includes("SEO")&&e.addEventListener("click",(0,K.debounce)((e=>{!1===Ol._progressBarInitialized&&Ol.initProgressBars();let t=Ol.getFormEngineElement("title"),n=t.value,r=Ol.getFormEngineElement("pageTitle").value;t.setAttribute("placeholder",r),""===n&&(n=r),n=Ol.getTitleValue(n),gl.dispatch(Fc({title:n+" "}))}),100))}))},getTitleValue:e=>(void 0!==YoastConfig.pageTitlePrepend&&null!==YoastConfig.pageTitlePrepend&&""!==YoastConfig.pageTitlePrepend&&(e=YoastConfig.pageTitlePrepend+e),void 0!==YoastConfig.pageTitleAppend&&null!==YoastConfig.pageTitleAppend&&""!==YoastConfig.pageTitleAppend&&(e+=YoastConfig.pageTitleAppend),e),setSeoTitlePlaceholder:()=>{let e=Ol.getFormEngineElement("title"),t=Ol.getFormEngineElement("pageTitle");if(e&&t){let n=t.value;e.setAttribute("placeholder",n)}},getFieldSelector:e=>void 0!==YoastConfig.fieldSelectors&&void 0!==YoastConfig.fieldSelectors[e]&&YoastConfig.fieldSelectors[e],getFormEngineElement:e=>{let t=Ol.getFieldSelector(e);return!1===t?null:document.querySelector(`[data-formengine-input-name="${t}"]`)},getFormEngineElements:e=>{let t=Ol.getFieldSelector(e);return!1===t?[]:document.querySelectorAll(`[data-formengine-input-name="${t}"]`)},refreshAnalysis:()=>function(e,t){const n=t.getState(),r=n.content,o=new fc.Paper(r.body,{keyword:n.focusKeyword,title:r.title,synonyms:n.focusKeywordSynonyms,description:r.description,locale:r.locale,titleWidth:qc(r.title)});return Promise.all([t.dispatch(Zc(e,o,YoastConfig.relatedKeyphrases)),t.dispatch(rl(e,o)),t.dispatch(sl(e,o)),t.dispatch(pl(e,o))])}(zl._yoastWorker,gl)},Al={_url:null,_updateInterval:null,init:n=>{Al._url=n,zl.setWorker(!1,YoastConfig.linkingSuggestions.locale),document.querySelectorAll("[data-yoast-linking-suggestions]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(Lc,null)))})),Al._updateInterval=setInterval((()=>{Al.checkLinkingSuggestions()}),1e3)},checkLinkingSuggestions:()=>{let e=Al.getCKEditorContent();null!==e&&(gl.dispatch(function(e,t,n){return r=>{const o=new fc.Paper(t,{locale:YoastConfig.linkingSuggestions.locale});return e.runResearch("getProminentWordsForInternalLinking",o).then((e=>{let o=e.result.prominentWords.slice(0,5);fetch(n,{method:"post",headers:new Headers,body:JSON.stringify({words:o,excludedPage:YoastConfig.linkingSuggestions.excludedPage,languageId:YoastConfig.data.languageId,content:t})}).then((e=>e.json())).then((e=>{r({type:fl,payload:e})})).catch((e=>{console.error("An error occured while analyzing the linking suggestions:"),console.error(e)}))}))}}(zl._yoastWorker,e,Al._url)),clearInterval(Al._updateInterval),Al._updateInterval=setInterval((()=>{Al.checkLinkingSuggestions()}),1e4))},getCKEditorContent:()=>{if(document.getElementsByTagName("typo3-rte-ckeditor-ckeditor5").length>0){const e=document.querySelectorAll(".ck-editor__editable");let t="",n=!1;for(let r in e)void 0!==e[r].ckeditorInstance&&(n=!0,t+=e[r].ckeditorInstance.getData());return!1===n?null:t}{if("undefined"==typeof CKEDITOR)return null;let e="";for(let t in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(t)&&(e+=CKEDITOR.instances[t].getData());return e}}},vl={_progressCache:[],init:()=>{document.querySelectorAll(".js-crawler-index").forEach((e=>{e.addEventListener("click",(t=>{vl.startIndex(e.dataset.site,e.dataset.language)}))}))},startIndex:(e,t)=>{vl.setButtonsDisableStatus(!0),document.querySelector("#saved-progress-"+e+"-"+t).remove();let n=document.querySelector("#progress-"+e+"-"+t);n.classList.remove("hide");let r=n.querySelector(".js-crawler-pages-progress"),o=n.querySelector(".js-crawler-pages-success");zl.postRequest(YoastConfig.urls.determinePages,{site:e,language:t}).then((e=>e.json())).then((n=>{void 0!==n.error?(r.innerHTML=n.error,r.classList.remove("alert-info"),r.classList.add("alert-danger")):(r.classList.add("hide"),o.classList.remove("hide"),o.innerHTML=o.innerHTML.replace("%d",n.amount),vl.runIndex(e,t))}))},setButtonsDisableStatus:e=>{document.querySelectorAll(".js-crawler-button").forEach((t=>{t.disabled=e}))},runIndex:(e,t)=>{let n=document.querySelector("#progress-"+e+"-"+t).querySelector(".js-crawler-progress-bar");zl.postRequest(YoastConfig.urls.indexPages,{site:e,language:t,offset:void 0!==vl._progressCache[e+"-"+t]?parseInt(vl._progressCache[e+"-"+t]):0}).then((e=>e.json())).then((async r=>{void 0!==r.status?(vl.setButtonsDisableStatus(!1),n.classList.remove("progress-bar-info"),n.classList.add("progress-bar-success"),n.style.width="100%",n.innerHTML=r.total+" pages have been indexed."):(vl._progressCache[e+"-"+t]=parseInt(r.nextOffset),await vl.process(e,t,r,n),vl.runIndex(e,t,r))}))},process:async(e,t,n,r)=>{let o=n.current,i=n.total,a=Math.round(o/i*100);vl.updateProgressBar(r,o,i,a);for(let e in n.pages)if(n.pages.hasOwnProperty(e)){let s=n.pages[e],c=await zl.postRequest(YoastConfig.urls.preview,{pageId:s,languageId:t,additionalGetVars:""});if(c.ok){let e=await c.json();await vl.processRelevantWords(s,t,e),o++,a=Math.round(o/i*100),vl.updateProgressBar(r,o,i,a)}}},processRelevantWords:(e,t,n)=>{zl.setWorker(!1,n.locale);let r=new fc.Paper(n.body,{title:n.title,description:n.description,locale:n.locale});return zl._yoastWorker.runResearch("getProminentWordsForInternalLinking",r).then((async n=>{await vl.saveRelevantWords(e,t,n)}))},saveRelevantWords:(e,t,n)=>{let r=n.result.prominentWords.slice(0,25),o={};r.forEach((e=>{o[e.getStem()]=e.getOccurrences()})),zl.postRequest(YoastConfig.urls.prominentWords,{words:o,uid:e,languageId:t,table:"pages"})},updateProgressBar:(e,t,n,r)=>{e.innerText=t+"/"+n,e.style.width=r+"%"}};zl.init()})()})(); \ No newline at end of file