(()=>{"use strict";const e={n:a=>{const o=a&&a.__esModule?()=>a.default:()=>a;return e.d(o,{a:o}),o},d:(a,o)=>{if(Array.isArray(o))for(var t=0;t<o.length;){var n=o[t++],l=o[t++];e.o(a,n)?0===l&&t++:0===l?Object.defineProperty(a,n,{enumerable:!0,value:o[t++]}):Object.defineProperty(a,n,{enumerable:!0,get:l})}else for(var n in o)e.o(o,n)&&!e.o(a,n)&&Object.defineProperty(a,n,{enumerable:!0,get:o[n]})},o:(e,a)=>Object.hasOwn(e,a)},a=window.wp.blocks,o=window.wp.primitives,t=window.ReactJSXRuntime;var n=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z"})});const l=window.wp.serverSideRender;var r=e.n(l);const i=window.wp.components,s=window.wp.blockEditor,c=window.wp.element,d=window.wp.hooks,p=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"aiopod/categories","version":"1.0.0","title":"AIOPOD - Categories","category":"aio-podcast-studio","keywords":["podcast","episode","categories","aio-podcast-studio","aiopod"],"description":"Display a list of your podcast categories.","textdomain":"aio-podcast-studio","editorScript":"file:./index.js"}');function h(e){var a="string";return"categories"==e||"tags"==e||"participants"==e?a="array":"number"==e?a="number":"checkbox"==e&&(a="boolean"),a}(0,a.registerBlockType)(p,{attributes:function(e){var a={};for(var o in e){var t=e[o].fields;for(var n in t)a[t[n].name]={type:h(t[n].type),default:t[n].value}}return a}(aiopod_blocks.categories),icon:n,edit:function({attributes:e,setAttributes:a}){const o=aiopod_blocks.categories,n=e=>o=>{a({[e]:o})},l=(0,c.useRef)();return(0,c.useEffect)(()=>{l.current?(0,d.applyFilters)("aiopod_block_init",e):l.current=!0}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.InspectorControls,{children:Object.keys(o).map((l,r)=>{return c=l,(0,d.applyFilters)("aiopod_block_toggle_panels",!0,c,e)&&(0,t.jsx)(i.PanelBody,{title:o[l].title,initialOpen:0==r,className:"aiopod-block-panel",children:Object.keys(o[l].fields).map((r,c)=>((o,l)=>{if(!(a=>{let o=!0;switch(a){case"columns":case"show_name":case"show_description":case"pagination":"list"!=e.layout&&"dropdown"!=e.layout||(o=!1);break;case"hierarchical":"grid"==e.layout&&(o=!1)}return(0,d.applyFilters)("aiopod_block_toggle_controls",o,a,e)})(o.name))return"";const r=o.placeholder?o.placeholder:"",c=o.description?o.description:"";switch(o.type){case"header":return(0,t.jsx)(i.PanelRow,{children:(0,t.jsx)("h3",{className:"aiopod-no-margin",children:o.label})},l);case"number":return(0,t.jsx)(i.PanelRow,{children:(0,t.jsx)(i.RangeControl,{label:o.label,help:c,placeholder:r,value:e[o.name],min:o.min,max:o.max,onChange:n(o.name),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})},l);case"textarea":return(0,t.jsx)(i.PanelRow,{children:(0,t.jsx)(i.TextareaControl,{label:o.label,help:c,placeholder:r,value:e[o.name],onChange:n(o.name),__nextHasNoMarginBottom:!0})},l);case"select":case"radio":let d=[];for(let e in o.options)d.push({label:o.options[e],value:e});return(0,t.jsx)(i.PanelRow,{children:(0,t.jsx)(i.SelectControl,{label:o.label,help:c,options:d,value:e[o.name],onChange:n(o.name),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})},l);case"checkbox":return(0,t.jsx)(i.PanelRow,{children:(0,t.jsx)(i.ToggleControl,{label:o.label,help:c,checked:e[o.name],onChange:(p=o.name,e=>{a({[p]:e})}),__nextHasNoMarginBottom:!0})},l);case"color":return(0,t.jsx)(i.PanelRow,{children:(0,t.jsx)(s.PanelColorSettings,{title:o.label,colorSettings:[{label:aiopod_blocks.i18n.select_color,value:e[o.name],onChange:n(o.name)}]})},l);default:return(0,t.jsx)(i.PanelRow,{children:(0,t.jsx)(i.TextControl,{label:o.label,help:c,placeholder:r,value:e[o.name],onChange:n(o.name),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})},l)}var p})(o[l].fields[r],"aiopod-block-control-"+c))},"aiopod-block-panel-"+r);var c})}),(0,t.jsx)("div",{...(0,s.useBlockProps)(),children:(0,t.jsx)(i.Disabled,{children:(0,t.jsx)(r(),{block:"aiopod/categories",attributes:e})})})]})}})})();