class TinyDrawer{constructor(e){this.o=Object.assign({},this.defaults(),e)}load(){document.addEventListener("DOMContentLoaded",()=>{this.backdropAdd(),this.setup(),this.triggerOpen(),this.triggerClose(),this.activeUnset()})}defaults(){return{replacement:"drawer",drawerSelector:"roulette-wheel-container"}}setup(){this.elementDrawer=document.querySelector(this.o.drawerSelector),this.elementOpen=document.querySelectorAll("[data-"+this.o.replacement+"-open]"),this.elementClose=document.querySelectorAll("[data-"+this.o.replacement+"-backdrop], [data-"+this.o.replacement+"-close]")}triggerOpen(){this.elementOpen.forEach(e=>{e.addEventListener("click",e=>{this.open(e.target)})})}triggerClose(){this.elementClose.forEach(e=>{e.addEventListener("click",e=>{this.close(e.target)})})}activeUnset(){document.body.dataset[this.o.replacement]=""}activeSet(){document.body.dataset[this.o.replacement]=!0}offsetTopToVariable(){var e=document.body.getBoundingClientRect();this.top=-e.top}open(e=null){this.activeSet(),this.offsetTopToVariable(),this.callback(e,"open")}close(e=null){this.activeUnset(),window.scrollTo(0,this.top),this.callback(e,"close")}backdropAdd(){let e=document.createElement("div");e.dataset[this.o.replacement+"Backdrop"]="",document.body.appendChild(e)}callback(e,t){void 0!==this.o.callback&&this.o.callback(e,t)}}var tinyDrawerObj;function tinyDrawer(e){return(tinyDrawerObj=new TinyDrawer(e)).load(),tinyDrawerObj}function tinyDrawerOpen(e=null){let t=e?e.target:null;tinyDrawerObj.open(t)}function tinyDrawerClose(e=null){let t=e?e.target:null;tinyDrawerObj.close(t)}