64 lines
26 KiB
JavaScript
64 lines
26 KiB
JavaScript
(()=>{"use strict";var e={865:(e,t,n)=>{var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=i(n(609)),s=i(n(848)),a=i(n(812));function i(e){return e&&e.__esModule?e:{default:e}}var l=void 0;function c(e,t){var n,a,i,u,d,p,g,m,f=[],h={};for(p=0;p<e.length;p++)if("string"!==(d=e[p]).type){if(!t.hasOwnProperty(d.value)||void 0===t[d.value])throw new Error("Invalid interpolation, missing component node: `"+d.value+"`");if("object"!==o(t[d.value]))throw new Error("Invalid interpolation, component node must be a ReactElement or null: `"+d.value+"`","\n> "+l);if("componentClose"===d.type)throw new Error("Missing opening component token: `"+d.value+"`");if("componentOpen"===d.type){n=t[d.value],i=p;break}f.push(t[d.value])}else f.push(d.value);return n&&(u=function(e,t){var n,o,r=t[e],s=0;for(o=e+1;o<t.length;o++)if((n=t[o]).value===r.value){if("componentOpen"===n.type){s++;continue}if("componentClose"===n.type){if(0===s)return o;s--}}throw new Error("Missing closing component token `"+r.value+"`")}(i,e),g=c(e.slice(i+1,u),t),a=r.default.cloneElement(n,{},g),f.push(a),u<e.length-1&&(m=c(e.slice(u+1),t),f=f.concat(m))),1===f.length?f[0]:(f.forEach((function(e,t){e&&(h["interpolation-child-"+t]=e)})),(0,s.default)(h))}t.A=function(e){var t=e.mixedString,n=e.components,r=e.throwErrors;if(l=t,!n)return t;if("object"!==(void 0===n?"undefined":o(n))){if(r)throw new Error("Interpolation Error: unable to process `"+t+"` because components is not an object");return t}var s=(0,a.default)(t);try{return c(s,n)}catch(e){if(r)throw new Error("Interpolation Error: unable to process `"+t+"` because of error `"+e.message+"`");return t}}},812:e=>{function t(e){return e.match(/^\{\{\//)?{type:"componentClose",value:e.replace(/\W/g,"")}:e.match(/\/\}\}$/)?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.match(/^\{\{/)?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}e.exports=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(t)}},848:(e,t,n)=>{var o=n(609),r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,s=n(650),a=n(163),i=n(759),l=".",c=":",u="function"==typeof Symbol&&Symbol.iterator,d="@@iterator";function p(e,t){return e&&"object"==typeof e&&null!=e.key?(n=e.key,o={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,(function(e){return o[e]}))):t.toString(36);var n,o}function g(e,t,n,o){var s,i=typeof e;if("undefined"!==i&&"boolean"!==i||(e=null),null===e||"string"===i||"number"===i||"object"===i&&e.$$typeof===r)return n(o,e,""===t?l+p(e,0):t),1;var m=0,f=""===t?l:t+c;if(Array.isArray(e))for(var h=0;h<e.length;h++)m+=g(s=e[h],f+p(s,h),n,o);else{var b=function(e){var t=e&&(u&&e[u]||e[d]);if("function"==typeof t)return t}(e);if(b)for(var y,w=b.call(e),v=0;!(y=w.next()).done;)m+=g(s=y.value,f+p(s,v++),n,o);else if("object"===i){var k=""+e;a(!1,"Objects are not valid as a React child (found: %s).%s","[object Object]"===k?"object with keys {"+Object.keys(e).join(", ")+"}":k,"")}}return m}var m=/\/+/g;function f(e){return(""+e).replace(m,"$&/")}var h,b,y=w,w=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)};function v(e,t,n,o){this.result=e,this.keyPrefix=t,this.func=n,this.context=o,this.count=0}function k(e,t,n){var r,a,i=e.result,l=e.keyPrefix,c=e.func,u=e.context,d=c.call(u,t,e.count++);Array.isArray(d)?x(d,i,n,s.thatReturnsArgument):null!=d&&(o.isValidElement(d)&&(r=d,a=l+(!d.key||t&&t.key===d.key?"":f(d.key)+"/")+n,d=o.cloneElement(r,{key:a},void 0!==r.props?r.props.children:void 0)),i.push(d))}function x(e,t,n,o,r){var s="";null!=n&&(s=f(n)+"/");var a=v.getPooled(t,s,o,r);!function(e,t,n){null==e||g(e,"",t,n)}(e,k,a),v.release(a)}v.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},h=function(e,t,n,o){var r=this;if(r.instancePool.length){var s=r.instancePool.pop();return r.call(s,e,t,n,o),s}return new r(e,t,n,o)},(b=v).instancePool=[],b.getPooled=h||y,b.poolSize||(b.poolSize=10),b.release=function(e){var t=this;a(e instanceof t,"Trying to release an instance into a pool of a different type."),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},e.exports=function(e){if("object"!=typeof e||!e||Array.isArray(e))return i(!1,"React.addons.createFragment only accepts a single object. Got: %s",e),e;if(o.isValidElement(e))return i(!1,"React.addons.createFragment does not accept a ReactElement without a wrapper object."),e;a(1!==e.nodeType,"React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.");var t=[];for(var n in e)x(e[n],t,n,s.thatReturnsArgument);return t}},650:e=>{function t(e){return function(){return e}}var n=function(){};n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},163:e=>{e.exports=function(e,t,n,o,r,s,a,i){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,r,s,a,i],u=0;(l=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw l.framesToPop=1,l}}},759:(e,t,n)=>{var o=n(650);e.exports=o},609:e=>{e.exports=window.React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{const e=window.lodash;var t=n(609);const o=window.wp.blocks,r=window.wp.blockEditor,s=window.wp.components,a=window.wp.data,i=window.wp.domReady;var l=n.n(i);const c=window.wp.element,u=window.wp.i18n,d=window.wp.a11y,p=window.wp.url,g=window.yoast.helpers;var m=n(865);const f=window.yoast.propTypes;var h=n.n(f);const b=window.yoast.styledComponents;var y=n.n(b);const w=window.yoast.componentsNew,v=window.yoast.styleGuide,k=y().div`
|
||
display: flex;
|
||
align-items: normal;
|
||
min-height: 40px;
|
||
margin: 10px 0 5px;
|
||
`,x=(0,g.createSvgIconComponent)({copy:{viewbox:"0 0 448 512",path:"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"},check:{viewbox:"0 0 512 512",path:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}}),E=y().div`
|
||
background-color: #e5e5e5;
|
||
width: 100%;
|
||
height: 1px;
|
||
`,_=y().button`
|
||
box-sizing: border-box;
|
||
flex: 0 0 30px;
|
||
height: 30px;
|
||
width: 30px;
|
||
background-color: ${e=>e.iconBackground};
|
||
border-radius: 5px;
|
||
cursor: pointer;
|
||
outline: none;
|
||
border: 1px solid ${e=>e.iconBorder};
|
||
margin-left: 3px;
|
||
|
||
&:focus {
|
||
box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8);
|
||
}
|
||
`;_.props={iconBackground:h().string,iconBorder:h().string},_.defaultProps={iconBackground:v.colors.$color_button,iconBorder:v.colors.$color_button_border};const A=y().div`
|
||
flex: auto;
|
||
`,S=(0,g.makeOutboundLink)(y().a`
|
||
text-overflow: ellipsis;
|
||
display: -webkit-box;
|
||
-webkit-line-clamp: 2;
|
||
/* -webkit-box-orient: vertical; */
|
||
/* -moz-box-orient: vertical; */
|
||
max-height: 40px;
|
||
margin-bottom: 4px;
|
||
-webkit-box-orient: vertical;
|
||
overflow: hidden;
|
||
padding: 0 0 4px;
|
||
`),B=y().div`
|
||
flex-wrap: wrap;
|
||
display: flex;
|
||
flex-direction: row;
|
||
justify-content: unset;
|
||
margin-top: 4px;
|
||
`,T=y().span`
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
text-align: center;
|
||
padding: 3px 8px;
|
||
font-size: 0.85em;
|
||
background-color: #f3f4f5;
|
||
border-radius: 2px;
|
||
margin-bottom: 4px;
|
||
margin-right: 4px;
|
||
text-transform: lowercase;
|
||
`,R=({badges:e})=>(0,t.createElement)(B,null,e.map(((e,n)=>(0,t.createElement)(T,{key:n},e))));R.propTypes={badges:h().array.isRequired};const P=({value:e,url:n,isActive:o,labels:r})=>{const s=(0,u.__)("Copy link","wordpress-seo-premium"),a=(0,u.sprintf)(/* translators: Hidden accessibility text; %s expands to the link value */ /* translators: Hidden accessibility text; %s expands to the link value */
|
||
(0,u.__)("Copy link to suggested article: %s","wordpress-seo-premium"),e),i=(0,c.useCallback)((e=>{e.nativeEvent.target.setAttribute("aria-label",a),e.nativeEvent.target.setAttribute("data-label",s)}),[a,s]);let l="copy",d=v.colors.$color_black,p=v.colors.$color_button,g="#979797";return o&&(l="check",d=v.colors.$color_alert_success_text,p=v.colors.$color_alert_success_background,g=v.colors.$color_alert_success_background),(0,t.createElement)("div",null,(0,t.createElement)(E,null),(0,t.createElement)(k,{className:"yoast-link-suggestion__wrapper"},(0,t.createElement)(A,{className:"yoast-link-suggestion__container"},(0,t.createElement)(S,{href:n},e),(0,t.createElement)(R,{badges:r})),(0,t.createElement)(_,{type:"button",className:"yoast-link-suggestion__copy yoast-tooltip yoast-tooltip-alt yoast-tooltip-s",onBlur:i,"data-clipboard-text":n,"aria-label":a,"data-label":s,iconBackground:p,iconBorder:g},(0,t.createElement)(x,{icon:l,color:d}),(0,t.createElement)(w.ScreenReaderText,null,s))))};P.propTypes={value:h().string.isRequired,url:h().string.isRequired,isActive:h().bool,labels:h().array.isRequired},P.defaultProps={isActive:!1};const C=P,L=y().div`
|
||
display: table-cell;
|
||
`;let M;const $=e=>{const t=(0,u.__)("Copied!","wordpress-seo-premium");e.trigger.focus(),e.trigger.setAttribute("aria-label",t),e.trigger.setAttribute("data-label",t),(0,d.speak)(t,"assertive")},N=e=>{const t=(0,u.__)("Not supported!","wordpress-seo-premium");e.trigger.el.setAttribute("aria-label",t),e.trigger.setAttribute("data-label",t),(0,d.speak)(t,"assertive")},O=({suggestions:e,maxSuggestions:n,customMessages:o,location:r})=>{const s=function(e){const n=(0,g.makeOutboundLink)(),o=(0,p.addQueryArgs)(wpseoAdminL10n["shortlinks.site_structure_metabox"],{context:e});return(0,m.A)({
|
||
// Translators: Text between {{a}} and {{/a}} will be a link to an article about site structure.
|
||
mixedString:(0,u.__)("{{a}}Read our guide on internal linking for SEO{{/a}} to learn more.","wordpress-seo-premium"),components:{a:(0,t.createElement)(n,{href:o})}})}(r);return 0===e.length?(0,t.createElement)("div",null,(0,t.createElement)("p",null,""===o.lengthMessage?(0,u.__)("We could not find any relevant articles on your website that you could link to from your post.","wordpress-seo-premium"):o.lengthMessage),(0,t.createElement)("p",null,o.metaMessage),(0,t.createElement)("p",null,s)):(e.length>n&&(e.length=n),(0,t.createElement)(L,null,(0,t.createElement)("p",null,(0,u.__)("To improve your site structure, consider linking to other relevant posts or pages on your website.","wordpress-seo-premium")," ",s),(0,t.createElement)("p",null,o.metaMessage),e.map(((e,n)=>(0,t.createElement)(C,{key:n,...e})))))};O.propTypes={suggestions:h().array.isRequired,maxSuggestions:h().number,customMessages:h().object,location:h().string},O.defaultProps={maxSuggestions:10,customMessages:{lengthMessage:"",metaMessage:""},location:""};const I=()=>{window.open("admin.php?page=wpseo_tools&start-indexation=true","yoastSeoAnalyzeProminentWords")},j=()=>{
|
||
/* translators: 1: link to yoast.com post about internal linking suggestion. 2: is anchor closing.
|
||
3: button to the recalculation option. 4: closing button */
|
||
let e=(0,u.__)("We need to optimize your site’s SEO data so we can offer you the best %1$slinking suggestions%2$s.\n\n%3$sStart SEO Data optimization%4$s","wordpress-seo-premium");return e=e.replace("%1$s","{{a}}"),e=e.replace("%2$s","{{/a}}"),e=e.replace("%3$s","{{startAnalysis}}"),e=e.replace("%4$s","{{/startAnalysis}}"),e=e.replace("\n\n","{{br /}}{{br /}}"),e=(0,m.A)({mixedString:e,components:{a:(0,t.createElement)("a",{href:wpseoAdminL10n["shortlinks.notification_internal_link"],target:"_blank"}),startAnalysis:(0,t.createElement)("button",{type:"button",className:"button",onClick:I}),br:(0,t.createElement)("br",null)}}),(0,t.createElement)("div",{className:"notice notice-warning notice-alt wpseo-notice-breakout-inside yoast-links-suggestions-notice"},(0,t.createElement)("p",null,e))},H=e=>{if((0,c.useEffect)((()=>(e.suggester.subscribe(),()=>{e.suggester.unsubscribe()})),[]),e.isLoading)return(0,t.createElement)("div",{className:"yoast-link-suggestions"},(0,t.createElement)("p",null,(0,u.__)("It takes a few seconds to show you a list of related content to which you could link. The suggestions will be shown here as soon as we have them.","wordpress-seo-premium")));M||(M=new ClipboardJS(".yoast-link-suggestion__copy"),M.on("success",$),M.on("error",N));let n=null;e.showUnindexedWarning&&(n=j());const o=(e=>{let t="";e.hasWordsForLinking||(t=(0,u.__)("Once you add a bit more copy, we'll give you a list of related content here to which you could link in your post.","wordpress-seo-premium"));const n=((e,t,n)=>{switch(!0){case n&&!t&&""===e:return(0,u.__)("Add a title to your post for the best internal linking suggestions.","wordpress-seo-premium");case!n&&t&&""===e:return(0,u.__)("Add a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium");case!n&&!t&&""===e:return(0,u.__)("Add a title and a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium");case n&&!t&&""!==e:return(0,u.__)("Also, add a title to your post for the best internal linking suggestions.","wordpress-seo-premium");case!n&&t&&""!==e:return(0,u.__)("Also, add a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium");case!n&&!t&&""!==e:return(0,u.__)("Also, add a title and a metadescription to your post for the best internal linking suggestions.","wordpress-seo-premium")}})(t,e.hasTitle,e.hasMetaDescription);return{lengthMessage:t,metaMessage:n}})({...e.messageData,hasWordsForLinking:Array.isArray(e.wordsForLinking)&&e.wordsForLinking.length>0});return(0,t.createElement)("div",{className:"yoast-link-suggestions"},n,(0,t.createElement)(O,{suggestions:e.suggestions,customMessages:o,location:e.location}))};function F(e,t){for(const n of e)t(n),n.innerBlocks&&F(n.innerBlocks,t)}H.propTypes={suggester:h().object,suggestions:h().array.isRequired,wordsForLinking:h().array,messageData:h().object,isLoading:h().bool.isRequired,showUnindexedWarning:h().bool,location:h().string},H.defaultProps={suggester:null,showUnindexedWarning:!1,messageData:{hasMetaDescription:!1,hasTitle:!1},wordsForLinking:[],location:""};const D=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"version":"23.0","name":"yoast-seo/related-links","title":"Yoast Related Links","description":"Adds a list of links related to this page.","category":"yoast-internal-linking-blocks","icon":"editor-ul","keywords":["SEO","internal linking","site structure","related posts","related pages"],"textdomain":"wordpress-seo-premium","attributes":{"status":{"type":"string","default":"loading"},"values":{"type":"string","source":"html","selector":"ul","multiline":"li","default":""}},"example":{"attributes":{"status":"loaded","values":"<li><a href=\'https://example.org\'>Related link 1</a></li> <li><a href=\'https://example.org\'>Related link 2</a></li> <li><a href=\'https://example.org\'>Related link 3</a></li>"}}}');const W=window.yoast.editorModules.helpers.createInterpolateElement;function q(e,t,n,o){t!==n&&o(e,{status:t})}function z(t){if(!(0,a.select)("yoast-seo-premium/editor"))return void setTimeout(z.bind(null,t),500);(0,e.get)(YoastSEO,"analysis.linkSuggester")&&YoastSEO.analysis.linkSuggester.update();const{linkSuggestionsAreLoading:n}=(0,a.select)("yoast-seo-premium/editor"),{getBlockAttributes:o}=(0,a.select)("core/block-editor"),r=o(t);"loaded"!==r.status&&(n()?setTimeout(z.bind(null,t),500):function(e,t){const{linkSuggestionsAreUnindexed:n,getLinkSuggestions:o,getWordsForLinking:r}=(0,a.select)("yoast-seo-premium/editor"),{updateBlockAttributes:s}=(0,a.dispatch)("core/block-editor");if(n())return void q(e,"unindexed",t.status,s);const i=r();if(!Array.isArray(i)||0===i.length)return void q(e,"no-content",t.status,s);const l=o();0!==l.length?"loading"===t.status?s(e,{values:l.map((e=>`<li><a href="${e.url}">${e.value}</a></li>`)).join(""),status:"loaded"}):q(e,"has-suggestions",t.status,s):q(e,"no-suggestions",t.status,s)}(t,r))}function V(e,n="warning",o){const r=`notice notice-${n} notice-alt wpseo-notice-breakout-inside yoast-links-suggestions-notice`;return(0,t.createElement)("div",{...o,className:r},(0,t.createElement)("p",null,e))}function U(){return(0,a.select)("yoast-seo-premium/editor")?(0,a.select)("yoast-seo-premium/editor").getLinkSuggestions():null}function Y(){return(0,a.select)("yoast-seo-premium/editor")?(0,a.select)("yoast-seo-premium/editor").getWordsForLinking():null}const G=window.wp.hooks,J=window.yoast.analysis,Q=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"version":"23.1","name":"yoast-seo/table-of-contents","title":"Yoast Table of Contents","description":"Adds a table of contents to this page.","category":"yoast-internal-linking-blocks","icon":"editor-ul","keywords":["SEO","links","toc","site structure"],"textdomain":"wordpress-seo-premium","attributes":{"title":{"type":"string","source":"html","selector":"h1,h2,h3,h4,h5,h6","default":"Table of contents"},"level":{"type":"number","default":2},"maxHeadingLevel":{"type":"number","default":3},"headings":{"type":"array","source":"query","selector":"a","query":{"content":{"type":"string","source":"html"},"href":{"type":"string","source":"attribute","attribute":"href"},"level":{"type":"string","source":"attribute","attribute":"data-level"}}}},"example":{"attributes":{"headings":[{"content":"Heading 1","href":"#heading-1","level":"2"},{"content":"Subheading 1","href":"#subheading-1","level":"3"},{"content":"Subheading 2","href":"#subheading-2","level":"3"},{"content":"Heading 2","href":"#heading-2","level":"2"}]}}}'),{stripHTMLTags:K}=J.languageProcessing,X=(t,n)=>{const r=`h-${function(t){const n=new RegExp("[^\\p{L}\\p{N}]+","gu");return(0,e.trim)((0,e.deburr)(K(t)).replace(n,"-").toLowerCase(),"-")}((0,o.getBlockContent)(t))}`;let s=r,a=0;for(;n.includes(s);)s=`${r}-${a}`,a++;return s};const Z=e=>{const t=[];return F(e,(e=>{"core/heading"===e.name&&t.push(e.attributes.anchor)})),t};function ee(e,t){let n=e;for(;n&&n.level>=t;)n=n.parent;return n}function te(e){const n=e.map((e=>{let n=null;return e.children&&e.children.length>0&&(n=te(e.children)),(0,t.createElement)("li",{key:e.href},(0,t.createElement)("a",{href:e.href,"data-level":e.level},e.content),n)}));return(0,t.createElement)("ul",null,n)}function ne(e,t=99){return e&&0!==e.length?te(e=function(e){const t=[];let n;for(const o of e){const e=parseInt(o.level,10),r={children:[],parent:null,...o,level:e},s=ee(n,e);s?(r.parent=s,s.children.push(r)):t.push(r),n=r}return t}(e=e.filter((e=>e.level<=t)))):null}(0,G.addFilter)("blocks.switchToBlockType.transformedBlock","yoast-seo-table-of-contents/transformed-block",(t=>{if((0,e.isNil)(t.attributes.anchor)&&"core/heading"===t.name){const e=(0,a.select)("core/block-editor").getBlocks(),n=Z(e);t.attributes.anchor=X(t,n)}return t})),l()((()=>{window.wpseoPremiumMetaboxData?function(){let t=(0,a.select)("core/block-editor").getBlocks(),n=Y(),o=U();(0,a.subscribe)((()=>{const r=(0,a.select)("core/block-editor").getBlocks(),s=Y(),i=U(),l=!(0,e.isEqual)(t,r),c=!(0,e.isEqual)(n,s),u=!(0,e.isEqual)(o,i);(l||c||u)&&F(r,(e=>{"yoast-seo/related-links"===e.name&&(l&&"loading"===e.attributes.status?z(e.clientId):(c&&"no-content"===e.attributes.status&&z(e.clientId),u&&"loaded"!==e.attributes.status&&z(e.clientId)))})),t=r,n=s,o=i}))}():(0,o.unregisterBlockType)("yoast-seo/related-links")})),(0,o.registerBlockType)(D,{edit:function({clientId:e,attributes:n,setAttributes:i}){const{status:l}=n,d=()=>{i({status:"loading"}),z(e)};(0,c.useEffect)((()=>{"loaded"!==l&&d()}),[]),function(e,t){const n=(0,a.useRegistry)(),{updateBlockAttributes:r,replaceInnerBlocks:s}=(0,a.dispatch)("core/block-editor");(0,c.useEffect)((()=>{if(!e.values)return;const[a,i]=function(e){const{values:t,...n}=e,r=document.createElement("ul");r.innerHTML=t;const[s]=(0,o.rawHandler)({HTML:r.outerHTML});return[{...n,...s.attributes},s.innerBlocks]}(e);n.batch((()=>{r(t,a),s(t,i)}))}),[e.values])}(n,e);const p=(0,r.useBlockProps)(),g=(0,r.useInnerBlocksProps)(p,{allowedBlocks:["core/list-item"],templateLock:!1,templateInsertUpdatesSelection:!0});if(!(window.wpseoPremiumMetaboxData.data.restApi.available&&window.wpseoPremiumMetaboxData.data.restApi.contentEndpointsAvailable&&"enabled"===window.wpseoPremiumMetaboxData.data.linkSuggestionsEnabled&&window.wpseoPremiumMetaboxData.data.linkSuggestionsAvailable)&&"loaded"!==l)return V(W((0,u.__)("You have disabled Link suggestions, which is needed for Related links to work. If you want to add Related links, please go to <a>Site features</a> and enable Link suggestions.","wordpress-seo-premium"),{a:(0,t.createElement)("a",{href:wpseoPremiumMetaboxData.data.settingsPageUrl,target:"_blank"},"#21441-gutenberg")}),"error",p);if("loaded"!==l)return function(e,n,o){if("unindexed"===e)return j();let r=(0,u.__)("We could not find any relevant articles on your website that you could link to from your post.","wordpress-seo-premium");return"no-content"===e&&(r=(0,u.__)("Once you add a bit more copy, we'll give you a list of related content here to which you could link in your post.","wordpress-seo-premium")),"loading"===e&&(r=(0,u.__)("It takes a few seconds to show you a list of related content to which you could link. The suggestions will be shown here as soon as we have them.","wordpress-seo-premium")),"has-suggestions"===e&&(r=(0,t.createElement)(c.Fragment,null,r,(0,t.createElement)("br",null),(0,t.createElement)("br",null),(0,t.createElement)("button",{type:"button",className:"button",onClick:n},(0,u.__)("Load suggestions","wordpress-seo-premium")))),V(r,"warning",o)}(l,d,p);const m=(0,t.createElement)(r.BlockControls,null,(0,t.createElement)(s.ToolbarGroup,{controls:[{icon:"image-rotate",title:(0,u.__)("Refresh suggestions","wordpress-seo-premium"),isActive:!1,onClick:d}]}));return(0,t.createElement)(c.Fragment,null,(0,t.createElement)("ul",{...g}),m)},save:function({attributes:e}){if("loaded"!==e.status)return null;const n=r.useBlockProps.save({className:"yoast-seo-related-links"}),o=r.useInnerBlocksProps.save(n);return(0,t.createElement)("ul",{...o})},deprecated:[{attributes:{status:{type:"string",default:"loading"},values:{type:"string",source:"html",selector:"ul",multiline:"li",default:""}},save:({attributes:e})=>"loaded"!==e.status?null:(0,t.createElement)(r.RichText.Content,{tagName:"ul",multiline:"li",value:e.values})}]}),(0,e.get)(window,"wpseoTOCData.data.disableTableOfContents",!1)||(l()((()=>{!function(){let t=null,n="",r=!1,s=[];const i={};(0,a.subscribe)((()=>{if(r)return;const l=(0,a.select)("core/block-editor").getBlocks(),c=[];if(t!==l){const t=[],u=[];let d="";r=!0;const p=Z(l).every((t=>(0,e.isUndefined)(t)));F(l,(n=>{if("core/heading"===n.name){const l=K((0,o.getBlockContent)(n)),u=n.attributes.level,g=function(t,n,r,s,i){let l=t.attributes.anchor;const c=n[t.clientId],u=K((0,o.getBlockContent)(t));return c&&c===u||l&&!l.startsWith("h-")||(l=function(t,n,r,s){return!(0,e.isNil)(t.attributes.anchor)||s||(0,e.isEmpty)((0,o.getBlockContent)(t))||r.includes(t.clientId)?X(t,n):""}(t,r,s,i),l!==t.attributes.anchor&&(0,a.dispatch)("core/block-editor").updateBlockAttributes(t.clientId,{anchor:l})),l}(n,i,c,s,p);if(i[n.clientId]=l,""===g||(0,e.isEmpty)(l))return;c.push(g),t.push({content:(r=l,(new DOMParser).parseFromString(r,"text/html").documentElement.textContent),href:"#"+g,level:u}),d+="$"+u+":"+g+":"+l}else u.push(n.clientId);var r})),F(l,(e=>{if("yoast-seo/table-of-contents"===e.name){const o=e.attributes.headings&&e.attributes.headings.length>0;(n!==d||t.length>0&&!o)&&(0,a.dispatch)("core/block-editor").updateBlockAttributes(e.clientId,{headings:t})}})),r=!1,n=d,s=u}t=l}))}()})),Q.attributes&&Q.attributes.title&&Q.attributes.title.default&&(Q.attributes.title.default=(0,u.__)("Table of contents","wordpress-seo-premium")),(0,o.registerBlockType)(Q,{edit:function({attributes:e,setAttributes:n}){const o=(0,c.useCallback)((e=>n({title:e})),[n]),a=(0,c.useCallback)((e=>n({level:e})),[n]),i=(0,c.useCallback)((e=>n({maxHeadingLevel:Number(e)})),[n]),l=(0,r.useBlockProps)({className:"yoast-table-of-contents"});return(0,t.createElement)(c.Fragment,null,(0,t.createElement)(r.BlockControls,null,(0,t.createElement)(s.ToolbarGroup,null,(0,t.createElement)(r.HeadingLevelDropdown,{value:e.level,options:[1,2,3,4,5,6],onChange:a}))),(0,t.createElement)(r.InspectorControls,null,(0,t.createElement)(s.PanelBody,{title:(0,u.__)("Settings","wordpress-seo-premium"),className:"yoast-table-of-contents-controls"},(0,t.createElement)(s.SelectControl,{label:(0,u.__)("Maximum heading level","wordpress-seo-premium"),value:e.maxHeadingLevel,options:[1,2,3,4,5,6].map((e=>({label:(0,u.sprintf)((0,u.__)("Heading %d"),e),value:e}))),onChange:i}))),(0,t.createElement)("div",{...l},(0,t.createElement)(r.RichText,{tagName:"h"+e.level,value:e.title,onChange:o}),ne(e.headings,e.maxHeadingLevel)))},save:function({attributes:e}){let n=null;e.title&&(n=(0,t.createElement)(r.RichText.Content,{tagName:"h"+e.level,value:e.title}));const o=r.useBlockProps.save({className:"yoast-table-of-contents"});return(0,t.createElement)("div",{...o},n,ne(e.headings,e.maxHeadingLevel))},deprecated:[{attributes:{title:{type:"string",source:"html",selector:"h2",default:(0,u.__)("Table of contents","wordpress-seo-premium")},level:{type:"number",default:2},headings:{type:"array",source:"query",selector:"a",query:{content:{type:"string",source:"html"},href:{type:"string",source:"attribute",attribute:"href"},level:{type:"string",source:"attribute",attribute:"data-level"}}}},migrate:e=>({maxHeadingLevel:6,...e}),save:({attributes:e})=>{let n=null;return e.title&&(n=(0,t.createElement)(r.RichText.Content,{tagName:"h"+e.level,value:e.title})),(0,t.createElement)("div",{className:"yoast-table-of-contents"},n,ne(e.headings))}}]}))})()})(); |