"use strict";(self.webpackChunkWebComponents=self.webpackChunkWebComponents||[]).push([[460],{67460:(t,i,e)=>{e.r(i);var s=e(78673),o={};class d extends s.A{constructor(t){super(t);var i=t.orig;this.origElem=i,this.divid=i.id,this.dataModal=!1,$(this.origElem).is("[data-modal]")&&(this.dataModal=!0),$(this.origElem).is("[data-instructoronly]")?this.instructorOnly=!0:this.instructorOnly=!1,this.modalTitle=null,this.showtitle=null,this.hidetitle=null,this.origContent=$(this.origElem).html(),this.children=[],this.adoptChildren(),this.checkForTitle(),this.getButtonTitles(),this.instructorOnly||(this.createShowButton(),this.dataModal||this.createHideButton()),this.indicate_component_ready()}adoptChildren(){for(var t=0;t<this.origElem.childNodes.length;t++)this.children.push(this.origElem.childNodes[t])}getButtonTitles(){this.showtitle=$(this.origElem).data("showtitle"),void 0===this.showtitle&&(this.showtitle="Show"),this.instructorOnly&&(this.showtitle+=" IG"),this.hidetitle=$(this.origElem).data("hidetitle"),void 0===this.hidetitle&&(this.hidetitle="Hide")}checkForTitle(){this.modalTitle=$(this.origElem).data("title"),void 0===this.modalTitle&&(this.modalTitle="Message from the author")}createShowButton(){var t=this;if(this.containerDiv=document.createElement("div"),this.containerDiv.id=this.divid,!this.dataModal){this.revealDiv=document.createElement("div");for(var i=0;i<this.children.length;i++)this.revealDiv.appendChild(this.children[i]);$(this.revealDiv).hide(),this.containerDiv.appendChild(this.revealDiv)}this.instructorOnly&&$(this.revealDiv).addClass("iguide"),this.sbutt=document.createElement("button"),$(this.sbutt).addClass("btn reveal_button"),this.instructorOnly?$(this.sbutt).addClass("btn-info"):$(this.sbutt).addClass("btn-default"),$(this.sbutt).css("margin-bottom","10px"),this.sbutt.textContent=this.showtitle,this.sbutt.id=this.divid+"_show",this.dataModal?(this.createModal(),$(this.sbutt).attr({"data-toggle":"modal","data-target":"#"+this.divid+"_modal"})):this.sbutt.onclick=function(){t.showInline(),$(this).hide()},this.containerDiv.appendChild(this.sbutt),$(this.origElem).replaceWith(this.containerDiv)}createHideButton(){var t=this;this.hbutt=document.createElement("button"),$(this.hbutt).hide(),this.hbutt.textContent=this.hidetitle,this.hbutt.className="btn btn-default reveal_button",$(this.hbutt).css("margin-bottom","10px"),this.hbutt.id=this.divid+"_hide",this.hbutt.onclick=function(){t.hideInline(),$(this).hide()},this.containerDiv.appendChild(this.hbutt)}createInstructorButtons(){this.createShowButton(),this.dataModal||this.createHideButton()}createModal(){this.modalContainerDiv=document.createElement("div"),$(this.modalContainerDiv).addClass("modal fade"),this.modalContainerDiv.id=this.divid+"_modal",$(this.modalContainerDiv).attr("role","dialog"),document.body.appendChild(this.modalContainerDiv),this.modalDialogDiv=document.createElement("div"),$(this.modalDialogDiv).addClass("modal-dialog"),this.modalContainerDiv.appendChild(this.modalDialogDiv),this.modalContentDiv=document.createElement("div"),$(this.modalContentDiv).addClass("modal-content"),this.modalDialogDiv.appendChild(this.modalContentDiv),this.modalHeaderDiv=document.createElement("div"),$(this.modalHeaderDiv).addClass("modal-header"),this.modalContentDiv.appendChild(this.modalHeaderDiv),this.modalButton=document.createElement("button"),this.modalButton.type="button",$(this.modalButton).addClass("close"),$(this.modalButton).attr({"aria-hidden":"true","data-dismiss":"modal"}),this.modalButton.innerHTML="&times",this.modalHeaderDiv.appendChild(this.modalButton),this.modalTitleE=document.createElement("h4"),$(this.modalTitleE).addClass("modal-title"),this.modalTitleE.innerHTML=this.modalTitle,this.modalHeaderDiv.appendChild(this.modalTitleE),this.modalBody=document.createElement("div"),$(this.modalBody).addClass("modal-body");for(var t=0;t<this.children.length;t++)this.modalBody.appendChild(this.children[t]);this.modalContentDiv.appendChild(this.modalBody)}showInline(){$(this.revealDiv).show(),$(this.hbutt).show(),$(this.revealDiv).find(".CodeMirror").each((function(t,i){i.CodeMirror.refresh()}))}hideInline(){$(this.revealDiv).hide(),$(this.sbutt).show()}}$(document).on("runestone:login-complete",(function(){if($("[data-component=reveal]").each((function(t){try{o[this.id]=new d({orig:this})}catch(t){console.log(`Error rendering Reveal ${this.id}`)}})),eBookConfig.isInstructor)for(const t of Object.keys(o))o[t].instructorOnly&&o[t].createInstructorButtons()}))}}]);
//# sourceMappingURL=460.bae9001422d7a484.js.map