diff --git a/build/content-helper/editor-sidebar.asset.php b/build/content-helper/editor-sidebar.asset.php
index 2ccd17711..379d92e26 100644
--- a/build/content-helper/editor-sidebar.asset.php
+++ b/build/content-helper/editor-sidebar.asset.php
@@ -1 +1 @@
- array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => 'bdcf78fb4b4054d8bf81');
+ array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => '1fd817a371f72b1f5217');
diff --git a/build/content-helper/editor-sidebar.js b/build/content-helper/editor-sidebar.js
index 177ac7823..10cd6dd04 100644
--- a/build/content-helper/editor-sidebar.js
+++ b/build/content-helper/editor-sidebar.js
@@ -1,5 +1,5 @@
-!function(){"use strict";var e={251:function(e,t,n){var r=n(196),s=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,i={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!o.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:s,type:e,key:c,ref:u,props:i,_owner:l.current}}t.Fragment=i,t.jsx=c,t.jsxs=c},893:function(e,t,n){e.exports=n(251)},196:function(e){e.exports=window.React}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){n.d({},{W:function(){return Et}});var e,t,r,s=n(893),i=window.wp.components,a=window.wp.data,l=window.wp.editPost,o=window.wp.element,c=window.wp.i18n,u=n(196),p=window.wp.primitives,d=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{fillRule:"evenodd",d:"M11.25 5h1.5v15h-1.5V5zM6 10h1.5v10H6V10zm12 4h-1.5v6H18v-6z",clipRule:"evenodd"})),f=window.wp.plugins,h=function(){function e(){this._tkq=[],this.isLoaded=!1,this.isEnabled=!1,"undefined"!=typeof wpParselyTracksTelemetry&&(this.isEnabled=!0,this.loadTrackingLibrary())}return e.getInstance=function(){return window.wpParselyTelemetryInstance||Object.defineProperty(window,"wpParselyTelemetryInstance",{value:new e,writable:!1,configurable:!1,enumerable:!1}),window.wpParselyTelemetryInstance},e.prototype.loadTrackingLibrary=function(){var e=this,t=document.createElement("script");t.async=!0,t.src="//stats.wp.com/w.js",t.onload=function(){e.isLoaded=!0,e._tkq=window._tkq||[]},document.head.appendChild(t)},e.trackEvent=function(t,n){return void 0===n&&(n={}),r=this,s=void 0,a=function(){var r;return function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(o){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&l[0]?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[2&l[0],s.value]),l[0]){case 0:case 1:s=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]=1e4&&(clearInterval(i),n("Telemetry library not loaded"))}),100);else n("Telemetry not enabled")}))},e.prototype.trackEvent=function(t,n){var r;this.isLoaded?(0!==t.indexOf(e.TRACKS_PREFIX)&&(t=e.TRACKS_PREFIX+t),this.isEventNameValid(t)?(n=this.prepareProperties(n),null===(r=this._tkq)||void 0===r||r.push(["recordEvent",t,n])):console.error("Error tracking event: Invalid event name")):console.error("Error tracking event: Telemetry not loaded")},e.prototype.isTelemetryEnabled=function(){return this.isEnabled},e.prototype.isProprietyValid=function(t){return e.PROPERTY_REGEX.test(t)},e.prototype.isEventNameValid=function(t){return e.EVENT_NAME_REGEX.test(t)},e.prototype.prepareProperties=function(e){return(e=this.sanitizeProperties(e)).parsely_version=wpParselyTracksTelemetry.version,wpParselyTracksTelemetry.user&&(e._ut=wpParselyTracksTelemetry.user.type,e._ui=wpParselyTracksTelemetry.user.id),wpParselyTracksTelemetry.vipgo_env&&(e.vipgo_env=wpParselyTracksTelemetry.vipgo_env),this.sanitizeProperties(e)},e.prototype.sanitizeProperties=function(e){var t=this,n={};return Object.keys(e).forEach((function(r){t.isProprietyValid(r)&&(n[r]=e[r])})),n},e.TRACKS_PREFIX="wpparsely_",e.EVENT_NAME_REGEX=/^(([a-z0-9]+)_){2}([a-z0-9_]+)$/,e.PROPERTY_REGEX=/^[a-z_][a-z0-9_]*$/,e}(),y=(h.trackEvent,window.wp.compose),g=(0,o.forwardRef)((function({icon:e,size:t=24,...n},r){return(0,o.cloneElement)(e,{width:t,height:t,...n,ref:r})})),v=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),m=function(){return(0,s.jsxs)(i.SVG,{"aria-hidden":"true",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:[(0,s.jsx)(i.G,{transform:"matrix(1, 0, 0, 1, 1.7763568394002505e-15, 0)"}),(0,s.jsx)(i.Path,{d:"M 16.693 6.167 A 4.541 4.541 0 0 1 12.152 10.708 A 4.541 4.541 0 0 1 7.611 6.167 A 4.541 4.541 0 0 1 12.152 1.626 A 4.541 4.541 0 0 1 16.693 6.167 Z",style:{fill:"rgba(216, 216, 216, 0)",fillOpacity:0,strokeWidth:"2.5px",stroke:"rgb(0, 0, 0)"}}),(0,s.jsx)(i.Path,{d:"M 3.016 23.76 L 3.0135 22.4385 C 3.0109999999999997 21.117 3.0060000000000002 18.474 3.3204999999999996 16.911 C 3.635 15.347999999999999 4.268999999999999 14.865 7.068666666666666 14.6235 C 9.868333333333332 14.382 14.833666666666666 14.382 17.585833333333333 14.658 C 20.337999999999997 14.934 20.877 15.485999999999999 21.1465 17.0435 C 21.416 18.601 21.416 21.164 21.416 22.4455 L 21.416 23.727",style:{fillOpacity:0,fill:"rgb(255, 255, 255)",strokeWidth:"2.5px",stroke:"rgb(0, 0, 0)"}})]})},w={journalist:{label:(0,c.__)("Journalist","wp-parsely"),emoji:"π°"},editorialWriter:{label:(0,c.__)("Editorial Writer","wp-parsely"),emoji:"βοΈ"},investigativeReporter:{label:(0,c.__)("Investigative Reporter","wp-parsely"),emoji:"π΅οΈ"},techAnalyst:{label:(0,c.__)("Tech Analyst","wp-parsely"),emoji:"π»"},businessAnalyst:{label:(0,c.__)("Business Analyst","wp-parsely"),emoji:"π"},culturalCommentator:{label:(0,c.__)("Cultural Commentator","wp-parsely"),emoji:"π"},scienceCorrespondent:{label:(0,c.__)("Science Correspondent","wp-parsely"),emoji:"π¬"},politicalAnalyst:{label:(0,c.__)("Political Analyst","wp-parsely"),emoji:"ποΈ"},healthWellnessAdvocate:{label:(0,c.__)("Health and Wellness Advocate","wp-parsely"),emoji:"π"},environmentalJournalist:{label:(0,c.__)("Environmental Journalist","wp-parsely"),emoji:"π³"},custom:{label:(0,c.__)("Use a custom persona","wp-parsely"),emoji:"π§"}},_=Object.keys(w),b=function(e){return"custom"===e||""===e?w.custom.label:x(e)?e:w[e].label},x=function(e){return!_.includes(e)||"custom"===e},P=function(e){var t=e.value,n=e.onChange,r=(0,o.useState)(""),a=r[0],l=r[1],u=(0,y.useDebounce)(n,500);return(0,s.jsx)("div",{className:"parsely-persona-selector-custom",children:(0,s.jsx)(i.TextControl,{value:a||t,onChange:function(e){if(""===e)return n(""),void l("");e.length>32&&(e=e.slice(0,32)),u(e),l(e)},help:(0,c.__)("Enter a custom persona","wp-parsely")})})},S=function(e){var t=e.persona,n=e.label,r=void 0===n?(0,c.__)("Select a persona","wp-parsely"):n,a=e.onChange,l=e.onDropdownChange,o=e.disabled,u=void 0!==o&&o,p=e.allowCustom,d=void 0!==p&&p;return(0,s.jsxs)(i.Disabled,{isDisabled:u,children:[(0,s.jsx)(i.DropdownMenu,{label:(0,c.__)("Persona","wp-parsely"),icon:m,className:"parsely-persona-selector-dropdown"+(u?" is-disabled":""),popoverProps:{className:"wp-parsely-popover"},toggleProps:{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"parsely-persona-selector-label",children:r}),(0,s.jsx)(g,{icon:v})]})},children:function(e){var n=e.onClose;return(0,s.jsx)(i.MenuGroup,{label:(0,c.__)("Select a persona","wp-parsely"),children:(0,s.jsx)(s.Fragment,{children:_.map((function(e){if(!d&&"custom"===e)return null;var r=w[e];return(0,s.jsxs)(i.MenuItem,{isSelected:e===t,className:e===t?"is-selected":"",role:"menuitemradio",onClick:function(){null==l||l(e),a(e),n()},children:[r.emoji," ",r.label]},e)}))})})}}),d&&x(t)&&(0,s.jsx)(P,{onChange:function(e){a(""!==e?e:"custom")},value:"custom"===t?"":t})]})},j=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{fillRule:"evenodd",d:"M6.863 13.644L5 13.25h-.5a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5H5L18 6.5h2V16h-2l-3.854-.815.026.008a3.75 3.75 0 01-7.31-1.549zm1.477.313a2.251 2.251 0 004.356.921l-4.356-.921zm-2.84-3.28L18.157 8h.343v6.5h-.343L5.5 11.823v-1.146z",clipRule:"evenodd"})),k={neutral:{label:(0,c.__)("Neutral","wp-parsely"),emoji:"π"},formal:{label:(0,c.__)("Formal","wp-parsely"),emoji:"π©"},humorous:{label:(0,c.__)("Humorous","wp-parsely"),emoji:"π"},confident:{label:(0,c.__)("Confident","wp-parsely"),emoji:"π"},provocative:{label:(0,c.__)("Provocative","wp-parsely"),emoji:"π"},serious:{label:(0,c.__)("Serious","wp-parsely"),emoji:"π§"},inspirational:{label:(0,c.__)("Inspirational","wp-parsely"),emoji:"β¨"},skeptical:{label:(0,c.__)("Skeptical","wp-parsely"),emoji:"π€¨"},conversational:{label:(0,c.__)("Conversational","wp-parsely"),emoji:"π¬"},analytical:{label:(0,c.__)("Analytical","wp-parsely"),emoji:"π€"},custom:{label:(0,c.__)("Use a custom tone","wp-parsely"),emoji:"π§"}},T=Object.keys(k),E=function(e){return"custom"===e||""===e?k.custom.label:L(e)?e:k[e].label},L=function(e){return!T.includes(e)||"custom"===e},C=function(e){var t=e.value,n=e.onChange,r=(0,o.useState)(""),a=r[0],l=r[1],u=(0,y.useDebounce)(n,500);return(0,s.jsx)("div",{className:"parsely-tone-selector-custom",children:(0,s.jsx)(i.TextControl,{value:a||t,onChange:function(e){if(""===e)return n(""),void l("");e.length>32&&(e=e.slice(0,32)),u(e),l(e)},help:(0,c.__)("Enter a custom tone","wp-parsely")})})},N=function(e){var t=e.tone,n=e.label,r=void 0===n?(0,c.__)("Select a tone","wp-parsely"):n,a=e.onChange,l=e.onDropdownChange,o=e.disabled,u=void 0!==o&&o,p=e.allowCustom,d=void 0!==p&&p;return(0,s.jsxs)(i.Disabled,{isDisabled:u,children:[(0,s.jsx)(i.DropdownMenu,{label:(0,c.__)("Tone","wp-parsely"),icon:j,className:"parsely-tone-selector-dropdown"+(u?" is-disabled":""),popoverProps:{className:"wp-parsely-popover"},toggleProps:{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"parsely-tone-selector-label",children:r}),(0,s.jsx)(g,{icon:v})]})},children:function(e){var n=e.onClose;return(0,s.jsx)(i.MenuGroup,{label:(0,c.__)("Select a tone","wp-parsely"),children:(0,s.jsx)(s.Fragment,{children:T.map((function(e){if(!d&&"custom"===e)return null;var r=k[e];return(0,s.jsxs)(i.MenuItem,{isSelected:e===t,className:e===t?"is-selected":"",role:"menuitemradio",onClick:function(){null==l||l(e),a(e),n()},children:[r.emoji," ",r.label]},e)}))})})}}),d&&L(t)&&(0,s.jsx)(C,{onChange:function(e){a(""!==e?e:"custom")},value:"custom"===t?"":t})]})},O=function(){return(0,s.jsx)(i.SVG,{"aria-hidden":"true",version:"1.1",viewBox:"0 0 15 15",width:"15",height:"15",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(i.Path,{d:"M0 14.0025V11.0025L7.5 3.5025L10.5 6.5025L3 14.0025H0ZM12 5.0025L13.56 3.4425C14.15 2.8525 14.15 1.9025 13.56 1.3225L12.68 0.4425C12.09 -0.1475 11.14 -0.1475 10.56 0.4425L9 2.0025L12 5.0025Z"})})},A=function(e){var t=e.size,n=void 0===t?24:t,r=e.className,a=void 0===r?"wp-parsely-icon":r;return(0,s.jsxs)(i.SVG,{className:a,height:n,viewBox:"0 0 60 65",width:n,xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)(i.Path,{fill:"#5ba745",d:"M23.72,51.53c0-.18,0-.34-.06-.52a13.11,13.11,0,0,0-2.1-5.53A14.74,14.74,0,0,0,19.12,43c-.27-.21-.5-.11-.51.22l-.24,3.42c0,.33-.38.35-.49,0l-1.5-4.8a1.4,1.4,0,0,0-.77-.78,23.91,23.91,0,0,0-3.1-.84c-1.38-.24-3.39-.39-3.39-.39-.34,0-.45.21-.25.49l2.06,3.76c.2.27,0,.54-.29.33l-4.51-3.6a3.68,3.68,0,0,0-2.86-.48c-1,.16-2.44.46-2.44.46a.68.68,0,0,0-.39.25.73.73,0,0,0-.14.45S.41,43,.54,44a3.63,3.63,0,0,0,1.25,2.62L6.48,50c.28.2.09.49-.23.37l-4.18-.94c-.32-.12-.5,0-.4.37,0,0,.69,1.89,1.31,3.16a24,24,0,0,0,1.66,2.74,1.34,1.34,0,0,0,1,.52l5,.13c.33,0,.41.38.1.48L7.51,58c-.31.1-.34.35-.07.55a14.29,14.29,0,0,0,3.05,1.66,13.09,13.09,0,0,0,5.9.5,25.13,25.13,0,0,0,4.34-1,9.55,9.55,0,0,1-.08-1.2,9.32,9.32,0,0,1,3.07-6.91"}),(0,s.jsx)(i.Path,{fill:"#5ba745",d:"M59.7,41.53a.73.73,0,0,0-.14-.45.68.68,0,0,0-.39-.25s-1.43-.3-2.44-.46a3.64,3.64,0,0,0-2.86.48l-4.51,3.6c-.26.21-.49-.06-.29-.33l2.06-3.76c.2-.28.09-.49-.25-.49,0,0-2,.15-3.39.39a23.91,23.91,0,0,0-3.1.84,1.4,1.4,0,0,0-.77.78l-1.5,4.8c-.11.32-.48.3-.49,0l-.24-3.42c0-.33-.24-.43-.51-.22a14.74,14.74,0,0,0-2.44,2.47A13.11,13.11,0,0,0,36.34,51c0,.18,0,.34-.06.52a9.26,9.26,0,0,1,3,8.1,24.1,24.1,0,0,0,4.34,1,13.09,13.09,0,0,0,5.9-.5,14.29,14.29,0,0,0,3.05-1.66c.27-.2.24-.45-.07-.55l-3.22-1.17c-.31-.1-.23-.47.1-.48l5-.13a1.38,1.38,0,0,0,1-.52A24.6,24.6,0,0,0,57,52.92c.61-1.27,1.31-3.16,1.31-3.16.1-.33-.08-.49-.4-.37l-4.18.94c-.32.12-.51-.17-.23-.37l4.69-3.34A3.63,3.63,0,0,0,59.46,44c.13-1,.24-2.47.24-2.47"}),(0,s.jsx)(i.Path,{fill:"#5ba745",d:"M46.5,25.61c0-.53-.35-.72-.8-.43l-4.86,2.66c-.45.28-.56-.27-.23-.69l4.66-6.23a2,2,0,0,0,.28-1.68,36.51,36.51,0,0,0-2.19-4.89,34,34,0,0,0-2.81-3.94c-.33-.41-.74-.35-.91.16l-2.28,5.68c-.16.5-.6.48-.59-.05l.28-8.93a2.54,2.54,0,0,0-.66-1.64S35,4.27,33.88,3.27,30.78.69,30.78.69a1.29,1.29,0,0,0-1.54,0s-1.88,1.49-3.12,2.59-2.48,2.35-2.48,2.35A2.5,2.5,0,0,0,23,7.27l.27,8.93c0,.53-.41.55-.58.05l-2.29-5.69c-.17-.5-.57-.56-.91-.14a35.77,35.77,0,0,0-3,4.2,35.55,35.55,0,0,0-2,4.62,2,2,0,0,0,.27,1.67l4.67,6.24c.33.42.23,1-.22.69l-4.87-2.66c-.45-.29-.82-.1-.82.43a18.6,18.6,0,0,0,.83,5.07,20.16,20.16,0,0,0,5.37,7.77c3.19,3,5.93,7.8,7.45,11.08A9.6,9.6,0,0,1,30,49.09a9.31,9.31,0,0,1,2.86.45c1.52-3.28,4.26-8.11,7.44-11.09a20.46,20.46,0,0,0,5.09-7,19,19,0,0,0,1.11-5.82"}),(0,s.jsx)(i.Path,{fill:"#5ba745",d:"M36.12,58.44A6.12,6.12,0,1,1,30,52.32a6.11,6.11,0,0,1,6.12,6.12"})]})},R=function(){return R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n".concat(this.message,"
").concat(this.hint?this.hint:"")}))},t.prototype.Hint=function(e){return''.concat((0,c.__)("Hint:","wp-parsely")," ").concat(e,"
")},t}(Error),ue=function(){function e(){}return e.generateSmartLinks=function(e,t,n){var r,s,i,a,l;return void 0===t&&(t=be),void 0===n&&(n=_e),s=this,i=void 0,l=function(){var s,i;return function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(o){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&l[0]?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[2&l[0],s.value]),l[0]){case 0:case 1:s=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0)){var e={maxLinksPerPost:p.SmartLinkingMaxLinks,maxLinkWords:p.SmartLinkingMaxLinkWords,settingsOpen:p.SmartLinkingSettingsOpen};A(e)}}),[A,p]);var R=(0,a.useSelect)((function(e){var t=e("core/block-editor"),r=t.getSelectedBlock,s=t.getBlock,i=e("core/editor").getEditedPostContent;return{selectedBlock:n?s(n):r(),postContent:i()}}),[n]),I=R.selectedBlock,B=R.postContent;(0,o.useEffect)((function(){g(null)}),[I]);var M=function(e){return void 0===e&&(e="all"),fe(void 0,void 0,void 0,(function(){var t;return he(this,(function(n){switch(n.label){case 0:return[4,O(e)];case 1:return n.sent(),l===de.BlockInspector&&("all"===e||w?(t=(0,a.select)("core/block-editor").getBlockOrder()[0],(0,a.dispatch)("core/block-editor").selectBlock(t)):(0,a.dispatch)("core/block-editor").selectBlock(e)),0===_.length&&D(),[2]}}))}))},F=function(){(0,a.dispatch)("core/editor").lockPostSaving("wp-parsely-block-overlay"),document.querySelectorAll('.edit-post-header__settings>[type="button"]').forEach((function(e){e.setAttribute("disabled","disabled")}))},D=function(){document.querySelectorAll('.edit-post-header__settings>[type="button"]').forEach((function(e){e.removeAttribute("disabled")})),(0,a.dispatch)("core/editor").unlockPostSaving("wp-parsely-block-overlay")};return(0,s.jsx)("div",{className:"wp-parsely-smart-linking",children:(0,s.jsxs)(i.PanelRow,{className:t,children:[(0,s.jsxs)("div",{className:"wp-parsely-smart-linking-text",children:[(0,c.__)("Automatically insert links to your most relevant, top performing content.","wp-parsely"),"Β ",(0,s.jsx)("a",{href:"https://docs.parse.ly/plugin-content-helper/#h-smart-linking-beta",children:(0,c.__)("Learn how Smart Linking works.","wp-parsely")})]}),b&&(0,s.jsx)(i.Notice,{status:"info",isDismissible:!1,className:"wp-parsely-content-helper-error",children:b.message}),null!==x&&(0,s.jsx)(i.Notice,{status:"success",isDismissible:!1,className:"wp-parsely-smart-linking-suggested-links",children:/* translators: 1 - number of smart links generated */
-(0,c.sprintf)((0,c.__)("Successfully added %s smart links.","wp-parsely"),x.length)}),(0,s.jsx)(ae,{disabled:m,onSettingChange:function(e,t){var n,r;d(((n={})[e]=t,n)),A(((r={})[e]=t,r))}}),(0,s.jsxs)("div",{className:"wp-parsely-smart-linking-generate",children:[(0,s.jsx)(i.Button,{onClick:function(){return fe(void 0,void 0,void 0,(function(){var e,t,n,r,s;return he(this,(function(i){switch(i.label){case 0:return[4,T(!0)];case 1:return i.sent(),[4,C(null)];case 2:return i.sent(),[4,L(null)];case 3:return i.sent(),h.trackEvent("smart_linking_generate_pressed",{is_full_content:w,selected_block:null!==(s=null==I?void 0:I.name)&&void 0!==s?s:"none",context:l}),[4,(o=w?"all":null==I?void 0:I.clientId,void 0===o&&(o="all"),fe(void 0,void 0,void 0,(function(){return he(this,(function(e){switch(e.label){case 0:return[4,N(o)];case 1:return e.sent(),F(),[2]}}))})))];case 4:i.sent(),e=setTimeout((function(){var e;T(!1),h.trackEvent("smart_linking_generate_timeout",{is_full_content:w,selected_block:null!==(e=null==I?void 0:I.name)&&void 0!==e?e:"none",context:l}),M(w?"all":null==I?void 0:I.clientId)}),6e4),i.label=5;case 5:return i.trys.push([5,11,12,15]),t=w||!I,n=[],!(null==I?void 0:I.originalContent)||t?[3,7]:[4,ue.generateSmartLinks(null==I?void 0:I.originalContent,S,P)];case 6:return n=i.sent(),[3,9];case 7:return[4,ue.generateSmartLinks(B,S,P)];case 8:n=i.sent(),i.label=9;case 9:return[4,C(n)];case 10:return i.sent(),function(e){var t;h.trackEvent("smart_linking_applied",{is_full_content:w,selected_block:null!==(t=null==I?void 0:I.name)&&void 0!==t?t:"none",links_count:e.length,context:l});for(var n="",r=n=I&&!w?I.attributes.content:B,s=0,i=e;s(null==p?void 0:p.length)&&o.offset++;var d='').concat(o.text,"");r=pe(r,new RegExp("(".concat(o.text,"|]*>").concat(o.text,")")),d,o.offset)}}I&&!w?(0,a.dispatch)("core/block-editor").updateBlockAttributes(I.clientId,{content:r}):(0,a.dispatch)("core/editor").editPost({content:r})}(n),[3,15];case 11:return r=i.sent(),L(r),[3,15];case 12:return[4,T(!1)];case 13:return i.sent(),[4,M(w?"all":null==I?void 0:I.clientId)];case 14:return i.sent(),clearTimeout(e),[7];case 15:return[2]}var o}))}))},variant:"primary",isBusy:m,disabled:m,children:m?(0,c.__)("Generatingβ¦","wp-parsely"):(0,c.__)("Add Smart Links","wp-parsely")}),y&&(0,s.jsxs)(i.Notice,{status:"warning",isDismissible:!0,onRemove:function(){return g(null)},className:"wp-parsely-smart-linking-hint",children:[(0,s.jsx)("strong",{children:(0,c.__)("Hint:","wp-parsely")})," ",y]}),(0,s.jsx)(i.Disabled,{isDisabled:m,children:(0,s.jsx)(i.CheckboxControl,{checked:!I||w,disabled:m,onClick:function(){I||g((0,c.__)("If you want to target a specific block, you should select it on the block editor.","wp-parsely"))},onChange:I?E:function(){},label:(0,c.__)("Add smart links for the entire post","wp-parsely")})})]})]})})},ge=function(){return ge=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=c){var u=t;(s=r/c)%1>1/l&&(u=s>10?1:2),u=parseFloat(s.toFixed(2))===parseFloat(s.toFixed(0))?0:u,i=s.toFixed(u),a=o}l=c})),i+n+a}var ke={month:"short",day:"numeric",year:"numeric"},Te={month:"short",day:"numeric"},Ee=(0,c.__)("Date N/A","wp-parsely");function Le(e){if(!1===function(e){return!isNaN(+e)&&0!==e.getTime()}(e))return Ee;var t=ke;return e.getUTCFullYear()===(new Date).getUTCFullYear()&&(t=Te),Intl.DateTimeFormat(document.documentElement.lang||"en",t).format(e)}function Ce(e){return{period_start:e,period_end:""}}var Ne=function(){return Ne=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]=1e4&&(clearInterval(i),n("Telemetry library not loaded"))}),100);else n("Telemetry not enabled")}))},e.prototype.trackEvent=function(t,n){var r;this.isLoaded?(0!==t.indexOf(e.TRACKS_PREFIX)&&(t=e.TRACKS_PREFIX+t),this.isEventNameValid(t)?(n=this.prepareProperties(n),null===(r=this._tkq)||void 0===r||r.push(["recordEvent",t,n])):console.error("Error tracking event: Invalid event name")):console.error("Error tracking event: Telemetry not loaded")},e.prototype.isTelemetryEnabled=function(){return this.isEnabled},e.prototype.isProprietyValid=function(t){return e.PROPERTY_REGEX.test(t)},e.prototype.isEventNameValid=function(t){return e.EVENT_NAME_REGEX.test(t)},e.prototype.prepareProperties=function(e){return(e=this.sanitizeProperties(e)).parsely_version=wpParselyTracksTelemetry.version,wpParselyTracksTelemetry.user&&(e._ut=wpParselyTracksTelemetry.user.type,e._ui=wpParselyTracksTelemetry.user.id),wpParselyTracksTelemetry.vipgo_env&&(e.vipgo_env=wpParselyTracksTelemetry.vipgo_env),this.sanitizeProperties(e)},e.prototype.sanitizeProperties=function(e){var t=this,n={};return Object.keys(e).forEach((function(r){t.isProprietyValid(r)&&(n[r]=e[r])})),n},e.TRACKS_PREFIX="wpparsely_",e.EVENT_NAME_REGEX=/^(([a-z0-9]+)_){2}([a-z0-9_]+)$/,e.PROPERTY_REGEX=/^[a-z_][a-z0-9_]*$/,e}(),g=(h.trackEvent,window.wp.compose),y=(0,o.forwardRef)((function({icon:e,size:t=24,...n},r){return(0,o.cloneElement)(e,{width:t,height:t,...n,ref:r})})),v=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),m=function(){return(0,s.jsxs)(i.SVG,{"aria-hidden":"true",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:[(0,s.jsx)(i.G,{transform:"matrix(1, 0, 0, 1, 1.7763568394002505e-15, 0)"}),(0,s.jsx)(i.Path,{d:"M 16.693 6.167 A 4.541 4.541 0 0 1 12.152 10.708 A 4.541 4.541 0 0 1 7.611 6.167 A 4.541 4.541 0 0 1 12.152 1.626 A 4.541 4.541 0 0 1 16.693 6.167 Z",style:{fill:"rgba(216, 216, 216, 0)",fillOpacity:0,strokeWidth:"2.5px",stroke:"rgb(0, 0, 0)"}}),(0,s.jsx)(i.Path,{d:"M 3.016 23.76 L 3.0135 22.4385 C 3.0109999999999997 21.117 3.0060000000000002 18.474 3.3204999999999996 16.911 C 3.635 15.347999999999999 4.268999999999999 14.865 7.068666666666666 14.6235 C 9.868333333333332 14.382 14.833666666666666 14.382 17.585833333333333 14.658 C 20.337999999999997 14.934 20.877 15.485999999999999 21.1465 17.0435 C 21.416 18.601 21.416 21.164 21.416 22.4455 L 21.416 23.727",style:{fillOpacity:0,fill:"rgb(255, 255, 255)",strokeWidth:"2.5px",stroke:"rgb(0, 0, 0)"}})]})},w={journalist:{label:(0,c.__)("Journalist","wp-parsely"),emoji:"π°"},editorialWriter:{label:(0,c.__)("Editorial Writer","wp-parsely"),emoji:"βοΈ"},investigativeReporter:{label:(0,c.__)("Investigative Reporter","wp-parsely"),emoji:"π΅οΈ"},techAnalyst:{label:(0,c.__)("Tech Analyst","wp-parsely"),emoji:"π»"},businessAnalyst:{label:(0,c.__)("Business Analyst","wp-parsely"),emoji:"π"},culturalCommentator:{label:(0,c.__)("Cultural Commentator","wp-parsely"),emoji:"π"},scienceCorrespondent:{label:(0,c.__)("Science Correspondent","wp-parsely"),emoji:"π¬"},politicalAnalyst:{label:(0,c.__)("Political Analyst","wp-parsely"),emoji:"ποΈ"},healthWellnessAdvocate:{label:(0,c.__)("Health and Wellness Advocate","wp-parsely"),emoji:"π"},environmentalJournalist:{label:(0,c.__)("Environmental Journalist","wp-parsely"),emoji:"π³"},custom:{label:(0,c.__)("Use a custom persona","wp-parsely"),emoji:"π§"}},_=Object.keys(w),b=function(e){return"custom"===e||""===e?w.custom.label:x(e)?e:w[e].label},x=function(e){return!_.includes(e)||"custom"===e},S=function(e){var t=e.value,n=e.onChange,r=(0,o.useState)(""),a=r[0],l=r[1],u=(0,g.useDebounce)(n,500);return(0,s.jsx)("div",{className:"parsely-persona-selector-custom",children:(0,s.jsx)(i.TextControl,{value:a||t,onChange:function(e){if(""===e)return n(""),void l("");e.length>32&&(e=e.slice(0,32)),u(e),l(e)},help:(0,c.__)("Enter a custom persona","wp-parsely")})})},P=function(e){var t=e.persona,n=e.label,r=void 0===n?(0,c.__)("Select a persona","wp-parsely"):n,a=e.onChange,l=e.onDropdownChange,o=e.disabled,u=void 0!==o&&o,p=e.allowCustom,d=void 0!==p&&p;return(0,s.jsxs)(i.Disabled,{isDisabled:u,children:[(0,s.jsx)(i.DropdownMenu,{label:(0,c.__)("Persona","wp-parsely"),icon:m,className:"parsely-persona-selector-dropdown"+(u?" is-disabled":""),popoverProps:{className:"wp-parsely-popover"},toggleProps:{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"parsely-persona-selector-label",children:r}),(0,s.jsx)(y,{icon:v})]})},children:function(e){var n=e.onClose;return(0,s.jsx)(i.MenuGroup,{label:(0,c.__)("Select a persona","wp-parsely"),children:(0,s.jsx)(s.Fragment,{children:_.map((function(e){if(!d&&"custom"===e)return null;var r=w[e];return(0,s.jsxs)(i.MenuItem,{isSelected:e===t,className:e===t?"is-selected":"",role:"menuitemradio",onClick:function(){null==l||l(e),a(e),n()},children:[r.emoji," ",r.label]},e)}))})})}}),d&&x(t)&&(0,s.jsx)(S,{onChange:function(e){a(""!==e?e:"custom")},value:"custom"===t?"":t})]})},j=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{fillRule:"evenodd",d:"M6.863 13.644L5 13.25h-.5a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5H5L18 6.5h2V16h-2l-3.854-.815.026.008a3.75 3.75 0 01-7.31-1.549zm1.477.313a2.251 2.251 0 004.356.921l-4.356-.921zm-2.84-3.28L18.157 8h.343v6.5h-.343L5.5 11.823v-1.146z",clipRule:"evenodd"})),k={neutral:{label:(0,c.__)("Neutral","wp-parsely"),emoji:"π"},formal:{label:(0,c.__)("Formal","wp-parsely"),emoji:"π©"},humorous:{label:(0,c.__)("Humorous","wp-parsely"),emoji:"π"},confident:{label:(0,c.__)("Confident","wp-parsely"),emoji:"π"},provocative:{label:(0,c.__)("Provocative","wp-parsely"),emoji:"π"},serious:{label:(0,c.__)("Serious","wp-parsely"),emoji:"π§"},inspirational:{label:(0,c.__)("Inspirational","wp-parsely"),emoji:"β¨"},skeptical:{label:(0,c.__)("Skeptical","wp-parsely"),emoji:"π€¨"},conversational:{label:(0,c.__)("Conversational","wp-parsely"),emoji:"π¬"},analytical:{label:(0,c.__)("Analytical","wp-parsely"),emoji:"π€"},custom:{label:(0,c.__)("Use a custom tone","wp-parsely"),emoji:"π§"}},T=Object.keys(k),E=function(e){return"custom"===e||""===e?k.custom.label:L(e)?e:k[e].label},L=function(e){return!T.includes(e)||"custom"===e},C=function(e){var t=e.value,n=e.onChange,r=(0,o.useState)(""),a=r[0],l=r[1],u=(0,g.useDebounce)(n,500);return(0,s.jsx)("div",{className:"parsely-tone-selector-custom",children:(0,s.jsx)(i.TextControl,{value:a||t,onChange:function(e){if(""===e)return n(""),void l("");e.length>32&&(e=e.slice(0,32)),u(e),l(e)},help:(0,c.__)("Enter a custom tone","wp-parsely")})})},N=function(e){var t=e.tone,n=e.label,r=void 0===n?(0,c.__)("Select a tone","wp-parsely"):n,a=e.onChange,l=e.onDropdownChange,o=e.disabled,u=void 0!==o&&o,p=e.allowCustom,d=void 0!==p&&p;return(0,s.jsxs)(i.Disabled,{isDisabled:u,children:[(0,s.jsx)(i.DropdownMenu,{label:(0,c.__)("Tone","wp-parsely"),icon:j,className:"parsely-tone-selector-dropdown"+(u?" is-disabled":""),popoverProps:{className:"wp-parsely-popover"},toggleProps:{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"parsely-tone-selector-label",children:r}),(0,s.jsx)(y,{icon:v})]})},children:function(e){var n=e.onClose;return(0,s.jsx)(i.MenuGroup,{label:(0,c.__)("Select a tone","wp-parsely"),children:(0,s.jsx)(s.Fragment,{children:T.map((function(e){if(!d&&"custom"===e)return null;var r=k[e];return(0,s.jsxs)(i.MenuItem,{isSelected:e===t,className:e===t?"is-selected":"",role:"menuitemradio",onClick:function(){null==l||l(e),a(e),n()},children:[r.emoji," ",r.label]},e)}))})})}}),d&&L(t)&&(0,s.jsx)(C,{onChange:function(e){a(""!==e?e:"custom")},value:"custom"===t?"":t})]})},O=function(){return(0,s.jsx)(i.SVG,{"aria-hidden":"true",version:"1.1",viewBox:"0 0 15 15",width:"15",height:"15",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(i.Path,{d:"M0 14.0025V11.0025L7.5 3.5025L10.5 6.5025L3 14.0025H0ZM12 5.0025L13.56 3.4425C14.15 2.8525 14.15 1.9025 13.56 1.3225L12.68 0.4425C12.09 -0.1475 11.14 -0.1475 10.56 0.4425L9 2.0025L12 5.0025Z"})})},A=function(e){var t=e.size,n=void 0===t?24:t,r=e.className,a=void 0===r?"wp-parsely-icon":r;return(0,s.jsxs)(i.SVG,{className:a,height:n,viewBox:"0 0 60 65",width:n,xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)(i.Path,{fill:"#5ba745",d:"M23.72,51.53c0-.18,0-.34-.06-.52a13.11,13.11,0,0,0-2.1-5.53A14.74,14.74,0,0,0,19.12,43c-.27-.21-.5-.11-.51.22l-.24,3.42c0,.33-.38.35-.49,0l-1.5-4.8a1.4,1.4,0,0,0-.77-.78,23.91,23.91,0,0,0-3.1-.84c-1.38-.24-3.39-.39-3.39-.39-.34,0-.45.21-.25.49l2.06,3.76c.2.27,0,.54-.29.33l-4.51-3.6a3.68,3.68,0,0,0-2.86-.48c-1,.16-2.44.46-2.44.46a.68.68,0,0,0-.39.25.73.73,0,0,0-.14.45S.41,43,.54,44a3.63,3.63,0,0,0,1.25,2.62L6.48,50c.28.2.09.49-.23.37l-4.18-.94c-.32-.12-.5,0-.4.37,0,0,.69,1.89,1.31,3.16a24,24,0,0,0,1.66,2.74,1.34,1.34,0,0,0,1,.52l5,.13c.33,0,.41.38.1.48L7.51,58c-.31.1-.34.35-.07.55a14.29,14.29,0,0,0,3.05,1.66,13.09,13.09,0,0,0,5.9.5,25.13,25.13,0,0,0,4.34-1,9.55,9.55,0,0,1-.08-1.2,9.32,9.32,0,0,1,3.07-6.91"}),(0,s.jsx)(i.Path,{fill:"#5ba745",d:"M59.7,41.53a.73.73,0,0,0-.14-.45.68.68,0,0,0-.39-.25s-1.43-.3-2.44-.46a3.64,3.64,0,0,0-2.86.48l-4.51,3.6c-.26.21-.49-.06-.29-.33l2.06-3.76c.2-.28.09-.49-.25-.49,0,0-2,.15-3.39.39a23.91,23.91,0,0,0-3.1.84,1.4,1.4,0,0,0-.77.78l-1.5,4.8c-.11.32-.48.3-.49,0l-.24-3.42c0-.33-.24-.43-.51-.22a14.74,14.74,0,0,0-2.44,2.47A13.11,13.11,0,0,0,36.34,51c0,.18,0,.34-.06.52a9.26,9.26,0,0,1,3,8.1,24.1,24.1,0,0,0,4.34,1,13.09,13.09,0,0,0,5.9-.5,14.29,14.29,0,0,0,3.05-1.66c.27-.2.24-.45-.07-.55l-3.22-1.17c-.31-.1-.23-.47.1-.48l5-.13a1.38,1.38,0,0,0,1-.52A24.6,24.6,0,0,0,57,52.92c.61-1.27,1.31-3.16,1.31-3.16.1-.33-.08-.49-.4-.37l-4.18.94c-.32.12-.51-.17-.23-.37l4.69-3.34A3.63,3.63,0,0,0,59.46,44c.13-1,.24-2.47.24-2.47"}),(0,s.jsx)(i.Path,{fill:"#5ba745",d:"M46.5,25.61c0-.53-.35-.72-.8-.43l-4.86,2.66c-.45.28-.56-.27-.23-.69l4.66-6.23a2,2,0,0,0,.28-1.68,36.51,36.51,0,0,0-2.19-4.89,34,34,0,0,0-2.81-3.94c-.33-.41-.74-.35-.91.16l-2.28,5.68c-.16.5-.6.48-.59-.05l.28-8.93a2.54,2.54,0,0,0-.66-1.64S35,4.27,33.88,3.27,30.78.69,30.78.69a1.29,1.29,0,0,0-1.54,0s-1.88,1.49-3.12,2.59-2.48,2.35-2.48,2.35A2.5,2.5,0,0,0,23,7.27l.27,8.93c0,.53-.41.55-.58.05l-2.29-5.69c-.17-.5-.57-.56-.91-.14a35.77,35.77,0,0,0-3,4.2,35.55,35.55,0,0,0-2,4.62,2,2,0,0,0,.27,1.67l4.67,6.24c.33.42.23,1-.22.69l-4.87-2.66c-.45-.29-.82-.1-.82.43a18.6,18.6,0,0,0,.83,5.07,20.16,20.16,0,0,0,5.37,7.77c3.19,3,5.93,7.8,7.45,11.08A9.6,9.6,0,0,1,30,49.09a9.31,9.31,0,0,1,2.86.45c1.52-3.28,4.26-8.11,7.44-11.09a20.46,20.46,0,0,0,5.09-7,19,19,0,0,0,1.11-5.82"}),(0,s.jsx)(i.Path,{fill:"#5ba745",d:"M36.12,58.44A6.12,6.12,0,1,1,30,52.32a6.11,6.11,0,0,1,6.12,6.12"})]})},R=function(){return R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n".concat(this.message,"").concat(this.hint?this.hint:"")}))},t.prototype.Hint=function(e){return''.concat((0,c.__)("Hint:","wp-parsely")," ").concat(e,"
")},t}(Error),ue=function(){function e(){}return e.generateSmartLinks=function(e,t,n){var r,s,i,a,l;return void 0===t&&(t=be),void 0===n&&(n=_e),s=this,i=void 0,l=function(){var s,i;return function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(o){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(s=2&l[0]?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[2&l[0],s.value]),l[0]){case 0:case 1:s=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0)){var e={maxLinksPerPost:p.SmartLinkingMaxLinks,maxLinkWords:p.SmartLinkingMaxLinkWords,settingsOpen:p.SmartLinkingSettingsOpen};A(e)}}),[A,p]);var R=(0,a.useSelect)((function(e){var t=e("core/block-editor"),r=t.getSelectedBlock,s=t.getBlock,i=e("core/editor").getEditedPostContent;return{selectedBlock:n?s(n):r(),postContent:i()}}),[n]),I=R.selectedBlock,B=R.postContent;(0,o.useEffect)((function(){y(null)}),[I]);var M=function(e){return void 0===e&&(e="all"),fe(void 0,void 0,void 0,(function(){var t;return he(this,(function(n){switch(n.label){case 0:return[4,O(e)];case 1:return n.sent(),l===de.BlockInspector&&("all"===e||w?(t=(0,a.select)("core/block-editor").getBlockOrder()[0],(0,a.dispatch)("core/block-editor").selectBlock(t)):(0,a.dispatch)("core/block-editor").selectBlock(e)),0===_.length&&D(),[2]}}))}))},F=function(){(0,a.dispatch)("core/editor").lockPostSaving("wp-parsely-block-overlay"),document.querySelectorAll('.edit-post-header__settings>[type="button"]').forEach((function(e){e.setAttribute("disabled","disabled")}))},D=function(){document.querySelectorAll('.edit-post-header__settings>[type="button"]').forEach((function(e){e.removeAttribute("disabled")})),(0,a.dispatch)("core/editor").unlockPostSaving("wp-parsely-block-overlay")};return(0,s.jsx)("div",{className:"wp-parsely-smart-linking",children:(0,s.jsxs)(i.PanelRow,{className:t,children:[(0,s.jsxs)("div",{className:"wp-parsely-smart-linking-text",children:[(0,c.__)("Automatically insert links to your most relevant, top performing content.","wp-parsely"),"Β ",(0,s.jsx)("a",{href:"https://docs.parse.ly/plugin-content-helper/#h-smart-linking-beta",children:(0,c.__)("Learn how Smart Linking works.","wp-parsely")})]}),b&&(0,s.jsx)(i.Notice,{status:"info",isDismissible:!1,className:"wp-parsely-content-helper-error",children:b.message}),null!==x&&(0,s.jsx)(i.Notice,{status:"success",isDismissible:!1,className:"wp-parsely-smart-linking-suggested-links",children:/* translators: 1 - number of smart links generated */
+(0,c.sprintf)((0,c.__)("Successfully added %s smart links.","wp-parsely"),x.length)}),(0,s.jsx)(ae,{disabled:m,onSettingChange:function(e,t){var n,r;d(((n={})[e]=t,n)),A(((r={})[e]=t,r))}}),(0,s.jsxs)("div",{className:"wp-parsely-smart-linking-generate",children:[(0,s.jsx)(i.Button,{onClick:function(){return fe(void 0,void 0,void 0,(function(){var e,t,n,r,s;return he(this,(function(i){switch(i.label){case 0:return[4,T(!0)];case 1:return i.sent(),[4,C(null)];case 2:return i.sent(),[4,L(null)];case 3:return i.sent(),h.trackEvent("smart_linking_generate_pressed",{is_full_content:w,selected_block:null!==(s=null==I?void 0:I.name)&&void 0!==s?s:"none",context:l}),[4,(o=w?"all":null==I?void 0:I.clientId,void 0===o&&(o="all"),fe(void 0,void 0,void 0,(function(){return he(this,(function(e){switch(e.label){case 0:return[4,N(o)];case 1:return e.sent(),F(),[2]}}))})))];case 4:i.sent(),e=setTimeout((function(){var e;T(!1),h.trackEvent("smart_linking_generate_timeout",{is_full_content:w,selected_block:null!==(e=null==I?void 0:I.name)&&void 0!==e?e:"none",context:l}),M(w?"all":null==I?void 0:I.clientId)}),6e4),i.label=5;case 5:return i.trys.push([5,11,12,15]),t=w||!I,n=[],!(null==I?void 0:I.originalContent)||t?[3,7]:[4,ue.generateSmartLinks(null==I?void 0:I.originalContent,P,S)];case 6:return n=i.sent(),[3,9];case 7:return[4,ue.generateSmartLinks(B,P,S)];case 8:n=i.sent(),i.label=9;case 9:return[4,C(n)];case 10:return i.sent(),function(e){var t;h.trackEvent("smart_linking_applied",{is_full_content:w,selected_block:null!==(t=null==I?void 0:I.name)&&void 0!==t?t:"none",links_count:e.length,context:l});for(var n="",r=n=I&&!w?I.attributes.content:B,s=0,i=e;s(null==p?void 0:p.length)&&o.offset++;var d='').concat(o.text,"");r=pe(r,new RegExp("(".concat(o.text,"|]*>").concat(o.text,")")),d,o.offset)}}I&&!w?(0,a.dispatch)("core/block-editor").updateBlockAttributes(I.clientId,{content:r}):(0,a.dispatch)("core/editor").editPost({content:r})}(n),[3,15];case 11:return r=i.sent(),L(r),[3,15];case 12:return[4,T(!1)];case 13:return i.sent(),[4,M(w?"all":null==I?void 0:I.clientId)];case 14:return i.sent(),clearTimeout(e),[7];case 15:return[2]}var o}))}))},variant:"primary",isBusy:m,disabled:m,children:m?(0,c.__)("Generatingβ¦","wp-parsely"):(0,c.__)("Add Smart Links","wp-parsely")}),g&&(0,s.jsxs)(i.Notice,{status:"warning",isDismissible:!0,onRemove:function(){return y(null)},className:"wp-parsely-smart-linking-hint",children:[(0,s.jsx)("strong",{children:(0,c.__)("Hint:","wp-parsely")})," ",g]}),(0,s.jsx)(i.Disabled,{isDisabled:m,children:(0,s.jsx)(i.CheckboxControl,{checked:!I||w,disabled:m,onClick:function(){I||y((0,c.__)("If you want to target a specific block, you should select it on the block editor.","wp-parsely"))},onChange:I?E:function(){},label:(0,c.__)("Add smart links for the entire post","wp-parsely")})})]})]})})},ye=function(){return ye=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=c){var u=t;(s=r/c)%1>1/l&&(u=s>10?1:2),u=parseFloat(s.toFixed(2))===parseFloat(s.toFixed(0))?0:u,i=s.toFixed(u),a=o}l=c})),i+n+a}var ke={month:"short",day:"numeric",year:"numeric"},Te={month:"short",day:"numeric"},Ee=(0,c.__)("Date N/A","wp-parsely");function Le(e){if(!1===function(e){return!isNaN(+e)&&0!==e.getTime()}(e))return Ee;var t=ke;return e.getUTCFullYear()===(new Date).getUTCFullYear()&&(t=Te),Intl.DateTimeFormat(document.documentElement.lang||"en",t).format(e)}function Ce(e){return{period_start:e,period_end:""}}var Ne=function(){return Ne=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]1?[2,Promise.reject(new ce((0,c.sprintf)(/* translators: URL of the published post */
(0,c.__)("Multiple results were returned for the post %s by the Parse.ly API.","wp-parsely"),t),ie.ParselyApiReturnedTooManyResults))]:[2,n.data[0]]}}))}))},e.prototype.fetchReferrerDataFromWpEndpoint=function(e,t,n){return Oe(this,void 0,void 0,(function(){var r,s;return Ae(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,D()({path:(0,le.addQueryArgs)("/wp-parsely/v1/referrers/post/detail",Ne(Ne({},Ce(e)),{itm_source:this.itmSource,total_views:n,url:t}))})];case 1:return r=i.sent(),[3,3];case 2:return s=i.sent(),[2,Promise.reject(new ce(s.message,s.code))];case 3:return(null==r?void 0:r.error)?[2,Promise.reject(new ce(r.error.message,ie.ParselyApiResponseContainsError))]:[2,r.data]}}))}))},e}(),Ie=function(){return Ie=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0&&e.retryFetch?[4,new Promise((function(e){return setTimeout(e,500)}))]:[3,3];case 1:return t.sent(),[4,r(s-1)];case 2:return t.sent(),[3,4];case 3:p(e),l(!1),t.label=4;case 4:return[2]}}))}))})),[2]}))}))};return l(!0),r(1),function(){p(void 0)}}),[n]),u?u.Message():a?(0,s.jsx)("div",{className:"parsely-spinner-wrapper","data-testid":"parsely-spinner-wrapper",children:(0,s.jsx)(i.Spinner,{})}):(0,s.jsx)(De,{data:f,period:n})}function De(e){return(0,s.jsxs)("div",{className:"performance-details-panel",children:[(0,s.jsx)("div",{className:"section period",children:W(e.period)}),(0,s.jsx)(Ve,Ie({},e)),(0,s.jsx)(Ge,Ie({},e)),(0,s.jsx)(ze,Ie({},e)),(0,s.jsx)(Ue,Ie({},e))]})}function Ve(e){var t=e.data;return(0,s.jsx)("div",{className:"section general-performance",children:(0,s.jsxs)("table",{children:[(0,s.jsx)("tbody",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:je(t.views)}),(0,s.jsx)("td",{children:je(t.visitors)}),(0,s.jsx)("td",{children:t.avgEngaged})]})}),(0,s.jsx)("tfoot",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:(0,c.__)("Page Views","wp-parsely")}),(0,s.jsx)("th",{children:(0,c.__)("Visitors","wp-parsely")}),(0,s.jsx)("th",{children:(0,c.__)("Avg. Time","wp-parsely")})]})})]})})}function Ge(e){var t=e.data;delete t.referrers.types.totals;var n=function(e){switch(e){case"social":return(0,c.__)("Social","wp-parsely");case"search":return(0,c.__)("Search","wp-parsely");case"other":return(0,c.__)("Other","wp-parsely");case"internal":return(0,c.__)("Internal","wp-parsely");case"direct":return(0,c.__)("Direct","wp-parsely")}return e};return(0,s.jsxs)("div",{className:"section referrer-types",children:[(0,s.jsx)("div",{className:"section-title",children:(0,c.__)("Referrers (Page Views)","wp-parsely")}),(0,s.jsx)("div",{className:"multi-percentage-bar",children:Object.entries(t.referrers.types).map((function(e){var t=e[0],r=e[1],i=(0,c.sprintf)(/* translators: 1: Referrer type, 2: Percentage value, %%: Escaped percent sign */
(0,c.__)("%1$s: %2$s%%","wp-parsely"),n(t),r.viewsPercentage);return(0,s.jsx)("div",{"aria-label":i,className:"bar-fill "+t,style:{width:r.viewsPercentage+"%"}},t)}))}),(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{children:Object.keys(t.referrers.types).map((function(e){return(0,s.jsx)("th",{children:n(e)},e)}))})}),(0,s.jsx)("tbody",{children:(0,s.jsx)("tr",{children:Object.entries(t.referrers.types).map((function(e){var t=e[0],n=e[1];return(0,s.jsx)("td",{children:je(n.views)},t)}))})})]})]})}function ze(e){var t=e.data,n=0;return(0,s.jsxs)("div",{className:"section top-referrers",children:[(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"col",children:(0,c.__)("Top Referrers","wp-parsely")}),(0,s.jsx)("th",{colSpan:2,scope:"colgroup",children:(0,c.__)("Page Views","wp-parsely")})]})}),(0,s.jsx)("tbody",{children:Object.entries(t.referrers.top).map((function(e){var t=e[0],r=e[1];if("totals"===t)return n=Number(r.viewsPercentage),null;var i=t;"direct"===t&&(i=(0,c.__)("Direct","wp-parsely"))
@@ -12,8 +12,6 @@ message:(0,c.sprintf)((0,c.__)('with tag "%1$s"',"wp-parsely"),n.value)};if(r.Se
/* translators: %s: message such as "in category Foo" */
message:(0,c.sprintf)((0,c.__)('in section "%1$s"',"wp-parsely"),n.value)};if(r.Author===n.type)return{query:et({author:n.value},s),
/* translators: %s: message such as "by author John" */
-message:(0,c.sprintf)((0,c.__)('by author "%1$s"',"wp-parsely"),n.value)};throw new ce((0,c.__)("No valid filter type has been specified.","wp-parsely"),ie.CannotFormulateApiQuery)},e}(),st=function(){return st=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0&&n.retryFetch?[4,new Promise((function(e){return setTimeout(e,500)}))]:[3,3];case 1:return t.sent(),[4,i(e-1)];case 2:return t.sent(),[3,4];case 3:g(!1),w(n),t.label=4;case 4:return[2]}}))}))})),[2]}))}))},o=r.Tag===T.type,c=r.Unavailable===T.type,u=0===l.tags.length,p=o&&!l.tags.includes(T.value);return g(!0),c||o&&u?Object.values(l).every((function(e){return 0===e.length}))||E((e="",s=r.Unavailable,l.tags.length>=1?(s=r.Tag,e=l.tags[0]):l.categories.length>=1?(s=r.Section,e=l.categories[0]):(s=r.Author,e=l.authors[0]),{type:s,value:e})):p?E({type:r.Tag,value:l.tags[0]}):i(1),function(){g(!1),j([]),x(""),w(void 0)}}),[a,n,T,l]);var C=(0,s.jsx)("div",{className:"parsely-spinner-wrapper","data-testid":"parsely-spinner-wrapper",children:(0,s.jsx)(i.Spinner,{})}),N=(0,s.jsx)(qe,{filter:T,label:(0,c.__)("Filter by","wp-parsely"),onFilterTypeChange:function(e){if(H(e,r)){var t="",n=e;r.Tag===n&&(t=l.tags[0]),r.Section===n&&(t=l.categories[0]),r.Author===n&&(t=l.authors[0]),""!==t&&(L(n,t),E({type:n,value:t}),h.trackEvent("related_posts_filter_type_changed",{filter_type:n}))}},onFilterValueChange:function(e){"string"==typeof e&&(L(T.type,e),E(st(st({},T),{value:e})))},postData:l});return m?(0,s.jsxs)(s.Fragment,{children:[N,m.Message({className:"parsely-related-posts-descr"})]}):(0,s.jsxs)(s.Fragment,{children:[N,y?C:(0,s.jsxs)("div",{className:"parsely-related-posts-wrapper",children:[(0,s.jsx)("p",{className:"parsely-related-posts-descr","data-testid":"parsely-related-posts-descr",children:b}),(0,s.jsx)("ol",{className:"parsely-related-posts",children:S.map((function(e){return(0,s.jsx)(Je,{metric:n,post:e},e.id)}))})]})]})}var ot,ct=function(e){var t=e.isLoading,n=e.isOpen,r=e.onPersonaChange,a=e.onSettingChange,l=e.onToneChange,u=e.persona,p=e.tone,d=(0,o.useState)(n),f=d[0],y=d[1];return(0,s.jsxs)("div",{className:"parsely-panel-settings",children:[(0,s.jsxs)("div",{className:"parsely-panel-settings-header",children:[(0,s.jsx)(A,{size:20}),(0,s.jsx)(i.BaseControl,{id:"parsely-write-titles-settings",className:"parsely-panel-settings-header-label",label:(0,c.__)("Parse.ly AI Settings","wp-parsely"),children:(0,s.jsx)(i.Button,{label:(0,c.__)("Change Tone & Persona","wp-parsely"),icon:J,onClick:function(){a("TitleSuggestionsSettingsOpen",!f),y(!f),h.trackEvent("title_suggestions_ai_settings_toggled",{is_active:!f})},isPressed:f,size:"small"})})]}),f&&(0,s.jsxs)("div",{className:"parsely-panel-settings-body",children:[(0,s.jsx)(N,{tone:p,label:E(p),onChange:function(e){l(e)},onDropdownChange:function(e){h.trackEvent("title_suggestions_ai_tone_changed",{tone:e})},disabled:t,allowCustom:!0}),(0,s.jsx)(S,{persona:u,label:b(u),onChange:function(e){r(e)},onDropdownChange:function(e){h.trackEvent("title_suggestions_ai_persona_changed",{persona:e})},disabled:t,allowCustom:!0})]})]})},ut=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),pt=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{d:"m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"})),dt=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})),ft=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"})),ht=function(){return ht=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0?"secondary":"primary",isBusy:w,disabled:w||"custom"===d||"custom"===g,onClick:function(){return Pt(void 0,void 0,void 0,(function(){return St(this,(function(e){switch(e.label){case 0:return u(void 0),!1!==w?[3,2]:(h.trackEvent("title_suggestions_generate_pressed",{request_more:_.length>0,total_titles:_.length,total_pinned:_.filter((function(e){return e.isPinned})).length,tone:d,persona:g}),[4,(t=ot.PostTitle,n=N,r=d,s=g,Pt(void 0,void 0,void 0,(function(){var e,i,a;return St(this,(function(l){switch(l.label){case 0:return[4,k(!0)];case 1:l.sent(),e=new xt,l.label=2;case 2:return l.trys.push([2,5,,6]),[4,e.generateTitles(n,3,r,s)];case 3:return i=l.sent(),[4,j(t,i)];case 4:return l.sent(),[3,6];case 5:return a=l.sent(),u(a),j(t,[]),[3,6];case 6:return[4,k(!1)];case 7:return l.sent(),[2]}}))})))]);case 1:e.sent(),e.label=2;case 2:return[2]}var t,n,r,s}))}))},children:[w&&(0,c.__)("Generating Titlesβ¦","wp-parsely"),!w&&_.length>0&&(0,c.__)("Generate More","wp-parsely"),!w&&0===_.length&&(0,c.__)("Generate Titles","wp-parsely")]})}),I=(0,s.jsxs)("div",{className:"parsely-write-titles-title-suggestions-container",children:[void 0!==P&&(0,s.jsx)(bt,{title:P,type:ot.PostTitle,isOriginal:!0}),_.map((function(e){return(0,s.jsx)(bt,{title:e,type:ot.PostTitle},e.id)}))]}),B=(0,s.jsxs)("div",{className:"parsely-write-titles-accepted-title-container",children:[(0,s.jsx)("div",{className:"parsely-write-titles-text",children:(0,c.__)("Replace the current post title with the following?","wp-parsely")}),(0,s.jsx)("div",{className:"parsely-write-titles-accepted-title",children:null==x?void 0:x.title}),(0,s.jsxs)("div",{className:"parsely-write-titles-accepted-title-actions",children:[(0,s.jsx)(i.Button,{variant:"secondary",onClick:function(){var e;T(ot.PostTitle,void 0),h.trackEvent("title_suggestions_cancel_pressed",{original_title:O,canceled_title:null!==(e=null==x?void 0:x.title)&&void 0!==e?e:""})},children:(0,c.__)("Cancel","wp-parsely")}),(0,s.jsx)(i.Button,{variant:"primary",onClick:function(){return Pt(void 0,void 0,void 0,(function(){return St(this,(function(e){switch(e.label){case 0:return[4,L(ot.PostTitle,O)];case 1:return e.sent(),(0,a.dispatch)("core/editor").editPost({title:null==x?void 0:x.title}),x?[4,(0,a.dispatch)(mt).pinTitle(ot.PostTitle,x)]:[3,3];case 2:e.sent(),h.trackEvent("title_suggestions_accept_pressed",{old_title:O,new_title:x.title}),e.label=3;case 3:return[4,T(ot.PostTitle,void 0)];case 4:return e.sent(),[2]}}))}))},children:(0,c.__)("Replace","wp-parsely")})]})]});return(0,s.jsx)(i.PanelRow,{children:(0,s.jsxs)("div",{className:"parsely-write-titles-wrapper",children:[0===_.length&&void 0===x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"parsely-write-titles-text",children:(0,c.__)("Use Parse.ly AI to generate a title for your post.","wp-parsely")}),l&&(0,s.jsx)(i.Notice,{status:"info",isDismissible:!1,className:"wp-parsely-content-helper-error",children:l.message}),A,R]}),0<_.length&&void 0===x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"parsely-write-titles-text",children:(0,o.createInterpolateElement)(
+message:(0,c.sprintf)((0,c.__)('by author "%1$s"',"wp-parsely"),n.value)};throw new ce((0,c.__)("No valid filter type has been specified.","wp-parsely"),ie.CannotFormulateApiQuery)},e}(),st=function(){return st=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0&&n.retryFetch?[4,new Promise((function(e){return setTimeout(e,500)}))]:[3,3];case 1:return t.sent(),[4,i(e-1)];case 2:return t.sent(),[3,4];case 3:y(!1),w(n),t.label=4;case 4:return[2]}}))}))})),[2]}))}))},o=r.Tag===T.type,c=r.Unavailable===T.type,u=0===l.tags.length,p=o&&!l.tags.includes(T.value);return y(!0),c||o&&u?Object.values(l).every((function(e){return 0===e.length}))||E((e="",s=r.Unavailable,l.tags.length>=1?(s=r.Tag,e=l.tags[0]):l.categories.length>=1?(s=r.Section,e=l.categories[0]):(s=r.Author,e=l.authors[0]),{type:s,value:e})):p?E({type:r.Tag,value:l.tags[0]}):i(1),function(){y(!1),j([]),x(""),w(void 0)}}),[a,n,T,l]);var C=(0,s.jsx)("div",{className:"parsely-spinner-wrapper","data-testid":"parsely-spinner-wrapper",children:(0,s.jsx)(i.Spinner,{})}),N=(0,s.jsx)(qe,{filter:T,label:(0,c.__)("Filter by","wp-parsely"),onFilterTypeChange:function(e){if(H(e,r)){var t="",n=e;r.Tag===n&&(t=l.tags[0]),r.Section===n&&(t=l.categories[0]),r.Author===n&&(t=l.authors[0]),""!==t&&(L(n,t),E({type:n,value:t}),h.trackEvent("related_posts_filter_type_changed",{filter_type:n}))}},onFilterValueChange:function(e){"string"==typeof e&&(L(T.type,e),E(st(st({},T),{value:e})))},postData:l});return m?(0,s.jsxs)(s.Fragment,{children:[N,m.Message({className:"parsely-related-posts-descr"})]}):(0,s.jsxs)(s.Fragment,{children:[N,g?C:(0,s.jsxs)("div",{className:"parsely-related-posts-wrapper",children:[(0,s.jsx)("p",{className:"parsely-related-posts-descr","data-testid":"parsely-related-posts-descr",children:b}),(0,s.jsx)("ol",{className:"parsely-related-posts",children:P.map((function(e){return(0,s.jsx)(Je,{metric:n,post:e},e.id)}))})]})]})}var ot,ct=function(e){var t=e.isLoading,n=e.isOpen,r=e.onPersonaChange,a=e.onSettingChange,l=e.onToneChange,u=e.persona,p=e.tone,d=(0,o.useState)(n),f=d[0],g=d[1];return(0,s.jsxs)("div",{className:"parsely-panel-settings",children:[(0,s.jsxs)("div",{className:"parsely-panel-settings-header",children:[(0,s.jsx)(A,{size:20}),(0,s.jsx)(i.BaseControl,{id:"parsely-write-titles-settings",className:"parsely-panel-settings-header-label",label:(0,c.__)("Parse.ly AI Settings","wp-parsely"),children:(0,s.jsx)(i.Button,{label:(0,c.__)("Change Tone & Persona","wp-parsely"),icon:J,onClick:function(){a("TitleSuggestionsSettingsOpen",!f),g(!f),h.trackEvent("title_suggestions_ai_settings_toggled",{is_active:!f})},isPressed:f,size:"small"})})]}),f&&(0,s.jsxs)("div",{className:"parsely-panel-settings-body",children:[(0,s.jsx)(N,{tone:p,label:E(p),onChange:function(e){l(e)},onDropdownChange:function(e){h.trackEvent("title_suggestions_ai_tone_changed",{tone:e})},disabled:t,allowCustom:!0}),(0,s.jsx)(P,{persona:u,label:b(u),onChange:function(e){r(e)},onDropdownChange:function(e){h.trackEvent("title_suggestions_ai_persona_changed",{persona:e})},disabled:t,allowCustom:!0})]})]})},ut=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),pt=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{d:"m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"})),dt=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})),ft=(0,u.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,u.createElement)(p.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"})),ht=function(){return ht=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0&&s[s.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]0?"secondary":"primary",isBusy:w,disabled:w||"custom"===d||"custom"===y,onClick:function(){return St(void 0,void 0,void 0,(function(){return Pt(this,(function(e){switch(e.label){case 0:return u(void 0),!1!==w?[3,2]:(h.trackEvent("title_suggestions_generate_pressed",{request_more:_.length>0,total_titles:_.length,total_pinned:_.filter((function(e){return e.isPinned})).length,tone:d,persona:y}),[4,(t=ot.PostTitle,n=N,r=d,s=y,St(void 0,void 0,void 0,(function(){var e,i,a;return Pt(this,(function(l){switch(l.label){case 0:return[4,k(!0)];case 1:l.sent(),e=new xt,l.label=2;case 2:return l.trys.push([2,5,,6]),[4,e.generateTitles(n,3,r,s)];case 3:return i=l.sent(),[4,j(t,i)];case 4:return l.sent(),[3,6];case 5:return a=l.sent(),u(a),j(t,[]),[3,6];case 6:return[4,k(!1)];case 7:return l.sent(),[2]}}))})))]);case 1:e.sent(),e.label=2;case 2:return[2]}var t,n,r,s}))}))},children:[w&&(0,c.__)("Generating Titlesβ¦","wp-parsely"),!w&&_.length>0&&(0,c.__)("Generate More","wp-parsely"),!w&&0===_.length&&(0,c.__)("Generate Titles","wp-parsely")]})}),I=(0,s.jsxs)("div",{className:"parsely-write-titles-title-suggestions-container",children:[void 0!==S&&(0,s.jsx)(bt,{title:S,type:ot.PostTitle,isOriginal:!0}),_.map((function(e){return(0,s.jsx)(bt,{title:e,type:ot.PostTitle},e.id)}))]}),B=(0,s.jsxs)("div",{className:"parsely-write-titles-accepted-title-container",children:[(0,s.jsx)("div",{className:"parsely-write-titles-text",children:(0,c.__)("Replace the current post title with the following?","wp-parsely")}),(0,s.jsx)("div",{className:"parsely-write-titles-accepted-title",children:null==x?void 0:x.title}),(0,s.jsxs)("div",{className:"parsely-write-titles-accepted-title-actions",children:[(0,s.jsx)(i.Button,{variant:"secondary",onClick:function(){var e;T(ot.PostTitle,void 0),h.trackEvent("title_suggestions_cancel_pressed",{original_title:O,canceled_title:null!==(e=null==x?void 0:x.title)&&void 0!==e?e:""})},children:(0,c.__)("Cancel","wp-parsely")}),(0,s.jsx)(i.Button,{variant:"primary",onClick:function(){return St(void 0,void 0,void 0,(function(){return Pt(this,(function(e){switch(e.label){case 0:return[4,L(ot.PostTitle,O)];case 1:return e.sent(),(0,a.dispatch)("core/editor").editPost({title:null==x?void 0:x.title}),x?[4,(0,a.dispatch)(mt).pinTitle(ot.PostTitle,x)]:[3,3];case 2:e.sent(),h.trackEvent("title_suggestions_accept_pressed",{old_title:O,new_title:x.title}),e.label=3;case 3:return[4,T(ot.PostTitle,void 0)];case 4:return e.sent(),[2]}}))}))},children:(0,c.__)("Replace","wp-parsely")})]})]});return(0,s.jsx)(i.PanelRow,{children:(0,s.jsxs)("div",{className:"parsely-write-titles-wrapper",children:[0===_.length&&void 0===x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"parsely-write-titles-text",children:(0,c.__)("Use Parse.ly AI to generate a title for your post.","wp-parsely")}),l&&(0,s.jsx)(i.Notice,{status:"info",isDismissible:!1,className:"wp-parsely-content-helper-error",children:l.message}),A,R]}),0<_.length&&void 0===x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"parsely-write-titles-text",children:(0,o.createInterpolateElement)(
// translators: %1$s is the tone, %2$s is the persona.
-(0,c.__)("We've generated a few titles based on the content of your post, written as a .","wp-parsely"),{tone:(0,s.jsx)("strong",{children:E(d)}),persona:(0,s.jsx)("strong",{children:b(g)})})}),l&&(0,s.jsx)(i.Notice,{status:"info",isDismissible:!1,className:"wp-parsely-content-helper-error",children:l.message}),I,A,R]}),void 0!==x&&B]})})},kt=function(e){var t=e.trackToggle,n=z(),r=n.settings,l=n.setSettings,u=(0,o.useState)({authors:[],categories:[],tags:[]}),p=u[0],d=u[1],f=(0,a.useSelect)((function(e){var t=e($e.store).getEditedPostAttribute,n=e(We.store).getEntityRecords;return{authors:n("root","user",{include:t("author")}),categories:n("taxonomy","category",{include:t("categories")}),tags:n("taxonomy","post_tag",{include:t("tags")})}}),[]),h=f.authors,y=f.categories,g=f.tags;return(0,o.useEffect)((function(){h&&y&&g&&d({authors:h.map((function(e){return e.name})),categories:y.map((function(e){return e.name})),tags:g.map((function(e){return e.name}))})}),[h,y,g]),(0,s.jsxs)(i.Panel,{children:[(0,s.jsx)(i.PanelBody,{icon:(0,s.jsx)(K,{}),title:(0,c.__)("Title Suggestions","wp-parsely"),initialOpen:r.TitleSuggestionsOpen,onToggle:function(e){l({TitleSuggestionsOpen:e}),t("title_suggestions",e)},children:(0,s.jsx)(Z,{children:(0,s.jsx)(jt,{})})}),(0,s.jsx)(i.PanelBody,{icon:(0,s.jsx)(K,{}),title:(0,c.__)("Smart Linking","wp-parsely"),initialOpen:r.SmartLinkingOpen,onToggle:function(e){l({SmartLinkingOpen:e}),t("smart_linking",e)},children:(0,s.jsx)(Z,{children:(0,s.jsx)(ye,{context:de.ContentHelperSidebar})})}),(0,s.jsx)(i.PanelBody,{title:(0,c.__)("Related Posts","wp-parsely"),initialOpen:r.RelatedPostsOpen,onToggle:function(e){l({RelatedPostsOpen:e}),t("related_top_posts",e)},children:(0,s.jsx)(Z,{children:(0,s.jsx)(lt,{metric:r.RelatedPostsMetric,period:r.RelatedPostsPeriod,postData:p})})})]})},Tt=function(){return Tt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n titles based on the content of your post, written as a .","wp-parsely"),{tone:(0,s.jsx)("strong",{children:E(d)}),persona:(0,s.jsx)("strong",{children:b(y)})})}),l&&(0,s.jsx)(i.Notice,{status:"info",isDismissible:!1,className:"wp-parsely-content-helper-error",children:l.message}),I,A,R]}),void 0!==x&&B]})})},kt=function(e){var t=e.trackToggle,n=z(),r=n.settings,l=n.setSettings,u=(0,o.useState)({authors:[],categories:[],tags:[]}),p=u[0],d=u[1],f=(0,a.useSelect)((function(e){var t=e($e.store).getEditedPostAttribute,n=e(We.store).getEntityRecords;return{authors:n("root","user",{include:t("author")}),categories:n("taxonomy","category",{include:t("categories")}),tags:n("taxonomy","post_tag",{include:t("tags")})}}),[]),h=f.authors,g=f.categories,y=f.tags;return(0,o.useEffect)((function(){h&&g&&y&&d({authors:h.map((function(e){return e.name})),categories:g.map((function(e){return e.name})),tags:y.map((function(e){return e.name}))})}),[h,g,y]),(0,s.jsxs)(i.Panel,{children:[(0,s.jsx)(i.PanelBody,{title:(0,c.__)("Title Suggestions (Beta)","wp-parsely"),initialOpen:r.TitleSuggestionsOpen,onToggle:function(e){l({TitleSuggestionsOpen:e}),t("title_suggestions",e)},children:(0,s.jsx)(Z,{children:(0,s.jsx)(jt,{})})}),(0,s.jsx)(i.PanelBody,{title:(0,c.__)("Smart Linking (Beta)","wp-parsely"),initialOpen:r.SmartLinkingOpen,onToggle:function(e){l({SmartLinkingOpen:e}),t("smart_linking",e)},children:(0,s.jsx)(Z,{children:(0,s.jsx)(ge,{context:de.ContentHelperSidebar})})}),(0,s.jsx)(i.PanelBody,{title:(0,c.__)("Related Posts","wp-parsely"),initialOpen:r.RelatedPostsOpen,onToggle:function(e){l({RelatedPostsOpen:e}),t("related_top_posts",e)},children:(0,s.jsx)(Z,{children:(0,s.jsx)(lt,{metric:r.RelatedPostsMetric,period:r.RelatedPostsPeriod,postData:p})})})]})},Tt=function(){return Tt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n {
endpoint="editor-sidebar-settings"
defaultSettings={ getSettingsFromJson() }
>
-
-
-
- {
- /* translators: %1$s: how it performed, %2$s: period starting with 'last' */
- sprintf( __( 'This post performed %1$s in the %2$s', 'wp-parsely' ),
- 'very well',
- getPeriodDescription( settings.PerformanceStatsPeriod, true )
- )
- // TODO: Make the performance descriptor dynamic, and display a different message if the post is unpublished.
- }
- { window.wpParselyPostUrl && (
-
- ) }
-
-
-
{
return (
}
- title={ __( 'Title Suggestions', 'wp-parsely' ) }
+ title={ __( 'Title Suggestions (Beta)', 'wp-parsely' ) }
initialOpen={ settings.TitleSuggestionsOpen }
onToggle={ ( next ) => {
setSettings( {
@@ -105,8 +103,7 @@ export const SidebarToolsTab = ( { trackToggle }: SidebarToolsTabProps ) => {
}
- title={ __( 'Smart Linking', 'wp-parsely' ) }
+ title={ __( 'Smart Linking (Beta)', 'wp-parsely' ) }
initialOpen={ settings.SmartLinkingOpen }
onToggle={ ( next ) => {
setSettings( {