(self.webpackChunkcoblocks=self.webpackChunkcoblocks||[]).push([[510],{510:function(e,t,o){"use strict";o.r(t),o.d(t,{default:function(){return W}});var n=o(9196),l=o(4184),s=o.n(l),i=o(2175),c=(0,i.withColors)("backgroundColor",{textColor:"color"}),a=o(7635),r=o(5377),m=o(5697),b=o.n(m),d=o(5161),p=o.n(d),u=o(5736),g=o(5609),h=o(9307),_=o(4333),k=o(9818),v=o(4981),f=o(7701);function y(e=(0,v.getBlockType)("core/buttons"),t=(0,v.getBlockType)("coblocks/buttons")){return!!e&&!!t}o.n(f)()((function(){const e=(0,v.getBlockType)("core/buttons"),t=(0,v.getBlockType)("coblocks/buttons");y(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=y(),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})}}))}}var 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(9630);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})})}var w=C;C.propTypes={className:b().string,icon:b().string.isRequired,label:b().string,menuLabel:b().string,props:b().object},C.defaultProps={icon:"menu"};var 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.ywL}),label:(0,u.__)("Change layout","coblocks"),props:e})),(0,n.createElement)(i.AlignmentToolbar,{onChange:e=>o({contentAlign:e}),value:l}),(0,n.createElement)(r.H,{...e})))};const $=[{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:f}=t,{updateBlockAttributes:y}=(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)}};f&&(B(),y(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&&m({[`${b}Top`]:o=o<0?"":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.bnu))))};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' */
(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' */
(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:()=>(m({[`${b}Unit`]:e}),void B())},e))))),(0,n.createElement)(g.Button,{"aria-label":(0,u.sprintf)(/* 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.ugZ},{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.ugZ},{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.v_G},{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.pY8}]},(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 */
(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};var 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.ugZ},{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.ugZ},{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.v_G},{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.pY8}]},(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||""})))))))))}}var 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}}));var 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:f,paddingLeftTablet:y,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:f,valueLeftTablet:y,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.OT,{...e,hasOverlay:!0})))})),V=o(1313);const F=["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"],O=[["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")}]]]];var 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:f,className:y,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,D]=(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 q(),n.addEventListener("resize",q),j(),()=>{n.removeEventListener("resize",q)}}),[]);const q=()=>{const e=document.defaultView;return D(e.innerWidth),e.innerWidth},G=(0,n.createElement)(r.pG,{...e,label:(0,u.__)("Add background to hero","coblocks")});let J=s()("wp-block-coblocks-hero",y);o.coblocks&&void 0!==o.coblocks.id&&(J=s()(J,`coblocks-hero-${o.coblocks.id}`));const Z=s()("wp-block-coblocks-hero__inner",...(0,r.Ro)(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.DS)(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},Y={bottom:!1,bottomLeft:!1,bottomRight:!1,left:!0,right:!0,top:!1,topLeft:!1,topRight:!1};let K={target:"height",value:A};return H<=768&&H>514?K={target:"heightTablet",value:L||A}:H<=514&&(K={target:"heightMobile",value:z||A}),(0,n.createElement)(n.Fragment,null,G,m&&(0,n.createElement)(U,{...e}),m&&(0,n.createElement)(S,{...e}),(0,n.createElement)("div",{className:J},T?(0,n.createElement)("div",{className:Z,style:Q},(0,V.isBlobURL)(B)&&(0,n.createElement)(g.Spinner,null),(0,r.QF)(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:Y,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=f+"px"},onResizeStop:(e,o,n,l)=>{b({maxWidth:parseInt(f+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(f+l.width,10)+"px"},showHandle:m,size:{width:f}},(0,n.createElement)(i.InnerBlocks,{__experimentalCaptureToolbars:!0,allowedBlocks:F,template:O,templateInsertUpdatesSelection:!1,templateLock:!1})))):(0,n.createElement)(g.ResizableBox,{className:Z,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(K.target){case"heightTablet":b({heightTablet:parseInt(K.value+i.height,10)});break;case"heightMobile":b({heightMobile:parseInt(K.value+i.height,10)});break;default:b({height:parseInt(K.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:K.value},style:Q},(0,V.isBlobURL)(B)&&(0,n.createElement)(g.Spinner,null),(0,r.QF)(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:Y,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=f+"px"},onResizeStop:(e,o,n,l)=>{b({maxWidth:parseInt(f+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(f+l.width,10)+"px"},showHandle:m,size:{width:f}},(0,n.createElement)(i.InnerBlocks,{allowedBlocks:F,template:O,templateInsertUpdatesSelection:!1,templateLock:!1}))))))}))},9881:function(e,t,o){var n=o(7816),l=o(9291)(n);e.exports=l},8483:function(e,t,o){var n=o(5063)();e.exports=n},7816:function(e,t,o){var n=o(8483),l=o(3674);e.exports=function(e,t){return e&&n(e,t,l)}},9199:function(e,t,o){var n=o(9881),l=o(8612);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}},9291:function(e,t,o){var n=o(8612);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}}},5063:function(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}}},5161:function(e,t,o){var n=o(9932),l=o(7206),s=o(9199),i=o(1469);e.exports=function(e,t){return(i(e)?n:s)(e,l(t,3))}}}]);