bible-ref-parse 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/am-bcv-parser.js +80 -32
- package/dist/am-bcv-parser.min.js +1 -1
- package/dist/ar-bcv-parser.js +80 -32
- package/dist/ar-bcv-parser.min.js +2 -2
- package/dist/bb-bcv-parser.js +80 -32
- package/dist/bb-bcv-parser.min.js +1 -1
- package/dist/bg-bcv-parser.js +80 -32
- package/dist/bg-bcv-parser.min.js +1 -1
- package/dist/bn-bcv-parser.js +80 -32
- package/dist/bn-bcv-parser.min.js +1 -1
- package/dist/ceb-bcv-parser.js +80 -32
- package/dist/ceb-bcv-parser.min.js +2 -2
- package/dist/cs-bcv-parser.js +80 -32
- package/dist/cs-bcv-parser.min.js +1 -1
- package/dist/da-bcv-parser.js +80 -32
- package/dist/da-bcv-parser.min.js +2 -2
- package/dist/de-bcv-parser.js +80 -32
- package/dist/de-bcv-parser.min.js +2 -2
- package/dist/ee-bcv-parser.js +80 -32
- package/dist/ee-bcv-parser.min.js +3 -3
- package/dist/el-bcv-parser.js +80 -32
- package/dist/el-bcv-parser.min.js +1 -1
- package/dist/es-bcv-parser.js +80 -32
- package/dist/es-bcv-parser.min.js +2 -2
- package/dist/fa-bcv-parser.js +80 -32
- package/dist/fa-bcv-parser.min.js +3 -3
- package/dist/fi-bcv-parser.js +80 -32
- package/dist/fi-bcv-parser.min.js +1 -1
- package/dist/fr-bcv-parser.js +80 -32
- package/dist/fr-bcv-parser.min.js +3 -3
- package/dist/he-bcv-parser.js +80 -32
- package/dist/he-bcv-parser.min.js +1 -1
- package/dist/hi-bcv-parser.js +80 -32
- package/dist/hi-bcv-parser.min.js +1 -1
- package/dist/hl-bcv-parser.js +80 -32
- package/dist/hl-bcv-parser.min.js +1 -1
- package/dist/hr-bcv-parser.js +80 -32
- package/dist/hr-bcv-parser.min.js +2 -2
- package/dist/ht-bcv-parser.js +80 -32
- package/dist/ht-bcv-parser.min.js +1 -1
- package/dist/hu-bcv-parser.js +80 -32
- package/dist/hu-bcv-parser.min.js +2 -2
- package/dist/id-bcv-parser.js +80 -32
- package/dist/id-bcv-parser.min.js +1 -1
- package/dist/il-bcv-parser.js +78 -30
- package/dist/il-bcv-parser.min.js +1 -1
- package/dist/is-bcv-parser.js +80 -32
- package/dist/is-bcv-parser.min.js +1 -1
- package/dist/it-bcv-parser.js +80 -32
- package/dist/it-bcv-parser.min.js +2 -2
- package/dist/ja-bcv-parser.js +80 -32
- package/dist/ja-bcv-parser.min.js +3 -3
- package/dist/jv-bcv-parser.js +80 -32
- package/dist/jv-bcv-parser.min.js +2 -2
- package/dist/ko-bcv-parser.js +80 -32
- package/dist/ko-bcv-parser.min.js +1 -1
- package/dist/la-bcv-parser.js +80 -32
- package/dist/la-bcv-parser.min.js +2 -2
- package/dist/lu-bcv-parser.js +80 -32
- package/dist/lu-bcv-parser.min.js +1 -1
- package/dist/mg-bcv-parser.js +80 -32
- package/dist/mg-bcv-parser.min.js +3 -3
- package/dist/mk-bcv-parser.js +80 -32
- package/dist/mk-bcv-parser.min.js +2 -2
- package/dist/mq-bcv-parser.js +80 -32
- package/dist/mq-bcv-parser.min.js +2 -2
- package/dist/mr-bcv-parser.js +80 -32
- package/dist/mr-bcv-parser.min.js +2 -2
- package/dist/nd-bcv-parser.js +80 -32
- package/dist/nd-bcv-parser.min.js +2 -2
- package/dist/ne-bcv-parser.js +80 -32
- package/dist/ne-bcv-parser.min.js +1 -1
- package/dist/nl-bcv-parser.js +80 -32
- package/dist/nl-bcv-parser.min.js +3 -3
- package/dist/no-bcv-parser.js +80 -32
- package/dist/no-bcv-parser.min.js +2 -2
- package/dist/ny-bcv-parser.js +80 -32
- package/dist/ny-bcv-parser.min.js +1 -1
- package/dist/or-bcv-parser.js +80 -32
- package/dist/or-bcv-parser.min.js +2 -2
- package/dist/pa-bcv-parser.js +80 -32
- package/dist/pa-bcv-parser.min.js +1 -1
- package/dist/pl-bcv-parser.js +80 -32
- package/dist/pl-bcv-parser.min.js +1 -1
- package/dist/pt-bcv-parser.js +80 -32
- package/dist/pt-bcv-parser.min.js +3 -3
- package/dist/ro-bcv-parser.js +80 -32
- package/dist/ro-bcv-parser.min.js +1 -1
- package/dist/ru-bcv-parser.js +80 -32
- package/dist/ru-bcv-parser.min.js +1 -1
- package/dist/rw-bcv-parser.js +80 -32
- package/dist/rw-bcv-parser.min.js +1 -1
- package/dist/si-bcv-parser.js +80 -32
- package/dist/si-bcv-parser.min.js +1 -1
- package/dist/sk-bcv-parser.js +80 -32
- package/dist/sk-bcv-parser.min.js +3 -3
- package/dist/so-bcv-parser.js +80 -32
- package/dist/so-bcv-parser.min.js +1 -1
- package/dist/sq-bcv-parser.js +80 -32
- package/dist/sq-bcv-parser.min.js +1 -1
- package/dist/sr-bcv-parser.js +80 -32
- package/dist/sr-bcv-parser.min.js +1 -1
- package/dist/sv-bcv-parser.js +80 -32
- package/dist/sv-bcv-parser.min.js +2 -2
- package/dist/sw-bcv-parser.js +80 -32
- package/dist/sw-bcv-parser.min.js +2 -2
- package/dist/ta-bcv-parser.js +80 -32
- package/dist/ta-bcv-parser.min.js +2 -2
- package/dist/th-bcv-parser.js +80 -32
- package/dist/th-bcv-parser.min.js +2 -2
- package/dist/tl-bcv-parser.js +80 -32
- package/dist/tl-bcv-parser.min.js +1 -1
- package/dist/tr-bcv-parser.js +80 -32
- package/dist/tr-bcv-parser.min.js +1 -1
- package/dist/uk-bcv-parser.js +80 -32
- package/dist/uk-bcv-parser.min.js +1 -1
- package/dist/ur-bcv-parser.js +80 -32
- package/dist/ur-bcv-parser.min.js +1 -1
- package/dist/vi-bcv-parser.js +80 -32
- package/dist/vi-bcv-parser.min.js +1 -1
- package/dist/zh-bcv-parser.js +80 -32
- package/dist/zh-bcv-parser.min.js +1 -1
- package/dist/zu-bcv-parser.js +80 -32
- package/dist/zu-bcv-parser.min.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const root=this;class bcv_parser{static initClass(){this.prototype.s="",this.prototype.entities=[],this.prototype.passage=null,this.prototype.regexps={},this.prototype.options={consecutive_combination_strategy:"combine",osis_compaction_strategy:"b",book_sequence_strategy:"ignore",invalid_sequence_strategy:"ignore",sequence_combination_strategy:"combine",punctuation_strategy:"us",invalid_passage_strategy:"ignore",non_latin_digits_strategy:"ignore",passage_existence_strategy:"bcv",zero_chapter_strategy:"error",zero_verse_strategy:"error",single_chapter_1_strategy:"chapter",book_alone_strategy:"ignore",book_range_strategy:"ignore",captive_end_digits_strategy:"delete",end_range_digits_strategy:"verse",include_apocrypha:!1,ps151_strategy:"c",versification_system:"default",case_sensitive:"none"}}constructor(){for(var e of(this.options={},Object.keys(bcv_parser.prototype.options||{}))){var s=bcv_parser.prototype.options[e];this.options[e]=s}this.versification_system(this.options.versification_system)}parse(e){return this.reset(),this.s=e,e=this.replace_control_characters(e),[e,this.passage.books]=Array.from(this.match_books(e)),[this.entities]=Array.from(this.match_passages(e)),this}parse_with_context(e,s){let t;return this.reset(),[s,this.passage.books]=Array.from(this.match_books(this.replace_control_characters(s))),[t,s]=Array.from(this.match_passages(s)),this.reset(),this.s=e,e=this.replace_control_characters(e),[e,this.passage.books]=Array.from(this.match_books(e)),this.passage.books.push({value:"",parsed:[],start_index:0,type:"context",context:s}),e=""+(this.passage.books.length-1)+"/9"+e,[this.entities]=Array.from(this.match_passages(e)),this}reset(){return this.s="",this.entities=[],this.passage?(this.passage.books=[],this.passage.indices={}):(this.passage=new bcv_passage,this.passage.options=this.options,this.passage.translations=this.translations)}set_options(e){for(var s of Object.keys(e||{})){var t=e[s];"include_apocrypha"===s||"versification_system"===s||"case_sensitive"===s?this[s](t):this.options[s]=t}return this}include_apocrypha(e){if(null==e||!0!==e&&!1!==e)return this;for(var s of(this.options.include_apocrypha=e,this.regexps.books=this.regexps.get_books(e,this.options.case_sensitive),Object.keys(this.translations||{}))){var t;if("aliases"!==s&&"alternates"!==s)if(null==this.translations[s].chapters&&(this.translations[s].chapters={}),null==this.translations[s].chapters.Ps&&(this.translations[s].chapters.Ps=bcv_utils.shallow_clone_array(this.translations.default.chapters.Ps)),!0===e)t=null!=this.translations[s].chapters.Ps151?this.translations[s].chapters.Ps151[0]:this.translations.default.chapters.Ps151[0],this.translations[s].chapters.Ps[150]=t;else 151===this.translations[s].chapters.Ps.length&&this.translations[s].chapters.Ps.pop()}return this}versification_system(e){let s,t;if(null==e||null==this.translations[e])return this;if(null!=this.translations.alternates.default)if("default"===e)for(s of(null!=this.translations.alternates.default.order&&(this.translations.default.order=bcv_utils.shallow_clone(this.translations.alternates.default.order)),Object.keys(this.translations.alternates.default.chapters||{})))t=this.translations.alternates.default.chapters[s],this.translations.default.chapters[s]=bcv_utils.shallow_clone_array(t);else this.versification_system("default");if(null==this.translations.alternates.default&&(this.translations.alternates.default={order:null,chapters:{}}),"default"!==e&&null!=this.translations[e].order&&(null==this.translations.alternates.default.order&&(this.translations.alternates.default.order=bcv_utils.shallow_clone(this.translations.default.order)),this.translations.default.order=bcv_utils.shallow_clone(this.translations[e].order)),"default"!==e&&null!=this.translations[e].chapters)for(s of Object.keys(this.translations[e].chapters||{}))t=this.translations[e].chapters[s],null==this.translations.alternates.default.chapters[s]&&(this.translations.alternates.default.chapters[s]=bcv_utils.shallow_clone_array(this.translations.default.chapters[s])),this.translations.default.chapters[s]=bcv_utils.shallow_clone_array(t);return this.options.versification_system=e,this.include_apocrypha(this.options.include_apocrypha),this}case_sensitive(e){return null==e||"none"!==e&&"books"!==e||e===this.options.case_sensitive||(this.options.case_sensitive=e,this.regexps.books=this.regexps.get_books(this.options.include_apocrypha,e)),this}translation_info(e){let s;null==e&&(e="default"),null!=e&&null!=(null!=this.translations.aliases[e]?this.translations.aliases[e].alias:void 0)&&(e=this.translations.aliases[e].alias),null!=e&&null!=this.translations[e]||(e="default");const t=this.options.versification_system;e!==t&&this.versification_system(e);const a={alias:e,books:[],chapters:{},order:bcv_utils.shallow_clone(this.translations.default.order)};for(s of Object.keys(this.translations.default.chapters||{})){var r=this.translations.default.chapters[s];a.chapters[s]=bcv_utils.shallow_clone_array(r)}for(s of Object.keys(a.order||{})){var n=a.order[s];a.books[n-1]=s}return e!==t&&this.versification_system(t),a}replace_control_characters(e){return e=(e=(e=e.replace(this.regexps.control," ")).replace(/\uFF1A/g,":")).replace(/\uFF1B/g,";"),"replace"===this.options.non_latin_digits_strategy&&(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/[٠۰߀०০੦૦୦0౦೦൦๐໐༠၀႐០᠐᥆᧐᪀᪐᭐᮰᱀᱐꘠꣐꤀꧐꩐꯰0]/g,"0")).replace(/[١۱߁१১੧૧୧௧౧೧൧๑໑༡၁႑១᠑᥇᧑᪁᪑᭑᮱᱁᱑꘡꣑꤁꧑꩑꯱1]/g,"1")).replace(/[٢۲߂२২੨૨୨௨౨೨൨๒໒༢၂႒២᠒᥈᧒᪂᪒᭒᮲᱂᱒꘢꣒꤂꧒꩒꯲2]/g,"2")).replace(/[٣۳߃३৩੩૩୩௩౩೩൩๓໓༣၃႓៣᠓᥉᧓᪃᪓᭓᮳᱃᱓꘣꣓꤃꧓꩓꯳3]/g,"3")).replace(/[٤۴߄४৪੪૪୪௪౪೪൪๔໔༤၄႔៤᠔᥊᧔᪄᪔᭔᮴᱄᱔꘤꣔꤄꧔꩔꯴4]/g,"4")).replace(/[٥۵߅५৫੫૫୫௫౫೫൫๕໕༥၅႕៥᠕᥋᧕᪅᪕᭕᮵᱅᱕꘥꣕꤅꧕꩕꯵5]/g,"5")).replace(/[٦۶߆६৬੬૬୬௬౬೬൬๖໖༦၆႖៦᠖᥌᧖᪆᪖᭖᮶᱆᱖꘦꣖꤆꧖꩖꯶6]/g,"6")).replace(/[٧۷߇७৭੭૭୭௭౭೭൭๗໗༧၇႗៧᠗᥍᧗᪇᪗᭗᮷᱇᱗꘧꣗꤇꧗꩗꯷7]/g,"7")).replace(/[٨۸߈८৮੮૮୮௮౮೮൮๘໘༨၈႘៨᠘᥎᧘᪈᪘᭘᮸᱈᱘꘨꣘꤈꧘꩘꯸8]/g,"8")).replace(/[٩۹߉९৯੯૯୯௯౯೯൯๙໙༩၉႙៩᠙᥏᧙᪉᪙᭙᮹᱉᱙꘩꣙꤉꧙꩙꯹9]/g,"9")),e}match_books(e){const s=[];for(var t of Array.from(this.regexps.books)){var a=!1;if(e=e.replace(t.regexp,(function(e,r,n){a=!0,s.push({value:n,parsed:t.osis,type:"book"});const i=null!=t.extra?`/${t.extra}`:"";return`${r}${s.length-1}${i}`})),!0===a&&/^[\s\x1f\d:.,;\-\u2013\u2014]+$/.test(e))break}return[e=e.replace(this.regexps.translations,(function(e){return s.push({value:e,parsed:e.toLowerCase(),type:"translation"}),`${s.length-1}`})),this.get_book_indices(s,e)]}get_book_indices(e,s){let t,a=0;const r=new RegExp("([\\x1f\\x1e])(\\d+)(?:/\\d+)?\\1","g");for(;t=r.exec(s);)e[t[2]].start_index=t.index+a,a+=e[t[2]].value.length-t[0].length;return e}match_passages(e){let s,t=[],a={};for(;s=this.regexps.escaped_passage.exec(e);){let g;var[r,n,i]=Array.from(s),o=n.length;if(s.index+=r.length-o,/\s[2-9]\d\d\s*$|\s\d{4,}\s*$/.test(n)&&(n=n.replace(/\s+\d+\s*$/,"")),/[\d\x1f\x1e)]$/.test(n)||(n=this.replace_match_end(n)),"delete"===this.options.captive_end_digits_strategy){var l=s.index+n.length;e.length>l&&/^\w/.test(e.substr(l,1))&&(n=n.replace(/[\s*]+\d+$/,"")),n=n.replace(/(\x1e[)\]]?)[\s*]*\d+$/,"$1")}var u=""===(n=n.replace(/[A-Z]+/g,(e=>e.toLowerCase()))).substr(0,1)?0:n.split("")[0].length,c={value:grammar.parse(n,{punctuation_strategy:this.options.punctuation_strategy}),type:"base",start_index:this.passage.books[i].start_index-u,match:n};"full"===this.options.book_alone_strategy&&"include"===this.options.book_range_strategy&&"b"===c.value[0].type&&(1===c.value.length||c.value.length>1&&"translation_sequence"===c.value[1].type)&&0===u&&(1===this.passage.books[i].parsed.length||this.passage.books[i].parsed.length>1&&"translation"===this.passage.books[i].parsed[1].type)&&/^[234]/.test(this.passage.books[i].parsed[0])&&this.create_book_range(e,c,i),[g,a]=Array.from(this.passage.handle_obj(c)),t=t.concat(g);var p=this.adjust_regexp_end(g,o,n.length);p>0&&(this.regexps.escaped_passage.lastIndex-=p)}return[t,a]}adjust_regexp_end(e,s,t){let a=0;return e.length>0?a=s-e[e.length-1].indices[1]-1:s!==t&&(a=s-t),a}replace_match_end(e){let s,t=e.length;for(;s=this.regexps.match_end_split.exec(e);)t=s.index+s[0].length;return t<e.length&&(e=e.substr(0,t)),e}create_book_range(e,s,t){const a=[bcv_parser.prototype.regexps.first,bcv_parser.prototype.regexps.second,bcv_parser.prototype.regexps.third],r=parseInt(this.passage.books[t].parsed[0].substr(0,1),10);for(let o=1,l=r,u=1<=l;u?o<l:o>l;u?o++:o--){var n=o===r-1?bcv_parser.prototype.regexps.range_and:bcv_parser.prototype.regexps.range_only,i=e.match(new RegExp(`(?:^|\\W)(${a[o-1]}\\s*${n}\\s*)\\x1f${t}\\x1f`,"i"));if(null!=i)return this.add_book_range_object(s,i,o)}return!1}add_book_range_object(e,s,t){const{length:a}=s[1];if(e.value[0]={type:"b_range_pre",value:[{type:"b_pre",value:t.toString(),indices:[s.index,s.index+a]},e.value[0]],indices:[0,e.value[0].indices[1]+a]},e.value[0].value[1].indices[0]+=a,e.value[0].value[1].indices[1]+=a,e.start_index-=a,e.match=s[1]+e.match,1!==e.value.length)return(()=>{const s=[];for(let t=1,r=e.value.length,n=1<=r;n?t<r:t>r;n?t++:t--)null!=e.value[t].value&&(null!=(null!=e.value[t].value[0]?e.value[t].value[0].indices:void 0)&&(e.value[t].value[0].indices[0]+=a,e.value[t].value[0].indices[1]+=a),e.value[t].indices[0]+=a,s.push(e.value[t].indices[1]+=a));return s})()}osis(){const e=[];for(var s of Array.from(this.parsed_entities()))s.osis.length>0&&e.push(s.osis);return e.join(",")}osis_and_translations(){const e=[];for(var s of Array.from(this.parsed_entities()))s.osis.length>0&&e.push([s.osis,s.translations.join(",")]);return e}osis_and_indices(){const e=[];for(var s of Array.from(this.parsed_entities()))s.osis.length>0&&e.push({osis:s.osis,translations:s.translations,indices:s.indices});return e}parsed_entities(){let e=[];for(let A=0,$=this.entities.length,E=0<=$;E?A<$:A>$;E?A++:A--){var s=this.entities[A];if(s.type&&"translation_sequence"===s.type&&e.length>0&&A===e[e.length-1].entity_id+1&&(e[e.length-1].indices[1]=s.absolute_indices[1]),null!=s.passages&&!("b"===s.type&&"ignore"===this.options.book_alone_strategy||"b_range"===s.type&&"ignore"===this.options.book_range_strategy||"context"===s.type)){var t=[],a=null;if(null!=s.passages[0].translations)for(var r of Array.from(s.passages[0].translations)){var n=(null!=r.osis?r.osis.length:void 0)>0?r.osis:"";null==a&&(a=r.alias),t.push(n)}else t=[""],a="default";for(var i=[],o=[],{length:l}=s.passages,u=0,c=u,p=l,g=0<=p;g?u<p:u>p;g?u++:u--,c=u){var _,x,h=s.passages[c];if(null==h.type&&(h.type=s.type),!1!==h.valid.valid||("ignore"===this.options.invalid_sequence_strategy&&"sequence"===s.type&&this.snap_sequence("ignore",s,i,c,l),"ignore"!==this.options.invalid_passage_strategy))if("b"!==h.type&&"b_range"!==h.type||"ignore"!==this.options.book_sequence_strategy||"sequence"!==s.type)if("b_range_start"!==h.type&&"range_end_b"!==h.type||"ignore"!==this.options.book_range_strategy||this.snap_range(s,c),null==h.absolute_indices&&(h.absolute_indices=s.absolute_indices),"separate-chapters"===this.options.consecutive_combination_strategy&&h.start.c!==h.end.c)for(c=h.start.c,x=h.end.c,_=h.start.c<=x;_?c<=x:c>=x;_?c++:c--){var f=c===h.start.c?h.start.v:1,d=c===h.end.c?h.end.v:this.translations[a].chapters[h.start.b][c-1],v={b:h.start.b,c:c,v:"bcv"===h.start.type?f:null,type:h.start.type},b={b:h.end.b,c:c,v:"bcv"===h.start.type?d:null,type:h.start.type};o.push({osis:h.valid.valid?this.to_osis(v,b,a):"",type:h.type,indices:h.absolute_indices,translations:t,start:v,end:b,enclosed_indices:h.enclosed_absolute_indices,entity_id:A,entities:[h]})}else i.push({osis:h.valid.valid?this.to_osis(h.start,h.end,a):"",type:h.type,indices:h.absolute_indices,translations:t,start:h.start,end:h.end,enclosed_indices:h.enclosed_absolute_indices,entity_id:A,entities:[h]});else this.snap_sequence("book",s,i,c,l)}if(0!==i.length||0!==o.length)if("combine"!==this.options.consecutive_combination_strategy&&"separate-chapters"!==this.options.consecutive_combination_strategy||(i.length>1&&(i=this.combine_consecutive_passages(i,a)),i=i.concat(o).sort(((e,s)=>e.indices[0]-s.indices[0]))),"separate"===this.options.sequence_combination_strategy)e=e.concat(i);else{var y,m=[],k=i.length-1;for(y of(null!=i[k].enclosed_indices&&i[k].enclosed_indices[1]>=0&&(s.absolute_indices[1]=i[k].enclosed_indices[1]),Array.from(i)))y.osis.length>0&&m.push(y.osis);e.push({osis:m.join(","),indices:s.absolute_indices,translations:t,entity_id:A,entities:i})}}}return e}to_osis(e,s,t){let a;null==s.c&&null==s.v&&e.b===s.b&&null==e.c&&null==e.v&&"first_chapter"===this.options.book_alone_strategy&&(s.c=1);const r={start:"",end:""};return null==e.c&&(e.c=1),null==e.v&&(e.v=1),null==s.c&&(this.options.passage_existence_strategy.indexOf("c")>=0||null!=this.passage.translations[t].chapters[s.b]&&1===this.passage.translations[t].chapters[s.b].length?s.c=this.passage.translations[t].chapters[s.b].length:s.c=999),null==s.v&&(null!=this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0?s.v=this.passage.translations[t].chapters[s.b][s.c-1]:s.v=999),this.options.include_apocrypha&&"b"===this.options.ps151_strategy&&(151===e.c&&"Ps"===e.b||151===s.c&&"Ps"===s.b)&&this.fix_ps151(e,s,t),"b"===this.options.osis_compaction_strategy&&1===e.c&&1===e.v&&(999===s.c&&999===s.v||s.c===this.passage.translations[t].chapters[s.b].length&&this.options.passage_existence_strategy.indexOf("c")>=0&&(999===s.v||s.v===this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0))?(r.start=e.b,r.end=s.b):this.options.osis_compaction_strategy.length<=2&&1===e.v&&(999===s.v||s.v===this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0)?(r.start=e.b+"."+e.c.toString(),r.end=s.b+"."+s.c.toString()):(r.start=e.b+"."+e.c.toString()+"."+e.v.toString(),r.end=s.b+"."+s.c.toString()+"."+s.v.toString()),a=r.start===r.end?r.start:r.start+"-"+r.end,null!=e.extra&&(a=e.extra+","+a),null!=s.extra&&(a+=","+s.extra),a}fix_ps151(e,s,t){return"default"!==t&&null==(null!=this.translations[t]?this.translations[t].chapters.Ps151:void 0)&&this.passage.promote_book_to_translation("Ps151",t),151===e.c&&"Ps"===e.b?151===s.c&&"Ps"===s.b?(e.b="Ps151",e.c=1,s.b="Ps151",s.c=1):(e.extra=this.to_osis({b:"Ps151",c:1,v:e.v},{b:"Ps151",c:1,v:this.passage.translations[t].chapters.Ps151[0]},t),e.b="Prov",e.c=1,e.v=1):(s.extra=this.to_osis({b:"Ps151",c:1,v:1},{b:"Ps151",c:1,v:s.v},t),s.c=150,s.v=this.passage.translations[t].chapters.Ps[149])}combine_consecutive_passages(e,s){const t=[];let a={};const r=e.length-1;let n=-1,i=!1;for(let c=0,p=r,g=0<=p;g?c<=p:c>=p;g?c++:c--){var o=e[c];if(o.osis.length>0){var l=t.length-1,u=!1;o.enclosed_indices[0]!==n&&(n=o.enclosed_indices[0]),n>=0&&(c===r||e[c+1].enclosed_indices[0]!==o.enclosed_indices[0])&&(u=!0,i=!0),this.is_verse_consecutive(a,o.start,s)?(t[l].end=o.end,t[l].is_enclosed_last=u,t[l].indices[1]=o.indices[1],t[l].enclosed_indices[1]=o.enclosed_indices[1],t[l].osis=this.to_osis(t[l].start,o.end,s)):t.push(o),a={b:o.end.b,c:o.end.c,v:o.end.v}}else t.push(o),a={}}return i&&this.snap_enclosed_indices(t),t}snap_enclosed_indices(e){for(var s of Array.from(e))null!=s.is_enclosed_last&&(s.enclosed_indices[0]<0&&s.is_enclosed_last&&(s.indices[1]=s.enclosed_indices[1]),delete s.is_enclosed_last);return e}is_verse_consecutive(e,s,t){if(null==e.b)return!1;const a=null!=this.passage.translations[t].order?this.passage.translations[t].order:this.passage.translations.default.order;if(e.b===s.b){if(e.c===s.c){if(e.v===s.v-1)return!0}else if(1===s.v&&e.c===s.c-1&&e.v===this.passage.translations[t].chapters[e.b][e.c-1])return!0}else if(1===s.c&&1===s.v&&a[e.b]===a[s.b]-1&&e.c===this.passage.translations[t].chapters[e.b].length&&e.v===this.passage.translations[t].chapters[e.b][e.c-1])return!0;return!1}snap_range(e,s){let t,a,r;"b_range_start"===e.type||"sequence"===e.type&&"b_range_start"===e.passages[s].type?(t=1,a="end",r="b_range_start"):(t=0,a="start",r="range_end_b");const n="end"===a?"start":"end";for(var i of Object.keys(e.passages[s][n]||{}))e.passages[s][n][i]=e.passages[s][a][i];if("sequence"===e.type){s>=e.value.length&&(s=e.value.length-1);const t=this.passage.pluck(r,e.value[s]);if(null!=t){const a=this.snap_range(t,0);0===s?e.absolute_indices[0]=a.absolute_indices[0]:e.absolute_indices[1]=a.absolute_indices[1]}}else e.original_type=e.type,e.type=e.value[t].type,e.absolute_indices=[e.value[t].absolute_indices[0],e.value[t].absolute_indices[1]];return e}snap_sequence(e,s,t,a,r){const n=s.passages[a];return n.absolute_indices[0]===s.absolute_indices[0]&&a<r-1&&this.get_snap_sequence_i(s.passages,a,r)!==a?(s.absolute_indices[0]=s.passages[a+1].absolute_indices[0],this.remove_absolute_indices(s.passages,a+1)):n.absolute_indices[1]===s.absolute_indices[1]&&a>0?s.absolute_indices[1]=t.length>0?t[t.length-1].indices[1]:s.passages[a-1].absolute_indices[1]:"book"===e&&a<r-1&&!this.starts_with_book(s.passages[a+1])&&(s.passages[a+1].absolute_indices[0]=n.absolute_indices[0]),s}get_snap_sequence_i(e,s,t){for(let a=s+1,r=a,n=t,i=a<=n;i?r<n:r>n;i?r++:r--){if(this.starts_with_book(e[r]))return r;if(e[r].valid.valid)return s}return s}starts_with_book(e){return"b"===e.type.substr(0,1)||("range"===e.type||"ff"===e.type)&&"b"===e.start.type.substr(0,1)}remove_absolute_indices(e,s){if(e[s].enclosed_absolute_indices[0]<0)return!1;const[t,a]=Array.from(e[s].enclosed_absolute_indices);for(var r of Array.from(e.slice(s))){if(r.enclosed_absolute_indices[0]!==t||r.enclosed_absolute_indices[1]!==a)break;r.enclosed_absolute_indices=[-1,-1]}return!0}}bcv_parser.initClass(),this.bcv_parser=bcv_parser;class bcv_passage{static initClass(){this.prototype.books=[],this.prototype.indices={},this.prototype.options={},this.prototype.translations={}}handle_array(e,s,t){for(var a of(null==s&&(s=[]),null==t&&(t={}),Array.from(e)))if(null!=a){if("stop"===a.type)break;[s,t]=Array.from(this.handle_obj(a,s,t))}return[s,t]}handle_obj(e,s,t){return null!=e.type&&null!=this[e.type]?this[e.type](e,s,t):[s,t]}b(e,s,t){let a;e.start_context=bcv_utils.shallow_clone(t),e.passages=[];const r=[];for(a of Array.from(this.books[e.value].parsed)){var n=this.validate_ref(e.start_context.translations,{b:a}),i={start:{b:a},end:{b:a},valid:n};0===e.passages.length&&n.valid?e.passages.push(i):r.push(i)}return 0===e.passages.length&&e.passages.push(r.shift()),r.length>0&&(e.passages[0].alternates=r),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),t={b:e.passages[0].start.b},null!=e.start_context.translations&&(t.translations=e.start_context.translations),[s,t]}b_range(e,s,t){return this.range(e,s,t)}b_range_pre(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t),e.passages=[];const n=this.pluck("b",e.value);a=this.b(n,[],t),[r]=Array.from(a[0]),t=a[1],null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices));const i={b:e.value[0].value+r.passages[0].start.b.substr(1),type:"b"};return e.passages=[{start:i,end:r.passages[0].end,valid:r.passages[0].valid}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),[s,t]}b_range_start(e,s,t){return this.range(e,s,t)}base(e,s,t){return this.indices=this.calculate_indices(e.match,e.start_index),this.handle_array(e.value,s,t)}bc(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.passages=[],this.reset_context(t,["b","c","v"]);const a=this.pluck("c",e.value).value,r=[];for(var n of Array.from(this.books[this.pluck("b",e.value).value].parsed)){var i="c",o=this.validate_ref(e.start_context.translations,{b:n,c:a}),l={start:{b:n},end:{b:n},valid:o};(o.messages.start_chapter_not_exist_in_single_chapter_book||o.messages.start_chapter_1)&&(l.valid=this.validate_ref(e.start_context.translations,{b:n,v:a}),o.messages.start_chapter_not_exist_in_single_chapter_book&&(l.valid.messages.start_chapter_not_exist_in_single_chapter_book=1),l.start.c=1,l.end.c=1,i="v"),l.start[i]=a,[l.start.c,l.start.v]=Array.from(this.fix_start_zeroes(l.valid,l.start.c,l.start.v)),null==l.start.v&&delete l.start.v,l.end[i]=l.start[i],0===e.passages.length&&l.valid.valid?e.passages.push(l):r.push(l)}return 0===e.passages.length&&e.passages.push(r.shift()),r.length>0&&(e.passages[0].alternates=r),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),this.set_context_from_object(t,["b","c","v"],e.passages[0].start),s.push(e),[s,t]}bc_title(e,s,t){let a,r;if(e.start_context=bcv_utils.shallow_clone(t),a=this.bc(this.pluck("bc",e.value),[],t),[r]=Array.from(a[0]),t=a[1],"Ps"!==r.passages[0].start.b.substr(0,2)&&null!=r.passages[0].alternates)for(let e=0,s=r.passages[0].alternates.length,t=0<=s;t?e<s:e>s;t?e++:e--)if("Ps"===r.passages[0].alternates[e].start.b.substr(0,2)){r.passages[0]=r.passages[0].alternates[e];break}if("Ps"!==r.passages[0].start.b.substr(0,2))return s.push(r),[s,t];this.books[this.pluck("b",r.value).value].parsed=["Ps"];let n=this.pluck("title",e.value);return null==n&&(n=this.pluck("v",e.value)),e.value[1]={type:"v",value:[{type:"integer",value:1,indices:n.indices}],indices:n.indices},e.type="bcv",this.bcv(e,s,e.start_context)}bcv(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.passages=[],this.reset_context(t,["b","c","v"]);const a=this.pluck("bc",e.value);let r=this.pluck("c",a.value).value,n=this.pluck("v",e.value).value;const i=[];for(var o of Array.from(this.books[this.pluck("b",a.value).value].parsed)){var l=this.validate_ref(e.start_context.translations,{b:o,c:r,v:n});[r,n]=Array.from(this.fix_start_zeroes(l,r,n));var u={start:{b:o,c:r,v:n},end:{b:o,c:r,v:n},valid:l};0===e.passages.length&&l.valid?e.passages.push(u):i.push(u)}return 0===e.passages.length&&e.passages.push(i.shift()),i.length>0&&(e.passages[0].alternates=i),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),this.set_context_from_object(t,["b","c","v"],e.passages[0].start),s.push(e),[s,t]}bv(e,s,t){let a;e.start_context=bcv_utils.shallow_clone(t);const[r,n]=Array.from(e.value);let i={indices:e.indices,value:[{type:"bc",value:[r,{type:"c",value:[{type:"integer",value:1}]}]},n]};return a=this.bcv(i,[],t),[i]=Array.from(a[0]),t=a[1],e.passages=i.passages,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),[s,t]}c(e,s,t){e.start_context=bcv_utils.shallow_clone(t);let a="integer"===e.type?e.value:this.pluck("integer",e.value).value;const r=this.validate_ref(e.start_context.translations,{b:t.b,c:a});return!r.valid&&r.messages.start_chapter_not_exist_in_single_chapter_book?this.v(e,s,t):([a]=Array.from(this.fix_start_zeroes(r,a)),e.passages=[{start:{b:t.b,c:a},end:{b:t.b,c:a},valid:r}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),t.c=a,this.reset_context(t,["v"]),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,t])}c_psalm(e,s,t){e.type="bc";const a=parseInt(this.books[e.value].value.match(/^\d+/)[0],10);return e.value=[{type:"b",value:e.value,indices:e.indices},{type:"c",value:[{type:"integer",value:a,indices:e.indices}],indices:e.indices}],this.bc(e,s,t)}c_title(e,s,t){if(e.start_context=bcv_utils.shallow_clone(t),"Ps"!==t.b)return this.c(e.value[0],s,t);const a=this.pluck("title",e.value);return e.value[1]={type:"v",value:[{type:"integer",value:1,indices:a.indices}],indices:a.indices},e.type="cv",this.cv(e,s,e.start_context)}cv(e,s,t){e.start_context=bcv_utils.shallow_clone(t);let a=this.pluck("c",e.value).value,r=this.pluck("v",e.value).value;const n=this.validate_ref(e.start_context.translations,{b:t.b,c:a,v:r});return[a,r]=Array.from(this.fix_start_zeroes(n,a,r)),e.passages=[{start:{b:t.b,c:a,v:r},end:{b:t.b,c:a,v:r},valid:n}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),t.c=a,t.v=r,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,t]}cb_range(e,s,t){e.type="range";const[a,r,n]=Array.from(e.value);return e.value=[{type:"bc",value:[a,r],indices:e.indices},n],n.indices[1]=e.indices[1],this.range(e,s,t)}context(e,s,t){for(var a of(e.start_context=bcv_utils.shallow_clone(t),e.passages=[],Object.keys(this.books[e.value].context||{})))t[a]=this.books[e.value].context[a];return s.push(e),[s,t]}cv_psalm(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.type="bcv";const[a,r]=Array.from(e.value),n=this.c_psalm(a,[],e.start_context),[i]=Array.from(n[0]);return e.value=[i,r],this.bcv(e,s,t)}ff(e,s,t){let a;return e.start_context=bcv_utils.shallow_clone(t),e.value.push({type:"integer",indices:e.indices,value:999}),a=this.range(e,[],e.start_context),[e]=Array.from(a[0]),t=a[1],e.value[0].indices=e.value[1].indices,e.value[0].absolute_indices=e.value[1].absolute_indices,e.value.pop(),null!=e.passages[0].valid.messages.end_verse_not_exist&&delete e.passages[0].valid.messages.end_verse_not_exist,null!=e.passages[0].valid.messages.end_chapter_not_exist&&delete e.passages[0].valid.messages.end_chapter_not_exist,null!=e.passages[0].end.original_c&&delete e.passages[0].end.original_c,s.push(e),[s,t]}integer_title(e,s,t){return e.start_context=bcv_utils.shallow_clone(t),"Ps"!==t.b?this.integer(e.value[0],s,t):(e.value[0]={type:"c",value:[e.value[0]],indices:[e.value[0].indices[0],e.value[0].indices[1]]},e.value[1].type="v",e.value[1].original_type="title",e.value[1].value=[{type:"integer",value:1,indices:e.value[1].value.indices}],e.type="cv",this.cv(e,s,e.start_context))}integer(e,s,t){return null!=t.v?this.v(e,s,t):this.c(e,s,t)}next_v(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t);let n=this.pluck_last_recursively("integer",e.value);if(null==n&&(n={value:1}),e.value.push({type:"integer",indices:e.indices,value:n.value+1}),a=this.range(e,[],e.start_context),[r]=Array.from(a[0]),t=a[1],null!=r.passages[0].valid.messages.end_verse_not_exist&&null==r.passages[0].valid.messages.start_verse_not_exist&&null==r.passages[0].valid.messages.start_chapter_not_exist&&null!=t.c){let s;e.value.pop(),e.value.push({type:"cv",indices:e.indices,value:[{type:"c",value:[{type:"integer",value:t.c+1,indices:e.indices}],indices:e.indices},{type:"v",value:[{type:"integer",value:1,indices:e.indices}],indices:e.indices}]}),s=this.range(e,[],e.start_context),[r]=Array.from(s[0]),t=s[1]}return r.value[0].indices=r.value[1].indices,r.value[0].absolute_indices=r.value[1].absolute_indices,r.value.pop(),null!=r.passages[0].valid.messages.end_verse_not_exist&&delete r.passages[0].valid.messages.end_verse_not_exist,null!=r.passages[0].valid.messages.end_chapter_not_exist&&delete r.passages[0].valid.messages.end_chapter_not_exist,null!=r.passages[0].end.original_c&&delete r.passages[0].end.original_c,s.push(r),[s,t]}sequence(e,s,t){for(var a of(e.start_context=bcv_utils.shallow_clone(t),e.passages=[],Array.from(e.value))){var r,n;for(var i of(r=this.handle_array(a,[],t),[n]=Array.from(r[0]),t=r[1],Array.from(n.passages)))null==i.type&&(i.type=n.type),null==i.absolute_indices&&(i.absolute_indices=n.absolute_indices),null!=n.start_context.translations&&(i.translations=n.start_context.translations),i.enclosed_absolute_indices="sequence_post_enclosed"===n.type?n.absolute_indices:[-1,-1],e.passages.push(i)}return null==e.absolute_indices&&(e.passages.length>0&&"sequence"===e.type?e.absolute_indices=[e.passages[0].absolute_indices[0],e.passages[e.passages.length-1].absolute_indices[1]]:e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),[s,t]}sequence_post_enclosed(e,s,t){return this.sequence(e,s,t)}v(e,s,t){let a,r="integer"===e.type?e.value:this.pluck("integer",e.value).value;e.start_context=bcv_utils.shallow_clone(t);const n=null!=t.c?t.c:1,i=this.validate_ref(e.start_context.translations,{b:t.b,c:n,v:r});return[a,r]=Array.from(this.fix_start_zeroes(i,0,r)),e.passages=[{start:{b:t.b,c:n,v:r},end:{b:t.b,c:n,v:r},valid:i}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),t.v=r,[s,t]}range(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t);let[n,i]=Array.from(e.value);if(a=this.handle_obj(n,[],t),[n]=Array.from(a[0]),t=a[1],"v"===i.type&&("bc"===n.type&&!__guard__(__guard__(__guard__(null!=n.passages?n.passages[0]:void 0,(e=>e.valid)),(e=>e.messages)),(e=>e.start_chapter_not_exist_in_single_chapter_book))||"c"===n.type)&&"verse"===this.options.end_range_digits_strategy)return e.value[0]=n,this.range_change_integer_end(e,s);r=this.handle_obj(i,[],t),[i]=Array.from(r[0]),t=r[1],e.value=[n,i],e.indices=[n.indices[0],i.indices[1]],delete e.absolute_indices;const o={b:n.passages[0].start.b,c:n.passages[0].start.c,v:n.passages[0].start.v,type:n.type},l={b:i.passages[0].end.b,c:i.passages[0].end.c,v:i.passages[0].end.v,type:i.type};i.passages[0].valid.messages.start_chapter_is_zero&&(l.c=0),i.passages[0].valid.messages.start_verse_is_zero&&(l.v=0);const u=this.validate_ref(e.start_context.translations,o,l);if(!u.valid)return this.range_handle_invalid(u,e,n,o,i,l,s);{const[t,a]=Array.from(this.range_handle_valid(u,e,n,o,i,l,s));if(t)return a}return null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),e.passages=[{start:o,end:l,valid:u}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),"b"===o.type?"b"===l.type?e.type="b_range":e.type="b_range_start":"b"===l.type&&(e.type="range_end_b"),s.push(e),[s,t]}range_change_end(e,s,t){let a;const[r,n]=Array.from(e.value);return"integer"===n.type?(n.original_value=n.value,n.value=t):"v"===n.type?(a=this.pluck("integer",n.value),a.original_value=a.value,a.value=t):"cv"===n.type&&(a=this.pluck("c",n.value),a.original_value=a.value,a.value=t),this.handle_obj(e,s,e.start_context)}range_change_integer_end(e,s){const[t,a]=Array.from(e.value);return null==e.original_type&&(e.original_type=e.type),null==e.original_value&&(e.original_value=[t,a]),e.type="integer"===t.type?"cv":t.type+"v","integer"===t.type&&(e.value[0]={type:"c",value:[t],indices:t.indices}),"integer"===a.type&&(e.value[1]={type:"v",value:[a],indices:a.indices}),this.handle_obj(e,s,e.start_context)}range_check_new_end(e,s,t,a){let r=0,n=null;if(a.messages.end_chapter_before_start?n="c":a.messages.end_verse_before_start&&(n="v"),null!=n&&(r=this.range_get_new_end_value(s,t,a,n)),r>0){const s={b:t.b,c:t.c,v:t.v};s[n]=r;this.validate_ref(e,s).valid||(r=0)}return r}range_end_b(e,s,t){return this.range(e,s,t)}range_get_new_end_value(e,s,t,a){let r=0;return"c"===a&&t.messages.end_chapter_is_zero||"v"===a&&t.messages.end_verse_is_zero||(e[a]>=10&&s[a]<10&&e[a]-10*Math.floor(e[a]/10)<s[a]?r=s[a]+10*Math.floor(e[a]/10):e[a]>=100&&s[a]<100&&e[a]-100<s[a]&&(r=s[a]+100)),r}range_handle_invalid(e,s,t,a,r,n,i){if(!1===e.valid&&(e.messages.end_chapter_before_start||e.messages.end_verse_before_start)&&("integer"===r.type||"v"===r.type)||!1===e.valid&&e.messages.end_chapter_before_start&&"cv"===r.type){const t=this.range_check_new_end(s.start_context.translations,a,n,e);if(t>0)return this.range_change_end(s,i,t)}if("verse"===this.options.end_range_digits_strategy&&null==a.v&&("integer"===r.type||"v"===r.type)){const e="v"===r.type?this.pluck("integer",r.value):r.value;if(this.validate_ref(s.start_context.translations,{b:a.b,c:a.c,v:e}).valid)return this.range_change_integer_end(s,i)}return null==s.original_type&&(s.original_type=s.type),s.type="sequence",[s.original_value,s.value]=Array.from([[t,r],[[t],[r]]]),this.sequence(s,i,s.start_context)}range_handle_valid(e,s,t,a,r,n,i){if(e.messages.end_chapter_not_exist&&"verse"===this.options.end_range_digits_strategy&&null==a.v&&("integer"===r.type||"v"===r.type)&&this.options.passage_existence_strategy.indexOf("v")>=0){const e="v"===r.type?this.pluck("integer",r.value):r.value;if(this.validate_ref(s.start_context.translations,{b:a.b,c:a.c,v:e}).valid)return[!0,this.range_change_integer_end(s,i)]}return this.range_validate(e,a,n,s),[!1,null]}range_validate(e,s,t,a){return e.messages.end_chapter_not_exist||e.messages.end_chapter_not_exist_in_single_chapter_book?(t.original_c=t.c,t.c=e.messages.end_chapter_not_exist?e.messages.end_chapter_not_exist:e.messages.end_chapter_not_exist_in_single_chapter_book,null!=t.v&&(t.v=this.validate_ref(a.start_context.translations,{b:t.b,c:t.c,v:999}).messages.end_verse_not_exist,delete e.messages.end_verse_is_zero)):e.messages.end_verse_not_exist&&(t.original_v=t.v,t.v=e.messages.end_verse_not_exist),e.messages.end_verse_is_zero&&"allow"!==this.options.zero_verse_strategy&&(t.v=e.messages.end_verse_is_zero),e.messages.end_chapter_is_zero&&(t.c=e.messages.end_chapter_is_zero),[s.c,s.v]=Array.from(this.fix_start_zeroes(e,s.c,s.v)),!0}translation_sequence(e,s,t){e.start_context=bcv_utils.shallow_clone(t);const a=[];for(var r of(a.push({translation:this.books[e.value[0].value].parsed}),Array.from(e.value[1])))null!=(r=this.books[this.pluck("translation",r).value].parsed)&&a.push({translation:r});for(var n of Array.from(a))null!=this.translations.aliases[n.translation]?(n.alias=this.translations.aliases[n.translation].alias,n.osis=this.translations.aliases[n.translation].osis||n.translation.toUpperCase()):(n.alias="default",n.osis=n.translation.toUpperCase());return s.length>0&&(t=this.translation_sequence_apply(s,a)),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),this.reset_context(t,["translations"]),[s,t]}translation_sequence_apply(e,s){let t,a=0;for(let s=e.length-1,t=s,r=s<=0;r?t<=0:t>=0;r?t++:t--)if(null!=e[t].original_type&&(e[t].type=e[t].original_type),null!=e[t].original_value&&(e[t].value=e[t].original_value),"translation_sequence"===e[t].type){a=t+1;break}if(a<e.length){let r;e[a].start_context.translations=s,[r,t]=Array.from(this.handle_array(e.slice(a),[],e[a].start_context))}else t=bcv_utils.shallow_clone(e[e.length-1].start_context);return t}pluck(e,s){for(var t of Array.from(s))if(null!=t&&null!=t.type&&t.type===e)return"c"===e||"v"===e?this.pluck("integer",t.value):t;return null}pluck_last_recursively(e,s){for(let r=s.length-1;r>=0;r--){var t=s[r];if(null!=t&&null!=t.type){if(t.type===e)return this.pluck(e,[t]);var a=this.pluck_last_recursively(e,t.value);if(null!=a)return a}}return null}set_context_from_object(e,s,t){return(()=>{const a=[];for(var r of Array.from(s))null!=t[r]&&a.push(e[r]=t[r]);return a})()}reset_context(e,s){return Array.from(s).map((s=>delete e[s]))}fix_start_zeroes(e,s,t){return e.messages.start_chapter_is_zero&&"upgrade"===this.options.zero_chapter_strategy&&(s=e.messages.start_chapter_is_zero),e.messages.start_verse_is_zero&&"upgrade"===this.options.zero_verse_strategy&&(t=e.messages.start_verse_is_zero),[s,t]}calculate_indices(e,s){let t,a="book";const r=[];let n=0;s=parseInt(s,10);let i=[e];for(var o of["",""]){var l=[];for(t of Array.from(i))l=l.concat(t.split(o));i=l}for(t of Array.from(i)){var u;a="book"===a?"rest":"book";var c=t.length;0!==c&&("book"===a?(t=t.replace(/\/\d+$/,""),u=n+c,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:n,end:u,index:s}),n+=c+2,s=this.books[t].start_index+this.books[t].value.length-n,r.push({start:u+1,end:u+1,index:s})):(u=n+c-1,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:n,end:u,index:s}),n+=c))}return r}get_absolute_indices(...e){const[s,t]=Array.from(e[0]);let a=null,r=null;for(var n of Array.from(this.indices))if(null===a&&n.start<=s&&s<=n.end&&(a=s+n.index),n.start<=t&&t<=n.end){r=t+n.index+1;break}return[a,r]}validate_ref(e,s,t){null!=e&&e.length>0||(e=[{translation:"default",osis:"",alias:"default"}]);let a=!1;const r={};for(var n of Array.from(e))if(null==n.alias&&(n.alias="default"),null!=n.alias){null==this.translations.aliases[n.alias]&&(n.alias="default",null==r.translation_unknown&&(r.translation_unknown=[]),r.translation_unknown.push(n));var[i]=Array.from(this.validate_start_ref(n.alias,s,r));t&&([i]=Array.from(this.validate_end_ref(n.alias,s,t,i,r))),!0===i&&(a=!0)}else null==r.translation_invalid&&(r.translation_invalid=[]),r.translation_invalid.push(n);return{valid:a,messages:r}}validate_start_ref(e,s,t){let a=!0;"default"!==e&&null==(null!=this.translations[e]?this.translations[e].chapters[s.b]:void 0)&&this.promote_book_to_translation(s.b,e);const r=null!=(null!=this.translations[e]?this.translations[e].order:void 0)?e:"default";if(null!=s.v&&(s.v=parseInt(s.v,10)),null!=this.translations[r].order[s.b]){if(null==s.c&&(s.c=1),s.c=parseInt(s.c,10),isNaN(s.c))return a=!1,t.start_chapter_not_numeric=!0,[a,t];0===s.c&&(t.start_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?a=!1:s.c=1),null!=s.v&&0===s.v&&(t.start_verse_is_zero=1,"error"===this.options.zero_verse_strategy?a=!1:"upgrade"===this.options.zero_verse_strategy&&(s.v=1)),s.c>0&&null!=this.translations[e].chapters[s.b][s.c-1]?null!=s.v?isNaN(s.v)?(a=!1,t.start_verse_not_numeric=!0):s.v>this.translations[e].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(a=!1,t.start_verse_not_exist=this.translations[e].chapters[s.b][s.c-1]):1===s.c&&"verse"===this.options.single_chapter_1_strategy&&1===this.translations[e].chapters[s.b].length&&(t.start_chapter_1=1):1!==s.c&&1===this.translations[e].chapters[s.b].length?(a=!1,t.start_chapter_not_exist_in_single_chapter_book=1):s.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(a=!1,t.start_chapter_not_exist=this.translations[e].chapters[s.b].length)}else null==s.b?(a=!1,t.start_book_not_defined=!0):(this.options.passage_existence_strategy.indexOf("b")>=0&&(a=!1),t.start_book_not_exist=!0);return[a,t]}validate_end_ref(e,s,t,a,r){const n=null!=(null!=this.translations[e]?this.translations[e].order:void 0)?e:"default";return null!=t.c&&(t.c=parseInt(t.c,10),isNaN(t.c)?(a=!1,r.end_chapter_not_numeric=!0):0===t.c&&(r.end_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?a=!1:t.c=1)),null!=t.v&&(t.v=parseInt(t.v,10),isNaN(t.v)?(a=!1,r.end_verse_not_numeric=!0):0===t.v&&(r.end_verse_is_zero=1,"error"===this.options.zero_verse_strategy?a=!1:"upgrade"===this.options.zero_verse_strategy&&(t.v=1))),null!=this.translations[n].order[t.b]?(null==t.c&&1===this.translations[e].chapters[t.b].length&&(t.c=1),null!=this.translations[n].order[s.b]&&this.translations[n].order[s.b]>this.translations[n].order[t.b]&&(this.options.passage_existence_strategy.indexOf("b")>=0&&(a=!1),r.end_book_before_start=!0),s.b!==t.b||null==t.c||isNaN(t.c)||(null==s.c&&(s.c=1),!isNaN(parseInt(s.c,10))&&s.c>t.c?(a=!1,r.end_chapter_before_start=!0):s.c!==t.c||null==t.v||isNaN(t.v)||(null==s.v&&(s.v=1),!isNaN(parseInt(s.v,10))&&s.v>t.v&&(a=!1,r.end_verse_before_start=!0))),null==t.c||isNaN(t.c)||null==this.translations[e].chapters[t.b][t.c-1]&&(1===this.translations[e].chapters[t.b].length?r.end_chapter_not_exist_in_single_chapter_book=1:t.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(r.end_chapter_not_exist=this.translations[e].chapters[t.b].length)),null==t.v||isNaN(t.v)||(null==t.c&&(t.c=this.translations[e].chapters[t.b].length),t.v>this.translations[e].chapters[t.b][t.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(r.end_verse_not_exist=this.translations[e].chapters[t.b][t.c-1]))):(a=!1,r.end_book_not_exist=!0),[a,r]}promote_book_to_translation(e,s){if(null==this.translations[s]&&(this.translations[s]={}),null==this.translations[s].chapters&&(this.translations[s].chapters={}),null==this.translations[s].chapters[e])return this.translations[s].chapters[e]=bcv_utils.shallow_clone_array(this.translations.default.chapters[e])}}function __guard__(e,s){return null!=e?s(e):void 0}bcv_passage.initClass();const bcv_utils={shallow_clone(e){if(null==e)return e;const s={};for(const t of Object.keys(e||{})){const a=e[t];s[t]=a}return s},shallow_clone_array(e){if(null==e)return e;const s=[];for(let t=0,a=e.length,r=0<=a;r?t<=a:t>=a;r?t++:t--)void 0!==e[t]&&(s[t]=e[t]);return s}};bcv_parser.prototype.regexps.translations=RegExp("(?:(?:ERV))\\b","gi"),bcv_parser.prototype.translations={aliases:{default:{osis:"",alias:"default"}},alternates:{},default:{order:{Gen:1,Exod:2,Lev:3,Num:4,Deut:5,Josh:6,Judg:7,Ruth:8,"1Sam":9,"2Sam":10,"1Kgs":11,"2Kgs":12,"1Chr":13,"2Chr":14,Ezra:15,Neh:16,Esth:17,Job:18,Ps:19,Prov:20,Eccl:21,Song:22,Isa:23,Jer:24,Lam:25,Ezek:26,Dan:27,Hos:28,Joel:29,Amos:30,Obad:31,Jonah:32,Mic:33,Nah:34,Hab:35,Zeph:36,Hag:37,Zech:38,Mal:39,Matt:40,Mark:41,Luke:42,John:43,Acts:44,Rom:45,"1Cor":46,"2Cor":47,Gal:48,Eph:49,Phil:50,Col:51,"1Thess":52,"2Thess":53,"1Tim":54,"2Tim":55,Titus:56,Phlm:57,Heb:58,Jas:59,"1Pet":60,"2Pet":61,"1John":62,"2John":63,"3John":64,Jude:65,Rev:66,Tob:67,Jdt:68,GkEsth:69,Wis:70,Sir:71,Bar:72,PrAzar:73,Sus:74,Bel:75,SgThree:76,EpJer:77,"1Macc":78,"2Macc":79,"3Macc":80,"4Macc":81,"1Esd":82,"2Esd":83,PrMan:84},chapters:{Gen:[31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,55,32,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,33,26],Exod:[22,25,22,31,23,30,25,32,35,29,10,51,22,31,27,36,16,27,25,26,36,31,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,38],Lev:[17,16,17,35,19,30,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,46,34],Num:[54,34,51,49,31,27,89,26,23,36,35,16,33,45,41,50,13,32,22,29,35,41,30,25,18,65,23,31,40,16,54,42,56,29,34,13],Deut:[46,37,29,49,33,25,26,20,29,22,32,32,18,29,23,22,20,22,21,20,23,30,25,22,19,19,26,68,29,20,30,52,29,12],Josh:[18,24,17,24,15,27,26,35,27,43,23,24,33,15,63,10,18,28,51,9,45,34,16,33],Judg:[36,23,31,24,31,40,25,35,57,18,40,15,25,20,20,31,13,31,30,48,25],Ruth:[22,23,18,22],"1Sam":[28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,42,15,23,29,22,44,25,12,25,11,31,13],"2Sam":[27,32,39,12,25,23,29,18,13,19,27,31,39,33,37,23,29,33,43,26,22,51,39,25],"1Kgs":[53,46,28,34,18,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,53],"2Kgs":[18,25,27,44,27,33,20,29,37,36,21,21,25,29,38,20,41,37,37,21,26,20,37,20,30],"1Chr":[54,55,24,43,26,81,40,40,44,14,47,40,14,17,29,43,27,17,19,8,30,19,32,31,31,32,34,21,30],"2Chr":[17,18,17,22,14,42,22,18,31,19,23,16,22,15,19,14,19,34,11,37,20,12,21,27,28,23,9,27,36,27,21,33,25,33,27,23],Ezra:[11,70,13,24,17,22,28,36,15,44],Neh:[11,20,32,23,19,19,73,18,38,39,36,47,31],Esth:[22,23,15,17,14,14,10,17,32,3],Job:[22,13,26,21,27,30,21,22,35,22,20,25,28,22,35,22,16,21,29,29,34,30,17,25,6,14,23,28,25,31,40,22,33,37,16,33,24,41,30,24,34,17],Ps:[6,12,8,8,12,10,17,9,20,18,7,8,6,7,5,11,15,50,14,9,13,31,6,10,22,12,14,9,11,12,24,11,22,22,28,12,40,22,13,17,13,11,5,26,17,11,9,14,20,23,19,9,6,7,23,13,11,11,17,12,8,12,11,10,13,20,7,35,36,5,24,20,28,23,10,12,20,72,13,19,16,8,18,12,13,17,7,18,52,17,16,15,5,23,11,13,12,9,9,5,8,28,22,35,45,48,43,13,31,7,10,10,9,8,18,19,2,29,176,7,8,9,4,8,5,6,5,6,8,8,3,18,3,3,21,26,9,8,24,13,10,7,12,15,21,10,20,14,9,6],Prov:[33,22,35,27,23,35,27,36,18,32,31,28,25,35,33,33,28,24,29,30,31,29,35,34,28,28,27,28,27,33,31],Eccl:[18,26,22,16,20,12,29,17,18,20,10,14],Song:[17,17,11,16,16,13,13,14],Isa:[31,22,26,6,30,13,25,22,21,34,16,6,22,32,9,14,14,7,25,6,17,25,18,23,12,21,13,29,24,33,9,20,24,17,10,22,38,22,8,31,29,25,28,28,25,13,15,22,26,11,23,15,12,17,13,12,21,14,21,22,11,12,19,12,25,24],Jer:[19,37,25,31,31,30,34,22,26,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,21,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34],Lam:[22,22,66,22,22],Ezek:[28,10,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,49,32,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35],Dan:[21,49,30,37,31,28,28,27,27,21,45,13],Hos:[11,23,5,19,15,11,16,14,17,15,12,14,16,9],Joel:[20,32,21],Amos:[15,16,15,13,27,14,17,14,15],Obad:[21],Jonah:[17,10,10,11],Mic:[16,13,12,13,15,16,20],Nah:[15,13,19],Hab:[17,20,19],Zeph:[18,15,20],Hag:[15,23],Zech:[21,13,10,14,11,15,14,23,17,12,17,14,9,21],Mal:[14,17,18,6],Matt:[25,23,17,25,48,34,29,34,38,42,30,50,58,36,39,28,27,35,30,34,46,46,39,51,46,75,66,20],Mark:[45,28,35,41,43,56,37,38,50,52,33,44,37,72,47,20],Luke:[80,52,38,44,39,49,50,56,62,42,54,59,35,35,32,31,37,43,48,47,38,71,56,53],John:[51,25,36,54,47,71,53,59,41,42,57,50,38,31,27,33,26,40,42,31,25],Acts:[26,47,26,37,42,15,60,40,43,48,30,25,52,28,41,40,34,28,41,38,40,30,35,27,27,32,44,31],Rom:[32,29,31,25,21,23,25,39,33,21,36,21,14,23,33,27],"1Cor":[31,16,23,21,13,20,40,13,27,33,34,31,13,40,58,24],"2Cor":[24,17,18,18,21,18,16,24,15,18,33,21,14],Gal:[24,21,29,31,26,18],Eph:[23,22,21,32,33,24],Phil:[30,30,21,23],Col:[29,23,25,18],"1Thess":[10,20,13,18,28],"2Thess":[12,17,18],"1Tim":[20,15,16,16,25,21],"2Tim":[18,26,17,22],Titus:[16,15,15],Phlm:[25],Heb:[14,18,19,16,14,20,28,13,28,39,40,29,25],Jas:[27,26,18,17,20],"1Pet":[25,25,22,19,14],"2Pet":[21,22,18],"1John":[10,29,24,21,21],"2John":[13],"3John":[15],Jude:[25],Rev:[20,29,22,11,14,17,17,13,21,11,19,17,18,20,8,21,18,24,21,15,27,21],Tob:[22,14,17,21,22,18,16,21,6,13,18,22,17,15],Jdt:[16,28,10,15,24,21,32,36,14,23,23,20,20,19,14,25],GkEsth:[22,23,15,17,14,14,10,17,32,13,12,6,18,19,16,24],Wis:[16,24,19,20,23,25,30,21,18,21,26,27,19,31,19,29,21,25,22],Sir:[30,18,31,31,15,37,36,19,18,31,34,18,26,27,20,30,32,33,30,31,28,27,27,34,26,29,30,26,28,25,31,24,33,31,26,31,31,34,35,30,22,25,33,23,26,20,25,25,16,29,30],Bar:[22,35,37,37,9],PrAzar:[68],Sus:[64],Bel:[42],SgThree:[39],EpJer:[73],"1Macc":[64,70,60,61,68,63,50,32,73,89,74,53,53,49,41,24],"2Macc":[36,32,40,50,27,31,42,36,29,38,38,45,26,46,39],"3Macc":[29,33,30,21,51,41,23],"4Macc":[35,24,21,26,38,35,23,29,32,21,27,19,27,20,32,25,24,24],"1Esd":[58,30,24,63,73,34,15,96,55],"2Esd":[40,48,36,52,56,59,70,63,47,59,46,51,58,48,63,78],PrMan:[15],Ps151:[7]}},vulgate:{chapters:{Gen:[31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,55,32,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,32,25],Exod:[22,25,22,31,23,30,25,32,35,29,10,51,22,31,27,36,16,27,25,26,36,31,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,36],Lev:[17,16,17,35,19,30,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,45,34],Num:[54,34,51,49,31,27,89,26,23,36,34,15,34,45,41,50,13,32,22,30,35,41,30,25,18,65,23,31,39,17,54,42,56,29,34,13],Josh:[18,24,17,25,16,27,26,35,27,44,23,24,33,15,63,10,18,28,51,9,43,34,16,33],Judg:[36,23,31,24,32,40,25,35,57,18,40,15,25,20,20,31,13,31,30,48,24],"1Sam":[28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,43,15,23,28,23,44,25,12,25,11,31,13],"1Kgs":[53,46,28,34,18,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,54],"1Chr":[54,55,24,43,26,81,40,40,44,14,46,40,14,17,29,43,27,17,19,7,30,19,32,31,31,32,34,21,30],Neh:[11,20,31,23,19,19,73,18,38,39,36,46,31],Job:[22,13,26,21,27,30,21,22,35,22,20,25,28,22,35,23,16,21,29,29,34,30,17,25,6,14,23,28,25,31,40,22,33,37,16,33,24,41,35,28,25,16],Ps:[6,13,9,10,13,11,18,10,39,8,9,6,7,5,10,15,51,15,10,14,32,6,10,22,12,14,9,11,13,25,11,22,23,28,13,40,23,14,18,14,12,5,26,18,12,10,15,21,23,21,11,7,9,24,13,12,12,18,14,9,13,12,11,14,20,8,36,37,6,24,20,28,23,11,13,21,72,13,20,17,8,19,13,14,17,7,19,53,17,16,16,5,23,11,13,12,9,9,5,8,29,22,35,45,48,43,14,31,7,10,10,9,26,9,10,2,29,176,7,8,9,4,8,5,6,5,6,8,8,3,18,3,3,21,26,9,8,24,14,10,8,12,15,21,10,11,9,14,9,6],Eccl:[18,26,22,17,19,11,30,17,18,20,10,14],Song:[16,17,11,16,17,12,13,14],Jer:[19,37,25,31,31,30,34,22,26,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,20,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34],Ezek:[28,9,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,49,32,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35],Dan:[21,49,100,34,31,28,28,27,27,21,45,13,65,42],Hos:[11,24,5,19,15,11,16,14,17,15,12,14,15,10],Amos:[15,16,15,13,27,15,17,14,14],Jonah:[16,11,10,11],Mic:[16,13,12,13,14,16,20],Hag:[14,24],Matt:[25,23,17,25,48,34,29,34,38,42,30,50,58,36,39,28,26,35,30,34,46,46,39,51,46,75,66,20],Mark:[45,28,35,40,43,56,37,39,49,52,33,44,37,72,47,20],John:[51,25,36,54,47,72,53,59,41,42,57,50,38,31,27,33,26,40,42,31,25],Acts:[26,47,26,37,42,15,59,40,43,48,30,25,52,27,41,40,34,28,40,38,40,30,35,27,27,32,44,31],"2Cor":[24,17,18,18,21,18,16,24,15,18,33,21,13],Rev:[20,29,22,11,14,17,17,13,21,11,19,18,18,20,8,21,18,24,21,15,27,21],Tob:[25,23,25,23,28,22,20,24,12,13,21,22,23,17],Jdt:[12,18,15,17,29,21,25,34,19,20,21,20,31,18,15,31],Wis:[16,25,19,20,24,27,30,21,19,21,27,27,19,31,19,29,20,25,20],Sir:[40,23,34,36,18,37,40,22,25,34,36,19,32,27,22,31,31,33,28,33,31,33,38,47,36,28,33,30,35,27,42,28,33,31,26,28,34,39,41,32,28,26,37,27,31,23,31,28,19,31,38,13],Bar:[22,35,38,37,9,72],"1Macc":[67,70,60,61,68,63,50,32,73,89,74,54,54,49,41,24],"2Macc":[36,33,40,50,27,31,42,36,29,38,38,46,26,46,40]}},ceb:{chapters:{"2Cor":[24,17,18,18,21,18,16,24,15,18,33,21,13],Rev:[20,29,22,11,14,17,17,13,21,11,19,18,18,20,8,21,18,24,21,15,27,21],Tob:[22,14,17,21,22,18,16,21,6,13,18,22,18,15],PrAzar:[67],EpJer:[72],"1Esd":[55,26,24,63,71,33,15,92,55]}},kjv:{chapters:{"3John":[14]}},nab:{order:{Gen:1,Exod:2,Lev:3,Num:4,Deut:5,Josh:6,Judg:7,Ruth:8,"1Sam":9,"2Sam":10,"1Kgs":11,"2Kgs":12,"1Chr":13,"2Chr":14,PrMan:15,Ezra:16,Neh:17,"1Esd":18,"2Esd":19,Tob:20,Jdt:21,Esth:22,GkEsth:23,"1Macc":24,"2Macc":25,"3Macc":26,"4Macc":27,Job:28,Ps:29,Prov:30,Eccl:31,Song:32,Wis:33,Sir:34,Isa:35,Jer:36,Lam:37,Bar:38,EpJer:39,Ezek:40,Dan:41,PrAzar:42,Sus:43,Bel:44,SgThree:45,Hos:46,Joel:47,Amos:48,Obad:49,Jonah:50,Mic:51,Nah:52,Hab:53,Zeph:54,Hag:55,Zech:56,Mal:57,Matt:58,Mark:59,Luke:60,John:61,Acts:62,Rom:63,"1Cor":64,"2Cor":65,Gal:66,Eph:67,Phil:68,Col:69,"1Thess":70,"2Thess":71,"1Tim":72,"2Tim":73,Titus:74,Phlm:75,Heb:76,Jas:77,"1Pet":78,"2Pet":79,"1John":80,"2John":81,"3John":82,Jude:83,Rev:84},chapters:{Gen:[31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,54,33,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,33,26],Exod:[22,25,22,31,23,30,29,28,35,29,10,51,22,31,27,36,16,27,25,26,37,30,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,38],Lev:[17,16,17,35,26,23,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,46,34],Num:[54,34,51,49,31,27,89,26,23,36,35,16,33,45,41,35,28,32,22,29,35,41,30,25,19,65,23,31,39,17,54,42,56,29,34,13],Deut:[46,37,29,49,33,25,26,20,29,22,32,31,19,29,23,22,20,22,21,20,23,29,26,22,19,19,26,69,28,20,30,52,29,12],"1Sam":[28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,42,16,23,28,23,44,25,12,25,11,31,13],"2Sam":[27,32,39,12,25,23,29,18,13,19,27,31,39,33,37,23,29,32,44,26,22,51,39,25],"1Kgs":[53,46,28,20,32,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,54],"2Kgs":[18,25,27,44,27,33,20,29,37,36,20,22,25,29,38,20,41,37,37,21,26,20,37,20,30],"1Chr":[54,55,24,43,41,66,40,40,44,14,47,41,14,17,29,43,27,17,19,8,30,19,32,31,31,32,34,21,30],"2Chr":[18,17,17,22,14,42,22,18,31,19,23,16,23,14,19,14,19,34,11,37,20,12,21,27,28,23,9,27,36,27,21,33,25,33,27,23],Neh:[11,20,38,17,19,19,72,18,37,40,36,47,31],Job:[22,13,26,21,27,30,21,22,35,22,20,25,28,22,35,22,16,21,29,29,34,30,17,25,6,14,23,28,25,31,40,22,33,37,16,33,24,41,30,32,26,17],Ps:[6,11,9,9,13,11,18,10,21,18,7,9,6,7,5,11,15,51,15,10,14,32,6,10,22,12,14,9,11,13,25,11,22,23,28,13,40,23,14,18,14,12,5,27,18,12,10,15,21,23,21,11,7,9,24,14,12,12,18,14,9,13,12,11,14,20,8,36,37,6,24,20,28,23,11,13,21,72,13,20,17,8,19,13,14,17,7,19,53,17,16,16,5,23,11,13,12,9,9,5,8,29,22,35,45,48,43,14,31,7,10,10,9,8,18,19,2,29,176,7,8,9,4,8,5,6,5,6,8,8,3,18,3,3,21,26,9,8,24,14,10,8,12,15,21,10,20,14,9,6],Eccl:[18,26,22,17,19,12,29,17,18,20,10,14],Song:[17,17,11,16,16,12,14,14],Isa:[31,22,26,6,30,13,25,23,20,34,16,6,22,32,9,14,14,7,25,6,17,25,18,23,12,21,13,29,24,33,9,20,24,17,10,22,38,22,8,31,29,25,28,28,25,13,15,22,26,11,23,15,12,17,13,12,21,14,21,22,11,12,19,11,25,24],Jer:[19,37,25,31,31,30,34,23,25,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,21,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34],Ezek:[28,10,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,44,37,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35],Dan:[21,49,100,34,30,29,28,27,27,21,45,13,64,42],Hos:[9,25,5,19,15,11,16,14,17,15,11,15,15,10],Joel:[20,27,5,21],Jonah:[16,11,10,11],Mic:[16,13,12,14,14,16,20],Nah:[14,14,19],Zech:[17,17,10,14,11,15,14,23,17,12,17,14,9,21],Mal:[14,17,24],Acts:[26,47,26,37,42,15,60,40,43,49,30,25,52,28,41,40,34,28,40,38,40,30,35,27,27,32,44,31],"2Cor":[24,17,18,18,21,18,16,24,15,18,33,21,13],Rev:[20,29,22,11,14,17,17,13,21,11,19,18,18,20,8,21,18,24,21,15,27,21],Tob:[22,14,17,21,22,18,17,21,6,13,18,22,18,15],Sir:[30,18,31,31,15,37,36,19,18,31,34,18,26,27,20,30,32,33,30,31,28,27,27,33,26,29,30,26,28,25,31,24,33,31,26,31,31,34,35,30,22,25,33,23,26,20,25,25,16,29,30],Bar:[22,35,38,37,9,72],"2Macc":[36,32,40,50,27,31,42,36,29,38,38,46,26,46,39]}},nlt:{chapters:{Rev:[20,29,22,11,14,17,17,13,21,11,19,18,18,20,8,21,18,24,21,15,27,21]}},nrsv:{chapters:{"2Cor":[24,17,18,18,21,18,16,24,15,18,33,21,13],Rev:[20,29,22,11,14,17,17,13,21,11,19,18,18,20,8,21,18,24,21,15,27,21]}}},bcv_parser.prototype.languages=["sr"];const heregex=e=>{let s="",t=!1,a=!1;for(let r=0;r<e.length;r++){const n=e[r];if(a)s+=n,a=!1;else if("\\"!==n)if(t||"["!==n)if(t&&"]"===n)t=!1,s+=n;else if(t||"#"!==n)!t&&/\s/.test(n)||(s+=n);else for(;r<e.length&&"\n"!==e[r];)r+=1;else t=!0,s+=n;else s+=n,a=!0}return s};var grammar;bcv_parser.prototype.regexps.space="[\\s\\xa0]",bcv_parser.prototype.regexps.escaped_passage=RegExp(heregex(String.raw`
|
|
1
|
+
const root=this;class bcv_parser{static initClass(){this.prototype.s="",this.prototype.entities=[],this.prototype.passage=null,this.prototype.regexps={},this.prototype.options={consecutive_combination_strategy:"combine",osis_compaction_strategy:"b",book_sequence_strategy:"ignore",invalid_sequence_strategy:"ignore",sequence_combination_strategy:"combine",punctuation_strategy:"us",invalid_passage_strategy:"ignore",non_latin_digits_strategy:"ignore",passage_existence_strategy:"bcv",zero_chapter_strategy:"error",zero_verse_strategy:"error",single_chapter_1_strategy:"chapter",book_alone_strategy:"ignore",book_range_strategy:"ignore",captive_end_digits_strategy:"delete",end_range_digits_strategy:"verse",include_apocrypha:!1,ps151_strategy:"c",versification_system:"default",case_sensitive:"none"}}constructor(){for(var e of(this.options={},Object.keys(bcv_parser.prototype.options||{}))){var s=bcv_parser.prototype.options[e];this.options[e]=s}this.versification_system(this.options.versification_system)}parse(e){return this.reset(),this.s=e,e=this.replace_control_characters(e),[e,this.passage.books]=Array.from(this.match_books(e)),[this.entities]=Array.from(this.match_passages(e)),this}parse_with_context(e,s){let t;return this.reset(),[s,this.passage.books]=Array.from(this.match_books(this.replace_control_characters(s))),[t,s]=Array.from(this.match_passages(s)),this.reset(),this.s=e,e=this.replace_control_characters(e),[e,this.passage.books]=Array.from(this.match_books(e)),this.passage.books.push({value:"",parsed:[],start_index:0,type:"context",context:s}),e=""+(this.passage.books.length-1)+"/9"+e,[this.entities]=Array.from(this.match_passages(e)),this}reset(){return this.s="",this.entities=[],this.passage?(this.passage.books=[],this.passage.indices={}):(this.passage=new bcv_passage,this.passage.options=this.options,this.passage.translations=this.translations)}set_options(e){for(var s of Object.keys(e||{})){var t=e[s];"include_apocrypha"===s||"versification_system"===s||"case_sensitive"===s?this[s](t):this.options[s]=t}return this}include_apocrypha(e){if(null==e||!0!==e&&!1!==e)return this;for(var s of(this.options.include_apocrypha=e,this.regexps.books=this.regexps.get_books(e,this.options.case_sensitive),Object.keys(this.translations||{}))){var t;if("aliases"!==s&&"alternates"!==s)if(null==this.translations[s].chapters&&(this.translations[s].chapters={}),null==this.translations[s].chapters.Ps&&(this.translations[s].chapters.Ps=bcv_utils.shallow_clone_array(this.translations.default.chapters.Ps)),!0===e)t=null!=this.translations[s].chapters.Ps151?this.translations[s].chapters.Ps151[0]:this.translations.default.chapters.Ps151[0],this.translations[s].chapters.Ps[150]=t;else 151===this.translations[s].chapters.Ps.length&&this.translations[s].chapters.Ps.pop()}return this}versification_system(e){let s,t;if(null==e||null==this.translations[e])return this;if(null!=this.translations.alternates.default)if("default"===e)for(s of(null!=this.translations.alternates.default.order&&(this.translations.default.order=bcv_utils.shallow_clone(this.translations.alternates.default.order)),Object.keys(this.translations.alternates.default.chapters||{})))t=this.translations.alternates.default.chapters[s],this.translations.default.chapters[s]=bcv_utils.shallow_clone_array(t);else this.versification_system("default");if(null==this.translations.alternates.default&&(this.translations.alternates.default={order:null,chapters:{}}),"default"!==e&&null!=this.translations[e].order&&(null==this.translations.alternates.default.order&&(this.translations.alternates.default.order=bcv_utils.shallow_clone(this.translations.default.order)),this.translations.default.order=bcv_utils.shallow_clone(this.translations[e].order)),"default"!==e&&null!=this.translations[e].chapters)for(s of Object.keys(this.translations[e].chapters||{}))t=this.translations[e].chapters[s],null==this.translations.alternates.default.chapters[s]&&(this.translations.alternates.default.chapters[s]=bcv_utils.shallow_clone_array(this.translations.default.chapters[s])),this.translations.default.chapters[s]=bcv_utils.shallow_clone_array(t);return this.options.versification_system=e,this.include_apocrypha(this.options.include_apocrypha),this}case_sensitive(e){return null==e||"none"!==e&&"books"!==e||e===this.options.case_sensitive||(this.options.case_sensitive=e,this.regexps.books=this.regexps.get_books(this.options.include_apocrypha,e)),this}translation_info(e){let s;null==e&&(e="default"),null!=e&&null!=(null!=this.translations.aliases[e]?this.translations.aliases[e].alias:void 0)&&(e=this.translations.aliases[e].alias),null!=e&&null!=this.translations[e]||(e="default");const t=this.options.versification_system;e!==t&&this.versification_system(e);const a={alias:e,books:[],chapters:{},order:bcv_utils.shallow_clone(this.translations.default.order)};for(s of Object.keys(this.translations.default.chapters||{})){var r=this.translations.default.chapters[s];a.chapters[s]=bcv_utils.shallow_clone_array(r)}for(s of Object.keys(a.order||{})){var n=a.order[s];a.books[n-1]=s}return e!==t&&this.versification_system(t),a}replace_control_characters(e){return e=(e=(e=e.replace(this.regexps.control," ")).replace(/\uFF1A/g,":")).replace(/\uFF1B/g,";"),"replace"===this.options.non_latin_digits_strategy&&(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/[٠۰߀०০੦૦୦0౦೦൦๐໐༠၀႐០᠐᥆᧐᪀᪐᭐᮰᱀᱐꘠꣐꤀꧐꩐꯰0]/g,"0")).replace(/[١۱߁१১੧૧୧௧౧೧൧๑໑༡၁႑១᠑᥇᧑᪁᪑᭑᮱᱁᱑꘡꣑꤁꧑꩑꯱1]/g,"1")).replace(/[٢۲߂२২੨૨୨௨౨೨൨๒໒༢၂႒២᠒᥈᧒᪂᪒᭒᮲᱂᱒꘢꣒꤂꧒꩒꯲2]/g,"2")).replace(/[٣۳߃३৩੩૩୩௩౩೩൩๓໓༣၃႓៣᠓᥉᧓᪃᪓᭓᮳᱃᱓꘣꣓꤃꧓꩓꯳3]/g,"3")).replace(/[٤۴߄४৪੪૪୪௪౪೪൪๔໔༤၄႔៤᠔᥊᧔᪄᪔᭔᮴᱄᱔꘤꣔꤄꧔꩔꯴4]/g,"4")).replace(/[٥۵߅५৫੫૫୫௫౫೫൫๕໕༥၅႕៥᠕᥋᧕᪅᪕᭕᮵᱅᱕꘥꣕꤅꧕꩕꯵5]/g,"5")).replace(/[٦۶߆६৬੬૬୬௬౬೬൬๖໖༦၆႖៦᠖᥌᧖᪆᪖᭖᮶᱆᱖꘦꣖꤆꧖꩖꯶6]/g,"6")).replace(/[٧۷߇७৭੭૭୭௭౭೭൭๗໗༧၇႗៧᠗᥍᧗᪇᪗᭗᮷᱇᱗꘧꣗꤇꧗꩗꯷7]/g,"7")).replace(/[٨۸߈८৮੮૮୮௮౮೮൮๘໘༨၈႘៨᠘᥎᧘᪈᪘᭘᮸᱈᱘꘨꣘꤈꧘꩘꯸8]/g,"8")).replace(/[٩۹߉९৯੯૯୯௯౯೯൯๙໙༩၉႙៩᠙᥏᧙᪉᪙᭙᮹᱉᱙꘩꣙꤉꧙꩙꯹9]/g,"9")),e}match_books(e){const s=[];for(var t of Array.from(this.regexps.books)){var a=!1;if(e=e.replace(t.regexp,(function(e,r,n){a=!0,s.push({value:n,parsed:t.osis,type:"book"});const i=null!=t.extra?`/${t.extra}`:"";return`${r}${s.length-1}${i}`})),!0===a&&/^[\s\x1f\d:.,;\-\u2013\u2014]+$/.test(e))break}return[e=e.replace(this.regexps.translations,(function(e){return s.push({value:e,parsed:e.toLowerCase(),type:"translation"}),`${s.length-1}`})),this.get_book_indices(s,e)]}get_book_indices(e,s){let t,a=0;const r=new RegExp("([\\x1f\\x1e])(\\d+)(?:/\\d+)?\\1","g");for(;t=r.exec(s);)e[t[2]].start_index=t.index+a,a+=e[t[2]].value.length-t[0].length;return e}match_passages(e){let s,t=[],a={};for(;s=this.regexps.escaped_passage.exec(e);){let g;var[r,n,i]=Array.from(s),o=n.length;if(s.index+=r.length-o,/\s[2-9]\d\d\s*$|\s\d{4,}\s*$/.test(n)&&(n=n.replace(/\s+\d+\s*$/,"")),/[\d\x1f\x1e)]$/.test(n)||(n=this.replace_match_end(n)),"delete"===this.options.captive_end_digits_strategy){var l=s.index+n.length;e.length>l&&/^\w/.test(e.substr(l,1))&&(n=n.replace(/[\s*]+\d+$/,"")),n=n.replace(/(\x1e[)\]]?)[\s*]*\d+$/,"$1")}var u=""===(n=n.replace(/[A-Z]+/g,(e=>e.toLowerCase()))).substr(0,1)?0:n.split("")[0].length,c={value:grammar.parse(n,{punctuation_strategy:this.options.punctuation_strategy}),type:"base",start_index:this.passage.books[i].start_index-u,match:n};"full"===this.options.book_alone_strategy&&"include"===this.options.book_range_strategy&&"b"===c.value[0].type&&(1===c.value.length||c.value.length>1&&"translation_sequence"===c.value[1].type)&&0===u&&(1===this.passage.books[i].parsed.length||this.passage.books[i].parsed.length>1&&"translation"===this.passage.books[i].parsed[1].type)&&/^[234]/.test(this.passage.books[i].parsed[0])&&this.create_book_range(e,c,i),[g,a]=Array.from(this.passage.handle_obj(c)),t=t.concat(g);var p=this.adjust_regexp_end(g,o,n.length);p>0&&(this.regexps.escaped_passage.lastIndex-=p)}return[t,a]}adjust_regexp_end(e,s,t){let a=0;return e.length>0?a=s-e[e.length-1].indices[1]-1:s!==t&&(a=s-t),a}replace_match_end(e){let s,t=e.length;for(;s=this.regexps.match_end_split.exec(e);)t=s.index+s[0].length;return t<e.length&&(e=e.substr(0,t)),e}create_book_range(e,s,t){const a=[bcv_parser.prototype.regexps.first,bcv_parser.prototype.regexps.second,bcv_parser.prototype.regexps.third],r=parseInt(this.passage.books[t].parsed[0].substr(0,1),10);for(let o=1,l=r,u=1<=l;u?o<l:o>l;u?o++:o--){var n=o===r-1?bcv_parser.prototype.regexps.range_and:bcv_parser.prototype.regexps.range_only,i=e.match(new RegExp(`(?:^|\\W)(${a[o-1]}\\s*${n}\\s*)\\x1f${t}\\x1f`,"i"));if(null!=i)return this.add_book_range_object(s,i,o)}return!1}add_book_range_object(e,s,t){const{length:a}=s[1];if(e.value[0]={type:"b_range_pre",value:[{type:"b_pre",value:t.toString(),indices:[s.index,s.index+a]},e.value[0]],indices:[0,e.value[0].indices[1]+a]},e.value[0].value[1].indices[0]+=a,e.value[0].value[1].indices[1]+=a,e.start_index-=a,e.match=s[1]+e.match,1!==e.value.length)return(()=>{const s=[];for(let t=1,r=e.value.length,n=1<=r;n?t<r:t>r;n?t++:t--)null!=e.value[t].value&&(null!=(null!=e.value[t].value[0]?e.value[t].value[0].indices:void 0)&&(e.value[t].value[0].indices[0]+=a,e.value[t].value[0].indices[1]+=a),e.value[t].indices[0]+=a,s.push(e.value[t].indices[1]+=a));return s})()}osis(){const e=[];for(var s of Array.from(this.parsed_entities()))s.osis.length>0&&e.push(s.osis);return e.join(",")}osis_and_translations(){const e=[];for(var s of Array.from(this.parsed_entities()))s.osis.length>0&&e.push([s.osis,s.translations.join(",")]);return e}osis_and_indices(){const e=[];for(var s of Array.from(this.parsed_entities()))if(s.osis.length>0){const t={osis:s.osis,translations:s.translations,indices:s.indices};null!=s.osises&&(t.osises=s.osises),e.push(t)}return e}parsed_entities(){let e=[];for(let d=0,v=this.entities.length,b=0<=v;b?d<v:d>v;b?d++:d--){var s=this.entities[d];if(s.type&&"translation_sequence"===s.type&&e.length>0&&d===e[e.length-1].entity_id+1&&(e[e.length-1].indices[1]=s.absolute_indices[1]),null!=s.passages&&!("b"===s.type&&"ignore"===this.options.book_alone_strategy||"b_range"===s.type&&"ignore"===this.options.book_range_strategy||"context"===s.type)){var t=[],a=null;if(null!=s.passages[0].translations)for(var r of Array.from(s.passages[0].translations)){var n=(null!=r.osis?r.osis.length:void 0)>0?r.osis:"";null==a&&(a=r.alias),t.push(n)}else t=[""],a="default";for(var i=[],o=[],{length:l}=s.passages,u=0,c=u,p=l,g=0<=p;g?u<p:u>p;g?u++:u--,c=u){var _=s.passages[c];if(null==_.type&&(_.type=s.type),!1!==_.valid.valid||("ignore"===this.options.invalid_sequence_strategy&&"sequence"===s.type&&this.snap_sequence("ignore",s,i,c,l),"ignore"!==this.options.invalid_passage_strategy))if("b"!==_.type&&"b_range"!==_.type||"ignore"!==this.options.book_sequence_strategy||"sequence"!==s.type)if("b_range_start"!==_.type&&"range_end_b"!==_.type||"ignore"!==this.options.book_range_strategy||this.snap_range(s,c),null==_.absolute_indices&&(_.absolute_indices=s.absolute_indices),"separate-chapters"===this.options.consecutive_combination_strategy&&_.start.c!==_.end.c){const e=this.get_osises_by_chapter({osis:"",start:_.start,end:_.end},a);i.push({osis:_.valid.valid?this.to_osis(_.start,_.end,a):"",osises:e,type:_.type,indices:_.absolute_indices,translations:t,start:_.start,end:_.end,enclosed_indices:_.enclosed_absolute_indices,entity_id:d,entities:[_]})}else i.push({osis:_.valid.valid?this.to_osis(_.start,_.end,a):"",type:_.type,indices:_.absolute_indices,translations:t,start:_.start,end:_.end,enclosed_indices:_.enclosed_absolute_indices,entity_id:d,entities:[_]});else this.snap_sequence("book",s,i,c,l)}if(0!==i.length||0!==o.length){if("combine"!==this.options.consecutive_combination_strategy&&"separate-chapters"!==this.options.consecutive_combination_strategy||(i.length>1&&(i=this.combine_consecutive_passages(i,a)),i=i.concat(o).sort(((e,s)=>e.indices[0]-s.indices[0]))),"separate-chapters"===this.options.consecutive_combination_strategy)for(x of Array.from(i)){if(0===x.osis.length)continue;const e=this.get_osises_by_chapter(x,a);e.length>1&&(x.osises=e)}if("separate"===this.options.sequence_combination_strategy)e=e.concat(i);else{var x,h=[],f=i.length-1;for(x of(null!=i[f].enclosed_indices&&i[f].enclosed_indices[1]>=0&&(s.absolute_indices[1]=i[f].enclosed_indices[1]),Array.from(i)))x.osis.length>0&&h.push(x.osis);let r=[];if("separate-chapters"===this.options.consecutive_combination_strategy)for(x of Array.from(i))0!==x.osis.length&&(r=null!=x.osises?r.concat(x.osises):r.concat(this.get_osises_by_chapter(x,a)));const n={osis:h.join(","),indices:s.absolute_indices,translations:t,entity_id:d,entities:i};r.length>0&&(n.osises=r),e.push(n)}}}}return e}to_osis(e,s,t){let a;null==s.c&&null==s.v&&e.b===s.b&&null==e.c&&null==e.v&&"first_chapter"===this.options.book_alone_strategy&&(s.c=1);const r={start:"",end:""};return null==e.c&&(e.c=1),null==e.v&&(e.v=1),null==s.c&&(this.options.passage_existence_strategy.indexOf("c")>=0||null!=this.passage.translations[t].chapters[s.b]&&1===this.passage.translations[t].chapters[s.b].length?s.c=this.passage.translations[t].chapters[s.b].length:s.c=999),null==s.v&&(null!=this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0?s.v=this.passage.translations[t].chapters[s.b][s.c-1]:s.v=999),this.options.include_apocrypha&&"b"===this.options.ps151_strategy&&(151===e.c&&"Ps"===e.b||151===s.c&&"Ps"===s.b)&&this.fix_ps151(e,s,t),"b"===this.options.osis_compaction_strategy&&1===e.c&&1===e.v&&(999===s.c&&999===s.v||s.c===this.passage.translations[t].chapters[s.b].length&&this.options.passage_existence_strategy.indexOf("c")>=0&&(999===s.v||s.v===this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0))?(r.start=e.b,r.end=s.b):this.options.osis_compaction_strategy.length<=2&&1===e.v&&(999===s.v||s.v===this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0)?(r.start=e.b+"."+e.c.toString(),r.end=s.b+"."+s.c.toString()):(r.start=e.b+"."+e.c.toString()+"."+e.v.toString(),r.end=s.b+"."+s.c.toString()+"."+s.v.toString()),a=r.start===r.end?r.start:r.start+"-"+r.end,null!=e.extra&&(a=e.extra+","+a),null!=s.extra&&(a+=","+s.extra),a}get_osises_by_chapter(e,s){if(null==e||null==e.start||null==e.end||null==e.osis)return[];if(null==e.start.b||null==e.end.b||null==e.start.c||null==e.end.c)return e.osis.length>0?[e.osis]:[];if(e.start.b!==e.end.b||e.start.c===e.end.c)return e.osis.length>0?[e.osis]:[];const t=[];for(let a=e.start.c,r=e.end.c,n=e.start.c<=r;n?a<=r:a>=r;n?a++:a--){const r=a===e.start.c?e.start.v:1,n=a===e.end.c?e.end.v:this.translations[s].chapters[e.start.b][a-1],i={b:e.start.b,c:a,v:"bcv"===e.start.type?r:null,type:e.start.type},o={b:e.end.b,c:a,v:"bcv"===e.start.type?n:null,type:e.start.type};t.push(this.to_osis(i,o,s))}return t}fix_ps151(e,s,t){return"default"!==t&&null==(null!=this.translations[t]?this.translations[t].chapters.Ps151:void 0)&&this.passage.promote_book_to_translation("Ps151",t),151===e.c&&"Ps"===e.b?151===s.c&&"Ps"===s.b?(e.b="Ps151",e.c=1,s.b="Ps151",s.c=1):(e.extra=this.to_osis({b:"Ps151",c:1,v:e.v},{b:"Ps151",c:1,v:this.passage.translations[t].chapters.Ps151[0]},t),e.b="Prov",e.c=1,e.v=1):(s.extra=this.to_osis({b:"Ps151",c:1,v:1},{b:"Ps151",c:1,v:s.v},t),s.c=150,s.v=this.passage.translations[t].chapters.Ps[149])}combine_consecutive_passages(e,s){const t=[];let a={};const r=e.length-1;let n=-1,i=!1;for(let c=0,p=r,g=0<=p;g?c<=p:c>=p;g?c++:c--){var o=e[c];if(o.osis.length>0){var l=t.length-1,u=!1;o.enclosed_indices[0]!==n&&(n=o.enclosed_indices[0]),n>=0&&(c===r||e[c+1].enclosed_indices[0]!==o.enclosed_indices[0])&&(u=!0,i=!0),this.is_verse_consecutive(a,o.start,s)?(t[l].end=o.end,t[l].is_enclosed_last=u,t[l].indices[1]=o.indices[1],t[l].enclosed_indices[1]=o.enclosed_indices[1],t[l].osis=this.to_osis(t[l].start,o.end,s)):t.push(o),a={b:o.end.b,c:o.end.c,v:o.end.v}}else t.push(o),a={}}return i&&this.snap_enclosed_indices(t),t}snap_enclosed_indices(e){for(var s of Array.from(e))null!=s.is_enclosed_last&&(s.enclosed_indices[0]<0&&s.is_enclosed_last&&(s.indices[1]=s.enclosed_indices[1]),delete s.is_enclosed_last);return e}is_verse_consecutive(e,s,t){if(null==e.b)return!1;const a=null!=this.passage.translations[t].order?this.passage.translations[t].order:this.passage.translations.default.order;if(e.b===s.b){if(e.c===s.c){if(e.v===s.v-1)return!0}else if(1===s.v&&e.c===s.c-1&&e.v===this.passage.translations[t].chapters[e.b][e.c-1])return!0}else if(1===s.c&&1===s.v&&a[e.b]===a[s.b]-1&&e.c===this.passage.translations[t].chapters[e.b].length&&e.v===this.passage.translations[t].chapters[e.b][e.c-1])return!0;return!1}snap_range(e,s){let t,a,r;"b_range_start"===e.type||"sequence"===e.type&&"b_range_start"===e.passages[s].type?(t=1,a="end",r="b_range_start"):(t=0,a="start",r="range_end_b");const n="end"===a?"start":"end";for(var i of Object.keys(e.passages[s][n]||{}))e.passages[s][n][i]=e.passages[s][a][i];if("sequence"===e.type){s>=e.value.length&&(s=e.value.length-1);const t=this.passage.pluck(r,e.value[s]);if(null!=t){const a=this.snap_range(t,0);0===s?e.absolute_indices[0]=a.absolute_indices[0]:e.absolute_indices[1]=a.absolute_indices[1]}}else e.original_type=e.type,e.type=e.value[t].type,e.absolute_indices=[e.value[t].absolute_indices[0],e.value[t].absolute_indices[1]];return e}snap_sequence(e,s,t,a,r){const n=s.passages[a];return n.absolute_indices[0]===s.absolute_indices[0]&&a<r-1&&this.get_snap_sequence_i(s.passages,a,r)!==a?(s.absolute_indices[0]=s.passages[a+1].absolute_indices[0],this.remove_absolute_indices(s.passages,a+1)):n.absolute_indices[1]===s.absolute_indices[1]&&a>0?s.absolute_indices[1]=t.length>0?t[t.length-1].indices[1]:s.passages[a-1].absolute_indices[1]:"book"===e&&a<r-1&&!this.starts_with_book(s.passages[a+1])&&(s.passages[a+1].absolute_indices[0]=n.absolute_indices[0]),s}get_snap_sequence_i(e,s,t){for(let a=s+1,r=a,n=t,i=a<=n;i?r<n:r>n;i?r++:r--){if(this.starts_with_book(e[r]))return r;if(e[r].valid.valid)return s}return s}starts_with_book(e){return"b"===e.type.substr(0,1)||("range"===e.type||"ff"===e.type)&&"b"===e.start.type.substr(0,1)}remove_absolute_indices(e,s){if(e[s].enclosed_absolute_indices[0]<0)return!1;const[t,a]=Array.from(e[s].enclosed_absolute_indices);for(var r of Array.from(e.slice(s))){if(r.enclosed_absolute_indices[0]!==t||r.enclosed_absolute_indices[1]!==a)break;r.enclosed_absolute_indices=[-1,-1]}return!0}}bcv_parser.initClass(),this.bcv_parser=bcv_parser;class bcv_passage{static initClass(){this.prototype.books=[],this.prototype.indices={},this.prototype.options={},this.prototype.translations={}}handle_array(e,s,t){for(var a of(null==s&&(s=[]),null==t&&(t={}),Array.from(e)))if(null!=a){if("stop"===a.type)break;[s,t]=Array.from(this.handle_obj(a,s,t))}return[s,t]}handle_obj(e,s,t){return null!=e.type&&null!=this[e.type]?this[e.type](e,s,t):[s,t]}b(e,s,t){let a;e.start_context=bcv_utils.shallow_clone(t),e.passages=[];const r=[];for(a of Array.from(this.books[e.value].parsed)){var n=this.validate_ref(e.start_context.translations,{b:a}),i={start:{b:a},end:{b:a},valid:n};0===e.passages.length&&n.valid?e.passages.push(i):r.push(i)}return 0===e.passages.length&&e.passages.push(r.shift()),r.length>0&&(e.passages[0].alternates=r),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),t={b:e.passages[0].start.b},null!=e.start_context.translations&&(t.translations=e.start_context.translations),[s,t]}b_range(e,s,t){return this.range(e,s,t)}b_range_pre(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t),e.passages=[];const n=this.pluck("b",e.value);a=this.b(n,[],t),[r]=Array.from(a[0]),t=a[1],null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices));const i={b:e.value[0].value+r.passages[0].start.b.substr(1),type:"b"};return e.passages=[{start:i,end:r.passages[0].end,valid:r.passages[0].valid}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),[s,t]}b_range_start(e,s,t){return this.range(e,s,t)}base(e,s,t){return this.indices=this.calculate_indices(e.match,e.start_index),this.handle_array(e.value,s,t)}bc(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.passages=[],this.reset_context(t,["b","c","v"]);const a=this.pluck("c",e.value).value,r=[];for(var n of Array.from(this.books[this.pluck("b",e.value).value].parsed)){var i="c",o=this.validate_ref(e.start_context.translations,{b:n,c:a}),l={start:{b:n},end:{b:n},valid:o};(o.messages.start_chapter_not_exist_in_single_chapter_book||o.messages.start_chapter_1)&&(l.valid=this.validate_ref(e.start_context.translations,{b:n,v:a}),o.messages.start_chapter_not_exist_in_single_chapter_book&&(l.valid.messages.start_chapter_not_exist_in_single_chapter_book=1),l.start.c=1,l.end.c=1,i="v"),l.start[i]=a,[l.start.c,l.start.v]=Array.from(this.fix_start_zeroes(l.valid,l.start.c,l.start.v)),null==l.start.v&&delete l.start.v,l.end[i]=l.start[i],0===e.passages.length&&l.valid.valid?e.passages.push(l):r.push(l)}return 0===e.passages.length&&e.passages.push(r.shift()),r.length>0&&(e.passages[0].alternates=r),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),this.set_context_from_object(t,["b","c","v"],e.passages[0].start),s.push(e),[s,t]}bc_title(e,s,t){let a,r;if(e.start_context=bcv_utils.shallow_clone(t),a=this.bc(this.pluck("bc",e.value),[],t),[r]=Array.from(a[0]),t=a[1],"Ps"!==r.passages[0].start.b.substr(0,2)&&null!=r.passages[0].alternates)for(let e=0,s=r.passages[0].alternates.length,t=0<=s;t?e<s:e>s;t?e++:e--)if("Ps"===r.passages[0].alternates[e].start.b.substr(0,2)){r.passages[0]=r.passages[0].alternates[e];break}if("Ps"!==r.passages[0].start.b.substr(0,2))return s.push(r),[s,t];this.books[this.pluck("b",r.value).value].parsed=["Ps"];let n=this.pluck("title",e.value);return null==n&&(n=this.pluck("v",e.value)),e.value[1]={type:"v",value:[{type:"integer",value:1,indices:n.indices}],indices:n.indices},e.type="bcv",this.bcv(e,s,e.start_context)}bcv(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.passages=[],this.reset_context(t,["b","c","v"]);const a=this.pluck("bc",e.value);let r=this.pluck("c",a.value).value,n=this.pluck("v",e.value).value;const i=[];for(var o of Array.from(this.books[this.pluck("b",a.value).value].parsed)){var l=this.validate_ref(e.start_context.translations,{b:o,c:r,v:n});[r,n]=Array.from(this.fix_start_zeroes(l,r,n));var u={start:{b:o,c:r,v:n},end:{b:o,c:r,v:n},valid:l};0===e.passages.length&&l.valid?e.passages.push(u):i.push(u)}return 0===e.passages.length&&e.passages.push(i.shift()),i.length>0&&(e.passages[0].alternates=i),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),this.set_context_from_object(t,["b","c","v"],e.passages[0].start),s.push(e),[s,t]}bv(e,s,t){let a;e.start_context=bcv_utils.shallow_clone(t);const[r,n]=Array.from(e.value);let i={indices:e.indices,value:[{type:"bc",value:[r,{type:"c",value:[{type:"integer",value:1}]}]},n]};return a=this.bcv(i,[],t),[i]=Array.from(a[0]),t=a[1],e.passages=i.passages,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),[s,t]}c(e,s,t){e.start_context=bcv_utils.shallow_clone(t);let a="integer"===e.type?e.value:this.pluck("integer",e.value).value;const r=this.validate_ref(e.start_context.translations,{b:t.b,c:a});return!r.valid&&r.messages.start_chapter_not_exist_in_single_chapter_book?this.v(e,s,t):([a]=Array.from(this.fix_start_zeroes(r,a)),e.passages=[{start:{b:t.b,c:a},end:{b:t.b,c:a},valid:r}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),t.c=a,this.reset_context(t,["v"]),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,t])}c_psalm(e,s,t){e.type="bc";const a=parseInt(this.books[e.value].value.match(/^\d+/)[0],10);return e.value=[{type:"b",value:e.value,indices:e.indices},{type:"c",value:[{type:"integer",value:a,indices:e.indices}],indices:e.indices}],this.bc(e,s,t)}c_title(e,s,t){if(e.start_context=bcv_utils.shallow_clone(t),"Ps"!==t.b)return this.c(e.value[0],s,t);const a=this.pluck("title",e.value);return e.value[1]={type:"v",value:[{type:"integer",value:1,indices:a.indices}],indices:a.indices},e.type="cv",this.cv(e,s,e.start_context)}cv(e,s,t){e.start_context=bcv_utils.shallow_clone(t);let a=this.pluck("c",e.value).value,r=this.pluck("v",e.value).value;const n=this.validate_ref(e.start_context.translations,{b:t.b,c:a,v:r});return[a,r]=Array.from(this.fix_start_zeroes(n,a,r)),e.passages=[{start:{b:t.b,c:a,v:r},end:{b:t.b,c:a,v:r},valid:n}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),t.c=a,t.v=r,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,t]}cb_range(e,s,t){e.type="range";const[a,r,n]=Array.from(e.value);return e.value=[{type:"bc",value:[a,r],indices:e.indices},n],n.indices[1]=e.indices[1],this.range(e,s,t)}context(e,s,t){for(var a of(e.start_context=bcv_utils.shallow_clone(t),e.passages=[],Object.keys(this.books[e.value].context||{})))t[a]=this.books[e.value].context[a];return s.push(e),[s,t]}cv_psalm(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.type="bcv";const[a,r]=Array.from(e.value),n=this.c_psalm(a,[],e.start_context),[i]=Array.from(n[0]);return e.value=[i,r],this.bcv(e,s,t)}ff(e,s,t){let a;return e.start_context=bcv_utils.shallow_clone(t),e.value.push({type:"integer",indices:e.indices,value:999}),a=this.range(e,[],e.start_context),[e]=Array.from(a[0]),t=a[1],e.value[0].indices=e.value[1].indices,e.value[0].absolute_indices=e.value[1].absolute_indices,e.value.pop(),null!=e.passages[0].valid.messages.end_verse_not_exist&&delete e.passages[0].valid.messages.end_verse_not_exist,null!=e.passages[0].valid.messages.end_chapter_not_exist&&delete e.passages[0].valid.messages.end_chapter_not_exist,null!=e.passages[0].end.original_c&&delete e.passages[0].end.original_c,s.push(e),[s,t]}integer_title(e,s,t){return e.start_context=bcv_utils.shallow_clone(t),"Ps"!==t.b?this.integer(e.value[0],s,t):(e.value[0]={type:"c",value:[e.value[0]],indices:[e.value[0].indices[0],e.value[0].indices[1]]},e.value[1].type="v",e.value[1].original_type="title",e.value[1].value=[{type:"integer",value:1,indices:e.value[1].value.indices}],e.type="cv",this.cv(e,s,e.start_context))}integer(e,s,t){return null!=t.v?this.v(e,s,t):this.c(e,s,t)}next_v(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t);let n=this.pluck_last_recursively("integer",e.value);if(null==n&&(n={value:1}),e.value.push({type:"integer",indices:e.indices,value:n.value+1}),a=this.range(e,[],e.start_context),[r]=Array.from(a[0]),t=a[1],null!=r.passages[0].valid.messages.end_verse_not_exist&&null==r.passages[0].valid.messages.start_verse_not_exist&&null==r.passages[0].valid.messages.start_chapter_not_exist&&null!=t.c){let s;e.value.pop(),e.value.push({type:"cv",indices:e.indices,value:[{type:"c",value:[{type:"integer",value:t.c+1,indices:e.indices}],indices:e.indices},{type:"v",value:[{type:"integer",value:1,indices:e.indices}],indices:e.indices}]}),s=this.range(e,[],e.start_context),[r]=Array.from(s[0]),t=s[1]}return r.value[0].indices=r.value[1].indices,r.value[0].absolute_indices=r.value[1].absolute_indices,r.value.pop(),null!=r.passages[0].valid.messages.end_verse_not_exist&&delete r.passages[0].valid.messages.end_verse_not_exist,null!=r.passages[0].valid.messages.end_chapter_not_exist&&delete r.passages[0].valid.messages.end_chapter_not_exist,null!=r.passages[0].end.original_c&&delete r.passages[0].end.original_c,s.push(r),[s,t]}sequence(e,s,t){for(var a of(e.start_context=bcv_utils.shallow_clone(t),e.passages=[],Array.from(e.value))){var r,n;for(var i of(r=this.handle_array(a,[],t),[n]=Array.from(r[0]),t=r[1],Array.from(n.passages)))null==i.type&&(i.type=n.type),null==i.absolute_indices&&(i.absolute_indices=n.absolute_indices),null!=n.start_context.translations&&(i.translations=n.start_context.translations),i.enclosed_absolute_indices="sequence_post_enclosed"===n.type?n.absolute_indices:[-1,-1],e.passages.push(i)}return null==e.absolute_indices&&(e.passages.length>0&&"sequence"===e.type?e.absolute_indices=[e.passages[0].absolute_indices[0],e.passages[e.passages.length-1].absolute_indices[1]]:e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),[s,t]}sequence_post_enclosed(e,s,t){return this.sequence(e,s,t)}v(e,s,t){let a,r="integer"===e.type?e.value:this.pluck("integer",e.value).value;e.start_context=bcv_utils.shallow_clone(t);const n=null!=t.c?t.c:1,i=this.validate_ref(e.start_context.translations,{b:t.b,c:n,v:r});return[a,r]=Array.from(this.fix_start_zeroes(i,0,r)),e.passages=[{start:{b:t.b,c:n,v:r},end:{b:t.b,c:n,v:r},valid:i}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),t.v=r,[s,t]}range(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t);let[n,i]=Array.from(e.value);if(a=this.handle_obj(n,[],t),[n]=Array.from(a[0]),t=a[1],"v"===i.type&&("bc"===n.type&&!__guard__(__guard__(__guard__(null!=n.passages?n.passages[0]:void 0,(e=>e.valid)),(e=>e.messages)),(e=>e.start_chapter_not_exist_in_single_chapter_book))||"c"===n.type)&&"verse"===this.options.end_range_digits_strategy)return e.value[0]=n,this.range_change_integer_end(e,s);r=this.handle_obj(i,[],t),[i]=Array.from(r[0]),t=r[1],e.value=[n,i],e.indices=[n.indices[0],i.indices[1]],delete e.absolute_indices;const o={b:n.passages[0].start.b,c:n.passages[0].start.c,v:n.passages[0].start.v,type:n.type},l={b:i.passages[0].end.b,c:i.passages[0].end.c,v:i.passages[0].end.v,type:i.type};i.passages[0].valid.messages.start_chapter_is_zero&&(l.c=0),i.passages[0].valid.messages.start_verse_is_zero&&(l.v=0);const u=this.validate_ref(e.start_context.translations,o,l);if(!u.valid)return this.range_handle_invalid(u,e,n,o,i,l,s);{const[t,a]=Array.from(this.range_handle_valid(u,e,n,o,i,l,s));if(t)return a}return null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),e.passages=[{start:o,end:l,valid:u}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),"b"===o.type?"b"===l.type?e.type="b_range":e.type="b_range_start":"b"===l.type&&(e.type="range_end_b"),s.push(e),[s,t]}range_change_end(e,s,t){let a;const[r,n]=Array.from(e.value);return"integer"===n.type?(n.original_value=n.value,n.value=t):"v"===n.type?(a=this.pluck("integer",n.value),a.original_value=a.value,a.value=t):"cv"===n.type&&(a=this.pluck("c",n.value),a.original_value=a.value,a.value=t),this.handle_obj(e,s,e.start_context)}range_change_integer_end(e,s){const[t,a]=Array.from(e.value);return null==e.original_type&&(e.original_type=e.type),null==e.original_value&&(e.original_value=[t,a]),e.type="integer"===t.type?"cv":t.type+"v","integer"===t.type&&(e.value[0]={type:"c",value:[t],indices:t.indices}),"integer"===a.type&&(e.value[1]={type:"v",value:[a],indices:a.indices}),this.handle_obj(e,s,e.start_context)}range_check_new_end(e,s,t,a){let r=0,n=null;if(a.messages.end_chapter_before_start?n="c":a.messages.end_verse_before_start&&(n="v"),null!=n&&(r=this.range_get_new_end_value(s,t,a,n)),r>0){const s={b:t.b,c:t.c,v:t.v};s[n]=r;this.validate_ref(e,s).valid||(r=0)}return r}range_end_b(e,s,t){return this.range(e,s,t)}range_get_new_end_value(e,s,t,a){let r=0;return"c"===a&&t.messages.end_chapter_is_zero||"v"===a&&t.messages.end_verse_is_zero||(e[a]>=10&&s[a]<10&&e[a]-10*Math.floor(e[a]/10)<s[a]?r=s[a]+10*Math.floor(e[a]/10):e[a]>=100&&s[a]<100&&e[a]-100<s[a]&&(r=s[a]+100)),r}range_handle_invalid(e,s,t,a,r,n,i){if(!1===e.valid&&(e.messages.end_chapter_before_start||e.messages.end_verse_before_start)&&("integer"===r.type||"v"===r.type)||!1===e.valid&&e.messages.end_chapter_before_start&&"cv"===r.type){const t=this.range_check_new_end(s.start_context.translations,a,n,e);if(t>0)return this.range_change_end(s,i,t)}if("verse"===this.options.end_range_digits_strategy&&null==a.v&&("integer"===r.type||"v"===r.type)){const e="v"===r.type?this.pluck("integer",r.value):r.value;if(this.validate_ref(s.start_context.translations,{b:a.b,c:a.c,v:e}).valid)return this.range_change_integer_end(s,i)}return null==s.original_type&&(s.original_type=s.type),s.type="sequence",[s.original_value,s.value]=Array.from([[t,r],[[t],[r]]]),this.sequence(s,i,s.start_context)}range_handle_valid(e,s,t,a,r,n,i){if(e.messages.end_chapter_not_exist&&"verse"===this.options.end_range_digits_strategy&&null==a.v&&("integer"===r.type||"v"===r.type)&&this.options.passage_existence_strategy.indexOf("v")>=0){const e="v"===r.type?this.pluck("integer",r.value):r.value;if(this.validate_ref(s.start_context.translations,{b:a.b,c:a.c,v:e}).valid)return[!0,this.range_change_integer_end(s,i)]}return this.range_validate(e,a,n,s),[!1,null]}range_validate(e,s,t,a){return e.messages.end_chapter_not_exist||e.messages.end_chapter_not_exist_in_single_chapter_book?(t.original_c=t.c,t.c=e.messages.end_chapter_not_exist?e.messages.end_chapter_not_exist:e.messages.end_chapter_not_exist_in_single_chapter_book,null!=t.v&&(t.v=this.validate_ref(a.start_context.translations,{b:t.b,c:t.c,v:999}).messages.end_verse_not_exist,delete e.messages.end_verse_is_zero)):e.messages.end_verse_not_exist&&(t.original_v=t.v,t.v=e.messages.end_verse_not_exist),e.messages.end_verse_is_zero&&"allow"!==this.options.zero_verse_strategy&&(t.v=e.messages.end_verse_is_zero),e.messages.end_chapter_is_zero&&(t.c=e.messages.end_chapter_is_zero),[s.c,s.v]=Array.from(this.fix_start_zeroes(e,s.c,s.v)),!0}translation_sequence(e,s,t){e.start_context=bcv_utils.shallow_clone(t);const a=[];for(var r of(a.push({translation:this.books[e.value[0].value].parsed}),Array.from(e.value[1])))null!=(r=this.books[this.pluck("translation",r).value].parsed)&&a.push({translation:r});for(var n of Array.from(a))null!=this.translations.aliases[n.translation]?(n.alias=this.translations.aliases[n.translation].alias,n.osis=this.translations.aliases[n.translation].osis||n.translation.toUpperCase()):(n.alias="default",n.osis=n.translation.toUpperCase());return s.length>0&&(t=this.translation_sequence_apply(s,a)),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),this.reset_context(t,["translations"]),[s,t]}translation_sequence_apply(e,s){let t,a=0;for(let s=e.length-1,t=s,r=s<=0;r?t<=0:t>=0;r?t++:t--)if(null!=e[t].original_type&&(e[t].type=e[t].original_type),null!=e[t].original_value&&(e[t].value=e[t].original_value),"translation_sequence"===e[t].type){a=t+1;break}if(a<e.length){let r;e[a].start_context.translations=s,[r,t]=Array.from(this.handle_array(e.slice(a),[],e[a].start_context))}else t=bcv_utils.shallow_clone(e[e.length-1].start_context);return t}pluck(e,s){for(var t of Array.from(s))if(null!=t&&null!=t.type&&t.type===e)return"c"===e||"v"===e?this.pluck("integer",t.value):t;return null}pluck_last_recursively(e,s){for(let r=s.length-1;r>=0;r--){var t=s[r];if(null!=t&&null!=t.type){if(t.type===e)return this.pluck(e,[t]);var a=this.pluck_last_recursively(e,t.value);if(null!=a)return a}}return null}set_context_from_object(e,s,t){return(()=>{const a=[];for(var r of Array.from(s))null!=t[r]&&a.push(e[r]=t[r]);return a})()}reset_context(e,s){return Array.from(s).map((s=>delete e[s]))}fix_start_zeroes(e,s,t){return e.messages.start_chapter_is_zero&&"upgrade"===this.options.zero_chapter_strategy&&(s=e.messages.start_chapter_is_zero),e.messages.start_verse_is_zero&&"upgrade"===this.options.zero_verse_strategy&&(t=e.messages.start_verse_is_zero),[s,t]}calculate_indices(e,s){let t,a="book";const r=[];let n=0;s=parseInt(s,10);let i=[e];for(var o of["",""]){var l=[];for(t of Array.from(i))l=l.concat(t.split(o));i=l}for(t of Array.from(i)){var u;a="book"===a?"rest":"book";var c=t.length;0!==c&&("book"===a?(t=t.replace(/\/\d+$/,""),u=n+c,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:n,end:u,index:s}),n+=c+2,s=this.books[t].start_index+this.books[t].value.length-n,r.push({start:u+1,end:u+1,index:s})):(u=n+c-1,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:n,end:u,index:s}),n+=c))}return r}get_absolute_indices(...e){const[s,t]=Array.from(e[0]);let a=null,r=null;for(var n of Array.from(this.indices))if(null===a&&n.start<=s&&s<=n.end&&(a=s+n.index),n.start<=t&&t<=n.end){r=t+n.index+1;break}return[a,r]}validate_ref(e,s,t){null!=e&&e.length>0||(e=[{translation:"default",osis:"",alias:"default"}]);let a=!1;const r={};for(var n of Array.from(e))if(null==n.alias&&(n.alias="default"),null!=n.alias){null==this.translations.aliases[n.alias]&&(n.alias="default",null==r.translation_unknown&&(r.translation_unknown=[]),r.translation_unknown.push(n));var[i]=Array.from(this.validate_start_ref(n.alias,s,r));t&&([i]=Array.from(this.validate_end_ref(n.alias,s,t,i,r))),!0===i&&(a=!0)}else null==r.translation_invalid&&(r.translation_invalid=[]),r.translation_invalid.push(n);return{valid:a,messages:r}}validate_start_ref(e,s,t){let a=!0;"default"!==e&&null==(null!=this.translations[e]?this.translations[e].chapters[s.b]:void 0)&&this.promote_book_to_translation(s.b,e);const r=null!=(null!=this.translations[e]?this.translations[e].order:void 0)?e:"default";if(null!=s.v&&(s.v=parseInt(s.v,10)),null!=this.translations[r].order[s.b]){if(null==s.c&&(s.c=1),s.c=parseInt(s.c,10),isNaN(s.c))return a=!1,t.start_chapter_not_numeric=!0,[a,t];0===s.c&&(t.start_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?a=!1:s.c=1),null!=s.v&&0===s.v&&(t.start_verse_is_zero=1,"error"===this.options.zero_verse_strategy?a=!1:"upgrade"===this.options.zero_verse_strategy&&(s.v=1)),s.c>0&&null!=this.translations[e].chapters[s.b][s.c-1]?null!=s.v?isNaN(s.v)?(a=!1,t.start_verse_not_numeric=!0):s.v>this.translations[e].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(a=!1,t.start_verse_not_exist=this.translations[e].chapters[s.b][s.c-1]):1===s.c&&"verse"===this.options.single_chapter_1_strategy&&1===this.translations[e].chapters[s.b].length&&(t.start_chapter_1=1):1!==s.c&&1===this.translations[e].chapters[s.b].length?(a=!1,t.start_chapter_not_exist_in_single_chapter_book=1):s.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(a=!1,t.start_chapter_not_exist=this.translations[e].chapters[s.b].length)}else null==s.b?(a=!1,t.start_book_not_defined=!0):(this.options.passage_existence_strategy.indexOf("b")>=0&&(a=!1),t.start_book_not_exist=!0);return[a,t]}validate_end_ref(e,s,t,a,r){const n=null!=(null!=this.translations[e]?this.translations[e].order:void 0)?e:"default";return null!=t.c&&(t.c=parseInt(t.c,10),isNaN(t.c)?(a=!1,r.end_chapter_not_numeric=!0):0===t.c&&(r.end_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?a=!1:t.c=1)),null!=t.v&&(t.v=parseInt(t.v,10),isNaN(t.v)?(a=!1,r.end_verse_not_numeric=!0):0===t.v&&(r.end_verse_is_zero=1,"error"===this.options.zero_verse_strategy?a=!1:"upgrade"===this.options.zero_verse_strategy&&(t.v=1))),null!=this.translations[n].order[t.b]?(null==t.c&&1===this.translations[e].chapters[t.b].length&&(t.c=1),null!=this.translations[n].order[s.b]&&this.translations[n].order[s.b]>this.translations[n].order[t.b]&&(this.options.passage_existence_strategy.indexOf("b")>=0&&(a=!1),r.end_book_before_start=!0),s.b!==t.b||null==t.c||isNaN(t.c)||(null==s.c&&(s.c=1),!isNaN(parseInt(s.c,10))&&s.c>t.c?(a=!1,r.end_chapter_before_start=!0):s.c!==t.c||null==t.v||isNaN(t.v)||(null==s.v&&(s.v=1),!isNaN(parseInt(s.v,10))&&s.v>t.v&&(a=!1,r.end_verse_before_start=!0))),null==t.c||isNaN(t.c)||null==this.translations[e].chapters[t.b][t.c-1]&&(1===this.translations[e].chapters[t.b].length?r.end_chapter_not_exist_in_single_chapter_book=1:t.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(r.end_chapter_not_exist=this.translations[e].chapters[t.b].length)),null==t.v||isNaN(t.v)||(null==t.c&&(t.c=this.translations[e].chapters[t.b].length),t.v>this.translations[e].chapters[t.b][t.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(r.end_verse_not_exist=this.translations[e].chapters[t.b][t.c-1]))):(a=!1,r.end_book_not_exist=!0),[a,r]}promote_book_to_translation(e,s){if(null==this.translations[s]&&(this.translations[s]={}),null==this.translations[s].chapters&&(this.translations[s].chapters={}),null==this.translations[s].chapters[e])return this.translations[s].chapters[e]=bcv_utils.shallow_clone_array(this.translations.default.chapters[e])}}function __guard__(e,s){return null!=e?s(e):void 0}bcv_passage.initClass();const bcv_utils={shallow_clone(e){if(null==e)return e;const s={};for(const t of Object.keys(e||{})){const a=e[t];s[t]=a}return s},shallow_clone_array(e){if(null==e)return e;const s=[];for(let t=0,a=e.length,r=0<=a;r?t<=a:t>=a;r?t++:t--)void 0!==e[t]&&(s[t]=e[t]);return s}};bcv_parser.prototype.regexps.translations=RegExp("(?:(?:ERV))\\b","gi"),bcv_parser.prototype.translations={aliases:{default:{osis:"",alias:"default"}},alternates:{},default:{order:{Gen:1,Exod:2,Lev:3,Num:4,Deut:5,Josh:6,Judg:7,Ruth:8,"1Sam":9,"2Sam":10,"1Kgs":11,"2Kgs":12,"1Chr":13,"2Chr":14,Ezra:15,Neh:16,Esth:17,Job:18,Ps:19,Prov:20,Eccl:21,Song:22,Isa:23,Jer:24,Lam:25,Ezek:26,Dan:27,Hos:28,Joel:29,Amos:30,Obad:31,Jonah:32,Mic:33,Nah:34,Hab:35,Zeph:36,Hag:37,Zech:38,Mal:39,Matt:40,Mark:41,Luke:42,John:43,Acts:44,Rom:45,"1Cor":46,"2Cor":47,Gal:48,Eph:49,Phil:50,Col:51,"1Thess":52,"2Thess":53,"1Tim":54,"2Tim":55,Titus:56,Phlm:57,Heb:58,Jas:59,"1Pet":60,"2Pet":61,"1John":62,"2John":63,"3John":64,Jude:65,Rev:66,Tob:67,Jdt:68,GkEsth:69,Wis:70,Sir:71,Bar:72,PrAzar:73,Sus:74,Bel:75,SgThree:76,EpJer:77,"1Macc":78,"2Macc":79,"3Macc":80,"4Macc":81,"1Esd":82,"2Esd":83,PrMan:84},chapters:{Gen:[31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,55,32,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,33,26],Exod:[22,25,22,31,23,30,25,32,35,29,10,51,22,31,27,36,16,27,25,26,36,31,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,38],Lev:[17,16,17,35,19,30,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,46,34],Num:[54,34,51,49,31,27,89,26,23,36,35,16,33,45,41,50,13,32,22,29,35,41,30,25,18,65,23,31,40,16,54,42,56,29,34,13],Deut:[46,37,29,49,33,25,26,20,29,22,32,32,18,29,23,22,20,22,21,20,23,30,25,22,19,19,26,68,29,20,30,52,29,12],Josh:[18,24,17,24,15,27,26,35,27,43,23,24,33,15,63,10,18,28,51,9,45,34,16,33],Judg:[36,23,31,24,31,40,25,35,57,18,40,15,25,20,20,31,13,31,30,48,25],Ruth:[22,23,18,22],"1Sam":[28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,42,15,23,29,22,44,25,12,25,11,31,13],"2Sam":[27,32,39,12,25,23,29,18,13,19,27,31,39,33,37,23,29,33,43,26,22,51,39,25],"1Kgs":[53,46,28,34,18,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,53],"2Kgs":[18,25,27,44,27,33,20,29,37,36,21,21,25,29,38,20,41,37,37,21,26,20,37,20,30],"1Chr":[54,55,24,43,26,81,40,40,44,14,47,40,14,17,29,43,27,17,19,8,30,19,32,31,31,32,34,21,30],"2Chr":[17,18,17,22,14,42,22,18,31,19,23,16,22,15,19,14,19,34,11,37,20,12,21,27,28,23,9,27,36,27,21,33,25,33,27,23],Ezra:[11,70,13,24,17,22,28,36,15,44],Neh:[11,20,32,23,19,19,73,18,38,39,36,47,31],Esth:[22,23,15,17,14,14,10,17,32,3],Job:[22,13,26,21,27,30,21,22,35,22,20,25,28,22,35,22,16,21,29,29,34,30,17,25,6,14,23,28,25,31,40,22,33,37,16,33,24,41,30,24,34,17],Ps:[6,12,8,8,12,10,17,9,20,18,7,8,6,7,5,11,15,50,14,9,13,31,6,10,22,12,14,9,11,12,24,11,22,22,28,12,40,22,13,17,13,11,5,26,17,11,9,14,20,23,19,9,6,7,23,13,11,11,17,12,8,12,11,10,13,20,7,35,36,5,24,20,28,23,10,12,20,72,13,19,16,8,18,12,13,17,7,18,52,17,16,15,5,23,11,13,12,9,9,5,8,28,22,35,45,48,43,13,31,7,10,10,9,8,18,19,2,29,176,7,8,9,4,8,5,6,5,6,8,8,3,18,3,3,21,26,9,8,24,13,10,7,12,15,21,10,20,14,9,6],Prov:[33,22,35,27,23,35,27,36,18,32,31,28,25,35,33,33,28,24,29,30,31,29,35,34,28,28,27,28,27,33,31],Eccl:[18,26,22,16,20,12,29,17,18,20,10,14],Song:[17,17,11,16,16,13,13,14],Isa:[31,22,26,6,30,13,25,22,21,34,16,6,22,32,9,14,14,7,25,6,17,25,18,23,12,21,13,29,24,33,9,20,24,17,10,22,38,22,8,31,29,25,28,28,25,13,15,22,26,11,23,15,12,17,13,12,21,14,21,22,11,12,19,12,25,24],Jer:[19,37,25,31,31,30,34,22,26,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,21,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34],Lam:[22,22,66,22,22],Ezek:[28,10,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,49,32,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35],Dan:[21,49,30,37,31,28,28,27,27,21,45,13],Hos:[11,23,5,19,15,11,16,14,17,15,12,14,16,9],Joel:[20,32,21],Amos:[15,16,15,13,27,14,17,14,15],Obad:[21],Jonah:[17,10,10,11],Mic:[16,13,12,13,15,16,20],Nah:[15,13,19],Hab:[17,20,19],Zeph:[18,15,20],Hag:[15,23],Zech:[21,13,10,14,11,15,14,23,17,12,17,14,9,21],Mal:[14,17,18,6],Matt:[25,23,17,25,48,34,29,34,38,42,30,50,58,36,39,28,27,35,30,34,46,46,39,51,46,75,66,20],Mark:[45,28,35,41,43,56,37,38,50,52,33,44,37,72,47,20],Luke:[80,52,38,44,39,49,50,56,62,42,54,59,35,35,32,31,37,43,48,47,38,71,56,53],John:[51,25,36,54,47,71,53,59,41,42,57,50,38,31,27,33,26,40,42,31,25],Acts:[26,47,26,37,42,15,60,40,43,48,30,25,52,28,41,40,34,28,41,38,40,30,35,27,27,32,44,31],Rom:[32,29,31,25,21,23,25,39,33,21,36,21,14,23,33,27],"1Cor":[31,16,23,21,13,20,40,13,27,33,34,31,13,40,58,24],"2Cor":[24,17,18,18,21,18,16,24,15,18,33,21,14],Gal:[24,21,29,31,26,18],Eph:[23,22,21,32,33,24],Phil:[30,30,21,23],Col:[29,23,25,18],"1Thess":[10,20,13,18,28],"2Thess":[12,17,18],"1Tim":[20,15,16,16,25,21],"2Tim":[18,26,17,22],Titus:[16,15,15],Phlm:[25],Heb:[14,18,19,16,14,20,28,13,28,39,40,29,25],Jas:[27,26,18,17,20],"1Pet":[25,25,22,19,14],"2Pet":[21,22,18],"1John":[10,29,24,21,21],"2John":[13],"3John":[15],Jude:[25],Rev:[20,29,22,11,14,17,17,13,21,11,19,17,18,20,8,21,18,24,21,15,27,21],Tob:[22,14,17,21,22,18,16,21,6,13,18,22,17,15],Jdt:[16,28,10,15,24,21,32,36,14,23,23,20,20,19,14,25],GkEsth:[22,23,15,17,14,14,10,17,32,13,12,6,18,19,16,24],Wis:[16,24,19,20,23,25,30,21,18,21,26,27,19,31,19,29,21,25,22],Sir:[30,18,31,31,15,37,36,19,18,31,34,18,26,27,20,30,32,33,30,31,28,27,27,34,26,29,30,26,28,25,31,24,33,31,26,31,31,34,35,30,22,25,33,23,26,20,25,25,16,29,30],Bar:[22,35,37,37,9],PrAzar:[68],Sus:[64],Bel:[42],SgThree:[39],EpJer:[73],"1Macc":[64,70,60,61,68,63,50,32,73,89,74,53,53,49,41,24],"2Macc":[36,32,40,50,27,31,42,36,29,38,38,45,26,46,39],"3Macc":[29,33,30,21,51,41,23],"4Macc":[35,24,21,26,38,35,23,29,32,21,27,19,27,20,32,25,24,24],"1Esd":[58,30,24,63,73,34,15,96,55],"2Esd":[40,48,36,52,56,59,70,63,47,59,46,51,58,48,63,78],PrMan:[15],Ps151:[7]}},vulgate:{chapters:{Gen:[31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,55,32,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,32,25],Exod:[22,25,22,31,23,30,25,32,35,29,10,51,22,31,27,36,16,27,25,26,36,31,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,36],Lev:[17,16,17,35,19,30,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,45,34],Num:[54,34,51,49,31,27,89,26,23,36,34,15,34,45,41,50,13,32,22,30,35,41,30,25,18,65,23,31,39,17,54,42,56,29,34,13],Josh:[18,24,17,25,16,27,26,35,27,44,23,24,33,15,63,10,18,28,51,9,43,34,16,33],Judg:[36,23,31,24,32,40,25,35,57,18,40,15,25,20,20,31,13,31,30,48,24],"1Sam":[28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,43,15,23,28,23,44,25,12,25,11,31,13],"1Kgs":[53,46,28,34,18,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,54],"1Chr":[54,55,24,43,26,81,40,40,44,14,46,40,14,17,29,43,27,17,19,7,30,19,32,31,31,32,34,21,30],Neh:[11,20,31,23,19,19,73,18,38,39,36,46,31],Job:[22,13,26,21,27,30,21,22,35,22,20,25,28,22,35,23,16,21,29,29,34,30,17,25,6,14,23,28,25,31,40,22,33,37,16,33,24,41,35,28,25,16],Ps:[6,13,9,10,13,11,18,10,39,8,9,6,7,5,10,15,51,15,10,14,32,6,10,22,12,14,9,11,13,25,11,22,23,28,13,40,23,14,18,14,12,5,26,18,12,10,15,21,23,21,11,7,9,24,13,12,12,18,14,9,13,12,11,14,20,8,36,37,6,24,20,28,23,11,13,21,72,13,20,17,8,19,13,14,17,7,19,53,17,16,16,5,23,11,13,12,9,9,5,8,29,22,35,45,48,43,14,31,7,10,10,9,26,9,10,2,29,176,7,8,9,4,8,5,6,5,6,8,8,3,18,3,3,21,26,9,8,24,14,10,8,12,15,21,10,11,9,14,9,6],Eccl:[18,26,22,17,19,11,30,17,18,20,10,14],Song:[16,17,11,16,17,12,13,14],Jer:[19,37,25,31,31,30,34,22,26,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,20,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34],Ezek:[28,9,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,49,32,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35],Dan:[21,49,100,34,31,28,28,27,27,21,45,13,65,42],Hos:[11,24,5,19,15,11,16,14,17,15,12,14,15,10],Amos:[15,16,15,13,27,15,17,14,14],Jonah:[16,11,10,11],Mic:[16,13,12,13,14,16,20],Hag:[14,24],Matt:[25,23,17,25,48,34,29,34,38,42,30,50,58,36,39,28,26,35,30,34,46,46,39,51,46,75,66,20],Mark:[45,28,35,40,43,56,37,39,49,52,33,44,37,72,47,20],John:[51,25,36,54,47,72,53,59,41,42,57,50,38,31,27,33,26,40,42,31,25],Acts:[26,47,26,37,42,15,59,40,43,48,30,25,52,27,41,40,34,28,40,38,40,30,35,27,27,32,44,31],"2Cor":[24,17,18,18,21,18,16,24,15,18,33,21,13],Rev:[20,29,22,11,14,17,17,13,21,11,19,18,18,20,8,21,18,24,21,15,27,21],Tob:[25,23,25,23,28,22,20,24,12,13,21,22,23,17],Jdt:[12,18,15,17,29,21,25,34,19,20,21,20,31,18,15,31],Wis:[16,25,19,20,24,27,30,21,19,21,27,27,19,31,19,29,20,25,20],Sir:[40,23,34,36,18,37,40,22,25,34,36,19,32,27,22,31,31,33,28,33,31,33,38,47,36,28,33,30,35,27,42,28,33,31,26,28,34,39,41,32,28,26,37,27,31,23,31,28,19,31,38,13],Bar:[22,35,38,37,9,72],"1Macc":[67,70,60,61,68,63,50,32,73,89,74,54,54,49,41,24],"2Macc":[36,33,40,50,27,31,42,36,29,38,38,46,26,46,40]}},ceb:{chapters:{"2Cor":[24,17,18,18,21,18,16,24,15,18,33,21,13],Rev:[20,29,22,11,14,17,17,13,21,11,19,18,18,20,8,21,18,24,21,15,27,21],Tob:[22,14,17,21,22,18,16,21,6,13,18,22,18,15],PrAzar:[67],EpJer:[72],"1Esd":[55,26,24,63,71,33,15,92,55]}},kjv:{chapters:{"3John":[14]}},nab:{order:{Gen:1,Exod:2,Lev:3,Num:4,Deut:5,Josh:6,Judg:7,Ruth:8,"1Sam":9,"2Sam":10,"1Kgs":11,"2Kgs":12,"1Chr":13,"2Chr":14,PrMan:15,Ezra:16,Neh:17,"1Esd":18,"2Esd":19,Tob:20,Jdt:21,Esth:22,GkEsth:23,"1Macc":24,"2Macc":25,"3Macc":26,"4Macc":27,Job:28,Ps:29,Prov:30,Eccl:31,Song:32,Wis:33,Sir:34,Isa:35,Jer:36,Lam:37,Bar:38,EpJer:39,Ezek:40,Dan:41,PrAzar:42,Sus:43,Bel:44,SgThree:45,Hos:46,Joel:47,Amos:48,Obad:49,Jonah:50,Mic:51,Nah:52,Hab:53,Zeph:54,Hag:55,Zech:56,Mal:57,Matt:58,Mark:59,Luke:60,John:61,Acts:62,Rom:63,"1Cor":64,"2Cor":65,Gal:66,Eph:67,Phil:68,Col:69,"1Thess":70,"2Thess":71,"1Tim":72,"2Tim":73,Titus:74,Phlm:75,Heb:76,Jas:77,"1Pet":78,"2Pet":79,"1John":80,"2John":81,"3John":82,Jude:83,Rev:84},chapters:{Gen:[31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,54,33,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,33,26],Exod:[22,25,22,31,23,30,29,28,35,29,10,51,22,31,27,36,16,27,25,26,37,30,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,38],Lev:[17,16,17,35,26,23,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,46,34],Num:[54,34,51,49,31,27,89,26,23,36,35,16,33,45,41,35,28,32,22,29,35,41,30,25,19,65,23,31,39,17,54,42,56,29,34,13],Deut:[46,37,29,49,33,25,26,20,29,22,32,31,19,29,23,22,20,22,21,20,23,29,26,22,19,19,26,69,28,20,30,52,29,12],"1Sam":[28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,42,16,23,28,23,44,25,12,25,11,31,13],"2Sam":[27,32,39,12,25,23,29,18,13,19,27,31,39,33,37,23,29,32,44,26,22,51,39,25],"1Kgs":[53,46,28,20,32,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,54],"2Kgs":[18,25,27,44,27,33,20,29,37,36,20,22,25,29,38,20,41,37,37,21,26,20,37,20,30],"1Chr":[54,55,24,43,41,66,40,40,44,14,47,41,14,17,29,43,27,17,19,8,30,19,32,31,31,32,34,21,30],"2Chr":[18,17,17,22,14,42,22,18,31,19,23,16,23,14,19,14,19,34,11,37,20,12,21,27,28,23,9,27,36,27,21,33,25,33,27,23],Neh:[11,20,38,17,19,19,72,18,37,40,36,47,31],Job:[22,13,26,21,27,30,21,22,35,22,20,25,28,22,35,22,16,21,29,29,34,30,17,25,6,14,23,28,25,31,40,22,33,37,16,33,24,41,30,32,26,17],Ps:[6,11,9,9,13,11,18,10,21,18,7,9,6,7,5,11,15,51,15,10,14,32,6,10,22,12,14,9,11,13,25,11,22,23,28,13,40,23,14,18,14,12,5,27,18,12,10,15,21,23,21,11,7,9,24,14,12,12,18,14,9,13,12,11,14,20,8,36,37,6,24,20,28,23,11,13,21,72,13,20,17,8,19,13,14,17,7,19,53,17,16,16,5,23,11,13,12,9,9,5,8,29,22,35,45,48,43,14,31,7,10,10,9,8,18,19,2,29,176,7,8,9,4,8,5,6,5,6,8,8,3,18,3,3,21,26,9,8,24,14,10,8,12,15,21,10,20,14,9,6],Eccl:[18,26,22,17,19,12,29,17,18,20,10,14],Song:[17,17,11,16,16,12,14,14],Isa:[31,22,26,6,30,13,25,23,20,34,16,6,22,32,9,14,14,7,25,6,17,25,18,23,12,21,13,29,24,33,9,20,24,17,10,22,38,22,8,31,29,25,28,28,25,13,15,22,26,11,23,15,12,17,13,12,21,14,21,22,11,12,19,11,25,24],Jer:[19,37,25,31,31,30,34,23,25,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,21,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34],Ezek:[28,10,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,44,37,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35],Dan:[21,49,100,34,30,29,28,27,27,21,45,13,64,42],Hos:[9,25,5,19,15,11,16,14,17,15,11,15,15,10],Joel:[20,27,5,21],Jonah:[16,11,10,11],Mic:[16,13,12,14,14,16,20],Nah:[14,14,19],Zech:[17,17,10,14,11,15,14,23,17,12,17,14,9,21],Mal:[14,17,24],Acts:[26,47,26,37,42,15,60,40,43,49,30,25,52,28,41,40,34,28,40,38,40,30,35,27,27,32,44,31],"2Cor":[24,17,18,18,21,18,16,24,15,18,33,21,13],Rev:[20,29,22,11,14,17,17,13,21,11,19,18,18,20,8,21,18,24,21,15,27,21],Tob:[22,14,17,21,22,18,17,21,6,13,18,22,18,15],Sir:[30,18,31,31,15,37,36,19,18,31,34,18,26,27,20,30,32,33,30,31,28,27,27,33,26,29,30,26,28,25,31,24,33,31,26,31,31,34,35,30,22,25,33,23,26,20,25,25,16,29,30],Bar:[22,35,38,37,9,72],"2Macc":[36,32,40,50,27,31,42,36,29,38,38,46,26,46,39]}},nlt:{chapters:{Rev:[20,29,22,11,14,17,17,13,21,11,19,18,18,20,8,21,18,24,21,15,27,21]}},nrsv:{chapters:{"2Cor":[24,17,18,18,21,18,16,24,15,18,33,21,13],Rev:[20,29,22,11,14,17,17,13,21,11,19,18,18,20,8,21,18,24,21,15,27,21]}}},bcv_parser.prototype.languages=["sr"];const heregex=e=>{let s="",t=!1,a=!1;for(let r=0;r<e.length;r++){const n=e[r];if(a)s+=n,a=!1;else if("\\"!==n)if(t||"["!==n)if(t&&"]"===n)t=!1,s+=n;else if(t||"#"!==n)!t&&/\s/.test(n)||(s+=n);else for(;r<e.length&&"\n"!==e[r];)r+=1;else t=!0,s+=n;else s+=n,a=!0}return s};var grammar;bcv_parser.prototype.regexps.space="[\\s\\xa0]",bcv_parser.prototype.regexps.escaped_passage=RegExp(heregex(String.raw`
|
|
2
2
|
(?:^ | [^\x1f\x1e\dA-Za-zªµºÀ-ÖØ-öø-ɏЀ-ҁ҃-҇Ҋ-ԧḀ-ỿⱠ-Ɀⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꟿ] ) # Beginning of string or not in the middle of a word or immediately following another book. Only count a book if it's part of a sequence: \`Matt5John3\` is OK, but not \`1Matt5John3\`
|
|
3
3
|
(
|
|
4
4
|
# Start inverted book/chapter (cb)
|
package/dist/sv-bcv-parser.js
CHANGED
|
@@ -548,7 +548,11 @@ class bcv_parser {
|
|
|
548
548
|
const out = [];
|
|
549
549
|
for (var osis of Array.from(this.parsed_entities())) {
|
|
550
550
|
if (osis.osis.length > 0) {
|
|
551
|
-
|
|
551
|
+
const entry = { osis: osis.osis, translations: osis.translations, indices: osis.indices };
|
|
552
|
+
if (osis.osises != null) {
|
|
553
|
+
entry.osises = osis.osises;
|
|
554
|
+
}
|
|
555
|
+
out.push(entry);
|
|
552
556
|
}
|
|
553
557
|
}
|
|
554
558
|
return out;
|
|
@@ -614,34 +618,19 @@ class bcv_parser {
|
|
|
614
618
|
passage.absolute_indices = entity.absolute_indices;
|
|
615
619
|
}
|
|
616
620
|
if ((this.options.consecutive_combination_strategy === 'separate-chapters') && (passage.start.c !== passage.end.c)) {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
v: passage.start.type === 'bcv' ? passageEndVerse : null,
|
|
631
|
-
type: passage.start.type
|
|
632
|
-
};
|
|
633
|
-
nonCombinableOsises.push({
|
|
634
|
-
osis: passage.valid.valid ? this.to_osis(passageStart, passageEnd, translation_alias) : "",
|
|
635
|
-
type: passage.type,
|
|
636
|
-
indices: passage.absolute_indices,
|
|
637
|
-
translations,
|
|
638
|
-
start: passageStart,
|
|
639
|
-
end: passageEnd,
|
|
640
|
-
enclosed_indices: passage.enclosed_absolute_indices,
|
|
641
|
-
entity_id,
|
|
642
|
-
entities: [passage]
|
|
643
|
-
});
|
|
644
|
-
}
|
|
621
|
+
const osises_by_chapter = this.get_osises_by_chapter({ osis: "", start: passage.start, end: passage.end }, translation_alias);
|
|
622
|
+
osises.push({
|
|
623
|
+
osis: passage.valid.valid ? this.to_osis(passage.start, passage.end, translation_alias) : "",
|
|
624
|
+
osises: osises_by_chapter,
|
|
625
|
+
type: passage.type,
|
|
626
|
+
indices: passage.absolute_indices,
|
|
627
|
+
translations,
|
|
628
|
+
start: passage.start,
|
|
629
|
+
end: passage.end,
|
|
630
|
+
enclosed_indices: passage.enclosed_absolute_indices,
|
|
631
|
+
entity_id,
|
|
632
|
+
entities: [passage]
|
|
633
|
+
});
|
|
645
634
|
}
|
|
646
635
|
else {
|
|
647
636
|
osises.push({
|
|
@@ -667,6 +656,17 @@ class bcv_parser {
|
|
|
667
656
|
}
|
|
668
657
|
osises = osises.concat(nonCombinableOsises).sort((osis1, osis2) => osis1.indices[0] - osis2.indices[0]);
|
|
669
658
|
}
|
|
659
|
+
if (this.options.consecutive_combination_strategy === "separate-chapters") {
|
|
660
|
+
for (osis of Array.from(osises)) {
|
|
661
|
+
if (osis.osis.length === 0) {
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
const osises_by_chapter = this.get_osises_by_chapter(osis, translation_alias);
|
|
665
|
+
if (osises_by_chapter.length > 1) {
|
|
666
|
+
osis.osises = osises_by_chapter;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
670
|
// Add the osises array to the existing array.
|
|
671
671
|
if (this.options.sequence_combination_strategy === "separate") {
|
|
672
672
|
out = out.concat(osises);
|
|
@@ -685,7 +685,25 @@ class bcv_parser {
|
|
|
685
685
|
strings.push(osis.osis);
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
|
-
|
|
688
|
+
let osises_by_chapter = [];
|
|
689
|
+
if (this.options.consecutive_combination_strategy === "separate-chapters") {
|
|
690
|
+
for (osis of Array.from(osises)) {
|
|
691
|
+
if (osis.osis.length === 0) {
|
|
692
|
+
continue;
|
|
693
|
+
}
|
|
694
|
+
if (osis.osises != null) {
|
|
695
|
+
osises_by_chapter = osises_by_chapter.concat(osis.osises);
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
osises_by_chapter = osises_by_chapter.concat(this.get_osises_by_chapter(osis, translation_alias));
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
const out_entry = { osis: strings.join(","), indices: entity.absolute_indices, translations, entity_id, entities: osises };
|
|
703
|
+
if (osises_by_chapter.length > 0) {
|
|
704
|
+
out_entry.osises = osises_by_chapter;
|
|
705
|
+
}
|
|
706
|
+
out.push(out_entry);
|
|
689
707
|
}
|
|
690
708
|
}
|
|
691
709
|
return out;
|
|
@@ -765,6 +783,36 @@ class bcv_parser {
|
|
|
765
783
|
}
|
|
766
784
|
return out;
|
|
767
785
|
}
|
|
786
|
+
get_osises_by_chapter(passage, translation) {
|
|
787
|
+
if ((passage == null) || (passage.start == null) || (passage.end == null) || (passage.osis == null)) {
|
|
788
|
+
return [];
|
|
789
|
+
}
|
|
790
|
+
if ((passage.start.b == null) || (passage.end.b == null) || (passage.start.c == null) || (passage.end.c == null)) {
|
|
791
|
+
return passage.osis.length > 0 ? [passage.osis] : [];
|
|
792
|
+
}
|
|
793
|
+
if ((passage.start.b !== passage.end.b) || (passage.start.c === passage.end.c)) {
|
|
794
|
+
return passage.osis.length > 0 ? [passage.osis] : [];
|
|
795
|
+
}
|
|
796
|
+
const out = [];
|
|
797
|
+
for (let c = passage.start.c, end = passage.end.c, asc = passage.start.c <= end; asc ? c <= end : c >= end; asc ? c++ : c--) {
|
|
798
|
+
const passageStartVerse = c === passage.start.c ? passage.start.v : 1;
|
|
799
|
+
const passageEndVerse = c === passage.end.c ? passage.end.v : this.translations[translation].chapters[passage.start.b][c - 1];
|
|
800
|
+
const passageStart = {
|
|
801
|
+
b: passage.start.b,
|
|
802
|
+
c,
|
|
803
|
+
v: passage.start.type === "bcv" ? passageStartVerse : null,
|
|
804
|
+
type: passage.start.type
|
|
805
|
+
};
|
|
806
|
+
const passageEnd = {
|
|
807
|
+
b: passage.end.b,
|
|
808
|
+
c,
|
|
809
|
+
v: passage.start.type === "bcv" ? passageEndVerse : null,
|
|
810
|
+
type: passage.start.type
|
|
811
|
+
};
|
|
812
|
+
out.push(this.to_osis(passageStart, passageEnd, translation));
|
|
813
|
+
}
|
|
814
|
+
return out;
|
|
815
|
+
}
|
|
768
816
|
// If we want to treat Ps151 as a book rather than a chapter, we have to do some gymnastics to make sure it returns properly.
|
|
769
817
|
fix_ps151(start, end, translation) {
|
|
770
818
|
// Ps151 doesn't necessarily get promoted into the translation chapter list because during the string parsing, we treat it as `Ps` rather than `Ps151`.
|
|
@@ -2549,8 +2597,8 @@ bcv_parser.prototype.regexps.pre_book = "[^A-Za-zªµºÀ-ÖØ-öø-ɏḀ-ỿⱠ
|
|
|
2549
2597
|
bcv_parser.prototype.regexps.first = `(?:F[öo]rsta|1)\\.?${bcv_parser.prototype.regexps.space}*`;
|
|
2550
2598
|
bcv_parser.prototype.regexps.second = `(?:Andra|2)\\.?${bcv_parser.prototype.regexps.space}*`;
|
|
2551
2599
|
bcv_parser.prototype.regexps.third = `(?:Tredje|3e|3)\\.?${bcv_parser.prototype.regexps.space}*`;
|
|
2552
|
-
bcv_parser.prototype.regexps.range_and =
|
|
2553
|
-
bcv_parser.prototype.regexps.range_only =
|
|
2600
|
+
bcv_parser.prototype.regexps.range_and = `(?:[&\\u2013\\u2014-]|(?:och|jfr)|till)`;
|
|
2601
|
+
bcv_parser.prototype.regexps.range_only = `(?:[\\u2013\\u2014-]|till)`;
|
|
2554
2602
|
// Each book regexp should return two parenthesized objects: an optional preliminary character and the book itself.
|
|
2555
2603
|
bcv_parser.prototype.regexps.get_books = function (include_apocrypha, case_sensitive) {
|
|
2556
2604
|
const books = [
|