/*! This file is auto-generated */ this.wp=this.wp||{},this.wp.editor=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=556)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.blockEditor},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t-1},get:function(e){return r[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),r.push(t))},delete:function(e){var t=n.indexOf(e);t>-1&&(n.splice(t,1),r.splice(t,1))}}),c=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){c=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function s(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!o.has(e)){var t,n=null,r=null,s=null,i=function(){e.clientWidth!==r&&d()},a=function(t){window.removeEventListener("resize",i,!1),e.removeEventListener("input",d,!1),e.removeEventListener("keyup",d,!1),e.removeEventListener("autosize:destroy",a,!1),e.removeEventListener("autosize:update",d,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),o.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",a,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",d,!1),window.addEventListener("resize",i,!1),e.addEventListener("input",d,!1),e.addEventListener("autosize:update",d,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",o.set(e,{destroy:a,update:d}),"vertical"===(t=window.getComputedStyle(e,null)).resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),n="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(n)&&(n=0),d()}function l(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(){if(0!==e.scrollHeight){var t=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(e),o=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+n+"px",r=e.clientWidth,t.forEach((function(e){e.node.scrollTop=e.scrollTop})),o&&(document.documentElement.scrollTop=o)}}function d(){u();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(rObject(m.createHigherOrderComponent)(t=>({attributes:n,setAttributes:r,...o})=>{const c=Object(h.useSelect)(e=>e("core/editor").getCurrentPostType(),[]),[i,d]=Object(s.useEntityProp)("postType",c,"meta"),m=Object(l.useMemo)(()=>({...n,...Object(u.mapValues)(e,e=>i[e])}),[n,i]);return Object(l.createElement)(t,Object(a.a)({attributes:m,setAttributes:t=>{const n=Object(u.mapKeys)(Object(u.pickBy)(t,(t,n)=>e[n]),(t,n)=>e[n]);Object(u.isEmpty)(n)||d(n),r(t)}},o))},"withMetaAttributeSource"))(t)(e.edit)),e}Object(p.addFilter)("blocks.registerBlockType","core/editor/custom-sources-backwards-compatibility/shim-attribute-source",v),Object(h.select)(d.store).getBlockTypes().map(({name:e})=>Object(h.select)(d.store).getBlockType(e)).forEach(v);var b=n(33),w=n.n(b),f={name:"users",className:"editor-autocompleters__user",triggerPrefix:"@",options(e){let t="";return e&&(t="?search="+encodeURIComponent(e)),w()({path:"/wp/v2/users"+t})},isDebounced:!0,getOptionKeywords:e=>[e.slug,e.name],getOptionLabel:e=>[e.avatar_urls&&e.avatar_urls[24]?Object(l.createElement)("img",{key:"avatar",className:"editor-autocompleters__user-avatar",alt:"",src:e.avatar_urls[24]}):Object(l.createElement)("span",{className:"editor-autocompleters__no-avatar"}),Object(l.createElement)("span",{key:"name",className:"editor-autocompleters__user-name"},e.name),Object(l.createElement)("span",{key:"slug",className:"editor-autocompleters__user-slug"},e.slug)],getOptionCompletion:e=>"@"+e.slug};Object(p.addFilter)("editor.Autocomplete.completers","editor/autocompleters/set-default-completers",(function(e=[]){return e.push(Object(u.clone)(f)),e}));var g=n(32);const O={insertUsage:{},isPublishSidebarEnabled:!0},j={...c.SETTINGS_DEFAULTS,richEditingEnabled:!0,codeEditingEnabled:!0,enableCustomFields:!1,supportsLayout:!0};function E(e){return e&&"object"==typeof e&&"raw"in e?e.raw:e}var S=Object(h.combineReducers)({postId:function(e=null,t){switch(t.type){case"SETUP_EDITOR_STATE":case"RESET_POST":return t.post.id}return e},postType:function(e=null,t){switch(t.type){case"SETUP_EDITOR_STATE":case"RESET_POST":return t.post.type}return e},preferences:function(e=O,t){switch(t.type){case"ENABLE_PUBLISH_SIDEBAR":return{...e,isPublishSidebarEnabled:!0};case"DISABLE_PUBLISH_SIDEBAR":return{...e,isPublishSidebarEnabled:!1}}return e},saving:function(e={},t){switch(t.type){case"REQUEST_POST_UPDATE_START":case"REQUEST_POST_UPDATE_FINISH":return{pending:"REQUEST_POST_UPDATE_START"===t.type,options:t.options||{}}}return e},postLock:function(e={isLocked:!1},t){switch(t.type){case"UPDATE_POST_LOCK":return t.lock}return e},template:function(e={isValid:!0},t){switch(t.type){case"SET_TEMPLATE_VALIDITY":return{...e,isValid:t.isValid}}return e},postSavingLock:function(e={},t){switch(t.type){case"LOCK_POST_SAVING":return{...e,[t.lockName]:!0};case"UNLOCK_POST_SAVING":return Object(u.omit)(e,t.lockName)}return e},isReady:function(e=!1,t){switch(t.type){case"SETUP_EDITOR_STATE":return!0;case"TEAR_DOWN_EDITOR":return!1}return e},editorSettings:function(e=j,t){switch(t.type){case"UPDATE_EDITOR_SETTINGS":return{...e,...t.settings}}return e},postAutosavingLock:function(e={},t){switch(t.type){case"LOCK_POST_AUTOSAVING":return{...e,[t.lockName]:!0};case"UNLOCK_POST_AUTOSAVING":return Object(u.omit)(e,t.lockName)}return e}}),_=n(26),y=n(47),P=n(20),x=n(24),V=n.n(x),z=n(171);const k=new Set(["meta"]),C="core/editor",H=/%(?:postname|pagename)%/,T=["title","excerpt","content"];function B(e,t){return Object(P.addQueryArgs)(e,t)}function M(e){return e?Object(u.trim)(Object(u.deburr)(e).replace(/[\s\./]+/g,"-").replace(/[^\w-]+/g,"").toLowerCase(),"-"):""}var L=n(13);const A={},R=[],I=Object(h.createRegistrySelector)(e=>()=>e("core").hasUndo()),N=Object(h.createRegistrySelector)(e=>()=>e("core").hasRedo());function G(e){return"auto-draft"===q(e).status}function D(e){const t=Y(e);return"blocks"in t||"content"in t}const U=Object(h.createRegistrySelector)(e=>t=>{const n=K(t),r=Z(t);return!!e("core").hasEditsForEntityRecord("postType",n,r)}),F=Object(h.createRegistrySelector)(e=>t=>{const n=e("core").__experimentalGetDirtyEntityRecords(),{type:r,id:o}=q(t);return Object(u.some)(n,e=>"postType"!==e.kind||e.name!==r||e.key!==o)});function W(e){return!U(e)&&G(e)}const q=Object(h.createRegistrySelector)(e=>t=>{const n=Z(t),r=K(t),o=e("core").getRawEntityRecord("postType",r,n);return o||A});function K(e){return e.postType}function Z(e){return e.postId}function $(e){return Object(u.get)(q(e),["_links","version-history",0,"count"],0)}function Q(e){return Object(u.get)(q(e),["_links","predecessor-version",0,"id"],null)}const Y=Object(h.createRegistrySelector)(e=>t=>{const n=K(t),r=Z(t);return e("core").getEntityRecordEdits("postType",n,r)||A}),X=Object(h.createRegistrySelector)(e=>()=>(V()("`wp.data.select( 'core/editor' ).getReferenceByDistinctEdits`",{since:"5.4",alternative:"`wp.data.select( 'core' ).getReferenceByDistinctEdits`"}),e("core").getReferenceByDistinctEdits()));function J(e,t){switch(t){case"type":return K(e);case"id":return Z(e);default:const n=q(e);if(!n.hasOwnProperty(t))break;return E(n[t])}}function ee(e,t){switch(t){case"content":return Ee(e)}const n=Y(e);return n.hasOwnProperty(t)?k.has(t)?((e,t)=>{const n=Y(e);return n.hasOwnProperty(t)?{...J(e,t),...n[t]}:J(e,t)})(e,t):n[t]:J(e,t)}const te=Object(h.createRegistrySelector)(e=>(t,n)=>{if(!Object(u.includes)(T,n)&&"preview_link"!==n)return;const r=K(t),o=Z(t),c=Object(u.get)(e("core").getCurrentUser(),["id"]),s=e("core").getAutosave(r,o,c);return s?E(s[n]):void 0});function ne(e){if("private"===ee(e,"status"))return"private";return ee(e,"password")?"password":"public"}function re(e){return"pending"===q(e).status}function oe(e,t){const n=t||q(e);return-1!==["publish","private"].indexOf(n.status)||"future"===n.status&&!Object(y.isInTheFuture)(new Date(Number(Object(y.getDate)(n.date))-6e4))}function ce(e){return"future"===q(e).status&&!oe(e)}function se(e){const t=q(e);return U(e)||-1===["publish","private","future"].indexOf(t.status)}function ie(e){return!pe(e)&&(!!ee(e,"title")||!!ee(e,"excerpt")||!ae(e)||"native"===l.Platform.OS)}function ae(e){const t=Le(e);if(t.length){if(t.length>1)return!1;const e=t[0].name;if(e!==Object(d.getDefaultBlockName)()&&e!==Object(d.getFreeformContentHandlerName)())return!1}return!Ee(e)}const le=Object(h.createRegistrySelector)(e=>t=>{if(!ie(t))return!1;if(ke(t))return!1;const n=K(t),r=Z(t),o=e("core").hasFetchedAutosaves(n,r),c=Object(u.get)(e("core").getCurrentUser(),["id"]),s=e("core").getAutosave(n,r,c);return!!o&&(!s||(!!D(t)||["title","excerpt"].some(e=>E(s[e])!==ee(t,e))))}),ue=Object(h.createRegistrySelector)(e=>t=>{V()("`wp.data.select( 'core/editor' ).getAutosave()`",{since:"5.3",alternative:"`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`"});const n=K(t),r=Z(t),o=Object(u.get)(e("core").getCurrentUser(),["id"]),c=e("core").getAutosave(n,r,o);return Object(u.mapValues)(Object(u.pick)(c,T),E)}),de=Object(h.createRegistrySelector)(e=>t=>{V()("`wp.data.select( 'core/editor' ).hasAutosave()`",{since:"5.3",alternative:"`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`"});const n=K(t),r=Z(t),o=Object(u.get)(e("core").getCurrentUser(),["id"]);return!!e("core").getAutosave(n,r,o)});function he(e){const t=ee(e,"date"),n=new Date(Number(Object(y.getDate)(t))-6e4);return Object(y.isInTheFuture)(n)}function me(e){const t=ee(e,"date"),n=ee(e,"modified"),r=q(e).status;return("draft"===r||"auto-draft"===r||"pending"===r)&&(t===n||null===t)}const pe=Object(h.createRegistrySelector)(e=>t=>{const n=K(t),r=Z(t);return e("core").isSavingEntityRecord("postType",n,r)}),ve=Object(h.createRegistrySelector)(e=>t=>{const n=K(t),r=Z(t);return!e("core").getLastEntitySaveError("postType",n,r)}),be=Object(h.createRegistrySelector)(e=>t=>{const n=K(t),r=Z(t);return!!e("core").getLastEntitySaveError("postType",n,r)});function we(e){return!!pe(e)&&!!Object(u.get)(e.saving,["options","isAutosave"])}function fe(e){return!!pe(e)&&!!e.saving.options.isPreview}function ge(e){if(e.saving.pending||pe(e))return;let t=te(e,"preview_link");t||(t=ee(e,"link"),t&&(t=Object(P.addQueryArgs)(t,{preview:!0})));const n=ee(e,"featured_media");return t&&n?Object(P.addQueryArgs)(t,{_thumbnail_id:n}):t}function Oe(e){const t=Le(e);if(t.length>2)return null;let n;if(1===t.length&&(n=t[0].name,"core/embed"===n)){var r;const e=null===(r=t[0].attributes)||void 0===r?void 0:r.providerNameSlug;["youtube","vimeo"].includes(e)?n="core/video":["spotify","soundcloud"].includes(e)&&(n="core/audio")}switch(2===t.length&&"core/paragraph"===t[1].name&&(n=t[0].name),n){case"core/image":return"image";case"core/quote":case"core/pullquote":return"quote";case"core/gallery":return"gallery";case"core/video":return"video";case"core/audio":return"audio";default:return null}}function je(e){V()("`core/editor` getBlocksForSerialization selector",{since:"5.3",alternative:"getEditorBlocks",hint:"Blocks serialization pre-processing occurs at save time"});const t=e.editor.present.blocks.value;return 1===t.length&&Object(d.isUnmodifiedDefaultBlock)(t[0])?[]:t}const Ee=Object(h.createRegistrySelector)(e=>t=>{const n=Z(t),r=K(t),o=e("core").getEditedEntityRecord("postType",r,n);if(o){if("function"==typeof o.content)return o.content(o);if(o.blocks)return Object(d.__unstableSerializeAndClean)(o.blocks);if(o.content)return o.content}return""});function Se(e){return pe(e)&&!oe(e)&&"publish"===ee(e,"status")}function _e(e){const t=ee(e,"permalink_template");return H.test(t)}function ye(e){const t=xe(e);if(!t)return null;const{prefix:n,postName:r,suffix:o}=t;return _e(e)?n+r+o:n}function Pe(e){return ee(e,"slug")||M(ee(e,"title"))||Z(e)}function xe(e){const t=ee(e,"permalink_template");if(!t)return null;const n=ee(e,"slug")||ee(e,"generated_slug"),[r,o]=t.split(H);return{prefix:r,postName:n,suffix:o}}function Ve(e){return e.postLock.isLocked}function ze(e){return Object.keys(e.postSavingLock).length>0}function ke(e){return Object.keys(e.postAutosavingLock).length>0}function Ce(e){return e.postLock.isTakeover}function He(e){return e.postLock.user}function Te(e){return e.postLock.activePostLock}function Be(e){return Object(u.has)(q(e),["_links","wp:action-unfiltered-html"])}function Me(e){return e.preferences.hasOwnProperty("isPublishSidebarEnabled")?e.preferences.isPublishSidebarEnabled:O.isPublishSidebarEnabled}function Le(e){return ee(e,"blocks")||R}function Ae(e){var t;return V()("select('core/editor').getEditorSelectionStart",{since:"10.0",plugin:"Gutenberg",alternative:"select('core/editor').getEditorSelection"}),null===(t=ee(e,"selection"))||void 0===t?void 0:t.selectionStart}function Re(e){var t;return V()("select('core/editor').getEditorSelectionStart",{since:"10.0",plugin:"Gutenberg",alternative:"select('core/editor').getEditorSelection"}),null===(t=ee(e,"selection"))||void 0===t?void 0:t.selectionEnd}function Ie(e){return ee(e,"selection")}function Ne(e){return e.isReady}function Ge(e){return e.editorSettings}function De(){return V()("select('core/editor').getStateBeforeOptimisticTransaction",{since:"5.7",hint:"No state history is kept on this store anymore"}),null}function Ue(){return V()("select('core/editor').inSomeHistory",{since:"5.7",hint:"No state history is kept on this store anymore"}),!1}function Fe(e){return Object(h.createRegistrySelector)(t=>(n,...r)=>(V()("`wp.data.select( 'core/editor' )."+e+"`",{since:"5.3",alternative:"`wp.data.select( 'core/block-editor' )."+e+"`"}),t("core/block-editor")[e](...r)))}const We=Fe("getBlockName"),qe=Fe("isBlockValid"),Ke=Fe("getBlockAttributes"),Ze=Fe("getBlock"),$e=Fe("getBlocks"),Qe=Fe("__unstableGetBlockWithoutInnerBlocks"),Ye=Fe("getClientIdsOfDescendants"),Xe=Fe("getClientIdsWithDescendants"),Je=Fe("getGlobalBlockCount"),et=Fe("getBlocksByClientId"),tt=Fe("getBlockCount"),nt=Fe("getBlockSelectionStart"),rt=Fe("getBlockSelectionEnd"),ot=Fe("getSelectedBlockCount"),ct=Fe("hasSelectedBlock"),st=Fe("getSelectedBlockClientId"),it=Fe("getSelectedBlock"),at=Fe("getBlockRootClientId"),lt=Fe("getBlockHierarchyRootClientId"),ut=Fe("getAdjacentBlockClientId"),dt=Fe("getPreviousBlockClientId"),ht=Fe("getNextBlockClientId"),mt=Fe("getSelectedBlocksInitialCaretPosition"),pt=Fe("getMultiSelectedBlockClientIds"),vt=Fe("getMultiSelectedBlocks"),bt=Fe("getFirstMultiSelectedBlockClientId"),wt=Fe("getLastMultiSelectedBlockClientId"),ft=Fe("isFirstMultiSelectedBlock"),gt=Fe("isBlockMultiSelected"),Ot=Fe("isAncestorMultiSelected"),jt=Fe("getMultiSelectedBlocksStartClientId"),Et=Fe("getMultiSelectedBlocksEndClientId"),St=Fe("getBlockOrder"),_t=Fe("getBlockIndex"),yt=Fe("isBlockSelected"),Pt=Fe("hasSelectedInnerBlock"),xt=Fe("isBlockWithinSelection"),Vt=Fe("hasMultiSelection"),zt=Fe("isMultiSelecting"),kt=Fe("isSelectionEnabled"),Ct=Fe("getBlockMode"),Ht=Fe("isTyping"),Tt=Fe("isCaretWithinFormattedText"),Bt=Fe("getBlockInsertionPoint"),Mt=Fe("isBlockInsertionPointVisible"),Lt=Fe("isValidTemplate"),At=Fe("getTemplate"),Rt=Fe("getTemplateLock"),It=Fe("canInsertBlockType"),Nt=Fe("getInserterItems"),Gt=Fe("hasInserterItems"),Dt=Fe("getBlockListSettings");function Ut(e){var t;return null===(t=Ge(e))||void 0===t?void 0:t.defaultTemplateTypes}const Ft=Object(_.a)(e=>{var t;const n=(null===(t=Ge(e))||void 0===t?void 0:t.defaultTemplatePartAreas)||[];return null==n?void 0:n.map(e=>{return{...e,icon:(t=e.icon,L[t]||z.a)};var t})},e=>{var t;return[null===(t=Ge(e))||void 0===t?void 0:t.defaultTemplatePartAreas]}),Wt=Object(_.a)((e,t)=>Object(u.find)(Ut(e),{slug:t})||{},(e,t)=>[Ut(e),t]);function qt(e,t){var n;if(!t)return{};const{excerpt:r,slug:o,title:c,area:s}=t,{title:i,description:a}=Wt(e,o),l=Object(u.isString)(c)?c:null==c?void 0:c.rendered;return{title:l&&l!==o?l:i||o,description:(Object(u.isString)(r)?r:null==r?void 0:r.raw)||a,icon:(null===(n=Ft(e).find(e=>s===e.area))||void 0===n?void 0:n.icon)||z.a}}var Kt=n(36),Zt=n(1);function*$t(e,t,n){let r;r=Object(u.has)(t,["content"])?t.content:e.content.raw;let o=Object(d.parse)(r);"auto-draft"===e.status&&n&&(o=Object(d.synchronizeBlocksWithTemplate)(o,n)),yield Yt(e),yield{type:"SETUP_EDITOR",post:e,edits:t,template:n},yield gn(o,{__unstableShouldCreateUndoLevel:!1}),yield nn(e),t&&Object.keys(t).some(n=>t[n]!==(Object(u.has)(e,[n,"raw"])?e[n].raw:e[n]))&&(yield rn(t))}function Qt(){return{type:"TEAR_DOWN_EDITOR"}}function Yt(e){return{type:"RESET_POST",post:e}}function*Xt(e){V()("resetAutosave action (`core/editor` store)",{since:"5.3",alternative:"receiveAutosaves action (`core` store)"});const t=yield h.controls.select(C,"getCurrentPostId");return yield h.controls.dispatch("core","receiveAutosaves",t,e),{type:"__INERT__"}}function Jt(e={}){return{type:"REQUEST_POST_UPDATE_START",options:e}}function en(e={}){return{type:"REQUEST_POST_UPDATE_FINISH",options:e}}function tn(){return V()("wp.data.dispatch( 'core/editor' ).updatePost",{since:"5.7",alternative:"User the core entitires store instead"}),{type:"DO_NOTHING"}}function nn(e){return{type:"SETUP_EDITOR_STATE",post:e}}function*rn(e,t){const{id:n,type:r}=yield h.controls.select(C,"getCurrentPost");yield h.controls.dispatch("core","editEntityRecord","postType",r,n,e,t)}function*on(e={}){if(!(yield h.controls.select(C,"isEditedPostSaveable")))return;let t={content:yield h.controls.select(C,"getEditedPostContent")};e.isAutosave||(yield h.controls.dispatch(C,"editPost",t,{undoIgnore:!0})),yield Jt(e);const n=yield h.controls.select(C,"getCurrentPost");t={id:n.id,...yield h.controls.select("core","getEntityRecordNonTransientEdits","postType",n.type,n.id),...t},yield h.controls.dispatch("core","saveEntityRecord","postType",n.type,t,e),yield en(e);const r=yield h.controls.select("core","getLastEntitySaveError","postType",n.type,n.id);if(r){const e=function(e){const{post:t,edits:n,error:r}=e;if(r&&"rest_autosave_no_changes"===r.code)return[];const o=["publish","private","future"],c=-1!==o.indexOf(t.status),s={publish:Object(Zt.__)("Publishing failed."),private:Object(Zt.__)("Publishing failed."),future:Object(Zt.__)("Scheduling failed.")};let i=c||-1===o.indexOf(n.status)?Object(Zt.__)("Updating failed."):s[n.status];return r.message&&!/<\/?[^>]*>/.test(r.message)&&(i=[i,r.message].join(" ")),[i,{id:"SAVE_POST_NOTICE_ID"}]}({post:n,edits:t,error:r});e.length&&(yield h.controls.dispatch(Kt.store,"createErrorNotice",...e))}else{const t=yield h.controls.select(C,"getCurrentPost"),r=function(e){const{previousPost:t,post:n,postType:r}=e;if(Object(u.get)(e.options,["isAutosave"]))return[];const o=["publish","private","future"],c=Object(u.includes)(o,t.status),s=Object(u.includes)(o,n.status);let i,a=Object(u.get)(r,["viewable"],!1);if(c||s?c&&!s?(i=r.labels.item_reverted_to_draft,a=!1):i=!c&&s?{publish:r.labels.item_published,private:r.labels.item_published_privately,future:r.labels.item_scheduled}[n.status]:r.labels.item_updated:i=null,i){const e=[];return a&&e.push({label:r.labels.view_item,url:n.link}),[i,{id:"SAVE_POST_NOTICE_ID",type:"snackbar",actions:e}]}return[]}({previousPost:n,post:t,postType:yield h.controls.resolveSelect("core","getPostType",t.type),options:e});r.length&&(yield h.controls.dispatch(Kt.store,"createSuccessNotice",...r)),e.isAutosave||(yield h.controls.dispatch("core/block-editor","__unstableMarkLastChangeAsPersistent"))}}function*cn(){const e=yield h.controls.select(C,"getCurrentPost"),t=yield h.controls.select(C,"getCurrentPostType"),n=yield h.controls.resolveSelect("core","getPostType",t),r=yield Object(g.apiFetch)({path:`/wp/v2/${n.rest_base}/${e.id}?context=edit&_timestamp=`+Date.now()});yield h.controls.dispatch(C,"resetPost",r)}function*sn(){const e=yield h.controls.select(C,"getCurrentPostType"),t=yield h.controls.resolveSelect("core","getPostType",e);yield h.controls.dispatch(Kt.store,"removeNotice","TRASH_POST_NOTICE_ID");try{const e=yield h.controls.select(C,"getCurrentPost");yield Object(g.apiFetch)({path:`/wp/v2/${t.rest_base}/${e.id}`,method:"DELETE"}),yield h.controls.dispatch(C,"savePost")}catch(e){yield h.controls.dispatch(Kt.store,"createErrorNotice",...(n={error:e},[n.error.message&&"unknown_error"!==n.error.code?n.error.message:Object(Zt.__)("Trashing failed"),{id:"TRASH_POST_NOTICE_ID"}]))}var n}function*an({local:e=!1,...t}={}){if(e){const e=yield h.controls.select(C,"getCurrentPost"),t=yield h.controls.select(C,"isEditedPostNew"),n=yield h.controls.select(C,"getEditedPostAttribute","title"),r=yield h.controls.select(C,"getEditedPostAttribute","content"),o=yield h.controls.select(C,"getEditedPostAttribute","excerpt");yield{type:"LOCAL_AUTOSAVE_SET",postId:e.id,isPostNew:t,title:n,content:r,excerpt:o}}else yield h.controls.dispatch(C,"savePost",{isAutosave:!0,...t})}function*ln(){yield h.controls.dispatch("core","redo")}function*un(){yield h.controls.dispatch("core","undo")}function dn(){return{type:"CREATE_UNDO_LEVEL"}}function hn(e){return{type:"UPDATE_POST_LOCK",lock:e}}function mn(){return{type:"ENABLE_PUBLISH_SIDEBAR"}}function pn(){return{type:"DISABLE_PUBLISH_SIDEBAR"}}function vn(e){return{type:"LOCK_POST_SAVING",lockName:e}}function bn(e){return{type:"UNLOCK_POST_SAVING",lockName:e}}function wn(e){return{type:"LOCK_POST_AUTOSAVING",lockName:e}}function fn(e){return{type:"UNLOCK_POST_AUTOSAVING",lockName:e}}function*gn(e,t={}){const{__unstableShouldCreateUndoLevel:n,selection:r}=t,o={blocks:e,selection:r};if(!1!==n){const{id:e,type:t}=yield h.controls.select(C,"getCurrentPost");if((yield h.controls.select("core","getEditedEntityRecord","postType",t,e)).blocks===o.blocks)return yield h.controls.dispatch("core","__unstableCreateUndoLevel","postType",t,e);o.content=({blocks:e=[]})=>Object(d.__unstableSerializeAndClean)(e)}yield*rn(o)}function On(e){return{type:"UPDATE_EDITOR_SETTINGS",settings:e}}const jn=e=>function*(...t){V()("`wp.data.dispatch( 'core/editor' )."+e+"`",{since:"5.3",alternative:"`wp.data.dispatch( 'core/block-editor' )."+e+"`"}),yield h.controls.dispatch("core/block-editor",e,...t)},En=jn("resetBlocks"),Sn=jn("receiveBlocks"),_n=jn("updateBlock"),yn=jn("updateBlockAttributes"),Pn=jn("selectBlock"),xn=jn("startMultiSelect"),Vn=jn("stopMultiSelect"),zn=jn("multiSelect"),kn=jn("clearSelectedBlock"),Cn=jn("toggleSelection"),Hn=jn("replaceBlocks"),Tn=jn("replaceBlock"),Bn=jn("moveBlocksDown"),Mn=jn("moveBlocksUp"),Ln=jn("moveBlockToPosition"),An=jn("insertBlock"),Rn=jn("insertBlocks"),In=jn("showInsertionPoint"),Nn=jn("hideInsertionPoint"),Gn=jn("setTemplateValidity"),Dn=jn("synchronizeTemplate"),Un=jn("mergeBlocks"),Fn=jn("removeBlocks"),Wn=jn("removeBlock"),qn=jn("toggleBlockMode"),Kn=jn("startTyping"),Zn=jn("stopTyping"),$n=jn("enterFormattedText"),Qn=jn("exitFormattedText"),Yn=jn("insertDefaultBlock"),Xn=jn("updateBlockListSettings");function Jn(e,t){return"wp-autosave-block-editor-post-"+(t?"auto-draft":e)}function er(e,t){window.sessionStorage.removeItem(Jn(e,t))}var tr={LOCAL_AUTOSAVE_SET({postId:e,isPostNew:t,title:n,content:r,excerpt:o}){!function(e,t,n,r,o){window.sessionStorage.setItem(Jn(e,t),JSON.stringify({post_title:n,content:r,excerpt:o}))}(e,t,n,r,o)}};const nr={reducer:S,selectors:r,actions:o,controls:{...g.controls,...tr}},rr=Object(h.createReduxStore)(C,{...nr,persist:["preferences"]});Object(h.registerStore)(C,{...nr,persist:["preferences"]});class or extends l.Component{constructor(e){super(e),this.needsAutosave=!(!e.isDirty||!e.isAutosaveable)}componentDidMount(){this.props.disableIntervalChecks||this.setAutosaveTimer()}componentDidUpdate(e){this.props.disableIntervalChecks?this.props.editsReference!==e.editsReference&&this.props.autosave():this.props.isDirty&&(!this.props.isAutosaving||e.isAutosaving)?this.props.editsReference!==e.editsReference&&(this.needsAutosave=!0):this.needsAutosave=!1}componentWillUnmount(){clearTimeout(this.timerId)}setAutosaveTimer(e=1e3*this.props.interval){this.timerId=setTimeout(()=>{this.autosaveTimerHandler()},e)}autosaveTimerHandler(){this.props.isAutosaveable?(this.needsAutosave&&(this.needsAutosave=!1,this.props.autosave()),this.setAutosaveTimer()):this.setAutosaveTimer(1e3)}render(){return null}}var cr=Object(m.compose)([Object(h.withSelect)((e,t)=>{const{getReferenceByDistinctEdits:n}=e("core"),{isEditedPostDirty:r,isEditedPostAutosaveable:o,isAutosavingPost:c,getEditorSettings:s}=e("core/editor"),{interval:i=s().autosaveInterval}=t;return{editsReference:n(),isDirty:r(),isAutosaveable:o(),isAutosaving:c(),interval:i}}),Object(h.withDispatch)((e,t)=>({autosave(){const{autosave:n=e("core/editor").autosave}=t;n()}}))])(or),sr=n(9),ir=n.n(sr);var ar=({children:e,isValid:t,level:n,href:r,onSelect:o})=>Object(l.createElement)("li",{className:ir()("document-outline__item","is-"+n.toLowerCase(),{"is-invalid":!t})},Object(l.createElement)("a",{href:r,className:"document-outline__button",onClick:o},Object(l.createElement)("span",{className:"document-outline__emdash","aria-hidden":"true"}),Object(l.createElement)("strong",{className:"document-outline__level"},n),Object(l.createElement)("span",{className:"document-outline__item-content"},e)));const lr=Object(l.createElement)("em",null,Object(Zt.__)("(Empty heading)")),ur=[Object(l.createElement)("br",{key:"incorrect-break"}),Object(l.createElement)("em",{key:"incorrect-message"},Object(Zt.__)("(Incorrect heading level)"))],dr=[Object(l.createElement)("br",{key:"incorrect-break-h1"}),Object(l.createElement)("em",{key:"incorrect-message-h1"},Object(Zt.__)("(Your theme may already use a H1 for the post title)"))],hr=[Object(l.createElement)("br",{key:"incorrect-break-multiple-h1"}),Object(l.createElement)("em",{key:"incorrect-message-multiple-h1"},Object(Zt.__)("(Multiple H1 headings are not recommended)"))],mr=(e=[])=>Object(u.flatMap)(e,(e={})=>"core/heading"===e.name?{...e,level:e.attributes.level,isEmpty:pr(e)}:mr(e.innerBlocks)),pr=e=>!e.attributes.content||0===e.attributes.content.length;var vr=Object(m.compose)(Object(h.withSelect)(e=>{const{getBlocks:t}=e(c.store),{getEditedPostAttribute:n}=e("core/editor"),{getPostType:r}=e("core"),o=r(n("type"));return{title:n("title"),blocks:t(),isTitleSupported:Object(u.get)(o,["supports","title"],!1)}}))(({blocks:e=[],title:t,onSelect:n,isTitleSupported:r,hasOutlineItemsDisabled:o})=>{const c=mr(e);if(c.length<1)return null;let s=1;const a=document.querySelector(".editor-post-title__input"),d=r&&t&&a,h=Object(u.countBy)(c,"level")[1]>1;return Object(l.createElement)("div",{className:"document-outline"},Object(l.createElement)("ul",null,d&&Object(l.createElement)(ar,{level:Object(Zt.__)("Title"),isValid:!0,onSelect:n,href:"#"+a.id,isDisabled:o},t),c.map((e,t)=>{const r=e.level>s+1,c=!(e.isEmpty||r||!e.level||1===e.level&&(h||d));return s=e.level,Object(l.createElement)(ar,{key:t,level:"H"+e.level,isValid:c,isDisabled:o,href:"#block-"+e.clientId,onSelect:n},e.isEmpty?lr:Object(i.getTextContent)(Object(i.create)({html:e.attributes.content})),r&&ur,1===e.level&&h&&hr,d&&1===e.level&&!h&&dr)})))});var br=Object(h.withSelect)(e=>({blocks:e(c.store).getBlocks()}))((function({blocks:e,children:t}){return Object(u.filter)(e,e=>"core/heading"===e.name).length<1?null:t})),wr=n(31);var fr=function({resetBlocksOnSave:e}){const{resetEditorBlocks:t,savePost:n}=Object(h.useDispatch)("core/editor"),{isEditedPostDirty:r,getPostEdits:o}=Object(h.useSelect)(e=>{const{isEditedPostDirty:t,getPostEdits:n}=e("core/editor");return{isEditedPostDirty:t,getPostEdits:n}},[]);return Object(wr.useShortcut)("core/editor/save",c=>{if(c.preventDefault(),r()){if(e){const e=o();if(e.content&&"string"==typeof e.content){const n=Object(d.parse)(e.content);t(n)}}n()}},{bindGlobal:!0}),null};var gr=function(){const{redo:e,undo:t}=Object(h.useDispatch)("core/editor");return Object(wr.useShortcut)("core/editor/undo",e=>{t(),e.preventDefault()},{bindGlobal:!0}),Object(wr.useShortcut)("core/editor/redo",t=>{e(),t.preventDefault()},{bindGlobal:!0}),Object(l.createElement)(l.Fragment,null,Object(l.createElement)(c.BlockEditorKeyboardShortcuts,null),Object(l.createElement)(fr,null))};function Or(){return Object(l.createElement)(fr,{resetBlocksOnSave:!0})}var jr=function(){const{registerShortcut:e}=Object(h.useDispatch)(wr.store);return Object(l.useEffect)(()=>{e({name:"core/editor/save",category:"global",description:Object(Zt.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/editor/undo",category:"global",description:Object(Zt.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/editor/redo",category:"global",description:Object(Zt.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"}})},[e]),Object(l.createElement)(c.BlockEditorKeyboardShortcuts.Register,null)},Er=n(4),Sr=n(12),_r=n(388),yr=n(389);var Pr=Object(l.forwardRef)((function(e,t){const n=Object(h.useSelect)(e=>e(rr).hasEditorRedo(),[]),{redo:r}=Object(h.useDispatch)(rr);return Object(l.createElement)(Er.Button,Object(a.a)({},e,{ref:t,icon:Object(Zt.isRTL)()?yr.a:_r.a,label:Object(Zt.__)("Redo"),shortcut:Sr.displayShortcut.primaryShift("z"),"aria-disabled":!n,onClick:n?r:void 0,className:"editor-history__redo"}))}));var xr=Object(l.forwardRef)((function(e,t){const n=Object(h.useSelect)(e=>e(rr).hasEditorUndo(),[]),{undo:r}=Object(h.useDispatch)(rr);return Object(l.createElement)(Er.Button,Object(a.a)({},e,{ref:t,icon:Object(Zt.isRTL)()?_r.a:yr.a,label:Object(Zt.__)("Undo"),shortcut:Sr.displayShortcut.primary("z"),"aria-disabled":!n,onClick:n?r:void 0,className:"editor-history__undo"}))}));var Vr=Object(m.compose)([Object(h.withSelect)(e=>({isValid:e(c.store).isValidTemplate()})),Object(h.withDispatch)(e=>{const{setTemplateValidity:t,synchronizeTemplate:n}=e(c.store);return{resetTemplateValidity:()=>t(!0),synchronizeTemplate:n}})])((function({isValid:e,...t}){return e?null:Object(l.createElement)(Er.Notice,{className:"editor-template-validation-notice",isDismissible:!1,status:"warning",actions:[{label:Object(Zt.__)("Keep it as is"),onClick:t.resetTemplateValidity},{label:Object(Zt.__)("Reset the template"),onClick:()=>{window.confirm(Object(Zt.__)("Resetting the template may result in loss of content, do you want to continue?"))&&t.synchronizeTemplate()}}]},Object(Zt.__)("The content of your post doesn’t match the template assigned to your post type."))}));var zr=Object(m.compose)([Object(h.withSelect)(e=>({notices:e(Kt.store).getNotices()})),Object(h.withDispatch)(e=>({onRemove:e(Kt.store).removeNotice}))])((function({notices:e,onRemove:t}){const n=Object(u.filter)(e,{isDismissible:!0,type:"default"}),r=Object(u.filter)(e,{isDismissible:!1,type:"default"}),o=Object(u.filter)(e,{type:"snackbar"});return Object(l.createElement)(l.Fragment,null,Object(l.createElement)(Er.NoticeList,{notices:r,className:"components-editor-notices__pinned"}),Object(l.createElement)(Er.NoticeList,{notices:n,className:"components-editor-notices__dismissible",onRemove:t},Object(l.createElement)(Vr,null)),Object(l.createElement)(Er.SnackbarList,{notices:o,className:"components-editor-notices__snackbar",onRemove:t}))})),kr=n(124),Cr=n(387);function Hr({record:e,checked:t,onChange:n,closePanel:r}){const{name:o,kind:s,title:i,key:a}=e,u=Object(h.useSelect)(e=>{var t;const{blocks:n=[]}=e("core").getEditedEntityRecord(s,o,a),r=e(c.store).getBlockParents(null===(t=n[0])||void 0===t?void 0:t.clientId);return r[r.length-1]},[]),d=Object(h.useSelect)(e=>{if("postType"!==s||"wp_template"!==o)return i;const t=e("core").getEditedEntityRecord(s,o,a);return e("core/editor").__experimentalGetTemplateInfo(t).title},[o,s,i,a]),m=Object(h.useSelect)(e=>e(c.store).getSelectedBlockClientId()===u,[u]),p=m?Object(Zt.__)("Selected"):Object(Zt.__)("Select"),{selectBlock:v}=Object(h.useDispatch)(c.store),b=Object(l.useCallback)(()=>v(u),[u]),w=Object(l.useCallback)(()=>{v(u),r()},[u]);return Object(l.createElement)(Er.PanelRow,null,Object(l.createElement)(Er.CheckboxControl,{label:Object(l.createElement)("strong",null,d||Object(Zt.__)("Untitled")),checked:t,onChange:n}),u?Object(l.createElement)(l.Fragment,null,Object(l.createElement)(Er.Button,{onClick:b,className:"entities-saved-states__find-entity",disabled:m},p),Object(l.createElement)(Er.Button,{onClick:w,className:"entities-saved-states__find-entity-small",disabled:m},p)):null)}const Tr={site:z.a,page:Cr.a};function Br({list:e,unselectedEntities:t,setUnselectedEntities:n,closePanel:r}){const o=e[0],c=Object(h.useSelect)(e=>e(s.store).getEntity(o.kind,o.name),[o.kind,o.name]),{name:i}=o,a=Tr[i];return Object(l.createElement)(Er.PanelBody,{title:c.label,initialOpen:!0,icon:a},e.map(e=>Object(l.createElement)(Hr,{key:e.key||e.property,record:e,checked:!Object(u.some)(t,t=>t.kind===e.kind&&t.name===e.name&&t.key===e.key&&t.property===e.property),onChange:t=>n(e,t),closePanel:r})))}const Mr={title:Object(Zt.__)("Title"),description:Object(Zt.__)("Tagline"),site_logo:Object(Zt.__)("Logo"),show_on_front:Object(Zt.__)("Show on front"),page_on_front:Object(Zt.__)("Page on front")};function Lr({close:e}){const t=Object(l.useRef)(),{dirtyEntityRecords:n}=Object(h.useSelect)(e=>{const t=e(s.store).__experimentalGetDirtyEntityRecords().filter(e=>!("root"===e.kind&&"site"===e.name)),n=e(s.store).getEntityRecordEdits("root","site"),r=[];for(const e in n)r.push({kind:"root",name:"site",title:Mr[e]||e,property:e});return{dirtyEntityRecords:[...t,...r]}},[]),{saveEditedEntityRecord:r,__experimentalSaveSpecifiedEntityEdits:o}=Object(h.useDispatch)(s.store),c=Object.values(Object(u.groupBy)(n,"name")),[i,d]=Object(l.useState)([]),p=({kind:e,name:t,key:n,property:r},o)=>{d(o?i.filter(o=>o.kind!==e||o.name!==t||o.key!==n||o.property!==r):[...i,{kind:e,name:t,key:n,property:r}])},v=Object(l.useCallback)(()=>e(),[e]),[b,w]=Object(m.__experimentalUseDialog)({onClose:()=>v()});return Object(l.createElement)("div",Object(a.a)({ref:b},w,{className:"entities-saved-states__panel"}),Object(l.createElement)("div",{className:"entities-saved-states__panel-header"},Object(l.createElement)(Er.Button,{ref:t,isPrimary:!0,disabled:n.length-i.length==0,onClick:()=>{const t=n.filter(({kind:e,name:t,key:n,property:r})=>!Object(u.some)(i,o=>o.kind===e&&o.name===t&&o.key===n&&o.property===r));e(t);const c=[];t.forEach(({kind:e,name:t,key:n,property:o})=>{"root"===e&&"site"===t?c.push(o):r(e,t,n)}),o("root","site",void 0,c)},className:"editor-entities-saved-states__save-button"},Object(Zt.__)("Save")),Object(l.createElement)(Er.Button,{icon:kr.a,onClick:v,label:Object(Zt.__)("Close panel")})),Object(l.createElement)("div",{className:"entities-saved-states__text-prompt"},Object(l.createElement)("strong",null,Object(Zt.__)("Select the changes you want to save")),Object(l.createElement)("p",null,Object(Zt.__)("Some changes may affect other areas of your site."))),c.map(e=>Object(l.createElement)(Br,{key:e[0].name,list:e,closePanel:v,unselectedEntities:i,setUnselectedEntities:p})))}function Ar({text:e,children:t}){const n=Object(m.useCopyToClipboard)(e);return Object(l.createElement)(Er.Button,{isSecondary:!0,ref:n},t)}class Rr extends l.Component{constructor(){super(...arguments),this.reboot=this.reboot.bind(this),this.getContent=this.getContent.bind(this),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}reboot(){this.props.onError()}getContent(){try{return Object(h.select)("core/editor").getEditedPostContent()}catch(e){}}render(){const{error:e}=this.state;return e?Object(l.createElement)(c.Warning,{className:"editor-error-boundary",actions:[Object(l.createElement)(Er.Button,{key:"recovery",onClick:this.reboot,isSecondary:!0},Object(Zt.__)("Attempt Recovery")),Object(l.createElement)(Ar,{key:"copy-post",text:this.getContent},Object(Zt.__)("Copy Post Text")),Object(l.createElement)(Ar,{key:"copy-error",text:e.stack},Object(Zt.__)("Copy Error"))]},Object(Zt.__)("The editor has encountered an unexpected error.")):this.props.children}}var Ir=Rr;const Nr=window.requestIdleCallback?window.requestIdleCallback:window.requestAnimationFrame,Gr=Object(u.once)(()=>{try{return window.sessionStorage.setItem("__wpEditorTestSessionStorage",""),window.sessionStorage.removeItem("__wpEditorTestSessionStorage"),!0}catch(e){return!1}});function Dr(){const{postId:e,isEditedPostNew:t,hasRemoteAutosave:n}=Object(h.useSelect)(e=>({postId:e("core/editor").getCurrentPostId(),isEditedPostNew:e("core/editor").isEditedPostNew(),getEditedPostAttribute:e("core/editor").getEditedPostAttribute,hasRemoteAutosave:!!e("core/editor").getEditorSettings().autosave}),[]),{getEditedPostAttribute:r}=Object(h.useSelect)("core/editor"),{createWarningNotice:o,removeNotice:c}=Object(h.useDispatch)(Kt.store),{editPost:s,resetEditorBlocks:i}=Object(h.useDispatch)("core/editor");Object(l.useEffect)(()=>{let a=function(e,t){return window.sessionStorage.getItem(Jn(e,t))}(e,t);if(!a)return;try{a=JSON.parse(a)}catch(e){return}const{post_title:l,content:h,excerpt:m}=a,p={title:l,content:h,excerpt:m};if(!Object.keys(p).some(e=>p[e]!==r(e)))return void er(e,t);if(n)return;const v=Object(u.uniqueId)("wpEditorAutosaveRestore");o(Object(Zt.__)("The backup of this post in your browser is different from the version below."),{id:v,actions:[{label:Object(Zt.__)("Restore the backup"),onClick(){s(Object(u.omit)(p,["content"])),i(Object(d.parse)(p.content)),c(v)}}]})},[t,e])}var Ur=Object(m.ifCondition)(Gr)((function(){const{autosave:e}=Object(h.useDispatch)("core/editor"),t=Object(l.useCallback)(()=>{Nr(()=>e({local:!0}))},[]);Dr(),function(){const{postId:e,isEditedPostNew:t,isDirty:n,isAutosaving:r,didError:o}=Object(h.useSelect)(e=>({postId:e("core/editor").getCurrentPostId(),isEditedPostNew:e("core/editor").isEditedPostNew(),isDirty:e("core/editor").isEditedPostDirty(),isAutosaving:e("core/editor").isAutosavingPost(),didError:e("core/editor").didPostSaveRequestFail()}),[]),c=Object(l.useRef)(n),s=Object(l.useRef)(r);Object(l.useEffect)(()=>{!o&&(s.current&&!r||c.current&&!n)&&er(e,t),c.current=n,s.current=r},[n,r,o]);const i=Object(m.usePrevious)(t),a=Object(m.usePrevious)(e);Object(l.useEffect)(()=>{a===e&&i&&!t&&er(e,!0)},[t,e])}();const{localAutosaveInterval:n}=Object(h.useSelect)(e=>({localAutosaveInterval:e("core/editor").getEditorSettings().__experimentalLocalAutosaveInterval}),[]);return Object(l.createElement)(cr,{interval:n,autosave:t})}));var Fr=function({children:e}){const t=Object(h.useSelect)(e=>{const{getEditedPostAttribute:t}=e(rr),{getPostType:n}=e(s.store);return n(t("type"))},[]);return Object(u.get)(t,["supports","page-attributes"],!1)?e:null};var Wr=Object(h.withSelect)(e=>{const{getEditedPostAttribute:t}=e("core/editor"),{getPostType:n}=e("core");return{postType:n(t("type"))}})((function({postType:e,children:t,supportKeys:n}){let r=!0;return e&&(r=Object(u.some)(Object(u.castArray)(n),t=>!!e.supports[t])),r?t:null}));const qr=Object(m.withState)({orderInput:null})(({onUpdateOrder:e,order:t=0,orderInput:n,setState:r})=>{const o=null===n?t:n;return Object(l.createElement)(Er.TextControl,{className:"editor-page-attributes__order",type:"number",label:Object(Zt.__)("Order"),value:o,onChange:t=>{r({orderInput:t});const n=Number(t);Number.isInteger(n)&&""!==Object(u.invoke)(t,["trim"])&&e(Number(t))},size:6,onBlur:()=>{r({orderInput:null})}})});var Kr=Object(m.compose)([Object(h.withSelect)(e=>({order:e("core/editor").getEditedPostAttribute("menu_order")})),Object(h.withDispatch)(e=>({onUpdateOrder(t){e("core/editor").editPost({menu_order:t})}}))])((function(e){return Object(l.createElement)(Wr,{supportKeys:"page-attributes"},Object(l.createElement)(qr,e))})),Zr=n(41);function $r(e){const t=e.map(e=>({children:[],parent:null,...e})),n=Object(u.groupBy)(t,"parent");if(n.null&&n.null.length)return t;const r=e=>e.map(e=>{const t=n[e.id];return{...e,children:t&&t.length?r(t):[]}});return r(n[0]||[])}const Qr=e=>Object(u.unescape)(e.replace("'","'")),Yr=e=>({...e,name:Qr(e.name)}),Xr=e=>Object(u.map)(e,Yr);function Jr(e){var t;return null!=e&&null!==(t=e.title)&&void 0!==t&&t.rendered?Object(Zr.decodeEntities)(e.title.rendered):`#${e.id} (${Object(Zt.__)("no title")})`}const eo=(e,t)=>{const n=Object(u.deburr)(e).toLowerCase(),r=Object(u.deburr)(t).toLowerCase();return n===r?0:n.startsWith(r)?n.length:1/0};var to=function(){const{editPost:e}=Object(h.useDispatch)("core/editor"),[t,n]=Object(l.useState)(!1),{parentPost:r,parentPostId:o,items:c,postType:s}=Object(h.useSelect)(e=>{const{getPostType:n,getEntityRecords:r,getEntityRecord:o}=e("core"),{getCurrentPostId:c,getEditedPostAttribute:s}=e("core/editor"),i=s("type"),a=s("parent"),l=n(i),d=c(),h=Object(u.get)(l,["hierarchical"],!1),m={per_page:100,exclude:d,parent_exclude:d,orderby:"menu_order",order:"asc",_fields:"id,title,parent"};return t&&(m.search=t),{parentPostId:a,parentPost:a?o("postType",i,a):null,items:h?r("postType",i,m):[],postType:l}},[t]),i=Object(u.get)(s,["hierarchical"],!1),a=Object(u.get)(s,["labels","parent_item_colon"]),d=c||[],m=Object(l.useMemo)(()=>{const e=(n,r=0)=>{const o=n.map(t=>[{value:t.id,label:Object(u.repeat)("— ",r)+Object(u.unescape)(t.name),rawName:t.name},...e(t.children||[],r+1)]).sort(([e],[n])=>eo(e.rawName,t)>=eo(n.rawName,t)?1:-1);return Object(u.flatten)(o)};let n=d.map(e=>({id:e.id,parent:e.parent,name:Jr(e)}));t||(n=$r(n));const c=e(n),s=Object(u.find)(c,e=>e.value===o);return r&&!s&&c.unshift({value:o,label:Jr(r)}),c},[d,t]);return i&&a?Object(l.createElement)(Er.ComboboxControl,{className:"editor-page-attributes__parent",label:a,value:o,options:m,onFilterValueChange:Object(u.debounce)(e=>{n(e)},300),onChange:t=>{e({parent:t})}}):null};var no=function({}){const{availableTemplates:e,selectedTemplate:t,isViewable:n}=Object(h.useSelect)(e=>{var t,n;const{getEditedPostAttribute:r,getEditorSettings:o,getCurrentPostType:c}=e(rr),{getPostType:i}=e(s.store);return{selectedTemplate:r("template"),availableTemplates:o().availableTemplates,isViewable:null!==(t=null===(n=i(c()))||void 0===n?void 0:n.viewable)&&void 0!==t&&t}},[]),{editPost:r}=Object(h.useDispatch)(rr);return!n||Object(u.isEmpty)(e)?null:Object(l.createElement)(Er.SelectControl,{label:Object(Zt.__)("Template:"),value:t,onChange:e=>{r({template:e||""})},options:Object(u.map)(e,(e,t)=>({value:t,label:e}))})};var ro=function(){const[e,t]=Object(l.useState)(),{authorId:n,isLoading:r,authors:o,postAuthor:c}=Object(h.useSelect)(t=>{const{__unstableGetAuthor:n,getAuthors:r,isResolving:o}=t("core"),{getEditedPostAttribute:c}=t("core/editor"),s=n(c("author")),i=e&&""!==e?{search:e}:{};return{authorId:c("author"),postAuthor:s,authors:r(i),isLoading:o("core","getAuthors",[i])}},[e]),{editPost:s}=Object(h.useDispatch)("core/editor"),i=Object(l.useMemo)(()=>{const e=(null!=o?o:[]).map(e=>({value:e.id,label:e.name}));return e.findIndex(({value:e})=>(null==c?void 0:c.id)===e)<0&&c?[{value:c.id,label:c.name},...e]:e},[o,c]);return Object(l.useEffect)(()=>{c&&t(c.name)},[c]),c?Object(l.createElement)(Er.ComboboxControl,{label:Object(Zt.__)("Author"),options:i,value:n,onFilterValueChange:Object(u.debounce)(e=>{t(e)},300),onChange:e=>{e&&s({author:e})},isLoading:r,allowReset:!1}):null};var oo=function(){const{editPost:e}=Object(h.useDispatch)("core/editor"),{postAuthor:t,authors:n}=Object(h.useSelect)(e=>{const t=e("core").getAuthors();return{postAuthor:e("core/editor").getEditedPostAttribute("author"),authors:t.map(e=>({label:Object(Zr.decodeEntities)(e.name),value:e.id}))}},[]);return Object(l.createElement)(Er.SelectControl,{className:"post-author-selector",label:Object(Zt.__)("Author"),options:n,onChange:t=>{const n=Number(t);e({author:n})},value:t})};var co=function(){return Object(h.useSelect)(e=>{const t=e(s.store).getAuthors();return(null==t?void 0:t.length)>=25},[])?Object(l.createElement)(ro,null):Object(l.createElement)(oo,null)};var so=Object(m.compose)([Object(h.withSelect)(e=>{const t=e("core/editor").getCurrentPost();return{hasAssignAuthorAction:Object(u.get)(t,["_links","wp:action-assign-author"],!1),postType:e("core/editor").getCurrentPostType(),authors:e("core").getAuthors()}}),m.withInstanceId])((function({hasAssignAuthorAction:e,authors:t,children:n}){return!e||!t||1>=t.length?null:Object(l.createElement)(Wr,{supportKeys:"author"},n)}));var io=Object(m.compose)([Object(h.withSelect)(e=>({commentStatus:e("core/editor").getEditedPostAttribute("comment_status")})),Object(h.withDispatch)(e=>({editPost:e("core/editor").editPost}))])((function({commentStatus:e="open",...t}){return Object(l.createElement)(Er.CheckboxControl,{label:Object(Zt.__)("Allow comments"),checked:"open"===e,onChange:()=>t.editPost({comment_status:"open"===e?"closed":"open"})})}));var ao=Object(m.compose)([Object(h.withSelect)(e=>({excerpt:e("core/editor").getEditedPostAttribute("excerpt")})),Object(h.withDispatch)(e=>({onUpdateExcerpt(t){e("core/editor").editPost({excerpt:t})}}))])((function({excerpt:e,onUpdateExcerpt:t}){return Object(l.createElement)("div",{className:"editor-post-excerpt"},Object(l.createElement)(Er.TextareaControl,{label:Object(Zt.__)("Write an excerpt (optional)"),className:"editor-post-excerpt__textarea",onChange:e=>t(e),value:e}),Object(l.createElement)(Er.ExternalLink,{href:Object(Zt.__)("https://wordpress.org/support/article/excerpt/")},Object(Zt.__)("Learn more about manual excerpts")))}));var lo=function(e){return Object(l.createElement)(Wr,Object(a.a)({},e,{supportKeys:"excerpt"}))};var uo=Object(h.withSelect)(e=>{const{getThemeSupports:t}=e("core"),{getEditedPostAttribute:n}=e("core/editor");return{postType:n("type"),themeSupports:t()}})((function({themeSupports:e,children:t,postType:n,supportKeys:r}){return Object(u.some)(Object(u.castArray)(r),t=>{const r=Object(u.get)(e,[t],!1);return"post-thumbnails"===t&&Object(u.isArray)(r)?Object(u.includes)(r,n):r})?t:null}));var ho=function(e){return Object(l.createElement)(uo,{supportKeys:"post-thumbnails"},Object(l.createElement)(Wr,Object(a.a)({},e,{supportKeys:"thumbnail"})))};const mo=["image"],po=Object(Zt.__)("Featured image"),vo=Object(Zt.__)("Set featured image"),bo=Object(Zt.__)("Remove image");const wo=Object(h.withSelect)(e=>{const{getMedia:t,getPostType:n}=e("core"),{getCurrentPostId:r,getEditedPostAttribute:o}=e("core/editor"),c=o("featured_media");return{media:c?t(c):null,currentPostId:r(),postType:n(o("type")),featuredImageId:c}}),fo=Object(h.withDispatch)((e,{noticeOperations:t},{select:n})=>{const{editPost:r}=e("core/editor");return{onUpdateImage(e){r({featured_media:e.id})},onDropImage(e){n(c.store).getSettings().mediaUpload({allowedTypes:["image"],filesList:e,onFileChange([e]){r({featured_media:e.id})},onError(e){t.removeAllNotices(),t.createErrorNotice(e)}})},onRemoveImage(){r({featured_media:0})}}});var go=Object(m.compose)(Er.withNotices,wo,fo,Object(Er.withFilters)("editor.PostFeaturedImage"))((function({currentPostId:e,featuredImageId:t,onUpdateImage:n,onDropImage:r,onRemoveImage:o,media:s,postType:i,noticeUI:a}){var d,h;const m=Object(u.get)(i,["labels"],{}),v=Object(l.createElement)("p",null,Object(Zt.__)("To edit the featured image, you need permission to upload media."));let b,w,f;if(s){const t=Object(p.applyFilters)("editor.PostFeaturedImage.imageSize","post-thumbnail",s.id,e);if(Object(u.has)(s,["media_details","sizes",t]))b=s.media_details.sizes[t].width,w=s.media_details.sizes[t].height,f=s.media_details.sizes[t].source_url;else{const t=Object(p.applyFilters)("editor.PostFeaturedImage.imageSize","thumbnail",s.id,e);Object(u.has)(s,["media_details","sizes",t])?(b=s.media_details.sizes[t].width,w=s.media_details.sizes[t].height,f=s.media_details.sizes[t].source_url):(b=s.media_details.width,w=s.media_details.height,f=s.source_url)}}return Object(l.createElement)(ho,null,a,Object(l.createElement)("div",{className:"editor-post-featured-image"},s&&Object(l.createElement)("div",{id:`editor-post-featured-image-${t}-describedby`,className:"hidden"},s.alt_text&&Object(Zt.sprintf)(Object(Zt.__)("Current image: %s"),s.alt_text),!s.alt_text&&Object(Zt.sprintf)(Object(Zt.__)("The current image has no alternative text. The file name is: %s"),(null===(d=s.media_details.sizes)||void 0===d||null===(h=d.full)||void 0===h?void 0:h.file)||s.slug)),Object(l.createElement)(c.MediaUploadCheck,{fallback:v},Object(l.createElement)(c.MediaUpload,{title:m.featured_image||po,onSelect:n,unstableFeaturedImageFlow:!0,allowedTypes:mo,modalClass:"editor-post-featured-image__media-modal",render:({open:e})=>Object(l.createElement)("div",{className:"editor-post-featured-image__container"},Object(l.createElement)(Er.Button,{className:t?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:e,"aria-label":t?Object(Zt.__)("Edit or update the image"):null,"aria-describedby":t?`editor-post-featured-image-${t}-describedby`:null},!!t&&s&&Object(l.createElement)(Er.ResponsiveWrapper,{naturalWidth:b,naturalHeight:w,isInline:!0},Object(l.createElement)("img",{src:f,alt:""})),!!t&&!s&&Object(l.createElement)(Er.Spinner,null),!t&&(m.set_featured_image||vo)),Object(l.createElement)(Er.DropZone,{onFilesDrop:r})),value:t})),!!t&&s&&!s.isLoading&&Object(l.createElement)(c.MediaUploadCheck,null,Object(l.createElement)(c.MediaUpload,{title:m.featured_image||po,onSelect:n,unstableFeaturedImageFlow:!0,allowedTypes:mo,modalClass:"editor-post-featured-image__media-modal",render:({open:e})=>Object(l.createElement)(Er.Button,{onClick:e,isSecondary:!0},Object(Zt.__)("Replace Image"))})),!!t&&Object(l.createElement)(c.MediaUploadCheck,null,Object(l.createElement)(Er.Button,{onClick:o,isLink:!0,isDestructive:!0},m.remove_featured_image||bo))))}));var Oo=Object(h.withSelect)(e=>({disablePostFormats:e("core/editor").getEditorSettings().disablePostFormats}))((function({disablePostFormats:e,...t}){return!e&&Object(l.createElement)(Wr,Object(a.a)({},t,{supportKeys:"post-formats"}))}));const jo=[{id:"aside",caption:Object(Zt.__)("Aside")},{id:"audio",caption:Object(Zt.__)("Audio")},{id:"chat",caption:Object(Zt.__)("Chat")},{id:"gallery",caption:Object(Zt.__)("Gallery")},{id:"image",caption:Object(Zt.__)("Image")},{id:"link",caption:Object(Zt.__)("Link")},{id:"quote",caption:Object(Zt.__)("Quote")},{id:"standard",caption:Object(Zt.__)("Standard")},{id:"status",caption:Object(Zt.__)("Status")},{id:"video",caption:Object(Zt.__)("Video")}].sort((e,t)=>{const n=e.caption.toUpperCase(),r=t.caption.toUpperCase();return nr?1:0});function Eo(){const e="post-format-selector-"+Object(m.useInstanceId)(Eo),{postFormat:t,suggestedFormat:n,supportedFormats:r}=Object(h.useSelect)(e=>{const{getEditedPostAttribute:t,getSuggestedPostFormat:n}=e("core/editor"),r=t("format"),o=e("core").getThemeSupports();return{postFormat:null!=r?r:"standard",suggestedFormat:n(),supportedFormats:Object(u.union)([r],Object(u.get)(o,["formats"],[]))}},[]),o=jo.filter(e=>Object(u.includes)(r,e.id)),c=Object(u.find)(o,e=>e.id===n),{editPost:s}=Object(h.useDispatch)("core/editor"),i=e=>s({format:e});return Object(l.createElement)(Oo,null,Object(l.createElement)("div",{className:"editor-post-format"},Object(l.createElement)("div",{className:"editor-post-format__content"},Object(l.createElement)("label",{htmlFor:e},Object(Zt.__)("Post Format")),Object(l.createElement)(Er.SelectControl,{value:t,onChange:e=>i(e),id:e,options:o.map(e=>({label:e.caption,value:e.id}))})),c&&c.id!==t&&Object(l.createElement)("div",{className:"editor-post-format__suggestion"},Object(Zt.__)("Suggestion:")," ",Object(l.createElement)(Er.Button,{isLink:!0,onClick:()=>i(c.id)},c.caption))))}var So=n(383);var _o=Object(h.withSelect)(e=>{const{getCurrentPostLastRevisionId:t,getCurrentPostRevisionsCount:n}=e("core/editor");return{lastRevisionId:t(),revisionsCount:n()}})((function({lastRevisionId:e,revisionsCount:t,children:n}){return!e||t<2?null:Object(l.createElement)(Wr,{supportKeys:"revisions"},n)}));var yo=Object(h.withSelect)(e=>{const{getCurrentPostLastRevisionId:t,getCurrentPostRevisionsCount:n}=e("core/editor");return{lastRevisionId:t(),revisionsCount:n()}})((function({lastRevisionId:e,revisionsCount:t}){return Object(l.createElement)(_o,null,Object(l.createElement)(Er.Button,{href:B("revision.php",{revision:e,gutenberg:!0}),className:"editor-post-last-revision__title",icon:So.a},Object(Zt.sprintf)(Object(Zt._n)("%d Revision","%d Revisions",t),t)))}));class Po extends l.Component{constructor(){super(...arguments),this.buttonRef=Object(l.createRef)(),this.openPreviewWindow=this.openPreviewWindow.bind(this)}componentDidUpdate(e){const{previewLink:t}=this.props;t&&!e.previewLink&&this.setPreviewWindowLink(t)}setPreviewWindowLink(e){const{previewWindow:t}=this;t&&!t.closed&&(t.location=e,this.buttonRef.current&&this.buttonRef.current.focus())}getWindowTarget(){const{postId:e}=this.props;return"wp-preview-"+e}openPreviewWindow(e){e.preventDefault(),this.previewWindow&&!this.previewWindow.closed||(this.previewWindow=window.open("",this.getWindowTarget())),this.previewWindow.focus(),this.props.isAutosaveable?(this.props.isDraft?this.props.savePost({isPreview:!0}):this.props.autosave({isPreview:!0}),function(e){let t=Object(l.renderToString)(Object(l.createElement)("div",{className:"editor-post-preview-button__interstitial-message"},Object(l.createElement)(Er.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96"},Object(l.createElement)(Er.Path,{className:"outer",d:"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",fill:"none"}),Object(l.createElement)(Er.Path,{className:"inner",d:"M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",fill:"none"})),Object(l.createElement)("p",null,Object(Zt.__)("Generating preview…"))));t+='\n\t\t\n\t',t=Object(p.applyFilters)("editor.PostPreview.interstitialMarkup",t),e.write(t),e.title=Object(Zt.__)("Generating preview…"),e.close()}(this.previewWindow.document)):this.setPreviewWindowLink(e.target.href)}render(){const{previewLink:e,currentPostLink:t,isSaveable:n,role:r}=this.props,o=e||t,c=ir()({"editor-post-preview":!this.props.className},this.props.className);return Object(l.createElement)(Er.Button,{isTertiary:!this.props.className,className:c,href:o,target:this.getWindowTarget(),disabled:!n,onClick:this.openPreviewWindow,ref:this.buttonRef,role:r},this.props.textContent?this.props.textContent:Object(l.createElement)(l.Fragment,null,Object(Zt._x)("Preview","imperative verb"),Object(l.createElement)(Er.VisuallyHidden,{as:"span"},Object(Zt.__)("(opens in a new tab)"))))}}var xo=Object(m.compose)([Object(h.withSelect)((e,{forcePreviewLink:t,forceIsAutosaveable:n})=>{const{getCurrentPostId:r,getCurrentPostAttribute:o,getEditedPostAttribute:c,isEditedPostSaveable:s,isEditedPostAutosaveable:i,getEditedPostPreviewLink:a}=e("core/editor"),{getPostType:l}=e("core"),d=a(),h=l(c("type"));return{postId:r(),currentPostLink:o("link"),previewLink:void 0!==t?t:d,isSaveable:s(),isAutosaveable:n||i(),isViewable:Object(u.get)(h,["viewable"],!1),isDraft:-1!==["draft","auto-draft"].indexOf(c("status"))}}),Object(h.withDispatch)(e=>({autosave:e("core/editor").autosave,savePost:e("core/editor").savePost})),Object(m.ifCondition)(({isViewable:e})=>e)])(Po);function Vo(){const e="core/editor/post-locked-modal-"+Object(m.useInstanceId)(Vo),{autosave:t,updatePostLock:n}=Object(h.useDispatch)("core/editor"),{isLocked:r,isTakeover:o,user:c,postId:s,postLockUtils:i,activePostLock:a,postType:d}=Object(h.useSelect)(e=>{const{isPostLocked:t,isPostLockTakeover:n,getPostLockUser:r,getCurrentPostId:o,getActivePostLock:c,getEditedPostAttribute:s,getEditorSettings:i}=e("core/editor"),{getPostType:a}=e("core");return{isLocked:t(),isTakeover:n(),user:r(),postId:o(),postLockUtils:i().postLockUtils,activePostLock:c(),postType:a(s("type"))}});if(Object(l.useEffect)(()=>{function o(){if(r||!a)return;const e=new window.FormData;if(e.append("action","wp-remove-post-lock"),e.append("_wpnonce",i.unlockNonce),e.append("post_ID",s),e.append("active_post_lock",a),window.navigator.sendBeacon)window.navigator.sendBeacon(i.ajaxUrl,e);else{const t=new window.XMLHttpRequest;t.open("POST",i.ajaxUrl,!1),t.send(e)}}return Object(p.addAction)("heartbeat.send",e,(function(e){r||(e["wp-refresh-post-lock"]={lock:a,post_id:s})})),Object(p.addAction)("heartbeat.tick",e,(function(e){if(!e["wp-refresh-post-lock"])return;const r=e["wp-refresh-post-lock"];r.lock_error?(t(),n({isLocked:!0,isTakeover:!0,user:{avatar:r.lock_error.avatar_src}})):r.new_lock&&n({isLocked:!1,activePostLock:r.new_lock})})),window.addEventListener("beforeunload",o),()=>{Object(p.removeAction)("heartbeat.send",e),Object(p.removeAction)("heartbeat.tick",e),window.removeEventListener("beforeunload",o)}},[]),!r)return null;const v=c.name,b=c.avatar,w=Object(P.addQueryArgs)("post.php",{"get-post-lock":"1",lockKey:!0,post:s,action:"edit",_wpnonce:i.nonce}),f=B("edit.php",{post_type:Object(u.get)(d,["slug"])}),g=Object(Zt.__)("Exit the Editor");return Object(l.createElement)(Er.Modal,{title:o?Object(Zt.__)("Someone else has taken over this post."):Object(Zt.__)("This post is already being edited."),focusOnMount:!0,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,isDismissible:!1,className:"editor-post-locked-modal"},!!b&&Object(l.createElement)("img",{src:b,alt:Object(Zt.__)("Avatar"),className:"editor-post-locked-modal__avatar"}),!!o&&Object(l.createElement)("div",null,Object(l.createElement)("div",null,v?Object(Zt.sprintf)(Object(Zt.__)("%s now has editing control of this post. Don’t worry, your changes up to this moment have been saved."),v):Object(Zt.__)("Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.")),Object(l.createElement)("div",{className:"editor-post-locked-modal__buttons"},Object(l.createElement)(Er.Button,{isPrimary:!0,href:f},g))),!o&&Object(l.createElement)("div",null,Object(l.createElement)("div",null,v?Object(Zt.sprintf)(Object(Zt.__)("%s is currently working on this post, which means you cannot make changes, unless you take over."),v):Object(Zt.__)("Another user is currently working on this post, which means you cannot make changes, unless you take over.")),Object(l.createElement)("div",{className:"editor-post-locked-modal__buttons"},Object(l.createElement)(Er.Button,{isSecondary:!0,href:f},g),Object(l.createElement)(xo,null),Object(l.createElement)(Er.Button,{isPrimary:!0,href:w},Object(Zt.__)("Take Over")))))}var zo=Object(m.compose)(Object(h.withSelect)(e=>{const{isCurrentPostPublished:t,getCurrentPostType:n,getCurrentPost:r}=e("core/editor");return{hasPublishAction:Object(u.get)(r(),["_links","wp:action-publish"],!1),isPublished:t(),postType:n()}}))((function({hasPublishAction:e,isPublished:t,children:n}){return t||!e?null:n}));var ko=Object(m.compose)(Object(h.withSelect)(e=>({status:e("core/editor").getEditedPostAttribute("status")})),Object(h.withDispatch)(e=>({onUpdateStatus(t){e("core/editor").editPost({status:t})}})))((function({status:e,onUpdateStatus:t}){return Object(l.createElement)(zo,null,Object(l.createElement)(Er.CheckboxControl,{label:Object(Zt.__)("Pending review"),checked:"pending"===e,onChange:()=>{t("pending"===e?"draft":"pending")}}))}));var Co=Object(m.compose)([Object(h.withSelect)(e=>({pingStatus:e("core/editor").getEditedPostAttribute("ping_status")})),Object(h.withDispatch)(e=>({editPost:e("core/editor").editPost}))])((function({pingStatus:e="open",...t}){return Object(l.createElement)(Er.CheckboxControl,{label:Object(Zt.__)("Allow pingbacks & trackbacks"),checked:"open"===e,onChange:()=>t.editPost({ping_status:"open"===e?"closed":"open"})})}));var Ho=Object(m.compose)([Object(h.withSelect)((e,{forceIsSaving:t})=>{const{isCurrentPostPublished:n,isEditedPostBeingScheduled:r,isSavingPost:o,isPublishingPost:c,getCurrentPost:s,getCurrentPostType:i,isAutosavingPost:a}=e("core/editor");return{isPublished:n(),isBeingScheduled:r(),isSaving:t||o(),isPublishing:c(),hasPublishAction:Object(u.get)(s(),["_links","wp:action-publish"],!1),postType:i(),isAutosaving:a()}})])((function({isPublished:e,isBeingScheduled:t,isSaving:n,isPublishing:r,hasPublishAction:o,isAutosaving:c,hasNonPostEntityChanges:s}){return r?Object(Zt.__)("Publishing…"):e&&n&&!c?Object(Zt.__)("Updating…"):t&&n&&!c?Object(Zt.__)("Scheduling…"):o?e?s?Object(Zt.__)("Update…"):Object(Zt.__)("Update"):t?s?Object(Zt.__)("Schedule…"):Object(Zt.__)("Schedule"):Object(Zt.__)("Publish"):s?Object(Zt.__)("Submit for Review…"):Object(Zt.__)("Submit for Review")}));class To extends l.Component{constructor(e){super(e),this.buttonNode=Object(l.createRef)(),this.createOnClick=this.createOnClick.bind(this),this.closeEntitiesSavedStates=this.closeEntitiesSavedStates.bind(this),this.state={entitiesSavedStatesCallback:!1}}componentDidMount(){this.props.focusOnMount&&this.buttonNode.current.focus()}createOnClick(e){return(...t)=>{const{hasNonPostEntityChanges:n}=this.props;return n?(this.setState({entitiesSavedStatesCallback:()=>e(...t)}),this.props.setEntitiesSavedStatesCallback(()=>this.closeEntitiesSavedStates),u.noop):e(...t)}}closeEntitiesSavedStates(e){const{postType:t,postId:n}=this.props,{entitiesSavedStatesCallback:r}=this.state;this.setState({entitiesSavedStatesCallback:!1},()=>{e&&Object(u.some)(e,e=>"postType"===e.kind&&e.name===t&&e.key===n)&&r()})}render(){const{forceIsDirty:e,forceIsSaving:t,hasPublishAction:n,isBeingScheduled:r,isOpen:o,isPostSavingLocked:c,isPublishable:s,isPublished:i,isSaveable:d,isSaving:h,isAutoSaving:m,isToggle:p,onSave:v,onStatusChange:b,onSubmit:w=u.noop,onToggle:f,visibility:g,hasNonPostEntityChanges:O}=this.props,j=h||t||!d||c||!s&&!e,E=i||h||t||!d||!s&&!e;let S;S=n?"private"===g?"private":r?"future":"publish":"pending";const _={"aria-disabled":j&&!O,className:"editor-post-publish-button",isBusy:!m&&h&&i,isPrimary:!0,onClick:this.createOnClick(()=>{j||(w(),b(S),v())})},y={"aria-disabled":E&&!O,"aria-expanded":o,className:"editor-post-publish-panel__toggle",isBusy:h&&i,isPrimary:!0,onClick:this.createOnClick(()=>{E||f()})},P=r?Object(Zt.__)("Schedule…"):Object(Zt.__)("Publish"),x=Object(l.createElement)(Ho,{forceIsSaving:t,hasNonPostEntityChanges:O}),V=p?y:_,z=p?P:x;return Object(l.createElement)(l.Fragment,null,Object(l.createElement)(Er.Button,Object(a.a)({ref:this.buttonNode},V,{className:ir()(V.className,"editor-post-publish-button__button",{"has-changes-dot":O})}),z))}}var Bo=Object(m.compose)([Object(h.withSelect)(e=>{const{isSavingPost:t,isAutosavingPost:n,isEditedPostBeingScheduled:r,getEditedPostVisibility:o,isCurrentPostPublished:c,isEditedPostSaveable:s,isEditedPostPublishable:i,isPostSavingLocked:a,getCurrentPost:l,getCurrentPostType:d,getCurrentPostId:h,hasNonPostEntityChanges:m}=e("core/editor"),p=n();return{isSaving:t()||p,isAutoSaving:p,isBeingScheduled:r(),visibility:o(),isSaveable:s(),isPostSavingLocked:a(),isPublishable:i(),isPublished:c(),hasPublishAction:Object(u.get)(l(),["_links","wp:action-publish"],!1),postType:d(),postId:h(),hasNonPostEntityChanges:m()}}),Object(h.withDispatch)(e=>{const{editPost:t,savePost:n}=e("core/editor");return{onStatusChange:e=>t({status:e},{undoIgnore:!0}),onSave:n}})])(To),Mo=n(122),Lo=n(318);const Ao=[{value:"public",label:Object(Zt.__)("Public"),info:Object(Zt.__)("Visible to everyone.")},{value:"private",label:Object(Zt.__)("Private"),info:Object(Zt.__)("Only visible to site admins and editors.")},{value:"password",label:Object(Zt.__)("Password Protected"),info:Object(Zt.__)("Protected with a password you choose. Only those with the password can view this post.")}];class Ro extends l.Component{constructor(e){super(...arguments),this.setPublic=this.setPublic.bind(this),this.setPrivate=this.setPrivate.bind(this),this.setPasswordProtected=this.setPasswordProtected.bind(this),this.updatePassword=this.updatePassword.bind(this),this.state={hasPassword:!!e.password}}setPublic(){const{visibility:e,onUpdateVisibility:t,status:n}=this.props;t("private"===e?"draft":n),this.setState({hasPassword:!1})}setPrivate(){if(!window.confirm(Object(Zt.__)("Would you like to privately publish this post now?")))return;const{onUpdateVisibility:e,onSave:t}=this.props;e("private"),this.setState({hasPassword:!1}),t()}setPasswordProtected(){const{visibility:e,onUpdateVisibility:t,status:n,password:r}=this.props;t("private"===e?"draft":n,r||""),this.setState({hasPassword:!0})}updatePassword(e){const{status:t,onUpdateVisibility:n}=this.props;n(t,e.target.value)}render(){const{visibility:e,password:t,instanceId:n}=this.props,r={public:{onSelect:this.setPublic,checked:"public"===e&&!this.state.hasPassword},private:{onSelect:this.setPrivate,checked:"private"===e},password:{onSelect:this.setPasswordProtected,checked:this.state.hasPassword}};return[Object(l.createElement)("fieldset",{key:"visibility-selector",className:"editor-post-visibility__dialog-fieldset"},Object(l.createElement)("legend",{className:"editor-post-visibility__dialog-legend"},Object(Zt.__)("Post Visibility")),Ao.map(({value:e,label:t,info:o})=>Object(l.createElement)("div",{key:e,className:"editor-post-visibility__choice"},Object(l.createElement)("input",{type:"radio",name:"editor-post-visibility__setting-"+n,value:e,onChange:r[e].onSelect,checked:r[e].checked,id:`editor-post-${e}-${n}`,"aria-describedby":`editor-post-${e}-${n}-description`,className:"editor-post-visibility__dialog-radio"}),Object(l.createElement)("label",{htmlFor:`editor-post-${e}-${n}`,className:"editor-post-visibility__dialog-label"},t),Object(l.createElement)("p",{id:`editor-post-${e}-${n}-description`,className:"editor-post-visibility__dialog-info"},o)))),this.state.hasPassword&&Object(l.createElement)("div",{className:"editor-post-visibility__dialog-password",key:"password-selector"},Object(l.createElement)(Er.VisuallyHidden,{as:"label",htmlFor:"editor-post-visibility__dialog-password-input-"+n},Object(Zt.__)("Create password")),Object(l.createElement)("input",{className:"editor-post-visibility__dialog-password-input",id:"editor-post-visibility__dialog-password-input-"+n,type:"text",onChange:this.updatePassword,value:t,placeholder:Object(Zt.__)("Use a secure password")}))]}}var Io=Object(m.compose)([Object(h.withSelect)(e=>{const{getEditedPostAttribute:t,getEditedPostVisibility:n}=e("core/editor");return{status:t("status"),visibility:n(),password:t("password")}}),Object(h.withDispatch)(e=>{const{savePost:t,editPost:n}=e("core/editor");return{onSave:t,onUpdateVisibility(e,t=""){n({status:e,password:t})}}}),m.withInstanceId])(Ro);var No=Object(h.withSelect)(e=>({visibility:e("core/editor").getEditedPostVisibility()}))((function({visibility:e}){return Object(u.find)(Ao,{value:e}).label}));function Go(e=new Date,t=!0){const n=new Date(e);return new Date(n.getFullYear(),n.getMonth()+(t?0:1),t?1:0).toISOString()}function Do(){const{postDate:e,postType:t}=Object(h.useSelect)(e=>({postDate:e(rr).getEditedPostAttribute("date"),postType:e(rr).getCurrentPostType()}),[]),{editPost:n}=Object(h.useDispatch)(rr),[r,o]=Object(l.useState)(Go(e)),c=Object(h.useSelect)(e=>e(s.store).getEntityRecords("postType",t,{status:"publish,future",after:Go(r),before:Go(r,!1),exclude:[e(rr).getCurrentPostId()]}),[r,t]),i=Object(l.useMemo)(()=>(c||[]).map(({title:e,type:t,date:n})=>({title:null==e?void 0:e.rendered,type:t,date:new Date(n)})),[c]),a=Object(l.useRef)(),u=Object(y.__experimentalGetSettings)(),d=/a(?!\\)/i.test(u.formats.time.toLowerCase().replace(/\\\\/g,"").split("").reverse().join(""));return Object(l.createElement)(Er.DateTimePicker,{ref:a,currentDate:e,onChange:function(e){n({date:e});const{ownerDocument:t}=a.current;t.activeElement.blur()},is12Hour:d,events:i,onMonthPreviewed:o})}var Uo=Object(h.withSelect)(e=>({date:e("core/editor").getEditedPostAttribute("date"),isFloating:e("core/editor").isEditedPostDateFloating()}))((function({date:e,isFloating:t}){const n=Object(y.__experimentalGetSettings)();return e&&!t?Object(y.format)(`${n.formats.date} ${n.formats.time}`,e):Object(Zt.__)("Immediately")}));const Fo={per_page:10,orderby:"count",order:"desc",_fields:"id,name,count"};function Wo({onSelect:e,taxonomy:t}){const{_terms:n,showTerms:r}=Object(h.useSelect)(e=>{const n=e(s.store).getEntityRecords("taxonomy",t.slug,Fo);return{_terms:n,showTerms:(null==n?void 0:n.length)>=10}},[]);if(!r)return null;const o=Xr(n),c=Object(u.get)(t,["labels","most_used"]);return Object(l.createElement)("div",{className:"editor-post-taxonomies__flat-term-most-used"},Object(l.createElement)("h3",{className:"editor-post-taxonomies__flat-term-most-used-label"},c),Object(l.createElement)("ul",{role:"list",className:"editor-post-taxonomies__flat-term-most-used-list"},o.map(t=>Object(l.createElement)("li",{key:t.id},Object(l.createElement)(Er.Button,{isLink:!0,onClick:()=>e(t)},t.name)))))}const qo={per_page:20,orderby:"count",order:"desc",_fields:"id,name,count"},Ko=(e,t)=>Qr(e).toLowerCase()===Qr(t).toLowerCase(),Zo=(e,t)=>e.map(e=>Object(u.find)(t,t=>Ko(t.name,e)).id);class $o extends l.Component{constructor(){super(...arguments),this.onChange=this.onChange.bind(this),this.searchTerms=Object(u.throttle)(this.searchTerms.bind(this),500),this.findOrCreateTerm=this.findOrCreateTerm.bind(this),this.appendTerm=this.appendTerm.bind(this),this.state={loading:!Object(u.isEmpty)(this.props.terms),availableTerms:[],selectedTerms:[]}}componentDidMount(){Object(u.isEmpty)(this.props.terms)||(this.initRequest=this.fetchTerms({include:this.props.terms.join(","),per_page:-1}),this.initRequest.then(()=>{this.setState({loading:!1})},e=>{"abort"!==e.statusText&&this.setState({loading:!1})}))}componentWillUnmount(){Object(u.invoke)(this.initRequest,["abort"]),Object(u.invoke)(this.searchRequest,["abort"])}componentDidUpdate(e){e.terms!==this.props.terms&&this.updateSelectedTerms(this.props.terms)}fetchTerms(e={}){const{taxonomy:t}=this.props,n={...qo,...e},r=w()({path:Object(P.addQueryArgs)("/wp/v2/"+t.rest_base,n)});return r.then(Xr).then(e=>{this.setState(t=>({availableTerms:t.availableTerms.concat(e.filter(e=>!Object(u.find)(t.availableTerms,t=>t.id===e.id)))})),this.updateSelectedTerms(this.props.terms)}),r}updateSelectedTerms(e=[]){const t=e.reduce((e,t)=>{const n=Object(u.find)(this.state.availableTerms,e=>e.id===t);return n&&e.push(n.name),e},[]);this.setState({selectedTerms:t})}findOrCreateTerm(e){const{taxonomy:t}=this.props,n=Object(u.escape)(e);return w()({path:"/wp/v2/"+t.rest_base,method:"POST",data:{name:n}}).catch(r=>"term_exists"===r.code?(this.addRequest=w()({path:Object(P.addQueryArgs)("/wp/v2/"+t.rest_base,{...qo,search:n})}).then(Xr),this.addRequest.then(t=>Object(u.find)(t,t=>Ko(t.name,e)))):Promise.reject(r)).then(Yr)}onChange(e){const t=Object(u.uniqBy)(e,e=>e.toLowerCase());this.setState({selectedTerms:t});const n=t.filter(e=>!Object(u.find)(this.state.availableTerms,t=>Ko(t.name,e)));if(0===n.length)return this.props.onUpdateTerms(Zo(t,this.state.availableTerms),this.props.taxonomy.rest_base);Promise.all(n.map(this.findOrCreateTerm)).then(e=>{const n=this.state.availableTerms.concat(e);return this.setState({availableTerms:n}),this.props.onUpdateTerms(Zo(t,n),this.props.taxonomy.rest_base)})}searchTerms(e=""){Object(u.invoke)(this.searchRequest,["abort"]),e.length>=3&&(this.searchRequest=this.fetchTerms({search:e}))}appendTerm(e){const{onUpdateTerms:t,taxonomy:n,terms:r=[],slug:o,speak:c}=this.props;if(r.includes(e.id))return;const s=[...r,e.id];c(Object(Zt.sprintf)(Object(Zt._x)("%s added","term"),Object(u.get)(n,["labels","singular_name"],"post_tag"===o?Object(Zt.__)("Tag"):Object(Zt.__)("Term"))),"assertive"),this.setState({availableTerms:[...this.state.availableTerms,e]}),t(s,n.rest_base)}render(){const{slug:e,taxonomy:t,hasAssignAction:n}=this.props;if(!n)return null;const{loading:r,availableTerms:o,selectedTerms:c}=this.state,s=o.map(e=>e.name),i=Object(u.get)(t,["labels","add_new_item"],"post_tag"===e?Object(Zt.__)("Add new tag"):Object(Zt.__)("Add new Term")),a=Object(u.get)(t,["labels","singular_name"],"post_tag"===e?Object(Zt.__)("Tag"):Object(Zt.__)("Term")),d=Object(Zt.sprintf)(Object(Zt._x)("%s added","term"),a),h=Object(Zt.sprintf)(Object(Zt._x)("%s removed","term"),a),m=Object(Zt.sprintf)(Object(Zt._x)("Remove %s","term"),a);return Object(l.createElement)(l.Fragment,null,Object(l.createElement)(Er.FormTokenField,{value:c,suggestions:s,onChange:this.onChange,onInputChange:this.searchTerms,maxSuggestions:20,disabled:r,label:i,messages:{added:d,removed:h,remove:m}}),Object(l.createElement)(Wo,{taxonomy:t,onSelect:this.appendTerm}))}}var Qo=Object(m.compose)(Object(h.withSelect)((e,{slug:t})=>{const{getCurrentPost:n}=e(rr),{getTaxonomy:r}=e(s.store),o=r(t);return{hasCreateAction:!!o&&Object(u.get)(n(),["_links","wp:action-create-"+o.rest_base],!1),hasAssignAction:!!o&&Object(u.get)(n(),["_links","wp:action-assign-"+o.rest_base],!1),terms:o?e(rr).getEditedPostAttribute(o.rest_base):[],taxonomy:o}}),Object(h.withDispatch)(e=>({onUpdateTerms(t,n){e(rr).editPost({[n]:t})}})),Er.withSpokenMessages,Object(Er.withFilters)("editor.PostTaxonomyType"))($o);const Yo=()=>{const e=[Object(Zt.__)("Suggestion:"),Object(l.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},Object(Zt.__)("Add tags"))];return Object(l.createElement)(Er.PanelBody,{initialOpen:!1,title:e},Object(l.createElement)("p",null,Object(Zt.__)("Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.")),Object(l.createElement)(Qo,{slug:"post_tag"}))};class Xo extends l.Component{constructor(e){super(e),this.state={hadTagsWhenOpeningThePanel:e.hasTags}}render(){return this.state.hadTagsWhenOpeningThePanel?null:Object(l.createElement)(Yo,null)}}var Jo=Object(m.compose)(Object(h.withSelect)(e=>{const t=e("core/editor").getCurrentPostType(),n=e("core").getTaxonomy("post_tag"),r=n&&e("core/editor").getEditedPostAttribute(n.rest_base);return{areTagsFetched:void 0!==n,isPostTypeSupported:n&&Object(u.some)(n.types,e=>e===t),hasTags:r&&r.length}}),Object(m.ifCondition)(({areTagsFetched:e,isPostTypeSupported:t})=>t&&e))(Xo);const ec=(e,t)=>{const n=jo.filter(t=>Object(u.includes)(e,t.id));return Object(u.find)(n,e=>e.id===t)},tc=({suggestedPostFormat:e,suggestionText:t,onUpdatePostFormat:n})=>Object(l.createElement)(Er.Button,{isLink:!0,onClick:()=>n(e)},t);function nc(){const{currentPostFormat:e,suggestion:t}=Object(h.useSelect)(e=>{const{getEditedPostAttribute:t,getSuggestedPostFormat:n}=e("core/editor"),r=Object(u.get)(e("core").getThemeSupports(),["formats"],[]);return{currentPostFormat:t("format"),suggestion:ec(r,n())}},[]),{editPost:n}=Object(h.useDispatch)("core/editor"),r=[Object(Zt.__)("Suggestion:"),Object(l.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},Object(Zt.__)("Use a post format"))];return t&&t.id!==e?Object(l.createElement)(Er.PanelBody,{initialOpen:!1,title:r},Object(l.createElement)("p",null,Object(Zt.__)("Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.")),Object(l.createElement)("p",null,Object(l.createElement)(tc,{onUpdatePostFormat:e=>n({format:e}),suggestedPostFormat:t.id,suggestionText:Object(Zt.sprintf)(Object(Zt.__)('Apply the "%1$s" format.'),t.caption)}))):null}var rc=function({children:e}){const{isBeingScheduled:t,isRequestingSiteIcon:n,hasPublishAction:r,siteIconUrl:o,siteTitle:c,siteHome:s}=Object(h.useSelect)(e=>{const{isResolving:t}=e("core/data"),{getCurrentPost:n,isEditedPostBeingScheduled:r}=e("core/editor"),{getEntityRecord:o}=e("core"),c=o("root","__unstableBase",void 0)||{};return{hasPublishAction:Object(u.get)(n(),["_links","wp:action-publish"],!1),isBeingScheduled:r(),isRequestingSiteIcon:t("core","getEntityRecord",["root","__unstableBase",void 0]),siteIconUrl:c.site_icon_url,siteTitle:c.name,siteHome:c.home&&Object(P.filterURLForDisplay)(c.home)}},[]);let i,a,d=Object(l.createElement)(Er.Icon,{className:"components-site-icon",size:"36px",icon:Lo.a});return o&&(d=Object(l.createElement)("img",{alt:Object(Zt.__)("Site Icon"),className:"components-site-icon",src:o})),n&&(d=null),r?t?(i=Object(Zt.__)("Are you ready to schedule?"),a=Object(Zt.__)("Your work will be published at the specified date and time.")):(i=Object(Zt.__)("Are you ready to publish?"),a=Object(Zt.__)("Double-check your settings before publishing.")):(i=Object(Zt.__)("Are you ready to submit for review?"),a=Object(Zt.__)("When you’re ready, submit your work for review, and an Editor will be able to approve it for you.")),Object(l.createElement)("div",{className:"editor-post-publish-panel__prepublish"},Object(l.createElement)("div",null,Object(l.createElement)("strong",null,i)),Object(l.createElement)("p",null,a),Object(l.createElement)("div",{className:"components-site-card"},d,Object(l.createElement)("div",{className:"components-site-info"},Object(l.createElement)("span",{className:"components-site-name"},c||Object(Zt.__)("(Untitled)")),Object(l.createElement)("span",{className:"components-site-home"},s))),r&&Object(l.createElement)(l.Fragment,null,Object(l.createElement)(Er.PanelBody,{initialOpen:!1,title:[Object(Zt.__)("Visibility:"),Object(l.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},Object(l.createElement)(No,null))]},Object(l.createElement)(Io,null)),Object(l.createElement)(Er.PanelBody,{initialOpen:!1,title:[Object(Zt.__)("Publish:"),Object(l.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},Object(l.createElement)(Uo,null))]},Object(l.createElement)(Do,null))),Object(l.createElement)(nc,null),Object(l.createElement)(Jo,null),e)};function oc({text:e,onCopy:t,children:n}){const r=Object(m.useCopyToClipboard)(e,t);return Object(l.createElement)(Er.Button,{isSecondary:!0,ref:r},n)}class cc extends l.Component{constructor(){super(...arguments),this.state={showCopyConfirmation:!1},this.onCopy=this.onCopy.bind(this),this.onSelectInput=this.onSelectInput.bind(this),this.postLink=Object(l.createRef)()}componentDidMount(){this.props.focusOnMount&&this.postLink.current.focus()}componentWillUnmount(){clearTimeout(this.dismissCopyConfirmation)}onCopy(){this.setState({showCopyConfirmation:!0}),clearTimeout(this.dismissCopyConfirmation),this.dismissCopyConfirmation=setTimeout(()=>{this.setState({showCopyConfirmation:!1})},4e3)}onSelectInput(e){e.target.select()}render(){const{children:e,isScheduled:t,post:n,postType:r}=this.props,o=Object(u.get)(r,["labels","singular_name"]),c=Object(u.get)(r,["labels","view_item"]),s="future"===n.status?(e=>{const{slug:t}=e;return e.permalink_template.includes("%postname%")?e.permalink_template.replace("%postname%",t):e.permalink_template})(n):n.link,i=t?Object(l.createElement)(l.Fragment,null,Object(Zt.__)("is now scheduled. It will go live on")," ",Object(l.createElement)(Uo,null),"."):Object(Zt.__)("is now live.");return Object(l.createElement)("div",{className:"post-publish-panel__postpublish"},Object(l.createElement)(Er.PanelBody,{className:"post-publish-panel__postpublish-header"},Object(l.createElement)("a",{ref:this.postLink,href:s},Object(Zr.decodeEntities)(n.title)||Object(Zt.__)("(no title)"))," ",i),Object(l.createElement)(Er.PanelBody,null,Object(l.createElement)("p",{className:"post-publish-panel__postpublish-subheader"},Object(l.createElement)("strong",null,Object(Zt.__)("What’s next?"))),Object(l.createElement)(Er.TextControl,{className:"post-publish-panel__postpublish-post-address",readOnly:!0,label:Object(Zt.sprintf)(Object(Zt.__)("%s address"),o),value:Object(P.safeDecodeURIComponent)(s),onFocus:this.onSelectInput}),Object(l.createElement)("div",{className:"post-publish-panel__postpublish-buttons"},!t&&Object(l.createElement)(Er.Button,{isSecondary:!0,href:s},c),Object(l.createElement)(oc,{text:s,onCopy:this.onCopy},this.state.showCopyConfirmation?Object(Zt.__)("Copied!"):Object(Zt.__)("Copy Link")))),e)}}var sc=Object(h.withSelect)(e=>{const{getEditedPostAttribute:t,getCurrentPost:n,isCurrentPostScheduled:r}=e("core/editor"),{getPostType:o}=e("core");return{post:n(),postType:o(t("type")),isScheduled:r()}})(cc);class ic extends l.Component{constructor(){super(...arguments),this.onSubmit=this.onSubmit.bind(this)}componentDidUpdate(e){e.isPublished&&!this.props.isSaving&&this.props.isDirty&&this.props.onClose()}onSubmit(){const{onClose:e,hasPublishAction:t,isPostTypeViewable:n}=this.props;t&&n||e()}render(){const{forceIsDirty:e,forceIsSaving:t,isBeingScheduled:n,isPublished:r,isPublishSidebarEnabled:o,isScheduled:c,isSaving:s,onClose:i,onTogglePublishSidebar:d,PostPublishExtension:h,PrePublishExtension:m,...p}=this.props,v=Object(u.omit)(p,["hasPublishAction","isDirty","isPostTypeViewable"]),b=r||c&&n,w=!b&&!s,f=b&&!s;return Object(l.createElement)("div",Object(a.a)({className:"editor-post-publish-panel"},v),Object(l.createElement)("div",{className:"editor-post-publish-panel__header"},f?Object(l.createElement)(Er.Button,{onClick:i,icon:Mo.a,label:Object(Zt.__)("Close panel")}):Object(l.createElement)(l.Fragment,null,Object(l.createElement)("div",{className:"editor-post-publish-panel__header-publish-button"},Object(l.createElement)(Bo,{focusOnMount:!0,onSubmit:this.onSubmit,forceIsDirty:e,forceIsSaving:t})),Object(l.createElement)("div",{className:"editor-post-publish-panel__header-cancel-button"},Object(l.createElement)(Er.Button,{onClick:i,isSecondary:!0},Object(Zt.__)("Cancel"))))),Object(l.createElement)("div",{className:"editor-post-publish-panel__content"},w&&Object(l.createElement)(rc,null,m&&Object(l.createElement)(m,null)),f&&Object(l.createElement)(sc,{focusOnMount:!0},h&&Object(l.createElement)(h,null)),s&&Object(l.createElement)(Er.Spinner,null)),Object(l.createElement)("div",{className:"editor-post-publish-panel__footer"},Object(l.createElement)(Er.CheckboxControl,{label:Object(Zt.__)("Always show pre-publish checks."),checked:o,onChange:d})))}}var ac=Object(m.compose)([Object(h.withSelect)(e=>{const{getPostType:t}=e("core"),{getCurrentPost:n,getEditedPostAttribute:r,isCurrentPostPublished:o,isCurrentPostScheduled:c,isEditedPostBeingScheduled:s,isEditedPostDirty:i,isSavingPost:a}=e("core/editor"),{isPublishSidebarEnabled:l}=e("core/editor"),d=t(r("type"));return{hasPublishAction:Object(u.get)(n(),["_links","wp:action-publish"],!1),isPostTypeViewable:Object(u.get)(d,["viewable"],!1),isBeingScheduled:s(),isDirty:i(),isPublished:o(),isPublishSidebarEnabled:l(),isSaving:a(),isScheduled:c()}}),Object(h.withDispatch)((e,{isPublishSidebarEnabled:t})=>{const{disablePublishSidebar:n,enablePublishSidebar:r}=e("core/editor");return{onTogglePublishSidebar:()=>{t?n():r()}}}),Er.withFocusReturn,Er.withConstrainedTabbing])(ic),lc=n(97),uc=n(385),dc=n(125),hc=n(384);var mc=Object(m.compose)([Object(h.withSelect)(e=>{const{isSavingPost:t,isCurrentPostPublished:n,isCurrentPostScheduled:r}=e("core/editor");return{isSaving:t(),isPublished:n(),isScheduled:r()}}),Object(h.withDispatch)(e=>{const{editPost:t,savePost:n}=e("core/editor");return{onClick:()=>{t({status:"draft"}),n()}}})])((function({isSaving:e,isPublished:t,isScheduled:n,onClick:r}){const o=Object(m.useViewportMatch)("small","<");return t||n?Object(l.createElement)(Er.Button,{className:"editor-post-switch-to-draft",onClick:()=>{let e;t?e=Object(Zt.__)("Are you sure you want to unpublish this post?"):n&&(e=Object(Zt.__)("Are you sure you want to unschedule this post?")),window.confirm(e)&&r()},disabled:e,isTertiary:!0},o?Object(Zt.__)("Draft"):Object(Zt.__)("Switch to draft")):null}));function pc({forceIsDirty:e,forceIsSaving:t,showIconLabels:n=!1}){const[r,o]=Object(l.useState)(!1),c=Object(m.useViewportMatch)("small"),{isAutosaving:s,isDirty:i,isNew:a,isPending:u,isPublished:d,isSaveable:p,isSaving:v,isScheduled:b,hasPublishAction:w}=Object(h.useSelect)(n=>{var r,o,c;const{isEditedPostNew:s,isCurrentPostPublished:i,isCurrentPostScheduled:a,isEditedPostDirty:l,isSavingPost:u,isEditedPostSaveable:d,getCurrentPost:h,isAutosavingPost:m,getEditedPostAttribute:p}=n("core/editor");return{isAutosaving:m(),isDirty:e||l(),isNew:s(),isPending:"pending"===p("status"),isPublished:i(),isSaving:t||u(),isSaveable:d(),isScheduled:a(),hasPublishAction:null!==(r=null===(o=h())||void 0===o||null===(c=o._links)||void 0===c?void 0:c["wp:action-publish"])&&void 0!==r&&r}},[e,t]),{savePost:f}=Object(h.useDispatch)("core/editor"),g=Object(m.usePrevious)(v);if(Object(l.useEffect)(()=>{let e;return g&&!v&&(o(!0),e=setTimeout(()=>{o(!1)},1e3)),()=>clearTimeout(e)},[v]),v){const e=ir()("editor-post-saved-state","is-saving",Object(Er.__unstableGetAnimateClassName)({type:"loading"}),{"is-autosaving":s});return Object(l.createElement)("span",{className:e},Object(l.createElement)(lc.a,{icon:uc.a}),s?Object(Zt.__)("Autosaving"):Object(Zt.__)("Saving"))}if(d||b)return Object(l.createElement)(mc,null);if(!p)return null;if(r||!a&&!i)return Object(l.createElement)("span",{className:"editor-post-saved-state is-saved"},Object(l.createElement)(lc.a,{icon:dc.a}),Object(Zt.__)("Saved"));if(!w&&u)return null;const O=u?Object(Zt.__)("Save as pending"):Object(Zt.__)("Save draft"),j=Object(Zt.__)("Save");return c?Object(l.createElement)(Er.Button,{className:"editor-post-save-draft",onClick:()=>f(),shortcut:Sr.displayShortcut.primary("s"),isTertiary:!0},O):Object(l.createElement)(Er.Button,{className:"editor-post-save-draft",label:O,onClick:()=>f(),shortcut:Sr.displayShortcut.primary("s"),icon:hc.a},n&&j)}var vc=Object(m.compose)([Object(h.withSelect)(e=>{const{getCurrentPost:t,getCurrentPostType:n}=e("core/editor");return{hasPublishAction:Object(u.get)(t(),["_links","wp:action-publish"],!1),postType:n()}})])((function({hasPublishAction:e,children:t}){return e?t:null}));function bc({children:e}){return Object(l.createElement)(Wr,{supportKeys:"slug"},e)}class wc extends l.Component{constructor({postSlug:e,postTitle:t,postID:n}){super(...arguments),this.state={editedSlug:Object(P.safeDecodeURIComponent)(e)||M(t)||n},this.setSlug=this.setSlug.bind(this)}setSlug(e){const{postSlug:t,onUpdateSlug:n}=this.props,{value:r}=e.target,o=M(r);o!==t&&n(o)}render(){const{instanceId:e}=this.props,{editedSlug:t}=this.state,n="editor-post-slug-"+e;return Object(l.createElement)(bc,null,Object(l.createElement)("label",{htmlFor:n},Object(Zt.__)("Slug")),Object(l.createElement)("input",{type:"text",id:n,value:t,onChange:e=>this.setState({editedSlug:e.target.value}),onBlur:this.setSlug,className:"editor-post-slug__input"}))}}var fc=Object(m.compose)([Object(h.withSelect)(e=>{const{getCurrentPost:t,getEditedPostAttribute:n}=e("core/editor"),{id:r}=t();return{postSlug:n("slug"),postTitle:n("title"),postID:r}}),Object(h.withDispatch)(e=>{const{editPost:t}=e("core/editor");return{onUpdateSlug(e){t({slug:e})}}}),m.withInstanceId])(wc);var gc=Object(m.compose)([Object(h.withSelect)(e=>{const t=e("core/editor").getCurrentPost();return{hasStickyAction:Object(u.get)(t,["_links","wp:action-sticky"],!1),postType:e("core/editor").getCurrentPostType()}})])((function({hasStickyAction:e,postType:t,children:n}){return"post"===t&&e?n:null}));var Oc=Object(m.compose)([Object(h.withSelect)(e=>({postSticky:e("core/editor").getEditedPostAttribute("sticky")})),Object(h.withDispatch)(e=>({onUpdateSticky(t){e("core/editor").editPost({sticky:t})}}))])((function({onUpdateSticky:e,postSticky:t=!1}){return Object(l.createElement)(gc,null,Object(l.createElement)(Er.CheckboxControl,{label:Object(Zt.__)("Stick to the top of the blog"),checked:t,onChange:()=>e(!t)}))}));const jc={per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent"};class Ec extends l.Component{constructor(){super(...arguments),this.findTerm=this.findTerm.bind(this),this.onChange=this.onChange.bind(this),this.onChangeFormName=this.onChangeFormName.bind(this),this.onChangeFormParent=this.onChangeFormParent.bind(this),this.onAddTerm=this.onAddTerm.bind(this),this.onToggleForm=this.onToggleForm.bind(this),this.setFilterValue=this.setFilterValue.bind(this),this.sortBySelected=this.sortBySelected.bind(this),this.state={loading:!0,availableTermsTree:[],availableTerms:[],adding:!1,formName:"",formParent:"",showForm:!1,filterValue:"",filteredTermsTree:[]}}onChange(e){const{onUpdateTerms:t,terms:n=[],taxonomy:r}=this.props;t(-1!==n.indexOf(e)?Object(u.without)(n,e):[...n,e],r.rest_base)}onChangeFormName(e){const t=""===e.target.value.trim()?"":e.target.value;this.setState({formName:t})}onChangeFormParent(e){this.setState({formParent:e})}onToggleForm(){this.setState(e=>({showForm:!e.showForm}))}findTerm(e,t,n){return Object(u.find)(e,e=>(!e.parent&&!t||parseInt(e.parent)===parseInt(t))&&e.name.toLowerCase()===n.toLowerCase())}onAddTerm(e){e.preventDefault();const{onUpdateTerms:t,taxonomy:n,terms:r,slug:o}=this.props,{formName:c,formParent:s,adding:i,availableTerms:a}=this.state;if(""===c||i)return;const l=this.findTerm(a,s,c);if(l)return Object(u.some)(r,e=>e===l.id)||t([...r,l.id],n.rest_base),void this.setState({formName:"",formParent:""});this.setState({adding:!0}),this.addRequest=w()({path:"/wp/v2/"+n.rest_base,method:"POST",data:{name:c,parent:s||void 0}});this.addRequest.catch(e=>"term_exists"===e.code?(this.addRequest=w()({path:Object(P.addQueryArgs)("/wp/v2/"+n.rest_base,{...jc,parent:s||0,search:c})}),this.addRequest.then(e=>this.findTerm(e,s,c))):Promise.reject(e)).then(e=>{const c=!!Object(u.find)(this.state.availableTerms,t=>t.id===e.id)?this.state.availableTerms:[e,...this.state.availableTerms],s=Object(Zt.sprintf)(Object(Zt._x)("%s added","term"),Object(u.get)(this.props.taxonomy,["labels","singular_name"],"category"===o?Object(Zt.__)("Category"):Object(Zt.__)("Term")));this.props.speak(s,"assertive"),this.addRequest=null,this.setState({adding:!1,formName:"",formParent:"",availableTerms:c,availableTermsTree:this.sortBySelected($r(c))}),t([...r,e.id],n.rest_base)},e=>{"abort"!==e.statusText&&(this.addRequest=null,this.setState({adding:!1}))})}componentDidMount(){this.fetchTerms()}componentWillUnmount(){Object(u.invoke)(this.fetchRequest,["abort"]),Object(u.invoke)(this.addRequest,["abort"])}componentDidUpdate(e){this.props.taxonomy!==e.taxonomy&&this.fetchTerms()}fetchTerms(){const{taxonomy:e}=this.props;e&&(this.fetchRequest=w()({path:Object(P.addQueryArgs)("/wp/v2/"+e.rest_base,jc)}),this.fetchRequest.then(e=>{const t=this.sortBySelected($r(e));this.fetchRequest=null,this.setState({loading:!1,availableTermsTree:t,availableTerms:e})},e=>{"abort"!==e.statusText&&(this.fetchRequest=null,this.setState({loading:!1}))}))}sortBySelected(e){const{terms:t}=this.props,n=e=>{if(-1!==t.indexOf(e.id))return!0;if(void 0===e.children)return!1;return!!(e.children.map(n).filter(e=>e).length>0)};return e.sort((e,t)=>{const r=n(e),o=n(t);return r===o?0:r&&!o?-1:!r&&o?1:0}),e}setFilterValue(e){const{availableTermsTree:t}=this.state,n=e.target.value,r=t.map(this.getFilterMatcher(n)).filter(e=>e),o=e=>{let t=0;for(let n=0;n{if(""===e)return n;const r={...n};return r.children.length>0&&(r.children=r.children.map(t).filter(e=>e)),(-1!==r.name.toLowerCase().indexOf(e.toLowerCase())||r.children.length>0)&&r};return t}renderTerms(e){const{terms:t=[]}=this.props;return e.map(e=>Object(l.createElement)("div",{key:e.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},Object(l.createElement)(Er.CheckboxControl,{checked:-1!==t.indexOf(e.id),onChange:()=>{const t=parseInt(e.id,10);this.onChange(t)},label:Object(u.unescape)(e.name)}),!!e.children.length&&Object(l.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},this.renderTerms(e.children))))}render(){const{slug:e,taxonomy:t,instanceId:n,hasCreateAction:r,hasAssignAction:o}=this.props;if(!o)return null;const{availableTermsTree:c,availableTerms:s,filteredTermsTree:i,formName:a,formParent:d,loading:h,showForm:m,filterValue:p}=this.state,v=(n,r,o)=>Object(u.get)(t,["labels",n],"category"===e?r:o),b=v("add_new_item",Object(Zt.__)("Add new category"),Object(Zt.__)("Add new term")),w=v("new_item_name",Object(Zt.__)("Add new category"),Object(Zt.__)("Add new term")),f=v("parent_item",Object(Zt.__)("Parent Category"),Object(Zt.__)("Parent Term")),g=`— ${f} —`,O=b,j="editor-post-taxonomies__hierarchical-terms-input-"+n,E="editor-post-taxonomies__hierarchical-terms-filter-"+n,S=Object(u.get)(this.props.taxonomy,["labels","search_items"],Object(Zt.__)("Search Terms")),_=Object(u.get)(this.props.taxonomy,["name"],Object(Zt.__)("Terms")),y=s.length>=8;return[y&&Object(l.createElement)("label",{key:"filter-label",htmlFor:E},S),y&&Object(l.createElement)("input",{type:"search",id:E,value:p,onChange:this.setFilterValue,className:"editor-post-taxonomies__hierarchical-terms-filter",key:"term-filter-input"}),Object(l.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",key:"term-list",tabIndex:"0",role:"group","aria-label":_},this.renderTerms(""!==p?i:c)),!h&&r&&Object(l.createElement)(Er.Button,{key:"term-add-button",onClick:this.onToggleForm,className:"editor-post-taxonomies__hierarchical-terms-add","aria-expanded":m,isLink:!0},b),m&&Object(l.createElement)("form",{onSubmit:this.onAddTerm,key:"hierarchical-terms-form"},Object(l.createElement)("label",{htmlFor:j,className:"editor-post-taxonomies__hierarchical-terms-label"},w),Object(l.createElement)("input",{type:"text",id:j,className:"editor-post-taxonomies__hierarchical-terms-input",value:a,onChange:this.onChangeFormName,required:!0}),!!s.length&&Object(l.createElement)(Er.TreeSelect,{label:f,noOptionLabel:g,onChange:this.onChangeFormParent,selectedId:d,tree:c}),Object(l.createElement)(Er.Button,{isSecondary:!0,type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit"},O))]}}var Sc=Object(m.compose)([Object(h.withSelect)((e,{slug:t})=>{const{getCurrentPost:n}=e("core/editor"),{getTaxonomy:r}=e("core"),o=r(t);return{hasCreateAction:!!o&&Object(u.get)(n(),["_links","wp:action-create-"+o.rest_base],!1),hasAssignAction:!!o&&Object(u.get)(n(),["_links","wp:action-assign-"+o.rest_base],!1),terms:o?e("core/editor").getEditedPostAttribute(o.rest_base):[],taxonomy:o}}),Object(h.withDispatch)(e=>({onUpdateTerms(t,n){e("core/editor").editPost({[n]:t})}})),Er.withSpokenMessages,m.withInstanceId,Object(Er.withFilters)("editor.PostTaxonomyType")])(Ec);var _c=Object(m.compose)([Object(h.withSelect)(e=>({postType:e("core/editor").getCurrentPostType(),taxonomies:e("core").getTaxonomies({per_page:-1})}))])((function({postType:e,taxonomies:t,taxonomyWrapper:n=u.identity}){const r=Object(u.filter)(t,t=>Object(u.includes)(t.types,e));return Object(u.filter)(r,e=>e.visibility.show_ui).map(e=>{const t=e.hierarchical?Sc:Qo;return Object(l.createElement)(l.Fragment,{key:"taxonomy-"+e.slug},n(Object(l.createElement)(t,{slug:e.slug}),e))})}));var yc=Object(m.compose)([Object(h.withSelect)(e=>({postType:e("core/editor").getCurrentPostType(),taxonomies:e("core").getTaxonomies({per_page:-1})}))])((function({postType:e,taxonomies:t,children:n}){return Object(u.some)(t,t=>Object(u.includes)(t.types,e))?n:null})),Pc=n(94),xc=n.n(Pc);function Vc(){const e=Object(h.useSelect)(e=>e("core/editor").getEditedPostContent(),[]),{editPost:t,resetEditorBlocks:n}=Object(h.useDispatch)("core/editor"),[r,o]=Object(l.useState)(e),[c,s]=Object(l.useState)(!1),i=Object(m.useInstanceId)(Vc);c||r===e||o(e);return Object(l.createElement)(l.Fragment,null,Object(l.createElement)(Er.VisuallyHidden,{as:"label",htmlFor:"post-content-"+i},Object(Zt.__)("Type text or HTML")),Object(l.createElement)(xc.a,{autoComplete:"off",dir:"auto",value:r,onChange:e=>{const n=e.target.value;t({content:n}),o(n),s(!0)},onBlur:()=>{if(c){const e=Object(d.parse)(r);n(e),s(!1)}},className:"editor-post-text-editor",id:"post-content-"+i,placeholder:Object(Zt.__)("Start writing with text or HTML")}))}const zc=/[\r\n]+/g;function kc(){const e=Object(m.useInstanceId)(kc),t=Object(l.useRef)(),[n,r]=Object(l.useState)(!1),{editPost:o}=Object(h.useDispatch)("core/editor"),{insertDefaultBlock:s,clearSelectedBlock:i,insertBlocks:a}=Object(h.useDispatch)(c.store),{isCleanNewPost:u,title:p,placeholder:v,isFocusMode:b,hasFixedToolbar:w}=Object(h.useSelect)(e=>{const{getEditedPostAttribute:t,isCleanNewPost:n}=e("core/editor"),{getSettings:r}=e(c.store),{titlePlaceholder:o,focusMode:s,hasFixedToolbar:i}=r();return{isCleanNewPost:n(),title:t("title"),placeholder:o,isFocusMode:s,hasFixedToolbar:i}});function f(e){a(e,0)}function g(e){o({title:e})}function O(){r(!1)}Object(l.useEffect)(()=>{if(!t.current)return;const{ownerDocument:e}=t.current,{activeElement:n,body:r}=e;!u||n&&r!==n||t.current.focus()},[u]);const j=ir()("wp-block editor-post-title editor-post-title__block",{"is-selected":n,"is-focus-mode":b,"has-fixed-toolbar":w}),E=Object(Zr.decodeEntities)(v);return Object(l.createElement)(Wr,{supportKeys:"title"},Object(l.createElement)("div",{className:j},Object(l.createElement)(Er.VisuallyHidden,{as:"label",htmlFor:"post-title-"+e},E||Object(Zt.__)("Add title")),Object(l.createElement)(xc.a,{ref:t,id:"post-title-"+e,className:"editor-post-title__input",value:p,onChange:function(e){g(e.target.value.replace(zc," "))},placeholder:E||Object(Zt.__)("Add title"),onFocus:function(){r(!0),i()},onBlur:O,onKeyDown:function(e){e.keyCode===Sr.ENTER&&(e.preventDefault(),s(void 0,void 0,0))},onKeyPress:O,onPaste:function(e){const t=e.clipboardData;let n="",r="";try{n=t.getData("text/plain"),r=t.getData("text/html")}catch(e){try{r=t.getData("Text")}catch(e){return}}window.console.log("Received HTML:\n\n",r),window.console.log("Received plain text:\n\n",n);const o=Object(d.pasteHandler)({HTML:r,plainText:n});if("string"!=typeof o&&o.length){e.preventDefault();const[t]=o;p||"core/heading"!==t.name&&"core/paragraph"!==t.name?f(o):(g(t.attributes.content),f(o.slice(1)))}}})))}var Cc=Object(m.compose)([Object(h.withSelect)(e=>{const{isEditedPostNew:t,getCurrentPostId:n,getCurrentPostType:r}=e("core/editor");return{isNew:t(),postId:n(),postType:r()}}),Object(h.withDispatch)(e=>({trashPost:e("core/editor").trashPost}))])((function({isNew:e,postId:t,postType:n,...r}){return e||!t?null:Object(l.createElement)(Er.Button,{className:"editor-post-trash",isDestructive:!0,isTertiary:!0,onClick:()=>r.trashPost(t,n)},Object(Zt.__)("Move to trash"))}));var Hc=Object(h.withSelect)(e=>{const{isEditedPostNew:t,getCurrentPostId:n,getCurrentPostType:r}=e("core/editor"),{getPostType:o,canUser:c}=e("core"),s=n(),i=o(r()),a=(null==i?void 0:i.rest_base)||"";return{isNew:t(),postId:s,canUserDelete:!(!s||!a)&&c("delete",a,s)}})((function({isNew:e,postId:t,canUserDelete:n,children:r}){return!e&&t&&n?r:null}));var Tc=Object(m.compose)([Object(h.withSelect)(e=>{const{getCurrentPost:t,getCurrentPostType:n}=e("core/editor");return{hasPublishAction:Object(u.get)(t(),["_links","wp:action-publish"],!1),postType:n()}})])((function({hasPublishAction:e,render:t}){return t({canEdit:e})})),Bc=n(386),Mc=n(117);function Lc(){const e=Object(h.useSelect)(e=>e("core/editor").getEditedPostAttribute("content")),t=Object(Zt._x)("words","Word count type. Do not translate!");return Object(l.createElement)("span",{className:"word-count"},Object(Mc.count)(e,t))}function Ac(){const e=Object(h.useSelect)(e=>e("core/editor").getEditedPostAttribute("content"));return Object(Mc.count)(e,"characters_including_spaces")}var Rc=function({hasOutlineItemsDisabled:e,onRequestClose:t}){const{headingCount:n,paragraphCount:r,numberOfBlocks:o}=Object(h.useSelect)(e=>{const{getGlobalBlockCount:t}=e(c.store);return{headingCount:t("core/heading"),paragraphCount:t("core/paragraph"),numberOfBlocks:t()}},[]);return Object(l.createElement)(l.Fragment,null,Object(l.createElement)("div",{className:"table-of-contents__wrapper",role:"note","aria-label":Object(Zt.__)("Document Statistics"),tabIndex:"0"},Object(l.createElement)("ul",{role:"list",className:"table-of-contents__counts"},Object(l.createElement)("li",{className:"table-of-contents__count"},Object(Zt.__)("Characters"),Object(l.createElement)("span",{className:"table-of-contents__number"},Object(l.createElement)(Ac,null))),Object(l.createElement)("li",{className:"table-of-contents__count"},Object(Zt.__)("Words"),Object(l.createElement)(Lc,null)),Object(l.createElement)("li",{className:"table-of-contents__count"},Object(Zt.__)("Headings"),Object(l.createElement)("span",{className:"table-of-contents__number"},n)),Object(l.createElement)("li",{className:"table-of-contents__count"},Object(Zt.__)("Paragraphs"),Object(l.createElement)("span",{className:"table-of-contents__number"},r)),Object(l.createElement)("li",{className:"table-of-contents__count"},Object(Zt.__)("Blocks"),Object(l.createElement)("span",{className:"table-of-contents__number"},o)))),n>0&&Object(l.createElement)(l.Fragment,null,Object(l.createElement)("hr",null),Object(l.createElement)("h2",{className:"table-of-contents__title"},Object(Zt.__)("Document Outline")),Object(l.createElement)(vr,{onSelect:t,hasOutlineItemsDisabled:e})))};var Ic=Object(l.forwardRef)((function({hasOutlineItemsDisabled:e,repositionDropdown:t,...n},r){const o=Object(h.useSelect)(e=>!!e(c.store).getBlockCount(),[]);return Object(l.createElement)(Er.Dropdown,{position:t?"middle right right":"bottom",className:"table-of-contents",contentClassName:"table-of-contents__popover",renderToggle:({isOpen:e,onToggle:t})=>Object(l.createElement)(Er.Button,Object(a.a)({},n,{ref:r,onClick:o?t:void 0,icon:Bc.a,"aria-expanded":e,"aria-haspopup":"true",label:Object(Zt.__)("Details"),tooltipPosition:"bottom","aria-disabled":!o})),renderContent:({onClose:t})=>Object(l.createElement)(Rc,{onRequestClose:t,hasOutlineItemsDisabled:e})})}));function Nc(){const e=Object(h.useSelect)(e=>()=>{const{__experimentalGetDirtyEntityRecords:t}=e("core");return t().length>0},[]),t=t=>{if(e())return t.returnValue=Object(Zt.__)("You have unsaved changes. If you proceed, they will be lost."),t.returnValue};return Object(l.useEffect)(()=>(window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}),[]),null}var Gc=n(151);var Dc=Object(m.createHigherOrderComponent)(e=>Object(h.withRegistry)(t=>{const{useSubRegistry:n=!0,registry:r,...o}=t;if(!n)return Object(l.createElement)(e,o);const[s,i]=Object(l.useState)(null);return Object(l.useEffect)(()=>{const e=Object(h.createRegistry)({"core/block-editor":c.storeConfig},r);e.registerStore("core/editor",nr),i(e)},[r]),s?Object(l.createElement)(h.RegistryProvider,{value:s},Object(l.createElement)(e,o)):null}),"withRegistryProvider"),Uc=n(158);function Fc({additionalData:e={},allowedTypes:t,filesList:n,maxUploadFileSize:r,onError:o=u.noop,onFileChange:c}){const{getCurrentPostId:s,getEditorSettings:i}=Object(h.select)("core/editor"),a=i().allowedMimeTypes;r=r||i().maxUploadFileSize,Object(Uc.uploadMedia)({allowedTypes:t,filesList:n,onFileChange:c,additionalData:{post:s(),...e},maxUploadFileSize:r,onError:({message:e})=>o(e),wpAllowedMimeTypes:a})}var Wc=function(e,t){const{reusableBlocks:n,hasUploadPermissions:r,canUseUnfilteredHTML:o,isTitleSelected:c}=Object(h.useSelect)(e=>{const{canUserUseUnfilteredHTML:t,isPostTitleSelected:n}=e(rr),{canUser:r}=e(s.store);return{canUseUnfilteredHTML:t(),reusableBlocks:e(s.store).getEntityRecords("postType","wp_block",{per_page:l.Platform.select({web:-1,native:10})}),hasUploadPermissions:Object(u.defaultTo)(r("create","media"),!0),isTitleSelected:n&&n()}},[]),{undo:i}=Object(h.useDispatch)(rr);return Object(l.useMemo)(()=>({...Object(u.pick)(e,["__experimentalBlockDirectory","__experimentalBlockPatternCategories","__experimentalBlockPatterns","__experimentalFeatures","__experimentalGlobalStylesBaseStyles","__experimentalGlobalStylesUserEntityId","__experimentalPreferredStyleVariations","__experimentalSetIsInserterOpened","alignWide","allowedBlockTypes","bodyPlaceholder","codeEditingEnabled","colors","disableCustomColors","disableCustomFontSizes","disableCustomGradients","enableCustomLineHeight","enableCustomSpacing","enableCustomUnits","focusMode","fontSizes","gradients","hasFixedToolbar","hasReducedUI","imageDefaultSize","imageDimensions","imageEditing","imageSizes","isRTL","keepCaretInsideBlock","maxWidth","onUpdateDefaultBlockStyles","styles","template","templateLock","titlePlaceholder","supportsLayout","widgetTypesToHideFromLegacyWidgetBlock"]),mediaUpload:r?Fc:void 0,__experimentalReusableBlocks:n,__experimentalFetchLinkSuggestions:(t,n)=>Object(s.__experimentalFetchLinkSuggestions)(t,n,e),__experimentalFetchRemoteUrlData:e=>Object(s.__experimentalFetchRemoteUrlData)(e),__experimentalCanUserUseUnfilteredHTML:o,__experimentalUndo:i,__experimentalShouldInsertAtTheTop:c,outlineMode:t}),[e,r,n,o,i,c,t])};var qc=Dc((function({__unstableTemplate:e,post:t,settings:n,recovery:r,initialEdits:o,children:i}){const a=Object(l.useMemo)(()=>"wp_template"===t.type?{}:{postId:t.id,postType:t.type},[t.id,t.type]),{selection:u,isReady:d}=Object(h.useSelect)(e=>{const{getEditorSelection:t,__unstableIsEditorReady:n}=e(rr);return{isReady:n(),selection:t()}},[]),{id:m,type:p}=null!=e?e:t,[v,b,w]=Object(s.useEntityBlockEditor)("postType",p,{id:m}),f=Wc(n,!!e),{updatePostLock:g,setupEditor:O,updateEditorSettings:j,__experimentalTearDownEditor:E}=Object(h.useDispatch)(rr),{createWarningNotice:S}=Object(h.useDispatch)(Kt.store);return Object(l.useLayoutEffect)(()=>{if(!r)return g(n.postLock),O(t,o,n.template),n.autosave&&S(Object(Zt.__)("There is an autosave of this post that is more recent than the version below."),{id:"autosave-exists",actions:[{label:Object(Zt.__)("View the autosave"),url:n.autosave.editLink}]}),()=>{E()}},[]),Object(l.useEffect)(()=>{j(n)},[n]),d?Object(l.createElement)(s.EntityProvider,{kind:"root",type:"site"},Object(l.createElement)(s.EntityProvider,{kind:"postType",type:t.type,id:t.id},Object(l.createElement)(c.BlockContextProvider,{value:a},Object(l.createElement)(c.BlockEditorProvider,{value:v,onChange:w,onInput:b,selection:u,settings:f,useSubRegistry:!1},i,Object(l.createElement)(Gc.ReusableBlocksMenuItems,null))))):null})),Kc=n(58),Zc=n.n(Kc);function $c(e,t,n=[]){const r=Object(l.forwardRef)((n,r)=>(V()("wp.editor."+e,{since:"5.3",alternative:"wp.blockEditor."+e}),Object(l.createElement)(t,Object(a.a)({ref:r},n))));return n.forEach(n=>{r[n]=$c(e+"."+n,t[n])}),r}function Qc(e,t){return(...n)=>(V()("wp.editor."+e,{since:"5.3",alternative:"wp.blockEditor."+e}),t(...n))}const Yc=$c("RichText",c.RichText,["Content"]);Yc.isEmpty=Qc("RichText.isEmpty",c.RichText.isEmpty);const Xc=$c("Autocomplete",c.Autocomplete),Jc=$c("AlignmentToolbar",c.AlignmentToolbar),es=$c("BlockAlignmentToolbar",c.BlockAlignmentToolbar),ts=$c("BlockControls",c.BlockControls,["Slot"]),ns=$c("BlockEdit",c.BlockEdit),rs=$c("BlockEditorKeyboardShortcuts",c.BlockEditorKeyboardShortcuts),os=$c("BlockFormatControls",c.BlockFormatControls,["Slot"]),cs=$c("BlockIcon",c.BlockIcon),ss=$c("BlockInspector",c.BlockInspector),is=$c("BlockList",c.BlockList),as=$c("BlockMover",c.BlockMover),ls=$c("BlockNavigationDropdown",c.BlockNavigationDropdown),us=$c("BlockSelectionClearer",c.BlockSelectionClearer),ds=$c("BlockSettingsMenu",c.BlockSettingsMenu),hs=$c("BlockTitle",c.BlockTitle),ms=$c("BlockToolbar",c.BlockToolbar),ps=$c("ColorPalette",c.ColorPalette),vs=$c("ContrastChecker",c.ContrastChecker),bs=$c("CopyHandler",c.CopyHandler),ws=$c("DefaultBlockAppender",c.DefaultBlockAppender),fs=$c("FontSizePicker",c.FontSizePicker),gs=$c("Inserter",c.Inserter),Os=$c("InnerBlocks",c.InnerBlocks,["ButtonBlockAppender","DefaultBlockAppender","Content"]),js=$c("InspectorAdvancedControls",c.InspectorAdvancedControls,["Slot"]),Es=$c("InspectorControls",c.InspectorControls,["Slot"]),Ss=$c("PanelColorSettings",c.PanelColorSettings),_s=$c("PlainText",c.PlainText),ys=$c("RichTextShortcut",c.RichTextShortcut),Ps=$c("RichTextToolbarButton",c.RichTextToolbarButton),xs=$c("__unstableRichTextInputEvent",c.__unstableRichTextInputEvent),Vs=$c("MediaPlaceholder",c.MediaPlaceholder),zs=$c("MediaUpload",c.MediaUpload),ks=$c("MediaUploadCheck",c.MediaUploadCheck),Cs=$c("MultiSelectScrollIntoView",c.MultiSelectScrollIntoView),Hs=$c("NavigableToolbar",c.NavigableToolbar),Ts=$c("ObserveTyping",c.ObserveTyping),Bs=$c("PreserveScrollInReorder",c.PreserveScrollInReorder),Ms=$c("SkipToSelectedBlock",c.SkipToSelectedBlock),Ls=$c("URLInput",c.URLInput),As=$c("URLInputButton",c.URLInputButton),Rs=$c("URLPopover",c.URLPopover),Is=$c("Warning",c.Warning),Ns=$c("WritingFlow",c.WritingFlow),Gs=Qc("createCustomColorsHOC",c.createCustomColorsHOC),Ds=Qc("getColorClassName",c.getColorClassName),Us=Qc("getColorObjectByAttributeValues",c.getColorObjectByAttributeValues),Fs=Qc("getColorObjectByColorValue",c.getColorObjectByColorValue),Ws=Qc("getFontSize",c.getFontSize),qs=Qc("getFontSizeClass",c.getFontSizeClass),Ks=Qc("withColorContext",c.withColorContext),Zs=Qc("withColors",c.withColors),$s=Qc("withFontSizes",c.withFontSizes)}]);