|
Server : LiteSpeed System : Linux premium92.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : rbnsfqys ( 805) PHP Version : 8.1.33 Disable Function : NONE Directory : /home/rbnsfqys/public_html/wp-content/plugins/surerank/build/seo-popup/ |
"use strict";(globalThis.webpackChunksurerank=globalThis.webpackChunksurerank||[]).push([[5307],{300:(e,t,a)=>{var r=a(51609),n=a(75795);const s=window.wp.compose;var l=a(86087),o=a(47143),i=a(1671),c=a(9607),u=a(66221),d=a(46615),m=a(60443),p=a(30758);const g=e=>t=>{const a=(0,o.useSelect)(e=>{const t=e("core/editor");return{postTitle:t.getEditedPostAttribute("title"),postExcerpt:t.getEditedPostAttribute("excerpt"),postContent:t.getEditedPostContent()}},[]);return(0,l.useEffect)(()=>{(0,o.dispatch)(i.E).updatePostDynamicData({title:a.postTitle,excerpt:a.postExcerpt,content:(0,c.XY)(a.postContent)})},[a.postTitle,a.postExcerpt,a.postContent]),(0,r.createElement)(e,{...t})},h=e=>t=>{const a=(e,t)=>{const a=(0,o.dispatch)(i.E);"content"===e&&(t=(0,c.XY)(t)),a.updatePostDynamicData({[e]:t})};return(0,l.useEffect)(()=>{const e=document.querySelector("textarea[name='content']#content");e&&e.addEventListener("input",e=>{a("content",e.target.value)});const t=document.querySelector("iframe#content_ifr");t&&t.contentDocument.body.addEventListener("input",e=>{a("content",e.target.innerHTML)});const r=document.querySelector("textarea[name='excerpt']#excerpt");r&&r.addEventListener("input",e=>{a("excerpt",e.target.value)});const n=document.querySelector("input[name='post_title']#title");return n&&n.addEventListener("input",e=>{a("title",e.target.value)}),()=>{e&&e.removeEventListener("input",e=>{a("content",e.target.value)}),t&&t.contentDocument.body.removeEventListener("input",e=>{a("content",e.target.innerHTML)}),r&&r.removeEventListener("input",e=>{a("excerpt",e.target.value)}),n&&n.removeEventListener("input",e=>{a("title",e.target.value)})}},[]),(0,r.createElement)(e,{...t})};var f=a(71149),k=a(88029),_=a(48697),y=a(76016);const E=(0,l.memo)(({status:e,errorAndWarnings:t=0,initializing:a=!1,className:n=""})=>{const s=(0,l.useMemo)(()=>(0,c.ns)(e),[e]),o=(0,l.useMemo)(()=>(0,c.x7)(t),[t]);return!a&&e&&y.Jj?(0,r.createElement)("div",{className:(0,c.cn)("absolute top-0.5 right-1 size-2 rounded-full z-10 duration-200",s,n),"aria-label":o,title:o}):null});var w=a(54486);const b=()=>{const{categorizedChecks:e={},initializing:t=!0}=(0,o.useSelect)(e=>{const t=e(i.E).getPageSeoChecks();return{categorizedChecks:t.categorizedChecks,initializing:t.initializing}},[]),{status:a,counts:r}=(0,l.useMemo)(()=>{var t;return null!==(t=(0,w.F)(e))&&void 0!==t?t:{status:null,initializing:!0,counts:{errorAndWarnings:0}}},[e]);return{status:a,initializing:t,counts:r}},v=()=>{const[e,t]=(0,l.useState)(null),{status:a,initializing:n,counts:s}=b();return(0,l.useEffect)(()=>{const e=()=>document.querySelector(".surerank-page-checks-indicator");let a=e();a&&t(a);const r=new MutationObserver(()=>{const r=e();r!==a&&(a=r,t(r))}),n=document.getElementById("surerank-metabox-header");if(n)return r.observe(n,{childList:!0,subtree:!0}),()=>{r.disconnect()}},[]),e&&(0,l.createPortal)((0,r.createElement)(E,{status:a,errorAndWarnings:s.errorAndWarnings,initializing:n,className:"static ml-1 size-1.5"}),e)},x=(0,l.memo)(({onClose:e})=>(0,r.createElement)("div",{id:"surerank-metabox-header",className:"flex items-center justify-between gap-3 border-0 border-b-0.5 border-solid border-border-subtle"},(0,r.createElement)("div",{className:"flex items-center py-3.5 px-4"},(0,r.createElement)(f.V_,{width:32,height:20})),(0,r.createElement)("div",{className:"h-full flex items-center mr-auto gap-2"}),(0,r.createElement)("div",{className:"flex items-center py-3.5 px-4 gap-2"},(0,r.createElement)(k.A,{variant:"ghost",size:"sm",onClick:e,className:"p-1 text-icon-secondary hover:text-icon-primary hover:bg-transparent bg-transparent focus:outline-none",icon:(0,r.createElement)(_.A,null)})),(0,r.createElement)(v,null)));var C=a(27723),S=a(1455),N=a.n(S),A=a(87096),T=a(62220),P=a(64894);const L=()=>{const e=(0,o.useSelect)(e=>e(i.E).getUnsavedMetaSettings(),[]),{resetUnsavedMetaSettings:t,initMetaDataAndDefaults:a}=(0,o.useDispatch)(i.E),n=(0,l.useCallback)(e=>{e.preventDefault(),e.returnValue=null},[e]);(0,l.useEffect)(()=>{if(e&&Object.keys(null!==e&&void 0!==e?e:{}).length)return window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}},[n]);const s=Object.keys(null!==e&&void 0!==e?e:{}).length>0;return(0,r.createElement)(A.A,{onClick:async()=>{const r={metaData:e,...(0,c.P$)("term.php")?{term_id:surerank_seo_popup?.term_id}:{post_id:surerank_seo_popup?.post_id}};try{const e=await N()({path:(0,c.P$)("term.php")?T.EJ:T.MF,method:"POST",data:r});if(!e.success)throw e;return(async()=>{try{const e=await(0,P.lr)();a({postSeoMeta:e.data,globalDefaults:e.global_default})}catch(e){}})(),setTimeout(()=>{t()},1e3),e}catch(n){throw n}},className:s?"":"opacity-60 bg-background-brand cursor-not-allowed pointer-events-none",icon:s?(0,r.createElement)(f.Zy,null):null,disabled:!s})},z=({onClose:e})=>(0,r.createElement)("div",{className:"flex items-center justify-start gap-3 px-5 py-2.5"},(0,r.createElement)(L,null),(0,r.createElement)(k.A,{onClick:e,variant:"outline"},(0,C.__)("Close","surerank")));var D=a(66087),I=a(18947);const M=e=>(0,I.bY)(e?e.length>60?{id:"search_engine_title",title:(0,C.sprintf)((0,C.__)("Search engine title exceeds %1$d characters.","surerank"),y.qt),status:"warning",type:"page"}:{id:"search_engine_title",title:(0,C.sprintf)((0,C.__)("Search engine title is present and under %1$d characters.","surerank"),y.qt),status:"success",type:"page"}:{id:"search_engine_title",title:(0,C.__)("Search engine title is missing on the page.","surerank"),status:"error",type:"page"}),O=e=>(0,I.bY)(e?e.length>160?{id:"search_engine_description",title:(0,C.sprintf)((0,C.__)("Search engine description exceeds %1$d characters.","surerank"),y.UM),status:"warning",type:"page"}:{id:"search_engine_description",title:(0,C.sprintf)((0,C.__)("Search engine description is present and under %1$d characters.","surerank"),y.UM),status:"success",type:"page"}:{id:"search_engine_description",title:(0,C.__)("Search engine description is missing on the page.","surerank"),status:"warning",type:"page"}),F=()=>{var e;const t=null!==(e=window?.surerank_globals?.open_graph_tags)&&void 0!==e&&e;return(0,I.bY)(t?{id:"open_graph_tags",title:(0,C.__)("Open Graph tags are not present on the page.","surerank"),status:"suggestion",type:"page"}:{id:"open_graph_tags",title:(0,C.__)("Open Graph tags are present on the page.","surerank"),status:"success",type:"page"})};var R=a(84038),j=a(64506);const $=(e,t="")=>{if(!e)return;let a={};return"richSelect"===t&&(a=[]),Object.values(e).forEach(e=>{Object.keys(e).forEach(r=>{switch(t){case"richSelect":a.push({value:r,label:e[r].label,title:"%"+r+"%",description:e[r].description});break;case"detailed":a[r]=e[r];break;default:a[r]=e[r].value}})}),a};var H=a(74801),U=a(52619),B=a(76316),V=a(70010),q=a(12395),G=a(71087),W=a(97213),K=a(94879),Y=a(61456),Z=a(30732),J=a(65650);const X=({fieldKey:e,onUseThis:t,tooltip:a})=>{const{currentScreen:n,currentTab:s,currentMetaTab:l,currentAccordion:u,generatedContents:d}=(0,o.useSelect)(e=>{const t=e(i.E);return{...t.getPageSeoChecks(),...t.getAppSettings()}},[]),{updateAppSettings:m}=(0,o.useDispatch)(i.E),p=d&&d[e]&&d[e].length>0,g=(0,r.createElement)(k.A,{size:"xs",variant:"ghost",className:(0,c.cn)("p-0.5 text-icon-interactive outline-brand-200 rounded-sm",p&&"[&>svg]:size-3 p-1"),icon:(0,r.createElement)(p?f.jf:f.Wn,null),onClick:()=>{const a={...d};a[e]&&delete a[e],m({currentScreen:"fixItForMe",previousScreen:n,previousTab:s,previousMetaTab:l,previousAccordion:u,selectedFieldKey:e,onUseThis:t,generateContentProcess:"idle",generatedContents:a,error:null})}});return a?(0,r.createElement)(K.$w,{content:a,placement:"top-end"},g):g},Q=({label:e,inputContent:t,maxLength:a,editorRef:n,defaultValue:s,variableSuggestions:l,onChange:o,placeholder:i="",className:u="",editorKey:d,fieldKey:m,onUseThis:p})=>{var g;return(0,r.createElement)("div",{className:"space-y-1.5 p-2"},(0,r.createElement)("div",{className:"flex items-center justify-start gap-1"},(0,r.createElement)(G.A,{tag:"span",size:"sm",className:"space-x-0.5"},(0,r.createElement)("span",null,e)),(0,r.createElement)("div",{className:"ml-auto inline-flex items-center gap-2"},(0,r.createElement)(Z.E,{size:12,weight:400,color:"help"},(0,r.createElement)("span",{className:(0,c.cn)({"text-text-error":t?.length>a})},null!==(g=t?.length)&&void 0!==g?g:0),"/ ",a),(0,r.createElement)(X,{fieldKey:m,onUseThis:p,tooltip:(0,C.__)("Generate with AI","surerank")}))),(0,r.createElement)(J.A,{key:d,ref:n,by:"label",defaultValue:s,trigger:"@",options:l,onChange:o,placeholder:i,className:u,maxLength:"description"===d?y.x8:void 0}),(0,r.createElement)(Z.E,{size:12,color:"help",weight:400},(0,C.__)("Type @ to view variable suggestions","surerank")))},ee=({postMetaData:e,updatePostMetaData:t,globalDefaults:a})=>{const{variables:n,postDynamicData:s,title:u,description:d}=(0,o.useSelect)(e=>{const t=e(i.E);return{variables:t?.getVariables(),postDynamicData:t?.getPostDynamicData(),title:t?.getPostSeoMeta()?.page_title,description:t?.getPostSeoMeta()?.page_description}},[]),m=a,p=(0,l.useRef)(null),g=(0,l.useRef)(null),h=(a,r)=>{e[a]!==r&&t({[a]:r})},f=(e,t)=>{h(e,t)},k=$(n),_=surerank_seo_popup?.site_icon_url?surerank_seo_popup?.site_icon_url:"",E=(0,j.A)(u||m.page_title,k,s),w=(0,j.A)(d||m?.page_description,k,s),b=(0,c.EJ)(E,y.qt),v=(0,c.EJ)(w,y.UM),x=(0,j.A)(u,k,s),S=(0,j.A)(d,k,s),N=(()=>{const e=()=>{if(!wp?.data?.select("core/editor"))return"";const{getPermalink:e,isCurrentPostPublished:t}=wp.data.select("core/editor"),a=e();return t()&&a||a&&!a?.includes("auto-draft")?a:""},[t,a]=(0,l.useState)(e());return wp.data.subscribe(()=>{const r=e();r&&r!==t&&a(r)}),t})(),A=(0,l.useMemo)(()=>/page_id=|p=/.test(k?.permalink)&&N?N:k?.permalink,[k?.permalink,N]);return(0,r.createElement)("div",{className:"flex flex-col gap-2"},(0,r.createElement)("div",{className:"space-y-2.5 p-2 px-0"},(0,r.createElement)("div",{className:"flex items-center justify-between gap-10"},(0,r.createElement)("div",{className:"flex items-center justify-start gap-1"},(0,r.createElement)(G.A,{tag:"span",size:"sm",className:"space-x-0.5"},(0,r.createElement)("span",null,(0,C.__)("Search Engine Preview","surerank"))),(0,r.createElement)(K.$w,{content:(0,C.__)("View a preview of how your page may appear in search engine results. This preview is for guidance only and might not exactly match how search engines display your content.","surerank"),placement:"top",arrow:!0,className:"z-[99999]"},(0,r.createElement)(W.A,{className:"size-4 text-icon-secondary"})))),(0,r.createElement)(Y.A,{siteTitle:k?.site_name,faviconURL:_,title:b,description:v,permalink:(0,c.jP)(A,65),deviceType:"desktop"})),(0,r.createElement)(Q,{label:(0,C.__)("Search Engine Title","surerank"),inputContent:x,maxLength:y.qt,editorRef:p,defaultValue:(0,c.pk)(e.page_title||m.page_title,y.Op,"value"),variableSuggestions:y.Op,onChange:e=>{h("page_title",(0,c.P3)(e.toJSON()))},editorKey:"title",fieldKey:"page_title",onUseThis:f}),(0,r.createElement)(Q,{label:(0,C.__)("Search Engine Description","surerank"),inputContent:S,maxLength:y.UM,editorRef:g,defaultValue:(0,c.pk)(e?.page_description||m?.page_description,y.Op,"value"),variableSuggestions:y.Op,onChange:e=>{h("page_description",(0,c.P3)(e.toJSON()))},className:"[&+div]:items-start [&+div]:pt-1",editorKey:"description",fieldKey:"page_description",onUseThis:f}))};var te=a(54429),ae=a(19781),re=a(62163),ne=a(14060),se=a(38502),le=a(68458),oe=a(60249);const ie=[{label:(0,C.__)("Facebook","surerank"),slug:"facebook"},{label:(0,C.__)("X","surerank"),slug:"twitter"}],ce=({postMetaData:e,updatePostMetaData:t,globalDefaults:a})=>{const{variables:n,postDynamicData:s}=(0,o.useSelect)(e=>{const{getVariables:t,getPostDynamicData:a}=e(i.E);return{variables:t(),postDynamicData:a()}},[]),u=a,[m,p]=(0,l.useState)("facebook"),[g,h]=(0,l.useState)({facebook:e?.facebook_image_mode||"uploader",twitter:e?.twitter_image_mode||"uploader"});(0,l.useEffect)(()=>{const a=e?.facebook_image_url||"",r=e?.twitter_image_url||"",n={...g};let s=!1;a.includes("%custom_field.")&&"custom"!==g.facebook&&(n.facebook="custom",s=!0),r.includes("%custom_field.")&&"custom"!==g.twitter&&(n.twitter="custom",s=!0),s&&(h(n),"custom"===n.facebook&&t({facebook_image_mode:"custom"}),"custom"===n.twitter&&t({twitter_image_mode:"custom"}))},[e?.facebook_image_url,e?.twitter_image_url]);const f=(0,l.useCallback)((t,a)=>{let r=m;return"twitter"===m&&e?.twitter_same_as_facebook&&(r="facebook"),e?.[`${r}_${t}`]||a?.[`${r}_${t}`]},[m,e,n,s]),_=$(n),E=(0,c.EJ)((0,j.A)(f("title",u),_,s),null),w=(0,c.EJ)((0,j.A)(f("description",u),_,s),78),b=e?.auto_generated_og_image?e?.auto_generated_og_image:u?.fallback_image,v=f("image_url",u)?f("image_url",u):b;let x=e?.[`${m}_image_url`]?e?.[`${m}_image_url`]:v;"twitter"===m&&e?.twitter_same_as_facebook&&(x=e?.facebook_image_url||b),x&&"custom"===g[m]&&x.includes("%")&&(x=(0,j.A)(x,_,s)),x&&x.includes("%")&&(x="");const S=!!e?.[`${m}_image_url`],N=(0,C.__)("Upload at least 600x315px image. Recommended size is 1200x630px.","surerank"),A=(0,C.__)("Enter a custom field variable like %custom_field.field_name% or a direct image URL.","surerank"),T="uploader"===g[m]?N:A,P=(0,l.useRef)(null),L=(0,l.useRef)(null),z=(a,r)=>{e[a]!==r&&t({[a]:r})};return(0,r.createElement)("div",{className:"flex flex-col gap-2 max-h-full w-full p-2"},(0,r.createElement)(te.Ay.Group,{className:"w-full",size:"md",variant:"rounded",activeItem:m,onChange:({value:{slug:e}})=>{p(e)}},ie.map(({label:e,slug:t})=>(0,r.createElement)(te.Ay.Tab,{key:t,slug:t,text:e,className:"text-sm"}))),(0,r.createElement)(d.P.div,{key:m,className:"flex flex-col gap-2 flex-1 overflow-y-auto",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2}},"twitter"===m&&(0,r.createElement)("div",{className:"flex items-center gap-3 p-2"},(0,r.createElement)(ae.Ay,{id:"facebook_same_as_twitter",name:"facebook_same_as_twitter",size:"sm",defaultValue:!!e?.twitter_same_as_facebook,onChange:e=>{z("twitter_same_as_facebook",!!e&&"1")}}),(0,r.createElement)(G.A,{htmlFor:"facebook_same_as_twitter",size:"sm"},(0,C.__)("Use Data from Facebook Tab","surerank"))),(D="twitter"===m&&!!e?.twitter_same_as_facebook,I=(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"p-2 space-y-1.5"},(0,r.createElement)("div",{className:"flex items-center justify-between gap-2"},(0,r.createElement)("div",{className:"flex items-center gap-1"},(0,r.createElement)(G.A,{tag:"span",size:"sm"},(0,C.__)("Social Image","surerank")),(0,r.createElement)(K.$w,{content:T,placement:"top",arrow:!0,className:"z-[99999]"},(0,r.createElement)(W.A,{className:"size-4 text-icon-secondary"}))),(0,r.createElement)("div",{className:"flex items-center gap-2"},(0,r.createElement)(ae.Ay,{id:`${m}_image_mode_toggle`,size:"xs",checked:"custom"===g[m],onChange:e=>{const t=e?"custom":"uploader";h({...g,[m]:t}),z(`${m}_image_mode`,t)}}),(0,r.createElement)(G.A,{htmlFor:`${m}_image_mode_toggle`,size:"sm",className:"text-field-label"},(0,C.__)("Custom Field","surerank")))),"uploader"===g[m]?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(re.A,{className:"m-0 [&>input]:m-0 [&>input]:transition-colors [&>input]:duration-150 [&>input]:ease-in-out",type:"file",size:"md",onClick:e=>{e.preventDefault();const a=(0,oe.a)({title:"Select Image",button:{text:"Use this image"},multiple:!1});a.on("select",()=>{const e=a.state().get("selection").first().toJSON();t({[`${m}_image_url`]:e.url,[`${m}_image_id`]:e.id})}),a.open()}}),S&&(0,r.createElement)(le.A,{imageId:e?.[`${m}_image_id`],onRemove:()=>{t({[`${m}_image_url`]:"",[`${m}_image_id`]:""})}})):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(J.A,{by:"label",defaultValue:(0,c.pk)(e?.[`${m}_image_url`],y.Op,"value"),trigger:"@",options:y.Op,onChange:e=>{z(`${m}_image_url`,(0,c.P3)(e.toJSON()))},placeholder:(0,C.__)("Enter image URL or %custom_field.field_name%","surerank")}),(0,r.createElement)(Z.E,{size:14,weight:400,color:"help"},(0,C.__)("Type @ to view variable suggestions or enter a direct URL","surerank")))),(0,r.createElement)("div",{className:"space-y-1.5 p-2"},(0,r.createElement)("div",{className:"flex items-center justify-between gap-1"},(0,r.createElement)(G.A,{tag:"span",size:"sm",className:"space-x-0.5"},(0,C.__)("Social Title","surerank")),(0,r.createElement)(X,{fieldKey:`${m}_title`,onUseThis:(e,t)=>{z(e,t)},tooltip:(0,C.__)("Generate with AI","surerank")})),(0,r.createElement)(J.A,{ref:P,by:"label",defaultValue:(0,c.pk)(e?.[`${m}_title`],y.Op,"value"),trigger:"@",options:y.Op,onChange:e=>{z(`${m}_title`,(0,c.P3)(e.toJSON()))},placeholder:""}),(0,r.createElement)("span",{className:"block text-xs leading-4 font-normal text-field-helper"},(0,C.__)("Type @ to view variable suggestions","surerank"))),(0,r.createElement)("div",{className:"space-y-1.5 p-2"},(0,r.createElement)("div",{className:"flex items-center justify-between gap-1"},(0,r.createElement)(G.A,{tag:"span",size:"sm",className:"space-x-0.5"},(0,C.__)("Social Description","surerank")),(0,r.createElement)(X,{fieldKey:`${m}_description`,onUseThis:(e,t)=>{z(e,t)},tooltip:(0,C.__)("Generate with AI","surerank")})),(0,r.createElement)(J.A,{ref:L,className:"[&+div]:items-start [&+div]:pt-1",by:"label",defaultValue:(0,c.pk)(e?.[`${m}_description`],y.Op,"value"),options:y.Op,onChange:e=>{z(`${m}_description`,(0,c.P3)(e.toJSON()))},trigger:"@",placeholder:"",maxLength:y.x8}),(0,r.createElement)("span",{className:"block text-xs leading-4 font-normal text-field-helper"},(0,C.__)("Type @ to view variable suggestions","surerank")))),D?null:"function"===typeof I?I():I),(0,r.createElement)("div",{className:"p-2 space-y-2"},(0,r.createElement)("div",{className:"flex items-center justify-between"},(0,r.createElement)(G.A,{tag:"span",size:"sm"},(0,C.sprintf)((0,C.__)("%s Preview","surerank"),"facebook"===m?"Facebook":"X")),"facebook"===m&&(0,r.createElement)(K.$w,{content:(0,C.__)("Click to update Facebook's share preview cache. This will update the preview with the latest content.","surerank"),placement:"top-end",offset:{alignmentAxis:"0",mainAxis:"8"},arrow:!0},(0,r.createElement)(k.A,{size:"sm",className:"p-0.5",onClick:()=>{const e=window?.wp?.data?.select("core/editor")?.getPermalink()||n?.term?.permalink?.value;window.open(`https://developers.facebook.com/tools/debug/?q=${e}`,"_blank")},icon:(0,r.createElement)(ne.A,null),variant:"ghost"}))),(0,r.createElement)(se.A,{type:m,title:E,description:w,imageURL:x,twitterLargePreview:"twitter"===m&&"summary_large_image"===a?.twitter_card_type,siteURL:n?.site?.site_url?.value?.replace(/(^\w+:|^)\/\//,""),hideRemoveButton:!0,forMetaBox:!0}))));var D,I};var ue=a(74443);const de=(0,s.compose)((0,o.withSelect)(e=>{var t,a;const r=e(i.E),n=null!==(t=null!==(a=e("core/editor")?.getPermalink())&&void 0!==a?a:surerank_seo_popup?.link)&&void 0!==t?t:"";return{postMetaData:r.getPostSeoMeta(),canonicalURLPlaceholder:n,globalDefaults:r.getGlobalDefaults()}}),(0,o.withDispatch)(e=>{const t=e(i.E);return{setMetaData:e=>t.updatePostMetaData(e)}}))(({postMetaData:e,setMetaData:t,canonicalURLPlaceholder:a,globalDefaults:n})=>{var s,l;const o=null!==(s=null!==(l=surerank_seo_popup?.post_type)&&void 0!==l?l:wp?.data?.select("core/editor")?.getCurrentPostType())&&void 0!==s?s:"post",i=e?.post_no_index,c=e?.post_no_follow,u=e?.post_no_archive;let d={};if(""===i&&""===c&&""===u){const e=void 0!==n?.no_index?n.no_index:[],t=void 0!==n?.no_follow?n.no_follow:[],a=void 0!==n?.no_archive?n.no_archive:[];e?.includes(o)&&(d={...d,post_no_index:"yes"}),t?.includes(o)&&(d={...d,post_no_follow:"yes"}),a?.includes(o)&&(d={...d,post_no_archive:"yes"})}return"yes"===i&&(d={...d,post_no_index:"yes"}),"yes"===c&&(d={...d,post_no_follow:"yes"}),"yes"===u&&(d={...d,post_no_archive:"yes"}),(0,r.createElement)("div",{className:"flex flex-col gap-3 px-3 mt-1"},(0,r.createElement)("div",{className:"flex flex-col gap-2"},(0,r.createElement)("div",{className:"flex items-center gap-1"},(0,r.createElement)(G.A,{as:"p",size:"sm"},(0,C.__)("Robot Instructions","surerank"),(0,r.createElement)(K.Nr,{content:(0,C.__)('These settings help search engines understand how to treat your page in search results. Enabling "No Index" will prevent the page from appearing in search results. "No Follow" tells search engines not to follow any links on the page, and "No Archive" prevents search engines from storing a cached version of the page.',"surerank")}))),(0,r.createElement)("div",{className:"flex flex-col gap-2 items-start"},y.vr.map(e=>(0,r.createElement)(ue.A,{key:e.id,size:"sm",label:{heading:(0,r.createElement)("div",{className:"flex items-center gap-1"},e.label,(0,r.createElement)(K.Nr,{content:e.description}))},checked:"yes"===d[e.id],onChange:a=>{return r=e.id,n=a,d={...d,[r]:n?"yes":"no"},void t(d);var r,n}})))),(0,r.createElement)("div",{className:"flex flex-col gap-1.5"},(0,r.createElement)(G.A,{htmlFor:"canonical-url",size:"sm",className:"flex items-center gap-1"},(0,C.__)("Canonical URL","surerank"),(0,r.createElement)(K.Nr,{content:(0,C.__)("The Canonical URL tells search engines which version of a page should be indexed to avoid duplicate content issues. Leave blank to let SureRank set it automatically.","surerank")})),(0,r.createElement)(re.A,{id:"canonical-url",type:"text",size:"md",className:"[&_input]:m-0",value:e.canonical_url,onChange:e=>(e=>{t({canonical_url:e})})(e),placeholder:a})))});var me=a(13739),pe=a(1839),ge=a(22157),he=a(28177),fe=a(98583),ke=a(22895);const _e=({onConfirm:e,confirmText:t=(0,C.__)("Remove","surerank"),cancelText:a=(0,C.__)("Cancel","surerank"),children:n,className:s,...o})=>{const[i,u]=(0,l.useState)(!1),d=e=>{e.preventDefault(),e.stopPropagation()},m=(0,r.createElement)("div",{className:"flex gap-2 items-center"},(0,r.createElement)(k.A,{size:"xs",variant:"outline",onClick:e=>{d(e),u(!1)},"aria-label":(0,C.__)("Cancel","surerank")},a),(0,r.createElement)(k.A,{size:"xs",className:"focus:[box-shadow:none] bg-button-danger hover:bg-button-danger-hover outline-button-danger hover:outline-button-danger-hover",onClick:t=>{d(t),e(),u(!1)},destructive:!0,"aria-label":(0,C.__)("Confirm","surerank")},t));return(0,r.createElement)(K.$w,{className:(0,c.cn)("w-fit p-1.5 rounded shadow-md border border-solid border-border-subtle [&>svg]:fill-border-subtle",s),content:m,open:i,setOpen:u,variant:"light",arrow:!0,...o},(0,l.cloneElement)(n,{onClick:e=>{d(e),u(e=>!e)}}))},ye=({postMetaData:e,globalDefaults:t,updatePostMetaData:a})=>{const[n,s]=(0,l.useState)(!1),[o,i]=(0,l.useState)(""),[u,d]=(0,l.useState)(""),[m,p]=(0,l.useState)(null),[g,h]=(0,l.useState)({}),f=surerank_globals?.wp_schema_pro_active||!1,k=surerank_globals?.default_schemas||{},_=Object.entries(k).map(([e,t])=>({id:e,...t})),y=e.schemas?e.schemas:t.schemas||{}||{},E=(0,l.useMemo)(()=>Object.entries(y).filter(([,e])=>(0,fe.sP)(e?.title)),[y]),w=surerank_globals?.schema_type_data||{},b=surerank_globals?.schema_type_options||{},v=(0,l.useMemo)(()=>Object.entries(surerank_globals?.schema_variables||{}).map(([e,t])=>({value:e,label:t})),[]),x=e=>e.reduce((e,t)=>{if("Group"===t.type&&t.fields)if(t.cloneable){const a={};t.fields.forEach(e=>{a[e.id]="Group"===e.type&&e.fields?x(e.fields):void 0!==e.std?e.std:""}),e[t.id]=[a]}else{const a={};t.fields.forEach(e=>{a[e.id]="Group"===e.type&&e.fields?x(e.fields):void 0!==e.std?e.std:""}),e[t.id]=a}else void 0!==t.std&&(e[t.id]=t.std);return e},{}),S=e=>{const t={};return Object.entries(e).forEach(([e,a])=>{const{show_on:r,not_show_on:n,...s}=a,l={...s,parent:!0};t[e]=l}),t};(0,l.useEffect)(()=>{const e={};if(Object.entries(y).forEach(([t,a])=>{const r=a.fields||{},n=x(w[a.title]||[]),s={...r,...n};0===Object.keys(r).length&&(s["@type"]=a?.type||"",e[t]={...a,fields:s})}),Object.keys(e).length>0){const t=S({...y,...e});JSON.stringify(t)!==JSON.stringify(y)&&a({schemas:t})}},[y,w,a]);const N=(e,t)=>y[e]?.fields?.[t]||"",A=(e,t,r)=>{if(((e,t,r)=>{const n={...y,[e]:{...y[e],fields:{...y[e].fields,[t]:r}}},s=S(n);a({schemas:s})})(e,t,r),"@type"===t){const t={...y};t[e].type=t[e]?.title||"",t[e].fields["@type"]=r,a({schemas:t})}};return f?(0,r.createElement)(ge.A,null):(0,r.createElement)("div",{className:"pt-2 gap-2"},(0,r.createElement)("div",{className:"flex items-center mb-4.5 -mt-0.5"},(0,r.createElement)(Z.E,{size:14,weight:500,color:"label"},(0,C.__)("Schemas in Use","surerank"))),(0,r.createElement)("div",{className:(0,c.cn)("w-full bg-background-secondary flex flex-col items-center justify-center rounded p-1")},E.length>0?(0,r.createElement)(q.Ay,{type:"simple",iconType:"arrow",className:"w-full space-y-1",autoClose:!1},E.map(([e,t])=>(0,r.createElement)(q.Ay.Item,{key:e,value:e,className:"bg-background-primary rounded-md",defaultExpanded:e===m},(0,r.createElement)(q.Ay.Trigger,{iconType:"arrow",className:"hover:bg-background-primary rounded-md flex justify-between items-center [&>div]:w-full p-2 gap-2 [&>svg]:size-4 cursor-pointer"},(0,r.createElement)("span",{className:"text-base font-normal text-text-primary leading-6 ml-1"},t.title),(0,r.createElement)(_e,{onConfirm:()=>(e=>{const t={...y};delete t[e];const r=S(t);a({schemas:r})})(e),placement:"bottom",offset:{mainAxis:8,crossAxis:-28}},(0,r.createElement)("div",{className:"inline-flex ml-auto",role:"button",tabIndex:0},(0,r.createElement)(pe.A,{className:"size-3.5 text-icon-secondary cursor-pointer"})))),(0,r.createElement)(q.Ay.Content,null,(0,r.createElement)("div",{className:"mt-3 space-y-4"},(e=>{const t=y[e]?.title;if(!(0,fe.sP)(t))return fe.lz;const a=w[t]||[];return 0===a.length||a.every(e=>"Hidden"===e.type||"schema_name"===e.id)?fe.lz:a.map(t=>"Hidden"===t.type||"SchemaDocs"===t.type?null:t.show||t.required?(0,r.createElement)("div",{key:t.id,className:"flex flex-col items-start justify-start gap-1.5 w-full p-1"},(0,r.createElement)("div",{className:"flex items-center gap-1.5"},(0,r.createElement)(G.A,{tag:"span",size:"sm",required:t.required},t.label),t.tooltip&&(0,r.createElement)(K.$w,{content:t.tooltip,placement:"top",arrow:!0,className:"z-[99999]"},(0,r.createElement)(W.A,{className:"size-4 text-icon-secondary",title:t.tooltip}))),"Group"===t.type&&t.cloneable?(0,r.createElement)("div",{className:"flex flex-col w-full"},(0,he.hx)({field:t,schemaId:e,getFieldValue:t=>N(e,t),onFieldChange:(t,a)=>A(e,t,a),variableSuggestions:v,fieldItemIds:g,setFieldItemIds:h})):"Group"!==t.type||t.cloneable?(0,r.createElement)("div",{className:"flex items-center gap-1.5 w-full"},t.cloneable?(0,he.OH)({field:t,schemaType:y[e].type,getFieldValue:t=>N(e,t),onFieldChange:(t,a)=>A(e,t,a),variableSuggestions:v,renderAsGroupComponent:!0}):(0,he.Yi)({field:t,schemaType:y[e].type,getFieldValue:t=>N(e,t),onFieldChange:(t,a)=>A(e,t,a),variableSuggestions:v,renderAsGroupComponent:!0})):(0,r.createElement)("div",{className:"flex flex-col w-full space-y-3 border border-border-subtle rounded-lg p-3"},t.fields.map(a=>"Hidden"===a.type?null:(0,r.createElement)("div",{key:a.id,className:"flex flex-col items-start justify-start gap-1.5 w-full"},(0,r.createElement)("div",{className:"flex items-center gap-1.5"},(0,r.createElement)(G.A,{tag:"span",size:"sm",required:a.required},a.label),a.tooltip&&(0,r.createElement)(K.$w,{content:a.tooltip,placement:"top",arrow:!0,className:"z-[99999]"},(0,r.createElement)(W.A,{className:"size-4 text-icon-secondary",title:a.tooltip}))),(0,r.createElement)("div",{className:"flex items-center gap-1.5 w-full"},(0,he.Yi)({field:a,schemaType:y[e].type,getFieldValue:r=>(N(e,t.id)||{})[r]||a.std||"",onFieldChange:(a,r)=>{const n={...N(e,t.id)||{},[a]:r};A(e,t.id,n)},variableSuggestions:v,renderAsGroupComponent:!1})))))):null)})(e)))))):(0,r.createElement)(me.A,{className:"w-full shadow-none",content:(0,C.__)("No schemas configured.","surerank"),variant:"info"})),(0,r.createElement)("div",{className:"w-full mt-6 rounded"},(0,r.createElement)(ke.A,{selectedSchema:o,setSelectedSchema:i,selectedType:u,setSelectedType:d,schemaTypeOptions:b,defaultSchemas:_,handleAddSchema:()=>{const e=(0,fe.lk)(),t={title:o,type:u,show_on:{rules:[],specific:[],specificText:[]},fields:{}},r={...y,[e]:t},n=S(r);a({schemas:n}),p(e),s(!1),i(""),d("")},isModalOpen:n,closeModal:()=>s(!1)})))},Ee=({postMetaData:e,updatePostMetaData:t,globalDefaults:a})=>{const{currentAccordion:n}=(0,o.useSelect)(e=>e(i.E).getAppSettings()),{updateAppSettings:s}=(0,o.useDispatch)(i.E),c=n||"general";(0,l.useEffect)(()=>{n||s({currentAccordion:"general"})},[]);const u=e=>{s({currentAccordion:e})};return(0,r.createElement)(q.Ay,{autoClose:!0,defaultValue:c,type:"boxed",className:"flex flex-col"},(0,r.createElement)(q.Ay.Item,{value:"general",className:"bg-background-primary border rounded-md overflow-hidden"},(0,r.createElement)(q.Ay.Trigger,{className:"text-base [&>svg]:size-4 px-4 py-4 hover:bg-background-secondary transition-colors",onClick:()=>u("general"),"aria-label":(0,C.__)("Toggle general SEO settings","surerank")},(0,C.__)("General","surerank")),(0,r.createElement)(q.Ay.Content,null,(0,r.createElement)(ee,{postMetaData:e,updatePostMetaData:t,globalDefaults:a}))),(0,r.createElement)(q.Ay.Item,{value:"social",className:"bg-background-primary border rounded-md overflow-hidden"},(0,r.createElement)(q.Ay.Trigger,{className:"text-base [&>svg]:size-4 px-4 py-4 hover:bg-background-secondary transition-colors",onClick:()=>u("social"),"aria-label":(0,C.__)("Toggle social media settings","surerank")},(0,C.__)("Social","surerank")),(0,r.createElement)(q.Ay.Content,null,(0,r.createElement)(ce,{postMetaData:e,updatePostMetaData:t,globalDefaults:a}))),(0,r.createElement)(q.Ay.Item,{value:"advanced",className:"bg-background-primary border rounded-md overflow-hidden"},(0,r.createElement)(q.Ay.Trigger,{className:"text-base [&>svg]:size-4 px-4 py-4 hover:bg-background-secondary transition-colors",onClick:()=>u("advanced"),"aria-label":(0,C.__)("Toggle advanced SEO settings","surerank")},(0,C.__)("Advanced","surerank")),(0,r.createElement)(q.Ay.Content,null,(0,r.createElement)(de,{postMetaData:e,updatePostMetaData:t,globalDefaults:a}))),y.Rw&&(0,r.createElement)(q.Ay.Item,{value:"schema",className:"bg-background-primary border rounded-md overflow-hidden"},(0,r.createElement)(q.Ay.Trigger,{className:"text-base [&>svg]:size-4 px-4 py-4 hover:bg-background-secondary transition-colors",onClick:()=>u("schema"),"aria-label":(0,C.__)("Toggle schema markup settings","surerank")},(0,C.__)("Schema","surerank")),(0,r.createElement)(q.Ay.Content,null,(0,r.createElement)(ye,{postMetaData:e,updatePostMetaData:t,globalDefaults:a}))))},we=({isRefreshing:e,isChecking:t,onClick:a,targetSelector:n=".refresh-button-container"})=>{const[s,o]=(0,l.useState)(null);return(0,l.useEffect)(()=>{const e=()=>{const e=document.querySelector(n);e&&o(e)};e();const t=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,a=t?new t(e):null;return a&&a.observe(document.body,{childList:!0,subtree:!0}),()=>a.disconnect()},[n]),s?(0,l.createPortal)((0,r.createElement)(H.sv,{isRefreshing:e,isChecking:t,onClick:a}),s):null};var be=a(54822),ve=a(68402);const xe={IDLE:"idle",START:"start",IN_PROGRESS:"inProgress",COMPLETED:"completed",FAILED:"failed"};var Ce=a(23551);const Se=(e,t)=>!(!e||!t)&&e.toLowerCase().includes(t.toLowerCase()),Ne=()=>{var e;const{setPageSeoCheck:t}=(0,o.useDispatch)(i.E),{metaData:a,variables:r,postDynamicData:n,globalDefaults:s,settingsLoaded:c,pageSeoChecks:u,focusKeyword:d,ignoredList:m,initializing:p}=(0,o.useSuspenseSelect)(e=>{const t=e(i.E);return{metaData:t?.getPostSeoMeta(),variables:t?.getVariables(),postDynamicData:t?.getPostDynamicData(),globalDefaults:t?.getGlobalDefaults(),settingsLoaded:t?.getMetaboxState(),pageSeoChecks:t?.getPageSeoChecks()||{},focusKeyword:t?.getPostSeoMeta()?.focus_keyword,ignoredList:t.getCurrentPostIgnoredList(),initializing:t.getPageSeoChecks().initializing}},[]),g=(0,l.useRef)({postContent:"",permalink:""}),h=(0,l.useRef)(a),f=(0,l.useRef)(d),k=(0,l.useRef)(m),_=(0,l.useCallback)((e,a,l)=>{if(!l)return void t("keyword",[]);const o=$(r),i=(0,j.A)(a.page_title||s.page_title||"",o,n),c=(0,j.A)(a.page_description||s.page_description||"",o,n),u=e?.permalink||r?.post?.permalink?.value||r?.term?.permalink?.value||window.location.href||"",d=e?.postContent||n?.content||"",m=[];m.push(((e,t)=>t?e?Se(e,t)?(0,I.bY)({id:"keyword_in_title",title:(0,C.sprintf)((0,C.__)('Focus keyword "%s" found in SEO title.',"surerank"),t),status:"success",type:"keyword"}):(0,I.bY)({id:"keyword_in_title",title:(0,C.sprintf)((0,C.__)('Focus keyword "%s" not found in SEO title.',"surerank"),t),status:"warning",type:"keyword"}):(0,I.bY)({id:"keyword_in_title",title:(0,C.__)("No SEO title found to analyze.","surerank"),status:"warning",type:"keyword"}):(0,I.bY)({id:"keyword_in_title",title:(0,C.__)("No focus keyword set to analyze title.","surerank"),status:"suggestion",type:"keyword"}))(i,l)),m.push(((e,t)=>t?e?Se(e,t)?(0,I.bY)({id:"keyword_in_description",title:(0,C.sprintf)((0,C.__)('Focus keyword "%s" found in meta description.',"surerank"),t),status:"success",type:"keyword"}):(0,I.bY)({id:"keyword_in_description",title:(0,C.sprintf)((0,C.__)('Focus keyword "%s" not found in meta description.',"surerank"),t),status:"warning",type:"keyword"}):(0,I.bY)({id:"keyword_in_description",title:(0,C.__)("No meta description found to analyze.","surerank"),status:"warning",type:"keyword"}):(0,I.bY)({id:"keyword_in_description",title:(0,C.__)("No focus keyword set to analyze meta description.","surerank"),status:"suggestion",type:"keyword"}))(c,l)),m.push(((e,t)=>{if(!t)return(0,I.bY)({id:"keyword_in_url",title:(0,C.__)("No focus keyword set to analyze URL.","surerank"),status:"suggestion",type:"keyword"});if(!e)return(0,I.bY)({id:"keyword_in_url",title:(0,C.__)("No URL found to analyze.","surerank"),status:"warning",type:"keyword"});const a=t.toLowerCase().replace(/\s+/g,"-");return e.toLowerCase().includes(a)||Se(e,t)?(0,I.bY)({id:"keyword_in_url",title:(0,C.sprintf)((0,C.__)('Focus keyword "%s" found in URL.',"surerank"),t),status:"success",type:"keyword"}):(0,I.bY)({id:"keyword_in_url",title:(0,C.sprintf)((0,C.__)('Focus keyword "%s" not found in URL.',"surerank"),t),status:"warning",type:"keyword"})})(u,l)),m.push(((e,t)=>{if(!t)return(0,I.bY)({id:"keyword_in_content",title:(0,C.__)("No focus keyword set to analyze content.","surerank"),status:"suggestion",type:"keyword"});if(!e)return(0,I.bY)({id:"keyword_in_content",title:(0,C.__)("No content found to analyze.","surerank"),status:"warning",type:"keyword"});const a=e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();return Se(a,t)?(0,I.bY)({id:"keyword_in_content",title:(0,C.sprintf)((0,C.__)('Focus keyword "%s" found in content.',"surerank"),t),status:"success",type:"keyword"}):(0,I.bY)({id:"keyword_in_content",title:(0,C.sprintf)((0,C.__)('Focus keyword "%s" not found in content.',"surerank"),t),status:"warning",type:"keyword"})})(d,l));const p=m.filter(Boolean);t("keyword",p)},[r,n,s,t]);(0,l.useLayoutEffect)(()=>{if(!c)return;const e=nt();(!(0,D.isEqual)(h.current,a)||!(0,D.isEqual)(g.current,e)||f.current!==d||!(0,D.isEqual)(k.current,m))&&(_(e,a,d),g.current=e,h.current=a,f.current=d,k.current=m)},[c,d,a,r,s,n,m,p]),(0,l.useLayoutEffect)(()=>{if(!c)return;const e=(0,D.debounce)(()=>{const e=nt();(0,D.isEqual)(g.current,e)&&(0,D.isEqual)(h.current,a)&&f.current===d&&(0,D.isEqual)(k.current,m)||(g.current=e,h.current=a,f.current=d,k.current=m,_(e,a,d))},300),t=(0,o.subscribe)(e);return()=>{t(),e.cancel()}},[c,a,d,r,s,n,m,_,p]);const y=null!==(e=u?.keywordChecks)&&void 0!==e?e:{badChecks:[],fairChecks:[],passedChecks:[],suggestionChecks:[],ignoredChecks:[]},E=y?.badChecks?.length>0||y?.fairChecks?.length>0||y?.suggestionChecks?.length>0;return{...y,hasBadOrFairChecks:E}},Ae=({type:e="page"})=>{const{pageSeoChecks:t,focusKeyword:a,currentScreen:n,currentTab:s}=(0,o.useSuspenseSelect)(e=>{const t=e(i.E),a=t.getAppSettings();return{pageSeoChecks:t?.getPageSeoChecks()||{},focusKeyword:t?.getPostSeoMeta?.()?.focus_keyword,ignoredList:t.getCurrentPostIgnoredList(),currentScreen:a?.currentScreen,currentTab:a?.currentTab}},[]),{ignorePageSeoCheck:u,restorePageSeoCheck:d,updateAppSettings:m,updatePostSeoMeta:p}=(0,o.useDispatch)(i.E);Ne();const g=(0,l.useMemo)(()=>{var a;const r=t?.categorizedChecks||{badChecks:[],fairChecks:[],passedChecks:[],suggestionChecks:[],ignoredChecks:[]};return null!==(a=t[(0,c.sz)(e)?.categorizedType])&&void 0!==a?a:{...r}},[e,t?.checks]),h=({selectedCheckId:e,content:t})=>{if("url_length"===e&&t){const e=(0,U.applyFilters)("surerank-pro.page-seo-checks-fix-url-length",null);if("function"!==typeof e)return;return void e(t)}const a=ve.BB[e];a&&p({[a]:t})};return"keyword"!==e||a?(0,r.createElement)(be.A,{type:e,pageSeoChecks:{...t,...g},onIgnore:e=>{u(e)},onRestore:e=>{d(e)},onFix:e=>{m({selectedCheckId:e,onSuccess:h,generateContentProcess:xe.IDLE,error:null,fixProcess:xe.IDLE,currentScreen:"fixItForMe",previousScreen:n,previousTab:s})}}):null},Te=({type:e="page"})=>!1===y.Jj?null:(0,r.createElement)(l.Suspense,{fallback:(0,r.createElement)(Ce.A,null)},(0,r.createElement)(Ae,{type:e})),Pe=({type:e="page"})=>{const t=(0,o.useSelect)(e=>e(i.E).getPageSeoChecks(),[]),{ignorePageSeoCheck:a,restorePageSeoCheck:n,updateAppSettings:s,updatePostSeoMeta:u}=(0,o.useDispatch)(i.E),{focusKeyword:d,currentScreen:m,currentTab:p}=(0,o.useSelect)(e=>{const t=e(i.E),a=t.getAppSettings();return{focusKeyword:t?.getPostSeoMeta?.()?.focus_keyword,currentScreen:a?.currentScreen,currentTab:a?.currentTab}},[]),g=(0,l.useMemo)(()=>{var a;const r=t?.categorizedChecks||{badChecks:[],fairChecks:[],passedChecks:[],suggestionChecks:[],ignoredChecks:[]},n=(0,c.sz)(e)?.categorizedType;return null!==(a=t[n])&&void 0!==a?a:{...r}},[e,t?.checks]),h=({selectedCheckId:e,content:t})=>{const a=ve.BB[e];a&&u({[a]:t})};return(0,H.ep)()?null:"keyword"!==e||d?(0,r.createElement)("div",{className:"p-1 space-y-2 flex-1 flex flex-col"},(0,r.createElement)("div",{className:"flex-1"},(0,r.createElement)(l.Suspense,{fallback:(0,r.createElement)(Ce.A,null)},(0,r.createElement)(be.A,{type:e,pageSeoChecks:{...t,...g,isCheckingLinks:t.isCheckingLinks},onIgnore:e=>{a(e)},onRestore:e=>{n(e)},onFix:e=>{s({selectedCheckId:e,onSuccess:h,generateContentProcess:xe.IDLE,error:null,fixProcess:xe.IDLE,currentScreen:"fixItForMe",previousScreen:m,previousTab:p})}})))):null};var Le=a(29767),ze=a(98979);const De=({value:e,onChange:t,suffix:a=null,placeholder:n=(0,C.__)("Enter your focus keyword","surerank"),isLoading:s=!1,...l})=>s?(0,r.createElement)(Le.A,{className:"w-full h-10"}):(0,r.createElement)(re.A,{className:"[&_input]:transition-[color,outline] [&_input]:duration-200",size:"md",placeholder:n,suffix:null!==a&&void 0!==a?a:(0,r.createElement)(ze.A,{className:"size-5 text-icon-primary",strokeWidth:1.5}),value:e,onChange:t,...l}),Ie=()=>{const{updatePostMetaData:e}=(0,o.useDispatch)(i.E),{focusKeyword:t,initialized:a}=(0,o.useSelect)(e=>{const t=e(i.E);return{focusKeyword:t?.getPostSeoMeta?.()?.focus_keyword,initialized:t.getMetaboxState()}});return(0,r.createElement)("div",{className:"w-full flex flex-col gap-2 [&>div]:w-full"},(0,r.createElement)("div",{className:"flex items-center gap-2"},(0,r.createElement)(Z.E,{as:"label",size:14,weight:500,lineHeight:20,htmlFor:"focus-keyword-input"},(0,C.__)("Focus Keyword","surerank")),(0,r.createElement)(K.ID,{content:(0,C.__)("The primary keyword or phrase you want this content to rank for in search engines. Keyword checks will be based on this.","surerank"),placement:"top-start",arrow:!1})),(0,r.createElement)(De,{id:"focus-keyword-input",value:t||"",onChange:t=>{e({focus_keyword:t})},isLoading:!a}))},Me=({type:e})=>{if((0,H.QZ)())return null;const t=(0,H.jK)();return(0,r.createElement)(t?Pe:Te,{type:e})},Oe=()=>{const e=(0,H.jK)(),t=(0,o.useSelect)(e=>e(i.E).getPageSeoChecks(),[]),a=(0,l.useMemo)(()=>{const e=t?.categorizedPageChecks||{};return"success"!==(0,w.F)(e)?.status},[t?.categorizedPageChecks]),n=t?.isRefreshing||!1,s=t?.brokenLinkState||{isChecking:!1,checkedLinks:[],brokenLinks:[],allLinks:[]},c={...s,checkedLinks:new Set(s.checkedLinks),brokenLinks:new Set(s.brokenLinks)},u=(0,o.useSelect)(e=>e(i.E).getModalState(),[]),d=(0,o.useSelect)(e=>e(i.E).getRefreshCalled(),[]),{setPageSeoCheck:m,setRefreshCalled:p}=(0,o.useDispatch)(i.E),g=(0,l.useCallback)(e=>{m("isRefreshing",e)},[m]),h=(0,l.useCallback)(e=>{let t=e;if("function"===typeof e){const a=e({...s,checkedLinks:new Set(s.checkedLinks),brokenLinks:new Set(s.brokenLinks)});t={...a,checkedLinks:Array.from(a.checkedLinks||[]),brokenLinks:Array.from(a.brokenLinks||[])}}else e&&"object"===typeof e&&(t={...e,checkedLinks:e.checkedLinks instanceof Set?Array.from(e.checkedLinks):e.checkedLinks||[],brokenLinks:e.brokenLinks instanceof Set?Array.from(e.brokenLinks):e.brokenLinks||[]});m("brokenLinkState",t)},[m,s]),f=(0,l.useCallback)(async()=>{p(!0),await(0,H.OV)(g,h,m,o.select,t,c)},[g,h,m,t,c,p]);(0,l.useEffect)(()=>{e&&u&&!d&&((0,H.OV)(g,h,m,o.select,t,c),p(!0))},[e,u,d,m,t,c,p]);const k=a?"page-checks":"keyword-checks";return(0,H.QZ)()?(0,r.createElement)("div",null,(0,r.createElement)(Z.E,{color:"help",size:14,className:"text-center py-5 border-0.5 border-solid border-border-secondary rounded-md"},(0,C.__)("SEO analysis is not available for this page.","surerank"))):(0,r.createElement)("div",{className:"space-y-2"},(0,H.jp)()&&(0,r.createElement)("div",{className:"[&_p.mr-10]:mr-0 m-1"},(0,r.createElement)(me.A,{variant:"info",content:(0,r.createElement)("span",{className:"flex items-start gap-2"},(0,r.createElement)("p",null,(0,C.__)("Please save changes in the editor before refreshing the checks.","surerank")),(0,r.createElement)("span",{className:"-mr-3 refresh-button-container shrink-0"})),className:"shadow-none"})),e&&(0,r.createElement)(we,{isRefreshing:n,isChecking:t.isCheckingLinks,onClick:f}),(0,r.createElement)(q.Ay,{autoClose:!0,defaultValue:k,type:"boxed"},(0,r.createElement)(q.Ay.Item,{value:"page-checks",className:"bg-background-primary overflow-hidden"},(0,r.createElement)(q.Ay.Trigger,{className:"text-base [&>svg]:size-5 pr-2 pl-3 py-3"},(0,C.__)("Page Checks","surerank")),(0,r.createElement)(q.Ay.Content,null,(0,r.createElement)("div",{className:"pt-3"},(0,r.createElement)(Me,{type:"page"})))),(0,r.createElement)(q.Ay.Item,{value:"keyword-checks",className:"bg-background-primary overflow-hidden"},(0,r.createElement)(q.Ay.Trigger,{className:"text-base [&>svg]:size-5 pr-2 pl-3 py-3"},(0,C.__)("Keyword Checks","surerank")),(0,r.createElement)(q.Ay.Content,null,(0,r.createElement)("div",{className:"pt-3"},y.Jj&&!(0,H.ep)()&&!(0,H.Rm)()&&(0,r.createElement)("div",{className:"flex items-center gap-2 mb-3"},(0,r.createElement)(Ie,null)),(0,r.createElement)(Me,{type:"keyword"}))))))},Fe=({tab:e="general"})=>{if("advanced"===e){const e=3;return(0,r.createElement)("div",{className:"w-full p-4 space-y-5"},(0,r.createElement)("div",{className:"space-y-2"},(0,r.createElement)("div",{className:"w-full flex items-center gap-2"},(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-32 h-4"}),(0,r.createElement)(Le.A,{variant:"circular",className:"size-5"})),(0,r.createElement)("div",{className:"space-y-4"},Array.from({length:e}).map((e,t)=>(0,r.createElement)("div",{key:t,className:"flex items-start gap-2"},(0,r.createElement)(Le.A,{variant:"rectangular",className:"size-5"}),(0,r.createElement)("div",{className:"space-y-2"},(0,r.createElement)(Le.A,{variant:"rectangular",className:(0,c.cn)("w-44 h-5",t%2===0&&"w-52")}),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-full h-4"})))))),(0,r.createElement)("div",{className:"w-full p-1 space-y-1.5"},(0,r.createElement)("div",{className:"w-full flex items-center gap-2"},(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-32 h-4"}),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-5 h-4"})),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-full h-12"}),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-full h-3"})))}const t="social"===e?2:1;return(0,r.createElement)("div",{className:"w-full space-y-2 p-2"},"social"===e&&(0,r.createElement)("div",{className:"w-full p-1"},(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-full h-14"})),(0,r.createElement)("div",{className:"w-full p-1 space-y-2"},(0,r.createElement)("div",{className:"w-full flex items-center justify-between"},(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-32 h-4"}),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-10 h-5"})),(0,r.createElement)(Le.A,{variant:"rectangular",className:(0,c.cn)("w-full h-40",{"h-48":"social"===e})})),Array.from({length:t}).map((e,t)=>(0,r.createElement)("div",{key:t,className:"w-full p-1 space-y-1.5"},(0,r.createElement)("div",{className:"w-full flex items-center gap-2"},(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-32 h-4"}),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-5 h-4"})),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-full h-12"}),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-full h-3"}))),(0,r.createElement)("div",{className:"w-full p-1 space-y-1.5"},(0,r.createElement)("div",{className:"w-full flex items-center gap-2"},(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-32 h-4"}),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-5 h-4"})),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-full h-32"}),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-full h-3"})))};let Re=e=>e;"block"===surerank_seo_popup?.editor_type?Re=g:"classic"===surerank_seo_popup?.editor_type&&(Re=h);const je=(0,s.compose)((0,o.withSelect)(e=>{const t=e(i.E);return{postMetaData:t.getPostSeoMeta(),initialized:t.getMetaboxState(),globalDefaults:t.getGlobalDefaults()}}),(0,o.withDispatch)(e=>{const t=e(i.E);return{updatePostMetaData:e=>t.updatePostMetaData(e)}}),Re)((0,l.memo)(e=>{const{postMetaData:t,updatePostMetaData:a,initialized:n,globalDefaults:s}=e,{status:u,initializing:m}=b(),p=(0,l.useMemo)(()=>{if(m||!u||!y.Jj)return null;const e=(0,c.ns)(u);return(0,r.createElement)("div",{className:(0,c.cn)("rounded-full ml-1 w-[7px] h-[7px]",e)})},[u,m]),g=[{label:(0,C.__)("Optimize","surerank"),slug:"optimize"},...(0,H.QZ)()?[]:[{label:(0,C.__)("Analyze","surerank"),slug:"analyze",icon:p}]],h=(0,U.applyFilters)("surerank.meta-settings.tabs",g,{statusIndicatorIcon:p}),{updateAppSettings:f}=(0,o.useDispatch)(i.E),{currentMetaTab:k}=(0,o.useSelect)(e=>e(i.E).getAppSettings()),[_,E]=(0,l.useState)(k||"optimize");(0,l.useEffect)(()=>{k&&k!==_&&E(k)},[k]);let w=null;switch(_){case"optimize":w=(0,r.createElement)(Ee,{postMetaData:t,updatePostMetaData:a,globalDefaults:s});break;case"analyze":w=(0,r.createElement)(Oe,null);break;default:w=null}return w=(0,U.applyFilters)("surerank.meta-settings.tab-content",w,{activeTab:_,postMetaData:t,updatePostMetaData:a,globalDefaults:s}),n||(w=(0,r.createElement)(Fe,{tab:_})),(0,r.createElement)(l.Fragment,null,(0,r.createElement)("div",null,(0,r.createElement)(te.Ay.Group,{className:"w-full",iconPosition:"right",size:"md",variant:"rounded",activeItem:_,onChange:({event:e,value:{slug:t}})=>{e.preventDefault(),e.stopPropagation(),E(t),f({currentMetaTab:t})}},h.map(({label:e,slug:t,icon:a})=>(0,r.createElement)(te.Ay.Tab,{key:e,slug:t,text:e,icon:null!==a&&void 0!==a?a:null,className:"text-sm"})))),(0,r.createElement)(d.P.div,{key:_,className:"flex flex-col -mt-1 flex-1 overflow-y-auto",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2}},w))})),$e=(0,U.applyFilters)("surerank-pro.seo-popup-tabs",{optimize:{title:(0,C.__)("Optimize","surerank"),component:()=>(0,r.createElement)(je,null),label:(0,C.__)("Optimize","surerank"),icon:(0,r.createElement)(B.A,null),slug:"optimize"},...(0,H.QZ)()?{}:{analyze:{title:(0,C.__)("Analyze","surerank"),component:Oe,label:(0,C.__)("Analyze","surerank"),slug:"analyze",icon:(0,r.createElement)(V.A,null),className:"relative surerank-page-checks-indicator"}}});var He=a(45350),Ue=a(3535),Be=a(80827);const Ve=({onClickGetStarted:e,onClickLearnMore:t,heading:a,subheading:n})=>{const[s,o]=(0,l.useState)(!1),i=[{id:1,text:(0,C.__)("Meta Titles & Descriptions","surerank")},{id:2,text:(0,C.__)("Social Titles & Descriptions","surerank")},{id:3,text:(0,C.__)("Site level SEO Checks","surerank")}],c=(0,U.applyFilters)("surerank.ai_auth_button_config",{buttonText:(0,C.__)("Let's Get Started","surerank"),onClick:null});return(0,r.createElement)("div",{className:"flex flex-col items-center self-stretch gap-3 px-5 py-8"},(0,r.createElement)(He.mc,{className:"flex flex-col justify-center items-center gap-8 mx-auto max-w-[24.75rem]"},(0,r.createElement)(f.V_,{width:28,height:31}),(0,r.createElement)("div",{className:"flex flex-col items-center self-stretch gap-3"},(0,r.createElement)(Z.E,{size:18,weight:600,color:"primary",className:"text-center"},a||(0,C.__)("Let SureRank AI optimize your SEO","surerank")),(0,r.createElement)(Z.E,{size:14,weight:400,color:"secondary",className:"text-center self-stretch"},n||(0,C.__)("Our AI-powered assistant helps you fix SEO issues smartly and quickly. No need to dig through settings or guess what's wrong \u2014 we'll do the heavy lifting for you.","surerank"))),(0,r.createElement)("div",{className:"flex flex-row self-stretch flex-wrap justify-center gap-6 py-2"},i.map(e=>(0,r.createElement)("div",{key:e.id,className:"flex flex-col items-center gap-2 max-w-28"},(0,r.createElement)(Be.A,{width:16,height:16,className:"text-icon-interactive"}),(0,r.createElement)(Z.E,{size:14,weight:500,color:"primary",className:"text-center"},e.text)))),(0,r.createElement)("div",{className:"flex flex-col w-full gap-2 p-2"},(0,r.createElement)(k.A,{variant:"primary",onClick:async()=>{c.onClick?c.onClick():s||"function"!==typeof e||(o(!0),await e(),o(!1))},className:"[&>span]:flex [&>span]:items-center [&>span]:justify-center [&>span]:gap-2",icon:s&&(0,r.createElement)(Ue.a,{size:"sm",variant:"secondary"})},c.buttonText),(0,r.createElement)(k.A,{variant:"ghost",className:"w-fit mx-auto hover:bg-transparent focus:[box-shadow:none] text-text-tertiary hover:text-text-secondary font-normal",onClick:()=>{"function"===typeof t&&t()}},(0,C.__)("Learn more","surerank")))))};var qe=a(90232);const Ge=({title:e=(0,C.__)("Here are a few suggestions","surerank"),onBack:t,onClose:a,className:n})=>(0,r.createElement)("div",{className:(0,c.cn)("flex flex-col self-stretch gap-2 px-4 pt-3.5 pb-2",n)},(0,r.createElement)("div",{className:"flex justify-between items-center self-stretch gap-8"},(0,r.createElement)(Z.E,{size:16,lineHeight:20,color:"primary",weight:600},e),(0,r.createElement)("div",{className:"flex items-center gap-2"},(0,r.createElement)(k.A,{variant:"outline",size:"xs",onClick:t,className:"px-1 py-1 border border-gray-300 shadow-sm bg-white",icon:(0,r.createElement)(qe.A,{className:"text-text-primary"}),iconPosition:"left"},(0,r.createElement)("span",null,(0,C.__)("Back","surerank"))),"function"===typeof a&&(0,r.createElement)(k.A,{variant:"ghost",size:"xs",onClick:a,className:"p-1 text-icon-secondary hover:text-icon-primary hover:bg-transparent bg-transparent focus:outline-none",icon:(0,r.createElement)(_.A,null)}))));var We=a(72956);const Ke=({onClickUpgrade:e,title:t=(0,C.__)("Free Plan Limit Reached","surerank"),description:a=(0,C.__)("You've used all available AI requests in your Free Plan. Upgrade to SureRank Pro to keep using AI features.","surerank"),buttonText:n=(0,C.__)("Upgrade Now","surerank"),showButton:s=!0})=>(0,r.createElement)("div",{className:"bg-background-secondary rounded-lg p-2"},(0,r.createElement)("div",{className:"bg-background-primary rounded-md p-4 flex flex-col items-center gap-3"},(0,r.createElement)(f.BZ,{className:"text-text-primary"}),(0,r.createElement)("div",{className:"text-center"},(0,r.createElement)(Z.E,{as:"h3",size:16,weight:600,color:"primary"},t),(0,r.createElement)(Z.E,{color:"secondary",className:"mt-1"},a)),s&&(0,r.createElement)(k.A,{variant:"primary",size:"md",onClick:()=>{"function"===typeof e?e():(0,We.n$)("ai_credits_exhausted")}},n)));var Ye=a(15977);const Ze=({message:e="",title:t="",icon:a=null,className:n})=>t&&a&&e?(0,r.createElement)("div",{className:(0,c.cn)("p-2 rounded-lg bg-background-secondary",n)},(0,r.createElement)("div",{className:"flex flex-col items-center text-center gap-2 p-4 bg-background-primary shadow-sm rounded-md"},a,(0,r.createElement)("div",{className:"space-y-1"},t&&(0,r.createElement)(Z.E,{as:"h5",size:18,weight:600,color:"primary"},t),(0,r.createElement)(Z.E,{size:14,weight:400,color:"secondary"},e||(0,C.__)("No data available","surerank"))))):(0,r.createElement)(He.mc,{align:"center",justify:"center",className:(0,c.cn)("p-8 bg-background-primary border border-solid border-border-subtle rounded-lg",n)},(0,r.createElement)(Z.E,{size:14,weight:400,color:"secondary"},e||(0,C.__)("No data available","surerank"))),Je=({item:e,onUseThis:t,globalFixing:a})=>{const[n,s]=(0,l.useState)(!1);let o=(0,C.__)("Use This","surerank");return n&&(o=(0,C.__)("Fixing\u2026","surerank")),(0,r.createElement)("div",{className:"flex flex-row self-stretch gap-1 p-2 bg-white rounded-md shadow-sm"},(0,r.createElement)("div",{className:"flex flex-row items-center gap-1 p-1 flex-1"},(0,r.createElement)("div",{className:"flex flex-row justify-stretch items-stretch gap-2 flex-1"},(0,r.createElement)(Z.E,{size:14,weight:500,color:"secondary",className:"flex-1"},e.text))),(0,r.createElement)("div",{className:"flex flex-row items-start gap-2"},(0,r.createElement)(k.A,{variant:"link",size:"xs",tag:"button",className:"mt-2",onClick:()=>(async e=>{if(!n&&!a){s(!0);try{"function"===typeof t&&await t(e)}finally{s(!1)}}})(e.text),disabled:n||a,icon:n&&(0,r.createElement)(Ue.a,{size:"sm"})},o)))},Xe=({onUseThis:e,onRegenerate:t,contents:a=[],generating:n=!1,fixing:s=!1,error:l=null})=>{const o=a&&a?.length>0,i=null!==l,u=()=>{let e=(0,C.__)("Generate","surerank");return!o&&i&&(e=(0,C.__)("Retry","surerank")),n&&(e=(0,C.__)("Generating\u2026","surerank")),o?(0,C.__)("Regenerate","surerank"):e};let d;return d=n?Array.from({length:5}).map((e,t)=>(0,r.createElement)("div",{key:t,className:"flex flex-row self-stretch gap-1 p-2 bg-white rounded-md shadow-sm"},(0,r.createElement)("div",{className:"flex flex-row items-center gap-1 p-1 flex-1"},(0,r.createElement)("div",{className:"flex flex-row justify-stretch items-stretch gap-2 flex-1"},(0,r.createElement)("div",{className:"flex-1 space-y-2"},(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-full h-4"}),(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-3/4 h-4"})))),(0,r.createElement)("div",{className:"flex flex-row items-center gap-2"},(0,r.createElement)(Le.A,{variant:"rectangular",className:"w-16 h-8 rounded"})))):o?a.map(t=>(0,r.createElement)(Je,{key:t.id,item:t,onUseThis:e,globalFixing:s})):(0,r.createElement)("div",{className:"flex flex-col self-stretch gap-2"},(0,r.createElement)(Ze,{message:o?(0,C.__)('No content generated yet. Click "Generate" to create AI-powered content suggestions.',"surerank"):(0,C.sprintf)((0,C.__)("No content generated. Click %s to retry creating AI-powered content suggestions.","surerank"),`"${u()}"`),className:"m-2 text-center"})),(0,r.createElement)("div",{className:"flex flex-col self-stretch gap-3"},(0,r.createElement)(Z.E,{size:14,weight:400,color:"primary",className:"self-stretch"},(0,C.__)("Here are the fixes generated by SureRank AI based on your request. Review and apply the ones you'd like to use.","surerank")),(0,r.createElement)("div",{className:"flex flex-col items-end self-stretch gap-2 p-2 bg-background-secondary rounded-lg"},d,(0,r.createElement)("div",{className:"flex flex-row items-center gap-2 p-1"},(0,r.createElement)(k.A,{variant:"ghost",size:"xs",onClick:()=>{n||"function"===typeof t&&t()},disabled:n,icon:(0,r.createElement)(Ye.A,{className:(0,c.cn)("w-4 h-4",n&&"animate-spin")}),iconPosition:"left",className:"px-1"},u()))))};var Qe=a(10960);const et=({error:e,onRetry:t,title:a,fallbackMessage:n,supportText:s,retryText:l})=>{const o=["content_generation_error","internal_server_error"].includes(e?.code),i=window?.surerank_globals?.support_link,c=(0,C.__)("Generation Failed","surerank"),u=(0,C.__)("Oops! Something went wrong while generating content. You can try again, or edit it manually to make sure it's correct.","surerank"),d=(0,C.__)("Click here to contact support.","surerank"),m=(0,C.__)("Retry","surerank");return(0,r.createElement)(Qe.A,{color:"error",title:a||c,message:e?.message||n||u,footer:(0,r.createElement)("div",{className:"flex flex-col gap-1"},o&&i&&(0,r.createElement)(k.A,{tag:"a",size:"md",href:i,target:"_blank",variant:"link",className:"w-fit [&>span]:p-0 no-underline hover:no-underline ring-0 -mt-2 mb-2"},s||d),(0,r.createElement)(k.A,{onClick:t,tag:"button",variant:"link",className:"w-fit [&>span]:p-0"},l||m))})},tt=e=>{const{updateAppSettings:t}=(0,o.useDispatch)(i.E),{status:a=xe.IDLE,allGeneratedContents:n={},selectedCheckId:s,selectedFieldKey:c,checkType:u,genError:d,postId:p,onSuccess:g,onError:h,onProgress:f,onUseThis:k,previousScreen:_}=(0,o.useSelect)(e=>{const t=e(i.E).getPageSeoChecks(),a=e(i.E).getAppSettings();return{status:a?.generateContentProcess,allGeneratedContents:a?.generatedContents,selectedCheckId:a?.selectedCheckId||t?.selectedItem,selectedFieldKey:a?.selectedFieldKey,genError:a?.error,postId:t?.postId,checkType:t?.checkType,previousScreen:a?.previousScreen,onSuccess:a?.onSuccess,onError:a?.onError,onProgress:a?.onProgress,onUseThis:a?.onUseThis}},[]),y=c||s,E=n[y]||[],{handleFixContent:w,isFixing:b}=((e={})=>{const{onSuccess:t,onError:a,onProgress:r}=e,{updateAppSettings:n}=(0,o.useDispatch)(i.E),{postId:s,checkType:l,selectedCheckId:c,status:u,currentScreen:d,previousScreen:p}=(0,o.useSelect)(e=>{const t=e(i.E).getPageSeoChecks(),a=e(i.E).getAppSettings();return{postId:t?.postId,checkType:t?.checkType,selectedCheckId:a?.selectedCheckId,status:a?.fixProcess,currentScreen:a?.currentScreen,previousScreen:a?.previousScreen}},[]);return{handleFixContent:async e=>{try{if(u===xe.IN_PROGRESS)return;if(""===e?.trim())throw new Error((0,C.__)("Selected content is empty.","surerank"));const a=s||window?.surerank_seo_popup?.post_id||window?.surerank_seo_popup?.term_id;if(!a)throw new Error((0,C.__)("Post or term ID not found.","surerank"));n({fixProcess:xe.IN_PROGRESS}),r&&"function"===typeof r&&r({selectedCheckId:c,content:e,postId:a,checkType:l});const o="taxonomy"===l||"1"===window?.surerank_seo_popup?.is_taxonomy,i=await N()({path:"/surerank/v1/page-seo-checks/fix",method:"POST",data:{type:"content-generation",input_key:c,input_value:e,id:parseInt(a),is_taxonomy:o}});if(!i?.success)throw new Error(i?.message||(0,C.__)("Failed to apply content.","surerank"));return t&&"function"===typeof t&&t({response:i,selectedCheckId:c,content:e,postId:a,checkType:l}),"block"!==surerank_seo_popup.editor_type&&m.o.success(i?.message||(0,C.__)("Fixed successfully","surerank"),{description:(0,C.__)("Fix applied successfully. Some fixes may require a page reload to see changes.","surerank")}),n({currentScreen:p,previousScreen:d,fixProcess:xe.IDLE,selectedCheckId:null,error:null}),i}catch(o){n({fixProcess:xe.ERROR});const t=o?.message||(0,C.__)("An unexpected error occurred while applying content.","surerank");return a&&"function"===typeof a&&a({error:o,selectedCheckId:c,content:e,postId:s||window?.surerank_seo_popup?.post_id||window?.surerank_seo_popup?.term_id,checkType:l}),m.o.error(t),{error:o?.message||(0,C.__)("Unknown error","surerank")}}},isFixing:u===xe.IN_PROGRESS}})({onSuccess:g,onError:h,onProgress:f}),v=async()=>{if(a!==xe.IN_PROGRESS)try{t({generateContentProcess:xe.START});const e=s||c,a=ve.EF[e]?ve.EF[e]:"";if(!a)throw{message:(0,C.__)("No content type selected. Please select an item to generate content for.","surerank"),code:"no_content_type"};t({generateContentProcess:xe.IN_PROGRESS});const r=p||window?.surerank_seo_popup?.post_id||window?.surerank_seo_popup?.term_id,l="taxonomy"===u||"1"===window?.surerank_seo_popup?.is_taxonomy,o=await(0,P.lX)(a,r,l);if(!o?.success)throw o;const i=o.content.map((e,t)=>({id:Date.now()+t,text:e}));t({generateContentProcess:xe.COMPLETED,generatedContents:{...n,[y]:i}})}catch(r){var e;t({generateContentProcess:xe.FAILED,error:{message:null!==(e=r?.message)&&void 0!==e?e:(0,C.__)("An unexpected error occurred while generating content.","surerank"),code:r?.code||"unknown_error"}})}},x=()=>{v()},S=async e=>{if(k&&c)return k(c,e),void t({currentScreen:_,previousScreen:"",selectedCheckId:null,selectedFieldKey:null,onUseThis:null,generateContentProcess:xe.IDLE,error:null});await w(e)};return(0,l.useEffect)(()=>{a!==xe.IDLE||!s&&!c||E.length||v()},[]),a===xe.FAILED?"require_pro"===d?.code?(0,r.createElement)(Ke,null):"limit_exceeded"===d?.code?(0,r.createElement)(Ke,{title:(0,C.__)("Daily Limit Reached","surerank"),description:(0,C.__)("You've used all your AI credits for today. Your credits will refresh automatically tomorrow, so you can continue creating content.","surerank"),showButton:!1}):(0,r.createElement)(et,{error:d,onRetry:x,title:(0,C.__)("Generation Failed","surerank"),supportText:(0,C.__)("Click here to contact support.","surerank"),retryText:(0,C.__)("Retry","surerank")}):(0,r.createElement)(Xe,a===xe.COMPLETED?{...e,contents:E,onRegenerate:x,onUseThis:S,fixing:b}:{...e,contents:E,onRegenerate:x,onUseThis:S,generating:a===xe.IN_PROGRESS||a===xe.START,error:a===xe.FAILED?d:null,fixing:b})},at=(0,U.applyFilters)("surerank-pro.seo-popup-screens",{settings:{title:(0,C.__)("Settings","surerank"),component:()=>{const{currentTab:e}=(0,o.useSelect)(e=>e(i.E).getAppSettings(),[]),t=(0,l.useMemo)(()=>{const t=$e[null!==e&&void 0!==e?e:"optimize"];return(0,H.jK)()&&t?.pageBuilderComponent||t?.component},[e]);return(0,r.createElement)(t,null)}},fixItForMe:{title:(0,C.__)("Fix It For Me","surerank"),component:()=>{const{authenticated:e,previousScreen:t,currentScreen:a,previousTab:n,previousMetaTab:s,previousAccordion:c}=(0,o.useSelect)(e=>{const t=e(i.E).getPageSeoChecks(),a=e(i.E).getAppSettings();return{authenticated:t?.authenticated,previousScreen:a?.previousScreen,currentScreen:a?.currentScreen,previousTab:a?.previousTab,previousMetaTab:a?.previousMetaTab,previousAccordion:a?.previousAccordion}},[]),{updateAppSettings:u,setPageSeoCheck:d}=(0,o.useDispatch)(i.E),{openAuthPopup:p}=((e,t={})=>{const{pollingInterval:a=2e3,maxPollingTime:r=3e5}=t,n=(0,l.useRef)(null),s=(0,l.useRef)(null),o=(0,l.useRef)(null),i=(0,l.useRef)(0),c=(0,l.useRef)(!1);(0,l.useEffect)(()=>()=>{n.current&&clearInterval(n.current)},[]);const u=async()=>{try{if(c.current&&(i.current+=1,i.current>10))return p(),void m.o.error((0,C.__)("Authentication timeout. Please try again.","surerank"));if(Date.now()-o.current>r)return p(),void m.o.error((0,C.__)("Authentication timeout. Please try again.","surerank"));const t=await(0,P.xI)();if(!t?.success)return;t?.auth_url||(p(),s.current&&!s.current.closed&&s.current.close(),e&&e(),m.o.success((0,C.__)("Authentication successful!","surerank")))}catch(t){m.o.error((0,C.__)("An error occurred during authentication","surerank"),{description:t?.message||"",autoDismiss:!1})}},d=(e=null)=>{if(p(),i.current=0,c.current=!1,e&&(s.current=e),o.current=Date.now(),n.current=setInterval(u,a),s.current){const e=setInterval(()=>{s.current?.closed&&(c.current=!0,clearInterval(e))},1e3)}},p=()=>{n.current&&(clearInterval(n.current),n.current=null),o.current=null,i.current=0,c.current=!1};return{startPolling:d,stopPolling:p,openAuthPopup:e=>{const t=window.open(e,"surerank_auth","fullscreen=yes,scrollbars=yes,resizable=yes");return!t||t.closed?(m.o.error((0,C.__)("Popup blocked. Redirecting to authentication\u2026","surerank")),window.location.href=e,null):(d(t),t)},isPolling:null!==n.current}})(()=>d("authenticated",!0));let g,h=(0,r.createElement)(tt,null);if(!e){const e=()=>window.open(y.HH,"_blank","noopener"),t=async()=>{try{const e=await(0,P.xI)();if(!e?.success)throw new Error(e?.message||(0,C.__)("Authentication failed","surerank"));if(e?.auth_url)return void p(e.auth_url);d("authenticated",!0)}catch(e){m.o.error(e?.message||(0,C.__)("An error occurred during authentication","surerank"))}};g=(0,C.__)("Connect SureRank AI","surerank"),h=(0,r.createElement)(Ve,{onClickLearnMore:e,onClickGetStarted:t})}return(0,r.createElement)("div",{className:"p-2 space-y-6"},(0,r.createElement)(Ge,{className:"p-0",title:g,onBack:()=>{u({currentScreen:t,previousScreen:a,currentTab:n||"optimize",currentMetaTab:s||"optimize",currentAccordion:c||"general",selectedCheckId:null,selectedFieldKey:null,onUseThis:null,generateContentProcess:xe.IDLE,error:null})}}),h)}}});window&&!window?.toast&&(window.toast=m.o);const rt={open:{x:0},closed:{x:"100%"}},nt=()=>{const e=(0,o.select)("core/editor"),t=(0,o.select)(i.E);if("block"===surerank_seo_popup?.editor_type)return{postContent:e.getEditedPostContent()||"",permalink:e.getPermalink()||surerank_seo_popup?.link,title:e.getEditedPostAttribute("title")||"",description:t.getPostSeoMeta()?.page_description||""};if("undefined"!==typeof window.tinymce&&window.tinymce.get("content")){const e=document.getElementById("title");return{postContent:window.tinymce.get("content").getContent()||"",permalink:surerank_seo_popup?.link,title:e&&e.value||"",description:t.getPostSeoMeta()?.page_description||""}}const a=document.getElementById("content"),r=document.getElementById("title");return{postContent:a&&a.value||"",permalink:surerank_seo_popup?.link,title:r&&r.value||"",description:t.getPostSeoMeta()?.page_description||""}},st=()=>(Ne(),(()=>{const{setPageSeoCheck:e}=(0,o.useDispatch)(i.E),{metaData:t,variables:a,postDynamicData:r,globalDefaults:n,pageSeoChecks:s,settingsLoaded:c}=(0,o.useSuspenseSelect)(e=>{const t=e(i.E);return t?.getCurrentPostIgnoredList(),{metaData:t?.getPostSeoMeta()||{},variables:t?.getVariables()||{},postDynamicData:t?.getPostDynamicData()||{},globalDefaults:t?.getGlobalDefaults()||{},pageSeoChecks:t?.getPageSeoChecks()||{},settingsLoaded:t?.getMetaboxState()}},[]),{categorizedChecks:u={},initializing:d}=s,[,m]=(0,l.useTransition)(),p=(0,l.useRef)({postContent:"",permalink:""}),g=(0,l.useRef)(t),h=(0,H.jK)(),f=(0,l.useMemo)(()=>$(a),[a]),k=(0,l.useMemo)(()=>(0,j.A)(t.page_title||n.page_title||"",f,r),[t.page_title,n.page_title,f,r]),_=(0,l.useMemo)(()=>(0,j.A)(t.page_description||n.page_description||"",f,r),[t.page_description,n.page_description,f,r]),E=(0,l.useMemo)(()=>(0,j.A)(t.canonical_url||n.canonical_url||"",f,r),[t.canonical_url,n.canonical_url,f,r]),b=(0,l.useCallback)(async(t,r,n,s,l)=>{if("1"===surerank_seo_popup?.is_taxonomy)return e("page",[(0,I.cd)(t.permalink),M(n),O(s),(0,R.aO)(l)]);const o=(i=t.postContent,(new DOMParser).parseFromString(i,"text/html"));var i;const c=await Promise.all([await(0,I.jU)(o),await(0,I.aS)(o),(0,I.SZ)(o),(0,I.cd)(t.permalink),M(n),O(s),F(),(0,I._e)(o),(0,R.aO)(l)]);e("page",c),m(async()=>{const t=await(0,R.Tq)(o,a?.post?.ID?.value||0,void 0,e),r=[...c];t&&r.push(t),e("page",r)})},[]);(0,l.useLayoutEffect)(()=>{!h&&c&&d&&y.Jj&&(async()=>{const a=nt();await b(a,t,k,_,E),p.current=a,d&&e("initializing",!1)})()},[h,d,t,k,_,E,c]),(0,l.useLayoutEffect)(()=>{if(h||!c||d||!y.Jj)return;const e=(0,D.debounce)(async()=>{const e=nt();(0,D.isEqual)(p.current,e)&&(0,D.isEqual)(g.current,t)||(p.current=e,g.current=t,await b(e,t,k,_,E))},300),a=(0,o.subscribe)(e);return()=>{a(),e.cancel()}},[h,t,k,_,b,E,d,c]);(0,l.useMemo)(()=>(0,w.F)(u),[u])})(),null);let lt=e=>e;"block"===surerank_seo_popup?.editor_type?lt=g:"classic"===surerank_seo_popup?.editor_type&&(lt=h);const ot=(0,s.compose)((0,o.withSelect)(e=>{const t=e(i.E);return{initialized:t.getMetaboxState(),appSettings:t.getAppSettings()}}),(0,o.withDispatch)(e=>{const t=e(i.E);return{setMetaDataAndDefaults:e=>t.initMetaDataAndDefaults(e),setInitialized:e=>t.updateMetaboxState(e),updateModalState:e=>t.updateModalState(e),updateAppSettings:e=>t.updateAppSettings(e)}}),lt,l.memo)(e=>{const{setMetaDataAndDefaults:t,initialized:a,setInitialized:n,updateModalState:s,appSettings:g}=e,h=(0,o.useSelect)(e=>e(i.E).getModalState(),[]),f=(0,l.useRef)(!1),k=(0,l.useCallback)(async()=>{if(!a)try{const e=await(0,P.lr)();m.o.success(e.message),t({postSeoMeta:e.data,globalDefaults:e.global_default})}catch(e){m.o.error(e.message)}finally{n(!0)}},[a]);(0,l.useEffect)(()=>{f.current||(k(),f.current=!0)},[k]);const _=(0,l.useCallback)(()=>{s(!1)},[s]),y=(0,l.useMemo)(()=>{if(g?.currentScreen)return at[g?.currentScreen].component},[g?.currentScreen]),E=(0,l.useMemo)(()=>{const e=at[g?.currentScreen];return e?.header?e.header:x},[g?.currentScreen]);return(0,r.createElement)(l.Fragment,null,(0,r.createElement)(l.Suspense,{fallback:null},(0,r.createElement)(st,null)),(0,r.createElement)(p.Ay,{className:"z-[100000]"}),(0,r.createElement)(u.N,null,h&&(0,r.createElement)(d.P.div,{tabIndex:"0",id:"surerank-seo-popup-modal-container",className:"fixed inset-y-0 right-0 lg:w-slide-over-container md:w-slide-over-container w-full z-[99999] bg-background-primary shadow-2xl p-0 flex flex-col",initial:"closed",animate:"open",exit:"closed",variants:rt,transition:{duration:.3}},(0,r.createElement)(E,{onClose:_}),(0,r.createElement)("div",{className:(0,c.cn)("flex-1 flex flex-col gap-6 overflow-y-auto px-4 pt-4 pb-0","optimize"!==g?.currentTab&&"pb-4")},(0,r.createElement)(y,null)),"settings"===g.currentScreen&&(0,r.createElement)(z,{onClose:_}))))}),it=window.wp.editor;var ct=a(56427),ut=a(11936);const dt=()=>{const{updateModalState:e}=(0,o.useDispatch)(i.E),[t,a]=(0,l.useState)(null),n=(0,o.useSelect)(e=>{try{return!!e(i.E).getModalState()}catch(t){return!1}},[]),{status:s,initializing:c,counts:u}=b(),d=(0,l.useCallback)(()=>e(!0),[e]);return(0,l.useEffect)(()=>{const e=()=>{const e=document.querySelector(".interface-pinned-items");if(e){let t=e.querySelector("#surerank-toolbar-portal");return t?t.parentElement!==e&&(e.firstChild&&e.firstChild!==t?e.insertBefore(t,e.firstChild):e.appendChild(t)):(t=document.createElement("div"),t.id="surerank-toolbar-portal",t.className="surerank-root",e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)),t}const t=document.querySelector([".edit-post-header__settings",".editor-header__actions",".edit-site-header__actions"].join(", "));if(!t)return null;let a=t.querySelector("#surerank-toolbar-portal");if(!a){a=document.createElement("div"),a.id="surerank-toolbar-portal",a.className="surerank-root";const e=t.querySelector([".edit-post-post-preview__button",".editor-preview-dropdown"].join(", "));e?(n=a,(r=e.closest("button, div, span")||e)&&r.parentNode?r.nextSibling?r.parentNode.insertBefore(n,r.nextSibling):r.parentNode.appendChild(n):t.appendChild(n)):t.appendChild(a)}var r,n;return a};let t=e();t&&a(t);const r=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(r){const n=new r(()=>{const r=document.getElementById("surerank-toolbar-portal"),n=document.querySelector(".interface-pinned-items");r?n&&r.parentElement!==n&&(n.firstChild&&n.firstChild!==r?n.insertBefore(r,n.firstChild):n.appendChild(r)):(t=e(),t&&a(t))}),s=document.querySelector(".editor-header, .edit-post-header");return n.observe(s,{childList:!0,subtree:!0}),()=>n.disconnect()}const n=window.setInterval(()=>{document.getElementById("surerank-toolbar-portal")||(t=e(),t&&a(t))},1500);return()=>window.clearInterval(n)},[]),t?(0,l.createPortal)((0,r.createElement)("div",{className:"relative"},(0,r.createElement)(ct.Button,{icon:(0,r.createElement)(f.bk,null),label:(0,ut.R)(u),"aria-label":(0,C.__)("Open SureRank Meta Box","surerank"),"aria-haspopup":"dialog",showTooltip:!0,isPressed:n,"aria-pressed":n,type:"button",size:"compact",onClick:d},(0,r.createElement)(E,{status:s,errorAndWarnings:u.errorAndWarnings,initializing:c}))),t):null},mt=window.wp.plugins;a(15345),(0,o.select)("core/editor")&&(0,mt.registerPlugin)("surerank-page-level-settings",{render:()=>{const{updateModalState:e}=(0,o.useDispatch)(i.E),t=(0,l.useCallback)(()=>{e(!0)},[e]);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(it.PluginMoreMenuItem,{onClick:t,icon:(0,r.createElement)(f.bk,null),"aria-label":(0,C.__)("Open SureRank Meta Box","surerank"),"aria-haspopup":"dialog"},(0,C.__)("SureRank Meta Box","surerank")),(0,r.createElement)(dt,null))}});const pt=()=>{const{updateModalState:e}=(0,o.useDispatch)(i.E),{status:t,initializing:a,counts:n}=b();return(0,l.useEffect)(()=>{const e=document.querySelector("#wpadminbar");e&&(e.style.zIndex="10")},[]),(0,r.createElement)("div",{className:"relative inline-flex"},(0,r.createElement)("button",{className:"inline-flex w-auto h-auto p-1 rounded-full border-0 bg-transparent focus:outline-none outline-none cursor-pointer",type:"button",onClick:()=>e(!0)},(0,r.createElement)(f.CX,{className:"size-6"})),(0,r.createElement)(E,{className:"z-auto",status:t,errorAndWarnings:n.errorAndWarnings,initializing:a}))};if("classic"===surerank_seo_popup.editor_type){const e=(()=>{const e=document.querySelector(".wrap > h1");if(e){const t=document.createElement("span");return t.id="seo-popup",t.className="surerank-root",e.appendChild(t),t}return null})();e&&(0,n.createRoot)(e).render((0,r.createElement)(pt,null))}document.addEventListener("DOMContentLoaded",function(){let e=document.querySelector("#surerank-root");e||(e=document.body.appendChild(document.createElement("div")),e.id="surerank-root",e.className="surerank-root"),setTimeout(function(){(0,n.createRoot)(e).render((0,r.createElement)(ot,null))},1e3)})},1455:e=>{e.exports=window.wp.apiFetch},1671:(e,t,a)=>{a.d(t,{E:()=>r});const r="surerank"},9607:(e,t,a)=>{a.d(t,{EJ:()=>p,MI:()=>F,OY:()=>C,P$:()=>w,P3:()=>_,PA:()=>b,RL:()=>$,XY:()=>m,ZV:()=>S,_t:()=>I,b7:()=>R,bF:()=>g,cn:()=>k,d_:()=>B,e$:()=>f,jP:()=>E,jT:()=>P,mT:()=>z,mv:()=>L,ns:()=>M,pk:()=>y,rt:()=>V,sI:()=>T,sL:()=>N,sz:()=>H,tI:()=>U,tX:()=>A,we:()=>j,x7:()=>O,xZ:()=>D,xx:()=>v});var r=a(27723),n=a(65313),s=a(6463),l=a(80696),o=a(81301),i=a(34164),c=a(75795),u=a(50856),d=a(76016);const m=e=>{const t=e.match(/<p>(.*?)<\/p>/g);return t?.length?t[0].replace(/(<([^>]+)>)/gi,""):e.replace(/(<([^>]+)>)/gi,"").replace(/\s+/g," ")},p=(e,t,a="...")=>!e?.length||!t||t<0||e.length<=t?e:e.slice(0,t)+a,g=(e,t,a=100)=>{if("string"!==typeof e||!e.trim())return;if(!h(t))return;const r=document.querySelector(e);r&&setTimeout(()=>{(0,c.createRoot)(r).render(t)},a)},h=e=>e&&e?.$$typeof===Symbol.for("react.element"),f=()=>({surerank_general:"general_settings",surerank_social:"social_settings",surerank_advanced:"advanced_settings"}[new URLSearchParams(window.location.search).get("page")]||"general_settings"),k=(...e)=>(0,u.QP)((0,i.A)(...e)),_=(e,t="value")=>{const a=e?.root?.children[0]?.children;if(!a||!a?.length)return"";let r="";return a.forEach(e=>{switch(e.type){case"text":r+=e.text;break;case"mention":r+=e.data[t];break;case"linebreak":r+="\n"}}),r},y=(e,t=[],a="value",r={type:"mention",version:1,data:{},size:"md",by:"label"})=>{const n={root:{children:[{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""}],direction:null,format:"",indent:0,type:"root",version:1}};return("string"===typeof e?e:"").trim().split(/(\s+|%[\w\-_.]+%)/).filter(Boolean).forEach(e=>{if("\n"===e)n.root.children[0].children.push({type:"linebreak",version:1});else if(e?.startsWith("%")&&e?.endsWith("%")){const s=t?.find(t=>t[a]===e.trim());n.root.children[0].children.push(s?{...r,data:{...s}}:{detail:0,format:0,mode:"normal",style:"",text:e,type:"text",version:1})}else n.root.children[0].children.push({detail:0,format:0,mode:"normal",style:"",text:e,type:"text",version:1})}),JSON.stringify(n)};function E(e,t=65){const a=e.split("/");let r=`${a.slice(0,3).join("/")} \u203a ${a.slice(3).filter(Boolean).join(" \u203a ")}`;return r.length>t&&(r=r.substring(0,t-3)+"..."),r}const w=e=>{const t=window.location.pathname;return Array.isArray(e)?e.some(e=>t.includes(e)):t.includes(e)},b=(e,t={})=>{if(!e)return;const{delay:a=1e3,retryDelay:r=200,maxRetries:n=5}=t,s=(t=0)=>{const l=document.getElementById(e);l?setTimeout(()=>{l.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},a):t<n&&setTimeout(()=>{s(t+1)},r)};window.requestAnimationFrame(()=>{s()})},v=(e,t)=>{try{return new URL(window.location.href).searchParams.get(e)===t}catch(a){return!1}},x=(e,t="yyyy-MM-dd")=>{try{if(!e||isNaN(new Date(e).getTime()))throw new Error((0,r.__)("Invalid Date","surerank"));return(0,n.GP)(new Date(e),t)}catch(a){return(0,r.__)("No Date","surerank")}},C=(e,t=!0)=>{if(isNaN(e))return{from:"",to:""};const a=t?(0,l.R)():(0,o.K)();let r=new Date(a);return r.setDate(a.getDate()-e),r=(0,s.o)(r),{from:r,to:a}},S=(e,t={})=>{const{decimals:a=1,forceDecimals:r=!1}=t;if("number"!==typeof e||isNaN(e))return"0";const n=e<0,s=Math.abs(e);if(s<1e3)return n?`-${s}`:s.toString();const l=[{value:1e3,suffix:"k"},{value:1e6,suffix:"m"},{value:1e9,suffix:"b"},{value:1e12,suffix:"t"},{value:1e15,suffix:"p"},{value:1e18,suffix:"e"},{value:1e21,suffix:"z"},{value:1e24,suffix:"y"},{value:1e27,suffix:"r"},{value:1e30,suffix:"q"}],o=l.find(({value:e})=>s<1e3*e)||l[l.length-1],i=(s/o.value).toFixed(a);return`${n?"-":""}${r?i:i.replace(/\.?0+$/,"")}${o.suffix}`},N=e=>{const t=new Date(e);return new Date(t.getTime()-6e4*t.getTimezoneOffset()).toISOString()},A=(e,t,a,n="MMM dd, yyyy")=>{if(!e)return"";const s=new Date(e),l=t?new Date(t):null,o=a?new Date(a):null;return isNaN(s.getTime())?(0,r.__)("Invalid Date","surerank"):l&&o?l.getMonth()===o.getMonth()&&l.getFullYear()===o.getFullYear()?x(s,"dd"):l.getFullYear()===o.getFullYear()?x(s,"MMM dd"):x(s,n):x(s,n)},T=e=>{let t,a="pending";const r=e.then(e=>{a="success",t=e},e=>{a="error",t=e});return{read(){if("pending"===a)throw r;if("error"===a)throw t;if("success"===a)return t}}},P=e=>{var t;return e&&"string"===typeof e&&null!==(t=(new DOMParser).parseFromString(e,"text/html").documentElement.textContent)&&void 0!==t?t:e},L=e=>{try{return/^(https?:\/\/)?((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|localhost|\d{1,3}(\.\d{1,3}){3})(:\d+)?(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(\#[-a-z\d_]*)?(\s.*)?$/i.test(e)}catch(t){return!1}},z=e=>e?Object.entries(e).map(([e,t])=>{const a=e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return{...t,id:e,title:t?.message||a,data:t?.description,showImages:"image_alt_text"===e}}):[],D=(e,t=[])=>e.filter(Boolean).reduce((e,a)=>(t.includes(a.id)?(a.ignore=!0,e.ignoredChecks.push(a)):(a.ignore=!1,"error"===a.status?e.badChecks.push(a):"warning"===a.status?e.fairChecks.push(a):"suggestion"===a.status?e.suggestionChecks.push(a):"success"===a.status&&e.passedChecks.push(a)),e),{badChecks:[],fairChecks:[],suggestionChecks:[],passedChecks:[],ignoredChecks:[]}),I=(e,t)=>"error"===e?(0,r.sprintf)("%1$s %2$s",t,(0,r._n)("Issue","Issues",t,"surerank")):"warning"===e?(0,r.sprintf)("%1$s %2$s",t,(0,r._n)("Warning","Warnings",t,"surerank")):(0,r.__)("SEO is Optimized","surerank"),M=e=>{switch(e){case"error":return"bg-support-error";case"warning":return"bg-support-warning";case"suggestion":return"bg-support-info";case"success":return"bg-support-success";default:return"bg-background-secondary"}},O=e=>e>0?(0,r.sprintf)((0,r.__)("%1$d %2$s need attention.","surerank"),e,(0,r._n)("issue","issues",e,"surerank")):(0,r.__)("All SEO checks passed.","surerank"),F=(e,t="")=>{try{const a=new URL(e,window.location.origin).searchParams;return t?a.get(t)||"":Object.fromEntries(a.entries())}catch(a){return t?"":{}}},R=(e,t)=>{try{const a=new URL(e,window.location.origin),r=a.searchParams;return Array.isArray(t)?t.forEach(e=>r.delete(e)):r.delete(t),a.toString()}catch(a){return e}},j=(e,t)=>(e&&"object"===typeof e&&Object.keys(e).forEach(a=>{e[a]&&"object"===typeof e[a]&&(e[a].category=t)}),e),$=(e,t,a)=>{const r=[];return d.Tv.forEach(n=>{if(n===t)r.push(...a);else{const t=H(n).type;r.push(...e.pageSeoChecks?.[t]||[])}}),r},H=e=>({type:`${e}Checks`,categorizedType:`categorized${e.charAt(0).toUpperCase()+e.slice(1)}Checks`}),U=e=>{let t=null!==e&&void 0!==e?e:"";return t.includes("sc-domain:")&&(t=t.replace(/sc-domain:/,"")),t.includes("https://")||t.includes("http://")||(t=`https://${t}`),t},B=e=>{let t="";switch(e.percentageType){case"danger":t="text-support-error [&>*]:text-support-error";break;case"success":t="text-support-success [&>*]:text-support-success";break;default:t=""}let a="";return null===e.value&&null===e.previous&&(a="text-text-tertiary [&>*]:text-text-tertiary"),{differenceClassName:t,fallbackClassName:a}},V=e=>({renderValue:null===e.value&&null===e.previous?"N/A":S(e.value),renderDifference:null===e.value&&null===e.previous?"N/A":S(Math.abs(e?.value-e?.previous))})},10960:(e,t,a)=>{a.d(t,{A:()=>c});var r=a(51609),n=a(30732),s=a(418),l=a(45773),o=a(97213),i=a(9607);const c=({title:e="",message:t="",showIcon:a=!1,className:c="",color:u="success",footer:d=null,renderIcon:m=null,action:p=null,...g})=>{const h={success:"text-support-success",error:"text-support-error",warning:"text-support-warning",info:"text-support-info"}[u]||"text-support-success",f={success:l.A,error:s.A,warning:s.A,info:o.A}[u]||l.A;return(0,r.createElement)("div",{className:(0,i.cn)("flex flex-row self-stretch gap-2 p-3 border border-solid rounded-lg",{success:"border-alert-border-green",error:"border-alert-border-danger",warning:"border-alert-border-warning",info:"border-alert-border-info"}[u]||"border-alert-border-green",{success:"bg-alert-background-green",error:"bg-alert-background-danger",warning:"bg-alert-background-warning",info:"bg-alert-background-info"}[u]||"bg-alert-background-green",c),role:"alert",...g},!!m&&m,a&&!m&&(0,r.createElement)(f,{className:(0,i.cn)(h,"shrink-0"),size:20}),(0,r.createElement)("div",{className:"flex flex-col gap-3 pl-1 pr-5 py-0 flex-1"},(0,r.createElement)("div",{className:"flex flex-col justify-center self-stretch gap-0.5"},e&&(0,r.createElement)(n.E,{size:14,weight:600,color:"primary",className:"leading-[1.43]"},e),t&&(0,r.createElement)(n.E,{size:14,weight:400,color:"primary",className:"self-stretch"},t)),d),p)}},11936:(e,t,a)=>{a.d(t,{R:()=>n});var r=a(27723);const n=e=>{if(!e||"object"!==typeof e)return(0,r.__)("SureRank Meta Box","surerank");const t="number"===typeof e.error?e.error:0,a="number"===typeof e.warning?e.warning:0;return t>0?(0,r.sprintf)((0,r._n)("%s Issue Detected","%s Issues Detected",t,"surerank"),t):a>0?(0,r.sprintf)((0,r._n)("%s Warning Detected","%s Warnings Detected",a,"surerank"),a):(0,r.__)("SureRank Meta Box","surerank")}},15345:(e,t,a)=>{a.d(t,{M:()=>ve});var r={};a.r(r),a.d(r,{fetchFromAPI:()=>$,ignorePageSeoCheck:()=>U,ignoreSeoBarCheck:()=>K,initMetaDataAndDefaults:()=>z,resetUnsavedMetaSettings:()=>F,restoreIgnoreCheck:()=>H,restorePageSeoCheck:()=>B,restoreSeoBarCheck:()=>Y,setBatchPageSeoChecks:()=>q,setCurrentPostIgnoredList:()=>j,setPageSeoCheck:()=>M,setPageSeoChecks:()=>I,setPageSeoChecksByIdAndType:()=>V,setRefreshCalled:()=>R,setUnsavedMetaSettings:()=>O,updateAppSettings:()=>D,updateGlobalDefaults:()=>L,updateInitialState:()=>P,updateMetaboxState:()=>S,updateModalState:()=>N,updatePostDynamicData:()=>A,updatePostMetaData:()=>T,updatePostSeoMeta:()=>C});var n={};a.r(n),a.d(n,{getAppSettings:()=>re,getCurrentPostIgnoredList:()=>le,getGlobalDefaults:()=>ae,getMetaboxState:()=>X,getModalState:()=>ee,getPageSeoChecks:()=>oe,getPostDynamicData:()=>te,getPostSeoMeta:()=>Z,getRefreshCalled:()=>se,getSeoBarChecks:()=>ie,getState:()=>Q,getUnsavedMetaSettings:()=>ne,getVariables:()=>J});var s={};a.r(s),a.d(s,{fetchSeoBarChecks:()=>Ee,getCurrentPostIgnoredList:()=>_e,getSeoBarChecks:()=>ye});var l=a(47143),o=a(52619);const i="FETCH_FROM_API",c="UPDATE_META_DATA",u="UPDATE_GLOBAL_DEFAULTS",d="UPDATE_APP_SETTINGS",m="SET_PAGE_SEO_CHECKS",p="SET_PAGE_SEO_CHECK",g="SET_UNSAVED_META_SETTINGS",h="RESET_UNSAVED_META_SETTINGS",f="SET_REFRESH_CALLED",k="SET_CURRENT_POST_IGNORED_LIST",_="SET_PAGE_SEO_CHECKS_BY_ID_AND_TYPE",y="SET_BATCH_PAGE_SEO_CHECKS",E={modalEnabled:!1,metaboxInitialized:!1,postSeoMeta:{page_title:"",page_description:"",post_no_index:"",post_no_follow:"",post_no_archive:"",facebook_image_url:"",facebook_title:"",facebook_description:"",facebook_image_id:"",twitter_image_url:"",twitter_title:"",twitter_description:"",twitter_image_id:"",twitter_same_as_facebook:!0,focus_keyword:"",canonical_url:""},unsavedPostSeoMeta:{},postDynamicData:{title:"",excerpt:"",content:""},research:{},globalDefaults:{},appSettings:{currentTab:"optimize",previousTab:"",currentScreen:"settings",previousScreen:"",generateContentProcess:"idle",generatedContents:{},selectedCheckId:null,selectedFieldKey:null,error:null,fixProcess:"idle",onUseThis:null},pageSeoChecks:{authenticated:window?.surerank_globals?.ai_authenticated||!1,initializing:!0,isCheckingLinks:!1,linkCheckProgress:{current:0,total:0},refreshCalled:!1,postId:null,checkType:null,isRefreshing:!1,pageChecks:[],keywordChecks:[],brokenLinkState:{isChecking:!1,checkedLinks:[],brokenLinks:[],allLinks:[]},hideFixHelpButtons:!1}};var w=a(66087),b=a(1671),v=a(9607),x=a(76016);function C(e){return{type:"UPDATE_POST_SEO_META",value:e}}function S(e){return{type:"UPDATE_METABOX_STATE",value:e}}function N(e){return{type:"UPDATE_MODAL_STATE",value:e}}function A(e){return{type:"UPDATE_DYNAMIC_DATA",value:e}}function*T(e){return yield O(e),{type:c,value:e}}function P(e){return{type:"UPDATE_INITIAL_STATE",value:e}}const L=e=>({type:u,payload:e});function*z({postSeoMeta:e,globalDefaults:t}){let a=e;return a&&!Object.keys(a).length?(a=(0,l.select)(b.E).getPostSeoMeta(),a=(0,w.pick)(t,Object.keys(a)),yield T(a)):yield C(a),L(t)}function D(e){return{type:d,value:e}}const I=e=>({type:m,payload:e}),M=(e,t)=>{let a={[e]:t};if("checks"===e){const e=(0,l.select)(b.E).getState();a={checks:t,categorizedChecks:(0,v.xZ)(t,e.pageSeoChecks?.ignoredList||[])}}else if(x.Tv.includes(e)){const r=(0,l.select)(b.E).getState(),n=r.pageSeoChecks?.ignoredList||[],s=(0,v.RL)(r,e,t)?.filter(Boolean)||[],o=(0,v.xZ)(s,n),i=(0,v.xZ)(t,n),c=(0,v.sz)(e);a={[c.type]:t,checks:s,categorizedChecks:o,[c.categorizedType]:i}}return{type:p,payload:a}},O=e=>({type:g,payload:e}),F=()=>({type:h}),R=e=>({type:f,value:e}),j=e=>({type:k,payload:e});function $(e){return{type:i,payload:e}}function*H(e,t){const a=(0,l.select)(b.E).getState(),r=a.pageSeoChecks?.postId||a.variables?.post?.ID?.value||a.variables?.term?.ID?.value,n="1"===window?.surerank_seo_popup?.is_taxonomy?"taxonomy":"post";try{const a=yield $({path:"surerank/v1/checks/ignore-page-check",method:"ignore"===t?"POST":"DELETE",data:{post_id:r,id:e,check_type:n}});yield j(a?.checks);const s=(0,l.select)(b.E).getPageSeoChecks(),o=s.checks.find(t=>t.id===e)?.type,i=(0,v.sz)(o)?.type||"checks";yield M(o,s[i])}catch(s){}}function*U(e){yield H(e,"ignore")}function*B(e){yield H(e,"restore")}const V=(e,t,a,r=null)=>{const{categorizedChecks:n,sequence:s}=G(a);return{type:_,payload:{postId:e,postType:t,checks:n,sequence:s,error:r}}},q=(e,t="post")=>{const a={};return Object.entries(e).forEach(([e,r])=>{const n=Object.entries(r.checks||{}).map(([e,t])=>({...t,id:e,title:t?.message||e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),data:t?.description,showImages:"image_alt_text"===e})),{categorizedChecks:s,sequence:l}=G(n);a[e]={postType:t,checks:s,sequence:l,error:null}}),{type:y,payload:a}},G=e=>{const t=[];return{categorizedChecks:e.reduce((e,a)=>(t.push(a.id),a?.ignore?e.ignoredChecks.push(a):(a.ignore=!1,"error"===a.status?e.badChecks.push(a):"warning"===a.status?e.fairChecks.push(a):"suggestion"===a.status?e.suggestionChecks.push(a):"success"===a.status&&e.passedChecks.push(a)),e),{badChecks:[],fairChecks:[],suggestionChecks:[],passedChecks:[],ignoredChecks:[]}),sequence:t}};function*W(e,t,a,r,n){try{const s=yield $({path:"surerank/v1/checks/ignore-page-check",method:r,data:{post_id:t,id:e,check_type:a}});if("success"!==s?.status)throw new Error(s?.message);const{checks:o,sequence:i}=(0,l.select)(b.E).getSeoBarChecks(t,a),c=Object.values(o).flat().map(t=>(t.id===e&&(t.ignore=n),t)).sort((e,t)=>i.indexOf(e.id)-i.indexOf(t.id));yield V(t,a,c)}catch(s){}}function*K(e,t,a){yield W(e,t,a,"POST",!0)}function*Y(e,t,a){yield W(e,t,a,"DELETE",!1)}function Z(e){return e.postSeoMeta}function J(e){return e.variables}function X(e){return e.metaboxInitialized}function Q(e){return e}function ee(e){return e.modalEnabled}function te(e){const t=e.postDynamicData;return e?.variables?.post?.title?.value&&!t?.title&&(t.title=e.variables.post.title.value),e?.variables?.post?.content?.value&&!t?.content&&(t.content=(0,v.XY)(e.variables.post.content.value)),e?.variables?.post?.excerpt?.value&&!t?.excerpt&&(t.excerpt=e.variables.post.excerpt.value),t}const ae=e=>e.globalDefaults,re=e=>e.appSettings,ne=e=>e.unsavedPostSeoMeta,se=e=>e.pageSeoChecks.refreshCalled,le=e=>{var t;return(null!==(t=e.pageSeoChecks?.postId)&&void 0!==t?t:e?.variables?.post?.ID?.value)&&e.pageSeoChecks.ignoredList||[]},oe=e=>e.pageSeoChecks,ie=(e,t,a)=>t&&a?{checks:e.pageSeoChecks[t]?.checks||{},sequence:e.pageSeoChecks[t]?.sequence||[],error:e.pageSeoChecks[t]?.error||null}:{};var ce=a(1455),ue=a.n(ce),de=a(93832),me=a(62220);const pe={FETCH_FROM_API:e=>ue()(e.payload)};var ge,he,fe=a(27723),ke=a(60443);function*_e(){const e=yield(0,l.select)(b.E).getState(),t=e.pageSeoChecks?.postId||e.variables?.post?.ID?.value||e.variables?.term?.ID?.value||window?.surerank_seo_popup?.post_id||window?.surerank_seo_popup?.term_id||window?.surerank_globals?.post_id||window?.surerank_globals?.term_id,a=e.pageSeoChecks?.checkType||("1"===window?.surerank_seo_popup?.is_taxonomy?"taxonomy":"post");if(!t||!a)return[];const r=e.pageSeoChecks?.ignoredList;if(r?.length>0)return r;try{const e=yield $({path:(0,de.addQueryArgs)("surerank/v1/checks/ignore-page-check",{post_id:t,check_type:a}),method:"GET"});yield j(e?.checks||[])}catch(n){yield j([])}}function*ye(e,t,a=null){if(!e||!t)return{};const r=Array.isArray(e)?e:[e],n=(0,l.select)(b.E).getState();let s=r;if(a||(s=r.filter(e=>{const t=n.pageSeoChecks?.[e]?.checks;return!t})),0!==s.length)try{yield Ee(s,t,a)}catch(o){const a=o?.message||(0,fe.__)("Error loading SEO checks","surerank");Array.isArray(e)||(yield V(e,t,[],a))}}function*Ee(e,t,a=!1){if(!e||!e.length)return;const r="taxonomy"===t,n=r?"/surerank/v1/checks/taxonomy":"/surerank/v1/checks/page",s=r?"term_ids":"post_ids",l=a?`&_t=${a}`:"";try{const a=yield $({path:(0,de.addQueryArgs)(n,{[s]:e})+l,method:"GET"});if("success"!==a?.status||!a?.data)throw a;yield q(a.data,t)}catch(o){(0,ke.o)({message:o?.message||(0,fe.__)("Error loading SEO checks","surerank"),type:"error"})}}const we=null!==(ge=(0,o.applyFilters)("surerank-pro.seo-metabox-actions",r))&&void 0!==ge?ge:r,be=null!==(he=(0,o.applyFilters)("surerank-pro.seo-metabox-selectors",n))&&void 0!==he?he:n,ve=(0,l.createReduxStore)(b.E,{reducer:function(e=E,t){switch(t.type){case"UPDATE_MODAL_STATE":return{...e,modalEnabled:t.value,appSettings:{...e.appSettings,currentScreen:E.appSettings.currentScreen,previousScreen:e.appSettings.currentScreen}};case"UPDATE_INITIAL_STATE":return{...e,...t.value};case"UPDATE_METABOX_STATE":return{...e,metaboxInitialized:t.value};case"UPDATE_POST_SEO_META":case"UPDATE_META_DATA":if("object"!==typeof t.value)throw new Error("Value should be an object");return{...e,postSeoMeta:{...e.postSeoMeta,...t.value}};case"UPDATE_DYNAMIC_DATA":return{...e,postDynamicData:{...e.postDynamicData,...t.value}};case u:return{...e,globalDefaults:t.payload};case d:return{...e,appSettings:{...e.appSettings,...t.value}};case m:case p:return{...e,pageSeoChecks:{...e.pageSeoChecks,...t.payload}};case g:return{...e,unsavedPostSeoMeta:{...e.unsavedPostSeoMeta,...t.payload}};case h:return{...e,unsavedPostSeoMeta:{}};case f:return{...e,pageSeoChecks:{...e.pageSeoChecks,refreshCalled:t.value}};case k:return{...e,pageSeoChecks:{...e.pageSeoChecks,ignoredList:t.payload}};case _:return{...e,pageSeoChecks:{...e.pageSeoChecks,[t.payload.postId]:{checks:{...e.pageSeoChecks[t.payload.postId]?.checks,...t.payload.checks},sequence:t.payload.sequence,error:t.payload.error}}};case y:return{...e,pageSeoChecks:{...e.pageSeoChecks,...t.payload}};default:return(0,o.applyFilters)("surerank-pro.seo-metabox-store",e,t)||e}},actions:we,selectors:be,controls:pe,resolvers:s});(0,l.register)(ve),(()=>{const e={};window?.surerank_globals?.post_id&&(e.post_id=window?.surerank_globals.post_id),window?.surerank_globals?.term_id&&(e.term_id=window?.surerank_globals.term_id),window?.surerank_seo_popup?.post_id&&(e.post_id=window?.surerank_seo_popup.post_id),window?.surerank_seo_popup?.term_id&&(e.term_id=window?.surerank_seo_popup.term_id),(e?.post_id||e?.term_id)&&ue()({path:(0,de.addQueryArgs)(me.uX,e)}).then(e=>{if(e?.success){let t={variables:e.variables};e.other&&(t={...t,...e.other}),(0,l.dispatch)(ve).updateInitialState(t)}})})()},18947:(e,t,a)=>{a.d(t,{SZ:()=>c,_e:()=>d,aS:()=>i,bY:()=>s,cd:()=>u,jU:()=>o});var r=a(27723),n=a(76016);const s=({id:e,title:t,status:a,description:r,data:n,showImages:s,type:l="page"})=>({id:e,title:t,status:a,description:r,data:n,showImages:s,type:l}),l=async()=>{if(window?.tinymce?.editors?.length)return document.querySelector("#set-post-thumbnail>img");const e=window?.wp?.data?.select("core/editor");if(e&&"function"===typeof e.getEditedPostContent){const r=e.getEditedPostAttribute("featured_media");if(r){var t,a;const e=await new Promise(e=>{const t=wp.media.attachment(r);"function"===typeof t.fetch&&t.fetch().then(t=>e(t)).catch(()=>{e({})})});return{alt:null!==(t=e?.alt)&&void 0!==t?t:"",src:null!==(a=e?.url)&&void 0!==a?a:""}}}},o=async e=>{let t=[];const a=await l();if(a&&t.push(a),t=[...t,...Array.from(e.querySelectorAll("img"))?.filter(e=>e?.src)],0===t.length)return;const n=t.filter(Boolean).filter(e=>!e?.alt?.trim());if(0===n.length)return s({id:"image_alt_text",title:(0,r.__)("All images on this page have alt text attributes.","surerank"),status:"success",type:"page"});const o=window?.surerank_seo_popup?.image_seo,i=(0,r.__)("One or more images are missing alt text attributes.","surerank");let c=`${i} ${(0,r.__)("You can add them manually or turn on auto-set image title and alt in the settings.","surerank")}`;return o&&(c=`${i} ${(0,r.__)("But don't worry, we will add them automatically for you.","surerank")}`),s({id:"image_alt_text",title:c,status:"suggestion",data:Array.from(new Set(n.map(e=>e.src))),showImages:!0,type:"page"})},i=async e=>{const t=!!await l(),a=e.querySelectorAll("img, figure img, figure picture, figure.is-type-photo").length>0||t,n=e.querySelectorAll("video, figure.is-type-video").length>0;return s(a||n?!a&&n?{id:"media_present",title:(0,r.__)("This page includes video(s) but no images.","surerank"),status:"warning",type:"page"}:{id:"media_present",title:(0,r.__)("This page includes images or videos to enhance content.","surerank"),status:"success",type:"page"}:{id:"media_present",title:(0,r.__)("No images or videos found on this page.","surerank"),status:"warning",type:"page"})},c=e=>{const t=Array.from(e.querySelectorAll("a[href]"));return 0===t.length?s({id:"links_present",title:(0,r.__)("No links found on this page.","surerank"),status:"warning",type:"page"}):t.length>0?s({id:"links_present",title:(0,r.__)("Links are present on this page.","surerank"),status:"success",type:"page"}):void 0},u=e=>{const t=e.length,a=(0,r.sprintf)((0,r.__)("Page URL is longer than %s characters and may affect SEO and readability.","surerank"),n.X);return s(t>n.X?{id:"url_length",title:a,status:"warning",type:"page"}:{id:"url_length",title:(0,r.__)("Page URL is short and SEO-friendly.","surerank"),status:"success",type:"page"})},d=e=>{const t=Array.from(e.querySelectorAll("h2, h3, h4, h5, h6"));return s(t.length?{id:"h2_subheadings",title:(0,r.__)("Page contains at least one subheading.","surerank"),status:"success",type:"page"}:{id:"h2_subheadings",title:(0,r.__)("Page does not contain at least one subheading.","surerank"),status:"warning",type:"page"})}},22157:(e,t,a)=>{a.d(t,{A:()=>l});var r=a(51609),n=a(27723),s=a(10960);const l=({className:e="",...t})=>(0,r.createElement)(s.A,{color:"info",title:(0,n.__)("SureRank Schema Disabled","surerank"),message:(0,n.__)("We detected that WP Schema Pro is active on your website. To avoid schema conflicts, SureRank Schema functionality has been automatically disabled. Please continue using WP Schema Pro for your schema markup needs.","surerank"),className:e,...t})},22861:(e,t,a)=>{a.d(t,{A:()=>c});var r=a(51609),n=a(88029),s=a(27723),l=a(33167),o=a(9607),i=a(72956);const c=({label:e=(0,s.__)("Upgrade Now","surerank"),variant:t="primary",size:a="md",icon:c,iconPosition:u="right",showIcon:d,onClick:m,className:p="",showUnderline:g=!1,utmMedium:h,...f})=>{let k;k=void 0!==c?c:(void 0!==d?d:"link"===t)?(0,r.createElement)(l.A,{className:"w-5 h-5"}):void 0;const{showUnderLine:_,...y}=f;return(0,r.createElement)(n.A,{size:a,variant:t,onClick:()=>{m&&"function"===typeof m?m():(0,i.n$)(h)},className:(0,o.cn)("no-underline ring-0",{"underline ring-0":g},p),icon:k,iconPosition:u,...y},e)}},22895:(e,t,a)=>{a.d(t,{A:()=>h});var r=a(51609),n=a(88029),s=a(43953),l=a(45350),o=a(85173),i=a(30732),c=a(80697),u=a(48697),d=a(27723),m=a(86087),p=a(72956),g=a(22861);const h=({selectedSchema:e,setSelectedSchema:t,selectedType:a,setSelectedType:h,schemaTypeOptions:f,defaultSchemas:k,handleAddSchema:_})=>{const y=(0,p.qP)()?k:[...k,{title:["ClaimReview","Book","Course","Dataset","Event","FAQPage","HowTo","JobPosting","Movie","Service","PodcastEpisode","Recipe","VideoObject","SoftwareApplication"].join(" "),isPro:!0,isProUpgradeNudge:!0}];return(0,m.useEffect)(()=>{""===a&&h(e)},[e,a,h]),(0,r.createElement)(o.Ay,{trigger:(0,r.createElement)(n.A,{icon:(0,r.createElement)(c.A,{"aria-label":"icon",role:"img"}),iconPosition:"left",size:"md",variant:"outline"},(0,d.__)("Add Schema","surerank"))},(0,r.createElement)(o.Ay.Panel,{className:"gap-2 p-3"},({close:c})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(o.Ay.Header,{className:"p-2"},(0,r.createElement)("div",{className:"flex items-center justify-between"},(0,r.createElement)(o.Ay.Title,null,(0,d.__)("Add Schema","surerank")),(0,r.createElement)(n.A,{className:"text-text-secondary [&_svg]:text-text-secondary [&_svg]:size-4 p-0",variant:"ghost",onClick:c,icon:(0,r.createElement)(u.A,{"aria-label":"icon",role:"img"})}))),(0,r.createElement)(o.Ay.Body,{className:"p-2"},(0,r.createElement)(l.mc,{align:"start",containerType:"flex",direction:"column",gap:"xs",justify:"start"},(0,r.createElement)(l.mc.Item,{className:"w-full pb-1"},(0,r.createElement)("label",{className:"text-base block font-medium text-field-label"},(0,d.__)("Choose Schema","surerank"))),(0,r.createElement)(l.mc.Item,{className:"w-full"},(0,r.createElement)(s.Ay,{combobox:!0,size:"md",value:e,onChange:e=>{t(e);const a=f[e]&&Object.keys(f[e]).length;h(a?"":e)}},(0,r.createElement)(s.Ay.Button,null),(0,r.createElement)(s.Ay.Options,null,y.map((e,t)=>e.isPro?(0,r.createElement)("div",{key:t,className:"px-2 py-1.5 cursor-default",role:"presentation"},(0,r.createElement)("div",{className:"flex items-center justify-between gap-2 p-3 bg-brand-background-50 rounded-lg"},(0,r.createElement)("div",{className:"flex-1"},(0,r.createElement)(i.E,{size:14,lineHeight:20,color:"secondary",weight:500},(0,d.__)("Looking for more schemas?","surerank"))),(0,r.createElement)(g.A,{label:(0,d.__)("Upgrade now","surerank"),variant:"link",size:"md",showIcon:!0,className:"ml-2",utmMedium:"schema_dropdown"})),(0,r.createElement)("span",{className:"sr-only"},e.title)):(0,r.createElement)(s.Ay.Option,{key:t,value:e.title},e.title)))))),e&&f[e]&&(0,r.createElement)("div",{className:"flex flex-col mt-3 gap-1.5"},(0,r.createElement)("label",{className:"text-base block font-medium text-field-label"},(0,d.__)("Schema Type","surerank")),(0,r.createElement)(s.Ay,{combobox:!0,size:"md",value:a||e,onChange:e=>h(e)},(0,r.createElement)(s.Ay.Button,{render:e=>e,type:"button"}),(0,r.createElement)(s.Ay.Options,null,(()=>{const t=f[e];return Object.values(t).every(e=>e.label&&e.options)?Object.values(t).map((e,t)=>(0,r.createElement)(s.Ay.OptionGroup,{key:t,label:e.label},Object.entries(e.options).map(([e])=>(0,r.createElement)(s.Ay.Option,{key:e,value:e},e)))):Object.entries(t||{}).map(([e,t])=>(0,r.createElement)(s.Ay.Option,{key:e,value:e},t))})())))),(0,r.createElement)(o.Ay.Footer,{className:"p-2"},(0,r.createElement)(n.A,{variant:"outline",onClick:c},(0,d.__)("Cancel","surerank")),(0,r.createElement)(n.A,{variant:"primary",onClick:()=>{_(),c()},disabled:!e},(0,d.__)("Add Schema","surerank"))),(0,r.createElement)(o.Ay.Backdrop,{className:"bg-misc-overlay"}))))}},23551:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(51609),n=a(29767),s=a(27723);const l=()=>(0,r.createElement)("div",{className:"relative flex flex-col gap-3 p-3 bg-background-primary rounded-lg shadow-sm border-0.5 border-solid border-border-subtle"},(0,r.createElement)("div",{className:"w-full flex items-start gap-2"},(0,r.createElement)(n.A,{variant:"rectangular",className:"h-6 w-16 rounded-full"}),(0,r.createElement)("div",{className:"flex-1"},(0,r.createElement)(n.A,{variant:"rectangular",className:"h-5 w-48"})),(0,r.createElement)(n.A,{variant:"rectangular",className:"h-6 w-20 rounded"})),(0,r.createElement)("div",{className:"ml-3 space-y-1"},(0,r.createElement)(n.A,{variant:"rectangular",className:"h-4 w-full"}),(0,r.createElement)(n.A,{variant:"rectangular",className:"h-4 w-3/4"}))),o=()=>(0,r.createElement)("div",{className:"p-2 overflow-y-auto",role:"status","aria-live":"polite","aria-busy":"true"},(0,r.createElement)("span",{className:"sr-only"},(0,s.__)("Loading page SEO checks\u2026","surerank")),(0,r.createElement)("div",{className:"space-y-3"},Array.from({length:4}).map((e,t)=>(0,r.createElement)(l,{key:`check-skeleton-${t}`}))))},27165:(e,t,a)=>{a.d(t,{E:()=>r});const r="surerank-admin"},27723:e=>{e.exports=window.wp.i18n},28177:(e,t,a)=>{a.d(t,{$4:()=>x,FQ:()=>N,OH:()=>C,Yi:()=>S,hx:()=>v});var r=a(51609),n=a(27723),s=a(88029),l=a(62163),o=a(71087),i=a(43953),c=a(65650),u=a(24345),d=a(30732),m=a(9607),p=a(32307),g=a(97213),h=a(80697),f=a(1839),k=a(98583),_=a(94879),y=a(86087);const E=["url","logo"],w={wordBreak:"break-all"},b=({field:e,currentValue:t,onFieldChange:a,placeholder:l,variableSuggestions:o})=>{const[i,d]=(0,y.useState)(!1),[g,h]=(0,y.useState)(0),f=(0,y.useRef)(null);return(0,y.useEffect)(()=>{function e(e){i&&f.current&&!f.current.contains(e.target)&&d(!1)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[i]),(0,r.createElement)("div",{ref:f,className:"w-full relative"},(0,r.createElement)("div",{className:"flex items-center gap-2 w-full"},(0,r.createElement)(c.A,{key:`${e.id}-${g}`,by:"label",trigger:"@",options:o,placeholder:l,defaultValue:(0,m.pk)(!t||t.startsWith("%")||t.includes("@")?t:(e=>{if(!e)return"";try{const t=new Date(e);return isNaN(t.getTime())?"":t.toLocaleDateString()+" "+t.toLocaleTimeString()}catch(t){return""}})(t),o),onChange:t=>a(e.id,(0,m.P3)(t,o)),"aria-label":e.label,className:"flex-grow max-w-full",size:"md",style:E.includes(e.id)?w:{}}),(0,r.createElement)(s.A,{variant:"ghost",size:"md",onClick:()=>d(e=>!e),className:"flex-shrink-0","aria-label":(0,n.__)("Open date picker","surerank"),icon:(0,r.createElement)(p.A,{strokeWidth:1.5,className:"text-icon-secondary"})})),i&&(0,r.createElement)("div",{className:"absolute z-10 mb-2 rounded-lg shadow-lg right-0 bg-background-primary bottom-full"},(0,r.createElement)(u.A,{applyButtonText:(0,n.__)("Apply","surerank"),cancelButtonText:(0,n.__)("Cancel","surerank"),selectionType:"single",showOutsideDays:!1,variant:"normal",onApply:t=>{a(e.id,(e=>{if(!e)return"";try{const t=new Date(e);return isNaN(t.getTime())?"":t.toISOString()}catch(t){return""}})(t)),d(!1),h(e=>e+1)},onCancel:()=>{d(!1)},selected:t&&!t.startsWith("%")?new Date(t):null})))},v=({field:e,schemaId:t,getFieldValue:a,onFieldChange:l,variableSuggestions:i,fieldItemIds:c,setFieldItemIds:u,renderHelpTextFunction:m=null})=>{let p=a(e.id)||[];if(Array.isArray(p)||(p="object"===typeof p&&null!==p?Object.values(p):[]),0===p.length){const t={};e.fields.forEach(e=>{if("Group"===e.type&&e.fields){const a={};e.fields.forEach(e=>{a[e.id]=e.std||""}),t[e.id]=a}else t[e.id]=e.std||""}),p=[t]}p=p.map(t=>{const a={...t};return e.fields.forEach(e=>{"Group"===e.type&&e.fields&&(a[e.id]&&"object"===typeof a[e.id]||(a[e.id]={}),e.fields.forEach(t=>{t.required&&void 0===a[e.id][t.id]&&(a[e.id][t.id]=t.std||"")}))}),a});const k=`${t}-${e.id}`;if(!c[k]||c[k].length!==p.length){const e=p.map((e,t)=>c[k]?.[t]||`item-${Date.now()}-${t}-${Math.random().toString(36).substr(2,9)}`);u(t=>({...t,[k]:e}))}const y=c[k]||[],E=p.map((e,t)=>({...e,_id:y[t]||`temp-${t}`})),w=(t,a,r)=>{const n=[...p];n[t]={...n[t],[a]:r},l(e.id,n)};return(0,r.createElement)(r.Fragment,null,E.map((t,a)=>(0,r.createElement)("div",{key:t._id,className:"border border-gray-200 rounded-lg mb-4 space-y-3"},(0,r.createElement)("div",{className:"flex items-center justify-between"},(0,r.createElement)(d.E,{size:14,lineHeight:20,weight:500,className:"text-text-primary"},e.cloneItemHeading?`${e.cloneItemHeading} ${a+1}`:`Item ${a+1}`),E.length>1&&(0,r.createElement)(s.A,{variant:"ghost",size:"sm",onClick:()=>(t=>{const a=p.filter((e,a)=>a!==t),r=y.filter((e,a)=>a!==t);u(e=>({...e,[k]:r})),l(e.id,a)})(a),icon:(0,r.createElement)(f.A,{strokeWidth:1.5,className:"text-icon-secondary"})})),e.fields.map(e=>e.hidden||"Hidden"===e.type?null:"Group"===e.type&&e.fields?(0,r.createElement)("div",{key:e.id,className:"space-y-2"},e.label&&(0,r.createElement)("div",{className:"flex items-center justify-start gap-1.5 w-full"},(0,r.createElement)(o.A,{tag:"span",size:"sm",className:"space-x-0.5",required:e.required},e.label),e.tooltip&&(0,r.createElement)(_.$w,{content:e.tooltip,placement:"top",arrow:!0,className:"z-[99999]"},(0,r.createElement)(g.A,{className:"size-4 text-icon-secondary",title:e.tooltip}))),e.fields.map(n=>n.hidden||"Hidden"===n.type?null:(0,r.createElement)("div",{key:n.id,className:"space-y-1.5"},(0,r.createElement)("div",{className:"flex items-center justify-start gap-1.5 w-full"},(0,r.createElement)(o.A,{tag:"span",size:"sm",className:"space-x-0.5",required:n.required},n.label),n.tooltip&&(0,r.createElement)(_.$w,{content:n.tooltip,placement:"top",arrow:!0,className:"z-[99999]"},(0,r.createElement)(g.A,{className:"size-4 text-icon-secondary",title:n.tooltip}))),(0,r.createElement)("div",{className:"flex items-center justify-start gap-1.5 w-full"},S({field:{...n,id:n.id},getFieldValue:()=>(t[e.id]||{})[n.id]||n.std||"",onFieldChange:(r,n)=>{const s={...t[e.id]||{},[r]:n};w(a,e.id,s)},variableSuggestions:i,renderAsGroupComponent:!1})),m&&m(n))),m&&m(e)):(0,r.createElement)("div",{key:e.id,className:"space-y-1.5"},(0,r.createElement)("div",{className:"flex items-center justify-start gap-1.5 w-full"},(0,r.createElement)(o.A,{tag:"span",size:"sm",className:"space-x-0.5",required:e.required},e.label),e.tooltip&&(0,r.createElement)(_.$w,{content:e.tooltip,placement:"top",arrow:!0,className:"z-[99999]"},(0,r.createElement)(g.A,{className:"size-4 text-icon-secondary",title:e.tooltip}))),(0,r.createElement)("div",{className:"flex items-center justify-start gap-1.5 w-full"},S({field:{...e,id:e.id},getFieldValue:()=>t[e.id]||e.std||"",onFieldChange:(e,t)=>w(a,e,t),variableSuggestions:i,renderAsGroupComponent:!1})),m&&m(e))))),(0,r.createElement)(s.A,{variant:"outline",className:"w-fit",size:"sm",onClick:()=>{const t={};e.fields.forEach(e=>{if("Group"===e.type&&e.fields){const a={};e.fields.forEach(e=>{a[e.id]=e.std||""}),t[e.id]=a}else t[e.id]=e.std||""});const a=[...p,t],r=`item-${Date.now()}-${p.length}-${Math.random().toString(36).substr(2,9)}`;u(e=>({...e,[k]:[...e[k]||[],r]})),l(e.id,a)},icon:(0,r.createElement)(h.A,null)},(0,n.__)("Add New","surerank")))},x=({field:e,schemaType:t,getFieldValue:a,onFieldChange:s,variableSuggestions:l})=>{if(!e.fields||0===e.fields.length)return null;const i=e.fields.find(e=>"@type"===e.id)?a("@type",e.id):null;return(0,r.createElement)("div",{className:"space-y-2 w-full border-l-2 border-gray-100 pt-2"},e.fields.map(c=>c.hidden||"Hidden"===c.type||c.main&&i&&c.main!==i?null:(0,r.createElement)("div",{key:c.id,className:"space-y-1.5"},(0,r.createElement)("div",{className:"flex items-center justify-start gap-1.5 w-full"},(0,r.createElement)(o.A,{tag:"span",size:"sm",className:"space-x-0.5",required:c.required},(0,r.createElement)("span",null,c.label)),c.tooltip&&(0,r.createElement)(_.$w,{content:c.tooltip,placement:"top",arrow:!0,className:"z-[99999]"},(0,r.createElement)(g.A,{className:"size-4 text-icon-secondary",title:c.tooltip}))),(0,r.createElement)("div",{className:"flex items-center justify-start gap-1.5 w-full"},S({field:c,schemaType:t,getFieldValue:t=>a(t,e.id),onFieldChange:(t,a)=>s(t,a,e.id),variableSuggestions:l,renderAsGroupComponent:!1})),"Select"!==c.type&&(0,r.createElement)(d.E,{size:14,weight:400,color:"help"},(0,n.__)("Type @ to view variable suggestions","surerank")))))},C=({field:e,getFieldValue:t,onFieldChange:a,variableSuggestions:l,placeholder:o=""})=>{const i=t(e.id)||{};return 0===Object.keys(i).length&&(i[(0,k.lk)(7)]=""),(0,r.createElement)("div",{className:"flex flex-col gap-2 w-full"},Object.entries(i).map(([t,n])=>(0,r.createElement)("div",{key:t,className:"flex items-center gap-1.5 w-full"},S({field:{...e,id:e.id},getFieldValue:()=>n||e.std||"",onFieldChange:(r,n)=>((t,r)=>{a(e.id,{...i,[t]:r})})(t,n),variableSuggestions:l,placeholder:o,renderAsGroupComponent:!1}),(0,r.createElement)(s.A,{variant:"ghost",size:"md",onClick:()=>{const r={...i};delete r[t],a(e.id,r)},icon:(0,r.createElement)(f.A,{strokeWidth:1.5,className:"text-icon-secondary"})}))),(0,r.createElement)(s.A,{variant:"outline",className:"w-fit",size:"sm",onClick:()=>{const t=(0,k.lk)(7),r={...i,[t]:""};a(e.id,r)},icon:(0,r.createElement)(h.A,null)},(0,n.__)("Add New","surerank")))};function S({field:e,getFieldValue:t,onFieldChange:a,variableSuggestions:s,placeholder:o="",renderAsGroupComponent:u=!1}){if(!e)return null;const d=t(e.id)||e.std||"";switch(e.type){case"Select":{const t=Array.isArray(e.options)?e.options.reduce((e,t)=>t.options?{...e,...t.options}:e,{}):e.options||{};return(0,r.createElement)("div",{key:e.id,className:"w-full"},(0,r.createElement)(i.Ay,{size:"md",value:d,onChange:t=>a(e.id,t)},(0,r.createElement)(i.Ay.Button,{render:e=>{const a=Object.entries(t).find(([t])=>t===e);return a?a[1]:e},placeholder:(0,n.__)("Select an option","surerank")}),(0,r.createElement)(i.Ay.Options,{className:"z-50"},Object.entries(t).map(([e,t])=>(0,r.createElement)(i.Ay.Option,{key:e,value:e},t)))))}case"MultiSelect":{const t=Array.isArray(e.options)?e.options.reduce((e,t)=>t.options?{...e,...t.options}:e,{}):e.options||{};let n=[];return n=Array.isArray(d)?d:d?[d]:[],(0,r.createElement)("div",{key:e.id,className:"w-full"},(0,r.createElement)(i.Ay,{size:"md",value:n,onChange:t=>a(e.id,t),multiple:!0},(0,r.createElement)(i.Ay.Button,null),(0,r.createElement)(i.Ay.Options,{className:"z-50"},Object.entries(t).map(([e,t])=>(0,r.createElement)(i.Ay.Option,{key:e,value:e},t)))))}case"Group":return u?(0,r.createElement)(x,{key:e.id,field:e,getFieldValue:t,onFieldChange:a,variableSuggestions:s}):e.fields?.length?(0,r.createElement)("div",{key:e.id,className:"space-y-2 w-full"},(0,r.createElement)("div",{className:"space-y-4 pl-4"},e.fields.map(e=>!e.hidden&&"Hidden"!==e.type&&(0,r.createElement)("div",{key:e.id,className:"flex items-center gap-4"})))):null;case"SelectGroup":{const t=Object.values(e?.options||{});return(0,r.createElement)("div",{key:e.id,className:"w-full"},(0,r.createElement)(i.Ay,{size:"md",value:d,onChange:t=>a(e.id,t),combobox:!0,placeholder:(0,n.__)("Search or select an option","surerank"),"aria-label":e.label},(0,r.createElement)(i.Ay.Button,{placeholder:(0,n.__)("Search or select an option","surerank"),render:e=>{for(const a of t){const t=Object.entries(a.options).find(([t])=>t===e);if(t)return t[1]}return e}}),(0,r.createElement)(i.Ay.Options,null,t.map((e,t)=>(0,r.createElement)(i.Ay.OptionGroup,{key:t,label:e.label},Object.entries(e.options).map(([e,t])=>(0,r.createElement)(i.Ay.Option,{key:e,value:e},t)))))))}case"DateTime":return(0,r.createElement)(b,{field:e,currentValue:d,onFieldChange:a,placeholder:o,variableSuggestions:s});case"Title":return(0,r.createElement)("div",{className:"w-full"},(0,r.createElement)(l.A,{key:e.id,by:"label",placeholder:o,defaultValue:d,"aria-label":e.label,className:"flex-grow max-w-full mdx",size:"md",type:"text",onChange:t=>{a(e.id,t)}}));default:return(0,r.createElement)(c.A,{key:e.id,by:"label",trigger:"@",options:s,placeholder:o,defaultValue:(0,m.pk)(d,s,"value"),onChange:t=>{a(e.id,(0,m.P3)(t.toJSON()))},className:"flex-grow",wrapperClassName:"[&>ul>li]:capitalize",...E.includes(e.id)&&{style:w}})}}function N(e){return"Group"===e?.type||"Select"===e?.type||"SelectGroup"===e?.type||"schema_name"===e?.id?null:(0,r.createElement)(d.E,{size:14,weight:400,color:"help"},(0,n.__)("Type @ to view variable suggestions","surerank"))}},37042:(e,t,a)=>{a.d(t,{A:()=>u});var r=a(51609),n=a(94879),s=a(88029),l=a(30732),o=a(27723),i=a(9607),c=a(72956);const u=({size:e="xs",tooltipProps:t,title:a=(0,o.__)("Fix SEO Issues with AI","surerank"),description:u=(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",null,(0,o.__)("Upgrade to SureRank Pro and let AI help you fix critical SEO issues and warnings, so your website stays fully optimized and ready to perform better in search results.","surerank")),(0,r.createElement)("br",null)),linkLabel:d=(0,o.__)("Upgrade Now","surerank"),iconPosition:m="left",icon:p,buttonLabel:g=(0,o.__)("Fix It for Me","surerank"),className:h,hidden:f=!0,locked:k=!0,onClick:_,runBeforeOnClick:y,runAfterOnClick:E,...w})=>{const b=(0,r.createElement)(s.A,{className:(0,i.cn)("w-fit",f&&"hidden",h),size:e,icon:p,iconPosition:m,...w,onClick:()=>{"function"!==typeof _||k||_()}},g);return k?(0,r.createElement)(n.$w,{arrow:!0,interactive:!0,placement:"top-end",...t,content:(0,r.createElement)("div",{className:"space-y-1"},(0,r.createElement)(l.E,{size:12,weight:600,color:"inverse"},a),(0,r.createElement)(l.E,{size:12,weight:400,color:"inverse",className:"leading-relaxed"},u),(0,r.createElement)("div",{className:"mt-1.5"},(0,r.createElement)(s.A,{size:"xs",variant:"link",className:"[&>span]:px-0 no-underline hover:no-underline focus:[box-shadow:none] text-link-visited-inverse hover:text-link-visited-inverse-hover",onClick:()=>(0,c.n$)("fix_it_button")},d)))},b):b}},38502:(e,t,a)=>{a.d(t,{A:()=>_});var r=a(51609),n=a(27723),s=a(59612),l=a(66803),o=a(56523),i=a(30732),c=a(9607),u=a(48697),d=a(88029),m=a(99019);const p=({variant:e="outline",size:t="xs",strokeWidth:a=2,icon:n=(0,r.createElement)(u.A,{strokeWidth:a,className:"h-4 w-4"}),onClick:s,className:l="absolute top-2 right-2 flex items-center p-1 h-8 w-8 rounded leading-[0]",disabled:o=!1,tooltip_label:i})=>{const c=(0,r.createElement)(d.A,{variant:e,size:t,className:l,onClick:s,disabled:o},n);return i?(0,r.createElement)(m.m,{placement:"top",offset:10,variant:"dark",title:i,tooltipPortalId:"surerank-root"},c):c};var g=a(86087);const h=e=>{const t=new Date,a=t.toLocaleString("default",{month:"long"}),r=t.getDate();return"twitter"===e?`${a?.slice(0,3)} ${r}`:`${a} ${r}`},f=({className:e,...t})=>(0,r.createElement)("div",{className:(0,c.cn)("w-full h-full bg-background-secondary flex items-center justify-center",e),...t},(0,r.createElement)(s.A,{className:"size-6 m-auto"})),k=({displayName:e="Name",username:t="@username",timeLabel:a="28m",postText:s="Sample Post Title",title:u=(0,n.__)("Modern WordPress SEO Plugin Without the Bloat - SureRank","surerank"),description:d="",imageURL:m="",siteURL:h="surerank.com",onClickRemove:k,hideRemoveButton:_=!0,forMetaBox:y=!1,cardType:E="summary_large_image"})=>{const w=(0,c.jT)(u),b=(0,c.jT)(d),v={id:"x-preview-large",className:"[#x-preview-large&_*]:font-twitter"},x=(0,r.createElement)(o.A,{className:"flex-shrink-0",size:y?"sm":"md",variant:"primary",src:"https://www.gravatar.com/avatar/?d=mp"},"User"),C=(0,r.createElement)("div",{className:"inline-flex items-center gap-1"},(0,r.createElement)(i.E,{as:"p",className:"m-0",size:16,weight:500,color:"secondary"},e),(0,r.createElement)(l.A,{className:"size-5 text-white fill-[#1d9bf0]","aria-label":(0,n.__)("Verified account","surerank")}),(0,r.createElement)(i.E,{as:"p",className:"m-0",size:16,weight:400,color:"secondary"},t," \xb7 ",a));if("summary_large_image"===E){const e=(0,n.sprintf)((0,n.__)("Check out my page: %s","surerank"),(0,g.renderToString)((0,r.createElement)(i.E,{className:"inline text-[#1d9bf0] m-0 hover:underline",as:"p"},h.startsWith("http")?h:`https://${h}`)));return(0,r.createElement)("div",{...v},(0,r.createElement)("div",{className:"p-3 flex items-start gap-3"},x,(0,r.createElement)("div",{className:"flex-1"},C,s?(0,r.createElement)(i.E,{as:"p",className:"mt-0.5 mb-0 line-clamp-2",size:14,color:"secondary"},s):(0,r.createElement)(i.E,{as:"p",color:"secondary",size:14,className:"mt-0.5 mb-0 line-clamp-2",dangerouslySetInnerHTML:{__html:e}}),(0,r.createElement)("div",{className:"relative mt-3 rounded-2xl border border-solid border-border-subtle overflow-hidden"},m?(0,r.createElement)("div",{className:(0,c.cn)("relative w-full h-[16.8125rem]",y&&"h-52")},(0,r.createElement)("img",{src:m,alt:"Shared link preview",className:"w-full h-full object-cover"}),!_&&(0,r.createElement)(p,{onClick:k})):(0,r.createElement)("div",{className:"h-[16.8125rem]"},(0,r.createElement)(f,null)),(0,r.createElement)("div",{className:"inline-block w-fit px-2 rounded absolute bottom-3 left-3 right-3 text-xs text-white bg-black/[0.77]"},(0,r.createElement)(i.E,{as:"p",className:"m-0 line-clamp-1 text-inherit"},w))),(0,r.createElement)(i.E,{as:"p",color:"secondary",size:14,weight:400,className:"mt-2 mb-1"},(0,n.__)("From","surerank")," ",(0,r.createElement)("span",{className:"hover:underline"},h)))))}return(0,r.createElement)("div",{id:v.id,className:(0,c.cn)("p-3",v.className)},(0,r.createElement)("div",{className:"flex gap-3 justify-start items-start"},x,(0,r.createElement)("div",{className:"space-y-4"},C,(0,r.createElement)("div",{className:"grid overflow-hidden min-h-[7.75rem] grid-cols-[7.5rem_1fr] rounded-2xl border border-solid border-border-subtle"},m?(0,r.createElement)("div",{className:"relative w-full h-full inline-flex"},(0,r.createElement)("img",{className:"w-full h-full object-cover m-0 max-h-[7.625rem] border-y-0 border-l-0 border-r border-solid border-border-subtle",src:m,alt:"thumbnail"}),!_&&(0,r.createElement)(p,{onClick:k})):(0,r.createElement)(f,{className:"border-y-0 border-l-0 border-r border-solid border-border-subtle"}),(0,r.createElement)("div",{className:"inline-grid items-center justify-start gap-0.5 px-3 py-5"},(0,r.createElement)("p",{className:"m-0 font-normal text-text-secondary leading-4 text-xs"},h),(0,r.createElement)("div",{className:"w-full overflow-hidden"},(0,r.createElement)("p",{className:"m-0 text-[0.9375rem] font-semibold text-text-primary whitespace-nowrap leading-5"},w)),(0,r.createElement)("p",{className:"m-0 font-normal text-text-secondary line-clamp-3 leading-5 text-sm"},b||""))))))},_=({displayName:e="Name",username:t="@username",type:a="facebook",title:s=(0,n.__)("Sample Post - Testing Site","surerank"),description:l="",imageURL:o="",siteURL:i="surerank.com",twitterLargePreview:u=!1,onClickRemove:d,hideRemoveButton:m=!0,forMetaBox:g=!1})=>{let _=null;const y=(0,c.jT)(l),E=(0,c.jT)(s),w=y||"";switch(a){case"twitter":_=(0,r.createElement)(k,{displayName:e,username:t,timeLabel:h("twitter"),title:E,description:y,imageURL:o,siteURL:i,onClickRemove:d,hideRemoveButton:m,forMetaBox:g,cardType:u?"summary_large_image":"summary"});break;case"facebook":_=(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"w-full h-[16.8125rem] overflow-clip"},o?(0,r.createElement)("div",{className:"relative w-full h-full"},(0,r.createElement)("img",{src:o,alt:"Social Post",className:"w-full h-full object-cover"}),!m&&(0,r.createElement)(p,{onClick:d})):(0,r.createElement)(f,null)),(0,r.createElement)("div",{className:"p-3 w-full"},(0,r.createElement)("p",{className:"m-0 text-xs leading-4 font-normal text-text-secondary"},i),(0,r.createElement)("p",{className:"mt-1.5 mb-1 text-base leading-6 font-semibold text-text-primary line-clamp-2"},E),(0,r.createElement)("p",{className:"m-0 text-sm leading-5 font-normal line-clamp-2"},w)));break;default:_=null}return(0,r.createElement)("div",{className:"p-2 rounded-lg bg-background-secondary"},(0,r.createElement)("div",{className:"flex flex-col rounded-md border border-solid border-border-subtle shadow-sm overflow-hidden bg-background-primary"},_))}},47143:e=>{e.exports=window.wp.data},48029:(e,t,a)=>{a.d(t,{Kl:()=>b,Tr:()=>w});var r=a(51609),n=a(88029),s=a(87835),l=a(71087),o=a(60443),i=a(9607),c=a(37042),u=a(27723),d=a(37946),m=a(79804),p=a(418),g=a(97213),h=a(94879),f=a(86087),k=a(64894),_=a(99418);const y=new Map,E=e=>{if(!e||"object"!==typeof e)return null;const{status:t,details:a}=e;let n="";a&&(n+=a),404===t?n+=" "+(0,u.__)("(The page or resource was not found)","surerank"):"http_request_failed"===t?n+=" "+(0,u.__)("(Unable to connect to the URL)","surerank"):403===t?n+=" "+(0,u.__)("(Access to this resource is forbidden)","surerank"):500===t?n+=" "+(0,u.__)("(Server error occurred)","surerank"):"number"===typeof t&&t>=400&&(n+=` ${(0,u.__)("(HTTP error","surerank")} ${t})`);const s=_.A.sanitize(n);return(0,r.createElement)("div",{className:"space-y-1"},(0,r.createElement)("p",{className:"m-0 text-inherit"},(0,r.createElement)("b",null,(0,u.__)("Why is this link broken?","surerank"))),(0,r.createElement)("p",{className:"m-0 text-inherit",dangerouslySetInnerHTML:{__html:s}}),t&&(0,r.createElement)("p",{className:"text-xs m-0 text-inherit"},(0,r.createElement)("b",null,(0,u.__)("Status:","surerank"))," ",t))},w=({variant:e,label:t,title:a,data:k,showImages:_,onIgnore:y,showRestoreButton:w=!1,onRestore:x,showIgnoreButton:C=!1,onFix:S,fixItButtonProps:N={}})=>{const{data:A,listStyleClassName:T}=v(k);return(0,r.createElement)(f.Fragment,null,(0,r.createElement)("div",{className:"relative flex flex-col gap-4 p-3 bg-background-primary rounded-lg shadow-sm border-0.5 border-solid border-border-subtle"},(0,r.createElement)("div",{className:"w-full flex items-start gap-2"},w?(0,r.createElement)(s.A,{label:t,size:"sm",type:"pill",variant:e,disableHover:!0,className:(0,i.cn)(w?"text-badge-color-disabled":"")}):(0,r.createElement)(f.Fragment,null,(0,r.createElement)("div",null,(0,r.createElement)("p",{className:"sr-only"},t),(0,r.createElement)("span",{className:"p-1 flex [&>svg]:size-4"},(e=>{const t="size-4";switch(e){case"blue":return(0,r.createElement)(g.A,{className:(0,i.cn)(t,"text-badge-color-sky")});case"red":return(0,r.createElement)(d.A,{className:(0,i.cn)(t,"text-badge-color-red")});case"yellow":return(0,r.createElement)(p.A,{className:(0,i.cn)(t,"text-badge-color-yellow")});case"green":return(0,r.createElement)(m.A,{className:(0,i.cn)(t,"text-badge-color-green")});default:return null}})(e)))),(0,r.createElement)("div",{className:"flex items-center flex-col gap-1.5 mt-px"},(0,r.createElement)(l.A,{size:"xs",className:"space-x-1 text-sm text-text-secondary inline"},a,(0,r.createElement)(h.$w,{content:(0,u.__)("Click here to discover more details about this check.","surerank"),arrow:!0},(0,r.createElement)("a",{href:surerank_globals?.help_link,className:"shrink-0 align-sub ml-2 focus:outline-none focus:ring-0",target:"_blank",rel:"noopener noreferrer"},(0,r.createElement)(g.A,{className:"size-4 text-icon-secondary hidden"})))),N?.show&&(0,r.createElement)(c.A,{variant:"link",size:"xs",className:"[&>span]:p-0 mr-auto min-w-fit shrink-0 underline",tooltipProps:{className:"z-999999"},hidden:!1,onClick:S,...(({show:e,...t})=>t)(N)})),C&&(0,r.createElement)(n.A,{variant:"link",onClick:async()=>{try{await y(),o.o.success((0,u.__)("Check ignored successfully","surerank"))}catch(e){o.o.error((0,u.__)("Failed to ignore check","surerank"))}},"aria-label":(0,u.__)("Ignore this check","surerank"),size:"xs",className:"underline hover:text-text-secondary ml-auto min-w-fit shrink-0 mt-1 text-text-secondary leading-4"},(0,u.__)("Ignore","surerank")),w&&(0,r.createElement)(n.A,{variant:"link",type:"button",onClick:async()=>{try{await x(),o.o.success((0,u.__)("Check restored successfully","surerank"))}catch(e){o.o.error((0,u.__)("Failed to restore check","surerank"))}},"aria-label":(0,u.__)("Restore this check","surerank"),size:"xs",className:"underline hover:text-text-secondary ml-auto min-w-fit shrink-0 mt-1 text-text-secondary leading-4"},(0,u.__)("Restore","surerank"))),!_&&A&&A.length>0&&(0,r.createElement)("ul",{className:(0,i.cn)("list-disc list-inside ml-3 mr-0 mt-0 mb-0.5",T)},A.map((e,t)=>(0,r.createElement)(f.Fragment,{key:`${e}-${t}`},(e=>{const t={tag:"a",variant:"link",className:"font-medium focus:outline-none focus:[box-shadow:none] [&>span]:px-0 break-all",target:"_blank",rel:"noopener noreferrer"};return(0,i.mv)(e)?(0,r.createElement)("li",{className:"m-0 text-sm"},(0,r.createElement)(n.A,{...t,href:e},e)):"object"===typeof e&&e?.url?(0,r.createElement)("li",{className:"my-1 first:mt-0 last:mb-0 p-2 flex items-center justify-between gap-1.5 text-sm border border-dashed border-border-subtle rounded-md bg-background-secondary"},(0,r.createElement)(n.A,{...t,href:e.url},e.url),(0,r.createElement)(h.Nr,{content:E(e),interactive:!0,placement:"top-start",offset:{alignmentAxis:-10,mainAxis:8}})):(0,r.createElement)("li",{className:"m-0 text-sm font-medium text-text-secondary list-none"},e)})(e)))),_&&(0,r.createElement)(b,{images:A})))},b=({images:e})=>e&&e.length?(0,r.createElement)("div",{className:"grid grid-cols-3 gap-2 mb-0.5"},e.map((e,t)=>(0,i.mv)(e)?(0,r.createElement)(n.A,{variant:"link",className:"inline-flex focus:outline-none focus:[box-shadow:none] p-0 relative",onClick:t=>(async(e,t)=>{if(e?.preventDefault(),y.has(t))window.open(`/wp-admin/upload.php?item=${y.get(t)}`,"_blank","noopener noreferrer");else try{const e=await(0,k.ih)(t);if(!e)throw new Error("No image found");const a=e?.id;y.set(t,a),window.open(`/wp-admin/upload.php?item=${a}`,"_blank","noopener noreferrer")}catch(a){window.open("/wp-admin/upload.php","_blank","noopener noreferrer")}})(t,e),key:`${e}-${t}`},(0,r.createElement)("div",{className:"absolute inset-0 bg-black bg-opacity-20 pointer-events-none"}),(0,r.createElement)("div",{className:"relative w-full h-36 rounded overflow-hidden"},(0,r.createElement)("img",{src:e,alt:e,className:"w-full h-36 object-cover rounded"}))):null)):null,v=e=>{if(!Array.isArray(e)||!e.length)return{data:[]};const t=[];let a="";return e.forEach(e=>{"string"===typeof e?t.push(e):e&&"object"===typeof e&&Array.isArray(e.list)?(t.push(...e.list),e.list?.some(e=>e?.url&&e?.status)&&(a="list-none mx-0")):e&&"object"===typeof e&&!Array.isArray(e?.list)&&"object"===typeof e?.list?t.push(...Object.values(e.list)):(t.push(e),a="list-none mx-0")}),{data:t,listStyleClassName:a}}},51609:e=>{e.exports=window.React},52619:e=>{e.exports=window.wp.hooks},54486:(e,t,a)=>{a.d(t,{F:()=>r});const r=(e={})=>{const t=e.badChecks||[],a=e.fairChecks||[],r=e.suggestionChecks||[];let n="success";return t.length>0?n="error":a.length>0?n="warning":r.length>0&&(n="suggestion"),{status:n,counts:{errorAndWarnings:t.length+a.length,success:(e.passedChecks||[]).length,error:t.length,warning:a.length,suggestion:r.length}}}},54822:(e,t,a)=>{a.d(t,{A:()=>m});var r=a(51609),n=a(86087),s=a(27723),l=a(3535),o=a(30732),i=a(46615),c=a(48029),u=a(68402),d=a(1671);const m=(0,n.memo)(({pageSeoChecks:e={},onIgnore:t,onRestore:a,onFix:m,type:p="page"})=>{const{badChecks:g=[],fairChecks:h=[],passedChecks:f=[],ignoredChecks:k=[],suggestionChecks:_=[],isCheckingLinks:y=!1,linkCheckProgress:E={current:0,total:0}}=e,w=(0,u.ZD)(d.E),b=(0,n.useMemo)(()=>g.length>0||h.length>0||_.length>0,[g.length,h.length,_.length]),v=e=>()=>{e&&"function"===typeof t&&t(e)},x=e=>()=>{e&&((0,u.M6)(e)&&"function"===typeof m?m(e):(0,u.J9)(e))},C=e=>{if(w)return{show:!1};const t=(0,u.M6)(e);return{show:!0,locked:t?u.IG.includes(e):!u.X2,...!t&&{buttonLabel:(0,s.__)("Help Me Fix","surerank")}}};return(0,r.createElement)(i.P.div,{className:"space-y-3 p-1",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3}},b&&(0,r.createElement)("div",{className:"space-y-3"},"page"===p&&y&&(0,r.createElement)("div",{className:"flex items-center gap-2 p-2 bg-white rounded-lg shadow-sm border-0.5 border-solid border-border-subtle"},(0,r.createElement)(l.a,{size:"sm"}),(0,r.createElement)(o.E,{size:14,weight:500,color:"tertiary"},(0,s.sprintf)((0,s.__)("%1$d out of %2$d checks are done.","surerank"),E.current,E.total))),g.map(e=>(0,r.createElement)(c.Tr,{key:e.id,variant:"red",label:(0,s.__)("Critical","surerank"),title:e.title,data:e?.data,showImages:e?.showImages,onIgnore:v(e.id),showIgnoreButton:!0,onFix:x(e.id),fixItButtonProps:C(e.id)})),h.map(e=>(0,r.createElement)(c.Tr,{key:e.id,variant:"yellow",label:(0,s.__)("Warning","surerank"),title:e.title,data:e?.data,showImages:e?.showImages,onIgnore:v(e.id),onFix:x(e.id),showIgnoreButton:!0,fixItButtonProps:C(e.id)})),_.map(e=>(0,r.createElement)(c.Tr,{key:e.id,variant:"blue",label:(0,s.__)("Suggestion","surerank"),title:e.title,data:e?.data,showImages:e?.showImages,onIgnore:v(e.id),showIgnoreButton:!0,onFix:x(e.id),fixItButtonProps:C(e.id)}))),k.length>0&&(0,r.createElement)("div",{className:"space-y-3"},k.map(e=>(0,r.createElement)(c.Tr,{key:e.id,variant:"neutral",label:(0,s.__)("Ignore","surerank"),title:e.title,showRestoreButton:!0,onRestore:()=>a(e.id)}))),f.length>0&&(0,r.createElement)("div",{className:"space-y-3"},f.map(e=>(0,r.createElement)(c.Tr,{key:e.id,variant:"green",label:(0,s.__)("Passed","surerank"),title:e.title,onIgnore:()=>t(e.id)}))))})},56427:e=>{e.exports=window.wp.components},60249:(e,t,a)=>{a.d(t,{a:()=>r});const r=e=>{const t=wp.media({...e,library:{type:"image",...e.library||{}}});return e.button&&e.button.text&&((e,t)=>{const a=()=>{const a=[".media-button-select",".media-button-insert",".button-primary"];for(const r of a){const a=e.$(r);if(a.length&&a.is(":visible")){a.text(t);break}}};e.on("ready",a),e.on("selection:toggle",a),e.on("content:render",a)})(t,e.button.text),t}},61456:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(51609),n=a(3213),s=a(9607),l=a(71149);const o=({deviceType:e="desktop",faviconURL:t="",title:a="",description:o="",permalink:i="",siteTitle:c=""})=>{const u=(0,s.jT)(a),d=(0,s.jT)(o);return(0,r.createElement)("div",{className:"p-2 rounded-lg bg-background-secondary"},(0,r.createElement)("div",{className:"rounded-md border border-solid border-border-subtle bg-background-primary p-4 space-y-1.5 shadow-sm"},(0,r.createElement)("div",{className:"grid grid-cols-[1.75rem_1fr] items-center gap-3"},t?(0,r.createElement)("div",{className:"relative w-7 h-7"},(0,r.createElement)("img",{className:"w-full h-full object-cover m-0",src:t,alt:"favicon"})):(0,r.createElement)(l.V_,{className:"size-7"}),(0,r.createElement)("div",{className:"flex flex-col gap-0.5"},(0,r.createElement)("span",{className:"text-text-primary font-semibold"},c),(0,r.createElement)("div",{className:"flex items-center justify-start gap-2"},(0,r.createElement)("span",{className:"text-text-secondary line-clamp-1 break-all"},i),(0,r.createElement)(n.A,{className:"size-3.5 text-icon-secondary"})))),(0,r.createElement)("div",{className:"space-y-1"},(0,r.createElement)("p",{className:"text-xl leading-8 font-normal text-text-seo-title m-0 line-clamp-1 break-all"},u),(0,r.createElement)("p",{className:(0,s.cn)("text-sm leading-5 font-medium text-text-secondary m-0 break-words","mobile"===e&&"text-2xl leading-9.5 line-clamp-2")},d))))}},62220:(e,t,a)=>{a.d(t,{CS:()=>u,DN:()=>d,EJ:()=>i,Li:()=>o,MF:()=>c,W9:()=>r,qh:()=>l,uX:()=>s,wX:()=>n});const r="/surerank/v1/admin/global-settings",n="/surerank/v1/admin/site-settings",s="/surerank/v1/admin/editor",l="/surerank/v1/onboarding",o="/surerank/v1/admin/post-content",i="/surerank/v1/term/settings",c="/surerank/v1/post/settings",u="/surerank/v1/admin/posts",d="/surerank/v1/robots-txt"},64506:(e,t,a)=>{a.d(t,{A:()=>r});const r=(e,t,a={})=>{if(!e||!t)return e;const r=(e=>{const t=e.match(/%([^%\s]+)%/g);return t?t.map(e=>e.replace(/%/g,"")):[]})(e),n=[];return r.forEach(e=>{n[e]||(n[e]=["title","excerpt","content"].includes(e)&&a?.[e]?a[e]:t[e]||"")}),e.replace(/%([^%\s]+)%/g,(e,t)=>n[t]||"")}},64894:(e,t,a)=>{a.d(t,{Af:()=>d,Lx:()=>p,YO:()=>h,ih:()=>u,lX:()=>g,lr:()=>c,rU:()=>f,xI:()=>m});var r=a(1455),n=a.n(r),s=a(93832),l=a(62220),o=a(9607);const i="/surerank/v1",c=async()=>{const e=new URLSearchParams;(0,o.P$)("term.php")?e.append("term_id",surerank_seo_popup?.term_id):e.append("post_id",surerank_seo_popup?.post_id),e.append("post_type",surerank_seo_popup?.post_type),e.append("is_taxonomy",surerank_seo_popup?.is_taxonomy);try{const t=await n()({path:`${(0,o.P$)("term.php")?l.EJ:l.MF}?${e.toString()}`,method:"GET"});if(!t.success)throw new Error(t.message);return t}catch(t){throw new Error(t.message)}},u=async e=>{if(!e)return null;const t=new URL(e).pathname.split("/").pop().split("?")[0],a=t.replace(/-\d+x\d+\.(jpg|jpeg|png|gif|webp)$/i,"").replace(/-scaled\.(jpg|jpeg|png|gif|webp)$/i,"").replace(/\.(webp)$/i,"").replace(/(-optimized|-compressed)/i,""),r=[{search:t},{search:a},{search:t.replace(/\.[^/.]+$/,"")},{search:a.replace(/\.[^/.]+$/,"")}];for(const o of r)try{const e=await n()({path:(0,s.addQueryArgs)("/wp/v2/media",{search:o.search,media_type:"image",slug:o.search,per_page:20}),method:"GET"});if(e&&e.length>0)return e.find(e=>{const r=e.source_url||e.url,n=r.split("/").pop().split("?")[0];return n===t||r.includes(a)||n.includes(a)})||e[0]}catch(l){continue}try{const e=a.split("-")[0],t=await n()({path:(0,s.addQueryArgs)("/wp/v2/media",{search:e,media_type:"image",per_page:50}),method:"GET"});if(t&&t.length>0)return t[0]}catch(l){}return null},d=()=>n()({path:`${i}/migration/migrated-data`,method:"GET"}),m=()=>n()({path:`${i}/ai/auth`}),p=e=>n()({path:`${i}/ai/auth`,method:"POST",data:{accessKey:e}}),g=(e,t,a)=>{const r={type:e};return t&&(r.post_id=t),a&&(r.is_taxonomy=a),n()({path:`${i}/generate-content`,method:"POST",data:r})},h=e=>n()({path:`${i}/email-reports/settings`,method:"POST",data:e}),f=e=>n()({path:`${i}/email-reports/send-test`,method:"POST",data:{recipientEmail:e}})},66087:e=>{e.exports=window.lodash},68402:(e,t,a)=>{a.d(t,{EF:()=>c,X2:()=>g,BB:()=>u,IG:()=>i,J9:()=>m,M6:()=>p,ZD:()=>h});var r=a(52619);const n={page_title:"content_generation",page_description:"content_generation",title:"content_generation",meta_description:"content_generation",url_length:"content_generation",site_tag_line:"content_generation",other_seo_plugins:"other_seo_plugins",indexing:"indexing",sitemaps:"sitemaps",index_status:"index_status"};var s=a(47143);const l={page_title:"page_title",page_description:"page_description",title:"home_page_title",meta_description:"home_page_description",site_tag_line:"site_tag_line",url_length:"page_url_slug"},o=(0,r.applyFilters)("surerank-pro.page-seo-checks-content-generation-mapping",{search_engine_title:"page_title",search_engine_description:"page_description",url_length:"page_url_slug"}),i=(0,r.applyFilters)("surerank-pro.pro-page-seo-checks-content-generation",["url_length","search_engine_title","search_engine_description"]),c=Object.freeze({...l,...o,facebook_title:"social_title",facebook_description:"social_description",twitter_title:"social_title",twitter_description:"social_description"}),u={search_engine_title:"page_title",search_engine_description:"page_description"},d=Object.freeze(Array.from(new Set([...Object.keys(l),...Object.keys(o)]))),m=e=>{const t=(0,r.applyFilters)("surerank-pro.help-me-fix-redirect",null);"function"===typeof t&&t(e)},p=e=>d.includes(null!==e&&void 0!==e?e:"")||Object.keys(n).includes(null!==e&&void 0!==e?e:""),g=(0,r.applyFilters)("surerank-pro.help-me-fix-active",!1),h=e=>{const t=(0,s.select)(e).getPageSeoChecks();return t?.hideFixHelpButtons||!1}},68458:(e,t,a)=>{a.d(t,{A:()=>p});var r=a(51609),n=a(86087),s=a(29767),l=a(9655);const o=class extends n.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){return this.state.hasError?(0,r.createElement)("div",{className:"text-base font-medium text-text-error p-4 border border-solid border-border-error rounded-lg"},"Error: ",this.state.error.message||"Unknown error"):this.props.children}};var i=a(9607),c=a(64894);const u=new Map,d=()=>(0,r.createElement)(s.A,{className:"h-14 w-full"}),m=({imageId:e,imageUrl:t,onRemove:a})=>{let n=(({imageId:e="",imageUrl:t=""})=>{if(u.has(e||t))return u.get(e||t);const a=(0,i.sI)(new Promise(a=>{if(!e&&!t)return void a({});const r=e=>{if(!e)return void a({});const t=(e=>wp.media.attachment(e).fetch())(e);t&&"function"===typeof t.then?t.then(()=>{a(t)}).catch(()=>{a({})}):a(t)};t?(0,c.ih)(t).then(e=>{e?r(e.id):a({})}).catch(()=>{a({})}):e?r(e):a({})}));return u.set(e||t,a),a})({imageId:e,imageUrl:t}).read()||{};return"attributes"in n&&(n=n.attributes),(0,r.createElement)("div",{className:"[&>div]:m-0"},(0,r.createElement)(l.d,{file:{name:n.filename||"",url:n.url||"",type:n.type||"",size:n.filesizeInBytes||""},onRemove:a,size:"md"}))},p=(0,n.memo)(({imageId:e,imageUrl:t,onRemove:a})=>((0,n.useEffect)(()=>{const a=()=>{(e||t)&&u.delete(e||t)};return window.addEventListener("beforeunload",a),()=>{window.removeEventListener("beforeunload",a)}},[e,t]),e||t?(0,r.createElement)(o,null,(0,r.createElement)(n.Suspense,{fallback:(0,r.createElement)(d,null)},(0,r.createElement)(m,{imageId:e,imageUrl:t,onRemove:a}))):null))},71149:(e,t,a)=>{a.d(t,{B0:()=>i,BZ:()=>u,CX:()=>l,V_:()=>s,Wn:()=>d,Zy:()=>c,bk:()=>o,jf:()=>m,uw:()=>n});var r=a(51609);const n=e=>(0,r.createElement)("svg",{width:"538",height:"84",viewBox:"0 0 538 84",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},(0,r.createElement)("path",{d:"M74.7021 31.1187C74.7021 13.9953 60.8924 0.118378 43.8521 0.118378H0.670166V83.7997H7.9266C20.5234 83.7997 30.9189 74.347 32.4782 62.1087H32.4986L32.5496 49.1228H31.459C22.735 49.1228 15.6417 42.1383 15.3971 33.4332H15.3869V29.2957H19.5145C25.2829 29.2957 30.3889 32.1633 33.5076 36.5465C36.4835 25.9468 46.1859 18.1737 57.6821 18.1737V22.3112V27.8722C57.6821 39.5575 48.9275 49.0409 37.3192 49.1126V62.1087C38.8276 74.3777 49.2434 83.8816 61.8708 83.8816H74.7225V59.0056H57.3356C67.6291 53.9772 74.7225 43.3774 74.7225 31.1084L74.7021 31.1187Z",fill:"#4338CA"}),(0,r.createElement)("path",{d:"M219.188 21.9015V12.4591H210.261V71.5512H219.188V29.7259C220.513 27.2987 222.786 25.1275 226.017 23.2124C229.248 21.2563 232.234 20.2834 234.996 20.2834C235.892 20.2834 237.034 20.3654 238.44 20.519V11.0765C234.71 11.0765 231.194 12.0699 227.882 14.067C224.58 16.0231 221.685 18.6243 219.188 21.8913V21.9015Z",fill:"#1B1933"}),(0,r.createElement)("path",{d:"M284.874 15.2037C280.634 12.3772 275.681 10.9639 270.004 10.9639C264.327 10.9639 259.721 12.3567 255.369 15.1423C251.017 17.887 247.613 21.6353 245.167 26.377C242.752 31.0777 241.549 36.2598 241.549 41.913C241.549 51.1096 244.311 58.6062 249.835 64.3823C255.359 70.1583 262.432 73.0464 271.064 73.0464C280.237 73.0464 287.88 69.974 293.985 63.8497L289.725 57.8791C287.391 60.3063 284.65 62.1804 281.5 63.4913C278.392 64.8022 275.141 65.4678 271.757 65.4678C265.764 65.4678 260.903 63.5118 257.173 59.6098C253.484 55.7079 251.455 50.8433 251.109 45.0365H297.715V42.7015C297.715 36.7309 296.625 31.3645 294.454 26.633C292.314 21.8503 289.124 18.0508 284.884 15.2242L284.874 15.2037ZM250.976 38.1544C251.089 35.8399 251.578 33.5766 252.434 31.344C253.29 29.0704 254.452 26.9812 255.93 25.0661C257.448 23.11 259.415 21.5431 261.82 20.3449C264.226 19.1466 266.916 18.5526 269.872 18.5526C273.021 18.5526 275.844 19.1671 278.331 20.4063C280.817 21.6045 282.805 23.1714 284.283 25.1275C285.76 27.0836 286.871 29.1728 287.605 31.4054C288.38 33.638 288.798 35.8911 288.828 38.1544H250.976Z",fill:"#1B1933"}),(0,r.createElement)("path",{d:"M132.336 41.913C130.277 40.6738 127.963 39.6394 125.395 38.8098C122.868 37.9701 120.32 37.2737 117.751 36.7206C115.224 36.1266 112.91 35.5019 110.811 34.867C108.752 34.191 107.06 33.2693 105.735 32.1223C104.41 30.9241 103.748 29.4698 103.748 27.7595C103.748 25.0866 104.91 22.8847 107.244 21.1232C109.578 19.331 112.666 18.4297 116.518 18.4297C120.371 18.4297 123.499 19.1262 126.496 20.519C129.523 21.8708 131.938 23.663 133.732 25.8956L137.87 19.5665C132.427 13.8314 125.313 10.9639 116.518 10.9639C109.863 10.9639 104.635 12.5922 100.823 15.8592C97.0114 19.0852 95.1055 23.1305 95.1055 27.9848C95.1055 30.9343 95.768 33.4844 97.0929 35.6351C98.4178 37.7448 100.13 39.3834 102.229 40.5304C104.329 41.6876 106.642 42.6606 109.17 43.4594C111.738 44.2582 114.286 44.9546 116.814 45.5486C119.341 46.1426 121.655 46.8083 123.754 47.5149C125.854 48.2318 127.566 49.2457 128.891 50.5668C130.216 51.8777 130.878 53.4958 130.878 55.4109C130.878 58.4423 129.655 60.89 127.199 62.7641C124.794 64.6383 121.43 65.5703 117.109 65.5703C113.338 65.5703 109.741 64.7509 106.316 63.1226C102.892 61.4942 100.15 59.4767 98.0917 57.0905L93.5972 63.7268C99.4268 69.9433 107.183 73.0464 116.865 73.0464C124.019 73.0464 129.563 71.377 133.487 68.0282C137.452 64.6383 139.439 60.3575 139.439 55.1856C139.439 52.0825 138.777 49.3891 137.452 47.1155C136.127 44.8419 134.415 43.1112 132.315 41.913H132.336Z",fill:"#1B1933"}),(0,r.createElement)("path",{d:"M188.155 55.8923C186.402 58.4014 183.976 60.5111 180.868 62.2214C177.76 63.9317 174.529 64.7919 171.186 64.7919C166.946 64.7919 163.716 63.7985 161.504 61.8015C159.292 59.7737 158.182 56.2815 158.182 51.3452V12.4591H149.254V54.1615C149.254 66.748 155.379 73.0464 167.629 73.0464C171.675 73.0464 175.507 72.1144 179.125 70.2403C182.743 68.3661 185.76 66.0414 188.165 63.2455V71.5512H197.144V12.4591H188.165V55.8923H188.155Z",fill:"#1B1933"}),(0,r.createElement)("path",{d:"M340.917 48.6312C344.332 46.9209 347.002 44.5552 348.948 41.534C350.946 38.4617 351.955 34.9694 351.955 31.0675C351.955 27.1656 351.017 23.6426 349.132 20.6931C347.246 17.6821 344.627 15.3164 341.274 13.5959C337.921 11.8856 334.069 11.0253 329.717 11.0253H306.775V73.1078H318.863V51.1096H328.127L340.744 73.1078H354.421L340.122 48.9897C340.387 48.877 340.652 48.7644 340.917 48.6312ZM338.094 35.6863C337.269 37.0484 336.127 38.1135 334.649 38.8815C333.233 39.6496 331.623 40.0388 329.798 40.0388H318.852V22.1269H329.177C332.183 22.1269 334.619 22.9564 336.504 24.6052C338.451 26.2643 339.419 28.415 339.419 31.0777C339.419 32.788 338.981 34.3344 338.094 35.6863Z",fill:"#1B1933"}),(0,r.createElement)("path",{d:"M394.607 11.0356H382.52L358.162 73.1181H370.962L376.17 59.4562H401.772L406.98 73.1181H419.78L395.422 11.0356H394.627H394.607ZM380.247 48.7234L388.961 25.8547L397.675 48.7234H380.247Z",fill:"#1B1933"}),(0,r.createElement)("path",{d:"M467.701 52.7175L437.524 11.0356H424.906V73.1078H436.994V30.6271L467.701 73.1078H479.707V11.0356H467.701V52.7175Z",fill:"#1B1933"}),(0,r.createElement)("path",{d:"M510.302 39.0352L536.362 11.0356H520.738L497.878 35.6146V11.0356H485.964V73.1078H497.878V52.3898L502.434 47.4944L522.409 73.1078H537.33L510.302 39.0352Z",fill:"#1B1933"})),s=({enableFill:e=!0,...t})=>(0,r.createElement)("svg",{width:"128",height:"128",viewBox:"0 0 128 128",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e&&(0,r.createElement)("rect",{width:"128",height:"128",fill:"white"}),(0,r.createElement)("path",{d:"M73.4731 0C99.6321 6.3594e-05 120.838 21.2062 120.838 47.3652C120.838 66.1146 109.944 82.3181 94.1401 89.9941H120.838V128H101.114C81.7276 128 65.7331 113.485 63.4018 94.7305H63.4008L63.4125 74.8838C81.2408 74.7673 94.685 60.2785 94.685 42.4229V33.9307H94.6879V27.6074C77.0272 27.6075 62.1389 39.4779 57.5649 55.6748C52.7868 48.9672 44.9453 44.5928 36.0825 44.5928H29.7495V50.915H29.7719C30.1453 64.2164 41.0453 74.8848 54.437 74.8848H56.1166L56.0356 94.7305H56.0073C53.6177 113.422 37.6508 127.868 18.31 127.868H7.16156V0H73.4731Z",fill:"#4338CA"})),l=e=>(0,r.createElement)("svg",{width:"128",height:"128",viewBox:"0 0 128 128",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},(0,r.createElement)("path",{d:"M73.4731 0C99.6321 6.3594e-05 120.838 21.2062 120.838 47.3652C120.838 66.1146 109.944 82.3181 94.1401 89.9941H120.838V128H101.114C81.7276 128 65.7331 113.485 63.4018 94.7305H63.4008L63.4125 74.8838C81.2408 74.7673 94.685 60.2785 94.685 42.4229V33.9307H94.6879V27.6074C77.0272 27.6075 62.1389 39.4779 57.5649 55.6748C52.7868 48.9672 44.9453 44.5928 36.0825 44.5928H29.7495V50.915H29.7719C30.1453 64.2164 41.0453 74.8848 54.437 74.8848H56.1166L56.0356 94.7305H56.0073C53.6177 113.422 37.6508 127.868 18.31 127.868H7.16156V0H73.4731Z",fill:"currentColor"})),o=e=>(0,r.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},(0,r.createElement)("path",{d:"M13.5537 1.5C17.8453 1.5 21.3251 4.97895 21.3252 9.27051C21.3252 12.347 19.5368 15.0056 16.9434 16.2646H21.3252V22.5H18.0889C14.9086 22.5 12.2861 20.1186 11.9033 17.042H11.9014L11.9033 13.7852C14.8283 13.7661 17.0342 11.3894 17.0342 8.45996V6.0293C14.137 6.02947 11.6948 7.97682 10.9443 10.6338C10.1605 9.53345 8.87383 8.8165 7.41992 8.81641H6.38086V9.85352H6.38379C6.44515 12.0356 8.23375 13.786 10.4307 13.7861H10.7061L10.6934 17.042H10.6865C10.2943 20.1082 7.67678 22.4785 4.50391 22.4785H2.6748V1.5H13.5537Z",fill:"currentColor"})),i=e=>(0,r.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},(0,r.createElement)("path",{d:"M12.2149 1.26929H14.4639L9.55054 6.88495L15.3307 14.5266H10.8049L7.26009 9.89198L3.20403 14.5266H0.953684L6.20902 8.52002L0.664062 1.26929H5.3048L8.50899 5.50551L12.2149 1.26929ZM11.4256 13.1805H12.6718L4.62766 2.54471H3.29037L11.4256 13.1805Z",fill:"#111827"})),c=e=>(0,r.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},(0,r.createElement)("path",{d:"M13.1667 10C13.1667 11.7489 11.7489 13.1667 10 13.1667C8.25113 13.1667 6.83337 11.7489 6.83337 10C6.83337 8.25113 8.25113 6.83337 10 6.83337C11.7489 6.83337 13.1667 8.25113 13.1667 10Z",fill:"#FFFFFF"})),u=e=>(0,r.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},(0,r.createElement)("path",{d:"M9.93548 15.5002C9.8462 15.1542 9.66581 14.8384 9.41309 14.5856C9.16037 14.3329 8.84455 14.1525 8.49848 14.0632L2.36348 12.4812C2.25881 12.4515 2.16668 12.3885 2.10109 12.3017C2.03549 12.2149 2 12.1091 2 12.0002C2 11.8914 2.03549 11.7856 2.10109 11.6988C2.16668 11.612 2.25881 11.549 2.36348 11.5192L8.49848 9.93625C8.84442 9.84706 9.16017 9.66682 9.41288 9.41429C9.66559 9.16175 9.84604 8.84614 9.93548 8.50025L11.5175 2.36525C11.5469 2.26017 11.6099 2.16759 11.6968 2.10164C11.7837 2.0357 11.8899 2 11.999 2C12.1081 2 12.2142 2.0357 12.3012 2.10164C12.3881 2.16759 12.4511 2.26017 12.4805 2.36525L14.0615 8.50025C14.1508 8.84632 14.3311 9.16215 14.5839 9.41487C14.8366 9.66759 15.1524 9.84797 15.4985 9.93725L21.6335 11.5182C21.739 11.5473 21.832 11.6103 21.8983 11.6973C21.9646 11.7844 22.0005 11.8908 22.0005 12.0002C22.0005 12.1097 21.9646 12.2161 21.8983 12.3032C21.832 12.3902 21.739 12.4531 21.6335 12.4822L15.4985 14.0632C15.1524 14.1525 14.8366 14.3329 14.5839 14.5856C14.3311 14.8384 14.1508 15.1542 14.0615 15.5002L12.4795 21.6353C12.4501 21.7403 12.3871 21.8329 12.3002 21.8989C12.2132 21.9648 12.1071 22.0005 11.998 22.0005C11.8889 22.0005 11.7827 21.9648 11.6958 21.8989C11.6089 21.8329 11.5459 21.7403 11.5165 21.6353L9.93548 15.5002Z",stroke:"#111827",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.createElement)("path",{d:"M20 3V7",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.createElement)("path",{d:"M22 5H18",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.createElement)("path",{d:"M4 17V19",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.createElement)("path",{d:"M5 18H3",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})),d=e=>(0,r.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},(0,r.createElement)("path",{d:"M6.64847 3.71638L7.04997 4.83138C7.49597 6.06888 8.47047 7.04338 9.70797 7.48938L10.823 7.89087C10.9235 7.92737 10.9235 8.06988 10.823 8.10588L9.70797 8.50737C8.47047 8.95337 7.49597 9.92787 7.04997 11.1654L6.64847 12.2804C6.61197 12.3809 6.46947 12.3809 6.43347 12.2804L6.03197 11.1654C5.58597 9.92787 4.61147 8.95337 3.37397 8.50737L2.25897 8.10588C2.15847 8.06938 2.15847 7.92687 2.25897 7.89087L3.37397 7.48938C4.61147 7.04338 5.58597 6.06888 6.03197 4.83138L6.43347 3.71638C6.46947 3.61537 6.61197 3.61537 6.64847 3.71638Z",fill:"currentColor"}),(0,r.createElement)("path",{d:"M11.6675 1.03863L11.871 1.60313C12.097 2.22963 12.5905 2.72312 13.217 2.94912L13.7815 3.15262C13.8325 3.17112 13.8325 3.24312 13.7815 3.26162L13.217 3.46512C12.5905 3.69112 12.097 4.18462 11.871 4.81112L11.6675 5.37563C11.649 5.42663 11.577 5.42663 11.5585 5.37563L11.355 4.81112C11.129 4.18462 10.6355 3.69112 10.009 3.46512L9.4445 3.26162C9.3935 3.24312 9.3935 3.17112 9.4445 3.15262L10.009 2.94912C10.6355 2.72312 11.129 2.22963 11.355 1.60313L11.5585 1.03863C11.577 0.987125 11.6495 0.987125 11.6675 1.03863Z",fill:"currentColor"}),(0,r.createElement)("path",{d:"M11.6675 10.6242L11.871 11.1887C12.097 11.8152 12.5905 12.3087 13.217 12.5347L13.7815 12.7382C13.8325 12.7567 13.8325 12.8287 13.7815 12.8472L13.217 13.0507C12.5905 13.2767 12.097 13.7702 11.871 14.3967L11.6675 14.9612C11.649 15.0122 11.577 15.0122 11.5585 14.9612L11.355 14.3967C11.129 13.7702 10.6355 13.2767 10.009 13.0507L9.4445 12.8472C9.3935 12.8287 9.3935 12.7567 9.4445 12.7382L10.009 12.5347C10.6355 12.3087 11.129 11.8152 11.355 11.1887L11.5585 10.6242C11.577 10.5732 11.6495 10.5732 11.6675 10.6242Z",fill:"currentColor"})),m=e=>(0,r.createElement)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},(0,r.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.91255 5.99999C0.91255 3.44174 2.9291 0.902258 6.06843 0.902258C8.60378 0.902258 9.85689 2.75767 10.3909 3.74438H8.80609C8.55414 3.74438 8.34982 3.94635 8.34982 4.1955C8.34982 4.44465 8.55414 4.64663 8.80609 4.64663H11.5437C11.7957 4.64663 12 4.44465 12 4.1955V1.48874C12 1.23959 11.7957 1.03761 11.5437 1.03761C11.2918 1.03761 11.0875 1.23959 11.0875 1.48874V3.12469C10.4446 2.00416 8.95748 0 6.06843 0C2.36092 0 0 3.00937 0 5.99999C0 8.99062 2.36092 12 6.06843 12C7.84228 12 9.31912 11.306 10.3707 10.2482C10.9337 9.68175 11.3734 9.01264 11.6731 8.29237C11.769 8.06199 11.6579 7.79834 11.4249 7.70352C11.1918 7.60869 10.9252 7.71861 10.8293 7.94901C10.5731 8.56467 10.1978 9.13489 9.71982 9.6157C8.83301 10.5079 7.58788 11.0977 6.06843 11.0977C2.9291 11.0977 0.91255 8.55826 0.91255 5.99999Z",fill:"currentColor"}))},72956:(e,t,a)=>{a.d(t,{n$:()=>r,qP:()=>l});const r=e=>{const t=((e="surerank_plugin")=>window?.surerank_globals?.pricing_link+`?utm_medium=${e}`)(e);window.open(t,"_blank","noopener,noreferrer")},n={"surerank-starter":1,"surerank-pro":2,"surerank-business":3},s=e=>e?e.startsWith("surerank-")?e:`surerank-${e}`:"",l=(e=null)=>{if(!e)return window?.surerank_globals?.is_pro_active;const t=window?.surerank_globals?.active_plan||null;if(!t)return!1;const a=s(e),r=s(t);return(n[r]||0)>=(n[a]||0)}},74801:(e,t,a)=>{a.d(t,{OV:()=>h,QZ:()=>E,Rm:()=>_,ep:()=>k,jK:()=>y,jp:()=>f,sv:()=>w});var r=a(51609),n=a(1455),s=a.n(n),l=a(27723),o=a(93832),i=a(88029),c=a(60443),u=a(9607),d=a(1671),m=a(84038),p=a(14060),g=a(76016);const h=async(e,t,a,r,n,i)=>{const p=r(d.E).getVariables()?.post?.ID?.value||0;e(!0);try{const e=await s()({path:(0,o.addQueryArgs)("/surerank/v1/checks/page",{post_ids:[p],_t:Date.now()}),method:"GET"}),r=(0,u.mT)(e?.data[p]?.checks),n=e.data[p]?.checks?.all_links||[];t(e=>{const t=new Set(n),a=new Set;return e.brokenLinks.forEach(e=>{t.has(e)&&a.add(e)}),{isChecking:!1,checkedLinks:new Set,brokenLinks:a,allLinks:n}});const i=[...r].filter(e=>"broken_links"!==e.id);g.Tv.forEach(e=>{a(e,i.filter(t=>t.type===e))}),0===n.length?(a("isCheckingLinks",!1),a("linkCheckProgress",{current:0,total:0})):(a("isCheckingLinks",!0),a("linkCheckProgress",{current:0,total:n.length}),await(async(e,t,a,r,n,s,o)=>{const i=a.length,c=[];for(const l of e){let e=!1;try{(await(0,m.Q7)({postId:t,userAgent:window.navigator.userAgent,url:l,allLinks:a})).success||(e=!0)}catch{e=!0}r(t=>{const a=new Set(t.checkedLinks),r=new Set(t.brokenLinks);return a.add(l),e&&(r.add(l),c.push(l)),n("linkCheckProgress",{current:a.size,total:i}),{...t,checkedLinks:a,brokenLinks:r}})}r(e=>{const t=[...o].filter(e=>"broken_links"!==e.id);return c.length>0&&t.push({id:"broken_links",title:(0,l.__)("One or more broken links found on the page.","surerank"),status:"error",type:"page",data:[(0,l.__)("These broken links were found on the page:","surerank"),{list:[...c]}]}),g.Tv.forEach(e=>{n(e,t.filter(t=>t.type===e))}),n("isCheckingLinks",!1),n("linkCheckProgress",{current:i,total:i}),{...e,isChecking:!1}})})(n,p,n,t,a,0,i))}catch(h){c.o.error(h.message),t({isChecking:!1,checkedLinks:new Set,brokenLinks:new Set,allLinks:[]}),a("isCheckingLinks",!1),a("linkCheckProgress",{current:0,total:0})}finally{e(!1)}},f=()=>"undefined"!==typeof window&&"undefined"!==typeof window.elementor&&window.elementor.hasOwnProperty("elements"),k=()=>!!surerank_globals?.is_bricks,_=()=>"undefined"!==typeof window&&"undefined"!==typeof window.FusionPageBuilder,y=()=>k()||f()||_(),E=()=>!g.Jj||k()||_(),w=({isRefreshing:e,isChecking:t,onClick:a})=>(0,r.createElement)(i.A,{variant:"outline",size:"xs",onClick:a,disabled:e||t,icon:(0,r.createElement)(p.A,{className:(0,u.cn)("size-4",(e||t)&&"animate-spin")})},(0,l.__)(e||t?"Refreshing":"Refresh","surerank"))},75795:e=>{e.exports=window.ReactDOM},76016:(e,t,a)=>{a.d(t,{$K:()=>f,Et:()=>w,HH:()=>A,Jj:()=>v,KT:()=>x,Op:()=>g,Rw:()=>C,Tv:()=>N,UM:()=>_,X:()=>E,dc:()=>S,de:()=>k,qt:()=>y,vr:()=>h,x8:()=>b});var r,n,s,l,o,i,c,u,d,m=a(51609),p=a(27723);const g=null!==(r=window?.surerank_globals?.input_variable_suggestions)&&void 0!==r?r:null,h=[{id:"post_no_index",value:"no",label:(0,p.__)("No index","surerank"),description:(0,p.__)("Prevents search engines from listing your page in search results.","surerank")},{id:"post_no_follow",value:"no",label:(0,p.__)("No follow","surerank"),description:(0,p.__)("Tells search engines not to follow any links on your page.","surerank")},{id:"post_no_archive",value:"no",label:(0,p.__)("No archive","surerank"),description:(0,p.__)("Blocks search engines from storing a cached version of your page.","surerank")}],f=()=>(0,p.__)("This content will be set as the meta description tag and may appear in search results. Keep it short and clearly explain what the page is about.","surerank"),k=null!==(n=window?.surerank_globals?.wp_dashboard_url)&&void 0!==n?n:"",_=null!==(s=window?.surerank_globals?.description_length)&&void 0!==s?s:160,y=null!==(l=window?.surerank_globals?.title_length)&&void 0!==l?l:60,E=null!==(o=window?.surerank_globals?.url_length)&&void 0!==o?o:90,w=()=>{var e;return(0,m.createElement)(m.Fragment,null,(0,p.__)("View a preview of how your page may appear in search engine results. This preview is for guidance only and might not exactly match how search engines display your content.","surerank"),(0,m.createElement)("div",{className:"mt-2"},(0,m.createElement)("strong",null,(0,p.__)("Site Icon: ","surerank")),(0,m.createElement)("span",null,(0,p.__)("The site icon (favicon) appears in browser tabs, bookmarks, and mobile devices. To update it, go to General Settings \u2192 Site Icon and upload a new image under Site Identity.","surerank")," ",(0,m.createElement)("a",{href:null!==(e=window?.surerank_globals?.wp_general_settings_url)&&void 0!==e?e:"",target:"_blank",rel:"noopener noreferrer",className:"block mt-2 no-underline hover:no-underline focus:[box-shadow:none] text-link-inverse hover:text-link-inverse-hover"},(0,p.__)("Change Here","surerank")))))},b=500,v=null!==(i=window?.surerank_globals?.enable_page_level_seo)&&void 0!==i&&i,x=null!==(c=window?.surerank_globals?.enable_google_console)&&void 0!==c&&c,C=null!==(u=window?.surerank_globals?.enable_schemas)&&void 0!==u&&u,S=null!==(d=window?.surerank_globals?.enable_migration)&&void 0!==d&&d,N=["page","keyword"],A="https://surerank.com/surerank-ai/?utm_medium=surerank_plugin"},84038:(e,t,a)=>{a.d(t,{Q7:()=>d,Tq:()=>c,aO:()=>u});var r=a(27723),n=a(18947),s=a(1455),l=a.n(s);const o=new Map,i=e=>{if(!e?.length)return[];const t=[];for(const a of e){const e=o.get(a);e?.broken&&t.push({url:a,...e})}return t},c=async(e,t,a=window.navigator.userAgent,s)=>{if(!e||!t)return;const l=(e=>{if(!e)return[];const t=Array.from(e.querySelectorAll("a[href]")).map(e=>{const t=e.getAttribute("href");if(!t)return null;const a=t.trim();if((e=>{if(!e)return!0;const t=e.trim();if(""===t)return!0;if(t.startsWith("#"))return!0;try{const e=(new URL(t,surerank_globals.site_url).protocol||"").replace(":","").toLowerCase();return!("http"===e||"https"===e)}catch(a){return t.includes(":")}})(a))return null;if(!a.startsWith("http")){const e=(a.startsWith("/")?"":"/")+a;return`${surerank_globals.site_url}${e}`}return a}).filter(Boolean);return[...new Set(t)]})(e);if(!l.length)return;const c=await(async({links:e,postId:t,userAgent:a,onProgress:n})=>{if((e=>{if(!e?.length)return o.clear();Array.from(o.keys()).forEach(t=>{e.includes(t)||o.delete(t)})})(e),!e.length)return[];const s=e.filter(e=>!o.has(e)),l=i(e);if(0===s.length)return l;const c=e.length;let u=e.length-s.length;"function"===typeof n&&(n("isCheckingLinks",!0),n("linkCheckProgress",{current:u,total:c}));for(const i of s){try{const r=await d({postId:t,userAgent:a,url:i,allLinks:e}),{success:n,...s}=r;o.set(i,{broken:!n,...s})}catch(g){var m,p;o.set(i,{broken:!0,status:null!==(m=null!==(p=g?.data?.status)&&void 0!==p?p:g?.code)&&void 0!==m?m:"error",details:g.message,message:(0,r.__)("Failed to check link","surerank")})}u++,"function"===typeof n&&n("linkCheckProgress",{current:u,total:c}),u<c&&await new Promise(e=>setTimeout(e,100))}return n("isCheckingLinks",!1),i(e)})({links:l,postId:t,userAgent:a,onProgress:s});return(0,n.bY)(c.length?{id:"broken_links",title:(0,r.__)("One or more broken links found on the page.","surerank"),status:"error",data:c,type:"page"}:{id:"broken_links",title:(0,r.__)("No broken links found on the page.","surerank"),status:"success",description:[],type:"page"})},u=e=>(0,n.bY)(e?{id:"canonical_url",title:(0,r.__)("Canonical tag is present on the page.","surerank"),status:"success",type:"page"}:{id:"canonical_url",title:(0,r.__)("Canonical tag is not present on the page.","surerank"),status:"warning",type:"page"}),d=async({postId:e,userAgent:t,url:a,allLinks:r})=>await l()({path:"/surerank/v1/checks/broken-link",method:"POST",data:{post_id:e,user_agent:t,url:a,urls:r}})},86087:e=>{e.exports=window.wp.element},87096:(e,t,a)=>{a.d(t,{A:()=>_,j:()=>k});var r=a(51609),n=a(86087),s=a(88029),l=a(60443),o=a(8723),i=a(45773),c=a(27723),u=a(62220),d=a(27165),m=a(47143),p=a(1455),g=a.n(p),h=a(71149);const f=({onClick:e,onSuccess:t,buttonTextInitial:a=(0,c.__)("Save","surerank"),icon:u,disabled:d,...m})=>{const[p,g]=(0,n.useState)(a),[h,f]=(0,n.useState)(!1),k=(0,n.useRef)(!0);return(0,r.createElement)(s.A,{onClick:async()=>{if(!h&&!d&&k.current){k.current=!1,f(!0),g((0,c.__)("Saving..","surerank"));try{const r=await e();if(!r.success)throw new Error(r.message);return g((0,c.__)("Saved","surerank")),t&&"function"===typeof t?await t(r):l.o.success((0,c.__)("Settings saved successfully.","surerank")),new Promise(e=>{setTimeout(()=>{g(a),k.current=!0,e(r)},1e3)})}catch(r){l.o.error(r.message),g(a),k.current=!0}finally{f(!1)}}},icon:h?(0,r.createElement)(o.A,{className:"animate-spin"}):p===(0,c.__)("Saved","surerank")?(0,r.createElement)(i.A,null):u||null,...m},p)},k=({onSuccess:e})=>{const{unsavedSettings:t}=(0,m.useSelect)(e=>{const{getUnsavedSettings:t}=e(d.E);return{unsavedSettings:t()||{}}},[]),{resetUnsavedSettings:a}=(0,m.useDispatch)(d.E),n=Object.keys(t||{}).length>0;return(0,r.createElement)(f,{onClick:async()=>{const e={data:t},r=await g()({path:u.W9,method:"POST",data:e});return r.success&&a(),r},onSuccess:e,className:n?"":"opacity-60 bg-background-brand cursor-not-allowed pointer-events-none",icon:n?(0,r.createElement)(h.Zy,null):null},(0,c.__)("Save","surerank"))},_=f},93832:e=>{e.exports=window.wp.url},94879:(e,t,a)=>{a.d(t,{$w:()=>c,ID:()=>i,Nr:()=>u,m_:()=>o});var r=a(51609),n=a(9607),s=a(99019),l=a(97213);const o=e=>e.content||e.title?(0,r.createElement)(s.m,{...e,tooltipPortalId:"surerank-root",boundary:document?.querySelector("#surerank-root")||"clippingAncestors"}):e.children,i=({content:e,...t})=>(0,r.createElement)(o,{content:e,placement:"top",arrow:!0,className:(0,n.cn)("max-w-95 z-[99999]",t?.className),...t},(0,r.createElement)(l.A,{className:"size-4 text-icon-secondary"})),c=e=>e.content||e.title?(0,r.createElement)(s.m,{...e,className:(0,n.cn)("z-[99999] max-w-95",e.className),tooltipPortalId:"surerank-root",boundary:document?.querySelector("#surerank-seo-popup-modal-container")||"clippingAncestors"}):e.children,u=({content:e,className:t,...a})=>(0,r.createElement)(c,{className:(0,n.cn)("z-[99999] max-w-95",t),content:e,placement:"top",arrow:!0,...a},(0,r.createElement)(l.A,{className:"shrink-0 size-4 !text-icon-secondary"}))},98583:(e,t,a)=>{a.d(t,{lk:()=>o,lz:()=>l,sP:()=>i});var r=a(51609),n=a(13739),s=a(27723);const l=(0,r.createElement)(n.A,{content:(0,s.__)("This schema does not have any configurable fields","surerank"),className:"shadow-none",variant:"info"}),o=(e=16)=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const a=Math.floor(Math.random()*e);return("x"===t?a:a%4+8).toString(16)}),i=e=>{const t=surerank_globals?.schema_type_data||{};return t[e]&&Array.isArray(t[e])&&t[e].length>0}}},e=>{e.O(0,[9603,4631,5769,4795,7167,862,5988,9743,4912,4865,5608,6115,1085,6152,359,9545,641,6018,2691,8426,9254,2584,418,5555,6770,938,8427,9526,8871,2002,908,8789,9658,8645,4973,5043,8732,5599,1811,4160,7683,5408,7040,703,4634,4787,8433,1624],()=>e(e.s=300)),e.O()}]);