From 05e7f917bd2cc323ec270f71455bc99fe1f72ed7 Mon Sep 17 00:00:00 2001 From: olatechpro Date: Wed, 20 Dec 2023 09:49:59 +0100 Subject: [PATCH] Npm run dev --- .../lib/async-calendar/js/index.min.js | 449 +- modules/efmigration/lib/js/efmigration.min.js | 101 +- package-lock.json | 13928 +++++++++++++++- 3 files changed, 13908 insertions(+), 570 deletions(-) diff --git a/modules/calendar/lib/async-calendar/js/index.min.js b/modules/calendar/lib/async-calendar/js/index.min.js index a0107a9a..37441ebc 100644 --- a/modules/calendar/lib/async-calendar/js/index.min.js +++ b/modules/calendar/lib/async-calendar/js/index.min.js @@ -1,446 +1,3 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./modules/calendar/lib/async-calendar/js/index.jsx"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "&ReactDOM": -/*!***************************!*\ - !*** external "ReactDOM" ***! - \***************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -eval("module.exports = ReactDOM;\n\n//# sourceURL=webpack:///external_%22ReactDOM%22?"); - -/***/ }), - -/***/ "&wp.element": -/*!*****************************!*\ - !*** external "wp.element" ***! - \*****************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -eval("module.exports = wp.element;\n\n//# sourceURL=webpack:///external_%22wp.element%22?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/AsyncCalendar.jsx": -/*!******************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/AsyncCalendar.jsx ***! - \******************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return AsyncCalendar; });\n/* harmony import */ var _NavigationBar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NavigationBar */ \"./modules/calendar/lib/async-calendar/js/NavigationBar.jsx\");\n/* harmony import */ var _WeekDays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WeekDays */ \"./modules/calendar/lib/async-calendar/js/WeekDays.jsx\");\n/* harmony import */ var _MessageBar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./MessageBar */ \"./modules/calendar/lib/async-calendar/js/MessageBar.jsx\");\n/* harmony import */ var _DayCell__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DayCell */ \"./modules/calendar/lib/async-calendar/js/DayCell.jsx\");\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Functions */ \"./modules/calendar/lib/async-calendar/js/Functions.jsx\");\n/* harmony import */ var _FilterBar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./FilterBar */ \"./modules/calendar/lib/async-calendar/js/FilterBar.jsx\");\n/* harmony import */ var _ItemFormPopup__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ItemFormPopup */ \"./modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\n\nvar $ = jQuery;\nfunction AsyncCalendar(props) {\n var theme = props.theme || 'light';\n var statusValue = props.requestFilter.post_status ? props.requestFilter.post_status : '';\n var typesValue = props.requestFilter.post_type ? props.requestFilter.post_type : '';\n var weeksValue = props.requestFilter.weeks ? props.requestFilter.weeks : props.numberOfWeeksToDisplay;\n var categoryValue = '';\n\n if (props.requestFilter.category && props.requestFilter.category.value) {\n categoryValue = props.requestFilter.category.value;\n }\n\n var postTagValue = '';\n\n if (props.requestFilter.post_tag && props.requestFilter.post_tag.value) {\n postTagValue = props.requestFilter.post_tag.value;\n }\n\n var authorValue = '';\n\n if (props.requestFilter.post_author && props.requestFilter.post_author.value) {\n authorValue = props.requestFilter.post_author.value;\n }\n\n var _React$useState = React.useState(Object(_Functions__WEBPACK_IMPORTED_MODULE_4__[\"getBeginDateOfWeekByDate\"])(props.firstDateToDisplay, props.weekStartsOnSunday)),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n firstDateToDisplay = _React$useState2[0],\n setFirstDateToDisplay = _React$useState2[1];\n\n var _React$useState3 = React.useState(weeksValue),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n numberOfWeeksToDisplay = _React$useState4[0],\n setNumberOfWeeksToDisplay = _React$useState4[1];\n\n var _React$useState5 = React.useState(props.items),\n _React$useState6 = _slicedToArray(_React$useState5, 2),\n itemsByDate = _React$useState6[0],\n setItemsByDate = _React$useState6[1];\n\n var _React$useState7 = React.useState(false),\n _React$useState8 = _slicedToArray(_React$useState7, 2),\n isLoading = _React$useState8[0],\n setIsLoading = _React$useState8[1];\n\n var _React$useState9 = React.useState(false),\n _React$useState10 = _slicedToArray(_React$useState9, 2),\n isDragging = _React$useState10[0],\n setIsDragging = _React$useState10[1];\n\n var _React$useState11 = React.useState(),\n _React$useState12 = _slicedToArray(_React$useState11, 2),\n message = _React$useState12[0],\n setMessage = _React$useState12[1];\n\n var _React$useState13 = React.useState(statusValue),\n _React$useState14 = _slicedToArray(_React$useState13, 2),\n filterStatus = _React$useState14[0],\n setFilterStatus = _React$useState14[1];\n\n var _React$useState15 = React.useState(categoryValue),\n _React$useState16 = _slicedToArray(_React$useState15, 2),\n filterCategory = _React$useState16[0],\n setFilterCategory = _React$useState16[1];\n\n var _React$useState17 = React.useState(postTagValue),\n _React$useState18 = _slicedToArray(_React$useState17, 2),\n filterTag = _React$useState18[0],\n setFilterTag = _React$useState18[1];\n\n var _React$useState19 = React.useState(authorValue),\n _React$useState20 = _slicedToArray(_React$useState19, 2),\n filterAuthor = _React$useState20[0],\n setFilterAuthor = _React$useState20[1];\n\n var _React$useState21 = React.useState(typesValue),\n _React$useState22 = _slicedToArray(_React$useState21, 2),\n filterPostType = _React$useState22[0],\n setFilterPostType = _React$useState22[1];\n\n var _React$useState23 = React.useState(weeksValue),\n _React$useState24 = _slicedToArray(_React$useState23, 2),\n filterWeeks = _React$useState24[0],\n setFilterWeeks = _React$useState24[1];\n\n var _React$useState25 = React.useState(),\n _React$useState26 = _slicedToArray(_React$useState25, 2),\n openedItemId = _React$useState26[0],\n setOpenedItemId = _React$useState26[1];\n\n var _React$useState27 = React.useState([]),\n _React$useState28 = _slicedToArray(_React$useState27, 2),\n openedItemData = _React$useState28[0],\n setOpenedItemData = _React$useState28[1];\n\n var _React$useState29 = React.useState(0),\n _React$useState30 = _slicedToArray(_React$useState29, 2),\n openedItemRefreshCount = _React$useState30[0],\n setOpenedItemRefreshCount = _React$useState30[1];\n\n var _React$useState31 = React.useState(0),\n _React$useState32 = _slicedToArray(_React$useState31, 2),\n refreshCount = _React$useState32[0],\n setRefreshCount = _React$useState32[1];\n\n var _React$useState33 = React.useState(),\n _React$useState34 = _slicedToArray(_React$useState33, 2),\n hoveredDate = _React$useState34[0],\n setHoveredDate = _React$useState34[1];\n\n var _React$useState35 = React.useState(),\n _React$useState36 = _slicedToArray(_React$useState35, 2),\n formDate = _React$useState36[0],\n setFormDate = _React$useState36[1];\n\n var DRAG_AND_DROP_HOVERING_CLASS = 'publishpress-calendar-day-hover';\n\n var getUrl = function getUrl(action, query) {\n if (!query) {\n query = '';\n }\n\n return props.ajaxUrl + '?action=' + action + '&nonce=' + props.nonce + query;\n };\n\n var addEventListeners = function addEventListeners() {\n document.addEventListener('keydown', onDocumentKeyDown);\n $(document).on('publishpress_calendar:close_popup', onCloseItemPopup);\n };\n\n var removeEventListeners = function removeEventListeners() {\n document.removeEventListener('keydown', onDocumentKeyDown);\n $('.publishpress-calendar tbody > tr > td').off('mouseenter');\n };\n\n var didMount = function didMount() {\n addEventListeners();\n\n if (props.userCanAddPosts) {\n initClickToCreateFeature();\n }\n\n return didUnmount;\n };\n\n var didUnmount = function didUnmount() {\n removeEventListeners();\n };\n\n var fetchCalendarData = function fetchCalendarData() {\n setIsLoading(true);\n setMessage(props.strings.loading);\n var dataUrl = getUrl(props.actionGetData, '&start_date=' + Object(_Functions__WEBPACK_IMPORTED_MODULE_4__[\"getDateAsStringInWpFormat\"])(Object(_Functions__WEBPACK_IMPORTED_MODULE_4__[\"getBeginDateOfWeekByDate\"])(firstDateToDisplay, props.weekStartsOnSunday)) + '&number_of_weeks=' + numberOfWeeksToDisplay);\n\n if (filterStatus) {\n dataUrl += '&post_status=' + filterStatus;\n }\n\n if (filterCategory) {\n dataUrl += '&category=' + filterCategory;\n }\n\n if (filterTag) {\n dataUrl += '&post_tag=' + filterTag;\n }\n\n if (filterAuthor) {\n dataUrl += '&post_author=' + filterAuthor;\n }\n\n if (filterPostType) {\n dataUrl += '&post_type=' + filterPostType;\n }\n\n if (filterWeeks) {\n dataUrl += '&weeks=' + filterWeeks;\n }\n\n fetch(dataUrl).then(function (response) {\n return response.json();\n }).then(function (fetchedData) {\n setItemsByDate(fetchedData);\n setIsLoading(false);\n setMessage(null);\n resetCSSClasses();\n });\n };\n\n var resetCSSClasses = function resetCSSClasses() {\n $('.' + DRAG_AND_DROP_HOVERING_CLASS).removeClass(DRAG_AND_DROP_HOVERING_CLASS);\n $('.publishpress-calendar-loading').removeClass('publishpress-calendar-loading');\n };\n\n var fetchCalendarItemData = function fetchCalendarItemData() {\n if (!openedItemId) {\n return;\n }\n\n setIsLoading(true);\n setMessage(props.strings.loadingItem);\n var dataUrl = props.ajaxUrl + '?action=' + 'publishpress_calendar_get_post_data' + '&nonce=' + props.nonce + '&id=' + openedItemId;\n fetch(dataUrl).then(function (response) {\n return response.json();\n }).then(function (data) {\n setIsLoading(false);\n setMessage(null);\n setOpenedItemData(data);\n });\n };\n\n var addOffsetInWeeksToFirstDateToDisplay = function addOffsetInWeeksToFirstDateToDisplay(offsetInWeeks) {\n setFirstDateToDisplay(new Date(firstDateToDisplay.getTime() + Object(_Functions__WEBPACK_IMPORTED_MODULE_4__[\"calculateWeeksInMilliseconds\"])(offsetInWeeks)));\n };\n\n var handleRefreshOnClick = function handleRefreshOnClick(e) {\n e.preventDefault();\n setRefreshCount(refreshCount + 1);\n };\n\n var handleBackPageOnClick = function handleBackPageOnClick(e) {\n e.preventDefault();\n addOffsetInWeeksToFirstDateToDisplay(numberOfWeeksToDisplay * -1);\n };\n\n var handleBackOnClick = function handleBackOnClick(e) {\n e.preventDefault();\n addOffsetInWeeksToFirstDateToDisplay(-1);\n };\n\n var handleForwardOnClick = function handleForwardOnClick(e) {\n e.preventDefault();\n addOffsetInWeeksToFirstDateToDisplay(1);\n };\n\n var handleForwardPageOnClick = function handleForwardPageOnClick(e) {\n e.preventDefault();\n addOffsetInWeeksToFirstDateToDisplay(numberOfWeeksToDisplay);\n };\n\n var handleTodayOnClick = function handleTodayOnClick(e) {\n e.preventDefault();\n setFirstDateToDisplay(Object(_Functions__WEBPACK_IMPORTED_MODULE_4__[\"getBeginDateOfWeekByDate\"])(props.todayDate, props.weekStartsOnSunday));\n };\n\n var moveCalendarItemToANewDate = function moveCalendarItemToANewDate(itemDate, itemIndex, newYear, newMonth, newDay) {\n var item = itemsByDate[itemDate][itemIndex];\n setIsLoading(true);\n setMessage(props.strings.movingTheItem);\n var dataUrl = getUrl(props.actionMoveItem);\n var formData = new FormData();\n formData.append('id', item.id);\n formData.append('year', newYear);\n formData.append('month', newMonth);\n formData.append('day', newDay);\n fetch(dataUrl, {\n method: 'POST',\n body: formData\n }).then(function (response) {\n return response.json();\n }).then(function () {\n setRefreshCount(refreshCount + 1);\n });\n };\n\n var handleOnDropItemCallback = function handleOnDropItemCallback(event, ui) {\n var $dayCell = $(event.target);\n var $item = $(ui.draggable[0]);\n var dateTime = Object(_Functions__WEBPACK_IMPORTED_MODULE_4__[\"getDateAsStringInWpFormat\"])(Object(_Functions__WEBPACK_IMPORTED_MODULE_4__[\"getDateInstanceFromString\"])($item.data('datetime')));\n $(event.target).addClass('publishpress-calendar-loading');\n moveCalendarItemToANewDate(dateTime, $item.data('index'), $dayCell.data('year'), $dayCell.data('month'), $dayCell.data('day'));\n };\n\n var handleOnHoverCellCallback = function handleOnHoverCellCallback(event, ui) {\n resetCSSClasses();\n $(event.target).addClass(DRAG_AND_DROP_HOVERING_CLASS);\n };\n\n var itemPopupIsOpenedById = function itemPopupIsOpenedById(id) {\n return id === openedItemId;\n };\n\n var initDraggableAndDroppableBehaviors = function initDraggableAndDroppableBehaviors() {\n $('.publishpress-calendar-day-items li').draggable({\n zIndex: 99999,\n helper: 'clone',\n containment: '.publishpress-calendar table',\n start: function start(event, ui) {\n // Do not drag the item if the popup is opened.\n if (itemPopupIsOpenedById($(event.target).data('id'))) {\n return false;\n }\n\n if (!$(event.target).hasClass('publishpress-calendar-item-movable')) {\n return false;\n }\n\n $(event.target).addClass('ui-draggable-target');\n resetOpenedItemInPopup();\n setIsDragging(true);\n },\n stop: function stop(event, ui) {\n $('.ui-draggable-target').removeClass('ui-draggable-target');\n setIsDragging(false);\n }\n });\n $('.publishpress-calendar tbody > tr > td').droppable({\n drop: handleOnDropItemCallback,\n over: handleOnHoverCellCallback\n });\n };\n\n var getCellFromChild = function getCellFromChild(child) {\n var $child = $(child);\n\n if ($child.is('td.publishpress-calendar-business-day, td.publishpress-calendar-weekend-day')) {\n return $child;\n }\n\n if ($child.is('.publishpress-calendar-cell-header, .publishpress-calendar-date, .publishpress-calendar-cell-click-to-add, .publishpress-calendar-month-name')) {\n return $child.parents('td');\n }\n\n return null;\n };\n\n var getCellDate = function getCellDate(cell) {\n var date = Object(_Functions__WEBPACK_IMPORTED_MODULE_4__[\"getDateInstanceFromString\"])(cell.data('year') + '-' + cell.data('month') + '-' + cell.data('day')); // Compensate the timezone for returning the correct date\n\n if (date.getHours() > 0) {\n date.setTime(date.getTime() + 60 * 1000 * date.getTimezoneOffset());\n }\n\n return date;\n };\n\n var isHoveringCellWhileDragging = function isHoveringCellWhileDragging(cell) {\n return $(cell).hasClass(DRAG_AND_DROP_HOVERING_CLASS);\n };\n\n var initClickToCreateFeature = function initClickToCreateFeature() {\n // We have to use this variable because when the click is done on the \"click to add\" label, we can't get its parent.\n // Probably because it was already removed from the DOM.\n var lastHoveredDate;\n $('.publishpress-calendar tbody > tr > td').on('mouseover', function (e) {\n e.preventDefault();\n e.stopPropagation();\n var cell = getCellFromChild(e.target);\n\n if (cell) {\n if (isHoveringCellWhileDragging(cell)) {\n return;\n }\n\n setHoveredDate(getCellDate(cell));\n lastHoveredDate = getCellDate(cell);\n }\n }).on('mouseout', function (e) {\n e.stopPropagation();\n e.preventDefault();\n\n if (getCellFromChild(e.relatedTarget)) {\n return;\n }\n\n setHoveredDate(null);\n lastHoveredDate = null;\n }).on('click', function (e) {\n var cell = getCellFromChild(e.target);\n\n if (cell) {\n setOpenedItemId(null);\n setFormDate(lastHoveredDate);\n }\n });\n };\n\n var onFilterEventCallback = function onFilterEventCallback(filterName, value) {\n if ('status' === filterName) {\n setFilterStatus(value);\n }\n\n if ('category' === filterName) {\n setFilterCategory(value);\n }\n\n if ('tag' === filterName) {\n setFilterTag(value);\n }\n\n if ('author' === filterName) {\n setFilterAuthor(value);\n }\n\n if ('postType' === filterName) {\n setFilterPostType(value);\n }\n\n if ('weeks' === filterName) {\n value = parseInt(value);\n\n if (value === 0 || isNaN(value)) {\n value = props.numberOfWeeksToDisplay;\n }\n\n setFilterWeeks(value);\n setNumberOfWeeksToDisplay(value);\n }\n };\n\n var resetOpenedItemInPopup = function resetOpenedItemInPopup() {\n setOpenedItemId(null);\n setOpenedItemData(null);\n setFormDate(null);\n };\n\n var onClickItem = function onClickItem(id) {\n setOpenedItemData(null);\n setHoveredDate(null);\n setFormDate(null);\n setOpenedItemId(id);\n };\n\n var onPopupItemActionClick = function onPopupItemActionClick(action, id, result) {\n setOpenedItemRefreshCount(openedItemRefreshCount + 1);\n };\n\n var onDocumentKeyDown = function onDocumentKeyDown(e) {\n if (e.key === 'Escape') {\n resetOpenedItemInPopup();\n }\n };\n\n var getOpenedItemData = function getOpenedItemData() {\n return openedItemData;\n };\n\n var onCloseForm = function onCloseForm() {\n setRefreshCount(refreshCount + 1);\n setFormDate(null);\n };\n\n var onCloseItemPopup = function onCloseItemPopup() {\n setOpenedItemId(null);\n };\n\n var calendarTableBodyRowsWithCells = function calendarTableBodyRowsWithCells() {\n var numberOfDaysToDisplay = numberOfWeeksToDisplay * 7;\n var firstDate = Object(_Functions__WEBPACK_IMPORTED_MODULE_4__[\"getBeginDateOfWeekByDate\"])(firstDateToDisplay, props.weekStartsOnSunday);\n var tableRows = [];\n var rowCells = [];\n var dayIndexInTheRow = 0;\n var dayDate;\n var dateString;\n var lastMonthDisplayed = firstDate.getMonth();\n\n for (var dataIndex = 0; dataIndex < numberOfDaysToDisplay; dataIndex++) {\n if (dayIndexInTheRow === 0) {\n rowCells = [];\n }\n\n dayDate = new Date(firstDate);\n dayDate.setDate(dayDate.getDate() + dataIndex);\n dateString = Object(_Functions__WEBPACK_IMPORTED_MODULE_4__[\"getDateAsStringInWpFormat\"])(dayDate);\n rowCells.push( /*#__PURE__*/React.createElement(_DayCell__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n key: 'day-' + dayDate.getTime(),\n date: dayDate,\n shouldDisplayMonthName: lastMonthDisplayed !== dayDate.getMonth() || dataIndex === 0,\n todayDate: props.todayDate,\n isLoading: false,\n isHovering: !isDragging && hoveredDate && hoveredDate.getTime() === dayDate.getTime() && !formDate,\n items: itemsByDate[dateString] || [],\n maxVisibleItems: parseInt(props.maxVisibleItems),\n timeFormat: props.timeFormat,\n openedItemId: openedItemId,\n getOpenedItemDataCallback: getOpenedItemData,\n ajaxUrl: props.ajaxUrl,\n onClickItemCallback: onClickItem,\n onItemActionClickCallback: onPopupItemActionClick,\n strings: props.strings\n }));\n dayIndexInTheRow++;\n\n if (dayIndexInTheRow === 7) {\n dayIndexInTheRow = 0;\n tableRows.push( /*#__PURE__*/React.createElement(\"tr\", {\n key: \"calendar-row-\".concat(tableRows.length)\n }, rowCells));\n }\n\n lastMonthDisplayed = dayDate.getMonth();\n }\n\n return tableRows;\n };\n\n React.useEffect(didMount, []);\n React.useEffect(initDraggableAndDroppableBehaviors);\n\n if (props.userCanAddPosts) {\n React.useEffect(initClickToCreateFeature, [firstDateToDisplay, numberOfWeeksToDisplay, filterWeeks, filterAuthor, filterTag, filterCategory, filterStatus, filterPostType, refreshCount]);\n }\n\n React.useEffect(fetchCalendarData, [firstDateToDisplay, numberOfWeeksToDisplay, filterWeeks, filterAuthor, filterTag, filterCategory, filterStatus, filterPostType, refreshCount]);\n React.useEffect(fetchCalendarItemData, [openedItemId, openedItemRefreshCount]);\n var componentClassName = ['publishpress-calendar', 'publishpress-calendar-theme-' + theme];\n\n if (props.userCanAddPosts) {\n componentClassName.push('user-can-add-posts');\n }\n\n return /*#__PURE__*/React.createElement(\"div\", {\n className: componentClassName.join(' ')\n }, /*#__PURE__*/React.createElement(_FilterBar__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n statuses: props.statuses,\n postTypes: props.postTypes,\n numberOfWeeksToDisplay: numberOfWeeksToDisplay,\n ajaxUrl: props.ajaxUrl,\n nonce: props.nonce,\n onChange: onFilterEventCallback,\n requestFilter: props.requestFilter,\n strings: props.strings\n }), /*#__PURE__*/React.createElement(_NavigationBar__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n refreshOnClickCallback: handleRefreshOnClick,\n backPageOnClickCallback: handleBackPageOnClick,\n backOnClickCallback: handleBackOnClick,\n forwardOnClickCallback: handleForwardOnClick,\n forwardPageOnClickCallback: handleForwardPageOnClick,\n todayOnClickCallback: handleTodayOnClick,\n strings: props.strings\n }), /*#__PURE__*/React.createElement(\"table\", null, /*#__PURE__*/React.createElement(\"thead\", null, /*#__PURE__*/React.createElement(\"tr\", null, /*#__PURE__*/React.createElement(_WeekDays__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n weekStartsOnSunday: props.weekStartsOnSunday,\n strings: props.strings\n }))), /*#__PURE__*/React.createElement(\"tbody\", null, calendarTableBodyRowsWithCells())), formDate && /*#__PURE__*/React.createElement(_ItemFormPopup__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n date: formDate,\n ajaxUrl: props.ajaxUrl,\n dateFormat: props.dateFormat,\n postTypes: props.postTypesCanCreate,\n statuses: props.statuses,\n actionGetPostTypeFields: props.actionGetPostTypeFields,\n nonce: props.nonce,\n onCloseCallback: onCloseForm,\n allowAddingMultipleAuthors: props.allowAddingMultipleAuthors,\n strings: props.strings\n }), /*#__PURE__*/React.createElement(_MessageBar__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n showSpinner: isLoading,\n message: message\n }));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/AsyncCalendar.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/Button.jsx": -/*!***********************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/Button.jsx ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Button; });\nfunction Button(props) {\n var icon;\n\n if (props.icon) {\n icon = /*#__PURE__*/React.createElement(\"span\", {\n className: \"dashicons dashicons-\" + props.icon\n });\n }\n\n var className = 'publishpress-calendar-button ' + (props.className || '');\n return /*#__PURE__*/React.createElement(\"a\", {\n href: props.href || '#',\n className: className,\n onClick: props.onClick\n }, icon, props.label);\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/Button.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/DayCell.jsx": -/*!************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/DayCell.jsx ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return DayCell; });\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Functions */ \"./modules/calendar/lib/async-calendar/js/Functions.jsx\");\n/* harmony import */ var _Item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Item */ \"./modules/calendar/lib/async-calendar/js/Item.jsx\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\nfunction DayCell(props) {\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n uncollapseItems = _React$useState2[0],\n setUncollapseItems = _React$useState2[1];\n\n var itemIndex = 0;\n\n var getDayItemClassName = function getDayItemClassName(dayDate, todayDate) {\n var businessDays = [1, 2, 3, 4, 5];\n var dayItemClassName = businessDays.indexOf(dayDate.getDay()) >= 0 ? 'business-day' : 'weekend-day';\n\n if (todayDate.getFullYear() === dayDate.getFullYear() && todayDate.getMonth() === dayDate.getMonth() && todayDate.getDate() === dayDate.getDate()) {\n dayItemClassName += ' publishpress-calendar-today';\n }\n\n if (props.isLoading) {\n dayItemClassName += ' publishpress-calendar-loading';\n }\n\n if (uncollapseItems) {\n dayItemClassName += ' publishpress-calendar-uncollapse';\n }\n\n if (dayDate.getDate() === 1) {\n dayItemClassName += ' publishpress-calendar-first-day-of-month';\n }\n\n if (props.isHovering) {\n dayItemClassName += ' publishpress-calendar-hovering';\n }\n\n return 'publishpress-calendar-' + dayItemClassName;\n };\n\n var toggleUncollapseItems = function toggleUncollapseItems() {\n setUncollapseItems(!uncollapseItems);\n };\n\n var uncollapseButton = function uncollapseButton() {\n if (props.maxVisibleItems === -1) {\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n }\n\n if (props.items.length > props.maxVisibleItems) {\n var numberOfExtraItems = props.items.length - props.maxVisibleItems;\n var label = uncollapseItems ? 'Hide the ' + numberOfExtraItems + ' last items' : 'Show ' + numberOfExtraItems + ' more';\n var className = uncollapseItems ? 'publishpress-calendar-hide-items' : 'publishpress-calendar-show-more';\n var iconClass = uncollapseItems ? 'hidden' : 'visibility';\n return /*#__PURE__*/React.createElement(\"a\", {\n className: className,\n onClick: toggleUncollapseItems\n }, /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons dashicons-' + iconClass\n }), \" \", label);\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n };\n\n var visibleItems = uncollapseItems || props.maxVisibleItems === -1 ? props.items : props.items.slice(0, props.maxVisibleItems);\n return /*#__PURE__*/React.createElement(\"td\", {\n className: getDayItemClassName(props.date, props.todayDate),\n \"data-year\": props.date.getFullYear(),\n \"data-month\": props.date.getMonth() + 1,\n \"data-day\": props.date.getDate()\n }, /*#__PURE__*/React.createElement(\"div\", null, /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-cell-header\"\n }, props.shouldDisplayMonthName && /*#__PURE__*/React.createElement(\"span\", {\n className: \"publishpress-calendar-month-name\"\n }, Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"getMonthNameByMonthIndex\"])(props.date.getMonth())), /*#__PURE__*/React.createElement(\"span\", {\n className: \"publishpress-calendar-date\"\n }, props.date.getDate()), props.isHovering && /*#__PURE__*/React.createElement(\"span\", {\n className: \"publishpress-calendar-cell-click-to-add\"\n }, props.strings.clickToAdd)), /*#__PURE__*/React.createElement(\"ul\", {\n className: \"publishpress-calendar-day-items\"\n }, visibleItems.map(function (item) {\n var isPopupOpened = item.id === props.openedItemId;\n return /*#__PURE__*/React.createElement(_Item__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n key: 'item-' + item.id + '-' + props.date.getTime(),\n icon: item.icon,\n color: item.color,\n label: item.label,\n id: item.id,\n timestamp: item.timestamp,\n timeFormat: props.timeFormat,\n showTime: item.showTime,\n showIcon: true,\n index: itemIndex++,\n canMove: item.canEdit,\n isPopupOpened: isPopupOpened,\n getPopupItemDataCallback: props.getOpenedItemDataCallback,\n onClickItemCallback: props.onClickItemCallback,\n onItemActionClickCallback: props.onItemActionClickCallback,\n ajaxUrl: props.ajaxUrl,\n strings: props.strings\n });\n })), uncollapseButton()));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/DayCell.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/FilterBar.jsx": -/*!**************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/FilterBar.jsx ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return FilterBar; });\n/* harmony import */ var _Select__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Select */ \"./modules/calendar/lib/async-calendar/js/Select.jsx\");\n/* harmony import */ var _fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fields/TaxonomyField */ \"./modules/calendar/lib/async-calendar/js/fields/TaxonomyField.jsx\");\n\n\nvar _n = wp.i18n._n;\nfunction FilterBar(props) {\n var handleFilterChange = function handleFilterChange(filterName, value) {\n var filterValue = value ? value[0].id : null;\n props.onChange(filterName, filterValue);\n };\n\n var handleStatusChange = function handleStatusChange(e, element, value) {\n handleFilterChange('status', value);\n };\n\n var handleCategoriesChange = function handleCategoriesChange(e, element, value) {\n handleFilterChange('category', value);\n };\n\n var handleTagsChange = function handleTagsChange(e, element, value) {\n handleFilterChange('tag', value);\n };\n\n var handleAuthorsChange = function handleAuthorsChange(e, element, value) {\n handleFilterChange('author', value);\n };\n\n var handlePostTypeChange = function handlePostTypeChange(e, element, value) {\n handleFilterChange('postType', value);\n };\n\n var handleWeeksChange = function handleWeeksChange(e, element, value) {\n handleFilterChange('weeks', value);\n };\n\n var getWeeksFilterLabel = function getWeeksFilterLabel(numberOfWeeks) {\n return _n(props.strings.xWeek, props.strings.xWeeks, numberOfWeeks, 'publishpress').replace('%d', numberOfWeeks);\n };\n\n var weeksFilterPlaceholder = getWeeksFilterLabel(props.numberOfWeeksToDisplay);\n var weeksOptions = [];\n\n for (var i = 1; i <= 12; i++) {\n weeksOptions.push({\n value: i,\n text: getWeeksFilterLabel(i)\n });\n }\n\n var statusValue = props.requestFilter.post_status ? props.requestFilter.post_status : '';\n var typesValue = props.requestFilter.post_type ? props.requestFilter.post_type : '';\n var weeksValue = props.requestFilter.weeks ? props.requestFilter.weeks : '';\n var categoryOptions = [];\n var categoryValue = '';\n\n if (props.requestFilter.category && props.requestFilter.category.value) {\n categoryOptions = [props.requestFilter.category];\n categoryValue = props.requestFilter.category.value;\n }\n\n var postTagOptions = [];\n var postTagValue = '';\n\n if (props.requestFilter.post_tag && props.requestFilter.post_tag.value) {\n postTagOptions = [props.requestFilter.post_tag];\n postTagValue = props.requestFilter.post_tag.value;\n }\n\n var authorOptions = [];\n var authorValue = '';\n\n if (props.requestFilter.post_author && props.requestFilter.post_author.value) {\n authorOptions = [props.requestFilter.post_author];\n authorValue = props.requestFilter.post_author.value;\n }\n\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-filter-bar\"\n }, /*#__PURE__*/React.createElement(_Select__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n placeholder: props.strings.allStatuses,\n options: props.statuses,\n value: statusValue,\n onSelect: handleStatusChange,\n onClear: handleStatusChange\n }), /*#__PURE__*/React.createElement(_fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n placeholder: props.strings.allCategories,\n isEditing: true,\n ajaxUrl: props.ajaxUrl,\n nonce: props.nonce,\n options: categoryOptions,\n value: categoryValue,\n taxonomy: 'category',\n onSelect: handleCategoriesChange,\n onClear: handleCategoriesChange,\n multiple: false,\n className: 'publishpress-calendar-category-filter'\n }), /*#__PURE__*/React.createElement(_fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n placeholder: props.strings.allTags,\n isEditing: true,\n ajaxUrl: props.ajaxUrl,\n nonce: props.nonce,\n options: postTagOptions,\n value: postTagValue,\n taxonomy: 'post_tag',\n onSelect: handleTagsChange,\n onClear: handleTagsChange,\n multiple: false,\n className: 'publishpress-calendar-tag-filter'\n }), /*#__PURE__*/React.createElement(_Select__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n placeholder: props.strings.allAuthors,\n ajaxUrl: props.ajaxUrl,\n nonce: props.nonce,\n options: authorOptions,\n value: authorValue,\n ajaxAction: 'publishpress_calendar_search_authors',\n onSelect: handleAuthorsChange,\n onClear: handleAuthorsChange\n }), /*#__PURE__*/React.createElement(_Select__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n placeholder: props.strings.allTypes,\n options: props.postTypes,\n value: typesValue,\n onSelect: handlePostTypeChange,\n onClear: handlePostTypeChange\n }), /*#__PURE__*/React.createElement(_Select__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n placeholder: weeksFilterPlaceholder,\n options: weeksOptions,\n value: weeksValue,\n onSelect: handleWeeksChange,\n onClear: handleWeeksChange\n }));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/FilterBar.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/Functions.jsx": -/*!**************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/Functions.jsx ***! - \**************************************************************/ -/*! exports provided: getBeginDateOfWeekByWeekNumber, getWeekNumberByDate, getBeginDateOfWeekByDate, getHourStringOnFormat, getDateAsStringInWpFormat, calculateWeeksInMilliseconds, getMonthNameByMonthIndex, getDateWithNoTimezoneOffset, getPostLinksElement, callAjaxAction, callAjaxPostAction, getTodayMidnight, getDateInstanceFromString */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBeginDateOfWeekByWeekNumber\", function() { return getBeginDateOfWeekByWeekNumber; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWeekNumberByDate\", function() { return getWeekNumberByDate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBeginDateOfWeekByDate\", function() { return getBeginDateOfWeekByDate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getHourStringOnFormat\", function() { return getHourStringOnFormat; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDateAsStringInWpFormat\", function() { return getDateAsStringInWpFormat; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"calculateWeeksInMilliseconds\", function() { return calculateWeeksInMilliseconds; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getMonthNameByMonthIndex\", function() { return getMonthNameByMonthIndex; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDateWithNoTimezoneOffset\", function() { return getDateWithNoTimezoneOffset; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getPostLinksElement\", function() { return getPostLinksElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"callAjaxAction\", function() { return callAjaxAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"callAjaxPostAction\", function() { return callAjaxPostAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getTodayMidnight\", function() { return getTodayMidnight; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDateInstanceFromString\", function() { return getDateInstanceFromString; });\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n/**\n * Base on :\n * https://stackoverflow.com/questions/16590500/javascript-calculate-date-from-week-number\n */\nfunction getBeginDateOfWeekByWeekNumber(weekNumber, year) {\n var weekStartsOnSunday = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var simpleDate = new Date(year, 0, 1 + (weekNumber - 1) * 7);\n var dayOfWeek = simpleDate.getDay();\n var weekStartISO = simpleDate;\n\n if (dayOfWeek <= 4) {\n weekStartISO.setDate(simpleDate.getDate() - simpleDate.getDay() + 1);\n } else {\n weekStartISO.setDate(simpleDate.getDate() + 8 - simpleDate.getDay());\n }\n\n if (weekStartsOnSunday) {\n weekStartISO.setDate(weekStartISO.getDate() - 1);\n }\n\n return weekStartISO;\n}\n/* For a given date, get the ISO week number\n *\n * Based on information at:\n *\n * http://www.merlyn.demon.co.uk/weekcalc.htm#WNR\n *\n * Algorithm is to find nearest thursday, it's year\n * is the year of the week number. Then get weeks\n * between that date and the first day of that year.\n *\n * Note that dates in one year can be weeks of previous\n * or next year, overlap is up to 3 days.\n *\n * e.g. 2014/12/29 is Monday in week 1 of 2015\n * 2012/1/1 is Sunday in week 52 of 2011\n */\n\nfunction getWeekNumberByDate(theDate) {\n var weekStartsOnSunday = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n // Copy date so don't modify original\n var theDateCopy = new Date(theDate.getFullYear(), theDate.getMonth(), theDate.getDate(), theDate.getHours(), theDate.getMinutes(), theDate.getSeconds(), theDate.getMilliseconds());\n var dayOfWeek = theDateCopy.getDay(); // Set to nearest Thursday: current date + 4 - current day number\n // Make Sunday's day number 7\n\n theDateCopy.setDate(theDateCopy.getDate() + 4 - (theDateCopy.getDay() || 7)); // Get first day of year\n\n var yearStart = new Date(theDateCopy.getFullYear(), 0, 1); // Calculate full weeks to nearest Thursday\n\n var weekNo = Math.round(((theDateCopy - yearStart) / 86400000 + 1) / 7);\n\n if (weekStartsOnSunday && dayOfWeek === 0) {\n weekNo++;\n } // Return array of year and week number\n\n\n return [theDateCopy.getFullYear(), weekNo];\n}\nfunction getBeginDateOfWeekByDate(theDate) {\n var weekStartsOnSunday = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var weekNumber = getWeekNumberByDate(theDate, weekStartsOnSunday);\n return getBeginDateOfWeekByWeekNumber(weekNumber[1], weekNumber[0], weekStartsOnSunday);\n}\nfunction getHourStringOnFormat(timestamp) {\n var timeFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ga';\n var hours = timestamp.getHours();\n\n if (timeFormat === 'ga' || timeFormat === 'ha') {\n if (hours === 0) {\n hours = '12am';\n } else if (hours < 12) {\n if (timeFormat === 'ha') {\n hours = hours.toString().padStart(2, '0');\n }\n\n hours += 'am';\n } else {\n if (hours > 12) {\n hours -= 12;\n }\n\n if (timeFormat === 'ha') {\n hours = hours.toString().padStart(2, '0');\n }\n\n hours += 'pm';\n }\n } else {\n hours = hours.toString().padStart(2, '0');\n }\n\n return hours;\n}\nfunction getDateAsStringInWpFormat(theDate) {\n return theDate.getFullYear() + '-' + (theDate.getMonth() + 1).toString().padStart(2, '0') + '-' + theDate.getDate().toString().padStart(2, '0');\n}\nfunction calculateWeeksInMilliseconds(weeks) {\n return weeks * 7 * 24 * 60 * 60 * 1000;\n}\nfunction getMonthNameByMonthIndex(month) {\n var strings = publishpressCalendarParams.strings;\n var monthNames = [strings.monthJan, strings.monthFeb, strings.monthMar, strings.monthApr, strings.monthMay, strings.monthJun, strings.monthJul, strings.monthAug, strings.monthSep, strings.monthOct, strings.monthNov, strings.monthDec];\n return monthNames[month];\n}\nfunction getDateWithNoTimezoneOffset(dateString) {\n var date = new Date(dateString);\n var browserTimezoneOffset = date.getTimezoneOffset() * 60000;\n return new Date(date.getTime() + browserTimezoneOffset);\n}\nfunction getPostLinksElement(linkData, handleOnClick) {\n if (linkData.url) {\n return /*#__PURE__*/React.createElement(\"a\", {\n key: \"link-\".concat(linkData.url, \"-\").concat(linkData.label),\n href: linkData.url\n }, linkData.label);\n } else if (linkData.action) {\n return /*#__PURE__*/React.createElement(\"a\", {\n key: \"link-\".concat(linkData.url, \"-\").concat(linkData.label),\n onClick: function onClick(e) {\n return handleOnClick(e, linkData);\n }\n }, linkData.label);\n }\n}\nfunction callAjaxAction(_x, _x2, _x3) {\n return _callAjaxAction.apply(this, arguments);\n}\n\nfunction _callAjaxAction() {\n _callAjaxAction = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(action, args, ajaxUrl) {\n var dataUrl, argumentName, response;\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n dataUrl = ajaxUrl + '?action=' + action;\n _context.t0 = regeneratorRuntime.keys(args);\n\n case 2:\n if ((_context.t1 = _context.t0()).done) {\n _context.next = 9;\n break;\n }\n\n argumentName = _context.t1.value;\n\n if (args.hasOwnProperty(argumentName)) {\n _context.next = 6;\n break;\n }\n\n return _context.abrupt(\"continue\", 2);\n\n case 6:\n dataUrl += '&' + argumentName + '=' + args[argumentName];\n _context.next = 2;\n break;\n\n case 9:\n _context.next = 11;\n return fetch(dataUrl);\n\n case 11:\n response = _context.sent;\n _context.next = 14;\n return response.json();\n\n case 14:\n return _context.abrupt(\"return\", _context.sent);\n\n case 15:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _callAjaxAction.apply(this, arguments);\n}\n\nfunction callAjaxPostAction(_x4, _x5, _x6, _x7) {\n return _callAjaxPostAction.apply(this, arguments);\n}\n\nfunction _callAjaxPostAction() {\n _callAjaxPostAction = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(action, args, ajaxUrl, body) {\n var dataUrl, argumentName, response;\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n dataUrl = ajaxUrl + '?action=' + action;\n _context2.t0 = regeneratorRuntime.keys(args);\n\n case 2:\n if ((_context2.t1 = _context2.t0()).done) {\n _context2.next = 9;\n break;\n }\n\n argumentName = _context2.t1.value;\n\n if (args.hasOwnProperty(argumentName)) {\n _context2.next = 6;\n break;\n }\n\n return _context2.abrupt(\"continue\", 2);\n\n case 6:\n dataUrl += '&' + argumentName + '=' + args[argumentName];\n _context2.next = 2;\n break;\n\n case 9:\n _context2.next = 11;\n return fetch(dataUrl, {\n method: 'post',\n body: body\n });\n\n case 11:\n response = _context2.sent;\n _context2.next = 14;\n return response.json();\n\n case 14:\n return _context2.abrupt(\"return\", _context2.sent);\n\n case 15:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n return _callAjaxPostAction.apply(this, arguments);\n}\n\nfunction getTodayMidnight() {\n var today = new Date();\n today.setHours(0, 0, 0, 0);\n return today;\n}\nfunction getDateInstanceFromString(dateString) {\n // The \"-\" char is replaced to make it compatible to Safari browser. Issue #1001.\n return new Date(String(dateString).replace(/-/g, \"/\"));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/Functions.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/Item.jsx": -/*!*********************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/Item.jsx ***! - \*********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Item; });\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Functions */ \"./modules/calendar/lib/async-calendar/js/Functions.jsx\");\n/* harmony import */ var _ItemPopup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ItemPopup */ \"./modules/calendar/lib/async-calendar/js/ItemPopup.jsx\");\n\n\nvar $ = jQuery;\nfunction Item(props) {\n var DEFAULT_TIME_FORMAT = 'g:i a';\n var DEFAULT_LABEL = props.strings.untitled;\n var calendarItem = React.useRef(null);\n\n var getHourString = function getHourString() {\n var timestampDate = Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"getDateInstanceFromString\"])(props.timestamp);\n return Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"getHourStringOnFormat\"])(timestampDate, props.timeFormat || DEFAULT_TIME_FORMAT);\n };\n\n var getClassName = function getClassName() {\n var className = 'publishpress-calendar-item';\n\n if (props.isPopupOpened) {\n className += ' publishpress-calendar-item-opened-popup';\n }\n\n if (props.canMove) {\n className += ' publishpress-calendar-item-movable';\n }\n\n return className;\n };\n\n var isPopupElementOrChildrenOfPopup = function isPopupElementOrChildrenOfPopup(element) {\n return $(element).hasClass('publishpress-calendar-popup') || $(element).parents('.publishpress-calendar-popup').length > 0;\n };\n\n var dispatchClickEvent = function dispatchClickEvent(e) {\n if (isPopupElementOrChildrenOfPopup(e.target)) {\n return;\n }\n\n props.onClickItemCallback(props.id);\n };\n\n var iconElement = props.showIcon && props.icon ? /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons ' + props.icon\n }, \" \") : null;\n var timeElement = props.showTime ? /*#__PURE__*/React.createElement(\"time\", {\n className: \"publishpress-calendar-item-time\",\n dateTime: props.timestamp,\n title: props.timestamp\n }, getHourString()) : null;\n var label = props.label || DEFAULT_LABEL;\n return /*#__PURE__*/React.createElement(\"li\", {\n ref: calendarItem,\n className: getClassName(),\n style: {\n backgroundColor: props.color\n },\n \"data-index\": props.index,\n \"data-id\": props.id,\n \"data-datetime\": props.timestamp,\n onClick: dispatchClickEvent\n }, iconElement, timeElement, /*#__PURE__*/React.createElement(\"span\", {\n dangerouslySetInnerHTML: {\n __html: label\n }\n }), props.isPopupOpened && /*#__PURE__*/React.createElement(_ItemPopup__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n target: calendarItem,\n id: props.id,\n title: label,\n icon: props.icon,\n timestamp: props.timestamp,\n color: props.color,\n data: props.isPopupOpened ? props.getPopupItemDataCallback() : null,\n onItemActionClickCallback: props.onItemActionClickCallback,\n ajaxUrl: props.ajaxUrl,\n strings: props.strings\n }));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/Item.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx": -/*!******************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx ***! - \******************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return ItemFormPopup; });\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Functions */ \"./modules/calendar/lib/async-calendar/js/Functions.jsx\");\n/* harmony import */ var _Select__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Select */ \"./modules/calendar/lib/async-calendar/js/Select.jsx\");\n/* harmony import */ var _fields_DateTimeField__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fields/DateTimeField */ \"./modules/calendar/lib/async-calendar/js/fields/DateTimeField.jsx\");\n/* harmony import */ var _fields_AuthorsField__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fields/AuthorsField */ \"./modules/calendar/lib/async-calendar/js/fields/AuthorsField.jsx\");\n/* harmony import */ var _fields_SelectField__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fields/SelectField */ \"./modules/calendar/lib/async-calendar/js/fields/SelectField.jsx\");\n/* harmony import */ var _fields_PostStatusField__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./fields/PostStatusField */ \"./modules/calendar/lib/async-calendar/js/fields/PostStatusField.jsx\");\n/* harmony import */ var _fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./fields/TaxonomyField */ \"./modules/calendar/lib/async-calendar/js/fields/TaxonomyField.jsx\");\n/* harmony import */ var _fields_CheckboxField__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fields/CheckboxField */ \"./modules/calendar/lib/async-calendar/js/fields/CheckboxField.jsx\");\n/* harmony import */ var _fields_LocationField__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./fields/LocationField */ \"./modules/calendar/lib/async-calendar/js/fields/LocationField.jsx\");\n/* harmony import */ var _fields_TextArea__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./fields/TextArea */ \"./modules/calendar/lib/async-calendar/js/fields/TextArea.jsx\");\n/* harmony import */ var _fields_TextField__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./fields/TextField */ \"./modules/calendar/lib/async-calendar/js/fields/TextField.jsx\");\n/* harmony import */ var _fields_UserField__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./fields/UserField */ \"./modules/calendar/lib/async-calendar/js/fields/UserField.jsx\");\n/* harmony import */ var _fields_NumberField__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./fields/NumberField */ \"./modules/calendar/lib/async-calendar/js/fields/NumberField.jsx\");\n/* harmony import */ var _fields_TimeField__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./fields/TimeField */ \"./modules/calendar/lib/async-calendar/js/fields/TimeField.jsx\");\n/* harmony import */ var _fields_MetaField__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./fields/MetaField */ \"./modules/calendar/lib/async-calendar/js/fields/MetaField.jsx\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar $ = jQuery;\nfunction ItemFormPopup(props) {\n var _React$useState = React.useState(props.postTypes[0].value),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n postType = _React$useState2[0],\n setPostType = _React$useState2[1];\n\n var _React$useState3 = React.useState([]),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n fields = _React$useState4[0],\n setFields = _React$useState4[1];\n\n var _React$useState5 = React.useState(false),\n _React$useState6 = _slicedToArray(_React$useState5, 2),\n isLoading = _React$useState6[0],\n setIsLoading = _React$useState6[1];\n\n var _React$useState7 = React.useState(false),\n _React$useState8 = _slicedToArray(_React$useState7, 2),\n savingLink = _React$useState8[0],\n setSavingLink = _React$useState8[1];\n\n var _React$useState9 = React.useState(),\n _React$useState10 = _slicedToArray(_React$useState9, 2),\n errorMessage = _React$useState10[0],\n setErrorMessage = _React$useState10[1];\n\n var didMount = function didMount() {\n resetGlobalFormFieldData();\n setPostType(props.postTypes[0].value);\n setDefaultValueForFields();\n activateFixForScreenLockerSize();\n return didUnmount;\n };\n\n var didUnmount = function didUnmount() {\n deactivateFixForScreenLockerSize();\n resetGlobalFormFieldData();\n };\n\n var activateFixForScreenLockerSize = function activateFixForScreenLockerSize() {\n $('#wpwrap').css('overflow', 'hidden');\n };\n\n var deactivateFixForScreenLockerSize = function deactivateFixForScreenLockerSize() {\n $('#wpwrap').css('overflow', 'auto');\n };\n\n var setDefaultValueForFields = function setDefaultValueForFields() {\n updateGlobalFormFieldData('post_type', props.postTypes[0].value);\n updateGlobalFormFieldData('status', 'draft');\n };\n\n var getFormTableFieldRows = function getFormTableFieldRows() {\n var fieldRows = [];\n var dataProperty;\n var field;\n var fieldId;\n var placeholder;\n\n var _loop = function _loop(dataPropertyName) {\n if (!fields.hasOwnProperty(dataPropertyName)) {\n return \"continue\";\n }\n\n fieldId = 'publishpress-calendar-field-' + dataPropertyName;\n dataProperty = fields[dataPropertyName];\n placeholder = dataProperty.placeholder ? dataProperty.placeholder : null;\n\n switch (dataProperty.type) {\n case 'date':\n field = /*#__PURE__*/React.createElement(_fields_DateTimeField__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n value: dataProperty.value,\n isEditing: true,\n id: fieldId,\n onChange: function onChange(e, value) {\n updateGlobalFormFieldData(dataPropertyName, value);\n }\n });\n break;\n\n case 'authors':\n field = /*#__PURE__*/React.createElement(_fields_AuthorsField__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n value: dataProperty.value,\n isEditing: true,\n name: dataPropertyName,\n id: fieldId,\n nonce: props.nonce,\n ajaxUrl: props.ajaxUrl,\n ajaxArgs: dataProperty.ajaxArgs,\n metadata: dataProperty.metadata ? true : false,\n post_types: dataProperty.post_types ? dataProperty.post_types : '',\n multiple: dataProperty.metadata ? dataProperty.multiple : props.allowAddingMultipleAuthors,\n onSelect: function onSelect(e, elem, data) {\n var values = [];\n\n for (var i = 0; i < data.length; i++) {\n values.push(data[i].id);\n }\n\n updateGlobalFormFieldData(dataPropertyName, values);\n },\n onClear: function onClear(e, elem) {\n updateGlobalFormFieldData(dataPropertyName, null);\n }\n });\n break;\n\n case 'select':\n field = /*#__PURE__*/React.createElement(_fields_SelectField__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n value: dataProperty.value,\n isEditing: true,\n name: dataPropertyName,\n id: fieldId,\n nonce: props.nonce,\n ajaxUrl: props.ajaxUrl,\n ajaxAction: dataProperty.ajaxAction,\n ajaxArgs: dataProperty.ajaxArgs,\n multiple: dataProperty.multiple,\n onSelect: function onSelect(e, elem, data) {\n var values = [];\n\n for (var i = 0; i < data.length; i++) {\n values.push(data[i].id);\n }\n\n updateGlobalFormFieldData(dataPropertyName, values);\n },\n onClear: function onClear(e, elem) {\n updateGlobalFormFieldData(dataPropertyName, null);\n }\n });\n break;\n\n case 'status':\n field = /*#__PURE__*/React.createElement(_fields_PostStatusField__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n value: dataProperty.value,\n isEditing: true,\n id: fieldId,\n options: dataProperty.options,\n onSelect: function onSelect(e, elem, data) {\n var value = null;\n\n if (data.length > 0) {\n value = data[0].id;\n }\n\n updateGlobalFormFieldData(dataPropertyName, value);\n },\n onClear: function onClear(e, elem) {\n updateGlobalFormFieldData(dataPropertyName, null);\n }\n });\n break;\n\n case 'taxonomy':\n field = /*#__PURE__*/React.createElement(_fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n value: dataProperty.value,\n isEditing: true,\n id: fieldId,\n taxonomy: dataProperty.taxonomy,\n nonce: props.nonce,\n ajaxUrl: props.ajaxUrl,\n multiple: true,\n onSelect: function onSelect(e, elem, data) {\n var values = [];\n\n for (var i = 0; i < data.length; i++) {\n values.push(data[i].id);\n }\n\n updateGlobalFormFieldData(dataPropertyName, values);\n },\n onClear: function onClear(e, elem) {\n updateGlobalFormFieldData(dataPropertyName, null);\n }\n });\n break;\n\n case 'checkbox':\n field = /*#__PURE__*/React.createElement(_fields_CheckboxField__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n isEditing: true,\n id: fieldId,\n value: dataProperty.value\n });\n break;\n\n case 'location':\n field = /*#__PURE__*/React.createElement(_fields_LocationField__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n value: dataProperty.value,\n isEditing: true,\n id: fieldId,\n onChange: function onChange(e, value) {\n updateGlobalFormFieldData(dataPropertyName, value);\n }\n });\n break;\n\n case 'html':\n field = /*#__PURE__*/React.createElement(_fields_TextArea__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n value: dataProperty.value,\n name: dataPropertyName,\n metadata: dataProperty.metadata ? true : false,\n post_types: dataProperty.post_types ? dataProperty.post_types : '',\n isEditing: true,\n id: fieldId,\n onChange: function onChange(e, value) {\n updateGlobalFormFieldData(dataPropertyName, value);\n }\n });\n break;\n\n case 'text':\n field = /*#__PURE__*/React.createElement(_fields_TextField__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: dataProperty.value,\n isEditing: true,\n id: fieldId,\n placeholder: placeholder,\n onChange: function onChange(e, value) {\n updateGlobalFormFieldData(dataPropertyName, value);\n }\n });\n break;\n\n case 'user':\n field = /*#__PURE__*/React.createElement(_fields_UserField__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n value: dataProperty.value,\n isEditing: true,\n id: fieldId\n });\n break;\n\n case 'number':\n field = /*#__PURE__*/React.createElement(_fields_NumberField__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n value: dataProperty.value,\n isEditing: true,\n id: fieldId,\n onChange: function onChange(e, value) {\n updateGlobalFormFieldData(dataPropertyName, value);\n }\n });\n break;\n\n case 'time':\n field = /*#__PURE__*/React.createElement(_fields_TimeField__WEBPACK_IMPORTED_MODULE_13__[\"default\"], {\n value: dataProperty.value,\n isEditing: true,\n id: fieldId,\n placeholder: placeholder,\n onChange: function onChange(e, value) {\n updateGlobalFormFieldData(dataPropertyName, value);\n }\n });\n break;\n\n case 'metafield':\n dataProperty.isEditing = true;\n field = Object(_fields_MetaField__WEBPACK_IMPORTED_MODULE_14__[\"default\"])(dataProperty);\n break;\n\n default:\n field = null;\n break;\n }\n\n fieldRows.push( /*#__PURE__*/React.createElement(\"tr\", {\n key: \"field-rows-\".concat(fieldRows.length)\n }, /*#__PURE__*/React.createElement(\"th\", null, /*#__PURE__*/React.createElement(\"label\", {\n htmlFor: fieldId\n }, dataProperty.label, \":\")), /*#__PURE__*/React.createElement(\"td\", null, field)));\n };\n\n for (var dataPropertyName in fields) {\n var _ret = _loop(dataPropertyName);\n\n if (_ret === \"continue\") continue;\n }\n\n return fieldRows;\n }; // We are using a global var because the states are async and we were having a hard time to make all\n // fields work together updating the same state.\n\n\n var getGlobalFormFieldData = function getGlobalFormFieldData(name) {\n if (typeof window.publishpressCalendarGlobalData === 'undefined') {\n window.publishpressCalendarGlobalData = {};\n }\n\n if (typeof window.publishpressCalendarGlobalData.formFieldsData === 'undefined') {\n window.publishpressCalendarGlobalData.formFieldsData = {};\n }\n\n if (window.publishpressCalendarGlobalData.formFieldsData.hasOwnProperty(name)) {\n return window.publishpressCalendarGlobalData.formFieldsData[name];\n }\n\n return null;\n };\n\n var setGlobalFormFieldData = function setGlobalFormFieldData(name, value) {\n getGlobalFormFieldData(name);\n window.publishpressCalendarGlobalData.formFieldsData[name] = value;\n };\n\n var resetGlobalFormFieldData = function resetGlobalFormFieldData() {\n if (typeof window.publishpressCalendarGlobalData !== 'undefined' && typeof window.publishpressCalendarGlobalData.formFieldsData !== 'undefined') {\n window.publishpressCalendarGlobalData.formFieldsData = [];\n }\n };\n\n var updateGlobalFormFieldData = function updateGlobalFormFieldData(fieldName, value) {\n setGlobalFormFieldData(fieldName, value);\n };\n\n var getFormDataForThePostRequest = function getFormDataForThePostRequest() {\n var formData = new FormData();\n formData.append('date', Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"getDateAsStringInWpFormat\"])(props.date));\n formData.append('nonce', props.nonce);\n\n for (var fieldName in window.publishpressCalendarGlobalData.formFieldsData) {\n if (window.publishpressCalendarGlobalData.formFieldsData.hasOwnProperty(fieldName)) {\n formData.append(fieldName, window.publishpressCalendarGlobalData.formFieldsData[fieldName]);\n }\n } //add metafield\n\n\n var field_name = '',\n field_value = '',\n field_type = '',\n skip_field = false;\n document.querySelectorAll('.pp-calendar-form-metafied-input').forEach(function (metafield) {\n field_name = metafield.getAttribute('name');\n field_type = metafield.getAttribute('type');\n field_value = metafield.value;\n skip_field = false;\n\n if (field_type === 'checkbox' && !metafield.checked) {\n skip_field = true;\n }\n\n if (metafield.classList.contains('pp_editorial_meta_multi_select2')) {\n skip_field = true;\n var selected_options = metafield.selectedOptions;\n var selected_key = '';\n\n for (selected_key in selected_options) {\n if (!selected_options.hasOwnProperty(selected_key)) {\n continue;\n }\n\n formData.append(field_name, selected_options[selected_key].value);\n }\n }\n\n if (!skip_field) {\n formData.append(field_name, field_value);\n }\n });\n return formData;\n };\n\n var handleLinkOnClick = function handleLinkOnClick(e, linkData) {\n e.preventDefault();\n setIsLoading(true);\n setSavingLink(linkData.id);\n setErrorMessage(null);\n Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"callAjaxPostAction\"])(linkData.action, linkData.args, props.ajaxUrl, getFormDataForThePostRequest()).then(function (result) {\n if (linkData.id === 'create') {\n setIsLoading(false);\n setSavingLink(null);\n\n if (result.status === 'success') {\n if (props.onCloseCallback) {\n props.onCloseCallback();\n }\n } else {\n setErrorMessage(result.message);\n }\n } else if (linkData.id === 'edit') {\n if (result.status === 'success') {\n window.location.href = result.data.link;\n } else {\n setIsLoading(false);\n setSavingLink(null);\n setErrorMessage(result.message);\n }\n }\n });\n };\n\n var getFooterLinks = function getFooterLinks() {\n var formLinks = [{\n 'id': 'create',\n 'label': props.strings.save,\n 'labelLoading': props.strings.saving,\n 'action': 'publishpress_calendar_create_item'\n }, {\n 'id': 'edit',\n 'label': props.strings.saveAndEdit,\n 'labelLoading': props.strings.saving,\n 'action': 'publishpress_calendar_create_item'\n }];\n var links = [];\n var linkData;\n\n for (var linkName in formLinks) {\n if (!formLinks.hasOwnProperty(linkName)) {\n continue;\n }\n\n linkData = formLinks[linkName];\n\n if (savingLink === linkData.id) {\n links.push( /*#__PURE__*/React.createElement(\"span\", {\n key: linkData.id\n }, linkData.labelLoading));\n } else {\n links.push(Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"getPostLinksElement\"])(linkData, handleLinkOnClick));\n }\n\n links.push( /*#__PURE__*/React.createElement(\"span\", {\n key: \"link-separator-\".concat(links.length)\n }, \"|\"));\n }\n\n links.pop();\n return links;\n };\n\n var handleOnSelectPostTypeField = function handleOnSelectPostTypeField(e) {\n var $target = $(e.target);\n var postType = $target.pp_select2('data')[0].id;\n setPostType(postType);\n updateGlobalFormFieldData('post_type', postType);\n };\n\n var getFormPopupTitle = function getFormPopupTitle() {\n var title;\n\n if (props.postId) {\n title = '';\n } else {\n title = props.strings.addContentFor;\n title = title.replace('%s', date_i18n(props.dateFormat, props.date));\n }\n\n return title;\n };\n\n var getPostTypeNameBySlug = function getPostTypeNameBySlug(postTypeSlug) {\n var _iterator = _createForOfIteratorHelper(props.postTypes),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var postTypeObj = _step.value;\n\n if (postTypeObj.value === postTypeSlug) {\n return postTypeObj.text;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n return props.strings.postTypeNotFound;\n };\n\n var fetchFieldsForSelectedPostType = function fetchFieldsForSelectedPostType() {\n setIsLoading(true);\n var args = {\n nonce: props.nonce,\n postType: getGlobalFormFieldData('post_type'),\n date: Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"getDateAsStringInWpFormat\"])(props.date)\n };\n setFields(null);\n Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"callAjaxAction\"])(props.actionGetPostTypeFields, args, props.ajaxUrl).then(function (result) {\n setFields(result.fields);\n }).then(function () {\n setFocusOnTitleField();\n setIsLoading(false);\n });\n };\n\n var setFocusOnTitleField = function setFocusOnTitleField() {\n setTimeout(function () {\n $('.publishpress-calendar-popup-form input').first().focus();\n }, 500);\n };\n\n React.useEffect(didMount, []);\n React.useEffect(fetchFieldsForSelectedPostType, [postType]);\n var fieldTableRows = getFormTableFieldRows();\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"div\", {\n className: 'publishpress-calendar-popup-screen-lock'\n }), /*#__PURE__*/React.createElement(\"div\", {\n className: 'publishpress-calendar-popup publishpress-calendar-popup-form'\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: 'publishpress-calendar-popup-title'\n }, getFormPopupTitle(), /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons dashicons-no publishpress-calendar-popup-close',\n title: props.strings.close,\n onClick: props.onCloseCallback\n })), /*#__PURE__*/React.createElement(\"hr\", null), /*#__PURE__*/React.createElement(\"table\", null, /*#__PURE__*/React.createElement(\"tbody\", null, props.postTypes.length > 1 && /*#__PURE__*/React.createElement(\"tr\", null, /*#__PURE__*/React.createElement(\"th\", null, /*#__PURE__*/React.createElement(\"label\", null, props.strings.postType)), /*#__PURE__*/React.createElement(\"td\", null, /*#__PURE__*/React.createElement(_Select__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n options: props.postTypes,\n allowClear: false,\n onSelect: handleOnSelectPostTypeField\n }))), props.postTypes.length === 1 && /*#__PURE__*/React.createElement(\"tr\", null, /*#__PURE__*/React.createElement(\"th\", null, /*#__PURE__*/React.createElement(\"label\", null, props.strings.postType)), /*#__PURE__*/React.createElement(\"td\", null, getPostTypeNameBySlug(postType))), fieldTableRows.length > 0 && fieldTableRows)), fieldTableRows.length === 0 && /*#__PURE__*/React.createElement(\"div\", {\n className: 'publishpress-calendar-popup-loading-fields'\n }, props.strings.pleaseWaitLoadingFormFields), errorMessage && /*#__PURE__*/React.createElement(\"div\", {\n className: 'publishpress-calendar-popup-error-message'\n }, /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons dashicons-warning'\n }), errorMessage), /*#__PURE__*/React.createElement(\"hr\", {\n className: 'publishpress-calendar-popup-links-hr'\n }), /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-popup-links\"\n }, getFooterLinks(), isLoading && /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons dashicons-update-alt publishpress-spinner'\n }))));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/ItemPopup.jsx": -/*!**************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/ItemPopup.jsx ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return ItemPopup; });\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Functions */ \"./modules/calendar/lib/async-calendar/js/Functions.jsx\");\n/* harmony import */ var _fields_DateTimeField__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fields/DateTimeField */ \"./modules/calendar/lib/async-calendar/js/fields/DateTimeField.jsx\");\n/* harmony import */ var _fields_AuthorsField__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fields/AuthorsField */ \"./modules/calendar/lib/async-calendar/js/fields/AuthorsField.jsx\");\n/* harmony import */ var _fields_PostTypeField__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fields/PostTypeField */ \"./modules/calendar/lib/async-calendar/js/fields/PostTypeField.jsx\");\n/* harmony import */ var _fields_SelectField__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fields/SelectField */ \"./modules/calendar/lib/async-calendar/js/fields/SelectField.jsx\");\n/* harmony import */ var _fields_PostStatusField__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./fields/PostStatusField */ \"./modules/calendar/lib/async-calendar/js/fields/PostStatusField.jsx\");\n/* harmony import */ var _fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./fields/TaxonomyField */ \"./modules/calendar/lib/async-calendar/js/fields/TaxonomyField.jsx\");\n/* harmony import */ var _fields_CheckboxField__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fields/CheckboxField */ \"./modules/calendar/lib/async-calendar/js/fields/CheckboxField.jsx\");\n/* harmony import */ var _fields_LocationField__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./fields/LocationField */ \"./modules/calendar/lib/async-calendar/js/fields/LocationField.jsx\");\n/* harmony import */ var _fields_TextArea__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./fields/TextArea */ \"./modules/calendar/lib/async-calendar/js/fields/TextArea.jsx\");\n/* harmony import */ var _fields_TextField__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./fields/TextField */ \"./modules/calendar/lib/async-calendar/js/fields/TextField.jsx\");\n/* harmony import */ var _fields_UserField__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./fields/UserField */ \"./modules/calendar/lib/async-calendar/js/fields/UserField.jsx\");\n/* harmony import */ var _fields_NumberField__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./fields/NumberField */ \"./modules/calendar/lib/async-calendar/js/fields/NumberField.jsx\");\n/* harmony import */ var _fields_TimeField__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./fields/TimeField */ \"./modules/calendar/lib/async-calendar/js/fields/TimeField.jsx\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar $ = jQuery;\nfunction ItemPopup(props) {\n if (!props.data) {\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n }\n\n if (!props.target.current) {\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n }\n\n var offsetX = 10;\n var offsetWidth = 180;\n var targetPosition = $(props.target.current).position();\n var targetOffset = $(props.target.current).offset();\n var targetWidth = $(props.target.current).width();\n var popupWidth = 380;\n\n var isWiderThanParentWidth = function isWiderThanParentWidth() {\n return targetOffset.left + popupWidth + offsetX + offsetWidth >= $(document).width();\n };\n\n var getPositionOnRightSide = function getPositionOnRightSide() {\n return targetPosition.left + targetWidth + offsetX;\n };\n\n var getPositionOnLeftSide = function getPositionOnLeftSide() {\n return targetPosition.left - offsetX * 2.5 - popupWidth;\n };\n\n var closePopup = function closePopup() {\n $(document).trigger('publishpress_calendar:close_popup');\n };\n\n var positionTop = targetPosition.top;\n var positionLeft = isWiderThanParentWidth() ? getPositionOnLeftSide() : getPositionOnRightSide();\n\n var getFieldRows = function getFieldRows() {\n var fieldRows = [];\n var dataProperty;\n var field;\n\n for (var dataPropertyName in props.data.fields) {\n if (!props.data.fields.hasOwnProperty(dataPropertyName)) {\n continue;\n }\n\n dataProperty = props.data.fields[dataPropertyName];\n\n switch (dataProperty.type) {\n case 'date':\n field = /*#__PURE__*/React.createElement(_fields_DateTimeField__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n value: dataProperty.value,\n valueString: dataProperty.valueString || null,\n isEditing: false\n });\n break;\n\n case 'time':\n field = /*#__PURE__*/React.createElement(_fields_TimeField__WEBPACK_IMPORTED_MODULE_13__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'authors':\n field = /*#__PURE__*/React.createElement(_fields_AuthorsField__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'select':\n field = /*#__PURE__*/React.createElement(_fields_SelectField__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'type':\n field = /*#__PURE__*/React.createElement(_fields_PostTypeField__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'status':\n field = /*#__PURE__*/React.createElement(_fields_PostStatusField__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'taxonomy':\n field = /*#__PURE__*/React.createElement(_fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'checkbox':\n field = /*#__PURE__*/React.createElement(_fields_CheckboxField__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'location':\n field = /*#__PURE__*/React.createElement(_fields_LocationField__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'paragraph':\n field = /*#__PURE__*/React.createElement(_fields_TextArea__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'text':\n field = /*#__PURE__*/React.createElement(_fields_TextField__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'user':\n field = /*#__PURE__*/React.createElement(_fields_UserField__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'number':\n field = /*#__PURE__*/React.createElement(_fields_NumberField__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n default:\n field = null;\n break;\n }\n\n fieldRows.push( /*#__PURE__*/React.createElement(\"tr\", {\n key: \"field-rows-popup-\".concat(fieldRows.length)\n }, /*#__PURE__*/React.createElement(\"th\", null, dataProperty.label, \":\"), /*#__PURE__*/React.createElement(\"td\", null, field)));\n }\n\n return fieldRows;\n };\n\n var handleOnClick = function handleOnClick(e, linkData) {\n e.preventDefault();\n Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"callAjaxAction\"])(linkData.action, linkData.args, props.ajaxUrl).then(function (result) {\n props.onItemActionClickCallback(linkData.action, props.id, result);\n });\n };\n\n var getPostLinks = function getPostLinks() {\n var links = [];\n var linkData;\n\n for (var linkName in props.data.links) {\n if (!props.data.links.hasOwnProperty(linkName)) {\n continue;\n }\n\n linkData = props.data.links[linkName];\n\n if (linkData.url) {\n links.push( /*#__PURE__*/React.createElement(\"a\", {\n key: \"links-popup-\".concat(links.length),\n href: linkData.url\n }, linkData.label));\n } else if (linkData.action) {\n links.push( /*#__PURE__*/React.createElement(\"a\", {\n key: \"links-popup-\".concat(links.length),\n onClick: function onClick(e) {\n return handleOnClick(e, linkData);\n }\n }, linkData.label));\n }\n\n links.push( /*#__PURE__*/React.createElement(\"span\", {\n key: \"links-popup-\".concat(links.length)\n }, \"|\"));\n }\n\n links.pop();\n return links;\n };\n\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-popup\",\n style: {\n top: positionTop,\n left: positionLeft\n }\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-popup-title\",\n style: {\n backgroundColor: props.color\n }\n }, props.icon && /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons ' + props.icon + ' publishpress-calendar-icon'\n }), /*#__PURE__*/React.createElement(\"span\", {\n dangerouslySetInnerHTML: {\n __html: props.title\n }\n }), /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons dashicons-no publishpress-calendar-popup-close',\n title: props.strings.close,\n onClick: closePopup\n })), /*#__PURE__*/React.createElement(\"table\", null, /*#__PURE__*/React.createElement(\"tbody\", null, getFieldRows())), /*#__PURE__*/React.createElement(\"hr\", null), /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-popup-links\"\n }, getPostLinks()));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/ItemPopup.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/MessageBar.jsx": -/*!***************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/MessageBar.jsx ***! - \***************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return MessageBar; });\nfunction MessageBar(props) {\n var showSpinner = props.showSpinner || false;\n var message = props.message || '';\n return /*#__PURE__*/React.createElement(\"div\", {\n className: 'publishpress-calendar-message-bar'\n }, showSpinner && /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons dashicons-update-alt publishpress-spinner'\n }), /*#__PURE__*/React.createElement(\"span\", null, message));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/MessageBar.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/NavigationBar.jsx": -/*!******************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/NavigationBar.jsx ***! - \******************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return NavigationBar; });\n/* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Button */ \"./modules/calendar/lib/async-calendar/js/Button.jsx\");\n\nfunction NavigationBar(props) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-navigation-bar\"\n }, /*#__PURE__*/React.createElement(_Button__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n icon: 'update-alt',\n onClick: props.refreshOnClickCallback\n }), /*#__PURE__*/React.createElement(_Button__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n label: '«',\n onClick: props.backPageOnClickCallback\n }), /*#__PURE__*/React.createElement(_Button__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n label: '‹',\n onClick: props.backOnClickCallback\n }), /*#__PURE__*/React.createElement(_Button__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n label: props.strings.today,\n onClick: props.todayOnClickCallback\n }), /*#__PURE__*/React.createElement(_Button__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n label: '›',\n onClick: props.forwardOnClickCallback\n }), /*#__PURE__*/React.createElement(_Button__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n label: '»',\n onClick: props.forwardPageOnClickCallback\n }));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/NavigationBar.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/Select.jsx": -/*!***********************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/Select.jsx ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Select; });\nvar $ = jQuery;\nfunction Select(props) {\n var selectRef = React.useRef(null);\n\n var getAllowClearProp = function getAllowClearProp() {\n if (typeof props.allowClear !== 'undefined' && props.allowClear !== null) {\n return props.allowClear;\n }\n\n return true;\n };\n\n var initSelect2 = function initSelect2() {\n var params = {\n placeholder: props.placeholder || false,\n tags: true,\n allowClear: getAllowClearProp()\n };\n\n if (props.ajaxUrl && props.ajaxAction) {\n params.ajax = {\n delay: 250,\n url: props.ajaxUrl,\n dataType: 'json',\n data: function data(params) {\n var args = {\n q: params.term,\n action: props.ajaxAction,\n nonce: props.nonce\n };\n\n if (props.ajaxArgs) {\n for (var arg in props.ajaxArgs) {\n if (props.ajaxArgs.hasOwnProperty(arg)) {\n args[arg] = props.ajaxArgs[arg];\n }\n }\n }\n\n return args;\n },\n processResults: function processResults(data) {\n return {\n results: data\n };\n }\n };\n }\n\n $(selectRef.current).pp_select2(params).on('select2:select', function (e) {\n if (typeof props.onSelect === 'function') {\n props.onSelect(e, selectRef.current, $(selectRef.current).pp_select2('data'));\n }\n }).on('select2:clear', function (e) {\n if (typeof props.onClear === 'function') {\n props.onClear(e, selectRef.current);\n }\n });\n return function () {\n $(selectRef.current).pp_select2('destroy');\n };\n };\n\n var blankOption = function blankOption() {\n if (props.placeholder) {\n return /*#__PURE__*/React.createElement(\"option\", {\n value: \"\"\n }, props.placeholder);\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n };\n\n React.useEffect(initSelect2, []);\n var options;\n\n if (props.options) {\n options = props.options.map(function (option) {\n return /*#__PURE__*/React.createElement(\"option\", {\n key: \"select-option-\".concat(option.value),\n value: option.value\n }, option.text);\n });\n }\n\n var className = 'pp_select2';\n\n if (props.className) {\n className += ' ' + props.className;\n }\n\n className += props.metadata ? 'pp-calendar-form-metafied ' + props.post_types : '';\n return /*#__PURE__*/React.createElement(\"select\", {\n className: className,\n defaultValue: props.value,\n type: \"select\",\n name: props.name,\n id: props.id,\n multiple: props.multiple,\n ref: selectRef\n }, blankOption(), options);\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/Select.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/WeekDays.jsx": -/*!*************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/WeekDays.jsx ***! - \*************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return WeekDays; });\nfunction WeekDays(props) {\n var DAYS_ON_A_WEEK = 7;\n var weekDayLabels = [props.strings.weekDaySun, props.strings.weekDayMon, props.strings.weekDayTue, props.strings.weekDayWed, props.strings.weekDayThu, props.strings.weekDayFri, props.strings.weekDaySat];\n var weekDays = [];\n var currentNumberOfDayOfWeek = (props.weekStartsOnSunday ? 0 : 1) - 1;\n\n for (var i = 0; i < DAYS_ON_A_WEEK; i++) {\n currentNumberOfDayOfWeek++;\n\n if (i === 6 && !props.weekStartsOnSunday) {\n currentNumberOfDayOfWeek = 0;\n }\n\n weekDays.push({\n key: currentNumberOfDayOfWeek.toString(),\n label: weekDayLabels[currentNumberOfDayOfWeek]\n });\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, weekDays.map(function (item) {\n return /*#__PURE__*/React.createElement(\"th\", {\n key: item.key.toString()\n }, item.label);\n }));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/WeekDays.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/AuthorsField.jsx": -/*!************************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/AuthorsField.jsx ***! - \************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return AuthorsField; });\n/* harmony import */ var _Select__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Select */ \"./modules/calendar/lib/async-calendar/js/Select.jsx\");\n\nfunction AuthorsField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(_Select__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n ajaxUrl: props.ajaxUrl,\n nonce: props.nonce,\n multiple: props.multiple,\n ajaxAction: 'publishpress_calendar_search_authors',\n ajaxArgs: props.ajaxArgs,\n value: props.value,\n metadata: props.metadata,\n post_types: props.post_types,\n className: props.metadata ? 'pp-calendar-form-metafied-input' : '',\n name: props.name,\n id: props.id,\n onSelect: props.onSelect,\n onClear: props.onClear\n });\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id\n }, props.value.join(', '));\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/AuthorsField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/CheckboxField.jsx": -/*!*************************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/CheckboxField.jsx ***! - \*************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return CheckboxField; });\nfunction CheckboxField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(\"input\", {\n type: \"checkbox\",\n id: props.id,\n value: \"1\",\n checked: props.value === 'Yes'\n });\n };\n\n var viewField = function viewField() {\n var icon;\n\n if (props.value === 'Yes') {\n icon = /*#__PURE__*/React.createElement(\"span\", {\n id: props.id,\n className: \"dashicons dashicons-yes-alt\"\n });\n } else {\n icon = /*#__PURE__*/React.createElement(\"span\", {\n id: props.id,\n className: \"dashicons dashicons-no-alt\"\n });\n }\n\n return icon;\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/CheckboxField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/DateTimeField.jsx": -/*!*************************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/DateTimeField.jsx ***! - \*************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return DateTimeField; });\nfunction DateTimeField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(\"input\", {\n type: \"text\",\n id: props.id,\n value: props.value,\n onChange: function onChange(e) {\n if (props.onChange) {\n props.onChange(e, e.target.value);\n }\n }\n });\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"time\", {\n dateTime: props.value,\n title: props.value,\n id: props.id\n }, props.valueString || props.value);\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/DateTimeField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/LocationField.jsx": -/*!*************************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/LocationField.jsx ***! - \*************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return LocationField; });\nfunction LocationField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(\"input\", {\n type: \"location\",\n id: props.id,\n value: props.value,\n onChange: function onChange(e) {\n if (props.onChange) {\n props.onChange(e, e.target.value);\n }\n }\n });\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id\n }, props.value);\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/LocationField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/MetaField.jsx": -/*!*********************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/MetaField.jsx ***! - \*********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return MetaField; });\n/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dompurify */ \"./node_modules/dompurify/dist/purify.js\");\n/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_0__);\n\nvar $ = jQuery;\nfunction MetaField(props) {\n var editField = function editField() {\n if ($('.pp_editorial_single_select2').length > 0) {\n $('.pp_editorial_single_select2').pp_select2({\n allowClear: true,\n placeholder: function placeholder() {\n $(this).data('placeholder');\n }\n });\n }\n\n if ($('.pp_editorial_meta_multi_select2').length > 0) {\n $('.pp_editorial_meta_multi_select2').pp_select2({\n multiple: true\n });\n }\n\n $('.date-time-pick').each(function () {\n var self = $(this);\n var options = getOptions(self, {\n alwaysSetTime: false,\n controlType: 'select',\n altFieldTimeOnly: false\n });\n self.datetimepicker(options);\n });\n\n function getOptions(self, custom_options) {\n var default_options = {};\n var options = $.extend({}, default_options, custom_options);\n var altFieldName = self.attr('data-alt-field');\n\n if (!altFieldName || typeof altFieldName == 'undefined' || altFieldName.length == 0) {\n return options;\n }\n\n return $.extend({}, options, {\n altField: 'input[name=\"' + altFieldName + '\"]',\n altFormat: self.attr('data-alt-format')\n });\n }\n\n return /*#__PURE__*/React.createElement(\"div\", {\n dangerouslySetInnerHTML: {\n __html: dompurify__WEBPACK_IMPORTED_MODULE_0___default.a.sanitize(props.html)\n }\n });\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id\n }, props.value);\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/MetaField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/NumberField.jsx": -/*!***********************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/NumberField.jsx ***! - \***********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return NumberField; });\nfunction NumberField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(\"input\", {\n type: \"number\",\n value: props.value,\n id: props.id,\n onChange: function onChange(e) {\n if (props.onChange) {\n props.onChange(e, e.target.value);\n }\n }\n });\n };\n\n var viewField = function viewField() {\n var className = props.value === 0 ? 'publishpress-calendar-empty-value' : '';\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id,\n className: className\n }, props.value);\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/NumberField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/PostStatusField.jsx": -/*!***************************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/PostStatusField.jsx ***! - \***************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return PostStatusField; });\n/* harmony import */ var _Select__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Select */ \"./modules/calendar/lib/async-calendar/js/Select.jsx\");\n\nfunction PostStatusField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(_Select__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n options: props.options,\n id: props.id,\n value: props.value,\n allowClear: props.allowClear,\n onSelect: props.onSelect,\n onClear: props.onClear\n });\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id\n }, props.value);\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/PostStatusField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/PostTypeField.jsx": -/*!*************************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/PostTypeField.jsx ***! - \*************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return PostTypeField; });\nfunction PostTypeField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(\"input\", {\n type: \"text\",\n value: props.value\n });\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"span\", null, props.value);\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/PostTypeField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/SelectField.jsx": -/*!***********************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/SelectField.jsx ***! - \***********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return SelectField; });\n/* harmony import */ var _Select__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Select */ \"./modules/calendar/lib/async-calendar/js/Select.jsx\");\n\nfunction SelectField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(_Select__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n ajaxUrl: props.ajaxUrl,\n nonce: props.nonce,\n multiple: props.multiple,\n ajaxAction: props.ajaxAction,\n ajaxArgs: props.ajaxArgs,\n options: props.options,\n value: props.value,\n name: props.name,\n id: props.id,\n onSelect: props.onSelect,\n onClear: props.onClear\n });\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id\n }, props.value);\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/SelectField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/TaxonomyField.jsx": -/*!*************************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/TaxonomyField.jsx ***! - \*************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return TaxonomyField; });\n/* harmony import */ var _Select__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Select */ \"./modules/calendar/lib/async-calendar/js/Select.jsx\");\n\nfunction TaxonomyField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(_Select__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n placeholder: props.placeholder,\n id: props.id,\n ajaxUrl: props.ajaxUrl,\n nonce: props.nonce,\n ajaxAction: 'publishpress_calendar_search_terms',\n ajaxArgs: {\n taxonomy: props.taxonomy\n },\n options: props.options,\n value: props.value,\n multiple: props.multiple,\n onSelect: props.onSelect,\n onClear: props.onClear,\n className: props.className\n });\n };\n\n var viewField = function viewField() {\n if (typeof props.value === 'undefined' || props.value.length === 0) {\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id,\n className: \"publishpress-calendar-empty-value\"\n }, publishpressCalendarParams.strings.noTerms);\n }\n\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id\n }, props.value.join(', '));\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/TaxonomyField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/TextArea.jsx": -/*!********************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/TextArea.jsx ***! - \********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return TextArea; });\nfunction TextArea(props) {\n var wrapper_class = props.metadata ? 'pp-calendar-form-metafied-input pp-calendar-form-metafied ' + props.post_types : '';\n\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: wrapper_class\n }, /*#__PURE__*/React.createElement(\"textarea\", {\n id: props.id,\n metadata: props.metadata,\n post_types: props.post_types,\n name: props.name,\n className: wrapper_class,\n onChange: function onChange(e) {\n if (props.onChange) {\n props.onChange(e, e.target.value);\n }\n }\n }, props.value));\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"div\", {\n id: props.id\n }, props.value);\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/TextArea.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/TextField.jsx": -/*!*********************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/TextField.jsx ***! - \*********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return TextField; });\nfunction TextField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(\"input\", {\n type: \"text\",\n id: props.id,\n value: props.value,\n onChange: function onChange(e) {\n if (props.onChange) {\n props.onChange(e, e.target.value);\n }\n }\n });\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id\n }, props.value);\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/TextField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/TimeField.jsx": -/*!*********************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/TimeField.jsx ***! - \*********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return TimeField; });\nfunction TimeField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(\"input\", {\n type: \"text\",\n id: props.id,\n placeholder: props.placeholder || null,\n value: props.value\n });\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id\n }, props.value);\n };\n\n var initInputMask = function initInputMask() {\n var selector = '#' + props.id;\n var args = {\n regex: \"^([0][0-9]|[1][0-9]|[2][0-3]):[0-5][0-9]$\",\n showMaskOnHover: false,\n staticDefinitionSymbol: \"*\"\n };\n\n if (props.placeholder) {\n args.placeholder = props.placeholder;\n }\n\n jQuery(selector).inputmask(args);\n jQuery(selector).on('change', function (e) {\n if (props.onChange) {\n props.onChange(e, e.target.value);\n }\n });\n };\n\n React.useEffect(initInputMask);\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/TimeField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/fields/UserField.jsx": -/*!*********************************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/fields/UserField.jsx ***! - \*********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return UserField; });\nfunction UserField(props) {\n var editField = function editField() {\n return /*#__PURE__*/React.createElement(\"input\", {\n type: \"text\",\n id: props.id,\n value: props.value\n });\n };\n\n var viewField = function viewField() {\n return /*#__PURE__*/React.createElement(\"span\", {\n id: props.id\n }, props.value);\n };\n\n return props.isEditing ? editField() : viewField();\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/fields/UserField.jsx?"); - -/***/ }), - -/***/ "./modules/calendar/lib/async-calendar/js/index.jsx": -/*!**********************************************************!*\ - !*** ./modules/calendar/lib/async-calendar/js/index.jsx ***! - \**********************************************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _AsyncCalendar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AsyncCalendar */ \"./modules/calendar/lib/async-calendar/js/AsyncCalendar.jsx\");\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Functions */ \"./modules/calendar/lib/async-calendar/js/Functions.jsx\");\n/* harmony import */ var _wp_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! &wp.element */ \"&wp.element\");\n/* harmony import */ var _wp_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wp_element__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _ReactDOM__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! &ReactDOM */ \"&ReactDOM\");\n/* harmony import */ var _ReactDOM__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_ReactDOM__WEBPACK_IMPORTED_MODULE_3__);\n\n\n\n\njQuery(function () {\n var container = document.getElementById('publishpress-calendar-wrap');\n var component = /*#__PURE__*/React.createElement(_AsyncCalendar__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n firstDateToDisplay: Object(_Functions__WEBPACK_IMPORTED_MODULE_1__[\"getDateWithNoTimezoneOffset\"])(publishpressCalendarParams.firstDateToDisplay),\n weekStartsOnSunday: parseInt(publishpressCalendarParams.weekStartsOnSunday) === 1,\n numberOfWeeksToDisplay: publishpressCalendarParams.numberOfWeeksToDisplay,\n todayDate: Object(_Functions__WEBPACK_IMPORTED_MODULE_1__[\"getDateInstanceFromString\"])(publishpressCalendarParams.todayDate),\n dateFormat: publishpressCalendarParams.dateFormat,\n timeFormat: publishpressCalendarParams.timeFormat,\n theme: publishpressCalendarParams.theme,\n statusesToDisplayTime: publishpressCalendarParams.statusesToDisplayTime,\n maxVisibleItems: publishpressCalendarParams.maxVisibleItems,\n ajaxUrl: publishpressCalendarParams.ajaxUrl,\n actionGetData: 'publishpress_calendar_get_data',\n actionMoveItem: 'publishpress_calendar_move_item',\n actionGetPostTypeFields: 'publishpress_calendar_get_post_type_fields',\n nonce: publishpressCalendarParams.nonce,\n statuses: publishpressCalendarParams.statuses,\n postTypes: publishpressCalendarParams.postTypes,\n postTypesCanCreate: publishpressCalendarParams.postTypesCanCreate,\n userCanAddPosts: publishpressCalendarParams.userCanAddPosts,\n items: publishpressCalendarParams.items,\n allowAddingMultipleAuthors: publishpressCalendarParams.allowAddingMultipleAuthors,\n requestFilter: publishpressCalendarParams.requestFilter,\n strings: publishpressCalendarParams.strings\n });\n\n if (_wp_element__WEBPACK_IMPORTED_MODULE_2__[\"createRoot\"]) {\n Object(_wp_element__WEBPACK_IMPORTED_MODULE_2__[\"createRoot\"])(container).render(component);\n } else {\n Object(_ReactDOM__WEBPACK_IMPORTED_MODULE_3__[\"render\"])(component);\n }\n});\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/index.jsx?"); - -/***/ }), - -/***/ "./node_modules/dompurify/dist/purify.js": -/*!***********************************************!*\ - !*** ./node_modules/dompurify/dist/purify.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -eval("/*! @license DOMPurify 2.4.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.1/LICENSE */\n\n(function (global, factory) {\n true ? module.exports = factory() :\n undefined;\n})(this, (function () { 'use strict';\n\n function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n }\n\n function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n }\n\n function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n }\n\n function _construct(Parent, args, Class) {\n if (_isNativeReflectConstruct()) {\n _construct = Reflect.construct;\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) _setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n }\n\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n }\n\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n }\n\n function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n }\n\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n var hasOwnProperty = Object.hasOwnProperty,\n setPrototypeOf = Object.setPrototypeOf,\n isFrozen = Object.isFrozen,\n getPrototypeOf = Object.getPrototypeOf,\n getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n var freeze = Object.freeze,\n seal = Object.seal,\n create = Object.create; // eslint-disable-line import/no-mutable-exports\n\n var _ref = typeof Reflect !== 'undefined' && Reflect,\n apply = _ref.apply,\n construct = _ref.construct;\n\n if (!apply) {\n apply = function apply(fun, thisValue, args) {\n return fun.apply(thisValue, args);\n };\n }\n\n if (!freeze) {\n freeze = function freeze(x) {\n return x;\n };\n }\n\n if (!seal) {\n seal = function seal(x) {\n return x;\n };\n }\n\n if (!construct) {\n construct = function construct(Func, args) {\n return _construct(Func, _toConsumableArray(args));\n };\n }\n\n var arrayForEach = unapply(Array.prototype.forEach);\n var arrayPop = unapply(Array.prototype.pop);\n var arrayPush = unapply(Array.prototype.push);\n var stringToLowerCase = unapply(String.prototype.toLowerCase);\n var stringToString = unapply(String.prototype.toString);\n var stringMatch = unapply(String.prototype.match);\n var stringReplace = unapply(String.prototype.replace);\n var stringIndexOf = unapply(String.prototype.indexOf);\n var stringTrim = unapply(String.prototype.trim);\n var regExpTest = unapply(RegExp.prototype.test);\n var typeErrorCreate = unconstruct(TypeError);\n function unapply(func) {\n return function (thisArg) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return apply(func, thisArg, args);\n };\n }\n function unconstruct(func) {\n return function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return construct(func, args);\n };\n }\n /* Add properties to a lookup table */\n\n function addToSet(set, array, transformCaseFunc) {\n transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase;\n\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n\n var l = array.length;\n\n while (l--) {\n var element = array[l];\n\n if (typeof element === 'string') {\n var lcElement = transformCaseFunc(element);\n\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n\n element = lcElement;\n }\n }\n\n set[element] = true;\n }\n\n return set;\n }\n /* Shallow clone an object */\n\n function clone(object) {\n var newObject = create(null);\n var property;\n\n for (property in object) {\n if (apply(hasOwnProperty, object, [property])) {\n newObject[property] = object[property];\n }\n }\n\n return newObject;\n }\n /* IE10 doesn't support __lookupGetter__ so lets'\n * simulate it. It also automatically checks\n * if the prop is function or getter and behaves\n * accordingly. */\n\n function lookupGetter(object, prop) {\n while (object !== null) {\n var desc = getOwnPropertyDescriptor(object, prop);\n\n if (desc) {\n if (desc.get) {\n return unapply(desc.get);\n }\n\n if (typeof desc.value === 'function') {\n return unapply(desc.value);\n }\n }\n\n object = getPrototypeOf(object);\n }\n\n function fallbackValue(element) {\n console.warn('fallback value for', element);\n return null;\n }\n\n return fallbackValue;\n }\n\n var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG\n\n var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);\n var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.\n // We still need to know them so that we can do namespace\n // checks properly in case one wants to add them to\n // allow-list.\n\n var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);\n var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements,\n // even those that we disallow by default.\n\n var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);\n var text = freeze(['#text']);\n\n var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);\n var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);\n var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);\n var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);\n\n var MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\n\n var ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\n var TMPLIT_EXPR = seal(/\\${[\\w\\W]*}/gm);\n var DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]/); // eslint-disable-line no-useless-escape\n\n var ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\n\n var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n );\n var IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\n var ATTR_WHITESPACE = seal(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n );\n var DOCTYPE_NAME = seal(/^html$/i);\n\n var getGlobal = function getGlobal() {\n return typeof window === 'undefined' ? null : window;\n };\n /**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.\n * @param {Document} document The document object (to determine policy name suffix)\n * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types\n * are not supported).\n */\n\n\n var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {\n if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {\n return null;\n } // Allow the callers to control the unique policy name\n // by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n // Policy creation with duplicate names throws in Trusted Types.\n\n\n var suffix = null;\n var ATTR_NAME = 'data-tt-policy-suffix';\n\n if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {\n suffix = document.currentScript.getAttribute(ATTR_NAME);\n }\n\n var policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n\n try {\n return trustedTypes.createPolicy(policyName, {\n createHTML: function createHTML(html) {\n return html;\n },\n createScriptURL: function createScriptURL(scriptUrl) {\n return scriptUrl;\n }\n });\n } catch (_) {\n // Policy creation failed (most likely another DOMPurify script has\n // already run). Skip creating the policy, as this will only cause errors\n // if TT are enforced.\n console.warn('TrustedTypes policy ' + policyName + ' could not be created.');\n return null;\n }\n };\n\n function createDOMPurify() {\n var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();\n\n var DOMPurify = function DOMPurify(root) {\n return createDOMPurify(root);\n };\n /**\n * Version label, exposed for easier checks\n * if DOMPurify is up to date or not\n */\n\n\n DOMPurify.version = '2.4.1';\n /**\n * Array of elements that DOMPurify removed during sanitation.\n * Empty if nothing was removed.\n */\n\n DOMPurify.removed = [];\n\n if (!window || !window.document || window.document.nodeType !== 9) {\n // Not running in a browser, provide a factory function\n // so that you can pass your own Window\n DOMPurify.isSupported = false;\n return DOMPurify;\n }\n\n var originalDocument = window.document;\n var document = window.document;\n var DocumentFragment = window.DocumentFragment,\n HTMLTemplateElement = window.HTMLTemplateElement,\n Node = window.Node,\n Element = window.Element,\n NodeFilter = window.NodeFilter,\n _window$NamedNodeMap = window.NamedNodeMap,\n NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,\n HTMLFormElement = window.HTMLFormElement,\n DOMParser = window.DOMParser,\n trustedTypes = window.trustedTypes;\n var ElementPrototype = Element.prototype;\n var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a\n // new document created via createHTMLDocument. As per the spec\n // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n // a new empty registry is used when creating a template contents owner\n // document, so we use that as our parent document to ensure nothing\n // is inherited.\n\n if (typeof HTMLTemplateElement === 'function') {\n var template = document.createElement('template');\n\n if (template.content && template.content.ownerDocument) {\n document = template.content.ownerDocument;\n }\n }\n\n var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);\n\n var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';\n var _document = document,\n implementation = _document.implementation,\n createNodeIterator = _document.createNodeIterator,\n createDocumentFragment = _document.createDocumentFragment,\n getElementsByTagName = _document.getElementsByTagName;\n var importNode = originalDocument.importNode;\n var documentMode = {};\n\n try {\n documentMode = clone(document).documentMode ? document.documentMode : {};\n } catch (_) {}\n\n var hooks = {};\n /**\n * Expose whether this browser supports running the full DOMPurify.\n */\n\n DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9;\n var MUSTACHE_EXPR$1 = MUSTACHE_EXPR,\n ERB_EXPR$1 = ERB_EXPR,\n TMPLIT_EXPR$1 = TMPLIT_EXPR,\n DATA_ATTR$1 = DATA_ATTR,\n ARIA_ATTR$1 = ARIA_ATTR,\n IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE$1 = ATTR_WHITESPACE;\n var IS_ALLOWED_URI$1 = IS_ALLOWED_URI;\n /**\n * We consider the elements and attributes below to be safe. Ideally\n * don't add any new ones but feel free to remove unwanted ones.\n */\n\n /* allowed element names */\n\n var ALLOWED_TAGS = null;\n var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));\n /* Allowed attribute names */\n\n var ALLOWED_ATTR = null;\n var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));\n /*\n * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.\n * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n */\n\n var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {\n tagNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n attributeNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n allowCustomizedBuiltInElements: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: false\n }\n }));\n /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n\n var FORBID_TAGS = null;\n /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n\n var FORBID_ATTR = null;\n /* Decide if ARIA attributes are okay */\n\n var ALLOW_ARIA_ATTR = true;\n /* Decide if custom data attributes are okay */\n\n var ALLOW_DATA_ATTR = true;\n /* Decide if unknown protocols are okay */\n\n var ALLOW_UNKNOWN_PROTOCOLS = false;\n /* Output should be safe for common template engines.\n * This means, DOMPurify removes data attributes, mustaches and ERB\n */\n\n var SAFE_FOR_TEMPLATES = false;\n /* Decide if document with ... should be returned */\n\n var WHOLE_DOCUMENT = false;\n /* Track whether config is already set on this instance of DOMPurify. */\n\n var SET_CONFIG = false;\n /* Decide if all elements (e.g. style, script) must be children of\n * document.body. By default, browsers might move them to document.head */\n\n var FORCE_BODY = false;\n /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported).\n * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n */\n\n var RETURN_DOM = false;\n /* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported) */\n\n var RETURN_DOM_FRAGMENT = false;\n /* Try to return a Trusted Type object instead of a string, return a string in\n * case Trusted Types are not supported */\n\n var RETURN_TRUSTED_TYPE = false;\n /* Output should be free from DOM clobbering attacks?\n * This sanitizes markups named with colliding, clobberable built-in DOM APIs.\n */\n\n var SANITIZE_DOM = true;\n /* Achieve full DOM Clobbering protection by isolating the namespace of named\n * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.\n *\n * HTML/DOM spec rules that enable DOM Clobbering:\n * - Named Access on Window (§7.3.3)\n * - DOM Tree Accessors (§3.1.5)\n * - Form Element Parent-Child Relations (§4.10.3)\n * - Iframe srcdoc / Nested WindowProxies (§4.8.5)\n * - HTMLCollection (§4.2.10.2)\n *\n * Namespace isolation is implemented by prefixing `id` and `name` attributes\n * with a constant string, i.e., `user-content-`\n */\n\n var SANITIZE_NAMED_PROPS = false;\n var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';\n /* Keep element content when removing element? */\n\n var KEEP_CONTENT = true;\n /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n * of importing it into a new Document and returning a sanitized copy */\n\n var IN_PLACE = false;\n /* Allow usage of profiles like html, svg and mathMl */\n\n var USE_PROFILES = {};\n /* Tags to ignore content of when KEEP_CONTENT is true */\n\n var FORBID_CONTENTS = null;\n var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);\n /* Tags that are safe for data: URIs */\n\n var DATA_URI_TAGS = null;\n var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);\n /* Attributes safe for values like \"javascript:\" */\n\n var URI_SAFE_ATTRIBUTES = null;\n var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);\n var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n /* Document namespace */\n\n var NAMESPACE = HTML_NAMESPACE;\n var IS_EMPTY_INPUT = false;\n /* Allowed XHTML+XML namespaces */\n\n var ALLOWED_NAMESPACES = null;\n var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);\n /* Parsing of strict XHTML documents */\n\n var PARSER_MEDIA_TYPE;\n var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n var transformCaseFunc;\n /* Keep a reference to config to pass to hooks */\n\n var CONFIG = null;\n /* Ideally, do not touch anything below this line */\n\n /* ______________________________________________ */\n\n var formElement = document.createElement('form');\n\n var isRegexOrFunction = function isRegexOrFunction(testValue) {\n return testValue instanceof RegExp || testValue instanceof Function;\n };\n /**\n * _parseConfig\n *\n * @param {Object} cfg optional config literal\n */\n // eslint-disable-next-line complexity\n\n\n var _parseConfig = function _parseConfig(cfg) {\n if (CONFIG && CONFIG === cfg) {\n return;\n }\n /* Shield configuration object from tampering */\n\n\n if (!cfg || _typeof(cfg) !== 'object') {\n cfg = {};\n }\n /* Shield configuration object from prototype pollution */\n\n\n cfg = clone(cfg);\n PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes\n SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n\n transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;\n /* Set configuration parameters */\n\n ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;\n ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;\n ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;\n URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent\n cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_URI_SAFE_ATTRIBUTES;\n DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent\n cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_DATA_URI_TAGS;\n FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;\n FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};\n FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};\n USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;\n ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n\n ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n\n ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n\n SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n\n WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n\n RETURN_DOM = cfg.RETURN_DOM || false; // Default false\n\n RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n\n RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n\n FORCE_BODY = cfg.FORCE_BODY || false; // Default false\n\n SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n\n SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false\n\n KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n\n IN_PLACE = cfg.IN_PLACE || false; // Default false\n\n IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1;\n NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n }\n\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n }\n\n if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {\n CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n }\n\n if (SAFE_FOR_TEMPLATES) {\n ALLOW_DATA_ATTR = false;\n }\n\n if (RETURN_DOM_FRAGMENT) {\n RETURN_DOM = true;\n }\n /* Parse profile info */\n\n\n if (USE_PROFILES) {\n ALLOWED_TAGS = addToSet({}, _toConsumableArray(text));\n ALLOWED_ATTR = [];\n\n if (USE_PROFILES.html === true) {\n addToSet(ALLOWED_TAGS, html$1);\n addToSet(ALLOWED_ATTR, html);\n }\n\n if (USE_PROFILES.svg === true) {\n addToSet(ALLOWED_TAGS, svg$1);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n\n if (USE_PROFILES.svgFilters === true) {\n addToSet(ALLOWED_TAGS, svgFilters);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n\n if (USE_PROFILES.mathMl === true) {\n addToSet(ALLOWED_TAGS, mathMl$1);\n addToSet(ALLOWED_ATTR, mathMl);\n addToSet(ALLOWED_ATTR, xml);\n }\n }\n /* Merge configuration parameters */\n\n\n if (cfg.ADD_TAGS) {\n if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n ALLOWED_TAGS = clone(ALLOWED_TAGS);\n }\n\n addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n }\n\n if (cfg.ADD_ATTR) {\n if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n ALLOWED_ATTR = clone(ALLOWED_ATTR);\n }\n\n addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n }\n\n if (cfg.ADD_URI_SAFE_ATTR) {\n addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n }\n\n if (cfg.FORBID_CONTENTS) {\n if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n FORBID_CONTENTS = clone(FORBID_CONTENTS);\n }\n\n addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n }\n /* Add #text in case KEEP_CONTENT is set to true */\n\n\n if (KEEP_CONTENT) {\n ALLOWED_TAGS['#text'] = true;\n }\n /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n\n\n if (WHOLE_DOCUMENT) {\n addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n }\n /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n\n\n if (ALLOWED_TAGS.table) {\n addToSet(ALLOWED_TAGS, ['tbody']);\n delete FORBID_TAGS.tbody;\n } // Prevent further manipulation of configuration.\n // Not available in IE8, Safari 5, etc.\n\n\n if (freeze) {\n freeze(cfg);\n }\n\n CONFIG = cfg;\n };\n\n var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);\n var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML\n // namespace. We need to specify them explicitly\n // so that they don't get erroneously deleted from\n // HTML namespace.\n\n var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);\n /* Keep track of all possible SVG and MathML tags\n * so that we can perform the namespace checks\n * correctly. */\n\n var ALL_SVG_TAGS = addToSet({}, svg$1);\n addToSet(ALL_SVG_TAGS, svgFilters);\n addToSet(ALL_SVG_TAGS, svgDisallowed);\n var ALL_MATHML_TAGS = addToSet({}, mathMl$1);\n addToSet(ALL_MATHML_TAGS, mathMlDisallowed);\n /**\n *\n *\n * @param {Element} element a DOM element whose namespace is being checked\n * @returns {boolean} Return false if the element has a\n * namespace that a spec-compliant parser would never\n * return. Return true otherwise.\n */\n\n var _checkValidNamespace = function _checkValidNamespace(element) {\n var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode\n // can be null. We just simulate parent in this case.\n\n if (!parent || !parent.tagName) {\n parent = {\n namespaceURI: NAMESPACE,\n tagName: 'template'\n };\n }\n\n var tagName = stringToLowerCase(element.tagName);\n var parentTagName = stringToLowerCase(parent.tagName);\n\n if (!ALLOWED_NAMESPACES[element.namespaceURI]) {\n return false;\n }\n\n if (element.namespaceURI === SVG_NAMESPACE) {\n // The only way to switch from HTML namespace to SVG\n // is via . If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'svg';\n } // The only way to switch from MathML to SVG is via`\n // svg if parent is either or MathML\n // text integration points.\n\n\n if (parent.namespaceURI === MATHML_NAMESPACE) {\n return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);\n } // We only allow elements that are defined in SVG\n // spec. All others are disallowed in SVG namespace.\n\n\n return Boolean(ALL_SVG_TAGS[tagName]);\n }\n\n if (element.namespaceURI === MATHML_NAMESPACE) {\n // The only way to switch from HTML namespace to MathML\n // is via . If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'math';\n } // The only way to switch from SVG to MathML is via\n // and HTML integration points\n\n\n if (parent.namespaceURI === SVG_NAMESPACE) {\n return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n } // We only allow elements that are defined in MathML\n // spec. All others are disallowed in MathML namespace.\n\n\n return Boolean(ALL_MATHML_TAGS[tagName]);\n }\n\n if (element.namespaceURI === HTML_NAMESPACE) {\n // The only way to switch from SVG to HTML is via\n // HTML integration points, and from MathML to HTML\n // is via MathML text integration points\n if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {\n return false;\n }\n\n if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {\n return false;\n } // We disallow tags that are specific for MathML\n // or SVG and should never appear in HTML namespace\n\n\n return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);\n } // For XHTML and XML documents that support custom namespaces\n\n\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {\n return true;\n } // The code should never reach this place (this means\n // that the element somehow got namespace that is not\n // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).\n // Return false just in case.\n\n\n return false;\n };\n /**\n * _forceRemove\n *\n * @param {Node} node a DOM node\n */\n\n\n var _forceRemove = function _forceRemove(node) {\n arrayPush(DOMPurify.removed, {\n element: node\n });\n\n try {\n // eslint-disable-next-line unicorn/prefer-dom-node-remove\n node.parentNode.removeChild(node);\n } catch (_) {\n try {\n node.outerHTML = emptyHTML;\n } catch (_) {\n node.remove();\n }\n }\n };\n /**\n * _removeAttribute\n *\n * @param {String} name an Attribute name\n * @param {Node} node a DOM node\n */\n\n\n var _removeAttribute = function _removeAttribute(name, node) {\n try {\n arrayPush(DOMPurify.removed, {\n attribute: node.getAttributeNode(name),\n from: node\n });\n } catch (_) {\n arrayPush(DOMPurify.removed, {\n attribute: null,\n from: node\n });\n }\n\n node.removeAttribute(name); // We void attribute values for unremovable \"is\"\" attributes\n\n if (name === 'is' && !ALLOWED_ATTR[name]) {\n if (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n try {\n _forceRemove(node);\n } catch (_) {}\n } else {\n try {\n node.setAttribute(name, '');\n } catch (_) {}\n }\n }\n };\n /**\n * _initDocument\n *\n * @param {String} dirty a string of dirty markup\n * @return {Document} a DOM, filled with the dirty markup\n */\n\n\n var _initDocument = function _initDocument(dirty) {\n /* Create a HTML document */\n var doc;\n var leadingWhitespace;\n\n if (FORCE_BODY) {\n dirty = '' + dirty;\n } else {\n /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n var matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n leadingWhitespace = matches && matches[0];\n }\n\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {\n // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n dirty = '' + dirty + '';\n }\n\n var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;\n /*\n * Use the DOMParser API by default, fallback later if needs be\n * DOMParser not work for svg when has multiple root element.\n */\n\n if (NAMESPACE === HTML_NAMESPACE) {\n try {\n doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n } catch (_) {}\n }\n /* Use createHTMLDocument in case DOMParser is not available */\n\n\n if (!doc || !doc.documentElement) {\n doc = implementation.createDocument(NAMESPACE, 'template', null);\n\n try {\n doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload;\n } catch (_) {// Syntax error if dirtyPayload is invalid xml\n }\n }\n\n var body = doc.body || doc.documentElement;\n\n if (dirty && leadingWhitespace) {\n body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);\n }\n /* Work on whole document or just its body */\n\n\n if (NAMESPACE === HTML_NAMESPACE) {\n return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];\n }\n\n return WHOLE_DOCUMENT ? doc.documentElement : body;\n };\n /**\n * _createIterator\n *\n * @param {Document} root document/fragment to create iterator for\n * @return {Iterator} iterator instance\n */\n\n\n var _createIterator = function _createIterator(root) {\n return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);\n };\n /**\n * _isClobbered\n *\n * @param {Node} elm element to check for clobbering attacks\n * @return {Boolean} true if clobbered, false if safe\n */\n\n\n var _isClobbered = function _isClobbered(elm) {\n return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');\n };\n /**\n * _isNode\n *\n * @param {Node} obj object to check whether it's a DOM node\n * @return {Boolean} true is object is a DOM node\n */\n\n\n var _isNode = function _isNode(object) {\n return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';\n };\n /**\n * _executeHook\n * Execute user configurable hooks\n *\n * @param {String} entryPoint Name of the hook's entry point\n * @param {Node} currentNode node to work on with the hook\n * @param {Object} data additional hook parameters\n */\n\n\n var _executeHook = function _executeHook(entryPoint, currentNode, data) {\n if (!hooks[entryPoint]) {\n return;\n }\n\n arrayForEach(hooks[entryPoint], function (hook) {\n hook.call(DOMPurify, currentNode, data, CONFIG);\n });\n };\n /**\n * _sanitizeElements\n *\n * @protect nodeName\n * @protect textContent\n * @protect removeChild\n *\n * @param {Node} currentNode to check for permission to exist\n * @return {Boolean} true if node was killed, false if left alive\n */\n\n\n var _sanitizeElements = function _sanitizeElements(currentNode) {\n var content;\n /* Execute a hook if present */\n\n _executeHook('beforeSanitizeElements', currentNode, null);\n /* Check if element is clobbered or can clobber */\n\n\n if (_isClobbered(currentNode)) {\n _forceRemove(currentNode);\n\n return true;\n }\n /* Check if tagname contains Unicode */\n\n\n if (regExpTest(/[\\u0080-\\uFFFF]/, currentNode.nodeName)) {\n _forceRemove(currentNode);\n\n return true;\n }\n /* Now let's check the element's type and name */\n\n\n var tagName = transformCaseFunc(currentNode.nodeName);\n /* Execute a hook if present */\n\n _executeHook('uponSanitizeElement', currentNode, {\n tagName: tagName,\n allowedTags: ALLOWED_TAGS\n });\n /* Detect mXSS attempts abusing namespace confusion */\n\n\n if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\\w]/g, currentNode.innerHTML) && regExpTest(/<[/\\w]/g, currentNode.textContent)) {\n _forceRemove(currentNode);\n\n return true;\n }\n /* Mitigate a problem with templates inside select */\n\n\n if (tagName === 'select' && regExpTest(/