%PDF- %PDF-
Direktori : /var/www/projetos/vagas.ongrace.com/wp-includes/js/dist/ |
Current File : /var/www/projetos/vagas.ongrace.com/wp-includes/js/dist/edit-site.min.js |
/*! This file is auto-generated */ !function(){var e={6411:function(e,t){var n,a,r; /*! autosize 4.0.4 license: MIT http://www.jacklmoore.com/autosize */a=[e,t],n=function(e,t){"use strict";var n,a,r="function"==typeof Map?new Map:(n=[],a=[],{has:function(e){return n.indexOf(e)>-1},get:function(e){return a[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),a.push(t))},delete:function(e){var t=n.indexOf(e);t>-1&&(n.splice(t,1),a.splice(t,1))}}),o=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){o=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!r.has(e)){var t=null,n=null,a=null,i=function(){e.clientWidth!==n&&m()},s=function(t){window.removeEventListener("resize",i,!1),e.removeEventListener("input",m,!1),e.removeEventListener("keyup",m,!1),e.removeEventListener("autosize:destroy",s,!1),e.removeEventListener("autosize:update",m,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),r.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",s,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",m,!1),window.addEventListener("resize",i,!1),e.addEventListener("input",m,!1),e.addEventListener("autosize:update",m,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",r.set(e,{destroy:s,update:m}),l()}function l(){var n=window.getComputedStyle(e,null);"vertical"===n.resize?e.style.resize="none":"both"===n.resize&&(e.style.resize="horizontal"),t="content-box"===n.boxSizing?-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),isNaN(t)&&(t=0),m()}function c(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(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}function d(){if(0!==e.scrollHeight){var a=u(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",n=e.clientWidth,a.forEach((function(e){e.node.scrollTop=e.scrollTop})),r&&(document.documentElement.scrollTop=r)}}function m(){d();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(r<t?"hidden"===n.overflowY&&(c("scroll"),d(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(c("hidden"),d(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),a!==r){a=r;var i=o("autosize:resized");try{e.dispatchEvent(i)}catch(e){}}}}function s(e){var t=r.get(e);t&&t.destroy()}function l(e){var t=r.get(e);t&&t.update()}var c=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((c=function(e){return e}).destroy=function(e){return e},c.update=function(e){return e}):((c=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],(function(e){return i(e,t)})),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],s),e},c.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],l),e}),t.default=c,e.exports=t.default},void 0===(r="function"==typeof n?n.apply(t,a):n)||(e.exports=r)},4827:function(e){e.exports=function(e,t,n){return((n=window.getComputedStyle)?n(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},1919:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)};var n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function a(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function r(e,t,n){return e.concat(t).map((function(e){return a(e,n)}))}function o(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function i(e,t){try{return t in e}catch(e){return!1}}function s(e,t,n){var r={};return n.isMergeableObject(e)&&o(e).forEach((function(t){r[t]=a(e[t],n)})),o(t).forEach((function(o){(function(e,t){return i(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(i(e,o)&&n.isMergeableObject(t[o])?r[o]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(o,n)(e[o],t[o],n):r[o]=a(t[o],n))})),r}function l(e,n,o){(o=o||{}).arrayMerge=o.arrayMerge||r,o.isMergeableObject=o.isMergeableObject||t,o.cloneUnlessOtherwiseSpecified=a;var i=Array.isArray(n);return i===Array.isArray(e)?i?o.arrayMerge(e,n,o):s(e,n,o):a(n,o)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var c=l;e.exports=c},8981:function(e,t){var n,a,r;a=[],void 0===(r="function"==typeof(n=function(){return function e(t,n,a){var r,o,i=window,s="application/octet-stream",l=a||s,c=t,u=!n&&!a&&c,d=document.createElement("a"),m=function(e){return String(e)},p=i.Blob||i.MozBlob||i.WebKitBlob||m,_=n||"download";if(p=p.call?p.bind(i):Blob,"true"===String(this)&&(l=(c=[c,l])[0],c=c[1]),u&&u.length<2048&&(_=u.split("/").pop().split("?")[0],d.href=u,-1!==d.href.indexOf(u))){var g=new XMLHttpRequest;return g.open("GET",u,!0),g.responseType="blob",g.onload=function(t){e(t.target.response,_,s)},setTimeout((function(){g.send()}),0),g}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(c)){if(!(c.length>2096103.424&&p!==m))return navigator.msSaveBlob?navigator.msSaveBlob(E(c),_):f(c);l=(c=E(c)).type||s}else if(/([\x80-\xff])/.test(c)){for(var h=0,y=new Uint8Array(c.length),v=y.length;h<v;++h)y[h]=c.charCodeAt(h);c=new p([y],{type:l})}function E(e){for(var t=e.split(/[:;,]/),n=t[1],a=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),r=a.length,o=0,i=new Uint8Array(r);o<r;++o)i[o]=a.charCodeAt(o);return new p([i],{type:n})}function f(e,t){if("download"in d)return d.href=e,d.setAttribute("download",_),d.className="download-js-link",d.innerHTML="downloading...",d.style.display="none",document.body.appendChild(d),setTimeout((function(){d.click(),document.body.removeChild(d),!0===t&&setTimeout((function(){i.URL.revokeObjectURL(d.href)}),250)}),66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,s)),window.open(e)||confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=e),!0;var n=document.createElement("iframe");document.body.appendChild(n),!t&&/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,s)),n.src=e,setTimeout((function(){document.body.removeChild(n)}),333)}if(r=c instanceof p?c:new p([c],{type:l}),navigator.msSaveBlob)return navigator.msSaveBlob(r,_);if(i.URL)f(i.URL.createObjectURL(r),!0);else{if("string"==typeof r||r.constructor===m)try{return f("data:"+l+";base64,"+i.btoa(r))}catch(e){return f("data:"+l+","+encodeURIComponent(r))}(o=new FileReader).onload=function(e){f(this.result)},o.readAsDataURL(r)}return!0}})?n.apply(t,a):n)||(e.exports=r)},9894:function(e,t,n){var a=n(4827);e.exports=function(e){var t=a(e,"line-height"),n=parseFloat(t,10);if(t===n+""){var r=e.style.lineHeight;e.style.lineHeight=t+"em",t=a(e,"line-height"),n=parseFloat(t,10),r?e.style.lineHeight=r:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(n*=4,n/=3):-1!==t.indexOf("mm")?(n*=96,n/=25.4):-1!==t.indexOf("cm")?(n*=96,n/=2.54):-1!==t.indexOf("in")?n*=96:-1!==t.indexOf("pc")&&(n*=16),n=Math.round(n),"normal"===t){var o=e.nodeName,i=document.createElement(o);i.innerHTML=" ","TEXTAREA"===o.toUpperCase()&&i.setAttribute("rows","1");var s=a(e,"font-size");i.style.fontSize=s,i.style.padding="0px",i.style.border="0px";var l=document.body;l.appendChild(i),n=i.offsetHeight,l.removeChild(i)}return n}},5372:function(e,t,n){"use strict";var a=n(9567);function r(){}function o(){}o.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,o,i){if(i!==a){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:r};return n.PropTypes=n,n}},2652:function(e,t,n){e.exports=n(5372)()},9567:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},5438:function(e,t,n){"use strict";var a,r=this&&this.__extends||(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&(n[a[r]]=e[a[r]])}return n};t.__esModule=!0;var s=n(9196),l=n(2652),c=n(6411),u=n(9894),d="autosize:resized",m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={lineHeight:null},t.textarea=null,t.onResize=function(e){t.props.onResize&&t.props.onResize(e)},t.updateLineHeight=function(){t.textarea&&t.setState({lineHeight:u(t.textarea)})},t.onChange=function(e){var n=t.props.onChange;t.currentValue=e.currentTarget.value,n&&n(e)},t}return r(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props,n=t.maxRows,a=t.async;"number"==typeof n&&this.updateLineHeight(),"number"==typeof n||a?setTimeout((function(){return e.textarea&&c(e.textarea)})):this.textarea&&c(this.textarea),this.textarea&&this.textarea.addEventListener(d,this.onResize)},t.prototype.componentWillUnmount=function(){this.textarea&&(this.textarea.removeEventListener(d,this.onResize),c.destroy(this.textarea))},t.prototype.render=function(){var e=this,t=this.props,n=(t.onResize,t.maxRows),a=(t.onChange,t.style),r=(t.innerRef,t.children),l=i(t,["onResize","maxRows","onChange","style","innerRef","children"]),c=this.state.lineHeight,u=n&&c?c*n:null;return s.createElement("textarea",o({},l,{onChange:this.onChange,style:u?o({},a,{maxHeight:u}):a,ref:function(t){e.textarea=t,"function"==typeof e.props.innerRef?e.props.innerRef(t):e.props.innerRef&&(e.props.innerRef.current=t)}}),r)},t.prototype.componentDidUpdate=function(){this.textarea&&c.update(this.textarea)},t.defaultProps={rows:1,async:!1},t.propTypes={rows:l.number,maxRows:l.number,onResize:l.func,innerRef:l.any,async:l.bool},t}(s.Component);t.TextareaAutosize=s.forwardRef((function(e,t){return s.createElement(m,o({},e,{innerRef:t}))}))},773:function(e,t,n){"use strict";var a=n(5438);t.Z=a.TextareaAutosize},4793:function(e){var t={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Ấ":"A","Ắ":"A","Ẳ":"A","Ẵ":"A","Ặ":"A","Æ":"AE","Ầ":"A","Ằ":"A","Ȃ":"A","Ç":"C","Ḉ":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ế":"E","Ḗ":"E","Ề":"E","Ḕ":"E","Ḝ":"E","Ȇ":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ḯ":"I","Ȋ":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ố":"O","Ṍ":"O","Ṓ":"O","Ȏ":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","ấ":"a","ắ":"a","ẳ":"a","ẵ":"a","ặ":"a","æ":"ae","ầ":"a","ằ":"a","ȃ":"a","ç":"c","ḉ":"c","è":"e","é":"e","ê":"e","ë":"e","ế":"e","ḗ":"e","ề":"e","ḕ":"e","ḝ":"e","ȇ":"e","ì":"i","í":"i","î":"i","ï":"i","ḯ":"i","ȋ":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ố":"o","ṍ":"o","ṓ":"o","ȏ":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","Ċ":"C","ċ":"c","Č":"C","č":"c","C̆":"C","c̆":"c","Ď":"D","ď":"d","Đ":"D","đ":"d","Ē":"E","ē":"e","Ĕ":"E","ĕ":"e","Ė":"E","ė":"e","Ę":"E","ę":"e","Ě":"E","ě":"e","Ĝ":"G","Ǵ":"G","ĝ":"g","ǵ":"g","Ğ":"G","ğ":"g","Ġ":"G","ġ":"g","Ģ":"G","ģ":"g","Ĥ":"H","ĥ":"h","Ħ":"H","ħ":"h","Ḫ":"H","ḫ":"h","Ĩ":"I","ĩ":"i","Ī":"I","ī":"i","Ĭ":"I","ĭ":"i","Į":"I","į":"i","İ":"I","ı":"i","IJ":"IJ","ij":"ij","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","Ḱ":"K","ḱ":"k","K̆":"K","k̆":"k","Ĺ":"L","ĺ":"l","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ŀ":"L","ŀ":"l","Ł":"l","ł":"l","Ḿ":"M","ḿ":"m","M̆":"M","m̆":"m","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","ʼn":"n","N̆":"N","n̆":"n","Ō":"O","ō":"o","Ŏ":"O","ŏ":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","P̆":"P","p̆":"p","Ŕ":"R","ŕ":"r","Ŗ":"R","ŗ":"r","Ř":"R","ř":"r","R̆":"R","r̆":"r","Ȓ":"R","ȓ":"r","Ś":"S","ś":"s","Ŝ":"S","ŝ":"s","Ş":"S","Ș":"S","ș":"s","ş":"s","Š":"S","š":"s","ß":"ss","Ţ":"T","ţ":"t","ț":"t","Ț":"T","Ť":"T","ť":"t","Ŧ":"T","ŧ":"t","T̆":"T","t̆":"t","Ũ":"U","ũ":"u","Ū":"U","ū":"u","Ŭ":"U","ŭ":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ȗ":"U","ȗ":"u","V̆":"V","v̆":"v","Ŵ":"W","ŵ":"w","Ẃ":"W","ẃ":"w","X̆":"X","x̆":"x","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Y̆":"Y","y̆":"y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","ſ":"s","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Ǎ":"A","ǎ":"a","Ǐ":"I","ǐ":"i","Ǒ":"O","ǒ":"o","Ǔ":"U","ǔ":"u","Ǖ":"U","ǖ":"u","Ǘ":"U","ǘ":"u","Ǚ":"U","ǚ":"u","Ǜ":"U","ǜ":"u","Ứ":"U","ứ":"u","Ṹ":"U","ṹ":"u","Ǻ":"A","ǻ":"a","Ǽ":"AE","ǽ":"ae","Ǿ":"O","ǿ":"o","Þ":"TH","þ":"th","Ṕ":"P","ṕ":"p","Ṥ":"S","ṥ":"s","X́":"X","x́":"x","Ѓ":"Г","ѓ":"г","Ќ":"К","ќ":"к","A̋":"A","a̋":"a","E̋":"E","e̋":"e","I̋":"I","i̋":"i","Ǹ":"N","ǹ":"n","Ồ":"O","ồ":"o","Ṑ":"O","ṑ":"o","Ừ":"U","ừ":"u","Ẁ":"W","ẁ":"w","Ỳ":"Y","ỳ":"y","Ȁ":"A","ȁ":"a","Ȅ":"E","ȅ":"e","Ȉ":"I","ȉ":"i","Ȍ":"O","ȍ":"o","Ȑ":"R","ȑ":"r","Ȕ":"U","ȕ":"u","B̌":"B","b̌":"b","Č̣":"C","č̣":"c","Ê̌":"E","ê̌":"e","F̌":"F","f̌":"f","Ǧ":"G","ǧ":"g","Ȟ":"H","ȟ":"h","J̌":"J","ǰ":"j","Ǩ":"K","ǩ":"k","M̌":"M","m̌":"m","P̌":"P","p̌":"p","Q̌":"Q","q̌":"q","Ř̩":"R","ř̩":"r","Ṧ":"S","ṧ":"s","V̌":"V","v̌":"v","W̌":"W","w̌":"w","X̌":"X","x̌":"x","Y̌":"Y","y̌":"y","A̧":"A","a̧":"a","B̧":"B","b̧":"b","Ḑ":"D","ḑ":"d","Ȩ":"E","ȩ":"e","Ɛ̧":"E","ɛ̧":"e","Ḩ":"H","ḩ":"h","I̧":"I","i̧":"i","Ɨ̧":"I","ɨ̧":"i","M̧":"M","m̧":"m","O̧":"O","o̧":"o","Q̧":"Q","q̧":"q","U̧":"U","u̧":"u","X̧":"X","x̧":"x","Z̧":"Z","z̧":"z","й":"и","Й":"И","ё":"е","Ё":"Е"},n=Object.keys(t).join("|"),a=new RegExp(n,"g"),r=new RegExp(n,"");function o(e){return t[e]}var i=function(e){return e.replace(a,o)};e.exports=i,e.exports.has=function(e){return!!e.match(r)},e.exports.remove=i},9196:function(e){"use strict";e.exports=window.React},7153:function(e,t){var n; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(){"use strict";var a={}.hasOwnProperty;function r(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,o(n)))}return e}function o(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)a.call(e,n)&&e[n]&&(t=i(t,n));return t}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()}},t={};function n(a){var r=t[a];if(void 0!==r)return r.exports;var o=t[a]={exports:{}};return e[a].call(o.exports,o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};!function(){"use strict";n.r(a),n.d(a,{PluginMoreMenuItem:function(){return vp},PluginSidebar:function(){return hp},PluginSidebarMoreMenuItem:function(){return yp},PluginTemplateSettingPanel:function(){return Mc},initializeEditor:function(){return Ep},reinitializeEditor:function(){return fp}});var e={};n.r(e),n.d(e,{closeModal:function(){return A},disableComplementaryArea:function(){return M},enableComplementaryArea:function(){return N},openModal:function(){return L},pinItem:function(){return P},setDefaultComplementaryArea:function(){return T},setFeatureDefaults:function(){return R},setFeatureValue:function(){return D},toggleFeature:function(){return B},unpinItem:function(){return I}});var t={};n.r(t),n.d(t,{getActiveComplementaryArea:function(){return F},isComplementaryAreaLoading:function(){return V},isFeatureActive:function(){return O},isItemPinned:function(){return z},isModalActive:function(){return H}});var r={};n.r(r),n.d(r,{__experimentalSetPreviewDeviceType:function(){return Ht},addTemplate:function(){return Ut},closeGeneralSidebar:function(){return sn},openGeneralSidebar:function(){return on},openNavigationPanelToMenu:function(){return Qt},removeTemplate:function(){return $t},revertTemplate:function(){return rn},setEditedEntity:function(){return Zt},setEditedPostContext:function(){return Yt},setHasPageContentFocus:function(){return cn},setHomeTemplateId:function(){return qt},setIsInserterOpened:function(){return en},setIsListViewOpened:function(){return nn},setIsNavigationPanelOpened:function(){return Jt},setIsSaveViewOpened:function(){return an},setNavigationMenu:function(){return Wt},setNavigationPanelActiveMenu:function(){return Xt},setPage:function(){return Kt},setTemplate:function(){return Gt},setTemplatePart:function(){return jt},switchEditorMode:function(){return ln},toggleFeature:function(){return Ot},updateSettings:function(){return tn}});var o={};n.r(o),n.d(o,{setCanvasMode:function(){return un},setEditorCanvasContainerView:function(){return dn}});var i={};n.r(i),n.d(i,{__experimentalGetInsertionPoint:function(){return Mn},__experimentalGetPreviewDeviceType:function(){return En},__unstableGetPreference:function(){return yn},getCanUserCreateMedia:function(){return fn},getCurrentTemplateNavigationPanelSubMenu:function(){return Rn},getCurrentTemplateTemplateParts:function(){return Bn},getEditedPostContext:function(){return xn},getEditedPostId:function(){return Cn},getEditedPostType:function(){return kn},getEditorMode:function(){return Dn},getHomeTemplateId:function(){return Sn},getNavigationPanelActiveMenu:function(){return Ln},getPage:function(){return Tn},getReusableBlocks:function(){return bn},getSettings:function(){return wn},hasPageContentFocus:function(){return Vn},isFeatureActive:function(){return vn},isInserterOpened:function(){return Nn},isListViewOpened:function(){return Pn},isNavigationOpened:function(){return An},isPage:function(){return Fn},isSaveViewOpened:function(){return In}});var s={};n.r(s),n.d(s,{getCanvasMode:function(){return zn},getEditorCanvasContainerView:function(){return On}});var l=window.wp.element,c=window.wp.blocks,u=window.wp.blockLibrary,d=window.wp.data,m=window.wp.deprecated,p=n.n(m),_=window.wp.coreData,g=window.wp.editor,h=n(7153),y=n.n(h),v=window.wp.components,E=window.wp.i18n,f=window.wp.primitives;var b=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));var w=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"}));var S=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})),k=window.wp.viewport;var C=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})),x=window.wp.preferences;const T=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),N=(e,t)=>({registry:n,dispatch:a})=>{if(!t)return;n.select(x.store).get(e,"isComplementaryAreaVisible")||n.dispatch(x.store).set(e,"isComplementaryAreaVisible",!0),a({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},M=e=>({registry:t})=>{t.select(x.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(x.store).set(e,"isComplementaryAreaVisible",!1)},P=(e,t)=>({registry:n})=>{if(!t)return;const a=n.select(x.store).get(e,"pinnedItems");!0!==a?.[t]&&n.dispatch(x.store).set(e,"pinnedItems",{...a,[t]:!0})},I=(e,t)=>({registry:n})=>{if(!t)return;const a=n.select(x.store).get(e,"pinnedItems");n.dispatch(x.store).set(e,"pinnedItems",{...a,[t]:!1})};function B(e,t){return function({registry:n}){p()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),n.dispatch(x.store).toggle(e,t)}}function D(e,t,n){return function({registry:a}){p()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),a.dispatch(x.store).set(e,t,!!n)}}function R(e,t){return function({registry:n}){p()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),n.dispatch(x.store).setDefaults(e,t)}}function L(e){return{type:"OPEN_MODAL",name:e}}function A(){return{type:"CLOSE_MODAL"}}const F=(0,d.createRegistrySelector)((e=>(t,n)=>{const a=e(x.store).get(n,"isComplementaryAreaVisible");if(void 0!==a)return!1===a?null:t?.complementaryAreas?.[n]})),V=(0,d.createRegistrySelector)((e=>(t,n)=>{const a=e(x.store).get(n,"isComplementaryAreaVisible"),r=t?.complementaryAreas?.[n];return a&&void 0===r})),z=(0,d.createRegistrySelector)((e=>(t,n,a)=>{var r;const o=e(x.store).get(n,"pinnedItems");return null===(r=o?.[a])||void 0===r||r})),O=(0,d.createRegistrySelector)((e=>(t,n,a)=>(p()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(x.store).get(n,a))));function H(e,t){return e.activeModal===t}var G=(0,d.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:n,area:a}=t;return e[n]?e:{...e,[n]:a}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:n,area:a}=t;return{...e,[n]:a}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}});const U=(0,d.createReduxStore)("core/interface",{reducer:G,actions:e,selectors:t});(0,d.register)(U);var $=window.wp.plugins,j=(0,$.withPluginContext)(((e,t)=>({icon:t.icon||e.icon,identifier:t.identifier||`${e.name}/${t.name}`})));var W=j((function({as:e=v.Button,scope:t,identifier:n,icon:a,selectedIcon:r,name:o,...i}){const s=e,c=(0,d.useSelect)((e=>e(U).getActiveComplementaryArea(t)===n),[n]),{enableComplementaryArea:u,disableComplementaryArea:m}=(0,d.useDispatch)(U);return(0,l.createElement)(s,{icon:r&&c?r:a,onClick:()=>{c?m(t):u(t,n)},...i})}));var Z=({smallScreenTitle:e,children:t,className:n,toggleButtonProps:a})=>{const r=(0,l.createElement)(W,{icon:C,...a});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"components-panel__header interface-complementary-area-header__small"},e&&(0,l.createElement)("span",{className:"interface-complementary-area-header__small-title"},e),r),(0,l.createElement)("div",{className:y()("components-panel__header","interface-complementary-area-header",n),tabIndex:-1},t,r))};const q=()=>{};function Y({name:e,as:t=v.Button,onClick:n,...a}){return(0,l.createElement)(v.Fill,{name:e},(({onClick:e})=>(0,l.createElement)(t,{onClick:n||e?(...t)=>{(n||q)(...t),(e||q)(...t)}:void 0,...a})))}Y.Slot=function({name:e,as:t=v.ButtonGroup,fillProps:n={},bubblesVirtually:a,...r}){return(0,l.createElement)(v.Slot,{name:e,bubblesVirtually:a,fillProps:n},(e=>{if(!l.Children.toArray(e).length)return null;const n=[];l.Children.forEach(e,(({props:{__unstableExplicitMenuItem:e,__unstableTarget:t}})=>{t&&e&&n.push(t)}));const a=l.Children.map(e,(e=>!e.props.__unstableExplicitMenuItem&&n.includes(e.props.__unstableTarget)?null:e));return(0,l.createElement)(t,{...r},a)}))};var K=Y;const X=({__unstableExplicitMenuItem:e,__unstableTarget:t,...n})=>(0,l.createElement)(v.MenuItem,{...n});function Q({scope:e,target:t,__unstableExplicitMenuItem:n,...a}){return(0,l.createElement)(W,{as:a=>(0,l.createElement)(K,{__unstableExplicitMenuItem:n,__unstableTarget:`${e}/${t}`,as:X,name:`${e}/plugin-more-menu`,...a}),role:"menuitemcheckbox",selectedIcon:b,name:t,scope:e,...a})}function J({scope:e,...t}){return(0,l.createElement)(v.Fill,{name:`PinnedItems/${e}`,...t})}J.Slot=function({scope:e,className:t,...n}){return(0,l.createElement)(v.Slot,{name:`PinnedItems/${e}`,...n},(e=>e?.length>0&&(0,l.createElement)("div",{className:y()(t,"interface-pinned-items")},e)))};var ee=J;function te({scope:e,children:t,className:n}){return(0,l.createElement)(v.Fill,{name:`ComplementaryArea/${e}`},(0,l.createElement)("div",{className:n},t))}const ne=j((function({children:e,className:t,closeLabel:n=(0,E.__)("Close plugin"),identifier:a,header:r,headerClassName:o,icon:i,isPinnable:s=!0,panelClassName:c,scope:u,name:m,smallScreenTitle:p,title:_,toggleShortcut:g,isActiveByDefault:h,showIconLabels:f=!1}){const{isLoading:C,isActive:x,isPinned:T,activeArea:N,isSmall:M,isLarge:P}=(0,d.useSelect)((e=>{const{getActiveComplementaryArea:t,isComplementaryAreaLoading:n,isItemPinned:r}=e(U),o=t(u);return{isLoading:n(u),isActive:o===a,isPinned:r(u,a),activeArea:o,isSmall:e(k.store).isViewportMatch("< medium"),isLarge:e(k.store).isViewportMatch("large")}}),[a,u]);!function(e,t,n,a,r){const o=(0,l.useRef)(!1),i=(0,l.useRef)(!1),{enableComplementaryArea:s,disableComplementaryArea:c}=(0,d.useDispatch)(U);(0,l.useEffect)((()=>{a&&r&&!o.current?(c(e),i.current=!0):i.current&&!r&&o.current?(i.current=!1,s(e,t)):i.current&&n&&n!==t&&(i.current=!1),r!==o.current&&(o.current=r)}),[a,r,e,t,n])}(u,a,N,x,M);const{enableComplementaryArea:I,disableComplementaryArea:B,pinItem:D,unpinItem:R}=(0,d.useDispatch)(U);return(0,l.useEffect)((()=>{h&&void 0===N&&!M?I(u,a):void 0===N&&M&&B(u,a)}),[N,h,u,a,M]),(0,l.createElement)(l.Fragment,null,s&&(0,l.createElement)(ee,{scope:u},T&&(0,l.createElement)(W,{scope:u,identifier:a,isPressed:x&&(!f||P),"aria-expanded":x,"aria-disabled":C,label:_,icon:f?b:i,showTooltip:!f,variant:f?"tertiary":void 0})),m&&s&&(0,l.createElement)(Q,{target:m,scope:u,icon:i},_),x&&(0,l.createElement)(te,{className:y()("interface-complementary-area",t),scope:u},(0,l.createElement)(Z,{className:o,closeLabel:n,onClose:()=>B(u),smallScreenTitle:p,toggleButtonProps:{label:n,shortcut:g,scope:u,identifier:a}},r||(0,l.createElement)(l.Fragment,null,(0,l.createElement)("strong",null,_),s&&(0,l.createElement)(v.Button,{className:"interface-complementary-area__pin-unpin-item",icon:T?w:S,label:T?(0,E.__)("Unpin from toolbar"):(0,E.__)("Pin to toolbar"),onClick:()=>(T?R:D)(u,a),isPressed:T,"aria-expanded":T}))),(0,l.createElement)(v.Panel,{className:c},e)))}));ne.Slot=function({scope:e,...t}){return(0,l.createElement)(v.Slot,{name:`ComplementaryArea/${e}`,...t})};var ae=ne,re=window.wp.compose;function oe({children:e,className:t,ariaLabel:n,as:a="div",...r}){return(0,l.createElement)(a,{className:y()("interface-navigable-region",t),"aria-label":n,role:"region",tabIndex:"-1",...r},e)}const ie={hidden:{opacity:0},hover:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},distractionFreeInactive:{opacity:1,transition:{delay:0}}};var se=(0,l.forwardRef)((function({isDistractionFree:e,footer:t,header:n,editorNotices:a,sidebar:r,secondarySidebar:o,notices:i,content:s,actions:c,labels:u,className:d,enableRegionNavigation:m=!0,shortcuts:p},_){const g=(0,v.__unstableUseNavigateRegions)(p);!function(e){(0,l.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const h={...{header:(0,E.__)("Header"),body:(0,E.__)("Content"),secondarySidebar:(0,E.__)("Block Library"),sidebar:(0,E.__)("Settings"),actions:(0,E.__)("Publish"),footer:(0,E.__)("Footer")},...u};return(0,l.createElement)("div",{...m?g:{},ref:(0,re.useMergeRefs)([_,m?g.ref:void 0]),className:y()(d,"interface-interface-skeleton",g.className,!!t&&"has-footer")},(0,l.createElement)("div",{className:"interface-interface-skeleton__editor"},!!n&&(0,l.createElement)(oe,{as:v.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":h.header,initial:e?"hidden":"distractionFreeInactive",whileHover:e?"hover":"distractionFreeInactive",animate:e?"hidden":"distractionFreeInactive",variants:ie,transition:e?{type:"tween",delay:.8}:void 0},n),e&&(0,l.createElement)("div",{className:"interface-interface-skeleton__header"},a),(0,l.createElement)("div",{className:"interface-interface-skeleton__body"},!!o&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:h.secondarySidebar},o),!!i&&(0,l.createElement)("div",{className:"interface-interface-skeleton__notices"},i),(0,l.createElement)(oe,{className:"interface-interface-skeleton__content",ariaLabel:h.body},s),!!r&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__sidebar",ariaLabel:h.sidebar},r),!!c&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__actions",ariaLabel:h.actions},c))),!!t&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__footer",ariaLabel:h.footer},t))}));var le=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function ce({as:e=v.DropdownMenu,className:t,label:n=(0,E.__)("Options"),popoverProps:a,toggleProps:r,children:o}){return(0,l.createElement)(e,{className:y()("interface-more-menu-dropdown",t),icon:le,label:n,popoverProps:{placement:"bottom-end",...a,className:y()("interface-more-menu-dropdown__content",a?.className)},toggleProps:{tooltipPosition:"bottom",...r}},(e=>o(e)))}function ue({closeModal:e,children:t}){return(0,l.createElement)(v.Modal,{className:"interface-preferences-modal",title:(0,E.__)("Preferences"),onRequestClose:e},t)}var de=function({icon:e,size:t=24,...n}){return(0,l.cloneElement)(e,{width:t,height:t,...n})};var me=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"}));var pe=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"}));const _e="preferences-menu";function ge({sections:e}){const t=(0,re.useViewportMatch)("medium"),[n,a]=(0,l.useState)(_e),{tabs:r,sectionsContentMap:o}=(0,l.useMemo)((()=>{let t={tabs:[],sectionsContentMap:{}};return e.length&&(t=e.reduce(((e,{name:t,tabLabel:n,content:a})=>(e.tabs.push({name:t,title:n}),e.sectionsContentMap[t]=a,e)),{tabs:[],sectionsContentMap:{}})),t}),[e]),i=(0,l.useCallback)((e=>o[e.name]||null),[o]);let s;return s=t?(0,l.createElement)(v.TabPanel,{className:"interface-preferences__tabs",tabs:r,initialTabName:n!==_e?n:void 0,onSelect:a,orientation:"vertical"},i):(0,l.createElement)(v.__experimentalNavigatorProvider,{initialPath:"/",className:"interface-preferences__provider"},(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/"},(0,l.createElement)(v.Card,{isBorderless:!0,size:"small"},(0,l.createElement)(v.CardBody,null,(0,l.createElement)(v.__experimentalItemGroup,null,r.map((e=>(0,l.createElement)(v.__experimentalNavigatorButton,{key:e.name,path:e.name,as:v.__experimentalItem,isAction:!0},(0,l.createElement)(v.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(v.FlexItem,null,(0,l.createElement)(v.__experimentalTruncate,null,e.title)),(0,l.createElement)(v.FlexItem,null,(0,l.createElement)(de,{icon:(0,E.isRTL)()?me:pe})))))))))),e.length&&e.map((e=>(0,l.createElement)(v.__experimentalNavigatorScreen,{key:`${e.name}-menu`,path:e.name},(0,l.createElement)(v.Card,{isBorderless:!0,size:"large"},(0,l.createElement)(v.CardHeader,{isBorderless:!1,justify:"left",size:"small",gap:"6"},(0,l.createElement)(v.__experimentalNavigatorBackButton,{icon:(0,E.isRTL)()?pe:me,"aria-label":(0,E.__)("Navigate to the previous view")}),(0,l.createElement)(v.__experimentalText,{size:"16"},e.tabLabel)),(0,l.createElement)(v.CardBody,null,e.content)))))),s}var he=({description:e,title:t,children:n})=>(0,l.createElement)("fieldset",{className:"interface-preferences-modal__section"},(0,l.createElement)("legend",{className:"interface-preferences-modal__section-legend"},(0,l.createElement)("h2",{className:"interface-preferences-modal__section-title"},t),e&&(0,l.createElement)("p",{className:"interface-preferences-modal__section-description"},e)),n);var ye=function({help:e,label:t,isChecked:n,onChange:a,children:r}){return(0,l.createElement)("div",{className:"interface-preferences-modal__option"},(0,l.createElement)(v.ToggleControl,{__nextHasNoMarginBottom:!0,help:e,label:t,checked:n,onChange:a}),r)},ve=window.wp.widgets,Ee=window.wp.hooks,fe=window.wp.mediaUtils;(0,Ee.addFilter)("editor.MediaUpload","core/edit-site/components/media-upload",(()=>fe.MediaUpload));var be=window.lodash,we=window.wp.blockEditor,Se=window.wp.notices,ke={grad:.9,turn:360,rad:360/(2*Math.PI)},Ce=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},xe=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Te=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},Ne=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Me=function(e){return{r:Te(e.r,0,255),g:Te(e.g,0,255),b:Te(e.b,0,255),a:Te(e.a)}},Pe=function(e){return{r:xe(e.r),g:xe(e.g),b:xe(e.b),a:xe(e.a,3)}},Ie=/^#([0-9a-f]{3,8})$/i,Be=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},De=function(e){var t=e.r,n=e.g,a=e.b,r=e.a,o=Math.max(t,n,a),i=o-Math.min(t,n,a),s=i?o===t?(n-a)/i:o===n?2+(a-t)/i:4+(t-n)/i:0;return{h:60*(s<0?s+6:s),s:o?i/o*100:0,v:o/255*100,a:r}},Re=function(e){var t=e.h,n=e.s,a=e.v,r=e.a;t=t/360*6,n/=100,a/=100;var o=Math.floor(t),i=a*(1-n),s=a*(1-(t-o)*n),l=a*(1-(1-t+o)*n),c=o%6;return{r:255*[a,s,i,i,l,a][c],g:255*[l,a,a,s,i,i][c],b:255*[i,i,l,a,a,s][c],a:r}},Le=function(e){return{h:Ne(e.h),s:Te(e.s,0,100),l:Te(e.l,0,100),a:Te(e.a)}},Ae=function(e){return{h:xe(e.h),s:xe(e.s),l:xe(e.l),a:xe(e.a,3)}},Fe=function(e){return Re((n=(t=e).s,{h:t.h,s:(n*=((a=t.l)<50?a:100-a)/100)>0?2*n/(a+n)*100:0,v:a+n,a:t.a}));var t,n,a},Ve=function(e){return{h:(t=De(e)).h,s:(r=(200-(n=t.s))*(a=t.v)/100)>0&&r<200?n*a/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,n,a,r},ze=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Oe=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,He=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ge=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ue={string:[[function(e){var t=Ie.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?xe(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?xe(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=He.exec(e)||Ge.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Me({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=ze.exec(e)||Oe.exec(e);if(!t)return null;var n,a,r=Le({h:(n=t[1],a=t[2],void 0===a&&(a="deg"),Number(n)*(ke[a]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return Fe(r)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,a=e.b,r=e.a,o=void 0===r?1:r;return Ce(t)&&Ce(n)&&Ce(a)?Me({r:Number(t),g:Number(n),b:Number(a),a:Number(o)}):null},"rgb"],[function(e){var t=e.h,n=e.s,a=e.l,r=e.a,o=void 0===r?1:r;if(!Ce(t)||!Ce(n)||!Ce(a))return null;var i=Le({h:Number(t),s:Number(n),l:Number(a),a:Number(o)});return Fe(i)},"hsl"],[function(e){var t=e.h,n=e.s,a=e.v,r=e.a,o=void 0===r?1:r;if(!Ce(t)||!Ce(n)||!Ce(a))return null;var i=function(e){return{h:Ne(e.h),s:Te(e.s,0,100),v:Te(e.v,0,100),a:Te(e.a)}}({h:Number(t),s:Number(n),v:Number(a),a:Number(o)});return Re(i)},"hsv"]]},$e=function(e,t){for(var n=0;n<t.length;n++){var a=t[n][0](e);if(a)return[a,t[n][1]]}return[null,void 0]},je=function(e){return"string"==typeof e?$e(e.trim(),Ue.string):"object"==typeof e&&null!==e?$e(e,Ue.object):[null,void 0]},We=function(e,t){var n=Ve(e);return{h:n.h,s:Te(n.s+100*t,0,100),l:n.l,a:n.a}},Ze=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},qe=function(e,t){var n=Ve(e);return{h:n.h,s:n.s,l:Te(n.l+100*t,0,100),a:n.a}},Ye=function(){function e(e){this.parsed=je(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return xe(Ze(this.rgba),2)},e.prototype.isDark=function(){return Ze(this.rgba)<.5},e.prototype.isLight=function(){return Ze(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=Pe(this.rgba)).r,n=e.g,a=e.b,o=(r=e.a)<1?Be(xe(255*r)):"","#"+Be(t)+Be(n)+Be(a)+o;var e,t,n,a,r,o},e.prototype.toRgb=function(){return Pe(this.rgba)},e.prototype.toRgbString=function(){return t=(e=Pe(this.rgba)).r,n=e.g,a=e.b,(r=e.a)<1?"rgba("+t+", "+n+", "+a+", "+r+")":"rgb("+t+", "+n+", "+a+")";var e,t,n,a,r},e.prototype.toHsl=function(){return Ae(Ve(this.rgba))},e.prototype.toHslString=function(){return t=(e=Ae(Ve(this.rgba))).h,n=e.s,a=e.l,(r=e.a)<1?"hsla("+t+", "+n+"%, "+a+"%, "+r+")":"hsl("+t+", "+n+"%, "+a+"%)";var e,t,n,a,r},e.prototype.toHsv=function(){return e=De(this.rgba),{h:xe(e.h),s:xe(e.s),v:xe(e.v),a:xe(e.a,3)};var e},e.prototype.invert=function(){return Ke({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Ke(We(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Ke(We(this.rgba,-e))},e.prototype.grayscale=function(){return Ke(We(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Ke(qe(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Ke(qe(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Ke({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):xe(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=Ve(this.rgba);return"number"==typeof e?Ke({h:e,s:t.s,l:t.l,a:t.a}):xe(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Ke(e).toHex()},e}(),Ke=function(e){return e instanceof Ye?e:new Ye(e)},Xe=[],Qe=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},Je=function(e){return.2126*Qe(e.r)+.7152*Qe(e.g)+.0722*Qe(e.b)};var et=window.wp.privateApis;const{lock:tt,unlock:nt}=(0,et.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.","@wordpress/edit-site"),{useGlobalSetting:at}=nt(we.privateApis);!function(e){e.forEach((function(e){Xe.indexOf(e)<0&&(e(Ye,Ue),Xe.push(e))}))}([function(e){e.prototype.luminance=function(){return e=Je(this.rgba),void 0===(t=2)&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0;var e,t,n},e.prototype.contrast=function(t){void 0===t&&(t="#FFF");var n,a,r,o,i,s,l,c=t instanceof e?t:new e(t);return o=this.rgba,i=c.toRgb(),n=(s=Je(o))>(l=Je(i))?(s+.05)/(l+.05):(l+.05)/(s+.05),void 0===(a=2)&&(a=0),void 0===r&&(r=Math.pow(10,a)),Math.floor(r*n)/r+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(i=void 0===(o=(n=t).size)?"normal":o,"AAA"===(r=void 0===(a=n.level)?"AA":a)&&"normal"===i?7:"AA"===r&&"large"===i?3:4.5);var n,a,r,o,i}}]);const{cleanEmptyObject:rt,GlobalStylesContext:ot,useBlockEditingMode:it}=nt(we.privateApis),st={...c.__EXPERIMENTAL_STYLE_PROPERTY,blockGap:{value:["spacing","blockGap"]}},lt={"border.color":"color","color.background":"color","color.text":"color","elements.link.color.text":"color","elements.link.:hover.color.text":"color","elements.link.typography.fontFamily":"font-family","elements.link.typography.fontSize":"font-size","elements.button.color.text":"color","elements.button.color.background":"color","elements.button.typography.fontFamily":"font-family","elements.button.typography.fontSize":"font-size","elements.caption.color.text":"color","elements.heading.color":"color","elements.heading.color.background":"color","elements.heading.typography.fontFamily":"font-family","elements.heading.gradient":"gradient","elements.heading.color.gradient":"gradient","elements.h1.color":"color","elements.h1.color.background":"color","elements.h1.typography.fontFamily":"font-family","elements.h1.color.gradient":"gradient","elements.h2.color":"color","elements.h2.color.background":"color","elements.h2.typography.fontFamily":"font-family","elements.h2.color.gradient":"gradient","elements.h3.color":"color","elements.h3.color.background":"color","elements.h3.typography.fontFamily":"font-family","elements.h3.color.gradient":"gradient","elements.h4.color":"color","elements.h4.color.background":"color","elements.h4.typography.fontFamily":"font-family","elements.h4.color.gradient":"gradient","elements.h5.color":"color","elements.h5.color.background":"color","elements.h5.typography.fontFamily":"font-family","elements.h5.color.gradient":"gradient","elements.h6.color":"color","elements.h6.color.background":"color","elements.h6.typography.fontFamily":"font-family","elements.h6.color.gradient":"gradient","color.gradient":"gradient",blockGap:"spacing","typography.fontSize":"font-size","typography.fontFamily":"font-family"},ct={"border.color":"borderColor","color.background":"backgroundColor","color.text":"textColor","color.gradient":"gradient","typography.fontSize":"fontSize","typography.fontFamily":"fontFamily"},ut=["border","color","spacing","typography"],dt=["borderColor","borderWidth","borderStyle"],mt=["top","right","bottom","left"];function pt(e,t,n){if(!t?.[e]||n?.[e]?.style)return[];const{color:a,style:r,width:o}=t[e];return!(a||o)||r?[]:[{path:["border",e,"style"],value:"solid"}]}function _t(e,t,n){const a=function(e,t){const{supportedPanels:n}=(0,d.useSelect)((n=>({supportedPanels:nt(n(c.store)).getSupportedStyles(e,t)})),[e,t]);return n}(e),r=n?.styles?.blocks?.[e];return(0,l.useMemo)((()=>{const e=a.flatMap((e=>{if(!st[e])return[];const{value:n}=st[e],a=n.join("."),r=t[ct[a]],o=r?`var:preset|${lt[a]}|${r}`:(0,be.get)(t.style,n);if("linkColor"===e){const e=o?[{path:n,value:o}]:[],a=["elements","link",":hover","color","text"],r=(0,be.get)(t.style,a);return r&&e.push({path:a,value:r}),e}if(dt.includes(e)&&o){const e=[{path:n,value:o}];return mt.forEach((t=>{const a=[...n];a.splice(-1,0,t),e.push({path:a,value:o})})),e}return o?[{path:n,value:o}]:[]}));return function(e,t,n){if(!e&&!t)return[];const a=[...pt("top",e,n),...pt("right",e,n),...pt("bottom",e,n),...pt("left",e,n)],{color:r,style:o,width:i}=e||{};return(t||r||i)&&!o&&mt.forEach((e=>{n?.[e]?.style||a.push({path:["border",e,"style"],value:"solid"})})),a}(t.style?.border,t.borderColor,r?.border).forEach((t=>e.push(t))),e}),[a,t,r])}function gt(e){return e?JSON.parse(JSON.stringify(e)):{}}function ht({name:e,attributes:t,setAttributes:n}){const{user:a,setUserConfig:r}=(0,l.useContext)(ot),o=_t(e,t,a),{__unstableMarkNextChangeAsNotPersistent:i}=(0,d.useDispatch)(we.store),{createSuccessNotice:s}=(0,d.useDispatch)(Se.store),u=(0,l.useCallback)((()=>{if(0===o.length)return;const{style:l}=t,u=gt(l),d=gt(a);for(const{path:t,value:n}of o)(0,be.set)(u,t,void 0),(0,be.set)(d,["styles","blocks",e,...t],n);const m={borderColor:void 0,backgroundColor:void 0,textColor:void 0,gradient:void 0,fontSize:void 0,fontFamily:void 0,style:rt(u)};i(),n(m),r((()=>d),{undoIgnore:!0}),s((0,E.sprintf)((0,E.__)("%s styles applied."),(0,c.getBlockType)(e).title),{type:"snackbar",actions:[{label:(0,E.__)("Undo"),onClick(){i(),n(t),r((()=>a),{undoIgnore:!0})}}]})}),[i,t,o,s,e,n,r,a]);return(0,l.createElement)(v.BaseControl,{className:"edit-site-push-changes-to-global-styles-control",help:(0,E.sprintf)((0,E.__)("Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks."),(0,c.getBlockType)(e).title)},(0,l.createElement)(v.BaseControl.VisualLabel,null,(0,E.__)("Styles")),(0,l.createElement)(v.Button,{variant:"primary",disabled:0===o.length,onClick:u},(0,E.__)("Apply globally")))}const yt=(0,re.createHigherOrderComponent)((e=>t=>{const n=it(),a=ut.some((e=>(0,c.hasBlockSupport)(t.name,e)));return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{...t}),"default"===n&&a&&(0,l.createElement)(we.InspectorAdvancedControls,null,(0,l.createElement)(ht,{...t})))}));(0,Ee.addFilter)("editor.BlockEdit","core/edit-site/push-changes-to-global-styles",yt);var vt=window.wp.router,Et=window.wp.url;function ft(){return void 0!==(0,Et.getQueryArg)(window.location.href,"wp_theme_preview")}function bt(){return ft()?(0,Et.getQueryArg)(window.location.href,"wp_theme_preview"):null}const{useHistory:wt}=nt(vt.privateApis);function St(e={},t,n=!1){const a=wt();const r=(0,Et.getQueryArgs)(window.location.href),o=(0,Et.removeQueryArgs)(window.location.href,...Object.keys(r));ft()&&(e={...e,wp_theme_preview:bt()});return{href:(0,Et.addQueryArgs)(o,e),onClick:function(r){r.preventDefault(),n?a.replace(e,t):a.push(e,t)}}}function kt({params:e={},state:t,replace:n=!1,children:a,...r}){const{href:o,onClick:i}=St(e,t,n);return(0,l.createElement)("a",{href:o,onClick:i,...r},a)}const{useLocation:Ct}=nt(vt.privateApis);function xt({attributes:e}){const{theme:t,slug:n}=e,{params:a}=Ct(),r=(0,d.useSelect)((e=>e(_.store).getEntityRecord("postType","wp_template_part",`${t}//${n}`)),[t,n]),o=St({postId:r?.id,postType:r?.type,canvas:"edit"},{fromTemplateId:a.postId});return r?(0,l.createElement)(we.BlockControls,{group:"other"},(0,l.createElement)(v.ToolbarButton,{...o,onClick:e=>{o.onClick(e)}},(0,E.__)("Edit"))):null}const Tt=(0,re.createHigherOrderComponent)((e=>t=>{const{attributes:n,name:a}=t,r="core/template-part"===a&&n.slug;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{...t}),r&&(0,l.createElement)(xt,{attributes:n}))}),"withEditBlockControls");(0,Ee.addFilter)("editor.BlockEdit","core/edit-site/template-part-edit-button",Tt);const{useLocation:Nt}=nt(vt.privateApis),{useBlockEditingMode:Mt}=nt(we.privateApis);function Pt({attributes:e}){const{ref:t}=e,{params:n}=Nt(),a=Mt(),r=(0,d.useSelect)((e=>e(_.store).getEntityRecord("postType","wp_navigation",t)),[t]),o=St({postId:r?.id,postType:r?.type,canvas:"edit"},{fromTemplateId:n.postId});return r&&"default"===a?(0,l.createElement)(we.BlockControls,{group:"other"},(0,l.createElement)(v.ToolbarButton,{...o,onClick:e=>{o.onClick(e)}},(0,E.__)("Edit"))):null}const It=(0,re.createHigherOrderComponent)((e=>t=>{const{attributes:n,name:a}=t,r="core/navigation"===a&&n.ref;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(e,{...t}),r&&(0,l.createElement)(Pt,{attributes:n}))}),"withEditBlockControls");(0,Ee.addFilter)("editor.BlockEdit","core/edit-site/navigation-edit-button",It);var Bt=(0,d.combineReducers)({deviceType:function(e="Desktop",t){return"SET_PREVIEW_DEVICE_TYPE"===t.type?t.deviceType:e},settings:function(e={},t){return"UPDATE_SETTINGS"===t.type?{...e,...t.settings}:e},editedPost:function(e={},t){switch(t.type){case"SET_EDITED_POST":return{postType:t.postType,id:t.id,context:t.context};case"SET_EDITED_POST_CONTEXT":return{...e,context:t.context}}return e},blockInserterPanel:function(e=!1,t){switch(t.type){case"SET_IS_LIST_VIEW_OPENED":return!t.isOpen&&e;case"SET_IS_INSERTER_OPENED":return t.value;case"SET_CANVAS_MODE":return!1}return e},listViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_INSERTER_OPENED":return!t.value&&e;case"SET_IS_LIST_VIEW_OPENED":return t.isOpen;case"SET_CANVAS_MODE":return!1}return e},saveViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_SAVE_VIEW_OPENED":return t.isOpen;case"SET_CANVAS_MODE":return!1}return e},canvasMode:function(e="init",t){return"SET_CANVAS_MODE"===t.type?t.mode:e},editorCanvasContainerView:function(e=void 0,t){return"SET_EDITOR_CANVAS_CONTAINER_VIEW"===t.type?t.view:e},hasPageContentFocus:function(e=!1,t){switch(t.type){case"SET_EDITED_POST":return!!t.context?.postId;case"SET_HAS_PAGE_CONTENT_FOCUS":return t.hasPageContentFocus}return e}}),Dt=window.wp.apiFetch,Rt=n.n(Dt),Lt=window.wp.a11y,At=window.wp.htmlEntities;const Ft="core/edit-site",Vt="uncategorized";function zt(e){return!!e&&("custom"===e?.source&&e?.has_theme_file)}function Ot(e){return function({registry:t}){p()("select( 'core/edit-site' ).toggleFeature( featureName )",{since:"6.0",alternative:"select( 'core/preferences').toggle( 'core/edit-site', featureName )"}),t.dispatch(x.store).toggle("core/edit-site",e)}}function Ht(e){return{type:"SET_PREVIEW_DEVICE_TYPE",deviceType:e}}const Gt=(e,t)=>async({dispatch:n,registry:a})=>{if(!t)try{const n=await a.resolveSelect(_.store).getEntityRecord("postType","wp_template",e);t=n?.slug}catch(e){}n({type:"SET_EDITED_POST",postType:"wp_template",id:e,context:{templateSlug:t}})},Ut=e=>async({dispatch:t,registry:n})=>{const a=await n.dispatch(_.store).saveEntityRecord("postType","wp_template",e);e.content&&n.dispatch(_.store).editEntityRecord("postType","wp_template",a.id,{blocks:(0,c.parse)(e.content)},{undoIgnore:!0}),t({type:"SET_EDITED_POST",postType:"wp_template",id:a.id,context:{templateSlug:a.slug}})},$t=e=>async({registry:t})=>{try{await t.dispatch(_.store).deleteEntityRecord("postType",e.type,e.id,{force:!0});const n=t.select(_.store).getLastEntityDeleteError("postType",e.type,e.id);if(n)throw n;const a="string"==typeof e.title?e.title:e.title?.rendered;t.dispatch(Se.store).createSuccessNotice((0,E.sprintf)((0,E.__)('"%s" deleted.'),(0,At.decodeEntities)(a)),{type:"snackbar",id:"site-editor-template-deleted-success"})}catch(e){const n=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while deleting the template.");t.dispatch(Se.store).createErrorNotice(n,{type:"snackbar"})}};function jt(e){return{type:"SET_EDITED_POST",postType:"wp_template_part",id:e}}function Wt(e){return{type:"SET_EDITED_POST",postType:"wp_navigation",id:e}}function Zt(e,t){return{type:"SET_EDITED_POST",postType:e,id:t}}function qt(){return p()("dispatch( 'core/edit-site' ).setHomeTemplateId",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function Yt(e){return{type:"SET_EDITED_POST_CONTEXT",context:e}}const Kt=e=>async({dispatch:t,registry:n})=>{if(!e.path&&e.context?.postId){const t=await n.resolveSelect(_.store).getEntityRecord("postType",e.context.postType||"post",e.context.postId);e.path=(0,Et.getPathAndQueryString)(t?.link)}const a=await n.resolveSelect(_.store).__experimentalGetTemplateForLink(e.path);if(a)return t({type:"SET_EDITED_POST",postType:"wp_template",id:a.id,context:{...e.context,templateSlug:a.slug}}),a.id};function Xt(){return p()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function Qt(){return p()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function Jt(){return p()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function en(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function tn(e){return{type:"UPDATE_SETTINGS",settings:e}}function nn(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}function an(e){return{type:"SET_IS_SAVE_VIEW_OPENED",isOpen:e}}const rn=(e,{allowUndo:t=!0}={})=>async({registry:n})=>{const a="edit-site-template-reverted";if(n.dispatch(Se.store).removeNotice(a),zt(e))try{const r=n.select(_.store).getEntityConfig("postType",e.type);if(!r)return void n.dispatch(Se.store).createErrorNotice((0,E.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const o=(0,Et.addQueryArgs)(`${r.baseURL}/${e.id}`,{context:"edit",source:"theme"}),i=await Rt()({path:o});if(!i)return void n.dispatch(Se.store).createErrorNotice((0,E.__)("The editor has encountered an unexpected error. Please reload."),{type:"snackbar"});const s=({blocks:e=[]})=>(0,c.__unstableSerializeAndClean)(e),l=n.select(_.store).getEditedEntityRecord("postType",e.type,e.id);n.dispatch(_.store).editEntityRecord("postType",e.type,e.id,{content:s,blocks:l.blocks,source:"custom"},{undoIgnore:!0});const u=(0,c.parse)(i?.content?.raw);if(n.dispatch(_.store).editEntityRecord("postType",e.type,i.id,{content:s,blocks:u,source:"theme"}),t){const t=()=>{n.dispatch(_.store).editEntityRecord("postType",e.type,l.id,{content:s,blocks:l.blocks,source:"custom"})};n.dispatch(Se.store).createSuccessNotice((0,E.__)("Template reverted."),{type:"snackbar",id:a,actions:[{label:(0,E.__)("Undo"),onClick:t}]})}}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("Template revert failed. Please reload.");n.dispatch(Se.store).createErrorNotice(t,{type:"snackbar"})}else n.dispatch(Se.store).createErrorNotice((0,E.__)("This template is not revertable."),{type:"snackbar"})},on=e=>({registry:t})=>{t.dispatch(U).enableComplementaryArea(Ft,e)},sn=()=>({registry:e})=>{e.dispatch(U).disableComplementaryArea(Ft)},ln=e=>({registry:t})=>{t.dispatch("core/preferences").set("core/edit-site","editorMode",e),"visual"!==e&&t.dispatch(we.store).clearSelectedBlock(),"visual"===e?(0,Lt.speak)((0,E.__)("Visual editor selected"),"assertive"):"text"===e&&(0,Lt.speak)((0,E.__)("Code editor selected"),"assertive")},cn=e=>({dispatch:t,registry:n})=>{e&&n.dispatch(we.store).clearSelectedBlock(),t({type:"SET_HAS_PAGE_CONTENT_FOCUS",hasPageContentFocus:e})},un=e=>({registry:t,dispatch:n,select:a})=>{t.dispatch(we.store).__unstableSetEditorMode("edit"),n({type:"SET_CANVAS_MODE",mode:e}),"edit"===e&&t.select(x.store).get("core/edit-site","showListViewByDefault")&&!t.select(x.store).get("core/edit-site","distractionFree")&&n.setIsListViewOpened(!0),"view"===e&&a.isPage()&&n.setHasPageContentFocus(!0)},dn=e=>({dispatch:t})=>{t({type:"SET_EDITOR_CANVAS_CONTAINER_VIEW",view:e})};var mn={};function pn(e){return[e]}function _n(e,t,n){var a;if(e.length!==t.length)return!1;for(a=n;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}const gn=[];const hn=function(e,t){var n,a,r=0;function o(){var o,i,s=n,l=arguments.length;e:for(;s;){if(s.args.length===arguments.length){for(i=0;i<l;i++)if(s.args[i]!==arguments[i]){s=s.next;continue e}return s!==n&&(s===a&&(a=s.prev),s.prev.next=s.next,s.next&&(s.next.prev=s.prev),s.next=n,s.prev=null,n.prev=s,n=s),s.val}s=s.next}for(o=new Array(l),i=0;i<l;i++)o[i]=arguments[i];return s={args:o,val:e.apply(null,o)},n?(n.prev=s,s.next=n):a=s,r===t.maxSize?(a=a.prev).next=null:r++,n=s,s.val}return t=t||{},o.clear=function(){n=null,a=null,r=0},o}((function(e=gn,t){const n=t?t.reduce(((e,t)=>({...e,[t.id]:t})),{}):{},a=[],r=[...e];for(;r.length;){const{innerBlocks:e,...t}=r.shift();if(r.unshift(...e),(0,c.isTemplatePart)(t)){const{attributes:{theme:e,slug:r}}=t,o=n[`${e}//${r}`];o&&a.push({templatePart:o,block:t})}}return a})),yn=(0,d.createRegistrySelector)((e=>(t,n)=>e(x.store).get("core/edit-site",n)));function vn(e,t){return p()("select( 'core/edit-site' ).isFeatureActive",{since:"6.0",alternative:"select( 'core/preferences' ).get"}),!!yn(e,t)}function En(e){return e.deviceType}const fn=(0,d.createRegistrySelector)((e=>()=>e(_.store).canUser("create","media"))),bn=(0,d.createRegistrySelector)((e=>()=>"web"===l.Platform.OS?e(_.store).getEntityRecords("postType","wp_block",{per_page:-1}):[])),wn=function(e,t){var n,a=t||pn;function r(){n=new WeakMap}function o(){var t,r,o,i,s,l=arguments.length;for(i=new Array(l),o=0;o<l;o++)i[o]=arguments[o];for(t=function(e){var t,a,r,o,i,s=n,l=!0;for(t=0;t<e.length;t++){if(!(i=a=e[t])||"object"!=typeof i){l=!1;break}s.has(a)?s=s.get(a):(r=new WeakMap,s.set(a,r),s=r)}return s.has(mn)||((o=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=l,s.set(mn,o)),s.get(mn)}(s=a.apply(null,i)),t.isUniqueByDependants||(t.lastDependants&&!_n(s,t.lastDependants,0)&&t.clear(),t.lastDependants=s),r=t.head;r;){if(_n(r.args,i,1))return r!==t.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=t.head,r.prev=null,t.head.prev=r,t.head=r),r.val;r=r.next}return r={val:e.apply(null,i)},i[0]=null,r.args=i,t.head&&(t.head.prev=r,r.next=t.head),t.head=r,r.val}return o.getDependants=a,o.clear=r,r(),o}(((e,t)=>{const n={...e.settings,outlineMode:!0,focusMode:!!yn(e,"focusMode"),isDistractionFree:!!yn(e,"distractionFree"),hasFixedToolbar:!!yn(e,"fixedToolbar"),keepCaretInsideBlock:!!yn(e,"keepCaretInsideBlock"),showIconLabels:!!yn(e,"showIconLabels"),__experimentalSetIsInserterOpened:t,__experimentalReusableBlocks:bn(e),__experimentalPreferPatternsOnRoot:"wp_template"===kn(e)};return fn(e)?(n.mediaUpload=({onError:t,...n})=>{(0,fe.uploadMedia)({wpAllowedMimeTypes:e.settings.allowedMimeTypes,onError:({message:e})=>t(e),...n})},n):n}),(e=>[fn(e),e.settings,yn(e,"focusMode"),yn(e,"distractionFree"),yn(e,"fixedToolbar"),yn(e,"keepCaretInsideBlock"),yn(e,"showIconLabels"),bn(e),kn(e)]));function Sn(){p()("select( 'core/edit-site' ).getHomeTemplateId",{since:"6.2",version:"6.4"})}function kn(e){return e.editedPost.postType}function Cn(e){return e.editedPost.id}function xn(e){return e.editedPost.context}function Tn(e){return{context:e.editedPost.context}}function Nn(e){return!!e.blockInserterPanel}const Mn=(0,d.createRegistrySelector)((e=>t=>{if("object"==typeof t.blockInserterPanel){const{rootClientId:e,insertionIndex:n,filterValue:a}=t.blockInserterPanel;return{rootClientId:e,insertionIndex:n,filterValue:a}}if(Vn(t)){const[t]=e(we.store).__experimentalGetGlobalBlocksByName("core/post-content");if(t)return{rootClientId:t,insertionIndex:void 0,filterValue:void 0}}return{rootClientId:void 0,insertionIndex:void 0,filterValue:void 0}}));function Pn(e){return e.listViewPanel}function In(e){return e.saveViewPanel}const Bn=(0,d.createRegistrySelector)((e=>t=>{const n=kn(t),a=Cn(t),r=e(_.store).getEditedEntityRecord("postType",n,a),o=e(_.store).getEntityRecords("postType","wp_template_part",{per_page:-1});return hn(r.blocks,o)}));function Dn(e){return yn(e,"editorMode")}function Rn(){p()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",{since:"6.2",version:"6.4"})}function Ln(){p()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu",{since:"6.2",version:"6.4"})}function An(){p()("dispatch( 'core/edit-site' ).isNavigationOpened",{since:"6.2",version:"6.4"})}function Fn(e){return!!e.editedPost.context?.postId}function Vn(e){return!!Fn(e)&&e.hasPageContentFocus}function zn(e){return e.canvasMode}function On(e){return e.editorCanvasContainerView}const Hn={reducer:Bt,actions:r,selectors:i},Gn=(0,d.createReduxStore)(Ft,Hn);(0,d.register)(Gn),nt(Gn).registerPrivateSelectors(s),nt(Gn).registerPrivateActions(o);var Un=window.wp.keyboardShortcuts,$n=window.wp.commands,jn=window.wp.coreCommands;var Wn=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"}));var Zn=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z"}));var qn=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"}));var Yn=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"}));var Kn=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"}));function Xn(e){return(0,l.createElement)(v.Button,{...e,className:y()("edit-site-sidebar-button",e.className)})}const{useLocation:Qn}=nt(vt.privateApis);function Jn({isRoot:e,title:t,actions:n,meta:a,content:r,footer:o,description:i,backPath:s}){const{dashboardLink:c}=(0,d.useSelect)((e=>{const{getSettings:t}=nt(e(Gn));return{dashboardLink:t().__experimentalDashboardLink}}),[]),{getTheme:u}=(0,d.useSelect)(_.store),m=Qn(),p=(0,v.__experimentalUseNavigator)(),g=u(bt()),h=(0,E.isRTL)()?pe:me;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.__experimentalVStack,{className:y()("edit-site-sidebar-navigation-screen__main",{"has-footer":!!o}),spacing:0,justify:"flex-start"},(0,l.createElement)(v.__experimentalHStack,{spacing:4,alignment:"flex-start",className:"edit-site-sidebar-navigation-screen__title-icon"},!e&&(0,l.createElement)(Xn,{onClick:()=>{const e=null!=s?s:m.state?.backPath;e?p.goTo(e,{isBack:!0}):p.goToParent()},icon:h,label:(0,E.__)("Back"),showTooltip:!1}),e&&(0,l.createElement)(Xn,{icon:h,label:ft()?(0,E.__)("Go back to the theme showcase"):(0,E.__)("Go to the Dashboard"),href:ft()?"themes.php":c||"index.php"}),(0,l.createElement)(v.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen__title",color:"#e0e0e0",level:1,size:20},ft()?(0,E.sprintf)("Previewing %1$s: %2$s",g?.name?.rendered,t):t),n&&(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen__actions"},n)),a&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen__meta"},a)),(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen__content"},i&&(0,l.createElement)("p",{className:"edit-site-sidebar-navigation-screen__description"},i),r)),o&&(0,l.createElement)("footer",{className:"edit-site-sidebar-navigation-screen__footer"},o))}var ea=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"}));var ta=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"}));function na({className:e,icon:t,withChevron:n=!1,suffix:a,children:r,...o}){return(0,l.createElement)(v.__experimentalItem,{className:y()("edit-site-sidebar-navigation-item",{"with-suffix":!n&&a},e),...o},(0,l.createElement)(v.__experimentalHStack,{justify:"flex-start"},t&&(0,l.createElement)(de,{style:{fill:"currentcolor"},icon:t,size:24}),(0,l.createElement)(v.FlexBlock,null,r),n&&(0,l.createElement)(de,{icon:(0,E.isRTL)()?ea:ta,className:"edit-site-sidebar-navigation-item__drilldown-indicator",size:24}),!n&&a))}var aa=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"}));var ra=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"}));var oa=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})),ia=oa,sa=window.wp.date,la=window.wp.keycodes,ca=n(1919),ua=n.n(ca); /*! * is-plain-object <https://github.com/jonschlinkert/is-plain-object> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function da(e){return"[object Object]"===Object.prototype.toString.call(e)}function ma(e){var t,n;return!1!==da(e)&&(void 0===(t=e.constructor)||!1!==da(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}const{GlobalStylesContext:pa,cleanEmptyObject:_a}=nt(we.privateApis);function ga(e,t){return ua()(e,t,{isMergeableObject:ma})}function ha(){const[e,t,n]=function(){const{globalStylesId:e,isReady:t,settings:n,styles:a}=(0,d.useSelect)((e=>{const{getEditedEntityRecord:t,hasFinishedResolution:n}=e(_.store),a=e(_.store).__experimentalGetCurrentGlobalStylesId(),r=a?t("root","globalStyles",a):void 0;let o=!1;return n("__experimentalGetCurrentGlobalStylesId")&&(o=!a||n("getEditedEntityRecord",["root","globalStyles",a])),{globalStylesId:a,isReady:o,settings:r?.settings,styles:r?.styles}}),[]),{getEditedEntityRecord:r}=(0,d.useSelect)(_.store),{editEntityRecord:o}=(0,d.useDispatch)(_.store);return[t,(0,l.useMemo)((()=>({settings:null!=n?n:{},styles:null!=a?a:{}})),[n,a]),(0,l.useCallback)(((t,n={})=>{var a,i;const s=r("root","globalStyles",e),l=t({styles:null!==(a=s?.styles)&&void 0!==a?a:{},settings:null!==(i=s?.settings)&&void 0!==i?i:{}});o("root","globalStyles",e,{styles:_a(l.styles)||{},settings:_a(l.settings)||{}},n)}),[e])]}(),[a,r]=function(){const e=(0,d.useSelect)((e=>e(_.store).__experimentalGetCurrentThemeBaseGlobalStyles()),[]);return[!!e,e]}(),o=(0,l.useMemo)((()=>r&&t?ga(r,t):{}),[t,r]);return(0,l.useMemo)((()=>({isReady:e&&a,user:t,base:r,merged:o,setUserConfig:n})),[o,t,r,n,e,a])}function ya({children:e}){const t=ha();return t.isReady?(0,l.createElement)(pa.Provider,{value:t},e):null}const{useGlobalSetting:va,useGlobalStyle:Ea,useGlobalStylesOutput:fa}=nt(we.privateApis),ba={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},wa={hover:{opacity:1},start:{opacity:.5}},Sa={hover:{scale:1,opacity:1},start:{scale:0,opacity:0}};var ka=({label:e,isFocused:t,withHoverView:n})=>{const[a]=Ea("typography.fontWeight"),[r="serif"]=Ea("typography.fontFamily"),[o=r]=Ea("elements.h1.typography.fontFamily"),[i=a]=Ea("elements.h1.typography.fontWeight"),[s="black"]=Ea("color.text"),[c=s]=Ea("elements.h1.color.text"),[u="white"]=Ea("color.background"),[d]=Ea("color.gradient"),[m]=fa(),p=(0,re.useReducedMotion)(),[_]=va("color.palette.core"),[g]=va("color.palette.theme"),[h]=va("color.palette.custom"),[y,E]=(0,l.useState)(!1),[f,{width:b}]=(0,re.useResizeObserver)(),w=b?b/248:1,S=(null!=g?g:[]).concat(null!=h?h:[]).concat(null!=_?_:[]),k=S.filter((({color:e})=>e!==u&&e!==c)).slice(0,2),C=(0,l.useMemo)((()=>m?[...m,{css:"html{overflow:hidden}body{min-width: 0;padding: 0;border: none;}",isGlobalStyles:!0}]:m),[m]),x=!!b;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{style:{position:"relative"}},f),x&&(0,l.createElement)(we.__unstableIframe,{className:"edit-site-global-styles-preview__iframe",style:{height:152*w},onMouseEnter:()=>E(!0),onMouseLeave:()=>E(!1),tabIndex:-1},(0,l.createElement)(we.__unstableEditorStyles,{styles:C}),(0,l.createElement)(v.__unstableMotion.div,{style:{height:152*w,width:"100%",background:null!=d?d:u,cursor:n?"pointer":void 0},initial:"start",animate:(y||t)&&!p&&e?"hover":"start"},(0,l.createElement)(v.__unstableMotion.div,{variants:ba,style:{height:"100%",overflow:"hidden"}},(0,l.createElement)(v.__experimentalHStack,{spacing:10*w,justify:"center",style:{height:"100%",overflow:"hidden"}},(0,l.createElement)(v.__unstableMotion.div,{style:{fontFamily:o,fontSize:65*w,color:c,fontWeight:i},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:.3,type:"tween"}},"Aa"),(0,l.createElement)(v.__experimentalVStack,{spacing:4*w},k.map((({slug:e,color:t},n)=>(0,l.createElement)(v.__unstableMotion.div,{key:e,style:{height:32*w,width:32*w,background:t,borderRadius:32*w/2},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:1===n?.2:.1}})))))),(0,l.createElement)(v.__unstableMotion.div,{variants:n&&wa,style:{height:"100%",width:"100%",position:"absolute",top:0,overflow:"hidden",filter:"blur(60px)",opacity:.1}},(0,l.createElement)(v.__experimentalHStack,{spacing:0,justify:"flex-start",style:{height:"100%",overflow:"hidden"}},S.slice(0,4).map((({color:e},t)=>(0,l.createElement)("div",{key:t,style:{height:"100%",background:e,flexGrow:1}}))))),(0,l.createElement)(v.__unstableMotion.div,{variants:Sa,style:{height:"100%",width:"100%",overflow:"hidden",position:"absolute",top:0}},(0,l.createElement)(v.__experimentalVStack,{spacing:3*w,justify:"center",style:{height:"100%",overflow:"hidden",padding:10*w,boxSizing:"border-box"}},e&&(0,l.createElement)("div",{style:{fontSize:40*w,fontFamily:o,color:c,fontWeight:i,lineHeight:"1em",textAlign:"center"}},e))))))};const{GlobalStylesContext:Ca,areGlobalStyleConfigsEqual:xa}=nt(we.privateApis);function Ta({variation:e}){const[t,n]=(0,l.useState)(!1),{base:a,user:r,setUserConfig:o}=(0,l.useContext)(Ca),i=(0,l.useMemo)((()=>{var t,n;return{user:{settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:null!==(n=e.styles)&&void 0!==n?n:{}},base:a,merged:ga(a,e),setUserConfig:()=>{}}}),[e,a]),s=()=>{o((()=>({settings:e.settings,styles:e.styles})))},c=(0,l.useMemo)((()=>xa(r,e)),[r,e]);let u=e?.title;return e?.description&&(u=(0,E.sprintf)((0,E.__)("%1$s (%2$s)"),e?.title,e?.description)),(0,l.createElement)(Ca.Provider,{value:i},(0,l.createElement)("div",{className:y()("edit-site-global-styles-variations_item",{"is-active":c}),role:"button",onClick:s,onKeyDown:e=>{e.keyCode===la.ENTER&&(e.preventDefault(),s())},tabIndex:"0","aria-label":u,"aria-current":c,onFocus:()=>n(!0),onBlur:()=>n(!1)},(0,l.createElement)("div",{className:"edit-site-global-styles-variations_item-preview"},(0,l.createElement)(ka,{label:e?.title,isFocused:t,withHoverView:!0}))))}function Na(){const e=(0,d.useSelect)((e=>e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()),[]),t=(0,l.useMemo)((()=>[{title:(0,E.__)("Default"),settings:{},styles:{}},...(null!=e?e:[]).map((e=>{var t,n;return{...e,settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:null!==(n=e.styles)&&void 0!==n?n:{}}}))]),[e]);return(0,l.createElement)(v.__experimentalGrid,{columns:2,className:"edit-site-global-styles-style-variations-container"},t.map(((e,t)=>(0,l.createElement)(Ta,{key:t,variation:e}))))}const Ma=20;function Pa({variation:e="default",direction:t,resizeWidthBy:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("button",{className:`resizable-editor__drag-handle is-${t} is-variation-${e}`,"aria-label":(0,E.__)("Drag to resize"),"aria-describedby":`resizable-editor__resize-help-${t}`,onKeyDown:function(e){const{keyCode:a}=e;"left"===t&&a===la.LEFT||"right"===t&&a===la.RIGHT?n(Ma):("left"===t&&a===la.RIGHT||"right"===t&&a===la.LEFT)&&n(-Ma)}}),(0,l.createElement)(v.VisuallyHidden,{id:`resizable-editor__resize-help-${t}`},(0,E.__)("Use left and right arrow keys to resize the canvas.")))}const Ia={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0};var Ba=function({enableResizing:e,height:t,children:n}){const[a,r]=(0,l.useState)("100%"),o=(0,l.useRef)(),i=(0,l.useCallback)((e=>{o.current&&r(o.current.offsetWidth+e)}),[]);return(0,l.createElement)(v.ResizableBox,{ref:e=>{o.current=e?.resizable},size:{width:e?a:"100%",height:e&&t?t:"100%"},onResizeStop:(e,t,n)=>{r(n.style.width)},minWidth:300,maxWidth:"100%",maxHeight:"100%",enable:{right:e,left:e},showHandle:e,resizeRatio:2,handleComponent:{left:(0,l.createElement)(Pa,{direction:"left",resizeWidthBy:i}),right:(0,l.createElement)(Pa,{direction:"right",resizeWidthBy:i})},handleClasses:void 0,handleStyles:{left:Ia,right:Ia}},n)};function Da(e){switch(e){case"style-book":return(0,E.__)("Style Book");case"global-styles-revisions":return(0,E.__)("Global styles revisions");default:return""}}const{createPrivateSlotFill:Ra}=nt(v.privateApis),{privateKey:La,Slot:Aa,Fill:Fa}=Ra("EditSiteEditorCanvasContainerSlot");function Va({children:e,closeButtonLabel:t,onClose:n,enableResizing:a=!1}){const{editorCanvasContainerView:r,showListViewByDefault:o}=(0,d.useSelect)((e=>({editorCanvasContainerView:nt(e(Gn)).getEditorCanvasContainerView(),showListViewByDefault:e(x.store).get("core/edit-site","showListViewByDefault")})),[]),[i,s]=(0,l.useState)(!1),{setEditorCanvasContainerView:c}=nt((0,d.useDispatch)(Gn)),u=(0,re.useFocusOnMount)("firstElement"),m=(0,re.useFocusReturn)(),p=(0,l.useMemo)((()=>Da(r)),[r]),{setIsListViewOpened:_}=(0,d.useDispatch)(Gn);function g(){"function"==typeof n&&n(),_(o),c(void 0),s(!0)}const h=Array.isArray(e)?l.Children.map(e,((e,t)=>0===t?(0,l.cloneElement)(e,{ref:m}):e)):(0,l.cloneElement)(e,{ref:m});if(i)return null;const y=n||t;return(0,l.createElement)(Fa,null,(0,l.createElement)(Ba,{enableResizing:a},(0,l.createElement)("section",{className:"edit-site-editor-canvas-container",ref:y?u:null,onKeyDown:function(e){e.keyCode!==la.ESCAPE||e.defaultPrevented||(e.preventDefault(),g())},"aria-label":p},y&&(0,l.createElement)(v.Button,{className:"edit-site-editor-canvas-container__close-button",icon:C,label:t||(0,E.__)("Close"),onClick:g,showTooltip:!1}),h)))}Va.Slot=Aa;var za=Va;const{ExperimentalBlockEditorProvider:Oa,useGlobalStyle:Ha}=nt(we.privateApis);function Ga(){return[{name:"core/heading",title:(0,E.__)("Headings"),category:"text",blocks:[(0,c.createBlock)("core/heading",{content:(0,E.__)("Code Is Poetry"),level:1}),(0,c.createBlock)("core/heading",{content:(0,E.__)("Code Is Poetry"),level:2}),(0,c.createBlock)("core/heading",{content:(0,E.__)("Code Is Poetry"),level:3}),(0,c.createBlock)("core/heading",{content:(0,E.__)("Code Is Poetry"),level:4}),(0,c.createBlock)("core/heading",{content:(0,E.__)("Code Is Poetry"),level:5})]},...(0,c.getBlockTypes)().filter((e=>{const{name:t,example:n,supports:a}=e;return"core/heading"!==t&&!!n&&!1!==a.inserter})).map((e=>({name:e.name,title:e.title,category:e.category,blocks:(0,c.getBlockFromExample)(e.name,e.example)})))]}const Ua=({category:e,examples:t,isSelected:n,onClick:a,onSelect:r,settings:o,sizes:i,title:s})=>{const[c,u]=(0,l.useState)(!1),d={role:"button",onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(e.defaultPrevented)return;const{keyCode:t}=e;!a||t!==la.ENTER&&t!==la.SPACE||(e.preventDefault(),a(e))},onClick:e=>{e.defaultPrevented||a&&(e.preventDefault(),a(e))},readonly:!0},m=a?"body { cursor: pointer; } body * { pointer-events: none; }":"";return(0,l.createElement)(we.__unstableIframe,{className:y()("edit-site-style-book__iframe",{"is-focused":c&&!!a,"is-button":!!a}),name:"style-book-canvas",tabIndex:0,...a?d:{}},(0,l.createElement)(we.__unstableEditorStyles,{styles:o.styles}),(0,l.createElement)("style",null,'.is-root-container { display: flow-root; }\n\t\t\t\t\t\tbody { position: relative; padding: 32px !important; }\n\t.edit-site-style-book__examples {\n\t\tmax-width: 900px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tmargin-bottom: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n'+m),(0,l.createElement)($a,{className:y()("edit-site-style-book__examples",{"is-wide":i.width>600}),examples:t,category:e,label:s?(0,E.sprintf)((0,E.__)("Examples of blocks in the %s category"),s):(0,E.__)("Examples of blocks"),isSelected:n,onSelect:r}))},$a=(0,l.memo)((({className:e,examples:t,category:n,label:a,isSelected:r,onSelect:o})=>{const i=(0,v.__unstableUseCompositeState)({orientation:"vertical"});return(0,l.createElement)(v.__unstableComposite,{...i,className:e,"aria-label":a},t.filter((e=>!n||e.category===n)).map((e=>(0,l.createElement)(ja,{key:e.name,id:`example-${e.name}`,composite:i,title:e.title,blocks:e.blocks,isSelected:r(e.name),onClick:()=>{o?.(e.name)}}))))})),ja=({composite:e,id:t,title:n,blocks:a,isSelected:r,onClick:o})=>{const i=(0,d.useSelect)((e=>e(we.store).getSettings()),[]),s=(0,l.useMemo)((()=>({...i,__unstableIsPreviewMode:!0})),[i]),c=(0,l.useMemo)((()=>Array.isArray(a)?a:[a]),[a]);return(0,l.createElement)(v.__unstableCompositeItem,{...e,className:y()("edit-site-style-book__example",{"is-selected":r}),id:t,"aria-label":(0,E.sprintf)((0,E.__)("Open %s styles in Styles panel"),n),onClick:o,role:"button",as:"div"},(0,l.createElement)("span",{className:"edit-site-style-book__example-title"},n),(0,l.createElement)("div",{className:"edit-site-style-book__example-preview","aria-hidden":!0},(0,l.createElement)(v.Disabled,{className:"edit-site-style-book__example-preview__content"},(0,l.createElement)(Oa,{value:c,settings:s},(0,l.createElement)(we.BlockList,{renderAppender:!1})))))};var Wa=function({enableResizing:e=!0,isSelected:t,onClick:n,onSelect:a,showCloseButton:r=!0,showTabs:o=!0}){const[i,s]=(0,re.useResizeObserver)(),[u]=Ha("color.text"),[m]=Ha("color.background"),p=(0,l.useMemo)(Ga,[]),_=(0,l.useMemo)((()=>(0,c.getCategories)().filter((e=>p.some((t=>t.category===e.slug)))).map((e=>({name:e.slug,title:e.title,icon:e.icon})))),[p]),g=(0,d.useSelect)((e=>e(we.store).getSettings()),[]),h=(0,l.useMemo)((()=>({...g,__unstableIsPreviewMode:!0})),[g]);return(0,l.createElement)(za,{enableResizing:e,closeButtonLabel:r?(0,E.__)("Close Style Book"):null},(0,l.createElement)("div",{className:y()("edit-site-style-book",{"is-wide":s.width>600,"is-button":!!n}),style:{color:u,background:m}},i,o?(0,l.createElement)(v.TabPanel,{className:"edit-site-style-book__tab-panel",tabs:_},(e=>(0,l.createElement)(Ua,{category:e.name,examples:p,isSelected:t,onSelect:a,settings:h,sizes:s,title:e.title}))):(0,l.createElement)(Ua,{examples:p,isSelected:t,onClick:n,onSelect:a,settings:h,sizes:s})))};const Za={per_page:-1,_fields:"id,name,avatar_urls",context:"view",capabilities:["edit_theme_options"]},qa=[],{GlobalStylesContext:Ya}=nt(we.privateApis);function Ka(){const{user:e}=(0,l.useContext)(Ya),{authors:t,currentUser:n,isDirty:a,revisions:r,isLoadingGlobalStylesRevisions:o}=(0,d.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,getCurrentUser:n,getUsers:a,getCurrentThemeGlobalStylesRevisions:r,isResolving:o}=e(_.store),i=t(),s=n(),l=i.length>0,c=r()||qa;return{authors:a(Za)||qa,currentUser:s,isDirty:l,revisions:c,isLoadingGlobalStylesRevisions:o("getCurrentThemeGlobalStylesRevisions")}}),[]);return(0,l.useMemo)((()=>{let i=[];if(!t.length||o)return{revisions:i,hasUnsavedChanges:a,isLoading:!0};if(i=r.map((e=>({...e,author:t.find((t=>t.id===e.author))}))),i.length&&("unsaved"!==i[0].id&&(i[0].isLatest=!0),a&&e&&Object.keys(e).length>0&&n)){const t={id:"unsaved",styles:e?.styles,settings:e?.settings,author:{name:n?.name,avatar_urls:n?.avatar_urls},modified:new Date};i.unshift(t)}return{revisions:i,hasUnsavedChanges:a,isLoading:!1}}),[a,r,n,t,e,o])}const Xa=()=>{};function Qa(e){const{openGeneralSidebar:t}=(0,d.useDispatch)(Gn),{setCanvasMode:n}=nt((0,d.useDispatch)(Gn)),{createNotice:a}=(0,d.useDispatch)(Se.store),{set:r}=(0,d.useDispatch)(x.store),{get:o}=(0,d.useSelect)(x.store),i=(0,l.useCallback)((()=>{o(Gn.name,"distractionFree")&&(r(Gn.name,"distractionFree",!1),a("info",(0,E.__)("Distraction free mode turned off"),{isDismissible:!0,type:"snackbar"}))}),[a,r,o]);return(0,d.useSelect)((e=>!!e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length),[])?(0,l.createElement)(v.__experimentalNavigatorButton,{...e,as:na,path:"/wp_global_styles"}):(0,l.createElement)(na,{...e,onClick:()=>{i(),n("edit"),t("edit-site/global-styles")}})}function Ja(){const{storedSettings:e}=(0,d.useSelect)((e=>{const{getSettings:t}=nt(e(Gn));return{storedSettings:t(!1)}}),[]);return(0,l.createElement)(we.BlockEditorProvider,{settings:e,onChange:Xa,onInput:Xa},(0,l.createElement)(Na,null))}function er({modifiedDateTime:e,onClickRevisions:t}){return(0,l.createElement)(v.__experimentalVStack,{className:"edit-site-sidebar-navigation-screen-global-styles__footer"},(0,l.createElement)(na,{className:"edit-site-sidebar-navigation-screen-global-styles__revisions",label:(0,E.__)("Revisions"),onClick:t},(0,l.createElement)(v.__experimentalVStack,{as:"span",alignment:"center",spacing:5,direction:"row",justify:"space-between"},(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-global-styles__revisions__label"},(0,E.__)("Last modified")),(0,l.createElement)("span",null,(0,l.createElement)("time",{dateTime:e},(0,sa.humanTimeDiff)(e))),(0,l.createElement)(v.Icon,{icon:aa,style:{fill:"currentcolor"}}))))}function tr(){const{revisions:e,isLoading:t}=Ka(),{openGeneralSidebar:n,setIsListViewOpened:a}=(0,d.useDispatch)(Gn),r=(0,re.useViewportMatch)("medium","<"),{setCanvasMode:o,setEditorCanvasContainerView:i}=nt((0,d.useDispatch)(Gn)),{createNotice:s}=(0,d.useDispatch)(Se.store),{set:c}=(0,d.useDispatch)(x.store),{get:u}=(0,d.useSelect)(x.store),{isViewMode:m,isStyleBookOpened:p,revisionsCount:g}=(0,d.useSelect)((e=>{var t;const{getCanvasMode:n,getEditorCanvasContainerView:a}=nt(e(Gn)),{getEntityRecord:r,__experimentalGetCurrentGlobalStylesId:o}=e(_.store),i=o(),s=i?r("root","globalStyles",i):void 0;return{isViewMode:"view"===n(),isStyleBookOpened:"style-book"===a(),revisionsCount:null!==(t=s?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0}}),[]),h=(0,l.useCallback)((()=>{u(Gn.name,"distractionFree")&&(c(Gn.name,"distractionFree",!1),s("info",(0,E.__)("Distraction free mode turned off"),{isDismissible:!0,type:"snackbar"}))}),[s,c,u]),y=(0,l.useCallback)((async()=>(h(),Promise.all([o("edit"),n("edit-site/global-styles")]))),[o,n,h]),v=(0,l.useCallback)((async()=>{await y(),i("style-book"),a(!1)}),[y,i,a]),f=(0,l.useCallback)((async()=>{await y(),i("global-styles-revisions")}),[y,i]),b=g>=2,w=e?.[0]?.modified,S=b&&!t&&w;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Jn,{title:(0,E.__)("Styles"),description:(0,E.__)("Choose a different style combination for the theme styles."),content:(0,l.createElement)(Ja,null),footer:S&&(0,l.createElement)(er,{modifiedDateTime:w,onClickRevisions:f}),actions:(0,l.createElement)(l.Fragment,null,!r&&(0,l.createElement)(Xn,{icon:ra,label:(0,E.__)("Style Book"),onClick:()=>i(p?void 0:"style-book"),isPressed:p}),(0,l.createElement)(Xn,{icon:ia,label:(0,E.__)("Edit styles"),onClick:async()=>await y()}))}),p&&!r&&m&&(0,l.createElement)(Wa,{enableResizing:!1,isSelected:()=>!1,onClick:v,onSelect:v,showCloseButton:!1,showTabs:!1}))}const nr="isTemplatePartMoveHintVisible";function ar(){const e=(0,d.useSelect)((e=>{var t;return null===(t=e(x.store).get("core",nr))||void 0===t||t}),[]),{set:t}=(0,d.useDispatch)(x.store);return e?(0,l.createElement)(v.Notice,{politeness:"polite",className:"edit-site-sidebar__notice",onRemove:()=>{t("core",nr,!1)}},(0,E.__)('Looking for template parts? Find them in "Patterns".')):null}function rr(){const{location:e}=(0,v.__experimentalUseNavigator)(),{setEditorCanvasContainerView:t}=nt((0,d.useDispatch)(Gn));return(0,l.useEffect)((()=>{"/"===e?.path&&t(void 0)}),[t,e?.path]),(0,l.createElement)(Jn,{isRoot:!0,title:(0,E.__)("Design"),description:(0,E.__)("Customize the appearance of your website using the block editor."),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.__experimentalItemGroup,null,(0,l.createElement)(v.__experimentalNavigatorButton,{as:na,path:"/navigation",withChevron:!0,icon:Wn},(0,E.__)("Navigation")),(0,l.createElement)(Qa,{withChevron:!0,icon:Zn},(0,E.__)("Styles")),(0,l.createElement)(v.__experimentalNavigatorButton,{as:na,path:"/page",withChevron:!0,icon:qn},(0,E.__)("Pages")),(0,l.createElement)(v.__experimentalNavigatorButton,{as:na,path:"/wp_template",withChevron:!0,icon:Yn},(0,E.__)("Templates")),(0,l.createElement)(v.__experimentalNavigatorButton,{as:na,path:"/patterns",withChevron:!0,icon:Kn},(0,E.__)("Patterns"))),(0,l.createElement)(ar,null))})}var or=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"}));var ir=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"}));var sr=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"}));var lr=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M19 6.2h-5.9l-.6-1.1c-.3-.7-1-1.1-1.8-1.1H5c-1.1 0-2 .9-2 2v11.8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.2c0-1.1-.9-2-2-2zm.5 11.6c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h5.8c.2 0 .4.1.4.3l1 2H19c.3 0 .5.2.5.5v9.5zM8 12.8h8v-1.5H8v1.5zm0 3h8v-1.5H8v1.5z"}));var cr=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"}));var ur=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z"}));var dr=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"}));var mr=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"}));var pr=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{fillRule:"evenodd",d:"M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",clipRule:"evenodd"}));var _r=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{fillRule:"evenodd",d:"M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z",clipRule:"evenodd"}));var gr=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"}));var hr=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M20.1 11.2l-6.7-6.7c-.1-.1-.3-.2-.5-.2H5c-.4-.1-.8.3-.8.7v7.8c0 .2.1.4.2.5l6.7 6.7c.2.2.5.4.7.5s.6.2.9.2c.3 0 .6-.1.9-.2.3-.1.5-.3.8-.5l5.6-5.6c.4-.4.7-1 .7-1.6.1-.6-.2-1.2-.6-1.6zM19 13.4L13.4 19c-.1.1-.2.1-.3.2-.2.1-.4.1-.6 0-.1 0-.2-.1-.3-.2l-6.5-6.5V5.8h6.8l6.5 6.5c.2.2.2.4.2.6 0 .1 0 .3-.2.5zM9 8c-.6 0-1 .4-1 1s.4 1 1 1 1-.4 1-1-.4-1-1-1z"}));var yr=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,l.createElement)(f.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"}));var vr=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));function Er(e=""){const[t,n]=(0,l.useState)(e),[a,r]=(0,l.useState)(e),o=(0,re.useDebounce)(r,250);return(0,l.useEffect)((()=>{a!==t&&o(t)}),[a,t]),[t,n,a]}var fr=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"}));const br=(e,t)=>(e||[]).map((e=>({...e,name:(0,At.decodeEntities)((0,be.get)(e,t))}))),wr=()=>(0,d.useSelect)((e=>e(_.store).getEntityRecords("postType","wp_template",{per_page:-1})),[]),Sr=()=>(0,d.useSelect)((e=>e(g.store).__experimentalGetDefaultTemplateTypes()),[]),kr=()=>{const e=(0,d.useSelect)((e=>e(_.store).getPostTypes({per_page:-1})),[]);return(0,l.useMemo)((()=>{const t=["attachment"];return e?.filter((({viewable:e,slug:n})=>e&&!t.includes(n)))}),[e])};function Cr(e){const t=(0,l.useMemo)((()=>e?.reduce(((e,{labels:t})=>{const n=t.singular_name.toLowerCase();return e[n]=(e[n]||0)+1,e}),{})));return(0,l.useCallback)((({labels:e,slug:n})=>{const a=e.singular_name.toLowerCase();return t[a]>1&&a!==n}),[t])}function xr(){const e=kr(),t=(0,l.useMemo)((()=>e?.filter((e=>e.has_archive))),[e]),n=wr(),a=Cr(t);return(0,l.useMemo)((()=>t?.filter((e=>!(n||[]).some((t=>t.slug==="archive-"+e.slug)))).map((e=>{let t;return t=a(e)?(0,E.sprintf)((0,E.__)("Archive: %1$s (%2$s)"),e.labels.singular_name,e.slug):(0,E.sprintf)((0,E.__)("Archive: %s"),e.labels.singular_name),{slug:"archive-"+e.slug,description:(0,E.sprintf)((0,E.__)("Displays an archive with the latest posts of type: %s."),e.labels.singular_name),title:t,icon:e.icon?.startsWith("dashicons-")?e.icon.slice(10):lr,templatePrefix:"archive"}}))||[]),[t,n,a])}const Tr=e=>{const t=kr(),n=wr(),a=Sr(),r=Cr(t),o=(0,l.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return"page"!==t&&(n=`single-${n}`),e[t]=n,e}),{})),[t]),i=Br("postType",o),s=(n||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,n)=>{const{slug:l,labels:c,icon:u}=n,d=o[l],m=a?.find((({slug:e})=>e===d)),p=s?.includes(d),_=r(n);let g=(0,E.sprintf)((0,E.__)("Single item: %s"),c.singular_name);_&&(g=(0,E.sprintf)((0,E.__)("Single item: %1$s (%2$s)"),c.singular_name,l));const h=m?{...m,templatePrefix:o[l]}:{slug:d,title:g,description:(0,E.sprintf)((0,E.__)("Displays a single item: %s."),c.singular_name),icon:u?.startsWith("dashicons-")?u.slice(10):fr,templatePrefix:o[l]},y=i?.[l]?.hasEntities;return y&&(h.onClick=t=>{e({type:"postType",slug:l,config:{recordNamePath:"title.rendered",queryArgs:({search:e})=>({_fields:"id,title,slug,link",orderBy:e?"relevance":"modified",exclude:i[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${o[l]}-${e.slug}`;return{title:t,slug:t,templatePrefix:o[l]}}},labels:c,hasGeneralTemplate:p,template:t})}),p&&!y||t.push(h),t}),[]),u=(0,l.useMemo)((()=>c.reduce(((e,t)=>{const{slug:n}=t;let a="postTypesMenuItems";return"page"===n&&(a="defaultPostTypesMenuItems"),e[a].push(t),e}),{defaultPostTypesMenuItems:[],postTypesMenuItems:[]})),[c]);return u},Nr=e=>{const t=(()=>{const e=(0,d.useSelect)((e=>e(_.store).getTaxonomies({per_page:-1})),[]);return(0,l.useMemo)((()=>e?.filter((({visibility:e})=>e?.publicly_queryable))),[e])})(),n=wr(),a=Sr(),r=(0,l.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let n=t;return["category","post_tag"].includes(t)||(n=`taxonomy-${n}`),"post_tag"===t&&(n="tag"),e[t]=n,e}),{})),[t]),o=t?.reduce(((e,{labels:t})=>{const n=t.singular_name.toLowerCase();return e[n]=(e[n]||0)+1,e}),{}),i=Br("taxonomy",r),s=(n||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,n)=>{const{slug:l,labels:c}=n,u=r[l],d=a?.find((({slug:e})=>e===u)),m=s?.includes(u),p=((e,t)=>{if(["category","post_tag"].includes(t))return!1;const n=e.singular_name.toLowerCase();return o[n]>1&&n!==t})(c,l);let _=c.singular_name;p&&(_=(0,E.sprintf)((0,E.__)("%1$s (%2$s)"),c.singular_name,l));const g=d?{...d,templatePrefix:r[l]}:{slug:u,title:_,description:(0,E.sprintf)((0,E.__)("Displays taxonomy: %s."),c.singular_name),icon:_r,templatePrefix:r[l]},h=i?.[l]?.hasEntities;return h&&(g.onClick=t=>{e({type:"taxonomy",slug:l,config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"count",exclude:i[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${r[l]}-${e.slug}`;return{title:t,slug:t,templatePrefix:r[l]}}},labels:c,hasGeneralTemplate:m,template:t})}),m&&!h||t.push(g),t}),[]);return(0,l.useMemo)((()=>c.reduce(((e,t)=>{const{slug:n}=t;let a="taxonomiesMenuItems";return["category","tag"].includes(n)&&(a="defaultTaxonomiesMenuItems"),e[a].push(t),e}),{defaultTaxonomiesMenuItems:[],taxonomiesMenuItems:[]})),[c])},Mr={user:"author"},Pr={user:{who:"authors"}};const Ir=(e,t,n={})=>{const a=(e=>{const t=wr();return(0,l.useMemo)((()=>Object.entries(e||{}).reduce(((e,[n,a])=>{const r=(t||[]).reduce(((e,t)=>{const n=`${a}-`;return t.slug.startsWith(n)&&e.push(t.slug.substring(n.length)),e}),[]);return r.length&&(e[n]=r),e}),{})),[e,t])})(t);return(0,d.useSelect)((t=>Object.entries(a||{}).reduce(((a,[r,o])=>{const i=t(_.store).getEntityRecords(e,r,{_fields:"id",context:"view",slug:o,...n[r]});return i?.length&&(a[r]=i),a}),{})),[a])},Br=(e,t,n={})=>{const a=Ir(e,t,n);return(0,d.useSelect)((r=>Object.keys(t||{}).reduce(((t,o)=>{const i=a?.[o]?.map((({id:e})=>e))||[];return t[o]={hasEntities:!!r(_.store).getEntityRecords(e,o,{per_page:1,_fields:"id",context:"view",exclude:i,...n[o]})?.length,existingEntitiesIds:i},t}),{})),[t,a])},Dr=[];function Rr({suggestion:e,search:t,onSelect:n,entityForSuggestions:a,composite:r}){const o="edit-site-custom-template-modal__suggestions_list__list-item";return(0,l.createElement)(v.__unstableCompositeItem,{role:"option",as:v.Button,...r,className:o,onClick:()=>n(a.config.getSpecificTemplate(e))},(0,l.createElement)(v.__experimentalText,{size:"body",lineHeight:1.53846153846,weight:500,className:`${o}__title`},(0,l.createElement)(v.TextHighlight,{text:(0,At.decodeEntities)(e.name),highlight:t})),e.link&&(0,l.createElement)(v.__experimentalText,{size:"body",lineHeight:1.53846153846,className:`${o}__info`},e.link))}function Lr({entityForSuggestions:e,onSelect:t}){const n=(0,v.__unstableUseCompositeState)({orientation:"vertical"}),[a,r,o]=Er(),i=function(e,t){const{config:n}=e,a=(0,l.useMemo)((()=>({order:"asc",context:"view",search:t,per_page:t?20:10,...n.queryArgs(t)})),[t,n]),{records:r,hasResolved:o}=(0,_.useEntityRecords)(e.type,e.slug,a),[i,s]=(0,l.useState)(Dr);return(0,l.useEffect)((()=>{if(!o)return;let e=Dr;r?.length&&(e=r,n.recordNamePath&&(e=br(e,n.recordNamePath))),s(e)}),[r,o]),i}(e,o),{labels:s}=e,[c,u]=(0,l.useState)(!1);return!c&&i?.length>9&&u(!0),(0,l.createElement)(l.Fragment,null,c&&(0,l.createElement)(v.SearchControl,{__nextHasNoMarginBottom:!0,onChange:r,value:a,label:s.search_items,placeholder:s.search_items}),!!i?.length&&(0,l.createElement)(v.__unstableComposite,{...n,role:"listbox",className:"edit-site-custom-template-modal__suggestions_list","aria-label":(0,E.__)("Suggestions list")},i.map((a=>(0,l.createElement)(Rr,{key:a.slug,suggestion:a,search:o,onSelect:t,entityForSuggestions:e,composite:n})))),o&&!i?.length&&(0,l.createElement)(v.__experimentalText,{as:"p",className:"edit-site-custom-template-modal__no-results"},s.not_found))}var Ar=function({onSelect:e,entityForSuggestions:t}){const[n,a]=(0,l.useState)(t.hasGeneralTemplate);return(0,l.createElement)(v.__experimentalVStack,{spacing:4,className:"edit-site-custom-template-modal__contents-wrapper",alignment:"left"},!n&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.__experimentalText,{as:"p"},(0,E.__)("Select whether to create a single template for all items or a specific one.")),(0,l.createElement)(v.Flex,{className:"edit-site-custom-template-modal__contents",gap:"4",align:"initial"},(0,l.createElement)(v.FlexItem,{isBlock:!0,as:v.Button,onClick:()=>{const{slug:n,title:a,description:r,templatePrefix:o}=t.template;e({slug:n,title:a,description:r,templatePrefix:o})}},(0,l.createElement)(v.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846},t.labels.all_items),(0,l.createElement)(v.__experimentalText,{as:"span",lineHeight:1.53846153846},(0,E.__)("For all items"))),(0,l.createElement)(v.FlexItem,{isBlock:!0,as:v.Button,onClick:()=>{a(!0)}},(0,l.createElement)(v.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846},t.labels.singular_name),(0,l.createElement)(v.__experimentalText,{as:"span",lineHeight:1.53846153846},(0,E.__)("For a specific item"))))),n&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.__experimentalText,{as:"p"},(0,E.__)("This template will be used only for the specific item chosen.")),(0,l.createElement)(Lr,{entityForSuggestions:t,onSelect:e})))};var Fr=function({onClose:e,createTemplate:t}){const[n,a]=(0,l.useState)(""),r=(0,E.__)("Custom Template"),[o,i]=(0,l.useState)(!1);return(0,l.createElement)("form",{onSubmit:async function(e){if(e.preventDefault(),!o){i(!0);try{await t({slug:"wp-custom-template-"+(0,be.kebabCase)(n||r),title:n||r},!1)}finally{i(!1)}}}},(0,l.createElement)(v.__experimentalVStack,{spacing:6},(0,l.createElement)(v.TextControl,{__nextHasNoMarginBottom:!0,label:(0,E.__)("Name"),value:n,onChange:a,placeholder:r,disabled:o,help:(0,E.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')}),(0,l.createElement)(v.__experimentalHStack,{className:"edit-site-custom-generic-template__modal-actions",justify:"right"},(0,l.createElement)(v.Button,{variant:"tertiary",onClick:()=>{e()}},(0,E.__)("Cancel")),(0,l.createElement)(v.Button,{variant:"primary",type:"submit",isBusy:o,"aria-disabled":o},(0,E.__)("Create")))))};function Vr(){const e="edit-site-template-actions-loading-screen-modal";return(0,l.createElement)(v.Modal,{isFullScreen:!0,isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,onRequestClose:()=>{},__experimentalHideHeader:!0,className:e},(0,l.createElement)("div",{className:`${e}__content`},(0,l.createElement)(v.Spinner,null)))}const{useHistory:zr}=nt(vt.privateApis),Or=["front-page","home","single","page","index","archive","author","category","date","tag","search","404"],Hr={"front-page":or,home:ir,single:sr,page:qn,archive:lr,search:cr,404:ur,index:dr,category:mr,author:pr,taxonomy:_r,date:gr,tag:hr,attachment:yr};function Gr({title:e,direction:t,className:n,description:a,icon:r,onClick:o,children:i}){return(0,l.createElement)(v.Button,{className:n,onClick:o,label:a,showTooltip:!!a},(0,l.createElement)(v.Flex,{as:"span",spacing:2,align:"center",justify:"center",style:{width:"100%"},direction:t},(0,l.createElement)("div",{className:"edit-site-add-new-template__template-icon"},(0,l.createElement)(v.Icon,{icon:r})),(0,l.createElement)(v.__experimentalVStack,{className:"edit-site-add-new-template__template-name",alignment:"center",spacing:0},(0,l.createElement)(v.__experimentalText,{weight:500,lineHeight:1.53846153846},e),i)))}const Ur={templatesList:1,customTemplate:2,customGenericTemplate:3};function $r({postType:e,toggleProps:t,showIcon:n=!0}){const[a,r]=(0,l.useState)(!1),[o,i]=(0,l.useState)(Ur.templatesList),[s,c]=(0,l.useState)({}),[u,m]=(0,l.useState)(!1),p=zr(),{saveEntityRecord:g}=(0,d.useDispatch)(_.store),{createErrorNotice:h,createSuccessNotice:f}=(0,d.useDispatch)(Se.store),{setTemplate:b}=nt((0,d.useDispatch)(Gn)),{homeUrl:w}=(0,d.useSelect)((e=>{const{getUnstableBase:t}=e(_.store);return{homeUrl:t()?.home}}),[]),S={"front-page":w,date:(0,E.sprintf)((0,E.__)("E.g. %s"),w+"/"+(new Date).getFullYear())};async function k(e,t=!0){if(!u){m(!0);try{const{title:n,description:a,slug:r}=e,o=await g("postType","wp_template",{description:a,slug:r.toString(),status:"publish",title:n,is_wp_suggestion:t},{throwOnError:!0});b(o.id,o.slug),p.push({postId:o.id,postType:o.type,canvas:"edit"}),f((0,E.sprintf)((0,E.__)('"%s" successfully created.'),(0,At.decodeEntities)(o.title?.rendered||n)),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while creating the template.");h(t,{type:"snackbar"})}finally{m(!1)}}}const C=()=>{r(!1),i(Ur.templatesList)},x=function(e,t){const n=wr(),a=Sr(),r=(n||[]).map((({slug:e})=>e)),o=(a||[]).filter((e=>Or.includes(e.slug)&&!r.includes(e.slug))),i=n=>{t?.(),e(n)},s=[...o],{defaultTaxonomiesMenuItems:l,taxonomiesMenuItems:c}=Nr(i),{defaultPostTypesMenuItems:u,postTypesMenuItems:d}=Tr(i),m=function(e){const t=wr(),n=Sr(),a=Br("root",Mr,Pr);let r=n?.find((({slug:e})=>"author"===e));r||(r={description:(0,E.__)("Displays latest posts written by a single author."),slug:"author",title:"Author"});const o=!!t?.find((({slug:e})=>"author"===e));if(a.user?.hasEntities&&(r={...r,templatePrefix:"author"},r.onClick=t=>{e({type:"root",slug:"user",config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"registered_date",exclude:a.user.existingEntitiesIds,who:"authors"}),getSpecificTemplate:e=>{const t=`author-${e.slug}`;return{title:t,slug:t,templatePrefix:"author"}}},labels:{singular_name:(0,E.__)("Author"),search_items:(0,E.__)("Search Authors"),not_found:(0,E.__)("No authors found."),all_items:(0,E.__)("All Authors")},hasGeneralTemplate:o,template:t})}),!o||a.user?.hasEntities)return r}(i);[...l,...u,m].forEach((e=>{if(!e)return;const t=s.findIndex((t=>t.slug===e.slug));t>-1?s[t]=e:s.push(e)})),s?.sort(((e,t)=>Or.indexOf(e.slug)-Or.indexOf(t.slug)));const p=[...s,...xr(),...d,...c];return p}(c,(()=>i(Ur.customTemplate)));if(!x.length)return null;const{as:T=v.Button,...N}=null!=t?t:{};let M=(0,E.__)("Add template");return o===Ur.customTemplate?M=(0,E.sprintf)((0,E.__)("Add template: %s"),s.labels.singular_name):o===Ur.customGenericTemplate&&(M=(0,E.__)("Create custom template")),(0,l.createElement)(l.Fragment,null,u&&(0,l.createElement)(Vr,null),(0,l.createElement)(T,{...N,onClick:()=>r(!0),icon:n?vr:null,label:e.labels.add_new_item},n?null:e.labels.add_new_item),a&&(0,l.createElement)(v.Modal,{title:M,className:y()("edit-site-add-new-template__modal",{"edit-site-add-new-template__modal_template_list":o===Ur.templatesList,"edit-site-custom-template-modal":o===Ur.customTemplate}),onRequestClose:C,overlayClassName:o===Ur.customGenericTemplate?"edit-site-custom-generic-template__modal":void 0},o===Ur.templatesList&&(0,l.createElement)(v.__experimentalGrid,{columns:3,gap:4,align:"flex-start",justify:"center",className:"edit-site-add-new-template__template-list__contents"},(0,l.createElement)(v.Flex,{className:"edit-site-add-new-template__template-list__prompt"},(0,E.__)("Select what the new template should apply to:")),x.map((e=>{const{title:t,slug:n,onClick:a}=e;return(0,l.createElement)(Gr,{key:n,title:t,direction:"column",className:"edit-site-add-new-template__template-button",description:S[n],icon:Hr[n]||Yn,onClick:()=>a?a(e):k(e)})})),(0,l.createElement)(Gr,{title:(0,E.__)("Custom template"),direction:"row",className:"edit-site-add-new-template__custom-template-button",icon:ia,onClick:()=>i(Ur.customGenericTemplate)},(0,l.createElement)(v.__experimentalText,{lineHeight:1.53846153846},(0,E.__)("A custom template can be manually applied to any post or page.")))),o===Ur.customTemplate&&(0,l.createElement)(Ar,{onSelect:k,entityForSuggestions:s}),o===Ur.customGenericTemplate&&(0,l.createElement)(Fr,{onClose:C,createTemplate:k})))}function jr({templateType:e="wp_template",...t}){const n=(0,d.useSelect)((t=>t(_.store).getPostType(e)),[e]);return n&&"wp_template"===e?(0,l.createElement)($r,{...t,postType:n}):null}const Wr=({postType:e,postId:t,...n})=>{const a=St({postType:e,postId:t});return(0,l.createElement)(na,{...a,...n})};function Zr(){const e=(0,re.useViewportMatch)("medium","<"),{records:t,isResolving:n}=(0,_.useEntityRecords)("postType","wp_template",{per_page:-1}),a=t?[...t]:[];a.sort(((e,t)=>e.title.rendered.localeCompare(t.title.rendered)));const r=St({path:"/wp_template/all"}),o=!e;return(0,l.createElement)(Jn,{title:(0,E.__)("Templates"),description:(0,E.__)("Express the layout of your site with templates"),actions:o&&(0,l.createElement)(jr,{templateType:"wp_template",toggleProps:{as:Xn}}),content:(0,l.createElement)(l.Fragment,null,n&&(0,E.__)("Loading templates"),!n&&(0,l.createElement)(v.__experimentalItemGroup,null,!t?.length&&(0,l.createElement)(v.__experimentalItem,null,(0,E.__)("No templates found")),a.map((e=>(0,l.createElement)(Wr,{postType:"wp_template",postId:e.id,key:e.id,withChevron:!0},(0,At.decodeEntities)(e.title?.rendered||e.slug)))))),footer:!e&&(0,l.createElement)(na,{withChevron:!0,...r},(0,E.__)("Manage all templates"))})}function qr(e,t){const{record:n,title:a,description:r,isLoaded:o,icon:i}=(0,d.useSelect)((n=>{const{getEditedPostType:a,getEditedPostId:r}=n(Gn),{getEditedEntityRecord:o,hasFinishedResolution:i}=n(_.store),{__experimentalGetTemplateInfo:s}=n(g.store),l=null!=e?e:a(),c=null!=t?t:r(),u=o("postType",l,c),d=c&&i("getEditedEntityRecord",["postType",l,c]),m=s(u);return{record:u,title:m.title,description:m.description,isLoaded:d,icon:m.icon}}),[e,t]);return{isLoaded:o,icon:i,record:n,getTitle:()=>a?(0,At.decodeEntities)(a):null,getDescription:()=>r?(0,At.decodeEntities)(r):null}}var Yr=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"}));var Kr=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"}));const Xr=["wp_template","wp_template_part"];function Qr(e,t){return(0,d.useSelect)((n=>{const{getTheme:a,getPlugin:r,getEntityRecord:o,getMedia:i,getUser:s,getEditedEntityRecord:l}=n(_.store),c=l("postType",e,t);if(Xr.includes(c.type)){if(c.has_theme_file&&("theme"===c.origin||!c.origin&&["theme","custom"].includes(c.source)))return{type:"theme",icon:Yn,text:a(c.theme)?.name?.rendered||c.theme,isCustomized:"custom"===c.source};if(c.has_theme_file&&"plugin"===c.origin)return{type:"plugin",icon:Yr,text:r(c.theme)?.name||c.theme,isCustomized:"custom"===c.source};if(!c.has_theme_file&&"custom"===c.source&&!c.author){const e=o("root","__unstableBase");return{type:"site",icon:Kr,imageUrl:e?.site_logo?i(e.site_logo)?.source_url:void 0,text:e?.name,isCustomized:!1}}}const u=s(c.author);return{type:"user",icon:pr,imageUrl:u?.avatar_urls?.[48],text:u?.nickname,isCustomized:!1}}),[e,t])}function Jr({imageUrl:e}){const[t,n]=(0,l.useState)(!1);return(0,l.createElement)("div",{className:y()("edit-site-list-added-by__avatar",{"is-loaded":t})},(0,l.createElement)("img",{onLoad:()=>n(!0),alt:"",src:e}))}function eo({postType:e,postId:t}){const{text:n,icon:a,imageUrl:r,isCustomized:o}=Qr(e,t);return(0,l.createElement)(v.__experimentalHStack,{alignment:"left"},r?(0,l.createElement)(Jr,{imageUrl:r}):(0,l.createElement)("div",{className:"edit-site-list-added-by__icon"},(0,l.createElement)(v.Icon,{icon:a})),(0,l.createElement)("span",null,n,o&&(0,l.createElement)("span",{className:"edit-site-list-added-by__customized-info"},"wp_template"===e?(0,E._x)("Customized","template"):(0,E._x)("Customized","template part"))))}function to(e){return!!e&&("custom"===e.source&&!e.has_theme_file)}function no({template:e,onClose:t}){const n=(0,At.decodeEntities)(e.title.rendered),[a,r]=(0,l.useState)(n),[o,i]=(0,l.useState)(!1),{editEntityRecord:s,saveEditedEntityRecord:c}=(0,d.useDispatch)(_.store),{createSuccessNotice:u,createErrorNotice:m}=(0,d.useDispatch)(Se.store);if("wp_template"===e.type&&!e.is_custom)return null;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.MenuItem,{onClick:()=>{i(!0),r(n)}},(0,E.__)("Rename")),o&&(0,l.createElement)(v.Modal,{title:(0,E.__)("Rename"),onRequestClose:()=>{i(!1)},overlayClassName:"edit-site-list__rename-modal"},(0,l.createElement)("form",{onSubmit:async function(n){n.preventDefault();try{await s("postType",e.type,e.id,{title:a}),r(""),i(!1),t(),await c("postType",e.type,e.id,{throwOnError:!0}),u((0,E.__)("Entity renamed."),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while renaming the entity.");m(t,{type:"snackbar"})}}},(0,l.createElement)(v.__experimentalVStack,{spacing:"5"},(0,l.createElement)(v.TextControl,{__nextHasNoMarginBottom:!0,label:(0,E.__)("Name"),value:a,onChange:r,required:!0}),(0,l.createElement)(v.__experimentalHStack,{justify:"right"},(0,l.createElement)(v.Button,{variant:"tertiary",onClick:()=>{i(!1)}},(0,E.__)("Cancel")),(0,l.createElement)(v.Button,{variant:"primary",type:"submit"},(0,E.__)("Save")))))))}function ao({postType:e,postId:t,className:n,toggleProps:a,onRemove:r}){const o=(0,d.useSelect)((n=>n(_.store).getEntityRecord("postType",e,t)),[e,t]),{removeTemplate:i,revertTemplate:s}=(0,d.useDispatch)(Gn),{saveEditedEntityRecord:c}=(0,d.useDispatch)(_.store),{createSuccessNotice:u,createErrorNotice:m}=(0,d.useDispatch)(Se.store),p=to(o),g=zt(o);if(!p&&!g)return null;return(0,l.createElement)(v.DropdownMenu,{icon:le,label:(0,E.__)("Actions"),className:n,toggleProps:a},(({onClose:e})=>(0,l.createElement)(v.MenuGroup,null,p&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(no,{template:o,onClose:e}),(0,l.createElement)(ro,{onRemove:()=>{i(o),r?.(),e()},isTemplate:"wp_template"===o.type})),g&&(0,l.createElement)(v.MenuItem,{info:(0,E.__)("Use the template as supplied by the theme."),onClick:()=>{!async function(){try{await s(o,{allowUndo:!1}),await c("postType",o.type,o.id),u((0,E.sprintf)((0,E.__)('"%s" reverted.'),(0,At.decodeEntities)(o.title.rendered)),{type:"snackbar",id:"edit-site-template-reverted"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while reverting the entity.");m(t,{type:"snackbar"})}}(),e()}},(0,E.__)("Clear customizations")))))}function ro({onRemove:e,isTemplate:t}){const[n,a]=(0,l.useState)(!1);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.MenuItem,{isDestructive:!0,isTertiary:!0,onClick:()=>a(!0)},(0,E.__)("Delete")),(0,l.createElement)(v.__experimentalConfirmDialog,{isOpen:n,onConfirm:e,onCancel:()=>a(!1),confirmButtonText:(0,E.__)("Delete")},t?(0,E.__)("Are you sure you want to delete this template?"):(0,E.__)("Are you sure you want to delete this template part?")))}var oo=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"}));var io=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{fillRule:"evenodd",d:"M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"}));function so({children:e}){return(0,l.createElement)(v.__experimentalText,{className:"edit-site-sidebar-navigation-details-screen-panel__label"},e)}function lo({label:e,children:t,className:n}){return(0,l.createElement)(v.__experimentalHStack,{key:e,spacing:5,alignment:"left",className:y()("edit-site-sidebar-navigation-details-screen-panel__row",n)},t)}function co({children:e}){return(0,l.createElement)(v.__experimentalText,{className:"edit-site-sidebar-navigation-details-screen-panel__value"},e)}function uo({title:e,children:t,spacing:n}){return(0,l.createElement)(v.__experimentalVStack,{className:"edit-site-sidebar-navigation-details-screen-panel",spacing:n},e&&(0,l.createElement)(v.__experimentalHeading,{className:"edit-site-sidebar-navigation-details-screen-panel__heading",level:2},e),t)}const mo={};function po({postId:e,icon:t,title:n}){var a;const r={header:oo,footer:io},o=St({postType:"wp_template_part",postId:e});return(0,l.createElement)(na,{className:"edit-site-sidebar-navigation-screen-template__template-area-button",...o,icon:null!==(a=r[t])&&void 0!==a?a:Yn,withChevron:!0},(0,l.createElement)(v.__experimentalTruncate,{limit:20,ellipsizeMode:"tail",numberOfLines:1,className:"edit-site-sidebar-navigation-screen-template__template-area-label-text"},(0,At.decodeEntities)(n)))}function _o(){const e=(0,v.__experimentalUseNavigator)(),{params:{postType:t,postId:n}}=e,{editEntityRecord:a}=(0,d.useDispatch)(_.store),{allowCommentsOnNewPosts:r,templatePartAreas:o,postsPerPage:i,postsPageTitle:s,postsPageId:c,currentTemplateParts:u}=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(_.store),n=t("root","site"),{getSettings:a}=nt(e(Gn)),r=e(Gn).getCurrentTemplateTemplateParts(),o=a(),i=n?.page_for_posts?e(_.store).getEntityRecord("postType","page",n?.page_for_posts):mo;return{allowCommentsOnNewPosts:"open"===n?.default_comment_status,postsPageTitle:i?.title?.rendered,postsPageId:i?.id,postsPerPage:n?.posts_per_page,templatePartAreas:o?.defaultTemplatePartAreas,currentTemplateParts:r}}),[t,n]),[m,p]=(0,l.useState)(""),[g,h]=(0,l.useState)(1),[y,f]=(0,l.useState)("");(0,l.useEffect)((()=>{p(r),f(s),h(i)}),[s,r,i]);const b=(0,l.useMemo)((()=>u.length&&o?u.map((({templatePart:e})=>({...o?.find((({area:t})=>t===e?.area)),...e}))):[]),[u,o]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(uo,{spacing:6},c&&(0,l.createElement)(lo,null,(0,l.createElement)(v.__experimentalInputControl,{className:"edit-site-sidebar-navigation-screen__input-control",placeholder:(0,E.__)("No Title"),size:"__unstable-large",value:y,onChange:(0,re.debounce)((e=>{f(e),a("postType","page",c,{title:e})}),300),label:(0,E.__)("Blog title"),help:(0,E.__)("Set the Posts Page title. Appears in search results, and when the page is shared on social media.")})),(0,l.createElement)(lo,null,(0,l.createElement)(v.__experimentalNumberControl,{className:"edit-site-sidebar-navigation-screen__input-control",placeholder:0,value:g,size:"__unstable-large",spinControls:"custom",step:"1",min:"1",onChange:e=>{h(e),a("root","site",void 0,{posts_per_page:e})},label:(0,E.__)("Posts per page"),help:(0,E.__)("Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.")}))),(0,l.createElement)(uo,{title:(0,E.__)("Discussion"),spacing:3},(0,l.createElement)(lo,null,(0,l.createElement)(v.CheckboxControl,{className:"edit-site-sidebar-navigation-screen__input-control",label:(0,E.__)("Allow comments on new posts"),help:(0,E.__)("Changes will apply to new posts only. Individual posts may override these settings."),checked:m,onChange:e=>{p(e),a("root","site",void 0,{default_comment_status:e?"open":null})}}))),(0,l.createElement)(uo,{title:(0,E.__)("Areas"),spacing:3},(0,l.createElement)(v.__experimentalItemGroup,null,b.map((({label:e,icon:t,theme:n,slug:a,title:r})=>(0,l.createElement)(lo,{key:a},(0,l.createElement)(po,{postId:`${n}//${a}`,title:r?.rendered||e,icon:t})))))))}function go({lastModifiedDateTime:e}){return(0,l.createElement)(l.Fragment,null,e&&(0,l.createElement)(lo,{className:"edit-site-sidebar-navigation-screen-details-footer"},(0,l.createElement)(so,null,(0,E.__)("Last modified")),(0,l.createElement)(co,null,(0,l.createInterpolateElement)((0,E.sprintf)((0,E.__)("<time>%s</time>"),(0,sa.humanTimeDiff)(e)),{time:(0,l.createElement)("time",{dateTime:e})}))))}function ho(){const e=(0,v.__experimentalUseNavigator)(),{params:{postType:t,postId:n}}=e,{setCanvasMode:a}=nt((0,d.useDispatch)(Gn)),{title:r,content:o,description:i,footer:s}=function(e,t){const{getDescription:n,getTitle:a,record:r}=qr(e,t),o=(0,d.useSelect)((e=>e(_.store).getCurrentTheme()),[]),i=Qr(e,t),s="theme"===i.type&&r.theme===o?.stylesheet,c=a();let u=n();!u&&i.text&&(u=(0,E.__)("This is a custom template that can be applied manually to any Post or Page."));const m="home"===r?.slug||"index"===r?.slug?(0,l.createElement)(_o,null):null,p=r?.modified?(0,l.createElement)(go,{lastModifiedDateTime:r.modified}):null;return{title:c,description:(0,l.createElement)(l.Fragment,null,u,i.text&&!s&&(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description"},(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description-author"},(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon"},i.imageUrl?(0,l.createElement)("img",{src:i.imageUrl,alt:"",width:"24",height:"24"}):(0,l.createElement)(v.Icon,{icon:i.icon})),i.text),i.isCustomized&&(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-template__added-by-description-customized"},(0,E._x)("(Customized)","template")))),content:m,footer:p}}(t,n);return(0,l.createElement)(Jn,{title:r,actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ao,{postType:t,postId:n,toggleProps:{as:Xn},onRemove:()=>{e.goTo(`/${t}/all`)}}),(0,l.createElement)(Xn,{onClick:()=>a("edit"),label:(0,E.__)("Edit"),icon:oa})),description:i,content:o,footer:s})}var yo=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z"}));var vo=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M19 6.2h-5.9l-.6-1.1c-.3-.7-1-1.1-1.8-1.1H5c-1.1 0-2 .9-2 2v11.8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.2c0-1.1-.9-2-2-2zm.5 11.6c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h5.8c.2 0 .4.1.4.3l1 2H19c.3 0 .5.2.5.5v9.5z"}));const Eo="my-patterns",fo="wp_block",bo="pattern",wo="wp_template_part",So="wp_block",ko="my-patterns",Co=["core","pattern-directory/core","pattern-directory/featured","pattern-directory/theme"],xo={full:"fully",unsynced:"unsynced"},To=(e,t,n)=>t===n.findIndex((t=>e.name===t.name));function No({blocks:e=[],closeModal:t,onCreate:n,onError:a,title:r}){const[o,i]=(0,l.useState)(""),[s,u]=(0,l.useState)(xo.unsynced),[m,p]=(0,l.useState)(!1),{createErrorNotice:g}=(0,d.useDispatch)(Se.store),{saveEntityRecord:h}=(0,d.useDispatch)(_.store);return(0,l.createElement)(v.Modal,{title:r||(0,E.__)("Create pattern"),onRequestClose:t,overlayClassName:"edit-site-create-pattern-modal"},(0,l.createElement)("form",{onSubmit:async t=>{t.preventDefault(),o&&(p(!0),await async function(){if(o)try{const t=await h("postType","wp_block",{title:o||(0,E.__)("Untitled Pattern"),content:e?.length?(0,c.serialize)(e):"",status:"publish",meta:s===xo.unsynced?{wp_pattern_sync_status:s}:void 0},{throwOnError:!0});n({pattern:t,categoryId:ko})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while creating the pattern.");g(t,{type:"snackbar"}),a()}else g((0,E.__)("Please enter a pattern name."),{type:"snackbar"})}())}},(0,l.createElement)(v.__experimentalVStack,{spacing:"4"},(0,l.createElement)(v.TextControl,{className:"edit-site-create-pattern-modal__input",label:(0,E.__)("Name"),onChange:i,placeholder:(0,E.__)("My pattern"),required:!0,value:o,__nextHasNoMarginBottom:!0}),(0,l.createElement)(v.ToggleControl,{label:(0,E.__)("Keep all pattern instances in sync"),onChange:()=>{u(s===xo.full?xo.unsynced:xo.full)},help:(0,E.__)("Editing the original pattern will also update anywhere the pattern is used."),checked:s===xo.full}),(0,l.createElement)(v.__experimentalHStack,{justify:"right"},(0,l.createElement)(v.Button,{variant:"tertiary",onClick:()=>{t()}},(0,E.__)("Cancel")),(0,l.createElement)(v.Button,{variant:"primary",type:"submit",disabled:!o,isBusy:m},(0,E.__)("Create"))))))}const Mo=()=>(0,d.useSelect)((e=>e(_.store).getEntityRecords("postType","wp_template_part",{per_page:-1})),[]),Po=(e,t)=>{const n=e.toLowerCase(),a=t.map((e=>e.title.rendered.toLowerCase()));if(!a.includes(n))return e;let r=2;for(;a.includes(`${n} ${r}`);)r++;return`${e} ${r}`},Io=e=>(0,be.kebabCase)(e).replace(/[^\w-]+/g,"")||"wp-custom-part";function Bo({closeModal:e,blocks:t=[],onCreate:n,onError:a}){const{createErrorNotice:r}=(0,d.useDispatch)(Se.store),{saveEntityRecord:o}=(0,d.useDispatch)(_.store),i=Mo(),[s,u]=(0,l.useState)(""),[m,p]=(0,l.useState)(Vt),[h,y]=(0,l.useState)(!1),f=(0,re.useInstanceId)(Bo),w=(0,d.useSelect)((e=>e(g.store).__experimentalGetDefaultTemplatePartAreas()),[]);return(0,l.createElement)(v.Modal,{title:(0,E.__)("Create template part"),onRequestClose:e,overlayClassName:"edit-site-create-template-part-modal"},(0,l.createElement)("form",{onSubmit:async e=>{e.preventDefault(),s&&(y(!0),await async function(){if(s)try{const e=Po(s,i),a=Io(e),r=await o("postType","wp_template_part",{slug:a,title:e,content:(0,c.serialize)(t),area:m},{throwOnError:!0});await n(r)}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while creating the template part.");r(t,{type:"snackbar"}),a?.()}else r((0,E.__)("Please enter a title."),{type:"snackbar"})}())}},(0,l.createElement)(v.__experimentalVStack,{spacing:"4"},(0,l.createElement)(v.TextControl,{__nextHasNoMarginBottom:!0,label:(0,E.__)("Name"),value:s,onChange:u,required:!0}),(0,l.createElement)(v.BaseControl,{label:(0,E.__)("Area"),id:`edit-site-create-template-part-modal__area-selection-${f}`,className:"edit-site-create-template-part-modal__area-base-control"},(0,l.createElement)(v.__experimentalRadioGroup,{label:(0,E.__)("Area"),className:"edit-site-create-template-part-modal__area-radio-group",id:`edit-site-create-template-part-modal__area-selection-${f}`,onChange:p,checked:m},w.map((({icon:e,label:t,area:n,description:a})=>(0,l.createElement)(v.__experimentalRadio,{key:t,value:n,className:"edit-site-create-template-part-modal__area-radio"},(0,l.createElement)(v.Flex,{align:"start",justify:"start"},(0,l.createElement)(v.FlexItem,null,(0,l.createElement)(v.Icon,{icon:e})),(0,l.createElement)(v.FlexBlock,{className:"edit-site-create-template-part-modal__option-label"},t,(0,l.createElement)("div",null,a)),(0,l.createElement)(v.FlexItem,{className:"edit-site-create-template-part-modal__checkbox"},m===n&&(0,l.createElement)(v.Icon,{icon:b})))))))),(0,l.createElement)(v.__experimentalHStack,{justify:"right"},(0,l.createElement)(v.Button,{variant:"tertiary",onClick:()=>{e()}},(0,E.__)("Cancel")),(0,l.createElement)(v.Button,{variant:"primary",type:"submit",disabled:!s,isBusy:h},(0,E.__)("Create"))))))}const{useHistory:Do}=nt(vt.privateApis);function Ro(){const e=Do(),[t,n]=(0,l.useState)(!1),[a,r]=(0,l.useState)(!1),o=(0,d.useSelect)((e=>!!e(Gn).getSettings().supportsTemplatePartsMode),[]);function i(){n(!1),r(!1)}return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.DropdownMenu,{controls:[!o&&{icon:oo,onClick:()=>r(!0),title:(0,E.__)("Create template part")},{icon:vo,onClick:()=>n(!0),title:(0,E.__)("Create pattern")}].filter(Boolean),toggleProps:{as:Xn},icon:vr,label:(0,E.__)("Create pattern")}),t&&(0,l.createElement)(No,{closeModal:()=>n(!1),onCreate:function({pattern:t,categoryId:a}){n(!1),e.push({postId:t.id,postType:"wp_block",categoryType:"wp_block",categoryId:a,canvas:"edit"})},onError:i}),a&&(0,l.createElement)(Bo,{closeModal:()=>r(!1),blocks:[],onCreate:function(t){r(!1),e.push({postId:t.id,postType:"wp_template_part",canvas:"edit"})},onError:i}))}function Lo({count:e,icon:t,id:n,isActive:a,label:r,type:o}){const i=St({path:"/patterns",categoryType:o,categoryId:n});if(e)return(0,l.createElement)(na,{...i,icon:t,suffix:(0,l.createElement)("span",null,e),"aria-current":a?"true":void 0},r)}function Ao(){const e=function(){const e=(0,d.useSelect)((e=>{var t;const{getSettings:n}=nt(e(Gn)),a=n();return null!==(t=a.__experimentalAdditionalBlockPatternCategories)&&void 0!==t?t:a.__experimentalBlockPatternCategories}));return[...e||[],...(0,d.useSelect)((e=>e(_.store).getBlockPatternCategories()))||[]]}();e.push({name:"uncategorized",label:(0,E.__)("Uncategorized")});const t=function(){const e=(0,d.useSelect)((e=>{var t;const{getSettings:n}=nt(e(Gn));return null!==(t=n().__experimentalAdditionalBlockPatterns)&&void 0!==t?t:n().__experimentalBlockPatterns})),t=(0,d.useSelect)((e=>e(_.store).getBlockPatterns()));return(0,l.useMemo)((()=>[...e||[],...t||[]].filter((e=>!Co.includes(e.source))).filter(To).filter((e=>!1!==e.inserter))),[e,t])}(),n=(0,l.useMemo)((()=>{const n={},a=[];return e.forEach((e=>{n[e.name]||(n[e.name]={...e,count:0})})),t.forEach((e=>{e.categories?.forEach((e=>{n[e]&&(n[e].count+=1)})),e.categories?.length||(n.uncategorized.count+=1)})),e.forEach((e=>{n[e.name].count&&a.push(n[e.name])})),a}),[e,t]);return{patternCategories:n,hasPatterns:!!n.length}}const Fo=e=>{const t=e||[],n=(0,d.useSelect)((e=>e(g.store).__experimentalGetDefaultTemplatePartAreas()),[]),a={header:{},footer:{},sidebar:{},uncategorized:{}};n.forEach((e=>a[e.area]={...e,templateParts:[]}));return t.reduce(((e,t)=>(e[e[t.area]?t.area:"uncategorized"].templateParts.push(t),e)),a)};function Vo({areas:e,currentArea:t,currentType:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-patterns__group-header"},(0,l.createElement)(v.__experimentalHeading,{level:2},(0,E.__)("Template parts"))),(0,l.createElement)(v.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group"},Object.entries(e).map((([e,{label:a,templateParts:r}])=>(0,l.createElement)(Lo,{key:e,count:r?.length,icon:(0,g.getTemplatePartIcon)(e),label:a,id:e,type:"wp_template_part",isActive:t===e&&"wp_template_part"===n})))))}function zo({categories:e,currentCategory:t,currentType:n}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group"},e.map((e=>(0,l.createElement)(Lo,{key:e.name,count:e.count,label:(0,l.createElement)(v.Flex,{justify:"left",align:"center",gap:0},e.label,(0,l.createElement)(v.Tooltip,{position:"top center",text:(0,E.__)("Theme patterns cannot be edited.")},(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-pattern__lock-icon"},(0,l.createElement)(v.Icon,{icon:yo,size:24})))),icon:vo,id:e.name,type:"pattern",isActive:t===`${e.name}`&&"pattern"===n})))))}function Oo(){const e=(0,re.useViewportMatch)("medium","<"),{categoryType:t,categoryId:n}=(0,Et.getQueryArgs)(window.location.href),a=n||Eo,r=t||fo,{templatePartAreas:o,hasTemplateParts:i,isLoading:s}=function(){const{records:e,isResolving:t}=(0,_.useEntityRecords)("postType","wp_template_part",{per_page:-1});return{hasTemplateParts:!!e&&!!e.length,isLoading:t,templatePartAreas:Fo(e)}}(),{patternCategories:c,hasPatterns:u}=Ao(),{myPatterns:m}=function(){const e=(0,d.useSelect)((e=>{var t;return null!==(t=e(_.store).getEntityRecords("postType","wp_block",{per_page:-1})?.length)&&void 0!==t?t:0}));return{myPatterns:{count:e,name:"my-patterns",label:(0,E.__)("My patterns")},hasPatterns:e>0}}(),p=St({path:"/wp_template_part/all"}),g=e?void 0:(0,l.createElement)(v.__experimentalItemGroup,null,(0,l.createElement)(na,{as:"a",href:"edit.php?post_type=wp_block",withChevron:!0},(0,E.__)("Manage all of my patterns")),(0,l.createElement)(na,{withChevron:!0,...p},(0,E.__)("Manage all template parts")));return(0,l.createElement)(Jn,{title:(0,E.__)("Patterns"),description:(0,E.__)("Manage what patterns are available when editing the site."),actions:(0,l.createElement)(Ro,null),footer:g,content:(0,l.createElement)(l.Fragment,null,s&&(0,E.__)("Loading patterns"),!s&&(0,l.createElement)(l.Fragment,null,!i&&!u&&(0,l.createElement)(v.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group"},(0,l.createElement)(v.__experimentalItem,null,(0,E.__)("No template parts or patterns found"))),(0,l.createElement)(v.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group"},(0,l.createElement)(Lo,{key:m.name,count:m.count?m.count:"0",label:m.label,icon:w,id:m.name,type:"wp_block",isActive:a===`${m.name}`&&"wp_block"===r})),u&&(0,l.createElement)(zo,{categories:c,currentCategory:a,currentType:r}),i&&(0,l.createElement)(Vo,{areas:o,currentArea:a,currentType:r})))})}const{useLocation:Ho}=nt(vt.privateApis);function Go(){const{params:{postId:e,postType:t}={}}=Ho(),{isRequestingSite:n,homepageId:a,url:r}=(0,d.useSelect)((e=>{const{getSite:t,getUnstableBase:n}=e(_.store),a=t(),r=n();return{isRequestingSite:!r,homepageId:"page"===a?.show_on_front?a.page_on_front:null,url:r?.home}}),[]),{setEditedEntity:o,setTemplate:i,setTemplatePart:s,setPage:c,setNavigationMenu:u}=(0,d.useDispatch)(Gn);(0,l.useEffect)((()=>{if(t&&e)switch(t){case"wp_template":i(e);break;case"wp_template_part":s(e);break;case"wp_navigation":u(e);break;case"wp_block":o(t,e);break;default:c({context:{postType:t,postId:e}})}else a?c({context:{postType:"page",postId:a}}):n||c({path:r})}),[r,e,t,a,n,o,c,i,s,u])}var Uo=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"}));var $o=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));const{useLocation:jo,useHistory:Wo}=nt(vt.privateApis);function Zo(e){var t;let n=null!==(t=e?.path)&&void 0!==t?t:"/";if(e?.postType&&e?.postId)switch(e.postType){case"wp_block":case"wp_template":case"wp_template_part":case"page":n=`/${encodeURIComponent(e.postType)}/${encodeURIComponent(e.postId)}`;break;default:n=`/navigation/${encodeURIComponent(e.postType)}/${encodeURIComponent(e.postId)}`}return n}function qo(){const e=Wo(),{params:t}=jo(),{location:n,params:a,goTo:r}=(0,v.__experimentalUseNavigator)(),o=(0,l.useRef)(!0);(0,l.useEffect)((()=>{function r(n){if(a=n,r=t,Object.entries(a).every((([e,t])=>r[e]===t)))return;var a,r;const o={...t,...n};e.push(o)}o.current?o.current=!1:a?.postType&&a?.postId?r({postType:a?.postType,postId:a?.postId,path:void 0}):n.path.startsWith("/page/")&&a?.postId?r({postType:"page",postId:a?.postId,path:void 0}):"/patterns"===n.path?r({postType:void 0,postId:void 0,canvas:void 0,path:n.path}):r({postType:void 0,postId:void 0,categoryType:void 0,categoryId:void 0,path:"/"===n.path?void 0:n.path})}),[n?.path,a]),(0,l.useEffect)((()=>{const e=Zo(t);n.path!==e&&r(e)}),[t])}const Yo={className:"block-editor-block-settings-menu__popover",placement:"bottom-start"},{useLocation:Ko,useHistory:Xo}=nt(vt.privateApis);function Qo(e){const t=Ko(),n=Xo(),{block:a}=e,{clientId:r}=a,{moveBlocksDown:o,moveBlocksUp:i,removeBlocks:s}=(0,d.useDispatch)(we.store),c=(0,E.sprintf)((0,E.__)("Remove %s"),(0,we.BlockTitle)({clientId:r,maximumLength:25})),u=(0,E.sprintf)((0,E.__)("Go to %s"),(0,we.BlockTitle)({clientId:r,maximumLength:25})),m=(0,d.useSelect)((e=>{const{getBlockRootClientId:t}=e(we.store);return t(r)}),[r]),p=(0,l.useCallback)((e=>{const{attributes:a,name:r}=e;"post-type"===a.kind&&a.id&&a.type&&n&&n.push({postType:a.type,postId:a.id,...ft()&&{wp_theme_preview:bt()}},{backPath:Zo(t.params)}),"core/page-list-item"===r&&a.id&&n&&n.push({postType:"page",postId:a.id,...ft()&&{wp_theme_preview:bt()}},{backPath:Zo(t.params)})}),[n]);return(0,l.createElement)(v.DropdownMenu,{icon:le,label:(0,E.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:Yo,noIcons:!0,...e},(({onClose:e})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.MenuGroup,null,(0,l.createElement)(v.MenuItem,{icon:Uo,onClick:()=>{i([r],m),e()}},(0,E.__)("Move up")),(0,l.createElement)(v.MenuItem,{icon:$o,onClick:()=>{o([r],m),e()}},(0,E.__)("Move down")),"page"===a.attributes?.type&&a.attributes?.id&&(0,l.createElement)(v.MenuItem,{onClick:()=>{p(a),e()}},u)),(0,l.createElement)(v.MenuGroup,null,(0,l.createElement)(v.MenuItem,{onClick:()=>{s([r],!1),e()}},c)))))}const{PrivateListView:Jo}=nt(we.privateApis),ei=["postType","page",{per_page:100,_fields:["id","link","menu_order","parent","title","type"],orderby:"menu_order",order:"asc"}];function ti({rootClientId:e}){const{listViewRootClientId:t,isLoading:n}=(0,d.useSelect)((t=>{const{areInnerBlocksControlled:n,getBlockName:a,getBlockCount:r,getBlockOrder:o}=t(we.store),{isResolving:i}=t(_.store),s=o(e),l=1===s.length&&"core/page-list"===a(s[0])&&r(s[0])>0,c=i("getEntityRecords",ei);return{listViewRootClientId:l?s[0]:e,isLoading:!n(e)||c}}),[e]),{replaceBlock:a,__unstableMarkNextChangeAsNotPersistent:r}=(0,d.useDispatch)(we.store),o=(0,l.useCallback)((e=>{"core/navigation-link"!==e.name||e.attributes.url||(r(),a(e.clientId,(0,c.createBlock)("core/navigation-link",e.attributes)))}),[r,a]);return(0,l.createElement)(l.Fragment,null,!n&&(0,l.createElement)(Jo,{rootClientId:t,onSelect:o,blockSettingsMenu:Qo,showAppender:!1}),(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor"},(0,l.createElement)(we.BlockList,null)))}const ni=()=>{};function ai({navigationMenuId:e}){const{storedSettings:t}=(0,d.useSelect)((e=>{const{getSettings:t}=nt(e(Gn));return{storedSettings:t(!1)}}),[]),n=(0,l.useMemo)((()=>e?[(0,c.createBlock)("core/navigation",{ref:e})]:[]),[e]);return e&&n?.length?(0,l.createElement)(we.BlockEditorProvider,{settings:t,value:n,onChange:ni,onInput:ni},(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__content"},(0,l.createElement)(ti,{rootClientId:n[0].clientId}))):null}function ri({id:e}){const[t]=(0,_.useEntityProp)("postType","wp_navigation","title",e);return e?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",size:"11",upperCase:!0,weight:500},t?.rendered||(0,E.__)("Navigation")),(0,l.createElement)(ai,{navigationMenuId:e})):null}function oi({id:e}){const[t]=(0,_.useEntityProp)("postType","wp_navigation","title",e),n=St({postId:e,postType:"wp_navigation"});return e?(0,l.createElement)(na,{withChevron:!0,...n},t||(0,E.__)("(no title)")):null}function ii({menus:e}){return(0,l.createElement)(v.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-template-part-navigation-menu-list"},e.map((e=>(0,l.createElement)(oi,{key:e,id:e}))))}function si({menus:e}){return e.length?1===e.length?(0,l.createElement)(ri,{id:e[0]}):(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title",size:"11",upperCase:!0,weight:500},(0,E.__)("Navigation")),(0,l.createElement)(ii,{menus:e})):null}function li(e,t){const{getDescription:n,getTitle:a,record:r}=qr(e,t),o=(0,d.useSelect)((e=>e(_.store).getCurrentTheme()),[]),i=Qr(e,t),s="theme"===i.type&&r.theme===o?.stylesheet,c=a();let u=n();!u&&i.text&&(u=(0,E.sprintf)((0,E.__)("This is the %s pattern."),a())),!u&&"wp_block"===e&&r?.title&&(u=(0,E.sprintf)((0,E.__)("This is the %s pattern."),r.title));const m=(0,l.createElement)(l.Fragment,null,u,i.text&&!s&&(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-pattern__added-by-description"},(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-pattern__added-by-description-author"},(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-pattern__added-by-description-author-icon"},i.imageUrl?(0,l.createElement)("img",{src:i.imageUrl,alt:"",width:"24",height:"24"}):(0,l.createElement)(v.Icon,{icon:i.icon})),i.text),i.isCustomized&&(0,l.createElement)("span",{className:"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized"},(0,E._x)("(Customized)","pattern")))),p=r?.modified?(0,l.createElement)(go,{lastModifiedDateTime:r.modified}):null,g=[];"wp_block"===e&&g.push({label:(0,E.__)("Syncing"),value:"unsynced"===r.wp_pattern_sync_status?(0,E.__)("Not synced"):(0,E.__)("Fully synced")});const h=(0,l.createElement)(l.Fragment,null,!!g.length&&(0,l.createElement)(uo,{spacing:5,title:(0,E.__)("Details")},g.map((({label:e,value:t})=>(0,l.createElement)(lo,{key:e},(0,l.createElement)(so,null,e),(0,l.createElement)(co,null,t))))),function(e,t){const{record:n}=qr(e,t);if("wp_template_part"!==e)return;const a=function(e,t){if(!e||!t?.length)return[];const n=t=>{if(!t)return[];const a=[];for(const r of t)if(r.name===e&&a.push(r),r?.innerBlocks){const e=n(r.innerBlocks);e.length&&a.push(...e)}return a};return n(t)}("core/navigation",n?.blocks),r=a?.map((e=>e.attributes.ref));return r?.length?(0,l.createElement)(si,{menus:r}):void 0}(e,t));return{title:c,description:m,content:h,footer:p}}function ci(){const{params:e}=(0,v.__experimentalUseNavigator)(),{categoryType:t}=(0,Et.getQueryArgs)(window.location.href),{postType:n,postId:a}=e,{setCanvasMode:r}=nt((0,d.useDispatch)(Gn));Go();const o=li(n,a),i=t||"wp_template_part"!==n?"/patterns":"/wp_template_part/all";return(0,l.createElement)(Jn,{actions:(0,l.createElement)(Xn,{onClick:()=>r("edit"),label:(0,E.__)("Edit"),icon:oa}),backPath:i,...o})}const ui={per_page:100,status:["publish","draft"],order:"desc",orderby:"date"},di=e=>e?.trim()?.length>0;function mi({menuTitle:e,onClose:t,onSave:n}){const[a,r]=(0,l.useState)(e),o=a!==e&&di(a);return(0,l.createElement)(v.Modal,{title:(0,E.__)("Rename"),onRequestClose:t},(0,l.createElement)("form",{className:"sidebar-navigation__rename-modal-form"},(0,l.createElement)(v.__experimentalVStack,{spacing:"3"},(0,l.createElement)(v.TextControl,{__nextHasNoMarginBottom:!0,value:a,placeholder:(0,E.__)("Navigation title"),onChange:r}),(0,l.createElement)(v.__experimentalHStack,{justify:"right"},(0,l.createElement)(v.Button,{variant:"tertiary",onClick:t},(0,E.__)("Cancel")),(0,l.createElement)(v.Button,{disabled:!o,variant:"primary",type:"submit",onClick:e=>{e.preventDefault(),o&&(n({title:a}),t())}},(0,E.__)("Save"))))))}function pi({onClose:e,onConfirm:t}){return(0,l.createElement)(v.Modal,{title:(0,E.__)("Delete"),onRequestClose:e},(0,l.createElement)("form",null,(0,l.createElement)(v.__experimentalVStack,{spacing:"3"},(0,l.createElement)("p",null,(0,E.__)("Are you sure you want to delete this Navigation menu?")),(0,l.createElement)(v.__experimentalHStack,{justify:"right"},(0,l.createElement)(v.Button,{variant:"tertiary",onClick:e},(0,E.__)("Cancel")),(0,l.createElement)(v.Button,{variant:"primary",type:"submit",onClick:n=>{n.preventDefault(),t(),e()}},(0,E.__)("Delete"))))))}const _i={position:"bottom right"};function gi(e){const{onDelete:t,onSave:n,onDuplicate:a,menuTitle:r}=e,[o,i]=(0,l.useState)(!1),[s,c]=(0,l.useState)(!1),u=()=>{i(!1),c(!1)};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.DropdownMenu,{className:"sidebar-navigation__more-menu",label:(0,E.__)("Actions"),icon:le,popoverProps:_i},(({onClose:e})=>(0,l.createElement)("div",null,(0,l.createElement)(v.MenuGroup,null,(0,l.createElement)(v.MenuItem,{onClick:()=>{i(!0),e()}},(0,E.__)("Rename")),(0,l.createElement)(v.MenuItem,{onClick:()=>{a(),e()}},(0,E.__)("Duplicate"))),(0,l.createElement)(v.MenuGroup,null,(0,l.createElement)(v.MenuItem,{onClick:()=>{c(!0),e()}},(0,E.__)("Delete")))))),s&&(0,l.createElement)(pi,{onClose:u,onConfirm:t}),o&&(0,l.createElement)(mi,{onClose:u,menuTitle:r,onSave:n}))}function hi({postId:e}){const t=St({postId:e,postType:"wp_navigation",canvas:"edit"});return(0,l.createElement)(Xn,{...t,label:(0,E.__)("Edit"),icon:oa})}function yi({navigationMenu:e,handleDelete:t,handleDuplicate:n,handleSave:a}){const r=e?.title?.rendered;return(0,l.createElement)(xi,{actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(gi,{menuTitle:(0,At.decodeEntities)(r),onDelete:t,onSave:a,onDuplicate:n}),(0,l.createElement)(hi,{postId:e?.id})),title:(0,At.decodeEntities)(r),description:(0,E.__)("Navigation menus are a curated collection of blocks that allow visitors to get around your site.")},(0,l.createElement)(ai,{navigationMenuId:e?.id}))}const vi="wp_navigation";function Ei(){const{params:{postId:e}}=(0,v.__experimentalUseNavigator)(),{record:t,isResolving:n}=(0,_.useEntityRecord)("postType",vi,e),{isSaving:a,isDeleting:r}=(0,d.useSelect)((t=>{const{isSavingEntityRecord:n,isDeletingEntityRecord:a}=t(_.store);return{isSaving:n("postType",vi,e),isDeleting:a("postType",vi,e)}}),[e]),o=n||a||r,i=t?.title?.rendered||t?.slug,{handleSave:s,handleDelete:c,handleDuplicate:u}=Si(),m=()=>c(t),p=e=>s(t,e),g=()=>u(t);return o?(0,l.createElement)(xi,{description:(0,E.__)("Navigation menus are a curated collection of blocks that allow visitors to get around your site.")},(0,l.createElement)(v.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})):o||t?t?.content?.raw?(0,l.createElement)(yi,{navigationMenu:t,handleDelete:m,handleSave:p,handleDuplicate:g}):(0,l.createElement)(xi,{actions:(0,l.createElement)(gi,{menuTitle:(0,At.decodeEntities)(i),onDelete:m,onSave:p,onDuplicate:g}),title:(0,At.decodeEntities)(i),description:(0,E.__)("This Navigation Menu is empty.")}):(0,l.createElement)(xi,{description:(0,E.__)("Navigation Menu missing.")})}function fi(){const{goTo:e}=(0,v.__experimentalUseNavigator)(),{deleteEntityRecord:t}=(0,d.useDispatch)(_.store),{createSuccessNotice:n,createErrorNotice:a}=(0,d.useDispatch)(Se.store);return async r=>{const o=r?.id;try{await t("postType",vi,o,{force:!0},{throwOnError:!0}),n((0,E.__)("Deleted Navigation menu"),{type:"snackbar"}),e("/navigation")}catch(e){a((0,E.sprintf)((0,E.__)("Unable to delete Navigation menu (%s)."),e?.message),{type:"snackbar"})}}}function bi(){const{getEditedEntityRecord:e}=(0,d.useSelect)((e=>{const{getEditedEntityRecord:t}=e(_.store);return{getEditedEntityRecord:t}}),[]),{editEntityRecord:t,saveEditedEntityRecord:n}=(0,d.useDispatch)(_.store),{createSuccessNotice:a,createErrorNotice:r}=(0,d.useDispatch)(Se.store);return async(o,i)=>{if(!i)return;const s=o?.id,l=e("postType","wp_navigation",s);t("postType",vi,s,i);try{await n("postType",vi,s,{throwOnError:!0}),a((0,E.__)("Renamed Navigation menu"),{type:"snackbar"})}catch(e){t("postType",vi,s,l),r((0,E.sprintf)((0,E.__)("Unable to rename Navigation menu (%s)."),e?.message),{type:"snackbar"})}}}function wi(){const{goTo:e}=(0,v.__experimentalUseNavigator)(),{saveEntityRecord:t}=(0,d.useDispatch)(_.store),{createSuccessNotice:n,createErrorNotice:a}=(0,d.useDispatch)(Se.store);return async r=>{const o=r?.title?.rendered||r?.slug;try{const a=await t("postType",vi,{title:(0,E.sprintf)((0,E.__)("%s (Copy)"),o),content:r?.content?.raw,status:"publish"},{throwOnError:!0});a&&(n((0,E.__)("Duplicated Navigation menu"),{type:"snackbar"}),e(`/navigation/${vi}/${a.id}`))}catch(e){a((0,E.sprintf)((0,E.__)("Unable to duplicate Navigation menu (%s)."),e?.message),{type:"snackbar"})}}}function Si(){return{handleDelete:fi(),handleSave:bi(),handleDuplicate:wi()}}let ki=!1;function Ci(){const{records:e,isResolving:t,hasResolved:n}=(0,_.useEntityRecords)("postType","wp_navigation",ui),a=t&&!n,{getNavigationFallbackId:r}=nt((0,d.useSelect)(_.store)),o=e?.[0];o&&(ki=!0),o||t||!n||ki||r();const{handleSave:i,handleDelete:s,handleDuplicate:c}=Si(),u=!!e?.length;return a?(0,l.createElement)(xi,null,(0,l.createElement)(v.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})):a||u?1===e?.length?(0,l.createElement)(yi,{navigationMenu:o,handleDelete:()=>s(o),handleDuplicate:()=>c(o),handleSave:e=>i(o,e)}):(0,l.createElement)(xi,null,(0,l.createElement)(v.__experimentalItemGroup,null,e?.map((({id:e,title:t,status:n},a)=>(0,l.createElement)(Ti,{postId:e,key:e,withChevron:!0,icon:Wn},function(e,t,n){return e?.rendered?"publish"===n?(0,At.decodeEntities)(e?.rendered):(0,E.sprintf)((0,E.__)("%1$s (%2$s)"),(0,At.decodeEntities)(e?.rendered),n):(0,E.sprintf)((0,E.__)("(no title %s)"),t)}(t,a+1,n)))))):(0,l.createElement)(xi,{description:(0,E.__)("No Navigation Menus found.")})}function xi({children:e,actions:t,title:n,description:a}){return(0,l.createElement)(Jn,{title:n||(0,E.__)("Navigation"),actions:t,description:a||(0,E.__)("Manage your Navigation menus."),content:e})}const Ti=({postId:e,...t})=>{const n=St({postId:e,postType:"wp_navigation"});return(0,l.createElement)(na,{...n,...t})},Ni={wp_template:{title:(0,E.__)("All templates"),description:(0,E.__)("Create new templates, or reset any customizations made to the templates supplied by your theme.")},wp_template_part:{title:(0,E.__)("All template parts"),description:(0,E.__)("Create new template parts, or reset any customizations made to the template parts supplied by your theme."),backPath:"/patterns"}};function Mi(){const{params:{postType:e}}=(0,v.__experimentalUseNavigator)(),t=(0,d.useSelect)((e=>!!e(Gn).getSettings().supportsTemplatePartsMode),[]);return(0,l.createElement)(Jn,{isRoot:t,title:Ni[e].title,description:Ni[e].description,backPath:Ni[e].backPath})}function Pi({className:e="edit-site-save-button__button",variant:t="primary",showTooltip:n=!0,defaultLabel:a,icon:r}){const{isDirty:o,isSaving:i,isSaveViewOpen:s}=(0,d.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:n}=e(_.store),a=t(),{isSaveViewOpened:r}=e(Gn);return{isDirty:a.length>0,isSaving:a.some((e=>n(e.kind,e.name,e.key))),isSaveViewOpen:r()}}),[]),{setIsSaveViewOpened:c}=(0,d.useDispatch)(Gn),u=ft()||o,m=i||!u,p=ft()?i?(0,E.__)("Activating"):m?(0,E.__)("Saved"):o?(0,E.__)("Activate & Save"):(0,E.__)("Activate"):i?(0,E.__)("Saving"):m?(0,E.__)("Saved"):a||(0,E.__)("Save");return(0,l.createElement)(v.Button,{variant:t,className:e,"aria-disabled":m,"aria-expanded":s,isBusy:i,onClick:m?void 0:()=>c(!0),label:p,shortcut:m?void 0:la.displayShortcut.primary("s"),showTooltip:n,icon:r},p)}const{useLocation:Ii}=nt(vt.privateApis),Bi=[{kind:"postType",name:"wp_navigation"}];function Di(){const{params:e}=Ii(),{__unstableMarkLastChangeAsPersistent:t}=(0,d.useDispatch)(we.store),{createSuccessNotice:n,createErrorNotice:a}=(0,d.useDispatch)(Se.store),{dirtyCurrentEntity:r,countUnsavedChanges:o,isDirty:i,isSaving:s}=(0,d.useSelect)((t=>{const{__experimentalGetDirtyEntityRecords:n,isSavingEntityRecord:a}=t(_.store),r=n();let o=null;return 1===r.length&&(e.path?.includes("wp_global_styles")?o=r.find((e=>"globalStyles"===e.name)):e.postId&&(o=r.find((t=>t.name===e.postType&&String(t.key)===e.postId)))),{dirtyCurrentEntity:o,isDirty:r.length>0,isSaving:r.some((e=>a(e.kind,e.name,e.key))),countUnsavedChanges:r.length}}),[e.path,e.postType,e.postId]),{editEntityRecord:c,saveEditedEntityRecord:u,__experimentalSaveSpecifiedEntityEdits:m}=(0,d.useDispatch)(_.store),p=s||!i&&!ft();let g=r?(0,E.__)("Save"):(0,E.sprintf)((0,E._n)("Review %d change…","Review %d changes…",o),o);s&&(g=(0,E.__)("Saving"));return(0,l.createElement)(v.__experimentalHStack,{className:"edit-site-save-hub",alignment:"right",spacing:4},r?(0,l.createElement)(v.Button,{variant:"primary",onClick:async()=>{if(!r)return;const{kind:e,name:o,key:i,property:s}=r;try{"root"===r.kind&&"site"===o?await m("root","site",void 0,[s]):(Bi.some((t=>t.kind===e&&t.name===o))&&c(e,o,i,{status:"publish"}),await u(e,o,i)),t(),n((0,E.__)("Site updated."),{type:"snackbar"})}catch(e){a(`${(0,E.__)("Saving failed.")} ${e}`)}},isBusy:s,disabled:s,"aria-disabled":s,className:"edit-site-save-hub__button"},g):(0,l.createElement)(Pi,{className:"edit-site-save-hub__button",variant:p?null:"primary",showTooltip:!1,icon:p&&!s?b:null,defaultLabel:g}))}function Ri({onSave:e,onClose:t}){const[n,a]=(0,l.useState)(!1),[r,o]=(0,l.useState)(""),{saveEntityRecord:i}=(0,d.useDispatch)(_.store),{createErrorNotice:s,createSuccessNotice:c}=(0,d.useDispatch)(Se.store);return(0,l.createElement)(v.Modal,{title:(0,E.__)("Draft a new page"),onRequestClose:t},(0,l.createElement)("form",{onSubmit:async function(t){if(t.preventDefault(),!n){a(!0);try{const t=await i("postType","page",{status:"draft",title:r,slug:(0,be.kebabCase)(r||(0,E.__)("No title"))},{throwOnError:!0});e(t),c((0,E.sprintf)((0,E.__)('"%s" successfully created.'),t.title?.rendered||r),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while creating the page.");s(t,{type:"snackbar"})}finally{a(!1)}}}},(0,l.createElement)(v.__experimentalVStack,{spacing:3},(0,l.createElement)(v.TextControl,{label:(0,E.__)("Page title"),onChange:o,placeholder:(0,E.__)("No title"),value:r}),(0,l.createElement)(v.__experimentalHStack,{spacing:2,justify:"end"},(0,l.createElement)(v.Button,{variant:"tertiary",onClick:t},(0,E.__)("Cancel")),(0,l.createElement)(v.Button,{variant:"primary",type:"submit",isBusy:n,"aria-disabled":n},(0,E.__)("Create draft"))))))}const{useHistory:Li}=nt(vt.privateApis),Ai=({postType:e="page",postId:t,...n})=>{const a=St({postType:e,postId:t},{backPath:"/page"});return(0,l.createElement)(na,{...a,...n})};function Fi(){const{records:e,isResolving:t}=(0,_.useEntityRecords)("postType","page",{status:"any",per_page:-1}),{records:n,isResolving:a}=(0,_.useEntityRecords)("postType","wp_template",{per_page:-1}),r=n?.filter((({slug:e})=>["404","search"].includes(e))),o=n?.find((e=>"front-page"===e.slug))||n?.find((e=>"home"===e.slug))||n?.find((e=>"index"===e.slug)),i=e?.concat(r,[o]),{frontPage:s,postsPage:c}=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(_.store),n=t("root","site");return{frontPage:n?.page_on_front,postsPage:n?.page_for_posts}}),[]),u=s===c,m=e&&[...e];if(!u&&m?.length){const e=m.findIndex((e=>e.id===s)),t=m.splice(e,1);m?.splice(0,0,...t);const n=m.findIndex((e=>e.id===c)),a=m.splice(n,1);m.splice(1,0,...a)}const[p,g]=(0,l.useState)(!1),h=Li(),y=e=>{let t=qn;const a=c&&c===e?(n?.find((e=>"home"===e.slug))||n?.find((e=>"index"===e.slug)))?.id:null;switch(e){case s:t=or;break;case c:t=ir}return{icon:t,postType:a?"wp_template":"page",postId:a||e}};return(0,l.createElement)(l.Fragment,null,p&&(0,l.createElement)(Ri,{onSave:({type:e,id:t})=>{h.push({postId:t,postType:e,canvas:"edit"}),g(!1)},onClose:()=>g(!1)}),(0,l.createElement)(Jn,{title:(0,E.__)("Pages"),description:(0,E.__)("Browse and edit pages on your site."),actions:(0,l.createElement)(Xn,{icon:vr,label:(0,E.__)("Draft a new page"),onClick:()=>g(!0)}),content:(0,l.createElement)(l.Fragment,null,(t||a)&&(0,l.createElement)(v.__experimentalItemGroup,null,(0,l.createElement)(v.__experimentalItem,null,(0,E.__)("Loading pages"))),!(t||a)&&(0,l.createElement)(v.__experimentalItemGroup,null,!i?.length&&(0,l.createElement)(v.__experimentalItem,null,(0,E.__)("No page found")),u&&o&&(0,l.createElement)(Ai,{postType:"wp_template",postId:o.id,key:o.id,icon:or,withChevron:!0},(0,l.createElement)(v.__experimentalTruncate,{numberOfLines:1},(0,At.decodeEntities)(o.title?.rendered||(0,E.__)("(no title)")))),m?.map((({id:e,title:t})=>(0,l.createElement)(Ai,{...y(e),key:e,withChevron:!0},(0,l.createElement)(v.__experimentalTruncate,{numberOfLines:1},(0,At.decodeEntities)(t?.rendered||(0,E.__)("(no title)")))))))),footer:(0,l.createElement)(v.__experimentalVStack,{spacing:0},r?.map((e=>(0,l.createElement)(Ai,{postType:"wp_template",postId:e.id,key:e.id,icon:Yn,withChevron:!0},(0,l.createElement)(v.__experimentalTruncate,{numberOfLines:1},(0,At.decodeEntities)(e.title?.rendered||(0,E.__)("(no title)")))))),(0,l.createElement)(na,{className:"edit-site-sidebar-navigation-screen-pages__see-all",href:"edit.php?post_type=page",onClick:()=>{document.location="edit.php?post_type=page"}},(0,E.__)("Manage all pages")))}))}var Vi=window.wp.dom,zi=window.wp.escapeHtml,Oi=window.wp.wordcount;function Hi({status:e,date:t,short:n}){const a=(0,sa.humanTimeDiff)(t);let r=e;switch(e){case"publish":r=t?(0,l.createInterpolateElement)((0,E.sprintf)((0,E.__)("Published <time>%s</time>"),a),{time:(0,l.createElement)("time",{dateTime:t})}):(0,E.__)("Published");break;case"future":const e=(0,sa.dateI18n)(n?"M j":"F j",(0,sa.getDate)(t));r=t?(0,l.createInterpolateElement)((0,E.sprintf)((0,E.__)("Scheduled: <time>%s</time>"),e),{time:(0,l.createElement)("time",{dateTime:t})}):(0,E.__)("Scheduled");break;case"draft":r=(0,E.__)("Draft");break;case"pending":r=(0,E.__)("Pending");break;case"private":r=(0,E.__)("Private");break;case"protected":r=(0,E.__)("Password protected")}return(0,l.createElement)("div",{className:y()("edit-site-sidebar-navigation-screen-page__status",{[`has-status has-${e}-status`]:!!e})},r)}const Gi=189;function Ui({id:e}){const{record:t}=(0,_.useEntityRecord)("postType","page",e),{parentTitle:n,templateTitle:a}=(0,d.useSelect)((e=>{const{getEditedPostContext:n}=nt(e(Gn)),a=n(),r=e(_.store).getEntityRecords("postType","wp_template",{per_page:-1}),o="page"===a?.postType?a?.templateSlug:null,i=r&&o?r.find((e=>e.slug===o))?.title?.rendered:null;return{parentTitle:t?.parent?e(_.store).getEntityRecord("postType","page",t.parent,{_fields:["title"]})?.title?.rendered:null,templateTitle:i}}),[t?.parent]);return(0,l.createElement)(uo,{spacing:5,title:(0,E.__)("Details")},function(e){if(!e)return[];const t=[{label:(0,E.__)("Status"),value:(0,l.createElement)(Hi,{status:e?.password?"protected":e.status,date:e?.date,short:!0})},{label:(0,E.__)("Slug"),value:(0,l.createElement)(v.__experimentalTruncate,{numberOfLines:1},(0,Et.safeDecodeURIComponent)(e.slug))}];e?.templateTitle&&t.push({label:(0,E.__)("Template"),value:(0,At.decodeEntities)(e.templateTitle)}),e?.parentTitle&&t.push({label:(0,E.__)("Parent"),value:(0,At.decodeEntities)(e.parentTitle||(0,E.__)("(no title)"))});const n=(0,E._x)("words","Word count type. Do not translate!"),a=e?.content?.rendered?(0,Oi.count)(e.content.rendered,n):0,r=Math.round(a/Gi);return a&&t.push({label:(0,E.__)("Words"),value:a.toLocaleString()||(0,E.__)("Unknown")},{label:(0,E.__)("Time to read"),value:r>1?(0,E.sprintf)((0,E.__)("%s mins"),r.toLocaleString()):(0,E.__)("< 1 min")}),t}({parentTitle:n,templateTitle:a,...t}).map((({label:e,value:t})=>(0,l.createElement)(lo,{key:e},(0,l.createElement)(so,null,e),(0,l.createElement)(co,null,t)))))}function $i({postId:e,onRemove:t}){const{createSuccessNotice:n,createErrorNotice:a}=(0,d.useDispatch)(Se.store),{deleteEntityRecord:r}=(0,d.useDispatch)(_.store),o=(0,d.useSelect)((t=>t(_.store).getEntityRecord("postType","page",e)),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.MenuItem,{onClick:()=>async function(){try{await r("postType","page",e,{},{throwOnError:!0}),n((0,E.sprintf)((0,E.__)('"%s" moved to the Trash.'),(0,At.decodeEntities)(o.title.rendered)),{type:"snackbar",id:"edit-site-page-trashed"}),t?.()}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while moving the page to the trash.");a(t,{type:"snackbar"})}}(),isDestructive:!0},(0,E.__)("Move to Trash")))}function ji({postId:e,className:t,toggleProps:n,onRemove:a}){return(0,l.createElement)(v.DropdownMenu,{icon:le,label:(0,E.__)("Actions"),className:t,toggleProps:n},(()=>(0,l.createElement)(v.MenuGroup,null,(0,l.createElement)($i,{postId:e,onRemove:a}))))}function Wi(){const e=(0,v.__experimentalUseNavigator)(),{setCanvasMode:t}=nt((0,d.useDispatch)(Gn)),{params:{postId:n}}=(0,v.__experimentalUseNavigator)(),{record:a}=(0,_.useEntityRecord)("postType","page",n),{featuredMediaAltText:r,featuredMediaSourceUrl:o}=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(_.store),n=a?.featured_media?t("postType","attachment",a?.featured_media):null;return{featuredMediaSourceUrl:n?.media_details.sizes?.medium?.source_url||n?.source_url,featuredMediaAltText:(0,zi.escapeAttribute)(n?.alt_text||n?.description?.raw||"")}}),[a]),i=r?(0,At.decodeEntities)(r):(0,At.decodeEntities)(a?.title?.rendered||(0,E.__)("Featured image"));return a?(0,l.createElement)(Jn,{title:(0,At.decodeEntities)(a?.title?.rendered||(0,E.__)("(no title)")),actions:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ji,{postId:n,toggleProps:{as:Xn},onRemove:()=>{e.goTo("/page")}}),(0,l.createElement)(Xn,{onClick:()=>t("edit"),label:(0,E.__)("Edit"),icon:oa})),meta:(0,l.createElement)(v.ExternalLink,{className:"edit-site-sidebar-navigation-screen__page-link",href:a.link},(0,Et.filterURLForDisplay)((0,Et.safeDecodeURIComponent)(a.link))),content:(0,l.createElement)(l.Fragment,null,!!o&&(0,l.createElement)(v.__experimentalVStack,{className:"edit-site-sidebar-navigation-screen-page__featured-image-wrapper",alignment:"left",spacing:2},(0,l.createElement)("div",{className:"edit-site-sidebar-navigation-screen-page__featured-image has-image"},(0,l.createElement)("img",{alt:i,src:o}))),!!a?.excerpt?.rendered&&(0,l.createElement)(v.__experimentalTruncate,{className:"edit-site-sidebar-navigation-screen-page__excerpt",numberOfLines:3},(0,Vi.__unstableStripHTML)(a.excerpt.rendered)),(0,l.createElement)(Ui,{id:n})),footer:(0,l.createElement)(go,{lastModifiedDateTime:a?.modified})}):null}const{useLocation:Zi}=nt(vt.privateApis);function qi(){return qo(),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/"},(0,l.createElement)(rr,null)),(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/navigation"},(0,l.createElement)(Ci,null)),(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/navigation/:postType/:postId"},(0,l.createElement)(Ei,null)),(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/wp_global_styles"},(0,l.createElement)(tr,null)),(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/page"},(0,l.createElement)(Fi,null)),(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/page/:postId"},(0,l.createElement)(Wi,null)),(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/:postType(wp_template)"},(0,l.createElement)(Zr,null)),(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/patterns"},(0,l.createElement)(Oo,null)),(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/:postType(wp_template|wp_template_part)/all"},(0,l.createElement)(Mi,null)),(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/:postType(wp_template_part|wp_block)/:postId"},(0,l.createElement)(ci,null)),(0,l.createElement)(v.__experimentalNavigatorScreen,{path:"/:postType(wp_template)/:postId"},(0,l.createElement)(ho,null)))}var Yi=(0,l.memo)((function(){const{params:e}=Zi(),t=(0,l.useRef)(Zo(e));return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.__experimentalNavigatorProvider,{className:"edit-site-sidebar__content",initialPath:t.current},(0,l.createElement)(qi,null)),(0,l.createElement)(Di,null))}));var Ki=(0,l.createElement)(f.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"}));var Xi=(0,l.createElement)(f.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"}));function Qi({className:e,identifier:t,title:n,icon:a,children:r,closeLabel:o,header:i,headerClassName:s,panelClassName:c}){const u=(0,d.useSelect)((e=>e(Gn).getSettings().showIconLabels),[]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ae,{className:e,scope:"core/edit-site",identifier:t,title:n,icon:a,closeLabel:o,header:i,headerClassName:s,panelClassName:c,showIconLabels:u},r),(0,l.createElement)(Q,{scope:"core/edit-site",identifier:t,icon:a},n))}function Ji({className:e,...t}){return(0,l.createElement)(v.Icon,{className:y()(e,"edit-site-global-styles-icon-with-current-color"),...t})}function es({icon:e,children:t,...n}){return(0,l.createElement)(v.__experimentalItem,{...n},e&&(0,l.createElement)(v.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(Ji,{icon:e,size:24}),(0,l.createElement)(v.FlexItem,null,t)),!e&&t)}function ts(e){return(0,l.createElement)(v.__experimentalNavigatorButton,{as:es,...e})}var ns=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z"}));var as=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"}));const{useHasDimensionsPanel:rs,useHasTypographyPanel:os,useHasColorPanel:is,useGlobalSetting:ss,useSettingsForBlockElement:ls}=nt(we.privateApis);var cs=function(){const[e]=ss(""),t=ls(e),n=os(t),a=is(t),r=rs(t);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.__experimentalItemGroup,null,n&&(0,l.createElement)(ts,{icon:ns,path:"/typography","aria-label":(0,E.__)("Typography styles")},(0,E.__)("Typography")),a&&(0,l.createElement)(ts,{icon:as,path:"/colors","aria-label":(0,E.__)("Colors styles")},(0,E.__)("Colors")),r&&(0,l.createElement)(ts,{icon:Yn,path:"/layout","aria-label":(0,E.__)("Layout styles")},(0,E.__)("Layout"))))};var us=function(){const{useGlobalStyle:e}=nt(we.privateApis),[t]=e("css"),{hasVariations:n,canEditCSS:a}=(0,d.useSelect)((e=>{var t;const{getEntityRecord:n,__experimentalGetCurrentGlobalStylesId:a,__experimentalGetCurrentThemeGlobalStylesVariations:r}=e(_.store),o=a(),i=o?n("root","globalStyles",o):void 0;return{hasVariations:!!r()?.length,canEditCSS:null!==(t=!!i?._links?.["wp:action-edit-css"])&&void 0!==t&&t}}),[]);return(0,l.createElement)(v.Card,{size:"small",className:"edit-site-global-styles-screen-root"},(0,l.createElement)(v.CardBody,null,(0,l.createElement)(v.__experimentalVStack,{spacing:4},(0,l.createElement)(v.Card,null,(0,l.createElement)(v.CardMedia,null,(0,l.createElement)(ka,null))),n&&(0,l.createElement)(v.__experimentalItemGroup,null,(0,l.createElement)(ts,{path:"/variations","aria-label":(0,E.__)("Browse styles")},(0,l.createElement)(v.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(v.FlexItem,null,(0,E.__)("Browse styles")),(0,l.createElement)(Ji,{icon:(0,E.isRTL)()?me:pe})))),(0,l.createElement)(cs,null))),(0,l.createElement)(v.CardDivider,null),(0,l.createElement)(v.CardBody,null,(0,l.createElement)(v.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4},(0,E.__)("Customize the appearance of specific blocks for the whole site.")),(0,l.createElement)(v.__experimentalItemGroup,null,(0,l.createElement)(ts,{path:"/blocks","aria-label":(0,E.__)("Blocks styles")},(0,l.createElement)(v.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(v.FlexItem,null,(0,E.__)("Blocks")),(0,l.createElement)(Ji,{icon:(0,E.isRTL)()?me:pe}))))),a&&!!t&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.CardDivider,null),(0,l.createElement)(v.CardBody,null,(0,l.createElement)(v.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4},(0,E.__)("Add your own CSS to customize the appearance and layout of your site.")),(0,l.createElement)(v.__experimentalItemGroup,null,(0,l.createElement)(ts,{path:"/css","aria-label":(0,E.__)("Additional CSS")},(0,l.createElement)(v.__experimentalHStack,{justify:"space-between"},(0,l.createElement)(v.FlexItem,null,(0,E.__)("Additional CSS")),(0,l.createElement)(Ji,{icon:(0,E.isRTL)()?me:pe})))))))};function ds(e){const t=function(e){return e?.filter((e=>"block"===e.source))}((0,d.useSelect)((t=>{const{getBlockStyles:n}=t(c.store);return n(e)}),[e]));return t}function ms({name:e}){const t=ds(e);return(0,l.createElement)(v.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},t.map(((t,n)=>t?.isDefault?null:(0,l.createElement)(ts,{key:n,path:"/blocks/"+encodeURIComponent(e)+"/variations/"+encodeURIComponent(t.name),"aria-label":t.label},t.label))))}var ps=function({title:e,description:t}){return(0,l.createElement)(v.__experimentalVStack,{spacing:0},(0,l.createElement)(v.__experimentalView,null,(0,l.createElement)(v.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3},(0,l.createElement)(v.__experimentalHStack,{spacing:2},(0,l.createElement)(v.__experimentalNavigatorToParentButton,{style:{minWidth:24,padding:0},icon:(0,E.isRTL)()?pe:me,isSmall:!0,"aria-label":(0,E.__)("Navigate to the previous view")}),(0,l.createElement)(v.__experimentalSpacer,null,(0,l.createElement)(v.__experimentalHeading,{className:"edit-site-global-styles-header",level:2,size:13},e))))),t&&(0,l.createElement)("p",{className:"edit-site-global-styles-header__description"},t))};const{useHasDimensionsPanel:_s,useHasTypographyPanel:gs,useHasBorderPanel:hs,useGlobalSetting:ys,useSettingsForBlockElement:vs,useHasColorPanel:Es}=nt(we.privateApis);function fs(e){const[t]=ys("",e),n=vs(t,e),a=gs(n),r=Es(n),o=hs(n),i=_s(n),s=o||i,l=!!ds(e)?.length;return a||r||s||l}function bs({block:e}){if(!fs(e.name))return null;const t=(0,E.sprintf)((0,E.__)("%s block styles"),e.title);return(0,l.createElement)(ts,{path:"/blocks/"+encodeURIComponent(e.name),"aria-label":t},(0,l.createElement)(v.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(we.BlockIcon,{icon:e.icon}),(0,l.createElement)(v.FlexItem,null,e.title)))}var ws=function(){const e=function(){const e=(0,d.useSelect)((e=>e(c.store).getBlockTypes()),[]),{core:t,noncore:n}=e.reduce(((e,t)=>{const{core:n,noncore:a}=e;return(t.name.startsWith("core/")?n:a).push(t),e}),{core:[],noncore:[]});return[...t,...n]}(),[t,n]=(0,l.useState)(""),a=(0,re.useDebounce)(Lt.speak,500),r=(0,d.useSelect)((e=>e(c.store).isMatchingSearchTerm),[]),o=(0,l.useMemo)((()=>t?e.filter((e=>r(e,t))):e),[t,e,r]),i=(0,l.useRef)();return(0,l.useEffect)((()=>{if(!t)return;const e=i.current.childElementCount,n=(0,E.sprintf)((0,E._n)("%d result found.","%d results found.",e),e);a(n,e)}),[t,a]),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ps,{title:(0,E.__)("Blocks"),description:(0,E.__)("Customize the appearance of specific blocks and for the whole site.")}),(0,l.createElement)(v.SearchControl,{__nextHasNoMarginBottom:!0,className:"edit-site-block-types-search",onChange:n,value:t,label:(0,E.__)("Search for blocks"),placeholder:(0,E.__)("Search")}),(0,l.createElement)("div",{ref:i,className:"edit-site-block-types-item-list"},o.map((e=>(0,l.createElement)(bs,{block:e,key:"menu-itemblock-"+e.name})))))};var Ss=({name:e,variation:t=""})=>{const n=(0,c.getBlockType)(e)?.example,a={...n,attributes:{...n?.attributes,className:"is-style-"+t}},r=n&&(0,c.getBlockFromExample)(e,t?a:n),o=n?.viewportWidth||null,i="150px";return n?(0,l.createElement)(v.__experimentalSpacer,{marginX:4,marginBottom:4},(0,l.createElement)("div",{className:"edit-site-global-styles__block-preview-panel",style:{maxHeight:i,boxSizing:"initial"}},(0,l.createElement)(we.BlockPreview,{blocks:r,viewportWidth:o,minHeight:i,additionalStyles:[{css:`\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tmin-height:${i};\n\t\t\t\t\t\t\t\t\tdisplay:flex;align-items:center;justify-content:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t`}]}))):null};var ks=function({children:e,level:t}){return(0,l.createElement)(v.__experimentalHeading,{className:"edit-site-global-styles-subtitle",level:null!=t?t:2},e)};function Cs(e){if(!e)return e;const t=e.color||e.width;return!e.style&&t?{...e,style:"solid"}:!e.style||t?e:void 0}const{useHasDimensionsPanel:xs,useHasTypographyPanel:Ts,useHasBorderPanel:Ns,useGlobalSetting:Ms,useSettingsForBlockElement:Ps,useHasColorPanel:Is,useHasEffectsPanel:Bs,useHasFiltersPanel:Ds,useGlobalStyle:Rs,BorderPanel:Ls,ColorPanel:As,TypographyPanel:Fs,DimensionsPanel:Vs,EffectsPanel:zs,FiltersPanel:Os,AdvancedPanel:Hs}=nt(we.privateApis);var Gs=function({name:e,variation:t}){let n=[];t&&(n=["variations",t].concat(n));const a=n.join("."),[r]=Rs(a,e,"user",{shouldDecodeEncode:!1}),[o,i]=Rs(a,e,"all",{shouldDecodeEncode:!1}),[s,u]=Ms("",e),m=Ps(s,e),p=(0,c.getBlockType)(e),g=ds(e),h=Ts(m),y=Is(m),f=Ns(m),b=xs(m),w=Bs(m),S=Ds(m),k=!!g?.length&&!t,{canEditCSS:C}=(0,d.useSelect)((e=>{var t;const{getEntityRecord:n,__experimentalGetCurrentGlobalStylesId:a}=e(_.store),r=a(),o=r?n("root","globalStyles",r):void 0;return{canEditCSS:null!==(t=!!o?._links?.["wp:action-edit-css"])&&void 0!==t&&t}}),[]),x=t?g.find((e=>e.name===t)):null,T=(0,l.useMemo)((()=>({...o,layout:m.layout})),[o,m.layout]),N=(0,l.useMemo)((()=>({...r,layout:m.layout})),[r,m.layout]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ps,{title:t?x.label:p.title}),(0,l.createElement)(Ss,{name:e,variation:t}),k&&(0,l.createElement)("div",{className:"edit-site-global-styles-screen-variations"},(0,l.createElement)(v.__experimentalVStack,{spacing:3},(0,l.createElement)(ks,null,(0,E.__)("Style Variations")),(0,l.createElement)(ms,{name:e}))),y&&(0,l.createElement)(As,{inheritedValue:o,value:r,onChange:i,settings:m}),h&&(0,l.createElement)(Fs,{inheritedValue:o,value:r,onChange:i,settings:m}),b&&(0,l.createElement)(Vs,{inheritedValue:T,value:N,onChange:e=>{const t={...e};delete t.layout,i(t),e.layout!==m.layout&&u({...s,layout:e.layout})},settings:m,includeLayoutControls:!0}),f&&(0,l.createElement)(Ls,{inheritedValue:o,value:r,onChange:e=>{if(!e?.border)return void i(e);const{radius:t,...n}=e.border,a=function(e){return e?(0,v.__experimentalHasSplitBorders)(e)?{top:Cs(e.top),right:Cs(e.right),bottom:Cs(e.bottom),left:Cs(e.left)}:Cs(e):e}(n),r=(0,v.__experimentalHasSplitBorders)(a)?{color:null,style:null,width:null,...a}:{top:a,right:a,bottom:a,left:a};i({...e,border:{...r,radius:t}})},settings:m}),w&&(0,l.createElement)(zs,{inheritedValue:T,value:N,onChange:i,settings:m,includeLayoutControls:!0}),S&&(0,l.createElement)(Os,{inheritedValue:T,value:N,onChange:i,settings:{...m,color:{...m.color,customDuotone:!1}},includeLayoutControls:!0}),C&&(0,l.createElement)(v.PanelBody,{title:(0,E.__)("Advanced"),initialOpen:!1},(0,l.createElement)("p",null,(0,E.sprintf)((0,E.__)("Add your own CSS to customize the appearance of the %s block."),p?.title)),(0,l.createElement)(Hs,{value:r,onChange:i,inheritedValue:o})))};const{useGlobalStyle:Us}=nt(we.privateApis);function $s({parentMenu:e,element:t,label:n}){const a="text"!==t&&t?`elements.${t}.`:"",r="link"===t?{textDecoration:"underline"}:{},[o]=Us(a+"typography.fontFamily"),[i]=Us(a+"typography.fontStyle"),[s]=Us(a+"typography.fontWeight"),[c]=Us(a+"typography.letterSpacing"),[u]=Us(a+"color.background"),[d]=Us(a+"color.gradient"),[m]=Us(a+"color.text"),p=(0,E.sprintf)((0,E.__)("Typography %s styles"),n);return(0,l.createElement)(ts,{path:e+"/typography/"+t,"aria-label":p},(0,l.createElement)(v.__experimentalHStack,{justify:"flex-start"},(0,l.createElement)(v.FlexItem,{className:"edit-site-global-styles-screen-typography__indicator",style:{fontFamily:null!=o?o:"serif",background:null!=d?d:u,color:m,fontStyle:i,fontWeight:s,letterSpacing:c,...r}},(0,E.__)("Aa")),(0,l.createElement)(v.FlexItem,null,n)))}var js=function(){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ps,{title:(0,E.__)("Typography"),description:(0,E.__)("Manage the typography settings for different elements.")}),(0,l.createElement)(Ss,null),(0,l.createElement)("div",{className:"edit-site-global-styles-screen-typography"},(0,l.createElement)(v.__experimentalVStack,{spacing:3},(0,l.createElement)(ks,{level:3},(0,E.__)("Elements")),(0,l.createElement)(v.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,l.createElement)($s,{parentMenu:"",element:"text",label:(0,E.__)("Text")}),(0,l.createElement)($s,{parentMenu:"",element:"link",label:(0,E.__)("Links")}),(0,l.createElement)($s,{parentMenu:"",element:"heading",label:(0,E.__)("Headings")}),(0,l.createElement)($s,{parentMenu:"",element:"caption",label:(0,E.__)("Captions")}),(0,l.createElement)($s,{parentMenu:"",element:"button",label:(0,E.__)("Buttons")})))))};const{useGlobalStyle:Ws,useGlobalSetting:Zs,useSettingsForBlockElement:qs,TypographyPanel:Ys}=nt(we.privateApis);function Ks({element:e,headingLevel:t}){let n=[];"heading"===e?n=n.concat(["elements",t]):e&&"text"!==e&&(n=n.concat(["elements",e]));const a=n.join("."),[r]=Ws(a,void 0,"user",{shouldDecodeEncode:!1}),[o,i]=Ws(a,void 0,"all",{shouldDecodeEncode:!1}),[s]=Zs(""),c=qs(s,void 0,"heading"===e?t:e);return(0,l.createElement)(Ys,{inheritedValue:o,value:r,onChange:i,settings:c})}const{useGlobalStyle:Xs}=nt(we.privateApis);function Qs({name:e,element:t,headingLevel:n}){let a="";"heading"===t?a=`elements.${n}.`:t&&"text"!==t&&(a=`elements.${t}.`);const[r]=Xs(a+"typography.fontFamily",e),[o]=Xs(a+"color.gradient",e),[i]=Xs(a+"color.background",e),[s]=Xs(a+"color.text",e),[c]=Xs(a+"typography.fontSize",e),[u]=Xs(a+"typography.fontStyle",e),[d]=Xs(a+"typography.fontWeight",e),[m]=Xs(a+"typography.letterSpacing",e),p="link"===t?{textDecoration:"underline"}:{};return(0,l.createElement)("div",{className:"edit-site-typography-preview",style:{fontFamily:null!=r?r:"serif",background:null!=o?o:i,color:s,fontSize:c,fontStyle:u,fontWeight:d,letterSpacing:m,...p}},"Aa")}const Js={text:{description:(0,E.__)("Manage the fonts used on the site."),title:(0,E.__)("Text")},link:{description:(0,E.__)("Manage the fonts and typography used on the links."),title:(0,E.__)("Links")},heading:{description:(0,E.__)("Manage the fonts and typography used on headings."),title:(0,E.__)("Headings")},caption:{description:(0,E.__)("Manage the fonts and typography used on captions."),title:(0,E.__)("Captions")},button:{description:(0,E.__)("Manage the fonts and typography used on buttons."),title:(0,E.__)("Buttons")}};var el=function({element:e}){const[t,n]=(0,l.useState)("heading");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ps,{title:Js[e].title,description:Js[e].description}),(0,l.createElement)(v.__experimentalSpacer,{marginX:4},(0,l.createElement)(Qs,{element:e,headingLevel:t})),"heading"===e&&(0,l.createElement)(v.__experimentalSpacer,{marginX:4,marginBottom:"1em"},(0,l.createElement)(v.__experimentalToggleGroupControl,{label:(0,E.__)("Select heading level"),hideLabelFromVision:!0,value:t,onChange:n,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0},(0,l.createElement)(v.__experimentalToggleGroupControlOption,{value:"heading",label:(0,E.__)("All")}),(0,l.createElement)(v.__experimentalToggleGroupControlOption,{value:"h1",label:(0,E.__)("H1")}),(0,l.createElement)(v.__experimentalToggleGroupControlOption,{value:"h2",label:(0,E.__)("H2")}),(0,l.createElement)(v.__experimentalToggleGroupControlOption,{value:"h3",label:(0,E.__)("H3")}),(0,l.createElement)(v.__experimentalToggleGroupControlOption,{value:"h4",label:(0,E.__)("H4")}),(0,l.createElement)(v.__experimentalToggleGroupControlOption,{value:"h5",label:(0,E.__)("H5")}),(0,l.createElement)(v.__experimentalToggleGroupControlOption,{value:"h6",label:(0,E.__)("H6")}))),(0,l.createElement)(Ks,{element:e,headingLevel:t}))};var tl=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/SVG"},(0,l.createElement)(f.Path,{d:"M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z"}));var nl=function({className:e,...t}){return(0,l.createElement)(v.Flex,{className:y()("edit-site-global-styles__color-indicator-wrapper",e),...t})};const{useGlobalSetting:al}=nt(we.privateApis),rl=[];var ol=function({name:e}){const[t]=al("color.palette.custom"),[n]=al("color.palette.theme"),[a]=al("color.palette.default"),[r]=al("color.defaultPalette",e),[o]=function(e){const[t,n]=at("color.palette.theme",e);return window.__experimentalEnableColorRandomizer?[function(){const e=Math.floor(225*Math.random()),a=t.map((t=>{const{color:n}=t,a=Ke(n).rotate(e).toHex();return{...t,color:a}}));n(a)}]:[]}(),i=(0,l.useMemo)((()=>[...t||rl,...n||rl,...a&&r?a:rl]),[t,n,a,r]),s=e?"/blocks/"+encodeURIComponent(e)+"/colors/palette":"/colors/palette",c=i.length>0?(0,E.sprintf)((0,E._n)("%d color","%d colors",i.length),i.length):(0,E.__)("Add custom colors");return(0,l.createElement)(v.__experimentalVStack,{spacing:3},(0,l.createElement)(ks,{level:3},(0,E.__)("Palette")),(0,l.createElement)(v.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,l.createElement)(ts,{path:s,"aria-label":(0,E.__)("Color palettes")},(0,l.createElement)(v.__experimentalHStack,{direction:0===i.length?"row-reverse":"row"},(0,l.createElement)(v.__experimentalZStack,{isLayered:!1,offset:-8},i.slice(0,5).map((({color:e},t)=>(0,l.createElement)(nl,{key:`${e}-${t}`},(0,l.createElement)(v.ColorIndicator,{colorValue:e}))))),(0,l.createElement)(v.FlexItem,null,c)))),window.__experimentalEnableColorRandomizer&&n?.length>0&&(0,l.createElement)(v.Button,{variant:"secondary",icon:tl,onClick:o},(0,E.__)("Randomize colors")))};const{useGlobalStyle:il,useGlobalSetting:sl,useSettingsForBlockElement:ll,ColorPanel:cl}=nt(we.privateApis);var ul=function(){const[e]=il("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=il("",void 0,"all",{shouldDecodeEncode:!1}),[a]=sl(""),r=ll(a);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ps,{title:(0,E.__)("Colors"),description:(0,E.__)("Manage palettes and the default color of different global elements on the site.")}),(0,l.createElement)(Ss,null),(0,l.createElement)("div",{className:"edit-site-global-styles-screen-colors"},(0,l.createElement)(v.__experimentalVStack,{spacing:10},(0,l.createElement)(ol,null),(0,l.createElement)(cl,{inheritedValue:t,value:e,onChange:n,settings:r}))))};const{useGlobalSetting:dl}=nt(we.privateApis),ml={placement:"bottom-start",offset:8};function pl({name:e}){const[t,n]=dl("color.palette.theme",e),[a]=dl("color.palette.theme",e,"base"),[r,o]=dl("color.palette.default",e),[i]=dl("color.palette.default",e,"base"),[s,c]=dl("color.palette.custom",e),[u]=dl("color.defaultPalette",e),d=(0,re.useViewportMatch)("small","<")?ml:void 0;return(0,l.createElement)(v.__experimentalVStack,{className:"edit-site-global-styles-color-palette-panel",spacing:10},!!t&&!!t.length&&(0,l.createElement)(v.__experimentalPaletteEdit,{canReset:t!==a,canOnlyChangeValues:!0,colors:t,onChange:n,paletteLabel:(0,E.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:d}),!!r&&!!r.length&&!!u&&(0,l.createElement)(v.__experimentalPaletteEdit,{canReset:r!==i,canOnlyChangeValues:!0,colors:r,onChange:o,paletteLabel:(0,E.__)("Default"),paletteLabelHeadingLevel:3,popoverProps:d}),(0,l.createElement)(v.__experimentalPaletteEdit,{colors:s,onChange:c,paletteLabel:(0,E.__)("Custom"),paletteLabelHeadingLevel:3,emptyMessage:(0,E.__)("Custom colors are empty! Add some colors to create your own color palette."),slugPrefix:"custom-",popoverProps:d}))}const{useGlobalSetting:_l}=nt(we.privateApis),gl={placement:"bottom-start",offset:8},hl=()=>{};function yl({name:e}){const[t,n]=_l("color.gradients.theme",e),[a]=_l("color.gradients.theme",e,"base"),[r,o]=_l("color.gradients.default",e),[i]=_l("color.gradients.default",e,"base"),[s,c]=_l("color.gradients.custom",e),[u]=_l("color.defaultGradients",e),[d]=_l("color.duotone.custom")||[],[m]=_l("color.duotone.default")||[],[p]=_l("color.duotone.theme")||[],[_]=_l("color.defaultDuotone"),g=[...d||[],...p||[],...m&&_?m:[]],h=(0,re.useViewportMatch)("small","<")?gl:void 0;return(0,l.createElement)(v.__experimentalVStack,{className:"edit-site-global-styles-gradient-palette-panel",spacing:10},!!t&&!!t.length&&(0,l.createElement)(v.__experimentalPaletteEdit,{canReset:t!==a,canOnlyChangeValues:!0,gradients:t,onChange:n,paletteLabel:(0,E.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:h}),!!r&&!!r.length&&!!u&&(0,l.createElement)(v.__experimentalPaletteEdit,{canReset:r!==i,canOnlyChangeValues:!0,gradients:r,onChange:o,paletteLabel:(0,E.__)("Default"),paletteLabelLevel:3,popoverProps:h}),(0,l.createElement)(v.__experimentalPaletteEdit,{gradients:s,onChange:c,paletteLabel:(0,E.__)("Custom"),paletteLabelLevel:3,emptyMessage:(0,E.__)("Custom gradients are empty! Add some gradients to create your own palette."),slugPrefix:"custom-",popoverProps:h}),!!g&&!!g.length&&(0,l.createElement)("div",null,(0,l.createElement)(ks,{level:3},(0,E.__)("Duotone")),(0,l.createElement)(v.__experimentalSpacer,{margin:3}),(0,l.createElement)(v.DuotonePicker,{duotonePalette:g,disableCustomDuotone:!0,disableCustomColors:!0,clearable:!1,onChange:hl})))}var vl=function({name:e}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ps,{title:(0,E.__)("Palette"),description:(0,E.__)("Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.")}),(0,l.createElement)(v.TabPanel,{tabs:[{name:"solid",title:"Solid",value:"solid"},{name:"gradient",title:"Gradient",value:"gradient"}]},(t=>(0,l.createElement)(l.Fragment,null,"solid"===t.value&&(0,l.createElement)(pl,{name:e}),"gradient"===t.value&&(0,l.createElement)(yl,{name:e})))))};const{useGlobalStyle:El,useGlobalSetting:fl,useSettingsForBlockElement:bl,DimensionsPanel:wl}=nt(we.privateApis),Sl={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,minHeight:!0,childLayout:!1};function kl(){const[e]=El("",void 0,"user",{shouldDecodeEncode:!1}),[t,n]=El("",void 0,"all",{shouldDecodeEncode:!1}),[a,r]=fl(""),o=bl(a),i=(0,l.useMemo)((()=>({...t,layout:o.layout})),[t,o.layout]),s=(0,l.useMemo)((()=>({...e,layout:o.layout})),[e,o.layout]);return(0,l.createElement)(wl,{inheritedValue:i,value:s,onChange:e=>{const t={...e};if(delete t.layout,n(t),e.layout!==o.layout){const t={...a,layout:e.layout};t.layout?.definitions&&delete t.layout.definitions,r(t)}},settings:o,includeLayoutControls:!0,defaultControls:Sl})}const{useHasDimensionsPanel:Cl,useGlobalSetting:xl,useSettingsForBlockElement:Tl}=nt(we.privateApis);var Nl=function(){const[e]=xl(""),t=Tl(e),n=Cl(t);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ps,{title:(0,E.__)("Layout")}),(0,l.createElement)(Ss,null),n&&(0,l.createElement)(kl,null))};var Ml=function(){const{mode:e}=(0,d.useSelect)((e=>({mode:e(we.store).__unstableGetEditorMode()})),[]),t=(0,l.useRef)(null);(0,l.useEffect)((()=>{"zoom-out"!==e&&(t.current=!1)}),[e]),(0,l.useEffect)((()=>{if("zoom-out"!==e)return n("zoom-out"),t.current=!0,()=>{t.current&&n(e)}}),[]);const{__unstableSetEditorMode:n}=(0,d.useDispatch)(we.store);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ps,{back:"/",title:(0,E.__)("Browse styles"),description:(0,E.__)("Choose a variation to change the look of the site.")}),(0,l.createElement)(v.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-style-variations"},(0,l.createElement)(v.CardBody,null,(0,l.createElement)(Na,null))))};const{useGlobalStyle:Pl,AdvancedPanel:Il}=nt(we.privateApis);var Bl=function(){const e=(0,E.__)("Add your own CSS to customize the appearance and layout of your site."),[t]=Pl("",void 0,"user",{shouldDecodeEncode:!1}),[n,a]=Pl("",void 0,"all",{shouldDecodeEncode:!1});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ps,{title:(0,E.__)("CSS"),description:(0,l.createElement)(l.Fragment,null,e,(0,l.createElement)(v.ExternalLink,{href:"https://wordpress.org/documentation/article/css/",className:"edit-site-global-styles-screen-css-help-link"},(0,E.__)("Learn more about CSS")))}),(0,l.createElement)("div",{className:"edit-site-global-styles-screen-css"},(0,l.createElement)(Il,{value:t,onChange:a,inheritedValue:n})))};const{ExperimentalBlockEditorProvider:Dl,useGlobalStylesOutputWithConfig:Rl}=nt(we.privateApis);function Ll(e){return!e||0===Object.keys(e).length}var Al=function({onClose:e,userConfig:t,blocks:n}){const{baseConfig:a}=(0,d.useSelect)((e=>({baseConfig:e(_.store).__experimentalGetCurrentThemeBaseGlobalStyles()})),[]),r=(0,l.useMemo)((()=>Ll(t)||Ll(a)?{}:ga(a,t)),[a,t]),o=(0,l.useMemo)((()=>Array.isArray(n)?n:[n]),[n]),i=(0,d.useSelect)((e=>e(we.store).getSettings()),[]),s=(0,l.useMemo)((()=>({...i,__unstableIsPreviewMode:!0})),[i]),[c]=Rl(r),u=Ll(c)||Ll(t)?s.styles:c;return(0,l.createElement)(za,{title:(0,E.__)("Revisions"),onClose:e,closeButtonLabel:(0,E.__)("Close revisions"),enableResizing:!0},(0,l.createElement)(we.__unstableIframe,{className:"edit-site-revisions__iframe",name:"revisions",tabIndex:0},(0,l.createElement)(we.__unstableEditorStyles,{styles:u}),(0,l.createElement)("style",null,".is-root-container { display: flow-root; } body { position: relative; padding: 32px; }"),(0,l.createElement)(v.Disabled,{className:"edit-site-revisions__example-preview__content"},(0,l.createElement)(Dl,{value:o,settings:s},(0,l.createElement)(we.BlockList,{renderAppender:!1})))))};const{createPrivateSlotFill:Fl}=nt(v.privateApis),{Slot:Vl,Fill:zl}=Fl("SidebarFixedBottom");function Ol({children:e}){return(0,l.createElement)(zl,null,(0,l.createElement)("div",{className:"edit-site-sidebar-fixed-bottom-slot"},e))}function Hl(e){const t=e?.author?.name||(0,E.__)("User");if("unsaved"===e?.id)return(0,E.sprintf)((0,E.__)("Unsaved changes by %s"),t);const n=(0,sa.dateI18n)((0,sa.getSettings)().formats.datetimeAbbreviated,(0,sa.getDate)(e?.modified));return e?.isLatest?(0,E.sprintf)((0,E.__)("Changes saved by %1$s on %2$s (current)"),t,n):(0,E.sprintf)((0,E.__)("Changes saved by %1$s on %2$s"),t,n)}var Gl=function({userRevisions:e,selectedRevisionId:t,onChange:n}){return(0,l.createElement)("ol",{className:"edit-site-global-styles-screen-revisions__revisions-list","aria-label":(0,E.__)("Global styles revisions"),role:"group"},e.map(((e,a)=>{const{id:r,author:o,modified:i}=e,s=o?.name||(0,E.__)("User"),c=o?.avatar_urls?.[48],u="unsaved"===e?.id,d=t?t===e?.id:0===a;return(0,l.createElement)("li",{className:y()("edit-site-global-styles-screen-revisions__revision-item",{"is-selected":d}),key:r},(0,l.createElement)(v.Button,{className:"edit-site-global-styles-screen-revisions__revision-button",disabled:d,onClick:()=>{n(e)},label:Hl(e)},(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__description"},(0,l.createElement)("time",{dateTime:i},(0,sa.humanTimeDiff)(i)),(0,l.createElement)("span",{className:"edit-site-global-styles-screen-revisions__meta"},u?(0,E.sprintf)((0,E.__)("Unsaved changes by %s"),s):(0,E.sprintf)((0,E.__)("Changes saved by %s"),s),(0,l.createElement)("img",{alt:o?.name,src:c})))))})))};const{GlobalStylesContext:Ul,areGlobalStyleConfigsEqual:$l}=nt(we.privateApis);var jl=function(){const{goBack:e}=(0,v.__experimentalUseNavigator)(),{user:t,setUserConfig:n}=(0,l.useContext)(Ul),{blocks:a,editorCanvasContainerView:r}=(0,d.useSelect)((e=>({editorCanvasContainerView:nt(e(Gn)).getEditorCanvasContainerView(),blocks:e(we.store).getBlocks()})),[]),{revisions:o,isLoading:i,hasUnsavedChanges:s}=Ka(),[c,u]=(0,l.useState)(),[m,p]=(0,l.useState)(t),[_,g]=(0,l.useState)(!1),{setEditorCanvasContainerView:h}=nt((0,d.useDispatch)(Gn));(0,l.useEffect)((()=>{"global-styles-revisions"!==r&&(e(),h(r))}),[r]);const y=()=>{e()},f=e=>{n((()=>({styles:e?.styles,settings:e?.settings}))),g(!1),y()},b=!!m?.id&&!$l(m,t),w=!i&&o.length;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ps,{title:(0,E.__)("Revisions"),description:(0,E.__)("Revisions are added to the timeline when style changes are saved.")}),i&&(0,l.createElement)(v.Spinner,{className:"edit-site-global-styles-screen-revisions__loading"}),w?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Al,{blocks:a,userConfig:m,onClose:y}),(0,l.createElement)("div",{className:"edit-site-global-styles-screen-revisions"},(0,l.createElement)(Gl,{onChange:e=>{p({styles:e?.styles,settings:e?.settings,id:e?.id}),u(e?.id)},selectedRevisionId:c,userRevisions:o}),b&&(0,l.createElement)(Ol,null,(0,l.createElement)(v.Button,{variant:"primary",className:"edit-site-global-styles-screen-revisions__button",disabled:!m?.id||"unsaved"===m?.id,onClick:()=>{s?g(!0):f(m)}},(0,E.__)("Apply")))),_&&(0,l.createElement)(v.__experimentalConfirmDialog,{title:(0,E.__)("Loading this revision will discard all unsaved changes."),isOpen:_,confirmButtonText:(0,E.__)(" Discard unsaved changes"),onConfirm:()=>f(m),onCancel:()=>g(!1)},(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h2",null,(0,E.__)("Loading this revision will discard all unsaved changes.")),(0,l.createElement)("p",null,(0,E.__)("Do you want to replace your unsaved changes in the editor?"))))):(0,l.createElement)(v.__experimentalSpacer,{marginX:4,"data-testid":"global-styles-no-revisions"},(0,E.__)("No results found.")))};const{Slot:Wl,Fill:Zl}=(0,v.createSlotFill)("GlobalStylesMenu");function ql(){const{toggle:e}=(0,d.useDispatch)(x.store),{canEditCSS:t}=(0,d.useSelect)((e=>{var t;const{getEntityRecord:n,__experimentalGetCurrentGlobalStylesId:a}=e(_.store),r=a(),o=r?n("root","globalStyles",r):void 0;return{canEditCSS:null!==(t=!!o?._links?.["wp:action-edit-css"])&&void 0!==t&&t}}),[]),{goTo:n}=(0,v.__experimentalUseNavigator)(),a=()=>n("/css");return(0,l.createElement)(Zl,null,(0,l.createElement)(v.DropdownMenu,{icon:le,label:(0,E.__)("More")},(({onClose:n})=>(0,l.createElement)(v.MenuGroup,null,t&&(0,l.createElement)(v.MenuItem,{onClick:a},(0,E.__)("Additional CSS")),(0,l.createElement)(v.MenuItem,{onClick:()=>{e("core/edit-site","welcomeGuideStyles"),n()}},(0,E.__)("Welcome Guide"))))))}function Yl({className:e,children:t}){return(0,l.createElement)("span",{className:y()(e,"edit-site-global-styles-sidebar__revisions-count-badge")},t)}function Kl(){const{setIsListViewOpened:e}=(0,d.useDispatch)(Gn),{revisionsCount:t}=(0,d.useSelect)((e=>{var t;const{getEntityRecord:n,__experimentalGetCurrentGlobalStylesId:a}=e(_.store),r=a(),o=r?n("root","globalStyles",r):void 0;return{revisionsCount:null!==(t=o?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0}}),[]),{useGlobalStylesReset:n}=nt(we.privateApis),[a,r]=n(),{goTo:o}=(0,v.__experimentalUseNavigator)(),{setEditorCanvasContainerView:i}=nt((0,d.useDispatch)(Gn)),s=()=>{e(!1),o("/revisions"),i("global-styles-revisions")},c=t>=2;return(0,l.createElement)(Zl,null,a||c?(0,l.createElement)(v.DropdownMenu,{icon:aa,label:(0,E.__)("Revisions")},(({onClose:e})=>(0,l.createElement)(v.MenuGroup,null,c&&(0,l.createElement)(v.MenuItem,{onClick:s,icon:(0,l.createElement)(Yl,null,t)},(0,E.__)("Revision history")),(0,l.createElement)(v.MenuItem,{onClick:()=>{r(),e()},disabled:!a},(0,E.__)("Reset to defaults"))))):(0,l.createElement)(v.Button,{label:(0,E.__)("Revisions"),icon:aa,disabled:!0,__experimentalIsFocusable:!0}))}function Xl({className:e,...t}){return(0,l.createElement)(v.__experimentalNavigatorScreen,{className:["edit-site-global-styles-sidebar__navigator-screen",e].filter(Boolean).join(" "),...t})}function Ql({parentMenu:e,blockStyles:t,blockName:n}){return t.map(((t,a)=>(0,l.createElement)(Xl,{key:a,path:e+"/variations/"+t.name},(0,l.createElement)(Gs,{name:n,variation:t.name}))))}function Jl({name:e,parentMenu:t=""}){const n=(0,d.useSelect)((t=>{const{getBlockStyles:n}=t(c.store);return n(e)}),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Xl,{path:t+"/colors/palette"},(0,l.createElement)(vl,{name:e})),!!n?.length&&(0,l.createElement)(Ql,{parentMenu:t,blockStyles:n,blockName:e}))}function ec(){const e=(0,v.__experimentalUseNavigator)(),{path:t}=e.location;return(0,l.createElement)(Wa,{isSelected:e=>t===`/blocks/${encodeURIComponent(e)}`||t.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t=>{e.goTo("/blocks/"+encodeURIComponent(t))}})}function tc(){const e=(0,v.__experimentalUseNavigator)(),{selectedBlockName:t,selectedBlockClientId:n}=(0,d.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:n}=e(we.store),a=t();return{selectedBlockName:n(a),selectedBlockClientId:a}}),[]),a=fs(t);(0,l.useEffect)((()=>{if(!n||!a)return;const r=e.location.path;if("/blocks"!==r&&!r.startsWith("/blocks/"))return;const o="/blocks/"+encodeURIComponent(t);o!==r&&e.goTo(o,{skipFocus:!0})}),[n,t,a])}function nc(){const{goTo:e,location:t}=(0,v.__experimentalUseNavigator)(),n=(0,d.useSelect)((e=>nt(e(Gn)).getEditorCanvasContainerView()),[]);(0,l.useEffect)((()=>{"global-styles-revisions"===n?e("/revisions"):n&&"/revisions"===t?.path?e("/"):"global-styles-css"===n&&e("/css")}),[n,e])}var ac=function(){const e=(0,c.getBlockTypes)(),t=(0,d.useSelect)((e=>nt(e(Gn)).getEditorCanvasContainerView()),[]);return(0,l.createElement)(v.__experimentalNavigatorProvider,{className:"edit-site-global-styles-sidebar__navigator-provider",initialPath:"/"},(0,l.createElement)(Xl,{path:"/"},(0,l.createElement)(us,null)),(0,l.createElement)(Xl,{path:"/variations"},(0,l.createElement)(Ml,null)),(0,l.createElement)(Xl,{path:"/blocks"},(0,l.createElement)(ws,null)),(0,l.createElement)(Xl,{path:"/typography"},(0,l.createElement)(js,null)),(0,l.createElement)(Xl,{path:"/typography/text"},(0,l.createElement)(el,{element:"text"})),(0,l.createElement)(Xl,{path:"/typography/link"},(0,l.createElement)(el,{element:"link"})),(0,l.createElement)(Xl,{path:"/typography/heading"},(0,l.createElement)(el,{element:"heading"})),(0,l.createElement)(Xl,{path:"/typography/caption"},(0,l.createElement)(el,{element:"caption"})),(0,l.createElement)(Xl,{path:"/typography/button"},(0,l.createElement)(el,{element:"button"})),(0,l.createElement)(Xl,{path:"/colors"},(0,l.createElement)(ul,null)),(0,l.createElement)(Xl,{path:"/layout"},(0,l.createElement)(Nl,null)),(0,l.createElement)(Xl,{path:"/css"},(0,l.createElement)(Bl,null)),(0,l.createElement)(Xl,{path:"/revisions"},(0,l.createElement)(jl,null)),e.map((e=>(0,l.createElement)(Xl,{key:"menu-block-"+e.name,path:"/blocks/"+encodeURIComponent(e.name)},(0,l.createElement)(Gs,{name:e.name})))),(0,l.createElement)(Jl,null),e.map((e=>(0,l.createElement)(Jl,{key:"screens-block-"+e.name,name:e.name,parentMenu:"/blocks/"+encodeURIComponent(e.name)}))),"style-book"===t&&(0,l.createElement)(ec,null),(0,l.createElement)(Kl,null),(0,l.createElement)(ql,null),(0,l.createElement)(tc,null),(0,l.createElement)(nc,null))};function rc(){const{shouldClearCanvasContainerView:e,isStyleBookOpened:t,showListViewByDefault:n}=(0,d.useSelect)((e=>{const{getActiveComplementaryArea:t}=e(U),{getEditorCanvasContainerView:n,getCanvasMode:a}=nt(e(Gn)),r="visual"===e(Gn).getEditorMode(),o="edit"===a(),i=e(x.store).get("core/edit-site","showListViewByDefault");return{isStyleBookOpened:"style-book"===n(),shouldClearCanvasContainerView:"edit-site/global-styles"!==t("core/edit-site")||!r||!o,showListViewByDefault:i}}),[]),{setEditorCanvasContainerView:a}=nt((0,d.useDispatch)(Gn));(0,l.useEffect)((()=>{e&&a(void 0)}),[e]);const{setIsListViewOpened:r}=(0,d.useDispatch)(Gn);return(0,l.createElement)(Qi,{className:"edit-site-global-styles-sidebar",identifier:"edit-site/global-styles",title:(0,E.__)("Styles"),icon:Zn,closeLabel:(0,E.__)("Close Styles"),panelClassName:"edit-site-global-styles-sidebar__panel",header:(0,l.createElement)(v.Flex,{className:"edit-site-global-styles-sidebar__header",role:"menubar","aria-label":(0,E.__)("Styles actions")},(0,l.createElement)(v.FlexBlock,{style:{minWidth:"min-content"}},(0,l.createElement)("strong",null,(0,E.__)("Styles"))),(0,l.createElement)(v.FlexItem,null,(0,l.createElement)(v.Button,{icon:ra,label:(0,E.__)("Style Book"),isPressed:t,disabled:e,onClick:()=>{r(t&&n),a(t?void 0:"style-book")}})),(0,l.createElement)(Wl,null))},(0,l.createElement)(ac,null))}const oc="edit-site/template",ic="edit-site/block-inspector",sc={wp_navigation:(0,E.__)("Navigation"),wp_block:(0,E.__)("Pattern"),wp_template:(0,E.__)("Template")};var lc=({sidebarName:e})=>{const{hasPageContentFocus:t,entityType:n}=(0,d.useSelect)((e=>{const{getEditedPostType:t,hasPageContentFocus:n}=e(Gn);return{hasPageContentFocus:n(),entityType:t()}})),a=sc[n]||sc.wp_template,{enableComplementaryArea:r}=(0,d.useDispatch)(U);let o;return o=t?e===oc?(0,E.__)("Page (selected)"):(0,E.__)("Page"):e===oc?(0,E.sprintf)((0,E.__)("%s (selected)"),a):a,(0,l.createElement)("ul",null,(0,l.createElement)("li",null,(0,l.createElement)(v.Button,{onClick:()=>r(Ft,oc),className:y()("edit-site-sidebar-edit-mode__panel-tab",{"is-active":e===oc}),"aria-label":o,"data-label":t?(0,E.__)("Page"):a},t?(0,E.__)("Page"):a)),(0,l.createElement)("li",null,(0,l.createElement)(v.Button,{onClick:()=>r(Ft,ic),className:y()("edit-site-sidebar-edit-mode__panel-tab",{"is-active":e===ic}),"aria-label":e===ic?(0,E.__)("Block (selected)"):(0,E.__)("Block"),"data-label":(0,E.__)("Block")},(0,E.__)("Block"))))};function cc({className:e,title:t,icon:n,description:a,actions:r,children:o}){return(0,l.createElement)("div",{className:y()("edit-site-sidebar-card",e)},(0,l.createElement)(v.Icon,{className:"edit-site-sidebar-card__icon",icon:n}),(0,l.createElement)("div",{className:"edit-site-sidebar-card__content"},(0,l.createElement)("div",{className:"edit-site-sidebar-card__header"},(0,l.createElement)("h2",{className:"edit-site-sidebar-card__title"},t),r),(0,l.createElement)("div",{className:"edit-site-sidebar-card__description"},a),o))}const{BlockQuickNavigation:uc}=nt(we.privateApis);function dc(){const e=(0,d.useSelect)((e=>nt(e(we.store)).getEnabledClientIdsTree()),[]),t=(0,l.useMemo)((()=>e.map((({clientId:e})=>e))),[e]);return(0,l.createElement)(uc,{clientIds:t})}const mc=[{label:(0,l.createElement)(l.Fragment,null,(0,E.__)("Draft"),(0,l.createElement)(v.__experimentalText,{variant:"muted"},(0,E.__)("Not ready to publish."))),value:"draft"},{label:(0,l.createElement)(l.Fragment,null,(0,E.__)("Pending"),(0,l.createElement)(v.__experimentalText,{variant:"muted"},(0,E.__)("Waiting for review before publishing."))),value:"pending"},{label:(0,l.createElement)(l.Fragment,null,(0,E.__)("Private"),(0,l.createElement)(v.__experimentalText,{variant:"muted"},(0,E.__)("Only visible to site admins and editors."))),value:"private"},{label:(0,l.createElement)(l.Fragment,null,(0,E.__)("Scheduled"),(0,l.createElement)(v.__experimentalText,{variant:"muted"},(0,E.__)("Publish automatically on a chosen date."))),value:"future"},{label:(0,l.createElement)(l.Fragment,null,(0,E.__)("Published"),(0,l.createElement)(v.__experimentalText,{variant:"muted"},(0,E.__)("Visible to everyone."))),value:"publish"}];function pc({postType:e,postId:t,status:n,password:a,date:r}){const[o,i]=(0,l.useState)(!!a),{editEntityRecord:s}=(0,d.useDispatch)(_.store),{createErrorNotice:c}=(0,d.useDispatch)(Se.store),[u,m]=(0,l.useState)(null),p=(0,l.useMemo)((()=>({anchor:u,"aria-label":(0,E.__)("Change status"),placement:"bottom-end"})),[u]),g=async({status:o=n,password:i=a,date:l=r})=>{try{await s("postType",e,t,{status:o,date:l,password:i})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while updating the status");c(t,{type:"snackbar"})}},h=e=>{i(e),e||g({password:""})},y=e=>{let t=r,n=a;"publish"===e?new Date(r)>new Date&&(t=null):"future"===e?(!r||new Date(r)<new Date)&&(t=new Date,t.setDate(t.getDate()+7)):"private"===e&&a&&(i(!1),n=""),g({status:e,date:t,password:n})};return(0,l.createElement)(v.__experimentalHStack,{className:"edit-site-summary-field"},(0,l.createElement)(v.__experimentalText,{className:"edit-site-summary-field__label"},(0,E.__)("Status")),(0,l.createElement)(v.Dropdown,{contentClassName:"edit-site-change-status__content",popoverProps:p,focusOnMount:!0,ref:m,renderToggle:({onToggle:e})=>(0,l.createElement)(v.Button,{className:"edit-site-summary-field__trigger",variant:"tertiary",onClick:e},(0,l.createElement)(Hi,{status:a?"protected":n})),renderContent:({onClose:e})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(we.__experimentalInspectorPopoverHeader,{title:(0,E.__)("Status"),onClose:e}),(0,l.createElement)("form",null,(0,l.createElement)(v.__experimentalVStack,{spacing:5},(0,l.createElement)(v.RadioControl,{className:"edit-site-change-status__options",hideLabelFromVision:!0,label:(0,E.__)("Status"),options:mc,onChange:y,selected:n}),"private"!==n&&(0,l.createElement)(v.BaseControl,{id:"edit-site-change-status__password",label:(0,E.__)("Password")},(0,l.createElement)(v.ToggleControl,{label:(0,E.__)("Hide this page behind a password"),checked:o,onChange:h}),o&&(0,l.createElement)(v.TextControl,{onChange:e=>g({password:e}),value:a,placeholder:(0,E.__)("Use a secure password"),type:"text"})))))}))}function _c({postType:e,postId:t,status:n,date:a}){const{editEntityRecord:r}=(0,d.useDispatch)(_.store),{createErrorNotice:o}=(0,d.useDispatch)(Se.store),[i,s]=(0,l.useState)(null),c=(0,l.useMemo)((()=>({anchor:i,"aria-label":(0,E.__)("Change publish date"),placement:"bottom-end"})),[i]),u=async a=>{try{let o=n;"future"===n&&new Date(a)<new Date?o="publish":"publish"===n&&new Date(a)>new Date&&(o="future"),await r("postType",e,t,{status:o,date:a})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while updating the status");o(t,{type:"snackbar"})}},m=a?(0,sa.humanTimeDiff)(a):(0,E.__)("Immediately");return(0,l.createElement)(v.__experimentalHStack,{className:"edit-site-summary-field"},(0,l.createElement)(v.__experimentalText,{className:"edit-site-summary-field__label"},(0,E.__)("Publish")),(0,l.createElement)(v.Dropdown,{contentClassName:"edit-site-change-status__content",popoverProps:c,focusOnMount:!0,ref:s,renderToggle:({onToggle:e})=>(0,l.createElement)(v.Button,{className:"edit-site-summary-field__trigger",variant:"tertiary",onClick:e},m),renderContent:({onClose:e})=>(0,l.createElement)(we.__experimentalPublishDateTimePicker,{currentDate:a,is12Hour:!0,onClose:e,onChange:u})}))}function gc({status:e,date:t,password:n,postId:a,postType:r}){return(0,l.createElement)(v.__experimentalVStack,null,(0,l.createElement)(pc,{status:e,date:t,password:n,postId:a,postType:r}),(0,l.createElement)(_c,{status:e,date:t,postId:a,postType:r}))}function hc(){const{context:e,hasResolved:t,title:n,blocks:a}=(0,d.useSelect)((e=>{const{getEditedPostContext:t,getEditedPostType:n,getEditedPostId:a}=e(Gn),{getEditedEntityRecord:r,hasFinishedResolution:o}=e(_.store),i=t(),s=["postType",n(),a()],l=r(...s);return{context:i,hasResolved:o("getEditedEntityRecord",s),title:l?.title,blocks:l?.blocks}}),[]),{setHasPageContentFocus:r}=(0,d.useDispatch)(Gn),o=(0,l.useMemo)((()=>({...e,postType:null,postId:null})),[e]);return t?(0,l.createElement)(v.__experimentalVStack,null,(0,l.createElement)("div",null,(0,At.decodeEntities)(n)),(0,l.createElement)("div",{className:"edit-site-page-panels__edit-template-preview"},(0,l.createElement)(we.BlockContextProvider,{value:o},(0,l.createElement)(we.BlockPreview,{viewportWidth:1024,blocks:a}))),(0,l.createElement)(v.Button,{className:"edit-site-page-panels__edit-template-button",variant:"secondary",onClick:()=>r(!1)},(0,E.__)("Edit template"))):null}function yc(){const{id:e,type:t,hasResolved:n,status:a,date:r,password:o,title:i,modified:s}=(0,d.useSelect)((e=>{const{getEditedPostContext:t}=e(Gn),{getEditedEntityRecord:n,hasFinishedResolution:a}=e(_.store),r=t(),o=["postType",r.postType,r.postId],i=n(...o);return{hasResolved:a("getEditedEntityRecord",o),title:i?.title,id:i?.id,type:i?.type,status:i?.status,date:i?.date,password:i?.password,modified:i?.modified}}),[]);return n?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.PanelBody,null,(0,l.createElement)(cc,{title:(0,At.decodeEntities)(i),icon:qn,description:(0,l.createElement)(v.__experimentalVStack,null,(0,l.createElement)(v.__experimentalText,null,(0,E.sprintf)((0,E.__)("Last edited %s"),(0,sa.humanTimeDiff)(s))))})),(0,l.createElement)(v.PanelBody,{title:(0,E.__)("Summary")},(0,l.createElement)(gc,{status:a,date:r,password:o,postId:e,postType:t})),(0,l.createElement)(v.PanelBody,{title:(0,E.__)("Content")},(0,l.createElement)(dc,null)),(0,l.createElement)(v.PanelBody,{title:(0,E.__)("Template")},(0,l.createElement)(hc,null))):null}function vc({template:e}){const{revertTemplate:t}=(0,d.useDispatch)(Gn);return zt(e)?(0,l.createElement)(v.DropdownMenu,{icon:le,label:(0,E.__)("Actions"),className:"edit-site-template-card__actions",toggleProps:{isSmall:!0}},(({onClose:n})=>(0,l.createElement)(v.MenuGroup,null,(0,l.createElement)(v.MenuItem,{info:(0,E.__)("Use the template as supplied by the theme."),onClick:()=>{t(e),n()}},(0,E.__)("Clear customizations"))))):null}function Ec({area:e,clientId:t}){const{selectBlock:n,toggleBlockHighlight:a}=(0,d.useDispatch)(we.store),r=(0,d.useSelect)((t=>t(g.store).__experimentalGetDefaultTemplatePartAreas().find((t=>t.area===e))),[e]),o=()=>a(t,!0),i=()=>a(t,!1);return(0,l.createElement)(v.Button,{className:"edit-site-template-card__template-areas-item",icon:r?.icon,onMouseOver:o,onMouseLeave:i,onFocus:o,onBlur:i,onClick:()=>{n(t)}},r?.label)}function fc(){const e=(0,d.useSelect)((e=>e(Gn).getCurrentTemplateTemplateParts()),[]);return e.length?(0,l.createElement)("section",{className:"edit-site-template-card__template-areas"},(0,l.createElement)(v.__experimentalHeading,{level:3,className:"edit-site-template-card__template-areas-title"},(0,E.__)("Areas")),(0,l.createElement)("ul",{className:"edit-site-template-card__template-areas-list"},e.map((({templatePart:e,block:t})=>(0,l.createElement)("li",{key:e.slug},(0,l.createElement)(Ec,{area:e.area,clientId:t.clientId})))))):null}const bc=()=>{var e,t;const{record:n}=qr();return{currentTemplate:n,lastRevisionId:null!==(e=n?._links?.["predecessor-version"]?.[0]?.id)&&void 0!==e?e:null,revisionsCount:null!==(t=n?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0}};function wc({children:e}){const{lastRevisionId:t,revisionsCount:n}=bc();return!t||n<2?null:(0,l.createElement)(g.PostTypeSupportCheck,{supportKeys:"revisions"},e)}const Sc=()=>{const{lastRevisionId:e,revisionsCount:t}=bc();return(0,l.createElement)(wc,null,(0,l.createElement)(v.Button,{href:(0,Et.addQueryArgs)("revision.php",{revision:e,gutenberg:!0}),className:"edit-site-template-last-revision__title",icon:aa},(0,E.sprintf)((0,E._n)("%d Revision","%d Revisions",t),t)))};function kc(){return(0,l.createElement)(wc,null,(0,l.createElement)(Sc,null))}function Cc(){const{info:{title:e,description:t,icon:n},record:a}=(0,d.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=e(Gn),{getEditedEntityRecord:a}=e(_.store),{__experimentalGetTemplateInfo:r}=e(g.store),o=a("postType",t(),n());return{info:o?r(o):{},record:o}}),[]);return e||t?(0,l.createElement)(v.PanelBody,{className:"edit-site-template-panel"},(0,l.createElement)(cc,{className:"edit-site-template-card",title:(0,At.decodeEntities)(e),icon:"wp_navigation"===a?.type?Wn:n,description:(0,At.decodeEntities)(t),actions:(0,l.createElement)(vc,{template:a})},(0,l.createElement)(fc,null)),(0,l.createElement)(v.PanelRow,{header:(0,E.__)("Editing history"),className:"edit-site-template-revisions"},(0,l.createElement)(kc,null))):null}const{Fill:xc,Slot:Tc}=(0,v.createSlotFill)("PluginTemplateSettingPanel"),Nc=xc;Nc.Slot=Tc;var Mc=Nc;const{Slot:Pc,Fill:Ic}=(0,v.createSlotFill)("EditSiteSidebarInspector"),Bc=Ic;function Dc(){const{sidebar:e,isEditorSidebarOpened:t,hasBlockSelection:n,supportsGlobalStyles:a,hasPageContentFocus:r}=(0,d.useSelect)((e=>{const t=e(U).getActiveComplementaryArea(Ft),n=[ic,oc].includes(t),a=e(Gn).getSettings();return{sidebar:t,isEditorSidebarOpened:n,hasBlockSelection:!!e(we.store).getBlockSelectionStart(),supportsGlobalStyles:!a?.supportsTemplatePartsMode,hasPageContentFocus:e(Gn).hasPageContentFocus()}}),[]),{enableComplementaryArea:o}=(0,d.useDispatch)(U);(0,l.useEffect)((()=>{t&&(n?r||o(Ft,ic):o(Ft,oc))}),[n,t,r]);let i=e;return t||(i=n?ic:oc),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Qi,{identifier:i,title:(0,E.__)("Settings"),icon:(0,E.isRTL)()?Ki:Xi,closeLabel:(0,E.__)("Close Settings"),header:(0,l.createElement)(lc,{sidebarName:i}),headerClassName:"edit-site-sidebar-edit-mode__panel-tabs"},i===oc&&(0,l.createElement)(l.Fragment,null,r?(0,l.createElement)(yc,null):(0,l.createElement)(Cc,null),(0,l.createElement)(Mc.Slot,null)),i===ic&&(0,l.createElement)(Pc,{bubblesVirtually:!0})),a&&(0,l.createElement)(rc,null))}var Rc=window.wp.reusableBlocks;function Lc({clientId:e,onClose:t}){const{getBlocks:n}=(0,d.useSelect)(we.store),{replaceBlocks:a}=(0,d.useDispatch)(we.store);return(0,d.useSelect)((t=>t(we.store).canRemoveBlock(e)),[e])?(0,l.createElement)(v.MenuItem,{onClick:()=>{a(e,n(e)),t()}},(0,E.__)("Detach blocks from template part")):null}var Ac=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"}));function Fc({clientIds:e,blocks:t}){const[n,a]=(0,l.useState)(!1),{replaceBlocks:r}=(0,d.useDispatch)(we.store),{createSuccessNotice:o}=(0,d.useDispatch)(Se.store),{canCreate:i}=(0,d.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(Gn).getSettings();return{canCreate:!t}}),[]);if(!i)return null;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.MenuItem,{icon:Ac,onClick:()=>{a(!0)}},(0,E.__)("Create template part")),n&&(0,l.createElement)(Bo,{closeModal:()=>{a(!1)},blocks:t,onCreate:async t=>{r(e,(0,c.createBlock)("core/template-part",{slug:t.slug,theme:t.theme})),o((0,E.__)("Template part created."),{type:"snackbar"})}}))}function Vc(){return(0,l.createElement)(we.BlockSettingsMenuControls,null,(({selectedClientIds:e,onClose:t})=>(0,l.createElement)(zc,{clientIds:e,onClose:t})))}function zc({clientIds:e,onClose:t}){const n=(0,d.useSelect)((t=>t(we.store).getBlocksByClientId(e)),[e]);return 1===n.length&&"core/template-part"===n[0]?.name?(0,l.createElement)(Lc,{clientId:e[0],onClose:t}):(0,l.createElement)(Fc,{clientIds:e,blocks:n})}var Oc=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"}));const{useLocation:Hc,useHistory:Gc}=nt(vt.privateApis);var Uc=function(){const e=Hc(),t=Gc(),n="wp_template_part"===e.params.postType,a="wp_navigation"===e.params.postType,r=e.state?.fromTemplateId;return(n||a)&&r?(0,l.createElement)(v.Button,{className:"edit-site-visual-editor__back-button",icon:Oc,onClick:()=>{t.back()}},(0,E.__)("Back")):null};var $c=function({enableResizing:e,settings:t,children:n,...a}){const{canvasMode:r,deviceType:o,isZoomOutMode:i}=(0,d.useSelect)((e=>({deviceType:e(Gn).__experimentalGetPreviewDeviceType(),isZoomOutMode:"zoom-out"===e(we.store).__unstableGetEditorMode(),canvasMode:nt(e(Gn)).getCanvasMode()})),[]),{setCanvasMode:s}=nt((0,d.useDispatch)(Gn)),c=(0,we.__experimentalUseResizeCanvas)(o),u=(0,we.__unstableUseMouseMoveTypingReset)(),[m,p]=(0,l.useState)(!1);(0,l.useEffect)((()=>{"edit"===r&&p(!1)}),[r]);const _={"aria-label":(0,E.__)("Editor Canvas"),role:"button",tabIndex:0,onFocus:()=>p(!0),onBlur:()=>p(!1),onKeyDown:e=>{const{keyCode:t}=e;t!==la.ENTER&&t!==la.SPACE||(e.preventDefault(),s("edit"))},onClick:()=>s("edit"),readonly:!0};return(0,l.createElement)(we.__unstableIframe,{expand:i,scale:i?.45:void 0,frameSize:i?100:void 0,style:e?{}:c,ref:u,name:"editor-canvas",className:y()("edit-site-visual-editor__editor-canvas",{"is-focused":m&&"view"===r}),...a,..."view"===r?_:{}},(0,l.createElement)(we.__unstableEditorStyles,{styles:t.styles}),(0,l.createElement)("style",null,`.is-root-container{display:flow-root;${e?"min-height:0!important;":""}}body{position:relative; ${"view"===r?"cursor: pointer; min-height: 100vh;":""}}}`),n)};const jc=(e,t)=>`<a ${Wc(e)}>${t}</a>`,Wc=e=>`href="${e}" target="_blank" rel="noreferrer noopener"`,Zc=e=>{const{title:t,foreign_landing_url:n,creator:a,creator_url:r,license:o,license_version:i,license_url:s}=e,l=((e,t)=>{let n=e.trim();return"pdm"!==e&&(n=e.toUpperCase().replace("SAMPLING","Sampling")),t&&(n+=` ${t}`),["pdm","cc0"].includes(e)||(n=`CC ${n}`),n})(o,i),c=(0,At.decodeEntities)(a);let u;return u=c?t?(0,E.sprintf)((0,E._x)('"%1$s" by %2$s/ %3$s',"caption"),jc(n,(0,At.decodeEntities)(t)),r?jc(r,c):c,s?jc(`${s}?ref=openverse`,l):l):(0,E.sprintf)((0,E._x)("<a %1$s>Work</a> by %2$s/ %3$s","caption"),Wc(n),r?jc(r,c):c,s?jc(`${s}?ref=openverse`,l):l):t?(0,E.sprintf)((0,E._x)('"%1$s"/ %2$s',"caption"),jc(n,(0,At.decodeEntities)(t)),s?jc(`${s}?ref=openverse`,l):l):(0,E.sprintf)((0,E._x)("<a %1$s>Work</a>/ %3$s","caption"),Wc(n),s?jc(`${s}?ref=openverse`,l):l),u.replace(/\s{2}/g," ")},qc=async(e={})=>(await(0,d.resolveSelect)(_.store).getMediaItems({...e,orderBy:e?.search?"relevance":"date"})).map((e=>({...e,alt:e.alt_text,url:e.source_url,previewUrl:e.media_details?.sizes?.medium?.source_url,caption:e.caption?.raw})));var Yc=[{name:"images",labels:{name:(0,E.__)("Images"),search_items:(0,E.__)("Search images")},mediaType:"image",async fetch(e={}){return qc({...e,media_type:"image"})}},{name:"videos",labels:{name:(0,E.__)("Videos"),search_items:(0,E.__)("Search videos")},mediaType:"video",async fetch(e={}){return qc({...e,media_type:"video"})}},{name:"audio",labels:{name:(0,E.__)("Audio"),search_items:(0,E.__)("Search audio")},mediaType:"audio",async fetch(e={}){return qc({...e,media_type:"audio"})}},{name:"openverse",labels:{name:(0,E.__)("Openverse"),search_items:(0,E.__)("Search Openverse")},mediaType:"image",async fetch(e={}){const t={...e,mature:!1,excluded_source:"flickr,inaturalist,wikimedia",license:"pdm,cc0"},n={per_page:"page_size",search:"q"},a=new URL("https://api.openverse.engineering/v1/images/");Object.entries(t).forEach((([e,t])=>{const r=n[e]||e;a.searchParams.set(r,t)}));const r=await window.fetch(a,{headers:{"User-Agent":"WordPress/inserter-media-fetch"}});return(await r.json()).results.map((e=>({...e,title:e.title?.toLowerCase().startsWith("file:")?e.title.slice(5):e.title,sourceId:e.id,id:void 0,caption:Zc(e),previewUrl:e.thumbnail})))},getReportUrl:({sourceId:e})=>`https://wordpress.org/openverse/image/${e}/report/`,isExternalResource:!0}];function Kc(){var e,t;const{setIsInserterOpened:n}=(0,d.useDispatch)(Gn),{storedSettings:a,canvasMode:r,templateType:o}=(0,d.useSelect)((e=>{const{getSettings:t,getCanvasMode:a,getEditedPostType:r}=nt(e(Gn));return{storedSettings:t(n),canvasMode:a(),templateType:r()}}),[n]),i=null!==(e=a.__experimentalAdditionalBlockPatterns)&&void 0!==e?e:a.__experimentalBlockPatterns,s=null!==(t=a.__experimentalAdditionalBlockPatternCategories)&&void 0!==t?t:a.__experimentalBlockPatternCategories,{restBlockPatterns:c,restBlockPatternCategories:u}=(0,d.useSelect)((e=>({restBlockPatterns:e(_.store).getBlockPatterns(),restBlockPatternCategories:e(_.store).getBlockPatternCategories()})),[]),m=(0,l.useMemo)((()=>[...i||[],...c||[]].filter(((e,t,n)=>t===n.findIndex((t=>e.name===t.name)))).filter((({postTypes:e})=>!e||Array.isArray(e)&&e.includes(o)))),[i,c,o]),p=(0,l.useMemo)((()=>[...s||[],...u||[]].filter(((e,t,n)=>t===n.findIndex((t=>e.name===t.name))))),[s,u]);return(0,l.useMemo)((()=>{const{__experimentalAdditionalBlockPatterns:e,__experimentalAdditionalBlockPatternCategories:t,focusMode:n,...o}=a;return{...o,inserterMediaCategories:Yc,__experimentalBlockPatterns:m,__experimentalBlockPatternCategories:p,templateLock:!1,template:!1,focusMode:("view"!==r||!n)&&n}}),[a,m,p,r])}const Xc=["wp_template_part","wp_navigation","wp_block"],{useBlockEditingMode:Qc}=nt(we.privateApis),Jc=["core/post-title","core/post-featured-image","core/post-content"];function eu(){return Qc("disabled"),(0,l.useEffect)((()=>((0,Ee.addFilter)("editor.BlockEdit","core/edit-site/disable-non-content-blocks",tu),()=>(0,Ee.removeFilter)("editor.BlockEdit","core/edit-site/disable-non-content-blocks"))),[]),null}const tu=(0,re.createHigherOrderComponent)((e=>t=>{const n=void 0!==t.context.queryId,a=Jc.includes(t.name)&&!n;return Qc(a?"contentOnly":void 0),(0,l.createElement)(e,{...t})}),"withDisableNonPageContentBlocks");function nu({contentRef:e}){const t=(0,d.useSelect)((e=>e(Gn).hasPageContentFocus()),[]),{getNotices:n}=(0,d.useSelect)(Se.store),{createInfoNotice:a,removeNotice:r}=(0,d.useDispatch)(Se.store),{setHasPageContentFocus:o}=(0,d.useDispatch)(Gn),[i,s]=(0,l.useState)(!1),c=(0,l.useRef)(0);return(0,l.useEffect)((()=>{const i=async e=>{if(!t)return;if(!e.target.classList.contains("is-root-container"))return;const r=n().some((e=>e.id===c.current));if(r)return;const{notice:i}=await a((0,E.__)("Edit your template to edit this block."),{isDismissible:!0,type:"snackbar",actions:[{label:(0,E.__)("Edit template"),onClick:()=>o(!1)}]});c.current=i.id},l=e=>{t&&e.target.classList.contains("is-root-container")&&(c.current&&r(c.current),s(!0))},u=e.current;return u?.addEventListener("click",i),u?.addEventListener("dblclick",l),()=>{u?.removeEventListener("click",i),u?.removeEventListener("dblclick",l)}}),[c,t,e.current]),(0,l.createElement)(v.__experimentalConfirmDialog,{isOpen:i,confirmButtonText:(0,E.__)("Edit template"),onConfirm:()=>{s(!1),o(!1)},onCancel:()=>s(!1)},(0,E.__)("Edit your template to edit this block."))}function au(){return function(){const{isPage:e,hasPageContentFocus:t}=(0,d.useSelect)((e=>({isPage:e(Gn).isPage(),hasPageContentFocus:e(Gn).hasPageContentFocus()})),[]),n=(0,l.useRef)(!1),a=(0,l.useRef)(!1),{createInfoNotice:r}=(0,d.useDispatch)(Se.store),{setHasPageContentFocus:o}=(0,d.useDispatch)(Gn);(0,l.useEffect)((()=>{!n.current&&e&&a.current&&!t&&(r((0,E.__)("You are editing a template."),{isDismissible:!0,type:"snackbar",actions:[{label:(0,E.__)("Back to page"),onClick:()=>o(!0)}]}),n.current=!0),a.current=t}),[n,e,a,t,r,o])}(),null}function ru({contentRef:e}){const t=(0,d.useSelect)((e=>e(Gn).hasPageContentFocus()),[]);return(0,l.createElement)(l.Fragment,null,t&&(0,l.createElement)(eu,null),(0,l.createElement)(nu,{contentRef:e}),(0,l.createElement)(au,null))}const ou={type:"default",alignments:[]};function iu(){const{clearSelectedBlock:e}=(0,d.useDispatch)(we.store),{templateType:t,isFocusMode:n,isViewMode:a}=(0,d.useSelect)((e=>{const{getEditedPostType:t,getCanvasMode:n}=nt(e(Gn)),a=t();return{templateType:a,isFocusMode:Xc.includes(a),isViewMode:"view"===n()}}),[]),[r,o]=(0,re.useResizeObserver)(),i=Kc(),{hasBlocks:s}=(0,d.useSelect)((e=>{const{getBlockCount:t}=e(we.store);return{hasBlocks:!!t()}}),[]),c=(0,re.useViewportMatch)("small","<"),u=n&&!a&&!c,m=(0,l.useRef)(),p=(0,re.useMergeRefs)([m,(0,we.__unstableUseClipboardHandler)(),(0,we.__unstableUseTypingObserver)()]),_="wp_navigation"===t,g=!(_&&n&&s||a)&&void 0;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(za.Slot,null,(([t])=>{var s;return t?(0,l.createElement)("div",{className:"edit-site-visual-editor is-focus-mode"},t):(0,l.createElement)(we.BlockTools,{className:y()("edit-site-visual-editor",{"is-focus-mode":n||!!t,"is-view-mode":a}),__unstableContentRef:m,onClick:t=>{t.target===t.currentTarget&&e()}},(0,l.createElement)(we.BlockEditorKeyboardShortcuts.Register,null),(0,l.createElement)(Uc,null),(0,l.createElement)(Ba,{enableResizing:u,height:null!==(s=o.height)&&void 0!==s?s:"100%"},(0,l.createElement)($c,{enableResizing:u,settings:i,contentRef:p,readonly:a},r,(0,l.createElement)(we.BlockList,{className:y()("edit-site-block-editor__block-list wp-site-blocks",{"is-navigation-block":_}),layout:ou,renderAppender:g}))))})),(0,l.createElement)(ru,{contentRef:m}))}const{ExperimentalBlockEditorProvider:su}=nt(we.privateApis);function lu({children:e}){const t=Kc(),{templateType:n}=(0,d.useSelect)((e=>{const{getEditedPostType:t}=nt(e(Gn));return{templateType:t()}}),[]),[a,r,o]=(0,_.useEntityBlockEditor)("postType",n);return(0,l.createElement)(su,{settings:t,value:a,onInput:r,onChange:o,useSubRegistry:!1},e)}const{ExperimentalBlockEditorProvider:cu}=nt(we.privateApis),uu=()=>{};function du({children:e}){const t=Kc(),n=(0,_.useEntityId)("postType","wp_navigation"),a=(0,l.useMemo)((()=>[(0,c.createBlock)("core/navigation",{ref:n,templateLock:!1})]),[n]),{isEditMode:r}=(0,d.useSelect)((e=>{const{getCanvasMode:t}=nt(e(Gn));return{isEditMode:"edit"===t()}}),[]),{selectBlock:o,setBlockEditingMode:i,unsetBlockEditingMode:s}=nt((0,d.useDispatch)(we.store)),u=a&&a[0]?.clientId,m=(0,l.useMemo)((()=>({...t,templateLock:"insert",template:[["core/navigation",{},[]]]})),[t]);return(0,l.useEffect)((()=>{u&&r&&o(u)}),[u,r,o]),(0,l.useEffect)((()=>{if(u)return i(u,"contentOnly"),()=>{s(u)}}),[u,s,i]),(0,l.createElement)(cu,{settings:m,value:a,onInput:uu,onChange:uu,useSubRegistry:!1},e)}function mu(){const e=function(e){let t=null;t="wp_navigation"===e?du:lu;return t}((0,d.useSelect)((e=>e(Gn).getEditedPostType()),[]));return(0,l.createElement)(e,null,(0,l.createElement)(Vc,null),(0,l.createElement)(Bc,null,(0,l.createElement)(we.BlockInspector,null)),(0,l.createElement)(iu,null),(0,l.createElement)(Rc.ReusableBlocksMenuItems,null))}var pu=n(773);function _u({value:e,onChange:t,onInput:n}){const[a,r]=(0,l.useState)(e),[o,i]=(0,l.useState)(!1),s=(0,re.useInstanceId)(_u),c=(0,l.useRef)();o||a===e||r(e);return(0,l.useEffect)((()=>()=>{c.current&&t(c.current)}),[]),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.VisuallyHidden,{as:"label",htmlFor:`code-editor-text-area-${s}`},(0,E.__)("Type text or HTML")),(0,l.createElement)(pu.Z,{autoComplete:"off",dir:"auto",value:a,onChange:e=>{const t=e.target.value;n(t),r(t),i(!0),c.current=t},onBlur:()=>{o&&(t(a),i(!1))},className:"edit-site-code-editor-text-area",id:`code-editor-text-area-${s}`,placeholder:(0,E.__)("Start writing with text or HTML")}))}function gu(){const{templateType:e,shortcut:t}=(0,d.useSelect)((e=>{const{getEditedPostType:t}=e(Gn),{getShortcutRepresentation:n}=e(Un.store);return{templateType:t(),shortcut:n("core/edit-site/toggle-mode")}}),[]),[n,a]=(0,_.useEntityProp)("postType",e,"content"),[r,,o]=(0,_.useEntityBlockEditor)("postType",e);let i;i=n instanceof Function?n({blocks:r}):r?(0,c.__unstableSerializeAndClean)(r):n;const{switchEditorMode:s}=(0,d.useDispatch)(Gn);return(0,l.createElement)("div",{className:"edit-site-code-editor"},(0,l.createElement)("div",{className:"edit-site-code-editor__toolbar"},(0,l.createElement)("h2",null,(0,E.__)("Editing code")),(0,l.createElement)(v.Button,{variant:"tertiary",onClick:()=>s("visual"),shortcut:t},(0,E.__)("Exit code editor"))),(0,l.createElement)("div",{className:"edit-site-code-editor__body"},(0,l.createElement)(_u,{value:i,onChange:e=>{o((0,c.parse)(e),{selection:void 0})},onInput:a})))}var hu=function(){const{getEditorMode:e}=(0,d.useSelect)(Gn),t=(0,d.useSelect)((e=>e(Gn).isListViewOpened()),[]),n=(0,d.useSelect)((e=>e(U).getActiveComplementaryArea(Gn.name)===ic),[]),{redo:a,undo:r}=(0,d.useDispatch)(_.store),{setIsListViewOpened:o,switchEditorMode:i,setIsInserterOpened:s,closeGeneralSidebar:l}=(0,d.useDispatch)(Gn),{enableComplementaryArea:u,disableComplementaryArea:m}=(0,d.useDispatch)(U),{replaceBlocks:p}=(0,d.useDispatch)(we.store),{getBlockName:g,getSelectedBlockClientId:h,getBlockAttributes:y}=(0,d.useSelect)(we.store),{get:v}=(0,d.useSelect)(x.store),{set:f,toggle:b}=(0,d.useDispatch)(x.store),{createInfoNotice:w}=(0,d.useDispatch)(Se.store),S=(e,t)=>{e.preventDefault();const n=0===t?"core/paragraph":"core/heading",a=h();if(null===a)return;const r=g(a);if("core/paragraph"!==r&&"core/heading"!==r)return;const o=y(a),i="core/paragraph"===r?"align":"textAlign",s="core/paragraph"===n?"align":"textAlign";p(a,(0,c.createBlock)(n,{level:t,content:o.content,[s]:o[i]}))};return(0,Un.useShortcut)("core/edit-site/undo",(e=>{r(),e.preventDefault()})),(0,Un.useShortcut)("core/edit-site/redo",(e=>{a(),e.preventDefault()})),(0,Un.useShortcut)("core/edit-site/toggle-list-view",(()=>{t||o(!0)})),(0,Un.useShortcut)("core/edit-site/toggle-block-settings-sidebar",(e=>{e.preventDefault(),n?m(Ft):u(Ft,ic)})),(0,Un.useShortcut)("core/edit-site/toggle-mode",(()=>{i("visual"===e()?"text":"visual")})),(0,Un.useShortcut)("core/edit-site/transform-heading-to-paragraph",(e=>S(e,0))),[1,2,3,4,5,6].forEach((e=>{(0,Un.useShortcut)(`core/edit-site/transform-paragraph-to-heading-${e}`,(t=>S(t,e)))})),(0,Un.useShortcut)("core/edit-site/toggle-distraction-free",(()=>{f("core/edit-site","fixedToolbar",!1),s(!1),o(!1),l(),b("core/edit-site","distractionFree"),w(v("core/edit-site","distractionFree")?(0,E.__)("Distraction free mode turned on."):(0,E.__)("Distraction free mode turned off."),{id:"core/edit-site/distraction-free-mode/notice",type:"snackbar"})})),null};var yu=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function vu(){const{setIsInserterOpened:e}=(0,d.useDispatch)(Gn),t=(0,d.useSelect)((e=>e(Gn).__experimentalGetInsertionPoint()),[]),n=(0,re.useViewportMatch)("medium","<"),a=n?"div":v.VisuallyHidden,[r,o]=(0,re.__experimentalUseDialog)({onClose:()=>e(!1),focusOnMount:null}),i=(0,l.useRef)();return(0,l.useEffect)((()=>{i.current.focusSearch()}),[]),(0,l.createElement)("div",{ref:r,...o,className:"edit-site-editor__inserter-panel"},(0,l.createElement)(a,{className:"edit-site-editor__inserter-panel-header"},(0,l.createElement)(v.Button,{icon:yu,label:(0,E.__)("Close block inserter"),onClick:()=>e(!1)})),(0,l.createElement)("div",{className:"edit-site-editor__inserter-panel-content"},(0,l.createElement)(we.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:n,rootClientId:t.rootClientId,__experimentalInsertionIndex:t.insertionIndex,__experimentalFilterValue:t.filterValue,ref:i})))}const{PrivateListView:Eu}=nt(we.privateApis);function fu(){const{setIsListViewOpened:e}=(0,d.useDispatch)(Gn),t=(0,re.useFocusOnMount)("firstElement"),n=(0,re.useFocusReturn)(),a=(0,re.useFocusReturn)();const[r,o]=(0,l.useState)(null),i=(0,l.useRef)(),s=(0,l.useRef)(),c=(0,l.useRef)();return(0,Un.useShortcut)("core/edit-site/toggle-list-view",(()=>{i.current.contains(i.current.ownerDocument.activeElement)?e(!1):function(){const e=Vi.focus.tabbable.find(c.current)[0];(i.current.contains(e)?e:s.current).focus()}()})),(0,l.createElement)("div",{className:"edit-site-editor__list-view-panel",onKeyDown:function(t){t.keyCode!==la.ESCAPE||t.defaultPrevented||e(!1)},ref:i},(0,l.createElement)("div",{className:"edit-site-editor__list-view-panel-header",ref:n},(0,l.createElement)("strong",null,(0,E.__)("List View")),(0,l.createElement)(v.Button,{icon:C,label:(0,E.__)("Close"),onClick:()=>e(!1),ref:s})),(0,l.createElement)("div",{className:"edit-site-editor__list-view-panel-content",ref:(0,re.useMergeRefs)([a,t,o,c])},(0,l.createElement)(Eu,{dropZoneElement:r})))}function bu({nonAnimatedSrc:e,animatedSrc:t}){return(0,l.createElement)("picture",{className:"edit-site-welcome-guide__image"},(0,l.createElement)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,l.createElement)("img",{src:t,width:"312",height:"240",alt:""}))}function wu(){const{toggle:e}=(0,d.useDispatch)(x.store);return(0,d.useSelect)((e=>!!e(x.store).get("core/edit-site","welcomeGuide")),[])?(0,l.createElement)(v.Guide,{className:"edit-site-welcome-guide guide-editor",contentLabel:(0,E.__)("Welcome to the site editor"),finishButtonText:(0,E.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuide"),pages:[{image:(0,l.createElement)(bu,{nonAnimatedSrc:"https://s.w.org/images/block-editor/edit-your-site.svg?1",animatedSrc:"https://s.w.org/images/block-editor/edit-your-site.gif?1"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,E.__)("Edit your site")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("Design everything on your site — from the header right down to the footer — using blocks.")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,l.createInterpolateElement)((0,E.__)("Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors."),{StylesIconImage:(0,l.createElement)("img",{alt:(0,E.__)("styles"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A"})})))}]}):null}function Su(){const{toggle:e}=(0,d.useDispatch)(x.store),{isActive:t,isStylesOpen:n}=(0,d.useSelect)((e=>{const t=e(U).getActiveComplementaryArea(Gn.name);return{isActive:!!e(x.store).get("core/edit-site","welcomeGuideStyles"),isStylesOpen:"edit-site/global-styles"===t}}),[]);if(!t||!n)return null;const a=(0,E.__)("Welcome to Styles");return(0,l.createElement)(v.Guide,{className:"edit-site-welcome-guide guide-styles",contentLabel:a,finishButtonText:(0,E.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuideStyles"),pages:[{image:(0,l.createElement)(bu,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.svg?1",animatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.gif?1"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},a),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.")))},{image:(0,l.createElement)(bu,{nonAnimatedSrc:"https://s.w.org/images/block-editor/set-the-design.svg?1",animatedSrc:"https://s.w.org/images/block-editor/set-the-design.gif?1"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,E.__)("Set the design")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! ")))},{image:(0,l.createElement)(bu,{nonAnimatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.svg?1",animatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.gif?1"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,E.__)("Personalize blocks")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.")))},{image:(0,l.createElement)(bu,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},(0,E.__)("Learn more")),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("New to block themes and styling your site? "),(0,l.createElement)(v.ExternalLink,{href:(0,E.__)("https://wordpress.org/documentation/article/styles-overview/")},(0,E.__)("Here’s a detailed guide to learn how to make the most of it."))))}]})}function ku(){const{toggle:e}=(0,d.useDispatch)(x.store),t=(0,d.useSelect)((e=>{const t=!!e(x.store).get("core/edit-site","welcomeGuidePage"),n=!!e(x.store).get("core/edit-site","welcomeGuide"),{hasPageContentFocus:a}=e(Gn);return t&&!n&&a()}),[]);if(!t)return null;const n=(0,E.__)("Editing a page");return(0,l.createElement)(v.Guide,{className:"edit-site-welcome-guide guide-page",contentLabel:n,finishButtonText:(0,E.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuidePage"),pages:[{image:(0,l.createElement)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240"},(0,l.createElement)("source",{src:"https://s.w.org/images/block-editor/editing-your-page.mp4",type:"video/mp4"})),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},n),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.")))}]})}function Cu(){const{toggle:e}=(0,d.useDispatch)(x.store),t=(0,d.useSelect)((e=>{const t=!!e(x.store).get("core/edit-site","welcomeGuideTemplate"),n=!!e(x.store).get("core/edit-site","welcomeGuide"),{isPage:a,hasPageContentFocus:r}=e(Gn);return t&&!n&&a()&&!r()}),[]);if(!t)return null;const n=(0,E.__)("Editing a template");return(0,l.createElement)(v.Guide,{className:"edit-site-welcome-guide guide-template",contentLabel:n,finishButtonText:(0,E.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuideTemplate"),pages:[{image:(0,l.createElement)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240"},(0,l.createElement)("source",{src:"https://s.w.org/images/block-editor/editing-your-template.mp4",type:"video/mp4"})),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("h1",{className:"edit-site-welcome-guide__heading"},n),(0,l.createElement)("p",{className:"edit-site-welcome-guide__text"},(0,E.__)("Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.")))}]})}function xu(){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(wu,null),(0,l.createElement)(Su,null),(0,l.createElement)(ku,null),(0,l.createElement)(Cu,null))}function Tu({fallbackContent:e,onChoosePattern:t,postType:n}){const[,,a]=(0,_.useEntityBlockEditor)("postType",n),r=function(e){const{slug:t,patterns:n}=(0,d.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=e(Gn),{getEntityRecord:a}=e(_.store),r=n(),o=a("postType",t(),r),{getSettings:i}=e(we.store);return{slug:o.slug,patterns:i().__experimentalBlockPatterns}}),[]);return(0,l.useMemo)((()=>[{name:"fallback",blocks:(0,c.parse)(e),title:(0,E.__)("Fallback content")},...n.filter((e=>Array.isArray(e.templateTypes)&&e.templateTypes.some((e=>t.startsWith(e))))).map((e=>({...e,blocks:(0,c.parse)(e.content)})))]),[e,t,n])}(e),o=(0,re.useAsyncList)(r);return(0,l.createElement)(we.__experimentalBlockPatternsList,{blockPatterns:r,shownPatterns:o,onClickPattern:(e,n)=>{a(n,{selection:void 0}),t()}})}function Nu({slug:e,isCustom:t,onClose:n,postType:a}){const r=function(e,t=!1){const[n,a]=(0,l.useState)("");return(0,l.useEffect)((()=>{Rt()({path:(0,Et.addQueryArgs)("/wp/v2/templates/lookup",{slug:e,is_custom:t,ignore_empty:!0})}).then((({content:e})=>a(e.raw)))}),[t,e]),n}(e,t);return r?(0,l.createElement)(v.Modal,{className:"edit-site-start-template-options__modal",title:(0,E.__)("Choose a pattern"),closeLabel:(0,E.__)("Cancel"),focusOnMount:"firstElement",onRequestClose:n,isFullScreen:!0},(0,l.createElement)("div",{className:"edit-site-start-template-options__modal-content"},(0,l.createElement)(Tu,{fallbackContent:r,slug:e,isCustom:t,postType:a,onChoosePattern:()=>{n()}})),(0,l.createElement)(v.Flex,{className:"edit-site-start-template-options__modal__actions",justify:"flex-end",expanded:!1},(0,l.createElement)(v.FlexItem,null,(0,l.createElement)(v.Button,{variant:"tertiary",onClick:n},(0,E.__)("Skip"))))):null}const Mu={INITIAL:"INITIAL",CLOSED:"CLOSED"};function Pu(){const[e,t]=(0,l.useState)(Mu.INITIAL),{shouldOpenModal:n,slug:a,isCustom:r,postType:o}=(0,d.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:n}=e(Gn),a=t(),r=n(),{getEditedEntityRecord:o,hasEditsForEntityRecord:i}=e(_.store),s=o("postType",a,r);return{shouldOpenModal:!i("postType",a,r)&&""===s.content&&"wp_template"===a&&!e(x.store).get("core/edit-site","welcomeGuide"),slug:s.slug,isCustom:s.is_custom,postType:a}}),[]);return e===Mu.INITIAL&&!n||e===Mu.CLOSED?null:(0,l.createElement)(Nu,{slug:a,isCustom:r,postType:o,onClose:()=>t(Mu.CLOSED)})}const{useGlobalStylesOutput:Iu}=nt(we.privateApis);function Bu(){return function(){const[e,t]=Iu(),{getSettings:n}=(0,d.useSelect)(Gn),{updateSettings:a}=(0,d.useDispatch)(Gn);(0,l.useEffect)((()=>{var r;if(!e||!t)return;const o=n(),i=Object.values(null!==(r=o.styles)&&void 0!==r?r:[]).filter((e=>!e.isGlobalStyles));a({...o,styles:[...i,...e],__experimentalFeatures:t})}),[e,t])}(),null}const{useLocation:Du}=nt(vt.privateApis);const{useGlobalStyle:Ru}=nt(we.privateApis);function Lu(){const[e]=Ru("color.text");return(0,l.createElement)("div",{className:"edit-site-canvas-spinner"},(0,l.createElement)(v.Spinner,{style:{color:e}}))}const{BlockRemovalWarningModal:Au}=nt(we.privateApis),Fu={body:(0,E.__)("Editor content"),sidebar:(0,E.__)("Editor settings"),actions:(0,E.__)("Editor publish"),footer:(0,E.__)("Editor footer")},Vu={wp_template:(0,E.__)("Template"),wp_template_part:(0,E.__)("Template Part"),wp_block:(0,E.__)("Pattern")},zu={"core/query":(0,E.__)("Query Loop displays a list of posts or pages."),"core/post-content":(0,E.__)("Post Content displays the content of a post or page."),"core/post-template":(0,E.__)("Post Template displays each post or page in a Query Loop.")};function Ou({isLoading:e}){const{record:t,getTitle:n,isLoaded:a}=qr(),{id:r,type:o}=t,{context:i,editorMode:s,canvasMode:c,blockEditorMode:u,isRightSidebarOpen:m,isInserterOpen:p,isListViewOpen:h,showIconLabels:f,showBlockBreadcrumbs:b,hasPageContentFocus:w}=(0,d.useSelect)((e=>{const{getEditedPostContext:t,getEditorMode:n,getCanvasMode:a,isInserterOpened:r,isListViewOpened:o,hasPageContentFocus:i}=nt(e(Gn)),{__unstableGetEditorMode:s}=e(we.store),{getActiveComplementaryArea:l}=e(U);return{context:t(),editorMode:n(),canvasMode:a(),blockEditorMode:s(),isInserterOpen:r(),isListViewOpen:o(),isRightSidebarOpen:l(Gn.name),showIconLabels:e(x.store).get("core/edit-site","showIconLabels"),showBlockBreadcrumbs:e(x.store).get("core/edit-site","showBlockBreadcrumbs"),hasPageContentFocus:i()}}),[]),{setEditedPostContext:S}=(0,d.useDispatch)(Gn),k="edit"===c,C="view"===c||"visual"===s,T=b&&k&&C&&"zoom-out"!==u,N=k&&C&&p,M=k&&C&&h,P=h?(0,E.__)("List View"):(0,E.__)("Block Library"),I=(0,l.useMemo)((()=>{const{postType:e,postId:t,...n}=null!=i?i:{};return{...w?i:n,queryContext:[i?.queryContext||{page:1},e=>S({...i,queryContext:{...i?.queryContext,...e}})]}}),[w,i,S]);let B;var D;a&&(B=(0,E.sprintf)((0,E.__)("%1$s ‹ %2$s ‹ Editor"),n(),null!==(D=Vu[o])&&void 0!==D?D:Vu.wp_template));return function(e){const t=Du(),n=(0,d.useSelect)((e=>e(_.store).getEntityRecord("root","site")?.title),[]),a=(0,l.useRef)(!0);(0,l.useEffect)((()=>{a.current=!1}),[t]),(0,l.useEffect)((()=>{if(!a.current&&e&&n){const t=(0,E.sprintf)((0,E.__)("%1$s ‹ %2$s — WordPress"),(0,At.decodeEntities)(e),(0,At.decodeEntities)(n));document.title=t,(0,Lt.speak)((0,E.sprintf)((0,E.__)("Now displaying: %s"),document.title),"assertive")}}),[e,n,t])}(a&&B),(0,l.createElement)(l.Fragment,null,e?(0,l.createElement)(Lu,null):null,k&&(0,l.createElement)(xu,null),(0,l.createElement)(_.EntityProvider,{kind:"root",type:"site"},(0,l.createElement)(_.EntityProvider,{kind:"postType",type:o,id:r},(0,l.createElement)(we.BlockContextProvider,{value:I},(0,l.createElement)(Dc,null),k&&(0,l.createElement)(Pu,null),(0,l.createElement)(se,{isDistractionFree:!0,enableRegionNavigation:!1,className:y()("edit-site-editor__interface-skeleton",{"show-icon-labels":f,"is-loading":e}),notices:(0,l.createElement)(g.EditorSnackbars,null),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Bu,null),k&&(0,l.createElement)(g.EditorNotices,null),C&&t&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(mu,null),(0,l.createElement)(Au,{rules:zu})),"text"===s&&t&&k&&(0,l.createElement)(gu,null),a&&!t&&(0,l.createElement)(v.Notice,{status:"warning",isDismissible:!1},(0,E.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")),k&&(0,l.createElement)(hu,null)),secondarySidebar:k&&(N&&(0,l.createElement)(vu,null)||M&&(0,l.createElement)(fu,null)),sidebar:k&&m&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ae.Slot,{scope:"core/edit-site"}),(0,l.createElement)(Vl,null)),footer:T&&(0,l.createElement)(we.BlockBreadcrumb,{rootLabelText:w?(0,E.__)("Page"):(0,E.__)("Template")}),labels:{...Fu,secondarySidebar:P}})))))}function Hu({text:e,children:t}){const n=(0,re.useCopyToClipboard)(e);return(0,l.createElement)(v.Button,{variant:"secondary",ref:n},t)}function Gu({message:e,error:t}){const n=[(0,l.createElement)(Hu,{key:"copy-error",text:t.stack},(0,E.__)("Copy Error"))];return(0,l.createElement)(we.Warning,{className:"editor-error-boundary",actions:n},e)}class Uu extends l.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,Ee.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,l.createElement)(Gu,{message:(0,E.__)("The editor has encountered an unexpected error."),error:this.state.error}):this.props.children}}function $u({path:e,categoryType:t,categoryId:n},a){return"/wp_template/all"===e||"/wp_template_part/all"===e||"/patterns"===e&&(!a||!!t&&!!n)}var ju=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"}));var Wu=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"m12 20-4.5-3.6-.9 1.2L12 22l5.5-4.4-.9-1.2L12 20zm0-16 4.5 3.6.9-1.2L12 2 6.5 6.4l.9 1.2L12 4z"}));var Zu=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"}));const qu=[{keyCombination:{modifier:"primary",character:"b"},description:(0,E.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,E.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,E.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,E.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,E.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,E.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,E.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,E.__)("Make the selected text inline code.")},{keyCombination:{modifier:"access",character:"0"},description:(0,E.__)("Convert the current heading to a paragraph.")},{keyCombination:{modifier:"access",character:"1-6"},description:(0,E.__)("Convert the current paragraph or heading to a heading of level 1 to 6.")}];function Yu({keyCombination:e,forceAriaLabel:t}){const n=e.modifier?la.displayShortcutList[e.modifier](e.character):e.character,a=e.modifier?la.shortcutAriaLabel[e.modifier](e.character):e.character;return(0,l.createElement)("kbd",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||a},(Array.isArray(n)?n:[n]).map(((e,t)=>"+"===e?(0,l.createElement)(l.Fragment,{key:t},e):(0,l.createElement)("kbd",{key:t,className:"edit-site-keyboard-shortcut-help-modal__shortcut-key"},e))))}function Ku({description:e,keyCombination:t,aliases:n=[],ariaLabel:a}){return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-description"},e),(0,l.createElement)("div",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-term"},(0,l.createElement)(Yu,{keyCombination:t,forceAriaLabel:a}),n.map(((e,t)=>(0,l.createElement)(Yu,{keyCombination:e,forceAriaLabel:a,key:t})))))}function Xu({name:e}){const{keyCombination:t,description:n,aliases:a}=(0,d.useSelect)((t=>{const{getShortcutKeyCombination:n,getShortcutDescription:a,getShortcutAliases:r}=t(Un.store);return{keyCombination:n(e),aliases:r(e),description:a(e)}}),[e]);return t?(0,l.createElement)(Ku,{keyCombination:t,description:n,aliases:a}):null}const Qu="edit-site/keyboard-shortcut-help",Ju=({shortcuts:e})=>(0,l.createElement)("ul",{className:"edit-site-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map(((e,t)=>(0,l.createElement)("li",{className:"edit-site-keyboard-shortcut-help-modal__shortcut",key:t},"string"==typeof e?(0,l.createElement)(Xu,{name:e}):(0,l.createElement)(Ku,{...e}))))),ed=({title:e,shortcuts:t,className:n})=>(0,l.createElement)("section",{className:y()("edit-site-keyboard-shortcut-help-modal__section",n)},!!e&&(0,l.createElement)("h2",{className:"edit-site-keyboard-shortcut-help-modal__section-title"},e),(0,l.createElement)(Ju,{shortcuts:t})),td=({title:e,categoryName:t,additionalShortcuts:n=[]})=>{const a=(0,d.useSelect)((e=>e(Un.store).getCategoryShortcuts(t)),[t]);return(0,l.createElement)(ed,{title:e,shortcuts:a.concat(n)})};function nd(){const e=(0,d.useSelect)((e=>e(U).isModalActive(Qu))),{closeModal:t,openModal:n}=(0,d.useDispatch)(U),a=()=>e?t():n(Qu);return(0,Un.useShortcut)("core/edit-site/keyboard-shortcuts",a),e?(0,l.createElement)(v.Modal,{className:"edit-site-keyboard-shortcut-help-modal",title:(0,E.__)("Keyboard shortcuts"),onRequestClose:a},(0,l.createElement)(ed,{className:"edit-site-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-site/keyboard-shortcuts"]}),(0,l.createElement)(td,{title:(0,E.__)("Global shortcuts"),categoryName:"global"}),(0,l.createElement)(td,{title:(0,E.__)("Selection shortcuts"),categoryName:"selection"}),(0,l.createElement)(td,{title:(0,E.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,E.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,E.__)("Forward-slash")}]}),(0,l.createElement)(ed,{title:(0,E.__)("Text formatting"),shortcuts:qu})):null}function ad(e){const{featureName:t,onToggle:n=(()=>{}),...a}=e,r=(0,d.useSelect)((e=>!!e(x.store).get("core/edit-site",t)),[t]),{toggle:o}=(0,d.useDispatch)(x.store);return(0,l.createElement)(ye,{onChange:()=>{n(),o("core/edit-site",t)},isChecked:r,...a})}const rd="edit-site/preferences";function od(){const e=(0,d.useSelect)((e=>e(U).isModalActive(rd))),{closeModal:t,openModal:n}=(0,d.useDispatch)(U),a=(0,d.useRegistry)(),{closeGeneralSidebar:r,setIsListViewOpened:o,setIsInserterOpened:i}=(0,d.useDispatch)(Gn),{set:s}=(0,d.useDispatch)(x.store),c=()=>{a.batch((()=>{s("core/edit-site","fixedToolbar",!1),i(!1),o(!1),r()}))},u=(0,l.useMemo)((()=>[{name:"general",tabLabel:(0,E.__)("General"),content:(0,l.createElement)(he,{title:(0,E.__)("Appearance"),description:(0,E.__)("Customize options related to the block editor interface and editing flow.")},(0,l.createElement)(ad,{featureName:"distractionFree",onToggle:c,help:(0,E.__)("Reduce visual distractions by hiding the toolbar and other elements to focus on writing."),label:(0,E.__)("Distraction free")}),(0,l.createElement)(ad,{featureName:"focusMode",help:(0,E.__)("Highlights the current block and fades other content."),label:(0,E.__)("Spotlight mode")}),(0,l.createElement)(ad,{featureName:"showIconLabels",label:(0,E.__)("Show button text labels"),help:(0,E.__)("Show text instead of icons on buttons.")}),(0,l.createElement)(ad,{featureName:"showListViewByDefault",help:(0,E.__)("Opens the block list view sidebar by default."),label:(0,E.__)("Always open list view")}),(0,l.createElement)(ad,{featureName:"showBlockBreadcrumbs",help:(0,E.__)("Shows block breadcrumbs at the bottom of the editor."),label:(0,E.__)("Display block breadcrumbs")}))},{name:"blocks",tabLabel:(0,E.__)("Blocks"),content:(0,l.createElement)(he,{title:(0,E.__)("Block interactions"),description:(0,E.__)("Customize how you interact with blocks in the block library and editing canvas.")},(0,l.createElement)(ad,{featureName:"keepCaretInsideBlock",help:(0,E.__)("Aids screen readers by stopping text caret from leaving blocks."),label:(0,E.__)("Contain text cursor inside block")}))}]));return e?(0,l.createElement)(ue,{closeModal:()=>e?t():n(rd)},(0,l.createElement)(ge,{sections:u})):null}const{Fill:id,Slot:sd}=(0,v.createSlotFill)("EditSiteToolsMoreMenuGroup");id.Slot=({fillProps:e})=>(0,l.createElement)(sd,{fillProps:e},(e=>e&&e.length>0));var ld=id,cd=n(8981),ud=n.n(cd);var dd=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"}));function md(){const{createErrorNotice:e}=(0,d.useDispatch)(Se.store);return(0,l.createElement)(v.MenuItem,{role:"menuitem",icon:dd,onClick:async function(){try{const e=await Rt()({path:"/wp-block-editor/v1/export",parse:!1,headers:{Accept:"application/zip"}}),t=await e.blob(),n=e.headers.get("content-disposition").match(/=(.+)\.zip/),a=n[1]?n[1]:"edit-site-export";ud()(t,a+".zip","application/zip")}catch(t){let n={};try{n=await t.json()}catch(e){}const a=n.message&&"unknown_error"!==n.code?n.message:(0,E.__)("An error occurred while creating the site export.");e(a,{type:"snackbar"})}},info:(0,E.__)("Download your theme with updated templates and styles.")},(0,E._x)("Export","site exporter menu item"))}function pd(){const{toggle:e}=(0,d.useDispatch)(x.store);return(0,l.createElement)(v.MenuItem,{onClick:()=>e("core/edit-site","welcomeGuide")},(0,E.__)("Welcome Guide"))}function _d(){const{createNotice:e}=(0,d.useDispatch)(Se.store),t=(0,d.useSelect)((e=>()=>{const{getEditedPostId:t,getEditedPostType:n}=e(Gn),{getEditedEntityRecord:a}=e(_.store),r=a("postType",n(),t());if(r){if("function"==typeof r.content)return r.content(r);if(r.blocks)return(0,c.__unstableSerializeAndClean)(r.blocks);if(r.content)return r.content}return""}),[]);const n=(0,re.useCopyToClipboard)(t,(function(){e("info",(0,E.__)("All content copied."),{isDismissible:!0,type:"snackbar"})}));return(0,l.createElement)(v.MenuItem,{ref:n},(0,E.__)("Copy all blocks"))}const gd=[{value:"visual",label:(0,E.__)("Visual editor")},{value:"text",label:(0,E.__)("Code editor")}];var hd=function(){const{shortcut:e,mode:t}=(0,d.useSelect)((e=>({shortcut:e(Un.store).getShortcutRepresentation("core/edit-site/toggle-mode"),isRichEditingEnabled:e(Gn).getSettings().richEditingEnabled,isCodeEditingEnabled:e(Gn).getSettings().codeEditingEnabled,mode:e(Gn).getEditorMode()})),[]),{switchEditorMode:n}=(0,d.useDispatch)(Gn),a=gd.map((n=>n.value!==t?{...n,shortcut:e}:n));return(0,l.createElement)(v.MenuGroup,{label:(0,E.__)("Editor")},(0,l.createElement)(v.MenuItemsChoice,{choices:a,value:t,onSelect:n}))};function yd({showIconLabels:e}){const t=(0,d.useRegistry)(),n=(0,d.useSelect)((e=>e(x.store).get("core/edit-site","distractionFree")),[]),{setIsInserterOpened:a,setIsListViewOpened:r,closeGeneralSidebar:o}=(0,d.useDispatch)(Gn),{openModal:i}=(0,d.useDispatch)(U),{set:s}=(0,d.useDispatch)(x.store),c=()=>{t.batch((()=>{s("core/edit-site","fixedToolbar",!1),a(!1),r(!1),o()}))};return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ce,{toggleProps:{showTooltip:!e,...e&&{variant:"tertiary"}}},(({onClose:e})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.MenuGroup,{label:(0,E._x)("View","noun")},(0,l.createElement)(x.PreferenceToggleMenuItem,{scope:"core/edit-site",name:"fixedToolbar",disabled:n,label:(0,E.__)("Top toolbar"),info:(0,E.__)("Access all block and document tools in a single place"),messageActivated:(0,E.__)("Top toolbar activated"),messageDeactivated:(0,E.__)("Top toolbar deactivated")}),(0,l.createElement)(x.PreferenceToggleMenuItem,{scope:"core/edit-site",name:"focusMode",label:(0,E.__)("Spotlight mode"),info:(0,E.__)("Focus on one block at a time"),messageActivated:(0,E.__)("Spotlight mode activated"),messageDeactivated:(0,E.__)("Spotlight mode deactivated")}),(0,l.createElement)(x.PreferenceToggleMenuItem,{scope:"core/edit-site",name:"distractionFree",onToggle:c,label:(0,E.__)("Distraction free"),info:(0,E.__)("Write with calmness"),messageActivated:(0,E.__)("Distraction free mode activated"),messageDeactivated:(0,E.__)("Distraction free mode deactivated"),shortcut:la.displayShortcut.primaryShift("\\")})),(0,l.createElement)(hd,null),(0,l.createElement)(K.Slot,{name:"core/edit-site/plugin-more-menu",label:(0,E.__)("Plugins"),as:v.MenuGroup,fillProps:{onClick:e}}),(0,l.createElement)(v.MenuGroup,{label:(0,E.__)("Tools")},(0,l.createElement)(md,null),(0,l.createElement)(v.MenuItem,{onClick:()=>i(Qu),shortcut:la.displayShortcut.access("h")},(0,E.__)("Keyboard shortcuts")),(0,l.createElement)(pd,null),(0,l.createElement)(_d,null),(0,l.createElement)(v.MenuItem,{icon:Zu,role:"menuitem",href:(0,E.__)("https://wordpress.org/documentation/article/site-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,E.__)("Help"),(0,l.createElement)(v.VisuallyHidden,{as:"span"},(0,E.__)("(opens in a new tab)"))),(0,l.createElement)(ld.Slot,{fillProps:{onClose:e}})),(0,l.createElement)(v.MenuGroup,null,(0,l.createElement)(v.MenuItem,{onClick:()=>i(rd)},(0,E.__)("Preferences")))))),(0,l.createElement)(nd,null),(0,l.createElement)(od,null))}var vd=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"}));var Ed=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"}));var fd=(0,l.forwardRef)((function(e,t){const n=(0,d.useSelect)((e=>e(_.store).hasUndo()),[]),{undo:a}=(0,d.useDispatch)(_.store);return(0,l.createElement)(v.Button,{...e,ref:t,icon:(0,E.isRTL)()?Ed:vd,label:(0,E.__)("Undo"),shortcut:la.displayShortcut.primary("z"),"aria-disabled":!n,onClick:n?a:void 0})}));var bd=(0,l.forwardRef)((function(e,t){const n=(0,la.isAppleOS)()?la.displayShortcut.primaryShift("z"):la.displayShortcut.primary("y"),a=(0,d.useSelect)((e=>e(_.store).hasRedo()),[]),{redo:r}=(0,d.useDispatch)(_.store);return(0,l.createElement)(v.Button,{...e,ref:t,icon:(0,E.isRTL)()?vd:Ed,label:(0,E.__)("Redo"),shortcut:n,"aria-disabled":!a,onClick:a?r:void 0})}));const wd={wp_block:(0,E.__)("Editing pattern:"),wp_navigation:(0,E.__)("Editing navigation menu:"),wp_template:(0,E.__)("Editing template:"),wp_template_part:(0,E.__)("Editing template part:")};function Sd(){return(0,d.useSelect)((e=>e(Gn).isPage()),[])?(0,l.createElement)(kd,null):(0,l.createElement)(Cd,null)}function kd(){const{hasPageContentFocus:e,hasResolved:t,isFound:n,title:a}=(0,d.useSelect)((e=>{const{hasPageContentFocus:t,getEditedPostContext:n}=e(Gn),{getEditedEntityRecord:a,hasFinishedResolution:r}=e(_.store),o=n(),i=["postType",o.postType,o.postId],s=a(...i);return{hasPageContentFocus:t(),hasResolved:r("getEditedEntityRecord",i),isFound:!!s,title:s?.title}}),[]),{setHasPageContentFocus:r}=(0,d.useDispatch)(Gn),[o,i]=(0,l.useState)(!1),s=(0,l.useRef)(!1);return(0,l.useEffect)((()=>{s.current&&!e&&i(!0),s.current=e}),[e]),t?n?e?(0,l.createElement)(xd,{className:y()("is-page",{"is-animated":o}),icon:qn},a):(0,l.createElement)(Cd,{className:"is-animated",onBack:()=>r(!0)}):(0,l.createElement)("div",{className:"edit-site-document-actions"},(0,E.__)("Document not found")):null}function Cd({className:e,onBack:t}){var n;const{isLoaded:a,record:r,getTitle:o,icon:i}=qr();if(!a)return null;if(!r)return(0,l.createElement)("div",{className:"edit-site-document-actions"},(0,E.__)("Document not found"));let s=i;return"wp_navigation"===r.type?s=Wn:"wp_block"===r.type&&(s=Kn),(0,l.createElement)(xd,{className:e,icon:s,onBack:t},(0,l.createElement)(v.VisuallyHidden,{as:"span"},null!==(n=wd[r.type])&&void 0!==n?n:wd.wp_template),o())}function xd({className:e,icon:t,children:n,onBack:a}){const{open:r}=(0,d.useDispatch)($n.store);return(0,l.createElement)("div",{className:y()("edit-site-document-actions",e)},a&&(0,l.createElement)(v.Button,{className:"edit-site-document-actions__back",icon:(0,E.isRTL)()?ta:ea,onClick:e=>{e.stopPropagation(),a()}},(0,E.__)("Back")),(0,l.createElement)(v.Button,{className:"edit-site-document-actions__command",onClick:()=>r()},(0,l.createElement)(v.__experimentalHStack,{className:"edit-site-document-actions__title",spacing:1,justify:"center"},(0,l.createElement)(we.BlockIcon,{icon:t}),(0,l.createElement)(v.__experimentalText,{size:"body",as:"h1"},n)),(0,l.createElement)("span",{className:"edit-site-document-actions__shortcut"},la.displayShortcut.primary("k"))))}const{useShouldContextualToolbarShow:Td}=nt(we.privateApis),Nd=e=>{e.preventDefault()};function Md(){const e=(0,l.useRef)(),{deviceType:t,templateType:n,isInserterOpen:a,isListViewOpen:r,listViewShortcut:o,isVisualMode:i,isDistractionFree:s,blockEditorMode:c,homeUrl:u,showIconLabels:m,editorCanvasView:p}=(0,d.useSelect)((e=>{const{__experimentalGetPreviewDeviceType:t,getEditedPostType:n,isInserterOpened:a,isListViewOpened:r,getEditorMode:o}=e(Gn),{getShortcutRepresentation:i}=e(Un.store),{__unstableGetEditorMode:s}=e(we.store),l=n(),{getUnstableBase:c}=e(_.store);return{deviceType:t(),templateType:l,isInserterOpen:a(),isListViewOpen:r(),listViewShortcut:i("core/edit-site/toggle-list-view"),isVisualMode:"visual"===o(),blockEditorMode:s(),homeUrl:c()?.home,showIconLabels:e(x.store).get("core/edit-site","showIconLabels"),editorCanvasView:nt(e(Gn)).getEditorCanvasContainerView(),isDistractionFree:e(x.store).get("core/edit-site","distractionFree")}}),[]),{get:g}=(0,d.useSelect)(x.store),h=g(Gn.name,"fixedToolbar"),{__experimentalSetPreviewDeviceType:f,setIsInserterOpened:b,setIsListViewOpened:w}=(0,d.useDispatch)(Gn),{__unstableSetEditorMode:S}=(0,d.useDispatch)(we.store),k=(0,re.useReducedMotion)(),C=(0,re.useViewportMatch)("medium"),T=(0,l.useCallback)((()=>{a?(e.current.focus(),b(!1)):b(!0)}),[a,b]),N=(0,l.useCallback)((()=>w(!r)),[w,r]),{shouldShowContextualToolbar:M,canFocusHiddenToolbar:P,fixedToolbarCanBeFocused:I}=Td(),B=M||P||I,D=!function(){const e=(0,v.__experimentalUseSlotFills)(La);return!!e?.length}(),R="wp_template_part"===n||"wp_navigation"===n,L=(0,E._x)("Toggle block inserter","Generic label for block inserter button"),A=a?(0,E.__)("Close"):(0,E.__)("Add"),F=window?.__experimentalEnableZoomedOutView&&i,V="zoom-out"===c,z={isDistractionFree:{y:"-50px"},isDistractionFreeHovering:{y:0},view:{y:0},edit:{y:0}},O={type:"tween",duration:k?0:.2,ease:"easeOut"};return(0,l.createElement)("div",{className:y()("edit-site-header-edit-mode",{"show-icon-labels":m})},D&&(0,l.createElement)(we.NavigableToolbar,{as:v.__unstableMotion.div,className:"edit-site-header-edit-mode__start","aria-label":(0,E.__)("Document tools"),shouldUseKeyboardFocusShortcut:!B,variants:z,transition:O},(0,l.createElement)("div",{className:"edit-site-header-edit-mode__toolbar"},!s&&(0,l.createElement)(v.ToolbarItem,{ref:e,as:v.Button,className:"edit-site-header-edit-mode__inserter-toggle",variant:"primary",isPressed:a,onMouseDown:Nd,onClick:T,disabled:!i,icon:vr,label:m?A:L,showTooltip:!m}),C&&(0,l.createElement)(l.Fragment,null,!h&&(0,l.createElement)(v.ToolbarItem,{as:we.ToolSelector,showTooltip:!m,variant:m?"tertiary":void 0,disabled:!i}),(0,l.createElement)(v.ToolbarItem,{as:fd,showTooltip:!m,variant:m?"tertiary":void 0}),(0,l.createElement)(v.ToolbarItem,{as:bd,showTooltip:!m,variant:m?"tertiary":void 0}),!s&&(0,l.createElement)(v.ToolbarItem,{as:v.Button,className:"edit-site-header-edit-mode__list-view-toggle",disabled:!i||V,icon:ju,isPressed:r,label:(0,E.__)("List View"),onClick:N,shortcut:o,showTooltip:!m,variant:m?"tertiary":void 0}),F&&!s&&!h&&(0,l.createElement)(v.ToolbarItem,{as:v.Button,className:"edit-site-header-edit-mode__zoom-out-view-toggle",icon:Wu,isPressed:V,label:(0,E.__)("Zoom-out View"),onClick:()=>{f("desktop"),S(V?"edit":"zoom-out")}})))),!s&&(0,l.createElement)("div",{className:"edit-site-header-edit-mode__center"},D?(0,l.createElement)(Sd,null):Da(p)),(0,l.createElement)("div",{className:"edit-site-header-edit-mode__end"},(0,l.createElement)(v.__unstableMotion.div,{className:"edit-site-header-edit-mode__actions",variants:z,transition:O},!R&&D&&(0,l.createElement)("div",{className:y()("edit-site-header-edit-mode__preview-options",{"is-zoomed-out":V})},(0,l.createElement)(we.__experimentalPreviewOptions,{deviceType:t,setDeviceType:f,label:(0,E.__)("View")},(0,l.createElement)(v.MenuGroup,null,(0,l.createElement)(v.MenuItem,{href:u,target:"_blank",icon:Zu},(0,E.__)("View site"),(0,l.createElement)(v.VisuallyHidden,{as:"span"},(0,E.__)("(opens in a new tab)")))))),(0,l.createElement)(Pi,null),!s&&(0,l.createElement)(ee.Slot,{scope:"core/edit-site"}),(0,l.createElement)(yd,{showIconLabels:m}))))}var Pd=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,l.createElement)(f.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"}));var Id=function({className:e}){const{isRequestingSite:t,siteIconUrl:n}=(0,d.useSelect)((e=>{const{getEntityRecord:t}=e(_.store),n=t("root","__unstableBase",void 0);return{isRequestingSite:!n,siteIconUrl:n?.site_icon_url}}),[]);if(t&&!n)return(0,l.createElement)("div",{className:"edit-site-site-icon__image"});const a=n?(0,l.createElement)("img",{className:"edit-site-site-icon__image",alt:(0,E.__)("Site Icon"),src:n}):(0,l.createElement)(v.Icon,{className:"edit-site-site-icon__icon",size:"48px",icon:Pd});return(0,l.createElement)("div",{className:y()(e,"edit-site-site-icon")},a)};const Bd=(0,l.forwardRef)((({isTransparent:e,...t},n)=>{const{canvasMode:a,dashboardLink:r,homeUrl:o}=(0,d.useSelect)((e=>{const{getCanvasMode:t,getSettings:n}=nt(e(Gn)),{getUnstableBase:a}=e(_.store);return{canvasMode:t(),dashboardLink:n().__experimentalDashboardLink||"index.php",homeUrl:a()?.home}}),[]),{open:i}=(0,d.useDispatch)($n.store),s=(0,re.useReducedMotion)(),{setCanvasMode:c,__experimentalSetPreviewDeviceType:u}=nt((0,d.useDispatch)(Gn)),{clearSelectedBlock:m}=(0,d.useDispatch)(we.store),p="view"===a?{href:r,label:(0,E.__)("Go to the Dashboard")}:{href:r,role:"button",label:(0,E.__)("Open Navigation"),onClick:e=>{e.preventDefault(),"edit"===a&&(m(),u("desktop"),c("view"))}},g=(0,d.useSelect)((e=>e(_.store).getEntityRecord("root","site")?.title),[]);return(0,l.createElement)(v.__unstableMotion.div,{ref:n,...t,className:y()("edit-site-site-hub",t.className),initial:!1,transition:{type:"tween",duration:s?0:.3,ease:"easeOut"}},(0,l.createElement)(v.__experimentalHStack,{justify:"space-between",alignment:"center",className:"edit-site-site-hub__container"},(0,l.createElement)(v.__experimentalHStack,{justify:"flex-start",className:"edit-site-site-hub__text-content",spacing:"0"},(0,l.createElement)(v.__unstableMotion.div,{className:y()("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),layout:!0,transition:{type:"tween",duration:s?0:.3,ease:"easeOut"}},(0,l.createElement)(v.Button,{...p,className:"edit-site-layout__view-mode-toggle"},(0,l.createElement)(v.__unstableMotion.div,{initial:!1,animate:{scale:"view"===a?.5:1},whileHover:{scale:"view"===a?.5:.96},transition:{type:"tween",duration:s?0:.3,ease:"easeOut"}},(0,l.createElement)(Id,{className:"edit-site-layout__view-mode-toggle-icon"})))),(0,l.createElement)(v.__unstableAnimatePresence,null,(0,l.createElement)(v.__unstableMotion.div,{layout:"edit"===a,animate:{opacity:"view"===a?1:0},exit:{opacity:0},className:y()("edit-site-site-hub__site-title",{"is-transparent":e}),transition:{type:"tween",duration:s?0:.2,ease:"easeOut",delay:"view"===a?.1:0}},(0,At.decodeEntities)(g))),"view"===a&&(0,l.createElement)(v.Button,{href:o,target:"_blank",label:(0,E.__)("View site (opens in a new tab)"),"aria-label":(0,E.__)("View site (opens in a new tab)"),icon:Zu,className:"edit-site-site-hub__site-view-link"})),"view"===a&&(0,l.createElement)(v.Button,{className:y()("edit-site-site-hub_toggle-command-center",{"is-transparent":e}),icon:cr,onClick:()=>i(),label:(0,E.__)("Open command palette")})))}));var Dd=Bd;const Rd={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0},Ld=320,Ad=1300,Fd=9/19.5,Vd={width:"100%",height:"100%"};function zd(e,t){const n=1-Math.max(0,Math.min(1,(e-Ld)/(Ad-Ld))),a=((e,t,n)=>e+(t-e)*n)(t,Fd,n);return e/a}var Od=function e({isFullWidth:t,isOversized:n,setIsOversized:a,isReady:r,children:o,defaultSize:i,innerContentStyle:s}){const[c,u]=(0,l.useState)(Vd),[m,p]=(0,l.useState)(),[_,g]=(0,l.useState)(!1),[h,f]=(0,l.useState)(!1),[b,w]=(0,l.useState)(1),S=(0,d.useSelect)((e=>nt(e(Gn)).getCanvasMode()),[]),{setCanvasMode:k}=nt((0,d.useDispatch)(Gn)),C={type:"tween",duration:_?0:.5},x=(0,l.useRef)(null),T=(0,re.useInstanceId)(e,"edit-site-resizable-frame-handle-help"),N=i.width/i.height,M={default:{flexGrow:0,height:c.height},fullWidth:{flexGrow:1,height:c.height}},P=_?"active":h?"visible":"hidden";return(0,l.createElement)(v.ResizableBox,{as:v.__unstableMotion.div,ref:x,initial:!1,variants:M,animate:t?"fullWidth":"default",onAnimationComplete:e=>{"fullWidth"===e&&u({width:"100%",height:"100%"})},transition:C,size:c,enable:{top:!1,right:!1,bottom:!1,left:r,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},resizeRatio:b,handleClasses:void 0,handleStyles:{left:Rd,right:Rd},minWidth:Ld,maxWidth:t?"100%":"150%",maxHeight:"100%",onFocus:()=>f(!0),onBlur:()=>f(!1),onMouseOver:()=>f(!0),onMouseOut:()=>f(!1),handleComponent:{left:"view"===S&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.Tooltip,{text:(0,E.__)("Drag to resize")},(0,l.createElement)(v.__unstableMotion.button,{key:"handle",role:"separator","aria-orientation":"vertical",className:y()("edit-site-resizable-frame__handle",{"is-resizing":_}),variants:{hidden:{opacity:0,left:0},visible:{opacity:1,left:-16},active:{opacity:1,left:-16,scaleY:1.3}},animate:P,"aria-label":(0,E.__)("Drag to resize"),"aria-describedby":T,"aria-valuenow":x.current?.resizable?.offsetWidth||void 0,"aria-valuemin":Ld,"aria-valuemax":i.width,onKeyDown:e=>{if(!["ArrowLeft","ArrowRight"].includes(e.key))return;e.preventDefault();const t=20*(e.shiftKey?5:1)*("ArrowLeft"===e.key?1:-1),n=Math.min(Math.max(Ld,x.current.resizable.offsetWidth+t),i.width);u({width:n,height:zd(n,N)})},initial:"hidden",exit:"hidden",whileFocus:"active",whileHover:"active"})),(0,l.createElement)("div",{hidden:!0,id:T},(0,E.__)("Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.")))},onResizeStart:(e,t,n)=>{p(n.offsetWidth),g(!0)},onResize:(e,t,r,o)=>{const s=o.width/b,l=Math.abs(s),c=o.width<0?l:(i.width-m)/2,d=Math.min(l,c),p=0===l?0:d/l;w(1-p+2*p);const _=m+o.width;a(_>i.width),u({height:n?"100%":zd(_,N)})},onResizeStop:(e,t,r)=>{if(g(!1),!n)return;a(!1);r.ownerDocument.documentElement.offsetWidth-r.offsetWidth>200?u(Vd):k("edit")},className:y()("edit-site-resizable-frame__inner",{"is-resizing":_})},(0,l.createElement)(v.__unstableMotion.div,{className:"edit-site-resizable-frame__inner-content",animate:{borderRadius:t?0:8},transition:C,style:s},o))};const{useLocation:Hd,useHistory:Gd}=nt(vt.privateApis);const{useHistory:Ud,useLocation:$d}=nt(vt.privateApis);const{EntitiesSavedStatesExtensible:jd}=nt(g.privateApis),Wd=({onClose:e})=>{const t=(0,g.useEntitiesSavedStatesIsDirty)();let n;n=t.isDirty?(0,E.__)("Activate & Save"):(0,E.__)("Activate");const{getTheme:a}=(0,d.useSelect)(_.store),r=a(bt()),o=(0,l.createElement)("p",null,(0,E.sprintf)("Saving your changes will change your active theme to %1$s.",r?.name?.rendered)),i=function(){const e=Ud(),t=$d();return async()=>{if(ft()){const n="themes.php?action=activate&stylesheet="+bt()+"&_wpnonce="+window.WP_BLOCK_THEME_ACTIVATE_NONCE;await window.fetch(n);const{wp_theme_preview:a,...r}=t.params;e.replace(r)}}}();return(0,l.createElement)(jd,{...t,additionalPrompt:o,close:e,onSave:async e=>(await i(),e),saveEnabled:!0,saveLabel:n})},Zd=({onClose:e})=>ft()?(0,l.createElement)(Wd,{onClose:e}):(0,l.createElement)(g.EntitiesSavedStates,{close:e});function qd(){const{isSaveViewOpen:e,canvasMode:t}=(0,d.useSelect)((e=>{const{isSaveViewOpened:t,getCanvasMode:n}=nt(e(Gn));return{isSaveViewOpen:t(),canvasMode:n()}}),[]),{setIsSaveViewOpened:n}=(0,d.useDispatch)(Gn),a=()=>n(!1);return"view"===t?e?(0,l.createElement)(v.Modal,{className:"edit-site-save-panel__modal",onRequestClose:a,__experimentalHideHeader:!0,contentLabel:(0,E.__)("Save site, content, and template changes")},(0,l.createElement)(Zd,{onClose:a})):null:(0,l.createElement)(oe,{className:y()("edit-site-layout__actions",{"is-entity-save-view-open":e}),ariaLabel:(0,E.__)("Save panel")},e?(0,l.createElement)(Zd,{onClose:a}):(0,l.createElement)("div",{className:"edit-site-editor__toggle-save-panel"},(0,l.createElement)(v.Button,{variant:"secondary",className:"edit-site-editor__toggle-save-panel-button",onClick:()=>n(!0),"aria-expanded":!1},(0,E.__)("Open save panel"))))}var Yd=function(){const{registerShortcut:e}=(0,d.useDispatch)(Un.store);return(0,l.useEffect)((()=>{e({name:"core/edit-site/save",category:"global",description:(0,E.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-site/undo",category:"global",description:(0,E.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-site/redo",category:"global",description:(0,E.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,la.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/edit-site/toggle-list-view",category:"global",description:(0,E.__)("Open the block list view."),keyCombination:{modifier:"access",character:"o"}}),e({name:"core/edit-site/toggle-block-settings-sidebar",category:"global",description:(0,E.__)("Show or hide the Settings sidebar."),keyCombination:{modifier:"primaryShift",character:","}}),e({name:"core/edit-site/keyboard-shortcuts",category:"main",description:(0,E.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-site/next-region",category:"global",description:(0,E.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/edit-site/previous-region",category:"global",description:(0,E.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]}),e({name:"core/edit-site/toggle-mode",category:"global",description:(0,E.__)("Switch between visual editor and code editor."),keyCombination:{modifier:"secondary",character:"m"}}),e({name:"core/edit-site/transform-heading-to-paragraph",category:"block-library",description:(0,E.__)("Transform heading to paragraph."),keyCombination:{modifier:"access",character:"0"}}),[1,2,3,4,5,6].forEach((t=>{e({name:`core/edit-site/transform-paragraph-to-heading-${t}`,category:"block-library",description:(0,E.__)("Transform paragraph to heading."),keyCombination:{modifier:"access",character:`${t}`}})})),e({name:"core/edit-site/toggle-distraction-free",category:"global",description:(0,E.__)("Toggle distraction free mode."),keyCombination:{modifier:"primaryShift",character:"\\"}})}),[e]),null};var Kd=function(){const{__experimentalGetDirtyEntityRecords:e,isSavingEntityRecord:t}=(0,d.useSelect)(_.store),{setIsSaveViewOpened:n}=(0,d.useDispatch)(Gn);return(0,Un.useShortcut)("core/edit-site/save",(a=>{a.preventDefault();const r=e(),o=!!r.length;!r.some((e=>t(e.kind,e.name,e.key)))&&o&&n(!0)})),null};var Xd=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M20 5h-5.7c0-1.3-1-2.3-2.3-2.3S9.7 3.7 9.7 5H4v2h1.5v.3l1.7 11.1c.1 1 1 1.7 2 1.7h5.7c1 0 1.8-.7 2-1.7l1.7-11.1V7H20V5zm-3.2 2l-1.7 11.1c0 .1-.1.2-.3.2H9.1c-.1 0-.3-.1-.3-.2L7.2 7h9.6z"}));var Qd=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"}));const{useGlobalStylesReset:Jd}=nt(we.privateApis),{useHistory:em,useLocation:tm}=nt(vt.privateApis);function nm(){const[e,t]=Jd();return{isLoading:!1,commands:(0,l.useMemo)((()=>e?[{name:"core/edit-site/reset-global-styles",label:(0,E.__)("Reset styles to defaults"),icon:Xd,callback:({close:e})=>{e(),t()}}]:[]),[e,t])}}function am(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t,setCanvasMode:n}=nt((0,d.useDispatch)(Gn)),{params:a}=tm(),r=!$u(a,(0,re.useViewportMatch)("medium","<")),o=em(),{canEditCSS:i}=(0,d.useSelect)((e=>{var t;const{getEntityRecord:n,__experimentalGetCurrentGlobalStylesId:a}=e(_.store),r=a(),o=r?n("root","globalStyles",r):void 0;return{canEditCSS:null!==(t=!!o?._links?.["wp:action-edit-css"])&&void 0!==t&&t}}),[]),{getCanvasMode:s}=nt((0,d.useSelect)(Gn));return{isLoading:!1,commands:(0,l.useMemo)((()=>i?[{name:"core/edit-site/open-styles-css",label:(0,E.__)("Open CSS"),icon:Zn,callback:({close:a})=>{a(),r||o.push({path:"/wp_global_styles",canvas:"edit"}),r&&"edit"!==s()&&n("edit"),e("edit-site/global-styles"),t("global-styles-css")}}]:[]),[o,e,t,i,r,s,n])}}var rm=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"}));var om=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"}));var im=(0,l.createElement)(f.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(f.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"}));var sm=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,l.createElement)(f.Path,{d:"M18,0 L2,0 C0.9,0 0.01,0.9 0.01,2 L0,12 C0,13.1 0.9,14 2,14 L18,14 C19.1,14 20,13.1 20,12 L20,2 C20,0.9 19.1,0 18,0 Z M18,12 L2,12 L2,2 L18,2 L18,12 Z M9,3 L11,3 L11,5 L9,5 L9,3 Z M9,6 L11,6 L11,8 L9,8 L9,6 Z M6,3 L8,3 L8,5 L6,5 L6,3 Z M6,6 L8,6 L8,8 L6,8 L6,6 Z M3,6 L5,6 L5,8 L3,8 L3,6 Z M3,3 L5,3 L5,5 L3,5 L3,3 Z M6,9 L14,9 L14,11 L6,11 L6,9 Z M12,6 L14,6 L14,8 L12,8 L12,6 Z M12,3 L14,3 L14,5 L12,5 L12,3 Z M15,6 L17,6 L17,8 L15,8 L15,6 Z M15,3 L17,3 L17,5 L15,5 L15,3 Z M10,20 L14,16 L6,16 L10,20 Z"}));const{useHistory:lm}=nt(vt.privateApis);function cm(){const{isPage:e,canvasMode:t,hasPageContentFocus:n}=(0,d.useSelect)((e=>({isPage:e(Gn).isPage(),canvasMode:nt(e(Gn)).getCanvasMode(),hasPageContentFocus:e(Gn).hasPageContentFocus()})),[]),{setHasPageContentFocus:a}=(0,d.useDispatch)(Gn);if(!e||"edit"!==t)return{isLoading:!1,commands:[]};const r=[];return n?r.push({name:"core/switch-to-template-focus",label:(0,E.__)("Edit template"),icon:Yn,callback:({close:e})=>{a(!1),e()}}):r.push({name:"core/switch-to-page-focus",label:(0,E.__)("Back to page"),icon:qn,callback:({close:e})=>{a(!0),e()}}),{isLoading:!1,commands:r}}function um(){const{isLoaded:e,record:t}=qr(),{removeTemplate:n,revertTemplate:a}=(0,d.useDispatch)(Gn),r=lm(),o=(0,d.useSelect)((e=>e(Gn).hasPageContentFocus()),[]);if(!e)return{isLoading:!0,commands:[]};const i=[];if(zt(t)&&!o){const e="wp_template"===t.type?(0,E.__)("Reset template"):(0,E.__)("Reset template part");i.push({name:"core/reset-template",label:e,icon:aa,callback:({close:e})=>{a(t),e()}})}if(to(t)&&!o){const e="wp_template"===t.type?(0,E.__)("Delete template"):(0,E.__)("Delete template part"),a="wp_template"===t.type?"/wp_template":"/wp_template_part/all";i.push({name:"core/remove-template",label:e,icon:Xd,callback:({close:e})=>{n(t),r.push({path:a}),e()}})}return{isLoading:!e,commands:i}}function dm(){const{openGeneralSidebar:e,closeGeneralSidebar:t,setIsInserterOpened:n,setIsListViewOpened:a,switchEditorMode:r}=(0,d.useDispatch)(Gn),{canvasMode:o,editorMode:i,activeSidebar:s}=(0,d.useSelect)((e=>({canvasMode:nt(e(Gn)).getCanvasMode(),editorMode:e(Gn).getEditorMode(),activeSidebar:e(U).getActiveComplementaryArea(Gn.name)})),[]),{openModal:l}=(0,d.useDispatch)(U),{get:c}=(0,d.useSelect)(x.store),{set:u,toggle:m}=(0,d.useDispatch)(x.store),{createInfoNotice:p}=(0,d.useDispatch)(Se.store);if("edit"!==o)return{isLoading:!1,commands:[]};const _=[];return _.push({name:"core/open-settings-sidebar",label:(0,E.__)("Toggle settings sidebar"),icon:(0,E.isRTL)()?Ki:Xi,callback:({close:n})=>{n(),"edit-site/template"===s?t():e("edit-site/template")}}),_.push({name:"core/open-block-inspector",label:(0,E.__)("Toggle block inspector"),icon:rm,callback:({close:n})=>{n(),"edit-site/block-inspector"===s?t():e("edit-site/block-inspector")}}),_.push({name:"core/toggle-spotlight-mode",label:(0,E.__)("Toggle spotlight mode"),icon:om,callback:({close:e})=>{m("core/edit-site","focusMode"),e()}}),_.push({name:"core/toggle-distraction-free",label:(0,E.__)("Toggle distraction free"),icon:om,callback:({close:e})=>{u("core/edit-site","fixedToolbar",!1),n(!1),a(!1),t(),m("core/edit-site","distractionFree"),p(c("core/edit-site","distractionFree")?(0,E.__)("Distraction free mode turned on."):(0,E.__)("Distraction free mode turned off."),{id:"core/edit-site/distraction-free-mode/notice",type:"snackbar"}),e()}}),_.push({name:"core/toggle-top-toolbar",label:(0,E.__)("Toggle top toolbar"),icon:om,callback:({close:e})=>{m("core/edit-site","fixedToolbar"),e()}}),_.push({name:"core/toggle-code-editor",label:(0,E.__)("Toggle code editor"),icon:im,callback:({close:e})=>{r("visual"===i?"text":"visual"),e()}}),_.push({name:"core/open-preferences",label:(0,E.__)("Open editor preferences"),icon:om,callback:()=>{l(rd)}}),_.push({name:"core/open-shortcut-help",label:(0,E.__)("Open keyboard shortcuts"),icon:sm,callback:()=>{l(Qu)}}),{isLoading:!1,commands:_}}function mm({title:e,subTitle:t,actions:n}){return(0,l.createElement)(v.__experimentalHStack,{as:"header",alignment:"left",className:"edit-site-page-header"},(0,l.createElement)(v.FlexBlock,{className:"edit-site-page-header__page-title"},(0,l.createElement)(v.__experimentalHeading,{as:"h2",level:4,className:"edit-site-page-header__title"},e),t&&(0,l.createElement)(v.__experimentalText,{as:"p",className:"edit-site-page-header__sub-title"},t)),(0,l.createElement)(v.FlexItem,{className:"edit-site-page-header__actions"},n))}function pm({title:e,subTitle:t,actions:n,children:a,className:r,hideTitleFromUI:o=!1}){const i=y()("edit-site-page",r);return(0,l.createElement)(oe,{className:i,ariaLabel:e},(0,l.createElement)("div",{className:"edit-site-page-content"},!o&&e&&(0,l.createElement)(mm,{title:e,subTitle:t,actions:n}),a),(0,l.createElement)(g.EditorSnackbars,null))}function _m({categoryId:e,type:t,titleId:n,descriptionId:a}){const{patternCategories:r}=Ao(),o=(0,d.useSelect)((e=>e(g.store).__experimentalGetDefaultTemplatePartAreas()),[]);let i,s;if(e===ko&&t===So)i=(0,E.__)("My Patterns"),s="";else if(t===wo){const t=o.find((t=>t.area===e));i=t?.label,s=t?.description}else if(t===bo){const t=r.find((t=>t.name===e));i=t?.label,s=t?.description}return i?(0,l.createElement)(v.__experimentalVStack,{className:"edit-site-patterns__section-header"},(0,l.createElement)(v.__experimentalHeading,{as:"h2",level:4,id:n},i),s?(0,l.createElement)(v.__experimentalText,{variant:"muted",as:"p",id:a},s):null):null}var gm=(0,l.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(f.Path,{d:"M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z"}));function hm({item:e,onClose:t}){const[n,a]=(0,l.useState)((()=>e.title)),[r,o]=(0,l.useState)(!1),{editEntityRecord:i,saveEditedEntityRecord:s}=(0,d.useDispatch)(_.store),{createSuccessNotice:c,createErrorNotice:u}=(0,d.useDispatch)(Se.store);if(e.type===wo&&!e.isCustom)return null;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.MenuItem,{onClick:()=>{o(!0),a(e.title)}},(0,E.__)("Rename")),r&&(0,l.createElement)(v.Modal,{title:(0,E.__)("Rename"),onRequestClose:()=>{o(!1),t()},overlayClassName:"edit-site-list__rename_modal"},(0,l.createElement)("form",{onSubmit:async function(r){r.preventDefault();try{await i("postType",e.type,e.id,{title:n}),a(""),o(!1),t(),await s("postType",e.type,e.id,{throwOnError:!0}),c((0,E.__)("Entity renamed."),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while renaming the entity.");u(t,{type:"snackbar"})}}},(0,l.createElement)(v.__experimentalVStack,{spacing:"5"},(0,l.createElement)(v.TextControl,{__nextHasNoMarginBottom:!0,label:(0,E.__)("Name"),value:n,onChange:a,required:!0}),(0,l.createElement)(v.__experimentalHStack,{justify:"right"},(0,l.createElement)(v.Button,{variant:"tertiary",onClick:()=>{o(!1),t()}},(0,E.__)("Cancel")),(0,l.createElement)(v.Button,{variant:"primary",type:"submit"},(0,E.__)("Save")))))))}const{useHistory:ym}=nt(vt.privateApis);function vm(e){if(e.type===bo)return{wp_pattern_sync_status:xo.unsynced};const t=e.reusableBlock.wp_pattern_sync_status,n=t===xo.unsynced;return{...e.reusableBlock.meta,wp_pattern_sync_status:n?t:void 0}}function Em({categoryId:e,item:t,label:n=(0,E.__)("Duplicate"),onClose:a}){const{saveEntityRecord:r}=(0,d.useDispatch)(_.store),{createErrorNotice:o,createSuccessNotice:i}=(0,d.useDispatch)(Se.store),s=ym(),c=Mo();const u=t.type===wo?async function(){try{const n=(0,E.sprintf)((0,E.__)("%s (Copy)"),t.title),o=Po(n,c),l=Io(o),{area:u,content:d}=t.templatePart,m=await r("postType","wp_template_part",{slug:l,title:o,content:d,area:u},{throwOnError:!0});i((0,E.sprintf)((0,E.__)('"%s" created.'),o),{type:"snackbar",id:"edit-site-patterns-success",actions:[{label:(0,E.__)("Edit"),onClick:()=>s.push({postType:wo,postId:m?.id,categoryType:wo,categoryId:e})}]}),a()}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while creating the template part.");o(t,{type:"snackbar",id:"edit-site-patterns-error"}),a()}}:async function(){try{const e=t.type===bo,n=(0,E.sprintf)((0,E.__)("%s (Copy)"),t.title),o=await r("postType","wp_block",{content:e?t.content:t.reusableBlock.content,meta:vm(t),status:"publish",title:n},{throwOnError:!0}),l=e?(0,E.__)("View my patterns"):(0,E.__)("Edit"),c=e?{categoryType:So,categoryId:ko,path:"/patterns"}:{categoryType:So,categoryId:ko,postType:So,postId:o?.id};i((0,E.sprintf)((0,E.__)('"%s" added to my patterns.'),n),{type:"snackbar",id:"edit-site-patterns-success",actions:[{label:l,onClick:()=>s.push(c)}]}),a()}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while creating the pattern.");o(t,{type:"snackbar",id:"edit-site-patterns-error"}),a()}};return(0,l.createElement)(v.MenuItem,{onClick:u},n)}const fm={header:oo,footer:io,uncategorized:Ac};var bm=(0,l.memo)((function({categoryId:e,item:t,...n}){const a=(0,l.useId)(),[r,o]=(0,l.useState)(!1),{removeTemplate:i}=(0,d.useDispatch)(Gn),{__experimentalDeleteReusableBlock:s}=(0,d.useDispatch)(Rc.store),{createErrorNotice:c,createSuccessNotice:u}=(0,d.useDispatch)(Se.store),m=t.type===So,p=t.type===bo,_=t.type===wo,{onClick:g}=St({postType:t.type,postId:m?t.id:t.name,categoryId:e,categoryType:t.type}),h=!t.blocks?.length,f=y()("edit-site-patterns__pattern",{"is-placeholder":h}),b=y()("edit-site-patterns__preview",{"is-inactive":p}),w=m||_&&t.isCustom,S=_&&t.templatePart.has_theme_file,k=[];w?k.push((0,E.__)("Press Enter to edit, or Delete to delete the pattern.")):t.description&&k.push(t.description),p&&k.push((0,E.__)("Theme patterns cannot be edited."));const C=fm[e]||(t.syncStatus===xo.full?Kn:void 0),x=S?(0,E.__)("Clear"):(0,E.__)("Delete"),T=S?(0,E.__)("Are you sure you want to clear these customizations?"):(0,E.sprintf)((0,E.__)('Are you sure you want to delete "%s"?'),t.title);return(0,l.createElement)("li",{className:f},(0,l.createElement)("button",{className:b,id:`edit-site-patterns-${t.name}`,...n,onClick:t.type!==bo?g:void 0,"aria-disabled":t.type!==bo?"false":"true","aria-label":t.title,"aria-describedby":k.length?k.map(((e,t)=>`${a}-${t}`)).join(" "):void 0},h&&(0,E.__)("Empty pattern"),!h&&(0,l.createElement)(we.BlockPreview,{blocks:t.blocks})),k.map(((e,t)=>(0,l.createElement)("div",{key:t,hidden:!0,id:`${a}-${t}`},e))),(0,l.createElement)(v.__experimentalHStack,{className:"edit-site-patterns__footer",justify:"space-between"},(0,l.createElement)(v.__experimentalHStack,{alignment:"center",justify:"left",spacing:3,className:"edit-site-patterns__pattern-title"},C&&!p&&(0,l.createElement)(v.Tooltip,{position:"top center",text:(0,E.__)("Editing this pattern will also update anywhere it is used")},(0,l.createElement)("span",null,(0,l.createElement)(de,{className:"edit-site-patterns__pattern-icon",icon:C}))),(0,l.createElement)(v.Flex,{as:"span",gap:0,justify:"left"},t.type===bo?t.title:(0,l.createElement)(v.__experimentalHeading,{level:5},(0,l.createElement)(v.Button,{variant:"link",onClick:g,tabIndex:"-1"},t.title)),t.type===bo&&(0,l.createElement)(v.Tooltip,{position:"top center",text:(0,E.__)("Theme patterns cannot be edited.")},(0,l.createElement)("span",{className:"edit-site-patterns__pattern-lock-icon"},(0,l.createElement)(de,{icon:yo,size:24}))))),(0,l.createElement)(v.DropdownMenu,{icon:gm,label:(0,E.__)("Actions"),className:"edit-site-patterns__dropdown",popoverProps:{placement:"bottom-end"},toggleProps:{className:"edit-site-patterns__button",isSmall:!0,describedBy:(0,E.sprintf)((0,E.__)("Action menu for %s pattern"),t.title)}},(({onClose:n})=>(0,l.createElement)(v.MenuGroup,null,w&&!S&&(0,l.createElement)(hm,{item:t,onClose:n}),(0,l.createElement)(Em,{categoryId:e,item:t,onClose:n,label:p?(0,E.__)("Copy to My patterns"):(0,E.__)("Duplicate")}),w&&(0,l.createElement)(v.MenuItem,{onClick:()=>o(!0)},S?(0,E.__)("Clear customizations"):(0,E.__)("Delete")))))),r&&(0,l.createElement)(v.__experimentalConfirmDialog,{confirmButtonText:x,onConfirm:()=>_?i(t):(async()=>{try{await s(t.id),u((0,E.sprintf)((0,E.__)('"%s" deleted.'),t.title),{type:"snackbar",id:"edit-site-patterns-success"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,E.__)("An error occurred while deleting the pattern.");c(t,{type:"snackbar",id:"edit-site-patterns-error"})}})(),onCancel:()=>o(!1)},T))}));const wm=20;function Sm({currentPage:e,numPages:t,changePage:n,totalItems:a}){return(0,l.createElement)(v.__experimentalHStack,{expanded:!1,spacing:3,className:"edit-site-patterns__grid-pagination"},(0,l.createElement)(v.__experimentalText,{variant:"muted"},(0,E.sprintf)((0,E._n)("%s item","%s items",a),a)),(0,l.createElement)(v.__experimentalHStack,{expanded:!1,spacing:1},(0,l.createElement)(v.Button,{variant:"tertiary",onClick:()=>n(1),disabled:1===e,"aria-label":(0,E.__)("First page")},"«"),(0,l.createElement)(v.Button,{variant:"tertiary",onClick:()=>n(e-1),disabled:1===e,"aria-label":(0,E.__)("Previous page")},"‹")),(0,l.createElement)(v.__experimentalText,{variant:"muted"},(0,E.sprintf)((0,E._x)("%1$s of %2$s","paging"),e,t)),(0,l.createElement)(v.__experimentalHStack,{expanded:!1,spacing:1},(0,l.createElement)(v.Button,{variant:"tertiary",onClick:()=>n(e+1),disabled:e===t,"aria-label":(0,E.__)("Next page")},"›"),(0,l.createElement)(v.Button,{variant:"tertiary",onClick:()=>n(t),disabled:e===t,"aria-label":(0,E.__)("Last page")},"»")))}function km({categoryId:e,items:t,currentPage:n,setCurrentPage:a,...r}){const o=(0,l.useRef)(),i=t.length,s=n-1,c=(0,l.useMemo)((()=>t.slice(s*wm,s*wm+wm)),[s,t]),u=(0,re.useAsyncList)(c,{step:10});if(!c?.length)return null;const d=Math.ceil(t.length/wm);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("ul",{role:"listbox",className:"edit-site-patterns__grid",...r,ref:o},u.map((t=>(0,l.createElement)(bm,{key:t.name,item:t,categoryId:e})))),d>1&&(0,l.createElement)(Sm,{currentPage:n,numPages:d,changePage:e=>{const t=document.querySelector(".edit-site-patterns");t?.scrollTo(0,0),a(e)},totalItems:i}))}function Cm(){return(0,l.createElement)("div",{className:"edit-site-patterns__no-results"},(0,E.__)("No patterns found."))}var xm=n(4793),Tm=n.n(xm);function Nm(e){return e.toLowerCase()}var Mm=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],Pm=/[^A-Z0-9]+/gi;function Im(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}const Bm=e=>e.name||"",Dm=e=>e.title,Rm=e=>e.description||"",Lm=e=>e.keywords||[],Am=()=>!1;function Fm(e=""){return function(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,a=void 0===n?Mm:n,r=t.stripRegexp,o=void 0===r?Pm:r,i=t.transform,s=void 0===i?Nm:i,l=t.delimiter,c=void 0===l?" ":l,u=Im(Im(e,a,"$1\0$2"),o,"\0"),d=0,m=u.length;"\0"===u.charAt(d);)d++;for(;"\0"===u.charAt(m-1);)m--;return u.slice(d,m).split("\0").map(s).join(c)}(e,{splitRegexp:[/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu,/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu],stripRegexp:/(\p{C}|\p{P}|\p{S})+/giu}).split(" ").filter(Boolean)}function Vm(e=""){return e=(e=(e=Tm()(e)).replace(/^\//,"")).toLowerCase()}const zm=(e="")=>Fm(Vm(e)),Om=(e=[],t="",n={})=>{const a=zm(t),r=!a.length,o={...n,onlyFilterByCategory:r},i=r?0:1,s=e.map((e=>[e,Hm(e,t,o)])).filter((([,e])=>e>i));return 0===a.length||s.sort((([,e],[,t])=>t-e)),s.map((([e])=>e))};function Hm(e,t,n){const{categoryId:a,getName:r=Bm,getTitle:o=Dm,getDescription:i=Rm,getKeywords:s=Lm,hasCategory:l=Am,onlyFilterByCategory:c}=n;let u=l(e,a)?1:0;if(!u||c)return u;const d=r(e),m=o(e),p=i(e),_=s(e),g=Vm(t),h=Vm(m);if(g===h)u+=30;else if(h.startsWith(g))u+=20;else{const e=[d,m,p,..._].join(" ");0===((e,t)=>e.filter((e=>!zm(t).some((t=>t.includes(e))))))(Fm(g),e).length&&(u+=10)}return u}const Gm=[],Um=(e,t)=>e&&t?e+"//"+t:null,$m=(e,{categoryId:t,search:n=""}={})=>{var a;const{getEntityRecords:r,getIsResolving:o}=e(_.store),{__experimentalGetDefaultTemplatePartAreas:i}=e(g.store),s={per_page:-1},l=(null!==(a=r("postType",wo,s))&&void 0!==a?a:Gm).map((e=>(e=>({blocks:(0,c.parse)(e.content.raw),categories:[e.area],description:e.description||"",isCustom:"custom"===e.source,keywords:e.keywords||[],id:Um(e.theme,e.slug),name:Um(e.theme,e.slug),title:(0,At.decodeEntities)(e.title.rendered),type:e.type,templatePart:e}))(e))),u=(i()||[]).map((e=>e.area)),d=o("getEntityRecords",["postType","wp_template_part",s]),m=Om(l,n,{categoryId:t,hasCategory:(e,t)=>"uncategorized"!==t?e.templatePart.area===t:e.templatePart.area===t||!u.includes(e.templatePart.area)});return{patterns:m,isResolving:d}},jm=(e,{search:t="",syncStatus:n}={})=>{const{getEntityRecords:a,getIsResolving:r}=e(_.store),o={per_page:-1},i=a("postType",So,o);let s=i?i.map((e=>{return t=e,{blocks:(0,c.parse)(t.content.raw),categories:t.wp_pattern,id:t.id,name:t.slug,syncStatus:t.wp_pattern_sync_status||xo.full,title:t.title.raw,type:t.type,reusableBlock:t};var t})):Gm;const l=r("getEntityRecords",["postType",So,o]);return n&&(s=s.filter((e=>e.syncStatus===n))),s=Om(s,t,{hasCategory:()=>!0}),{patterns:s,isResolving:l}};var Wm=(e,t,{search:n="",syncStatus:a})=>(0,d.useSelect)((r=>e===wo?$m(r,{categoryId:t,search:n}):e===bo?((e,{categoryId:t,search:n=""}={})=>{var a;const{getSettings:r}=nt(e(Gn)),o=r();let i=[...(null!==(a=o.__experimentalAdditionalBlockPatterns)&&void 0!==a?a:o.__experimentalBlockPatterns)||[],...e(_.store).getBlockPatterns()||[]].filter((e=>!Co.includes(e.source))).filter(To).filter((e=>!1!==e.inserter)).map((e=>({...e,keywords:e.keywords||[],type:"pattern",blocks:(0,c.parse)(e.content)})));return i=Om(i,n,t?{categoryId:t,hasCategory:(e,t)=>e.categories?.includes(t)}:{hasCategory:e=>!e.hasOwnProperty("categories")}),{patterns:i,isResolving:!1}})(r,{categoryId:t,search:n}):e===So?jm(r,{search:n,syncStatus:a}):{patterns:Gm,isResolving:!1}),[t,e,n,a]);const{useLocation:Zm,useHistory:qm}=nt(vt.privateApis),Ym={all:(0,E.__)("All"),[xo.full]:(0,E.__)("Synced"),[xo.unsynced]:(0,E.__)("Standard")},Km={all:"",[xo.full]:(0,E.__)("Patterns that are kept in sync across the site."),[xo.unsynced]:(0,E.__)("Patterns that can be changed freely without affecting the site.")};function Xm({categoryId:e,type:t}){const[n,a]=(0,l.useState)(1),r=Zm(),o=qm(),i=(0,re.useViewportMatch)("medium","<"),[s,c,u]=Er(""),d=(0,l.useDeferredValue)(u),[m,p]=(0,l.useState)("all"),_=(0,l.useDeferredValue)(m),g=t===bo&&"uncategorized"===e,{patterns:h,isResolving:y}=Wm(t,g?"":e,{search:d,syncStatus:"all"===_?void 0:_}),f=(0,l.useId)(),b=`${f}-title`,w=`${f}-description`,S=h.length,k=Ym[m],C=Km[m];return(0,l.createElement)(v.__experimentalVStack,{spacing:6},(0,l.createElement)(_m,{categoryId:e,type:t,titleId:b,descriptionId:w}),(0,l.createElement)(v.Flex,{alignment:"stretch",wrap:!0},i&&(0,l.createElement)(Xn,{icon:(0,E.isRTL)()?pe:me,label:(0,E.__)("Back"),onClick:()=>{"/patterns"===r.state?.backPath?o.back():o.push({path:"/patterns"})}}),(0,l.createElement)(v.FlexBlock,{className:"edit-site-patterns__search-block"},(0,l.createElement)(v.SearchControl,{className:"edit-site-patterns__search",onChange:e=>(e=>{a(1),c(e)})(e),placeholder:(0,E.__)("Search patterns"),label:(0,E.__)("Search patterns"),value:s,__nextHasNoMarginBottom:!0})),e===ko&&(0,l.createElement)(v.__experimentalToggleGroupControl,{className:"edit-site-patterns__sync-status-filter",hideLabelFromVision:!0,label:(0,E.__)("Filter by sync status"),value:m,isBlock:!0,onChange:e=>(e=>{a(1),p(e)})(e),__nextHasNoMarginBottom:!0},Object.entries(Ym).map((([e,t])=>(0,l.createElement)(v.__experimentalToggleGroupControlOption,{className:"edit-site-patterns__sync-status-filter-option",key:e,value:e,label:t}))))),"all"!==m&&(0,l.createElement)(v.__experimentalVStack,{className:"edit-site-patterns__section-header"},(0,l.createElement)(v.__experimentalHeading,{as:"h3",level:5,id:b},k),C?(0,l.createElement)(v.__experimentalText,{variant:"muted",as:"p",id:w},C):null),S&&(0,l.createElement)(km,{categoryId:e,items:h,"aria-labelledby":b,"aria-describedby":w,currentPage:n,setCurrentPage:a}),!y&&!S&&(0,l.createElement)(Cm,null))}const{ExperimentalBlockEditorProvider:Qm}=nt(we.privateApis);function Jm(){const{categoryType:e,categoryId:t}=(0,Et.getQueryArgs)(window.location.href),n=e||fo,a=t||Eo,r=function(){var e;const t=(0,d.useSelect)((e=>{const{getSettings:t}=nt(e(Gn));return t()}),[]),n=null!==(e=t.__experimentalAdditionalBlockPatterns)&&void 0!==e?e:t.__experimentalBlockPatterns,a=(0,d.useSelect)((e=>e(_.store).getBlockPatterns()),[]),r=(0,l.useMemo)((()=>[...n||[],...a||[]].filter(To)),[n,a]);return(0,l.useMemo)((()=>{const{__experimentalAdditionalBlockPatterns:e,...n}=t;return{...n,__experimentalBlockPatterns:r,__unstableIsPreviewMode:!0}}),[t,r])}();return(0,l.createElement)(Qm,{settings:r},(0,l.createElement)(pm,{className:"edit-site-patterns",title:(0,E.__)("Patterns content"),hideTitleFromUI:!0},(0,l.createElement)(Xm,{key:`${n}-${a}`,type:n,categoryId:a})))}function ep({data:e,columns:t}){return(0,l.createElement)("div",{className:"edit-site-table-wrapper"},(0,l.createElement)("table",{className:"edit-site-table"},(0,l.createElement)("thead",null,(0,l.createElement)("tr",null,t.map((e=>(0,l.createElement)("th",{key:e.header},e.header))))),(0,l.createElement)("tbody",null,e.map(((e,n)=>(0,l.createElement)("tr",{key:n},t.map(((t,n)=>(0,l.createElement)("td",{style:{maxWidth:t.maxWidth?t.maxWidth:void 0},key:n},t.cell(e))))))))))}const{useHistory:tp}=nt(vt.privateApis);function np(){const{canCreate:e,postType:t}=(0,d.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(Gn).getSettings();return{canCreate:!t,postType:e(_.store).getPostType("wp_template_part")}}),[]),[n,a]=(0,l.useState)(!1),r=tp();return e&&t?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(v.Button,{variant:"primary",onClick:()=>a(!0)},t.labels.add_new_item),n&&(0,l.createElement)(Bo,{closeModal:()=>a(!1),blocks:[],onCreate:e=>{a(!1),r.push({postId:e.id,postType:"wp_template_part",canvas:"edit"})},onError:()=>a(!1)})):null}function ap(){const{records:e}=(0,_.useEntityRecords)("postType","wp_template_part",{per_page:-1}),t=[{header:(0,E.__)("Template Part"),cell:e=>(0,l.createElement)(v.__experimentalVStack,null,(0,l.createElement)(v.__experimentalHeading,{as:"h3",level:5},(0,l.createElement)(kt,{params:{postId:e.id,postType:e.type},state:{backPath:"/wp_template_part/all"}},(0,At.decodeEntities)(e.title?.rendered||e.slug)))),maxWidth:400},{header:(0,E.__)("Added by"),cell:e=>(0,l.createElement)(eo,{postType:e.type,postId:e.id})},{header:(0,l.createElement)(v.VisuallyHidden,null,(0,E.__)("Actions")),cell:e=>(0,l.createElement)(ao,{postType:e.type,postId:e.id})}];return(0,l.createElement)(pm,{title:(0,E.__)("Template Parts"),actions:(0,l.createElement)(np,null)},e&&(0,l.createElement)(ep,{data:e,columns:t}))}function rp(){const{records:e}=(0,_.useEntityRecords)("postType","wp_template",{per_page:-1}),{canCreate:t}=(0,d.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(Gn).getSettings();return{postType:e(_.store).getPostType("wp_template"),canCreate:!t}})),n=[{header:(0,E.__)("Template"),cell:e=>(0,l.createElement)(v.__experimentalVStack,null,(0,l.createElement)(v.__experimentalHeading,{as:"h3",level:5},(0,l.createElement)(kt,{params:{postId:e.id,postType:e.type,canvas:"edit"}},(0,At.decodeEntities)(e.title?.rendered||e.slug))),e.description&&(0,l.createElement)(v.__experimentalText,{variant:"muted"},(0,At.decodeEntities)(e.description))),maxWidth:400},{header:(0,E.__)("Added by"),cell:e=>(0,l.createElement)(eo,{postType:e.type,postId:e.id})},{header:(0,l.createElement)(v.VisuallyHidden,null,(0,E.__)("Actions")),cell:e=>(0,l.createElement)(ao,{postType:e.type,postId:e.id})}];return(0,l.createElement)(pm,{title:(0,E.__)("Templates"),actions:t&&(0,l.createElement)(jr,{templateType:"wp_template",showIcon:!1,toggleProps:{variant:"primary"}})},e&&(0,l.createElement)(ep,{data:e,columns:n}))}const{useLocation:op}=nt(vt.privateApis);function ip(){const{params:{path:e}}=op();return"/wp_template/all"===e?(0,l.createElement)(rp,null):"/wp_template_part/all"===e?(0,l.createElement)(ap,null):"/patterns"===e?(0,l.createElement)(Jm,null):null}const sp=1e4;const{useCommands:lp}=nt(jn.privateApis),{useCommandContext:cp}=nt($n.privateApis),{useLocation:up}=nt(vt.privateApis),{useGlobalStyle:dp}=nt(we.privateApis),mp=.5;function pp(){Go(),function(){const e=Gd(),{params:t}=Hd(),n=(0,d.useSelect)((e=>nt(e(Gn)).getCanvasMode()),[]),{setCanvasMode:a}=nt((0,d.useDispatch)(Gn)),r=(0,l.useRef)(n),{canvas:o}=t,i=(0,l.useRef)(o),s=(0,l.useRef)(t);(0,l.useEffect)((()=>{s.current=t}),[t]),(0,l.useEffect)((()=>{r.current=n,"init"!==n&&("edit"===n&&i.current!==n&&e.push({...s.current,canvas:"edit"}),"view"===n&&void 0!==i.current&&e.push({...s.current,canvas:void 0}))}),[n,e]),(0,l.useEffect)((()=>{i.current=o,"edit"!==o&&"view"!==r.current?a("view"):"edit"===o&&"edit"!==r.current&&a("edit")}),[o,a])}(),lp(),(0,$n.useCommandLoader)({name:"core/edit-site/page-content-focus",hook:cm,context:"site-editor-edit"}),(0,$n.useCommandLoader)({name:"core/edit-site/manipulate-document",hook:um}),(0,$n.useCommandLoader)({name:"core/edit-site/edit-ui",hook:dm}),function(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t,setCanvasMode:n}=nt((0,d.useDispatch)(Gn)),{params:a}=tm(),r=!$u(a,(0,re.useViewportMatch)("medium","<")),{getCanvasMode:o}=nt((0,d.useSelect)(Gn)),{set:i}=(0,d.useDispatch)(x.store),{createInfoNotice:s}=(0,d.useDispatch)(Se.store),l=em(),{homeUrl:c,isDistractionFree:u}=(0,d.useSelect)((e=>{const{getUnstableBase:t}=e(_.store);return{homeUrl:t()?.home,isDistractionFree:e(x.store).get(Gn.name,"distractionFree")}}),[]);(0,$n.useCommand)({name:"core/edit-site/open-global-styles-revisions",label:(0,E.__)("Open styles revisions"),icon:aa,callback:({close:a})=>{a(),r||l.push({path:"/wp_global_styles",canvas:"edit"}),r&&"edit"!==o()&&n("edit"),e("edit-site/global-styles"),t("global-styles-revisions")}}),(0,$n.useCommand)({name:"core/edit-site/open-styles",label:(0,E.__)("Open styles"),callback:({close:t})=>{t(),r||l.push({path:"/wp_global_styles",canvas:"edit"}),r&&"edit"!==o()&&n("edit"),u&&(i(Gn.name,"distractionFree",!1),s((0,E.__)("Distraction free mode turned off."),{type:"snackbar"})),e("edit-site/global-styles")},icon:Zn}),(0,$n.useCommand)({name:"core/edit-site/toggle-styles-welcome-guide",label:(0,E.__)("Learn about styles"),callback:({close:t})=>{t(),r||l.push({path:"/wp_global_styles",canvas:"edit"}),r&&"edit"!==o()&&n("edit"),e("edit-site/global-styles"),i("core/edit-site","welcomeGuideStyles",!0),setTimeout((()=>{i("core/edit-site","welcomeGuideStyles",!0)}),500)},icon:Qd}),(0,$n.useCommand)({name:"core/edit-site/view-site",label:(0,E.__)("View site"),callback:({close:e})=>{e(),window.open(c,"_blank")},icon:Zu}),(0,$n.useCommandLoader)({name:"core/edit-site/reset-global-styles",hook:nm}),(0,$n.useCommandLoader)({name:"core/edit-site/open-styles-css",hook:am})}();const e=(0,l.useRef)(),{params:t}=up(),n=(0,re.useViewportMatch)("medium","<"),a=$u(t,n),r=!a,{isDistractionFree:o,hasFixedToolbar:i,canvasMode:s,previousShortcut:c,nextShortcut:u}=(0,d.useSelect)((e=>{const{getAllShortcutKeyCombinations:t}=e(Un.store),{getCanvasMode:n}=nt(e(Gn));return{canvasMode:n(),previousShortcut:t("core/edit-site/previous-region"),nextShortcut:t("core/edit-site/next-region"),hasFixedToolbar:e(x.store).get("core/edit-site","fixedToolbar"),isDistractionFree:e(x.store).get("core/edit-site","distractionFree")}}),[]),m="edit"===s,p=(0,v.__unstableUseNavigateRegions)({previous:c,next:u}),g=(0,re.useReducedMotion)(),h=n&&!a||!n&&("view"===s||!r),f=n&&r&&m||!n||!r,b=n&&a||r&&m,[w,S]=(0,re.useResizeObserver)(),[k]=(0,re.useResizeObserver)(),[C]=(0,l.useState)(!1),T=function(){const{isLoaded:e}=qr(),[t,n]=(0,l.useState)(!1),a=(0,d.useSelect)((e=>{const n=e(_.store).hasResolvingSelectors();return!t&&!n}),[t]);return(0,l.useEffect)((()=>{let e;return t||(e=setTimeout((()=>{n(!0)}),sp)),()=>{clearTimeout(e)}}),[t]),(0,l.useEffect)((()=>{if(a){const e=setTimeout((()=>{n(!0)}),1e3);return()=>{clearTimeout(e)}}}),[a]),!t||!e}(),[N,M]=(0,l.useState)(!1);let P;P="view"===s?"view":o?"isDistractionFree":s;cp("edit"===s&&r?"site-editor-edit":"site-editor");const[I]=dp("color.background"),[B]=dp("color.gradient");return"init"===s?null:(0,l.createElement)(l.Fragment,null,(0,l.createElement)($n.CommandMenu,null),(0,l.createElement)(Yd,null),(0,l.createElement)(Kd,null),k,(0,l.createElement)("div",{...p,ref:p.ref,className:y()("edit-site-layout",p.className,{"is-distraction-free":o&&m,"is-full-canvas":b,"is-edit-mode":m,"has-fixed-toolbar":i})},(0,l.createElement)(v.__unstableMotion.div,{className:"edit-site-layout__header-container",variants:{isDistractionFree:{opacity:0,transition:{type:"tween",delay:.8,delayChildren:.8}},isDistractionFreeHovering:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}},view:{opacity:1},edit:{opacity:1}},whileHover:o?"isDistractionFreeHovering":void 0,animate:P},(0,l.createElement)(Dd,{as:v.__unstableMotion.div,variants:{isDistractionFree:{x:"-100%"},isDistractionFreeHovering:{x:0},view:{x:0},edit:{x:0}},ref:e,isTransparent:N,className:"edit-site-layout__hub"}),(0,l.createElement)(v.__unstableAnimatePresence,{initial:!1},r&&m&&(0,l.createElement)(oe,{key:"header",className:"edit-site-layout__header",ariaLabel:(0,E.__)("Editor top bar"),as:v.__unstableMotion.div,variants:{isDistractionFree:{opacity:0,y:0},isDistractionFreeHovering:{opacity:1,y:0},view:{opacity:1,y:"-100%"},edit:{opacity:1,y:0}},exit:{y:"-100%"},initial:{opacity:o?1:0,y:o?0:"-100%"},transition:{type:"tween",duration:g?0:.2,ease:"easeOut"}},(0,l.createElement)(Md,null)))),(0,l.createElement)("div",{className:"edit-site-layout__content"},(0,l.createElement)(oe,{ariaLabel:(0,E.__)("Navigation"),className:"edit-site-layout__sidebar-region"},(0,l.createElement)(v.__unstableMotion.div,{inert:h?void 0:"inert",animate:{opacity:h?1:0},transition:{type:"tween",duration:g||n?0:mp,ease:"easeOut"},className:"edit-site-layout__sidebar"},(0,l.createElement)(Yi,null))),(0,l.createElement)(qd,null),f&&(0,l.createElement)(l.Fragment,null,a&&(0,l.createElement)(ip,null),r&&(0,l.createElement)("div",{className:y()("edit-site-layout__canvas-container",{"is-resizing":C})},w,!!S.width&&(0,l.createElement)(v.__unstableMotion.div,{whileHover:r&&"view"===s?{scale:1.005,transition:{duration:g||C?0:.5,ease:"easeOut"}}:{},initial:!1,layout:"position",className:y()("edit-site-layout__canvas",{"is-right-aligned":N}),transition:{type:"tween",duration:g||C?0:mp,ease:"easeOut"}},(0,l.createElement)(Uu,null,(0,l.createElement)(Od,{isReady:!T,isFullWidth:m,defaultSize:{width:S.width-24,height:S.height},isOversized:N,setIsOversized:M,innerContentStyle:{background:null!=B?B:I}},(0,l.createElement)(Ou,{isLoading:T})))))))))}const{RouterProvider:_p}=nt(vt.privateApis);function gp(){const{createErrorNotice:e}=(0,d.useDispatch)(Se.store);return(0,l.createElement)(Un.ShortcutProvider,{style:{height:"100%"}},(0,l.createElement)(v.SlotFillProvider,null,(0,l.createElement)(ya,null,(0,l.createElement)(v.Popover.Slot,null),(0,l.createElement)(g.UnsavedChangesWarning,null),(0,l.createElement)(_p,null,(0,l.createElement)(pp,null),(0,l.createElement)($.PluginArea,{onError:function(t){e((0,E.sprintf)((0,E.__)('The "%s" plugin has encountered an error and cannot be rendered.'),t))}})))))}function hp({className:e,...t}){const n=(0,d.useSelect)((e=>e(Gn).getSettings().showIconLabels),[]);return(0,l.createElement)(ae,{panelClassName:e,className:"edit-site-sidebar-edit-mode",scope:"core/edit-site",showIconLabels:n,...t})}function yp(e){return(0,l.createElement)(Q,{__unstableExplicitMenuItem:!0,scope:"core/edit-site",...e})}var vp=(0,re.compose)((0,$.withPluginContext)(((e,t)=>{var n;return{as:null!==(n=t.as)&&void 0!==n?n:v.MenuItem,icon:t.icon||e.icon,name:"core/edit-site/plugin-more-menu"}})))(K);function Ep(e,t){const n=document.getElementById(e),a=(0,l.createRoot)(n);t.__experimentalFetchLinkSuggestions=(e,n)=>(0,_.__experimentalFetchLinkSuggestions)(e,n,t),t.__experimentalFetchRichUrlData=_.__experimentalFetchUrlData,(0,d.dispatch)(c.store).__experimentalReapplyBlockTypeFilters();const r=(0,u.__experimentalGetCoreBlocks)().filter((({name:e})=>"core/freeform"!==e));return(0,u.registerCoreBlocks)(r),(0,d.dispatch)(c.store).setFreeformFallbackBlockName("core/html"),(0,ve.registerLegacyWidgetBlock)({inserter:!1}),(0,ve.registerWidgetGroupBlock)({inserter:!1}),(0,d.dispatch)(x.store).setDefaults("core/edit-site",{editorMode:"visual",fixedToolbar:!1,focusMode:!1,distractionFree:!1,keepCaretInsideBlock:!1,welcomeGuide:!0,welcomeGuideStyles:!0,welcomeGuidePage:!0,welcomeGuideTemplate:!0,showListViewByDefault:!1,showBlockBreadcrumbs:!0}),(0,d.dispatch)(U).setDefaultComplementaryArea("core/edit-site","edit-site/template"),(0,d.dispatch)(Gn).updateSettings(t),(0,d.dispatch)(g.store).updateEditorSettings({defaultTemplateTypes:t.defaultTemplateTypes,defaultTemplatePartAreas:t.defaultTemplatePartAreas}),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),a.render((0,l.createElement)(gp,null)),a}function fp(){p()("wp.editSite.reinitializeEditor",{since:"6.2",version:"6.3"})}}(),(window.wp=window.wp||{}).editSite=a}();