diff --git a/build/content-helper/editor-sidebar.asset.php b/build/content-helper/editor-sidebar.asset.php index 953fe7af0..fce0af939 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-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url', 'wp-wordcount'), 'version' => 'db69c114d741ca9a2460'); + array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url', 'wp-wordcount'), 'version' => '6cff2a59e0a708629834'); diff --git a/build/content-helper/editor-sidebar.js b/build/content-helper/editor-sidebar.js index 3940185ed..2e12bab5e 100644 --- a/build/content-helper/editor-sidebar.js +++ b/build/content-helper/editor-sidebar.js @@ -1,7 +1,7 @@ -!function(){"use strict";var e={20:function(e,t,n){var r=n(609),i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,o={},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)s.call(t,r)&&!l.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:i,type:e,key:c,ref:u,props:o,_owner:a.current}}t.Fragment=o,t.jsx=c,t.jsxs=c},848:function(e,t,n){e.exports=n(20)},609:function(e){e.exports=window.React}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.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({},{_:function(){return Sr}});var e,t,r,i,o,s,a,l,c,u,p,d,f=n(848),h=window.wp.components,v=window.wp.data,g=window.wp.domReady,y=n.n(g);void 0!==window.wp&&(p=null!==(t=null===(e=window.wp.editor)||void 0===e?void 0:e.PluginDocumentSettingPanel)&&void 0!==t?t:null!==(i=null===(r=window.wp.editPost)||void 0===r?void 0:r.PluginDocumentSettingPanel)&&void 0!==i?i:null===(o=window.wp.editSite)||void 0===o?void 0:o.PluginDocumentSettingPanel,d=null!==(a=null===(s=window.wp.editor)||void 0===s?void 0:s.PluginSidebar)&&void 0!==a?a:null!==(c=null===(l=window.wp.editPost)||void 0===l?void 0:l.PluginSidebar)&&void 0!==c?c:null===(u=window.wp.editSite)||void 0===u?void 0:u.PluginSidebar);var m,w,b,_=window.wp.element,x=window.wp.i18n,k=window.wp.primitives,S=(0,f.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,f.jsx)(k.Path,{fillRule:"evenodd",d:"M11.25 5h1.5v15h-1.5V5zM6 10h1.5v10H6V10zm12 4h-1.5v6H18v-6z",clipRule:"evenodd"})}),j=window.wp.plugins,P=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){return n=this,r=arguments,o=function(t,n){var r;return void 0===n&&(n={}),function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=1e4&&(clearInterval(o),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}(),T=(P.trackEvent,function(){return(0,f.jsx)(h.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,f.jsx)(h.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"})})}),L=function(e){var t=e.size,n=void 0===t?24:t,r=e.className,i=void 0===r?"wp-parsely-icon":r;return(0,f.jsxs)(h.SVG,{className:i,height:n,viewBox:"0 0 60 65",width:n,xmlns:"http://www.w3.org/2000/svg",children:[(0,f.jsx)(h.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,f.jsx)(h.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,f.jsx)(h.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,f.jsx)(h.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"})]})},E=function(){return E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0?"".concat(i," ").concat(n):n)||this).hint=null,o.name=o.constructor.name,o.code=r;var s=[U.AccessToFeatureDisabled,U.ParselyApiForbidden,U.ParselyApiResponseContainsError,U.ParselyApiReturnedNoData,U.ParselyApiReturnedTooManyResults,U.PluginCredentialsNotSetMessageDetected,U.PluginSettingsApiSecretNotSet,U.PluginSettingsSiteIdNotSet,U.PostIsNotPublished,U.UnknownError,U.ParselySuggestionsApiAuthUnavailable,U.ParselySuggestionsApiNoAuthentication,U.ParselySuggestionsApiNoAuthorization,U.ParselySuggestionsApiNoData,U.ParselySuggestionsApiSchemaError];return o.retryFetch=!s.includes(o.code),Object.setPrototypeOf(o,t.prototype),o.code===U.AccessToFeatureDisabled?o.message=(0,x.__)("Access to this feature is disabled by the site's administration.","wp-parsely"):o.code===U.ParselySuggestionsApiNoAuthorization?o.message=(0,x.__)('This AI-powered feature is opt-in. To gain access, please submit a request here.',"wp-parsely"):o.code===U.ParselySuggestionsApiOpenAiError||o.code===U.ParselySuggestionsApiOpenAiUnavailable?o.message=(0,x.__)("The Parse.ly API returned an internal server error. Please retry with a different input, or try again later.","wp-parsely"):o.code===U.HttpRequestFailed&&o.message.includes("cURL error 28")?o.message=(0,x.__)("The Parse.ly API did not respond in a timely manner. Please try again later.","wp-parsely"):o.code===U.ParselySuggestionsApiSchemaError?o.message=(0,x.__)("The Parse.ly API returned a validation error. Please try again with different parameters.","wp-parsely"):o.code===U.ParselySuggestionsApiNoData?o.message=(0,x.__)("The Parse.ly API couldn't find any relevant data to fulfill the request. Please retry with a different input.","wp-parsely"):o.code===U.ParselySuggestionsApiOpenAiSchema?o.message=(0,x.__)("The Parse.ly API returned an incorrect response. Please try again later.","wp-parsely"):o.code===U.ParselySuggestionsApiAuthUnavailable&&(o.message=(0,x.__)("The Parse.ly API is currently unavailable. Please try again later.","wp-parsely")),o}return ee(t,e),t.prototype.Message=function(e){return void 0===e&&(e=null),[U.PluginCredentialsNotSetMessageDetected,U.PluginSettingsSiteIdNotSet,U.PluginSettingsApiSecretNotSet].includes(this.code)?X(e):(this.code===U.FetchError&&(this.hint=this.Hint((0,x.__)("This error can sometimes be caused by ad-blockers or browser tracking protections. Please add this site to any applicable allow lists and try again.","wp-parsely"))),this.code!==U.ParselyApiForbidden&&this.code!==U.ParselySuggestionsApiNoAuthentication||(this.hint=this.Hint((0,x.__)("Please ensure that the Site ID and API Secret given in the plugin's settings are correct.","wp-parsely"))),this.code===U.HttpRequestFailed&&(this.hint=this.Hint((0,x.__)("The Parse.ly API cannot be reached. Please verify that you are online.","wp-parsely"))),(0,f.jsx)(Q,{className:null==e?void 0:e.className,testId:"error",children:"

".concat(this.message,"

").concat(this.hint?this.hint:"")}))},t.prototype.Hint=function(e){return'

'.concat((0,x.__)("Hint:","wp-parsely")," ").concat(e,"

")},t.prototype.createErrorSnackbar=function(){//.test(this.message)||(0,v.dispatch)("core/notices").createNotice("error",this.message,{type:"snackbar"})},t}(Error),ne=window.wp.url,re=function(){function e(){this.abortControllers=new Map}return e.prototype.cancelRequest=function(e){if(e)(t=this.abortControllers.get(e))&&(t.abort(),this.abortControllers.delete(e));else{var t,n=Array.from(this.abortControllers.keys()).pop();n&&(t=this.abortControllers.get(n))&&(t.abort(),this.abortControllers.delete(n))}},e.prototype.cancelAll=function(){this.abortControllers.forEach((function(e){return e.abort()})),this.abortControllers.clear()},e.prototype.getOrCreateController=function(e){if(e&&this.abortControllers.has(e))return{abortController:this.abortControllers.get(e),abortId:e};var t=null!=e?e:"auto-"+Date.now(),n=new AbortController;return this.abortControllers.set(t,n),{abortController:n,abortId:t}},e.prototype.fetch=function(e,t){return n=this,r=void 0,o=function(){var n,r,i,o,s,a;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]32&&(e=e.slice(0,32)),s(e),o(e)}})})},ve=function(e){var t=e.persona,n=e.value,r=void 0===n?(0,x.__)("Select a persona…","wp-parsely"):n,i=e.label,o=void 0===i?(0,x.__)("Persona","wp-parsely"):i,s=e.onChange,a=e.onDropdownChange,l=e.disabled,c=void 0!==l&&l,u=e.allowCustom,p=void 0!==u&&u;return(0,f.jsxs)(h.Disabled,{isDisabled:c,children:[o&&(0,f.jsx)("div",{className:"wp-parsely-dropdown-label",children:o}),(0,f.jsx)(h.DropdownMenu,{label:(0,x.__)("Persona","wp-parsely"),className:"parsely-persona-selector-dropdown"+(c?" is-disabled":""),popoverProps:{className:"wp-parsely-popover"},toggleProps:{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{className:"parsely-persona-selector-label",children:fe(t)?ue.custom.label:r}),(0,f.jsx)(ce,{})]})},children:function(e){var n=e.onClose;return(0,f.jsx)(h.MenuGroup,{label:(0,x.__)("Persona","wp-parsely"),children:(0,f.jsx)(f.Fragment,{children:pe.map((function(e){if(!p&&"custom"===e)return null;var r=ue[e],i=e===t||fe(t)&&"custom"===e;return(0,f.jsxs)(h.MenuItem,{isSelected:i,className:i?"is-selected":"",role:"menuitemradio",onClick:function(){null==a||a(e),s(e),n(),"custom"===e&&setTimeout((function(){var e=document.querySelector(".parsely-persona-selector-custom input");e&&e.focus()}),0)},children:[r.icon&&(0,f.jsx)(le,{icon:r.icon}),r.label]},e)}))})})}}),p&&fe(t)&&(0,f.jsx)(he,{onChange:function(e){s(""!==e?e:"custom")},value:"custom"===t?"":t})]})},ge={neutral:{label:(0,x.__)("Neutral","wp-parsely")},formal:{label:(0,x.__)("Formal","wp-parsely")},humorous:{label:(0,x.__)("Humorous","wp-parsely")},confident:{label:(0,x.__)("Confident","wp-parsely")},provocative:{label:(0,x.__)("Provocative","wp-parsely")},serious:{label:(0,x.__)("Serious","wp-parsely")},inspirational:{label:(0,x.__)("Inspirational","wp-parsely")},skeptical:{label:(0,x.__)("Skeptical","wp-parsely")},conversational:{label:(0,x.__)("Conversational","wp-parsely")},analytical:{label:(0,x.__)("Analytical","wp-parsely")},custom:{label:(0,x.__)("Custom Tone","wp-parsely"),icon:ae}},ye=Object.keys(ge),me=function(e){return"custom"===e||""===e?ge.custom.label:we(e)?e:ge[e].label},we=function(e){return!ye.includes(e)||"custom"===e},be=function(e){var t=e.value,n=e.onChange,r=(0,_.useState)(""),i=r[0],o=r[1],s=(0,se.useDebounce)(n,500);return(0,f.jsx)("div",{className:"parsely-tone-selector-custom",children:(0,f.jsx)(h.TextControl,{value:i||t,placeholder:(0,x.__)("Enter a custom tone","wp-parsely"),onChange:function(e){if(""===e)return n(""),void o("");e.length>32&&(e=e.slice(0,32)),s(e),o(e)}})})},_e=function(e){var t=e.tone,n=e.value,r=void 0===n?(0,x.__)("Select a tone","wp-parsely"):n,i=e.label,o=void 0===i?(0,x.__)("Tone","wp-parsely"):i,s=e.onChange,a=e.onDropdownChange,l=e.disabled,c=void 0!==l&&l,u=e.allowCustom,p=void 0!==u&&u;return(0,f.jsxs)(h.Disabled,{isDisabled:c,children:[(0,f.jsx)("div",{className:"wp-parsely-dropdown-label",children:o}),(0,f.jsx)(h.DropdownMenu,{label:(0,x.__)("Tone","wp-parsely"),className:"parsely-tone-selector-dropdown"+(c?" is-disabled":""),popoverProps:{className:"wp-parsely-popover"},toggleProps:{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{className:"parsely-tone-selector-label",children:we(t)?ge.custom.label:r}),(0,f.jsx)(ce,{})]})},children:function(e){var n=e.onClose;return(0,f.jsx)(h.MenuGroup,{label:(0,x.__)("Select a tone","wp-parsely"),children:(0,f.jsx)(f.Fragment,{children:ye.map((function(e){if(!p&&"custom"===e)return null;var r=ge[e],i=e===t||we(t)&&"custom"===e;return(0,f.jsxs)(h.MenuItem,{isSelected:i,className:i?"is-selected":"",role:"menuitemradio",onClick:function(){null==a||a(e),s(e),n(),"custom"===e&&setTimeout((function(){var e=document.querySelector(".parsely-tone-selector-custom input");e&&e.focus()}),0)},children:[r.icon&&(0,f.jsx)(le,{icon:r.icon}),r.label]},e)}))})})}}),p&&we(t)&&(0,f.jsx)(be,{onChange:function(e){s(""!==e?e:"custom")},value:"custom"===t?"":t})]})},xe=function(e){var t=e.isLoading,n=e.onPersonaChange,r=e.onToneChange,i=e.persona,o=e.tone;return(0,f.jsxs)("div",{className:"excerpt-suggestions-settings",children:[(0,f.jsx)(_e,{tone:o,value:me(o),onChange:function(e){r(e)},onDropdownChange:function(e){P.trackEvent("excerpt_generator_ai_tone_changed",{selectedTone:e})},disabled:t,allowCustom:!0}),(0,f.jsx)(ve,{persona:i,value:de(i),onChange:function(e){n(e)},onDropdownChange:function(e){P.trackEvent("excerpt_generator_ai_persona_changed",{persona:e})},disabled:t,allowCustom:!0})]})},ke=function(){return ke=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0?(0,x.sprintf)( +!function(){"use strict";var e={20:function(e,t,n){var r=n(609),i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,o={},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)s.call(t,r)&&!l.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:i,type:e,key:c,ref:u,props:o,_owner:a.current}}t.Fragment=o,t.jsx=c,t.jsxs=c},848:function(e,t,n){e.exports=n(20)},609:function(e){e.exports=window.React}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.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({},{_:function(){return Sr}});var e,t,r,i,o,s,a,l,c,u,p,d,f=n(848),h=window.wp.components,v=window.wp.data,g=window.wp.domReady,y=n.n(g);void 0!==window.wp&&(p=null!==(t=null===(e=window.wp.editor)||void 0===e?void 0:e.PluginDocumentSettingPanel)&&void 0!==t?t:null!==(i=null===(r=window.wp.editPost)||void 0===r?void 0:r.PluginDocumentSettingPanel)&&void 0!==i?i:null===(o=window.wp.editSite)||void 0===o?void 0:o.PluginDocumentSettingPanel,d=null!==(a=null===(s=window.wp.editor)||void 0===s?void 0:s.PluginSidebar)&&void 0!==a?a:null!==(c=null===(l=window.wp.editPost)||void 0===l?void 0:l.PluginSidebar)&&void 0!==c?c:null===(u=window.wp.editSite)||void 0===u?void 0:u.PluginSidebar);var m,w,b,_=window.wp.element,x=window.wp.i18n,k=window.wp.primitives,S=(0,f.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,f.jsx)(k.Path,{fillRule:"evenodd",d:"M11.25 5h1.5v15h-1.5V5zM6 10h1.5v10H6V10zm12 4h-1.5v6H18v-6z",clipRule:"evenodd"})}),j=window.wp.plugins,P=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){return n=this,r=arguments,o=function(t,n){var r;return void 0===n&&(n={}),function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=1e4&&(clearInterval(o),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}(),T=(P.trackEvent,function(){return(0,f.jsx)(h.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,f.jsx)(h.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"})})}),L=function(e){var t=e.size,n=void 0===t?24:t,r=e.className,i=void 0===r?"wp-parsely-icon":r;return(0,f.jsxs)(h.SVG,{className:i,height:n,viewBox:"0 0 60 65",width:n,xmlns:"http://www.w3.org/2000/svg",children:[(0,f.jsx)(h.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,f.jsx)(h.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,f.jsx)(h.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,f.jsx)(h.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"})]})},E=function(){return E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0?"".concat(i," ").concat(n):n)||this).hint=null,o.name=o.constructor.name,o.code=r;var s=[U.AccessToFeatureDisabled,U.ParselyApiForbidden,U.ParselyApiResponseContainsError,U.ParselyApiReturnedNoData,U.ParselyApiReturnedTooManyResults,U.PluginCredentialsNotSetMessageDetected,U.PluginSettingsApiSecretNotSet,U.PluginSettingsSiteIdNotSet,U.PostIsNotPublished,U.UnknownError,U.ParselySuggestionsApiAuthUnavailable,U.ParselySuggestionsApiNoAuthentication,U.ParselySuggestionsApiNoAuthorization,U.ParselySuggestionsApiNoData,U.ParselySuggestionsApiSchemaError];return o.retryFetch=!s.includes(o.code),Object.setPrototypeOf(o,t.prototype),o.code===U.AccessToFeatureDisabled?o.message=(0,x.__)("Access to this feature is disabled by the site's administration.","wp-parsely"):o.code===U.ParselySuggestionsApiNoAuthorization?o.message=(0,x.__)('This AI-powered feature is opt-in. To gain access, please submit a request here.',"wp-parsely"):o.code===U.ParselySuggestionsApiOpenAiError||o.code===U.ParselySuggestionsApiOpenAiUnavailable?o.message=(0,x.__)("The Parse.ly API returned an internal server error. Please retry with a different input, or try again later.","wp-parsely"):o.code===U.HttpRequestFailed&&o.message.includes("cURL error 28")?o.message=(0,x.__)("The Parse.ly API did not respond in a timely manner. Please try again later.","wp-parsely"):o.code===U.ParselySuggestionsApiSchemaError?o.message=(0,x.__)("The Parse.ly API returned a validation error. Please try again with different parameters.","wp-parsely"):o.code===U.ParselySuggestionsApiNoData?o.message=(0,x.__)("The Parse.ly API couldn't find any relevant data to fulfill the request. Please retry with a different input.","wp-parsely"):o.code===U.ParselySuggestionsApiOpenAiSchema?o.message=(0,x.__)("The Parse.ly API returned an incorrect response. Please try again later.","wp-parsely"):o.code===U.ParselySuggestionsApiAuthUnavailable&&(o.message=(0,x.__)("The Parse.ly API is currently unavailable. Please try again later.","wp-parsely")),o}return ee(t,e),t.prototype.Message=function(e){return void 0===e&&(e=null),[U.PluginCredentialsNotSetMessageDetected,U.PluginSettingsSiteIdNotSet,U.PluginSettingsApiSecretNotSet].includes(this.code)?X(e):(this.code===U.FetchError&&(this.hint=this.Hint((0,x.__)("This error can sometimes be caused by ad-blockers or browser tracking protections. Please add this site to any applicable allow lists and try again.","wp-parsely"))),this.code!==U.ParselyApiForbidden&&this.code!==U.ParselySuggestionsApiNoAuthentication||(this.hint=this.Hint((0,x.__)("Please ensure that the Site ID and API Secret given in the plugin's settings are correct.","wp-parsely"))),this.code===U.HttpRequestFailed&&(this.hint=this.Hint((0,x.__)("The Parse.ly API cannot be reached. Please verify that you are online.","wp-parsely"))),(0,f.jsx)(Q,{className:null==e?void 0:e.className,testId:"error",children:"

".concat(this.message,"

").concat(this.hint?this.hint:"")}))},t.prototype.Hint=function(e){return'

'.concat((0,x.__)("Hint:","wp-parsely")," ").concat(e,"

")},t.prototype.createErrorSnackbar=function(){//.test(this.message)||(0,v.dispatch)("core/notices").createNotice("error",this.message,{type:"snackbar"})},t}(Error),ne=window.wp.url,re=function(){function e(){this.abortControllers=new Map}return e.prototype.cancelRequest=function(e){if(e)(t=this.abortControllers.get(e))&&(t.abort(),this.abortControllers.delete(e));else{var t,n=Array.from(this.abortControllers.keys()).pop();n&&(t=this.abortControllers.get(n))&&(t.abort(),this.abortControllers.delete(n))}},e.prototype.cancelAll=function(){this.abortControllers.forEach((function(e){return e.abort()})),this.abortControllers.clear()},e.prototype.getOrCreateController=function(e){if(e&&this.abortControllers.has(e))return{abortController:this.abortControllers.get(e),abortId:e};var t=null!=e?e:"auto-"+Date.now(),n=new AbortController;return this.abortControllers.set(t,n),{abortController:n,abortId:t}},e.prototype.fetch=function(e,t){return n=this,r=void 0,o=function(){var n,r,i,o,s,a;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]32&&(e=e.slice(0,32)),s(e),o(e)}})})},ve=function(e){var t=e.persona,n=e.value,r=void 0===n?(0,x.__)("Select a persona…","wp-parsely"):n,i=e.label,o=void 0===i?(0,x.__)("Persona","wp-parsely"):i,s=e.onChange,a=e.onDropdownChange,l=e.disabled,c=void 0!==l&&l,u=e.allowCustom,p=void 0!==u&&u;return(0,f.jsxs)(h.Disabled,{isDisabled:c,children:[o&&(0,f.jsx)("div",{className:"wp-parsely-dropdown-label",children:o}),(0,f.jsx)(h.DropdownMenu,{label:(0,x.__)("Persona","wp-parsely"),className:"parsely-persona-selector-dropdown"+(c?" is-disabled":""),popoverProps:{className:"wp-parsely-popover"},toggleProps:{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{className:"parsely-persona-selector-label",children:fe(t)?ue.custom.label:r}),(0,f.jsx)(ce,{})]})},children:function(e){var n=e.onClose;return(0,f.jsx)(h.MenuGroup,{label:(0,x.__)("Persona","wp-parsely"),children:(0,f.jsx)(f.Fragment,{children:pe.map((function(e){if(!p&&"custom"===e)return null;var r=ue[e],i=e===t||fe(t)&&"custom"===e;return(0,f.jsxs)(h.MenuItem,{isSelected:i,className:i?"is-selected":"",role:"menuitemradio",onClick:function(){null==a||a(e),s(e),n(),"custom"===e&&setTimeout((function(){var e=document.querySelector(".parsely-persona-selector-custom input");e&&e.focus()}),0)},children:[r.icon&&(0,f.jsx)(le,{icon:r.icon}),r.label]},e)}))})})}}),p&&fe(t)&&(0,f.jsx)(he,{onChange:function(e){s(""!==e?e:"custom")},value:"custom"===t?"":t})]})},ge={neutral:{label:(0,x.__)("Neutral","wp-parsely")},formal:{label:(0,x.__)("Formal","wp-parsely")},humorous:{label:(0,x.__)("Humorous","wp-parsely")},confident:{label:(0,x.__)("Confident","wp-parsely")},provocative:{label:(0,x.__)("Provocative","wp-parsely")},serious:{label:(0,x.__)("Serious","wp-parsely")},inspirational:{label:(0,x.__)("Inspirational","wp-parsely")},skeptical:{label:(0,x.__)("Skeptical","wp-parsely")},conversational:{label:(0,x.__)("Conversational","wp-parsely")},analytical:{label:(0,x.__)("Analytical","wp-parsely")},custom:{label:(0,x.__)("Custom Tone","wp-parsely"),icon:ae}},ye=Object.keys(ge),me=function(e){return"custom"===e||""===e?ge.custom.label:we(e)?e:ge[e].label},we=function(e){return!ye.includes(e)||"custom"===e},be=function(e){var t=e.value,n=e.onChange,r=(0,_.useState)(""),i=r[0],o=r[1],s=(0,se.useDebounce)(n,500);return(0,f.jsx)("div",{className:"parsely-tone-selector-custom",children:(0,f.jsx)(h.TextControl,{value:i||t,placeholder:(0,x.__)("Enter a custom tone","wp-parsely"),onChange:function(e){if(""===e)return n(""),void o("");e.length>32&&(e=e.slice(0,32)),s(e),o(e)}})})},_e=function(e){var t=e.tone,n=e.value,r=void 0===n?(0,x.__)("Select a tone","wp-parsely"):n,i=e.label,o=void 0===i?(0,x.__)("Tone","wp-parsely"):i,s=e.onChange,a=e.onDropdownChange,l=e.disabled,c=void 0!==l&&l,u=e.allowCustom,p=void 0!==u&&u;return(0,f.jsxs)(h.Disabled,{isDisabled:c,children:[(0,f.jsx)("div",{className:"wp-parsely-dropdown-label",children:o}),(0,f.jsx)(h.DropdownMenu,{label:(0,x.__)("Tone","wp-parsely"),className:"parsely-tone-selector-dropdown"+(c?" is-disabled":""),popoverProps:{className:"wp-parsely-popover"},toggleProps:{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{className:"parsely-tone-selector-label",children:we(t)?ge.custom.label:r}),(0,f.jsx)(ce,{})]})},children:function(e){var n=e.onClose;return(0,f.jsx)(h.MenuGroup,{label:(0,x.__)("Select a tone","wp-parsely"),children:(0,f.jsx)(f.Fragment,{children:ye.map((function(e){if(!p&&"custom"===e)return null;var r=ge[e],i=e===t||we(t)&&"custom"===e;return(0,f.jsxs)(h.MenuItem,{isSelected:i,className:i?"is-selected":"",role:"menuitemradio",onClick:function(){null==a||a(e),s(e),n(),"custom"===e&&setTimeout((function(){var e=document.querySelector(".parsely-tone-selector-custom input");e&&e.focus()}),0)},children:[r.icon&&(0,f.jsx)(le,{icon:r.icon}),r.label]},e)}))})})}}),p&&we(t)&&(0,f.jsx)(be,{onChange:function(e){s(""!==e?e:"custom")},value:"custom"===t?"":t})]})},xe=function(e){var t=e.isLoading,n=e.onPersonaChange,r=e.onToneChange,i=e.persona,o=e.tone;return(0,f.jsxs)("div",{className:"excerpt-suggestions-settings",children:[(0,f.jsx)(_e,{tone:o,value:me(o),onChange:function(e){r(e)},onDropdownChange:function(e){P.trackEvent("excerpt_generator_ai_tone_changed",{selectedTone:e})},disabled:t,allowCustom:!0}),(0,f.jsx)(ve,{persona:i,value:de(i),onChange:function(e){n(e)},onDropdownChange:function(e){P.trackEvent("excerpt_generator_ai_persona_changed",{persona:e})},disabled:t,allowCustom:!0})]})},ke=function(){return ke=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0?(0,x.sprintf)( // Translators: %1$s the number of words in the excerpt. // Translators: %1$s the number of words in the excerpt. -(0,x._n)("%1$s word","%1$s words",e,"wp-parsely"),e):"")}),[a.currentExcerpt,I]),(0,_.useEffect)((function(){var e=document.querySelector(".editor-post-excerpt textarea");e&&(e.scrollTop=0)}),[a.newExcerptGeneratedCount]);var D=(0,f.jsxs)("div",{className:"wp-parsely-excerpt-generator-header",children:[(0,f.jsx)(L,{size:16}),(0,f.jsxs)("div",{className:"wp-parsely-excerpt-generator-header-label",children:[(0,x.__)("Generate With Parse.ly","wp-parsely"),(0,f.jsx)("span",{className:"beta-label",children:(0,x.__)("Beta","wp-parsely")})]})]});return(0,f.jsxs)("div",{className:"editor-post-excerpt",children:[(0,f.jsxs)("div",{style:{position:"relative"},children:[u&&(0,f.jsx)("div",{className:"editor-post-excerpt__loading_animation",children:(0,f.jsx)(Te,{})}),(0,f.jsx)(h.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Write an excerpt (optional)","wp-parsely"),className:"editor-post-excerpt__textarea",onChange:function(e){a.isUnderReview||N({excerpt:e}),l(ke(ke({},a),{currentExcerpt:e})),y(!0)},onKeyUp:function(){var e;if(g)y(!1);else{var t=document.querySelector(".editor-post-excerpt textarea"),n=null!==(e=null==t?void 0:t.textContent)&&void 0!==e?e:"";l(ke(ke({},a),{currentExcerpt:n}))}},value:u?"":a.isUnderReview?a.currentExcerpt:I,help:E||null})]}),(0,f.jsxs)(h.Button,{href:(0,x.__)("https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt","wp-parsely"),target:"_blank",variant:"link",children:[(0,x.__)("Learn more about manual excerpts","wp-parsely"),(0,f.jsx)(h.Icon,{icon:Y,size:18,className:"parsely-external-link-icon"})]}),(0,f.jsxs)("div",{className:"wp-parsely-excerpt-generator",children:[i&&(0,f.jsx)(h.Notice,{className:"wp-parsely-excerpt-generator-error",onRemove:function(){return o(void 0)},status:"info",children:i.Message()}),a.isUnderReview?(0,f.jsxs)(f.Fragment,{children:[D,(0,f.jsxs)("div",{className:"wp-parsely-excerpt-suggestions-review-controls",children:[(0,f.jsx)(h.Button,{variant:"secondary",onClick:function(){return Se(void 0,void 0,void 0,(function(){return je(this,(function(e){switch(e.label){case 0:return[4,N({excerpt:a.currentExcerpt})];case 1:return e.sent(),l(ke(ke({},a),{isUnderReview:!1})),P.trackEvent("excerpt_generator_accepted"),[2]}}))}))},children:(0,x.__)("Accept","wp-parsely")}),(0,f.jsx)(h.Button,{isDestructive:!0,variant:"secondary",onClick:function(){return Se(void 0,void 0,void 0,(function(){return je(this,(function(e){return N({excerpt:a.oldExcerpt}),l(ke(ke({},a),{currentExcerpt:a.oldExcerpt,isUnderReview:!1})),P.trackEvent("excerpt_generator_discarded"),[2]}))}))},children:(0,x.__)("Discard","wp-parsely")})]})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(xe,{isLoading:u,onPersonaChange:function(e){A("Persona",e),b(e)},onSettingChange:A,onToneChange:function(e){A("Tone",e),j(e)},persona:t.ExcerptSuggestions.Persona,tone:t.ExcerptSuggestions.Tone}),D,(0,f.jsx)("div",{className:"excerpt-suggestions-generate",children:(0,f.jsxs)(h.Button,{onClick:function(){return Se(void 0,void 0,void 0,(function(){var e,t;return je(this,(function(n){switch(n.label){case 0:p(!0),o(void 0),n.label=1;case 1:return n.trys.push([1,3,4,5]),P.trackEvent("excerpt_generator_pressed"),[4,oe.getInstance().generateExcerpt(B,R,w,S)];case 2:return e=n.sent(),l({currentExcerpt:e,isUnderReview:!0,newExcerptGeneratedCount:a.newExcerptGeneratedCount+1,oldExcerpt:I}),[3,5];case 3:return(t=n.sent())instanceof te?o(t):(o(new te((0,x.__)("An unknown error occurred.","wp-parsely"),U.UnknownError)),console.error(t)),[3,5];case 4:return p(!1),[7];case 5:return[2]}}))}))},variant:"primary",isBusy:u,disabled:u||!R,children:[u&&(0,x.__)("Generating Excerpt…","wp-parsely"),!u&&a.newExcerptGeneratedCount>0&&(0,x.__)("Regenerate Excerpt","wp-parsely"),!u&&0===a.newExcerptGeneratedCount&&(0,x.__)("Generate Excerpt","wp-parsely")]})})]}),(0,f.jsxs)(h.Button,{href:"https://docs.parse.ly/plugin-content-helper/#h-excerpt-generator-beta",target:"_blank",variant:"link",children:[(0,x.__)("Learn more about Parse.ly AI","wp-parsely"),(0,f.jsx)(h.Icon,{icon:Y,size:18,className:"parsely-external-link-icon"})]})]})]})},Te=function(){return(0,f.jsx)(h.Animate,{type:"loading",children:function(e){var t=e.className;return(0,f.jsx)("span",{className:t,children:(0,x.__)("Generating…","wp-parsely")})}})},Le=function(){return(0,f.jsx)(K.PostTypeSupportCheck,{supportKeys:"excerpt",children:(0,f.jsx)(p,{name:"parsely-post-excerpt",title:(0,x.__)("Excerpt","wp-parsely"),children:(0,f.jsx)(D,{endpoint:"editor-sidebar",defaultSettings:Sr(window.wpParselyContentHelperSettings),children:(0,f.jsx)(Pe,{})})})})},Ee=function(e,t){var n,r,i;return"wp-parsely-block-editor-sidebar"!==t||((null===(n=null===window||void 0===window?void 0:window.Jetpack_Editor_Initial_State)||void 0===n?void 0:n.available_blocks["ai-content-lens"])&&(console.log("Parse.ly: Jetpack AI is enabled and will be disabled."),(0,q.removeFilter)("blocks.registerBlockType","jetpack/ai-content-lens-features")),(0,j.registerPlugin)("wp-parsely-excerpt-suggestions",{render:function(){return(0,f.jsx)(Le,{})}}),(null===(r=(0,v.dispatch)("core/editor"))||void 0===r?void 0:r.removeEditorPanel)?null===(i=(0,v.dispatch)("core/editor"))||void 0===i||i.removeEditorPanel("post-excerpt"):null==Z||Z.removeEditorPanel("post-excerpt")),e};function Ce(){(0,q.addFilter)("plugins.registerPlugin","wp-parsely-excerpt-suggestions",Ee,1e3)}var Ne=window.wp.blockEditor;function Ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Oe=function(){return Oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)return r(e.innerBlocks,t[o].innerBlocks);if(JSON.stringify(e)!==JSON.stringify(t[o])){var s=t[o],a=i.parseFromString(e.attributes.content||"","text/html"),l=i.parseFromString((null==s?void 0:s.attributes.content)||"","text/html"),c=Array.from(a.querySelectorAll("a[data-smartlink]")),u=Array.from(l.querySelectorAll("a[data-smartlink]")),p=c.filter((function(e){return!u.some((function(t){return t.dataset.smartlink===e.dataset.smartlink}))})),d=u.filter((function(e){return!c.some((function(t){return t.dataset.smartlink===e.dataset.smartlink}))})),f=c.filter((function(e){var t=u.find((function(t){return t.dataset.smartlink===e.dataset.smartlink}));return t&&t.outerHTML!==e.outerHTML}));(p.length>0||d.length>0||f.length>0)&&n.push({block:e,prevBlock:s,addedLinks:p,removedLinks:d,changedLinks:f})}}}))};return r(e,t),n}(a,l.current);s.length>0&&(s.forEach((function(e){e.changedLinks.length>0&&n&&n(e),e.addedLinks.length>0&&i&&i(e),e.removedLinks.length>0&&r&&r(e)})),l.current=a)}),s);return e(t),function(){e.cancel()}}),[a,s,t,i,n,r]),null},Me=function(e){var t=e.value,n=e.onChange,r=e.max,i=e.min,o=e.suffix,s=e.size,a=e.label,l=e.initialPosition,c=e.disabled,u=e.className;return(0,f.jsxs)("div",{className:"parsely-inputrange-control ".concat(u||""),children:[(0,f.jsx)(h.__experimentalHeading,{className:"parsely-inputrange-control__label",level:3,children:a}),(0,f.jsxs)("div",{className:"parsely-inputrange-control__controls",children:[(0,f.jsx)(h.__experimentalNumberControl,{disabled:c,value:t,suffix:(0,f.jsx)(h.__experimentalInputControlSuffixWrapper,{children:o}),size:null!=s?s:"__unstable-large",min:i,max:r,onChange:function(e){var t=parseInt(e,10);isNaN(t)||n(t)}}),(0,f.jsx)(h.RangeControl,{disabled:c,value:t,showTooltip:!1,initialPosition:l,onChange:function(e){n(e)},withInputField:!1,min:i,max:r})]})]})},De=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))},Fe=function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0&&(0,x.__)("Regenerate Excerpt","wp-parsely"),!u&&0===a.newExcerptGeneratedCount&&(0,x.__)("Generate Excerpt","wp-parsely")]})})]}),(0,f.jsxs)(h.Button,{href:"https://docs.parse.ly/plugin-content-helper/#h-excerpt-generator-beta",target:"_blank",variant:"link",children:[(0,x.__)("Learn more about Parse.ly AI","wp-parsely"),(0,f.jsx)(h.Icon,{icon:Y,size:18,className:"parsely-external-link-icon"})]})]})]})},Te=function(){return(0,f.jsx)(h.Animate,{type:"loading",children:function(e){var t=e.className;return(0,f.jsx)("span",{className:t,children:(0,x.__)("Generating…","wp-parsely")})}})},Le=function(){return(0,f.jsx)(K.PostTypeSupportCheck,{supportKeys:"excerpt",children:(0,f.jsx)(p,{name:"parsely-post-excerpt",title:(0,x.__)("Excerpt","wp-parsely"),children:(0,f.jsx)(D,{endpoint:"editor-sidebar",defaultSettings:Sr(window.wpParselyContentHelperSettings),children:(0,f.jsx)(Pe,{})})})})},Ee=function(e,t){var n,r,i;return"wp-parsely-block-editor-sidebar"!==t?e:H().ExcerptSuggestions?((null===(n=null===window||void 0===window?void 0:window.Jetpack_Editor_Initial_State)||void 0===n?void 0:n.available_blocks["ai-content-lens"])&&(console.log("Parse.ly: Jetpack AI is enabled and will be disabled."),(0,q.removeFilter)("blocks.registerBlockType","jetpack/ai-content-lens-features")),(0,j.registerPlugin)("wp-parsely-excerpt-suggestions",{render:function(){return(0,f.jsx)(Le,{})}}),(null===(r=(0,v.dispatch)("core/editor"))||void 0===r?void 0:r.removeEditorPanel)?null===(i=(0,v.dispatch)("core/editor"))||void 0===i||i.removeEditorPanel("post-excerpt"):null==Z||Z.removeEditorPanel("post-excerpt"),e):e};function Ce(){(0,q.addFilter)("plugins.registerPlugin","wp-parsely-excerpt-suggestions",Ee,1e3)}var Ne=window.wp.blockEditor;function Ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Oe=function(){return Oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)return r(e.innerBlocks,t[o].innerBlocks);if(JSON.stringify(e)!==JSON.stringify(t[o])){var s=t[o],a=i.parseFromString(e.attributes.content||"","text/html"),l=i.parseFromString((null==s?void 0:s.attributes.content)||"","text/html"),c=Array.from(a.querySelectorAll("a[data-smartlink]")),u=Array.from(l.querySelectorAll("a[data-smartlink]")),p=c.filter((function(e){return!u.some((function(t){return t.dataset.smartlink===e.dataset.smartlink}))})),d=u.filter((function(e){return!c.some((function(t){return t.dataset.smartlink===e.dataset.smartlink}))})),f=c.filter((function(e){var t=u.find((function(t){return t.dataset.smartlink===e.dataset.smartlink}));return t&&t.outerHTML!==e.outerHTML}));(p.length>0||d.length>0||f.length>0)&&n.push({block:e,prevBlock:s,addedLinks:p,removedLinks:d,changedLinks:f})}}}))};return r(e,t),n}(a,l.current);s.length>0&&(s.forEach((function(e){e.changedLinks.length>0&&n&&n(e),e.addedLinks.length>0&&i&&i(e),e.removedLinks.length>0&&r&&r(e)})),l.current=a)}),s);return e(t),function(){e.cancel()}}),[a,s,t,i,n,r]),null},Me=function(e){var t=e.value,n=e.onChange,r=e.max,i=e.min,o=e.suffix,s=e.size,a=e.label,l=e.initialPosition,c=e.disabled,u=e.className;return(0,f.jsxs)("div",{className:"parsely-inputrange-control ".concat(u||""),children:[(0,f.jsx)(h.__experimentalHeading,{className:"parsely-inputrange-control__label",level:3,children:a}),(0,f.jsxs)("div",{className:"parsely-inputrange-control__controls",children:[(0,f.jsx)(h.__experimentalNumberControl,{disabled:c,value:t,suffix:(0,f.jsx)(h.__experimentalInputControlSuffixWrapper,{children:o}),size:null!=s?s:"__unstable-large",min:i,max:r,onChange:function(e){var t=parseInt(e,10);isNaN(t)||n(t)}}),(0,f.jsx)(h.RangeControl,{disabled:c,value:t,showTooltip:!1,initialPosition:l,onChange:function(e){n(e)},withInputField:!1,min:i,max:r})]})]})},De=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))},Fe=function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]

