mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-18 08:36:04 +01:00
c886de61f9
The following packages were updated: - @wordpress/a11y to `3.1.2` - @wordpress/annotations to `2.1.6` - @wordpress/api-fetch to `5.1.2` - @wordpress/autop to `3.1.2` - @wordpress/babel-preset-default to `6.2.1` - @wordpress/blob to `3.1.2` - @wordpress/block-directory to `2.1.21` - @wordpress/block-editor to `6.1.14` - @wordpress/block-library to `3.2.19` - @wordpress/block-serialization-default-parser to `4.1.2` - @wordpress/blocks to `9.1.8` - @wordpress/components to `14.1.11` - @wordpress/compose to `4.1.6` - @wordpress/core-data to `3.1.12` - @wordpress/customize-widgets to `1.0.20` - @wordpress/data-controls to `2.1.6` - @wordpress/data to `5.1.6` - @wordpress/date to `4.1.2` - @wordpress/deprecated to `3.1.2` - @wordpress/dom-ready to `3.1.2` - @wordpress/dom to `3.1.5` - @wordpress/e2e-test-utils to `5.3.1` - @wordpress/edit-post to `4.1.21` - @wordpress/edit-widgets to `2.1.21` - @wordpress/editor to `10.1.17` - @wordpress/element to `3.1.2` - @wordpress/escape-html to `2.1.2` - @wordpress/format-library to `2.1.14` - @wordpress/html-entities to `3.1.2` - @wordpress/i18n to `4.1.2` - @wordpress/icons to `4.0.3` - @wordpress/interface to `3.1.12` - @wordpress/keyboard-shortcuts to `2.1.7` - @wordpress/keycodes to `3.1.2` - @wordpress/list-reusable-blocks to `2.1.11` - @wordpress/media-utils to `2.1.2` - @wordpress/notices to `3.1.6` - @wordpress/nux to `4.1.11` - @wordpress/plugins to `3.1.6` - @wordpress/primitives to `2.1.2` - @wordpress/priority-queue to `2.1.2` - @wordpress/react-i18n to `2.1.2` - @wordpress/redux-routine to `4.1.2` - @wordpress/reusable-blocks to `2.1.17` - @wordpress/rich-text to `4.1.6` - @wordpress/scripts to `16.1.5` - @wordpress/server-side-render to `2.1.12` - @wordpress/shortcode to `3.1.2` - @wordpress/url to `3.1.2` - @wordpress/viewport to `3.1.6` - @wordpress/warning to `2.1.2` - @wordpress/widgets to `1.1.19` - @wordpress/wordcount to `3.1.2` Props oandregal, juanmaguitar, gziolo, jblz, talldanwp, ribaricplusplus, peterwisoncc, youknowriad, paaljoachim, kreppar, ellatrix, aristath, walbo, ajlende, kevin940726, mamaduka, ntsekouras, toro_unit, mkaz, joen, noisysocks, zieladam, andraganescu, antonvlasenko, terraling, dariak, vladytimy, circlecube, desrosj. Fixes #54052, #52818. Built from https://develop.svn.wordpress.org/trunk@51719 git-svn-id: http://core.svn.wordpress.org/trunk@51325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
7 lines
36 KiB
JavaScript
7 lines
36 KiB
JavaScript
/*! This file is auto-generated */
|
||
this.wp=this.wp||{},this.wp.customizeWidgets=function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(s,r,function(t){return e[t]}.bind(null,r));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="9pbN")}({"1CF3":function(e,t){e.exports=window.wp.dom},"1ZqX":function(e,t){e.exports=window.wp.data},"6aBm":function(e,t){e.exports=window.wp.mediaUtils},"9pbN":function(e,t,n){"use strict";n.r(t),n.d(t,"initialize",(function(){return Te}));var s={};n.r(s),n.d(s,"__unstableIsFeatureActive",(function(){return z})),n.d(s,"isInserterOpened",(function(){return W})),n.d(s,"__experimentalGetInsertionPoint",(function(){return B}));var r={};n.r(r),n.d(r,"__unstableToggleFeature",(function(){return T})),n.d(r,"setIsInserterOpened",(function(){return F}));var i=n("GRId"),c=n("QyPg"),o=n("GLVC"),a=n("HSyU"),l=n("tI+e"),d=n("l3Sj"),u=n("axFQ"),b=n("K9lf");function m({text:e,children:t}){const n=Object(b.useCopyToClipboard)(e);return Object(i.createElement)(l.Button,{variant:"secondary",ref:n},t)}class h extends i.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}render(){const{error:e}=this.state;return e?Object(i.createElement)(u.Warning,{className:"customize-widgets-error-boundary",actions:[Object(i.createElement)(m,{key:"copy-error",text:e.stack},Object(d.__)("Copy Error"))]},Object(d.__)("The editor has encountered an unexpected error.")):this.props.children}}var p=n("YLtl"),g=n("jZUy"),O=n("1ZqX"),j=n("6aBm"),f=n("wx14");var w=function({inspector:e,closeMenu:t,...n}){const s=Object(O.useSelect)(e=>e(u.store).getSelectedBlockClientId(),[]),r=Object(i.useMemo)(()=>document.getElementById("block-"+s),[s]);return Object(i.createElement)(l.MenuItem,Object(f.a)({onClick:()=>{e.open({returnFocusWhenClose:r}),t()}},n),Object(d.__)("Show more settings"))},_=n("TSYQ"),y=n.n(_),v=n("RxS6"),E=n("Ntru"),k=n("K2cm"),C=n("Q4Sy"),x=n("bWcr");const S=Object(p.flow)([O.combineReducers,(I={features:{fixedToolbar:!1,welcomeGuide:!0}},e=>(t=I,n)=>e(t,n))])({features:(e,t)=>"TOGGLE_FEATURE"===t.type?{...e,[t.feature]:!e[t.feature]}:e});var I;function z(e,t){return Object(p.get)(e.preferences.features,[t],!1)}function W(e){return!!e.blockInserterPanel}function B(e){const{rootClientId:t,insertionIndex:n}=e.blockInserterPanel;return{rootClientId:t,insertionIndex:n}}function T(e){return{type:"TOGGLE_FEATURE",feature:e}}function F(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}const M={reducer:Object(O.combineReducers)({blockInserterPanel:function(e=!1,t){switch(t.type){case"SET_IS_INSERTER_OPENED":return t.value}return e},preferences:S}),selectors:s,actions:r,persist:["preferences"]},A=Object(O.createReduxStore)("core/customize-widgets",M);Object(O.registerStore)("core/customize-widgets",M);var N=function e({setIsOpened:t}){const n=Object(b.useInstanceId)(e,"customize-widget-layout__inserter-panel-title"),s=Object(O.useSelect)(e=>e(A).__experimentalGetInsertionPoint());return Object(i.createElement)("div",{className:"customize-widgets-layout__inserter-panel","aria-labelledby":n},Object(i.createElement)("div",{className:"customize-widgets-layout__inserter-panel-header"},Object(i.createElement)("h2",{id:n,className:"customize-widgets-layout__inserter-panel-header-title"},Object(d.__)("Add a block")),Object(i.createElement)(l.Button,{className:"customize-widgets-layout__inserter-panel-header-close-button",icon:x.a,onClick:()=>t(!1),"aria-label":Object(d.__)("Close inserter")})),Object(i.createElement)("div",{className:"customize-widgets-layout__inserter-panel-content"},Object(i.createElement)(u.__experimentalLibrary,{rootClientId:s.rootClientId,__experimentalInsertionIndex:s.insertionIndex,showInserterHelpPanel:!0,onSelect:()=>t(!1)})))},P=n("VKE3"),G=n("K+tz"),R=n("hF7m"),L=n("RMJe"),D=n("gdqT");function H({label:e,info:t,messageActivated:n,messageDeactivated:s,shortcut:r,feature:c}){const o=Object(O.useSelect)(e=>e(A).__unstableIsFeatureActive(c),[c]),{__unstableToggleFeature:a}=Object(O.useDispatch)(A);return Object(i.createElement)(l.MenuItem,{icon:o&&L.a,isSelected:o,onClick:()=>{a(c),o?Object(D.speak)(s||Object(d.__)("Feature deactivated")):Object(D.speak)(n||Object(d.__)("Feature activated"))},role:"menuitemcheckbox",info:t,shortcut:r},e)}const V=[{keyCombination:{modifier:"primary",character:"b"},description:Object(d.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:Object(d.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:Object(d.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:Object(d.__)("Remove a link.")},{keyCombination:{modifier:"primary",character:"u"},description:Object(d.__)("Underline the selected text.")}];function U({keyCombination:e,forceAriaLabel:t}){const n=e.modifier?v.displayShortcutList[e.modifier](e.character):e.character,s=e.modifier?v.shortcutAriaLabel[e.modifier](e.character):e.character;return Object(i.createElement)("kbd",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||s},Object(p.castArray)(n).map((e,t)=>"+"===e?Object(i.createElement)(i.Fragment,{key:t},e):Object(i.createElement)("kbd",{key:t,className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-key"},e)))}var q=function({description:e,keyCombination:t,aliases:n=[],ariaLabel:s}){return Object(i.createElement)(i.Fragment,null,Object(i.createElement)("div",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-description"},e),Object(i.createElement)("div",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-term"},Object(i.createElement)(U,{keyCombination:t,forceAriaLabel:s}),n.map((e,t)=>Object(i.createElement)(U,{keyCombination:e,forceAriaLabel:s,key:t}))))};var K=function({name:e}){const{keyCombination:t,description:n,aliases:s}=Object(O.useSelect)(t=>{const{getShortcutKeyCombination:n,getShortcutDescription:s,getShortcutAliases:r}=t(R.store);return{keyCombination:n(e),aliases:r(e),description:s(e)}});return t?Object(i.createElement)(q,{keyCombination:t,description:n,aliases:s}):null};const $=({shortcuts:e})=>Object(i.createElement)("ul",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map((e,t)=>Object(i.createElement)("li",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut",key:t},Object(p.isString)(e)?Object(i.createElement)(K,{name:e}):Object(i.createElement)(q,e)))),Q=({title:e,shortcuts:t,className:n})=>Object(i.createElement)("section",{className:y()("customize-widgets-keyboard-shortcut-help-modal__section",n)},!!e&&Object(i.createElement)("h2",{className:"customize-widgets-keyboard-shortcut-help-modal__section-title"},e),Object(i.createElement)($,{shortcuts:t})),Y=({title:e,categoryName:t,additionalShortcuts:n=[]})=>{const s=Object(O.useSelect)(e=>e(R.store).getCategoryShortcuts(t),[t]);return Object(i.createElement)(Q,{title:e,shortcuts:s.concat(n)})};function Z({isModalActive:e,toggleModal:t}){const{registerShortcut:n}=Object(O.useDispatch)(R.store);return n({name:"core/customize-widgets/keyboard-shortcuts",category:"main",description:Object(d.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),Object(R.useShortcut)("core/customize-widgets/keyboard-shortcuts",t,{bindGlobal:!0}),e?Object(i.createElement)(l.Modal,{className:"customize-widgets-keyboard-shortcut-help-modal",title:Object(d.__)("Keyboard shortcuts"),closeLabel:Object(d.__)("Close"),onRequestClose:t},Object(i.createElement)(Q,{className:"customize-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/customize-widgets/keyboard-shortcuts"]}),Object(i.createElement)(Y,{title:Object(d.__)("Global shortcuts"),categoryName:"global"}),Object(i.createElement)(Y,{title:Object(d.__)("Selection shortcuts"),categoryName:"selection"}),Object(i.createElement)(Y,{title:Object(d.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:Object(d.__)("Change the block type after adding a new paragraph."),ariaLabel:Object(d.__)("Forward-slash")}]}),Object(i.createElement)(Q,{title:Object(d.__)("Text formatting"),shortcuts:V})):null}const J={className:"customize-widgets-more-menu__content",position:"bottom left"},X={tooltipPosition:"bottom"};function ee(){const[e,t]=Object(i.useState)(!1),n=()=>t(!e);return Object(R.useShortcut)("core/customize-widgets/keyboard-shortcuts",n,{bindGlobal:!0}),Object(i.createElement)(i.Fragment,null,Object(i.createElement)(l.ToolbarDropdownMenu,{className:"customize-widgets-more-menu",icon:P.a,label:Object(d.__)("Options"),popoverProps:J,toggleProps:X},()=>Object(i.createElement)(i.Fragment,null,Object(i.createElement)(l.MenuGroup,{label:Object(d._x)("View","noun")},Object(i.createElement)(H,{feature:"fixedToolbar",label:Object(d.__)("Top toolbar"),info:Object(d.__)("Access all block and document tools in a single place"),messageActivated:Object(d.__)("Top toolbar activated"),messageDeactivated:Object(d.__)("Top toolbar deactivated")})),Object(i.createElement)(l.MenuGroup,{label:Object(d.__)("Tools")},Object(i.createElement)(l.MenuItem,{onClick:()=>{t(!0)},shortcut:v.displayShortcut.access("h")},Object(d.__)("Keyboard shortcuts")),Object(i.createElement)(H,{feature:"welcomeGuide",label:Object(d.__)("Welcome Guide")}),Object(i.createElement)(l.MenuItem,{role:"menuitem",icon:G.a,href:Object(d.__)("https://wordpress.org/support/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer"},Object(d.__)("Help"),Object(i.createElement)(l.VisuallyHidden,{as:"span"},Object(d.__)("(opens in a new tab)")))),Object(i.createElement)(l.MenuGroup,{label:Object(d.__)("Preferences")},Object(i.createElement)(H,{feature:"keepCaretInsideBlock",label:Object(d.__)("Contain text cursor inside block"),info:Object(d.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:Object(d.__)("Contain text cursor inside block activated"),messageDeactivated:Object(d.__)("Contain text cursor inside block deactivated")})))),Object(i.createElement)(Z,{isModalActive:e,toggleModal:n}))}var te=function({sidebar:e,inserter:t,isInserterOpened:n,setIsInserterOpened:s,isFixedToolbarActive:r}){const[[c,o],a]=Object(i.useState)([e.hasUndo(),e.hasRedo()]);return Object(i.useEffect)(()=>e.subscribeHistory(()=>{a([e.hasUndo(),e.hasRedo()])}),[e]),Object(i.createElement)(i.Fragment,null,Object(i.createElement)("div",{className:y()("customize-widgets-header",{"is-fixed-toolbar-active":r})},Object(i.createElement)(u.NavigableToolbar,{className:"customize-widgets-header-toolbar","aria-label":Object(d.__)("Document tools")},Object(i.createElement)(l.ToolbarButton,{icon:Object(d.isRTL)()?k.a:E.a,label:Object(d.__)("Undo"),shortcut:v.displayShortcut.primary("z"),"aria-disabled":!c,onClick:e.undo,className:"customize-widgets-editor-history-button undo-button"}),Object(i.createElement)(l.ToolbarButton,{icon:Object(d.isRTL)()?E.a:k.a,label:Object(d.__)("Redo"),shortcut:v.displayShortcut.primaryShift("z"),"aria-disabled":!o,onClick:e.redo,className:"customize-widgets-editor-history-button redo-button"}),Object(i.createElement)(l.ToolbarButton,{className:"customize-widgets-header-toolbar__inserter-toggle",isPressed:n,isPrimary:!0,icon:C.a,label:Object(d._x)("Add block","Generic label for block inserter button"),onClick:()=>{s(e=>!e)}}),Object(i.createElement)(ee,null))),Object(i.createPortal)(Object(i.createElement)(N,{setIsOpened:s}),t.contentContainer[0]))};var ne=n("rl8x"),se=n.n(ne);function re(e){const t=e.match(/^widget_(.+)(?:\[(\d+)\])$/);if(t){return`${t[1]}-${parseInt(t[2],10)}`}return e}function ie(e,t=null){let n;if("core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance))if(e.attributes.id)n={id:e.attributes.id};else{const{encoded:s,hash:r,raw:i,...c}=e.attributes.instance;n={idBase:e.attributes.idBase,instance:{...null==t?void 0:t.instance,is_widget_customizer_js_value:!0,encoded_serialized_instance:s,instance_hash_key:r,raw_instance:i,...c}}}else{n={idBase:"block",widgetClass:"WP_Widget_Block",instance:{raw_instance:{content:Object(a.serialize)(e)}}}}return{...Object(p.omit)(t,["form","rendered"]),...n}}function ce({id:e,idBase:t,number:n,instance:s}){let r;const{encoded_serialized_instance:i,instance_hash_key:c,raw_instance:l,...d}=s;if("block"===t){const e=Object(a.parse)(l.content);r=e.length?e[0]:Object(a.createBlock)("core/paragraph",{})}else r=n?Object(a.createBlock)("core/legacy-widget",{idBase:t,instance:{encoded:i,hash:c,raw:l,...d}}):Object(a.createBlock)("core/legacy-widget",{id:e});return Object(o.addWidgetIdToBlock)(r,e)}function oe(e){const[t,n]=Object(i.useState)(()=>e.getWidgets().map(e=>ce(e)));Object(i.useEffect)(()=>e.subscribe((e,t)=>{n(n=>{const s=new Map(e.map(e=>[e.id,e])),r=new Map(n.map(e=>[Object(o.getWidgetIdFromBlock)(e),e])),i=t.map(e=>{const t=s.get(e.id);return t&&t===e?r.get(e.id):ce(e)});return se()(n,i)?n:i})}),[e]);const s=Object(i.useCallback)(t=>{n(n=>{if(se()(n,t))return n;const s=new Map(n.map(e=>[Object(o.getWidgetIdFromBlock)(e),e])),r=t.map(t=>{const n=Object(o.getWidgetIdFromBlock)(t);if(n&&s.has(n)){const r=s.get(n),i=e.getWidget(n);return Object(p.isEqual)(t,r)&&i?i:ie(t,i)}return ie(t)});if(se()(e.getWidgets(),r))return n;const i=e.setWidgets(r);return t.reduce((e,n,s)=>{const r=i[s];return null!==r&&(e===t&&(e=t.slice()),e[s]=Object(o.addWidgetIdToBlock)(n,r)),e},t)})},[e]);return[t,s,s]}const ae=Object(i.createContext)();function le({api:e,sidebarControls:t,children:n}){const[s,r]=Object(i.useState)({current:null}),c=Object(i.useCallback)(e=>{for(const n of t){if(n.setting.get().includes(e)){n.sectionInstance.expand({completeCallback(){r({current:e})}});break}}},[t]);Object(i.useEffect)(()=>{function t(e){const t=re(e);c(t)}function n(){e.previewer.preview.bind("focus-control-for-setting",t)}return e.previewer.bind("ready",n),()=>{e.previewer.unbind("ready",n),e.previewer.preview.unbind("focus-control-for-setting",t)}},[e,c]);const o=Object(i.useMemo)(()=>[s,c],[s,c]);return Object(i.createElement)(ae.Provider,{value:o},n)}const de=()=>Object(i.useContext)(ae);function ue({sidebar:e,settings:t,children:n}){const[s,r,c]=oe(e);return function(e){const{selectBlock:t}=Object(O.useDispatch)(u.store),[n]=de(),s=Object(i.useRef)(e);Object(i.useEffect)(()=>{s.current=e},[e]),Object(i.useEffect)(()=>{if(n.current){const e=s.current.find(e=>Object(o.getWidgetIdFromBlock)(e)===n.current);if(e){t(e.clientId);const n=document.querySelector(`[data-block="${e.clientId}"]`);null==n||n.focus()}}},[n,t])}(s),Object(i.createElement)(u.BlockEditorProvider,{value:s,onInput:r,onChange:c,settings:t,useSubRegistry:!1},n)}function be({sidebar:e}){const{__unstableToggleFeature:t}=Object(O.useDispatch)(A),n=e.getWidgets().every(e=>e.id.startsWith("block-"));return Object(i.createElement)("div",{className:"customize-widgets-welcome-guide"},Object(i.createElement)("div",{className:"customize-widgets-welcome-guide__image__wrapper"},Object(i.createElement)("picture",null,Object(i.createElement)("source",{srcSet:"https://s.w.org/images/block-editor/welcome-editor.svg",media:"(prefers-reduced-motion: reduce)"}),Object(i.createElement)("img",{className:"customize-widgets-welcome-guide__image",src:"https://s.w.org/images/block-editor/welcome-editor.gif",width:"312",height:"240",alt:""}))),Object(i.createElement)("h1",{className:"customize-widgets-welcome-guide__heading"},Object(d.__)("Welcome to block Widgets")),Object(i.createElement)("p",{className:"customize-widgets-welcome-guide__text"},n?Object(d.__)("Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site."):Object(d.__)("You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.")),Object(i.createElement)(l.Button,{className:"customize-widgets-welcome-guide__button",isPrimary:!0,onClick:()=>t("welcomeGuide")},Object(d.__)("Got it")),Object(i.createElement)("hr",{className:"customize-widgets-welcome-guide__separator"}),!n&&Object(i.createElement)("p",{className:"customize-widgets-welcome-guide__more-info"},Object(d.__)("Want to stick with the old widgets?"),Object(i.createElement)("br",null),Object(i.createElement)(l.ExternalLink,{href:Object(d.__)("https://wordpress.org/plugins/classic-widgets/")},Object(d.__)("Get the Classic Widgets plugin."))),Object(i.createElement)("p",{className:"customize-widgets-welcome-guide__more-info"},Object(d.__)("New to the block editor?"),Object(i.createElement)("br",null),Object(i.createElement)(l.ExternalLink,{href:Object(d.__)("https://wordpress.org/support/article/wordpress-editor/")},Object(d.__)("Here's a detailed guide."))))}function me({undo:e,redo:t,save:n}){return Object(R.useShortcut)("core/customize-widgets/undo",t=>{e(),t.preventDefault()},{bindGlobal:!0}),Object(R.useShortcut)("core/customize-widgets/redo",e=>{t(),e.preventDefault()},{bindGlobal:!0}),Object(R.useShortcut)("core/customize-widgets/save",e=>{e.preventDefault(),n()},{bindGlobal:!0}),null}me.Register=function(){const{registerShortcut:e,unregisterShortcut:t}=Object(O.useDispatch)(R.store);return Object(i.useEffect)(()=>(e({name:"core/customize-widgets/undo",category:"global",description:Object(d.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/customize-widgets/redo",category:"global",description:Object(d.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"}}),e({name:"core/customize-widgets/save",category:"global",description:Object(d.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),()=>{t("core/customize-widgets/undo"),t("core/customize-widgets/redo"),t("core/customize-widgets/save")}),[e]),null};var he=me;function pe(e){const t=Object(i.useRef)(),n=Object(O.useSelect)(e=>0===e(u.store).getBlockCount());return Object(i.useEffect)(()=>{if(n&&t.current){const{ownerDocument:e}=t.current;e.activeElement&&e.activeElement!==e.body||t.current.focus()}},[n]),Object(i.createElement)(u.ButtonBlockAppender,Object(f.a)({},e,{ref:t}))}function ge({blockEditorSettings:e,sidebar:t,inserter:n,inspector:s}){const[r,c]=function(e){const t=Object(O.useSelect)(e=>e(A).isInserterOpened()),{setIsInserterOpened:n}=Object(O.useDispatch)(A);return Object(i.useEffect)(()=>{t?e.open():e.close()},[e,t]),[t,Object(i.useCallback)(e=>{let t=e;"function"==typeof e&&(t=e(Object(O.select)(A).isInserterOpened())),n(t)},[n])]}(n),{hasUploadPermissions:o,isFixedToolbarActive:a,keepCaretInsideBlock:l,isWelcomeGuideActive:d}=Object(O.useSelect)(e=>({hasUploadPermissions:Object(p.defaultTo)(e(g.store).canUser("create","media"),!0),isFixedToolbarActive:e(A).__unstableIsFeatureActive("fixedToolbar"),keepCaretInsideBlock:e(A).__unstableIsFeatureActive("keepCaretInsideBlock"),isWelcomeGuideActive:e(A).__unstableIsFeatureActive("welcomeGuide")}),[]),b=Object(i.useMemo)(()=>{let t;return o&&(t=({onError:t,...n})=>{Object(j.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...n})}),{...e,__experimentalSetIsInserterOpened:c,mediaUpload:t,hasFixedToolbar:a,keepCaretInsideBlock:l,__unstableHasCustomAppender:!0}},[o,e,a,l,c]);return d?Object(i.createElement)(be,{sidebar:t}):Object(i.createElement)(i.Fragment,null,Object(i.createElement)(u.BlockEditorKeyboardShortcuts.Register,null),Object(i.createElement)(he.Register,null),Object(i.createElement)(ue,{sidebar:t,settings:b},Object(i.createElement)(u.BlockEditorKeyboardShortcuts,null),Object(i.createElement)(he,{undo:t.undo,redo:t.redo,save:t.save}),Object(i.createElement)(te,{sidebar:t,inserter:n,isInserterOpened:r,setIsInserterOpened:c,isFixedToolbarActive:a}),Object(i.createElement)(u.CopyHandler,null,Object(i.createElement)(u.BlockTools,null,Object(i.createElement)(u.BlockSelectionClearer,null,Object(i.createElement)(u.WritingFlow,null,Object(i.createElement)(u.ObserveTyping,null,Object(i.createElement)(u.BlockList,{renderAppender:pe})))))),Object(i.createPortal)(Object(i.createElement)("form",{onSubmit:e=>e.preventDefault()},Object(i.createElement)(u.BlockInspector,null)),s.contentContainer[0])),Object(i.createElement)(u.__unstableBlockSettingsMenuFirstItem,null,({onClose:e})=>Object(i.createElement)(w,{inspector:s,closeMenu:e})))}const Oe=Object(i.createContext)();function je({sidebarControls:e,activeSidebarControl:t,children:n}){const s=Object(i.useMemo)(()=>({sidebarControls:e,activeSidebarControl:t}),[e,t]);return Object(i.createElement)(Oe.Provider,{value:s},n)}function fe({api:e,sidebarControls:t,blockEditorSettings:n}){const[s,r]=Object(i.useState)(null),c=document.getElementById("customize-theme-controls"),o=Object(i.useRef)();!function(e,t){const{hasSelectedBlock:n,hasMultiSelection:s}=Object(O.useSelect)(u.store),{clearSelectedBlock:r}=Object(O.useDispatch)(u.store);Object(i.useEffect)(()=>{if(t.current&&e){const a=e.inspector,l=e.container[0],d=l.ownerDocument,u=d.defaultView;function i(e){!n()&&!s()||!e||!d.contains(e)||l.contains(e)||t.current.contains(e)||e.closest('[role="dialog"]')||a.expanded()||r()}function c(e){i(e.target)}function o(){i(d.activeElement)}return d.addEventListener("mousedown",c),u.addEventListener("blur",o),()=>{d.removeEventListener("mousedown",c),u.removeEventListener("blur",o)}}},[t,e,n,s,r])}(s,o),Object(i.useEffect)(()=>{const e=t.map(e=>e.subscribe(t=>{t&&r(e)}));return()=>{e.forEach(e=>e())}},[t]);const a=s&&Object(i.createPortal)(Object(i.createElement)(h,null,Object(i.createElement)(ge,{key:s.id,blockEditorSettings:n,sidebar:s.sidebarAdapter,inserter:s.inserter,inspector:s.inspector})),s.container[0]),d=c&&Object(i.createPortal)(Object(i.createElement)("div",{className:"customize-widgets-popover",ref:o},Object(i.createElement)(l.Popover.Slot,null)),c);return Object(i.createElement)(l.SlotFillProvider,null,Object(i.createElement)(je,{sidebarControls:t,activeSidebarControl:s},Object(i.createElement)(le,{api:e,sidebarControls:t},a,d)))}function we(){const{wp:{customize:e}}=window;return class extends e.Section{ready(){const t=function(){const{wp:{customize:e}}=window;return class extends e.Section{constructor(e,t){super(e,t),this.parentSection=t.parentSection,this.returnFocusWhenClose=null}ready(){this.contentContainer[0].classList.add("customize-widgets-layout__inspector")}onChangeExpanded(e,t){super.onChangeExpanded(e,t),this.parentSection&&!t.unchanged&&(e?this.parentSection.collapse({manualTransition:!0}):this.parentSection.expand({manualTransition:!0,completeCallback:()=>{this.returnFocusWhenClose&&!this.contentContainer[0].contains(this.returnFocusWhenClose)&&this.returnFocusWhenClose.focus()}}))}open({returnFocusWhenClose:e}={}){this.returnFocusWhenClose=e,this.expand({allowMultiple:!0})}close(){this.collapse({allowMultiple:!0})}}}();this.inspector=new t("widgets-inspector-"+this.id,{title:Object(d.__)("Block Settings"),parentSection:this,customizeAction:[Object(d.__)("Customizing"),Object(d.__)("Widgets"),this.params.title].join(" ▸ ")}),e.section.add(this.inspector),this.contentContainer[0].classList.add("customize-widgets__sidebar-section")}hasSubSectionOpened(){return this.inspector.expanded()}onChangeExpanded(e,t){const n=this.controls(),s={...t,completeCallback(){var r;n.forEach(t=>{var n;null===(n=t.onChangeSectionExpanded)||void 0===n||n.call(t,e,s)}),null===(r=t.completeCallback)||void 0===r||r.call(t)}};s.manualTransition?e?(this.contentContainer.addClass(["busy","open"]),this.contentContainer.removeClass("is-sub-section-open"),this.contentContainer.closest(".wp-full-overlay").addClass("section-open"),this.contentContainer.one("transitionend",()=>{this.contentContainer.removeClass("busy"),s.completeCallback()})):(this.contentContainer.addClass(["busy","is-sub-section-open"]),this.contentContainer.closest(".wp-full-overlay").addClass("section-open"),this.contentContainer.removeClass("open"),this.contentContainer.one("transitionend",()=>{this.contentContainer.removeClass("busy"),s.completeCallback()})):super.onChangeExpanded(e,s)}}}const{wp:_e}=window;function ye(e){const t=e.match(/^(.+)-(\d+)$/);return t?{idBase:t[1],number:parseInt(t[2],10)}:{idBase:e}}function ve(e){const{idBase:t,number:n}=ye(e);return n?`widget_${t}[${n}]`:"widget_"+t}class Ee{constructor(e,t){this.setting=e,this.api=t,this.locked=!1,this.widgetsCache=new WeakMap,this.subscribers=new Set,this.history=[this._getWidgetIds().map(e=>this.getWidget(e))],this.historyIndex=0,this.historySubscribers=new Set,this._debounceSetHistory=function(e,t,n){let s,r=!1;function i(...i){const c=(r?t:e).apply(this,i);return r=!0,clearTimeout(s),s=setTimeout(()=>{r=!1},n),c}return i.cancel=()=>{r=!1,clearTimeout(s)},i}(this._pushHistory,this._replaceHistory,1e3),this.setting.bind(this._handleSettingChange.bind(this)),this.api.bind("change",this._handleAllSettingsChange.bind(this)),this.undo=this.undo.bind(this),this.redo=this.redo.bind(this),this.save=this.save.bind(this)}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}getWidgets(){return this.history[this.historyIndex]}_emit(...e){for(const t of this.subscribers)t(...e)}_getWidgetIds(){return this.setting.get()}_pushHistory(){this.history=[...this.history.slice(0,this.historyIndex+1),this._getWidgetIds().map(e=>this.getWidget(e))],this.historyIndex+=1,this.historySubscribers.forEach(e=>e())}_replaceHistory(){this.history[this.historyIndex]=this._getWidgetIds().map(e=>this.getWidget(e))}_handleSettingChange(){if(this.locked)return;const e=this.getWidgets();this._pushHistory(),this._emit(e,this.getWidgets())}_handleAllSettingsChange(e){if(this.locked)return;if(!e.id.startsWith("widget_"))return;const t=re(e.id);if(!this.setting.get().includes(t))return;const n=this.getWidgets();this._pushHistory(),this._emit(n,this.getWidgets())}_createWidget(e){const t=_e.customize.Widgets.availableWidgets.findWhere({id_base:e.idBase});let n=e.number;t.get("is_multi")&&!n&&(t.set("multi_number",t.get("multi_number")+1),n=t.get("multi_number"));const s=n?`widget_${e.idBase}[${n}]`:"widget_"+e.idBase,r={transport:_e.customize.Widgets.data.selectiveRefreshableWidgets[t.get("id_base")]?"postMessage":"refresh",previewer:this.setting.previewer};this.api.create(s,s,"",r).set(e.instance);return re(s)}_removeWidget(e){const t=ve(e.id),n=this.api(t);if(n){const e=n.get();this.widgetsCache.delete(e)}this.api.remove(t)}_updateWidget(e){const t=this.getWidget(e.id);if(t===e)return e.id;if(t.idBase&&e.idBase&&t.idBase===e.idBase){const t=ve(e.id);return this.api(t).set(e.instance),e.id}return this._removeWidget(e),this._createWidget(e)}getWidget(e){if(!e)return null;const{idBase:t,number:n}=ye(e),s=ve(e),r=this.api(s);if(!r)return null;const i=r.get();if(this.widgetsCache.has(i))return this.widgetsCache.get(i);const c={id:e,idBase:t,number:n,instance:i};return this.widgetsCache.set(i,c),c}_updateWidgets(e){this.locked=!0;const t=[],n=e.map(e=>{if(e.id&&this.getWidget(e.id))return t.push(null),this._updateWidget(e);const n=this._createWidget(e);return t.push(n),n});return this.getWidgets().filter(e=>!n.includes(e.id)).forEach(e=>this._removeWidget(e)),this.setting.set(n),this.locked=!1,t}setWidgets(e){const t=this._updateWidgets(e);return this._debounceSetHistory(),t}hasUndo(){return this.historyIndex>0}hasRedo(){return this.historyIndex<this.history.length-1}_seek(e){const t=this.getWidgets();this.historyIndex=e;const n=this.history[this.historyIndex];this._updateWidgets(n),this._emit(t,this.getWidgets()),this.historySubscribers.forEach(e=>e()),this._debounceSetHistory.cancel()}undo(){this.hasUndo()&&this._seek(this.historyIndex-1)}redo(){this.hasRedo()&&this._seek(this.historyIndex+1)}subscribeHistory(e){return this.historySubscribers.add(e),()=>{this.historySubscribers.delete(e)}}save(){this.api.previewer.save()}}var ke=n("1CF3");function Ce(){const{wp:{customize:e}}=window;return class extends e.Control{constructor(...e){super(...e),this.subscribers=new Set}ready(){const t=function(){const{wp:{customize:e}}=window,t=e.OuterSection;return e.OuterSection=class extends t{onChangeExpanded(t,n){return t&&e.section.each(e=>{"outer"===e.params.type&&e.id!==this.id&&e.expanded()&&e.collapse()}),super.onChangeExpanded(t,n)}},e.sectionConstructor.outer=e.OuterSection,class extends e.OuterSection{constructor(...e){super(...e),this.params.type="outer",this.activeElementBeforeExpanded=null;this.contentContainer[0].ownerDocument.defaultView.addEventListener("keydown",e=>{!this.expanded()||e.keyCode!==v.ESCAPE&&"Escape"!==e.code||(e.stopPropagation(),Object(O.dispatch)(A).setIsInserterOpened(!1))},!0),this.contentContainer.addClass("widgets-inserter"),this.isFromInternalAction=!1,this.expanded.bind(()=>{this.isFromInternalAction||Object(O.dispatch)(A).setIsInserterOpened(this.expanded()),this.isFromInternalAction=!1})}open(){if(!this.expanded()){const e=this.contentContainer[0];this.activeElementBeforeExpanded=e.ownerDocument.activeElement,this.isFromInternalAction=!0,this.expand({completeCallback(){const t=ke.focus.tabbable.find(e)[1];t&&t.focus()}})}}close(){if(this.expanded()){const e=this.contentContainer[0],t=e.ownerDocument.activeElement;this.isFromInternalAction=!0,this.collapse({completeCallback(){e.contains(t)&&this.activeElementBeforeExpanded&&this.activeElementBeforeExpanded.focus()}})}}}}();this.inserter=new t("widgets-inserter-"+this.id,{}),e.section.add(this.inserter),this.sectionInstance=e.section(this.section()),this.inspector=this.sectionInstance.inspector,this.sidebarAdapter=new Ee(this.setting,e)}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}onChangeSectionExpanded(e,t){t.unchanged||(e||Object(O.dispatch)(A).setIsInserterOpened(!1),this.subscribers.forEach(n=>n(e,t)))}}}var xe=n("g56x");const Se=Object(b.createHigherOrderComponent)(e=>t=>{let n=Object(o.getWidgetIdFromBlock)(t);const s=function(){const{sidebarControls:e}=Object(i.useContext)(Oe);return e}(),r=function(){const{activeSidebarControl:e}=Object(i.useContext)(Oe);return e}(),c=(null==s?void 0:s.length)>1,a=t.name,l=t.clientId,d=Object(O.useSelect)(e=>e(u.store).canInsertBlockType(a,""),[a]),b=Object(O.useSelect)(e=>e(u.store).getBlock(l),[l]),{removeBlock:m}=Object(O.useDispatch)(u.store),[,h]=de();return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(e,t),c&&d&&Object(i.createElement)(u.BlockControls,null,Object(i.createElement)(o.MoveToWidgetArea,{widgetAreas:s.map(e=>({id:e.id,name:e.params.label,description:e.params.description})),currentWidgetAreaId:null==r?void 0:r.id,onSelect:function(e){const t=s.find(t=>t.id===e);if(n){const e=r.setting,s=t.setting;e(Object(p.without)(e(),n)),s([...s(),n])}else{const e=t.sidebarAdapter;m(l);const s=e.setWidgets([...e.getWidgets(),ie(b)]);n=s.reverse().find(e=>!!e)}h(n)}})))},"withMoveToSidebarToolbarItem");Object(xe.addFilter)("editor.BlockEdit","core/customize-widgets/block-edit",Se);Object(xe.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",()=>j.MediaUpload);const{wp:Ie}=window,ze=Object(b.createHigherOrderComponent)(e=>t=>{var n,s;const{idBase:r}=t.attributes,c=null!==(n=null===(s=Ie.customize.Widgets.data.availableWidgets.find(e=>e.id_base===r))||void 0===s?void 0:s.is_wide)&&void 0!==n&&n;return Object(i.createElement)(e,Object(f.a)({},t,{isWide:c}))},"withWideWidgetDisplay");Object(xe.addFilter)("editor.BlockEdit","core/customize-widgets/wide-widget-display",ze);const{wp:We}=window,Be=["core/more","core/block","core/freeform"];function Te(e,t){const n=Object(c.__experimentalGetCoreBlocks)().filter(e=>!(Be.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")));Object(c.registerCoreBlocks)(n),Object(o.registerLegacyWidgetBlock)(),Object(o.registerLegacyWidgetVariations)(t),Object(a.setFreeformContentHandlerName)("core/html");const s=Ce();We.customize.sectionConstructor.sidebar=we(),We.customize.controlConstructor.sidebar_block_editor=s;const r=document.createElement("div");document.body.appendChild(r),We.customize.bind("ready",()=>{const e=[];We.customize.control.each(t=>{t instanceof s&&e.push(t)}),Object(i.render)(Object(i.createElement)(fe,{api:We.customize,sidebarControls:e,blockEditorSettings:t}),r)})}},GLVC:function(e,t){e.exports=window.wp.widgets},GRId:function(e,t){e.exports=window.wp.element},HSyU:function(e,t){e.exports=window.wp.blocks},"K+tz":function(e,t,n){"use strict";var s=n("GRId"),r=n("Tqx9");const i=Object(s.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(r.Path,{d:"M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"}));t.a=i},K2cm:function(e,t,n){"use strict";var s=n("GRId"),r=n("Tqx9");const i=Object(s.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(r.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"}));t.a=i},K9lf:function(e,t){e.exports=window.wp.compose},Ntru:function(e,t,n){"use strict";var s=n("GRId"),r=n("Tqx9");const i=Object(s.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(r.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"}));t.a=i},Q4Sy:function(e,t,n){"use strict";var s=n("GRId"),r=n("Tqx9");const i=Object(s.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(r.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));t.a=i},QyPg:function(e,t){e.exports=window.wp.blockLibrary},RMJe:function(e,t,n){"use strict";var s=n("GRId"),r=n("Tqx9");const i=Object(s.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(r.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"}));t.a=i},RxS6:function(e,t){e.exports=window.wp.keycodes},TSYQ:function(e,t,n){var s;
|
||
/*!
|
||
Copyright (c) 2018 Jed Watson.
|
||
Licensed under the MIT License (MIT), see
|
||
http://jedwatson.github.io/classnames
|
||
*/!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var i=typeof s;if("string"===i||"number"===i)e.push(s);else if(Array.isArray(s)){if(s.length){var c=r.apply(null,s);c&&e.push(c)}}else if("object"===i)if(s.toString===Object.prototype.toString)for(var o in s)n.call(s,o)&&s[o]&&e.push(o);else e.push(s.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(s=function(){return r}.apply(t,[]))||(e.exports=s)}()},Tqx9:function(e,t){e.exports=window.wp.primitives},VKE3:function(e,t,n){"use strict";var s=n("GRId"),r=n("Tqx9");const i=Object(s.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(r.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));t.a=i},YLtl:function(e,t){e.exports=window.lodash},axFQ:function(e,t){e.exports=window.wp.blockEditor},bWcr:function(e,t,n){"use strict";var s=n("GRId"),r=n("Tqx9");const i=Object(s.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(r.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"}));t.a=i},g56x:function(e,t){e.exports=window.wp.hooks},gdqT:function(e,t){e.exports=window.wp.a11y},hF7m:function(e,t){e.exports=window.wp.keyboardShortcuts},jZUy:function(e,t){e.exports=window.wp.coreData},l3Sj:function(e,t){e.exports=window.wp.i18n},rl8x:function(e,t){e.exports=window.wp.isShallowEqual},"tI+e":function(e,t){e.exports=window.wp.components},wx14:function(e,t,n){"use strict";function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return s}))}}); |