diff --git a/build/admin.asset.php b/build/admin.asset.php index ac8955958..8ca20bd5d 100644 --- a/build/admin.asset.php +++ b/build/admin.asset.php @@ -1 +1 @@ - array('wp-blocks', 'wp-data', 'wp-dom-ready'), 'version' => '3611bca17011dd4cf5be'); + array('wp-blocks', 'wp-data', 'wp-dom-ready'), 'version' => 'bccff6cd671b0e947c21'); diff --git a/build/admin.js b/build/admin.js index 7e0fe851e..462aead8f 100644 --- a/build/admin.js +++ b/build/admin.js @@ -1 +1,262 @@ -(()=>{"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.domReady;var t=e.n(r);const o=window.wp.blocks;function s(e){if("object"==typeof GatherPress)return e.split(".").reduce(((e,r)=>e&&e[r]),GatherPress)}window.wp.data,t()((()=>{Object.keys(s("misc.unregisterBlocks")).forEach((e=>{const r=s("misc.unregisterBlocks")[e];r&&void 0!==(0,o.getBlockType)(r)&&(0,o.unregisterBlockType)(r)}))}))})(); \ No newline at end of file +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/helpers/globals.js": +/*!********************************!*\ + !*** ./src/helpers/globals.js ***! + \********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ enableSave: () => (/* binding */ enableSave), +/* harmony export */ getFromGlobal: () => (/* binding */ getFromGlobal), +/* harmony export */ isSinglePostInEditor: () => (/* binding */ isSinglePostInEditor), +/* harmony export */ setToGlobal: () => (/* binding */ setToGlobal) +/* harmony export */ }); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__); + + +/** + * Enable the Save buttons after making an update. + * + * This function uses a hacky approach to trigger a change in the post's meta, which prompts + * Gutenberg to recognize that changes have been made and enables the Save buttons. + * It dispatches an editPost action with a non-existing meta key. + * + * @since 1.0.0 + * + * @todo This is a hacky approach and relies on the behavior described in + * https://github.com/WordPress/gutenberg/issues/13774. + * Monitor the issue for any updates or changes in the Gutenberg behavior. + */ +function enableSave() { + (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.dispatch)('core/editor')?.editPost({ + meta: { + _non_existing_meta: true + } + }); +} + +/** + * Checks if the current editor session is editing a post type entity. + * + * This function determines if the current context within the WordPress editor + * is focused on editing an entity that is classified as a post type. This includes + * single posts, pages, and custom post types. It is particularly useful for distinguishing + * editor sessions that are editing post type entities from those editing other types of content, + * such as widget areas or templates in the full site editor, ensuring that specific actions or features + * are correctly applied only when editing post type entities. + * + * @return {boolean} True if the current editor session is for editing a post type entity, false otherwise. + */ +function isSinglePostInEditor() { + return 'string' === typeof (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.select)('core/editor')?.getCurrentPostType(); +} + +/** + * Get a value from the global GatherPress object based on the provided dot-separated path. + * + * This function is designed to retrieve values from the global GatherPress object. + * It takes a dot-separated path as an argument and traverses the object to return the specified value. + * If the object or any level along the path is undefined, it returns undefined. + * + * @since 1.0.0 + * + * @param {string} args - Dot-separated path to the desired property in the GatherPress global object. + * @return {*} The value at the specified path in the GatherPress global object or undefined if not found. + */ +function getFromGlobal(args) { + // eslint-disable-next-line no-undef + if ('object' !== typeof GatherPress) { + return undefined; + } + return args.split('.').reduce( + // eslint-disable-next-line no-undef + (GatherPress, level) => GatherPress && GatherPress[level], + // eslint-disable-next-line no-undef + GatherPress); +} + +/** + * Set a value to a global object based on the provided path. + * + * This function allows setting values within a nested global object using a dot-separated path. + * If the global object (GatherPress) does not exist, it will be initialized. + * + * @since 1.0.0 + * + * @param {string} args - Dot-separated path to the property. + * @param {*} value - The value to set. + * + * @return {void} + */ +function setToGlobal(args, value) { + // eslint-disable-next-line no-undef + if ('object' !== typeof GatherPress) { + return; + } + const properties = args.split('.'); + const last = properties.pop(); + + // eslint-disable-next-line no-undef + properties.reduce((all, item) => { + var _all$item; + return (_all$item = all[item]) !== null && _all$item !== void 0 ? _all$item : all[item] = {}; + }, GatherPress)[last] = value; +} + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/dom-ready": +/*!**********************************!*\ + !*** external ["wp","domReady"] ***! + \**********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["domReady"]; + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +/*!**********************!*\ + !*** ./src/admin.js ***! + \**********************/ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/dom-ready */ "@wordpress/dom-ready"); +/* harmony import */ var _wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _helpers_globals__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers/globals */ "./src/helpers/globals.js"); +/** + * WordPress dependencies. + */ + + + +/** + * Internal dependencies. + */ + + +/** + * Remove Unwanted Blocks + * + * This script removes unwanted blocks from the localized array. + * It utilizes the `domReady` function to ensure the DOM is ready before execution. + * It iterates through the keys of the 'unregister_blocks' array obtained from the global scope, + * retrieves the block name, and unregisters the block using the `unregisterBlockType` function. + * + * @since 1.0.0 + */ + +// Execute the following code when the DOM is ready. +_wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_0___default()(() => { + // Iterate through keys of the 'unregister_blocks' array in the global scope. + Object.keys((0,_helpers_globals__WEBPACK_IMPORTED_MODULE_2__.getFromGlobal)('misc.unregisterBlocks')).forEach(key => { + // Retrieve the block name using the key. + const blockName = (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_2__.getFromGlobal)('misc.unregisterBlocks')[key]; + + // Check if the block name is defined and unregister the block. + if (blockName && 'undefined' !== typeof (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.getBlockType)(blockName)) { + (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.unregisterBlockType)(blockName); + } + }); +}); +})(); + +/******/ })() +; +//# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/build/admin_style.asset.php b/build/admin_style.asset.php index 16bcf03a2..10231999a 100644 --- a/build/admin_style.asset.php +++ b/build/admin_style.asset.php @@ -1 +1 @@ - array(), 'version' => 'ceb7c66a2b1e518e5f59'); + array(), 'version' => '54ce19837a9ab5960801'); diff --git a/build/admin_style.css b/build/admin_style.css index b09bce20a..a98b91de7 100644 --- a/build/admin_style.css +++ b/build/admin_style.css @@ -1 +1,14 @@ -.gp-admin__membership-check{align-items:center;display:flex;gap:1rem;padding:.5rem}.gp-admin__membership-check>div:last-child{margin-left:auto} +/*!***************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/admin.scss ***! + \***************************************************************************************************************************************************************************************************************************************/ +.gp-admin__membership-check { + align-items: center; + display: flex; + gap: 1rem; + padding: 0.5rem; +} +.gp-admin__membership-check > div:last-child { + margin-left: auto; +} + +/*# sourceMappingURL=admin_style.css.map*/ \ No newline at end of file diff --git a/build/admin_style.js b/build/admin_style.js index e69de29bb..0cbe9c75a 100644 --- a/build/admin_style.js +++ b/build/admin_style.js @@ -0,0 +1,28 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ // The require scope +/******/ var __webpack_require__ = {}; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +/*!************************!*\ + !*** ./src/admin.scss ***! + \************************/ +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + +/******/ })() +; +//# sourceMappingURL=admin_style.js.map \ No newline at end of file diff --git a/build/blocks/add-to-calendar/add-to-calendar.asset.php b/build/blocks/add-to-calendar/add-to-calendar.asset.php index a99e87807..90bd4a096 100644 --- a/build/blocks/add-to-calendar/add-to-calendar.asset.php +++ b/build/blocks/add-to-calendar/add-to-calendar.asset.php @@ -1 +1 @@ - array('wp-dom-ready'), 'version' => '3ebd875b9e03f34024e6'); + array('wp-dom-ready'), 'version' => 'c5e07b505ee22c88a97a'); diff --git a/build/blocks/add-to-calendar/add-to-calendar.js b/build/blocks/add-to-calendar/add-to-calendar.js index 875654888..9eecda5b2 100644 --- a/build/blocks/add-to-calendar/add-to-calendar.js +++ b/build/blocks/add-to-calendar/add-to-calendar.js @@ -1 +1,163 @@ -(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var l in n)e.o(n,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:n[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.domReady,n=e=>{e.preventDefault();const t=e.target.nextElementSibling.style.display,n=document.querySelectorAll(".gp-add-to-calendar__list");for(let e=0;e{(()=>{const e=document.querySelectorAll(".gp-add-to-calendar");for(let t=0;t{n.closest(".gp-add-to-calendar")||(e[t].querySelector(".gp-add-to-calendar__list").style.display="none")})),document.addEventListener("keydown",(({key:n})=>{"Escape"===n&&(e[t].querySelector(".gp-add-to-calendar__list").style.display="none")}))})()}))})(); \ No newline at end of file +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "@wordpress/dom-ready": +/*!**********************************!*\ + !*** external ["wp","domReady"] ***! + \**********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["domReady"]; + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +/*!*******************************************************!*\ + !*** ./src/blocks/add-to-calendar/add-to-calendar.js ***! + \*******************************************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/dom-ready */ "@wordpress/dom-ready"); +/* harmony import */ var _wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_0__); +/** + * WordPress dependencies. + */ + + +/** + * Toggle to Show/Hide Calendar options. + * + * @param {TouchEvent} e Event. + */ +const addToCalendarToggle = e => { + e.preventDefault(); + const currentListDisplay = e.target.nextElementSibling.style.display; + const lists = document.querySelectorAll('.gp-add-to-calendar__list'); + for (let i = 0; i < lists.length; i++) { + lists[i].style.display = 'none'; + } + e.target.nextElementSibling.style.display = 'none' === currentListDisplay ? 'flex' : 'none'; +}; + +/** + * Initialize all Add To Calendar blocks. + * + * This function initializes the behavior of Add To Calendar blocks on the page. + * It sets up event listeners for click and keydown events to toggle the display + * of the calendar options list. The function targets elements with the class + * 'gp-add-to-calendar' and adds event listeners to handle user interactions. + * + * @since 1.0.0 + * + * @return {void} + */ +const addToCalendarInit = () => { + const containers = document.querySelectorAll('.gp-add-to-calendar'); + for (let i = 0; i < containers.length; i++) { + containers[i].querySelector('.gp-add-to-calendar__init').addEventListener('click', addToCalendarToggle, false); + document.addEventListener('click', ({ + target + }) => { + if (!target.closest('.gp-add-to-calendar')) { + containers[i].querySelector('.gp-add-to-calendar__list').style.display = 'none'; + } + }); + document.addEventListener('keydown', ({ + key + }) => { + if ('Escape' === key) { + containers[i].querySelector('.gp-add-to-calendar__list').style.display = 'none'; + } + }); + } +}; + +/** + * Callback for when the DOM is ready. + * + * This callback function is executed when the DOM is fully loaded and ready for manipulation. + * It calls the `addToCalendarInit` function to initialize the behavior of Add To Calendar blocks + * on the page, setting up event listeners for user interactions. + * + * @since 1.0.0 + * + * @return {void} + */ +_wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_0___default()(() => { + addToCalendarInit(); +}); +})(); + +/******/ })() +; +//# sourceMappingURL=add-to-calendar.js.map \ No newline at end of file diff --git a/build/blocks/add-to-calendar/index.asset.php b/build/blocks/add-to-calendar/index.asset.php index 0598c7b90..8ff45f2a0 100644 --- a/build/blocks/add-to-calendar/index.asset.php +++ b/build/blocks/add-to-calendar/index.asset.php @@ -1 +1 @@ - array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '105e21bbfab9c0d33514'); + array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'd99d220bb310f2294e02'); diff --git a/build/blocks/add-to-calendar/index.js b/build/blocks/add-to-calendar/index.js index 6466ca650..90532e7fa 100644 --- a/build/blocks/add-to-calendar/index.js +++ b/build/blocks/add-to-calendar/index.js @@ -1 +1,402 @@ -(()=>{"use strict";var e,t={5045:()=>{const e=window.wp.blocks,t=window.React,r=window.wp.i18n,n=window.wp.blockEditor,a=window.wp.components,l=e=>{const{isSelected:r}=e,n=r?"none":"block";return(0,t.createElement)("div",{style:{position:"relative"}},e.children,(0,t.createElement)("div",{style:{position:"absolute",top:"0",right:"0",bottom:"0",left:"0",display:n}}))},o=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"gatherpress/add-to-calendar","version":"1.0.0","title":"Add to Calendar","category":"gatherpress","icon":"calendar","example":{},"description":"Allows a member to add an event to their preferred calendar.","attributes":{"blockId":{"type":"string"}},"supports":{"html":false},"textdomain":"gatherpress","editorScript":"file:./index.js","style":"file:./style-index.css","viewScript":"file:./add-to-calendar.js","render":"file:./render.php"}');(0,e.registerBlockType)(o,{edit:()=>{const e=(0,n.useBlockProps)();return(0,t.createElement)("div",{...e},(0,t.createElement)(l,null,(0,t.createElement)(a.Flex,{justify:"normal",align:"center",gap:"4"},(0,t.createElement)(a.FlexItem,{display:"flex",className:"gp-event-date__icon"},(0,t.createElement)(a.Icon,{icon:"calendar"})),(0,t.createElement)(a.FlexItem,null,(0,t.createElement)("a",{href:"#"},(0,r.__)("Add to calendar","gatherpress"))))))},save:()=>null})}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var l=r[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,r,a,l)=>{if(!r){var o=1/0;for(d=0;d=l)&&Object.keys(n.O).every((e=>n.O[e](r[i])))?r.splice(i--,1):(s=!1,l0&&e[d-1][2]>l;d--)e[d]=e[d-1];e[d]=[r,a,l]},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={981:0,443:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var a,l,[o,s,i]=r,c=0;if(o.some((t=>0!==e[t]))){for(a in s)n.o(s,a)&&(n.m[a]=s[a]);if(i)var d=i(n)}for(t&&t(r);cn(5045)));a=n.O(a)})(); \ No newline at end of file +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/blocks/add-to-calendar/edit.js": +/*!********************************************!*\ + !*** ./src/blocks/add-to-calendar/edit.js ***! + \********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _components_EditCover__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../components/EditCover */ "./src/components/EditCover.js"); + +/** + * WordPress dependencies. + */ + + + + +/** + * Internal dependencies. + */ + + +/** + * Edit component for the GatherPress Add to Calendar block. + * + * This component renders the edit view of the GatherPress Add to Calendar block. + * It provides an interface for users to add the event to their calendar. + * The component includes an icon and a link for adding the event to the calendar. + * + * @since 1.0.0 + * + * @return {JSX.Element} The rendered React component. + */ +const Edit = () => { + const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)(); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...blockProps + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_components_EditCover__WEBPACK_IMPORTED_MODULE_4__["default"], null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Flex, { + justify: "normal", + align: "center", + gap: "4" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.FlexItem, { + display: "flex", + className: "gp-event-date__icon" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Icon, { + icon: "calendar" + })), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.FlexItem, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: "#" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Add to calendar', 'gatherpress')))))); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Edit); + +/***/ }), + +/***/ "./src/blocks/add-to-calendar/index.js": +/*!*********************************************!*\ + !*** ./src/blocks/add-to-calendar/index.js ***! + \*********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/blocks/add-to-calendar/edit.js"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/blocks/add-to-calendar/block.json"); +/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./style.scss */ "./src/blocks/add-to-calendar/style.scss"); +/** + * WordPress dependencies. + */ + + +/** + * Internal dependencies. + */ + + + + +/** + * Register the GatherPress Add to Calendar block. + * + * This code registers the GatherPress Add to Calendar block in the WordPress block editor. + * It utilizes the block metadata from the 'block.json' file and associates it with the + * edit component for rendering in the editor. The 'save' function is set to null as + * the block doesn't have a front-end representation and is only used in the editor. + * + * @since 1.0.0 + * + * @return {void} + */ + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__, { + edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"], + save: () => null +}); + +/***/ }), + +/***/ "./src/components/EditCover.js": +/*!*************************************!*\ + !*** ./src/components/EditCover.js ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); + +/** + * EditCover component for GatherPress. + * + * This component is used to create an overlay cover for the block editor. + * It is typically used to visually distinguish the selected and unselected states + * of a block in the editor. + * + * @since 1.0.0 + * + * @param {Object} props - Component properties. + * @param {boolean} props.isSelected - Indicates whether the block is selected. + * + * @return {JSX.Element} The rendered React component. + */ +const EditCover = props => { + const { + isSelected + } = props; + const display = isSelected ? 'none' : 'block'; + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + style: { + position: 'relative' + } + }, props.children, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + style: { + position: 'absolute', + top: '0', + right: '0', + bottom: '0', + left: '0', + display + } + })); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EditCover); + +/***/ }), + +/***/ "./src/blocks/add-to-calendar/style.scss": +/*!***********************************************!*\ + !*** ./src/blocks/add-to-calendar/style.scss ***! + \***********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "react": +/*!************************!*\ + !*** external "React" ***! + \************************/ +/***/ ((module) => { + +module.exports = window["React"]; + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "./src/blocks/add-to-calendar/block.json": +/*!***********************************************!*\ + !*** ./src/blocks/add-to-calendar/block.json ***! + \***********************************************/ +/***/ ((module) => { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"gatherpress/add-to-calendar","version":"1.0.0","title":"Add to Calendar","category":"gatherpress","icon":"calendar","example":{},"description":"Allows a member to add an event to their preferred calendar.","attributes":{"blockId":{"type":"string"}},"supports":{"html":false},"textdomain":"gatherpress","editorScript":"file:./index.js","style":"file:./style-index.css","viewScript":"file:./add-to-calendar.js","render":"file:./render.php"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = __webpack_modules__; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ (() => { +/******/ var deferred = []; +/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var [chunkIds, fn, priority] = deferred[i]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/jsonp chunk loading */ +/******/ (() => { +/******/ // no baseURI +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "blocks/add-to-calendar/index": 0, +/******/ "blocks/add-to-calendar/style-index": 0 +/******/ }; +/******/ +/******/ // no chunk on demand loading +/******/ +/******/ // no prefetching +/******/ +/******/ // no preloaded +/******/ +/******/ // no HMR +/******/ +/******/ // no HMR manifest +/******/ +/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); +/******/ +/******/ // install a JSONP callback for chunk loading +/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { +/******/ var [chunkIds, moreModules, runtime] = data; +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { +/******/ installedChunks[chunkId][0](); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ return __webpack_require__.O(result); +/******/ } +/******/ +/******/ var chunkLoadingGlobal = globalThis["webpackChunkgatherpress"] = globalThis["webpackChunkgatherpress"] || []; +/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); +/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module depends on other loaded chunks and execution need to be delayed +/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["blocks/add-to-calendar/style-index"], () => (__webpack_require__("./src/blocks/add-to-calendar/index.js"))) +/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); +/******/ +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/blocks/add-to-calendar/style-index.css b/build/blocks/add-to-calendar/style-index.css index 3a025cf07..0971a26eb 100644 --- a/build/blocks/add-to-calendar/style-index.css +++ b/build/blocks/add-to-calendar/style-index.css @@ -1 +1,42 @@ -.gp-add-to-calendar{position:relative}.gp-add-to-calendar__icon{align-items:flex-start;display:flex}.gp-add-to-calendar__item{align-items:center;display:flex;gap:.75rem}.gp-add-to-calendar__list{border:1px solid #ccc;border-radius:.4rem;flex-direction:column;overflow:hidden;position:absolute;width:15rem;z-index:50}.gp-add-to-calendar__list-item{border-top:1px solid #ccc;margin-top:-1px}.gp-add-to-calendar__list-item a{background-color:#fff;color:#000;display:block;padding:.5rem}.gp-add-to-calendar__list-item a:hover{background-color:#eee}.gp-add-to-calendar__row{display:flex} +/*!**************************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/blocks/add-to-calendar/style.scss ***! + \**************************************************************************************************************************************************************************************************************************************************************/ +.gp-add-to-calendar { + position: relative; +} +.gp-add-to-calendar__icon { + align-items: flex-start; + display: flex; +} +.gp-add-to-calendar__item { + align-items: center; + display: flex; + gap: 0.75rem; +} +.gp-add-to-calendar__list { + border: 1px solid #CCCCCC; + border-radius: 0.4rem; + flex-direction: column; + overflow: hidden; + position: absolute; + width: 15rem; + z-index: 50; +} +.gp-add-to-calendar__list-item { + border-top: 1px solid #CCCCCC; + margin-top: -1px; +} +.gp-add-to-calendar__list-item a { + background-color: #FFFFFF; + color: #000000; + display: block; + padding: 0.5rem; +} +.gp-add-to-calendar__list-item a:hover { + background-color: #EEEEEE; +} +.gp-add-to-calendar__row { + display: flex; +} + +/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file diff --git a/build/blocks/event-date/index.asset.php b/build/blocks/event-date/index.asset.php index 566566e80..ac49a16c9 100644 --- a/build/blocks/event-date/index.asset.php +++ b/build/blocks/event-date/index.asset.php @@ -1 +1 @@ - array('moment', 'react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n'), 'version' => '4672717c04f3422d32bc'); + array('moment', 'react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n'), 'version' => '298dc48a77fbf7bd04c0'); diff --git a/build/blocks/event-date/index.js b/build/blocks/event-date/index.js index f93da29f1..59bb26221 100644 --- a/build/blocks/event-date/index.js +++ b/build/blocks/event-date/index.js @@ -1,2 +1,1730 @@ -(()=>{"use strict";var e,t={3484:(e,t,n)=>{const r=window.wp.blocks,a=window.React,i=window.moment;var s=n.n(i);const o=window.wp.i18n,l=window.wp.blockEditor,c=window.wp.components,m=window.wp.element,d=(e,t="")=>{for(const[n,r]of Object.entries(e)){let e=n;t&&(e+="_"+String(t));const a=new CustomEvent(e,{detail:r});dispatchEvent(a)}},p=window.wp.data,u=window.wp.apiFetch;var f=n.n(u);function v(){(0,p.dispatch)("core/editor")?.editPost({meta:{_non_existing_meta:!0}})}function g(e){if("object"==typeof GatherPress)return e.split(".").reduce(((e,t)=>e&&e[t]),GatherPress)}function T(e,t){if("object"!=typeof GatherPress)return;const n=e.split("."),r=n.pop();n.reduce(((e,t)=>{var n;return null!==(n=e[t])&&void 0!==n?n:e[t]={}}),GatherPress)[r]=t}function E(){const e=s().tz(g("eventDetails.dateTime.datetime_end"),S());return"gp_event"===(0,p.select)("core/editor")?.getCurrentPostType()&&s().tz(S()).valueOf()>e.valueOf()}function h(){const e="gp_event_past",t=(0,p.dispatch)("core/notices");t.removeNotice(e),E()&&t.createNotice("warning",(0,o.__)("This event has already past.","gatherpress"),{id:e,isDismissible:!1})}const D="YYYY-MM-DDTHH:mm:ss",_="YYYY-MM-DD HH:mm:ss",w=s().tz(S()).add(1,"day").set("hour",18).set("minute",0).set("second",0).format(D),z=s().tz(w,S()).add(2,"hours").format(D);function b(){return C(g("settings.dateFormat"))+" "+C(g("settings.timeFormat"))}function S(e=g("eventDetails.dateTime.timezone")){return s().tz.zone(e)?e:(0,o.__)("GMT","gatherpress")}function y(e=""){const t=/^([+-])(\d{2}):(00|15|30|45)$/,n=e.replace(t,"$1");return n!==e?"UTC"+n+parseInt(e.replace(t,"$2")).toString()+e.replace(t,"$3").replace("00","").replace("15",".25").replace("30",".5").replace("45",".75"):e}function O(e,t=null){!function(e){const t=s().tz(g("eventDetails.dateTime.datetime_end"),S()).valueOf(),n=s().tz(e,S()).valueOf();n>=t&&k(s().tz(n,S()).add(2,"hours").format(D))}(e),T("eventDetails.dateTime.datetime_start",e),"function"==typeof t&&t(e),v()}function k(e,t=null){!function(e){const t=s().tz(g("eventDetails.dateTime.datetime_start"),S()).valueOf(),n=s().tz(e,S()).valueOf();n<=t&&O(s().tz(n,S()).subtract(2,"hours").format(D))}(e),T("eventDetails.dateTime.datetime_end",e),null!==t&&t(e),v()}function P(){const e=(0,p.select)("core/editor").isSavingPost(),t=(0,p.select)("core/editor").isAutosavingPost();"gp_event"===(0,p.select)("core/editor").getCurrentPostType()&&e&&!t&&f()({path:g("urls.eventRestApi")+"/datetime",method:"POST",data:{post_id:g("eventDetails.postId"),datetime_start:s().tz(g("eventDetails.dateTime.datetime_start"),S()).format(_),datetime_end:s().tz(g("eventDetails.dateTime.datetime_end"),S()).format(_),timezone:g("eventDetails.dateTime.timezone"),_wpnonce:g("misc.nonce")}}).then((()=>{!function(){const e="gp_event_communcation",t=(0,p.dispatch)("core/notices");t.removeNotice(e),"publish"!==(0,p.select)("core/editor").getEditedPostAttribute("status")||E()||t.createNotice("success",(0,o.__)("Send an event update to members via email?","gatherpress"),{id:e,isDismissible:!0,actions:[{onClick:()=>{d({setOpen:!0})},label:(0,o.__)("Compose Message","gatherpress")}]})}()}))}function C(e){const t={d:"DD",D:"ddd",j:"D",l:"dddd",N:"E",S:"o",w:"e",z:"DDD",W:"W",F:"MMMM",m:"MM",M:"MMM",n:"M",t:"",L:"",o:"YYYY",Y:"YYYY",y:"YY",a:"a",A:"A",B:"",g:"h",G:"H",h:"hh",H:"HH",i:"mm",s:"ss",u:"SSS",e:"zz",I:"",O:"",P:"",T:"",Z:"",c:"",r:"",U:"X"};return String(e).split("").map((e=>e in t?t[e]:e)).join("")}const x=e=>{const{isSelected:t}=e,n=t?"none":"block";return(0,a.createElement)("div",{style:{position:"relative"}},e.children,(0,a.createElement)("div",{style:{position:"absolute",top:"0",right:"0",bottom:"0",left:"0",display:n}}))},M=window.wp.date,Y=e=>{const{dateTimeStart:t}=e;return s().tz(t,S()).format(b())},F=e=>{const{dateTimeEnd:t}=e;return s().tz(t,S()).format(b())},j=e=>{const{dateTimeStart:t,setDateTimeStart:n}=e,r=(0,M.getSettings)(),i=/a(?!\\)/i.test(r.formats.time.toLowerCase().replace(/\\\\/g,"").split("").reverse().join(""));return(0,a.createElement)(c.DateTimePicker,{currentDate:t,onChange:e=>O(e,n),is12Hour:i})},$=e=>{const{dateTimeEnd:t,setDateTimeEnd:n}=e,r=(0,M.getSettings)(),i=/a(?!\\)/i.test(r.formats.time.toLowerCase().replace(/\\\\/g,"").split("").reverse().join(""));return(0,a.createElement)(c.DateTimePicker,{currentDate:t,onChange:e=>k(e,n),is12Hour:i})},I=e=>{const{dateTimeStart:t,setDateTimeStart:n}=e;return(0,m.useEffect)((()=>{n(s().tz(function(){let e=g("eventDetails.dateTime.datetime_start");return e=""!==e?s().tz(e,S()).format(D):w,T("eventDetails.dateTime.datetime_start",e),e}(),S()).format(D)),d({setDateTimeStart:t}),h()})),(0,a.createElement)(c.PanelRow,null,(0,a.createElement)(c.Flex,{direction:"column",gap:"0"},(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("label",{htmlFor:"gp-datetime-start"},(0,o.__)("Start","gatherpress"))),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Dropdown,{popoverProps:{placement:"bottom-end"},renderToggle:({isOpen:e,onToggle:n})=>(0,a.createElement)(c.Button,{id:"gp-datetime-start",onClick:n,"aria-expanded":e,isLink:!0},(0,a.createElement)(Y,{dateTimeStart:t})),renderContent:()=>(0,a.createElement)(j,{dateTimeStart:t,setDateTimeStart:n})}))))},H=e=>{const{dateTimeEnd:t,setDateTimeEnd:n}=e;return(0,m.useEffect)((()=>{n(s().tz(function(){let e=g("eventDetails.dateTime.datetime_end");return e=""!==e?s().tz(e,S()).format(D):z,T("eventDetails.dateTime.datetime_end",e),e}(),S()).format(D)),d({setDateTimeEnd:t}),h()})),(0,a.createElement)(c.PanelRow,null,(0,a.createElement)(c.Flex,{direction:"column",gap:"0"},(0,a.createElement)(c.FlexItem,null,(0,a.createElement)("label",{htmlFor:"gp-datetime-end"},(0,o.__)("End","gatherpress"))),(0,a.createElement)(c.FlexItem,null,(0,a.createElement)(c.Dropdown,{popoverProps:{placement:"bottom-end"},renderToggle:({isOpen:e,onToggle:n})=>(0,a.createElement)(c.Button,{id:"gp-datetime-end",onClick:n,"aria-expanded":e,isLink:!0},(0,a.createElement)(F,{dateTimeEnd:t})),renderContent:()=>(0,a.createElement)($,{dateTimeEnd:t,setDateTimeEnd:n})}))))},G=e=>{const{timezone:t,setTimezone:n}=e,r=g("misc.timezoneChoices");return(0,m.useEffect)((()=>{n(g("eventDetails.dateTime.timezone"))}),[n]),(0,m.useEffect)((()=>{d({setTimezone:g("eventDetails.dateTime.timezone")})})),(0,a.createElement)(c.PanelRow,null,(0,a.createElement)(c.SelectControl,{label:(0,o.__)("Time Zone","gatherpress"),value:y(t),onChange:e=>{e=function(e=""){const t=/^UTC([+-])(\d+)(.\d+)?$/,n=e.replace(t,"$1");if(n!==e){const r=e.replace(t,"$2").padStart(2,"0");let a=e.replace(t,"$3");return""===a&&(a=":00"),a=a.replace(".25",":15").replace(".5",":30").replace(".75",":45"),n+r+a}return e}(e),n(e),T("eventDetails.dateTime.timezone",e),v()}},Object.keys(r).map((e=>(0,a.createElement)("optgroup",{key:e,label:e},Object.keys(r[e]).map((t=>(0,a.createElement)("option",{key:t,value:t},r[e][t]))))))))},N=()=>{const[e,t]=(0,m.useState)(),[n,r]=(0,m.useState)(),[i,s]=(0,m.useState)();return(0,p.subscribe)(P),(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h3",null,(0,o.__)("Date & time","gatherpress")),(0,a.createElement)(I,{dateTimeStart:e,setDateTimeStart:t}),(0,a.createElement)(H,{dateTimeEnd:n,setDateTimeEnd:r}),(0,a.createElement)(G,{timezone:i,setTimezone:s}))},B=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"gatherpress/event-date","version":"1.0.0","title":"Event Date","category":"gatherpress","icon":"clock","example":{},"description":"Displays the date and time for an event.","attributes":{"eventEnd":{"type":"string"},"eventStart":{"type":"string"}},"supports":{"html":false},"textdomain":"gatherpress","editorScript":"file:./index.js","style":"file:./style-index.css","render":"file:./render.php"}');(0,r.registerBlockType)(B,{edit:()=>{const e=(0,l.useBlockProps)(),[t,n]=(0,m.useState)(w),[r,i]=(0,m.useState)(z),[d,u]=(0,m.useState)(S());return((e,t="")=>{for(const[n,r]of Object.entries(e)){let e=n;t&&(e+="_"+String(t)),addEventListener(e,(e=>{r(e.detail)}),!1)}})({setDateTimeEnd:i,setDateTimeStart:n,setTimezone:u}),(0,a.createElement)("div",{...e},(0,a.createElement)(x,null,(0,a.createElement)(c.Flex,{justify:"normal",align:"center",gap:"4"},(0,a.createElement)(c.FlexItem,{display:"flex",className:"gp-event-date__icon"},(0,a.createElement)(c.Icon,{icon:"clock"})),(0,a.createElement)(c.FlexItem,null,((e,t,n)=>{const r=C(g("settings.dateFormat")),a=C(g("settings.timeFormat")),i=g("settings.showTimezone")?"z":"",l=r+" "+a,c=S(n);let m=r+" "+a+" "+i;return s().tz(e,c).format(r)===s().tz(t,c).format(r)&&(m=a+" "+i),(0,o.sprintf)(/* translators: %1$s: datetime start, %2$s: datetime end, %3$s timezone. */ -(0,o.__)("%1$s to %2$s %3$s"),s().tz(e,c).format(l),s().tz(t,c).format(m),(d=S(d=c),(0,o.__)("GMT","gatherpress")!==d?"":function(e=""){return e.replace(":","")}(g("eventDetails.dateTime.timezone"))));var d})(t,r,d)),"string"==typeof(0,p.select)("core/editor")?.getCurrentPostType()&&(0,a.createElement)(l.InspectorControls,null,(0,a.createElement)(c.PanelBody,null,(0,a.createElement)(N,null))))))},save:()=>null})}},n={};function r(e){var a=n[e];if(void 0!==a)return a.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.m=t,e=[],r.O=(t,n,a,i)=>{if(!n){var s=1/0;for(m=0;m=i)&&Object.keys(r.O).every((e=>r.O[e](n[l])))?n.splice(l--,1):(o=!1,i0&&e[m-1][2]>i;m--)e[m]=e[m-1];e[m]=[n,a,i]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={591:0,42:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var a,i,[s,o,l]=n,c=0;if(s.some((t=>0!==e[t]))){for(a in o)r.o(o,a)&&(r.m[a]=o[a]);if(l)var m=l(r)}for(t&&t(n);cr(3484)));a=r.O(a)})(); \ No newline at end of file +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/blocks/event-date/edit.js": +/*!***************************************!*\ + !*** ./src/blocks/event-date/edit.js ***! + \***************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! moment */ "moment"); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _helpers_broadcasting__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../helpers/broadcasting */ "./src/helpers/broadcasting.js"); +/* harmony import */ var _helpers_datetime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../helpers/datetime */ "./src/helpers/datetime.js"); +/* harmony import */ var _components_EditCover__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../components/EditCover */ "./src/components/EditCover.js"); +/* harmony import */ var _components_DateTimeRange__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../components/DateTimeRange */ "./src/components/DateTimeRange.js"); +/* harmony import */ var _helpers_globals__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../helpers/globals */ "./src/helpers/globals.js"); + +/** + * External dependencies. + */ + + +/** + * WordPress dependencies. + */ + + + + + +/** + * Internal dependencies. + */ + + + + + + +/** + * Similar to get_display_datetime method in class-event.php. + * + * @param {string} start + * @param {string} end + * @param {string} tz + * @return {string} Displayed date. + */ +const displayDateTime = (start, end, tz) => { + const dateFormat = (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_7__.convertPHPToMomentFormat)((0,_helpers_globals__WEBPACK_IMPORTED_MODULE_10__.getFromGlobal)('settings.dateFormat')); + const timeFormat = (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_7__.convertPHPToMomentFormat)((0,_helpers_globals__WEBPACK_IMPORTED_MODULE_10__.getFromGlobal)('settings.timeFormat')); + const timeZoneFormat = (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_10__.getFromGlobal)('settings.showTimezone') ? 'z' : ''; + const startFormat = dateFormat + ' ' + timeFormat; + const timeZone = (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_7__.getTimeZone)(tz); + let endFormat = dateFormat + ' ' + timeFormat + ' ' + timeZoneFormat; + if (moment__WEBPACK_IMPORTED_MODULE_1___default().tz(start, timeZone).format(dateFormat) === moment__WEBPACK_IMPORTED_MODULE_1___default().tz(end, timeZone).format(dateFormat)) { + endFormat = timeFormat + ' ' + timeZoneFormat; + } + return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.sprintf)( /* translators: %1$s: datetime start, %2$s: datetime end, %3$s timezone. */ + (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('%1$s to %2$s %3$s'), moment__WEBPACK_IMPORTED_MODULE_1___default().tz(start, timeZone).format(startFormat), moment__WEBPACK_IMPORTED_MODULE_1___default().tz(end, timeZone).format(endFormat), (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_7__.getUtcOffset)(timeZone)); +}; + +/** + * Edit component for the GatherPress Event Date block. + * + * This component represents the editable view of the GatherPress Event Date block + * in the WordPress block editor. It manages the state of date, time, and timezone + * for the block and renders the user interface accordingly. The component includes + * an icon, displays the formatted date and time, and provides controls to edit the + * date and time range via the DateTimeRange component in the InspectorControls. + * + * @since 1.0.0 + * + * @return {JSX.Element} The rendered Edit component for the GatherPress Event Date block. + * + * @see {@link DateTimeRange} - Component for editing date and time range. + * @see {@link EditCover} - Component for displaying a cover over the block. + * @see {@link useBlockProps} - Custom hook for block props. + * @see {@link displayDateTime} - Function for formatting and displaying date and time. + * @see {@link Listener} - Function for adding event listeners. + */ +const Edit = () => { + const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)(); + const [dateTimeStart, setDateTimeStart] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useState)(_helpers_datetime__WEBPACK_IMPORTED_MODULE_7__.defaultDateTimeStart); + const [dateTimeEnd, setDateTimeEnd] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useState)(_helpers_datetime__WEBPACK_IMPORTED_MODULE_7__.defaultDateTimeEnd); + const [timezone, setTimezone] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useState)((0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_7__.getTimeZone)()); + (0,_helpers_broadcasting__WEBPACK_IMPORTED_MODULE_6__.Listener)({ + setDateTimeEnd, + setDateTimeStart, + setTimezone + }); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...blockProps + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_components_EditCover__WEBPACK_IMPORTED_MODULE_8__["default"], null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.Flex, { + justify: "normal", + align: "center", + gap: "4" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.FlexItem, { + display: "flex", + className: "gp-event-date__icon" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.Icon, { + icon: "clock" + })), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.FlexItem, null, displayDateTime(dateTimeStart, dateTimeEnd, timezone)), (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_10__.isSinglePostInEditor)() && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_components_DateTimeRange__WEBPACK_IMPORTED_MODULE_9__["default"], null)))))); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Edit); + +/***/ }), + +/***/ "./src/blocks/event-date/index.js": +/*!****************************************!*\ + !*** ./src/blocks/event-date/index.js ***! + \****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./edit */ "./src/blocks/event-date/edit.js"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/blocks/event-date/block.json"); +/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./style.scss */ "./src/blocks/event-date/style.scss"); +/** + * WordPress dependencies. + */ + + +/** + * Internal dependencies. + */ + + + + +/** + * Register the GatherPress Event Date block. + * + * This code registers the GatherPress Event Date block in the WordPress block editor. + * It includes metadata from the 'block.json' file, defines the block styles with 'style.scss', + * and specifies the 'edit' and 'save' components for the block. The 'edit' component is responsible + * for the block's appearance and behavior in the editor, while the 'save' component defines how + * the block should be rendered on the front end. + * + * @since 1.0.0 + * + * @return {void} + */ +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__, { + edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"], + save: () => null +}); + +/***/ }), + +/***/ "./src/components/DateTime.js": +/*!************************************!*\ + !*** ./src/components/DateTime.js ***! + \************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DateTimeEndLabel: () => (/* binding */ DateTimeEndLabel), +/* harmony export */ DateTimeEndPicker: () => (/* binding */ DateTimeEndPicker), +/* harmony export */ DateTimeStartLabel: () => (/* binding */ DateTimeStartLabel), +/* harmony export */ DateTimeStartPicker: () => (/* binding */ DateTimeStartPicker) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_date__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/date */ "@wordpress/date"); +/* harmony import */ var _wordpress_date__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_date__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! moment */ "moment"); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _helpers_datetime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helpers/datetime */ "./src/helpers/datetime.js"); + +/** + * WordPress dependencies. + */ + + + + +/** + * Internal dependencies. + */ + + +/** + * Formats the provided start date and time according to the specified label format + * and returns the formatted result in the time zone configured for the plugin. + * + * @since 1.0.0 + * + * @param {Object} props - The properties object containing the start date and time. + * @param {string} props.dateTimeStart - The start date and time to be formatted. + * + * @return {string} Formatted date and time label based on the configured format and time zone. + */ +const DateTimeStartLabel = props => { + const { + dateTimeStart + } = props; + return moment__WEBPACK_IMPORTED_MODULE_3___default().tz(dateTimeStart, (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_4__.getTimeZone)()).format((0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_4__.dateTimeLabelFormat)()); +}; + +/** + * Formats the provided end date and time according to the specified label format + * and returns the formatted result in the time zone configured for the plugin. + * + * @since 1.0.0 + * + * @param {Object} props - The properties object containing the end date and time. + * @param {string} props.dateTimeStart - The end date and time to be formatted. + * + * @return {string} Formatted date and time label based on the configured format and time zone. + */ +const DateTimeEndLabel = props => { + const { + dateTimeEnd + } = props; + return moment__WEBPACK_IMPORTED_MODULE_3___default().tz(dateTimeEnd, (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_4__.getTimeZone)()).format((0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_4__.dateTimeLabelFormat)()); +}; + +/** + * DateTimeStartPicker component for GatherPress. + * + * This component renders a DateTimePicker for selecting the start date and time of an event. + * It takes the current date and time, as well as a callback function to update the state. + * The component is configured based on the site's time settings (12-hour or 24-hour format). + * + * @since 1.0.0 + * + * @param {Object} props - Component props. + * @param {Date} props.dateTimeStart - The current date and time for the picker. + * @param {Function} props.setDateTimeStart - Callback function to update the start date and time. + * + * @return {JSX.Element} The rendered React component. + */ +const DateTimeStartPicker = props => { + const { + dateTimeStart, + setDateTimeStart + } = props; + const settings = (0,_wordpress_date__WEBPACK_IMPORTED_MODULE_1__.getSettings)(); + const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase().replace(/\\\\/g, '').split('').reverse().join('')); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.DateTimePicker, { + currentDate: dateTimeStart, + onChange: date => (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_4__.updateDateTimeStart)(date, setDateTimeStart), + is12Hour: is12HourTime + }); +}; + +/** + * DateTimeEndPicker component for GatherPress. + * + * This component renders a DateTimePicker for selecting the end date and time of an event. + * It takes the current date and time, as well as a callback function to update the state. + * The component is configured based on the site's time settings (12-hour or 24-hour format). + * + * @since 1.0.0 + * + * @param {Object} props - Component props. + * @param {Date} props.dateTimeEnd - The current date and time for the picker. + * @param {Function} props.setDateTimeEnd - Callback function to update the end date and time. + * + * @return {JSX.Element} The rendered React component. + */ +const DateTimeEndPicker = props => { + const { + dateTimeEnd, + setDateTimeEnd + } = props; + const settings = (0,_wordpress_date__WEBPACK_IMPORTED_MODULE_1__.getSettings)(); + const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase().replace(/\\\\/g, '').split('').reverse().join('')); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.DateTimePicker, { + currentDate: dateTimeEnd, + onChange: date => (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_4__.updateDateTimeEnd)(date, setDateTimeEnd), + is12Hour: is12HourTime + }); +}; + +/***/ }), + +/***/ "./src/components/DateTimeEnd.js": +/*!***************************************!*\ + !*** ./src/components/DateTimeEnd.js ***! + \***************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! moment */ "moment"); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _DateTime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DateTime */ "./src/components/DateTime.js"); +/* harmony import */ var _helpers_event__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../helpers/event */ "./src/helpers/event.js"); +/* harmony import */ var _helpers_broadcasting__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../helpers/broadcasting */ "./src/helpers/broadcasting.js"); +/* harmony import */ var _helpers_datetime__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../helpers/datetime */ "./src/helpers/datetime.js"); + +/** + * External dependencies. + */ + + +/** + * WordPress dependencies. + */ + + + + +/** + * Internal dependencies. + */ + + + + + +/** + * DateTimeEnd component for GatherPress. + * + * This component renders the end date and time selection in the editor. + * It includes a DateTimeEndPicker for selecting the end date and time. + * The component also updates the state using the setDateTimeEnd callback. + * Additionally, it broadcasts the end date and time using the Broadcaster utility. + * If the event has passed, it displays a notice using hasEventPastNotice function. + * + * @since 1.0.0 + * + * @param {Object} props - Component props. + * @param {Date} props.dateTimeEnd - The current date and time for the picker. + * @param {Function} props.setDateTimeEnd - Callback function to update the end date and time. + * + * @return {JSX.Element} The rendered React component. + */ +const DateTimeEnd = props => { + const { + dateTimeEnd, + setDateTimeEnd + } = props; + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useEffect)(() => { + setDateTimeEnd(moment__WEBPACK_IMPORTED_MODULE_1___default().tz((0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_8__.getDateTimeEnd)(), (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_8__.getTimeZone)()).format(_helpers_datetime__WEBPACK_IMPORTED_MODULE_8__.dateTimeMomentFormat)); + (0,_helpers_broadcasting__WEBPACK_IMPORTED_MODULE_7__.Broadcaster)({ + setDateTimeEnd: dateTimeEnd + }); + (0,_helpers_event__WEBPACK_IMPORTED_MODULE_6__.hasEventPastNotice)(); + }); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelRow, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Flex, { + direction: "column", + gap: "0" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.FlexItem, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", { + htmlFor: "gp-datetime-end" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('End', 'gatherpress'))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.FlexItem, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Dropdown, { + popoverProps: { + placement: 'bottom-end' + }, + renderToggle: ({ + isOpen, + onToggle + }) => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, { + id: "gp-datetime-end", + onClick: onToggle, + "aria-expanded": isOpen, + isLink: true + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_DateTime__WEBPACK_IMPORTED_MODULE_5__.DateTimeEndLabel, { + dateTimeEnd: dateTimeEnd + })), + renderContent: () => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_DateTime__WEBPACK_IMPORTED_MODULE_5__.DateTimeEndPicker, { + dateTimeEnd: dateTimeEnd, + setDateTimeEnd: setDateTimeEnd + }) + })))); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DateTimeEnd); + +/***/ }), + +/***/ "./src/components/DateTimeRange.js": +/*!*****************************************!*\ + !*** ./src/components/DateTimeRange.js ***! + \*****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _helpers_datetime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helpers/datetime */ "./src/helpers/datetime.js"); +/* harmony import */ var _components_DateTimeStart__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/DateTimeStart */ "./src/components/DateTimeStart.js"); +/* harmony import */ var _components_DateTimeEnd__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/DateTimeEnd */ "./src/components/DateTimeEnd.js"); +/* harmony import */ var _components_TimeZone__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/TimeZone */ "./src/components/TimeZone.js"); + +/** + * WordPress dependencies. + */ + + + + +/** + * Internal dependencies. + */ + + + + + +/** + * DateTimeRange component for GatherPress. + * + * This component manages the date and time range selection. It includes + * DateTimeStart, DateTimeEnd, and TimeZone components. The selected values + * for start date and time, end date and time, and timezone are managed in the + * component's state. The component subscribes to the saveDateTime function, + * which is triggered to save the selected date and time values. + * + * @since 1.0.0 + * + * @return {JSX.Element} The rendered React component. + */ +const DateTimeRange = () => { + const [dateTimeStart, setDateTimeStart] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(); + const [dateTimeEnd, setDateTimeEnd] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(); + const [timezone, setTimezone] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(); + (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.subscribe)(_helpers_datetime__WEBPACK_IMPORTED_MODULE_4__.saveDateTime); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Date & time', 'gatherpress')), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_components_DateTimeStart__WEBPACK_IMPORTED_MODULE_5__["default"], { + dateTimeStart: dateTimeStart, + setDateTimeStart: setDateTimeStart + }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_components_DateTimeEnd__WEBPACK_IMPORTED_MODULE_6__["default"], { + dateTimeEnd: dateTimeEnd, + setDateTimeEnd: setDateTimeEnd + }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_components_TimeZone__WEBPACK_IMPORTED_MODULE_7__["default"], { + timezone: timezone, + setTimezone: setTimezone + })); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DateTimeRange); + +/***/ }), + +/***/ "./src/components/DateTimeStart.js": +/*!*****************************************!*\ + !*** ./src/components/DateTimeStart.js ***! + \*****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! moment */ "moment"); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _DateTime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DateTime */ "./src/components/DateTime.js"); +/* harmony import */ var _helpers_event__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../helpers/event */ "./src/helpers/event.js"); +/* harmony import */ var _helpers_broadcasting__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../helpers/broadcasting */ "./src/helpers/broadcasting.js"); +/* harmony import */ var _helpers_datetime__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../helpers/datetime */ "./src/helpers/datetime.js"); + +/** + * External dependencies. + */ + + +/** + * WordPress dependencies. + */ + + + + +/** + * Internal dependencies. + */ + + + + + +/** + * DateTimeStart component for GatherPress. + * + * This component manages the selection of the start date and time. It uses + * DateTimeStartPicker for the user to pick the date and time. The selected + * values are formatted and broadcasted using Broadcaster. The component + * subscribes to the saveDateTime function and triggers the hasEventPastNotice + * function to handle any event past notices. + * + * @since 1.0.0 + * + * @param {Object} props - Component properties. + * @param {string} props.dateTimeStart - The current start date and time. + * @param {Function} props.setDateTimeStart - Function to set the start date and time. + * + * @return {JSX.Element} The rendered React component. + */ +const DateTimeStart = props => { + const { + dateTimeStart, + setDateTimeStart + } = props; + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useEffect)(() => { + setDateTimeStart(moment__WEBPACK_IMPORTED_MODULE_1___default().tz((0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_8__.getDateTimeStart)(), (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_8__.getTimeZone)()).format(_helpers_datetime__WEBPACK_IMPORTED_MODULE_8__.dateTimeMomentFormat)); + (0,_helpers_broadcasting__WEBPACK_IMPORTED_MODULE_7__.Broadcaster)({ + setDateTimeStart: dateTimeStart + }); + (0,_helpers_event__WEBPACK_IMPORTED_MODULE_6__.hasEventPastNotice)(); + }); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelRow, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Flex, { + direction: "column", + gap: "0" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.FlexItem, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", { + htmlFor: "gp-datetime-start" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Start', 'gatherpress'))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.FlexItem, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Dropdown, { + popoverProps: { + placement: 'bottom-end' + }, + renderToggle: ({ + isOpen, + onToggle + }) => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, { + id: "gp-datetime-start", + onClick: onToggle, + "aria-expanded": isOpen, + isLink: true + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_DateTime__WEBPACK_IMPORTED_MODULE_5__.DateTimeStartLabel, { + dateTimeStart: dateTimeStart + })), + renderContent: () => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_DateTime__WEBPACK_IMPORTED_MODULE_5__.DateTimeStartPicker, { + dateTimeStart: dateTimeStart, + setDateTimeStart: setDateTimeStart + }) + })))); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DateTimeStart); + +/***/ }), + +/***/ "./src/components/EditCover.js": +/*!*************************************!*\ + !*** ./src/components/EditCover.js ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); + +/** + * EditCover component for GatherPress. + * + * This component is used to create an overlay cover for the block editor. + * It is typically used to visually distinguish the selected and unselected states + * of a block in the editor. + * + * @since 1.0.0 + * + * @param {Object} props - Component properties. + * @param {boolean} props.isSelected - Indicates whether the block is selected. + * + * @return {JSX.Element} The rendered React component. + */ +const EditCover = props => { + const { + isSelected + } = props; + const display = isSelected ? 'none' : 'block'; + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + style: { + position: 'relative' + } + }, props.children, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + style: { + position: 'absolute', + top: '0', + right: '0', + bottom: '0', + left: '0', + display + } + })); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EditCover); + +/***/ }), + +/***/ "./src/components/TimeZone.js": +/*!************************************!*\ + !*** ./src/components/TimeZone.js ***! + \************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _helpers_broadcasting__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helpers/broadcasting */ "./src/helpers/broadcasting.js"); +/* harmony import */ var _helpers_globals__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helpers/globals */ "./src/helpers/globals.js"); +/* harmony import */ var _helpers_datetime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../helpers/datetime */ "./src/helpers/datetime.js"); + +/** + * WordPress dependencies. + */ + + + + +/** + * Internal dependencies. + */ + + + + +/** + * TimeZone component for GatherPress. + * + * This component allows users to select their preferred time zone from a list of choices. + * It includes a SelectControl with options grouped by regions. The selected time zone is + * stored in the state and broadcasted using the Broadcaster utility. + * + * @since 1.0.0 + * + * @param {Object} props - Component props. + * @param {string} props.timezone - The current selected time zone. + * @param {Function} props.setTimezone - Callback function to set the selected time zone. + * + * @return {JSX.Element} The rendered React component. + */ +const TimeZone = props => { + const { + timezone, + setTimezone + } = props; + const choices = (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_5__.getFromGlobal)('misc.timezoneChoices'); + + // Run only once. + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { + setTimezone((0,_helpers_globals__WEBPACK_IMPORTED_MODULE_5__.getFromGlobal)('eventDetails.dateTime.timezone')); + }, [setTimezone]); + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => { + (0,_helpers_broadcasting__WEBPACK_IMPORTED_MODULE_4__.Broadcaster)({ + setTimezone: (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_5__.getFromGlobal)('eventDetails.dateTime.timezone') + }); + }); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.PanelRow, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.SelectControl, { + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Time Zone', 'gatherpress'), + value: (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_6__.maybeConvertUtcOffsetForSelect)(timezone), + onChange: value => { + value = (0,_helpers_datetime__WEBPACK_IMPORTED_MODULE_6__.maybeConvertUtcOffsetForDatabase)(value); + setTimezone(value); + (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_5__.setToGlobal)('eventDetails.dateTime.timezone', value); + (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_5__.enableSave)(); + } + }, Object.keys(choices).map(group => { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("optgroup", { + key: group, + label: group + }, Object.keys(choices[group]).map(item => { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("option", { + key: item, + value: item + }, choices[group][item]); + })); + }))); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TimeZone); + +/***/ }), + +/***/ "./src/helpers/broadcasting.js": +/*!*************************************!*\ + !*** ./src/helpers/broadcasting.js ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Broadcaster: () => (/* binding */ Broadcaster), +/* harmony export */ Listener: () => (/* binding */ Listener) +/* harmony export */ }); +/** + * Broadcasts custom events based on the provided payload, optionally appending an identifier to each event type. + * + * @since 1.0.0 + * + * @param {Object} payload - An object containing data to be dispatched with custom events. + * @param {string} identifier - An optional identifier to append to each event type. + * + * @return {void} + */ +const Broadcaster = (payload, identifier = '') => { + for (const [key, value] of Object.entries(payload)) { + let type = key; + if (identifier) { + type += '_' + String(identifier); + } + const dispatcher = new CustomEvent(type, { + detail: value + }); + dispatchEvent(dispatcher); + } +}; + +/** + * Sets up event listeners for custom events based on the provided payload, optionally appending an identifier to each event type. + * When an event is triggered, the corresponding listener callback is executed with the event detail. + * + * @since 1.0.0 + * + * @param {Object} payload - An object specifying event types and their corresponding listener callbacks. + * @param {string} identifier - An optional identifier to append to each event type. + * + * @return {void} + */ +const Listener = (payload, identifier = '') => { + for (const [key, value] of Object.entries(payload)) { + let type = key; + if (identifier) { + type += '_' + String(identifier); + } + addEventListener(type, e => { + value(e.detail); + }, false); + } +}; + +/***/ }), + +/***/ "./src/helpers/datetime.js": +/*!*********************************!*\ + !*** ./src/helpers/datetime.js ***! + \*********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ convertPHPToMomentFormat: () => (/* binding */ convertPHPToMomentFormat), +/* harmony export */ dateTimeDatabaseFormat: () => (/* binding */ dateTimeDatabaseFormat), +/* harmony export */ dateTimeLabelFormat: () => (/* binding */ dateTimeLabelFormat), +/* harmony export */ dateTimeMomentFormat: () => (/* binding */ dateTimeMomentFormat), +/* harmony export */ defaultDateTimeEnd: () => (/* binding */ defaultDateTimeEnd), +/* harmony export */ defaultDateTimeStart: () => (/* binding */ defaultDateTimeStart), +/* harmony export */ getDateTimeEnd: () => (/* binding */ getDateTimeEnd), +/* harmony export */ getDateTimeStart: () => (/* binding */ getDateTimeStart), +/* harmony export */ getTimeZone: () => (/* binding */ getTimeZone), +/* harmony export */ getUtcOffset: () => (/* binding */ getUtcOffset), +/* harmony export */ maybeConvertUtcOffsetForDatabase: () => (/* binding */ maybeConvertUtcOffsetForDatabase), +/* harmony export */ maybeConvertUtcOffsetForDisplay: () => (/* binding */ maybeConvertUtcOffsetForDisplay), +/* harmony export */ maybeConvertUtcOffsetForSelect: () => (/* binding */ maybeConvertUtcOffsetForSelect), +/* harmony export */ saveDateTime: () => (/* binding */ saveDateTime), +/* harmony export */ updateDateTimeEnd: () => (/* binding */ updateDateTimeEnd), +/* harmony export */ updateDateTimeStart: () => (/* binding */ updateDateTimeStart), +/* harmony export */ validateDateTimeEnd: () => (/* binding */ validateDateTimeEnd), +/* harmony export */ validateDateTimeStart: () => (/* binding */ validateDateTimeStart) +/* harmony export */ }); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment */ "moment"); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./src/helpers/globals.js"); +/* harmony import */ var _event__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./event */ "./src/helpers/event.js"); +/** + * External dependencies. + */ + + +/** + * WordPress dependencies. + */ + + + + +/** + * Internal dependencies. + */ + + + +/** + * Date and time format string for use with Moment.js. + * + * This format is designed to represent date and time in the format + * "YYYY-MM-DDTHH:mm:ss" for compatibility with Moment.js library. + * + * @since 1.0.0 + * + * @type {string} + */ +const dateTimeMomentFormat = 'YYYY-MM-DDTHH:mm:ss'; + +/** + * Database-compatible date and time format string for storage. + * + * This format is designed to represent date and time in the format + * "YYYY-MM-DD HH:mm:ss" for compatibility with database storage. + * + * @since 1.0.0 + * + * @type {string} + */ +const dateTimeDatabaseFormat = 'YYYY-MM-DD HH:mm:ss'; + +/** + * The default start date and time for an event. + * It is set to the current date and time plus one day at 18:00:00 in the application's timezone. + * + * @since 1.0.0 + * + * @type {string} Formatted default start date and time in the application's timezone. + */ +const defaultDateTimeStart = moment__WEBPACK_IMPORTED_MODULE_0___default().tz(getTimeZone()).add(1, 'day').set('hour', 18).set('minute', 0).set('second', 0).format(dateTimeMomentFormat); + +/** + * The default end date and time for an event. + * It is calculated based on the default start date and time plus two hours in the application's timezone. + * + * @since 1.0.0 + * + * @type {string} Formatted default end date and time in the application's timezone. + */ +const defaultDateTimeEnd = moment__WEBPACK_IMPORTED_MODULE_0___default().tz(defaultDateTimeStart, getTimeZone()).add(2, 'hours').format(dateTimeMomentFormat); + +/** + * Get the combined date and time format for event labels. + * + * This function retrieves the date and time formats from global settings + * and combines them to create a formatted label for event start and end times. + * + * @since 1.0.0 + * + * @return {string} The combined date and time format for event labels. + */ +function dateTimeLabelFormat() { + const dateFormat = convertPHPToMomentFormat((0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('settings.dateFormat')); + const timeFormat = convertPHPToMomentFormat((0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('settings.timeFormat')); + return dateFormat + ' ' + timeFormat; +} + +/** + * Retrieves the timezone for the application based on the provided timezone or the global setting. + * If the provided timezone is invalid, the default timezone is set to 'GMT'. + * + * @since 1.0.0 + * + * @param {string} timezone - The timezone to be used, defaults to the global setting 'event_datetime.timezone'. + * + * @return {string} The retrieved timezone, or 'GMT' if the provided timezone is invalid. + */ +function getTimeZone(timezone = (0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.dateTime.timezone')) { + if (!!moment__WEBPACK_IMPORTED_MODULE_0___default().tz.zone(timezone)) { + return timezone; + } + return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('GMT', 'gatherpress'); +} + +/** + * Retrieves the UTC offset for a given timezone. + * If the timezone is not set to 'GMT', an empty string is returned. + * + * @since 1.0.0 + * + * @param {string} timezone - The timezone for which to retrieve the UTC offset. + * + * @return {string} UTC offset without the colon if the timezone is set to 'GMT', otherwise an empty string. + */ +function getUtcOffset(timezone) { + timezone = getTimeZone(timezone); + if ((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('GMT', 'gatherpress') !== timezone) { + return ''; + } + const offset = (0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.dateTime.timezone'); + return maybeConvertUtcOffsetForDisplay(offset); +} + +/** + * Converts a UTC offset string to a format suitable for display, + * removing the colon (:) between hours and minutes. + * + * @since 1.0.0 + * + * @param {string} offset - The UTC offset string to be converted. + * + * @return {string} Converted UTC offset without the colon, suitable for display. + */ +function maybeConvertUtcOffsetForDisplay(offset = '') { + return offset.replace(':', ''); +} + +/** + * Converts a UTC offset string to a standardized format suitable for database storage. + * The function accepts offsets in the form of 'UTC+HH:mm', 'UTC-HH:mm', 'UTC+HH', or 'UTC-HH'. + * The resulting format is '+HH:mm' or '-HH:mm'. + * + * @since 1.0.0 + * + * @param {string} offset - The UTC offset string to be converted. + * + * @return {string} Converted UTC offset in the format '+HH:mm' or '-HH:mm'. + */ +function maybeConvertUtcOffsetForDatabase(offset = '') { + // Regex: https://regex101.com/r/9bMgJd/2. + const pattern = /^UTC([+-])(\d+)(.\d+)?$/; + const sign = offset.replace(pattern, '$1'); + if (sign !== offset) { + const hour = offset.replace(pattern, '$2').padStart(2, '0'); + let minute = offset.replace(pattern, '$3'); + if ('' === minute) { + minute = ':00'; + } + minute = minute.replace('.25', ':15').replace('.5', ':30').replace('.75', ':45'); + return sign + hour + minute; + } + return offset; +} + +/** + * Converts a UTC offset string to a format suitable for dropdown selection, + * specifically in the format '+HH:mm' or '-HH:mm'. + * + * @since 1.0.0 + * + * @param {string} offset - The UTC offset string to be converted. + * + * @return {string} Converted UTC offset in the format '+HH:mm' or '-HH:mm'. + */ +function maybeConvertUtcOffsetForSelect(offset = '') { + // Regex: https://regex101.com/r/nOXCPo/2. + const pattern = /^([+-])(\d{2}):(00|15|30|45)$/; + const sign = offset.replace(pattern, '$1'); + if (sign !== offset) { + const hour = parseInt(offset.replace(pattern, '$2')).toString(); + const minute = offset.replace(pattern, '$3').replace('00', '').replace('15', '.25').replace('30', '.5').replace('45', '.75'); + return 'UTC' + sign + hour + minute; + } + return offset; +} + +/** + * Retrieves the start date and time for an event, formatted based on the plugin's timezone. + * If the start date and time is not set, it defaults to a predefined value. + * The formatted datetime is then stored in the global settings for future access. + * + * @since 1.0.0 + * + * @return {string} The formatted start date and time for the event. + */ +function getDateTimeStart() { + let dateTime = (0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.dateTime.datetime_start'); + dateTime = '' !== dateTime ? moment__WEBPACK_IMPORTED_MODULE_0___default().tz(dateTime, getTimeZone()).format(dateTimeMomentFormat) : defaultDateTimeStart; + (0,_globals__WEBPACK_IMPORTED_MODULE_4__.setToGlobal)('eventDetails.dateTime.datetime_start', dateTime); + return dateTime; +} + +/** + * Retrieves the end date and time for an event, formatted based on the plugin's timezone. + * If the end date and time is not set, it defaults to a predefined value. + * The formatted datetime is then stored in the global settings for future access. + * + * @since 1.0.0 + * + * @return {string} The formatted end date and time for the event. + */ +function getDateTimeEnd() { + let dateTime = (0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.dateTime.datetime_end'); + dateTime = '' !== dateTime ? moment__WEBPACK_IMPORTED_MODULE_0___default().tz(dateTime, getTimeZone()).format(dateTimeMomentFormat) : defaultDateTimeEnd; + (0,_globals__WEBPACK_IMPORTED_MODULE_4__.setToGlobal)('eventDetails.dateTime.datetime_end', dateTime); + return dateTime; +} + +/** + * Updates the start date and time for an event, performs validation, and triggers the save functionality. + * + * @since 1.0.0 + * + * @param {string} date - The new start date and time to be set. + * @param {Function} setDateTimeStart - Optional callback function to update the state or perform additional actions. + * + * @return {void} + */ +function updateDateTimeStart(date, setDateTimeStart = null) { + validateDateTimeStart(date); + (0,_globals__WEBPACK_IMPORTED_MODULE_4__.setToGlobal)('eventDetails.dateTime.datetime_start', date); + if ('function' === typeof setDateTimeStart) { + setDateTimeStart(date); + } + (0,_globals__WEBPACK_IMPORTED_MODULE_4__.enableSave)(); +} + +/** + * Update the end date and time of the event and trigger necessary actions. + * + * This function sets the end date and time of the event to the specified value, + * validates the input, and triggers additional actions such as updating the UI. + * + * @since 1.0.0 + * + * @param {string} date - The new end date and time in a valid format. + * @param {Function|null} setDateTimeEnd - Optional callback to update the UI with the new end date and time. + * + * @return {void} + */ +function updateDateTimeEnd(date, setDateTimeEnd = null) { + validateDateTimeEnd(date); + (0,_globals__WEBPACK_IMPORTED_MODULE_4__.setToGlobal)('eventDetails.dateTime.datetime_end', date); + if (null !== setDateTimeEnd) { + setDateTimeEnd(date); + } + (0,_globals__WEBPACK_IMPORTED_MODULE_4__.enableSave)(); +} + +/** + * Validate the start date and time of the event and perform necessary adjustments if needed. + * + * This function compares the provided start date and time with the current end date + * and time of the event. If the start date is greater than or equal to the end date, + * it adjusts the end date to ensure a minimum two-hour duration. + * + * @since 1.0.0 + * + * @param {string} dateTimeStart - The start date and time in a valid format. + * + * @return {void} + */ +function validateDateTimeStart(dateTimeStart) { + const dateTimeEndNumeric = moment__WEBPACK_IMPORTED_MODULE_0___default().tz((0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.dateTime.datetime_end'), getTimeZone()).valueOf(); + const dateTimeStartNumeric = moment__WEBPACK_IMPORTED_MODULE_0___default().tz(dateTimeStart, getTimeZone()).valueOf(); + if (dateTimeStartNumeric >= dateTimeEndNumeric) { + const dateTimeEnd = moment__WEBPACK_IMPORTED_MODULE_0___default().tz(dateTimeStartNumeric, getTimeZone()).add(2, 'hours').format(dateTimeMomentFormat); + updateDateTimeEnd(dateTimeEnd); + } +} + +/** + * Validate the end date and time of the event and perform necessary adjustments if needed. + * + * This function compares the provided end date and time with the current start date + * and time of the event. If the end date is less than or equal to the start date, + * it adjusts the start date to ensure a minimum two-hour duration. + * + * @since 1.0.0 + * + * @param {string} dateTimeEnd - The end date and time in a valid format. + * + * @return {void} + */ +function validateDateTimeEnd(dateTimeEnd) { + const dateTimeStartNumeric = moment__WEBPACK_IMPORTED_MODULE_0___default().tz((0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.dateTime.datetime_start'), getTimeZone()).valueOf(); + const dateTimeEndNumeric = moment__WEBPACK_IMPORTED_MODULE_0___default().tz(dateTimeEnd, getTimeZone()).valueOf(); + if (dateTimeEndNumeric <= dateTimeStartNumeric) { + const dateTimeStart = moment__WEBPACK_IMPORTED_MODULE_0___default().tz(dateTimeEndNumeric, getTimeZone()).subtract(2, 'hours').format(dateTimeMomentFormat); + updateDateTimeStart(dateTimeStart); + } +} + +/** + * Save the event date, time, and timezone to the server. + * + * This function sends a POST request to the server with the updated event date, + * time, and timezone information for storage. It is triggered during the process + * of saving an event post in the WordPress editor. + * + * @since 1.0.0 + * + * @return {void} + */ +function saveDateTime() { + const isSavingPost = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/editor').isSavingPost(), + isAutosavingPost = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/editor').isAutosavingPost(); + if ((0,_event__WEBPACK_IMPORTED_MODULE_5__.isEventPostType)() && isSavingPost && !isAutosavingPost) { + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ + path: (0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('urls.eventRestApi') + '/datetime', + method: 'POST', + data: { + post_id: (0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.postId'), + datetime_start: moment__WEBPACK_IMPORTED_MODULE_0___default().tz((0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.dateTime.datetime_start'), getTimeZone()).format(dateTimeDatabaseFormat), + datetime_end: moment__WEBPACK_IMPORTED_MODULE_0___default().tz((0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.dateTime.datetime_end'), getTimeZone()).format(dateTimeDatabaseFormat), + timezone: (0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.dateTime.timezone'), + _wpnonce: (0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('misc.nonce') + } + }).then(() => { + (0,_event__WEBPACK_IMPORTED_MODULE_5__.triggerEventCommuncation)(); + }); + } +} + +/** + * Convert PHP date format to Moment.js date format. + * + * This function converts a PHP date format string to its equivalent Moment.js date format. + * It uses a mapping of PHP format characters to Moment.js format characters. + * + * @see https://gist.github.com/neilrackett/7881b5bef4cb4ae63af5c3a6a244cffa + * + * @since 1.0.0 + * + * @param {string} format - The PHP date format to be converted. + * @return {string} The equivalent Moment.js date format. + */ +function convertPHPToMomentFormat(format) { + const replacements = { + d: 'DD', + D: 'ddd', + j: 'D', + l: 'dddd', + N: 'E', + S: 'o', + w: 'e', + z: 'DDD', + W: 'W', + F: 'MMMM', + m: 'MM', + M: 'MMM', + n: 'M', + t: '', + // no equivalent + L: '', + // no equivalent + o: 'YYYY', + Y: 'YYYY', + y: 'YY', + a: 'a', + A: 'A', + B: '', + // no equivalent + g: 'h', + G: 'H', + h: 'hh', + H: 'HH', + i: 'mm', + s: 'ss', + u: 'SSS', + e: 'zz', + // deprecated since Moment.js 1.6.0 + I: '', + // no equivalent + O: '', + // no equivalent + P: '', + // no equivalent + T: '', + // no equivalent + Z: '', + // no equivalent + c: '', + // no equivalent + r: '', + // no equivalent + U: 'X' + }; + return String(format).split('').map(chr => chr in replacements ? replacements[chr] : chr).join(''); +} + +/***/ }), + +/***/ "./src/helpers/event.js": +/*!******************************!*\ + !*** ./src/helpers/event.js ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ hasEventPast: () => (/* binding */ hasEventPast), +/* harmony export */ hasEventPastNotice: () => (/* binding */ hasEventPastNotice), +/* harmony export */ isEventPostType: () => (/* binding */ isEventPostType), +/* harmony export */ triggerEventCommuncation: () => (/* binding */ triggerEventCommuncation) +/* harmony export */ }); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment */ "moment"); +/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _datetime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./datetime */ "./src/helpers/datetime.js"); +/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./src/helpers/globals.js"); +/* harmony import */ var _broadcasting__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./broadcasting */ "./src/helpers/broadcasting.js"); +/** + * External dependencies. + */ + + +/** + * WordPress dependencies. + */ + + + +/** + * Internal dependencies. + */ + + + + +/** + * Checks if the current post type is an event in the GatherPress application. + * + * This function queries the current post type using the `select` function from the `core/editor` package. + * It returns `true` if the current post type is 'gp_event', indicating that the post is an event, + * and `false` otherwise. + * + * @since 1.0.0 + * + * @return {boolean} True if the current post type is 'gp_event', false otherwise. + */ +function isEventPostType() { + return 'gp_event' === (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/editor').getCurrentPostType(); +} + +/** + * Check if the event has already passed. + * + * This function compares the current time with the end time of the event + * to determine if the event has already taken place. + * + * @return {boolean} True if the event has passed; false otherwise. + */ +function hasEventPast() { + const dateTimeEnd = moment__WEBPACK_IMPORTED_MODULE_0___default().tz((0,_globals__WEBPACK_IMPORTED_MODULE_4__.getFromGlobal)('eventDetails.dateTime.datetime_end'), (0,_datetime__WEBPACK_IMPORTED_MODULE_3__.getTimeZone)()); + return 'gp_event' === (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/editor')?.getCurrentPostType() && moment__WEBPACK_IMPORTED_MODULE_0___default().tz((0,_datetime__WEBPACK_IMPORTED_MODULE_3__.getTimeZone)()).valueOf() > dateTimeEnd.valueOf(); +} + +/** + * Display a notice if the event has already passed. + * + * This function checks if the event has passed and displays a warning notice + * if so. The notice is non-dismissible to ensure the user is informed about + * the event status. + * + * @since 1.0.0 + * + * @return {void} + */ +function hasEventPastNotice() { + const id = 'gp_event_past'; + const notices = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.dispatch)('core/notices'); + notices.removeNotice(id); + if (hasEventPast()) { + notices.createNotice('warning', (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('This event has already past.', 'gatherpress'), { + id, + isDismissible: false + }); + } +} + +/** + * Trigger communication notice for event updates. + * + * This function checks if the event is published and not yet passed, + * then displays a success notice prompting the user to send an event update + * to members via email. The notice includes an action to compose the message. + * + * @since 1.0.0 + * + * @return {void} + */ +function triggerEventCommuncation() { + const id = 'gp_event_communcation'; + const notices = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.dispatch)('core/notices'); + notices.removeNotice(id); + if ('publish' === (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/editor').getEditedPostAttribute('status') && !hasEventPast()) { + notices.createNotice('success', (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Send an event update to members via email?', 'gatherpress'), { + id, + isDismissible: true, + actions: [{ + onClick: () => { + (0,_broadcasting__WEBPACK_IMPORTED_MODULE_5__.Broadcaster)({ + setOpen: true + }); + }, + label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Compose Message', 'gatherpress') + }] + }); + } +} + +/***/ }), + +/***/ "./src/helpers/globals.js": +/*!********************************!*\ + !*** ./src/helpers/globals.js ***! + \********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ enableSave: () => (/* binding */ enableSave), +/* harmony export */ getFromGlobal: () => (/* binding */ getFromGlobal), +/* harmony export */ isSinglePostInEditor: () => (/* binding */ isSinglePostInEditor), +/* harmony export */ setToGlobal: () => (/* binding */ setToGlobal) +/* harmony export */ }); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__); + + +/** + * Enable the Save buttons after making an update. + * + * This function uses a hacky approach to trigger a change in the post's meta, which prompts + * Gutenberg to recognize that changes have been made and enables the Save buttons. + * It dispatches an editPost action with a non-existing meta key. + * + * @since 1.0.0 + * + * @todo This is a hacky approach and relies on the behavior described in + * https://github.com/WordPress/gutenberg/issues/13774. + * Monitor the issue for any updates or changes in the Gutenberg behavior. + */ +function enableSave() { + (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.dispatch)('core/editor')?.editPost({ + meta: { + _non_existing_meta: true + } + }); +} + +/** + * Checks if the current editor session is editing a post type entity. + * + * This function determines if the current context within the WordPress editor + * is focused on editing an entity that is classified as a post type. This includes + * single posts, pages, and custom post types. It is particularly useful for distinguishing + * editor sessions that are editing post type entities from those editing other types of content, + * such as widget areas or templates in the full site editor, ensuring that specific actions or features + * are correctly applied only when editing post type entities. + * + * @return {boolean} True if the current editor session is for editing a post type entity, false otherwise. + */ +function isSinglePostInEditor() { + return 'string' === typeof (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.select)('core/editor')?.getCurrentPostType(); +} + +/** + * Get a value from the global GatherPress object based on the provided dot-separated path. + * + * This function is designed to retrieve values from the global GatherPress object. + * It takes a dot-separated path as an argument and traverses the object to return the specified value. + * If the object or any level along the path is undefined, it returns undefined. + * + * @since 1.0.0 + * + * @param {string} args - Dot-separated path to the desired property in the GatherPress global object. + * @return {*} The value at the specified path in the GatherPress global object or undefined if not found. + */ +function getFromGlobal(args) { + // eslint-disable-next-line no-undef + if ('object' !== typeof GatherPress) { + return undefined; + } + return args.split('.').reduce( + // eslint-disable-next-line no-undef + (GatherPress, level) => GatherPress && GatherPress[level], + // eslint-disable-next-line no-undef + GatherPress); +} + +/** + * Set a value to a global object based on the provided path. + * + * This function allows setting values within a nested global object using a dot-separated path. + * If the global object (GatherPress) does not exist, it will be initialized. + * + * @since 1.0.0 + * + * @param {string} args - Dot-separated path to the property. + * @param {*} value - The value to set. + * + * @return {void} + */ +function setToGlobal(args, value) { + // eslint-disable-next-line no-undef + if ('object' !== typeof GatherPress) { + return; + } + const properties = args.split('.'); + const last = properties.pop(); + + // eslint-disable-next-line no-undef + properties.reduce((all, item) => { + var _all$item; + return (_all$item = all[item]) !== null && _all$item !== void 0 ? _all$item : all[item] = {}; + }, GatherPress)[last] = value; +} + +/***/ }), + +/***/ "./src/blocks/event-date/style.scss": +/*!******************************************!*\ + !*** ./src/blocks/event-date/style.scss ***! + \******************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "react": +/*!************************!*\ + !*** external "React" ***! + \************************/ +/***/ ((module) => { + +module.exports = window["React"]; + +/***/ }), + +/***/ "moment": +/*!*************************!*\ + !*** external "moment" ***! + \*************************/ +/***/ ((module) => { + +module.exports = window["moment"]; + +/***/ }), + +/***/ "@wordpress/api-fetch": +/*!**********************************!*\ + !*** external ["wp","apiFetch"] ***! + \**********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["apiFetch"]; + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/date": +/*!******************************!*\ + !*** external ["wp","date"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["date"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "./src/blocks/event-date/block.json": +/*!******************************************!*\ + !*** ./src/blocks/event-date/block.json ***! + \******************************************/ +/***/ ((module) => { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"gatherpress/event-date","version":"1.0.0","title":"Event Date","category":"gatherpress","icon":"clock","example":{},"description":"Displays the date and time for an event.","attributes":{"eventEnd":{"type":"string"},"eventStart":{"type":"string"}},"supports":{"html":false},"textdomain":"gatherpress","editorScript":"file:./index.js","style":"file:./style-index.css","render":"file:./render.php"}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = __webpack_modules__; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ (() => { +/******/ var deferred = []; +/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var [chunkIds, fn, priority] = deferred[i]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/jsonp chunk loading */ +/******/ (() => { +/******/ // no baseURI +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "blocks/event-date/index": 0, +/******/ "blocks/event-date/style-index": 0 +/******/ }; +/******/ +/******/ // no chunk on demand loading +/******/ +/******/ // no prefetching +/******/ +/******/ // no preloaded +/******/ +/******/ // no HMR +/******/ +/******/ // no HMR manifest +/******/ +/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); +/******/ +/******/ // install a JSONP callback for chunk loading +/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { +/******/ var [chunkIds, moreModules, runtime] = data; +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { +/******/ installedChunks[chunkId][0](); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ return __webpack_require__.O(result); +/******/ } +/******/ +/******/ var chunkLoadingGlobal = globalThis["webpackChunkgatherpress"] = globalThis["webpackChunkgatherpress"] || []; +/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); +/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module depends on other loaded chunks and execution need to be delayed +/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["blocks/event-date/style-index"], () => (__webpack_require__("./src/blocks/event-date/index.js"))) +/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); +/******/ +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/blocks/event-date/style-index.css b/build/blocks/event-date/style-index.css index 64a4cd1e2..06d09e474 100644 --- a/build/blocks/event-date/style-index.css +++ b/build/blocks/event-date/style-index.css @@ -1 +1,17 @@ -.gp-event-date__icon{align-items:flex-start;display:flex}.gp-event-date__item{align-items:center;display:flex;gap:.75rem}.gp-event-date__row{display:flex} +/*!*********************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/blocks/event-date/style.scss ***! + \*********************************************************************************************************************************************************************************************************************************************************/ +.gp-event-date__icon { + align-items: flex-start; + display: flex; +} +.gp-event-date__item { + align-items: center; + display: flex; + gap: 0.75rem; +} +.gp-event-date__row { + display: flex; +} + +/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file diff --git a/build/blocks/events-list/events-list.asset.php b/build/blocks/events-list/events-list.asset.php index 7f5360849..1b348fa75 100644 --- a/build/blocks/events-list/events-list.asset.php +++ b/build/blocks/events-list/events-list.asset.php @@ -1 +1 @@ - array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '380b1cff8defae071d12'); + array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '2c4c47cfadd1ebb20c04'); diff --git a/build/blocks/events-list/events-list.js b/build/blocks/events-list/events-list.js index 51f018f75..be3737b2f 100644 --- a/build/blocks/events-list/events-list.js +++ b/build/blocks/events-list/events-list.js @@ -1,3 +1,9192 @@ -(()=>{var e={9960:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Doctype=t.CDATA=t.Tag=t.Style=t.Script=t.Comment=t.Directive=t.Text=t.Root=t.isTag=t.ElementType=void 0,function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"}(n=t.ElementType||(t.ElementType={})),t.isTag=function(e){return e.type===n.Tag||e.type===n.Script||e.type===n.Style},t.Root=n.Root,t.Text=n.Text,t.Directive=n.Directive,t.Comment=n.Comment,t.Script=n.Script,t.Style=n.Style,t.Tag=n.Tag,t.CDATA=n.CDATA,t.Doctype=n.Doctype},7915:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DomHandler=void 0;var i=n(9960),l=n(7790);r(n(7790),t);var a={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},s=function(){function e(e,t,n){this.dom=[],this.root=new l.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,"function"==typeof t&&(n=t,t=a),"object"==typeof e&&(t=e,e=void 0),this.callback=null!=e?e:null,this.options=null!=t?t:a,this.elementCB=null!=n?n:null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new l.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?i.ElementType.Tag:void 0,o=new l.Element(e,t,void 0,n);this.addNode(o),this.tagStack.push(o)},e.prototype.ontext=function(e){var t=this.lastNode;if(t&&t.type===i.ElementType.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{var n=new l.Text(e);this.addNode(n),this.lastNode=n}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===i.ElementType.Comment)this.lastNode.data+=e;else{var t=new l.Comment(e);this.addNode(t),this.lastNode=t}},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new l.Text(""),t=new l.CDATA([e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new l.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if("function"==typeof this.callback)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();t.DomHandler=s,t.default=s},7790:function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),t}(a);t.NodeWithChildren=p;var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=l.ElementType.CDATA,t}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),t}(p);t.CDATA=f;var m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=l.ElementType.Root,t}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),t}(p);t.Document=m;var h=function(e){function t(t,n,o,r){void 0===o&&(o=[]),void 0===r&&(r="script"===t?l.ElementType.Script:"style"===t?l.ElementType.Style:l.ElementType.Tag);var i=e.call(this,o)||this;return i.name=t,i.attribs=n,i.type=r,i}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map((function(t){var n,o;return{name:t,value:e.attribs[t],namespace:null===(n=e["x-attribsNamespace"])||void 0===n?void 0:n[t],prefix:null===(o=e["x-attribsPrefix"])||void 0===o?void 0:o[t]}}))},enumerable:!1,configurable:!0}),t}(p);function v(e){return(0,l.isTag)(e)}function y(e){return e.type===l.ElementType.CDATA}function g(e){return e.type===l.ElementType.Text}function b(e){return e.type===l.ElementType.Comment}function w(e){return e.type===l.ElementType.Directive}function _(e){return e.type===l.ElementType.Root}function E(e,t){var n;if(void 0===t&&(t=!1),g(e))n=new c(e.data);else if(b(e))n=new u(e.data);else if(v(e)){var o=t?x(e.children):[],r=new h(e.name,i({},e.attribs),o);o.forEach((function(e){return e.parent=r})),null!=e.namespace&&(r.namespace=e.namespace),e["x-attribsNamespace"]&&(r["x-attribsNamespace"]=i({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(r["x-attribsPrefix"]=i({},e["x-attribsPrefix"])),n=r}else if(y(e)){o=t?x(e.children):[];var l=new f(o);o.forEach((function(e){return e.parent=l})),n=l}else if(_(e)){o=t?x(e.children):[];var a=new m(o);o.forEach((function(e){return e.parent=a})),e["x-mode"]&&(a["x-mode"]=e["x-mode"]),n=a}else{if(!w(e))throw new Error("Not implemented yet: ".concat(e.type));var s=new d(e.name,e.data);null!=e["x-name"]&&(s["x-name"]=e["x-name"],s["x-publicId"]=e["x-publicId"],s["x-systemId"]=e["x-systemId"]),n=s}return n.startIndex=e.startIndex,n.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function x(e){for(var t=e.map((function(e){return E(e,!0)})),n=1;n{var o;!function(){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen};void 0===(o=function(){return i}.call(t,n,t,e))||(e.exports=o)}()},885:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CASE_SENSITIVE_TAG_NAMES_MAP=t.CASE_SENSITIVE_TAG_NAMES=void 0,t.CASE_SENSITIVE_TAG_NAMES=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],t.CASE_SENSITIVE_TAG_NAMES_MAP=t.CASE_SENSITIVE_TAG_NAMES.reduce((function(e,t){return e[t.toLowerCase()]=t,e}),{})},8276:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="html",o="head",r="body",i=/<([a-zA-Z]+[0-9]?)/,l=//i,a=//i,s=function(e,t){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},c=function(e,t){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},u="object"==typeof window&&window.DOMParser;if("function"==typeof u){var d=new u;s=c=function(e,t){return t&&(e="<".concat(t,">").concat(e,"")),d.parseFromString(e,"text/html")}}if("object"==typeof document&&document.implementation){var p=document.implementation.createHTMLDocument();s=function(e,t){if(t){var n=p.documentElement.querySelector(t);return n&&(n.innerHTML=e),p}return p.documentElement.innerHTML=e,p}}var f,m="object"==typeof document&&document.createElement("template");m&&m.content&&(f=function(e){return m.innerHTML=e,m.content.childNodes}),t.default=function(e){var t,u,d=e.match(i),p=d&&d[1]?d[1].toLowerCase():"";switch(p){case n:var m=c(e);return l.test(e)||null===(t=null==(v=m.querySelector(o))?void 0:v.parentNode)||void 0===t||t.removeChild(v),a.test(e)||null===(u=null==(v=m.querySelector(r))?void 0:v.parentNode)||void 0===u||u.removeChild(v),m.querySelectorAll(n);case o:case r:var h=s(e).querySelectorAll(p);return a.test(e)&&l.test(e)?h[0].parentNode.childNodes:h;default:return f?f(e):(v=s(e,r).querySelector(r)).childNodes;var v}}},4152:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=o(n(8276)),i=n(1507),l=/<(![a-zA-Z\s]+)>/;t.default=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];var t=e.match(l),n=t?t[1]:void 0;return(0,i.formatDOM)((0,r.default)(e),null,n)}},1507:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatDOM=t.formatAttributes=void 0;var o=n(7915),r=n(885);function i(e){for(var t={},n=0,o=e.length;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(5726),r=n(4606),i=["checked","value"],l=["input","select","textarea"],a={reset:!0,submit:!0};function s(e){return o.possibleStandardNames[e]}t.default=function(e,t){void 0===e&&(e={});var n={},c=Boolean(e.type&&a[e.type]);for(var u in e){var d=e[u];if((0,o.isCustomAttribute)(u))n[u]=d;else{var p=u.toLowerCase(),f=s(p);if(f){var m=(0,o.getPropertyInfo)(f);switch(i.includes(f)&&l.includes(t)&&!c&&(f=s("default"+p)),n[f]=d,m&&m.type){case o.BOOLEAN:n[f]=!0;break;case o.OVERLOADED_BOOLEAN:""===d&&(n[f]=!0)}}else r.PRESERVE_CUSTOM_ATTRIBUTES&&(n[u]=d)}}return(0,r.setStyleProp)(e.style,n),n}},3670:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=n(9196),i=o(n(484)),l=n(4606),a={cloneElement:r.cloneElement,createElement:r.createElement,isValidElement:r.isValidElement};function s(e){return l.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===e.type&&(0,l.isCustomComponent)(e.name,e.attribs)}t.default=function e(t,n){void 0===n&&(n={});for(var o=[],r="function"==typeof n.replace,c=n.transform||l.returnFirstArg,u=n.library||a,d=u.cloneElement,p=u.createElement,f=u.isValidElement,m=t.length,h=0;h1&&(y=d(y,{key:y.key||h})),o.push(c(y,v,h));continue}}if("text"!==v.type){var g=v,b={};s(g)?((0,l.setStyleProp)(g.attribs.style,g.attribs),b=g.attribs):g.attribs&&(b=(0,i.default)(g.attribs,g.name));var w=void 0;switch(v.type){case"script":case"style":v.children[0]&&(b.dangerouslySetInnerHTML={__html:v.children[0].data});break;case"tag":"textarea"===v.name&&v.children[0]?b.defaultValue=v.children[0].data:v.children&&v.children.length&&(w=e(v.children,n));break;default:continue}m>1&&(b.key=h),o.push(c(p(v.name,b,w),v,h))}else{var _=!v.data.trim().length;if(_&&v.parent&&!(0,l.canTextBeChildOfNode)(v.parent))continue;if(n.trim&&_)continue;o.push(c(v.data,v,h))}}return 1===o.length?o[0]:o}},3426:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.htmlToDOM=t.domToReact=t.attributesToProps=t.Text=t.ProcessingInstruction=t.Element=t.Comment=void 0;var r=o(n(4152));t.htmlToDOM=r.default;var i=o(n(484));t.attributesToProps=i.default;var l=o(n(3670));t.domToReact=l.default;var a=n(7915);Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return a.Comment}}),Object.defineProperty(t,"Element",{enumerable:!0,get:function(){return a.Element}}),Object.defineProperty(t,"ProcessingInstruction",{enumerable:!0,get:function(){return a.ProcessingInstruction}}),Object.defineProperty(t,"Text",{enumerable:!0,get:function(){return a.Text}});var s={lowerCaseAttributeNames:!1};t.default=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return e?(0,l.default)((0,r.default)(e,(null==t?void 0:t.htmlparser2)||s),t):[]}},4606:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.returnFirstArg=t.canTextBeChildOfNode=t.ELEMENTS_WITH_NO_TEXT_CHILDREN=t.PRESERVE_CUSTOM_ATTRIBUTES=t.setStyleProp=t.isCustomComponent=void 0;var r=n(9196),i=o(n(1476)),l=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);t.isCustomComponent=function(e,t){return e.includes("-")?!l.has(e):Boolean(t&&"string"==typeof t.is)};var a={reactCompat:!0};t.setStyleProp=function(e,t){if("string"==typeof e)if(e.trim())try{t.style=(0,i.default)(e,a)}catch(e){t.style={}}else t.style={}},t.PRESERVE_CUSTOM_ATTRIBUTES=Number(r.version.split(".")[0])>=16,t.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]),t.canTextBeChildOfNode=function(e){return!t.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(e.name)},t.returnFirstArg=function(e){return e}},8139:e=>{var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,o=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,c="";function u(e){return e?e.replace(s,c):c}e.exports=function(e,s){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];s=s||{};var d=1,p=1;function f(e){var t=e.match(n);t&&(d+=t.length);var o=e.lastIndexOf("\n");p=~o?e.length-o:p+e.length}function m(){var e={line:d,column:p};return function(t){return t.position=new h(e),b(),t}}function h(e){this.start=e,this.end={line:d,column:p},this.source=s.source}h.prototype.content=e;var v=[];function y(t){var n=new Error(s.source+":"+d+":"+p+": "+t);if(n.reason=t,n.filename=s.source,n.line=d,n.column=p,n.source=e,!s.silent)throw n;v.push(n)}function g(t){var n=t.exec(e);if(n){var o=n[0];return f(o),e=e.slice(o.length),n}}function b(){g(o)}function w(e){var t;for(e=e||[];t=_();)!1!==t&&e.push(t);return e}function _(){var t=m();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;c!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,c===e.charAt(n-1))return y("End of comment missing");var o=e.slice(2,n-2);return p+=2,f(o),e=e.slice(n),p+=2,t({type:"comment",comment:o})}}function E(){var e=m(),n=g(r);if(n){if(_(),!g(i))return y("property missing ':'");var o=g(l),s=e({type:"declaration",property:u(n[0].replace(t,c)),value:o?u(o[0].replace(t,c)):c});return g(a),s}}return b(),function(){var e,t=[];for(w(t);e=E();)!1!==e&&(t.push(e),w(t));return t}()}},2703:(e,t,n)=>{"use strict";var o=n(414);function r(){}function i(){}i.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,i,l){if(l!==o){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return n.PropTypes=n,n}},5697:(e,t,n)=>{e.exports=n(2703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},6871:(e,t,n)=>{"use strict";function o(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function r(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function i(e,t){try{var n=this.props,o=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,o)}finally{this.props=n,this.state=o}}function l(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,l=null,a=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?l="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(l="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?a="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(a="UNSAFE_componentWillUpdate"),null!==n||null!==l||null!==a){var s=e.displayName||e.name,c="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+s+" uses "+c+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==l?"\n "+l:"")+(null!==a?"\n "+a:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=o,t.componentWillReceiveProps=r),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=i;var u=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var o=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;u.call(this,e,t,o)}}return e}n.r(t),n.d(t,{polyfill:()=>l}),o.__suppressDeprecationWarning=!0,r.__suppressDeprecationWarning=!0,i.__suppressDeprecationWarning=!0},9983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var o=Object.assign||function(e){for(var t=1;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t0&&0==(g-=1)&&u.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(s.returnFocus(n.props.preventScroll),s.teardownScopedFocus()):s.popWithoutFocus()),n.props.onAfterClose&&n.props.onAfterClose(),m.default.deregister(n)},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(s.setupScopedFocus(n.node),s.markForFocusLater()),n.setState({isOpen:!0},(function(){n.openAnimationFrame=requestAnimationFrame((function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen({overlayEl:n.overlay,contentEl:n.content})}))})))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus({preventScroll:!0})},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},(function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())}))},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){(function(e){return"Tab"===e.code||9===e.keyCode})(e)&&(0,c.default)(n.content,e),n.props.shouldCloseOnEsc&&function(e){return"Escape"===e.code||27===e.keyCode}(e)&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault()},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var o="object"===(void 0===t?"undefined":r(t))?t:{base:y[e],afterOpen:y[e]+"--after-open",beforeClose:y[e]+"--before-close"},i=o.base;return n.state.afterOpen&&(i=i+" "+o.afterOpen),n.state.beforeClose&&(i=i+" "+o.beforeClose),"string"==typeof t&&t?i+" "+t:i},n.attributesFromObject=function(e,t){return Object.keys(t).reduce((function(n,o){return n[e+"-"+o]=t[o],n}),{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(e,t){this.props.isOpen&&!e.isOpen?this.open():!this.props.isOpen&&e.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!t.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.state.isOpen&&this.afterClose(),clearTimeout(this.closeTimer),cancelAnimationFrame(this.openAnimationFrame)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,o=e.htmlOpenClassName,r=e.bodyOpenClassName,i=e.parentSelector,l=i&&i().ownerDocument||document;r&&d.add(l.body,r),o&&d.add(l.getElementsByTagName("html")[0],o),n&&(g+=1,u.hide(t)),m.default.register(this)}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.className,r=e.overlayClassName,i=e.defaultStyles,l=e.children,a=n?{}:i.content,s=r?{}:i.overlay;if(this.shouldBeClosed())return null;var c={ref:this.setOverlayRef,className:this.buildClassName("overlay",r),style:o({},s,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},u=o({id:t,ref:this.setContentRef,style:o({},a,this.props.style.content),className:this.buildClassName("content",n),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",o({modal:!0},this.props.aria)),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),d=this.props.contentElement(u,l);return this.props.overlayElement(c,d)}}]),t}(l.Component);b.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},b.propTypes={isOpen:a.default.bool.isRequired,defaultStyles:a.default.shape({content:a.default.object,overlay:a.default.object}),style:a.default.shape({content:a.default.object,overlay:a.default.object}),className:a.default.oneOfType([a.default.string,a.default.object]),overlayClassName:a.default.oneOfType([a.default.string,a.default.object]),parentSelector:a.default.func,bodyOpenClassName:a.default.string,htmlOpenClassName:a.default.string,ariaHideApp:a.default.bool,appElement:a.default.oneOfType([a.default.instanceOf(f.default),a.default.instanceOf(p.SafeHTMLCollection),a.default.instanceOf(p.SafeNodeList),a.default.arrayOf(a.default.instanceOf(f.default))]),onAfterOpen:a.default.func,onAfterClose:a.default.func,onRequestClose:a.default.func,closeTimeoutMS:a.default.number,shouldFocusAfterRender:a.default.bool,shouldCloseOnOverlayClick:a.default.bool,shouldReturnFocusAfterClose:a.default.bool,preventScroll:a.default.bool,role:a.default.string,contentLabel:a.default.string,aria:a.default.object,data:a.default.object,children:a.default.node,shouldCloseOnEsc:a.default.bool,overlayRef:a.default.func,contentRef:a.default.func,id:a.default.string,overlayElement:a.default.func,contentElement:a.default.func,testId:a.default.string},t.default=b,e.exports=t.default},7149:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){l&&(l.removeAttribute?l.removeAttribute("aria-hidden"):null!=l.length?l.forEach((function(e){return e.removeAttribute("aria-hidden")})):document.querySelectorAll(l).forEach((function(e){return e.removeAttribute("aria-hidden")}))),l=null},t.log=function(){},t.assertNodeList=a,t.setElement=function(e){var t=e;if("string"==typeof t&&i.canUseDOM){var n=document.querySelectorAll(t);a(n,t),t=n}return l=t||l},t.validateElement=s,t.hide=function(e){var t=!0,n=!1,o=void 0;try{for(var r,i=s(e)[Symbol.iterator]();!(t=(r=i.next()).done);t=!0)r.value.setAttribute("aria-hidden","true")}catch(e){n=!0,o=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw o}}},t.show=function(e){var t=!0,n=!1,o=void 0;try{for(var r,i=s(e)[Symbol.iterator]();!(t=(r=i.next()).done);t=!0)r.value.removeAttribute("aria-hidden")}catch(e){n=!0,o=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw o}}},t.documentNotReadyOrSSRTesting=function(){l=null};var o,r=(o=n(2473))&&o.__esModule?o:{default:o},i=n(1112),l=null;function a(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function s(e){var t=e||l;return t?Array.isArray(t)||t instanceof HTMLCollection||t instanceof NodeList?t:[t]:((0,r.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),[])}},5063:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){for(var e=[i,l],t=0;t0?(document.body.firstChild!==i&&document.body.insertBefore(i,document.body.firstChild),document.body.lastChild!==l&&document.body.appendChild(l)):(i.parentElement&&i.parentElement.removeChild(i),l.parentElement&&l.parentElement.removeChild(l))}))},2409:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){var e=document.getElementsByTagName("html")[0];for(var t in n)r(e,n[t]);var i=document.body;for(var l in o)r(i,o[l]);n={},o={}},t.log=function(){};var n={},o={};function r(e,t){e.classList.remove(t)}t.add=function(e,t){return r=e.classList,i="html"==e.nodeName.toLowerCase()?n:o,void t.split(" ").forEach((function(e){!function(e,t){e[t]||(e[t]=0),e[t]+=1}(i,e),r.add(e)}));var r,i},t.remove=function(e,t){return r=e.classList,i="html"==e.nodeName.toLowerCase()?n:o,void t.split(" ").forEach((function(e){!function(e,t){e[t]&&(e[t]-=1)}(i,e),0===i[e]&&r.remove(e)}));var r,i}},9685:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){i=[]},t.log=function(){},t.handleBlur=s,t.handleFocus=c,t.markForFocusLater=function(){i.push(document.activeElement)},t.returnFocus=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=null;try{return void(0!==i.length&&(t=i.pop()).focus({preventScroll:e}))}catch(e){console.warn(["You tried to return focus to",t,"but it is not in the DOM anymore"].join(" "))}},t.popWithoutFocus=function(){i.length>0&&i.pop()},t.setupScopedFocus=function(e){l=e,window.addEventListener?(window.addEventListener("blur",s,!1),document.addEventListener("focus",c,!0)):(window.attachEvent("onBlur",s),document.attachEvent("onFocus",c))},t.teardownScopedFocus=function(){l=null,window.addEventListener?(window.removeEventListener("blur",s),document.removeEventListener("focus",c)):(window.detachEvent("onBlur",s),document.detachEvent("onFocus",c))};var o,r=(o=n(7845))&&o.__esModule?o:{default:o},i=[],l=null,a=!1;function s(){a=!0}function c(){if(a){if(a=!1,!l)return;setTimeout((function(){l.contains(document.activeElement)||((0,r.default)(l)[0]||l).focus()}),0)}}},9623:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.log=function(){console.log("portalOpenInstances ----------"),console.log(o.openInstances.length),o.openInstances.forEach((function(e){return console.log(e)})),console.log("end portalOpenInstances ----------")},t.resetState=function(){o=new n};var n=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.register=function(e){-1===t.openInstances.indexOf(e)&&(t.openInstances.push(e),t.emit("register"))},this.deregister=function(e){var n=t.openInstances.indexOf(e);-1!==n&&(t.openInstances.splice(n,1),t.emit("deregister"))},this.subscribe=function(e){t.subscribers.push(e)},this.emit=function(e){t.subscribers.forEach((function(n){return n(e,t.openInstances.slice())}))},this.openInstances=[],this.subscribers=[]},o=new n;t.default=o},1112:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canUseDOM=t.SafeNodeList=t.SafeHTMLCollection=void 0;var o,r=((o=n(8875))&&o.__esModule?o:{default:o}).default,i=r.canUseDOM?window.HTMLElement:{};t.SafeHTMLCollection=r.canUseDOM?window.HTMLCollection:{},t.SafeNodeList=r.canUseDOM?window.NodeList:{},t.canUseDOM=r.canUseDOM,t.default=i},8338:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,r.default)(e);if(n.length){var o=void 0,l=t.shiftKey,a=n[0],s=n[n.length-1],c=i();if(e===c){if(!l)return;o=s}if(s!==c||l||(o=a),a===c&&l&&(o=s),o)return t.preventDefault(),void o.focus();var u=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null!=u&&"Chrome"!=u[1]&&null==/\biPod\b|\biPad\b/g.exec(navigator.userAgent)){var d=n.indexOf(c);if(d>-1&&(d+=l?-1:1),void 0===(o=n[d]))return t.preventDefault(),void(o=l?s:a).focus();t.preventDefault(),o.focus()}}else t.preventDefault()};var o,r=(o=n(7845))&&o.__esModule?o:{default:o};function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return e.activeElement.shadowRoot?i(e.activeElement.shadowRoot):e.activeElement}e.exports=t.default},7845:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){return[].slice.call(t.querySelectorAll("*"),0).reduce((function(t,n){return t.concat(n.shadowRoot?e(n.shadowRoot):[n])}),[]).filter(l)};var n="none",o="contents",r=/input|select|textarea|button|object|iframe/;function i(e){var t=e.offsetWidth<=0&&e.offsetHeight<=0;if(t&&!e.innerHTML)return!0;try{var r=window.getComputedStyle(e),i=r.getPropertyValue("display");return t?i!==o&&function(e,t){return"visible"!==t.getPropertyValue("overflow")||e.scrollWidth<=0&&e.scrollHeight<=0}(e,r):i===n}catch(e){return console.warn("Failed to inspect element style"),!1}}function l(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&function(e,t){var n=e.nodeName.toLowerCase();return(r.test(n)&&!e.disabled||"a"===n&&e.href||t)&&function(e){for(var t=e,n=e.getRootNode&&e.getRootNode();t&&t!==document.body;){if(n&&t===n&&(t=n.host.parentNode),i(t))return!1;t=t.parentNode}return!0}(e)}(e,!n)}e.exports=t.default},3253:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=(o=n(9983))&&o.__esModule?o:{default:o};t.default=r.default,e.exports=t.default},5726:(e,t,n)=>{"use strict";function o(e,t,n,o,r,i,l){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=o,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=l}const r={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach((e=>{r[e]=new o(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((([e,t])=>{r[e]=new o(e,1,!1,t,null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((e=>{r[e]=new o(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((e=>{r[e]=new o(e,2,!1,e,null,!1,!1)})),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach((e=>{r[e]=new o(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((e=>{r[e]=new o(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((e=>{r[e]=new o(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((e=>{r[e]=new o(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((e=>{r[e]=new o(e,5,!1,e.toLowerCase(),null,!1,!1)}));const i=/[\-\:]([a-z])/g,l=e=>e[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach((e=>{const t=e.replace(i,l);r[t]=new o(t,1,!1,e,null,!1,!1)})),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach((e=>{const t=e.replace(i,l);r[t]=new o(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((e=>{const t=e.replace(i,l);r[t]=new o(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((e=>{r[e]=new o(e,1,!1,e.toLowerCase(),null,!1,!1)})),r.xlinkHref=new o("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((e=>{r[e]=new o(e,1,!1,e.toLowerCase(),null,!0,!0)}));const{CAMELCASE:a,SAME:s,possibleStandardNames:c}=n(8229),u=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),d=Object.keys(c).reduce(((e,t)=>{const n=c[t];return n===s?e[t]=t:n===a?e[t.toLowerCase()]=t:e[t]=n,e}),{});t.BOOLEAN=3,t.BOOLEANISH_STRING=2,t.NUMERIC=5,t.OVERLOADED_BOOLEAN=4,t.POSITIVE_NUMERIC=6,t.RESERVED=0,t.STRING=1,t.getPropertyInfo=function(e){return r.hasOwnProperty(e)?r[e]:null},t.isCustomAttribute=u,t.possibleStandardNames=d},8229:(e,t)=>{t.SAME=0,t.CAMELCASE=1,t.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}},1476:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=o(n(5174)),i=n(6678);t.default=function(e,t){var n={};return e&&"string"==typeof e?((0,r.default)(e,(function(e,o){e&&o&&(n[(0,i.camelCase)(e,t)]=o)})),n):n}},6678:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.camelCase=void 0;var n=/^--[a-zA-Z0-9-]+$/,o=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,a=function(e,t){return t.toUpperCase()},s=function(e,t){return"".concat(t,"-")};t.camelCase=function(e,t){return void 0===t&&(t={}),function(e){return!e||r.test(e)||n.test(e)}(e)?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(l,s):e.replace(i,s)).replace(o,a))}},5174:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=o(n(8139));t.default=function(e,t){var n=null;if(!e||"string"!=typeof e)return n;var o=(0,r.default)(e),i="function"==typeof t;return o.forEach((function(e){if("declaration"===e.type){var o=e.property,r=e.value;i?t(o,r,e):r&&((n=n||{})[o]=r)}})),n}},2473:e=>{"use strict";e.exports=function(){}},9196:e=>{"use strict";e.exports=window.React},1850:e=>{"use strict";e.exports=window.ReactDOM},3967:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{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.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e=n(9196);const t=window.wp.domReady;var o=n.n(t);const r=window.wp.element,i=window.wp.components,l=window.wp.i18n;var a=n(3426);const s=a.default||a;var c=n(3253),u=n.n(c);const d=Math.min,p=Math.max,f=Math.round,m=Math.floor,h=e=>({x:e,y:e}),v={left:"right",right:"left",bottom:"top",top:"bottom"},y={start:"end",end:"start"};function g(e,t,n){return p(e,d(t,n))}function b(e,t){return"function"==typeof e?e(t):e}function w(e){return e.split("-")[0]}function _(e){return e.split("-")[1]}function E(e){return"x"===e?"y":"x"}function x(e){return"y"===e?"height":"width"}function S(e){return["top","bottom"].includes(w(e))?"y":"x"}function O(e){return E(S(e))}function C(e){return e.replace(/start|end/g,(e=>y[e]))}function T(e){return e.replace(/left|right|bottom|top/g,(e=>v[e]))}function k(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function A(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function N(e,t,n){let{reference:o,floating:r}=e;const i=S(t),l=O(t),a=x(l),s=w(t),c="y"===i,u=o.x+o.width/2-r.width/2,d=o.y+o.height/2-r.height/2,p=o[a]/2-r[a]/2;let f;switch(s){case"top":f={x:u,y:o.y-r.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-r.width,y:d};break;default:f={x:o.x,y:o.y}}switch(_(t)){case"start":f[l]-=p*(n&&c?-1:1);break;case"end":f[l]+=p*(n&&c?-1:1)}return f}async function R(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:l,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=b(t,e),m=k(f),h=a[p?"floating"===d?"reference":"floating":d],v=A(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:s})),y="floating"===d?{...l.floating,x:o,y:r}:l.reference,g=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),w=await(null==i.isElement?void 0:i.isElement(g))&&await(null==i.getScale?void 0:i.getScale(g))||{x:1,y:1},_=A(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:g,strategy:s}):y);return{top:(v.top-_.top+m.top)/w.y,bottom:(_.bottom-v.bottom+m.bottom)/w.y,left:(v.left-_.left+m.left)/w.x,right:(_.right-v.right+m.right)/w.x}}const P=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:l,middlewareData:a}=t,s=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),l=w(n),a=_(n),s="y"===S(n),c=["left","top"].includes(l)?-1:1,u=i&&s?-1:1,d=b(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&"number"==typeof m&&(f="end"===a?-1*m:m),s?{x:f*u,y:p*c}:{x:p*c,y:f*u}}(t,e);return l===(null==(n=a.offset)?void 0:n.placement)&&null!=(o=a.arrow)&&o.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:l}}}}};function M(e){return j(e)?(e.nodeName||"").toLowerCase():"#document"}function L(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function D(e){var t;return null==(t=(j(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function j(e){return e instanceof Node||e instanceof L(e).Node}function I(e){return e instanceof Element||e instanceof L(e).Element}function F(e){return e instanceof HTMLElement||e instanceof L(e).HTMLElement}function H(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof L(e).ShadowRoot)}function U(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(r)}function B(e){return["table","td","th"].includes(M(e))}function W(e){const t=z(),n=q(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function z(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function V(e){return["html","body","#document"].includes(M(e))}function q(e){return L(e).getComputedStyle(e)}function $(e){return I(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function G(e){if("html"===M(e))return e;const t=e.assignedSlot||e.parentNode||H(e)&&e.host||D(e);return H(t)?t.host:t}function X(e){const t=G(e);return V(t)?e.ownerDocument?e.ownerDocument.body:e.body:F(t)&&U(t)?t:X(t)}function Y(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=X(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),l=L(r);return i?t.concat(l,l.visualViewport||[],U(r)?r:[],l.frameElement&&n?Y(l.frameElement):[]):t.concat(r,Y(r,[],n))}function K(e){const t=q(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=F(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,a=f(n)!==i||f(o)!==l;return a&&(n=i,o=l),{width:n,height:o,$:a}}function Z(e){return I(e)?e:e.contextElement}function J(e){const t=Z(e);if(!F(t))return h(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=K(t);let l=(i?f(n.width):n.width)/o,a=(i?f(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}const Q=h(0);function ee(e){const t=L(e);return z()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Q}function te(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=Z(e);let l=h(1);t&&(o?I(o)&&(l=J(o)):l=J(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==L(e))&&t}(i,n,o)?ee(i):h(0);let s=(r.left+a.x)/l.x,c=(r.top+a.y)/l.y,u=r.width/l.x,d=r.height/l.y;if(i){const e=L(i),t=o&&I(o)?L(o):o;let n=e,r=n.frameElement;for(;r&&o&&t!==n;){const e=J(r),t=r.getBoundingClientRect(),o=q(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;s*=e.x,c*=e.y,u*=e.x,d*=e.y,s+=i,c+=l,n=L(r),r=n.frameElement}}return A({width:u,height:d,x:s,y:c})}const ne=[":popover-open",":modal"];function oe(e){return ne.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function re(e){return te(D(e)).left+$(e).scrollLeft}function ie(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=L(e),o=D(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,a=0,s=0;if(r){i=r.width,l=r.height;const e=z();(!e||e&&"fixed"===t)&&(a=r.offsetLeft,s=r.offsetTop)}return{width:i,height:l,x:a,y:s}}(e,n);else if("document"===t)o=function(e){const t=D(e),n=$(e),o=e.ownerDocument.body,r=p(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=p(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+re(e);const a=-n.scrollTop;return"rtl"===q(o).direction&&(l+=p(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:a}}(D(e));else if(I(t))o=function(e,t){const n=te(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=F(e)?J(e):h(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=ee(e);o={...t,x:t.x-n.x,y:t.y-n.y}}return A(o)}function le(e,t){const n=G(e);return!(n===t||!I(n)||V(n))&&("fixed"===q(n).position||le(n,t))}function ae(e,t,n){const o=F(t),r=D(t),i="fixed"===n,l=te(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const s=h(0);if(o||!o&&!i)if(("body"!==M(t)||U(r))&&(a=$(t)),o){const e=te(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else r&&(s.x=re(r));return{x:l.left+a.scrollLeft-s.x,y:l.top+a.scrollTop-s.y,width:l.width,height:l.height}}function se(e,t){return F(e)&&"fixed"!==q(e).position?t?t(e):e.offsetParent:null}function ce(e,t){const n=L(e);if(!F(e)||oe(e))return n;let o=se(e,t);for(;o&&B(o)&&"static"===q(o).position;)o=se(o,t);return o&&("html"===M(o)||"body"===M(o)&&"static"===q(o).position&&!W(o))?n:o||function(e){let t=G(e);for(;F(t)&&!V(t);){if(W(t))return t;t=G(t)}return null}(e)||n}const ue={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,l=D(o),a=!!t&&oe(t.floating);if(o===l||a&&i)return n;let s={scrollLeft:0,scrollTop:0},c=h(1);const u=h(0),d=F(o);if((d||!d&&!i)&&(("body"!==M(o)||U(l))&&(s=$(o)),F(o))){const e=te(o);c=J(o),u.x=e.x+o.clientLeft,u.y=e.y+o.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+u.x,y:n.y*c.y-s.scrollTop*c.y+u.y}},getDocumentElement:D,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let o=Y(e,[],!1).filter((e=>I(e)&&"body"!==M(e))),r=null;const i="fixed"===q(e).position;let l=i?G(e):e;for(;I(l)&&!V(l);){const t=q(l),n=W(l);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&["absolute","fixed"].includes(r.position)||U(l)&&!n&&le(e,l))?o=o.filter((e=>e!==l)):r=t,l=G(l)}return t.set(e,o),o}(t,this._c):[].concat(n),o],l=i[0],a=i.reduce(((e,n)=>{const o=ie(t,n,r);return e.top=p(o.top,e.top),e.right=d(o.right,e.right),e.bottom=d(o.bottom,e.bottom),e.left=p(o.left,e.left),e}),ie(t,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:ce,getElementRects:async function(e){const t=this.getOffsetParent||ce,n=this.getDimensions;return{reference:ae(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=K(e);return{width:t,height:n}},getScale:J,isElement:I,isRTL:function(e){return"rtl"===q(e).direction}};const de=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=b(e,t),c={x:n,y:o},u=await R(t,s),d=S(w(r)),p=E(d);let f=c[p],m=c[d];if(i){const e="y"===p?"bottom":"right";f=g(f+u["y"===p?"top":"left"],f,f-u[e])}if(l){const e="y"===d?"bottom":"right";m=g(m+u["y"===d?"top":"left"],m,m-u[e])}const h=a.fn({...t,[p]:f,[d]:m});return{...h,data:{x:h.x-n,y:h.y-o}}}}},pe=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:a,platform:s,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...v}=b(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=w(r),g=w(a)===a,E=await(null==s.isRTL?void 0:s.isRTL(c.floating)),S=p||(g||!h?[T(a)]:function(e){const t=T(e);return[C(e),t,C(t)]}(a));p||"none"===m||S.push(...function(e,t,n,o){const r=_(e);let i=function(e,t,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:o:t?o:r;case"left":case"right":return t?i:l;default:return[]}}(w(e),"start"===n,o);return r&&(i=i.map((e=>e+"-"+r)),t&&(i=i.concat(i.map(C)))),i}(a,h,m,E));const k=[a,...S],A=await R(t,v),N=[];let P=(null==(o=i.flip)?void 0:o.overflows)||[];if(u&&N.push(A[y]),d){const e=function(e,t,n){void 0===n&&(n=!1);const o=_(e),r=O(e),i=x(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=T(l)),[l,T(l)]}(r,l,E);N.push(A[e[0]],A[e[1]])}if(P=[...P,{placement:r,overflows:N}],!N.every((e=>e<=0))){var M,L;const e=((null==(M=i.flip)?void 0:M.index)||0)+1,t=k[e];if(t)return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(L=P.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:L.placement;if(!n)switch(f){case"bestFit":{var D;const e=null==(D=P.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:D[0];e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}},fe=(e,t,n)=>{const o=new Map,r={platform:ue,...n},i={...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,a=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:d}=N(c,o,s),p=o,f={},m=0;for(let n=0;n{let o=null;const r=function(...r){const i=()=>{o=null,n||e.apply(this,r)};n&&!o&&(e.apply(this,r),o=setTimeout(i,t)),n||(o&&clearTimeout(o),o=setTimeout(i,t))};return r.cancel=()=>{o&&(clearTimeout(o),o=null)},r},ge={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},be=(0,e.createContext)({getTooltipData:()=>ge});function we(t="DEFAULT_TOOLTIP_ID"){return(0,e.useContext)(be).getTooltipData(t)}const _e="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,Ee=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const n=t.getPropertyValue(e);return"auto"===n||"scroll"===n}))},xe=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Ee(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Se=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:o="top",offset:r=10,strategy:i="absolute",middlewares:l=[P(Number(r)),pe({fallbackAxisSideDirection:"start"}),de({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:o};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:o};const s=l;return n?(s.push({name:"arrow",options:c={element:n,padding:5},async fn(e){const{x:t,y:n,placement:o,rects:r,platform:i,elements:l,middlewareData:a}=e,{element:s,padding:u=0}=b(c,e)||{};if(null==s)return{};const p=k(u),f={x:t,y:n},m=O(o),h=x(m),v=await i.getDimensions(s),y="y"===m,w=y?"top":"left",E=y?"bottom":"right",S=y?"clientHeight":"clientWidth",C=r.reference[h]+r.reference[m]-f[m]-r.floating[h],T=f[m]-r.reference[m],A=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s));let N=A?A[S]:0;N&&await(null==i.isElement?void 0:i.isElement(A))||(N=l.floating[S]||r.floating[h]);const R=C/2-T/2,P=N/2-v[h]/2-1,M=d(p[w],P),L=d(p[E],P),D=M,j=N-v[h]-L,I=N/2-v[h]/2+R,F=g(D,I,j),H=!a.arrow&&null!=_(o)&&I!==F&&r.reference[h]/2-(I{var r,i;const l={left:`${e}px`,top:`${t}px`,border:a},{x:s,y:c}=null!==(r=o.arrow)&&void 0!==r?r:{x:0,y:0},u=null!==(i={top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]])&&void 0!==i?i:"bottom",d=a&&{borderBottom:a,borderRight:a};let p=0;if(a){const e=`${a}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:l,tooltipArrowStyles:{left:null!=s?`${s}px`:"",top:null!=c?`${c}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:n}}))):fe(e,t,{placement:"bottom",strategy:i,middleware:s}).then((({x:e,y:t,placement:n})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:n})));var c},Oe=e=>null!==e&&"object"==typeof e,Ce=(e,t)=>{if(!Oe(e)||!Oe(t))return e===t;const n=Object.keys(e),o=Object.keys(t);return n.length===o.length&&n.every((n=>{const o=e[n],r=t[n];return Oe(o)&&Oe(r)?Ce(o,r):o===r}))};var Te={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},ke={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const Ae=({forwardRef:t,id:n,className:o,classNameArrow:r,variant:i="dark",anchorId:l,anchorSelect:a,place:s="top",offset:c=10,events:u=["hover"],openOnClick:f=!1,positionStrategy:h="absolute",middlewares:v,wrapper:y,delayShow:g=0,delayHide:b=0,float:w=!1,hidden:_=!1,noArrow:E=!1,clickable:x=!1,closeOnEsc:S=!1,closeOnScroll:O=!1,closeOnResize:C=!1,openEvents:T,closeEvents:k,globalCloseEvents:A,imperativeModeOnly:N,style:R,position:P,afterShow:M,afterHide:L,content:j,contentWrapperRef:I,isOpen:F,defaultIsOpen:H=!1,setIsOpen:U,activeAnchor:B,setActiveAnchor:W,border:z,opacity:V,arrowColor:q,role:$="tooltip"})=>{var G;const X=(0,e.useRef)(null),K=(0,e.useRef)(null),J=(0,e.useRef)(null),Q=(0,e.useRef)(null),ee=(0,e.useRef)(null),[ne,oe]=(0,e.useState)({tooltipStyles:{},tooltipArrowStyles:{},place:s}),[re,ie]=(0,e.useState)(!1),[le,ae]=(0,e.useState)(!1),[se,ce]=(0,e.useState)(null),ue=(0,e.useRef)(!1),de=(0,e.useRef)(null),{anchorRefs:pe,setActiveAnchor:fe}=we(n),he=(0,e.useRef)(!1),[ve,ge]=(0,e.useState)([]),be=(0,e.useRef)(!1),Ee=f||u.includes("click"),Oe=Ee||(null==T?void 0:T.click)||(null==T?void 0:T.dblclick)||(null==T?void 0:T.mousedown),Ae=T?{...T}:{mouseenter:!0,focus:!0,click:!1,dblclick:!1,mousedown:!1};!T&&Ee&&Object.assign(Ae,{mouseenter:!1,focus:!1,click:!0});const Ne=k?{...k}:{mouseleave:!0,blur:!0,click:!1,dblclick:!1,mouseup:!1};!k&&Ee&&Object.assign(Ne,{mouseleave:!1,blur:!1});const Re=A?{...A}:{escape:S||!1,scroll:O||!1,resize:C||!1,clickOutsideAnchor:Oe||!1};N&&(Object.assign(Ae,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Ne,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Re,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),_e((()=>(be.current=!0,()=>{be.current=!1})),[]);const Pe=e=>{be.current&&(e&&ae(!0),setTimeout((()=>{be.current&&(null==U||U(e),void 0===F&&ie(e))}),10))};(0,e.useEffect)((()=>{if(void 0===F)return()=>null;F&&ae(!0);const e=setTimeout((()=>{ie(F)}),10);return()=>{clearTimeout(e)}}),[F]),(0,e.useEffect)((()=>{if(re!==ue.current)if(ee.current&&clearTimeout(ee.current),ue.current=re,re)null==M||M();else{const e=(e=>{const t=getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay").match(/^([\d.]+)(m?s?)$/);if(!t)return 0;const[,n,o]=t;return"s"!==o&&"ms"!==o?0:Number(n)*("ms"===o?1:1e3)})();ee.current=setTimeout((()=>{ae(!1),ce(null),null==L||L()}),e+25)}}),[re]);const Me=e=>{oe((t=>Ce(t,e)?t:e))},Le=(e=g)=>{J.current&&clearTimeout(J.current),le?Pe(!0):J.current=setTimeout((()=>{Pe(!0)}),e)},De=(e=b)=>{Q.current&&clearTimeout(Q.current),Q.current=setTimeout((()=>{he.current||Pe(!1)}),e)},je=e=>{var t;if(!e)return;const n=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==n?void 0:n.isConnected))return W(null),void fe({current:null});g?Le():Pe(!0),W(n),fe({current:n}),Q.current&&clearTimeout(Q.current)},Ie=()=>{x?De(b||100):b?De():Pe(!1),J.current&&clearTimeout(J.current)},Fe=({x:e,y:t})=>{var n;const o={getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})};Se({place:null!==(n=null==se?void 0:se.place)&&void 0!==n?n:s,offset:c,elementReference:o,tooltipReference:X.current,tooltipArrowReference:K.current,strategy:h,middlewares:v,border:z}).then((e=>{Me(e)}))},He=e=>{if(!e)return;const t=e,n={x:t.clientX,y:t.clientY};Fe(n),de.current=n},Ue=e=>{var t;if(!re)return;const n=e.target;n.isConnected&&((null===(t=X.current)||void 0===t?void 0:t.contains(n))||[document.querySelector(`[id='${l}']`),...ve].some((e=>null==e?void 0:e.contains(n)))||(Pe(!1),J.current&&clearTimeout(J.current)))},Be=ye(je,50,!0),We=ye(Ie,50,!0),ze=e=>{We.cancel(),Be(e)},Ve=()=>{Be.cancel(),We()},qe=(0,e.useCallback)((()=>{var e,t;const n=null!==(e=null==se?void 0:se.position)&&void 0!==e?e:P;n?Fe(n):w?de.current&&Fe(de.current):(null==B?void 0:B.isConnected)&&Se({place:null!==(t=null==se?void 0:se.place)&&void 0!==t?t:s,offset:c,elementReference:B,tooltipReference:X.current,tooltipArrowReference:K.current,strategy:h,middlewares:v,border:z}).then((e=>{be.current&&Me(e)}))}),[re,B,j,R,s,null==se?void 0:se.place,c,h,P,null==se?void 0:se.position,w]);(0,e.useEffect)((()=>{var e,t;const n=new Set(pe);ve.forEach((e=>{n.add({current:e})}));const o=document.querySelector(`[id='${l}']`);o&&n.add({current:o});const r=()=>{Pe(!1)},i=xe(B),a=xe(X.current);Re.scroll&&(window.addEventListener("scroll",r),null==i||i.addEventListener("scroll",r),null==a||a.addEventListener("scroll",r));let s=null;Re.resize?window.addEventListener("resize",r):B&&X.current&&(s=function(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:s=!1}=o,c=Z(e),u=r||i?[...c?Y(c):[],...Y(t)]:[];u.forEach((e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const f=c&&a?function(e,t){let n,o=null;const r=D(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function l(a,s){void 0===a&&(a=!1),void 0===s&&(s=1),i();const{left:c,top:u,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const v={rootMargin:-m(u)+"px "+-m(r.clientWidth-(c+f))+"px "+-m(r.clientHeight-(u+h))+"px "+-m(c)+"px",threshold:p(0,d(1,s))||1};let y=!0;function g(e){const t=e[0].intersectionRatio;if(t!==s){if(!y)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),100)}y=!1}try{o=new IntersectionObserver(g,{...v,root:r.ownerDocument})}catch(e){o=new IntersectionObserver(g,v)}o.observe(e)}(!0),i}(c,n):null;let h,v=-1,y=null;l&&(y=new ResizeObserver((e=>{let[o]=e;o&&o.target===c&&y&&(y.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame((()=>{var e;null==(e=y)||e.observe(t)}))),n()})),c&&!s&&y.observe(c),y.observe(t));let g=s?te(e):null;return s&&function t(){const o=te(e);!g||o.x===g.x&&o.y===g.y&&o.width===g.width&&o.height===g.height||n(),g=o,h=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==f||f(),null==(e=y)||e.disconnect(),y=null,s&&cancelAnimationFrame(h)}}(B,X.current,qe,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const c=e=>{"Escape"===e.key&&Pe(!1)};Re.escape&&window.addEventListener("keydown",c),Re.clickOutsideAnchor&&window.addEventListener("click",Ue);const u=[],f=e=>{re&&(null==e?void 0:e.target)===B||je(e)},h=e=>{re&&(null==e?void 0:e.target)===B&&Ie()},v=["mouseenter","mouseleave","focus","blur"],y=["click","dblclick","mousedown","mouseup"];Object.entries(Ae).forEach((([e,t])=>{t&&(v.includes(e)?u.push({event:e,listener:ze}):y.includes(e)&&u.push({event:e,listener:f}))})),Object.entries(Ne).forEach((([e,t])=>{t&&(v.includes(e)?u.push({event:e,listener:Ve}):y.includes(e)&&u.push({event:e,listener:h}))})),w&&u.push({event:"pointermove",listener:He});const g=()=>{he.current=!0},b=()=>{he.current=!1,Ie()};return x&&!Oe&&(null===(e=X.current)||void 0===e||e.addEventListener("mouseenter",g),null===(t=X.current)||void 0===t||t.addEventListener("mouseleave",b)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var o;null===(o=n.current)||void 0===o||o.addEventListener(e,t)}))})),()=>{var e,t;Re.scroll&&(window.removeEventListener("scroll",r),null==i||i.removeEventListener("scroll",r),null==a||a.removeEventListener("scroll",r)),Re.resize?window.removeEventListener("resize",r):null==s||s(),Re.clickOutsideAnchor&&window.removeEventListener("click",Ue),Re.escape&&window.removeEventListener("keydown",c),x&&!Oe&&(null===(e=X.current)||void 0===e||e.removeEventListener("mouseenter",g),null===(t=X.current)||void 0===t||t.removeEventListener("mouseleave",b)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var o;null===(o=n.current)||void 0===o||o.removeEventListener(e,t)}))}))}}),[B,qe,le,pe,ve,T,k,A,Ee,g,b]),(0,e.useEffect)((()=>{var e,t;let o=null!==(t=null!==(e=null==se?void 0:se.anchorSelect)&&void 0!==e?e:a)&&void 0!==t?t:"";!o&&n&&(o=`[data-tooltip-id='${n}']`);const r=new MutationObserver((e=>{const t=[],r=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName&&(e.target.getAttribute("data-tooltip-id")===n?t.push(e.target):e.oldValue===n&&r.push(e.target)),"childList"===e.type){if(B){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(o)try{r.push(...t.filter((e=>e.matches(o)))),r.push(...t.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,B))&&(ae(!1),Pe(!1),W(null),J.current&&clearTimeout(J.current),Q.current&&clearTimeout(Q.current),!0)}))}if(o)try{const n=[...e.addedNodes].filter((e=>1===e.nodeType));t.push(...n.filter((e=>e.matches(o)))),t.push(...n.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}}})),(t.length||r.length)&&ge((e=>[...e.filter((e=>!r.includes(e))),...t]))}));return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{r.disconnect()}}),[n,a,null==se?void 0:se.anchorSelect,B]),(0,e.useEffect)((()=>{qe()}),[qe]),(0,e.useEffect)((()=>{if(!(null==I?void 0:I.current))return()=>null;const e=new ResizeObserver((()=>{setTimeout((()=>qe()))}));return e.observe(I.current),()=>{e.disconnect()}}),[j,null==I?void 0:I.current]),(0,e.useEffect)((()=>{var e;const t=document.querySelector(`[id='${l}']`),n=[...ve,t];B&&n.includes(B)||W(null!==(e=ve[0])&&void 0!==e?e:t)}),[l,ve,B]),(0,e.useEffect)((()=>(H&&Pe(!0),()=>{J.current&&clearTimeout(J.current),Q.current&&clearTimeout(Q.current)})),[]),(0,e.useEffect)((()=>{var e;let t=null!==(e=null==se?void 0:se.anchorSelect)&&void 0!==e?e:a;if(!t&&n&&(t=`[data-tooltip-id='${n}']`),t)try{const e=Array.from(document.querySelectorAll(t));ge(e)}catch(e){ge([])}}),[n,a,null==se?void 0:se.anchorSelect]),(0,e.useEffect)((()=>{J.current&&(clearTimeout(J.current),Le(g))}),[g]);const $e=null!==(G=null==se?void 0:se.content)&&void 0!==G?G:j,Ge=re&&Object.keys(ne.tooltipStyles).length>0;return(0,e.useImperativeHandle)(t,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect)}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}ce(null!=e?e:null),(null==e?void 0:e.delay)?Le(e.delay):Pe(!0)},close:e=>{(null==e?void 0:e.delay)?De(e.delay):Pe(!1)},activeAnchor:B,place:ne.place,isOpen:Boolean(le&&!_&&$e&&Ge)}))),le&&!_&&$e?e.createElement(y,{id:n,role:$,className:me("react-tooltip",Te.tooltip,ke.tooltip,ke[i],o,`react-tooltip__place-${ne.place}`,Te[Ge?"show":"closing"],Ge?"react-tooltip__show":"react-tooltip__closing","fixed"===h&&Te.fixed,x&&Te.clickable),onTransitionEnd:e=>{ee.current&&clearTimeout(ee.current),re||"opacity"!==e.propertyName||(ae(!1),ce(null),null==L||L())},style:{...R,...ne.tooltipStyles,opacity:void 0!==V&&Ge?V:void 0},ref:X},$e,e.createElement(y,{className:me("react-tooltip-arrow",Te.arrow,ke.arrow,r,E&&Te.noArrow),style:{...ne.tooltipArrowStyles,background:q?`linear-gradient(to right bottom, transparent 50%, ${q} 50%)`:void 0},ref:K})):null},Ne=({content:t})=>e.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),Re=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Pe=e.forwardRef((({id:t,anchorId:n,anchorSelect:o,content:r,html:i,render:l,className:a,classNameArrow:s,variant:c="dark",place:u="top",offset:d=10,wrapper:p="div",children:f=null,events:m=["hover"],openOnClick:h=!1,positionStrategy:v="absolute",middlewares:y,delayShow:g=0,delayHide:b=0,float:w=!1,hidden:_=!1,noArrow:E=!1,clickable:x=!1,closeOnEsc:S=!1,closeOnScroll:O=!1,closeOnResize:C=!1,openEvents:T,closeEvents:k,globalCloseEvents:A,imperativeModeOnly:N=!1,style:R,position:P,isOpen:M,defaultIsOpen:L=!1,disableStyleInjection:D=!1,border:j,opacity:I,arrowColor:F,setIsOpen:H,afterShow:U,afterHide:B,role:W="tooltip"},z)=>{const[V,q]=(0,e.useState)(r),[$,G]=(0,e.useState)(i),[X,Y]=(0,e.useState)(u),[K,Z]=(0,e.useState)(c),[J,Q]=(0,e.useState)(d),[ee,te]=(0,e.useState)(g),[ne,oe]=(0,e.useState)(b),[re,ie]=(0,e.useState)(w),[le,ae]=(0,e.useState)(_),[se,ce]=(0,e.useState)(p),[ue,de]=(0,e.useState)(m),[pe,fe]=(0,e.useState)(v),[he,ve]=(0,e.useState)(null),[ye,ge]=(0,e.useState)(null),be=(0,e.useRef)(D),{anchorRefs:_e,activeAnchor:Ee}=we(t),xe=e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>{var o;return n.startsWith("data-tooltip-")&&(t[n.replace(/^data-tooltip-/,"")]=null!==(o=null==e?void 0:e.getAttribute(n))&&void 0!==o?o:null),t}),{}),Se=e=>{const t={place:e=>{var t;Y(null!==(t=e)&&void 0!==t?t:u)},content:e=>{q(null!=e?e:r)},html:e=>{G(null!=e?e:i)},variant:e=>{var t;Z(null!==(t=e)&&void 0!==t?t:c)},offset:e=>{Q(null===e?d:Number(e))},wrapper:e=>{var t;ce(null!==(t=e)&&void 0!==t?t:p)},events:e=>{const t=null==e?void 0:e.split(" ");de(null!=t?t:m)},"position-strategy":e=>{var t;fe(null!==(t=e)&&void 0!==t?t:v)},"delay-show":e=>{te(null===e?g:Number(e))},"delay-hide":e=>{oe(null===e?b:Number(e))},float:e=>{ie(null===e?w:"true"===e)},hidden:e=>{ae(null===e?_:"true"===e)},"class-name":e=>{ve(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var o;null===(o=t[e])||void 0===o||o.call(t,n)}))};(0,e.useEffect)((()=>{q(r)}),[r]),(0,e.useEffect)((()=>{G(i)}),[i]),(0,e.useEffect)((()=>{Y(u)}),[u]),(0,e.useEffect)((()=>{Z(c)}),[c]),(0,e.useEffect)((()=>{Q(d)}),[d]),(0,e.useEffect)((()=>{te(g)}),[g]),(0,e.useEffect)((()=>{oe(b)}),[b]),(0,e.useEffect)((()=>{ie(w)}),[w]),(0,e.useEffect)((()=>{ae(_)}),[_]),(0,e.useEffect)((()=>{fe(v)}),[v]),(0,e.useEffect)((()=>{be.current!==D&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[D]),(0,e.useEffect)((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===D,disableBase:D}}))}),[]),(0,e.useEffect)((()=>{var e;const r=new Set(_e);let i=o;if(!i&&t&&(i=`[data-tooltip-id='${t}']`),i)try{document.querySelectorAll(i).forEach((e=>{r.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${i}" is not a valid CSS selector`)}const l=document.querySelector(`[id='${n}']`);if(l&&r.add({current:l}),!r.size)return()=>null;const a=null!==(e=null!=ye?ye:l)&&void 0!==e?e:Ee.current,s=new MutationObserver((e=>{e.forEach((e=>{var t;if(!a||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const n=xe(a);Se(n)}))})),c={attributes:!0,childList:!1,subtree:!1};if(a){const e=xe(a);Se(e),s.observe(a,c)}return()=>{s.disconnect()}}),[_e,Ee,ye,n,o]),(0,e.useEffect)((()=>{(null==R?void 0:R.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),j&&!Re("border",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`border\`.`),(null==R?void 0:R.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),I&&!Re("opacity",`${I}`)&&console.warn(`[react-tooltip] "${I}" is not a valid \`opacity\`.`)}),[]);let Oe=f;const Ce=(0,e.useRef)(null);if(l){const t=l({content:(null==ye?void 0:ye.getAttribute("data-tooltip-content"))||V||null,activeAnchor:ye});Oe=t?e.createElement("div",{ref:Ce,className:"react-tooltip-content-wrapper"},t):null}else V&&(Oe=V);$&&(Oe=e.createElement(Ne,{content:$}));const Te={forwardRef:z,id:t,anchorId:n,anchorSelect:o,className:me(a,he),classNameArrow:s,content:Oe,contentWrapperRef:Ce,place:X,variant:K,offset:J,wrapper:se,events:ue,openOnClick:h,positionStrategy:pe,middlewares:y,delayShow:ee,delayHide:ne,float:re,hidden:le,noArrow:E,clickable:x,closeOnEsc:S,closeOnScroll:O,closeOnResize:C,openEvents:T,closeEvents:k,globalCloseEvents:A,imperativeModeOnly:N,style:R,position:P,isOpen:M,defaultIsOpen:L,border:j,opacity:I,arrowColor:F,setIsOpen:H,afterShow:U,afterHide:B,activeAnchor:ye,setActiveAnchor:e=>ge(e),role:W};return e.createElement(Ae,{...Te})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||ve({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||ve({css:"\n.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}",type:"base"})}));const Me=window.wp.apiFetch;var Le=n.n(Me);const De=({type:t="upcoming",status:n="no_status"})=>{const o={upcoming:{attending:{icon:"dashicons dashicons-yes-alt",text:(0,l.__)("Attending","gatherpress")},waiting_list:{icon:"dashicons dashicons-editor-help",text:(0,l.__)("Waiting List","gatherpress")},not_attending:{icon:"dashicons dashicons-dismiss",text:(0,l._x)("Not Attending","responded not attending","gatherpress")},no_status:{icon:"",text:""}},past:{attending:{icon:"dashicons dashicons-yes-alt",text:(0,l.__)("Went","gatherpress")},waiting_list:{icon:"dashicons dashicons-dismiss",text:(0,l.__)("Didn't Go","gatherpress")},not_attending:{icon:"dashicons dashicons-dismiss",text:(0,l.__)("Didn't Go","gatherpress")},no_status:{icon:"dashicons dashicons-dismiss",text:(0,l.__)("Didn't Go","gatherpress")}}};return(0,e.createElement)("div",{className:"gp-status__response"},(0,e.createElement)("span",{className:o[t][n].icon}),(0,e.createElement)("strong",null,o[t][n].text))};function je(e){if("object"==typeof GatherPress)return e.split(".").reduce(((e,t)=>e&&e[t]),GatherPress)}window.wp.data;const Ie=({postId:t,currentUser:n="",type:o,enableAnonymousRsvp:a})=>{const[c,d]=(0,r.useState)(n.status),[p,f]=(0,r.useState)(Number(n.anonymous)),[m,h]=(0,r.useState)(n.guests),[v,y]=(0,r.useState)("hidden"),[g,b]=(0,r.useState)("false"),[w,_]=(0,r.useState)(!1);if("past"===o)return"";"undefined"==typeof adminpage&&u().setAppElement(".gp-enabled");const E=e=>{e.preventDefault(),_(!1)},x=async(e,n,o,r=0,i=!0)=>{e.preventDefault(),"attending"!==n&&(r=0),Le()({path:je("urls.eventRestApi")+"/rsvp",method:"POST",data:{post_id:t,status:n,guests:r,anonymous:o,_wpnonce:je("misc.nonce")}}).then((t=>{if(t.success){d(t.status),h(t.guests);const n={all:0,attending:0,not_attending:0,waiting_list:0};for(const[e,o]of Object.entries(t.responses))n[e]=o.count;((e,t="")=>{for(const[n,o]of Object.entries(e)){let e=n;t&&(e+="_"+String(t));const r=new CustomEvent(e,{detail:o});dispatchEvent(r)}})({setRsvpStatus:t.status,setRsvpResponse:t.responses,setRsvpCount:n,setRsvpSeeAllLink:n[t.status]>8,setOnlineEventLink:t.online_link},t.event_id),i&&E(e)}}))},S=e=>{switch(e){case"attending":return(0,l.__)("You're attending","gatherpress");case"waiting_list":return(0,l.__)("You're wait listed","gatherpress");case"not_attending":return(0,l.__)("You're not attending","gatherpress")}return(0,l.__)("RSVP to this event","gatherpress")};return(0,e.createElement)("div",{className:"gp-rsvp"},(0,e.createElement)(i.ButtonGroup,{className:"gp-buttons wp-block-buttons"},(0,e.createElement)("div",{className:"gp-buttons__container wp-block-button"},(0,e.createElement)("a",{href:"#",className:"gp-buttons__button wp-block-button__link","aria-expanded":g,tabIndex:"0",onKeyDown:e=>{13===e.keyCode&&(y("hidden"===v?"show":"hidden"),b("false"===g?"true":"false"))},onClick:e=>(e=>{e.preventDefault(),_(!0)})(e)},(e=>{switch(e){case"attending":case"waiting_list":case"not_attending":return(0,l.__)("Edit RSVP","gatherpress")}return(0,l.__)("RSVP","gatherpress")})(c))),(0,e.createElement)(u(),{isOpen:w,onRequestClose:E,style:{overlay:{zIndex:999999999},content:{top:"50%",left:"50%",right:"auto",bottom:"auto",marginRight:"-50%",transform:"translate(-50%, -50%)"}},contentLabel:(0,l.__)("Edit RSVP","gatherpress")},0===n.length&&(0,e.createElement)((()=>(0,e.createElement)("div",{className:"gp-modal gp-modal__rsvp"},(0,e.createElement)("div",{className:"gp-modal__header"},(0,l.__)("Login Required","gatherpress")),(0,e.createElement)("div",{className:"gp-modal__content"},(0,e.createElement)("div",{className:"gp-modal__text"},(0,l.__)("You must ","gatherpress"),(0,e.createElement)("a",{href:je("urls.loginUrl")},(0,l.__)("Login","gatherpress")),(0,l.__)(" to RSVP to events.","gatherpress")),""!==je("urls.registrationUrl")&&(0,e.createElement)("div",{className:"gp-modal__text"},(0,e.createElement)("a",{href:je("urls.registrationUrl")},(0,l.__)("Register","gatherpress")),(0,l.__)(" if you do not have an account.","gatherpress"))),(0,e.createElement)(i.ButtonGroup,{className:"gp-buttons wp-block-buttons"},(0,e.createElement)("div",{className:"gp-buttons__container wp-block-button"},(0,e.createElement)("a",{href:"#",onClick:E,className:"gp-buttons__button wp-block-button__link"},(0,l.__)("Close","gatherpress")))))),null),0!==n.length&&(0,e.createElement)((({status:t})=>{let n="",o="";return"not_attending"===t||"no_status"===t?(n="attending",o=(0,l.__)("Attend","gatherpress")):(n="not_attending",o=(0,l._x)("Not Attending","action of not attending","gatherpress")),(0,e.createElement)("div",{className:"gp-modal gp-modal__rsvp"},(0,e.createElement)("div",{className:"gp-modal__header"},S(c)?S(c):(0,e.createElement)(i.Spinner,null)),(0,e.createElement)("div",{className:"gp-modal__content"},(0,e.createElement)("div",{className:"gp-modal__text"},s((0,l.sprintf)(/* translators: %s: button label. */ -(0,l.__)("To set or change your attending status, simply click the %s button below.","gatherpress"),""+o+""))),a?(0,e.createElement)("div",{className:"gp-modal__anonymous"},(0,e.createElement)("input",{id:"gp-anonymous",type:"checkbox",onChange:e=>{const t=Number(e.target.checked);f(t),x(e,c,t,m,!1)},checked:p}),(0,e.createElement)("label",{htmlFor:"gp-anonymous",tabIndex:"0",className:"gp-tooltip","data-tooltip-id":"gp-anonymous-tooltip","data-tooltip-content":(0,l.__)("Only admins will see your identity.","gatherpress")},(0,l.__)("List me as anonymous.","gatherpress")),(0,e.createElement)(Pe,{id:"gp-anonymous-tooltip"})):(0,e.createElement)(e.Fragment,null)),(0,e.createElement)(i.ButtonGroup,{className:"gp-buttons wp-block-buttons"},(0,e.createElement)("div",{className:"gp-buttons__container wp-block-button is-style-outline"},(0,e.createElement)("a",{href:"#",onClick:e=>x(e,n,p),className:"gp-buttons__button wp-block-button__link"},o)),(0,e.createElement)("div",{className:"gp-buttons__container wp-block-button"},(0,e.createElement)("a",{href:"#",onClick:E,className:"gp-buttons__button wp-block-button__link"},(0,l.__)("Close","gatherpress")))))}),{status:c}))),"no_status"!==c&&(0,e.createElement)("div",{className:"gp-status"},(0,e.createElement)(De,{type:o,status:c}),0{const[l,a]=(0,r.useState)(i);((e,t="")=>{for(const[n,o]of Object.entries(e)){let e=n;t&&(e+="_"+String(t)),addEventListener(e,(e=>{o(e.detail)}),!1)}})({setRsvpResponse:a},t);let s="";return"object"==typeof l&&void 0!==l[n]&&(i=[...l[n].responses],o&&(i=i.splice(0,o)),s=i.map(((t,n)=>{const{name:o,photo:r}=t;return(0,e.createElement)("figure",{key:n,className:"gp-rsvp-response__member-avatar"},(0,e.createElement)("img",{alt:o,title:o,src:r}))}))),(0,e.createElement)(e.Fragment,null,s)},He=t=>{const{type:n,event:o,eventOptions:r}=t,i="default"===r.imageSize?"featured_image":"featured_image_"+r.imageSize,l=s(o[i]),a="gp-events-list";let c="location";const u=o.venue?.is_online_event;return u&&(c="video-alt2"),(0,e.createElement)("div",{className:`${a}`},(0,e.createElement)("div",{className:`${a}__header`},(0,e.createElement)("div",{className:`${a}__info`},r.showFeaturedImage&&(0,e.createElement)("figure",{className:`${a}__image`},(0,e.createElement)("a",{href:o.permalink},l)),(0,e.createElement)("div",{className:`${a}__datetime`},(0,e.createElement)("strong",null,o.datetime_start)),(0,e.createElement)("div",{className:`${a}__title`},(0,e.createElement)("a",{href:o.permalink},s(o.title))),o.venue&&r.showVenue&&(0,e.createElement)("div",{className:`${a}__venue`},(0,e.createElement)("span",{className:`dashicons dashicons-${c}`}),!u&&(0,e.createElement)("a",{href:o.venue.permalink},s(o.venue.name)),u&&(0,e.createElement)("span",null,s(o.venue.name))),r.showDescription&&(0,e.createElement)("div",{className:`${a}__content`},(0,e.createElement)("div",{className:`${a}__excerpt`},s(o.excerpt.split(" ").splice(0,parseInt(r.descriptionLimit)).join(" ")+"[…]"))))),(0,e.createElement)("div",{className:`${a}__footer`},r.showRsvpResponse&&(0,e.createElement)("div",{className:"gp-rsvp-response__items"},(0,e.createElement)(Fe,{postId:o.ID,value:"attending",responses:o.responses,limit:"3"})),"upcoming"===n&&r.showRsvp&&(0,e.createElement)(Ie,{postId:o.ID,currentUser:o.current_user,type:n,enableAnonymousRsvp:o.enable_anonymous_rsvp}),"past"===n&&r.showRsvp&&""!==o.current_user&&(0,e.createElement)(De,{type:n,status:o.current_user?.status})))},Ue=t=>{const{eventOptions:n,maxNumberOfEvents:o,datetimeFormat:a,type:s,topics:c,venues:u}=t,[d,p]=(0,r.useState)([]),[f,m]=(0,r.useState)(!1),h=d.map((t=>(0,e.createElement)(He,{key:t.ID,eventOptions:n,type:s,event:t})));return(0,r.useEffect)((()=>{let e="",t="";"object"==typeof c&&(e=c.map((e=>e.slug))?.join(",")),"object"==typeof u&&(t=u.map((e=>e.slug))?.join(","));const n=je("urls.eventRestApi")+`/events-list?event_list_type=${s}&max_number=${o}&datetime_format=${a}&topics=${e}&venues=${t}`;je("misc.isUserLoggedIn")?Le()({path:n}).then((e=>{m(!0),p(e)})):fetch(n).then((e=>e.json())).then((e=>{m(!0),p(e)}))}),[p,o,a,s,c,u]),(0,e.createElement)("div",{className:`gp-${s}-events-list`},!f&&(0,e.createElement)(i.Spinner,null),f&&0===d.length&&(()=>{const t="upcoming"===s?(0,l.__)("There are no upcoming events.","gatherpress"):(0,l.__)("There are no past events.","gatherpress");return(0,e.createElement)("div",{className:`gp-${s}-events__no_events_message`},t)})(),f&&h)};o()((()=>{const t=document.querySelectorAll('[data-gp_block_name="events-list"]');for(let s=0;s { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./src/components/EventItem.js": +/*!*************************************!*\ + !*** ./src/components/EventItem.js ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var html_react_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! html-react-parser */ "./node_modules/html-react-parser/esm/index.mjs"); +/* harmony import */ var _Rsvp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Rsvp */ "./src/components/Rsvp.js"); +/* harmony import */ var _RsvpResponseAvatarOnly__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./RsvpResponseAvatarOnly */ "./src/components/RsvpResponseAvatarOnly.js"); +/* harmony import */ var _RsvpStatusResponse__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./RsvpStatusResponse */ "./src/components/RsvpStatusResponse.js"); + +/** + * External dependencies. + */ + + +/** + * Internal dependencies. + */ + + + + +/** + * EventItem component for GatherPress. + * + * This component represents an individual event item in the events list. + * It displays various details of the event, including the featured image, + * date and time, title, venue, and description. It also handles RSVP and + * RSVP response components based on the event type. + * + * @since 1.0.0 + * + * @param {Object} props - Component properties. + * @param {string} props.type - The type of the event (upcoming or past). + * @param {Object} props.event - The event data. + * @param {Object} props.eventOptions - Options for displaying the event. + * + * @return {JSX.Element} The rendered React component. + */ +const EventItem = props => { + const { + type, + event, + eventOptions + } = props; + const limitExcerpt = excerpt => { + return excerpt.split(' ').splice(0, parseInt(eventOptions.descriptionLimit)).join(' ') + '[…]'; + }; + const size = eventOptions.imageSize === 'default' ? 'featured_image' : 'featured_image_' + eventOptions.imageSize; + const featuredImage = (0,html_react_parser__WEBPACK_IMPORTED_MODULE_1__["default"])(event[size]); + const eventClass = `gp-events-list`; + let icon = 'location'; + const isOnlineEvent = event.venue?.is_online_event; + if (isOnlineEvent) { + icon = 'video-alt2'; + } + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `${eventClass}` + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `${eventClass}__header` + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `${eventClass}__info` + }, eventOptions.showFeaturedImage && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("figure", { + className: `${eventClass}__image` + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: event.permalink + }, featuredImage)), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `${eventClass}__datetime` + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("strong", null, event.datetime_start)), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `${eventClass}__title` + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: event.permalink + }, (0,html_react_parser__WEBPACK_IMPORTED_MODULE_1__["default"])(event.title))), event.venue && eventOptions.showVenue && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `${eventClass}__venue` + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { + className: `dashicons dashicons-${icon}` + }), !isOnlineEvent && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: event.venue.permalink + }, (0,html_react_parser__WEBPACK_IMPORTED_MODULE_1__["default"])(event.venue.name)), isOnlineEvent && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, (0,html_react_parser__WEBPACK_IMPORTED_MODULE_1__["default"])(event.venue.name))), eventOptions.showDescription && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `${eventClass}__content` + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `${eventClass}__excerpt` + }, (0,html_react_parser__WEBPACK_IMPORTED_MODULE_1__["default"])(limitExcerpt(event.excerpt)))))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `${eventClass}__footer` + }, eventOptions.showRsvpResponse && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-rsvp-response__items" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_RsvpResponseAvatarOnly__WEBPACK_IMPORTED_MODULE_3__["default"], { + postId: event.ID, + value: "attending", + responses: event.responses, + limit: "3" + })), 'upcoming' === type && eventOptions.showRsvp && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_Rsvp__WEBPACK_IMPORTED_MODULE_2__["default"], { + postId: event.ID, + currentUser: event.current_user, + type: type, + enableAnonymousRsvp: event.enable_anonymous_rsvp, + enableInitialDecline: event.enable_initial_decline + }), 'past' === type && eventOptions.showRsvp && '' !== event.current_user && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_RsvpStatusResponse__WEBPACK_IMPORTED_MODULE_4__["default"], { + type: type, + status: event.current_user?.status + }))); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EventItem); + +/***/ }), + +/***/ "./src/components/EventsList.js": +/*!**************************************!*\ + !*** ./src/components/EventsList.js ***! + \**************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _EventItem__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./EventItem */ "./src/components/EventItem.js"); +/* harmony import */ var _helpers_globals__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helpers/globals */ "./src/helpers/globals.js"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_6__); + +/** + * WordPress dependencies. + */ + + + + +/** + * Internal dependencies. + */ + + + + +/** + * EventsList component for GatherPress. + * + * This component displays a list of events based on the provided parameters. + * It retrieves the events from the server using the WordPress REST API or + * GatherPress custom API, depending on whether the user is logged in or not. + * + * @since 1.0.0 + * + * @param {Object} props - Component properties. + * @param {Object} props.eventOptions - Options for displaying each event in the list. + * @param {number} props.maxNumberOfEvents - The maximum number of events to display. + * @param {string} props.type - The type of events to retrieve ('upcoming' or 'past'). + * @param {Array} props.topics - An array of topic objects to filter events by. + * @param {Array} props.venues - An array of venue objects to filter events by. + * + * @return {JSX.Element} The rendered React component. + */ +const EventsList = props => { + const { + eventOptions, + maxNumberOfEvents, + datetimeFormat, + type, + topics, + venues + } = props; + const [events, setEvents] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.useState)([]); + const [loaded, setLoaded] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.useState)(false); + const renderEvents = events.map(event => { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_EventItem__WEBPACK_IMPORTED_MODULE_4__["default"], { + key: event.ID, + eventOptions: eventOptions, + type: type, + event: event + }); + }); + const renderNoEventsMessage = () => { + const message = 'upcoming' === type ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('There are no upcoming events.', 'gatherpress') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('There are no past events.', 'gatherpress'); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `gp-${type}-events__no_events_message` + }, message); + }; + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => { + let topicsString = ''; + let venuesString = ''; + if ('object' === typeof topics) { + topicsString = topics.map(topic => { + return topic.slug; + })?.join(','); + } + if ('object' === typeof venues) { + venuesString = venues.map(venue => { + return venue.slug; + })?.join(','); + } + const endpoint = (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_5__.getFromGlobal)('urls.eventRestApi') + `/events-list?event_list_type=${type}&max_number=${maxNumberOfEvents}&datetime_format=${datetimeFormat}&topics=${topicsString}&venues=${venuesString}`; + + /** + * Check if user is logged in, so we have current_user for the event present, which + * allows them to interact with the block. + */ + if ((0,_helpers_globals__WEBPACK_IMPORTED_MODULE_5__.getFromGlobal)('misc.isUserLoggedIn')) { + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_6___default()({ + path: endpoint + }).then(data => { + setLoaded(true); + setEvents(data); + }); + } else { + /** + * Not using apiFetch helper here as it will use X-Wp-Nonce and cache it when page caching is on causing a 403. + * + * @see https://github.com/GatherPress/gatherpress/issues/300 + */ + fetch(endpoint).then(response => { + return response.json(); + }).then(data => { + setLoaded(true); + setEvents(data); + }); + } + }, [setEvents, maxNumberOfEvents, datetimeFormat, type, topics, venues]); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: `gp-${type}-events-list` + }, !loaded && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Spinner, null), loaded && 0 === events.length && renderNoEventsMessage(), loaded && renderEvents); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EventsList); + +/***/ }), + +/***/ "./src/components/Rsvp.js": +/*!********************************!*\ + !*** ./src/components/Rsvp.js ***! + \********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var react_modal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-modal */ "./node_modules/react-modal/lib/index.js"); +/* harmony import */ var react_modal__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_modal__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var html_react_parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! html-react-parser */ "./node_modules/html-react-parser/esm/index.mjs"); +/* harmony import */ var react_tooltip__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-tooltip */ "./node_modules/react-tooltip/dist/react-tooltip.min.mjs"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); +/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _helpers_broadcasting__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../helpers/broadcasting */ "./src/helpers/broadcasting.js"); +/* harmony import */ var _RsvpStatusResponse__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./RsvpStatusResponse */ "./src/components/RsvpStatusResponse.js"); +/* harmony import */ var _helpers_globals__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../helpers/globals */ "./src/helpers/globals.js"); + +/** + * External dependencies + */ + + + + +/** + * WordPress dependencies. + */ + + + + + +/** + * Internal Dependencies. + */ + + + + +/** + * Rsvp component for GatherPress. + * + * This component provides functionality for users to RSVP to events. It includes a button + * to open a modal for RSVP actions, handles different RSVP statuses, and updates the RSVP + * status and guest count accordingly. If the enableAnonymousRsvp prop is true, it shows + * a checkbox to permit anonymous RSVPs. The component communicates with the server through + * REST API calls and broadcasts changes to other components. + * + * @since 1.0.0 + * + * @param {Object} props - Component props. + * @param {number} props.postId - The ID of the event. + * @param {Object} [props.currentUser=''] - Current user's RSVP information. + * @param {boolean} props.enableAnonymousRsvp - If true, shows a checkbox to allow anonymous RSVPs. + * @param {boolean} props.enableInitialDecline- If true, shows an option to decline attendance initially. + * @param {string} props.type - Type of event ('upcoming' or 'past'). + * + * @return {JSX.Element} The rendered React component. + */ +const Rsvp = ({ + postId, + currentUser = '', + type, + enableAnonymousRsvp, + enableInitialDecline +}) => { + const [rsvpStatus, setRsvpStatus] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useState)(currentUser.status); + const [rsvpAnonymous, setRsvpAnonymous] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useState)(Number(currentUser.anonymous)); + const [rsvpGuests, setRsvpGuests] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useState)(currentUser.guests); + const [selectorHidden, setSelectorHidden] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useState)('hidden'); + const [selectorExpanded, setSelectorExpanded] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useState)('false'); + const [modalIsOpen, setIsOpen] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useState)(false); + const customStyles = { + overlay: { + zIndex: 999999999 + }, + content: { + top: '50%', + left: '50%', + right: 'auto', + bottom: 'auto', + marginRight: '-50%', + transform: 'translate(-50%, -50%)' + } + }; + const openModal = e => { + e.preventDefault(); + setIsOpen(true); + }; + + // No need to show block if event is in the past. + if ('past' === type) { + return ''; + } + + // Might be better way to do this, but should only run on frontend, not admin. + if ('undefined' === typeof adminpage) { + react_modal__WEBPACK_IMPORTED_MODULE_1___default().setAppElement('.gp-enabled'); + } + const closeModal = e => { + e.preventDefault(); + setIsOpen(false); + }; + const onAnchorClick = async (e, status, anonymous, guests = 0, close = true) => { + e.preventDefault(); + if ('attending' !== status) { + guests = 0; + } + _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default()({ + path: (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_10__.getFromGlobal)('urls.eventRestApi') + '/rsvp', + method: 'POST', + data: { + post_id: postId, + status, + guests, + anonymous, + _wpnonce: (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_10__.getFromGlobal)('misc.nonce') + } + }).then(res => { + if (res.success) { + setRsvpStatus(res.status); + setRsvpGuests(res.guests); + const count = { + all: 0, + attending: 0, + not_attending: 0, + // eslint-disable-line camelcase + waiting_list: 0 // eslint-disable-line camelcase + }; + + for (const [key, value] of Object.entries(res.responses)) { + count[key] = value.count; + } + const payload = { + setRsvpStatus: res.status, + setRsvpResponse: res.responses, + setRsvpCount: count, + setRsvpSeeAllLink: count[res.status] > 8, + // @todo make defaultLimit a setting, not hardcoded. + setOnlineEventLink: res.online_link + }; + (0,_helpers_broadcasting__WEBPACK_IMPORTED_MODULE_8__.Broadcaster)(payload, res.event_id); + if (close) { + closeModal(e); + } + } + }); + }; + const getButtonText = status => { + switch (status) { + case 'attending': + case 'waiting_list': + case 'not_attending': + return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Edit RSVP', 'gatherpress'); + } + return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('RSVP', 'gatherpress'); + }; + const getModalLabel = status => { + switch (status) { + case 'attending': + return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)("You're attending", 'gatherpress'); + case 'waiting_list': + return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)("You're wait listed", 'gatherpress'); + case 'not_attending': + return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)("You're not attending", 'gatherpress'); + } + return (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('RSVP to this event', 'gatherpress'); + }; + const onSpanKeyDown = e => { + if (13 === e.keyCode) { + setSelectorHidden('hidden' === selectorHidden ? 'show' : 'hidden'); + setSelectorExpanded('false' === selectorExpanded ? 'true' : 'false'); + } + }; + const LoggedOutModal = () => { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-modal gp-modal__rsvp" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-modal__header" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Login Required', 'gatherpress')), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-modal__content" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-modal__text" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('You must ', 'gatherpress'), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_10__.getFromGlobal)('urls.loginUrl') + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Login', 'gatherpress')), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)(' to RSVP to events.', 'gatherpress')), '' !== (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_10__.getFromGlobal)('urls.registrationUrl') && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-modal__text" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: (0,_helpers_globals__WEBPACK_IMPORTED_MODULE_10__.getFromGlobal)('urls.registrationUrl') + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Register', 'gatherpress')), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)(' if you do not have an account.', 'gatherpress'))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.ButtonGroup, { + className: "gp-buttons wp-block-buttons" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-buttons__container wp-block-button" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: "#", + onClick: closeModal, + className: "gp-buttons__button wp-block-button__link" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Close', 'gatherpress'))))); + }; + const LoggedInModal = ({ + status + }) => { + let buttonStatus = ''; + let buttonLabel = ''; + if ('not_attending' === status || 'no_status' === status) { + buttonStatus = 'attending'; + buttonLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Attend', 'gatherpress'); + } else { + buttonStatus = 'not_attending'; + buttonLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__._x)('Not Attending', 'action of not attending', 'gatherpress'); + } + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-modal gp-modal__rsvp" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-modal__header" + }, getModalLabel(rsvpStatus) ? getModalLabel(rsvpStatus) : (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.Spinner, null)), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-modal__content" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-modal__text" + }, (0,html_react_parser__WEBPACK_IMPORTED_MODULE_2__["default"])((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.sprintf)( /* translators: %s: button label. */ + (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('To set or change your attending status, simply click the %s button below.', 'gatherpress'), '' + buttonLabel + ''))), enableAnonymousRsvp ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-modal__anonymous" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("input", { + id: "gp-anonymous", + type: "checkbox", + onChange: e => { + const value = Number(e.target.checked); + setRsvpAnonymous(value); + onAnchorClick(e, rsvpStatus, value, rsvpGuests, false); + }, + checked: rsvpAnonymous + }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", { + htmlFor: "gp-anonymous", + tabIndex: "0", + className: "gp-tooltip", + "data-tooltip-id": "gp-anonymous-tooltip", + "data-tooltip-content": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Only admins will see your identity.', 'gatherpress') + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('List me as anonymous.', 'gatherpress')), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react_tooltip__WEBPACK_IMPORTED_MODULE_3__.Tooltip, { + id: "gp-anonymous-tooltip" + })) : (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null)), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.ButtonGroup, { + className: "gp-buttons wp-block-buttons" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-buttons__container wp-block-button is-style-outline" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: "#", + onClick: e => onAnchorClick(e, buttonStatus, rsvpAnonymous), + className: "gp-buttons__button wp-block-button__link" + }, buttonLabel)), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-buttons__container wp-block-button" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: "#", + onClick: closeModal, + className: "gp-buttons__button wp-block-button__link" + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Close', 'gatherpress'))), enableInitialDecline && 'no_status' === rsvpStatus ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-buttons__container wp-block-button is-style-outline" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: "#", + onClick: e => onAnchorClick(e, 'not_attending', null) + }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('I can\'t attend', 'gatherpress'))) : (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null))); + }; + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-rsvp" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.ButtonGroup, { + className: "gp-buttons wp-block-buttons" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-buttons__container wp-block-button" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: "#", + className: "gp-buttons__button wp-block-button__link", + "aria-expanded": selectorExpanded, + tabIndex: "0", + onKeyDown: onSpanKeyDown, + onClick: e => openModal(e) + }, getButtonText(rsvpStatus))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)((react_modal__WEBPACK_IMPORTED_MODULE_1___default()), { + isOpen: modalIsOpen, + onRequestClose: closeModal, + style: customStyles, + contentLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Edit RSVP', 'gatherpress') + }, 0 === currentUser.length && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(LoggedOutModal, null), 0 !== currentUser.length && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(LoggedInModal, { + status: rsvpStatus + }))), 'no_status' !== rsvpStatus && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-status" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_RsvpStatusResponse__WEBPACK_IMPORTED_MODULE_9__["default"], { + type: type, + status: rsvpStatus + }), 0 < rsvpGuests && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-status__guests" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", null, "+", ' ', (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.sprintf)( /* translators: %d: Number of guests. */ + (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__._n)('%d guest', '%d guests', { + rsvpGuests + }, 'gatherpress'), { + rsvpGuests + }))))); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rsvp); + +/***/ }), + +/***/ "./src/components/RsvpResponseAvatarOnly.js": +/*!**************************************************!*\ + !*** ./src/components/RsvpResponseAvatarOnly.js ***! + \**************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _helpers_broadcasting__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../helpers/broadcasting */ "./src/helpers/broadcasting.js"); + +/** + * WordPress dependencies. + */ + + +/** + * Internal dependencies. + */ + + +/** + * RsvpResponseCard component for GatherPress. + * + * This component displays avatars of attendees who have responded to an event's RSVP. + * It receives information about the RSVP responses, including the attendee's name and photo, + * and renders their avatars accordingly. The component listens for updates to the RSVP responses + * and dynamically reflects changes. + * + * @since 1.0.0 + * + * @param {Object} props - Component props. + * @param {number} props.postId - The ID of the event. + * @param {string} props.value - The RSVP status value ('attending', 'not_attending', etc.). + * @param {number} props.limit - The maximum number of responses to display. + * @param {Array} [props.responses=[]] - An array of RSVP responses for the specified status. + * + * @return {JSX.Element} The rendered React component. + */ +const RsvpResponseCard = ({ + postId, + value, + limit, + responses = [] +}) => { + const [rsvpResponse, setRsvpResponse] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.useState)(responses); + (0,_helpers_broadcasting__WEBPACK_IMPORTED_MODULE_2__.Listener)({ + setRsvpResponse + }, postId); + let renderedItems = ''; + if ('object' === typeof rsvpResponse && 'undefined' !== typeof rsvpResponse[value]) { + responses = [...rsvpResponse[value].responses]; + if (limit) { + responses = responses.splice(0, limit); + } + renderedItems = responses.map((response, index) => { + const { + name, + photo + } = response; + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("figure", { + key: index, + className: "gp-rsvp-response__member-avatar" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + alt: name, + title: name, + src: photo + })); + }); + } + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, renderedItems); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RsvpResponseCard); + +/***/ }), + +/***/ "./src/components/RsvpStatusResponse.js": +/*!**********************************************!*\ + !*** ./src/components/RsvpStatusResponse.js ***! + \**********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); + +/** + * WordPress dependencies. + */ + + +/** + * RsvpStatusResponse component for GatherPress. + * + * This component displays the RSVP status response based on the event type (upcoming or past) + * and the provided status. It includes an icon and text representing the corresponding RSVP status. + * The component is typically used within the `Rsvp` component to show the user's RSVP status. + * + * @since 1.0.0 + * + * @param {Object} props - Component props. + * @param {string} [props.type='upcoming'] - The type of the event, either 'upcoming' or 'past'. + * @param {string} [props.status='no_status'] - The RSVP status, such as 'attending', 'waiting_list', 'not_attending', 'no_status'. + * + * @return {JSX.Element} The rendered React component. + */ +const RsvpStatusResponse = ({ + type = 'upcoming', + status = 'no_status' +}) => { + const responses = { + upcoming: { + attending: { + icon: 'dashicons dashicons-yes-alt', + text: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Attending', 'gatherpress') + }, + waiting_list: { + icon: 'dashicons dashicons-editor-help', + text: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Waiting List', 'gatherpress') + }, + not_attending: { + icon: 'dashicons dashicons-dismiss', + text: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__._x)('Not Attending', 'responded not attending', 'gatherpress') + }, + no_status: { + icon: '', + text: '' + } + }, + past: { + attending: { + icon: 'dashicons dashicons-yes-alt', + text: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Went', 'gatherpress') + }, + waiting_list: { + icon: 'dashicons dashicons-dismiss', + text: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Didn't Go", 'gatherpress') + }, + not_attending: { + icon: 'dashicons dashicons-dismiss', + text: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Didn't Go", 'gatherpress') + }, + no_status: { + icon: 'dashicons dashicons-dismiss', + text: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Didn't Go", 'gatherpress') + } + } + }; + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "gp-status__response" + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { + className: responses[type][status].icon + }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("strong", null, responses[type][status].text)); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RsvpStatusResponse); + +/***/ }), + +/***/ "./src/helpers/broadcasting.js": +/*!*************************************!*\ + !*** ./src/helpers/broadcasting.js ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Broadcaster: () => (/* binding */ Broadcaster), +/* harmony export */ Listener: () => (/* binding */ Listener) +/* harmony export */ }); +/** + * Broadcasts custom events based on the provided payload, optionally appending an identifier to each event type. + * + * @since 1.0.0 + * + * @param {Object} payload - An object containing data to be dispatched with custom events. + * @param {string} identifier - An optional identifier to append to each event type. + * + * @return {void} + */ +const Broadcaster = (payload, identifier = '') => { + for (const [key, value] of Object.entries(payload)) { + let type = key; + if (identifier) { + type += '_' + String(identifier); + } + const dispatcher = new CustomEvent(type, { + detail: value + }); + dispatchEvent(dispatcher); + } +}; + +/** + * Sets up event listeners for custom events based on the provided payload, optionally appending an identifier to each event type. + * When an event is triggered, the corresponding listener callback is executed with the event detail. + * + * @since 1.0.0 + * + * @param {Object} payload - An object specifying event types and their corresponding listener callbacks. + * @param {string} identifier - An optional identifier to append to each event type. + * + * @return {void} + */ +const Listener = (payload, identifier = '') => { + for (const [key, value] of Object.entries(payload)) { + let type = key; + if (identifier) { + type += '_' + String(identifier); + } + addEventListener(type, e => { + value(e.detail); + }, false); + } +}; + +/***/ }), + +/***/ "./src/helpers/globals.js": +/*!********************************!*\ + !*** ./src/helpers/globals.js ***! + \********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ enableSave: () => (/* binding */ enableSave), +/* harmony export */ getFromGlobal: () => (/* binding */ getFromGlobal), +/* harmony export */ isSinglePostInEditor: () => (/* binding */ isSinglePostInEditor), +/* harmony export */ setToGlobal: () => (/* binding */ setToGlobal) +/* harmony export */ }); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__); + + +/** + * Enable the Save buttons after making an update. + * + * This function uses a hacky approach to trigger a change in the post's meta, which prompts + * Gutenberg to recognize that changes have been made and enables the Save buttons. + * It dispatches an editPost action with a non-existing meta key. + * + * @since 1.0.0 + * + * @todo This is a hacky approach and relies on the behavior described in + * https://github.com/WordPress/gutenberg/issues/13774. + * Monitor the issue for any updates or changes in the Gutenberg behavior. + */ +function enableSave() { + (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.dispatch)('core/editor')?.editPost({ + meta: { + _non_existing_meta: true + } + }); +} + +/** + * Checks if the current editor session is editing a post type entity. + * + * This function determines if the current context within the WordPress editor + * is focused on editing an entity that is classified as a post type. This includes + * single posts, pages, and custom post types. It is particularly useful for distinguishing + * editor sessions that are editing post type entities from those editing other types of content, + * such as widget areas or templates in the full site editor, ensuring that specific actions or features + * are correctly applied only when editing post type entities. + * + * @return {boolean} True if the current editor session is for editing a post type entity, false otherwise. + */ +function isSinglePostInEditor() { + return 'string' === typeof (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.select)('core/editor')?.getCurrentPostType(); +} + +/** + * Get a value from the global GatherPress object based on the provided dot-separated path. + * + * This function is designed to retrieve values from the global GatherPress object. + * It takes a dot-separated path as an argument and traverses the object to return the specified value. + * If the object or any level along the path is undefined, it returns undefined. + * + * @since 1.0.0 + * + * @param {string} args - Dot-separated path to the desired property in the GatherPress global object. + * @return {*} The value at the specified path in the GatherPress global object or undefined if not found. + */ +function getFromGlobal(args) { + // eslint-disable-next-line no-undef + if ('object' !== typeof GatherPress) { + return undefined; + } + return args.split('.').reduce( + // eslint-disable-next-line no-undef + (GatherPress, level) => GatherPress && GatherPress[level], + // eslint-disable-next-line no-undef + GatherPress); +} + +/** + * Set a value to a global object based on the provided path. + * + * This function allows setting values within a nested global object using a dot-separated path. + * If the global object (GatherPress) does not exist, it will be initialized. + * + * @since 1.0.0 + * + * @param {string} args - Dot-separated path to the property. + * @param {*} value - The value to set. + * + * @return {void} + */ +function setToGlobal(args, value) { + // eslint-disable-next-line no-undef + if ('object' !== typeof GatherPress) { + return; + } + const properties = args.split('.'); + const last = properties.pop(); + + // eslint-disable-next-line no-undef + properties.reduce((all, item) => { + var _all$item; + return (_all$item = all[item]) !== null && _all$item !== void 0 ? _all$item : all[item] = {}; + }, GatherPress)[last] = value; +} + +/***/ }), + +/***/ "./node_modules/domelementtype/lib/index.js": +/*!**************************************************!*\ + !*** ./node_modules/domelementtype/lib/index.js ***! + \**************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = exports.ElementType = void 0; +/** Types of elements found in htmlparser2's DOM */ +var ElementType; +(function (ElementType) { + /** Type for the root element of a document */ + ElementType["Root"] = "root"; + /** Type for Text */ + ElementType["Text"] = "text"; + /** Type for */ + ElementType["Directive"] = "directive"; + /** Type for */ + ElementType["Comment"] = "comment"; + /** Type for