Files
shiny/inst/www/shared/shiny.min.js
2025-12-11 11:56:42 -05:00

471 lines
126 KiB
JavaScript

/*! shiny 1.12.1.9000 | (c) 2012-2025 Posit Software, PBC. | License: GPL-3 | file LICENSE */
"use strict";(()=>{var Rr=Object.create;var Ni=Object.defineProperty;var Or=Object.getOwnPropertyDescriptor;var Vr=Object.getOwnPropertyNames;var zr=Object.getPrototypeOf,Nr=Object.prototype.hasOwnProperty;var Ui=n=>{throw TypeError(n)};var Ur=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Qr=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Vr(e))!Nr.call(n,s)&&s!==t&&Ni(n,s,{get:()=>e[s],enumerable:!(i=Or(e,s))||i.enumerable});return n};var M=(n,e,t)=>(t=n!=null?Rr(zr(n)):{},Qr(e||!n||!n.__esModule?Ni(t,"default",{value:n,enumerable:!0}):t,n));var Jn=(n,e,t)=>e.has(n)||Ui("Cannot "+t);var Qt=(n,e,t)=>(Jn(n,e,"read from private field"),t?t.call(n):e.get(n)),Jt=(n,e,t)=>e.has(n)?Ui("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Qi=(n,e,t,i)=>(Jn(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),F=(n,e,t)=>(Jn(n,e,"access private method"),t);var S=Ur((Qo,Ji)=>{Ji.exports=window.jQuery});var Ft=M(S());var Fi=!1,ji=!1,qi=-1;function Fn(n){Fi=n}function Xi(n){ji=n}function Wi(n){qi=n}function Gi(){return Fi}function Re(){return ji}function Ki(){return qi}var W;function Yi(n){W=n}function Jr(){let n=W.indexOf("MSIE ");if(Re()&&n>0)return parseInt(W.substring(n+5,W.indexOf(".",n)),10);if(W.indexOf("Trident/")>0){let t=W.indexOf("rv:");return parseInt(W.substring(t+3,W.indexOf(".",t)),10)}return-1}function Zi(){/\bQt\//.test(W)?((0,Ft.default)(document.documentElement).addClass("qt"),Fn(!0)):Fn(!1),/\bQt/.test(W)&&/\bMacintosh/.test(W)&&(0,Ft.default)(document.documentElement).addClass("qtmac"),/\bQt\/5/.test(W)&&/Linux/.test(W)&&(0,Ft.default)(document.documentElement).addClass("qt5"),Xi(/MSIE|Trident|Edge/.test(W)),Wi(Jr())}var es=M(S());function ts(){(0,es.default)(document).on("submit","form:not([action])",function(n){n.preventDefault()})}var ns=M(S());function is(){let n=window.history.pushState;window.history.pushState=function(...e){let t=n.apply(this,e);return(0,ns.default)(document).trigger("pushstate"),t}}var H=M(S());var ft=M(S());var te=M(S());function se(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function x(n,e){return Object.prototype.hasOwnProperty.call(n,e)&&n[e]!==void 0}function j(n,e){return n===void 0?e:n}function nt(n){return n==null?[]:Array.isArray(n)?n:[n]}var jn;function ss(n){jn=n}function be(){if(typeof jn>"u")throw"Shiny has not finish initialization yet. Please wait for the 'shiny-initialized' event.";return jn}function me(n,e,t){be().setInputValue(n,e,t)}function Oe(){return be().shinyapp}function rs(n){be().user=n}function os(n){be().forgetLastInputValue(n)}async function Ve(n){await be().bindAll(n)}function G(n,e=!1){be().unbindAll(n,e)}function dt(n){be().initializeInputs(n)}async function as(n,e){await Oe().bindOutput(n,e)}function ls(n,e){return Oe().unbindOutput(n,e)}function us(){return be().oncustommessage}var ds;function cs(){return ds}function ps(n){ds=n}function ms(){return be().createSocket}var ee=class{constructor(e,t,i){this.target=e,this.func=t,this.delayMs=i,this.timerId=null,this.args=null}normalCall(...e){this.$clearTimer(),this.args=e,this.timerId=setTimeout(()=>{this.timerId!==null&&(this.$clearTimer(),this.$invoke())},this.delayMs)}immediateCall(...e){this.$clearTimer(),this.args=e,this.$invoke()}isPending(){return this.timerId!==null}$clearTimer(){this.timerId!==null&&(clearTimeout(this.timerId),this.timerId=null)}$invoke(){this.args&&this.args.length>0?this.func.apply(this.target,this.args):this.func.apply(this.target),this.args=null}};function $e(n,e){let t=null;return function i(...s){t!==null&&(clearTimeout(t),t=null),t=setTimeout(()=>{t!==null&&(t=null,e.apply(i,s))},n)}}var ct=class{constructor(e,t){this.target=e,this.func=t}normalCall(...e){this.func.apply(this.target,e)}immediateCall(...e){this.func.apply(this.target,e)}};var Ce=class{constructor(e,t,i){this.target=e,this.func=t,this.delayMs=i,this.timerId=null,this.args=null}normalCall(...e){this.args=e,this.timerId===null&&this.$invoke()}immediateCall(...e){this.$clearTimer(),this.args=e,this.$invoke()}isPending(){return this.args!==null}$clearTimer(){this.timerId!==null&&(clearTimeout(this.timerId),this.timerId=null)}$invoke(){this.args!==null&&(this.func.apply(this.target,this.args),this.args=null,this.timerId=setTimeout(()=>{this.timerId!==null&&(this.$clearTimer(),this.isPending()&&this.$invoke())},this.delayMs))}};var qn=class{setImageSend(e,t){let i=new ee(null,t,0);return this.regular=function(){i.normalCall()},e.lastChanceCallback.push(function(){i.isPending()&&i.immediateCall()}),this.transitioned=$e(200,this.regular),i}},ue=new qn;var ve=M(S()),Fr=/<!--(SHINY.SINGLETON\[([\w]+)\])-->([\s\S]*?)<!--\/\1-->/,jr=/<head(?:\s[^>]*)?>([\s\S]*?)<\/head>/,jt={};function Xn(n,e,t){let i=Wr(n);switch(Xr(i.head),qr(i.singletons),t.toLowerCase()){case"replace":(0,ve.default)(e).html(i.html);break;case"beforebegin":(0,ve.default)(e).before(i.html);break;case"afterbegin":(0,ve.default)(e).prepend(i.html);break;case"beforeend":(0,ve.default)(e).append(i.html);break;case"afterend":(0,ve.default)(e).after(i.html);break;default:throw new Error("Unknown where position: "+t)}return i}function qr(n){ve.default.extend(jt,n)}function fs(n){if(typeof n=="string")jt[n]=!0;else if(n instanceof Array)for(let e=0;e<n.length;e++)jt[n[e]]=!0}function Xr(n){if(n.length>0){let e=(0,ve.default)("<div>"+n+"</div>").get(0),t=(0,ve.default)("head");for(;e.hasChildNodes();)t.append(e.firstChild)}}function Wr(n){let e={},t,i=function(a,r,l,u){return jt[l]||e[l]?"":(e[l]=!0,u)};for(;t=n.replace(Fr,i),n.length!==t.length;)n=t;let s=[],o=function(a,r){return s.push(r),""};for(;t=n.replace(jr,o),n.length!==t.length;)n=t;return{html:n,head:s.join(`
`),singletons:e}}async function re(n,e,t="replace"){t==="replace"&&G(n);let i="",s=[];e===null?i="":typeof e=="string"?i=e:typeof e=="object"&&(i=e.html,s=e.deps||[]),await mt(i,n,s,t);let o=n;if(t==="replace")dt(n),await Ve(n);else{let a=(0,te.default)(n).parent();if(a.length>0&&(o=a,t==="beforeBegin"||t==="afterEnd")){let r=a.parent();r.length>0&&(o=r)}dt(o),await Ve(o)}}function we(n,e,t="replace"){t==="replace"&&G(n);let i="",s=[];e===null?i="":typeof e=="string"?i=e:typeof e=="object"&&(i=e.html,s=e.deps||[]),Wn(i,n,s,t);let o=n;if(t==="replace")return dt(n),Ve(n);{let a=(0,te.default)(n).parent();if(a.length>0&&(o=a,t==="beforeBegin"||t==="afterEnd")){let r=a.parent();r.length>0&&(o=r)}return dt(o),Ve(o)}}async function mt(n,e,t,i="replace"){return await ze(t),Xn(n,e,i)}function Wn(n,e,t,i="replace"){return Gn(t),Xn(n,e,i)}async function ze(n){if(n)for(let e of n)await Yr(e)}function Gn(n){if(n)for(let e of n)Zr(e)}var pt={};function qt(n,e){pt[n]=e}function hs(n){if(!n.restyle)return!1;let e=Object.keys(pt),t=e.indexOf(n.name);return t===-1?!1:pt[e[t]]===n.version}function gs(n){let e=(0,te.default)("head").first(),t=function(o,a){let r=new XMLHttpRequest;r.open("GET",o),r.onload=function(){let l="shiny_restyle_"+o.split("?restyle")[0].replace(/\W/g,"_"),u=e.find("style#"+l),d=(0,te.default)("<style>").attr("id",l).html(r.responseText);e.append(d),u.remove(),s(a),ue.transitioned()},r.send()},i=function(o){if(!o)return null;for(let a=0;a<document.styleSheets.length;a++){let r=document.styleSheets[a];if(typeof r.href=="string"&&r.href.indexOf(o)>-1)return r}return null},s=function(o){o&&(o.disabled=!0,Re()&&(o.cssText=""),o.ownerNode instanceof Element&&(0,te.default)(o.ownerNode).remove())};n.map(o=>{let a=(0,te.default)(o),r=i(a.attr("href")),l=a.attr("href")+"?restyle="+new Date().getTime();Re()?t(l,r):(a.attr("href",l),a.attr("onload",()=>{let u=(0,te.default)("<div>").css("transition","0.1s all").css("position","absolute").css("top","-1000px").css("left","0");u.one("transitionend",()=>{u.remove(),s(r),ue.transitioned()}),(0,te.default)(document.body).append(u);let d="#"+Math.floor(Math.random()*16777215).toString(16);setTimeout(()=>u.css("color",d),10)}),e.append(o))})}function Kn(n){return n.stylesheet.map(e=>{e.rel===void 0&&(e.rel="stylesheet"),e.type===void 0&&(e.type="text/css");let t=document.createElement("link");return Object.entries(e).forEach(function([i,s]){i==="href"&&(s=encodeURI(s)),t.setAttribute(i,s||"")}),t})}function ys(n,e){let t=Kn(n);t.length!==0&&e.append(t)}function Gr(n,e){n.script.forEach(t=>{let i=document.createElement("script");Object.entries(t).forEach(function([s,o]){s==="src"&&(o=encodeURI(o)),i.setAttribute(s,o||"")}),e.append(i)})}async function Kr(n){let e=[];n.script.forEach(t=>{let i=document.createElement("script");x(t,"async")||(i.async=!1),Object.entries(t).forEach(function([o,a]){o==="src"&&(a=encodeURI(a)),i.setAttribute(o,a||"")});let s=new Promise((o,a)=>{i.onload=r=>{o(null)},i.onerror=r=>{a(r)}});e.push(s),document.head.append(i)}),await Promise.allSettled(e)}function bs(n,e){n.meta.forEach(t=>{let i=document.createElement("meta");for(let[s,o]of Object.entries(t))i.setAttribute(s,o);e.append(i)})}function vs(n,e){n.attachment.forEach(t=>{let i=(0,te.default)("<link rel='attachment'>").attr("id",n.name+"-"+t.key+"-attachment").attr("href",encodeURI(t.href));e.append(i)})}function ws(n,e){if(n.head){let t=(0,te.default)("<head></head>");t.html(n.head),e.append(t.children())}}async function Yr(n){let e=xs(n);if(hs(e))return gs(Kn(e)),!0;if(x(pt,e.name))return!1;qt(e.name,e.version);let t=(0,te.default)("head").first();return bs(e,t),ys(e,t),await Kr(e),vs(e,t),ws(e,t),!0}function Zr(n){let e=xs(n);if(hs(e))return gs(Kn(e)),!0;if(x(pt,e.name))return!1;qt(e.name,e.version);let t=(0,te.default)("head").first();return bs(e,t),ys(e,t),Gr(e,t),vs(e,t),ws(e,t),!0}function xs(n){let e=n.src?.href,t={name:n.name,version:n.version,restyle:n.restyle,meta:[],stylesheet:[],script:[],attachment:[],head:n.head};n.meta&&(Array.isArray(n.meta)?t.meta=n.meta:t.meta=Object.entries(n.meta).map(function([s,o]){return{name:s,content:o}})),t.stylesheet=nt(n.stylesheet).map(s=>(typeof s=="string"&&(s={href:s}),e&&(s.href=e+"/"+s.href),s)),t.script=nt(n.script).map(s=>(typeof s=="string"&&(s={src:s}),e&&(s.src=e+"/"+s.src),s));let i=n.attachment;return i||(i=[]),typeof i=="string"&&(i=[i]),Array.isArray(i)?i=i.map((o,a)=>typeof o=="string"?{key:(a+1).toString(),href:o}:o):i=Object.entries(i).map(function([s,o]){return{key:s,href:o}}),t.attachment=i.map(s=>(e&&(s.href=e+"/"+s.href),s)),t}function Yn(){return window.devicePixelRatio}function Ts(n){let e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;","/":"&#x2F;"};return n.replace(/[&<>'"/]/g,function(t){return e[t]})}function Xt(){return Math.floor(4294967296+Math.random()*64424509440).toString(16)}function Ne(n){if(!(!n||!n.toLowerCase))switch(n.toLowerCase()){case"true":return!0;case"false":return!1;default:return}}function fe(n,e){let t;if("currentStyle"in n)t=n.currentStyle[e];else{let i=document?.defaultView?.getComputedStyle(n,null);i&&(t=i.getPropertyValue(e))}return t}function Is(n,e){let t=n.toString();for(;t.length<e;)t="0"+t;return t}function ei(n,e=1){if(e<1)throw"Significant digits must be at least 1.";return parseFloat(n.toPrecision(e))}function Es(n){let e=new Date(n);return e.toString()==="Invalid Date"&&(e=new Date(n.replace(/-/g,"/"))),e}function de(n){return n instanceof Date?n.getUTCFullYear()+"-"+Is(n.getUTCMonth()+1,2)+"-"+Is(n.getUTCDate(),2):null}function Ss(n,e){let t={};return function(){let i=n.getBoundingClientRect(),s={w:i.width,h:i.height};s.w===0&&s.h===0||s.w===t.w&&s.h===t.h||(t=s,e(s.w,s.h))}}function ti(){return Yn()?Math.round(Yn()*100)/100:1}function ni(n){let e=n.getBoundingClientRect(),t=n.currentCSSZoom||1;return{width:e.width/t,height:e.height/t}}function Ms(n){let e=n.replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\b]/g,"\\b"),t;try{t=new Function(`with (this) {
try {
return (${n});
} catch (e) {
console.error('Error evaluating expression: ${e}');
throw e;
}
}`)}catch(i){throw console.error("Error parsing expression: "+n),i}return function(i){return t.call(i)}}function $s(n,e){function t(i,s){let o=0,a=0,r=[];for(;o<i.length&&a<s.length;)Number(e(i[o],s[a]))<=0?r.push(i[o++]):r.push(s[a++]);for(;o<i.length;)r.push(i[o++]);for(;a<s.length;)r.push(s[a++]);return r}n=n.slice(0);for(let i=1;i<n.length;i*=2)for(let s=0;s<n.length;s+=i*2){let o=n.slice(s,s+i),a=n.slice(s+i,s+i*2),r=t(o,a),l=[s,r.length];Array.prototype.push.apply(l,r),Array.prototype.splice.apply(n,l)}return n}function E(n){return typeof n>"u"?n:n.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g,"\\$1")}function ce(n,e){let t={};return Object.keys(n).forEach(i=>{t[i]=e(n[i],i,n)}),t}function Cs(n){return typeof n=="number"&&isNaN(n)}function Zn(n,e){if(ft.default.type(n)==="object"&&ft.default.type(e)==="object"){let t=n,i=e;if(Object.keys(t).length!==Object.keys(i).length)return!1;for(let s in t)if(!se(i,s)||!Zn(t[s],i[s]))return!1;return!0}else if(ft.default.type(n)==="array"&&ft.default.type(e)==="array"){let t=n,i=e;if(t.length!==i.length)return!1;for(let s=0;s<t.length;s++)if(!Zn(t[s],i[s]))return!1;return!0}else return n===e}function ii(...n){if(n.length<2)throw new Error("equal requires at least two arguments.");for(let e=0;e<n.length-1;e++)if(!Zn(n[e],n[e+1]))return!1;return!0}var ks=function(n,e,t){function i(a){return(a+"").replace(/-/,".").replace(/(\.0)+[^.]*$/,"").split(".")}function s(a,r){let l=i(a),u=i(r),d=Math.min(l.length,u.length),c;for(let p=0;p<d;p++)if(c=parseInt(l[p],10)-parseInt(u[p],10),c!==0)return c;return l.length-u.length}let o=s(n,t);if(e==="==")return o===0;if(e===">=")return o>=0;if(e===">")return o>0;if(e==="<=")return o<=0;if(e==="<")return o<0;throw`Unknown operator: ${e}`};async function q(n,e){if(!(typeof n>"u")){if(e.length!==1)throw new Error("labelNode must be of length 1");typeof n=="string"&&(n={html:n,deps:[]}),n.html===""?e.addClass("shiny-label-null"):(await we(e,n),e.removeClass("shiny-label-null"))}}function ht(n){let e=document.createElement("a");e.href="/";let t=document.createElement("div");t.style.setProperty("position","absolute","important"),t.style.setProperty("top","-1000px","important"),t.style.setProperty("left","0","important"),t.style.setProperty("width","30px","important"),t.style.setProperty("height","10px","important"),t.appendChild(e),n.appendChild(t);let i=window.getComputedStyle(e).getPropertyValue("color");return n.removeChild(t),i}function si(){return!window.bootstrap}function Wt(){return"__SHINY_DEV_MODE__"in window?!!window.__SHINY_DEV_MODE__:!1}var it=class{constructor(){this.bindings=[];this.bindingNames={}}register(e,t,i=0){let s={binding:e,priority:i};this.bindings.unshift(s),t&&(this.bindingNames[t]=s,e.name=t)}setPriority(e,t){let i=this.bindingNames[e];if(!i)throw"Tried to set priority on unknown binding "+e;i.priority=t||0}getPriority(e){let t=this.bindingNames[e];return t?t.priority:!1}getBindings(){return $s(this.bindings,function(e,t){return t.priority-e.priority})}};var P=class{find(e){throw"Not implemented"}getId(e){return e.getAttribute("data-input-id")||e.id}getType(e){return null}getValue(e){throw"Not implemented"}subscribe(e,t){}unsubscribe(e){}receiveMessage(e,t){throw"Not implemented"}getState(e){throw"Not implemented"}getRatePolicy(e){return null}initialize(e){}dispose(e){}};var ke=M(S());var Gt=class extends P{find(e){return(0,ke.default)(e).find(".action-button")}getValue(e){return(0,ke.default)(e).data("val")||0}setValue(e,t){(0,ke.default)(e).data("val",t)}getType(e){return"shiny.action"}subscribe(e,t){(0,ke.default)(e).on("click.actionButtonInputBinding",function(){let i=(0,ke.default)(this),s=i.data("val")||0;i.data("val",s+1),t(!1)})}getState(e){return{value:this.getValue(e)}}async receiveMessage(e,t){if(x(t,"icon")){let i=e.querySelector(":scope > .action-icon");i||(i=document.createElement("span"),i.className="action-icon",e.prepend(i)),await we(i,t.icon)}if(x(t,"label")){let i=e.querySelector(":scope > .action-label");i||(i=document.createElement("span"),i.className="action-label",e.appendChild(i)),await we(i,t.label)}x(t,"disabled")&&(t.disabled?e.setAttribute("disabled",""):e.removeAttribute("disabled"))}unsubscribe(e){(0,ke.default)(e).off(".actionButtonInputBinding")}};(0,ke.default)(document).on("click","a.action-button",function(n){n.preventDefault()});var Ue=M(S());var Kt=class extends P{find(e){return(0,Ue.default)(e).find('input[type="checkbox"]')}getValue(e){return e.checked}setValue(e,t){e.checked=t}subscribe(e,t){(0,Ue.default)(e).on("change.checkboxInputBinding",function(){t(!0)})}unsubscribe(e){(0,Ue.default)(e).off(".checkboxInputBinding")}getState(e){return{label:(0,Ue.default)(e).parent().find("span").text(),value:e.checked}}async receiveMessage(e,t){if(x(t,"value")&&(e.checked=t.value),x(t,"label")){let i=(0,Ue.default)(e).parent().find("span");await we(i,t.label)}(0,Ue.default)(e).trigger("change")}};var ne=M(S());function Hs(n){return(0,ne.default)(n).find('label[for="'+E(n.id)+'"]')}function eo(n){let e=n.parentNode;return e.tagName==="LABEL"?(0,ne.default)(e).find("span").text().trim():null}var Yt=class extends P{find(e){return(0,ne.default)(e).find(".shiny-input-checkboxgroup")}getValue(e){let t=(0,ne.default)('input:checkbox[name="'+E(e.id)+'"]:checked'),i=new Array(t.length);for(let s=0;s<t.length;s++)i[s]=t[s].value;return i}setValue(e,t){if(t=t??[],(0,ne.default)('input:checkbox[name="'+E(e.id)+'"]').prop("checked",!1),t instanceof Array)for(let i=0;i<t.length;i++)(0,ne.default)('input:checkbox[name="'+E(e.id)+'"][value="'+E(t[i])+'"]').prop("checked",!0);else(0,ne.default)('input:checkbox[name="'+E(e.id)+'"][value="'+E(t)+'"]').prop("checked",!0)}getState(e){let t=(0,ne.default)('input:checkbox[name="'+E(e.id)+'"]'),i=new Array(t.length);for(let s=0;s<i.length;s++)i[s]={value:t[s].value,label:eo(t[s])};return{label:Hs(e).text(),value:this.getValue(e),options:i}}async receiveMessage(e,t){let i=(0,ne.default)(e);x(t,"options")&&(i.find("div.shiny-options-group").remove(),i.find("label.checkbox").remove(),i.append(t.options)),x(t,"value")&&this.setValue(e,t.value),await q(t.label,Hs(e)),(0,ne.default)(e).trigger("change")}subscribe(e,t){(0,ne.default)(e).on("change.checkboxGroupInputBinding",function(){t(!1)})}unsubscribe(e){(0,ne.default)(e).off(".checkboxGroupInputBinding")}};var O=M(S());var gt=class extends P{find(e){return(0,O.default)(e).find(".shiny-date-input")}getType(e){return"shiny.date"}subscribe(e,t){(0,O.default)(e).on("changeDate.dateInputBinding change.dateInputBinding",function(){t(!1)})}unsubscribe(e){(0,O.default)(e).off(".dateInputBinding")}getRatePolicy(){return{policy:"debounce",delay:250}}setValue(e,t){throw"not implemented"}initialize(e){let t=(0,O.default)(e).find("input"),i=t.data("initial-date");i==null&&(i=this._floorDateTime(this._dateAsUTC(new Date))),this.setValue(e,i),t.data("min-date")!==void 0&&this._setMin(t[0],t.data("min-date")),t.data("max-date")!==void 0&&this._setMax(t[0],t.data("max-date"))}_getLabelNode(e){return(0,O.default)(e).find('label[for="'+E(e.id)+'"]')}_formatToString(e){let t="",i;for(i=0;i<e.parts.length;i++)t+=e.separators[i]+e.parts[i];return t+=e.separators[i],t}_setMin(e,t){if(t===null){(0,O.default)(e).bsDatepicker("setStartDate",null);return}let i=this._newDate(t);if(i===null||(t=i,isNaN(t.valueOf())))return;let s=(0,O.default)(e).bsDatepicker("getUTCDate");(0,O.default)(e).bsDatepicker("setStartDate",this._utcDateAsLocal(t)),t&&s&&t.getTime()>s.getTime()?(0,O.default)(e).bsDatepicker("clearDates"):(0,O.default)(e).bsDatepicker("setUTCDate",s)}_setMax(e,t){if(t===null){(0,O.default)(e).bsDatepicker("setEndDate",null);return}let i=this._newDate(t);if(i===null||(t=i,isNaN(t.valueOf())))return;let s=(0,O.default)(e).bsDatepicker("getUTCDate");(0,O.default)(e).bsDatepicker("setEndDate",this._utcDateAsLocal(t)),t&&s&&t.getTime()<s.getTime()?(0,O.default)(e).bsDatepicker("clearDates"):(0,O.default)(e).bsDatepicker("setUTCDate",s)}_newDate(e){if(e instanceof Date)return e;if(!e)return null;let t=Es(e);return isNaN(t.valueOf())?null:t}_floorDateTime(e){return e=new Date(e.getTime()),e.setUTCHours(0,0,0,0),e}_dateAsUTC(e){return new Date(e.getTime()-e.getTimezoneOffset()*6e4)}_utcDateAsLocal(e){return new Date(e.getTime()+e.getTimezoneOffset()*6e4)}},Zt=class extends gt{getValue(e){let t=(0,O.default)(e).find("input").bsDatepicker("getUTCDate");return de(t)}setValue(e,t){if(t===null){(0,O.default)(e).find("input").val("").bsDatepicker("update");return}let i=this._newDate(t);i!==null&&(isNaN(i.valueOf())||(0,O.default)(e).find("input").bsDatepicker("setUTCDate",i))}getState(e){let i=(0,O.default)(e).find("input"),s=i.data("datepicker").startDate,o=i.data("datepicker").endDate;s=s===-1/0?null:de(s),o=o===1/0?null:de(o);let a=i.data("datepicker").startViewMode;return a===2?a="decade":a===1?a="year":a===0&&(a="month"),{label:this._getLabelNode(e).text(),value:this.getValue(e),valueString:i.val(),min:s,max:o,language:i.data("datepicker").language,weekstart:i.data("datepicker").weekStart,format:this._formatToString(i.data("datepicker").format),startview:a}}async receiveMessage(e,t){let i=(0,O.default)(e).find("input");await q(t.label,this._getLabelNode(e)),x(t,"min")&&this._setMin(i[0],t.min),x(t,"max")&&this._setMax(i[0],t.max),x(t,"value")&&this.setValue(e,t.value),(0,O.default)(e).trigger("change")}};var he=M(S());function Ds(n){return(0,he.default)(n).find('label[for="'+E(n.id)+'"]')}var en=class extends gt{find(e){return(0,he.default)(e).find(".shiny-date-range-input")}getValue(e){let t=(0,he.default)(e).find("input"),i=t.eq(0).bsDatepicker("getUTCDate"),s=t.eq(1).bsDatepicker("getUTCDate");return[de(i),de(s)]}setValue(e,t){if(!(t instanceof Object))return;let i=(0,he.default)(e).find("input");if(t.start!==void 0)if(t.start===null)i.eq(0).val("").bsDatepicker("update");else{let s=this._newDate(t.start);i.eq(0).bsDatepicker("setUTCDate",s)}if(t.end!==void 0)if(t.end===null)i.eq(1).val("").bsDatepicker("update");else{let s=this._newDate(t.end);i.eq(1).bsDatepicker("setUTCDate",s)}}getState(e){let i=(0,he.default)(e).find("input"),s=i.eq(0),o=i.eq(1),a=s.bsDatepicker("getStartDate"),r=s.bsDatepicker("getEndDate"),l=a===-1/0?null:de(a),u=r===1/0?null:de(r),d=s.data("datepicker").startView;return d===2?d="decade":d===1?d="year":d===0&&(d="month"),{label:Ds(e).text(),value:this.getValue(e),valueString:[s.val(),o.val()],min:l,max:u,weekstart:s.data("datepicker").weekStart,format:this._formatToString(s.data("datepicker").format),language:s.data("datepicker").language,startview:d}}async receiveMessage(e,t){let i=(0,he.default)(e),s=i.find("input"),o=s.eq(0),a=s.eq(1);await q(t.label,Ds(e)),x(t,"min")&&(this._setMin(o[0],t.min),this._setMin(a[0],t.min)),x(t,"max")&&(this._setMax(o[0],t.max),this._setMax(a[0],t.max)),x(t,"value")&&this.setValue(e,t.value),i.trigger("change")}initialize(e){let i=(0,he.default)(e).find("input"),s=i.eq(0),o=i.eq(1),a=s.data("initial-date"),r=o.data("initial-date");a==null&&(a=this._dateAsUTC(new Date)),r==null&&(r=this._dateAsUTC(new Date)),this.setValue(e,{start:a,end:r}),this._setMin(s[0],s.data("min-date")),this._setMin(o[0],s.data("min-date")),this._setMax(s[0],o.data("max-date")),this._setMax(o[0],o.data("max-date"))}subscribe(e,t){(0,he.default)(e).on("changeDate.dateRangeInputBinding change.dateRangeInputBinding",function(){t(!1)})}unsubscribe(e){(0,he.default)(e).off(".dateRangeInputBinding")}};var X=M(S());var ge=M(S());var ri=M(S());function Ps(n,e,t,i,s,o){let a=ri.default.Event("shiny:inputchanged");return a.name=n,a.value=e,a.binding=t,a.el=i,a.inputType=s,(0,ri.default)(o).trigger(a),a}var oi=class{constructor(e,t=!0){this.fileIndex=-1;this.aborted=!1;this.completed=!1;this.files=Array.from(e),t&&this.$run()}onBegin(e,t){setTimeout(t,0)}onFile(e,t){setTimeout(t,0)}onComplete(){}onAbort(){}abort(){this.completed||this.aborted||(this.aborted=!0,this.onAbort())}$getRun(){let e=!1;return()=>{e||(e=!0,this.$run())}}$run(){if(this.aborted||this.completed)return;if(this.fileIndex<0){this.fileIndex=0,this.onBegin(this.files,this.$getRun());return}if(this.fileIndex===this.files.length){this.completed=!0,this.onComplete();return}let e=this.files[this.fileIndex++];this.onFile(e,this.$getRun())}},yt=class extends oi{constructor(e,t,i,s){super(i,!1),this.shinyapp=e,this.id=t,this.el=s,this.$run()}makeRequest(e,t,i,s,o){this.shinyapp.makeRequest(e,t,i,s,o)}onBegin(e,t){this.$setError(null),this.$setActive(!0),this.$setVisible(!0),this.onProgress(null,0),this.totalBytes=0,this.progressBytes=0,ge.default.each(e,(s,o)=>{this.totalBytes+=o.size});let i=ge.default.map(e,function(s){return{name:s.name,size:s.size,type:s.type}});this.makeRequest("uploadInit",[i],s=>{this.jobId=s.jobId,this.uploadUrl=s.uploadUrl,t()},s=>{this.onError(s)},void 0)}onFile(e,t){this.onProgress(e,0),ge.default.ajax(this.uploadUrl,{type:"POST",cache:!1,xhr:()=>{if(typeof ge.default.ajaxSettings.xhr!="function")throw"jQuery's XHR is not a function";let i=ge.default.ajaxSettings.xhr();return i.upload&&(i.upload.onprogress=s=>{s.lengthComputable&&this.onProgress(e,(this.progressBytes+s.loaded)/this.totalBytes)}),i},data:e,contentType:"application/octet-stream",processData:!1,success:()=>{this.progressBytes+=e.size,t()},error:(i,s,o)=>{this.onError(i.responseText||s)}})}onComplete(){let e=ge.default.map(this.files,function(i,s){return{name:i.name,size:i.size,type:i.type}}),t=Ps(this.id,e,cs(),this.el,"shiny.fileupload",document);this.makeRequest("uploadEnd",[this.jobId,this.id],()=>{this.$setActive(!1),this.onProgress(null,1),this.$bar().text("Upload complete"),(0,ge.default)(t.el).val("")},i=>{this.onError(i)},void 0),this.$bar().text("Finishing upload")}onError(e){this.$setError(e||""),this.$setActive(!1)}onAbort(){this.$setVisible(!1)}onProgress(e,t){this.$bar().width(Math.round(t*100)+"%"),this.$bar().text(e?e.name:"")}$container(){return(0,ge.default)("#"+E(this.id)+"_progress.shiny-file-input-progress")}$bar(){return(0,ge.default)("#"+E(this.id)+"_progress.shiny-file-input-progress .progress-bar")}$setVisible(e){this.$container().css("visibility",e?"visible":"hidden")}$setError(e){this.$bar().toggleClass("progress-bar-danger",e!==null),e!==null&&(this.onProgress(null,1),this.$bar().text(e))}$setActive(e){this.$container().toggleClass("active",!!e)}};var tn="shiny-file-input-active",nn="shiny-file-input-over";function bt(n){return(0,X.default)(n).closest("div.input-group")}function Ls(n){let e=(0,X.default)(n),t=0;return e.on({"dragenter.draghover":i=>{t++===0&&e.trigger("draghover:enter",i)},"dragleave.draghover":i=>{--t===0&&e.trigger("draghover:leave",i),t<0&&console.error("draghover childCounter is negative somehow")},"dragover.draghover":i=>{i.preventDefault()},"drop.draghover":i=>{t=0,e.trigger("draghover:drop",i),i.preventDefault()}}),e}function Bs(n){return(0,X.default)(n).off(".draghover")}function to(){let n=(0,X.default)("html");Ls(n).on({"draghover:enter.draghover":()=>{bt(xe).addClass(tn)},"draghover:leave.draghover":()=>{bt(xe).removeClass(tn)},"draghover:drop.draghover":()=>{bt(xe).removeClass(nn).removeClass(tn)}})}function no(){let n=(0,X.default)("html");n.off(".draghover"),Bs(n)}function io(n){let e=document.createElement("input");e.type="file";try{e.files=n}catch(t){return!1}return!0}function so(n,e){let t=n.originalEvent?.dataTransfer?.files,i=(0,X.default)(e);t==null?console.log("Dropping files is not supported on this browser. (no FileList)"):io(t)?(i.val(""),e.files=t,i.trigger("change")):(i.val(""),ro(e,t))}function _s(n,e){let t=n.closest("div.input-group").find("input[type=text]");e.length===1?t.val(e[0].name):t.val(e.length+" files")}function As(n){let e=n.data("currentUploader");e&&e.abort(),n.removeAttr("data-restore")}function ro(n,e){let t=(0,X.default)(n);As(t),_s(t,e),t.data("currentUploader",new yt(Oe(),ai(n),e,n))}function oo(n){let e=(0,X.default)(n.target);As(e);let t=n.target.files,i=ai(n.target);t.length!==0&&(_s(e,t),e.data("currentUploader",new yt(Oe(),i,t,n.target)))}var xe=(0,X.default)();function ai(n){return P.prototype.getId.call(this,n)||n.name}var sn=class extends P{find(e){return(0,X.default)(e).find('input[type="file"]')}getId(e){return ai(e)}getValue(e){let t=(0,X.default)(e).attr("data-restore");if(t){let i=JSON.parse(t),s=(0,X.default)(e).closest("div.input-group").find("input[type=text]");i.name.length===1?s.val(i.name[0]):s.val(i.name.length+" files");let o=(0,X.default)(e).closest("div.form-group").find(".progress"),a=o.find(".progress-bar");return o.removeClass("active"),a.width("100%"),a.css("visibility","visible"),i}else return null}setValue(e,t){}getType(e){return"shiny.file"}subscribe(e,t){(0,X.default)(e).on("change.fileInputBinding",oo),xe.length===0&&to(),xe=xe.add(e);let i=bt(e);Ls(i).on({"draghover:enter.draghover":s=>{i.addClass(nn)},"draghover:leave.draghover":s=>{i.removeClass(nn),s.stopPropagation()},"draghover:drop.draghover":(s,o)=>{so(o,e)}})}unsubscribe(e){let t=(0,X.default)(e),i=bt(e);i.removeClass(nn).removeClass(tn),Bs(i),t.off(".fileInputBinding"),i.off(".draghover"),xe=xe.not(e),xe.length===0&&no()}};var vt=M(S());var st=M(S());function Rs(n){return(0,st.default)(n).parent().find('label[for="'+E(n.id)+'"]')}var Qe=class extends P{find(e){return(0,st.default)(e).find('input[type="text"], input[type="search"], input[type="url"], input[type="email"]').not('input[type="text"][id$="-selectized"]')}getId(e){return super.getId(e)||e.name}getValue(e){throw"not implemented"}setValue(e,t){throw"not implemented"}subscribe(e,t){let i=(0,st.default)(e),s=i.data("update-on")||"change";s==="change"?i.on("keyup.textInputBinding input.textInputBinding",function(){t(!0)}):s==="blur"&&(i.on("blur.textInputBinding",function(){t(!1)}),i.on("keydown.textInputBinding",function(o){o.key==="Enter"&&(i.is("textarea")&&!(o.ctrlKey||o.metaKey)||t(!1))})),i.on("change.textInputBinding",function(){s==="blur"&&i.is(":focus")||t(!1)})}unsubscribe(e){(0,st.default)(e).off(".textInputBinding")}receiveMessage(e,t){throw"not implemented"}getState(e){throw"not implemented"}getRatePolicy(e){return{policy:"debounce",delay:250}}},He=class extends Qe{setValue(e,t){e.value=t}getValue(e){return e.value}getState(e){return{label:Rs(e).text(),value:e.value,placeholder:e.placeholder}}async receiveMessage(e,t){x(t,"value")&&this.setValue(e,t.value),await q(t.label,Rs(e)),x(t,"placeholder")&&(e.placeholder=t.placeholder),(0,st.default)(e).trigger("change")}};function Os(n){return(0,vt.default)(n).parent().find('label[for="'+E(n.id)+'"]')}var rn=class extends Qe{find(e){return(0,vt.default)(e).find('input[type="number"]')}getValue(e){let t=(0,vt.default)(e).val();if(typeof t=="string"&&/^\s*$/.test(t))return null;let i=Number(t);return isNaN(i)?t:i}setValue(e,t){e.value=""+t}getType(e){return"shiny.number"}async receiveMessage(e,t){x(t,"value")&&(e.value=t.value??""),x(t,"min")&&(e.min=t.min??""),x(t,"max")&&(e.max=t.max??""),x(t,"step")&&(e.step=t.step??""),await q(t.label,Os(e)),(0,vt.default)(e).trigger("change")}getState(e){return{label:Os(e).text(),value:this.getValue(e),min:Number(e.min),max:Number(e.max),step:Number(e.step)}}};var Vs=M(S());var on=class extends He{find(e){return(0,Vs.default)(e).find('input[type="password"]')}getType(e){return"shiny.password"}};var oe=M(S());function zs(n){return(0,oe.default)(n).parent().find('label[for="'+E(n.id)+'"]')}function ao(n){let e=n.parentNode;return e.tagName==="LABEL"?(0,oe.default)(e).find("span").text().trim():null}var an=class extends P{find(e){return(0,oe.default)(e).find(".shiny-input-radiogroup")}getValue(e){let t=(0,oe.default)('input:radio[name="'+E(e.id)+'"]:checked');return t.length===0?null:t.val()}setValue(e,t){Array.isArray(t)&&t.length===0?(0,oe.default)('input:radio[name="'+E(e.id)+'"]').prop("checked",!1):(0,oe.default)('input:radio[name="'+E(e.id)+'"][value="'+E(t)+'"]').prop("checked",!0)}getState(e){let t=(0,oe.default)('input:radio[name="'+E(e.id)+'"]'),i=new Array(t.length);for(let s=0;s<i.length;s++)i[s]={value:t[s].value,label:ao(t[s])};return{label:zs(e).text(),value:this.getValue(e),options:i}}async receiveMessage(e,t){let i=(0,oe.default)(e);x(t,"options")&&(i.find("div.shiny-options-group").remove(),i.find("label.radio").remove(),i.append(t.options)),x(t,"value")&&this.setValue(e,t.value),await q(t.label,zs(e)),(0,oe.default)(e).trigger("change")}subscribe(e,t){(0,oe.default)(e).on("change.radioInputBinding",function(){t(!1)})}unsubscribe(e){(0,oe.default)(e).off(".radioInputBinding")}};var V=M(S());var Je=eval;function Ns(n){let e=E(n.id);return li(n)&&(e+="-selectized"),(0,V.default)(n).parent().parent().find('label[for="'+e+'"]')}function li(n){return(0,V.default)(n).parent().find('script[data-for="'+E(n.id)+'"]').length>0}var ln=class extends P{find(e){return(0,V.default)(e).find("select")}getType(e){let t=(0,V.default)(e);return t.hasClass("symbol")?t.attr("multiple")==="multiple"?"shiny.symbolList":"shiny.symbol":null}getId(e){return P.prototype.getId.call(this,e)||e.name}getValue(e){return li(e)?this._selectize(e)?.getValue():(0,V.default)(e).val()}setValue(e,t){li(e)?this._selectize(e)?.setValue(t):(0,V.default)(e).val(t)}getState(e){let t=new Array(e.length);for(let i=0;i<e.length;i++)t[i]={value:e[i].value,label:e[i].label};return{label:Ns(e),value:this.getValue(e),options:t}}async receiveMessage(e,t){let i=(0,V.default)(e);if(x(t,"options")&&(this._selectize(e)?.destroy(),i.empty().append(t.options),this._selectize(e)),x(t,"config")&&(i.parent().find('script[data-for="'+E(e.id)+'"]').replaceWith(t.config),this._selectize(e,!0)),x(t,"url")){let s=this._selectize(e);s.clear(),s.clearOptions();let o=!1;s.settings.load=function(a,r){let l=s.settings;V.default.ajax({url:t.url,data:{query:a,field:JSON.stringify([l.searchField]),value:l.valueField,conju:l.searchConjunction,maxop:l.maxOptions},type:"GET",error:function(){r()},success:function(u){V.default.each(u,function(d,c){let p=c[l.optgroupField||"optgroup"],m={};m[l.optgroupLabelField||"label"]=p,m[l.optgroupValueField||"value"]=p,s.addOptionGroup(p,m)}),r(u),o||(x(t,"value")?s.setValue(t.value):l.maxItems===1&&s.setValue(u[0].value)),o=!0}})},s.load(function(a){s.settings.load.apply(s,["",a])})}else x(t,"value")&&this.setValue(e,t.value);await q(t.label,Ns(e)),(0,V.default)(e).trigger("change")}subscribe(e,t){(0,V.default)(e).on("change.selectInputBinding",()=>{e.nonempty&&this.getValue(e)===""||t(!1)})}unsubscribe(e){(0,V.default)(e).off(".selectInputBinding")}initialize(e){this._selectize(e)}_selectize(e,t=!1){if(!V.default.fn.selectize)return;let i=(0,V.default)(e),s=i.parent().find('script[data-for="'+E(e.id)+'"]');if(s.length===0)return;let o=V.default.extend({labelField:"label",valueField:"value",searchField:["label"]},JSON.parse(s.html()));o=this._addShinyRemoveButton(o,e.hasAttribute("multiple")),typeof s.data("nonempty")<"u"?(e.nonempty=!0,o=V.default.extend(o,{onItemRemove:function(r){this.getValue()===""&&(0,V.default)("select#"+E(e.id)).empty().append((0,V.default)("<option/>",{value:r,selected:!0})).trigger("change")},onDropdownClose:function(){this.getValue()===""&&this.setValue((0,V.default)("select#"+E(e.id)).val())}})):e.nonempty=!1,s.data("eval")instanceof Array&&V.default.each(s.data("eval"),function(r,l){o[l]=Je("("+o[l]+")")});let a=i.selectize(o)[0].selectize;if(t){let r=V.default.extend(a.settings,o);a.destroy(),a=i.selectize(r)[0].selectize}return a}_addShinyRemoveButton(e,t){let i=e.shinyRemoveButton;if(i===void 0||(i==="none"&&(i=t?"true":"false"),i==="false"))return e;let s=[];return i==="both"?s.push("remove_button","clear_button"):i==="true"&&s.push(t?"remove_button":"clear_button"),{...e,plugins:Array.from(new Set([...Array.isArray(e.plugins)?e.plugins:[],...s]))}}};var N=M(S());function un(n){n.$cache&&n.$cache.input?n.$cache.input.trigger("change"):console.log("Couldn't force ion slider to update")}function Us(n,e,t){let i,s;return n==="date"?(i=window.strftime.utc(),s=function(o){return i(e,new Date(o))}):n==="datetime"?(t?i=window.strftime.timezone(t):i=window.strftime,s=function(o){return i(e,new Date(o))}):s=function(o){return uo(o,this.prettify_separator)},s}function lo(n){return(0,N.default)(n).parent().find('label[for="'+E(n.id)+'"]')}function ui(n){return(0,N.default)(n).data("ionRangeSlider").options.type==="double"?2:1}var dn=class extends Qe{find(e){return N.default.fn.ionRangeSlider?(0,N.default)(e).find("input.js-range-slider"):(0,N.default)()}getType(e){let t=(0,N.default)(e).data("data-type");return t==="date"?"shiny.date":t==="datetime"?"shiny.datetime":null}getValue(e){let t=(0,N.default)(e),i=(0,N.default)(e).data("ionRangeSlider").result,s,o=t.data("data-type");return o==="date"?s=function(a){return de(new Date(Number(a)))}:o==="datetime"?s=function(a){return Number(a)/1e3}:s=function(a){return Number(a)},ui(e)===2?[s(i.from),s(i.to)]:s(i.from)}setValue(e,t){let i=(0,N.default)(e),s=i.data("ionRangeSlider");i.data("immediate",!0);try{ui(e)===2&&t instanceof Array?s.update({from:t[0],to:t[1]}):s.update({from:t}),un(s)}finally{i.data("immediate",!1)}}subscribe(e,t){(0,N.default)(e).on("change.sliderInputBinding",function(){t(!(0,N.default)(e).data("immediate")&&!(0,N.default)(e).data("animating"))})}unsubscribe(e){(0,N.default)(e).off(".sliderInputBinding")}async receiveMessage(e,t){let i=(0,N.default)(e),s=i.data("ionRangeSlider"),o={};if(x(t,"value"))if(ui(e)===2&&t.value instanceof Array)o.from=t.value[0],o.to=t.value[1];else{if(Array.isArray(t.value))throw"Slider requires two values to update with an array, but message value was "+["an empty array.","a single-value array.","an array with more than two values."][Math.min(t.value.length,2)];o.from=t.value}let a=["min","max","step"];for(let c=0;c<a.length;c++){let p=a[c];x(t,p)&&(o[p]=t[p])}await q(t.label,lo(e));let r=["data-type","time-format","timezone"];for(let c=0;c<r.length;c++){let p=r[c];x(t,p)&&i.data(p,t[p])}let l=i.data("data-type"),u=i.data("time-format"),d=i.data("timezone");o.prettify=Us(l,u,d),i.data("immediate",!0);try{s.update(o),un(s)}finally{i.data("immediate",!1)}}getRatePolicy(e){return{policy:"debounce",delay:250}}getState(e){}initialize(e){let t=(0,N.default)(e),i=t.data("data-type"),s=t.data("time-format"),o=t.data("timezone"),a={prettify:Us(i,s,o)};t.ionRangeSlider(a)}};function uo(n,e=",",t="."){let i=n.toString().split(".");return i[0]=i[0].replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g,"$1"+e),i.length===1?i[0]:i.length===2?i[0]+t+i[1]:""}(0,N.default)(document).on("click",".slider-animate-button",function(n){n.preventDefault();let e=(0,N.default)(this),t=(0,N.default)("#"+E(e.attr("data-target-id"))),i="Play",s="Pause",o=e.attr("data-loop")!==void 0&&!/^\s*false\s*$/i.test(e.attr("data-loop")),a=e.attr("data-interval");if(isNaN(a)?a=1500:a=Number(a),t.data("animTimer"))clearTimeout(t.data("animTimer")),t.removeData("animTimer"),e.attr("title",i),e.removeClass("playing"),t.removeData("animating");else{let r;if(t.hasClass("jslider")){let l=t.slider();l.canStepNext()||l.resetToStart(),r=setInterval(function(){o&&!l.canStepNext()?l.resetToStart():(l.stepNext(),!o&&!l.canStepNext()&&e.click())},a)}else{let l=t.data("ionRangeSlider"),u=function(){return l.options.type==="double"?l.result.to<l.result.max:l.result.from<l.result.max},d=function(){let p={from:l.result.min};l.options.type==="double"&&(p.to=p.from+(l.result.to-l.result.from)),l.update(p),un(l)},c=function(){let p={from:Math.min(l.result.max,l.result.from+l.options.step)};l.options.type==="double"&&(p.to=Math.min(l.result.max,l.result.to+l.options.step)),l.update(p),un(l)};u()||d(),r=setInterval(function(){o&&!u()?d():(c(),!o&&!u()&&e.click())},a)}t.data("animTimer",r),e.attr("title",s),e.addClass("playing"),t.data("animating",!0)}});var ae=M(S());function Qs(n){return n.attr("data-value")||n.text()}var cn=class extends P{find(e){return(0,ae.default)(e).find("ul.nav.shiny-tab-input")}getValue(e){let t=si()?(0,ae.default)(e).find("li:not(.dropdown).active > a"):(0,ae.default)(e).find(".nav-link:not(.dropdown-toggle).active, .dropdown-menu .dropdown-item.active");return t.length===1?Qs(t):null}setValue(e,t){let i=!1;t&&(si()?(0,ae.default)(e).find("li:not(.dropdown) > a"):(0,ae.default)(e).find(".nav-link:not(.dropdown-toggle), .dropdown-menu .dropdown-item")).each(function(){if(Qs((0,ae.default)(this))===t)return(0,ae.default)(this).tab("show"),i=!0,!1}),i||(0,ae.default)(e).trigger("change")}getState(e){return{value:this.getValue(e)}}receiveMessage(e,t){x(t,"value")&&this.setValue(e,t.value),(0,ae.default)(e).trigger("change")}subscribe(e,t){(0,ae.default)(e).on("change shown.bootstrapTabInputBinding shown.bs.tab.bootstrapTabInputBinding",function(){t(!1)})}unsubscribe(e){(0,ae.default)(e).off(".bootstrapTabInputBinding")}};var Fs=M(S());var Js=new IntersectionObserver(n=>{n.forEach(e=>{e.isIntersecting&&di(e.target)})}),Fe,pn=class extends He{constructor(){super(...arguments);Jt(this,Fe,null)}find(t){return(0,Fs.default)(t).find("textarea")}initialize(t){super.initialize(t),di(t)}subscribe(t,i){super.subscribe(t,i),Qi(this,Fe,s=>di(s.target)),t.addEventListener("input",Qt(this,Fe)),Js.observe(t)}unsubscribe(t){super.unsubscribe(t),Qt(this,Fe)&&t.removeEventListener("input",Qt(this,Fe)),Js.unobserve(t)}};Fe=new WeakMap;function di(n){n.classList.contains("textarea-autoresize")&&n.scrollHeight!=0&&(n.style.height="auto",n.style.height=n.scrollHeight+"px")}function js(){let n=new it;n.register(new He,"shiny.textInput"),n.register(new pn,"shiny.textareaInput"),n.register(new on,"shiny.passwordInput"),n.register(new rn,"shiny.numberInput"),n.register(new Kt,"shiny.checkboxInput"),n.register(new Yt,"shiny.checkboxGroupInput"),n.register(new an,"shiny.radioInput"),n.register(new dn,"shiny.sliderInput"),n.register(new Zt,"shiny.dateInput"),n.register(new en,"shiny.dateRangeInput"),n.register(new ln,"shiny.selectInput"),n.register(new Gt,"shiny.actionButtonInput"),n.register(new cn,"shiny.bootstrapTabInput");let e=new sn;return n.register(e,"shiny.fileInputBinding"),{inputBindings:n,fileInputBinding:e}}var ye=M(S());var je=M(S());var U=class{find(e){throw"Not implemented"}renderValue(e,t){throw"Not implemented"}getId(e){return e.getAttribute("data-input-id")||e.id}async onValueChange(e,t){this.clearError(e),await this.renderValue(e,t)}onValueError(e,t){this.renderError(e,t)}renderError(e,t){if(this.clearError(e),t.message===""){(0,je.default)(e).empty();return}let i="shiny-output-error";t.type!==null&&(i=i+" "+je.default.map(nt(t.type),function(s){return i+"-"+s}).join(" ")),(0,je.default)(e).addClass(i).text(t.message)}clearError(e){(0,je.default)(e).attr("class",function(t,i){return i.replace(/(^|\s)shiny-output-error\S*/g,"")})}showProgress(e,t){let i="recalculating";t?(0,je.default)(e).addClass(i):(0,je.default)(e).removeClass(i)}};var mn=class extends U{find(e){return(0,ye.default)(e).find(".shiny-datatable-output")}onValueError(e,t){G(e),this.renderError(e,t)}renderValue(e,t){let i=(0,ye.default)(e).empty();if(!t||!t.colnames)return;let s=ye.default.makeArray(t.colnames),o=ye.default.map(s,function(c){return"<th>"+c+"</th>"}).join("");o="<thead><tr>"+o+"</tr></thead>";let a="";(t.options?.searching??!0)&&(a=ye.default.map(s,function(c){return'<th><input type="text" placeholder="'+Ts(c.replace(/(<([^>]+)>)/gi,""))+'" /></th>'}).join(""),a="<tfoot>"+a+"</tfoot>");let r='<table class="table table-striped table-hover">'+o+a+"</table>";i.append(r),t.evalOptions&&ye.default.each(t.evalOptions,function(c,p){t.options[p]=Je("("+t.options[p]+")")});let l=t.options?.search?.caseInsensitive!==!1,u=(0,ye.default)(e).children("table").DataTable(ye.default.extend({processing:!0,serverSide:!0,order:[],orderClasses:!1,pageLength:25,ajax:{url:t.action,type:"POST",data:function(c){c.search||(c.search={}),c.search.caseInsensitive=l,c.escape=t.escape}}},t.options));if(typeof t.callback=="string"){let c=Je("("+t.callback+")");typeof c=="function"&&c(u)}i.find("label input").first().unbind("keyup").keyup($e(t.searchDelay,function(){u.search(this.value).draw()}));let d=i.find("tfoot input");d.length>0&&(ye.default.each(u.settings()[0].aoColumns,function(c,p){p.bSearchable||d.eq(c).hide()}),d.keyup($e(t.searchDelay,function(){u.column(d.index(this)).search(this.value).draw()}))),i.parents(".tab-content").css("overflow","visible")}};var wt=M(S());var fn=class extends U{find(e){return(0,wt.default)(e).find("a.shiny-download-link")}renderValue(e,t){e.setAttribute("href",t),e.classList.remove("disabled"),e.removeAttribute("aria-disabled"),e.removeAttribute("tabindex")}showProgress(e,t){}};(0,wt.default)(document).on("click.shinyDownloadLink","a.shiny-download-link",function(n){let e=wt.default.Event("shiny:filedownload");e.name=this.id,e.href=this.href,(0,wt.default)(document).trigger(e)});var qs=M(S());var hn=class extends U{find(e){return(0,qs.default)(e).find(".shiny-html-output")}onValueError(e,t){G(e),this.renderError(e,t)}async renderValue(e,t){await re(e,t)}};var qe=M(S());var Ks=M(S());var Gs=M(S());function Xs(n,e,t,i,s,o=!0){o=o||!0;let a=(s-i)/(t-e),l=(n-e)*a+i;if(o){let u=Math.max(s,i),d=Math.min(s,i);l>u?l=u:l<d&&(l=d)}return l}function Ws(n,e,t,i,s){return{scale:function(o,a){return s&&(o=Math.log(o)/Math.log(s)),Xs(o,n,e,t,i,a)},scaleInv:function(o,a){let r=Xs(o,t,i,n,e,a);return s&&(r=Math.pow(s,r)),r}}}function co(n){let e=n,t=e.domain,i=e.range,s=e.log&&e.log.x?e.log.x:null,o=e.log&&e.log.y?e.log.y:null,a=Ws(t.left,t.right,i.left,i.right,s),r=Ws(t.bottom,t.top,i.bottom,i.top,o);function l(d,c){return ce(d,(p,m)=>{let y=m.substring(0,1);return y==="x"?a.scale(p,c):y==="y"?r.scale(p,c):null})}e.scaleDataToImg=l;function u(d,c){return ce(d,(p,m)=>{let y=m.substring(0,1);return y==="x"?a.scaleInv(p,c):y==="y"?r.scaleInv(p,c):null})}return e.scaleImgToData=u,e.clipImg=function(d){let c={x:d.x,y:d.y},p=e.range;return d.x>p.right?c.x=p.right:d.x<p.left&&(c.x=p.left),d.y>p.bottom?c.y=p.bottom:d.y<p.top&&(c.y=p.top),c},e}function ci(n){return n.map(e=>co(e))}function po(n){let e=n[0].getBoundingClientRect();return{x:e.width/n.outerWidth(),y:e.height/n.outerHeight()}}function pi(n){let e=n.offset(),t=po(n),i={left:parseInt(n.css("border-left-width"))+parseInt(n.css("padding-left")),top:parseInt(n.css("border-top-width"))+parseInt(n.css("padding-top"))};return{x:e.left+t.x*i.left,y:e.top+t.y*i.top}}function mo(n){let e={x:n.width()/n.outerWidth(),y:n.height()/n.outerHeight()},t=n[0].getBoundingClientRect();return{x:e.x*t.width,y:e.y*t.height}}function mi(n,e){let t=n.find("img"),i=t[0];if(e.panels.length===0){let r={top:0,left:0,right:i.naturalWidth-1,bottom:i.naturalHeight-1};e.panels[0]={domain:r,range:r,mapping:{}}}let s=e;s.dims.height=s.dims.height||i.naturalHeight,s.dims.width=s.dims.width||i.naturalWidth,s.panels=ci(e.panels),s.mouseOffsetCss=function(r){let l=pi(t);return{x:r.pageX-l.x,y:r.pageY-l.y}};function o(r){let l=s.imgToCssScalingRatio();return ce(r,(d,c)=>{let p=c.substring(0,1);return p==="x"?r[c]/l.x:p==="y"?r[c]/l.y:null})}s.scaleCssToImg=o;function a(r){let l=s.imgToCssScalingRatio();return ce(r,(d,c)=>{let p=c.substring(0,1);return p==="x"?r[c]*l.x:p==="y"?r[c]*l.y:null})}return s.scaleImgToCss=a,s.imgToCssScalingRatio=function(){let r=mo(t);return{x:r.x/s.dims.width,y:r.y/s.dims.height}},s.cssToImgScalingRatio=function(){let r=s.imgToCssScalingRatio();return{x:1/r.x,y:1/r.y}},s.getPanelCss=function(r,l=0){let u=s.scaleCssToImg(r),d=u.x,c=u.y,p=s.cssToImgScalingRatio(),m={x:l*p.x,y:l*p.y},y=[],$=[],C;for(C=0;C<s.panels.length;C++){let I=s.panels[C].range;if(d<=I.right+m.x&&d>=I.left-m.x&&c<=I.bottom+m.y&&c>=I.top-m.y){y.push(s.panels[C]);let B=0,K=0;d>I.right&&d<=I.right+m.x?B=d-I.right:d<I.left&&d>=I.left-m.x&&(B=d-I.left),c>I.bottom&&c<=I.bottom+m.y?K=c-I.bottom:c<I.top&&c>=I.top-m.y&&(K=c-I.top),$.push(Math.sqrt(Math.pow(B,2)+Math.pow(K,2)))}}if(y.length){let I=Math.min.apply(null,$);for(C=0;C<y.length;C++)if($[C]===I)return y[C]}return null},s.isInPanelCss=function(r,l=0){return!!s.getPanelCss(r,l)},s.mouseCoordinateSender=function(r,l=!0,u=!1){return function(d){if(d===null){me(r,null);return}let c=s.mouseOffsetCss(d);if(!s.isInPanelCss(c)){if(u){me(r,null);return}if(l)return;let C={coords_css:c,coords_img:s.scaleCssToImg(c)};me(r,C,{priority:"event"});return}let p=s.getPanelCss(c),m=s.scaleCssToImg(c),y=p.scaleImgToData(m),$={x:y?.x,y:y?.y,coords_css:c,coords_img:m,img_css_ratio:s.cssToImgScalingRatio()};Gs.default.extend($,p.panel_vars),$.mapping=p.mapping,$.domain=p.domain,$.range=p.range,$.log=p.log,me(r,$,{priority:"event"})}},s}function rt(n,e){return{xmin:Math.min(n.x,e.x),xmax:Math.max(n.x,e.x),ymin:Math.min(n.y,e.y),ymax:Math.max(n.y,e.y)}}function De(n,e,t){n instanceof Array||(n=[n]);let i=Math.max.apply(null,n),s=Math.min.apply(null,n),o=0;i>t?o=t-i:s<e&&(o=e-s);let a=[];for(let r=0;r<n.length;r++)a[r]=n[r]+o;return a}function fi(n,e,t,i){let o=n[0],a=null,r={},l=t.scaleCssToImg,u=t.scaleImgToCss;d();function d(){r.brushing=!1,r.dragging=!1,r.resizing=!1,r.down={x:NaN,y:NaN},r.up={x:NaN,y:NaN},r.resizeSides={left:!1,right:!1,top:!1,bottom:!1},r.boundsCss={xmin:NaN,xmax:NaN,ymin:NaN,ymax:NaN},r.boundsData={xmin:NaN,xmax:NaN,ymin:NaN,ymax:NaN},r.panel=null,r.changeStartBounds={xmin:NaN,xmax:NaN,ymin:NaN,ymax:NaN},a&&a.remove()}function c(){return n.find("#"+o.id+"_brush").length>0}function p(){let g=n.find("#"+o.id+"_brush");if(g.length===0)return;let w=g.data("bounds-data"),D=g.data("panel");if(!(!w||!D)){for(let k=0;k<t.panels.length;k++){let ie=t.panels[k];if(ii(D.mapping,ie.mapping)&&ii(D.panel_vars,ie.panel_vars)){r.panel=t.panels[k];break}}if(r.panel===null){g.remove();return}a=g,B(w),T()}}function m(){let g=B();Object.values(g).some(Cs)||(B(g),T())}function y(g){let w=r.boundsCss;return g.x<=w.xmax&&g.x>=w.xmin&&g.y<=w.ymax&&g.y>=w.ymin}function $(g){let w=C(g);return w.left||w.right||w.top||w.bottom}function C(g){let w=r.boundsCss,D={xmin:w.xmin-10,xmax:w.xmax+10,ymin:w.ymin-10,ymax:w.ymax+10},k={left:!1,right:!1,top:!1,bottom:!1};return(e.brushDirection==="xy"||e.brushDirection==="x")&&g.y<=D.ymax&&g.y>=D.ymin&&(g.x<w.xmin&&g.x>=D.xmin?k.left=!0:g.x>w.xmax&&g.x<=D.xmax&&(k.right=!0)),(e.brushDirection==="xy"||e.brushDirection==="y")&&g.x<=D.xmax&&g.x>=D.xmin&&(g.y<w.ymin&&g.y>=D.ymin?k.top=!0:g.y>w.ymax&&g.y<=D.ymax&&(k.bottom=!0)),k}function I(g){if(g===void 0)return{...r.boundsCss};let w={x:g.xmin,y:g.ymin},D={x:g.xmax,y:g.ymax},k=r.panel,ie=k.range;e.brushClip&&(w=u(k.clipImg(l(w))),D=u(k.clipImg(l(D)))),e.brushDirection==="xy"||(e.brushDirection==="x"?(w.y=u({y:ie.top}).y,D.y=u({y:ie.bottom}).y):e.brushDirection==="y"&&(w.x=u({x:ie.left}).x,D.x=u({x:ie.right}).x)),r.boundsCss={xmin:w.x,xmax:D.x,ymin:w.y,ymax:D.y};let Ae=k.scaleImgToData(l(w)),Y=k.scaleImgToData(l(D));r.boundsData=rt(Ae,Y),r.boundsData=ce(r.boundsData,tt=>ei(tt,14)),a.data("bounds-data",r.boundsData),a.data("panel",r.panel)}function B(g){if(typeof g>"u")return{...r.boundsData};let w=u(r.panel.scaleDataToImg(g));w=ce(w,D=>ei(D,13)),I({xmin:Math.min(w.xmin,w.xmax),xmax:Math.max(w.xmin,w.xmax),ymin:Math.min(w.ymin,w.ymax),ymax:Math.max(w.ymin,w.ymax)})}function K(){return r.panel}function b(){a&&a.remove(),a=(0,Ks.default)(document.createElement("div")).attr("id",o.id+"_brush").css({"background-color":e.brushFill,opacity:e.brushOpacity,"pointer-events":"none",position:"absolute"}).hide();let g="1px solid "+e.brushStroke;e.brushDirection==="xy"?a.css({border:g}):e.brushDirection==="x"?a.css({"border-left":g,"border-right":g}):e.brushDirection==="y"&&a.css({"border-top":g,"border-bottom":g}),n.append(a),a.offset({x:0,y:0}).width(0).outerHeight(0)}function T(){let g=pi(n.find("img")),w=r.boundsCss;a.offset({top:g.y+w.ymin,left:g.x+w.xmin}).outerWidth(w.xmax-w.xmin+1).outerHeight(w.ymax-w.ymin+1)}function _(g){if(g===void 0)return r.down;r.down=g}function Me(g){if(g===void 0)return r.up;r.up=g}function Ze(){return r.brushing}function et(){r.brushing=!0,b(),r.panel=t.getPanelCss(r.down,i),I(rt(r.down,r.down)),T()}function Nn(g){I(rt(r.down,g)),a.show(),T()}function Un(){r.brushing=!1,I(rt(r.down,r.up))}function Qn(){return r.dragging}function f(){r.dragging=!0,r.changeStartBounds={...r.boundsCss}}function h(g){let w=g.x-r.down.x,D=g.y-r.down.y,k=r.changeStartBounds,ie={xmin:k.xmin+w,xmax:k.xmax+w,ymin:k.ymin+D,ymax:k.ymax+D};if(e.brushClip){let Y=r.panel.range,tt=l(ie),Nt=[tt.xmin,tt.xmax],Ut=[tt.ymin,tt.ymax];Nt=De(Nt,Y.left,Y.right),Ut=De(Ut,Y.top,Y.bottom),ie=u({xmin:Nt[0],xmax:Nt[1],ymin:Ut[0],ymax:Ut[1]})}I(ie),T()}function L(){r.dragging=!1}function z(){return r.resizing}function Z(){r.resizing=!0,r.changeStartBounds={...r.boundsCss},r.resizeSides=C(r.down)}function le(g){let w={x:g.x-r.down.x,y:g.y-r.down.y},D=l(w),k=l(r.changeStartBounds),Ae=r.panel.range;if(r.resizeSides.left){let Y=De(k.xmin+D.x,Ae.left,k.xmax)[0];k.xmin=Y}else if(r.resizeSides.right){let Y=De(k.xmax+D.x,k.xmin,Ae.right)[0];k.xmax=Y}if(r.resizeSides.top){let Y=De(k.ymin+D.y,Ae.top,k.ymax)[0];k.ymin=Y}else if(r.resizeSides.bottom){let Y=De(k.ymax+D.y,k.ymin,Ae.bottom)[0];k.ymax=Y}I(u(k)),T()}function pe(){r.resizing=!1}return{reset:d,hasOldBrush:c,importOldBrush:p,isInsideBrush:y,isInResizeArea:$,whichResizeSides:C,onResize:m,boundsCss:I,boundsData:B,getPanel:K,down:_,up:Me,isBrushing:Ze,startBrushing:et,brushTo:Nn,stopBrushing:Un,isDragging:Qn,startDragging:f,dragTo:h,stopDragging:L,isResizing:z,startResizing:Z,resizeTo:le,stopResizing:pe}}var Ys=M(S());function hi(n,e,t){let i,s=null;function o(d,c){let p=Ys.default.Event(d,{which:c.which,pageX:c.pageX,pageY:c.pageY});n.trigger(p)}function a(){s&&(o("mousedown2",s),s=null)}function r(d){s=d,i=window.setTimeout(function(){a()},t)}function l(d){if(d.which===1){if(!e){o("mousedown2",d);return}s===null?r(d):(clearTimeout(i),s&&Math.abs(s.pageX-d.pageX)>2||Math.abs(s.pageY-d.pageY)>2?(a(),r(d)):(s=null,o("dblclick2",d)))}}function u(d){d.which=1,o("dblclick2",d)}return{mousedown:l,dblclickIE8:u}}var Pe=M(S());var Zs=M(S());function ot(n=document.documentElement){return(0,Zs.default)(n).find(".shiny-image-output, .shiny-plot-output")}function gn(n,e,t){let i=t.mouseCoordinateSender(n,e);return i(null),{mousedown:function(s){s.which===1&&i(s)},onResetImg:function(){i(null)},onResize:null}}function gi(n,e,t,i,s,o){let a=o.mouseCoordinateSender(n,i,s),r;t==="throttle"?r=new Ce(null,a,e):r=new ee(null,a,e),r.immediateCall(null);let l;return s?l=function(){r.normalCall(null)}:l=function(){},{mousemove:function(u){r.normalCall(u)},mouseout:l,onResetImg:function(){r.immediateCall(null)},onResize:null}}function yi(n,e,t,i,s){let a=fi(e,t,i,20);e.on("shiny-internal:brushed.image_output",function(b,T){T.brushId===n&&T.outputId!==s&&(e.data("mostRecentBrush",!1),a.reset())});function r(b){e.removeClass("crosshair grabbable grabbing ns-resize ew-resize nesw-resize nwse-resize"),b&&e.addClass(b)}function l(){let b=a.boundsData();if(isNaN(b.xmin)){me(n,null),ot(document.documentElement).trigger("shiny-internal:brushed",{brushId:n,outputId:null});return}let T=a.getPanel();Pe.default.extend(b,T.panel_vars),b.coords_css=a.boundsCss(),b.coords_img=i.scaleCssToImg(b.coords_css),b.img_css_ratio=i.cssToImgScalingRatio(),b.mapping=T.mapping,b.domain=T.domain,b.range=T.range,b.log=T.log,b.direction=t.brushDirection,b.brushId=n,b.outputId=s,me(n,b),e.data("mostRecentBrush",!0),ot(document.documentElement).trigger("shiny-internal:brushed",b)}let u;t.brushDelayType==="throttle"?u=new Ce(null,l,t.brushDelay):u=new ee(null,l,t.brushDelay),a.hasOldBrush()||u.immediateCall();function d(b){if(a.isBrushing()||a.isDragging()||a.isResizing()||b.which!==1)return;let T=i.mouseOffsetCss(b);if(!(t.brushClip&&!i.isInPanelCss(T,20)))if(a.up({x:NaN,y:NaN}),a.down(T),a.isInResizeArea(T))a.startResizing(T),(0,Pe.default)(document).on("mousemove.image_brush",y).on("mouseup.image_brush",I);else if(a.isInsideBrush(T))a.startDragging(T),r("grabbing"),(0,Pe.default)(document).on("mousemove.image_brush",m).on("mouseup.image_brush",C);else{let _=i.getPanelCss(T,20);a.startBrushing(_.clipImg(i.scaleCssToImg(T))),(0,Pe.default)(document).on("mousemove.image_brush",p).on("mouseup.image_brush",$)}}function c(b){let T=i.mouseOffsetCss(b);if(!(a.isBrushing()||a.isDragging()||a.isResizing()))if(a.isInResizeArea(T)){let _=a.whichResizeSides(T);_.left&&_.top||_.right&&_.bottom?r("nwse-resize"):_.left&&_.bottom||_.right&&_.top?r("nesw-resize"):_.left||_.right?r("ew-resize"):(_.top||_.bottom)&&r("ns-resize")}else a.isInsideBrush(T)?r("grabbable"):i.isInPanelCss(T,20)?r("crosshair"):r(null)}function p(b){a.brushTo(i.mouseOffsetCss(b)),u.normalCall()}function m(b){a.dragTo(i.mouseOffsetCss(b)),u.normalCall()}function y(b){a.resizeTo(i.mouseOffsetCss(b)),u.normalCall()}function $(b){if(b.which===1){if((0,Pe.default)(document).off("mousemove.image_brush").off("mouseup.image_brush"),a.up(i.mouseOffsetCss(b)),a.stopBrushing(),r("crosshair"),a.down().x===a.up().x&&a.down().y===a.up().y){a.reset(),u.immediateCall();return}u.isPending()&&u.immediateCall()}}function C(b){b.which===1&&((0,Pe.default)(document).off("mousemove.image_brush").off("mouseup.image_brush"),a.up(i.mouseOffsetCss(b)),a.stopDragging(),r("grabbable"),u.isPending()&&u.immediateCall())}function I(b){b.which===1&&((0,Pe.default)(document).off("mousemove.image_brush").off("mouseup.image_brush"),a.up(i.mouseOffsetCss(b)),a.stopResizing(),u.isPending()&&u.immediateCall())}function B(){t.brushResetOnNew&&e.data("mostRecentBrush")&&(a.reset(),u.immediateCall())}t.brushResetOnNew||e.data("mostRecentBrush")&&(a.importOldBrush(),u.immediateCall());function K(){a.onResize(),u.immediateCall()}return{mousedown:d,mousemove:c,onResetImg:B,onResize:K}}function at(n,e){e.css("-webkit-user-drag","none"),e.off("dragstart.image_output"),e.on("dragstart.image_output",function(){return!1}),n.off("selectstart.image_output"),n.on("selectstart.image_output",function(){return!1})}var bi=class extends U{find(e){return ot(e)}renderValue(e,t){let i=this.getId(e),s=(0,qe.default)(e),o,a=s.find("img");if(a.length===0?(o=document.createElement("img"),s.append(o),a=(0,qe.default)(o)):(o=a[0],a.trigger("reset")),!t){s.empty();return}let r={clickId:s.data("click-id"),clickClip:j(Ne(s.data("click-clip")),!0),dblclickId:s.data("dblclick-id"),dblclickClip:j(Ne(s.data("dblclick-clip")),!0),dblclickDelay:j(s.data("dblclick-delay"),400),hoverId:s.data("hover-id"),hoverClip:j(Ne(s.data("hover-clip")),!0),hoverDelayType:j(s.data("hover-delay-type"),"debounce"),hoverDelay:j(s.data("hover-delay"),300),hoverNullOutside:j(Ne(s.data("hover-null-outside")),!1),brushId:s.data("brush-id"),brushClip:j(Ne(s.data("brush-clip")),!0),brushDelayType:j(s.data("brush-delay-type"),"debounce"),brushDelay:j(s.data("brush-delay"),300),brushFill:j(s.data("brush-fill"),"#666"),brushStroke:j(s.data("brush-stroke"),"#000"),brushOpacity:j(s.data("brush-opacity"),.3),brushDirection:j(s.data("brush-direction"),"xy"),brushResetOnNew:j(Ne(s.data("brush-reset-on-new")),!1),coordmap:t.coordmap};r.brushFill==="auto"&&(r.brushFill=ht(s[0])),r.brushStroke==="auto"&&(r.brushStroke=fe(s[0],"color")),qe.default.each(t,function(l,u){u===null||l==="coordmap"||(l==="src"&&u===o.getAttribute("src")&&o.removeAttribute("src"),o.setAttribute(l,u))});for(let l=0;l<o.attributes.length;l++){let u=o.attributes[l];u.specified&&!se(t,u.name)&&o.removeAttribute(u.name)}r.coordmap||(r.coordmap={panels:[],dims:{height:null,width:null}}),s.off(".image_output"),a.off(".image_output"),a.off("load.shiny_image_interaction"),a.one("load.shiny_image_interaction",function(){let l=r.coordmap=mi(s,r.coordmap),u=hi(s,r.dblclickId,r.dblclickDelay);if(s.on("mousedown.image_output",u.mousedown),Re()&&Ki()===8&&s.on("dblclick.image_output",u.dblclickIE8),r.clickId){at(s,a);let d=gn(r.clickId,r.clickClip,l);s.on("mousedown2.image_output",d.mousedown),s.on("resize.image_output",d.onResize),a.on("reset.image_output",d.onResetImg)}if(r.dblclickId){at(s,a);let d=gn(r.dblclickId,r.clickClip,l);s.on("dblclick2.image_output",d.mousedown),s.on("resize.image_output",d.onResize),a.on("reset.image_output",d.onResetImg)}if(r.hoverId){at(s,a);let d=gi(r.hoverId,r.hoverDelay,r.hoverDelayType,r.hoverClip,r.hoverNullOutside,l);s.on("mousemove.image_output",d.mousemove),s.on("mouseout.image_output",d.mouseout),s.on("resize.image_output",d.onResize),a.on("reset.image_output",d.onResetImg)}if(r.brushId){at(s,a);let d=yi(r.brushId,s,r,l,i);s.on("mousedown.image_output",d.mousedown),s.on("mousemove.image_output",d.mousemove),s.on("resize.image_output",d.onResize),a.on("reset.image_output",d.onResetImg)}(r.clickId||r.dblclickId||r.hoverId||r.brushId)&&s.addClass("crosshair"),t.error&&console.log("Error on server extracting coordmap: "+t.error)})}renderError(e,t){(0,qe.default)(e).find("img").trigger("reset"),U.prototype.renderError.call(this,e,t)}clearError(e){(0,qe.default)(e).contents().filter(function(){return!(this instanceof HTMLElement&&(this.tagName==="IMG"||this.id===e.id+"_brush"))}).remove(),U.prototype.clearError.call(this,e)}resize(e,t,i){(0,qe.default)(e).find("img").trigger("resize")}},yn=new bi;var vi=M(S());var bn=class extends U{find(e){return(0,vi.default)(e).find(".shiny-text-output")}renderValue(e,t){(0,vi.default)(e).text(t)}};function er(){let n=new it;return n.register(new bn,"shiny.textOutput"),n.register(new fn,"shiny.downloadLink"),n.register(new mn,"shiny.datatableOutput"),n.register(new hn,"shiny.htmlOutput"),n.register(yn,"shiny.imageOutput"),{outputBindings:n}}var vn=globalThis,wn=vn.ShadowRoot&&(vn.ShadyCSS===void 0||vn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wi=Symbol(),tr=new WeakMap,xt=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==wi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(wn&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=tr.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&tr.set(t,e))}return e}toString(){return this.cssText}},nr=n=>new xt(typeof n=="string"?n:n+"",void 0,wi),It=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((i,s,o)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+n[o+1],n[0]);return new xt(t,n,wi)},ir=(n,e)=>{if(wn)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let i=document.createElement("style"),s=vn.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,n.appendChild(i)}},xi=wn?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return nr(t)})(n):n;var{is:fo,defineProperty:ho,getOwnPropertyDescriptor:go,getOwnPropertyNames:yo,getOwnPropertySymbols:bo,getPrototypeOf:vo}=Object,xn=globalThis,sr=xn.trustedTypes,wo=sr?sr.emptyScript:"",xo=xn.reactiveElementPolyfillSupport,Tt=(n,e)=>n,Ii={toAttribute(n,e){switch(e){case Boolean:n=n?wo:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},or=(n,e)=>!fo(n,e),rr={attribute:!0,type:String,converter:Ii,reflect:!1,useDefault:!1,hasChanged:or};Symbol.metadata??=Symbol("metadata"),xn.litPropertyMetadata??=new WeakMap;var Ie=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=rr){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&ho(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){let{get:s,set:o}=go(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:s,set(a){let r=s?.call(this);o?.call(this,a),this.requestUpdate(e,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??rr}static _$Ei(){if(this.hasOwnProperty(Tt("elementProperties")))return;let e=vo(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Tt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Tt("properties"))){let t=this.properties,i=[...yo(t),...bo(t)];for(let s of i)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(let[t,i]of this.elementProperties){let s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let s of i)t.unshift(xi(s))}else e!==void 0&&t.push(xi(e));return t}static _$Eu(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ir(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){let i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:Ii).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){let i=this.constructor,s=i._$Eh.get(e);if(s!==void 0&&this._$Em!==s){let o=i.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Ii;this._$Em=s;let r=a.fromAttribute(t,o.type);this[s]=r??this._$Ej?.get(s)??r,this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){let s=this.constructor,o=this[e];if(i??=s.getPropertyOptions(e),!((i.hasChanged??or)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:o},a){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),o!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[s,o]of i){let{wrapped:a}=o,r=this[s];a!==!0||this._$AL.has(s)||r===void 0||this.C(s,void 0,o,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Ie.elementStyles=[],Ie.shadowRootOptions={mode:"open"},Ie[Tt("elementProperties")]=new Map,Ie[Tt("finalized")]=new Map,xo?.({ReactiveElement:Ie}),(xn.reactiveElementVersions??=[]).push("2.1.1");var ki=globalThis,In=ki.trustedTypes,ar=In?In.createPolicy("lit-html",{createHTML:n=>n}):void 0,mr="$lit$",Le=`lit$${Math.random().toFixed(9).slice(2)}$`,fr="?"+Le,Io=`<${fr}>`,Ge=document,St=()=>Ge.createComment(""),Mt=n=>n===null||typeof n!="object"&&typeof n!="function",Hi=Array.isArray,To=n=>Hi(n)||typeof n?.[Symbol.iterator]=="function",Ti=`[
\f\r]`,Et=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,lr=/-->/g,ur=/>/g,Xe=RegExp(`>|${Ti}(?:([^\\s"'>=/]+)(${Ti}*=${Ti}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),dr=/'/g,cr=/"/g,hr=/^(?:script|style|textarea|title)$/i,Di=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),Pi=Di(1),Ku=Di(2),Yu=Di(3),Ke=Symbol.for("lit-noChange"),Q=Symbol.for("lit-nothing"),pr=new WeakMap,We=Ge.createTreeWalker(Ge,129);function gr(n,e){if(!Hi(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return ar!==void 0?ar.createHTML(e):e}var Eo=(n,e)=>{let t=n.length-1,i=[],s,o=e===2?"<svg>":e===3?"<math>":"",a=Et;for(let r=0;r<t;r++){let l=n[r],u,d,c=-1,p=0;for(;p<l.length&&(a.lastIndex=p,d=a.exec(l),d!==null);)p=a.lastIndex,a===Et?d[1]==="!--"?a=lr:d[1]!==void 0?a=ur:d[2]!==void 0?(hr.test(d[2])&&(s=RegExp("</"+d[2],"g")),a=Xe):d[3]!==void 0&&(a=Xe):a===Xe?d[0]===">"?(a=s??Et,c=-1):d[1]===void 0?c=-2:(c=a.lastIndex-d[2].length,u=d[1],a=d[3]===void 0?Xe:d[3]==='"'?cr:dr):a===cr||a===dr?a=Xe:a===lr||a===ur?a=Et:(a=Xe,s=void 0);let m=a===Xe&&n[r+1].startsWith("/>")?" ":"";o+=a===Et?l+Io:c>=0?(i.push(u),l.slice(0,c)+mr+l.slice(c)+Le+m):l+Le+(c===-2?r:m)}return[gr(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]},$t=class n{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let o=0,a=0,r=e.length-1,l=this.parts,[u,d]=Eo(e,t);if(this.el=n.createElement(u,i),We.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(s=We.nextNode())!==null&&l.length<r;){if(s.nodeType===1){if(s.hasAttributes())for(let c of s.getAttributeNames())if(c.endsWith(mr)){let p=d[a++],m=s.getAttribute(c).split(Le),y=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:y[2],strings:m,ctor:y[1]==="."?Si:y[1]==="?"?Mi:y[1]==="@"?$i:ut}),s.removeAttribute(c)}else c.startsWith(Le)&&(l.push({type:6,index:o}),s.removeAttribute(c));if(hr.test(s.tagName)){let c=s.textContent.split(Le),p=c.length-1;if(p>0){s.textContent=In?In.emptyScript:"";for(let m=0;m<p;m++)s.append(c[m],St()),We.nextNode(),l.push({type:2,index:++o});s.append(c[p],St())}}}else if(s.nodeType===8)if(s.data===fr)l.push({type:2,index:o});else{let c=-1;for(;(c=s.data.indexOf(Le,c+1))!==-1;)l.push({type:7,index:o}),c+=Le.length-1}o++}}static createElement(e,t){let i=Ge.createElement("template");return i.innerHTML=e,i}};function lt(n,e,t=n,i){if(e===Ke)return e;let s=i!==void 0?t._$Co?.[i]:t._$Cl,o=Mt(e)?void 0:e._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),o===void 0?s=void 0:(s=new o(n),s._$AT(n,t,i)),i!==void 0?(t._$Co??=[])[i]=s:t._$Cl=s),s!==void 0&&(e=lt(n,s._$AS(n,e.values),s,i)),e}var Ei=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??Ge).importNode(t,!0);We.currentNode=s;let o=We.nextNode(),a=0,r=0,l=i[0];for(;l!==void 0;){if(a===l.index){let u;l.type===2?u=new Ct(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new Ci(o,this,e)),this._$AV.push(u),l=i[++r]}a!==l?.index&&(o=We.nextNode(),a++)}return We.currentNode=Ge,s}p(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},Ct=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=Q,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=lt(this,e,t),Mt(e)?e===Q||e==null||e===""?(this._$AH!==Q&&this._$AR(),this._$AH=Q):e!==this._$AH&&e!==Ke&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):To(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Q&&Mt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ge.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=$t.createElement(gr(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{let o=new Ei(s,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=pr.get(e.strings);return t===void 0&&pr.set(e.strings,t=new $t(e)),t}k(e){Hi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,s=0;for(let o of e)s===t.length?t.push(i=new n(this.O(St()),this.O(St()),this,this.options)):i=t[s],i._$AI(o),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let i=e.nextSibling;e.remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ut=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,o){this.type=1,this._$AH=Q,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Q}_$AI(e,t=this,i,s){let o=this.strings,a=!1;if(o===void 0)e=lt(this,e,t,0),a=!Mt(e)||e!==this._$AH&&e!==Ke,a&&(this._$AH=e);else{let r=e,l,u;for(e=o[0],l=0;l<o.length-1;l++)u=lt(this,r[i+l],t,l),u===Ke&&(u=this._$AH[l]),a||=!Mt(u)||u!==this._$AH[l],u===Q?e=Q:e!==Q&&(e+=(u??"")+o[l+1]),this._$AH[l]=u}a&&!s&&this.j(e)}j(e){e===Q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Si=class extends ut{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Q?void 0:e}},Mi=class extends ut{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Q)}},$i=class extends ut{constructor(e,t,i,s,o){super(e,t,i,s,o),this.type=5}_$AI(e,t=this){if((e=lt(this,e,t,0)??Q)===Ke)return;let i=this._$AH,s=e===Q&&i!==Q||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==Q&&(i===Q||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ci=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){lt(this,e)}};var So=ki.litHtmlPolyfillSupport;So?.($t,Ct),(ki.litHtmlVersions??=[]).push("3.3.1");var yr=(n,e,t)=>{let i=t?.renderBefore??e,s=i._$litPart$;if(s===void 0){let o=t?.renderBefore??null;i._$litPart$=s=new Ct(e.insertBefore(St(),o),o,void 0,t??{})}return s._$AI(n),s};var Li=globalThis,Te=class extends Ie{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=yr(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ke}};Te._$litElement$=!0,Te.finalized=!0,Li.litElementHydrateSupport?.({LitElement:Te});var Mo=Li.litElementPolyfillSupport;Mo?.({LitElement:Te});(Li.litElementVersions??=[]).push("4.2.1");var Tn=class extends Error{constructor({headline:e,message:t}){super(t),this.name="ShinyClientError",this.headline=e}};var br=It`
button {
background-color: transparent;
outline: none;
border-style: none;
padding: var(--space-3);
border-radius: var(--space-1);
font-size: var(--font-lg);
background-color: inherit;
display: block;
}
button > svg {
display: block;
}
`,Sn=class Sn extends Te{toggleCollapsed(){this.classList.toggle("collapsed"),this.querySelector(".toggle-button")?.blur()}handleDismissAll(){this.classList.add("leaving"),this.addEventListener("animationend",()=>{this.remove()})}static createClientMessageElement({headline:e,message:t}){let i=document.createElement("shiny-error-message");return i.setAttribute("headline",e||""),i.setAttribute("message",t),i}appendConsoleMessage({headline:e,message:t}){let i=this.shadowRoot?.querySelector("slot.content");if(i){let s=a=>{let r=a.getAttribute("headline")||"",l=a.getAttribute("message")||"";return`${r}::${l}`},o=`${e}::${t}`;for(let a of i.assignedElements())if(a.tagName.toLowerCase()==="shiny-error-message"&&s(a)===o)return}this.appendChild(Sn.createClientMessageElement({headline:e,message:t}))}render(){return Pi` <div class="header">
<span class="title"> Shiny Client Errors </span>
<button
class="close-button"
@click=${this.handleDismissAll}
title="Dismiss all console messages and close console"
>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
height="1em"
width="1em"
stroke="currentColor"
class="close-icon"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M6 18L18 6M6 6l12 12"
/>
</svg>
Dismiss all
</button>
<button class="toggle-button" @click=${this.toggleCollapsed}>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
height="1em"
width="1em"
stroke="currentColor"
class="toggle-icon"
>
<path
class="collapse"
stroke-linecap="round"
stroke-linejoin="round"
d="M4.5 19.5l15-15m0 0H8.25m11.25 0v11.25"
/>
</svg>
</button>
</div>
<slot class="content"></slot>`}};Sn.styles=[It`
:host {
/* We declare hard pixel values here to avoid body font size changes
messing up the size of the console. This was an issue with bslib setting
the body font-size at 16px relative to base shiny's 14px. */
--font-md: 14px;
--font-lg: 16px;
--font-xl: 18px;
/* These are all taken from open-props */
--space-1: 6px;
--space-2: calc(var(--space-1) * 2);
--space-3: calc(var(--space-1) * 3);
--space-4: calc(var(--space-1) * 4);
--space-8: calc(var(--space-1) * 8);
--red-2: #ffc9c9;
--red-6: #fa5252;
--red-7: #f03e3e;
--red-8: #e03131;
--red-10: #b02525;
--red-11: #962020;
--red-12: #7d1a1a;
--gray-1: #f8f9fa;
--gray-2: #e9ecef;
--gray-3: #dee2e6;
--gray-4: #ced4da;
--gray-6: #868e96;
--gray-8: #6c757d;
--green-8: #51cf66;
--shadow-color: 220 3% 15%;
--shadow-strength: 1%;
--shadow-3:
0 -1px 3px 0
hsl(var(--shadow-color) / calc(var(--shadow-strength) + 2%)),
0 1px 2px -5px
hsl(var(--shadow-color) / calc(var(--shadow-strength) + 2%)),
0 2px 5px -5px
hsl(var(--shadow-color) / calc(var(--shadow-strength) + 4%)),
0 4px 12px -5px
hsl(var(--shadow-color) / calc(var(--shadow-strength) + 5%)),
0 12px 15px -5px
hsl(var(--shadow-color) / calc(var(--shadow-strength) + 7%));
--ring-shadow: 0 0 0 1px var(--gray-2);
/* How fast should the message pop in and out of the screen? */
--animation-speed: 500ms;
/* Taken from open-props */
--ease-3: cubic-bezier(0.25, 0, 0.3, 1);
--animation-slide-in-left: slide-in-left var(--animation-speed)
var(--ease-3);
--animation-slide-out-left: slide-out-left var(--animation-speed)
var(--ease-3);
--modal-bg-color: white;
position: fixed;
top: var(--space-1);
right: var(--space-1);
z-index: 1000;
display: flex;
flex-direction: column;
background-color: var(--modal-bg-color);
border-radius: var(--space-1);
animation: var(--animation-slide-in-left);
box-shadow: var(--shadow-3), var(--ring-shadow);
/* Dont let the error console burst out of the viewport */
max-height: calc(100vh - 2 * var(--space-1));
}
@keyframes slide-in-left {
from {
transform: translateX(100%);
}
}
@keyframes slide-out-left {
to {
transform: translateX(100%);
}
}
:host(.leaving) {
animation: var(--animation-slide-out-left);
}
.header {
display: flex;
justify-content: flex-end;
align-items: flex-start;
gap: var(--space-2);
}
.title {
font-size: var(--font-xl);
margin-right: auto;
padding: var(--space-3);
line-height: 1;
font-weight: 600;
color: var(--red-12);
}
${br}
button:hover {
background-color: var(--gray-2);
}
.toggle-button {
width: fit-content;
border: none;
aspect-ratio: 1;
border-color: var(--gray-4);
}
.close-button {
display: flex;
align-items: center;
color: var(--red-11);
}
.close-button > svg {
margin-right: 3px;
}
.toggle-button:focus {
outline: 1px solid black;
}
.toggle-icon {
transition: transform var(--animation-speed) ease-in-out;
}
:host(.collapsed) .toggle-icon {
transform: scaleX(-1) scaleY(-1);
}
:host(.collapsed) .close-button {
display: none;
}
.content {
display: block;
padding-inline: var(--space-4);
padding-block-start: 0;
padding-block-end: var(--space-4);
max-height: 100%;
overflow: auto;
}
:host(.collapsed) .content {
display: none;
}
`];var Bi=Sn;customElements.define("shiny-error-console",Bi);var kt=class extends Te{constructor(){super(...arguments);this.headline="";this.message=""}async copyErrorToClipboard(){await navigator.clipboard.writeText(this.message),this.classList.add("copy-success"),setTimeout(()=>{this.classList.remove("copy-success")},1e3)}render(){return Pi`
<div class="container">
<div class="decoration-container">
<div class="vertical-line"></div>
<div class="dot"></div>
</div>
<div class="contents">
<h3>${this.headline}</h3>
<pre class="error-message">${this.message}</pre>
</div>
<div class="actions">
<button
class="copy-button"
@click=${this.copyErrorToClipboard}
title="Copy error to clipboard"
>
<div class="copy-button-inner">
<svg
class="front"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
height="1em"
width="1em"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"
/>
</svg>
<svg
class="back"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
height="1em"
width="1em"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
</div>
</button>
</div>
</div>
`}};kt.properties={headline:{},message:{}},kt.styles=[It`
:host {
color: var(--red-11);
display: block;
font-size: var(--font-md);
position: relative;
--icon-size: var(--font-lg) /* Reset box sizing */
box-sizing: border-box;
}
.container {
display: flex;
gap: var(--space-2);
}
.contents {
width: 40ch;
display: flex;
flex-direction: column;
gap: var(--space-1);
padding-block-start: 0;
padding-block-end: var(--space-3);
overflow: auto;
}
:host(:last-of-type) .contents {
padding-block-end: var(--space-1);
}
.contents > h3 {
font-size: 1em;
font-weight: 500;
color: var(--red-12);
}
.contents > * {
margin-block: 0;
}
.error-message {
font-family: "Courier New", Courier, monospace;
white-space: pre-wrap;
}
.decoration-container {
flex-shrink: 0;
position: relative;
--line-w: 2px;
--dot-size: 11px;
}
:host(:hover) .decoration-container {
--scale: 1.25;
}
.vertical-line {
margin-inline: auto;
width: var(--line-w);
height: 100%;
background-color: var(--red-10);
}
:host(:first-of-type) .vertical-line {
height: calc(100% - var(--dot-size));
margin-top: var(--dot-size);
}
.dot {
position: absolute;
width: var(--dot-size);
height: var(--dot-size);
top: calc(-1px + var(--dot-size) / 2);
left: calc(50% - var(--dot-size) / 2);
border-radius: 100%;
transform: scale(var(--scale, 1));
color: var(--red-6);
background-color: var(--red-10);
}
.actions {
transform: scaleX(0);
transition: transform calc(var(--animation-speed) / 2) ease-in-out;
display: flex;
justify-content: center;
flex-direction: column;
}
/* Delay transition on mouseout so the buttons don't jump away if the user
overshoots them with their mouse */
:host(:not(:hover)) .actions {
transition-delay: 0.15s;
}
:host(:hover) .actions {
transform: scaleX(1);
}
${br}
.copy-button {
padding: 0;
width: var(--space-8);
height: var(--space-8);
position: relative;
--pad: var(--space-2);
}
.copy-button-inner {
position: relative;
width: 100%;
height: 100%;
border-radius: inherit;
transition: transform 0.5s;
transform-style: preserve-3d;
}
/* Animate flipping to the other side when the .copy-success class is
added to the host */
:host(.copy-success) .copy-button-inner {
transform: rotateY(180deg);
}
/* Position the front and back side */
.copy-button .front,
.copy-button .back {
--side: calc(100% - 2 * var(--pad));
position: absolute;
inset: var(--pad);
height: var(--side);
width: var(--side);
-webkit-backface-visibility: hidden; /* Safari */
backface-visibility: hidden;
}
.copy-button:hover .copy-button-inner {
background-color: var(--gray-2);
}
/* Style the back side */
.copy-button .back {
--pad: var(--space-1);
color: var(--green-8);
transform: rotateY(180deg);
}
`];customElements.define("shiny-error-message",kt);function vr({headline:n="",message:e,status:t="warning"}){let i=`[shiny] ${n}${n?" - ":""}${e}`;switch(t){case"error":console.error(i);break;case"warning":console.warn(i);break;default:console.log(i);break}if(!Wt())return;let s=document.querySelector("shiny-error-console");s||(s=document.createElement("shiny-error-console"),document.body.appendChild(s)),s.appendConsoleMessage({headline:n,message:e})}function Mn(n){let e=null,t="Error on client while running Shiny app";typeof n=="string"?e=n:n instanceof Tn?(e=n.message,t=n.headline):n instanceof Error?e=n.message:e="Unknown error",vr({headline:t,message:e,status:"error"})}var En=class extends CustomEvent{constructor(e){super("shiny:client-message",{detail:e,bubbles:!0,cancelable:!0})}};window.addEventListener("shiny:client-message",n=>{if(!(n instanceof CustomEvent))throw new Error("[shiny] shiny:client-message expected a CustomEvent");let{headline:e,message:t,status:i}=n.detail;if(!t)throw new Error("[shiny] shiny:client-message expected a `message` property in `event.detail`.");vr({headline:e,message:t,status:i})});function $n(n){me(n,null),yn.find(document.documentElement).trigger("shiny-internal:brushed",{brushId:n,outputId:null})}var Ht=class{constructor(e){this.pendingData={};this.reentrant=!1;this.sendIsEnqueued=!1;this.lastChanceCallback=[];this.shinyapp=e}setInput(e,t,i){this.pendingData[e]=t,this.reentrant||(i.priority==="event"?this._sendNow():this.sendIsEnqueued||this.shinyapp.taskQueue.enqueue(()=>{this.sendIsEnqueued=!1,this._sendNow()}))}_sendNow(){this.reentrant&&console.trace("Unexpected reentrancy in InputBatchSender!"),this.reentrant=!0;try{this.lastChanceCallback.forEach(t=>t());let e=this.pendingData;this.pendingData={},this.shinyapp.sendInput(e)}finally{this.reentrant=!1}}};var Dt=class{constructor(e){this.pendingInput={};this.target=e}setInput(e,t,i){/^\./.test(e)?this.target.setInput(e,t,i):this.pendingInput[e]={value:t,opts:i}}submit(){for(let e in this.pendingInput)if(x(this.pendingInput,e)){let{value:t,opts:i}=this.pendingInput[e];this.target.setInput(e,t,i)}}};var _i=M(S());function Be(n){let e=n.split(":");return{name:e[0],inputType:e.length>1?e[1]:""}}var Pt=class{constructor(e){this.target=e}setInput(e,t,i){let s=_i.default.Event("shiny:inputchanged"),o=Be(e);if(s.name=o.name,s.inputType=o.inputType,s.value=t,s.binding=i.binding||null,s.el=i.el||null,s.priority=i.priority,(0,_i.default)(i.el||window.document).trigger(s),!s.isDefaultPrevented()){let a=s.name;s.inputType!==""&&(a+=":"+s.inputType),this.target.setInput(a,s.value,{priority:i.priority})}}};var Lt=class{constructor(e,t={}){this.lastSentValues={};this.target=e,this.reset(t)}setInput(e,t,i){let{name:s,inputType:o}=Be(e),a=JSON.stringify(t);i.priority!=="event"&&this.lastSentValues[s]&&this.lastSentValues[s].jsonValue===a&&this.lastSentValues[s].inputType===o||(this.lastSentValues[s]={jsonValue:a,inputType:o},this.target.setInput(e,t,i))}reset(e={}){let t={};for(let i in e)if(x(e,i)){let{name:s,inputType:o}=Be(i);t[s]={jsonValue:JSON.stringify(e[i]),inputType:o}}this.lastSentValues=t}forget(e){delete this.lastSentValues[e]}};var Bt=class{constructor(e){this.inputRatePolicies={};this.target=e}setInput(e,t,i){let{name:s}=Be(e);this._ensureInit(s),i.priority!=="deferred"?this.inputRatePolicies[s].immediateCall(e,t,i):this.inputRatePolicies[s].normalCall(e,t,i)}setRatePolicy(e,t,i){let{name:s}=Be(e);t==="direct"?this.inputRatePolicies[s]=new ct(this,this._doSetInput):t==="debounce"?this.inputRatePolicies[s]=new ee(this,this._doSetInput,i):t==="throttle"&&(this.inputRatePolicies[s]=new Ce(this,this._doSetInput,i))}_ensureInit(e){e in this.inputRatePolicies||this.setRatePolicy(e,"direct")}_doSetInput(e,t,i){this.target.setInput(e,t,i)}};function Ai(n){let e={priority:"immediate",...n};switch(e.priority){case"deferred":case"immediate":case"event":break;default:throw new Error("Unexpected input value mode: '"+e.priority+"'")}return e}var _t=class{constructor(e){this.target=e}setInput(e,t,i={}){if(!e)throw"Can't set input with empty name.";let s=Ai(i);this.target.setInput(e,t,s)}};function $o(){let n,e;return{promise:new Promise((i,s)=>{n=i,e=s}),resolve:n,reject:e}}function wr(){let{promise:n,resolve:e}=$o(),t=!1;return{promise:n,resolve(i){t=!0,e(i)},then:n.then.bind(n),catch:n.catch.bind(n),finally:n.finally.bind(n),[Symbol.toStringTag]:"InitStatus",resolved(){return t}}}var J=M(S());var Cn=class{constructor(e,t){this.el=e,this.binding=t,t.resize&&(this.onResize=Ss(e,function(i,s){t.resize(e,i,s)}))}getId(){return this.binding.getId(this.el)}async onValueChange(e){await this.binding.onValueChange(this.el,e)}onValueError(e){this.binding.onValueError(this.el,e)}showProgress(e){this.binding.showProgress(this.el,e)}onResize(){}};function xr(n){return!!(n&&n.jquery)}function Co(n,e,t,i){let s=e.getId(t);if(s){let o=e.getValue(t),a=e.getType(t);a&&(s=s+":"+a);let r=ko(i);n.setInput(s,o,{priority:r,binding:e,el:t})}}function ko(n){return n===!1||n===void 0?"immediate":n===!0?"deferred":typeof n=="object"&&"priority"in n?n.priority:n}var At=(()=>{let n=new Map;function e(s){if(!xr(s)&&!(s instanceof HTMLElement))return;let o=new Map,a=new Set;if(n.forEach(($,C)=>{let I={input:0,output:0};$.forEach(B=>I[B]+=1),!(I.input+I.output<2)&&(o.set(C,I),I.input>1&&a.add("input"),I.output>1&&a.add("output"),I.input>=1&&I.output>=1&&a.add("shared"))}),o.size===0)return;let r=Array.from(o.entries()).map(([$,C])=>{let I=[Ir(C.input,"input"),Ir(C.output,"output")].filter(B=>B!=="").join(" and ");return`- "${$}": ${I}`}).join(`
`),l="Duplicate",u="input/output";a.has("input")&&a.has("output")||(a.has("input")?u="input":a.has("output")?u="output":a.has("shared")&&(l="Shared"));let d=o.size==1?"ID was":"IDs were",c=`${l} ${u} ${d} found`,p=`The following ${d} used for more than one ${a.has("shared")?"input/output":u}:
${r}`,m=new En({headline:c,message:p});((xr(s)?s.get(0):s)||window).dispatchEvent(m)}function t(s,o){let a=n.get(s);a?a.push(o):n.set(s,[o])}function i(s,o){let a=n.get(s);if(a){let r=a.indexOf(o);r>-1&&a.splice(r,1)}a?.length===0&&n.delete(s)}return{addBinding:t,removeBinding:i,checkValidity:e}})();function Ir(n,e){return n===0?"":n===1?`${n} ${e}`:`${n} ${e}s`}function Ho(n,e=document.documentElement){let{inputs:t,inputsRate:i,inputBindings:s}=n,o=s.getBindings(),a={};for(let r=0;r<o.length;r++){let l=o[r].binding,u=l.find(e)||[];for(let d=0;d<u.length;d++){let c=u[d];if(c.hasAttribute("data-shiny-no-bind-input"))continue;let p=l.getId(c);if(!p||(0,J.default)(c).hasClass("shiny-bound-input"))continue;let m=l.getType(c),y=m?p+":"+m:p;a[y]={value:l.getValue(c),opts:{immediate:!0,binding:l,el:c}};let $=function(){let I=l,B=c;return function(K){Co(t,I,B,K)}}();l.subscribe(c,$),(0,J.default)(c).data("shiny-input-binding",l),(0,J.default)(c).addClass("shiny-bound-input");let C=l.getRatePolicy(c);C!==null&&i.setRatePolicy(y,C.policy,C.delay),At.addBinding(p,"input"),(0,J.default)(c).trigger({type:"shiny:bound",binding:l,bindingType:"input"})}}return a}async function Do({sendOutputHiddenState:n,maybeAddThemeObserver:e,outputBindings:t,outputIsRecalculating:i},s=document.documentElement){let o=(0,J.default)(s),a=t.getBindings();for(let r=0;r<a.length;r++){let l=a[r].binding,u=l.find(o)||[];for(let d=0;d<u.length;d++){let c=u[d],p=l.getId(c);if(!p||!J.default.contains(document.documentElement,c))continue;let m=(0,J.default)(c);if(m.hasClass("shiny-bound-output"))continue;e(c);let y=new Cn(c,l);await as(p,y),m.data("shiny-output-binding",y),m.addClass("shiny-bound-output"),m.attr("aria-live")||m.attr("aria-live","polite"),i(p)&&y.showProgress(!0),At.addBinding(p,"output"),m.trigger({type:"shiny:bound",binding:l,bindingType:"output"})}}setTimeout(ue.regular,0),setTimeout(n,0)}function Po(n=document.documentElement,e=!1){let t=(0,J.default)(n).find(".shiny-bound-input").toArray();e&&(0,J.default)(n).hasClass("shiny-bound-input")&&t.push(n);for(let i=0;i<t.length;i++){let s=t[i],o=(0,J.default)(s).data("shiny-input-binding");if(!o)continue;let a=o.getId(s);(0,J.default)(s).removeClass("shiny-bound-input"),At.removeBinding(a,"input"),o.unsubscribe(s),(0,J.default)(s).trigger({type:"shiny:unbound",binding:o,bindingType:"input"})}}function Lo({sendOutputHiddenState:n},e=document.documentElement,t=!1){let i=(0,J.default)(e).find(".shiny-bound-output").toArray();t&&(0,J.default)(e).hasClass("shiny-bound-output")&&i.push(e);for(let s=0;s<i.length;s++){let o=(0,J.default)(i[s]),a=o.data("shiny-output-binding");if(!a)continue;let r=a.binding.getId(i[s]);ls(r,a),At.removeBinding(r,"output"),o.removeClass("shiny-bound-output"),o.removeData("shiny-output-binding"),o.trigger({type:"shiny:unbound",binding:a.binding,bindingType:"output"})}setTimeout(ue.regular,0),setTimeout(n,0)}async function Ri(n,e){await Do(n,e);let t=Ho(n,e);return At.checkValidity(e),t}function Tr(n,e,t=!1){Po(e,t),Lo(n,e,t)}async function Er(n,e){let t=await Ri(n,e),i=n.inputs;J.default.each(t,function(s,o){i.setInput(s,o.value,o.opts)}),n.initDeferredIframes()}var _e=M(S());async function kn({html:n="",deps:e=[]}={}){await ze(e),(0,_e.default)(".modal-backdrop").remove();let t=(0,_e.default)("#shiny-modal-wrapper");t.length===0&&(t=(0,_e.default)('<div id="shiny-modal-wrapper"></div>'),(0,_e.default)(document.body).append(t),t.on("hidden.bs.modal",function(i){i.target===(0,_e.default)("#shiny-modal")[0]&&(G(t),t.remove())})),t.on("keydown.shinymodal",function(i){(0,_e.default)("#shiny-modal").data("keyboard")!==!1&&i.keyCode===27&&(i.stopPropagation(),i.preventDefault())}),await re(t,{html:n})}function Hn(){let n=(0,_e.default)("#shiny-modal-wrapper");n.off("keydown.shinymodal");let e=n.find(".modal");e.length>0?(e.on("shown.bs.modal",()=>e.modal("hide")),e.modal("hide")):(G(n),n.remove())}var Rt=M(S());var Bo=250;async function Ee({html:n="",action:e="",deps:t=[],duration:i=5e3,id:s=null,closeButton:o=!0,type:a=null}={}){s||(s=Xt()),await ze(t),Ao();let r=Ot(s);r?.length===0&&(r=Ro(s));let l=r,u=`<div class="shiny-notification-content-text">${n}</div><div class="shiny-notification-content-action">${e}</div>`,d=l.find(".shiny-notification-content");await re(d,{html:u});let c=l?.attr("class");if(c){let m=c.split(/\s+/).filter(y=>y.match(/^shiny-notification-/)).join(" ");l.removeClass(m)}a&&a!=="default"&&l.addClass("shiny-notification-"+a);let p=l.find(".shiny-notification-close");return o&&p.length===0?l.append('<div class="shiny-notification-close">&times;</div>'):!o&&p.length!==0&&p.remove(),i?Oo(s,i):Sr(s),s}function Se(n){Ot(n)?.fadeOut(Bo,function(){G(this),(0,Rt.default)(this).remove(),_o().length===0&&Vt().remove()})}function Ot(n){return n?Vt().find("#shiny-notification-"+E(n)):null}function _o(){return Vt().find(".shiny-notification").map(function(){return this.id.replace(/shiny-notification-/,"")}).get()}function Vt(){return(0,Rt.default)("#shiny-notification-panel")}function Ao(){let n=Vt();return n.length>0||(0,Rt.default)(document.body).append('<div id="shiny-notification-panel">'),n}function Ro(n){let e=Ot(n);return e?.length===0&&(e=(0,Rt.default)(`<div id="shiny-notification-${n}" class="shiny-notification"><div class="shiny-notification-close">&times;</div><div class="shiny-notification-content"></div></div>`),e.find(".shiny-notification-close").on("click",t=>{t.preventDefault(),t.stopPropagation(),Se(n)}),Vt().append(e)),e}function Oo(n,e){Sr(n);let t=setTimeout(function(){Se(n)},e);Ot(n)?.data("removalCallback",t)}function Sr(n){let t=Ot(n)?.data("removalCallback");t&&clearTimeout(t)}var Oi=M(S());function Mr(n){let e=(0,Oi.default)("#shiny-reconnect-time");if(e.length===0)return;let t=Math.floor((n-new Date().getTime())/1e3);t>0?e.text(" in "+t+"s"):e.text("..."),setTimeout(function(){Mr(n)},1e3)}async function Dn(n){let e=new Date().getTime()+n;if((0,Oi.default)("#shiny-reconnect-text").length>0)return;await Ee({id:"reconnect",html:'<span id="shiny-reconnect-text">Attempting to reconnect</span><span id="shiny-reconnect-time"></span>',action:'<a id="shiny-reconnect-now" href="#" onclick="Shiny.shinyapp.reconnect();">Try now</a>',duration:null,closeButton:!1,type:"warning"}),Mr(e)}function Pn(){Se("reconnect")}var v=M(S());var Ln=class{constructor(){this.$promises=[];this.$resolvers=[]}_add(){let e=new Promise(t=>{this.$resolvers.push(t)});this.$promises.push(e)}enqueue(e){this.$resolvers.length||this._add(),this.$resolvers.shift()(e)}async dequeue(){return this.$promises.length||this._add(),this.$promises.shift()}isEmpty(){return!this.$promises.length}isBlocked(){return!!this.$resolvers.length}get length(){return this.$promises.length-this.$resolvers.length}};var A,$r,Cr,kr,Vi,zt,Ye,Bn=class{constructor(){Jt(this,A);this.outputStates=new Map;this.changedOutputs=new Map}takeChanges(){let e=this.changedOutputs;return this.changedOutputs=new Map,e}isRecalculating(e){let t=F(this,A,zt).call(this,e);return["initial","running","idle","persistent","invalidated"].includes(t)}updateStateFromMessage(e){Vo(e)&&F(this,A,$r).call(this,e),zo(e)&&F(this,A,Cr).call(this,e),No(e)&&F(this,A,kr).call(this,e)}};A=new WeakSet,$r=function(e){let{name:t,status:i}=e.recalculating,s=F(this,A,zt).call(this,t);if(i==="recalculating")switch(s){case"initial":case"invalidated":F(this,A,Ye).call(this,t,"running");break;default:throw new Error(`Shiny server sent a message that the output '${t}' is recalculating,
but the output is in an unexpected state of: '${s}'.`)}if(i==="recalculated")switch(s){case"running":F(this,A,Ye).call(this,t,"idle");break;default:throw new Error(`Shiny server sent a message that the output '${t}' has been recalculated,
but the output is in an unexpected state of: '${s}'.`)}},Cr=function(e){for(let t in e.values)F(this,A,Vi).call(this,t,"value");for(let t in e.errors)F(this,A,Vi).call(this,t,"error");for(let[t,i]of this.outputStates)switch(i){case"idle":F(this,A,Ye).call(this,t,"cancel");break;case"value":case"error":case"cancel":case"persistent":case"invalidated":break;default:throw new Error(`Shiny server sent a flush message, and after processing the values and errors,
the output '${t}' has an unexpected ending state of: '${i}'.`)}},kr=function(e){let{id:t,persistent:i}=e.progress.message,s=F(this,A,zt).call(this,t);if(i)switch(s){case"running":F(this,A,Ye).call(this,t,"persistent");break;default:throw new Error(`Shiny server has sent a 'persistent progress' message for ${t},
but the output is in an unexpected state of: ${s}`)}else switch(s){case"value":case"error":case"cancel":case"persistent":case"idle":F(this,A,Ye).call(this,t,"invalidated");break;default:throw new Error(`Shiny server has sent a progress message for ${t},
but the output is in an unexpected state of: ${s}`)}},Vi=function(e,t){let i=F(this,A,zt).call(this,e);switch(i){case"idle":F(this,A,Ye).call(this,e,t);break;default:throw new Error(`Shiny server has sent a ${t} for the output '${e}',
but the output is in an unexpected state of: '${i}'.`)}},zt=function(e){return this.outputStates.get(e)??"initial"},Ye=function(e,t){let i=this.isRecalculating(e);this.outputStates.set(e,t);let s=this.isRecalculating(e);i!==s&&this.changedOutputs.set(e,s)};function Vo(n){return n.recalculating!==void 0}function zo(n){let e=n;return e.values!==void 0&&e.errors!==void 0}function No(n){let e=n;return e.progress!==void 0&&e.progress.type==="binding"}var Hr=[],zi={},_n=[],An={};function R(n,e){if(zi[n])throw'handler for message of type "'+n+'" already added.';if(typeof e!="function")throw"handler must be a function.";if(e.length!==1)throw"handler must be a function that takes one argument.";Hr.push(n),zi[n]=e}function Dr(n,e){if(An[n]){let t=_n.indexOf(n);t!==-1&&(_n.splice(t,1),delete An[n])}if(typeof e!="function")throw"handler must be a function.";if(e.length!==1)throw"handler must be a function that takes one argument.";_n.push(n),An[n]=e}var Rn=class{constructor(){this.$socket=null;this.taskQueue=new Ln;this.config=null;this.$inputValues={};this.$initialInput=null;this.$bindings={};this.$outputProgress=new Bn;this.$values={};this.$errors={};this.$conditionals={};this.$pendingMessages=[];this.$activeRequests={};this.$nextRequestId=0;this.$allowReconnect=!1;this.scheduledReconnect=void 0;this.reconnectDelay=function(){let e=0,t=[1500,1500,2500,2500,5500,5500,10500];return{next:function(){let i=e;return i>=t.length&&(i=t.length-1),e++,t[i]},reset:function(){e=0}}}();this.progressHandlers={binding:function(e){let t=e.id,i=this.$bindings[t];i&&(0,v.default)(i.el).trigger({type:"shiny:outputinvalidated",binding:i,name:t}),this._updateProgress()},open:async function(e){if(e.style==="notification")await Ee({html:`<div id="shiny-progress-${e.id}" class="shiny-progress-notification"><div class="progress active" style="display: none;"><div class="progress-bar"></div></div><div class="progress-text"><span class="progress-message">message</span> <span class="progress-detail"></span></div></div>`,id:e.id,duration:null});else if(e.style==="old"){let t=(0,v.default)(".shiny-progress-container");t.length===0&&(t=(0,v.default)('<div class="shiny-progress-container"></div>'),(0,v.default)(document.body).append(t));let i=(0,v.default)(".shiny-progress.open").length,s=(0,v.default)('<div class="shiny-progress open"><div class="progress active"><div class="progress-bar bar"></div></div><div class="progress-text"><span class="progress-message">message</span><span class="progress-detail"></span></div></div>');s.attr("id",e.id),t.append(s);let o=s.find(".progress");if(o){o.css("top",i*o.height()+"px");let a=s.find(".progress-text");a.css("top",3*o.height()+i*a.outerHeight()+"px"),s.hide()}}},update:function(e){if(e.style==="notification"){let t=(0,v.default)("#shiny-progress-"+e.id);if(t.length===0)return;typeof e.message<"u"&&t.find(".progress-message").text(e.message),typeof e.detail<"u"&&t.find(".progress-detail").text(e.detail),typeof e.value<"u"&&e.value!==null&&(t.find(".progress").show(),t.find(".progress-bar").width(e.value*100+"%"))}else if(e.style==="old"){let t=(0,v.default)("#"+e.id+".shiny-progress");typeof e.message<"u"&&t.find(".progress-message").text(e.message),typeof e.detail<"u"&&t.find(".progress-detail").text(e.detail),typeof e.value<"u"&&e.value!==null&&(t.find(".progress").show(),t.find(".bar").width(e.value*100+"%")),t.fadeIn()}},close:function(e){if(e.style==="notification")Se(e.id);else if(e.style==="old"){let t=(0,v.default)("#"+e.id+".shiny-progress");t.removeClass("open"),t.fadeOut({complete:function(){t.remove(),(0,v.default)(".shiny-progress").length===0&&(0,v.default)(".shiny-progress-container").remove()}})}}};this._init()}connect(e){if(this.$socket)throw"Connect was already called on this application object";this.$socket=this.createSocket(),this.$initialInput=e,v.default.extend(this.$inputValues,e),this.$updateConditionals()}isConnected(){return!!this.$socket}reconnect(){if(clearTimeout(this.scheduledReconnect),this.isConnected())throw"Attempted to reconnect, but already connected.";this.$socket=this.createSocket(),this.$initialInput=v.default.extend({},this.$inputValues),this.$updateConditionals()}createSocket(){let t=(ms()||(()=>{let s="ws:";window.location.protocol==="https:"&&(s="wss:");let o=window.location.pathname;/^([$#!&-;=?-[\]_a-z~]|%[0-9a-fA-F]{2})+$/.test(o)||(o=encodeURI(o),Gi()&&(o=encodeURI(o))),/\/$/.test(o)||(o+="/"),o+="websocket/";let a=new WebSocket(s+"//"+window.location.host+o);return a.binaryType="arraybuffer",a}))(),i=!1;return t.onopen=()=>{for(i=!0,(0,v.default)(document).trigger({type:"shiny:connected",socket:t}),this.onConnected(),t.send(JSON.stringify({method:"init",data:this.$initialInput}));this.$pendingMessages.length;){let s=this.$pendingMessages.shift();t.send(s)}this.startActionQueueLoop()},t.onmessage=s=>{this.taskQueue.enqueue(async()=>await this.dispatchMessage(s.data))},t.onclose=s=>{let o=s.code===1012;i&&((0,v.default)(document).trigger({type:"shiny:disconnected",socket:t}),this.$notifyDisconnected()),this.onDisconnected(o),this.$removeSocket()},t}async startActionQueueLoop(){for(;;)try{await(await this.taskQueue.dequeue())()}catch(e){Mn(e),console.error(e)}}sendInput(e){let t=JSON.stringify({method:"update",data:e});this.$sendMsg(t),v.default.extend(this.$inputValues,e),this.$updateConditionals()}$notifyDisconnected(){window.parent&&window.parent.postMessage("disconnected","*")}$removeSocket(){this.$socket=null}$scheduleReconnect(e){this.scheduledReconnect=window.setTimeout(()=>{this.reconnect()},e)}onDisconnected(e=!1){if((0,v.default)("#shiny-disconnected-overlay").length===0&&(0,v.default)(document.body).append('<div id="shiny-disconnected-overlay"></div>'),(0,v.default)("#shiny-disconnected-overlay").toggleClass("reloading",e),this.$allowReconnect===!0&&this.$socket.allowReconnect===!0||this.$allowReconnect==="force"){let t=this.reconnectDelay.next();Dn(t),this.$scheduleReconnect(t)}}onConnected(){(0,v.default)("#shiny-disconnected-overlay").remove(),Pn(),this.reconnectDelay.reset()}makeRequest(e,t,i,s,o){let a=this.$nextRequestId;for(;this.$activeRequests[a];)a=(a+1)%1e9;this.$nextRequestId=a+1,this.$activeRequests[a]={onSuccess:i,onError:s};let r=JSON.stringify({method:e,args:t,tag:a});if(o){let l=function(p){let m=new ArrayBuffer(4);return new DataView(m).setUint32(0,p,!0),m},u=[];u.push(l(16908802));let d=new Blob([r]);u.push(l(d.size)),u.push(d);for(let p=0;p<o.length;p++){let m=o[p];u.push(l(m.byteLength||m.size||0)),u.push(m)}r=new Blob(u)}this.$sendMsg(r)}$sendMsg(e){this.$socket&&this.$socket.readyState?this.$socket.send(e):this.$pendingMessages.push(e)}receiveError(e,t){if(this.$errors[e]===t)return;this.$errors[e]=t,delete this.$values[e];let i=this.$bindings[e],s=v.default.Event("shiny:error");s.name=e,s.error=t,s.binding=i,(0,v.default)(i?i.el:document).trigger(s),!s.isDefaultPrevented()&&i&&i.onValueError&&i.onValueError(s.error)}async receiveOutput(e,t){let i=this.$bindings[e],s=v.default.Event("shiny:value");if(s.name=e,s.value=t,s.binding=i,this.$values[e]===t){(0,v.default)(i?i.el:document).trigger(s);return}return this.$values[e]=t,delete this.$errors[e],(0,v.default)(i?i.el:document).trigger(s),!s.isDefaultPrevented()&&i&&await i.onValueChange(s.value),t}async bindOutput(e,t){if(!e)throw new Error("Can't bind an element with no ID");return this.$bindings[e]=t,this.$values[e]!==void 0?await t.onValueChange(this.$values[e]):this.$errors[e]!==void 0&&t.onValueError(this.$errors[e]),t}unbindOutput(e,t){return this.$bindings[e]===t?(delete this.$bindings[e],!0):!1}_narrowScopeComponent(e,t){return Object.keys(e).filter(i=>i.indexOf(t)===0).map(i=>({[i.substring(t.length)]:e[i]})).reduce((i,s)=>v.default.extend(i,s),{})}_narrowScope(e,t){return t?{input:this._narrowScopeComponent(e.input,t),output:this._narrowScopeComponent(e.output,t)}:e}$updateConditionals(){(0,v.default)(document).trigger({type:"shiny:conditional"});let e={};for(let s in this.$inputValues)if(se(this.$inputValues,s)){let o=s.replace(/:.*/,"");e[o]=this.$inputValues[s]}let t={input:e,output:this.$values},i=(0,v.default)(document).find("[data-display-if]");for(let s=0;s<i.length;s++){let o=(0,v.default)(i[s]),a=o.data("data-display-if-func");if(!a){let c=o.attr("data-display-if");a=Ms(c),o.data("data-display-if-func",a)}let r=o.attr("data-ns-prefix"),l=this._narrowScope(t,r),u=!!a(l),d=o.css("display")!=="none";u!==d&&(u?(o.trigger("show"),o.show(),o.trigger("shown")):(o.trigger("hide"),o.hide(),o.trigger("hidden")))}}async dispatchMessage(e){let t={};if(typeof e=="string")t=JSON.parse(e);else{let s=new DataView(e,0,1).getUint8(0),o=new DataView(e,1,s),a=[];for(let l=0;l<s;l++)a.push(String.fromCharCode(o.getUint8(l)));let r=a.join("");e=e.slice(s+1),t.custom={},t.custom[r]=e}let i=v.default.Event("shiny:message");i.message=t,(0,v.default)(document).trigger(i),!i.isDefaultPrevented()&&(this.$outputProgress.updateStateFromMessage(i.message),await this._sendMessagesToHandlers(i.message,zi,Hr),this.$updateConditionals())}async _sendMessagesToHandlers(e,t,i){for(let s=0;s<i.length;s++){let o=i[s];se(e,o)&&await t[o].call(this,e[o])}}_updateProgress(){let e=this.$outputProgress.takeChanges();for(let[t,i]of e.entries())se(this.$bindings,t)&&this.$bindings[t].showProgress(i)}_init(){R("values",async r=>{this._updateProgress();for(let l in r)se(r,l)&&await this.receiveOutput(l,r[l])}),R("errors",r=>{for(let l in r)se(r,l)&&this.receiveError(l,r[l])}),R("inputMessages",async r=>{for(let l=0;l<r.length;l++){let u=(0,v.default)(".shiny-bound-input#"+E(r[l].id)),d=u.data("shiny-input-binding");if(u.length>0){u.attr("aria-live")||u.attr("aria-live","polite");let c=u[0],p=v.default.Event("shiny:updateinput");if(p.message=r[l].message,p.binding=d,(0,v.default)(c).trigger(p),!p.isDefaultPrevented())try{await d.receiveMessage(c,p.message)}catch(m){console.error("[shiny] Error in inputBinding.receiveMessage()",{error:m,binding:d,message:p.message})}}}}),R("javascript",r=>{Je(r)}),R("console",r=>{for(let l=0;l<r.length;l++)console.log&&console.log(r[l])}),R("progress",async r=>{if(r.type&&r.message){let l=await this.progressHandlers[r.type];l&&l.call(this,r.message)}}),R("notification",async r=>{if(r.type==="show")await Ee(r.message);else if(r.type==="remove")Se(r.message);else throw"Unkown notification type: "+r.type}),R("modal",async r=>{if(r.type==="show")await kn(r.message);else if(r.type==="remove")Hn();else throw"Unkown modal type: "+r.type}),R("response",r=>{let l=r.tag,u=this.$activeRequests[l];u&&(delete this.$activeRequests[l],"value"in r?u.onSuccess(r.value):u.onError(r.error))}),R("allowReconnect",r=>{switch(r){case!0:case!1:case"force":this.$allowReconnect=r;break;default:throw"Invalid value for allowReconnect: "+r}}),R("custom",async r=>{let l=us();l&&await l(r),await this._sendMessagesToHandlers(r,An,_n)}),R("config",r=>{this.config={workerId:r.workerId,sessionId:r.sessionId},r.user&&rs(r.user),(0,v.default)(document).trigger("shiny:sessioninitialized")}),R("busy",r=>{r==="busy"?((0,v.default)(document.documentElement).addClass("shiny-busy"),(0,v.default)(document).trigger("shiny:busy")):r==="idle"&&((0,v.default)(document.documentElement).removeClass("shiny-busy"),(0,v.default)(document).trigger("shiny:idle"))}),R("recalculating",r=>{if(se(r,"name")&&se(r,"status")){let l=this.$bindings[r.name];l?(0,v.default)(l.el).trigger("shiny:"+r.status):(0,v.default)().trigger("shiny:"+r.status)}}),R("reload",r=>{window.location.reload()}),R("shiny-insert-ui",async r=>{let l=(0,v.default)(r.selector);if(l.length===0)console.warn('The selector you chose ("'+r.selector+'") could not be found in the DOM.'),await mt(r.content.html,(0,v.default)([]),r.content.deps);else for(let u of l)if(await re(u,r.content,r.where),r.multiple===!1)break}),R("shiny-remove-ui",r=>{(0,v.default)(r.selector).each(function(u,d){return G(d,!0),(0,v.default)(d).remove(),r.multiple===!1?!1:void 0})}),R("frozen",r=>{for(let l=0;l<r.ids.length;l++)os(r.ids[l])});function e(r){let l=(0,v.default)("#"+E(r));if(l.length===0)throw"There is no tabsetPanel (or navbarPage or navlistPanel) with id equal to '"+r+"'";return l}function t(r){let l=r.attr("data-tabsetid");return(0,v.default)("div.tab-content[data-tabsetid='"+E(l)+"']")}function i(r,l,u){let d="[data-value='"+E(u)+"']",c=r.find("a"+d),p=c.parent();if(p.length===0)throw"There is no tabPanel (or navbarMenu) with value (or menuName) equal to '"+u+"'";let m=[],y=[];if(c.attr("data-toggle")==="dropdown"){let $=c.find("+ ul.dropdown-menu"),C=$.attr("data-tabsetid");$.find("a[data-toggle='tab']").parent("li").each(function(b,T){m.push((0,v.default)(T))});let B="div.tab-pane[id^='tab-"+E(C)+"']";l.find(B).each(function(b,T){y.push((0,v.default)(T))})}else y.push(l.find("div"+d));return{$liTag:p,$liTags:m,$divTags:y}}R("shiny-insert-tab",async r=>{let l=e(r.inputId),u=l,d=t(u),c=l.attr("data-tabsetid"),p=(0,v.default)("<div>");await re(p,r.liTag,"afterBegin");let m=(0,v.default)(p).find("> li"),y=m.find("> a"),$=null;r.target!==null&&($=i(u,d,r.target).$liTag);let C=K();if(C!==null){if(y.attr("data-toggle")==="dropdown")throw"Cannot insert a navbarMenu inside another one";u=C.$tabset,c=C.id,m.removeClass("nav-item").find(".nav-link").removeClass("nav-link").addClass("dropdown-item")}let I="";if(y.attr("data-toggle")==="tab"){let b=B(u,c),T="tab-"+c+"-"+b;m.find("> a").attr("href","#"+T),I=T}r.position==="before"?$?$.before(m):u.prepend(m):r.position==="after"&&($?$.after(m):u.append(m)),await Ve($?.parent()||u),await re(d[0],r.divTag,"beforeEnd"),I&&d.find('[id="tab-tsid-id"]').attr("id",I),r.select&&m.find("a").tab("show");function B(b,T){let _=[0];return b.find("> li").each(function(){let Me=(0,v.default)(this).find("> a[data-toggle='tab']");if(Me.length>0){let et=Me.attr("href").replace(/.*(?=#[^\s]+$)/,"").replace("#tab-"+T+"-","");_.push(Number(et))}}),Math.max.apply(null,_)+1}function K(){if(r.menuName!==null){let b=(0,v.default)("a.dropdown-toggle[data-value='"+E(r.menuName)+"']");if(b.length===0)throw"There is no navbarMenu with menuName equal to '"+r.menuName+"'";let T=b.find("+ ul.dropdown-menu"),_=T.attr("data-tabsetid");return{$tabset:T,id:_}}else if(r.target!==null&&$!==null){let b=$.parent("ul");if(b.hasClass("dropdown-menu")){let T=b.attr("data-tabsetid");return{$tabset:b,id:T}}}return null}});function s(r){let l=r.data("shiny-input-binding");if(!l.getValue(r)){let u=o(r),d=v.default.Event("shiny:updateinput");d.binding=l,r.trigger(d),l.setValue(r[0],u)}}function o(r){return r.find("li:visible a[data-toggle='tab']").first().attr("data-value")||null}function a(r,l,u=!1){v.default.each(r,function(d,c){d==="$liTag"?l(c):d==="$divTags"?v.default.each(c,function(p,m){l(m)}):u&&d==="$liTags"&&v.default.each(c,function(p,m){l(m)})})}R("shiny-remove-tab",r=>{let l=e(r.inputId),u=t(l),d=i(l,u,r.target);a(d,c),s(l);function c(p){G(p,!0),p.remove()}}),R("shiny-change-tab-visibility",r=>{let l=e(r.inputId),u=t(l),d=i(l,u,r.target);a(d,c,!0),s(l);function c(p){r.type==="show"?p.css("display",""):r.type==="hide"&&(p.hide(),p.removeClass("active"))}}),R("updateQueryString",r=>{if(r.mode==="replace"){window.history.replaceState(null,null,r.queryString);return}let l=null;if(r.queryString.charAt(0)==="#")l="hash";else if(r.queryString.charAt(0)==="?")l="query";else throw"The 'query' string must start with either '?' (to update the query string) or with '#' (to update the hash).";let u=window.location.pathname,d=window.location.search,c=window.location.hash,p=u;l==="query"?p+=r.queryString:p+=d+r.queryString,window.history.pushState(null,null,p),r.queryString.indexOf("#")!==-1&&(l="hash"),window.location.hash!==c&&(l="hash"),l==="hash"&&(0,v.default)(document).trigger("hashchange")}),R("resetBrush",r=>{$n(r.brushId)})}getTestSnapshotBaseUrl({fullUrl:e=!0}={}){let t=window.location,i="";return e&&(i=t.origin+t.pathname.replace(/\/[^/]*$/,"")),i+="/session/"+encodeURIComponent(this.config.sessionId)+"/dataobj/shinytest?w="+encodeURIComponent(this.config.workerId)+"&nonce="+Xt(),i}};var On=class{constructor(){this.version="1.12.1.9000";let{inputBindings:e,fileInputBinding:t}=js(),{outputBindings:i}=er();ps(t),this.$escape=E,this.compareVersion=ks,this.inputBindings=e,this.InputBinding=P,this.outputBindings=i,this.OutputBinding=U,this.resetBrush=$n,this.notifications={show:Ee,remove:Se},this.modal={show:kn,remove:Hn},this.addCustomMessageHandler=Dr,this.showReconnectDialog=Dn,this.hideReconnectDialog=Pn,this.renderDependenciesAsync=ze,this.renderDependencies=Gn,this.renderContentAsync=re,this.renderContent=we,this.renderHtmlAsync=mt,this.renderHtml=Wn,this.initializedPromise=wr(),(0,H.default)(()=>{setTimeout(async()=>{try{await this.initialize()}catch(s){throw Mn(s),s}},1)})}inDevMode(){return Wt()}async initialize(){ss(this),this.shinyapp=new Rn;let e=this.shinyapp;this.progressHandlers=e.progressHandlers;let t=new Ht(e),i=new Lt(t),s=new Pt(i),o=new Bt(s),a=new Dt(s),r;document.querySelector(".shiny-submit-button")?(r=a,document.querySelectorAll(".shiny-submit-button").forEach(function(f){f.addEventListener("click",function(h){h.preventDefault(),a.submit()})})):r=o;let l=new _t(r);this.setInputValue=this.onInputChange=function(f,h,L={}){let z=Ai(L);l.setInput(f,h,z)},this.forgetLastInputValue=function(f){i.forget(f)};let u=this.inputBindings,d=this.outputBindings,c=()=>({inputs:l,inputsRate:o,sendOutputHiddenState:Ze,maybeAddThemeObserver:I,inputBindings:u,outputBindings:d,initDeferredIframes:Pr,outputIsRecalculating:f=>this.shinyapp?.$outputProgress.isRecalculating(f)??!1});this.bindAll=async function(f){await Er(c(),f)},this.unbindAll=function(f,h=!1){Tr(c(),f,h)};function p(f=document.documentElement){let h=u.getBindings();for(let L=0;L<h.length;L++){let z=h[L].binding,Z=z.find(f);if(Z)for(let le=0;le<Z.length;le++){let pe=(0,H.default)(Z[le]);pe.data("_shiny_initialized")||(pe.data("_shiny_initialized",!0),z.initialize(Z[le]))}}}this.initializeInputs=p;function m(f){let L=(0,H.default)(f).data("shiny-output-binding");return L?L.getId():null}p(document.documentElement);let y=ce(await Ri(c(),document.documentElement),f=>f.value);(0,H.default)(".shiny-image-output, .shiny-plot-output, .shiny-report-size").each(function(){let f=m(this),h=ni(this);(h.width!==0||h.height!==0)&&(y[".clientdata_output_"+f+"_width"]=h.width,y[".clientdata_output_"+f+"_height"]=h.height)});function $(f){if(!f)return null;let h=fe(f,"background-color");if(!h)return h;let L=h.match(/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);if(h==="transparent"||L&&parseFloat(L[4])===0){let z=fe(f,"background-image");return z&&z!=="none"?null:$(f.parentElement)}return h}function C(f){let h=fe(f,"font-family"),L=fe(f,"font-size");return{families:h?.replace(/"/g,"").split(", "),size:L}}(0,H.default)(".shiny-image-output, .shiny-plot-output, .shiny-report-theme").each(function(){let f=this,h=m(f);y[".clientdata_output_"+h+"_bg"]=$(f),y[".clientdata_output_"+h+"_fg"]=fe(f,"color"),y[".clientdata_output_"+h+"_accent"]=ht(f),y[".clientdata_output_"+h+"_font"]=C(f),I(f)});function I(f){if(!window.MutationObserver)return;let h=f.classList;if(!(h.contains("shiny-image-output")||h.contains("shiny-plot-output")||h.contains("shiny-report-theme")))return;let z=(0,H.default)(f);if(z.data("shiny-theme-observer"))return;let Z=new ee(null,()=>B(f),100),le=new MutationObserver(()=>Z.normalCall()),pe={attributes:!0,attributeFilter:["style","class"]};le.observe(f,pe),z.data("shiny-theme-observer",le)}function B(f){if(f.classList.contains("shiny-output-error"))return;let h=m(f);l.setInput(".clientdata_output_"+h+"_bg",$(f)),l.setInput(".clientdata_output_"+h+"_fg",fe(f,"color")),l.setInput(".clientdata_output_"+h+"_accent",ht(f)),l.setInput(".clientdata_output_"+h+"_font",C(f))}function K(){(0,H.default)(".shiny-image-output, .shiny-plot-output, .shiny-report-size").each(function(){let f=m(this),h=ni(this);(h.width!==0||h.height!==0)&&(l.setInput(".clientdata_output_"+f+"_width",h.width),l.setInput(".clientdata_output_"+f+"_height",h.height))}),(0,H.default)(".shiny-image-output, .shiny-plot-output, .shiny-report-theme").each(function(){B(this)}),(0,H.default)(".shiny-bound-output").each(function(){let f=(0,H.default)(this),h=f.data("shiny-output-binding");f.trigger({type:"shiny:visualchange",visible:!b(this),binding:h}),h.onResize()})}ue.setImageSend(t,K);function b(f){return f===null||f.offsetWidth!==0||f.offsetHeight!==0?!1:fe(f,"display")==="none"?!0:b(f.parentNode)}let T={};(0,H.default)(".shiny-bound-output").each(function(){let f=m(this);b(this)?y[".clientdata_output_"+f+"_hidden"]=!0:(T[f]=!0,y[".clientdata_output_"+f+"_hidden"]=!1)});function _(){let f={};(0,H.default)(".shiny-bound-output").each(function(){let h=m(this);delete T[h];let L=b(this),z={type:"shiny:visualchange",visible:!L};L?l.setInput(".clientdata_output_"+h+"_hidden",!0):(f[h]=!0,l.setInput(".clientdata_output_"+h+"_hidden",!1));let Z=(0,H.default)(this);z.binding=Z.data("shiny-output-binding"),Z.trigger(z)});for(let h in T)x(T,h)&&l.setInput(".clientdata_output_"+h+"_hidden",!0);T=f}let Me=new ee(null,_,0);function Ze(){Me.normalCall()}t.lastChanceCallback.push(function(){Me.isPending()&&Me.immediateCall()});function et(f,h,...L){let z=f.split(".");return function(Z){let le=Z.namespace?.split(".")??[];for(let pe=0;pe<z.length;pe++)if(le.indexOf(z[pe])===-1)return;h.apply(this,[z,h,...L])}}(0,H.default)(window).resize($e(500,ue.regular));let Nn=["modal","dropdown","tab","tooltip","popover","collapse"];H.default.each(Nn,function(f,h){(0,H.default)(document.body).on("shown.bs."+h+".sendImageSize","*",et("bs",ue.regular)),(0,H.default)(document.body).on("shown.bs."+h+".sendOutputHiddenState hidden.bs."+h+".sendOutputHiddenState","*",et("bs",Ze))}),(0,H.default)(document.body).on("shown.sendImageSize","*",ue.regular),(0,H.default)(document.body).on("shown.sendOutputHiddenState hidden.sendOutputHiddenState","*",Ze),y[".clientdata_pixelratio"]=ti(),(0,H.default)(window).resize(function(){l.setInput(".clientdata_pixelratio",ti())}),y[".clientdata_url_protocol"]=window.location.protocol,y[".clientdata_url_hostname"]=window.location.hostname,y[".clientdata_url_port"]=window.location.port,y[".clientdata_url_pathname"]=window.location.pathname,y[".clientdata_url_search"]=window.location.search,(0,H.default)(window).on("pushstate",function(f){l.setInput(".clientdata_url_search",window.location.search)}),(0,H.default)(window).on("popstate",function(f){l.setInput(".clientdata_url_search",window.location.search)}),y[".clientdata_url_hash_initial"]=window.location.hash,y[".clientdata_url_hash"]=window.location.hash,(0,H.default)(window).on("hashchange",function(f){l.setInput(".clientdata_url_hash",window.location.hash)});let Un=y[".clientdata_singletons"]=(0,H.default)('script[type="application/shiny-singletons"]').text();fs(Un.split(/,/));let Qn=(0,H.default)('script[type="application/html-dependencies"]').text();H.default.each(Qn.split(/;/),function(f,h){let L=/\s*^(.+)\[(.+)\]\s*$/.exec(h);L&&qt(L[1],L[2])}),i.reset(y),e.connect(y),(0,H.default)(document).one("shiny:connected",()=>{Pr()}),(0,H.default)(document).one("shiny:sessioninitialized",()=>{this.initializedPromise.resolve()})}};function Pr(){!window.Shiny||!window.Shiny.shinyapp||!window.Shiny.shinyapp.isConnected()||(0,H.default)(".shiny-frame-deferred").each(function(n,e){let t=(0,H.default)(e);t.removeClass("shiny-frame-deferred"),t.attr("src",t.attr("data-deferred-src")),t.attr("data-deferred-src",null)})}function Lr(){return window.navigator.userAgent}var zn=M(S());function Vn(){return Oe().config}function Br(){(0,zn.default)(document).on("keydown",function(n){if(n.which!==114||!n.ctrlKey&&!n.metaKey||n.shiftKey||n.altKey)return;let e="reactlog?w="+window.escape(Vn().workerId)+"&s="+window.escape(Vn().sessionId);window.open(e),n.preventDefault()}),(0,zn.default)(document).on("keydown",function(n){if(!(n.which===115&&(n.ctrlKey||n.metaKey)&&!n.shiftKey&&!n.altKey||n.which===114&&(n.ctrlKey||n.metaKey)&&n.shiftKey&&!n.altKey))return;let e="reactlog/mark?w="+window.escape(Vn().workerId)+"&s="+window.escape(Vn().sessionId);zn.default.get(e,function(t){if(t!=="marked")return;Ee({html:'<span id="shiny-reactlog-mark-text">Marked time point in reactlog</span>',closeButton:!0})}).fail(function(){window.open(e)}),n.preventDefault()})}var _r;function Ar(){if(window.Shiny)throw new Error("Trying to create window.Shiny, but it already exists!");_r=window.Shiny=new On,Yi(Lr()),Zi(),is(),ts(),Br()}Ar();})();
/*! Bundled license information:
@lit/reactive-element/css-tag.js:
(**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
@lit/reactive-element/reactive-element.js:
lit-html/lit-html.js:
lit-element/lit-element.js:
(**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/is-server.js:
(**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
*/
//# sourceMappingURL=shiny.min.js.map