(()=>{"use strict";var __webpack_require__={n:module=>{var getter=module&&module.__esModule?()=>module.default:()=>module;return __webpack_require__.d(getter,{a:getter}),getter},d:(exports,definition)=>{for(var key in definition)__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports,key)&&Object.defineProperty(exports,key,{enumerable:!0,get:definition[key]})},o:(obj,prop)=>Object.prototype.hasOwnProperty.call(obj,prop)};const external_wp_i18n_namespaceObject=window.wp.i18n,external_jQuery_namespaceObject=window.jQuery;var external_jQuery_default=__webpack_require__.n(external_jQuery_namespaceObject);const external_moment_namespaceObject=window.moment;var external_moment_default=__webpack_require__.n(external_moment_namespaceObject);!function($){function isDateValidFormat(dateString=!1){return!1!==dateString&&external_moment_default()(dateString,"YYYY-MM-DD",!0).isValid()}function renderError(errorMessage=""){0!==errorMessage.length&&alert(errorMessage)}$(document).ready((function(){"true"===new URLSearchParams(window.location.href).get("confirm")&&"confirmed"!==$("#_booking_status").val()&&confirm((0,external_wp_i18n_namespaceObject.__)("Confirm the booking?","woocommerce-bookings"))&&($(" #_booking_status").val("confirmed"),$(" #post").submit())}));$('#woocommerce-booking-save input[name="save"]').on("click",(function(e){const startDateEl=$("#booking_start_date"),endDateEl=$("#booking_end_date"),startDateValue=startDateEl.val(),endDateValue=endDateEl.val();if(!isDateValidFormat(startDateValue)||!isDateValidFormat(endDateValue))return e.preventDefault(),void renderError(wc_bookings_admin_edit_booking_params.invalid_start_end_date);isDateValidFormat(startDateValue)&&isDateValidFormat(endDateValue)&&!function(startDate="",endDate=""){return 0!==startDate.length&&0!==endDate.length&&!external_moment_default()(endDate).isBefore(startDate)}(startDateValue,endDateValue)&&(e.preventDefault(),renderError(wc_bookings_admin_edit_booking_params.date_range_invalid))}))}(external_jQuery_default())})();
//# sourceMappingURL=admin-edit-booking.js.map