(()=>{"use strict";var e,t={34:()=>{const e=window.wp.blocks,t=window.React,o=(window.wp.i18n,window.wp.blockEditor),n=window.wp.components,a=window.wp.data,l=JSON.parse('{"UU":"peachysoftware/downloadmagnet"}');(0,e.registerBlockType)(l.UU,{edit:function({attributes:e,setAttributes:l}){const{psdmId:r,psdmType:s,psdmLivePreview:p,psdmButtonId:d,psdmShowId:c}=e,i=(0,a.useSelect)((e=>e("core").getEntityRecords("postType","psdmcontent"))),{meta:m}=(0,a.useSelect)((e=>e("core").getEntityRecord("postType","psdmcontent",r)))||{};let u=[],w=!1;0!==r&&(w=!0);const h=e=>{l({psdmId:parseInt(e)}),l({psdmLivePreview:!1}),l(0===r?{psdmShowMore:!1}:{psdmShowMore:!0})};return i?(u.push({value:0,label:"Select a Download Magnet post"}),i.forEach((e=>{u.push({value:e.id,label:e.title.rendered})}))):u.push({value:0,label:"Loading..."}),(0,t.createElement)("div",{...(0,o.useBlockProps)()},(0,t.createElement)(o.InspectorControls,null,(0,t.createElement)(n.PanelBody,{title:"Download Magnet Setting"},(0,t.createElement)(n.SelectControl,{className:"wp-block-peachysoftware-downloadmagnet-panel-select",value:r,options:u,label:"Select a DownloadMagnet post",onChange:h,__nextHasNoMarginBottom:!0}),w?(0,t.createElement)(t.Fragment,null,(0,t.createElement)(n.SelectControl,{label:"Type",value:s,options:[{label:"Post Default",value:"post"},{label:"Popup",value:"popup"},{label:"Inline",value:"inline"},{label:"Attach to button",value:"button"}],onChange:e=>{l({psdmType:e}),l("button"===e?{psdmShowId:!0}:{psdmShowId:!1})},__nextHasNoMarginBottom:!0}),c?(0,t.createElement)(t.Fragment,null,(0,t.createElement)(n.TextControl,{label:"Attached Button ID",value:d,onChange:e=>{l({psdmButtonId:e})}})):""):"")),(0,t.createElement)(o.BlockControls,null),p?(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{dangerouslySetInnerHTML:psdmParsedDay})):(0,t.createElement)(t.Fragment,null,(0,t.createElement)("p",{className:"wp-block-peachysoftware-downloadmagnet-psdmBlockHeader"},(0,t.createElement)("svg",{width:"28",height:"28",version:"1.1",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",transform:"rotate(90)"},(0,t.createElement)("path",{d:"m50.102 30h49.898v-30h-49.898c-27.668 0-50.102 22.383-50.102 50 0 27.613 22.434 50 50.102 50h49.898v-30h-49.898c-10.902 0-19.738-9.1211-19.738-20s8.8359-20 19.738-20zm30.059-25h14.828v20h-14.828zm0 70h14.828v20h-14.828z"})),(0,t.createElement)("b",{className:"wp-block-peachysoftware-downloadmagnet-psdmBlockText"},"Download Magnet")),(0,t.createElement)(n.SelectControl,{className:"wp-block-peachysoftware-downloadmagnet-select",value:r,options:u,onChange:h,__nextHasNoMarginBottom:!0})))},save:function({attributes:e}){const{psdmId:n,psdmType:a,psdmButtonId:l}=e;let r="";switch(a){case"button":r="id="+n+" type=button button="+l;break;case"inline":r="id="+n+" type=inline";break;case"popup":r="id="+n+" type=popup";break;default:r=" id="+n}return(0,t.createElement)("div",{...o.useBlockProps.save()},"[downloadmagnet ",r,"]")}})}},o={};function n(e){var a=o[e];if(void 0!==a)return a.exports;var l=o[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,o,a,l)=>{if(!o){var r=1/0;for(c=0;c<e.length;c++){for(var[o,a,l]=e[c],s=!0,p=0;p<o.length;p++)(!1&l||r>=l)&&Object.keys(n.O).every((e=>n.O[e](o[p])))?o.splice(p--,1):(s=!1,l<r&&(r=l));if(s){e.splice(c--,1);var d=a();void 0!==d&&(t=d)}}return t}l=l||0;for(var c=e.length;c>0&&e[c-1][2]>l;c--)e[c]=e[c-1];e[c]=[o,a,l]},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={57:0,350:0};n.O.j=t=>0===e[t];var t=(t,o)=>{var a,l,[r,s,p]=o,d=0;if(r.some((t=>0!==e[t]))){for(a in s)n.o(s,a)&&(n.m[a]=s[a]);if(p)var c=p(n)}for(t&&t(o);d<r.length;d++)l=r[d],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(c)},o=globalThis.webpackChunkdownloadmagnet=globalThis.webpackChunkdownloadmagnet||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var a=n.O(void 0,[350],(()=>n(34)));a=n.O(a)})();