{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./app/src/frontend/booking-widget/index.js","webpack:///external [\"wp\",\"hooks\"]"],"names":["isDateAvailable","startDate","cutOffTime","times","nowDate","moment","Date","utc","toDate","co","availableToday","hour","min","length","tripTimeData","forEach","time","split","setHours","parseInt","setMinutes","h","getHours","addFilter","available","tripData","date","data","cuttOffTime","isSame","start_date","trip_time","dateRules","find","da","format","unix","console","log","selectedDate","filter"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAA4C;;AAE5C;AACA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,SAAS,EAAEC,UAAU,EAAEC,KAAK,EAAM;EACvD,IAAIC,OAAO,GAAGC,MAAM,CAAE,IAAIC,IAAI,EAAE,CAAE,CAACC,GAAG,EAAE,CAACC,MAAM,EAAE;EAEjD,IAAIC,EAAE,GAAG,IAAIH,IAAI,CAAEL,SAAS,CAAE,EAAC;EAC/B;EACA;;EAEA,IAAIS,cAAc,GAAG,KAAK;EAC1B,IAAIC,IAAI,GAAG,CAAC;EACZ,IAAIC,GAAG,GAAG,CAAC;EACX,IAAKT,KAAK,CAACU,MA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,CAAE,CAAE,EAAC;;MAEjC,IAAIS,CAAC,GAAGF,QAAQ,CAAEV,EAAE,CAACa,QAAQ,EAAE,CAAE,GAAGH,QAAQ,CAACjB,UAAU,CAAC;MACxDO,EAAE,CAACS,QAAQ,CAAEG,CAAC,CAAE,CAAC,CAAC;MAClB,IAAIjB,OAAO,GAAGK,EAAE,EAAG;QACf,OAAOO,IAAI;MACf;IACJ,CAAC,CAAC;EACN;EACA,OAAOb,KAAK;AAEhB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAE,C;;;;;;;;;;;;;;;;;;;;;;;ACvGV,aAAa,wCAAwC,EAAE,I","file":"frontend-booking-widget.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","import {addFilter } from '@wordpress/hooks';\n\n// cutoff date calculation..\nconst isDateAvailable = (startDate, cutOffTime, times ) => {\n let nowDate = moment( new Date() ).utc().toDate();\n\n let co = new Date( startDate ) // start date as cutoff date.\n // let coh = co.getHours(); // extract current hours in start date.\n // let com = co.getMinutes();\n\n let availableToday = false;\n let hour = 0\n let min = 0;\n if ( times.length > 0 ) { // set compare date with time\n // let times = tripTime.split(',');\n let tripTimeData = []\n \n times.forEach(function( time ) {\n co = new Date( startDate ) // re initialize co to fix date override issue in loop.\n tripTimeData = time.split(':')\n hour = tripTimeData[0]; // Trip time hour\n min = tripTimeData[1]; // Trip time minute\n \n co.setHours(parseInt( hour ) ) // Set trip time hour to get actual trip date along with time\n co.setMinutes( parseInt( min ) ) // Set trip time min to get actual trip date along with time\n \n let h = parseInt( co.getHours() ) - parseInt(cutOffTime)\n co.setHours( h ); // set cutoff hours.\n \n if( nowDate < co ) {\n availableToday = true\n } \n \n });\n return availableToday\n\n } else {\n co.setHours(0) // Set trip time hour to get actual trip date along with time\n co.setMinutes(0) // Set trip time min to get actual trip date along with time\n\n let h = parseInt(-cutOffTime)\n co.setHours( h ); // set cutoff hours.\n \n if( nowDate < co ) {\n availableToday = true\n } \n return availableToday\n }\n}\n\n// cutOffTime Normal Date filter [without reucrring]\naddFilter( 'wpTravelCutofDateFilter', 'wp-travel', (available, tripData, date, data ) => { \n \n let cutOffTime = 'undefined' != typeof tripData.cuttOffTime ? parseInt( tripData.cuttOffTime ) : 0; // in hours\n if ( moment(date).isSame(moment(data.start_date)) && cutOffTime ) {\n let times = data.trip_time && data.trip_time.split(',') || []\n return isDateAvailable( data.start_date, cutOffTime, times )\n }\n return available\n}, 10, 4 );\n\n\n// cutOffTime Recurring Date filter\naddFilter( 'wpTravelRecurringCutofDateFilter', 'wp-travel', (available, dateRules, tripData, date, data ) => { \n \n let cutOffTime = 'undefined' != typeof tripData.cuttOffTime ? parseInt( tripData.cuttOffTime ) : 0; // in hours\n if ( dateRules.find(da => moment(moment(da).format(\"YYYY-MM-DD\")).unix() === moment(moment(date).format('YYYY-MM-DD')).unix()) instanceof Date && cutOffTime ) {\n let times = data.trip_time && data.trip_time.split(',') || []\n console.log( 'date', date );\n return isDateAvailable( date, cutOffTime, times )\n }\n return available\n}, 10, 5 );\n\n// cutOffTime Time filter\naddFilter( 'wpTravelCutofTimeFilter', 'wp-travel', (times, tripData, selectedDate ) => { \n let cutOffTime = 'undefined' != typeof tripData.cuttOffTime ? parseInt( tripData.cuttOffTime ) : 0; // in hours\n \n if ( cutOffTime ) {\n let nowDate = moment( new Date() ).utc().toDate();\n // let selectedDate = date.start_date\n let co = moment( new Date(selectedDate) ).utc().toDate(); // start date as cutoff date. [need to reset time in selected date due to some date doesn't have time.]\n let tripTimeData = []\n let hour = 0\n let min = 0;\n times = times.filter( ( time ) => {\n co = moment( new Date(selectedDate) ).utc().toDate(); // re initialize co to fix date override issue in loop.\n tripTimeData = time.split(':')\n hour = tripTimeData[0]; // Trip time hour\n min = tripTimeData[1]; // Trip time minute\n \n co.setHours( parseInt( hour ) ) // Set trip time hour to get actual trip date along with time\n co.setMinutes( parseInt( min ) ) // Set trip time min to get actual trip date along with time\n \n let h = parseInt( co.getHours() ) - parseInt(cutOffTime)\n co.setHours( h ); // set cutoff hours.\n if( nowDate < co ) {\n return time\n }\n })\n }\n return times;\n \n}, 10, 3 );","(function() { module.exports = window[\"wp\"][\"hooks\"]; }());"],"sourceRoot":""}