PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | js/dist/ai-generator.js +98 -92 27.7 → trunk View file →
@@ -1,66 +1,72 @@
1 -(()=>{var e={2485(e,t){var s;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var o=typeof s;if("string"===o||"number"===o)e.push(s);else if(Array.isArray(s)){if(s.length){var n=i.apply(null,s);n&&e.push(n)}}else if("object"===o){if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]")){e.push(s.toString());continue}for(var a in s)r.call(s,a)&&s[a]&&e.push(a)}}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(s=function(){return i}.apply(t,[]))||(e.exports=s)}()}},t={};function s(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,s),o.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.components,t=window.wp.data,r=window.wp.hooks,i=window.yoast.uiLibrary,o=window.lodash,n=window.yoast.reduxJsToolkit,a="adminUrl",l=(0,n.createSlice)({name:a,initialState:"",reducers:{setAdminUrl:(e,{payload:t})=>t}}),c=(l.getInitialState,{selectAdminUrl:e=>(0,o.get)(e,a,"")});c.selectAdminLink=(0,n.createSelector)([c.selectAdminUrl,(e,t)=>t],(e,t="")=>{try{return new URL(t,e).href}catch(t){return e}}),l.actions,l.reducer;const d=window.wp.apiFetch;var u=s.n(d);const p="hasConsent",m=`${p}/storeConsent`,h=(0,n.createSlice)({name:p,initialState:{hasConsent:!1,endpoint:""},reducers:{giveAiGeneratorConsent:(e,{payload:t})=>{e.hasConsent=t},setAiGeneratorConsentEndpoint:(e,{payload:t})=>{e.endpoint=t}}}),g=h.getInitialState,y={selectHasAiGeneratorConsent:e=>(0,o.get)(e,[p,"hasConsent"],h.getInitialState().hasConsent),selectAiGeneratorConsentEndpoint:e=>(0,o.get)(e,[p,"endpoint"],h.getInitialState().endpoint)},w={...h.actions,storeAiGeneratorConsent:function*(e,t){try{yield{type:m,payload:{consent:e,endpoint:t}}}catch(e){return!1}return yield{type:`${p}/giveAiGeneratorConsent`,payload:e},!0}},x={[m]:async({payload:e})=>await u()({path:e.endpoint,method:"POST",data:{consent:e.consent},parse:!1})},f=h.reducer,v=window.wp.url,b="linkParams",S=(0,n.createSlice)({name:b,initialState:{},reducers:{setLinkParams:(e,{payload:t})=>t}}),k=(S.getInitialState,{selectLinkParam:(e,t,s={})=>(0,o.get)(e,`${b}.${t}`,s),selectLinkParams:e=>(0,o.get)(e,b,{})});k.selectLink=(0,n.createSelector)([k.selectLinkParams,(e,t)=>t,(e,t,s={})=>s],(e,t,s)=>(0,v.addQueryArgs)(t,{...e,...s})),S.actions,S.reducer;const C=(0,n.createSlice)({name:"notifications",initialState:{},reducers:{addNotification:{reducer:(e,{payload:t})=>{e[t.id]={id:t.id,variant:t.variant,size:t.size,title:t.title,description:t.description}},prepare:({id:e,variant:t="info",size:s="default",title:r,description:i})=>({payload:{id:e||(0,n.nanoid)(),variant:t,size:s,title:r||"",description:i}})},removeNotification:(e,{payload:t})=>(0,o.omit)(e,t)}}),j=(C.getInitialState,C.actions,C.reducer,"pluginUrl"),_=(0,n.createSlice)({name:j,initialState:"",reducers:{setPluginUrl:(e,{payload:t})=>t}}),E=(_.getInitialState,{selectPluginUrl:e=>(0,o.get)(e,j,"")});E.selectImageLink=(0,n.createSelector)([E.selectPluginUrl,(e,t,s="images")=>s,(e,t)=>t],(e,t,s)=>[(0,o.trimEnd)(e,"/"),(0,o.trim)(t,"/"),(0,o.trimStart)(s,"/")].join("/")),_.actions,_.reducer;const R="request",I="success",L="error",T="idle",P="loading",M="success",A="error",N="showPlay",$="askPermission",F="isPlaying",q="wistiaEmbedPermission",O=(0,n.createSlice)({name:q,initialState:{value:!1,status:T,error:{}},reducers:{setWistiaEmbedPermissionValue:(e,{payload:t})=>{e.value=Boolean(t)}},extraReducers:e=>{e.addCase(`${q}/${R}`,e=>{e.status=P}),e.addCase(`${q}/${I}`,(e,{payload:t})=>{e.status=M,e.value=Boolean(t&&t.value)}),e.addCase(`${q}/${L}`,(e,{payload:t})=>{e.status=A,e.value=Boolean(t&&t.value),e.error={code:(0,o.get)(t,"error.code",500),message:(0,o.get)(t,"error.message","Unknown")}})}});var U;O.getInitialState,O.actions,O.reducer;const W=(0,n.createSlice)({name:"documentTitle",initialState:(0,o.defaultTo)(null===(U=document)||void 0===U?void 0:U.title,""),reducers:{setDocumentTitle:(e,{payload:t})=>t}}),B=(W.getInitialState,W.actions,W.reducer,window.React);var G=s.n(B);const D=B.forwardRef(function(e,t){return B.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),B.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"}))}),H=window.wp.element,z=window.wp.i18n,V=window.yoast.aiFrontend,Y=window.yoast.propTypes;var K=s.n(Y);const Z="yoast-seo/ai-generator",X="yoast-seo/editor",J="google",Q="social",ee="twitter",te="title",se="description",re="post",ie="term",oe={post:"title",term:"term_title"},ne=(0,o.mapValues)(oe,e=>`%%${e}%%`),ae={idle:"idle",loading:"loading",success:"success",error:"error"},le="success",ce="error",de="abort",ue=window.yoast.analysis,pe=(window.wp.sanitize,window.yoast.helpers),me=(e,t)=>{try{return(0,H.createInterpolateElement)(e,t)}catch(t){return console.error("Error in translation for:",e,t),e}},he=window.ReactJSXRuntime,{stripHTMLTags:ge}=pe.strings,ye=["_formal","_informal","_ao90"],we=e=>{for(const t of ye)if(e.endsWith(t))return e.slice(0,-t.length);return e};let xe,fe=!1;const ve="\\–\\-\\(\\)_\\[\\]’‘“”〝〞〟‟„\"'.?!:;,¿¡«»‹›—×+&۔؟،؛。。!‼?⁇⁉⁈‥…・ー、〃〄〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〶〼〽{}|~⦅⦆「」、[]・¥$%@&'()*/:;<>\\\<>";ve.split(""),new RegExp("^["+ve+"]+"),new RegExp("["+ve+"]+$");const be=new RegExp("["+ve+"#$%&*+/=@^`{|}~ -¿–-⁊ -₠-⃀]","g"),Se=e=>0===e.replace(be,"").trim().length,ke=e=>{const t={...e};return""!==e.value||["title","excerpt","excerpt_only"].includes(e.name)||(t.value="%%"+e.name+"%%"),t.badge=`<badge>${e.label}</badge>`,t},Ce=()=>{const e=(0,t.useSelect)(e=>e(X).getReplaceVars(),[]),s=(0,H.useMemo)(()=>e.map(ke),[e]);return(0,H.useCallback)((e,{key:t="value",overrides:r={},applyPluggable:i=!0,editType:n=te,contentType:a=re}={})=>{for(const i of s)e=e.replace(new RegExp("%%"+(0,o.escapeRegExp)(i.name)+"%%","g"),(0,o.get)(r,i.name,i[t]));return a===ie&&(e=e.replace(" Archives","")),i?((e,t=te)=>{const s=function(e){const t=(0,o.get)(window,["YoastSEO","app","pluggable"],!1);if(!t||!(0,o.get)(window,["YoastSEO","app","pluggable","loaded"],!1))return function(e){const t=(0,o.get)(window,["YoastSEO","wp","replaceVarsPlugin","replaceVariables"],o.identity);return{url:e.url,title:ge(t(e.title)),description:ge(t(e.description)),filteredSEOTitle:e.filteredSEOTitle?ge(t(e.filteredSEOTitle)):""}}(e);const s=t._applyModifications.bind(t);return{url:e.url,title:ge(s("data_page_title",e.title)),description:ge(s("data_meta_desc",e.description)),filteredSEOTitle:e.filteredSEOTitle?ge(s("data_page_title",e.filteredSEOTitle)):""}}({title:"",description:"",[t]:ue.languageProcessing.stripSpaces(e)});return(0,o.get)(s,t,e)})(e,n):e},[s])},je={editType:te,previewType:J,postType:"post",contentType:re},_e=(0,H.createContext)(je),Ee=_e.Provider,Re=()=>(0,H.useContext)(_e),Ie=window.yoast.externals.contexts,Le=()=>(0,H.useContext)(Ie.LocationContext),Te=e=>{const t=(0,H.useRef)(null);return(0,H.useCallback)(s=>{(0,o.attempt)(()=>t.current&&t.current.disconnect()),null!==s&&(t.current=new ResizeObserver(t=>{(0,o.forEach)(t,t=>e(t))}),t.current.observe(s))},[e])},Pe=(0,n.createSlice)({name:"suggestions",initialState:{status:ae.loading,error:{code:200,message:""},entities:[],selected:""},reducers:{setLoading:e=>{e.status=ae.loading},setSuccess:(e,{payload:t})=>{e.status=ae.success,e.selected=t[0],e.entities.push(...t)},setError:(e,{payload:t})=>{e.status=ae.error,e.error=t},setSelected:(e,{payload:t})=>{e.selected=t}}}),Me=e=>{switch(e){case Q:return"Facebook";case ee:return"Twitter";default:return"Google"}},Ae=window.yoast.searchMetadataPreviews,Ne="usageCount",$e="fetchUsageCount",Fe=`${$e}/${I}`,qe=`${$e}/${L}`,Oe={errorCode:null,errorIdentifier:null,errorMessage:null},Ue=(0,n.createSlice)({name:Ne,initialState:{status:T,count:0,limit:10,endpoint:"",error:Oe},reducers:{addUsageCount:(e,{payload:t=1})=>{e.count+=t},setUsageCount:(e,{payload:t})=>{e.count=t},setUsageCountEndpoint:(e,{payload:t})=>{e.endpoint=t},setUsageCountLimit:(e,{payload:t})=>{e.limit=t}},extraReducers:e=>{e.addCase(`${$e}/${R}`,e=>{e.status=P,e.error=Oe}),e.addCase(Fe,(e,{payload:t})=>{e.status=M,e.count=t.count,e.limit=t.limit,e.error=Oe}),e.addCase(`${$e}/${L}`,(e,{payload:t})=>{e.status=A,e.error={errorCode:502,...t}})}}),We=Ue.getInitialState,Be={selectUsageCountStatus:e=>(0,o.get)(e,[Ne,"status"],Ue.getInitialState()),selectUsageCount:e=>(0,o.get)(e,[Ne,"count"],Ue.getInitialState().count),selectUsageCountLimit:e=>(0,o.get)(e,[Ne,"limit"],Ue.getInitialState().limit),selectUsageCountEndpoint:e=>(0,o.get)(e,[Ne,"endpoint"],Ue.getInitialState().endpoint),selectUsageCountError:e=>(0,o.get)(e,[Ne,"error"],Ue.getInitialState().error)};Be.selectUsageCountRemaining=(0,n.createSelector)([Be.selectUsageCount,Be.selectUsageCountLimit],(e,t)=>Math.max(t-e,0)),Be.isUsageCountLimitReached=(0,n.createSelector)([Be.selectUsageCount,Be.selectUsageCountLimit,Be.selectUsageCountError],(e,t,s)=>429===s.errorCode||e>=t);const Ge={...Ue.actions,fetchUsageCount:function*({endpoint:e,isWooProductEntity:t}){yield{type:`${$e}/${R}`};try{const s=(e=>{const t=(0,o.get)(e,"totalUsed.license",null),s=(0,o.get)(e,"totalUsed.limit",null);if(!(0,o.isNumber)(t)||t<0)throw new Error("Invalid usage count: must be a number of zero or higher.");if(!(0,o.isNumber)(s)||s<-1||0===s)throw new Error("Invalid usage count limit: must be a number of -1 or higher than 1");return{count:t,limit:s}})(yield{type:$e,payload:{endpoint:e,isWooProductEntity:t}});return{type:`${$e}/${I}`,payload:s}}catch(e){return{type:`${$e}/${L}`,payload:e}}}},De={[$e]:async({payload:e})=>u()({method:"POST",path:e.endpoint,data:{is_woo_product_entity:e.isWooProductEntity}})},He=Ue.reducer;B.forwardRef(function(e,t){return B.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),B.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});K().string.isRequired;const ze=B.forwardRef(function(e,t){return B.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),B.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"}))}),Ve=B.forwardRef(function(e,t){return B.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),B.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"}))});K().string.isRequired,K().string.isRequired,K().shape({src:K().string.isRequired,width:K().string,height:K().string}).isRequired,K().shape({value:K().bool.isRequired,status:K().string.isRequired,set:K().func.isRequired}).isRequired,K().string,K().string,K().string;const Ye=({handleRefreshClick:e,supportLink:t})=>(0,he.jsxs)("div",{className:"yst-flex yst-gap-2",children:[(0,he.jsx)(i.Button,{onClick:e,children:(0,z.__)("Refresh this page","wordpress-seo")}),(0,he.jsx)(i.Button,{variant:"secondary",as:"a",href:t,target:"_blank",rel:"noopener",children:(0,z.__)("Contact support","wordpress-seo")})]});Ye.propTypes={handleRefreshClick:K().func.isRequired,supportLink:K().string.isRequired};const Ke=({handleRefreshClick:e,supportLink:t})=>(0,he.jsxs)("div",{className:"yst-grid yst-grid-cols-1 yst-gap-y-2",children:[(0,he.jsx)(i.Button,{className:"yst-order-last",onClick:e,children:(0,z.__)("Refresh this page","wordpress-seo")}),(0,he.jsx)(i.Button,{variant:"secondary",as:"a",href:t,target:"_blank",rel:"noopener",children:(0,z.__)("Contact support","wordpress-seo")})]});Ke.propTypes={handleRefreshClick:K().func.isRequired,supportLink:K().string.isRequired};const Ze=({error:e,children:t=null})=>(0,he.jsxs)("div",{role:"alert",className:"yst-max-w-screen-sm yst-p-8 yst-space-y-4",children:[(0,he.jsx)(i.Title,{children:(0,z.__)("Something went wrong. An unexpected error occurred.","wordpress-seo")}),(0,he.jsx)("p",{children:(0,z.__)("We're very sorry, but it seems like the following error has interrupted our application:","wordpress-seo")}),(0,he.jsx)(i.Alert,{variant:"error",children:(null==e?void 0:e.message)||(0,z.__)("Undefined error message.","wordpress-seo")}),(0,he.jsx)("p",{children:(0,z.__)("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")}),t]});Ze.propTypes={error:K().object.isRequired,children:K().node},Ze.VerticalButtons=Ke,Ze.HorizontalButtons=Ye;K().string,K().node.isRequired,K().node.isRequired,K().node,K().oneOf(Object.keys({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"}}));const Xe=window.ReactDOM;var Je,Qe,et;(Qe=Je||(Je={})).Pop="POP",Qe.Push="PUSH",Qe.Replace="REPLACE",function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(et||(et={})),new Set(["lazy","caseSensitive","path","id","index","children"]),Error;const tt=["post","put","patch","delete"],st=(new Set(tt),["get",...tt]);new Set(st),new Set([301,302,303,307,308]),new Set([307,308]),Symbol("deferred"),B.Component,B.startTransition,new Promise(()=>{}),B.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);try{window.__reactRouterVersion="6"}catch(e){}var rt,it,ot,nt;new Map,B.startTransition,Xe.flushSync,B.useId,"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement,(nt=rt||(rt={})).UseScrollRestoration="useScrollRestoration",nt.UseSubmit="useSubmit",nt.UseSubmitFetcher="useSubmitFetcher",nt.UseFetcher="useFetcher",nt.useViewTransitionState="useViewTransitionState",(ot=it||(it={})).UseFetcher="useFetcher",ot.UseFetchers="useFetchers",ot.UseScrollRestoration="useScrollRestoration",K().string.isRequired,K().string;const at=({href:e,children:t=null,...s})=>(0,he.jsxs)(i.Link,{target:"_blank",rel:"noopener noreferrer",...s,href:e,children:[t,(0,he.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
2 -(0,z.__)("(Opens in a new browser tab)","wordpress-seo")})]});at.propTypes={href:K().string.isRequired,children:K().node};B.forwardRef(function(e,t){return B.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),B.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"}))}),(0,z.__)("Create optimized SEO titles & meta descriptions in seconds","wordpress-seo"),(0,z.__)("Apply AI suggestions to improve content in 1 click","wordpress-seo"),(0,z.__)("Manage redirects with ease and without extra plugins","wordpress-seo"),(0,z.__)("Optimize pages for multiple keywords with guidance","wordpress-seo"),(0,z.__)("Add product details to help your listings stand out","wordpress-seo"),(0,z.__)("Make sure search engines show the right version of your product page","wordpress-seo"),(0,z.__)("Create optimized SEO titles & meta descriptions with AI","wordpress-seo"),(0,z.__)("Receive clear SEO and readability guidance to optimize your products","wordpress-seo"),(0,z.__)("Generate SEO optimized metadata in seconds with AI","wordpress-seo"),(0,z.__)("Make your articles visible, be seen in Google News","wordpress-seo"),(0,z.__)("Built to get found by search, AI, and real users","wordpress-seo"),(0,z.__)("Easy Local SEO. Show up in Google Maps results","wordpress-seo"),(0,z.__)("Internal links and redirect management, easy","wordpress-seo"),(0,z.__)("Access to friendly help when you need it, day or night","wordpress-seo");var lt=s(2485),ct=s.n(lt);K().string.isRequired,K().object.isRequired,K().func.isRequired,B.forwardRef(function(e,t){return B.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),B.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 8l4 4m0 0l-4 4m4-4H3"}))}),K().string.isRequired,K().object,K().func.isRequired,K().bool.isRequired,K().string.isRequired,K().object.isRequired,K().string.isRequired,K().func.isRequired,K().bool.isRequired,B.forwardRef(function(e,t){return B.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),B.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"}))}),K().bool.isRequired,K().func,K().func,K().string.isRequired,K().string.isRequired,K().string.isRequired,K().string.isRequired;const dt=window.yoast.reactHelmet,ut=({videoId:e,thumbnail:t,wistiaEmbedPermission:s,className:r=""})=>{const[o,n]=(0,H.useState)(s.value?F:N),a=(0,H.useCallback)(()=>n(F),[n]),l=(0,H.useCallback)(()=>{s.value?a():n($)},[s.value,a,n]),c=(0,H.useCallback)(()=>n(N),[n]),d=(0,H.useCallback)(()=>{s.set(!0),a()},[s.set,a]);return(0,he.jsxs)(he.Fragment,{children:[s.value&&(0,he.jsx)(dt.Helmet,{children:(0,he.jsx)("script",{src:"https://fast.wistia.com/assets/external/E-v1.js",async:!0})}),(0,he.jsxs)("div",{className:ct()("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===N&&(0,he.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:l,children:(0,he.jsx)("img",{className:"yst-w-full yst-h-auto yst-object-contain",alt:"",loading:"lazy",decoding:"async",...t})}),o===$&&(0,he.jsxs)("div",{className:"yst-absolute yst-inset-0 yst-flex yst-flex-col yst-items-center yst-justify-center yst-bg-white",children:[(0,he.jsxs)("p",{className:"yst-max-w-xs yst-mx-auto yst-text-center",children:[s.status===P&&(0,he.jsx)(i.Spinner,{}),s.status!==P&&(0,z.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. */
3 -(0,z.__)("To see this video, you need to allow %1$s to load embedded videos from %2$s.","wordpress-seo"),"Yoast SEO","Wistia")]}),(0,he.jsxs)("div",{className:"yst-flex yst-mt-6 yst-gap-x-4",children:[(0,he.jsx)(i.Button,{type:"button",variant:"secondary",onClick:c,disabled:s.status===P,children:(0,z.__)("Deny","wordpress-seo")}),(0,he.jsx)(i.Button,{type:"button",variant:"primary",onClick:d,disabled:s.status===P,children:(0,z.__)("Allow","wordpress-seo")})]})]}),s.value&&o===F&&(0,he.jsxs)("div",{className:"yst-absolute yst-w-full yst-h-full yst-top-0 yst-right-0",children:[null===e&&(0,he.jsx)(i.Spinner,{className:"yst-h-full yst-mx-auto"}),null!==e&&(0,he.jsx)("div",{className:`wistia_embed wistia_async_${e} videoFoam=true`})]})]})]})};ut.propTypes={videoId:K().string.isRequired,thumbnail:K().shape({src:K().string.isRequired,width:K().string,height:K().string}).isRequired,wistiaEmbedPermission:K().shape({value:K().bool.isRequired,status:K().string.isRequired,set:K().func.isRequired}).isRequired,hasPadding:K().bool},B.forwardRef(function(e,t){return B.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),B.createElement("path",{fillRule:"evenodd",d:"M10.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L12.586 11H5a1 1 0 110-2h7.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"}))}),K().bool.isRequired,K().func.isRequired,K().func,K().string;const pt=({onGiveConsent:e,learnMoreLink:t,privacyPolicyLink:s,termsOfServiceLink:r,imageLink:o})=>{const{onClose:n,initialFocus:a}=(0,i.useModalContext)(),[l,c]=(0,i.useToggleState)(!1),d=(0,H.useMemo)(()=>({src:o,width:"432",height:"244"}),[o]),u=me((0,z.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. */
4 -(0,z.__)("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>","</a1>","<a2>","</a2>"),{a1:(0,he.jsx)(at,{href:r}),a2:(0,he.jsx)(at,{href:s})}),[p,m]=(0,i.useToggleState)(!1),h=(0,H.useCallback)(async()=>{m(),await e(),m()},[e]);return(0,he.jsxs)(he.Fragment,{children:[(0,he.jsx)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center",children:(0,he.jsx)("div",{className:"yst-relative yst-w-full",children:(0,he.jsx)("img",{className:"yst-w-full yst-h-auto yst-rounded-md yst-drop-shadow-md",alt:"",loading:"lazy",decoding:"async",...d})})}),(0,he.jsxs)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center",children:[(0,he.jsxs)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center",children:[(0,he.jsx)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium",children:(0,z.sprintf)(/* translators: %s expands to Yoast AI. */ /* translators: %s expands to Yoast AI. */
5 -(0,z.__)("Grant consent for %s","wordpress-seo"),"Yoast AI")}),(0,he.jsx)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm",children:me((0,z.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. */
6 -(0,z.__)("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"),"<br/>","<a>","<ArrowNarrowRightIcon />","</a>"),{a:(0,he.jsx)(at,{href:t,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,he.jsx)(Ve,{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"}),br:(0,he.jsx)("br",{})})})]}),(0,he.jsx)("div",{className:"yst-flex yst-w-full yst-mt-6",children:(0,he.jsx)("hr",{className:"yst-w-full yst-text-gray-200"})}),(0,he.jsxs)("div",{className:"yst-flex yst-items-start yst-mt-4",children:[(0,he.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,he.jsx)("label",{htmlFor:"yst-ai-consent-checkbox",className:"yst-label yst-checkbox__label yst-text-xs yst-font-normal yst-text-slate-500",children:u})]}),(0,he.jsx)("div",{className:"yst-w-full yst-flex yst-mt-4",children:(0,he.jsxs)(i.Button,{as:"button",className:"yst-grow",size:"large",disabled:!l,onClick:h,children:[p&&(0,he.jsx)(i.Spinner,{className:"yst-me-2"}),(0,z.__)("Grant consent","wordpress-seo")]})}),(0,he.jsx)(i.Button,{as:"button",className:"yst-mt-4",variant:"tertiary",onClick:n,children:(0,z.__)("Close","wordpress-seo")})]})]})};pt.propTypes={onGiveConsent:K().func.isRequired,learnMoreLink:K().string.isRequired,privacyPolicyLink:K().string.isRequired,termsOfServiceLink:K().string.isRequired,imageLink:K().string.isRequired};const mt={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"},ht=({storeName:e,onConsentGranted:s,linkStoreName:r,links:i={}})=>{const o=(0,H.useMemo)(()=>({...mt,...i}),[i]),{termsOfServiceLink:n,privacyPolicyLink:a,learnMoreLink:l,imageLink:c,endpoint:d}=(0,t.useSelect)(t=>{const s=t(r),i=t(e);return{termsOfServiceLink:s.selectLink(o.termsOfService),privacyPolicyLink:s.selectLink(o.privacyPolicy),learnMoreLink:s.selectLink(o.learnMore),imageLink:s.selectImageLink("ai-consent.png"),endpoint:i.selectAiGeneratorConsentEndpoint()}},[r,e,o]),{storeAiGeneratorConsent:u}=(0,t.useDispatch)(e),p=(0,H.useCallback)(async()=>{await u(!0,d),s()},[u,s,d]);return(0,he.jsx)(pt,{termsOfServiceLink:n,privacyPolicyLink:a,learnMoreLink:l,imageLink:c,onGiveConsent:p})};ht.propTypes={storeName:K().string.isRequired,onConsentGranted:K().func.isRequired,linkStoreName:K().string.isRequired,links:K().shape({termsOfService:K().string,privacyPolicy:K().string,learnMore:K().string})};const gt=()=>{const e=(0,t.useSelect)(e=>e(X).selectLink("https://yoa.st/ai-common-errors"),[]),s=(0,t.useSelect)(e=>e(X).selectAdminLink("?page=wpseo_page_support"),[]);return(0,he.jsxs)(i.Alert,{variant:"error",children:[(0,he.jsx)("span",{className:"yst-block yst-font-medium",children:(0,z.__)("Something went wrong","wordpress-seo")}),(0,he.jsx)("p",{className:"yst-mt-2",children:me((0,z.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. */
7 -(0,z.__)("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>","</a1>","<a2>","</a2>"),{a1:(0,he.jsx)(at,{variant:"error",href:e}),a2:(0,he.jsx)(at,{variant:"error",href:s})})})]})},yt=()=>{const e=(0,t.useSelect)(e=>e(X).selectLink("https://yoa.st/ai-common-errors"),[]),s=(0,t.useSelect)(e=>e(X).selectAdminLink("?page=wpseo_page_support"),[]);return(0,he.jsxs)(i.Alert,{variant:"error",children:[(0,he.jsx)("span",{className:"yst-block yst-font-medium",children:(0,z.__)("Not enough content","wordpress-seo")}),(0,he.jsx)("p",{className:"yst-mt-2",children:me((0,z.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. */
8 -(0,z.__)("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>","</a1>","<a2>","</a2>"),{a1:(0,he.jsx)(at,{variant:"error",href:e}),a2:(0,he.jsx)(at,{variant:"error",href:s})})})]})},wt=()=>{const e=(0,t.useSelect)(e=>e(X).selectAdminLink("?page=wpseo_page_settings#/site-features#card-wpseo-keyword_analysis_active"),[]),s=(0,H.useCallback)(()=>{window.location.reload()},[]),{onClose:r}=(0,i.useModalContext)();return(0,he.jsxs)(he.Fragment,{children:[(0,he.jsxs)(i.Alert,{variant:"error",children:[(0,he.jsx)("span",{className:"yst-block yst-font-medium",children:(0,z.__)("SEO analysis required","wordpress-seo")}),(0,he.jsx)("p",{className:"yst-mt-2",children:me((0,z.sprintf)(
1 +(()=>{var e={818(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},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=i},1609(e){"use strict";e.exports=window.React},2485(e,t){var s;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var o=typeof s;if("string"===o||"number"===o)e.push(s);else if(Array.isArray(s)){if(s.length){var n=i.apply(null,s);n&&e.push(n)}}else if("object"===o){if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]")){e.push(s.toString());continue}for(var a in s)r.call(s,a)&&s[a]&&e.push(a)}}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(s=function(){return i}.apply(t,[]))||(e.exports=s)}()},2514(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"}))});e.exports=i},2863(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"}))});e.exports=i},3473(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 8l4 4m0 0l-4 4m4-4H3"}))});e.exports=i},5074(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"}))});e.exports=i},5687(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{fillRule:"evenodd",d:"M10.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L12.586 11H5a1 1 0 110-2h7.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"}))});e.exports=i},6702(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.exports=i},7219(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}))});e.exports=i},8738(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"}))});e.exports=i}},t={};function s(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,s),o.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.components,t=window.wp.data,r=window.wp.hooks,i=window.yoast.uiLibrary,o=window.lodash,n=window.yoast.reduxJsToolkit,a="adminUrl",l=(0,n.createSlice)({name:a,initialState:"",reducers:{setAdminUrl:(e,{payload:t})=>t}}),c=(l.getInitialState,{selectAdminUrl:e=>(0,o.get)(e,a,"")});c.selectAdminLink=(0,n.createSelector)([c.selectAdminUrl,(e,t)=>t],(e,t="")=>{try{return new URL(t,e).href}catch(t){return e}}),l.actions,l.reducer;const d="replacementVariables",u=(0,n.createSlice)({name:d,initialState:(p={},{recommended:(0,o.get)(p,"recommended",{}),shared:(0,o.get)(p,"shared",[]),specific:(0,o.get)(p,"specific",{}),variables:(0,o.get)(p,"variables",[])}),reducers:{}});var p;const m=(0,n.createSelector)([e=>(0,o.get)(e,[d,"shared"],[]),e=>(0,o.get)(e,[d,"specific"],{}),(e,t)=>t,(e,t,s)=>s],(e,t,s,r)=>[...e,...(0,o.get)(t,s,(0,o.get)(t,r,[]))]),h=((0,n.createSelector)([e=>(0,o.get)(e,[d,"variables"],[]),m],(e,t)=>(0,o.filter)(e,({name:e})=>(0,o.includes)(t,e))),(0,n.createSelector)([e=>(0,o.get)(e,[d,"recommended"],{}),(e,t)=>t,(e,t,s)=>s],(e,t,s)=>(0,o.get)(e,t,(0,o.get)(e,s,[]))),u.actions,u.reducer,window.wp.apiFetch);var g=s.n(h);const y="hasConsent",x=`${y}/storeConsent`,w=(0,n.createSlice)({name:y,initialState:{hasConsent:!1,endpoint:""},reducers:{giveAiGeneratorConsent:(e,{payload:t})=>{e.hasConsent=t},setAiGeneratorConsentEndpoint:(e,{payload:t})=>{e.endpoint=t}}}),f=w.getInitialState,v={selectHasAiGeneratorConsent:e=>(0,o.get)(e,[y,"hasConsent"],w.getInitialState().hasConsent),selectAiGeneratorConsentEndpoint:e=>(0,o.get)(e,[y,"endpoint"],w.getInitialState().endpoint)},b={...w.actions,storeAiGeneratorConsent:function*(e,t){try{yield{type:x,payload:{consent:e,endpoint:t}}}catch(e){return!1}return yield{type:`${y}/giveAiGeneratorConsent`,payload:e},!0}},S={[x]:async({payload:e})=>await g()({path:e.endpoint,method:"POST",data:{consent:e.consent},parse:!1})},j=w.reducer,C=window.wp.url,k="linkParams",_=(0,n.createSlice)({name:k,initialState:{},reducers:{setLinkParams:(e,{payload:t})=>t}}),E=(_.getInitialState,{selectLinkParam:(e,t,s={})=>(0,o.get)(e,`${k}.${t}`,s),selectLinkParams:e=>(0,o.get)(e,k,{})});E.selectLink=(0,n.createSelector)([E.selectLinkParams,(e,t)=>t,(e,t,s={})=>s],(e,t,s)=>(0,C.addQueryArgs)(t,{...e,...s})),_.actions,_.reducer;const R="myyoastConnection",I=(0,n.createSlice)({name:R,initialState:{isAvailable:!1,canConnect:!1,connectUrl:null,learnMoreUrl:""},reducers:{}}),L=I.getInitialState,T=e=>({isAvailable:Boolean(e)&&(0,o.get)(e,"isProvisioned",!1),canConnect:(0,o.get)(e,"canConnect",!1),connectUrl:(0,o.get)(e,"connectUrl",null),learnMoreUrl:(0,o.get)(e,"learnMoreUrl","")}),A={selectMyyoastConnection:e=>(0,o.get)(e,R,L())},M=I.actions,P=I.reducer,N=(0,n.createSlice)({name:"notifications",initialState:{},reducers:{addNotification:{reducer:(e,{payload:t})=>{e[t.id]={id:t.id,variant:t.variant,size:t.size,title:t.title,description:t.description}},prepare:({id:e,variant:t="info",size:s="default",title:r,description:i})=>({payload:{id:e||(0,n.nanoid)(),variant:t,size:s,title:r||"",description:i}})},removeNotification:(e,{payload:t})=>(0,o.omit)(e,t)}}),O=(N.getInitialState,N.actions,N.reducer,"request"),$="success",F="error",U="idle",q="loading",W="success",B="error",G="showPlay",D="askPermission",H="isPlaying",z=(0,n.createSlice)({name:"optInNotification",initialState:{seen:{}},reducers:{hideOptInNotification(e,t){const s=t.payload;e.seen[s]=!0}}}),Y=(z.getInitialState,z.actions,z.reducer,"pluginUrl"),V=(0,n.createSlice)({name:Y,initialState:"",reducers:{setPluginUrl:(e,{payload:t})=>t}}),K=(V.getInitialState,{selectPluginUrl:e=>(0,o.get)(e,Y,"")});K.selectImageLink=(0,n.createSelector)([K.selectPluginUrl,(e,t,s="images")=>s,(e,t)=>t],(e,t,s)=>[(0,o.trimEnd)(e,"/"),(0,o.trim)(t,"/"),(0,o.trimStart)(s,"/")].join("/")),V.actions,V.reducer;const Z="wistiaEmbedPermission",X=(0,n.createSlice)({name:Z,initialState:{value:!1,status:U,error:{}},reducers:{setWistiaEmbedPermissionValue:(e,{payload:t})=>{e.value=Boolean(t)}},extraReducers:e=>{e.addCase(`${Z}/${O}`,e=>{e.status=q}),e.addCase(`${Z}/${$}`,(e,{payload:t})=>{e.status=W,e.value=Boolean(t&&t.value)}),e.addCase(`${Z}/${F}`,(e,{payload:t})=>{e.status=B,e.value=Boolean(t&&t.value),e.error={code:(0,o.get)(t,"error.code",500),message:(0,o.get)(t,"error.message","Unknown")}})}});var J;X.getInitialState,X.actions,X.reducer;const Q=(0,n.createSlice)({name:"documentTitle",initialState:(0,o.defaultTo)(null===(J=document)||void 0===J?void 0:J.title,""),reducers:{setDocumentTitle:(e,{payload:t})=>t}}),ee=(Q.getInitialState,Q.actions,Q.reducer,window.yoast.propTypes);var te=s.n(ee);const se="yoast-seo/ai-generator",re="yoast-seo/editor",ie="google",oe="social",ne="twitter",ae="title",le="description",ce="post",de="term",ue={post:"title",term:"term_title"},pe=(0,o.mapValues)(ue,e=>`%%${e}%%`),me={idle:"idle",loading:"loading",success:"success",error:"error"},he="success",ge="error",ye="abort",xe=window.wp.i18n,we=window.wp.element,fe=(e,t)=>{try{return(0,we.createInterpolateElement)(e,t)}catch(t){return console.error("Error in translation for:",e,t),e}};var ve=s(6702),be=s.n(ve);const Se=window.ReactJSXRuntime;te().string.isRequired;var je=s(2514),Ce=s.n(je),ke=s(818),_e=s.n(ke);te().string.isRequired,te().string.isRequired,te().shape({src:te().string.isRequired,width:te().string,height:te().string}).isRequired,te().shape({value:te().bool.isRequired,status:te().string.isRequired,set:te().func.isRequired}).isRequired,te().string,te().string,te().string;const Ee=({handleRefreshClick:e,supportLink:t})=>(0,Se.jsxs)("div",{className:"yst-flex yst-gap-2",children:[(0,Se.jsx)(i.Button,{onClick:e,children:(0,xe.__)("Refresh this page","wordpress-seo")}),(0,Se.jsx)(i.Button,{variant:"secondary",as:"a",href:t,target:"_blank",rel:"noopener",children:(0,xe.__)("Contact support","wordpress-seo")})]});Ee.propTypes={handleRefreshClick:te().func.isRequired,supportLink:te().string.isRequired};const Re=({handleRefreshClick:e,supportLink:t})=>(0,Se.jsxs)("div",{className:"yst-grid yst-grid-cols-1 yst-gap-y-2",children:[(0,Se.jsx)(i.Button,{className:"yst-order-last",onClick:e,children:(0,xe.__)("Refresh this page","wordpress-seo")}),(0,Se.jsx)(i.Button,{variant:"secondary",as:"a",href:t,target:"_blank",rel:"noopener",children:(0,xe.__)("Contact support","wordpress-seo")})]});Re.propTypes={handleRefreshClick:te().func.isRequired,supportLink:te().string.isRequired};const Ie=({error:e,children:t=null})=>(0,Se.jsxs)("div",{role:"alert",className:"yst-max-w-screen-sm yst-p-8 yst-space-y-4",children:[(0,Se.jsx)(i.Title,{children:(0,xe.__)("Something went wrong. An unexpected error occurred.","wordpress-seo")}),(0,Se.jsx)("p",{children:(0,xe.__)("We're very sorry, but it seems like the following error has interrupted our application:","wordpress-seo")}),(0,Se.jsx)(i.Alert,{variant:"error",children:(null==e?void 0:e.message)||(0,xe.__)("Undefined error message.","wordpress-seo")}),(0,Se.jsx)("p",{children:(0,xe.__)("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")}),t]});Ie.propTypes={error:te().object.isRequired,children:te().node},Ie.VerticalButtons=Re,Ie.HorizontalButtons=Ee;te().string,te().node.isRequired,te().node.isRequired,te().node,te().oneOf(Object.keys({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"}}));var Le=s(1609),Te=s.n(Le);const Ae=window.ReactDOM;var Me,Pe,Ne;(Pe=Me||(Me={})).Pop="POP",Pe.Push="PUSH",Pe.Replace="REPLACE",function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Ne||(Ne={})),new Set(["lazy","caseSensitive","path","id","index","children"]),Error;const Oe=["post","put","patch","delete"],$e=(new Set(Oe),["get",...Oe]);new Set($e),new Set([301,302,303,307,308]),new Set([307,308]),Symbol("deferred"),Le.Component,Le.startTransition,new Promise(()=>{}),Le.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);try{window.__reactRouterVersion="6"}catch(e){}var Fe,Ue,qe,We;new Map,Le.startTransition,Ae.flushSync,Le.useId,"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement,(We=Fe||(Fe={})).UseScrollRestoration="useScrollRestoration",We.UseSubmit="useSubmit",We.UseSubmitFetcher="useSubmitFetcher",We.UseFetcher="useFetcher",We.useViewTransitionState="useViewTransitionState",(qe=Ue||(Ue={})).UseFetcher="useFetcher",qe.UseFetchers="useFetchers",qe.UseScrollRestoration="useScrollRestoration",te().string.isRequired,te().string;const Be=({href:e,children:t=null,...s})=>(0,Se.jsxs)(i.Link,{target:"_blank",rel:"noopener noreferrer",...s,href:e,children:[t,(0,Se.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
2 +(0,xe.__)("(Opens in a new browser tab)","wordpress-seo")})]});Be.propTypes={href:te().string.isRequired,children:te().node};s(8738);(0,xe.__)("Create optimized SEO titles & meta descriptions in seconds","wordpress-seo"),(0,xe.__)("Apply AI suggestions to improve content in 1 click","wordpress-seo"),(0,xe.__)("Manage redirects with ease and without extra plugins","wordpress-seo"),(0,xe.__)("Optimize pages for multiple keywords with guidance","wordpress-seo"),(0,xe.__)("Add product details to help your listings stand out","wordpress-seo"),(0,xe.__)("Make sure search engines show the right version of your product page","wordpress-seo"),(0,xe.__)("Create optimized SEO titles & meta descriptions with AI","wordpress-seo"),(0,xe.__)("Receive clear SEO and readability guidance to optimize your products","wordpress-seo"),(0,xe.__)("Generate SEO optimized metadata in seconds with AI","wordpress-seo"),(0,xe.__)("Make your articles visible, be seen in Google News","wordpress-seo"),(0,xe.__)("Built to get found by search, AI, and real users","wordpress-seo"),(0,xe.__)("Easy Local SEO. Show up in Google Maps results","wordpress-seo"),(0,xe.__)("Internal links and redirect management, easy","wordpress-seo"),(0,xe.__)("Access to friendly help when you need it, day or night","wordpress-seo");var Ge=s(2485),De=s.n(Ge);te().string.isRequired,te().object.isRequired,te().func.isRequired,te().bool.isRequired,s(3473),te().string.isRequired,te().object,te().func.isRequired,te().bool.isRequired,te().string.isRequired,te().object.isRequired,te().string.isRequired,te().func.isRequired,te().bool.isRequired;var He=s(5074),ze=s.n(He);te().bool.isRequired,te().func,te().func,te().string.isRequired,te().string.isRequired,te().string.isRequired,te().string.isRequired;const Ye=window.yoast.reactHelmet,Ve=({videoId:e,thumbnail:t,wistiaEmbedPermission:s,className:r=""})=>{const[o,n]=(0,we.useState)(s.value?H:G),a=(0,we.useCallback)(()=>n(H),[n]),l=(0,we.useCallback)(()=>{s.value?a():n(D)},[s.value,a,n]),c=(0,we.useCallback)(()=>n(G),[n]),d=(0,we.useCallback)(()=>{s.set(!0),a()},[s.set,a]);return(0,Se.jsxs)(Se.Fragment,{children:[s.value&&(0,Se.jsx)(Ye.Helmet,{children:(0,Se.jsx)("script",{src:"https://fast.wistia.com/assets/external/E-v1.js",async:!0})}),(0,Se.jsxs)("div",{className:De()("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===G&&(0,Se.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:l,children:(0,Se.jsx)("img",{className:"yst-w-full yst-h-auto yst-object-contain",alt:"",loading:"lazy",decoding:"async",...t})}),o===D&&(0,Se.jsxs)("div",{className:"yst-absolute yst-inset-0 yst-flex yst-flex-col yst-items-center yst-justify-center yst-bg-white",children:[(0,Se.jsxs)("p",{className:"yst-max-w-xs yst-mx-auto yst-text-center",children:[s.status===q&&(0,Se.jsx)(i.Spinner,{}),s.status!==q&&(0,xe.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. */
3 +(0,xe.__)("To see this video, you need to allow %1$s to load embedded videos from %2$s.","wordpress-seo"),"Yoast SEO","Wistia")]}),(0,Se.jsxs)("div",{className:"yst-flex yst-mt-6 yst-gap-x-4",children:[(0,Se.jsx)(i.Button,{type:"button",variant:"secondary",onClick:c,disabled:s.status===q,children:(0,xe.__)("Deny","wordpress-seo")}),(0,Se.jsx)(i.Button,{type:"button",variant:"primary",onClick:d,disabled:s.status===q,children:(0,xe.__)("Allow","wordpress-seo")})]})]}),s.value&&o===H&&(0,Se.jsxs)("div",{className:"yst-absolute yst-w-full yst-h-full yst-top-0 yst-right-0",children:[null===e&&(0,Se.jsx)(i.Spinner,{className:"yst-h-full yst-mx-auto"}),null!==e&&(0,Se.jsx)("div",{className:`wistia_embed wistia_async_${e} videoFoam=true`})]})]})]})};Ve.propTypes={videoId:te().string.isRequired,thumbnail:te().shape({src:te().string.isRequired,width:te().string,height:te().string}).isRequired,wistiaEmbedPermission:te().shape({value:te().bool.isRequired,status:te().string.isRequired,set:te().func.isRequired}).isRequired,hasPadding:te().bool},s(5687),te().bool.isRequired,te().func.isRequired,te().func,te().string;const Ke=({onGiveConsent:e,learnMoreLink:t,privacyPolicyLink:s,termsOfServiceLink:r,imageLink:o,linkStoreName:n})=>{const{onClose:a,initialFocus:l}=(0,i.useModalContext)(),[c,d]=(0,i.useToggleState)(!1),[u,p]=(0,we.useState)(!1),m=(0,we.useMemo)(()=>({src:o,width:"432",height:"244"}),[o]),h=fe((0,xe.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. */
4 +(0,xe.__)("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>","</a1>","<a2>","</a2>"),{a1:(0,Se.jsx)(Be,{href:r}),a2:(0,Se.jsx)(Be,{href:s})}),[g,y]=(0,i.useToggleState)(!1),x=(0,we.useCallback)(async()=>{y();const t=await e();p(!1===t),y()},[e]);return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center",children:(0,Se.jsx)("div",{className:"yst-relative yst-w-full",children:(0,Se.jsx)("img",{className:"yst-w-full yst-h-auto yst-rounded-md yst-drop-shadow-md",alt:"",loading:"lazy",decoding:"async",...m})})}),(0,Se.jsxs)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center",children:[(0,Se.jsxs)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center",children:[(0,Se.jsx)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium",children:(0,xe.sprintf)(/* translators: %s expands to Yoast AI. */ /* translators: %s expands to Yoast AI. */
5 +(0,xe.__)("Grant consent for %s","wordpress-seo"),"Yoast AI")}),(0,Se.jsx)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm",children:fe((0,xe.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. */
6 +(0,xe.__)("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"),"<br/>","<a>","<ArrowNarrowRightIcon />","</a>"),{a:(0,Se.jsx)(Be,{href:t,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,Se.jsx)(_e(),{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"}),br:(0,Se.jsx)("br",{})})})]}),(0,Se.jsx)("div",{className:"yst-flex yst-w-full yst-mt-6",children:(0,Se.jsx)("hr",{className:"yst-w-full yst-text-gray-200"})}),(0,Se.jsxs)("div",{className:"yst-flex yst-items-start yst-mt-4",children:[(0,Se.jsx)("input",{type:"checkbox",id:"yst-ai-consent-checkbox",name:"yst-ai-consent-checkbox",checked:c,value:c?"true":"false",onChange:d,className:"yst-checkbox__input",ref:l}),(0,Se.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,Se.jsx)(st,{className:"yst-mt-3",linkStoreName:n}),(0,Se.jsx)("div",{className:"yst-w-full yst-flex yst-mt-4",children:(0,Se.jsxs)(i.Button,{as:"button",className:"yst-grow",size:"large",disabled:!c||u,onClick:x,children:[g&&!u&&(0,Se.jsx)(i.Spinner,{className:"yst-me-2"}),(0,xe.__)("Grant consent","wordpress-seo")]})}),(0,Se.jsx)(i.Button,{as:"button",className:"yst-mt-4",variant:"tertiary",onClick:a,children:(0,xe.__)("Close","wordpress-seo")})]})]})};Ke.propTypes={onGiveConsent:te().func.isRequired,learnMoreLink:te().string.isRequired,privacyPolicyLink:te().string.isRequired,termsOfServiceLink:te().string.isRequired,imageLink:te().string.isRequired,linkStoreName:te().string.isRequired};const Ze={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"},Xe=({storeName:e,onConsentGranted:s,linkStoreName:r,links:i={}})=>{const o=(0,we.useMemo)(()=>({...Ze,...i}),[i]),{termsOfServiceLink:n,privacyPolicyLink:a,learnMoreLink:l,imageLink:c,endpoint:d}=(0,t.useSelect)(t=>{const s=t(r),i=t(e);return{termsOfServiceLink:s.selectLink(o.termsOfService),privacyPolicyLink:s.selectLink(o.privacyPolicy),learnMoreLink:s.selectLink(o.learnMore),imageLink:s.selectImageLink("ai-consent.jpg"),endpoint:i.selectAiGeneratorConsentEndpoint()}},[r,e,o]),{storeAiGeneratorConsent:u}=(0,t.useDispatch)(e),p=(0,we.useCallback)(async()=>{const e=await u(!0,d);return!1!==e&&s(),e},[u,s,d]);return(0,Se.jsx)(Ke,{termsOfServiceLink:n,privacyPolicyLink:a,learnMoreLink:l,imageLink:c,onGiveConsent:p,linkStoreName:r})};Xe.propTypes={storeName:te().string.isRequired,onConsentGranted:te().func.isRequired,linkStoreName:te().string.isRequired,links:te().shape({termsOfService:te().string,privacyPolicy:te().string,learnMore:te().string})};const Je=({children:e})=>(0,Se.jsx)("p",{className:"yst-mt-2",children:e});Je.propTypes={children:te().node.isRequired};const Qe=()=>(0,t.useSelect)(e=>{const t=e(re);return{commonErrorsLink:t.selectLink("https://yoa.st/ai-common-errors"),supportLink:t.selectAdminLink("?page=wpseo_page_support")}},[]),et=(0,xe.__)("Something went wrong","wordpress-seo"),tt=({linkStoreName:e=re})=>{const s=(0,t.useSelect)(t=>t(e).selectLink("https://yoa.st/ai-common-errors"),[e]),r=(0,t.useSelect)(t=>t(e).selectAdminLink("?page=wpseo_page_support"),[e]);return(0,Se.jsx)(Je,{children:fe((0,xe.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. */
7 +(0,xe.__)("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>","</a1>","<a2>","</a2>"),{a1:(0,Se.jsx)(Be,{variant:"error",href:s}),a2:(0,Se.jsx)(Be,{variant:"error",href:r})})})};tt.propTypes={linkStoreName:te().string};const st=({linkStoreName:e=re,className:t=""})=>(0,Se.jsxs)(i.Alert,{variant:"error",className:t,children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:et}),(0,Se.jsx)(tt,{linkStoreName:e})]});st.propTypes={linkStoreName:te().string,className:te().string};const rt=(0,xe.__)("Not enough content","wordpress-seo"),it=()=>{const{commonErrorsLink:e,supportLink:t}=Qe();return(0,Se.jsx)(Je,{children:fe((0,xe.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. */
8 +(0,xe.__)("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>","</a1>","<a2>","</a2>"),{a1:(0,Se.jsx)(Be,{variant:"error",href:e}),a2:(0,Se.jsx)(Be,{variant:"error",href:t})})})},ot=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:rt}),(0,Se.jsx)(it,{})]}),nt=(0,xe.__)("SEO analysis required","wordpress-seo"),at=()=>{const e=(0,t.useSelect)(e=>e(re).selectAdminLink("?page=wpseo_page_settings#/site-features#card-wpseo-keyword_analysis_active"),[]);return(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(
9 9 /**
10 - * translators:
11 - * %1$s expands to Yoast SEO.
12 - * %2$s and %3$s expand to an opening and closing anchor tag, respectively, that links to the settings page.
13 - * %4$s expands to Yoast AI.
14 - */
10 + * translators:
11 + * %1$s expands to Yoast SEO.
12 + * %2$s and %3$s expand to an opening and closing anchor tag, respectively, that links to the settings page.
13 + * %4$s expands to Yoast AI.
14 + */
15 15 /**
16 - * translators:
17 - * %1$s expands to Yoast SEO.
18 - * %2$s and %3$s expand to an opening and closing anchor tag, respectively, that links to the settings page.
19 - * %4$s expands to Yoast AI.
20 - */
21 -(0,z.__)("%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","<a>","</a>","Yoast AI"),{a:(0,he.jsx)(at,{variant:"error",href:e})})})]}),(0,he.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,he.jsx)(i.Button,{variant:"secondary",onClick:r,children:(0,z.__)("Close","wordpress-seo")}),(0,he.jsx)(i.Button,{className:"yst-revoke-button",variant:"primary",onClick:s,children:(0,z.__)("Refresh page","wordpress-seo")})]})]})},xt=()=>{const e=(0,t.useSelect)(e=>e(X).selectLink("https://yoa.st/ai-generator-rate-limit-help"),[]);return(0,he.jsxs)(i.Alert,{variant:"error",children:[(0,he.jsx)("span",{className:"yst-block yst-font-medium",children:(0,z.__)("You've reached the Yoast AI rate limit","wordpress-seo")}),(0,he.jsx)("p",{className:"yst-mt-2",children:me((0,z.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. */
22 -(0,z.__)("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>","</a>"),{a:(0,he.jsx)(at,{variant:"error",href:e})})})]})},ft=({invalidSubscriptions:e=[]})=>{const{newYoastWooLink:s,activateYoastWooLink:r,newPremiumLink:o,activatePremiumLink:n,bustSubscriptionCacheEndpoint:a}=(0,t.useSelect)(e=>{const t=e(X);return{newYoastWooLink:t.selectLink("https://yoa.st/ai-generator-new-yoast-woocommerce"),activateYoastWooLink:t.selectLink("https://yoa.st/ai-generator-activate-yoast-woocommerce"),newPremiumLink:t.selectLink("https://yoa.st/ai-generator-new-premium"),activatePremiumLink:t.selectLink("https://yoa.st/ai-generator-activate-premium"),bustSubscriptionCacheEndpoint:e(Z).selectBustSubscriptionCacheEndpoint()}},[]),{onClose:l}=(0,i.useModalContext)(),c=(0,H.useCallback)(async()=>{try{await u()({path:a,method:"POST",parse:!1})}catch(e){console.error(e)}window.location.reload()},[]);let d,p,m;return e.includes("Yoast WooCommerce SEO")?(d="Yoast WooCommerce SEO",p=r,m=s):e.includes("Yoast SEO Premium")&&(d="Yoast SEO Premium",p=n,m=o),(0,he.jsxs)(H.Fragment,{children:[(0,he.jsxs)(i.Alert,{variant:"error",children:[(0,he.jsx)("span",{className:"yst-block yst-font-medium",children:(0,z.__)("Subscription required","wordpress-seo")}),(0,he.jsx)("p",{className:"yst-mt-2",children:me((0,z.sprintf)(
16 + * translators:
17 + * %1$s expands to Yoast SEO.
18 + * %2$s and %3$s expand to an opening and closing anchor tag, respectively, that links to the settings page.
19 + * %4$s expands to Yoast AI.
20 + */
21 +(0,xe.__)("%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","<a>","</a>","Yoast AI"),{a:(0,Se.jsx)(Be,{variant:"error",href:e})})})},lt=(0,xe.__)("You've reached the Yoast AI rate limit","wordpress-seo"),ct=()=>{const e=(0,t.useSelect)(e=>e(re).selectLink("https://yoa.st/ai-generator-rate-limit-help"),[]);return(0,Se.jsx)(Je,{children:fe((0,xe.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. */
22 +(0,xe.__)("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>","</a>"),{a:(0,Se.jsx)(Be,{variant:"error",href:e})})})},dt=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:lt}),(0,Se.jsx)(ct,{})]}),ut=(0,xe.__)("Subscription required","wordpress-seo"),pt=({invalidSubscriptions:e=[]})=>{const{newYoastWooLink:s,activateYoastWooLink:r,newPremiumLink:i,activatePremiumLink:o}=(0,t.useSelect)(e=>{const t=e(re);return{newYoastWooLink:t.selectLink("https://yoa.st/ai-generator-new-yoast-woocommerce"),activateYoastWooLink:t.selectLink("https://yoa.st/ai-generator-activate-yoast-woocommerce"),newPremiumLink:t.selectLink("https://yoa.st/ai-generator-new-premium"),activatePremiumLink:t.selectLink("https://yoa.st/ai-generator-activate-premium")}},[]);let n,a,l;return e.includes("Yoast WooCommerce SEO")?(n="Yoast WooCommerce SEO",a=r,l=s):e.includes("Yoast SEO Premium")&&(n="Yoast SEO Premium",a=o,l=i),n?(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(
23 23 /**
24 - * translators:
25 - * %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO.
26 - * %2$s expands to MyYoast.
27 - * %3$s and %4$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
28 - * %5$s and %6$s expand to an opening and closing anchor tag, respectively, to get a new subscription.
29 - **/
24 + * translators:
25 + * %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO.
26 + * %2$s expands to MyYoast.
27 + * %3$s and %4$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
28 + * %5$s and %6$s expand to an opening and closing anchor tag, respectively, to get a new subscription.
29 + **/
30 30 /**
31 - * translators:
32 - * %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO.
33 - * %2$s expands to MyYoast.
34 - * %3$s and %4$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
35 - * %5$s and %6$s expand to an opening and closing anchor tag, respectively, to get a new subscription.
36 - **/
37 -(0,z.__)("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"),d,"MyYoast","<Activate>","</Activate>","<New>","</New>"),{Activate:(0,he.jsx)(at,{variant:"error",href:p}),New:(0,he.jsx)(at,{variant:"error",href:m})})})]}),(0,he.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,he.jsx)(i.Button,{variant:"secondary",onClick:l,children:(0,z.__)("Close","wordpress-seo")}),(0,he.jsx)(i.Button,{variant:"primary",onClick:c,children:(0,z.__)("Refresh page","wordpress-seo")})]})]})};ft.propTypes={invalidSubscriptions:K().arrayOf(K().string)};const vt=()=>{const e=(0,t.useSelect)(e=>e(X).selectLink("https://yoa.st/ai-common-errors"),[]),s=(0,t.useSelect)(e=>e(X).selectAdminLink("?page=wpseo_page_support"),[]);return(0,he.jsxs)(i.Alert,{variant:"error",children:[(0,he.jsx)("span",{className:"yst-block yst-font-medium",children:(0,z.__)("Connection timeout","wordpress-seo")}),(0,he.jsx)("p",{className:"yst-mt-2",children:me((0,z.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. */
38 -(0,z.__)("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>","</a1>","<a2>","</a2>"),{a1:(0,he.jsx)(at,{variant:"error",href:e}),a2:(0,he.jsx)(at,{variant:"error",href:s})})})]})},bt=()=>{const e=(0,t.useSelect)(e=>e(X).selectAdminLink("?page=wpseo_page_support"),[]);return(0,he.jsxs)(i.Alert,{variant:"error",children:[(0,he.jsx)("span",{className:"yst-block yst-font-medium",children:(0,z.__)("Usage policy violation","wordpress-seo")}),(0,he.jsx)("p",{className:"yst-mt-2",children:me((0,z.sprintf)(
39 -/* translators: %1$s, %2$s, %3$s, %4$s are anchor tags.
40 - * %5$s expands to OpenAI.
41 - */
42 -/* translators: %1$s, %2$s, %3$s, %4$s are anchor tags.
43 - * %5$s expands to OpenAI.
44 - */
45 -(0,z.__)("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"),"<a1>","</a1>","<a2>","</a2>","OpenAI"),{a1:(0,he.jsx)(at,{variant:"error",href:"https://openai.com/policies/usage-policies"}),a2:(0,he.jsx)(at,{variant:"error",href:e})})})]})},St=({errorMessage:e=""})=>{const s=(0,t.useSelect)(e=>e(X).selectAdminLink("?page=wpseo_page_support"),[]);return(0,he.jsxs)(i.Alert,{variant:"error",children:[(0,he.jsx)("span",{className:"yst-block yst-font-medium",children:(0,z.__)("Something went wrong","wordpress-seo")}),(0,he.jsx)("p",{className:"yst-mt-2",children:(0,z.sprintf)(/* translators: %s is the error response of the request. */ /* translators: %s is the error response of the request. */
46 -(0,z.__)("The request came back with the following error: '%s'.","wordpress-seo"),e)}),(0,he.jsx)("p",{className:"yst-mt-2",children:me((0,z.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. */
47 -(0,z.__)("Please try again later. If the issue persists, please %1$scontact our support team%2$s.","wordpress-seo"),"<a>","</a>"),{a:(0,he.jsx)(at,{variant:"error",href:s})})})]})};St.propTypes={errorMessage:K().string};const kt=()=>{const e=(0,t.useSelect)(e=>e(X).selectAdminLink("plugins.php"),[]);return(0,he.jsxs)(i.Alert,{variant:"error",children:[(0,he.jsx)("span",{className:"yst-block yst-font-medium",children:(0,z.__)("Something went wrong","wordpress-seo")}),(0,he.jsx)("p",{className:"yst-mt-2",children:me((0,z.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. */
48 -(0,z.__)("The version of %1$s is outdated. Please upgrade %1$s %2$shere%3$s!","wordpress-seo"),"Yoast SEO Premium","<a>","</a>"),{a:(0,he.jsx)(at,{variant:"error",href:e})})})]})},Ct=()=>{const e=(0,t.useSelect)(e=>e(X).selectLink("https://yoa.st/ai-common-errors"),[]),s=(0,t.useSelect)(e=>e(X).selectAdminLink("?page=wpseo_page_support"),[]);return(0,he.jsxs)(i.Alert,{variant:"error",children:[(0,he.jsx)("span",{className:"yst-block yst-font-medium",children:(0,z.__)("Yoast AI cannot reach your site","wordpress-seo")}),(0,he.jsx)("p",{className:"yst-mt-2",children:me((0,z.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. */
49 -(0,z.__)("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>","</a1>","<a2>","</a2>"),{a1:(0,he.jsx)(at,{variant:"error",href:e}),a2:(0,he.jsx)(at,{variant:"error",href:s})})})]})},jt=({errorCode:e,errorIdentifier:t="",errorMessage:s=""})=>{switch(e){case 400:switch(t){case"SITE_UNREACHABLE":return(0,he.jsx)(Ct,{});case"WP_HTTP_REQUEST_ERROR":return(0,he.jsx)(St,{errorMessage:s});default:return(0,he.jsx)(gt,{})}case 429:return(0,he.jsx)(xt,{});default:return(0,he.jsx)(gt,{})}};jt.propTypes={errorCode:K().number.isRequired,errorIdentifier:K().string,errorMessage:K().string};const _t=({currentSubscriptions:e,isSeoAnalysisActive:s=!0})=>{const{isPremium:r,usageCountStatus:i,usageCountError:o,isWooProductEntity:n,isWooSeoActive:a}=(0,t.useSelect)(e=>{const t=e(X);return{isPremium:t.getIsPremium(),usageCountStatus:e(Z).selectUsageCountStatus(),usageCountError:e(Z).selectUsageCountError(),isWooProductEntity:t.getIsWooProductEntity(),isWooSeoActive:t.getIsWooSeoActive()}},[]),l=(0,H.useMemo)(()=>!e.wooCommerceSubscription&&n,[e.wooCommerceSubscription]),c=(0,H.useMemo)(()=>{const t=[];return!r&&!n||e.premiumSubscription||t.push("Yoast SEO Premium"),l&&a&&t.push("Yoast WooCommerce SEO"),t},[r,e.premiumSubscription,l,a,n]);return c.length>0?(0,he.jsx)(ft,{invalidSubscriptions:c}):s?i===ae.error?(0,he.jsx)(jt,{...o}):void 0:(0,he.jsx)(wt,{})};_t.propTypes={currentSubscriptions:K().object.isRequired,isSeoAnalysisActive:K().bool};const Et=({onStartGenerating:e})=>(0,he.jsx)(ht,{storeName:Z,linkStoreName:X,onConsentGranted:e});Et.propTypes={onStartGenerating:K().func.isRequired};const Rt=B.forwardRef(function(e,t){return B.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),B.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}))}),It=e=>{var s,r;const i=null===(s=(0,t.useDispatch)("core/edit-post"))||void 0===s?void 0:s.openGeneralSidebar,o=null===(r=(0,t.useDispatch)("core/editor"))||void 0===r?void 0:r.closePublishSidebar,{openEditorModal:n}=(0,t.useDispatch)("yoast-seo/editor");return(0,H.useCallback)(()=>{o(),i("yoast-seo/seo-sidebar"),e&&n("yoast-search-appearance-modal")},[o,i,n])},Lt=/(?<start><\/badge>|^(?!<badge>))(?<wrap>[\s\S]+?)(?<end><badge>|$)/g,Tt=({total:e,current:t,onNavigate:s,disabled:r=!1,...o})=>(0,he.jsxs)("div",{className:"yst-flex yst-justify-between yst-gap-x-2 yst-items-start",children:[(0,he.jsx)("p",{className:"yst-text-slate-500 yst-text-xxs yst-mt-1",children:(0,z.__)("Text generated by AI may be offensive or inaccurate.","wordpress-seo")}),e>1&&(0,he.jsx)(i.Pagination,{className:"yst-shrink-0",current:t,total:e,onNavigate:s,disabled:r,variant:"text"
50 -/* translators: Hidden accessibility text. */,screenReaderTextPrevious:(0,z.__)("Previous","wordpress-seo")
51 -/* translators: Hidden accessibility text. */,screenReaderTextNext:(0,z.__)("Next","wordpress-seo"),...o})]}),Pt=({height:e})=>{const[s,r]=(0,H.useState)(""),{onClose:n}=(0,i.useModalContext)(),{editType:a,previewType:l,contentType:c}=Re(),d=(()=>{const{editType:e,previewType:t}=Re();let s="SEO";switch(t){case Q:s="social";break;case ee:s="X"}switch(e){case te:return(0,z.sprintf)(/* translators: %s is the type of title. */ /* translators: %s is the type of title. */
52 -(0,z.__)("Generated %s titles","wordpress-seo"),s);case se:return t===J&&(s="meta"),(0,z.sprintf)(/* translators: %s is the type of description. */ /* translators: %s is the type of description. */
53 -(0,z.__)("Generated %s descriptions","wordpress-seo"),s)}})(),p=(()=>{const{editType:e,previewType:t}=Re();let s="SEO";switch(t){case Q:s="social";break;case ee:s="X"}switch(e){case te:return(0,z.sprintf)(/* translators: %s is the type of title. */ /* translators: %s is the type of title. */
54 -(0,z.__)("Apply %s title","wordpress-seo"),s);case se:return t===J&&(s="meta"),(0,z.sprintf)(/* translators: %s is the type of description. */ /* translators: %s is the type of description. */
55 -(0,z.__)("Apply %s description","wordpress-seo"),s)}})(),m=Le(),{suggestions:h,fetchSuggestions:g,setSelectedSuggestion:y}=(()=>{const[e,s]=(0,H.useReducer)(Pe.reducer,Pe.getInitialState()),{editType:r,previewType:i,postType:n,contentType:a}=Re(),l=(0,t.useSelect)(e=>e(Z).selectPromptContent(),[]),c=(0,t.useSelect)(e=>e(Z).selectGetSuggestionsEndpoint(),[]),{contentLocale:d,focusKeyphrase:p,isWooCommerceActive:m,isGutenberg:h,isElementor:g}=(0,t.useSelect)(e=>({contentLocale:e(X).getContentLocale(),focusKeyphrase:e(X).getFocusKeyphrase(),isWooCommerceActive:e(X).getIsWooCommerceActive(),isGutenberg:e(X).getIsBlockEditor(),isElementor:e(X).getIsElementorEditor()}),[]);let y,w=ue.languageProcessing.helpers.processExactMatchRequest(p).keyphrase;w.length>191&&(w=w.slice(0,191)),y=g?"elementor":h?"gutenberg":"classic";const x=((e,t,s,r)=>{const i=e===se?"meta-description":"seo-title";let o=((e,t)=>{if(e)switch(t){case"product":return"product-";case"product_cat":case"product_tag":return"product-taxonomy-"}return""})(t,s);return o&&t||r!==ie||(o="taxonomy-"),`${o}${i}`})(r,m,n,a);return{suggestions:e,fetchSuggestions:(0,H.useCallback)(async(e=!0)=>{s(Pe.actions.setLoading());const{status:t,payload:r}=await(async({endpoint:e,data:t})=>{let s;const r=1e3*(0,o.get)(window,"wpseoAiGenerator.requestTimeout",30);try{xe&&xe.abort(),xe=new AbortController,fe=!1,s=setTimeout(()=>{fe=!0,xe.abort()},r);const i=await u()({path:e,method:"POST",data:t,parse:!1,signal:xe.signal}),o=await i.json();return{status:le,payload:o}}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return fe?{status:ce,payload:{message:"timeout",code:408}}:{status:de};const{message:t,missingLicenses:s,errorIdentifier:r}=await(async e=>{try{const t=e.body.getReader(),{value:s}=await t.read(),r=new TextDecoder("utf-8").decode(s);return console.error(r),JSON.parse(r)}catch(e){return{message:"Unknown"}}})(e);return{status:ce,payload:{message:t,code:e.status||500,missingLicenses:s,errorIdentifier:r}}}finally{clearTimeout(s)}})({endpoint:c,canAbort:e,data:{type:x,prompt_content:l,focus_keyphrase:w,platform:Me(i),language:we(d).replace("_","-"),editor:y}});switch(t){case de:break;case ce:s(Pe.actions.setError(r));break;case le:s(Pe.actions.setSuccess(r))}return t},[s]),setSelectedSuggestion:(0,H.useCallback)(e=>s(Pe.actions.setSelected(e)),[s])}})(),w=(()=>{const{previewType:e}=Re();switch(e){case Q:return Gt;case ee:return Xs;default:return qt}})(),{addAppliedSuggestion:x,addUsageCount:f}=(0,t.useDispatch)(Z),{isUsageCountLimitReached:v,isWooProductEntity:b,hasValidPremiumSubscription:S,hasValidWooSubscription:k}=(0,t.useSelect)(e=>{const t=e(Z),s=e(X);return{isUsageCountLimitReached:t.isUsageCountLimitReached(),isPremium:s.getIsPremium(),isWooProductEntity:s.getIsWooProductEntity(),isWooSeoActive:s.getIsWooSeoActive(),hasValidPremiumSubscription:t.selectPremiumSubscription(),hasValidWooSubscription:t.selectWooCommerceSubscription()}},[]),C=(0,H.useMemo)(()=>h.status===ae.loading||!(k||!v||!b)||!(S||!v),[S,v,h.status,b,k]),j=(0,i.usePrevious)(e),_=h.status===ae.success?e:j,{bottom:E}={bottom:`calc( (${_+"px"} - 100vh) / 2 + 32px )`},[R,I]=(0,H.useState)(!1),L=(0,H.useCallback)(e=>{I(e.target.offsetHeight!==e.target.scrollHeight)},[I]),T=Te(L),P=(()=>{const{editType:e,previewType:s,contentType:r}=Re(),i=(()=>{const{previewType:e}=Re();return(0,H.useMemo)(()=>{switch(e){case J:return()=>(0,t.select)(X).getSnippetEditorData().title;case Q:return(0,t.select)(X).getFacebookTitleOrFallback;case ee:return(0,t.select)(X).getTwitterTitleOrFallback;default:return(0,o.constant)("")}},[e])})(),n=(0,t.useSelect)(t=>t(Z).selectAppliedSuggestionFor({editType:e,previewType:s}),[e,s]);return(0,H.useMemo)(()=>{let t=i();return e===se?t:(n&&(t=t.replace(n,ne[r])),((e,t)=>e.includes(ne[t])?e:ne[t])(t,r))},[e,i])})(),M=(()=>{const e=(()=>{const{previewType:e}=Re();return(0,H.useMemo)(()=>{switch(e){case J:return()=>(0,t.select)(X).getSnippetEditorData().description;case Q:return(0,t.select)(X).getFacebookDescriptionOrFallback;case ee:return(0,t.select)(X).getTwitterDescriptionOrFallback;default:return(0,o.constant)("")}},[e])})();return(0,H.useMemo)(e,[e])})(),A=Ce(),N=(0,H.useMemo)(()=>a===te?{[oe[c]]:h.selected}:{},[a,c,h.selected]),$=(0,H.useMemo)(()=>A(P,{overrides:N,contentType:c}),[A,P,a,c,h.selected]),F=(0,H.useMemo)(()=>A(P,{overrides:{...N,sep:"",sitename:""},contentType:c}),[A,P,a,c,h.selected]),q=(0,H.useMemo)(()=>a===se?h.selected:A(M,{editType:se}),[A,M,a,h.selected]),O=(0,H.useCallback)(e=>A(P,{overrides:{[oe[c]]:e},key:"badge",applyPluggable:!1,contentType:c}),[A,P,c]),{currentPage:U,setCurrentPage:W,isOnLastPage:B,totalPages:G,getItemsOnCurrentPage:D}=(({totalItems:e=0,perPage:t=5})=>{const[s,r]=(0,H.useState)(1),i=(0,H.useMemo)(()=>Math.ceil(e/t),[e,t]),n=(0,H.useMemo)(()=>s*t,[s,t]),a=(0,H.useMemo)(()=>n-t,[n,t]),l=(0,H.useMemo)(()=>1===s,[s]),c=(0,H.useMemo)(()=>s===i,[s,i]),d=(0,H.useCallback)(()=>{s>1&&r(s-1)},[s,r]),u=(0,H.useCallback)(()=>{s<i&&r(s+1)},[s,r,i]),p=(0,H.useCallback)(e=>(0,o.slice)(e,a,n),[a,n]);return{currentPage:s,setCurrentPage:r,totalPages:i,isOnFirstPage:l,isOnLastPage:c,previousPage:d,nextPage:u,firstOnPage:a,lastOnPage:n,getItemsOnCurrentPage:p}})({totalItems:h.status===ae.loading||h.status===ae.error?h.entities.length+5:h.entities.length,perPage:5}),V=(0,H.useMemo)(()=>(0,o.map)(D(h.entities),e=>{let t=e;return a===te&&(t=O(e),t=t.replace(Lt,(e,t,s,r,i,o,{start:n,wrap:a,end:l})=>{const c=a.trim();return 0===c.length?`${n}${a}${l}`:`${n}<span>${c}</span>${l}`}),t=me(t,{badge:(0,he.jsx)(i.Badge,{className:"yst-me-2 last:yst-me-0",variant:"plain",children:" "}),span:(0,he.jsx)("span",{className:"yst-flex yst-items-center yst-me-2 last:yst-me-0"})})),{value:e,label:t}}),[h.entities,D,a,O]),Y=(0,H.useMemo)(()=>h.status!==ae.error||h.status===ae.error&&!B,[h.status,B]),K=(0,H.useMemo)(()=>h.status===ae.loading&&B,[h.status,B]),re=(0,H.useMemo)(()=>h.status===ae.error&&B,[h.status,B]),pe=(0,H.useCallback)(()=>{C||(W(h.status===ae.error?G:G+1),g().then(e=>{e===le&&f()}))},[g,h.status,G,W,y,v]),ge=(0,H.useCallback)(()=>r(""),[r]),ye=(()=>{const{editType:e}=Re();switch(e){case te:return(()=>{const{previewType:e}=Re(),{updateData:s,setFacebookPreviewTitle:r,setTwitterPreviewTitle:i}=(0,t.useDispatch)(X);return(0,H.useMemo)(()=>{switch(e){case J:return e=>s({title:e});case Q:return r;case ee:return i;default:return o.noop}},[e,s,r,i])})();case se:return(()=>{const{previewType:e}=Re(),{updateData:s,setFacebookPreviewDescription:r,setTwitterPreviewDescription:i}=(0,t.useDispatch)(X);return(0,H.useMemo)(()=>{switch(e){case J:return e=>s({description:e});case Q:return r;case ee:return i;default:return o.noop}},[e,s,r,i])})();default:return o.noop}})(),ve=It(!0),be=(0,H.useCallback)(()=>{const e=a===te?P.replace(new RegExp(ne[c]+"( Archives)?"),h.selected):h.selected;ye(e),x({editType:a,previewType:l,suggestion:h.selected}),n(),"pre-publish"===m&&ve()},[ye,a,l,h.selected,P,n,x,ve,m]);return((e,t=[])=>{const s=(0,H.useRef)(!1);(0,H.useEffect)(()=>{s.current||(s.current=!0,e().finally(()=>{s.current=!1}))},[e,t])})(()=>""===s?g().then(e=>{r(e),e===le&&f()}):Promise.resolve(),[s,f,g]),s===ce||h.status===ae.error&&402===h.error.code?(0,he.jsx)("div",{className:"yst-flex yst-flex-col yst-space-y-6 yst-mt-6",children:(0,he.jsx)(Gs,{errorCode:h.error.code,errorIdentifier:h.error.errorIdentifier,invalidSubscriptions:h.error.missingLicenses,showActions:!0,onRetry:ge,errorMessage:h.error.message})}):(0,he.jsxs)(H.Fragment,{children:[(0,he.jsxs)(i.Modal.Container.Content,{ref:T,className:"yst-flex yst-flex-col yst-py-6 yst-space-y-2",children:[(0,he.jsx)(w,{title:$,description:q,status:h.status,titleForLength:F,showPreviewSkeleton:""===s,showLengthProgress:!K}),Y&&(0,he.jsxs)(he.Fragment,{children:[(0,he.jsxs)("div",{className:"yst-flex yst-space-y-4",children:[(0,he.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default yst-mt-auto",children:d}),(0,he.jsx)(i.Button,{variant:"ai-secondary",size:"small",onClick:h.status===ae.loading?o.noop:pe,isLoading:h.status===ae.loading,disabled:C,children:(0,z.__)("Generate 5 more","wordpress-seo")})]}),K?(0,he.jsx)(Ys,{idSuffix:m,suggestionClassNames:a===te?[["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,he.jsxs)(he.Fragment,{children:[(0,he.jsx)(zs,{idSuffix:m,suggestions:V,selected:h.selected,onChange:y}),(0,he.jsx)(Tt,{current:U,total:G,onNavigate:W,disabled:h.status===ae.loading||re})]})]}),h.status===ae.error&&B&&(0,he.jsxs)(he.Fragment,{children:[(0,he.jsx)("div",{className:"yst-mt-8"}),(0,he.jsx)(Gs,{errorCode:h.error.code,errorIdentifier:h.error.errorIdentifier,invalidSubscriptions:h.error.missingLicenses,errorMessage:h.error.message}),(0,he.jsx)(Tt,{current:U,total:G,onNavigate:W,disabled:h.status===ae.loading})]})]}),(0,he.jsxs)(i.Modal.Container.Footer,{children:[R&&(0,he.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,he.jsx)("hr",{className:"yst-mb-6 yst--mx-6"}),(0,he.jsxs)("div",{className:"sm:yst-flex sm:yst-justify-end sm:yst-space-x-2 sm:rtl:yst-space-x-reverse",children:[(0,he.jsx)("div",{className:"yst-hidden sm:yst-inline",children:(0,he.jsx)(i.Button,{variant:"secondary",onClick:n,children:(0,z.__)("Close","wordpress-seo")})}),(0,he.jsx)("div",{className:"yst-block sm:yst-inline",children:(0,he.jsxs)(i.Button,{className:"yst-w-full sm:yst-w-auto",variant:"primary",onClick:be,disabled:""===h.selected||h.status===ae.loading||re,children:[(0,he.jsx)(Rt,{className:"yst--ms-1 yst-me-1 yst-h-4 yst-w-4 yst-text-white"}),p]})}),(0,he.jsx)("div",{className:"yst-mt-3 sm:yst-hidden",children:(0,he.jsx)(i.Button,{variant:"secondary",onClick:n,className:"yst-w-full sm:yst-w-auto",children:(0,z.__)("Close","wordpress-seo")})})]})]}),(0,he.jsxs)(i.Notifications,{className:"yst-mx-[calc(50%-50vw)] yst-transition-all",style:{bottom:E},position:"bottom-left",children:[h.status!==ae.loading&&(0,he.jsx)(ir,{className:"yst-mx-[calc(50%-50vw)] yst-transition-all"}),(h.status===ae.success||h.status===ae.loading)&&(0,he.jsx)(Zs,{})]})]})};Pt.propTypes={height:K().number.isRequired};const Mt=({onActivateFreeSparks:e})=>{const{premiumUpsellLink:s,wooUpsellLink:r,isWooCommerceActive:o,isProductPost:n,learnMoreLink:a,imageLink:l,wistiaEmbedPermissionValue:c,wistiaEmbedPermissionStatus:d,isUsageCountLimitReached:u,activateFreeSparksEndpoint:p}=(0,t.useSelect)(e=>{const t=e(Z),s=e(X);return{premiumUpsellLink:s.selectLink("https://yoa.st/ai-generator-upsell"),wooUpsellLink:s.selectLink("https://yoa.st/ai-generator-upsell-woo-seo"),isWooCommerceActive:s.getIsWooCommerceActive(),isProductPost:s.getIsProduct(),learnMoreLink:s.selectLink("https://yoa.st/ai-generator-learn-more"),imageLink:s.selectImageLink("ai-generator-preview.png"),wistiaEmbedPermissionValue:s.selectWistiaEmbedPermissionValue(),wistiaEmbedPermissionStatus:s.selectWistiaEmbedPermissionStatus(),isUsageCountLimitReached:t.isUsageCountLimitReached(),activateFreeSparksEndpoint:t.selectFreeSparksActiveEndpoint()}},[]),{onClose:m,initialFocus:h}=(0,i.useModalContext)(),{title:g,upsellLabel:y,upsellLink:w,ctbId:x,newToText:f}=(e=>{const{isWooProductEntity:s,isProductPost:r,hasValidWooSubscription:i}=(0,t.useSelect)(e=>{const t=e(X),s=e(Z);return{isWooProductEntity:t.getIsWooProductEntity(),isProductPost:t.getIsProduct(),hasValidWooSubscription:s.selectWooCommerceSubscription()}},[]);return(0,H.useMemo)(()=>{const t={upsellLink:e.premium,upsellLabel:(0,z.sprintf)(/* translators: %1$s expands to Yoast SEO Premium. */ /* translators: %1$s expands to Yoast SEO Premium. */
56 -(0,z.__)("Unlock with %1$s","wordpress-seo"),"Yoast SEO Premium"),newToText:"Yoast SEO Premium",ctbId:"f6a84663-465f-4cb5-8ba5-f7a6d72224b2",title:(0,z.__)("Use AI to generate your titles & descriptions!","wordpress-seo")};return s&&(r&&(t.title=(0,z.__)("Generate product titles & descriptions with AI!","wordpress-seo")),i||(t.newToText="Yoast WooCommerce SEO",t.upsellLabel=(0,z.sprintf)(/* translators: %1$s expands to Yoast WooCommerce SEO. */ /* translators: %1$s expands to Yoast WooCommerce SEO. */
57 -(0,z.__)("Unlock with %1$s","wordpress-seo"),"Yoast WooCommerce SEO"),t.upsellLink=e.woo,t.ctbId="5b32250e-e6f0-44ae-ad74-3cefc8e427f9")),t},[s,r,e.premium,e.woo])})({premium:s,woo:r}),v=(0,H.useMemo)(()=>o&&n,[o,n]),b=(0,H.useMemo)(()=>({src:l,width:"432",height:"244"}),[l]),{setWistiaEmbedPermission:S}=(0,t.useDispatch)(X),{activateFreeSparks:k}=(0,t.useDispatch)(Z),C=(0,H.useMemo)(()=>({value:c,status:d,set:S}),[c,d,S]),j=(0,H.useCallback)(()=>{k({endpoint:p}),e()},[k,p,m,e]),_={a:(0,he.jsx)(at,{href:a,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,he.jsx)(Ve,{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"})};return(0,he.jsxs)(he.Fragment,{children:[(0,he.jsxs)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center",children:[(0,he.jsxs)("div",{className:"yst-relative yst-w-full",children:[(0,he.jsx)(ut,{videoId:"vmrahpfjxp",thumbnail:b,wistiaEmbedPermission:C}),(0,he.jsx)(i.Badge,{className:"yst-absolute yst--top-2 yst-end-4",variant:"info",children:"Beta"})]}),(0,he.jsx)("div",{className:"yst-mt-6 yst-text-xs yst-font-medium yst-flex yst-flex-col yst-items-center",children:(0,he.jsxs)("span",{className:"yst-introduction-modal-uppercase yst-flex yst-gap-2 yst-items-center",children:[(0,he.jsx)("span",{className:"yst-logo-icon"}),f]})})]}),(0,he.jsxs)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center",children:[(0,he.jsxs)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center",children:[(0,he.jsx)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium",children:g}),(0,he.jsx)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm",children:me(v?(0,z.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. */
58 -(0,z.__)("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"),"<a>","<ArrowNarrowRightIcon />","</a>"):(0,z.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. */
59 -(0,z.__)("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"),"<a>","<ArrowNarrowRightIcon />","</a>"),_)})]}),u&&(0,he.jsx)(i.Alert,{className:"yst-my-4",children:(0,z.sprintf)(/* translators: %s is for Yoast SEO Premium. */ /* translators: %s is for Yoast SEO Premium. */
60 -(0,z.__)("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,he.jsxs)("div",{className:ct()("yst-w-full yst-flex yst-flex-col",u?"yst-mt-0":"yst-mt-6"),children:[(0,he.jsxs)(i.Button,{as:"a",className:"yst-grow",size:"extra-large",variant:"upsell",href:w,target:"_blank",ref:h,"data-action":"load-nfd-ctb","data-ctb-id":x,children:[(0,he.jsx)(ze,{className:"yst--ms-1 yst-me-2 yst-h-5 yst-w-5"}),y,(0,he.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
61 -(0,z.__)("(Opens in a new browser tab)","wordpress-seo")})]}),!u&&(0,he.jsx)(i.Button,{variant:"ai-secondary",onClick:j,className:"yst-mt-2 yst-w-full yst-text-base yst-text-slate-800 yst-font-medium yst-h-11",children:(0,z.__)("Try for free","wordpress-seo")})]}),(0,he.jsx)(i.Button,{as:"a",className:"yst-mt-4",variant:"tertiary",onClick:m,children:(0,z.__)("Close","wordpress-seo")})]})]})},At=({isOpen:e,onClose:t,closeButtonScreenReaderText:s,panelRef:r,title:o,aiModalHelperLink:n,children:a})=>{const l=(0,i.useSvgAria)();return(0,he.jsx)(i.Modal,{className:"yst-ai-modal",isOpen:e,onClose:t,children:(0,he.jsx)(i.Modal.Panel,{ref:r,className:"yst-max-w-3xl yst-relative",closeButtonScreenReaderText:s,children:(0,he.jsxs)(i.Modal.Container,{children:[(0,he.jsxs)(i.Modal.Container.Header,{children:[(0,he.jsxs)("div",{className:"yst-flex yst-items-center",children:[(0,he.jsx)("span",{className:"yst-logo-icon yst-h-5 yst-w-5"}),(0,he.jsx)(i.Modal.Title,{className:"yst-ms-3 yst-me-1.5",as:"h1",size:"2",children:o}),(0,he.jsx)(i.Link,{id:"ai-modal-learn-more",href:n,variant:"primary",className:"yst-no-underline yst-me-2",target:"_blank",rel:"noopener"
62 -/* translators: Hidden accessibility text. */,"aria-label":(0,z.__)("Learn more about AI (Opens in a new browser tab)","wordpress-seo"),children:(0,he.jsx)(D,{...l,className:"yst-w-4 yst-h-4 yst-text-slate-500 yst-shrink-0"})}),(0,he.jsx)(i.Badge,{variant:"info",children:(0,z.__)("Beta","wordpress-seo")})]}),(0,he.jsx)("hr",{className:"yst-mt-6 yst--mx-6"})]}),a]})})})},Nt=({isOpen:e,onClose:t,closeButtonScreenReaderText:s,children:r})=>(0,he.jsx)(i.Modal,{className:"yst-introduction-modal",isOpen:e,onClose:t,children:(0,he.jsx)(i.Modal.Panel,{className:"yst-max-w-lg yst-p-0 yst-rounded-3xl",closeButtonScreenReaderText:s,children:r})}),$t={inactive:"inactive",askConsent:"askConsent",upsell:"upsell",error:"error",generate:"generate"},Ft=({onUseAi:e})=>{const[s,r]=(0,H.useState)($t.inactive),{editType:o,previewType:n}=Re(),a=Le(),l=(()=>{const{editType:e,previewType:t}=Re();switch(t){case Q:return e===se?(0,z.__)("AI social description generator","wordpress-seo"):(0,z.__)("AI social title generator","wordpress-seo");case ee:return e===se?(0,z.__)("AI X description generator","wordpress-seo"):(0,z.__)("AI X title generator","wordpress-seo");default:return e===se?(0,z.__)("AI description generator","wordpress-seo"):(0,z.__)("AI title generator","wordpress-seo")}})(),{hasConsent:c,promptContentInitialized:d,currentSubscriptions:u,usageCountStatus:p,usageCount:m,usageCountLimit:h,usageCountEndpoint:g,hasValidPremiumSubscription:y,hasValidWooSubscription:w,focusKeyphrase:x,isPremium:f,isSeoAnalysisActive:v,aiModalHelperLink:b,isWooProductEntity:S,isFreeSparksActive:k,isWooSeoActive:C}=(0,t.useSelect)(e=>{const t=e(Z),s=e(X);return{hasConsent:t.selectHasAiGeneratorConsent(),promptContentInitialized:t.selectPromptContentInitialized(),currentSubscriptions:t.selectProductSubscriptions(),usageCountStatus:t.selectUsageCountStatus(),usageCount:t.selectUsageCount(),usageCountLimit:t.selectUsageCountLimit(),usageCountEndpoint:t.selectUsageCountEndpoint(),hasValidPremiumSubscription:t.selectPremiumSubscription(),hasValidWooSubscription:t.selectWooCommerceSubscription(),focusKeyphrase:s.getFocusKeyphrase(),isPremium:s.getIsPremium(),isWooSeoActive:s.getIsWooSeoActive(),isSeoAnalysisActive:s.getPreference("isKeywordAnalysisActive",!0),aiModalHelperLink:s.selectLink("https://yoa.st/ai-generator-help-button-modal"),isWooProductEntity:s.getIsWooProductEntity(),isFreeSparksActive:e(Z).selectIsFreeSparksActive()}},[]),{fetchUsageCount:j}=(0,t.useDispatch)(Z),{closeEditorModal:_}=(0,t.useDispatch)(X),E=(0,z.__)("Close modal","wordpress-seo"),[R,I]=(0,H.useState)(!1),[L,T]=(0,H.useState)(0),M=(0,H.useCallback)(e=>T(e.borderBoxSize[0].blockSize),[T]),A=Te(M),N={onClose:(0,H.useCallback)(()=>{r($t.inactive)},[]),closeButtonScreenReaderText:E},$=(0,H.useCallback)(()=>!Se(x),[x]),F=It(!1),q=(0,H.useCallback)(()=>{_(),"pre-publish"===a&&F(),setTimeout(()=>(e=>{const t=`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 s=document.getElementById(t);s&&s.focus()})(a),0)},[_,a,F]),O=(0,H.useCallback)(()=>S?w&&y:y,[y,w,S]),U=(0,H.useCallback)(async()=>{if(e(),!v)return void r($t.error);if(!$())return r($t.inactive),void q();const t=O();if(!t&&f&&C&&S)return void r($t.error);if(!t&&f&&!S)return void r($t.error);if(!c&&(k||t))return void r($t.askConsent);I(!0);const{type:s,payload:i}=await j({endpoint:g,isWooProductEntity:S}),o=429===(null==i?void 0:i.errorCode)&&!(null!=i&&i.errorIdentifier)&&0===(null==i?void 0:i.missingLicenses.length),n=429===(null==i?void 0:i.errorCode)&&"USAGE_LIMIT_REACHED"===(null==i?void 0:i.errorIdentifier)||i.count>=i.limit;I(!1),o?r($t.error):403!==(null==i?void 0:i.errorCode)||!k&&!t?s!==qe||429===(null==i?void 0:i.errorCode)||403===(null==i?void 0:i.errorCode)?s===qe&&429===(null==i?void 0:i.errorCode)&&t?r($t.error):!t&&!k||!t&&n?r($t.upsell):(t&&c&&r($t.generate),!t&&k&&!n&&c&&r($t.generate)):r($t.error):r($t.askConsent)},[e,f,k,c,v,$,q,g,j,C,S,R]),W=(0,H.useCallback)(async()=>{const{type:e,payload:t}=await j({endpoint:g,isWooProductEntity:S}),s=429===(null==t?void 0:t.errorCode)||t.count>=t.limit,i=O();r(!s||i?e!==qe?$t.generate:$t.error:$t.upsell)},[r,g,j,O,S]),B=(0,H.useCallback)(()=>{r(c?$t.generate:$t.askConsent)},[r,c]),G=(0,H.useMemo)(()=>"google"===n?"title"===o?(0,z.__)("Generate SEO title","wordpress-seo"):(0,z.__)("Generate meta description","wordpress-seo"):"social"===n||"twitter"===n?"title"===o?(0,z.__)("Generate social title","wordpress-seo"):(0,z.__)("Generate social description","wordpress-seo"):void 0,[n,o]);return(0,he.jsxs)(he.Fragment,{children:[(0,he.jsx)(i.Button,{type:"button",variant:"ai-secondary",size:"small",id:`yst-replacevar__use-ai-button__${o}__${a}`,onClick:U,disabled:p===P||!d,isLoading:R&&p===P,children:G}),(0,he.jsxs)(Nt,{...N,isOpen:[$t.askConsent,$t.upsell].includes(s),children:[s===$t.askConsent&&(0,he.jsx)(Et,{onStartGenerating:W}),s===$t.upsell&&(0,he.jsx)(Mt,{onActivateFreeSparks:B})]}),(0,he.jsxs)(At,{...N,isOpen:[$t.error,$t.generate].includes(s),aiModalHelperLink:b,panelRef:A,title:l,children:[s===$t.error&&(0,he.jsx)(i.Modal.Container.Content,{className:"yst-pt-6",children:(0,he.jsx)(_t,{currentSubscriptions:u,isSeoAnalysisActive:v})}),s===$t.generate&&(0,he.jsxs)(he.Fragment,{children:[(0,he.jsx)(V.UsageCounter,{limit:h,requests:m,isSkeleton:!1,className:"yst-absolute yst-top-[-11px] yst-end-12 sm:yst-end-16",mentionBetaInTooltip:f,mentionResetInTooltip:f}),(0,he.jsx)(Pt,{height:L})]})]})]})};Ft.propTypes={onUseAi:K().func.isRequired};const qt=({title:e,description:s,status:r,titleForLength:o,showPreviewSkeleton:n,showLengthProgress:a})=>{const l=(0,t.useSelect)(e=>e(X).getSnippetEditorMode(),[]),[c,d]=(0,H.useState)(l),{editType:u}=Re(),p=Le(),m=(({editType:e,title:s,description:r})=>{const i=(0,t.useSelect)(e=>e(X).getDateFromSettings(),[]),o=(0,t.useSelect)(e=>e(X).getContentLocale(),[]),n=(0,t.useSelect)(e=>e(X).isCornerstoneContent(),[]),a=(0,t.useSelect)(e=>e(X).getIsTerm(),[]);return(0,H.useMemo)(()=>e===se?(0,Ae.getDescriptionProgress)(r,i,n,a,o):(0,Ae.getTitleProgress)(s),[e,s,r,i,n,a,o])})({editType:u,title:o,description:s});return(0,he.jsxs)(he.Fragment,{children:[(0,he.jsx)(Ae.ModeSwitcher,{onChange:d,active:c,id:`yst-ai-google-preview-mode-switcher-${p}`,disabled:r===ae.loading}),n?(0,he.jsx)(Wt,{}):(0,he.jsx)(Ut,{mode:c,title:e,description:s}),(0,he.jsxs)("div",{className:"yst-pt-4",children:[(0,he.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:u===te?(0,z.__)("SEO title width","wordpress-seo"):(0,z.__)("Meta description length","wordpress-seo")}),(0,he.jsx)(Bt,{className:"yst-mt-2",progress:a?m.actual:0,min:0,max:m.max,score:m.score})]})]})};qt.propTypes={title:K().string.isRequired,description:K().string.isRequired,status:K().oneOf(Object.keys(ae)).isRequired,titleForLength:K().string.isRequired,showPreviewSkeleton:K().bool.isRequired,showLengthProgress:K().bool.isRequired};const Ot=/mobi/i,Ut=({mode:e,title:s,description:r})=>{var i,n;const a=(0,t.useSelect)(e=>e(X).getBaseUrlFromSettings(),[]),l=(0,t.useSelect)(e=>e(X).getSnippetEditorData().slug||"",[]),c=(0,t.useSelect)(e=>e(X).getDateFromSettings(),[]),d=(0,t.useSelect)(e=>e(X).getFocusKeyphrase(),[]),u=(0,t.useSelect)(e=>e(X).getSnippetEditorPreviewImageUrl(),[]),p=(0,t.useSelect)(e=>e(X).getSiteIconUrlFromSettings(),[]),m=(0,t.useSelect)(e=>e(X).getShoppingData(),[]),h=(0,t.useSelect)(e=>e(X).getSnippetEditorWordsToHighlight(),[]),g=(0,t.useSelect)(e=>e(X).getSiteName(),[]),y=(0,t.useSelect)(e=>e(X).getContentLocale(),[]),w=(0,H.useMemo)(()=>a+l,[a,l]),x=(0,H.useMemo)(()=>{var e,t;return Ot.test(null===(e=window)||void 0===e||null===(t=e.navigator)||void 0===t?void 0:t.userAgent)},[null===(i=window)||void 0===i||null===(n=i.navigator)||void 0===n?void 0:n.userAgent]);return(0,he.jsx)("div",{className:`yst-ai-generator-preview-section ${e}${x?" yst-user-agent__mobile":""}`,children:(0,he.jsx)(Ae.SnippetPreview,{title:s,description:r,mode:e,url:w,keyword:d,date:c,faviconSrc:p,mobileImageSrc:u,wordsToHighlight:h,siteName:g,locale:y,shoppingData:m,onMouseUp:o.noop})})};Ut.propTypes={mode:K().oneOf(Object.keys({mobile:"mobile",desktop:"desktop"})).isRequired,title:K().string.isRequired,description:K().string.isRequired};const Wt=()=>(0,he.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,he.jsxs)("div",{className:"yst-flex yst-gap-x-3",children:[(0,he.jsx)(i.SkeletonLoader,{className:"yst-flex-shrink-0 yst-h-7 yst-w-7 yst-rounded-full"}),(0,he.jsxs)("div",{className:"yst-flex yst-flex-col yst-w-full yst-gap-y-1",children:[(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-2.5 yst-w-10/12"})]})]}),(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-4 yst-w-full yst-mt-6 yst-mb-4"}),(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"}),(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-10/12 yst-mt-2.5"})]}),Bt=({className:e="",progress:t,max:s,score:r})=>{const o=(0,H.useMemo)(()=>(e=>e>=7?"yst-score-good":e>=5?"yst-score-ok":"yst-score-bad")(r),[r]);return(0,he.jsx)(i.ProgressBar,{className:ct()("yst-length-progress-bar",o,e),progress:t,min:0,max:s})};Bt.propTypes={className:K().string,progress:K().number.isRequired,max:K().number.isRequired,score:K().number.isRequired};const Gt=({title:e,description:t,showPreviewSkeleton:s})=>(0,he.jsxs)("div",{children:[(0,he.jsx)("div",{className:"yst-flex yst-mb-6",children:(0,he.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:(0,z.__)("Social preview","wordpress-seo")})}),s?(0,he.jsx)(Ws,{}):(0,he.jsx)(Us,{title:e,description:t})]});Gt.propTypes={title:K().string.isRequired,description:K().string.isRequired,showPreviewSkeleton:K().bool.isRequired};const Dt=window.yoast.styledComponents;var Ht=s.n(Dt);const zt=Ht().p`
31 + * translators:
32 + * %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO.
33 + * %2$s expands to MyYoast.
34 + * %3$s and %4$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
35 + * %5$s and %6$s expand to an opening and closing anchor tag, respectively, to get a new subscription.
36 + **/
37 +(0,xe.__)("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"),n,"MyYoast","<Activate>","</Activate>","<New>","</New>"),{Activate:(0,Se.jsx)(Be,{variant:"error",href:a}),New:(0,Se.jsx)(Be,{variant:"error",href:l})})}):(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(
38 +/**
39 + * translators:
40 + * %1$s expands to MyYoast.
41 + * %2$s and %3$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
42 + **/
43 +/**
44 + * translators:
45 + * %1$s expands to MyYoast.
46 + * %2$s and %3$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
47 + **/
48 +(0,xe.__)("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>","</Activate>"),{Activate:(0,Se.jsx)(Be,{variant:"error",href:o})})})};pt.propTypes={invalidSubscriptions:te().arrayOf(te().string)};const mt=({invalidSubscriptions:e=[]})=>{const s=(0,t.useSelect)(e=>e(se).selectBustSubscriptionCacheEndpoint(),[]),{onClose:r}=(0,i.useModalContext)(),o=(0,we.useCallback)(async()=>{try{await g()({path:s,method:"POST",parse:!1})}catch(e){console.error(e)}window.location.reload()},[]);return(0,Se.jsxs)(we.Fragment,{children:[(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:ut}),(0,Se.jsx)(pt,{invalidSubscriptions:e})]}),(0,Se.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,Se.jsx)(i.Button,{variant:"secondary",onClick:r,children:(0,xe.__)("Close","wordpress-seo")}),(0,Se.jsx)(i.Button,{variant:"primary",onClick:o,children:(0,xe.__)("Refresh page","wordpress-seo")})]})]})};mt.propTypes={invalidSubscriptions:te().arrayOf(te().string)};const ht=(0,xe.__)("Connection timeout","wordpress-seo"),gt=()=>{const{commonErrorsLink:e,supportLink:t}=Qe();return(0,Se.jsx)(Je,{children:fe((0,xe.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. */
49 +(0,xe.__)("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>","</a1>","<a2>","</a2>"),{a1:(0,Se.jsx)(Be,{variant:"error",href:e}),a2:(0,Se.jsx)(Be,{variant:"error",href:t})})})},yt=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:ht}),(0,Se.jsx)(gt,{})]}),xt=(0,xe.__)("Usage policy violation","wordpress-seo"),wt=()=>{const e=(0,t.useSelect)(e=>e(re).selectAdminLink("?page=wpseo_page_support"),[]);return(0,Se.jsx)(Je,{children:fe((0,xe.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. */
50 +(0,xe.__)("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"),"<a1>","</a1>","<a2>","</a2>","OpenAI"),{a1:(0,Se.jsx)(Be,{variant:"error",href:"https://openai.com/policies/usage-policies"}),a2:(0,Se.jsx)(Be,{variant:"error",href:e})})})},ft=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:xt}),(0,Se.jsx)(wt,{})]}),vt=(0,xe.__)("Something went wrong","wordpress-seo"),bt=({errorMessage:e=""})=>{const s=(0,t.useSelect)(e=>e(re).selectAdminLink("?page=wpseo_page_support"),[]);return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Je,{children:(0,xe.sprintf)(/* translators: %s is the error response of the request. */ /* translators: %s is the error response of the request. */
51 +(0,xe.__)("The request came back with the following error: '%s'.","wordpress-seo"),e)}),(0,Se.jsx)(Je,{children:fe((0,xe.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. */
52 +(0,xe.__)("Please try again later. If the issue persists, please %1$scontact our support team%2$s.","wordpress-seo"),"<a>","</a>"),{a:(0,Se.jsx)(Be,{variant:"error",href:s})})})]})};bt.propTypes={errorMessage:te().string};const St=({errorMessage:e=""})=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:vt}),(0,Se.jsx)(bt,{errorMessage:e})]});St.propTypes={errorMessage:te().string};const jt=(0,xe.__)("Something went wrong","wordpress-seo"),Ct=()=>{const e=(0,t.useSelect)(e=>e(re).selectAdminLink("plugins.php"),[]);return(0,Se.jsx)(Je,{children:fe((0,xe.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. */
53 +(0,xe.__)("The version of %1$s is outdated. Please upgrade %1$s %2$shere%3$s!","wordpress-seo"),"Yoast SEO Premium","<a>","</a>"),{a:(0,Se.jsx)(Be,{variant:"error",href:e})})})},kt=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:jt}),(0,Se.jsx)(Ct,{})]}),_t=({children:e})=>(0,Se.jsx)(i.Modal.Description,{as:"div",className:"yst-mt-2 yst-text-sm yst-text-slate-500",children:e}),Et=({children:e})=>(0,Se.jsx)("div",{className:"yst-mt-6 yst-flex yst-flex-row yst-justify-end yst-gap-3",children:e}),Rt=({onClose:e,...t})=>(0,Se.jsx)(i.Button,{variant:"secondary",onClick:e,...t,children:(0,xe.__)("Close","wordpress-seo")}),It=({isOpen:e,title:t,onClose:s=o.noop,children:r})=>{const n=(0,i.useSvgAria)();return(0,Se.jsx)(i.Modal,{isOpen:e,onClose:s,children:(0,Se.jsx)(i.Modal.Panel,{className:"yst-max-w-lg",closeButtonScreenReaderText:(0,xe.__)("Dismiss","wordpress-seo"),children:(0,Se.jsxs)("div",{className:"yst-flex yst-items-start yst-gap-4",children:[(0,Se.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,Se.jsx)(ze(),{className:"yst-h-6 yst-w-6 yst-text-red-600",...n})}),(0,Se.jsxs)("div",{className:"yst-text-start yst-flex-1 yst-min-w-0",children:[(0,Se.jsx)(i.Modal.Title,{className:"yst-text-lg yst-leading-6 yst-font-medium yst-text-slate-900",children:t}),r]})]})})})},Lt=({showActions:e=!1,onRetry:t,onClose:s})=>(0,Se.jsxs)(Et,{children:[(0,Se.jsx)(Rt,{onClose:s}),e&&(0,Se.jsx)(i.Button,{variant:"primary",onClick:t,children:(0,xe.__)("Try again","wordpress-seo")})]});Lt.propTypes={showActions:te().bool,onRetry:te().func.isRequired,onClose:te().func.isRequired};const Tt=({isOpen:e=!0,showActions:t=!1,onRetry:s=o.noop,onClose:r=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:et,onClose:r,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(tt,{})}),(0,Se.jsx)(Lt,{showActions:t,onRetry:s,onClose:r})]});Tt.propTypes={isOpen:te().bool,showActions:te().bool,onRetry:te().func,onClose:te().func};const At=({isOpen:e=!0,showActions:t=!1,onRetry:s=o.noop,onClose:r=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:ht,onClose:r,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(gt,{})}),(0,Se.jsx)(Lt,{showActions:t,onRetry:s,onClose:r})]});At.propTypes={isOpen:te().bool,showActions:te().bool,onRetry:te().func,onClose:te().func};const Mt=({errorMessage:e="",isOpen:t=!0,showActions:s=!1,onRetry:r=o.noop,onClose:i=o.noop})=>(0,Se.jsxs)(It,{isOpen:t,title:vt,onClose:i,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(bt,{errorMessage:e})}),(0,Se.jsx)(Lt,{showActions:s,onRetry:r,onClose:i})]});Mt.propTypes={errorMessage:te().string,isOpen:te().bool,showActions:te().bool,onRetry:te().func,onClose:te().func};const Pt=({isOpen:e=!0,onClose:t=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:rt,onClose:t,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(it,{})}),(0,Se.jsx)(Et,{children:(0,Se.jsx)(Rt,{onClose:t})})]});Pt.propTypes={isOpen:te().bool,onClose:te().func};const Nt=({isOpen:e=!0,onClose:t=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:xt,onClose:t,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(wt,{})}),(0,Se.jsx)(Et,{children:(0,Se.jsx)(Rt,{onClose:t})})]});Nt.propTypes={isOpen:te().bool,onClose:te().func};const Ot=({isOpen:e=!0,onClose:t=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:lt,onClose:t,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(ct,{})}),(0,Se.jsx)(Et,{children:(0,Se.jsx)(Rt,{onClose:t})})]});Ot.propTypes={isOpen:te().bool,onClose:te().func};const $t=({isOpen:e=!0,onClose:t=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:jt,onClose:t,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(Ct,{})}),(0,Se.jsx)(Et,{children:(0,Se.jsx)(Rt,{onClose:t})})]});$t.propTypes={isOpen:te().bool,onClose:te().func};const Ft=({invalidSubscriptions:e=[],isOpen:s=!0,onClose:r=o.noop})=>{const n=(0,t.useSelect)(e=>e(se).selectBustSubscriptionCacheEndpoint(),[]),a=(0,we.useCallback)(async()=>{try{await g()({path:n,method:"POST",parse:!1})}catch(e){console.error(e)}window.location.reload()},[n]);return(0,Se.jsxs)(It,{isOpen:s,title:ut,onClose:r,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(pt,{invalidSubscriptions:e})}),(0,Se.jsxs)(Et,{children:[(0,Se.jsx)(Rt,{onClose:r}),(0,Se.jsx)(i.Button,{variant:"primary",onClick:a,children:(0,xe.__)("Refresh page","wordpress-seo")})]})]})};Ft.propTypes={invalidSubscriptions:te().arrayOf(te().string),isOpen:te().bool,onClose:te().func};const Ut=({isOpen:e=!0,onClose:t=o.noop})=>{const s=(0,we.useCallback)(()=>window.location.reload(),[]);return(0,Se.jsxs)(It,{isOpen:e,title:nt,onClose:t,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(at,{})}),(0,Se.jsxs)(Et,{children:[(0,Se.jsx)(Rt,{onClose:t}),(0,Se.jsx)(i.Button,{variant:"primary",onClick:s,children:(0,xe.__)("Refresh page","wordpress-seo")})]})]})};Ut.propTypes={isOpen:te().bool,onClose:te().func};const qt=(0,xe.__)("Yoast AI cannot reach your site","wordpress-seo"),Wt=()=>{const{commonErrorsLink:e,supportLink:t}=Qe();return(0,Se.jsx)(Je,{children:fe((0,xe.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. */
54 +(0,xe.__)("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>","</a1>","<a2>","</a2>"),{a1:(0,Se.jsx)(Be,{variant:"error",href:e}),a2:(0,Se.jsx)(Be,{variant:"error",href:t})})})},Bt=({learnMoreUrl:e=""})=>(0,Se.jsx)(Je,{children:fe((0,xe.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. */
55 +(0,xe.__)("%1$sLearn more about connecting with MyYoast.%2$s","wordpress-seo"),"<a>","</a>"),{a:(0,Se.jsx)(Be,{variant:"error",href:e})})});Bt.propTypes={learnMoreUrl:te().string};const Gt=()=>{const e=(0,i.useSvgAria)(),{commonErrorsLink:s,supportLink:r}=(0,t.useSelect)(e=>{const t=e(re);return{commonErrorsLink:t.selectLink("https://yoa.st/ai-common-errors"),supportLink:t.selectAdminLink("?page=wpseo_page_support")}},[]);return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(Je,{children:(0,xe.__)("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,Se.jsxs)(Et,{children:[(0,Se.jsxs)(i.Button,{as:"a",href:r,target:"_blank",rel:"noopener noreferrer",variant:"secondary",children:[(0,xe.__)("Still need help?","wordpress-seo"),(0,Se.jsx)(be(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 yst-text-slate-400 rtl:yst-rotate-[270deg]",...e}),(0,Se.jsx)("span",{className:"yst-sr-only",children:(0,xe.__)("(Opens in a new browser tab)","wordpress-seo")})]}),(0,Se.jsxs)(i.Button,{as:"a",href:s,target:"_blank",rel:"noopener noreferrer",variant:"primary",children:[(0,xe.__)("Learn more","wordpress-seo"),(0,Se.jsx)(_e(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 rtl:yst-rotate-180",...e})]})]})]})},Dt=({isAvailable:e,canConnect:t,connectUrl:s,learnMoreUrl:r},o,n)=>e&&t&&s?(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsxs)(_t,{children:[(0,Se.jsx)(Je,{children:(0,xe.__)("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,Se.jsx)(Bt,{learnMoreUrl:r})]}),(0,Se.jsxs)(Et,{children:[(0,Se.jsx)(Rt,{onClose:o}),(0,Se.jsxs)(i.Button,{as:"a",href:s,target:"_blank",rel:"noopener noreferrer",variant:"primary",children:[(0,xe.__)("Connect to MyYoast","wordpress-seo"),(0,Se.jsx)(be(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 rtl:yst-rotate-[270deg]",...n}),(0,Se.jsx)("span",{className:"yst-sr-only",children:(0,xe.__)("(Opens in a new browser tab)","wordpress-seo")})]})]})]}):e&&!t?(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsxs)(_t,{children:[(0,Se.jsx)(Je,{children:(0,xe.__)("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,Se.jsx)(Bt,{learnMoreUrl:r})]}),(0,Se.jsx)(Et,{children:(0,Se.jsx)(Rt,{onClose:o})})]}):(0,Se.jsx)(Gt,{}),Ht=({isOpen:e=!0,onClose:s=o.noop})=>{const r=(0,i.useSvgAria)(),n=(0,t.useSelect)(e=>e(se).selectMyyoastConnection(),[]);return(0,Se.jsx)(It,{isOpen:e,title:qt,onClose:s,children:Dt(n,s,r)})};Ht.propTypes={isOpen:te().bool,onClose:te().func};const zt=({errorCode:e,errorIdentifier:t="",isOpen:s=!0,invalidSubscriptions:r=[],showActions:i=!1,onRetry:n=o.noop,errorMessage:a="",onClose:l=o.noop})=>{if("SEO_ANALYSIS_INACTIVE"===t)return(0,Se.jsx)(Ut,{isOpen:s,onClose:l});if(402===e||429===e&&"USAGE_LIMIT_REACHED"===t)return(0,Se.jsx)(Ft,{isOpen:s,invalidSubscriptions:r,onClose:l});switch(e){case 400:switch(t){case"AI_CONTENT_FILTER":return(0,Se.jsx)(Nt,{isOpen:s,onClose:l});case"NOT_ENOUGH_CONTENT":return(0,Se.jsx)(Pt,{isOpen:s,onClose:l});case"SITE_UNREACHABLE":return(0,Se.jsx)(Ht,{isOpen:s,onClose:l});case"WP_HTTP_REQUEST_ERROR":return(0,Se.jsx)(Mt,{isOpen:s,errorMessage:a,showActions:i,onRetry:n,onClose:l});default:return(0,Se.jsx)(Tt,{isOpen:s,showActions:i,onRetry:n,onClose:l})}case 408:return(0,Se.jsx)(At,{isOpen:s,showActions:i,onRetry:n,onClose:l});case 429:return(0,Se.jsx)(Ot,{isOpen:s,onClose:l});case 410:return(0,Se.jsx)($t,{isOpen:s,onClose:l});default:return(0,Se.jsx)(Tt,{isOpen:s,showActions:i,onRetry:n,onClose:l})}};zt.propTypes={errorCode:te().number.isRequired,errorIdentifier:te().string,isOpen:te().bool,invalidSubscriptions:te().arrayOf(te().string),showActions:te().bool,onRetry:te().func,errorMessage:te().string,onClose:te().func};var Yt=s(2863),Vt=s.n(Yt);const Kt=window.yoast.aiFrontend,Zt=window.yoast.analysis,Xt=(window.wp.sanitize,window.yoast.helpers),{stripHTMLTags:Jt}=Xt.strings,Qt=["_formal","_informal","_ao90"],es=e=>{for(const t of Qt)if(e.endsWith(t))return e.slice(0,-t.length);return e};let ts,ss=!1;const rs="\\–\\-\\(\\)_\\[\\]’‘“”〝〞〟‟„\"'.?!:;,¿¡«»‹›—×+&۔؟،؛。。!‼?⁇⁉⁈‥…・ー、〃〄〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〶〼〽{}|~⦅⦆「」、[]・¥$%@&'()*/:;<>\\\<>";rs.split(""),new RegExp("^["+rs+"]+"),new RegExp("["+rs+"]+$");const is=new RegExp("["+rs+"#$%&*+/=@^`{|}~ -¿–-⁊ -₠-⃀]","g"),os=e=>0===e.replace(is,"").trim().length,ns=e=>e.replace(/[\n\r]+/g," "),as=(e,t,s)=>{let r="",i=t;for(const t of e){if(i+=t.tokens.length,i>s)return{text:r,tokenCount:i,exceeded:!0};r+=ns(t.text)}return{text:r,tokenCount:i,exceeded:!1}},ls=e=>{const t={...e};return""!==e.value||["title","excerpt","excerpt_only"].includes(e.name)||(t.value="%%"+e.name+"%%"),t.badge=`<badge>${e.label}</badge>`,t},cs=()=>{const e=(0,t.useSelect)(e=>e(re).getReplaceVars(),[]),s=(0,we.useMemo)(()=>e.map(ls),[e]);return(0,we.useCallback)((e,{key:t="value",overrides:r={},applyPluggable:i=!0,editType:n=ae,contentType:a=ce}={})=>{for(const i of s)e=e.replace(new RegExp("%%"+(0,o.escapeRegExp)(i.name)+"%%","g"),(0,o.get)(r,i.name,i[t]));return a===de&&(e=e.replace(" Archives","")),i?((e,t=ae)=>{const s=function(e){const t=(0,o.get)(window,["YoastSEO","app","pluggable"],!1);if(!t||!(0,o.get)(window,["YoastSEO","app","pluggable","loaded"],!1))return function(e){const t=(0,o.get)(window,["YoastSEO","wp","replaceVarsPlugin","replaceVariables"],o.identity);return{url:e.url,title:Jt(t(e.title)),description:Jt(t(e.description)),filteredSEOTitle:e.filteredSEOTitle?Jt(t(e.filteredSEOTitle)):""}}(e);const s=t._applyModifications.bind(t);return{url:e.url,title:Jt(s("data_page_title",e.title)),description:Jt(s("data_meta_desc",e.description)),filteredSEOTitle:e.filteredSEOTitle?Jt(s("data_page_title",e.filteredSEOTitle)):""}}({title:"",description:"",[t]:Zt.languageProcessing.stripSpaces(e)});return(0,o.get)(s,t,e)})(e,n):e},[s])},ds={editType:ae,previewType:ie,postType:"post",contentType:ce},us=(0,we.createContext)(ds),ps=us.Provider,ms=()=>(0,we.useContext)(us),hs=window.yoast.externals.contexts,gs=()=>(0,we.useContext)(hs.LocationContext),ys=e=>{const t=(0,we.useRef)(null);return(0,we.useCallback)(s=>{(0,o.attempt)(()=>t.current&&t.current.disconnect()),null!==s&&(t.current=new ResizeObserver(t=>{(0,o.forEach)(t,t=>e(t))}),t.current.observe(s))},[e])},xs=(0,n.createSlice)({name:"suggestions",initialState:{status:me.loading,error:{code:200,message:""},entities:[],selected:""},reducers:{setLoading:e=>{e.status=me.loading},setSuccess:(e,{payload:t})=>{e.status=me.success,e.selected=t[0],e.entities.push(...t)},setError:(e,{payload:t})=>{e.status=me.error,e.error=t},setSelected:(e,{payload:t})=>{e.selected=t}}}),ws=e=>{switch(e){case oe:return"Facebook";case ne:return"Twitter";default:return"Google"}},fs=window.yoast.searchMetadataPreviews,vs="usageCount",bs="fetchUsageCount",Ss=`${bs}/${$}`,js=`${bs}/${F}`,Cs={errorCode:null,errorIdentifier:null,errorMessage:null},ks=(0,n.createSlice)({name:vs,initialState:{status:U,count:0,limit:10,endpoint:"",error:Cs},reducers:{addUsageCount:(e,{payload:t=1})=>{e.count+=t},setUsageCount:(e,{payload:t})=>{e.count=t},setUsageCountEndpoint:(e,{payload:t})=>{e.endpoint=t},setUsageCountLimit:(e,{payload:t})=>{e.limit=t}},extraReducers:e=>{e.addCase(`${bs}/${O}`,e=>{e.status=q,e.error=Cs}),e.addCase(Ss,(e,{payload:t})=>{e.status=W,e.count=t.count,e.limit=t.limit,e.error=Cs}),e.addCase(`${bs}/${F}`,(e,{payload:t})=>{e.status=B,e.error={errorCode:502,...t}})}}),_s=ks.getInitialState,Es={selectUsageCountStatus:e=>(0,o.get)(e,[vs,"status"],ks.getInitialState()),selectUsageCount:e=>(0,o.get)(e,[vs,"count"],ks.getInitialState().count),selectUsageCountLimit:e=>(0,o.get)(e,[vs,"limit"],ks.getInitialState().limit),selectUsageCountEndpoint:e=>(0,o.get)(e,[vs,"endpoint"],ks.getInitialState().endpoint),selectUsageCountError:e=>(0,o.get)(e,[vs,"error"],ks.getInitialState().error)};Es.selectUsageCountRemaining=(0,n.createSelector)([Es.selectUsageCount,Es.selectUsageCountLimit],(e,t)=>Math.max(t-e,0)),Es.isUsageCountLimitReached=(0,n.createSelector)([Es.selectUsageCount,Es.selectUsageCountLimit,Es.selectUsageCountError],(e,t,s)=>429===s.errorCode||e>=t);const Rs={...ks.actions,fetchUsageCount:function*({endpoint:e,isWooProductEntity:t}){yield{type:`${bs}/${O}`};try{const s=(e=>{const t=(0,o.get)(e,"totalUsed.license",null),s=(0,o.get)(e,"totalUsed.limit",null);if(!(0,o.isNumber)(t)||t<0)throw new Error("Invalid usage count: must be a number of zero or higher.");if(!(0,o.isNumber)(s)||s<-1||0===s)throw new Error("Invalid usage count limit: must be a number of -1 or higher than 1");return{count:t,limit:s}})(yield{type:bs,payload:{endpoint:e,isWooProductEntity:t}});return{type:`${bs}/${$}`,payload:s}}catch(e){return{type:`${bs}/${F}`,payload:e}}}},Is={[bs]:async({payload:e})=>g()({method:"POST",path:e.endpoint,data:{is_woo_product_entity:e.isWooProductEntity}})},Ls=ks.reducer,Ts=({onStartGenerating:e})=>(0,Se.jsx)(Xe,{storeName:se,linkStoreName:re,onConsentGranted:e});Ts.propTypes={onStartGenerating:te().func.isRequired};var As=s(7219),Ms=s.n(As);const Ps=e=>{var s,r;const i=null===(s=(0,t.useDispatch)("core/edit-post"))||void 0===s?void 0:s.openGeneralSidebar,o=null===(r=(0,t.useDispatch)("core/editor"))||void 0===r?void 0:r.closePublishSidebar,{openEditorModal:n}=(0,t.useDispatch)("yoast-seo/editor");return(0,we.useCallback)(()=>{o(),i("yoast-seo/seo-sidebar"),e&&n("yoast-search-appearance-modal")},[o,i,n])},Ns=/(?<start><\/badge>|^(?!<badge>))(?<wrap>[\s\S]+?)(?<end><badge>|$)/g,Os=({total:e,current:t,onNavigate:s,disabled:r=!1,...o})=>(0,Se.jsxs)("div",{className:"yst-flex yst-justify-between yst-gap-x-2 yst-items-start",children:[(0,Se.jsx)("p",{className:"yst-text-slate-500 yst-text-xxs yst-mt-1",children:(0,xe.__)("Text generated by AI may be offensive or inaccurate.","wordpress-seo")}),e>1&&(0,Se.jsx)(i.Pagination,{className:"yst-shrink-0",current:t,total:e,onNavigate:s,disabled:r,variant:"text"
56 +/* translators: Hidden accessibility text. */,screenReaderTextPrevious:(0,xe.__)("Previous","wordpress-seo")
57 +/* translators: Hidden accessibility text. */,screenReaderTextNext:(0,xe.__)("Next","wordpress-seo"),...o})]}),$s=({height:e,onFatalError:s})=>{const[r,n]=(0,we.useState)(""),{onClose:a}=(0,i.useModalContext)(),{editType:l,previewType:c,contentType:d}=ms(),u=(()=>{const{editType:e,previewType:t}=ms();let s="SEO";switch(t){case oe:s="social";break;case ne:s="X"}switch(e){case ae:return(0,xe.sprintf)(/* translators: %s is the type of title. */ /* translators: %s is the type of title. */
58 +(0,xe.__)("Generated %s titles","wordpress-seo"),s);case le:return t===ie&&(s="meta"),(0,xe.sprintf)(/* translators: %s is the type of description. */ /* translators: %s is the type of description. */
59 +(0,xe.__)("Generated %s descriptions","wordpress-seo"),s)}})(),p=(()=>{const{editType:e,previewType:t}=ms();let s="SEO";switch(t){case oe:s="social";break;case ne:s="X"}switch(e){case ae:return(0,xe.sprintf)(/* translators: %s is the type of title. */ /* translators: %s is the type of title. */
60 +(0,xe.__)("Apply %s title","wordpress-seo"),s);case le:return t===ie&&(s="meta"),(0,xe.sprintf)(/* translators: %s is the type of description. */ /* translators: %s is the type of description. */
61 +(0,xe.__)("Apply %s description","wordpress-seo"),s)}})(),m=gs(),{suggestions:h,fetchSuggestions:y,setSelectedSuggestion:x}=(()=>{const[e,s]=(0,we.useReducer)(xs.reducer,xs.getInitialState()),{editType:r,previewType:i,postType:n,contentType:a}=ms(),l=(0,t.useSelect)(e=>e(se).selectPromptContent(),[]),c=(0,t.useSelect)(e=>e(se).selectGetSuggestionsEndpoint(),[]),{contentLocale:d,focusKeyphrase:u,isWooCommerceActive:p,isGutenberg:m,isElementor:h}=(0,t.useSelect)(e=>({contentLocale:e(re).getContentLocale(),focusKeyphrase:e(re).getFocusKeyphrase(),isWooCommerceActive:e(re).getIsWooCommerceActive(),isGutenberg:e(re).getIsBlockEditor(),isElementor:e(re).getIsElementorEditor()}),[]);let y,x=Zt.languageProcessing.helpers.processExactMatchRequest(u).keyphrase;x.length>191&&(x=x.slice(0,191)),y=h?"elementor":m?"gutenberg":"classic";const w=((e,t,s,r)=>{const i=e===le?"meta-description":"seo-title";let o=((e,t)=>{if(e)switch(t){case"product":return"product-";case"product_cat":case"product_tag":return"product-taxonomy-"}return""})(t,s);return o&&t||r!==de||(o="taxonomy-"),`${o}${i}`})(r,p,n,a),f=(0,we.useCallback)(async(e=!0)=>{s(xs.actions.setLoading());const{status:t,payload:r}=await(async({endpoint:e,data:t})=>{let s;const r=1e3*(0,o.get)(window,"wpseoAiGenerator.requestTimeout",30);try{ts&&ts.abort(),ts=new AbortController,ss=!1,s=setTimeout(()=>{ss=!0,ts.abort()},r);const i=await g()({path:e,method:"POST",data:t,parse:!1,signal:ts.signal}),o=await i.json();return{status:he,payload:o}}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return ss?{status:ge,payload:{message:"timeout",code:408}}:{status:ye};const{message:t,missingLicenses:s,errorIdentifier:r}=await(async e=>{try{const t=e.body.getReader(),{value:s}=await t.read(),r=new TextDecoder("utf-8").decode(s);return console.error(r),JSON.parse(r)}catch(e){return{message:"Unknown"}}})(e);return{status:ge,payload:{message:t,code:e.status||500,missingLicenses:s,errorIdentifier:r}}}finally{clearTimeout(s)}})({endpoint:c,canAbort:e,data:{type:w,prompt_content:l,focus_keyphrase:x,platform:ws(i),language:es(d).replace("_","-"),editor:y}});switch(t){case ye:break;case ge:s(xs.actions.setError(r));break;case he:s(xs.actions.setSuccess(r))}return t},[s]);return{suggestions:e,fetchSuggestions:f,setSelectedSuggestion:(0,we.useCallback)(e=>s(xs.actions.setSelected(e)),[s])}})(),w=(()=>{const{previewType:e}=ms();switch(e){case oe:return Vs;case ne:return ri;default:return Gs}})(),{addAppliedSuggestion:f,addUsageCount:v}=(0,t.useDispatch)(se),{isUsageCountLimitReached:b,isWooProductEntity:S,hasValidPremiumSubscription:j,hasValidWooSubscription:C}=(0,t.useSelect)(e=>{const t=e(se),s=e(re);return{isUsageCountLimitReached:t.isUsageCountLimitReached(),isPremium:s.getIsPremium(),isWooProductEntity:s.getIsWooProductEntity(),isWooSeoActive:s.getIsWooSeoActive(),hasValidPremiumSubscription:t.selectPremiumSubscription(),hasValidWooSubscription:t.selectWooCommerceSubscription()}},[]),k=(0,we.useMemo)(()=>h.status===me.loading||!(C||!b||!S)||!(j||!b),[j,b,h.status,S,C]),_=(0,i.usePrevious)(e),E=h.status===me.success?e:_,{bottom:R}={bottom:`calc( (${E+"px"} - 100vh) / 2 + 32px )`},[I,L]=(0,we.useState)(!1),T=(0,we.useCallback)(e=>{L(e.target.offsetHeight!==e.target.scrollHeight)},[L]),A=ys(T),M=(()=>{const{editType:e,previewType:s,contentType:r}=ms(),i=(()=>{const{previewType:e}=ms();return(0,we.useMemo)(()=>{switch(e){case ie:return()=>(0,t.select)(re).getSnippetEditorData().title;case oe:return(0,t.select)(re).getFacebookTitleOrFallback;case ne:return(0,t.select)(re).getTwitterTitleOrFallback;default:return(0,o.constant)("")}},[e])})(),n=(0,t.useSelect)(t=>t(se).selectAppliedSuggestionFor({editType:e,previewType:s}),[e,s]);return(0,we.useMemo)(()=>{let t=i();return e===le?t:(n&&(t=t.replace(n,pe[r])),((e,t)=>e.includes(pe[t])?e:pe[t])(t,r))},[e,i])})(),P=(()=>{const e=(()=>{const{previewType:e}=ms();return(0,we.useMemo)(()=>{switch(e){case ie:return()=>(0,t.select)(re).getSnippetEditorData().description;case oe:return(0,t.select)(re).getFacebookDescriptionOrFallback;case ne:return(0,t.select)(re).getTwitterDescriptionOrFallback;default:return(0,o.constant)("")}},[e])})();return(0,we.useMemo)(e,[e])})(),N=cs(),O=(0,we.useMemo)(()=>l===ae?{[ue[d]]:h.selected}:{},[l,d,h.selected]),$=(0,we.useMemo)(()=>N(M,{overrides:O,contentType:d}),[N,M,l,d,h.selected]),F=(0,we.useMemo)(()=>N(M,{overrides:{...O,sep:"",sitename:""},contentType:d}),[N,M,l,d,h.selected]),U=(0,we.useMemo)(()=>l===le?h.selected:N(P,{editType:le}),[N,P,l,h.selected]),q=(0,we.useCallback)(e=>N(M,{overrides:{[ue[d]]:e},key:"badge",applyPluggable:!1,contentType:d}),[N,M,d]),{currentPage:W,setCurrentPage:B,isOnLastPage:G,totalPages:D,getItemsOnCurrentPage:H}=(({totalItems:e=0,perPage:t=5})=>{const[s,r]=(0,we.useState)(1),i=(0,we.useMemo)(()=>Math.ceil(e/t),[e,t]),n=(0,we.useMemo)(()=>s*t,[s,t]),a=(0,we.useMemo)(()=>n-t,[n,t]),l=(0,we.useMemo)(()=>1===s,[s]),c=(0,we.useMemo)(()=>s===i,[s,i]),d=(0,we.useCallback)(()=>{s>1&&r(s-1)},[s,r]),u=(0,we.useCallback)(()=>{s<i&&r(s+1)},[s,r,i]),p=(0,we.useCallback)(e=>(0,o.slice)(e,a,n),[a,n]);return{currentPage:s,setCurrentPage:r,totalPages:i,isOnFirstPage:l,isOnLastPage:c,previousPage:d,nextPage:u,firstOnPage:a,lastOnPage:n,getItemsOnCurrentPage:p}})({totalItems:h.status===me.loading||h.status===me.error?h.entities.length+5:h.entities.length,perPage:5}),z=(0,we.useMemo)(()=>(0,o.map)(H(h.entities),e=>{let t=e;return l===ae&&(t=q(e),t=t.replace(Ns,(e,t,s,r,i,o,{start:n,wrap:a,end:l})=>{const c=a.trim();return 0===c.length?`${n}${a}${l}`:`${n}<span>${c}</span>${l}`}),t=fe(t,{badge:(0,Se.jsx)(i.Badge,{className:"yst-me-2 last:yst-me-0",variant:"plain",children:" "}),span:(0,Se.jsx)("span",{className:"yst-flex yst-items-center yst-me-2 last:yst-me-0"})})),{value:e,label:t}}),[h.entities,H,l,q]),Y=(0,we.useMemo)(()=>h.status!==me.error||h.status===me.error&&!G,[h.status,G]),V=(0,we.useMemo)(()=>h.status===me.loading&&G,[h.status,G]),K=(0,we.useMemo)(()=>h.status===me.error&&G,[h.status,G]),Z=(0,we.useCallback)(()=>{k||(B(h.status===me.error?D:D+1),y().then(e=>{e===he&&v()}))},[y,h.status,D,B,x,b]),X=(()=>{const{editType:e}=ms();switch(e){case ae:return(()=>{const{previewType:e}=ms(),{updateData:s,setFacebookPreviewTitle:r,setTwitterPreviewTitle:i}=(0,t.useDispatch)(re);return(0,we.useMemo)(()=>{switch(e){case ie:return e=>s({title:e});case oe:return r;case ne:return i;default:return o.noop}},[e,s,r,i])})();case le:return(()=>{const{previewType:e}=ms(),{updateData:s,setFacebookPreviewDescription:r,setTwitterPreviewDescription:i}=(0,t.useDispatch)(re);return(0,we.useMemo)(()=>{switch(e){case ie:return e=>s({description:e});case oe:return r;case ne:return i;default:return o.noop}},[e,s,r,i])})();default:return o.noop}})(),J=Ps(!0),Q=(0,we.useCallback)(()=>{const e=l===ae?M.replace(new RegExp(pe[d]+"( Archives)?"),h.selected):h.selected;X(e),f({editType:l,previewType:c,suggestion:h.selected}),a(),"pre-publish"===m&&J()},[X,l,c,h.selected,M,a,f,J,m]);((e,t=[])=>{const s=(0,we.useRef)(!1);(0,we.useEffect)(()=>{s.current||(s.current=!0,e().finally(()=>{s.current=!1}))},[e,t])})(()=>""===r?y().then(e=>{n(e),e===he&&v()}):Promise.resolve(),[r,v,y]);const ee=r===ge||h.status===me.error&&402===h.error.code;return(0,we.useEffect)(()=>{var e,t,r,i,o,n,a,l;ee&&s({errorCode:null!==(e=null===(t=h.error)||void 0===t?void 0:t.code)&&void 0!==e?e:0,errorIdentifier:null!==(r=null===(i=h.error)||void 0===i?void 0:i.errorIdentifier)&&void 0!==r?r:"",invalidSubscriptions:null!==(o=null===(n=h.error)||void 0===n?void 0:n.missingLicenses)&&void 0!==o?o:[],errorMessage:null!==(a=null===(l=h.error)||void 0===l?void 0:l.message)&&void 0!==a?a:""})},[ee,h.error,s]),ee?null:(0,Se.jsxs)(we.Fragment,{children:[(0,Se.jsxs)(i.Modal.Container.Content,{ref:A,className:"yst-flex yst-flex-col yst-py-6 yst-space-y-2",children:[(0,Se.jsx)(w,{title:$,description:U,status:h.status,titleForLength:F,showPreviewSkeleton:""===r,showLengthProgress:!V}),Y&&(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsxs)("div",{className:"yst-flex yst-space-y-4",children:[(0,Se.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default yst-mt-auto",children:u}),(0,Se.jsx)(i.Button,{variant:"ai-secondary",size:"small",onClick:h.status===me.loading?o.noop:Z,isLoading:h.status===me.loading,disabled:k,children:(0,xe.__)("Generate 5 more","wordpress-seo")})]}),V?(0,Se.jsx)(ei,{idSuffix:m,suggestionClassNames:l===ae?[["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,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Jr,{idSuffix:m,suggestions:z,selected:h.selected,onChange:x}),(0,Se.jsx)(Os,{current:W,total:D,onNavigate:B,disabled:h.status===me.loading||K})]})]}),K&&(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("div",{className:"yst-mt-8"}),(0,Se.jsx)(Kr,{errorCode:h.error.code,errorIdentifier:h.error.errorIdentifier,invalidSubscriptions:h.error.missingLicenses,errorMessage:h.error.message}),(0,Se.jsx)(Os,{current:W,total:D,onNavigate:B,disabled:h.status===me.loading})]})]}),(0,Se.jsxs)(i.Modal.Container.Footer,{children:[I&&(0,Se.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,Se.jsx)("hr",{className:"yst-mb-6 yst--mx-6"}),(0,Se.jsxs)("div",{className:"sm:yst-flex sm:yst-justify-end sm:yst-space-x-2 sm:rtl:yst-space-x-reverse",children:[(0,Se.jsx)("div",{className:"yst-hidden sm:yst-inline",children:(0,Se.jsx)(i.Button,{variant:"secondary",onClick:a,children:(0,xe.__)("Close","wordpress-seo")})}),(0,Se.jsx)("div",{className:"yst-block sm:yst-inline",children:(0,Se.jsxs)(i.Button,{className:"yst-w-full sm:yst-w-auto",variant:"primary",onClick:Q,disabled:""===h.selected||h.status===me.loading||K,children:[(0,Se.jsx)(Ms(),{className:"yst--ms-1 yst-me-1 yst-h-4 yst-w-4 yst-text-white"}),p]})}),(0,Se.jsx)("div",{className:"yst-mt-3 sm:yst-hidden",children:(0,Se.jsx)(i.Button,{variant:"secondary",onClick:a,className:"yst-w-full sm:yst-w-auto",children:(0,xe.__)("Close","wordpress-seo")})})]})]}),(0,Se.jsxs)(i.Notifications,{className:"yst-mx-[calc(50%-50vw)] yst-transition-all",style:{bottom:R},position:"bottom-left",children:[h.status!==me.loading&&(0,Se.jsx)(di,{className:"yst-mx-[calc(50%-50vw)] yst-transition-all"}),(h.status===me.success||h.status===me.loading)&&(0,Se.jsx)(si,{})]})]})};$s.propTypes={height:te().number.isRequired,onFatalError:te().func.isRequired};const Fs=({onActivateFreeSparks:e})=>{const{premiumUpsellLink:s,wooUpsellLink:r,isWooCommerceActive:o,isProductPost:n,learnMoreLink:a,imageLink:l,wistiaEmbedPermissionValue:c,wistiaEmbedPermissionStatus:d,isUsageCountLimitReached:u,activateFreeSparksEndpoint:p}=(0,t.useSelect)(e=>{const t=e(se),s=e(re);return{premiumUpsellLink:s.selectLink("https://yoa.st/ai-generator-upsell"),wooUpsellLink:s.selectLink("https://yoa.st/ai-generator-upsell-woo-seo"),isWooCommerceActive:s.getIsWooCommerceActive(),isProductPost:s.getIsProduct(),learnMoreLink:s.selectLink("https://yoa.st/ai-generator-learn-more"),imageLink:s.selectImageLink("ai-generator-preview.jpg"),wistiaEmbedPermissionValue:s.selectWistiaEmbedPermissionValue(),wistiaEmbedPermissionStatus:s.selectWistiaEmbedPermissionStatus(),isUsageCountLimitReached:t.isUsageCountLimitReached(),activateFreeSparksEndpoint:t.selectFreeSparksActiveEndpoint()}},[]),{onClose:m,initialFocus:h}=(0,i.useModalContext)(),{title:g,upsellLabel:y,upsellLink:x,ctbId:w,newToText:f}=(e=>{const{isWooProductEntity:s,isProductPost:r,hasValidWooSubscription:i}=(0,t.useSelect)(e=>{const t=e(re),s=e(se);return{isWooProductEntity:t.getIsWooProductEntity(),isProductPost:t.getIsProduct(),hasValidWooSubscription:s.selectWooCommerceSubscription()}},[]);return(0,we.useMemo)(()=>{const t={upsellLink:e.premium,upsellLabel:(0,xe.sprintf)(/* translators: %1$s expands to Yoast SEO Premium. */ /* translators: %1$s expands to Yoast SEO Premium. */
62 +(0,xe.__)("Unlock with %1$s","wordpress-seo"),"Yoast SEO Premium"),newToText:"Yoast SEO Premium",ctbId:"f6a84663-465f-4cb5-8ba5-f7a6d72224b2",title:(0,xe.__)("Use AI to generate your titles & descriptions!","wordpress-seo")};return s&&(r&&(t.title=(0,xe.__)("Generate product titles & descriptions with AI!","wordpress-seo")),i||(t.newToText="Yoast WooCommerce SEO",t.upsellLabel=(0,xe.sprintf)(/* translators: %1$s expands to Yoast WooCommerce SEO. */ /* translators: %1$s expands to Yoast WooCommerce SEO. */
63 +(0,xe.__)("Unlock with %1$s","wordpress-seo"),"Yoast WooCommerce SEO"),t.upsellLink=e.woo,t.ctbId="5b32250e-e6f0-44ae-ad74-3cefc8e427f9")),t},[s,r,e.premium,e.woo])})({premium:s,woo:r}),v=(0,we.useMemo)(()=>o&&n,[o,n]),b=(0,we.useMemo)(()=>({src:l,width:"432",height:"244"}),[l]),{setWistiaEmbedPermission:S}=(0,t.useDispatch)(re),{activateFreeSparks:j}=(0,t.useDispatch)(se),C=(0,we.useMemo)(()=>({value:c,status:d,set:S}),[c,d,S]),k=(0,we.useCallback)(()=>{j({endpoint:p}),e()},[j,p,m,e]),_={a:(0,Se.jsx)(Be,{href:a,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,Se.jsx)(_e(),{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"})};return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsxs)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center",children:[(0,Se.jsxs)("div",{className:"yst-relative yst-w-full",children:[(0,Se.jsx)(Ve,{videoId:"vmrahpfjxp",thumbnail:b,wistiaEmbedPermission:C}),(0,Se.jsx)(i.Badge,{className:"yst-absolute yst--top-2 yst-end-4",variant:"info",children:"Beta"})]}),(0,Se.jsx)("div",{className:"yst-mt-6 yst-text-xs yst-font-medium yst-flex yst-flex-col yst-items-center",children:(0,Se.jsxs)("span",{className:"yst-introduction-modal-uppercase yst-flex yst-gap-2 yst-items-center",children:[(0,Se.jsx)("span",{className:"yst-logo-icon"}),f]})})]}),(0,Se.jsxs)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center",children:[(0,Se.jsxs)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center",children:[(0,Se.jsx)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium",children:g}),(0,Se.jsx)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm",children:fe(v?(0,xe.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. */
64 +(0,xe.__)("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"),"<a>","<ArrowNarrowRightIcon />","</a>"):(0,xe.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. */
65 +(0,xe.__)("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"),"<a>","<ArrowNarrowRightIcon />","</a>"),_)})]}),u&&(0,Se.jsx)(i.Alert,{className:"yst-my-4",children:(0,xe.sprintf)(/* translators: %s is for Yoast SEO Premium. */ /* translators: %s is for Yoast SEO Premium. */
66 +(0,xe.__)("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,Se.jsxs)("div",{className:De()("yst-w-full yst-flex yst-flex-col",u?"yst-mt-0":"yst-mt-6"),children:[(0,Se.jsxs)(i.Button,{as:"a",className:"yst-grow",size:"extra-large",variant:"upsell",href:x,target:"_blank",ref:h,"data-action":"load-nfd-ctb","data-ctb-id":w,children:[(0,Se.jsx)(Ce(),{className:"yst--ms-1 yst-me-2 yst-h-5 yst-w-5"}),y,(0,Se.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
67 +(0,xe.__)("(Opens in a new browser tab)","wordpress-seo")})]}),!u&&(0,Se.jsx)(i.Button,{variant:"ai-secondary",onClick:k,className:"yst-mt-2 yst-w-full yst-text-base yst-text-slate-800 yst-font-medium yst-h-11",children:(0,xe.__)("Try for free","wordpress-seo")})]}),(0,Se.jsx)(i.Button,{as:"a",className:"yst-mt-4",variant:"tertiary",onClick:m,children:(0,xe.__)("Close","wordpress-seo")})]})]})},Us=({isOpen:e,onClose:t,closeButtonScreenReaderText:s,panelRef:r,title:o,aiModalHelperLink:n,children:a})=>{const l=(0,i.useSvgAria)();return(0,Se.jsx)(i.Modal,{className:"yst-ai-modal",isOpen:e,onClose:t,children:(0,Se.jsx)(i.Modal.Panel,{ref:r,className:"yst-max-w-3xl yst-relative",closeButtonScreenReaderText:s,children:(0,Se.jsxs)(i.Modal.Container,{children:[(0,Se.jsxs)(i.Modal.Container.Header,{children:[(0,Se.jsxs)("div",{className:"yst-flex yst-items-center",children:[(0,Se.jsx)("span",{className:"yst-logo-icon yst-h-5 yst-w-5"}),(0,Se.jsx)(i.Modal.Title,{className:"yst-ms-3 yst-me-1.5",as:"h1",size:"2",children:o}),(0,Se.jsx)(i.Link,{id:"ai-modal-learn-more",href:n,variant:"primary",className:"yst-no-underline yst-me-2",target:"_blank",rel:"noopener"
68 +/* translators: Hidden accessibility text. */,"aria-label":(0,xe.__)("Learn more about AI (Opens in a new browser tab)","wordpress-seo"),children:(0,Se.jsx)(Vt(),{...l,className:"yst-w-4 yst-h-4 yst-text-slate-500 yst-shrink-0"})}),(0,Se.jsx)(i.Badge,{variant:"info",children:(0,xe.__)("Beta","wordpress-seo")})]}),(0,Se.jsx)("hr",{className:"yst-mt-6 yst--mx-6"})]}),a]})})})},qs=({isOpen:e,onClose:t,closeButtonScreenReaderText:s,children:r})=>(0,Se.jsx)(i.Modal,{className:"yst-introduction-modal",isOpen:e,onClose:t,children:(0,Se.jsx)(i.Modal.Panel,{className:"yst-max-w-lg yst-p-0 yst-rounded-3xl",closeButtonScreenReaderText:s,children:r})}),Ws={inactive:"inactive",askConsent:"askConsent",upsell:"upsell",generate:"generate"},Bs=({onUseAi:e})=>{const[s,r]=(0,we.useState)(Ws.inactive),{editType:o,previewType:n}=ms(),a=gs(),l=(()=>{const{editType:e,previewType:t}=ms();switch(t){case oe:return e===le?(0,xe.__)("AI social description generator","wordpress-seo"):(0,xe.__)("AI social title generator","wordpress-seo");case ne:return e===le?(0,xe.__)("AI X description generator","wordpress-seo"):(0,xe.__)("AI X title generator","wordpress-seo");default:return e===le?(0,xe.__)("AI description generator","wordpress-seo"):(0,xe.__)("AI title generator","wordpress-seo")}})(),{hasConsent:c,promptContentInitialized:d,currentSubscriptions:u,usageCountStatus:p,usageCount:m,usageCountLimit:h,usageCountEndpoint:g,hasValidPremiumSubscription:y,hasValidWooSubscription:x,focusKeyphrase:w,isPremium:f,isSeoAnalysisActive:v,aiModalHelperLink:b,isWooProductEntity:S,isFreeSparksActive:j,isWooSeoActive:C}=(0,t.useSelect)(e=>{const t=e(se),s=e(re);return{hasConsent:t.selectHasAiGeneratorConsent(),promptContentInitialized:t.selectPromptContentInitialized(),currentSubscriptions:t.selectProductSubscriptions(),usageCountStatus:t.selectUsageCountStatus(),usageCount:t.selectUsageCount(),usageCountLimit:t.selectUsageCountLimit(),usageCountEndpoint:t.selectUsageCountEndpoint(),hasValidPremiumSubscription:t.selectPremiumSubscription(),hasValidWooSubscription:t.selectWooCommerceSubscription(),focusKeyphrase:s.getFocusKeyphrase(),isPremium:s.getIsPremium(),isWooSeoActive:s.getIsWooSeoActive(),isSeoAnalysisActive:s.getPreference("isKeywordAnalysisActive",!0),aiModalHelperLink:s.selectLink("https://yoa.st/ai-generator-help-button-modal"),isWooProductEntity:s.getIsWooProductEntity(),isFreeSparksActive:e(se).selectIsFreeSparksActive()}},[]),{fetchUsageCount:k}=(0,t.useDispatch)(se),{closeEditorModal:_}=(0,t.useDispatch)(re),E=(0,xe.__)("Close modal","wordpress-seo"),[R,I]=(0,we.useState)(!1),[L,T]=(0,we.useState)(0),A=(0,we.useCallback)(e=>T(e.borderBoxSize[0].blockSize),[T]),M=ys(A),[P,N]=(0,we.useState)(null),O=(0,we.useCallback)(({currentSubscriptions:e,isSeoAnalysisActive:s})=>{const r=(e=>{const s=(0,t.select)(re),r=[];return((e,t)=>(e.getIsPremium()||e.getIsWooProductEntity())&&!t.premiumSubscription)(s,e)&&r.push("Yoast SEO Premium"),((e,t)=>e.getIsWooProductEntity()&&e.getIsWooSeoActive()&&!t.wooCommerceSubscription)(s,e)&&r.push("Yoast WooCommerce SEO"),r})(e);return r.length>0?{errorCode:402,errorIdentifier:"",invalidSubscriptions:r,errorMessage:""}:s?(()=>{var e,s;const r=(0,t.select)(se);if(r.selectUsageCountStatus()!==B)return null;const i=r.selectUsageCountError();return{errorCode:i.errorCode,errorIdentifier:null!==(e=i.errorIdentifier)&&void 0!==e?e:"",invalidSubscriptions:[],errorMessage:null!==(s=i.errorMessage)&&void 0!==s?s:""}})():{errorCode:0,errorIdentifier:"SEO_ANALYSIS_INACTIVE",invalidSubscriptions:[],errorMessage:""}},[]),$=(0,we.useCallback)(()=>{r(Ws.inactive)},[]),F=(0,we.useCallback)(()=>N(null),[]),U=(0,we.useCallback)(()=>{N(null),r(Ws.generate)},[]),W=(0,we.useCallback)(()=>{N(O({currentSubscriptions:u,isSeoAnalysisActive:v})),r(Ws.inactive)},[O,u,v]),G=(0,we.useCallback)(e=>{N(e),r(Ws.inactive)},[]),D={onClose:$,closeButtonScreenReaderText:E},H=(0,we.useCallback)(()=>!os(w),[w]),z=Ps(!1),Y=(0,we.useCallback)(()=>{_(),"pre-publish"===a&&z(),setTimeout(()=>(e=>{const t=`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 s=document.getElementById(t);s&&s.focus()})(a),0)},[_,a,z]),V=(0,we.useCallback)(()=>S?x&&y:y,[y,x,S]),K=(0,we.useCallback)(async()=>{if(e(),!v)return void W();if(!H())return r(Ws.inactive),void Y();const t=V();if(!t&&f&&C&&S)return void W();if(!t&&f&&!S)return void W();if(!c&&(j||t))return void r(Ws.askConsent);I(!0);const{type:s,payload:i}=await k({endpoint:g,isWooProductEntity:S}),o=429===(null==i?void 0:i.errorCode)&&!(null!=i&&i.errorIdentifier)&&0===(null==i?void 0:i.missingLicenses.length),n=429===(null==i?void 0:i.errorCode)&&"USAGE_LIMIT_REACHED"===(null==i?void 0:i.errorIdentifier)||i.count>=i.limit;I(!1),o?W():403!==(null==i?void 0:i.errorCode)||!j&&!t?s!==js||429===(null==i?void 0:i.errorCode)||403===(null==i?void 0:i.errorCode)?s===js&&429===(null==i?void 0:i.errorCode)&&t?W():!t&&!j||!t&&n?r(Ws.upsell):(t&&c&&r(Ws.generate),!t&&j&&!n&&c&&r(Ws.generate)):W():r(Ws.askConsent)},[e,f,j,c,v,H,Y,W,g,k,C,S,R]),Z=(0,we.useCallback)(async()=>{const{type:e,payload:t}=await k({endpoint:g,isWooProductEntity:S}),s=429===(null==t?void 0:t.errorCode)||t.count>=t.limit,i=V();!s||i?e!==js?r(Ws.generate):W():r(Ws.upsell)},[r,W,g,k,V,S]),X=(0,we.useCallback)(()=>{r(c?Ws.generate:Ws.askConsent)},[r,c]),J=(0,we.useMemo)(()=>"google"===n?"title"===o?(0,xe.__)("Generate SEO title","wordpress-seo"):(0,xe.__)("Generate meta description","wordpress-seo"):"social"===n||"twitter"===n?"title"===o?(0,xe.__)("Generate social title","wordpress-seo"):(0,xe.__)("Generate social description","wordpress-seo"):void 0,[n,o]);return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(i.Button,{type:"button",variant:"ai-secondary",size:"small",id:`yst-replacevar__use-ai-button__${o}__${a}`,onClick:K,disabled:p===q||!d,isLoading:R&&p===q,children:J}),(0,Se.jsxs)(qs,{...D,isOpen:[Ws.askConsent,Ws.upsell].includes(s),children:[s===Ws.askConsent&&(0,Se.jsx)(Ts,{onStartGenerating:Z}),s===Ws.upsell&&(0,Se.jsx)(Fs,{onActivateFreeSparks:X})]}),(0,Se.jsx)(Us,{...D,isOpen:s===Ws.generate,aiModalHelperLink:b,panelRef:M,title:l,children:s===Ws.generate&&(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Kt.UsageCounter,{limit:h,requests:m,isSkeleton:!1,className:"yst-absolute yst-top-[-11px] yst-end-12 sm:yst-end-16",mentionBetaInTooltip:f,mentionResetInTooltip:f}),(0,Se.jsx)($s,{height:L,onFatalError:G})]})}),P&&(0,Se.jsx)(zt,{isOpen:!0,errorCode:P.errorCode,errorIdentifier:P.errorIdentifier,invalidSubscriptions:P.invalidSubscriptions,errorMessage:P.errorMessage,showActions:!0,onRetry:U,onClose:F})]})};Bs.propTypes={onUseAi:te().func.isRequired};const Gs=({title:e,description:s,status:r,titleForLength:o,showPreviewSkeleton:n,showLengthProgress:a})=>{const l=(0,t.useSelect)(e=>e(re).getSnippetEditorMode(),[]),[c,d]=(0,we.useState)(l),{editType:u}=ms(),p=gs(),m=(({editType:e,title:s,description:r})=>{const i=(0,t.useSelect)(e=>e(re).getDateFromSettings(),[]),o=(0,t.useSelect)(e=>e(re).getContentLocale(),[]),n=(0,t.useSelect)(e=>e(re).isCornerstoneContent(),[]),a=(0,t.useSelect)(e=>e(re).getIsTerm(),[]);return(0,we.useMemo)(()=>e===le?(0,fs.getDescriptionProgress)(r,i,n,a,o):(0,fs.getTitleProgress)(s),[e,s,r,i,n,a,o])})({editType:u,title:o,description:s});return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(fs.ModeSwitcher,{onChange:d,active:c,id:`yst-ai-google-preview-mode-switcher-${p}`,disabled:r===me.loading}),n?(0,Se.jsx)(zs,{}):(0,Se.jsx)(Hs,{mode:c,title:e,description:s}),(0,Se.jsxs)("div",{className:"yst-pt-4",children:[(0,Se.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:u===ae?(0,xe.__)("SEO title width","wordpress-seo"):(0,xe.__)("Meta description length","wordpress-seo")}),(0,Se.jsx)(Ys,{className:"yst-mt-2",progress:a?m.actual:0,min:0,max:m.max,score:m.score})]})]})};Gs.propTypes={title:te().string.isRequired,description:te().string.isRequired,status:te().oneOf(Object.keys(me)).isRequired,titleForLength:te().string.isRequired,showPreviewSkeleton:te().bool.isRequired,showLengthProgress:te().bool.isRequired};const Ds=/mobi/i,Hs=({mode:e,title:s,description:r})=>{var i,n;const a=(0,t.useSelect)(e=>e(re).getBaseUrlFromSettings(),[]),l=(0,t.useSelect)(e=>e(re).getSnippetEditorData().slug||"",[]),c=(0,t.useSelect)(e=>e(re).getDateFromSettings(),[]),d=(0,t.useSelect)(e=>e(re).getFocusKeyphrase(),[]),u=(0,t.useSelect)(e=>e(re).getSnippetEditorPreviewImageUrl(),[]),p=(0,t.useSelect)(e=>e(re).getSiteIconUrlFromSettings(),[]),m=(0,t.useSelect)(e=>e(re).getShoppingData(),[]),h=(0,t.useSelect)(e=>e(re).getSnippetEditorWordsToHighlight(),[]),g=(0,t.useSelect)(e=>e(re).getSiteName(),[]),y=(0,t.useSelect)(e=>e(re).getContentLocale(),[]),x=(0,we.useMemo)(()=>a+l,[a,l]),w=(0,we.useMemo)(()=>{var e,t;return Ds.test(null===(e=window)||void 0===e||null===(t=e.navigator)||void 0===t?void 0:t.userAgent)},[null===(i=window)||void 0===i||null===(n=i.navigator)||void 0===n?void 0:n.userAgent]);return(0,Se.jsx)("div",{className:`yst-ai-generator-preview-section ${e}${w?" yst-user-agent__mobile":""}`,children:(0,Se.jsx)(fs.SnippetPreview,{title:s,description:r,mode:e,url:x,keyword:d,date:c,faviconSrc:p,mobileImageSrc:u,wordsToHighlight:h,siteName:g,locale:y,shoppingData:m,onMouseUp:o.noop})})};Hs.propTypes={mode:te().oneOf(Object.keys({mobile:"mobile",desktop:"desktop"})).isRequired,title:te().string.isRequired,description:te().string.isRequired};const zs=()=>(0,Se.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,Se.jsxs)("div",{className:"yst-flex yst-gap-x-3",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-flex-shrink-0 yst-h-7 yst-w-7 yst-rounded-full"}),(0,Se.jsxs)("div",{className:"yst-flex yst-flex-col yst-w-full yst-gap-y-1",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-2.5 yst-w-10/12"})]})]}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-4 yst-w-full yst-mt-6 yst-mb-4"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-10/12 yst-mt-2.5"})]}),Ys=({className:e="",progress:t,max:s,score:r})=>{const o=(0,we.useMemo)(()=>(e=>e>=7?"yst-score-good":e>=5?"yst-score-ok":"yst-score-bad")(r),[r]);return(0,Se.jsx)(i.ProgressBar,{className:De()("yst-length-progress-bar",o,e),progress:t,min:0,max:s})};Ys.propTypes={className:te().string,progress:te().number.isRequired,max:te().number.isRequired,score:te().number.isRequired};const Vs=({title:e,description:t,showPreviewSkeleton:s})=>(0,Se.jsxs)("div",{children:[(0,Se.jsx)("div",{className:"yst-flex yst-mb-6",children:(0,Se.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:(0,xe.__)("Social preview","wordpress-seo")})}),s?(0,Se.jsx)(zr,{}):(0,Se.jsx)(Hr,{title:e,description:t})]});Vs.propTypes={title:te().string.isRequired,description:te().string.isRequired,showPreviewSkeleton:te().bool.isRequired};const Ks=window.yoast.styledComponents;var Zs=s.n(Ks);const Xs=Zs().p`
63 69 color: #606770;
64 70 flex-shrink: 0;
65 71 font-size: 12px;
66 72 line-height: 16px;
@@ -70,9 +76,9 @@
70 76 text-transform: uppercase;
71 77 white-space: nowrap;
72 78 margin: 0;
73 79 position: ${e=>"landscape"===e.mode?"relative":"static"};
74 -`,Vt=e=>{const{siteUrl:t}=e;return(0,he.jsxs)(B.Fragment,{children:[(0,he.jsx)("span",{className:"screen-reader-text",children:t}),(0,he.jsx)(zt,{"aria-hidden":"true",children:(0,he.jsx)("span",{children:t})})]})};Vt.propTypes={siteUrl:K().string.isRequired};const Yt=Vt,Kt=window.yoast.socialMetadataForms,Zt=window.yoast.styleGuide,Xt=Ht().img`
80 +`,Js=e=>{const{siteUrl:t}=e;return(0,Se.jsxs)(Le.Fragment,{children:[(0,Se.jsx)("span",{className:"screen-reader-text",children:t}),(0,Se.jsx)(Xs,{"aria-hidden":"true",children:(0,Se.jsx)("span",{children:t})})]})};Js.propTypes={siteUrl:te().string.isRequired};const Qs=Js,er=window.yoast.socialMetadataForms,tr=window.yoast.styleGuide,sr=Zs().img`
75 81 && {
76 82 max-width: ${e=>e.width}px;
77 83 height: ${e=>e.height}px;
78 84 position: absolute;
@@ -80,9 +86,9 @@
80 86 left: 50%;
81 87 transform: translate(-50%, -50%);
82 88 max-width: none;
83 89 }
84 -`,Jt=Ht().img`
90 +`,rr=Zs().img`
85 91 && {
86 92 height: 100%;
87 93 position: absolute;
88 94 width: 100%;
@@ -87,20 +93,20 @@
87 93 position: absolute;
88 94 width: 100%;
89 95 object-fit: cover;
90 96 }
91 -`,Qt=Ht().div`
97 +`,ir=Zs().div`
92 98 padding-bottom: ${e=>e.aspectRatio}%;
93 -`,es=({imageProps:e,width:t,height:s,imageMode:r="landscape"})=>"landscape"===r?(0,he.jsx)(Qt,{aspectRatio:e.aspectRatio,children:(0,he.jsx)(Jt,{src:e.src,alt:e.alt})}):(0,he.jsx)(Xt,{src:e.src,alt:e.alt,width:t,height:s,imageProperties:e});function ts(e,t,s){return"landscape"===s?{widthRatio:t.width/e.landscapeWidth,heightRatio:t.height/e.landscapeHeight}:"portrait"===s?{widthRatio:t.width/e.portraitWidth,heightRatio:t.height/e.portraitHeight}:{widthRatio:t.width/e.squareWidth,heightRatio:t.height/e.squareHeight}}function ss(e,t){return t.widthRatio<=t.heightRatio?{width:Math.round(e.width/t.widthRatio),height:Math.round(e.height/t.widthRatio)}:{width:Math.round(e.width/t.heightRatio),height:Math.round(e.height/t.heightRatio)}}async function rs(e,t,s=!1){const r=await function(e){return new Promise((t,s)=>{const r=new Image;r.onload=()=>{t({width:r.width,height:r.height})},r.onerror=s,r.src=e})}(e);let i=s?"landscape":"square";"Facebook"===t&&(i=(0,Kt.determineFacebookImageMode)(r));const o=function(e){return"Twitter"===e?Kt.TWITTER_IMAGE_SIZES:Kt.FACEBOOK_IMAGE_SIZES}(t),n=function(e,t,s){return"square"===s&&t.width===t.height?{width:e.squareWidth,height:e.squareHeight}:ss(t,ts(e,t,s))}(o,r,i);return{mode:i,height:n.height,width:n.width}}async function is(e,t,s=!1){try{return{imageProperties:await rs(e,t,s),status:"loaded"}}catch(e){return{imageProperties:null,status:"errored"}}}es.propTypes={imageProps:K().shape({src:K().string.isRequired,alt:K().string.isRequired,aspectRatio:K().number.isRequired}).isRequired,width:K().number.isRequired,height:K().number.isRequired,imageMode:K().string};const os=Ht().div`
99 +`,or=({imageProps:e,width:t,height:s,imageMode:r="landscape"})=>"landscape"===r?(0,Se.jsx)(ir,{aspectRatio:e.aspectRatio,children:(0,Se.jsx)(rr,{src:e.src,alt:e.alt})}):(0,Se.jsx)(sr,{src:e.src,alt:e.alt,width:t,height:s,imageProperties:e});function nr(e,t,s){return"landscape"===s?{widthRatio:t.width/e.landscapeWidth,heightRatio:t.height/e.landscapeHeight}:"portrait"===s?{widthRatio:t.width/e.portraitWidth,heightRatio:t.height/e.portraitHeight}:{widthRatio:t.width/e.squareWidth,heightRatio:t.height/e.squareHeight}}function ar(e,t){return t.widthRatio<=t.heightRatio?{width:Math.round(e.width/t.widthRatio),height:Math.round(e.height/t.widthRatio)}:{width:Math.round(e.width/t.heightRatio),height:Math.round(e.height/t.heightRatio)}}async function lr(e,t,s=!1){const r=await function(e){return new Promise((t,s)=>{const r=new Image;r.onload=()=>{t({width:r.width,height:r.height})},r.onerror=s,r.src=e})}(e);let i=s?"landscape":"square";"Facebook"===t&&(i=(0,er.determineFacebookImageMode)(r));const o=function(e){return"Twitter"===e?er.TWITTER_IMAGE_SIZES:er.FACEBOOK_IMAGE_SIZES}(t),n=function(e,t,s){return"square"===s&&t.width===t.height?{width:e.squareWidth,height:e.squareHeight}:ar(t,nr(e,t,s))}(o,r,i);return{mode:i,height:n.height,width:n.width}}async function cr(e,t,s=!1){try{return{imageProperties:await lr(e,t,s),status:"loaded"}}catch(e){return{imageProperties:null,status:"errored"}}}or.propTypes={imageProps:te().shape({src:te().string.isRequired,alt:te().string.isRequired,aspectRatio:te().number.isRequired}).isRequired,width:te().number.isRequired,height:te().number.isRequired,imageMode:te().string};const dr=Zs().div`
94 100 position: relative;
95 101 ${e=>"landscape"===e.mode?`max-width: ${e.dimensions.width}`:`min-width: ${e.dimensions.width}; height: ${e.dimensions.height}`};
96 102 overflow: hidden;
97 - background-color: ${Zt.colors.$color_white};
98 -`,ns=Ht().div`
103 + background-color: ${tr.colors.$color_white};
104 +`,ur=Zs().div`
99 105 box-sizing: border-box;
100 - max-width: ${Kt.FACEBOOK_IMAGE_SIZES.landscapeWidth}px;
101 - height: ${Kt.FACEBOOK_IMAGE_SIZES.landscapeHeight}px;
102 - background-color: ${Zt.colors.$color_grey};
106 + max-width: ${er.FACEBOOK_IMAGE_SIZES.landscapeWidth}px;
107 + height: ${er.FACEBOOK_IMAGE_SIZES.landscapeHeight}px;
108 + background-color: ${tr.colors.$color_grey};
103 109 border-style: dashed;
104 110 border-width: 1px;
105 111 // We're not using standard colors to increase contrast for accessibility.
106 112 color: #006DAC;
@@ -111,9 +117,9 @@
111 117 align-items: center;
112 118 text-decoration: underline;
113 119 font-size: 14px;
114 120 cursor: pointer;
115 -`;class as extends B.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 is(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:Kt.FACEBOOK_IMAGE_SIZES.squareHeight+"px",width:Kt.FACEBOOK_IMAGE_SIZES.squareWidth+"px"};case"portrait":return{height:Kt.FACEBOOK_IMAGE_SIZES.portraitHeight+"px",width:Kt.FACEBOOK_IMAGE_SIZES.portraitWidth+"px"};case"landscape":return{height:Kt.FACEBOOK_IMAGE_SIZES.landscapeHeight+"px",width:Kt.FACEBOOK_IMAGE_SIZES.landscapeWidth+"px"}}}render(){const{imageProperties:e,status:t}=this.state;if("loading"===t||""===this.props.src||"errored"===t)return(0,he.jsx)(ns,{onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,z.__)("Select image","wordpress-seo")});const s=this.retrieveContainerDimensions(e.mode);return(0,he.jsx)(os,{mode:e.mode,dimensions:s,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,onClick:this.props.onImageClick,children:(0,he.jsx)(es,{imageProps:{src:this.props.src,alt:this.props.alt,aspectRatio:Kt.FACEBOOK_IMAGE_SIZES.aspectRatio},width:e.width,height:e.height,imageMode:e.mode})})}}as.propTypes={src:K().string,alt:K().string,onImageLoaded:K().func,onImageClick:K().func,onMouseEnter:K().func,onMouseLeave:K().func},as.defaultProps={src:"",alt:"",onImageLoaded:o.noop,onImageClick:o.noop,onMouseEnter:o.noop,onMouseLeave:o.noop};const ls=as,cs=Ht().span`
121 +`;class pr extends Le.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 cr(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:er.FACEBOOK_IMAGE_SIZES.squareHeight+"px",width:er.FACEBOOK_IMAGE_SIZES.squareWidth+"px"};case"portrait":return{height:er.FACEBOOK_IMAGE_SIZES.portraitHeight+"px",width:er.FACEBOOK_IMAGE_SIZES.portraitWidth+"px"};case"landscape":return{height:er.FACEBOOK_IMAGE_SIZES.landscapeHeight+"px",width:er.FACEBOOK_IMAGE_SIZES.landscapeWidth+"px"}}}render(){const{imageProperties:e,status:t}=this.state;if("loading"===t||""===this.props.src||"errored"===t)return(0,Se.jsx)(ur,{onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,xe.__)("Select image","wordpress-seo")});const s=this.retrieveContainerDimensions(e.mode);return(0,Se.jsx)(dr,{mode:e.mode,dimensions:s,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,onClick:this.props.onImageClick,children:(0,Se.jsx)(or,{imageProps:{src:this.props.src,alt:this.props.alt,aspectRatio:er.FACEBOOK_IMAGE_SIZES.aspectRatio},width:e.width,height:e.height,imageMode:e.mode})})}}pr.propTypes={src:te().string,alt:te().string,onImageLoaded:te().func,onImageClick:te().func,onMouseEnter:te().func,onMouseLeave:te().func},pr.defaultProps={src:"",alt:"",onImageLoaded:o.noop,onImageClick:o.noop,onMouseEnter:o.noop,onMouseLeave:o.noop};const mr=pr,hr=Zs().span`
116 122 line-height: ${20}px;
117 123 min-height : ${20}px;
118 124 color: #1d2129;
119 125 font-weight: 600;
@@ -127,9 +133,9 @@
127 133 display: -webkit-box;
128 134 -webkit-line-clamp: ${e=>e.lineCount};
129 135 -webkit-box-orient: vertical;
130 136 overflow: hidden;
131 -`,ds=Ht().p`
137 +`,gr=Zs().p`
132 138 line-height: ${16}px;
133 139 min-height : ${16}px;
134 140 color: #606770;
135 141 font-size: 14px;
@@ -144,15 +150,15 @@
144 150
145 151 @media all and ( max-width: ${e=>e.maxWidth} ) {
146 152 display: none;
147 153 }
148 -`,us=e=>{switch(e){case"landscape":return"527px";case"square":case"portrait":return"369px";default:return"476px"}},ps=Ht().div`
154 +`,yr=e=>{switch(e){case"landscape":return"527px";case"square":case"portrait":return"369px";default:return"476px"}},xr=Zs().div`
149 155 box-sizing: border-box;
150 156 display: flex;
151 157 flex-direction: ${e=>"landscape"===e.mode?"column":"row"};
152 158 background-color: #f2f3f5;
153 159 max-width: 527px;
154 -`,ms=Ht().div`
160 +`,wr=Zs().div`
155 161 box-sizing: border-box;
156 162 background-color: #f2f3f5;
157 163 margin: 0;
158 164 padding: 10px 12px;
@@ -166,9 +172,9 @@
166 172 flex-grow: 1;
167 173 justify-content: ${e=>"landscape"===e.mode?"flex-start":"center"};
168 174 font-size: 12px;
169 175 overflow: hidden;
170 -`;class hs extends B.Component{constructor(e){super(e),this.state={imageMode:null,maxLineCount:0,descriptionLineCount:0},this.facebookTitleRef=G().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:t}=this.state,s="landscape"===e?2:5;s!==t&&this.setState({maxLineCount:s})}maybeSetDescriptionLineCount(){const{descriptionLineCount:e,maxLineCount:t,imageMode:s}=this.state,r=this.getTitleLineCount();let i=t-r;"portrait"===s&&(i=5===r?0:4),i!==e&&this.setState({descriptionLineCount:i})}componentDidUpdate(){this.maybeSetMaxLineCount(),this.maybeSetDescriptionLineCount()}render(){const{imageMode:e,maxLineCount:t,descriptionLineCount:s}=this.state;return(0,he.jsxs)(ps,{id:"facebookPreview",mode:e,children:[(0,he.jsx)(ls,{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,he.jsxs)(ms,{mode:e,children:[(0,he.jsx)(Yt,{siteUrl:this.props.siteUrl,mode:e}),(0,he.jsx)(cs,{ref:this.facebookTitleRef,onMouseEnter:this.onTitleEnter,onMouseLeave:this.onLeave,onClick:this.onSelectTitle,lineCount:t,children:this.props.title}),s>0&&(0,he.jsx)(ds,{maxWidth:us(e),onMouseEnter:this.onDescriptionEnter,onMouseLeave:this.onLeave,onClick:this.onSelectDescription,lineCount:s,children:this.props.description})]})]})}}hs.propTypes={siteUrl:K().string.isRequired,title:K().string.isRequired,description:K().string,imageUrl:K().string,imageFallbackUrl:K().string,alt:K().string,onSelect:K().func,onImageClick:K().func,onMouseHover:K().func},hs.defaultProps={description:"",alt:"",imageUrl:"",imageFallbackUrl:"",onSelect:()=>{},onImageClick:()=>{},onMouseHover:()=>{}};const gs=hs,ys=Ht().div`
176 +`;class fr extends Le.Component{constructor(e){super(e),this.state={imageMode:null,maxLineCount:0,descriptionLineCount:0},this.facebookTitleRef=Te().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:t}=this.state,s="landscape"===e?2:5;s!==t&&this.setState({maxLineCount:s})}maybeSetDescriptionLineCount(){const{descriptionLineCount:e,maxLineCount:t,imageMode:s}=this.state,r=this.getTitleLineCount();let i=t-r;"portrait"===s&&(i=5===r?0:4),i!==e&&this.setState({descriptionLineCount:i})}componentDidUpdate(){this.maybeSetMaxLineCount(),this.maybeSetDescriptionLineCount()}render(){const{imageMode:e,maxLineCount:t,descriptionLineCount:s}=this.state;return(0,Se.jsxs)(xr,{id:"facebookPreview",mode:e,children:[(0,Se.jsx)(mr,{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,Se.jsxs)(wr,{mode:e,children:[(0,Se.jsx)(Qs,{siteUrl:this.props.siteUrl,mode:e}),(0,Se.jsx)(hr,{ref:this.facebookTitleRef,onMouseEnter:this.onTitleEnter,onMouseLeave:this.onLeave,onClick:this.onSelectTitle,lineCount:t,children:this.props.title}),s>0&&(0,Se.jsx)(gr,{maxWidth:yr(e),onMouseEnter:this.onDescriptionEnter,onMouseLeave:this.onLeave,onClick:this.onSelectDescription,lineCount:s,children:this.props.description})]})]})}}fr.propTypes={siteUrl:te().string.isRequired,title:te().string.isRequired,description:te().string,imageUrl:te().string,imageFallbackUrl:te().string,alt:te().string,onSelect:te().func,onImageClick:te().func,onMouseHover:te().func},fr.defaultProps={description:"",alt:"",imageUrl:"",imageFallbackUrl:"",onSelect:()=>{},onImageClick:()=>{},onMouseHover:()=>{}};const vr=fr,br=Zs().div`
171 177 text-transform: lowercase;
172 178 color: rgb(83, 100, 113);
173 179 white-space: nowrap;
174 180 overflow: hidden;
@@ -177,16 +183,16 @@
177 183 fill: currentcolor;
178 184 display: flex;
179 185 flex-direction: row;
180 186 align-items: flex-end;
181 -`,ws=e=>(0,he.jsx)(ys,{children:(0,he.jsx)("span",{children:e.siteUrl})});ws.propTypes={siteUrl:K().string.isRequired};const xs=ws,fs=(e,t=!0)=>e?`\n\t\t\tmax-width: ${Kt.TWITTER_IMAGE_SIZES.landscapeWidth}px;\n\t\t\t${t?"border-bottom: 1px solid #E1E8ED;":""}\n\t\t\tborder-radius: 14px 14px 0 0;\n\t\t\t`:`\n\t\twidth: ${Kt.TWITTER_IMAGE_SIZES.squareWidth}px;\n\t\t${t?"border-right: 1px solid #E1E8ED;":""}\n\t\tborder-radius: 14px 0 0 14px;\n\t\t`,vs=Ht().div`
187 +`,Sr=e=>(0,Se.jsx)(br,{children:(0,Se.jsx)("span",{children:e.siteUrl})});Sr.propTypes={siteUrl:te().string.isRequired};const jr=Sr,Cr=(e,t=!0)=>e?`\n\t\t\tmax-width: ${er.TWITTER_IMAGE_SIZES.landscapeWidth}px;\n\t\t\t${t?"border-bottom: 1px solid #E1E8ED;":""}\n\t\t\tborder-radius: 14px 14px 0 0;\n\t\t\t`:`\n\t\twidth: ${er.TWITTER_IMAGE_SIZES.squareWidth}px;\n\t\t${t?"border-right: 1px solid #E1E8ED;":""}\n\t\tborder-radius: 14px 0 0 14px;\n\t\t`,kr=Zs().div`
182 188 position: relative;
183 189 box-sizing: content-box;
184 190 overflow: hidden;
185 191 background-color: #e1e8ed;
186 192 flex-shrink: 0;
187 - ${e=>fs(e.isLarge)}
188 -`,bs=Ht().div`
193 + ${e=>Cr(e.isLarge)}
194 +`,_r=Zs().div`
189 195 display: flex;
190 196 justify-content: center;
191 197 align-items: center;
192 198 box-sizing: border-box;
@@ -194,11 +200,11 @@
194 200 margin: 0;
195 201 padding: 1em;
196 202 text-align: center;
197 203 font-size: 1rem;
198 - ${e=>fs(e.isLarge,!1)}
199 -`,Ss=Ht()(bs)`
200 - ${e=>e.isLarge&&`height: ${Kt.TWITTER_IMAGE_SIZES.landscapeHeight}px;`}
204 + ${e=>Cr(e.isLarge,!1)}
205 +`,Er=Zs()(_r)`
206 + ${e=>e.isLarge&&`height: ${er.TWITTER_IMAGE_SIZES.landscapeHeight}px;`}
201 207 border-top-left-radius: 14px;
202 208 ${e=>e.isLarge?"border-top-right-radius":"border-bottom-left-radius"}: 14px;
203 209 border-style: dashed;
204 210 border-width: 1px;
@@ -208,9 +214,9 @@
208 214 background-color: #f1f1f1;
209 215 text-decoration: underline;
210 216 font-size: 14px;
211 217 cursor: pointer;
212 -`;class ks extends G().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 is(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:t}=this.state;return"loading"===e||""===this.props.src||"errored"===e?(0,he.jsx)(Ss,{isLarge:this.props.isLarge,onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,z.__)("Select image","wordpress-seo")}):(0,he.jsx)(vs,{isLarge:this.props.isLarge,onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,he.jsx)(es,{imageProps:{src:this.props.src,alt:this.props.alt,aspectRatio:Kt.TWITTER_IMAGE_SIZES.aspectRatio},width:t.width,height:t.height,imageMode:t.mode})})}}ks.propTypes={isLarge:K().bool.isRequired,src:K().string,alt:K().string,onImageClick:K().func,onMouseEnter:K().func,onMouseLeave:K().func},ks.defaultProps={src:"",alt:"",onMouseEnter:o.noop,onImageClick:o.noop,onMouseLeave:o.noop};const Cs=Ht().div`
218 +`;class Rr extends Te().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 cr(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:t}=this.state;return"loading"===e||""===this.props.src||"errored"===e?(0,Se.jsx)(Er,{isLarge:this.props.isLarge,onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,xe.__)("Select image","wordpress-seo")}):(0,Se.jsx)(kr,{isLarge:this.props.isLarge,onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,Se.jsx)(or,{imageProps:{src:this.props.src,alt:this.props.alt,aspectRatio:er.TWITTER_IMAGE_SIZES.aspectRatio},width:t.width,height:t.height,imageMode:t.mode})})}}Rr.propTypes={isLarge:te().bool.isRequired,src:te().string,alt:te().string,onImageClick:te().func,onMouseEnter:te().func,onMouseLeave:te().func},Rr.defaultProps={src:"",alt:"",onMouseEnter:o.noop,onImageClick:o.noop,onMouseLeave:o.noop};const Ir=Zs().div`
213 219 display: flex;
214 220 flex-direction: column;
215 221 padding: 12px;
216 222 justify-content: center;
@@ -223,9 +229,9 @@
223 229 line-height:20px;
224 230 min-height:20px;
225 231 font-size:15px;
226 232 }
227 -`,js=e=>(0,he.jsx)(Cs,{children:e.children});js.propTypes={children:K().array.isRequired};const _s=js,Es=Ht().p`
233 +`,Lr=e=>(0,Se.jsx)(Ir,{children:e.children});Lr.propTypes={children:te().array.isRequired};const Tr=Lr,Ar=Zs().p`
228 234 white-space: nowrap;
229 235 overflow: hidden;
230 236 text-overflow: ellipsis;
231 237 margin: 0;
@@ -230,9 +236,9 @@
230 236 text-overflow: ellipsis;
231 237 margin: 0;
232 238 color: rgb(15, 20, 25);
233 239 cursor: pointer;
234 -`,Rs=Ht().p`
240 +`,Mr=Zs().p`
235 241 max-height: 55px;
236 242 overflow: hidden;
237 243 text-overflow: ellipsis;
238 244 margin: 0;
@@ -241,12 +247,12 @@
241 247 cursor: pointer;
242 248 -webkit-line-clamp: 2;
243 249 -webkit-box-orient: vertical;
244 250
245 - @media all and ( max-width: ${Kt.TWITTER_IMAGE_SIZES.landscapeWidth}px ) {
251 + @media all and ( max-width: ${er.TWITTER_IMAGE_SIZES.landscapeWidth}px ) {
246 252 display: none;
247 253 }
248 -`,Is=Ht().div`
254 +`,Pr=Zs().div`
249 255 font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
250 256 font-size: 15px;
251 257 font-weight: 400;
252 258 line-height: 20px;
@@ -262,17 +268,17 @@
262 268 &:hover {
263 269 background: #f5f8fa;
264 270 border: 1px solid rgba(136,153,166,.5);
265 271 }
266 -`,Ls=Ht()(Is)`
272 +`,Nr=Zs()(Pr)`
267 273 flex-direction: column;
268 274 max-height: 370px;
269 -`,Ts=Ht()(Is)`
275 +`,Or=Zs()(Pr)`
270 276 flex-direction: row;
271 277 height: 125px;
272 -`;class Ps extends B.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:t,imageFallbackUrl:s,alt:r,title:i,description:o,siteUrl:n}=this.props,a=e?Ls:Ts;return(0,he.jsxs)(a,{id:"twitterPreview",children:[(0,he.jsx)(ks,{src:t||s,alt:r,isLarge:e,onImageClick:this.props.onImageClick,onMouseEnter:this.onImageEnter,onMouseLeave:this.onLeave}),(0,he.jsxs)(_s,{children:[(0,he.jsx)(xs,{siteUrl:n}),(0,he.jsx)(Es,{onMouseEnter:this.onTitleEnter,onMouseLeave:this.onLeave,onClick:this.onSelectTitle,children:i}),(0,he.jsx)(Rs,{onMouseEnter:this.onDescriptionEnter,onMouseLeave:this.onLeave,onClick:this.onSelectDescription,children:o})]})]})}}Ps.propTypes={siteUrl:K().string.isRequired,title:K().string.isRequired,description:K().string,isLarge:K().bool,imageUrl:K().string,imageFallbackUrl:K().string,alt:K().string,onSelect:K().func,onImageClick:K().func,onMouseHover:K().func},Ps.defaultProps={description:"",alt:"",imageUrl:"",imageFallbackUrl:"",onSelect:()=>{},onImageClick:()=>{},onMouseHover:()=>{},isLarge:!0};const Ms=Ps,As=window.yoast.componentsNew,Ns=window.yoast.replacementVariableEditor;class $s extends B.Component{constructor(e){super(e),this.state={activeField:"",hoveredField:""},this.SocialPreview="Social"===e.socialMediumName?gs:Ms,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,t){switch(e){case"title":this.titleEditorRef=t;break;case"description":this.descriptionEditorRef=t}}render(){const{onDescriptionChange:e,onTitleChange:t,onSelectImageClick:s,onRemoveImageClick:r,socialMediumName:i,imageWarnings:o,siteUrl:n,description:a,descriptionInputPlaceholder:l,descriptionPreviewFallback:c,imageUrl:d,imageFallbackUrl:u,alt:p,title:m,titleInputPlaceholder:h,titlePreviewFallback:g,replacementVariables:y,recommendedReplacementVariables:w,applyReplacementVariables:x,onReplacementVariableSearchChange:f,isPremium:v,isLarge:b,socialPreviewLabel:S,idSuffix:k,activeMetaTabId:C}=this.props,j=x({title:m||g,description:a||c});return(0,he.jsxs)(G().Fragment,{children:[S&&(0,he.jsx)(As.SimulatedLabel,{children:S}),(0,he.jsx)(this.SocialPreview,{onMouseHover:this.setHoveredField,onSelect:this.setActiveField,onImageClick:s,siteUrl:n,title:j.title,description:j.description,imageUrl:d,imageFallbackUrl:u,alt:p,isLarge:b,activeMetaTabId:C}),(0,he.jsx)(Kt.SocialMetadataPreviewForm,{onDescriptionChange:e,socialMediumName:i,title:m,titleInputPlaceholder:h,onRemoveImageClick:r,imageSelected:!!d,imageUrl:d,imageFallbackUrl:u,onTitleChange:t,onSelectImageClick:s,description:a,descriptionInputPlaceholder:l,imageWarnings:o,replacementVariables:y,recommendedReplacementVariables:w,onReplacementVariableSearchChange:f,onMouseHover:this.setHoveredField,hoveredField:this.state.hoveredField,onSelect:this.setActiveField,activeField:this.state.activeField,isPremium:v,setEditorRef:this.setEditorRef,idSuffix:k})]})}}$s.propTypes={title:K().string.isRequired,onTitleChange:K().func.isRequired,description:K().string.isRequired,onDescriptionChange:K().func.isRequired,imageUrl:K().string.isRequired,imageFallbackUrl:K().string.isRequired,onSelectImageClick:K().func.isRequired,onRemoveImageClick:K().func.isRequired,socialMediumName:K().string.isRequired,alt:K().string,isPremium:K().bool,imageWarnings:K().array,isLarge:K().bool,siteUrl:K().string,descriptionInputPlaceholder:K().string,titleInputPlaceholder:K().string,descriptionPreviewFallback:K().string,titlePreviewFallback:K().string,replacementVariables:Ns.replacementVariablesShape,recommendedReplacementVariables:Ns.recommendedReplacementVariablesShape,applyReplacementVariables:K().func,onReplacementVariableSearchChange:K().func,socialPreviewLabel:K().string,idSuffix:K().string,activeMetaTabId:K().string},$s.defaultProps={imageWarnings:[],recommendedReplacementVariables:[],replacementVariables:[],isPremium:!1,isLarge:!0,siteUrl:"",descriptionInputPlaceholder:"",titleInputPlaceholder:"",descriptionPreviewFallback:"",titlePreviewFallback:"",alt:"",applyReplacementVariables:e=>e,onReplacementVariableSearchChange:null,socialPreviewLabel:"",idSuffix:"",activeMetaTabId:""};const Fs={},qs=(e,t,{log:s=console.warn}={})=>{Fs[e]||(Fs[e]=!0,s(t))},Os=(e,t=o.noop)=>{const s={};for(const r in e)Object.hasOwn(e,r)&&Object.defineProperty(s,r,{set:s=>{e[r]=s,t("set",r,s)},get:()=>(t("get",r),e[r])});return s};Os({squareWidth:125,squareHeight:125,landscapeWidth:506,landscapeHeight:265,aspectRatio:50.2},(e,t)=>qs(`@yoast/social-metadata-previews/TWITTER_IMAGE_SIZES/${e}/${t}`,`[@yoast/social-metadata-previews] "TWITTER_IMAGE_SIZES.${t}" is deprecated and will be removed in the future, please use this from @yoast/social-metadata-forms instead.`)),Os({squareWidth:158,squareHeight:158,landscapeWidth:527,landscapeHeight:273,portraitWidth:158,portraitHeight:237,aspectRatio:52.2,largeThreshold:{width:446,height:233}},(e,t)=>qs(`@yoast/social-metadata-previews/FACEBOOK_IMAGE_SIZES/${e}/${t}`,`[@yoast/social-metadata-previews] "FACEBOOK_IMAGE_SIZES.${t}" is deprecated and will be removed in the future, please use this from @yoast/social-metadata-forms instead.`));const Us=({title:e,description:s})=>{const r=(0,t.useSelect)(e=>e(X).getSiteUrl(),[]),i=(0,t.useSelect)(e=>e(X).getFacebookImageUrl(),[]),n=(0,t.useSelect)(e=>e(X).getEditorDataImageFallback(),[]),a=(0,t.useSelect)(e=>e(X).getFacebookAltText(),[]);return(0,he.jsx)("div",{className:"yst-ai-generator-preview-section",children:(0,he.jsx)(gs,{title:e,description:s,siteUrl:r,imageUrl:i,imageFallbackUrl:n,alt:a,onSelect:o.noop,onImageClick:o.noop,onMouseHover:o.noop})})};Us.propTypes={title:K().string.isRequired,description:K().string.isRequired};const Ws=()=>(0,he.jsxs)("div",{className:"yst-flex yst-flex-col yst-w-[527px] yst-border yst-mx-auto",children:[(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-[273px] yst-w-full yst-rounded-none yst-border yst-border-dashed"}),(0,he.jsxs)("div",{className:"yst-w-full yst-p-4 yst-space-y-1",children:[(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-5 yst-w-10/12"}),(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"})]})]}),Bs=({children:e,onRetry:t})=>{const{onClose:s}=(0,i.useModalContext)();return(0,he.jsxs)(H.Fragment,{children:[e,(0,he.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,he.jsx)(i.Button,{variant:"secondary",onClick:s,children:(0,z.__)("Close","wordpress-seo")}),(0,he.jsx)(i.Button,{variant:"primary",onClick:t,children:(0,z.__)("Try again","wordpress-seo")})]})]})};Bs.propTypes={children:K().node.isRequired,onRetry:K().func.isRequired};const Gs=({errorCode:e,errorIdentifier:t,invalidSubscriptions:s=[],showActions:r=!1,onRetry:i=o.noop,errorMessage:n=""})=>{switch(e){case 400:switch(t){case"AI_CONTENT_FILTER":return(0,he.jsx)(bt,{});case"NOT_ENOUGH_CONTENT":return(0,he.jsx)(yt,{});case"SITE_UNREACHABLE":return(0,he.jsx)(Ct,{});case"WP_HTTP_REQUEST_ERROR":return r?(0,he.jsx)(Bs,{onRetry:i,children:(0,he.jsx)(St,{errorMessage:n})}):(0,he.jsx)(St,{errorMessage:n});default:return r?(0,he.jsx)(Bs,{onRetry:i,children:(0,he.jsx)(gt,{})}):(0,he.jsx)(gt,{})}case 402:return(0,he.jsx)(ft,{invalidSubscriptions:s});case 408:return r?(0,he.jsx)(Bs,{onRetry:i,children:(0,he.jsx)(vt,{})}):(0,he.jsx)(vt,{});case 429:return"USAGE_LIMIT_REACHED"===t?(0,he.jsx)(ft,{invalidSubscriptions:s}):(0,he.jsx)(xt,{});case 410:return(0,he.jsx)(kt,{});default:return r?(0,he.jsx)(Bs,{onRetry:i,children:(0,he.jsx)(gt,{})}):(0,he.jsx)(gt,{})}};Gs.propTypes={errorCode:K().number.isRequired,errorIdentifier:K().string.isRequired,invalidSubscriptions:K().array,showActions:K().bool,onRetry:K().func,errorMessage:K().string};const Ds=K().shape({value:K().string.isRequired,label:K().node.isRequired}),Hs=({id:e,name:t,suggestion:s,isChecked:r,onChange:i})=>{const o=(0,H.useCallback)(()=>i(s.value),[s,i]);return(0,he.jsxs)("label",{htmlFor:e,className:ct()("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,he.jsx)("input",{type:"radio",id:e,name:t,className:"yst-radio__input",value:s.value,checked:r,onChange:o}),(0,he.jsx)("div",{className:ct()("yst-label yst-radio__label yst-flex yst-flex-wrap yst-items-center",!r&&"yst-text-slate-600"),children:s.label})]})};Hs.propTypes={id:K().string.isRequired,name:K().string.isRequired,suggestion:Ds.isRequired,isChecked:K().bool.isRequired,onChange:K().func.isRequired};const zs=({idSuffix:e,suggestions:t,selected:s,onChange:r})=>(0,he.jsx)("div",{children:(0,he.jsx)(i.RadioGroup,{className:"yst-suggestions-radio-group yst-flex yst-flex-col",id:`yst-ai-suggestions-radio-group__${e}`,children:t.map((t,i)=>(0,he.jsx)(Hs,{id:`yst-ai-suggestions-radio-${e}__${i}`,name:`ai-suggestion__${e}`,isChecked:t.value===s,onChange:r,suggestion:t},`yst-ai-suggestions-radio-${e}__${i}`))})});zs.propTypes={idSuffix:K().string.isRequired,suggestions:K().arrayOf(Ds).isRequired,selected:K().string.isRequired,onChange:K().func.isRequired};const Vs=[["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"]],Ys=({suggestionClassNames:e=Vs})=>(0,he.jsx)("div",{className:"yst-flex yst-flex-col yst--space-y-[1px]",children:e.map((e,t)=>(0,he.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,he.jsx)("input",{type:"radio",disabled:!0,className:"yst-my-0.5"}),(0,he.jsx)("div",{className:"yst-flex yst-flex-col yst-w-full",children:e.map((e,s)=>(0,he.jsx)(i.SkeletonLoader,{className:e},`yst-ai-suggestion-radio-skeleton-${t}__${s}`))})]},`yst-ai-suggestion-radio-skeleton__${t}`))});Ys.propTypes={suggestionClassNames:K().arrayOf(K().arrayOf(K().string))};const Ks="ai_generator_tip_notification",Zs=()=>{const e=(0,t.useSelect)(e=>e(X).isAlertDismissed(Ks),[]),s=(0,t.useSelect)(e=>e(X).getEditorDataContent(),[]),r=(0,t.useSelect)(e=>e(X).getIsWooProductEntity(),[]),[o,,,n]=(0,i.useToggleState)(!1),{editType:a,contentType:l}=Re(),{dismissAlert:c}=(0,t.useDispatch)(X),d=(0,H.useCallback)(()=>{c(Ks)},[c]),u=(0,H.useMemo)(()=>a===se?(0,z.__)("%1$sTip%2$s: Improve the accuracy of your generated AI descriptions by writing more content in your page.","wordpress-seo"):(0,z.__)("%1$sTip%2$s: Improve the accuracy of your generated AI titles by writing more content in your page.","wordpress-seo")
273 -/* translators: %1$s and %2$s expand to opening and closing of a span in order to emphasise the word. */,[a]),p=(0,H.useMemo)(()=>((e,t)=>e||t===ie?150:300)(r,l),[l,r]);return e||o||s.length>p?null:(0,he.jsxs)(i.Notifications.Notification,{id:"ai-generator-content-tip",variant:"info",dismissScreenReaderLabel:(0,z.__)("Dismiss","wordpress-seo"),children:[me((0,z.sprintf)(u,"<span>","</span>"),{span:(0,he.jsx)("span",{className:"yst-font-medium yst-text-slate-800"})}),(0,he.jsxs)("div",{className:"yst-flex yst-mt-3 yst--ms-3 yst-gap-1",children:[(0,he.jsx)(i.Button,{type:"button",variant:"tertiary",onClick:d,children:(0,z.__)("Don’t show again","wordpress-seo")}),(0,he.jsx)(i.Button,{type:"button",variant:"tertiary",className:"yst-text-slate-800",onClick:n,children:(0,z.__)("Dismiss","wordpress-seo")})]})]})},Xs=({title:e,description:t,showPreviewSkeleton:s})=>(0,he.jsxs)("div",{children:[(0,he.jsx)("div",{className:"yst-flex yst-mb-6",children:(0,he.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:(0,z.__)("X preview","wordpress-seo")})}),s?(0,he.jsx)(Qs,{}):(0,he.jsx)(Js,{title:e,description:t})]});Xs.propTypes={title:K().string.isRequired,description:K().string.isRequired,showPreviewSkeleton:K().bool.isRequired};const Js=({title:e,description:s})=>{const r=(0,t.useSelect)(e=>e(X).getSiteUrl(),[]),i=(0,t.useSelect)(e=>e(X).getTwitterImageUrl(),[]),n=(0,t.useSelect)(e=>e(X).getFacebookImageUrl(),[]),a=(0,t.useSelect)(e=>e(X).getEditorDataImageFallback(),[]),l=(0,t.useSelect)(e=>e(X).getTwitterImageType(),[]),c=(0,t.useSelect)(e=>e(X).getTwitterAltText(),[]);return(0,he.jsx)("div",{className:"yst-ai-generator-preview-section",children:(0,he.jsx)(Ms,{title:e,description:s,siteUrl:r,imageUrl:i,imageFallbackUrl:n||a,isLarge:"summary"!==l,alt:c,onSelect:o.noop,onImageClick:o.noop,onMouseHover:o.noop})})};Js.propTypes={title:K().string.isRequired,description:K().string.isRequired};const Qs=()=>(0,he.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,he.jsx)(i.SkeletonLoader,{className:"yst-h-[265px] yst-w-full yst-rounded-none yst-border yst-border-dashed"}),(0,he.jsxs)("div",{className:"yst-w-full yst-p-4 yst-space-y-1",children:[(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-5 yst-w-10/12"}),(0,he.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"})]})]}),er="yst-mt-1 yst-mb-3",tr="yst-flex yst-justify-end yst--me-8 yst-gap-3 yst--ms-2",sr=({onClose:e})=>(0,he.jsxs)(he.Fragment,{children:[(0,he.jsx)("p",{className:er,children:(0,z.__)("As long as this is a beta feature, you get unlimited sparks.","wordpress-seo")}),(0,he.jsx)("div",{className:tr,children:(0,he.jsx)(i.Button,{type:"button",variant:"primary",size:"small",onClick:e,children:(0,z.__)("Got it!","wordpress-seo")})})]}),rr=({onClose:e,upsellLink:t,isWooProductEntity:s=!1,ctbId:r="f6a84663-465f-4cb5-8ba5-f7a6d72224b2"})=>{const o=(0,i.useSvgAria)();return(0,he.jsxs)(he.Fragment,{children:[(0,he.jsx)("p",{className:er,children:(0,z.sprintf)(/* translators: %s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */ /* translators: %s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */
274 -(0,z.__)("Keep the momentum going, unlock unlimited sparks with %s!","wordpress-seo"),s?"Yoast WooCommerce SEO":"Yoast SEO Premium")}),(0,he.jsxs)("div",{className:tr,children:[(0,he.jsx)(i.Button,{type:"button",variant:"tertiary",size:"small",onClick:e,children:(0,z.__)("Close","wordpress-seo")}),(0,he.jsxs)(i.Button,{as:"a",size:"small",variant:"upsell",href:t,target:"_blank",rel:"noopener noreferrer","data-action":"load-nfd-ctb","data-ctb-id":r,children:[(0,he.jsx)(ze,{className:"yst-w-4 yst-h-4 yst--ms-1 yst-me-2 yst-shrink-0",...o}),(0,z.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. */
275 -(0,z.__)("Unlock with %1$s","wordpress-seo"),s?"Yoast WooCommerce SEO":"Yoast SEO Premium"),(0,he.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
276 -(0,z.__)("(Opens in a new browser tab)","wordpress-seo")})]})]})]})},ir=({className:e=""})=>{const{isUsageCountLimitReached:s,usageCount:r,usageCountLimit:o,premiumUpsellLink:n,wooUpsellLink:a,isWooProductEntity:l,hasValidPremiumSubscription:c,hasValidWooSubscription:d}=(0,t.useSelect)(e=>{const t=e(Z),s=e(X);return{isUsageCountLimitReached:t.isUsageCountLimitReached(),usageCount:t.selectUsageCount(),usageCountLimit:t.selectUsageCountLimit(),premiumUpsellLink:s.selectLink("https://yoa.st/ai-toast-out-of-free-sparks"),wooUpsellLink:s.selectLink("https://yoa.st/ai-toast-out-of-free-sparks-woo"),isWooProductEntity:s.getIsWooProductEntity(),hasValidPremiumSubscription:t.selectPremiumSubscription(),hasValidWooSubscription:t.selectWooCommerceSubscription()}},[]),u=(0,H.useMemo)(()=>c&&!l||l&&d&&c,[c,l,d]),[p,,m,,h]=(0,i.useToggleState)(r===o),g=Math.max(0,o-r);(0,H.useEffect)(()=>{m(u&&r===o||!u&&g<=5)},[r,o,u,s]);const y=(0,H.useMemo)(()=>l?a:n,[l,a,n]),w=(0,H.useMemo)(()=>l&&!d,[l,d]);return p&&(0,he.jsx)(i.Notifications.Notification,{id:"ai-sparks-limit",className:e,variant:"info",dismissScreenReaderLabel:(0,z.__)("Close","wordpress-seo"),title:u?(0,z.sprintf)(/* translators: %s is the number of the sparks. */ /* translators: %s is the number of the sparks. */
277 -(0,z._n)("You've used %s spark this month.","You've used %s sparks this month.",r,"wordpress-seo"),r):g<=5&&!s?(0,z.sprintf)(/* translators: %s is the number of the sparks. */ /* translators: %s is the number of the sparks. */
278 -(0,z._n)("%s free spark left!","%s free sparks left!",g,"wordpress-seo"),g):(0,z.__)("You're out of free sparks!","wordpress-seo"),size:u?"default":"large",children:u?(0,he.jsx)(sr,{onClose:h}):(0,he.jsx)(rr,{onClose:h,upsellLink:y,isWooUpsell:w})})},or=()=>{const{setPromptContent:e}=(0,t.dispatch)(Z);return()=>{(e=>{const s=(0,t.select)(X).getIsProduct(),r=(0,t.select)(X).getIsTerm(),i=(0,t.select)(X).getIsWooCommerceActive(),n=s&&i||r?150:300,a=(0,o.get)(window,"YoastSEO.analysis.worker.runResearch",o.noop),l=(0,o.get)(window,"YoastSEO.analysis.collectData",!1);a("getParagraphs",l?ue.Paper.parse(l()):null).then(t=>{let s="";if(t.result){const e=t.result;if(e){let t=0;e.forEach(e=>{e.sentences.forEach(e=>{if(t+=e.tokens.length,t>n)return s;s+=e.text.replace(/[\n\r]+/g," ")}),s+=" ",t+=1})}}e(s.trimEnd()||".")})})(e)}},nr=()=>{or(),(0,t.subscribe)((0,o.debounce)((()=>{const{getEditorDataContent:e}=(0,t.select)(X),s=or();return setTimeout(s,1500),((e,t)=>{let s=e();return()=>{const r=e();(0,o.isEqual)(r,s)||(s=r,t((0,o.clone)(r)))}})(e,s)})(),1500,{maxWait:3e3}))};let ar=!1;const lr=()=>{ar||(ar=!0)},cr=(e,t)=>ar?(Se(t)&&e.push((0,z.__)("Please enter a valid focus keyphrase.","wordpress-seo")),e):e,dr="appliedSuggestions",ur=(0,n.createSlice)({name:dr,initialState:{},reducers:{addAppliedSuggestion:(e,{payload:{editType:t,previewType:s,suggestion:r}})=>{e[s]={...e[s],[t]:r}}}}),pr=ur.getInitialState,mr={selectAppliedSuggestions:e=>(0,o.get)(e,dr,{})};mr.selectAppliedSuggestionFor=(0,n.createSelector)([mr.selectAppliedSuggestions,(e,t)=>t],(e,{editType:t,previewType:s})=>(0,o.get)(e,[s,t],""));const hr=ur.actions,gr=ur.reducer,yr="productSubscriptions",wr=(0,n.createSlice)({name:yr,initialState:{premiumSubscription:!1,wooCommerceSubscription:!1},reducers:{}}),xr=wr.getInitialState,fr={selectProductSubscriptions:e=>(0,o.get)(e,yr,xr()),selectPremiumSubscription:e=>(0,o.get)(e,`${yr}.premiumSubscription`),selectWooCommerceSubscription:e=>(0,o.get)(e,`${yr}.wooCommerceSubscription`)},vr=wr.actions,br=wr.reducer,Sr="promptContent",kr=(0,n.createSlice)({name:Sr,initialState:{content:"",initialized:!1},reducers:{setPromptContent:(e,{payload:t})=>({content:t,initialized:!0})}}),Cr=kr.getInitialState,jr={selectPromptContent:e=>(0,o.get)(e,`${Sr}.content`,""),selectPromptContentInitialized:e=>(0,o.get)(e,`${Sr}.initialized`,!1)},_r=kr.actions,Er=kr.reducer,Rr="endpoints",Ir=(0,n.createSlice)({name:Rr,initialState:{getSuggestions:"",bustSubscriptionCache:""},reducers:{}}),Lr=Ir.getInitialState,Tr={selectGetSuggestionsEndpoint:e=>(0,o.get)(e,[Rr,"getSuggestions"],Ir.getInitialState().getSuggestions),selectBustSubscriptionCacheEndpoint:e=>(0,o.get)(e,[Rr,"bustSubscriptionCache"],Ir.getInitialState().bustSubscriptionCache)},Pr={...Ir.actions},Mr=Ir.reducer,Ar="freeSparks",Nr="activateFreeSparks",$r=(0,n.createSlice)({name:Ar,initialState:{isFreeSparksActive:!1,endpoint:""},extraReducers:e=>{e.addCase(`${Nr}/${I}`,e=>{e.isFreeSparksActive=!0})}}),Fr=$r.getInitialState,qr={selectFreeSparksActiveEndpoint:e=>(0,o.get)(e,[Ar,"endpoint"],$r.getInitialState().endpoint),selectIsFreeSparksActive:e=>(0,o.get)(e,[Ar,"isFreeSparksActive"],$r.getInitialState().isFreeSparksActive)},Or={...$r.actions,activateFreeSparks:function*({endpoint:e}){try{yield{type:Nr,payload:e}}catch(e){console.error("Error starting free sparks:",e)}return{type:`${Nr}/${I}`}}},Ur={[Nr]:async({payload:e})=>u()({method:"POST",path:e})},Wr=$r.reducer,Br=window.wp.domReady,Gr=(s,{fieldId:r,type:o})=>{const n=(0,t.select)(X).getPostType(),a=function(e){return e.startsWith("yoast-google-preview")?J:e.startsWith("social")?Q:e.startsWith("x-")?ee:void 0}(r);if(!a)return s;const l={isRtl:(0,t.select)(X).getPreference("isRtl")},c={editType:o,previewType:a,postType:n,contentType:(0,t.select)(X).getIsTerm()?"term":"post"};return s.push((0,he.jsx)(e.Fill,{name:`yoast.replacementVariableEditor.additionalButtons.${r}`,children:(0,he.jsx)(i.Root,{context:l,children:(0,he.jsx)(Ee,{value:c,children:(0,he.jsx)(Ft,{onUseAi:lr})})})})),s};s.n(Br)()(()=>{var e;null!==(e=window.wpseoScriptData)&&void 0!==e&&e.postType&&(((e={})=>{(0,t.register)((e=>(0,t.createReduxStore)(Z,{actions:{...w,...hr,...vr,..._r,...Ge,...Or,...Pr},selectors:{...y,...mr,...fr,...jr,...Be,...qr,...Tr},initialState:(0,o.merge)({},{[p]:g(),[dr]:pr(),[yr]:xr(),[Sr]:Cr(),[Ne]:We(),[Ar]:Fr(),[Rr]:Lr()},e),reducer:(0,t.combineReducers)({[p]:f,[dr]:gr,[yr]:br,[Sr]:Er,[Ne]:He,[Ar]:Wr,[Rr]:Mr}),controls:{...x,...De,...Ur}}))(e))})({[p]:{hasConsent:"1"===(0,o.get)(window,"wpseoAiGenerator.hasConsent",!1),endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.consent","")},[Ne]:{endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.getUsage","")},[yr]:(0,o.get)(window,"wpseoAiGenerator.productSubscriptions",{}),[Ar]:{isFreeSparksActive:"1"===(0,o.get)(window,"wpseoAiGenerator.isFreeSparks",!1),endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.freeSparks","")},[Rr]:{getSuggestions:(0,o.get)(window,"wpseoAiGenerator.endpoints.getSuggestions",""),bustSubscriptionCache:(0,o.get)(window,"wpseoAiGenerator.endpoints.bustSubscriptionCache","")}}),window.jQuery(window).on("YoastSEO:ready",()=>{nr()}),(0,r.addFilter)("yoast.replacementVariableEditor.additionalButtons","yoast/yoast-seo/AiGenerator",Gr),(0,r.addFilter)("yoast.focusKeyphrase.errors","yoast/yoast-seo/AiGenerator",cr),(0,r.addAction)("yoast.elementor.loaded","yoast/yoast-seo/AiGenerator",nr))})})()})();
278 +`;class $r extends Le.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:t,imageFallbackUrl:s,alt:r,title:i,description:o,siteUrl:n}=this.props,a=e?Nr:Or;return(0,Se.jsxs)(a,{id:"twitterPreview",children:[(0,Se.jsx)(Rr,{src:t||s,alt:r,isLarge:e,onImageClick:this.props.onImageClick,onMouseEnter:this.onImageEnter,onMouseLeave:this.onLeave}),(0,Se.jsxs)(Tr,{children:[(0,Se.jsx)(jr,{siteUrl:n}),(0,Se.jsx)(Ar,{onMouseEnter:this.onTitleEnter,onMouseLeave:this.onLeave,onClick:this.onSelectTitle,children:i}),(0,Se.jsx)(Mr,{onMouseEnter:this.onDescriptionEnter,onMouseLeave:this.onLeave,onClick:this.onSelectDescription,children:o})]})]})}}$r.propTypes={siteUrl:te().string.isRequired,title:te().string.isRequired,description:te().string,isLarge:te().bool,imageUrl:te().string,imageFallbackUrl:te().string,alt:te().string,onSelect:te().func,onImageClick:te().func,onMouseHover:te().func},$r.defaultProps={description:"",alt:"",imageUrl:"",imageFallbackUrl:"",onSelect:()=>{},onImageClick:()=>{},onMouseHover:()=>{},isLarge:!0};const Fr=$r,Ur=window.yoast.componentsNew,qr=window.yoast.replacementVariableEditor;class Wr extends Le.Component{constructor(e){super(e),this.state={activeField:"",hoveredField:""},this.SocialPreview="Social"===e.socialMediumName?vr:Fr,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,t){switch(e){case"title":this.titleEditorRef=t;break;case"description":this.descriptionEditorRef=t}}render(){const{onDescriptionChange:e,onTitleChange:t,onSelectImageClick:s,onRemoveImageClick:r,socialMediumName:i,imageWarnings:o,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:w,onReplacementVariableSearchChange:f,isPremium:v,isLarge:b,socialPreviewLabel:S,idSuffix:j,activeMetaTabId:C}=this.props,k=w({title:m||g,description:a||c});return(0,Se.jsxs)(Te().Fragment,{children:[S&&(0,Se.jsx)(Ur.SimulatedLabel,{children:S}),(0,Se.jsx)(this.SocialPreview,{onMouseHover:this.setHoveredField,onSelect:this.setActiveField,onImageClick:s,siteUrl:n,title:k.title,description:k.description,imageUrl:d,imageFallbackUrl:u,alt:p,isLarge:b,activeMetaTabId:C}),(0,Se.jsx)(er.SocialMetadataPreviewForm,{onDescriptionChange:e,socialMediumName:i,title:m,titleInputPlaceholder:h,onRemoveImageClick:r,imageSelected:!!d,imageUrl:d,imageFallbackUrl:u,onTitleChange:t,onSelectImageClick:s,description:a,descriptionInputPlaceholder:l,imageWarnings:o,replacementVariables:y,recommendedReplacementVariables:x,onReplacementVariableSearchChange:f,onMouseHover:this.setHoveredField,hoveredField:this.state.hoveredField,onSelect:this.setActiveField,activeField:this.state.activeField,isPremium:v,setEditorRef:this.setEditorRef,idSuffix:j})]})}}Wr.propTypes={title:te().string.isRequired,onTitleChange:te().func.isRequired,description:te().string.isRequired,onDescriptionChange:te().func.isRequired,imageUrl:te().string.isRequired,imageFallbackUrl:te().string.isRequired,onSelectImageClick:te().func.isRequired,onRemoveImageClick:te().func.isRequired,socialMediumName:te().string.isRequired,alt:te().string,isPremium:te().bool,imageWarnings:te().array,isLarge:te().bool,siteUrl:te().string,descriptionInputPlaceholder:te().string,titleInputPlaceholder:te().string,descriptionPreviewFallback:te().string,titlePreviewFallback:te().string,replacementVariables:qr.replacementVariablesShape,recommendedReplacementVariables:qr.recommendedReplacementVariablesShape,applyReplacementVariables:te().func,onReplacementVariableSearchChange:te().func,socialPreviewLabel:te().string,idSuffix:te().string,activeMetaTabId:te().string},Wr.defaultProps={imageWarnings:[],recommendedReplacementVariables:[],replacementVariables:[],isPremium:!1,isLarge:!0,siteUrl:"",descriptionInputPlaceholder:"",titleInputPlaceholder:"",descriptionPreviewFallback:"",titlePreviewFallback:"",alt:"",applyReplacementVariables:e=>e,onReplacementVariableSearchChange:null,socialPreviewLabel:"",idSuffix:"",activeMetaTabId:""};const Br={},Gr=(e,t,{log:s=console.warn}={})=>{Br[e]||(Br[e]=!0,s(t))},Dr=(e,t=o.noop)=>{const s={};for(const r in e)Object.hasOwn(e,r)&&Object.defineProperty(s,r,{set:s=>{e[r]=s,t("set",r,s)},get:()=>(t("get",r),e[r])});return s};Dr({squareWidth:125,squareHeight:125,landscapeWidth:506,landscapeHeight:265,aspectRatio:50.2},(e,t)=>Gr(`@yoast/social-metadata-previews/TWITTER_IMAGE_SIZES/${e}/${t}`,`[@yoast/social-metadata-previews] "TWITTER_IMAGE_SIZES.${t}" is deprecated and will be removed in the future, please use this from @yoast/social-metadata-forms instead.`)),Dr({squareWidth:158,squareHeight:158,landscapeWidth:527,landscapeHeight:273,portraitWidth:158,portraitHeight:237,aspectRatio:52.2,largeThreshold:{width:446,height:233}},(e,t)=>Gr(`@yoast/social-metadata-previews/FACEBOOK_IMAGE_SIZES/${e}/${t}`,`[@yoast/social-metadata-previews] "FACEBOOK_IMAGE_SIZES.${t}" is deprecated and will be removed in the future, please use this from @yoast/social-metadata-forms instead.`));const Hr=({title:e,description:s})=>{const r=(0,t.useSelect)(e=>e(re).getSiteUrl(),[]),i=(0,t.useSelect)(e=>e(re).getFacebookImageUrl(),[]),n=(0,t.useSelect)(e=>e(re).getEditorDataImageFallback(),[]),a=(0,t.useSelect)(e=>e(re).getFacebookAltText(),[]);return(0,Se.jsx)("div",{className:"yst-ai-generator-preview-section",children:(0,Se.jsx)(vr,{title:e,description:s,siteUrl:r,imageUrl:i,imageFallbackUrl:n,alt:a,onSelect:o.noop,onImageClick:o.noop,onMouseHover:o.noop})})};Hr.propTypes={title:te().string.isRequired,description:te().string.isRequired};const zr=()=>(0,Se.jsxs)("div",{className:"yst-flex yst-flex-col yst-w-[527px] yst-border yst-mx-auto",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-[273px] yst-w-full yst-rounded-none yst-border yst-border-dashed"}),(0,Se.jsxs)("div",{className:"yst-w-full yst-p-4 yst-space-y-1",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-5 yst-w-10/12"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"})]})]}),Yr=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:qt}),(0,Se.jsx)(Wt,{})]}),Vr=({children:e,onRetry:t})=>{const{onClose:s}=(0,i.useModalContext)();return(0,Se.jsxs)(we.Fragment,{children:[e,(0,Se.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,Se.jsx)(i.Button,{variant:"secondary",onClick:s,children:(0,xe.__)("Close","wordpress-seo")}),(0,Se.jsx)(i.Button,{variant:"primary",onClick:t,children:(0,xe.__)("Try again","wordpress-seo")})]})]})};Vr.propTypes={children:te().node.isRequired,onRetry:te().func.isRequired};const Kr=({errorCode:e,errorIdentifier:t,invalidSubscriptions:s=[],showActions:r=!1,onRetry:i=o.noop,errorMessage:n=""})=>{switch(e){case 400:switch(t){case"AI_CONTENT_FILTER":return(0,Se.jsx)(ft,{});case"NOT_ENOUGH_CONTENT":return(0,Se.jsx)(ot,{});case"SITE_UNREACHABLE":return(0,Se.jsx)(Yr,{});case"WP_HTTP_REQUEST_ERROR":return r?(0,Se.jsx)(Vr,{onRetry:i,children:(0,Se.jsx)(St,{errorMessage:n})}):(0,Se.jsx)(St,{errorMessage:n});default:return r?(0,Se.jsx)(Vr,{onRetry:i,children:(0,Se.jsx)(st,{})}):(0,Se.jsx)(st,{})}case 402:return(0,Se.jsx)(mt,{invalidSubscriptions:s});case 408:return r?(0,Se.jsx)(Vr,{onRetry:i,children:(0,Se.jsx)(yt,{})}):(0,Se.jsx)(yt,{});case 429:return"USAGE_LIMIT_REACHED"===t?(0,Se.jsx)(mt,{invalidSubscriptions:s}):(0,Se.jsx)(dt,{});case 410:return(0,Se.jsx)(kt,{});default:return r?(0,Se.jsx)(Vr,{onRetry:i,children:(0,Se.jsx)(st,{})}):(0,Se.jsx)(st,{})}};Kr.propTypes={errorCode:te().number.isRequired,errorIdentifier:te().string.isRequired,invalidSubscriptions:te().array,showActions:te().bool,onRetry:te().func,errorMessage:te().string};const Zr=te().shape({value:te().string.isRequired,label:te().node.isRequired}),Xr=({id:e,name:t,suggestion:s,isChecked:r,onChange:i})=>{const o=(0,we.useCallback)(()=>i(s.value),[s,i]);return(0,Se.jsxs)("label",{htmlFor:e,className:De()("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,Se.jsx)("input",{type:"radio",id:e,name:t,className:"yst-radio__input",value:s.value,checked:r,onChange:o}),(0,Se.jsx)("div",{className:De()("yst-label yst-radio__label yst-flex yst-flex-wrap yst-items-center",!r&&"yst-text-slate-600"),children:s.label})]})};Xr.propTypes={id:te().string.isRequired,name:te().string.isRequired,suggestion:Zr.isRequired,isChecked:te().bool.isRequired,onChange:te().func.isRequired};const Jr=({idSuffix:e,suggestions:t,selected:s,onChange:r})=>(0,Se.jsx)("div",{children:(0,Se.jsx)(i.RadioGroup,{className:"yst-suggestions-radio-group yst-flex yst-flex-col",id:`yst-ai-suggestions-radio-group__${e}`,children:t.map((t,i)=>(0,Se.jsx)(Xr,{id:`yst-ai-suggestions-radio-${e}__${i}`,name:`ai-suggestion__${e}`,isChecked:t.value===s,onChange:r,suggestion:t},`yst-ai-suggestions-radio-${e}__${i}`))})});Jr.propTypes={idSuffix:te().string.isRequired,suggestions:te().arrayOf(Zr).isRequired,selected:te().string.isRequired,onChange:te().func.isRequired};const Qr=[["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"]],ei=({suggestionClassNames:e=Qr})=>(0,Se.jsx)("div",{className:"yst-flex yst-flex-col yst--space-y-[1px]",children:e.map((e,t)=>(0,Se.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,Se.jsx)("input",{type:"radio",disabled:!0,className:"yst-my-0.5"}),(0,Se.jsx)("div",{className:"yst-flex yst-flex-col yst-w-full",children:e.map((e,s)=>(0,Se.jsx)(i.SkeletonLoader,{className:e},`yst-ai-suggestion-radio-skeleton-${t}__${s}`))})]},`yst-ai-suggestion-radio-skeleton__${t}`))});ei.propTypes={suggestionClassNames:te().arrayOf(te().arrayOf(te().string))};const ti="ai_generator_tip_notification",si=()=>{const e=(0,t.useSelect)(e=>e(re).isAlertDismissed(ti),[]),s=(0,t.useSelect)(e=>e(re).getEditorDataContent(),[]),r=(0,t.useSelect)(e=>e(re).getIsWooProductEntity(),[]),[o,,,n]=(0,i.useToggleState)(!1),{editType:a,contentType:l}=ms(),{dismissAlert:c}=(0,t.useDispatch)(re),d=(0,we.useCallback)(()=>{c(ti)},[c]),u=(0,we.useMemo)(()=>a===le?(0,xe.__)("%1$sTip%2$s: Improve the accuracy of your generated AI descriptions by writing more content in your page.","wordpress-seo"):(0,xe.__)("%1$sTip%2$s: Improve the accuracy of your generated AI titles by writing more content in your page.","wordpress-seo")
279 +/* translators: %1$s and %2$s expand to opening and closing of a span in order to emphasise the word. */,[a]),p=(0,we.useMemo)(()=>((e,t)=>e||t===de?150:300)(r,l),[l,r]),m=(0,we.useMemo)(()=>(e=>Zt.languageProcessing.sanitizeString(e||"").length)(s),[s]);return e||o||m>p?null:(0,Se.jsxs)(i.Notifications.Notification,{id:"ai-generator-content-tip",variant:"info",dismissScreenReaderLabel:(0,xe.__)("Dismiss","wordpress-seo"),children:[fe((0,xe.sprintf)(u,"<span>","</span>"),{span:(0,Se.jsx)("span",{className:"yst-font-medium yst-text-slate-800"})}),(0,Se.jsxs)("div",{className:"yst-flex yst-mt-3 yst--ms-3 yst-gap-1",children:[(0,Se.jsx)(i.Button,{type:"button",variant:"tertiary",onClick:d,children:(0,xe.__)("Don’t show again","wordpress-seo")}),(0,Se.jsx)(i.Button,{type:"button",variant:"tertiary",className:"yst-text-slate-800",onClick:n,children:(0,xe.__)("Dismiss","wordpress-seo")})]})]})},ri=({title:e,description:t,showPreviewSkeleton:s})=>(0,Se.jsxs)("div",{children:[(0,Se.jsx)("div",{className:"yst-flex yst-mb-6",children:(0,Se.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:(0,xe.__)("X preview","wordpress-seo")})}),s?(0,Se.jsx)(oi,{}):(0,Se.jsx)(ii,{title:e,description:t})]});ri.propTypes={title:te().string.isRequired,description:te().string.isRequired,showPreviewSkeleton:te().bool.isRequired};const ii=({title:e,description:s})=>{const r=(0,t.useSelect)(e=>e(re).getSiteUrl(),[]),i=(0,t.useSelect)(e=>e(re).getTwitterImageUrl(),[]),n=(0,t.useSelect)(e=>e(re).getFacebookImageUrl(),[]),a=(0,t.useSelect)(e=>e(re).getEditorDataImageFallback(),[]),l=(0,t.useSelect)(e=>e(re).getTwitterImageType(),[]),c=(0,t.useSelect)(e=>e(re).getTwitterAltText(),[]);return(0,Se.jsx)("div",{className:"yst-ai-generator-preview-section",children:(0,Se.jsx)(Fr,{title:e,description:s,siteUrl:r,imageUrl:i,imageFallbackUrl:n||a,isLarge:"summary"!==l,alt:c,onSelect:o.noop,onImageClick:o.noop,onMouseHover:o.noop})})};ii.propTypes={title:te().string.isRequired,description:te().string.isRequired};const oi=()=>(0,Se.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,Se.jsx)(i.SkeletonLoader,{className:"yst-h-[265px] yst-w-full yst-rounded-none yst-border yst-border-dashed"}),(0,Se.jsxs)("div",{className:"yst-w-full yst-p-4 yst-space-y-1",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-5 yst-w-10/12"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"})]})]}),ni="yst-mt-1 yst-mb-3",ai="yst-flex yst-justify-end yst--me-8 yst-gap-3 yst--ms-2",li=({onClose:e})=>(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("p",{className:ni,children:(0,xe.__)("As long as this is a beta feature, you get unlimited sparks.","wordpress-seo")}),(0,Se.jsx)("div",{className:ai,children:(0,Se.jsx)(i.Button,{type:"button",variant:"primary",size:"small",onClick:e,children:(0,xe.__)("Got it!","wordpress-seo")})})]}),ci=({onClose:e,upsellLink:t,isWooProductEntity:s=!1,ctbId:r="f6a84663-465f-4cb5-8ba5-f7a6d72224b2"})=>{const o=(0,i.useSvgAria)();return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("p",{className:ni,children:(0,xe.sprintf)(/* translators: %s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */ /* translators: %s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */
280 +(0,xe.__)("Keep the momentum going, unlock unlimited sparks with %s!","wordpress-seo"),s?"Yoast WooCommerce SEO":"Yoast SEO Premium")}),(0,Se.jsxs)("div",{className:ai,children:[(0,Se.jsx)(i.Button,{type:"button",variant:"tertiary",size:"small",onClick:e,children:(0,xe.__)("Close","wordpress-seo")}),(0,Se.jsxs)(i.Button,{as:"a",size:"small",variant:"upsell",href:t,target:"_blank",rel:"noopener noreferrer","data-action":"load-nfd-ctb","data-ctb-id":r,children:[(0,Se.jsx)(Ce(),{className:"yst-w-4 yst-h-4 yst--ms-1 yst-me-2 yst-shrink-0",...o}),(0,xe.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. */
281 +(0,xe.__)("Unlock with %1$s","wordpress-seo"),s?"Yoast WooCommerce SEO":"Yoast SEO Premium"),(0,Se.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
282 +(0,xe.__)("(Opens in a new browser tab)","wordpress-seo")})]})]})]})},di=({className:e=""})=>{const{isUsageCountLimitReached:s,usageCount:r,usageCountLimit:o,premiumUpsellLink:n,wooUpsellLink:a,isWooProductEntity:l,hasValidPremiumSubscription:c,hasValidWooSubscription:d}=(0,t.useSelect)(e=>{const t=e(se),s=e(re);return{isUsageCountLimitReached:t.isUsageCountLimitReached(),usageCount:t.selectUsageCount(),usageCountLimit:t.selectUsageCountLimit(),premiumUpsellLink:s.selectLink("https://yoa.st/ai-toast-out-of-free-sparks"),wooUpsellLink:s.selectLink("https://yoa.st/ai-toast-out-of-free-sparks-woo"),isWooProductEntity:s.getIsWooProductEntity(),hasValidPremiumSubscription:t.selectPremiumSubscription(),hasValidWooSubscription:t.selectWooCommerceSubscription()}},[]),u=(0,we.useMemo)(()=>c&&!l||l&&d&&c,[c,l,d]),[p,,m,,h]=(0,i.useToggleState)(r===o),g=Math.max(0,o-r);(0,we.useEffect)(()=>{m(u&&r===o||!u&&g<=5)},[r,o,u,s]);const y=(0,we.useMemo)(()=>l?a:n,[l,a,n]),x=(0,we.useMemo)(()=>l&&!d,[l,d]);return p&&(0,Se.jsx)(i.Notifications.Notification,{id:"ai-sparks-limit",className:e,variant:"info",dismissScreenReaderLabel:(0,xe.__)("Close","wordpress-seo"),title:u?(0,xe.sprintf)(/* translators: %s is the number of the sparks. */ /* translators: %s is the number of the sparks. */
283 +(0,xe._n)("You've used %s spark this month.","You've used %s sparks this month.",r,"wordpress-seo"),r):g<=5&&!s?(0,xe.sprintf)(/* translators: %s is the number of the sparks. */ /* translators: %s is the number of the sparks. */
284 +(0,xe._n)("%s free spark left!","%s free sparks left!",g,"wordpress-seo"),g):(0,xe.__)("You're out of free sparks!","wordpress-seo"),size:u?"default":"large",children:u?(0,Se.jsx)(li,{onClose:h}):(0,Se.jsx)(ci,{onClose:h,upsellLink:y,isWooUpsell:x})})};te().number.isRequired,te().string,te().string,te().object.isRequired,te().bool;const ui=()=>{const{setPromptContent:e}=(0,t.dispatch)(se);return()=>{(e=>{const s=(0,t.select)(re).getIsProduct(),r=(0,t.select)(re).getIsTerm(),i=(0,t.select)(re).getIsWooCommerceActive(),n=s&&i||r?150:300,a=(0,o.get)(window,"YoastSEO.analysis.worker.runResearch",o.noop),l=(0,o.get)(window,"YoastSEO.analysis.collectData",!1);a("getParagraphs",l?Zt.Paper.parse(l()):null).then(t=>{e(((e,t)=>{let s="",r=0;for(const o of Array.isArray(e)?e:[]){var i;const e=as(null!==(i=o.sentences)&&void 0!==i?i:[],r,t);if(s+=e.text,r=e.tokenCount,e.exceeded)break;s+=" ",r+=1}return s.trimEnd()||"."})((0,o.get)(t,"result",[]),n))})})(e)}},pi=()=>{ui(),(0,t.subscribe)((0,o.debounce)((()=>{const{getEditorDataContent:e}=(0,t.select)(re),s=ui();return setTimeout(s,1500),((e,t)=>{let s=e();return()=>{const r=e();(0,o.isEqual)(r,s)||(s=r,t((0,o.clone)(r)))}})(e,s)})(),1500,{maxWait:3e3}))};let mi=!1;const hi=()=>{mi||(mi=!0)},gi=(e,t)=>mi?(os(t)&&e.push((0,xe.__)("Please enter a valid focus keyphrase.","wordpress-seo")),e):e,yi="appliedSuggestions",xi=(0,n.createSlice)({name:yi,initialState:{},reducers:{addAppliedSuggestion:(e,{payload:{editType:t,previewType:s,suggestion:r}})=>{e[s]={...e[s],[t]:r}}}}),wi=xi.getInitialState,fi={selectAppliedSuggestions:e=>(0,o.get)(e,yi,{})};fi.selectAppliedSuggestionFor=(0,n.createSelector)([fi.selectAppliedSuggestions,(e,t)=>t],(e,{editType:t,previewType:s})=>(0,o.get)(e,[s,t],""));const vi=xi.actions,bi=xi.reducer,Si="productSubscriptions",ji=(0,n.createSlice)({name:Si,initialState:{premiumSubscription:!1,wooCommerceSubscription:!1},reducers:{}}),Ci=ji.getInitialState,ki={selectProductSubscriptions:e=>(0,o.get)(e,Si,Ci()),selectPremiumSubscription:e=>(0,o.get)(e,`${Si}.premiumSubscription`),selectWooCommerceSubscription:e=>(0,o.get)(e,`${Si}.wooCommerceSubscription`)},_i=ji.actions,Ei=ji.reducer,Ri="promptContent",Ii=(0,n.createSlice)({name:Ri,initialState:{content:"",initialized:!1},reducers:{setPromptContent:(e,{payload:t})=>({content:t,initialized:!0})}}),Li=Ii.getInitialState,Ti={selectPromptContent:e=>(0,o.get)(e,`${Ri}.content`,""),selectPromptContentInitialized:e=>(0,o.get)(e,`${Ri}.initialized`,!1)},Ai=Ii.actions,Mi=Ii.reducer,Pi="endpoints",Ni=(0,n.createSlice)({name:Pi,initialState:{getSuggestions:"",bustSubscriptionCache:""},reducers:{}}),Oi=Ni.getInitialState,$i={selectGetSuggestionsEndpoint:e=>(0,o.get)(e,[Pi,"getSuggestions"],Ni.getInitialState().getSuggestions),selectBustSubscriptionCacheEndpoint:e=>(0,o.get)(e,[Pi,"bustSubscriptionCache"],Ni.getInitialState().bustSubscriptionCache)},Fi={...Ni.actions},Ui=Ni.reducer,qi="freeSparks",Wi="activateFreeSparks",Bi=(0,n.createSlice)({name:qi,initialState:{isFreeSparksActive:!1,endpoint:""},extraReducers:e=>{e.addCase(`${Wi}/${$}`,e=>{e.isFreeSparksActive=!0})}}),Gi=Bi.getInitialState,Di={selectFreeSparksActiveEndpoint:e=>(0,o.get)(e,[qi,"endpoint"],Bi.getInitialState().endpoint),selectIsFreeSparksActive:e=>(0,o.get)(e,[qi,"isFreeSparksActive"],Bi.getInitialState().isFreeSparksActive)},Hi={...Bi.actions,activateFreeSparks:function*({endpoint:e}){try{yield{type:Wi,payload:e}}catch(e){console.error("Error starting free sparks:",e)}return{type:`${Wi}/${$}`}}},zi={[Wi]:async({payload:e})=>g()({method:"POST",path:e})},Yi=Bi.reducer,Vi=window.wp.domReady,Ki=(s,{fieldId:r,type:o})=>{const n=(0,t.select)(re).getPostType(),a=function(e){return e.startsWith("yoast-google-preview")?ie:e.startsWith("social")?oe:e.startsWith("x-")?ne:void 0}(r);if(!a)return s;const l={isRtl:(0,t.select)(re).getPreference("isRtl")},c={editType:o,previewType:a,postType:n,contentType:(0,t.select)(re).getIsTerm()?"term":"post"};return s.push((0,Se.jsx)(e.Fill,{name:`yoast.replacementVariableEditor.additionalButtons.${r}`,children:(0,Se.jsx)(i.Root,{context:l,children:(0,Se.jsx)(ps,{value:c,children:(0,Se.jsx)(Bs,{onUseAi:hi})})})})),s};s.n(Vi)()(()=>{var e;null!==(e=window.wpseoScriptData)&&void 0!==e&&e.postType&&(()=>{const e=(0,o.get)(window,"wpseoAiGenerator.myyoastConnection",null);((e={})=>{(0,t.register)((e=>(0,t.createReduxStore)(se,{actions:{...b,...vi,..._i,...Ai,...Rs,...Hi,...Fi,...M},selectors:{...v,...fi,...ki,...Ti,...Es,...Di,...$i,...A},initialState:(0,o.merge)({},{[y]:f(),[yi]:wi(),[Si]:Ci(),[Ri]:Li(),[vs]:_s(),[qi]:Gi(),[Pi]:Oi(),[R]:L()},e),reducer:(0,t.combineReducers)({[y]:j,[yi]:bi,[Si]:Ei,[Ri]:Mi,[vs]:Ls,[qi]:Yi,[Pi]:Ui,[R]:P}),controls:{...S,...Is,...zi}}))(e))})({[y]:{hasConsent:"1"===(0,o.get)(window,"wpseoAiGenerator.hasConsent",!1),endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.consent","")},[vs]:{endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.getUsage","")},[Si]:(0,o.get)(window,"wpseoAiGenerator.productSubscriptions",{}),[qi]:{isFreeSparksActive:"1"===(0,o.get)(window,"wpseoAiGenerator.isFreeSparks",!1),endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.freeSparks","")},[Pi]:{getSuggestions:(0,o.get)(window,"wpseoAiGenerator.endpoints.getSuggestions",""),bustSubscriptionCache:(0,o.get)(window,"wpseoAiGenerator.endpoints.bustSubscriptionCache","")},[R]:T(e)}),window.jQuery(window).on("YoastSEO:ready",()=>{pi()}),(0,r.addFilter)("yoast.replacementVariableEditor.additionalButtons","yoast/yoast-seo/AiGenerator",Ki),(0,r.addFilter)("yoast.focusKeyphrase.errors","yoast/yoast-seo/AiGenerator",gi),(0,r.addAction)("yoast.elementor.loaded","yoast/yoast-seo/AiGenerator",pi)})()})})()})();