(()=>{"use strict";var e,t={592:()=>{const e=window.wp.blocks,t=window.wp.i18n,n=window.wp.blockEditor,o=window.wp.components,r=window.wp.data,i=window.ReactJSXRuntime,a=JSON.parse('{"UU":"nemtly/event-date"}');(0,e.registerBlockType)(a.UU,{edit:function({attributes:e,setAttributes:a,context:l}){const{format:s,showTime:m,showIcon:d}=e,{postId:c,postType:u}=l,v=(0,n.useBlockProps)({className:"nemtly-event-date"}),{eventDate:h,eventTime:p,eventType:g,isLoading:y}=(0,r.useSelect)((e=>{if(!c)return{eventDate:null,eventTime:null,eventType:null,isLoading:!1};const{getEditedEntityRecord:t,hasFinishedResolution:n}=e("core"),o=t("postType",u||"nemtly_event",c),r=n("getEditedEntityRecord",["postType",u||"nemtly_event",c]),i=o?.meta||{};return{eventDate:i.nemtly_event_date||null,eventTime:i.nemtly_event_time||null,eventType:i.nemtly_event_type||null,isLoading:!r}}),[c,u]);if("one-on-one"===g||"group"===g)return null;const{formattedDate:f,formattedTime:w}=((e,t)=>{if(!e)return{formattedDate:null,formattedTime:null};try{const n=new Date(e+"T"+(t||"00:00"));if(isNaN(n.getTime()))return{formattedDate:e,formattedTime:t};const o=n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let r=null;return t&&(r=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",hour12:!0})),{formattedDate:o,formattedTime:r}}catch(n){return{formattedDate:e,formattedTime:t}}})(h,p),b=f||(0,t.__)("Event Date","nemtly-booking"),T=w||(0,t.__)("12:00 PM","nemtly-booking");return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.InspectorControls,{children:(0,i.jsxs)(o.PanelBody,{title:(0,t.__)("Settings","nemtly-booking"),children:[(0,i.jsx)(o.TextControl,{label:(0,t.__)("Date Format","nemtly-booking"),value:s,onChange:e=>a({format:e}),help:(0,t.__)("Enter a PHP date format string (e.g. F j, Y). Leave empty for system default.","nemtly-booking")}),(0,i.jsx)(o.ToggleControl,{label:(0,t.__)("Show Time","nemtly-booking"),checked:m,onChange:e=>a({showTime:e})}),(0,i.jsx)(o.ToggleControl,{label:(0,t.__)("Show Icon","nemtly-booking"),checked:d,onChange:e=>a({showIcon:e})})]})}),(0,i.jsxs)("div",{...v,children:[y&&(0,i.jsx)(o.Spinner,{}),!y&&(0,i.jsxs)(i.Fragment,{children:[d&&(0,i.jsx)("svg",{width:"20",height:"20",className:"nb-mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:(0,i.jsx)("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"})}),(0,i.jsx)("span",{className:"nemtly-date-preview",children:b}),m&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"nemtly-event-time-separator",children:" | "}),(0,i.jsx)("span",{className:"nemtly-time-preview",children:T})]})]})]})]})},save:()=>null})}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.m=t,e=[],o.O=(t,n,r,i)=>{if(!n){var a=1/0;for(d=0;d<e.length;d++){for(var[n,r,i]=e[d],l=!0,s=0;s<n.length;s++)(!1&i||a>=i)&&Object.keys(o.O).every((e=>o.O[e](n[s])))?n.splice(s--,1):(l=!1,i<a&&(a=i));if(l){e.splice(d--,1);var m=r();void 0!==m&&(t=m)}}return t}i=i||0;for(var d=e.length;d>0&&e[d-1][2]>i;d--)e[d]=e[d-1];e[d]=[n,r,i]},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={532:0,4:0};o.O.j=t=>0===e[t];var t=(t,n)=>{var r,i,[a,l,s]=n,m=0;if(a.some((t=>0!==e[t]))){for(r in l)o.o(l,r)&&(o.m[r]=l[r]);if(s)var d=s(o)}for(t&&t(n);m<a.length;m++)i=a[m],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(d)},n=globalThis.webpackChunknemtly_booking=globalThis.webpackChunknemtly_booking||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var r=o.O(void 0,[4],(()=>o(592)));r=o.O(r)})();