2024-04-17 11:32:24 +02:00
/******/ ( ( ) => { // webpackBootstrap
2025-02-28 08:42:11 +01:00
/******/ "use strict" ;
/******/ // The require scope
/******/ var _ _webpack _require _ _ = { } ;
2022-06-16 14:03:35 +02:00
/******/
2021-07-23 11:58:50 +02:00
/************************************************************************/
2022-06-16 14:03:35 +02:00
/******/ /* webpack/runtime/compat get default export */
2024-04-17 11:32:24 +02:00
/******/ ( ( ) => {
2022-06-16 14:03:35 +02:00
/******/ // getDefaultExport function for compatibility with non-harmony modules
2024-04-17 11:32:24 +02:00
/******/ _ _webpack _require _ _ . n = ( module ) => {
2022-06-16 14:03:35 +02:00
/******/ var getter = module && module . _ _esModule ?
2024-04-17 11:32:24 +02:00
/******/ ( ) => ( module [ 'default' ] ) :
/******/ ( ) => ( module ) ;
2022-06-16 14:03:35 +02:00
/******/ _ _webpack _require _ _ . d ( getter , { a : getter } ) ;
/******/ return getter ;
/******/ } ;
2024-04-17 11:32:24 +02:00
/******/ } ) ( ) ;
2022-06-16 14:03:35 +02:00
/******/
/******/ /* webpack/runtime/define property getters */
2024-04-17 11:32:24 +02:00
/******/ ( ( ) => {
2022-06-16 14:03:35 +02:00
/******/ // define getter functions for harmony exports
2024-04-17 11:32:24 +02:00
/******/ _ _webpack _require _ _ . d = ( exports , definition ) => {
2022-06-16 14:03:35 +02:00
/******/ for ( var key in definition ) {
/******/ if ( _ _webpack _require _ _ . o ( definition , key ) && ! _ _webpack _require _ _ . o ( exports , key ) ) {
/******/ Object . defineProperty ( exports , key , { enumerable : true , get : definition [ key ] } ) ;
/******/ }
/******/ }
/******/ } ;
2024-04-17 11:32:24 +02:00
/******/ } ) ( ) ;
2022-06-16 14:03:35 +02:00
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
2024-04-17 11:32:24 +02:00
/******/ ( ( ) => {
/******/ _ _webpack _require _ _ . o = ( obj , prop ) => ( Object . prototype . hasOwnProperty . call ( obj , prop ) )
/******/ } ) ( ) ;
2022-06-16 14:03:35 +02:00
/******/
/******/ /* webpack/runtime/make namespace object */
2024-04-17 11:32:24 +02:00
/******/ ( ( ) => {
2022-06-16 14:03:35 +02:00
/******/ // define __esModule on exports
2024-04-17 11:32:24 +02:00
/******/ _ _webpack _require _ _ . r = ( exports ) => {
2022-06-16 14:03:35 +02:00
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
/******/ } ;
2024-04-17 11:32:24 +02:00
/******/ } ) ( ) ;
2022-06-16 14:03:35 +02:00
/******/
/************************************************************************/
var _ _webpack _exports _ _ = { } ;
2021-07-23 11:58:50 +02:00
// ESM COMPAT FLAG
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
// EXPORTS
2022-06-16 14:03:35 +02:00
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
2024-04-17 11:32:24 +02:00
MoveToWidgetArea : ( ) => ( /* reexport */ MoveToWidgetArea ) ,
addWidgetIdToBlock : ( ) => ( /* reexport */ addWidgetIdToBlock ) ,
getWidgetIdFromBlock : ( ) => ( /* reexport */ getWidgetIdFromBlock ) ,
registerLegacyWidgetBlock : ( ) => ( /* binding */ registerLegacyWidgetBlock ) ,
registerLegacyWidgetVariations : ( ) => ( /* reexport */ registerLegacyWidgetVariations ) ,
registerWidgetGroupBlock : ( ) => ( /* binding */ registerWidgetGroupBlock )
2022-06-16 14:03:35 +02:00
} ) ;
2021-07-23 11:58:50 +02:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/index.js
var legacy _widget _namespaceObject = { } ;
_ _webpack _require _ _ . r ( legacy _widget _namespaceObject ) ;
2022-06-16 14:03:35 +02:00
_ _webpack _require _ _ . d ( legacy _widget _namespaceObject , {
2025-12-12 13:15:55 +01:00
yu : ( ) => ( block _namespaceObject ) ,
2025-04-25 12:30:07 +02:00
UU : ( ) => ( legacy _widget _name ) ,
W0 : ( ) => ( settings )
2022-06-16 14:03:35 +02:00
} ) ;
2021-07-23 11:58:50 +02:00
2022-04-02 10:26:41 +02:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/index.js
var widget _group _namespaceObject = { } ;
_ _webpack _require _ _ . r ( widget _group _namespaceObject ) ;
2022-06-16 14:03:35 +02:00
_ _webpack _require _ _ . d ( widget _group _namespaceObject , {
2025-12-12 13:15:55 +01:00
yu : ( ) => ( widget _group _block _namespaceObject ) ,
2025-04-25 12:30:07 +02:00
UU : ( ) => ( widget _group _name ) ,
W0 : ( ) => ( widget _group _settings )
2022-06-16 14:03:35 +02:00
} ) ;
2021-07-23 11:58:50 +02:00
2025-04-25 12:30:07 +02:00
; // external ["wp","blocks"]
2024-04-17 11:32:24 +02:00
const external _wp _blocks _namespaceObject = window [ "wp" ] [ "blocks" ] ;
2025-04-25 12:30:07 +02:00
; // external "ReactJSXRuntime"
2025-02-28 08:42:11 +01:00
const external _ReactJSXRuntime _namespaceObject = window [ "ReactJSXRuntime" ] ;
2025-12-12 13:15:55 +01:00
; // external ["wp","primitives"]
const external _wp _primitives _namespaceObject = window [ "wp" ] [ "primitives" ] ;
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/icons/build-module/library/widget.js
2021-07-23 11:58:50 +02:00
2025-02-28 08:42:11 +01:00
2025-12-12 13:15:55 +01:00
var widget _default = /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , { xmlns : "http://www.w3.org/2000/svg" , viewBox : "0 0 24 24" , children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . 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" } ) } ) ;
2021-07-23 11:58:50 +02:00
2025-12-12 13:15:55 +01:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/block.json
const block _namespaceObject = /*#__PURE__*/ JSON . parse ( '{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"core/legacy-widget","title":"Legacy Widget","category":"widgets","description":"Display a legacy widget.","textdomain":"default","attributes":{"id":{"type":"string","default":null},"idBase":{"type":"string","default":null},"instance":{"type":"object","default":null}},"supports":{"html":false,"customClassName":false,"reusable":false},"editorStyle":"wp-block-legacy-widget-editor"}' ) ;
2025-04-25 12:30:07 +02:00
; // ./node_modules/clsx/dist/clsx.mjs
2025-02-28 08:42:11 +01:00
function r ( e ) { var t , f , n = "" ; if ( "string" == typeof e || "number" == typeof e ) n += e ; else if ( "object" == typeof e ) if ( Array . isArray ( e ) ) { var o = e . length ; for ( t = 0 ; t < o ; t ++ ) e [ t ] && ( f = r ( e [ t ] ) ) && ( n && ( n += " " ) , n += f ) } else for ( f in e ) e [ f ] && ( n && ( n += " " ) , n += f ) ; return n } function clsx ( ) { for ( var e , t , f = 0 , n = "" , o = arguments . length ; f < o ; f ++ ) ( e = arguments [ f ] ) && ( t = r ( e ) ) && ( n && ( n += " " ) , n += t ) ; return n } /* harmony default export */ const dist _clsx = ( clsx ) ;
2025-04-25 12:30:07 +02:00
; // external ["wp","blockEditor"]
2024-04-17 11:32:24 +02:00
const external _wp _blockEditor _namespaceObject = window [ "wp" ] [ "blockEditor" ] ;
2025-04-25 12:30:07 +02:00
; // external ["wp","components"]
2024-04-17 11:32:24 +02:00
const external _wp _components _namespaceObject = window [ "wp" ] [ "components" ] ;
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/icons/build-module/library/brush.js
2021-07-23 11:58:50 +02:00
2025-02-28 08:42:11 +01:00
2025-12-12 13:15:55 +01:00
var brush _default = /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , { xmlns : "http://www.w3.org/2000/svg" , viewBox : "0 0 24 24" , children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . 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" } ) } ) ;
2021-07-23 11:58:50 +02:00
2025-04-25 12:30:07 +02:00
; // external ["wp","i18n"]
2024-04-17 11:32:24 +02:00
const external _wp _i18n _namespaceObject = window [ "wp" ] [ "i18n" ] ;
2025-04-25 12:30:07 +02:00
; // external ["wp","element"]
2024-04-17 11:32:24 +02:00
const external _wp _element _namespaceObject = window [ "wp" ] [ "element" ] ;
2025-04-25 12:30:07 +02:00
; // external ["wp","coreData"]
2024-04-17 11:32:24 +02:00
const external _wp _coreData _namespaceObject = window [ "wp" ] [ "coreData" ] ;
2025-04-25 12:30:07 +02:00
; // external ["wp","data"]
const external _wp _data _namespaceObject = window [ "wp" ] [ "data" ] ;
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/widget-type-selector.js
2021-07-23 11:58:50 +02:00
2025-02-28 08:42:11 +01:00
2025-12-12 13:15:55 +01:00
function WidgetTypeSelector ( { selectedId , onSelect } ) {
const widgetTypes = ( 0 , external _wp _data _namespaceObject . useSelect ) ( ( select ) => {
const hiddenIds = select ( external _wp _blockEditor _namespaceObject . store ) . getSettings ( ) ? . widgetTypesToHideFromLegacyWidgetBlock ? ? [ ] ;
return select ( external _wp _coreData _namespaceObject . store ) . getWidgetTypes ( { per _page : - 1 } ) ? . filter ( ( widgetType ) => ! hiddenIds . includes ( widgetType . id ) ) ;
2021-07-23 11:58:50 +02:00
} , [ ] ) ;
if ( ! widgetTypes ) {
2025-12-12 13:15:55 +01:00
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Spinner , { } ) ;
2021-07-23 11:58:50 +02:00
}
if ( widgetTypes . length === 0 ) {
2025-12-12 13:15:55 +01:00
return ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "There are no widgets available." ) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _components _namespaceObject . SelectControl ,
{
_ _next40pxDefaultSize : true ,
_ _nextHasNoMarginBottom : true ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Legacy widget" ) ,
value : selectedId ? ? "" ,
options : [
{ value : "" , label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Select widget" ) } ,
... widgetTypes . map ( ( widgetType ) => ( {
value : widgetType . id ,
label : widgetType . name
} ) )
] ,
onChange : ( value ) => {
if ( value ) {
const selected = widgetTypes . find (
( widgetType ) => widgetType . id === value
) ;
onSelect ( {
selectedId : selected . id ,
isMulti : selected . is _multi
} ) ;
} else {
onSelect ( { selectedId : null } ) ;
}
2021-07-23 11:58:50 +02:00
}
}
2025-12-12 13:15:55 +01:00
) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/inspector-card.js
2025-02-28 08:42:11 +01:00
2025-12-12 13:15:55 +01:00
function InspectorCard ( { name , description } ) {
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "div" , { className : "wp-block-legacy-widget-inspector-card" , children : [
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "h3" , { className : "wp-block-legacy-widget-inspector-card__name" , children : name } ) ,
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "span" , { children : description } )
] } ) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // external ["wp","notices"]
2024-04-17 11:32:24 +02:00
const external _wp _notices _namespaceObject = window [ "wp" ] [ "notices" ] ;
2025-04-25 12:30:07 +02:00
; // external ["wp","compose"]
2024-04-17 11:32:24 +02:00
const external _wp _compose _namespaceObject = window [ "wp" ] [ "compose" ] ;
2025-04-25 12:30:07 +02:00
; // external ["wp","apiFetch"]
2024-04-17 11:32:24 +02:00
const external _wp _apiFetch _namespaceObject = window [ "wp" ] [ "apiFetch" ] ;
2022-06-16 14:03:35 +02:00
var external _wp _apiFetch _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _wp _apiFetch _namespaceObject ) ;
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/control.js
2021-07-23 11:58:50 +02:00
2023-12-07 09:44:11 +01:00
2022-06-16 14:03:35 +02:00
class Control {
2021-07-23 11:58:50 +02:00
/ * *
* Creates and loads a new control .
*
* @ access public
2022-04-02 10:26:41 +02:00
* @ param { Object } params
* @ param { string } params . id
* @ param { string } params . idBase
* @ param { Object } params . instance
2021-07-23 11:58:50 +02:00
* @ param { Function } params . onChangeInstance
* @ param { Function } params . onChangeHasPreview
* @ param { Function } params . onError
* /
2023-09-26 10:33:34 +02:00
constructor ( {
id ,
idBase ,
instance ,
onChangeInstance ,
onChangeHasPreview ,
onError
} ) {
2021-07-23 11:58:50 +02:00
this . id = id ;
this . idBase = idBase ;
this . _instance = instance ;
this . _hasPreview = null ;
this . onChangeInstance = onChangeInstance ;
this . onChangeHasPreview = onChangeHasPreview ;
2023-12-07 09:44:11 +01:00
this . onError = onError ;
2021-07-23 11:58:50 +02:00
this . number = ++ lastNumber ;
2025-12-12 13:15:55 +01:00
this . handleFormChange = ( 0 , external _wp _compose _namespaceObject . debounce ) (
this . handleFormChange . bind ( this ) ,
200
) ;
2021-07-23 11:58:50 +02:00
this . handleFormSubmit = this . handleFormSubmit . bind ( this ) ;
this . initDOM ( ) ;
this . bindEvents ( ) ;
this . loadContent ( ) ;
}
/ * *
2025-04-25 12:30:07 +02:00
* Clean up the control so that it can be garbage collected .
2021-07-23 11:58:50 +02:00
*
* @ access public
* /
destroy ( ) {
this . unbindEvents ( ) ;
2023-12-07 09:44:11 +01:00
this . element . remove ( ) ;
2021-07-23 11:58:50 +02:00
}
/ * *
* Creates the control ' s DOM structure .
*
* @ access private
* /
initDOM ( ) {
2025-12-12 13:15:55 +01:00
this . element = el ( "div" , { class : "widget open" } , [
el ( "div" , { class : "widget-inside" } , [
this . form = el ( "form" , { class : "form" , method : "post" } , [
// These hidden form inputs are what most widgets' scripts
// use to access data about the widget.
el ( "input" , {
class : "widget-id" ,
type : "hidden" ,
name : "widget-id" ,
value : this . id ? ? ` ${ this . idBase } - ${ this . number } `
} ) ,
el ( "input" , {
class : "id_base" ,
type : "hidden" ,
name : "id_base" ,
value : this . idBase ? ? this . id
} ) ,
el ( "input" , {
class : "widget-width" ,
type : "hidden" ,
name : "widget-width" ,
value : "250"
} ) ,
el ( "input" , {
class : "widget-height" ,
type : "hidden" ,
name : "widget-height" ,
value : "200"
} ) ,
el ( "input" , {
class : "widget_number" ,
type : "hidden" ,
name : "widget_number" ,
value : this . idBase ? this . number . toString ( ) : ""
} ) ,
this . content = el ( "div" , { class : "widget-content" } ) ,
// Non-multi widgets can be saved via a Save button.
this . id && el (
"button" ,
{
class : "button is-primary" ,
type : "submit"
} ,
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Save" )
)
] )
] )
] ) ;
2021-07-23 11:58:50 +02:00
}
/ * *
* Adds the control ' s event listeners .
*
* @ access private
* /
bindEvents ( ) {
if ( window . jQuery ) {
2025-12-12 13:15:55 +01:00
const { jQuery : $ } = window ;
$ ( this . form ) . on ( "change" , null , this . handleFormChange ) ;
$ ( this . form ) . on ( "input" , null , this . handleFormChange ) ;
$ ( this . form ) . on ( "submit" , this . handleFormSubmit ) ;
2021-07-23 11:58:50 +02:00
} else {
2025-12-12 13:15:55 +01:00
this . form . addEventListener ( "change" , this . handleFormChange ) ;
this . form . addEventListener ( "input" , this . handleFormChange ) ;
this . form . addEventListener ( "submit" , this . handleFormSubmit ) ;
2021-07-23 11:58:50 +02:00
}
}
/ * *
* Removes the control ' s event listeners .
*
* @ access private
* /
unbindEvents ( ) {
if ( window . jQuery ) {
2025-12-12 13:15:55 +01:00
const { jQuery : $ } = window ;
$ ( this . form ) . off ( "change" , null , this . handleFormChange ) ;
$ ( this . form ) . off ( "input" , null , this . handleFormChange ) ;
$ ( this . form ) . off ( "submit" , this . handleFormSubmit ) ;
2021-07-23 11:58:50 +02:00
} else {
2025-12-12 13:15:55 +01:00
this . form . removeEventListener ( "change" , this . handleFormChange ) ;
this . form . removeEventListener ( "input" , this . handleFormChange ) ;
this . form . removeEventListener ( "submit" , this . handleFormSubmit ) ;
2021-07-23 11:58:50 +02:00
}
}
/ * *
* Fetches the widget ' s form HTML from the REST API and loads it into the
* control ' s form .
*
* @ access private
* /
async loadContent ( ) {
try {
if ( this . id ) {
2025-12-12 13:15:55 +01:00
const { form } = await saveWidget ( this . id ) ;
2021-07-23 11:58:50 +02:00
this . content . innerHTML = form ;
} else if ( this . idBase ) {
2025-12-12 13:15:55 +01:00
const { form , preview } = await encodeWidget ( {
2021-07-23 11:58:50 +02:00
idBase : this . idBase ,
instance : this . instance ,
number : this . number
} ) ;
this . content . innerHTML = form ;
2023-12-07 09:44:11 +01:00
this . hasPreview = ! isEmptyHTML ( preview ) ;
2021-07-23 11:58:50 +02:00
if ( ! this . instance . hash ) {
2025-12-12 13:15:55 +01:00
const { instance } = await encodeWidget ( {
2021-07-23 11:58:50 +02:00
idBase : this . idBase ,
instance : this . instance ,
number : this . number ,
formData : serializeForm ( this . form )
} ) ;
this . instance = instance ;
}
2023-12-07 09:44:11 +01:00
}
2021-07-23 11:58:50 +02:00
if ( window . jQuery ) {
2025-12-12 13:15:55 +01:00
const { jQuery : $ } = window ;
$ ( document ) . trigger ( "widget-added" , [ $ ( this . element ) ] ) ;
2021-07-23 11:58:50 +02:00
}
} catch ( error ) {
this . onError ( error ) ;
}
}
/ * *
* Perform a save when a multi widget ' s form is changed . Non - multi widgets
* are saved manually .
*
* @ access private
* /
handleFormChange ( ) {
if ( this . idBase ) {
this . saveForm ( ) ;
}
}
/ * *
* Perform a save when the control ' s form is manually submitted .
*
* @ access private
* @ param { Event } event
* /
handleFormSubmit ( event ) {
event . preventDefault ( ) ;
this . saveForm ( ) ;
}
/ * *
* Serialize the control ' s form , send it to the REST API , and update the
* instance with the encoded instance that the REST API returns .
*
* @ access private
* /
async saveForm ( ) {
const formData = serializeForm ( this . form ) ;
try {
if ( this . id ) {
2025-12-12 13:15:55 +01:00
const { form } = await saveWidget ( this . id , formData ) ;
2021-07-23 11:58:50 +02:00
this . content . innerHTML = form ;
if ( window . jQuery ) {
2025-12-12 13:15:55 +01:00
const { jQuery : $ } = window ;
$ ( document ) . trigger ( "widget-updated" , [
$ ( this . element )
] ) ;
2021-07-23 11:58:50 +02:00
}
} else if ( this . idBase ) {
2025-12-12 13:15:55 +01:00
const { instance , preview } = await encodeWidget ( {
2021-07-23 11:58:50 +02:00
idBase : this . idBase ,
instance : this . instance ,
number : this . number ,
formData
} ) ;
this . instance = instance ;
this . hasPreview = ! isEmptyHTML ( preview ) ;
}
} catch ( error ) {
this . onError ( error ) ;
}
}
/ * *
* The widget ' s instance object .
*
* @ access private
* /
get instance ( ) {
return this . _instance ;
}
/ * *
* The widget ' s instance object .
*
* @ access private
* /
set instance ( instance ) {
if ( this . _instance !== instance ) {
this . _instance = instance ;
this . onChangeInstance ( instance ) ;
}
}
/ * *
* Whether or not the widget can be previewed .
*
* @ access public
* /
get hasPreview ( ) {
return this . _hasPreview ;
}
/ * *
* Whether or not the widget can be previewed .
*
* @ access private
* /
set hasPreview ( hasPreview ) {
if ( this . _hasPreview !== hasPreview ) {
this . _hasPreview = hasPreview ;
this . onChangeHasPreview ( hasPreview ) ;
}
}
}
let lastNumber = 0 ;
2023-09-26 10:33:34 +02:00
function el ( tagName , attributes = { } , content = null ) {
2021-07-23 11:58:50 +02:00
const element = document . createElement ( tagName ) ;
for ( const [ attribute , value ] of Object . entries ( attributes ) ) {
element . setAttribute ( attribute , value ) ;
}
if ( Array . isArray ( content ) ) {
for ( const child of content ) {
if ( child ) {
element . appendChild ( child ) ;
}
}
2025-12-12 13:15:55 +01:00
} else if ( typeof content === "string" ) {
2021-07-23 11:58:50 +02:00
element . innerText = content ;
}
return element ;
}
2023-09-26 10:33:34 +02:00
async function saveWidget ( id , formData = null ) {
2021-07-23 11:58:50 +02:00
let widget ;
if ( formData ) {
widget = await external _wp _apiFetch _default ( ) ( {
path : ` /wp/v2/widgets/ ${ id } ?context=edit ` ,
2025-12-12 13:15:55 +01:00
method : "PUT" ,
2021-07-23 11:58:50 +02:00
data : {
form _data : formData
}
} ) ;
} else {
widget = await external _wp _apiFetch _default ( ) ( {
path : ` /wp/v2/widgets/ ${ id } ?context=edit ` ,
2025-12-12 13:15:55 +01:00
method : "GET"
2021-07-23 11:58:50 +02:00
} ) ;
}
2025-12-12 13:15:55 +01:00
return { form : widget . rendered _form } ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
async function encodeWidget ( { idBase , instance , number , formData = null } ) {
2021-07-23 11:58:50 +02:00
const response = await external _wp _apiFetch _default ( ) ( {
path : ` /wp/v2/widget-types/ ${ idBase } /encode ` ,
2025-12-12 13:15:55 +01:00
method : "POST" ,
2021-07-23 11:58:50 +02:00
data : {
instance ,
number ,
form _data : formData
}
} ) ;
return {
instance : response . instance ,
form : response . form ,
preview : response . preview
} ;
}
function isEmptyHTML ( html ) {
2025-12-12 13:15:55 +01:00
const element = document . createElement ( "div" ) ;
2021-07-23 11:58:50 +02:00
element . innerHTML = html ;
return isEmptyNode ( element ) ;
}
function isEmptyNode ( node ) {
switch ( node . nodeType ) {
case node . TEXT _NODE :
2025-12-12 13:15:55 +01:00
return node . nodeValue . trim ( ) === "" ;
2021-07-23 11:58:50 +02:00
case node . ELEMENT _NODE :
2025-12-12 13:15:55 +01:00
if ( [
"AUDIO" ,
"CANVAS" ,
"EMBED" ,
"IFRAME" ,
"IMG" ,
"MATH" ,
"OBJECT" ,
"SVG" ,
"VIDEO"
] . includes ( node . tagName ) ) {
2021-07-23 11:58:50 +02:00
return false ;
2023-12-07 09:44:11 +01:00
}
2021-07-23 11:58:50 +02:00
if ( ! node . hasChildNodes ( ) ) {
return true ;
2023-12-07 09:44:11 +01:00
}
2021-07-23 11:58:50 +02:00
return Array . from ( node . childNodes ) . every ( isEmptyNode ) ;
default :
return true ;
}
}
function serializeForm ( form ) {
2025-12-12 13:15:55 +01:00
return new window . URLSearchParams (
Array . from ( new window . FormData ( form ) )
) . toString ( ) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/form.js
2021-07-23 11:58:50 +02:00
2025-02-28 08:42:11 +01:00
2023-09-26 10:33:34 +02:00
function Form ( {
title ,
isVisible ,
id ,
idBase ,
instance ,
isWide ,
onChangeInstance ,
onChangeHasPreview
} ) {
2022-06-16 14:03:35 +02:00
const ref = ( 0 , external _wp _element _namespaceObject . useRef ) ( ) ;
2025-12-12 13:15:55 +01:00
const isMediumLargeViewport = ( 0 , external _wp _compose _namespaceObject . useViewportMatch ) ( "small" ) ;
const outgoingInstances = ( 0 , external _wp _element _namespaceObject . useRef ) ( /* @__PURE__ */ new Set ( ) ) ;
const incomingInstances = ( 0 , external _wp _element _namespaceObject . useRef ) ( /* @__PURE__ */ new Set ( ) ) ;
const { createNotice } = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _notices _namespaceObject . store ) ;
2022-06-16 14:03:35 +02:00
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
2021-07-23 11:58:50 +02:00
if ( incomingInstances . current . has ( instance ) ) {
incomingInstances . current . delete ( instance ) ;
return ;
}
2022-06-16 14:03:35 +02:00
const control = new Control ( {
2021-07-23 11:58:50 +02:00
id ,
idBase ,
instance ,
onChangeInstance ( nextInstance ) {
outgoingInstances . current . add ( instance ) ;
incomingInstances . current . add ( nextInstance ) ;
onChangeInstance ( nextInstance ) ;
} ,
onChangeHasPreview ,
onError ( error ) {
window . console . error ( error ) ;
2025-12-12 13:15:55 +01:00
createNotice (
"error" ,
( 0 , external _wp _i18n _namespaceObject . sprintf ) (
/* translators: %s: the name of the affected block. */
( 0 , external _wp _i18n _namespaceObject . _ _ ) (
'The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.'
) ,
idBase || id
)
) ;
2021-07-23 11:58:50 +02:00
}
} ) ;
ref . current . appendChild ( control . element ) ;
return ( ) => {
if ( outgoingInstances . current . has ( instance ) ) {
outgoingInstances . current . delete ( instance ) ;
return ;
}
control . destroy ( ) ;
} ;
2025-12-12 13:15:55 +01:00
} , [
id ,
idBase ,
instance ,
onChangeInstance ,
onChangeHasPreview ,
isMediumLargeViewport
] ) ;
2021-07-23 11:58:50 +02:00
if ( isWide && isMediumLargeViewport ) {
2025-12-12 13:15:55 +01:00
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) (
"div" ,
{
className : dist _clsx ( {
"wp-block-legacy-widget__container" : isVisible
} ) ,
children : [
isVisible && /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "h3" , { className : "wp-block-legacy-widget__edit-form-title" , children : title } ) ,
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _components _namespaceObject . Popover ,
{
focusOnMount : false ,
placement : "right" ,
offset : 32 ,
resize : false ,
flip : false ,
shift : true ,
children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
"div" ,
{
ref ,
className : "wp-block-legacy-widget__edit-form" ,
hidden : ! isVisible
}
)
}
)
]
}
) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
"div" ,
{
ref ,
className : "wp-block-legacy-widget__edit-form" ,
hidden : ! isVisible ,
children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "h3" , { className : "wp-block-legacy-widget__edit-form-title" , children : title } )
}
) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/preview.js
2023-12-07 09:44:11 +01:00
2021-07-23 11:58:50 +02:00
2025-02-28 08:42:11 +01:00
2025-12-12 13:15:55 +01:00
function Preview ( { idBase , instance , isVisible } ) {
2022-06-16 14:03:35 +02:00
const [ isLoaded , setIsLoaded ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
2025-12-12 13:15:55 +01:00
const [ srcDoc , setSrcDoc ] = ( 0 , external _wp _element _namespaceObject . useState ) ( "" ) ;
2022-06-16 14:03:35 +02:00
( 0 , external _wp _element _namespaceObject . useEffect ) ( ( ) => {
2025-12-12 13:15:55 +01:00
const abortController = typeof window . AbortController === "undefined" ? void 0 : new window . AbortController ( ) ;
2022-04-02 10:26:41 +02:00
async function fetchPreviewHTML ( ) {
const restRoute = ` /wp/v2/widget-types/ ${ idBase } /render ` ;
return await external _wp _apiFetch _default ( ) ( {
path : restRoute ,
2025-12-12 13:15:55 +01:00
method : "POST" ,
2023-09-26 10:33:34 +02:00
signal : abortController ? . signal ,
2025-12-12 13:15:55 +01:00
data : instance ? { instance } : { }
2022-04-02 10:26:41 +02:00
} ) ;
}
2025-12-12 13:15:55 +01:00
fetchPreviewHTML ( ) . then ( ( response ) => {
2022-04-02 10:26:41 +02:00
setSrcDoc ( response . preview ) ;
2025-12-12 13:15:55 +01:00
} ) . catch ( ( error ) => {
if ( "AbortError" === error . name ) {
2022-04-02 10:26:41 +02:00
return ;
}
throw error ;
} ) ;
2023-09-26 10:33:34 +02:00
return ( ) => abortController ? . abort ( ) ;
2023-12-07 09:44:11 +01:00
} , [ idBase , instance ] ) ;
2025-12-12 13:15:55 +01:00
const ref = ( 0 , external _wp _compose _namespaceObject . useRefEffect ) (
( iframe ) => {
if ( ! isLoaded ) {
return ;
2022-04-02 10:26:41 +02:00
}
2025-12-12 13:15:55 +01:00
function setHeight ( ) {
const height = Math . max (
iframe . contentDocument . documentElement ? . offsetHeight ? ? 0 ,
iframe . contentDocument . body ? . offsetHeight ? ? 0
) ;
iframe . style . height = ` ${ height !== 0 ? height : 100 } px ` ;
}
const { IntersectionObserver } = iframe . ownerDocument . defaultView ;
const intersectionObserver = new IntersectionObserver (
( [ entry ] ) => {
if ( entry . isIntersecting ) {
setHeight ( ) ;
}
} ,
{
threshold : 1
}
) ;
intersectionObserver . observe ( iframe ) ;
iframe . addEventListener ( "load" , setHeight ) ;
return ( ) => {
intersectionObserver . disconnect ( ) ;
iframe . removeEventListener ( "load" , setHeight ) ;
} ;
} ,
[ isLoaded ]
) ;
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , { children : [
isVisible && ! isLoaded && /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Placeholder , { children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Spinner , { } ) } ) ,
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
"div" ,
{
className : dist _clsx ( "wp-block-legacy-widget__edit-preview" , {
"is-offscreen" : ! isVisible || ! isLoaded
} ) ,
children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Disabled , { children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
"iframe" ,
{
ref ,
className : "wp-block-legacy-widget__edit-preview-iframe" ,
tabIndex : "-1" ,
title : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Legacy Widget Preview" ) ,
srcDoc ,
onLoad : ( event ) => {
event . target . contentDocument . body . style . overflow = "hidden" ;
setIsLoaded ( true ) ;
} ,
height : 100
}
) } )
}
)
] } ) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/no-preview.js
2021-07-23 11:58:50 +02:00
2025-02-28 08:42:11 +01:00
2025-12-12 13:15:55 +01:00
function NoPreview ( { name } ) {
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( "div" , { className : "wp-block-legacy-widget__edit-no-preview" , children : [
name && /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "h3" , { children : name } ) ,
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "p" , { children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "No preview available." ) } )
] } ) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js
2021-07-23 11:58:50 +02:00
2025-02-28 08:42:11 +01:00
2025-12-12 13:15:55 +01:00
function ConvertToBlocksButton ( { clientId , rawInstance } ) {
const { replaceBlocks } = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _blockEditor _namespaceObject . store ) ;
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _components _namespaceObject . ToolbarButton ,
{
onClick : ( ) => {
if ( rawInstance . title ) {
replaceBlocks ( clientId , [
( 0 , external _wp _blocks _namespaceObject . createBlock ) ( "core/heading" , {
content : rawInstance . title
} ) ,
... ( 0 , external _wp _blocks _namespaceObject . rawHandler ) ( { HTML : rawInstance . text } )
] ) ;
} else {
replaceBlocks (
clientId ,
( 0 , external _wp _blocks _namespaceObject . rawHandler ) ( { HTML : rawInstance . text } )
) ;
}
} ,
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Convert to blocks" )
}
) ;
2021-07-23 11:58:50 +02:00
}
2023-12-07 09:44:11 +01:00
2025-12-12 13:15:55 +01:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/index.js
2021-07-23 11:58:50 +02:00
2025-02-28 08:42:11 +01:00
2021-07-23 11:58:50 +02:00
function Edit ( props ) {
2025-12-12 13:15:55 +01:00
const { id , idBase } = props . attributes ;
const { isWide = false } = props ;
2022-06-16 14:03:35 +02:00
const blockProps = ( 0 , external _wp _blockEditor _namespaceObject . useBlockProps ) ( {
2025-02-28 08:42:11 +01:00
className : dist _clsx ( {
2025-12-12 13:15:55 +01:00
"is-wide-widget" : isWide
2025-02-28 08:42:11 +01:00
} )
} ) ;
2025-12-12 13:15:55 +01:00
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "div" , { ... blockProps , children : ! id && ! idBase ? /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( Empty , { ... props } ) : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( NotEmpty , { ... props } ) } ) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
function Empty ( { attributes : { id , idBase } , setAttributes } ) {
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _components _namespaceObject . Placeholder ,
{
icon : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . BlockIcon , { icon : brush _default } ) ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Legacy Widget" ) ,
children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Flex , { children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . FlexBlock , { children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
WidgetTypeSelector ,
{
selectedId : id ? ? idBase ,
onSelect : ( { selectedId , isMulti } ) => {
2025-02-28 08:42:11 +01:00
if ( ! selectedId ) {
setAttributes ( {
id : null ,
idBase : null ,
instance : null
} ) ;
} else if ( isMulti ) {
setAttributes ( {
id : null ,
idBase : selectedId ,
instance : { }
} ) ;
} else {
setAttributes ( {
id : selectedId ,
idBase : null ,
instance : null
} ) ;
}
}
2025-12-12 13:15:55 +01:00
}
) } ) } )
}
) ;
2021-07-23 11:58:50 +02:00
}
2023-09-26 10:33:34 +02:00
function NotEmpty ( {
2025-12-12 13:15:55 +01:00
attributes : { id , idBase , instance } ,
2023-09-26 10:33:34 +02:00
setAttributes ,
clientId ,
isSelected ,
isWide = false
} ) {
2022-06-16 14:03:35 +02:00
const [ hasPreview , setHasPreview ] = ( 0 , external _wp _element _namespaceObject . useState ) ( null ) ;
2025-12-12 13:15:55 +01:00
const widgetTypeId = id ? ? idBase ;
const { record : widgetType , hasResolved : hasResolvedWidgetType } = ( 0 , external _wp _coreData _namespaceObject . useEntityRecord ) ( "root" , "widgetType" , widgetTypeId ) ;
const setInstance = ( 0 , external _wp _element _namespaceObject . useCallback ) ( ( nextInstance ) => {
setAttributes ( { instance : nextInstance } ) ;
2021-07-23 11:58:50 +02:00
} , [ ] ) ;
if ( ! widgetType && hasResolvedWidgetType ) {
2025-12-12 13:15:55 +01:00
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _components _namespaceObject . Placeholder ,
{
icon : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . BlockIcon , { icon : brush _default } ) ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Legacy Widget" ) ,
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Widget is missing." )
}
) ;
2021-07-23 11:58:50 +02:00
}
if ( ! hasResolvedWidgetType ) {
2025-12-12 13:15:55 +01:00
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Placeholder , { children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Spinner , { } ) } ) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
const mode = idBase && ! isSelected ? "preview" : "edit" ;
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , { children : [
idBase === "text" && /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . BlockControls , { group : "other" , children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
ConvertToBlocksButton ,
{
clientId ,
2025-02-28 08:42:11 +01:00
rawInstance : instance . raw
2025-12-12 13:15:55 +01:00
}
) } ) ,
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . InspectorControls , { children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
InspectorCard ,
{
2025-02-28 08:42:11 +01:00
name : widgetType . name ,
description : widgetType . description
2025-12-12 13:15:55 +01:00
}
) } ) ,
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
Form ,
{
title : widgetType . name ,
isVisible : mode === "edit" ,
id ,
idBase ,
instance ,
isWide ,
onChangeInstance : setInstance ,
onChangeHasPreview : setHasPreview
}
) ,
idBase && /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , { children : [
hasPreview === null && mode === "preview" && /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Placeholder , { children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Spinner , { } ) } ) ,
hasPreview === true && /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
Preview ,
{
idBase ,
instance ,
isVisible : mode === "preview"
}
) ,
hasPreview === false && mode === "preview" && /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( NoPreview , { name : widgetType . name } )
] } )
] } ) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/transforms.js
2025-12-12 13:15:55 +01:00
const legacyWidgetTransforms = [
{
block : "core/calendar" ,
widget : "calendar"
} ,
{
block : "core/search" ,
widget : "search"
} ,
{
block : "core/html" ,
widget : "custom_html" ,
transform : ( { content } ) => ( {
content
} )
} ,
{
block : "core/archives" ,
widget : "archives" ,
transform : ( { count , dropdown } ) => {
return {
displayAsDropdown : ! ! dropdown ,
showPostCounts : ! ! count
} ;
}
} ,
{
block : "core/latest-posts" ,
widget : "recent-posts" ,
transform : ( { show _date : displayPostDate , number } ) => {
return {
displayPostDate : ! ! displayPostDate ,
postsToShow : number
} ;
}
} ,
{
block : "core/latest-comments" ,
widget : "recent-comments" ,
transform : ( { number } ) => {
return {
commentsToShow : number
} ;
}
} ,
{
block : "core/tag-cloud" ,
widget : "tag_cloud" ,
transform : ( { taxonomy , count } ) => {
return {
showTagCounts : ! ! count ,
taxonomy
} ;
}
} ,
{
block : "core/categories" ,
widget : "categories" ,
transform : ( { count , dropdown , hierarchical } ) => {
return {
displayAsDropdown : ! ! dropdown ,
showPostCounts : ! ! count ,
showHierarchy : ! ! hierarchical
} ;
}
} ,
{
block : "core/audio" ,
widget : "media_audio" ,
transform : ( { url , preload , loop , attachment _id : id } ) => {
return {
src : url ,
id ,
preload ,
loop
} ;
}
} ,
{
block : "core/video" ,
widget : "media_video" ,
transform : ( { url , preload , loop , attachment _id : id } ) => {
return {
src : url ,
id ,
preload ,
loop
} ;
}
} ,
{
block : "core/image" ,
widget : "media_image" ,
transform : ( {
2021-07-23 11:58:50 +02:00
alt ,
2025-12-12 13:15:55 +01:00
attachment _id : id ,
2021-07-23 11:58:50 +02:00
caption ,
height ,
2025-12-12 13:15:55 +01:00
link _classes : linkClass ,
link _rel : rel ,
link _target _blank : targetBlack ,
link _type : linkDestination ,
link _url : link ,
size : sizeSlug ,
2021-07-23 11:58:50 +02:00
url ,
width
2025-12-12 13:15:55 +01:00
} ) => {
return {
alt ,
caption ,
height ,
id ,
link ,
linkClass ,
linkDestination ,
linkTarget : targetBlack ? "_blank" : void 0 ,
rel ,
sizeSlug ,
url ,
width
} ;
}
} ,
{
block : "core/gallery" ,
widget : "media_gallery" ,
transform : ( { ids , link _type : linkTo , size , number } ) => {
return {
ids ,
columns : number ,
linkTo ,
sizeSlug : size ,
images : ids . map ( ( id ) => ( {
id
} ) )
} ;
}
} ,
{
block : "core/rss" ,
widget : "rss" ,
transform : ( {
url ,
show _author : displayAuthor ,
show _date : displayDate ,
show _summary : displayExcerpt ,
items
} ) => {
return {
feedURL : url ,
displayAuthor : ! ! displayAuthor ,
displayDate : ! ! displayDate ,
displayExcerpt : ! ! displayExcerpt ,
itemsToShow : items
} ;
}
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
] . map ( ( { block , widget , transform } ) => {
2021-07-23 11:58:50 +02:00
return {
2025-12-12 13:15:55 +01:00
type : "block" ,
2021-07-23 11:58:50 +02:00
blocks : [ block ] ,
2025-12-12 13:15:55 +01:00
isMatch : ( { idBase , instance } ) => {
2023-09-26 10:33:34 +02:00
return idBase === widget && ! ! instance ? . raw ;
2021-07-23 11:58:50 +02:00
} ,
2025-12-12 13:15:55 +01:00
transform : ( { instance } ) => {
const transformedBlock = ( 0 , external _wp _blocks _namespaceObject . createBlock ) (
block ,
transform ? transform ( instance . raw ) : void 0
) ;
2023-09-26 10:33:34 +02:00
if ( ! instance . raw ? . title ) {
2021-07-23 11:58:50 +02:00
return transformedBlock ;
}
2025-12-12 13:15:55 +01:00
return [
( 0 , external _wp _blocks _namespaceObject . createBlock ) ( "core/heading" , {
content : instance . raw . title
} ) ,
transformedBlock
] ;
2021-07-23 11:58:50 +02:00
}
} ;
} ) ;
const transforms = {
to : legacyWidgetTransforms
} ;
2025-12-12 13:15:55 +01:00
var transforms _default = transforms ;
2021-07-23 11:58:50 +02:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/index.js
2021-07-23 11:58:50 +02:00
2025-12-12 13:15:55 +01:00
const { name : legacy _widget _name } = block _namespaceObject ;
2022-06-16 14:03:35 +02:00
const settings = {
2025-12-12 13:15:55 +01:00
icon : widget _default ,
2021-07-23 11:58:50 +02:00
edit : Edit ,
2025-12-12 13:15:55 +01:00
transforms : transforms _default
2021-07-23 11:58:50 +02:00
} ;
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/icons/build-module/library/group.js
2022-06-16 14:03:35 +02:00
2025-02-28 08:42:11 +01:00
2025-12-12 13:15:55 +01:00
var group _default = /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , { viewBox : "0 0 24 24" , xmlns : "http://www.w3.org/2000/svg" , children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , { d : "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" } ) } ) ;
2022-06-16 14:03:35 +02:00
2025-12-12 13:15:55 +01:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/block.json
const widget _group _block _namespaceObject = /*#__PURE__*/ JSON . parse ( '{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"core/widget-group","title":"Widget Group","category":"widgets","attributes":{"title":{"type":"string"}},"supports":{"html":false,"inserter":true,"customClassName":true,"reusable":false},"editorStyle":"wp-block-widget-group-editor","style":"wp-block-widget-group"}' ) ;
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/edit.js
2022-04-02 10:26:41 +02:00
2025-02-28 08:42:11 +01:00
2022-04-02 10:26:41 +02:00
function edit _Edit ( props ) {
2025-12-12 13:15:55 +01:00
const { clientId } = props ;
const { innerBlocks } = ( 0 , external _wp _data _namespaceObject . useSelect ) (
( select ) => select ( external _wp _blockEditor _namespaceObject . store ) . getBlock ( clientId ) ,
[ clientId ]
) ;
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "div" , { ... ( 0 , external _wp _blockEditor _namespaceObject . useBlockProps ) ( { className : "widget" } ) , children : innerBlocks . length === 0 ? /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( PlaceholderContent , { ... props } ) : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( PreviewContent , { ... props } ) } ) ;
2022-04-02 10:26:41 +02:00
}
2025-12-12 13:15:55 +01:00
function PlaceholderContent ( { clientId } ) {
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , { children : [
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _components _namespaceObject . Placeholder ,
{
className : "wp-block-widget-group__placeholder" ,
icon : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . BlockIcon , { icon : group _default } ) ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Widget Group" ) ,
children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . ButtonBlockAppender , { rootClientId : clientId } )
}
) ,
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . InnerBlocks , { renderAppender : false } )
] } ) ;
2022-04-02 10:26:41 +02:00
}
2025-12-12 13:15:55 +01:00
function PreviewContent ( { attributes , setAttributes } ) {
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , { children : [
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _blockEditor _namespaceObject . RichText ,
{
tagName : "h2" ,
identifier : "title" ,
className : "widget-title" ,
allowedFormats : [ ] ,
placeholder : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Title" ) ,
value : attributes . title ? ? "" ,
onChange : ( title ) => setAttributes ( { title } )
}
) ,
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . InnerBlocks , { } )
] } ) ;
2022-04-02 10:26:41 +02:00
}
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/save.js
2022-04-02 10:26:41 +02:00
2025-02-28 08:42:11 +01:00
2025-12-12 13:15:55 +01:00
function save ( { attributes } ) {
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , { children : [
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _blockEditor _namespaceObject . RichText . Content ,
{
tagName : "h2" ,
className : "widget-title" ,
value : attributes . title
}
) ,
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "div" , { className : "wp-widget-group__inner-blocks" , children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . InnerBlocks . Content , { } ) } )
] } ) ;
2022-04-02 10:26:41 +02:00
}
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/deprecated.js
2022-06-16 14:03:35 +02:00
2025-02-28 08:42:11 +01:00
2022-06-16 14:03:35 +02:00
const v1 = {
attributes : {
title : {
2025-12-12 13:15:55 +01:00
type : "string"
2022-06-16 14:03:35 +02:00
}
} ,
supports : {
html : false ,
inserter : true ,
customClassName : true ,
reusable : false
} ,
2025-12-12 13:15:55 +01:00
save ( { attributes } ) {
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , { children : [
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _blockEditor _namespaceObject . RichText . Content ,
{
tagName : "h2" ,
className : "widget-title" ,
value : attributes . title
}
) ,
/* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . InnerBlocks . Content , { } )
] } ) ;
2022-06-16 14:03:35 +02:00
}
} ;
2025-12-12 13:15:55 +01:00
var deprecated _default = [ v1 ] ;
2022-06-16 14:03:35 +02:00
2022-04-02 10:26:41 +02:00
2025-12-12 13:15:55 +01:00
; // ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/index.js
2022-04-02 10:26:41 +02:00
2023-12-07 09:44:11 +01:00
2022-04-02 10:26:41 +02:00
2022-06-16 14:03:35 +02:00
2022-04-02 10:26:41 +02:00
2025-12-12 13:15:55 +01:00
const { name : widget _group _name } = widget _group _block _namespaceObject ;
2022-04-02 10:26:41 +02:00
const widget _group _settings = {
2025-12-12 13:15:55 +01:00
title : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Widget Group" ) ,
description : ( 0 , external _wp _i18n _namespaceObject . _ _ ) (
"Create a classic widget layout with a title that\u2019s styled by your theme for your widget areas."
) ,
icon : group _default ,
_ _experimentalLabel : ( { name : label } ) => label ,
2022-04-02 10:26:41 +02:00
edit : edit _Edit ,
save : save ,
transforms : {
2025-12-12 13:15:55 +01:00
from : [
{
type : "block" ,
isMultiBlock : true ,
blocks : [ "*" ] ,
isMatch ( attributes , blocks ) {
return ! blocks . some (
( block ) => block . name === "core/widget-group"
) ;
} ,
_ _experimentalConvert ( blocks ) {
let innerBlocks = [
... blocks . map ( ( block ) => {
return ( 0 , external _wp _blocks _namespaceObject . createBlock ) (
block . name ,
block . attributes ,
block . innerBlocks
) ;
} )
] ;
const firstHeadingBlock = innerBlocks [ 0 ] . name === "core/heading" ? innerBlocks [ 0 ] : null ;
innerBlocks = innerBlocks . filter (
( block ) => block !== firstHeadingBlock
) ;
return ( 0 , external _wp _blocks _namespaceObject . createBlock ) (
"core/widget-group" ,
{
... firstHeadingBlock && {
title : firstHeadingBlock . attributes . content
}
} ,
innerBlocks
) ;
}
2022-04-02 10:26:41 +02:00
}
2025-12-12 13:15:55 +01:00
]
2022-06-16 14:03:35 +02:00
} ,
2025-12-12 13:15:55 +01:00
deprecated : deprecated _default
2022-04-02 10:26:41 +02:00
} ;
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/icons/build-module/library/move-to.js
2021-07-23 11:58:50 +02:00
2025-02-28 08:42:11 +01:00
2025-12-12 13:15:55 +01:00
var move _to _default = /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , { xmlns : "http://www.w3.org/2000/svg" , viewBox : "0 0 24 24" , children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , { d : "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z" } ) } ) ;
2021-07-23 11:58:50 +02:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/components/move-to-widget-area/index.js
2021-07-23 11:58:50 +02:00
2025-02-28 08:42:11 +01:00
2023-09-26 10:33:34 +02:00
function MoveToWidgetArea ( {
currentWidgetAreaId ,
widgetAreas ,
onSelect
} ) {
2025-12-12 13:15:55 +01:00
return /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . ToolbarGroup , { children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . ToolbarItem , { children : ( toggleProps ) => /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _components _namespaceObject . DropdownMenu ,
{
icon : move _to _default ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Move to widget area" ) ,
toggleProps ,
children : ( { onClose } ) => /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . MenuGroup , { label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( "Move to" ) , children : /* @__PURE__ */ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) (
external _wp _components _namespaceObject . MenuItemsChoice ,
{
choices : widgetAreas . map (
( widgetArea ) => ( {
2025-02-28 08:42:11 +01:00
value : widgetArea . id ,
label : widgetArea . name ,
info : widgetArea . description
2025-12-12 13:15:55 +01:00
} )
) ,
value : currentWidgetAreaId ,
onSelect : ( value ) => {
onSelect ( value ) ;
onClose ( ) ;
}
}
) } )
}
) } ) } ) ;
2021-07-23 11:58:50 +02:00
}
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/components/index.js
2021-07-23 11:58:50 +02:00
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/utils.js
2021-07-23 11:58:50 +02:00
function getWidgetIdFromBlock ( block ) {
return block . attributes . _ _internalWidgetId ;
}
function addWidgetIdToBlock ( block , widgetId ) {
2023-12-07 09:44:11 +01:00
return {
... block ,
attributes : {
2025-12-12 13:15:55 +01:00
... block . attributes || { } ,
2021-07-23 11:58:50 +02:00
_ _internalWidgetId : widgetId
}
} ;
}
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
; // ./node_modules/@wordpress/widgets/build-module/register-legacy-widget-variations.js
2021-07-23 11:58:50 +02:00
function registerLegacyWidgetVariations ( settings ) {
2022-06-16 14:03:35 +02:00
const unsubscribe = ( 0 , external _wp _data _namespaceObject . subscribe ) ( ( ) => {
2025-12-12 13:15:55 +01:00
const hiddenIds = settings ? . widgetTypesToHideFromLegacyWidgetBlock ? ? [ ] ;
const widgetTypes = ( 0 , external _wp _data _namespaceObject . select ) ( external _wp _coreData _namespaceObject . store ) . getWidgetTypes ( { per _page : - 1 } ) ? . filter ( ( widgetType ) => ! hiddenIds . includes ( widgetType . id ) ) ;
2021-07-23 11:58:50 +02:00
if ( widgetTypes ) {
unsubscribe ( ) ;
2025-12-12 13:15:55 +01:00
( 0 , external _wp _data _namespaceObject . dispatch ) ( external _wp _blocks _namespaceObject . store ) . addBlockVariations (
"core/legacy-widget" ,
widgetTypes . map ( ( widgetType ) => ( {
name : widgetType . id ,
title : widgetType . name ,
description : widgetType . description ,
attributes : widgetType . is _multi ? {
idBase : widgetType . id ,
instance : { }
} : {
id : widgetType . id
}
} ) )
) ;
2021-07-23 11:58:50 +02:00
}
} ) ;
}
2023-12-07 09:44:11 +01:00
2025-12-12 13:15:55 +01:00
; // ./node_modules/@wordpress/widgets/build-module/index.js
2021-07-23 11:58:50 +02:00
2022-04-02 10:26:41 +02:00
2023-09-26 10:33:34 +02:00
function registerLegacyWidgetBlock ( supports = { } ) {
2025-12-12 13:15:55 +01:00
const { /* metadata */ "yu" : metadata , /* settings */ "W0" : settings , /* name */ "UU" : name } = legacy _widget _namespaceObject ;
( 0 , external _wp _blocks _namespaceObject . registerBlockType ) (
{ name , ... metadata } ,
{
... settings ,
supports : {
... settings . supports ,
... supports
}
2023-04-26 17:39:43 +02:00
}
2025-12-12 13:15:55 +01:00
) ;
2021-07-23 11:58:50 +02:00
}
2023-09-26 10:33:34 +02:00
function registerWidgetGroupBlock ( supports = { } ) {
2025-12-12 13:15:55 +01:00
const { /* metadata */ "yu" : metadata , /* settings */ "W0" : settings , /* name */ "UU" : name } = widget _group _namespaceObject ;
( 0 , external _wp _blocks _namespaceObject . registerBlockType ) (
{ name , ... metadata } ,
{
... settings ,
supports : {
... settings . supports ,
... supports
}
2023-04-26 17:39:43 +02:00
}
2025-12-12 13:15:55 +01:00
) ;
2022-04-02 10:26:41 +02:00
}
2021-07-23 11:58:50 +02:00
2025-12-12 13:15:55 +01:00
2022-06-16 14:03:35 +02:00
( window . wp = window . wp || { } ) . widgets = _ _webpack _exports _ _ ;
/******/ } ) ( )
;