/home/techb158/public_html/wp-content/plugins/wordpress-seo/js/dist
Edit: /home/techb158/public_html/wp-content/plugins/wordpress-seo/js/dist/editor-modules.js (156972B)
(()=>{var e={465(e,s,t){const r=t(1609),o=r.forwardRef(function(e,s){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:s},e),r.createElement("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"}))});e.exports=o},818(e,s,t){const r=t(1609),o=r.forwardRef(function(e,s){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:s},e),r.createElement("path",{fillRule:"evenodd",d:"M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"}))});e.exports=o},1609(e){"use strict";e.exports=window.React},2485(e,s){var t;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],s=0;s
{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},t.d=(e,s)=>{for(var r in s)t.o(s,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:s[r]})},t.o=(e,s)=>Object.prototype.hasOwnProperty.call(e,s),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};t.r(e),t.d(e,{refreshDelay:()=>a});var s={};t.r(s),t.d(s,{default:()=>k,initializationDone:()=>S,sortResultsByIdentifier:()=>b});var r={};t.r(r),t.d(r,{default:()=>Q,getIconForScore:()=>Z});var o={};t.r(o),t.d(o,{doAjaxRequest:()=>ts});var i={};t.r(i),t.d(i,{applyReplaceUsingPlugin:()=>vs,createLabelFromName:()=>ps,excerptFromContent:()=>ws,fillReplacementVariables:()=>ds,handlePrefixes:()=>us,mapCustomFields:()=>fs,mapCustomTaxonomies:()=>xs,nonReplaceVars:()=>cs,prepareCustomFieldForDispatch:()=>gs,prepareCustomTaxonomyForDispatch:()=>ys,pushNewReplaceVar:()=>ms,replaceSpaces:()=>hs});const n=window.yoast.externals.contexts,a=500,l=window.lodash;function c(){return(0,l.get)(window,"wpseoScriptData.metabox",{intl:{},isRtl:!1})}const d=window.wp.i18n,u=window.yoast.analysis,p=window.wp.hooks,m=window.yoast.externals.redux;class h{static get keyphraseElement(){var e;return document.getElementById(null!==(e=window.wpseoScriptData)&&void 0!==e&&e.isPost?"yoast_wpseo_focuskw":"hidden_wpseo_focuskw")}static get isCornerstoneElement(){var e;return document.getElementById(null!==(e=window.wpseoScriptData)&&void 0!==e&&e.isPost?"yoast_wpseo_is_cornerstone":"hidden_wpseo_is_cornerstone")}static get seoScoreElement(){var e;return document.getElementById(null!==(e=window.wpseoScriptData)&&void 0!==e&&e.isPost?"yoast_wpseo_linkdex":"hidden_wpseo_linkdex")}static get readabilityScoreElement(){var e;return document.getElementById(null!==(e=window.wpseoScriptData)&&void 0!==e&&e.isPost?"yoast_wpseo_content_score":"hidden_wpseo_content_score")}static get inclusiveLanguageScoreElement(){var e;return document.getElementById(null!==(e=window.wpseoScriptData)&&void 0!==e&&e.isPost?"yoast_wpseo_inclusive_language_score":"hidden_wpseo_inclusive_language_score")}static get seoTitleScoreElement(){var e;return document.getElementById(null!==(e=window.wpseoScriptData)&&void 0!==e&&e.isPost?"yoast_wpseo_seo_title_score":"hidden_wpseo_seo_title_score")}static get metaDescriptionScoreElement(){var e;return document.getElementById(null!==(e=window.wpseoScriptData)&&void 0!==e&&e.isPost?"yoast_wpseo_meta_description_score":"hidden_wpseo_meta_description_score")}static set keyphrase(e){h.keyphraseElement&&(h.keyphraseElement.value=e)}static get keyphrase(){var e,s;return null!==(e=null===(s=h.keyphraseElement)||void 0===s?void 0:s.value)&&void 0!==e?e:""}static set isCornerstone(e){h.isCornerstoneElement&&(h.isCornerstoneElement.value=e?"1":"0")}static get isCornerstone(){var e;return"1"===(null===(e=h.isCornerstoneElement)||void 0===e?void 0:e.value)}static set seoScore(e){h.seoScoreElement&&(h.seoScoreElement.value=e)}static get seoScore(){var e,s;return null!==(e=null===(s=h.seoScoreElement)||void 0===s?void 0:s.value)&&void 0!==e?e:""}static set readabilityScore(e){h.readabilityScoreElement&&(h.readabilityScoreElement.value=e)}static get readabilityScore(){var e,s;return null!==(e=null===(s=h.readabilityScoreElement)||void 0===s?void 0:s.value)&&void 0!==e?e:""}static set inclusiveLanguageScore(e){h.inclusiveLanguageScoreElement&&(h.inclusiveLanguageScoreElement.value=e)}static get inclusiveLanguageScore(){var e,s;return null!==(e=null===(s=h.inclusiveLanguageScoreElement)||void 0===s?void 0:s.value)&&void 0!==e?e:""}static set seoTitleScore(e){h.seoTitleScoreElement&&(h.seoTitleScoreElement.value=e)}static get seoTitleScore(){var e,s;return null!==(e=null===(s=h.seoTitleScoreElement)||void 0===s?void 0:s.value)&&void 0!==e?e:""}static set metaDescriptionScore(e){h.metaDescriptionScoreElement&&(h.metaDescriptionScoreElement.value=e)}static get metaDescriptionScore(){var e,s;return null!==(e=null===(s=h.metaDescriptionScoreElement)||void 0===s?void 0:s.value)&&void 0!==e?e:""}}const g=["titleWidth","keyphraseInSEOTitle"],y=["metaDescriptionKeyword","metaDescriptionLength"],x=(e,s)=>{const t=(e||[]).filter(e=>{var t,r;return s.includes(null==e?void 0:e._identifier)&&(null===(t=e.hasScore)||void 0===t?void 0:t.call(e))&&(null===(r=e.hasText)||void 0===r?void 0:r.call(e))}),r=t.reduce((e,s)=>e+s.getScore(),0);return Math.round(r/(9*t.length)*100)||0},f=e=>{const s=(e=>x(e,g))(e);s>0&&(h.seoTitleScore=String(s));const t=(e=>x(e,y))(e);t>0&&(h.metaDescriptionScore=String(t))};function w(){}let v=!1;function b(e){return e.sort((e,s)=>e._identifier.localeCompare(s._identifier))}function k(e,s,t,r,o){if(!v)return;const i=u.Paper.parse(s());e.analyze(i).then(n=>{const{result:{seo:a,readability:l,inclusiveLanguage:c}}=n;if(a){const e=a[""];e.results.forEach(e=>{e.getMarker=()=>()=>t(i,e.marks)}),e.results=b(e.results),r.dispatch(m.actions.setSeoResultsForKeyword(i.getKeyword(),e.results)),r.dispatch(m.actions.setOverallSeoScore(e.score,i.getKeyword())),r.dispatch(m.actions.refreshSnippetEditor()),o.saveScores(e.score,i.getKeyword()),f(e.results)}l&&(l.results.forEach(e=>{e.getMarker=()=>()=>t(i,e.marks)}),l.results=b(l.results),r.dispatch(m.actions.setReadabilityResults(l.results)),r.dispatch(m.actions.setOverallReadabilityScore(l.score)),r.dispatch(m.actions.refreshSnippetEditor()),o.saveContentScore(l.score)),c&&(c.results.forEach(e=>{e.getMarker=()=>()=>t(i,e.marks)}),c.results=b(c.results),r.dispatch(m.actions.setInclusiveLanguageResults(c.results)),r.dispatch(m.actions.setOverallInclusiveLanguageScore(c.score)),r.dispatch(m.actions.refreshSnippetEditor()),o.saveInclusiveLanguageScore(c.score)),(0,p.doAction)("yoast.analysis.refresh",n,{paper:i,worker:e,collectData:s,applyMarks:t,store:r,dataCollector:o})}).catch(w)}function S(){v=!0}const j=window.wp.element,_=window.yoast.styledComponents;var C=t.n(_);const R=window.yoast.propTypes;var E=t.n(R);const I=window.yoast.componentsNew,L=window.yoast.helpers,N=window.yoast.styleGuide,T=window.ReactJSXRuntime,M=N.colors.$color_bad,P=N.colors.$palette_error_background,A=N.colors.$color_grey_text_light,O=N.colors.$palette_error_text,F=C().div`
display: flex;
flex-direction: column;
`,q=C().label`
font-size: var(--yoast-font-size-default);
font-weight: var(--yoast-font-weight-bold);
${(0,L.getDirectionalStyle)("margin-right: 4px","margin-left: 4px")};
`,B=C().span`
margin-bottom: 0.5em;
`,$=C()(I.InputField)`
flex: 1 !important;
box-sizing: border-box;
max-width: 100%;
margin: 0; // Reset margins inherited from WordPress.
// Hide native X in Edge and IE11.
&::-ms-clear {
display: none;
}
&.has-error {
border-color: ${M} !important;
background-color: ${P} !important;
&:focus {
box-shadow: 0 0 2px ${M} !important;
}
}
`,U=C().ul`
color: ${O};
list-style-type: disc;
list-style-position: outside;
margin: 0;
margin-left: 1.2em;
`,W=C().li`
color: ${O};
margin: 0 0 0.5em 0;
`,D=(0,I.addFocusStyle)(C().button`
border: 1px solid transparent;
box-shadow: none;
background: none;
flex: 0 0 32px;
height: 32px;
max-width: 32px;
padding: 0;
cursor: pointer;
`);D.propTypes={type:E().string,focusColor:E().string,focusBackgroundColor:E().string,focusBorderColor:E().string},D.defaultProps={type:"button",focusColor:N.colors.$color_button_text_hover,focusBackgroundColor:"transparent",focusBorderColor:N.colors.$color_blue};const H=C()(I.SvgIcon)`
margin-top: 4px;
`,z=C().div`
display: flex;
flex-direction: row;
align-items: center;
&.has-remove-keyword-button {
${$} {
${(0,L.getDirectionalStyle)("padding-right: 40px","padding-left: 40px")};
}
${D} {
${(0,L.getDirectionalStyle)("margin-left: -32px","margin-right: -32px")};
}
}
`;class G extends j.Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}handleChange(e){this.props.onChange(e.target.value)}renderLabel(){const{id:e,label:s,helpLink:t}=this.props;return(0,T.jsxs)(B,{children:[(0,T.jsx)(q,{htmlFor:e,children:s}),t]})}renderErrorMessages(){const e=[...this.props.errorMessages];return!(0,l.isEmpty)(e)&&(0,T.jsx)(U,{children:e.map((e,s)=>(0,T.jsx)(W,{children:(0,T.jsx)("span",{role:"alert",children:e})},s))})}render(){const{id:e,showLabel:s,keyword:t,onRemoveKeyword:r,onBlurKeyword:o,onFocusKeyword:i,hasError:n}=this.props,a=!s,c=r!==l.noop;return(0,T.jsxs)(F,{children:[s&&this.renderLabel(),n&&this.renderErrorMessages(),(0,T.jsxs)(z,{className:c?"has-remove-keyword-button":null,children:[(0,T.jsx)($,{"aria-label":a?this.props.label:null,type:"text",id:e,className:n?"has-error":null,onChange:this.handleChange,onFocus:i,onBlur:o,value:t,autoComplete:"off"}),c&&(0,T.jsx)(D,{onClick:r,focusBoxShadowColor:"#084A67",children:(0,T.jsx)(H,{size:"18px",icon:"times-circle",color:A})})]})]})}}G.propTypes={id:E().string.isRequired,showLabel:E().bool,keyword:E().string,onChange:E().func.isRequired,onRemoveKeyword:E().func,onBlurKeyword:E().func,onFocusKeyword:E().func,label:E().string.isRequired,helpLink:E().node,hasError:E().bool,errorMessages:E().arrayOf(E().string)},G.defaultProps={showLabel:!0,keyword:"",onRemoveKeyword:l.noop,onBlurKeyword:l.noop,onFocusKeyword:l.noop,helpLink:null,hasError:!1,errorMessages:[]};const V=G;function K(e,s=""){const t=e.getIdentifier(),r={score:e.score,rating:u.interpreters.scoreToRating(e.score),hasMarks:e.hasMarks(),marker:e.getMarker(),id:t,text:e.text,markerId:s.length>0?`${s}:${t}`:t,hasBetaBadge:e.isBeta(),hasJumps:e.hasJumps(),hasAIFixes:e.isOptimizable(),editFieldName:e.editFieldName,editFieldAriaLabel:e.editFieldAriaLabel};return"ok"===r.rating&&(r.rating="OK"),r}function Y(e,s){switch(e.rating){case"error":s.errorsResults.push(e);break;case"feedback":s.considerationsResults.push(e);break;case"bad":s.problemsResults.push(e);break;case"OK":s.improvementsResults.push(e);break;case"good":s.goodResults.push(e)}return s}function Z(e){switch(e){case"loading":return{icon:"loading-spinner",color:N.colors.$color_green_medium_light};case"not-set":return{icon:"seo-score-none",color:N.colors.$color_score_icon};case"noindex":return{icon:"seo-score-none",color:N.colors.$color_noindex};case"good":return{icon:"seo-score-good",color:N.colors.$color_green_medium};case"ok":return{icon:"seo-score-ok",color:N.colors.$color_ok};default:return{icon:"seo-score-bad",color:N.colors.$color_red}}}function Q(e,s=""){let t={errorsResults:[],problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[]};if(!e)return t;for(let r=0;r(0,T.jsx)(X.Root,{children:(0,T.jsx)(X.TextField,{id:e,label:s,onChange:r,autoComplete:"off",description:t,...o})});J.propTypes={id:E().string.isRequired,label:E().string.isRequired,onChange:E().func.isRequired,description:E().node};const ee=J,se=(0,L.makeOutboundLink)(C().a`
display: inline-block;
position: relative;
outline: none;
text-decoration: none;
border-radius: 100%;
width: 24px;
height: 24px;
margin: -4px 0;
vertical-align: middle;
color: ${N.colors.$color_help_text};
&:hover,
&:focus {
color: ${N.colors.$color_snippet_focus};
}
// Overwrite the default blue active color for links.
&:active {
color: ${N.colors.$color_help_text};
}
&::before {
position: absolute;
top: 0;
left: 0;
padding: 2px;
content: "\f223";
}
`),te=C()(I.Collapsible)`
h2 > button {
padding-left: 24px;
padding-top: 16px;
&:hover {
background-color: #f0f0f0;
}
}
div[class^="collapsible_content"] {
padding: 24px 0;
margin: 0 24px;
border-top: 1px solid rgba(0,0,0,0.2);
}
`,re=window.wp.components,oe=({title:e="Yoast SEO",className:s="yoast yoast-gutenberg-modal",showYoastIcon:t=!0,children:r=null,additionalClassName:o="",...i})=>{const n=t?(0,T.jsx)("span",{className:"yoast-icon"}):null;return(0,T.jsx)(re.Modal,{title:e,className:`${s} ${o}`,icon:n,...i,children:r})};oe.propTypes={title:E().string,className:E().string,showYoastIcon:E().bool,children:E().oneOfType([E().node,E().arrayOf(E().node)]),additionalClassName:E().string};const ie=oe,ne=window.yoast.socialMetadataForms,ae=e=>({type:e.subtype,width:e.width,height:e.height,url:e.url,id:e.id,sizes:e.sizes,alt:e.alt||e.title||e.name});const le=({hiddenField:e,hiddenFieldImageId:s="",hiddenFieldFallbackImageId:t="",hasImageValidation:r=!1,...o})=>{const[i,n]=(0,j.useState)(null!==document.getElementById(t)),a=(0,j.useMemo)(()=>document.getElementById(e)),l=(0,j.useMemo)(()=>document.getElementById(s));let c=null;c=t&&document.getElementById(t)?(0,j.useMemo)(()=>document.getElementById(t)):l;const[d,u]=(0,j.useState)({url:a?a.value:"",id:c?parseInt(c.value,10):"",alt:""}),[p,m]=(0,j.useState)([]),h=(0,j.useCallback)(e=>{a&&(a.value=e.url),c&&(c.value=e.id)}),g=(0,j.useCallback)(()=>{(function(e){const s=window.wp.media();return s.on("select",()=>{const t=s.state().get("selection").first();e(ae(t.attributes))}),s})(e=>{c=l,u(e),h(e),r&&m((0,L.validateFacebookImage)(e)),n(!1)}).open()},[r,h]),y=(0,j.useCallback)(()=>{c=l;const e={url:"",id:"",alt:""};u(e),h(e),m([]),n(!0)},[h]);return(0,j.useEffect)(()=>{var e;d.id&&!d.alt&&(e=d.id,new Promise((s,t)=>{window.wp.media.attachment||t(),window.wp.media.attachment(e).fetch().then(e=>{s(ae(e))}).catch(()=>t())})).then(e=>u(e))},[d]),(0,T.jsx)(I.ImageSelect,{...o,usingFallback:i,imageUrl:d.url,imageId:d.id,imageAltText:d.alt,onClick:g,onRemoveImageClick:y,warnings:p})};le.propTypes={hiddenField:E().string.isRequired,hiddenFieldImageId:E().string,hiddenFieldFallbackImageId:E().string,hasImageValidation:E().bool};const ce=le;function de({target:e,children:s}){let t=e;return"string"==typeof e&&(t=document.getElementById(e)),t?(0,j.createPortal)(s,t):null}function ue({target:e,label:s,hasPreview:t,hiddenField:r,hiddenFieldImageId:o="",hiddenFieldFallbackImageId:i="",selectImageButtonId:n="",replaceImageButtonId:a="",removeImageButtonId:l="",hasNewBadge:c=!1,isDisabled:d=!1,hasPremiumBadge:u=!1,hasImageValidation:p=!1}){return(0,T.jsx)(de,{target:e,children:(0,T.jsx)(ce,{label:s,hasPreview:t,hiddenField:r,hiddenFieldImageId:o,hiddenFieldFallbackImageId:i,selectImageButtonId:n,replaceImageButtonId:a,removeImageButtonId:l,hasNewBadge:c,isDisabled:d,hasPremiumBadge:u,hasImageValidation:p})})}de.propTypes={target:E().oneOfType([E().string,E().object]).isRequired,children:E().node.isRequired},ue.propTypes={target:E().string.isRequired,label:E().string.isRequired,hasPreview:E().bool.isRequired,hiddenField:E().string.isRequired,hiddenFieldImageId:E().string,hiddenFieldFallbackImageId:E().string,selectImageButtonId:E().string,replaceImageButtonId:E().string,removeImageButtonId:E().string,hasNewBadge:E().bool,isDisabled:E().bool,hasPremiumBadge:E().bool,hasImageValidation:E().bool};const pe=({target:e,scoreIndicator:s})=>(0,T.jsx)(de,{target:e,children:(0,T.jsx)(I.SvgIcon,{...Z(s)})});pe.propTypes={target:E().string.isRequired,scoreIndicator:E().string.isRequired};const me=pe,he=({title:e,children:s,id:t=null,prefixIcon:r=null,subTitle:o="",hasBetaBadgeLabel:i=!1,hasNewBadgeLabel:n=!1,buttonId:a=null,renderNewBadgeLabel:l=()=>{},initialIsOpen:c=!1})=>{const[d,u]=(0,j.useState)(c),p=(0,j.useRef)(null);(0,j.useEffect)(()=>{c&&p.current&&p.current.focus()},[]);const m=(0,j.useCallback)(()=>{u(e=>!e)},[u]);return(0,T.jsxs)("div",{id:t,className:"yoast components-panel__body "+(d?"is-opened":""),children:[(0,T.jsx)("h2",{className:"components-panel__body-title",children:(0,T.jsxs)("button",{ref:p,onClick:m,className:"components-button components-panel__body-toggle",type:"button",id:a,children:[(0,T.jsx)("span",{className:"yoast-icon-span",style:{fill:`${r&&r.color||""}`},children:r&&(0,T.jsx)(I.SvgIcon,{icon:r.icon,color:r.color,size:r.size})}),!n&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)("span",{className:"yoast-title-container",children:[(0,T.jsx)("div",{className:"yoast-title",children:e}),o&&(0,T.jsx)("div",{className:"yoast-subtitle",children:o})]}),i&&(0,T.jsx)(I.BetaBadge,{})]}),n&&(0,T.jsxs)("div",{className:"yst-flex-grow yst-flex yst-items-center yst-gap-2",children:[(0,T.jsxs)("span",{className:"yst-overflow-x-hidden yst-leading-normal",children:[(0,T.jsx)("div",{className:"yoast-title",children:e}),o&&(0,T.jsx)("div",{className:"yoast-subtitle",children:o})]}),l()]}),(0,T.jsx)("span",{className:"yoast-chevron","aria-hidden":"true"})]})}),d&&s]})},ge=he;he.propTypes={title:E().string.isRequired,children:E().oneOfType([E().node,E().arrayOf(E().node)]).isRequired,id:E().string,prefixIcon:E().object,subTitle:E().string,hasBetaBadgeLabel:E().bool,hasNewBadgeLabel:E().bool,buttonId:E().string,renderNewBadgeLabel:E().func,initialIsOpen:E().bool};const ye=({children:e})=>(0,T.jsx)("div",{children:e});ye.propTypes={renderPriority:E().number.isRequired,children:E().node.isRequired};const xe=ye,fe=({theme:e,location:s,children:t})=>(0,T.jsx)(n.LocationProvider,{value:s,children:(0,T.jsx)(_.ThemeProvider,{theme:e,children:t})});fe.propTypes={theme:E().object.isRequired,location:E().oneOf(["sidebar","metabox","modal"]).isRequired,children:E().node.isRequired};const we=fe,ve=window.wp.compose,be=window.wp.data,ke=({onClick:e,title:s,id:t="",subTitle:r="",suffixIcon:o=null,SuffixHeroIcon:i=null,prefixIcon:n=null,children:a=null})=>(0,T.jsx)("div",{className:"yoast components-panel__body",children:(0,T.jsx)("h2",{className:"components-panel__body-title",children:(0,T.jsxs)("button",{id:t,onClick:e,className:"components-button components-panel__body-toggle",type:"button",children:[n&&(0,T.jsx)("span",{className:"yoast-icon-span",style:{fill:`${n&&n.color||""}`},children:(0,T.jsx)(I.SvgIcon,{size:n.size,icon:n.icon})}),(0,T.jsxs)("span",{className:"yoast-title-container",children:[(0,T.jsx)("div",{className:"yoast-title",children:s}),(0,T.jsx)("div",{className:"yoast-subtitle",children:r})]}),a,o&&(0,T.jsx)(I.SvgIcon,{size:o.size,icon:o.icon}),i]})})}),Se=ke;ke.propTypes={onClick:E().func.isRequired,title:E().string.isRequired,id:E().string,subTitle:E().string,suffixIcon:E().object,SuffixHeroIcon:E().element,prefixIcon:E().object,children:E().node};const je=({id:e,postTypeName:s,children:t,title:r,isOpen:o,open:i,close:a,shouldCloseOnClickOutside:l=!0,showChangesWarning:c=!0,SuffixHeroIcon:u=null})=>(0,T.jsxs)(j.Fragment,{children:[o&&(0,T.jsx)(n.LocationProvider,{value:"modal",children:(0,T.jsxs)(ie,{title:r,onRequestClose:a,additionalClassName:"yoast-collapsible-modal yoast-post-settings-modal",id:"id",shouldCloseOnClickOutside:l,children:[(0,T.jsx)("div",{className:"yoast-content-container",children:(0,T.jsx)("div",{className:"yoast-modal-content",children:t})}),(0,T.jsxs)("div",{className:"yoast-notice-container",children:[(0,T.jsx)("hr",{}),(0,T.jsxs)("div",{className:"yoast-button-container",children:[c&&(0,T.jsx)("p",{children:/* Translators: %s translates to the Post Label in singular form */ /* Translators: %s translates to the Post Label in singular form */
(0,d.sprintf)((0,d.__)("Make sure to save your %s for changes to take effect","wordpress-seo"),s)}),(0,T.jsx)("button",{className:"yoast-button yoast-button--primary yoast-button--post-settings-modal",type:"button",onClick:a,children:/* Translators: %s translates to the Post Label in singular form */ /* Translators: %s translates to the Post Label in singular form */
(0,d.sprintf)((0,d.__)("Return to your %s","wordpress-seo"),s)})]})]})]})}),(0,T.jsx)(Se,{id:e+"-open-button",title:r,SuffixHeroIcon:u,suffixIcon:u?null:{size:"20px",icon:"pencil-square"},onClick:i})]});je.propTypes={id:E().string.isRequired,postTypeName:E().string.isRequired,children:E().oneOfType([E().node,E().arrayOf(E().node)]).isRequired,title:E().string.isRequired,isOpen:E().bool.isRequired,open:E().func.isRequired,close:E().func.isRequired,shouldCloseOnClickOutside:E().bool,showChangesWarning:E().bool,SuffixHeroIcon:E().element};const _e=je,Ce=(0,ve.compose)([(0,be.withSelect)((e,s)=>{const{getPostOrPageString:t,getIsModalOpen:r}=e("yoast-seo/editor");return{postTypeName:t(),isOpen:r(s.id)}}),(0,be.withDispatch)((e,s)=>{const{openEditorModal:t,closeEditorModal:r}=e("yoast-seo/editor");return{open:()=>t(s.id),close:r}})])(_e),Re=(0,ve.compose)([(0,be.withSelect)((e,s)=>{const{isAlertDismissed:t}=e(s.store||"yoast-seo/editor");return{isAlertDismissed:t(s.alertKey)}}),(0,be.withDispatch)((e,s)=>{const{dismissAlert:t}=e(s.store||"yoast-seo/editor");return{onDismissed:()=>t(s.alertKey)}})])(I.Alert),Ee=window.yoast.analysisReport;var Ie=t(465),Le=t.n(Ie);const Ne=window.wp.url,Te=(e,s)=>{try{return(0,j.createInterpolateElement)(e,s)}catch(s){return console.error("Error in translation for:",e,s),e}};var Me,Pe,Ae=t(1609),Oe=t.n(Ae);function Fe(){return Fe=Object.assign?Object.assign.bind():function(e){for(var s=1;sAe.createElement("svg",Fe({xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 425 456.27"},e),Me||(Me=Ae.createElement("path",{d:"M73 405.26a66.79 66.79 0 0 1-6.54-1.7 64.75 64.75 0 0 1-6.28-2.31c-1-.42-2-.89-3-1.37-1.49-.72-3-1.56-4.77-2.56-1.5-.88-2.71-1.64-3.83-2.39-.9-.61-1.8-1.26-2.68-1.92a70.154 70.154 0 0 1-5.08-4.19 69.21 69.21 0 0 1-8.4-9.17c-.92-1.2-1.68-2.25-2.35-3.24a70.747 70.747 0 0 1-3.44-5.64 68.29 68.29 0 0 1-8.29-32.55V142.13a68.26 68.26 0 0 1 8.29-32.55c1-1.92 2.21-3.82 3.44-5.64s2.55-3.58 4-5.27a69.26 69.26 0 0 1 14.49-13.25C50.37 84.19 52.27 83 54.2 82A67.59 67.59 0 0 1 73 75.09a68.75 68.75 0 0 1 13.75-1.39h169.66L263 55.39H86.75A86.84 86.84 0 0 0 0 142.13v196.09A86.84 86.84 0 0 0 86.75 425h11.32v-18.35H86.75A68.75 68.75 0 0 1 73 405.26zM368.55 60.85l-1.41-.53-6.41 17.18 1.41.53a68.06 68.06 0 0 1 8.66 4c1.93 1 3.82 2.2 5.65 3.43A69.19 69.19 0 0 1 391 98.67c1.4 1.68 2.72 3.46 3.95 5.27s2.39 3.72 3.44 5.64a68.29 68.29 0 0 1 8.29 32.55v264.52H233.55l-.44.76c-3.07 5.37-6.26 10.48-9.49 15.19L222 425h203V142.13a87.2 87.2 0 0 0-56.45-81.28z"})),Pe||(Pe=Ae.createElement("path",{stroke:"#000",strokeMiterlimit:10,strokeWidth:3.81,d:"M119.8 408.28v46c28.49-1.12 50.73-10.6 69.61-29.58 19.45-19.55 36.17-50 52.61-96L363.94 1.9H305l-98.25 272.89-48.86-153h-54l71.7 184.18a75.67 75.67 0 0 1 0 55.12c-7.3 18.68-20.25 40.66-55.79 47.19z"})));var Be=t(2514),$e=t.n(Be),Ue=t(8738),We=t.n(Ue),De=t(7656),He=t.n(De),ze=t(2485),Ge=t.n(ze);const Ve=({isOpen:e,onClose:s,id:t,upsellLink:r,title:o="",description:i="",benefits:n=[],note:a="",ctbId:l="",modalTitle:c})=>{const{isBlackFriday:u,isWooCommerceActive:p,isProductEntity:m,isWooSEOActive:h}=(0,be.useSelect)(e=>{const s=e("yoast-seo/editor");return{isProductEntity:s.getIsProductEntity(),isWooCommerceActive:s.getIsWooCommerceActive(),isBlackFriday:s.isPromotionActive("black-friday-promotion"),isWooSEOActive:s.getIsWooSeoActive()}},[]),g=(0,j.useMemo)(()=>p&&m,[p,m]),y=(0,j.useRef)(null);return(0,T.jsx)(X.Modal,{isOpen:e,onClose:s,id:t,initialFocus:y,children:(0,T.jsx)(X.Modal.Panel,{className:"yst-max-w-md yst-p-0",hasCloseButton:!1,children:(0,T.jsxs)(X.Modal.Container,{children:[(0,T.jsxs)(X.Modal.Container.Header,{className:"yst-p-6 yst-border-b-slate-200 yst-border-b yst-flex yst-justify-start yst-gap-3 yst-items-center",children:[g?(0,T.jsx)(He(),{className:"yst-text-woo-light yst-w-6 yst-h-6 yst-scale-x-[-1]"}):(0,T.jsx)(qe,{className:"yst-fill-primary-500 yst-w-5 yst-h-5"}),(0,T.jsx)(X.Modal.Title,{as:"h3",className:Ge()(g?"yst-text-woo-light":"yst-text-primary-500","yst-text-base yst-font-normal"),children:c}),(0,T.jsx)(X.Modal.CloseButton,{className:"yst-top-2",onClick:s,screenReaderText:(0,d.__)("Close modal","wordpress-seo")})]}),(0,T.jsxs)(X.Modal.Container.Content,{className:"yst-p-0",children:[u&&(0,T.jsx)("div",{className:"yst-flex yst-font-semibold yst-items-center yst-text-lg yst-content-between yst-bg-black yst-text-amber-300 yst-h-9 yst-border-amber-300 yst-border-y yst-border-x-0 yst-border-solid yst-px-6",children:(0,T.jsx)("div",{className:"yst-mx-auto",children:(0,d.__)("BLACK FRIDAY | 30% OFF","wordpress-seo")})}),(0,T.jsxs)("div",{className:"yst-py-6 yst-px-12",children:[(0,T.jsx)(X.Title,{as:"h3",className:"yst-mb-1 yst-leading-5 yst-text-sm yst-font-medium yst-text-slate-800",children:o}),(0,T.jsx)("p",{className:"yst-mb-2",children:i}),Array.isArray(n)&&n.length>0&&(0,T.jsx)("ul",{className:"yst-my-2",children:n.map((e,s)=>(0,T.jsxs)("li",{className:"yst-flex yst-gap-1 yst-mb-2",children:[(0,T.jsx)(We(),{className:"yst-mr-1 yst-text-green-500 yst-w-[19.5px] yst-h-[19.5px] yst-flex-shrink-0"}),(0,T.jsx)("p",{className:"yst-text-slate-600",children:e})]},`${t}-upsell-benefit-${s}`))}),"function"==typeof n&&n(),(0,T.jsxs)("div",{className:"yst-text-center",children:[(0,T.jsxs)(X.Button,{as:"a",variant:"upsell",className:"yst-my-2 yst-gap-1.5 yst-w-full",href:r,target:"_blank","data-action":"load-nfd-ctb","data-ctb-id":l,ref:y,children:[(0,T.jsx)($e(),{className:"yst-w-4 yst-h-4 yst--ms-1 yst-shrink-0"}),(0,d.sprintf)(/* translators: %s expands to 'Yoast SEO Premium' or 'Yoast Woocommerce SEO'. */ /* translators: %s expands to 'Yoast SEO Premium' or 'Yoast Woocommerce SEO'. */
(0,d.__)("Explore %s","wordpress-seo"),g&&!h?"Yoast WooCommerce SEO":"Yoast SEO Premium"),(0,T.jsx)("span",{className:"yst-sr-only",children:(0,d.__)("Opens in a new tab","wordpress-seo")})]}),(0,T.jsx)("div",{className:"yst-italic yst-text-slate-500 yst-mt-1",children:a})]})]})]})]})})})},Ke=({isOpen:e,closeModal:s,id:t,upsellLink:r})=>{const{locationContext:o}=(0,n.useRootContext)(),i=(0,Ne.addQueryArgs)(wpseoAdminL10n[r],{context:o}),a=[Te((0,d.sprintf)(/* translators: %1$s and %2$s are opening and closing span tags. */ /* translators: %1$s and %2$s are opening and closing span tags. */
(0,d.__)("%1$sKeyphrase distribution:%2$s See if your keywords are spread evenly so search engines understand your topic","wordpress-seo"),"",""),{span:(0,T.jsx)("span",{className:"yst-font-medium yst-text-slate-800"})}),Te((0,d.sprintf)(/* translators: %1$s and %2$s are opening and closing span tags. */ /* translators: %1$s and %2$s are opening and closing span tags. */
(0,d.__)("%1$sTitle check:%2$s Instantly spot missing titles and fix them for better click-through rates","wordpress-seo"),"",""),{span:(0,T.jsx)("span",{className:"yst-font-medium yst-text-slate-800"})}),Te((0,d.sprintf)(/* translators: %1$s and %2$s are opening and closing span tags. */ /* translators: %1$s and %2$s are opening and closing span tags. */
(0,d.__)("%1$sSynonyms:%2$s Include synonyms of your keyphrase for a more natural flow and smarter suggestions","wordpress-seo"),"",""),{span:(0,T.jsx)("span",{className:"yst-font-medium yst-text-slate-800"})})];return(0,T.jsx)(Ve,{isOpen:e,onClose:s,id:t,modalTitle:(0,d.__)("Get deeper SEO insights with Premium","wordpress-seo"),title:(0,d.__)("Find new ways to grow your rankings.","wordpress-seo"),description:(0,d.__)("Premium gives you advanced content checks that reveal new ranking opportunities and help you reach more readers.","wordpress-seo"),upsellLink:i,benefits:a,note:(0,d.__)("Upgrade to optimize with precision","wordpress-seo"),ctbId:"f6a84663-465f-4cb5-8ba5-f7a6d72224b2"})};Ke.propTypes={isOpen:E().bool.isRequired,closeModal:E().func.isRequired,id:E().string.isRequired,upsellLink:E().string.isRequired};class Ye extends j.Component{constructor(e){super(e);const s=this.props.results;this.state={mappedResults:{}},null!==s&&(this.state={mappedResults:Q(s,this.props.keywordKey)}),this.handleMarkButtonClick=this.handleMarkButtonClick.bind(this),this.handleEditButtonClick=this.handleEditButtonClick.bind(this),this.handleResultsChange=this.handleResultsChange.bind(this),this.renderHighlightingUpsell=this.renderHighlightingUpsell.bind(this),this.createMarkButton=this.createMarkButton.bind(this)}componentDidUpdate(e){null!==this.props.results&&this.props.results!==e.results&&this.setState({mappedResults:Q(this.props.results,this.props.keywordKey)})}createMarkButton({ariaLabel:e,id:s,className:t,status:r,onClick:o,isPressed:i}){return(0,T.jsxs)(j.Fragment,{children:[(0,T.jsx)(I.IconButtonToggle,{marksButtonStatus:r,className:t,onClick:o,id:s,icon:"eye",pressed:i,ariaLabel:e}),this.props.shouldUpsellHighlighting&&(0,T.jsx)("div",{className:"yst-root",children:(0,T.jsx)(X.Badge,{className:"yst-absolute yst-px-[3px] yst-py-[3px] yst--end-[6.5px] yst--top-[6.5px]",size:"small",variant:"upsell",children:(0,T.jsx)(Le(),{className:"yst-w-2.5 yst-h-2.5 yst-shrink-0",role:"img","aria-hidden":!0,focusable:!1})})})]})}deactivateMarker(){this.props.setActiveMarker(null),this.props.setMarkerPauseStatus(!1),this.removeMarkers()}activateMarker(e,s){this.props.setActiveMarker(e),s()}handleMarkButtonClick(e,s){const t=this.props.keywordKey.length>0?`${this.props.keywordKey}:${e}`:e;this.props.activeAIFixesButton&&this.props.setActiveAIFixesButton(null),t===this.props.activeMarker?this.deactivateMarker():this.activateMarker(t,s)}handleResultsChange(e,s,t){const r=this.props.keywordKey.length>0?`${this.props.keywordKey}:${e}`:e;r===this.props.activeMarker&&(t?(0,l.isUndefined)(s)||this.activateMarker(r,s):this.deactivateMarker())}focusOnKeyphraseField(e){const s=this.props.keywordKey,t=""===s?"focus-keyword-input-"+e:"yoast-keyword-input-"+s+"-"+e,r=document.getElementById(t);r.focus(),r.scrollIntoView({behavior:"auto",block:"center",inline:"center"})}focusOnGooglePreviewField(e,s){const t=document.getElementById("yoast-google-preview-"+e+"-"+s);t.focus(),t.scrollIntoView({behavior:"auto",block:"center",inline:"center"})}handleEditButtonClick(e,s){var t;null==s||null===(t=s.currentTarget)||void 0===t||t.blur();const r=this.props.location;"keyphrase"!==e?(["description","title","slug"].includes(e)&&this.handleGooglePreviewFocus(r,e),(0,p.doAction)("yoast.focus.input",e)):this.focusOnKeyphraseField(r)}handleGooglePreviewFocus(e,s){if("sidebar"===e)document.getElementById("yoast-search-appearance-modal-open-button").click(),setTimeout(()=>this.focusOnGooglePreviewField(s,"modal"),500);else{const t=document.getElementById("yoast-snippet-editor-metabox");t&&"false"===t.getAttribute("aria-expanded")?(t.click(),setTimeout(()=>this.focusOnGooglePreviewField(s,e),100)):this.focusOnGooglePreviewField(s,e)}}removeMarkers(){window.YoastSEO.analysis.applyMarks(new u.Paper("",{}),[])}renderHighlightingUpsell(e,s){const t=(0,d.__)("Highlight areas of improvement in your text, no more searching for a needle in a haystack, straight to optimizing! Now also in Elementor!","wordpress-seo");return(0,T.jsx)(Ke,{isOpen:e,closeModal:s,id:"yoast-premium-seo-analysis-highlighting-modal",upsellLink:this.props.highlightingUpsellLink,description:t})}render(){const{mappedResults:e}=this.state,{errorsResults:s,improvementsResults:t,goodResults:r,considerationsResults:o,problemsResults:i}=e,{upsellResults:n,resultCategoryLabels:a}=this.props,l={errors:(0,d.__)("Errors","wordpress-seo"),problems:(0,d.__)("Problems","wordpress-seo"),improvements:(0,d.__)("Improvements","wordpress-seo"),considerations:(0,d.__)("Considerations","wordpress-seo"),goodResults:(0,d.__)("Good results","wordpress-seo")},c=Object.assign(l,a);let u=this.props.marksButtonStatus;return"enabled"===u&&this.props.shortcodesForParsing.length>0&&(u="disabled"),(0,T.jsx)(j.Fragment,{children:(0,T.jsx)(Ee.ContentAnalysis,{errorsResults:s,problemsResults:i,upsellResults:n,improvementsResults:t,considerationsResults:o,goodResults:r,activeMarker:this.props.activeMarker,onMarkButtonClick:this.handleMarkButtonClick,onEditButtonClick:this.handleEditButtonClick,marksButtonClassName:this.props.marksButtonClassName,editButtonClassName:this.props.editButtonClassName,marksButtonStatus:u,headingLevel:3,keywordKey:this.props.keywordKey,id:this.props.id,isPremium:this.props.isPremium,resultCategoryLabels:c,onResultChange:this.handleResultsChange,shouldUpsellHighlighting:this.props.shouldUpsellHighlighting,renderAIOptimizeButton:this.props.renderAIOptimizeButton,renderHighlightingUpsell:this.renderHighlightingUpsell,markButtonFactory:this.createMarkButton})})}}Ye.propTypes={results:E().array,upsellResults:E().array,marksButtonClassName:E().string,editButtonClassName:E().string,marksButtonStatus:E().oneOf(["enabled","disabled","hidden"]),setActiveMarker:E().func.isRequired,setMarkerPauseStatus:E().func.isRequired,setActiveAIFixesButton:E().func.isRequired,activeMarker:E().string,activeAIFixesButton:E().string,keywordKey:E().string,location:E().string,id:E().string,isPremium:E().bool,resultCategoryLabels:E().shape({errors:E().string,problems:E().string,improvements:E().string,considerations:E().string,goodResults:E().string}),shortcodesForParsing:E().array,shouldUpsellHighlighting:E().bool,highlightingUpsellLink:E().string,renderAIOptimizeButton:E().func},Ye.defaultProps={results:null,upsellResults:[],marksButtonStatus:"enabled",marksButtonClassName:"",editButtonClassName:"",activeMarker:null,activeAIFixesButton:null,keywordKey:"",location:"",id:"",isPremium:!1,resultCategoryLabels:{},shortcodesForParsing:[],shouldUpsellHighlighting:!1,highlightingUpsellLink:"",renderAIOptimizeButton:()=>{}};const Ze=Ye,Qe=(0,ve.compose)([(0,be.withSelect)(e=>{const{getActiveMarker:s,getIsPremium:t,getShortcodesForParsing:r,getActiveAIFixesButton:o}=e("yoast-seo/editor");return{activeMarker:s(),isPremium:t(),shortcodesForParsing:r(),activeAIFixesButton:o()}}),(0,be.withDispatch)(e=>{const{setActiveMarker:s,setMarkerPauseStatus:t,setActiveAIFixesButton:r}=e("yoast-seo/editor");return{setActiveMarker:s,setMarkerPauseStatus:t,setActiveAIFixesButton:r}})])(Ze),Xe=window.yoast.relatedKeyphraseSuggestions;function Je({requestLimitReached:e,isSuccess:s,response:t,requestHasData:r,relatedKeyphrases:o}){return e?"requestLimitReached":!s&&function(e){return"invalid_json"===(null==e?void 0:e.code)||"fetch_error"===(null==e?void 0:e.code)||!(0,l.isEmpty)(e)&&"error"in e}(t)?"requestFailed":r?function(e){return e&&e.length>=4}(o)?"maxRelatedKeyphrases":null:"requestEmpty"}function es({keyphrase:e="",relatedKeyphrases:s=[],renderAction:t=null,requestLimitReached:r=!1,countryCode:o,setCountry:i,newRequest:n,response:a={},isRtl:l=!1,userLocale:c="en_US",isPending:d=!1,isSuccess:u=!1,requestHasData:p=!0,isPremium:m=!1,semrushUpsellLink:h="",premiumUpsellLink:g=""}){var y,x;const[f,w]=(0,j.useState)(o),v=(0,j.useCallback)(async()=>{n(o,e),w(o)},[o,e,n]);return(0,T.jsxs)(X.Root,{context:{isRtl:l},children:[!r&&!m&&(0,T.jsx)(Xe.PremiumUpsell,{url:g,className:"yst-mb-4"}),!r&&(0,T.jsx)(Xe.CountrySelector,{countryCode:o,activeCountryCode:f,onChange:i,onClick:v,className:"yst-mb-4",userLocale:c.split("_")[0]}),!d&&(0,T.jsx)(Xe.UserMessage,{variant:Je({requestLimitReached:r,isSuccess:u,response:a,requestHasData:p,relatedKeyphrases:s}),upsellLink:h}),(0,T.jsx)(Xe.KeyphrasesTable,{relatedKeyphrases:s,columnNames:null==a||null===(y=a.results)||void 0===y?void 0:y.columnNames,data:null==a||null===(x=a.results)||void 0===x?void 0:x.rows,isPending:d,renderButton:t,className:"yst-mt-4"})]})}es.propTypes={keyphrase:E().string,relatedKeyphrases:E().array,renderAction:E().func,requestLimitReached:E().bool,countryCode:E().string.isRequired,setCountry:E().func.isRequired,newRequest:E().func.isRequired,response:E().object,isRtl:E().bool,userLocale:E().string,isPending:E().bool,isSuccess:E().bool,requestHasData:E().bool,isPremium:E().bool,semrushUpsellLink:E().string,premiumUpsellLink:E().string};const ss=(0,ve.compose)([(0,be.withSelect)(e=>{const{getFocusKeyphrase:s,getSEMrushSelectedCountry:t,getSEMrushRequestLimitReached:r,getSEMrushRequestResponse:o,getSEMrushRequestIsSuccess:i,getSEMrushIsRequestPending:n,getSEMrushRequestHasData:a,getPreference:l,getIsPremium:c,selectLinkParams:d}=e("yoast-seo/editor");return{keyphrase:s(),countryCode:t(),requestLimitReached:r(),response:o(),isSuccess:i(),isPending:n(),requestHasData:a(),isRtl:l("isRtl",!1),userLocale:l("userLocale","en_US"),isPremium:c(),semrushUpsellLink:(0,Ne.addQueryArgs)("https://yoa.st/semrush-prices",d()),premiumUpsellLink:(0,Ne.addQueryArgs)("https://yoa.st/413",d())}}),(0,be.withDispatch)(e=>{const{setSEMrushChangeCountry:s,setSEMrushNewRequest:t}=e("yoast-seo/editor");return{setCountry:e=>{s(e)},newRequest:(e,s)=>{t(e,s)}}})])(es);function ts(e,s,t,r){return new Promise((o,i)=>{jQuery.ajax({type:e,url:s,beforeSend:t?e=>{e.setRequestHeader("X-WP-Nonce",t)}:null,data:r,dataType:"json",success:o,error:i})})}const rs=window.wp.sanitize,os="SNIPPET_EDITOR_UPDATE_REPLACEMENT_VARIABLE",is="SNIPPET_EDITOR_UPDATE_REPLACEMENT_VARIABLES_BATCH";function ns(e,s,t="",r=!1){const o="string"==typeof s?(0,L.decodeHTML)(s):s;return{type:os,name:e,value:o,label:t,hidden:r}}function as(e){return e.charAt(0).toUpperCase()+e.slice(1)}const{stripHTMLTags:ls}=L.strings,cs=["slug","content","contentImage","snippetPreviewImageURL"];function ds(e,s){(0,l.forEach)(e,(e,t)=>{cs.includes(t)||s.dispatch(ns(t,e))})}function us(e){if(!["ct_","cf_","pt_"].includes(e.substring(0,3)))return e.replace(/_/g," ");const s=e.slice(0,3);switch(-1!==(e=e.slice(3)).indexOf("desc_")&&(e=e.slice(5)+" description"),s){case"ct_":e+=" (custom taxonomy)";break;case"cf_":e+=" (custom field)";break;case"pt_":e="Post type ("+(e=e.replace("single","singular"))+")"}return e}function ps(e){return as(e=us(e))}function ms(e,s){return e.push({name:s.name,label:s.label||ps(s.name),value:s.value}),e}function hs(e,s="_"){return e.replace(/\s/g,s)}function gs(e){return{name:"cf_"+hs(e),label:as(e+" (custom field)")}}function ys(e){const s=hs(e);return{name:"ct_"+s,label:as(e+" (custom taxonomy)"),descriptionName:"ct_desc_"+s,descriptionLabel:as(e+" description (custom taxonomy)")}}function xs(e,s){if(!e.custom_taxonomies)return e;const t={};return(0,l.forEach)(e.custom_taxonomies,(e,s)=>{const{name:r,label:o,descriptionName:i,descriptionLabel:n}=ys(s),a="string"==typeof e.name?(0,L.decodeHTML)(e.name):e.name,l="string"==typeof e.description?(0,L.decodeHTML)(e.description):e.description;t[r]={value:a,label:o},t[i]={value:l,label:n}}),s.dispatch(function(e){return{type:is,updatedVariables:e}}(t)),(0,l.omit)({...e},"custom_taxonomies")}function fs(e,s){return e.custom_fields?((0,l.forEach)(e.custom_fields,(e,t)=>{const{name:r,label:o}=gs(t);s.dispatch(ns(r,e,o))}),(0,l.omit)({...e},"custom_fields")):e}function ws(e,s=156){return(e=(e=(0,rs.stripTags)(e)).trim()).length<=s||(e=e.substring(0,s),/\s/.test(e)&&(e=e.substring(0,e.lastIndexOf(" ")))),e}const vs=function(e){const s=(0,l.get)(window,["YoastSEO","app","pluggable"],!1);if(!s||!(0,l.get)(window,["YoastSEO","app","pluggable","loaded"],!1))return function(e){const s=(0,l.get)(window,["YoastSEO","wp","replaceVarsPlugin","replaceVariables"],l.identity);return{url:e.url,title:ls(s(e.title)),description:ls(s(e.description)),filteredSEOTitle:e.filteredSEOTitle?ls(s(e.filteredSEOTitle)):""}}(e);const t=s._applyModifications.bind(s);return{url:e.url,title:ls(t("data_page_title",e.title)),description:ls(t("data_meta_desc",e.description)),filteredSEOTitle:e.filteredSEOTitle?ls(t("data_page_title",e.filteredSEOTitle)):""}};var bs="score-text",ks="image yoast-logo svg",Ss=jQuery;function js(e,s,t=null){var r,o,i,n,a;if(null!==t)return(0,l.get)(t,s,"");const c=(0,be.select)("yoast-seo/editor").getIsPremium(),u={na:(0,d.__)("Not available","wordpress-seo"),bad:(0,d.__)("Needs improvement","wordpress-seo"),ok:(0,d.__)("OK","wordpress-seo"),good:(0,d.__)("Good","wordpress-seo")},p={keyword:{label:c?(0,d.__)("Premium SEO analysis:","wordpress-seo"):(0,d.__)("SEO analysis:","wordpress-seo"),anchor:"yoast-seo-analysis-collapsible-metabox",status:u},content:{label:(0,d.__)("Readability analysis:","wordpress-seo"),anchor:"yoast-readability-analysis-collapsible-metabox",status:u},"inclusive-language":{label:(0,d.__)("Inclusive language:","wordpress-seo"),anchor:"yoast-inclusive-language-analysis-collapsible-metabox",status:{...u,ok:(0,d.__)("Potentially non-inclusive","wordpress-seo")}}};return null!=p&&null!==(r=p[e])&&void 0!==r&&null!==(o=r.status)&&void 0!==o&&o[s]?`${null===(n=p[e])||void 0===n?void 0:n.label} ${null===(a=p[e])||void 0===a?void 0:a.status[s]}`:""}var _s=t(6702),Cs=t.n(_s);E().string.isRequired;var Rs=t(818),Es=t.n(Rs);E().string.isRequired,E().string.isRequired,E().shape({src:E().string.isRequired,width:E().string,height:E().string}).isRequired,E().shape({value:E().bool.isRequired,status:E().string.isRequired,set:E().func.isRequired}).isRequired,E().string,E().string,E().string;const Is=({handleRefreshClick:e,supportLink:s})=>(0,T.jsxs)("div",{className:"yst-flex yst-gap-2",children:[(0,T.jsx)(X.Button,{onClick:e,children:(0,d.__)("Refresh this page","wordpress-seo")}),(0,T.jsx)(X.Button,{variant:"secondary",as:"a",href:s,target:"_blank",rel:"noopener",children:(0,d.__)("Contact support","wordpress-seo")})]});Is.propTypes={handleRefreshClick:E().func.isRequired,supportLink:E().string.isRequired};const Ls=({handleRefreshClick:e,supportLink:s})=>(0,T.jsxs)("div",{className:"yst-grid yst-grid-cols-1 yst-gap-y-2",children:[(0,T.jsx)(X.Button,{className:"yst-order-last",onClick:e,children:(0,d.__)("Refresh this page","wordpress-seo")}),(0,T.jsx)(X.Button,{variant:"secondary",as:"a",href:s,target:"_blank",rel:"noopener",children:(0,d.__)("Contact support","wordpress-seo")})]});Ls.propTypes={handleRefreshClick:E().func.isRequired,supportLink:E().string.isRequired};const Ns=({error:e,children:s=null})=>(0,T.jsxs)("div",{role:"alert",className:"yst-max-w-screen-sm yst-p-8 yst-space-y-4",children:[(0,T.jsx)(X.Title,{children:(0,d.__)("Something went wrong. An unexpected error occurred.","wordpress-seo")}),(0,T.jsx)("p",{children:(0,d.__)("We're very sorry, but it seems like the following error has interrupted our application:","wordpress-seo")}),(0,T.jsx)(X.Alert,{variant:"error",children:(null==e?void 0:e.message)||(0,d.__)("Undefined error message.","wordpress-seo")}),(0,T.jsx)("p",{children:(0,d.__)("Unfortunately, this means that any unsaved changes in this section will be lost. You can try and refresh this page to resolve the problem. If this error still occurs, please get in touch with our support team, and we'll get you all the help you need!","wordpress-seo")}),s]});Ns.propTypes={error:E().object.isRequired,children:E().node},Ns.VerticalButtons=Ls,Ns.HorizontalButtons=Is;const Ts={variant:{lg:{grid:"yst-grid lg:yst-grid-cols-3 lg:yst-gap-12",col1:"yst-col-span-1",col2:"lg:yst-mt-0 lg:yst-col-span-2"},xl:{grid:"yst-grid xl:yst-grid-cols-3 xl:yst-gap-12",col1:"yst-col-span-1",col2:"xl:yst-mt-0 xl:yst-col-span-2"},"2xl":{grid:"yst-grid 2xl:yst-grid-cols-3 2xl:yst-gap-12",col1:"yst-col-span-1",col2:"2xl:yst-mt-0 2xl:yst-col-span-2"}}},Ms=({id:e,children:s,title:t,description:r=null,variant:o="2xl"})=>(0,T.jsxs)("section",{id:e,className:Ts.variant[o].grid,children:[(0,T.jsx)("div",{className:Ts.variant[o].col1,children:(0,T.jsxs)("div",{className:"yst-max-w-screen-sm",children:[(0,T.jsx)(X.Title,{as:"h2",size:"4",children:t}),r&&(0,T.jsx)("p",{className:"yst-mt-2",children:r})]})}),(0,T.jsxs)("fieldset",{className:`yst-min-w-0 yst-mt-8 ${Ts.variant[o].col2}`,children:[(0,T.jsx)("legend",{className:"yst-sr-only",children:t}),(0,T.jsx)("div",{className:"yst-space-y-8",children:s})]})]});Ms.propTypes={id:E().string,children:E().node.isRequired,title:E().node.isRequired,description:E().node,variant:E().oneOf(Object.keys(Ts.variant))};const Ps=window.ReactDOM;var As,Os,Fs;(Os=As||(As={})).Pop="POP",Os.Push="PUSH",Os.Replace="REPLACE",function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Fs||(Fs={})),new Set(["lazy","caseSensitive","path","id","index","children"]),Error;const qs=["post","put","patch","delete"],Bs=(new Set(qs),["get",...qs]);new Set(Bs),new Set([301,302,303,307,308]),new Set([307,308]),Symbol("deferred"),Ae.Component,Ae.startTransition,new Promise(()=>{}),Ae.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);try{window.__reactRouterVersion="6"}catch(e){}var $s,Us,Ws,Ds;new Map,Ae.startTransition,Ps.flushSync,Ae.useId,"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement,(Ds=$s||($s={})).UseScrollRestoration="useScrollRestoration",Ds.UseSubmit="useSubmit",Ds.UseSubmitFetcher="useSubmitFetcher",Ds.UseFetcher="useFetcher",Ds.useViewTransitionState="useViewTransitionState",(Ws=Us||(Us={})).UseFetcher="useFetcher",Ws.UseFetchers="useFetchers",Ws.UseScrollRestoration="useScrollRestoration",E().string.isRequired,E().string;const Hs=({href:e,children:s=null,...t})=>(0,T.jsxs)(X.Link,{target:"_blank",rel:"noopener noreferrer",...t,href:e,children:[s,(0,T.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
(0,d.__)("(Opens in a new browser tab)","wordpress-seo")})]});Hs.propTypes={href:E().string.isRequired,children:E().node};(0,d.__)("Create optimized SEO titles & meta descriptions in seconds","wordpress-seo"),(0,d.__)("Apply AI suggestions to improve content in 1 click","wordpress-seo"),(0,d.__)("Manage redirects with ease and without extra plugins","wordpress-seo"),(0,d.__)("Optimize pages for multiple keywords with guidance","wordpress-seo"),(0,d.__)("Add product details to help your listings stand out","wordpress-seo"),(0,d.__)("Make sure search engines show the right version of your product page","wordpress-seo"),(0,d.__)("Create optimized SEO titles & meta descriptions with AI","wordpress-seo"),(0,d.__)("Receive clear SEO and readability guidance to optimize your products","wordpress-seo"),(0,d.__)("Generate SEO optimized metadata in seconds with AI","wordpress-seo"),(0,d.__)("Make your articles visible, be seen in Google News","wordpress-seo"),(0,d.__)("Built to get found by search, AI, and real users","wordpress-seo"),(0,d.__)("Easy Local SEO. Show up in Google Maps results","wordpress-seo"),(0,d.__)("Internal links and redirect management, easy","wordpress-seo"),(0,d.__)("Access to friendly help when you need it, day or night","wordpress-seo");E().string.isRequired,E().object.isRequired,E().func.isRequired,E().bool.isRequired,t(3473),E().string.isRequired,E().object,E().func.isRequired,E().bool.isRequired,E().string.isRequired,E().object.isRequired,E().string.isRequired,E().func.isRequired,E().bool.isRequired;var zs=t(5074),Gs=t.n(zs);const Vs=({isOpen:e,onClose:s=l.noop,onDiscard:t=l.noop,title:r,description:o,dismissLabel:i,discardLabel:n})=>{const a=(0,X.useSvgAria)();return(0,T.jsx)(X.Modal,{isOpen:e,onClose:s,children:(0,T.jsxs)(X.Modal.Panel,{closeButtonScreenReaderText:(0,d.__)("Close","wordpress-seo"),children:[(0,T.jsxs)("div",{className:"sm:yst-flex sm:yst-items-start",children:[(0,T.jsx)("div",{className:"yst-mx-auto yst-flex-shrink-0 yst-flex yst-items-center yst-justify-center yst-h-12 yst-w-12 yst-rounded-full yst-bg-red-100 sm:yst-mx-0 sm:yst-h-10 sm:yst-w-10",children:(0,T.jsx)(Gs(),{className:"yst-h-6 yst-w-6 yst-text-red-600",...a})}),(0,T.jsxs)("div",{className:"yst-mt-3 yst-text-center sm:yst-mt-0 sm:yst-ms-4 sm:yst-text-start",children:[(0,T.jsx)(X.Modal.Title,{className:"yst-text-lg yst-leading-6 yst-font-medium yst-text-slate-900 yst-mb-3",children:r}),(0,T.jsx)(X.Modal.Description,{className:"yst-text-sm yst-text-slate-500",children:o})]})]}),(0,T.jsxs)("div",{className:"yst-flex yst-flex-col sm:yst-flex-row-reverse yst-gap-3 yst-mt-6",children:[(0,T.jsx)(X.Button,{type:"button",variant:"error",onClick:t,className:"yst-block",children:n}),(0,T.jsx)(X.Button,{type:"button",variant:"secondary",onClick:s,className:"yst-block",children:i})]})]})})};Vs.propTypes={isOpen:E().bool.isRequired,onClose:E().func,onDiscard:E().func,title:E().string.isRequired,description:E().string.isRequired,dismissLabel:E().string.isRequired,discardLabel:E().string.isRequired};const Ks=window.yoast.reactHelmet,Ys="error",Zs="loading",Qs="error",Xs="showPlay",Js="askPermission",et="isPlaying",st=({videoId:e,thumbnail:s,wistiaEmbedPermission:t,className:r=""})=>{const[o,i]=(0,j.useState)(t.value?et:Xs),n=(0,j.useCallback)(()=>i(et),[i]),a=(0,j.useCallback)(()=>{t.value?n():i(Js)},[t.value,n,i]),l=(0,j.useCallback)(()=>i(Xs),[i]),c=(0,j.useCallback)(()=>{t.set(!0),n()},[t.set,n]);return(0,T.jsxs)(T.Fragment,{children:[t.value&&(0,T.jsx)(Ks.Helmet,{children:(0,T.jsx)("script",{src:"https://fast.wistia.com/assets/external/E-v1.js",async:!0})}),(0,T.jsxs)("div",{className:Ge()("yst-relative yst-w-full yst-h-0 yst-pt-[47.25%] yst-overflow-hidden yst-rounded-md yst-drop-shadow-md yst-bg-white",r),children:[o===Xs&&(0,T.jsx)("button",{type:"button",className:"yst-absolute yst-inset-0 yst-button yst-p-0 yst-border-none yst-bg-white yst-transition-opacity yst-duration-1000 yst-opacity-100",onClick:a,children:(0,T.jsx)("img",{className:"yst-w-full yst-h-auto yst-object-contain",alt:"",loading:"lazy",decoding:"async",...s})}),o===Js&&(0,T.jsxs)("div",{className:"yst-absolute yst-inset-0 yst-flex yst-flex-col yst-items-center yst-justify-center yst-bg-white",children:[(0,T.jsxs)("p",{className:"yst-max-w-xs yst-mx-auto yst-text-center",children:[t.status===Zs&&(0,T.jsx)(X.Spinner,{}),t.status!==Zs&&(0,d.sprintf)(/* translators: %1$s expands to Yoast SEO. %2$s expands to Wistia. */ /* translators: %1$s expands to Yoast SEO. %2$s expands to Wistia. */
(0,d.__)("To see this video, you need to allow %1$s to load embedded videos from %2$s.","wordpress-seo"),"Yoast SEO","Wistia")]}),(0,T.jsxs)("div",{className:"yst-flex yst-mt-6 yst-gap-x-4",children:[(0,T.jsx)(X.Button,{type:"button",variant:"secondary",onClick:l,disabled:t.status===Zs,children:(0,d.__)("Deny","wordpress-seo")}),(0,T.jsx)(X.Button,{type:"button",variant:"primary",onClick:c,disabled:t.status===Zs,children:(0,d.__)("Allow","wordpress-seo")})]})]}),t.value&&o===et&&(0,T.jsxs)("div",{className:"yst-absolute yst-w-full yst-h-full yst-top-0 yst-right-0",children:[null===e&&(0,T.jsx)(X.Spinner,{className:"yst-h-full yst-mx-auto"}),null!==e&&(0,T.jsx)("div",{className:`wistia_embed wistia_async_${e} videoFoam=true`})]})]})]})};var tt,rt;function ot(){return ot=Object.assign?Object.assign.bind():function(e){for(var s=1;s`%%${e}%%`),yt={idle:"idle",loading:"loading",success:"success",error:"error"},xt="success",ft="error",wt="abort",vt=({children:e})=>(0,T.jsx)("p",{className:"yst-mt-2",children:e});vt.propTypes={children:E().node.isRequired};const bt=()=>(0,be.useSelect)(e=>{const s=e(nt);return{commonErrorsLink:s.selectLink("https://yoa.st/ai-common-errors"),supportLink:s.selectAdminLink("?page=wpseo_page_support")}},[]),kt=(0,d.__)("Something went wrong","wordpress-seo"),St=({linkStoreName:e=nt})=>{const s=(0,be.useSelect)(s=>s(e).selectLink("https://yoa.st/ai-common-errors"),[e]),t=(0,be.useSelect)(s=>s(e).selectAdminLink("?page=wpseo_page_support"),[e]);return(0,T.jsx)(vt,{children:Te((0,d.sprintf)(/* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ /* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */
(0,d.__)("Please try again later. If this issue persists, you can learn more about possible reasons for this error on our page about %1$scommon AI feature problems and errors%2$s. In case you need further help, please %3$scontact our support team%4$s.","wordpress-seo"),"","","",""),{a1:(0,T.jsx)(Hs,{variant:"error",href:s}),a2:(0,T.jsx)(Hs,{variant:"error",href:t})})})};St.propTypes={linkStoreName:E().string};const jt=({linkStoreName:e=nt,className:s=""})=>(0,T.jsxs)(X.Alert,{variant:"error",className:s,children:[(0,T.jsx)("span",{className:"yst-block yst-font-medium",children:kt}),(0,T.jsx)(St,{linkStoreName:e})]});jt.propTypes={linkStoreName:E().string,className:E().string};const _t=(0,d.__)("Not enough content","wordpress-seo"),Ct=()=>{const{commonErrorsLink:e,supportLink:s}=bt();return(0,T.jsx)(vt,{children:Te((0,d.sprintf)(/* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ /* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */
(0,d.__)("Please add more content to ensure a valuable AI suggestion. Learn more on our page about %1$scommon AI feature problems and errors%2$s. In case you need further help, please %3$scontact our support team%4$s.","wordpress-seo"),"","","",""),{a1:(0,T.jsx)(Hs,{variant:"error",href:e}),a2:(0,T.jsx)(Hs,{variant:"error",href:s})})})},Rt=()=>(0,T.jsxs)(X.Alert,{variant:"error",children:[(0,T.jsx)("span",{className:"yst-block yst-font-medium",children:_t}),(0,T.jsx)(Ct,{})]}),Et=(0,d.__)("SEO analysis required","wordpress-seo"),It=()=>{const e=(0,be.useSelect)(e=>e(nt).selectAdminLink("?page=wpseo_page_settings#/site-features#card-wpseo-keyword_analysis_active"),[]);return(0,T.jsx)(vt,{children:Te((0,d.sprintf)(
/**
* translators:
* %1$s expands to Yoast SEO.
* %2$s and %3$s expand to an opening and closing anchor tag, respectively, that links to the settings page.
* %4$s expands to Yoast AI.
*/
/**
* translators:
* %1$s expands to Yoast SEO.
* %2$s and %3$s expand to an opening and closing anchor tag, respectively, that links to the settings page.
* %4$s expands to Yoast AI.
*/
(0,d.__)("%4$s requires the SEO analysis to be enabled. To enable it, please navigate to %2$sSite features%3$s in %1$s, turn on the SEO analysis, and click 'Save changes'. If it's disabled in your WordPress user profile, access your profile and enable it there. Please contact your administrator if you don't have access to these settings.","wordpress-seo"),"Yoast SEO","","","Yoast AI"),{a:(0,T.jsx)(Hs,{variant:"error",href:e})})})},Lt=()=>{const e=(0,j.useCallback)(()=>{window.location.reload()},[]),{onClose:s}=(0,X.useModalContext)();return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(X.Alert,{variant:"error",children:[(0,T.jsx)("span",{className:"yst-block yst-font-medium",children:Et}),(0,T.jsx)(It,{})]}),(0,T.jsxs)("div",{className:"yst-mt-6 yst-mb-1 yst-flex yst-space-x-3 rtl:yst-space-x-reverse yst-place-content-end",children:[(0,T.jsx)(X.Button,{variant:"secondary",onClick:s,children:(0,d.__)("Close","wordpress-seo")}),(0,T.jsx)(X.Button,{className:"yst-revoke-button",variant:"primary",onClick:e,children:(0,d.__)("Refresh page","wordpress-seo")})]})]})},Nt=(0,d.__)("You've reached the Yoast AI rate limit","wordpress-seo"),Tt=()=>{const e=(0,be.useSelect)(e=>e(nt).selectLink("https://yoa.st/ai-generator-rate-limit-help"),[]);return(0,T.jsx)(vt,{children:Te((0,d.sprintf)(/* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */ /* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */
(0,d.__)("You might have reached your Yoast AI rate limit for a specific time frame or your sparks limit for this month. If you have reached your rate limit, please reduce the frequency of your requests to continue using Yoast AI features. Our %1$shelp article%2$s provides guidance on effectively planning and pacing your requests for an optimized workflow.","wordpress-seo"),"",""),{a:(0,T.jsx)(Hs,{variant:"error",href:e})})})},Mt=()=>(0,T.jsxs)(X.Alert,{variant:"error",children:[(0,T.jsx)("span",{className:"yst-block yst-font-medium",children:Nt}),(0,T.jsx)(Tt,{})]}),Pt=window.wp.apiFetch;var At=t.n(Pt);const Ot=(0,d.__)("Subscription required","wordpress-seo"),Ft=({invalidSubscriptions:e=[]})=>{const{newYoastWooLink:s,activateYoastWooLink:t,newPremiumLink:r,activatePremiumLink:o}=(0,be.useSelect)(e=>{const s=e(nt);return{newYoastWooLink:s.selectLink("https://yoa.st/ai-generator-new-yoast-woocommerce"),activateYoastWooLink:s.selectLink("https://yoa.st/ai-generator-activate-yoast-woocommerce"),newPremiumLink:s.selectLink("https://yoa.st/ai-generator-new-premium"),activatePremiumLink:s.selectLink("https://yoa.st/ai-generator-activate-premium")}},[]);let i,n,a;return e.includes("Yoast WooCommerce SEO")?(i="Yoast WooCommerce SEO",n=t,a=s):e.includes("Yoast SEO Premium")&&(i="Yoast SEO Premium",n=o,a=r),i?(0,T.jsx)(vt,{children:Te((0,d.sprintf)(
/**
* translators:
* %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO.
* %2$s expands to MyYoast.
* %3$s and %4$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
* %5$s and %6$s expand to an opening and closing anchor tag, respectively, to get a new subscription.
**/
/**
* translators:
* %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO.
* %2$s expands to MyYoast.
* %3$s and %4$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
* %5$s and %6$s expand to an opening and closing anchor tag, respectively, to get a new subscription.
**/
(0,d.__)("To access this feature, you need an active %1$s subscription. Please %3$sactivate your subscription in %2$s%4$s or %5$sget a new %1$s subscription%6$s. Afterward, refresh this page. It may take up to 30 seconds for the feature to function correctly.","wordpress-seo"),i,"MyYoast","","","",""),{Activate:(0,T.jsx)(Hs,{variant:"error",href:n}),New:(0,T.jsx)(Hs,{variant:"error",href:a})})}):(0,T.jsx)(vt,{children:Te((0,d.sprintf)(
/**
* translators:
* %1$s expands to MyYoast.
* %2$s and %3$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
**/
/**
* translators:
* %1$s expands to MyYoast.
* %2$s and %3$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
**/
(0,d.__)("To access this feature, you need an active subscription. Please %2$sactivate your subscription in %1$s%3$s. Afterward, refresh this page. It may take up to 30 seconds for the feature to function correctly.","wordpress-seo"),"MyYoast","",""),{Activate:(0,T.jsx)(Hs,{variant:"error",href:o})})})};Ft.propTypes={invalidSubscriptions:E().arrayOf(E().string)};const qt=({invalidSubscriptions:e=[]})=>{const s=(0,be.useSelect)(e=>e(it).selectBustSubscriptionCacheEndpoint(),[]),{onClose:t}=(0,X.useModalContext)(),r=(0,j.useCallback)(async()=>{try{await At()({path:s,method:"POST",parse:!1})}catch(e){console.error(e)}window.location.reload()},[]);return(0,T.jsxs)(j.Fragment,{children:[(0,T.jsxs)(X.Alert,{variant:"error",children:[(0,T.jsx)("span",{className:"yst-block yst-font-medium",children:Ot}),(0,T.jsx)(Ft,{invalidSubscriptions:e})]}),(0,T.jsxs)("div",{className:"yst-mt-6 yst-mb-1 yst-flex yst-space-x-3 rtl:yst-space-x-reverse yst-place-content-end",children:[(0,T.jsx)(X.Button,{variant:"secondary",onClick:t,children:(0,d.__)("Close","wordpress-seo")}),(0,T.jsx)(X.Button,{variant:"primary",onClick:r,children:(0,d.__)("Refresh page","wordpress-seo")})]})]})};qt.propTypes={invalidSubscriptions:E().arrayOf(E().string)};const Bt=(0,d.__)("Connection timeout","wordpress-seo"),$t=()=>{const{commonErrorsLink:e,supportLink:s}=bt();return(0,T.jsx)(vt,{children:Te((0,d.sprintf)(/* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ /* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */
(0,d.__)("It seems that a connection timeout has occurred. Please check your internet connection and try again later. Learn more on our page about %1$scommon AI feature problems and errors%2$s. In case you need further help, please %3$scontact our support team%4$s.","wordpress-seo"),"","","",""),{a1:(0,T.jsx)(Hs,{variant:"error",href:e}),a2:(0,T.jsx)(Hs,{variant:"error",href:s})})})},Ut=()=>(0,T.jsxs)(X.Alert,{variant:"error",children:[(0,T.jsx)("span",{className:"yst-block yst-font-medium",children:Bt}),(0,T.jsx)($t,{})]}),Wt=(0,d.__)("Usage policy violation","wordpress-seo"),Dt=()=>{const e=(0,be.useSelect)(e=>e(nt).selectAdminLink("?page=wpseo_page_support"),[]);return(0,T.jsx)(vt,{children:Te((0,d.sprintf)(/* translators: %1$s, %2$s, %3$s, %4$s are anchor tags. %5$s expands to OpenAI. */ /* translators: %1$s, %2$s, %3$s, %4$s are anchor tags. %5$s expands to OpenAI. */
(0,d.__)("Due to %5$s's strict ethical guidelines and %1$susage policies%2$s, we cannot generate suggestions for the content on this page. If you intend to use AI, kindly avoid the use of explicit, violent, copyrighted, or sexually explicit content. In case you need further help, please %3$scontact our support team%4$s.","wordpress-seo"),"","","","","OpenAI"),{a1:(0,T.jsx)(Hs,{variant:"error",href:"https://openai.com/policies/usage-policies"}),a2:(0,T.jsx)(Hs,{variant:"error",href:e})})})},Ht=()=>(0,T.jsxs)(X.Alert,{variant:"error",children:[(0,T.jsx)("span",{className:"yst-block yst-font-medium",children:Wt}),(0,T.jsx)(Dt,{})]}),zt=(0,d.__)("Something went wrong","wordpress-seo"),Gt=({errorMessage:e=""})=>{const s=(0,be.useSelect)(e=>e(nt).selectAdminLink("?page=wpseo_page_support"),[]);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(vt,{children:(0,d.sprintf)(/* translators: %s is the error response of the request. */ /* translators: %s is the error response of the request. */
(0,d.__)("The request came back with the following error: '%s'.","wordpress-seo"),e)}),(0,T.jsx)(vt,{children:Te((0,d.sprintf)(/* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */ /* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */
(0,d.__)("Please try again later. If the issue persists, please %1$scontact our support team%2$s.","wordpress-seo"),"",""),{a:(0,T.jsx)(Hs,{variant:"error",href:s})})})]})};Gt.propTypes={errorMessage:E().string};const Vt=({errorMessage:e=""})=>(0,T.jsxs)(X.Alert,{variant:"error",children:[(0,T.jsx)("span",{className:"yst-block yst-font-medium",children:zt}),(0,T.jsx)(Gt,{errorMessage:e})]});Vt.propTypes={errorMessage:E().string};const Kt=(0,d.__)("Something went wrong","wordpress-seo"),Yt=()=>{const e=(0,be.useSelect)(e=>e(nt).selectAdminLink("plugins.php"),[]);return(0,T.jsx)(vt,{children:Te((0,d.sprintf)(/* translators: %1$s expands to Yoast SEO Premium. %2$s expands to an opening link tag. %3$s expands to a closing link tag. */ /* translators: %1$s expands to Yoast SEO Premium. %2$s expands to an opening link tag. %3$s expands to a closing link tag. */
(0,d.__)("The version of %1$s is outdated. Please upgrade %1$s %2$shere%3$s!","wordpress-seo"),"Yoast SEO Premium","",""),{a:(0,T.jsx)(Hs,{variant:"error",href:e})})})},Zt=()=>(0,T.jsxs)(X.Alert,{variant:"error",children:[(0,T.jsx)("span",{className:"yst-block yst-font-medium",children:Kt}),(0,T.jsx)(Yt,{})]}),Qt=({children:e})=>(0,T.jsx)(X.Modal.Description,{as:"div",className:"yst-mt-2 yst-text-sm yst-text-slate-500",children:e}),Xt=({children:e})=>(0,T.jsx)("div",{className:"yst-mt-6 yst-flex yst-flex-row yst-justify-end yst-gap-3",children:e}),Jt=({onClose:e,...s})=>(0,T.jsx)(X.Button,{variant:"secondary",onClick:e,...s,children:(0,d.__)("Close","wordpress-seo")}),er=({isOpen:e,title:s,onClose:t=l.noop,children:r})=>{const o=(0,X.useSvgAria)();return(0,T.jsx)(X.Modal,{isOpen:e,onClose:t,children:(0,T.jsx)(X.Modal.Panel,{className:"yst-max-w-lg",closeButtonScreenReaderText:(0,d.__)("Dismiss","wordpress-seo"),children:(0,T.jsxs)("div",{className:"yst-flex yst-items-start yst-gap-4",children:[(0,T.jsx)("div",{className:"yst-flex-shrink-0 yst-flex yst-items-center yst-justify-center yst-h-10 yst-w-10 yst-rounded-full yst-bg-red-100",children:(0,T.jsx)(Gs(),{className:"yst-h-6 yst-w-6 yst-text-red-600",...o})}),(0,T.jsxs)("div",{className:"yst-text-start yst-flex-1 yst-min-w-0",children:[(0,T.jsx)(X.Modal.Title,{className:"yst-text-lg yst-leading-6 yst-font-medium yst-text-slate-900",children:s}),r]})]})})})},sr=({showActions:e=!1,onRetry:s,onClose:t})=>(0,T.jsxs)(Xt,{children:[(0,T.jsx)(Jt,{onClose:t}),e&&(0,T.jsx)(X.Button,{variant:"primary",onClick:s,children:(0,d.__)("Try again","wordpress-seo")})]});sr.propTypes={showActions:E().bool,onRetry:E().func.isRequired,onClose:E().func.isRequired};const tr=({isOpen:e=!0,showActions:s=!1,onRetry:t=l.noop,onClose:r=l.noop})=>(0,T.jsxs)(er,{isOpen:e,title:kt,onClose:r,children:[(0,T.jsx)(Qt,{children:(0,T.jsx)(St,{})}),(0,T.jsx)(sr,{showActions:s,onRetry:t,onClose:r})]});tr.propTypes={isOpen:E().bool,showActions:E().bool,onRetry:E().func,onClose:E().func};const rr=({isOpen:e=!0,showActions:s=!1,onRetry:t=l.noop,onClose:r=l.noop})=>(0,T.jsxs)(er,{isOpen:e,title:Bt,onClose:r,children:[(0,T.jsx)(Qt,{children:(0,T.jsx)($t,{})}),(0,T.jsx)(sr,{showActions:s,onRetry:t,onClose:r})]});rr.propTypes={isOpen:E().bool,showActions:E().bool,onRetry:E().func,onClose:E().func};const or=({errorMessage:e="",isOpen:s=!0,showActions:t=!1,onRetry:r=l.noop,onClose:o=l.noop})=>(0,T.jsxs)(er,{isOpen:s,title:zt,onClose:o,children:[(0,T.jsx)(Qt,{children:(0,T.jsx)(Gt,{errorMessage:e})}),(0,T.jsx)(sr,{showActions:t,onRetry:r,onClose:o})]});or.propTypes={errorMessage:E().string,isOpen:E().bool,showActions:E().bool,onRetry:E().func,onClose:E().func};const ir=({isOpen:e=!0,onClose:s=l.noop})=>(0,T.jsxs)(er,{isOpen:e,title:_t,onClose:s,children:[(0,T.jsx)(Qt,{children:(0,T.jsx)(Ct,{})}),(0,T.jsx)(Xt,{children:(0,T.jsx)(Jt,{onClose:s})})]});ir.propTypes={isOpen:E().bool,onClose:E().func};const nr=({isOpen:e=!0,onClose:s=l.noop})=>(0,T.jsxs)(er,{isOpen:e,title:Wt,onClose:s,children:[(0,T.jsx)(Qt,{children:(0,T.jsx)(Dt,{})}),(0,T.jsx)(Xt,{children:(0,T.jsx)(Jt,{onClose:s})})]});nr.propTypes={isOpen:E().bool,onClose:E().func};const ar=({isOpen:e=!0,onClose:s=l.noop})=>(0,T.jsxs)(er,{isOpen:e,title:Nt,onClose:s,children:[(0,T.jsx)(Qt,{children:(0,T.jsx)(Tt,{})}),(0,T.jsx)(Xt,{children:(0,T.jsx)(Jt,{onClose:s})})]});ar.propTypes={isOpen:E().bool,onClose:E().func};const lr=({isOpen:e=!0,onClose:s=l.noop})=>(0,T.jsxs)(er,{isOpen:e,title:Kt,onClose:s,children:[(0,T.jsx)(Qt,{children:(0,T.jsx)(Yt,{})}),(0,T.jsx)(Xt,{children:(0,T.jsx)(Jt,{onClose:s})})]});lr.propTypes={isOpen:E().bool,onClose:E().func};const cr=({invalidSubscriptions:e=[],isOpen:s=!0,onClose:t=l.noop})=>{const r=(0,be.useSelect)(e=>e(it).selectBustSubscriptionCacheEndpoint(),[]),o=(0,j.useCallback)(async()=>{try{await At()({path:r,method:"POST",parse:!1})}catch(e){console.error(e)}window.location.reload()},[r]);return(0,T.jsxs)(er,{isOpen:s,title:Ot,onClose:t,children:[(0,T.jsx)(Qt,{children:(0,T.jsx)(Ft,{invalidSubscriptions:e})}),(0,T.jsxs)(Xt,{children:[(0,T.jsx)(Jt,{onClose:t}),(0,T.jsx)(X.Button,{variant:"primary",onClick:o,children:(0,d.__)("Refresh page","wordpress-seo")})]})]})};cr.propTypes={invalidSubscriptions:E().arrayOf(E().string),isOpen:E().bool,onClose:E().func};const dr=({isOpen:e=!0,onClose:s=l.noop})=>{const t=(0,j.useCallback)(()=>window.location.reload(),[]);return(0,T.jsxs)(er,{isOpen:e,title:Et,onClose:s,children:[(0,T.jsx)(Qt,{children:(0,T.jsx)(It,{})}),(0,T.jsxs)(Xt,{children:[(0,T.jsx)(Jt,{onClose:s}),(0,T.jsx)(X.Button,{variant:"primary",onClick:t,children:(0,d.__)("Refresh page","wordpress-seo")})]})]})};dr.propTypes={isOpen:E().bool,onClose:E().func};const ur=(0,d.__)("Yoast AI cannot reach your site","wordpress-seo"),pr=()=>{const{commonErrorsLink:e,supportLink:s}=bt();return(0,T.jsx)(vt,{children:Te((0,d.sprintf)(/* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ /* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */
(0,d.__)("To use this feature, your site must be publicly accessible. This applies to both test sites and instances where your REST API is password-protected. Please ensure your site is accessible to the public and try again. Learn more on our page about %1$scommon AI feature problems and errors%2$s. In case you need further help, please %3$scontact our support team%4$s.","wordpress-seo"),"","","",""),{a1:(0,T.jsx)(Hs,{variant:"error",href:e}),a2:(0,T.jsx)(Hs,{variant:"error",href:s})})})},mr=({learnMoreUrl:e=""})=>(0,T.jsx)(vt,{children:Te((0,d.sprintf)(/* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */ /* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */
(0,d.__)("%1$sLearn more about connecting with MyYoast.%2$s","wordpress-seo"),"",""),{a:(0,T.jsx)(Hs,{variant:"error",href:e})})});mr.propTypes={learnMoreUrl:E().string};const hr=()=>{const e=(0,X.useSvgAria)(),{commonErrorsLink:s,supportLink:t}=(0,be.useSelect)(e=>{const s=e(nt);return{commonErrorsLink:s.selectLink("https://yoa.st/ai-common-errors"),supportLink:s.selectAdminLink("?page=wpseo_page_support")}},[]);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(Qt,{children:(0,T.jsx)(vt,{children:(0,d.__)("This feature requires a publicly accessible site. Check that your site (including any password-protected REST APIs or test environments) is visible to the public, then try again.","wordpress-seo")})}),(0,T.jsxs)(Xt,{children:[(0,T.jsxs)(X.Button,{as:"a",href:t,target:"_blank",rel:"noopener noreferrer",variant:"secondary",children:[(0,d.__)("Still need help?","wordpress-seo"),(0,T.jsx)(Cs(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 yst-text-slate-400 rtl:yst-rotate-[270deg]",...e}),(0,T.jsx)("span",{className:"yst-sr-only",children:(0,d.__)("(Opens in a new browser tab)","wordpress-seo")})]}),(0,T.jsxs)(X.Button,{as:"a",href:s,target:"_blank",rel:"noopener noreferrer",variant:"primary",children:[(0,d.__)("Learn more","wordpress-seo"),(0,T.jsx)(Es(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 rtl:yst-rotate-180",...e})]})]})]})},gr=({isAvailable:e,canConnect:s,connectUrl:t,learnMoreUrl:r},o,i)=>e&&s&&t?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(Qt,{children:[(0,T.jsx)(vt,{children:(0,d.__)("This feature requires a publicly accessible site. Connect to MyYoast to use Yoast AI even when your site is offline, behind a firewall, or with the REST API disabled.","wordpress-seo")}),(0,T.jsx)(mr,{learnMoreUrl:r})]}),(0,T.jsxs)(Xt,{children:[(0,T.jsx)(Jt,{onClose:o}),(0,T.jsxs)(X.Button,{as:"a",href:t,target:"_blank",rel:"noopener noreferrer",variant:"primary",children:[(0,d.__)("Connect to MyYoast","wordpress-seo"),(0,T.jsx)(Cs(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 rtl:yst-rotate-[270deg]",...i}),(0,T.jsx)("span",{className:"yst-sr-only",children:(0,d.__)("(Opens in a new browser tab)","wordpress-seo")})]})]})]}):e&&!s?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(Qt,{children:[(0,T.jsx)(vt,{children:(0,d.__)("Your site isn't publicly accessible. Ask your site administrator to connect to MyYoast. They can find it on the Integrations page in Yoast SEO. This allows Yoast AI to work even when your site is offline, behind a firewall, or with the REST API disabled.","wordpress-seo")}),(0,T.jsx)(mr,{learnMoreUrl:r})]}),(0,T.jsx)(Xt,{children:(0,T.jsx)(Jt,{onClose:o})})]}):(0,T.jsx)(hr,{}),yr=({isOpen:e=!0,onClose:s=l.noop})=>{const t=(0,X.useSvgAria)(),r=(0,be.useSelect)(e=>e(it).selectMyyoastConnection(),[]);return(0,T.jsx)(er,{isOpen:e,title:ur,onClose:s,children:gr(r,s,t)})};yr.propTypes={isOpen:E().bool,onClose:E().func};const xr=({onGiveConsent:e,learnMoreLink:s,privacyPolicyLink:t,termsOfServiceLink:r,imageLink:o,linkStoreName:i})=>{const{onClose:n,initialFocus:a}=(0,X.useModalContext)(),[l,c]=(0,X.useToggleState)(!1),[u,p]=(0,j.useState)(!1),m=(0,j.useMemo)(()=>({src:o,width:"432",height:"244"}),[o]),h=Te((0,d.sprintf)(/* translators: %1$s and %2$s are a set of anchor tags and %3$s and %4$s are a set of anchor tags. */ /* translators: %1$s and %2$s are a set of anchor tags and %3$s and %4$s are a set of anchor tags. */
(0,d.__)("I approve the %1$sTerms of Service%2$s & %3$sPrivacy Policy%4$s of the Yoast AI service. This includes consenting to the collection and use of data to improve user experience.","wordpress-seo"),"","","",""),{a1:(0,T.jsx)(Hs,{href:r}),a2:(0,T.jsx)(Hs,{href:t})}),[g,y]=(0,X.useToggleState)(!1),x=(0,j.useCallback)(async()=>{y();const s=await e();p(!1===s),y()},[e]);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center",children:(0,T.jsx)("div",{className:"yst-relative yst-w-full",children:(0,T.jsx)("img",{className:"yst-w-full yst-h-auto yst-rounded-md yst-drop-shadow-md",alt:"",loading:"lazy",decoding:"async",...m})})}),(0,T.jsxs)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center",children:[(0,T.jsxs)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center",children:[(0,T.jsx)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium",children:(0,d.sprintf)(/* translators: %s expands to Yoast AI. */ /* translators: %s expands to Yoast AI. */
(0,d.__)("Grant consent for %s","wordpress-seo"),"Yoast AI")}),(0,T.jsx)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm",children:Te((0,d.sprintf)(/* translators: %1$s is a break tag; %2$s and %3$s are anchor tag; %4$s is the arrow icon. */ /* translators: %1$s is a break tag; %2$s and %3$s are anchor tag; %4$s is the arrow icon. */
(0,d.__)("Enable AI-powered SEO! Use all Yoast AI features to boost your efficiency. Just give us the green light. %1$s%2$sLearn more%3$s%4$s","wordpress-seo"),"
","","",""),{a:(0,T.jsx)(Hs,{href:s,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,T.jsx)(Es(),{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"}),br:(0,T.jsx)("br",{})})})]}),(0,T.jsx)("div",{className:"yst-flex yst-w-full yst-mt-6",children:(0,T.jsx)("hr",{className:"yst-w-full yst-text-gray-200"})}),(0,T.jsxs)("div",{className:"yst-flex yst-items-start yst-mt-4",children:[(0,T.jsx)("input",{type:"checkbox",id:"yst-ai-consent-checkbox",name:"yst-ai-consent-checkbox",checked:l,value:l?"true":"false",onChange:c,className:"yst-checkbox__input",ref:a}),(0,T.jsx)("label",{htmlFor:"yst-ai-consent-checkbox",className:"yst-label yst-checkbox__label yst-text-xs yst-font-normal yst-text-slate-500",children:h})]}),u&&(0,T.jsx)(jt,{className:"yst-mt-3",linkStoreName:i}),(0,T.jsx)("div",{className:"yst-w-full yst-flex yst-mt-4",children:(0,T.jsxs)(X.Button,{as:"button",className:"yst-grow",size:"large",disabled:!l||u,onClick:x,children:[g&&!u&&(0,T.jsx)(X.Spinner,{className:"yst-me-2"}),(0,d.__)("Grant consent","wordpress-seo")]})}),(0,T.jsx)(X.Button,{as:"button",className:"yst-mt-4",variant:"tertiary",onClick:n,children:(0,d.__)("Close","wordpress-seo")})]})]})};xr.propTypes={onGiveConsent:E().func.isRequired,learnMoreLink:E().string.isRequired,privacyPolicyLink:E().string.isRequired,termsOfServiceLink:E().string.isRequired,imageLink:E().string.isRequired,linkStoreName:E().string.isRequired};const fr={termsOfService:"https://yoa.st/ai-generator-terms-of-service",privacyPolicy:"https://yoa.st/ai-generator-privacy-policy",learnMore:"https://yoa.st/ai-generator-learn-more"},wr=({storeName:e,onConsentGranted:s,linkStoreName:t,links:r={}})=>{const o=(0,j.useMemo)(()=>({...fr,...r}),[r]),{termsOfServiceLink:i,privacyPolicyLink:n,learnMoreLink:a,imageLink:l,endpoint:c}=(0,be.useSelect)(s=>{const r=s(t),i=s(e);return{termsOfServiceLink:r.selectLink(o.termsOfService),privacyPolicyLink:r.selectLink(o.privacyPolicy),learnMoreLink:r.selectLink(o.learnMore),imageLink:r.selectImageLink("ai-consent.jpg"),endpoint:i.selectAiGeneratorConsentEndpoint()}},[t,e,o]),{storeAiGeneratorConsent:d}=(0,be.useDispatch)(e),u=(0,j.useCallback)(async()=>{const e=await d(!0,c);return!1!==e&&s(),e},[d,s,c]);return(0,T.jsx)(xr,{termsOfServiceLink:i,privacyPolicyLink:n,learnMoreLink:a,imageLink:l,onGiveConsent:u,linkStoreName:t})};wr.propTypes={storeName:E().string.isRequired,onConsentGranted:E().func.isRequired,linkStoreName:E().string.isRequired,links:E().shape({termsOfService:E().string,privacyPolicy:E().string,learnMore:E().string})};const vr=({errorCode:e,errorIdentifier:s="",isOpen:t=!0,invalidSubscriptions:r=[],showActions:o=!1,onRetry:i=l.noop,errorMessage:n="",onClose:a=l.noop})=>{if("SEO_ANALYSIS_INACTIVE"===s)return(0,T.jsx)(dr,{isOpen:t,onClose:a});if(402===e||429===e&&"USAGE_LIMIT_REACHED"===s)return(0,T.jsx)(cr,{isOpen:t,invalidSubscriptions:r,onClose:a});switch(e){case 400:switch(s){case"AI_CONTENT_FILTER":return(0,T.jsx)(nr,{isOpen:t,onClose:a});case"NOT_ENOUGH_CONTENT":return(0,T.jsx)(ir,{isOpen:t,onClose:a});case"SITE_UNREACHABLE":return(0,T.jsx)(yr,{isOpen:t,onClose:a});case"WP_HTTP_REQUEST_ERROR":return(0,T.jsx)(or,{isOpen:t,errorMessage:n,showActions:o,onRetry:i,onClose:a});default:return(0,T.jsx)(tr,{isOpen:t,showActions:o,onRetry:i,onClose:a})}case 408:return(0,T.jsx)(rr,{isOpen:t,showActions:o,onRetry:i,onClose:a});case 429:return(0,T.jsx)(ar,{isOpen:t,onClose:a});case 410:return(0,T.jsx)(lr,{isOpen:t,onClose:a});default:return(0,T.jsx)(tr,{isOpen:t,showActions:o,onRetry:i,onClose:a})}};vr.propTypes={errorCode:E().number.isRequired,errorIdentifier:E().string,isOpen:E().bool,invalidSubscriptions:E().arrayOf(E().string),showActions:E().bool,onRetry:E().func,errorMessage:E().string,onClose:E().func};var br=t(2863),kr=t.n(br);const Sr=window.yoast.aiFrontend,jr=["_formal","_informal","_ao90"],_r=e=>{for(const s of jr)if(e.endsWith(s))return e.slice(0,-s.length);return e};let Cr,Rr=!1;const Er=async({endpoint:e,data:s})=>{let t;const r=1e3*(0,l.get)(window,"wpseoAiGenerator.requestTimeout",30);try{Cr&&Cr.abort(),Cr=new AbortController,Rr=!1,t=setTimeout(()=>{Rr=!0,Cr.abort()},r);const o=await At()({path:e,method:"POST",data:s,parse:!1,signal:Cr.signal}),i=await o.json();return{status:xt,payload:i}}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return Rr?{status:ft,payload:{message:"timeout",code:408}}:{status:wt};const{message:s,missingLicenses:t,errorIdentifier:r}=await(async e=>{try{const s=e.body.getReader(),{value:t}=await s.read(),r=new TextDecoder("utf-8").decode(t);return console.error(r),JSON.parse(r)}catch(e){return{message:"Unknown"}}})(e);return{status:ft,payload:{message:s,code:e.status||500,missingLicenses:t,errorIdentifier:r}}}finally{clearTimeout(t)}},Ir="\\–\\-\\(\\)_\\[\\]’‘“”〝〞〟‟„\"'.?!:;,¿¡«»‹›—×+&۔؟،؛。。!‼?⁇⁉⁈‥…・ー、〃〄〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〶〼〽{}|~⦅⦆「」、[]・¥$%@&'()*/:;<>\\\<>";Ir.split(""),new RegExp("^["+Ir+"]+"),new RegExp("["+Ir+"]+$");const Lr=new RegExp("["+Ir+"#$%&*+/=@^`{|}~ -¿–-⁊ -₠-⃀]","g"),Nr=e=>{const s={...e};return""!==e.value||["title","excerpt","excerpt_only"].includes(e.name)||(s.value="%%"+e.name+"%%"),s.badge=`${e.label}`,s},Tr={editType:dt,previewType:at,postType:"post",contentType:pt},Mr=(0,j.createContext)(Tr),Pr=(Mr.Provider,()=>(0,j.useContext)(Mr)),Ar=()=>(0,j.useContext)(n.LocationContext),Or=e=>{const s=(0,j.useRef)(null);return(0,j.useCallback)(t=>{(0,l.attempt)(()=>s.current&&s.current.disconnect()),null!==t&&(s.current=new ResizeObserver(s=>{(0,l.forEach)(s,s=>e(s))}),s.current.observe(t))},[e])},Fr=window.yoast.reduxJsToolkit,qr=(0,Fr.createSlice)({name:"suggestions",initialState:{status:yt.loading,error:{code:200,message:""},entities:[],selected:""},reducers:{setLoading:e=>{e.status=yt.loading},setSuccess:(e,{payload:s})=>{e.status=yt.success,e.selected=s[0],e.entities.push(...s)},setError:(e,{payload:s})=>{e.status=yt.error,e.error=s},setSelected:(e,{payload:s})=>{e.selected=s}}}),Br=e=>{switch(e){case lt:return"Facebook";case ct:return"Twitter";default:return"Google"}},$r=window.yoast.searchMetadataPreviews,Ur="usageCount",Wr="fetchUsageCount",Dr=`${Wr}/success`,Hr=`${Wr}/${Ys}`,zr={errorCode:null,errorIdentifier:null,errorMessage:null},Gr=(0,Fr.createSlice)({name:Ur,initialState:{status:"idle",count:0,limit:10,endpoint:"",error:zr},reducers:{addUsageCount:(e,{payload:s=1})=>{e.count+=s},setUsageCount:(e,{payload:s})=>{e.count=s},setUsageCountEndpoint:(e,{payload:s})=>{e.endpoint=s},setUsageCountLimit:(e,{payload:s})=>{e.limit=s}},extraReducers:e=>{e.addCase(`${Wr}/request`,e=>{e.status=Zs,e.error=zr}),e.addCase(Dr,(e,{payload:s})=>{e.status="success",e.count=s.count,e.limit=s.limit,e.error=zr}),e.addCase(`${Wr}/${Ys}`,(e,{payload:s})=>{e.status=Qs,e.error={errorCode:502,...s}})}}),Vr=(Gr.getInitialState,{selectUsageCountStatus:e=>(0,l.get)(e,[Ur,"status"],Gr.getInitialState()),selectUsageCount:e=>(0,l.get)(e,[Ur,"count"],Gr.getInitialState().count),selectUsageCountLimit:e=>(0,l.get)(e,[Ur,"limit"],Gr.getInitialState().limit),selectUsageCountEndpoint:e=>(0,l.get)(e,[Ur,"endpoint"],Gr.getInitialState().endpoint),selectUsageCountError:e=>(0,l.get)(e,[Ur,"error"],Gr.getInitialState().error)});Vr.selectUsageCountRemaining=(0,Fr.createSelector)([Vr.selectUsageCount,Vr.selectUsageCountLimit],(e,s)=>Math.max(s-e,0)),Vr.isUsageCountLimitReached=(0,Fr.createSelector)([Vr.selectUsageCount,Vr.selectUsageCountLimit,Vr.selectUsageCountError],(e,s,t)=>429===t.errorCode||e>=s),Gr.actions,Gr.reducer;const Kr=({onStartGenerating:e})=>(0,T.jsx)(wr,{storeName:it,linkStoreName:nt,onConsentGranted:e});Kr.propTypes={onStartGenerating:E().func.isRequired};var Yr=t(7219),Zr=t.n(Yr);const Qr=e=>{var s,t;const r=null===(s=(0,be.useDispatch)("core/edit-post"))||void 0===s?void 0:s.openGeneralSidebar,o=null===(t=(0,be.useDispatch)("core/editor"))||void 0===t?void 0:t.closePublishSidebar,{openEditorModal:i}=(0,be.useDispatch)("yoast-seo/editor");return(0,j.useCallback)(()=>{o(),r("yoast-seo/seo-sidebar"),e&&i("yoast-search-appearance-modal")},[o,r,i])},Xr=/(?<\/badge>|^(?!))(?[\s\S]+?)(?|$)/g,Jr=({total:e,current:s,onNavigate:t,disabled:r=!1,...o})=>(0,T.jsxs)("div",{className:"yst-flex yst-justify-between yst-gap-x-2 yst-items-start",children:[(0,T.jsx)("p",{className:"yst-text-slate-500 yst-text-xxs yst-mt-1",children:(0,d.__)("Text generated by AI may be offensive or inaccurate.","wordpress-seo")}),e>1&&(0,T.jsx)(X.Pagination,{className:"yst-shrink-0",current:s,total:e,onNavigate:t,disabled:r,variant:"text"
/* translators: Hidden accessibility text. */,screenReaderTextPrevious:(0,d.__)("Previous","wordpress-seo")
/* translators: Hidden accessibility text. */,screenReaderTextNext:(0,d.__)("Next","wordpress-seo"),...o})]}),eo=({height:e,onFatalError:s})=>{const[t,r]=(0,j.useState)(""),{onClose:o}=(0,X.useModalContext)(),{editType:i,previewType:n,contentType:a}=Pr(),c=(()=>{const{editType:e,previewType:s}=Pr();let t="SEO";switch(s){case lt:t="social";break;case ct:t="X"}switch(e){case dt:return(0,d.sprintf)(/* translators: %s is the type of title. */ /* translators: %s is the type of title. */
(0,d.__)("Generated %s titles","wordpress-seo"),t);case ut:return s===at&&(t="meta"),(0,d.sprintf)(/* translators: %s is the type of description. */ /* translators: %s is the type of description. */
(0,d.__)("Generated %s descriptions","wordpress-seo"),t)}})(),p=(()=>{const{editType:e,previewType:s}=Pr();let t="SEO";switch(s){case lt:t="social";break;case ct:t="X"}switch(e){case dt:return(0,d.sprintf)(/* translators: %s is the type of title. */ /* translators: %s is the type of title. */
(0,d.__)("Apply %s title","wordpress-seo"),t);case ut:return s===at&&(t="meta"),(0,d.sprintf)(/* translators: %s is the type of description. */ /* translators: %s is the type of description. */
(0,d.__)("Apply %s description","wordpress-seo"),t)}})(),m=Ar(),{suggestions:h,fetchSuggestions:g,setSelectedSuggestion:y}=(()=>{const[e,s]=(0,j.useReducer)(qr.reducer,qr.getInitialState()),{editType:t,previewType:r,postType:o,contentType:i}=Pr(),n=(0,be.useSelect)(e=>e(it).selectPromptContent(),[]),a=(0,be.useSelect)(e=>e(it).selectGetSuggestionsEndpoint(),[]),{contentLocale:l,focusKeyphrase:c,isWooCommerceActive:d,isGutenberg:p,isElementor:m}=(0,be.useSelect)(e=>({contentLocale:e(nt).getContentLocale(),focusKeyphrase:e(nt).getFocusKeyphrase(),isWooCommerceActive:e(nt).getIsWooCommerceActive(),isGutenberg:e(nt).getIsBlockEditor(),isElementor:e(nt).getIsElementorEditor()}),[]);let h,g=u.languageProcessing.helpers.processExactMatchRequest(c).keyphrase;g.length>191&&(g=g.slice(0,191)),h=m?"elementor":p?"gutenberg":"classic";const y=((e,s,t,r)=>{const o=e===ut?"meta-description":"seo-title";let i=((e,s)=>{if(e)switch(s){case"product":return"product-";case"product_cat":case"product_tag":return"product-taxonomy-"}return""})(s,t);return i&&s||r!==mt||(i="taxonomy-"),`${i}${o}`})(t,d,o,i);return{suggestions:e,fetchSuggestions:(0,j.useCallback)(async(e=!0)=>{s(qr.actions.setLoading());const{status:t,payload:o}=await Er({endpoint:a,canAbort:e,data:{type:y,prompt_content:n,focus_keyphrase:g,platform:Br(r),language:_r(l).replace("_","-"),editor:h}});switch(t){case wt:break;case ft:s(qr.actions.setError(o));break;case xt:s(qr.actions.setSuccess(o))}return t},[s]),setSelectedSuggestion:(0,j.useCallback)(e=>s(qr.actions.setSelected(e)),[s])}})(),x=(()=>{const{previewType:e}=Pr();switch(e){case lt:return uo;case ct:return gi;default:return io}})(),{addAppliedSuggestion:f,addUsageCount:w}=(0,be.useDispatch)(it),{isUsageCountLimitReached:v,isWooProductEntity:b,hasValidPremiumSubscription:k,hasValidWooSubscription:S}=(0,be.useSelect)(e=>{const s=e(it),t=e(nt);return{isUsageCountLimitReached:s.isUsageCountLimitReached(),isPremium:t.getIsPremium(),isWooProductEntity:t.getIsWooProductEntity(),isWooSeoActive:t.getIsWooSeoActive(),hasValidPremiumSubscription:s.selectPremiumSubscription(),hasValidWooSubscription:s.selectWooCommerceSubscription()}},[]),_=(0,j.useMemo)(()=>h.status===yt.loading||!(S||!v||!b)||!(k||!v),[k,v,h.status,b,S]),C=(0,X.usePrevious)(e),R=h.status===yt.success?e:C,{bottom:E}={bottom:`calc( (${R+"px"} - 100vh) / 2 + 32px )`},[I,L]=(0,j.useState)(!1),N=(0,j.useCallback)(e=>{L(e.target.offsetHeight!==e.target.scrollHeight)},[L]),M=Or(N),P=(()=>{const{editType:e,previewType:s,contentType:t}=Pr(),r=(()=>{const{previewType:e}=Pr();return(0,j.useMemo)(()=>{switch(e){case at:return()=>(0,be.select)(nt).getSnippetEditorData().title;case lt:return(0,be.select)(nt).getFacebookTitleOrFallback;case ct:return(0,be.select)(nt).getTwitterTitleOrFallback;default:return(0,l.constant)("")}},[e])})(),o=(0,be.useSelect)(t=>t(it).selectAppliedSuggestionFor({editType:e,previewType:s}),[e,s]);return(0,j.useMemo)(()=>{let s=r();return e===ut?s:(o&&(s=s.replace(o,gt[t])),((e,s)=>e.includes(gt[s])?e:gt[s])(s,t))},[e,r])})(),A=(()=>{const e=(()=>{const{previewType:e}=Pr();return(0,j.useMemo)(()=>{switch(e){case at:return()=>(0,be.select)(nt).getSnippetEditorData().description;case lt:return(0,be.select)(nt).getFacebookDescriptionOrFallback;case ct:return(0,be.select)(nt).getTwitterDescriptionOrFallback;default:return(0,l.constant)("")}},[e])})();return(0,j.useMemo)(e,[e])})(),O=(()=>{const e=(0,be.useSelect)(e=>e(nt).getReplaceVars(),[]),s=(0,j.useMemo)(()=>e.map(Nr),[e]);return(0,j.useCallback)((e,{key:t="value",overrides:r={},applyPluggable:o=!0,editType:i=dt,contentType:n=pt}={})=>{for(const o of s)e=e.replace(new RegExp("%%"+(0,l.escapeRegExp)(o.name)+"%%","g"),(0,l.get)(r,o.name,o[t]));return n===mt&&(e=e.replace(" Archives","")),o?((e,s=dt)=>{const t=vs({title:"",description:"",[s]:u.languageProcessing.stripSpaces(e)});return(0,l.get)(t,s,e)})(e,i):e},[s])})(),F=(0,j.useMemo)(()=>i===dt?{[ht[a]]:h.selected}:{},[i,a,h.selected]),q=(0,j.useMemo)(()=>O(P,{overrides:F,contentType:a}),[O,P,i,a,h.selected]),B=(0,j.useMemo)(()=>O(P,{overrides:{...F,sep:"",sitename:""},contentType:a}),[O,P,i,a,h.selected]),$=(0,j.useMemo)(()=>i===ut?h.selected:O(A,{editType:ut}),[O,A,i,h.selected]),U=(0,j.useCallback)(e=>O(P,{overrides:{[ht[a]]:e},key:"badge",applyPluggable:!1,contentType:a}),[O,P,a]),{currentPage:W,setCurrentPage:D,isOnLastPage:H,totalPages:z,getItemsOnCurrentPage:G}=(({totalItems:e=0,perPage:s=5})=>{const[t,r]=(0,j.useState)(1),o=(0,j.useMemo)(()=>Math.ceil(e/s),[e,s]),i=(0,j.useMemo)(()=>t*s,[t,s]),n=(0,j.useMemo)(()=>i-s,[i,s]),a=(0,j.useMemo)(()=>1===t,[t]),c=(0,j.useMemo)(()=>t===o,[t,o]),d=(0,j.useCallback)(()=>{t>1&&r(t-1)},[t,r]),u=(0,j.useCallback)(()=>{t(0,l.slice)(e,n,i),[n,i]);return{currentPage:t,setCurrentPage:r,totalPages:o,isOnFirstPage:a,isOnLastPage:c,previousPage:d,nextPage:u,firstOnPage:n,lastOnPage:i,getItemsOnCurrentPage:p}})({totalItems:h.status===yt.loading||h.status===yt.error?h.entities.length+5:h.entities.length,perPage:5}),V=(0,j.useMemo)(()=>(0,l.map)(G(h.entities),e=>{let s=e;return i===dt&&(s=U(e),s=s.replace(Xr,(e,s,t,r,o,i,{start:n,wrap:a,end:l})=>{const c=a.trim();return 0===c.length?`${n}${a}${l}`:`${n}${c}${l}`}),s=Te(s,{badge:(0,T.jsx)(X.Badge,{className:"yst-me-2 last:yst-me-0",variant:"plain",children:" "}),span:(0,T.jsx)("span",{className:"yst-flex yst-items-center yst-me-2 last:yst-me-0"})})),{value:e,label:s}}),[h.entities,G,i,U]),K=(0,j.useMemo)(()=>h.status!==yt.error||h.status===yt.error&&!H,[h.status,H]),Y=(0,j.useMemo)(()=>h.status===yt.loading&&H,[h.status,H]),Z=(0,j.useMemo)(()=>h.status===yt.error&&H,[h.status,H]),Q=(0,j.useCallback)(()=>{_||(D(h.status===yt.error?z:z+1),g().then(e=>{e===xt&&w()}))},[g,h.status,z,D,y,v]),J=(()=>{const{editType:e}=Pr();switch(e){case dt:return(()=>{const{previewType:e}=Pr(),{updateData:s,setFacebookPreviewTitle:t,setTwitterPreviewTitle:r}=(0,be.useDispatch)(nt);return(0,j.useMemo)(()=>{switch(e){case at:return e=>s({title:e});case lt:return t;case ct:return r;default:return l.noop}},[e,s,t,r])})();case ut:return(()=>{const{previewType:e}=Pr(),{updateData:s,setFacebookPreviewDescription:t,setTwitterPreviewDescription:r}=(0,be.useDispatch)(nt);return(0,j.useMemo)(()=>{switch(e){case at:return e=>s({description:e});case lt:return t;case ct:return r;default:return l.noop}},[e,s,t,r])})();default:return l.noop}})(),ee=Qr(!0),se=(0,j.useCallback)(()=>{const e=i===dt?P.replace(new RegExp(gt[a]+"( Archives)?"),h.selected):h.selected;J(e),f({editType:i,previewType:n,suggestion:h.selected}),o(),"pre-publish"===m&&ee()},[J,i,n,h.selected,P,o,f,ee,m]);((e,s=[])=>{const t=(0,j.useRef)(!1);(0,j.useEffect)(()=>{t.current||(t.current=!0,e().finally(()=>{t.current=!1}))},[e,s])})(()=>""===t?g().then(e=>{r(e),e===xt&&w()}):Promise.resolve(),[t,w,g]);const te=t===ft||h.status===yt.error&&402===h.error.code;return(0,j.useEffect)(()=>{var e,t,r,o,i,n,a,l;te&&s({errorCode:null!==(e=null===(t=h.error)||void 0===t?void 0:t.code)&&void 0!==e?e:0,errorIdentifier:null!==(r=null===(o=h.error)||void 0===o?void 0:o.errorIdentifier)&&void 0!==r?r:"",invalidSubscriptions:null!==(i=null===(n=h.error)||void 0===n?void 0:n.missingLicenses)&&void 0!==i?i:[],errorMessage:null!==(a=null===(l=h.error)||void 0===l?void 0:l.message)&&void 0!==a?a:""})},[te,h.error,s]),te?null:(0,T.jsxs)(j.Fragment,{children:[(0,T.jsxs)(X.Modal.Container.Content,{ref:M,className:"yst-flex yst-flex-col yst-py-6 yst-space-y-2",children:[(0,T.jsx)(x,{title:q,description:$,status:h.status,titleForLength:B,showPreviewSkeleton:""===t,showLengthProgress:!Y}),K&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)("div",{className:"yst-flex yst-space-y-4",children:[(0,T.jsx)(X.Label,{as:"span",className:"yst-flex-grow yst-cursor-default yst-mt-auto",children:c}),(0,T.jsx)(X.Button,{variant:"ai-secondary",size:"small",onClick:h.status===yt.loading?l.noop:Q,isLoading:h.status===yt.loading,disabled:_,children:(0,d.__)("Generate 5 more","wordpress-seo")})]}),Y?(0,T.jsx)(pi,{idSuffix:m,suggestionClassNames:i===dt?[["yst-h-3 yst-w-9/12"],["yst-h-3 yst-w-7/12"],["yst-h-3 yst-w-10/12"],["yst-h-3 yst-w-11/12"],["yst-h-3 yst-w-8/12"]]:void 0}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(di,{idSuffix:m,suggestions:V,selected:h.selected,onChange:y}),(0,T.jsx)(Jr,{current:W,total:z,onNavigate:D,disabled:h.status===yt.loading||Z})]})]}),Z&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("div",{className:"yst-mt-8"}),(0,T.jsx)(ai,{errorCode:h.error.code,errorIdentifier:h.error.errorIdentifier,invalidSubscriptions:h.error.missingLicenses,errorMessage:h.error.message}),(0,T.jsx)(Jr,{current:W,total:z,onNavigate:D,disabled:h.status===yt.loading})]})]}),(0,T.jsxs)(X.Modal.Container.Footer,{children:[I&&(0,T.jsx)("div",{className:"yst-absolute yst-inset-x-0 yst--mt-10 yst-me-[calc(2.5rem-1px)] yst-h-10 yst-pointer-events-none yst-bg-gradient-to-t yst-from-slate-50"}),(0,T.jsx)("hr",{className:"yst-mb-6 yst--mx-6"}),(0,T.jsxs)("div",{className:"sm:yst-flex sm:yst-justify-end sm:yst-space-x-2 sm:rtl:yst-space-x-reverse",children:[(0,T.jsx)("div",{className:"yst-hidden sm:yst-inline",children:(0,T.jsx)(X.Button,{variant:"secondary",onClick:o,children:(0,d.__)("Close","wordpress-seo")})}),(0,T.jsx)("div",{className:"yst-block sm:yst-inline",children:(0,T.jsxs)(X.Button,{className:"yst-w-full sm:yst-w-auto",variant:"primary",onClick:se,disabled:""===h.selected||h.status===yt.loading||Z,children:[(0,T.jsx)(Zr(),{className:"yst--ms-1 yst-me-1 yst-h-4 yst-w-4 yst-text-white"}),p]})}),(0,T.jsx)("div",{className:"yst-mt-3 sm:yst-hidden",children:(0,T.jsx)(X.Button,{variant:"secondary",onClick:o,className:"yst-w-full sm:yst-w-auto",children:(0,d.__)("Close","wordpress-seo")})})]})]}),(0,T.jsxs)(X.Notifications,{className:"yst-mx-[calc(50%-50vw)] yst-transition-all",style:{bottom:E},position:"bottom-left",children:[h.status!==yt.loading&&(0,T.jsx)(ki,{className:"yst-mx-[calc(50%-50vw)] yst-transition-all"}),(h.status===yt.success||h.status===yt.loading)&&(0,T.jsx)(hi,{})]})]})};eo.propTypes={height:E().number.isRequired,onFatalError:E().func.isRequired};const so=({onActivateFreeSparks:e})=>{const{premiumUpsellLink:s,wooUpsellLink:t,isWooCommerceActive:r,isProductPost:o,learnMoreLink:i,imageLink:n,wistiaEmbedPermissionValue:a,wistiaEmbedPermissionStatus:l,isUsageCountLimitReached:c,activateFreeSparksEndpoint:u}=(0,be.useSelect)(e=>{const s=e(it),t=e(nt);return{premiumUpsellLink:t.selectLink("https://yoa.st/ai-generator-upsell"),wooUpsellLink:t.selectLink("https://yoa.st/ai-generator-upsell-woo-seo"),isWooCommerceActive:t.getIsWooCommerceActive(),isProductPost:t.getIsProduct(),learnMoreLink:t.selectLink("https://yoa.st/ai-generator-learn-more"),imageLink:t.selectImageLink("ai-generator-preview.jpg"),wistiaEmbedPermissionValue:t.selectWistiaEmbedPermissionValue(),wistiaEmbedPermissionStatus:t.selectWistiaEmbedPermissionStatus(),isUsageCountLimitReached:s.isUsageCountLimitReached(),activateFreeSparksEndpoint:s.selectFreeSparksActiveEndpoint()}},[]),{onClose:p,initialFocus:m}=(0,X.useModalContext)(),{title:h,upsellLabel:g,upsellLink:y,ctbId:x,newToText:f}=(e=>{const{isWooProductEntity:s,isProductPost:t,hasValidWooSubscription:r}=(0,be.useSelect)(e=>{const s=e(nt),t=e(it);return{isWooProductEntity:s.getIsWooProductEntity(),isProductPost:s.getIsProduct(),hasValidWooSubscription:t.selectWooCommerceSubscription()}},[]);return(0,j.useMemo)(()=>{const o={upsellLink:e.premium,upsellLabel:(0,d.sprintf)(/* translators: %1$s expands to Yoast SEO Premium. */ /* translators: %1$s expands to Yoast SEO Premium. */
(0,d.__)("Unlock with %1$s","wordpress-seo"),"Yoast SEO Premium"),newToText:"Yoast SEO Premium",ctbId:"f6a84663-465f-4cb5-8ba5-f7a6d72224b2",title:(0,d.__)("Use AI to generate your titles & descriptions!","wordpress-seo")};return s&&(t&&(o.title=(0,d.__)("Generate product titles & descriptions with AI!","wordpress-seo")),r||(o.newToText="Yoast WooCommerce SEO",o.upsellLabel=(0,d.sprintf)(/* translators: %1$s expands to Yoast WooCommerce SEO. */ /* translators: %1$s expands to Yoast WooCommerce SEO. */
(0,d.__)("Unlock with %1$s","wordpress-seo"),"Yoast WooCommerce SEO"),o.upsellLink=e.woo,o.ctbId="5b32250e-e6f0-44ae-ad74-3cefc8e427f9")),o},[s,t,e.premium,e.woo])})({premium:s,woo:t}),w=(0,j.useMemo)(()=>r&&o,[r,o]),v=(0,j.useMemo)(()=>({src:n,width:"432",height:"244"}),[n]),{setWistiaEmbedPermission:b}=(0,be.useDispatch)(nt),{activateFreeSparks:k}=(0,be.useDispatch)(it),S=(0,j.useMemo)(()=>({value:a,status:l,set:b}),[a,l,b]),_=(0,j.useCallback)(()=>{k({endpoint:u}),e()},[k,u,p,e]),C={a:(0,T.jsx)(Hs,{href:i,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,T.jsx)(Es(),{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"})};return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center",children:[(0,T.jsxs)("div",{className:"yst-relative yst-w-full",children:[(0,T.jsx)(st,{videoId:"vmrahpfjxp",thumbnail:v,wistiaEmbedPermission:S}),(0,T.jsx)(X.Badge,{className:"yst-absolute yst--top-2 yst-end-4",variant:"info",children:"Beta"})]}),(0,T.jsx)("div",{className:"yst-mt-6 yst-text-xs yst-font-medium yst-flex yst-flex-col yst-items-center",children:(0,T.jsxs)("span",{className:"yst-introduction-modal-uppercase yst-flex yst-gap-2 yst-items-center",children:[(0,T.jsx)("span",{className:"yst-logo-icon"}),f]})})]}),(0,T.jsxs)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center",children:[(0,T.jsxs)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center",children:[(0,T.jsx)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium",children:h}),(0,T.jsx)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm",children:Te(w?(0,d.sprintf)(/* translators: %1$s and %2$s are anchor tags; %3$s is the arrow icon. */ /* translators: %1$s and %2$s are anchor tags; %3$s is the arrow icon. */
(0,d.__)("Let AI do some of the thinking for you and help you save time. Get high-quality suggestions for product titles and meta descriptions to make your content rank high and look good on social media. %1$sLearn more%2$s%3$s","wordpress-seo"),"","",""):(0,d.sprintf)(/* translators: %1$s and %2$s are anchor tags; %3$s is the arrow icon. */ /* translators: %1$s and %2$s are anchor tags; %3$s is the arrow icon. */
(0,d.__)("Let AI do some of the thinking for you and help you save time. Get high-quality suggestions for titles and meta descriptions to make your content rank high and look good on social media. %1$sLearn more%2$s%3$s","wordpress-seo"),"","",""),C)})]}),c&&(0,T.jsx)(X.Alert,{className:"yst-my-4",children:(0,d.sprintf)(/* translators: %s is for Yoast SEO Premium. */ /* translators: %s is for Yoast SEO Premium. */
(0,d.__)("Oh no! Its seems like you're out of free Sparks. Keep the momentum going, unlock unlimited sparks with %s!","wordpress-seo"),"Yoast SEO Premium")}),(0,T.jsxs)("div",{className:Ge()("yst-w-full yst-flex yst-flex-col",c?"yst-mt-0":"yst-mt-6"),children:[(0,T.jsxs)(X.Button,{as:"a",className:"yst-grow",size:"extra-large",variant:"upsell",href:y,target:"_blank",ref:m,"data-action":"load-nfd-ctb","data-ctb-id":x,children:[(0,T.jsx)($e(),{className:"yst--ms-1 yst-me-2 yst-h-5 yst-w-5"}),g,(0,T.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
(0,d.__)("(Opens in a new browser tab)","wordpress-seo")})]}),!c&&(0,T.jsx)(X.Button,{variant:"ai-secondary",onClick:_,className:"yst-mt-2 yst-w-full yst-text-base yst-text-slate-800 yst-font-medium yst-h-11",children:(0,d.__)("Try for free","wordpress-seo")})]}),(0,T.jsx)(X.Button,{as:"a",className:"yst-mt-4",variant:"tertiary",onClick:p,children:(0,d.__)("Close","wordpress-seo")})]})]})},to=({isOpen:e,onClose:s,closeButtonScreenReaderText:t,panelRef:r,title:o,aiModalHelperLink:i,children:n})=>{const a=(0,X.useSvgAria)();return(0,T.jsx)(X.Modal,{className:"yst-ai-modal",isOpen:e,onClose:s,children:(0,T.jsx)(X.Modal.Panel,{ref:r,className:"yst-max-w-3xl yst-relative",closeButtonScreenReaderText:t,children:(0,T.jsxs)(X.Modal.Container,{children:[(0,T.jsxs)(X.Modal.Container.Header,{children:[(0,T.jsxs)("div",{className:"yst-flex yst-items-center",children:[(0,T.jsx)("span",{className:"yst-logo-icon yst-h-5 yst-w-5"}),(0,T.jsx)(X.Modal.Title,{className:"yst-ms-3 yst-me-1.5",as:"h1",size:"2",children:o}),(0,T.jsx)(X.Link,{id:"ai-modal-learn-more",href:i,variant:"primary",className:"yst-no-underline yst-me-2",target:"_blank",rel:"noopener"
/* translators: Hidden accessibility text. */,"aria-label":(0,d.__)("Learn more about AI (Opens in a new browser tab)","wordpress-seo"),children:(0,T.jsx)(kr(),{...a,className:"yst-w-4 yst-h-4 yst-text-slate-500 yst-shrink-0"})}),(0,T.jsx)(X.Badge,{variant:"info",children:(0,d.__)("Beta","wordpress-seo")})]}),(0,T.jsx)("hr",{className:"yst-mt-6 yst--mx-6"})]}),n]})})})},ro=({isOpen:e,onClose:s,closeButtonScreenReaderText:t,children:r})=>(0,T.jsx)(X.Modal,{className:"yst-introduction-modal",isOpen:e,onClose:s,children:(0,T.jsx)(X.Modal.Panel,{className:"yst-max-w-lg yst-p-0 yst-rounded-3xl",closeButtonScreenReaderText:t,children:r})}),oo={inactive:"inactive",askConsent:"askConsent",upsell:"upsell",generate:"generate"};(({onUseAi:e})=>{const[s,t]=(0,j.useState)(oo.inactive),{editType:r,previewType:o}=Pr(),i=Ar(),n=(()=>{const{editType:e,previewType:s}=Pr();switch(s){case lt:return e===ut?(0,d.__)("AI social description generator","wordpress-seo"):(0,d.__)("AI social title generator","wordpress-seo");case ct:return e===ut?(0,d.__)("AI X description generator","wordpress-seo"):(0,d.__)("AI X title generator","wordpress-seo");default:return e===ut?(0,d.__)("AI description generator","wordpress-seo"):(0,d.__)("AI title generator","wordpress-seo")}})(),{hasConsent:a,promptContentInitialized:l,currentSubscriptions:c,usageCountStatus:u,usageCount:p,usageCountLimit:m,usageCountEndpoint:h,hasValidPremiumSubscription:g,hasValidWooSubscription:y,focusKeyphrase:x,isPremium:f,isSeoAnalysisActive:w,aiModalHelperLink:v,isWooProductEntity:b,isFreeSparksActive:k,isWooSeoActive:S}=(0,be.useSelect)(e=>{const s=e(it),t=e(nt);return{hasConsent:s.selectHasAiGeneratorConsent(),promptContentInitialized:s.selectPromptContentInitialized(),currentSubscriptions:s.selectProductSubscriptions(),usageCountStatus:s.selectUsageCountStatus(),usageCount:s.selectUsageCount(),usageCountLimit:s.selectUsageCountLimit(),usageCountEndpoint:s.selectUsageCountEndpoint(),hasValidPremiumSubscription:s.selectPremiumSubscription(),hasValidWooSubscription:s.selectWooCommerceSubscription(),focusKeyphrase:t.getFocusKeyphrase(),isPremium:t.getIsPremium(),isWooSeoActive:t.getIsWooSeoActive(),isSeoAnalysisActive:t.getPreference("isKeywordAnalysisActive",!0),aiModalHelperLink:t.selectLink("https://yoa.st/ai-generator-help-button-modal"),isWooProductEntity:t.getIsWooProductEntity(),isFreeSparksActive:e(it).selectIsFreeSparksActive()}},[]),{fetchUsageCount:_}=(0,be.useDispatch)(it),{closeEditorModal:C}=(0,be.useDispatch)(nt),R=(0,d.__)("Close modal","wordpress-seo"),[E,I]=(0,j.useState)(!1),[L,N]=(0,j.useState)(0),M=(0,j.useCallback)(e=>N(e.borderBoxSize[0].blockSize),[N]),P=Or(M),[A,O]=(0,j.useState)(null),F=(0,j.useCallback)(({currentSubscriptions:e,isSeoAnalysisActive:s})=>{const t=(e=>{const s=(0,be.select)(nt),t=[];return((e,s)=>(e.getIsPremium()||e.getIsWooProductEntity())&&!s.premiumSubscription)(s,e)&&t.push("Yoast SEO Premium"),((e,s)=>e.getIsWooProductEntity()&&e.getIsWooSeoActive()&&!s.wooCommerceSubscription)(s,e)&&t.push("Yoast WooCommerce SEO"),t})(e);return t.length>0?{errorCode:402,errorIdentifier:"",invalidSubscriptions:t,errorMessage:""}:s?(()=>{var e,s;const t=(0,be.select)(it);if(t.selectUsageCountStatus()!==Qs)return null;const r=t.selectUsageCountError();return{errorCode:r.errorCode,errorIdentifier:null!==(e=r.errorIdentifier)&&void 0!==e?e:"",invalidSubscriptions:[],errorMessage:null!==(s=r.errorMessage)&&void 0!==s?s:""}})():{errorCode:0,errorIdentifier:"SEO_ANALYSIS_INACTIVE",invalidSubscriptions:[],errorMessage:""}},[]),q=(0,j.useCallback)(()=>{t(oo.inactive)},[]),B=(0,j.useCallback)(()=>O(null),[]),$=(0,j.useCallback)(()=>{O(null),t(oo.generate)},[]),U=(0,j.useCallback)(()=>{O(F({currentSubscriptions:c,isSeoAnalysisActive:w})),t(oo.inactive)},[F,c,w]),W=(0,j.useCallback)(e=>{O(e),t(oo.inactive)},[]),D={onClose:q,closeButtonScreenReaderText:R},H=(0,j.useCallback)(()=>!(0===x.replace(Lr,"").trim().length),[x]),z=Qr(!1),G=(0,j.useCallback)(()=>{C(),"pre-publish"===i&&z(),setTimeout(()=>(e=>{const s=`focus-keyword-input-${["modal","pre-publish"].includes(e)?"sidebar":e}`;if("metabox"===e){const e=document.getElementById("wpseo-meta-tab-content");e&&e.click()}const t=document.getElementById(s);t&&t.focus()})(i),0)},[C,i,z]),V=(0,j.useCallback)(()=>b?y&&g:g,[g,y,b]),K=(0,j.useCallback)(async()=>{if(e(),!w)return void U();if(!H())return t(oo.inactive),void G();const s=V();if(!s&&f&&S&&b)return void U();if(!s&&f&&!b)return void U();if(!a&&(k||s))return void t(oo.askConsent);I(!0);const{type:r,payload:o}=await _({endpoint:h,isWooProductEntity:b}),i=429===(null==o?void 0:o.errorCode)&&!(null!=o&&o.errorIdentifier)&&0===(null==o?void 0:o.missingLicenses.length),n=429===(null==o?void 0:o.errorCode)&&"USAGE_LIMIT_REACHED"===(null==o?void 0:o.errorIdentifier)||o.count>=o.limit;I(!1),i?U():403!==(null==o?void 0:o.errorCode)||!k&&!s?r!==Hr||429===(null==o?void 0:o.errorCode)||403===(null==o?void 0:o.errorCode)?r===Hr&&429===(null==o?void 0:o.errorCode)&&s?U():!s&&!k||!s&&n?t(oo.upsell):(s&&a&&t(oo.generate),!s&&k&&!n&&a&&t(oo.generate)):U():t(oo.askConsent)},[e,f,k,a,w,H,G,U,h,_,S,b,E]),Y=(0,j.useCallback)(async()=>{const{type:e,payload:s}=await _({endpoint:h,isWooProductEntity:b}),r=429===(null==s?void 0:s.errorCode)||s.count>=s.limit,o=V();!r||o?e!==Hr?t(oo.generate):U():t(oo.upsell)},[t,U,h,_,V,b]),Z=(0,j.useCallback)(()=>{t(a?oo.generate:oo.askConsent)},[t,a]),Q=(0,j.useMemo)(()=>"google"===o?"title"===r?(0,d.__)("Generate SEO title","wordpress-seo"):(0,d.__)("Generate meta description","wordpress-seo"):"social"===o||"twitter"===o?"title"===r?(0,d.__)("Generate social title","wordpress-seo"):(0,d.__)("Generate social description","wordpress-seo"):void 0,[o,r]);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(X.Button,{type:"button",variant:"ai-secondary",size:"small",id:`yst-replacevar__use-ai-button__${r}__${i}`,onClick:K,disabled:u===Zs||!l,isLoading:E&&u===Zs,children:Q}),(0,T.jsxs)(ro,{...D,isOpen:[oo.askConsent,oo.upsell].includes(s),children:[s===oo.askConsent&&(0,T.jsx)(Kr,{onStartGenerating:Y}),s===oo.upsell&&(0,T.jsx)(so,{onActivateFreeSparks:Z})]}),(0,T.jsx)(to,{...D,isOpen:s===oo.generate,aiModalHelperLink:v,panelRef:P,title:n,children:s===oo.generate&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(Sr.UsageCounter,{limit:m,requests:p,isSkeleton:!1,className:"yst-absolute yst-top-[-11px] yst-end-12 sm:yst-end-16",mentionBetaInTooltip:f,mentionResetInTooltip:f}),(0,T.jsx)(eo,{height:L,onFatalError:W})]})}),A&&(0,T.jsx)(vr,{isOpen:!0,errorCode:A.errorCode,errorIdentifier:A.errorIdentifier,invalidSubscriptions:A.invalidSubscriptions,errorMessage:A.errorMessage,showActions:!0,onRetry:$,onClose:B})]})}).propTypes={onUseAi:E().func.isRequired};const io=({title:e,description:s,status:t,titleForLength:r,showPreviewSkeleton:o,showLengthProgress:i})=>{const n=(0,be.useSelect)(e=>e(nt).getSnippetEditorMode(),[]),[a,l]=(0,j.useState)(n),{editType:c}=Pr(),u=Ar(),p=(({editType:e,title:s,description:t})=>{const r=(0,be.useSelect)(e=>e(nt).getDateFromSettings(),[]),o=(0,be.useSelect)(e=>e(nt).getContentLocale(),[]),i=(0,be.useSelect)(e=>e(nt).isCornerstoneContent(),[]),n=(0,be.useSelect)(e=>e(nt).getIsTerm(),[]);return(0,j.useMemo)(()=>e===ut?(0,$r.getDescriptionProgress)(t,r,i,n,o):(0,$r.getTitleProgress)(s),[e,s,t,r,i,n,o])})({editType:c,title:r,description:s});return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)($r.ModeSwitcher,{onChange:l,active:a,id:`yst-ai-google-preview-mode-switcher-${u}`,disabled:t===yt.loading}),o?(0,T.jsx)(lo,{}):(0,T.jsx)(ao,{mode:a,title:e,description:s}),(0,T.jsxs)("div",{className:"yst-pt-4",children:[(0,T.jsx)(X.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:c===dt?(0,d.__)("SEO title width","wordpress-seo"):(0,d.__)("Meta description length","wordpress-seo")}),(0,T.jsx)(co,{className:"yst-mt-2",progress:i?p.actual:0,min:0,max:p.max,score:p.score})]})]})};io.propTypes={title:E().string.isRequired,description:E().string.isRequired,status:E().oneOf(Object.keys(yt)).isRequired,titleForLength:E().string.isRequired,showPreviewSkeleton:E().bool.isRequired,showLengthProgress:E().bool.isRequired};const no=/mobi/i,ao=({mode:e,title:s,description:t})=>{var r,o;const i=(0,be.useSelect)(e=>e(nt).getBaseUrlFromSettings(),[]),n=(0,be.useSelect)(e=>e(nt).getSnippetEditorData().slug||"",[]),a=(0,be.useSelect)(e=>e(nt).getDateFromSettings(),[]),c=(0,be.useSelect)(e=>e(nt).getFocusKeyphrase(),[]),d=(0,be.useSelect)(e=>e(nt).getSnippetEditorPreviewImageUrl(),[]),u=(0,be.useSelect)(e=>e(nt).getSiteIconUrlFromSettings(),[]),p=(0,be.useSelect)(e=>e(nt).getShoppingData(),[]),m=(0,be.useSelect)(e=>e(nt).getSnippetEditorWordsToHighlight(),[]),h=(0,be.useSelect)(e=>e(nt).getSiteName(),[]),g=(0,be.useSelect)(e=>e(nt).getContentLocale(),[]),y=(0,j.useMemo)(()=>i+n,[i,n]),x=(0,j.useMemo)(()=>{var e,s;return no.test(null===(e=window)||void 0===e||null===(s=e.navigator)||void 0===s?void 0:s.userAgent)},[null===(r=window)||void 0===r||null===(o=r.navigator)||void 0===o?void 0:o.userAgent]);return(0,T.jsx)("div",{className:`yst-ai-generator-preview-section ${e}${x?" yst-user-agent__mobile":""}`,children:(0,T.jsx)($r.SnippetPreview,{title:s,description:t,mode:e,url:y,keyword:c,date:a,faviconSrc:u,mobileImageSrc:d,wordsToHighlight:m,siteName:h,locale:g,shoppingData:p,onMouseUp:l.noop})})};ao.propTypes={mode:E().oneOf(Object.keys({mobile:"mobile",desktop:"desktop"})).isRequired,title:E().string.isRequired,description:E().string.isRequired};const lo=()=>(0,T.jsxs)("div",{className:"yst-max-w-[400px] yst-py-4 yst-px-3 yst-border yst-rounded-lg yst-w-full yst-mx-auto",children:[(0,T.jsxs)("div",{className:"yst-flex yst-gap-x-3",children:[(0,T.jsx)(X.SkeletonLoader,{className:"yst-flex-shrink-0 yst-h-7 yst-w-7 yst-rounded-full"}),(0,T.jsxs)("div",{className:"yst-flex yst-flex-col yst-w-full yst-gap-y-1",children:[(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-2.5 yst-w-10/12"})]})]}),(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-4 yst-w-full yst-mt-6 yst-mb-4"}),(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-3 yst-w-full"}),(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-3 yst-w-10/12 yst-mt-2.5"})]}),co=({className:e="",progress:s,max:t,score:r})=>{const o=(0,j.useMemo)(()=>(e=>e>=7?"yst-score-good":e>=5?"yst-score-ok":"yst-score-bad")(r),[r]);return(0,T.jsx)(X.ProgressBar,{className:Ge()("yst-length-progress-bar",o,e),progress:s,min:0,max:t})};co.propTypes={className:E().string,progress:E().number.isRequired,max:E().number.isRequired,score:E().number.isRequired};const uo=({title:e,description:s,showPreviewSkeleton:t})=>(0,T.jsxs)("div",{children:[(0,T.jsx)("div",{className:"yst-flex yst-mb-6",children:(0,T.jsx)(X.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:(0,d.__)("Social preview","wordpress-seo")})}),t?(0,T.jsx)(oi,{}):(0,T.jsx)(ri,{title:e,description:s})]});uo.propTypes={title:E().string.isRequired,description:E().string.isRequired,showPreviewSkeleton:E().bool.isRequired};const po=C().p`
color: #606770;
flex-shrink: 0;
font-size: 12px;
line-height: 16px;
overflow: hidden;
padding: 0;
text-overflow: ellipsis;
text-transform: uppercase;
white-space: nowrap;
margin: 0;
position: ${e=>"landscape"===e.mode?"relative":"static"};
`,mo=e=>{const{siteUrl:s}=e;return(0,T.jsxs)(Ae.Fragment,{children:[(0,T.jsx)("span",{className:"screen-reader-text",children:s}),(0,T.jsx)(po,{"aria-hidden":"true",children:(0,T.jsx)("span",{children:s})})]})};mo.propTypes={siteUrl:E().string.isRequired};const ho=mo,go=C().img`
&& {
max-width: ${e=>e.width}px;
height: ${e=>e.height}px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: none;
}
`,yo=C().img`
&& {
height: 100%;
position: absolute;
width: 100%;
object-fit: cover;
}
`,xo=C().div`
padding-bottom: ${e=>e.aspectRatio}%;
`,fo=({imageProps:e,width:s,height:t,imageMode:r="landscape"})=>"landscape"===r?(0,T.jsx)(xo,{aspectRatio:e.aspectRatio,children:(0,T.jsx)(yo,{src:e.src,alt:e.alt})}):(0,T.jsx)(go,{src:e.src,alt:e.alt,width:s,height:t,imageProperties:e});function wo(e,s,t){return"landscape"===t?{widthRatio:s.width/e.landscapeWidth,heightRatio:s.height/e.landscapeHeight}:"portrait"===t?{widthRatio:s.width/e.portraitWidth,heightRatio:s.height/e.portraitHeight}:{widthRatio:s.width/e.squareWidth,heightRatio:s.height/e.squareHeight}}function vo(e,s){return s.widthRatio<=s.heightRatio?{width:Math.round(e.width/s.widthRatio),height:Math.round(e.height/s.widthRatio)}:{width:Math.round(e.width/s.heightRatio),height:Math.round(e.height/s.heightRatio)}}async function bo(e,s,t=!1){const r=await function(e){return new Promise((s,t)=>{const r=new Image;r.onload=()=>{s({width:r.width,height:r.height})},r.onerror=t,r.src=e})}(e);let o=t?"landscape":"square";"Facebook"===s&&(o=(0,ne.determineFacebookImageMode)(r));const i=function(e){return"Twitter"===e?ne.TWITTER_IMAGE_SIZES:ne.FACEBOOK_IMAGE_SIZES}(s),n=function(e,s,t){return"square"===t&&s.width===s.height?{width:e.squareWidth,height:e.squareHeight}:vo(s,wo(e,s,t))}(i,r,o);return{mode:o,height:n.height,width:n.width}}async function ko(e,s,t=!1){try{return{imageProperties:await bo(e,s,t),status:"loaded"}}catch(e){return{imageProperties:null,status:"errored"}}}fo.propTypes={imageProps:E().shape({src:E().string.isRequired,alt:E().string.isRequired,aspectRatio:E().number.isRequired}).isRequired,width:E().number.isRequired,height:E().number.isRequired,imageMode:E().string};const So=C().div`
position: relative;
${e=>"landscape"===e.mode?`max-width: ${e.dimensions.width}`:`min-width: ${e.dimensions.width}; height: ${e.dimensions.height}`};
overflow: hidden;
background-color: ${N.colors.$color_white};
`,jo=C().div`
box-sizing: border-box;
max-width: ${ne.FACEBOOK_IMAGE_SIZES.landscapeWidth}px;
height: ${ne.FACEBOOK_IMAGE_SIZES.landscapeHeight}px;
background-color: ${N.colors.$color_grey};
border-style: dashed;
border-width: 1px;
// We're not using standard colors to increase contrast for accessibility.
color: #006DAC;
// We're not using standard colors to increase contrast for accessibility.
background-color: #f1f1f1;
display: flex;
justify-content: center;
align-items: center;
text-decoration: underline;
font-size: 14px;
cursor: pointer;
`;class _o extends Ae.Component{constructor(e){super(e),this.state={imageProperties:null,status:"loading"},this.socialMedium="Facebook",this.handleFacebookImage=this.handleFacebookImage.bind(this),this.setState=this.setState.bind(this)}async handleFacebookImage(){try{const e=await ko(this.props.src,this.socialMedium);this.setState(e),this.props.onImageLoaded(e.imageProperties.mode||"landscape")}catch(e){this.setState(e),this.props.onImageLoaded("landscape")}}componentDidUpdate(e){e.src!==this.props.src&&this.handleFacebookImage()}componentDidMount(){this.handleFacebookImage()}retrieveContainerDimensions(e){switch(e){case"square":return{height:ne.FACEBOOK_IMAGE_SIZES.squareHeight+"px",width:ne.FACEBOOK_IMAGE_SIZES.squareWidth+"px"};case"portrait":return{height:ne.FACEBOOK_IMAGE_SIZES.portraitHeight+"px",width:ne.FACEBOOK_IMAGE_SIZES.portraitWidth+"px"};case"landscape":return{height:ne.FACEBOOK_IMAGE_SIZES.landscapeHeight+"px",width:ne.FACEBOOK_IMAGE_SIZES.landscapeWidth+"px"}}}render(){const{imageProperties:e,status:s}=this.state;if("loading"===s||""===this.props.src||"errored"===s)return(0,T.jsx)(jo,{onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,d.__)("Select image","wordpress-seo")});const t=this.retrieveContainerDimensions(e.mode);return(0,T.jsx)(So,{mode:e.mode,dimensions:t,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,onClick:this.props.onImageClick,children:(0,T.jsx)(fo,{imageProps:{src:this.props.src,alt:this.props.alt,aspectRatio:ne.FACEBOOK_IMAGE_SIZES.aspectRatio},width:e.width,height:e.height,imageMode:e.mode})})}}_o.propTypes={src:E().string,alt:E().string,onImageLoaded:E().func,onImageClick:E().func,onMouseEnter:E().func,onMouseLeave:E().func},_o.defaultProps={src:"",alt:"",onImageLoaded:l.noop,onImageClick:l.noop,onMouseEnter:l.noop,onMouseLeave:l.noop};const Co=_o,Ro=C().span`
line-height: ${20}px;
min-height : ${20}px;
color: #1d2129;
font-weight: 600;
overflow: hidden;
font-size: 16px;
margin: 3px 0 0;
letter-spacing: normal;
white-space: normal;
flex-shrink: 0;
cursor: pointer;
display: -webkit-box;
-webkit-line-clamp: ${e=>e.lineCount};
-webkit-box-orient: vertical;
overflow: hidden;
`,Eo=C().p`
line-height: ${16}px;
min-height : ${16}px;
color: #606770;
font-size: 14px;
padding: 0;
text-overflow: ellipsis;
margin: 3px 0 0 0;
display: -webkit-box;
cursor: pointer;
-webkit-line-clamp: ${e=>e.lineCount};
-webkit-box-orient: vertical;
overflow: hidden;
@media all and ( max-width: ${e=>e.maxWidth} ) {
display: none;
}
`,Io=e=>{switch(e){case"landscape":return"527px";case"square":case"portrait":return"369px";default:return"476px"}},Lo=C().div`
box-sizing: border-box;
display: flex;
flex-direction: ${e=>"landscape"===e.mode?"column":"row"};
background-color: #f2f3f5;
max-width: 527px;
`,No=C().div`
box-sizing: border-box;
background-color: #f2f3f5;
margin: 0;
padding: 10px 12px;
position: relative;
border-bottom: ${e=>"landscape"===e.mode?"":"1px solid #dddfe2"};
border-top: ${e=>"landscape"===e.mode?"":"1px solid #dddfe2"};
border-right: ${e=>"landscape"===e.mode?"":"1px solid #dddfe2"};
border: ${e=>"landscape"===e.mode?"1px solid #dddfe2":""};
display: flex;
flex-direction: column;
flex-grow: 1;
justify-content: ${e=>"landscape"===e.mode?"flex-start":"center"};
font-size: 12px;
overflow: hidden;
`;class To extends Ae.Component{constructor(e){super(e),this.state={imageMode:null,maxLineCount:0,descriptionLineCount:0},this.facebookTitleRef=Oe().createRef(),this.onImageLoaded=this.onImageLoaded.bind(this),this.onImageEnter=this.props.onMouseHover.bind(this,"image"),this.onTitleEnter=this.props.onMouseHover.bind(this,"title"),this.onDescriptionEnter=this.props.onMouseHover.bind(this,"description"),this.onLeave=this.props.onMouseHover.bind(this,""),this.onSelectTitle=this.props.onSelect.bind(this,"title"),this.onSelectDescription=this.props.onSelect.bind(this,"description")}onImageLoaded(e){this.setState({imageMode:e})}getTitleLineCount(){return this.facebookTitleRef.current.offsetHeight/20}maybeSetMaxLineCount(){const{imageMode:e,maxLineCount:s}=this.state,t="landscape"===e?2:5;t!==s&&this.setState({maxLineCount:t})}maybeSetDescriptionLineCount(){const{descriptionLineCount:e,maxLineCount:s,imageMode:t}=this.state,r=this.getTitleLineCount();let o=s-r;"portrait"===t&&(o=5===r?0:4),o!==e&&this.setState({descriptionLineCount:o})}componentDidUpdate(){this.maybeSetMaxLineCount(),this.maybeSetDescriptionLineCount()}render(){const{imageMode:e,maxLineCount:s,descriptionLineCount:t}=this.state;return(0,T.jsxs)(Lo,{id:"facebookPreview",mode:e,children:[(0,T.jsx)(Co,{src:this.props.imageUrl||this.props.imageFallbackUrl,alt:this.props.alt,onImageLoaded:this.onImageLoaded,onImageClick:this.props.onImageClick,onMouseEnter:this.onImageEnter,onMouseLeave:this.onLeave}),(0,T.jsxs)(No,{mode:e,children:[(0,T.jsx)(ho,{siteUrl:this.props.siteUrl,mode:e}),(0,T.jsx)(Ro,{ref:this.facebookTitleRef,onMouseEnter:this.onTitleEnter,onMouseLeave:this.onLeave,onClick:this.onSelectTitle,lineCount:s,children:this.props.title}),t>0&&(0,T.jsx)(Eo,{maxWidth:Io(e),onMouseEnter:this.onDescriptionEnter,onMouseLeave:this.onLeave,onClick:this.onSelectDescription,lineCount:t,children:this.props.description})]})]})}}To.propTypes={siteUrl:E().string.isRequired,title:E().string.isRequired,description:E().string,imageUrl:E().string,imageFallbackUrl:E().string,alt:E().string,onSelect:E().func,onImageClick:E().func,onMouseHover:E().func},To.defaultProps={description:"",alt:"",imageUrl:"",imageFallbackUrl:"",onSelect:()=>{},onImageClick:()=>{},onMouseHover:()=>{}};const Mo=To,Po=C().div`
text-transform: lowercase;
color: rgb(83, 100, 113);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0;
fill: currentcolor;
display: flex;
flex-direction: row;
align-items: flex-end;
`,Ao=e=>(0,T.jsx)(Po,{children:(0,T.jsx)("span",{children:e.siteUrl})});Ao.propTypes={siteUrl:E().string.isRequired};const Oo=Ao,Fo=(e,s=!0)=>e?`\n\t\t\tmax-width: ${ne.TWITTER_IMAGE_SIZES.landscapeWidth}px;\n\t\t\t${s?"border-bottom: 1px solid #E1E8ED;":""}\n\t\t\tborder-radius: 14px 14px 0 0;\n\t\t\t`:`\n\t\twidth: ${ne.TWITTER_IMAGE_SIZES.squareWidth}px;\n\t\t${s?"border-right: 1px solid #E1E8ED;":""}\n\t\tborder-radius: 14px 0 0 14px;\n\t\t`,qo=C().div`
position: relative;
box-sizing: content-box;
overflow: hidden;
background-color: #e1e8ed;
flex-shrink: 0;
${e=>Fo(e.isLarge)}
`,Bo=C().div`
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
max-width: 100%;
margin: 0;
padding: 1em;
text-align: center;
font-size: 1rem;
${e=>Fo(e.isLarge,!1)}
`,$o=C()(Bo)`
${e=>e.isLarge&&`height: ${ne.TWITTER_IMAGE_SIZES.landscapeHeight}px;`}
border-top-left-radius: 14px;
${e=>e.isLarge?"border-top-right-radius":"border-bottom-left-radius"}: 14px;
border-style: dashed;
border-width: 1px;
// We're not using standard colors to increase contrast for accessibility.
color: #006DAC;
// We're not using standard colors to increase contrast for accessibility.
background-color: #f1f1f1;
text-decoration: underline;
font-size: 14px;
cursor: pointer;
`;class Uo extends Oe().Component{constructor(e){super(e),this.state={status:"loading"},this.socialMedium="Twitter",this.handleTwitterImage=this.handleTwitterImage.bind(this),this.setState=this.setState.bind(this)}async handleTwitterImage(){if(null===this.props.src)return;const e=await ko(this.props.src,this.socialMedium,this.props.isLarge);this.setState(e)}componentDidUpdate(e){e.src!==this.props.src&&this.handleTwitterImage()}componentDidMount(){this.handleTwitterImage()}render(){const{status:e,imageProperties:s}=this.state;return"loading"===e||""===this.props.src||"errored"===e?(0,T.jsx)($o,{isLarge:this.props.isLarge,onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,d.__)("Select image","wordpress-seo")}):(0,T.jsx)(qo,{isLarge:this.props.isLarge,onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,T.jsx)(fo,{imageProps:{src:this.props.src,alt:this.props.alt,aspectRatio:ne.TWITTER_IMAGE_SIZES.aspectRatio},width:s.width,height:s.height,imageMode:s.mode})})}}Uo.propTypes={isLarge:E().bool.isRequired,src:E().string,alt:E().string,onImageClick:E().func,onMouseEnter:E().func,onMouseLeave:E().func},Uo.defaultProps={src:"",alt:"",onMouseEnter:l.noop,onImageClick:l.noop,onMouseLeave:l.noop};const Wo=C().div`
display: flex;
flex-direction: column;
padding: 12px;
justify-content: center;
margin: 0;
box-sizing: border-box;
flex: auto;
min-width: 0px;
gap:2px;
> * {
line-height:20px;
min-height:20px;
font-size:15px;
}
`,Do=e=>(0,T.jsx)(Wo,{children:e.children});Do.propTypes={children:E().array.isRequired};const Ho=Do,zo=C().p`
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0;
color: rgb(15, 20, 25);
cursor: pointer;
`,Go=C().p`
max-height: 55px;
overflow: hidden;
text-overflow: ellipsis;
margin: 0;
color: rgb(83, 100, 113);
display: -webkit-box;
cursor: pointer;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
@media all and ( max-width: ${ne.TWITTER_IMAGE_SIZES.landscapeWidth}px ) {
display: none;
}
`,Vo=C().div`
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
font-size: 15px;
font-weight: 400;
line-height: 20px;
max-width: 507px;
border: 1px solid #E1E8ED;
box-sizing: border-box;
border-radius: 14px;
color: #292F33;
background: #FFFFFF;
text-overflow: ellipsis;
display: flex;
&:hover {
background: #f5f8fa;
border: 1px solid rgba(136,153,166,.5);
}
`,Ko=C()(Vo)`
flex-direction: column;
max-height: 370px;
`,Yo=C()(Vo)`
flex-direction: row;
height: 125px;
`;class Zo extends Ae.Component{constructor(e){super(e),this.onImageEnter=this.props.onMouseHover.bind(this,"image"),this.onTitleEnter=this.props.onMouseHover.bind(this,"title"),this.onDescriptionEnter=this.props.onMouseHover.bind(this,"description"),this.onLeave=this.props.onMouseHover.bind(this,""),this.onSelectTitle=this.props.onSelect.bind(this,"title"),this.onSelectDescription=this.props.onSelect.bind(this,"description")}render(){const{isLarge:e,imageUrl:s,imageFallbackUrl:t,alt:r,title:o,description:i,siteUrl:n}=this.props,a=e?Ko:Yo;return(0,T.jsxs)(a,{id:"twitterPreview",children:[(0,T.jsx)(Uo,{src:s||t,alt:r,isLarge:e,onImageClick:this.props.onImageClick,onMouseEnter:this.onImageEnter,onMouseLeave:this.onLeave}),(0,T.jsxs)(Ho,{children:[(0,T.jsx)(Oo,{siteUrl:n}),(0,T.jsx)(zo,{onMouseEnter:this.onTitleEnter,onMouseLeave:this.onLeave,onClick:this.onSelectTitle,children:o}),(0,T.jsx)(Go,{onMouseEnter:this.onDescriptionEnter,onMouseLeave:this.onLeave,onClick:this.onSelectDescription,children:i})]})]})}}Zo.propTypes={siteUrl:E().string.isRequired,title:E().string.isRequired,description:E().string,isLarge:E().bool,imageUrl:E().string,imageFallbackUrl:E().string,alt:E().string,onSelect:E().func,onImageClick:E().func,onMouseHover:E().func},Zo.defaultProps={description:"",alt:"",imageUrl:"",imageFallbackUrl:"",onSelect:()=>{},onImageClick:()=>{},onMouseHover:()=>{},isLarge:!0};const Qo=Zo,Xo=window.yoast.replacementVariableEditor;class Jo extends Ae.Component{constructor(e){super(e),this.state={activeField:"",hoveredField:""},this.SocialPreview="Social"===e.socialMediumName?Mo:Qo,this.setHoveredField=this.setHoveredField.bind(this),this.setActiveField=this.setActiveField.bind(this),this.setEditorRef=this.setEditorRef.bind(this),this.setEditorFocus=this.setEditorFocus.bind(this)}setHoveredField(e){e!==this.state.hoveredField&&this.setState({hoveredField:e})}setActiveField(e){e!==this.state.activeField&&this.setState({activeField:e},()=>this.setEditorFocus(e))}setEditorFocus(e){switch(e){case"title":this.titleEditorRef.focus();break;case"description":this.descriptionEditorRef.focus()}}setEditorRef(e,s){switch(e){case"title":this.titleEditorRef=s;break;case"description":this.descriptionEditorRef=s}}render(){const{onDescriptionChange:e,onTitleChange:s,onSelectImageClick:t,onRemoveImageClick:r,socialMediumName:o,imageWarnings:i,siteUrl:n,description:a,descriptionInputPlaceholder:l,descriptionPreviewFallback:c,imageUrl:d,imageFallbackUrl:u,alt:p,title:m,titleInputPlaceholder:h,titlePreviewFallback:g,replacementVariables:y,recommendedReplacementVariables:x,applyReplacementVariables:f,onReplacementVariableSearchChange:w,isPremium:v,isLarge:b,socialPreviewLabel:k,idSuffix:S,activeMetaTabId:j}=this.props,_=f({title:m||g,description:a||c});return(0,T.jsxs)(Oe().Fragment,{children:[k&&(0,T.jsx)(I.SimulatedLabel,{children:k}),(0,T.jsx)(this.SocialPreview,{onMouseHover:this.setHoveredField,onSelect:this.setActiveField,onImageClick:t,siteUrl:n,title:_.title,description:_.description,imageUrl:d,imageFallbackUrl:u,alt:p,isLarge:b,activeMetaTabId:j}),(0,T.jsx)(ne.SocialMetadataPreviewForm,{onDescriptionChange:e,socialMediumName:o,title:m,titleInputPlaceholder:h,onRemoveImageClick:r,imageSelected:!!d,imageUrl:d,imageFallbackUrl:u,onTitleChange:s,onSelectImageClick:t,description:a,descriptionInputPlaceholder:l,imageWarnings:i,replacementVariables:y,recommendedReplacementVariables:x,onReplacementVariableSearchChange:w,onMouseHover:this.setHoveredField,hoveredField:this.state.hoveredField,onSelect:this.setActiveField,activeField:this.state.activeField,isPremium:v,setEditorRef:this.setEditorRef,idSuffix:S})]})}}Jo.propTypes={title:E().string.isRequired,onTitleChange:E().func.isRequired,description:E().string.isRequired,onDescriptionChange:E().func.isRequired,imageUrl:E().string.isRequired,imageFallbackUrl:E().string.isRequired,onSelectImageClick:E().func.isRequired,onRemoveImageClick:E().func.isRequired,socialMediumName:E().string.isRequired,alt:E().string,isPremium:E().bool,imageWarnings:E().array,isLarge:E().bool,siteUrl:E().string,descriptionInputPlaceholder:E().string,titleInputPlaceholder:E().string,descriptionPreviewFallback:E().string,titlePreviewFallback:E().string,replacementVariables:Xo.replacementVariablesShape,recommendedReplacementVariables:Xo.recommendedReplacementVariablesShape,applyReplacementVariables:E().func,onReplacementVariableSearchChange:E().func,socialPreviewLabel:E().string,idSuffix:E().string,activeMetaTabId:E().string},Jo.defaultProps={imageWarnings:[],recommendedReplacementVariables:[],replacementVariables:[],isPremium:!1,isLarge:!0,siteUrl:"",descriptionInputPlaceholder:"",titleInputPlaceholder:"",descriptionPreviewFallback:"",titlePreviewFallback:"",alt:"",applyReplacementVariables:e=>e,onReplacementVariableSearchChange:null,socialPreviewLabel:"",idSuffix:"",activeMetaTabId:""};const ei={},si=(e,s,{log:t=console.warn}={})=>{ei[e]||(ei[e]=!0,t(s))},ti=(e,s=l.noop)=>{const t={};for(const r in e)Object.hasOwn(e,r)&&Object.defineProperty(t,r,{set:t=>{e[r]=t,s("set",r,t)},get:()=>(s("get",r),e[r])});return t};ti({squareWidth:125,squareHeight:125,landscapeWidth:506,landscapeHeight:265,aspectRatio:50.2},(e,s)=>si(`@yoast/social-metadata-previews/TWITTER_IMAGE_SIZES/${e}/${s}`,`[@yoast/social-metadata-previews] "TWITTER_IMAGE_SIZES.${s}" is deprecated and will be removed in the future, please use this from @yoast/social-metadata-forms instead.`)),ti({squareWidth:158,squareHeight:158,landscapeWidth:527,landscapeHeight:273,portraitWidth:158,portraitHeight:237,aspectRatio:52.2,largeThreshold:{width:446,height:233}},(e,s)=>si(`@yoast/social-metadata-previews/FACEBOOK_IMAGE_SIZES/${e}/${s}`,`[@yoast/social-metadata-previews] "FACEBOOK_IMAGE_SIZES.${s}" is deprecated and will be removed in the future, please use this from @yoast/social-metadata-forms instead.`));const ri=({title:e,description:s})=>{const t=(0,be.useSelect)(e=>e(nt).getSiteUrl(),[]),r=(0,be.useSelect)(e=>e(nt).getFacebookImageUrl(),[]),o=(0,be.useSelect)(e=>e(nt).getEditorDataImageFallback(),[]),i=(0,be.useSelect)(e=>e(nt).getFacebookAltText(),[]);return(0,T.jsx)("div",{className:"yst-ai-generator-preview-section",children:(0,T.jsx)(Mo,{title:e,description:s,siteUrl:t,imageUrl:r,imageFallbackUrl:o,alt:i,onSelect:l.noop,onImageClick:l.noop,onMouseHover:l.noop})})};ri.propTypes={title:E().string.isRequired,description:E().string.isRequired};const oi=()=>(0,T.jsxs)("div",{className:"yst-flex yst-flex-col yst-w-[527px] yst-border yst-mx-auto",children:[(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-[273px] yst-w-full yst-rounded-none yst-border yst-border-dashed"}),(0,T.jsxs)("div",{className:"yst-w-full yst-p-4 yst-space-y-1",children:[(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-5 yst-w-10/12"}),(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-3 yst-w-full"})]})]}),ii=()=>(0,T.jsxs)(X.Alert,{variant:"error",children:[(0,T.jsx)("span",{className:"yst-block yst-font-medium",children:ur}),(0,T.jsx)(pr,{})]}),ni=({children:e,onRetry:s})=>{const{onClose:t}=(0,X.useModalContext)();return(0,T.jsxs)(j.Fragment,{children:[e,(0,T.jsxs)("div",{className:"yst-mt-6 yst-mb-1 yst-flex yst-space-x-3 rtl:yst-space-x-reverse yst-place-content-end",children:[(0,T.jsx)(X.Button,{variant:"secondary",onClick:t,children:(0,d.__)("Close","wordpress-seo")}),(0,T.jsx)(X.Button,{variant:"primary",onClick:s,children:(0,d.__)("Try again","wordpress-seo")})]})]})};ni.propTypes={children:E().node.isRequired,onRetry:E().func.isRequired};const ai=({errorCode:e,errorIdentifier:s,invalidSubscriptions:t=[],showActions:r=!1,onRetry:o=l.noop,errorMessage:i=""})=>{switch(e){case 400:switch(s){case"AI_CONTENT_FILTER":return(0,T.jsx)(Ht,{});case"NOT_ENOUGH_CONTENT":return(0,T.jsx)(Rt,{});case"SITE_UNREACHABLE":return(0,T.jsx)(ii,{});case"WP_HTTP_REQUEST_ERROR":return r?(0,T.jsx)(ni,{onRetry:o,children:(0,T.jsx)(Vt,{errorMessage:i})}):(0,T.jsx)(Vt,{errorMessage:i});default:return r?(0,T.jsx)(ni,{onRetry:o,children:(0,T.jsx)(jt,{})}):(0,T.jsx)(jt,{})}case 402:return(0,T.jsx)(qt,{invalidSubscriptions:t});case 408:return r?(0,T.jsx)(ni,{onRetry:o,children:(0,T.jsx)(Ut,{})}):(0,T.jsx)(Ut,{});case 429:return"USAGE_LIMIT_REACHED"===s?(0,T.jsx)(qt,{invalidSubscriptions:t}):(0,T.jsx)(Mt,{});case 410:return(0,T.jsx)(Zt,{});default:return r?(0,T.jsx)(ni,{onRetry:o,children:(0,T.jsx)(jt,{})}):(0,T.jsx)(jt,{})}};ai.propTypes={errorCode:E().number.isRequired,errorIdentifier:E().string.isRequired,invalidSubscriptions:E().array,showActions:E().bool,onRetry:E().func,errorMessage:E().string};const li=E().shape({value:E().string.isRequired,label:E().node.isRequired}),ci=({id:e,name:s,suggestion:t,isChecked:r,onChange:o})=>{const i=(0,j.useCallback)(()=>o(t.value),[t,o]);return(0,T.jsxs)("label",{htmlFor:e,className:Ge()("yst-flex yst-p-4 yst-items-center yst-border first:yst-rounded-t-md last:yst-rounded-b-md",r&&"yst-z-10 yst-border-primary-500"),children:[(0,T.jsx)("input",{type:"radio",id:e,name:s,className:"yst-radio__input",value:t.value,checked:r,onChange:i}),(0,T.jsx)("div",{className:Ge()("yst-label yst-radio__label yst-flex yst-flex-wrap yst-items-center",!r&&"yst-text-slate-600"),children:t.label})]})};ci.propTypes={id:E().string.isRequired,name:E().string.isRequired,suggestion:li.isRequired,isChecked:E().bool.isRequired,onChange:E().func.isRequired};const di=({idSuffix:e,suggestions:s,selected:t,onChange:r})=>(0,T.jsx)("div",{children:(0,T.jsx)(X.RadioGroup,{className:"yst-suggestions-radio-group yst-flex yst-flex-col",id:`yst-ai-suggestions-radio-group__${e}`,children:s.map((s,o)=>(0,T.jsx)(ci,{id:`yst-ai-suggestions-radio-${e}__${o}`,name:`ai-suggestion__${e}`,isChecked:s.value===t,onChange:r,suggestion:s},`yst-ai-suggestions-radio-${e}__${o}`))})});di.propTypes={idSuffix:E().string.isRequired,suggestions:E().arrayOf(li).isRequired,selected:E().string.isRequired,onChange:E().func.isRequired};const ui=[["yst-h-3 yst-w-full","yst-mt-2.5 yst-h-3 yst-w-9/12"],["yst-h-3 yst-w-full","yst-mt-2.5 yst-h-3 yst-w-7/12"],["yst-h-3 yst-w-full","yst-mt-2.5 yst-h-3 yst-w-10/12"],["yst-h-3 yst-w-full","yst-mt-2.5 yst-h-3 yst-w-11/12"],["yst-h-3 yst-w-full","yst-mt-2.5 yst-h-3 yst-w-8/12"]],pi=({suggestionClassNames:e=ui})=>(0,T.jsx)("div",{className:"yst-flex yst-flex-col yst--space-y-[1px]",children:e.map((e,s)=>(0,T.jsxs)("div",{className:"yst-flex yst-p-4 yst-gap-x-3 yst-items-center yst-border first:yst-rounded-t-md last:yst-rounded-b-md",children:[(0,T.jsx)("input",{type:"radio",disabled:!0,className:"yst-my-0.5"}),(0,T.jsx)("div",{className:"yst-flex yst-flex-col yst-w-full",children:e.map((e,t)=>(0,T.jsx)(X.SkeletonLoader,{className:e},`yst-ai-suggestion-radio-skeleton-${s}__${t}`))})]},`yst-ai-suggestion-radio-skeleton__${s}`))});pi.propTypes={suggestionClassNames:E().arrayOf(E().arrayOf(E().string))};const mi="ai_generator_tip_notification",hi=()=>{const e=(0,be.useSelect)(e=>e(nt).isAlertDismissed(mi),[]),s=(0,be.useSelect)(e=>e(nt).getEditorDataContent(),[]),t=(0,be.useSelect)(e=>e(nt).getIsWooProductEntity(),[]),[r,,,o]=(0,X.useToggleState)(!1),{editType:i,contentType:n}=Pr(),{dismissAlert:a}=(0,be.useDispatch)(nt),l=(0,j.useCallback)(()=>{a(mi)},[a]),c=(0,j.useMemo)(()=>i===ut?(0,d.__)("%1$sTip%2$s: Improve the accuracy of your generated AI descriptions by writing more content in your page.","wordpress-seo"):(0,d.__)("%1$sTip%2$s: Improve the accuracy of your generated AI titles by writing more content in your page.","wordpress-seo")
/* translators: %1$s and %2$s expand to opening and closing of a span in order to emphasise the word. */,[i]),p=(0,j.useMemo)(()=>((e,s)=>e||s===mt?150:300)(t,n),[n,t]),m=(0,j.useMemo)(()=>(e=>u.languageProcessing.sanitizeString(e||"").length)(s),[s]);return e||r||m>p?null:(0,T.jsxs)(X.Notifications.Notification,{id:"ai-generator-content-tip",variant:"info",dismissScreenReaderLabel:(0,d.__)("Dismiss","wordpress-seo"),children:[Te((0,d.sprintf)(c,"",""),{span:(0,T.jsx)("span",{className:"yst-font-medium yst-text-slate-800"})}),(0,T.jsxs)("div",{className:"yst-flex yst-mt-3 yst--ms-3 yst-gap-1",children:[(0,T.jsx)(X.Button,{type:"button",variant:"tertiary",onClick:l,children:(0,d.__)("Don’t show again","wordpress-seo")}),(0,T.jsx)(X.Button,{type:"button",variant:"tertiary",className:"yst-text-slate-800",onClick:o,children:(0,d.__)("Dismiss","wordpress-seo")})]})]})},gi=({title:e,description:s,showPreviewSkeleton:t})=>(0,T.jsxs)("div",{children:[(0,T.jsx)("div",{className:"yst-flex yst-mb-6",children:(0,T.jsx)(X.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:(0,d.__)("X preview","wordpress-seo")})}),t?(0,T.jsx)(xi,{}):(0,T.jsx)(yi,{title:e,description:s})]});gi.propTypes={title:E().string.isRequired,description:E().string.isRequired,showPreviewSkeleton:E().bool.isRequired};const yi=({title:e,description:s})=>{const t=(0,be.useSelect)(e=>e(nt).getSiteUrl(),[]),r=(0,be.useSelect)(e=>e(nt).getTwitterImageUrl(),[]),o=(0,be.useSelect)(e=>e(nt).getFacebookImageUrl(),[]),i=(0,be.useSelect)(e=>e(nt).getEditorDataImageFallback(),[]),n=(0,be.useSelect)(e=>e(nt).getTwitterImageType(),[]),a=(0,be.useSelect)(e=>e(nt).getTwitterAltText(),[]);return(0,T.jsx)("div",{className:"yst-ai-generator-preview-section",children:(0,T.jsx)(Qo,{title:e,description:s,siteUrl:t,imageUrl:r,imageFallbackUrl:o||i,isLarge:"summary"!==n,alt:a,onSelect:l.noop,onImageClick:l.noop,onMouseHover:l.noop})})};yi.propTypes={title:E().string.isRequired,description:E().string.isRequired};const xi=()=>(0,T.jsxs)("div",{className:"yst-flex yst-flex-col yst-max-h-[370px] yst-w-[507px] yst-border yst-rounded-t-[14px] yst-overflow-hidden yst-mx-auto",children:[(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-[265px] yst-w-full yst-rounded-none yst-border yst-border-dashed"}),(0,T.jsxs)("div",{className:"yst-w-full yst-p-4 yst-space-y-1",children:[(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-5 yst-w-10/12"}),(0,T.jsx)(X.SkeletonLoader,{className:"yst-h-3 yst-w-full"})]})]}),fi="yst-mt-1 yst-mb-3",wi="yst-flex yst-justify-end yst--me-8 yst-gap-3 yst--ms-2",vi=({onClose:e})=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("p",{className:fi,children:(0,d.__)("As long as this is a beta feature, you get unlimited sparks.","wordpress-seo")}),(0,T.jsx)("div",{className:wi,children:(0,T.jsx)(X.Button,{type:"button",variant:"primary",size:"small",onClick:e,children:(0,d.__)("Got it!","wordpress-seo")})})]}),bi=({onClose:e,upsellLink:s,isWooProductEntity:t=!1,ctbId:r="f6a84663-465f-4cb5-8ba5-f7a6d72224b2"})=>{const o=(0,X.useSvgAria)();return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("p",{className:fi,children:(0,d.sprintf)(/* translators: %s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */ /* translators: %s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */
(0,d.__)("Keep the momentum going, unlock unlimited sparks with %s!","wordpress-seo"),t?"Yoast WooCommerce SEO":"Yoast SEO Premium")}),(0,T.jsxs)("div",{className:wi,children:[(0,T.jsx)(X.Button,{type:"button",variant:"tertiary",size:"small",onClick:e,children:(0,d.__)("Close","wordpress-seo")}),(0,T.jsxs)(X.Button,{as:"a",size:"small",variant:"upsell",href:s,target:"_blank",rel:"noopener noreferrer","data-action":"load-nfd-ctb","data-ctb-id":r,children:[(0,T.jsx)($e(),{className:"yst-w-4 yst-h-4 yst--ms-1 yst-me-2 yst-shrink-0",...o}),(0,d.sprintf)(/* translators: %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */ /* translators: %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */
(0,d.__)("Unlock with %1$s","wordpress-seo"),t?"Yoast WooCommerce SEO":"Yoast SEO Premium"),(0,T.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
(0,d.__)("(Opens in a new browser tab)","wordpress-seo")})]})]})]})},ki=({className:e=""})=>{const{isUsageCountLimitReached:s,usageCount:t,usageCountLimit:r,premiumUpsellLink:o,wooUpsellLink:i,isWooProductEntity:n,hasValidPremiumSubscription:a,hasValidWooSubscription:l}=(0,be.useSelect)(e=>{const s=e(it),t=e(nt);return{isUsageCountLimitReached:s.isUsageCountLimitReached(),usageCount:s.selectUsageCount(),usageCountLimit:s.selectUsageCountLimit(),premiumUpsellLink:t.selectLink("https://yoa.st/ai-toast-out-of-free-sparks"),wooUpsellLink:t.selectLink("https://yoa.st/ai-toast-out-of-free-sparks-woo"),isWooProductEntity:t.getIsWooProductEntity(),hasValidPremiumSubscription:s.selectPremiumSubscription(),hasValidWooSubscription:s.selectWooCommerceSubscription()}},[]),c=(0,j.useMemo)(()=>a&&!n||n&&l&&a,[a,n,l]),[u,,p,,m]=(0,X.useToggleState)(t===r),h=Math.max(0,r-t);(0,j.useEffect)(()=>{p(c&&t===r||!c&&h<=5)},[t,r,c,s]);const g=(0,j.useMemo)(()=>n?i:o,[n,i,o]),y=(0,j.useMemo)(()=>n&&!l,[n,l]);return u&&(0,T.jsx)(X.Notifications.Notification,{id:"ai-sparks-limit",className:e,variant:"info",dismissScreenReaderLabel:(0,d.__)("Close","wordpress-seo"),title:c?(0,d.sprintf)(/* translators: %s is the number of the sparks. */ /* translators: %s is the number of the sparks. */
(0,d._n)("You've used %s spark this month.","You've used %s sparks this month.",t,"wordpress-seo"),t):h<=5&&!s?(0,d.sprintf)(/* translators: %s is the number of the sparks. */ /* translators: %s is the number of the sparks. */
(0,d._n)("%s free spark left!","%s free sparks left!",h,"wordpress-seo"),h):(0,d.__)("You're out of free sparks!","wordpress-seo"),size:c?"default":"large",children:c?(0,T.jsx)(vi,{onClose:m}):(0,T.jsx)(bi,{onClose:m,upsellLink:g,isWooUpsell:y})})},Si=({errorCode:e,errorIdentifier:s="",errorMessage:t=""})=>{switch(e){case 400:switch(s){case"SITE_UNREACHABLE":return(0,T.jsx)(ii,{});case"WP_HTTP_REQUEST_ERROR":return(0,T.jsx)(Vt,{errorMessage:t});default:return(0,T.jsx)(jt,{})}case 429:return(0,T.jsx)(Mt,{});default:return(0,T.jsx)(jt,{})}};Si.propTypes={errorCode:E().number.isRequired,errorIdentifier:E().string,errorMessage:E().string};const ji=({currentSubscriptions:e,isSeoAnalysisActive:s=!0})=>{const{isPremium:t,usageCountStatus:r,usageCountError:o,isWooProductEntity:i,isWooSeoActive:n}=(0,be.useSelect)(e=>{const s=e(nt);return{isPremium:s.getIsPremium(),usageCountStatus:e(it).selectUsageCountStatus(),usageCountError:e(it).selectUsageCountError(),isWooProductEntity:s.getIsWooProductEntity(),isWooSeoActive:s.getIsWooSeoActive()}},[]),a=(0,j.useMemo)(()=>!e.wooCommerceSubscription&&i,[e.wooCommerceSubscription]),l=(0,j.useMemo)(()=>{const s=[];return!t&&!i||e.premiumSubscription||s.push("Yoast SEO Premium"),a&&n&&s.push("Yoast WooCommerce SEO"),s},[t,e.premiumSubscription,a,n,i]);return l.length>0?(0,T.jsx)(qt,{invalidSubscriptions:l}):s?r===yt.error?(0,T.jsx)(Si,{...o}):void 0:(0,T.jsx)(Lt,{})};ji.propTypes={currentSubscriptions:E().object.isRequired,isSeoAnalysisActive:E().bool};const _i=({id:e,label:s,description:t="",onChange:r,...o})=>(0,T.jsx)(X.Root,{children:(0,T.jsx)(X.TextField,{id:e,label:s,onChange:r,autoComplete:"off",description:t,...o})});_i.propTypes={id:E().string.isRequired,label:E().string.isRequired,onChange:E().func.isRequired,description:E().oneOfType([E().string,E().element])};const Ci=_i;window.yoast=window.yoast||{},window.yoast.editorModules={analysis:{getL10nObject:c,getContentLocale:function(){const e=c();return(0,l.get)(e,"contentLocale","en_US")},getIndicatorForScore:function(e){return(0,l.isNil)(e)||(e/=10),function(e){switch(e){case"feedback":return{className:"na",screenReaderText:(0,d.__)("Not available","wordpress-seo"),screenReaderReadabilityText:(0,d.__)("Not available","wordpress-seo"),screenReaderInclusiveLanguageText:(0,d.__)("Not available","wordpress-seo")};case"bad":return{className:"bad",screenReaderText:(0,d.__)("Needs improvement","wordpress-seo"),screenReaderReadabilityText:(0,d.__)("Needs improvement","wordpress-seo"),screenReaderInclusiveLanguageText:(0,d.__)("Needs improvement","wordpress-seo")};case"ok":return{className:"ok",screenReaderText:(0,d.__)("OK SEO score","wordpress-seo"),screenReaderReadabilityText:(0,d.__)("OK","wordpress-seo"),screenReaderInclusiveLanguageText:(0,d.__)("Potentially non-inclusive","wordpress-seo")};case"good":return{className:"good",screenReaderText:(0,d.__)("Good SEO score","wordpress-seo"),screenReaderReadabilityText:(0,d.__)("Good","wordpress-seo"),screenReaderInclusiveLanguageText:(0,d.__)("Good","wordpress-seo")};default:return{className:"loading",screenReaderText:"",screenReaderReadabilityText:"",screenReaderInclusiveLanguageText:""}}}(u.interpreters.scoreToRating(e))},constants:e,refreshAnalysis:s},aiGenerator:{components:{AIErrorModal:vr,Introduction:Kr,SuggestionError:ai,SparksLimitNotification:ki,FeatureError:ji},helpers:{removesLocaleVariantSuffixes:_r,fetchSuggestions:Er}},components:{HelpLink:se,TopLevelProviders:we,higherorder:{withYoastSidebarPriority:e=>{const s=({renderPriority:s,...t})=>(0,T.jsx)(e,{...t});return s.propTypes={renderPriority:E().number},s}},contentAnalysis:{KeywordInput:V,RelatedKeyphraseInputField:ee,SynonymsInputField:Ci,mapResults:r},contexts:{location:{LocationContext:n.LocationContext,LocationProvider:n.LocationProvider,LocationConsumer:n.LocationConsumer}},SidebarItem:xe,SidebarCollapsible:ge,MetaboxCollapsible:({initialIsOpen:e,id:s,...t})=>(0,T.jsx)(te,{hasPadding:!0,hasSeparator:!0,initialIsOpen:e,id:s,...t}),Modal:ie,portals:{Portal:de,ImageSelectPortal:ue,ScoreIconPortal:me},FieldsetLayout:Ms,UnsavedChangesModal:Vs,YoastLogo:e=>Ae.createElement("svg",ot({xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:"yoast-logo_svg__w-40",viewBox:"0 0 842 224"},e),tt||(tt=Ae.createElement("path",{fill:"#a61e69",d:"M166.55 54.09c-38.69 0-54.17 25.97-54.17 54.88s15.25 56.02 54.17 56.02 54.07-27.19 54-54.26c-.09-32.97-16.77-56.65-54-56.65Zm-23.44 56.52c.94-38.69 30.66-38.65 40.59-24.79 9.05 12.63 10.9 55.81-17.14 55.5-12.92-.14-23.06-8.87-23.44-30.71Zm337.25 27.55V82.11h20.04V57.78h-20.04V28.39h-30.95v29.39h-15.7v24.33h15.7v52.87c0 30.05 20.95 47.91 43.06 51.61l9.24-24.88c-12.89-1.63-21.23-11.27-21.35-23.54Zm-156.15-8.87V87.16c0-1.54-.1-2.98-.25-4.39-2.68-34.04-51.02-33.97-88.46-20.9l10.82 21.78c24.38-11.58 38.97-8.59 44.07-2.89.13.15.26.29.38.45.01.02.03.04.04.06 2.6 3.51 1.98 9.05 1.98 13.41-31.86 0-65.77 4.23-65.77 39.17 0 26.56 33.28 43.65 68.06 18.33l5.16 12.45h29.81c-2.66-14.62-5.85-27.14-5.85-35.34Zm-31.18-.23c-24.51 27.43-46.96 1.61-23.97-9.65 6.77-2.31 15.95-2.41 23.97-2.41v12.06Zm78.75-44.17c0-10.38 16.61-15.23 42.82-3.27l9.06-22.01c-35.27-10.66-83.44-11.62-83.75 25.28-.15 17.68 11.19 27.19 27.52 33.26 11.31 4.2 27.64 6.38 27.59 15.39-.06 11.77-25.38 13.57-48.42-2.26l-9.31 23.87c31.43 15.64 89.87 16.08 89.56-23.12-.31-38.76-55.08-32.11-55.08-47.14ZM99.3 1 54.44 125.61 32.95 58.32H1l35.78 91.89a33.49 33.49 0 0 1 0 24.33c-4 10.25-10.65 19.03-26.87 21.21v27.24c31.58 0 48.65-19.41 63.88-61.96L133.48 1H99.3ZM598.64 139.05c0 8.17-2.96 14.58-8.87 19.23-5.91 4.65-14.07 6.98-24.47 6.98s-18.92-1.61-25.54-4.84v-14.2c4.19 1.97 8.65 3.52 13.37 4.65 4.72 1.13 9.11 1.7 13.18 1.7 5.95 0 10.35-1.13 13.18-3.39 2.83-2.26 4.25-5.3 4.25-9.11 0-3.43-1.3-6.35-3.9-8.74-2.6-2.39-7.97-5.22-16.1-8.48-8.39-3.39-14.3-7.27-17.74-11.63-3.44-4.36-5.16-9.59-5.16-15.71 0-7.67 2.72-13.7 8.18-18.1 5.45-4.4 12.77-6.6 21.95-6.6s17.57 1.93 26.29 5.78l-4.78 12.26c-8.18-3.43-15.47-5.15-21.89-5.15-4.87 0-8.55 1.06-11.07 3.17-2.52 2.12-3.77 4.91-3.77 8.39 0 2.39.5 4.43 1.51 6.13s2.66 3.3 4.97 4.81c2.3 1.51 6.46 3.5 12.45 5.97 6.75 2.81 11.7 5.43 14.85 7.86 3.15 2.43 5.45 5.18 6.92 8.23 1.46 3.06 2.2 6.66 2.2 10.81Zm68.53 24.96h-52.02V72.12h52.02v12.7h-36.99v25.01h34.66v12.57h-34.66v28.85h36.99v12.76Zm100.24-46.07c0 14.96-3.74 26.59-11.23 34.88-7.49 8.3-18.08 12.44-31.8 12.44s-24.54-4.12-31.99-12.35c-7.44-8.23-11.17-19.93-11.17-35.1s3.74-26.82 11.23-34.95c7.49-8.13 18.17-12.19 32.05-12.19s24.24 4.13 31.7 12.38c7.47 8.26 11.2 19.88 11.2 34.88Zm-70.2 0c0 11.31 2.29 19.89 6.86 25.74 4.57 5.85 11.35 8.77 20.32 8.77s15.67-2.89 20.22-8.67c4.55-5.78 6.82-14.39 6.82-25.83s-2.25-19.82-6.76-25.64-11.23-8.74-20.16-8.74-15.82 2.91-20.41 8.74c-4.59 5.82-6.89 14.37-6.89 25.64Z"})),rt||(rt=Ae.createElement("path",{fill:"#77b227",d:"m790.45 165.35 36.05-94.96H840l-36.02 94.96h-13.53z"}))),SidebarLayout:({contentClassName:e="",children:s})=>(0,T.jsx)("div",{className:"yst-flex yst-gap-6 xl:yst-flex-row yst-flex-col relative",children:(0,T.jsx)("div",{className:Ge()("yst-@container yst-flex yst-flex-grow yst-flex-col",e),children:s})}),ErrorFallback:Ns},containers:{EditorModal:Ce,PersistentDismissableAlert:Re,Results:Qe,SEMrushRelatedKeyphrases:ss},helpers:{ajaxHelper:o,createInterpolateElement:Te,createWatcher:(e,s)=>{let t=e();return()=>{const r=e();(0,l.isEqual)(r,t)||(t=r,s((0,l.clone)(r)))}},isBlockEditor:function(){return window.wpseoScriptData&&"1"===window.wpseoScriptData.isBlockEditor},i18n:{setTextdomainL10n:function(e,s="wpseoYoastJSL10n"){const t=(0,l.get)(window,[s,e,"locale_data",e],!1);"yoast-components"===e&&(e="wordpress-seo"),!1===t?(0,d.setLocaleData)({"":{}},e):(0,d.setLocaleData)(t,e)}},replacementVariableHelpers:i,publishBox:{updateScore:function(e,s,t=null){var r=Ss("#"+e+"-score"),o=ks+" "+s;r.children(".image").attr("class",o);var i=js(e,s,t);r.children("."+bs).html(i)},createScoresInPublishBox:function(e,s,t=null){const r=Ss("",{class:"misc-pub-section yoast yoast-seo-score "+e+"-score",id:e+"-score"}),o=Ss("",{class:bs,html:js(e,s,t)}),i=Ss("").attr("class",ks+" na");r.append(i).append(o),Ss("#yoast-seo-publishbox-section").append(r)},scrollToCollapsible:function(e){const s=Ss("#wpadminbar"),t=Ss(e);if(!s||!t)return;const r="fixed"===s.css("position")?s.height():0;Ss([document.documentElement,document.body]).animate({scrollTop:t.offset().top-r},1e3),t.trigger("focus"),0===t.parent().siblings().length&&t.trigger("click")}},updateAdminBar:function(e){jQuery("#wp-admin-bar-wpseo-menu .wpseo-score-icon").attr("title",e.screenReaderText).attr("class","wpseo-score-icon "+e.className).find(".wpseo-score-text").text(e.screenReaderText)},updateTrafficLight:function(e){var s=jQuery(".yst-traffic-light"),t=s.closest(".wpseo-meta-section-link"),r=jQuery("#wpseo-traffic-light-desc"),o=e.className||"na";s.attr("class","yst-traffic-light "+o),t.attr("aria-describedby","wpseo-traffic-light-desc"),r.length>0?r.text(e.screenReaderText):t.closest("li").append(""+e.screenReaderText+"")}}}})()})();