(()=>{"use strict";var e={790(e){e.exports=window.ReactJSXRuntime},455(e){e.exports=window.wp.apiFetch},715(e){e.exports=window.wp.blockEditor},997(e){e.exports=window.wp.blocks},427(e){e.exports=window.wp.components},143(e){e.exports=window.wp.data},443(e){e.exports=window.wp.date},87(e){e.exports=window.wp.element},723(e){e.exports=window.wp.i18n},703(e,t,n){n(87),n(427),n(443),n(723),n(331),n(790)},447(e,t,n){n(723)},637(e,t,n){n(87),n(427),n(723),n(455),n(790)},740(e,t,n){n(87),n(427),n(723),n(828),n(790)},134(e,t,n){n(427),n(723),n(759),n(790)},828(e,t,n){n(443)},331(e,t,n){n(455)},709(e,t,n){n(723)},395(e,t,n){n(455),n(723)},185(e,t,n){n.d(t,{bz:()=>r.b}),n(828),n(331),n(703),n(447),n(637),n(740),n(134),n(759),n(596),n(845),n(395),n(264),n(709);var r=n(150)},264(e,t,n){n(455),n(395)},845(e,t,n){n(443)},596(e,t,n){n(723),n(455),n(828)},759(e,t,n){var r=n(723);(0,r.__)("Daily","fair-events"),(0,r.__)("Weekly","fair-events"),(0,r.__)("Biweekly","fair-events"),(0,r.__)("Monthly","fair-events"),(0,r.__)("After number of occurrences","fair-events"),(0,r.__)("On a specific date","fair-events")},150(e,t,n){function r(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();const e=crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=Array.from(e,e=>e.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20,32)].join("-")}n.d(t,{b:()=>r})},863(e){e.exports=JSON.parse('{"UU":"fair-payment/simple-payment"}')}};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var o=t[r++],i=t[r++];n.o(e,o)?0===i&&r++:0===i?Object.defineProperty(e,o,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,o,{enumerable:!0,get:i})}else for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.hasOwn(e,t);var r=n(997),o=n(715),i=n(143),s=n(427),a=n(723),c=n(87),l=n(185),p=n(863),d=n(790);(0,r.registerBlockType)(p.UU,{edit:({attributes:e,setAttributes:t,clientId:n})=>{const r=(0,o.useBlockProps)(),{blockId:u,amount:f,currency:m,description:w}=e,[b]=(0,c.useState)(()=>!u),[y]=(0,c.useState)(()=>u&&function(e,t){const{getClientIdsWithDescendants:n,getBlockName:r,getBlockAttributes:o}=(0,i.select)("core/block-editor");for(const i of n()){if(i===e)return!1;if(r(i)===p.UU&&o(i)?.blockId===t)return!0}return!1}(n,u)?(0,l.bz)():null);return(0,c.useEffect)(()=>{u?y&&t({blockId:y}):t({blockId:(0,l.bz)()}),m||t({currency:window.fairPaymentsConnector?.currency||"EUR"})},[]),(0,d.jsx)("div",{...r,children:(0,d.jsxs)("div",{className:"fair-payments-connector-block",children:[(0,d.jsx)("h3",{children:(0,a.__)("Simple Payment Block","fair-payments-connector")}),b&&(0,d.jsx)(s.Notice,{status:"warning",isDismissible:!1,children:(0,a.__)("This block is missing an identifier and payments will fail until the post is saved. Save or update the post now.","fair-payments-connector")}),y&&(0,d.jsx)(s.Notice,{status:"warning",isDismissible:!1,children:(0,a.__)("This block shared its identifier with another Simple Payment block on this page, which could cause buyers to be charged the wrong price. A new identifier was assigned — save or update the post now.","fair-payments-connector")}),(0,d.jsx)(s.TextControl,{label:(0,a.__)("Amount","fair-payments-connector"),value:f,onChange:e=>t({amount:e}),type:"number",min:"0",step:"0.01"}),(0,d.jsx)(s.TextControl,{label:(0,a.__)("Currency","fair-payments-connector"),value:m,onChange:e=>t({currency:e})}),(0,d.jsx)(s.TextControl,{label:(0,a.__)("Description (optional)","fair-payments-connector"),value:w,onChange:e=>t({description:e}),help:(0,a.__)("Optional description for the payment","fair-payments-connector")}),(0,d.jsxs)("div",{style:{marginTop:"20px",padding:"15px",border:"1px solid #ddd",borderRadius:"4px",backgroundColor:"#f9f9f9"},children:[(0,d.jsxs)("strong",{children:[f," ",m]}),w&&(0,d.jsx)("p",{children:w}),(0,d.jsx)("button",{className:"wp-element-button",disabled:!0,children:(0,a.__)("Pay Now","fair-payments-connector")})]})]})})}})})();
//# sourceMappingURL=index.js.map