{
"version": 3,
"sources": ["../../../../node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js", "../../../../node_modules/events/events.js", "../../../../node_modules/fg-loadjs/loadJS.js", "../../../../node_modules/@iconfu/svg-inject/dist/svg-inject.js", "../../../../node_modules/@carwow/dead_end/lib/app.js", "../../../../node_modules/intersection-observer/intersection-observer.js", "../../../javascript/shared/common.js", "../../../../node_modules/@carwow/carwow_theme/app/javascript/elm_google_translate.js", "../../../../node_modules/@ungap/custom-elements/index.js", "../../../../node_modules/@carwow/carwow_theme/app/javascript/components/header.js", "../../../../node_modules/@carwow/carwow_theme/app/javascript/event_bus.js", "../../../../node_modules/@carwow/carwow_theme/app/javascript/components/remote_content.js", "../../../../node_modules/@carwow/carwow_theme/app/javascript/components/lazy_svg_sprite.js", "../../../../node_modules/body-scroll-lock/lib/bodyScrollLock.esm.js", "../../../../node_modules/@carwow/carwow_theme/app/javascript/components/modal.js", "../../../../node_modules/@carwow/carwow_theme/app/javascript/theme_common.js", "../../../../node_modules/@carwow/carwow_theme/app/javascript/doc_cookies.js", "../../../javascript/shared/referrer_tracking.js", "../../../javascript/shared/lazy_srcset.js", "../../../../node_modules/@carwow/carwow_theme/app/javascript/dead_end.js", "../../../javascript/pages/errors/page_not_found.js"],
"sourcesContent": ["/*\nUnobtrusive JavaScript\nhttps://github.com/rails/rails/blob/main/actionview/app/assets/javascripts\nReleased under the MIT license\n */;\n\n(function() {\n var context = this;\n\n (function() {\n (function() {\n this.Rails = {\n linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',\n buttonClickSelector: {\n selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',\n exclude: 'form button'\n },\n inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',\n formSubmitSelector: 'form:not([data-turbo=true])',\n formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',\n formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',\n formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',\n fileInputSelector: 'input[name][type=file]:not([disabled])',\n linkDisableSelector: 'a[data-disable-with], a[data-disable]',\n buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'\n };\n\n }).call(this);\n }).call(context);\n\n var Rails = context.Rails;\n\n (function() {\n (function() {\n var nonce;\n\n nonce = null;\n\n Rails.loadCSPNonce = function() {\n var ref;\n return nonce = (ref = document.querySelector(\"meta[name=csp-nonce]\")) != null ? ref.content : void 0;\n };\n\n Rails.cspNonce = function() {\n return nonce != null ? nonce : Rails.loadCSPNonce();\n };\n\n }).call(this);\n (function() {\n var expando, m;\n\n m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n\n Rails.matches = function(element, selector) {\n if (selector.exclude != null) {\n return m.call(element, selector.selector) && !m.call(element, selector.exclude);\n } else {\n return m.call(element, selector);\n }\n };\n\n expando = '_ujsData';\n\n Rails.getData = function(element, key) {\n var ref;\n return (ref = element[expando]) != null ? ref[key] : void 0;\n };\n\n Rails.setData = function(element, key, value) {\n if (element[expando] == null) {\n element[expando] = {};\n }\n return element[expando][key] = value;\n };\n\n Rails.isContentEditable = function(element) {\n var isEditable;\n isEditable = false;\n while (true) {\n if (element.isContentEditable) {\n isEditable = true;\n break;\n }\n element = element.parentElement;\n if (!element) {\n break;\n }\n }\n return isEditable;\n };\n\n Rails.$ = function(selector) {\n return Array.prototype.slice.call(document.querySelectorAll(selector));\n };\n\n }).call(this);\n (function() {\n var $, csrfParam, csrfToken;\n\n $ = Rails.$;\n\n csrfToken = Rails.csrfToken = function() {\n var meta;\n meta = document.querySelector('meta[name=csrf-token]');\n return meta && meta.content;\n };\n\n csrfParam = Rails.csrfParam = function() {\n var meta;\n meta = document.querySelector('meta[name=csrf-param]');\n return meta && meta.content;\n };\n\n Rails.CSRFProtection = function(xhr) {\n var token;\n token = csrfToken();\n if (token != null) {\n return xhr.setRequestHeader('X-CSRF-Token', token);\n }\n };\n\n Rails.refreshCSRFTokens = function() {\n var param, token;\n token = csrfToken();\n param = csrfParam();\n if ((token != null) && (param != null)) {\n return $('form input[name=\"' + param + '\"]').forEach(function(input) {\n return input.value = token;\n });\n }\n };\n\n }).call(this);\n (function() {\n var CustomEvent, fire, matches, preventDefault;\n\n matches = Rails.matches;\n\n CustomEvent = window.CustomEvent;\n\n if (typeof CustomEvent !== 'function') {\n CustomEvent = function(event, params) {\n var evt;\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n CustomEvent.prototype = window.Event.prototype;\n preventDefault = CustomEvent.prototype.preventDefault;\n CustomEvent.prototype.preventDefault = function() {\n var result;\n result = preventDefault.call(this);\n if (this.cancelable && !this.defaultPrevented) {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function() {\n return true;\n }\n });\n }\n return result;\n };\n }\n\n fire = Rails.fire = function(obj, name, data) {\n var event;\n event = new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail: data\n });\n obj.dispatchEvent(event);\n return !event.defaultPrevented;\n };\n\n Rails.stopEverything = function(e) {\n fire(e.target, 'ujs:everythingStopped');\n e.preventDefault();\n e.stopPropagation();\n return e.stopImmediatePropagation();\n };\n\n Rails.delegate = function(element, selector, eventType, handler) {\n return element.addEventListener(eventType, function(e) {\n var target;\n target = e.target;\n while (!(!(target instanceof Element) || matches(target, selector))) {\n target = target.parentNode;\n }\n if (target instanceof Element && handler.call(target, e) === false) {\n e.preventDefault();\n return e.stopPropagation();\n }\n });\n };\n\n }).call(this);\n (function() {\n var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;\n\n cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;\n\n AcceptHeaders = {\n '*': '*/*',\n text: 'text/plain',\n html: 'text/html',\n xml: 'application/xml, text/xml',\n json: 'application/json, text/javascript',\n script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'\n };\n\n Rails.ajax = function(options) {\n var xhr;\n options = prepareOptions(options);\n xhr = createXHR(options, function() {\n var ref, response;\n response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));\n if (Math.floor(xhr.status / 100) === 2) {\n if (typeof options.success === \"function\") {\n options.success(response, xhr.statusText, xhr);\n }\n } else {\n if (typeof options.error === \"function\") {\n options.error(response, xhr.statusText, xhr);\n }\n }\n return typeof options.complete === \"function\" ? options.complete(xhr, xhr.statusText) : void 0;\n });\n if ((options.beforeSend != null) && !options.beforeSend(xhr, options)) {\n return false;\n }\n if (xhr.readyState === XMLHttpRequest.OPENED) {\n return xhr.send(options.data);\n }\n };\n\n prepareOptions = function(options) {\n options.url = options.url || location.href;\n options.type = options.type.toUpperCase();\n if (options.type === 'GET' && options.data) {\n if (options.url.indexOf('?') < 0) {\n options.url += '?' + options.data;\n } else {\n options.url += '&' + options.data;\n }\n }\n if (AcceptHeaders[options.dataType] == null) {\n options.dataType = '*';\n }\n options.accept = AcceptHeaders[options.dataType];\n if (options.dataType !== '*') {\n options.accept += ', */*; q=0.01';\n }\n return options;\n };\n\n createXHR = function(options, done) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.open(options.type, options.url, true);\n xhr.setRequestHeader('Accept', options.accept);\n if (typeof options.data === 'string') {\n xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n }\n if (!options.crossDomain) {\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n CSRFProtection(xhr);\n }\n xhr.withCredentials = !!options.withCredentials;\n xhr.onreadystatechange = function() {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n return done(xhr);\n }\n };\n return xhr;\n };\n\n processResponse = function(response, type) {\n var parser, script;\n if (typeof response === 'string' && typeof type === 'string') {\n if (type.match(/\\bjson\\b/)) {\n try {\n response = JSON.parse(response);\n } catch (error) {}\n } else if (type.match(/\\b(?:java|ecma)script\\b/)) {\n script = document.createElement('script');\n script.setAttribute('nonce', cspNonce());\n script.text = response;\n document.head.appendChild(script).parentNode.removeChild(script);\n } else if (type.match(/\\b(xml|html|svg)\\b/)) {\n parser = new DOMParser();\n type = type.replace(/;.+/, '');\n try {\n response = parser.parseFromString(response, type);\n } catch (error) {}\n }\n }\n return response;\n };\n\n Rails.href = function(element) {\n return element.href;\n };\n\n Rails.isCrossDomain = function(url) {\n var e, originAnchor, urlAnchor;\n originAnchor = document.createElement('a');\n originAnchor.href = location.href;\n urlAnchor = document.createElement('a');\n try {\n urlAnchor.href = url;\n return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host));\n } catch (error) {\n e = error;\n return true;\n }\n };\n\n }).call(this);\n (function() {\n var matches, toArray;\n\n matches = Rails.matches;\n\n toArray = function(e) {\n return Array.prototype.slice.call(e);\n };\n\n Rails.serializeElement = function(element, additionalParam) {\n var inputs, params;\n inputs = [element];\n if (matches(element, 'form')) {\n inputs = toArray(element.elements);\n }\n params = [];\n inputs.forEach(function(input) {\n if (!input.name || input.disabled) {\n return;\n }\n if (matches(input, 'fieldset[disabled] *')) {\n return;\n }\n if (matches(input, 'select')) {\n return toArray(input.options).forEach(function(option) {\n if (option.selected) {\n return params.push({\n name: input.name,\n value: option.value\n });\n }\n });\n } else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {\n return params.push({\n name: input.name,\n value: input.value\n });\n }\n });\n if (additionalParam) {\n params.push(additionalParam);\n }\n return params.map(function(param) {\n if (param.name != null) {\n return (encodeURIComponent(param.name)) + \"=\" + (encodeURIComponent(param.value));\n } else {\n return param;\n }\n }).join('&');\n };\n\n Rails.formElements = function(form, selector) {\n if (matches(form, 'form')) {\n return toArray(form.elements).filter(function(el) {\n return matches(el, selector);\n });\n } else {\n return toArray(form.querySelectorAll(selector));\n }\n };\n\n }).call(this);\n (function() {\n var allowAction, fire, stopEverything;\n\n fire = Rails.fire, stopEverything = Rails.stopEverything;\n\n Rails.handleConfirm = function(e) {\n if (!allowAction(this)) {\n return stopEverything(e);\n }\n };\n\n Rails.confirm = function(message, element) {\n return confirm(message);\n };\n\n allowAction = function(element) {\n var answer, callback, message;\n message = element.getAttribute('data-confirm');\n if (!message) {\n return true;\n }\n answer = false;\n if (fire(element, 'confirm')) {\n try {\n answer = Rails.confirm(message, element);\n } catch (error) {}\n callback = fire(element, 'confirm:complete', [answer]);\n }\n return answer && callback;\n };\n\n }).call(this);\n (function() {\n var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isContentEditable, isXhrRedirect, matches, setData, stopEverything;\n\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements, isContentEditable = Rails.isContentEditable;\n\n Rails.handleDisabledElement = function(e) {\n var element;\n element = this;\n if (element.disabled) {\n return stopEverything(e);\n }\n };\n\n Rails.enableElement = function(e) {\n var element;\n if (e instanceof Event) {\n if (isXhrRedirect(e)) {\n return;\n }\n element = e.target;\n } else {\n element = e;\n }\n if (isContentEditable(element)) {\n return;\n }\n if (matches(element, Rails.linkDisableSelector)) {\n return enableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {\n return enableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return enableFormElements(element);\n }\n };\n\n Rails.disableElement = function(e) {\n var element;\n element = e instanceof Event ? e.target : e;\n if (isContentEditable(element)) {\n return;\n }\n if (matches(element, Rails.linkDisableSelector)) {\n return disableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {\n return disableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return disableFormElements(element);\n }\n };\n\n disableLinkElement = function(element) {\n var replacement;\n if (getData(element, 'ujs:disabled')) {\n return;\n }\n replacement = element.getAttribute('data-disable-with');\n if (replacement != null) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n }\n element.addEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', true);\n };\n\n enableLinkElement = function(element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n if (originalText != null) {\n element.innerHTML = originalText;\n setData(element, 'ujs:enable-with', null);\n }\n element.removeEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', null);\n };\n\n disableFormElements = function(form) {\n return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);\n };\n\n disableFormElement = function(element) {\n var replacement;\n if (getData(element, 'ujs:disabled')) {\n return;\n }\n replacement = element.getAttribute('data-disable-with');\n if (replacement != null) {\n if (matches(element, 'button')) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n } else {\n setData(element, 'ujs:enable-with', element.value);\n element.value = replacement;\n }\n }\n element.disabled = true;\n return setData(element, 'ujs:disabled', true);\n };\n\n enableFormElements = function(form) {\n return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);\n };\n\n enableFormElement = function(element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n if (originalText != null) {\n if (matches(element, 'button')) {\n element.innerHTML = originalText;\n } else {\n element.value = originalText;\n }\n setData(element, 'ujs:enable-with', null);\n }\n element.disabled = false;\n return setData(element, 'ujs:disabled', null);\n };\n\n isXhrRedirect = function(event) {\n var ref, xhr;\n xhr = (ref = event.detail) != null ? ref[0] : void 0;\n return (xhr != null ? xhr.getResponseHeader(\"X-Xhr-Redirect\") : void 0) != null;\n };\n\n }).call(this);\n (function() {\n var isContentEditable, stopEverything;\n\n stopEverything = Rails.stopEverything;\n\n isContentEditable = Rails.isContentEditable;\n\n Rails.handleMethod = function(e) {\n var csrfParam, csrfToken, form, formContent, href, link, method;\n link = this;\n method = link.getAttribute('data-method');\n if (!method) {\n return;\n }\n if (isContentEditable(this)) {\n return;\n }\n href = Rails.href(link);\n csrfToken = Rails.csrfToken();\n csrfParam = Rails.csrfParam();\n form = document.createElement('form');\n formContent = \"\";\n if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) {\n formContent += \"\";\n }\n formContent += '';\n form.method = 'post';\n form.action = href;\n form.target = link.target;\n form.innerHTML = formContent;\n form.style.display = 'none';\n document.body.appendChild(form);\n form.querySelector('[type=\"submit\"]').click();\n return stopEverything(e);\n };\n\n }).call(this);\n (function() {\n var ajax, fire, getData, isContentEditable, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,\n slice = [].slice;\n\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement, isContentEditable = Rails.isContentEditable;\n\n isRemote = function(element) {\n var value;\n value = element.getAttribute('data-remote');\n return (value != null) && value !== 'false';\n };\n\n Rails.handleRemote = function(e) {\n var button, data, dataType, element, method, url, withCredentials;\n element = this;\n if (!isRemote(element)) {\n return true;\n }\n if (!fire(element, 'ajax:before')) {\n fire(element, 'ajax:stopped');\n return false;\n }\n if (isContentEditable(element)) {\n fire(element, 'ajax:stopped');\n return false;\n }\n withCredentials = element.getAttribute('data-with-credentials');\n dataType = element.getAttribute('data-type') || 'script';\n if (matches(element, Rails.formSubmitSelector)) {\n button = getData(element, 'ujs:submit-button');\n method = getData(element, 'ujs:submit-button-formmethod') || element.method;\n url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;\n if (method.toUpperCase() === 'GET') {\n url = url.replace(/\\?.*$/, '');\n }\n if (element.enctype === 'multipart/form-data') {\n data = new FormData(element);\n if (button != null) {\n data.append(button.name, button.value);\n }\n } else {\n data = serializeElement(element, button);\n }\n setData(element, 'ujs:submit-button', null);\n setData(element, 'ujs:submit-button-formmethod', null);\n setData(element, 'ujs:submit-button-formaction', null);\n } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {\n method = element.getAttribute('data-method');\n url = element.getAttribute('data-url');\n data = serializeElement(element, element.getAttribute('data-params'));\n } else {\n method = element.getAttribute('data-method');\n url = Rails.href(element);\n data = element.getAttribute('data-params');\n }\n ajax({\n type: method || 'GET',\n url: url,\n data: data,\n dataType: dataType,\n beforeSend: function(xhr, options) {\n if (fire(element, 'ajax:beforeSend', [xhr, options])) {\n return fire(element, 'ajax:send', [xhr]);\n } else {\n fire(element, 'ajax:stopped');\n return false;\n }\n },\n success: function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:success', args);\n },\n error: function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:error', args);\n },\n complete: function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:complete', args);\n },\n crossDomain: isCrossDomain(url),\n withCredentials: (withCredentials != null) && withCredentials !== 'false'\n });\n return stopEverything(e);\n };\n\n Rails.formSubmitButtonClick = function(e) {\n var button, form;\n button = this;\n form = button.form;\n if (!form) {\n return;\n }\n if (button.name) {\n setData(form, 'ujs:submit-button', {\n name: button.name,\n value: button.value\n });\n }\n setData(form, 'ujs:formnovalidate-button', button.formNoValidate);\n setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));\n return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));\n };\n\n Rails.preventInsignificantClick = function(e) {\n var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;\n link = this;\n method = (link.getAttribute('data-method') || 'GET').toUpperCase();\n data = link.getAttribute('data-params');\n metaClick = e.metaKey || e.ctrlKey;\n insignificantMetaClick = metaClick && method === 'GET' && !data;\n nonPrimaryMouseClick = (e.button != null) && e.button !== 0;\n if (nonPrimaryMouseClick || insignificantMetaClick) {\n return e.stopImmediatePropagation();\n }\n };\n\n }).call(this);\n (function() {\n var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;\n\n fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;\n\n if ((typeof jQuery !== \"undefined\" && jQuery !== null) && (jQuery.ajax != null)) {\n if (jQuery.rails) {\n throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');\n }\n jQuery.rails = Rails;\n jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {\n if (!options.crossDomain) {\n return CSRFProtection(xhr);\n }\n });\n }\n\n Rails.start = function() {\n if (window._rails_loaded) {\n throw new Error('rails-ujs has already been loaded!');\n }\n window.addEventListener('pageshow', function() {\n $(Rails.formEnableSelector).forEach(function(el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n return $(Rails.linkDisableSelector).forEach(function(el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n });\n delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.linkClickSelector, 'click', handleConfirm);\n delegate(document, Rails.linkClickSelector, 'click', disableElement);\n delegate(document, Rails.linkClickSelector, 'click', handleRemote);\n delegate(document, Rails.linkClickSelector, 'click', handleMethod);\n delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);\n delegate(document, Rails.buttonClickSelector, 'click', disableElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleRemote);\n delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);\n delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);\n delegate(document, Rails.inputChangeSelector, 'change', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);\n delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);\n delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', function(e) {\n return setTimeout((function() {\n return disableElement(e);\n }), 13);\n });\n delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);\n delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);\n delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);\n document.addEventListener('DOMContentLoaded', refreshCSRFTokens);\n document.addEventListener('DOMContentLoaded', loadCSPNonce);\n return window._rails_loaded = true;\n };\n\n if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {\n Rails.start();\n }\n\n }).call(this);\n }).call(this);\n\n if (typeof module === \"object\" && module.exports) {\n module.exports = Rails;\n } else if (typeof define === \"function\" && define.amd) {\n define(Rails);\n }\n}).call(this);\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n", "/*! loadJS: load a JS file asynchronously. [c]2014 @scottjehl, Filament Group, Inc. (Based on http://goo.gl/REQGQ by Paul Irish). Licensed MIT */\n(function( w ){\n\tvar loadJS = function( src, cb, ordered ){\n\t\t\"use strict\";\n\t\tvar tmp;\n\t\tvar ref = w.document.getElementsByTagName( \"script\" )[ 0 ];\n\t\tvar script = w.document.createElement( \"script\" );\n\n\t\tif (typeof(cb) === 'boolean') {\n\t\t\ttmp = ordered;\n\t\t\tordered = cb;\n\t\t\tcb = tmp;\n\t\t}\n\n\t\tscript.src = src;\n\t\tscript.async = !ordered;\n\t\tref.parentNode.insertBefore( script, ref );\n\n\t\tif (cb && typeof(cb) === \"function\") {\n\t\t\tscript.onload = cb;\n\t\t}\n\t\treturn script;\n\t};\n\t// commonjs\n\tif( typeof module !== \"undefined\" ){\n\t\tmodule.exports = loadJS;\n\t}\n\telse {\n\t\tw.loadJS = loadJS;\n\t}\n}( typeof global !== \"undefined\" ? global : this ));\n", "/**\n * SVGInject - Version 1.2.3\n * A tiny, intuitive, robust, caching solution for injecting SVG files inline into the DOM.\n *\n * https://github.com/iconfu/svg-inject\n *\n * Copyright (c) 2018 INCORS, the creators of iconfu.com\n * @license MIT License - https://github.com/iconfu/svg-inject/blob/master/LICENSE\n */\n\n(function(window, document) {\n // constants for better minification\n var _CREATE_ELEMENT_ = 'createElement';\n var _GET_ELEMENTS_BY_TAG_NAME_ = 'getElementsByTagName';\n var _LENGTH_ = 'length';\n var _STYLE_ = 'style';\n var _TITLE_ = 'title';\n var _UNDEFINED_ = 'undefined';\n var _SET_ATTRIBUTE_ = 'setAttribute';\n var _GET_ATTRIBUTE_ = 'getAttribute';\n\n var NULL = null;\n\n // constants\n var __SVGINJECT = '__svgInject';\n var ID_SUFFIX = '--inject-';\n var ID_SUFFIX_REGEX = new RegExp(ID_SUFFIX + '\\\\d+', \"g\");\n var LOAD_FAIL = 'LOAD_FAIL';\n var SVG_NOT_SUPPORTED = 'SVG_NOT_SUPPORTED';\n var SVG_INVALID = 'SVG_INVALID';\n var ATTRIBUTE_EXCLUSION_NAMES = ['src', 'alt', 'onload', 'onerror'];\n var A_ELEMENT = document[_CREATE_ELEMENT_]('a');\n var IS_SVG_SUPPORTED = typeof SVGRect != _UNDEFINED_;\n var DEFAULT_OPTIONS = {\n useCache: true,\n copyAttributes: true,\n makeIdsUnique: true\n };\n // Map of IRI referenceable tag names to properties that can reference them. This is defined in\n // https://www.w3.org/TR/SVG11/linking.html#processingIRI\n var IRI_TAG_PROPERTIES_MAP = {\n clipPath: ['clip-path'],\n 'color-profile': NULL,\n cursor: NULL,\n filter: NULL,\n linearGradient: ['fill', 'stroke'],\n marker: ['marker', 'marker-end', 'marker-mid', 'marker-start'],\n mask: NULL,\n pattern: ['fill', 'stroke'],\n radialGradient: ['fill', 'stroke']\n };\n var INJECTED = 1;\n var FAIL = 2;\n\n var uniqueIdCounter = 1;\n var xmlSerializer;\n var domParser;\n\n\n // creates an SVG document from an SVG string\n function svgStringToSvgDoc(svgStr) {\n domParser = domParser || new DOMParser();\n return domParser.parseFromString(svgStr, 'text/xml');\n }\n\n\n // searializes an SVG element to an SVG string\n function svgElemToSvgString(svgElement) {\n xmlSerializer = xmlSerializer || new XMLSerializer();\n return xmlSerializer.serializeToString(svgElement);\n }\n\n\n // Returns the absolute url for the specified url\n function getAbsoluteUrl(url) {\n A_ELEMENT.href = url;\n return A_ELEMENT.href;\n }\n\n\n // Load svg with an XHR request\n function loadSvg(url, callback, errorCallback) {\n if (url) {\n var req = new XMLHttpRequest();\n req.onreadystatechange = function() {\n if (req.readyState == 4) {\n // readyState is DONE\n var status = req.status;\n if (status == 200) {\n // request status is OK\n callback(req.responseXML, req.responseText.trim());\n } else if (status >= 400) {\n // request status is error (4xx or 5xx)\n errorCallback();\n } else if (status == 0) {\n // request status 0 can indicate a failed cross-domain call\n errorCallback();\n }\n }\n };\n req.open('GET', url, true);\n req.send();\n }\n }\n\n\n // Copy attributes from img element to svg element\n function copyAttributes(imgElem, svgElem) {\n var attribute;\n var attributeName;\n var attributeValue;\n var attributes = imgElem.attributes;\n for (var i = 0; i < attributes[_LENGTH_]; i++) {\n attribute = attributes[i];\n attributeName = attribute.name;\n // Only copy attributes not explicitly excluded from copying\n if (ATTRIBUTE_EXCLUSION_NAMES.indexOf(attributeName) == -1) {\n attributeValue = attribute.value;\n // If img attribute is \"title\", insert a title element into SVG element\n if (attributeName == _TITLE_) {\n var titleElem;\n var firstElementChild = svgElem.firstElementChild;\n if (firstElementChild && firstElementChild.localName.toLowerCase() == _TITLE_) {\n // If the SVG element's first child is a title element, keep it as the title element\n titleElem = firstElementChild;\n } else {\n // If the SVG element's first child element is not a title element, create a new title\n // ele,emt and set it as the first child\n titleElem = document[_CREATE_ELEMENT_ + 'NS']('http://www.w3.org/2000/svg', _TITLE_);\n svgElem.insertBefore(titleElem, firstElementChild);\n }\n // Set new title content\n titleElem.textContent = attributeValue;\n } else {\n // Set img attribute to svg element\n svgElem[_SET_ATTRIBUTE_](attributeName, attributeValue);\n }\n }\n }\n }\n\n\n // This function appends a suffix to IDs of referenced elements in the in order to to avoid ID collision\n // between multiple injected SVGs. The suffix has the form \"--inject-X\", where X is a running number which is\n // incremented with each injection. References to the IDs are adjusted accordingly.\n // We assume tha all IDs within the injected SVG are unique, therefore the same suffix can be used for all IDs of one\n // injected SVG.\n // If the onlyReferenced argument is set to true, only those IDs will be made unique that are referenced from within the SVG\n function makeIdsUnique(svgElem, onlyReferenced) {\n var idSuffix = ID_SUFFIX + uniqueIdCounter++;\n // Regular expression for functional notations of an IRI references. This will find occurences in the form\n // url(#anyId) or url(\"#anyId\") (for Internet Explorer) and capture the referenced ID\n var funcIriRegex = /url\\(\"?#([a-zA-Z][\\w:.-]*)\"?\\)/g;\n // Get all elements with an ID. The SVG spec recommends to put referenced elements inside elements, but\n // this is not a requirement, therefore we have to search for IDs in the whole SVG.\n var idElements = svgElem.querySelectorAll('[id]');\n var idElem;\n // An object containing referenced IDs as keys is used if only referenced IDs should be uniquified.\n // If this object does not exist, all IDs will be uniquified.\n var referencedIds = onlyReferenced ? [] : NULL;\n var tagName;\n var iriTagNames = {};\n var iriProperties = [];\n var changed = false;\n var i, j;\n\n if (idElements[_LENGTH_]) {\n // Make all IDs unique by adding the ID suffix and collect all encountered tag names\n // that are IRI referenceable from properities.\n for (i = 0; i < idElements[_LENGTH_]; i++) {\n tagName = idElements[i].localName; // Use non-namespaced tag name\n // Make ID unique if tag name is IRI referenceable\n if (tagName in IRI_TAG_PROPERTIES_MAP) {\n iriTagNames[tagName] = 1;\n }\n }\n // Get all properties that are mapped to the found IRI referenceable tags\n for (tagName in iriTagNames) {\n (IRI_TAG_PROPERTIES_MAP[tagName] || [tagName]).forEach(function (mappedProperty) {\n // Add mapped properties to array of iri referencing properties.\n // Use linear search here because the number of possible entries is very small (maximum 11)\n if (iriProperties.indexOf(mappedProperty) < 0) {\n iriProperties.push(mappedProperty);\n }\n });\n }\n if (iriProperties[_LENGTH_]) {\n // Add \"style\" to properties, because it may contain references in the form 'style=\"fill:url(#myFill)\"'\n iriProperties.push(_STYLE_);\n }\n // Run through all elements of the SVG and replace IDs in references.\n // To get all descending elements, getElementsByTagName('*') seems to perform faster than querySelectorAll('*').\n // Since svgElem.getElementsByTagName('*') does not return the svg element itself, we have to handle it separately.\n var descElements = svgElem[_GET_ELEMENTS_BY_TAG_NAME_]('*');\n var element = svgElem;\n var propertyName;\n var value;\n var newValue;\n for (i = -1; element != NULL;) {\n if (element.localName == _STYLE_) {\n // If element is a style element, replace IDs in all occurences of \"url(#anyId)\" in text content\n value = element.textContent;\n newValue = value && value.replace(funcIriRegex, function(match, id) {\n if (referencedIds) {\n referencedIds[id] = 1;\n }\n return 'url(#' + id + idSuffix + ')';\n });\n if (newValue !== value) {\n element.textContent = newValue;\n }\n } else if (element.hasAttributes()) {\n // Run through all property names for which IDs were found\n for (j = 0; j < iriProperties[_LENGTH_]; j++) {\n propertyName = iriProperties[j];\n value = element[_GET_ATTRIBUTE_](propertyName);\n newValue = value && value.replace(funcIriRegex, function(match, id) {\n if (referencedIds) {\n referencedIds[id] = 1;\n }\n return 'url(#' + id + idSuffix + ')';\n });\n if (newValue !== value) {\n element[_SET_ATTRIBUTE_](propertyName, newValue);\n }\n }\n // Replace IDs in xlink:ref and href attributes\n ['xlink:href', 'href'].forEach(function(refAttrName) {\n var iri = element[_GET_ATTRIBUTE_](refAttrName);\n if (/^\\s*#/.test(iri)) { // Check if iri is non-null and internal reference\n iri = iri.trim();\n element[_SET_ATTRIBUTE_](refAttrName, iri + idSuffix);\n if (referencedIds) {\n // Add ID to referenced IDs\n referencedIds[iri.substring(1)] = 1;\n }\n }\n });\n }\n element = descElements[++i];\n }\n for (i = 0; i < idElements[_LENGTH_]; i++) {\n idElem = idElements[i];\n // If set of referenced IDs exists, make only referenced IDs unique,\n // otherwise make all IDs unique.\n if (!referencedIds || referencedIds[idElem.id]) {\n // Add suffix to element's ID\n idElem.id += idSuffix;\n changed = true;\n }\n }\n }\n // return true if SVG element has changed\n return changed;\n }\n\n\n // For cached SVGs the IDs are made unique by simply replacing the already inserted unique IDs with a\n // higher ID counter. This is much more performant than a call to makeIdsUnique().\n function makeIdsUniqueCached(svgString) {\n return svgString.replace(ID_SUFFIX_REGEX, ID_SUFFIX + uniqueIdCounter++);\n }\n\n\n // Inject SVG by replacing the img element with the SVG element in the DOM\n function inject(imgElem, svgElem, absUrl, options) {\n if (svgElem) {\n svgElem[_SET_ATTRIBUTE_]('data-inject-url', absUrl);\n var parentNode = imgElem.parentNode;\n if (parentNode) {\n if (options.copyAttributes) {\n copyAttributes(imgElem, svgElem);\n }\n // Invoke beforeInject hook if set\n var beforeInject = options.beforeInject;\n var injectElem = (beforeInject && beforeInject(imgElem, svgElem)) || svgElem;\n // Replace img element with new element. This is the actual injection.\n parentNode.replaceChild(injectElem, imgElem);\n // Mark img element as injected\n imgElem[__SVGINJECT] = INJECTED;\n removeOnLoadAttribute(imgElem);\n // Invoke afterInject hook if set\n var afterInject = options.afterInject;\n if (afterInject) {\n afterInject(imgElem, injectElem);\n }\n }\n } else {\n svgInvalid(imgElem, options);\n }\n }\n\n\n // Merges any number of options objects into a new object\n function mergeOptions() {\n var mergedOptions = {};\n var args = arguments;\n // Iterate over all specified options objects and add all properties to the new options object\n for (var i = 0; i < args[_LENGTH_]; i++) {\n var argument = args[i];\n for (var key in argument) {\n if (argument.hasOwnProperty(key)) {\n mergedOptions[key] = argument[key];\n }\n }\n }\n return mergedOptions;\n }\n\n\n // Adds the specified CSS to the document's element\n function addStyleToHead(css) {\n var head = document[_GET_ELEMENTS_BY_TAG_NAME_]('head')[0];\n if (head) {\n var style = document[_CREATE_ELEMENT_](_STYLE_);\n style.type = 'text/css';\n style.appendChild(document.createTextNode(css));\n head.appendChild(style);\n }\n }\n\n\n // Builds an SVG element from the specified SVG string\n function buildSvgElement(svgStr, verify) {\n if (verify) {\n var svgDoc;\n try {\n // Parse the SVG string with DOMParser\n svgDoc = svgStringToSvgDoc(svgStr);\n } catch(e) {\n return NULL;\n }\n if (svgDoc[_GET_ELEMENTS_BY_TAG_NAME_]('parsererror')[_LENGTH_]) {\n // DOMParser does not throw an exception, but instead puts parsererror tags in the document\n return NULL;\n }\n return svgDoc.documentElement;\n } else {\n var div = document.createElement('div');\n div.innerHTML = svgStr;\n return div.firstElementChild;\n }\n }\n\n\n function removeOnLoadAttribute(imgElem) {\n // Remove the onload attribute. Should only be used to remove the unstyled image flash protection and\n // make the element visible, not for removing the event listener.\n imgElem.removeAttribute('onload');\n }\n\n\n function errorMessage(msg) {\n console.error('SVGInject: ' + msg);\n }\n\n\n function fail(imgElem, status, options) {\n imgElem[__SVGINJECT] = FAIL;\n if (options.onFail) {\n options.onFail(imgElem, status);\n } else {\n errorMessage(status);\n }\n }\n\n\n function svgInvalid(imgElem, options) {\n removeOnLoadAttribute(imgElem);\n fail(imgElem, SVG_INVALID, options);\n }\n\n\n function svgNotSupported(imgElem, options) {\n removeOnLoadAttribute(imgElem);\n fail(imgElem, SVG_NOT_SUPPORTED, options);\n }\n\n\n function loadFail(imgElem, options) {\n fail(imgElem, LOAD_FAIL, options);\n }\n\n\n function removeEventListeners(imgElem) {\n imgElem.onload = NULL;\n imgElem.onerror = NULL;\n }\n\n\n function imgNotSet(msg) {\n errorMessage('no img element');\n }\n\n\n function createSVGInject(globalName, options) {\n var defaultOptions = mergeOptions(DEFAULT_OPTIONS, options);\n var svgLoadCache = {};\n\n if (IS_SVG_SUPPORTED) {\n // If the browser supports SVG, add a small stylesheet that hides the elements until\n // injection is finished. This avoids showing the unstyled SVGs before style is applied.\n addStyleToHead('img[onload^=\"' + globalName + '(\"]{visibility:hidden;}');\n }\n\n\n /**\n * SVGInject\n *\n * Injects the SVG specified in the `src` attribute of the specified `img` element or array of `img`\n * elements. Returns a Promise object which resolves if all passed in `img` elements have either been\n * injected or failed to inject (Only if a global Promise object is available like in all modern browsers\n * or through a polyfill).\n *\n * Options:\n * useCache: If set to `true` the SVG will be cached using the absolute URL. Default value is `true`.\n * copyAttributes: If set to `true` the attributes will be copied from `img` to `svg`. Dfault value\n * is `true`.\n * makeIdsUnique: If set to `true` the ID of elements in the `` element that can be references by\n * property values (for example 'clipPath') are made unique by appending \"--inject-X\", where X is a\n * running number which increases with each injection. This is done to avoid duplicate IDs in the DOM.\n * beforeLoad: Hook before SVG is loaded. The `img` element is passed as a parameter. If the hook returns\n * a string it is used as the URL instead of the `img` element's `src` attribute.\n * afterLoad: Hook after SVG is loaded. The loaded `svg` element and `svg` string are passed as a\n * parameters. If caching is active this hook will only get called once for injected SVGs with the\n * same absolute path. Changes to the `svg` element in this hook will be applied to all injected SVGs\n * with the same absolute path. It's also possible to return an `svg` string or `svg` element which\n * will then be used for the injection.\n * beforeInject: Hook before SVG is injected. The `img` and `svg` elements are passed as parameters. If\n * any html element is returned it gets injected instead of applying the default SVG injection.\n * afterInject: Hook after SVG is injected. The `img` and `svg` elements are passed as parameters.\n * onAllFinish: Hook after all `img` elements passed to an SVGInject() call have either been injected or\n * failed to inject.\n * onFail: Hook after injection fails. The `img` element and a `status` string are passed as an parameter.\n * The `status` can be either `'SVG_NOT_SUPPORTED'` (the browser does not support SVG),\n * `'SVG_INVALID'` (the SVG is not in a valid format) or `'LOAD_FAILED'` (loading of the SVG failed).\n *\n * @param {HTMLImageElement} img - an img element or an array of img elements\n * @param {Object} [options] - optional parameter with [options](#options) for this injection.\n */\n function SVGInject(img, options) {\n options = mergeOptions(defaultOptions, options);\n\n var run = function(resolve) {\n var allFinish = function() {\n var onAllFinish = options.onAllFinish;\n if (onAllFinish) {\n onAllFinish();\n }\n resolve && resolve();\n };\n\n if (img && typeof img[_LENGTH_] != _UNDEFINED_) {\n // an array like structure of img elements\n var injectIndex = 0;\n var injectCount = img[_LENGTH_];\n\n if (injectCount == 0) {\n allFinish();\n } else {\n var finish = function() {\n if (++injectIndex == injectCount) {\n allFinish();\n }\n };\n\n for (var i = 0; i < injectCount; i++) {\n SVGInjectElement(img[i], options, finish);\n }\n }\n } else {\n // only one img element\n SVGInjectElement(img, options, allFinish);\n }\n };\n\n // return a Promise object if globally available\n return typeof Promise == _UNDEFINED_ ? run() : new Promise(run);\n }\n\n\n // Injects a single svg element. Options must be already merged with the default options.\n function SVGInjectElement(imgElem, options, callback) {\n if (imgElem) {\n var svgInjectAttributeValue = imgElem[__SVGINJECT];\n if (!svgInjectAttributeValue) {\n removeEventListeners(imgElem);\n\n if (!IS_SVG_SUPPORTED) {\n svgNotSupported(imgElem, options);\n callback();\n return;\n }\n // Invoke beforeLoad hook if set. If the beforeLoad returns a value use it as the src for the load\n // URL path. Else use the imgElem's src attribute value.\n var beforeLoad = options.beforeLoad;\n var src = (beforeLoad && beforeLoad(imgElem)) || imgElem[_GET_ATTRIBUTE_]('src');\n\n if (!src) {\n // If no image src attribute is set do no injection. This can only be reached by using javascript\n // because if no src attribute is set the onload and onerror events do not get called\n if (src === '') {\n loadFail(imgElem, options);\n }\n callback();\n return;\n }\n\n // set array so later calls can register callbacks\n var onFinishCallbacks = [];\n imgElem[__SVGINJECT] = onFinishCallbacks;\n\n var onFinish = function() {\n callback();\n onFinishCallbacks.forEach(function(onFinishCallback) {\n onFinishCallback();\n });\n };\n\n var absUrl = getAbsoluteUrl(src);\n var useCacheOption = options.useCache;\n var makeIdsUniqueOption = options.makeIdsUnique;\n \n var setSvgLoadCacheValue = function(val) {\n if (useCacheOption) {\n svgLoadCache[absUrl].forEach(function(svgLoad) {\n svgLoad(val);\n });\n svgLoadCache[absUrl] = val;\n }\n };\n\n if (useCacheOption) {\n var svgLoad = svgLoadCache[absUrl];\n\n var handleLoadValue = function(loadValue) {\n if (loadValue === LOAD_FAIL) {\n loadFail(imgElem, options);\n } else if (loadValue === SVG_INVALID) {\n svgInvalid(imgElem, options);\n } else {\n var hasUniqueIds = loadValue[0];\n var svgString = loadValue[1];\n var uniqueIdsSvgString = loadValue[2];\n var svgElem;\n\n if (makeIdsUniqueOption) {\n if (hasUniqueIds === NULL) {\n // IDs for the SVG string have not been made unique before. This may happen if previous\n // injection of a cached SVG have been run with the option makedIdsUnique set to false\n svgElem = buildSvgElement(svgString, false);\n hasUniqueIds = makeIdsUnique(svgElem, false);\n\n loadValue[0] = hasUniqueIds;\n loadValue[2] = hasUniqueIds && svgElemToSvgString(svgElem);\n } else if (hasUniqueIds) {\n // Make IDs unique for already cached SVGs with better performance\n svgString = makeIdsUniqueCached(uniqueIdsSvgString);\n }\n }\n\n svgElem = svgElem || buildSvgElement(svgString, false);\n\n inject(imgElem, svgElem, absUrl, options);\n }\n onFinish();\n };\n\n if (typeof svgLoad != _UNDEFINED_) {\n // Value for url exists in cache\n if (svgLoad.isCallbackQueue) {\n // Same url has been cached, but value has not been loaded yet, so add to callbacks\n svgLoad.push(handleLoadValue);\n } else {\n handleLoadValue(svgLoad);\n }\n return;\n } else {\n var svgLoad = [];\n // set property isCallbackQueue to Array to differentiate from array with cached loaded values\n svgLoad.isCallbackQueue = true;\n svgLoadCache[absUrl] = svgLoad;\n }\n }\n\n // Load the SVG because it is not cached or caching is disabled\n loadSvg(absUrl, function(svgXml, svgString) {\n // Use the XML from the XHR request if it is an instance of Document. Otherwise\n // (for example of IE9), create the svg document from the svg string.\n var svgElem = svgXml instanceof Document ? svgXml.documentElement : buildSvgElement(svgString, true);\n\n var afterLoad = options.afterLoad;\n if (afterLoad) {\n // Invoke afterLoad hook which may modify the SVG element. After load may also return a new\n // svg element or svg string\n var svgElemOrSvgString = afterLoad(svgElem, svgString) || svgElem;\n if (svgElemOrSvgString) {\n // Update svgElem and svgString because of modifications to the SVG element or SVG string in\n // the afterLoad hook, so the modified SVG is also used for all later cached injections\n var isString = typeof svgElemOrSvgString == 'string';\n svgString = isString ? svgElemOrSvgString : svgElemToSvgString(svgElem);\n svgElem = isString ? buildSvgElement(svgElemOrSvgString, true) : svgElemOrSvgString;\n }\n }\n\n if (svgElem instanceof SVGElement) {\n var hasUniqueIds = NULL;\n if (makeIdsUniqueOption) {\n hasUniqueIds = makeIdsUnique(svgElem, false);\n }\n\n if (useCacheOption) {\n var uniqueIdsSvgString = hasUniqueIds && svgElemToSvgString(svgElem);\n // set an array with three entries to the load cache\n setSvgLoadCacheValue([hasUniqueIds, svgString, uniqueIdsSvgString]);\n }\n\n inject(imgElem, svgElem, absUrl, options);\n } else {\n svgInvalid(imgElem, options);\n setSvgLoadCacheValue(SVG_INVALID);\n }\n onFinish();\n }, function() {\n loadFail(imgElem, options);\n setSvgLoadCacheValue(LOAD_FAIL);\n onFinish();\n });\n } else {\n if (Array.isArray(svgInjectAttributeValue)) {\n // svgInjectAttributeValue is an array. Injection is not complete so register callback\n svgInjectAttributeValue.push(callback);\n } else {\n callback();\n }\n }\n } else {\n imgNotSet();\n }\n }\n\n\n /**\n * Sets the default [options](#options) for SVGInject.\n *\n * @param {Object} [options] - default [options](#options) for an injection.\n */\n SVGInject.setOptions = function(options) {\n defaultOptions = mergeOptions(defaultOptions, options);\n };\n\n\n // Create a new instance of SVGInject\n SVGInject.create = createSVGInject;\n\n\n /**\n * Used in onerror Event of an `` element to handle cases when the loading the original src fails\n * (for example if file is not found or if the browser does not support SVG). This triggers a call to the\n * options onFail hook if available. The optional second parameter will be set as the new src attribute\n * for the img element.\n *\n * @param {HTMLImageElement} img - an img element\n * @param {String} [fallbackSrc] - optional parameter fallback src\n */\n SVGInject.err = function(img, fallbackSrc) {\n if (img) {\n if (img[__SVGINJECT] != FAIL) {\n removeEventListeners(img);\n\n if (!IS_SVG_SUPPORTED) {\n svgNotSupported(img, defaultOptions);\n } else {\n removeOnLoadAttribute(img);\n loadFail(img, defaultOptions);\n }\n if (fallbackSrc) {\n removeOnLoadAttribute(img);\n img.src = fallbackSrc;\n }\n }\n } else {\n imgNotSet();\n }\n };\n\n window[globalName] = SVGInject;\n\n return SVGInject;\n }\n\n var SVGInjectInstance = createSVGInject('SVGInject');\n\n if (typeof module == 'object' && typeof module.exports == 'object') {\n module.exports = SVGInjectInstance;\n }\n})(window, document);", "\"use strict\";function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError(\"Invalid attempt to spread non-iterable instance\")}function _iterableToArray(iter){if(Symbol.iterator in Object(iter)||Object.prototype.toString.call(iter)===\"[object Arguments]\")return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i0&&this.sprite.setVelocityX(0),this.sprite.setFrame(this.carState+1),this.sprite.setAccelerationX(-2*h))}},{key:\"steerRight\",value:function steerRight(){this.skidding||(this.sprite.getVelocityY()<0&&this.sprite.setVelocityY(0),this.sprite.setAccelerationY(o))}},{key:\"steerLeft\",value:function steerLeft(){this.skidding||(this.sprite.getVelocityY()>0&&this.sprite.setVelocityY(0),this.sprite.setAccelerationY(-1*o))}},{key:\"stopAccelerating\",value:function stopAccelerating(){this.sprite.setAccelerationX(0),this.sprite.setFrame(this.carState)}},{key:\"stopSteering\",value:function stopSteering(){this.sprite.setAccelerationY(0)}},{key:\"hasReachedTopSpeed\",value:function hasReachedTopSpeed(){return this.speed>=this.topSpeed}}]);return p}();var c=/*#__PURE__*/function(){function c(e){_classCallCheck(this,c);this.scene=e,this.setup()}_createClass(c,[{key:\"setup\",value:function setup(){this.sprite=this.scene.add.tileSprite(0,0,this.scene.game.config.width,208,\"road\"),this.sprite.y=this.scene.game.config.height/2,this.sprite.setOrigin(0,.5)}},{key:\"tick\",value:function tick(e){this.sprite.tilePositionX+=e}}]);return c}();var l=1200,g=200;var u=/*#__PURE__*/function(){function u(e,t){_classCallCheck(this,u);this.sprites=e,this.lanes=t.lanes,this.x=t.x,this.y=t.y,this.laneWidth=t.laneWidth,this.setNextSpawnTime()}_createClass(u,[{key:\"setNextSpawnTime\",value:function setNextSpawnTime(){var e=new Date,t=l+Math.floor(500*Math.random());this.nextSpawnTime=e.setMilliseconds(e.getMilliseconds()+t)}},{key:\"pickAvailable\",value:function pickAvailable(){var e=this.sprites.filter(function(e){return e.sprite.getX()<0});return e[Math.floor(Math.random()*e.length)]}},{key:\"placeObstacleIfNeeded\",value:function placeObstacleIfNeeded(){if(this.nextSpawnTime>new Date)return;this.setNextSpawnTime();var e=this.pickAvailable();e&&(e.sprite.setX(this.x),this.assignLane(e,Math.floor(Math.random()*this.lanes)),\"car\"===e.type&&e.sprite.setVelocityX(200+Math.floor(200*Math.random())))}},{key:\"assignLane\",value:function assignLane(e,t){e.lane=t,e.sprite.setY(this.y+e.lane*this.laneWidth)}},{key:\"move\",value:function move(e){var _this=this;this.sprites.forEach(function(t){if(t.sprite.setX(t.sprite.getX()-e),\"car\"===t.type&&t.sprite.getVelocityX()>0){var _e=t.sprite.getX(),_i=_this.sprites.filter(function(i){return i.lane==t.lane&&i.sprite.getX()>_e&&i.sprite.getX()-160<_e}).sort(function(t,i){return t.sprite.getX()-_e-(i.sprite.getX()-_e)})[0];_i&&t.lane<_this.lanes-1?(t.lane+=1,t.sprite.setVelocityY(g)):_i&&(t.sprite.setVelocityY(-1*g),t.lane-=1);var _s=_this.y+t.lane*_this.laneWidth;_s&&t.sprite.getY()+2<_s?t.sprite.setVelocityY(g):_s&&t.sprite.getY()-2>_s?t.sprite.setVelocityY(-1*g):t.sprite.setVelocityY(0)}})}}]);return u}();var m=/*#__PURE__*/function(){function m(e){_classCallCheck(this,m);this.phaserSprite=e}_createClass(m,[{key:\"getX\",value:function getX(){return this.phaserSprite.x}},{key:\"getY\",value:function getY(){return this.phaserSprite.y}},{key:\"getWidth\",value:function getWidth(){return this.phaserSprite.width}},{key:\"getHeight\",value:function getHeight(){return this.phaserSprite.height}},{key:\"setX\",value:function setX(e){this.phaserSprite.x=e}},{key:\"setY\",value:function setY(e){this.phaserSprite.y=e}},{key:\"setFrame\",value:function setFrame(e){this.phaserSprite.setFrame(e)}},{key:\"getVelocityY\",value:function getVelocityY(){return this.phaserSprite.body.velocity.y}},{key:\"getVelocityX\",value:function getVelocityX(){return this.phaserSprite.body&&this.phaserSprite.body.velocity.x}},{key:\"enableBouncingFromWorldBounds\",value:function enableBouncingFromWorldBounds(){this.phaserSprite.setCollideWorldBounds(!0)}},{key:\"enableDamping\",value:function enableDamping(){this.phaserSprite.setDamping(!0)}},{key:\"disableDamping\",value:function disableDamping(){this.phaserSprite.setDamping(!0)}},{key:\"setHitBox\",value:function setHitBox(e,t){this.phaserSprite.body.setSize(e,t)}},{key:\"setHitBoxCircle\",value:function setHitBoxCircle(e){this.phaserSprite.body.setCircle(e)}},{key:\"setBounce\",value:function setBounce(e){this.phaserSprite.setBounce(e)}},{key:\"setDragY\",value:function setDragY(e){this.phaserSprite.setDragY(e)}},{key:\"setDragX\",value:function setDragX(e){this.phaserSprite.setDragX(e)}},{key:\"setVelocityY\",value:function setVelocityY(e){this.phaserSprite.setVelocityY(e)}},{key:\"setVelocityX\",value:function setVelocityX(e){this.phaserSprite.setVelocityX(e)}},{key:\"setMaxVelocity\",value:function setMaxVelocity(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:e;this.phaserSprite.setMaxVelocity(e,t)}},{key:\"setAccelerationX\",value:function setAccelerationX(e){this.phaserSprite.setAccelerationX(e)}},{key:\"setAccelerationY\",value:function setAccelerationY(e){this.phaserSprite.setAccelerationY(e)}}]);return m}();var S=/*#__PURE__*/function(){function S(e){_classCallCheck(this,S);var t=function t(_t){return e.keyboard.addKey(_t)};this._pointer=e.pointer1,this._cursors=e.keyboard.createCursorKeys(),this._buttonD=t(Phaser.Input.Keyboard.KeyCodes.D),this._buttonA=t(Phaser.Input.Keyboard.KeyCodes.A),this._buttonW=t(Phaser.Input.Keyboard.KeyCodes.W),this._buttonS=t(Phaser.Input.Keyboard.KeyCodes.S)}_createClass(S,[{key:\"isPointerDownOnRight\",value:function isPointerDownOnRight(){return this._pointer.isDown&&this._pointer.position.x>535&&this._pointer.position.y>124&&this._pointer.position.y<160}},{key:\"isPointerDownOnLeft\",value:function isPointerDownOnLeft(){return this._pointer.isDown&&this._pointer.position.x<265&&this._pointer.position.y>124&&this._pointer.position.y<160}},{key:\"isPointerDownOnTop\",value:function isPointerDownOnTop(){return this._pointer.isDown&&this._pointer.position.y<124}},{key:\"isPointerDownOnBottom\",value:function isPointerDownOnBottom(){return this._pointer.isDown&&this._pointer.position.y>160}},{key:\"isWKeyPressed\",value:function isWKeyPressed(){return this._buttonW.isDown}},{key:\"isSKeyPressed\",value:function isSKeyPressed(){return this._buttonS.isDown}},{key:\"isDownKeyPressed\",value:function isDownKeyPressed(){return this._cursors.down.isDown}},{key:\"isUpKeyPressed\",value:function isUpKeyPressed(){return this._cursors.up.isDown}},{key:\"isAKeyPressed\",value:function isAKeyPressed(){return this._buttonA.isDown}},{key:\"isDKeyPressed\",value:function isDKeyPressed(){return this._buttonD.isDown}},{key:\"isLeftKeyPressed\",value:function isLeftKeyPressed(){return this._cursors.left.isDown}},{key:\"isRightKeyPressed\",value:function isRightKeyPressed(){return this._cursors.right.isDown}},{key:\"isSpacePressed\",value:function isSpacePressed(){return this._cursors.space.isDown}}]);return S}();var f=/*#__PURE__*/function(){function f(e){_classCallCheck(this,f);this._input=new S(e)}_createClass(f,[{key:\"isSteeringRight\",value:function isSteeringRight(){return this._tryingSteeringRight()&&!this._tryingSteeringLeft()}},{key:\"isSteeringLeft\",value:function isSteeringLeft(){return this._tryingSteeringLeft()&&!this._tryingSteeringRight()}},{key:\"isAccelerating\",value:function isAccelerating(){return this._tryingAccelerating()&&!this._tryingSlowingDown()}},{key:\"isSlowingDown\",value:function isSlowingDown(){return this._tryingSlowingDown()&&!this._tryingAccelerating()}},{key:\"_tryingSteeringRight\",value:function _tryingSteeringRight(){return this._input.isSKeyPressed()||this._input.isDownKeyPressed()||this._input.isPointerDownOnBottom()}},{key:\"_tryingSteeringLeft\",value:function _tryingSteeringLeft(){return this._input.isWKeyPressed()||this._input.isUpKeyPressed()||this._input.isPointerDownOnTop()}},{key:\"_tryingAccelerating\",value:function _tryingAccelerating(){return this._input.isDKeyPressed()||this._input.isRightKeyPressed()||this._input.isPointerDownOnRight()}},{key:\"_tryingSlowingDown\",value:function _tryingSlowingDown(){return this._input.isAKeyPressed()||this._input.isLeftKeyPressed()||this._input.isPointerDownOnLeft()}}]);return f}();var y=3,w=5,b=4;var _=/*#__PURE__*/function(){function _(e,t,i){_classCallCheck(this,_);this.slickGroup=i,this.rocksGroup=e,this.carGroup=t}_createClass(_,[{key:\"build\",value:function build(){return this.buildRocks().concat(this.buildCars()).concat(this.buildSlicks())}},{key:\"buildRocks\",value:function buildRocks(){var _this2=this;return _toConsumableArray(Array(w)).map(function(){var e=_this2.rocksGroup.create(-5e3,0,\"rocks\").setRotation(90*Math.round(4*Math.random()));return new x(\"rocks\",e)})}},{key:\"buildCars\",value:function buildCars(){var _this3=this;return _toConsumableArray(Array(b)).map(function(e,t){var i=_this3.carGroup.create(-5e3,0,\"car-sprite\",10+t);return new x(\"car\",i)})}},{key:\"buildSlicks\",value:function buildSlicks(){var _this4=this;return _toConsumableArray(Array(y)).map(function(){var e=_this4.slickGroup.create(-5e3,0,\"slick\").setRotation(90*Math.round(4*Math.random()));return new x(\"slick\",e)})}}]);return _}();var x=function x(e,t){_classCallCheck(this,x);this.type=e,this.lane=null,this.sprite=new m(t),\"car\"===e?this.sprite.setHitBox(this.sprite.getWidth()-12,this.sprite.getHeight()-8):this.sprite.setHitBoxCircle(this.sprite.getWidth()/2)};var v,D,k,P,O,A,X,V,Y={preload:function preload(){this.load.spritesheet(\"car-sprite\",\"/dead_end/img/car-sprite.png\",{frameWidth:96,frameHeight:48}),this.load.image(\"road\",\"/dead_end/img/road.png\"),this.load.image(\"rocks\",\"/dead_end/img/rocks.png\"),this.load.image(\"slick\",\"/dead_end/img/slick.png\"),this.load.audioSprite(\"sfx\",\"/dead_end/data/audio_sprite.json\",[\"/dead_end/sfx/sprite2.mp3\"]),this.load.audio(\"theme\",[\"/dead_end/sfx/soundtrack.mp3\"])},create:function create(){this.sound.add(\"theme\",{loop:!0,volume:.75}).play(),O=this.sound.addAudioSprite(\"sfx\"),A=this.sound.addAudioSprite(\"sfx\"),P=new f(this.input),A.stop(\"engine\"),A.play(\"engine\"),this.physics.world.setBounds(0,88,this.game.config.width,144),D=new c(this);var e=new m(this.physics.add.sprite(0,0,\"car-sprite\",0).setDepth(1));e.enableBouncingFromWorldBounds(),v=new p(e);this.game.gameState.levels[this.game.gameState.level];X&&clearTimeout(X),this.anims.create({key:\"gameOver\",frames:this.anims.generateFrameNumbers(\"car-sprite\",{start:7,end:9}),frameRate:5,repeat:-1}),function(e){var t=e.physics.add.group(),i=e.physics.add.group(),s=e.physics.add.group(),r=new _(t,i,s).build();k=new u(r,{x:1600,y:105,laneWidth:50,lanes:3}),e.physics.add.overlap(v.sprite.phaserSprite,t,function(t,i){B(v,i,e)}),e.physics.add.overlap(v.sprite.phaserSprite,i,function(t,i){v.isInvinsible||(i.setVelocity(0),B(v,i,e))}),e.physics.add.overlap(i,t,function(t,i){t.x>0&&t.x0&&t.xr.goal&&(this.game.gameState.level+=1),k.placeObstacleIfNeeded(),k.move(s),P.isAccelerating()?v.accelerate():P.isSlowingDown()?v.slowDown():v.stopAccelerating(),P.isSteeringLeft()?v.steerLeft():P.isSteeringRight()?v.steerRight():v.stopSteering()):v.dead&&v.playDeathAnim()}};function B(e,t,i){e.isInvinsible||(O.play(\"crash\"),i.cameras.main.shake(300,.01),i.game.gameState.carHit(),i.game.gameState.lives>0?(V=i.tweens.add({targets:e.sprite.phaserSprite,alpha:0,ease:\"Cubic.easeOut\",duration:200,repeat:-1,yoyo:!0}),e.carState+=2,X=setTimeout(T,3e3)):e.die(),e.isInvinsible=!0,e.speed=0,i.cameras.main.shake(300,.01))}function T(){v.sprite.phaserSprite.setAlpha(1),v.isInvinsible=!1,V.stop()}var M,K,I,R,C;function W(e){var t=e.toString(),i=t.length;return _toConsumableArray(Array(5-i)).forEach(function(){t=\"0\"+t}),t}var L,H,G,F,j={preload:function preload(){this.load.image(\"life\",\"/dead_end/img/life.png\"),this.load.spritesheet(\"muteButton\",\"/dead_end/img/mute-button-sprite.png\",{frameWidth:18,frameHeight:14})},create:function create(){var _this5=this;M=this.add.text(this.game.config.width,10,W(0),{fill:\"#3d414a\",font:\"14px \\\"Press Start 2P\\\"\"}).setOrigin(1,0),K=this.add.text(this.game.config.width-90,10,\"HI \"+W(this.game.gameState.highScore),{fill:\"#666b76\",font:\"14px \\\"Press Start 2P\\\"\"}).setOrigin(1,0),I=this.add.text(this.game.config.width/2,10,\"LVL\"+(this.game.gameState.level+1).toString().padStart(2,\"0\"),{fill:\"#666b76\",font:\"14px \\\"Press Start 2P\\\"\"}).setOrigin(1,0),R=_toConsumableArray(Array(this.game.gameState.lives)).map(function(e,t){return _this5.add.image(20*t,8,\"life\").setOrigin(0,0)}),(C=this.add.sprite(0,0,\"muteButton\",0)).setOrigin(.5,-.5).setInteractive({useHandCursor:!0}),C.x=this.game.config.width-16,C.y=this.game.config.height-60,C.on(\"pointerdown\",function(e){_this5.sound.mute=!_this5.sound.mute,_this5.sound.mute?C.setFrame(0):C.setFrame(1)})},update:function update(){M.text=W(this.game.gameState.score),I.text=\"LVL\"+(this.game.gameState.level+1).toString().padStart(2,\"0\"),this.game.gameState.highScore3e3&&(H.setVisible(!1),G.setVisible(!0))}};function z(e){e.game.sound.stopAll(),e.scene.stop(),e.game.gameState.reset()}var q=40;function J(e,t,i){var s={fill:\"#fff\",font:parseInt(.3*q)+\"px \\\"Press Start 2P\\\"\"},r=i.add.text(0,0,e.toUpperCase(),s).setOrigin(.5,.5),n=function(e,t,i){var s=i.add.tileSprite(0,0,e,q,\"button-tile\");s.setOrigin(0,0).setInteractive({useHandCursor:!0}),s.on(\"pointerdown\",t);var r=s.getBounds(),n=i.add.image(0,0,\"button-left-corner\").setOrigin(0,0);n.setX(r.x-n.getBounds().width),n.setY(r.y);var a=i.add.image(0,0,\"button-right-corner\").setOrigin(0,0);return a.setX(r.x+r.width),a.setY(r.y),i.add.container().add([n,s,a])}(r.getBounds().width+10,t,i),a=n.getBounds();return r.setX(a.x+a.width/2),r.setY(a.y+a.height/2+1),i.add.container().add([n,r])}var Q={type:Phaser.AUTO,parent:\"four-o-four-game\",backgroundColor:\"#ffffff\",width:800,height:320,physics:{default:\"arcade\",arcade:{debug:!1}},antialias:!1,pixelArt:!0};var Z=new Phaser.Game(Q);Z.scene.add(\"MainScene\",Y),Z.scene.add(\"OverlayScene\",{preload:function preload(){},create:function create(){this.add.graphics({x:0,y:0,fillStyle:{color:16777215,alpha:.75}}).fillRect(0,0,this.game.config.width,this.game.config.height)},update:function update(){}}),Z.scene.add(\"SplashScene\",a),Z.scene.add(\"GameOverScene\",N),Z.scene.add(\"ScoreScene\",j),Z.gameState=new(/*#__PURE__*/function(){function _class(e){_classCallCheck(this,_class);this.game=e,this.reset()}_createClass(_class,[{key:\"reset\",value:function reset(){var _this6=this;this.time=0,this.gameStarted=!1,this.savedScore=parseInt(localStorage.getItem(\"highScore\")||\"0\"),this.highScore=this.savedScore,this.score=0,this.lives=3,this.level=0,this.levels=[{goal:5e3,topSpeed:400},{goal:1e4,topSpeed:500},{goal:5e4,topSpeed:600},{goal:1e5,topSpeed:800},{goal:1/0,topSpeed:1200}],setTimeout(function(){_this6.gameStarted=!0,_this6.game.scene.stop(\"SplashScene\")},5e3),this.game.scene.start(\"SplashScene\"),this.game.scene.start(\"ScoreScene\"),this.game.scene.start(\"MainScene\"),this.game.scene.stop(\"OverlayScene\")}},{key:\"tick\",value:function tick(e){this.time+=e}},{key:\"carHit\",value:function carHit(){this.lives-=1,this.lives<=0&&this.gameOver()}},{key:\"levelUp\",value:function levelUp(){this.level+=1}},{key:\"topSpeed\",value:function topSpeed(){return this.levels[this.level].topSpeed}},{key:\"gameOver\",value:function gameOver(){var _this7=this;setTimeout(function(){_this7.game.scene.pause(\"MainScene\"),_this7.game.scene.start(\"OverlayScene\"),_this7.game.scene.start(\"GameOverScene\")},1e3),this.savedScore 0;\n }\n });\n }\n return;\n}\n\n/**\n * Returns the embedding frame element, if any.\n * @param {!Document} doc\n * @return {!Element}\n */\nfunction getFrameElement(doc) {\n try {\n return doc.defaultView && doc.defaultView.frameElement || null;\n } catch (e) {\n // Ignore the error.\n return null;\n }\n}\n\n/**\n * A local reference to the root document.\n */\nvar document = (function(startDoc) {\n var doc = startDoc;\n var frame = getFrameElement(doc);\n while (frame) {\n doc = frame.ownerDocument;\n frame = getFrameElement(doc);\n }\n return doc;\n})(window.document);\n\n/**\n * An IntersectionObserver registry. This registry exists to hold a strong\n * reference to IntersectionObserver instances currently observing a target\n * element. Without this registry, instances without another reference may be\n * garbage collected.\n */\nvar registry = [];\n\n/**\n * The signal updater for cross-origin intersection. When not null, it means\n * that the polyfill is configured to work in a cross-origin mode.\n * @type {function(DOMRect|ClientRect, DOMRect|ClientRect)}\n */\nvar crossOriginUpdater = null;\n\n/**\n * The current cross-origin intersection. Only used in the cross-origin mode.\n * @type {DOMRect|ClientRect}\n */\nvar crossOriginRect = null;\n\n\n/**\n * Creates the global IntersectionObserverEntry constructor.\n * https://w3c.github.io/IntersectionObserver/#intersection-observer-entry\n * @param {Object} entry A dictionary of instance properties.\n * @constructor\n */\nfunction IntersectionObserverEntry(entry) {\n this.time = entry.time;\n this.target = entry.target;\n this.rootBounds = ensureDOMRect(entry.rootBounds);\n this.boundingClientRect = ensureDOMRect(entry.boundingClientRect);\n this.intersectionRect = ensureDOMRect(entry.intersectionRect || getEmptyRect());\n this.isIntersecting = !!entry.intersectionRect;\n\n // Calculates the intersection ratio.\n var targetRect = this.boundingClientRect;\n var targetArea = targetRect.width * targetRect.height;\n var intersectionRect = this.intersectionRect;\n var intersectionArea = intersectionRect.width * intersectionRect.height;\n\n // Sets intersection ratio.\n if (targetArea) {\n // Round the intersection ratio to avoid floating point math issues:\n // https://github.com/w3c/IntersectionObserver/issues/324\n this.intersectionRatio = Number((intersectionArea / targetArea).toFixed(4));\n } else {\n // If area is zero and is intersecting, sets to 1, otherwise to 0\n this.intersectionRatio = this.isIntersecting ? 1 : 0;\n }\n}\n\n\n/**\n * Creates the global IntersectionObserver constructor.\n * https://w3c.github.io/IntersectionObserver/#intersection-observer-interface\n * @param {Function} callback The function to be invoked after intersection\n * changes have queued. The function is not invoked if the queue has\n * been emptied by calling the `takeRecords` method.\n * @param {Object=} opt_options Optional configuration options.\n * @constructor\n */\nfunction IntersectionObserver(callback, opt_options) {\n\n var options = opt_options || {};\n\n if (typeof callback != 'function') {\n throw new Error('callback must be a function');\n }\n\n if (\n options.root &&\n options.root.nodeType != 1 &&\n options.root.nodeType != 9\n ) {\n throw new Error('root must be a Document or Element');\n }\n\n // Binds and throttles `this._checkForIntersections`.\n this._checkForIntersections = throttle(\n this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT);\n\n // Private properties.\n this._callback = callback;\n this._observationTargets = [];\n this._queuedEntries = [];\n this._rootMarginValues = this._parseRootMargin(options.rootMargin);\n\n // Public properties.\n this.thresholds = this._initThresholds(options.threshold);\n this.root = options.root || null;\n this.rootMargin = this._rootMarginValues.map(function(margin) {\n return margin.value + margin.unit;\n }).join(' ');\n\n /** @private @const {!Array} */\n this._monitoringDocuments = [];\n /** @private @const {!Array} */\n this._monitoringUnsubscribes = [];\n}\n\n\n/**\n * The minimum interval within which the document will be checked for\n * intersection changes.\n */\nIntersectionObserver.prototype.THROTTLE_TIMEOUT = 100;\n\n\n/**\n * The frequency in which the polyfill polls for intersection changes.\n * this can be updated on a per instance basis and must be set prior to\n * calling `observe` on the first target.\n */\nIntersectionObserver.prototype.POLL_INTERVAL = null;\n\n/**\n * Use a mutation observer on the root element\n * to detect intersection changes.\n */\nIntersectionObserver.prototype.USE_MUTATION_OBSERVER = true;\n\n\n/**\n * Sets up the polyfill in the cross-origin mode. The result is the\n * updater function that accepts two arguments: `boundingClientRect` and\n * `intersectionRect` - just as these fields would be available to the\n * parent via `IntersectionObserverEntry`. This function should be called\n * each time the iframe receives intersection information from the parent\n * window, e.g. via messaging.\n * @return {function(DOMRect|ClientRect, DOMRect|ClientRect)}\n */\nIntersectionObserver._setupCrossOriginUpdater = function() {\n if (!crossOriginUpdater) {\n /**\n * @param {DOMRect|ClientRect} boundingClientRect\n * @param {DOMRect|ClientRect} intersectionRect\n */\n crossOriginUpdater = function(boundingClientRect, intersectionRect) {\n if (!boundingClientRect || !intersectionRect) {\n crossOriginRect = getEmptyRect();\n } else {\n crossOriginRect = convertFromParentRect(boundingClientRect, intersectionRect);\n }\n registry.forEach(function(observer) {\n observer._checkForIntersections();\n });\n };\n }\n return crossOriginUpdater;\n};\n\n\n/**\n * Resets the cross-origin mode.\n */\nIntersectionObserver._resetCrossOriginUpdater = function() {\n crossOriginUpdater = null;\n crossOriginRect = null;\n};\n\n\n/**\n * Starts observing a target element for intersection changes based on\n * the thresholds values.\n * @param {Element} target The DOM element to observe.\n */\nIntersectionObserver.prototype.observe = function(target) {\n var isTargetAlreadyObserved = this._observationTargets.some(function(item) {\n return item.element == target;\n });\n\n if (isTargetAlreadyObserved) {\n return;\n }\n\n if (!(target && target.nodeType == 1)) {\n throw new Error('target must be an Element');\n }\n\n this._registerInstance();\n this._observationTargets.push({element: target, entry: null});\n this._monitorIntersections(target.ownerDocument);\n this._checkForIntersections();\n};\n\n\n/**\n * Stops observing a target element for intersection changes.\n * @param {Element} target The DOM element to observe.\n */\nIntersectionObserver.prototype.unobserve = function(target) {\n this._observationTargets =\n this._observationTargets.filter(function(item) {\n return item.element != target;\n });\n this._unmonitorIntersections(target.ownerDocument);\n if (this._observationTargets.length == 0) {\n this._unregisterInstance();\n }\n};\n\n\n/**\n * Stops observing all target elements for intersection changes.\n */\nIntersectionObserver.prototype.disconnect = function() {\n this._observationTargets = [];\n this._unmonitorAllIntersections();\n this._unregisterInstance();\n};\n\n\n/**\n * Returns any queue entries that have not yet been reported to the\n * callback and clears the queue. This can be used in conjunction with the\n * callback to obtain the absolute most up-to-date intersection information.\n * @return {Array} The currently queued entries.\n */\nIntersectionObserver.prototype.takeRecords = function() {\n var records = this._queuedEntries.slice();\n this._queuedEntries = [];\n return records;\n};\n\n\n/**\n * Accepts the threshold value from the user configuration object and\n * returns a sorted array of unique threshold values. If a value is not\n * between 0 and 1 and error is thrown.\n * @private\n * @param {Array|number=} opt_threshold An optional threshold value or\n * a list of threshold values, defaulting to [0].\n * @return {Array} A sorted list of unique and valid threshold values.\n */\nIntersectionObserver.prototype._initThresholds = function(opt_threshold) {\n var threshold = opt_threshold || [0];\n if (!Array.isArray(threshold)) threshold = [threshold];\n\n return threshold.sort().filter(function(t, i, a) {\n if (typeof t != 'number' || isNaN(t) || t < 0 || t > 1) {\n throw new Error('threshold must be a number between 0 and 1 inclusively');\n }\n return t !== a[i - 1];\n });\n};\n\n\n/**\n * Accepts the rootMargin value from the user configuration object\n * and returns an array of the four margin values as an object containing\n * the value and unit properties. If any of the values are not properly\n * formatted or use a unit other than px or %, and error is thrown.\n * @private\n * @param {string=} opt_rootMargin An optional rootMargin value,\n * defaulting to '0px'.\n * @return {Array