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 a;return this.reset(),[s,this.passage.books]=Array.from(this.match_books(this.replace_control_characters(s))),[a,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 a=e[s];"include_apocrypha"===s||"versification_system"===s||"case_sensitive"===s?this[s](a):this.options[s]=a}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 a;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)a=null!=this.translations[s].chapters.Ps151?this.translations[s].chapters.Ps151[0]:this.translations.default.chapters.Ps151[0],this.translations[s].chapters.Ps[150]=a;else 151===this.translations[s].chapters.Ps.length&&this.translations[s].chapters.Ps.pop()}return this}versification_system(e){let s,a;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||{})))a=this.translations.alternates.default.chapters[s],this.translations.default.chapters[s]=bcv_utils.shallow_clone_array(a);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||{}))a=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(a);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 a=this.options.versification_system;e!==a&&this.versification_system(e);const t={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];t.chapters[s]=bcv_utils.shallow_clone_array(r)}for(s of Object.keys(t.order||{})){var i=t.order[s];t.books[i-1]=s}return e!==a&&this.versification_system(a),t}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 a of Array.from(this.regexps.books)){var t=!1;if(e=e.replace(a.regexp,(function(e,r,i){t=!0,s.push({value:i,parsed:a.osis,type:"book"});const n=null!=a.extra?`/${a.extra}`:"";return`${r}${s.length-1}${n}`})),!0===t&&/^[\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 a,t=0;const r=new RegExp("([\\x1f\\x1e])(\\d+)(?:/\\d+)?\\1","g");for(;a=r.exec(s);)e[a[2]].start_index=a.index+t,t+=e[a[2]].value.length-a[0].length;return e}match_passages(e){let s,a=[],t={};for(;s=this.regexps.escaped_passage.exec(e);){let p;var[r,i,n]=Array.from(s),o=i.length;if(s.index+=r.length-o,/\s[2-9]\d\d\s*$|\s\d{4,}\s*$/.test(i)&&(i=i.replace(/\s+\d+\s*$/,"")),/[\d\x1f\x1e)]$/.test(i)||(i=this.replace_match_end(i)),"delete"===this.options.captive_end_digits_strategy){var l=s.index+i.length;e.length>l&&/^\w/.test(e.substr(l,1))&&(i=i.replace(/[\s*]+\d+$/,"")),i=i.replace(/(\x1e[)\]]?)[\s*]*\d+$/,"$1")}var u=""===(i=i.replace(/[A-Z]+/g,(e=>e.toLowerCase()))).substr(0,1)?0:i.split("")[0].length,c={value:grammar.parse(i,{punctuation_strategy:this.options.punctuation_strategy}),type:"base",start_index:this.passage.books[n].start_index-u,match:i};"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[n].parsed.length||this.passage.books[n].parsed.length>1&&"translation"===this.passage.books[n].parsed[1].type)&&/^[234]/.test(this.passage.books[n].parsed[0])&&this.create_book_range(e,c,n),[p,t]=Array.from(this.passage.handle_obj(c)),a=a.concat(p);var x=this.adjust_regexp_end(p,o,i.length);x>0&&(this.regexps.escaped_passage.lastIndex-=x)}return[a,t]}adjust_regexp_end(e,s,a){let t=0;return e.length>0?t=s-e[e.length-1].indices[1]-1:s!==a&&(t=s-a),t}replace_match_end(e){let s,a=e.length;for(;s=this.regexps.match_end_split.exec(e);)a=s.index+s[0].length;return a<e.length&&(e=e.substr(0,a)),e}create_book_range(e,s,a){const t=[bcv_parser.prototype.regexps.first,bcv_parser.prototype.regexps.second,bcv_parser.prototype.regexps.third],r=parseInt(this.passage.books[a].parsed[0].substr(0,1),10);for(let o=1,l=r,u=1<=l;u?o<l:o>l;u?o++:o--){var i=o===r-1?bcv_parser.prototype.regexps.range_and:bcv_parser.prototype.regexps.range_only,n=e.match(new RegExp(`(?:^|\\W)(${t[o-1]}\\s*${i}\\s*)\\x1f${a}\\x1f`,"i"));if(null!=n)return this.add_book_range_object(s,n,o)}return!1}add_book_range_object(e,s,a){const{length:t}=s[1];if(e.value[0]={type:"b_range_pre",value:[{type:"b_pre",value:a.toString(),indices:[s.index,s.index+t]},e.value[0]],indices:[0,e.value[0].indices[1]+t]},e.value[0].value[1].indices[0]+=t,e.value[0].value[1].indices[1]+=t,e.start_index-=t,e.match=s[1]+e.match,1!==e.value.length)return(()=>{const s=[];for(let a=1,r=e.value.length,i=1<=r;i?a<r:a>r;i?a++:a--)null!=e.value[a].value&&(null!=(null!=e.value[a].value[0]?e.value[a].value[0].indices:void 0)&&(e.value[a].value[0].indices[0]+=t,e.value[a].value[0].indices[1]+=t),e.value[a].indices[0]+=t,s.push(e.value[a].indices[1]+=t));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 m=0,k=this.entities.length,K=0<=k;K?m<k:m>k;K?m++:m--){var s=this.entities[m];if(s.type&&"translation_sequence"===s.type&&e.length>0&&m===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 a=[],t=null;if(null!=s.passages[0].translations)for(var r of Array.from(s.passages[0].translations)){var i=(null!=r.osis?r.osis.length:void 0)>0?r.osis:"";null==t&&(t=r.alias),a.push(i)}else a=[""],t="default";for(var n=[],o=[],{length:l}=s.passages,u=0,c=u,x=l,p=0<=x;p?u<x:u>x;p?u++:u--,c=u){var g,h,_=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,n,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)for(c=_.start.c,h=_.end.c,g=_.start.c<=h;g?c<=h:c>=h;g?c++:c--){var d=c===_.start.c?_.start.v:1,f=c===_.end.c?_.end.v:this.translations[t].chapters[_.start.b][c-1],v={b:_.start.b,c:c,v:"bcv"===_.start.type?d:null,type:_.start.type},b={b:_.end.b,c:c,v:"bcv"===_.start.type?f:null,type:_.start.type};o.push({osis:_.valid.valid?this.to_osis(v,b,t):"",type:_.type,indices:_.absolute_indices,translations:a,start:v,end:b,enclosed_indices:_.enclosed_absolute_indices,entity_id:m,entities:[_]})}else n.push({osis:_.valid.valid?this.to_osis(_.start,_.end,t):"",type:_.type,indices:_.absolute_indices,translations:a,start:_.start,end:_.end,enclosed_indices:_.enclosed_absolute_indices,entity_id:m,entities:[_]});else this.snap_sequence("book",s,n,c,l)}if(0!==n.length||0!==o.length)if("combine"!==this.options.consecutive_combination_strategy&&"separate-chapters"!==this.options.consecutive_combination_strategy||(n.length>1&&(n=this.combine_consecutive_passages(n,t)),n=n.concat(o).sort(((e,s)=>e.indices[0]-s.indices[0]))),"separate"===this.options.sequence_combination_strategy)e=e.concat(n);else{var y,w=[],z=n.length-1;for(y of(null!=n[z].enclosed_indices&&n[z].enclosed_indices[1]>=0&&(s.absolute_indices[1]=n[z].enclosed_indices[1]),Array.from(n)))y.osis.length>0&&w.push(y.osis);e.push({osis:w.join(","),indices:s.absolute_indices,translations:a,entity_id:m,entities:n})}}}return e}to_osis(e,s,a){let t;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[a].chapters[s.b]&&1===this.passage.translations[a].chapters[s.b].length?s.c=this.passage.translations[a].chapters[s.b].length:s.c=999),null==s.v&&(null!=this.passage.translations[a].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0?s.v=this.passage.translations[a].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,a),"b"===this.options.osis_compaction_strategy&&1===e.c&&1===e.v&&(999===s.c&&999===s.v||s.c===this.passage.translations[a].chapters[s.b].length&&this.options.passage_existence_strategy.indexOf("c")>=0&&(999===s.v||s.v===this.passage.translations[a].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[a].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()),t=r.start===r.end?r.start:r.start+"-"+r.end,null!=e.extra&&(t=e.extra+","+t),null!=s.extra&&(t+=","+s.extra),t}fix_ps151(e,s,a){return"default"!==a&&null==(null!=this.translations[a]?this.translations[a].chapters.Ps151:void 0)&&this.passage.promote_book_to_translation("Ps151",a),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[a].chapters.Ps151[0]},a),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},a),s.c=150,s.v=this.passage.translations[a].chapters.Ps[149])}combine_consecutive_passages(e,s){const a=[];let t={};const r=e.length-1;let i=-1,n=!1;for(let c=0,x=r,p=0<=x;p?c<=x:c>=x;p?c++:c--){var o=e[c];if(o.osis.length>0){var l=a.length-1,u=!1;o.enclosed_indices[0]!==i&&(i=o.enclosed_indices[0]),i>=0&&(c===r||e[c+1].enclosed_indices[0]!==o.enclosed_indices[0])&&(u=!0,n=!0),this.is_verse_consecutive(t,o.start,s)?(a[l].end=o.end,a[l].is_enclosed_last=u,a[l].indices[1]=o.indices[1],a[l].enclosed_indices[1]=o.enclosed_indices[1],a[l].osis=this.to_osis(a[l].start,o.end,s)):a.push(o),t={b:o.end.b,c:o.end.c,v:o.end.v}}else a.push(o),t={}}return n&&this.snap_enclosed_indices(a),a}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,a){if(null==e.b)return!1;const t=null!=this.passage.translations[a].order?this.passage.translations[a].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[a].chapters[e.b][e.c-1])return!0}else if(1===s.c&&1===s.v&&t[e.b]===t[s.b]-1&&e.c===this.passage.translations[a].chapters[e.b].length&&e.v===this.passage.translations[a].chapters[e.b][e.c-1])return!0;return!1}snap_range(e,s){let a,t,r;"b_range_start"===e.type||"sequence"===e.type&&"b_range_start"===e.passages[s].type?(a=1,t="end",r="b_range_start"):(a=0,t="start",r="range_end_b");const i="end"===t?"start":"end";for(var n of Object.keys(e.passages[s][i]||{}))e.passages[s][i][n]=e.passages[s][t][n];if("sequence"===e.type){s>=e.value.length&&(s=e.value.length-1);const a=this.passage.pluck(r,e.value[s]);if(null!=a){const t=this.snap_range(a,0);0===s?e.absolute_indices[0]=t.absolute_indices[0]:e.absolute_indices[1]=t.absolute_indices[1]}}else e.original_type=e.type,e.type=e.value[a].type,e.absolute_indices=[e.value[a].absolute_indices[0],e.value[a].absolute_indices[1]];return e}snap_sequence(e,s,a,t,r){const i=s.passages[t];return i.absolute_indices[0]===s.absolute_indices[0]&&t<r-1&&this.get_snap_sequence_i(s.passages,t,r)!==t?(s.absolute_indices[0]=s.passages[t+1].absolute_indices[0],this.remove_absolute_indices(s.passages,t+1)):i.absolute_indices[1]===s.absolute_indices[1]&&t>0?s.absolute_indices[1]=a.length>0?a[a.length-1].indices[1]:s.passages[t-1].absolute_indices[1]:"book"===e&&t<r-1&&!this.starts_with_book(s.passages[t+1])&&(s.passages[t+1].absolute_indices[0]=i.absolute_indices[0]),s}get_snap_sequence_i(e,s,a){for(let t=s+1,r=t,i=a,n=t<=i;n?r<i:r>i;n?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[a,t]=Array.from(e[s].enclosed_absolute_indices);for(var r of Array.from(e.slice(s))){if(r.enclosed_absolute_indices[0]!==a||r.enclosed_absolute_indices[1]!==t)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,a){for(var t of(null==s&&(s=[]),null==a&&(a={}),Array.from(e)))if(null!=t){if("stop"===t.type)break;[s,a]=Array.from(this.handle_obj(t,s,a))}return[s,a]}handle_obj(e,s,a){return null!=e.type&&null!=this[e.type]?this[e.type](e,s,a):[s,a]}b(e,s,a){let t;e.start_context=bcv_utils.shallow_clone(a),e.passages=[];const r=[];for(t of Array.from(this.books[e.value].parsed)){var i=this.validate_ref(e.start_context.translations,{b:t}),n={start:{b:t},end:{b:t},valid:i};0===e.passages.length&&i.valid?e.passages.push(n):r.push(n)}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),a={b:e.passages[0].start.b},null!=e.start_context.translations&&(a.translations=e.start_context.translations),[s,a]}b_range(e,s,a){return this.range(e,s,a)}b_range_pre(e,s,a){let t,r;e.start_context=bcv_utils.shallow_clone(a),e.passages=[];const i=this.pluck("b",e.value);t=this.b(i,[],a),[r]=Array.from(t[0]),a=t[1],null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices));const n={b:e.value[0].value+r.passages[0].start.b.substr(1),type:"b"};return e.passages=[{start:n,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,a]}b_range_start(e,s,a){return this.range(e,s,a)}base(e,s,a){return this.indices=this.calculate_indices(e.match,e.start_index),this.handle_array(e.value,s,a)}bc(e,s,a){e.start_context=bcv_utils.shallow_clone(a),e.passages=[],this.reset_context(a,["b","c","v"]);const t=this.pluck("c",e.value).value,r=[];for(var i of Array.from(this.books[this.pluck("b",e.value).value].parsed)){var n="c",o=this.validate_ref(e.start_context.translations,{b:i,c:t}),l={start:{b:i},end:{b:i},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:i,v:t}),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,n="v"),l.start[n]=t,[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[n]=l.start[n],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(a,["b","c","v"],e.passages[0].start),s.push(e),[s,a]}bc_title(e,s,a){let t,r;if(e.start_context=bcv_utils.shallow_clone(a),t=this.bc(this.pluck("bc",e.value),[],a),[r]=Array.from(t[0]),a=t[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,a=0<=s;a?e<s:e>s;a?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,a];this.books[this.pluck("b",r.value).value].parsed=["Ps"];let i=this.pluck("title",e.value);return null==i&&(i=this.pluck("v",e.value)),e.value[1]={type:"v",value:[{type:"integer",value:1,indices:i.indices}],indices:i.indices},e.type="bcv",this.bcv(e,s,e.start_context)}bcv(e,s,a){e.start_context=bcv_utils.shallow_clone(a),e.passages=[],this.reset_context(a,["b","c","v"]);const t=this.pluck("bc",e.value);let r=this.pluck("c",t.value).value,i=this.pluck("v",e.value).value;const n=[];for(var o of Array.from(this.books[this.pluck("b",t.value).value].parsed)){var l=this.validate_ref(e.start_context.translations,{b:o,c:r,v:i});[r,i]=Array.from(this.fix_start_zeroes(l,r,i));var u={start:{b:o,c:r,v:i},end:{b:o,c:r,v:i},valid:l};0===e.passages.length&&l.valid?e.passages.push(u):n.push(u)}return 0===e.passages.length&&e.passages.push(n.shift()),n.length>0&&(e.passages[0].alternates=n),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(a,["b","c","v"],e.passages[0].start),s.push(e),[s,a]}bv(e,s,a){let t;e.start_context=bcv_utils.shallow_clone(a);const[r,i]=Array.from(e.value);let n={indices:e.indices,value:[{type:"bc",value:[r,{type:"c",value:[{type:"integer",value:1}]}]},i]};return t=this.bcv(n,[],a),[n]=Array.from(t[0]),a=t[1],e.passages=n.passages,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),[s,a]}c(e,s,a){e.start_context=bcv_utils.shallow_clone(a);let t="integer"===e.type?e.value:this.pluck("integer",e.value).value;const r=this.validate_ref(e.start_context.translations,{b:a.b,c:t});return!r.valid&&r.messages.start_chapter_not_exist_in_single_chapter_book?this.v(e,s,a):([t]=Array.from(this.fix_start_zeroes(r,t)),e.passages=[{start:{b:a.b,c:t},end:{b:a.b,c:t},valid:r}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),a.c=t,this.reset_context(a,["v"]),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,a])}c_psalm(e,s,a){e.type="bc";const t=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:t,indices:e.indices}],indices:e.indices}],this.bc(e,s,a)}c_title(e,s,a){if(e.start_context=bcv_utils.shallow_clone(a),"Ps"!==a.b)return this.c(e.value[0],s,a);const t=this.pluck("title",e.value);return e.value[1]={type:"v",value:[{type:"integer",value:1,indices:t.indices}],indices:t.indices},e.type="cv",this.cv(e,s,e.start_context)}cv(e,s,a){e.start_context=bcv_utils.shallow_clone(a);let t=this.pluck("c",e.value).value,r=this.pluck("v",e.value).value;const i=this.validate_ref(e.start_context.translations,{b:a.b,c:t,v:r});return[t,r]=Array.from(this.fix_start_zeroes(i,t,r)),e.passages=[{start:{b:a.b,c:t,v:r},end:{b:a.b,c:t,v:r},valid:i}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),a.c=t,a.v=r,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,a]}cb_range(e,s,a){e.type="range";const[t,r,i]=Array.from(e.value);return e.value=[{type:"bc",value:[t,r],indices:e.indices},i],i.indices[1]=e.indices[1],this.range(e,s,a)}context(e,s,a){for(var t of(e.start_context=bcv_utils.shallow_clone(a),e.passages=[],Object.keys(this.books[e.value].context||{})))a[t]=this.books[e.value].context[t];return s.push(e),[s,a]}cv_psalm(e,s,a){e.start_context=bcv_utils.shallow_clone(a),e.type="bcv";const[t,r]=Array.from(e.value),i=this.c_psalm(t,[],e.start_context),[n]=Array.from(i[0]);return e.value=[n,r],this.bcv(e,s,a)}ff(e,s,a){let t;return e.start_context=bcv_utils.shallow_clone(a),e.value.push({type:"integer",indices:e.indices,value:999}),t=this.range(e,[],e.start_context),[e]=Array.from(t[0]),a=t[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,a]}integer_title(e,s,a){return e.start_context=bcv_utils.shallow_clone(a),"Ps"!==a.b?this.integer(e.value[0],s,a):(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,a){return null!=a.v?this.v(e,s,a):this.c(e,s,a)}next_v(e,s,a){let t,r;e.start_context=bcv_utils.shallow_clone(a);let i=this.pluck_last_recursively("integer",e.value);if(null==i&&(i={value:1}),e.value.push({type:"integer",indices:e.indices,value:i.value+1}),t=this.range(e,[],e.start_context),[r]=Array.from(t[0]),a=t[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!=a.c){let s;e.value.pop(),e.value.push({type:"cv",indices:e.indices,value:[{type:"c",value:[{type:"integer",value:a.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]),a=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,a]}sequence(e,s,a){for(var t of(e.start_context=bcv_utils.shallow_clone(a),e.passages=[],Array.from(e.value))){var r,i;for(var n of(r=this.handle_array(t,[],a),[i]=Array.from(r[0]),a=r[1],Array.from(i.passages)))null==n.type&&(n.type=i.type),null==n.absolute_indices&&(n.absolute_indices=i.absolute_indices),null!=i.start_context.translations&&(n.translations=i.start_context.translations),n.enclosed_absolute_indices="sequence_post_enclosed"===i.type?i.absolute_indices:[-1,-1],e.passages.push(n)}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,a]}sequence_post_enclosed(e,s,a){return this.sequence(e,s,a)}v(e,s,a){let t,r="integer"===e.type?e.value:this.pluck("integer",e.value).value;e.start_context=bcv_utils.shallow_clone(a);const i=null!=a.c?a.c:1,n=this.validate_ref(e.start_context.translations,{b:a.b,c:i,v:r});return[t,r]=Array.from(this.fix_start_zeroes(n,0,r)),e.passages=[{start:{b:a.b,c:i,v:r},end:{b:a.b,c:i,v:r},valid:n}],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),a.v=r,[s,a]}range(e,s,a){let t,r;e.start_context=bcv_utils.shallow_clone(a);let[i,n]=Array.from(e.value);if(t=this.handle_obj(i,[],a),[i]=Array.from(t[0]),a=t[1],"v"===n.type&&("bc"===i.type&&!__guard__(__guard__(__guard__(null!=i.passages?i.passages[0]:void 0,(e=>e.valid)),(e=>e.messages)),(e=>e.start_chapter_not_exist_in_single_chapter_book))||"c"===i.type)&&"verse"===this.options.end_range_digits_strategy)return e.value[0]=i,this.range_change_integer_end(e,s);r=this.handle_obj(n,[],a),[n]=Array.from(r[0]),a=r[1],e.value=[i,n],e.indices=[i.indices[0],n.indices[1]],delete e.absolute_indices;const o={b:i.passages[0].start.b,c:i.passages[0].start.c,v:i.passages[0].start.v,type:i.type},l={b:n.passages[0].end.b,c:n.passages[0].end.c,v:n.passages[0].end.v,type:n.type};n.passages[0].valid.messages.start_chapter_is_zero&&(l.c=0),n.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,i,o,n,l,s);{const[a,t]=Array.from(this.range_handle_valid(u,e,i,o,n,l,s));if(a)return t}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,a]}range_change_end(e,s,a){let t;const[r,i]=Array.from(e.value);return"integer"===i.type?(i.original_value=i.value,i.value=a):"v"===i.type?(t=this.pluck("integer",i.value),t.original_value=t.value,t.value=a):"cv"===i.type&&(t=this.pluck("c",i.value),t.original_value=t.value,t.value=a),this.handle_obj(e,s,e.start_context)}range_change_integer_end(e,s){const[a,t]=Array.from(e.value);return null==e.original_type&&(e.original_type=e.type),null==e.original_value&&(e.original_value=[a,t]),e.type="integer"===a.type?"cv":a.type+"v","integer"===a.type&&(e.value[0]={type:"c",value:[a],indices:a.indices}),"integer"===t.type&&(e.value[1]={type:"v",value:[t],indices:t.indices}),this.handle_obj(e,s,e.start_context)}range_check_new_end(e,s,a,t){let r=0,i=null;if(t.messages.end_chapter_before_start?i="c":t.messages.end_verse_before_start&&(i="v"),null!=i&&(r=this.range_get_new_end_value(s,a,t,i)),r>0){const s={b:a.b,c:a.c,v:a.v};s[i]=r;this.validate_ref(e,s).valid||(r=0)}return r}range_end_b(e,s,a){return this.range(e,s,a)}range_get_new_end_value(e,s,a,t){let r=0;return"c"===t&&a.messages.end_chapter_is_zero||"v"===t&&a.messages.end_verse_is_zero||(e[t]>=10&&s[t]<10&&e[t]-10*Math.floor(e[t]/10)<s[t]?r=s[t]+10*Math.floor(e[t]/10):e[t]>=100&&s[t]<100&&e[t]-100<s[t]&&(r=s[t]+100)),r}range_handle_invalid(e,s,a,t,r,i,n){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 a=this.range_check_new_end(s.start_context.translations,t,i,e);if(a>0)return this.range_change_end(s,n,a)}if("verse"===this.options.end_range_digits_strategy&&null==t.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:t.b,c:t.c,v:e}).valid)return this.range_change_integer_end(s,n)}return null==s.original_type&&(s.original_type=s.type),s.type="sequence",[s.original_value,s.value]=Array.from([[a,r],[[a],[r]]]),this.sequence(s,n,s.start_context)}range_handle_valid(e,s,a,t,r,i,n){if(e.messages.end_chapter_not_exist&&"verse"===this.options.end_range_digits_strategy&&null==t.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:t.b,c:t.c,v:e}).valid)return[!0,this.range_change_integer_end(s,n)]}return this.range_validate(e,t,i,s),[!1,null]}range_validate(e,s,a,t){return e.messages.end_chapter_not_exist||e.messages.end_chapter_not_exist_in_single_chapter_book?(a.original_c=a.c,a.c=e.messages.end_chapter_not_exist?e.messages.end_chapter_not_exist:e.messages.end_chapter_not_exist_in_single_chapter_book,null!=a.v&&(a.v=this.validate_ref(t.start_context.translations,{b:a.b,c:a.c,v:999}).messages.end_verse_not_exist,delete e.messages.end_verse_is_zero)):e.messages.end_verse_not_exist&&(a.original_v=a.v,a.v=e.messages.end_verse_not_exist),e.messages.end_verse_is_zero&&"allow"!==this.options.zero_verse_strategy&&(a.v=e.messages.end_verse_is_zero),e.messages.end_chapter_is_zero&&(a.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,a){e.start_context=bcv_utils.shallow_clone(a);const t=[];for(var r of(t.push({translation:this.books[e.value[0].value].parsed}),Array.from(e.value[1])))null!=(r=this.books[this.pluck("translation",r).value].parsed)&&t.push({translation:r});for(var i of Array.from(t))null!=this.translations.aliases[i.translation]?(i.alias=this.translations.aliases[i.translation].alias,i.osis=this.translations.aliases[i.translation].osis||i.translation.toUpperCase()):(i.alias="default",i.osis=i.translation.toUpperCase());return s.length>0&&(a=this.translation_sequence_apply(s,t)),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),this.reset_context(a,["translations"]),[s,a]}translation_sequence_apply(e,s){let a,t=0;for(let s=e.length-1,a=s,r=s<=0;r?a<=0:a>=0;r?a++:a--)if(null!=e[a].original_type&&(e[a].type=e[a].original_type),null!=e[a].original_value&&(e[a].value=e[a].original_value),"translation_sequence"===e[a].type){t=a+1;break}if(t<e.length){let r;e[t].start_context.translations=s,[r,a]=Array.from(this.handle_array(e.slice(t),[],e[t].start_context))}else a=bcv_utils.shallow_clone(e[e.length-1].start_context);return a}pluck(e,s){for(var a of Array.from(s))if(null!=a&&null!=a.type&&a.type===e)return"c"===e||"v"===e?this.pluck("integer",a.value):a;return null}pluck_last_recursively(e,s){for(let r=s.length-1;r>=0;r--){var a=s[r];if(null!=a&&null!=a.type){if(a.type===e)return this.pluck(e,[a]);var t=this.pluck_last_recursively(e,a.value);if(null!=t)return t}}return null}set_context_from_object(e,s,a){return(()=>{const t=[];for(var r of Array.from(s))null!=a[r]&&t.push(e[r]=a[r]);return t})()}reset_context(e,s){return Array.from(s).map((s=>delete e[s]))}fix_start_zeroes(e,s,a){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&&(a=e.messages.start_verse_is_zero),[s,a]}calculate_indices(e,s){let a,t="book";const r=[];let i=0;s=parseInt(s,10);let n=[e];for(var o of["",""]){var l=[];for(a of Array.from(n))l=l.concat(a.split(o));n=l}for(a of Array.from(n)){var u;t="book"===t?"rest":"book";var c=a.length;0!==c&&("book"===t?(a=a.replace(/\/\d+$/,""),u=i+c,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:i,end:u,index:s}),i+=c+2,s=this.books[a].start_index+this.books[a].value.length-i,r.push({start:u+1,end:u+1,index:s})):(u=i+c-1,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:i,end:u,index:s}),i+=c))}return r}get_absolute_indices(...e){const[s,a]=Array.from(e[0]);let t=null,r=null;for(var i of Array.from(this.indices))if(null===t&&i.start<=s&&s<=i.end&&(t=s+i.index),i.start<=a&&a<=i.end){r=a+i.index+1;break}return[t,r]}validate_ref(e,s,a){null!=e&&e.length>0||(e=[{translation:"default",osis:"",alias:"default"}]);let t=!1;const r={};for(var i of Array.from(e))if(null==i.alias&&(i.alias="default"),null!=i.alias){null==this.translations.aliases[i.alias]&&(i.alias="default",null==r.translation_unknown&&(r.translation_unknown=[]),r.translation_unknown.push(i));var[n]=Array.from(this.validate_start_ref(i.alias,s,r));a&&([n]=Array.from(this.validate_end_ref(i.alias,s,a,n,r))),!0===n&&(t=!0)}else null==r.translation_invalid&&(r.translation_invalid=[]),r.translation_invalid.push(i);return{valid:t,messages:r}}validate_start_ref(e,s,a){let t=!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 t=!1,a.start_chapter_not_numeric=!0,[t,a];0===s.c&&(a.start_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?t=!1:s.c=1),null!=s.v&&0===s.v&&(a.start_verse_is_zero=1,"error"===this.options.zero_verse_strategy?t=!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)?(t=!1,a.start_verse_not_numeric=!0):s.v>this.translations[e].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(t=!1,a.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&&(a.start_chapter_1=1):1!==s.c&&1===this.translations[e].chapters[s.b].length?(t=!1,a.start_chapter_not_exist_in_single_chapter_book=1):s.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(t=!1,a.start_chapter_not_exist=this.translations[e].chapters[s.b].length)}else null==s.b?(t=!1,a.start_book_not_defined=!0):(this.options.passage_existence_strategy.indexOf("b")>=0&&(t=!1),a.start_book_not_exist=!0);return[t,a]}validate_end_ref(e,s,a,t,r){const i=null!=(null!=this.translations[e]?this.translations[e].order:void 0)?e:"default";return null!=a.c&&(a.c=parseInt(a.c,10),isNaN(a.c)?(t=!1,r.end_chapter_not_numeric=!0):0===a.c&&(r.end_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?t=!1:a.c=1)),null!=a.v&&(a.v=parseInt(a.v,10),isNaN(a.v)?(t=!1,r.end_verse_not_numeric=!0):0===a.v&&(r.end_verse_is_zero=1,"error"===this.options.zero_verse_strategy?t=!1:"upgrade"===this.options.zero_verse_strategy&&(a.v=1))),null!=this.translations[i].order[a.b]?(null==a.c&&1===this.translations[e].chapters[a.b].length&&(a.c=1),null!=this.translations[i].order[s.b]&&this.translations[i].order[s.b]>this.translations[i].order[a.b]&&(this.options.passage_existence_strategy.indexOf("b")>=0&&(t=!1),r.end_book_before_start=!0),s.b!==a.b||null==a.c||isNaN(a.c)||(null==s.c&&(s.c=1),!isNaN(parseInt(s.c,10))&&s.c>a.c?(t=!1,r.end_chapter_before_start=!0):s.c!==a.c||null==a.v||isNaN(a.v)||(null==s.v&&(s.v=1),!isNaN(parseInt(s.v,10))&&s.v>a.v&&(t=!1,r.end_verse_before_start=!0))),null==a.c||isNaN(a.c)||null==this.translations[e].chapters[a.b][a.c-1]&&(1===this.translations[e].chapters[a.b].length?r.end_chapter_not_exist_in_single_chapter_book=1:a.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(r.end_chapter_not_exist=this.translations[e].chapters[a.b].length)),null==a.v||isNaN(a.v)||(null==a.c&&(a.c=this.translations[e].chapters[a.b].length),a.v>this.translations[e].chapters[a.b][a.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(r.end_verse_not_exist=this.translations[e].chapters[a.b][a.c-1]))):(t=!1,r.end_book_not_exist=!0),[t,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 a of Object.keys(e||{})){const t=e[a];s[a]=t}return s},shallow_clone_array(e){if(null==e)return e;const s=[];for(let a=0,t=e.length,r=0<=t;r?a<=t:a>=t;r?a++:a--)void 0!==e[a]&&(s[a]=e[a]);return s}};bcv_parser.prototype.regexps.translations=RegExp("(?:(?:NP))\\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=["pl"];const heregex=e=>{let s="",a=!1,t=!1;for(let r=0;r<e.length;r++){const i=e[r];if(t)s+=i,t=!1;else if("\\"!==i)if(a||"["!==i)if(a&&"]"===i)a=!1,s+=i;else if(a||"#"!==i)!a&&/\s/.test(i)||(s+=i);else for(;r<e.length&&"\n"!==e[r];)r+=1;else a=!0,s+=i;else s+=i,t=!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 a;return this.reset(),[s,this.passage.books]=Array.from(this.match_books(this.replace_control_characters(s))),[a,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 a=e[s];"include_apocrypha"===s||"versification_system"===s||"case_sensitive"===s?this[s](a):this.options[s]=a}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 a;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)a=null!=this.translations[s].chapters.Ps151?this.translations[s].chapters.Ps151[0]:this.translations.default.chapters.Ps151[0],this.translations[s].chapters.Ps[150]=a;else 151===this.translations[s].chapters.Ps.length&&this.translations[s].chapters.Ps.pop()}return this}versification_system(e){let s,a;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||{})))a=this.translations.alternates.default.chapters[s],this.translations.default.chapters[s]=bcv_utils.shallow_clone_array(a);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||{}))a=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(a);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 a=this.options.versification_system;e!==a&&this.versification_system(e);const t={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];t.chapters[s]=bcv_utils.shallow_clone_array(r)}for(s of Object.keys(t.order||{})){var i=t.order[s];t.books[i-1]=s}return e!==a&&this.versification_system(a),t}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 a of Array.from(this.regexps.books)){var t=!1;if(e=e.replace(a.regexp,(function(e,r,i){t=!0,s.push({value:i,parsed:a.osis,type:"book"});const n=null!=a.extra?`/${a.extra}`:"";return`${r}${s.length-1}${n}`})),!0===t&&/^[\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 a,t=0;const r=new RegExp("([\\x1f\\x1e])(\\d+)(?:/\\d+)?\\1","g");for(;a=r.exec(s);)e[a[2]].start_index=a.index+t,t+=e[a[2]].value.length-a[0].length;return e}match_passages(e){let s,a=[],t={};for(;s=this.regexps.escaped_passage.exec(e);){let p;var[r,i,n]=Array.from(s),o=i.length;if(s.index+=r.length-o,/\s[2-9]\d\d\s*$|\s\d{4,}\s*$/.test(i)&&(i=i.replace(/\s+\d+\s*$/,"")),/[\d\x1f\x1e)]$/.test(i)||(i=this.replace_match_end(i)),"delete"===this.options.captive_end_digits_strategy){var l=s.index+i.length;e.length>l&&/^\w/.test(e.substr(l,1))&&(i=i.replace(/[\s*]+\d+$/,"")),i=i.replace(/(\x1e[)\]]?)[\s*]*\d+$/,"$1")}var u=""===(i=i.replace(/[A-Z]+/g,(e=>e.toLowerCase()))).substr(0,1)?0:i.split("")[0].length,c={value:grammar.parse(i,{punctuation_strategy:this.options.punctuation_strategy}),type:"base",start_index:this.passage.books[n].start_index-u,match:i};"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[n].parsed.length||this.passage.books[n].parsed.length>1&&"translation"===this.passage.books[n].parsed[1].type)&&/^[234]/.test(this.passage.books[n].parsed[0])&&this.create_book_range(e,c,n),[p,t]=Array.from(this.passage.handle_obj(c)),a=a.concat(p);var x=this.adjust_regexp_end(p,o,i.length);x>0&&(this.regexps.escaped_passage.lastIndex-=x)}return[a,t]}adjust_regexp_end(e,s,a){let t=0;return e.length>0?t=s-e[e.length-1].indices[1]-1:s!==a&&(t=s-a),t}replace_match_end(e){let s,a=e.length;for(;s=this.regexps.match_end_split.exec(e);)a=s.index+s[0].length;return a<e.length&&(e=e.substr(0,a)),e}create_book_range(e,s,a){const t=[bcv_parser.prototype.regexps.first,bcv_parser.prototype.regexps.second,bcv_parser.prototype.regexps.third],r=parseInt(this.passage.books[a].parsed[0].substr(0,1),10);for(let o=1,l=r,u=1<=l;u?o<l:o>l;u?o++:o--){var i=o===r-1?bcv_parser.prototype.regexps.range_and:bcv_parser.prototype.regexps.range_only,n=e.match(new RegExp(`(?:^|\\W)(${t[o-1]}\\s*${i}\\s*)\\x1f${a}\\x1f`,"i"));if(null!=n)return this.add_book_range_object(s,n,o)}return!1}add_book_range_object(e,s,a){const{length:t}=s[1];if(e.value[0]={type:"b_range_pre",value:[{type:"b_pre",value:a.toString(),indices:[s.index,s.index+t]},e.value[0]],indices:[0,e.value[0].indices[1]+t]},e.value[0].value[1].indices[0]+=t,e.value[0].value[1].indices[1]+=t,e.start_index-=t,e.match=s[1]+e.match,1!==e.value.length)return(()=>{const s=[];for(let a=1,r=e.value.length,i=1<=r;i?a<r:a>r;i?a++:a--)null!=e.value[a].value&&(null!=(null!=e.value[a].value[0]?e.value[a].value[0].indices:void 0)&&(e.value[a].value[0].indices[0]+=t,e.value[a].value[0].indices[1]+=t),e.value[a].indices[0]+=t,s.push(e.value[a].indices[1]+=t));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 a={osis:s.osis,translations:s.translations,indices:s.indices};null!=s.osises&&(a.osises=s.osises),e.push(a)}return e}parsed_entities(){let e=[];for(let f=0,v=this.entities.length,b=0<=v;b?f<v:f>v;b?f++:f--){var s=this.entities[f];if(s.type&&"translation_sequence"===s.type&&e.length>0&&f===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 a=[],t=null;if(null!=s.passages[0].translations)for(var r of Array.from(s.passages[0].translations)){var i=(null!=r.osis?r.osis.length:void 0)>0?r.osis:"";null==t&&(t=r.alias),a.push(i)}else a=[""],t="default";for(var n=[],o=[],{length:l}=s.passages,u=0,c=u,x=l,p=0<=x;p?u<x:u>x;p?u++:u--,c=u){var g=s.passages[c];if(null==g.type&&(g.type=s.type),!1!==g.valid.valid||("ignore"===this.options.invalid_sequence_strategy&&"sequence"===s.type&&this.snap_sequence("ignore",s,n,c,l),"ignore"!==this.options.invalid_passage_strategy))if("b"!==g.type&&"b_range"!==g.type||"ignore"!==this.options.book_sequence_strategy||"sequence"!==s.type)if("b_range_start"!==g.type&&"range_end_b"!==g.type||"ignore"!==this.options.book_range_strategy||this.snap_range(s,c),null==g.absolute_indices&&(g.absolute_indices=s.absolute_indices),"separate-chapters"===this.options.consecutive_combination_strategy&&g.start.c!==g.end.c){const e=this.get_osises_by_chapter({osis:"",start:g.start,end:g.end},t);n.push({osis:g.valid.valid?this.to_osis(g.start,g.end,t):"",osises:e,type:g.type,indices:g.absolute_indices,translations:a,start:g.start,end:g.end,enclosed_indices:g.enclosed_absolute_indices,entity_id:f,entities:[g]})}else n.push({osis:g.valid.valid?this.to_osis(g.start,g.end,t):"",type:g.type,indices:g.absolute_indices,translations:a,start:g.start,end:g.end,enclosed_indices:g.enclosed_absolute_indices,entity_id:f,entities:[g]});else this.snap_sequence("book",s,n,c,l)}if(0!==n.length||0!==o.length){if("combine"!==this.options.consecutive_combination_strategy&&"separate-chapters"!==this.options.consecutive_combination_strategy||(n.length>1&&(n=this.combine_consecutive_passages(n,t)),n=n.concat(o).sort(((e,s)=>e.indices[0]-s.indices[0]))),"separate-chapters"===this.options.consecutive_combination_strategy)for(h of Array.from(n)){if(0===h.osis.length)continue;const e=this.get_osises_by_chapter(h,t);e.length>1&&(h.osises=e)}if("separate"===this.options.sequence_combination_strategy)e=e.concat(n);else{var h,_=[],d=n.length-1;for(h of(null!=n[d].enclosed_indices&&n[d].enclosed_indices[1]>=0&&(s.absolute_indices[1]=n[d].enclosed_indices[1]),Array.from(n)))h.osis.length>0&&_.push(h.osis);let r=[];if("separate-chapters"===this.options.consecutive_combination_strategy)for(h of Array.from(n))0!==h.osis.length&&(r=null!=h.osises?r.concat(h.osises):r.concat(this.get_osises_by_chapter(h,t)));const i={osis:_.join(","),indices:s.absolute_indices,translations:a,entity_id:f,entities:n};r.length>0&&(i.osises=r),e.push(i)}}}}return e}to_osis(e,s,a){let t;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[a].chapters[s.b]&&1===this.passage.translations[a].chapters[s.b].length?s.c=this.passage.translations[a].chapters[s.b].length:s.c=999),null==s.v&&(null!=this.passage.translations[a].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0?s.v=this.passage.translations[a].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,a),"b"===this.options.osis_compaction_strategy&&1===e.c&&1===e.v&&(999===s.c&&999===s.v||s.c===this.passage.translations[a].chapters[s.b].length&&this.options.passage_existence_strategy.indexOf("c")>=0&&(999===s.v||s.v===this.passage.translations[a].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[a].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()),t=r.start===r.end?r.start:r.start+"-"+r.end,null!=e.extra&&(t=e.extra+","+t),null!=s.extra&&(t+=","+s.extra),t}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 a=[];for(let t=e.start.c,r=e.end.c,i=e.start.c<=r;i?t<=r:t>=r;i?t++:t--){const r=t===e.start.c?e.start.v:1,i=t===e.end.c?e.end.v:this.translations[s].chapters[e.start.b][t-1],n={b:e.start.b,c:t,v:"bcv"===e.start.type?r:null,type:e.start.type},o={b:e.end.b,c:t,v:"bcv"===e.start.type?i:null,type:e.start.type};a.push(this.to_osis(n,o,s))}return a}fix_ps151(e,s,a){return"default"!==a&&null==(null!=this.translations[a]?this.translations[a].chapters.Ps151:void 0)&&this.passage.promote_book_to_translation("Ps151",a),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[a].chapters.Ps151[0]},a),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},a),s.c=150,s.v=this.passage.translations[a].chapters.Ps[149])}combine_consecutive_passages(e,s){const a=[];let t={};const r=e.length-1;let i=-1,n=!1;for(let c=0,x=r,p=0<=x;p?c<=x:c>=x;p?c++:c--){var o=e[c];if(o.osis.length>0){var l=a.length-1,u=!1;o.enclosed_indices[0]!==i&&(i=o.enclosed_indices[0]),i>=0&&(c===r||e[c+1].enclosed_indices[0]!==o.enclosed_indices[0])&&(u=!0,n=!0),this.is_verse_consecutive(t,o.start,s)?(a[l].end=o.end,a[l].is_enclosed_last=u,a[l].indices[1]=o.indices[1],a[l].enclosed_indices[1]=o.enclosed_indices[1],a[l].osis=this.to_osis(a[l].start,o.end,s)):a.push(o),t={b:o.end.b,c:o.end.c,v:o.end.v}}else a.push(o),t={}}return n&&this.snap_enclosed_indices(a),a}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,a){if(null==e.b)return!1;const t=null!=this.passage.translations[a].order?this.passage.translations[a].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[a].chapters[e.b][e.c-1])return!0}else if(1===s.c&&1===s.v&&t[e.b]===t[s.b]-1&&e.c===this.passage.translations[a].chapters[e.b].length&&e.v===this.passage.translations[a].chapters[e.b][e.c-1])return!0;return!1}snap_range(e,s){let a,t,r;"b_range_start"===e.type||"sequence"===e.type&&"b_range_start"===e.passages[s].type?(a=1,t="end",r="b_range_start"):(a=0,t="start",r="range_end_b");const i="end"===t?"start":"end";for(var n of Object.keys(e.passages[s][i]||{}))e.passages[s][i][n]=e.passages[s][t][n];if("sequence"===e.type){s>=e.value.length&&(s=e.value.length-1);const a=this.passage.pluck(r,e.value[s]);if(null!=a){const t=this.snap_range(a,0);0===s?e.absolute_indices[0]=t.absolute_indices[0]:e.absolute_indices[1]=t.absolute_indices[1]}}else e.original_type=e.type,e.type=e.value[a].type,e.absolute_indices=[e.value[a].absolute_indices[0],e.value[a].absolute_indices[1]];return e}snap_sequence(e,s,a,t,r){const i=s.passages[t];return i.absolute_indices[0]===s.absolute_indices[0]&&t<r-1&&this.get_snap_sequence_i(s.passages,t,r)!==t?(s.absolute_indices[0]=s.passages[t+1].absolute_indices[0],this.remove_absolute_indices(s.passages,t+1)):i.absolute_indices[1]===s.absolute_indices[1]&&t>0?s.absolute_indices[1]=a.length>0?a[a.length-1].indices[1]:s.passages[t-1].absolute_indices[1]:"book"===e&&t<r-1&&!this.starts_with_book(s.passages[t+1])&&(s.passages[t+1].absolute_indices[0]=i.absolute_indices[0]),s}get_snap_sequence_i(e,s,a){for(let t=s+1,r=t,i=a,n=t<=i;n?r<i:r>i;n?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[a,t]=Array.from(e[s].enclosed_absolute_indices);for(var r of Array.from(e.slice(s))){if(r.enclosed_absolute_indices[0]!==a||r.enclosed_absolute_indices[1]!==t)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,a){for(var t of(null==s&&(s=[]),null==a&&(a={}),Array.from(e)))if(null!=t){if("stop"===t.type)break;[s,a]=Array.from(this.handle_obj(t,s,a))}return[s,a]}handle_obj(e,s,a){return null!=e.type&&null!=this[e.type]?this[e.type](e,s,a):[s,a]}b(e,s,a){let t;e.start_context=bcv_utils.shallow_clone(a),e.passages=[];const r=[];for(t of Array.from(this.books[e.value].parsed)){var i=this.validate_ref(e.start_context.translations,{b:t}),n={start:{b:t},end:{b:t},valid:i};0===e.passages.length&&i.valid?e.passages.push(n):r.push(n)}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),a={b:e.passages[0].start.b},null!=e.start_context.translations&&(a.translations=e.start_context.translations),[s,a]}b_range(e,s,a){return this.range(e,s,a)}b_range_pre(e,s,a){let t,r;e.start_context=bcv_utils.shallow_clone(a),e.passages=[];const i=this.pluck("b",e.value);t=this.b(i,[],a),[r]=Array.from(t[0]),a=t[1],null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices));const n={b:e.value[0].value+r.passages[0].start.b.substr(1),type:"b"};return e.passages=[{start:n,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,a]}b_range_start(e,s,a){return this.range(e,s,a)}base(e,s,a){return this.indices=this.calculate_indices(e.match,e.start_index),this.handle_array(e.value,s,a)}bc(e,s,a){e.start_context=bcv_utils.shallow_clone(a),e.passages=[],this.reset_context(a,["b","c","v"]);const t=this.pluck("c",e.value).value,r=[];for(var i of Array.from(this.books[this.pluck("b",e.value).value].parsed)){var n="c",o=this.validate_ref(e.start_context.translations,{b:i,c:t}),l={start:{b:i},end:{b:i},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:i,v:t}),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,n="v"),l.start[n]=t,[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[n]=l.start[n],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(a,["b","c","v"],e.passages[0].start),s.push(e),[s,a]}bc_title(e,s,a){let t,r;if(e.start_context=bcv_utils.shallow_clone(a),t=this.bc(this.pluck("bc",e.value),[],a),[r]=Array.from(t[0]),a=t[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,a=0<=s;a?e<s:e>s;a?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,a];this.books[this.pluck("b",r.value).value].parsed=["Ps"];let i=this.pluck("title",e.value);return null==i&&(i=this.pluck("v",e.value)),e.value[1]={type:"v",value:[{type:"integer",value:1,indices:i.indices}],indices:i.indices},e.type="bcv",this.bcv(e,s,e.start_context)}bcv(e,s,a){e.start_context=bcv_utils.shallow_clone(a),e.passages=[],this.reset_context(a,["b","c","v"]);const t=this.pluck("bc",e.value);let r=this.pluck("c",t.value).value,i=this.pluck("v",e.value).value;const n=[];for(var o of Array.from(this.books[this.pluck("b",t.value).value].parsed)){var l=this.validate_ref(e.start_context.translations,{b:o,c:r,v:i});[r,i]=Array.from(this.fix_start_zeroes(l,r,i));var u={start:{b:o,c:r,v:i},end:{b:o,c:r,v:i},valid:l};0===e.passages.length&&l.valid?e.passages.push(u):n.push(u)}return 0===e.passages.length&&e.passages.push(n.shift()),n.length>0&&(e.passages[0].alternates=n),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(a,["b","c","v"],e.passages[0].start),s.push(e),[s,a]}bv(e,s,a){let t;e.start_context=bcv_utils.shallow_clone(a);const[r,i]=Array.from(e.value);let n={indices:e.indices,value:[{type:"bc",value:[r,{type:"c",value:[{type:"integer",value:1}]}]},i]};return t=this.bcv(n,[],a),[n]=Array.from(t[0]),a=t[1],e.passages=n.passages,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),[s,a]}c(e,s,a){e.start_context=bcv_utils.shallow_clone(a);let t="integer"===e.type?e.value:this.pluck("integer",e.value).value;const r=this.validate_ref(e.start_context.translations,{b:a.b,c:t});return!r.valid&&r.messages.start_chapter_not_exist_in_single_chapter_book?this.v(e,s,a):([t]=Array.from(this.fix_start_zeroes(r,t)),e.passages=[{start:{b:a.b,c:t},end:{b:a.b,c:t},valid:r}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),a.c=t,this.reset_context(a,["v"]),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,a])}c_psalm(e,s,a){e.type="bc";const t=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:t,indices:e.indices}],indices:e.indices}],this.bc(e,s,a)}c_title(e,s,a){if(e.start_context=bcv_utils.shallow_clone(a),"Ps"!==a.b)return this.c(e.value[0],s,a);const t=this.pluck("title",e.value);return e.value[1]={type:"v",value:[{type:"integer",value:1,indices:t.indices}],indices:t.indices},e.type="cv",this.cv(e,s,e.start_context)}cv(e,s,a){e.start_context=bcv_utils.shallow_clone(a);let t=this.pluck("c",e.value).value,r=this.pluck("v",e.value).value;const i=this.validate_ref(e.start_context.translations,{b:a.b,c:t,v:r});return[t,r]=Array.from(this.fix_start_zeroes(i,t,r)),e.passages=[{start:{b:a.b,c:t,v:r},end:{b:a.b,c:t,v:r},valid:i}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),a.c=t,a.v=r,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,a]}cb_range(e,s,a){e.type="range";const[t,r,i]=Array.from(e.value);return e.value=[{type:"bc",value:[t,r],indices:e.indices},i],i.indices[1]=e.indices[1],this.range(e,s,a)}context(e,s,a){for(var t of(e.start_context=bcv_utils.shallow_clone(a),e.passages=[],Object.keys(this.books[e.value].context||{})))a[t]=this.books[e.value].context[t];return s.push(e),[s,a]}cv_psalm(e,s,a){e.start_context=bcv_utils.shallow_clone(a),e.type="bcv";const[t,r]=Array.from(e.value),i=this.c_psalm(t,[],e.start_context),[n]=Array.from(i[0]);return e.value=[n,r],this.bcv(e,s,a)}ff(e,s,a){let t;return e.start_context=bcv_utils.shallow_clone(a),e.value.push({type:"integer",indices:e.indices,value:999}),t=this.range(e,[],e.start_context),[e]=Array.from(t[0]),a=t[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,a]}integer_title(e,s,a){return e.start_context=bcv_utils.shallow_clone(a),"Ps"!==a.b?this.integer(e.value[0],s,a):(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,a){return null!=a.v?this.v(e,s,a):this.c(e,s,a)}next_v(e,s,a){let t,r;e.start_context=bcv_utils.shallow_clone(a);let i=this.pluck_last_recursively("integer",e.value);if(null==i&&(i={value:1}),e.value.push({type:"integer",indices:e.indices,value:i.value+1}),t=this.range(e,[],e.start_context),[r]=Array.from(t[0]),a=t[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!=a.c){let s;e.value.pop(),e.value.push({type:"cv",indices:e.indices,value:[{type:"c",value:[{type:"integer",value:a.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]),a=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,a]}sequence(e,s,a){for(var t of(e.start_context=bcv_utils.shallow_clone(a),e.passages=[],Array.from(e.value))){var r,i;for(var n of(r=this.handle_array(t,[],a),[i]=Array.from(r[0]),a=r[1],Array.from(i.passages)))null==n.type&&(n.type=i.type),null==n.absolute_indices&&(n.absolute_indices=i.absolute_indices),null!=i.start_context.translations&&(n.translations=i.start_context.translations),n.enclosed_absolute_indices="sequence_post_enclosed"===i.type?i.absolute_indices:[-1,-1],e.passages.push(n)}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,a]}sequence_post_enclosed(e,s,a){return this.sequence(e,s,a)}v(e,s,a){let t,r="integer"===e.type?e.value:this.pluck("integer",e.value).value;e.start_context=bcv_utils.shallow_clone(a);const i=null!=a.c?a.c:1,n=this.validate_ref(e.start_context.translations,{b:a.b,c:i,v:r});return[t,r]=Array.from(this.fix_start_zeroes(n,0,r)),e.passages=[{start:{b:a.b,c:i,v:r},end:{b:a.b,c:i,v:r},valid:n}],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),a.v=r,[s,a]}range(e,s,a){let t,r;e.start_context=bcv_utils.shallow_clone(a);let[i,n]=Array.from(e.value);if(t=this.handle_obj(i,[],a),[i]=Array.from(t[0]),a=t[1],"v"===n.type&&("bc"===i.type&&!__guard__(__guard__(__guard__(null!=i.passages?i.passages[0]:void 0,(e=>e.valid)),(e=>e.messages)),(e=>e.start_chapter_not_exist_in_single_chapter_book))||"c"===i.type)&&"verse"===this.options.end_range_digits_strategy)return e.value[0]=i,this.range_change_integer_end(e,s);r=this.handle_obj(n,[],a),[n]=Array.from(r[0]),a=r[1],e.value=[i,n],e.indices=[i.indices[0],n.indices[1]],delete e.absolute_indices;const o={b:i.passages[0].start.b,c:i.passages[0].start.c,v:i.passages[0].start.v,type:i.type},l={b:n.passages[0].end.b,c:n.passages[0].end.c,v:n.passages[0].end.v,type:n.type};n.passages[0].valid.messages.start_chapter_is_zero&&(l.c=0),n.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,i,o,n,l,s);{const[a,t]=Array.from(this.range_handle_valid(u,e,i,o,n,l,s));if(a)return t}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,a]}range_change_end(e,s,a){let t;const[r,i]=Array.from(e.value);return"integer"===i.type?(i.original_value=i.value,i.value=a):"v"===i.type?(t=this.pluck("integer",i.value),t.original_value=t.value,t.value=a):"cv"===i.type&&(t=this.pluck("c",i.value),t.original_value=t.value,t.value=a),this.handle_obj(e,s,e.start_context)}range_change_integer_end(e,s){const[a,t]=Array.from(e.value);return null==e.original_type&&(e.original_type=e.type),null==e.original_value&&(e.original_value=[a,t]),e.type="integer"===a.type?"cv":a.type+"v","integer"===a.type&&(e.value[0]={type:"c",value:[a],indices:a.indices}),"integer"===t.type&&(e.value[1]={type:"v",value:[t],indices:t.indices}),this.handle_obj(e,s,e.start_context)}range_check_new_end(e,s,a,t){let r=0,i=null;if(t.messages.end_chapter_before_start?i="c":t.messages.end_verse_before_start&&(i="v"),null!=i&&(r=this.range_get_new_end_value(s,a,t,i)),r>0){const s={b:a.b,c:a.c,v:a.v};s[i]=r;this.validate_ref(e,s).valid||(r=0)}return r}range_end_b(e,s,a){return this.range(e,s,a)}range_get_new_end_value(e,s,a,t){let r=0;return"c"===t&&a.messages.end_chapter_is_zero||"v"===t&&a.messages.end_verse_is_zero||(e[t]>=10&&s[t]<10&&e[t]-10*Math.floor(e[t]/10)<s[t]?r=s[t]+10*Math.floor(e[t]/10):e[t]>=100&&s[t]<100&&e[t]-100<s[t]&&(r=s[t]+100)),r}range_handle_invalid(e,s,a,t,r,i,n){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 a=this.range_check_new_end(s.start_context.translations,t,i,e);if(a>0)return this.range_change_end(s,n,a)}if("verse"===this.options.end_range_digits_strategy&&null==t.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:t.b,c:t.c,v:e}).valid)return this.range_change_integer_end(s,n)}return null==s.original_type&&(s.original_type=s.type),s.type="sequence",[s.original_value,s.value]=Array.from([[a,r],[[a],[r]]]),this.sequence(s,n,s.start_context)}range_handle_valid(e,s,a,t,r,i,n){if(e.messages.end_chapter_not_exist&&"verse"===this.options.end_range_digits_strategy&&null==t.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:t.b,c:t.c,v:e}).valid)return[!0,this.range_change_integer_end(s,n)]}return this.range_validate(e,t,i,s),[!1,null]}range_validate(e,s,a,t){return e.messages.end_chapter_not_exist||e.messages.end_chapter_not_exist_in_single_chapter_book?(a.original_c=a.c,a.c=e.messages.end_chapter_not_exist?e.messages.end_chapter_not_exist:e.messages.end_chapter_not_exist_in_single_chapter_book,null!=a.v&&(a.v=this.validate_ref(t.start_context.translations,{b:a.b,c:a.c,v:999}).messages.end_verse_not_exist,delete e.messages.end_verse_is_zero)):e.messages.end_verse_not_exist&&(a.original_v=a.v,a.v=e.messages.end_verse_not_exist),e.messages.end_verse_is_zero&&"allow"!==this.options.zero_verse_strategy&&(a.v=e.messages.end_verse_is_zero),e.messages.end_chapter_is_zero&&(a.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,a){e.start_context=bcv_utils.shallow_clone(a);const t=[];for(var r of(t.push({translation:this.books[e.value[0].value].parsed}),Array.from(e.value[1])))null!=(r=this.books[this.pluck("translation",r).value].parsed)&&t.push({translation:r});for(var i of Array.from(t))null!=this.translations.aliases[i.translation]?(i.alias=this.translations.aliases[i.translation].alias,i.osis=this.translations.aliases[i.translation].osis||i.translation.toUpperCase()):(i.alias="default",i.osis=i.translation.toUpperCase());return s.length>0&&(a=this.translation_sequence_apply(s,t)),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),this.reset_context(a,["translations"]),[s,a]}translation_sequence_apply(e,s){let a,t=0;for(let s=e.length-1,a=s,r=s<=0;r?a<=0:a>=0;r?a++:a--)if(null!=e[a].original_type&&(e[a].type=e[a].original_type),null!=e[a].original_value&&(e[a].value=e[a].original_value),"translation_sequence"===e[a].type){t=a+1;break}if(t<e.length){let r;e[t].start_context.translations=s,[r,a]=Array.from(this.handle_array(e.slice(t),[],e[t].start_context))}else a=bcv_utils.shallow_clone(e[e.length-1].start_context);return a}pluck(e,s){for(var a of Array.from(s))if(null!=a&&null!=a.type&&a.type===e)return"c"===e||"v"===e?this.pluck("integer",a.value):a;return null}pluck_last_recursively(e,s){for(let r=s.length-1;r>=0;r--){var a=s[r];if(null!=a&&null!=a.type){if(a.type===e)return this.pluck(e,[a]);var t=this.pluck_last_recursively(e,a.value);if(null!=t)return t}}return null}set_context_from_object(e,s,a){return(()=>{const t=[];for(var r of Array.from(s))null!=a[r]&&t.push(e[r]=a[r]);return t})()}reset_context(e,s){return Array.from(s).map((s=>delete e[s]))}fix_start_zeroes(e,s,a){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&&(a=e.messages.start_verse_is_zero),[s,a]}calculate_indices(e,s){let a,t="book";const r=[];let i=0;s=parseInt(s,10);let n=[e];for(var o of["",""]){var l=[];for(a of Array.from(n))l=l.concat(a.split(o));n=l}for(a of Array.from(n)){var u;t="book"===t?"rest":"book";var c=a.length;0!==c&&("book"===t?(a=a.replace(/\/\d+$/,""),u=i+c,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:i,end:u,index:s}),i+=c+2,s=this.books[a].start_index+this.books[a].value.length-i,r.push({start:u+1,end:u+1,index:s})):(u=i+c-1,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:i,end:u,index:s}),i+=c))}return r}get_absolute_indices(...e){const[s,a]=Array.from(e[0]);let t=null,r=null;for(var i of Array.from(this.indices))if(null===t&&i.start<=s&&s<=i.end&&(t=s+i.index),i.start<=a&&a<=i.end){r=a+i.index+1;break}return[t,r]}validate_ref(e,s,a){null!=e&&e.length>0||(e=[{translation:"default",osis:"",alias:"default"}]);let t=!1;const r={};for(var i of Array.from(e))if(null==i.alias&&(i.alias="default"),null!=i.alias){null==this.translations.aliases[i.alias]&&(i.alias="default",null==r.translation_unknown&&(r.translation_unknown=[]),r.translation_unknown.push(i));var[n]=Array.from(this.validate_start_ref(i.alias,s,r));a&&([n]=Array.from(this.validate_end_ref(i.alias,s,a,n,r))),!0===n&&(t=!0)}else null==r.translation_invalid&&(r.translation_invalid=[]),r.translation_invalid.push(i);return{valid:t,messages:r}}validate_start_ref(e,s,a){let t=!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 t=!1,a.start_chapter_not_numeric=!0,[t,a];0===s.c&&(a.start_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?t=!1:s.c=1),null!=s.v&&0===s.v&&(a.start_verse_is_zero=1,"error"===this.options.zero_verse_strategy?t=!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)?(t=!1,a.start_verse_not_numeric=!0):s.v>this.translations[e].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(t=!1,a.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&&(a.start_chapter_1=1):1!==s.c&&1===this.translations[e].chapters[s.b].length?(t=!1,a.start_chapter_not_exist_in_single_chapter_book=1):s.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(t=!1,a.start_chapter_not_exist=this.translations[e].chapters[s.b].length)}else null==s.b?(t=!1,a.start_book_not_defined=!0):(this.options.passage_existence_strategy.indexOf("b")>=0&&(t=!1),a.start_book_not_exist=!0);return[t,a]}validate_end_ref(e,s,a,t,r){const i=null!=(null!=this.translations[e]?this.translations[e].order:void 0)?e:"default";return null!=a.c&&(a.c=parseInt(a.c,10),isNaN(a.c)?(t=!1,r.end_chapter_not_numeric=!0):0===a.c&&(r.end_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?t=!1:a.c=1)),null!=a.v&&(a.v=parseInt(a.v,10),isNaN(a.v)?(t=!1,r.end_verse_not_numeric=!0):0===a.v&&(r.end_verse_is_zero=1,"error"===this.options.zero_verse_strategy?t=!1:"upgrade"===this.options.zero_verse_strategy&&(a.v=1))),null!=this.translations[i].order[a.b]?(null==a.c&&1===this.translations[e].chapters[a.b].length&&(a.c=1),null!=this.translations[i].order[s.b]&&this.translations[i].order[s.b]>this.translations[i].order[a.b]&&(this.options.passage_existence_strategy.indexOf("b")>=0&&(t=!1),r.end_book_before_start=!0),s.b!==a.b||null==a.c||isNaN(a.c)||(null==s.c&&(s.c=1),!isNaN(parseInt(s.c,10))&&s.c>a.c?(t=!1,r.end_chapter_before_start=!0):s.c!==a.c||null==a.v||isNaN(a.v)||(null==s.v&&(s.v=1),!isNaN(parseInt(s.v,10))&&s.v>a.v&&(t=!1,r.end_verse_before_start=!0))),null==a.c||isNaN(a.c)||null==this.translations[e].chapters[a.b][a.c-1]&&(1===this.translations[e].chapters[a.b].length?r.end_chapter_not_exist_in_single_chapter_book=1:a.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(r.end_chapter_not_exist=this.translations[e].chapters[a.b].length)),null==a.v||isNaN(a.v)||(null==a.c&&(a.c=this.translations[e].chapters[a.b].length),a.v>this.translations[e].chapters[a.b][a.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(r.end_verse_not_exist=this.translations[e].chapters[a.b][a.c-1]))):(t=!1,r.end_book_not_exist=!0),[t,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 a of Object.keys(e||{})){const t=e[a];s[a]=t}return s},shallow_clone_array(e){if(null==e)return e;const s=[];for(let a=0,t=e.length,r=0<=t;r?a<=t:a>=t;r?a++:a--)void 0!==e[a]&&(s[a]=e[a]);return s}};bcv_parser.prototype.regexps.translations=RegExp("(?:(?:NP))\\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=["pl"];const heregex=e=>{let s="",a=!1,t=!1;for(let r=0;r<e.length;r++){const i=e[r];if(t)s+=i,t=!1;else if("\\"!==i)if(a||"["!==i)if(a&&"]"===i)a=!1,s+=i;else if(a||"#"!==i)!a&&/\s/.test(i)||(s+=i);else for(;r<e.length&&"\n"!==e[r];)r+=1;else a=!0,s+=i;else s+=i,t=!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/pt-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 = `(?:Primeir[ao]|1[ao]?|I)\\.?${bcv_parser.prototype.regexps.space}*`;
|
|
2550
2598
|
bcv_parser.prototype.regexps.second = `(?:Segund[ao]|2[ao]?|II)\\.?${bcv_parser.prototype.regexps.space}*`;
|
|
2551
2599
|
bcv_parser.prototype.regexps.third = `(?:Terceir[ao]|3[ao]?|III)\\.?${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-]|e(?!${bcv_parser.prototype.regexps.space}+sig)|á)`;
|
|
2601
|
+
bcv_parser.prototype.regexps.range_only = `(?:[\\u2013\\u2014-]|á)`;
|
|
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 = [
|