2024-09-20 03:55:35 +02:00
|
|
|
(()=>{"use strict";var e={n:t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MoveToWidgetArea:()=>X,addWidgetIdToBlock:()=>K,getWidgetIdFromBlock:()=>q,registerLegacyWidgetBlock:()=>ee,registerLegacyWidgetVariations:()=>Y,registerWidgetGroupBlock:()=>te});var i={};e.r(i),e.d(i,{metadata:()=>A,name:()=>W,settings:()=>O});var n={};e.r(n),e.d(n,{metadata:()=>Q,name:()=>Z,settings:()=>U});const s=window.wp.blocks,r=window.wp.primitives,o=window.ReactJSXRuntime,a=(0,o.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(r.Path,{d:"M6 3H8V5H16V3H18V5C19.1046 5 20 5.89543 20 7V19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19V7C4 5.89543 4.89543 5 6 5V3ZM18 6.5H6C5.72386 6.5 5.5 6.72386 5.5 7V8H18.5V7C18.5 6.72386 18.2761 6.5 18 6.5ZM18.5 9.5H5.5V19C5.5 19.2761 5.72386 19.5 6 19.5H18C18.2761 19.5 18.5 19.2761 18.5 19V9.5ZM11 11H13V13H11V11ZM7 11V13H9V11H7ZM15 13V11H17V13H15Z"})});function c(e){var t,i,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(i=c(e[t]))&&(n&&(n+=" "),n+=i)}else for(i in e)e[i]&&(n&&(n+=" "),n+=i);return n}const l=function(){for(var e,t,i=0,n="",s=arguments.length;i<s;i++)(e=arguments[i])&&(t=c(e))&&(n&&(n+=" "),n+=t);return n},d=window.wp.blockEditor,h=window.wp.components,u=(0,o.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(r.Path,{d:"M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"})}),m=window.wp.i18n,w=window.wp.element,g=window.wp.data,p=window.wp.coreData;function f({selectedId:e,onSelect:t}){const i=(0,g.useSelect)((e=>{var t;const i=null!==(t=e(d.store).getSettings()?.widgetTypesToHideFromLegacyWidgetBlock)&&void 0!==t?t:[];return e(p.store).getWidgetTypes({per_page:-1})?.filter((e=>!i.includes(e.id)))}),[]);return i?0===i.length?(0,m.__)("There are no widgets available."):(0,o.jsx)(h.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,m.__)("Legacy widget"),value:null!=e?e:"",options:[{value:"",label:(0,m.__)("Select widget")},...i.map((e=>({value:e.id,label:e.name})))],onChange:e=>{if(e){const n=i.find((t=>t.id===e));t({selectedId:n.id,isMulti:n.is_multi})}else t({selectedId:null})}}):(0,o.jsx)(h.Spinner,{})}function b({name:e,description:t}){return(0,o.jsxs)("div",{className:"wp-block-legacy-widget-inspector-card",children:[(0,o.jsx)("h3",{className:"wp-block-legacy-widget-inspector-card__name",children:e}),(0,o.jsx)("span",{children:t})]})}const v=window.wp.notices,y=window.wp.compose,_=window.wp.apiFetch;var x=e.n(_);class j{constructor({id:e,idBase:t,instance:i,onChangeInstance:n,onChangeHasPreview:s,onError:r}){this.id=e,this.idBase=t,this._instance=i,this._hasPreview=null,this.onChangeInstance=n,this.onChangeHasPreview=s,this.onError=r,this.number=++k,this.handleFormChange=(0,y.debounce)(this.handleFormChange.bind(this),200),this.handleFormSubmit=this.handleFormSubmit.bind(this),this.initDOM(),this.bindEvents(),this.loadContent()}destroy(){this.unbindEvents(),this.element.remove()}initDOM(){var e,t;this.element=B("div",{class:"widget open"},[B("div",{class:"widget-inside"},[this.form=B("form",{class:"form",method:"post"},[B("input",{class:"widget-id",type:"hidden",name:"widget-id",value:null!==(e=this.id)&&void 0!==e?e:`${this.idBase}-${this.number}`}),B("input",{class:"id_base",type:"hidden",name:"id_base",value:null!==(t=this.idBase)&&void 0!==t?t:this.id}),B("input",{
|