function countUp(n,t,i,r,u,f){for(var e,h=0,s=["webkit","moz","ms","o"],o=0;o<s.length&&!window.requestAnimationFrame;++o)window.requestAnimationFrame=window[s[o]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[s[o]+"CancelAnimationFrame"]||window[s[o]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(n){var t=(new Date).getTime(),i=Math.max(0,16-(t-h)),r=window.setTimeout(function(){n(t+i)},i);return h=t+i,r});window.cancelAnimationFrame||(window.cancelAnimationFrame=function(n){clearTimeout(n)});this.options=f||{useEasing:!0,useGrouping:!0,separator:",",decimal:"."};""==this.options.separator&&(this.options.useGrouping=!1);null==this.options.prefix&&(this.options.prefix="");null==this.options.suffix&&(this.options.suffix="");e=this;this.d="string"==typeof n?document.getElementById(n):n;this.startVal=Number(t);this.endVal=Number(i);this.countDown=this.startVal>this.endVal?!0:!1;this.startTime=null;this.timestamp=null;this.remaining=null;this.frameVal=this.startVal;this.rAF=null;this.decimals=Math.max(0,r||0);this.dec=Math.pow(10,this.decimals);this.duration=1e3*u||2e3;this.version=function(){return"1.3.2"};this.printValue=function(n){var t=isNaN(n)?"--":e.formatNumber(n);"INPUT"==e.d.tagName?this.d.value=t:"text"==e.d.tagName?this.d.textContent=t:this.d.innerHTML=t};this.easeOutExpo=function(n,t,i,r){return 1024*i*(-Math.pow(2,-10*n/r)+1)/1023+t};this.count=function(n){var t,i;null===e.startTime&&(e.startTime=n);e.timestamp=n;t=n-e.startTime;(e.remaining=e.duration-t,e.options.useEasing)?e.countDown?(i=e.easeOutExpo(t,0,e.startVal-e.endVal,e.duration),e.frameVal=e.startVal-i):e.frameVal=e.easeOutExpo(t,e.startVal,e.endVal-e.startVal,e.duration):e.countDown?(i=(e.startVal-e.endVal)*(t/e.duration),e.frameVal=e.startVal-i):e.frameVal=e.startVal+(e.endVal-e.startVal)*(t/e.duration);e.frameVal=e.countDown?e.frameVal<e.endVal?e.endVal:e.frameVal:e.frameVal>e.endVal?e.endVal:e.frameVal;e.frameVal=Math.round(e.frameVal*e.dec)/e.dec;e.printValue(e.frameVal);t<e.duration?e.rAF=requestAnimationFrame(e.count):null!=e.callback&&e.callback()};this.start=function(n){return e.callback=n,isNaN(e.endVal)||isNaN(e.startVal)?(console.log("countUp error: startVal or endVal is not a number"),e.printValue()):e.rAF=requestAnimationFrame(e.count),!1};this.stop=function(){cancelAnimationFrame(e.rAF)};this.reset=function(){e.startTime=null;e.startVal=t;cancelAnimationFrame(e.rAF);e.printValue(e.startVal)};this.resume=function(){e.stop();e.startTime=null;e.duration=e.remaining;e.startVal=e.frameVal;requestAnimationFrame(e.count)};this.formatNumber=function(n){n=n.toFixed(e.decimals);n+="";var i,t,u,r;if(i=n.split("."),t=i[0],u=i.length>1?e.options.decimal+i[1]:"",r=/(\d+)(\d{3})/,e.options.useGrouping)for(;r.test(t);)t=t.replace(r,"$1"+e.options.separator+"$2");return e.options.prefix+t+u+e.options.suffix};e.printValue(e.startVal)}function closeModals(){if($("[data-uses-overlay=true]").removeClass("show"),$(".overlay").removeClass("show"),setTimeout(function(){$(".modal").empty()},200),history.replaceState){var n="/",t=window.location.pathname.split("/")[1];/^(de|fr|es|it|ko|hi|pl|pt|zh)$/.test(t)&&(n+=t);history.replaceState({page:n},null,n)}}function appinit(){if(document.removeEventListener("turbolinks:load",appinit),window.localStorage.getItem("user")||$.ajax({type:"get",url:"/api/auth/token?client=cfe",success:function(n){window.localStorage.setItem("user",JSON.stringify({jwt:n.jwt}))}}),history.replaceState){$(document).oncustom("click",".js-load-via-modal",function(){});$(document).oncustom("submit",".js-submit-via-modal",function(){})}if(history.replaceState)$(document).oncustom("submit",".js-source-form",function(){});$(document).oncustom("submit",".js-delete-reference-form",function(n){var t,i;n.preventDefault();t=$(this);t.parents("li").addClass("pending-deletion");confirm("Are you sure you want to delete this reference?")?(i=$('<div class="spinner-wrapper"><div class="spinner"><\/div><\/div>'),$("body").prepend(i),$.ajax({type:"POST",url:t.attr("action"),success:function(n){var r=$(n);i.remove();t.parents("li").slideUp(function(){replaceBibliography(r);replaceBibliographyDropdown(r);replaceSortSearchAndFilterSettings(r,!0);applySortSearchAndFilterSettings();bindTipsy()})},error:function(){alert("Error. Please try again.");location.reload()},datatype:"html"})):t.parents("li").removeClass("pending-deletion")});$(document).oncustom("submit",".js-delete-references-form",function(n){var i,t,r;n.preventDefault();i=$(this);t=$(".reference-list li.selected");t.addClass("pending-deletion");confirm("Are you sure you want to delete the "+t.length+" selected references?")?(r=$('<div class="spinner-wrapper"><div class="spinner"><\/div><\/div>'),$("body").prepend(r),$.ajax({type:"POST",url:i.attr("action"),data:i.serialize(),success:function(n){var i=$(n);r.remove();t.slideUp(function(){replaceBibliography(i);replaceBibliographyDropdown(i);replaceSortSearchAndFilterSettings(i,!0);applySortSearchAndFilterSettings();bindTipsy()})},error:function(){alert("Error. Please try again.");location.reload()}})):t.removeClass("pending-deletion")});$(document).oncustom("submit",".js-delete-bibliography-form",function(n){$(".page").addClass("pending-deletion");confirm("WARNING: This will DELETE your bibliography. All references will be lost and cannot be restored. Are you sure you want to continue?")||(n.preventDefault(),$(".page").removeClass("pending-deletion"))});$(document).oncustom("submit",".js-delete-expired-bibliography-form",function(n){$(".page").addClass("pending-deletion");$.ajax({url:"/cite/bibliography/getexpiredbibliographiescountofuser",success:function(t){confirm("WARNING: You have "+t.ExpiredCount+" out of "+t.TotalCount+" bibliographies expired. Click OK to delete them. All references will be lost and cannot be restored. Are you sure you want to continue?")?$.ajax({url:"/cite/bibliography/Delete?deleteExpiredBibliographies=True",type:"POST",success:function(){location.reload()},error:function(){alert("error in deletion");location.reload()}}):(n.preventDefault(),$(".page").removeClass("pending-deletion"))},error:function(){alert("Error. Please try again.")}});n.preventDefault()});$(document).oncustom("submit",".js-unshare-bibliography-form",function(n){var t=$(this).parent();t.addClass("pending-deletion");confirm("Are you sure you want to stop sharing this bibliography? Your group will no longer be able to access or edit it.")||(t.removeClass("pending-deletion"),n.preventDefault())});$(document).oncustom("change input",".js-reference-checkbox",function(){var i=$(this),r=i.parents("li"),n,u,t;i.is(":checked")?r.addClass("selected"):r.removeClass("selected");n=$(".js-reference-checkbox:checked");u=n.map(function(){return this.value}).get().join(",");$(".selected-reference-ids").val(u);$(".selected-reference-count").text(n.length);t=$(".page .toolbox");n.length>0?t.addClass("show"):t.removeClass("show")});$(document).oncustom("change",".js-change-bib-dropdown",function(n){var i,t,r;n.preventDefault();i=$("option:selected",this);t=$('<div class="spinner-wrapper"><div class="spinner"><\/div><\/div>');$("body").prepend(t);r=$(i).data("href");$.ajax({url:r,success:function(n){var i=$(n);replaceBibliography(i);replaceSortSearchAndFilterSettings(i,!1);bindTipsy();$(".page-wrapper").scrollTop(0);t.remove()},error:function(){alert("Error. Please try again.");location.reload()}})});$(document).oncustom("click",".js-change-style-dropdown a.btn-small",function(n){var t,i;n.preventDefault();t=$('<div class="spinner-wrapper"><div class="spinner"><\/div><\/div>');$("body").prepend(t);i=$(this);$.ajax({url:this.href,success:function(n,r,u){var o=u.getResponseHeader("Current-Location"),f,e;history.replaceState({page:o},null,o);document.title=n.match(/<title>(.*?)<\/title>/)[1];f=$(n);$(".title-bar h1").html(f.filter(".title-bar").find("h1").html());replaceBibliography(f);replaceSocialButtons(f);replaceAddNewReferenceLink(f);applySortSearchAndFilterSettings();bindTipsy();t.remove();e=i.text();$(".js-selected-style").text(e).attr("title",e);$(".js-change-style-dropdown a").removeClass("selected");i.addClass("selected")},error:function(){alert("Error. Please try again.");location.reload()}})});$(".page-wrapper").scroll(function(){var t=$(this).scrollTop(),n=$(".reference-list-header");t>63?n.addClass("sticky"):n.removeClass("sticky")});$(".js-reference-style-search").oncustom("keyup","input",function(){applyReferenceStyleSearch()});$(document).oncustom("submit",".js-reference-style-search",function(n){n.preventDefault();applyReferenceStyleSearch()});var n=!1;$(".reference-styles").scroll(function(){var i=$(".js-reference-styles-list"),t=$(".js-load-more-reference-styles");!n&&i.height()-$(this).scrollTop()<600&&t.length>0&&(n=!0,$.ajax({url:t.attr("href"),success:function(r){t.remove();i.append(r);n=!1},error:function(){alert("Error. Please try again.");location.reload()}}))});$(document).oncustom("click",".js-sort-search-and-filter-close",function(){$(".sort_search").slideToggle()});$(".js-sort-search-and-filter").oncustom("change input","input:not(.js-filter-all)",function(){applySortSearchAndFilterSettings()});$(".js-sort-search-and-filter").oncustom("submit",".js-sort-search-and-filter-form",function(n){n.preventDefault();applySortSearchAndFilterSettings()});$(".js-sort-search-and-filter").oncustom("change input",".js-filter-all",function(){$(this).closest("ul").find(":checkbox:not(.js-filter-all)").prop("checked",this.checked);applySortSearchAndFilterSettings()});sessionStorage.getItem("modalPosition")&&$(".modal").offset($.parseJSON(sessionStorage.getItem("modalPosition")));$(".modal").liveDraggable({handle:"h2"});$(document).oncustom("click",".js-add-author-btn",function(){var t=$(".author-template").last().clone(),n=$(document.createElement("div")).append(t).html();n=n.replace(/guid/g,createGuid());$(n).appendTo($(this).parent().siblings("fieldset")).slideDown()});$(document).oncustom("click",".js-add-chapter-author-btn",function(){var t=$(".chapter-author-template").last().clone(),n=$(document.createElement("div")).append(t).html();n=n.replace(/guid/g,createGuid());$(n).appendTo($(this).parent().siblings("fieldset")).slideDown()});$(document).oncustom("click",".js-remove-author-btn",function(){$(this).closest(".input-row").slideUp(function(){$(this).remove()})});$(document).oncustom("click",".attach-quote-btn",function(){var n=$(".js-attach-quote-fieldset-container");n.is(":visible")?n.slideUp():n.slideDown()});$(document).oncustom("click",".js-load-more-journal-results-btn",function(n){n.preventDefault();var t=$(this),i=t.data("query"),r=t.data("skip-results");$.ajax({url:this.href,type:"POST",data:{jrQry:i,skip:r},success:function(n){$(".js-results-list").append($(n).find(".js-results-list li"));t.data("skip-results",t.data("skip-results")+20)},error:function(){alert("Error. Please try again.");location.reload()}})});$(document).oncustom("click",".js-load-more-book-results-btn",function(n){n.preventDefault();var t=$(this),i=t.data("query"),r=t.data("skip-results");$.ajax({url:this.href,type:"POST",data:{bkQry:i,skip:r},success:function(n){$(".js-results-list").append($(n).find(".js-results-list li"));t.data("skip-results",t.data("skip-results")+20)},error:function(){alert("Error. Please try again.");location.reload()}})});$(document).oncustom("click",".js-load-more-keyword-results-btn",function(n){n.preventDefault();var t=$(this),i=t.data("query"),r=t.data("skip-results");$.ajax({url:this.href,type:"POST",data:{autociteUrl:i,from:r},success:function(n){$(".js-results-list").append($(n).find(".js-results-list li"));t.data("skip-results",t.data("skip-results")+30)},error:function(){alert("Error. Please try again.");location.reload()}})});$(document).oncustom("click",".js-show-manual-form-btn",function(){$(this).siblings(".manual-form").addClass("show")});$(".corner-note.show").length&&window.setTimeout(function(){$(".corner-note.show").removeClass("show")},5e3);$(document).oncustom("click",".js-jump-to-new-reference",function(){$(".page-wrapper").scrollTo(".highlighted",{offset:{left:0,top:-200}})});$(document).oncustom("click",".selectable",function(){$(this).selectText()});$(".page-wrapper").oncustom("copy",".reference-parts",function(n){var u=$(n.currentTarget).parent().data("reload-oncopy"),t=$(n.currentTarget).parent().children(".li-overlay"),i=t.find(".loading-text"),r;$(".hover").addClass("hide-hover-btns");r=$(n.currentTarget).parent().hasClass("highlighted");$(n.currentTarget).parent().removeClass("highlighted");$(n.currentTarget).find(".selectable").css("color","#000");i.text("Copying...");t.addClass("show");setTimeout(function(){r&&$(n.currentTarget).parent().addClass("highlighted");$(n.currentTarget).find(".selectable").css("color","")});setTimeout(function(){i.text("Copied!");setTimeout(function(){var r=$.cookie("dont-show-copy-prompt"),i=$(n.currentTarget).parent().data("showconfirmation");i=typeof i!="undefined"?i:!0;r!==undefined&&r=="1"?(t.removeClass("show"),$(".hover").removeClass("hide-hover-btns")):(i&&showModalConfirmation(),t.removeClass("show"))},1e3)},500);u&&reloadAds()});$(".logout-action").oncustom("click",function(n){n.preventDefault();var t=$(this);$.ajax({type:"get",url:"/api/auth/logout",success:function(){$.ajax({type:"get",url:"/api/auth/token?client=cfe",success:function(n){window.localStorage.setItem("user",JSON.stringify({jwt:n.jwt}));location.href=t.attr("href")},error:function(){window.localStorage.removeItem("user");location.href=t.attr("href")}})},xhrFields:{withCredentials:!0}});ga("send","event","account","header navigation","logout")});bindLaddaButtons();bindTipsy();bindClipboard();document.addEventListener("turbolinks:load",appinit)}function setSortField(n){n==="addeddatetime"?$("#sort-addeddatetime").attr("checked","true"):n==="title"?$("#sort-title").attr("checked","true"):n==="year"?$("#sort-year").attr("checked","true"):$("#sort-author").attr("checked","true")}function createGuid(){function n(n){var t=(Math.random().toString(16)+"000000000").substr(2,8);return n?"-"+t.substr(0,4)+"-"+t.substr(4,4):t}return n()+n(!0)+n(!0)+n()}function bindLaddaButtons(){Ladda.bind(".ladda-button")}function bindTipsy(){$(".tipsy").remove();$("[data-tipsy]").tipsy({gravity:function(){var n=$(this).data("tipsy-gravity");return n===undefined?"e":n},html:!0})}function reloadAds(){try{SBMGlobal.run.refresh()}catch(n){}}function bindClipboard(){var n=new ClipboardJS(".js-copy-bibliography-btn"),t=new ClipboardJS(".js-copy-in-text-btn");n.on("success",function(n){var i=$(n.trigger).data("pop-up-width"),r=$(n.trigger).data("pop-up-height"),u=$(n.trigger).data("uses-overlay"),f=$(n.trigger).data("reload"),e={width:i,height:r,useOverlay:u},t;f&&ga("send","event","bibliography","copy-bibliography-citation","copy");t=$(n.trigger).parent();showCopyConfirmation(t,"/cite/download/copyprompt",e)});t.on("success",function(n){var i=$(n.trigger).data("pop-up-width"),r=$(n.trigger).data("pop-up-height"),u=$(n.trigger).data("uses-overlay"),f=$(n.trigger).data("reload"),e={width:i,height:r,useOverlay:u},t;f&&ga("send","event","bibliography","copy-in-text-citation","copy");t=$(n.trigger).parent();showCopyConfirmation(t,"/cite/download/intextprompt",e)})}function showCopyConfirmation(n,t,i){var e=n.closest("li"),r=e.data("showconfirmation");r=typeof r!="undefined"?r:!0;var o=e.children(".li-overlay"),h=o.find(".loading-text"),u=0,f=0,s=!1;i&&(u=i.width?i.width:0,f=i.height?i.height:0,s=typeof i.useOverlay!="undefined"?i.useOverlay:!0);setTimeout(function(){var i,n;o.removeClass("show");i=$.cookie("dont-show-copy-prompt");i!==undefined&&i!="1"&&r?(n=$(".modal"),u!==0&&f!==0&&n.css({height:f,width:u,margin:"auto"}),n.length!==0&&(s&&$(".overlay").addClass("show"),n.empty().addClass("show").prepend('<div class="spinner"><\/div>'),$.ajax({url:t,success:function(t){var i=$(t);n.html(i.find(".modal").html())},error:function(){alert("Error. Please try again.");location.reload()},dataType:"html"}))):$(".hover").removeClass("hide-hover-btns")},1e3)}function showModalConfirmation(){var n=$(".modal");n.hasClass("show")||(n.empty().addClass("show").prepend('<div class="spinner"><\/div>'),$.ajax({url:"/cite/download/copyprompt",success:function(t){var i=$(t);n.html(i.find(".modal").html())},error:function(){alert("Error. Please try again.");location.reload()},dataType:"html"}))}function showAjaxCornerNotes(n){var t=$(".corner-note-container"),i=n.find(".corner-note");i.each(function(){var n=$(this);t.prepend(n);window.setTimeout(function(){n.removeClass("show");window.setTimeout(function(){n.remove()},200)},5e3)})}function showAjaxAlerts(n){var t=$(".alert-container"),i=n.filter(".alert-container").find(".alert");i.each(function(){t.append($(this))})}function replaceAddNewReferenceLink(n){$("#add-new-reference").attr("href",n.find("#add-new-reference").attr("href"))}function replaceBibliography(n){$(".js-page-ajax-wrapper").html(n.find(".js-page-ajax-wrapper").html());bindClipboard();var t=$(".reference-list li").length;$(".page.a4").data("metadata-prompted")==="False"&&t===3&&$.ajax({url:"/cite/bibliography/rename",success:function(n,t,i){var r=i.getResponseHeader("Current-Location"),u;checkForAccountExpiration(r);history.replaceState({page:r},null,r);document.title=n.match(/<title>(.*?)<\/title>/)[1];checkForVersionUpdate(n);u=$(n);$(".modal").html(u.filter(".modal").html());showAjaxAlerts(u);bindLaddaButtons();$(".overlay").addClass("show");$(".modal").addClass("show");$(".alert-container").append($('<div class="alert alert-info">Please let us know what your essay is about so that we can make resource recommendations!<\/div>'))},error:function(){alert("Error. Please try again.");location.reload()},dataType:"html"})}function replaceSocialButtons(n){$(".social-sidebar").html(n.filter(".social-sidebar").html())}function replaceBibliographyDropdown(n){$(".js-change-bib-dropdown").html(n.find(".js-change-bib-dropdown").html())}function applyReferenceStyleSearch(){clearTimeout(referenceStyleSearchTimer);var n=$('.js-reference-style-search input[name="q"]'),t=n.val();(t.length>2||t.length===0)&&(referenceStyleSearchTimer=setTimeout(function(){var t=n.closest("form")[0];$.ajax({type:t.method,url:t.action,data:$(t).serialize(),success:function(n){$(".js-reference-styles-list").html(n)},error:function(){alert("Error. Please try again.");location.reload()}})},300))}function replaceSortSearchAndFilterSettings(n,t){var i=$(".js-sort-search-and-filter"),r=n.filter(".js-sort-search-and-filter"),u,f,e;t&&(u=r.find("ul"),f=i.find("input:checkbox:not(:checked)"),f.each(function(){u.find('input:checkbox[value="'+$(this).val()+'"]').attr("checked",!1)}),r.find('input[type="text"]').attr("value",i.find('input[type="text"]').val()),e=i.find("input:radio:checked").val(),r.find('input:radio[value="'+e+'"]').attr("checked","checked"));i.html(r.html())}function sortReferences(n){var t=n.find("input:radio:checked").val(),i=$('<div class="spinner-wrapper"><div class="spinner"><\/div><\/div>');$("body").prepend(i);$.ajax({type:"POST",url:"/cite/bibliography/changesortorder",data:{sortColumn:t},success:function(n){n==="Ok"&&(t!=="author"?$(".js-sort-icon").css("color","#00cc00"):$(".js-sort-icon").css("color","inherit"),t==="addeddatetime"?$(".reference-list li").sort(function(n,i){var r=new Date($(n).data(t)),u=new Date($(i).data(t));return u>=r?1:-1}).appendTo(".reference-list"):$(".reference-list li").sort(function(n,i){var r=$(n).data(t).toString().toUpperCase(),u=$(i).data(t).toString().toUpperCase();return u<=r?1:-1}).appendTo(".reference-list"),i.remove())},error:function(){alert("Error. Please try again.");i.remove()}})}function filterreferences(n){var t=n.find("input:text").val().toLowerCase(),r,i;t.length<2&&(t="");r=n.find("input:checkbox:checked").map(function(){return $(this).val()}).get();i=$(".reference-list li");i.css("display","none");i.filter(function(){var n=$(this),i=n.find(".info").data("source-type"),u=$.inArray(i,r)>-1,f=n.text().toLowerCase().indexOf(t)>-1;return u&&f}).css("display","block").unhighlight({element:"mark"}).highlight(t,{element:"mark"})}function applySortSearchAndFilterSettings(){var n=$(".js-sort-search-and-filter");sortReferences(n);filterreferences(n);updateHiddenReferencesCount()}function updateHiddenReferencesCount(){var n=$(".reference-list li:not(:visible)").length;n>0?($(".js-references-shown").text("("+n+" hidden)"),$(".js-search-icon").css("color","#00cc00")):($(".js-references-shown").text(""),$(".js-search-icon").css("color","inherit"))}function checkForVersionUpdate(n){var i=n.match(/<meta name="version" content="(.*?)"\/>/)[1],t=$("meta[name=version]").attr("content");t===undefined||i>t}function checkForAccountExpiration(n){n==="/premium/expired"&&location.reload()}function openWebLink(n){var t=window.open("about:blank","newtab"),i=$(this).closest("li").find("#resolveUrl").val();i&&n.include("https://www.bing.com/cr?IG")?$.ajax({url:"/cite/sources/BingAutociteUrl",type:"POST",data:{bingUrl:n},success:function(n){t.location=n},error:function(){alert("Sorry! We could not open this link. Please try again later")}}):t.location=n}function showBackBibliographyConfirmationMessage(){if(confirm("If you go back to your bibliography now your citation will be lost. Would you like to continue?")){var n=window.location.protocol+"//"+window.location.host+"/"+$("#lang").val();typeof Turbolinks=="undefined"?window.location.href=n:Turbolinks.visit(n,{action:"advance"})}}function toggleSortSearchFilter(n){$(".sort_search").slideToggle();setSortField(n)}!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ClipboardJS=t():n.ClipboardJS=t()}(this,function(){return function(n){function t(r){if(i[r])return i[r].exports;var u=i[r]={i:r,l:!1,exports:{}};return n[r].call(u.exports,u,u.exports,t),u.l=!0,u.exports}var i={};return t.m=n,t.c=i,t.i=function(n){return n},t.d=function(n,i,r){t.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:r})},t.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(i,"a",i),i},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=3)}([function(n,t,i){var r,u,f,e;e=function(n,t){"use strict";var i,r=(i=t)&&i.__esModule?i:{"default":i},u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},f=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),e=function(){function n(t){!function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}(this,n);this.resolveOptions(t);this.initSelection()}return f(n,[{key:"resolveOptions",value:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=n.action;this.container=n.container;this.emitter=n.emitter;this.target=n.target;this.text=n.text;this.trigger=n.trigger;this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,i="rtl"==document.documentElement.getAttribute("dir"),n;this.removeFake();this.fakeHandlerCallback=function(){return t.removeFake()};this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0;this.fakeElem=document.createElement("textarea");this.fakeElem.style.fontSize="12pt";this.fakeElem.style.border="0";this.fakeElem.style.padding="0";this.fakeElem.style.margin="0";this.fakeElem.style.position="absolute";this.fakeElem.style[i?"right":"left"]="-9999px";n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px";this.fakeElem.setAttribute("readonly","");this.fakeElem.value=this.text;this.container.appendChild(this.fakeElem);this.selectedText=r.default(this.fakeElem);this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null);this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=r.default(this.target);this.copyText()}},{key:"copyText",value:function(){var n=void 0;try{n=document.execCommand(this.action)}catch(t){n=!1}this.handleResult(n)}},{key:"handleResult",value:function(n){this.emitter.emit(n?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus();window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=n,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"');},get:function(){return this._action}},{key:"target",set:function(n){if(void 0!==n){if(!n||"object"!==(void 0===n?"undefined":u(n))||1!==n.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&n.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(n.hasAttribute("readonly")||n.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=n}},get:function(){return this._target}}]),n}();n.exports=e};u=[n,i(7)];void 0===(f="function"==typeof(r=e)?r.apply(t,u):r)||(n.exports=f)},function(n,t,i){var r=i(6),u=i(5);n.exports=function(n,t,i){if(!n&&!t&&!i)throw new Error("Missing required arguments");if(!r.string(t))throw new TypeError("Second argument must be a String");if(!r.fn(i))throw new TypeError("Third argument must be a Function");if(r.node(n))return s=t,h=i,(v=n).addEventListener(s,h),{destroy:function(){v.removeEventListener(s,h)}};if(r.nodeList(n))return f=n,e=t,o=i,Array.prototype.forEach.call(f,function(n){n.addEventListener(e,o)}),{destroy:function(){Array.prototype.forEach.call(f,function(n){n.removeEventListener(e,o)})}};if(r.string(n))return c=n,l=t,a=i,u(document.body,c,l,a);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var c,l,a,f,e,o,v,s,h}},function(n){function t(){}t.prototype={on:function(n,t,i){var r=this.e||(this.e={});return(r[n]||(r[n]=[])).push({fn:t,ctx:i}),this},once:function(n,t,i){function r(){u.off(n,r);t.apply(i,arguments)}var u=this;return r._=t,this.on(n,r,i)},emit:function(n){for(var r=[].slice.call(arguments,1),i=((this.e||(this.e={}))[n]||[]).slice(),t=0,u=i.length;t<u;t++)i[t].fn.apply(i[t].ctx,r);return this},off:function(n,t){var u=this.e||(this.e={}),r=u[n],f=[],i,e;if(r&&t)for(i=0,e=r.length;i<e;i++)r[i].fn!==t&&r[i].fn._!==t&&f.push(r[i]);return f.length?u[n]=f:delete u[n],this}};n.exports=t},function(n,t,i){var r,u,f,e;e=function(n,t,i,r){"use strict";function u(n){return n&&n.__esModule?n:{"default":n}}function f(n,t){var i="data-clipboard-"+n;if(t.hasAttribute(i))return t.getAttribute(i)}var e=u(t),o=u(i),s=u(r),h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},c=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),l=function(){function n(t,i){!function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}(this,n);var r=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?n:t}(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));return r.resolveOptions(i),r.listenClick(t),r}return function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)}(n,o.default),c(n,[{key:"resolveOptions",value:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof n.action?n.action:this.defaultAction;this.target="function"==typeof n.target?n.target:this.defaultTarget;this.text="function"==typeof n.text?n.text:this.defaultText;this.container="object"===h(n.container)?n.container:document.body}},{key:"listenClick",value:function(n){var t=this;this.listener=s.default(n,"click",function(n){return t.onClick(n)})}},{key:"onClick",value:function(n){var t=n.delegateTarget||n.currentTarget;this.clipboardAction&&(this.clipboardAction=null);this.clipboardAction=new e.default({action:this.action(t),target:this.target(t),text:this.text(t),container:this.container,trigger:t,emitter:this})}},{key:"defaultAction",value:function(n){return f("action",n)}},{key:"defaultTarget",value:function(n){var t=f("target",n);if(t)return document.querySelector("#"+t)}},{key:"defaultText",value:function(n){return f("text",n)}},{key:"destroy",value:function(){this.listener.destroy();this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],i="string"==typeof n?[n]:n,t=!!document.queryCommandSupported;return i.forEach(function(n){t=t&&!!document.queryCommandSupported(n)}),t}}]),n}();n.exports=l};u=[n,i(0),i(2),i(1)];void 0===(f="function"==typeof(r=e)?r.apply(t,u):r)||(n.exports=f)},function(n){var i=9,t;"undefined"==typeof Element||Element.prototype.matches||(t=Element.prototype,t.matches=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector);n.exports=function(n,t){for(;n&&n.nodeType!==i;){if("function"==typeof n.matches&&n.matches(t))return n;n=n.parentNode}}},function(n,t,i){function r(n,t,i,r,f){var e=function(n,t,i,r){return function(i){i.delegateTarget=u(i.target,t);i.delegateTarget&&r.call(n,i)}}.apply(this,arguments);return n.addEventListener(i,e,f),{destroy:function(){n.removeEventListener(i,e,f)}}}var u=i(4);n.exports=function(n,t,i,u,f){return"function"==typeof n.addEventListener?r.apply(null,arguments):"function"==typeof i?r.bind(null,document).apply(null,arguments):("string"==typeof n&&(n=document.querySelectorAll(n)),Array.prototype.map.call(n,function(n){return r(n,t,i,u,f)}))}},function(n,t){t.node=function(n){return void 0!==n&&n instanceof HTMLElement&&1===n.nodeType};t.nodeList=function(n){var i=Object.prototype.toString.call(n);return void 0!==n&&("[object NodeList]"===i||"[object HTMLCollection]"===i)&&"length"in n&&(0===n.length||t.node(n[0]))};t.string=function(n){return"string"==typeof n||n instanceof String};t.fn=function(n){return"[object Function]"===Object.prototype.toString.call(n)}},function(n){n.exports=function(n){var t,r,i,u;return"SELECT"===n.nodeName?(n.focus(),t=n.value):"INPUT"===n.nodeName||"TEXTAREA"===n.nodeName?(r=n.hasAttribute("readonly"),r||n.setAttribute("readonly",""),n.select(),n.setSelectionRange(0,n.value.length),r||n.removeAttribute("readonly"),t=n.value):(n.hasAttribute("contenteditable")&&n.focus(),i=window.getSelection(),u=document.createRange(),u.selectNodeContents(n),i.removeAllRanges(),i.addRange(u),t=i.toString()),t}}])});!function(n){"use strict";function u(){n(r).parent().removeClass("open")}function i(){document.removeEventListener("turbolinks:load",i);n("html").oncustom("click.dropdown.data-api",u);n("body").oncustom("click.dropdown",".dropdown form",function(n){n.stopPropagation()}).oncustom("click.dropdown.data-api",r,t.prototype.toggle);document.addEventListener("turbolinks:load",i)}var r='[data-toggle="dropdown"]',t=function(t){var i=n(t).on("click.dropdown.data-api",this.toggle);n("html").on("click.dropdown.data-api",function(){i.parent().removeClass("open")})};t.prototype={constructor:t,toggle:function(){var r=n(this),i,t,f;if(!r.is(".disabled, :disabled"))return t=r.attr("data-target"),t||(t=r.attr("href"),t=t&&t.replace(/.*(?=#[^\s]*$)/,"")),i=n(t),i.length||(i=r.parent()),f=i.hasClass("open"),u(),f||i.toggleClass("open"),!1}};n.fn.dropdown=function(i){return this.each(function(){var r=n(this),u=r.data("dropdown");u||r.data("dropdown",u=new t(this));typeof i=="string"&&u[i].call(r)})};n.fn.dropdown.Constructor=t;n(function(){typeof Turbolinks=="undefined"?i():document.addEventListener("turbolinks:load",i)})}(window.jQuery),function(n,t){"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):n.Spinner=t()}(this,function(){"use strict";function r(n,t){var i,r=document.createElement(n||"div");for(i in t)r[i]=t[i];return r}function t(n){for(var t=1,i=arguments.length;i>t;t++)n.appendChild(arguments[t]);return n}function a(n,t,i,r){var f=["opacity",t,~~(100*n),i,r].join("-"),e=.01+100*(i/r),s=Math.max(1-(1-n)/t*(100-e),n),h=u.substring(0,u.indexOf("Animation")).toLowerCase(),c=h&&"-"+h+"-"||"";return l[f]||(o.insertRule("@"+c+"keyframes "+f+"{0%{opacity:"+s+"}"+e+"%{opacity:"+n+"}"+(e+.01)+"%{opacity:1}"+(e+t)%100+"%{opacity:"+n+"}100%{opacity:"+s+"}}",o.cssRules.length),l[f]=1),f}function e(n,t){var r,i,u=n.style;if(void 0!==u[t])return t;for(t=t.charAt(0).toUpperCase()+t.slice(1),i=0;c.length>i;i++)if(r=c[i]+t,void 0!==u[r])return r}function n(n,t){for(var i in t)n.style[e(n,i)||i]=t[i];return n}function s(n){for(var r,i,t=1;arguments.length>t;t++){r=arguments[t];for(i in r)void 0===n[i]&&(n[i]=r[i])}return n}function h(n){for(var t={x:n.offsetLeft,y:n.offsetTop};n=n.offsetParent;)t.x+=n.offsetLeft,t.y+=n.offsetTop;return t}function i(n){return this===void 0?new i(n):(this.opts=s(n||{},i.defaults,y),void 0)}function v(){function u(n,t){return r("<"+n+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',t)}o.addRule(".spin-vml","behavior:url(#default#VML)");i.prototype.lines=function(i,r){function s(){return n(u("group",{coordsize:o+" "+o,coordorigin:-e+" "+-e}),{width:o,height:o})}function h(i,f,o){t(l,t(n(s(),{rotation:360/r.lines*i+"deg",left:~~f}),t(n(u("roundrect",{arcsize:r.corners}),{width:e,height:r.width,left:r.radius,top:-r.width>>1,filter:o}),u("fill",{color:r.color,opacity:r.opacity}),u("stroke",{opacity:0}))))}var f,e=r.length+r.width,o=2*e,c=2*-(r.width+r.length)+"px",l=n(s(),{position:"absolute",top:c,left:c});if(r.shadow)for(f=1;r.lines>=f;f++)h(f,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(f=1;r.lines>=f;f++)h(f);return t(i,l)};i.prototype.opacity=function(n,t,i,r){var u=n.firstChild;r=r.shadow&&r.lines||0;u&&u.childNodes.length>t+r&&(u=u.childNodes[t+r],u=u&&u.firstChild,u=u&&u.firstChild,u&&(u.opacity=i))}}var u,c=["webkit","Moz","ms","O"],l={},o=function(){var n=r("style",{type:"text/css"});return t(document.getElementsByTagName("head")[0],n),n.sheet||n.styleSheet}(),y={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"},f;return i.defaults={},s(i.prototype,{spin:function(t){this.stop();var o,s,f=this,i=f.opts,e=f.el=n(r(0,{className:i.className}),{position:i.position,width:0,zIndex:i.zIndex}),l=i.radius+i.length+i.width;if(t&&(t.insertBefore(e,t.firstChild||null),s=h(t),o=h(e),n(e,{left:("auto"==i.left?s.x-o.x+(t.offsetWidth>>1):parseInt(i.left,10)+l)+"px",top:("auto"==i.top?s.y-o.y+(t.offsetHeight>>1):parseInt(i.top,10)+l)+"px"})),e.setAttribute("role","progressbar"),f.lines(e,f.opts),!u){var a,v=0,p=(i.lines-1)*(1-i.direction)/2,y=i.fps,c=y/i.speed,w=(1-i.opacity)/(c*i.trail/100),b=c/i.lines;(function k(){v++;for(var n=0;i.lines>n;n++)a=Math.max(1-(v+(i.lines-n)*b)%c*w,i.opacity),f.opacity(e,n*i.direction+p,a,i);f.timeout=f.el&&setTimeout(k,~~(1e3/y))})()}return f},stop:function(){var n=this.el;return n&&(clearTimeout(this.timeout),n.parentNode&&n.parentNode.removeChild(n),this.el=void 0),this},lines:function(i,f){function s(t,i){return n(r(),{position:"absolute",width:f.length+f.width+"px",height:f.width+"px",background:t,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*e+f.rotate)+"deg) translate("+f.radius+"px,0)",borderRadius:(f.corners*f.width>>1)+"px"})}for(var o,e=0,h=(f.lines-1)*(1-f.direction)/2;f.lines>e;e++)o=n(r(),{position:"absolute",top:1+~(f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:u&&a(f.opacity,f.trail,h+e*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&t(o,n(s("#000","0 0 4px #000"),{top:"2px"})),t(i,t(o,s(f.color,"0 0 1px rgba(0,0,0,.1)")));return i},opacity:function(n,t,i){n.childNodes.length>t&&(n.childNodes[t].style.opacity=i)}}),f=n(r("group"),{behavior:"url(#default#VML)"}),!e(f,"transform")&&f.adj?v():u=e(f,"animation"),i}),function(n,t){"object"==typeof exports?module.exports=t(require("spin.js")):"function"==typeof define&&define.amd?define(["spin"],t):n.Ladda=t(n.Spinner)}(this,function(n){"use strict";function i(n){var i,u,r,f;return n===void 0?(console.warn("Ladda button target must be defined."),void 0):(n.querySelector(".ladda-label")||(n.innerHTML='<span class="ladda-label">'+n.innerHTML+"<\/span>"),u=document.createElement("span"),u.className="ladda-spinner",n.appendChild(u),f={start:function(){return i||(i=o(n)),n.setAttribute("disabled",""),n.setAttribute("data-loading",""),clearTimeout(r),i.spin(u),this.setProgress(0),this},startAfter:function(n){return clearTimeout(r),r=setTimeout(function(){f.start()},n),this},stop:function(){return n.removeAttribute("disabled"),n.removeAttribute("data-loading"),clearTimeout(r),i&&(r=setTimeout(function(){i.stop()},1e3)),this},toggle:function(){return this.isLoading()?this.stop():this.start(),this},setProgress:function(t){t=Math.max(Math.min(t,1),0);var i=n.querySelector(".ladda-progress");0===t&&i&&i.parentNode?i.parentNode.removeChild(i):(i||(i=document.createElement("div"),i.className="ladda-progress",n.appendChild(i)),i.style.width=(t||0)*n.offsetWidth+"px")},enable:function(){return this.stop(),this},disable:function(){return this.stop(),n.setAttribute("disabled",""),this},isLoading:function(){return n.hasAttribute("data-loading")}},t.push(f),f)}function r(n,t){for(;n.parentNode&&n.tagName!==t;)n=n.parentNode;if(t===n.tagName)return n}function u(n){for(var i,t,u=["input","textarea"],f=[],r=0;u.length>r;r++)for(i=n.getElementsByTagName(u[r]),t=0;i.length>t;t++)i[t].hasAttribute("required")&&f.push(i[t]);return f}function f(n,t){var f,e,o;for(t=t||{},f=[],"string"==typeof n?f=s(document.querySelectorAll(n)):"object"==typeof n&&"string"==typeof n.nodeName&&(f=[n]),e=0,o=f.length;o>e;e++)(function(){var n=f[e],o,s;"function"==typeof n.addEventListener&&(o=i(n),s=-1,n.addEventListener("click",function(){var e=!0,h=r(n,"FORM"),f,i;if(h!==void 0)for(f=u(h),i=0;f.length>i;i++)""===f[i].value.replace(/^\s+|\s+$/g,"")&&(e=!1);e&&(o.startAfter(1),"number"==typeof t.timeout&&(clearTimeout(s),s=setTimeout(o.stop,t.timeout)),"function"==typeof t.callback&&t.callback.apply(null,[o]))},!1))})()}function e(){for(var n=0,i=t.length;i>n;n++)t[n].stop()}function o(t){var u,i=t.offsetHeight;0===i&&(i=parseFloat(window.getComputedStyle(t).height));i>32&&(i*=.8);t.hasAttribute("data-spinner-size")&&(i=parseInt(t.getAttribute("data-spinner-size"),10));t.hasAttribute("data-spinner-color")&&(u=t.getAttribute("data-spinner-color"));var r=.2*i,f=.6*r,e=7>r?2:3;return new n({color:u||"#fff",lines:12,radius:r,length:f,width:e,zIndex:"auto",top:"auto",left:"auto",className:""})}function s(n){for(var i=[],t=0;n.length>t;t++)i.push(n[t]);return i}var t=[];return{bind:f,create:i,stopAll:e}}),function(n){function i(n){return typeof n=="object"?n:{top:n,left:n}}var t=n.scrollTo=function(t,i,r){n(window).scrollTo(t,i,r)};t.defaults={axis:"xy",duration:parseFloat(n.fn.jquery)>=1.3?0:1,limit:!0};t.window=function(){return n(window)._scrollable()};n.fn._scrollable=function(){return this.map(function(){var t=this,r=!t.nodeName||n.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1,i;return r?(i=(t.contentWindow||t).document||t.ownerDocument||t,/webkit/i.test(navigator.userAgent)||i.compatMode=="BackCompat"?i.body:i.documentElement):t})};n.fn.scrollTo=function(r,u,f){return typeof u=="object"&&(f=u,u=0),typeof f=="function"&&(f={onAfter:f}),r=="max"&&(r=9e9),f=n.extend({},t.defaults,f),u=u||f.duration,f.queue=f.queue&&f.axis.length>1,f.queue&&(u/=2),f.offset=i(f.offset),f.over=i(f.over),this._scrollable().each(function(){function l(n){h.animate(o,u,f.easing,n&&function(){n.call(this,r,f)})}if(r!=null){var s=this,h=n(s),e=r,c,o={},a=h.is("html,body");switch(typeof e){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(e)){e=i(e);break}if(e=n(e,this),!e.length)return;case"object":(e.is||e.style)&&(c=(e=n(e)).offset())}n.each(f.axis.split(""),function(n,i){var y=i=="x"?"Left":"Top",u=y.toLowerCase(),r="scroll"+y,p=s[r],w=t.max(s,i),v;c?(o[r]=c[u]+(a?0:p-h.offset()[u]),f.margin&&(o[r]-=parseInt(e.css("margin"+y))||0,o[r]-=parseInt(e.css("border"+y+"Width"))||0),o[r]+=f.offset[u]||0,f.over[u]&&(o[r]+=e[i=="x"?"width":"height"]()*f.over[u])):(v=e[u],o[r]=v.slice&&v.slice(-1)=="%"?parseFloat(v)/100*w:v);f.limit&&/^\d+$/.test(o[r])&&(o[r]=o[r]<=0?0:Math.min(o[r],w));!n&&f.queue&&(p!=o[r]&&l(f.onAfterFirst),delete o[r])});l(f.onAfter)}}).end()};t.max=function(t,i){var r=i=="x"?"Width":"Height",u="scroll"+r;if(!n(t).is("html,body"))return t[u]-n(t)[r.toLowerCase()]();var f="client"+r,e=t.ownerDocument.documentElement,o=t.ownerDocument.body;return Math.max(e[u],o[u])-Math.min(e[f],o[f])}}(jQuery),function(n,t,i){function e(n){return n}function o(n){return decodeURIComponent(n.replace(f," "))}function u(n){return n.indexOf('"')===0&&(n=n.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")),r.json?JSON.parse(n):n}var f=/\+/g,r=n.cookie=function(f,s,h){var v,l,c,w;if(s!==i)return h=n.extend({},r.defaults,h),s===null&&(h.expires=-1),typeof h.expires=="number"&&(v=h.expires,l=h.expires=new Date,l.setDate(l.getDate()+v)),s=r.json?JSON.stringify(s):String(s),t.cookie=[encodeURIComponent(f),"=",r.raw?s:encodeURIComponent(s),h.expires?"; expires="+h.expires.toUTCString():"",h.path?"; path="+h.path:"",h.domain?"; domain="+h.domain:"",h.secure?"; secure":""].join("");var y=r.raw?e:o,p=t.cookie.split("; "),a=f?null:{};for(c=0,w=p.length;c<w;c++){var b=p[c].split("="),k=y(b.shift()),d=y(b.join("="));if(f&&f===k){a=u(d);break}f||(a[k]=u(d))}return a};r.defaults={};n.removeCookie=function(t,i){return n.cookie(t)!==null?(n.cookie(t,null,i),!0):!1}}(jQuery,document),function(n){n.fn.drags=function(t){t=n.extend({handle:"",cursor:"move",draggableClass:"draggable",activeHandleClass:"active-handle"},t);var r=this,i=null,u=t.handle===""?this:this.find(t.handle);u.css("cursor",t.cursor).on("mousedown",function(u){t.handle===""?(i=n(this),i.addClass(t.draggableClass)):(i=n(r),i.addClass(t.draggableClass).find(t.handle).addClass(t.activeHandleClass));var f=i.outerHeight(),e=i.outerWidth(),o=i.offset().top+f-u.pageY,s=i.offset().left+e-u.pageX;n(document).on("mousemove",function(n){i.offset({top:Math.round(n.pageY+o-f),left:Math.round(n.pageX+s-e)})}).on("mouseup",function(){n(this).off("mousemove");i!==null&&(i.removeClass(t.draggableClass),i=null)});u.preventDefault()}).on("mouseup",function(){t.handle===""?i.removeClass(t.draggableClass):i.removeClass(t.draggableClass).find(t.handle).removeClass(t.activeHandleClass);sessionStorage.setItem("modalPosition",JSON.stringify(i.offset()));i=null});return this}}(jQuery),function(n){n.fn.liveDraggable=function(t){this.on("mouseover",function(){n(this).drags(t)});return this}}(jQuery);jQuery.extend({highlight:function(n,t,i,r){var e,o,u,s,f;if(n.nodeType===3){if(e=n.data.match(t),e)return o=document.createElement(i||"span"),o.className=r||"highlight",u=n.splitText(e.index),u.splitText(e[0].length),s=u.cloneNode(!0),o.appendChild(s),u.parentNode.replaceChild(o,u),1}else if(n.nodeType===1&&n.childNodes&&!/(script|style)/i.test(n.tagName)&&!(n.tagName===i.toUpperCase()&&n.className===r))for(f=0;f<n.childNodes.length;f++)f+=jQuery.highlight(n.childNodes[f],t,i,r);return 0}});jQuery.fn.unhighlight=function(n){var t={className:"highlight",element:"span"};return jQuery.extend(t,n),this.find(t.element+"."+t.className).each(function(){var n=this.parentNode;n.replaceChild(this.firstChild,this);n.normalize()}).end()};jQuery.fn.highlight=function(n,t){var i={className:"highlight",element:"span",caseSensitive:!1,wordsOnly:!1},u,r,f;return(jQuery.extend(i,t),n.constructor===String&&(n=[n]),n=jQuery.grep(n,function(n){return n!=""}),n=jQuery.map(n,function(n){return n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}),n.length==0)?this:(u=i.caseSensitive?"":"i",r="("+n.join("|")+")",i.wordsOnly&&(r="\\b"+r+"\\b"),f=new RegExp(r,u),this.each(function(){jQuery.highlight(this,f,i.element,i.className)}))};jQuery.fn.selectText=function(){var r=document,i=this[0],n,t;r.body.createTextRange?(n=document.body.createTextRange(),n.moveToElementText(i),n.select()):window.getSelection&&(t=window.getSelection(),n=document.createRange(),n.selectNodeContents(i),t.removeAllRanges(),t.addRange(n))},function(n){function t(n,t){return typeof n=="function"?n.call(t):n}function r(n){while(n=n.parentNode)if(n==document)return!0;return!1}function i(t,i){this.$element=n(t);this.options=i;this.enabled=!0;this.fixTitle()}i.prototype={show:function(){var s=this.getTitle(),r;if(s&&this.enabled){r=this.tip();r.find(".tipsy-inner")[this.options.html?"html":"text"](s);r[0].className="tipsy";r.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var i=n.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),e=r[0].offsetWidth,o=r[0].offsetHeight,f=t(this.options.gravity,this.$element[0]),u;switch(f.charAt(0)){case"n":u={top:i.top+i.height+this.options.offset,left:i.left+i.width/2-e/2};break;case"s":u={top:i.top-o-this.options.offset,left:i.left+i.width/2-e/2};break;case"e":u={top:i.top+i.height/2-o/2,left:i.left-e-this.options.offset};break;case"w":u={top:i.top+i.height/2-o/2,left:i.left+i.width+this.options.offset}}f.length==2&&(u.left=f.charAt(1)=="w"?i.left+i.width/2-15:i.left+i.width/2-e+15);r.css(u).addClass("tipsy-"+f);r.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+f.charAt(0);this.options.className&&r.addClass(t(this.options.className,this.$element[0]));this.options.fade?r.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):r.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){n(this).remove()}):this.tip().remove()},fixTitle:function(){var n=this.$element;(n.attr("title")||typeof n.attr("original-title")!="string")&&n.attr("original-title",n.attr("title")||"").removeAttr("title")},getTitle:function(){var i=this.$element,n=this.options,t;return this.fixTitle(),n=this.options,typeof n.title=="string"?t=i.attr(n.title=="title"?"original-title":n.title):typeof n.title=="function"&&(t=n.title.call(i[0])),t=(""+t).replace(/(^\s*|\s*$)/,""),t||n.fallback},tip:function(){return this.$tip||(this.$tip=n('<div class="tipsy"><\/div>').html('<div class="tipsy-arrow"><\/div><div class="tipsy-inner"><\/div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}};n.fn.tipsy=function(t){function u(r){var u=n.data(r,"tipsy");return u||(u=new i(r,n.fn.tipsy.elementOptions(r,t)),n.data(r,"tipsy",u)),u}function e(){var n=u(this);n.hoverState="in";t.delayIn==0?n.show():(n.fixTitle(),setTimeout(function(){n.hoverState=="in"&&n.show()},t.delayIn))}function o(){var n=u(this);n.hoverState="out";t.delayOut==0?n.hide():setTimeout(function(){n.hoverState=="out"&&n.hide()},t.delayOut)}var r;if(t===!0)return this.data("tipsy");if(typeof t=="string")return r=this.data("tipsy"),r&&r[t](),this;if(t=n.extend({},n.fn.tipsy.defaults,t),t.live||this.each(function(){u(this)}),t.trigger!="manual"){var f=t.live?"on":"bind",s=t.trigger=="hover"?"mouseenter":"focus",h=t.trigger=="hover"?"mouseleave":"blur";this[f](s,e)[f](h,o)}return this};n.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"};n.fn.tipsy.revalidate=function(){n(".tipsy").each(function(){var t=n.data(this,"tipsy-pointee");t&&r(t)||n(this).remove()})};n.fn.tipsy.elementOptions=function(t,i){return n.metadata?n.extend({},i,n(t).metadata()):i};n.fn.tipsy.autoNS=function(){return n(this).offset().top>n(document).scrollTop()+n(window).height()/2?"s":"n"};n.fn.tipsy.autoWE=function(){return n(this).offset().left>n(document).scrollLeft()+n(window).width()/2?"e":"w"};n.fn.tipsy.autoBounds=function(t,i){return function(){var r={ns:i[0],ew:i.length>1?i[1]:!1},f=n(document).scrollTop()+t,e=n(document).scrollLeft()+t,u=n(this);return u.offset().top<f&&(r.ns="n"),u.offset().left<e&&(r.ew="w"),n(window).width()+n(document).scrollLeft()-u.offset().left<t&&(r.ew="e"),n(window).height()+n(document).scrollTop()-u.offset().top<t&&(r.ns="s"),r.ns+(r.ew?r.ew:"")}}}(jQuery);$(document).ready(function(){$(document).on("click",".js-close-modal-btn, .modal .close, .overlay",function(){var n="/",t=window.location.pathname.split("/")[1];if(/^(de|fr|es|it|ko|hi|pl|pt|zh)$/.test(t)&&(n+=t),window.location.pathname.indexOf("welcome")>-1){closeModals();return}window.location.href=n});$(document).on("click",".sidebar .close",function(){var i=$(this),n=i.parents(".sidebar"),t;n.removeClass("show");t=$(".page-wrapper");n.hasClass("sidebar-left")&&t.removeClass("sidebar-left-active");n.hasClass("sidebar-right")&&t.removeClass("sidebar-right-active")});$(document).on("click",":not(.alert-container .alert)",function(){$(".alert-container .alert").fadeOut(400,function(){this.remove()})})});jQuery.fn.extend({oncustom:function(n,t,i){return $(this).off(n,t).on(n,t,i)}});$(function(){typeof Turbolinks=="undefined"?appinit():document.addEventListener("turbolinks:load",appinit)});var referenceStyleSearchTimer;$(document).on("submit",".js-set-customer-cards",function(n){n.preventDefault();var t=$(this);confirm("Are you sure you want to change your default card?")&&$.ajax({type:"POST",url:t.attr("action"),success:function(n){n.Response==="error"?alert(n.ErrorMessage):location.reload()}})});$(document).on("submit",".js-delete-customer-cards",function(n){n.preventDefault();var t=$(this);confirm("Are you sure you want to delete this card?")&&$.ajax({type:"POST",url:t.attr("action"),success:function(n){n.Response==="error"?alert(n.ErrorMessage):location.reload()}})});$(document).on("submit",".delete-form",function(n){confirm("Are you sure you want to delete your account? All work will be lost.")||n.preventDefault()});$(document).on("click",".pause-subscription-btn",function(){$(".premium-modal-wrapper .premium-overlay, .premium-modal-wrapper .modal").addClass("show")});$(document).on("click",".premium-overlay",function(){$(".premium-modal-wrapper .premium-overlay, .premium-modal-wrapper .modal").removeClass("show");$(".cancel-modal-wrapper .premium-overlay, .cancel-modal-wrapper .modal").removeClass("show")});$(document).on("click",".cancel-subscription-btn",function(){$(".cancel-modal-wrapper .premium-overlay, .cancel-modal-wrapper .modal").addClass("show")});$(document).on("click",".finished-studies-btn",function(){$(".cancel-modal-wrapper .premium-overlay, .cancel-modal-wrapper .modal").removeClass("show");$(".premium-modal-wrapper .premium-overlay, .premium-modal-wrapper .modal").addClass("show")})