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oD,oBAAZI,UAE3EA,QAAQC,KAAK,sNAEbD,QAAQC,MAAK,IAAIC,OAAQC,QAEpB,IAAIvD,KAAKQ,KAEpB,C,kBCnDA,SAASgD,EAAQC,GAGf,OAAOD,EAAU,mBAAqBE,QAAU,iBAAmBA,OAAOC,SAAW,SAAUF,GAC7F,cAAcA,CAChB,EAAI,SAAUA,GACZ,OAAOA,GAAK,mBAAqBC,QAAUD,EAAE1G,cAAgB2G,QAAUD,IAAMC,OAAOT,UAAY,gBAAkBQ,CACpH,EAAGD,EAAQC,EACb,C","sources":["webpack:///./app/javascript/lib/IdleScheduler.js","webpack:///./app/javascript/packs/views/listings/lazy/YouSeemInterestedPopup.js","webpack:///../../shared/node_modules/date-fns/esm/isFuture/index.js","webpack:///../../shared/node_modules/date-fns/esm/parseJSON/index.js","webpack:///../../shared/node_modules/date-fns/esm/addWeeks/index.js","webpack:///../../shared/node_modules/date-fns/esm/addDays/index.js","webpack:///../../shared/node_modules/date-fns/esm/_lib/requiredArgs/index.js","webpack:///../../shared/node_modules/date-fns/esm/_lib/toInteger/index.js","webpack:///../../shared/node_modules/date-fns/esm/toDate/index.js","webpack:///../../shared/node_modules/@babel/runtime/helpers/esm/typeof.js"],"sourcesContent":["export default class IdleScheduler {\n constructor({ timeout = null } = {}) {\n this.timeout = timeout\n this.pendingTasks = []\n this.isScheduled = false\n }\n\n schedule(task) {\n if (typeof task === 'function') this.pendingTasks.unshift(task)\n\n if (this.isScheduled) return\n\n this.isScheduled = true\n\n requestIdleCallback(this.process, { timeout: this.timeout })\n }\n\n process = (deadline) => {\n this.isScheduled = false\n\n while ((deadline.timeRemaining() > 0 || deadline.didTimeout) && this.pendingTasks.length) {\n const performTask = this.pendingTasks.pop()\n performTask()\n }\n\n if (this.pendingTasks.length) this.schedule()\n }\n}\n","import $ from 'legacy/vendor/jquery.custom'\n\nimport addWeeks from 'date-fns/addWeeks'\nimport isFuture from 'date-fns/isFuture'\nimport parseJSON from 'date-fns/parseJSON'\n\nimport IdleScheduler from 'lib/IdleScheduler'\n\nexport default class YouSeemInterestedPopup {\n static VISIT_THRESHOLD = 2\n static STORAGE_KEY = 'visit-history'\n\n // Example shape of the visit-history object (JSON stored in localStorage)\n // -----------------\n // static history = {\n // '123-main-st': { visits: 0, expiry: '2000-01-01T01:00:00.123Z', shown: false },\n // '456-main-ln': { visits: 3, expiry: '2000-01-01T01:00:00.123Z', shown: true },\n // …\n // }\n\n static lazyLoad() {\n if (window.estately.data.is_csr) return\n if ($('.js-show-to-users-with-showing').is(':visible')) return // Disable if showing already requested\n\n this.$popup = $('#you-seem-interested-popup')\n\n const idler = new IdleScheduler()\n idler.schedule(() => this.constructHistory())\n idler.schedule(() => this.trackVisit())\n }\n\n static constructHistory() {\n const cachedHistory = JSON.parse(localStorage.getItem(this.STORAGE_KEY) || '{}')\n\n this.history = Object.fromEntries(\n // Filter out any entries that expired\n Object.entries(cachedHistory).filter(([_key, val]) => (\n !val.expiry || isFuture(parseJSON(val.expiry))\n )),\n )\n }\n\n static trackVisit() {\n const entry = this.getEntry()\n\n entry.visits += 1\n\n if (!entry.shown) {\n entry.expiry = addWeeks(new Date(), 1) // Bump the expiration date\n\n if (entry.visits >= this.VISIT_THRESHOLD) this.setupLazyPopup()\n }\n\n this.saveEntry(entry)\n }\n\n static getEntry() {\n if (!this.history) this.constructHistory()\n\n return this.history[window.estately.data.property.id] || { visits: 0 }\n }\n\n static saveEntry(entry) {\n this.history[window.estately.data.property.id] = entry\n localStorage.setItem(this.STORAGE_KEY, JSON.stringify(this.history))\n }\n\n static setupLazyPopup() {\n const $imageCarousel = $('.js-image-carousel .js-carousel-scroller')\n\n // Don’t activate the popup until a user clicks/scrolls the image gallery, or\n // scrolls the document. We want to avoid the popup getting triggered by bots!\n $imageCarousel\n .one('click', (event) => {\n if (this.getEntry().shown) return\n\n event.stopPropagation() // Prevent the gallery from opening\n this.attemptPopupDisplay()\n })\n .add(document).one('scroll', () => {\n if (!this.getEntry().shown) this.attemptPopupDisplay()\n })\n }\n\n static attemptPopupDisplay = () => {\n if ($('.modal').is(':visible')) return\n\n this.$popup\n .modal('show')\n\n const entry = this.getEntry()\n entry.shown = true\n this.saveEntry(entry)\n }\n}\n","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isFuture\n * @category Common Helpers\n * @summary Is the given date in the future?\n * @pure false\n *\n * @description\n * Is the given date in the future?\n *\n * > ⚠️ Please note that this function is not present in the FP submodule as\n * > it uses `Date.now()` internally hence impure and can't be safely curried.\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is in the future\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // If today is 6 October 2014, is 31 December 2014 in the future?\n * const result = isFuture(new Date(2014, 11, 31))\n * //=> true\n */\nexport default function isFuture(dirtyDate) {\n requiredArgs(1, arguments);\n return toDate(dirtyDate).getTime() > Date.now();\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name parseJSON\n * @category Common Helpers\n * @summary Parse a JSON date string\n *\n * @description\n * Converts a complete ISO date string in UTC time, the typical format for transmitting\n * a date in JSON, to a JavaScript `Date` instance.\n *\n * This is a minimal implementation for converting dates retrieved from a JSON API to\n * a `Date` instance which can be used with other functions in the `date-fns` library.\n * The following formats are supported:\n *\n * - `2000-03-15T05:20:10.123Z`: The output of `.toISOString()` and `JSON.stringify(new Date())`\n * - `2000-03-15T05:20:10Z`: Without milliseconds\n * - `2000-03-15T05:20:10+00:00`: With a zero offset, the default JSON encoded format in some other languages\n * - `2000-03-15T05:20:10+05:45`: With a positive or negative offset, the default JSON encoded format in some other languages\n * - `2000-03-15T05:20:10+0000`: With a zero offset without a colon\n * - `2000-03-15T05:20:10`: Without a trailing 'Z' symbol\n * - `2000-03-15T05:20:10.1234567`: Up to 7 digits in milliseconds field. Only first 3 are taken into account since JS does not allow fractional milliseconds\n * - `2000-03-15 05:20:10`: With a space instead of a 'T' separator for APIs returning a SQL date without reformatting\n *\n * For convenience and ease of use these other input types are also supported\n * via [toDate]{@link https://date-fns.org/docs/toDate}:\n *\n * - A `Date` instance will be cloned\n * - A `number` will be treated as a timestamp\n *\n * Any other input type or invalid date strings will return an `Invalid Date`.\n *\n * @param {String|Number|Date} argument A fully formed ISO8601 date string to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n */\nexport default function parseJSON(argument) {\n requiredArgs(1, arguments);\n if (typeof argument === 'string') {\n var parts = argument.match(/(\\d{4})-(\\d{2})-(\\d{2})[T ](\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d{0,7}))?(?:Z|(.)(\\d{2}):?(\\d{2})?)?/);\n if (parts) {\n // Group 8 matches the sign\n return new Date(Date.UTC(+parts[1], +parts[2] - 1, +parts[3], +parts[4] - (+parts[9] || 0) * (parts[8] == '-' ? -1 : 1), +parts[5] - (+parts[10] || 0) * (parts[8] == '-' ? -1 : 1), +parts[6], +((parts[7] || '0') + '00').substring(0, 3)));\n }\n return new Date(NaN);\n }\n return toDate(argument);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addDays from \"../addDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addWeeks\n * @category Week Helpers\n * @summary Add the specified number of weeks to the given date.\n *\n * @description\n * Add the specified number of week to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the weeks added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 4 weeks to 1 September 2014:\n * const result = addWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Sep 29 2014 00:00:00\n */\nexport default function addWeeks(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n var days = amount * 7;\n return addDays(dirtyDate, days);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} - the new date with the days added\n * @throws {TypeError} - 2 arguments required\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport default function addDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n if (!amount) {\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n date.setDate(date.getDate() + amount);\n return date;\n}","export default function requiredArgs(required, args) {\n if (args.length < required) {\n throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n }\n}","export default function toInteger(dirtyNumber) {\n if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n return NaN;\n }\n var number = Number(dirtyNumber);\n if (isNaN(number)) {\n return number;\n }\n return number < 0 ? Math.ceil(number) : Math.floor(number);\n}","import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @param {Date|Number} argument - the value to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport default function toDate(argument) {\n requiredArgs(1, arguments);\n var argStr = Object.prototype.toString.call(argument);\n\n // Clone the date\n if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n } else if (typeof argument === 'number' || argStr === '[object Number]') {\n return new Date(argument);\n } else {\n if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(\"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments\");\n // eslint-disable-next-line no-console\n console.warn(new Error().stack);\n }\n return new Date(NaN);\n }\n}","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };"],"names":["IdleScheduler","constructor","timeout","arguments","length","undefined","deadline","this","isScheduled","timeRemaining","didTimeout","pendingTasks","pop","performTask","schedule","task","unshift","requestIdleCallback","process","YouSeemInterestedPopup","lazyLoad","window","estately","data","is_csr","$","is","$popup","idler","constructHistory","trackVisit","cachedHistory","JSON","parse","localStorage","getItem","STORAGE_KEY","history","Object","fromEntries","entries","filter","_ref","_key","val","expiry","dirtyDate","requiredArgs","toDate","getTime","Date","now","isFuture","argument","parts","match","UTC","substring","NaN","parseJSON","entry","getEntry","visits","shown","dirtyAmount","date","amount","toInteger","isNaN","setDate","getDate","addDays","addWeeks","VISIT_THRESHOLD","setupLazyPopup","saveEntry","property","id","setItem","stringify","one","event","stopPropagation","attemptPopupDisplay","add","document","_YouSeemInterestedPopup","_defineProperty","modal","required","args","TypeError","dirtyNumber","number","Number","Math","ceil","floor","argStr","prototype","toString","call","console","warn","Error","stack","_typeof","o","Symbol","iterator"],"sourceRoot":""}