(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var o in t)e.o(t,o)&&!e.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:t[o]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)};const r=window.wp.blocks,t=window.wp.blockEditor,o=window.wp.i18n,a=[["core/group",{style:{spacing:{blockGap:"var:preset|spacing|20",margin:{bottom:"var:preset|spacing|30"}}},layout:{type:"flex",flexWrap:"nowrap"}},[["gatherpress/icon",{icon:"calendar"}],["gatherpress/dropdown",{label:(0,o.__)("Add to calendar","gatherpress"),metadata:{name:(0,o.__)("Add to calendar","gatherpress")}},[["gatherpress/dropdown-item",{text:`${(0,o.__)("Google Calendar","gatherpress")}`,metadata:{name:(0,o.__)("Google Calendar","gatherpress")}}],["gatherpress/dropdown-item",{text:`${(0,o.__)("iCal","gatherpress")}`,metadata:{name:(0,o.__)("iCal","gatherpress")}}],["gatherpress/dropdown-item",{text:`${(0,o.__)("Outlook","gatherpress")}`,metadata:{name:(0,o.__)("Outlook","gatherpress")}}],["gatherpress/dropdown-item",{text:`${(0,o.__)("Yahoo Calendar","gatherpress")}`,metadata:{name:(0,o.__)("Yahoo Calendar","gatherpress")}}]]]]]],n=window.moment;var s=e.n(n);const d=window.wp.data;function l(){const e=(0,d.select)("core/editor")?.getCurrentPostType();return["wp_template","wp_template_part"].includes(e)}window.wp.element,window.wp.hooks,window.wp.date;const p=window.ReactJSXRuntime,c="YYYY-MM-DD HH:mm:ss";function i(){const e=g();return h(s()().format("YYYY-MM-DD HH:mm:ss"),e).add(1,"day").set("hour",18).set("minute",0).set("second",0).format(c)}function u(e){return/^[+-]\d{2}:\d{2}$/.test(e)}function h(e,r){return u(r)?s()(e).utcOffset(r,!0):s().tz(e,r)}function g(e=function(){if("object"==typeof GatherPress)return"eventDetails.dateTime.timezone".split(".").reduce((e,r)=>e?.[r],GatherPress)}()){return u(e)||s().tz.zone(e)?e:(0,o.__)("GMT","gatherpress")}i(),function(){const e=g();h(i(),e).add(2,"hours").format(c)}();const m=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"gatherpress/add-to-calendar","version":"2.0.0","title":"Add to Calendar","category":"gatherpress","icon":"calendar","example":{},"description":"Allows a member to add an event to their preferred calendar.","usesContext":["postId","queryId"],"supports":{"gatherpress":{"blockGuard":true,"postIdOverride":true},"html":false},"textdomain":"gatherpress","editorScript":"file:./index.js"}');(0,r.registerBlockType)(m,{edit:({attributes:e,context:r})=>{var o,n;const s=function(e=null){if(e){const r=(0,d.select)("core").getEntityRecord("postType","gatherpress_event",e),t=(0,d.select)("core/editor")?.getCurrentPostId();return t&&t===e?!!r:!!r&&"publish"===r.status}return"gatherpress_event"===(0,d.select)("core/editor")?.getCurrentPostType()}(null!==(o=null!==(n=e?.postId||null)&&void 0!==n?n:r?.postId)&&void 0!==o?o:null),c=(0,t.useBlockProps)({style:{opacity:l()||s?1:.3}});return(0,p.jsx)("div",{...c,children:(0,p.jsx)(t.InnerBlocks,{template:a})})},save:()=>(0,p.jsx)("div",{...t.useBlockProps.save(),children:(0,p.jsx)(t.InnerBlocks.Content,{})})})})();