(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[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,{blockMetadataAttribute:()=>k});const o=window.React,n=window.wp.hooks,a=window.wp.blocks,c=window.lodash,r=window.wp.components,i=window.kadence.helpers,l=window.wp.compose,d=window.wp.i18n,s=window.wp.element,p=window.wp.data;function k(e){if((0,a.hasBlockSupport)(e,"kbMetadata")){e.attributes=(0,c.assign)(e.attributes,{metadata:{type:"object",default:{name:""}}});const t=(0,a.getBlockSupport)(e,"kbContentLabel");e.__experimentalLabel=(o,{context:n})=>{const{metadata:a}=o;return"list-view"===n&&""!==(0,c.get)(a,"name","")?a.name:"list-view"===n&&void 0!==t&&""!==(0,c.get)(o,t)?"kadence/pane"===(0,c.get)(e,"name")&&(0,c.get)(o,t)instanceof Array?b((0,c.get)(o,t)):(0,c.get)(o,t):void 0}}return e}function b(e){let t="";return e.forEach((e=>{"string"==typeof e?t+=e:e.props&&e.props.children&&(t+=b(e.props.children))})),t}(0,n.addFilter)("blocks.registerBlockType","kadence/block-label",k);const m=(0,l.createHigherOrderComponent)((e=>t=>{const n="header"===(0,p.select)("core/editor").getEditedPostAttribute("area"),l=(0,p.select)("core/block-editor").getBlocks(),k=(0,c.get)(l,["0","clientId"]),[b,m]=(0,s.useState)(!1),[w,u]=(0,s.useState)(!1),g=()=>u(!1),h=n&&t.clientId===k&&!(0,i.blockExists)(l,"kadence/header"),{getEntityRecord:_}=(0,p.select)("core"),{saveEntityRecord:y}=(0,p.useDispatch)("core"),{removeBlocks:f,insertBlock:E}=(0,p.useDispatch)("core/block-editor"),B=_("root","site"),v=(0,c.get)(B,"kadence_blocks_header_notice_dismissed",!1);return(0,o.createElement)(o.Fragment,null,w&&(0,o.createElement)(r.Modal,{title:(0,d.__)("Replace header","kadence-blocks"),onRequestClose:g},(0,o.createElement)("p",null,(0,d.__)("This will replace your header with a Kadence Header block.","kadence-blocks")),(0,o.createElement)("div",{style:{marginBottom:"15px",display:"flex",justifyContent:"space-between"}},(0,o.createElement)(r.Button,{isPrimary:!0,onClick:()=>{f(l.map((e=>e.clientId))),E((0,a.createBlock)("kadence/header",{})),y("root","site",{kadence_blocks_header_notice_dismissed:!0}),m(!0),g()}},(0,d.__)("Replace","kadence-blocks")),(0,o.createElement)(r.Button,{isSecondary:!0,onClick:g},(0,d.__)("Cancel","kadence-blocks")))),h&&!b&&!v&&(0,o.createElement)("div",{style:{height:"30px",padding:"15px",backgroundColor:"#fef8ef",borderBottom:"1px solid rgb(155, 155, 155, 0.6)",borderLeft:"4px solid #f1b849",display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"5px"}},(0,d.__)("Try the Kadence Header block!","kadence-blocks"),(0,o.createElement)("div",null,(0,o.createElement)(r.Button,{isPrimary:!0,style:{marginRight:"15px"},onClick:()=>{u(!0)}},(0,d.__)("Replace with Kadence Header","kadence-blocks")),(0,o.createElement)(r.Button,{isSecondary:!0,onClick:()=>{m(!0),y("root","site",{kadence_blocks_header_notice_dismissed:!0})}},(0,d.__)("Dismiss","kadence-blocks")))),(0,o.createElement)(e,{...t}))}),"withTemplatePartNotice");window.wpWidgets||(0,n.addFilter)("editor.BlockEdit","kadence-blocks/with-template-part-notice",m),(this.kadence=this.kadence||{})["early-filters"]=t})();