{ "version": 3, "sources": ["../../node_modules/aos/dist/aos.js", "../../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/slider.js", "../../node_modules/@story/story_assets/app/assets/javascripts/slide.js", "../../node_modules/@story/story_assets/app/assets/javascripts/modal/modal.js", "../../node_modules/@story/story_assets/app/assets/javascripts/modal/modal_gallery.js", "../../node_modules/@story/story_assets/app/assets/javascripts/ajax_form.js", "../../app/assets/javascripts/components/multiselect.js", "../../app/assets/javascripts/components/instareels.js", "../../app/assets/javascripts/application.js"], "sourcesContent": ["!function(e,t){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define([],t):\"object\"==typeof exports?exports.AOS=t():e.AOS=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p=\"dist/\",t(0)}([function(e,t,n){\"use strict\";function o(e){return e&&e.__esModule?e:{default:e}}var i=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0];if(e&&(k=!0),k)return w=(0,y.default)(w,x),(0,b.default)(w,x.once),w},O=function(){w=(0,h.default)(),j()},M=function(){w.forEach(function(e,t){e.node.removeAttribute(\"data-aos\"),e.node.removeAttribute(\"data-aos-easing\"),e.node.removeAttribute(\"data-aos-duration\"),e.node.removeAttribute(\"data-aos-delay\")})},S=function(e){return e===!0||\"mobile\"===e&&p.default.mobile()||\"phone\"===e&&p.default.phone()||\"tablet\"===e&&p.default.tablet()||\"function\"==typeof e&&e()===!0},_=function(e){x=i(x,e),w=(0,h.default)();var t=document.all&&!window.atob;return S(x.disable)||t?M():(x.disableMutationObserver||d.default.isSupported()||(console.info('\\n aos: MutationObserver is not supported on this browser,\\n code mutations observing has been disabled.\\n You may have to call \"refreshHard()\" by yourself.\\n '),x.disableMutationObserver=!0),document.querySelector(\"body\").setAttribute(\"data-aos-easing\",x.easing),document.querySelector(\"body\").setAttribute(\"data-aos-duration\",x.duration),document.querySelector(\"body\").setAttribute(\"data-aos-delay\",x.delay),\"DOMContentLoaded\"===x.startEvent&&[\"complete\",\"interactive\"].indexOf(document.readyState)>-1?j(!0):\"load\"===x.startEvent?window.addEventListener(x.startEvent,function(){j(!0)}):document.addEventListener(x.startEvent,function(){j(!0)}),window.addEventListener(\"resize\",(0,s.default)(j,x.debounceDelay,!0)),window.addEventListener(\"orientationchange\",(0,s.default)(j,x.debounceDelay,!0)),window.addEventListener(\"scroll\",(0,u.default)(function(){(0,b.default)(w,x.once)},x.throttleDelay)),x.disableMutationObserver||d.default.ready(\"[data-aos]\",O),w)};e.exports={init:_,refresh:j,refreshHard:O}},function(e,t){},,,,,function(e,t){(function(t){\"use strict\";function n(e,t,n){function o(t){var n=b,o=v;return b=v=void 0,k=t,g=e.apply(o,n)}function r(e){return k=e,h=setTimeout(f,t),M?o(e):g}function a(e){var n=e-w,o=e-k,i=t-n;return S?j(i,y-o):i}function c(e){var n=e-w,o=e-k;return void 0===w||n>=t||n<0||S&&o>=y}function f(){var e=O();return c(e)?d(e):void(h=setTimeout(f,a(e)))}function d(e){return h=void 0,_&&b?o(e):(b=v=void 0,g)}function l(){void 0!==h&&clearTimeout(h),k=0,b=w=v=h=void 0}function p(){return void 0===h?g:d(O())}function m(){var e=O(),n=c(e);if(b=arguments,v=this,w=e,n){if(void 0===h)return r(w);if(S)return h=setTimeout(f,t),o(w)}return void 0===h&&(h=setTimeout(f,t)),g}var b,v,y,g,h,w,k=0,M=!1,S=!1,_=!0;if(\"function\"!=typeof e)throw new TypeError(s);return t=u(t)||0,i(n)&&(M=!!n.leading,S=\"maxWait\"in n,y=S?x(u(n.maxWait)||0,t):y,_=\"trailing\"in n?!!n.trailing:_),m.cancel=l,m.flush=p,m}function o(e,t,o){var r=!0,a=!0;if(\"function\"!=typeof e)throw new TypeError(s);return i(o)&&(r=\"leading\"in o?!!o.leading:r,a=\"trailing\"in o?!!o.trailing:a),n(e,t,{leading:r,maxWait:t,trailing:a})}function i(e){var t=\"undefined\"==typeof e?\"undefined\":c(e);return!!e&&(\"object\"==t||\"function\"==t)}function r(e){return!!e&&\"object\"==(\"undefined\"==typeof e?\"undefined\":c(e))}function a(e){return\"symbol\"==(\"undefined\"==typeof e?\"undefined\":c(e))||r(e)&&k.call(e)==d}function u(e){if(\"number\"==typeof e)return e;if(a(e))return f;if(i(e)){var t=\"function\"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+\"\":t}if(\"string\"!=typeof e)return 0===e?e:+e;e=e.replace(l,\"\");var n=m.test(e);return n||b.test(e)?v(e.slice(2),n?2:8):p.test(e)?f:+e}var c=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e},s=\"Expected a function\",f=NaN,d=\"[object Symbol]\",l=/^\\s+|\\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,m=/^0b[01]+$/i,b=/^0o[0-7]+$/i,v=parseInt,y=\"object\"==(\"undefined\"==typeof t?\"undefined\":c(t))&&t&&t.Object===Object&&t,g=\"object\"==(\"undefined\"==typeof self?\"undefined\":c(self))&&self&&self.Object===Object&&self,h=y||g||Function(\"return this\")(),w=Object.prototype,k=w.toString,x=Math.max,j=Math.min,O=function(){return h.Date.now()};e.exports=o}).call(t,function(){return this}())},function(e,t){(function(t){\"use strict\";function n(e,t,n){function i(t){var n=b,o=v;return b=v=void 0,O=t,g=e.apply(o,n)}function r(e){return O=e,h=setTimeout(f,t),M?i(e):g}function u(e){var n=e-w,o=e-O,i=t-n;return S?x(i,y-o):i}function s(e){var n=e-w,o=e-O;return void 0===w||n>=t||n<0||S&&o>=y}function f(){var e=j();return s(e)?d(e):void(h=setTimeout(f,u(e)))}function d(e){return h=void 0,_&&b?i(e):(b=v=void 0,g)}function l(){void 0!==h&&clearTimeout(h),O=0,b=w=v=h=void 0}function p(){return void 0===h?g:d(j())}function m(){var e=j(),n=s(e);if(b=arguments,v=this,w=e,n){if(void 0===h)return r(w);if(S)return h=setTimeout(f,t),i(w)}return void 0===h&&(h=setTimeout(f,t)),g}var b,v,y,g,h,w,O=0,M=!1,S=!1,_=!0;if(\"function\"!=typeof e)throw new TypeError(c);return t=a(t)||0,o(n)&&(M=!!n.leading,S=\"maxWait\"in n,y=S?k(a(n.maxWait)||0,t):y,_=\"trailing\"in n?!!n.trailing:_),m.cancel=l,m.flush=p,m}function o(e){var t=\"undefined\"==typeof e?\"undefined\":u(e);return!!e&&(\"object\"==t||\"function\"==t)}function i(e){return!!e&&\"object\"==(\"undefined\"==typeof e?\"undefined\":u(e))}function r(e){return\"symbol\"==(\"undefined\"==typeof e?\"undefined\":u(e))||i(e)&&w.call(e)==f}function a(e){if(\"number\"==typeof e)return e;if(r(e))return s;if(o(e)){var t=\"function\"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+\"\":t}if(\"string\"!=typeof e)return 0===e?e:+e;e=e.replace(d,\"\");var n=p.test(e);return n||m.test(e)?b(e.slice(2),n?2:8):l.test(e)?s:+e}var u=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e},c=\"Expected a function\",s=NaN,f=\"[object Symbol]\",d=/^\\s+|\\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,m=/^0o[0-7]+$/i,b=parseInt,v=\"object\"==(\"undefined\"==typeof t?\"undefined\":u(t))&&t&&t.Object===Object&&t,y=\"object\"==(\"undefined\"==typeof self?\"undefined\":u(self))&&self&&self.Object===Object&&self,g=v||y||Function(\"return this\")(),h=Object.prototype,w=h.toString,k=Math.max,x=Math.min,j=function(){return g.Date.now()};e.exports=n}).call(t,function(){return this}())},function(e,t){\"use strict\";function n(e){var t=void 0,o=void 0,i=void 0;for(t=0;te.position?e.node.classList.add(\"aos-animate\"):\"undefined\"!=typeof o&&(\"false\"===o||!n&&\"true\"!==o)&&e.node.classList.remove(\"aos-animate\")},o=function(e,t){var o=window.pageYOffset,i=window.innerHeight;e.forEach(function(e,r){n(e,i+o,t)})};t.default=o},function(e,t,n){\"use strict\";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,\"__esModule\",{value:!0});var i=n(12),r=o(i),a=function(e,t){return e.forEach(function(e,n){e.node.classList.add(\"aos-init\"),e.position=(0,r.default)(e.node,t.offset)}),e};t.default=a},function(e,t,n){\"use strict\";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,\"__esModule\",{value:!0});var i=n(13),r=o(i),a=function(e,t){var n=0,o=0,i=window.innerHeight,a={offset:e.getAttribute(\"data-aos-offset\"),anchor:e.getAttribute(\"data-aos-anchor\"),anchorPlacement:e.getAttribute(\"data-aos-anchor-placement\")};switch(a.offset&&!isNaN(a.offset)&&(o=parseInt(a.offset)),a.anchor&&document.querySelectorAll(a.anchor)&&(e=document.querySelectorAll(a.anchor)[0]),n=(0,r.default)(e).top,a.anchorPlacement){case\"top-bottom\":break;case\"center-bottom\":n+=e.offsetHeight/2;break;case\"bottom-bottom\":n+=e.offsetHeight;break;case\"top-center\":n+=i/2;break;case\"bottom-center\":n+=i/2+e.offsetHeight;break;case\"center-center\":n+=i/2+e.offsetHeight/2;break;case\"top-top\":n+=i;break;case\"bottom-top\":n+=e.offsetHeight+i;break;case\"center-top\":n+=e.offsetHeight/2+i}return a.anchorPlacement||a.offset||isNaN(t)||(o=t),n+o};t.default=a},function(e,t){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0});var n=function(e){for(var t=0,n=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-(\"BODY\"!=e.tagName?e.scrollLeft:0),n+=e.offsetTop-(\"BODY\"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:n,left:t}};t.default=n},function(e,t){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0});var n=function(e){return e=e||document.querySelectorAll(\"[data-aos]\"),Array.prototype.map.call(e,function(e){return{node:e}})};t.default=n}])});", "/**\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//