{"version":3,"sources":["webpack:///./app/javascript/js/common/apartmentRentalPeriod.js","webpack:///./app/javascript/images/react_icons/xmark.svg","webpack:///./app/javascript/js/pages/apartment/index.js","webpack:///./app/javascript/js/common/dates.js","webpack:///./app/javascript/js/common/formatCurrency.js","webpack:///./app/javascript/js/common/translations.js","webpack:///./node_modules/moment/locale/pt-br.js"],"names":["isShortTerm","term","isLongTerm","modalReservationForm","window","http","axios","moment","locale","document","documentElement","lang","SIMPLE_DATE_FORMAT","DATEPICKER_FORMAT","inclusions","NONE","LEFT","RIGHT","BOTH","includeLeft","inclusion","includeRight","dateComparator","a","b","Date","getTime","clone","date","resetTime","getFullYear","getMonth","getDate","addDays","days","newDate","setDate","dayDatesBetween","startDate","endDate","arguments","length","undefined","current","to","result","push","daysDiff","first","second","Math","round","parse","str","format","momentDate","toDate","verifyBlockedDates","blockedDates","checkIn","nextMax","_toConsumableArray","sort","find","lastBlockedDate","sortedUnavailableDates","currentLanguage","querySelector","getAttribute","currencyFormatter","Intl","NumberFormat","minimumFractionDigits","formatCurrency","value","provider","get","set","translations","append","_objectSpread","keyFormat","key","concat","replaceAll","replace","RegExp","t","params","Object","keys","forEach","register","defineLocale","months","split","monthsShort","weekdays","weekdaysShort","weekdaysMin","weekdaysParseExact","longDateFormat","LT","LTS","L","LL","LLL","LLLL","calendar","sameDay","nextDay","nextWeek","lastDay","lastWeek","this","day","sameElse","relativeTime","future","past","s","ss","m","mm","h","hh","d","dd","M","MM","y","yy","dayOfMonthOrdinalParse","ordinal","factory"],"mappings":";kKAAA,oEAAO,IAAMA,EAAc,SAACC,GAAI,MAAc,eAATA,GACxBC,EAAa,SAACD,GAAI,MAAc,cAATA,I,iCCDpC,OAAe,cAA0B,uE,uECGzCE,YAAqBC,OAAQ,CAAEC,KAAMC,O,+oCCArCC,IAAOC,OAAOC,SAASC,gBAAgBC,MAEhC,IAAMC,EAAqB,aACrBC,EAAsD,OAAlCJ,SAASC,gBAAgBC,KAAgB,aAAe,aAG5EG,E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AQoC,EAAUC,GAAMM,EAAON,OAG9CrC,GAGTzC,OAAiB,aAAI,CACnBwF,SAzBsB,SAACd,GAAY,OAAKH,EAASI,OAAOD,M,qBCTjD,SAAUvE,GACjB,aAGWA,EAAOsF,aAAa,QAAS,CACtCC,OAAQ,8FAA2FC,MAAM,KACzGC,YAAa,kDAAkDD,MAAM,KACrEE,SAAU,uFAAiFF,MAAM,KACjGG,cAAe,iCAA8BH,MAAM,KACnDI,YAAa,yCAAuBJ,MAAM,KAC1CK,oBAAoB,EACpBC,eAAgB,CACdC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,wBACJC,IAAK,sCACLC,KAAM,6CAERC,SAAU,CACRC,QAAS,kBACTC,QAAS,uBACTC,SAAU,kBACVC,QAAS,mBACTC,SAAU,WACR,OAAsB,IAAfC,KAAKC,OAA8B,IAAfD,KAAKC,MAAc,8BAC5C,+BAGJC,SAAU,KAEZC,aAAc,CACZC,OAAQ,QACRC,KAAM,WACNC,EAAG,kBACHC,GAAI,cACJC,EAAG,YACHC,GAAI,aACJC,EAAG,WACHC,GAAI,WACJC,EAAG,SACHC,GAAI,UACJC,EAAG,YACHC,GAAI,WACJC,EAAG,SACHC,GAAI,WAENC,uBAAwB,cACxBC,QAAS,WAjDqFC,CAAQ,EAAQ,O","file":"js/pack-apartment-page-6343c60f80697659b3fd.chunk.js","sourcesContent":["export const isShortTerm = (term) => term === 'short_term';\nexport const isLongTerm = (term) => term === 'long_term';\n","export default __webpack_public_path__ + \"media/images/react_icons/xmark-7dbfa03a8b18fff00502854b7729a8e9.svg\";","import modalReservationForm from '../../components/MobileCalendarModal';\nimport axios from 'axios';\n\nmodalReservationForm(window, { http: axios });\n","import moment from 'moment';\nimport 'moment/locale/pt-br';\n\nmoment.locale(document.documentElement.lang);\n\nexport const SIMPLE_DATE_FORMAT = 'YYYY-MM-DD'; // based on moment date format\nexport const DATEPICKER_FORMAT = document.documentElement.lang === 'en' ? 'MM/DD/YYYY' : 'DD/MM/YYYY'; // Format for text form input\n\nconst MILLISECONDS_IN_A_DAY = 1000 * 60 * 60 * 24;\nexport const inclusions = {\n NONE: 'none',\n LEFT: 'left',\n RIGHT: 'right',\n BOTH: 'both'\n};\n\nconst includeLeft = inclusion => inclusion === inclusions.LEFT || inclusion === inclusions.BOTH;\nconst includeRight = inclusion => inclusion === inclusions.RIGHT || inclusion === inclusions.BOTH;\n\nconst dateComparator = (a, b) => new Date(a).getTime() - new Date(b).getTime();\n\n/**\n * Clones the date\n *\n * @param date\n * @returns {Date}\n */\nexport function clone(date) {\n return date ? new Date(date.getTime()) : date;\n}\n\n/**\n * Reset the time part of a date\n * @param {Date} date\n */\nexport function resetTime(date) {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);\n}\n\n/**\n * Adds days to the given date, a negative value in days will decrement\n * @param {Date} date\n * @param {number} days\n */\nexport function addDays(date, days) {\n const newDate = clone(date);\n newDate.setDate(newDate.getDate() + days);\n return newDate;\n}\n\n/**\n * Get the days between 2 dates\n * @param {Date} startDate\n * @param {Date} endDate\n * @param inclusion\n */\nexport function dayDatesBetween(startDate, endDate, inclusion = inclusions.LEFT) {\n let current = resetTime(addDays(startDate, includeLeft(inclusion) ? 0 : 1));\n const to = resetTime(addDays(endDate, includeRight(inclusion) ? 1 : 0));\n const result = [];\n while (current.getTime() < to.getTime()) {\n result.push(current);\n current = addDays(current, 1);\n }\n return result;\n}\n\n/**\n * Gets the different in terms of days\n *\n * @param first\n * @param second\n * @returns {number}\n */\nexport function daysDiff(first, second) {\n // Take the difference between the dates and divide by milliseconds per day.\n // Round to nearest whole number to deal with DST.\n return Math.round((second - first) / MILLISECONDS_IN_A_DAY);\n}\n\n/**\n * Gets the different in terms of natural days\n *\n * @param {Date} first\n * @param {Date} second\n * @returns {number}\n */\nexport function naturalDaysDiff(first, second) {\n const utc1 = Date.UTC(first.getFullYear(), first.getMonth(), first.getDate());\n const utc2 = Date.UTC(second.getFullYear(), second.getMonth(), second.getDate());\n\n return Math.floor((utc2 - utc1) / MILLISECONDS_IN_A_DAY);\n}\n\n/**\n * Gets the date of the first not available from the given one (sinceDate), looking into the unavailableDates\n *\n * @param sinceDate\n * @param unavailableDates\n * @returns {*}\n */\nexport function getFirstUnAvailableDateSince(sinceDate, unavailableDates) {\n if (unavailableDates.length === 0) {\n return null;\n }\n const sortedUnavailableDates = [...unavailableDates].sort(dateComparator);\n\n // TODO: improve with a binary find\n let i;\n for (i = 0; i < sortedUnavailableDates.length; i++) {\n if (naturalDaysDiff(sinceDate, sortedUnavailableDates[i]) >= 1) {\n break;\n }\n }\n\n if (i < sortedUnavailableDates.length) {\n return clone(sortedUnavailableDates[i]);\n }\n\n return null;\n}\n\n/**\n *\n * @param {string} str\n * @param {string} format\n * @returns {Date}\n */\nexport function parse(str, format = undefined) {\n const momentDate = moment(str, format);\n return momentDate.toDate();\n}\n\n/**\n *\n * @param {Date} date\n * @param {string} format\n * @returns {string}\n */\nexport function format(date, format = undefined) {\n const momentDate = moment(date);\n return momentDate.format(format);\n}\n\nexport function verifyBlockedDates(blockedDates, checkIn) {\n if (blockedDates.length === 1) return null;\n\n const sortedUnavailableDates = [...blockedDates].sort(dateComparator);\n\n const nextMax = sortedUnavailableDates.find(date => new Date(date) > checkIn);\n\n if (nextMax) {\n return nextMax;\n }\n return null;\n}\n\nexport function lastBlockedDate(blockedDates) {\n if (blockedDates.length === 1) return null;\n\n const sortedUnavailableDates = [...blockedDates].sort(dateComparator);\n\n return sortedUnavailableDates[sortedUnavailableDates.length - 1];\n}\n","const currentLanguage = window.document.querySelector('html').getAttribute('lang');\nconst currencyFormatter = new Intl.NumberFormat(currentLanguage, { minimumFractionDigits: 0 });\nconst formatCurrency = value => (currencyFormatter.format(value));\n\nexport default formatCurrency;\n","/* eslint-disable no-return-assign */\nconst TRANSLATIONS_KEY = 'TRANSLATIONS';\nconst GLOBAL_KEY = 'translations';\n\nconst windowProvider = {\n get: () => window[TRANSLATIONS_KEY],\n set: (translations) => window[TRANSLATIONS_KEY] = translations,\n append: (translations) => {\n if (!window[TRANSLATIONS_KEY]) window[TRANSLATIONS_KEY] = {};\n window[TRANSLATIONS_KEY] = { ...window[TRANSLATIONS_KEY], ...translations };\n }\n};\n\nlet provider = windowProvider;\n\nexport const setTranslationProvider = fn => provider = fn;\nexport const register = (translations) => provider.append(translations);\n\nconst keyFormat = key => `%{${key}}`;\n\nconst replaceAll = (str, find, replace) => {\n return str.replace(new RegExp(find, 'g'), replace);\n};\n\nexport const t = (key, params = {}) => {\n const translations = provider.get() || {};\n\n if (translations[key] === undefined || translations[key] === null) {\n return key;\n }\n\n let result = translations[key];\n\n Object.keys(params).forEach(key => {\n result = replaceAll(result, keyFormat(key), params[key]);\n });\n\n return result;\n};\n\nwindow[GLOBAL_KEY] = {\n register\n};\n","//! moment.js locale configuration\n//! locale : Portuguese (Brazil) [pt-br]\n//! author : Caio Ribeiro Pereira : https://github.com/caio-ribeiro-pereira\n\n;\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' && typeof require === 'function' ? factory(require('../moment')) : typeof define === 'function' && define.amd ? define(['../moment'], factory) : factory(global.moment);\n})(this, function (moment) {\n 'use strict';\n\n //! moment.js locale configuration\n var ptBr = moment.defineLocale('pt-br', {\n months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'),\n monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'),\n weekdays: 'domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado'.split('_'),\n weekdaysShort: 'dom_seg_ter_qua_qui_sex_sáb'.split('_'),\n weekdaysMin: 'do_2ª_3ª_4ª_5ª_6ª_sá'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'HH:mm',\n LTS: 'HH:mm:ss',\n L: 'DD/MM/YYYY',\n LL: 'D [de] MMMM [de] YYYY',\n LLL: 'D [de] MMMM [de] YYYY [às] HH:mm',\n LLLL: 'dddd, D [de] MMMM [de] YYYY [às] HH:mm'\n },\n calendar: {\n sameDay: '[Hoje às] LT',\n nextDay: '[Amanhã às] LT',\n nextWeek: 'dddd [às] LT',\n lastDay: '[Ontem às] LT',\n lastWeek: function () {\n return this.day() === 0 || this.day() === 6 ? '[Último] dddd [às] LT' // Saturday + Sunday\n : '[Última] dddd [às] LT'; // Monday - Friday\n },\n\n sameElse: 'L'\n },\n relativeTime: {\n future: 'em %s',\n past: 'há %s',\n s: 'poucos segundos',\n ss: '%d segundos',\n m: 'um minuto',\n mm: '%d minutos',\n h: 'uma hora',\n hh: '%d horas',\n d: 'um dia',\n dd: '%d dias',\n M: 'um mês',\n MM: '%d meses',\n y: 'um ano',\n yy: '%d anos'\n },\n dayOfMonthOrdinalParse: /\\d{1,2}º/,\n ordinal: '%dº'\n });\n return ptBr;\n});"],"sourceRoot":""}