{"version":3,"file":"was_turbo_preview_controller-BGR0hBe_.js","sources":["../../../node_modules/@slideslive/fuse-kit/dist/utils/time/format_relative_time.js","../../../node_modules/@slideslive/fuse-kit/dist/utils/utilities/deep_transform_keys.js","../../../node_modules/@slideslive/fuse-kit/dist/utils/utilities/push_form_submission_to_data_layer.js","../../../node_modules/@slideslive/fuse-kit/dist/utils/utilities/push_page_view_to_data_layer.js","../../../node_modules/@slideslive/fuse-kit/dist/modules/relative_time/index.js","../../../app/frontend/fuse/javascript/blur_active_element_on_escape_controller.js","../../../app/frontend/fuse/javascript/choices_phone_country_code_controller.js","../../../app/frontend/fuse/javascript/container_size_controller.js","../../../app/frontend/fuse/javascript/download_content_controller.js","../../../app/frontend/fuse/javascript/extended_time_controller.js","../../../app/frontend/fuse/javascript/form_controller.js","../../../app/frontend/fuse/javascript/gtm_form_submission_controller.js","../../../app/frontend/fuse/javascript/gtm_page_view_controller.js","../../../app/frontend/fuse/javascript/modal_trigger_controller.js","../../../app/frontend/fuse/javascript/nested_form_controller.js","../../../app/frontend/fuse/javascript/relative_time_controller.js","../../../app/frontend/fuse/javascript/scroll_reveal_controller.js","../../../app/frontend/fuse/javascript/search_click_through_controller.js","../../../app/frontend/fuse/javascript/sortable_controller.js","../../../app/frontend/fuse/javascript/traffic_source_tracking_controller.js","../../../app/frontend/fuse/javascript/trigger_fields_controller.js","../../../app/frontend/fuse/javascript/was_turbo_preview_controller.js"],"sourcesContent":["const UNITS = [\n [\"year\", 24 * 60 * 60 * 1e3 * 365],\n [\"month\", 24 * 60 * 60 * 1e3 * 365 / 12],\n [\"day\", 24 * 60 * 60 * 1e3],\n [\"hour\", 60 * 60 * 1e3],\n [\"minute\", 60 * 1e3],\n [\"second\", 0]\n];\nfunction formatRelativeTime(value, { locale = \"en\", from = /* @__PURE__ */ new Date(), unit = \"second\", absolute = false, datetime = null }) {\n if (typeof Intl.RelativeTimeFormat === \"undefined\" || !Intl.RelativeTimeFormat) {\n if (!datetime) {\n return \"\";\n }\n const format = {\n day: \"numeric\",\n month: \"numeric\"\n };\n const now = /* @__PURE__ */ new Date();\n datetime = typeof datetime === \"string\" ? new Date(datetime) : datetime;\n if (now.getUTCFullYear() !== datetime.getUTCFullYear()) {\n format.year = \"numeric\";\n }\n const dtf = new Intl.DateTimeFormat(locale, format);\n return dtf.format(datetime);\n }\n const rtf = new Intl.RelativeTimeFormat(locale, {\n localeMatcher: \"lookup\",\n numeric: \"auto\"\n });\n if (!absolute) {\n value = typeof value === \"string\" ? new Date(value) : value;\n const elapsed = value - from;\n for (let i = 0; i < UNITS.length; i++) {\n const u = UNITS[i];\n if (Math.abs(elapsed) >= u[1] || u[0] === unit) {\n value = Math.round(elapsed / u[1]);\n unit = u[0];\n }\n }\n }\n return rtf.format(value, unit);\n}\nexport {\n formatRelativeTime as default\n};\n","import isObject from \"./is_object.js\";\nfunction deepTransformKeys(obj, fn) {\n if (Array.isArray(obj)) {\n return obj.map((val) => deepTransformKeys(val, fn));\n }\n if (isObject(obj)) {\n return Object.keys(obj).reduce((acc, current) => {\n const key = fn(current);\n const val = obj[current];\n acc[key] = val !== null && typeof val === \"object\" ? deepTransformKeys(val, fn) : val;\n return acc;\n }, {});\n }\n return obj;\n}\nexport {\n deepTransformKeys as default\n};\n","import pushDataLayer from \"./push_data_layer.js\";\nfunction pushFormSubmissionToDataLayer({ formName, ...rest }) {\n const formSubmission = {\n form_name: formName,\n ...rest\n };\n pushDataLayer({ event: \"form_submission\", ...formSubmission });\n}\nexport {\n pushFormSubmissionToDataLayer as default\n};\n","import toUnderscore from \"../string/to_underscore.js\";\nimport deepTransformKeys from \"./deep_transform_keys.js\";\nimport pushDataLayer from \"./push_data_layer.js\";\nfunction pushPageViewToDataLayer({ event = \"page_view\", type, title, path, location, ...rest }) {\n const page = {\n type,\n title,\n path,\n location,\n ...deepTransformKeys(rest, (key) => toUnderscore(key))\n };\n pushDataLayer({\n event,\n page\n });\n}\nexport {\n pushPageViewToDataLayer as default\n};\n","import formatRelativeTime from \"../../utils/time/format_relative_time.js\";\nclass RelativeTime {\n constructor(date, { locale = \"en\", precise = false, alwaysRelative = false, limitAhead = true, limitElapsed = true } = {}) {\n this.date = date;\n this.locale = locale;\n this.precise = precise;\n this.alwaysRelative = alwaysRelative;\n this.limitAhead = limitAhead;\n this.limitElapsed = limitElapsed;\n }\n toString() {\n const ago = this.timeElapsed();\n if (ago) {\n return ago;\n }\n const ahead = this.timeAhead();\n if (ahead) {\n return ahead;\n }\n return this.formatDate();\n }\n timeElapsed() {\n const ms = this.now.getTime() - this.date.getTime();\n const sec = Math.round(ms / 1e3);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n if (ms >= 0 && (!this.limitElapsed || day < 30)) {\n if (this.alwaysRelative) {\n return this.timeAgoFromMs(ms);\n }\n }\n return null;\n }\n timeAhead() {\n const ms = this.date.getTime() - this.now.getTime();\n const sec = Math.round(ms / 1e3);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n if (ms >= 0 && (!this.limitAhead || day < 30)) {\n if (this.alwaysRelative) {\n return this.timeUntil();\n }\n }\n return null;\n }\n timeAgo() {\n const ms = this.now.getTime() - this.date.getTime();\n return this.timeAgoFromMs(ms);\n }\n timeAgoFromMs(ms) {\n const sec = Math.round(ms / 1e3);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n let value;\n let unit;\n if (sec < 60) {\n if (this.precise) {\n value = -sec;\n unit = \"second\";\n } else {\n value = 0;\n unit = \"minute\";\n }\n } else if (min < 45) {\n value = -min;\n unit = \"minute\";\n } else if (min < 90) {\n value = -hr;\n unit = \"hour\";\n } else if (hr < 24) {\n value = -hr;\n unit = \"hour\";\n } else if (hr < 36) {\n value = -day;\n unit = \"day\";\n } else if (day < 30) {\n value = -day;\n unit = \"day\";\n } else if (month < 18) {\n value = -month;\n unit = \"month\";\n } else {\n value = -year;\n unit = \"year\";\n }\n return formatRelativeTime(value, {\n locale: this.locale,\n unit,\n absolute: true,\n datetime: this.date\n });\n }\n microTimeAgo() {\n const ms = this.now.getTime() - this.date.getTime();\n const sec = Math.round(ms / 1e3);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n if (min < 1) {\n return \"1m\";\n }\n if (min < 60) {\n return `${min}m`;\n }\n if (hr < 24) {\n return `${hr}h`;\n }\n if (day < 365) {\n return `${day}d`;\n }\n return `${year}y`;\n }\n timeUntil() {\n const ms = this.date.getTime() - this.now.getTime();\n return this.timeUntilFromMs(ms);\n }\n timeUntilFromMs(ms) {\n const sec = Math.round(ms / 1e3);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n let value;\n let unit;\n if (month >= 18) {\n value = year;\n unit = \"year\";\n } else if (month >= 12) {\n value = year;\n unit = \"year\";\n } else if (day >= 45) {\n value = month;\n unit = \"month\";\n } else if (day >= 30) {\n value = month;\n unit = \"month\";\n } else if (hr >= 36) {\n value = day;\n unit = \"day\";\n } else if (hr >= 24) {\n value = day;\n unit = \"day\";\n } else if (min >= 90) {\n value = hr;\n unit = \"hour\";\n } else if (min >= 45) {\n value = hr;\n unit = \"hour\";\n } else if (sec >= 60) {\n value = min;\n unit = \"minute\";\n } else {\n value = 0;\n unit = \"minute\";\n }\n return formatRelativeTime(value, {\n locale: this.locale,\n unit,\n absolute: true\n });\n }\n microTimeUntil() {\n const ms = this.date.getTime() - this.now.getTime();\n const sec = Math.round(ms / 1e3);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n if (day >= 365) {\n return `${year}y`;\n }\n if (hr >= 24) {\n return `${day}d`;\n }\n if (min >= 60) {\n return `${hr}h`;\n }\n if (min > 1) {\n return `${min}m`;\n }\n return \"1m\";\n }\n formatDate() {\n const format = {\n day: \"numeric\",\n month: \"numeric\"\n };\n if (this.now.getUTCFullYear() !== this.date.getUTCFullYear()) {\n format.year = \"numeric\";\n }\n const dtf = new Intl.DateTimeFormat(this.locale, format);\n return dtf.format(this.date);\n }\n get now() {\n return /* @__PURE__ */ new Date();\n }\n}\nexport {\n RelativeTime as default\n};\n","import ApplicationController from 'modules/application_controller';\n\nexport default class extends ApplicationController {\n blurActiveElement(event) {\n const { key, ctrlKey, metaKey, shiftKey } = event;\n\n if (key !== 'Escape' || ctrlKey || metaKey || shiftKey) return;\n if (!document.activeElement || (document.activeElement.tabIndex < 0 && !document.activeElement.isContentEditable)) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n\n document.activeElement.blur();\n }\n}\n","import ChoicesAutocompleteController from '@/fuse/javascript/choices_autocomplete_controller';\nimport Choices from 'choices.js';\nimport 'flag-icons/css/flag-icons.css';\n\nexport default class extends ChoicesAutocompleteController {\n renderChoice(templateOptions, data, itemSelectText) {\n let content = data.label;\n\n if (data.customProperties.country_char_code) {\n content = `\n \n ${data.label}\n \n +${data.value}\n \n `;\n }\n\n const element = Choices.defaults.templates.choice(templateOptions, data, itemSelectText);\n element.classList.add('tw-flex', 'tw-items-center');\n element.innerHTML = content;\n\n return element;\n }\n\n setCountryCode(code) {\n this.choices.setChoiceByValue(code);\n }\n\n get value() {\n return this.choices.getValue();\n }\n\n get createTemplates() {\n return {\n dropdown(...args) {\n return Object.assign(Choices.defaults.templates.choiceList.call(this, ...args), {\n classList: `${args[0].classNames.listDropdown} tw-min-w-72`,\n });\n },\n item(templateOptions, data) {\n if (data.customProperties.country_char_code) {\n data.label = `+${data.value}`;\n }\n\n return Choices.defaults.templates.item(templateOptions, data, false);\n },\n choice: this.renderChoice.bind(this),\n };\n }\n\n get showSelectedValuesInDropdown() {\n return false;\n }\n}\n","import ApplicationController from 'modules/application_controller';\n\nexport default class extends ApplicationController {\n static get values() {\n return {\n breakpoints: {\n type: Object,\n default: {\n xs: 320,\n sm: 384,\n md: 448,\n lg: 512,\n xl: 576,\n '2xl': 672,\n '3xl': 768,\n '4xl': 896,\n '5xl': 1024,\n '6xl': 1152,\n '7xl': 1280,\n },\n },\n };\n }\n\n initialize() {\n this.resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n this.updateBreakpointClasses(entry.contentRect.width);\n }\n });\n }\n\n connect() {\n this.resizeObserver.observe(this.element);\n }\n\n disconnect() {\n this.resizeObserver.disconnect();\n }\n\n updateBreakpointClasses(width) {\n const breakpointKeys = Object.keys(this.breakpointsValue).sort(\n (a, b) => this.breakpointsValue[b] - this.breakpointsValue[a],\n );\n\n for (const key of breakpointKeys) {\n if (width < this.breakpointsValue[key]) {\n this.element.classList.remove(key);\n\n continue;\n }\n\n this.element.classList.add(key);\n }\n }\n}\n","import ApplicationController from 'modules/application_controller';\n\nexport default class extends ApplicationController {\n static get targets() {\n return ['content'];\n }\n\n download(event) {\n event.preventDefault();\n\n const link = document.createElement('a');\n link.href = `data:text/plain;charset=utf-8,${encodeURIComponent(this.content)}`;\n link.download = this.fileNameFromEvent(event);\n\n link.click();\n }\n\n fileNameFromEvent(event) {\n return event.target.dataset.downloadContentName || 'content.txt';\n }\n\n get content() {\n return this.contentTarget.textContent;\n }\n}\n","import ApplicationController from 'modules/application_controller';\nimport stimulus, { FUSE_TOOLTIP_CONTROLLER } from 'plugins/stimulus';\n\nexport default class extends ApplicationController {\n static values = {\n locale: {\n type: String,\n default: null,\n },\n datetime: {\n type: String,\n default: null,\n },\n titleFormat: {\n type: Object,\n default: {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short',\n },\n },\n };\n\n initialize() {\n this.parsedDatetime = null;\n }\n\n connect() {\n this.parseDatetimeValue();\n this.setTitle();\n }\n\n localeValueChanged() {\n this.setTitle();\n }\n\n datetimeValueChanged() {\n this.parseDatetimeValue();\n this.setTitle();\n }\n\n titleFormatValueChanged() {\n this.setTitle();\n }\n\n parseDatetimeValue() {\n this.parsedDatetime = this.datetimeValue ? new Date(this.datetimeValue) : null;\n }\n\n setTitle() {\n if (!stimulus.hasTarget(this.element, { [FUSE_TOOLTIP_CONTROLLER]: 'item' })) return;\n\n const title = this.formattedTitle;\n\n this.element.setAttribute('title', title);\n }\n\n get formattedTitle() {\n if (!this.parsedDatetime) return '';\n\n const dtf = new Intl.DateTimeFormat(this.localeValue, this.titleFormatValue);\n\n return dtf.format(this.parsedDatetime);\n }\n}\n","import ApplicationController from 'modules/application_controller';\n\nconst INTERCEPT_REJECT_ERROR = 'fuse:intercept-promise-reject';\nconst EVENT_NAMES = {\n VALIDATE: 'validate',\n BEFORE_SUBMIT: 'before-submit',\n SUBMIT_START: 'submit-start',\n BEFORE_SUBMIT_REQUEST: 'before-submit-request',\n SUBMIT_PREVENTED: 'submit-prevented',\n SUBMIT_END: 'submit-end',\n SUBMIT_END_SUCCESS: 'submit-end-success',\n SUBMIT_END_FAIL: 'submit-end-fail',\n};\nconst FORM_FIELDS_STIMULUS_CONTROLLER_PREFIX = 'fuse--form';\n\nexport default class extends ApplicationController {\n static targets = ['errorNotice', 'errorNoticeText', 'errorNoticeFieldLinkTemplate'];\n\n static values = {\n defaultErrorMessage: {\n type: String,\n default: 'Check the field.',\n },\n defaultFieldLabel: {\n type: String,\n default: 'Field',\n },\n };\n\n initialize() {\n this.fields = new Map();\n this.errors = new Set();\n this.delayedResultId = null;\n }\n\n // Form Reset\n reset() {\n this.element.reset();\n }\n\n // Error Notice Management\n toggleErrorNotice(hidden = false) {\n if (!this.hasErrorNoticeTarget || !this.hasErrorNoticeTextTarget) return;\n\n if (hidden) {\n this._clearErrorNotice();\n\n return;\n }\n\n const errorItems = this._generateErrorItems();\n\n this._displayErrorNotice(errorItems);\n }\n\n _clearErrorNotice() {\n this.errorNoticeTextTarget.textContent = '';\n this.errorNoticeTarget.hidden = true;\n }\n\n _generateErrorItems() {\n return Array.from(this.errors)\n .map((error) => {\n const field = this.fields.get(error);\n if (!field) return null;\n\n const label = this._getFieldLabel(field, error);\n const message = this._getFieldMessage(field);\n return `