\n' +
- '
任务3 \n' +
- '
\n' +
+ '
任务3 \n' +
+ '
\n' +
' \n' +
'
\n' +
'
\n' +
@@ -137786,8 +137869,8 @@ $(document).on('turbolinks:load', function() {
data: $form.serialize()
});
}
- });
- })
+ });
+ })
});
$(document).on('turbolinks:load', function () {
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-subject-modal', function () {
@@ -138085,6 +138168,52 @@ $(document).on('turbolinks:load', function() {
});
}
});
+$(document).on('turbolinks:load', function() {
+ $('.admin-modal-container').on('show.bs.modal', '.admin-save-competition-prize-modal', function(event){
+ var $modal = $('.modal.admin-save-competition-prize-modal');
+ var $form = $modal.find('form.admin-save-competition-prize-form');
+
+ $form.validate({
+ errorElement: 'span',
+ errorClass: 'danger text-danger',
+ rules: {
+ 'competition_prize[name]': {
+ required: true,
+ maxlength: 10
+ },
+ 'competition_prize[num]': {
+ required: true,
+ digits: true,
+ min: 1
+ }
+ }
+ });
+
+ $modal.on('click', '.submit-btn', function(){
+ $form.find('.error').html('');
+ var url = $form.attr('action');
+ var formMethod = $form.data('form-method')
+
+ if ($form.valid()) {
+ $.ajax({
+ method: formMethod,
+ dataType: 'json',
+ url: url,
+ data: $form.serialize(),
+ success: function(data){
+ if(data && data.status === 0) {
+ show_success_flash();
+ $(document).trigger('prize.save.success');
+ $modal.modal('hide');
+ } else {
+ $modal.find('.error').html(data.message)
+ }
+ }
+ });
+ }
+ });
+ })
+});
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.admin-upload-file-modal');
if ($modal.length > 0) {
diff --git a/public/assets/admin-5d791c4f4a14e1586cfa44776ae262b3c1494e1c0fb0e00c330f0cb9d30fd7ba.js.gz b/public/assets/admin-5d791c4f4a14e1586cfa44776ae262b3c1494e1c0fb0e00c330f0cb9d30fd7ba.js.gz
new file mode 100644
index 000000000..5ea1b2817
Binary files /dev/null and b/public/assets/admin-5d791c4f4a14e1586cfa44776ae262b3c1494e1c0fb0e00c330f0cb9d30fd7ba.js.gz differ
diff --git a/public/assets/admin-6a76c25b6691b4f436608be28606d90c907ba8f033f5f47c6c20d7bf11251cb6.css b/public/assets/admin-70dc0e7136a8f54139e4167c00f3fde9ccc92b404b01b37ac6064913806e3f6e.css
similarity index 99%
rename from public/assets/admin-6a76c25b6691b4f436608be28606d90c907ba8f033f5f47c6c20d7bf11251cb6.css
rename to public/assets/admin-70dc0e7136a8f54139e4167c00f3fde9ccc92b404b01b37ac6064913806e3f6e.css
index c21343820..2611b0b16 100644
--- a/public/assets/admin-6a76c25b6691b4f436608be28606d90c907ba8f033f5f47c6c20d7bf11251cb6.css
+++ b/public/assets/admin-70dc0e7136a8f54139e4167c00f3fde9ccc92b404b01b37ac6064913806e3f6e.css
@@ -20922,9 +20922,9 @@ span.CodeMirror-selectedtext {
}
/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */
-/*!
- * Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome
- * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
+/*!
+ * Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome
+ * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
@font-face {
font-family: FontAwesome;
@@ -25681,6 +25681,48 @@ input.form-control {
border: none;
}
+/* line 91, app/assets/stylesheets/admins/competition_settings.scss */
+.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n-2) > span.col-4 {
+ -webkit-box-flex: 0;
+ flex: 0 0 81px;
+ max-width: 81px;
+}
+
+/* line 95, app/assets/stylesheets/admins/competition_settings.scss */
+.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n-2) {
+ -webkit-box-flex: 0;
+ flex: 0 0 50%;
+ max-width: 50%;
+}
+
+/* line 99, app/assets/stylesheets/admins/competition_settings.scss */
+.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n-1) {
+ -webkit-box-flex: 0;
+ flex: 0 0 25%;
+ max-width: 25%;
+}
+
+/* line 103, app/assets/stylesheets/admins/competition_settings.scss */
+.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n) {
+ -webkit-box-flex: 0;
+ flex: 0 0 33.3%;
+ max-width: 33.3%;
+}
+
+/* line 107, app/assets/stylesheets/admins/competition_settings.scss */
+.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n) > span.col-4 {
+ -webkit-box-flex: 0;
+ flex: 0 0 25%;
+ max-width: 25%;
+}
+
+/* line 111, app/assets/stylesheets/admins/competition_settings.scss */
+.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n) > div.col-6 {
+ -webkit-box-flex: 0;
+ flex: 0 0 58.3%;
+ max-width: 58.3%;
+}
+
/* line 4, app/assets/stylesheets/admins/cooperatives.scss */
.admins-cooperatives-index-page .coo-img-card .coo-img-item > .drag {
cursor: move;
@@ -26142,7 +26184,7 @@ input.form-control {
/* line 27, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header-logo > .logo-label {
- display: none;
+ display: none;
}
/* line 33, app/assets/stylesheets/admins/sidebar.scss */
@@ -26214,25 +26256,25 @@ input.form-control {
/* line 83, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header-logo {
- display: -webkit-box;
- display: flex;
- -webkit-box-pack: justify;
- justify-content: space-between;
- -webkit-box-align: center;
- align-items: center;
+ display: -webkit-box;
+ display: flex;
+ -webkit-box-pack: justify;
+ justify-content: space-between;
+ -webkit-box-align: center;
+ align-items: center;
}
/* line 88, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header-logo > img {
- width: 40px;
- height: auto;
+ width: 40px;
+ height: auto;
}
/* line 93, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header-logo > .logo-label {
- font-size: 18px;
- color: darkgrey;
- margin-left: 10px;
+ font-size: 18px;
+ color: darkgrey;
+ margin-left: 10px;
}
/* line 101, app/assets/stylesheets/admins/sidebar.scss */
@@ -26336,7 +26378,7 @@ input.form-control {
}
@media (max-width: 768px) {
- /* line 182, app/assets/stylesheets/admins/sidebar.scss */
+ /* line 182, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active {
padding: 10px 5px;
min-width: 40px;
@@ -26346,47 +26388,39 @@ input.form-control {
-webkit-transform: none;
transform: none;
}
-
- /* line 190, app/assets/stylesheets/admins/sidebar.scss */
+ /* line 190, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header {
padding: 0px;
}
-
- /* line 193, app/assets/stylesheets/admins/sidebar.scss */
+ /* line 193, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header .sidebar-header-logo {
display: none;
}
-
- /* line 197, app/assets/stylesheets/admins/sidebar.scss */
+ /* line 197, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header #sidebarCollapse {
width: 30px;
height: 20px;
}
-
- /* line 203, app/assets/stylesheets/admins/sidebar.scss */
+ /* line 203, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a {
padding: 10px;
font-size: 0.85em;
}
-
- /* line 207, app/assets/stylesheets/admins/sidebar.scss */
+ /* line 207, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a i {
margin-right: 0;
display: block;
margin-bottom: 5px;
}
-
- /* line 214, app/assets/stylesheets/admins/sidebar.scss */
+ /* line 214, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active > ul > li > a > i {
font-size: 1.8em;
}
-
- /* line 218, app/assets/stylesheets/admins/sidebar.scss */
+ /* line 218, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul ul a {
padding: 10px !important;
}
-
- /* line 227, app/assets/stylesheets/admins/sidebar.scss */
+ /* line 227, app/assets/stylesheets/admins/sidebar.scss */
.dropdown-toggle::after {
top: auto;
bottom: 10px;
diff --git a/public/assets/admin-6a76c25b6691b4f436608be28606d90c907ba8f033f5f47c6c20d7bf11251cb6.css.gz b/public/assets/admin-70dc0e7136a8f54139e4167c00f3fde9ccc92b404b01b37ac6064913806e3f6e.css.gz
similarity index 75%
rename from public/assets/admin-6a76c25b6691b4f436608be28606d90c907ba8f033f5f47c6c20d7bf11251cb6.css.gz
rename to public/assets/admin-70dc0e7136a8f54139e4167c00f3fde9ccc92b404b01b37ac6064913806e3f6e.css.gz
index 48f2a32cf..1e065c160 100644
Binary files a/public/assets/admin-6a76c25b6691b4f436608be28606d90c907ba8f033f5f47c6c20d7bf11251cb6.css.gz and b/public/assets/admin-70dc0e7136a8f54139e4167c00f3fde9ccc92b404b01b37ac6064913806e3f6e.css.gz differ
diff --git a/public/assets/admin-e975e2039206e9ae2b6a072fee083cf39b8e04f2318f67bfbf1923fe208456b3.js.gz b/public/assets/admin-e975e2039206e9ae2b6a072fee083cf39b8e04f2318f67bfbf1923fe208456b3.js.gz
deleted file mode 100644
index 73ad7510e..000000000
Binary files a/public/assets/admin-e975e2039206e9ae2b6a072fee083cf39b8e04f2318f67bfbf1923fe208456b3.js.gz and /dev/null differ
diff --git a/public/assets/cooperative-f1ac8f14ad6ade8d1f79ca49ea9c79be77d49aae9d2705ca672e78444481700d.js b/public/assets/cooperative-4fe879591997da39d38e94f6f5eb3b688aa827fa42cb8fd73d21bc96ed880236.js
similarity index 99%
rename from public/assets/cooperative-f1ac8f14ad6ade8d1f79ca49ea9c79be77d49aae9d2705ca672e78444481700d.js
rename to public/assets/cooperative-4fe879591997da39d38e94f6f5eb3b688aa827fa42cb8fd73d21bc96ed880236.js
index 64eec3d6b..cf5015df2 100644
--- a/public/assets/cooperative-f1ac8f14ad6ade8d1f79ca49ea9c79be77d49aae9d2705ca672e78444481700d.js
+++ b/public/assets/cooperative-4fe879591997da39d38e94f6f5eb3b688aa827fa42cb8fd73d21bc96ed880236.js
@@ -29891,13 +29891,35 @@ function customConfirm(opts){
return $.confirm($.extend({}, defaultOpts, opts))
}
-function show_success_flash(){
+function customLoading(opts) {
+ var loading;
+ var defaultOpts = {
+ content: opts.ajax,
+ contentLoaded: function(){
+ setTimeout(function(){
+ loading.close()
+ }, 200);
+ }
+ }
+ loading = $.confirm($.extend({}, defaultOpts, opts));
+ return loading;
+}
+
+function show_success_flash(message){
$.notify({
- message: '操作成功'
+ message: message || '操作成功'
},{
type: 'success'
});
}
+
+function showErrorNotify(message){
+ $.notify({
+ message: message || '操作失败'
+ },{
+ type: 'danger'
+ });
+}
;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
diff --git a/public/assets/cooperative-4fe879591997da39d38e94f6f5eb3b688aa827fa42cb8fd73d21bc96ed880236.js.gz b/public/assets/cooperative-4fe879591997da39d38e94f6f5eb3b688aa827fa42cb8fd73d21bc96ed880236.js.gz
new file mode 100644
index 000000000..5ee8073c2
Binary files /dev/null and b/public/assets/cooperative-4fe879591997da39d38e94f6f5eb3b688aa827fa42cb8fd73d21bc96ed880236.js.gz differ
diff --git a/public/assets/cooperative-a309d245cd0b0b9c653db471c53ec090e49ba7ad885879ffa02a11b6efd79d74.js b/public/assets/cooperative-a309d245cd0b0b9c653db471c53ec090e49ba7ad885879ffa02a11b6efd79d74.js
deleted file mode 100644
index 2e7bf74aa..000000000
--- a/public/assets/cooperative-a309d245cd0b0b9c653db471c53ec090e49ba7ad885879ffa02a11b6efd79d74.js
+++ /dev/null
@@ -1,141770 +0,0 @@
-/*
-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 cspNonce;
-
- cspNonce = Rails.cspNonce = function () {
- var meta;
- meta = document.querySelector('meta[name=csp-nonce]');
- return meta && meta.content;
- };
-
- }).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.handleMetaClick = function (e) {
- var data, link, metaClick, method;
- link = this;
- method = (link.getAttribute('data-method') || 'GET').toUpperCase();
- data = link.getAttribute('data-params');
- metaClick = e.metaKey || e.ctrlKey;
- if (metaClick && method === 'GET' && !data) {
- return e.stopImmediatePropagation();
- }
- };
-
- }).call(this);
- (function () {
- var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData,
- handleConfirm, handleDisabledElement, handleMetaClick, handleMethod, handleRemote, refreshCSRFTokens;
-
- fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMetaClick = Rails.handleMetaClick, handleMethod = Rails.handleMethod;
-
- if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null) && !jQuery.rails) {
- 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', handleDisabledElement);
- delegate(document, Rails.linkClickSelector, 'click', handleConfirm);
- delegate(document, Rails.linkClickSelector, 'click', handleMetaClick);
- delegate(document, Rails.linkClickSelector, 'click', disableElement);
- delegate(document, Rails.linkClickSelector, 'click', handleRemote);
- delegate(document, Rails.linkClickSelector, 'click', handleMethod);
- 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', handleDisabledElement);
- delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
- delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
- document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
- 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);
-!function (t, e) {
- "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.ActiveStorage = e() : t.ActiveStorage = e()
-}(this, function () {
- return function (t) {
- function e(n) {
- if (r[n]) return r[n].exports;
- var i = r[n] = {i: n, l: !1, exports: {}};
- return t[n].call(i.exports, i, i.exports, e), i.l = !0, i.exports
- }
-
- var r = {};
- return e.m = t, e.c = r, e.d = function (t, r, n) {
- e.o(t, r) || Object.defineProperty(t, r, {configurable: !1, enumerable: !0, get: n})
- }, e.n = function (t) {
- var r = t && t.__esModule ? function () {
- return t.default
- } : function () {
- return t
- };
- return e.d(r, "a", r), r
- }, e.o = function (t, e) {
- return Object.prototype.hasOwnProperty.call(t, e)
- }, e.p = "", e(e.s = 2)
- }([function (t, e, r) {
- "use strict";
-
- function n(t) {
- var e = a(document.head, 'meta[name="' + t + '"]');
- if (e) return e.getAttribute("content")
- }
-
- function i(t, e) {
- return "string" == typeof t && (e = t, t = document), o(t.querySelectorAll(e))
- }
-
- function a(t, e) {
- return "string" == typeof t && (e = t, t = document), t.querySelector(e)
- }
-
- function u(t, e) {
- var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, n = t.disabled, i = r.bubbles,
- a = r.cancelable, u = r.detail, o = document.createEvent("Event");
- o.initEvent(e, i || !0, a || !0), o.detail = u || {};
- try {
- t.disabled = !1, t.dispatchEvent(o)
- } finally {
- t.disabled = n
- }
- return o
- }
-
- function o(t) {
- return Array.isArray(t) ? t : Array.from ? Array.from(t) : [].slice.call(t)
- }
-
- e.d = n, e.c = i, e.b = a, e.a = u, e.e = o
- }, function (t, e, r) {
- "use strict";
-
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
-
- function i(t, e) {
- if (t && "function" == typeof t[e]) {
- for (var r = arguments.length, n = Array(r > 2 ? r - 2 : 0), i = 2; i < r; i++) n[i - 2] = arguments[i];
- return t[e].apply(t, n)
- }
- }
-
- r.d(e, "a", function () {
- return c
- });
- var a = r(6), u = r(8), o = r(9), s = function () {
- function t(t, e) {
- for (var r = 0; r < e.length; r++) {
- var n = e[r];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
-
- return function (e, r, n) {
- return r && t(e.prototype, r), n && t(e, n), e
- }
- }(), f = 0, c = function () {
- function t(e, r, i) {
- n(this, t), this.id = ++f, this.file = e, this.url = r, this.delegate = i
- }
-
- return s(t, [{
- key: "create", value: function (t) {
- var e = this;
- a.a.create(this.file, function (r, n) {
- if (r) return void t(r);
- var a = new u.a(e.file, n, e.url);
- i(e.delegate, "directUploadWillCreateBlobWithXHR", a.xhr), a.create(function (r) {
- if (r) t(r); else {
- var n = new o.a(a);
- i(e.delegate, "directUploadWillStoreFileWithXHR", n.xhr), n.create(function (e) {
- e ? t(e) : t(null, a.toJSON())
- })
- }
- })
- })
- }
- }]), t
- }()
- }, function (t, e, r) {
- "use strict";
-
- function n() {
- window.ActiveStorage && Object(i.a)()
- }
-
- Object.defineProperty(e, "__esModule", {value: !0});
- var i = r(3), a = r(1);
- r.d(e, "start", function () {
- return i.a
- }), r.d(e, "DirectUpload", function () {
- return a.a
- }), setTimeout(n, 1)
- }, function (t, e, r) {
- "use strict";
-
- function n() {
- d || (d = !0, document.addEventListener("submit", i), document.addEventListener("ajax:before", a))
- }
-
- function i(t) {
- u(t)
- }
-
- function a(t) {
- "FORM" == t.target.tagName && u(t)
- }
-
- function u(t) {
- var e = t.target;
- if (e.hasAttribute(l)) return void t.preventDefault();
- var r = new c.a(e), n = r.inputs;
- n.length && (t.preventDefault(), e.setAttribute(l, ""), n.forEach(s), r.start(function (t) {
- e.removeAttribute(l), t ? n.forEach(f) : o(e)
- }))
- }
-
- function o(t) {
- var e = Object(h.b)(t, "input[type=submit]");
- if (e) {
- var r = e, n = r.disabled;
- e.disabled = !1, e.focus(), e.click(), e.disabled = n
- } else e = document.createElement("input"), e.type = "submit", e.style.display = "none", t.appendChild(e), e.click(), t.removeChild(e)
- }
-
- function s(t) {
- t.disabled = !0
- }
-
- function f(t) {
- t.disabled = !1
- }
-
- e.a = n;
- var c = r(4), h = r(0), l = "data-direct-uploads-processing", d = !1
- }, function (t, e, r) {
- "use strict";
-
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
-
- r.d(e, "a", function () {
- return s
- });
- var i = r(5), a = r(0), u = function () {
- function t(t, e) {
- for (var r = 0; r < e.length; r++) {
- var n = e[r];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
-
- return function (e, r, n) {
- return r && t(e.prototype, r), n && t(e, n), e
- }
- }(), o = "input[type=file][data-direct-upload-url]:not([disabled])", s = function () {
- function t(e) {
- n(this, t), this.form = e, this.inputs = Object(a.c)(e, o).filter(function (t) {
- return t.files.length
- })
- }
-
- return u(t, [{
- key: "start", value: function (t) {
- var e = this, r = this.createDirectUploadControllers();
- this.dispatch("start"), function n() {
- var i = r.shift();
- i ? i.start(function (r) {
- r ? (t(r), e.dispatch("end")) : n()
- }) : (t(), e.dispatch("end"))
- }()
- }
- }, {
- key: "createDirectUploadControllers", value: function () {
- var t = [];
- return this.inputs.forEach(function (e) {
- Object(a.e)(e.files).forEach(function (r) {
- var n = new i.a(e, r);
- t.push(n)
- })
- }), t
- }
- }, {
- key: "dispatch", value: function (t) {
- var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
- return Object(a.a)(this.form, "direct-uploads:" + t, {detail: e})
- }
- }]), t
- }()
- }, function (t, e, r) {
- "use strict";
-
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
-
- r.d(e, "a", function () {
- return o
- });
- var i = r(1), a = r(0), u = function () {
- function t(t, e) {
- for (var r = 0; r < e.length; r++) {
- var n = e[r];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
-
- return function (e, r, n) {
- return r && t(e.prototype, r), n && t(e, n), e
- }
- }(), o = function () {
- function t(e, r) {
- n(this, t), this.input = e, this.file = r, this.directUpload = new i.a(this.file, this.url, this), this.dispatch("initialize")
- }
-
- return u(t, [{
- key: "start", value: function (t) {
- var e = this, r = document.createElement("input");
- r.type = "hidden", r.name = this.input.name, this.input.insertAdjacentElement("beforebegin", r), this.dispatch("start"), this.directUpload.create(function (n, i) {
- n ? (r.parentNode.removeChild(r), e.dispatchError(n)) : r.value = i.signed_id, e.dispatch("end"), t(n)
- })
- }
- }, {
- key: "uploadRequestDidProgress", value: function (t) {
- var e = t.loaded / t.total * 100;
- e && this.dispatch("progress", {progress: e})
- }
- }, {
- key: "dispatch", value: function (t) {
- var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
- return e.file = this.file, e.id = this.directUpload.id, Object(a.a)(this.input, "direct-upload:" + t, {detail: e})
- }
- }, {
- key: "dispatchError", value: function (t) {
- this.dispatch("error", {error: t}).defaultPrevented || alert(t)
- }
- }, {
- key: "directUploadWillCreateBlobWithXHR", value: function (t) {
- this.dispatch("before-blob-request", {xhr: t})
- }
- }, {
- key: "directUploadWillStoreFileWithXHR", value: function (t) {
- var e = this;
- this.dispatch("before-storage-request", {xhr: t}), t.upload.addEventListener("progress", function (t) {
- return e.uploadRequestDidProgress(t)
- })
- }
- }, {
- key: "url", get: function () {
- return this.input.getAttribute("data-direct-upload-url")
- }
- }]), t
- }()
- }, function (t, e, r) {
- "use strict";
-
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
-
- r.d(e, "a", function () {
- return s
- });
- var i = r(7), a = r.n(i), u = function () {
- function t(t, e) {
- for (var r = 0; r < e.length; r++) {
- var n = e[r];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
-
- return function (e, r, n) {
- return r && t(e.prototype, r), n && t(e, n), e
- }
- }(), o = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice, s = function () {
- function t(e) {
- n(this, t), this.file = e, this.chunkSize = 2097152, this.chunkCount = Math.ceil(this.file.size / this.chunkSize), this.chunkIndex = 0
- }
-
- return u(t, null, [{
- key: "create", value: function (e, r) {
- new t(e).create(r)
- }
- }]), u(t, [{
- key: "create", value: function (t) {
- var e = this;
- this.callback = t, this.md5Buffer = new a.a.ArrayBuffer, this.fileReader = new FileReader, this.fileReader.addEventListener("load", function (t) {
- return e.fileReaderDidLoad(t)
- }), this.fileReader.addEventListener("error", function (t) {
- return e.fileReaderDidError(t)
- }), this.readNextChunk()
- }
- }, {
- key: "fileReaderDidLoad", value: function (t) {
- if (this.md5Buffer.append(t.target.result), !this.readNextChunk()) {
- var e = this.md5Buffer.end(!0), r = btoa(e);
- this.callback(null, r)
- }
- }
- }, {
- key: "fileReaderDidError", value: function (t) {
- this.callback("Error reading " + this.file.name)
- }
- }, {
- key: "readNextChunk", value: function () {
- if (this.chunkIndex < this.chunkCount || 0 == this.chunkIndex && 0 == this.chunkCount) {
- var t = this.chunkIndex * this.chunkSize, e = Math.min(t + this.chunkSize, this.file.size),
- r = o.call(this.file, t, e);
- return this.fileReader.readAsArrayBuffer(r), this.chunkIndex++, !0
- }
- return !1
- }
- }]), t
- }()
- }, function (t, e, r) {
- !function (e) {
- t.exports = e()
- }(function (t) {
- "use strict";
-
- function e(t, e) {
- var r = t[0], n = t[1], i = t[2], a = t[3];
- r += (n & i | ~n & a) + e[0] - 680876936 | 0, r = (r << 7 | r >>> 25) + n | 0, a += (r & n | ~r & i) + e[1] - 389564586 | 0, a = (a << 12 | a >>> 20) + r | 0, i += (a & r | ~a & n) + e[2] + 606105819 | 0, i = (i << 17 | i >>> 15) + a | 0, n += (i & a | ~i & r) + e[3] - 1044525330 | 0, n = (n << 22 | n >>> 10) + i | 0, r += (n & i | ~n & a) + e[4] - 176418897 | 0, r = (r << 7 | r >>> 25) + n | 0, a += (r & n | ~r & i) + e[5] + 1200080426 | 0, a = (a << 12 | a >>> 20) + r | 0, i += (a & r | ~a & n) + e[6] - 1473231341 | 0, i = (i << 17 | i >>> 15) + a | 0, n += (i & a | ~i & r) + e[7] - 45705983 | 0, n = (n << 22 | n >>> 10) + i | 0, r += (n & i | ~n & a) + e[8] + 1770035416 | 0, r = (r << 7 | r >>> 25) + n | 0, a += (r & n | ~r & i) + e[9] - 1958414417 | 0, a = (a << 12 | a >>> 20) + r | 0, i += (a & r | ~a & n) + e[10] - 42063 | 0, i = (i << 17 | i >>> 15) + a | 0, n += (i & a | ~i & r) + e[11] - 1990404162 | 0, n = (n << 22 | n >>> 10) + i | 0, r += (n & i | ~n & a) + e[12] + 1804603682 | 0, r = (r << 7 | r >>> 25) + n | 0, a += (r & n | ~r & i) + e[13] - 40341101 | 0, a = (a << 12 | a >>> 20) + r | 0, i += (a & r | ~a & n) + e[14] - 1502002290 | 0, i = (i << 17 | i >>> 15) + a | 0, n += (i & a | ~i & r) + e[15] + 1236535329 | 0, n = (n << 22 | n >>> 10) + i | 0, r += (n & a | i & ~a) + e[1] - 165796510 | 0, r = (r << 5 | r >>> 27) + n | 0, a += (r & i | n & ~i) + e[6] - 1069501632 | 0, a = (a << 9 | a >>> 23) + r | 0, i += (a & n | r & ~n) + e[11] + 643717713 | 0, i = (i << 14 | i >>> 18) + a | 0, n += (i & r | a & ~r) + e[0] - 373897302 | 0, n = (n << 20 | n >>> 12) + i | 0, r += (n & a | i & ~a) + e[5] - 701558691 | 0, r = (r << 5 | r >>> 27) + n | 0, a += (r & i | n & ~i) + e[10] + 38016083 | 0, a = (a << 9 | a >>> 23) + r | 0, i += (a & n | r & ~n) + e[15] - 660478335 | 0, i = (i << 14 | i >>> 18) + a | 0, n += (i & r | a & ~r) + e[4] - 405537848 | 0, n = (n << 20 | n >>> 12) + i | 0, r += (n & a | i & ~a) + e[9] + 568446438 | 0, r = (r << 5 | r >>> 27) + n | 0, a += (r & i | n & ~i) + e[14] - 1019803690 | 0, a = (a << 9 | a >>> 23) + r | 0, i += (a & n | r & ~n) + e[3] - 187363961 | 0, i = (i << 14 | i >>> 18) + a | 0, n += (i & r | a & ~r) + e[8] + 1163531501 | 0, n = (n << 20 | n >>> 12) + i | 0, r += (n & a | i & ~a) + e[13] - 1444681467 | 0, r = (r << 5 | r >>> 27) + n | 0, a += (r & i | n & ~i) + e[2] - 51403784 | 0, a = (a << 9 | a >>> 23) + r | 0, i += (a & n | r & ~n) + e[7] + 1735328473 | 0, i = (i << 14 | i >>> 18) + a | 0, n += (i & r | a & ~r) + e[12] - 1926607734 | 0, n = (n << 20 | n >>> 12) + i | 0, r += (n ^ i ^ a) + e[5] - 378558 | 0, r = (r << 4 | r >>> 28) + n | 0, a += (r ^ n ^ i) + e[8] - 2022574463 | 0, a = (a << 11 | a >>> 21) + r | 0, i += (a ^ r ^ n) + e[11] + 1839030562 | 0, i = (i << 16 | i >>> 16) + a | 0, n += (i ^ a ^ r) + e[14] - 35309556 | 0, n = (n << 23 | n >>> 9) + i | 0, r += (n ^ i ^ a) + e[1] - 1530992060 | 0, r = (r << 4 | r >>> 28) + n | 0, a += (r ^ n ^ i) + e[4] + 1272893353 | 0, a = (a << 11 | a >>> 21) + r | 0, i += (a ^ r ^ n) + e[7] - 155497632 | 0, i = (i << 16 | i >>> 16) + a | 0, n += (i ^ a ^ r) + e[10] - 1094730640 | 0, n = (n << 23 | n >>> 9) + i | 0, r += (n ^ i ^ a) + e[13] + 681279174 | 0, r = (r << 4 | r >>> 28) + n | 0, a += (r ^ n ^ i) + e[0] - 358537222 | 0, a = (a << 11 | a >>> 21) + r | 0, i += (a ^ r ^ n) + e[3] - 722521979 | 0, i = (i << 16 | i >>> 16) + a | 0, n += (i ^ a ^ r) + e[6] + 76029189 | 0, n = (n << 23 | n >>> 9) + i | 0, r += (n ^ i ^ a) + e[9] - 640364487 | 0, r = (r << 4 | r >>> 28) + n | 0, a += (r ^ n ^ i) + e[12] - 421815835 | 0, a = (a << 11 | a >>> 21) + r | 0, i += (a ^ r ^ n) + e[15] + 530742520 | 0, i = (i << 16 | i >>> 16) + a | 0, n += (i ^ a ^ r) + e[2] - 995338651 | 0, n = (n << 23 | n >>> 9) + i | 0, r += (i ^ (n | ~a)) + e[0] - 198630844 | 0, r = (r << 6 | r >>> 26) + n | 0, a += (n ^ (r | ~i)) + e[7] + 1126891415 | 0, a = (a << 10 | a >>> 22) + r | 0, i += (r ^ (a | ~n)) + e[14] - 1416354905 | 0,i = (i << 15 | i >>> 17) + a | 0,n += (a ^ (i | ~r)) + e[5] - 57434055 | 0,n = (n << 21 | n >>> 11) + i | 0,r += (i ^ (n | ~a)) + e[12] + 1700485571 | 0,r = (r << 6 | r >>> 26) + n | 0,a += (n ^ (r | ~i)) + e[3] - 1894986606 | 0,a = (a << 10 | a >>> 22) + r | 0,i += (r ^ (a | ~n)) + e[10] - 1051523 | 0,i = (i << 15 | i >>> 17) + a | 0,n += (a ^ (i | ~r)) + e[1] - 2054922799 | 0,n = (n << 21 | n >>> 11) + i | 0,r += (i ^ (n | ~a)) + e[8] + 1873313359 | 0,r = (r << 6 | r >>> 26) + n | 0,a += (n ^ (r | ~i)) + e[15] - 30611744 | 0,a = (a << 10 | a >>> 22) + r | 0,i += (r ^ (a | ~n)) + e[6] - 1560198380 | 0,i = (i << 15 | i >>> 17) + a | 0,n += (a ^ (i | ~r)) + e[13] + 1309151649 | 0,n = (n << 21 | n >>> 11) + i | 0,r += (i ^ (n | ~a)) + e[4] - 145523070 | 0,r = (r << 6 | r >>> 26) + n | 0,a += (n ^ (r | ~i)) + e[11] - 1120210379 | 0,a = (a << 10 | a >>> 22) + r | 0,i += (r ^ (a | ~n)) + e[2] + 718787259 | 0,i = (i << 15 | i >>> 17) + a | 0,n += (a ^ (i | ~r)) + e[9] - 343485551 | 0,n = (n << 21 | n >>> 11) + i | 0,t[0] = r + t[0] | 0,t[1] = n + t[1] | 0,t[2] = i + t[2] | 0,t[3] = a + t[3] | 0
- }
-
- function r(t) {
- var e, r = [];
- for (e = 0; e < 64; e += 4) r[e >> 2] = t.charCodeAt(e) + (t.charCodeAt(e + 1) << 8) + (t.charCodeAt(e + 2) << 16) + (t.charCodeAt(e + 3) << 24);
- return r
- }
-
- function n(t) {
- var e, r = [];
- for (e = 0; e < 64; e += 4) r[e >> 2] = t[e] + (t[e + 1] << 8) + (t[e + 2] << 16) + (t[e + 3] << 24);
- return r
- }
-
- function i(t) {
- var n, i, a, u, o, s, f = t.length, c = [1732584193, -271733879, -1732584194, 271733878];
- for (n = 64; n <= f; n += 64) e(c, r(t.substring(n - 64, n)));
- for (t = t.substring(n - 64), i = t.length, a = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], n = 0; n < i; n += 1) a[n >> 2] |= t.charCodeAt(n) << (n % 4 << 3);
- if (a[n >> 2] |= 128 << (n % 4 << 3), n > 55) for (e(c, a), n = 0; n < 16; n += 1) a[n] = 0;
- return u = 8 * f, u = u.toString(16).match(/(.*?)(.{0,8})$/), o = parseInt(u[2], 16), s = parseInt(u[1], 16) || 0, a[14] = o, a[15] = s, e(c, a), c
- }
-
- function a(t) {
- var r, i, a, u, o, s, f = t.length, c = [1732584193, -271733879, -1732584194, 271733878];
- for (r = 64; r <= f; r += 64) e(c, n(t.subarray(r - 64, r)));
- for (t = r - 64 < f ? t.subarray(r - 64) : new Uint8Array(0), i = t.length, a = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], r = 0; r < i; r += 1) a[r >> 2] |= t[r] << (r % 4 << 3);
- if (a[r >> 2] |= 128 << (r % 4 << 3), r > 55) for (e(c, a), r = 0; r < 16; r += 1) a[r] = 0;
- return u = 8 * f, u = u.toString(16).match(/(.*?)(.{0,8})$/), o = parseInt(u[2], 16), s = parseInt(u[1], 16) || 0, a[14] = o, a[15] = s, e(c, a), c
- }
-
- function u(t) {
- var e, r = "";
- for (e = 0; e < 4; e += 1) r += p[t >> 8 * e + 4 & 15] + p[t >> 8 * e & 15];
- return r
- }
-
- function o(t) {
- var e;
- for (e = 0; e < t.length; e += 1) t[e] = u(t[e]);
- return t.join("")
- }
-
- function s(t) {
- return /[\u0080-\uFFFF]/.test(t) && (t = unescape(encodeURIComponent(t))), t
- }
-
- function f(t, e) {
- var r, n = t.length, i = new ArrayBuffer(n), a = new Uint8Array(i);
- for (r = 0; r < n; r += 1) a[r] = t.charCodeAt(r);
- return e ? a : i
- }
-
- function c(t) {
- return String.fromCharCode.apply(null, new Uint8Array(t))
- }
-
- function h(t, e, r) {
- var n = new Uint8Array(t.byteLength + e.byteLength);
- return n.set(new Uint8Array(t)), n.set(new Uint8Array(e), t.byteLength), r ? n : n.buffer
- }
-
- function l(t) {
- var e, r = [], n = t.length;
- for (e = 0; e < n - 1; e += 2) r.push(parseInt(t.substr(e, 2), 16));
- return String.fromCharCode.apply(String, r)
- }
-
- function d() {
- this.reset()
- }
-
- var p = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
- return "5d41402abc4b2a76b9719d911017c592" !== o(i("hello")) && function (t, e) {
- var r = (65535 & t) + (65535 & e);
- return (t >> 16) + (e >> 16) + (r >> 16) << 16 | 65535 & r
- }, "undefined" == typeof ArrayBuffer || ArrayBuffer.prototype.slice || function () {
- function e(t, e) {
- return t = 0 | t || 0, t < 0 ? Math.max(t + e, 0) : Math.min(t, e)
- }
-
- ArrayBuffer.prototype.slice = function (r, n) {
- var i, a, u, o, s = this.byteLength, f = e(r, s), c = s;
- return n !== t && (c = e(n, s)), f > c ? new ArrayBuffer(0) : (i = c - f, a = new ArrayBuffer(i), u = new Uint8Array(a), o = new Uint8Array(this, f, i), u.set(o), a)
- }
- }(), d.prototype.append = function (t) {
- return this.appendBinary(s(t)), this
- }, d.prototype.appendBinary = function (t) {
- this._buff += t, this._length += t.length;
- var n, i = this._buff.length;
- for (n = 64; n <= i; n += 64) e(this._hash, r(this._buff.substring(n - 64, n)));
- return this._buff = this._buff.substring(n - 64), this
- }, d.prototype.end = function (t) {
- var e, r, n = this._buff, i = n.length, a = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- for (e = 0; e < i; e += 1) a[e >> 2] |= n.charCodeAt(e) << (e % 4 << 3);
- return this._finish(a, i), r = o(this._hash), t && (r = l(r)), this.reset(), r
- }, d.prototype.reset = function () {
- return this._buff = "", this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this
- }, d.prototype.getState = function () {
- return {buff: this._buff, length: this._length, hash: this._hash}
- }, d.prototype.setState = function (t) {
- return this._buff = t.buff, this._length = t.length, this._hash = t.hash, this
- }, d.prototype.destroy = function () {
- delete this._hash, delete this._buff, delete this._length
- }, d.prototype._finish = function (t, r) {
- var n, i, a, u = r;
- if (t[u >> 2] |= 128 << (u % 4 << 3), u > 55) for (e(this._hash, t), u = 0; u < 16; u += 1) t[u] = 0;
- n = 8 * this._length, n = n.toString(16).match(/(.*?)(.{0,8})$/), i = parseInt(n[2], 16), a = parseInt(n[1], 16) || 0, t[14] = i, t[15] = a, e(this._hash, t)
- }, d.hash = function (t, e) {
- return d.hashBinary(s(t), e)
- }, d.hashBinary = function (t, e) {
- var r = i(t), n = o(r);
- return e ? l(n) : n
- }, d.ArrayBuffer = function () {
- this.reset()
- }, d.ArrayBuffer.prototype.append = function (t) {
- var r, i = h(this._buff.buffer, t, !0), a = i.length;
- for (this._length += t.byteLength, r = 64; r <= a; r += 64) e(this._hash, n(i.subarray(r - 64, r)));
- return this._buff = r - 64 < a ? new Uint8Array(i.buffer.slice(r - 64)) : new Uint8Array(0), this
- }, d.ArrayBuffer.prototype.end = function (t) {
- var e, r, n = this._buff, i = n.length, a = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- for (e = 0; e < i; e += 1) a[e >> 2] |= n[e] << (e % 4 << 3);
- return this._finish(a, i), r = o(this._hash), t && (r = l(r)), this.reset(), r
- }, d.ArrayBuffer.prototype.reset = function () {
- return this._buff = new Uint8Array(0), this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this
- }, d.ArrayBuffer.prototype.getState = function () {
- var t = d.prototype.getState.call(this);
- return t.buff = c(t.buff), t
- }, d.ArrayBuffer.prototype.setState = function (t) {
- return t.buff = f(t.buff, !0), d.prototype.setState.call(this, t)
- }, d.ArrayBuffer.prototype.destroy = d.prototype.destroy, d.ArrayBuffer.prototype._finish = d.prototype._finish, d.ArrayBuffer.hash = function (t, e) {
- var r = a(new Uint8Array(t)), n = o(r);
- return e ? l(n) : n
- }, d
- })
- }, function (t, e, r) {
- "use strict";
-
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
-
- r.d(e, "a", function () {
- return u
- });
- var i = r(0), a = function () {
- function t(t, e) {
- for (var r = 0; r < e.length; r++) {
- var n = e[r];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
-
- return function (e, r, n) {
- return r && t(e.prototype, r), n && t(e, n), e
- }
- }(), u = function () {
- function t(e, r, a) {
- var u = this;
- n(this, t), this.file = e, this.attributes = {
- filename: e.name,
- content_type: e.type,
- byte_size: e.size,
- checksum: r
- }, this.xhr = new XMLHttpRequest, this.xhr.open("POST", a, !0), this.xhr.responseType = "json", this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.setRequestHeader("Accept", "application/json"), this.xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"), this.xhr.setRequestHeader("X-CSRF-Token", Object(i.d)("csrf-token")), this.xhr.addEventListener("load", function (t) {
- return u.requestDidLoad(t)
- }), this.xhr.addEventListener("error", function (t) {
- return u.requestDidError(t)
- })
- }
-
- return a(t, [{
- key: "create", value: function (t) {
- this.callback = t, this.xhr.send(JSON.stringify({blob: this.attributes}))
- }
- }, {
- key: "requestDidLoad", value: function (t) {
- if (this.status >= 200 && this.status < 300) {
- var e = this.response, r = e.direct_upload;
- delete e.direct_upload, this.attributes = e, this.directUploadData = r, this.callback(null, this.toJSON())
- } else this.requestDidError(t)
- }
- }, {
- key: "requestDidError", value: function (t) {
- this.callback('Error creating Blob for "' + this.file.name + '". Status: ' + this.status)
- }
- }, {
- key: "toJSON", value: function () {
- var t = {};
- for (var e in this.attributes) t[e] = this.attributes[e];
- return t
- }
- }, {
- key: "status", get: function () {
- return this.xhr.status
- }
- }, {
- key: "response", get: function () {
- var t = this.xhr, e = t.responseType, r = t.response;
- return "json" == e ? r : JSON.parse(r)
- }
- }]), t
- }()
- }, function (t, e, r) {
- "use strict";
-
- function n(t, e) {
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
- }
-
- r.d(e, "a", function () {
- return a
- });
- var i = function () {
- function t(t, e) {
- for (var r = 0; r < e.length; r++) {
- var n = e[r];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
- }
- }
-
- return function (e, r, n) {
- return r && t(e.prototype, r), n && t(e, n), e
- }
- }(), a = function () {
- function t(e) {
- var r = this;
- n(this, t), this.blob = e, this.file = e.file;
- var i = e.directUploadData, a = i.url, u = i.headers;
- this.xhr = new XMLHttpRequest, this.xhr.open("PUT", a, !0), this.xhr.responseType = "text";
- for (var o in u) this.xhr.setRequestHeader(o, u[o]);
- this.xhr.addEventListener("load", function (t) {
- return r.requestDidLoad(t)
- }), this.xhr.addEventListener("error", function (t) {
- return r.requestDidError(t)
- })
- }
-
- return i(t, [{
- key: "create", value: function (t) {
- this.callback = t, this.xhr.send(this.file.slice())
- }
- }, {
- key: "requestDidLoad", value: function (t) {
- var e = this.xhr, r = e.status, n = e.response;
- r >= 200 && r < 300 ? this.callback(null, n) : this.requestDidError(t)
- }
- }, {
- key: "requestDidError", value: function (t) {
- this.callback('Error storing "' + this.file.name + '". Status: ' + this.xhr.status)
- }
- }]), t
- }()
- }])
-});
-/*
-Turbolinks 5.2.0
-Copyright © 2018 Basecamp, LLC
- */
-
-(function () {
- var t = this;
- (function () {
- (function () {
- this.Turbolinks = {
- supported: function () {
- return null != window.history.pushState && null != window.requestAnimationFrame && null != window.addEventListener
- }(), visit: function (t, r) {
- return e.controller.visit(t, r)
- }, clearCache: function () {
- return e.controller.clearCache()
- }, setProgressBarDelay: function (t) {
- return e.controller.setProgressBarDelay(t)
- }
- }
- }).call(this)
- }).call(t);
- var e = t.Turbolinks;
- (function () {
- (function () {
- var t, r, n, o = [].slice;
- e.copyObject = function (t) {
- var e, r, n;
- r = {};
- for (e in t) n = t[e], r[e] = n;
- return r
- }, e.closest = function (e, r) {
- return t.call(e, r)
- }, t = function () {
- var t, e;
- return t = document.documentElement, null != (e = t.closest) ? e : function (t) {
- var e;
- for (e = this; e;) {
- if (e.nodeType === Node.ELEMENT_NODE && r.call(e, t)) return e;
- e = e.parentNode
- }
- }
- }(), e.defer = function (t) {
- return setTimeout(t, 1)
- }, e.throttle = function (t) {
- var e;
- return e = null, function () {
- var r;
- return r = 1 <= arguments.length ? o.call(arguments, 0) : [], null != e ? e : e = requestAnimationFrame(function (n) {
- return function () {
- return e = null, t.apply(n, r)
- }
- }(this))
- }
- }, e.dispatch = function (t, e) {
- var r, o, i, s, a, u;
- return a = null != e ? e : {}, u = a.target, r = a.cancelable, o = a.data, i = document.createEvent("Events"), i.initEvent(t, !0, r === !0), i.data = null != o ? o : {}, i.cancelable && !n && (s = i.preventDefault, i.preventDefault = function () {
- return this.defaultPrevented || Object.defineProperty(this, "defaultPrevented", {
- get: function () {
- return !0
- }
- }), s.call(this)
- }), (null != u ? u : document).dispatchEvent(i), i
- }, n = function () {
- var t;
- return t = document.createEvent("Events"), t.initEvent("test", !0, !0), t.preventDefault(), t.defaultPrevented
- }(), e.match = function (t, e) {
- return r.call(t, e)
- }, r = function () {
- var t, e, r, n;
- return t = document.documentElement, null != (e = null != (r = null != (n = t.matchesSelector) ? n : t.webkitMatchesSelector) ? r : t.msMatchesSelector) ? e : t.mozMatchesSelector
- }(), e.uuid = function () {
- var t, e, r;
- for (r = "", t = e = 1; 36 >= e; t = ++e) r += 9 === t || 14 === t || 19 === t || 24 === t ? "-" : 15 === t ? "4" : 20 === t ? (Math.floor(4 * Math.random()) + 8).toString(16) : Math.floor(15 * Math.random()).toString(16);
- return r
- }
- }).call(this), function () {
- e.Location = function () {
- function t(t) {
- var e, r;
- null == t && (t = ""), r = document.createElement("a"), r.href = t.toString(), this.absoluteURL = r.href, e = r.hash.length, 2 > e ? this.requestURL = this.absoluteURL : (this.requestURL = this.absoluteURL.slice(0, -e), this.anchor = r.hash.slice(1))
- }
-
- var e, r, n, o;
- return t.wrap = function (t) {
- return t instanceof this ? t : new this(t)
- }, t.prototype.getOrigin = function () {
- return this.absoluteURL.split("/", 3).join("/")
- }, t.prototype.getPath = function () {
- var t, e;
- return null != (t = null != (e = this.requestURL.match(/\/\/[^\/]*(\/[^?;]*)/)) ? e[1] : void 0) ? t : "/"
- }, t.prototype.getPathComponents = function () {
- return this.getPath().split("/").slice(1)
- }, t.prototype.getLastPathComponent = function () {
- return this.getPathComponents().slice(-1)[0]
- }, t.prototype.getExtension = function () {
- var t, e;
- return null != (t = null != (e = this.getLastPathComponent().match(/\.[^.]*$/)) ? e[0] : void 0) ? t : ""
- }, t.prototype.isHTML = function () {
- return this.getExtension().match(/^(?:|\.(?:htm|html|xhtml))$/)
- }, t.prototype.isPrefixedBy = function (t) {
- var e;
- return e = r(t), this.isEqualTo(t) || o(this.absoluteURL, e)
- }, t.prototype.isEqualTo = function (t) {
- return this.absoluteURL === (null != t ? t.absoluteURL : void 0)
- }, t.prototype.toCacheKey = function () {
- return this.requestURL
- }, t.prototype.toJSON = function () {
- return this.absoluteURL
- }, t.prototype.toString = function () {
- return this.absoluteURL
- }, t.prototype.valueOf = function () {
- return this.absoluteURL
- }, r = function (t) {
- return e(t.getOrigin() + t.getPath())
- }, e = function (t) {
- return n(t, "/") ? t : t + "/"
- }, o = function (t, e) {
- return t.slice(0, e.length) === e
- }, n = function (t, e) {
- return t.slice(-e.length) === e
- }, t
- }()
- }.call(this), function () {
- var t = function (t, e) {
- return function () {
- return t.apply(e, arguments)
- }
- };
- e.HttpRequest = function () {
- function r(r, n, o) {
- this.delegate = r, this.requestCanceled = t(this.requestCanceled, this), this.requestTimedOut = t(this.requestTimedOut, this), this.requestFailed = t(this.requestFailed, this), this.requestLoaded = t(this.requestLoaded, this), this.requestProgressed = t(this.requestProgressed, this), this.url = e.Location.wrap(n).requestURL, this.referrer = e.Location.wrap(o).absoluteURL, this.createXHR()
- }
-
- return r.NETWORK_FAILURE = 0, r.TIMEOUT_FAILURE = -1, r.timeout = 60, r.prototype.send = function () {
- var t;
- return this.xhr && !this.sent ? (this.notifyApplicationBeforeRequestStart(), this.setProgress(0), this.xhr.send(), this.sent = !0, "function" == typeof (t = this.delegate).requestStarted ? t.requestStarted() : void 0) : void 0
- }, r.prototype.cancel = function () {
- return this.xhr && this.sent ? this.xhr.abort() : void 0
- }, r.prototype.requestProgressed = function (t) {
- return t.lengthComputable ? this.setProgress(t.loaded / t.total) : void 0
- }, r.prototype.requestLoaded = function () {
- return this.endRequest(function (t) {
- return function () {
- var e;
- return 200 <= (e = t.xhr.status) && 300 > e ? t.delegate.requestCompletedWithResponse(t.xhr.responseText, t.xhr.getResponseHeader("Turbolinks-Location")) : (t.failed = !0, t.delegate.requestFailedWithStatusCode(t.xhr.status, t.xhr.responseText))
- }
- }(this))
- }, r.prototype.requestFailed = function () {
- return this.endRequest(function (t) {
- return function () {
- return t.failed = !0, t.delegate.requestFailedWithStatusCode(t.constructor.NETWORK_FAILURE)
- }
- }(this))
- }, r.prototype.requestTimedOut = function () {
- return this.endRequest(function (t) {
- return function () {
- return t.failed = !0, t.delegate.requestFailedWithStatusCode(t.constructor.TIMEOUT_FAILURE)
- }
- }(this))
- }, r.prototype.requestCanceled = function () {
- return this.endRequest()
- }, r.prototype.notifyApplicationBeforeRequestStart = function () {
- return e.dispatch("turbolinks:request-start", {data: {url: this.url, xhr: this.xhr}})
- }, r.prototype.notifyApplicationAfterRequestEnd = function () {
- return e.dispatch("turbolinks:request-end", {data: {url: this.url, xhr: this.xhr}})
- }, r.prototype.createXHR = function () {
- return this.xhr = new XMLHttpRequest, this.xhr.open("GET", this.url, !0), this.xhr.timeout = 1e3 * this.constructor.timeout, this.xhr.setRequestHeader("Accept", "text/html, application/xhtml+xml"), this.xhr.setRequestHeader("Turbolinks-Referrer", this.referrer), this.xhr.onprogress = this.requestProgressed, this.xhr.onload = this.requestLoaded, this.xhr.onerror = this.requestFailed, this.xhr.ontimeout = this.requestTimedOut, this.xhr.onabort = this.requestCanceled
- }, r.prototype.endRequest = function (t) {
- return this.xhr ? (this.notifyApplicationAfterRequestEnd(), null != t && t.call(this), this.destroy()) : void 0
- }, r.prototype.setProgress = function (t) {
- var e;
- return this.progress = t, "function" == typeof (e = this.delegate).requestProgressed ? e.requestProgressed(this.progress) : void 0
- }, r.prototype.destroy = function () {
- var t;
- return this.setProgress(1), "function" == typeof (t = this.delegate).requestFinished && t.requestFinished(), this.delegate = null, this.xhr = null
- }, r
- }()
- }.call(this), function () {
- var t = function (t, e) {
- return function () {
- return t.apply(e, arguments)
- }
- };
- e.ProgressBar = function () {
- function e() {
- this.trickle = t(this.trickle, this), this.stylesheetElement = this.createStylesheetElement(), this.progressElement = this.createProgressElement()
- }
-
- var r;
- return r = 300, e.defaultCSS = ".turbolinks-progress-bar {\n position: fixed;\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n background: #0076ff;\n z-index: 9999;\n transition: width " + r + "ms ease-out, opacity " + r / 2 + "ms " + r / 2 + "ms ease-in;\n transform: translate3d(0, 0, 0);\n}", e.prototype.show = function () {
- return this.visible ? void 0 : (this.visible = !0, this.installStylesheetElement(), this.installProgressElement(), this.startTrickling())
- }, e.prototype.hide = function () {
- return this.visible && !this.hiding ? (this.hiding = !0, this.fadeProgressElement(function (t) {
- return function () {
- return t.uninstallProgressElement(), t.stopTrickling(), t.visible = !1, t.hiding = !1
- }
- }(this))) : void 0
- }, e.prototype.setValue = function (t) {
- return this.value = t, this.refresh()
- }, e.prototype.installStylesheetElement = function () {
- return document.head.insertBefore(this.stylesheetElement, document.head.firstChild)
- }, e.prototype.installProgressElement = function () {
- return this.progressElement.style.width = 0, this.progressElement.style.opacity = 1, document.documentElement.insertBefore(this.progressElement, document.body), this.refresh()
- }, e.prototype.fadeProgressElement = function (t) {
- return this.progressElement.style.opacity = 0, setTimeout(t, 1.5 * r)
- }, e.prototype.uninstallProgressElement = function () {
- return this.progressElement.parentNode ? document.documentElement.removeChild(this.progressElement) : void 0
- }, e.prototype.startTrickling = function () {
- return null != this.trickleInterval ? this.trickleInterval : this.trickleInterval = setInterval(this.trickle, r)
- }, e.prototype.stopTrickling = function () {
- return clearInterval(this.trickleInterval), this.trickleInterval = null
- }, e.prototype.trickle = function () {
- return this.setValue(this.value + Math.random() / 100)
- }, e.prototype.refresh = function () {
- return requestAnimationFrame(function (t) {
- return function () {
- return t.progressElement.style.width = 10 + 90 * t.value + "%"
- }
- }(this))
- }, e.prototype.createStylesheetElement = function () {
- var t;
- return t = document.createElement("style"), t.type = "text/css", t.textContent = this.constructor.defaultCSS, t
- }, e.prototype.createProgressElement = function () {
- var t;
- return t = document.createElement("div"), t.className = "turbolinks-progress-bar", t
- }, e
- }()
- }.call(this), function () {
- var t = function (t, e) {
- return function () {
- return t.apply(e, arguments)
- }
- };
- e.BrowserAdapter = function () {
- function r(r) {
- this.controller = r, this.showProgressBar = t(this.showProgressBar, this), this.progressBar = new e.ProgressBar
- }
-
- var n, o, i;
- return i = e.HttpRequest, n = i.NETWORK_FAILURE, o = i.TIMEOUT_FAILURE, r.prototype.visitProposedToLocationWithAction = function (t, e) {
- return this.controller.startVisitToLocationWithAction(t, e)
- }, r.prototype.visitStarted = function (t) {
- return t.issueRequest(), t.changeHistory(), t.loadCachedSnapshot()
- }, r.prototype.visitRequestStarted = function (t) {
- return this.progressBar.setValue(0), t.hasCachedSnapshot() || "restore" !== t.action ? this.showProgressBarAfterDelay() : this.showProgressBar()
- }, r.prototype.visitRequestProgressed = function (t) {
- return this.progressBar.setValue(t.progress)
- }, r.prototype.visitRequestCompleted = function (t) {
- return t.loadResponse()
- }, r.prototype.visitRequestFailedWithStatusCode = function (t, e) {
- switch (e) {
- case n:
- case o:
- return this.reload();
- default:
- return t.loadResponse()
- }
- }, r.prototype.visitRequestFinished = function (t) {
- return this.hideProgressBar()
- }, r.prototype.visitCompleted = function (t) {
- return t.followRedirect()
- }, r.prototype.pageInvalidated = function () {
- return this.reload()
- }, r.prototype.showProgressBarAfterDelay = function () {
- return this.progressBarTimeout = setTimeout(this.showProgressBar, this.controller.progressBarDelay)
- }, r.prototype.showProgressBar = function () {
- return this.progressBar.show()
- }, r.prototype.hideProgressBar = function () {
- return this.progressBar.hide(), clearTimeout(this.progressBarTimeout)
- }, r.prototype.reload = function () {
- return window.location.reload()
- }, r
- }()
- }.call(this), function () {
- var t = function (t, e) {
- return function () {
- return t.apply(e, arguments)
- }
- };
- e.History = function () {
- function r(e) {
- this.delegate = e, this.onPageLoad = t(this.onPageLoad, this), this.onPopState = t(this.onPopState, this)
- }
-
- return r.prototype.start = function () {
- return this.started ? void 0 : (addEventListener("popstate", this.onPopState, !1), addEventListener("load", this.onPageLoad, !1), this.started = !0)
- }, r.prototype.stop = function () {
- return this.started ? (removeEventListener("popstate", this.onPopState, !1), removeEventListener("load", this.onPageLoad, !1), this.started = !1) : void 0
- }, r.prototype.push = function (t, r) {
- return t = e.Location.wrap(t), this.update("push", t, r)
- }, r.prototype.replace = function (t, r) {
- return t = e.Location.wrap(t), this.update("replace", t, r)
- }, r.prototype.onPopState = function (t) {
- var r, n, o, i;
- return this.shouldHandlePopState() && (i = null != (n = t.state) ? n.turbolinks : void 0) ? (r = e.Location.wrap(window.location), o = i.restorationIdentifier, this.delegate.historyPoppedToLocationWithRestorationIdentifier(r, o)) : void 0
- }, r.prototype.onPageLoad = function (t) {
- return e.defer(function (t) {
- return function () {
- return t.pageLoaded = !0
- }
- }(this))
- }, r.prototype.shouldHandlePopState = function () {
- return this.pageIsLoaded()
- }, r.prototype.pageIsLoaded = function () {
- return this.pageLoaded || "complete" === document.readyState
- }, r.prototype.update = function (t, e, r) {
- var n;
- return n = {turbolinks: {restorationIdentifier: r}}, history[t + "State"](n, null, e)
- }, r
- }()
- }.call(this), function () {
- e.HeadDetails = function () {
- function t(t) {
- var e, r, n, s, a, u;
- for (this.elements = {}, n = 0, a = t.length; a > n; n++) u = t[n], u.nodeType === Node.ELEMENT_NODE && (s = u.outerHTML, r = null != (e = this.elements)[s] ? e[s] : e[s] = {
- type: i(u),
- tracked: o(u),
- elements: []
- }, r.elements.push(u))
- }
-
- var e, r, n, o, i;
- return t.fromHeadElement = function (t) {
- var e;
- return new this(null != (e = null != t ? t.childNodes : void 0) ? e : [])
- }, t.prototype.hasElementWithKey = function (t) {
- return t in this.elements
- }, t.prototype.getTrackedElementSignature = function () {
- var t, e;
- return function () {
- var r, n;
- r = this.elements, n = [];
- for (t in r) e = r[t].tracked, e && n.push(t);
- return n
- }.call(this).join("")
- }, t.prototype.getScriptElementsNotInDetails = function (t) {
- return this.getElementsMatchingTypeNotInDetails("script", t)
- }, t.prototype.getStylesheetElementsNotInDetails = function (t) {
- return this.getElementsMatchingTypeNotInDetails("stylesheet", t)
- }, t.prototype.getElementsMatchingTypeNotInDetails = function (t, e) {
- var r, n, o, i, s, a;
- o = this.elements, s = [];
- for (n in o) i = o[n], a = i.type, r = i.elements, a !== t || e.hasElementWithKey(n) || s.push(r[0]);
- return s
- }, t.prototype.getProvisionalElements = function () {
- var t, e, r, n, o, i, s;
- r = [], n = this.elements;
- for (e in n) o = n[e], s = o.type, i = o.tracked, t = o.elements, null != s || i ? t.length > 1 && r.push.apply(r, t.slice(1)) : r.push.apply(r, t);
- return r
- }, t.prototype.getMetaValue = function (t) {
- var e;
- return null != (e = this.findMetaElementByName(t)) ? e.getAttribute("content") : void 0
- }, t.prototype.findMetaElementByName = function (t) {
- var r, n, o, i;
- r = void 0, i = this.elements;
- for (o in i) n = i[o].elements, e(n[0], t) && (r = n[0]);
- return r
- }, i = function (t) {
- return r(t) ? "script" : n(t) ? "stylesheet" : void 0
- }, o = function (t) {
- return "reload" === t.getAttribute("data-turbolinks-track")
- }, r = function (t) {
- var e;
- return e = t.tagName.toLowerCase(), "script" === e
- }, n = function (t) {
- var e;
- return e = t.tagName.toLowerCase(), "style" === e || "link" === e && "stylesheet" === t.getAttribute("rel")
- }, e = function (t, e) {
- var r;
- return r = t.tagName.toLowerCase(), "meta" === r && t.getAttribute("name") === e
- }, t
- }()
- }.call(this), function () {
- e.Snapshot = function () {
- function t(t, e) {
- this.headDetails = t, this.bodyElement = e
- }
-
- return t.wrap = function (t) {
- return t instanceof this ? t : "string" == typeof t ? this.fromHTMLString(t) : this.fromHTMLElement(t)
- }, t.fromHTMLString = function (t) {
- var e;
- return e = document.createElement("html"), e.innerHTML = t, this.fromHTMLElement(e)
- }, t.fromHTMLElement = function (t) {
- var r, n, o, i;
- return o = t.querySelector("head"), r = null != (i = t.querySelector("body")) ? i : document.createElement("body"), n = e.HeadDetails.fromHeadElement(o), new this(n, r)
- }, t.prototype.clone = function () {
- return new this.constructor(this.headDetails, this.bodyElement.cloneNode(!0))
- }, t.prototype.getRootLocation = function () {
- var t, r;
- return r = null != (t = this.getSetting("root")) ? t : "/", new e.Location(r)
- }, t.prototype.getCacheControlValue = function () {
- return this.getSetting("cache-control")
- }, t.prototype.getElementForAnchor = function (t) {
- try {
- return this.bodyElement.querySelector("[id='" + t + "'], a[name='" + t + "']")
- } catch (e) {
- }
- }, t.prototype.getPermanentElements = function () {
- return this.bodyElement.querySelectorAll("[id][data-turbolinks-permanent]")
- }, t.prototype.getPermanentElementById = function (t) {
- return this.bodyElement.querySelector("#" + t + "[data-turbolinks-permanent]")
- }, t.prototype.getPermanentElementsPresentInSnapshot = function (t) {
- var e, r, n, o, i;
- for (o = this.getPermanentElements(), i = [], r = 0, n = o.length; n > r; r++) e = o[r], t.getPermanentElementById(e.id) && i.push(e);
- return i
- }, t.prototype.findFirstAutofocusableElement = function () {
- return this.bodyElement.querySelector("[autofocus]")
- }, t.prototype.hasAnchor = function (t) {
- return null != this.getElementForAnchor(t)
- }, t.prototype.isPreviewable = function () {
- return "no-preview" !== this.getCacheControlValue()
- }, t.prototype.isCacheable = function () {
- return "no-cache" !== this.getCacheControlValue()
- }, t.prototype.isVisitable = function () {
- return "reload" !== this.getSetting("visit-control")
- }, t.prototype.getSetting = function (t) {
- return this.headDetails.getMetaValue("turbolinks-" + t)
- }, t
- }()
- }.call(this), function () {
- var t = [].slice;
- e.Renderer = function () {
- function e() {
- }
-
- var r;
- return e.render = function () {
- var e, r, n, o;
- return n = arguments[0], r = arguments[1], e = 3 <= arguments.length ? t.call(arguments, 2) : [], o = function (t, e, r) {
- r.prototype = t.prototype;
- var n = new r, o = t.apply(n, e);
- return Object(o) === o ? o : n
- }(this, e, function () {
- }), o.delegate = n, o.render(r), o
- }, e.prototype.renderView = function (t) {
- return this.delegate.viewWillRender(this.newBody), t(), this.delegate.viewRendered(this.newBody)
- }, e.prototype.invalidateView = function () {
- return this.delegate.viewInvalidated()
- }, e.prototype.createScriptElement = function (t) {
- var e;
- return "false" === t.getAttribute("data-turbolinks-eval") ? t : (e = document.createElement("script"), e.textContent = t.textContent, e.async = !1, r(e, t), e)
- }, r = function (t, e) {
- var r, n, o, i, s, a, u;
- for (i = e.attributes, a = [], r = 0, n = i.length; n > r; r++) s = i[r], o = s.name, u = s.value, a.push(t.setAttribute(o, u));
- return a
- }, e
- }()
- }.call(this), function () {
- var t, r, n = function (t, e) {
- function r() {
- this.constructor = t
- }
-
- for (var n in e) o.call(e, n) && (t[n] = e[n]);
- return r.prototype = e.prototype, t.prototype = new r, t.__super__ = e.prototype, t
- }, o = {}.hasOwnProperty;
- e.SnapshotRenderer = function (e) {
- function o(t, e, r) {
- this.currentSnapshot = t, this.newSnapshot = e, this.isPreview = r, this.currentHeadDetails = this.currentSnapshot.headDetails, this.newHeadDetails = this.newSnapshot.headDetails, this.currentBody = this.currentSnapshot.bodyElement, this.newBody = this.newSnapshot.bodyElement
- }
-
- return n(o, e), o.prototype.render = function (t) {
- return this.shouldRender() ? (this.mergeHead(), this.renderView(function (e) {
- return function () {
- return e.replaceBody(), e.isPreview || e.focusFirstAutofocusableElement(), t()
- }
- }(this))) : this.invalidateView()
- }, o.prototype.mergeHead = function () {
- return this.copyNewHeadStylesheetElements(), this.copyNewHeadScriptElements(), this.removeCurrentHeadProvisionalElements(), this.copyNewHeadProvisionalElements()
- }, o.prototype.replaceBody = function () {
- var t;
- return t = this.relocateCurrentBodyPermanentElements(), this.activateNewBodyScriptElements(), this.assignNewBody(), this.replacePlaceholderElementsWithClonedPermanentElements(t)
- }, o.prototype.shouldRender = function () {
- return this.newSnapshot.isVisitable() && this.trackedElementsAreIdentical()
- }, o.prototype.trackedElementsAreIdentical = function () {
- return this.currentHeadDetails.getTrackedElementSignature() === this.newHeadDetails.getTrackedElementSignature()
- }, o.prototype.copyNewHeadStylesheetElements = function () {
- var t, e, r, n, o;
- for (n = this.getNewHeadStylesheetElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.appendChild(t));
- return o
- }, o.prototype.copyNewHeadScriptElements = function () {
- var t, e, r, n, o;
- for (n = this.getNewHeadScriptElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.appendChild(this.createScriptElement(t)));
- return o
- }, o.prototype.removeCurrentHeadProvisionalElements = function () {
- var t, e, r, n, o;
- for (n = this.getCurrentHeadProvisionalElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.removeChild(t));
- return o
- }, o.prototype.copyNewHeadProvisionalElements = function () {
- var t, e, r, n, o;
- for (n = this.getNewHeadProvisionalElements(), o = [], e = 0, r = n.length; r > e; e++) t = n[e], o.push(document.head.appendChild(t));
- return o
- }, o.prototype.relocateCurrentBodyPermanentElements = function () {
- var e, n, o, i, s, a, u;
- for (a = this.getCurrentBodyPermanentElements(), u = [], e = 0, n = a.length; n > e; e++) i = a[e], s = t(i), o = this.newSnapshot.getPermanentElementById(i.id), r(i, s.element), r(o, i), u.push(s);
- return u
- }, o.prototype.replacePlaceholderElementsWithClonedPermanentElements = function (t) {
- var e, n, o, i, s, a, u;
- for (u = [], o = 0, i = t.length; i > o; o++) a = t[o], n = a.element, s = a.permanentElement, e = s.cloneNode(!0), u.push(r(n, e));
- return u
- }, o.prototype.activateNewBodyScriptElements = function () {
- var t, e, n, o, i, s;
- for (i = this.getNewBodyScriptElements(), s = [], e = 0, o = i.length; o > e; e++) n = i[e], t = this.createScriptElement(n), s.push(r(n, t));
- return s
- }, o.prototype.assignNewBody = function () {
- return document.body = this.newBody
- }, o.prototype.focusFirstAutofocusableElement = function () {
- var t;
- return null != (t = this.newSnapshot.findFirstAutofocusableElement()) ? t.focus() : void 0
- }, o.prototype.getNewHeadStylesheetElements = function () {
- return this.newHeadDetails.getStylesheetElementsNotInDetails(this.currentHeadDetails)
- }, o.prototype.getNewHeadScriptElements = function () {
- return this.newHeadDetails.getScriptElementsNotInDetails(this.currentHeadDetails)
- }, o.prototype.getCurrentHeadProvisionalElements = function () {
- return this.currentHeadDetails.getProvisionalElements()
- }, o.prototype.getNewHeadProvisionalElements = function () {
- return this.newHeadDetails.getProvisionalElements()
- }, o.prototype.getCurrentBodyPermanentElements = function () {
- return this.currentSnapshot.getPermanentElementsPresentInSnapshot(this.newSnapshot)
- }, o.prototype.getNewBodyScriptElements = function () {
- return this.newBody.querySelectorAll("script")
- }, o
- }(e.Renderer), t = function (t) {
- var e;
- return e = document.createElement("meta"), e.setAttribute("name", "turbolinks-permanent-placeholder"), e.setAttribute("content", t.id), {
- element: e,
- permanentElement: t
- }
- }, r = function (t, e) {
- var r;
- return (r = t.parentNode) ? r.replaceChild(e, t) : void 0
- }
- }.call(this), function () {
- var t = function (t, e) {
- function n() {
- this.constructor = t
- }
-
- for (var o in e) r.call(e, o) && (t[o] = e[o]);
- return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
- }, r = {}.hasOwnProperty;
- e.ErrorRenderer = function (e) {
- function r(t) {
- var e;
- e = document.createElement("html"), e.innerHTML = t, this.newHead = e.querySelector("head"), this.newBody = e.querySelector("body")
- }
-
- return t(r, e), r.prototype.render = function (t) {
- return this.renderView(function (e) {
- return function () {
- return e.replaceHeadAndBody(), e.activateBodyScriptElements(), t()
- }
- }(this))
- }, r.prototype.replaceHeadAndBody = function () {
- var t, e;
- return e = document.head, t = document.body, e.parentNode.replaceChild(this.newHead, e), t.parentNode.replaceChild(this.newBody, t)
- }, r.prototype.activateBodyScriptElements = function () {
- var t, e, r, n, o, i;
- for (n = this.getScriptElements(), i = [], e = 0, r = n.length; r > e; e++) o = n[e], t = this.createScriptElement(o), i.push(o.parentNode.replaceChild(t, o));
- return i
- }, r.prototype.getScriptElements = function () {
- return document.documentElement.querySelectorAll("script")
- }, r
- }(e.Renderer)
- }.call(this), function () {
- e.View = function () {
- function t(t) {
- this.delegate = t, this.htmlElement = document.documentElement
- }
-
- return t.prototype.getRootLocation = function () {
- return this.getSnapshot().getRootLocation()
- }, t.prototype.getElementForAnchor = function (t) {
- return this.getSnapshot().getElementForAnchor(t)
- }, t.prototype.getSnapshot = function () {
- return e.Snapshot.fromHTMLElement(this.htmlElement)
- }, t.prototype.render = function (t, e) {
- var r, n, o;
- return o = t.snapshot, r = t.error, n = t.isPreview, this.markAsPreview(n), null != o ? this.renderSnapshot(o, n, e) : this.renderError(r, e)
- }, t.prototype.markAsPreview = function (t) {
- return t ? this.htmlElement.setAttribute("data-turbolinks-preview", "") : this.htmlElement.removeAttribute("data-turbolinks-preview")
- }, t.prototype.renderSnapshot = function (t, r, n) {
- return e.SnapshotRenderer.render(this.delegate, n, this.getSnapshot(), e.Snapshot.wrap(t), r)
- }, t.prototype.renderError = function (t, r) {
- return e.ErrorRenderer.render(this.delegate, r, t)
- }, t
- }()
- }.call(this), function () {
- var t = function (t, e) {
- return function () {
- return t.apply(e, arguments)
- }
- };
- e.ScrollManager = function () {
- function r(r) {
- this.delegate = r, this.onScroll = t(this.onScroll, this), this.onScroll = e.throttle(this.onScroll)
- }
-
- return r.prototype.start = function () {
- return this.started ? void 0 : (addEventListener("scroll", this.onScroll, !1), this.onScroll(), this.started = !0)
- }, r.prototype.stop = function () {
- return this.started ? (removeEventListener("scroll", this.onScroll, !1), this.started = !1) : void 0
- }, r.prototype.scrollToElement = function (t) {
- return t.scrollIntoView()
- }, r.prototype.scrollToPosition = function (t) {
- var e, r;
- return e = t.x, r = t.y, window.scrollTo(e, r)
- }, r.prototype.onScroll = function (t) {
- return this.updatePosition({x: window.pageXOffset, y: window.pageYOffset})
- }, r.prototype.updatePosition = function (t) {
- var e;
- return this.position = t, null != (e = this.delegate) ? e.scrollPositionChanged(this.position) : void 0
- }, r
- }()
- }.call(this), function () {
- e.SnapshotCache = function () {
- function t(t) {
- this.size = t, this.keys = [], this.snapshots = {}
- }
-
- var r;
- return t.prototype.has = function (t) {
- var e;
- return e = r(t), e in this.snapshots
- }, t.prototype.get = function (t) {
- var e;
- if (this.has(t)) return e = this.read(t), this.touch(t), e
- }, t.prototype.put = function (t, e) {
- return this.write(t, e), this.touch(t), e
- }, t.prototype.read = function (t) {
- var e;
- return e = r(t), this.snapshots[e]
- }, t.prototype.write = function (t, e) {
- var n;
- return n = r(t), this.snapshots[n] = e
- }, t.prototype.touch = function (t) {
- var e, n;
- return n = r(t), e = this.keys.indexOf(n), e > -1 && this.keys.splice(e, 1), this.keys.unshift(n), this.trim()
- }, t.prototype.trim = function () {
- var t, e, r, n, o;
- for (n = this.keys.splice(this.size), o = [], t = 0, r = n.length; r > t; t++) e = n[t], o.push(delete this.snapshots[e]);
- return o
- }, r = function (t) {
- return e.Location.wrap(t).toCacheKey()
- }, t
- }()
- }.call(this), function () {
- var t = function (t, e) {
- return function () {
- return t.apply(e, arguments)
- }
- };
- e.Visit = function () {
- function r(r, n, o) {
- this.controller = r, this.action = o, this.performScroll = t(this.performScroll, this), this.identifier = e.uuid(), this.location = e.Location.wrap(n), this.adapter = this.controller.adapter, this.state = "initialized", this.timingMetrics = {}
- }
-
- var n;
- return r.prototype.start = function () {
- return "initialized" === this.state ? (this.recordTimingMetric("visitStart"), this.state = "started", this.adapter.visitStarted(this)) : void 0
- }, r.prototype.cancel = function () {
- var t;
- return "started" === this.state ? (null != (t = this.request) && t.cancel(), this.cancelRender(), this.state = "canceled") : void 0
- }, r.prototype.complete = function () {
- var t;
- return "started" === this.state ? (this.recordTimingMetric("visitEnd"), this.state = "completed", "function" == typeof (t = this.adapter).visitCompleted && t.visitCompleted(this), this.controller.visitCompleted(this)) : void 0
- }, r.prototype.fail = function () {
- var t;
- return "started" === this.state ? (this.state = "failed", "function" == typeof (t = this.adapter).visitFailed ? t.visitFailed(this) : void 0) : void 0
- }, r.prototype.changeHistory = function () {
- var t, e;
- return this.historyChanged ? void 0 : (t = this.location.isEqualTo(this.referrer) ? "replace" : this.action, e = n(t), this.controller[e](this.location, this.restorationIdentifier), this.historyChanged = !0)
- }, r.prototype.issueRequest = function () {
- return this.shouldIssueRequest() && null == this.request ? (this.progress = 0, this.request = new e.HttpRequest(this, this.location, this.referrer), this.request.send()) : void 0
- }, r.prototype.getCachedSnapshot = function () {
- var t;
- return !(t = this.controller.getCachedSnapshotForLocation(this.location)) || null != this.location.anchor && !t.hasAnchor(this.location.anchor) || "restore" !== this.action && !t.isPreviewable() ? void 0 : t
- }, r.prototype.hasCachedSnapshot = function () {
- return null != this.getCachedSnapshot()
- }, r.prototype.loadCachedSnapshot = function () {
- var t, e;
- return (e = this.getCachedSnapshot()) ? (t = this.shouldIssueRequest(), this.render(function () {
- var r;
- return this.cacheSnapshot(), this.controller.render({
- snapshot: e,
- isPreview: t
- }, this.performScroll), "function" == typeof (r = this.adapter).visitRendered && r.visitRendered(this), t ? void 0 : this.complete()
- })) : void 0
- }, r.prototype.loadResponse = function () {
- return null != this.response ? this.render(function () {
- var t, e;
- return this.cacheSnapshot(), this.request.failed ? (this.controller.render({error: this.response}, this.performScroll), "function" == typeof (t = this.adapter).visitRendered && t.visitRendered(this), this.fail()) : (this.controller.render({snapshot: this.response}, this.performScroll), "function" == typeof (e = this.adapter).visitRendered && e.visitRendered(this), this.complete())
- }) : void 0
- }, r.prototype.followRedirect = function () {
- return this.redirectedToLocation && !this.followedRedirect ? (this.location = this.redirectedToLocation, this.controller.replaceHistoryWithLocationAndRestorationIdentifier(this.redirectedToLocation, this.restorationIdentifier), this.followedRedirect = !0) : void 0
- }, r.prototype.requestStarted = function () {
- var t;
- return this.recordTimingMetric("requestStart"), "function" == typeof (t = this.adapter).visitRequestStarted ? t.visitRequestStarted(this) : void 0
- }, r.prototype.requestProgressed = function (t) {
- var e;
- return this.progress = t, "function" == typeof (e = this.adapter).visitRequestProgressed ? e.visitRequestProgressed(this) : void 0
- }, r.prototype.requestCompletedWithResponse = function (t, r) {
- return this.response = t, null != r && (this.redirectedToLocation = e.Location.wrap(r)), this.adapter.visitRequestCompleted(this)
- }, r.prototype.requestFailedWithStatusCode = function (t, e) {
- return this.response = e, this.adapter.visitRequestFailedWithStatusCode(this, t)
- }, r.prototype.requestFinished = function () {
- var t;
- return this.recordTimingMetric("requestEnd"), "function" == typeof (t = this.adapter).visitRequestFinished ? t.visitRequestFinished(this) : void 0
- }, r.prototype.performScroll = function () {
- return this.scrolled ? void 0 : ("restore" === this.action ? this.scrollToRestoredPosition() || this.scrollToTop() : this.scrollToAnchor() || this.scrollToTop(), this.scrolled = !0)
- }, r.prototype.scrollToRestoredPosition = function () {
- var t, e;
- return t = null != (e = this.restorationData) ? e.scrollPosition : void 0, null != t ? (this.controller.scrollToPosition(t), !0) : void 0
- }, r.prototype.scrollToAnchor = function () {
- return null != this.location.anchor ? (this.controller.scrollToAnchor(this.location.anchor), !0) : void 0
- }, r.prototype.scrollToTop = function () {
- return this.controller.scrollToPosition({x: 0, y: 0})
- }, r.prototype.recordTimingMetric = function (t) {
- var e;
- return null != (e = this.timingMetrics)[t] ? e[t] : e[t] = (new Date).getTime()
- }, r.prototype.getTimingMetrics = function () {
- return e.copyObject(this.timingMetrics)
- }, n = function (t) {
- switch (t) {
- case"replace":
- return "replaceHistoryWithLocationAndRestorationIdentifier";
- case"advance":
- case"restore":
- return "pushHistoryWithLocationAndRestorationIdentifier"
- }
- }, r.prototype.shouldIssueRequest = function () {
- return "restore" === this.action ? !this.hasCachedSnapshot() : !0
- }, r.prototype.cacheSnapshot = function () {
- return this.snapshotCached ? void 0 : (this.controller.cacheSnapshot(), this.snapshotCached = !0)
- }, r.prototype.render = function (t) {
- return this.cancelRender(), this.frame = requestAnimationFrame(function (e) {
- return function () {
- return e.frame = null, t.call(e)
- }
- }(this))
- }, r.prototype.cancelRender = function () {
- return this.frame ? cancelAnimationFrame(this.frame) : void 0
- }, r
- }()
- }.call(this), function () {
- var t = function (t, e) {
- return function () {
- return t.apply(e, arguments)
- }
- };
- e.Controller = function () {
- function r() {
- this.clickBubbled = t(this.clickBubbled, this), this.clickCaptured = t(this.clickCaptured, this), this.pageLoaded = t(this.pageLoaded, this), this.history = new e.History(this), this.view = new e.View(this), this.scrollManager = new e.ScrollManager(this), this.restorationData = {}, this.clearCache(), this.setProgressBarDelay(500)
- }
-
- return r.prototype.start = function () {
- return e.supported && !this.started ? (addEventListener("click", this.clickCaptured, !0), addEventListener("DOMContentLoaded", this.pageLoaded, !1), this.scrollManager.start(), this.startHistory(), this.started = !0, this.enabled = !0) : void 0
- }, r.prototype.disable = function () {
- return this.enabled = !1
- }, r.prototype.stop = function () {
- return this.started ? (removeEventListener("click", this.clickCaptured, !0), removeEventListener("DOMContentLoaded", this.pageLoaded, !1), this.scrollManager.stop(), this.stopHistory(), this.started = !1) : void 0
- }, r.prototype.clearCache = function () {
- return this.cache = new e.SnapshotCache(10)
- }, r.prototype.visit = function (t, r) {
- var n, o;
- return null == r && (r = {}), t = e.Location.wrap(t), this.applicationAllowsVisitingLocation(t) ? this.locationIsVisitable(t) ? (n = null != (o = r.action) ? o : "advance", this.adapter.visitProposedToLocationWithAction(t, n)) : window.location = t : void 0
- }, r.prototype.startVisitToLocationWithAction = function (t, r, n) {
- var o;
- return e.supported ? (o = this.getRestorationDataForIdentifier(n), this.startVisit(t, r, {restorationData: o})) : window.location = t
- }, r.prototype.setProgressBarDelay = function (t) {
- return this.progressBarDelay = t
- }, r.prototype.startHistory = function () {
- return this.location = e.Location.wrap(window.location), this.restorationIdentifier = e.uuid(), this.history.start(), this.history.replace(this.location, this.restorationIdentifier)
- }, r.prototype.stopHistory = function () {
- return this.history.stop()
- }, r.prototype.pushHistoryWithLocationAndRestorationIdentifier = function (t, r) {
- return this.restorationIdentifier = r, this.location = e.Location.wrap(t), this.history.push(this.location, this.restorationIdentifier)
- }, r.prototype.replaceHistoryWithLocationAndRestorationIdentifier = function (t, r) {
- return this.restorationIdentifier = r, this.location = e.Location.wrap(t), this.history.replace(this.location, this.restorationIdentifier)
- }, r.prototype.historyPoppedToLocationWithRestorationIdentifier = function (t, r) {
- var n;
- return this.restorationIdentifier = r, this.enabled ? (n = this.getRestorationDataForIdentifier(this.restorationIdentifier), this.startVisit(t, "restore", {
- restorationIdentifier: this.restorationIdentifier,
- restorationData: n,
- historyChanged: !0
- }), this.location = e.Location.wrap(t)) : this.adapter.pageInvalidated()
- }, r.prototype.getCachedSnapshotForLocation = function (t) {
- var e;
- return null != (e = this.cache.get(t)) ? e.clone() : void 0
- }, r.prototype.shouldCacheSnapshot = function () {
- return this.view.getSnapshot().isCacheable();
- }, r.prototype.cacheSnapshot = function () {
- var t, r;
- return this.shouldCacheSnapshot() ? (this.notifyApplicationBeforeCachingSnapshot(), r = this.view.getSnapshot(), t = this.lastRenderedLocation, e.defer(function (e) {
- return function () {
- return e.cache.put(t, r.clone())
- }
- }(this))) : void 0
- }, r.prototype.scrollToAnchor = function (t) {
- var e;
- return (e = this.view.getElementForAnchor(t)) ? this.scrollToElement(e) : this.scrollToPosition({x: 0, y: 0})
- }, r.prototype.scrollToElement = function (t) {
- return this.scrollManager.scrollToElement(t)
- }, r.prototype.scrollToPosition = function (t) {
- return this.scrollManager.scrollToPosition(t)
- }, r.prototype.scrollPositionChanged = function (t) {
- var e;
- return e = this.getCurrentRestorationData(), e.scrollPosition = t
- }, r.prototype.render = function (t, e) {
- return this.view.render(t, e)
- }, r.prototype.viewInvalidated = function () {
- return this.adapter.pageInvalidated()
- }, r.prototype.viewWillRender = function (t) {
- return this.notifyApplicationBeforeRender(t)
- }, r.prototype.viewRendered = function () {
- return this.lastRenderedLocation = this.currentVisit.location, this.notifyApplicationAfterRender()
- }, r.prototype.pageLoaded = function () {
- return this.lastRenderedLocation = this.location, this.notifyApplicationAfterPageLoad()
- }, r.prototype.clickCaptured = function () {
- return removeEventListener("click", this.clickBubbled, !1), addEventListener("click", this.clickBubbled, !1)
- }, r.prototype.clickBubbled = function (t) {
- var e, r, n;
- return this.enabled && this.clickEventIsSignificant(t) && (r = this.getVisitableLinkForNode(t.target)) && (n = this.getVisitableLocationForLink(r)) && this.applicationAllowsFollowingLinkToLocation(r, n) ? (t.preventDefault(), e = this.getActionForLink(r), this.visit(n, {action: e})) : void 0
- }, r.prototype.applicationAllowsFollowingLinkToLocation = function (t, e) {
- var r;
- return r = this.notifyApplicationAfterClickingLinkToLocation(t, e), !r.defaultPrevented
- }, r.prototype.applicationAllowsVisitingLocation = function (t) {
- var e;
- return e = this.notifyApplicationBeforeVisitingLocation(t), !e.defaultPrevented
- }, r.prototype.notifyApplicationAfterClickingLinkToLocation = function (t, r) {
- return e.dispatch("turbolinks:click", {target: t, data: {url: r.absoluteURL}, cancelable: !0})
- }, r.prototype.notifyApplicationBeforeVisitingLocation = function (t) {
- return e.dispatch("turbolinks:before-visit", {data: {url: t.absoluteURL}, cancelable: !0})
- }, r.prototype.notifyApplicationAfterVisitingLocation = function (t) {
- return e.dispatch("turbolinks:visit", {data: {url: t.absoluteURL}})
- }, r.prototype.notifyApplicationBeforeCachingSnapshot = function () {
- return e.dispatch("turbolinks:before-cache")
- }, r.prototype.notifyApplicationBeforeRender = function (t) {
- return e.dispatch("turbolinks:before-render", {data: {newBody: t}})
- }, r.prototype.notifyApplicationAfterRender = function () {
- return e.dispatch("turbolinks:render")
- }, r.prototype.notifyApplicationAfterPageLoad = function (t) {
- return null == t && (t = {}), e.dispatch("turbolinks:load", {
- data: {
- url: this.location.absoluteURL,
- timing: t
- }
- })
- }, r.prototype.startVisit = function (t, e, r) {
- var n;
- return null != (n = this.currentVisit) && n.cancel(), this.currentVisit = this.createVisit(t, e, r), this.currentVisit.start(), this.notifyApplicationAfterVisitingLocation(t)
- }, r.prototype.createVisit = function (t, r, n) {
- var o, i, s, a, u;
- return i = null != n ? n : {}, a = i.restorationIdentifier, s = i.restorationData, o = i.historyChanged, u = new e.Visit(this, t, r), u.restorationIdentifier = null != a ? a : e.uuid(), u.restorationData = e.copyObject(s), u.historyChanged = o, u.referrer = this.location, u
- }, r.prototype.visitCompleted = function (t) {
- return this.notifyApplicationAfterPageLoad(t.getTimingMetrics())
- }, r.prototype.clickEventIsSignificant = function (t) {
- return !(t.defaultPrevented || t.target.isContentEditable || t.which > 1 || t.altKey || t.ctrlKey || t.metaKey || t.shiftKey)
- }, r.prototype.getVisitableLinkForNode = function (t) {
- return this.nodeIsVisitable(t) ? e.closest(t, "a[href]:not([target]):not([download])") : void 0
- }, r.prototype.getVisitableLocationForLink = function (t) {
- var r;
- return r = new e.Location(t.getAttribute("href")), this.locationIsVisitable(r) ? r : void 0
- }, r.prototype.getActionForLink = function (t) {
- var e;
- return null != (e = t.getAttribute("data-turbolinks-action")) ? e : "advance"
- }, r.prototype.nodeIsVisitable = function (t) {
- var r;
- return (r = e.closest(t, "[data-turbolinks]")) ? "false" !== r.getAttribute("data-turbolinks") : !0
- }, r.prototype.locationIsVisitable = function (t) {
- return t.isPrefixedBy(this.view.getRootLocation()) && t.isHTML()
- }, r.prototype.getCurrentRestorationData = function () {
- return this.getRestorationDataForIdentifier(this.restorationIdentifier)
- }, r.prototype.getRestorationDataForIdentifier = function (t) {
- var e;
- return null != (e = this.restorationData)[t] ? e[t] : e[t] = {}
- }, r
- }()
- }.call(this), function () {
- !function () {
- var t, e;
- if ((t = e = document.currentScript) && !e.hasAttribute("data-turbolinks-suppress-warning")) for (; t = t.parentNode;) if (t === document.body) return console.warn("You are loading Turbolinks from a