").html(a.find(".ui-tooltip-content").html()),h.removeAttr("name").find("[name]").removeAttr("name"),h.removeAttr("id").find("[id]").removeAttr("id"),h.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(l.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(e){var i=t("
").attr("role","tooltip"),s=t("
").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),t.uiBackCompat!==!1&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip});
-/* Rails UJS 5.2.3 */
-(function(){(function(){(function(){this.Rails={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]",buttonClickSelector:{selector:"button[data-remote]:not([form]), button[data-confirm]:not([form])",exclude:"form button"},inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])",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",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",fileInputSelector:"input[name][type=file]:not([disabled])",linkDisableSelector:"a[data-disable-with], a[data-disable]",buttonDisableSelector:"button[data-remote][data-disable-with], button[data-remote][data-disable]"}}).call(this)}).call(this);var S=this.Rails;(function(){(function(){var e;e=null,S.loadCSPNonce=function(){var t;return e=null!=(t=document.querySelector("meta[name=csp-nonce]"))?t.content:void 0},S.cspNonce=function(){return null!=e?e:S.loadCSPNonce()}}).call(this),function(){var a,n;n=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,S.matches=function(t,e){return null!=e.exclude?n.call(t,e.selector)&&!n.call(t,e.exclude):n.call(t,e)},a="_ujsData",S.getData=function(t,e){var n;return null!=(n=t[a])?n[e]:void 0},S.setData=function(t,e,n){return null==t[a]&&(t[a]={}),t[a][e]=n},S.$=function(t){return Array.prototype.slice.call(document.querySelectorAll(t))}}.call(this),function(){var n,a,o;n=S.$,o=S.csrfToken=function(){var t;return(t=document.querySelector("meta[name=csrf-token]"))&&t.content},a=S.csrfParam=function(){var t;return(t=document.querySelector("meta[name=csrf-param]"))&&t.content},S.CSRFProtection=function(t){var e;if(null!=(e=o()))return t.setRequestHeader("X-CSRF-Token",e)},S.refreshCSRFTokens=function(){var t,e;if(e=o(),t=a(),null!=e&&null!=t)return n('form input[name="'+t+'"]').forEach(function(t){return t.value=e})}}.call(this),function(){var o,e,r,n;r=S.matches,"function"!=typeof(o=window.CustomEvent)&&((o=function(t,e){var n;return(n=document.createEvent("CustomEvent")).initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}).prototype=window.Event.prototype,n=o.prototype.preventDefault,o.prototype.preventDefault=function(){var t;return t=n.call(this),this.cancelable&&!this.defaultPrevented&&Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}),t}),e=S.fire=function(t,e,n){var a;return a=new o(e,{bubbles:!0,cancelable:!0,detail:n}),t.dispatchEvent(a),!a.defaultPrevented},S.stopEverything=function(t){return e(t.target,"ujs:everythingStopped"),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()},S.delegate=function(t,n,e,a){return t.addEventListener(e,function(t){var e;for(e=t.target;e instanceof Element&&!r(e,n);)e=e.parentNode;if(e instanceof Element&&!1===a.call(e,t))return t.preventDefault(),t.stopPropagation()})}}.call(this),function(){var e,a,t,o,r,i;o=S.cspNonce,a=S.CSRFProtection,S.fire,e={"*":"*/*",text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript",script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},S.ajax=function(n){var a;return n=r(n),a=t(n,function(){var t,e;return e=i(null!=(t=a.response)?t:a.responseText,a.getResponseHeader("Content-Type")),2===Math.floor(a.status/100)?"function"==typeof n.success&&n.success(e,a.statusText,a):"function"==typeof n.error&&n.error(e,a.statusText,a),"function"==typeof n.complete?n.complete(a,a.statusText):void 0}),!(null!=n.beforeSend&&!n.beforeSend(a,n))&&(a.readyState===XMLHttpRequest.OPENED?a.send(n.data):void 0)},r=function(t){return t.url=t.url||location.href,t.type=t.type.toUpperCase(),"GET"===t.type&&t.data&&(t.url.indexOf("?")<0?t.url+="?"+t.data:t.url+="&"+t.data),null==e[t.dataType]&&(t.dataType="*"),t.accept=e[t.dataType],"*"!==t.dataType&&(t.accept+=", */*; q=0.01"),t},t=function(t,e){var n;return(n=new XMLHttpRequest).open(t.type,t.url,!0),n.setRequestHeader("Accept",t.accept),"string"==typeof t.data&&n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),t.crossDomain||n.setRequestHeader("X-Requested-With","XMLHttpRequest"),a(n),n.withCredentials=!!t.withCredentials,n.onreadystatechange=function(){if(n.readyState===XMLHttpRequest.DONE)return e(n)},n},i=function(t,e){var n,a;if("string"==typeof t&&"string"==typeof e)if(e.match(/\bjson\b/))try{t=JSON.parse(t)}catch(t){}else if(e.match(/\b(?:java|ecma)script\b/))(a=document.createElement("script")).setAttribute("nonce",o()),a.text=t,document.head.appendChild(a).parentNode.removeChild(a);else if(e.match(/\b(xml|html|svg)\b/)){n=new DOMParser,e=e.replace(/;.+/,"");try{t=n.parseFromString(t,e)}catch(t){}}return t},S.href=function(t){return t.href},S.isCrossDomain=function(t){var e,n;(e=document.createElement("a")).href=location.href,n=document.createElement("a");try{return n.href=t,!((!n.protocol||":"===n.protocol)&&!n.host||e.protocol+"//"+e.host==n.protocol+"//"+n.host)}catch(t){return t,!0}}}.call(this),function(){var o,r;o=S.matches,r=function(t){return Array.prototype.slice.call(t)},S.serializeElement=function(t,e){var n,a;return n=[t],o(t,"form")&&(n=r(t.elements)),a=[],n.forEach(function(e){if(e.name&&!e.disabled)return o(e,"select")?r(e.options).forEach(function(t){if(t.selected)return a.push({name:e.name,value:t.value})}):e.checked||-1===["radio","checkbox","submit"].indexOf(e.type)?a.push({name:e.name,value:e.value}):void 0}),e&&a.push(e),a.map(function(t){return null!=t.name?encodeURIComponent(t.name)+"="+encodeURIComponent(t.value):t}).join("&")},S.formElements=function(t,e){return o(t,"form")?r(t.elements).filter(function(t){return o(t,e)}):r(t.querySelectorAll(e))}}.call(this),function(){var e,o,n;o=S.fire,n=S.stopEverything,S.handleConfirm=function(t){if(!e(this))return n(t)},e=function(t){var e,n,a;if(!(a=t.getAttribute("data-confirm")))return!0;if(e=!1,o(t,"confirm")){try{e=confirm(a)}catch(t){}n=o(t,"confirm:complete",[e])}return e&&n}}.call(this),function(){var n,a,o,r,i,l,e,u,c,s,d;c=S.matches,u=S.getData,s=S.setData,d=S.stopEverything,e=S.formElements,S.handleDisabledElement=function(t){if(this.disabled)return d(t)},S.enableElement=function(t){var e;return e=t instanceof Event?t.target:t,c(e,S.linkDisableSelector)?l(e):c(e,S.buttonDisableSelector)||c(e,S.formEnableSelector)?r(e):c(e,S.formSubmitSelector)?i(e):void 0},S.disableElement=function(t){var e;return e=t instanceof Event?t.target:t,c(e,S.linkDisableSelector)?o(e):c(e,S.buttonDisableSelector)||c(e,S.formDisableSelector)?n(e):c(e,S.formSubmitSelector)?a(e):void 0},o=function(t){var e;return null!=(e=t.getAttribute("data-disable-with"))&&(s(t,"ujs:enable-with",t.innerHTML),t.innerHTML=e),t.addEventListener("click",d),s(t,"ujs:disabled",!0)},l=function(t){var e;return null!=(e=u(t,"ujs:enable-with"))&&(t.innerHTML=e,s(t,"ujs:enable-with",null)),t.removeEventListener("click",d),s(t,"ujs:disabled",null)},a=function(t){return e(t,S.formDisableSelector).forEach(n)},n=function(t){var e;return null!=(e=t.getAttribute("data-disable-with"))&&(c(t,"button")?(s(t,"ujs:enable-with",t.innerHTML),t.innerHTML=e):(s(t,"ujs:enable-with",t.value),t.value=e)),t.disabled=!0,s(t,"ujs:disabled",!0)},i=function(t){return e(t,S.formEnableSelector).forEach(r)},r=function(t){var e;return null!=(e=u(t,"ujs:enable-with"))&&(c(t,"button")?t.innerHTML=e:t.value=e,s(t,"ujs:enable-with",null)),t.disabled=!1,s(t,"ujs:disabled",null)}}.call(this),function(){var l;l=S.stopEverything,S.handleMethod=function(t){var e,n,a,o,r,i;if(i=this.getAttribute("data-method"))return r=S.href(this),n=S.csrfToken(),e=S.csrfParam(),a=document.createElement("form"),o="",null==e||null==n||S.isCrossDomain(r)||(o+=""),o+='',a.method="post",a.action=r,a.target=this.target,a.innerHTML=o,a.style.display="none",document.body.appendChild(a),a.querySelector('[type="submit"]').click(),l(t)}}.call(this),function(){var u,c,s,d,m,f,p,b,h,v=[].slice;f=S.matches,s=S.getData,b=S.setData,c=S.fire,h=S.stopEverything,u=S.ajax,d=S.isCrossDomain,p=S.serializeElement,m=function(t){var e;return null!=(e=t.getAttribute("data-remote"))&&"false"!==e},S.handleRemote=function(t){var e,n,a,o,r,i,l;return!m(o=this)||(c(o,"ajax:before")?(l=o.getAttribute("data-with-credentials"),a=o.getAttribute("data-type")||"script",f(o,S.formSubmitSelector)?(e=s(o,"ujs:submit-button"),r=s(o,"ujs:submit-button-formmethod")||o.method,i=s(o,"ujs:submit-button-formaction")||o.getAttribute("action")||location.href,"GET"===r.toUpperCase()&&(i=i.replace(/\?.*$/,"")),"multipart/form-data"===o.enctype?(n=new FormData(o),null!=e&&n.append(e.name,e.value)):n=p(o,e),b(o,"ujs:submit-button",null),b(o,"ujs:submit-button-formmethod",null),b(o,"ujs:submit-button-formaction",null)):n=f(o,S.buttonClickSelector)||f(o,S.inputChangeSelector)?(r=o.getAttribute("data-method"),i=o.getAttribute("data-url"),p(o,o.getAttribute("data-params"))):(r=o.getAttribute("data-method"),i=S.href(o),o.getAttribute("data-params")),u({type:r||"GET",url:i,data:n,dataType:a,beforeSend:function(t,e){return c(o,"ajax:beforeSend",[t,e])?c(o,"ajax:send",[t]):(c(o,"ajax:stopped"),!1)},success:function(){var t;return t=1<=arguments.length?v.call(arguments,0):[],c(o,"ajax:success",t)},error:function(){var t;return t=1<=arguments.length?v.call(arguments,0):[],c(o,"ajax:error",t)},complete:function(){var t;return t=1<=arguments.length?v.call(arguments,0):[],c(o,"ajax:complete",t)},crossDomain:d(i),withCredentials:null!=l&&"false"!==l}),h(t)):(c(o,"ajax:stopped"),!1))},S.formSubmitButtonClick=function(t){var e,n;if(n=(e=this).form)return e.name&&b(n,"ujs:submit-button",{name:e.name,value:e.value}),b(n,"ujs:formnovalidate-button",e.formNoValidate),b(n,"ujs:submit-button-formaction",e.getAttribute("formaction")),b(n,"ujs:submit-button-formmethod",e.getAttribute("formmethod"))},S.preventInsignificantClick=function(t){var e,n,a;if(a=(this.getAttribute("data-method")||"GET").toUpperCase(),e=this.getAttribute("data-params"),n=(t.metaKey||t.ctrlKey)&&"GET"===a&&!e,!(0===t.button)||n)return t.stopImmediatePropagation()}}.call(this),function(){var t,a,e,n,o,r,i,l,u,c,s,d,m,f,p;if(r=S.fire,e=S.delegate,l=S.getData,t=S.$,p=S.refreshCSRFTokens,a=S.CSRFProtection,m=S.loadCSPNonce,o=S.enableElement,n=S.disableElement,c=S.handleDisabledElement,u=S.handleConfirm,f=S.preventInsignificantClick,d=S.handleRemote,i=S.formSubmitButtonClick,s=S.handleMethod,"undefined"!=typeof jQuery&&null!==jQuery&&null!=jQuery.ajax){if(jQuery.rails)throw new Error("If you load both jquery_ujs and rails-ujs, use rails-ujs only.");jQuery.rails=S,jQuery.ajaxPrefilter(function(t,e,n){if(!t.crossDomain)return a(n)})}S.start=function(){if(window._rails_loaded)throw new Error("rails-ujs has already been loaded!");return window.addEventListener("pageshow",function(){return t(S.formEnableSelector).forEach(function(t){if(l(t,"ujs:disabled"))return o(t)}),t(S.linkDisableSelector).forEach(function(t){if(l(t,"ujs:disabled"))return o(t)})}),e(document,S.linkDisableSelector,"ajax:complete",o),e(document,S.linkDisableSelector,"ajax:stopped",o),e(document,S.buttonDisableSelector,"ajax:complete",o),e(document,S.buttonDisableSelector,"ajax:stopped",o),e(document,S.linkClickSelector,"click",f),e(document,S.linkClickSelector,"click",c),e(document,S.linkClickSelector,"click",u),e(document,S.linkClickSelector,"click",n),e(document,S.linkClickSelector,"click",d),e(document,S.linkClickSelector,"click",s),e(document,S.buttonClickSelector,"click",f),e(document,S.buttonClickSelector,"click",c),e(document,S.buttonClickSelector,"click",u),e(document,S.buttonClickSelector,"click",n),e(document,S.buttonClickSelector,"click",d),e(document,S.inputChangeSelector,"change",c),e(document,S.inputChangeSelector,"change",u),e(document,S.inputChangeSelector,"change",d),e(document,S.formSubmitSelector,"submit",c),e(document,S.formSubmitSelector,"submit",u),e(document,S.formSubmitSelector,"submit",d),e(document,S.formSubmitSelector,"submit",function(t){return setTimeout(function(){return n(t)},13)}),e(document,S.formSubmitSelector,"ajax:send",n),e(document,S.formSubmitSelector,"ajax:complete",o),e(document,S.formInputClickSelector,"click",f),e(document,S.formInputClickSelector,"click",c),e(document,S.formInputClickSelector,"click",u),e(document,S.formInputClickSelector,"click",i),document.addEventListener("DOMContentLoaded",p),document.addEventListener("DOMContentLoaded",m),window._rails_loaded=!0},window.Rails===S&&r(document,"rails:attachBindings")&&S.start()}.call(this)}).call(this),"object"==typeof module&&module.exports?module.exports=S:"function"==typeof define&&define.amd&&define(S)}).call(this);
+/* Rails UJS 5.2.4.5 */
+/*
+Unobtrusive JavaScript
+https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts
+Released under the MIT license
+ */;
+
+(function() {
+ var context = this;
+
+ (function() {
+ (function() {
+ this.Rails = {
+ linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
+ buttonClickSelector: {
+ selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',
+ exclude: 'form button'
+ },
+ inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
+ formSubmitSelector: 'form',
+ formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
+ 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',
+ 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',
+ fileInputSelector: 'input[name][type=file]:not([disabled])',
+ linkDisableSelector: 'a[data-disable-with], a[data-disable]',
+ buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'
+ };
+
+ }).call(this);
+ }).call(context);
+
+ var Rails = context.Rails;
+
+ (function() {
+ (function() {
+ var nonce;
+
+ nonce = null;
+
+ Rails.loadCSPNonce = function() {
+ var ref;
+ return nonce = (ref = document.querySelector("meta[name=csp-nonce]")) != null ? ref.content : void 0;
+ };
+
+ Rails.cspNonce = function() {
+ return nonce != null ? nonce : Rails.loadCSPNonce();
+ };
+
+ }).call(this);
+ (function() {
+ var expando, m;
+
+ m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;
+
+ Rails.matches = function(element, selector) {
+ if (selector.exclude != null) {
+ return m.call(element, selector.selector) && !m.call(element, selector.exclude);
+ } else {
+ return m.call(element, selector);
+ }
+ };
+
+ expando = '_ujsData';
+
+ Rails.getData = function(element, key) {
+ var ref;
+ return (ref = element[expando]) != null ? ref[key] : void 0;
+ };
+
+ Rails.setData = function(element, key, value) {
+ if (element[expando] == null) {
+ element[expando] = {};
+ }
+ return element[expando][key] = value;
+ };
+
+ Rails.$ = function(selector) {
+ return Array.prototype.slice.call(document.querySelectorAll(selector));
+ };
+
+ }).call(this);
+ (function() {
+ var $, csrfParam, csrfToken;
+
+ $ = Rails.$;
+
+ csrfToken = Rails.csrfToken = function() {
+ var meta;
+ meta = document.querySelector('meta[name=csrf-token]');
+ return meta && meta.content;
+ };
+
+ csrfParam = Rails.csrfParam = function() {
+ var meta;
+ meta = document.querySelector('meta[name=csrf-param]');
+ return meta && meta.content;
+ };
+
+ Rails.CSRFProtection = function(xhr) {
+ var token;
+ token = csrfToken();
+ if (token != null) {
+ return xhr.setRequestHeader('X-CSRF-Token', token);
+ }
+ };
+
+ Rails.refreshCSRFTokens = function() {
+ var param, token;
+ token = csrfToken();
+ param = csrfParam();
+ if ((token != null) && (param != null)) {
+ return $('form input[name="' + param + '"]').forEach(function(input) {
+ return input.value = token;
+ });
+ }
+ };
+
+ }).call(this);
+ (function() {
+ var CustomEvent, fire, matches, preventDefault;
+
+ matches = Rails.matches;
+
+ CustomEvent = window.CustomEvent;
+
+ if (typeof CustomEvent !== 'function') {
+ CustomEvent = function(event, params) {
+ var evt;
+ evt = document.createEvent('CustomEvent');
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
+ return evt;
+ };
+ CustomEvent.prototype = window.Event.prototype;
+ preventDefault = CustomEvent.prototype.preventDefault;
+ CustomEvent.prototype.preventDefault = function() {
+ var result;
+ result = preventDefault.call(this);
+ if (this.cancelable && !this.defaultPrevented) {
+ Object.defineProperty(this, 'defaultPrevented', {
+ get: function() {
+ return true;
+ }
+ });
+ }
+ return result;
+ };
+ }
+
+ fire = Rails.fire = function(obj, name, data) {
+ var event;
+ event = new CustomEvent(name, {
+ bubbles: true,
+ cancelable: true,
+ detail: data
+ });
+ obj.dispatchEvent(event);
+ return !event.defaultPrevented;
+ };
+
+ Rails.stopEverything = function(e) {
+ fire(e.target, 'ujs:everythingStopped');
+ e.preventDefault();
+ e.stopPropagation();
+ return e.stopImmediatePropagation();
+ };
+
+ Rails.delegate = function(element, selector, eventType, handler) {
+ return element.addEventListener(eventType, function(e) {
+ var target;
+ target = e.target;
+ while (!(!(target instanceof Element) || matches(target, selector))) {
+ target = target.parentNode;
+ }
+ if (target instanceof Element && handler.call(target, e) === false) {
+ e.preventDefault();
+ return e.stopPropagation();
+ }
+ });
+ };
+
+ }).call(this);
+ (function() {
+ var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;
+
+ cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;
+
+ AcceptHeaders = {
+ '*': '*/*',
+ text: 'text/plain',
+ html: 'text/html',
+ xml: 'application/xml, text/xml',
+ json: 'application/json, text/javascript',
+ script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'
+ };
+
+ Rails.ajax = function(options) {
+ var xhr;
+ options = prepareOptions(options);
+ xhr = createXHR(options, function() {
+ var ref, response;
+ response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));
+ if (Math.floor(xhr.status / 100) === 2) {
+ if (typeof options.success === "function") {
+ options.success(response, xhr.statusText, xhr);
+ }
+ } else {
+ if (typeof options.error === "function") {
+ options.error(response, xhr.statusText, xhr);
+ }
+ }
+ return typeof options.complete === "function" ? options.complete(xhr, xhr.statusText) : void 0;
+ });
+ if ((options.beforeSend != null) && !options.beforeSend(xhr, options)) {
+ return false;
+ }
+ if (xhr.readyState === XMLHttpRequest.OPENED) {
+ return xhr.send(options.data);
+ }
+ };
+
+ prepareOptions = function(options) {
+ options.url = options.url || location.href;
+ options.type = options.type.toUpperCase();
+ if (options.type === 'GET' && options.data) {
+ if (options.url.indexOf('?') < 0) {
+ options.url += '?' + options.data;
+ } else {
+ options.url += '&' + options.data;
+ }
+ }
+ if (AcceptHeaders[options.dataType] == null) {
+ options.dataType = '*';
+ }
+ options.accept = AcceptHeaders[options.dataType];
+ if (options.dataType !== '*') {
+ options.accept += ', */*; q=0.01';
+ }
+ return options;
+ };
+
+ createXHR = function(options, done) {
+ var xhr;
+ xhr = new XMLHttpRequest();
+ xhr.open(options.type, options.url, true);
+ xhr.setRequestHeader('Accept', options.accept);
+ if (typeof options.data === 'string') {
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
+ }
+ if (!options.crossDomain) {
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+ CSRFProtection(xhr);
+ }
+ xhr.withCredentials = !!options.withCredentials;
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ return done(xhr);
+ }
+ };
+ return xhr;
+ };
+
+ processResponse = function(response, type) {
+ var parser, script;
+ if (typeof response === 'string' && typeof type === 'string') {
+ if (type.match(/\bjson\b/)) {
+ try {
+ response = JSON.parse(response);
+ } catch (error) {}
+ } else if (type.match(/\b(?:java|ecma)script\b/)) {
+ script = document.createElement('script');
+ script.setAttribute('nonce', cspNonce());
+ script.text = response;
+ document.head.appendChild(script).parentNode.removeChild(script);
+ } else if (type.match(/\b(xml|html|svg)\b/)) {
+ parser = new DOMParser();
+ type = type.replace(/;.+/, '');
+ try {
+ response = parser.parseFromString(response, type);
+ } catch (error) {}
+ }
+ }
+ return response;
+ };
+
+ Rails.href = function(element) {
+ return element.href;
+ };
+
+ Rails.isCrossDomain = function(url) {
+ var e, originAnchor, urlAnchor;
+ originAnchor = document.createElement('a');
+ originAnchor.href = location.href;
+ urlAnchor = document.createElement('a');
+ try {
+ urlAnchor.href = url;
+ return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host));
+ } catch (error) {
+ e = error;
+ return true;
+ }
+ };
+
+ }).call(this);
+ (function() {
+ var matches, toArray;
+
+ matches = Rails.matches;
+
+ toArray = function(e) {
+ return Array.prototype.slice.call(e);
+ };
+
+ Rails.serializeElement = function(element, additionalParam) {
+ var inputs, params;
+ inputs = [element];
+ if (matches(element, 'form')) {
+ inputs = toArray(element.elements);
+ }
+ params = [];
+ inputs.forEach(function(input) {
+ if (!input.name || input.disabled) {
+ return;
+ }
+ if (matches(input, 'select')) {
+ return toArray(input.options).forEach(function(option) {
+ if (option.selected) {
+ return params.push({
+ name: input.name,
+ value: option.value
+ });
+ }
+ });
+ } else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {
+ return params.push({
+ name: input.name,
+ value: input.value
+ });
+ }
+ });
+ if (additionalParam) {
+ params.push(additionalParam);
+ }
+ return params.map(function(param) {
+ if (param.name != null) {
+ return (encodeURIComponent(param.name)) + "=" + (encodeURIComponent(param.value));
+ } else {
+ return param;
+ }
+ }).join('&');
+ };
+
+ Rails.formElements = function(form, selector) {
+ if (matches(form, 'form')) {
+ return toArray(form.elements).filter(function(el) {
+ return matches(el, selector);
+ });
+ } else {
+ return toArray(form.querySelectorAll(selector));
+ }
+ };
+
+ }).call(this);
+ (function() {
+ var allowAction, fire, stopEverything;
+
+ fire = Rails.fire, stopEverything = Rails.stopEverything;
+
+ Rails.handleConfirm = function(e) {
+ if (!allowAction(this)) {
+ return stopEverything(e);
+ }
+ };
+
+ allowAction = function(element) {
+ var answer, callback, message;
+ message = element.getAttribute('data-confirm');
+ if (!message) {
+ return true;
+ }
+ answer = false;
+ if (fire(element, 'confirm')) {
+ try {
+ answer = confirm(message);
+ } catch (error) {}
+ callback = fire(element, 'confirm:complete', [answer]);
+ }
+ return answer && callback;
+ };
+
+ }).call(this);
+ (function() {
+ var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, matches, setData, stopEverything;
+
+ matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;
+
+ Rails.handleDisabledElement = function(e) {
+ var element;
+ element = this;
+ if (element.disabled) {
+ return stopEverything(e);
+ }
+ };
+
+ Rails.enableElement = function(e) {
+ var element;
+ element = e instanceof Event ? e.target : e;
+ if (matches(element, Rails.linkDisableSelector)) {
+ return enableLinkElement(element);
+ } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {
+ return enableFormElement(element);
+ } else if (matches(element, Rails.formSubmitSelector)) {
+ return enableFormElements(element);
+ }
+ };
+
+ Rails.disableElement = function(e) {
+ var element;
+ element = e instanceof Event ? e.target : e;
+ if (matches(element, Rails.linkDisableSelector)) {
+ return disableLinkElement(element);
+ } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {
+ return disableFormElement(element);
+ } else if (matches(element, Rails.formSubmitSelector)) {
+ return disableFormElements(element);
+ }
+ };
+
+ disableLinkElement = function(element) {
+ var replacement;
+ replacement = element.getAttribute('data-disable-with');
+ if (replacement != null) {
+ setData(element, 'ujs:enable-with', element.innerHTML);
+ element.innerHTML = replacement;
+ }
+ element.addEventListener('click', stopEverything);
+ return setData(element, 'ujs:disabled', true);
+ };
+
+ enableLinkElement = function(element) {
+ var originalText;
+ originalText = getData(element, 'ujs:enable-with');
+ if (originalText != null) {
+ element.innerHTML = originalText;
+ setData(element, 'ujs:enable-with', null);
+ }
+ element.removeEventListener('click', stopEverything);
+ return setData(element, 'ujs:disabled', null);
+ };
+
+ disableFormElements = function(form) {
+ return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);
+ };
+
+ disableFormElement = function(element) {
+ var replacement;
+ replacement = element.getAttribute('data-disable-with');
+ if (replacement != null) {
+ if (matches(element, 'button')) {
+ setData(element, 'ujs:enable-with', element.innerHTML);
+ element.innerHTML = replacement;
+ } else {
+ setData(element, 'ujs:enable-with', element.value);
+ element.value = replacement;
+ }
+ }
+ element.disabled = true;
+ return setData(element, 'ujs:disabled', true);
+ };
+
+ enableFormElements = function(form) {
+ return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);
+ };
+
+ enableFormElement = function(element) {
+ var originalText;
+ originalText = getData(element, 'ujs:enable-with');
+ if (originalText != null) {
+ if (matches(element, 'button')) {
+ element.innerHTML = originalText;
+ } else {
+ element.value = originalText;
+ }
+ setData(element, 'ujs:enable-with', null);
+ }
+ element.disabled = false;
+ return setData(element, 'ujs:disabled', null);
+ };
+
+ }).call(this);
+ (function() {
+ var stopEverything;
+
+ stopEverything = Rails.stopEverything;
+
+ Rails.handleMethod = function(e) {
+ var csrfParam, csrfToken, form, formContent, href, link, method;
+ link = this;
+ method = link.getAttribute('data-method');
+ if (!method) {
+ return;
+ }
+ href = Rails.href(link);
+ csrfToken = Rails.csrfToken();
+ csrfParam = Rails.csrfParam();
+ form = document.createElement('form');
+ formContent = "";
+ if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) {
+ formContent += "";
+ }
+ formContent += '';
+ form.method = 'post';
+ form.action = href;
+ form.target = link.target;
+ form.innerHTML = formContent;
+ form.style.display = 'none';
+ document.body.appendChild(form);
+ form.querySelector('[type="submit"]').click();
+ return stopEverything(e);
+ };
+
+ }).call(this);
+ (function() {
+ var ajax, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,
+ slice = [].slice;
+
+ matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement;
+
+ isRemote = function(element) {
+ var value;
+ value = element.getAttribute('data-remote');
+ return (value != null) && value !== 'false';
+ };
+
+ Rails.handleRemote = function(e) {
+ var button, data, dataType, element, method, url, withCredentials;
+ element = this;
+ if (!isRemote(element)) {
+ return true;
+ }
+ if (!fire(element, 'ajax:before')) {
+ fire(element, 'ajax:stopped');
+ return false;
+ }
+ withCredentials = element.getAttribute('data-with-credentials');
+ dataType = element.getAttribute('data-type') || 'script';
+ if (matches(element, Rails.formSubmitSelector)) {
+ button = getData(element, 'ujs:submit-button');
+ method = getData(element, 'ujs:submit-button-formmethod') || element.method;
+ url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;
+ if (method.toUpperCase() === 'GET') {
+ url = url.replace(/\?.*$/, '');
+ }
+ if (element.enctype === 'multipart/form-data') {
+ data = new FormData(element);
+ if (button != null) {
+ data.append(button.name, button.value);
+ }
+ } else {
+ data = serializeElement(element, button);
+ }
+ setData(element, 'ujs:submit-button', null);
+ setData(element, 'ujs:submit-button-formmethod', null);
+ setData(element, 'ujs:submit-button-formaction', null);
+ } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {
+ method = element.getAttribute('data-method');
+ url = element.getAttribute('data-url');
+ data = serializeElement(element, element.getAttribute('data-params'));
+ } else {
+ method = element.getAttribute('data-method');
+ url = Rails.href(element);
+ data = element.getAttribute('data-params');
+ }
+ ajax({
+ type: method || 'GET',
+ url: url,
+ data: data,
+ dataType: dataType,
+ beforeSend: function(xhr, options) {
+ if (fire(element, 'ajax:beforeSend', [xhr, options])) {
+ return fire(element, 'ajax:send', [xhr]);
+ } else {
+ fire(element, 'ajax:stopped');
+ return false;
+ }
+ },
+ success: function() {
+ var args;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ return fire(element, 'ajax:success', args);
+ },
+ error: function() {
+ var args;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ return fire(element, 'ajax:error', args);
+ },
+ complete: function() {
+ var args;
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ return fire(element, 'ajax:complete', args);
+ },
+ crossDomain: isCrossDomain(url),
+ withCredentials: (withCredentials != null) && withCredentials !== 'false'
+ });
+ return stopEverything(e);
+ };
+
+ Rails.formSubmitButtonClick = function(e) {
+ var button, form;
+ button = this;
+ form = button.form;
+ if (!form) {
+ return;
+ }
+ if (button.name) {
+ setData(form, 'ujs:submit-button', {
+ name: button.name,
+ value: button.value
+ });
+ }
+ setData(form, 'ujs:formnovalidate-button', button.formNoValidate);
+ setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));
+ return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));
+ };
+
+ Rails.preventInsignificantClick = function(e) {
+ var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;
+ link = this;
+ method = (link.getAttribute('data-method') || 'GET').toUpperCase();
+ data = link.getAttribute('data-params');
+ metaClick = e.metaKey || e.ctrlKey;
+ insignificantMetaClick = metaClick && method === 'GET' && !data;
+ nonPrimaryMouseClick = (e.button != null) && e.button !== 0;
+ if (nonPrimaryMouseClick || insignificantMetaClick) {
+ return e.stopImmediatePropagation();
+ }
+ };
+
+ }).call(this);
+ (function() {
+ var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;
+
+ 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;
+
+ if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null)) {
+ if (jQuery.rails) {
+ throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');
+ }
+ jQuery.rails = Rails;
+ jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
+ if (!options.crossDomain) {
+ return CSRFProtection(xhr);
+ }
+ });
+ }
+
+ Rails.start = function() {
+ if (window._rails_loaded) {
+ throw new Error('rails-ujs has already been loaded!');
+ }
+ window.addEventListener('pageshow', function() {
+ $(Rails.formEnableSelector).forEach(function(el) {
+ if (getData(el, 'ujs:disabled')) {
+ return enableElement(el);
+ }
+ });
+ return $(Rails.linkDisableSelector).forEach(function(el) {
+ if (getData(el, 'ujs:disabled')) {
+ return enableElement(el);
+ }
+ });
+ });
+ delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);
+ delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);
+ delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);
+ delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);
+ delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);
+ delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);
+ delegate(document, Rails.linkClickSelector, 'click', handleConfirm);
+ delegate(document, Rails.linkClickSelector, 'click', disableElement);
+ delegate(document, Rails.linkClickSelector, 'click', handleRemote);
+ delegate(document, Rails.linkClickSelector, 'click', handleMethod);
+ delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);
+ delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);
+ delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);
+ delegate(document, Rails.buttonClickSelector, 'click', disableElement);
+ delegate(document, Rails.buttonClickSelector, 'click', handleRemote);
+ delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);
+ delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);
+ delegate(document, Rails.inputChangeSelector, 'change', handleRemote);
+ delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);
+ delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);
+ delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);
+ delegate(document, Rails.formSubmitSelector, 'submit', function(e) {
+ return setTimeout((function() {
+ return disableElement(e);
+ }), 13);
+ });
+ delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);
+ delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);
+ delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);
+ delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);
+ delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
+ delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
+ document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
+ document.addEventListener('DOMContentLoaded', loadCSPNonce);
+ return window._rails_loaded = true;
+ };
+
+ if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {
+ Rails.start();
+ }
+
+ }).call(this);
+ }).call(this);
+
+ if (typeof module === "object" && module.exports) {
+ module.exports = Rails;
+ } else if (typeof define === "function" && define.amd) {
+ define(Rails);
+ }
+}).call(this);