OwlCyberSecurity - MANAGER
Edit File: amp-block-validation.js
(()=>{var e={349:(e,t,r)=>{var i={"./amp-block-validation.js":173,"./amp-document-setting-panel.js":133,"./amp-pre-publish-panel.js":208};function s(e){var t=n(e);return r(t)}function n(e){if(!r.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}s.keys=function(){return Object.keys(i)},s.resolve=n,e.exports=s,s.id=349},587:(e,t,r)=>{"use strict";r.d(t,{A:()=>g});var i=r(723),s=r(427),n=r(143),o=r(371),a=r(866),l=r(563),c=r(268),d=r(182),u=r(336),p=r(173),h=r(468),_=r(790);function m(){const{isAMPEnabled:e,toggleAMP:t}=(0,d.n)(),r=(0,h.useRef)(`amp-toggle-${Math.random().toString(32).substr(-4)}`);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("label",{htmlFor:r.current,children:(0,i.__)("Enable AMP","amp")}),(0,_.jsx)(s.FormToggle,{checked:e,onChange:t,id:r.current})]})}function g(){const{isAMPEnabled:e}=(0,d.n)(),{isFetchingErrors:t,fetchingErrorsMessage:r}=(0,u.H)(),{openGeneralSidebar:h,closePublishSidebar:g}=(0,n.useDispatch)("core/edit-post"),{isPostDirty:E,maybeIsPostDirty:v,keptMarkupValidationErrorCount:x,reviewedValidationErrorCount:w,unreviewedValidationErrorCount:f}=(0,n.useSelect)((e=>({isPostDirty:e(a.M_).getIsPostDirty(),maybeIsPostDirty:e(a.M_).getMaybeIsPostDirty(),keptMarkupValidationErrorCount:e(a.M_).getKeptMarkupValidationErrors().length,reviewedValidationErrorCount:e(a.M_).getReviewedValidationErrors().length,unreviewedValidationErrorCount:e(a.M_).getUnreviewedValidationErrors().length})),[]);if(!e)return(0,_.jsx)(s.PanelRow,{children:(0,_.jsx)(m,{})});if(t)return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s.PanelRow,{children:(0,_.jsx)(m,{})}),(0,_.jsx)(c._,{message:r,isLoading:!0,isSmall:!0})]});const j=()=>{g(),h(`${p.PLUGIN_NAME}/${p.SIDEBAR_NAME}`)};return E||v?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s.PanelRow,{children:(0,_.jsx)(m,{})}),(0,_.jsx)(c._,{icon:(0,_.jsx)(o.XF,{}),message:v?(0,i.__)("Content may have changed. Trigger validation in the AMP Validation sidebar.","amp"):(0,i.__)("Content has changed. Trigger validation in the AMP Validation sidebar.","amp"),isSmall:!0}),(0,_.jsx)(s.PanelRow,{children:(0,_.jsx)(s.Button,{onClick:j,isSecondary:!0,isSmall:!0,children:(0,i.__)("Open AMP Validation","amp")})})]}):x>0?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s.PanelRow,{children:(0,_.jsx)(m,{})}),(0,_.jsx)(c._,{icon:(0,_.jsx)(o.Qj,{}),message:(0,i.sprintf)(/* translators: %d is count of validation errors whose invalid markup is kept */ /* translators: %d is count of validation errors whose invalid markup is kept */ (0,i._n)("AMP is blocked due to %d validation issue marked as kept.","AMP is blocked due to %d validation issues marked as kept.",x,"amp"),x),isSmall:!0}),(0,_.jsx)(s.PanelRow,{children:(0,_.jsx)(s.Button,{onClick:j,isSecondary:!0,isSmall:!0,children:(0,i._n)("Review issue","Review issues",x,"amp")})})]}):f>0?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s.PanelRow,{children:(0,_.jsx)(m,{})}),(0,_.jsx)(c._,{icon:(0,_.jsx)(l.kW,{broken:!0}),message:(0,i.sprintf)(/* translators: %d is count of unreviewed validation error */ /* translators: %d is count of unreviewed validation error */ (0,i._n)("AMP is valid, but %d issue needs review.","AMP is valid, but %d issues need review.",f,"amp"),f),isSmall:!0}),(0,_.jsx)(s.PanelRow,{children:(0,_.jsx)(s.Button,{onClick:j,isSecondary:!0,isSmall:!0,children:(0,i._n)("Review issue","Review issues",f,"amp")})})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s.PanelRow,{children:(0,_.jsx)(m,{})}),(0,_.jsx)(c._,{icon:(0,_.jsx)(l.kW,{}),message:w>0?(0,i.sprintf)(/* translators: %d is count of unreviewed validation error */ /* translators: %d is count of unreviewed validation error */ (0,i._n)("AMP is valid. %d issue was reviewed.","AMP is valid. %d issues were reviewed.",w,"amp"),w):(0,i.__)("No AMP validation issues detected.","amp"),isSmall:!0}),w>0&&(0,_.jsx)(s.PanelRow,{children:(0,_.jsx)(s.Button,{onClick:j,isSecondary:!0,isSmall:!0,children:(0,i.__)("Open AMP Validation","amp")})})]})}},563:(e,t,r)=>{"use strict";r.d(t,{bx:()=>a,kW:()=>c,wc:()=>l});var i=r(371),s=r(790);function n({hasBadge:e}){return(0,s.jsx)("span",{className:"amp-toolbar-icon components-menu-items__item-icon"+(e?" amp-toolbar-icon--has-badge":""),children:(0,s.jsx)(i.LF,{})})}function o({hasBadge:e}){return(0,s.jsx)("span",{className:"amp-toolbar-broken-icon"+(e?" amp-toolbar-broken-icon--has-badge":""),children:(0,s.jsx)(i.wN,{})})}function a({broken:e=!1,count:t}){return(0,s.jsxs)("div",{className:"amp-plugin-icon "+(e?"amp-plugin-icon--broken":""),children:[e?(0,s.jsx)(o,{hasBadge:Boolean(t)}):(0,s.jsx)(n,{hasBadge:Boolean(t)}),0<t&&(0,s.jsx)("div",{className:"amp-error-count-badge",children:t})]})}function l(){return(0,s.jsx)(n,{hasBadge:!1})}function c({broken:e=!1}){return(0,s.jsx)("div",{className:"amp-status-icon "+(e?"amp-status-icon--broken":""),children:(0,s.jsx)(i.ZD,{})})}},268:(e,t,r)=>{"use strict";r.d(t,{_:()=>l,S:()=>c});var i=r(942),s=r.n(i),n=r(427),o=r(790);function a({inline:e=!1}){const t=e?"span":"div";return(0,o.jsx)(t,{className:s()("amp-spinner-container",{"amp-spinner-container--inline":e}),children:(0,o.jsx)(n.Spinner,{})})}function l({action:e,icon:t,isLoading:r=!1,isSmall:i=!1,message:n}){const l=r?(0,o.jsx)(a,{}):t;return(0,o.jsxs)("div",{className:s()("sidebar-notification",{"is-loading":r,"is-small":i}),children:[l&&(0,o.jsx)("div",{className:"sidebar-notification__icon",children:l}),(0,o.jsxs)("div",{className:"sidebar-notification__content",children:[(0,o.jsx)("p",{children:n}),e&&(0,o.jsx)("div",{className:"sidebar-notification__action",children:e})]})]})}function c({children:e,isShady:t}){return(0,o.jsx)("div",{className:s()("sidebar-notifications-container",{"is-shady":t}),children:e})}},182:(e,t,r)=>{"use strict";r.d(t,{n:()=>s});var i=r(143);function s(){const e=(0,i.useSelect)((e=>e("core/editor").getEditedPostAttribute("amp_enabled")||!1),[]),{editPost:t}=(0,i.useDispatch)("core/editor");return{isAMPEnabled:e,toggleAMP:()=>t({amp_enabled:!e})}}},336:(e,t,r)=>{"use strict";r.d(t,{H:()=>l});var i=r(468),s=r(143),n=r(491),o=r(723),a=r(866);function l(){const[e,t]=(0,i.useState)(!1),[r,l]=(0,i.useState)(""),{isEditedPostNew:c,isFetchingErrors:d}=(0,s.useSelect)((e=>({isEditedPostNew:e("core/editor").isEditedPostNew(),isFetchingErrors:e(a.M_).getIsFetchingErrors()})),[]),u=(0,n.usePrevious)(c),p=(0,n.usePrevious)(d);return(0,i.useEffect)((()=>{e||!d&&p&&t(!0)}),[e,d,p]),(0,i.useEffect)((()=>{l(e?(0,o.__)("Re-validating content.","amp"):c||u?(0,o.__)("Validating content.","amp"):d?(0,o.__)("Loading…","amp"):"")}),[e,c,d,u]),{isFetchingErrors:d,fetchingErrorsMessage:r}}},173:(e,t,r)=>{"use strict";r.r(t),r.d(t,{PLUGIN_ICON:()=>F,PLUGIN_NAME:()=>B,PLUGIN_TITLE:()=>H,SIDEBAR_NAME:()=>O,default:()=>U});var i=r(723),s=r(309),n=r(143),o=r(866),a=r(563),l=r(427),c=r(468),d=r(268),u=r(371),p=r(336),h=r(790);function _(){const{autosave:e,savePost:t}=(0,n.useDispatch)("core/editor"),{isFetchingErrors:r,fetchingErrorsMessage:s}=(0,p.H)(),{isDraft:a,isPostDirty:c,maybeIsPostDirty:_}=(0,n.useSelect)((e=>({isDraft:-1!==["draft","auto-draft"].indexOf(e("core/editor").getEditedPostAttribute("status")),isPostDirty:e(o.M_).getIsPostDirty(),maybeIsPostDirty:e(o.M_).getMaybeIsPostDirty()})),[]);return r?(0,h.jsx)(d._,{message:s,isLoading:!0}):c||_?(0,h.jsx)(d._,{icon:(0,h.jsx)(u.XF,{}),message:_?(0,i.__)("Content may have changed.","amp"):(0,i.__)("Content has changed.","amp"),action:a?(0,h.jsx)(l.Button,{isLink:!0,onClick:()=>t({isPreview:!0}),children:(0,i.__)("Save draft and validate","amp")}):(0,h.jsx)(l.Button,{isLink:!0,onClick:()=>e({isPreview:!0}),children:(0,i.__)("Re-validate","amp")})}):null}function m(){const{autosave:e,savePost:t}=(0,n.useDispatch)("core/editor"),{isFetchingErrors:r}=(0,p.H)(),{fetchingErrorsRequestErrorMessage:s,isDraft:c,isEditedPostNew:_,keptMarkupValidationErrorCount:m,reviewLink:g,supportLink:E,unreviewedValidationErrorCount:v,validationErrorCount:x}=(0,n.useSelect)((e=>({fetchingErrorsRequestErrorMessage:e(o.M_).getFetchingErrorsRequestErrorMessage(),isDraft:-1!==["draft","auto-draft"].indexOf(e("core/editor").getEditedPostAttribute("status")),isEditedPostNew:e("core/editor").isEditedPostNew(),keptMarkupValidationErrorCount:e(o.M_).getKeptMarkupValidationErrors().length,reviewLink:e(o.M_).getReviewLink(),supportLink:e(o.M_).getSupportLink(),unreviewedValidationErrorCount:e(o.M_).getUnreviewedValidationErrors().length,validationErrorCount:e(o.M_).getValidationErrors().length})),[]);if(r)return null;if(_)return(0,h.jsx)(d._,{icon:(0,h.jsx)(a.kW,{}),message:(0,i.__)("Validation will be checked upon saving.","amp")});const w=g&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.ExternalLink,{href:g,children:(0,i.__)("View technical details","amp")}),(0,h.jsx)("br",{}),E&&(0,h.jsx)(l.ExternalLink,{href:E,children:(0,i.__)("Get Support","amp")})]});return s?(0,h.jsx)(d._,{icon:(0,h.jsx)(u.Qj,{}),message:s,action:(0,h.jsx)(l.Button,{isLink:!0,onClick:c?()=>t({isPreview:!0}):()=>e({isPreview:!0}),children:(0,i.__)("Try again","amp")})}):m>0?(0,h.jsx)(d._,{icon:(0,h.jsx)(u.Qj,{}),message:(0,i.sprintf)(/* translators: %d is count of validation errors whose invalid markup is kept */ /* translators: %d is count of validation errors whose invalid markup is kept */ (0,i._n)("AMP is disabled due to invalid markup being kept for %d issue.","AMP is disabled due to invalid markup being kept for %d issues.",m,"amp"),m),action:w}):v>0?(0,h.jsx)(d._,{icon:(0,h.jsx)(a.kW,{broken:!0}),message:(0,i.sprintf)(/* translators: %d is count of unreviewed validation error */ /* translators: %d is count of unreviewed validation error */ (0,i._n)("AMP is valid, but %d issue needs review.","AMP is valid, but %d issues need review.",v,"amp"),v),action:w}):x>0?(0,h.jsx)(d._,{icon:(0,h.jsx)(a.kW,{}),message:(0,i.sprintf)(/* translators: %d is count of unreviewed validation error */ /* translators: %d is count of unreviewed validation error */ (0,i._n)("AMP is valid. %d issue was reviewed.","AMP is valid. %d issues were reviewed.",x,"amp"),x),action:w}):(0,h.jsx)(d._,{icon:(0,h.jsx)(a.kW,{}),message:(0,i.__)("No AMP validation issues detected.","amp")})}function g(){return(0,h.jsxs)(d.S,{isShady:!0,children:[(0,h.jsx)(_,{}),(0,h.jsx)(m,{})]})}var E=r(942),v=r.n(E),x=r(955);function w({type:e}){switch(e){case x.HTML_ATTRIBUTE_ERROR_TYPE:case x.HTML_ELEMENT_ERROR_TYPE:return(0,h.jsx)(u.JP,{});case x.JS_ERROR_TYPE:return(0,h.jsx)(u.RY,{});case x.CSS_ERROR_TYPE:return(0,h.jsx)(u.Bn,{});default:return null}}function f({kept:e,title:t,error:{type:r}}){return(0,h.jsxs)("div",{className:"amp-error__panel-title",title:e?(0,i.__)("This error has been kept, making this URL not AMP-compatible.","amp"):"",children:[(0,h.jsx)("div",{className:"amp-error__icons",children:r&&(0,h.jsx)("div",{className:`amp-error__error-type-icon amp-error__error-type-icon--${r?.replace(/_/g,"-")}`,children:(0,h.jsx)(w,{type:r})})}),(0,h.jsx)("div",{className:"amp-error__title",dangerouslySetInnerHTML:{__html:t}})]})}var j=r(715);function k({clientId:e,blockTypeName:t,sources:r}){let s;const n=x.blockSources?.[t];if(e&&"core/shortcode"!==t)switch(n?.type){case"plugin":s=(0,i.sprintf)(/* translators: %s: plugin name. */ /* translators: %s: plugin name. */ (0,i.__)("%s (plugin)","amp"),n.title);break;case"mu-plugin":s=(0,i.sprintf)(/* translators: %s: plugin name. */ /* translators: %s: plugin name. */ (0,i.__)("%s (must-use plugin)","amp"),n.title);break;case"theme":s=(0,i.sprintf)(/* translators: %s: theme name. */ /* translators: %s: theme name. */ (0,i.__)("%s (theme)","amp"),n.title);break;default:s=n?.title}return s||(s=function(e=[]){const t=function(e){const t={theme:[],plugin:[],"mu-plugin":[],embed:[],core:[],blocks:[]};if(!e?.length)return t;for(const r of e)r.type&&r.type in t?t[r.type].push(r):"block_name"in r&&t.blocks.push(r);return t}(e),r=[],s=new Set(t.plugin.map((({name:e})=>e))),n=new Set(t["mu-plugin"].map((({name:e})=>e)));let o=[...s,...n];if(o.length>1&&(o=o.filter((e=>"gutenberg"!==e))),1===o.length)r.push(x.pluginNames[o[0]]||o[0]);else{const e=s.size,t=n.size;0<e&&r.push((0,i.sprintf)("%1$s (%2$d)",(0,i.__)("Plugins","amp"),e)),0<t&&r.push((0,i.sprintf)("%1$s (%2$d)",(0,i.__)("Must-use plugins","amp"),t))}if(0===t.embed.length){const e=t.theme.filter((({name:e})=>x.themeSlug===e)),s=t.theme.filter((({name:e})=>x.themeSlug!==e));0<e.length&&r.push(x.themeName),0<s.length&& /* translators: placeholder is the slug of an inactive WordPress theme. */ r.push((0,i.__)("Inactive theme(s)","amp"))}return 0===r.length&&0<t.blocks.length&&r.push(t.blocks[0].block_name),0===r.length&&0<t.embed.length&&r.push((0,i.__)("Embed","amp")),0===r.length&&0<t.core.length&&r.push((0,i.__)("Core","amp")),!r.length&&e?.length&&r.push((0,i.__)("Unknown","amp")),r.join(", ")}(r)),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("dt",{children:(0,i.__)("Source","amp")}),(0,h.jsx)("dd",{children:s})]})}function P({status:e}){let t,r;return t=[x.VALIDATION_ERROR_NEW_ACCEPTED_STATUS,x.VALIDATION_ERROR_ACK_ACCEPTED_STATUS].includes(e)?(0,h.jsxs)("span",{className:"amp-error__kept-removed amp-error__kept-removed--removed",children:[(0,i.__)("Removed","amp"),(0,h.jsx)("span",{children:(0,h.jsx)(u.IS,{})})]}):(0,h.jsxs)("span",{className:"amp-error__kept-removed amp-error__kept-removed--kept",children:[(0,i.__)("Kept","amp"),(0,h.jsx)("span",{children:(0,h.jsx)(u.NO,{})})]}),r=[x.VALIDATION_ERROR_ACK_ACCEPTED_STATUS,x.VALIDATION_ERROR_ACK_REJECTED_STATUS].includes(e)?(0,i.__)("Yes","amp"):(0,i.__)("No","amp"),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("dt",{children:(0,i.__)("Markup status","amp")}),(0,h.jsx)("dd",{children:t}),(0,h.jsx)("dt",{children:(0,i.__)("Reviewed","amp")}),(0,h.jsx)("dd",{children:r})]})}function b({blockTypeIcon:e,blockTypeTitle:t}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("dt",{children:(0,i.__)("Block type","amp")}),(0,h.jsx)("dd",{children:(0,h.jsxs)("span",{className:"amp-error__block-type-description",children:[t||(0,i.__)("unknown","amp"),e&&(0,h.jsx)("span",{className:"amp-error__block-type-icon",children:(0,h.jsx)(j.BlockIcon,{icon:e})})]})})]})}function S({blockType:e,clientId:t,error:{sources:r},isExternal:s,removed:n,status:o}){const a=e?.title,l=e?.name,c=e?.icon;return(0,h.jsxs)(h.Fragment,{children:[n&&(0,h.jsx)("p",{children:(0,i.__)("This error is no longer detected, either because the block was removed or the editor mode was switched.","amp")}),s&&(0,h.jsx)("p",{children:(0,i.__)("This error comes from outside the content (e.g. header or footer).","amp")}),(0,h.jsxs)("dl",{className:"amp-error__details",children:[!(n||s)&&(0,h.jsx)(b,{blockTypeIcon:c,blockTypeTitle:a}),(0,h.jsx)(k,{blockTypeName:l,clientId:t,sources:r}),(0,h.jsx)(P,{status:o})]})]})}function C({clientId:e,error:t,status:r,term_id:s,title:a}){const{selectBlock:c}=(0,n.useDispatch)("core/block-editor"),d=(0,n.useSelect)((e=>e(o.M_).getReviewLink()),[]),u=r===x.VALIDATION_ERROR_ACK_ACCEPTED_STATUS||r===x.VALIDATION_ERROR_ACK_REJECTED_STATUS,p=r===x.VALIDATION_ERROR_ACK_REJECTED_STATUS||r===x.VALIDATION_ERROR_NEW_REJECTED_STATUS,_=!Boolean(e),{blockType:m,removed:g}=(0,n.useSelect)((t=>{const r=t("core/block-editor").getBlockName(e);return{removed:e&&!r,blockType:t("core/blocks").getBlockType(r)}}),[e]);let E=null;d&&(E=new URL(d),E.hash=`#tag-${s}`);const w=v()("amp-error",{"amp-error--reviewed":u,"amp-error--new":!u,"amp-error--removed":g,"amp-error--kept":p,[`error-${e}`]:e});return(0,h.jsxs)(l.PanelBody,{className:w,title:(0,h.jsx)(f,{error:t,kept:p,title:a}),initialOpen:!1,children:[(0,h.jsx)(S,{blockType:m,clientId:e,error:t,isExternal:_,removed:g,status:r}),(0,h.jsxs)("div",{className:"amp-error__actions",children:[!(g||_)&&(0,h.jsx)(l.Button,{className:"amp-error__select-block",isSecondary:!0,onClick:()=>{c(e)},children:(0,i.__)("Select block","amp")}),E&&(0,h.jsx)(l.ExternalLink,{href:E.href,className:"amp-error__details-link",children:(0,i.__)("View details","amp")})]})]})}function R(){const{setIsShowingReviewed:e}=(0,n.useDispatch)(o.M_),{displayedErrors:t,hasReviewedValidationErrors:r,isShowingReviewed:s}=(0,n.useSelect)((e=>{const t=e(o.M_).getIsShowingReviewed();return{displayedErrors:t?e(o.M_).getValidationErrors():e(o.M_).getUnreviewedValidationErrors(),hasReviewedValidationErrors:e(o.M_).getReviewedValidationErrors()?.length>0,isShowingReviewed:t}}),[]);return(0,c.useEffect)((()=>{const e=document.querySelector(".amp-sidebar a, .amp-sidebar button, .amp-sidebar input");e&&e.focus()}),[]),(0,h.jsxs)("div",{className:"amp-sidebar",children:[(0,h.jsx)(g,{}),0<t.length&&(0,h.jsx)("ul",{className:"amp-sidebar__errors-list",children:t.map(((e,t)=>(0,h.jsx)("li",{className:"amp-sidebar__errors-list-item",children:(0,h.jsx)(C,{...e})},`${e.clientId}${t}`)))}),r&&(0,h.jsx)("div",{className:"amp-sidebar__options",children:(0,h.jsx)(l.Button,{isLink:!0,onClick:()=>e(!s),children:s?(0,i.__)("Hide reviewed issues","amp"):(0,i.__)("Show reviewed issues","amp")})})]})}function M(){const e=(0,n.useSelect)((e=>e(o.M_).getUnreviewedValidationErrors()),[]),t=(0,c.useMemo)((()=>e.map((({clientId:e})=>e)).filter((e=>e)).map((e=>`#block-${e}::before`))),[e]);return(0,h.jsx)("style",{children:`${t.join(",")} {\n\t\t\t\t\tborder-radius: 9px;\n\t\t\t\t\tbottom: -3px;\n\t\t\t\t\tbox-shadow: 0 0 0 2px #bb522e;\n\t\t\t\t\tcontent: '';\n\t\t\t\t\tleft: -3px;\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tright: -3px;\n\t\t\t\t\ttop: -3px;\n\t\t\t\t}`})}var L=r(491);const A=500,y=window.lodash,I=window.wp.apiFetch;var T=r.n(I);const V=window.wp.url;function N({validationError:e,source:t,currentPostId:r,blockOrder:i,getBlock:s}){if(!t.block_name||void 0===t.block_content_index)return;if(r!==t.post_id)return;const n=i[t.block_content_index];if(!n)return;const o=s(n);o&&o.name===t.block_name&&(e.clientId=n)}var D=r(182);const B="amp-block-validation",O="amp-editor-sidebar",H=(0,i.__)("AMP Validation","amp"),F=a.wc;function U(){const{broken:e,errorCount:t}=(0,n.useSelect)((e=>({broken:e(o.M_).getAMPCompatibilityBroken(),errorCount:e(o.M_).getUnreviewedValidationErrors()?.length||0})),[]),{isAMPEnabled:r}=(0,D.n)();return function(){const[e,t]=(0,c.useState)([]),[r,s]=(0,c.useState)(!1),[a,l]=(0,c.useState)([]),[d,u]=(0,c.useState)(!1),{setIsFetchingErrors:p,setFetchingErrorsRequestErrorMessage:h,setReviewLink:_,setSupportLink:m,setValidationErrors:g}=(0,n.useDispatch)(o.M_),{currentPostId:E,getBlock:v,getClientIdsWithDescendants:x,isAutosavingPost:w,isEditedPostNew:f,isPreviewingPost:j,isSavingPost:k,previewLink:P,validationErrors:b}=(0,n.useSelect)((e=>({currentPostId:e("core/editor").getCurrentPostId(),getBlock:e("core/block-editor").getBlock,getClientIdsWithDescendants:e("core/block-editor").getClientIdsWithDescendants,isAutosavingPost:e("core/editor").isAutosavingPost(),isEditedPostNew:e("core/editor").isEditedPostNew(),isPreviewingPost:e("core/editor").isPreviewingPost(),isSavingPost:e("core/editor").isSavingPost(),previewLink:e("core/editor").getEditedPostPreviewLink(),validationErrors:e(o.M_).getValidationErrors()})),[]),S=(0,L.usePrevious)(f);(0,c.useEffect)((()=>{f||S||u(!0)}),[f,S]),(0,c.useEffect)((()=>{if(k)return j?(u(!0),void s(!0)):void(w||u(!0))}),[w,j,k]),(0,c.useEffect)((()=>{if(!d)return;if(k)return void p(!0);if(r&&!(0,V.isURL)(P))return;const e={id:E};r&&(e.preview_nonce=(0,V.getQueryArg)(P,"preview_nonce")),p(!0),u(!1),s(!1),h(""),t(x()),T()({path:"/amp/v1/validate-post-url/",method:"POST",data:e}).then((e=>{g(e.results),_(e.review_link),m(e.support_link)})).catch((e=>{h(e?.message||(0,i.__)("Whoops! Something went wrong.","amp"))})).finally((()=>{p(!1)}))}),[E,x,r,k,P,h,p,_,m,g,d]),(0,c.useEffect)((()=>{b&&!(0,y.isEqual)(a,b)&&l(b)}),[a,b]),(0,c.useEffect)((()=>{const t=a.map((t=>{if(!t.error.sources?.length)return t;for(const r of t.error.sources){if("clientId"in t)break;N({validationError:t,source:r,getBlock:v,blockOrder:0<e.length?e:x(),currentPostId:E})}return t}));g(t)}),[e,E,v,x,g,a])}(),function(){const[e,t]=(0,c.useState)(null),[r,i]=(0,c.useState)(),s=(0,c.useRef)(null),{setIsPostDirty:a,setMaybeIsPostDirty:l}=(0,n.useDispatch)(o.M_),{getEditedPostContent:d,hasErrorsFromRemovedBlocks:u,hasActiveMetaboxes:p,isPostDirty:h,isSavingOrPreviewingPost:_}=(0,n.useSelect)((e=>({getEditedPostContent:e("core/editor").getEditedPostContent,hasErrorsFromRemovedBlocks:Boolean(e(o.M_).getValidationErrors().find((({clientId:t})=>t&&!e("core/block-editor").getBlockName(t)))),hasActiveMetaboxes:e("core/edit-post").hasMetaBoxes(),isPostDirty:e(o.M_).getIsPostDirty(),isSavingOrPreviewingPost:e("core/editor").isSavingPost()&&!e("core/editor").isAutosavingPost()||e("core/editor").isPreviewingPost()})),[]);(0,c.useEffect)((()=>()=>{s.current&&s.current()}),[]),(0,c.useEffect)((()=>{h&&_&&(a(!1),t(null))}),[h,_,a]),(0,c.useEffect)((()=>{if(null===e){const e=d();return t(e),void i(e)}r!==e&&a(!0)}),[e,d,a,r]),(0,c.useEffect)((()=>{l(!h&&(p||u))}),[p,u,h,l]);const m=(0,c.useCallback)((()=>{i(d())}),[d]),g=(0,L.useDebounce)(m,A);(0,c.useEffect)((()=>{h&&s.current?(s.current(),s.current=null):_||h||s.current||(s.current=(0,n.subscribe)(g))}),[g,h,_])}(),r?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.PluginSidebarMoreMenuItem,{icon:(0,h.jsx)(F,{}),target:O,children:H}),(0,h.jsxs)(s.PluginSidebar,{className:`${B}-sidebar`,icon:(0,h.jsx)(a.bx,{count:t,broken:e}),name:O,title:H,children:[(0,h.jsx)(R,{}),(0,h.jsx)(M,{})]})]}):null}},133:(e,t,r)=>{"use strict";r.r(t),r.d(t,{PLUGIN_ICON:()=>l,PLUGIN_NAME:()=>a,default:()=>c});var i=r(723),s=r(309),n=r(587),o=r(790);const a="amp-block-validation-document-setting-panel",l="";function c(){return(0,o.jsx)(s.PluginDocumentSettingPanel,{name:a,title:(0,i.__)("AMP","amp"),initialOpen:!0,children:(0,o.jsx)(n.A,{})})}},208:(e,t,r)=>{"use strict";r.r(t),r.d(t,{PLUGIN_ICON:()=>l,PLUGIN_NAME:()=>a,default:()=>c});var i=r(723),s=r(309),n=r(587),o=r(790);const a="amp-block-validation-pre-publish-panel",l="";function c(){return(0,o.jsx)(s.PluginPrePublishPanel,{title:(0,i.__)("AMP","amp"),initialOpen:!0,children:(0,o.jsx)(n.A,{})})}},866:(e,t,r)=>{"use strict";r.d(t,{M_:()=>h});var i=r(955),s=r(143);const n="SET_FETCHING_ERRORS_REQUEST_ERROR_MESSAGE",o="SET_IS_FETCHING_ERRORS",a="SET_IS_POST_DIRTY",l="SET_IS_SHOWING_REVIEWED",c="SET_MAYBE_IS_POST_DIRTY",d="SET_REVIEW_LINK",u="SET_SUPPORT_LINK",p="SET_VALIDATION_ERRORS",h=(0,s.createReduxStore)("amp/block-validation",{reducer:(e=_,t)=>{switch(t.type){case n:return{...e,fetchingErrorsRequestErrorMessage:t.fetchingErrorsRequestErrorMessage};case o:return{...e,isFetchingErrors:t.isFetchingErrors};case a:return{...e,isPostDirty:t.isPostDirty};case l:return{...e,isShowingReviewed:t.isShowingReviewed};case c:return{...e,maybeIsPostDirty:t.maybeIsPostDirty};case d:return{...e,reviewLink:t.reviewLink};case u:return{...e,supportLink:t.supportLink};case p:return{...e,ampCompatibilityBroken:Boolean(t.validationErrors.filter((({status:e})=>e===i.VALIDATION_ERROR_NEW_REJECTED_STATUS||e===i.VALIDATION_ERROR_ACK_REJECTED_STATUS))?.length),reviewedValidationErrors:t.validationErrors.filter((({status:e})=>e===i.VALIDATION_ERROR_ACK_ACCEPTED_STATUS||e===i.VALIDATION_ERROR_ACK_REJECTED_STATUS)),unreviewedValidationErrors:t.validationErrors.filter((({status:e})=>e===i.VALIDATION_ERROR_NEW_ACCEPTED_STATUS||e===i.VALIDATION_ERROR_NEW_REJECTED_STATUS)),keptMarkupValidationErrors:t.validationErrors.filter((({status:e})=>e===i.VALIDATION_ERROR_NEW_REJECTED_STATUS||e===i.VALIDATION_ERROR_ACK_REJECTED_STATUS)),validationErrors:t.validationErrors};default:return e}},actions:{setFetchingErrorsRequestErrorMessage:e=>({type:n,fetchingErrorsRequestErrorMessage:e}),setIsFetchingErrors:e=>({type:o,isFetchingErrors:e}),setIsPostDirty:e=>({type:a,isPostDirty:e}),setIsShowingReviewed:e=>({type:l,isShowingReviewed:e}),setMaybeIsPostDirty:e=>({type:c,maybeIsPostDirty:e}),setReviewLink:e=>({type:d,reviewLink:e}),setSupportLink:e=>({type:u,supportLink:e}),setValidationErrors:e=>({type:p,validationErrors:e})},selectors:{getAMPCompatibilityBroken:({ampCompatibilityBroken:e})=>e,getFetchingErrorsRequestErrorMessage:({fetchingErrorsRequestErrorMessage:e})=>e,getIsFetchingErrors:({isFetchingErrors:e})=>e,getIsPostDirty:({isPostDirty:e})=>e,getIsShowingReviewed:({isShowingReviewed:e})=>e,getMaybeIsPostDirty:({maybeIsPostDirty:e})=>e,getReviewLink:({reviewLink:e})=>e,getSupportLink:({supportLink:e})=>e,getReviewedValidationErrors:({reviewedValidationErrors:e})=>e,getUnreviewedValidationErrors:({unreviewedValidationErrors:e})=>e,getKeptMarkupValidationErrors:({keptMarkupValidationErrors:e})=>e,getValidationErrors:({validationErrors:e})=>e},initialState:_={ampCompatibilityBroken:!1,fetchingErrorsRequestErrorMessage:"",isPostDirty:!1,isFetchingErrors:!1,isShowingReviewed:!1,keptMarkupValidationErrors:[],maybeIsPostDirty:!1,rawValidationErrors:[],reviewLink:null,supportLink:null,reviewedValidationErrors:[],unreviewedValidationErrors:[],validationErrors:[]}});var _;(0,s.register)(h)},371:(e,t,r)=>{"use strict";r.d(t,{Bn:()=>l,IS:()=>d,JP:()=>a,LF:()=>p,NO:()=>c,Qj:()=>_,RY:()=>o,XF:()=>n,ZD:()=>u,wN:()=>h});var i=r(573),s=r(790);const n=()=>(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 20",children:(0,s.jsx)(i.Path,{fill:"#707070",d:"M8 20c1.1 0 2-.9 2-2H6c0 1.1.9 2 2 2zm6-6V9c0-3.07-1.63-5.64-4.5-6.32V2C9.5 1.17 8.83.5 8 .5S6.5 1.17 6.5 2v.68C3.64 3.36 2 5.92 2 9v5l-2 2v1h16v-1l-2-2zm-2 1H4V9c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5v6z"})}),o=()=>(0,s.jsxs)(i.SVG,{width:"12",height:"9",viewBox:"0 0 12 9",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)(i.Path,{fill:"white",d:"M3.67502 0.958984H5.17502V5.85898C5.17502 6.35898 5.07502 6.75898 4.87502 7.05898C4.67502 7.35898 4.37503 7.65898 4.07503 7.85898C3.67503 8.05898 3.27503 8.15898 2.87503 8.15898C2.07503 8.15898 1.57503 7.95898 1.07503 7.55898C0.675025 7.15898 0.475025 6.65898 0.475025 5.95898H1.97503C1.97503 6.25898 2.07502 6.55898 2.17502 6.75898C2.27503 6.95898 2.57503 6.95898 2.87503 6.95898C3.17503 6.95898 3.37503 6.85898 3.57503 6.65898C3.77503 6.45898 3.77503 6.15898 3.77503 5.85898V0.958984H3.67502Z"}),(0,s.jsx)(i.Path,{fill:"white",d:"M10.075 6.25937C10.075 5.95937 9.97503 5.75938 9.77503 5.65938C9.57503 5.55938 9.27502 5.35938 8.67502 5.15938C8.17502 4.95938 7.77503 4.85938 7.47503 4.65938C6.67503 4.25938 6.27503 3.65937 6.27503 2.85938C6.27503 2.45938 6.37503 2.15937 6.57503 1.85938C6.77503 1.55937 7.07503 1.35937 7.47503 1.15937C7.97503 0.959375 8.47503 0.859375 8.97503 0.859375C9.47503 0.859375 9.97502 0.959375 10.375 1.15937C10.775 1.35937 11.075 1.55937 11.275 1.95937C11.475 2.25937 11.575 2.65937 11.575 3.05937H10.075C10.075 2.75937 9.97503 2.45937 9.77503 2.25937C9.57503 2.05937 9.27502 1.95937 8.87502 1.95937C8.47502 1.95937 8.27503 2.05937 8.07503 2.15937C7.87503 2.35937 7.77503 2.45937 7.77503 2.75937C7.77503 2.95937 7.87503 3.15937 8.07503 3.35938C8.27503 3.55938 8.67503 3.65937 9.07503 3.75937C9.87503 4.05937 10.475 4.35938 10.875 4.65938C11.275 4.95938 11.475 5.45937 11.475 6.05937C11.475 6.65937 11.275 7.15937 10.775 7.45937C10.275 7.85937 9.67502 7.95937 8.87502 7.95937C8.37502 7.95937 7.87502 7.85938 7.37502 7.65938C6.97502 7.45938 6.57502 7.15938 6.37502 6.85938C6.17502 6.55937 5.97503 6.05938 5.97503 5.65938H7.47503C7.47503 6.45938 7.97502 6.85938 8.87502 6.85938C9.17502 6.85938 9.47502 6.75938 9.67502 6.65938C9.97502 6.65938 10.075 6.45937 10.075 6.25937Z"})]}),a=()=>(0,s.jsx)(i.SVG,{width:"13",height:"6",viewBox:"0 0 13 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(i.Path,{fill:"white",d:"M2.44926 3.06836L5.78911 4.24609V5.88672L0.744186 3.74805V2.36523L5.78911 0.226562V1.86719L2.44926 3.06836ZM10.6407 3.05078L7.23637 1.86133V0.232422L12.3399 2.37109V3.74805L7.23637 5.89258V4.25781L10.6407 3.05078Z"})}),l=()=>(0,s.jsx)(i.SVG,{width:"8",height:"9",viewBox:"0 0 8 9",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(i.Path,{fill:"white",d:"M4.13 6.45937H2.93001L2.53 8.85938H1.43L1.83 6.45937H0.530005V5.45937H2.03L2.33 3.75937H1.03V2.75937H2.53L2.93001 0.359375H4.03L3.63 2.75937H4.73L5.13 0.359375H6.23L5.83 2.75937H7.13V3.75937H5.63L5.33 5.45937H6.63V6.45937H5.13L4.73 8.85938H3.63L4.13 6.45937ZM3.13 5.45937H4.23L4.53 3.75937H3.43001L3.13 5.45937Z"})}),c=()=>(0,s.jsx)(i.SVG,{width:"20",height:"17",viewBox:"0 0 20 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(i.Path,{fill:"#BE2C23",d:"M10.0749 4.05547L16.3499 14.8971H3.79987L10.0749 4.05547ZM10.0749 0.730469L0.908203 16.5638H19.2415L10.0749 0.730469ZM10.9082 12.3971H9.24154V14.0638H10.9082V12.3971ZM10.9082 7.39714H9.24154V10.7305H10.9082V7.39714Z"})}),d=()=>(0,s.jsx)(i.SVG,{width:"21",height:"21",viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(i.Path,{fill:"#479696",d:"M12.2577 9.04336L10.491 10.81L8.71605 9.04336L7.54105 10.2184L9.31605 11.985L7.54938 13.7517L8.72438 14.9267L10.491 13.16L12.2577 14.9267L13.4327 13.7517L11.666 11.985L13.4327 10.2184L12.2577 9.04336ZM13.4077 3.65169L12.5744 2.81836H8.40772L7.57438 3.65169H4.65771V5.31836H16.3244V3.65169H13.4077ZM5.49105 16.1517C5.49105 17.0684 6.24105 17.8184 7.15772 17.8184H13.8244C14.741 17.8184 15.491 17.0684 15.491 16.1517V6.15169H5.49105V16.1517ZM7.15772 7.81836H13.8244V16.1517H7.15772V7.81836Z"})}),u=()=>(0,s.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:(0,s.jsx)(i.Path,{fill:"#0075C2",d:"M13.3 9.1l-4 6.6h-.8l.7-4.3H7c-.2 0-.4-.2-.4-.4 0-.1.1-.2.1-.2l4-6.6h.7l-.7 4.3h2.2c.2 0 .4.2.4.4.1.1 0 .2 0 .2zM10 .5C4.7.5.4 4.8.4 10c0 5.3 4.3 9.5 9.6 9.5s9.6-4.3 9.6-9.5c0-5.3-4.3-9.5-9.6-9.5z"})}),p=()=>(0,s.jsx)(i.SVG,{width:"21",height:"21",viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(i.Path,{d:"M9.86345 16.8148H9.16345L9.96345 12.3148H7.66345C7.46345 12.3148 7.26345 12.1148 7.26345 11.9148C7.26345 11.8148 7.36345 11.7148 7.36345 11.7148L11.5635 4.71484H12.3635L11.5635 9.31484H13.8635C14.0635 9.31484 14.2635 9.51484 14.2635 9.71484C14.2635 9.81484 14.2635 9.91484 14.1635 9.91484L9.86345 16.8148ZM10.6635 0.714844C5.16345 0.714844 0.663452 5.21484 0.663452 10.7148C0.663452 16.2148 5.16345 20.7148 10.6635 20.7148C16.1635 20.7148 20.6635 16.2148 20.6635 10.7148C20.6635 5.21484 16.1635 0.714844 10.6635 0.714844Z"})}),h=()=>(0,s.jsxs)(i.SVG,{width:"21",height:"21",viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)(i.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M0.912598 10.2832C0.912598 15.7832 5.4126 20.2832 10.9126 20.2832C16.4126 20.2832 20.9126 15.7832 20.9126 10.2832C20.9126 4.7832 16.4126 0.283203 10.9126 0.283203C5.4126 0.283203 0.912598 4.7832 0.912598 10.2832Z",fill:"white"}),(0,s.jsx)(i.Path,{d:"M10.1126 16.3832H9.4126L10.2126 11.8832H7.9126C7.7126 11.8832 7.5126 11.6832 7.5126 11.4832C7.5126 11.3832 7.6126 11.2832 7.6126 11.2832L11.8126 4.2832H12.6126L11.8126 8.8832H14.1126C14.3126 8.8832 14.5126 9.0832 14.5126 9.2832C14.5126 9.3832 14.5126 9.4832 14.4126 9.4832L10.1126 16.3832ZM10.9126 0.283203C5.4126 0.283203 0.912598 4.7832 0.912598 10.2832C0.912598 15.7832 5.4126 20.2832 10.9126 20.2832C16.4126 20.2832 20.9126 15.7832 20.9126 10.2832C20.9126 4.7832 16.4126 0.283203 10.9126 0.283203Z",fill:"#37414B"}),(0,s.jsx)(i.Circle,{cx:"10.9126",cy:"10.2832",r:"9",stroke:"#BB522E",strokeWidth:"2"}),(0,s.jsx)(i.Line,{x1:"16.5185",y1:"17.3458",x2:"3.79056",y2:"4.61786",stroke:"#BB522E",strokeWidth:"2"}),(0,s.jsx)(i.Line,{x1:"19.8051",y1:"18.1177",x2:"3.28165",y2:"1.24851",stroke:"white",strokeWidth:"2"})]}),_=()=>(0,s.jsxs)(i.SVG,{width:"21",height:"21",viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsxs)(i.G,{clipPath:"url(#clip-amp-validation-errors-kept)",children:[(0,s.jsx)(i.Path,{d:"M10.7617 2.54102C15.1617 2.54102 18.7617 6.14102 18.7617 10.541C18.7617 12.141 18.2617 13.541 17.5617 14.741L18.9617 16.241C20.0617 14.641 20.7617 12.641 20.7617 10.541C20.7617 5.04102 16.2617 0.541016 10.7617 0.541016C8.76172 0.541016 6.86172 1.14102 5.26172 2.24102L6.66172 3.74102C7.86172 2.94102 9.26172 2.54102 10.7617 2.54102Z",fill:"#BB522E"}),(0,s.jsx)(i.Path,{d:"M0.761719 10.541C0.761719 16.041 5.26172 20.541 10.7617 20.541C13.4617 20.541 15.8617 19.441 17.6617 17.741L3.66172 3.54102C1.86172 5.34102 0.761719 7.84102 0.761719 10.541ZM10.7617 18.541C6.36172 18.541 2.76172 14.941 2.76172 10.541C2.76172 9.04102 3.16172 7.74102 3.86172 6.54102L14.7617 17.441C13.5617 18.141 12.2617 18.541 10.7617 18.541Z",fill:"#BB522E"}),(0,s.jsx)(i.Path,{d:"M14.2619 9.74062C14.3619 9.74062 14.3619 9.64062 14.3619 9.54062C14.3619 9.34062 14.1619 9.14062 13.9619 9.14062H11.9619L13.5619 10.7406L14.2619 9.74062Z",fill:"#BB522E"}),(0,s.jsx)(i.Path,{d:"M12.4615 4.54102H11.6615L10.0615 7.14102L11.7615 8.84102L12.4615 4.54102Z",fill:"#BB522E"}),(0,s.jsx)(i.Path,{d:"M7.46182 11.5414C7.46182 11.5414 7.36182 11.6414 7.36182 11.7414C7.36182 11.9414 7.56182 12.1414 7.76182 12.1414H10.0618L9.26182 16.6414H9.96182L12.5618 12.5414L9.06182 8.94141L7.46182 11.5414Z",fill:"#BB522E"})]}),(0,s.jsx)(i.Defs,{children:(0,s.jsx)("clipPath",{id:"clip-amp-validation-errors-kept",children:(0,s.jsx)(i.Rect,{width:"20",height:"20",fill:"white",transform:"translate(0.761719 0.541016)"})})})]})},955:e=>{"use strict";e.exports=ampBlockValidation},790:e=>{"use strict";e.exports=window.ReactJSXRuntime},715:e=>{"use strict";e.exports=window.wp.blockEditor},427:e=>{"use strict";e.exports=window.wp.components},491:e=>{"use strict";e.exports=window.wp.compose},143:e=>{"use strict";e.exports=window.wp.data},309:e=>{"use strict";e.exports=window.wp.editPost},468:e=>{"use strict";e.exports=window.wp.element},723:e=>{"use strict";e.exports=window.wp.i18n},573:e=>{"use strict";e.exports=window.wp.primitives},942:(e,t)=>{var r;!function(){"use strict";var i={}.hasOwnProperty;function s(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=o(e,n(r)))}return e}function n(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return s.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var r in e)i.call(e,r)&&e[r]&&(t=o(t,r));return t}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(s.default=s,e.exports=s):void 0===(r=function(){return s}.apply(t,[]))||(e.exports=r)}()}},t={};function r(i){var s=t[i];if(void 0!==s)return s.exports;var n=t[i]={exports:{}};return e[i](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";const e=window.wp.hooks,t=window.wp.plugins;var i=r(143),s=r(491),n=r(866),o=r(715),a=r(427),l=r(563),c=r(173),d=r(182),u=r(790);function p({clientId:e,count:t}){const{openGeneralSidebar:r}=(0,i.useDispatch)("core/edit-post"),{isAMPEnabled:s}=(0,d.n)();return s?(0,u.jsx)(o.BlockControls,{children:(0,u.jsx)(a.ToolbarButton,{onClick:()=>{r(`${c.PLUGIN_NAME}/${c.SIDEBAR_NAME}`),setTimeout((()=>{const t=Array.from(document.querySelectorAll(`.error-${e} button`)),r=t[0];t.reverse();for(const e of t)"false"===e.getAttribute("aria-expanded")&&e.click();r&&r.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}))},children:(0,u.jsx)(l.bx,{count:t})})}):null}function h(e){const{BlockEdit:t,clientId:r}=e,s=(0,i.useSelect)((e=>(e(n.M_).getUnreviewedValidationErrors()||[]).filter((({clientId:e})=>r===e)).length||0),[r]);return(0,u.jsxs)(u.Fragment,{children:[0<s&&(0,u.jsx)(p,{clientId:r,count:s}),(0,u.jsx)(t,{...e})]})}const _=(0,s.createHigherOrderComponent)((e=>t=>(0,u.jsx)(h,{...t,BlockEdit:e})),"BlockEditWithAMPToolbar"),m=r(349);m.keys().forEach((e=>{const{default:r,PLUGIN_NAME:i,PLUGIN_ICON:s}=m(e);(0,t.registerPlugin)(i,{icon:s,render:r})})),(0,e.addFilter)("editor.BlockEdit","ampBlockValidation/filterEdit",_,-99)})()})();