{ "version": 3, "sources": ["../../node_modules/@story/story_assets/app/assets/javascripts/utils.js", "../../node_modules/@story/story_assets/app/assets/javascripts/cookies.js", "../../node_modules/@story/story_assets/app/assets/javascripts/dom_extend.js", "../../node_modules/@story/story_assets/app/assets/javascripts/ajax.js", "../../node_modules/@story/story_assets/app/assets/javascripts/animations.js", "../../node_modules/@story/story_assets/app/assets/javascripts/carousel.js", "../../node_modules/@story/story_assets/app/assets/javascripts/slide.js", "../../node_modules/@story/story_assets/app/assets/javascripts/ajax_form.js", "../../node_modules/@story/story_assets/app/assets/javascripts/modal/modal.js", "../../node_modules/@story/story_assets/app/assets/javascripts/modal/modal_dialog.js", "../../node_modules/@story/story_assets/app/assets/javascripts/modal/modal_window.js", "../../app/assets/javascripts/application.js"], "sourcesContent": ["/**\n * Equivalent of the jQuery.ready() function.\n * Executes the callback when the document is fully loaded.\n *\n * @param {Function} callback - The function to be executed when the document is ready.\n */\nexport function onDocumentReady(callback) {\n\tif (document.readyState === \"complete\" || (document.readyState !== \"loading\" && !document.documentElement.doScroll)) {\n\t\t// Dokument u\u017E je na\u010Dten\u00FD, tak\u017Ee mus\u00EDme zavolat callback my (ud\u00E1lost DOMContentLoaded\n\t\t// u\u017E nebude prohl\u00ED\u017Ee\u010Dem emitov\u00E1na).\n\t\tcallback();\n\t}\n\telse {\n\t\t// Dokument je\u0161t\u011B nen\u00ED na\u010Dten\u00FD, po\u010Dk\u00E1me na n\u011Bj p\u0159es ud\u00E1lost.\n\t\tdocument.addEventListener(\"DOMContentLoaded\", callback);\n\t}\n}\n\n\n/**\n * Handler for code that is added to the page via snippets.\n * Executes the callback when the document is ready or when a snippet is ready.\n *\n * @param {Function} callback - The function to be executed when the content is ready.\n */\nexport function onContentReady(callback) {\n\tonDocumentReady(function() {\n\t\tcallback(document)\n\t});\n\n\tdocument.addEventListener(\"snippetready\", function(event) {\n\t\tcallback(event.detail.parent);\n\t});\n}\n\n\n/**\n * Simplified way of creating custom events. Events can have their own parameters\n * (available in the handler via event.detail.*), can \"bubble\" upwards, or be \"cancelable\"\n * (both set to false by default).\n *\n * This function is crucial as we use custom events extensively on the web.\n *\n * The function needs to be called using \"apply\" or \"bind\" in the form of\n * triggerEvent.apply(element, eventName, params, bubbles, cancellable).\n * It expects to receive the element on which to trigger the event in \"this\".\n *\n * @param {string} eventName - The name of the event to be triggered.\n * @param {Object} params - The parameters to be passed with the event.\n * @param {boolean} [bubbles=true] - Whether the event should bubble up.\n * @param {boolean} [cancellable=true] - Whether the event should be cancelable.\n */\nexport function triggerEvent(eventName, params, bubbles, cancellable) {\n\t// V\u00FDchoz\u00ED hodnoty pro probubl\u00E1v\u00E1n\u00ED a zru\u0161itelnost.\n\tbubbles = bubbles || true;\n\tcancellable = cancellable || true;\n\n\t// Vytvo\u0159en\u00ED vlastn\u00ED ud\u00E1losti se zvolen\u00FDm n\u00E1zvem.\n\tvar customEvent = new window.CustomEvent(eventName, { bubbles: bubbles, cancellable: cancellable, detail: params })\n\n\t// Vyvol\u00E1n\u00ED ud\u00E1losti na DOM elementu, kter\u00FD n\u00E1m byl p\u0159ed\u00E1n ve form\u011B \"this\" prom\u011Bnn\u00E9.\n\tthis.dispatchEvent(customEvent);\n}\n\n\n/**\n * Is the DOM element visible?\n * The DOM element is passed via \"apply\" as the \"this\" pointer.\n * Function taken from the jQuery library.\n */\nexport function isVisible() {\n\treturn !!(this.offsetWidth || this.offsetHeight || this.getClientRects().length) && this.style.visibility != \"hidden\";\n}\n\n\n/**\n * Return direct descendants of the given element that match the given selector.\n * Unfortunately, IE does not implement the querySelectorAll(\":scope > ...\") option,\n * so we need to find another way.\n * The DOM element is passed via \"apply\" as the \"this\" pointer.\n *\n * @param {string} selector - The CSS selector to match the descendants against.\n * @returns {Array} - An array of matching direct descendant elements.\n */\nexport function querySelectorChildren(selector) {\n\treturn Array.prototype.filter.call(this.children, function(child) {\n\t\treturn child.matches(selector);\n\t});\n};\n\n\n/**\n * Simplifies event capturing that is bound to a specific element (selector).\n *\n * @param {Element} element - The DOM element to bind the event to.\n * @param {string} event - The event type to listen for.\n * @param {string} selector - The CSS selector to match the descendants against.\n * @param {Function} handler - The event handler function.\n */\nexport function addEventSelectorListener(eventNames, selector, callback) {\n\tvar eventNames = eventNames.split(\" \");\n\tfor (var i = 0; i < eventNames.length; ++i) {\n\t\tthis.addEventListener(eventNames[i], function(event) {\n\t\t\t// Dostaneme-li jako event.target objekt document, ten nem\u00E1 metodu closest, a proto mus\u00EDme jej\u00ED p\u0159\u00EDtomnost testovat.\n\t\t\tvar target = event.target.closest ? event.target.closest(selector) : null;\n\t\t\tif (!target) { return; }\n\t\t\tcallback(event, target);\n\t\t});\n\t}\n}\n\n\n/**\n * A relaxed version of addEventSelectorListener, where \"closest\" is not used,\n * but the selector must match directly on the element that triggered the event.\n * This is particularly useful for events like \"change\", where the event source\n * is directly an input element and checking \"closest\" would be unnecessary\n * (it wouldn't be fundamentally wrong, but it would reduce script performance).\n *\n * @param {Element} element - The DOM element to bind the event to.\n * @param {string} event - The event type to listen for.\n * @param {string} selector - The CSS selector to match the event target against.\n * @param {Function} handler - The event handler function.\n */\nexport function addEventMatchesListener(eventName, selector, callback) {\n\tthis.addEventListener(eventName, function(event) {\n\t\tif (event.target.matches(selector)) {\n\t\t\tcallback(event, event.target);\n\t\t}\n\t});\n}\n\n\n/**\n * If it is a link that does not point anywhere or a button that is not \"submit\",\n * it suppresses the action. Useful for suppressing events on links that lead nowhere\n * (href is #), while preserving functionality for elements like radio buttons.\n */\nexport function preventLinkDefault(event, target) {\n\tif (target.getAttribute(\"href\") == \"#\"\n\t\t|| (target.matches(\"button\") && !target.matches(\"button[type='submit'], button[type='reset']\"))\n\t\t|| (target.matches(\"input\") && !target.matches(\"input[type='checkbox'], input[type='radio']\"))) {\n\t\tevent.preventDefault();\n\t}\n}", "\nexport const Cookies = {};\n\nCookies.set = function(name, value, expirationDays) {\n\tvar expiration = new Date();\n\texpiration.setTime(expiration.getTime() + (expirationDays * 24 * 60 * 60 * 1000));\n\n\tdocument.cookie = name + \"=\" + value + \";expires=\" + expiration.toUTCString() + \";path=/\";\n}\n\nCookies.remove = function(name) {\n\tdocument.cookie = name + \"=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/\";\n}\n\nCookies.get = function(cname) {\n\tvar name = cname + \"=\";\n\tvar decodedCookie = decodeURIComponent(document.cookie);\n\tvar ca = decodedCookie.split(\";\");\n\n\tfor (var i = 0; i < ca.length; ++i) {\n\t\tvar c = ca[i];\n\t\twhile (c.charAt(0) == \" \") {\n\t\t\tc = c.substring(1);\n\t\t}\n\t\tif (c.indexOf(name) == 0) {\n\t\t\treturn c.substring(name.length, c.length);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nCookies.contains = function(name) {\n\treturn Cookies.get(name) !== undefined;\n}\n", "import { triggerEvent, isVisible, querySelectorChildren, addEventSelectorListener, addEventMatchesListener } from \"./utils\";\n\n//\n// Tato t\u0159\u00EDda obsahuje k\u00F3d, kter\u00FD je trochu \"kontroverzn\u00ED\" (nen\u00ED to \u00FApln\u011B dobr\u00FD n\u00E1pad).\n// Smyslem je zjednodu\u0161it z\u00E1pis vol\u00E1n\u00ED funkc\u00ED, kter\u00E9 o\u010Dek\u00E1vaj\u00ED element jako sv\u016Fj argument,\n// tj. jde o operace s/nad elementy a tak se roz\u0161\u00ED\u0159en\u00ED jejich prototypu (by\u0165\n// jde o siln\u011B nedoporu\u010Dovan\u00E9 \u0159e\u0161en\u00ED) nab\u00EDz\u00ED. Zde si tuto \"kontroverzi\" m\u016F\u017Eeme dovolit,\n// proto\u017Ee k\u00F3d nen\u00ED rozsh\u00E1hl\u00FD.\n//\n// Pokud by se v budoucnu uk\u00E1zalo, \u017Ee tento p\u0159\u00EDstup opravdu nebyl dobr\u00FD n\u00E1pad,\n// v\u0161echny funkce jsou ps\u00E1ny tak, aby je \u0161lo kdykoliv nahradit vol\u00E1n\u00EDm p\u0159es \"apply\" nebo \"bind\",\n// kde jako prvn\u00ED argument bude v\u017Edy dan\u00FD element.\n//\n\nif (!Element.prototype.trigger && !Document.prototype.trigger && !Element.prototype.isVisible && !Element.prototype.querySelectorChildren && !Document.prototype.addEventSelectorListener && !Element.prototype.addEventSelectorListener && !Document.prototype.addEventMatchesListener && !Element.prototype.addEventMatchesListener) {\n\tElement.prototype.trigger = Document.prototype.trigger = triggerEvent;\n\tElement.prototype.isVisible = isVisible;\n\tElement.prototype.querySelectorChildren = querySelectorChildren;\n\tElement.prototype.addEventSelectorListener = Document.prototype.addEventSelectorListener = addEventSelectorListener;\n\tElement.prototype.addEventMatchesListener = Document.prototype.addEventMatchesListener = addEventMatchesListener;\n}\nelse {\n\tconsole.error(\"N\u011Bkter\u00E9 z metod v t\u0159\u00EDd\u011B \\\"Element\\\" ji\u017E existuj\u00ED. Zkontrolujte \\\"dom_extend.js\\\".\");\n}\n", "import \"./dom_extend\";\n\nexport const Ajax = {};\n\n//\n// V p\u0159\u00EDpad\u011B, \u017Ee se AJAXov\u00FD po\u017Eadavek vr\u00E1til, emitujeme ud\u00E1losti\n// \"ajaxsuccess\" (resp. \"ajaxerror\") a \"ajaxcompleted\".\n//\n// Nav\u00EDc provedeme alespo\u0148 z\u00E1kladn\u00ED pokus o p\u0159evod n\u00E1vratov\u00E9 hodnoty do JSON (je-li\n// odpov\u011B\u010F v tomto form\u00E1tu).\n//\nfunction onAjaxResponse(kind, status, event, callback, form, xhr) {\n\tvar responseJSON = null;\n\ttry {\n\t\tresponseJSON = JSON.parse(event.target.response);\n\t} catch (exception) {\n\t}\n\n\tvar form = form ? form : null;\n\tvar emitter = form ? form : document;\n\n\temitter.trigger(\"ajax\" + kind, { status: status, event: event, form: form, response: event.target.response, responseJSON: responseJSON, xhr: xhr }, true);\n\temitter.trigger(\"ajaxcompleted\", { status: status, event: event, form: form, response: event.target.response, responseJSON: responseJSON, xhr: xhr }, true);\n\n\tif (kind == \"error\") {\n\t\tconsole.error(\"AJAX: P\u0159i vy\u0159izov\u00E1n\u00ED AJAX po\u017Eadavku do\u0161lo k chyb\u011B.\");\n\t}\n\n\tif (callback) {\n\t\tcallback({ event: event, response: event.target.response, responseJSON: responseJSON, xhr: xhr });\n\t}\n}\n\nfunction onAjaxBefore(form) {\n\t// P\u0159ed samotn\u00FDm vysl\u00E1n\u00EDm AJAXov\u00E9ho po\u017Eadavku emitneme ud\u00E1lost \"ajaxbefore\".\n\t// To se m\u016F\u017Ee hodit nap\u0159. pro zobrazen\u00ED to\u010D\u00EDc\u00EDho kole\u010Dka nebo n\u011Bco podobn\u00E9ho.\n\n\tvar form = form ? form : null;\n\tvar emitter = form ? form : document;\n\n\temitter.trigger(\"ajaxbefore\", { form: form }, true);\n}\n\nfunction getCsrfToken() {\n\treturn document.head.querySelector(\"meta[name='csrf-token']\").getAttribute(\"content\");\n}\n\n\n// *************************************************************************\n// Obecn\u00FD GET po\u017Eadavek.\n// *************************************************************************\n\nAjax.get = function(url, headers) {\n\treturn new Promise(function(resolve, reject) {\n\t\tonAjaxBefore();\n\n\t\tvar xhr = new XMLHttpRequest();\n\n\t\txhr.addEventListener(\"load\", function(event) {\n\t\t\tonAjaxResponse(\"success\", xhr.status, event, resolve, null, xhr);\n\t\t});\n\t\txhr.addEventListener(\"error\", function(event) {\n\t\t\tonAjaxResponse(\"error\", xhr.status, event, reject, null, xhr);\n\t\t});\n\n\t\txhr.open(\"GET\", url);\n\t\txhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n\n\t\tif (headers) {\n\t\t\tfor (const key in headers) {\n\t\t\t\txhr.setRequestHeader(key, headers[key]);\n\t\t\t}\n\t\t}\n\n\t\txhr.send();\n\t});\n}\n\n\n// *************************************************************************\n// Obecn\u00FD POST po\u017Eadavek.\n// *************************************************************************\n\nAjax.post = function(url, data) {\n\treturn new Promise(function(resolve, reject) {\n\t\tonAjaxBefore();\n\n\t\tvar xhr = new XMLHttpRequest();\n\n\t\txhr.addEventListener(\"load\", function(event) {\n\t\t\tonAjaxResponse(\"success\", xhr.status, event, resolve, null, xhr);\n\t\t});\n\t\txhr.addEventListener(\"error\", function(event) {\n\t\t\tonAjaxResponse(\"error\", xhr.status, event, reject, null, xhr);\n\t\t});\n\n\t\txhr.open(\"POST\", url);\n\t\txhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n\t\txhr.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n\t\txhr.setRequestHeader(\"X-CSRF-Token\", getCsrfToken());\n\n\t\tvar encoded = \"\";\n\t\tfor (var key in data) {\n\t\t\tif (encoded) {\n\t\t\t\tencoded += \"&\";\n\t\t\t}\n\t\t\tencoded += encodeURIComponent(key) + \"=\" + encodeURIComponent(data[key]);\n\t\t}\n\n\t\txhr.send(encoded);\n\t});\n}\n\n\n// *************************************************************************\n// Odesl\u00E1n\u00ED formul\u00E1\u0159e.\n// *************************************************************************\n\nAjax.submit = function(form, submitter) {\n\treturn new Promise(function(resolve, reject) {\n\t\tvar method = form.getAttribute(\"method\");\n\t\tvar action = form.getAttribute(\"action\");\n\n\t\tform.classList.add(\"sending-request\");\n\t\tonAjaxBefore(form);\n\n\t\tvar xhr = new XMLHttpRequest();\n\t\tvar formData = new FormData(form);\n\n\t\tif (submitter && submitter.name) {\n\t\t\tformData.append(submitter.name, submitter.value);\n\t\t}\n\n\t\txhr.addEventListener(\"load\", function(event) {\n\t\t\tform.classList.remove(\"sending-request\");\n\t\t\tonAjaxResponse(\"success\", xhr.status, event, resolve, form, xhr);\n\t\t});\n\t\txhr.addEventListener(\"error\", function(event) {\n\t\t\tform.classList.remove(\"sending-request\");\n\t\t\tonAjaxResponse(\"error\", xhr.status, event, reject, form, xhr);\n\t\t});\n\n\t\tif (method.toUpperCase() == \"GET\") {\n\t\t\t// Po\u017Eadavek GET a POST se li\u0161\u00ED. U GET po\u017Eadavku data p\u0159ed\u00E1v\u00E1me v URL.\n\n\t\t\tvar formDataEntries = formData.entries();\n\t\t\tvar formDataEntry = formDataEntries.next();\n\t\t\twhile (!formDataEntry.done) {\n\t\t\t\tvar key = formDataEntry.value[0];\n\t\t\t\tvar value = formDataEntry.value[1];\n\n\t\t\t\tif (0 <= action.indexOf(\"?\")) {\n\t\t\t\t\taction += \"&\";\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\taction += \"?\";\n\t\t\t\t}\n\t\t\t\taction += encodeURIComponent(key) + \"=\" + encodeURIComponent(value);\n\n\t\t\t\tformDataEntry = formDataEntries.next();\n\t\t\t}\n\n\t\t\txhr.open(method, action);\n\t\t\txhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n\t\t\txhr.setRequestHeader(\"X-CSRF-Token\", getCsrfToken());\n\t\t\txhr.send();\n\t\t}\n\t\telse {\n\t\t\txhr.open(method, action);\n\t\t\txhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n\t\t\txhr.setRequestHeader(\"X-CSRF-Token\", getCsrfToken());\n\t\t\txhr.send(formData);\n\t\t}\n\n\t});\n}\n\n\n//\n// Odesl\u00E1n\u00ED formul\u00E1\u0159e p\u0159es AJAX sta\u010D\u00ED odchytnut\u00EDm ud\u00E1losti \"submit\",\n// nen\u00ED nutn\u00E9 p\u0159edem \"skenovat\" DOM strom, vyhledat v\u0161echny formul\u00E1\u0159e\n// a k nim registrovat handlery ud\u00E1losti \"submit\".\n//\ndocument.addEventListener(\"submit\", function(event) {\n\tlet form = event.target;\n\tif (!form.matches(\"form[data-remote='true']\")) {\n\t\treturn;\n\t}\n\n\tlet submitter = event.submitter;\n\n\t// Temporary \"polyfill\".\n\t// For Safari bellow 15, there must be onclick attribute on submit buttons:\n\t//