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AAM,SACnC,EAAU,WAAW,UAC/B,KAAK,GAAG,MAAM,eAAiB,aAC/B,KAAK,mBAAqB,CAAC,IAAK,MAAO,KAAM,UAG1C,EAAU,SAAS,UACtB,KAAK,GAAG,MAAM,WAAa,WACjB,EAAU,SAAS,SAC7B,KAAK,GAAG,MAAM,WAAa,cAG5B,KAAK,mBACL,aAAa,KAAK,UAClB,MAAM,OAAO,MAAM,IAClB,GAAI,EAAM,CACT,IAAI,EAAW,EAAK,cAAc,qBAClC,EAAS,IAAM,EACf,EAAS,aAAa,QAAS,OAChC,CACA,EAAK,cAAc,oBAAoB,UAAY,EACnD,KAAK,SAAW,YAAW,IAAI,KAAK,SAAS,EAAO,GAEtD,EAID,MAAM,YAAc,IAAI,WAClB,cAAgB,IAAI,aACpB,aAAe,IAAI,YACnB,YAAc,IAAI","file":"/gh/shashfrankenstien/lib-modaljs@0.3.0/lib-modal.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /gh/shashfrankenstien/lib-modaljs@0.3.0/lib-modal.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*\n*\nMIT License\n\nCopyright (c) 2021 Shashank Gopikrishna\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n**/\n\n\nclass Modal {\n\tconstructor(elem, options) {\n\t\toptions = options || {}\n\t\tthis.autoClose = options.autoClose || false // autoClose = true enables modal close on Escape press and outside click\n\t\tthis.noCloseBtn = options.noCloseBtn || false // Don't display close button on top right\n\t\tthis.beforeOpen = options.beforeOpen // beforeOpen() is called with the content element everytime open() is called\n\t\tthis.afterClose = options.afterClose // afterClose() is called with no args everytime close() is called\n\t\tthis.noTransition = options.noTransition || false // noTransition = true disables modal transition\n\n\t\tthis.bg = this._makeCover()\n\t\tthis.bg.style.backgroundColor = (options.noFade) ? \"transparent\" : \"black\"\n\n\t\tthis.fg = this._makeCover()\n\t\tthis.fg.style.backgroundColor = \"transparent\"\n\n\t\t// set up trnsition timing\n\t\tthis.transitionStartPos = {}\n\t\tif (!this.noTransition) { // setup transitions\n\t\t\tthis.transitionStartPos = options.transitionStartPos || {top: '10%'}\n\t\t\tthis.bg.style.transition = \"all 0.1s ease\"\n\t\t\tthis.fg.style.transition = \"all 0.15s ease\"\n\t\t}\n\t\tthis._resetTransition()\n\n\t\tif (this.autoClose) {\n\t\t\tthis.fg.onmousedown = (evt)=>{\n\t\t\t\tif (evt.target===this.fg) this.close()\n\t\t\t}\n\t\t}\n\n\t\tthis.container = this._makeCover()\n\t\tthis.container.classList.add(...(options.classList || []))\n\t\tthis.container.style.height = options.height\n\t\tthis.container.style.width = options.width\n\t\tconst css = Object.assign({\n\t\t\tposition: \"relative\",\n\t\t\tborderRadius: options.borderRadius || \"4px\",\n\t\t\tbackgroundColor: options.containerColor || \"white\",\n\t\t\tcolor: \"#0d0d0d\",\n\t\t\tboxShadow: \"0 4px 8px 0 rgba(0,0,0,0.4)\",\n\t\t\tmarginRight: options.marginRight || \"20px\",\n\t\t\tmarginLeft: options.marginLeft || \"20px\",\n\t\t\t// overflowY: \"scroll\",\n\t\t}, options.css || {})\n\t\tObject.assign(this.container.style, css)\n\n\t\tthis.fg.appendChild(this.container)\n\n\t\tthis.content = elem // save the content element\n\t\tthis.content.remove() // remove it from DOM\n\t\tthis.content.style.display = options.displayStyle || \"block\" // set display style of content\n\n\t\tthis._escapePressed = this._escapePressed.bind(this)\n\t}\n\n\t_makeCloseBtn() {\n\t\tlet btn = document.createElement(\"span\")\n\t\tbtn.classList.add('close-btn')\n\t\tbtn.innerHTML = \"&times;\"\n\t\tbtn.onclick = ()=>{\n\t\t\tthis.close()\n\t\t}\n\t\tObject.assign(btn.style, {\n\t\t\tposition: \"absolute\",\n\t\t\tdisplay: \"flex\",\n\t\t\tjustifyContent: \"center\",\n\t\t\talignItems: \"center\",\n\t\t\ttop: \"15px\",\n\t\t\tright: \"25px\",\n\t\t\twidth: \"40px\",\n\t\t\theight: \"40px\",\n\t\t\tborderRadius: \"20px\",\n\t\t\tcursor: \"pointer\",\n\n\t\t\tbackground: \"#e3e3e3\",\n\t\t\topacity: \"0.8\",\n\t\t\tfontSize: \"20px\",\n\t\t\tfontWeight: \"1000\",\n\t\t\tzIndex: '110',\n\t\t})\n\t\treturn btn\n\t}\n\n\t_makeCover() {\n\t\tlet cover = document.createElement(\"div\")\n\t\tObject.assign(cover.style, {\n\t\t\tposition: 'fixed',\n\t\t\theight: '100%',\n\t\t\twidth: '100%',\n\t\t\ttop: '0',\n\t\t\tbottom: '0',\n\t\t\tright: '0',\n\t\t\tleft: '0',\n\t\t\tzIndex: '100',\n\t\t\tdisplay: 'flex',\n\t\t\tjustifyContent: 'center',\n\t\t\talignItems: 'center',\n\t\t\toverflow: 'hidden',\n\t\t})\n\t\treturn cover\n\t}\n\n\t_resetTransition() {\n\t\t// set values to closed state\n\t\tthis.bg.style.opacity = \"0\"\n\t\tthis.fg.style.opacity = \"0\"\n\t\tfor (const direction in this.transitionStartPos) {\n\t\t\tthis.fg.style[direction] = this.transitionStartPos[direction]\n\t\t}\n\t}\n\n\t_performTransition() {\n\t\t// set values to open state\n\t\tthis.bg.style.opacity = \"0.5\"\n\t\tObject.assign(this.fg.style, {\n\t\t\topacity: \"1\",\n\t\t\ttop: \"0px\",\n\t\t\tbottom: \"0px\",\n\t\t\tright: \"0px\",\n\t\t\tleft: \"0px\",\n\t\t})\n\t}\n\n\t_escapePressed(evt) {\n\t\tif (evt.key === \"Escape\") { // escape key maps to keycode `27`\n\t\t\tthis.close()\n\t\t}\n\t}\n\n\tcloneContent() {\n\t\treturn this.content.cloneNode(true)\n\t}\n\n\tasync open(mod_elem) {\n\t\tlet clone_elem = mod_elem || this.cloneContent() // clone content so that all input fields are reset\n\t\tif (this.beforeOpen) this.beforeOpen(clone_elem) // usually used to attach required events\n\n\t\tthis.container.innerHTML = \"\" // clear container\n\t\tif (!this.noCloseBtn) this.container.appendChild(this._makeCloseBtn())\n\t\tthis.container.appendChild(clone_elem) // append the new clone\n\n\t\tdocument.body.appendChild(this.bg)\n\t\tdocument.body.appendChild(this.fg)\n\n\t\tif (!this.noTransition) { // setup transitions\n\t\t\t// perform transition after a short timeout so that browser performs 'reflow'\n\t\t\t// see this answer: https://stackoverflow.com/a/24195559/5712554\n\t\t\tsetTimeout(()=>{this._performTransition()}, 100)\n\t\t} else {\n\t\t\tthis._performTransition()\n\t\t}\n\n\t\tif (this.autoClose) {\n\t\t\tdocument.body.addEventListener('keyup', this._escapePressed)\n\t\t}\n\t\treturn clone_elem\n\t}\n\n\tclose() {\n\t\tif (this.autoClose) {\n\t\t\tdocument.body.removeEventListener('keyup', this._escapePressed)\n\t\t}\n\t\tconst exitFunc = ()=>{ // provide time to reset transition (this performs reverse transition)\n\t\t\tthis.bg.remove()\n\t\t\tthis.fg.remove()\n\t\t\tif (this.afterClose) this.afterClose()\n\t\t}\n\t\tif (!this.noTransition) { // setup transitions\n\t\t\tthis._resetTransition()\n\t\t\tsetTimeout(exitFunc, 200) // wait for 250ms since longest transitions is 200ms (0.2s)\n\t\t} else {\n\t\t\texitFunc()\n\t\t}\n\t}\n}\n\n\nclass _ModalDrawerBase extends Modal {\n\tconstructor(elem, options) {\n\t\toptions = options || {}\n\t\toptions.css = options.css || {}\n\t\tObject.assign(options.css, {\n\t\t\tborderRadius: options.borderRadius || \"0px\",\n\t\t\tmarginRight: options.marginRight || \"0px\",\n\t\t\tmarginLeft: options.marginLeft || \"0px\",\n\t\t})\n\t\tsuper(elem, options)\n\t}\n}\n\nclass ModalDrawerHorizontal extends _ModalDrawerBase {\n\tconstructor(elem, options) {\n\t\tlet transSign = (options.side==='bottom') ? '': '-' // negative or positive sign for 'top' value\n\t\toptions.transitionStartPos = {top: transSign + options.height}\n\t\toptions.width = \"100%\"\n\t\tsuper(elem, options)\n\t\tthis.fg.style.flexDirection = 'column'\n\t\tthis.fg.style.justifyContent = (options.side==='bottom') ? 'flex-end' : 'flex-start'\n\t}\n}\n\n\nclass ModalDrawerVertical extends _ModalDrawerBase {\n\tconstructor(elem, options) {\n\t\tlet transSign = (options.side==='right') ? '': '-' // negative or positive sign for 'left' value\n\t\toptions.transitionStartPos = {left: transSign + options.width}\n\t\toptions.height = \"100%\"\n\t\tsuper(elem, options)\n\t\tthis.fg.style.flexDirection = 'row'\n\t\tthis.fg.style.justifyContent = (options.side==='right') ? 'flex-end' : 'flex-start'\n\t}\n}\n\n\nclass ModalDrawerTop extends ModalDrawerHorizontal {\n\tconstructor(elem, options) {\n\t\toptions.side = 'top'\n\t\tsuper(elem, options)\n\t}\n}\n\nclass ModalDrawerBottom extends ModalDrawerHorizontal {\n\tconstructor(elem, options) {\n\t\toptions.side = 'bottom'\n\t\tsuper(elem, options)\n\t}\n}\n\n\nclass ModalDrawerRight extends ModalDrawerVertical {\n\tconstructor(elem, options) {\n\t\toptions.side = 'right'\n\t\tsuper(elem, options)\n\t}\n}\n\nclass ModalDrawerLeft extends ModalDrawerVertical {\n\tconstructor(elem, options) {\n\t\toptions.side = 'left'\n\t\tsuper(elem, options)\n\t}\n}\n\n\n\n\n\n\nclass ModalAlert extends Modal {\n\tconstructor(options) {\n\t\tlet elem = document.createElement(\"div\")\n\t\telem.style.width = \"80%\"\n\t\telem.style.height = \"40%\"\n\n\t\tlet ok = document.createElement(\"button\")\n\t\tok.classList.add(\"modal-alert-ok\", \"btn\", 'btn-primary')\n\t\tObject.assign(ok.style, {\n\t\t\tposition: \"absolute\",\n\t\t\tbottom: \"10%\",\n\t\t\theight: \"20%\",\n\t\t\twidth: \"30%\",\n\t\t\tright: \"5%\",\n\t\t\tcursor: \"pointer\",\n\t\t})\n\t\tok.innerHTML = `Okay`\n\n\t\telem.innerHTML += `<span class=\"modal-alert-msg\"></span>`\n\t\telem.appendChild(ok)\n\n\t\tsuper(elem, Object.assign({\n\t\t\tautoClose: true, noCloseBtn:true,\n\t\t\twidth: \"600px\", height: \"180px\",\n\t\t}, options))\n\t}\n\n\topen(msg, onokay) {\n\t\tsuper.open().then((form)=>{\n\t\t\tform.querySelector(\".modal-alert-msg\").innerHTML = msg\n\t\t\tlet okbtn = form.querySelector(\".modal-alert-ok\")\n\t\t\tokbtn.onclick = ()=>{\n\t\t\t\tif (onokay) onokay(form)\n\t\t\t\tthis.close()\n\t\t\t}\n\t\t\tokbtn.focus()\n\t\t})\n\t}\n}\n\n\nclass ModalConfirm extends Modal {\n\tconstructor(options) {\n\t\tlet elem = document.createElement(\"div\")\n\t\telem.style.width = \"80%\"\n\t\telem.style.height = \"40%\"\n\n\t\tlet ok = document.createElement(\"button\")\n\t\tok.classList.add(\"modal-confirm-ok\", \"btn\", 'btn-primary')\n\t\tObject.assign(ok.style, {\n\t\t\tposition: \"absolute\",\n\t\t\tbottom: \"10%\",\n\t\t\theight: \"20%\",\n\t\t\twidth: \"30%\",\n\t\t\tright: \"26%\",\n\t\t\tcursor: \"pointer\",\n\t\t})\n\t\tok.innerHTML = `Okay`\n\n\t\tlet cancel = document.createElement(\"button\")\n\t\tcancel.classList.add(\"modal-confirm-cancel\", \"btn\", 'btn-secondary')\n\t\tObject.assign(cancel.style, {\n\t\t\tposition: \"absolute\",\n\t\t\tbottom: \"10%\",\n\t\t\theight: \"20%\",\n\t\t\twidth: \"18%\",\n\t\t\tright: \"5%\",\n\t\t\tcursor: \"pointer\",\n\t\t})\n\t\tcancel.innerHTML = `Cancel`\n\n\t\telem.innerHTML += `<span class=\"modal-confirm-msg\"></span>`\n\t\telem.appendChild(ok)\n\t\telem.appendChild(cancel)\n\n\t\tsuper(elem, Object.assign({\n\t\t\tautoClose: true, noCloseBtn:true,\n\t\t\twidth: \"600px\", height: \"180px\",\n\t\t}, options))\n\t}\n\n\topen(msg, onokay, oncancel) {\n\t\tsuper.open().then((form)=>{\n\t\t\tform.querySelector(\".modal-confirm-msg\").innerHTML = msg\n\t\t\tlet okbtn = form.querySelector(\".modal-confirm-ok\")\n\t\t\tokbtn.onclick = ()=>{\n\t\t\t\tif (onokay) onokay(form)\n\t\t\t\tthis.close()\n\t\t\t}\n\t\t\tokbtn.focus()\n\t\t\tform.querySelector(\".modal-confirm-cancel\").onclick = ()=>{\n\t\t\t\tif (oncancel) oncancel(form)\n\t\t\t\tthis.close()\n\t\t\t}\n\t\t})\n\t}\n}\n\n\nclass ModalPrompt extends Modal {\n\tconstructor(options) {\n\t\tlet elem = document.createElement(\"div\")\n\t\telem.style.width = \"80%\"\n\t\telem.style.height = \"60%\"\n\t\telem.style.flexDirection = \"column\"\n\t\telem.style.gap = \"0.3rem\"\n\n\t\tlet ok = document.createElement(\"button\")\n\t\tok.classList.add(\"modal-prompt-ok\", \"btn\", 'btn-primary')\n\t\tObject.assign(ok.style, {\n\t\t\tposition: \"absolute\",\n\t\t\tbottom: \"10%\",\n\t\t\theight: \"20%\",\n\t\t\twidth: \"30%\",\n\t\t\tright: \"26%\",\n\t\t\tcursor: \"pointer\",\n\t\t})\n\t\tok.innerHTML = `Okay`\n\n\t\tlet cancel = document.createElement(\"button\")\n\t\tcancel.classList.add(\"modal-prompt-cancel\", \"btn\", 'btn-secondary')\n\t\tObject.assign(cancel.style, {\n\t\t\tposition: \"absolute\",\n\t\t\tbottom: \"10%\",\n\t\t\theight: \"20%\",\n\t\t\twidth: \"18%\",\n\t\t\tright: \"5%\",\n\t\t\tcursor: \"pointer\",\n\t\t})\n\t\tcancel.innerHTML = `Cancel`\n\n\t\telem.innerHTML += `<span class=\"modal-prompt-msg\"></span>`\n\t\telem.innerHTML += `<br><input class=\"modal-prompt-input\" style=\"width:100%;height:25%;\">`\n\t\telem.appendChild(ok)\n\t\telem.appendChild(cancel)\n\n\t\tsuper(elem, Object.assign({\n\t\t\tdisplayStyle: 'flex',\n\t\t\tautoClose: true, noCloseBtn:true,\n\t\t\twidth: \"600px\", height: \"180px\",\n\t\t}, options))\n\t}\n\n\topen(msg, defaultval, onokay, oncancel) {\n\t\t// defaultval is optional. If it is omitted, oncancel will be null - because onokay=defaultval, oncancel=onokay\n\t\t// this alows for two seemingly overloaded function signatures\n\t\t// - open(msg, defaultval, onokay, oncancel)\n\t\t// - open(msg, onokay, oncancel)\n\t\tif (typeof defaultval === 'function' && !oncancel) {\n\t\t\toncancel = onokay\n\t\t\tonokay = defaultval\n\t\t\tdefaultval = null\n\t\t\tconsole.log(\"here\")\n\t\t}\n\t\tsuper.open().then((form)=>{\n\t\t\tform.querySelector(\".modal-prompt-msg\").innerHTML = msg\n\t\t\tconst inp = form.querySelector(\".modal-prompt-input\")\n\t\t\tinp.value = defaultval || ''\n\t\t\tinp.select()\n\t\t\tlet okbtn = form.querySelector(\".modal-prompt-ok\")\n\t\t\tokbtn.onclick = ()=>{\n\t\t\t\tif (onokay) onokay(inp.value, form)\n\t\t\t\tthis.close()\n\t\t\t}\n\t\t\t// okbtn.focus()\n\t\t\tform.querySelector(\".modal-prompt-cancel\").onclick = ()=>{\n\t\t\t\tif (oncancel) oncancel(form)\n\t\t\t\tthis.close()\n\t\t\t}\n\t\t})\n\t}\n}\n\n\nclass ModalToast extends Modal {\n\n\tconstructor(options) {\n\t\toptions = options || {}\n\t\toptions.css = options.css || {}\n\t\tObject.assign(options.css, {\n\t\t\tcolor: \"black\",\n\t\t\tmargin: \"25px\",\n\t\t})\n\t\tlet elem = document.createElement(\"div\")\n\t\tObject.assign(elem.style, {\n\t\t\tminWidth: '200px',\n\t\t\tflexDirection: 'row',\n\t\t\tjustifyContent: 'space-around',\n\t\t\talignItems: 'center',\n\t\t\tpadding: \"10px\",\n\t\t\tborderRadius: \"5px\",\n\t\t})\n\n\t\telem.innerHTML += '<img class=\"modal-toast-icon\" src=\"\" alt=\"\">'\n\t\tlet msgelem = document.createElement('b')\n\t\tmsgelem.classList.add(\"modal-toast-msg\")\n\t\tObject.assign(msgelem.style, {\n\t\t\tflex:'1',\n\t\t\ttextAlign:'center',\n\t\t\tmarginRight: '5px',\n\t\t\tmarginLeft: '5px',\n\t\t\t// color:'black',\n\t\t})\n\t\telem.appendChild(msgelem)\n\n\t\tsuper(elem, Object.assign({\n\t\t\tdisplayStyle: \"flex\",\n\t\t\tnoCloseBtn: true,\n\t\t\tnoFade: true,\n\t\t\twidth: \"auto\",\n\t\t\theight:\"50px\",\n\t\t}, options))\n\t\tthis.bg.style.pointerEvents = \"none\"\n\t\tthis.fg.style.pointerEvents = \"none\"\n\t}\n\n\topen(msg, options) {\n\t\toptions = options || {}\n\t\tconst placement = options.placement || \"right-top\" // can be right-top, right-bottom, left-top and left-bottom\n\t\tconst timeout = options.timeout || 5000\n\t\tconst icon = options.icon || null\n\n\t\tif (placement.startsWith('right')) {\n\t\t\tthis.fg.style.justifyContent = 'flex-end'\n\t\t\tthis.transitionStartPos = {top: '0px', left: \"50px\"}\n\t\t} else if (placement.startsWith('left')) {\n\t\t\tthis.fg.style.justifyContent = 'flex-start'\n\t\t\tthis.transitionStartPos = {top: '0px', left: \"-50px\"}\n\t\t}\n\n\t\tif (placement.endsWith('bottom')) {\n\t\t\tthis.fg.style.alignItems = 'flex-end'\n\t\t} else if (placement.endsWith('top')) {\n\t\t\tthis.fg.style.alignItems = 'flex-start'\n\t\t}\n\n\t\tthis._resetTransition()\n\t\tclearTimeout(this._timeout)\n\t\tsuper.open().then((form)=>{\n\t\t\tif (icon) {\n\t\t\t\tlet iconElem = form.querySelector(\".modal-toast-icon\")\n\t\t\t\ticonElem.src = icon\n\t\t\t\ticonElem.setAttribute('width', '25px')\n\t\t\t}\n\t\t\tform.querySelector(\".modal-toast-msg\").innerHTML = msg\n\t\t\tthis._timeout = setTimeout(()=>this.close(), timeout)\n\t\t})\n\t}\n}\n\n\nconst modal_alert = new ModalAlert()\nconst modal_confirm = new ModalConfirm()\nconst modal_prompt = new ModalPrompt()\nconst modal_toast = new ModalToast()\n\n"]}