","\n\x3c!-- /wp:paragraph --\x3e");t&&d((0,Re.parse)(n))}),[o]),(0,f.jsxs)("div",{className:"smart-linking-review-suggestion",children:[(0,f.jsx)(h.KeyboardShortcuts,{shortcuts:{left:s,right:a,up:s,down:a}}),(0,f.jsx)("div",{className:"review-suggestion-post-title",children:null===(t=o.post_data)||void 0===t?void 0:t.title}),(0,f.jsxs)("div",{className:"review-suggestion-preview",children:[!(null===(n=o.post_data)||void 0===n?void 0:n.is_first_paragraph)&&(0,f.jsx)(_t,{topOrBottom:"top"}),(0,f.jsx)(bt,{block:p[0],link:o,useOriginalBlock:!0}),!(null===(r=o.post_data)||void 0===r?void 0:r.is_last_paragraph)&&(0,f.jsx)(_t,{topOrBottom:"bottom"})]}),(0,f.jsx)(h.__experimentalDivider,{}),(0,f.jsx)(xt,{link:o}),(0,f.jsxs)("div",{className:"review-controls",children:[(0,f.jsx)(h.Tooltip,{shortcut:"←",text:(0,x.__)("Previous","wp-parsely"),children:(0,f.jsx)(h.Button,{disabled:!l,className:"wp-parsely-review-suggestion-previous",onClick:s,icon:gt,children:(0,x.__)("Previous","wp-parsely")})}),(0,f.jsx)("div",{className:"reviews-controls-middle",children:(0,f.jsx)(h.Button,{target:"_blank",href:(null===(i=o.post_data)||void 0===i?void 0:i.edit_link)+"&smart-link="+o.uid,variant:"secondary",onClick:function(){P.trackEvent("smart_linking_open_in_editor_pressed",{type:"inbound",uid:o.uid})},children:(0,x.__)("Open in the Editor","wp-parsely")})}),(0,f.jsx)(h.Tooltip,{shortcut:"→",text:(0,x.__)("Next","wp-parsely"),children:(0,f.jsxs)(h.Button,{disabled:!c,onClick:a,className:"wp-parsely-review-suggestion-next",children:[(0,x.__)("Next","wp-parsely"),(0,f.jsx)(le,{icon:yt})]})})]})]})},St=function(e){var t=e.size,n=void 0===t?24:t,r=e.className,i=void 0===r?"wp-parsely-icon":r;return(0,f.jsxs)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",className:i,width:n,height:n,viewBox:"0 0 24 24",fill:"none",children:[(0,f.jsx)(h.Path,{d:"M8.18983 5.90381L8.83642 7.54325L10.4758 8.18983L8.83642 8.8364L8.18983 10.4759L7.54324 8.8364L5.90381 8.18983L7.54324 7.54325L8.18983 5.90381Z"}),(0,f.jsx)(h.Path,{d:"M15.048 5.90381L15.9101 8.08972L18.0961 8.95186L15.9101 9.81397L15.048 11.9999L14.1859 9.81397L12 8.95186L14.1859 8.08972L15.048 5.90381Z"}),(0,f.jsx)(h.Path,{d:"M11.238 10.4761L12.3157 13.2085L15.048 14.2861L12.3157 15.3638L11.238 18.0962L10.1603 15.3638L7.42798 14.2861L10.1603 13.2085L11.238 10.4761Z"})]})},jt=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;ii.bottom)&&(n.scrollTop=r.offsetTop-n.offsetTop)}}}}),[t,l]);var u=function(){var e=document.querySelector(".smart-linking-review-sidebar-tabs [data-active-item]"),t=null==e?void 0:e.nextElementSibling;t||(t=document.querySelector('.smart-linking-review-sidebar-tabs [role="tab"]')),t&&t.click()},p=(0,f.jsxs)("span",{className:"smart-linking-menu-label",children:[(0,x.__)("NEW","wp-parsely"),(0,f.jsx)(St,{})]}),d=[];n&&n.length>0&&d.push({name:"outbound",title:(0,x.__)("Outbound","wp-parsely")}),r&&r.length>0&&d.push({name:"inbound",title:(0,x.__)("Inbound","wp-parsely")});var v="outbound";return d=d.filter((function(e){return"outbound"===e.name&&r&&0===r.length&&(e.title=(0,x.__)("Outbound Smart Links","wp-parsely"),v="outbound"),"inbound"===e.name&&n&&0===n.length&&(e.title=(0,x.__)("Inbound Smart Links","wp-parsely"),v="inbound"),e})),(0,f.jsxs)("div",{className:"smart-linking-review-sidebar",ref:o,children:[(0,f.jsx)(h.KeyboardShortcuts,{shortcuts:{tab:function(){return u()},"shift+tab":function(){return u()}}}),(0,f.jsx)(h.TabPanel,{className:"smart-linking-review-sidebar-tabs",initialTabName:v,tabs:d,onSelect:function(e){var t,o;"outbound"===e&&n&&n.length>0&&i(n[0]),"inbound"===e&&r&&r.length>0&&i(r[0]),P.trackEvent("smart_linking_modal_tab_selected",{tab:e,total_inbound:null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0,total_outbound:null!==(o=null==n?void 0:n.length)&&void 0!==o?o:0})},children:function(e){return(0,f.jsxs)(f.Fragment,{children:["outbound"===e.name&&(0,f.jsx)(f.Fragment,{children:n&&0!==n.length?n.map((function(e,n){return(0,f.jsxs)(h.MenuItem,{ref:function(e){s.current[n]=e},className:(null==t?void 0:t.uid)===e.uid?"is-selected":"",role:"menuitemradio",isSelected:(null==t?void 0:t.uid)===e.uid,onClick:function(){return i(e)},children:[(0,f.jsx)("span",{className:"smart-linking-menu-item",children:e.text}),!e.applied&&p]},e.uid)})):(0,f.jsxs)(f.Fragment,{children:[" ",(0,x.__)("No outbound links found.","wp-parsely")]})}),"inbound"===e.name&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{className:"review-sidebar-tip",children:(0,x.__)("This section shows external posts that link back to the current post.","wp-parsely")}),r&&0!==r.length?r.map((function(e,r){var o;return(0,f.jsx)(h.MenuItem,{ref:function(e){s.current[(n?n.length:0)+r]=e},className:(null==t?void 0:t.uid)===e.uid?"is-selected":"",role:"menuitemradio",isSelected:(null==t?void 0:t.uid)===e.uid,onClick:function(){return i(e)},children:(0,f.jsx)("span",{className:"smart-linking-menu-item",children:null===(o=e.post_data)||void 0===o?void 0:o.title})},e.uid)})):(0,f.jsxs)(f.Fragment,{children:[" ",(0,x.__)("No inbound links found.","wp-parsely")]})]})]})}})]})},Tt=(0,f.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,f.jsx)(k.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"})}),Lt=(0,f.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,f.jsx)(k.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),Et=function(e){var t,n,r,i,o=null===(t=e.link.match)||void 0===t?void 0:t.blockId,s=(0,v.useSelect)((function(e){var t=e("core/block-editor"),n=t.getBlock,r=t.getBlockParents;return o?{block:n(o),parents:r(o).map((function(e){return n(e)})).filter((function(e){return void 0!==e}))}:{block:void 0,parents:[]}}),[o]),a=s.block,l=s.parents;return a?(0,f.jsxs)("div",{className:"review-suggestions-breadcrumbs",children:[l.map((function(e,t){var n;return(0,f.jsxs)("span",{children:[(0,f.jsx)("span",{className:"breadcrumbs-parent-block",children:null===(n=(0,Re.getBlockType)(e.name))||void 0===n?void 0:n.title}),(0,f.jsx)("span",{className:"breadcrumbs-parent-separator",children:" / "})]},t)})),(0,f.jsxs)("span",{className:"breadcrumbs-current-block",children:[(0,f.jsx)("span",{className:"breadcrumbs-current-block-type",children:null===(n=(0,Re.getBlockType)(a.name))||void 0===n?void 0:n.title}),(null===(i=null===(r=a.attributes)||void 0===r?void 0:r.metadata)||void 0===i?void 0:i.name)&&(0,f.jsx)("span",{className:"breadcrumbs-current-block-name",children:a.attributes.metadata.name})]})]}):(0,f.jsx)(f.Fragment,{})},Ct=function(e){var t,n=e.link,r=(0,_.useState)(n.href),i=r[0],o=r[1],s=(0,_.useState)(null===(t=n.destination)||void 0===t?void 0:t.post_type),a=s[0],l=s[1],c=(0,_.useRef)(null),u=(0,v.useDispatch)(it).updateSmartLink;return(0,_.useEffect)((function(){n.destination?l(n.destination.post_type):(l((0,x.__)("External","wp-parsely")),dt.getInstance().getPostTypeByURL(n.href).then((function(e){e&&l(e.post_type),n.destination=e,u(n)})))}),[n,u]),(0,_.useEffect)((function(){var e=function(){if(c.current){var e=c.current.offsetWidth,t=Math.floor(e/8);o(function(e,t){var n=e.replace(/(^\w+:|^)\/\//,"").replace(/^www\./,"");if(!t||n.length<=t)return n;var r=n.split("/")[0],i=n.substring(r.length);t-=r.length;var o=Math.floor((t-3)/2),s=i.substring(0,o),a=i.substring(i.length-o);return"".concat(r).concat(s,"...").concat(a)}(n.href,t))}};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[n]),(0,f.jsx)(h.MenuItem,{ref:c,info:i,iconPosition:"left",icon:vt,shortcut:a,className:"block-editor-link-control__search-item wp-parsely-link-suggestion-link-details",children:n.title})},Nt=function(e){var t=e.link,n=e.onNext,r=e.onPrevious,i=e.onAccept,o=e.onReject,s=e.onRemove,a=e.onSelectInEditor,l=e.hasPrevious,c=e.hasNext;if(t&&void 0!==t.post_data)return(0,f.jsx)(kt,{link:t,onNext:n,onPrevious:r,onAccept:i,onReject:o,onRemove:s,onSelectInEditor:a,hasPrevious:l,hasNext:c});if(!(null==t?void 0:t.match))return(0,f.jsx)(f.Fragment,{children:(0,x.__)("This Smart Link does not have any matches in the current content.","wp-parsely")});var u=t.match.blockId,p=(0,v.select)("core/block-editor").getBlock(u),d=t.applied;return p?(0,f.jsxs)("div",{className:"smart-linking-review-suggestion",children:[(0,f.jsx)(h.KeyboardShortcuts,{shortcuts:{left:r,right:n,up:r,down:n,a:function(){t&&!t.applied&&i()},r:function(){t&&(t.applied?s():o())}}}),(0,f.jsx)(Et,{link:t}),(0,f.jsx)("div",{className:"review-suggestion-preview",children:(0,f.jsx)(bt,{block:p,link:t})}),(0,f.jsx)(h.__experimentalDivider,{}),(0,f.jsx)(Ct,{link:t}),(0,f.jsxs)("div",{className:"review-controls",children:[(0,f.jsx)(h.Tooltip,{shortcut:"←",text:(0,x.__)("Previous","wp-parsely"),children:(0,f.jsx)(h.Button,{disabled:!l,className:"wp-parsely-review-suggestion-previous",onClick:r,icon:gt,children:(0,x.__)("Previous","wp-parsely")})}),(0,f.jsxs)("div",{className:"reviews-controls-middle",children:[!d&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(h.Tooltip,{shortcut:"R",text:(0,x.__)("Reject","wp-parsely"),children:(0,f.jsx)(h.Button,{className:"wp-parsely-review-suggestion-reject",icon:Tt,onClick:o,variant:"secondary",children:(0,x.__)("Reject","wp-parsely")})}),(0,f.jsx)(h.Tooltip,{shortcut:"A",text:(0,x.__)("Accept","wp-parsely"),children:(0,f.jsx)(h.Button,{className:"wp-parsely-review-suggestion-accept",icon:Lt,onClick:i,variant:"secondary",children:(0,x.__)("Accept","wp-parsely")})})]}),d&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(h.Tooltip,{shortcut:"R",text:(0,x.__)("Remove","wp-parsely"),children:(0,f.jsx)(h.Button,{className:"wp-parsely-review-suggestion-reject",icon:Tt,onClick:s,variant:"secondary",children:(0,x.__)("Remove","wp-parsely")})}),(0,f.jsx)(h.Button,{className:"wp-parsely-review-suggestion-accept",onClick:a,variant:"secondary",children:(0,x.__)("Select in Editor","wp-parsely")})]})]}),(0,f.jsx)(h.Tooltip,{shortcut:"→",text:(0,x.__)("Next","wp-parsely"),children:(0,f.jsxs)(h.Button,{disabled:!c,onClick:n,className:"wp-parsely-review-suggestion-next",children:[(0,x.__)("Next","wp-parsely"),(0,f.jsx)(le,{icon:yt})]})})]})]}):(0,f.jsx)(f.Fragment,{children:(0,x.__)("No block is selected.","wp-parsely")})},At=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))},Ot=function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0&&(a=s[0],(l=a.parentNode)&&(c=document.createTextNode(null!==(u=a.textContent)&&void 0!==u?u:""),l.replaceChild(c,a),$.updateBlockAttributes(n,{content:o.innerHTML}))),[4,E(t.uid)]):[2]):[2];case 1:return p.sent(),[2]}}))}))},N=(0,_.useCallback)((function(){c(!1),w().filter((function(e){return!e.applied})).length>0?s(!0):(W.unlockPostAutosaving("smart-linking-review-modal"),t())}),[w,t]),A=function(e){s(!1),e?(c(!1),T().then((function(){N()}))):c(!0)},O=function(){if(Ge(k)){var e=g.indexOf(k);if(!g[t=e+1])return;S(g[t])}else{var t;if(e=d.indexOf(k),!d[t=e+1])return;S(d[t])}},I=function(){if(Ge(k)){var e=g.indexOf(k);if(!g[t=e-1])return;S(g[t])}else{var t;if(e=d.indexOf(k),!d[t=e-1])return;S(d[t])}};return(0,_.useEffect)((function(){l?W.lockPostAutosaving("smart-linking-review-modal"):l&&0===p.length&&N()}),[l,t,p,N]),(0,_.useEffect)((function(){c(n)}),[n]),(0,f.jsxs)(f.Fragment,{children:[l&&(0,f.jsx)(h.Modal,{title:(0,x.__)("Review Smart Links","wp-parsely"),className:"wp-parsely-smart-linking-review-modal",onRequestClose:N,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,children:(0,f.jsxs)("div",{className:"smart-linking-modal-body",children:[(0,f.jsx)(Pt,{outboundLinks:d,inboundLinks:g,activeLink:k,setSelectedLink:S}),k&&(Ge(k)?(0,f.jsx)(kt,{link:k,onNext:O,onPrevious:I,hasNext:g.indexOf(k)0}):(0,f.jsx)(Nt,{link:k,hasNext:m().indexOf(k)0,onNext:O,onPrevious:I,onAccept:function(){return At(void 0,void 0,void 0,(function(){var e,t;return Ot(this,(function(n){switch(n.label){case 0:return k.match?(r(k),[4,(i=k.match.blockId,o=k,At(void 0,void 0,void 0,(function(){var e,t;return Ot(this,(function(n){switch(n.label){case 0:return(e=document.createElement("a")).href=o.href,e.title=o.title,e.setAttribute("data-smartlink",o.uid),(t=(0,v.select)("core/block-editor").getBlock(i))?(Ue(t,o,e),o.applied=!0,[4,L(o)]):[2];case 1:return n.sent(),[2]}}))})))]):[2];case 1:return n.sent(),P.trackEvent("smart_linking_link_accepted",{link:k.href,title:k.title,text:k.text,uid:k.uid}),0===y().length?(N(),[2]):(e=d.indexOf(k),d[t=e+1]?S(d[t]):S(d[0]),[2])}var i,o}))}))},onReject:function(){return At(void 0,void 0,void 0,(function(){var e,t;return Ot(this,(function(n){switch(n.label){case 0:return e=d.indexOf(k),d[t=e+1]?S(d[t]):d[0]?S(d[0]):N(),[4,E(k.uid)];case 1:return n.sent(),P.trackEvent("smart_linking_link_rejected",{link:k.href,title:k.title,text:k.text,uid:k.uid}),[2]}}))}))},onRemove:function(){return At(void 0,void 0,void 0,(function(){var e,t,n,r;return Ot(this,(function(i){switch(i.label){case 0:return k.match?(e=(0,v.select)("core/block-editor").getBlock(k.match.blockId))?(t=m(),n=t.indexOf(k),r=n-1,[4,C(e,k)]):[3,2]:[2];case 1:if(i.sent(),P.trackEvent("smart_linking_link_removed",{link:k.href,title:k.title,text:k.text,uid:k.uid}),0===(t=m()).length&&g.length>0)return S(g[0]),[2];if(0===t.length&&0===g.length)return N(),[2];if(t[r])return S(t[r]),[2];S(t[0]),i.label=2;case 2:return[2]}}))}))},onSelectInEditor:function(){if(k.match){var e=(0,v.select)("core/block-editor").getBlock(k.match.blockId);if(e){$.selectBlock(e.clientId);var t=document.querySelector('[data-block="'.concat(e.clientId,'"]'));t&&et(t,k.uid),P.trackEvent("smart_linking_select_in_editor_pressed",{type:"outbound",uid:k.uid}),N()}}}}))]})}),o&&(0,f.jsxs)(h.Modal,{title:(0,x.__)("Review Smart Links","wp-parsely"),onRequestClose:function(){return A(!1)},className:"wp-parsely-smart-linking-close-dialog",children:[(0,x.__)("Are you sure you want to close? All un-accepted smart links will not be added.","wp-parsely"),(0,f.jsxs)("div",{className:"smart-linking-close-dialog-actions",children:[(0,f.jsx)(h.Button,{variant:"secondary",onClick:function(){return A(!1)},children:(0,x.__)("Go Back","wp-parsely")}),(0,f.jsx)(h.Button,{variant:"primary",onClick:function(){return A(!0)},children:(0,x.__)("Close","wp-parsely")})]})]})]})})),Rt=function(){return Rt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0&&k("success",/* translators: %d: number of smart links applied */ /* translators: %d: number of smart links applied */ (0,x.sprintf)((0,x.__)("%s smart links successfully applied.","wp-parsely"),g),{type:"snackbar"}):y(0)}),[w]),(0,_.useEffect)((function(){if(!(Object.keys(I).length>0)){var e={maxLinksPerPost:a.SmartLinking.MaxLinks};ee(e)}}),[ee,a]);var pe=(0,v.useSelect)((function(e){var t=e("core/block-editor"),r=t.getSelectedBlock,i=t.getBlock,o=t.getBlocks,s=e("core/editor"),a=s.getEditedPostContent,l=s.getCurrentPostAttribute;return{allBlocks:o(),selectedBlock:n?i(n):r(),postContent:a(),postPermalink:l("link")}}),[n]),de=pe.allBlocks,fe=pe.selectedBlock,he=pe.postContent,ve=pe.postPermalink,ge=function(e){return Bt(void 0,void 0,void 0,(function(){var t,n,r,i,o;return Mt(this,(function(s){switch(s.label){case 0:t=[],s.label=1;case 1:return s.trys.push([1,4,,9]),[4,ne((n=E||!fe)?Qe.All:Qe.Selected)];case 2:return s.sent(),a=ve.replace(/^https?:\/\//i,""),r=["http://"+a,"https://"+a],i=function(e){return e.map((function(e){return e.href}))}(F),r.push.apply(r,i),[4,dt.getInstance().generateSmartLinks(fe&&!n?(0,Re.getBlockContent)(fe):he,O,r)];case 3:return t=s.sent(),[3,9];case 4:if((o=s.sent()).code&&o.code===U.ParselyAborted)throw o.numRetries=3-e,o;return e>0&&o.retryFetch?(console.error(o),[4,ie(!0)]):[3,8];case 5:return s.sent(),[4,oe()];case 6:return s.sent(),[4,ge(e-1)];case 7:return[2,s.sent()];case 8:throw o;case 9:return[2,t]}var a}))}))},ye=function(){for(var e=[],t=0;t[type="button"]').forEach((function(e){e.setAttribute("disabled","disabled")}))},be=function(){document.querySelectorAll('.edit-post-header__settings>[type="button"]').forEach((function(e){e.removeAttribute("disabled")})),W.unlockPostSaving("wp-parsely-block-overlay")};return(0,f.jsxs)("div",{className:"wp-parsely-smart-linking",children:[(0,f.jsx)(Be,{isDetectingEnabled:!L,onLinkRemove:function(e){!function(e){De(this,void 0,void 0,(function(){var t,n,r;return Fe(this,(function(i){switch(i.label){case 0:return[4,Ye((0,Re.getBlockContent)(e),e.clientId)];case 1:return t=i.sent(),n=t.missingSmartLinks,r=t.didAnyFixes,n.forEach((function(e){(0,v.dispatch)(it).removeSmartLink(e.uid)})),[2,r]}}))}))}(e.block)}}),(0,f.jsxs)(h.PanelRow,{className:t,children:[(0,f.jsxs)("div",{className:"smart-linking-text",children:[(0,x.__)("Automatically insert links to your most relevant, top performing content.","wp-parsely"),(0,f.jsxs)(h.Button,{href:"https://docs.parse.ly/plugin-content-helper/#h-smart-linking-beta",target:"_blank",variant:"link",children:[(0,x.__)("Learn more about Parse.ly AI","wp-parsely"),(0,f.jsx)(le,{icon:Y,size:18,className:"parsely-external-link-icon"})]})]}),N&&(0,f.jsx)(h.Notice,{status:"info",onRemove:function(){return $(null)},className:"wp-parsely-content-helper-error",children:N.Message()}),w&&g>0&&(0,f.jsx)(h.Notice,{status:"success",onRemove:function(){return b(!1)},className:"wp-parsely-smart-linking-suggested-links",children:(0,x.sprintf)(/* translators: 1 - number of smart links generated */ /* translators: 1 - number of smart links generated */ (0,x.__)("Successfully added %s smart links.","wp-parsely"),g>0?g:A.length)}),(0,f.jsx)(lt,{disabled:T,selectedBlock:fe,onSettingChange:function(e,t){var n;p({SmartLinking:Rt(Rt({},a.SmartLinking),(n={},n[e]=t,n))}),"MaxLinks"===e&&re(t)}}),(0,f.jsx)("div",{className:"smart-linking-generate",children:(0,f.jsx)(h.Button,{onClick:function(){return Bt(void 0,void 0,void 0,(function(){var e,t,n,r,o,s,a,l;return Mt(this,(function(c){switch(c.label){case 0:return[4,q(!0)];case 1:return c.sent(),[4,ae()];case 2:return c.sent(),[4,$(null)];case 3:return c.sent(),b(!1),P.trackEvent("smart_linking_generate_pressed",{is_full_content:E,selected_block:null!==(s=null==fe?void 0:fe.name)&&void 0!==s?s:"none",context:i}),[4,ye(E?"all":null==fe?void 0:fe.clientId)];case 4:c.sent(),e=setTimeout((function(){var e;q(!1),P.trackEvent("smart_linking_generate_timeout",{is_full_content:E,selected_block:null!==(e=null==fe?void 0:fe.name)&&void 0!==e?e:"none",context:i}),me(E?"all":null==fe?void 0:fe.clientId)}),18e4),t=R,c.label=5;case 5:return c.trys.push([5,8,10,15]),[4,ge(3)];case 6:return n=c.sent(),[4,(u=n,Bt(void 0,void 0,void 0,(function(){var e;return Mt(this,(function(t){switch(t.label){case 0:return u=u.filter((function(e){return!F.some((function(t){return t.uid===e.uid&&t.applied}))})),e=ve.replace(/^https?:\/\//,"").replace(/\/+$/,""),u=(u=u.filter((function(t){return!t.href.includes(e)||(console.warn("PCH Smart Linking: Skipping self-reference link: ".concat(t.href)),!1)}))).filter((function(e){return!F.some((function(t){return t.href===e.href?(console.warn("PCH Smart Linking: Skipping duplicate link: ".concat(e.href)),!0):t.text===e.text&&t.offset!==e.offset&&(console.warn("PCH Smart Linking: Skipping duplicate link text: ".concat(e.text)),!0)}))})),u=(u=We(E?de:[fe],u,{}).filter((function(e){return e.match}))).filter((function(e){if(!e.match)return!1;var t=e.match.blockLinkPosition,n=t+e.text.length;return!F.some((function(r){if(!r.match)return!1;if(e.match.blockId!==r.match.blockId)return!1;var i=r.match.blockLinkPosition,o=i+r.text.length;return t>=i&&n<=o}))})),[4,Z(u)];case 1:return t.sent(),[2,u]}}))})))];case 7:if(0===c.sent().length)throw new te((0,x.__)("No smart links were generated.","wp-parsely"),U.ParselySuggestionsApiNoData,"");return ce(!0),[3,15];case 8:return r=c.sent(),o=new te(null!==(a=r.message)&&void 0!==a?a:"An unknown error has occurred.",null!==(l=r.code)&&void 0!==l?l:U.UnknownError),r.code&&r.code===U.ParselyAborted&&(o.message=(0,x.sprintf)(/* translators: %d: number of retry attempts, %s: attempt plural */ /* translators: %d: number of retry attempts, %s: attempt plural */ diff --git a/src/class-permissions.php b/src/class-permissions.php index fdb1c8b8c..8767f737a 100644 --- a/src/class-permissions.php +++ b/src/class-permissions.php @@ -154,8 +154,9 @@ public static function current_user_can_use_pch_feature( public static function get_pch_permissions_json( $pch_options ): string { $permissions = array(); $features = array( - 'SmartLinking' => 'smart_linking', - 'TitleSuggestions' => 'title_suggestions', + 'SmartLinking' => 'smart_linking', + 'TitleSuggestions' => 'title_suggestions', + 'ExcerptSuggestions' => 'excerpt_suggestions', ); foreach ( $features as $key => $value ) { diff --git a/src/content-helper/common/utils/permissions.ts b/src/content-helper/common/utils/permissions.ts index 541462987..1cfddbfc6 100644 --- a/src/content-helper/common/utils/permissions.ts +++ b/src/content-helper/common/utils/permissions.ts @@ -6,6 +6,7 @@ export interface ContentHelperPermissions { SmartLinking: boolean; TitleSuggestions: boolean; + ExcerptSuggestions: boolean; } /** @@ -19,6 +20,7 @@ export function getContentHelperPermissions(): ContentHelperPermissions { const defaultPermissions: ContentHelperPermissions = { SmartLinking: false, TitleSuggestions: false, + ExcerptSuggestions: false, }; try { diff --git a/src/content-helper/editor-sidebar/excerpt-suggestions/excerpt-suggestions.tsx b/src/content-helper/editor-sidebar/excerpt-suggestions/excerpt-suggestions.tsx index da7790eca..5b323a364 100644 --- a/src/content-helper/editor-sidebar/excerpt-suggestions/excerpt-suggestions.tsx +++ b/src/content-helper/editor-sidebar/excerpt-suggestions/excerpt-suggestions.tsx @@ -9,6 +9,7 @@ import { registerPlugin } from '@wordpress/plugins'; * Internal dependencies */ import { dispatchCoreEditPost } from '../../../@types/gutenberg/types'; +import { getContentHelperPermissions } from '../../common/utils/permissions'; import { ExcerptPanel } from './component-panel'; import './excerpt-suggestions.scss'; @@ -29,6 +30,12 @@ const ExcerptSuggestions = ( settings: never, name: string ) => { return settings; } + // Check if the user has the necessary permissions to use the ExcerptSuggestions feature. + const permissions = getContentHelperPermissions(); + if ( ! permissions.ExcerptSuggestions ) { + return settings; + } + const isJetpackAiEnabled = window?.Jetpack_Editor_Initial_State?.available_blocks[ 'ai-content-lens' ];