loader/dist/js/getBible.min.js

3 lines
34 KiB
JavaScript

/*! getBible Loader v3.1.0 | https://getbible.net | (c) 2014 - 2024 Llewellyn van der Merwe | MIT License */
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";function t(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function e(t,e,n){return e=p(e),function(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)}(t,i()?Reflect.construct(e,n||[],p(t).constructor):e.apply(t,n))}function n(e,n){return e.get(t(e,n))}function r(e,n,r){return e.set(t(e,n),r),r}function i(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(i=function(){return!!t})()}function o(){o=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",l=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(t){u=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),c=new S(r||[]);return i(a,"_invoke",{value:I(t,n,c)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",p="suspendedYield",v="executing",g="completed",b={};function y(){}function m(){}function w(){}var k={};u(k,c,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(N([])));x&&x!==n&&r.call(x,c)&&(k=x);var L=w.prototype=y.prototype=Object.create(k);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(i,o,a,c){var s=f(t[i],t,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==typeof u&&r.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(u).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function I(e,n,r){var i=d;return function(o,a){if(i===v)throw Error("Generator is already running");if(i===g){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=M(c,r);if(s){if(s===b)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=v;var l=f(e,n,r);if("normal"===l.type){if(i=r.done?g:p,l.arg===b)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=g,r.method="throw",r.arg=l.arg)}}}function M(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,M(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),b;var o=f(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,b;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,b):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,b)}function T(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 S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function N(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(typeof e+" is not iterable")}return m.prototype=w,i(L,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:m,configurable:!0}),m.displayName=u(w,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,l,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(j.prototype),u(j.prototype,s,(function(){return this})),e.AsyncIterator=j,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new j(h(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(L),u(L,l,"Generator"),u(L,c,(function(){return this})),u(L,"toString",(function(){return"[object Generator]"})),e.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}},e.values=N,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(_),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return c.type="throw",c.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,b):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),b},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),b}},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 i=r.arg;_(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),b}},e}function a(t){var e=function(t,e){if("object"!=typeof t||!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:e+""}function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function s(t,e,n,r,i,o,a){try{var c=t[o](a),s=c.value}catch(t){return void n(t)}c.done?e(s):Promise.resolve(s).then(r,i)}function l(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){s(o,r,i,a,c,"next",t)}function c(t){s(o,r,i,a,c,"throw",t)}a(void 0)}))}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(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,a(r.key),r)}}function f(t,e,n){return e&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(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&&v(t,e)}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function g(){return g="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=p(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},g.apply(this,arguments)}function b(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,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==e);s=!0);}catch(t){l=!0,i=t}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,e)||y(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 y(t,e){if(t){if("string"==typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}function m(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 w(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=y(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){c=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw o}}}}function k(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function E(t,e,n){k(t,e),e.set(t,n)}function x(t,e){k(t,e),e.add(t)}var L,O,j,I,M=function(){function e(){u(this,e)}return f(e,null,[{key:"set",value:function(n,r,i){var o=t(e,this,_).call(this,n,r),a={data:i,timestamp:Date.now()};try{localStorage.setItem(o,JSON.stringify(a))}catch(t){throw console.error("Error storing data in local storage:",t),t}}},{key:"get",value:(n=l(o().mark((function n(r,i){return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",t(e,this,T).call(this,r,i));case 1:case"end":return n.stop()}}),n,this)}))),function(t,e){return n.apply(this,arguments)})}]);var n}();function T(e,n){var r=t(L,this,_).call(this,e,n);try{var i=localStorage.getItem(r);if(i){var o=JSON.parse(i),a=o.data;if(o.timestamp>Date.now()-L.ONE_MONTH_IN_MILLISECONDS)return a}return null}catch(t){throw console.error("Error parsing or retrieving data from local storage:",t),t}}function _(t,e){return"getBible-".concat(e,"-").concat(t)}L=M,O=M,I=2592e6,(j=a(j="ONE_MONTH_IN_MILLISECONDS"))in O?Object.defineProperty(O,j,{value:I,enumerable:!0,configurable:!0,writable:!0}):O[j]=I;var S=new WeakSet,N=function(){return f((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://query.getbible.net/v2/";u(this,t),x(this,S),this.apiEndpoint=e}),[{key:"get",value:function(){var e=l(o().mark((function e(n,r){var i,a,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M.get(n,r);case 3:if(null===(i=e.sent)){e.next=6;break}return e.abrupt("return",i);case 6:return e.next=8,fetch(t(S,this,C).call(this,n,r));case 8:if((a=e.sent).ok){e.next=11;break}throw new Error("".concat(a.status," - ").concat(a.statusText||"Failed to fetch scripture"));case 11:return e.next=13,a.json();case 13:return c=e.sent,e.next=16,M.set(n,r,c);case 16:return e.abrupt("return",c);case 19:throw e.prev=19,e.t0=e.catch(0),console.error("Error fetching data:",e.t0),new Error(e.t0.message||"Error fetching scripture");case 23:case"end":return e.stop()}}),e,this,[[0,19]])})));return function(t,n){return e.apply(this,arguments)}}()}])}();function C(t,e){return"".concat(this.apiEndpoint).concat(encodeURIComponent(e),"/").concat(encodeURIComponent(t))}var B=new WeakMap,R=function(){return f((function t(e){if(u(this,t),E(this,B,void 0),!e||"object"!==c(e))throw new Error("Data must be a valid object.");["translation","abbreviation","language","lang","direction","encoding","book_nr","book_name","chapter","name","verses","ref"].forEach((function(t){if(void 0===e[t]||null===e[t])throw new Error("Missing required property: '".concat(t,"'."))})),r(B,this,e)}),[{key:"bibleUrl",get:function(){return"".concat(this.abbreviation,"/").concat(this.bookName,"/").concat(this.chapter,"/").concat(this.verseReference)}},{key:"translation",get:function(){return n(B,this).translation}},{key:"abbreviation",get:function(){return n(B,this).abbreviation}},{key:"language",get:function(){return n(B,this).language}},{key:"languageCode",get:function(){return n(B,this).lang}},{key:"textDirection",get:function(){return n(B,this).direction}},{key:"encoding",get:function(){return n(B,this).encoding}},{key:"bookNumber",get:function(){return n(B,this).book_nr}},{key:"bookName",get:function(){return n(B,this).book_name}},{key:"chapter",get:function(){return n(B,this).chapter}},{key:"chapterName",get:function(){return n(B,this).name}},{key:"verses",get:function(){return n(B,this).verses}},{key:"getVerse",value:function(t){return n(B,this).verses.find((function(e){return e.verse===t}))}},{key:"getVersesInRange",value:function(t,e){return n(B,this).verses.filter((function(n){return n.verse>=t&&n.verse<=e}))}},{key:"localReference",get:function(){return Array.isArray(n(B,this).ref)?n(B,this).ref.join("; "):n(B,this).ref}},{key:"reference",get:function(){return"".concat(n(B,this).name,":").concat(this.verseReference)}},{key:"verseReference",get:function(){var t=n(B,this).verses.map((function(t){return t.verse})).sort((function(t,e){return t-e})),e={},r=null,i=null,o=null;return t.forEach((function(t){null===r?r=t:t===o+1?i=t:(e[r]=null!==i?"".concat(r,"-").concat(i):"".concat(r),r=t,i=null),o=t})),null!==r&&(e[r]=null!==i?"".concat(r,"-").concat(i):"".concat(r)),Object.values(e).join(",")}}])}(),A=new WeakMap,W=function(){return f((function t(e){u(this,t),E(this,A,void 0),r(A,this,Object.values(e).map((function(t){return new R(t)})))}),[{key:"forEachReference",value:function(t){n(A,this).forEach(t)}}])}(),P=new WeakMap,D=new WeakMap,U=new WeakMap,H=new WeakMap,F=new WeakMap,z=new WeakMap,G=new WeakMap,q=new WeakMap,V=new WeakMap,Y=new WeakMap,J=new WeakMap,Z=new WeakMap,X=function(){return f((function t(e){if(u(this,t),E(this,P,void 0),E(this,D,void 0),E(this,U,void 0),E(this,H,void 0),E(this,F,void 0),E(this,z,void 0),E(this,G,void 0),E(this,q,void 0),E(this,V,void 0),E(this,Y,void 0),E(this,J,void 0),E(this,Z,void 0),!(e instanceof HTMLElement))throw new Error("triggerElement must be an instance of HTMLElement.");r(P,this,e),r(D,this,(e.dataset.format||"inline").toLowerCase()),r(U,this,(e.dataset.translation||"kjv").toLowerCase().split(";").map((function(t){return t.trim()}))),r(H,this,e.dataset.showBookName?parseInt(e.dataset.showBookName,10):0),r(F,this,e.dataset.showReference?parseInt(e.dataset.showReference,10):1),r(z,this,e.dataset.showLocalReference?parseInt(e.dataset.showLocalReference,10):0),r(G,this,e.dataset.showTranslation?parseInt(e.dataset.showTranslation,10):0),r(q,this,e.dataset.showAbbreviation?parseInt(e.dataset.showAbbreviation,10):0),r(V,this,e.dataset.showLanguage?parseInt(e.dataset.showLanguage,10):0),r(Y,this,e.dataset.showLanguageCode?parseInt(e.dataset.showLanguageCode,10):0),r(J,this,e.dataset.showBibleLink?parseInt(e.dataset.showBibleLink,10):0),r(Z,this,e.dataset.bibleUrl?e.dataset.bibleUrl:"https://getBible.net/"),n(z,this)&&r(F,this,0),"https://getBible.net/"!==n(Z,this)&&r(J,this,1)}),[{key:"bibleUrl",get:function(){return n(Z,this)}},{key:"bibleLink",get:function(){return n(J,this)}},{key:"translations",get:function(){return n(U,this)}},{key:"bookName",get:function(){return n(H,this)}},{key:"reference",get:function(){return n(F,this)}},{key:"localReference",get:function(){return n(z,this)}},{key:"translation",get:function(){return n(G,this)}},{key:"abbreviation",get:function(){return n(q,this)}},{key:"language",get:function(){return n(V,this)}},{key:"languageCode",get:function(){return n(Y,this)}},{key:"format",get:function(){return n(D,this)}},{key:"element",get:function(){return n(P,this)}}])}(),$=new WeakMap,K=function(){return f((function t(e){u(this,t),E(this,$,void 0),r($,this,e)}),[{key:"action",get:function(){return n($,this)}},{key:"get",value:function(t){throw new Error("The 'get' method must be implemented in BaseFormat subclass.")}},{key:"getExternalLinkImage",value:function(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),'<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">\n <title>'.concat(t,'</title>\n <path\n fill="#36c"\n d="M6 1h5v5L8.86 3.85 4.7 8 4 7.3l4.15-4.16L6 1Z M2 3h2v1H2v6h6V8h1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z"\n />\n </svg>')}}])}(),Q=function(t){function n(t){return u(this,n),e(this,n,[t])}return d(n,t),f(n,[{key:"get",value:function(t){var e=this,n=[];return t.forEachReference((function(t){var r=[];n.push('<div dir="'.concat(t.textDirection.toUpperCase(),'" class="getbible-reference-block">')),e.action.bookName&&r.push('<span class="getbible-book-name">'.concat(t.bookName,"</span>")),e.action.reference&&r.push('<span class="getbible-reference">'.concat(t.reference,"</span>")),e.action.localReference&&r.push('<span class="getbible-reference">'.concat(t.localReference,"</span>")),e.action.translation&&r.push('<span class="getbible-translation">'.concat(t.translation,"</span>")),e.action.abbreviation&&r.push('<span class="getbible-abbreviation">'.concat(t.abbreviation,"</span>")),e.action.language&&r.push('<span class="getbible-language">'.concat(t.language,"</span>")),e.action.languageCode&&r.push('<span class="getbible-language-code">'.concat(t.languageCode,"</span>")),r.length>0&&n.push('<b class="getbible-header">'.concat(r.join(" - "),"</b>")),e.action.bibleLink&&n.push('&nbsp;<a class="getbible-link"\n href="'.concat(e.action.bibleUrl).concat(t.bibleUrl,'"\n target="_blank" style="text-decoration: unset;"\n title="').concat(t.reference,'">').concat(e.getExternalLinkImage(t.reference),"</a>"));var i=t.verses.map((function(t){return'<div class="getbible-verse">'.concat(t.verse,". ").concat(t.text,"</div>")})).join("\n");n.push('<div class="getbible-verses">'.concat(i,"</div>")),n.push("</div>")})),'<div class="getbible-element getbible-block">'.concat(n.join("\n"),"</div><br />")}}])}(K),tt=function(t){function n(t){return u(this,n),e(this,n,[t])}return d(n,t),f(n,[{key:"get",value:function(t){var e=this,n=[];return t.forEachReference((function(t){var r=[];n.push('<div dir="'.concat(t.textDirection.toUpperCase(),'" class="getbible-reference-inline">')),e.action.bookName&&r.push('<span class="getbible-book-name">'.concat(t.bookName,"</span>")),e.action.reference&&r.push('<span class="getbible-reference">'.concat(t.reference,"</span>")),e.action.localReference&&r.push('<span class="getbible-reference">'.concat(t.localReference,"</span>")),e.action.translation&&r.push('<span class="getbible-translation">'.concat(t.translation,"</span>")),e.action.abbreviation&&r.push('<span class="getbible-abbreviation">'.concat(t.abbreviation,"</span>")),e.action.language&&r.push('<span class="getbible-language">'.concat(t.language,"</span>")),e.action.languageCode&&r.push('<span class="getbible-language-code">'.concat(t.languageCode,"</span>"));var i=t.verses.map((function(t){return'<span class="getbible-verse">'.concat(t.verse,". ").concat(t.text,"</span>")})).join("\n");n.push('<span class="getbible-verses">'.concat(i,"</span>")),r.length>0&&n.push('<b class="getbible-footer">'.concat(r.join(" - "),"</b>")),e.action.bibleLink&&n.push('<a class="getbible-link"\n href="'.concat(e.action.bibleUrl).concat(t.bibleUrl,'"\n target="_blank" style="text-decoration: unset;"\n title="').concat(t.reference,'">').concat(e.getExternalLinkImage(t.reference),"</a>")),n.push("</div>")})),'<div class="getbible-element getbible-inline">'.concat(n.join("\n"),"</div>")}}])}(K),et=function(t){function n(t){return u(this,n),e(this,n,[t])}return d(n,t),f(n,[{key:"get",value:function(t){var e=this,n=[];return t.forEachReference((function(t){var r=[];e.action.bookName&&r.push("".concat(t.bookName)),e.action.reference&&r.push("".concat(t.reference)),e.action.localReference&&r.push("".concat(t.localReference)),e.action.translation&&r.push("".concat(t.translation)),e.action.abbreviation&&r.push("".concat(t.abbreviation)),e.action.language&&r.push("".concat(t.language)),e.action.languageCode&&r.push("".concat(t.languageCode)),r.length>0&&n.push("[".concat(r.join(" - "),"]")),n.push(t.verses.map((function(t){return"".concat(t.verse,". ").concat(t.text)})).join("\n"))})),"".concat(n.join("\n"),"\n")}}])}(K),nt=function(){return f((function t(e){u(this,t);var n={modal:Q,inline:tt,tooltip:et}[e.format]||tt;this.format=new n(e)}),[{key:"get",value:function(t){return this.format.get(t)}}])}(),rt=new WeakMap,it=new WeakMap,ot=function(){return f((function t(e){u(this,t),E(this,rt,void 0),E(this,it,void 0),r(rt,this,"modal-".concat(Math.random().toString(36).slice(2,11))),r(it,this,e),this.element.style.cursor="pointer",this.initializeTrigger()}),[{key:"load",value:function(t){if(document.getElementById(this.id)){var e=document.getElementById("".concat(this.id,"-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.id,'" 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.id,'\').style.display=\'none\'" style="position:absolute; top:7px; right:7px; border:none; background:transparent; font-size:20px; cursor:pointer;">✖</button>\n <div id="').concat(this.id,'-content">\n ').concat(t,"\n </div>\n </div>\n </div>");this.insertIntoDOM(e);var n=document.getElementById(this.id);n.addEventListener("click",(function(t){t.target===n&&(n.style.display="none")}))}},{key:"initializeTrigger",value:function(){var t=this;this.element.addEventListener("click",(function(){document.getElementById(t.id).style.display="flex"}))}},{key:"id",get:function(){return n(rt,this)}},{key:"element",get:function(){return n(it,this).element}}])}(),at=function(t){function n(t){return u(this,n),e(this,n,[t])}return d(n,t),f(n,[{key:"show",value:function(){UIkit.modal("#".concat(this.id)).show()}},{key:"hide",value:function(){UIkit.modal("#".concat(this.id)).hide()}},{key:"create",value:function(t){var e='\n <div id="'.concat(this.id,'" 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.id,'-content">\n ').concat(t,"\n </div>\n </div>\n </div>");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){this.element.setAttribute("uk-toggle","target: #".concat(this.id))}}])}(ot),ct=function(t){function n(t){return u(this,n),e(this,n,[t])}return d(n,t),f(n,[{key:"show",value:function(){new bootstrap.Modal(document.getElementById(this.id)).show()}},{key:"hide",value:function(){var t=bootstrap.Modal.getInstance(document.getElementById(this.id));t&&t.hide()}},{key:"create",value:function(t){var e='\n <div class="modal fade" id="'.concat(this.id,'" 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.id,'-content" class="modal-body">\n ').concat(t,"\n </div>\n </div>\n </div>\n </div>");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){this.element.setAttribute("data-bs-toggle","modal"),this.element.setAttribute("data-bs-target","#".concat(this.id))}}])}(ot),st=function(t){function n(t){var r;return u(this,n),(r=e(this,n,[t])).modalElement=null,r}return d(n,t),f(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.id,'" data-reveal>\n <div id="').concat(this.id,'-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.id))}},{key:"initializeTrigger",value:function(){this.element.setAttribute("data-open",this.id)}}])}(ot),lt=function(t){function n(t){return u(this,n),e(this,n,[t])}return d(n,t),f(n,[{key:"show",value:function(){document.getElementById(this.id).classList.remove("hidden")}},{key:"hide",value:function(){document.getElementById(this.id).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.id,'">\n <div class="modal-content container mx-auto p-5 bg-white">\n <div id="').concat(this.id,'-content">\n ').concat(t,'\n </div>\n <button class="close-button" onclick="document.getElementById(\'').concat(this.id,"').classList.add('hidden')\">Close</button>\n </div>\n </div>");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){var t=this;this.element.addEventListener("click",(function(){document.getElementById(t.id).classList.remove("hidden")}))}}])}(ot),ut=function(){return f((function t(e){u(this,t),this.modal=t.framework(e)}),[{key:"load",value:function(t){this.modal.load(t)}}],[{key:"framework",value:function(t){for(var e={UIkit:at,bootstrap:ct,Foundation:st,tailwind:lt},n=0,r=Object.entries(e);n<r.length;n++){var i=b(r[n],2),o=i[0],a=i[1];if(void 0!==window[o]||"tailwind"===o&&null!==document.querySelector(".tailwind-class"))return new a(t)}return new ot(t)}}])}(),ht=new WeakMap,ft=function(){return f((function t(e){u(this,t),E(this,ht,void 0),r(ht,this,e),this.element.innerHTML=""}),[{key:"load",value:function(t){var e=this.element.innerHTML;this.element.innerHTML=e?"".concat(e,"\n ").concat(t):t}},{key:"element",get:function(){return n(ht,this).element}}])}(),dt=new WeakMap,pt=function(){return f((function t(e){u(this,t),E(this,dt,void 0),r(dt,this,e),this.element.style.cursor="help"}),[{key:"load",value:function(t){var e=this.element.getAttribute("title"),n=e?e+"\n"+t:t;this.element.setAttribute("title",n)}},{key:"element",get:function(){return n(dt,this).element}}])}(),vt=function(t){function n(t){return u(this,n),e(this,n,[t])}return d(n,t),f(n,[{key:"load",value:function(t){try{g(p(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)}}}])}(pt),gt=function(t){function n(t){return u(this,n),e(this,n,[t])}return d(n,t),f(n,[{key:"load",value:function(t){try{g(p(n.prototype),"load",this).call(this,t),UIkit.tooltip(this.element)}catch(t){console.error("Error loading UikitTooltip:",t)}}}])}(pt),bt=function(t){function n(t){return u(this,n),e(this,n,[t])}return d(n,t),f(n,[{key:"load",value:function(t){var e=this;try{this.element.setAttribute("data-tooltip",""),g(p(n.prototype),"load",this).call(this,t),this.element.classList.add("has-tip"),new Foundation.Tooltip(this.element,{disableHover:!1,fadeOutDuration:150,fadeInDuration:150,showOn:"all",templateClasses:"",tipText:function(){return e.element.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)}}}])}(pt),yt=function(t){function n(t){return u(this,n),e(this,n,[t])}return d(n,t),f(n,[{key:"load",value:function(t){try{g(p(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.element.getAttribute("title"),document.body.appendChild(this.tooltipElement)}},{key:"_initializeEvents",value:function(){var t=this;this.element.addEventListener("mouseenter",(function(){var e=t.element.getBoundingClientRect();t._title=t.element.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.element.setAttribute("title","")})),this.element.addEventListener("mouseleave",(function(){t.tooltipElement.classList.add("invisible"),t.tooltipElement.classList.remove("opacity-100"),t.element.setAttribute("title",t._title)}))}}])}(pt),mt=function(){return f((function t(e){u(this,t),this.tooltip=t.framework(e)}),[{key:"load",value:function(t){this.tooltip.load(t)}}],[{key:"framework",value:function(t){for(var e={UIkit:gt,bootstrap:vt,Foundation:bt,tailwind:yt},n=0,r=Object.entries(e);n<r.length;n++){var i=b(r[n],2),o=i[0],a=i[1];if(void 0!==window[o]||"tailwind"===o&&null!==document.querySelector(".tailwind-class"))return new a(t)}return new pt(t)}}])}(),wt=function(){return f((function t(e){u(this,t);var n={modal:ut,inline:ft,tooltip:mt}[e.format]||ft;this.element=new n(e)}),[{key:"load",value:function(t){this.element.load(t)}}])}(),kt=new WeakMap,Et=new WeakMap,xt=new WeakMap,Lt=new WeakMap,Ot=new WeakSet,jt=function(){return f((function t(e){u(this,t),x(this,Ot),E(this,kt,void 0),E(this,Et,void 0),E(this,xt,void 0),E(this,Lt,void 0),r(kt,this,e)}),[{key:"load",value:(e=l(o().mark((function e(n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==(r=n.innerHTML.split(";").map((function(t){return t.trim()}))).length){e.next=4;break}return console.error("No references found in the getBible tagged class."),e.abrupt("return");case 4:if(0!==(i=t(Ot,this,It).call(this,r)).length){e.next=8;break}return console.error("No valid references found in the getBible tagged class."),e.abrupt("return");case 8:return t(Ot,this,_t).call(this,n),e.next=11,t(Ot,this,Mt).call(this,i);case 11:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})}]);var e}();function It(t){return t.filter((function(t){return!!(t.length<=30&&/\d/.test(t))||(console.error("Invalid getBible reference: ".concat(t)),!1)}))}function Mt(t){return Tt.apply(this,arguments)}function Tt(){return(Tt=l(o().mark((function e(r){var i,a,c,s,l,u,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=w(r),e.prev=1,i.s();case 3:if((a=i.n()).done){e.next=32;break}c=a.value,s=w(n(Et,this).translations),e.prev=6,s.s();case 8:if((l=s.n()).done){e.next=22;break}return u=l.value,e.prev=10,e.next=13,n(kt,this).get(c,u);case 13:(h=e.sent)&&t(Ot,this,St).call(this,h),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(10),console.error("Error loading reference ".concat(c,":"),e.t0);case 20:e.next=8;break;case 22:e.next=27;break;case 24:e.prev=24,e.t1=e.catch(6),s.e(e.t1);case 27:return e.prev=27,s.f(),e.finish(27);case 30:e.next=3;break;case 32:e.next=37;break;case 34:e.prev=34,e.t2=e.catch(1),i.e(e.t2);case 37:return e.prev=37,i.f(),e.finish(37);case 40:case"end":return e.stop()}}),e,this,[[1,34,37,40],[6,24,27,30],[10,17]])})))).apply(this,arguments)}function _t(t){r(Et,this,new X(t)),r(xt,this,new wt(n(Et,this))),r(Lt,this,new nt(n(Et,this)))}function St(t){n(xt,this).load(n(Lt,this).get(new W(t)))}document.addEventListener("DOMContentLoaded",(function(t){try{!function(t){document.querySelectorAll(".getBible").forEach((function(e){new jt(t).load(e).catch((function(t){console.error("Loading error for element ".concat(e,":"),t)}))}))}(new N)}catch(t){console.error("Error initializing GetBible loaders:",t)}}))}));