/*! shiny 1.6.0 | (c) 2012-2021 RStudio, Inc. | License: GPL-3 | file LICENSE */

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