????JFIF??x?x????'
Server IP : 104.21.96.1 / Your IP : 216.73.216.191 Web Server : LiteSpeed System : Linux premium151.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 : tempvsty ( 647) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /././proc/thread-self/cwd/wp-content/plugins/wordpress-seo/js/dist/ |
Upload File : |
(()=>{"use strict";var e={6746:(e,t,n)=>{var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=a(n(9196)),r=a(n(9156)),i=a(n(6743));function a(e){return e&&e.__esModule?e:{default:e}}var c=void 0;function l(e,t){var n,i,a,d,u,p,h,y,m=[],f={};for(p=0;p<e.length;p++)if("string"!==(u=e[p]).type){if(!t.hasOwnProperty(u.value)||void 0===t[u.value])throw new Error("Invalid interpolation, missing component node: `"+u.value+"`");if("object"!==s(t[u.value]))throw new Error("Invalid interpolation, component node must be a ReactElement or null: `"+u.value+"`","\n> "+c);if("componentClose"===u.type)throw new Error("Missing opening component token: `"+u.value+"`");if("componentOpen"===u.type){n=t[u.value],a=p;break}m.push(t[u.value])}else m.push(u.value);return n&&(d=function(e,t){var n,s,o=t[e],r=0;for(s=e+1;s<t.length;s++)if((n=t[s]).value===o.value){if("componentOpen"===n.type){r++;continue}if("componentClose"===n.type){if(0===r)return s;r--}}throw new Error("Missing closing component token `"+o.value+"`")}(a,e),h=l(e.slice(a+1,d),t),i=o.default.cloneElement(n,{},h),m.push(i),d<e.length-1&&(y=l(e.slice(d+1),t),m=m.concat(y))),1===m.length?m[0]:(m.forEach((function(e,t){e&&(f["interpolation-child-"+t]=e)})),(0,r.default)(f))}t.Z=function(e){var t=e.mixedString,n=e.components,o=e.throwErrors;if(c=t,!n)return t;if("object"!==(void 0===n?"undefined":s(n))){if(o)throw new Error("Interpolation Error: unable to process `"+t+"` because components is not an object");return t}var r=(0,i.default)(t);try{return l(r,n)}catch(e){if(o)throw new Error("Interpolation Error: unable to process `"+t+"` because of error `"+e.message+"`");return t}}},6743:e=>{function t(e){return e.match(/^\{\{\//)?{type:"componentClose",value:e.replace(/\W/g,"")}:e.match(/\/\}\}$/)?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.match(/^\{\{/)?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}e.exports=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(t)}},9156:(e,t,n)=>{var s=n(9196),o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,r=n(7942),i=n(9179),a=n(397),c=".",l=":",d="function"==typeof Symbol&&Symbol.iterator,u="@@iterator";function p(e,t){return e&&"object"==typeof e&&null!=e.key?(n=e.key,s={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,(function(e){return s[e]}))):t.toString(36);var n,s}function h(e,t,n,s){var r,a=typeof e;if("undefined"!==a&&"boolean"!==a||(e=null),null===e||"string"===a||"number"===a||"object"===a&&e.$$typeof===o)return n(s,e,""===t?c+p(e,0):t),1;var y=0,m=""===t?c:t+l;if(Array.isArray(e))for(var f=0;f<e.length;f++)y+=h(r=e[f],m+p(r,f),n,s);else{var g=function(e){var t=e&&(d&&e[d]||e[u]);if("function"==typeof t)return t}(e);if(g)for(var w,b=g.call(e),x=0;!(w=b.next()).done;)y+=h(r=w.value,m+p(r,x++),n,s);else if("object"===a){var v=""+e;i(!1,"Objects are not valid as a React child (found: %s).%s","[object Object]"===v?"object with keys {"+Object.keys(e).join(", ")+"}":v,"")}}return y}var y=/\/+/g;function m(e){return(""+e).replace(y,"$&/")}var f,g,w=b,b=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)};function x(e,t,n,s){this.result=e,this.keyPrefix=t,this.func=n,this.context=s,this.count=0}function v(e,t,n){var o,i,a=e.result,c=e.keyPrefix,l=e.func,d=e.context,u=l.call(d,t,e.count++);Array.isArray(u)?k(u,a,n,r.thatReturnsArgument):null!=u&&(s.isValidElement(u)&&(o=u,i=c+(!u.key||t&&t.key===u.key?"":m(u.key)+"/")+n,u=s.cloneElement(o,{key:i},void 0!==o.props?o.props.children:void 0)),a.push(u))}function k(e,t,n,s,o){var r="";null!=n&&(r=m(n)+"/");var i=x.getPooled(t,r,s,o);!function(e,t,n){null==e||h(e,"",t,n)}(e,v,i),x.release(i)}x.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},f=function(e,t,n,s){var o=this;if(o.instancePool.length){var r=o.instancePool.pop();return o.call(r,e,t,n,s),r}return new o(e,t,n,s)},(g=x).instancePool=[],g.getPooled=f||w,g.poolSize||(g.poolSize=10),g.release=function(e){var t=this;i(e instanceof t,"Trying to release an instance into a pool of a different type."),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},e.exports=function(e){if("object"!=typeof e||!e||Array.isArray(e))return a(!1,"React.addons.createFragment only accepts a single object. Got: %s",e),e;if(s.isValidElement(e))return a(!1,"React.addons.createFragment does not accept a ReactElement without a wrapper object."),e;i(1!==e.nodeType,"React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.");var t=[];for(var n in e)k(e[n],t,n,r.thatReturnsArgument);return t}},7942:e=>{function t(e){return function(){return e}}var n=function(){};n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},9179:e=>{e.exports=function(e,t,n,s,o,r,i,a){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,s,o,r,i,a],d=0;(c=new Error(t.replace(/%s/g,(function(){return l[d++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}},397:(e,t,n)=>{var s=n(7942);e.exports=s},9196:e=>{e.exports=window.React}},t={};function n(s){var o=t[s];if(void 0!==o)return o.exports;var r=t[s]={exports:{}};return e[s](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{const e=window.wp.element,t=window.yoast.propTypes;var s=n.n(t);const o=window.yoast.styledComponents;var r=n.n(o);const i=window.wp.i18n,a=window.lodash;var c=n(6746);const l=window.yoast.helpers,d=window.yoast.componentsNew,u=window.ReactJSXRuntime,p=e=>(0,u.jsx)(d.Alert,{type:"warning",className:e.className,children:(0,i.sprintf)(/* translators: %s: Expands to "Wincher". */ (0,i.__)('Your %s account does not contain any keyphrases for this website yet. You can track keyphrases by using the "Track SEO Performance" button in the post editor.',"wordpress-seo"),"Wincher")});p.propTypes={className:s().string},p.defaultProps={className:""};const h=p,y=window.moment;var m=n.n(y);const f=({data:e,mapChartDataToTableData:t,dataTableCaption:n,dataTableHeaderLabels:s,isDataTableVisuallyHidden:o})=>e.length!==s.length?(0,u.jsx)("p",{children:(0,i.__)("The number of headers and header labels don't match.","wordpress-seo")}):(0,u.jsx)("div",{className:o?"screen-reader-text":null,children:(0,u.jsxs)("table",{children:[(0,u.jsx)("caption",{children:n}),(0,u.jsx)("thead",{children:(0,u.jsx)("tr",{children:s.map(((e,t)=>(0,u.jsx)("th",{children:e},t)))})}),(0,u.jsx)("tbody",{children:(0,u.jsx)("tr",{children:e.map(((e,n)=>(0,u.jsx)("td",{children:t(e.y)},n)))})})]})});f.propTypes={data:s().arrayOf(s().shape({x:s().number,y:s().number})).isRequired,mapChartDataToTableData:s().func,dataTableCaption:s().string.isRequired,dataTableHeaderLabels:s().array.isRequired,isDataTableVisuallyHidden:s().bool},f.defaultProps={mapChartDataToTableData:null,isDataTableVisuallyHidden:!0};const g=f,w=({data:t,width:n,height:s,fillColor:o,strokeColor:r,strokeWidth:i,className:a,mapChartDataToTableData:c,dataTableCaption:l,dataTableHeaderLabels:d,isDataTableVisuallyHidden:p})=>{const h=Math.max(1,Math.max(...t.map((e=>e.x)))),y=Math.max(1,Math.max(...t.map((e=>e.y)))),m=s-i,f=t.map((e=>`${e.x/h*n},${m-e.y/y*m+i}`)).join(" "),w=`0,${m+i} `+f+` ${n},${m+i}`;return(0,u.jsxs)(e.Fragment,{children:[(0,u.jsxs)("svg",{width:n,height:s,viewBox:`0 0 ${n} ${s}`,className:a,role:"img","aria-hidden":"true",focusable:"false",children:[(0,u.jsx)("polygon",{fill:o,points:w}),(0,u.jsx)("polyline",{fill:"none",stroke:r,strokeWidth:i,strokeLinejoin:"round",strokeLinecap:"round",points:f})]}),c&&(0,u.jsx)(g,{data:t,mapChartDataToTableData:c,dataTableCaption:l,dataTableHeaderLabels:d,isDataTableVisuallyHidden:p})]})};w.propTypes={data:s().arrayOf(s().shape({x:s().number,y:s().number})).isRequired,width:s().number.isRequired,height:s().number.isRequired,fillColor:s().string,strokeColor:s().string,strokeWidth:s().number,className:s().string,mapChartDataToTableData:s().func,dataTableCaption:s().string.isRequired,dataTableHeaderLabels:s().array.isRequired,isDataTableVisuallyHidden:s().bool},w.defaultProps={fillColor:null,strokeColor:"#000000",strokeWidth:1,className:"",mapChartDataToTableData:null,isDataTableVisuallyHidden:!0};const b=w,x=()=>(0,u.jsxs)("p",{className:"yoast-wincher-seo-performance-modal__loading-message",children:[(0,i.__)("Tracking the ranking position…","wordpress-seo")," ",(0,u.jsx)(d.SvgIcon,{icon:"loading-spinner"})]}),v=r()(d.SvgIcon)` margin-left: 2px; flex-shrink: 0; rotate: ${e=>e.isImproving?"-90deg":"90deg"}; `,k=r().span` color: ${e=>e.isImproving?"#69AB56":"#DC3332"}; font-size: 13px; font-weight: 600; line-height: 20px; margin-right: 2px; margin-left: 12px; `,j=r().td` padding-right: 0 !important; & > div { margin: 0px; } `,T=r().td` padding-left: 2px !important; `,_=r().td.attrs({className:"yoast-table--nopadding"})` & > div { justify-content: center; } `,C=r().div` display: flex; align-items: center; & > a { box-sizing: border-box; } `,S=r().button` background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit; display: flex; align-items: center; `,R=r().tr` background-color: ${e=>e.isEnabled?"#FFFFFF":"#F9F9F9"} !important; `;function D(e){return Math.round(100*e)}function E({chartData:e}){if((0,a.isEmpty)(e)||(0,a.isEmpty)(e.position))return"?";const t=function(e){return Array.from({length:e.position.history.length},((e,t)=>t+1)).map((e=>(0,i.sprintf)((0,i._n)("%d day","%d days",e,"wordpress-seo"),e)))}(e),n=e.position.history.map(((e,t)=>({x:t,y:101-e.value})));return(0,u.jsx)(b,{width:66,height:24,data:n,strokeWidth:1.8,strokeColor:"#498afc",fillColor:"#ade3fc",mapChartDataToTableData:D,dataTableCaption:(0,i.__)("Keyphrase position in the last 90 days on a scale from 0 to 100.","wordpress-seo"),dataTableHeaderLabels:t})}function I({keyphrase:e,isEnabled:t,toggleAction:n,isLoading:s}){return s?(0,u.jsx)(d.SvgIcon,{icon:"loading-spinner"}):(0,u.jsx)(d.Toggle,{id:`toggle-keyphrase-tracking-${e}`,className:"wincher-toggle",isEnabled:t,onSetToggleState:n,showToggleStateLabel:!1})}function N(e){return!e||!e.position||e.position.value>100?"> 100":e.position.value}E.propTypes={chartData:s().object},E.defaultProps={chartData:{}};const L=e=>m()(e).fromNow(),P=({rowData:t})=>{var n;if(null==t||null===(n=t.position)||void 0===n||!n.change)return(0,u.jsx)(E,{chartData:t});const s=t.position.change<0;return(0,u.jsxs)(e.Fragment,{children:[(0,u.jsx)(E,{chartData:t}),(0,u.jsx)(k,{isImproving:s,children:Math.abs(t.position.change)}),(0,u.jsx)(v,{icon:"caret-right",color:s?"#69AB56":"#DC3332",size:"14px",isImproving:s})]})};function A(t){const{rowData:n,websiteId:s,keyphrase:o,onSelectKeyphrases:r}=t,c=(0,e.useCallback)((()=>{r([o])}),[r,o]),l=!(0,a.isEmpty)(n),p=n&&n.updated_at&&m()(n.updated_at)>=m()().subtract(7,"days"),h=n?`https://app.wincher.com/websites/${s}/keywords?serp=${n.id}&utm_medium=plugin&utm_source=yoast&referer=yoast&partner=yoast`:null;return l?p?(0,u.jsxs)(e.Fragment,{children:[(0,u.jsx)("td",{children:(0,u.jsxs)(C,{children:[N(n),(0,u.jsx)(d.ButtonStyledLink,{variant:"secondary",href:h,style:{height:28,marginLeft:12},rel:"noopener",target:"_blank",children:(0,i.__)("View","wordpress-seo")})]})}),(0,u.jsx)("td",{className:"yoast-table--nopadding",children:(0,u.jsx)(S,{type:"button",onClick:c,children:(0,u.jsx)(P,{rowData:n})})}),(0,u.jsx)("td",{children:L(n.updated_at)})]}):(0,u.jsx)("td",{className:"yoast-table--nopadding",colSpan:"3",children:(0,u.jsx)(x,{})}):(0,u.jsx)("td",{className:"yoast-table--nopadding",colSpan:"3",children:(0,u.jsx)("i",{children:(0,i.__)("Activate tracking to show the ranking position","wordpress-seo")})})}function q(t){var n;const{keyphrase:s,rowData:o,onTrackKeyphrase:r,onUntrackKeyphrase:i,isFocusKeyphrase:c,isDisabled:l,isLoading:p,isSelected:h,onSelectKeyphrases:y}=t,m=!(0,a.isEmpty)(o),f=!(0,a.isEmpty)(null==o||null===(n=o.position)||void 0===n?void 0:n.history),g=(0,e.useCallback)((()=>{l||(m?i(s,o.id):r(s))}),[s,r,i,m,o,l]),w=(0,e.useCallback)((()=>{y((e=>h?e.filter((e=>e!==s)):e.concat(s)))}),[y,h,s]);return(0,u.jsxs)(R,{isEnabled:m,children:[(0,u.jsx)(j,{children:f&&(0,u.jsx)(d.Checkbox,{id:"select-"+s,onChange:w,checked:h,label:""})}),(0,u.jsxs)(T,{children:[s,c&&(0,u.jsx)("span",{children:"*"})]}),A(t),(0,u.jsx)(_,{children:I({keyphrase:s,isEnabled:m,toggleAction:g,isLoading:p})})]})}P.propTypes={rowData:s().object},q.propTypes={rowData:s().object,keyphrase:s().string.isRequired,onTrackKeyphrase:s().func,onUntrackKeyphrase:s().func,isFocusKeyphrase:s().bool,isDisabled:s().bool,isLoading:s().bool,websiteId:s().string,isSelected:s().bool.isRequired,onSelectKeyphrases:s().func.isRequired},q.defaultProps={rowData:{},onTrackKeyphrase:()=>{},onUntrackKeyphrase:()=>{},isFocusKeyphrase:!1,isDisabled:!1,isLoading:!1,websiteId:""};const $=e=>{const t=(0,i.sprintf)(/* translators: %s expands to a link to open the Wincher login popup. */ (0,i.__)("It seems like something went wrong when retrieving your website's data. Please %s and try again.","wordpress-seo"),"{{reconnectToWincher/}}","Wincher");return(0,u.jsx)(d.Alert,{type:"error",className:e.className,children:(0,c.Z)({mixedString:t,components:{reconnectToWincher:(0,u.jsx)("a",{href:"#",onClick:t=>{t.preventDefault(),e.onReconnect()},children:(0,i.sprintf)(/* translators: %s : Expands to "Wincher". */ (0,i.__)("reconnect to %s","wordpress-seo"),"Wincher")})}})})};$.propTypes={onReconnect:s().func.isRequired,className:s().string},$.defaultProps={className:""};const W=$,F=window.yoast.styleGuide,O=window.wp.apiFetch;var H=n.n(O);async function B(e){try{return await H()(e)}catch(e){return e.error&&e.status?e:e instanceof Response&&await e.json()}}const K=r().p` color: ${F.colors.$color_pink_dark}; font-size: 14px; font-weight: 700; margin: 13px 0 10px; `,z=r()(d.SvgIcon)` margin-right: 5px; vertical-align: middle; `,M=r().button` position: absolute; top: 9px; right: 9px; border: none; background: none; cursor: pointer; `,V=r().p` font-size: 13px; font-weight: 500; margin: 10px 0 13px; `,G=r().div` position: relative; background: ${e=>e.isTitleShortened?"#F5F7F7":"transparent"}; border: 1px solid #C7C7C7; border-left: 4px solid${F.colors.$color_pink_dark}; padding: 0 16px; margin-bottom: 1.5em; `,Y=t=>{const[n,s]=(0,e.useState)(null);return(0,e.useEffect)((()=>{t&&!n&&async function(){return await B({path:"yoast/v1/wincher/account/limit",method:"GET"})}().then((e=>s(e)))}),[n]),n};Y.propTypes={limit:s().bool.isRequired};const U=({limit:e,usage:t,isTitleShortened:n,isFreeAccount:s})=>{const o=(0,i.sprintf)( /* Translators: %1$s expands to the number of used keywords. * %2$s expands to the account keywords limit. */ (0,i.__)("Your are tracking %1$s out of %2$s keyphrases included in your free account.","wordpress-seo"),t,e),r=(0,i.sprintf)( /* Translators: %1$s expands to the number of used keywords. * %2$s expands to the account keywords limit. */ (0,i.__)("Your are tracking %1$s out of %2$s keyphrases included in your account.","wordpress-seo"),t,e),a=s?o:r,c=(0,i.sprintf)( /* Translators: %1$s expands to the number of used keywords. * %2$s expands to the account keywords limit. */ (0,i.__)("Keyphrases tracked: %1$s/%2$s","wordpress-seo"),t,e),l=n?c:a;return(0,u.jsxs)(K,{children:[n&&(0,u.jsx)(z,{icon:"exclamation-triangle",color:F.colors.$color_pink_dark,size:"14px"}),l]})};U.propTypes={limit:s().number.isRequired,usage:s().number.isRequired,isTitleShortened:s().bool,isFreeAccount:s().bool};const Z=(0,l.makeOutboundLink)(),X=({discount:e,months:t})=>{const n=(0,u.jsx)(Z,{href:wpseoAdminGlobalL10n["links.wincher.upgrade"],style:{fontWeight:600},children:(0,i.sprintf)(/* Translators: %s : Expands to "Wincher". */ (0,i.__)("Click here to upgrade your %s plan","wordpress-seo"),"Wincher")});if(!e||!t)return(0,u.jsx)(V,{children:n});const s=100*e,o=(0,i.sprintf)( /* Translators: %1$s expands to upgrade account link. * %2$s expands to the upgrade discount value. * %3$s expands to the upgrade discount duration e.g. 2 months. */ (0,i.__)("%1$s and get an exclusive %2$s discount for %3$s month(s).","wordpress-seo"),"{{wincherAccountUpgradeLink/}}",s+"%",t);return(0,u.jsx)(V,{children:(0,c.Z)({mixedString:o,components:{wincherAccountUpgradeLink:n}})})};X.propTypes={discount:s().number,months:s().number};const J=({onClose:t,isTitleShortened:n,trackingInfo:s})=>{const o=(()=>{const[t,n]=(0,e.useState)(null);return(0,e.useEffect)((()=>{t||async function(){return await B({path:"yoast/v1/wincher/account/upgrade-campaign",method:"GET"})}().then((e=>n(e)))}),[t]),t})();if(null===s)return null;const{limit:r,usage:a}=s;if(!(r&&a/r>=.8))return null;const c=Boolean(null==o?void 0:o.discount);return(0,u.jsxs)(G,{isTitleShortened:n,children:[t&&(0,u.jsx)(M,{type:"button","aria-label":(0,i.__)("Close the upgrade callout","wordpress-seo"),onClick:t,children:(0,u.jsx)(d.SvgIcon,{icon:"times-circle",color:F.colors.$color_pink_dark,size:"14px"})}),(0,u.jsx)(U,{...s,isTitleShortened:n,isFreeAccount:c}),(0,u.jsx)(X,{discount:null==o?void 0:o.discount,months:null==o?void 0:o.months})]})};J.propTypes={onClose:s().func,isTitleShortened:s().bool,trackingInfo:s().object};const Q=J,ee=(0,l.makeOutboundLink)(),te=(0,l.makeOutboundLink)(),ne=(0,l.makeOutboundLink)(),se=(0,l.makeOutboundLink)(),oe=r().div` & .wincher-performance-report-alert { margin-bottom: 1em; } `,re=r().table` pointer-events: none; user-select: none; `,ie=r().div` position: relative; width: 100%; overflow-y: auto; `,ae=r().div` margin: 0; -webkit-filter: blur(4px); -moz-filter: blur(4px); -o-filter: blur(4px); -ms-filter: blur(4px); filter: blur(4px); `,ce=r().p` top: 47%; left: 50%; position: absolute; `,le=e=>{const{websiteId:t,id:n}=e;return`https://app.wincher.com/websites/${t}/keywords?serp=${n}&utm_medium=plugin&utm_source=yoast&referer=yoast&partner=yoast`},de=e=>{const{isLoggedIn:t,onConnectAction:n}=e;return t?null:(0,u.jsx)(ce,{children:(0,u.jsx)(d.NewButton,{onClick:n,variant:"primary",style:{left:"-50%",backgroundColor:"#2371B0"},children:(0,i.sprintf)(/* translators: %s expands to Wincher */ (0,i.__)("Connect with %s","wordpress-seo"),"Wincher")})})};de.propTypes={isLoggedIn:s().bool.isRequired,onConnectAction:s().func.isRequired};const ue=({isBlurred:e,children:t})=>e?(0,u.jsx)("td",{children:(0,u.jsx)(ae,{children:t})}):(0,u.jsx)("td",{children:t});ue.propTypes={isBlurred:s().bool,children:s().oneOfType([s().string,s().number,s().object])};const pe=({keyphrase:e,websiteId:t,isBlurred:n})=>{const{id:s,keyword:o}=e;return(0,u.jsxs)("tr",{children:[(0,u.jsx)(ue,{isBlurred:n,children:o}),(0,u.jsx)(ue,{isBlurred:n,children:N(e)}),(0,u.jsx)(ue,{isBlurred:n,className:"yoast-table--nopadding",children:(0,u.jsx)(E,{chartData:e})}),(0,u.jsx)(ue,{isBlurred:n,className:"yoast-table--nobreak",children:(0,u.jsx)(ee,{href:le({websiteId:t,id:s}),children:(0,i.__)("View","wordpress-seo")})})]})};pe.propTypes={keyphrase:s().object.isRequired,websiteId:s().string.isRequired,isBlurred:s().bool};const he=()=>(0,u.jsx)(d.Alert,{type:"error",className:"wincher-performance-report-alert",children:(0,i.__)("Network Error: Unable to connect to the server. Please check your internet connection and try again later.","wordpress-seo")}),ye=e=>{const{data:t}=e;return!(0,a.isEmpty)(t)&&(0,a.isEmpty)(t.results)?(0,u.jsx)(d.Alert,{type:"success",className:"wincher-performance-report-alert",children:(0,i.sprintf)(/* translators: %1$s and %2$s: Expands to "Wincher". */ (0,i.__)('You have successfully connected with %1$s. Your %2$s account does not contain any keyphrases for this website yet. You can track keyphrases by using the "Track SEO Performance" button in the post editor.',"wordpress-seo"),"Wincher","Wincher")}):(0,u.jsx)(d.Alert,{type:"success",className:"wincher-performance-report-alert",children:(0,i.sprintf)(/* translators: %s: Expands to "Wincher". */ (0,i.__)("You have successfully connected with %s.","wordpress-seo"),"Wincher")})};ye.propTypes={data:s().object.isRequired};const me=e=>{const{data:t,onConnectAction:n,isConnectSuccess:s,isNetworkError:o,isFailedRequest:r}=e;return o?(0,u.jsx)(he,{data:t}):s?(0,u.jsx)(ye,{data:t}):r?(0,u.jsx)(W,{onReconnect:n,className:"wincher-performance-report-alert"}):null};me.propTypes={data:s().object.isRequired,onConnectAction:s().func.isRequired,isConnectSuccess:s().bool.isRequired,isNetworkError:s().bool.isRequired,isFailedRequest:s().bool.isRequired};const fe=e=>{const{data:t,isNetworkError:n,isConnectSuccess:s}=e,o=(e=>e&&[401,403,404].includes(e.status))(t);return n||s||o?(0,u.jsx)(me,{...e,isFailedRequest:o}):!t||(0,a.isEmpty)(t.results)?(0,u.jsx)(h,{className:"wincher-performance-report-alert"}):null};fe.propTypes={data:s().object.isRequired,onConnectAction:s().func.isRequired,isConnectSuccess:s().bool.isRequired,isNetworkError:s().bool.isRequired};const ge=({isLoggedIn:e})=>{const t=(0,i.sprintf)(/* translators: %s expands to a link to Wincher login */ (0,i.__)("This overview only shows you keyphrases added to Yoast SEO. There may be other keyphrases added to your %s.","wordpress-seo"),"{{wincherAccountLink/}}"),n=(0,i.sprintf)(/* translators: %s expands to a link to Wincher login */ (0,i.__)("This overview will show you your top performing keyphrases in Google. Connect with %s to get started.","wordpress-seo"),"{{wincherLink/}}"),s=e?t:n;return(0,u.jsx)("p",{children:(0,c.Z)({mixedString:s,components:{wincherAccountLink:(0,u.jsx)(ne,{href:wpseoAdminGlobalL10n["links.wincher.login"],children:(0,i.sprintf)(/* translators: %s : Expands to "Wincher". */ (0,i.__)("%s account","wordpress-seo"),"Wincher")}),wincherLink:(0,u.jsx)(se,{href:wpseoAdminGlobalL10n["links.wincher.about"],children:"Wincher"})}})})};ge.propTypes={isLoggedIn:s().bool.isRequired};const we={results:[{id:0,keyword:"wincher",position:{value:84,history:[{value:90},{value:89},{value:94},{value:98},{value:84}]}},{id:1,keyword:"rank tracker",position:{value:20,history:[{value:50},{value:30},{value:66},{value:15},{value:20}]}},{id:2,keyword:"performance",position:{value:2,history:[{value:44},{value:66},{value:18},{value:31},{value:2}]}}]},be=({isBlurred:e,children:t})=>e?(0,u.jsx)(re,{className:"yoast yoast-table",children:t}):(0,u.jsx)("table",{className:"yoast yoast-table",children:t});be.propTypes={isBlurred:s().bool,children:s().any};const xe=t=>{const{className:n,websiteId:s,isLoggedIn:o,onConnectAction:r,isConnectSuccess:c}=t,l=o?t.data:we,d=!o,p=(e=>e&&!(0,a.isEmpty)(e)&&!(0,a.isEmpty)(e.results))(l),h=Y(o);return(0,u.jsxs)(oe,{className:n,children:[o&&(0,u.jsx)(Q,{isTitleShortened:!0,trackingInfo:h}),(0,u.jsx)(fe,{...t,data:l,isConnectSuccess:c&&o}),p&&(0,u.jsxs)(e.Fragment,{children:[(0,u.jsx)(ge,{isLoggedIn:o}),(0,u.jsxs)(ie,{children:[(0,u.jsxs)(be,{isBlurred:d,children:[(0,u.jsx)("thead",{children:(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{scope:"col",abbr:(0,i.__)("Keyphrase","wordpress-seo"),children:(0,i.__)("Keyphrase","wordpress-seo")}),(0,u.jsx)("th",{scope:"col",abbr:(0,i.__)("Position","wordpress-seo"),children:(0,i.__)("Position","wordpress-seo")}),(0,u.jsx)("th",{scope:"col",abbr:(0,i.__)("Position over time","wordpress-seo"),children:(0,i.__)("Position over time","wordpress-seo")}),(0,u.jsx)("td",{className:"yoast-table--nobreak"})]})}),(0,u.jsx)("tbody",{children:(0,a.map)(l.results,((e,t)=>(0,u.jsx)(pe,{keyphrase:e,websiteId:s,isBlurred:d},`keyphrase-${t}`)))})]}),(0,u.jsx)(de,{isLoggedIn:o,onConnectAction:r})]}),(0,u.jsx)("p",{style:{marginBottom:0,position:"relative"},children:(0,u.jsx)(te,{href:wpseoAdminGlobalL10n["links.wincher.login"],children:(0,i.sprintf)(/* translators: %s expands to Wincher */ (0,i.__)("Get more insights over at %s","wordpress-seo"),"Wincher")})})]})]})};xe.propTypes={className:s().string,data:s().object.isRequired,websiteId:s().string.isRequired,isLoggedIn:s().bool.isRequired,isConnectSuccess:s().bool.isRequired,isNetworkError:s().bool.isRequired,onConnectAction:s().func.isRequired},xe.defaultProps={className:"wincher-seo-performance"};const ve=xe;class ke{constructor(e,t={},n={}){this.url=e,this.origin=new URL(e).origin,this.eventHandlers=Object.assign({success:{type:"",callback:()=>{}},error:{type:"",callback:()=>{}}},t),this.options=Object.assign({height:570,width:340,title:""},n),this.popup=null,this.createPopup=this.createPopup.bind(this),this.messageHandler=this.messageHandler.bind(this),this.getPopup=this.getPopup.bind(this)}createPopup(){const{height:e,width:t,title:n}=this.options,s=["top="+(window.top.outerHeight/2+window.top.screenY-e/2),"left="+(window.top.outerWidth/2+window.top.screenX-t/2),"width="+t,"height="+e,"resizable=1","scrollbars=1","status=0"];this.popup&&!this.popup.closed||(this.popup=window.open(this.url,n,s.join(","))),this.popup&&this.popup.focus(),window.addEventListener("message",this.messageHandler,!1)}async messageHandler(e){const{data:t,source:n,origin:s}=e;s===this.origin&&this.popup===n&&(t.type===this.eventHandlers.success.type&&(this.popup.close(),window.removeEventListener("message",this.messageHandler,!1),await this.eventHandlers.success.callback(t)),t.type===this.eventHandlers.error.type&&(this.popup.close(),window.removeEventListener("message",this.messageHandler,!1),await this.eventHandlers.error.callback(t)))}getPopup(){return this.popup}isClosed(){return!this.popup||this.popup.closed}focus(){this.isClosed()||this.popup.focus()}}class je extends e.Component{constructor(){super(),this.state={wincherData:{},wincherWebsiteId:wpseoWincherDashboardWidgetL10n.wincher_website_id,wincherIsLoggedIn:"1"===wpseoWincherDashboardWidgetL10n.wincher_is_logged_in,isDataFetched:!1,isConnectSuccess:!1,isNetworkError:!1},this.onConnect=this.onConnect.bind(this),this.getWincherData=this.getWincherData.bind(this),this.performAuthenticationRequest=this.performAuthenticationRequest.bind(this),this.onConnectSuccess=this.onConnectSuccess.bind(this),this.onNetworkDisconnectionError=this.onNetworkDisconnectionError.bind(this)}componentDidMount(){const e=jQuery("#wpseo-wincher-dashboard-overview-hide");e.is(":checked")&&this.fetchData(),e.on("click",(()=>{this.fetchData()}))}fetchData(){this.state.isDataFetched||(this.state.wincherIsLoggedIn&&this.getWincherData(),this.setState({isDataFetched:!0}))}async getWincherData(){const e=await async function(e=null,t=null,n=null,s){return await B({path:"yoast/v1/wincher/keyphrases",method:"POST",data:{keyphrases:e,permalink:n,startAt:t},signal:s})}();if(200===e.status){const t=(0,a.filter)(e.results,(e=>!(0,a.isEmpty)(e.position))),n=(0,a.sortBy)(t,(e=>e.position.value)).splice(0,5);this.setState({wincherData:{results:n,status:e.status}})}else this.setState({wincherData:{results:[],status:e.status}})}async performAuthenticationRequest(e){if(200!==(await async function(e){const{code:t,websiteId:n}=e;return await B({path:"yoast/v1/wincher/authenticate",method:"POST",data:{code:t,websiteId:n}})}(e)).status)return;this.setState({wincherIsLoggedIn:!0,wincherWebsiteId:e.websiteId.toString()}),await this.getWincherData();const t=this.loginPopup.getPopup();t&&t.close()}async onConnectSuccess(e){this.setState({isConnectSuccess:!0,isNetworkError:!1}),await this.performAuthenticationRequest(e)}async onNetworkDisconnectionError(){this.setState({isConnectSuccess:!1,isNetworkError:!0})}async onConnect(){if(this.loginPopup&&!this.loginPopup.isClosed())return void this.loginPopup.focus();const{url:e}=await async function(){return await B({path:"yoast/v1/wincher/authorization-url",method:"GET"})}();e&&void 0!==e?(this.loginPopup=new ke(e,{success:{type:"wincher:oauth:success",callback:e=>this.onConnectSuccess(e)},error:{type:"wincher:oauth:error",callback:()=>{}}},{title:"Wincher_login",width:500,height:700}),this.loginPopup.createPopup()):this.onNetworkDisconnectionError()}render(){return(0,u.jsx)(ve,{data:this.state.wincherData,websiteId:this.state.wincherWebsiteId,isLoggedIn:this.state.wincherIsLoggedIn,isConnectSuccess:this.state.isConnectSuccess,isNetworkError:this.state.isNetworkError,onConnectAction:this.onConnect},"wincher-performance-report")}}const Te=document.getElementById("yoast-seo-wincher-dashboard-widget");Te&&(0,e.createRoot)(Te).render((0,u.jsx)(je,{}))})()})();