var s=class extends window.Shiny.OutputBinding{constructor(){super(...arguments);this.originalBodyTagAttrs=null}find(t){return $(t).find(".shiny-page-output")}onValueError(t,e){window.Shiny.unbindAll&&window.Shiny.unbindAll(t),this.renderError(t,e)}async renderValue(t,e){if(e===null)return;if(t!==document.body)throw new Error('Output with class "shiny-page-output" must be a <body> tag.');if(this.originalBodyTagAttrs===null)this.originalBodyTagAttrs=Array.from(t.attributes);else for(let n of this.originalBodyTagAttrs)t.setAttribute(n.name,n.value);let r=typeof e=="string"?e:e.html,i=new DOMParser().parseFromString(r,"text/html");i.documentElement.lang&&(document.documentElement.lang=i.documentElement.lang),i.title&&(document.title=i.title);for(let n of Array.from(i.body.attributes))n.name==="class"?t.classList.add(...n.value.split(" ")):t.setAttribute(n.name,n.value);r=r.replace(/<html>.*<body[^>]*>/gis,"").replace(/<\/body>.*<\/html>/gis,""),typeof e=="string"?e=r:e.html=r,await window.Shiny.renderContentAsync(t,e)}};window.Shiny.outputBindings.register(new s,"shinyPageOutputBinding");export{s as PageOutputBinding};
//# sourceMappingURL=page-output.js.map
