/
shiny.min.js.map
1 lines (1 loc) · 272 KB
/
shiny.min.js.map
1
{"version":3,"sources":["../../srcjs/_start.js","../../srcjs/utils.js","../../srcjs/input_rate.js","../../srcjs/output_binding_html.js","../../srcjs/input_binding_slider.js","../../srcjs/input_binding_fileinput.js","../../srcjs/init_shiny.js","../../srcjs/browser.js","../../srcjs/shinyapp.js","../../srcjs/notifications.js","../../srcjs/modal.js","../../srcjs/file_processor.js","../../srcjs/binding_registry.js","../../srcjs/output_binding.js","../../srcjs/output_binding_text.js","../../srcjs/output_binding_image.js","../../srcjs/output_binding_downloadlink.js","../../srcjs/output_binding_datatable.js","../../srcjs/output_binding_adapter.js","../../srcjs/input_binding.js","../../srcjs/input_binding_text.js","../../srcjs/input_binding_textarea.js","../../srcjs/input_binding_password.js","../../srcjs/input_binding_number.js","../../srcjs/input_binding_checkbox.js","../../srcjs/input_binding_date.js","../../srcjs/input_binding_daterange.js","../../srcjs/input_binding_select.js","../../srcjs/input_binding_radio.js","../../srcjs/input_binding_checkboxgroup.js","../../srcjs/input_binding_actionbutton.js","../../srcjs/input_binding_tabinput.js","../../srcjs/reactlog.js"],"names":["escapeHTML","str","replace","randomId","Math","floor","random","toString","strToBool","toLowerCase","getStyle","el","styleProp","x","currentStyle","window","getComputedStyle","style","document","defaultView","getPropertyValue","padZeros","n","digits","length","parseDate","dateString","date","Date","isNaN","formatDateUTC","getUTCFullYear","getUTCMonth","getUTCDate","makeResizeFilter","func","lastSize","size","w","offsetWidth","h","offsetHeight","makeBlob","parts","Blob","e","blobBuilder","_BlobBuilder","$","each","i","part","append","getBlob","pixelRatio","devicePixelRatio","scopeExprToFunc","expr","Function","scope","call","asArray","value","undefined","isArray","mergeSort","list","sortfunc","merge","a","b","ia","ib","sorted","push","slice","chunkSize","listA","listB","merged","args","Array","prototype","apply","splice","debounce","threshold","self","timerId","this","arguments","clearTimeout","setTimeout","throttle","throttled","executionPending","registerDependency","name","version","htmlDependencies","renderDependency","dep","hasOwnProperty","href","src","$head","first","meta","metas","map","obj","idx","Object","keys","attr","stylesheet","stylesheets","encodeURI","script","scripts","scriptName","attachment","attachments","tmp","index","attach","key","head","$newHead","html","children","forceIonSliderUpdate","slider","$cache","input","trigger","console","log","uploadFiles","evt","$el","target","uploader","data","abort","files","IE8","id","fileInputBinding","getId","removeAttr","$fileText","closest","find","val","IE8FileUploader","exports","shinyapp","FileUploader","initShiny","bindOutputs","bindings","outputBindings","getBindings","binding","matches","j","contains","hasClass","bindingAdapter","OutputBindingAdapter","bindOutput","addClass","type","bindingType","sendImageSize","sendOutputHiddenState","unbindOutputs","includeSelf","outputs","unbindOutput","removeClass","removeData","valueChangeCallback","allowDeferred","getValue","getType","inputs","setInput","bindInputs","inputBindings","currentValues","boundInputs","effectiveId","thisCallback","thisBinding","thisEl","subscribe","ratePolicy","getRatePolicy","inputsRate","setRatePolicy","policy","delay","node","isConnected","unbindInputs","unsubscribe","_bindAll","unbindAll","initializeInputs","inputObjects","_shiny_initialized","initialize","getIdFromEl","doSendImageSize","$this","visible","isHidden","onResize","sendImageSizeDebouncer","normalCall","parentNode","doSendOutputHiddenState","visibleOutputs","lastKnownVisibleOutputs","hidden","sendOutputHiddenStateDebouncer","filterEventsByNamespace","namespace","handler","split","eventNamespace","indexOf","ShinyApp","inputBatchSender","InputBatchSender","inputsNoResend","InputNoResendDecorator","inputsEvent","InputEventDecorator","InputRateDecorator","inputsDefer","InputDeferDecorator","click","event","preventDefault","submit","onInputChange","bindAll","initDeferredIframes","initialValues","Debouncer","lastChanceCallback","isPending","immediateCall","resize","bs3classes","classname","on","location","protocol","hostname","port","pathname","search","hash","singletonText","text","singletons","registerNames","dependencyText","depStr","match","exec","reset","connect","one","Shiny","jQuery","origPushState","history","pushState","result","BlobBuilder","WebKitBlobBuilder","MozBlobBuilder","MSBlobBuilder","$escape","browser","getIEVersion","rv","isIE","ua","navigator","userAgent","re","RegExp","parseFloat","$1","isQt","test","documentElement","appName","IEVersion","Invoker","delayMs","$clearTimer","$invoke","Throttler","pendingData","reentrant","callback","currentData","sendInput","lastSentValues","jsonValue","JSON","stringify","values","strValues","pendingInput","immediate","Event","name2","inputType","isDefaultPrevented","inputRatePolicies","$ensureInit","mode","millis","$doSetInput","$socket","$inputValues","$bindings","$values","$errors","$conditionals","$pendingMessages","$activeRequests","$nextRequestId","$allowReconnect","addMessageHandler","messageHandlers","messageHandlerOrder","addCustomMessageHandler","customMessageHandlers","typeIdx","customMessageHandlerOrder","initialInput","extend",".clientdata_allowDataUriScheme","WebSocket","createSocket","$initialInput","$updateConditionals","scheduledReconnect","reconnect","createSocketFunc","defaultPath","ws","host","binaryType","socket","hasOpened","onopen","onConnected","send","method","msg","shift","onmessage","dispatchMessage","onclose","$notifyDisconnected","onDisconnected","$removeSocket","$sendMsg","normalize","parentUrl","parent","referrer","createElement","origin","postMessage","$scheduleReconnect","reconnectDelay","attempts","delays","next","$overlay","body","allowReconnect","showReconnectDialog","remove","hideReconnectDialog","makeRequest","onSuccess","onError","blobs","requestId","tag","uint32_to_buf","buffer","ArrayBuffer","view","DataView","setUint32","payload","jsonBuf","byteLength","readyState","receiveError","error","onValueError","receiveOutput","onValueChange","shortName","output","conditionals","condFunc","condExpr","show","showing","css","hide","msgObj","parse","len","getUint8","typedv","typebuf","String","fromCharCode","join","custom","message","_sendMessagesToHandlers","handlers","handlerOrder","msgType","showProgress","$obj","inputBinding","receiveMessage","eval","progressHandlers","notifications","modal","request","oncustommessage","config","status","reload","targets","selector","warn","renderHtml","content","deps","renderContent","where","multiple","els","replaceState","queryString","what","charAt","path","oldQS","oldHash","relURL","resetBrush","brushId","open","duration","$container","depth","$progress","$progressBar","height","$progressText","outerHeight","update","detail","width","fadeIn","close","fadeOut","complete","getTestSnapshotBaseUrl","_ref","fullUrl","_ref$fullUrl","loc","url","encodeURIComponent","sessionId","workerId","updateTime","$time","seconds","reconnectTime","getTime","action","closeButton","_ref2","_ref2$html","_ref2$action","_ref2$deps","_ref2$duration","_ref2$id","_ref2$closeButton","_ref2$type","_createPanel","$notification","_get","_create","newHtml","$content","classes","filter","cls","$close","_addRemovalCallback","_clearRemovalCallback","fadeDuration","_ids","_getPanel","get","$panel","stopPropagation","removalCallback","oldRemovalCallback","_ref3","_ref3$html","_ref3$deps","$modal","FileProcessor","fileIndex","aborted","completed","$run","onBegin","cont","onFile","file","onComplete","onAbort","$getRun","called","BindingRegistry","bindingNames","register","bindingName","priority","bindingObj","unshift","setPriority","getPriority","OutputBinding","clearError","renderValue","err","renderError","empty","errClass","c","RECALC_CLASS","textOutputBinding","imageOutputBinding","OR","alternate","img","outputId","off","$img","opts","clickId","clickClip","dblclickId","dblclickClip","dblclickDelay","hoverId","hoverClip","hoverDelayType","hoverDelay","hoverNullOutside","brushClip","brushDelayType","brushDelay","brushFill","brushStroke","brushOpacity","brushDirection","brushResetOnNew","coordmap","setAttribute","attributes","attrib","specified","removeAttribute","imageutils","initCoordmap","clickInfo","createClickInfo","mousedown","dblclickIE8","clickHandler","createClickHandler","onResetImg","dblclickHandler","hoverHandler","createHoverHandler","mousemove","mouseout","brushHandler","createBrushHandler","contents","tagName","initPanelScales","mapLinear","domainMin","domainMax","rangeMin","rangeMax","clip","factor","newval","max","min","scaler1D","logbase","scale","scaleInv","res","pow","addScaleFuns","panel","d","domain","r","range","xlog","ylog","y","xscaler","left","right","yscaler","bottom","top","offset","newOffset","bounds","clientWidth","clientHeight","mapping","mouseOffset","mouseEvent","pageX","pageY","findBox","offset1","offset2","xmin","xmax","ymin","ymax","shiftToRange","vals","maxval","minval","shiftAmount","newvals","getPanel","expand","dists","xdist","ydist","sqrt","min_dist","isInPanel","mouseCoordinateSender","inputId","nullOutside","coords","panel_vars","triggerEvent","newEventType","e2","which","offsetX","offsetY","triggerPendingMousedown2","pending_e","scheduleMousedown2","clickTimer","abs","clickInfoSender","delayType","hoverInfoSender","sendHoverInfo","setCursorStyle","sendBrushInfo","brush","boundsData","direction","isBrushing","isDragging","isResizing","expandPixels","up","NaN","down","isInResizeArea","startResizing","mousemoveResizing","mouseupResizing","isInsideBrush","startDragging","mousemoveDragging","mouseupDragging","startBrushing","mousemoveBrushing","mouseupBrushing","whichResizeSides","brushTo","brushInfoSender","dragTo","resizeTo","stopBrushing","stopDragging","stopResizing","createBrush","importOldBrush","state","brushing","dragging","resizing","resizeSides","boundsPx","changeStartBounds","$div","isEquivalent","aProps","getOwnPropertyNames","bProps","propName","oldDiv","oldBoundsData","oldPanel","curPanel","updateDiv","sides","resizeExpand","box","panelBounds","minData","maxData","minPx","maxPx","addDiv","background-color","opacity","pointer-events","position","borderStyle","border","border-left","border-right","border-top","border-bottom","imgOffset","outerWidth","dx","dy","start","newBounds","xvals","yvals","htmlOutputBinding","renderDependencies","dependencies","_typeof","$parent","$grandparent","knownSingletons","processed","_processHtml","_addToHead","insertAdjacentHTML","s","tempDiv","hasChildNodes","firstChild","newVal","newSingletons","findNewPayload","p1","sig","_reSingleton","heads","headAddPayload","_reHead","downloadLinkOutputBinding","datatableOutputBinding","_data","colnames","makeArray","header","footer","options","searching","evalOptions","searchCI","caseInsensitive","oTable","DataTable","processing","serverSide","order","orderClasses","pageLength","ajax","escape","unbind","keyup","searchDelay","draw","searchInputs","settings","aoColumns","bSearchable","eq","column","parents","InputBinding","getState","dispose","textInputBinding","setValue","label","textareaInputBinding","passwordInputBinding","numberInputBinding","numberVal","step","Number","checkboxInputBinding","checked","sliderInputBinding","fn","ionRangeSlider","dataType","convert","_numValues","from","to","timeFormatter","timeFormat","strftime","utc","prettify","num","timezone","startLabel","stopLabel","loop","animInterval","timer","canStepNext","resetToStart","setInterval","stepNext","sliderCanStep","sliderReset","sliderStep","dateInputBinding","bsDatepicker","_newDate","$input","startDate","endDate","Infinity","startview","startViewMode","valueString","language","weekstart","weekStart","format","_formatToString","_setMin","_setMax","_dateAsUTC","separators","_UTCDateAsLocal","curValue","getTimezoneOffset","dateRangeInputBinding","$inputs","end","$startinput","$endinput","startView","selectInputBinding","selectize","_selectize","destroy","replaceWith","clearOptions","thiz","loaded","load","query","field","searchField","valueField","conju","searchConjunction","maxop","maxOptions","success","labelField","onItemRemove","selected","onDropdownClose","$dropdown","control","radioInputBinding","prop","$objs","_getLabel","trim","_setLabel","checkboxGroupInputBinding","actionButtonInputBinding","icon","icon_html","bootstrapTabInputBinding","anchor","_getTabName","anchors","tab","fileEl","beginUpload","iframeId","iframe","iframeDestroy","attachEvent","onload","form","insertAfter","onFailure","$setError","$setActive","$setVisible","onProgress","totalBytes","progressBytes","fileInfo","response","jobId","uploadUrl","cache","xhr","xhrVal","ajaxSettings","upload","onprogress","lengthComputable","processData","jqXHR","textStatus","errorThrown","responseText","$bar","round","toggleClass","active","ctrlKey","metaKey","shiftKey","altKey"],"mappings":";;oOAGA,WCAA,QAASA,YAAWC,GAClB,MAAOA,GAAIC,QAAW,KAAG,SACdA,QAAW,KAAG,QACdA,QAAW,KAAG,QACdA,QAAW,KAAG,UACdA,QAAW,KAAG,UACdA,QAAY,MAAK,UAG9B,QAASC,YACP,MAAOC,MAAKC,MAAM,WAA+B,YAAhBD,KAAKE,UAAyBC,SAAS,IAG1E,QAASC,WAAUP,GACjB,GAAKA,GAAQA,EAAIQ,YAGjB,OAAOR,EAAIQ,eACT,IAAK,OACH,OAAO,CACT,KAAK,QACH,OAAO,CACT,SACE,QAMN,QAASC,UAASC,EAAIC,GACpB,GAAIC,EACJ,IAAIF,EAAGG,aACLD,EAAIF,EAAGG,aAAaF,OACjB,IAAIG,OAAOC,iBAAkB,CAIhC,GAAIC,GAAQC,SAASC,YAAYH,iBAAiBL,EAAI,KAClDM,KACFJ,EAAII,EAAMG,iBAAiBR,IAE/B,MAAOC,GAIT,QAASQ,UAASC,EAAGC,GAEnB,IADA,GAAItB,GAAMqB,EAAEf,WACLN,EAAIuB,OAASD,GAClBtB,EAAM,IAAMA,CACd,OAAOA,GAKT,QAASwB,WAAUC,GACjB,GAAIC,GAAO,GAAIC,MAAKF,EAGpB,OAFIG,OAAMF,KACRA,EAAO,GAAIC,MAAKF,EAAWxB,QAAW,KA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EAAErC,GAAIwP,GAAI,0BAA0BzH,cAEtCqE,YAAa,SAASpM,GACpBqC,EAAErC,GAAIojB,IAAM,wBAGhBjY,cAAc2W,SAASrZ,iBAAkB,0BC2NzCpG,EAAE,WAGA4C,WAAWmE,UAAW,K0BvexB/G,EAAE9B,UAAUiP,GAAI,UAAU,SAAStN,GACjC,GAAgB,MAAZA,EAAEsoB,QAAmBtoB,EAAEw6B,SAAYx6B,EAAEy6B,WAAaz6B,EAAE06B,WAAY16B,EAAE26B,OAAtE,CAEA,GAAIze,GAAM,cAAgBhe,OAAO0yB,OAAO7pB,QAAQC,SAASsS,OAAO+C,UAC9D,MAAQne,OAAO0yB,OAAO7pB,QAAQC,SAASsS,OAAO8C,UAChDle,QAAO2c,KAAKqB,GACZlc,EAAEyM","file":"shiny.min.js","sourcesContent":["//---------------------------------------------------------------------\n// Source file: ../srcjs/_start.js\n\n(function() {\n var $ = jQuery;\n\n var exports = window.Shiny = window.Shiny || {};\n\n var origPushState = window.history.pushState;\n window.history.pushState = function() {\n var result = origPushState.apply(this, arguments);\n $(document).trigger(\"pushstate\");\n return result;\n };\n\n $(document).on('submit', 'form:not([action])', function(e) {\n e.preventDefault();\n });\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/utils.js\n\nfunction escapeHTML(str) {\n return str.replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\")\n .replace(/\\//g,\"/\");\n}\n\nfunction randomId() {\n return Math.floor(0x100000000 + (Math.random() * 0xF00000000)).toString(16);\n}\n\nfunction strToBool(str) {\n if (!str || !str.toLowerCase)\n return undefined;\n\n switch(str.toLowerCase()) {\n case 'true':\n return true;\n case 'false':\n return false;\n default:\n return undefined;\n }\n}\n\n// A wrapper for getComputedStyle that is compatible with older browsers.\n// This is significantly faster than jQuery's .css() function.\nfunction getStyle(el, styleProp) {\n var x;\n if (el.currentStyle)\n x = el.currentStyle[styleProp];\n else if (window.getComputedStyle) {\n // getComputedStyle can return null when we're inside a hidden iframe on\n // Firefox; don't attempt to retrieve style props in this case.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=548397\n var style = document.defaultView.getComputedStyle(el, null);\n if (style)\n x = style.getPropertyValue(styleProp);\n }\n return x;\n}\n\n// Convert a number to a string with leading zeros\nfunction padZeros(n, digits) {\n var str = n.toString();\n while (str.length < digits)\n str = \"0\" + str;\n return str;\n}\n\n// Take a string with format \"YYYY-MM-DD\" and return a Date object.\n// IE8 and QTWebKit don't support YYYY-MM-DD, but they support YYYY/MM/DD\nfunction parseDate(dateString) {\n var date = new Date(dateString);\n if (isNaN(date))\n date = new Date(dateString.replace(/-/g, \"/\"));\n return date;\n}\n\n// Given a Date object, return a string in yyyy-mm-dd format, using the\n// UTC date. This may be a day off from the date in the local time zone.\nfunction formatDateUTC(date) {\n if (date instanceof Date) {\n return date.getUTCFullYear() + '-' +\n padZeros(date.getUTCMonth()+1, 2) + '-' +\n padZeros(date.getUTCDate(), 2);\n\n } else {\n return null;\n }\n}\n\n\n// Given an element and a function(width, height), returns a function(). When\n// the output function is called, it calls the input function with the offset\n// width and height of the input element--but only if the size of the element\n// is non-zero and the size is different than the last time the output\n// function was called.\n//\n// Basically we are trying to filter out extraneous calls to func, so that\n// when the window size changes or whatever, we don't run resize logic for\n// elements that haven't actually changed size or aren't visible anyway.\nfunction makeResizeFilter(el, func) {\n var lastSize = {};\n return function() {\n var size = { w: el.offsetWidth, h: el.offsetHeight };\n if (size.w === 0 && size.h === 0)\n return;\n if (size.w === lastSize.w && size.h === lastSize.h)\n return;\n lastSize = size;\n func(size.w, size.h);\n };\n}\n\nvar _BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder ||\n window.MozBlobBuilder || window.MSBlobBuilder;\n\nfunction makeBlob(parts) {\n\n // Browser compatibility is a mess right now. The code as written works in\n // a variety of modern browsers, but sadly gives a deprecation warning\n // message on the console in current versions (as of this writing) of\n // Chrome.\n\n // Safari 6.0 (8536.25) on Mac OS X 10.8.1:\n // Has Blob constructor but it doesn't work with ArrayBufferView args\n\n // Google Chrome 21.0.1180.81 on Xubuntu 12.04:\n // Has Blob constructor, accepts ArrayBufferView args, accepts ArrayBuffer\n // but with a deprecation warning message\n\n // Firefox 15.0 on Xubuntu 12.04:\n // Has Blob constructor, accepts both ArrayBuffer and ArrayBufferView args\n\n // Chromium 18.0.1025.168 (Developer Build 134367 Linux) on Xubuntu 12.04:\n // No Blob constructor. Has WebKitBlobBuilder.\n\n try {\n return new Blob(parts);\n }\n catch (e) {\n var blobBuilder = new _BlobBuilder();\n $.each(parts, function(i, part) {\n blobBuilder.append(part);\n });\n return blobBuilder.getBlob();\n }\n}\n\nfunction pixelRatio() {\n if (window.devicePixelRatio) {\n return window.devicePixelRatio;\n } else {\n return 1;\n }\n}\n\n// Takes a string expression and returns a function that takes an argument.\n//\n// When the function is executed, it will evaluate that expression using\n// \"with\" on the argument value, and return the result.\nfunction scopeExprToFunc(expr) {\n /*jshint evil: true */\n var func = new Function(\"with (this) {return (\" + expr + \");}\");\n return function(scope) {\n return func.call(scope);\n };\n}\n\nfunction asArray(value) {\n if (value === null || value === undefined)\n return [];\n if ($.isArray(value))\n return value;\n return [value];\n}\n\n// We need a stable sorting algorithm for ordering\n// bindings by priority and insertion order.\nfunction mergeSort(list, sortfunc) {\n function merge(sortfunc, a, b) {\n var ia = 0;\n var ib = 0;\n var sorted = [];\n while (ia < a.length && ib < b.length) {\n if (sortfunc(a[ia], b[ib]) <= 0) {\n sorted.push(a[ia++]);\n }\n else {\n sorted.push(b[ib++]);\n }\n }\n while (ia < a.length)\n sorted.push(a[ia++]);\n while (ib < b.length)\n sorted.push(b[ib++]);\n return sorted;\n }\n\n // Don't mutate list argument\n list = list.slice(0);\n\n for (var chunkSize = 1; chunkSize < list.length; chunkSize *= 2) {\n for (var i = 0; i < list.length; i += chunkSize * 2) {\n var listA = list.slice(i, i + chunkSize);\n var listB = list.slice(i + chunkSize, i + chunkSize * 2);\n var merged = merge(sortfunc, listA, listB);\n var args = [i, merged.length];\n Array.prototype.push.apply(args, merged);\n Array.prototype.splice.apply(list, args);\n }\n }\n\n return list;\n}\n\n// Escape jQuery selector metacharacters: !\"#$%&'()*+,./:;<=>?@[\\]^`{|}~\nvar $escape = exports.$escape = function(val) {\n return val.replace(/([!\"#$%&'()*+,.\\/:;<=>?@\\[\\\\\\]^`{|}~])/g, '\\\\$1');\n};\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_rate.js\n\nvar Invoker = function(target, func) {\n this.target = target;\n this.func = func;\n};\n\n(function() {\n this.normalCall =\n this.immediateCall = function() {\n this.func.apply(this.target, arguments);\n };\n}).call(Invoker.prototype);\n\nvar Debouncer = function(target, func, delayMs) {\n this.target = target;\n this.func = func;\n this.delayMs = delayMs;\n\n this.timerId = null;\n this.args = null;\n};\n\n(function() {\n this.normalCall = function() {\n var self = this;\n\n this.$clearTimer();\n this.args = arguments;\n\n this.timerId = setTimeout(function() {\n // IE8 doesn't reliably clear timeout, so this additional\n // check is needed\n if (self.timerId === null)\n return;\n self.$clearTimer();\n self.$invoke();\n }, this.delayMs);\n };\n this.immediateCall = function() {\n this.$clearTimer();\n this.args = arguments;\n this.$invoke();\n };\n this.isPending = function() {\n return this.timerId !== null;\n };\n this.$clearTimer = function() {\n if (this.timerId !== null) {\n clearTimeout(this.timerId);\n this.timerId = null;\n }\n };\n this.$invoke = function() {\n this.func.apply(this.target, this.args);\n this.args = null;\n };\n}).call(Debouncer.prototype);\n\nvar Throttler = function(target, func, delayMs) {\n this.target = target;\n this.func = func;\n this.delayMs = delayMs;\n\n this.timerId = null;\n this.args = null;\n};\n\n(function() {\n this.normalCall = function() {\n var self = this;\n\n this.args = arguments;\n if (this.timerId === null) {\n this.$invoke();\n this.timerId = setTimeout(function() {\n // IE8 doesn't reliably clear timeout, so this additional\n // check is needed\n if (self.timerId === null)\n return;\n self.$clearTimer();\n if (self.args)\n self.normalCall.apply(self, self.args);\n }, this.delayMs);\n }\n };\n this.immediateCall = function() {\n this.$clearTimer();\n this.args = arguments;\n this.$invoke();\n };\n this.isPending = function() {\n return this.timerId !== null;\n };\n this.$clearTimer = function() {\n if (this.timerId !== null) {\n clearTimeout(this.timerId);\n this.timerId = null;\n }\n };\n this.$invoke = function() {\n this.func.apply(this.target, this.args);\n this.args = null;\n };\n}).call(Throttler.prototype);\n\n// Returns a debounced version of the given function.\n// Debouncing means that when the function is invoked,\n// there is a delay of `threshold` milliseconds before\n// it is actually executed, and if the function is\n// invoked again before that threshold has elapsed then\n// the clock starts over.\n//\n// For example, if a function is debounced with a\n// threshold of 1000ms, then calling it 17 times at\n// 900ms intervals will result in a single execution\n// of the underlying function, 1000ms after the 17th\n// call.\nfunction debounce(threshold, func) {\n var timerId = null;\n var self, args;\n return function() {\n self = this;\n args = arguments;\n if (timerId !== null) {\n clearTimeout(timerId);\n timerId = null;\n }\n timerId = setTimeout(function() {\n // IE8 doesn't reliably clear timeout, so this additional\n // check is needed\n if (timerId === null)\n return;\n timerId = null;\n func.apply(self, args);\n }, threshold);\n };\n}\n\n// Returns a throttled version of the given function.\n// Throttling means that the underlying function will\n// be executed no more than once every `threshold`\n// milliseconds.\n//\n// For example, if a function is throttled with a\n// threshold of 1000ms, then calling it 17 times at\n// 900ms intervals will result in something like 15\n// or 16 executions of the underlying function.\n// eslint-disable-next-line no-unused-vars\nfunction throttle(threshold, func) {\n var executionPending = false;\n var timerId = null;\n var self, args;\n\n function throttled() {\n self = null;\n args = null;\n if (timerId === null) {\n // Haven't seen a call recently. Execute now and\n // start a timer to buffer any subsequent calls.\n timerId = setTimeout(function() {\n // When time expires, clear the timer; and if\n // there has been a call in the meantime, repeat.\n timerId = null;\n if (executionPending) {\n executionPending = false;\n throttled.apply(self, args);\n }\n }, threshold);\n func.apply(this, arguments);\n }\n else {\n // Something executed recently. Don't do anything\n // except set up target/arguments to be called later\n executionPending = true;\n self = this;\n args = arguments;\n }\n }\n return throttled;\n}\n\n// Schedules data to be sent to shinyapp at the next setTimeout(0).\n// Batches multiple input calls into one websocket message.\nvar InputBatchSender = function(shinyapp) {\n this.shinyapp = shinyapp;\n this.timerId = null;\n this.pendingData = {};\n this.reentrant = false;\n this.lastChanceCallback = [];\n};\n(function() {\n this.setInput = function(name, value) {\n var self = this;\n\n this.pendingData[name] = value;\n if (!this.timerId && !this.reentrant) {\n this.timerId = setTimeout(function() {\n self.reentrant = true;\n try {\n $.each(self.lastChanceCallback, function(i, callback) {\n callback();\n });\n self.timerId = null;\n var currentData = self.pendingData;\n self.pendingData = {};\n self.shinyapp.sendInput(currentData);\n } finally {\n self.reentrant = false;\n }\n }, 0);\n }\n };\n}).call(InputBatchSender.prototype);\n\nvar InputNoResendDecorator = function(target, initialValues) {\n this.target = target;\n this.lastSentValues = initialValues || {};\n};\n(function() {\n this.setInput = function(name, value) {\n var jsonValue = JSON.stringify(value);\n if (this.lastSentValues[name] === jsonValue)\n return;\n this.lastSentValues[name] = jsonValue;\n this.target.setInput(name, value);\n };\n this.reset = function(values) {\n values = values || {};\n var strValues = {};\n $.each(values, function(key, value) {\n strValues[key] = JSON.stringify(value);\n });\n this.lastSentValues = strValues;\n };\n}).call(InputNoResendDecorator.prototype);\n\nvar InputDeferDecorator = function(target) {\n this.target = target;\n this.pendingInput = {};\n};\n(function() {\n this.setInput = function(name, value) {\n if (/^\\./.test(name))\n this.target.setInput(name, value);\n else\n this.pendingInput[name] = value;\n };\n this.submit = function() {\n for (var name in this.pendingInput) {\n if (this.pendingInput.hasOwnProperty(name))\n this.target.setInput(name, this.pendingInput[name]);\n }\n };\n}).call(InputDeferDecorator.prototype);\n\nvar InputEventDecorator = function(target) {\n this.target = target;\n};\n(function() {\n this.setInput = function(name, value, immediate) {\n var evt = jQuery.Event(\"shiny:inputchanged\");\n var name2 = name.split(':');\n evt.name = name2[0];\n evt.inputType = name2.length > 1 ? name2[1] : '';\n evt.value = value;\n $(document).trigger(evt);\n if (!evt.isDefaultPrevented()) {\n name = evt.name;\n if (evt.inputType !== '') name += ':' + evt.inputType;\n this.target.setInput(name, evt.value, immediate);\n }\n };\n}).call(InputEventDecorator.prototype);\n\nvar InputRateDecorator = function(target) {\n this.target = target;\n this.inputRatePolicies = {};\n};\n(function() {\n this.setInput = function(name, value, immediate) {\n this.$ensureInit(name);\n if (immediate)\n this.inputRatePolicies[name].immediateCall(name, value, immediate);\n else\n this.inputRatePolicies[name].normalCall(name, value, immediate);\n };\n this.setRatePolicy = function(name, mode, millis) {\n if (mode === 'direct') {\n this.inputRatePolicies[name] = new Invoker(this, this.$doSetInput);\n }\n else if (mode === 'debounce') {\n this.inputRatePolicies[name] = new Debouncer(this, this.$doSetInput, millis);\n }\n else if (mode === 'throttle') {\n this.inputRatePolicies[name] = new Throttler(this, this.$doSetInput, millis);\n }\n };\n this.$ensureInit = function(name) {\n if (!(name in this.inputRatePolicies))\n this.setRatePolicy(name, 'direct');\n };\n this.$doSetInput = function(name, value) {\n this.target.setInput(name, value);\n };\n}).call(InputRateDecorator.prototype);\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/output_binding_html.js\n\nvar htmlOutputBinding = new OutputBinding();\n$.extend(htmlOutputBinding, {\n find: function(scope) {\n return $(scope).find('.shiny-html-output');\n },\n onValueError: function(el, err) {\n exports.unbindAll(el);\n this.renderError(el, err);\n },\n renderValue: function(el, data) {\n exports.renderContent(el, data);\n }\n});\noutputBindings.register(htmlOutputBinding, 'shiny.htmlOutput');\n\nvar renderDependencies = exports.renderDependencies = function(dependencies) {\n if (dependencies) {\n $.each(dependencies, function(i, dep) {\n renderDependency(dep);\n });\n }\n};\n\n// Render HTML in a DOM element, add dependencies, and bind Shiny\n// inputs/outputs. `content` can be null, a string, or an object with\n// properties 'html' and 'deps'.\nexports.renderContent = function(el, content, where=\"replace\") {\n if (where === \"replace\") {\n exports.unbindAll(el);\n }\n\n exports.unbindAll(el);\n\n var html;\n var dependencies = [];\n if (content === null) {\n html = '';\n } else if (typeof(content) === 'string') {\n html = content;\n } else if (typeof(content) === 'object') {\n html = content.html;\n dependencies = content.deps || [];\n }\n\n exports.renderHtml(html, el, dependencies, where);\n\n var scope = el;\n if (where === \"replace\") {\n exports.initializeInputs(el);\n exports.bindAll(el);\n } else {\n var $parent = $(el).parent();\n if ($parent.length > 0) {\n scope = $parent;\n if (where === \"beforeBegin\" || where === \"afterEnd\") {\n var $grandparent = $parent.parent();\n if ($grandparent.length > 0) scope = $grandparent;\n }\n }\n exports.initializeInputs(scope);\n exports.bindAll(scope);\n }\n};\n\n// Render HTML in a DOM element, inserting singletons into head as needed\nexports.renderHtml = function(html, el, dependencies, where = 'replace') {\n renderDependencies(dependencies);\n return singletons.renderHtml(html, el, where);\n};\n\nvar htmlDependencies = {};\nfunction registerDependency(name, version) {\n htmlDependencies[name] = version;\n}\n\n// Client-side dependency resolution and rendering\nfunction renderDependency(dep) {\n if (htmlDependencies.hasOwnProperty(dep.name))\n return false;\n\n registerDependency(dep.name, dep.version);\n\n var href = dep.src.href;\n\n var $head = $(\"head\").first();\n\n if (dep.meta) {\n var metas = $.map(asArray(dep.meta), function(obj, idx) {\n // only one named pair is expected in obj as it's already been decomposed\n var name = Object.keys(obj)[0];\n return $(\"<meta>\").attr(\"name\", name).attr(\"content\", obj[name]);\n });\n $head.append(metas);\n }\n\n if (dep.stylesheet) {\n var stylesheets = $.map(asArray(dep.stylesheet), function(stylesheet) {\n return $(\"<link rel='stylesheet' type='text/css'>\")\n .attr(\"href\", href + \"/\" + encodeURI(stylesheet));\n });\n $head.append(stylesheets);\n }\n\n if (dep.script) {\n var scripts = $.map(asArray(dep.script), function(scriptName) {\n return $(\"<script>\").attr(\"src\", href + \"/\" + encodeURI(scriptName));\n });\n $head.append(scripts);\n }\n\n if (dep.attachment) {\n // dep.attachment might be a single string, an array, or an object.\n var attachments = dep.attachment;\n if (typeof(attachments) === \"string\")\n attachments = [attachments];\n if ($.isArray(attachments)) {\n // The contract for attachments is that arrays of attachments are\n // addressed using 1-based indexes. Convert this array to an object.\n var tmp = {};\n $.each(attachments, function(index, attachment) {\n tmp[(index + 1) + \"\"] = attachment;\n });\n attachments = tmp;\n }\n\n var attach = $.map(attachments, function(attachment, key) {\n return $(\"<link rel='attachment'>\")\n .attr(\"id\", dep.name + \"-\" + key + \"-attachment\")\n .attr(\"href\", href + \"/\" + encodeURI(attachment));\n });\n $head.append(attach);\n }\n\n if (dep.head) {\n var $newHead = $(\"<head></head>\");\n $newHead.html(dep.head);\n $head.append($newHead.children());\n }\n return true;\n}\n\nvar singletons = {\n knownSingletons: {},\n renderHtml: function(html, el, where) {\n var processed = this._processHtml(html);\n this._addToHead(processed.head);\n this.register(processed.singletons);\n if (where === \"replace\") {\n $(el).html(processed.html);\n } else {\n el.insertAdjacentHTML(where, processed.html);\n }\n return processed;\n },\n // Take an object where keys are names of singletons, and merges it into\n // knownSingletons\n register: function(s) {\n $.extend(this.knownSingletons, s);\n },\n // Takes a string or array of strings and adds them to knownSingletons\n registerNames: function(s) {\n if (typeof s === 'string') {\n this.knownSingletons[s] = true;\n } else if (s instanceof Array) {\n for (var i = 0; i < s.length; i++) {\n this.knownSingletons[s[i]] = true;\n }\n }\n },\n // Inserts new content into document head\n _addToHead: function(head) {\n if (head.length > 0) {\n var tempDiv = $(\"<div>\" + head + \"</div>\")[0];\n var $head = $('head');\n while (tempDiv.hasChildNodes()) {\n $head.append(tempDiv.firstChild);\n }\n }\n },\n // Reads HTML and returns an object with info about singletons\n _processHtml: function(val) {\n var self = this;\n var newSingletons = {};\n var newVal;\n\n var findNewPayload = function(match, p1, sig, payload) {\n if (self.knownSingletons[sig] || newSingletons[sig])\n return \"\";\n newSingletons[sig] = true;\n return payload;\n };\n while (true) {\n newVal = val.replace(self._reSingleton, findNewPayload);\n if (val.length === newVal.length)\n break;\n val = newVal;\n }\n\n var heads = [];\n var headAddPayload = function(match, payload) {\n heads.push(payload);\n return \"\";\n };\n while (true) {\n newVal = val.replace(self._reHead, headAddPayload);\n if (val.length === newVal.length)\n break;\n val = newVal;\n }\n\n return {\n html: val,\n head: heads.join(\"\\n\"),\n singletons: newSingletons\n };\n },\n _reSingleton: /<!--(SHINY.SINGLETON\\[([\\w]+)\\])-->([\\s\\S]*?)<!--\\/\\1-->/,\n _reHead: /<head(?:\\s[^>]*)?>([\\s\\S]*?)<\\/head>/\n};\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_slider.js\n\n// Necessary to get hidden sliders to send their updated values\nfunction forceIonSliderUpdate(slider) {\n if (slider.$cache && slider.$cache.input)\n slider.$cache.input.trigger('change');\n else\n console.log(\"Couldn't force ion slider to update\");\n}\n\nvar sliderInputBinding = {};\n$.extend(sliderInputBinding, textInputBinding, {\n find: function(scope) {\n // Check if ionRangeSlider plugin is loaded\n if (!$.fn.ionRangeSlider)\n return [];\n\n return $(scope).find('input.js-range-slider');\n },\n getType: function(el) {\n var dataType = $(el).data('data-type');\n if (dataType === 'date')\n return 'shiny.date';\n else if (dataType === 'datetime')\n return 'shiny.datetime';\n else\n return false;\n },\n getValue: function(el) {\n var $el = $(el);\n var result = $(el).data('ionRangeSlider').result;\n\n // Function for converting numeric value from slider to appropriate type.\n var convert;\n var dataType = $el.data('data-type');\n if (dataType === 'date') {\n convert = function(val) {\n return formatDateUTC(new Date(+val));\n };\n } else if (dataType === 'datetime') {\n convert = function(val) {\n // Convert ms to s\n return +val / 1000;\n };\n } else {\n convert = function(val) { return +val; };\n }\n\n if (this._numValues(el) === 2) {\n return [convert(result.from), convert(result.to)];\n }\n else {\n return convert(result.from);\n }\n\n },\n setValue: function(el, value) {\n var $el = $(el);\n var slider = $el.data('ionRangeSlider');\n\n $el.data('immediate', true);\n try {\n if (this._numValues(el) === 2 && value instanceof Array) {\n slider.update({ from: value[0], to: value[1] });\n } else {\n slider.update({ from: value });\n }\n\n forceIonSliderUpdate(slider);\n } finally {\n $el.data('immediate', false);\n }\n },\n subscribe: function(el, callback) {\n $(el).on('change.sliderInputBinding', function(event) {\n callback(!$(el).data('immediate') && !$(el).data('animating'));\n });\n },\n unsubscribe: function(el) {\n $(el).off('.sliderInputBinding');\n },\n receiveMessage: function(el, data) {\n var $el = $(el);\n var slider = $el.data('ionRangeSlider');\n var msg = {};\n\n if (data.hasOwnProperty('value')) {\n if (this._numValues(el) === 2 && data.value instanceof Array) {\n msg.from = data.value[0];\n msg.to = data.value[1];\n } else {\n msg.from = data.value;\n }\n }\n if (data.hasOwnProperty('min')) msg.min = data.min;\n if (data.hasOwnProperty('max')) msg.max = data.max;\n if (data.hasOwnProperty('step')) msg.step = data.step;\n\n if (data.hasOwnProperty('label'))\n $el.parent().find('label[for=\"' + $escape(el.id) + '\"]').text(data.label);\n\n $el.data('immediate', true);\n try {\n slider.update(msg);\n forceIonSliderUpdate(slider);\n } finally {\n $el.data('immediate', false);\n }\n },\n getRatePolicy: function() {\n return {\n policy: 'debounce',\n delay: 250\n };\n },\n getState: function(el) {\n },\n initialize: function(el) {\n var opts = {};\n var $el = $(el);\n var dataType = $el.data('data-type');\n var timeFormat = $el.data('time-format');\n var timeFormatter;\n\n // Set up formatting functions\n if (dataType === 'date') {\n timeFormatter = strftime.utc();\n opts.prettify = function(num) {\n return timeFormatter(timeFormat, new Date(num));\n };\n\n } else if (dataType === 'datetime') {\n var timezone = $el.data('timezone');\n if (timezone)\n timeFormatter = strftime.timezone(timezone);\n else\n timeFormatter = strftime;\n\n opts.prettify = function(num) {\n return timeFormatter(timeFormat, new Date(num));\n };\n }\n\n $el.ionRangeSlider(opts);\n },\n\n // Number of values; 1 for single slider, 2 for range slider\n _numValues: function(el) {\n if ($(el).data('ionRangeSlider').options.type === 'double')\n return 2;\n else\n return 1;\n }\n});\ninputBindings.register(sliderInputBinding, 'shiny.sliderInput');\n\n\n\n$(document).on('click', '.slider-animate-button', function(evt) {\n evt.preventDefault();\n var self = $(this);\n var target = $('#' + $escape(self.attr('data-target-id')));\n var startLabel = 'Play';\n var stopLabel = 'Pause';\n var loop = self.attr('data-loop') !== undefined &&\n !/^\\s*false\\s*$/i.test(self.attr('data-loop'));\n var animInterval = self.attr('data-interval');\n if (isNaN(animInterval))\n animInterval = 1500;\n else\n animInterval = +animInterval;\n\n if (!target.data('animTimer')) {\n var slider;\n var timer;\n\n // Separate code paths:\n // Backward compatible code for old-style jsliders (Shiny <= 0.10.2.2),\n // and new-style ionsliders.\n if (target.hasClass('jslider')) {\n slider = target.slider();\n\n // If we're currently at the end, restart\n if (!slider.canStepNext())\n slider.resetToStart();\n\n timer = setInterval(function() {\n if (loop && !slider.canStepNext()) {\n slider.resetToStart();\n }\n else {\n slider.stepNext();\n if (!loop && !slider.canStepNext()) {\n self.click(); // stop the animation\n }\n }\n }, animInterval);\n\n } else {\n slider = target.data('ionRangeSlider');\n // Single sliders have slider.options.type == \"single\", and only the\n // `from` value is used. Double sliders have type == \"double\", and also\n // use the `to` value for the right handle.\n var sliderCanStep = function() {\n if (slider.options.type === \"double\")\n return slider.result.to < slider.result.max;\n else\n return slider.result.from < slider.result.max;\n };\n var sliderReset = function() {\n var val = { from: slider.result.min };\n // Preserve the current spacing for double sliders\n if (slider.options.type === \"double\")\n val.to = val.from + (slider.result.to - slider.result.from);\n\n slider.update(val);\n forceIonSliderUpdate(slider);\n };\n var sliderStep = function() {\n // Don't overshoot the end\n var val = {\n from: Math.min(slider.result.max, slider.result.from + slider.options.step)\n };\n if (slider.options.type === \"double\")\n val.to = Math.min(slider.result.max, slider.result.to + slider.options.step);\n\n slider.update(val);\n forceIonSliderUpdate(slider);\n };\n\n // If we're currently at the end, restart\n if (!sliderCanStep())\n sliderReset();\n\n timer = setInterval(function() {\n if (loop && !sliderCanStep()) {\n sliderReset();\n }\n else {\n sliderStep();\n if (!loop && !sliderCanStep()) {\n self.click(); // stop the animation\n }\n }\n }, animInterval);\n }\n\n target.data('animTimer', timer);\n self.attr('title', stopLabel);\n self.addClass('playing');\n target.data('animating', true);\n }\n else {\n clearTimeout(target.data('animTimer'));\n target.removeData('animTimer');\n self.attr('title', startLabel);\n self.removeClass('playing');\n target.removeData('animating');\n }\n});\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_fileinput.js\n\nvar IE8FileUploader = function(shinyapp, id, fileEl) {\n this.shinyapp = shinyapp;\n this.id = id;\n this.fileEl = fileEl;\n this.beginUpload();\n};\n(function() {\n this.beginUpload = function() {\n var self = this;\n // Create invisible frame\n var iframeId = 'shinyupload_iframe_' + this.id;\n this.iframe = document.createElement('iframe');\n this.iframe.id = iframeId;\n this.iframe.name = iframeId;\n this.iframe.setAttribute('style', 'position: fixed; top: 0; left: 0; width: 0; height: 0; border: none');\n $('body').append(this.iframe);\n var iframeDestroy = function() {\n // Forces Shiny to flushReact, flush outputs, etc. Without this we get\n // invalidated reactives, but observers don't actually execute.\n self.shinyapp.makeRequest('uploadieFinish', [], function(){}, function(){});\n $(self.iframe).remove();\n };\n if (this.iframe.attachEvent) {\n this.iframe.attachEvent('onload', iframeDestroy);\n } else {\n this.iframe.onload = iframeDestroy;\n }\n\n this.form = document.createElement('form');\n this.form.method = 'POST';\n this.form.setAttribute('enctype', 'multipart/form-data');\n this.form.action = \"session/\" + encodeURI(this.shinyapp.config.sessionId) +\n \"/uploadie/\" + encodeURI(this.id);\n this.form.id = 'shinyupload_form_' + this.id;\n this.form.target = iframeId;\n $(this.form).insertAfter(this.fileEl).append(this.fileEl);\n this.form.submit();\n };\n}).call(IE8FileUploader.prototype);\n\nvar FileUploader = function(shinyapp, id, files) {\n this.shinyapp = shinyapp;\n this.id = id;\n FileProcessor.call(this, files);\n};\n$.extend(FileUploader.prototype, FileProcessor.prototype);\n(function() {\n this.makeRequest = function(method, args, onSuccess, onFailure, blobs) {\n this.shinyapp.makeRequest(method, args, onSuccess, onFailure, blobs);\n };\n this.onBegin = function(files, cont) {\n var self = this;\n\n // Reset progress bar\n this.$setError(null);\n this.$setActive(true);\n this.$setVisible(true);\n this.onProgress(null, 0);\n\n this.totalBytes = 0;\n this.progressBytes = 0;\n $.each(files, function(i, file) {\n self.totalBytes += file.size;\n });\n\n var fileInfo = $.map(files, function(file, i) {\n return {\n name: file.name,\n size: file.size,\n type: file.type\n };\n });\n\n this.makeRequest(\n 'uploadInit', [fileInfo],\n function(response) {\n self.jobId = response.jobId;\n self.uploadUrl = response.uploadUrl;\n cont();\n },\n function(error) {\n self.onError(error);\n });\n };\n this.onFile = function(file, cont) {\n var self = this;\n this.onProgress(file, 0);\n\n $.ajax(this.uploadUrl, {\n type: 'POST',\n cache: false,\n xhr: function() {\n var xhrVal = $.ajaxSettings.xhr();\n if (xhrVal.upload) {\n xhrVal.upload.onprogress = function(e) {\n if (e.lengthComputable) {\n self.onProgress(\n file,\n (self.progressBytes + e.loaded) / self.totalBytes);\n }\n };\n }\n return xhrVal;\n },\n data: file,\n processData: false,\n success: function() {\n self.progressBytes += file.size;\n cont();\n },\n error: function(jqXHR, textStatus, errorThrown) {\n self.onError(jqXHR.responseText || textStatus);\n }\n });\n };\n this.onComplete = function() {\n var self = this;\n this.makeRequest(\n 'uploadEnd', [this.jobId, this.id],\n function(response) {\n self.$setActive(false);\n self.onProgress(null, 1);\n self.$bar().text('Upload complete');\n },\n function(error) {\n self.onError(error);\n });\n this.$bar().text('Finishing upload');\n\n // Trigger event when all files are finished uploading.\n var evt = jQuery.Event(\"shiny:fileuploaded\");\n evt.name = this.id;\n evt.files = $.map(this.files, function(file, i) {\n return {\n name: file.name,\n size: file.size,\n type: file.type\n };\n });\n $(document).trigger(evt);\n };\n this.onError = function(message) {\n this.$setError(message || '');\n this.$setActive(false);\n };\n this.onAbort = function() {\n this.$setVisible(false);\n };\n this.onProgress = function(file, completed) {\n this.$bar().width(Math.round(completed*100) + '%');\n this.$bar().text(file ? file.name : '');\n };\n this.$container = function() {\n return $('#' + $escape(this.id) + '_progress.shiny-file-input-progress');\n };\n this.$bar = function() {\n return $('#' + $escape(this.id) + '_progress.shiny-file-input-progress .progress-bar');\n };\n this.$setVisible = function(visible) {\n this.$container().css('visibility', visible ? 'visible' : 'hidden');\n };\n this.$setError = function(error) {\n this.$bar().toggleClass('bar-danger', (error !== null));\n if (error !== null) {\n this.onProgress(null, 1);\n this.$bar().text(error);\n }\n };\n this.$setActive = function(active) {\n this.$container().toggleClass('active', !!active);\n };\n}).call(FileUploader.prototype);\n\n\nfunction uploadFiles(evt) {\n // If previously selected files are uploading, abort that.\n var $el = $(evt.target);\n var uploader = $el.data('currentUploader');\n if (uploader)\n uploader.abort();\n\n var files = evt.target.files;\n // IE8 here does not necessarily mean literally IE8; it indicates if the web\n // browser supports the FileList object (IE8/9 do not support it)\n var IE8 = typeof(files) === 'undefined';\n var id = fileInputBinding.getId(evt.target);\n\n if (!IE8 && files.length === 0)\n return;\n\n // Clear data-restore attribute if present.\n $el.removeAttr('data-restore');\n\n // Set the label in the text box\n var $fileText = $el.closest('div.input-group').find('input[type=text]');\n if (IE8) {\n // If we're using IE8/9, just use this placeholder\n $fileText.val(\"[Uploaded file]\");\n } else if (files.length === 1) {\n $fileText.val(files[0].name);\n } else {\n $fileText.val(files.length + \" files\");\n }\n\n // Start the new upload and put the uploader in 'currentUploader'.\n if (IE8) {\n /*jshint nonew:false */\n new IE8FileUploader(exports.shinyapp, id, evt.target);\n } else {\n $el.data('currentUploader', new FileUploader(exports.shinyapp, id, files));\n }\n}\n\nvar fileInputBinding = new InputBinding();\n$.extend(fileInputBinding, {\n find: function(scope) {\n return $(scope).find('input[type=\"file\"]');\n },\n getId: function(el) {\n return InputBinding.prototype.getId.call(this, el) || el.name;\n },\n getValue: function(el) {\n // This returns a non-undefined value only when there's a 'data-restore'\n // attribute, which is set only when restoring Shiny state. If a file is\n // uploaded through the browser, 'data-restore' gets cleared.\n var data = $(el).attr('data-restore');\n if (data) {\n data = JSON.parse(data);\n\n // Set the label in the text box\n var $fileText = $(el).closest('div.input-group').find('input[type=text]');\n if (data.name.length === 1) {\n $fileText.val(data.name[0]);\n } else {\n $fileText.val(data.name.length + \" files\");\n }\n\n // Manually set up progress bar. A bit inelegant because it duplicates\n // code from FileUploader, but duplication is less bad than alternatives.\n var $progress = $(el).closest('div.form-group').find('.progress');\n var $bar = $progress.find('.progress-bar');\n $progress.removeClass('active');\n $bar.width('100%');\n $bar.css('visibility', 'visible');\n\n return data;\n\n } else {\n return null;\n }\n },\n setValue: function(el, value) {\n // Not implemented\n },\n getType: function(el) {\n // This will be used only when restoring a file from a saved state.\n return 'shiny.file';\n },\n subscribe: function(el, callback) {\n $(el).on('change.fileInputBinding', uploadFiles);\n },\n unsubscribe: function(el) {\n $(el).off('.fileInputBinding');\n }\n});\ninputBindings.register(fileInputBinding, 'shiny.fileInputBinding');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/init_shiny.js\n\nfunction initShiny() {\n\n var shinyapp = exports.shinyapp = new ShinyApp();\n\n function bindOutputs(scope = document) {\n scope = $(scope);\n\n var bindings = outputBindings.getBindings();\n\n for (var i = 0; i < bindings.length; i++) {\n var binding = bindings[i].binding;\n var matches = binding.find(scope) || [];\n for (var j = 0; j < matches.length; j++) {\n var el = matches[j];\n var id = binding.getId(el);\n\n // Check if ID is falsy\n if (!id)\n continue;\n\n // In some uncommon cases, elements that are later in the\n // matches array can be removed from the document by earlier\n // iterations. See https://github.com/rstudio/shiny/issues/1399\n if (!$.contains(document, el))\n continue;\n\n var $el = $(el);\n if ($el.hasClass('shiny-bound-output')) {\n // Already bound; can happen with nested uiOutput (bindAll\n // gets called on two ancestors)\n continue;\n }\n\n var bindingAdapter = new OutputBindingAdapter(el, binding);\n shinyapp.bindOutput(id, bindingAdapter);\n $el.data('shiny-output-binding', bindingAdapter);\n $el.addClass('shiny-bound-output');\n $el.trigger({\n type: 'shiny:bound',\n binding: binding,\n bindingType: 'output'\n });\n }\n }\n\n // Send later in case DOM layout isn't final yet.\n setTimeout(sendImageSize, 0);\n setTimeout(sendOutputHiddenState, 0);\n }\n\n function unbindOutputs(scope = document, includeSelf = false) {\n var outputs = $(scope).find('.shiny-bound-output');\n\n if (includeSelf && $(scope).hasClass('shiny-bound-output')) {\n outputs.push(scope);\n }\n\n for (var i = 0; i < outputs.length; i++) {\n var $el = $(outputs[i]);\n var bindingAdapter = $el.data('shiny-output-binding');\n if (!bindingAdapter)\n continue;\n var id = bindingAdapter.binding.getId(outputs[i]);\n shinyapp.unbindOutput(id, bindingAdapter);\n $el.removeClass('shiny-bound-output');\n $el.removeData('shiny-output-binding');\n $el.trigger({\n type: 'shiny:unbound',\n binding: bindingAdapter.binding,\n bindingType: 'output'\n });\n }\n\n // Send later in case DOM layout isn't final yet.\n setTimeout(sendImageSize, 0);\n setTimeout(sendOutputHiddenState, 0);\n }\n\n var inputBatchSender = new InputBatchSender(shinyapp);\n var inputsNoResend = new InputNoResendDecorator(inputBatchSender);\n var inputsEvent = new InputEventDecorator(inputsNoResend);\n var inputsRate = new InputRateDecorator(inputsEvent);\n var inputsDefer = new InputDeferDecorator(inputsEvent);\n\n // By default, use rate decorator\n var inputs = inputsRate;\n $('input[type=\"submit\"], button[type=\"submit\"]').each(function() {\n // If there is a submit button on the page, use defer decorator\n inputs = inputsDefer;\n $(this).click(function(event) {\n event.preventDefault();\n inputsDefer.submit();\n });\n });\n\n exports.onInputChange = function(name, value) {\n inputs.setInput(name, value);\n };\n\n var boundInputs = {};\n\n function valueChangeCallback(binding, el, allowDeferred) {\n var id = binding.getId(el);\n if (id) {\n var value = binding.getValue(el);\n var type = binding.getType(el);\n if (type)\n id = id + \":\" + type;\n inputs.setInput(id, value, !allowDeferred);\n }\n }\n\n function bindInputs(scope = document) {\n var bindings = inputBindings.getBindings();\n\n var currentValues = {};\n\n for (var i = 0; i < bindings.length; i++) {\n var binding = bindings[i].binding;\n var matches = binding.find(scope) || [];\n for (var j = 0; j < matches.length; j++) {\n var el = matches[j];\n var id = binding.getId(el);\n\n // Check if ID is falsy, or if already bound\n if (!id || boundInputs[id])\n continue;\n\n var type = binding.getType(el);\n var effectiveId = type ? id + \":\" + type : id;\n currentValues[effectiveId] = binding.getValue(el);\n\n /*jshint loopfunc:true*/\n var thisCallback = (function() {\n var thisBinding = binding;\n var thisEl = el;\n return function(allowDeferred) {\n valueChangeCallback(thisBinding, thisEl, allowDeferred);\n };\n })();\n\n binding.subscribe(el, thisCallback);\n $(el).data('shiny-input-binding', binding);\n $(el).addClass('shiny-bound-input');\n var ratePolicy = binding.getRatePolicy(el);\n if (ratePolicy !== null) {\n inputsRate.setRatePolicy(\n effectiveId,\n ratePolicy.policy,\n ratePolicy.delay);\n }\n\n boundInputs[id] = {\n binding: binding,\n node: el\n };\n\n $(el).trigger({\n type: 'shiny:bound',\n binding: binding,\n bindingType: 'input'\n });\n\n if (shinyapp.isConnected()) {\n valueChangeCallback(binding, el, false);\n }\n }\n }\n\n return currentValues;\n }\n\n function unbindInputs(scope = document, includeSelf = false) {\n var inputs = $(scope).find('.shiny-bound-input');\n\n if (includeSelf && $(scope).hasClass('shiny-bound-input')) {\n inputs.push(scope);\n }\n\n for (var i = 0; i < inputs.length; i++) {\n var el = inputs[i];\n var binding = $(el).data('shiny-input-binding');\n if (!binding)\n continue;\n var id = binding.getId(el);\n $(el).removeClass('shiny-bound-input');\n delete boundInputs[id];\n binding.unsubscribe(el);\n $(el).trigger({\n type: 'shiny:unbound',\n binding: binding,\n bindingType: 'input'\n });\n }\n }\n\n function _bindAll(scope) {\n bindOutputs(scope);\n return bindInputs(scope);\n }\n function unbindAll(scope, includeSelf = false) {\n unbindInputs(scope, includeSelf);\n unbindOutputs(scope, includeSelf);\n }\n exports.bindAll = function(scope) {\n // _bindAll alone returns initial values, it doesn't send them to the\n // server. export.bindAll needs to send the values to the server, so we\n // wrap _bindAll in a closure that does that.\n var currentValues = _bindAll(scope);\n $.each(currentValues, function(name, value) {\n inputs.setInput(name, value);\n });\n\n // Not sure if the iframe stuff is an intrinsic part of bindAll, but bindAll\n // is a convenient place to hang it. bindAll will be called anytime new HTML\n // appears that might contain inputs/outputs; it's reasonable to assume that\n // any such HTML may contain iframes as well.\n initDeferredIframes();\n };\n exports.unbindAll = unbindAll;\n\n // Calls .initialize() for all of the input objects in all input bindings,\n // in the given scope.\n function initializeInputs(scope = document) {\n var bindings = inputBindings.getBindings();\n\n // Iterate over all bindings\n for (var i = 0; i < bindings.length; i++) {\n var binding = bindings[i].binding;\n var inputObjects = binding.find(scope) || [];\n\n // Iterate over all input objects for this binding\n for (var j = 0; j < inputObjects.length; j++) {\n if (!inputObjects[j]._shiny_initialized) {\n inputObjects[j]._shiny_initialized = true;\n binding.initialize(inputObjects[j]);\n }\n }\n }\n }\n exports.initializeInputs = initializeInputs;\n\n function getIdFromEl(el) {\n var $el = $(el);\n var bindingAdapter = $el.data(\"shiny-output-binding\");\n if (!bindingAdapter)\n return null;\n else\n return bindingAdapter.getId();\n }\n\n\n // Initialize all input objects in the document, before binding\n initializeInputs(document);\n\n var initialValues = _bindAll(document);\n\n\n // The server needs to know the size of each image and plot output element,\n // in case it is auto-sizing\n $('.shiny-image-output, .shiny-plot-output').each(function() {\n var id = getIdFromEl(this);\n if (this.offsetWidth !== 0 || this.offsetHeight !== 0) {\n initialValues['.clientdata_output_' + id + '_width'] = this.offsetWidth;\n initialValues['.clientdata_output_' + id + '_height'] = this.offsetHeight;\n }\n });\n function doSendImageSize() {\n $('.shiny-image-output, .shiny-plot-output').each(function() {\n var id = getIdFromEl(this);\n if (this.offsetWidth !== 0 || this.offsetHeight !== 0) {\n inputs.setInput('.clientdata_output_' + id + '_width', this.offsetWidth);\n inputs.setInput('.clientdata_output_' + id + '_height', this.offsetHeight);\n }\n });\n $('.shiny-bound-output').each(function() {\n var $this = $(this), binding = $this.data('shiny-output-binding');\n $this.trigger({\n type: 'shiny:visualchange',\n visible: !isHidden(this),\n binding: binding\n });\n binding.onResize();\n });\n }\n var sendImageSizeDebouncer = new Debouncer(null, doSendImageSize, 0);\n function sendImageSize() {\n sendImageSizeDebouncer.normalCall();\n }\n // Make sure sendImageSize actually gets called before the inputBatchSender\n // sends data to the server.\n inputBatchSender.lastChanceCallback.push(function() {\n if (sendImageSizeDebouncer.isPending())\n sendImageSizeDebouncer.immediateCall();\n });\n\n // Return true if the object or one of its ancestors in the DOM tree has\n // style='display:none'; otherwise return false.\n function isHidden(obj) {\n // null means we've hit the top of the tree. If width or height is\n // non-zero, then we know that no ancestor has display:none.\n if (obj === null || obj.offsetWidth !== 0 || obj.offsetHeight !== 0) {\n return false;\n } else if (getStyle(obj, 'display') === 'none') {\n return true;\n } else {\n return(isHidden(obj.parentNode));\n }\n }\n var lastKnownVisibleOutputs = {};\n // Set initial state of outputs to hidden, if needed\n $('.shiny-bound-output').each(function() {\n var id = getIdFromEl(this);\n if (isHidden(this)) {\n initialValues['.clientdata_output_' + id + '_hidden'] = true;\n } else {\n lastKnownVisibleOutputs[id] = true;\n initialValues['.clientdata_output_' + id + '_hidden'] = false;\n }\n });\n // Send update when hidden state changes\n function doSendOutputHiddenState() {\n var visibleOutputs = {};\n $('.shiny-bound-output').each(function() {\n var id = getIdFromEl(this);\n delete lastKnownVisibleOutputs[id];\n // Assume that the object is hidden when width and height are 0\n var hidden = isHidden(this), evt = {\n type: 'shiny:visualchange',\n visible: !hidden\n };\n if (hidden) {\n inputs.setInput('.clientdata_output_' + id + '_hidden', true);\n } else {\n visibleOutputs[id] = true;\n inputs.setInput('.clientdata_output_' + id + '_hidden', false);\n }\n var $this = $(this);\n evt.binding = $this.data('shiny-output-binding');\n $this.trigger(evt);\n });\n // Anything left in lastKnownVisibleOutputs is orphaned\n for (var name in lastKnownVisibleOutputs) {\n if (lastKnownVisibleOutputs.hasOwnProperty(name))\n inputs.setInput('.clientdata_output_' + name + '_hidden', true);\n }\n // Update the visible outputs for next time\n lastKnownVisibleOutputs = visibleOutputs;\n }\n // sendOutputHiddenState gets called each time DOM elements are shown or\n // hidden. This can be in the hundreds or thousands of times at startup.\n // We'll debounce it, so that we do the actual work once per tick.\n var sendOutputHiddenStateDebouncer = new Debouncer(null, doSendOutputHiddenState, 0);\n function sendOutputHiddenState() {\n sendOutputHiddenStateDebouncer.normalCall();\n }\n // We need to make sure doSendOutputHiddenState actually gets called before\n // the inputBatchSender sends data to the server. The lastChanceCallback\n // here does that - if the debouncer has a pending call, flush it.\n inputBatchSender.lastChanceCallback.push(function() {\n if (sendOutputHiddenStateDebouncer.isPending())\n sendOutputHiddenStateDebouncer.immediateCall();\n });\n\n // Given a namespace and a handler function, return a function that invokes\n // the handler only when e's namespace matches. For example, if the\n // namespace is \"bs\", it would match when e.namespace is \"bs\" or \"bs.tab\".\n // If the namespace is \"bs.tab\", it would match for \"bs.tab\", but not \"bs\".\n function filterEventsByNamespace(namespace, handler) {\n namespace = namespace.split(\".\");\n\n return function(e) {\n var eventNamespace = e.namespace.split(\".\");\n\n // If any of the namespace strings aren't present in this event, quit.\n for (var i=0; i<namespace.length; i++) {\n if (eventNamespace.indexOf(namespace[i]) === -1)\n return;\n }\n\n handler.apply(this, arguments);\n };\n }\n\n // The size of each image may change either because the browser window was\n // resized, or because a tab was shown/hidden (hidden elements report size\n // of 0x0). It's OK to over-report sizes because the input pipeline will\n // filter out values that haven't changed.\n $(window).resize(debounce(500, sendImageSize));\n // Need to register callbacks for each Bootstrap 3 class.\n var bs3classes = ['modal', 'dropdown', 'tab', 'tooltip', 'popover', 'collapse'];\n $.each(bs3classes, function(idx, classname) {\n $('body').on('shown.bs.' + classname + '.sendImageSize', '*',\n filterEventsByNamespace('bs', sendImageSize));\n $('body').on('shown.bs.' + classname + '.sendOutputHiddenState ' +\n 'hidden.bs.' + classname + '.sendOutputHiddenState',\n '*', filterEventsByNamespace('bs', sendOutputHiddenState));\n });\n\n // This is needed for Bootstrap 2 compatibility and for non-Bootstrap\n // related shown/hidden events (like conditionalPanel)\n $('body').on('shown.sendImageSize', '*', sendImageSize);\n $('body').on('shown.sendOutputHiddenState hidden.sendOutputHiddenState', '*',\n sendOutputHiddenState);\n\n // Send initial pixel ratio, and update it if it changes\n initialValues['.clientdata_pixelratio'] = pixelRatio();\n $(window).resize(function() {\n inputs.setInput('.clientdata_pixelratio', pixelRatio());\n });\n\n // Send initial URL\n initialValues['.clientdata_url_protocol'] = window.location.protocol;\n initialValues['.clientdata_url_hostname'] = window.location.hostname;\n initialValues['.clientdata_url_port'] = window.location.port;\n initialValues['.clientdata_url_pathname'] = window.location.pathname;\n\n // Send initial URL search (query string) and update it if it changes\n initialValues['.clientdata_url_search'] = window.location.search;\n\n $(window).on('pushstate', function(e) {\n inputs.setInput('.clientdata_url_search', window.location.search);\n });\n\n $(window).on('popstate', function(e) {\n inputs.setInput('.clientdata_url_search', window.location.search);\n });\n\n // This is only the initial value of the hash. The hash can change, but\n // a reactive version of this isn't sent because watching for changes can\n // require polling on some browsers. The JQuery hashchange plugin can be\n // used if this capability is important.\n initialValues['.clientdata_url_hash_initial'] = window.location.hash;\n initialValues['.clientdata_url_hash'] = window.location.hash;\n\n $(window).on('hashchange', function(e) {\n inputs.setInput('.clientdata_url_hash', location.hash);\n });\n\n // The server needs to know what singletons were rendered as part of\n // the page loading\n var singletonText = initialValues['.clientdata_singletons'] =\n $('script[type=\"application/shiny-singletons\"]').text();\n singletons.registerNames(singletonText.split(/,/));\n\n var dependencyText = $('script[type=\"application/html-dependencies\"]').text();\n $.each(dependencyText.split(/;/), function(i, depStr) {\n var match = /\\s*^(.+)\\[(.+)\\]\\s*$/.exec(depStr);\n if (match) {\n registerDependency(match[1], match[2]);\n }\n });\n\n // We've collected all the initial values--start the server process!\n inputsNoResend.reset(initialValues);\n shinyapp.connect(initialValues);\n $(document).one(\"shiny:connected\", function() {\n initDeferredIframes();\n });\n\n} // function initShiny()\n\n\n// Give any deferred iframes a chance to load.\nfunction initDeferredIframes() {\n if (!window.Shiny || !window.Shiny.shinyapp || !window.Shiny.shinyapp.isConnected()) {\n // If somehow we accidentally call this before the server connection is\n // established, just ignore the call. At the time of this writing it\n // doesn't happen, but it's easy to imagine a later refactoring putting\n // us in this situation and it'd be hard to notice with either manual\n // testing or automated tests, because the only effect is on HTTP request\n // timing. (Update: Actually Aron saw this being called without even\n // window.Shiny being defined, but it was hard to repro.)\n return;\n }\n\n $(\".shiny-frame-deferred\").each(function (i, el) {\n var $el = $(el);\n $el.removeClass(\"shiny-frame-deferred\");\n $el.attr(\"src\", $el.attr(\"data-deferred-src\"));\n $el.attr(\"data-deferred-src\", null);\n });\n}\n\n$(function() {\n // Init Shiny a little later than document ready, so user code can\n // run first (i.e. to register bindings)\n setTimeout(initShiny, 1);\n});\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/browser.js\n\nvar browser = (function() {\n\n var isQt = false;\n // For easy handling of Qt quirks using CSS\n if (/\\bQt\\//.test(window.navigator.userAgent)) {\n $(document.documentElement).addClass('qt');\n isQt = true;\n }\n\n // Enable special treatment for Qt 5 quirks on Linux\n if (/\\bQt\\/5/.test(window.navigator.userAgent) &&\n /Linux/.test(window.navigator.userAgent)) {\n $(document.documentElement).addClass('qt5');\n }\n\n // Detect IE information\n var isIE = (navigator.appName === 'Microsoft Internet Explorer');\n\n function getIEVersion() {\n var rv = -1;\n if (isIE) {\n var ua = navigator.userAgent;\n var re = new RegExp(\"MSIE ([0-9]{1,}[\\\\.0-9]{0,})\");\n if (re.exec(ua) !== null)\n rv = parseFloat(RegExp.$1);\n }\n return rv;\n }\n\n return {\n isQt: isQt,\n isIE: isIE,\n IEVersion: getIEVersion()\n };\n\n})();\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/shinyapp.js\n\nvar ShinyApp = function() {\n this.$socket = null;\n\n // Cached input values\n this.$inputValues = {};\n\n // Output bindings\n this.$bindings = {};\n\n // Cached values/errors\n this.$values = {};\n this.$errors = {};\n\n // Conditional bindings (show/hide element based on expression)\n this.$conditionals = {};\n\n this.$pendingMessages = [];\n this.$activeRequests = {};\n this.$nextRequestId = 0;\n\n this.$allowReconnect = false;\n};\n\n(function() {\n\n this.connect = function(initialInput) {\n if (this.$socket)\n throw \"Connect was already called on this application object\";\n\n $.extend(initialInput, {\n // IE8 and IE9 have some limitations with data URIs\n \".clientdata_allowDataUriScheme\": typeof WebSocket !== 'undefined'\n });\n\n this.$socket = this.createSocket();\n this.$initialInput = initialInput;\n $.extend(this.$inputValues, initialInput);\n\n this.$updateConditionals();\n };\n\n this.isConnected = function() {\n return !!this.$socket;\n };\n\n var scheduledReconnect = null;\n this.reconnect = function() {\n // This function can be invoked directly even if there's a scheduled\n // reconnect, so be sure to clear any such scheduled reconnects.\n clearTimeout(scheduledReconnect);\n\n if (this.isConnected())\n throw \"Attempted to reconnect, but already connected.\";\n\n this.$socket = this.createSocket();\n this.$initialInput = $.extend({}, this.$inputValues);\n this.$updateConditionals();\n };\n\n this.createSocket = function () {\n var self = this;\n\n var createSocketFunc = exports.createSocket || function() {\n var protocol = 'ws:';\n if (window.location.protocol === 'https:')\n protocol = 'wss:';\n\n var defaultPath = window.location.pathname;\n // some older WebKit browsers return the pathname already decoded;\n // if we find invalid URL characters in the path, encode them\n if (!/^([$#!&-;=?-[\\]_a-z~]|%[0-9a-fA-F]{2})+$/.test(defaultPath)) {\n defaultPath = encodeURI(defaultPath);\n // Bizarrely, QtWebKit requires us to encode these characters *twice*\n if (browser.isQt) {\n defaultPath = encodeURI(defaultPath);\n }\n }\n if (!/\\/$/.test(defaultPath))\n defaultPath += '/';\n defaultPath += 'websocket/';\n\n var ws = new WebSocket(protocol + '//' + window.location.host + defaultPath);\n ws.binaryType = 'arraybuffer';\n\n return ws;\n };\n\n var socket = createSocketFunc();\n var hasOpened = false;\n socket.onopen = function() {\n hasOpened = true;\n\n $(document).trigger({\n type: 'shiny:connected',\n socket: socket\n });\n\n self.onConnected();\n\n socket.send(JSON.stringify({\n method: 'init',\n data: self.$initialInput\n }));\n\n while (self.$pendingMessages.length) {\n var msg = self.$pendingMessages.shift();\n socket.send(msg);\n }\n };\n socket.onmessage = function(e) {\n self.dispatchMessage(e.data);\n };\n // Called when a successfully-opened websocket is closed, or when an\n // attempt to open a connection fails.\n socket.onclose = function() {\n // These things are needed only if we've successfully opened the\n // websocket.\n if (hasOpened) {\n $(document).trigger({\n type: 'shiny:disconnected',\n socket: socket\n });\n\n self.$notifyDisconnected();\n }\n\n self.onDisconnected(); // Must be run before self.$removeSocket()\n self.$removeSocket();\n };\n return socket;\n };\n\n this.sendInput = function(values) {\n var msg = JSON.stringify({\n method: 'update',\n data: values\n });\n\n this.$sendMsg(msg);\n\n $.extend(this.$inputValues, values);\n this.$updateConditionals();\n };\n\n this.$notifyDisconnected = function() {\n\n // function to normalize hostnames\n var normalize = function(hostname) {\n if (hostname === \"127.0.0.1\")\n return \"localhost\";\n else\n return hostname;\n };\n\n // Send a 'disconnected' message to parent if we are on the same domin\n var parentUrl = (parent !== window) ? document.referrer : null;\n if (parentUrl) {\n // parse the parent href\n var a = document.createElement('a');\n a.href = parentUrl;\n\n // post the disconnected message if the hostnames are the same\n if (normalize(a.hostname) === normalize(window.location.hostname)) {\n var protocol = a.protocol.replace(':',''); // browser compatability\n var origin = protocol + '://' + a.hostname;\n if (a.port)\n origin = origin + ':' + a.port;\n parent.postMessage('disconnected', origin);\n }\n }\n };\n\n this.$removeSocket = function() {\n this.$socket = null;\n };\n\n this.$scheduleReconnect = function(delay) {\n var self = this;\n scheduledReconnect = setTimeout(function() { self.reconnect(); }, delay);\n };\n\n // How long should we wait before trying the next reconnection?\n // The delay will increase with subsequent attempts.\n // .next: Return the time to wait for next connection, and increment counter.\n // .reset: Reset the attempt counter.\n var reconnectDelay = (function() {\n var attempts = 0;\n // Time to wait before each reconnection attempt. If we go through all of\n // these values, repeated use the last one. Add 500ms to each one so that\n // in the last 0.5s, it shows \"...\"\n var delays = [1500, 1500, 2500, 2500, 5500, 5500, 10500];\n\n return {\n next: function() {\n var i = attempts;\n // Instead of going off the end, use the last one\n if (i >= delays.length) {\n i = delays.length - 1;\n }\n\n attempts++;\n return delays[i];\n },\n reset: function() {\n attempts = 0;\n }\n };\n })();\n\n this.onDisconnected = function() {\n // Add gray-out overlay, if not already present\n var $overlay = $('#shiny-disconnected-overlay');\n if ($overlay.length === 0) {\n $(document.body).append('<div id=\"shiny-disconnected-overlay\"></div>');\n }\n\n // To try a reconnect, both the app (this.$allowReconnect) and the\n // server (this.$socket.allowReconnect) must allow reconnections, or\n // session$allowReconnect(\"force\") was called. The \"force\" option should\n // only be used for testing.\n if ((this.$allowReconnect === true && this.$socket.allowReconnect === true) ||\n this.$allowReconnect === \"force\")\n {\n var delay = reconnectDelay.next();\n exports.showReconnectDialog(delay);\n this.$scheduleReconnect(delay);\n }\n };\n\n this.onConnected = function() {\n $('#shiny-disconnected-overlay').remove();\n exports.hideReconnectDialog();\n reconnectDelay.reset();\n };\n\n // NB: Including blobs will cause IE to break!\n // TODO: Make blobs work with Internet Explorer\n //\n // Websocket messages are normally one-way--i.e. the client passes a\n // message to the server but there is no way for the server to provide\n // a response to that specific message. makeRequest provides a way to\n // do asynchronous RPC over websocket. Each request has a method name\n // and arguments, plus optionally one or more binary blobs can be\n // included as well. The request is tagged with a unique number that\n // the server will use to label the corresponding response.\n //\n // @param method A string that tells the server what logic to run.\n // @param args An array of objects that should also be passed to the\n // server in JSON-ified form.\n // @param onSuccess A function that will be called back if the server\n // responds with success. If the server provides a value in the\n // response, the function will be called with it as the only argument.\n // @param onError A function that will be called back if the server\n // responds with error, or if the request fails for any other reason.\n // The parameter to onError will be a string describing the error.\n // @param blobs Optionally, an array of Blob, ArrayBuffer, or string\n // objects that will be made available to the server as part of the\n // request. Strings will be encoded using UTF-8.\n this.makeRequest = function(method, args, onSuccess, onError, blobs) {\n var requestId = this.$nextRequestId;\n while (this.$activeRequests[requestId]) {\n requestId = (requestId + 1) % 1000000000;\n }\n this.$nextRequestId = requestId + 1;\n\n this.$activeRequests[requestId] = {\n onSuccess: onSuccess,\n onError: onError\n };\n\n var msg = JSON.stringify({\n method: method,\n args: args,\n tag: requestId\n });\n\n if (blobs) {\n // We have binary data to transfer; form a different kind of packet.\n // Start with a 4-byte signature, then for each blob, emit 4 bytes for\n // the length followed by the blob. The json payload is UTF-8 encoded\n // and used as the first blob.\n\n var uint32_to_buf = function(val) {\n var buffer = new ArrayBuffer(4);\n var view = new DataView(buffer);\n view.setUint32(0, val, true); // little-endian\n return buffer;\n };\n\n var payload = [];\n payload.push(uint32_to_buf(0x01020202)); // signature\n\n var jsonBuf = makeBlob([msg]);\n payload.push(uint32_to_buf(jsonBuf.size));\n payload.push(jsonBuf);\n\n for (var i = 0; i < blobs.length; i++) {\n payload.push(uint32_to_buf(blobs[i].byteLength || blobs[i].size || 0));\n payload.push(blobs[i]);\n }\n\n msg = makeBlob(payload);\n }\n\n this.$sendMsg(msg);\n };\n\n this.$sendMsg = function(msg) {\n if (!this.$socket.readyState) {\n this.$pendingMessages.push(msg);\n }\n else {\n this.$socket.send(msg);\n }\n };\n\n this.receiveError = function(name, error) {\n if (this.$errors[name] === error)\n return;\n\n this.$errors[name] = error;\n delete this.$values[name];\n\n var binding = this.$bindings[name];\n var evt = jQuery.Event('shiny:error');\n evt.name = name;\n evt.error = error;\n evt.binding = binding;\n $(binding ? binding.el : document).trigger(evt);\n if (!evt.isDefaultPrevented() && binding && binding.onValueError) {\n binding.onValueError(evt.error);\n }\n };\n\n this.receiveOutput = function(name, value) {\n if (this.$values[name] === value)\n return undefined;\n\n this.$values[name] = value;\n delete this.$errors[name];\n\n var binding = this.$bindings[name];\n var evt = jQuery.Event('shiny:value');\n evt.name = name;\n evt.value = value;\n evt.binding = binding;\n $(binding ? binding.el : document).trigger(evt);\n if (!evt.isDefaultPrevented() && binding) {\n binding.onValueChange(evt.value);\n }\n\n return value;\n };\n\n this.bindOutput = function(id, binding) {\n if (!id)\n throw \"Can't bind an element with no ID\";\n if (this.$bindings[id])\n throw \"Duplicate binding for ID \" + id;\n this.$bindings[id] = binding;\n\n if (this.$values[id] !== undefined)\n binding.onValueChange(this.$values[id]);\n else if (this.$errors[id] !== undefined)\n binding.onValueError(this.$errors[id]);\n\n return binding;\n };\n\n this.unbindOutput = function(id, binding) {\n if (this.$bindings[id] === binding) {\n delete this.$bindings[id];\n return true;\n }\n else {\n return false;\n }\n };\n\n this.$updateConditionals = function() {\n $(document).trigger({\n type: 'shiny:conditional'\n });\n\n var inputs = {};\n\n // Input keys use \"name:type\" format; we don't want the user to\n // have to know about the type suffix when referring to inputs.\n for (var name in this.$inputValues) {\n if (this.$inputValues.hasOwnProperty(name)) {\n var shortName = name.replace(/:.*/, '');\n inputs[shortName] = this.$inputValues[name];\n }\n }\n\n var scope = {input: inputs, output: this.$values};\n\n var conditionals = $(document).find('[data-display-if]');\n for (var i = 0; i < conditionals.length; i++) {\n var el = $(conditionals[i]);\n var condFunc = el.data('data-display-if-func');\n\n if (!condFunc) {\n var condExpr = el.attr('data-display-if');\n condFunc = scopeExprToFunc(condExpr);\n el.data('data-display-if-func', condFunc);\n }\n\n var show = condFunc(scope);\n var showing = el.css(\"display\") !== \"none\";\n if (show !== showing) {\n if (show) {\n el.trigger('show');\n el.show();\n el.trigger('shown');\n }\n else {\n el.trigger('hide');\n el.hide();\n el.trigger('hidden');\n }\n }\n }\n };\n\n // Message handler management functions =================================\n\n // Records insertion order of handlers. Maps number to name. This is so\n // we can dispatch messages to handlers in the order that handlers were\n // added.\n var messageHandlerOrder = [];\n // Keep track of handlers by name. Maps name to handler function.\n var messageHandlers = {};\n\n // Two categories of message handlers: those that are from Shiny, and those\n // that are added by the user. The Shiny ones handle messages in\n // msgObj.values, msgObj.errors, and so on. The user ones handle messages\n // in msgObj.custom.foo and msgObj.custom.bar.\n var customMessageHandlerOrder = [];\n var customMessageHandlers = {};\n\n // Adds Shiny (internal) message handler\n function addMessageHandler(type, handler) {\n if (messageHandlers[type]) {\n throw('handler for message of type \"' + type + '\" already added.');\n }\n if (typeof(handler) !== 'function') {\n throw('handler must be a function.');\n }\n if (handler.length !== 1) {\n throw('handler must be a function that takes one argument.');\n }\n messageHandlerOrder.push(type);\n messageHandlers[type] = handler;\n }\n\n // Adds custom message handler - this one is exposed to the user\n function addCustomMessageHandler(type, handler) {\n // Remove any previously defined handlers so that only the most recent one\n // will be called\n if (customMessageHandlers[type]) {\n var typeIdx = customMessageHandlerOrder.indexOf(type);\n if (typeIdx !== -1) {\n customMessageHandlerOrder.splice(typeIdx, 1);\n delete customMessageHandlers[type];\n }\n }\n if (typeof(handler) !== 'function') {\n throw('handler must be a function.');\n }\n if (handler.length !== 1) {\n throw('handler must be a function that takes one argument.');\n }\n\n customMessageHandlerOrder.push(type);\n customMessageHandlers[type] = handler;\n }\n\n exports.addCustomMessageHandler = addCustomMessageHandler;\n\n this.dispatchMessage = function(data) {\n var msgObj = {};\n if(typeof data === \"string\") {\n msgObj = JSON.parse(data);\n } else { // data is arraybuffer\n var len = new DataView(data,0,1).getUint8(0);\n var typedv = new DataView(data,1,len);\n var typebuf = [];\n for(var i=0; i<len; i++){\n typebuf.push(String.fromCharCode(typedv.getUint8(i)));\n }\n var type = typebuf.join(\"\");\n data = data.slice(len+1);\n msgObj.custom = {};\n msgObj.custom[type] = data;\n }\n\n var evt = jQuery.Event('shiny:message');\n evt.message = msgObj;\n $(document).trigger(evt);\n if (evt.isDefaultPrevented()) return;\n\n // Send msgObj.foo and msgObj.bar to appropriate handlers\n this._sendMessagesToHandlers(evt.message, messageHandlers, messageHandlerOrder);\n\n this.$updateConditionals();\n };\n\n // A function for sending messages to the appropriate handlers.\n // - msgObj: the object containing messages, with format {msgObj.foo, msObj.bar\n this._sendMessagesToHandlers = function(msgObj, handlers, handlerOrder) {\n // Dispatch messages to handlers, if handler is present\n for (let i = 0; i < handlerOrder.length; i++) {\n var msgType = handlerOrder[i];\n if (msgObj.hasOwnProperty(msgType)) {\n // Execute each handler with 'this' referring to the present value of\n // 'this'\n handlers[msgType].call(this, msgObj[msgType]);\n }\n }\n };\n\n // Message handlers =====================================================\n\n addMessageHandler('values', function(message) {\n for (var name in this.$bindings) {\n if (this.$bindings.hasOwnProperty(name))\n this.$bindings[name].showProgress(false);\n }\n\n for (var key in message) {\n if (message.hasOwnProperty(key))\n this.receiveOutput(key, message[key]);\n }\n });\n\n addMessageHandler('errors', function(message) {\n for (var key in message) {\n if (message.hasOwnProperty(key))\n this.receiveError(key, message[key]);\n }\n });\n\n addMessageHandler('inputMessages', function(message) {\n // inputMessages should be an array\n for (var i = 0; i < message.length; i++) {\n var $obj = $('.shiny-bound-input#' + $escape(message[i].id));\n var inputBinding = $obj.data('shiny-input-binding');\n\n // Dispatch the message to the appropriate input object\n if ($obj.length > 0) {\n var el = $obj[0];\n var evt = jQuery.Event('shiny:updateinput');\n evt.message = message[i].message;\n evt.binding = inputBinding;\n $(el).trigger(evt);\n if (!evt.isDefaultPrevented())\n inputBinding.receiveMessage(el, evt.message);\n }\n }\n });\n\n addMessageHandler('javascript', function(message) {\n /*jshint evil: true */\n eval(message);\n });\n\n addMessageHandler('console', function(message) {\n for (var i = 0; i < message.length; i++) {\n if (console.log)\n console.log(message[i]);\n }\n });\n\n addMessageHandler('progress', function(message) {\n if (message.type && message.message) {\n var handler = progressHandlers[message.type];\n if (handler)\n handler.call(this, message.message);\n }\n });\n\n addMessageHandler('notification', function(message) {\n if (message.type === 'show')\n exports.notifications.show(message.message);\n else if (message.type === 'remove')\n exports.notifications.remove(message.message);\n else\n throw('Unkown notification type: ' + message.type);\n });\n\n addMessageHandler('modal', function(message) {\n if (message.type === 'show')\n exports.modal.show(message.message);\n else if (message.type === 'remove')\n exports.modal.remove(); // For 'remove', message content isn't used\n else\n throw('Unkown modal type: ' + message.type);\n });\n\n addMessageHandler('response', function(message) {\n var requestId = message.tag;\n var request = this.$activeRequests[requestId];\n if (request) {\n delete this.$activeRequests[requestId];\n if ('value' in message)\n request.onSuccess(message.value);\n else\n request.onError(message.error);\n }\n });\n\n addMessageHandler('allowReconnect', function(message) {\n if (message === true || message === false || message === \"force\") {\n this.$allowReconnect = message;\n } else {\n throw \"Invalid value for allowReconnect: \" + message;\n }\n });\n\n addMessageHandler('custom', function(message) {\n // For old-style custom messages - should deprecate and migrate to new\n // method\n if (exports.oncustommessage) {\n exports.oncustommessage(message);\n }\n\n // Send messages.foo and messages.bar to appropriate handlers\n this._sendMessagesToHandlers(message, customMessageHandlers,\n customMessageHandlerOrder);\n });\n\n addMessageHandler('config', function(message) {\n this.config = message;\n });\n\n addMessageHandler('busy', function(message) {\n if (message === 'busy') {\n $(document.documentElement).addClass('shiny-busy');\n $(document).trigger('shiny:busy');\n } else if (message === 'idle') {\n $(document.documentElement).removeClass('shiny-busy');\n $(document).trigger('shiny:idle');\n }\n });\n\n addMessageHandler('recalculating', function(message) {\n if (message.hasOwnProperty('name') && message.hasOwnProperty('status')) {\n var binding = this.$bindings[message.name];\n $(binding ? binding.el : null).trigger({\n type: 'shiny:' + message.status\n });\n }\n });\n\n addMessageHandler('reload', function(message) {\n window.location.reload();\n });\n\n addMessageHandler('shiny-insert-ui', function (message) {\n var targets = $(message.selector);\n if (targets.length === 0) {\n // render the HTML and deps to a null target, so\n // the side-effect of rendering the deps, singletons,\n // and <head> still occur\n console.warn('The selector you chose (\"' + message.selector +\n '\") could not be found in the DOM.');\n exports.renderHtml(message.content.html, $([]), message.content.deps);\n } else {\n targets.each(function (i, target) {\n exports.renderContent(target, message.content, message.where);\n return message.multiple;\n });\n }\n });\n\n addMessageHandler('shiny-remove-ui', function (message) {\n var els = $(message.selector);\n els.each(function (i, el) {\n exports.unbindAll(el, true);\n $(el).remove();\n // If `multiple` is false, returning false terminates the function\n // and no other elements are removed; if `multiple` is true,\n // returning true continues removing all remaining elements.\n return message.multiple;\n });\n });\n\n addMessageHandler('updateQueryString', function(message) {\n\n // leave the bookmarking code intact\n if (message.mode === \"replace\") {\n window.history.replaceState(null, null, message.queryString);\n return;\n }\n\n var what = null;\n if (message.queryString.charAt(0) === \"#\") what = \"hash\";\n else if (message.queryString.charAt(0) === \"?\") what = \"query\";\n else throw \"The 'query' string must start with either '?' \" +\n \"(to update the query string) or with '#' (to \" +\n \"update the hash).\";\n\n var path = window.location.pathname;\n var oldQS = window.location.search;\n var oldHash = window.location.hash;\n\n /* Barbara -- December 2016\n Note: we could check if the new QS and/or hash are different\n from the old one(s) and, if not, we could choose not to push\n a new state (whether or not we would replace it is moot/\n inconsequential). However, I think that it is better to\n interpret each call to `updateQueryString` as representing\n new state (even if the message.queryString is the same), so\n that check isn't even performed as of right now.\n */\n\n var relURL = path;\n if (what === \"query\") relURL += message.queryString;\n else relURL += oldQS + message.queryString; // leave old QS if it exists\n window.history.pushState(null, null, relURL);\n\n // for the case when message.queryString has both a query string\n // and a hash (`what = \"hash\"` allows us to trigger the\n // hashchange event)\n if (message.queryString.indexOf(\"#\") !== -1) what = \"hash\";\n\n // for the case when there was a hash before, but there isn't\n // any hash now (e.g. for when only the query string is updated)\n if (window.location.hash !== oldHash) what = \"hash\";\n\n // This event needs to be triggered manually because pushState() never\n // causes a hashchange event to be fired,\n if (what === \"hash\") $(document).trigger(\"hashchange\");\n });\n\n addMessageHandler(\"resetBrush\", function(message) {\n exports.resetBrush(message.brushId);\n });\n\n // Progress reporting ====================================================\n\n var progressHandlers = {\n // Progress for a particular object\n binding: function(message) {\n var key = message.id;\n var binding = this.$bindings[key];\n if (binding && binding.showProgress) {\n binding.showProgress(true);\n }\n },\n\n // Open a page-level progress bar\n open: function(message) {\n if (message.style === \"notification\") {\n // For new-style (starting in Shiny 0.14) progress indicators that use\n // the notification API.\n\n // Progress bar starts hidden; will be made visible if a value is provided\n // during updates.\n exports.notifications.show({\n html:\n `<div id=\"shiny-progress-${message.id}\" class=\"shiny-progress-notification\">` +\n '<div class=\"progress progress-striped active\" style=\"display: none;\"><div class=\"progress-bar\"></div></div>' +\n '<div class=\"progress-text\">' +\n '<span class=\"progress-message\">message</span> ' +\n '<span class=\"progress-detail\"></span>' +\n '</div>' +\n '</div>',\n id: message.id,\n duration: null\n });\n\n } else if (message.style === \"old\") {\n // For old-style (Shiny <=0.13.2) progress indicators.\n\n // Add progress container (for all progress items) if not already present\n var $container = $('.shiny-progress-container');\n if ($container.length === 0) {\n $container = $('<div class=\"shiny-progress-container\"></div>');\n $('body').append($container);\n }\n\n // Add div for just this progress ID\n var depth = $('.shiny-progress.open').length;\n // The 'bar' class is needed for backward compatibility with Bootstrap 2.\n var $progress = $('<div class=\"shiny-progress open\">' +\n '<div class=\"progress progress-striped active\"><div class=\"progress-bar bar\"></div></div>' +\n '<div class=\"progress-text\">' +\n '<span class=\"progress-message\">message</span>' +\n '<span class=\"progress-detail\"></span>' +\n '</div>' +\n '</div>'\n );\n\n $progress.attr('id', message.id);\n $container.append($progress);\n\n // Stack bars\n var $progressBar = $progress.find('.progress');\n $progressBar.css('top', depth * $progressBar.height() + 'px');\n\n // Stack text objects\n var $progressText = $progress.find('.progress-text');\n $progressText.css('top', 3 * $progressBar.height() +\n depth * $progressText.outerHeight() + 'px');\n\n $progress.hide();\n }\n\n },\n\n // Update page-level progress bar\n update: function(message) {\n if (message.style === \"notification\") {\n // For new-style (starting in Shiny 0.14) progress indicators that use\n // the notification API.\n var $progress = $('#shiny-progress-' + message.id);\n\n if ($progress.length === 0)\n return;\n\n if (typeof(message.message) !== 'undefined') {\n $progress.find('.progress-message').text(message.message);\n }\n if (typeof(message.detail) !== 'undefined') {\n $progress.find('.progress-detail').text(message.detail);\n }\n if (typeof(message.value) !== 'undefined') {\n if (message.value !== null) {\n $progress.find('.progress').show();\n $progress.find('.progress-bar').width((message.value*100) + '%');\n\n } else {\n $progress.find('.progress').hide();\n }\n }\n\n } else if (message.style === \"old\") {\n // For old-style (Shiny <=0.13.2) progress indicators.\n\n var $progress = $('#' + message.id + '.shiny-progress');\n if (typeof(message.message) !== 'undefined') {\n $progress.find('.progress-message').text(message.message);\n }\n if (typeof(message.detail) !== 'undefined') {\n $progress.find('.progress-detail').text(message.detail);\n }\n if (typeof(message.value) !== 'undefined') {\n if (message.value !== null) {\n $progress.find('.progress').show();\n $progress.find('.bar').width((message.value*100) + '%');\n } else {\n $progress.find('.progress').hide();\n }\n }\n\n $progress.fadeIn();\n }\n\n },\n\n // Close page-level progress bar\n close: function(message) {\n if (message.style === \"notification\") {\n exports.notifications.remove(message.id);\n\n } else if (message.style === \"old\") {\n var $progress = $('#' + message.id + '.shiny-progress');\n $progress.removeClass('open');\n\n $progress.fadeOut({\n complete: function() {\n $progress.remove();\n\n // If this was the last shiny-progress, remove container\n if ($('.shiny-progress').length === 0)\n $('.shiny-progress-container').remove();\n }\n });\n }\n }\n };\n\n exports.progressHandlers = progressHandlers;\n\n // Returns a URL which can be queried to get values from inside the server\n // function. This is enabled with `options(shiny.testmode=TRUE)`.\n this.getTestSnapshotBaseUrl = function({ fullUrl = true } = {})\n {\n const loc = window.location;\n let url = \"\";\n\n if (fullUrl) {\n // Strip off everything after last slash in path, like dirname() in R\n url = loc.origin + loc.pathname.replace(/\\/[^/]*$/, \"\");\n }\n url += \"/session/\" +\n encodeURIComponent(this.config.sessionId) +\n \"/dataobj/shinytest?w=\" +\n encodeURIComponent(this.config.workerId) +\n \"&nonce=\" + randomId();\n\n return url;\n };\n\n}).call(ShinyApp.prototype);\n\n\n\nexports.showReconnectDialog = (function() {\n var reconnectTime = null;\n\n function updateTime() {\n var $time = $(\"#shiny-reconnect-time\");\n // If the time has been removed, exit and don't reschedule this function.\n if ($time.length === 0) return;\n\n var seconds = Math.floor((reconnectTime - new Date().getTime()) / 1000);\n if (seconds > 0) {\n $time.text(\" in \" + seconds + \"s\");\n } else {\n $time.text(\"...\");\n }\n\n // Reschedule this function after 1 second\n setTimeout(updateTime, 1000);\n }\n\n\n return function(delay) {\n reconnectTime = new Date().getTime() + delay;\n\n // If there's already a reconnect dialog, don't add another\n if ($('#shiny-reconnect-text').length > 0)\n return;\n\n var html = '<span id=\"shiny-reconnect-text\">Attempting to reconnect</span>' +\n '<span id=\"shiny-reconnect-time\"></span>';\n var action = '<a id=\"shiny-reconnect-now\" href=\"#\" onclick=\"Shiny.shinyapp.reconnect();\">Try now</a>';\n\n exports.notifications.show({\n id: \"reconnect\",\n html: html,\n action: action,\n duration: null,\n closeButton: false,\n type: 'warning'\n });\n\n updateTime();\n };\n})();\n\nexports.hideReconnectDialog = function() {\n exports.notifications.remove(\"reconnect\");\n};\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/notifications.js\n\nexports.notifications = (function() {\n\n // Milliseconds to fade in or out\n const fadeDuration = 250;\n\n function show({ html='', action='', deps=[], duration=5000,\n id=null, closeButton=true, type=null } = {})\n {\n if (!id)\n id = randomId();\n\n // Create panel if necessary\n _createPanel();\n\n // Get existing DOM element for this ID, or create if needed.\n let $notification = _get(id);\n if ($notification.length === 0)\n $notification = _create(id);\n\n // Render html and dependencies\n const newHtml = `<div class=\"shiny-notification-content-text\">${html}</div>` +\n `<div class=\"shiny-notification-content-action\">${action}</div>`;\n const $content = $notification.find('.shiny-notification-content');\n exports.renderContent($content, { html: newHtml, deps: deps });\n\n // Remove any existing classes of the form 'shiny-notification-xxxx'.\n // The xxxx would be strings like 'warning'.\n const classes = $notification.attr('class')\n .split(/\\s+/)\n .filter(cls => cls.match(/^shiny-notification-/))\n .join(' ');\n $notification.removeClass(classes);\n\n // Add class. 'default' means no additional CSS class.\n if (type && type !== 'default')\n $notification.addClass('shiny-notification-' + type);\n\n\n // Make sure that the presence/absence of close button matches with value\n // of `closeButton`.\n const $close = $notification.find('.shiny-notification-close');\n if (closeButton && $close.length === 0) {\n $notification.append('<div class=\"shiny-notification-close\">×</div>');\n } else if (!closeButton && $close.length !== 0) {\n $close.remove();\n }\n\n // If duration was provided, schedule removal. If not, clear existing\n // removal callback (this happens if a message was first added with\n // a duration, and then updated with no duration).\n if (duration)\n _addRemovalCallback(id, duration);\n else\n _clearRemovalCallback(id);\n\n return id;\n }\n\n function remove(id) {\n _get(id).fadeOut(fadeDuration, function() {\n\n exports.unbindAll(this);\n $(this).remove();\n\n // If no more notifications, remove the panel from the DOM.\n if (_ids().length === 0) {\n _getPanel().remove();\n }\n });\n }\n\n // Returns an individual notification DOM object (wrapped in jQuery).\n function _get(id) {\n if (!id)\n return null;\n return _getPanel().find('#shiny-notification-' + $escape(id));\n }\n\n // Return array of all notification IDs\n function _ids() {\n return _getPanel()\n .find('.shiny-notification')\n .map(function() { return this.id.replace(/shiny-notification-/, ''); })\n .get();\n }\n\n // Returns the notification panel DOM object (wrapped in jQuery).\n function _getPanel() {\n return $('#shiny-notification-panel');\n }\n\n // Create notifications panel and return the jQuery object. If the DOM\n // element already exists, just return it.\n function _createPanel() {\n let $panel = _getPanel();\n\n if ($panel.length > 0)\n return $panel;\n\n $('body').append('<div id=\"shiny-notification-panel\">');\n\n return $panel;\n }\n\n // Create a notification DOM element and return the jQuery object. If the\n // DOM element already exists for the ID, just return it without creating.\n function _create(id) {\n let $notification = _get(id);\n\n if ($notification.length === 0) {\n $notification = $(\n `<div id=\"shiny-notification-${id}\" class=\"shiny-notification\">` +\n '<div class=\"shiny-notification-close\">×</div>' +\n '<div class=\"shiny-notification-content\"></div>' +\n '</div>'\n );\n\n $notification.find('.shiny-notification-close').on('click', e => {\n e.preventDefault();\n e.stopPropagation();\n remove(id);\n });\n\n _getPanel().append($notification);\n }\n\n return $notification;\n }\n\n // Add a callback to remove a notification after a delay in ms.\n function _addRemovalCallback(id, delay) {\n // If there's an existing removalCallback, clear it before adding the new\n // one.\n _clearRemovalCallback(id);\n\n // Attach new removal callback\n const removalCallback = setTimeout(function() { remove(id); }, delay);\n _get(id).data('removalCallback', removalCallback);\n }\n\n // Clear a removal callback from a notification, if present.\n function _clearRemovalCallback(id) {\n const $notification = _get(id);\n const oldRemovalCallback = $notification.data('removalCallback');\n if (oldRemovalCallback) {\n clearTimeout(oldRemovalCallback);\n }\n }\n\n return {\n show,\n remove\n };\n})();\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/modal.js\n\nexports.modal = {\n\n // Show a modal dialog. This is meant to handle two types of cases: one is\n // that the content is a Bootstrap modal dialog, and the other is that the\n // content is non-Bootstrap. Bootstrap modals require some special handling,\n // which is coded in here.\n show: function({ html='', deps=[] } = {}) {\n\n // If there was an existing Bootstrap modal, then there will be a modal-\n // backdrop div that was added outside of the modal wrapper, and it must be\n // removed; otherwise there can be multiple of these divs.\n $('.modal-backdrop').remove();\n\n // Get existing wrapper DOM element, or create if needed.\n let $modal = $('#shiny-modal-wrapper');\n if ($modal.length === 0) {\n $modal = $('<div id=\"shiny-modal-wrapper\"></div>');\n $('body').append($modal);\n\n // If the wrapper's content is a Bootstrap modal, then when the inner\n // modal is hidden, remove the entire thing, including wrapper.\n $modal.on('hidden.bs.modal', function(e) {\n if (e.target === $(\"#shiny-modal\")[0]) {\n exports.unbindAll($modal);\n $modal.remove();\n }\n });\n }\n\n // Set/replace contents of wrapper with html.\n exports.renderContent($modal, { html: html, deps: deps });\n },\n\n remove: function() {\n const $modal = $('#shiny-modal-wrapper');\n\n // Look for a Bootstrap modal and if present, trigger hide event. This will\n // trigger the hidden.bs.modal callback that we set in show(), which unbinds\n // and removes the element.\n if ($modal.find('.modal').length > 0) {\n $modal.find('.modal').modal('hide');\n\n } else {\n // If not a Bootstrap modal dialog, simply unbind and remove it.\n exports.unbindAll($modal);\n $modal.remove();\n }\n }\n};\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/file_processor.js\n\n// Generic driver class for doing chunk-wise asynchronous processing of a\n// FileList object. Subclass/clone it and override the `on*` functions to\n// make it do something useful.\nvar FileProcessor = function(files) {\n this.files = files;\n this.fileIndex = -1;\n // Currently need to use small chunk size because R-Websockets can't\n // handle continuation frames\n this.aborted = false;\n this.completed = false;\n\n // TODO: Register error/abort callbacks\n\n this.$run();\n};\n(function() {\n // Begin callbacks. Subclassers/cloners may override any or all of these.\n this.onBegin = function(files, cont) {\n setTimeout(cont, 0);\n };\n this.onFile = function(file, cont) {\n setTimeout(cont, 0);\n };\n this.onComplete = function() {\n };\n this.onAbort = function() {\n };\n // End callbacks\n\n // Aborts processing, unless it's already completed\n this.abort = function() {\n if (this.completed || this.aborted)\n return;\n\n this.aborted = true;\n this.onAbort();\n };\n\n // Returns a bound function that will call this.$run one time.\n this.$getRun = function() {\n var self = this;\n var called = false;\n return function() {\n if (called)\n return;\n called = true;\n self.$run();\n };\n };\n\n // This function will be called multiple times to advance the process.\n // It relies on the state of the object's fields to know what to do next.\n this.$run = function() {\n\n if (this.aborted || this.completed)\n return;\n\n if (this.fileIndex < 0) {\n // Haven't started yet--begin\n this.fileIndex = 0;\n this.onBegin(this.files, this.$getRun());\n return;\n }\n\n if (this.fileIndex === this.files.length) {\n // Just ended\n this.completed = true;\n this.onComplete();\n return;\n }\n\n // If we got here, then we have a file to process, or we are\n // in the middle of processing a file, or have just finished\n // processing a file.\n\n var file = this.files[this.fileIndex++];\n this.onFile(file, this.$getRun());\n };\n}).call(FileProcessor.prototype);\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/binding_registry.js\n\nvar BindingRegistry = function() {\n this.bindings = [];\n this.bindingNames = {};\n};\n(function() {\n this.register = function(binding, bindingName, priority) {\n var bindingObj = {binding: binding, priority: priority || 0};\n this.bindings.unshift(bindingObj);\n if (bindingName) {\n this.bindingNames[bindingName] = bindingObj;\n binding.name = bindingName;\n }\n };\n this.setPriority = function(bindingName, priority) {\n var bindingObj = this.bindingNames[bindingName];\n if (!bindingObj)\n throw \"Tried to set priority on unknown binding \" + bindingName;\n bindingObj.priority = priority || 0;\n };\n this.getPriority = function(bindingName) {\n var bindingObj = this.bindingNames[bindingName];\n if (!bindingObj)\n return false;\n return bindingObj.priority;\n };\n this.getBindings = function() {\n // Sort the bindings. The ones with higher priority are consulted\n // first; ties are broken by most-recently-registered.\n return mergeSort(this.bindings, function(a, b) {\n return b.priority - a.priority;\n });\n };\n}).call(BindingRegistry.prototype);\n\n\nvar inputBindings = exports.inputBindings = new BindingRegistry();\nvar outputBindings = exports.outputBindings = new BindingRegistry();\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/output_binding.js\n\nvar OutputBinding = exports.OutputBinding = function() {};\n(function() {\n // Returns a jQuery object or element array that contains the\n // descendants of scope that match this binding\n this.find = function(scope) { throw \"Not implemented\"; };\n\n this.getId = function(el) {\n return el['data-input-id'] || el.id;\n };\n\n this.onValueChange = function(el, data) {\n this.clearError(el);\n this.renderValue(el, data);\n };\n this.onValueError = function(el, err) {\n this.renderError(el, err);\n };\n this.renderError = function(el, err) {\n this.clearError(el);\n if (err.message === '') {\n // not really error, but we just need to wait (e.g. action buttons)\n $(el).empty();\n return;\n }\n var errClass = 'shiny-output-error';\n if (err.type !== null) {\n // use the classes of the error condition as CSS class names\n errClass = errClass + ' ' + $.map(asArray(err.type), function(type) {\n return errClass + '-' + type;\n }).join(' ');\n }\n $(el).addClass(errClass).text(err.message);\n };\n this.clearError = function(el) {\n $(el).attr('class', function(i, c) {\n return c.replace(/(^|\\s)shiny-output-error\\S*/g, '');\n });\n };\n this.showProgress = function(el, show) {\n var RECALC_CLASS = 'recalculating';\n if (show)\n $(el).addClass(RECALC_CLASS);\n else\n $(el).removeClass(RECALC_CLASS);\n };\n}).call(OutputBinding.prototype);\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/output_binding_text.js\n\nvar textOutputBinding = new OutputBinding();\n$.extend(textOutputBinding, {\n find: function(scope) {\n return $(scope).find('.shiny-text-output');\n },\n renderValue: function(el, data) {\n $(el).text(data);\n }\n});\noutputBindings.register(textOutputBinding, 'shiny.textOutput');\n\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/output_binding_image.js\n\nvar imageOutputBinding = new OutputBinding();\n$.extend(imageOutputBinding, {\n find: function(scope) {\n return $(scope).find('.shiny-image-output, .shiny-plot-output');\n },\n renderValue: function(el, data) {\n // The overall strategy:\n // * Clear out existing image and event handlers.\n // * Create new image.\n // * Create various event handlers.\n // * Bind those event handlers to events.\n // * Insert the new image.\n\n var outputId = this.getId(el);\n\n var $el = $(el);\n var img;\n\n // Remove event handlers that were added in previous renderValue()\n $el.off('.image_output');\n\n // Get existing img element if present.\n var $img = $el.find('img');\n\n if ($img.length === 0) {\n // If a img element is not already present, that means this is either\n // the first time renderValue() has been called, or this is after an\n // error.\n img = document.createElement('img');\n $el.append(img);\n $img = $(img);\n } else {\n // Trigger custom 'reset' event for any existing images in the div\n img = $img[0];\n $img.trigger('reset');\n }\n\n if (!data) {\n $el.empty();\n return;\n }\n\n // If value is undefined, return alternate. Sort of like ||, except it won't\n // return alternate for other falsy values (0, false, null).\n function OR(value, alternate) {\n if (value === undefined) return alternate;\n return value;\n }\n\n var opts = {\n clickId: $el.data('click-id'),\n clickClip: OR(strToBool($el.data('click-clip')), true),\n\n dblclickId: $el.data('dblclick-id'),\n dblclickClip: OR(strToBool($el.data('dblclick-clip')), true),\n dblclickDelay: OR($el.data('dblclick-delay'), 400),\n\n hoverId: $el.data('hover-id'),\n hoverClip: OR(strToBool($el.data('hover-clip')), true),\n hoverDelayType: OR($el.data('hover-delay-type'), 'debounce'),\n hoverDelay: OR($el.data('hover-delay'), 300),\n hoverNullOutside: OR(strToBool($el.data('hover-null-outside')), false),\n\n brushId: $el.data('brush-id'),\n brushClip: OR(strToBool($el.data('brush-clip')), true),\n brushDelayType: OR($el.data('brush-delay-type'), 'debounce'),\n brushDelay: OR($el.data('brush-delay'), 300),\n brushFill: OR($el.data('brush-fill'), '#666'),\n brushStroke: OR($el.data('brush-stroke'), '#000'),\n brushOpacity: OR($el.data('brush-opacity'), 0.3),\n brushDirection: OR($el.data('brush-direction'), 'xy'),\n brushResetOnNew: OR(strToBool($el.data('brush-reset-on-new')), false),\n\n coordmap: data.coordmap\n };\n\n // Copy items from data to img. Don't set the coordmap as an attribute.\n $.each(data, function(key, value) {\n if (value === null || key === 'coordmap') {\n return;\n }\n img.setAttribute(key, value);\n });\n\n // Unset any attributes in the current img that were not provided in the\n // new data.\n for (var i=0; i<img.attributes.length; i++) {\n var attrib = img.attributes[i];\n // Need to check attrib.specified on IE because img.attributes contains\n // all possible attributes on IE.\n if (attrib.specified && !data.hasOwnProperty(attrib.name)) {\n img.removeAttribute(attrib.name);\n }\n }\n\n if (!opts.coordmap)\n opts.coordmap = [];\n\n imageutils.initCoordmap($el, opts.coordmap);\n\n // This object listens for mousedowns, and triggers mousedown2 and dblclick2\n // events as appropriate.\n var clickInfo = imageutils.createClickInfo($el, opts.dblclickId, opts.dblclickDelay);\n\n $el.on('mousedown.image_output', clickInfo.mousedown);\n\n if (browser.isIE && browser.IEVersion === 8) {\n $el.on('dblclick.image_output', clickInfo.dblclickIE8);\n }\n\n // ----------------------------------------------------------\n // Register the various event handlers\n // ----------------------------------------------------------\n if (opts.clickId) {\n var clickHandler = imageutils.createClickHandler(opts.clickId,\n opts.clickClip, opts.coordmap);\n $el.on('mousedown2.image_output', clickHandler.mousedown);\n\n // When img is reset, do housekeeping: clear $el's mouse listener and\n // call the handler's onResetImg callback.\n $img.on('reset', clickHandler.onResetImg);\n }\n\n if (opts.dblclickId) {\n // We'll use the clickHandler's mousedown function, but register it to\n // our custom 'dblclick2' event.\n var dblclickHandler = imageutils.createClickHandler(opts.dblclickId,\n opts.clickClip, opts.coordmap);\n $el.on('dblclick2.image_output', dblclickHandler.mousedown);\n\n $img.on('reset', dblclickHandler.onResetImg);\n }\n\n if (opts.hoverId) {\n var hoverHandler = imageutils.createHoverHandler(opts.hoverId,\n opts.hoverDelay, opts.hoverDelayType, opts.hoverClip,\n opts.hoverNullOutside, opts.coordmap);\n $el.on('mousemove.image_output', hoverHandler.mousemove);\n $el.on('mouseout.image_output', hoverHandler.mouseout);\n\n $img.on('reset', hoverHandler.onResetImg);\n }\n\n if (opts.brushId) {\n // Make image non-draggable (Chrome, Safari)\n $img.css('-webkit-user-drag', 'none');\n // Firefox, IE<=10\n $img.on('dragstart', function() { return false; });\n\n // Disable selection of image and text when dragging in IE<=10\n $el.on('selectstart.image_output', function() { return false; });\n\n var brushHandler = imageutils.createBrushHandler(opts.brushId, $el, opts,\n opts.coordmap, outputId);\n $el.on('mousedown.image_output', brushHandler.mousedown);\n $el.on('mousemove.image_output', brushHandler.mousemove);\n\n $img.on('reset', brushHandler.onResetImg);\n }\n\n if (opts.clickId || opts.dblclickId || opts.hoverId || opts.brushId) {\n $el.addClass('crosshair');\n }\n\n if (data.error)\n console.log('Error on server extracting coordmap: ' + data.error);\n },\n\n renderError: function(el, err) {\n $(el).find('img').trigger('reset');\n OutputBinding.prototype.renderError.call(this, el, err);\n },\n\n clearError: function(el) {\n // Remove all elements except img and the brush; this is usually just\n // error messages.\n $(el).contents().filter(function() {\n return this.tagName !== \"IMG\" &&\n this.id !== el.id + '_brush';\n }).remove();\n\n OutputBinding.prototype.clearError.call(this, el);\n }\n});\noutputBindings.register(imageOutputBinding, 'shiny.imageOutput');\n\n\nvar imageutils = {};\n\n\n// Modifies the panel objects in a coordmap, adding scale(), scaleInv(),\n// and clip() functions to each one.\nimageutils.initPanelScales = function(coordmap) {\n // Map a value x from a domain to a range. If clip is true, clip it to the\n // range.\n function mapLinear(x, domainMin, domainMax, rangeMin, rangeMax, clip) {\n // By default, clip to range\n clip = clip || true;\n\n var factor = (rangeMax - rangeMin) / (domainMax - domainMin);\n var val = x - domainMin;\n var newval = (val * factor) + rangeMin;\n\n if (clip) {\n var max = Math.max(rangeMax, rangeMin);\n var min = Math.min(rangeMax, rangeMin);\n if (newval > max)\n newval = max;\n else if (newval < min)\n newval = min;\n }\n return newval;\n }\n\n // Create scale and inverse-scale functions for a single direction (x or y).\n function scaler1D(domainMin, domainMax, rangeMin, rangeMax, logbase) {\n return {\n scale: function(val, clip) {\n if (logbase)\n val = Math.log(val) / Math.log(logbase);\n return mapLinear(val, domainMin, domainMax, rangeMin, rangeMax, clip);\n },\n\n scaleInv: function(val, clip) {\n var res = mapLinear(val, rangeMin, rangeMax, domainMin, domainMax, clip);\n if (logbase)\n res = Math.pow(logbase, res);\n return res;\n }\n };\n }\n\n // Modify panel, adding scale and inverse-scale functions that take objects\n // like {x:1, y:3}, and also add clip function.\n function addScaleFuns(panel) {\n var d = panel.domain;\n var r = panel.range;\n var xlog = (panel.log && panel.log.x) ? panel.log.x : null;\n var ylog = (panel.log && panel.log.y) ? panel.log.y : null;\n var xscaler = scaler1D(d.left, d.right, r.left, r.right, xlog);\n var yscaler = scaler1D(d.bottom, d.top, r.bottom, r.top, ylog);\n\n panel.scale = function(val, clip) {\n return {\n x: xscaler.scale(val.x, clip),\n y: yscaler.scale(val.y, clip)\n };\n };\n\n panel.scaleInv = function(val, clip) {\n return {\n x: xscaler.scaleInv(val.x, clip),\n y: yscaler.scaleInv(val.y, clip)\n };\n };\n\n // Given a scaled offset (in pixels), clip it to the nearest panel region.\n panel.clip = function(offset) {\n var newOffset = {\n x: offset.x,\n y: offset.y\n };\n\n var bounds = panel.range;\n\n if (offset.x > bounds.right) newOffset.x = bounds.right;\n else if (offset.x < bounds.left) newOffset.x = bounds.left;\n\n if (offset.y > bounds.bottom) newOffset.y = bounds.bottom;\n else if (offset.y < bounds.top) newOffset.y = bounds.top;\n\n return newOffset;\n };\n }\n\n // Add the functions to each panel object.\n for (var i=0; i<coordmap.length; i++) {\n var panel = coordmap[i];\n addScaleFuns(panel);\n }\n};\n\n\n// This adds functions to the coordmap object to handle various\n// coordinate-mapping tasks, and send information to the server.\n// The input coordmap is an array of objects, each of which represents a panel.\n// coordmap must be an array, even if empty, so that it can be modified in\n// place; when empty, we add a dummy panel to the array.\n// It also calls initPanelScales, which modifies each panel object to have\n// scale, scaleInv, and clip functions.\nimageutils.initCoordmap = function($el, coordmap) {\n var el = $el[0];\n\n // If we didn't get any panels, create a dummy one where the domain and range\n // are simply the pixel dimensions.\n // that we modify.\n if (coordmap.length === 0) {\n var bounds = {\n top: 0,\n left: 0,\n right: el.clientWidth - 1,\n bottom: el.clientHeight - 1\n };\n\n coordmap[0] = {\n domain: bounds,\n range: bounds,\n mapping: {}\n };\n }\n\n // Add scaling functions to each panel\n imageutils.initPanelScales(coordmap);\n\n // Firefox doesn't have offsetX/Y, so we need to use an alternate\n // method of calculation for it. Even though other browsers do have\n // offsetX/Y, we need to calculate relative to $el, because sometimes the\n // mouse event can come with offset relative to other elements on the\n // page. This happens when the event listener is bound to, say, window.\n coordmap.mouseOffset = function(mouseEvent) {\n var offset = $el.offset();\n return {\n x: mouseEvent.pageX - offset.left,\n y: mouseEvent.pageY - offset.top\n };\n };\n\n // Given two sets of x/y coordinates, return an object representing the\n // min and max x and y values. (This could be generalized to any number\n // of points).\n coordmap.findBox = function(offset1, offset2) {\n return {\n xmin: Math.min(offset1.x, offset2.x),\n xmax: Math.max(offset1.x, offset2.x),\n ymin: Math.min(offset1.y, offset2.y),\n ymax: Math.max(offset1.y, offset2.y)\n };\n };\n\n\n // Shift an array of values so that they are within a min and max.\n // The vals will be shifted so that they maintain the same spacing\n // internally. If the range in vals is larger than the range of\n // min and max, the result might not make sense.\n coordmap.shiftToRange = function(vals, min, max) {\n if (!(vals instanceof Array))\n vals = [vals];\n\n var maxval = Math.max.apply(null, vals);\n var minval = Math.min.apply(null, vals);\n var shiftAmount = 0;\n if (maxval > max) {\n shiftAmount = max - maxval;\n } else if (minval < min) {\n shiftAmount = min - minval;\n }\n\n var newvals = [];\n for (var i=0; i<vals.length; i++) {\n newvals[i] = vals[i] + shiftAmount;\n }\n return newvals;\n };\n\n // Given an offset, return an object representing which panel it's in. The\n // `expand` argument tells it to expand the panel area by that many pixels.\n // It's possible for an offset to be within more than one panel, because\n // of the `expand` value. If that's the case, find the nearest panel.\n coordmap.getPanel = function(offset, expand) {\n expand = expand || 0;\n\n var x = offset.x;\n var y = offset.y;\n\n var matches = []; // Panels that match\n var dists = []; // Distance of offset to each matching panel\n var b;\n for (var i=0; i<coordmap.length; i++) {\n b = coordmap[i].range;\n\n if (x <= b.right + expand &&\n x >= b.left - expand &&\n y <= b.bottom + expand &&\n y >= b.top - expand)\n {\n matches.push(coordmap[i]);\n\n // Find distance from edges for x and y\n var xdist = 0;\n var ydist = 0;\n if (x > b.right && x <= b.right + expand) {\n xdist = x - b.right;\n } else if (x < b.left && x >= b.left - expand) {\n xdist = x - b.left;\n }\n if (y > b.bottom && y <= b.bottom + expand) {\n ydist = y - b.bottom;\n } else if (y < b.top && y >= b.top - expand) {\n ydist = y - b.top;\n }\n\n // Cartesian distance\n dists.push(Math.sqrt( Math.pow(xdist, 2) + Math.pow(ydist, 2) ));\n }\n }\n\n if (matches.length) {\n // Find shortest distance\n var min_dist = Math.min.apply(null, dists);\n for (i=0; i<matches.length; i++) {\n if (dists[i] === min_dist) {\n return matches[i];\n }\n }\n }\n\n return null;\n };\n\n // Is an offset in a panel? If supplied, `expand` tells us to expand the\n // panels by that many pixels in all directions.\n coordmap.isInPanel = function(offset, expand) {\n expand = expand || 0;\n\n if (coordmap.getPanel(offset, expand))\n return true;\n\n return false;\n };\n\n // Returns a function that sends mouse coordinates, scaled to data space.\n // If that function is passed a null event, it will send null.\n coordmap.mouseCoordinateSender = function(inputId, clip, nullOutside) {\n if (clip === undefined) clip = true;\n if (nullOutside === undefined) nullOutside = false;\n\n return function(e) {\n if (e === null) {\n exports.onInputChange(inputId, null);\n return;\n }\n\n var offset = coordmap.mouseOffset(e);\n // If outside of plotting region\n if (!coordmap.isInPanel(offset)) {\n if (nullOutside) {\n exports.onInputChange(inputId, null);\n return;\n }\n if (clip)\n return;\n }\n if (clip && !coordmap.isInPanel(offset)) return;\n\n var panel = coordmap.getPanel(offset);\n var coords = panel.scaleInv(offset);\n\n // Add the panel (facet) variables, if present\n $.extend(coords, panel.panel_vars);\n\n // Add variable name mappings\n coords.mapping = panel.mapping;\n\n // Add scaling information\n coords.domain = panel.domain;\n coords.range = panel.range;\n coords.log = panel.log;\n\n coords[\".nonce\"] = Math.random();\n exports.onInputChange(inputId, coords);\n };\n };\n};\n\n\n// This object provides two public event listeners: mousedown, and\n// dblclickIE8.\n// We need to make sure that, when the image is listening for double-\n// clicks, that a double-click doesn't trigger two click events. We'll\n// trigger custom mousedown2 and dblclick2 events with this mousedown\n// listener.\nimageutils.createClickInfo = function($el, dblclickId, dblclickDelay) {\n var clickTimer = null;\n var pending_e = null; // A pending mousedown2 event\n\n // Create a new event of type eventType (like 'mousedown2'), and trigger\n // it with the information stored in this.e.\n function triggerEvent(newEventType, e) {\n // Extract important info from e and construct a new event with type\n // eventType.\n var e2 = $.Event(newEventType, {\n which: e.which,\n pageX: e.pageX,\n pageY: e.pageY,\n offsetX: e.offsetX,\n offsetY: e.offsetY\n });\n\n $el.trigger(e2);\n }\n\n function triggerPendingMousedown2() {\n // It's possible that between the scheduling of a mousedown2 and the\n // time this callback is executed, someone else triggers a\n // mousedown2, so check for that.\n if (pending_e) {\n triggerEvent('mousedown2', pending_e);\n pending_e = null;\n }\n }\n\n // Set a timer to trigger a mousedown2 event, using information from the\n // last recorded mousdown event.\n function scheduleMousedown2(e) {\n pending_e = e;\n\n clickTimer = setTimeout(function() {\n triggerPendingMousedown2();\n }, dblclickDelay);\n }\n\n function mousedown(e) {\n // Listen for left mouse button only\n if (e.which !== 1) return;\n\n // If no dblclick listener, immediately trigger a mousedown2 event.\n if (!dblclickId) {\n triggerEvent('mousedown2', e);\n return;\n }\n\n // If there's a dblclick listener, make sure not to count this as a\n // click on the first mousedown; we need to wait for the dblclick\n // delay before we can be sure this click was a single-click.\n if (pending_e === null) {\n scheduleMousedown2(e);\n\n } else {\n clearTimeout(clickTimer);\n\n // If second click is too far away, it doesn't count as a double\n // click. Instead, immediately trigger a mousedown2 for the previous\n // click, and set this click as a new first click.\n if (pending_e &&\n Math.abs(pending_e.offsetX - e.offsetX) > 2 ||\n Math.abs(pending_e.offsetY - e.offsetY) > 2) {\n\n triggerPendingMousedown2();\n scheduleMousedown2(e);\n\n } else {\n // The second click was close to the first one. If it happened\n // within specified delay, trigger our custom 'dblclick2' event.\n pending_e = null;\n triggerEvent('dblclick2', e);\n }\n }\n }\n\n // IE8 needs a special hack because when you do a double-click it doesn't\n // trigger the click event twice - it directly triggers dblclick.\n function dblclickIE8(e) {\n e.which = 1; // In IE8, e.which is 0 instead of 1. ???\n triggerEvent('dblclick2', e);\n }\n\n return {\n mousedown: mousedown,\n dblclickIE8: dblclickIE8\n };\n};\n\n\n// ----------------------------------------------------------\n// Handler creators for click, hover, brush.\n// Each of these returns an object with a few public members. These public\n// members are callbacks that are meant to be bound to events on $el with\n// the same name (like 'mousedown').\n// ----------------------------------------------------------\n\nimageutils.createClickHandler = function(inputId, clip, coordmap) {\n var clickInfoSender = coordmap.mouseCoordinateSender(inputId, clip);\n\n return {\n mousedown: function(e) {\n // Listen for left mouse button only\n if (e.which !== 1) return;\n clickInfoSender(e);\n },\n onResetImg: function() { clickInfoSender(null); }\n };\n};\n\n\nimageutils.createHoverHandler = function(inputId, delay, delayType, clip,\n nullOutside, coordmap)\n{\n var sendHoverInfo = coordmap.mouseCoordinateSender(inputId, clip, nullOutside);\n\n var hoverInfoSender;\n if (delayType === 'throttle')\n hoverInfoSender = new Throttler(null, sendHoverInfo, delay);\n else\n hoverInfoSender = new Debouncer(null, sendHoverInfo, delay);\n\n // What to do when mouse exits the image\n var mouseout;\n if (nullOutside)\n mouseout = function() { hoverInfoSender.normalCall(null); };\n else\n mouseout = function() {};\n\n return {\n mousemove: function(e) { hoverInfoSender.normalCall(e); },\n mouseout: mouseout,\n onResetImg: function() { hoverInfoSender.immediateCall(null); }\n };\n};\n\n\n// Returns a brush handler object. This has three public functions:\n// mousedown, mousemove, and onResetImg.\nimageutils.createBrushHandler = function(inputId, $el, opts, coordmap, outputId) {\n // Parameter: expand the area in which a brush can be started, by this\n // many pixels in all directions. (This should probably be a brush option)\n var expandPixels = 20;\n\n // Represents the state of the brush\n var brush = imageutils.createBrush($el, opts, coordmap, expandPixels);\n\n // Brush IDs can span multiple image/plot outputs. When an output is brushed,\n // if a brush with the same ID is active on a different image/plot, it must\n // be dismissed (but without sending any data to the server). We implement\n // this by sending the shiny-internal:brushed event to all plots, and letting\n // each plot decide for itself what to do.\n //\n // The decision to have the event sent to each plot (as opposed to a single\n // event triggered on, say, the document) was made to make cleanup easier;\n // listening on an event on the document would prevent garbage collection\n // of plot outputs that are removed from the document.\n $el.on(\"shiny-internal:brushed.image_output\", function(e, coords) {\n // If the new brush shares our ID but not our output element ID, we\n // need to clear our brush (if any).\n if (coords.brushId === inputId && coords.outputId !== outputId) {\n $el.data(\"mostRecentBrush\", false);\n brush.reset();\n }\n });\n\n // Set cursor to one of 7 styles. We need to set the cursor on the whole\n // el instead of the brush div, because the brush div has\n // 'pointer-events:none' so that it won't intercept pointer events.\n // If `style` is null, don't add a cursor style.\n function setCursorStyle(style) {\n $el.removeClass('crosshair grabbable grabbing ns-resize ew-resize nesw-resize nwse-resize');\n\n if (style) $el.addClass(style);\n }\n\n function sendBrushInfo() {\n var coords = brush.boundsData();\n\n // We're in a new or reset state\n if (isNaN(coords.xmin)) {\n exports.onInputChange(inputId, null);\n // Must tell other brushes to clear.\n imageOutputBinding.find(document).trigger(\"shiny-internal:brushed\", {\n brushId: inputId, outputId: null\n });\n return;\n }\n\n var panel = brush.getPanel();\n\n // Add the panel (facet) variables, if present\n $.extend(coords, panel.panel_vars);\n\n // Add variable name mappings\n coords.mapping = panel.mapping;\n\n // Add scaling information\n coords.domain = panel.domain;\n coords.range = panel.range;\n coords.log = panel.log;\n\n coords.direction = opts.brushDirection;\n\n coords.brushId = inputId;\n coords.outputId = outputId;\n\n // Send data to server\n exports.onInputChange(inputId, coords);\n\n $el.data(\"mostRecentBrush\", true);\n imageOutputBinding.find(document).trigger(\"shiny-internal:brushed\", coords);\n }\n\n var brushInfoSender;\n if (opts.brushDelayType === 'throttle') {\n brushInfoSender = new Throttler(null, sendBrushInfo, opts.brushDelay);\n } else {\n brushInfoSender = new Debouncer(null, sendBrushInfo, opts.brushDelay);\n }\n\n function mousedown(e) {\n // This can happen when mousedown inside the graphic, then mouseup\n // outside, then mousedown inside. Just ignore the second\n // mousedown.\n if (brush.isBrushing() || brush.isDragging() || brush.isResizing()) return;\n\n // Listen for left mouse button only\n if (e.which !== 1) return;\n\n var offset = coordmap.mouseOffset(e);\n\n // Ignore mousedown events outside of plotting region, expanded by\n // a number of pixels specified in expandPixels.\n if (opts.brushClip && !coordmap.isInPanel(offset, expandPixels))\n return;\n\n brush.up({ x: NaN, y: NaN });\n brush.down(offset);\n\n\n if (brush.isInResizeArea(offset)) {\n brush.startResizing(offset);\n\n // Attach the move and up handlers to the window so that they respond\n // even when the mouse is moved outside of the image.\n $(document)\n .on('mousemove.image_brush', mousemoveResizing)\n .on('mouseup.image_brush', mouseupResizing);\n\n } else if (brush.isInsideBrush(offset)) {\n brush.startDragging(offset);\n setCursorStyle('grabbing');\n\n // Attach the move and up handlers to the window so that they respond\n // even when the mouse is moved outside of the image.\n $(document)\n .on('mousemove.image_brush', mousemoveDragging)\n .on('mouseup.image_brush', mouseupDragging);\n\n } else {\n var panel = coordmap.getPanel(offset, expandPixels);\n brush.startBrushing(panel.clip(offset));\n\n // Attach the move and up handlers to the window so that they respond\n // even when the mouse is moved outside of the image.\n $(document)\n .on('mousemove.image_brush', mousemoveBrushing)\n .on('mouseup.image_brush', mouseupBrushing);\n }\n }\n\n // This sets the cursor style when it's in the el\n function mousemove(e) {\n var offset = coordmap.mouseOffset(e);\n\n if (!(brush.isBrushing() || brush.isDragging() || brush.isResizing())) {\n // Set the cursor depending on where it is\n if (brush.isInResizeArea(offset)) {\n var r = brush.whichResizeSides(offset);\n\n if ((r.left && r.top) || (r.right && r.bottom)) {\n setCursorStyle('nwse-resize');\n } else if ((r.left && r.bottom) || (r.right && r.top)) {\n setCursorStyle('nesw-resize');\n } else if (r.left || r.right) {\n setCursorStyle('ew-resize');\n } else if (r.top || r.bottom) {\n setCursorStyle('ns-resize');\n }\n } else if (brush.isInsideBrush(offset)) {\n setCursorStyle('grabbable');\n } else if (coordmap.isInPanel(offset, expandPixels)) {\n setCursorStyle('crosshair');\n } else {\n setCursorStyle(null);\n }\n }\n }\n\n // mousemove handlers while brushing or dragging\n function mousemoveBrushing(e) {\n brush.brushTo(coordmap.mouseOffset(e));\n brushInfoSender.normalCall();\n }\n\n function mousemoveDragging(e) {\n brush.dragTo(coordmap.mouseOffset(e));\n brushInfoSender.normalCall();\n }\n\n function mousemoveResizing(e) {\n brush.resizeTo(coordmap.mouseOffset(e));\n brushInfoSender.normalCall();\n }\n\n // mouseup handlers while brushing or dragging\n function mouseupBrushing(e) {\n // Listen for left mouse button only\n if (e.which !== 1) return;\n\n $(document)\n .off('mousemove.image_brush')\n .off('mouseup.image_brush');\n\n brush.up(coordmap.mouseOffset(e));\n\n brush.stopBrushing();\n setCursorStyle('crosshair');\n\n // If the brush didn't go anywhere, hide the brush, clear value,\n // and return.\n if (brush.down().x === brush.up().x && brush.down().y === brush.up().y) {\n brush.reset();\n brushInfoSender.immediateCall();\n return;\n }\n\n // Send info immediately on mouseup, but only if needed. If we don't\n // do the pending check, we might send the same data twice (with\n // with difference nonce).\n if (brushInfoSender.isPending())\n brushInfoSender.immediateCall();\n }\n\n function mouseupDragging(e) {\n // Listen for left mouse button only\n if (e.which !== 1) return;\n\n $(document)\n .off('mousemove.image_brush')\n .off('mouseup.image_brush');\n\n brush.up(coordmap.mouseOffset(e));\n\n brush.stopDragging();\n setCursorStyle('grabbable');\n\n if (brushInfoSender.isPending())\n brushInfoSender.immediateCall();\n }\n\n function mouseupResizing(e) {\n // Listen for left mouse button only\n if (e.which !== 1) return;\n\n $(document)\n .off('mousemove.image_brush')\n .off('mouseup.image_brush');\n\n brush.up(coordmap.mouseOffset(e));\n brush.stopResizing();\n\n if (brushInfoSender.isPending())\n brushInfoSender.immediateCall();\n\n }\n\n // Brush maintenance: When an image is re-rendered, the brush must either\n // be removed (if brushResetOnNew) or imported (if !brushResetOnNew). The\n // \"mostRecentBrush\" bit is to ensure that when multiple outputs share the\n // same brush ID, inactive brushes don't send null values up to the server.\n\n // This should be called when the img (not the el) is reset\n function onResetImg() {\n if (opts.brushResetOnNew) {\n if ($el.data(\"mostRecentBrush\")) {\n brush.reset();\n brushInfoSender.immediateCall();\n }\n }\n }\n\n if (!opts.brushResetOnNew) {\n if ($el.data(\"mostRecentBrush\")) {\n brush.importOldBrush();\n brushInfoSender.immediateCall();\n }\n }\n\n return {\n mousedown: mousedown,\n mousemove: mousemove,\n onResetImg: onResetImg\n };\n};\n\n// Returns an object that represents the state of the brush. This gets wrapped\n// in a brushHandler, which provides various event listeners.\nimageutils.createBrush = function($el, opts, coordmap, expandPixels) {\n // Number of pixels outside of brush to allow start resizing\n var resizeExpand = 10;\n\n var el = $el[0];\n var $div = null; // The div representing the brush\n\n var state = {};\n reset();\n\n function reset() {\n // Current brushing/dragging/resizing state\n state.brushing = false;\n state.dragging = false;\n state.resizing = false;\n\n // Offset of last mouse down and up events\n state.down = { x: NaN, y: NaN };\n state.up = { x: NaN, y: NaN };\n\n // Which side(s) we're currently resizing\n state.resizeSides = {\n left: false,\n right: false,\n top: false,\n bottom: false\n };\n\n // Bounding rectangle of the brush, in pixel and data dimensions. We need to\n // record data dimensions along with pixel dimensions so that when a new\n // plot is sent, we can re-draw the brush div with the appropriate coords.\n state.boundsPx = {\n xmin: NaN,\n xmax: NaN,\n ymin: NaN,\n ymax: NaN\n };\n state.boundsData = {\n xmin: NaN,\n xmax: NaN,\n ymin: NaN,\n ymax: NaN\n };\n\n // Panel object that the brush is in\n state.panel = null;\n\n // The bounds at the start of a drag/resize\n state.changeStartBounds = {\n xmin: NaN,\n xmax: NaN,\n ymin: NaN,\n ymax: NaN\n };\n\n if ($div)\n $div.remove();\n }\n\n // If there's an existing brush div, use that div to set the new brush's\n // settings, provided that the x, y, and panel variables have the same names,\n // and there's a panel with matching panel variable values.\n function importOldBrush() {\n var oldDiv = $el.find('#' + el.id + '_brush');\n if (oldDiv.length === 0)\n return;\n\n var oldBoundsData = oldDiv.data('bounds-data');\n var oldPanel = oldDiv.data('panel');\n\n if (!oldBoundsData || !oldPanel)\n return;\n\n // Compare two objects. This checks that objects a and b have the same est\n // of keys, and that each key has the same value. This function isn't\n // perfect, but it's good enough for comparing variable mappings, below.\n function isEquivalent(a, b) {\n if (a === undefined) {\n if (b === undefined)\n return true;\n else\n return false;\n }\n if (a === null) {\n if (b === null)\n return true;\n else\n return false;\n }\n\n var aProps = Object.getOwnPropertyNames(a);\n var bProps = Object.getOwnPropertyNames(b);\n\n if (aProps.length !== bProps.length)\n return false;\n\n for (var i=0; i<aProps.length; i++) {\n var propName = aProps[i];\n if (a[propName] !== b[propName]) {\n return false;\n }\n }\n return true;\n }\n\n // Find a panel that has matching vars; if none found, we can't restore.\n // The oldPanel and new panel must match on their mapping vars, and the\n // values.\n for (var i=0; i<coordmap.length; i++){\n var curPanel = coordmap[i];\n\n if (isEquivalent(oldPanel.mapping, curPanel.mapping) &&\n isEquivalent(oldPanel.panel_vars, curPanel.panel_vars)) {\n // We've found a matching panel\n state.panel = coordmap[i];\n break;\n }\n }\n\n // If we didn't find a matching panel, remove the old div and return\n if (state.panel === null) {\n oldDiv.remove();\n return;\n }\n\n $div = oldDiv;\n\n boundsData(oldBoundsData);\n updateDiv();\n }\n\n // Return true if the offset is inside min/max coords\n function isInsideBrush(offset) {\n var bounds = state.boundsPx;\n return offset.x <= bounds.xmax && offset.x >= bounds.xmin &&\n offset.y <= bounds.ymax && offset.y >= bounds.ymin;\n }\n\n // Return true if offset is inside a region to start a resize\n function isInResizeArea(offset) {\n var sides = whichResizeSides(offset);\n return sides.left || sides.right || sides.top || sides.bottom;\n }\n\n // Return an object representing which resize region(s) the cursor is in.\n function whichResizeSides(offset) {\n var b = state.boundsPx;\n // Bounds with expansion\n var e = {\n xmin: b.xmin - resizeExpand,\n xmax: b.xmax + resizeExpand,\n ymin: b.ymin - resizeExpand,\n ymax: b.ymax + resizeExpand\n };\n var res = {\n left: false,\n right: false,\n top: false,\n bottom: false\n };\n\n if ((opts.brushDirection === 'xy' || opts.brushDirection === 'x') &&\n (offset.y <= e.ymax && offset.y >= e.ymin))\n {\n if (offset.x < b.xmin && offset.x >= e.xmin)\n res.left = true;\n else if (offset.x > b.xmax && offset.x <= e.xmax)\n res.right = true;\n }\n\n if ((opts.brushDirection === 'xy' || opts.brushDirection === 'y') &&\n (offset.x <= e.xmax && offset.x >= e.xmin))\n {\n if (offset.y < b.ymin && offset.y >= e.ymin)\n res.top = true;\n else if (offset.y > b.ymax && offset.y <= e.ymax)\n res.bottom = true;\n }\n\n return res;\n }\n\n\n // Sets the bounds of the brush, given a box and optional panel. This\n // will fit the box bounds into the panel, so we don't brush outside of it.\n // This knows whether we're brushing in the x, y, or xy directions, and sets\n // bounds accordingly.\n // If no box is passed in, just return current bounds.\n function boundsPx(box) {\n if (box === undefined)\n return state.boundsPx;\n\n var min = { x: box.xmin, y: box.ymin };\n var max = { x: box.xmax, y: box.ymax };\n\n var panel = state.panel;\n var panelBounds = panel.range;\n\n if (opts.brushClip) {\n min = panel.clip(min);\n max = panel.clip(max);\n }\n\n if (opts.brushDirection === 'xy') {\n // No change\n\n } else if (opts.brushDirection === 'x') {\n // Extend top and bottom of plotting area\n min.y = panelBounds.top;\n max.y = panelBounds.bottom;\n\n } else if (opts.brushDirection === 'y') {\n min.x = panelBounds.left;\n max.x = panelBounds.right;\n }\n\n state.boundsPx = {\n xmin: min.x,\n xmax: max.x,\n ymin: min.y,\n ymax: max.y\n };\n\n // Positions in data space\n var minData = state.panel.scaleInv(min);\n var maxData = state.panel.scaleInv(max);\n // For reversed scales, the min and max can be reversed, so use findBox\n // to ensure correct order.\n state.boundsData = coordmap.findBox(minData, maxData);\n\n // We also need to attach the data bounds and panel as data attributes, so\n // that if the image is re-sent, we can grab the data bounds to create a new\n // brush. This should be fast because it doesn't actually modify the DOM.\n $div.data('bounds-data', state.boundsData);\n $div.data('panel', state.panel);\n return undefined;\n }\n\n // Get or set the bounds of the brush using coordinates in the data space.\n function boundsData(box) {\n if (box === undefined) {\n return state.boundsData;\n }\n\n var min = { x: box.xmin, y: box.ymin };\n var max = { x: box.xmax, y: box.ymax };\n\n var minPx = state.panel.scale(min);\n var maxPx = state.panel.scale(max);\n\n // The scaling function can reverse the direction of the axes, so we need to\n // find the min and max again.\n boundsPx({\n xmin: Math.min(minPx.x, maxPx.x),\n xmax: Math.max(minPx.x, maxPx.x),\n ymin: Math.min(minPx.y, maxPx.y),\n ymax: Math.max(minPx.y, maxPx.y)\n });\n return undefined;\n }\n\n function getPanel() {\n return state.panel;\n }\n\n // Add a new div representing the brush.\n function addDiv() {\n if ($div) $div.remove();\n\n // Start hidden; we'll show it when movement occurs\n $div = $(document.createElement('div'))\n .attr('id', el.id + '_brush')\n .css({\n 'background-color': opts.brushFill,\n 'opacity': opts.brushOpacity,\n 'pointer-events': 'none',\n 'position': 'absolute'\n })\n .hide();\n\n var borderStyle = '1px solid ' + opts.brushStroke;\n if (opts.brushDirection === 'xy') {\n $div.css({\n 'border': borderStyle\n });\n } else if (opts.brushDirection === 'x') {\n $div.css({\n 'border-left': borderStyle,\n 'border-right': borderStyle\n });\n } else if (opts.brushDirection === 'y') {\n $div.css({\n 'border-top': borderStyle,\n 'border-bottom': borderStyle\n });\n }\n\n $el.append($div);\n $div.offset({x:0, y:0}).width(0).outerHeight(0);\n }\n\n // Update the brush div to reflect the current brush bounds.\n function updateDiv() {\n // Need parent offset relative to page to calculate mouse offset\n // relative to page.\n var imgOffset = $el.offset();\n var b = state.boundsPx;\n $div.offset({\n top: imgOffset.top + b.ymin,\n left: imgOffset.left + b.xmin\n })\n .outerWidth(b.xmax - b.xmin + 1)\n .outerHeight(b.ymax - b.ymin + 1);\n }\n\n function down(offset) {\n if (offset === undefined)\n return state.down;\n\n state.down = offset;\n return undefined;\n }\n\n function up(offset) {\n if (offset === undefined)\n return state.up;\n\n state.up = offset;\n return undefined;\n }\n\n function isBrushing() {\n return state.brushing;\n }\n\n function startBrushing() {\n state.brushing = true;\n addDiv();\n state.panel = coordmap.getPanel(state.down, expandPixels);\n\n boundsPx(coordmap.findBox(state.down, state.down));\n updateDiv();\n }\n\n function brushTo(offset) {\n boundsPx(coordmap.findBox(state.down, offset));\n $div.show();\n updateDiv();\n }\n\n function stopBrushing() {\n state.brushing = false;\n\n // Save the final bounding box of the brush\n boundsPx(coordmap.findBox(state.down, state.up));\n }\n\n function isDragging() {\n return state.dragging;\n }\n\n function startDragging() {\n state.dragging = true;\n state.changeStartBounds = $.extend({}, state.boundsPx);\n }\n\n function dragTo(offset) {\n // How far the brush was dragged\n var dx = offset.x - state.down.x;\n var dy = offset.y - state.down.y;\n\n // Calculate what new positions would be, before clipping.\n var start = state.changeStartBounds;\n var newBounds = {\n xmin: start.xmin + dx,\n xmax: start.xmax + dx,\n ymin: start.ymin + dy,\n ymax: start.ymax + dy\n };\n\n // Clip to the plotting area\n if (opts.brushClip) {\n var panelBounds = state.panel.range;\n\n // Convert to format for shiftToRange\n var xvals = [ newBounds.xmin, newBounds.xmax ];\n var yvals = [ newBounds.ymin, newBounds.ymax ];\n\n xvals = coordmap.shiftToRange(xvals, panelBounds.left, panelBounds.right);\n yvals = coordmap.shiftToRange(yvals, panelBounds.top, panelBounds.bottom);\n\n // Convert back to bounds format\n newBounds = {\n xmin: xvals[0],\n xmax: xvals[1],\n ymin: yvals[0],\n ymax: yvals[1]\n };\n }\n\n boundsPx(newBounds);\n updateDiv();\n }\n\n function stopDragging() {\n state.dragging = false;\n }\n\n function isResizing() {\n return state.resizing;\n }\n\n function startResizing() {\n state.resizing = true;\n state.changeStartBounds = $.extend({}, state.boundsPx);\n state.resizeSides = whichResizeSides(state.down);\n }\n\n function resizeTo(offset) {\n // How far the brush was dragged\n var dx = offset.x - state.down.x;\n var dy = offset.y - state.down.y;\n\n // Calculate what new positions would be, before clipping.\n var b = $.extend({}, state.changeStartBounds);\n var panelBounds = state.panel.range;\n\n if (state.resizeSides.left) {\n b.xmin = coordmap.shiftToRange([b.xmin + dx], panelBounds.left, b.xmax)[0];\n } else if (state.resizeSides.right) {\n b.xmax = coordmap.shiftToRange([b.xmax + dx], b.xmin, panelBounds.right)[0];\n }\n\n if (state.resizeSides.top) {\n b.ymin = coordmap.shiftToRange([b.ymin + dy], panelBounds.top, b.ymax)[0];\n } else if (state.resizeSides.bottom) {\n b.ymax = coordmap.shiftToRange([b.ymax + dy], b.ymin, panelBounds.bottom)[0];\n }\n\n boundsPx(b);\n updateDiv();\n }\n\n function stopResizing() {\n state.resizing = false;\n }\n\n return {\n reset: reset,\n\n importOldBrush: importOldBrush,\n isInsideBrush: isInsideBrush,\n isInResizeArea: isInResizeArea,\n whichResizeSides: whichResizeSides,\n\n boundsPx: boundsPx,\n boundsData: boundsData,\n getPanel: getPanel,\n\n down: down,\n up: up,\n\n isBrushing: isBrushing,\n startBrushing: startBrushing,\n brushTo: brushTo,\n stopBrushing: stopBrushing,\n\n isDragging: isDragging,\n startDragging: startDragging,\n dragTo: dragTo,\n stopDragging: stopDragging,\n\n isResizing: isResizing,\n startResizing: startResizing,\n resizeTo: resizeTo,\n stopResizing: stopResizing\n };\n};\n\nexports.resetBrush = function(brushId) {\n exports.onInputChange(brushId, null);\n imageOutputBinding.find(document).trigger(\"shiny-internal:brushed\", {\n brushId: brushId, outputId: null\n });\n};\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/output_binding_downloadlink.js\n\nvar downloadLinkOutputBinding = new OutputBinding();\n$.extend(downloadLinkOutputBinding, {\n find: function(scope) {\n return $(scope).find('a.shiny-download-link');\n },\n renderValue: function(el, data) {\n $(el).attr('href', data);\n }\n});\noutputBindings.register(downloadLinkOutputBinding, 'shiny.downloadLink');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/output_binding_datatable.js\n\nvar datatableOutputBinding = new OutputBinding();\n$.extend(datatableOutputBinding, {\n find: function(scope) {\n return $(scope).find('.shiny-datatable-output');\n },\n onValueError: function(el, err) {\n exports.unbindAll(el);\n this.renderError(el, err);\n },\n renderValue: function(el, data) {\n var $el = $(el).empty();\n if (!data || !data.colnames) return;\n\n var colnames = $.makeArray(data.colnames);\n var header = $.map(colnames, function(x) {\n return '<th>' + x + '</th>';\n }).join('');\n header = '<thead><tr>' + header + '</tr></thead>';\n var footer = '';\n if (data.options === null || data.options.searching !== false) {\n footer = $.map(colnames, function(x) {\n // placeholder needs to be escaped (and HTML tags are stripped off)\n return '<th><input type=\"text\" placeholder=\"' +\n escapeHTML(x.replace(/(<([^>]+)>)/ig, '')) +\n '\" /></th>';\n }).join('');\n footer = '<tfoot>' + footer + '</tfoot>';\n }\n var content = '<table class=\"table table-striped table-hover\">' +\n header + footer + '</table>';\n $el.append(content);\n\n // options that should be eval()ed\n if (data.evalOptions)\n $.each(data.evalOptions, function(i, x) {\n /*jshint evil: true */\n data.options[x] = eval('(' + data.options[x] + ')');\n });\n\n // caseInsensitive searching? default true\n var searchCI = data.options === null || typeof(data.options.search) === 'undefined' ||\n data.options.search.caseInsensitive !== false;\n var oTable = $(el).children(\"table\").DataTable($.extend({\n \"processing\": true,\n \"serverSide\": true,\n \"order\": [],\n \"orderClasses\": false,\n \"pageLength\": 25,\n \"ajax\": {\n \"url\": data.action,\n \"type\": \"POST\",\n \"data\": function(d) {\n d.search.caseInsensitive = searchCI;\n d.escape = data.escape;\n }\n }\n }, data.options));\n // the table object may need post-processing\n if (typeof data.callback === 'string') {\n /*jshint evil: true */\n var callback = eval('(' + data.callback + ')');\n if (typeof callback === 'function') callback(oTable);\n }\n\n // use debouncing for searching boxes\n $el.find('label input').first().unbind('keyup')\n .keyup(debounce(data.searchDelay, function() {\n oTable.search(this.value).draw();\n }));\n var searchInputs = $el.find(\"tfoot input\");\n if (searchInputs.length > 0) {\n // this is a little weird: aoColumns/bSearchable are still in DT 1.10\n // https://github.com/DataTables/DataTables/issues/388\n $.each(oTable.settings()[0].aoColumns, function(i, x) {\n // hide the text box if not searchable\n if (!x.bSearchable) searchInputs.eq(i).hide();\n });\n searchInputs.keyup(debounce(data.searchDelay, function() {\n oTable.column(searchInputs.index(this)).search(this.value).draw();\n }));\n }\n // FIXME: ugly scrollbars in tab panels b/c Bootstrap uses 'visible: auto'\n $el.parents('.tab-content').css('overflow', 'visible');\n }\n});\noutputBindings.register(datatableOutputBinding, 'shiny.datatableOutput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/output_binding_adapter.js\n\nvar OutputBindingAdapter = function(el, binding) {\n this.el = el;\n this.binding = binding;\n\n // If the binding actually has a resize method, override the prototype of\n // onResize with a version that does a makeResizeFilter on the element.\n if (binding.resize) {\n this.onResize = makeResizeFilter(el, function(width, height) {\n binding.resize(el, width, height);\n });\n }\n};\n(function() {\n this.getId = function() {\n return this.binding.getId(this.el);\n };\n this.onValueChange = function(data) {\n this.binding.onValueChange(this.el, data);\n };\n this.onValueError = function(err) {\n this.binding.onValueError(this.el, err);\n };\n this.showProgress = function(show) {\n this.binding.showProgress(this.el, show);\n };\n this.onResize = function() {\n // Intentionally left blank; see constructor\n };\n}).call(OutputBindingAdapter.prototype);\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding.js\n\nvar InputBinding = exports.InputBinding = function() {};\n\n(function() {\n\n// Returns a jQuery object or element array that contains the\n// descendants of scope that match this binding\nthis.find = function(scope) { throw \"Not implemented\"; };\n\nthis.getId = function(el) {\n return el['data-input-id'] || el.id;\n};\n\n// Gives the input a type in case the server needs to know it\n// to deserialize the JSON correctly\nthis.getType = function() { return false; };\nthis.getValue = function(el) { throw \"Not implemented\"; };\n\n// The callback method takes one argument, whose value is boolean. If true,\n// allow deferred (debounce or throttle) sending depending on the value of\n// getRatePolicy. If false, send value immediately.\nthis.subscribe = function(el, callback) { };\nthis.unsubscribe = function(el) { };\n\n// This is used for receiving messages that tell the input object to do\n// things, such as setting values (including min, max, and others).\n// 'data' should be an object with elements corresponding to value, min,\n// max, etc., as appropriate for the type of input object. It also should\n// trigger a change event.\nthis.receiveMessage = function(el, data) { throw \"Not implemented\"; };\nthis.getState = function(el, data) { throw \"Not implemented\"; };\n\nthis.getRatePolicy = function() { return null; };\n\n// Some input objects need initialization before being bound. This is\n// called when the document is ready (for statically-added input objects),\n// and when new input objects are added to the document with\n// htmlOutputBinding.renderValue() (for dynamically-added input objects).\n// This is called before the input is bound.\nthis.initialize = function(el) { };\n\n// This is called after unbinding the output.\nthis.dispose = function(el) { };\n\n}).call(InputBinding.prototype);\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_text.js\n\nvar textInputBinding = new InputBinding();\n$.extend(textInputBinding, {\n find: function(scope) {\n return $(scope).find('input[type=\"text\"], input[type=\"search\"], input[type=\"url\"], input[type=\"email\"]');\n },\n getId: function(el) {\n return InputBinding.prototype.getId.call(this, el) || el.name;\n },\n getValue: function(el) {\n return el.value;\n },\n setValue: function(el, value) {\n el.value = value;\n },\n subscribe: function(el, callback) {\n $(el).on('keyup.textInputBinding input.textInputBinding', function(event) {\n callback(true);\n });\n $(el).on('change.textInputBinding', function(event) {\n callback(false);\n });\n },\n unsubscribe: function(el) {\n $(el).off('.textInputBinding');\n },\n receiveMessage: function(el, data) {\n if (data.hasOwnProperty('value'))\n this.setValue(el, data.value);\n\n if (data.hasOwnProperty('label'))\n $(el).parent().find('label[for=\"' + $escape(el.id) + '\"]').text(data.label);\n\n $(el).trigger('change');\n },\n getState: function(el) {\n return {\n label: $(el).parent().find('label[for=\"' + $escape(el.id) + '\"]').text(),\n value: el.value\n };\n },\n getRatePolicy: function() {\n return {\n policy: 'debounce',\n delay: 250\n };\n }\n});\ninputBindings.register(textInputBinding, 'shiny.textInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_textarea.js\n\nvar textareaInputBinding = {};\n$.extend(textareaInputBinding, textInputBinding, {\n find: function(scope) {\n return $(scope).find('textarea');\n }\n});\ninputBindings.register(textareaInputBinding, 'shiny.textareaInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_password.js\n\nvar passwordInputBinding = {};\n$.extend(passwordInputBinding, textInputBinding, {\n find: function(scope) {\n return $(scope).find('input[type=\"password\"]');\n },\n getType: function(el) {\n return \"shiny.password\";\n }\n});\ninputBindings.register(passwordInputBinding, 'shiny.passwordInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_number.js\n\nvar numberInputBinding = {};\n$.extend(numberInputBinding, textInputBinding, {\n find: function(scope) {\n return $(scope).find('input[type=\"number\"]');\n },\n getValue: function(el) {\n var numberVal = $(el).val();\n if (/^\\s*$/.test(numberVal)) // Return null if all whitespace\n return null;\n else if (!isNaN(numberVal)) // If valid Javascript number string, coerce to number\n return +numberVal;\n else\n return numberVal; // If other string like \"1e6\", send it unchanged\n },\n setValue: function(el, value) {\n el.value = value;\n },\n getType: function(el) {\n return \"shiny.number\";\n },\n receiveMessage: function(el, data) {\n if (data.hasOwnProperty('value')) el.value = data.value;\n if (data.hasOwnProperty('min')) el.min = data.min;\n if (data.hasOwnProperty('max')) el.max = data.max;\n if (data.hasOwnProperty('step')) el.step = data.step;\n\n if (data.hasOwnProperty('label'))\n $(el).parent().find('label[for=\"' + $escape(el.id) + '\"]').text(data.label);\n\n $(el).trigger('change');\n },\n getState: function(el) {\n return { label: $(el).parent().find('label[for=\"' + $escape(el.id) + '\"]').text(),\n value: this.getValue(el),\n min: Number(el.min),\n max: Number(el.max),\n step: Number(el.step) };\n }\n});\ninputBindings.register(numberInputBinding, 'shiny.numberInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_checkbox.js\n\nvar checkboxInputBinding = new InputBinding();\n$.extend(checkboxInputBinding, {\n find: function(scope) {\n return $(scope).find('input[type=\"checkbox\"]');\n },\n getValue: function(el) {\n return el.checked;\n },\n setValue: function(el, value) {\n el.checked = value;\n },\n subscribe: function(el, callback) {\n $(el).on('change.checkboxInputBinding', function(event) {\n callback(true);\n });\n },\n unsubscribe: function(el) {\n $(el).off('.checkboxInputBinding');\n },\n getState: function(el) {\n return {\n label: $(el).parent().find('span').text(),\n value: el.checked\n };\n },\n receiveMessage: function(el, data) {\n if (data.hasOwnProperty('value'))\n el.checked = data.value;\n\n if (data.hasOwnProperty('label'))\n $(el).parent().find('span').text(data.label);\n\n $(el).trigger('change');\n }\n});\ninputBindings.register(checkboxInputBinding, 'shiny.checkboxInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_date.js\n\nvar dateInputBinding = new InputBinding();\n$.extend(dateInputBinding, {\n find: function(scope) {\n return $(scope).find('.shiny-date-input');\n },\n getType: function(el) {\n return \"shiny.date\";\n },\n // Return the date in an unambiguous format, yyyy-mm-dd (as opposed to a\n // format like mm/dd/yyyy)\n getValue: function(el) {\n var date = $(el).find('input').bsDatepicker('getUTCDate');\n return formatDateUTC(date);\n },\n // value must be an unambiguous string like '2001-01-01', or a Date object.\n setValue: function(el, value) {\n // R's NA, which is null here will remove current value\n if (value === null) {\n $(el).find('input').val('').bsDatepicker('update');\n return;\n }\n\n var date = this._newDate(value);\n // If date is invalid, do nothing\n if (isNaN(date))\n return;\n\n $(el).find('input').bsDatepicker('setUTCDate', date);\n },\n getState: function(el) {\n var $el = $(el);\n var $input = $el.find('input');\n\n var min = $input.data('datepicker').startDate;\n var max = $input.data('datepicker').endDate;\n\n // Stringify min and max. If min and max aren't set, they will be\n // -Infinity and Infinity; replace these with null.\n min = (min === -Infinity) ? null : formatDateUTC(min);\n max = (max === Infinity) ? null : formatDateUTC(max);\n\n // startViewMode is stored as a number; convert to string\n var startview = $input.data('datepicker').startViewMode;\n if (startview === 2) startview = 'decade';\n else if (startview === 1) startview = 'year';\n else if (startview === 0) startview = 'month';\n\n return {\n label: $el.find('label[for=\"' + $escape(el.id) + '\"]').text(),\n value: this.getValue(el),\n valueString: $input.val(),\n min: min,\n max: max,\n language: $input.data('datepicker').language,\n weekstart: $input.data('datepicker').weekStart,\n format: this._formatToString($input.data('datepicker').format),\n startview: startview\n };\n },\n receiveMessage: function(el, data) {\n var $input = $(el).find('input');\n\n if (data.hasOwnProperty('label'))\n $(el).find('label[for=\"' + $escape(el.id) + '\"]').text(data.label);\n\n if (data.hasOwnProperty('min'))\n this._setMin($input[0], data.min);\n\n if (data.hasOwnProperty('max'))\n this._setMax($input[0], data.max);\n\n // Must set value only after min and max have been set. If new value is\n // outside the bounds of the previous min/max, then the result will be a\n // blank input.\n if (data.hasOwnProperty('value'))\n this.setValue(el, data.value);\n\n $(el).trigger('change');\n },\n subscribe: function(el, callback) {\n $(el).on('keyup.dateInputBinding input.dateInputBinding', function(event) {\n // Use normal debouncing policy when typing\n callback(true);\n });\n $(el).on('changeDate.dateInputBinding change.dateInputBinding', function(event) {\n // Send immediately when clicked\n callback(false);\n });\n },\n unsubscribe: function(el) {\n $(el).off('.dateInputBinding');\n },\n getRatePolicy: function() {\n return {\n policy: 'debounce',\n delay: 250\n };\n },\n initialize: function(el) {\n var $input = $(el).find('input');\n\n var date = $input.data('initial-date');\n // If initial_date is null, set to current date\n if (date === undefined || date === null) {\n // Get local date, but as UTC\n date = this._dateAsUTC(new Date());\n }\n\n this.setValue(el, date);\n\n // Set the start and end dates, from min-date and max-date. These always\n // use yyyy-mm-dd format, instead of bootstrap-datepicker's built-in\n // support for date-startdate and data-enddate, which use the current\n // date format.\n if ($input.data('min-date') !== undefined) {\n this._setMin($input[0], $input.data('min-date'));\n }\n if ($input.data('max-date') !== undefined) {\n this._setMax($input[0], $input.data('max-date'));\n }\n },\n // Given a format object from a date picker, return a string\n _formatToString: function(format) {\n // Format object has structure like:\n // { parts: ['mm', 'dd', 'yy'], separators: ['', '/', '/' ,''] }\n var str = '';\n for (var i = 0; i < format.parts.length; i++) {\n str += format.separators[i] + format.parts[i];\n }\n str += format.separators[i];\n return str;\n },\n // Given an unambiguous date string or a Date object, set the min (start) date.\n // null will unset. undefined will result in no change,\n _setMin: function(el, date) {\n if (date === undefined)\n return;\n if (date === null) {\n $(el).bsDatepicker('setStartDate', null);\n\n } else {\n date = this._newDate(date);\n date = this._UTCDateAsLocal(date);\n if (!isNaN(date)) {\n // Workaround for https://github.com/eternicode/bootstrap-datepicker/issues/2010\n // If the start date when there's a two-digit year format, it will set\n // the date value to null. So we'll save the value, set the start\n // date, and the restore the value.\n var curValue = $(el).bsDatepicker('getUTCDate');\n $(el).bsDatepicker('setStartDate', date);\n $(el).bsDatepicker('setUTCDate', curValue);\n }\n }\n },\n // Given an unambiguous date string or a Date object, set the max (end) date\n // null will unset.\n _setMax: function(el, date) {\n if (date === undefined)\n return;\n if (date === null) {\n $(el).bsDatepicker('setEndDate', null);\n\n } else {\n date = this._newDate(date);\n date = this._UTCDateAsLocal(date);\n if (!isNaN(date)) {\n // Workaround for same issue as in _setMin.\n var curValue = $(el).bsDatepicker('getUTCDate');\n $(el).bsDatepicker('setEndDate', date);\n $(el).bsDatepicker('setUTCDate', curValue);\n }\n }\n },\n // Given a date string of format yyyy-mm-dd, return a Date object with\n // that date at 12AM UTC.\n // If date is a Date object, return it unchanged.\n _newDate: function(date) {\n if (date instanceof Date)\n return date;\n if (!date)\n return null;\n\n // Get Date object - this will be at 12AM in UTC, but may print\n // differently at the Javascript console.\n var d = parseDate(date);\n\n // If invalid date, return null\n if (isNaN(d))\n return null;\n\n return new Date(d.getTime());\n },\n // Given a Date object, return a Date object which has the same \"clock time\"\n // in UTC. For example, if input date is 2013-02-01 23:00:00 GMT-0600 (CST),\n // output will be 2013-02-01 23:00:00 UTC. Note that the JS console may\n // print this in local time, as \"Sat Feb 02 2013 05:00:00 GMT-0600 (CST)\".\n _dateAsUTC: function(date) {\n return new Date(date.getTime() - date.getTimezoneOffset() * 60000);\n },\n // The inverse of _dateAsUTC. This is needed to adjust time zones because\n // some bootstrap-datepicker methods only take local dates as input, and not\n // UTC.\n _UTCDateAsLocal: function(date) {\n return new Date(date.getTime() + date.getTimezoneOffset() * 60000);\n }\n});\ninputBindings.register(dateInputBinding, 'shiny.dateInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_daterange.js\n\nvar dateRangeInputBinding = {};\n$.extend(dateRangeInputBinding, dateInputBinding, {\n find: function(scope) {\n return $(scope).find('.shiny-date-range-input');\n },\n // Return the date in an unambiguous format, yyyy-mm-dd (as opposed to a\n // format like mm/dd/yyyy)\n getValue: function(el) {\n var $inputs = $(el).find('input');\n var start = $inputs.eq(0).bsDatepicker('getUTCDate');\n var end = $inputs.eq(1).bsDatepicker('getUTCDate');\n\n return [formatDateUTC(start), formatDateUTC(end)];\n },\n // value must be an object, with optional fields `start` and `end`. These\n // should be unambiguous strings like '2001-01-01', or Date objects.\n setValue: function(el, value) {\n if (!(value instanceof Object)) {\n return;\n }\n\n // Get the start and end input objects\n var $inputs = $(el).find('input');\n\n // If value is undefined, don't try to set\n // null will remove the current value\n if (value.start !== undefined) {\n if (value.start === null) {\n $inputs.eq(0).val('').bsDatepicker('update');\n } else {\n var start = this._newDate(value.start);\n $inputs.eq(0).bsDatepicker('setUTCDate', start);\n }\n }\n if (value.end !== undefined) {\n if (value.end === null) {\n $inputs.eq(1).val('').bsDatepicker('update');\n } else {\n var end = this._newDate(value.end);\n $inputs.eq(1).bsDatepicker('setUTCDate', end);\n }\n }\n },\n getState: function(el) {\n var $el = $(el);\n var $inputs = $el.find('input');\n var $startinput = $inputs.eq(0);\n var $endinput = $inputs.eq(1);\n\n // For many of the properties, assume start and end have the same values\n var min = $startinput.bsDatepicker('getStartDate');\n var max = $startinput.bsDatepicker('getEndDate');\n\n // Stringify min and max. If min and max aren't set, they will be\n // -Infinity and Infinity; replace these with null.\n min = (min === -Infinity) ? null : formatDateUTC(min);\n max = (max === Infinity) ? null : formatDateUTC(max);\n\n // startViewMode is stored as a number; convert to string\n var startview = $startinput.data('datepicker').startView;\n if (startview === 2) startview = 'decade';\n else if (startview === 1) startview = 'year';\n else if (startview === 0) startview = 'month';\n\n return {\n label: $el.find('label[for=\"' + $escape(el.id) + '\"]').text(),\n value: this.getValue(el),\n valueString: [ $startinput.val(), $endinput.val() ],\n min: min,\n max: max,\n weekstart: $startinput.data('datepicker').weekStart,\n format: this._formatToString($startinput.data('datepicker').format),\n language: $startinput.data('datepicker').language,\n startview: startview\n };\n },\n receiveMessage: function(el, data) {\n var $el = $(el);\n var $inputs = $el.find('input');\n var $startinput = $inputs.eq(0);\n var $endinput = $inputs.eq(1);\n\n if (data.hasOwnProperty('label'))\n $el.find('label[for=\"' + $escape(el.id) + '\"]').text(data.label);\n\n if (data.hasOwnProperty('min')) {\n this._setMin($startinput[0], data.min);\n this._setMin($endinput[0], data.min);\n }\n\n if (data.hasOwnProperty('max')) {\n this._setMax($startinput[0], data.max);\n this._setMax($endinput[0], data.max);\n }\n\n // Must set value only after min and max have been set. If new value is\n // outside the bounds of the previous min/max, then the result will be a\n // blank input.\n if (data.hasOwnProperty('value'))\n this.setValue(el, data.value);\n\n $el.trigger('change');\n },\n initialize: function(el) {\n var $el = $(el);\n var $inputs = $el.find('input');\n var $startinput = $inputs.eq(0);\n var $endinput = $inputs.eq(1);\n\n var start = $startinput.data('initial-date');\n var end = $endinput.data('initial-date');\n\n // If empty/null, use local date, but as UTC\n if (start === undefined || start === null)\n start = this._dateAsUTC(new Date());\n\n if (end === undefined || end === null)\n end = this._dateAsUTC(new Date());\n\n this.setValue(el, { \"start\": start, \"end\": end });\n\n // // Set the start and end dates, from min-date and max-date. These always\n // // use yyyy-mm-dd format, instead of bootstrap-datepicker's built-in\n // // support for date-startdate and data-enddate, which use the current\n // // date format.\n this._setMin($startinput[0], $startinput.data('min-date'));\n this._setMin($endinput[0], $startinput.data('min-date'));\n this._setMax($startinput[0], $endinput.data('max-date'));\n this._setMax($endinput[0], $endinput.data('max-date'));\n },\n subscribe: function(el, callback) {\n $(el).on('keyup.dateRangeInputBinding input.dateRangeInputBinding', function(event) {\n // Use normal debouncing policy when typing\n callback(true);\n });\n $(el).on('changeDate.dateRangeInputBinding change.dateRangeInputBinding', function(event) {\n // Send immediately when clicked\n callback(false);\n });\n },\n unsubscribe: function(el) {\n $(el).off('.dateRangeInputBinding');\n }\n});\ninputBindings.register(dateRangeInputBinding, 'shiny.dateRangeInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_select.js\n\nvar selectInputBinding = new InputBinding();\n$.extend(selectInputBinding, {\n find: function(scope) {\n return $(scope).find('select');\n },\n getId: function(el) {\n return InputBinding.prototype.getId.call(this, el) || el.name;\n },\n getValue: function(el) {\n return $(el).val();\n },\n setValue: function(el, value) {\n var selectize = this._selectize(el);\n if (typeof(selectize) !== 'undefined') {\n selectize.setValue(value);\n } else $(el).val(value);\n },\n getState: function(el) {\n // Store options in an array of objects, each with with value and label\n var options = new Array(el.length);\n for (var i = 0; i < el.length; i++) {\n options[i] = { value: el[i].value,\n label: el[i].label };\n }\n\n return {\n label: $(el).parent().find('label[for=\"' + $escape(el.id) + '\"]').text(),\n value: this.getValue(el),\n options: options\n };\n },\n receiveMessage: function(el, data) {\n var $el = $(el), selectize;\n\n // This will replace all the options\n if (data.hasOwnProperty('options')) {\n selectize = this._selectize(el);\n // Must destroy selectize before appending new options, otherwise\n // selectize will restore the original select\n if (selectize) selectize.destroy();\n // Clear existing options and add each new one\n $el.empty().append(data.options);\n this._selectize(el);\n }\n\n // re-initialize selectize\n if (data.hasOwnProperty('config')) {\n $el.parent()\n .find('script[data-for=\"' + $escape(el.id) + '\"]')\n .replaceWith(data.config);\n this._selectize(el, true);\n }\n\n // use server-side processing for selectize\n if (data.hasOwnProperty('url')) {\n selectize = this._selectize(el);\n selectize.clearOptions();\n var thiz = this, loaded = false;\n selectize.settings.load = function(query, callback) {\n var settings = selectize.settings;\n $.ajax({\n url: data.url,\n data: {\n query: query,\n field: JSON.stringify([settings.searchField]),\n value: settings.valueField,\n conju: settings.searchConjunction,\n maxop: settings.maxOptions\n },\n type: 'GET',\n error: function() {\n callback();\n },\n success: function(res) {\n callback(res);\n if (!loaded && data.hasOwnProperty('value'))\n thiz.setValue(el, data.value);\n loaded = true;\n }\n });\n };\n // perform an empty search after changing the `load` function\n selectize.load(function(callback) {\n selectize.settings.load.apply(selectize, ['', callback]);\n });\n } else if (data.hasOwnProperty('value')) {\n this.setValue(el, data.value);\n }\n\n if (data.hasOwnProperty('label'))\n $(el).parent().parent().find('label[for=\"' + $escape(el.id) + '\"]').text(data.label);\n\n $(el).trigger('change');\n },\n subscribe: function(el, callback) {\n $(el).on('change.selectInputBinding', function(event) {\n callback();\n });\n },\n unsubscribe: function(el) {\n $(el).off('.selectInputBinding');\n },\n initialize: function(el) {\n this._selectize(el);\n },\n _selectize: function(el, update) {\n if (!$.fn.selectize) return undefined;\n var $el = $(el);\n var config = $el.parent().find('script[data-for=\"' + $escape(el.id) + '\"]');\n if (config.length === 0) return undefined;\n var options = $.extend({\n labelField: 'label',\n valueField: 'value',\n searchField: ['label']\n }, JSON.parse(config.html()));\n // selectize created from selectInput()\n if (typeof(config.data('nonempty')) !== 'undefined') {\n options = $.extend(options, {\n onItemRemove: function(value) {\n if (this.getValue() === \"\")\n $(\"select#\" + $escape(el.id)).empty().append($(\"<option/>\", {\n \"value\": value,\n \"selected\": true\n })).trigger(\"change\");\n },\n onDropdownClose: function($dropdown) {\n if (this.getValue() === \"\")\n this.setValue($(\"select#\" + $escape(el.id)).val());\n }\n });\n }\n // options that should be eval()ed\n if (config.data('eval') instanceof Array)\n $.each(config.data('eval'), function(i, x) {\n /*jshint evil: true*/\n options[x] = eval('(' + options[x] + ')');\n });\n var control = $el.selectize(options)[0].selectize;\n // .selectize() does not really update settings; must destroy and rebuild\n if (update) {\n var settings = $.extend(control.settings, options);\n control.destroy();\n control = $el.selectize(settings)[0].selectize;\n }\n return control;\n }\n});\ninputBindings.register(selectInputBinding, 'shiny.selectInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_radio.js\n\nvar radioInputBinding = new InputBinding();\n$.extend(radioInputBinding, {\n find: function(scope) {\n return $(scope).find('.shiny-input-radiogroup');\n },\n getValue: function(el) {\n // Select the radio objects that have name equal to the grouping div's id\n return $('input:radio[name=\"' + $escape(el.id) + '\"]:checked').val();\n },\n setValue: function(el, value) {\n $('input:radio[name=\"' + $escape(el.id) + '\"][value=\"' + $escape(value) + '\"]').prop('checked', true);\n },\n getState: function(el) {\n var $objs = $('input:radio[name=\"' + $escape(el.id) + '\"]');\n\n // Store options in an array of objects, each with with value and label\n var options = new Array($objs.length);\n for (var i = 0; i < options.length; i++) {\n options[i] = { value: $objs[i].value,\n label: this._getLabel($objs[i]) };\n }\n\n return {\n label: $(el).parent().find('label[for=\"' + $escape(el.id) + '\"]').text(),\n value: this.getValue(el),\n options: options\n };\n },\n receiveMessage: function(el, data) {\n var $el = $(el);\n\n // This will replace all the options\n if (data.hasOwnProperty('options')) {\n // Clear existing options and add each new one\n $el.find('div.shiny-options-group').remove();\n // Backward compatibility: for HTML generated by shinybootstrap2 package\n $el.find('label.radio').remove();\n $el.append(data.options);\n }\n\n if (data.hasOwnProperty('value'))\n this.setValue(el, data.value);\n\n if (data.hasOwnProperty('label'))\n $(el).parent().find('label[for=\"' + $escape(el.id) + '\"]').text(data.label);\n\n $(el).trigger('change');\n },\n subscribe: function(el, callback) {\n $(el).on('change.radioInputBinding', function(event) {\n callback();\n });\n },\n unsubscribe: function(el) {\n $(el).off('.radioInputBinding');\n },\n // Given an input DOM object, get the associated label. Handles labels\n // that wrap the input as well as labels associated with 'for' attribute.\n _getLabel: function(obj) {\n // If <label><input /><span>label text</span></label>\n if (obj.parentNode.tagName === \"LABEL\") {\n return $.trim($(obj.parentNode).find('span').text());\n }\n\n return null;\n },\n // Given an input DOM object, set the associated label. Handles labels\n // that wrap the input as well as labels associated with 'for' attribute.\n _setLabel: function(obj, value) {\n // If <label><input /><span>label text</span></label>\n if (obj.parentNode.tagName === \"LABEL\") {\n $(obj.parentNode).find('span').text(value);\n }\n\n return null;\n }\n\n});\ninputBindings.register(radioInputBinding, 'shiny.radioInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_checkboxgroup.js\n\nvar checkboxGroupInputBinding = new InputBinding();\n$.extend(checkboxGroupInputBinding, {\n find: function(scope) {\n return $(scope).find('.shiny-input-checkboxgroup');\n },\n getValue: function(el) {\n // Select the checkbox objects that have name equal to the grouping div's id\n var $objs = $('input:checkbox[name=\"' + $escape(el.id) + '\"]:checked');\n var values = new Array($objs.length);\n for (var i = 0; i < $objs.length; i ++) {\n values[i] = $objs[i].value;\n }\n return values;\n },\n setValue: function(el, value) {\n // Clear all checkboxes\n $('input:checkbox[name=\"' + $escape(el.id) + '\"]').prop('checked', false);\n\n // Accept array\n if (value instanceof Array) {\n for (var i = 0; i < value.length; i++) {\n $('input:checkbox[name=\"' + $escape(el.id) + '\"][value=\"' + $escape(value[i]) + '\"]')\n .prop('checked', true);\n }\n // Else assume it's a single value\n } else {\n $('input:checkbox[name=\"' + $escape(el.id) + '\"][value=\"' + $escape(value) + '\"]')\n .prop('checked', true);\n }\n\n },\n getState: function(el) {\n var $objs = $('input:checkbox[name=\"' + $escape(el.id) + '\"]');\n\n // Store options in an array of objects, each with with value and label\n var options = new Array($objs.length);\n for (var i = 0; i < options.length; i++) {\n options[i] = { value: $objs[i].value,\n label: this._getLabel($objs[i]) };\n }\n\n return { label: $(el).find('label[for=\"' + $escape(el.id) + '\"]').text(),\n value: this.getValue(el),\n options: options\n };\n },\n receiveMessage: function(el, data) {\n var $el = $(el);\n\n // This will replace all the options\n if (data.hasOwnProperty('options')) {\n // Clear existing options and add each new one\n $el.find('div.shiny-options-group').remove();\n // Backward compatibility: for HTML generated by shinybootstrap2 package\n $el.find('label.checkbox').remove();\n $el.append(data.options);\n }\n\n if (data.hasOwnProperty('value'))\n this.setValue(el, data.value);\n\n if (data.hasOwnProperty('label'))\n $el.find('label[for=\"' + $escape(el.id) + '\"]').text(data.label);\n\n $(el).trigger('change');\n },\n subscribe: function(el, callback) {\n $(el).on('change.checkboxGroupInputBinding', function(event) {\n callback();\n });\n },\n unsubscribe: function(el) {\n $(el).off('.checkboxGroupInputBinding');\n },\n // Given an input DOM object, get the associated label. Handles labels\n // that wrap the input as well as labels associated with 'for' attribute.\n _getLabel: function(obj) {\n // If <label><input /><span>label text</span></label>\n if (obj.parentNode.tagName === \"LABEL\") {\n return $.trim($(obj.parentNode).find('span').text());\n }\n\n return null;\n },\n // Given an input DOM object, set the associated label. Handles labels\n // that wrap the input as well as labels associated with 'for' attribute.\n _setLabel: function(obj, value) {\n // If <label><input /><span>label text</span></label>\n if (obj.parentNode.tagName === \"LABEL\") {\n $(obj.parentNode).find('span').text(value);\n }\n\n return null;\n }\n\n});\ninputBindings.register(checkboxGroupInputBinding, 'shiny.checkboxGroupInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_actionbutton.js\n\nvar actionButtonInputBinding = new InputBinding();\n$.extend(actionButtonInputBinding, {\n find: function(scope) {\n return $(scope).find(\".action-button\");\n },\n getValue: function(el) {\n return $(el).data('val') || 0;\n },\n setValue: function(el, value) {\n $(el).data('val', value);\n },\n getType: function(el) {\n return 'shiny.action';\n },\n subscribe: function(el, callback) {\n $(el).on(\"click.actionButtonInputBinding\", function(e) {\n var $el = $(this);\n var val = $el.data('val') || 0;\n $el.data('val', val + 1);\n\n callback();\n });\n },\n getState: function(el) {\n return { value: this.getValue(el) };\n },\n receiveMessage: function(el, data) {\n var $el = $(el);\n\n // retrieve current label and icon\n var label = $el.text();\n var icon = '';\n\n // to check (and store) the previous icon, we look for a $el child\n // object that has an i tag, and some (any) class (this prevents\n // italicized text - which has an i tag but, usually, no class -\n // from being mistakenly selected)\n if ($el.find('i[class]').length > 0) {\n var icon_html = $el.find('i[class]')[0];\n if (icon_html === $el.children()[0]) { // another check for robustness\n icon = $(icon_html).prop('outerHTML');\n }\n }\n\n // update the requested properties\n if (data.hasOwnProperty('label')) label = data.label;\n if (data.hasOwnProperty('icon')) {\n icon = data.icon;\n // if the user entered icon=character(0), remove the icon\n if (icon.length === 0) icon = '';\n }\n\n // produce new html\n $el.html(icon + ' ' + label);\n },\n unsubscribe: function(el) {\n $(el).off(\".actionButtonInputBinding\");\n }\n});\ninputBindings.register(actionButtonInputBinding, 'shiny.actionButtonInput');\n\n\n$(document).on('click', 'a.action-button', function(e) {\n e.preventDefault();\n});\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/input_binding_tabinput.js\n\nvar bootstrapTabInputBinding = new InputBinding();\n$.extend(bootstrapTabInputBinding, {\n find: function(scope) {\n return $(scope).find('ul.nav.shiny-tab-input');\n },\n getValue: function(el) {\n var anchor = $(el).find('li:not(.dropdown).active').children('a');\n if (anchor.length === 1)\n return this._getTabName(anchor);\n\n return null;\n },\n setValue: function(el, value) {\n var self = this;\n var anchors = $(el).find('li:not(.dropdown)').children('a');\n anchors.each(function() {\n if (self._getTabName($(this)) === value) {\n $(this).tab('show');\n return false; // Break out of each()\n }\n return true;\n });\n },\n getState: function(el) {\n return { value: this.getValue(el) };\n },\n receiveMessage: function(el, data) {\n if (data.hasOwnProperty('value'))\n this.setValue(el, data.value);\n },\n subscribe: function(el, callback) {\n $(el).on('shown.bootstrapTabInputBinding shown.bs.tab.bootstrapTabInputBinding', function(event) {\n callback();\n });\n },\n unsubscribe: function(el) {\n $(el).off('.bootstrapTabInputBinding');\n },\n _getTabName: function(anchor) {\n return anchor.attr('data-value') || anchor.text();\n }\n});\ninputBindings.register(bootstrapTabInputBinding, 'shiny.bootstrapTabInput');\n","//---------------------------------------------------------------------\n// Source file: ../srcjs/reactlog.js\n\n$(document).on('keydown', function(e) {\n if (e.which !== 114 || (!e.ctrlKey && !e.metaKey) || (e.shiftKey || e.altKey))\n return;\n var url = 'reactlog?w=' + window.escape(exports.shinyapp.config.workerId) +\n \"&s=\" + window.escape(exports.shinyapp.config.sessionId);\n window.open(url);\n e.preventDefault();\n});\n\n"]}