loader/dist/js/getBible.min.js
Llewellyn van der Merwe d9f5a1aebc
Implement enhanced UI elements with library detection and fallback
- Add modal implementation with automatic detection for four specific libraries.
- Introduce inline tooltips with library compatibility.
- Implement a default stand-alone fallback for environments without supported libraries.
2023-11-20 16:29:47 +02:00

3 lines
26 KiB
JavaScript

/*! getBible Loader v3.0.0 | https://getbible.net | (c) 2014 - 2023 Llewellyn van der Merwe | MIT License */
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";function t(){t=function(){return n};var e,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(e){u=function(t,e,n){return t[e]=n}}function d(t,e,n,r){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),l=new A(r||[]);return i(a,"_invoke",{value:T(t,n,l)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=d;var f="suspendedStart",p="suspendedYield",v="executing",m="completed",g={};function y(){}function b(){}function w(){}var E={};u(E,l,(function(){return this}));var k=Object.getPrototypeOf,I=k&&k(k(P([])));I&&I!==r&&o.call(I,l)&&(E=I);var L=w.prototype=y.prototype=Object.create(E);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(r,i,a,l){var c=h(t[r],t,i);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==typeof u&&o.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,a,l)}),(function(t){n("throw",t,a,l)})):e.resolve(u).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,l)}))}l(c.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function T(t,n,r){var o=f;return function(i,a){if(o===v)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var l=r.delegate;if(l){var c=j(l,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===f)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var s=h(t,n,r);if("normal"===s.type){if(o=r.done?m:p,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=m,r.method="throw",r.arg=s.arg)}}}function j(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=h(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function P(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=w,i(L,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=u(w,s,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},n.awrap=function(t){return{__await:t}},O(x.prototype),u(x.prototype,c,(function(){return this})),n.AsyncIterator=x,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new x(d(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(L),u(L,s,"Generator"),u(L,l,(function(){return this})),u(L,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=P,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(_),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,o){return l.type="throw",l.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],l=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;_(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:P(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}function e(t,e,n,r,o,i,a){try{var l=t[i](a),c=l.value}catch(t){return void n(t)}l.done?e(c):Promise.resolve(c).then(r,o)}function n(t){return function(){var n=this,r=arguments;return new Promise((function(o,i){var a=t.apply(n,r);function l(t){e(a,o,i,l,c,"next",t)}function c(t){e(a,o,i,l,c,"throw",t)}l(void 0)}))}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,p(r.key),r)}}function i(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function s(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function d(){return d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},d.apply(this,arguments)}function h(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return f(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function p(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function v(t,e,n){return function(t,e){if(t!==e)throw new TypeError("Private static access of wrong provenance")}(t,e),n}function m(t,e,n){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return n}function g(t,e){!function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,e),e.add(t)}var y,b,w,E,k=function(){function e(){r(this,e)}var o;return i(e,null,[{key:"set",value:function(t,n,r){var o=v(this,e,L).call(this,t,n),i={data:r,timestamp:Date.now()};try{localStorage.setItem(o,JSON.stringify(i))}catch(t){throw console.error("Error storing data in local storage:",t),t}}},{key:"get",value:(o=n(t().mark((function n(r,o){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",v(this,e,I).call(this,r,o));case 1:case"end":return t.stop()}}),n,this)}))),function(t,e){return o.apply(this,arguments)})}]),e}();function I(t,e){var n=v(this,y,L).call(this,t,e);try{var r=localStorage.getItem(n);if(r){var o=JSON.parse(r),i=o.data;if(o.timestamp>Date.now()-y.ONE_MONTH_IN_MILLISECONDS)return i}return null}catch(t){throw console.error("Error parsing or retrieving data from local storage:",t),t}}function L(t,e){return"getBible-".concat(e,"-").concat(t)}y=k,b=k,E=2592e6,(w=p(w="ONE_MONTH_IN_MILLISECONDS"))in b?Object.defineProperty(b,w,{value:E,enumerable:!0,configurable:!0,writable:!0}):b[w]=E;var O=new WeakSet,x=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://query.getbible.net/v2/";r(this,e),g(this,O),this.apiEndpoint=t}return i(e,[{key:"get",value:function(){var e=n(t().mark((function e(n,r){var o,i,a;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,k.get(n,r);case 3:if(null===(o=t.sent)){t.next=6;break}return t.abrupt("return",o);case 6:return t.next=8,fetch(m(this,O,T).call(this,n,r));case 8:if((i=t.sent).ok){t.next=11;break}throw new Error("".concat(i.status," - ").concat(i.statusText||"Failed to fetch scripture"));case 11:return t.next=13,i.json();case 13:return a=t.sent,t.next=16,k.set(n,r,a);case 16:return t.abrupt("return",a);case 19:throw t.prev=19,t.t0=t.catch(0),console.error("Error fetching data:",t.t0),new Error(t.t0.message||"Error fetching scripture");case 23:case"end":return t.stop()}}),e,this,[[0,19]])})));return function(t,n){return e.apply(this,arguments)}}()}]),e}();function T(t,e){return"".concat(this.apiEndpoint).concat(encodeURIComponent(e),"/").concat(encodeURIComponent(t))}var j=function(){function t(){r(this,t)}return i(t,[{key:"get",value:function(t,e,n,r,o){throw new Error("The 'get' method must be implemented in BaseFormat subclass.")}}]),t}(),S=function(t){a(n,t);var e=u(n);function n(){return r(this,n),e.apply(this,arguments)}return i(n,[{key:"get",value:function(t,e,n,r,o){var i="",a=new Set,l=new Set,c=new Set,s=new Set;for(var u in t)if(t.hasOwnProperty(u)){var d=[];n&&!l.has(u)&&(d.push('<span class="getbible-translation">'.concat(t[u].translation,"</span>")),l.add(u)),r&&!c.has(u)&&(d.push('<span class="getbible-abbreviation">'.concat(t[u].abbreviation,"</span>")),c.add(u)),e&&!a.has(u)&&(d.push('<span class="getbible-book-name">'.concat(t[u].name,"</span>")),a.add(u)),o&&!s.has(u)&&(d.push('<span class="getbible-language">'.concat(t[u].language,"</span>")),s.add(u)),d.length>0&&(i+='<div class="getbible-header">['.concat(d.join(" - "),"]</div>\n"));var h=t[u].verses.map((function(t){return'<span class="getbible-verse">'.concat(t.verse,". ").concat(t.text,"</span>")})).join("<br />");i+='<div class="getbible-verses">'.concat(h,"</div><br />")}return'<div class="getbible-element getbible-block">'.concat(i,"</div>")}}]),n}(j),_=function(t){a(n,t);var e=u(n);function n(){return r(this,n),e.apply(this,arguments)}return i(n,[{key:"get",value:function(t,e,n,r,o){var i="",a=new Set,l=new Set,c=new Set,s=new Set;for(var u in t)if(t.hasOwnProperty(u)){var d=[];n&&!l.has(u)&&(d.push('<span class="getbible-translation">'.concat(t[u].translation,"</span>")),l.add(u)),r&&!c.has(u)&&(d.push('<span class="getbible-abbreviation">'.concat(t[u].abbreviation,"</span>")),c.add(u)),e&&!a.has(u)&&(d.push('<span class="getbible-book-name">'.concat(t[u].name,"</span>")),a.add(u)),o&&!s.has(u)&&(d.push('<span class="getbible-language">'.concat(t[u].language,"</span>")),s.add(u));var h=t[u].verses.map((function(t){return'<span class="getbible-verse">'.concat(t.verse,". ").concat(t.text,"</span>")})).join("\n");i+='<span class="getbible-verses">'.concat(h,"</span>\n"),d.length>0&&(i+='<span class="getbible-footer">['.concat(d.join(" - "),"]</span>\n"))}return'<span class="getbible-element getbible-inline">'.concat(i,"</span>")}}]),n}(j),A=function(t){a(n,t);var e=u(n);function n(){return r(this,n),e.apply(this,arguments)}return i(n,[{key:"get",value:function(t,e,n,r,o){var i="",a=new Set,l=new Set,c=new Set,s=new Set;for(var u in t)if(t.hasOwnProperty(u)){var d=[];n&&!l.has(u)&&(d.push(t[u].translation),l.add(u)),r&&!c.has(u)&&(d.push(t[u].abbreviation),c.add(u)),e&&!a.has(u)&&(d.push(t[u].name),a.add(u)),o&&!s.has(u)&&(d.push(t[u].language),s.add(u)),d.length>0&&(i+="["+d.join(" - ")+"]\n"),i+=t[u].verses.map((function(t){return"".concat(t.verse,". ").concat(t.text)})).join("\n")+"\n\n"}return i.trim()}}]),n}(j),P=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"tooltip";r(this,t);var n={modal:S,inline:_,tooltip:A}[e]||A;this.format=new n}return i(t,[{key:"get",value:function(t,e,n,r,o){return this.format.get(t,e,n,r,o)}}]),t}(),M=function(){function t(e){r(this,t),this.modalId="modal-".concat(Math.random().toString(36).slice(2,11)),this.triggerElement=e,this.triggerElement.style.cursor="pointer",this.initializeTrigger()}return i(t,[{key:"load",value:function(t){if(document.getElementById(this.modalId)){var e=document.getElementById("".concat(this.modalId,"-content"));e&&(e.innerHTML+=t)}else this.create(t)}},{key:"insertIntoDOM",value:function(t){document.body.insertAdjacentHTML("beforeend",t)}},{key:"create",value:function(t){var e='\n <div id="'.concat(this.modalId,'" style="display:none; position:fixed; top:0; left:0; width:100%; height:100%; background-color:rgba(0, 0, 0, 0.5); justify-content:center; align-items:center;">\n <div style="position:relative; background-color:white; padding:20px; border-radius:5px; max-width:300px;">\n <button class="getbible-modal-close" type="button" onclick="document.getElementById(\'').concat(this.modalId,'\').style.display=\'none\'" style="position:absolute; top:10px; right:10px; border:none; background:transparent; font-size:24px; cursor:pointer;">✖</button>\n <div id="').concat(this.modalId,'-content">\n ').concat(t,"\n </div>\n </div>\n </div>");this.insertIntoDOM(e);var n=document.getElementById(this.modalId);n.addEventListener("click",(function(t){t.target===n&&(n.style.display="none")}))}},{key:"initializeTrigger",value:function(){var t=this;this.triggerElement.addEventListener("click",(function(){document.getElementById(t.modalId).style.display="flex"}))}}]),t}(),N=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"show",value:function(){UIkit.modal("#".concat(this.modalId)).show()}},{key:"hide",value:function(){UIkit.modal("#".concat(this.modalId)).hide()}},{key:"create",value:function(t){var e='\n <div id="'.concat(this.modalId,'" uk-modal>\n <div class="uk-modal-dialog uk-modal-body">\n <button class="uk-modal-close-default" type="button" uk-close></button>\n <div id="').concat(this.modalId,'-content">\n ').concat(t,"\n </div>\n </div>\n </div>");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){this.triggerElement.setAttribute("uk-toggle","target: #".concat(this.modalId))}}]),n}(M),B=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"show",value:function(){new bootstrap.Modal(document.getElementById(this.modalId)).show()}},{key:"hide",value:function(){var t=bootstrap.Modal.getInstance(document.getElementById(this.modalId));t&&t.hide()}},{key:"create",value:function(t){var e='\n <div class="modal fade" id="'.concat(this.modalId,'" tabindex="-1" role="dialog" aria-hidden="true">\n <div class="modal-dialog" role="document">\n <div class="modal-content p-3">\n <div class="modal-header">\n <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>\n </div>\n <div id="').concat(this.modalId,'-content" class="modal-body">\n ').concat(t,"\n </div>\n </div>\n </div>\n </div>");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){this.triggerElement.setAttribute("data-bs-toggle","modal"),this.triggerElement.setAttribute("data-bs-target","#".concat(this.modalId))}}]),n}(M),C=function(t){a(n,t);var e=u(n);function n(t){var o;return r(this,n),(o=e.call(this,t)).modalElement=null,o}return i(n,[{key:"show",value:function(){this.modalElement&&this.modalElement.open()}},{key:"hide",value:function(){this.modalElement&&this.modalElement.close()}},{key:"create",value:function(t){var e='\n <div class="reveal" id="'.concat(this.modalId,'" data-reveal>\n <div id="').concat(this.modalId,'-content">\n ').concat(t,'\n </div>\n <button class="close-button" data-close aria-label="Close modal" type="button">\n <span aria-hidden="true">&times;</span>\n </button>\n </div>');this.insertIntoDOM(e),this.modalElement=new Foundation.Reveal(document.getElementById(this.modalId))}},{key:"initializeTrigger",value:function(){this.triggerElement.setAttribute("data-open",this.modalId)}}]),n}(M),D=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"show",value:function(){document.getElementById(this.modalId).classList.remove("hidden")}},{key:"hide",value:function(){document.getElementById(this.modalId).classList.add("hidden")}},{key:"create",value:function(t){var e='\n <div class="modal hidden fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full" id="'.concat(this.modalId,'">\n <div class="modal-content container mx-auto p-5 bg-white">\n <div id="').concat(this.modalId,'-content">\n ').concat(t,'\n </div>\n <button class="close-button" onclick="document.getElementById(\'').concat(this.modalId,"').classList.add('hidden')\">Close</button>\n </div>\n </div>");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(t){var e=this;this.triggerElement.addEventListener("click",(function(){document.getElementById(e.modalId).classList.remove("hidden")}))}}]),n}(M),H=function(){function t(e){r(this,t),this.modal=t.framework(e)}return i(t,[{key:"load",value:function(t){this.modal.load(t)}}],[{key:"framework",value:function(t){for(var e={UIkit:N,bootstrap:B,Foundation:C,tailwind:D},n=0,r=Object.entries(e);n<r.length;n++){var o=h(r[n],2),i=o[0],a=o[1];if(void 0!==window[i]||"tailwind"===i&&null!==document.querySelector(".tailwind-class"))return new a(t)}return new M(t)}}]),t}(),R=function(){function t(e){if(r(this,t),!(e instanceof HTMLElement))throw new Error("triggerElement must be an instance of HTMLElement.");this.triggerElement=e,this.triggerElement.innerHTML=""}return i(t,[{key:"load",value:function(t){var e=this.triggerElement.innerHTML;this.triggerElement.innerHTML=e?"".concat(e,"\n ").concat(t):t}}]),t}(),F=function(){function t(e){r(this,t),this.triggerElement=e,this.triggerElement.style.cursor="help"}return i(t,[{key:"load",value:function(t){var e=this.triggerElement.getAttribute("title"),n=e?e+"\n"+t:t;this.triggerElement.setAttribute("title",n)}}]),t}(),z=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"load",value:function(t){try{d(l(n.prototype),"load",this).call(this,t);[].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map((function(t){return new bootstrap.Tooltip(t)}))}catch(t){console.error("Error loading BootstrapTooltip:",t)}}}]),n}(F),U=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"load",value:function(t){try{d(l(n.prototype),"load",this).call(this,t),UIkit.tooltip(this.triggerElement)}catch(t){console.error("Error loading UikitTooltip:",t)}}}]),n}(F),G=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"load",value:function(t){var e=this;try{this.triggerElement.setAttribute("data-tooltip",""),d(l(n.prototype),"load",this).call(this,t),this.triggerElement.classList.add("has-tip"),new Foundation.Tooltip(this.triggerElement,{disableHover:!1,fadeOutDuration:150,fadeInDuration:150,showOn:"all",templateClasses:"",tipText:function(){return e.triggerElement.getAttribute("title")},triggerClass:"has-tip",touchCloseText:"tap to close",positionClass:"top",vOffset:10,hOffset:12,allowHtml:!1})}catch(t){console.error("Error loading FoundationTooltip:",t)}}}]),n}(F),q=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"load",value:function(t){try{d(l(n.prototype),"load",this).call(this,t),this._createTooltipElement(),this._initializeEvents()}catch(t){console.error("Error loading TailwindTooltip:",t)}}},{key:"_createTooltipElement",value:function(){this.tooltipElement=document.createElement("div"),this.tooltipElement.id=this.tooltipId,this.tooltipElement.className="absolute invisible bg-gray-800 text-white text-xs px-2 py-1 rounded-md",this.tooltipElement.style.transition="visibility 0.3s linear, opacity 0.3s linear",this.tooltipElement.textContent=this.triggerElement.getAttribute("title"),document.body.appendChild(this.tooltipElement)}},{key:"_initializeEvents",value:function(){var t=this;this.triggerElement.addEventListener("mouseenter",(function(){var e=t.triggerElement.getBoundingClientRect();t._title=t.triggerElement.getAttribute("title"),t.tooltipElement.style.left="".concat(e.left+window.scrollX,"px"),t.tooltipElement.style.top="".concat(e.bottom+5+window.scrollY,"px"),t.tooltipElement.classList.remove("invisible"),t.tooltipElement.classList.add("opacity-100"),t.triggerElement.setAttribute("title","")})),this.triggerElement.addEventListener("mouseleave",(function(){t.tooltipElement.classList.add("invisible"),t.tooltipElement.classList.remove("opacity-100"),t.triggerElement.setAttribute("title",t._title)}))}}]),n}(F),W=function(){function t(e){r(this,t),this.tooltip=t.framework(e)}return i(t,[{key:"load",value:function(t){this.tooltip.load(t)}}],[{key:"framework",value:function(t){for(var e={UIkit:U,bootstrap:z,Foundation:G,tailwind:q},n=0,r=Object.entries(e);n<r.length;n++){var o=h(r[n],2),i=o[0],a=o[1];if(void 0!==window[i]||"tailwind"===i&&null!==document.querySelector(".tailwind-class"))return new a(t)}return new F(t)}}]),t}(),Y=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"tooltip";if(r(this,t),!(e instanceof HTMLElement))throw new Error("triggerElement must be an instance of HTMLElement.");var o={modal:H,inline:R,tooltip:W}[n]||W;this.element=new o(e)}return i(t,[{key:"load",value:function(t){this.element.load(t)}}]),t}(),J=new WeakSet,X=new WeakSet,$=function(){function t(){r(this,t),g(this,X),g(this,J),this.api=new x}return i(t,[{key:"load",value:function(t){var e=this,n=t.innerHTML.split(";");if(n){m(this,J,K).call(this,t);var r=(t.dataset.translation||"kjv").toLowerCase().split(";");this.showBookName=t.dataset.showBookName?parseInt(t.dataset.showBookName,10):1,this.showTranslation=t.dataset.showTranslation?parseInt(t.dataset.showTranslation,10):0,this.showAbbreviation=t.dataset.showAbbreviation?parseInt(t.dataset.showAbbreviation,10):0,this.showLanguage=t.dataset.showLanguage?parseInt(t.dataset.showLanguage,10):0,n.forEach((function(t){r.forEach((function(n){e.api.get(t.trim(),n.trim()).then((function(t){t&&m(e,X,Q).call(e,t)})).catch((function(t){return console.error(t)}))}))}))}}}]),t}();function K(t){var e=(t.dataset.format||"inline").toLowerCase();this.element=new Y(t,e),this.format=new P(e)}function Q(t){this.element.load(this.format.get(t,this.showBookName,this.showTranslation,this.showAbbreviation,this.showLanguage))}document.addEventListener("DOMContentLoaded",(function(t){document.querySelectorAll(".getBible").forEach((function(t){(new $).load(t)}))}))}));