(()=>{"use strict";const e=window.wp.hooks,l=window.wp.blockEditor,o=window.wp.components,t=window.wp.i18n,n=window.wp.compose,a=window.ReactJSXRuntime,s=(0,n.createHigherOrderComponent)(e=>n=>{const{name:s,attributes:i,setAttributes:r}=n;console.log("[GTS HOC] withInspectorControls called for:",s),console.log("[GTS HOC] Props:",n);const c=(e=>{const l=wp.blocks.getBlockType(e);return console.log("[GTS HOC] Checking block:",e),console.log("[GTS HOC] Block settings:",l),console.log("[GTS HOC] Supports:",l?.supports),console.log("[GTS HOC] gtsInspectorControls:",l?.supports?.gtsInspectorControls),l?.supports?.gtsInspectorControls?(console.log("[GTS HOC] Block opted in! Config:",l.supports.gtsInspectorControls),l.supports.gtsInspectorControls):(console.log("[GTS HOC] Block did not opt-in, skipping"),null)})(s);if(!c)return console.log("[GTS HOC] No config, returning original BlockEdit"),(0,a.jsx)(e,{...n});console.log("[GTS HOC] Config found! Will add controls"),console.log("[GTS HOC] Gap support:",c.gap);const p=i.style||{},g=p.spacing||{},d=g.blockGap||"",u=p.display||"",b=g.padding||{},C=(e,l)=>{const o={...b,[e]:l>0?`${l}px`:void 0};Object.keys(o).forEach(e=>{o[e]||delete o[e]});const t={...p,spacing:{...g,padding:Object.keys(o).length>0?o:void 0}};t.spacing.padding||delete t.spacing.padding,0===Object.keys(t.spacing||{}).length&&delete t.spacing,r({style:Object.keys(t).length>0?t:void 0})},w=e=>{if(!e)return 0;const l=e.match(/^(\d+)px$/);return l?parseInt(l[1],10):0},y=(e=>{if(!e)return 0;const l=e.match(/^(\d+)px$/);return l?parseInt(l[1],10):0})(d),h=w(b.top),x=w(b.right),k=w(b.bottom),v=w(b.left);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(e,{...n}),c.gap&&(0,a.jsx)(l.InspectorControls,{children:(0,a.jsxs)(o.PanelBody,{title:(0,t.__)("GTS Layout Controls","gateway"),initialOpen:!1,children:[(0,a.jsx)(o.RangeControl,{label:(0,t.__)("Gap","gateway"),help:(0,t.__)("Set the gap between child elements (CSS gap property)","gateway"),value:y,onChange:e=>{return(e=>{const l={...p,spacing:{...g,blockGap:e}};l.spacing.blockGap||delete l.spacing.blockGap,0===Object.keys(l.spacing||{}).length&&delete l.spacing,r({style:Object.keys(l).length>0?l:void 0})})((l=e)>0?`${l}px`:"");var l},min:0,max:100,step:1,allowReset:!0,resetFallbackValue:0}),y>0&&(0,a.jsxs)("div",{style:{marginTop:"8px",fontSize:"12px",color:"#757575"},children:[(0,t.__)("Current value:","gateway")," ",(0,a.jsx)("code",{children:d})]})]})}),c.display&&(0,a.jsx)(l.InspectorControls,{children:(0,a.jsxs)(o.PanelBody,{title:(0,t.__)("GTS Display Controls","gateway"),initialOpen:!1,children:[(0,a.jsx)(o.SelectControl,{label:(0,t.__)("Display","gateway"),help:(0,t.__)("Set the CSS display property","gateway"),value:u,onChange:e=>{const l={...p,display:e};l.display||delete l.display,r({style:Object.keys(l).length>0?l:void 0})},options:[{label:(0,t.__)("Default","gateway"),value:""},{label:"block",value:"block"},{label:"inline",value:"inline"},{label:"inline-block",value:"inline-block"},{label:"flex",value:"flex"},{label:"inline-flex",value:"inline-flex"},{label:"grid",value:"grid"},{label:"inline-grid",value:"inline-grid"},{label:"flow-root",value:"flow-root"},{label:"none",value:"none"},{label:"contents",value:"contents"},{label:"table",value:"table"},{label:"table-row",value:"table-row"},{label:"table-cell",value:"table-cell"}]}),u&&(0,a.jsxs)("div",{style:{marginTop:"8px",fontSize:"12px",color:"#757575"},children:[(0,t.__)("Current value:","gateway")," ",(0,a.jsx)("code",{children:u})]})]})}),c.padding&&(0,a.jsx)(l.InspectorControls,{children:(0,a.jsxs)(o.PanelBody,{title:(0,t.__)("GTS Padding Controls","gateway"),initialOpen:!1,children:[(0,a.jsx)(o.RangeControl,{label:(0,t.__)("Padding Top","gateway"),value:h,onChange:e=>C("top",e),min:0,max:200,step:1,allowReset:!0,resetFallbackValue:0}),(0,a.jsx)(o.RangeControl,{label:(0,t.__)("Padding Right","gateway"),value:x,onChange:e=>C("right",e),min:0,max:200,step:1,allowReset:!0,resetFallbackValue:0}),(0,a.jsx)(o.RangeControl,{label:(0,t.__)("Padding Bottom","gateway"),value:k,onChange:e=>C("bottom",e),min:0,max:200,step:1,allowReset:!0,resetFallbackValue:0}),(0,a.jsx)(o.RangeControl,{label:(0,t.__)("Padding Left","gateway"),value:v,onChange:e=>C("left",e),min:0,max:200,step:1,allowReset:!0,resetFallbackValue:0})]})})]})},"withInspectorControls");console.log("[GTS HOC] Registering inspector controls HOC"),console.log("[GTS HOC] withInspectorControls:",s),(0,e.addFilter)("editor.BlockEdit","gateway/with-inspector-controls",s,10),console.log("[GTS HOC] Filter registered successfully")})();