-
Notifications
You must be signed in to change notification settings - Fork 0
/
shiny.min.js
5 lines (4 loc) · 86.9 KB
/
shiny.min.js
1
2
3
4
5
/*! shiny 1.0.5 | (c) 2012-2017 RStudio, Inc. | License: GPL-3 | file LICENSE */
"use strict";function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_slicedToArray=function(){function a(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(i){e=!0,f=i}finally{try{!d&&h["return"]&&h["return"]()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();!function(){function escapeHTML(a){var b={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return a.replace(/[&<>'"\/]/g,function(a){return b[a]})}function randomId(){return Math.floor(4294967296+64424509440*Math.random()).toString(16)}function strToBool(a){if(a&&a.toLowerCase)switch(a.toLowerCase()){case"true":return!0;case"false":return!1;default:return}}function getStyle(a,b){var c;if(a.currentStyle)c=a.currentStyle[b];else if(window.getComputedStyle){var d=document.defaultView.getComputedStyle(a,null);d&&(c=d.getPropertyValue(b))}return c}function padZeros(a,b){for(var c=a.toString();c.length<b;)c="0"+c;return c}function roundSignif(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(b<1)throw"Significant digits must be at least 1.";return parseFloat(a.toPrecision(b))}function parseDate(a){var b=new Date(a);return isNaN(b)&&(b=new Date(a.replace(/-/g,"/"))),b}function formatDateUTC(a){return a instanceof Date?a.getUTCFullYear()+"-"+padZeros(a.getUTCMonth()+1,2)+"-"+padZeros(a.getUTCDate(),2):null}function makeResizeFilter(a,b){var c={};return function(){var d={w:a.offsetWidth,h:a.offsetHeight};0===d.w&&0===d.h||d.w===c.w&&d.h===c.h||(c=d,b(d.w,d.h))}}function makeBlob(a){try{return new Blob(a)}catch(b){var c=new _BlobBuilder;return $.each(a,function(a,b){c.append(b)}),c.getBlob()}}function pixelRatio(){return window.devicePixelRatio?window.devicePixelRatio:1}function scopeExprToFunc(a){var b=a.replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\b]/g,"\\b");try{var c=new Function("with (this) {\n try {\n return ("+a+");\n } catch (e) {\n console.error('Error evaluating expression: "+b+"');\n throw e;\n }\n }")}catch(d){throw console.error("Error parsing expression: "+a),d}return function(a){return c.call(a)}}function asArray(a){return null===a||void 0===a?[]:$.isArray(a)?a:[a]}function mergeSort(a,b){function c(a,b,c){for(var d=0,e=0,f=[];d<b.length&&e<c.length;)a(b[d],c[e])<=0?f.push(b[d++]):f.push(c[e++]);for(;d<b.length;)f.push(b[d++]);for(;e<c.length;)f.push(c[e++]);return f}a=a.slice(0);for(var d=1;d<a.length;d*=2)for(var e=0;e<a.length;e+=2*d){var f=a.slice(e,e+d),g=a.slice(e+d,e+2*d),h=c(b,f,g),i=[e,h.length];Array.prototype.push.apply(i,h),Array.prototype.splice.apply(a,i)}return a}function mapValues(a,b){var c={};for(var d in a)a.hasOwnProperty(d)&&(c[d]=b(a[d]));return c}function _equal(a,b){if("object"===$.type(a)&&"object"===$.type(b)){if(Object.keys(a).length!==Object.keys(b).length)return!1;for(var c in a)if(!b.hasOwnProperty(c)||!_equal(a[c],b[c]))return!1;return!0}if("array"===$.type(a)&&"array"===$.type(b)){if(a.length!==b.length)return!1;for(var d=0;d<a.length;d++)if(!_equal(a[d],b[d]))return!1;return!0}return a===b}function equal(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];if(b.length<2)throw new Error("equal requires at least two arguments.");for(var d=0;d<b.length-1;d++)if(!_equal(b[d],b[d+1]))return!1;return!0}function multimethod(){function a(a){this.args=a}function b(b){return function(){for(var c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];g=!0;for(var f=b.apply(h,d);f instanceof a;)f=b.apply(h,f.args);return g=!1,f}}var c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(a){return a},d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:equal,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],g=!1,h=b(function(){for(var a=arguments.length,b=Array(a),g=0;g<a;g++)b[g]=arguments[g];for(var i=c.apply(null,b),j=0;j<f.length;j++){var k=_slicedToArray(f[j],2),l=k[0],m=k[1];if(d(i,l))return m.apply(h,b)}if(e)return e.apply(h,b);throw new Error("No method for dispatch value "+i)});return h.recur=function(){for(var b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];if(!g)throw new Error("recur can only be called inside a method");return new a(c)},h.dispatch=function(a){return c=a,h},h.test=function(a){return d=a,h},h.when=function(a,b){return f=f.concat([[a,b]]),h},h.whenAny=function(a,b){return a.reduce(function(a,c){return h.when(c,b)},h)},h["else"]=function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e=a,h},h.clone=function(){return multimethod(c,d,e,f.slice())},h}function debounce(a,b){var c,d,e=null;return function(){c=this,d=arguments,null!==e&&(clearTimeout(e),e=null),e=setTimeout(function(){null!==e&&(e=null,b.apply(c,d))},a)}}function throttle(a,b){function c(){d=null,e=null,null===g?(g=setTimeout(function(){g=null,f&&(f=!1,c.apply(d,e))},a),b.apply(this,arguments)):(f=!0,d=this,e=arguments)}var d,e,f=!1,g=null;return c}function addDefaultInputOpts(a){return $.extend({immediate:!1,binding:null,el:null},a)}function splitInputNameType(a){var b=a.split(":");return{name:b[0],inputType:b.length>1?b[1]:""}}function registerDependency(a,b){htmlDependencies[a]=b}function renderDependency(a){if(htmlDependencies.hasOwnProperty(a.name))return!1;registerDependency(a.name,a.version);var b=a.src.href,c=$("head").first();if(a.meta){var d=$.map(asArray(a.meta),function(a,b){var c=Object.keys(a)[0];return $("<meta>").attr("name",c).attr("content",a[c])});c.append(d)}if(a.stylesheet){var e=$.map(asArray(a.stylesheet),function(a){return $("<link rel='stylesheet' type='text/css'>").attr("href",b+"/"+encodeURI(a))});c.append(e)}if(a.script){var f=$.map(asArray(a.script),function(a){return $("<script>").attr("src",b+"/"+encodeURI(a))});c.append(f)}if(a.attachment){var g=a.attachment;if("string"==typeof g&&(g=[g]),$.isArray(g)){var h={};$.each(g,function(a,b){h[a+1+""]=b}),g=h}var i=$.map(g,function(c,d){return $("<link rel='attachment'>").attr("id",a.name+"-"+d+"-attachment").attr("href",b+"/"+encodeURI(c))});c.append(i)}if(a.head){var j=$("<head></head>");j.html(a.head),c.append(j.children())}return!0}function forceIonSliderUpdate(a){a.$cache&&a.$cache.input?a.$cache.input.trigger("change"):console.log("Couldn't force ion slider to update")}function setFileText(a,b){var c=a.closest("div.input-group").find("input[type=text]");1===b.length?c.val(b[0].name):c.val(b.length+" files")}function abortCurrentUpload(a){var b=a.data("currentUploader");b&&b.abort(),a.removeAttr("data-restore")}function uploadDroppedFilesIE10Plus(a,b){var c=$(a);abortCurrentUpload(c),setFileText(c,b),c.data("currentUploader",new FileUploader(exports.shinyapp,fileInputBinding.getId(a),b,a))}function uploadFiles(a){var b=$(a.target);abortCurrentUpload(b);var c=a.target.files,d="undefined"==typeof c,e=fileInputBinding.getId(a.target);if(d||0!==c.length){var f=b.closest("div.input-group").find("input[type=text]");d?f.val("[Uploaded file]"):setFileText(b,c),d?new IE8FileUploader(exports.shinyapp,e,a.target):b.data("currentUploader",new FileUploader(exports.shinyapp,e,c,a.target))}}function initShiny(){function a(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;a=$(a);for(var b=outputBindings.getBindings(),c=0;c<b.length;c++)for(var d=b[c].binding,e=d.find(a)||[],f=0;f<e.length;f++){var g=e[f],h=d.getId(g);if(h&&$.contains(document,g)){var i=$(g);if(!i.hasClass("shiny-bound-output")){var j=new OutputBindingAdapter(g,d);q.bindOutput(h,j),i.data("shiny-output-binding",j),i.addClass("shiny-bound-output"),i.trigger({type:"shiny:bound",binding:d,bindingType:"output"})}}}setTimeout(k,0),setTimeout(n,0)}function b(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,b=arguments.length>1&&void 0!==arguments[1]&&arguments[1],c=$(a).find(".shiny-bound-output");b&&$(a).hasClass("shiny-bound-output")&&c.push(a);for(var d=0;d<c.length;d++){var e=$(c[d]),f=e.data("shiny-output-binding");if(f){var g=f.binding.getId(c[d]);q.unbindOutput(g,f),e.removeClass("shiny-bound-output"),e.removeData("shiny-output-binding"),e.trigger({type:"shiny:unbound",binding:f.binding,bindingType:"output"})}}setTimeout(k,0),setTimeout(n,0)}function c(a,b,c){var d=a.getId(b);if(d){var e=a.getValue(b),f=a.getType(b);f&&(d=d+":"+f);var g={immediate:!c,binding:a,el:b};p.setInput(d,e,g)}}function d(){for(var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,b=inputBindings.getBindings(),d={},e=0;e<b.length;e++)for(var f=b[e].binding,g=f.find(a)||[],h=0;h<g.length;h++){var i=g[h],j=f.getId(i);if(j&&!w[j]){var k=f.getType(i),l=k?j+":"+k:j;d[l]={value:f.getValue(i),opts:{immediate:!0,binding:f,el:i}};var m=function(){var a=f,b=i;return function(d){c(a,b,d)}}();f.subscribe(i,m),$(i).data("shiny-input-binding",f),$(i).addClass("shiny-bound-input");var n=f.getRatePolicy(i);null!==n&&u.setRatePolicy(l,n.policy,n.delay),w[j]={binding:f,node:i},$(i).trigger({type:"shiny:bound",binding:f,bindingType:"input"})}}return d}function e(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,b=arguments.length>1&&void 0!==arguments[1]&&arguments[1],c=$(a).find(".shiny-bound-input");b&&$(a).hasClass("shiny-bound-input")&&c.push(a);for(var d=0;d<c.length;d++){var e=c[d],f=$(e).data("shiny-input-binding");if(f){var g=f.getId(e);$(e).removeClass("shiny-bound-input"),delete w[g],f.unsubscribe(e),$(e).trigger({type:"shiny:unbound",binding:f,bindingType:"input"})}}}function f(b){return a(b),d(b)}function g(a){var c=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e(a,c),b(a,c)}function h(){for(var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,b=inputBindings.getBindings(),c=0;c<b.length;c++)for(var d=b[c].binding,e=d.find(a)||[],f=0;f<e.length;f++)e[f]._shiny_initialized||(e[f]._shiny_initialized=!0,d.initialize(e[f]))}function i(a){var b=$(a),c=b.data("shiny-output-binding");return c?c.getId():null}function j(){$(".shiny-image-output, .shiny-plot-output").each(function(){var a=i(this);0===this.offsetWidth&&0===this.offsetHeight||(p.setInput(".clientdata_output_"+a+"_width",this.offsetWidth),p.setInput(".clientdata_output_"+a+"_height",this.offsetHeight))}),$(".shiny-bound-output").each(function(){var a=$(this),b=a.data("shiny-output-binding");a.trigger({type:"shiny:visualchange",visible:!l(this),binding:b}),b.onResize()})}function k(){y.normalCall()}function l(a){return null!==a&&0===a.offsetWidth&&0===a.offsetHeight&&("none"===getStyle(a,"display")||l(a.parentNode))}function m(){var a={};$(".shiny-bound-output").each(function(){var b=i(this);delete z[b];var c=l(this),d={type:"shiny:visualchange",visible:!c};c?p.setInput(".clientdata_output_"+b+"_hidden",!0):(a[b]=!0,p.setInput(".clientdata_output_"+b+"_hidden",!1));var e=$(this);d.binding=e.data("shiny-output-binding"),e.trigger(d)});for(var b in z)z.hasOwnProperty(b)&&p.setInput(".clientdata_output_"+b+"_hidden",!0);z=a}function n(){A.normalCall()}function o(a,b){return a=a.split("."),function(c){for(var d=c.namespace.split("."),e=0;e<a.length;e++)if(d.indexOf(a[e])===-1)return;b.apply(this,arguments)}}var p,q=exports.shinyapp=new ShinyApp,r=new InputBatchSender(q),s=new InputNoResendDecorator(r),t=new InputEventDecorator(s),u=new InputRateDecorator(t),v=new InputDeferDecorator(t);$('input[type="submit"], button[type="submit"]').length>0?(p=v,$('input[type="submit"], button[type="submit"]').each(function(){$(this).click(function(a){a.preventDefault(),v.submit()})})):p=u,p=new InputValidateDecorator(p),exports.onInputChange=function(a,b,c){c=addDefaultInputOpts(c),p.setInput(a,b,c)};var w={};exports.bindAll=function(a){var b=f(a);$.each(b,function(a,b){p.setInput(a,b.value,b.opts)}),initDeferredIframes()},exports.unbindAll=g,exports.initializeInputs=h,h(document);var x=mapValues(f(document),function(a){return a.value});$(".shiny-image-output, .shiny-plot-output").each(function(){var a=i(this);0===this.offsetWidth&&0===this.offsetHeight||(x[".clientdata_output_"+a+"_width"]=this.offsetWidth,x[".clientdata_output_"+a+"_height"]=this.offsetHeight)});var y=new Debouncer(null,j,0);r.lastChanceCallback.push(function(){y.isPending()&&y.immediateCall()});var z={};$(".shiny-bound-output").each(function(){var a=i(this);l(this)?x[".clientdata_output_"+a+"_hidden"]=!0:(z[a]=!0,x[".clientdata_output_"+a+"_hidden"]=!1)});var A=new Debouncer(null,m,0);r.lastChanceCallback.push(function(){A.isPending()&&A.immediateCall()}),$(window).resize(debounce(500,k));var B=["modal","dropdown","tab","tooltip","popover","collapse"];$.each(B,function(a,b){$("body").on("shown.bs."+b+".sendImageSize","*",o("bs",k)),$("body").on("shown.bs."+b+".sendOutputHiddenState hidden.bs."+b+".sendOutputHiddenState","*",o("bs",n))}),$("body").on("shown.sendImageSize","*",k),$("body").on("shown.sendOutputHiddenState hidden.sendOutputHiddenState","*",n),x[".clientdata_pixelratio"]=pixelRatio(),$(window).resize(function(){p.setInput(".clientdata_pixelratio",pixelRatio())}),x[".clientdata_url_protocol"]=window.location.protocol,x[".clientdata_url_hostname"]=window.location.hostname,x[".clientdata_url_port"]=window.location.port,x[".clientdata_url_pathname"]=window.location.pathname,x[".clientdata_url_search"]=window.location.search,$(window).on("pushstate",function(a){p.setInput(".clientdata_url_search",window.location.search)}),$(window).on("popstate",function(a){p.setInput(".clientdata_url_search",window.location.search)}),x[".clientdata_url_hash_initial"]=window.location.hash,x[".clientdata_url_hash"]=window.location.hash,$(window).on("hashchange",function(a){p.setInput(".clientdata_url_hash",location.hash)});var C=x[".clientdata_singletons"]=$('script[type="application/shiny-singletons"]').text();singletons.registerNames(C.split(/,/));var D=$('script[type="application/html-dependencies"]').text();$.each(D.split(/;/),function(a,b){var c=/\s*^(.+)\[(.+)\]\s*$/.exec(b);c&®isterDependency(c[1],c[2])}),x[".clientdata_allowDataUriScheme"]="undefined"!=typeof WebSocket,s.reset(x),q.connect(x),$(document).one("shiny:connected",function(){initDeferredIframes()})}function initDeferredIframes(){window.Shiny&&window.Shiny.shinyapp&&window.Shiny.shinyapp.isConnected()&&$(".shiny-frame-deferred").each(function(a,b){var c=$(b);c.removeClass("shiny-frame-deferred"),c.attr("src",c.attr("data-deferred-src")),c.attr("data-deferred-src",null)})}var $=jQuery,exports=window.Shiny=window.Shiny||{},origPushState=window.history.pushState;window.history.pushState=function(){var a=origPushState.apply(this,arguments);return $(document).trigger("pushstate"),a},$(document).on("submit","form:not([action])",function(a){a.preventDefault()});var _BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,$escape=exports.$escape=function(a){return a.replace(/([!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~])/g,"\\$1")},browser=function(){function a(){var a=-1;if(c){var b=navigator.userAgent,d=new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})");null!==d.exec(b)&&(a=parseFloat(RegExp.$1))}return a}var b=!1;/\bQt\//.test(window.navigator.userAgent)&&($(document.documentElement).addClass("qt"),b=!0),/\bQt\/5/.test(window.navigator.userAgent)&&/Linux/.test(window.navigator.userAgent)&&$(document.documentElement).addClass("qt5");var c="Microsoft Internet Explorer"===navigator.appName;return{isQt:b,isIE:c,IEVersion:a()}}(),Invoker=function(a,b){this.target=a,this.func=b};(function(){this.normalCall=this.immediateCall=function(){this.func.apply(this.target,arguments)}}).call(Invoker.prototype);var Debouncer=function(a,b,c){this.target=a,this.func=b,this.delayMs=c,this.timerId=null,this.args=null};(function(){this.normalCall=function(){var a=this;this.$clearTimer(),this.args=arguments,this.timerId=setTimeout(function(){null!==a.timerId&&(a.$clearTimer(),a.$invoke())},this.delayMs)},this.immediateCall=function(){this.$clearTimer(),this.args=arguments,this.$invoke()},this.isPending=function(){return null!==this.timerId},this.$clearTimer=function(){null!==this.timerId&&(clearTimeout(this.timerId),this.timerId=null)},this.$invoke=function(){this.func.apply(this.target,this.args),this.args=null}}).call(Debouncer.prototype);var Throttler=function(a,b,c){this.target=a,this.func=b,this.delayMs=c,this.timerId=null,this.args=null};(function(){this.normalCall=function(){var a=this;this.args=arguments,null===this.timerId&&(this.$invoke(),this.timerId=setTimeout(function(){null!==a.timerId&&(a.$clearTimer(),a.args&&a.normalCall.apply(a,a.args))},this.delayMs))},this.immediateCall=function(){this.$clearTimer(),this.args=arguments,this.$invoke()},this.isPending=function(){return null!==this.timerId},this.$clearTimer=function(){null!==this.timerId&&(clearTimeout(this.timerId),this.timerId=null)},this.$invoke=function(){this.func.apply(this.target,this.args),this.args=null}}).call(Throttler.prototype);var InputBatchSender=function(a){this.shinyapp=a,this.timerId=null,this.pendingData={},this.reentrant=!1,this.lastChanceCallback=[]};(function(){this.setInput=function(a,b){var c=this;this.pendingData[a]=b,this.timerId||this.reentrant||(this.timerId=setTimeout(function(){c.reentrant=!0;try{$.each(c.lastChanceCallback,function(a,b){b()}),c.timerId=null;var a=c.pendingData;c.pendingData={},c.shinyapp.sendInput(a)}finally{c.reentrant=!1}},0))}}).call(InputBatchSender.prototype);var InputNoResendDecorator=function(a,b){this.target=a,this.lastSentValues=this.reset(b)};(function(){this.setInput=function(a,b){var c=splitInputNameType(a),d=c.name,e=c.inputType,f=JSON.stringify(b);this.lastSentValues[d]&&this.lastSentValues[d].jsonValue===f&&this.lastSentValues[d].inputType===e||(this.lastSentValues[d]={jsonValue:f,inputType:e},this.target.setInput(a,b))},this.reset=function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b={};for(var c in a)if(a.hasOwnProperty(c)){var d=splitInputNameType(c),e=d.name,f=d.inputType;b[e]={jsonValue:JSON.stringify(a[c]),inputType:f}}this.lastSentValues=b}}).call(InputNoResendDecorator.prototype);var InputEventDecorator=function(a){this.target=a};(function(){this.setInput=function(a,b,c){var d=jQuery.Event("shiny:inputchanged"),e=splitInputNameType(a);d.name=e.name,d.inputType=e.inputType,d.value=b,d.binding=c.binding,d.el=c.el,$(document).trigger(d),d.isDefaultPrevented()||(a=d.name,""!==d.inputType&&(a+=":"+d.inputType),this.target.setInput(a,d.value))}}).call(InputEventDecorator.prototype);var InputRateDecorator=function(a){this.target=a,this.inputRatePolicies={}};(function(){this.setInput=function(a,b,c){this.$ensureInit(a),c.immediate?this.inputRatePolicies[a].immediateCall(a,b,c):this.inputRatePolicies[a].normalCall(a,b,c)},this.setRatePolicy=function(a,b,c){"direct"===b?this.inputRatePolicies[a]=new Invoker(this,this.$doSetInput):"debounce"===b?this.inputRatePolicies[a]=new Debouncer(this,this.$doSetInput,c):"throttle"===b&&(this.inputRatePolicies[a]=new Throttler(this,this.$doSetInput,c))},this.$ensureInit=function(a){a in this.inputRatePolicies||this.setRatePolicy(a,"direct")},this.$doSetInput=function(a,b,c){this.target.setInput(a,b,c)}}).call(InputRateDecorator.prototype);var InputDeferDecorator=function(a){this.target=a,this.pendingInput={}};(function(){this.setInput=function(a,b,c){/^\./.test(a)?this.target.setInput(a,b,c):this.pendingInput[a]={value:b,opts:c}},this.submit=function(){for(var a in this.pendingInput)if(this.pendingInput.hasOwnProperty(a)){var b=this.pendingInput[a];this.target.setInput(a,b.value,b.opts)}}}).call(InputDeferDecorator.prototype);var InputValidateDecorator=function(a){this.target=a};(function(){this.setInput=function(a,b,c){if(!a)throw"Can't set input with empty name.";c=addDefaultInputOpts(c),this.target.setInput(a,b,c)}}).call(InputValidateDecorator.prototype);var ShinyApp=function(){this.$socket=null,this.$inputValues={},this.$initialInput={},this.$bindings={},this.$values={},this.$errors={},this.$conditionals={},this.$pendingMessages=[],this.$activeRequests={},this.$nextRequestId=0,this.$allowReconnect=!1};(function(){function narrowScopeComponent(a,b){return Object.keys(a).filter(function(a){return 0===a.indexOf(b)}).map(function(c){return _defineProperty({},c.substring(b.length),a[c])}).reduce(function(a,b){return $.extend(a,b)},{})}function narrowScope(a,b){return b?{input:narrowScopeComponent(a.input,b),output:narrowScopeComponent(a.output,b)}:a}function addMessageHandler(a,b){if(messageHandlers[a])throw'handler for message of type "'+a+'" already added.';if("function"!=typeof b)throw"handler must be a function.";if(1!==b.length)throw"handler must be a function that takes one argument.";messageHandlerOrder.push(a),messageHandlers[a]=b}function addCustomMessageHandler(a,b){if(customMessageHandlers[a]){var c=customMessageHandlerOrder.indexOf(a);c!==-1&&(customMessageHandlerOrder.splice(c,1),delete customMessageHandlers[a])}if("function"!=typeof b)throw"handler must be a function.";if(1!==b.length)throw"handler must be a function that takes one argument.";customMessageHandlerOrder.push(a),customMessageHandlers[a]=b}function getTabset(a){var b=$("#"+$escape(a));if(0===b.length)throw"There is no tabsetPanel (or navbarPage or navlistPanel) with id equal to '"+a+"'";return b}function getTabContent(a){var b=a.attr("data-tabsetid"),c=$("div.tab-content[data-tabsetid='"+$escape(b)+"']");return c}function getTargetTabs(a,b,c){var d="[data-value='"+$escape(c)+"']",e=a.find("a"+d),f=e.parent();if(0===f.length)throw"There is no tabPanel (or navbarMenu) with value (or menuName) equal to '"+c+"'";var g=[],h=[];if("dropdown"===e.attr("data-toggle")){var i=e.find("+ ul.dropdown-menu"),j=i.attr("data-tabsetid"),k=i.find("a[data-toggle='tab']").parent("li");k.each(function(a,b){g.push($(b))});var l="div.tab-pane[id^='tab-"+$escape(j)+"']",m=b.find(l);m.each(function(a,b){h.push($(b))})}else h.push(b.find("div"+d));return{$liTag:f,$liTags:g,$divTags:h}}function ensureTabsetHasVisibleTab(a){if(0===a.find("li.active").not(".dropdown").length){var b=getFirstTab(a),c=a.data("shiny-input-binding"),d=jQuery.Event("shiny:updateinput");d.binding=c,a.trigger(d),c.setValue(a[0],b)}}function getFirstTab(a){return a.find("li:visible a[data-toggle='tab']").first().attr("data-value")||null}function tabApplyFunction(a,b){var c=arguments.length>2&&void 0!==arguments[2]&&arguments[2];$.each(a,function(a,d){"$liTag"===a?b(d):"$divTags"===a?$.each(d,function(a,c){b(c)}):c&&"$liTags"===a&&$.each(d,function(a,c){b(c)})})}this.connect=function(a){if(this.$socket)throw"Connect was already called on this application object";this.$socket=this.createSocket(),this.$initialInput=a,$.extend(this.$inputValues,a),this.$updateConditionals()},this.isConnected=function(){return!!this.$socket};var scheduledReconnect=null;this.reconnect=function(){if(clearTimeout(scheduledReconnect),this.isConnected())throw"Attempted to reconnect, but already connected.";this.$socket=this.createSocket(),this.$initialInput=$.extend({},this.$inputValues),this.$updateConditionals()},this.createSocket=function(){var a=this,b=exports.createSocket||function(){var a="ws:";"https:"===window.location.protocol&&(a="wss:");var b=window.location.pathname;/^([$#!&-;=?-[\]_a-z~]|%[0-9a-fA-F]{2})+$/.test(b)||(b=encodeURI(b),browser.isQt&&(b=encodeURI(b))),/\/$/.test(b)||(b+="/"),b+="websocket/";var c=new WebSocket(a+"//"+window.location.host+b);return c.binaryType="arraybuffer",c},c=b(),d=!1;return c.onopen=function(){for(d=!0,$(document).trigger({type:"shiny:connected",socket:c}),a.onConnected(),c.send(JSON.stringify({method:"init",data:a.$initialInput}));a.$pendingMessages.length;){var b=a.$pendingMessages.shift();c.send(b)}},c.onmessage=function(b){a.dispatchMessage(b.data)},c.onclose=function(){d&&($(document).trigger({type:"shiny:disconnected",socket:c}),a.$notifyDisconnected()),a.onDisconnected(),a.$removeSocket()},c},this.sendInput=function(a){var b=JSON.stringify({method:"update",data:a});this.$sendMsg(b),$.extend(this.$inputValues,a),this.$updateConditionals()},this.$notifyDisconnected=function(){var a=function(a){return"127.0.0.1"===a?"localhost":a},b=parent!==window?document.referrer:null;if(b){var c=document.createElement("a");if(c.href=b,a(c.hostname)===a(window.location.hostname)){var d=c.protocol.replace(":",""),e=d+"://"+c.hostname;c.port&&(e=e+":"+c.port),parent.postMessage("disconnected",e)}}},this.$removeSocket=function(){this.$socket=null},this.$scheduleReconnect=function(a){var b=this;scheduledReconnect=setTimeout(function(){b.reconnect()},a)};var reconnectDelay=function(){var a=0,b=[1500,1500,2500,2500,5500,5500,10500];return{next:function(){var c=a;return c>=b.length&&(c=b.length-1),a++,b[c]},reset:function(){a=0}}}();this.onDisconnected=function(){var a=$("#shiny-disconnected-overlay");if(0===a.length&&$(document.body).append('<div id="shiny-disconnected-overlay"></div>'),this.$allowReconnect===!0&&this.$socket.allowReconnect===!0||"force"===this.$allowReconnect){var b=reconnectDelay.next();exports.showReconnectDialog(b),this.$scheduleReconnect(b)}},this.onConnected=function(){$("#shiny-disconnected-overlay").remove(),exports.hideReconnectDialog(),reconnectDelay.reset()},this.makeRequest=function(a,b,c,d,e){for(var f=this.$nextRequestId;this.$activeRequests[f];)f=(f+1)%1e9;this.$nextRequestId=f+1,this.$activeRequests[f]={onSuccess:c,onError:d};var g=JSON.stringify({method:a,args:b,tag:f});if(e){var h=function(a){var b=new ArrayBuffer(4),c=new DataView(b);return c.setUint32(0,a,!0),b},i=[];i.push(h(16908802));var j=makeBlob([g]);i.push(h(j.size)),i.push(j);for(var k=0;k<e.length;k++)i.push(h(e[k].byteLength||e[k].size||0)),i.push(e[k]);g=makeBlob(i)}this.$sendMsg(g)},this.$sendMsg=function(a){this.$socket.readyState?this.$socket.send(a):this.$pendingMessages.push(a)},this.receiveError=function(a,b){if(this.$errors[a]!==b){this.$errors[a]=b,delete this.$values[a];var c=this.$bindings[a],d=jQuery.Event("shiny:error");d.name=a,d.error=b,d.binding=c,$(c?c.el:document).trigger(d),!d.isDefaultPrevented()&&c&&c.onValueError&&c.onValueError(d.error)}},this.receiveOutput=function(a,b){if(this.$values[a]!==b){this.$values[a]=b,delete this.$errors[a];var c=this.$bindings[a],d=jQuery.Event("shiny:value");return d.name=a,d.value=b,d.binding=c,$(c?c.el:document).trigger(d),!d.isDefaultPrevented()&&c&&c.onValueChange(d.value),b}},this.bindOutput=function(a,b){if(!a)throw"Can't bind an element with no ID";if(this.$bindings[a])throw"Duplicate binding for ID "+a;return this.$bindings[a]=b,void 0!==this.$values[a]?b.onValueChange(this.$values[a]):void 0!==this.$errors[a]&&b.onValueError(this.$errors[a]),b},this.unbindOutput=function(a,b){return this.$bindings[a]===b&&(delete this.$bindings[a],!0)},this.$updateConditionals=function(){$(document).trigger({type:"shiny:conditional"});var a={};for(var b in this.$inputValues)if(this.$inputValues.hasOwnProperty(b)){var c=b.replace(/:.*/,"");a[c]=this.$inputValues[b]}for(var d={input:a,output:this.$values},e=$(document).find("[data-display-if]"),f=0;f<e.length;f++){var g=$(e[f]),h=g.data("data-display-if-func");if(!h){var i=g.attr("data-display-if");h=scopeExprToFunc(i),g.data("data-display-if-func",h)}var j=g.attr("data-ns-prefix"),k=narrowScope(d,j),l=h(k),m="none"!==g.css("display");l!==m&&(l?(g.trigger("show"),g.show(),g.trigger("shown")):(g.trigger("hide"),g.hide(),g.trigger("hidden")))}};var messageHandlerOrder=[],messageHandlers={},customMessageHandlerOrder=[],customMessageHandlers={};exports.addCustomMessageHandler=addCustomMessageHandler,this.dispatchMessage=function(a){var b={};if("string"==typeof a)b=JSON.parse(a);else{for(var c=new DataView(a,0,1).getUint8(0),d=new DataView(a,1,c),e=[],f=0;f<c;f++)e.push(String.fromCharCode(d.getUint8(f)));var g=e.join("");a=a.slice(c+1),b.custom={},b.custom[g]=a}var h=jQuery.Event("shiny:message");h.message=b,$(document).trigger(h),h.isDefaultPrevented()||(this._sendMessagesToHandlers(h.message,messageHandlers,messageHandlerOrder),this.$updateConditionals())},this._sendMessagesToHandlers=function(a,b,c){for(var d=0;d<c.length;d++){var e=c[d];a.hasOwnProperty(e)&&b[e].call(this,a[e])}},addMessageHandler("values",function(a){for(var b in this.$bindings)this.$bindings.hasOwnProperty(b)&&this.$bindings[b].showProgress(!1);for(var c in a)a.hasOwnProperty(c)&&this.receiveOutput(c,a[c])}),addMessageHandler("errors",function(a){for(var b in a)a.hasOwnProperty(b)&&this.receiveError(b,a[b])}),addMessageHandler("inputMessages",function(a){for(var b=0;b<a.length;b++){var c=$(".shiny-bound-input#"+$escape(a[b].id)),d=c.data("shiny-input-binding");if(c.length>0){var e=c[0],f=jQuery.Event("shiny:updateinput");f.message=a[b].message,f.binding=d,$(e).trigger(f),f.isDefaultPrevented()||d.receiveMessage(e,f.message)}}}),addMessageHandler("javascript",function(message){eval(message)}),addMessageHandler("console",function(a){for(var b=0;b<a.length;b++)console.log&&console.log(a[b])}),addMessageHandler("progress",function(a){if(a.type&&a.message){var b=progressHandlers[a.type];b&&b.call(this,a.message)}}),addMessageHandler("notification",function(a){if("show"===a.type)exports.notifications.show(a.message);else{if("remove"!==a.type)throw"Unkown notification type: "+a.type;exports.notifications.remove(a.message)}}),addMessageHandler("modal",function(a){if("show"===a.type)exports.modal.show(a.message);else{if("remove"!==a.type)throw"Unkown modal type: "+a.type;exports.modal.remove()}}),addMessageHandler("response",function(a){var b=a.tag,c=this.$activeRequests[b];c&&(delete this.$activeRequests[b],"value"in a?c.onSuccess(a.value):c.onError(a.error))}),addMessageHandler("allowReconnect",function(a){if(a!==!0&&a!==!1&&"force"!==a)throw"Invalid value for allowReconnect: "+a;this.$allowReconnect=a}),addMessageHandler("custom",function(a){exports.oncustommessage&&exports.oncustommessage(a),this._sendMessagesToHandlers(a,customMessageHandlers,customMessageHandlerOrder)}),addMessageHandler("config",function(a){this.config={workerId:a.workerId,sessionId:a.sessionId},a.user&&(exports.user=a.user),$(document).trigger("shiny:sessioninitialized")}),addMessageHandler("busy",function(a){"busy"===a?($(document.documentElement).addClass("shiny-busy"),$(document).trigger("shiny:busy")):"idle"===a&&($(document.documentElement).removeClass("shiny-busy"),$(document).trigger("shiny:idle"))}),addMessageHandler("recalculating",function(a){if(a.hasOwnProperty("name")&&a.hasOwnProperty("status")){var b=this.$bindings[a.name];$(b?b.el:null).trigger({type:"shiny:"+a.status})}}),addMessageHandler("reload",function(a){window.location.reload()}),addMessageHandler("shiny-insert-ui",function(a){var b=$(a.selector);0===b.length?(console.warn('The selector you chose ("'+a.selector+'") could not be found in the DOM.'),exports.renderHtml(a.content.html,$([]),a.content.deps)):b.each(function(b,c){return exports.renderContent(c,a.content,a.where),a.multiple})}),addMessageHandler("shiny-remove-ui",function(a){var b=$(a.selector);b.each(function(b,c){return exports.unbindAll(c,!0),$(c).remove(),a.multiple})}),addMessageHandler("shiny-insert-tab",function(a){function b(a,b){var c=[0],d="#tab-"+b+"-";return a.find("> li").each(function(){var a=$(this).find("> a[data-toggle='tab']");if(a.length>0){var b=a.attr("href").replace(d,"");c.push(Number(b))}}),Math.max.apply(null,c)+1}function c(){if(null!==a.menuName){var b=$("a.dropdown-toggle[data-value='"+$escape(a.menuName)+"']");if(0===b.length)throw"There is no navbarMenu with menuName equal to '"+a.menuName+"'";var c=b.find("+ ul.dropdown-menu"),d=c.attr("data-tabsetid");
return{$tabset:c,id:d}}if(null!==a.target){var e=l.parent("ul");if(e.hasClass("dropdown-menu")){var f=e.attr("data-tabsetid");return{$tabset:e,id:f}}}return null}var d=getTabset(a.inputId),e=d,f=getTabContent(e),g=d.attr("data-tabsetid"),h=$(a.divTag.html),i=$(a.liTag.html),j=i.find("> a"),k=null,l=null;null!==a.target&&(k=getTargetTabs(e,f,a.target),l=k.$liTag);var m=c();if(null!==m){if("dropdown"===j.attr("data-toggle"))throw"Cannot insert a navbarMenu inside another one";e=m.$tabset,g=m.id}if("tab"===j.attr("data-toggle")){var n=b(e,g),o="tab-"+g+"-"+n;i.find("> a").attr("href","#"+o),h.attr("id",o)}"before"===a.position?l?l.before(i):e.append(i):"after"===a.position&&(l?l.after(i):e.prepend(i)),exports.renderContent(i[0],{html:i.html(),deps:a.liTag.deps}),exports.renderContent(f[0],{html:"",deps:a.divTag.deps},"beforeend"),h.get().forEach(function(a){f[0].appendChild(a),exports.renderContent(a,a.innerHTML||a.textContent)}),a.select&&i.find("a").tab("show")}),addMessageHandler("shiny-remove-tab",function(a){function b(a){exports.unbindAll(a,!0),a.remove()}var c=getTabset(a.inputId),d=getTabContent(c),e=getTargetTabs(c,d,a.target);tabApplyFunction(e,b),ensureTabsetHasVisibleTab(c)}),addMessageHandler("shiny-change-tab-visibility",function(a){function b(b){"show"===a.type?b.css("display",""):"hide"===a.type&&(b.hide(),b.removeClass("active"))}var c=getTabset(a.inputId),d=getTabContent(c),e=getTargetTabs(c,d,a.target);tabApplyFunction(e,b,!0),ensureTabsetHasVisibleTab(c)}),addMessageHandler("updateQueryString",function(a){if("replace"===a.mode)return void window.history.replaceState(null,null,a.queryString);var b=null;if("#"===a.queryString.charAt(0))b="hash";else{if("?"!==a.queryString.charAt(0))throw"The 'query' string must start with either '?' (to update the query string) or with '#' (to update the hash).";b="query"}var c=window.location.pathname,d=window.location.search,e=window.location.hash,f=c;f+="query"===b?a.queryString:d+a.queryString,window.history.pushState(null,null,f),a.queryString.indexOf("#")!==-1&&(b="hash"),window.location.hash!==e&&(b="hash"),"hash"===b&&$(document).trigger("hashchange")}),addMessageHandler("resetBrush",function(a){exports.resetBrush(a.brushId)});var progressHandlers={binding:function a(b){var c=b.id,a=this.$bindings[c];a&&($(a.el).trigger({type:"shiny:outputinvalidated",binding:a,name:c}),a.showProgress&&a.showProgress(!0))},open:function(a){if("notification"===a.style)exports.notifications.show({html:'<div id="shiny-progress-'+a.id+'" class="shiny-progress-notification"><div class="progress progress-striped active" style="display: none;"><div class="progress-bar"></div></div><div class="progress-text"><span class="progress-message">message</span> <span class="progress-detail"></span></div></div>',id:a.id,duration:null});else if("old"===a.style){var b=$(".shiny-progress-container");0===b.length&&(b=$('<div class="shiny-progress-container"></div>'),$("body").append(b));var c=$(".shiny-progress.open").length,d=$('<div class="shiny-progress open"><div class="progress progress-striped active"><div class="progress-bar bar"></div></div><div class="progress-text"><span class="progress-message">message</span><span class="progress-detail"></span></div></div>');d.attr("id",a.id),b.append(d);var e=d.find(".progress");e.css("top",c*e.height()+"px");var f=d.find(".progress-text");f.css("top",3*e.height()+c*f.outerHeight()+"px"),d.hide()}},update:function(a){if("notification"===a.style){var b=$("#shiny-progress-"+a.id);if(0===b.length)return;"undefined"!=typeof a.message&&b.find(".progress-message").text(a.message),"undefined"!=typeof a.detail&&b.find(".progress-detail").text(a.detail),"undefined"!=typeof a.value&&null!==a.value&&(b.find(".progress").show(),b.find(".progress-bar").width(100*a.value+"%"))}else if("old"===a.style){var b=$("#"+a.id+".shiny-progress");"undefined"!=typeof a.message&&b.find(".progress-message").text(a.message),"undefined"!=typeof a.detail&&b.find(".progress-detail").text(a.detail),"undefined"!=typeof a.value&&null!==a.value&&(b.find(".progress").show(),b.find(".bar").width(100*a.value+"%")),b.fadeIn()}},close:function(a){if("notification"===a.style)exports.notifications.remove(a.id);else if("old"===a.style){var b=$("#"+a.id+".shiny-progress");b.removeClass("open"),b.fadeOut({complete:function(){b.remove(),0===$(".shiny-progress").length&&$(".shiny-progress-container").remove()}})}}};exports.progressHandlers=progressHandlers,this.getTestSnapshotBaseUrl=function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=a.fullUrl,c=void 0===b||b,d=window.location,e="";return c&&(e=d.origin+d.pathname.replace(/\/[^\/]*$/,"")),e+="/session/"+encodeURIComponent(this.config.sessionId)+"/dataobj/shinytest?w="+encodeURIComponent(this.config.workerId)+"&nonce="+randomId()}}).call(ShinyApp.prototype),exports.showReconnectDialog=function(){function a(){var c=$("#shiny-reconnect-time");if(0!==c.length){var d=Math.floor((b-(new Date).getTime())/1e3);d>0?c.text(" in "+d+"s"):c.text("..."),setTimeout(a,1e3)}}var b=null;return function(c){if(b=(new Date).getTime()+c,!($("#shiny-reconnect-text").length>0)){var d='<span id="shiny-reconnect-text">Attempting to reconnect</span><span id="shiny-reconnect-time"></span>',e='<a id="shiny-reconnect-now" href="#" onclick="Shiny.shinyapp.reconnect();">Try now</a>';exports.notifications.show({id:"reconnect",html:d,action:e,duration:null,closeButton:!1,type:"warning"}),a()}}}(),exports.hideReconnectDialog=function(){exports.notifications.remove("reconnect")},exports.notifications=function(){function a(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=a.html,d=void 0===b?"":b,e=a.action,j=void 0===e?"":e,k=a.deps,l=void 0===k?[]:k,m=a.duration,n=void 0===m?5e3:m,o=a.id,p=void 0===o?null:o,q=a.closeButton,r=void 0===q||q,s=a.type,t=void 0===s?null:s;p||(p=randomId()),f();var u=c(p);0===u.length&&(u=g(p));var v='<div class="shiny-notification-content-text">'+d+"</div>"+('<div class="shiny-notification-content-action">'+j+"</div>"),w=u.find(".shiny-notification-content");exports.renderContent(w,{html:v,deps:l});var x=u.attr("class").split(/\s+/).filter(function(a){return a.match(/^shiny-notification-/)}).join(" ");u.removeClass(x),t&&"default"!==t&&u.addClass("shiny-notification-"+t);var y=u.find(".shiny-notification-close");return r&&0===y.length?u.append('<div class="shiny-notification-close">×</div>'):r||0===y.length||y.remove(),n?h(p,n):i(p),p}function b(a){c(a).fadeOut(j,function(){exports.unbindAll(this),$(this).remove(),0===d().length&&e().remove()})}function c(a){return a?e().find("#shiny-notification-"+$escape(a)):null}function d(){return e().find(".shiny-notification").map(function(){return this.id.replace(/shiny-notification-/,"")}).get()}function e(){return $("#shiny-notification-panel")}function f(){var a=e();return a.length>0?a:($("body").append('<div id="shiny-notification-panel">'),a)}function g(a){var d=c(a);return 0===d.length&&(d=$('<div id="shiny-notification-'+a+'" class="shiny-notification"><div class="shiny-notification-close">×</div><div class="shiny-notification-content"></div></div>'),d.find(".shiny-notification-close").on("click",function(c){c.preventDefault(),c.stopPropagation(),b(a)}),e().append(d)),d}function h(a,d){i(a);var e=setTimeout(function(){b(a)},d);c(a).data("removalCallback",e)}function i(a){var b=c(a),d=b.data("removalCallback");d&&clearTimeout(d)}var j=250;return{show:a,remove:b}}(),exports.modal={show:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=a.html,c=void 0===b?"":b,d=a.deps,e=void 0===d?[]:d;$(".modal-backdrop").remove();var f=$("#shiny-modal-wrapper");0===f.length&&(f=$('<div id="shiny-modal-wrapper"></div>'),$("body").append(f),f.on("hidden.bs.modal",function(a){a.target===$("#shiny-modal")[0]&&(exports.unbindAll(f),f.remove())})),f.on("keydown.shinymodal",function(a){$("#shiny-modal").data("keyboard")!==!1&&27===a.keyCode&&(a.stopPropagation(),a.preventDefault())}),exports.renderContent(f,{html:c,deps:e})},remove:function(){var a=$("#shiny-modal-wrapper");a.off("keydown.shinymodal"),a.find(".modal").length>0?a.find(".modal").modal("hide"):(exports.unbindAll(a),a.remove())}};var FileProcessor=function(a){this.files=a,this.fileIndex=-1,this.aborted=!1,this.completed=!1,this.$run()};(function(){this.onBegin=function(a,b){setTimeout(b,0)},this.onFile=function(a,b){setTimeout(b,0)},this.onComplete=function(){},this.onAbort=function(){},this.abort=function(){this.completed||this.aborted||(this.aborted=!0,this.onAbort())},this.$getRun=function(){var a=this,b=!1;return function(){b||(b=!0,a.$run())}},this.$run=function(){if(!this.aborted&&!this.completed){if(this.fileIndex<0)return this.fileIndex=0,void this.onBegin(this.files,this.$getRun());if(this.fileIndex===this.files.length)return this.completed=!0,void this.onComplete();var a=this.files[this.fileIndex++];this.onFile(a,this.$getRun())}}}).call(FileProcessor.prototype);var BindingRegistry=function(){this.bindings=[],this.bindingNames={}};(function(){this.register=function(a,b,c){var d={binding:a,priority:c||0};this.bindings.unshift(d),b&&(this.bindingNames[b]=d,a.name=b)},this.setPriority=function(a,b){var c=this.bindingNames[a];if(!c)throw"Tried to set priority on unknown binding "+a;c.priority=b||0},this.getPriority=function(a){var b=this.bindingNames[a];return!!b&&b.priority},this.getBindings=function(){return mergeSort(this.bindings,function(a,b){return b.priority-a.priority})}}).call(BindingRegistry.prototype);var inputBindings=exports.inputBindings=new BindingRegistry,outputBindings=exports.outputBindings=new BindingRegistry,OutputBinding=exports.OutputBinding=function(){};(function(){this.find=function(a){throw"Not implemented"},this.getId=function(a){return a["data-input-id"]||a.id},this.onValueChange=function(a,b){this.clearError(a),this.renderValue(a,b)},this.onValueError=function(a,b){this.renderError(a,b)},this.renderError=function(a,b){if(this.clearError(a),""===b.message)return void $(a).empty();var c="shiny-output-error";null!==b.type&&(c=c+" "+$.map(asArray(b.type),function(a){return c+"-"+a}).join(" ")),$(a).addClass(c).text(b.message)},this.clearError=function(a){$(a).attr("class",function(a,b){return b.replace(/(^|\s)shiny-output-error\S*/g,"")})},this.showProgress=function(a,b){var c="recalculating";b?$(a).addClass(c):$(a).removeClass(c)}}).call(OutputBinding.prototype);var textOutputBinding=new OutputBinding;$.extend(textOutputBinding,{find:function(a){return $(a).find(".shiny-text-output")},renderValue:function(a,b){$(a).text(b)}}),outputBindings.register(textOutputBinding,"shiny.textOutput");var imageOutputBinding=new OutputBinding;$.extend(imageOutputBinding,{find:function(a){return $(a).find(".shiny-image-output, .shiny-plot-output")},renderValue:function(a,b){function c(a,b){return void 0===a?b:a}var d,e=this.getId(a),f=$(a);f.off(".image_output");var g=f.find("img");if(0===g.length?(d=document.createElement("img"),f.append(d),g=$(d)):(d=g[0],g.trigger("reset")),!b)return void f.empty();var h={clickId:f.data("click-id"),clickClip:c(strToBool(f.data("click-clip")),!0),dblclickId:f.data("dblclick-id"),dblclickClip:c(strToBool(f.data("dblclick-clip")),!0),dblclickDelay:c(f.data("dblclick-delay"),400),hoverId:f.data("hover-id"),hoverClip:c(strToBool(f.data("hover-clip")),!0),hoverDelayType:c(f.data("hover-delay-type"),"debounce"),hoverDelay:c(f.data("hover-delay"),300),hoverNullOutside:c(strToBool(f.data("hover-null-outside")),!1),brushId:f.data("brush-id"),brushClip:c(strToBool(f.data("brush-clip")),!0),brushDelayType:c(f.data("brush-delay-type"),"debounce"),brushDelay:c(f.data("brush-delay"),300),brushFill:c(f.data("brush-fill"),"#666"),brushStroke:c(f.data("brush-stroke"),"#000"),brushOpacity:c(f.data("brush-opacity"),.3),brushDirection:c(f.data("brush-direction"),"xy"),brushResetOnNew:c(strToBool(f.data("brush-reset-on-new")),!1),coordmap:b.coordmap};$.each(b,function(a,b){null!==b&&"coordmap"!==a&&d.setAttribute(a,b)});for(var i=0;i<d.attributes.length;i++){var j=d.attributes[i];j.specified&&!b.hasOwnProperty(j.name)&&d.removeAttribute(j.name)}h.coordmap||(h.coordmap=[]),imageutils.initCoordmap(f,h.coordmap);var k=imageutils.createClickInfo(f,h.dblclickId,h.dblclickDelay);if(f.on("mousedown.image_output",k.mousedown),browser.isIE&&8===browser.IEVersion&&f.on("dblclick.image_output",k.dblclickIE8),h.clickId){var l=imageutils.createClickHandler(h.clickId,h.clickClip,h.coordmap);f.on("mousedown2.image_output",l.mousedown),g.on("reset",l.onResetImg)}if(h.dblclickId){var m=imageutils.createClickHandler(h.dblclickId,h.clickClip,h.coordmap);f.on("dblclick2.image_output",m.mousedown),g.on("reset",m.onResetImg)}if(h.hoverId){var n=imageutils.createHoverHandler(h.hoverId,h.hoverDelay,h.hoverDelayType,h.hoverClip,h.hoverNullOutside,h.coordmap);f.on("mousemove.image_output",n.mousemove),f.on("mouseout.image_output",n.mouseout),g.on("reset",n.onResetImg)}if(h.brushId){g.css("-webkit-user-drag","none"),g.on("dragstart",function(){return!1}),f.on("selectstart.image_output",function(){return!1});var o=imageutils.createBrushHandler(h.brushId,f,h,h.coordmap,e);f.on("mousedown.image_output",o.mousedown),f.on("mousemove.image_output",o.mousemove),g.on("reset",o.onResetImg)}(h.clickId||h.dblclickId||h.hoverId||h.brushId)&&f.addClass("crosshair"),b.error&&console.log("Error on server extracting coordmap: "+b.error)},renderError:function(a,b){$(a).find("img").trigger("reset"),OutputBinding.prototype.renderError.call(this,a,b)},clearError:function(a){$(a).contents().filter(function(){return"IMG"!==this.tagName&&this.id!==a.id+"_brush"}).remove(),OutputBinding.prototype.clearError.call(this,a)}}),outputBindings.register(imageOutputBinding,"shiny.imageOutput");var imageutils={};imageutils.initPanelScales=function(a){function b(a,b,c,d,e,f){f=f||!0;var g=(e-d)/(c-b),h=a-b,i=h*g+d;if(f){var j=Math.max(e,d),k=Math.min(e,d);i>j?i=j:i<k&&(i=k)}return i}function c(a,c,d,e,f){return{scale:function(g,h){return f&&(g=Math.log(g)/Math.log(f)),b(g,a,c,d,e,h)},scaleInv:function(g,h){var i=b(g,d,e,a,c,h);return f&&(i=Math.pow(f,i)),i}}}function d(a){var b=a.domain,d=a.range,e=a.log&&a.log.x?a.log.x:null,f=a.log&&a.log.y?a.log.y:null,g=c(b.left,b.right,d.left,d.right,e),h=c(b.bottom,b.top,d.bottom,d.top,f);a.scale=function(a,b){return{x:g.scale(a.x,b),y:h.scale(a.y,b)}},a.scaleInv=function(a,b){return{x:g.scaleInv(a.x,b),y:h.scaleInv(a.y,b)}},a.clip=function(b){var c={x:b.x,y:b.y},d=a.range;return b.x>d.right?c.x=d.right:b.x<d.left&&(c.x=d.left),b.y>d.bottom?c.y=d.bottom:b.y<d.top&&(c.y=d.top),c}}for(var e=0;e<a.length;e++){var f=a[e];d(f)}},imageutils.initCoordmap=function(a,b){var c=a[0];if(0===b.length){var d={top:0,left:0,right:c.clientWidth-1,bottom:c.clientHeight-1};b[0]={domain:d,range:d,mapping:{}}}imageutils.initPanelScales(b),b.mouseOffset=function(b){var c=a.offset();return{x:b.pageX-c.left,y:b.pageY-c.top}},b.findBox=function(a,b){return{xmin:Math.min(a.x,b.x),xmax:Math.max(a.x,b.x),ymin:Math.min(a.y,b.y),ymax:Math.max(a.y,b.y)}},b.shiftToRange=function(a,b,c){a instanceof Array||(a=[a]);var d=Math.max.apply(null,a),e=Math.min.apply(null,a),f=0;d>c?f=c-d:e<b&&(f=b-e);for(var g=[],h=0;h<a.length;h++)g[h]=a[h]+f;return g},b.getPanel=function(a,c){c=c||0;for(var d,e=a.x,f=a.y,g=[],h=[],i=0;i<b.length;i++)if(d=b[i].range,e<=d.right+c&&e>=d.left-c&&f<=d.bottom+c&&f>=d.top-c){g.push(b[i]);var j=0,k=0;e>d.right&&e<=d.right+c?j=e-d.right:e<d.left&&e>=d.left-c&&(j=e-d.left),f>d.bottom&&f<=d.bottom+c?k=f-d.bottom:f<d.top&&f>=d.top-c&&(k=f-d.top),h.push(Math.sqrt(Math.pow(j,2)+Math.pow(k,2)))}if(g.length){var l=Math.min.apply(null,h);for(i=0;i<g.length;i++)if(h[i]===l)return g[i]}return null},b.isInPanel=function(a,c){return c=c||0,!!b.getPanel(a,c)},b.mouseCoordinateSender=function(a,c,d){return void 0===c&&(c=!0),void 0===d&&(d=!1),function(e){if(null===e)return void exports.onInputChange(a,null);var f=b.mouseOffset(e);if(!b.isInPanel(f)){if(d)return void exports.onInputChange(a,null);if(c)return}if(!c||b.isInPanel(f)){var g=b.getPanel(f),h=g.scaleInv(f);$.extend(h,g.panel_vars),h.mapping=g.mapping,h.domain=g.domain,h.range=g.range,h.log=g.log,h[".nonce"]=Math.random(),exports.onInputChange(a,h)}}}},imageutils.createClickInfo=function(a,b,c){function d(b,c){var d=$.Event(b,{which:c.which,pageX:c.pageX,pageY:c.pageY,offsetX:c.offsetX,offsetY:c.offsetY});a.trigger(d)}function e(){j&&(d("mousedown2",j),j=null)}function f(a){j=a,i=setTimeout(function(){e()},c)}function g(a){if(1===a.which)return b?void(null===j?f(a):(clearTimeout(i),j&&Math.abs(j.offsetX-a.offsetX)>2||Math.abs(j.offsetY-a.offsetY)>2?(e(),f(a)):(j=null,d("dblclick2",a)))):void d("mousedown2",a)}function h(a){a.which=1,d("dblclick2",a)}var i=null,j=null;return{mousedown:g,dblclickIE8:h}},imageutils.createClickHandler=function(a,b,c){var d=c.mouseCoordinateSender(a,b);return{mousedown:function(a){1===a.which&&d(a)},onResetImg:function(){d(null)}}},imageutils.createHoverHandler=function(a,b,c,d,e,f){var g,h=f.mouseCoordinateSender(a,d,e);g="throttle"===c?new Throttler(null,h,b):new Debouncer(null,h,b);var i;return i=e?function(){g.normalCall(null)}:function(){},{mousemove:function(a){g.normalCall(a)},mouseout:i,onResetImg:function(){g.immediateCall(null)}}},imageutils.createBrushHandler=function(a,b,c,d,e){function f(a){b.removeClass("crosshair grabbable grabbing ns-resize ew-resize nesw-resize nwse-resize"),a&&b.addClass(a)}function g(){var d=r.boundsData();if(isNaN(d.xmin))return exports.onInputChange(a,null),void imageOutputBinding.find(document).trigger("shiny-internal:brushed",{brushId:a,outputId:null});var f=r.getPanel();$.extend(d,f.panel_vars),d.mapping=f.mapping,d.domain=f.domain,d.range=f.range,d.log=f.log,d.direction=c.brushDirection,d.brushId=a,d.outputId=e,exports.onInputChange(a,d),b.data("mostRecentBrush",!0),imageOutputBinding.find(document).trigger("shiny-internal:brushed",d)}function h(a){if(!(r.isBrushing()||r.isDragging()||r.isResizing())&&1===a.which){var b=d.mouseOffset(a);if(!c.brushClip||d.isInPanel(b,q))if(r.up({x:NaN,y:NaN}),r.down(b),r.isInResizeArea(b))r.startResizing(b),$(document).on("mousemove.image_brush",l).on("mouseup.image_brush",o);else if(r.isInsideBrush(b))r.startDragging(b),f("grabbing"),$(document).on("mousemove.image_brush",k).on("mouseup.image_brush",n);else{var e=d.getPanel(b,q);r.startBrushing(e.clip(b)),$(document).on("mousemove.image_brush",j).on("mouseup.image_brush",m)}}}function i(a){var b=d.mouseOffset(a);if(!(r.isBrushing()||r.isDragging()||r.isResizing()))if(r.isInResizeArea(b)){var c=r.whichResizeSides(b);c.left&&c.top||c.right&&c.bottom?f("nwse-resize"):c.left&&c.bottom||c.right&&c.top?f("nesw-resize"):c.left||c.right?f("ew-resize"):(c.top||c.bottom)&&f("ns-resize")}else f(r.isInsideBrush(b)?"grabbable":d.isInPanel(b,q)?"crosshair":null)}function j(a){r.brushTo(d.mouseOffset(a)),s.normalCall()}function k(a){r.dragTo(d.mouseOffset(a)),s.normalCall()}function l(a){r.resizeTo(d.mouseOffset(a)),s.normalCall()}function m(a){if(1===a.which)return $(document).off("mousemove.image_brush").off("mouseup.image_brush"),r.up(d.mouseOffset(a)),r.stopBrushing(),f("crosshair"),r.down().x===r.up().x&&r.down().y===r.up().y?(r.reset(),void s.immediateCall()):void(s.isPending()&&s.immediateCall())}function n(a){1===a.which&&($(document).off("mousemove.image_brush").off("mouseup.image_brush"),r.up(d.mouseOffset(a)),r.stopDragging(),f("grabbable"),s.isPending()&&s.immediateCall())}function o(a){1===a.which&&($(document).off("mousemove.image_brush").off("mouseup.image_brush"),r.up(d.mouseOffset(a)),r.stopResizing(),s.isPending()&&s.immediateCall())}function p(){c.brushResetOnNew&&b.data("mostRecentBrush")&&(r.reset(),s.immediateCall())}var q=20,r=imageutils.createBrush(b,c,d,q);b.on("shiny-internal:brushed.image_output",function(c,d){d.brushId===a&&d.outputId!==e&&(b.data("mostRecentBrush",!1),r.reset())});var s;return s="throttle"===c.brushDelayType?new Throttler(null,g,c.brushDelay):new Debouncer(null,g,c.brushDelay),c.brushResetOnNew||b.data("mostRecentBrush")&&(r.importOldBrush(),s.immediateCall()),{mousedown:h,mousemove:i,onResetImg:p}},imageutils.createBrush=function(a,b,c,d){function e(){F.brushing=!1,F.dragging=!1,F.resizing=!1,F.down={x:NaN,y:NaN},F.up={x:NaN,y:NaN},F.resizeSides={left:!1,right:!1,top:!1,bottom:!1},F.boundsPx={xmin:NaN,xmax:NaN,ymin:NaN,ymax:NaN},F.boundsData={xmin:NaN,xmax:NaN,ymin:NaN,ymax:NaN},F.panel=null,F.changeStartBounds={xmin:NaN,xmax:NaN,ymin:NaN,ymax:NaN},E&&E.remove()}function f(){function b(a,b){if(void 0===a)return void 0===b;if(null===a)return null===b;var c=Object.getOwnPropertyNames(a),d=Object.getOwnPropertyNames(b);if(c.length!==d.length)return!1;for(var e=0;e<c.length;e++){var f=c[e];if(a[f]!==b[f])return!1}return!0}var d=a.find("#"+D.id+"_brush");if(0!==d.length){var e=d.data("bounds-data"),f=d.data("panel");if(e&&f){for(var g=0;g<c.length;g++){var h=c[g];if(b(f.mapping,h.mapping)&&b(f.panel_vars,h.panel_vars)){F.panel=c[g];break}}if(null===F.panel)return void d.remove();E=d,k(e),n()}}}function g(a){var b=F.boundsPx;return a.x<=b.xmax&&a.x>=b.xmin&&a.y<=b.ymax&&a.y>=b.ymin}function h(a){var b=i(a);return b.left||b.right||b.top||b.bottom}function i(a){var c=F.boundsPx,d={xmin:c.xmin-C,xmax:c.xmax+C,ymin:c.ymin-C,ymax:c.ymax+C},e={left:!1,right:!1,top:!1,bottom:!1};return("xy"===b.brushDirection||"x"===b.brushDirection)&&a.y<=d.ymax&&a.y>=d.ymin&&(a.x<c.xmin&&a.x>=d.xmin?e.left=!0:a.x>c.xmax&&a.x<=d.xmax&&(e.right=!0)),("xy"===b.brushDirection||"y"===b.brushDirection)&&a.x<=d.xmax&&a.x>=d.xmin&&(a.y<c.ymin&&a.y>=d.ymin?e.top=!0:a.y>c.ymax&&a.y<=d.ymax&&(e.bottom=!0)),e}function j(a){if(void 0===a)return F.boundsPx;var d={x:a.xmin,y:a.ymin},e={x:a.xmax,y:a.ymax},f=F.panel,g=f.range;b.brushClip&&(d=f.clip(d),e=f.clip(e)),"xy"===b.brushDirection||("x"===b.brushDirection?(d.y=g.top,e.y=g.bottom):"y"===b.brushDirection&&(d.x=g.left,e.x=g.right)),F.boundsPx={xmin:d.x,xmax:e.x,ymin:d.y,ymax:e.y};var h=F.panel.scaleInv(d),i=F.panel.scaleInv(e);F.boundsData=c.findBox(h,i),F.boundsData=mapValues(F.boundsData,function(a){return roundSignif(a,14)}),E.data("bounds-data",F.boundsData),E.data("panel",F.panel)}function k(a){if(void 0===a)return F.boundsData;var b={x:a.xmin,y:a.ymin},c={x:a.xmax,y:a.ymax},d=F.panel.scale(b),e=F.panel.scale(c);j({xmin:Math.min(d.x,e.x),xmax:Math.max(d.x,e.x),ymin:Math.min(d.y,e.y),ymax:Math.max(d.y,e.y)})}function l(){return F.panel}function m(){E&&E.remove(),E=$(document.createElement("div")).attr("id",D.id+"_brush").css({"background-color":b.brushFill,opacity:b.brushOpacity,"pointer-events":"none",position:"absolute"}).hide();var c="1px solid "+b.brushStroke;"xy"===b.brushDirection?E.css({border:c}):"x"===b.brushDirection?E.css({"border-left":c,"border-right":c}):"y"===b.brushDirection&&E.css({"border-top":c,"border-bottom":c}),a.append(E),E.offset({x:0,y:0}).width(0).outerHeight(0)}function n(){var b=a.offset(),c=F.boundsPx;E.offset({top:b.top+c.ymin,left:b.left+c.xmin}).outerWidth(c.xmax-c.xmin+1).outerHeight(c.ymax-c.ymin+1)}function o(a){return void 0===a?F.down:void(F.down=a)}function p(a){return void 0===a?F.up:void(F.up=a)}function q(){return F.brushing}function r(){F.brushing=!0,m(),F.panel=c.getPanel(F.down,d),j(c.findBox(F.down,F.down)),n()}function s(a){j(c.findBox(F.down,a)),E.show(),n()}function t(){F.brushing=!1,j(c.findBox(F.down,F.up))}function u(){return F.dragging}function v(){F.dragging=!0,F.changeStartBounds=$.extend({},F.boundsPx)}function w(a){var d=a.x-F.down.x,e=a.y-F.down.y,f=F.changeStartBounds,g={xmin:f.xmin+d,xmax:f.xmax+d,ymin:f.ymin+e,ymax:f.ymax+e};if(b.brushClip){var h=F.panel.range,i=[g.xmin,g.xmax],k=[g.ymin,g.ymax];i=c.shiftToRange(i,h.left,h.right),k=c.shiftToRange(k,h.top,h.bottom),g={xmin:i[0],xmax:i[1],ymin:k[0],ymax:k[1]}}j(g),n()}function x(){F.dragging=!1}function y(){return F.resizing}function z(){F.resizing=!0,F.changeStartBounds=$.extend({},F.boundsPx),F.resizeSides=i(F.down)}function A(a){var b=a.x-F.down.x,d=a.y-F.down.y,e=$.extend({},F.changeStartBounds),f=F.panel.range;F.resizeSides.left?e.xmin=c.shiftToRange([e.xmin+b],f.left,e.xmax)[0]:F.resizeSides.right&&(e.xmax=c.shiftToRange([e.xmax+b],e.xmin,f.right)[0]),F.resizeSides.top?e.ymin=c.shiftToRange([e.ymin+d],f.top,e.ymax)[0]:F.resizeSides.bottom&&(e.ymax=c.shiftToRange([e.ymax+d],e.ymin,f.bottom)[0]),j(e),n()}function B(){F.resizing=!1}var C=10,D=a[0],E=null,F={};return e(),{reset:e,importOldBrush:f,isInsideBrush:g,isInResizeArea:h,whichResizeSides:i,boundsPx:j,boundsData:k,getPanel:l,down:o,up:p,isBrushing:q,startBrushing:r,brushTo:s,stopBrushing:t,isDragging:u,startDragging:v,dragTo:w,stopDragging:x,isResizing:y,startResizing:z,resizeTo:A,stopResizing:B}},exports.resetBrush=function(a){exports.onInputChange(a,null),imageOutputBinding.find(document).trigger("shiny-internal:brushed",{brushId:a,outputId:null})};var htmlOutputBinding=new OutputBinding;$.extend(htmlOutputBinding,{find:function(a){return $(a).find(".shiny-html-output")},onValueError:function(a,b){exports.unbindAll(a),this.renderError(a,b)},renderValue:function(a,b){exports.renderContent(a,b)}}),outputBindings.register(htmlOutputBinding,"shiny.htmlOutput");var renderDependencies=exports.renderDependencies=function(a){a&&$.each(a,function(a,b){renderDependency(b)})};exports.renderContent=function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"replace";"replace"===c&&exports.unbindAll(a);var d,e=[];null===b?d="":"string"==typeof b?d=b:"object"===("undefined"==typeof b?"undefined":_typeof(b))&&(d=b.html,e=b.deps||[]),exports.renderHtml(d,a,e,c);var f=a;if("replace"===c)exports.initializeInputs(a),exports.bindAll(a);else{var g=$(a).parent();if(g.length>0&&(f=g,"beforeBegin"===c||"afterEnd"===c)){var h=g.parent();h.length>0&&(f=h)}exports.initializeInputs(f),exports.bindAll(f)}},exports.renderHtml=function(a,b,c){var d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"replace";return renderDependencies(c),singletons.renderHtml(a,b,d)};var htmlDependencies={},singletons={knownSingletons:{},renderHtml:function(a,b,c){var d=this._processHtml(a);return this._addToHead(d.head),this.register(d.singletons),"replace"===c?$(b).html(d.html):b.insertAdjacentHTML(c,d.html),d},register:function(a){$.extend(this.knownSingletons,a)},registerNames:function(a){if("string"==typeof a)this.knownSingletons[a]=!0;else if(a instanceof Array)for(var b=0;b<a.length;b++)this.knownSingletons[a[b]]=!0},_addToHead:function(a){if(a.length>0)for(var b=$("<div>"+a+"</div>")[0],c=$("head");b.hasChildNodes();)c.append(b.firstChild)},_processHtml:function(a){for(var b,c=this,d={},e=function(a,b,e,f){return c.knownSingletons[e]||d[e]?"":(d[e]=!0,f)};;){if(b=a.replace(c._reSingleton,e),a.length===b.length)break;a=b}for(var f=[],g=function(a,b){return f.push(b),""};;){if(b=a.replace(c._reHead,g),a.length===b.length)break;a=b}return{html:a,head:f.join("\n"),singletons:d}},_reSingleton:/<!--(SHINY.SINGLETON\[([\w]+)\])-->([\s\S]*?)<!--\/\1-->/,_reHead:/<head(?:\s[^>]*)?>([\s\S]*?)<\/head>/},downloadLinkOutputBinding=new OutputBinding;$.extend(downloadLinkOutputBinding,{find:function(a){return $(a).find("a.shiny-download-link")},renderValue:function(a,b){$(a).attr("href",b)}}),outputBindings.register(downloadLinkOutputBinding,"shiny.downloadLink"),$(document).on("click.shinyDownloadLink","a.shiny-download-link",function(a){var b=jQuery.Event("shiny:filedownload");b.name=this.id,b.href=this.href,$(document).trigger(b)});var datatableOutputBinding=new OutputBinding;$.extend(datatableOutputBinding,{find:function(a){return $(a).find(".shiny-datatable-output")},onValueError:function(a,b){exports.unbindAll(a),this.renderError(a,b)},renderValue:function renderValue(el,_data){var $el=$(el).empty();if(_data&&_data.colnames){var colnames=$.makeArray(_data.colnames),header=$.map(colnames,function(a){return"<th>"+a+"</th>"}).join("");header="<thead><tr>"+header+"</tr></thead>";var footer="";null!==_data.options&&_data.options.searching===!1||(footer=$.map(colnames,function(a){return'<th><input type="text" placeholder="'+escapeHTML(a.replace(/(<([^>]+)>)/gi,""))+'" /></th>'}).join(""),footer="<tfoot>"+footer+"</tfoot>");var content='<table class="table table-striped table-hover">'+header+footer+"</table>";$el.append(content),_data.evalOptions&&$.each(_data.evalOptions,function(i,x){_data.options[x]=eval("("+_data.options[x]+")")});var searchCI=null===_data.options||"undefined"==typeof _data.options.search||_data.options.search.caseInsensitive!==!1,oTable=$(el).children("table").DataTable($.extend({processing:!0,serverSide:!0,order:[],orderClasses:!1,pageLength:25,ajax:{url:_data.action,type:"POST",data:function(a){a.search.caseInsensitive=searchCI,a.escape=_data.escape}}},_data.options));if("string"==typeof _data.callback){var callback=eval("("+_data.callback+")");"function"==typeof callback&&callback(oTable)}$el.find("label input").first().unbind("keyup").keyup(debounce(_data.searchDelay,function(){oTable.search(this.value).draw()}));var searchInputs=$el.find("tfoot input");searchInputs.length>0&&($.each(oTable.settings()[0].aoColumns,function(a,b){b.bSearchable||searchInputs.eq(a).hide()}),searchInputs.keyup(debounce(_data.searchDelay,function(){oTable.column(searchInputs.index(this)).search(this.value).draw()}))),$el.parents(".tab-content").css("overflow","visible")}}}),outputBindings.register(datatableOutputBinding,"shiny.datatableOutput");var OutputBindingAdapter=function(a,b){this.el=a,this.binding=b,b.resize&&(this.onResize=makeResizeFilter(a,function(c,d){b.resize(a,c,d)}))};(function(){this.getId=function(){return this.binding.getId(this.el)},this.onValueChange=function(a){this.binding.onValueChange(this.el,a)},this.onValueError=function(a){this.binding.onValueError(this.el,a)},this.showProgress=function(a){this.binding.showProgress(this.el,a)},this.onResize=function(){}}).call(OutputBindingAdapter.prototype);var InputBinding=exports.InputBinding=function(){};(function(){this.find=function(a){throw"Not implemented"},this.getId=function(a){return a["data-input-id"]||a.id},this.getType=function(){return!1},this.getValue=function(a){throw"Not implemented"},this.subscribe=function(a,b){},this.unsubscribe=function(a){},this.receiveMessage=function(a,b){throw"Not implemented"},this.getState=function(a,b){throw"Not implemented"},this.getRatePolicy=function(){return null},this.initialize=function(a){},this.dispose=function(a){}}).call(InputBinding.prototype);var textInputBinding=new InputBinding;$.extend(textInputBinding,{find:function(a){return $(a).find('input[type="text"], input[type="search"], input[type="url"], input[type="email"]')},getId:function(a){return InputBinding.prototype.getId.call(this,a)||a.name},getValue:function(a){return a.value},setValue:function(a,b){a.value=b},subscribe:function(a,b){$(a).on("keyup.textInputBinding input.textInputBinding",function(a){b(!0)}),$(a).on("change.textInputBinding",function(a){b(!1)})},unsubscribe:function(a){$(a).off(".textInputBinding")},receiveMessage:function(a,b){b.hasOwnProperty("value")&&this.setValue(a,b.value),b.hasOwnProperty("label")&&$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(b.label),b.hasOwnProperty("placeholder")&&(a.placeholder=b.placeholder),$(a).trigger("change")},getState:function(a){return{label:$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(),value:a.value,placeholder:a.placeholder}},getRatePolicy:function(){return{policy:"debounce",delay:250}}}),inputBindings.register(textInputBinding,"shiny.textInput");var textareaInputBinding={};$.extend(textareaInputBinding,textInputBinding,{find:function(a){return $(a).find("textarea")}}),inputBindings.register(textareaInputBinding,"shiny.textareaInput");var passwordInputBinding={};$.extend(passwordInputBinding,textInputBinding,{find:function(a){return $(a).find('input[type="password"]')},getType:function(a){return"shiny.password"}}),inputBindings.register(passwordInputBinding,"shiny.passwordInput");var numberInputBinding={};$.extend(numberInputBinding,textInputBinding,{
find:function(a){return $(a).find('input[type="number"]')},getValue:function(a){var b=$(a).val();return/^\s*$/.test(b)?null:isNaN(b)?b:+b},setValue:function(a,b){a.value=b},getType:function(a){return"shiny.number"},receiveMessage:function(a,b){b.hasOwnProperty("value")&&(a.value=b.value),b.hasOwnProperty("min")&&(a.min=b.min),b.hasOwnProperty("max")&&(a.max=b.max),b.hasOwnProperty("step")&&(a.step=b.step),b.hasOwnProperty("label")&&$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(b.label),$(a).trigger("change")},getState:function(a){return{label:$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),min:Number(a.min),max:Number(a.max),step:Number(a.step)}}}),inputBindings.register(numberInputBinding,"shiny.numberInput");var checkboxInputBinding=new InputBinding;$.extend(checkboxInputBinding,{find:function(a){return $(a).find('input[type="checkbox"]')},getValue:function(a){return a.checked},setValue:function(a,b){a.checked=b},subscribe:function(a,b){$(a).on("change.checkboxInputBinding",function(a){b(!0)})},unsubscribe:function(a){$(a).off(".checkboxInputBinding")},getState:function(a){return{label:$(a).parent().find("span").text(),value:a.checked}},receiveMessage:function(a,b){b.hasOwnProperty("value")&&(a.checked=b.value),b.hasOwnProperty("label")&&$(a).parent().find("span").text(b.label),$(a).trigger("change")}}),inputBindings.register(checkboxInputBinding,"shiny.checkboxInput");var sliderInputBinding={};$.extend(sliderInputBinding,textInputBinding,{find:function(a){return $.fn.ionRangeSlider?$(a).find("input.js-range-slider"):[]},getType:function(a){var b=$(a).data("data-type");return"date"===b?"shiny.date":"datetime"===b&&"shiny.datetime"},getValue:function(a){var b,c=$(a),d=$(a).data("ionRangeSlider").result,e=c.data("data-type");return b="date"===e?function(a){return formatDateUTC(new Date((+a)))}:"datetime"===e?function(a){return+a/1e3}:function(a){return+a},2===this._numValues(a)?[b(d.from),b(d.to)]:b(d.from)},setValue:function(a,b){var c=$(a),d=c.data("ionRangeSlider");c.data("immediate",!0);try{2===this._numValues(a)&&b instanceof Array?d.update({from:b[0],to:b[1]}):d.update({from:b}),forceIonSliderUpdate(d)}finally{c.data("immediate",!1)}},subscribe:function(a,b){$(a).on("change.sliderInputBinding",function(c){b(!$(a).data("immediate")&&!$(a).data("animating"))})},unsubscribe:function(a){$(a).off(".sliderInputBinding")},receiveMessage:function(a,b){var c=$(a),d=c.data("ionRangeSlider"),e={};b.hasOwnProperty("value")&&(2===this._numValues(a)&&b.value instanceof Array?(e.from=b.value[0],e.to=b.value[1]):e.from=b.value),b.hasOwnProperty("min")&&(e.min=b.min),b.hasOwnProperty("max")&&(e.max=b.max),b.hasOwnProperty("step")&&(e.step=b.step),b.hasOwnProperty("label")&&c.parent().find('label[for="'+$escape(a.id)+'"]').text(b.label),c.data("immediate",!0);try{d.update(e),forceIonSliderUpdate(d)}finally{c.data("immediate",!1)}},getRatePolicy:function(){return{policy:"debounce",delay:250}},getState:function(a){},initialize:function(a){var b,c={},d=$(a),e=d.data("data-type"),f=d.data("time-format");if("date"===e)b=strftime.utc(),c.prettify=function(a){return b(f,new Date(a))};else if("datetime"===e){var g=d.data("timezone");b=g?strftime.timezone(g):strftime,c.prettify=function(a){return b(f,new Date(a))}}d.ionRangeSlider(c)},_numValues:function(a){return"double"===$(a).data("ionRangeSlider").options.type?2:1}}),inputBindings.register(sliderInputBinding,"shiny.sliderInput"),$(document).on("click",".slider-animate-button",function(a){a.preventDefault();var b=$(this),c=$("#"+$escape(b.attr("data-target-id"))),d="Play",e="Pause",f=void 0!==b.attr("data-loop")&&!/^\s*false\s*$/i.test(b.attr("data-loop")),g=b.attr("data-interval");if(g=isNaN(g)?1500:+g,c.data("animTimer"))clearTimeout(c.data("animTimer")),c.removeData("animTimer"),b.attr("title",d),b.removeClass("playing"),c.removeData("animating");else{var h,i;if(c.hasClass("jslider"))h=c.slider(),h.canStepNext()||h.resetToStart(),i=setInterval(function(){f&&!h.canStepNext()?h.resetToStart():(h.stepNext(),f||h.canStepNext()||b.click())},g);else{h=c.data("ionRangeSlider");var j=function(){return"double"===h.options.type?h.result.to<h.result.max:h.result.from<h.result.max},k=function(){var a={from:h.result.min};"double"===h.options.type&&(a.to=a.from+(h.result.to-h.result.from)),h.update(a),forceIonSliderUpdate(h)},l=function(){var a={from:Math.min(h.result.max,h.result.from+h.options.step)};"double"===h.options.type&&(a.to=Math.min(h.result.max,h.result.to+h.options.step)),h.update(a),forceIonSliderUpdate(h)};j()||k(),i=setInterval(function(){f&&!j()?k():(l(),f||j()||b.click())},g)}c.data("animTimer",i),b.attr("title",e),b.addClass("playing"),c.data("animating",!0)}});var dateInputBinding=new InputBinding;$.extend(dateInputBinding,{find:function(a){return $(a).find(".shiny-date-input")},getType:function(a){return"shiny.date"},getValue:function(a){var b=$(a).find("input").bsDatepicker("getUTCDate");return formatDateUTC(b)},setValue:function(a,b){if(null===b)return void $(a).find("input").val("").bsDatepicker("update");var c=this._newDate(b);isNaN(c)||$(a).find("input").bsDatepicker("setUTCDate",c)},getState:function(a){var b=$(a),c=b.find("input"),d=c.data("datepicker").startDate,e=c.data("datepicker").endDate;d=d===-(1/0)?null:formatDateUTC(d),e=e===1/0?null:formatDateUTC(e);var f=c.data("datepicker").startViewMode;return 2===f?f="decade":1===f?f="year":0===f&&(f="month"),{label:b.find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),valueString:c.val(),min:d,max:e,language:c.data("datepicker").language,weekstart:c.data("datepicker").weekStart,format:this._formatToString(c.data("datepicker").format),startview:f}},receiveMessage:function(a,b){var c=$(a).find("input");b.hasOwnProperty("label")&&$(a).find('label[for="'+$escape(a.id)+'"]').text(b.label),b.hasOwnProperty("min")&&this._setMin(c[0],b.min),b.hasOwnProperty("max")&&this._setMax(c[0],b.max),b.hasOwnProperty("value")&&this.setValue(a,b.value),$(a).trigger("change")},subscribe:function(a,b){$(a).on("keyup.dateInputBinding input.dateInputBinding",function(a){b(!0)}),$(a).on("changeDate.dateInputBinding change.dateInputBinding",function(a){b(!1)})},unsubscribe:function(a){$(a).off(".dateInputBinding")},getRatePolicy:function(){return{policy:"debounce",delay:250}},initialize:function(a){var b=$(a).find("input"),c=b.data("initial-date");void 0!==c&&null!==c||(c=this._dateAsUTC(new Date)),this.setValue(a,c),void 0!==b.data("min-date")&&this._setMin(b[0],b.data("min-date")),void 0!==b.data("max-date")&&this._setMax(b[0],b.data("max-date"))},_formatToString:function(a){for(var b="",c=0;c<a.parts.length;c++)b+=a.separators[c]+a.parts[c];return b+=a.separators[c]},_setMin:function(a,b){if(void 0!==b)if(null===b)$(a).bsDatepicker("setStartDate",null);else if(b=this._newDate(b),b=this._UTCDateAsLocal(b),!isNaN(b)){var c=$(a).bsDatepicker("getUTCDate");$(a).bsDatepicker("setStartDate",b),$(a).bsDatepicker("setUTCDate",c)}},_setMax:function(a,b){if(void 0!==b)if(null===b)$(a).bsDatepicker("setEndDate",null);else if(b=this._newDate(b),b=this._UTCDateAsLocal(b),!isNaN(b)){var c=$(a).bsDatepicker("getUTCDate");$(a).bsDatepicker("setEndDate",b),$(a).bsDatepicker("setUTCDate",c)}},_newDate:function(a){if(a instanceof Date)return a;if(!a)return null;var b=parseDate(a);return isNaN(b)?null:new Date(b.getTime())},_dateAsUTC:function(a){return new Date(a.getTime()-6e4*a.getTimezoneOffset())},_UTCDateAsLocal:function(a){return new Date(a.getTime()+6e4*a.getTimezoneOffset())}}),inputBindings.register(dateInputBinding,"shiny.dateInput");var dateRangeInputBinding={};$.extend(dateRangeInputBinding,dateInputBinding,{find:function(a){return $(a).find(".shiny-date-range-input")},getValue:function(a){var b=$(a).find("input"),c=b.eq(0).bsDatepicker("getUTCDate"),d=b.eq(1).bsDatepicker("getUTCDate");return[formatDateUTC(c),formatDateUTC(d)]},setValue:function(a,b){if(b instanceof Object){var c=$(a).find("input");if(void 0!==b.start)if(null===b.start)c.eq(0).val("").bsDatepicker("update");else{var d=this._newDate(b.start);c.eq(0).bsDatepicker("setUTCDate",d)}if(void 0!==b.end)if(null===b.end)c.eq(1).val("").bsDatepicker("update");else{var e=this._newDate(b.end);c.eq(1).bsDatepicker("setUTCDate",e)}}},getState:function(a){var b=$(a),c=b.find("input"),d=c.eq(0),e=c.eq(1),f=d.bsDatepicker("getStartDate"),g=d.bsDatepicker("getEndDate");f=f===-(1/0)?null:formatDateUTC(f),g=g===1/0?null:formatDateUTC(g);var h=d.data("datepicker").startView;return 2===h?h="decade":1===h?h="year":0===h&&(h="month"),{label:b.find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),valueString:[d.val(),e.val()],min:f,max:g,weekstart:d.data("datepicker").weekStart,format:this._formatToString(d.data("datepicker").format),language:d.data("datepicker").language,startview:h}},receiveMessage:function(a,b){var c=$(a),d=c.find("input"),e=d.eq(0),f=d.eq(1);b.hasOwnProperty("label")&&c.find('label[for="'+$escape(a.id)+'"]').text(b.label),b.hasOwnProperty("min")&&(this._setMin(e[0],b.min),this._setMin(f[0],b.min)),b.hasOwnProperty("max")&&(this._setMax(e[0],b.max),this._setMax(f[0],b.max)),b.hasOwnProperty("value")&&this.setValue(a,b.value),c.trigger("change")},initialize:function(a){var b=$(a),c=b.find("input"),d=c.eq(0),e=c.eq(1),f=d.data("initial-date"),g=e.data("initial-date");void 0!==f&&null!==f||(f=this._dateAsUTC(new Date)),void 0!==g&&null!==g||(g=this._dateAsUTC(new Date)),this.setValue(a,{start:f,end:g}),this._setMin(d[0],d.data("min-date")),this._setMin(e[0],d.data("min-date")),this._setMax(d[0],e.data("max-date")),this._setMax(e[0],e.data("max-date"))},subscribe:function(a,b){$(a).on("keyup.dateRangeInputBinding input.dateRangeInputBinding",function(a){b(!0)}),$(a).on("changeDate.dateRangeInputBinding change.dateRangeInputBinding",function(a){b(!1)})},unsubscribe:function(a){$(a).off(".dateRangeInputBinding")}}),inputBindings.register(dateRangeInputBinding,"shiny.dateRangeInput");var selectInputBinding=new InputBinding;$.extend(selectInputBinding,{find:function(a){return $(a).find("select")},getId:function(a){return InputBinding.prototype.getId.call(this,a)||a.name},getValue:function(a){return $(a).val()},setValue:function(a,b){var c=this._selectize(a);"undefined"!=typeof c?c.setValue(b):$(a).val(b)},getState:function(a){for(var b=new Array(a.length),c=0;c<a.length;c++)b[c]={value:a[c].value,label:a[c].label};return{label:$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),options:b}},receiveMessage:function(a,b){var c,d=$(a);if(b.hasOwnProperty("options")&&(c=this._selectize(a),c&&c.destroy(),d.empty().append(b.options),this._selectize(a)),b.hasOwnProperty("config")&&(d.parent().find('script[data-for="'+$escape(a.id)+'"]').replaceWith(b.config),this._selectize(a,!0)),b.hasOwnProperty("url")){c=this._selectize(a),c.clearOptions();var e=this,f=!1;c.settings.load=function(d,g){var h=c.settings;$.ajax({url:b.url,data:{query:d,field:JSON.stringify([h.searchField]),value:h.valueField,conju:h.searchConjunction,maxop:h.maxOptions},type:"GET",error:function(){g()},success:function(c){g(c),!f&&b.hasOwnProperty("value")&&e.setValue(a,b.value),f=!0}})},c.load(function(a){c.settings.load.apply(c,["",a])})}else b.hasOwnProperty("value")&&this.setValue(a,b.value);b.hasOwnProperty("label")&&$(a).parent().parent().find('label[for="'+$escape(a.id)+'"]').text(b.label),$(a).trigger("change")},subscribe:function(a,b){$(a).on("change.selectInputBinding",function(a){b()})},unsubscribe:function(a){$(a).off(".selectInputBinding")},initialize:function(a){this._selectize(a)},_selectize:function _selectize(el,update){if($.fn.selectize){var $el=$(el),config=$el.parent().find('script[data-for="'+$escape(el.id)+'"]');if(0!==config.length){var options=$.extend({labelField:"label",valueField:"value",searchField:["label"]},JSON.parse(config.html()));"undefined"!=typeof config.data("nonempty")&&(options=$.extend(options,{onItemRemove:function(a){""===this.getValue()&&$("select#"+$escape(el.id)).empty().append($("<option/>",{value:a,selected:!0})).trigger("change")},onDropdownClose:function(a){""===this.getValue()&&this.setValue($("select#"+$escape(el.id)).val())}})),config.data("eval")instanceof Array&&$.each(config.data("eval"),function(i,x){options[x]=eval("("+options[x]+")")});var control=$el.selectize(options)[0].selectize;if(update){var settings=$.extend(control.settings,options);control.destroy(),control=$el.selectize(settings)[0].selectize}return control}}}}),inputBindings.register(selectInputBinding,"shiny.selectInput");var radioInputBinding=new InputBinding;$.extend(radioInputBinding,{find:function(a){return $(a).find(".shiny-input-radiogroup")},getValue:function(a){return $('input:radio[name="'+$escape(a.id)+'"]:checked').val()},setValue:function(a,b){$('input:radio[name="'+$escape(a.id)+'"][value="'+$escape(b)+'"]').prop("checked",!0)},getState:function(a){for(var b=$('input:radio[name="'+$escape(a.id)+'"]'),c=new Array(b.length),d=0;d<c.length;d++)c[d]={value:b[d].value,label:this._getLabel(b[d])};return{label:$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),options:c}},receiveMessage:function(a,b){var c=$(a);b.hasOwnProperty("options")&&(c.find("div.shiny-options-group").remove(),c.find("label.radio").remove(),c.append(b.options)),b.hasOwnProperty("value")&&this.setValue(a,b.value),b.hasOwnProperty("label")&&$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(b.label),$(a).trigger("change")},subscribe:function(a,b){$(a).on("change.radioInputBinding",function(a){b()})},unsubscribe:function(a){$(a).off(".radioInputBinding")},_getLabel:function(a){return"LABEL"===a.parentNode.tagName?$.trim($(a.parentNode).find("span").text()):null},_setLabel:function(a,b){return"LABEL"===a.parentNode.tagName&&$(a.parentNode).find("span").text(b),null}}),inputBindings.register(radioInputBinding,"shiny.radioInput");var checkboxGroupInputBinding=new InputBinding;$.extend(checkboxGroupInputBinding,{find:function(a){return $(a).find(".shiny-input-checkboxgroup")},getValue:function(a){for(var b=$('input:checkbox[name="'+$escape(a.id)+'"]:checked'),c=new Array(b.length),d=0;d<b.length;d++)c[d]=b[d].value;return c},setValue:function(a,b){if($('input:checkbox[name="'+$escape(a.id)+'"]').prop("checked",!1),b instanceof Array)for(var c=0;c<b.length;c++)$('input:checkbox[name="'+$escape(a.id)+'"][value="'+$escape(b[c])+'"]').prop("checked",!0);else $('input:checkbox[name="'+$escape(a.id)+'"][value="'+$escape(b)+'"]').prop("checked",!0)},getState:function(a){for(var b=$('input:checkbox[name="'+$escape(a.id)+'"]'),c=new Array(b.length),d=0;d<c.length;d++)c[d]={value:b[d].value,label:this._getLabel(b[d])};return{label:$(a).find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),options:c}},receiveMessage:function(a,b){var c=$(a);b.hasOwnProperty("options")&&(c.find("div.shiny-options-group").remove(),c.find("label.checkbox").remove(),c.append(b.options)),b.hasOwnProperty("value")&&this.setValue(a,b.value),b.hasOwnProperty("label")&&c.find('label[for="'+$escape(a.id)+'"]').text(b.label),$(a).trigger("change")},subscribe:function(a,b){$(a).on("change.checkboxGroupInputBinding",function(a){b()})},unsubscribe:function(a){$(a).off(".checkboxGroupInputBinding")},_getLabel:function(a){return"LABEL"===a.parentNode.tagName?$.trim($(a.parentNode).find("span").text()):null},_setLabel:function(a,b){return"LABEL"===a.parentNode.tagName&&$(a.parentNode).find("span").text(b),null}}),inputBindings.register(checkboxGroupInputBinding,"shiny.checkboxGroupInput");var actionButtonInputBinding=new InputBinding;$.extend(actionButtonInputBinding,{find:function(a){return $(a).find(".action-button")},getValue:function(a){return $(a).data("val")||0},setValue:function(a,b){$(a).data("val",b)},getType:function(a){return"shiny.action"},subscribe:function(a,b){$(a).on("click.actionButtonInputBinding",function(a){var c=$(this),d=c.data("val")||0;c.data("val",d+1),b()})},getState:function(a){return{value:this.getValue(a)}},receiveMessage:function(a,b){var c=$(a),d=c.text(),e="";if(c.find("i[class]").length>0){var f=c.find("i[class]")[0];f===c.children()[0]&&(e=$(f).prop("outerHTML"))}b.hasOwnProperty("label")&&(d=b.label),b.hasOwnProperty("icon")&&(e=b.icon,0===e.length&&(e="")),c.html(e+" "+d)},unsubscribe:function(a){$(a).off(".actionButtonInputBinding")}}),inputBindings.register(actionButtonInputBinding,"shiny.actionButtonInput"),$(document).on("click","a.action-button",function(a){a.preventDefault()});var bootstrapTabInputBinding=new InputBinding;$.extend(bootstrapTabInputBinding,{find:function(a){return $(a).find("ul.nav.shiny-tab-input")},getValue:function(a){var b=$(a).find("li:not(.dropdown).active").children("a");return 1===b.length?this._getTabName(b):null},setValue:function(a,b){var c=this,d=!1;if(b){var e=$(a).find("li:not(.dropdown)").children("a");e.each(function(){return c._getTabName($(this))!==b||($(this).tab("show"),d=!0,!1)})}d||$(a).trigger("change")},getState:function(a){return{value:this.getValue(a)}},receiveMessage:function(a,b){b.hasOwnProperty("value")&&this.setValue(a,b.value)},subscribe:function(a,b){$(a).on("change shown.bootstrapTabInputBinding shown.bs.tab.bootstrapTabInputBinding",function(a){b()})},unsubscribe:function(a){$(a).off(".bootstrapTabInputBinding")},_getTabName:function(a){return a.attr("data-value")||a.text()}}),inputBindings.register(bootstrapTabInputBinding,"shiny.bootstrapTabInput");var IE8FileUploader=function(a,b,c){this.shinyapp=a,this.id=b,this.fileEl=c,this.beginUpload()};(function(){this.beginUpload=function(){var a=this,b="shinyupload_iframe_"+this.id;this.iframe=document.createElement("iframe"),this.iframe.id=b,this.iframe.name=b,this.iframe.setAttribute("style","position: fixed; top: 0; left: 0; width: 0; height: 0; border: none"),$("body").append(this.iframe);var c=function(){a.shinyapp.makeRequest("uploadieFinish",[],function(){},function(){}),$(a.iframe).remove(),$(a.fileEl).val("")};this.iframe.attachEvent?this.iframe.attachEvent("onload",c):this.iframe.onload=c,this.form=document.createElement("form"),this.form.method="POST",this.form.setAttribute("enctype","multipart/form-data"),this.form.action="session/"+encodeURI(this.shinyapp.config.sessionId)+"/uploadie/"+encodeURI(this.id),this.form.id="shinyupload_form_"+this.id,this.form.target=b,$(this.form).insertAfter(this.fileEl).append(this.fileEl),this.form.submit()}}).call(IE8FileUploader.prototype);var FileUploader=function(a,b,c,d){this.shinyapp=a,this.id=b,this.el=d,FileProcessor.call(this,c)};$.extend(FileUploader.prototype,FileProcessor.prototype),function(){this.makeRequest=function(a,b,c,d,e){this.shinyapp.makeRequest(a,b,c,d,e)},this.onBegin=function(a,b){var c=this;this.$setError(null),this.$setActive(!0),this.$setVisible(!0),this.onProgress(null,0),this.totalBytes=0,this.progressBytes=0,$.each(a,function(a,b){c.totalBytes+=b.size});var d=$.map(a,function(a,b){return{name:a.name,size:a.size,type:a.type}});this.makeRequest("uploadInit",[d],function(a){c.jobId=a.jobId,c.uploadUrl=a.uploadUrl,b()},function(a){c.onError(a)})},this.onFile=function(a,b){var c=this;this.onProgress(a,0),$.ajax(this.uploadUrl,{type:"POST",cache:!1,xhr:function(){var b=$.ajaxSettings.xhr();return b.upload&&(b.upload.onprogress=function(b){b.lengthComputable&&c.onProgress(a,(c.progressBytes+b.loaded)/c.totalBytes)}),b},data:a,contentType:"application/octet-stream",processData:!1,success:function(){c.progressBytes+=a.size,b()},error:function(a,b,d){c.onError(a.responseText||b)}})},this.onComplete=function(){var a=this,b=$.map(this.files,function(a,b){return{name:a.name,size:a.size,type:a.type}}),c=jQuery.Event("shiny:inputchanged");c.name=this.id,c.value=b,c.binding=fileInputBinding,c.el=this.el,c.inputType="shiny.fileupload",$(document).trigger(c),this.makeRequest("uploadEnd",[this.jobId,this.id],function(b){a.$setActive(!1),a.onProgress(null,1),a.$bar().text("Upload complete"),$(c.el).val("")},function(b){a.onError(b)}),this.$bar().text("Finishing upload")},this.onError=function(a){this.$setError(a||""),this.$setActive(!1)},this.onAbort=function(){this.$setVisible(!1)},this.onProgress=function(a,b){this.$bar().width(Math.round(100*b)+"%"),this.$bar().text(a?a.name:"")},this.$container=function(){return $("#"+$escape(this.id)+"_progress.shiny-file-input-progress")},this.$bar=function(){return $("#"+$escape(this.id)+"_progress.shiny-file-input-progress .progress-bar")},this.$setVisible=function(a){this.$container().css("visibility",a?"visible":"hidden")},this.$setError=function(a){this.$bar().toggleClass("progress-bar-danger",null!==a),null!==a&&(this.onProgress(null,1),this.$bar().text(a))},this.$setActive=function(a){this.$container().toggleClass("active",!!a)}}.call(FileUploader.prototype);var $fileInputs=$(),fileInputBinding=new InputBinding;$.extend(fileInputBinding,{find:function(a){return $(a).find('input[type="file"]')},getId:function(a){return InputBinding.prototype.getId.call(this,a)||a.name},getValue:function(a){var b=$(a).attr("data-restore");if(b){b=JSON.parse(b);var c=$(a).closest("div.input-group").find("input[type=text]");1===b.name.length?c.val(b.name[0]):c.val(b.name.length+" files");var d=$(a).closest("div.form-group").find(".progress"),e=d.find(".progress-bar");return d.removeClass("active"),e.width("100%"),e.css("visibility","visible"),b}return null},setValue:function(a,b){},getType:function(a){return"shiny.file"},_getZone:function(a){return $(a).closest("div.input-group")},_enableDraghover:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",c=$();a.on("dragenter.dragHover",function(d){0===c.size()&&a.trigger("draghoverstart"+b,d.originalEvent),c=c.add(d.originalEvent.target)}),a.on("dragleave.dragHover drop.dragHover",function(d){c=c.not(d.originalEvent.target),0===c.size()&&a.trigger("draghoverend"+b,d.originalEvent)})},_disableDraghover:function(a){a.off(".dragHover")},_enableDocumentEvents:function(){var a=$("html");this._enableDraghover(a),a.on({"draghoverstart.fileDrag":function(a){$fileInputs.trigger("showZone.fileDrag")},"draghoverend.fileDrag":function(a){$fileInputs.trigger("hideZone.fileDrag")},"dragover.fileDrag drop.fileDrag":function(a){a.preventDefault()}})},_disableDocumentEvents:function(){var a=$("html");a.off(".fileDrag"),this._disableDraghover(a)},_zoneEvents:["showZone.fileDrag","hideZone.fileDrag","draghoverstart.zone","draghoverend.zone","drop"].join(" "),_canSetFiles:function(a){var b=document.createElement("input");b.type="file";try{b.files=a}catch(c){return!1}return!0},_handleDrop:function(a,b){var c=a.originalEvent.dataTransfer.files,d=$(b);void 0===c||null===c?console.log("Dropping files is not supported on this browser. (no FileList)"):this._canSetFiles(c)?(d.val(""),b.files=a.originalEvent.dataTransfer.files):(d.val(""),uploadDroppedFilesIE10Plus(b,c))},_activeClass:"shiny-file-input-active",_overClass:"shiny-file-input-over",_isIE9:function(){try{return window.navigator.userAgent.match(/MSIE 9\./)&&!0||!1}catch(a){return!1}},subscribe:function(a,b){var c=this,d=$(a);this._isIE9()||!function(){var b=c._getZone(a),e=function(){return d.data("state")},f=function(a){return d.data("state",a)},g=multimethod().dispatch(function(a){return[e(),a.type]}).when(["plain","showZone"],function(a){b.removeClass(c._overClass),b.addClass(c._activeClass),f("activated")}).when(["activated","hideZone"],function(a){b.removeClass(c._overClass),b.removeClass(c._activeClass),f("plain")}).when(["activated","draghoverstart"],function(a){b.addClass(c._overClass),b.removeClass(c._activeClass),f("over")}).when(["over","drop"],function(b){c._handleDrop(b,a)}).when(["over","draghoverend"],function(a){b.removeClass(c._overClass),b.addClass(c._activeClass),f("activated")}).when(["plain","draghoverstart"],function(a){window.setTimeout(function(){b.addClass(c._overClass),b.removeClass(c._activeClass),f("over")},0)})["else"](function(a){console.log("fileInput DnD unhandled transition",e(),a.type,a)});0===$fileInputs.length&&c._enableDocumentEvents(),f("plain"),b.on(c._zoneEvents,g),$fileInputs=$fileInputs.add(a),c._enableDraghover(b,".zone")}(),d.on("change.fileInputBinding",uploadFiles)},unsubscribe:function(a){var b=$(a),c=this._getZone(a);b.removeData("state"),c.removeClass(this._overClass),c.removeClass(this._activeClass),this._disableDraghover(c),b.off(".fileInputBinding"),c.off(this._zoneEvents),$fileInputs=$fileInputs.not(a),0===$fileInputs.length&&this._disableDocumentEvents()}}),inputBindings.register(fileInputBinding,"shiny.fileInputBinding"),$(function(){setTimeout(initShiny,1)}),$(document).on("keydown",function(a){if(114===a.which&&(a.ctrlKey||a.metaKey)&&!a.shiftKey&&!a.altKey){var b="reactlog?w="+window.escape(exports.shinyapp.config.workerId)+"&s="+window.escape(exports.shinyapp.config.sessionId);window.open(b),a.preventDefault()}})}();