(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var l in a)e.o(a,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:a[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,a=window.wp.blocks,l=window.wp.blockEditor,i=window.wp.components,r=window.wp.serverSideRender;var n=e.n(r);const o=window.wp.i18n,s=JSON.parse('{"UU":"vitalisite-fse/before-after"}');(0,a.registerBlockType)(s.UU,{edit:function({attributes:e,setAttributes:a}){const{beforeImageId:r,beforeImageUrl:c,afterImageId:m,afterImageUrl:d,beforeLabel:f,afterLabel:g,showLabels:p,showDisclaimer:b,disclaimerText:u}=e,v=(0,l.useBlockProps)({className:"vitalisite-before-after-block"});return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(l.InspectorControls,null,(0,t.createElement)(i.PanelBody,{title:(0,o.__)("Images","vitalisite-fse")},(0,t.createElement)("p",{style:{fontWeight:600,marginBottom:"4px"}},(0,o.__)("Image Avant","vitalisite-fse")),(0,t.createElement)(l.MediaUploadCheck,null,(0,t.createElement)(l.MediaUpload,{onSelect:e=>a({beforeImageId:e.id,beforeImageUrl:e.url}),allowedTypes:["image"],value:r,render:({open:e})=>(0,t.createElement)(t.Fragment,null,(0,t.createElement)(i.Button,{onClick:e,variant:"secondary"},c?(0,o.__)("Changer","vitalisite-fse"):(0,o.__)("Choisir une image","vitalisite-fse")),c&&(0,t.createElement)("img",{src:c,alt:"before",style:{marginTop:"8px",maxWidth:"100%",borderRadius:"4px"}}))})),(0,t.createElement)("p",{style:{fontWeight:600,marginBottom:"4px",marginTop:"16px"}},(0,o.__)("Image Après","vitalisite-fse")),(0,t.createElement)(l.MediaUploadCheck,null,(0,t.createElement)(l.MediaUpload,{onSelect:e=>a({afterImageId:e.id,afterImageUrl:e.url}),allowedTypes:["image"],value:m,render:({open:e})=>(0,t.createElement)(t.Fragment,null,(0,t.createElement)(i.Button,{onClick:e,variant:"secondary"},d?(0,o.__)("Changer","vitalisite-fse"):(0,o.__)("Choisir une image","vitalisite-fse")),d&&(0,t.createElement)("img",{src:d,alt:"after",style:{marginTop:"8px",maxWidth:"100%",borderRadius:"4px"}}))}))),(0,t.createElement)(i.PanelBody,{title:(0,o.__)("Étiquettes","vitalisite-fse"),initialOpen:!1},(0,t.createElement)(i.ToggleControl,{label:(0,o.__)("Afficher les étiquettes","vitalisite-fse"),checked:p,onChange:e=>a({showLabels:e})}),p&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(i.TextControl,{label:(0,o.__)("Label Avant","vitalisite-fse"),value:f,onChange:e=>a({beforeLabel:e})}),(0,t.createElement)(i.TextControl,{label:(0,o.__)("Label Après","vitalisite-fse"),value:g,onChange:e=>a({afterLabel:e})}))),(0,t.createElement)(i.PanelBody,{title:(0,o.__)("Avis de non-responsabilité","vitalisite-fse"),initialOpen:!1},(0,t.createElement)(i.ToggleControl,{label:(0,o.__)("Afficher l'avis","vitalisite-fse"),checked:b,onChange:e=>a({showDisclaimer:e})}),b&&(0,t.createElement)(i.TextareaControl,{label:(0,o.__)("Texte","vitalisite-fse"),value:u,onChange:e=>a({disclaimerText:e})}))),(0,t.createElement)("div",{...v},(0,t.createElement)(i.Disabled,null,(0,t.createElement)(n(),{block:s.UU,attributes:e}))))},save:()=>null})})();