(globalThis.webpackChunkcoblocks=globalThis.webpackChunkcoblocks||[]).push([[84],{1084:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>W});var n=o(1609),l=o(2485),s=o.n(l),i=o(4715);const c=(0,i.withColors)("backgroundColor",{textColor:"color"});var a=o(9668),r=o(4082),m=o(5556),b=o.n(m),d=o(5378),p=o.n(d),u=o(7723),g=o(6427),h=o(6087),_=o(9491),k=o(7143),v=o(4997),y=o(8490);function f(e=(0,v.getBlockType)("core/buttons"),t=(0,v.getBlockType)("coblocks/buttons")){return!!e&&!!t}o.n(y)()((function(){const e=(0,v.getBlockType)("core/buttons"),t=(0,v.getBlockType)("coblocks/buttons");f(e,t)&&((0,v.unregisterBlockType)("coblocks/buttons"),(0,v.registerBlockType)("coblocks/buttons",{...t,supports:{...t.supports,inserter:!1}}))}));class E extends h.Component{render(){const{attributes:e,clientId:t,setAttributes:o,tooltip:l=!0,updateBlockAttributes:i,innerBlocks:c}=this.props,{layout:a,fullscreen:r}=e,m=e=>{const t=f(),o=t?"core/buttons":"coblocks/buttons",n=t?"align":"contentAlign";c.forEach((t=>{t.name===o&&i(t.clientId,{[n]:e})}))};let b=[{
/* translators: block layout */
label:(0,u.__)("Top left","coblocks"),value:"top-left"},{
/* translators: block layout */
label:(0,u.__)("Top center","coblocks"),value:"top-center"},{
/* translators: block layout */
label:(0,u.__)("Top right","coblocks"),value:"top-right"},{
/* translators: block layout */
label:(0,u.__)("Center left","coblocks"),value:"center-left"},{
/* translators: block layout */
label:(0,u.__)("Center center","coblocks"),value:"center-center"},{
/* translators: block layout */
label:(0,u.__)("Center right","coblocks"),value:"center-right"},{
/* translators: block layout */
label:(0,u.__)("Bottom left","coblocks"),value:"bottom-left"},{
/* translators: block layout */
label:(0,u.__)("Bottom center","coblocks"),value:"bottom-center"},{
/* translators: block layout */
label:(0,u.__)("Bottom right","coblocks"),value:"bottom-right"}];r||(b=[{
/* translators: block layout */
label:(0,u.__)("Center left","coblocks"),value:"center-left"},{
/* translators: block layout */
label:(0,u.__)("Center center","coblocks"),value:"center-center"},{
/* translators: block layout */
label:(0,u.__)("Center right","coblocks"),value:"center-right"}]);const d={"top-left":{wrapper:{contentAlign:"left"}},"top-center":{wrapper:{contentAlign:"center"}},"top-right":{wrapper:{contentAlign:"right"}},"center-left":{wrapper:{contentAlign:"left"}},"center-center":{wrapper:{contentAlign:"center"}},"center-right":{wrapper:{contentAlign:"right"}},"bottom-left":{wrapper:{contentAlign:"left"}},"bottom-center":{wrapper:{contentAlign:"center"}},"bottom-right":{wrapper:{contentAlign:"right"}}},_=s()("components-base-control","components-coblocks-css-grid-selector",{"is-fullscreen":r});return(0,n.createElement)(h.Fragment,null,(0,n.createElement)("div",{className:_},(0,n.createElement)("p",{className:"components-base-control__label"},(0,u.__)("Layout","coblocks")),(0,n.createElement)(g.ButtonGroup,{"aria-label":(0,u.__)("Select layout","coblocks")},p()(b,(({label:e,value:s},c)=>l?(0,n.createElement)(g.Tooltip,{key:`grid-tooltip-${c}`,text:e},(0,n.createElement)("div",{className:s===a?"is-selected":null},(0,n.createElement)(g.Button,{isPrimary:s===a,isSecondary:s!==a,isSmall:!0,onClick:()=>{o({layout:s}),m(s.split("-")[1]),d[s].wrapper&&i(t,d[s].wrapper)}}))):(0,n.createElement)("div",{className:s===a?"is-selected":null},(0,n.createElement)(g.Button,{isPrimary:s===a,isSecondary:s!==a,isSmall:!0,onClick:()=>{o({layout:s}),d[s].wrapper&&(i(t,d[s].wrapper),m(s.split("-")[1]))}})))))),(0,n.createElement)(g.ToggleControl,{checked:!!r,help:r?(0,u.__)("Fullscreen mode is enabled.","coblocks"):(0,u.__)("Toggle to enable fullscreen mode.","coblocks"),label:(0,u.__)("Fullscreen","coblocks"),onChange:()=>{r&&(["bottom-left","top-left"].includes(a)&&(o({layout:"center-left"}),m("left")),["bottom-center","top-center"].includes(a)&&(o({layout:"center-center"}),m("center")),["bottom-right","top-right"].includes(a)&&(o({layout:"center-right"}),m("right"))),o({fullscreen:!r})}}))}}const T=(0,_.withInstanceId)((0,_.compose)([(0,k.withDispatch)((e=>{const{updateBlockAttributes:t}=e("core/block-editor");return{updateBlockAttributes:t}})),(0,k.withSelect)(((e,t)=>{const{getBlocks:o}=e("core/block-editor");return{innerBlocks:o(t.clientId)}}))])(E));E.propTypes={attributes:b().object,clientId:b().number,innerBlocks:b().array,setAttributes:b().func,tooltip:b().bool.isRequired,updateBlockAttributes:b().func},E.defaultProps={tooltip:!1};var B=o(8558);function C({icon:e="menu",label:t,menuLabel:o,className:l,props:i}){return(0,n.createElement)(g.Dropdown,{className:s()("components-dropdown-menu",l),contentClassName:"components-dropdown-menu__popover",renderContent:()=>(0,n.createElement)(g.NavigableMenu,{"aria-label":o,className:"components-coblocks-grid-dropdown",role:"menu"},(0,n.createElement)(T,{...i,tooltip:!1})),renderToggle:({isOpen:o,onToggle:l})=>(0,n.createElement)(g.ToolbarButton,{"aria-expanded":o,"aria-haspopup":"true",icon:e,label:t,onClick:l,onKeyDown:e=>{o||e.keyCode!==B.DOWN||(e.preventDefault(),e.stopPropagation(),l())},showTooltip:!0})})}const w=C;C.propTypes={className:b().string,icon:b().string.isRequired,label:b().string,menuLabel:b().string,props:b().object},C.defaultProps={icon:"menu"};const S=e=>{const{attributes:t,setAttributes:o}=e,{contentAlign:l}=t;return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.BlockControls,null,(0,n.createElement)(g.ToolbarGroup,null,(0,n.createElement)(w,{icon:(0,n.createElement)(g.Icon,{icon:a.ruP}),label:(0,u.__)("Change layout","coblocks"),props:e})),(0,n.createElement)(i.AlignmentToolbar,{onChange:e=>o({contentAlign:e}),value:l}),(0,n.createElement)(r.j2,{...e})))},$=[{name:(0,u.__)("None","coblocks"),size:0,slug:"no"},{name:(0,u.__)("Small","coblocks"),size:14,slug:"small"},{name:(0,u.__)("Medium","coblocks"),size:24,slug:"medium"},{name:(0,u.__)("Large","coblocks"),size:34,slug:"large"},{name:(0,u.__)("Huge","coblocks"),size:60,slug:"huge"}];class N extends h.Component{constructor(){super(...arguments),this.getSelectValuesFromUtilitySizes=this.getSelectValuesFromUtilitySizes.bind(this),this.getCurrentSelectValue=this.getCurrentSelectValue.bind(this),this.setCurrentSelectValue=this.setCurrentSelectValue.bind(this),this.onChangeValue=this.onChangeValue.bind(this),this.getSelectOptions=this.getSelectOptions.bind(this)}getSelectValuesFromUtilitySizes(e,t){let o;if("string"==typeof t)return o=e.find((e=>e.slug===t)),o?o.slug:"custom"}getCurrentSelectValue(e){const{paddingSize:t,marginSize:o}=this.props;switch(e){case"margin":return o;case"padding":return t}}setCurrentSelectValue(e){const{type:t,setAttributes:o}=this.props;switch(t){case"margin":o({marginSize:e});break;case"padding":o({paddingSize:e})}}onChangeValue(e){const t=$.find((t=>t.slug===e));t&&this.setCurrentSelectValue(this.getSelectValuesFromUtilitySizes($,t.slug))}getSelectOptions(e){return[...e.map((e=>({label:e.name,value:e.slug})))]}render(){const{type:e}=this.props;return(0,n.createElement)(h.Fragment,null,(0,n.createElement)(g.SelectControl,{className:"components-font-size-picker__select",hideLabelFromVision:!0,label:`Choose ${e} preset`,onChange:this.onChangeValue,options:this.getSelectOptions($),value:this.getCurrentSelectValue(e)}))}}N.propTypes={marginSize:b().number,paddingSize:b().number,setAttributes:b().func,type:b().string};const M=["Top","Right","Bottom","Left"],x={margin:{bottom:(0,u.__)("Margin bottom","coblocks"),left:(0,u.__)("Margin left","coblocks"),right:(0,u.__)("Margin right","coblocks"),top:(0,u.__)("Margin top","coblocks")},padding:{bottom:(0,u.__)("Padding bottom","coblocks"),left:(0,u.__)("Padding left","coblocks"),right:(0,u.__)("Padding right","coblocks"),top:(0,u.__)("Padding top","coblocks")}},R=e=>{const{attributes:t,clientId:o,dimensionSize:l,help:i,instanceId:c,label:r=(0,u.__)("Margin","coblocks"),setAttributes:m,type:b="margin",unit:d}=e,{coblocks:h,marginSize:_,paddingSize:v,saveCoBlocksMeta:y}=t,{updateBlockAttributes:f}=(0,k.useDispatch)("core/block-editor"),E=(e,t)=>void 0!==e?`${e}${t}`:null,T=(e,t)=>{if(void 0!==e)return`${t}: ${e} !important`},B=()=>{const t=wp.data.select("core/editor").getEditedPostAttribute("meta"),n=wp.data.select("core/block-editor").getBlock(o);let s={};if(void 0!==h&&void 0!==h.id){const o=e.name.split("/").join("-")+"-"+h.id,i=n.attributes.paddingUnit,c=n.attributes.marginUnit,a={paddingBottom:E(n.attributes.paddingBottom,i),paddingBottomMobile:E(n.attributes.paddingBottomMobile,i),paddingBottomTablet:E(n.attributes.paddingBottomTablet,i),paddingLeft:E(n.attributes.paddingLeft,i),paddingLeftMobile:E(n.attributes.paddingLeftMobile,i),paddingLeftTablet:E(n.attributes.paddingLeftTablet,i),paddingRight:E(n.attributes.paddingRight,i),paddingRightMobile:E(n.attributes.paddingRightMobile,i),paddingRightTablet:E(n.attributes.paddingRightTablet,i),paddingTop:E(n.attributes.paddingTop,i),paddingTopMobile:E(n.attributes.paddingTopMobile,i),paddingTopTablet:E(n.attributes.paddingTopTablet,i)},r={marginBottom:E(n.attributes.marginBottom,c),marginBottomMobile:E(n.attributes.marginBottomMobile,c),marginBottomTablet:E(n.attributes.marginBottomTablet,c),marginLeft:E(n.attributes.marginLeft,c),marginLeftMobile:E(n.attributes.marginLeftMobile,c),marginLeftTablet:E(n.attributes.marginLeftTablet,c),marginRight:E(n.attributes.marginRight,c),marginRightMobile:E(n.attributes.marginRightMobile,c),marginRightTablet:E(n.attributes.marginRightTablet,c),marginTop:E(n.attributes.marginTop,c),marginTopMobile:E(n.attributes.marginTopMobile,c),marginTopTablet:E(n.attributes.marginTopTablet,c)};s=void 0===t||void 0===t._coblocks_dimensions||void 0!==t._coblocks_dimensions&&""===t._coblocks_dimensions?{}:JSON.parse(t._coblocks_dimensions),void 0===s[o]?(s[o]={},s[o][b]={}):void 0===s[o][b]&&(s[o][b]={}),s[o][b]="advanced"===l?"padding"===b?a:r:{},wp.data.dispatch("core/editor").editPost({meta:{_coblocks_dimensions:JSON.stringify(s)}});const m=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.type="text/css";const p=`\n\t\t\t\t@media only screen and (max-width: 768px) {\n\t\t\t\t\t.${o} > div {\n\t\t\t\t\t\t${T(a.paddingTopTablet,"padding-top")}\n\t\t\t\t\t\t${T(a.paddingRightTablet,"padding-right")}\n\t\t\t\t\t\t${T(a.paddingBottomTablet,"padding-bottom")}\n\t\t\t\t\t\t${T(a.paddingLeftTablet,"padding-left")}\n\t\t\t\t\t\t${T(r.marginTopTablet,"margin-top")}\n\t\t\t\t\t\t${T(r.marginRightTablet,"margin-right")}\n\t\t\t\t\t\t${T(r.marginBottomTablet,"margin-bottom")}\n\t\t\t\t\t\t${T(r.marginLeftTablet,"margin-left")}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@media only screen and (max-width: 514px) {\n\t\t\t\t\t.${o} > div {\n\t\t\t\t\t\t${T(a.paddingTopMobile,"padding-top")}\n\t\t\t\t\t\t${T(a.paddingRightMobile,"padding-right")}\n\t\t\t\t\t\t${T(a.paddingBottomMobile,"padding-bottom")}\n\t\t\t\t\t\t${T(a.paddingLeftMobile,"padding-left")}\n\t\t\t\t\t\t${T(r.marginTopMobile,"margin-top")}\n\t\t\t\t\t\t${T(r.marginRightMobile,"margin-right")}\n\t\t\t\t\t\t${T(r.marginBottomMobile,"margin-bottom")}\n\t\t\t\t\t\t${T(r.marginLeftMobile,"margin-left")}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t`;d.styleSheet?d.styleSheet.cssText=p:d.appendChild(document.createTextNode(p)),m.appendChild(d)}};y&&(B(),f(o,{saveCoBlocksMeta:!1}));const C=(t,o)=>{["coblocks/hero"].includes(e.name)&&"no"===t&&(o<0?(t="huge",o=60):o=-1),"padding"===b&&m({paddingSyncUnits:!0}),m({[`${b}Size`]:t}),o&&(o=o<0?"":o,m({[`${b}Top`]:o,[`${b}Right`]:0,[`${b}Bottom`]:o,[`${b}Left`]:0,[`${b}Unit`]:"px"})),B()},w=s()("components-base-control","components-coblocks-dimensions-control",{}),S=`inspector-coblocks-dimensions-control-${c}`,$=[{
/* translators: a unit of size (px) for css markup */
name:(0,u.__)("Pixel","coblocks"),unitValue:"px"},{
/* translators: a unit of size (em) for css markup */
name:(0,u.__)("Em","coblocks"),unitValue:"em"},{
/* translators: a unit of size (vw) for css markup */
name:(0,u.__)("Viewport width","coblocks"),unitValue:"vw"},{
/* translators: a unit of size (vh) for css markup */
name:(0,u.__)("Viewport height","coblocks"),unitValue:"vh"},{
/* translators: a unit of size for css markup */
name:(0,u.__)("Percentage","coblocks"),unitValue:"%"}],R=(t="")=>{const o=e[`syncUnits${t}`];return(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"components-coblocks-dimensions-control__inputs"},M.map((o=>(0,n.createElement)("input",{"aria-describedby":i?S+"__help":void 0,"aria-label":x[b][o.toLowerCase()],className:"components-coblocks-dimensions-control__number","data-device-type":t,key:`coblocks-dimensions-control-number-${t}-${o}`,min:"padding"===b?0:void 0,onChange:t=>((t,o)=>{const n=""===t.target.value?void 0:Number(t.target.value);let l="";void 0!==t.target.getAttribute("data-device-type")&&void 0!==t.target.getAttribute("data-device-type")&&(l=t.target.getAttribute("data-device-type")),e["syncUnits"+l]?((e,t)=>{m({[`${b}Top${t}`]:e,[`${b}Right${t}`]:e,[`${b}Bottom${t}`]:e,[`${b}Left${t}`]:e}),B()})(n,l):((e,t,o)=>{m({[`${b}${o}${t}`]:e}),B()})(n,l,o)})(t,o),type:"number",value:e[`value${o}${t}`]}))),(0,n.createElement)(g.Tooltip,{text:o?(0,u.__)("Unsync","coblocks"):(0,u.__)("Sync","coblocks")},(0,n.createElement)(g.Button,{"aria-label":(0,u.__)("Sync units","coblocks"),"aria-pressed":!!o,className:"components-coblocks-dimensions-control_sync","data-device-type":t,isPrimary:!!o,isSecondary:!o,isSmall:!0,onClick:()=>((t="")=>{const o=[e["valueTop"+t],e["valueRight"+t],e["valueBottom"+t],e["valueLeft"+t]],n=Math.max.apply(null,o);m({[`${b}SyncUnits${t}`]:!e[`syncUnits${t}`],[`${b}Top${t}`]:n,[`${b}Right${t}`]:n,[`${b}Bottom${t}`]:n,[`${b}Left${t}`]:n}),B()})(t)},a.Fjq))))};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:w},"advanced"===l?(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"components-coblocks-dimensions-control__header"},r&&(0,n.createElement)("p",{className:"components-coblocks-dimensions-control__label"},r),(0,n.createElement)("div",{className:"components-coblocks-dimensions-control__actions"},(0,n.createElement)(g.ButtonGroup,{"aria-label":(0,u.__)("Select Units","coblocks"),className:"components-coblocks-dimensions-control__units"},p()($,(({unitValue:e,name:t})=>(0,n.createElement)(g.Tooltip,{key:`coblocks-dimensions-control-unit-tooltip-${t}`,text:(0,u.sprintf)(/* translators: %s: values associated with CSS syntax, 'Pixel', 'Em', 'Percentage' */ /* translators: %s: values associated with CSS syntax, 'Pixel', 'Em', 'Percentage' */
(0,u.__)("%s units","coblocks"),t)},(0,n.createElement)(g.Button,{"aria-label":(0,u.sprintf)(/* translators: %s: values associated with CSS syntax, 'Pixel', 'Em', 'Percentage' */ /* translators: %s: values associated with CSS syntax, 'Pixel', 'Em', 'Percentage' */
(0,u.__)("%s units","coblocks"),t),"aria-pressed":d===e,className:"components-coblocks-dimensions-control__units--"+t,isPrimary:d===e,isSecondary:d!==e,isSmall:!0,key:e,onClick:()=>{return t=e,m({[`${b}Unit`]:t}),void B();var t}},e))))),(0,n.createElement)(g.Button,{"aria-label":(0,u.sprintf)(/* translators: %s: a texual label  */ /* translators: %s: a texual label  */
(0,u.__)("Turn off advanced %s settings","coblocks"),r.toLowerCase()),isSecondary:!0,isSmall:!0,onClick:()=>C("no",-1),type:"button"},(0,u.__)("Reset","coblocks")))),(0,n.createElement)(g.TabPanel,{activeClass:"is-active",className:"components-coblocks-dimensions-control__mobile-controls",initialTabName:"default",onSelect:e=>{let t="desktop";switch(e){case"desktop":t="tablet";break;case"tablet":t="mobile";break;case"mobile":t="desktop"}const o=document.getElementsByClassName(`components-coblocks-dimensions-control__mobile-controls-item--${b}`);for(let e=0;e<o.length;e++)o[e].style.display="none";"default"===e?document.getElementsByClassName(`components-coblocks-dimensions-control__mobile-controls-item-${b}--tablet`)[0].click():document.getElementsByClassName(`components-coblocks-dimensions-control__mobile-controls-item-${b}--${t}`)[0].style.display="block"},tabs:[{className:`components-coblocks-dimensions-control__mobile-controls-item components-coblocks-dimensions-control__mobile-controls-item--${b} components-button is-button is-default is-secondary components-coblocks-dimensions-control__mobile-controls-item--default components-coblocks-dimensions-control__mobile-controls-item-${b}--default`,name:"default",title:a.eZO},{className:`components-coblocks-dimensions-control__mobile-controls-item components-coblocks-dimensions-control__mobile-controls-item--${b} components-button is-button is-default is-secondary components-coblocks-dimensions-control__mobile-controls-item--desktop components-coblocks-dimensions-control__mobile-controls-item-${b}--desktop`,name:"desktop",title:a.eZO},{className:`components-coblocks-dimensions-control__mobile-controls-item components-coblocks-dimensions-control__mobile-controls-item--${b} components-button is-button is-default is-secondary components-coblocks-dimensions-control__mobile-controls-item--tablet components-coblocks-dimensions-control__mobile-controls-item-${b}--tablet`,name:"tablet",title:a._Or},{className:`components-coblocks-dimensions-control__mobile-controls-item components-coblocks-dimensions-control__mobile-controls-item--${b} components-button is-button is-default is-secondary components-coblocks-dimensions-control__mobile-controls-item--mobile components-coblocks-dimensions-control__mobile-controls-item-${b}--mobile`,name:"mobile",title:a.sqe}]},(e=>{return R(["default","desktop"].includes(e.name)?"":(t=e.name)&&t[0].toUpperCase()+t.slice(1)||"");var t})),(0,n.createElement)("div",{className:"components-coblocks-dimensions-control__input-labels"},(0,n.createElement)("span",{className:"components-coblocks-dimensions-control__number-label"},(0,u.__)("Top","coblocks")),(0,n.createElement)("span",{className:"components-coblocks-dimensions-control__number-label"},(0,u.__)("Right","coblocks")),(0,n.createElement)("span",{className:"components-coblocks-dimensions-control__number-label"},(0,u.__)("Bottom","coblocks")),(0,n.createElement)("span",{className:"components-coblocks-dimensions-control__number-label"},(0,u.__)("Left","coblocks")),(0,n.createElement)("span",{className:"components-coblocks-dimensions-control__number-label-blank"}))):(0,n.createElement)(g.BaseControl,{help:i,id:"textarea-1",label:r},(0,n.createElement)("div",{className:"components-font-size-picker__controls"},(0,n.createElement)(N,{marginSize:_,paddingSize:v,setAttributes:m,type:b}),(0,n.createElement)(g.Button,{"aria-label":(0,u.sprintf)(/* translators: %s: a texual label */ /* translators: %s: a texual label */
(0,u.__)("Advanced %s settings","coblocks"),r.toLowerCase()),isPrimary:"advanced"===l,isSecondary:!0,isSmall:!0,onClick:()=>C("advanced",""),type:"button"},(0,u.__)("Advanced","coblocks"))))))};R.propTypes={attributes:b().number,clientId:b().number,dimensionSize:b().number,help:b().bool,instanceId:b().number,label:b().string,name:b().string,setAttributes:b().func,type:b().string,unit:b().number};const A=(0,_.withInstanceId)(R);class L extends h.Component{constructor(){super(...arguments),this.saveMeta=this.saveMeta.bind(this)}saveMeta(){const{attributes:e,clientId:t,name:o,type:n}=this.props,l=wp.data.select("core/editor").getEditedPostAttribute("meta"),s=wp.data.select("core/block-editor").getBlock(t);let i={};if(void 0!==e.coblocks&&void 0!==e.coblocks.id){const t=o.split("/").join("-")+"-"+e.coblocks.id,c={height:s.attributes[n],heightMobile:s.attributes[n+"Mobile"],heightTablet:s.attributes[n+"Tablet"]};i=void 0===l._coblocks_responsive_height||void 0!==l._coblocks_responsive_height&&""===l._coblocks_responsive_height?{}:JSON.parse(l._coblocks_responsive_height),void 0===i[t]?(i[t]={},i[t][n]={}):void 0===i[t][n]&&(i[t][n]={}),i[t][n]=c,wp.data.dispatch("core/editor").editPost({meta:{_coblocks_responsive_height:JSON.stringify(i)}})}}render(){const{label:e=(0,u.__)("Height","coblocks"),height:t,heightTablet:o,heightMobile:l,onChange:i,onChangeTablet:c,onChangeMobile:r,min:m=10,max:b=1e3,step:d=1,type:p}=this.props,_=s()("components-base-control","components-coblocks-dimensions-control","components-coblocks-responsive-base-control",{});return(0,n.createElement)(h.Fragment,null,(0,n.createElement)("div",{className:_},(0,n.createElement)(h.Fragment,null,(0,n.createElement)("span",{className:"components-base-control__label"},e),(0,n.createElement)(g.TabPanel,{activeClass:"is-active",className:"components-coblocks-dimensions-control__mobile-controls",initialTabName:"default",onSelect:e=>{let t="desktop";switch(e){case"desktop":t="tablet";break;case"tablet":t="mobile";break;case"mobile":t="desktop"}const o=document.getElementsByClassName(`components-coblocks-dimensions-control__mobile-controls-item--${p}`);for(let e=0;e<o.length;e++)o[e].style.display="none";if("default"===e){const e=document.getElementsByClassName(`components-coblocks-dimensions-control__mobile-controls-item-${p}--tablet`);e[0]?.click()}else document.getElementsByClassName(`components-coblocks-dimensions-control__mobile-controls-item-${p}--${t}`)[0].style.display="block"},tabs:[{className:`is-secondary components-coblocks-dimensions-control__mobile-controls-item components-coblocks-dimensions-control__mobile-controls-item--${p} components-button is-button is-default components-coblocks-dimensions-control__mobile-controls-item--default components-coblocks-dimensions-control__mobile-controls-item-${p}--default`,name:"default",title:a.eZO},{className:`is-secondary components-coblocks-dimensions-control__mobile-controls-item components-coblocks-dimensions-control__mobile-controls-item--${p} components-button is-button is-default components-coblocks-dimensions-control__mobile-controls-item--desktop components-coblocks-dimensions-control__mobile-controls-item-${p}--desktop`,name:"desktop",title:a.eZO},{className:`is-secondary components-coblocks-dimensions-control__mobile-controls-item components-coblocks-dimensions-control__mobile-controls-item--${p} components-button is-button is-default components-coblocks-dimensions-control__mobile-controls-item--tablet components-coblocks-dimensions-control__mobile-controls-item-${p}--tablet`,name:"tablet",title:a._Or},{className:`is-secondary components-coblocks-dimensions-control__mobile-controls-item components-coblocks-dimensions-control__mobile-controls-item--${p} components-button is-button is-default components-coblocks-dimensions-control__mobile-controls-item--mobile components-coblocks-dimensions-control__mobile-controls-item-${p}--mobile`,name:"mobile",title:a.sqe}]},(e=>"mobile"===e.name?(0,n.createElement)(h.Fragment,null,(0,n.createElement)("div",{className:"components-coblocks-dimensions-control__inputs component-coblocks-is-mobile"},(0,n.createElement)(g.BaseControl,null,(0,n.createElement)("input",{max:b,min:m,onChange:e=>{r(e),this.saveMeta()},step:d,type:"number",value:l||""})))):"tablet"===e.name?(0,n.createElement)(h.Fragment,null,(0,n.createElement)("div",{className:"components-coblocks-dimensions-control__inputs component-coblocks-is-tablet"},(0,n.createElement)(g.BaseControl,null,(0,n.createElement)("input",{max:b,min:m,onChange:e=>{c(e),this.saveMeta()},step:d,type:"number",value:o||""})))):(0,n.createElement)(h.Fragment,null,(0,n.createElement)("div",{className:"components-coblocks-dimensions-control__inputs component-coblocks-is-desktop"},(0,n.createElement)(g.BaseControl,null,(0,n.createElement)("input",{max:b,min:m,onChange:e=>{i(e),this.saveMeta()},step:d,type:"number",value:t||""})))))))))}}const z=(0,_.withInstanceId)(L);L.propTypes={height:b().oneOfType([b().number,b().string]),heightMobile:b().oneOfType([b().number,b().string]),heightTablet:b().oneOfType([b().number,b().string]),label:b().string.isRequired,max:b().number.isRequired,min:b().number.isRequired,onChange:b().func,onChangeMobile:b().func,onChangeTablet:b().func,step:b().number.isRequired},L.defaultProps={label:(0,u.__)("Height","coblocks"),max:1e3,min:10,step:1};const{getComputedStyle:I}=window,P=(0,g.withFallbackStyles)(((e,t)=>{const{backgroundColor:o}=t.attributes,n=e.querySelector('[contenteditable="true"]'),l=n?I(n):null;return{fallbackBackgroundColor:o||!l?void 0:l.backgroundColor}})),U=(0,_.compose)([c,P])((e=>{const{attributes:t,backgroundColor:o,setAttributes:l,setBackgroundColor:s,setTextColor:c,textColor:a}=e,{fullscreen:m,maxWidth:b,paddingTop:d,paddingRight:p,paddingBottom:h,paddingLeft:_,paddingTopTablet:k,paddingRightTablet:v,paddingBottomTablet:y,paddingLeftTablet:f,paddingTopMobile:E,paddingRightMobile:B,paddingBottomMobile:C,paddingLeftMobile:w,paddingUnit:S,paddingSyncUnits:$,paddingSyncUnitsTablet:N,paddingSyncUnitsMobile:M,paddingSize:x,saveCoBlocksMeta:R,height:L,heightTablet:I,heightMobile:P,syncHeight:U}=t;return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.InspectorControls,null,(0,n.createElement)(g.PanelBody,{title:(0,u.__)("Hero settings","coblocks")},(0,n.createElement)(A,{...e,type:"padding",label:(0,u.__)("Padding","coblocks"),help:(0,u.__)("Space inside of the container.","coblocks"),valueTop:d,valueRight:p,valueBottom:h,valueLeft:_,valueTopTablet:k,valueRightTablet:v,valueBottomTablet:y,valueLeftTablet:f,valueTopMobile:E,valueRightMobile:B,valueBottomMobile:C,valueLeftMobile:w,unit:S,syncUnits:$,syncUnitsTablet:N,syncUnitsMobile:M,dimensionSize:x,saveCoBlocksMeta:R}),(0,n.createElement)(T,{...e}),!m&&(0,n.createElement)(z,{...e,label:(0,u.__)("Height in pixels","coblocks"),height:L,heightTablet:I,heightMobile:P,onChange:e=>{l({height:parseInt(e.target.value,10)})},onChangeTablet:e=>{l({heightTablet:parseInt(e.target.value,10)})},onChangeMobile:e=>{l({heightMobile:parseInt(e.target.value,10)})},sync:U,type:"height",min:"500"}),(0,n.createElement)(g.RangeControl,{label:(0,u.__)("Content width in pixels","coblocks"),value:parseInt(b),onChange:e=>l({maxWidth:parseInt(e)}),min:400,max:1e3,step:10,initialPosition:560})),(0,n.createElement)(i.PanelColorSettings,{title:(0,u.__)("Color settings","coblocks"),initialOpen:!1,colorSettings:[{value:o.color,onChange:e=>{s(e),x&&"no"!==x||l({paddingSize:"huge"})},label:(0,u.__)("Background color","coblocks")},{value:a.color,onChange:c,label:(0,u.__)("Text color","coblocks")}]}),(0,n.createElement)(r.vB,{...e,hasOverlay:!0})))}));var V=o(3162);const O=["core/heading","core/paragraph","core/spacer","core/button","core/buttons","core/list","core/image","coblocks/alert","coblocks/gif","coblocks/social","coblocks/row","coblocks/column","coblocks/buttons"],F=[["core/heading",{level:2,
/* translators: content placeholder */
placeholder:(0,u.__)("Add hero heading…","coblocks")}],["core/paragraph",{
/* translators: content placeholder */
placeholder:(0,u.__)("Add hero content, which is typically an introductory area of a page accompanied by call to action or two.","coblocks")}],["core/buttons",{contentAlign:"left",gutter:"medium",items:2},[["core/button",{
/* translators: content placeholder */
placeholder:(0,u.__)("Primary button…","coblocks")}],["core/button",{className:"is-style-outline",
/* translators: content placeholder */
placeholder:(0,u.__)("Secondary button…","coblocks")}]]]],W=(0,_.compose)([c,(0,k.withDispatch)((e=>{const{updateBlockAttributes:t}=e("core/block-editor"),{editPost:o}=e("core/editor");return{editPost:o,updateBlockAttributes:t}})),(0,k.withSelect)((e=>{const{getEditedPostAttribute:t}=e("core/editor"),{getBlockAttributes:o}=e("core/block-editor");return{getBlockAttributes:o,getEditedPostAttribute:t}}))])((e=>{const{clientId:t,attributes:o,getEditedPostAttribute:l,editPost:c,name:a,isSelected:m,setAttributes:b,textColor:d,backgroundColor:p,insertBlocksAfter:_,getBlockAttributes:v}=e,{maxWidth:y,className:f,layout:E,fullscreen:T,backgroundImg:B,paddingSize:C,paddingTop:w,paddingRight:$,paddingBottom:N,paddingLeft:M,paddingUnit:x,contentAlign:R,height:A,heightTablet:L,heightMobile:z}=o,[I]=(0,h.useState)(!1),[P,W]=(0,h.useState)(!1),[H,q]=(0,h.useState)(null),{__unstableMarkAutomaticChange:j}=(0,k.useDispatch)("core/block-editor");(0,h.useEffect)((()=>{const e=document.getElementById("block-"+t);e&&(e.getElementsByClassName("wp-block-coblocks-hero__content")[0].style.width="auto",e.getElementsByClassName("wp-block-coblocks-hero__content")[0].style.maxWidth=o.maxWidth+"px");const n=document.defaultView;return D(),n.addEventListener("resize",D),j(),()=>{n.removeEventListener("resize",D)}}),[]);const D=()=>{const e=document.defaultView;return q(e.innerWidth),e.innerWidth},J=(0,n.createElement)(r.i9,{...e,label:(0,u.__)("Add background to hero","coblocks")});let Z=s()("wp-block-coblocks-hero",f);o.coblocks&&void 0!==o.coblocks.id&&(Z=s()(Z,`coblocks-hero-${o.coblocks.id}`));const G=s()("wp-block-coblocks-hero__inner",...(0,r.dN)(o),E&&{[`hero-${E}-align`]:E},{"has-text-color":d&&d.color},C&&{"has-padding":"no"!==C,[`has-${C}-padding`]:"advanced"!==C},R&&{[`has-${R}-content`]:R},{"is-fullscreen":T,"is-hero-resizing":I}),Q={...(0,r.$i)(o,p),color:d&&d.color,minHeight:T?void 0:A,paddingBottom:"advanced"===C&&N?N+x:void 0,paddingLeft:"advanced"===C&&M?M+x:void 0,paddingRight:"advanced"===C&&$?$+x:void 0,paddingTop:"advanced"===C&&w?w+x:void 0},K={bottom:!1,bottomLeft:!1,bottomRight:!1,left:!0,right:!0,top:!1,topLeft:!1,topRight:!1};let X={target:"height",value:A};return H<=768&&H>514?X={target:"heightTablet",value:L||A}:H<=514&&(X={target:"heightMobile",value:z||A}),(0,n.createElement)(n.Fragment,null,J,m&&(0,n.createElement)(U,{...e}),m&&(0,n.createElement)(S,{...e}),(0,n.createElement)("div",{className:Z},T?(0,n.createElement)("div",{className:G,style:Q},(0,V.isBlobURL)(B)&&(0,n.createElement)(g.Spinner,null),(0,r.Qt)(o),void 0!==_&&(0,n.createElement)("div",{className:"wp-block-coblocks-hero__content-wrapper"},(0,n.createElement)(g.ResizableBox,{className:s()("wp-block-coblocks-hero__content","editor-media-container__resizer",{"is-resizing":P}),enable:K,maxWidth:"1000",minWidth:"400",onResizeStart:()=>{W(!0);const e=document.getElementById("block-"+t);e.getElementsByClassName("wp-block-coblocks-hero__content")[0].style.maxWidth="",e.getElementsByClassName("wp-block-coblocks-hero__content")[0].style.width=y+"px"},onResizeStop:(e,o,n,l)=>{b({maxWidth:parseInt(y+l.width,10)}),W(!1);const s=document.getElementById("block-"+t);s.getElementsByClassName("wp-block-coblocks-hero__content")[0].style.width="auto",s.getElementsByClassName("wp-block-coblocks-hero__content")[0].style.maxWidth=parseInt(y+l.width,10)+"px"},showHandle:m,size:{width:y}},(0,n.createElement)(i.InnerBlocks,{__experimentalCaptureToolbars:!0,allowedBlocks:O,template:F,templateInsertUpdatesSelection:!1,templateLock:!1})))):(0,n.createElement)(g.ResizableBox,{className:G,enable:{bottom:!0,bottomLeft:!1,bottomRight:!1,left:!1,right:!1,top:!1,topLeft:!1,topRight:!1},minHeight:"500",onResizeStop:(e,n,s,i)=>{switch(X.target){case"heightTablet":b({heightTablet:parseInt(X.value+i.height,10)});break;case"heightMobile":b({heightMobile:parseInt(X.value+i.height,10)});break;default:b({height:parseInt(X.value+i.height,10)})}(e=>{const n=l("meta"),s=v(t);let i={};if(void 0!==o.coblocks&&void 0!==o.coblocks.id){const t=a.split("/").join("-")+"-"+o.coblocks.id,l={height:s[e],heightMobile:s[e+"Mobile"],heightTablet:s[e+"Tablet"]};i=void 0===n._coblocks_responsive_height||void 0!==n._coblocks_responsive_height&&""===n._coblocks_responsive_height?{}:JSON.parse(n._coblocks_responsive_height),void 0===i[t]?(i[t]={},i[t][e]={}):void 0===i[t][e]&&(i[t][e]={}),i[t][e]=l,c({meta:{_coblocks_responsive_height:JSON.stringify(i)}})}})("height")},showHandle:m,size:{height:X.value},style:Q},(0,V.isBlobURL)(B)&&(0,n.createElement)(g.Spinner,null),(0,r.Qt)(o),void 0!==_&&(0,n.createElement)("div",{className:"wp-block-coblocks-hero__content-wrapper"},(0,n.createElement)(g.ResizableBox,{className:s()("wp-block-coblocks-hero__content","editor-media-container__resizer",{"is-resizing":P}),enable:K,maxWidth:"1000",minWidth:"400",onResizeStart:()=>{W(!0);const e=document.getElementById("block-"+t);e.getElementsByClassName("wp-block-coblocks-hero__content")[0].style.maxWidth="",e.getElementsByClassName("wp-block-coblocks-hero__content")[0].style.width=y+"px"},onResizeStop:(e,o,n,l)=>{b({maxWidth:parseInt(y+l.width,10)}),W(!1);const s=document.getElementById("block-"+t);s.getElementsByClassName("wp-block-coblocks-hero__content")[0].style.width="auto",s.getElementsByClassName("wp-block-coblocks-hero__content")[0].style.maxWidth=parseInt(y+l.width,10)+"px"},showHandle:m,size:{width:y}},(0,n.createElement)(i.InnerBlocks,{allowedBlocks:O,template:F,templateInsertUpdatesSelection:!1,templateLock:!1}))))))}))},909:(e,t,o)=>{var n=o(3022),l=o(8329)(n);e.exports=l},6649:(e,t,o)=>{var n=o(3221)();e.exports=n},3022:(e,t,o)=>{var n=o(6649),l=o(5950);e.exports=function(e,t){return e&&n(e,t,l)}},5128:(e,t,o)=>{var n=o(909),l=o(4894);e.exports=function(e,t){var o=-1,s=l(e)?Array(e.length):[];return n(e,(function(e,n,l){s[++o]=t(e,n,l)})),s}},8329:(e,t,o)=>{var n=o(4894);e.exports=function(e,t){return function(o,l){if(null==o)return o;if(!n(o))return e(o,l);for(var s=o.length,i=t?s:-1,c=Object(o);(t?i--:++i<s)&&!1!==l(c[i],i,c););return o}}},3221:e=>{e.exports=function(e){return function(t,o,n){for(var l=-1,s=Object(t),i=n(t),c=i.length;c--;){var a=i[e?c:++l];if(!1===o(s[a],a,s))break}return t}}},5378:(e,t,o)=>{var n=o(4932),l=o(5389),s=o(5128),i=o(6449);e.exports=function(e,t){return(i(e)?n:s)(e,l(t,3))}}}]);