bible-ref-parse 3.3.0 → 3.3.2
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 +90 -11
- package/dist/am-bcv-parser.min.js +1 -1
- package/dist/ar-bcv-parser.js +90 -11
- package/dist/ar-bcv-parser.min.js +2 -2
- package/dist/bb-bcv-parser.js +90 -11
- package/dist/bb-bcv-parser.min.js +2 -2
- package/dist/bg-bcv-parser.js +90 -11
- package/dist/bg-bcv-parser.min.js +2 -2
- package/dist/bn-bcv-parser.js +90 -11
- package/dist/bn-bcv-parser.min.js +2 -2
- package/dist/ceb-bcv-parser.js +90 -11
- package/dist/ceb-bcv-parser.min.js +2 -2
- package/dist/cs-bcv-parser.js +90 -11
- package/dist/cs-bcv-parser.min.js +2 -2
- package/dist/da-bcv-parser.js +90 -11
- package/dist/da-bcv-parser.min.js +2 -2
- package/dist/de-bcv-parser.js +90 -11
- package/dist/de-bcv-parser.min.js +1 -1
- package/dist/ee-bcv-parser.js +90 -11
- package/dist/ee-bcv-parser.min.js +1 -1
- package/dist/el-bcv-parser.js +90 -11
- package/dist/el-bcv-parser.min.js +1 -1
- package/dist/en-bcv-parser.js +90 -11
- package/dist/en-bcv-parser.min.js +2 -2
- package/dist/es-bcv-parser.js +90 -11
- package/dist/es-bcv-parser.min.js +1 -1
- package/dist/fa-bcv-parser.js +90 -11
- package/dist/fa-bcv-parser.min.js +2 -2
- package/dist/fi-bcv-parser.js +90 -11
- package/dist/fi-bcv-parser.min.js +2 -2
- package/dist/fr-bcv-parser.js +90 -11
- package/dist/fr-bcv-parser.min.js +2 -2
- package/dist/he-bcv-parser.js +90 -11
- package/dist/he-bcv-parser.min.js +1 -1
- package/dist/hi-bcv-parser.js +90 -11
- package/dist/hi-bcv-parser.min.js +2 -2
- package/dist/hl-bcv-parser.js +90 -11
- package/dist/hl-bcv-parser.min.js +2 -2
- package/dist/hr-bcv-parser.js +90 -11
- package/dist/hr-bcv-parser.min.js +2 -2
- package/dist/ht-bcv-parser.js +90 -11
- package/dist/ht-bcv-parser.min.js +2 -2
- package/dist/hu-bcv-parser.js +90 -11
- package/dist/hu-bcv-parser.min.js +2 -2
- package/dist/id-bcv-parser.js +91 -12
- package/dist/id-bcv-parser.min.js +3 -3
- package/dist/il-bcv-parser.js +90 -11
- package/dist/il-bcv-parser.min.js +2 -2
- package/dist/is-bcv-parser.js +90 -11
- package/dist/is-bcv-parser.min.js +2 -2
- package/dist/it-bcv-parser.js +90 -11
- package/dist/it-bcv-parser.min.js +2 -2
- package/dist/ja-bcv-parser.js +90 -11
- package/dist/ja-bcv-parser.min.js +2 -2
- package/dist/jv-bcv-parser.js +90 -11
- package/dist/jv-bcv-parser.min.js +2 -2
- package/dist/ko-bcv-parser.js +90 -11
- package/dist/ko-bcv-parser.min.js +2 -2
- package/dist/la-bcv-parser.js +90 -11
- package/dist/la-bcv-parser.min.js +2 -2
- package/dist/lu-bcv-parser.js +90 -11
- package/dist/lu-bcv-parser.min.js +2 -2
- package/dist/mg-bcv-parser.js +90 -11
- package/dist/mg-bcv-parser.min.js +2 -2
- package/dist/mk-bcv-parser.js +90 -11
- package/dist/mk-bcv-parser.min.js +1 -1
- package/dist/mq-bcv-parser.js +90 -11
- package/dist/mq-bcv-parser.min.js +2 -2
- package/dist/mr-bcv-parser.js +90 -11
- package/dist/mr-bcv-parser.min.js +1 -1
- package/dist/nd-bcv-parser.js +90 -11
- package/dist/nd-bcv-parser.min.js +1 -1
- package/dist/ne-bcv-parser.js +90 -11
- package/dist/ne-bcv-parser.min.js +1 -1
- package/dist/nl-bcv-parser.js +90 -11
- package/dist/nl-bcv-parser.min.js +2 -2
- package/dist/no-bcv-parser.js +90 -11
- package/dist/no-bcv-parser.min.js +2 -2
- package/dist/ny-bcv-parser.js +90 -11
- package/dist/ny-bcv-parser.min.js +2 -2
- package/dist/or-bcv-parser.js +90 -11
- package/dist/or-bcv-parser.min.js +2 -2
- package/dist/pa-bcv-parser.js +90 -11
- package/dist/pa-bcv-parser.min.js +2 -2
- package/dist/pl-bcv-parser.js +90 -11
- package/dist/pl-bcv-parser.min.js +2 -2
- package/dist/pt-bcv-parser.js +90 -11
- package/dist/pt-bcv-parser.min.js +1 -1
- package/dist/ro-bcv-parser.js +90 -11
- package/dist/ro-bcv-parser.min.js +2 -2
- package/dist/ru-bcv-parser.js +90 -11
- package/dist/ru-bcv-parser.min.js +2 -2
- package/dist/rw-bcv-parser.js +90 -11
- package/dist/rw-bcv-parser.min.js +3 -3
- package/dist/si-bcv-parser.js +90 -11
- package/dist/si-bcv-parser.min.js +2 -2
- package/dist/sk-bcv-parser.js +90 -11
- package/dist/sk-bcv-parser.min.js +2 -2
- package/dist/so-bcv-parser.js +90 -11
- package/dist/so-bcv-parser.min.js +2 -2
- package/dist/sq-bcv-parser.js +90 -11
- package/dist/sq-bcv-parser.min.js +2 -2
- package/dist/sr-bcv-parser.js +90 -11
- package/dist/sr-bcv-parser.min.js +2 -2
- package/dist/sv-bcv-parser.js +90 -11
- package/dist/sv-bcv-parser.min.js +2 -2
- package/dist/sw-bcv-parser.js +90 -11
- package/dist/sw-bcv-parser.min.js +2 -2
- package/dist/ta-bcv-parser.js +90 -11
- package/dist/ta-bcv-parser.min.js +2 -2
- package/dist/test/en.spec.js +12 -0
- package/dist/test/id.spec.js +2 -0
- package/dist/th-bcv-parser.js +90 -11
- package/dist/th-bcv-parser.min.js +1 -1
- package/dist/tl-bcv-parser.js +90 -11
- package/dist/tl-bcv-parser.min.js +2 -2
- package/dist/tr-bcv-parser.js +90 -11
- package/dist/tr-bcv-parser.min.js +1 -1
- package/dist/uk-bcv-parser.js +90 -11
- package/dist/uk-bcv-parser.min.js +2 -2
- package/dist/ur-bcv-parser.js +90 -11
- package/dist/ur-bcv-parser.min.js +1 -1
- package/dist/vi-bcv-parser.js +90 -11
- package/dist/vi-bcv-parser.min.js +1 -1
- package/dist/zh-bcv-parser.js +90 -11
- package/dist/zh-bcv-parser.min.js +3 -3
- package/dist/zu-bcv-parser.js +90 -11
- package/dist/zu-bcv-parser.min.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const root=this;class bcv_parser{static initClass(){this.prototype.s="",this.prototype.entities=[],this.prototype.passage=null,this.prototype.regexps={},this.prototype.options={consecutive_combination_strategy:"combine",osis_compaction_strategy:"b",book_sequence_strategy:"ignore",invalid_sequence_strategy:"ignore",sequence_combination_strategy:"combine",punctuation_strategy:"us",invalid_passage_strategy:"ignore",non_latin_digits_strategy:"ignore",passage_existence_strategy:"bcv",zero_chapter_strategy:"error",zero_verse_strategy:"error",single_chapter_1_strategy:"chapter",book_alone_strategy:"ignore",book_range_strategy:"ignore",captive_end_digits_strategy:"delete",end_range_digits_strategy:"verse",include_apocrypha:!1,ps151_strategy:"c",versification_system:"default",case_sensitive:"none"}}constructor(){for(var e of(this.options={},Object.keys(bcv_parser.prototype.options||{}))){var s=bcv_parser.prototype.options[e];this.options[e]=s}this.versification_system(this.options.versification_system)}parse(e){return this.reset(),this.s=e,e=this.replace_control_characters(e),[e,this.passage.books]=Array.from(this.match_books(e)),[this.entities]=Array.from(this.match_passages(e)),this}parse_with_context(e,s){let t;return this.reset(),[s,this.passage.books]=Array.from(this.match_books(this.replace_control_characters(s))),[t,s]=Array.from(this.match_passages(s)),this.reset(),this.s=e,e=this.replace_control_characters(e),[e,this.passage.books]=Array.from(this.match_books(e)),this.passage.books.push({value:"",parsed:[],start_index:0,type:"context",context:s}),e=""+(this.passage.books.length-1)+"/9"+e,[this.entities]=Array.from(this.match_passages(e)),this}reset(){return this.s="",this.entities=[],this.passage?(this.passage.books=[],this.passage.indices={}):(this.passage=new bcv_passage,this.passage.options=this.options,this.passage.translations=this.translations)}set_options(e){for(var s of Object.keys(e||{})){var t=e[s];"include_apocrypha"===s||"versification_system"===s||"case_sensitive"===s?this[s](t):this.options[s]=t}return this}include_apocrypha(e){if(null==e||!0!==e&&!1!==e)return this;for(var s of(this.options.include_apocrypha=e,this.regexps.books=this.regexps.get_books(e,this.options.case_sensitive),Object.keys(this.translations||{}))){var t;if("aliases"!==s&&"alternates"!==s)if(null==this.translations[s].chapters&&(this.translations[s].chapters={}),null==this.translations[s].chapters.Ps&&(this.translations[s].chapters.Ps=bcv_utils.shallow_clone_array(this.translations.default.chapters.Ps)),!0===e)t=null!=this.translations[s].chapters.Ps151?this.translations[s].chapters.Ps151[0]:this.translations.default.chapters.Ps151[0],this.translations[s].chapters.Ps[150]=t;else 151===this.translations[s].chapters.Ps.length&&this.translations[s].chapters.Ps.pop()}return this}versification_system(e){let s,t;if(null==e||null==this.translations[e])return this;if(null!=this.translations.alternates.default)if("default"===e)for(s of(null!=this.translations.alternates.default.order&&(this.translations.default.order=bcv_utils.shallow_clone(this.translations.alternates.default.order)),Object.keys(this.translations.alternates.default.chapters||{})))t=this.translations.alternates.default.chapters[s],this.translations.default.chapters[s]=bcv_utils.shallow_clone_array(t);else this.versification_system("default");if(null==this.translations.alternates.default&&(this.translations.alternates.default={order:null,chapters:{}}),"default"!==e&&null!=this.translations[e].order&&(null==this.translations.alternates.default.order&&(this.translations.alternates.default.order=bcv_utils.shallow_clone(this.translations.default.order)),this.translations.default.order=bcv_utils.shallow_clone(this.translations[e].order)),"default"!==e&&null!=this.translations[e].chapters)for(s of Object.keys(this.translations[e].chapters||{}))t=this.translations[e].chapters[s],null==this.translations.alternates.default.chapters[s]&&(this.translations.alternates.default.chapters[s]=bcv_utils.shallow_clone_array(this.translations.default.chapters[s])),this.translations.default.chapters[s]=bcv_utils.shallow_clone_array(t);return this.options.versification_system=e,this.include_apocrypha(this.options.include_apocrypha),this}case_sensitive(e){return null==e||"none"!==e&&"books"!==e||e===this.options.case_sensitive||(this.options.case_sensitive=e,this.regexps.books=this.regexps.get_books(this.options.include_apocrypha,e)),this}translation_info(e){let s;null==e&&(e="default"),null!=e&&null!=(null!=this.translations.aliases[e]?this.translations.aliases[e].alias:void 0)&&(e=this.translations.aliases[e].alias),null!=e&&null!=this.translations[e]||(e="default");const t=this.options.versification_system;e!==t&&this.versification_system(e);const a={alias:e,books:[],chapters:{},order:bcv_utils.shallow_clone(this.translations.default.order)};for(s of Object.keys(this.translations.default.chapters||{})){var r=this.translations.default.chapters[s];a.chapters[s]=bcv_utils.shallow_clone_array(r)}for(s of Object.keys(a.order||{})){var n=a.order[s];a.books[n-1]=s}return e!==t&&this.versification_system(t),a}replace_control_characters(e){return e=(e=(e=e.replace(this.regexps.control," ")).replace(/\uFF1A/g,":")).replace(/\uFF1B/g,";"),"replace"===this.options.non_latin_digits_strategy&&(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/[٠۰߀०০੦૦୦0౦೦൦๐໐༠၀႐០᠐᥆᧐᪀᪐᭐᮰᱀᱐꘠꣐꤀꧐꩐꯰0]/g,"0")).replace(/[١۱߁१১੧૧୧௧౧೧൧๑໑༡၁႑១᠑᥇᧑᪁᪑᭑᮱᱁᱑꘡꣑꤁꧑꩑꯱1]/g,"1")).replace(/[٢۲߂२২੨૨୨௨౨೨൨๒໒༢၂႒២᠒᥈᧒᪂᪒᭒᮲᱂᱒꘢꣒꤂꧒꩒꯲2]/g,"2")).replace(/[٣۳߃३৩੩૩୩௩౩೩൩๓໓༣၃႓៣᠓᥉᧓᪃᪓᭓᮳᱃᱓꘣꣓꤃꧓꩓꯳3]/g,"3")).replace(/[٤۴߄४৪੪૪୪௪౪೪൪๔໔༤၄႔៤᠔᥊᧔᪄᪔᭔᮴᱄᱔꘤꣔꤄꧔꩔꯴4]/g,"4")).replace(/[٥۵߅५৫੫૫୫௫౫೫൫๕໕༥၅႕៥᠕᥋᧕᪅᪕᭕᮵᱅᱕꘥꣕꤅꧕꩕꯵5]/g,"5")).replace(/[٦۶߆६৬੬૬୬௬౬೬൬๖໖༦၆႖៦᠖᥌᧖᪆᪖᭖᮶᱆᱖꘦꣖꤆꧖꩖꯶6]/g,"6")).replace(/[٧۷߇७৭੭૭୭௭౭೭൭๗໗༧၇႗៧᠗᥍᧗᪇᪗᭗᮷᱇᱗꘧꣗꤇꧗꩗꯷7]/g,"7")).replace(/[٨۸߈८৮੮૮୮௮౮೮൮๘໘༨၈႘៨᠘᥎᧘᪈᪘᭘᮸᱈᱘꘨꣘꤈꧘꩘꯸8]/g,"8")).replace(/[٩۹߉९৯੯૯୯௯౯೯൯๙໙༩၉႙៩᠙᥏᧙᪉᪙᭙᮹᱉᱙꘩꣙꤉꧙꩙꯹9]/g,"9")),e}match_books(e){const s=[];for(var t of Array.from(this.regexps.books)){var a=!1;if(e=e.replace(t.regexp,(function(e,r,n){a=!0,s.push({value:n,parsed:t.osis,type:"book"});const i=null!=t.extra?`/${t.extra}`:"";return`${r}${s.length-1}${i}`})),!0===a&&/^[\s\x1f\d:.,;\-\u2013\u2014]+$/.test(e))break}return[e=e.replace(this.regexps.translations,(function(e){return s.push({value:e,parsed:e.toLowerCase(),type:"translation"}),`${s.length-1}`})),this.get_book_indices(s,e)]}get_book_indices(e,s){let t,a=0;const r=new RegExp("([\\x1f\\x1e])(\\d+)(?:/\\d+)?\\1","g");for(;t=r.exec(s);)e[t[2]].start_index=t.index+a,a+=e[t[2]].value.length-t[0].length;return e}match_passages(e){let s,t=[],a={};for(;s=this.regexps.escaped_passage.exec(e);){let g;var[r,n,i]=Array.from(s),o=n.length;if(s.index+=r.length-o,/\s[2-9]\d\d\s*$|\s\d{4,}\s*$/.test(n)&&(n=n.replace(/\s+\d+\s*$/,"")),/[\d\x1f\x1e)]$/.test(n)||(n=this.replace_match_end(n)),"delete"===this.options.captive_end_digits_strategy){var l=s.index+n.length;e.length>l&&/^\w/.test(e.substr(l,1))&&(n=n.replace(/[\s*]+\d+$/,"")),n=n.replace(/(\x1e[)\]]?)[\s*]*\d+$/,"$1")}var u=""===(n=n.replace(/[A-Z]+/g,(e=>e.toLowerCase()))).substr(0,1)?0:n.split("")[0].length,c={value:grammar.parse(n,{punctuation_strategy:this.options.punctuation_strategy}),type:"base",start_index:this.passage.books[i].start_index-u,match:n};"full"===this.options.book_alone_strategy&&"include"===this.options.book_range_strategy&&"b"===c.value[0].type&&(1===c.value.length||c.value.length>1&&"translation_sequence"===c.value[1].type)&&0===u&&(1===this.passage.books[i].parsed.length||this.passage.books[i].parsed.length>1&&"translation"===this.passage.books[i].parsed[1].type)&&/^[234]/.test(this.passage.books[i].parsed[0])&&this.create_book_range(e,c,i),[g,a]=Array.from(this.passage.handle_obj(c)),t=t.concat(g);var p=this.adjust_regexp_end(g,o,n.length);p>0&&(this.regexps.escaped_passage.lastIndex-=p)}return[t,a]}adjust_regexp_end(e,s,t){let a=0;return e.length>0?a=s-e[e.length-1].indices[1]-1:s!==t&&(a=s-t),a}replace_match_end(e){let s,t=e.length;for(;s=this.regexps.match_end_split.exec(e);)t=s.index+s[0].length;return t<e.length&&(e=e.substr(0,t)),e}create_book_range(e,s,t){const a=[bcv_parser.prototype.regexps.first,bcv_parser.prototype.regexps.second,bcv_parser.prototype.regexps.third],r=parseInt(this.passage.books[t].parsed[0].substr(0,1),10);for(let o=1,l=r,u=1<=l;u?o<l:o>l;u?o++:o--){var n=o===r-1?bcv_parser.prototype.regexps.range_and:bcv_parser.prototype.regexps.range_only,i=e.match(new RegExp(`(?:^|\\W)(${a[o-1]}\\s*${n}\\s*)\\x1f${t}\\x1f`,"i"));if(null!=i)return this.add_book_range_object(s,i,o)}return!1}add_book_range_object(e,s,t){const{length:a}=s[1];if(e.value[0]={type:"b_range_pre",value:[{type:"b_pre",value:t.toString(),indices:[s.index,s.index+a]},e.value[0]],indices:[0,e.value[0].indices[1]+a]},e.value[0].value[1].indices[0]+=a,e.value[0].value[1].indices[1]+=a,e.start_index-=a,e.match=s[1]+e.match,1!==e.value.length)return(()=>{const s=[];for(let t=1,r=e.value.length,n=1<=r;n?t<r:t>r;n?t++:t--)null!=e.value[t].value&&(null!=(null!=e.value[t].value[0]?e.value[t].value[0].indices:void 0)&&(e.value[t].value[0].indices[0]+=a,e.value[t].value[0].indices[1]+=a),e.value[t].indices[0]+=a,s.push(e.value[t].indices[1]+=a));return s})()}osis(){const e=[];for(var s of Array.from(this.parsed_entities()))s.osis.length>0&&e.push(s.osis);return e.join(",")}osis_and_translations(){const e=[];for(var s of Array.from(this.parsed_entities()))s.osis.length>0&&e.push([s.osis,s.translations.join(",")]);return e}osis_and_indices(){const e=[];for(var s of Array.from(this.parsed_entities()))if(s.osis.length>0){const t={osis:s.osis,translations:s.translations,indices:s.indices};null!=s.osises&&(t.osises=s.osises),e.push(t)}return e}parsed_entities(){let e=[];for(let v=0,d=this.entities.length,b=0<=d;b?v<d:v>d;b?v++:v--){var s=this.entities[v];if(s.type&&"translation_sequence"===s.type&&e.length>0&&v===e[e.length-1].entity_id+1&&(e[e.length-1].indices[1]=s.absolute_indices[1]),null!=s.passages&&!("b"===s.type&&"ignore"===this.options.book_alone_strategy||"b_range"===s.type&&"ignore"===this.options.book_range_strategy||"context"===s.type)){var t=[],a=null;if(null!=s.passages[0].translations)for(var r of Array.from(s.passages[0].translations)){var n=(null!=r.osis?r.osis.length:void 0)>0?r.osis:"";null==a&&(a=r.alias),t.push(n)}else t=[""],a="default";for(var i=[],o=[],{length:l}=s.passages,u=0,c=u,p=l,g=0<=p;g?u<p:u>p;g?u++:u--,c=u){var _=s.passages[c];if(null==_.type&&(_.type=s.type),!1!==_.valid.valid||("ignore"===this.options.invalid_sequence_strategy&&"sequence"===s.type&&this.snap_sequence("ignore",s,i,c,l),"ignore"!==this.options.invalid_passage_strategy))if("b"!==_.type&&"b_range"!==_.type||"ignore"!==this.options.book_sequence_strategy||"sequence"!==s.type)if("b_range_start"!==_.type&&"range_end_b"!==_.type||"ignore"!==this.options.book_range_strategy||this.snap_range(s,c),null==_.absolute_indices&&(_.absolute_indices=s.absolute_indices),"separate-chapters"===this.options.consecutive_combination_strategy&&_.start.c!==_.end.c){const e=this.get_osises_by_chapter({osis:"",start:_.start,end:_.end},a);i.push({osis:_.valid.valid?this.to_osis(_.start,_.end,a):"",osises:e,type:_.type,indices:_.absolute_indices,translations:t,start:_.start,end:_.end,enclosed_indices:_.enclosed_absolute_indices,entity_id:v,entities:[_]})}else i.push({osis:_.valid.valid?this.to_osis(_.start,_.end,a):"",type:_.type,indices:_.absolute_indices,translations:t,start:_.start,end:_.end,enclosed_indices:_.enclosed_absolute_indices,entity_id:v,entities:[_]});else this.snap_sequence("book",s,i,c,l)}if(0!==i.length||0!==o.length){if("combine"!==this.options.consecutive_combination_strategy&&"separate-chapters"!==this.options.consecutive_combination_strategy||(i.length>1&&(i=this.combine_consecutive_passages(i,a)),i=i.concat(o).sort(((e,s)=>e.indices[0]-s.indices[0]))),"separate-chapters"===this.options.consecutive_combination_strategy)for(h of Array.from(i)){if(0===h.osis.length)continue;const e=this.get_osises_by_chapter(h,a);e.length>1&&(h.osises=e)}if("separate"===this.options.sequence_combination_strategy)e=e.concat(i);else{var h,x=[],f=i.length-1;for(h of(null!=i[f].enclosed_indices&&i[f].enclosed_indices[1]>=0&&(s.absolute_indices[1]=i[f].enclosed_indices[1]),Array.from(i)))h.osis.length>0&&x.push(h.osis);let r=[];if("separate-chapters"===this.options.consecutive_combination_strategy)for(h of Array.from(i))0!==h.osis.length&&(r=null!=h.osises?r.concat(h.osises):r.concat(this.get_osises_by_chapter(h,a)));const n={osis:x.join(","),indices:s.absolute_indices,translations:t,entity_id:v,entities:i};r.length>0&&(n.osises=r),e.push(n)}}}}return e}to_osis(e,s,t){let a;null==s.c&&null==s.v&&e.b===s.b&&null==e.c&&null==e.v&&"first_chapter"===this.options.book_alone_strategy&&(s.c=1);const r={start:"",end:""};return null==e.c&&(e.c=1),null==e.v&&(e.v=1),null==s.c&&(this.options.passage_existence_strategy.indexOf("c")>=0||null!=this.passage.translations[t].chapters[s.b]&&1===this.passage.translations[t].chapters[s.b].length?s.c=this.passage.translations[t].chapters[s.b].length:s.c=999),null==s.v&&(null!=this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0?s.v=this.passage.translations[t].chapters[s.b][s.c-1]:s.v=999),this.options.include_apocrypha&&"b"===this.options.ps151_strategy&&(151===e.c&&"Ps"===e.b||151===s.c&&"Ps"===s.b)&&this.fix_ps151(e,s,t),"b"===this.options.osis_compaction_strategy&&1===e.c&&1===e.v&&(999===s.c&&999===s.v||s.c===this.passage.translations[t].chapters[s.b].length&&this.options.passage_existence_strategy.indexOf("c")>=0&&(999===s.v||s.v===this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0))?(r.start=e.b,r.end=s.b):this.options.osis_compaction_strategy.length<=2&&1===e.v&&(999===s.v||s.v===this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0)?(r.start=e.b+"."+e.c.toString(),r.end=s.b+"."+s.c.toString()):(r.start=e.b+"."+e.c.toString()+"."+e.v.toString(),r.end=s.b+"."+s.c.toString()+"."+s.v.toString()),a=r.start===r.end?r.start:r.start+"-"+r.end,null!=e.extra&&(a=e.extra+","+a),null!=s.extra&&(a+=","+s.extra),a}get_osises_by_chapter(e,s){if(null==e||null==e.start||null==e.end||null==e.osis)return[];if(null==e.start.b||null==e.end.b||null==e.start.c||null==e.end.c)return e.osis.length>0?[e.osis]:[];if(e.start.b!==e.end.b||e.start.c===e.end.c)return e.osis.length>0?[e.osis]:[];const t=[];for(let a=e.start.c,r=e.end.c,n=e.start.c<=r;n?a<=r:a>=r;n?a++:a--){const r=a===e.start.c?e.start.v:1,n=a===e.end.c?e.end.v:this.translations[s].chapters[e.start.b][a-1],i={b:e.start.b,c:a,v:"bcv"===e.start.type?r:null,type:e.start.type},o={b:e.end.b,c:a,v:"bcv"===e.start.type?n:null,type:e.start.type};t.push(this.to_osis(i,o,s))}return t}fix_ps151(e,s,t){return"default"!==t&&null==(null!=this.translations[t]?this.translations[t].chapters.Ps151:void 0)&&this.passage.promote_book_to_translation("Ps151",t),151===e.c&&"Ps"===e.b?151===s.c&&"Ps"===s.b?(e.b="Ps151",e.c=1,s.b="Ps151",s.c=1):(e.extra=this.to_osis({b:"Ps151",c:1,v:e.v},{b:"Ps151",c:1,v:this.passage.translations[t].chapters.Ps151[0]},t),e.b="Prov",e.c=1,e.v=1):(s.extra=this.to_osis({b:"Ps151",c:1,v:1},{b:"Ps151",c:1,v:s.v},t),s.c=150,s.v=this.passage.translations[t].chapters.Ps[149])}combine_consecutive_passages(e,s){const t=[];let a={};const r=e.length-1;let n=-1,i=!1;for(let c=0,p=r,g=0<=p;g?c<=p:c>=p;g?c++:c--){var o=e[c];if(o.osis.length>0){var l=t.length-1,u=!1;o.enclosed_indices[0]!==n&&(n=o.enclosed_indices[0]),n>=0&&(c===r||e[c+1].enclosed_indices[0]!==o.enclosed_indices[0])&&(u=!0,i=!0),this.is_verse_consecutive(a,o.start,s)?(t[l].end=o.end,t[l].is_enclosed_last=u,t[l].indices[1]=o.indices[1],t[l].enclosed_indices[1]=o.enclosed_indices[1],t[l].osis=this.to_osis(t[l].start,o.end,s)):t.push(o),a={b:o.end.b,c:o.end.c,v:o.end.v}}else t.push(o),a={}}return i&&this.snap_enclosed_indices(t),t}snap_enclosed_indices(e){for(var s of Array.from(e))null!=s.is_enclosed_last&&(s.enclosed_indices[0]<0&&s.is_enclosed_last&&(s.indices[1]=s.enclosed_indices[1]),delete s.is_enclosed_last);return e}is_verse_consecutive(e,s,t){if(null==e.b)return!1;const a=null!=this.passage.translations[t].order?this.passage.translations[t].order:this.passage.translations.default.order;if(e.b===s.b){if(e.c===s.c){if(e.v===s.v-1)return!0}else if(1===s.v&&e.c===s.c-1&&e.v===this.passage.translations[t].chapters[e.b][e.c-1])return!0}else if(1===s.c&&1===s.v&&a[e.b]===a[s.b]-1&&e.c===this.passage.translations[t].chapters[e.b].length&&e.v===this.passage.translations[t].chapters[e.b][e.c-1])return!0;return!1}snap_range(e,s){let t,a,r;"b_range_start"===e.type||"sequence"===e.type&&"b_range_start"===e.passages[s].type?(t=1,a="end",r="b_range_start"):(t=0,a="start",r="range_end_b");const n="end"===a?"start":"end";for(var i of Object.keys(e.passages[s][n]||{}))e.passages[s][n][i]=e.passages[s][a][i];if("sequence"===e.type){s>=e.value.length&&(s=e.value.length-1);const t=this.passage.pluck(r,e.value[s]);if(null!=t){const a=this.snap_range(t,0);0===s?e.absolute_indices[0]=a.absolute_indices[0]:e.absolute_indices[1]=a.absolute_indices[1]}}else e.original_type=e.type,e.type=e.value[t].type,e.absolute_indices=[e.value[t].absolute_indices[0],e.value[t].absolute_indices[1]];return e}snap_sequence(e,s,t,a,r){const n=s.passages[a];return n.absolute_indices[0]===s.absolute_indices[0]&&a<r-1&&this.get_snap_sequence_i(s.passages,a,r)!==a?(s.absolute_indices[0]=s.passages[a+1].absolute_indices[0],this.remove_absolute_indices(s.passages,a+1)):n.absolute_indices[1]===s.absolute_indices[1]&&a>0?s.absolute_indices[1]=t.length>0?t[t.length-1].indices[1]:s.passages[a-1].absolute_indices[1]:"book"===e&&a<r-1&&!this.starts_with_book(s.passages[a+1])&&(s.passages[a+1].absolute_indices[0]=n.absolute_indices[0]),s}get_snap_sequence_i(e,s,t){for(let a=s+1,r=a,n=t,i=a<=n;i?r<n:r>n;i?r++:r--){if(this.starts_with_book(e[r]))return r;if(e[r].valid.valid)return s}return s}starts_with_book(e){return"b"===e.type.substr(0,1)||("range"===e.type||"ff"===e.type)&&"b"===e.start.type.substr(0,1)}remove_absolute_indices(e,s){if(e[s].enclosed_absolute_indices[0]<0)return!1;const[t,a]=Array.from(e[s].enclosed_absolute_indices);for(var r of Array.from(e.slice(s))){if(r.enclosed_absolute_indices[0]!==t||r.enclosed_absolute_indices[1]!==a)break;r.enclosed_absolute_indices=[-1,-1]}return!0}}bcv_parser.initClass(),this.bcv_parser=bcv_parser;class bcv_passage{static initClass(){this.prototype.books=[],this.prototype.indices={},this.prototype.options={},this.prototype.translations={}}handle_array(e,s,t){for(var a of(null==s&&(s=[]),null==t&&(t={}),Array.from(e)))if(null!=a){if("stop"===a.type)break;[s,t]=Array.from(this.handle_obj(a,s,t))}return[s,t]}handle_obj(e,s,t){return null!=e.type&&null!=this[e.type]?this[e.type](e,s,t):[s,t]}b(e,s,t){let a;e.start_context=bcv_utils.shallow_clone(t),e.passages=[];const r=[];for(a of Array.from(this.books[e.value].parsed)){var n=this.validate_ref(e.start_context.translations,{b:a}),i={start:{b:a},end:{b:a},valid:n};0===e.passages.length&&n.valid?e.passages.push(i):r.push(i)}return 0===e.passages.length&&e.passages.push(r.shift()),r.length>0&&(e.passages[0].alternates=r),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),t={b:e.passages[0].start.b},null!=e.start_context.translations&&(t.translations=e.start_context.translations),[s,t]}b_range(e,s,t){return this.range(e,s,t)}b_range_pre(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t),e.passages=[];const n=this.pluck("b",e.value);a=this.b(n,[],t),[r]=Array.from(a[0]),t=a[1],null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices));const i={b:e.value[0].value+r.passages[0].start.b.substr(1),type:"b"};return e.passages=[{start:i,end:r.passages[0].end,valid:r.passages[0].valid}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),[s,t]}b_range_start(e,s,t){return this.range(e,s,t)}base(e,s,t){return this.indices=this.calculate_indices(e.match,e.start_index),this.handle_array(e.value,s,t)}bc(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.passages=[],this.reset_context(t,["b","c","v"]);const a=this.pluck("c",e.value).value,r=[];for(var n of Array.from(this.books[this.pluck("b",e.value).value].parsed)){var i="c",o=this.validate_ref(e.start_context.translations,{b:n,c:a}),l={start:{b:n},end:{b:n},valid:o};(o.messages.start_chapter_not_exist_in_single_chapter_book||o.messages.start_chapter_1)&&(l.valid=this.validate_ref(e.start_context.translations,{b:n,v:a}),o.messages.start_chapter_not_exist_in_single_chapter_book&&(l.valid.messages.start_chapter_not_exist_in_single_chapter_book=1),l.start.c=1,l.end.c=1,i="v"),l.start[i]=a,[l.start.c,l.start.v]=Array.from(this.fix_start_zeroes(l.valid,l.start.c,l.start.v)),null==l.start.v&&delete l.start.v,l.end[i]=l.start[i],0===e.passages.length&&l.valid.valid?e.passages.push(l):r.push(l)}return 0===e.passages.length&&e.passages.push(r.shift()),r.length>0&&(e.passages[0].alternates=r),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),this.set_context_from_object(t,["b","c","v"],e.passages[0].start),s.push(e),[s,t]}bc_title(e,s,t){let a,r;if(e.start_context=bcv_utils.shallow_clone(t),a=this.bc(this.pluck("bc",e.value),[],t),[r]=Array.from(a[0]),t=a[1],"Ps"!==r.passages[0].start.b.substr(0,2)&&null!=r.passages[0].alternates)for(let e=0,s=r.passages[0].alternates.length,t=0<=s;t?e<s:e>s;t?e++:e--)if("Ps"===r.passages[0].alternates[e].start.b.substr(0,2)){r.passages[0]=r.passages[0].alternates[e];break}if("Ps"!==r.passages[0].start.b.substr(0,2))return s.push(r),[s,t];this.books[this.pluck("b",r.value).value].parsed=["Ps"];let n=this.pluck("title",e.value);return null==n&&(n=this.pluck("v",e.value)),e.value[1]={type:"v",value:[{type:"integer",value:1,indices:n.indices}],indices:n.indices},e.type="bcv",this.bcv(e,s,e.start_context)}bcv(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.passages=[],this.reset_context(t,["b","c","v"]);const a=this.pluck("bc",e.value);let r=this.pluck("c",a.value).value,n=this.pluck("v",e.value).value;const i=[];for(var o of Array.from(this.books[this.pluck("b",a.value).value].parsed)){var l=this.validate_ref(e.start_context.translations,{b:o,c:r,v:n});[r,n]=Array.from(this.fix_start_zeroes(l,r,n));var u={start:{b:o,c:r,v:n},end:{b:o,c:r,v:n},valid:l};0===e.passages.length&&l.valid?e.passages.push(u):i.push(u)}return 0===e.passages.length&&e.passages.push(i.shift()),i.length>0&&(e.passages[0].alternates=i),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),this.set_context_from_object(t,["b","c","v"],e.passages[0].start),s.push(e),[s,t]}bv(e,s,t){let a;e.start_context=bcv_utils.shallow_clone(t);const[r,n]=Array.from(e.value);let i={indices:e.indices,value:[{type:"bc",value:[r,{type:"c",value:[{type:"integer",value:1}]}]},n]};return a=this.bcv(i,[],t),[i]=Array.from(a[0]),t=a[1],e.passages=i.passages,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),[s,t]}c(e,s,t){e.start_context=bcv_utils.shallow_clone(t);let a="integer"===e.type?e.value:this.pluck("integer",e.value).value;const r=this.validate_ref(e.start_context.translations,{b:t.b,c:a});return!r.valid&&r.messages.start_chapter_not_exist_in_single_chapter_book?this.v(e,s,t):([a]=Array.from(this.fix_start_zeroes(r,a)),e.passages=[{start:{b:t.b,c:a},end:{b:t.b,c:a},valid:r}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),t.c=a,this.reset_context(t,["v"]),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,t])}c_psalm(e,s,t){e.type="bc";const a=parseInt(this.books[e.value].value.match(/^\d+/)[0],10);return e.value=[{type:"b",value:e.value,indices:e.indices},{type:"c",value:[{type:"integer",value:a,indices:e.indices}],indices:e.indices}],this.bc(e,s,t)}c_title(e,s,t){if(e.start_context=bcv_utils.shallow_clone(t),"Ps"!==t.b)return this.c(e.value[0],s,t);const a=this.pluck("title",e.value);return e.value[1]={type:"v",value:[{type:"integer",value:1,indices:a.indices}],indices:a.indices},e.type="cv",this.cv(e,s,e.start_context)}cv(e,s,t){e.start_context=bcv_utils.shallow_clone(t);let a=this.pluck("c",e.value).value,r=this.pluck("v",e.value).value;const n=this.validate_ref(e.start_context.translations,{b:t.b,c:a,v:r});return[a,r]=Array.from(this.fix_start_zeroes(n,a,r)),e.passages=[{start:{b:t.b,c:a,v:r},end:{b:t.b,c:a,v:r},valid:n}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),t.c=a,t.v=r,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,t]}cb_range(e,s,t){e.type="range";const[a,r,n]=Array.from(e.value);return e.value=[{type:"bc",value:[a,r],indices:e.indices},n],n.indices[1]=e.indices[1],this.range(e,s,t)}context(e,s,t){for(var a of(e.start_context=bcv_utils.shallow_clone(t),e.passages=[],Object.keys(this.books[e.value].context||{})))t[a]=this.books[e.value].context[a];return s.push(e),[s,t]}cv_psalm(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.type="bcv";const[a,r]=Array.from(e.value),n=this.c_psalm(a,[],e.start_context),[i]=Array.from(n[0]);return e.value=[i,r],this.bcv(e,s,t)}ff(e,s,t){let a;return e.start_context=bcv_utils.shallow_clone(t),e.value.push({type:"integer",indices:e.indices,value:999}),a=this.range(e,[],e.start_context),[e]=Array.from(a[0]),t=a[1],e.value[0].indices=e.value[1].indices,e.value[0].absolute_indices=e.value[1].absolute_indices,e.value.pop(),null!=e.passages[0].valid.messages.end_verse_not_exist&&delete e.passages[0].valid.messages.end_verse_not_exist,null!=e.passages[0].valid.messages.end_chapter_not_exist&&delete e.passages[0].valid.messages.end_chapter_not_exist,null!=e.passages[0].end.original_c&&delete e.passages[0].end.original_c,s.push(e),[s,t]}integer_title(e,s,t){return e.start_context=bcv_utils.shallow_clone(t),"Ps"!==t.b?this.integer(e.value[0],s,t):(e.value[0]={type:"c",value:[e.value[0]],indices:[e.value[0].indices[0],e.value[0].indices[1]]},e.value[1].type="v",e.value[1].original_type="title",e.value[1].value=[{type:"integer",value:1,indices:e.value[1].value.indices}],e.type="cv",this.cv(e,s,e.start_context))}integer(e,s,t){return null!=t.v?this.v(e,s,t):this.c(e,s,t)}next_v(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t);let n=this.pluck_last_recursively("integer",e.value);if(null==n&&(n={value:1}),e.value.push({type:"integer",indices:e.indices,value:n.value+1}),a=this.range(e,[],e.start_context),[r]=Array.from(a[0]),t=a[1],null!=r.passages[0].valid.messages.end_verse_not_exist&&null==r.passages[0].valid.messages.start_verse_not_exist&&null==r.passages[0].valid.messages.start_chapter_not_exist&&null!=t.c){let s;e.value.pop(),e.value.push({type:"cv",indices:e.indices,value:[{type:"c",value:[{type:"integer",value:t.c+1,indices:e.indices}],indices:e.indices},{type:"v",value:[{type:"integer",value:1,indices:e.indices}],indices:e.indices}]}),s=this.range(e,[],e.start_context),[r]=Array.from(s[0]),t=s[1]}return r.value[0].indices=r.value[1].indices,r.value[0].absolute_indices=r.value[1].absolute_indices,r.value.pop(),null!=r.passages[0].valid.messages.end_verse_not_exist&&delete r.passages[0].valid.messages.end_verse_not_exist,null!=r.passages[0].valid.messages.end_chapter_not_exist&&delete r.passages[0].valid.messages.end_chapter_not_exist,null!=r.passages[0].end.original_c&&delete r.passages[0].end.original_c,s.push(r),[s,t]}sequence(e,s,t){for(var a of(e.start_context=bcv_utils.shallow_clone(t),e.passages=[],Array.from(e.value))){var r,n;for(var i of(r=this.handle_array(a,[],t),[n]=Array.from(r[0]),t=r[1],Array.from(n.passages)))null==i.type&&(i.type=n.type),null==i.absolute_indices&&(i.absolute_indices=n.absolute_indices),null!=n.start_context.translations&&(i.translations=n.start_context.translations),i.enclosed_absolute_indices="sequence_post_enclosed"===n.type?n.absolute_indices:[-1,-1],e.passages.push(i)}return null==e.absolute_indices&&(e.passages.length>0&&"sequence"===e.type?e.absolute_indices=[e.passages[0].absolute_indices[0],e.passages[e.passages.length-1].absolute_indices[1]]:e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),[s,t]}sequence_post_enclosed(e,s,t){return this.sequence(e,s,t)}v(e,s,t){let a,r="integer"===e.type?e.value:this.pluck("integer",e.value).value;e.start_context=bcv_utils.shallow_clone(t);const n=null!=t.c?t.c:1,i=this.validate_ref(e.start_context.translations,{b:t.b,c:n,v:r});return[a,r]=Array.from(this.fix_start_zeroes(i,0,r)),e.passages=[{start:{b:t.b,c:n,v:r},end:{b:t.b,c:n,v:r},valid:i}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),t.v=r,[s,t]}range(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t);let[n,i]=Array.from(e.value);if(a=this.handle_obj(n,[],t),[n]=Array.from(a[0]),t=a[1],"v"===i.type&&("bc"===n.type&&!__guard__(__guard__(__guard__(null!=n.passages?n.passages[0]:void 0,(e=>e.valid)),(e=>e.messages)),(e=>e.start_chapter_not_exist_in_single_chapter_book))||"c"===n.type)&&"verse"===this.options.end_range_digits_strategy)return e.value[0]=n,this.range_change_integer_end(e,s);r=this.handle_obj(i,[],t),[i]=Array.from(r[0]),t=r[1],e.value=[n,i],e.indices=[n.indices[0],i.indices[1]],delete e.absolute_indices;const o={b:n.passages[0].start.b,c:n.passages[0].start.c,v:n.passages[0].start.v,type:n.type},l={b:i.passages[0].end.b,c:i.passages[0].end.c,v:i.passages[0].end.v,type:i.type};i.passages[0].valid.messages.start_chapter_is_zero&&(l.c=0),i.passages[0].valid.messages.start_verse_is_zero&&(l.v=0);const u=this.validate_ref(e.start_context.translations,o,l);if(!u.valid)return this.range_handle_invalid(u,e,n,o,i,l,s);{const[t,a]=Array.from(this.range_handle_valid(u,e,n,o,i,l,s));if(t)return a}return null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),e.passages=[{start:o,end:l,valid:u}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),"b"===o.type?"b"===l.type?e.type="b_range":e.type="b_range_start":"b"===l.type&&(e.type="range_end_b"),s.push(e),[s,t]}range_change_end(e,s,t){let a;const[r,n]=Array.from(e.value);return"integer"===n.type?(n.original_value=n.value,n.value=t):"v"===n.type?(a=this.pluck("integer",n.value),a.original_value=a.value,a.value=t):"cv"===n.type&&(a=this.pluck("c",n.value),a.original_value=a.value,a.value=t),this.handle_obj(e,s,e.start_context)}range_change_integer_end(e,s){const[t,a]=Array.from(e.value);return null==e.original_type&&(e.original_type=e.type),null==e.original_value&&(e.original_value=[t,a]),e.type="integer"===t.type?"cv":t.type+"v","integer"===t.type&&(e.value[0]={type:"c",value:[t],indices:t.indices}),"integer"===a.type&&(e.value[1]={type:"v",value:[a],indices:a.indices}),this.handle_obj(e,s,e.start_context)}range_check_new_end(e,s,t,a){let r=0,n=null;if(a.messages.end_chapter_before_start?n="c":a.messages.end_verse_before_start&&(n="v"),null!=n&&(r=this.range_get_new_end_value(s,t,a,n)),r>0){const s={b:t.b,c:t.c,v:t.v};s[n]=r;this.validate_ref(e,s).valid||(r=0)}return r}range_end_b(e,s,t){return this.range(e,s,t)}range_get_new_end_value(e,s,t,a){let r=0;return"c"===a&&t.messages.end_chapter_is_zero||"v"===a&&t.messages.end_verse_is_zero||(e[a]>=10&&s[a]<10&&e[a]-10*Math.floor(e[a]/10)<s[a]?r=s[a]+10*Math.floor(e[a]/10):e[a]>=100&&s[a]<100&&e[a]-100<s[a]&&(r=s[a]+100)),r}range_handle_invalid(e,s,t,a,r,n,i){if(!1===e.valid&&(e.messages.end_chapter_before_start||e.messages.end_verse_before_start)&&("integer"===r.type||"v"===r.type)||!1===e.valid&&e.messages.end_chapter_before_start&&"cv"===r.type){const t=this.range_check_new_end(s.start_context.translations,a,n,e);if(t>0)return this.range_change_end(s,i,t)}if("verse"===this.options.end_range_digits_strategy&&null==a.v&&("integer"===r.type||"v"===r.type)){const e="v"===r.type?this.pluck("integer",r.value):r.value;if(this.validate_ref(s.start_context.translations,{b:a.b,c:a.c,v:e}).valid)return this.range_change_integer_end(s,i)}return null==s.original_type&&(s.original_type=s.type),s.type="sequence",[s.original_value,s.value]=Array.from([[t,r],[[t],[r]]]),this.sequence(s,i,s.start_context)}range_handle_valid(e,s,t,a,r,n,i){if(e.messages.end_chapter_not_exist&&"verse"===this.options.end_range_digits_strategy&&null==a.v&&("integer"===r.type||"v"===r.type)&&this.options.passage_existence_strategy.indexOf("v")>=0){const e="v"===r.type?this.pluck("integer",r.value):r.value;if(this.validate_ref(s.start_context.translations,{b:a.b,c:a.c,v:e}).valid)return[!0,this.range_change_integer_end(s,i)]}return this.range_validate(e,a,n,s),[!1,null]}range_validate(e,s,t,a){return e.messages.end_chapter_not_exist||e.messages.end_chapter_not_exist_in_single_chapter_book?(t.original_c=t.c,t.c=e.messages.end_chapter_not_exist?e.messages.end_chapter_not_exist:e.messages.end_chapter_not_exist_in_single_chapter_book,null!=t.v&&(t.v=this.validate_ref(a.start_context.translations,{b:t.b,c:t.c,v:999}).messages.end_verse_not_exist,delete e.messages.end_verse_is_zero)):e.messages.end_verse_not_exist&&(t.original_v=t.v,t.v=e.messages.end_verse_not_exist),e.messages.end_verse_is_zero&&"allow"!==this.options.zero_verse_strategy&&(t.v=e.messages.end_verse_is_zero),e.messages.end_chapter_is_zero&&(t.c=e.messages.end_chapter_is_zero),[s.c,s.v]=Array.from(this.fix_start_zeroes(e,s.c,s.v)),!0}translation_sequence(e,s,t){e.start_context=bcv_utils.shallow_clone(t);const a=[];for(var r of(a.push({translation:this.books[e.value[0].value].parsed}),Array.from(e.value[1])))null!=(r=this.books[this.pluck("translation",r).value].parsed)&&a.push({translation:r});for(var n of Array.from(a))null!=this.translations.aliases[n.translation]?(n.alias=this.translations.aliases[n.translation].alias,n.osis=this.translations.aliases[n.translation].osis||n.translation.toUpperCase()):(n.alias="default",n.osis=n.translation.toUpperCase());return s.length>0&&(t=this.translation_sequence_apply(s,a)),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),this.reset_context(t,["translations"]),[s,t]}translation_sequence_apply(e,s){let t,a=0;for(let s=e.length-1,t=s,r=s<=0;r?t<=0:t>=0;r?t++:t--)if(null!=e[t].original_type&&(e[t].type=e[t].original_type),null!=e[t].original_value&&(e[t].value=e[t].original_value),"translation_sequence"===e[t].type){a=t+1;break}if(a<e.length){let r;e[a].start_context.translations=s,[r,t]=Array.from(this.handle_array(e.slice(a),[],e[a].start_context))}else t=bcv_utils.shallow_clone(e[e.length-1].start_context);return t}pluck(e,s){for(var t of Array.from(s))if(null!=t&&null!=t.type&&t.type===e)return"c"===e||"v"===e?this.pluck("integer",t.value):t;return null}pluck_last_recursively(e,s){for(let r=s.length-1;r>=0;r--){var t=s[r];if(null!=t&&null!=t.type){if(t.type===e)return this.pluck(e,[t]);var a=this.pluck_last_recursively(e,t.value);if(null!=a)return a}}return null}set_context_from_object(e,s,t){return(()=>{const a=[];for(var r of Array.from(s))null!=t[r]&&a.push(e[r]=t[r]);return a})()}reset_context(e,s){return Array.from(s).map((s=>delete e[s]))}fix_start_zeroes(e,s,t){return e.messages.start_chapter_is_zero&&"upgrade"===this.options.zero_chapter_strategy&&(s=e.messages.start_chapter_is_zero),e.messages.start_verse_is_zero&&"upgrade"===this.options.zero_verse_strategy&&(t=e.messages.start_verse_is_zero),[s,t]}calculate_indices(e,s){let t,a="book";const r=[];let n=0;s=parseInt(s,10);let i=[e];for(var o of["",""]){var l=[];for(t of Array.from(i))l=l.concat(t.split(o));i=l}for(t of Array.from(i)){var u;a="book"===a?"rest":"book";var c=t.length;0!==c&&("book"===a?(t=t.replace(/\/\d+$/,""),u=n+c,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:n,end:u,index:s}),n+=c+2,s=this.books[t].start_index+this.books[t].value.length-n,r.push({start:u+1,end:u+1,index:s})):(u=n+c-1,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:n,end:u,index:s}),n+=c))}return r}get_absolute_indices(...e){const[s,t]=Array.from(e[0]);let a=null,r=null;for(var n of Array.from(this.indices))if(null===a&&n.start<=s&&s<=n.end&&(a=s+n.index),n.start<=t&&t<=n.end){r=t+n.index+1;break}return[a,r]}validate_ref(e,s,t){null!=e&&e.length>0||(e=[{translation:"default",osis:"",alias:"default"}]);let a=!1;const r={};for(var n of Array.from(e))if(null==n.alias&&(n.alias="default"),null!=n.alias){null==this.translations.aliases[n.alias]&&(n.alias="default",null==r.translation_unknown&&(r.translation_unknown=[]),r.translation_unknown.push(n));var[i]=Array.from(this.validate_start_ref(n.alias,s,r));t&&([i]=Array.from(this.validate_end_ref(n.alias,s,t,i,r))),!0===i&&(a=!0)}else null==r.translation_invalid&&(r.translation_invalid=[]),r.translation_invalid.push(n);return{valid:a,messages:r}}validate_start_ref(e,s,t){let a=!0;"default"!==e&&null==(null!=this.translations[e]?this.translations[e].chapters[s.b]:void 0)&&this.promote_book_to_translation(s.b,e);const r=null!=(null!=this.translations[e]?this.translations[e].order:void 0)?e:"default";if(null!=s.v&&(s.v=parseInt(s.v,10)),null!=this.translations[r].order[s.b]){if(null==s.c&&(s.c=1),s.c=parseInt(s.c,10),isNaN(s.c))return a=!1,t.start_chapter_not_numeric=!0,[a,t];0===s.c&&(t.start_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?a=!1:s.c=1),null!=s.v&&0===s.v&&(t.start_verse_is_zero=1,"error"===this.options.zero_verse_strategy?a=!1:"upgrade"===this.options.zero_verse_strategy&&(s.v=1)),s.c>0&&null!=this.translations[e].chapters[s.b][s.c-1]?null!=s.v?isNaN(s.v)?(a=!1,t.start_verse_not_numeric=!0):s.v>this.translations[e].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(a=!1,t.start_verse_not_exist=this.translations[e].chapters[s.b][s.c-1]):1===s.c&&"verse"===this.options.single_chapter_1_strategy&&1===this.translations[e].chapters[s.b].length&&(t.start_chapter_1=1):1!==s.c&&1===this.translations[e].chapters[s.b].length?(a=!1,t.start_chapter_not_exist_in_single_chapter_book=1):s.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(a=!1,t.start_chapter_not_exist=this.translations[e].chapters[s.b].length)}else null==s.b?(a=!1,t.start_book_not_defined=!0):(this.options.passage_existence_strategy.indexOf("b")>=0&&(a=!1),t.start_book_not_exist=!0);return[a,t]}validate_end_ref(e,s,t,a,r){const n=null!=(null!=this.translations[e]?this.translations[e].order:void 0)?e:"default";return null!=t.c&&(t.c=parseInt(t.c,10),isNaN(t.c)?(a=!1,r.end_chapter_not_numeric=!0):0===t.c&&(r.end_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?a=!1:t.c=1)),null!=t.v&&(t.v=parseInt(t.v,10),isNaN(t.v)?(a=!1,r.end_verse_not_numeric=!0):0===t.v&&(r.end_verse_is_zero=1,"error"===this.options.zero_verse_strategy?a=!1:"upgrade"===this.options.zero_verse_strategy&&(t.v=1))),null!=this.translations[n].order[t.b]?(null==t.c&&1===this.translations[e].chapters[t.b].length&&(t.c=1),null!=this.translations[n].order[s.b]&&this.translations[n].order[s.b]>this.translations[n].order[t.b]&&(this.options.passage_existence_strategy.indexOf("b")>=0&&(a=!1),r.end_book_before_start=!0),s.b!==t.b||null==t.c||isNaN(t.c)||(null==s.c&&(s.c=1),!isNaN(parseInt(s.c,10))&&s.c>t.c?(a=!1,r.end_chapter_before_start=!0):s.c!==t.c||null==t.v||isNaN(t.v)||(null==s.v&&(s.v=1),!isNaN(parseInt(s.v,10))&&s.v>t.v&&(a=!1,r.end_verse_before_start=!0))),null==t.c||isNaN(t.c)||null==this.translations[e].chapters[t.b][t.c-1]&&(1===this.translations[e].chapters[t.b].length?r.end_chapter_not_exist_in_single_chapter_book=1:t.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(r.end_chapter_not_exist=this.translations[e].chapters[t.b].length)),null==t.v||isNaN(t.v)||(null==t.c&&(t.c=this.translations[e].chapters[t.b].length),t.v>this.translations[e].chapters[t.b][t.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(r.end_verse_not_exist=this.translations[e].chapters[t.b][t.c-1]))):(a=!1,r.end_book_not_exist=!0),[a,r]}promote_book_to_translation(e,s){if(null==this.translations[s]&&(this.translations[s]={}),null==this.translations[s].chapters&&(this.translations[s].chapters={}),null==this.translations[s].chapters[e])return this.translations[s].chapters[e]=bcv_utils.shallow_clone_array(this.translations.default.chapters[e])}}function __guard__(e,s){return null!=e?s(e):void 0}bcv_passage.initClass();const bcv_utils={shallow_clone(e){if(null==e)return e;const s={};for(const t of Object.keys(e||{})){const a=e[t];s[t]=a}return s},shallow_clone_array(e){if(null==e)return e;const s=[];for(let t=0,a=e.length,r=0<=a;r?t<=a:t>=a;r?t++:t--)void 0!==e[t]&&(s[t]=e[t]);return s}};bcv_parser.prototype.regexps.translations=RegExp("(?:(?:CKK))\\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=["hr"];const heregex=e=>{let s="",t=!1,a=!1;for(let r=0;r<e.length;r++){const n=e[r];if(a)s+=n,a=!1;else if("\\"!==n)if(t||"["!==n)if(t&&"]"===n)t=!1,s+=n;else if(t||"#"!==n)!t&&/\s/.test(n)||(s+=n);else for(;r<e.length&&"\n"!==e[r];)r+=1;else t=!0,s+=n;else s+=n,a=!0}return s};var grammar;bcv_parser.prototype.regexps.space="[\\s\\xa0]",bcv_parser.prototype.regexps.escaped_passage=RegExp(heregex(String.raw`
|
|
1
|
+
const root=this;class bcv_parser{static initClass(){this.prototype.s="",this.prototype.entities=[],this.prototype.passage=null,this.prototype.regexps={},this.prototype.options={consecutive_combination_strategy:"combine",osis_compaction_strategy:"b",book_sequence_strategy:"ignore",invalid_sequence_strategy:"ignore",sequence_combination_strategy:"combine",punctuation_strategy:"us",invalid_passage_strategy:"ignore",non_latin_digits_strategy:"ignore",passage_existence_strategy:"bcv",zero_chapter_strategy:"error",zero_verse_strategy:"error",single_chapter_1_strategy:"chapter",book_alone_strategy:"ignore",book_range_strategy:"ignore",captive_end_digits_strategy:"delete",end_range_digits_strategy:"verse",include_apocrypha:!1,ps151_strategy:"c",versification_system:"default",case_sensitive:"none"}}constructor(){for(var e of(this.options={},Object.keys(bcv_parser.prototype.options||{}))){var s=bcv_parser.prototype.options[e];this.options[e]=s}this.versification_system(this.options.versification_system)}parse(e){return this.reset(),this.s=e,e=this.replace_control_characters(e),[e,this.passage.books]=Array.from(this.match_books(e)),[this.entities]=Array.from(this.match_passages(e)),this}parse_with_context(e,s){let t;return this.reset(),[s,this.passage.books]=Array.from(this.match_books(this.replace_control_characters(s))),[t,s]=Array.from(this.match_passages(s)),this.reset(),this.s=e,e=this.replace_control_characters(e),[e,this.passage.books]=Array.from(this.match_books(e)),this.passage.books.push({value:"",parsed:[],start_index:0,type:"context",context:s}),e=""+(this.passage.books.length-1)+"/9"+e,[this.entities]=Array.from(this.match_passages(e)),this}reset(){return this.s="",this.entities=[],this.passage?(this.passage.books=[],this.passage.indices={}):(this.passage=new bcv_passage,this.passage.options=this.options,this.passage.translations=this.translations)}set_options(e){for(var s of Object.keys(e||{})){var t=e[s];"include_apocrypha"===s||"versification_system"===s||"case_sensitive"===s?this[s](t):this.options[s]=t}return this}include_apocrypha(e){if(null==e||!0!==e&&!1!==e)return this;for(var s of(this.options.include_apocrypha=e,this.regexps.books=this.regexps.get_books(e,this.options.case_sensitive),Object.keys(this.translations||{}))){var t;if("aliases"!==s&&"alternates"!==s)if(null==this.translations[s].chapters&&(this.translations[s].chapters={}),null==this.translations[s].chapters.Ps&&(this.translations[s].chapters.Ps=bcv_utils.shallow_clone_array(this.translations.default.chapters.Ps)),!0===e)t=null!=this.translations[s].chapters.Ps151?this.translations[s].chapters.Ps151[0]:this.translations.default.chapters.Ps151[0],this.translations[s].chapters.Ps[150]=t;else 151===this.translations[s].chapters.Ps.length&&this.translations[s].chapters.Ps.pop()}return this}versification_system(e){let s,t;if(null==e||null==this.translations[e])return this;if(null!=this.translations.alternates.default)if("default"===e)for(s of(null!=this.translations.alternates.default.order&&(this.translations.default.order=bcv_utils.shallow_clone(this.translations.alternates.default.order)),Object.keys(this.translations.alternates.default.chapters||{})))t=this.translations.alternates.default.chapters[s],this.translations.default.chapters[s]=bcv_utils.shallow_clone_array(t);else this.versification_system("default");if(null==this.translations.alternates.default&&(this.translations.alternates.default={order:null,chapters:{}}),"default"!==e&&null!=this.translations[e].order&&(null==this.translations.alternates.default.order&&(this.translations.alternates.default.order=bcv_utils.shallow_clone(this.translations.default.order)),this.translations.default.order=bcv_utils.shallow_clone(this.translations[e].order)),"default"!==e&&null!=this.translations[e].chapters)for(s of Object.keys(this.translations[e].chapters||{}))t=this.translations[e].chapters[s],null==this.translations.alternates.default.chapters[s]&&(this.translations.alternates.default.chapters[s]=bcv_utils.shallow_clone_array(this.translations.default.chapters[s])),this.translations.default.chapters[s]=bcv_utils.shallow_clone_array(t);return this.options.versification_system=e,this.include_apocrypha(this.options.include_apocrypha),this}case_sensitive(e){return null==e||"none"!==e&&"books"!==e||e===this.options.case_sensitive||(this.options.case_sensitive=e,this.regexps.books=this.regexps.get_books(this.options.include_apocrypha,e)),this}translation_info(e){let s;null==e&&(e="default"),null!=e&&null!=(null!=this.translations.aliases[e]?this.translations.aliases[e].alias:void 0)&&(e=this.translations.aliases[e].alias),null!=e&&null!=this.translations[e]||(e="default");const t=this.options.versification_system;e!==t&&this.versification_system(e);const a={alias:e,books:[],chapters:{},order:bcv_utils.shallow_clone(this.translations.default.order)};for(s of Object.keys(this.translations.default.chapters||{})){var r=this.translations.default.chapters[s];a.chapters[s]=bcv_utils.shallow_clone_array(r)}for(s of Object.keys(a.order||{})){var n=a.order[s];a.books[n-1]=s}return e!==t&&this.versification_system(t),a}replace_control_characters(e){return e=(e=(e=e.replace(this.regexps.control," ")).replace(/\uFF1A/g,":")).replace(/\uFF1B/g,";"),"replace"===this.options.non_latin_digits_strategy&&(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/[٠۰߀०০੦૦୦0౦೦൦๐໐༠၀႐០᠐᥆᧐᪀᪐᭐᮰᱀᱐꘠꣐꤀꧐꩐꯰0]/g,"0")).replace(/[١۱߁१১੧૧୧௧౧೧൧๑໑༡၁႑១᠑᥇᧑᪁᪑᭑᮱᱁᱑꘡꣑꤁꧑꩑꯱1]/g,"1")).replace(/[٢۲߂२২੨૨୨௨౨೨൨๒໒༢၂႒២᠒᥈᧒᪂᪒᭒᮲᱂᱒꘢꣒꤂꧒꩒꯲2]/g,"2")).replace(/[٣۳߃३৩੩૩୩௩౩೩൩๓໓༣၃႓៣᠓᥉᧓᪃᪓᭓᮳᱃᱓꘣꣓꤃꧓꩓꯳3]/g,"3")).replace(/[٤۴߄४৪੪૪୪௪౪೪൪๔໔༤၄႔៤᠔᥊᧔᪄᪔᭔᮴᱄᱔꘤꣔꤄꧔꩔꯴4]/g,"4")).replace(/[٥۵߅५৫੫૫୫௫౫೫൫๕໕༥၅႕៥᠕᥋᧕᪅᪕᭕᮵᱅᱕꘥꣕꤅꧕꩕꯵5]/g,"5")).replace(/[٦۶߆६৬੬૬୬௬౬೬൬๖໖༦၆႖៦᠖᥌᧖᪆᪖᭖᮶᱆᱖꘦꣖꤆꧖꩖꯶6]/g,"6")).replace(/[٧۷߇७৭੭૭୭௭౭೭൭๗໗༧၇႗៧᠗᥍᧗᪇᪗᭗᮷᱇᱗꘧꣗꤇꧗꩗꯷7]/g,"7")).replace(/[٨۸߈८৮੮૮୮௮౮೮൮๘໘༨၈႘៨᠘᥎᧘᪈᪘᭘᮸᱈᱘꘨꣘꤈꧘꩘꯸8]/g,"8")).replace(/[٩۹߉९৯੯૯୯௯౯೯൯๙໙༩၉႙៩᠙᥏᧙᪉᪙᭙᮹᱉᱙꘩꣙꤉꧙꩙꯹9]/g,"9")),e}match_books(e){const s=[];for(var t of Array.from(this.regexps.books)){var a=!1;if(e=e.replace(t.regexp,(function(e,r,n){a=!0,s.push({value:n,parsed:t.osis,type:"book"});const i=null!=t.extra?`/${t.extra}`:"";return`${r}${s.length-1}${i}`})),!0===a&&/^[\s\x1f\d:.,;\-\u2013\u2014]+$/.test(e))break}return[e=e.replace(this.regexps.translations,(function(e){return s.push({value:e,parsed:e.toLowerCase(),type:"translation"}),`${s.length-1}`})),this.get_book_indices(s,e)]}get_book_indices(e,s){let t,a=0;const r=new RegExp("([\\x1f\\x1e])(\\d+)(?:/\\d+)?\\1","g");for(;t=r.exec(s);)e[t[2]].start_index=t.index+a,a+=e[t[2]].value.length-t[0].length;return e}match_passages(e){let s,t=[],a={};for(;s=this.regexps.escaped_passage.exec(e);){let g;var[r,n,i]=Array.from(s),o=n.length;if(s.index+=r.length-o,/\s[2-9]\d\d\s*$|\s\d{4,}\s*$/.test(n)&&(n=n.replace(/\s+\d+\s*$/,"")),/[\d\x1f\x1e)]$/.test(n)||(n=this.replace_match_end(n)),"delete"===this.options.captive_end_digits_strategy){var l=s.index+n.length;e.length>l&&/^\w/.test(e.substr(l,1))&&(n=n.replace(/[\s*]+\d+$/,"")),n=n.replace(/(\x1e[)\]]?)[\s*]*\d+$/,"$1")}var u=""===(n=n.replace(/[A-Z]+/g,(e=>e.toLowerCase()))).substr(0,1)?0:n.split("")[0].length,c={value:grammar.parse(n,{punctuation_strategy:this.options.punctuation_strategy}),type:"base",start_index:this.passage.books[i].start_index-u,match:n};"full"===this.options.book_alone_strategy&&"include"===this.options.book_range_strategy&&"b"===c.value[0].type&&(1===c.value.length||c.value.length>1&&"translation_sequence"===c.value[1].type)&&0===u&&(1===this.passage.books[i].parsed.length||this.passage.books[i].parsed.length>1&&"translation"===this.passage.books[i].parsed[1].type)&&/^[234]/.test(this.passage.books[i].parsed[0])&&this.create_book_range(e,c,i),[g,a]=Array.from(this.passage.handle_obj(c)),t=t.concat(g);var p=this.adjust_regexp_end(g,o,n.length);p>0&&(this.regexps.escaped_passage.lastIndex-=p)}return[t,a]}adjust_regexp_end(e,s,t){let a=0;return e.length>0?a=s-e[e.length-1].indices[1]-1:s!==t&&(a=s-t),a}replace_match_end(e){let s,t=e.length;for(;s=this.regexps.match_end_split.exec(e);)t=s.index+s[0].length;return t<e.length&&(e=e.substr(0,t)),e}create_book_range(e,s,t){const a=[bcv_parser.prototype.regexps.first,bcv_parser.prototype.regexps.second,bcv_parser.prototype.regexps.third],r=parseInt(this.passage.books[t].parsed[0].substr(0,1),10);for(let o=1,l=r,u=1<=l;u?o<l:o>l;u?o++:o--){var n=o===r-1?bcv_parser.prototype.regexps.range_and:bcv_parser.prototype.regexps.range_only,i=e.match(new RegExp(`(?:^|\\W)(${a[o-1]}\\s*${n}\\s*)\\x1f${t}\\x1f`,"i"));if(null!=i)return this.add_book_range_object(s,i,o)}return!1}add_book_range_object(e,s,t){const{length:a}=s[1];if(e.value[0]={type:"b_range_pre",value:[{type:"b_pre",value:t.toString(),indices:[s.index,s.index+a]},e.value[0]],indices:[0,e.value[0].indices[1]+a]},e.value[0].value[1].indices[0]+=a,e.value[0].value[1].indices[1]+=a,e.start_index-=a,e.match=s[1]+e.match,1!==e.value.length)return(()=>{const s=[];for(let t=1,r=e.value.length,n=1<=r;n?t<r:t>r;n?t++:t--)null!=e.value[t].value&&(null!=(null!=e.value[t].value[0]?e.value[t].value[0].indices:void 0)&&(e.value[t].value[0].indices[0]+=a,e.value[t].value[0].indices[1]+=a),e.value[t].indices[0]+=a,s.push(e.value[t].indices[1]+=a));return s})()}osis(){const e=[];for(var s of Array.from(this.parsed_entities()))s.osis.length>0&&e.push(s.osis);return e.join(",")}osis_and_translations(){const e=[];for(var s of Array.from(this.parsed_entities()))s.osis.length>0&&e.push([s.osis,s.translations.join(",")]);return e}osis_and_indices(){const e=[];for(var s of Array.from(this.parsed_entities()))if(s.osis.length>0){const t={osis:s.osis,translations:s.translations,indices:s.indices};null!=s.osises&&(t.osises=s.osises),e.push(t)}return e}parsed_entities(){let e=[];for(let v=0,d=this.entities.length,b=0<=d;b?v<d:v>d;b?v++:v--){var s=this.entities[v];if(s.type&&"translation_sequence"===s.type&&e.length>0&&v===e[e.length-1].entity_id+1&&(e[e.length-1].indices[1]=s.absolute_indices[1]),null!=s.passages&&!("b"===s.type&&"ignore"===this.options.book_alone_strategy||"b_range"===s.type&&"ignore"===this.options.book_range_strategy||"context"===s.type)){var t=[],a=null;if(null!=s.passages[0].translations)for(var r of Array.from(s.passages[0].translations)){var n=(null!=r.osis?r.osis.length:void 0)>0?r.osis:"";null==a&&(a=r.alias),t.push(n)}else t=[""],a="default";for(var i=[],o=[],{length:l}=s.passages,u=0,c=u,p=l,g=0<=p;g?u<p:u>p;g?u++:u--,c=u){var _=s.passages[c];null==_.type&&(_.type=s.type),!1===_.valid.valid&&("ignore"===this.options.invalid_sequence_strategy&&"sequence"===s.type&&this.snap_sequence("ignore",s,i,c,l),"ignore"===this.options.invalid_passage_strategy)||("b"!==_.type&&"b_range"!==_.type||"ignore"!==this.options.book_sequence_strategy||"sequence"!==s.type?("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?i.push({osis:_.valid.valid?this.to_osis(_.start,_.end,a):"",osises:this.get_osises_by_chapter({osis:"",start:_.start,end:_.end},a),type:_.type,indices:_.absolute_indices,translations:t,start:_.start,end:_.end,enclosed_indices:_.enclosed_absolute_indices,entity_id:v,entities:[_]}):i.push({osis:_.valid.valid?this.to_osis(_.start,_.end,a):"",type:_.type,indices:_.absolute_indices,translations:t,start:_.start,end:_.end,enclosed_indices:_.enclosed_absolute_indices,entity_id:v,entities:[_]})):this.snap_sequence("book",s,i,c,l))}if(0!==i.length||0!==o.length){if("combine"!==this.options.consecutive_combination_strategy&&"separate-chapters"!==this.options.consecutive_combination_strategy||(i.length>1&&(i=this.combine_consecutive_passages(i,a)),i=i.concat(o).sort(((e,s)=>e.indices[0]-s.indices[0]))),"separate-chapters"===this.options.consecutive_combination_strategy)for(h of Array.from(i)){if(0===h.osis.length)continue;const e=this.get_osises_by_chapter(h,a);e.length>1&&(h.osises=e)}if("separate"===this.options.sequence_combination_strategy)e=e.concat(i);else{if("separate-chapters"===this.options.consecutive_combination_strategy&&"sequence"===s.type){const s=this.group_osises_by_semicolon(i);if(s.length>1){for(const a of Array.from(s)){if(0===a.length)continue;if(a.length>1){for(h of Array.from(a)){if(0===h.osis.length)continue;const s={osis:h.osis,indices:h.indices,translations:t,entity_id:v,entities:[h]};null!=h.osises&&(s.osises=h.osises),e.push(s)}continue}const s=a.length-1,r=[a[0].indices[0],a[s].indices[1]];null!=a[s].enclosed_indices&&a[s].enclosed_indices[1]>=0&&(r[1]=a[s].enclosed_indices[1]);const n=[];let i=[];for(h of Array.from(a))h.osis.length>0&&n.push(h.osis),null!=h.osises&&(i=i.concat(h.osises));const o={osis:n.join(","),indices:r,translations:t,entity_id:v,entities:a};i.length>0&&(o.osises=i),e.push(o)}continue}}var h,x=[],f=i.length-1;for(h of(null!=i[f].enclosed_indices&&i[f].enclosed_indices[1]>=0&&(s.absolute_indices[1]=i[f].enclosed_indices[1]),Array.from(i)))h.osis.length>0&&x.push(h.osis);let a=[];if("separate-chapters"===this.options.consecutive_combination_strategy)for(h of Array.from(i))null!=h.osises&&(a=a.concat(h.osises));const r={osis:x.join(","),indices:s.absolute_indices,translations:t,entity_id:v,entities:i};a.length>0&&(r.osises=a),e.push(r)}}}}return e}to_osis(e,s,t){let a;null==s.c&&null==s.v&&e.b===s.b&&null==e.c&&null==e.v&&"first_chapter"===this.options.book_alone_strategy&&(s.c=1);const r={start:"",end:""};return null==e.c&&(e.c=1),null==e.v&&(e.v=1),null==s.c&&(this.options.passage_existence_strategy.indexOf("c")>=0||null!=this.passage.translations[t].chapters[s.b]&&1===this.passage.translations[t].chapters[s.b].length?s.c=this.passage.translations[t].chapters[s.b].length:s.c=999),null==s.v&&(null!=this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0?s.v=this.passage.translations[t].chapters[s.b][s.c-1]:s.v=999),this.options.include_apocrypha&&"b"===this.options.ps151_strategy&&(151===e.c&&"Ps"===e.b||151===s.c&&"Ps"===s.b)&&this.fix_ps151(e,s,t),"b"===this.options.osis_compaction_strategy&&1===e.c&&1===e.v&&(999===s.c&&999===s.v||s.c===this.passage.translations[t].chapters[s.b].length&&this.options.passage_existence_strategy.indexOf("c")>=0&&(999===s.v||s.v===this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0))?(r.start=e.b,r.end=s.b):this.options.osis_compaction_strategy.length<=2&&1===e.v&&(999===s.v||s.v===this.passage.translations[t].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0)?(r.start=e.b+"."+e.c.toString(),r.end=s.b+"."+s.c.toString()):(r.start=e.b+"."+e.c.toString()+"."+e.v.toString(),r.end=s.b+"."+s.c.toString()+"."+s.v.toString()),a=r.start===r.end?r.start:r.start+"-"+r.end,null!=e.extra&&(a=e.extra+","+a),null!=s.extra&&(a+=","+s.extra),a}get_osises_by_chapter(e,s){if(null==e||null==e.start||null==e.end)return[];if(null==e.start.b||null==e.end.b||null==e.start.c||null==e.end.c)return null!=e.osis&&e.osis.length>0?[e.osis]:[];if(e.start.b!==e.end.b||e.start.c===e.end.c)return null!=e.osis&&e.osis.length>0?[e.osis]:[];const t=[];for(let a=e.start.c,r=e.end.c,n=e.start.c<=r;n?a<=r:a>=r;n?a++:a--){const r=a===e.start.c?e.start.v:1,n=a===e.end.c?e.end.v:this.translations[s].chapters[e.start.b][a-1],i={b:e.start.b,c:a,v:"bcv"===e.start.type?r:null,type:e.start.type},o={b:e.end.b,c:a,v:"bcv"===e.start.type?n:null,type:e.start.type};t.push(this.to_osis(i,o,s))}return t}get_separator_between(e,s){if(null==this.s||null==e||null==s)return"";const t=e[1],a=s[0];return a<=t?"":this.s.slice(t,a)}has_semicolon_separator(e,s){const t=this.get_separator_between(e.indices,s.indices);return/[;;]/.test(t)}group_osises_by_semicolon(e){const s=[];let t=[];for(const a of Array.from(e))0!==t.length&&this.has_semicolon_separator(t[t.length-1],a)?(s.push(t),t=[a]):t.push(a);return t.length>0&&s.push(t),s}fix_ps151(e,s,t){return"default"!==t&&null==(null!=this.translations[t]?this.translations[t].chapters.Ps151:void 0)&&this.passage.promote_book_to_translation("Ps151",t),151===e.c&&"Ps"===e.b?151===s.c&&"Ps"===s.b?(e.b="Ps151",e.c=1,s.b="Ps151",s.c=1):(e.extra=this.to_osis({b:"Ps151",c:1,v:e.v},{b:"Ps151",c:1,v:this.passage.translations[t].chapters.Ps151[0]},t),e.b="Prov",e.c=1,e.v=1):(s.extra=this.to_osis({b:"Ps151",c:1,v:1},{b:"Ps151",c:1,v:s.v},t),s.c=150,s.v=this.passage.translations[t].chapters.Ps[149])}combine_consecutive_passages(e,s){const t=[];let a={};const r=e.length-1;let n=-1,i=!1;for(let c=0,p=r,g=0<=p;g?c<=p:c>=p;g?c++:c--){var o=e[c];if(o.osis.length>0){var l=t.length-1,u=!1;if(l>=0&&this.has_semicolon_separator(t[l],o)){t.push(o),a={b:o.end.b,c:o.end.c,v:o.end.v};continue}o.enclosed_indices[0]!==n&&(n=o.enclosed_indices[0]),n>=0&&(c===r||e[c+1].enclosed_indices[0]!==o.enclosed_indices[0])&&(u=!0,i=!0),this.is_verse_consecutive(a,o.start,s)?(t[l].end=o.end,t[l].is_enclosed_last=u,t[l].indices[1]=o.indices[1],t[l].enclosed_indices[1]=o.enclosed_indices[1],t[l].osis=this.to_osis(t[l].start,o.end,s)):t.push(o),a={b:o.end.b,c:o.end.c,v:o.end.v}}else t.push(o),a={}}return i&&this.snap_enclosed_indices(t),t}snap_enclosed_indices(e){for(var s of Array.from(e))null!=s.is_enclosed_last&&(s.enclosed_indices[0]<0&&s.is_enclosed_last&&(s.indices[1]=s.enclosed_indices[1]),delete s.is_enclosed_last);return e}is_verse_consecutive(e,s,t){if(null==e.b)return!1;const a=null!=this.passage.translations[t].order?this.passage.translations[t].order:this.passage.translations.default.order;if(e.b===s.b){if(e.c===s.c){if(e.v===s.v-1)return!0}else if(1===s.v&&e.c===s.c-1&&e.v===this.passage.translations[t].chapters[e.b][e.c-1])return!0}else if(1===s.c&&1===s.v&&a[e.b]===a[s.b]-1&&e.c===this.passage.translations[t].chapters[e.b].length&&e.v===this.passage.translations[t].chapters[e.b][e.c-1])return!0;return!1}snap_range(e,s){let t,a,r;"b_range_start"===e.type||"sequence"===e.type&&"b_range_start"===e.passages[s].type?(t=1,a="end",r="b_range_start"):(t=0,a="start",r="range_end_b");const n="end"===a?"start":"end";for(var i of Object.keys(e.passages[s][n]||{}))e.passages[s][n][i]=e.passages[s][a][i];if("sequence"===e.type){s>=e.value.length&&(s=e.value.length-1);const t=this.passage.pluck(r,e.value[s]);if(null!=t){const a=this.snap_range(t,0);0===s?e.absolute_indices[0]=a.absolute_indices[0]:e.absolute_indices[1]=a.absolute_indices[1]}}else e.original_type=e.type,e.type=e.value[t].type,e.absolute_indices=[e.value[t].absolute_indices[0],e.value[t].absolute_indices[1]];return e}snap_sequence(e,s,t,a,r){const n=s.passages[a];return n.absolute_indices[0]===s.absolute_indices[0]&&a<r-1&&this.get_snap_sequence_i(s.passages,a,r)!==a?(s.absolute_indices[0]=s.passages[a+1].absolute_indices[0],this.remove_absolute_indices(s.passages,a+1)):n.absolute_indices[1]===s.absolute_indices[1]&&a>0?s.absolute_indices[1]=t.length>0?t[t.length-1].indices[1]:s.passages[a-1].absolute_indices[1]:"book"===e&&a<r-1&&!this.starts_with_book(s.passages[a+1])&&(s.passages[a+1].absolute_indices[0]=n.absolute_indices[0]),s}get_snap_sequence_i(e,s,t){for(let a=s+1,r=a,n=t,i=a<=n;i?r<n:r>n;i?r++:r--){if(this.starts_with_book(e[r]))return r;if(e[r].valid.valid)return s}return s}starts_with_book(e){return"b"===e.type.substr(0,1)||("range"===e.type||"ff"===e.type)&&"b"===e.start.type.substr(0,1)}remove_absolute_indices(e,s){if(e[s].enclosed_absolute_indices[0]<0)return!1;const[t,a]=Array.from(e[s].enclosed_absolute_indices);for(var r of Array.from(e.slice(s))){if(r.enclosed_absolute_indices[0]!==t||r.enclosed_absolute_indices[1]!==a)break;r.enclosed_absolute_indices=[-1,-1]}return!0}}bcv_parser.initClass(),this.bcv_parser=bcv_parser;class bcv_passage{static initClass(){this.prototype.books=[],this.prototype.indices={},this.prototype.options={},this.prototype.translations={}}handle_array(e,s,t){for(var a of(null==s&&(s=[]),null==t&&(t={}),Array.from(e)))if(null!=a){if("stop"===a.type)break;[s,t]=Array.from(this.handle_obj(a,s,t))}return[s,t]}handle_obj(e,s,t){return null!=e.type&&null!=this[e.type]?this[e.type](e,s,t):[s,t]}b(e,s,t){let a;e.start_context=bcv_utils.shallow_clone(t),e.passages=[];const r=[];for(a of Array.from(this.books[e.value].parsed)){var n=this.validate_ref(e.start_context.translations,{b:a}),i={start:{b:a},end:{b:a},valid:n};0===e.passages.length&&n.valid?e.passages.push(i):r.push(i)}return 0===e.passages.length&&e.passages.push(r.shift()),r.length>0&&(e.passages[0].alternates=r),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),t={b:e.passages[0].start.b},null!=e.start_context.translations&&(t.translations=e.start_context.translations),[s,t]}b_range(e,s,t){return this.range(e,s,t)}b_range_pre(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t),e.passages=[];const n=this.pluck("b",e.value);a=this.b(n,[],t),[r]=Array.from(a[0]),t=a[1],null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices));const i={b:e.value[0].value+r.passages[0].start.b.substr(1),type:"b"};return e.passages=[{start:i,end:r.passages[0].end,valid:r.passages[0].valid}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),[s,t]}b_range_start(e,s,t){return this.range(e,s,t)}base(e,s,t){return this.indices=this.calculate_indices(e.match,e.start_index),this.handle_array(e.value,s,t)}bc(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.passages=[],this.reset_context(t,["b","c","v"]);const a=this.pluck("c",e.value).value,r=[];for(var n of Array.from(this.books[this.pluck("b",e.value).value].parsed)){var i="c",o=this.validate_ref(e.start_context.translations,{b:n,c:a}),l={start:{b:n},end:{b:n},valid:o};(o.messages.start_chapter_not_exist_in_single_chapter_book||o.messages.start_chapter_1)&&(l.valid=this.validate_ref(e.start_context.translations,{b:n,v:a}),o.messages.start_chapter_not_exist_in_single_chapter_book&&(l.valid.messages.start_chapter_not_exist_in_single_chapter_book=1),l.start.c=1,l.end.c=1,i="v"),l.start[i]=a,[l.start.c,l.start.v]=Array.from(this.fix_start_zeroes(l.valid,l.start.c,l.start.v)),null==l.start.v&&delete l.start.v,l.end[i]=l.start[i],0===e.passages.length&&l.valid.valid?e.passages.push(l):r.push(l)}return 0===e.passages.length&&e.passages.push(r.shift()),r.length>0&&(e.passages[0].alternates=r),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),this.set_context_from_object(t,["b","c","v"],e.passages[0].start),s.push(e),[s,t]}bc_title(e,s,t){let a,r;if(e.start_context=bcv_utils.shallow_clone(t),a=this.bc(this.pluck("bc",e.value),[],t),[r]=Array.from(a[0]),t=a[1],"Ps"!==r.passages[0].start.b.substr(0,2)&&null!=r.passages[0].alternates)for(let e=0,s=r.passages[0].alternates.length,t=0<=s;t?e<s:e>s;t?e++:e--)if("Ps"===r.passages[0].alternates[e].start.b.substr(0,2)){r.passages[0]=r.passages[0].alternates[e];break}if("Ps"!==r.passages[0].start.b.substr(0,2))return s.push(r),[s,t];this.books[this.pluck("b",r.value).value].parsed=["Ps"];let n=this.pluck("title",e.value);return null==n&&(n=this.pluck("v",e.value)),e.value[1]={type:"v",value:[{type:"integer",value:1,indices:n.indices}],indices:n.indices},e.type="bcv",this.bcv(e,s,e.start_context)}bcv(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.passages=[],this.reset_context(t,["b","c","v"]);const a=this.pluck("bc",e.value);let r=this.pluck("c",a.value).value,n=this.pluck("v",e.value).value;const i=[];for(var o of Array.from(this.books[this.pluck("b",a.value).value].parsed)){var l=this.validate_ref(e.start_context.translations,{b:o,c:r,v:n});[r,n]=Array.from(this.fix_start_zeroes(l,r,n));var u={start:{b:o,c:r,v:n},end:{b:o,c:r,v:n},valid:l};0===e.passages.length&&l.valid?e.passages.push(u):i.push(u)}return 0===e.passages.length&&e.passages.push(i.shift()),i.length>0&&(e.passages[0].alternates=i),null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),this.set_context_from_object(t,["b","c","v"],e.passages[0].start),s.push(e),[s,t]}bv(e,s,t){let a;e.start_context=bcv_utils.shallow_clone(t);const[r,n]=Array.from(e.value);let i={indices:e.indices,value:[{type:"bc",value:[r,{type:"c",value:[{type:"integer",value:1}]}]},n]};return a=this.bcv(i,[],t),[i]=Array.from(a[0]),t=a[1],e.passages=i.passages,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),[s,t]}c(e,s,t){e.start_context=bcv_utils.shallow_clone(t);let a="integer"===e.type?e.value:this.pluck("integer",e.value).value;const r=this.validate_ref(e.start_context.translations,{b:t.b,c:a});return!r.valid&&r.messages.start_chapter_not_exist_in_single_chapter_book?this.v(e,s,t):([a]=Array.from(this.fix_start_zeroes(r,a)),e.passages=[{start:{b:t.b,c:a},end:{b:t.b,c:a},valid:r}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),t.c=a,this.reset_context(t,["v"]),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,t])}c_psalm(e,s,t){e.type="bc";const a=parseInt(this.books[e.value].value.match(/^\d+/)[0],10);return e.value=[{type:"b",value:e.value,indices:e.indices},{type:"c",value:[{type:"integer",value:a,indices:e.indices}],indices:e.indices}],this.bc(e,s,t)}c_title(e,s,t){if(e.start_context=bcv_utils.shallow_clone(t),"Ps"!==t.b)return this.c(e.value[0],s,t);const a=this.pluck("title",e.value);return e.value[1]={type:"v",value:[{type:"integer",value:1,indices:a.indices}],indices:a.indices},e.type="cv",this.cv(e,s,e.start_context)}cv(e,s,t){e.start_context=bcv_utils.shallow_clone(t);let a=this.pluck("c",e.value).value,r=this.pluck("v",e.value).value;const n=this.validate_ref(e.start_context.translations,{b:t.b,c:a,v:r});return[a,r]=Array.from(this.fix_start_zeroes(n,a,r)),e.passages=[{start:{b:t.b,c:a,v:r},end:{b:t.b,c:a,v:r},valid:n}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),s.push(e),t.c=a,t.v=r,null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),[s,t]}cb_range(e,s,t){e.type="range";const[a,r,n]=Array.from(e.value);return e.value=[{type:"bc",value:[a,r],indices:e.indices},n],n.indices[1]=e.indices[1],this.range(e,s,t)}context(e,s,t){for(var a of(e.start_context=bcv_utils.shallow_clone(t),e.passages=[],Object.keys(this.books[e.value].context||{})))t[a]=this.books[e.value].context[a];return s.push(e),[s,t]}cv_psalm(e,s,t){e.start_context=bcv_utils.shallow_clone(t),e.type="bcv";const[a,r]=Array.from(e.value),n=this.c_psalm(a,[],e.start_context),[i]=Array.from(n[0]);return e.value=[i,r],this.bcv(e,s,t)}ff(e,s,t){let a;return e.start_context=bcv_utils.shallow_clone(t),e.value.push({type:"integer",indices:e.indices,value:999}),a=this.range(e,[],e.start_context),[e]=Array.from(a[0]),t=a[1],e.value[0].indices=e.value[1].indices,e.value[0].absolute_indices=e.value[1].absolute_indices,e.value.pop(),null!=e.passages[0].valid.messages.end_verse_not_exist&&delete e.passages[0].valid.messages.end_verse_not_exist,null!=e.passages[0].valid.messages.end_chapter_not_exist&&delete e.passages[0].valid.messages.end_chapter_not_exist,null!=e.passages[0].end.original_c&&delete e.passages[0].end.original_c,s.push(e),[s,t]}integer_title(e,s,t){return e.start_context=bcv_utils.shallow_clone(t),"Ps"!==t.b?this.integer(e.value[0],s,t):(e.value[0]={type:"c",value:[e.value[0]],indices:[e.value[0].indices[0],e.value[0].indices[1]]},e.value[1].type="v",e.value[1].original_type="title",e.value[1].value=[{type:"integer",value:1,indices:e.value[1].value.indices}],e.type="cv",this.cv(e,s,e.start_context))}integer(e,s,t){return null!=t.v?this.v(e,s,t):this.c(e,s,t)}next_v(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t);let n=this.pluck_last_recursively("integer",e.value);if(null==n&&(n={value:1}),e.value.push({type:"integer",indices:e.indices,value:n.value+1}),a=this.range(e,[],e.start_context),[r]=Array.from(a[0]),t=a[1],null!=r.passages[0].valid.messages.end_verse_not_exist&&null==r.passages[0].valid.messages.start_verse_not_exist&&null==r.passages[0].valid.messages.start_chapter_not_exist&&null!=t.c){let s;e.value.pop(),e.value.push({type:"cv",indices:e.indices,value:[{type:"c",value:[{type:"integer",value:t.c+1,indices:e.indices}],indices:e.indices},{type:"v",value:[{type:"integer",value:1,indices:e.indices}],indices:e.indices}]}),s=this.range(e,[],e.start_context),[r]=Array.from(s[0]),t=s[1]}return r.value[0].indices=r.value[1].indices,r.value[0].absolute_indices=r.value[1].absolute_indices,r.value.pop(),null!=r.passages[0].valid.messages.end_verse_not_exist&&delete r.passages[0].valid.messages.end_verse_not_exist,null!=r.passages[0].valid.messages.end_chapter_not_exist&&delete r.passages[0].valid.messages.end_chapter_not_exist,null!=r.passages[0].end.original_c&&delete r.passages[0].end.original_c,s.push(r),[s,t]}sequence(e,s,t){for(var a of(e.start_context=bcv_utils.shallow_clone(t),e.passages=[],Array.from(e.value))){var r,n;for(var i of(r=this.handle_array(a,[],t),[n]=Array.from(r[0]),t=r[1],Array.from(n.passages)))null==i.type&&(i.type=n.type),null==i.absolute_indices&&(i.absolute_indices=n.absolute_indices),null!=n.start_context.translations&&(i.translations=n.start_context.translations),i.enclosed_absolute_indices="sequence_post_enclosed"===n.type?n.absolute_indices:[-1,-1],e.passages.push(i)}return null==e.absolute_indices&&(e.passages.length>0&&"sequence"===e.type?e.absolute_indices=[e.passages[0].absolute_indices[0],e.passages[e.passages.length-1].absolute_indices[1]]:e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),[s,t]}sequence_post_enclosed(e,s,t){return this.sequence(e,s,t)}v(e,s,t){let a,r="integer"===e.type?e.value:this.pluck("integer",e.value).value;e.start_context=bcv_utils.shallow_clone(t);const n=null!=t.c?t.c:1,i=this.validate_ref(e.start_context.translations,{b:t.b,c:n,v:r});return[a,r]=Array.from(this.fix_start_zeroes(i,0,r)),e.passages=[{start:{b:t.b,c:n,v:r},end:{b:t.b,c:n,v:r},valid:i}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),t.v=r,[s,t]}range(e,s,t){let a,r;e.start_context=bcv_utils.shallow_clone(t);let[n,i]=Array.from(e.value);if(a=this.handle_obj(n,[],t),[n]=Array.from(a[0]),t=a[1],"v"===i.type&&("bc"===n.type&&!__guard__(__guard__(__guard__(null!=n.passages?n.passages[0]:void 0,(e=>e.valid)),(e=>e.messages)),(e=>e.start_chapter_not_exist_in_single_chapter_book))||"c"===n.type)&&"verse"===this.options.end_range_digits_strategy)return e.value[0]=n,this.range_change_integer_end(e,s);r=this.handle_obj(i,[],t),[i]=Array.from(r[0]),t=r[1],e.value=[n,i],e.indices=[n.indices[0],i.indices[1]],delete e.absolute_indices;const o={b:n.passages[0].start.b,c:n.passages[0].start.c,v:n.passages[0].start.v,type:n.type},l={b:i.passages[0].end.b,c:i.passages[0].end.c,v:i.passages[0].end.v,type:i.type};i.passages[0].valid.messages.start_chapter_is_zero&&(l.c=0),i.passages[0].valid.messages.start_verse_is_zero&&(l.v=0);const u=this.validate_ref(e.start_context.translations,o,l);if(!u.valid)return this.range_handle_invalid(u,e,n,o,i,l,s);{const[t,a]=Array.from(this.range_handle_valid(u,e,n,o,i,l,s));if(t)return a}return null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),e.passages=[{start:o,end:l,valid:u}],null!=e.start_context.translations&&(e.passages[0].translations=e.start_context.translations),"b"===o.type?"b"===l.type?e.type="b_range":e.type="b_range_start":"b"===l.type&&(e.type="range_end_b"),s.push(e),[s,t]}range_change_end(e,s,t){let a;const[r,n]=Array.from(e.value);return"integer"===n.type?(n.original_value=n.value,n.value=t):"v"===n.type?(a=this.pluck("integer",n.value),a.original_value=a.value,a.value=t):"cv"===n.type&&(a=this.pluck("c",n.value),a.original_value=a.value,a.value=t),this.handle_obj(e,s,e.start_context)}range_change_integer_end(e,s){const[t,a]=Array.from(e.value);return null==e.original_type&&(e.original_type=e.type),null==e.original_value&&(e.original_value=[t,a]),e.type="integer"===t.type?"cv":t.type+"v","integer"===t.type&&(e.value[0]={type:"c",value:[t],indices:t.indices}),"integer"===a.type&&(e.value[1]={type:"v",value:[a],indices:a.indices}),this.handle_obj(e,s,e.start_context)}range_check_new_end(e,s,t,a){let r=0,n=null;if(a.messages.end_chapter_before_start?n="c":a.messages.end_verse_before_start&&(n="v"),null!=n&&(r=this.range_get_new_end_value(s,t,a,n)),r>0){const s={b:t.b,c:t.c,v:t.v};s[n]=r;this.validate_ref(e,s).valid||(r=0)}return r}range_end_b(e,s,t){return this.range(e,s,t)}range_get_new_end_value(e,s,t,a){let r=0;return"c"===a&&t.messages.end_chapter_is_zero||"v"===a&&t.messages.end_verse_is_zero||(e[a]>=10&&s[a]<10&&e[a]-10*Math.floor(e[a]/10)<s[a]?r=s[a]+10*Math.floor(e[a]/10):e[a]>=100&&s[a]<100&&e[a]-100<s[a]&&(r=s[a]+100)),r}range_handle_invalid(e,s,t,a,r,n,i){if(!1===e.valid&&(e.messages.end_chapter_before_start||e.messages.end_verse_before_start)&&("integer"===r.type||"v"===r.type)||!1===e.valid&&e.messages.end_chapter_before_start&&"cv"===r.type){const t=this.range_check_new_end(s.start_context.translations,a,n,e);if(t>0)return this.range_change_end(s,i,t)}if("verse"===this.options.end_range_digits_strategy&&null==a.v&&("integer"===r.type||"v"===r.type)){const e="v"===r.type?this.pluck("integer",r.value):r.value;if(this.validate_ref(s.start_context.translations,{b:a.b,c:a.c,v:e}).valid)return this.range_change_integer_end(s,i)}return null==s.original_type&&(s.original_type=s.type),s.type="sequence",[s.original_value,s.value]=Array.from([[t,r],[[t],[r]]]),this.sequence(s,i,s.start_context)}range_handle_valid(e,s,t,a,r,n,i){if(e.messages.end_chapter_not_exist&&"verse"===this.options.end_range_digits_strategy&&null==a.v&&("integer"===r.type||"v"===r.type)&&this.options.passage_existence_strategy.indexOf("v")>=0){const e="v"===r.type?this.pluck("integer",r.value):r.value;if(this.validate_ref(s.start_context.translations,{b:a.b,c:a.c,v:e}).valid)return[!0,this.range_change_integer_end(s,i)]}return this.range_validate(e,a,n,s),[!1,null]}range_validate(e,s,t,a){return e.messages.end_chapter_not_exist||e.messages.end_chapter_not_exist_in_single_chapter_book?(t.original_c=t.c,t.c=e.messages.end_chapter_not_exist?e.messages.end_chapter_not_exist:e.messages.end_chapter_not_exist_in_single_chapter_book,null!=t.v&&(t.v=this.validate_ref(a.start_context.translations,{b:t.b,c:t.c,v:999}).messages.end_verse_not_exist,delete e.messages.end_verse_is_zero)):e.messages.end_verse_not_exist&&(t.original_v=t.v,t.v=e.messages.end_verse_not_exist),e.messages.end_verse_is_zero&&"allow"!==this.options.zero_verse_strategy&&(t.v=e.messages.end_verse_is_zero),e.messages.end_chapter_is_zero&&(t.c=e.messages.end_chapter_is_zero),[s.c,s.v]=Array.from(this.fix_start_zeroes(e,s.c,s.v)),!0}translation_sequence(e,s,t){e.start_context=bcv_utils.shallow_clone(t);const a=[];for(var r of(a.push({translation:this.books[e.value[0].value].parsed}),Array.from(e.value[1])))null!=(r=this.books[this.pluck("translation",r).value].parsed)&&a.push({translation:r});for(var n of Array.from(a))null!=this.translations.aliases[n.translation]?(n.alias=this.translations.aliases[n.translation].alias,n.osis=this.translations.aliases[n.translation].osis||n.translation.toUpperCase()):(n.alias="default",n.osis=n.translation.toUpperCase());return s.length>0&&(t=this.translation_sequence_apply(s,a)),null==e.absolute_indices&&(e.absolute_indices=this.get_absolute_indices(e.indices)),s.push(e),this.reset_context(t,["translations"]),[s,t]}translation_sequence_apply(e,s){let t,a=0;for(let s=e.length-1,t=s,r=s<=0;r?t<=0:t>=0;r?t++:t--)if(null!=e[t].original_type&&(e[t].type=e[t].original_type),null!=e[t].original_value&&(e[t].value=e[t].original_value),"translation_sequence"===e[t].type){a=t+1;break}if(a<e.length){let r;e[a].start_context.translations=s,[r,t]=Array.from(this.handle_array(e.slice(a),[],e[a].start_context))}else t=bcv_utils.shallow_clone(e[e.length-1].start_context);return t}pluck(e,s){for(var t of Array.from(s))if(null!=t&&null!=t.type&&t.type===e)return"c"===e||"v"===e?this.pluck("integer",t.value):t;return null}pluck_last_recursively(e,s){for(let r=s.length-1;r>=0;r--){var t=s[r];if(null!=t&&null!=t.type){if(t.type===e)return this.pluck(e,[t]);var a=this.pluck_last_recursively(e,t.value);if(null!=a)return a}}return null}set_context_from_object(e,s,t){return(()=>{const a=[];for(var r of Array.from(s))null!=t[r]&&a.push(e[r]=t[r]);return a})()}reset_context(e,s){return Array.from(s).map((s=>delete e[s]))}fix_start_zeroes(e,s,t){return e.messages.start_chapter_is_zero&&"upgrade"===this.options.zero_chapter_strategy&&(s=e.messages.start_chapter_is_zero),e.messages.start_verse_is_zero&&"upgrade"===this.options.zero_verse_strategy&&(t=e.messages.start_verse_is_zero),[s,t]}calculate_indices(e,s){let t,a="book";const r=[];let n=0;s=parseInt(s,10);let i=[e];for(var o of["",""]){var l=[];for(t of Array.from(i))l=l.concat(t.split(o));i=l}for(t of Array.from(i)){var u;a="book"===a?"rest":"book";var c=t.length;0!==c&&("book"===a?(t=t.replace(/\/\d+$/,""),u=n+c,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:n,end:u,index:s}),n+=c+2,s=this.books[t].start_index+this.books[t].value.length-n,r.push({start:u+1,end:u+1,index:s})):(u=n+c-1,r.length>0&&r[r.length-1].index===s?r[r.length-1].end=u:r.push({start:n,end:u,index:s}),n+=c))}return r}get_absolute_indices(...e){const[s,t]=Array.from(e[0]);let a=null,r=null;for(var n of Array.from(this.indices))if(null===a&&n.start<=s&&s<=n.end&&(a=s+n.index),n.start<=t&&t<=n.end){r=t+n.index+1;break}return[a,r]}validate_ref(e,s,t){null!=e&&e.length>0||(e=[{translation:"default",osis:"",alias:"default"}]);let a=!1;const r={};for(var n of Array.from(e))if(null==n.alias&&(n.alias="default"),null!=n.alias){null==this.translations.aliases[n.alias]&&(n.alias="default",null==r.translation_unknown&&(r.translation_unknown=[]),r.translation_unknown.push(n));var[i]=Array.from(this.validate_start_ref(n.alias,s,r));t&&([i]=Array.from(this.validate_end_ref(n.alias,s,t,i,r))),!0===i&&(a=!0)}else null==r.translation_invalid&&(r.translation_invalid=[]),r.translation_invalid.push(n);return{valid:a,messages:r}}validate_start_ref(e,s,t){let a=!0;"default"!==e&&null==(null!=this.translations[e]?this.translations[e].chapters[s.b]:void 0)&&this.promote_book_to_translation(s.b,e);const r=null!=(null!=this.translations[e]?this.translations[e].order:void 0)?e:"default";if(null!=s.v&&(s.v=parseInt(s.v,10)),null!=this.translations[r].order[s.b]){if(null==s.c&&(s.c=1),s.c=parseInt(s.c,10),isNaN(s.c))return a=!1,t.start_chapter_not_numeric=!0,[a,t];0===s.c&&(t.start_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?a=!1:s.c=1),null!=s.v&&0===s.v&&(t.start_verse_is_zero=1,"error"===this.options.zero_verse_strategy?a=!1:"upgrade"===this.options.zero_verse_strategy&&(s.v=1)),s.c>0&&null!=this.translations[e].chapters[s.b][s.c-1]?null!=s.v?isNaN(s.v)?(a=!1,t.start_verse_not_numeric=!0):s.v>this.translations[e].chapters[s.b][s.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(a=!1,t.start_verse_not_exist=this.translations[e].chapters[s.b][s.c-1]):1===s.c&&"verse"===this.options.single_chapter_1_strategy&&1===this.translations[e].chapters[s.b].length&&(t.start_chapter_1=1):1!==s.c&&1===this.translations[e].chapters[s.b].length?(a=!1,t.start_chapter_not_exist_in_single_chapter_book=1):s.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(a=!1,t.start_chapter_not_exist=this.translations[e].chapters[s.b].length)}else null==s.b?(a=!1,t.start_book_not_defined=!0):(this.options.passage_existence_strategy.indexOf("b")>=0&&(a=!1),t.start_book_not_exist=!0);return[a,t]}validate_end_ref(e,s,t,a,r){const n=null!=(null!=this.translations[e]?this.translations[e].order:void 0)?e:"default";return null!=t.c&&(t.c=parseInt(t.c,10),isNaN(t.c)?(a=!1,r.end_chapter_not_numeric=!0):0===t.c&&(r.end_chapter_is_zero=1,"error"===this.options.zero_chapter_strategy?a=!1:t.c=1)),null!=t.v&&(t.v=parseInt(t.v,10),isNaN(t.v)?(a=!1,r.end_verse_not_numeric=!0):0===t.v&&(r.end_verse_is_zero=1,"error"===this.options.zero_verse_strategy?a=!1:"upgrade"===this.options.zero_verse_strategy&&(t.v=1))),null!=this.translations[n].order[t.b]?(null==t.c&&1===this.translations[e].chapters[t.b].length&&(t.c=1),null!=this.translations[n].order[s.b]&&this.translations[n].order[s.b]>this.translations[n].order[t.b]&&(this.options.passage_existence_strategy.indexOf("b")>=0&&(a=!1),r.end_book_before_start=!0),s.b!==t.b||null==t.c||isNaN(t.c)||(null==s.c&&(s.c=1),!isNaN(parseInt(s.c,10))&&s.c>t.c?(a=!1,r.end_chapter_before_start=!0):s.c!==t.c||null==t.v||isNaN(t.v)||(null==s.v&&(s.v=1),!isNaN(parseInt(s.v,10))&&s.v>t.v&&(a=!1,r.end_verse_before_start=!0))),null==t.c||isNaN(t.c)||null==this.translations[e].chapters[t.b][t.c-1]&&(1===this.translations[e].chapters[t.b].length?r.end_chapter_not_exist_in_single_chapter_book=1:t.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(r.end_chapter_not_exist=this.translations[e].chapters[t.b].length)),null==t.v||isNaN(t.v)||(null==t.c&&(t.c=this.translations[e].chapters[t.b].length),t.v>this.translations[e].chapters[t.b][t.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(r.end_verse_not_exist=this.translations[e].chapters[t.b][t.c-1]))):(a=!1,r.end_book_not_exist=!0),[a,r]}promote_book_to_translation(e,s){if(null==this.translations[s]&&(this.translations[s]={}),null==this.translations[s].chapters&&(this.translations[s].chapters={}),null==this.translations[s].chapters[e])return this.translations[s].chapters[e]=bcv_utils.shallow_clone_array(this.translations.default.chapters[e])}}function __guard__(e,s){return null!=e?s(e):void 0}bcv_passage.initClass();const bcv_utils={shallow_clone(e){if(null==e)return e;const s={};for(const t of Object.keys(e||{})){const a=e[t];s[t]=a}return s},shallow_clone_array(e){if(null==e)return e;const s=[];for(let t=0,a=e.length,r=0<=a;r?t<=a:t>=a;r?t++:t--)void 0!==e[t]&&(s[t]=e[t]);return s}};bcv_parser.prototype.regexps.translations=RegExp("(?:(?:CKK))\\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=["hr"];const heregex=e=>{let s="",t=!1,a=!1;for(let r=0;r<e.length;r++){const n=e[r];if(a)s+=n,a=!1;else if("\\"!==n)if(t||"["!==n)if(t&&"]"===n)t=!1,s+=n;else if(t||"#"!==n)!t&&/\s/.test(n)||(s+=n);else for(;r<e.length&&"\n"!==e[r];)r+=1;else t=!0,s+=n;else s+=n,a=!0}return s};var grammar;bcv_parser.prototype.regexps.space="[\\s\\xa0]",bcv_parser.prototype.regexps.escaped_passage=RegExp(heregex(String.raw`
|
|
2
2
|
(?:^ | [^\x1f\x1e\dA-Za-zªµºÀ-ÖØ-öø-ɏḀ-ỿⱠ-ⱿꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꟿ] ) # Beginning of string or not in the middle of a word or immediately following another book. Only count a book if it's part of a sequence: \`Matt5John3\` is OK, but not \`1Matt5John3\`
|
|
3
3
|
(
|
|
4
4
|
# Start inverted book/chapter (cb)
|
|
@@ -197,4 +197,4 @@ const root=this;class bcv_parser{static initClass(){this.prototype.s="",this.pro
|
|
|
197
197
|
(?:4(?:Macc|[\s\xa0]*Mak))
|
|
198
198
|
)(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]/"'\*=~\-\u2013\u2014])|$)`),"gi")},{osis:["1Macc"],apocrypha:!0,regexp:RegExp(heregex(String.raw`(^|[^0-9A-Za-zªµºÀ-ÖØ-öø-ɏḀ-ỿⱠ-ⱿꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꟿ])(
|
|
199
199
|
(?:Prva[\s\xa0]*knjiga[\s\xa0]*o[\s\xa0]*Makabejcima|1(?:Macc|[\s\xa0]*Mak))
|
|
200
|
-
)(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]/"'\*=~\-\u2013\u2014])|$)`),"gi")}];if(!0===e&&"none"===s)return t;const a=[];for(const r of t)!1===e&&null!=r.apocrypha&&!0===r.apocrypha||("books"===s&&(r.regexp=new RegExp(r.regexp.source,"g")),a.push(r));return a},bcv_parser.prototype.regexps.books=bcv_parser.prototype.regexps.get_books(!1,"none"),function(){"use strict";function e(s,t,a,r){var n=Error.call(this,s);return Object.setPrototypeOf&&Object.setPrototypeOf(n,e.prototype),n.expected=t,n.found=a,n.location=r,n.name="SyntaxError",n}function s(e,s,t){return t=t||" ",e.length>s?e:(s-=e.length,e+(t+=t.repeat(s)).slice(0,s))}!function(e,s){function t(){this.constructor=e}t.prototype=s.prototype,e.prototype=new t}(e,Error),e.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var a,r=null;for(a=0;a<e.length;a++)if(e[a].source===this.location.source){r=e[a].text.split(/\r\n|\n|\r/g);break}var n=this.location.start,i=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(n):n,o=this.location.source+":"+i.line+":"+i.column;if(r){var l=this.location.end,u=s("",i.line.toString().length," "),c=r[n.line-1],p=(n.line===l.line?l.column:c.length+1)-n.column||1;t+="\n --\x3e "+o+"\n"+u+" |\n"+i.line+" | "+c+"\n"+u+" | "+s("",n.column-1," ")+s("",p,"^")}else t+="\n at "+o}return t},e.buildMessage=function(e,s){var t={literal:function(e){return'"'+r(e.text)+'"'},class:function(e){var s=e.parts.map((function(e){return Array.isArray(e)?n(e[0])+"-"+n(e[1]):n(e)}));return"["+(e.inverted?"^":"")+s.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function a(e){return e.charCodeAt(0).toString(16).toUpperCase()}function r(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+a(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+a(e)}))}function n(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+a(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+a(e)}))}function i(e){return t[e.type](e)}return"Expected "+function(e){var s,t,a=e.map(i);if(a.sort(),a.length>0){for(s=1,t=1;s<a.length;s++)a[s-1]!==a[s]&&(a[t]=a[s],t++);a.length=t}switch(a.length){case 1:return a[0];case 2:return a[0]+" or "+a[1];default:return a.slice(0,-1).join(", ")+", or "+a[a.length-1]}}(e)+" but "+function(e){return e?'"'+r(e)+'"':"end of input"}(s)+" found."},grammar={StartRules:["start"],SyntaxError:e,parse:function(s,t){var a,r={},n=(t=void 0!==t?t:{}).grammarSource,i={start:ws},o=ws,l="(",u=")",c="",p="/",g=",",_=".",h="-",x="th",f="nd",v="st",d="/1",b="ff",y="/9",m="/2",k=".1",$="poglavlja",A="poglavlje",E="glava",S="verse",j="i",w="title",P="from",R="of",I="in",z="the",J="book",C="",M=/^[1-8]/,K=/^[a-z]/,T=/^[0-9]/,N=/^[a-e]/,Z=/^["']/,O=/^[,;\/:&\-\u2013\u2014~]/,q=/^[\-\u2013\u2014]/,L=/^[([]/,D=/^[)\]]/,F=/^[^\x1F\x1E([]/,H=ks("(",!1),G=ks(")",!1),B=ks("",!1),W=ks("/",!1),U=$s([["1","8"]],!1,!1),Q=ks(",",!1),V=ks(".",!1),X=ks("-",!1),Y=ks("th",!1),ee=ks("nd",!1),se=ks("st",!1),te=ks("/1",!1),ae=ks("ff",!1),re=$s([["a","z"]],!1,!1),ne=ks("/9",!1),ie=ks("/2",!1),oe=ks(".1",!1),le=$s([["0","9"]],!1,!1),ue=$s([["a","e"]],!1,!1),ce=ks("poglavlja",!1),pe=ks("poglavlje",!1),ge=ks("glava",!1),_e=ks("verse",!1),he=ks(":",!1),xe=$s(['"',"'"],!1,!1),fe=$s([",",";","/",":","&","-","–","—","~"],!1,!1),ve=ks("i",!1),de=$s(["-","–","—"],!1,!1),be=ks("title",!1),ye=ks("from",!1),me=ks("of",!1),ke=ks("in",!1),$e=ks("the",!1),Ae=ks("book",!1),Ee=$s(["(","["],!1,!1),Se=$s([")","]"],!1,!1),je=ks("",!1),we=(ks(",000",!1),$s(["","","(","["],!0,!1)),Pe=($s([" ","\t","\r","\n"," ","*"],!1,!1),function(e,s){return s.unshift([e]),{type:"sequence",value:s,indices:[vs,fs-1]}}),Re=function(e,s){return void 0===s&&(s=[]),s.unshift([e]),{type:"sequence_post_enclosed",value:s,indices:[vs,fs-1]}},Ie=function(e,s){return e.length&&2===e.length&&(e=e[0]),{type:"range",value:[e,s],indices:[vs,fs-1]}},ze=function(e){return{type:"b",value:e.value,indices:[vs,fs-1]}},Je=function(e,s){return{type:"bc",value:[e,s],indices:[vs,fs-1]}},Ce=function(e,s){return{type:"bc",value:[e,s],indices:[vs,fs-1]}},Me=function(e,s){return{type:"bc_title",value:[e,s],indices:[vs,fs-1]}},Ke=function(e,s){return{type:"bcv",value:[e,s],indices:[vs,fs-1]}},Te=function(e,s){return{type:"bcv",value:[e,s],indices:[vs,fs-1]}},Ne=function(e,s){return{type:"bcv",value:[e,s],indices:[vs,fs-1]}},Ze=function(e,s,t,a){return{type:"range",value:[{type:"bcv",value:[{type:"bc",value:[e,s],indices:[e.indices[0],s.indices[1]]},t],indices:[e.indices[0],t.indices[1]]},a],indices:[vs,fs-1]}},Oe=function(e,s){return{type:"bv",value:[e,s],indices:[vs,fs-1]}},qe=function(e,s){return{type:"bc",value:[s,e],indices:[vs,fs-1]}},Le=function(e,s,t){return{type:"cb_range",value:[t,e,s],indices:[vs,fs-1]}},De=function(e,s){return{type:"bcv",value:[e,s],indices:[vs,fs-1]}},Fe=function(e,s){return{type:"bc",value:[s,e],indices:[vs,fs-1]}},He=function(e,s){return{type:"bcv",value:[e,s],indices:[vs,fs-1]}},Ge=function(e){return{type:"c_psalm",value:e.value,indices:[vs,fs-1]}},Be=function(e,s){return{type:"cv_psalm",value:[e,s],indices:[vs,fs-1]}},We=function(e,s){return{type:"c_title",value:[e,s],indices:[vs,fs-1]}},Ue=function(e,s){return{type:"cv",value:[e,s],indices:[vs,fs-1]}},Qe=function(e,s){return{type:"cv",value:[e,s],indices:[vs,fs-1]}},Ve=function(e){return{type:"c",value:[e],indices:[vs,fs-1]}},Xe=function(e){return{type:"ff",value:[e],indices:[vs,fs-1]}},Ye=function(e,s){return{type:"integer_title",value:[e,s],indices:[vs,fs-1]}},es=function(e){return{type:"context",value:e.value,indices:[vs,fs-1]}},ss=function(e){return{type:"b",value:e.value,indices:[vs,fs-1]}},ts=function(e){return{type:"bc",value:[e,{type:"c",value:[{type:"integer",value:151,indices:[fs-2,fs-1]}],indices:[fs-2,fs-1]}],indices:[vs,fs-1]}},as=function(e,s){return{type:"bcv",value:[e,{type:"v",value:[s],indices:[s.indices[0],s.indices[1]]}],indices:[vs,fs-1]}},rs=function(e){return{type:"v",value:[e],indices:[vs,fs-1]}},ns=function(e){return{type:"v",value:[e],indices:[vs,fs-1]}},is=function(){return{type:"c_explicit"}},os=function(){return{type:"v_explicit"}},ls=function(){return""},us=function(e){return{type:"title",value:[e],indices:[vs,fs-1]}},cs=function(e){return{type:"translation_sequence",value:e,indices:[vs,fs-1]}},ps=function(e){return{type:"translation_sequence",value:e,indices:[vs,fs-1]}},gs=function(e){return{type:"translation",value:e.value,indices:[vs,fs-1]}},_s=function(e){return{type:"integer",value:parseInt(e.join(""),10),indices:[vs,fs-1]}},hs=function(e){return{type:"word",value:e.join(""),indices:[vs,fs-1]}},xs=function(e){return{type:"stop",value:e,indices:[vs,fs-1]}},fs=0|t.peg$currPos,vs=fs,ds=[{line:1,column:1}],bs=fs,ys=t.peg$maxFailExpected||[],ms=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in i))throw new Error("Can't start parsing from rule \""+t.startRule+'".');o=i[t.startRule]}function ks(e,s){return{type:"literal",text:e,ignoreCase:s}}function $s(e,s,t){return{type:"class",parts:e,inverted:s,ignoreCase:t}}function As(e){var t,a=ds[e];if(a)return a;if(e>=ds.length)t=ds.length-1;else for(t=e;!ds[--t];);for(a={line:(a=ds[t]).line,column:a.column};t<e;)10===s.charCodeAt(t)?(a.line++,a.column=1):a.column++,t++;return ds[e]=a,a}function Es(e,s,t){var a=As(e),r=As(s),i={source:n,start:{offset:e,line:a.line,column:a.column},end:{offset:s,line:r.line,column:r.column}};return t&&n&&"function"==typeof n.offset&&(i.start=n.offset(i.start),i.end=n.offset(i.end)),i}function Ss(e){fs<bs||(fs>bs&&(bs=fs,ys=[]),ys.push(e))}function js(s,t,a){return new e(e.buildMessage(s,t),s,t,a)}function ws(){var e,s;if(e=[],(s=Ns())===r&&(s=Ps())===r&&(s=qs())===r&&(s=Is())===r&&(s=Vs())===r&&(s=Ts())===r&&(s=Cs())===r&&(s=st())===r&&(s=Ms())===r&&(s=Ks())===r&&(s=et())===r&&(s=Js())===r&&(s=Gs())===r&&(s=Zs())===r&&(s=Hs())===r&&(s=zs())===r&&(s=Ls())===r&&(s=Fs())===r&&(s=Os())===r&&(s=Ds())===r&&(s=gt())===r&&(s=_t())===r&&(s=lt())===r&&(s=Bs())===r&&(s=Xs())===r&&(s=Ws())===r&&(s=Us())===r&&(s=tt())===r&&(s=xt())===r&&(s=Qs())===r&&(s=at())===r&&(s=vt())===r&&(s=dt())===r&&(s=Ys()),s!==r)for(;s!==r;)e.push(s),(s=Ns())===r&&(s=Ps())===r&&(s=qs())===r&&(s=Is())===r&&(s=Vs())===r&&(s=Ts())===r&&(s=Cs())===r&&(s=st())===r&&(s=Ms())===r&&(s=Ks())===r&&(s=et())===r&&(s=Js())===r&&(s=Gs())===r&&(s=Zs())===r&&(s=Hs())===r&&(s=zs())===r&&(s=Ls())===r&&(s=Fs())===r&&(s=Os())===r&&(s=Ds())===r&&(s=gt())===r&&(s=_t())===r&&(s=lt())===r&&(s=Bs())===r&&(s=Xs())===r&&(s=Ws())===r&&(s=Us())===r&&(s=tt())===r&&(s=xt())===r&&(s=Qs())===r&&(s=at())===r&&(s=vt())===r&&(s=dt())===r&&(s=Ys());else e=r;return e}function Ps(){var e,s,t,a,n,i;if(e=fs,(s=qs())===r&&(s=Ns())===r&&(s=Is())===r&&(s=Vs())===r&&(s=Ts())===r&&(s=Cs())===r&&(s=st())===r&&(s=Ms())===r&&(s=Ks())===r&&(s=et())===r&&(s=Js())===r&&(s=Gs())===r&&(s=Zs())===r&&(s=Hs())===r&&(s=zs())===r&&(s=Ls())===r&&(s=Fs())===r&&(s=Os())===r&&(s=Ds())===r&&(s=Ys()),s!==r){if(t=[],a=fs,(n=lt())===r&&(n=null),(i=Rs())!==r?a=n=[n,i]:(fs=a,a=r),a!==r)for(;a!==r;)t.push(a),a=fs,(n=lt())===r&&(n=null),(i=Rs())!==r?a=n=[n,i]:(fs=a,a=r);else t=r;t!==r?(vs=e,e=Pe(s,t)):(fs=e,e=r)}else fs=e,e=r;return e}function Rs(){var e;return(e=function(){var e,t,a,n,i,o,c;if(e=fs,40===s.charCodeAt(fs)?(t=l,fs++):(t=r,0===ms&&Ss(H)),t!==r)if(bt(),lt(),(a=Rs())!==r){for(n=[],i=fs,(o=lt())===r&&(o=null),(c=Rs())!==r?i=o=[o,c]:(fs=i,i=r);i!==r;)n.push(i),i=fs,(o=lt())===r&&(o=null),(c=Rs())!==r?i=o=[o,c]:(fs=i,i=r);i=bt(),41===s.charCodeAt(fs)?(o=u,fs++):(o=r,0===ms&&Ss(G)),o!==r?(vs=e,e=Re(a,n)):(fs=e,e=r)}else fs=e,e=r;else fs=e,e=r;return e}())===r&&(e=qs())===r&&(e=Ns())===r&&(e=Is())===r&&(e=Vs())===r&&(e=Ts())===r&&(e=Cs())===r&&(e=st())===r&&(e=Ms())===r&&(e=Ks())===r&&(e=et())===r&&(e=Js())===r&&(e=Gs())===r&&(e=Zs())===r&&(e=Hs())===r&&(e=zs())===r&&(e=Ls())===r&&(e=Fs())===r&&(e=Os())===r&&(e=Ds())===r&&(e=Bs())===r&&(e=Xs())===r&&(e=Ws())===r&&(e=Us())===r&&(e=tt())===r&&(e=xt())===r&&(e=Qs())===r&&(e=at()),e}function Is(){var e,s,t,a,n,i,o;return e=fs,(s=Ts())===r&&(s=Cs())===r&&(s=st())===r&&(s=Ms())===r&&(s=Ks())===r&&(s=et())===r&&(s=Js())===r&&(s=Gs())===r&&(s=Zs())===r&&(s=fs,(t=zs())!==r?(a=fs,ms++,n=fs,(i=ut())!==r?((o=Ts())===r&&(o=Cs())===r&&(o=st())===r&&(o=Ms())===r&&(o=Ks())===r&&(o=et())===r&&(o=Js())===r&&(o=Zs())===r&&(o=zs()),o!==r?n=i=[i,o]:(fs=n,n=r)):(fs=n,n=r),ms--,n!==r?(fs=a,a=void 0):a=r,a!==r?s=t=[t,a]:(fs=s,s=r)):(fs=s,s=r),s===r&&(s=Ls())===r&&(s=Fs())===r&&(s=Hs())===r&&(s=Os())===r&&(s=Ds())===r&&(s=Bs())===r&&(s=Xs())===r&&(s=Ws())===r&&(s=Us())===r&&(s=tt())===r&&(s=xt())===r&&(s=Qs())===r&&(s=at())),s!==r&&(t=ut())!==r?((a=Vs())===r&&(a=Ts())===r&&(a=Cs())===r&&(a=st())===r&&(a=Ms())===r&&(a=Ks())===r&&(a=et())===r&&(a=Js())===r&&(a=Gs())===r&&(a=Zs())===r&&(a=zs())===r&&(a=Ls())===r&&(a=Fs())===r&&(a=Hs())===r&&(a=Os())===r&&(a=Ds())===r&&(a=Bs())===r&&(a=Xs())===r&&(a=Ws())===r&&(a=tt())===r&&(a=xt())===r&&(a=Us())===r&&(a=Qs())===r&&(a=at()),a!==r?(vs=e,e=Ie(s,a)):(fs=e,e=r)):(fs=e,e=r),e}function zs(){var e,t,a,n,i,o;return e=fs,31===s.charCodeAt(fs)?(t=c,fs++):(t=r,0===ms&&Ss(B)),t!==r&&(a=ft())!==r?(n=fs,47===s.charCodeAt(fs)?(i=p,fs++):(i=r,0===ms&&Ss(W)),i!==r?(o=s.charAt(fs),M.test(o)?fs++:(o=r,0===ms&&Ss(U)),o!==r?n=i=[i,o]:(fs=n,n=r)):(fs=n,n=r),n===r&&(n=null),31===s.charCodeAt(fs)?(i=c,fs++):(i=r,0===ms&&Ss(B)),i!==r?(vs=e,e=ze(a)):(fs=e,e=r)):(fs=e,e=r),e}function Js(){var e,s,t,a,n,i,o,l,u;if(e=fs,(s=zs())!==r){if(t=fs,(a=nt())!==r?(n=fs,ms++,i=fs,(o=Qs())!==r&&(l=it())!==r&&(u=at())!==r?i=o=[o,l,u]:(fs=i,i=r),ms--,i!==r?(fs=n,n=void 0):n=r,n!==r?t=a=[a,n]:(fs=t,t=r)):(fs=t,t=r),t===r){if(t=[],(a=it())!==r)for(;a!==r;)t.push(a),a=it();else t=r;if(t===r){if(t=[],(a=ot())!==r)for(;a!==r;)t.push(a),a=ot();else t=r;if(t===r){if(t=[],(a=ut())!==r)for(;a!==r;)t.push(a),a=ut();else t=r;t===r&&(t=bt())}}}t!==r&&(a=Qs())!==r?(vs=e,e=Je(s,a)):(fs=e,e=r)}else fs=e,e=r;return e}function Cs(){var e,s,t;return e=fs,(s=et())===r&&(s=Js()),s!==r&&(t=ct())!==r?(vs=e,e=Me(s,t)):(fs=e,e=r),e}function Ms(){var e,t,a,n,i,o,l;return e=fs,(t=et())===r&&(t=Js()),t!==r?(a=fs,ms++,n=fs,46===s.charCodeAt(fs)?(i=_,fs++):(i=r,0===ms&&Ss(V)),i!==r&&(o=nt())!==r&&(l=at())!==r?n=i=[i,o,l]:(fs=n,n=r),n===r&&(n=fs,(i=lt())===r&&(i=null),(o=nt())!==r&&(l=Ws())!==r?n=i=[i,o,l]:(fs=n,n=r)),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(n=fs,(i=it())===r&&(i=lt()),i===r&&(i=null),(o=nt())!==r?n=i=[i,o]:(fs=n,n=r),n===r&&(n=it()),n!==r?((i=tt())===r&&(i=at()),i!==r?(vs=e,e=Ke(t,i)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Ks(){var e,s,t,a,n,i,o;return e=fs,(s=et())===r&&(s=Js()),s!==r&&ot()!==r?((t=tt())===r&&(t=at()),t!==r?(a=fs,ms++,n=fs,(i=it())!==r&&(o=at())!==r?n=i=[i,o]:(fs=n,n=r),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(vs=e,e=Te(s,t)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Ts(){var e,t,a,n,i,o,l,u;return e=fs,t=function(){var e,t,a,n;return e=fs,(t=zs())!==r?(bt(),44===s.charCodeAt(fs)?(a=g,fs++):(a=r,0===ms&&Ss(Q)),a!==r?(bt(),(n=Qs())!==r?(vs=e,e=Ce(t,n)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}(),t!==r?(bt(),44===s.charCodeAt(fs)?(a=g,fs++):(a=r,0===ms&&Ss(Q)),a!==r?(bt(),(n=tt())===r&&(n=at()),n!==r?(i=fs,ms++,o=fs,(l=it())!==r&&(u=at())!==r?o=l=[l,u]:(fs=o,o=r),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?(vs=e,e=Ne(t,n)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Ns(){var e,t,a,n,i,o,l,u;return e=fs,(t=zs())!==r?(45===s.charCodeAt(fs)?(a=h,fs++):(a=r,0===ms&&Ss(X)),a===r&&(a=yt()),a===r&&(a=null),(n=Qs())!==r?(45===s.charCodeAt(fs)?(i=h,fs++):(i=r,0===ms&&Ss(X)),i!==r&&(o=at())!==r?(45===s.charCodeAt(fs)?(l=h,fs++):(l=r,0===ms&&Ss(X)),l!==r&&(u=at())!==r?(vs=e,e=Ze(t,n,o,u)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Zs(){var e,s,t,a,n,i;if(e=fs,(s=zs())!==r){if(t=[],(a=it())!==r)for(;a!==r;)t.push(a),a=it();else t=r;if(t===r){if(t=[],(a=ot())!==r)for(;a!==r;)t.push(a),a=ot();else t=r;if(t===r){if(t=[],(a=ut())!==r)for(;a!==r;)t.push(a),a=ut();else t=r;if(t===r){if(t=fs,a=[],(n=lt())!==r)for(;n!==r;)a.push(n),n=lt();else a=r;a!==r?(n=fs,ms++,i=nt(),ms--,i!==r?(fs=n,n=void 0):n=r,n!==r?t=a=[a,n]:(fs=t,t=r)):(fs=t,t=r),t===r&&(t=bt())}}}t!==r?((a=tt())===r&&(a=at()),a!==r?(vs=e,e=Oe(s,a)):(fs=e,e=r)):(fs=e,e=r)}else fs=e,e=r;return e}function Os(){var e,s,t;return e=fs,rt()!==r&&(s=Qs())!==r?(pt()===r&&null,(t=zs())!==r?(vs=e,e=qe(s,t)):(fs=e,e=r)):(fs=e,e=r),e}function qs(){var e,s,t,a;return e=fs,rt()!==r&&(s=Qs())!==r&&ut()!==r&&(t=Qs())!==r?(pt()===r&&null,(a=zs())!==r?(vs=e,e=Le(s,t,a)):(fs=e,e=r)):(fs=e,e=r),e}function Ls(){var e,s,t;return e=fs,(s=Os())!==r?(lt()===r&&null,nt()!==r&&(t=at())!==r?(vs=e,e=De(s,t)):(fs=e,e=r)):(fs=e,e=r),e}function Ds(){var e,t,a,n;return e=fs,(t=Qs())!==r?(s.substr(fs,2)===x?(a=x,fs+=2):(a=r,0===ms&&Ss(Y)),a===r&&(s.substr(fs,2)===f?(a=f,fs+=2):(a=r,0===ms&&Ss(ee)),a===r&&(s.substr(fs,2)===v?(a=v,fs+=2):(a=r,0===ms&&Ss(se)))),a!==r&&rt()!==r?(pt()===r&&null,(n=zs())!==r?(vs=e,e=Fe(t,n)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Fs(){var e,s,t;return e=fs,(s=Ds())!==r?(lt()===r&&null,nt()!==r&&(t=at())!==r?(vs=e,e=He(s,t)):(fs=e,e=r)):(fs=e,e=r),e}function Hs(){var e,t,a,n;return e=fs,31===s.charCodeAt(fs)?(t=c,fs++):(t=r,0===ms&&Ss(B)),t!==r&&(a=ft())!==r?(s.substr(fs,3)===d?(n=d,fs+=3):(n=r,0===ms&&Ss(te)),n!==r?(vs=e,e=Ge(a)):(fs=e,e=r)):(fs=e,e=r),e}function Gs(){var e,s,t;return e=fs,(s=Hs())!==r?(lt()===r&&null,nt()!==r&&(t=at())!==r?(vs=e,e=Be(s,t)):(fs=e,e=r)):(fs=e,e=r),e}function Bs(){var e,s,t;return e=fs,rt()!==r&&(s=Qs())!==r&&(t=ct())!==r?(vs=e,e=We(s,t)):(fs=e,e=r),e}function Ws(){var e,t,a,n,i,o,l;return e=fs,nt()===r&&null,(t=Qs())!==r?(a=fs,ms++,n=fs,46===s.charCodeAt(fs)?(i=_,fs++):(i=r,0===ms&&Ss(V)),i!==r&&(o=nt())!==r&&(l=at())!==r?n=i=[i,o,l]:(fs=n,n=r),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(n=fs,(i=it())===r&&(i=null),(o=nt())!==r?n=i=[i,o]:(fs=n,n=r),n===r&&(n=it()),n!==r?((i=tt())===r&&(i=at()),i!==r?(vs=e,e=Ue(t,i)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Us(){var e,s,t,a,n,i,o;return e=fs,(s=Qs())!==r&&ot()!==r?((t=tt())===r&&(t=at()),t!==r?(a=fs,ms++,n=fs,(i=it())!==r&&(o=at())!==r?n=i=[i,o]:(fs=n,n=r),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(vs=e,e=Qe(s,t)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Qs(){var e,s;return e=fs,rt()===r&&null,(s=xt())!==r?(vs=e,e=Ve(s)):(fs=e,e=r),e}function Vs(){var e,t,a,n,i,o;return e=fs,(t=Ms())===r&&(t=Ks())===r&&(t=Js())===r&&(t=Zs())===r&&(t=Ws())===r&&(t=Us())===r&&(t=xt())===r&&(t=Qs())===r&&(t=at()),t!==r?(bt(),s.substr(fs,2)===b?(a=b,fs+=2):(a=r,0===ms&&Ss(ae)),a!==r?(n=function(){var e,t,a,n,i,o,l,u,c;e=fs,t=bt(),46===s.charCodeAt(fs)?(a=_,fs++):(a=r,0===ms&&Ss(V));a!==r?(n=fs,ms++,i=fs,o=bt(),46===s.charCodeAt(fs)?(l=_,fs++):(l=r,0===ms&&Ss(V)),l!==r?(u=bt(),46===s.charCodeAt(fs)?(c=_,fs++):(c=r,0===ms&&Ss(V)),c!==r?i=o=[o,l,u,c]:(fs=i,i=r)):(fs=i,i=r),ms--,i===r?n=void 0:(fs=n,n=r),n!==r?e=t=[t,a,n]:(fs=e,e=r)):(fs=e,e=r);return e}(),n===r&&(n=null),i=fs,ms++,o=s.charAt(fs),K.test(o)?fs++:(o=r,0===ms&&Ss(re)),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?(vs=e,e=Xe(t)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Xs(){var e,s,t;return e=fs,(s=xt())!==r&&(t=ct())!==r?(vs=e,e=Ye(s,t)):(fs=e,e=r),e}function Ys(){var e,t,a,n;return e=fs,31===s.charCodeAt(fs)?(t=c,fs++):(t=r,0===ms&&Ss(B)),t!==r&&(a=ft())!==r?(s.substr(fs,3)===y?(n=y,fs+=3):(n=r,0===ms&&Ss(ne)),n!==r?(vs=e,e=es(a)):(fs=e,e=r)):(fs=e,e=r),e}function et(){var e,t,a,n,i;return e=fs,t=function(){var e,t,a,n;return e=fs,31===s.charCodeAt(fs)?(t=c,fs++):(t=r,0===ms&&Ss(B)),t!==r&&(a=ft())!==r?(s.substr(fs,3)===m?(n=m,fs+=3):(n=r,0===ms&&Ss(ie)),n!==r?(vs=e,e=ss(a)):(fs=e,e=r)):(fs=e,e=r),e}(),t!==r?(s.substr(fs,2)===k?(a=k,fs+=2):(a=r,0===ms&&Ss(oe)),a!==r?(n=fs,ms++,i=s.charAt(fs),T.test(i)?fs++:(i=r,0===ms&&Ss(le)),ms--,i===r?n=void 0:(fs=n,n=r),n!==r?(vs=e,e=ts(t)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function st(){var e,t,a,n;return e=fs,(t=et())!==r?(46===s.charCodeAt(fs)?(a=_,fs++):(a=r,0===ms&&Ss(V)),a!==r&&(n=xt())!==r?(vs=e,e=as(t,n)):(fs=e,e=r)):(fs=e,e=r),e}function tt(){var e,t,a,n,i,o;return e=fs,nt()===r&&null,(t=xt())!==r?(bt(),a=fs,ms++,s.substr(fs,2)===b?(n=b,fs+=2):(n=r,0===ms&&Ss(ae)),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(n=s.charAt(fs),N.test(n)?fs++:(n=r,0===ms&&Ss(ue)),n!==r?(i=fs,ms++,o=s.charAt(fs),K.test(o)?fs++:(o=r,0===ms&&Ss(re)),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?(vs=e,e=rs(t)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function at(){var e,s;return e=fs,nt()===r&&null,(s=xt())!==r?(vs=e,e=ns(s)):(fs=e,e=r),e}function rt(){var e,t;return e=fs,bt(),s.substr(fs,9)===$?(t=$,fs+=9):(t=r,0===ms&&Ss(ce)),t===r&&(s.substr(fs,9)===A?(t=A,fs+=9):(t=r,0===ms&&Ss(pe)),t===r&&(s.substr(fs,5)===E?(t=E,fs+=5):(t=r,0===ms&&Ss(ge)))),t!==r?(bt(),vs=e,e=is()):(fs=e,e=r),e}function nt(){var e,t,a,n;return e=fs,bt(),s.substr(fs,5)===S?(t=S,fs+=5):(t=r,0===ms&&Ss(_e)),t!==r?(a=fs,ms++,n=s.charAt(fs),K.test(n)?fs++:(n=r,0===ms&&Ss(re)),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(n=bt(),vs=e,e=os()):(fs=e,e=r)):(fs=e,e=r),e}function it(){var e,t,a,n,i,o,l,u,c,p;if(e=fs,t=bt(),a=[],58===s.charCodeAt(fs)?(n=":",fs++):(n=r,0===ms&&Ss(he)),n!==r)for(;n!==r;)a.push(n),58===s.charCodeAt(fs)?(n=":",fs++):(n=r,0===ms&&Ss(he));else a=r;return a===r&&(a=fs,46===s.charCodeAt(fs)?(n=_,fs++):(n=r,0===ms&&Ss(V)),n!==r?(i=fs,ms++,o=fs,l=bt(),46===s.charCodeAt(fs)?(u=_,fs++):(u=r,0===ms&&Ss(V)),u!==r?(c=bt(),46===s.charCodeAt(fs)?(p=_,fs++):(p=r,0===ms&&Ss(V)),p!==r?o=l=[l,u,c,p]:(fs=o,o=r)):(fs=o,o=r),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?a=n=[n,i]:(fs=a,a=r)):(fs=a,a=r)),a!==r?e=t=[t,a,n=bt()]:(fs=e,e=r),e}function ot(){var e,t,a;return e=fs,t=bt(),a=s.charAt(fs),Z.test(a)?fs++:(a=r,0===ms&&Ss(xe)),a!==r?e=t=[t,a,bt()]:(fs=e,e=r),e===r&&(e=yt()),e}function lt(){var e,t,a,n,i,o,l,u,c,p;if(e=fs,t=[],a=s.charAt(fs),O.test(a)?fs++:(a=r,0===ms&&Ss(fe)),a===r&&(a=fs,46===s.charCodeAt(fs)?(n=_,fs++):(n=r,0===ms&&Ss(V)),n!==r?(i=fs,ms++,o=fs,l=bt(),46===s.charCodeAt(fs)?(u=_,fs++):(u=r,0===ms&&Ss(V)),u!==r?(c=bt(),46===s.charCodeAt(fs)?(p=_,fs++):(p=r,0===ms&&Ss(V)),p!==r?o=l=[l,u,c,p]:(fs=o,o=r)):(fs=o,o=r),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?a=n=[n,i]:(fs=a,a=r)):(fs=a,a=r),a===r&&(105===s.charCodeAt(fs)?(a=j,fs++):(a=r,0===ms&&Ss(ve)),a===r&&(a=yt()))),a!==r)for(;a!==r;)t.push(a),a=s.charAt(fs),O.test(a)?fs++:(a=r,0===ms&&Ss(fe)),a===r&&(a=fs,46===s.charCodeAt(fs)?(n=_,fs++):(n=r,0===ms&&Ss(V)),n!==r?(i=fs,ms++,o=fs,l=bt(),46===s.charCodeAt(fs)?(u=_,fs++):(u=r,0===ms&&Ss(V)),u!==r?(c=bt(),46===s.charCodeAt(fs)?(p=_,fs++):(p=r,0===ms&&Ss(V)),p!==r?o=l=[l,u,c,p]:(fs=o,o=r)):(fs=o,o=r),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?a=n=[n,i]:(fs=a,a=r)):(fs=a,a=r),a===r&&(105===s.charCodeAt(fs)?(a=j,fs++):(a=r,0===ms&&Ss(ve)),a===r&&(a=yt())));else t=r;return t!==r&&(vs=e,t=ls()),e=t}function ut(){var e,t,a,n,i;if(e=fs,t=bt(),a=[],n=fs,i=s.charAt(fs),q.test(i)?fs++:(i=r,0===ms&&Ss(de)),i!==r?n=i=[i,bt()]:(fs=n,n=r),n===r&&(n=fs,45===s.charCodeAt(fs)?(i=h,fs++):(i=r,0===ms&&Ss(X)),i!==r?n=i=[i,bt()]:(fs=n,n=r)),n!==r)for(;n!==r;)a.push(n),n=fs,i=s.charAt(fs),q.test(i)?fs++:(i=r,0===ms&&Ss(de)),i!==r?n=i=[i,bt()]:(fs=n,n=r),n===r&&(n=fs,45===s.charCodeAt(fs)?(i=h,fs++):(i=r,0===ms&&Ss(X)),i!==r?n=i=[i,bt()]:(fs=n,n=r));else a=r;return a!==r?e=t=[t,a]:(fs=e,e=r),e}function ct(){var e,t,a;return e=fs,(t=it())===r&&(t=lt()),t===r&&(t=null),s.substr(fs,5)===w?(a=w,fs+=5):(a=r,0===ms&&Ss(be)),a!==r?(vs=e,e=us(a)):(fs=e,e=r),e}function pt(){var e,t,a,n,i,o,l,u,c,p;return e=fs,t=bt(),s.substr(fs,4)===P?(a=P,fs+=4):(a=r,0===ms&&Ss(ye)),a===r&&(s.substr(fs,2)===R?(a=R,fs+=2):(a=r,0===ms&&Ss(me)),a===r&&(s.substr(fs,2)===I?(a=I,fs+=2):(a=r,0===ms&&Ss(ke)))),a!==r?(n=bt(),i=fs,s.substr(fs,3)===z?(o=z,fs+=3):(o=r,0===ms&&Ss($e)),o!==r?(l=bt(),s.substr(fs,4)===J?(u=J,fs+=4):(u=r,0===ms&&Ss(Ae)),u!==r?(c=bt(),s.substr(fs,2)===R?(p=R,fs+=2):(p=r,0===ms&&Ss(me)),p!==r?i=o=[o,l,u,c,p,bt()]:(fs=i,i=r)):(fs=i,i=r)):(fs=i,i=r),i===r&&(i=null),e=t=[t,a,n,i]):(fs=e,e=r),e}function gt(){var e,t,a,n,i,o,l,u;if(e=fs,bt(),t=s.charAt(fs),L.test(t)?fs++:(t=r,0===ms&&Ss(Ee)),t!==r){if(bt(),a=fs,(n=ht())!==r){for(i=[],o=fs,(l=lt())!==r&&(u=ht())!==r?o=l=[l,u]:(fs=o,o=r);o!==r;)i.push(o),o=fs,(l=lt())!==r&&(u=ht())!==r?o=l=[l,u]:(fs=o,o=r);a=n=[n,i]}else fs=a,a=r;a!==r?(n=bt(),i=s.charAt(fs),D.test(i)?fs++:(i=r,0===ms&&Ss(Se)),i!==r?(vs=e,e=cs(a)):(fs=e,e=r)):(fs=e,e=r)}else fs=e,e=r;return e}function _t(){var e,t,a,n,i,o,l,u;if(e=fs,bt(),t=fs,44===s.charCodeAt(fs)?(a=g,fs++):(a=r,0===ms&&Ss(Q)),a!==r?t=a=[a,n=bt()]:(fs=t,t=r),t===r&&(t=null),a=fs,(n=ht())!==r){for(i=[],o=fs,(l=lt())!==r&&(u=ht())!==r?o=l=[l,u]:(fs=o,o=r);o!==r;)i.push(o),o=fs,(l=lt())!==r&&(u=ht())!==r?o=l=[l,u]:(fs=o,o=r);a=n=[n,i]}else fs=a,a=r;return a!==r?(vs=e,e=ps(a)):(fs=e,e=r),e}function ht(){var e,t,a,n;return e=fs,30===s.charCodeAt(fs)?(t=C,fs++):(t=r,0===ms&&Ss(je)),t!==r&&(a=ft())!==r?(30===s.charCodeAt(fs)?(n=C,fs++):(n=r,0===ms&&Ss(je)),n!==r?(vs=e,e=gs(a)):(fs=e,e=r)):(fs=e,e=r),e}function xt(){var e;return(e=/^[0-9]{1,3}(?!\d|,000)/.exec(s.substr(fs)))?(vs=fs,fs+=e[0].length,{type:"integer",value:parseInt(e[0],10),indices:[vs,fs-1]}):r}function ft(){var e,t,a;if(e=fs,t=[],a=s.charAt(fs),T.test(a)?fs++:(a=r,0===ms&&Ss(le)),a!==r)for(;a!==r;)t.push(a),a=s.charAt(fs),T.test(a)?fs++:(a=r,0===ms&&Ss(le));else t=r;return t!==r&&(vs=e,t=_s(t)),e=t}function vt(){var e,t,a;if(e=fs,t=[],a=s.charAt(fs),F.test(a)?fs++:(a=r,0===ms&&Ss(we)),a!==r)for(;a!==r;)t.push(a),a=s.charAt(fs),F.test(a)?fs++:(a=r,0===ms&&Ss(we));else t=r;return t!==r&&(vs=e,t=hs(t)),e=t}function dt(){var e,t;return e=fs,t=s.charAt(fs),L.test(t)?fs++:(t=r,0===ms&&Ss(Ee)),t!==r&&(vs=e,t=xs(t)),e=t}function bt(){var e;return(e=yt())===r&&(e=null),e}function yt(){var e;return(e=/^[\s\xa0*]+/.exec(s.substr(fs)))?(fs+=e[0].length,[]):r}if("punctuation_strategy"in t&&"eu"===t.punctuation_strategy&&(it=function(){var e,t,a;e=fs,t=bt(),44===s.charCodeAt(fs)?(a=g,fs++):(a=r,0===ms&&Ss(Q));a!==r?e=t=[t,a,bt()]:(fs=e,e=r);return e},O=/^[;\/:&\-\u2013\u2014~]/),a=o(),t.peg$library)return{peg$result:a,peg$currPos:fs,peg$FAILED:r,peg$maxFailExpected:ys,peg$maxFailPos:bs};if(a!==r&&fs===s.length)return a;throw a!==r&&fs<s.length&&Ss({type:"end"}),js(ys,bs<s.length?s.charAt(bs):null,bs<s.length?Es(bs,bs+1):Es(bs,bs))}}}();
|
|
200
|
+
)(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]/"'\*=~\-\u2013\u2014])|$)`),"gi")}];if(!0===e&&"none"===s)return t;const a=[];for(const r of t)!1===e&&null!=r.apocrypha&&!0===r.apocrypha||("books"===s&&(r.regexp=new RegExp(r.regexp.source,"g")),a.push(r));return a},bcv_parser.prototype.regexps.books=bcv_parser.prototype.regexps.get_books(!1,"none"),function(){"use strict";function e(s,t,a,r){var n=Error.call(this,s);return Object.setPrototypeOf&&Object.setPrototypeOf(n,e.prototype),n.expected=t,n.found=a,n.location=r,n.name="SyntaxError",n}function s(e,s,t){return t=t||" ",e.length>s?e:(s-=e.length,e+(t+=t.repeat(s)).slice(0,s))}!function(e,s){function t(){this.constructor=e}t.prototype=s.prototype,e.prototype=new t}(e,Error),e.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var a,r=null;for(a=0;a<e.length;a++)if(e[a].source===this.location.source){r=e[a].text.split(/\r\n|\n|\r/g);break}var n=this.location.start,i=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(n):n,o=this.location.source+":"+i.line+":"+i.column;if(r){var l=this.location.end,u=s("",i.line.toString().length," "),c=r[n.line-1],p=(n.line===l.line?l.column:c.length+1)-n.column||1;t+="\n --\x3e "+o+"\n"+u+" |\n"+i.line+" | "+c+"\n"+u+" | "+s("",n.column-1," ")+s("",p,"^")}else t+="\n at "+o}return t},e.buildMessage=function(e,s){var t={literal:function(e){return'"'+r(e.text)+'"'},class:function(e){var s=e.parts.map((function(e){return Array.isArray(e)?n(e[0])+"-"+n(e[1]):n(e)}));return"["+(e.inverted?"^":"")+s.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function a(e){return e.charCodeAt(0).toString(16).toUpperCase()}function r(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+a(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+a(e)}))}function n(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+a(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+a(e)}))}function i(e){return t[e.type](e)}return"Expected "+function(e){var s,t,a=e.map(i);if(a.sort(),a.length>0){for(s=1,t=1;s<a.length;s++)a[s-1]!==a[s]&&(a[t]=a[s],t++);a.length=t}switch(a.length){case 1:return a[0];case 2:return a[0]+" or "+a[1];default:return a.slice(0,-1).join(", ")+", or "+a[a.length-1]}}(e)+" but "+function(e){return e?'"'+r(e)+'"':"end of input"}(s)+" found."},grammar={StartRules:["start"],SyntaxError:e,parse:function(s,t){var a,r={},n=(t=void 0!==t?t:{}).grammarSource,i={start:ws},o=ws,l="(",u=")",c="",p="/",g=",",_=".",h="-",x="th",f="nd",v="st",d="/1",b="ff",y="/9",m="/2",k=".1",A="poglavlja",$="poglavlje",E="glava",S="verse",j="i",w="title",P="from",R="of",I="in",z="the",J="book",C="",M=/^[1-8]/,K=/^[a-z]/,T=/^[0-9]/,N=/^[a-e]/,Z=/^["']/,q=/^[,;\/:&\-\u2013\u2014~]/,O=/^[\-\u2013\u2014]/,L=/^[([]/,D=/^[)\]]/,F=/^[^\x1F\x1E([]/,H=ks("(",!1),G=ks(")",!1),B=ks("",!1),W=ks("/",!1),U=As([["1","8"]],!1,!1),Q=ks(",",!1),V=ks(".",!1),X=ks("-",!1),Y=ks("th",!1),ee=ks("nd",!1),se=ks("st",!1),te=ks("/1",!1),ae=ks("ff",!1),re=As([["a","z"]],!1,!1),ne=ks("/9",!1),ie=ks("/2",!1),oe=ks(".1",!1),le=As([["0","9"]],!1,!1),ue=As([["a","e"]],!1,!1),ce=ks("poglavlja",!1),pe=ks("poglavlje",!1),ge=ks("glava",!1),_e=ks("verse",!1),he=ks(":",!1),xe=As(['"',"'"],!1,!1),fe=As([",",";","/",":","&","-","–","—","~"],!1,!1),ve=ks("i",!1),de=As(["-","–","—"],!1,!1),be=ks("title",!1),ye=ks("from",!1),me=ks("of",!1),ke=ks("in",!1),Ae=ks("the",!1),$e=ks("book",!1),Ee=As(["(","["],!1,!1),Se=As([")","]"],!1,!1),je=ks("",!1),we=(ks(",000",!1),As(["","","(","["],!0,!1)),Pe=(As([" ","\t","\r","\n"," ","*"],!1,!1),function(e,s){return s.unshift([e]),{type:"sequence",value:s,indices:[vs,fs-1]}}),Re=function(e,s){return void 0===s&&(s=[]),s.unshift([e]),{type:"sequence_post_enclosed",value:s,indices:[vs,fs-1]}},Ie=function(e,s){return e.length&&2===e.length&&(e=e[0]),{type:"range",value:[e,s],indices:[vs,fs-1]}},ze=function(e){return{type:"b",value:e.value,indices:[vs,fs-1]}},Je=function(e,s){return{type:"bc",value:[e,s],indices:[vs,fs-1]}},Ce=function(e,s){return{type:"bc",value:[e,s],indices:[vs,fs-1]}},Me=function(e,s){return{type:"bc_title",value:[e,s],indices:[vs,fs-1]}},Ke=function(e,s){return{type:"bcv",value:[e,s],indices:[vs,fs-1]}},Te=function(e,s){return{type:"bcv",value:[e,s],indices:[vs,fs-1]}},Ne=function(e,s){return{type:"bcv",value:[e,s],indices:[vs,fs-1]}},Ze=function(e,s,t,a){return{type:"range",value:[{type:"bcv",value:[{type:"bc",value:[e,s],indices:[e.indices[0],s.indices[1]]},t],indices:[e.indices[0],t.indices[1]]},a],indices:[vs,fs-1]}},qe=function(e,s){return{type:"bv",value:[e,s],indices:[vs,fs-1]}},Oe=function(e,s){return{type:"bc",value:[s,e],indices:[vs,fs-1]}},Le=function(e,s,t){return{type:"cb_range",value:[t,e,s],indices:[vs,fs-1]}},De=function(e,s){return{type:"bcv",value:[e,s],indices:[vs,fs-1]}},Fe=function(e,s){return{type:"bc",value:[s,e],indices:[vs,fs-1]}},He=function(e,s){return{type:"bcv",value:[e,s],indices:[vs,fs-1]}},Ge=function(e){return{type:"c_psalm",value:e.value,indices:[vs,fs-1]}},Be=function(e,s){return{type:"cv_psalm",value:[e,s],indices:[vs,fs-1]}},We=function(e,s){return{type:"c_title",value:[e,s],indices:[vs,fs-1]}},Ue=function(e,s){return{type:"cv",value:[e,s],indices:[vs,fs-1]}},Qe=function(e,s){return{type:"cv",value:[e,s],indices:[vs,fs-1]}},Ve=function(e){return{type:"c",value:[e],indices:[vs,fs-1]}},Xe=function(e){return{type:"ff",value:[e],indices:[vs,fs-1]}},Ye=function(e,s){return{type:"integer_title",value:[e,s],indices:[vs,fs-1]}},es=function(e){return{type:"context",value:e.value,indices:[vs,fs-1]}},ss=function(e){return{type:"b",value:e.value,indices:[vs,fs-1]}},ts=function(e){return{type:"bc",value:[e,{type:"c",value:[{type:"integer",value:151,indices:[fs-2,fs-1]}],indices:[fs-2,fs-1]}],indices:[vs,fs-1]}},as=function(e,s){return{type:"bcv",value:[e,{type:"v",value:[s],indices:[s.indices[0],s.indices[1]]}],indices:[vs,fs-1]}},rs=function(e){return{type:"v",value:[e],indices:[vs,fs-1]}},ns=function(e){return{type:"v",value:[e],indices:[vs,fs-1]}},is=function(){return{type:"c_explicit"}},os=function(){return{type:"v_explicit"}},ls=function(){return""},us=function(e){return{type:"title",value:[e],indices:[vs,fs-1]}},cs=function(e){return{type:"translation_sequence",value:e,indices:[vs,fs-1]}},ps=function(e){return{type:"translation_sequence",value:e,indices:[vs,fs-1]}},gs=function(e){return{type:"translation",value:e.value,indices:[vs,fs-1]}},_s=function(e){return{type:"integer",value:parseInt(e.join(""),10),indices:[vs,fs-1]}},hs=function(e){return{type:"word",value:e.join(""),indices:[vs,fs-1]}},xs=function(e){return{type:"stop",value:e,indices:[vs,fs-1]}},fs=0|t.peg$currPos,vs=fs,ds=[{line:1,column:1}],bs=fs,ys=t.peg$maxFailExpected||[],ms=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in i))throw new Error("Can't start parsing from rule \""+t.startRule+'".');o=i[t.startRule]}function ks(e,s){return{type:"literal",text:e,ignoreCase:s}}function As(e,s,t){return{type:"class",parts:e,inverted:s,ignoreCase:t}}function $s(e){var t,a=ds[e];if(a)return a;if(e>=ds.length)t=ds.length-1;else for(t=e;!ds[--t];);for(a={line:(a=ds[t]).line,column:a.column};t<e;)10===s.charCodeAt(t)?(a.line++,a.column=1):a.column++,t++;return ds[e]=a,a}function Es(e,s,t){var a=$s(e),r=$s(s),i={source:n,start:{offset:e,line:a.line,column:a.column},end:{offset:s,line:r.line,column:r.column}};return t&&n&&"function"==typeof n.offset&&(i.start=n.offset(i.start),i.end=n.offset(i.end)),i}function Ss(e){fs<bs||(fs>bs&&(bs=fs,ys=[]),ys.push(e))}function js(s,t,a){return new e(e.buildMessage(s,t),s,t,a)}function ws(){var e,s;if(e=[],(s=Ns())===r&&(s=Ps())===r&&(s=Os())===r&&(s=Is())===r&&(s=Vs())===r&&(s=Ts())===r&&(s=Cs())===r&&(s=st())===r&&(s=Ms())===r&&(s=Ks())===r&&(s=et())===r&&(s=Js())===r&&(s=Gs())===r&&(s=Zs())===r&&(s=Hs())===r&&(s=zs())===r&&(s=Ls())===r&&(s=Fs())===r&&(s=qs())===r&&(s=Ds())===r&&(s=gt())===r&&(s=_t())===r&&(s=lt())===r&&(s=Bs())===r&&(s=Xs())===r&&(s=Ws())===r&&(s=Us())===r&&(s=tt())===r&&(s=xt())===r&&(s=Qs())===r&&(s=at())===r&&(s=vt())===r&&(s=dt())===r&&(s=Ys()),s!==r)for(;s!==r;)e.push(s),(s=Ns())===r&&(s=Ps())===r&&(s=Os())===r&&(s=Is())===r&&(s=Vs())===r&&(s=Ts())===r&&(s=Cs())===r&&(s=st())===r&&(s=Ms())===r&&(s=Ks())===r&&(s=et())===r&&(s=Js())===r&&(s=Gs())===r&&(s=Zs())===r&&(s=Hs())===r&&(s=zs())===r&&(s=Ls())===r&&(s=Fs())===r&&(s=qs())===r&&(s=Ds())===r&&(s=gt())===r&&(s=_t())===r&&(s=lt())===r&&(s=Bs())===r&&(s=Xs())===r&&(s=Ws())===r&&(s=Us())===r&&(s=tt())===r&&(s=xt())===r&&(s=Qs())===r&&(s=at())===r&&(s=vt())===r&&(s=dt())===r&&(s=Ys());else e=r;return e}function Ps(){var e,s,t,a,n,i;if(e=fs,(s=Os())===r&&(s=Ns())===r&&(s=Is())===r&&(s=Vs())===r&&(s=Ts())===r&&(s=Cs())===r&&(s=st())===r&&(s=Ms())===r&&(s=Ks())===r&&(s=et())===r&&(s=Js())===r&&(s=Gs())===r&&(s=Zs())===r&&(s=Hs())===r&&(s=zs())===r&&(s=Ls())===r&&(s=Fs())===r&&(s=qs())===r&&(s=Ds())===r&&(s=Ys()),s!==r){if(t=[],a=fs,(n=lt())===r&&(n=null),(i=Rs())!==r?a=n=[n,i]:(fs=a,a=r),a!==r)for(;a!==r;)t.push(a),a=fs,(n=lt())===r&&(n=null),(i=Rs())!==r?a=n=[n,i]:(fs=a,a=r);else t=r;t!==r?(vs=e,e=Pe(s,t)):(fs=e,e=r)}else fs=e,e=r;return e}function Rs(){var e;return(e=function(){var e,t,a,n,i,o,c;if(e=fs,40===s.charCodeAt(fs)?(t=l,fs++):(t=r,0===ms&&Ss(H)),t!==r)if(bt(),lt(),(a=Rs())!==r){for(n=[],i=fs,(o=lt())===r&&(o=null),(c=Rs())!==r?i=o=[o,c]:(fs=i,i=r);i!==r;)n.push(i),i=fs,(o=lt())===r&&(o=null),(c=Rs())!==r?i=o=[o,c]:(fs=i,i=r);i=bt(),41===s.charCodeAt(fs)?(o=u,fs++):(o=r,0===ms&&Ss(G)),o!==r?(vs=e,e=Re(a,n)):(fs=e,e=r)}else fs=e,e=r;else fs=e,e=r;return e}())===r&&(e=Os())===r&&(e=Ns())===r&&(e=Is())===r&&(e=Vs())===r&&(e=Ts())===r&&(e=Cs())===r&&(e=st())===r&&(e=Ms())===r&&(e=Ks())===r&&(e=et())===r&&(e=Js())===r&&(e=Gs())===r&&(e=Zs())===r&&(e=Hs())===r&&(e=zs())===r&&(e=Ls())===r&&(e=Fs())===r&&(e=qs())===r&&(e=Ds())===r&&(e=Bs())===r&&(e=Xs())===r&&(e=Ws())===r&&(e=Us())===r&&(e=tt())===r&&(e=xt())===r&&(e=Qs())===r&&(e=at()),e}function Is(){var e,s,t,a,n,i,o;return e=fs,(s=Ts())===r&&(s=Cs())===r&&(s=st())===r&&(s=Ms())===r&&(s=Ks())===r&&(s=et())===r&&(s=Js())===r&&(s=Gs())===r&&(s=Zs())===r&&(s=fs,(t=zs())!==r?(a=fs,ms++,n=fs,(i=ut())!==r?((o=Ts())===r&&(o=Cs())===r&&(o=st())===r&&(o=Ms())===r&&(o=Ks())===r&&(o=et())===r&&(o=Js())===r&&(o=Zs())===r&&(o=zs()),o!==r?n=i=[i,o]:(fs=n,n=r)):(fs=n,n=r),ms--,n!==r?(fs=a,a=void 0):a=r,a!==r?s=t=[t,a]:(fs=s,s=r)):(fs=s,s=r),s===r&&(s=Ls())===r&&(s=Fs())===r&&(s=Hs())===r&&(s=qs())===r&&(s=Ds())===r&&(s=Bs())===r&&(s=Xs())===r&&(s=Ws())===r&&(s=Us())===r&&(s=tt())===r&&(s=xt())===r&&(s=Qs())===r&&(s=at())),s!==r&&(t=ut())!==r?((a=Vs())===r&&(a=Ts())===r&&(a=Cs())===r&&(a=st())===r&&(a=Ms())===r&&(a=Ks())===r&&(a=et())===r&&(a=Js())===r&&(a=Gs())===r&&(a=Zs())===r&&(a=zs())===r&&(a=Ls())===r&&(a=Fs())===r&&(a=Hs())===r&&(a=qs())===r&&(a=Ds())===r&&(a=Bs())===r&&(a=Xs())===r&&(a=Ws())===r&&(a=tt())===r&&(a=xt())===r&&(a=Us())===r&&(a=Qs())===r&&(a=at()),a!==r?(vs=e,e=Ie(s,a)):(fs=e,e=r)):(fs=e,e=r),e}function zs(){var e,t,a,n,i,o;return e=fs,31===s.charCodeAt(fs)?(t=c,fs++):(t=r,0===ms&&Ss(B)),t!==r&&(a=ft())!==r?(n=fs,47===s.charCodeAt(fs)?(i=p,fs++):(i=r,0===ms&&Ss(W)),i!==r?(o=s.charAt(fs),M.test(o)?fs++:(o=r,0===ms&&Ss(U)),o!==r?n=i=[i,o]:(fs=n,n=r)):(fs=n,n=r),n===r&&(n=null),31===s.charCodeAt(fs)?(i=c,fs++):(i=r,0===ms&&Ss(B)),i!==r?(vs=e,e=ze(a)):(fs=e,e=r)):(fs=e,e=r),e}function Js(){var e,s,t,a,n,i,o,l,u;if(e=fs,(s=zs())!==r){if(t=fs,(a=nt())!==r?(n=fs,ms++,i=fs,(o=Qs())!==r&&(l=it())!==r&&(u=at())!==r?i=o=[o,l,u]:(fs=i,i=r),ms--,i!==r?(fs=n,n=void 0):n=r,n!==r?t=a=[a,n]:(fs=t,t=r)):(fs=t,t=r),t===r){if(t=[],(a=it())!==r)for(;a!==r;)t.push(a),a=it();else t=r;if(t===r){if(t=[],(a=ot())!==r)for(;a!==r;)t.push(a),a=ot();else t=r;if(t===r){if(t=[],(a=ut())!==r)for(;a!==r;)t.push(a),a=ut();else t=r;t===r&&(t=bt())}}}t!==r&&(a=Qs())!==r?(vs=e,e=Je(s,a)):(fs=e,e=r)}else fs=e,e=r;return e}function Cs(){var e,s,t;return e=fs,(s=et())===r&&(s=Js()),s!==r&&(t=ct())!==r?(vs=e,e=Me(s,t)):(fs=e,e=r),e}function Ms(){var e,t,a,n,i,o,l;return e=fs,(t=et())===r&&(t=Js()),t!==r?(a=fs,ms++,n=fs,46===s.charCodeAt(fs)?(i=_,fs++):(i=r,0===ms&&Ss(V)),i!==r&&(o=nt())!==r&&(l=at())!==r?n=i=[i,o,l]:(fs=n,n=r),n===r&&(n=fs,(i=lt())===r&&(i=null),(o=nt())!==r&&(l=Ws())!==r?n=i=[i,o,l]:(fs=n,n=r)),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(n=fs,(i=it())===r&&(i=lt()),i===r&&(i=null),(o=nt())!==r?n=i=[i,o]:(fs=n,n=r),n===r&&(n=it()),n!==r?((i=tt())===r&&(i=at()),i!==r?(vs=e,e=Ke(t,i)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Ks(){var e,s,t,a,n,i,o;return e=fs,(s=et())===r&&(s=Js()),s!==r&&ot()!==r?((t=tt())===r&&(t=at()),t!==r?(a=fs,ms++,n=fs,(i=it())!==r&&(o=at())!==r?n=i=[i,o]:(fs=n,n=r),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(vs=e,e=Te(s,t)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Ts(){var e,t,a,n,i,o,l,u;return e=fs,t=function(){var e,t,a,n;return e=fs,(t=zs())!==r?(bt(),44===s.charCodeAt(fs)?(a=g,fs++):(a=r,0===ms&&Ss(Q)),a!==r?(bt(),(n=Qs())!==r?(vs=e,e=Ce(t,n)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}(),t!==r?(bt(),44===s.charCodeAt(fs)?(a=g,fs++):(a=r,0===ms&&Ss(Q)),a!==r?(bt(),(n=tt())===r&&(n=at()),n!==r?(i=fs,ms++,o=fs,(l=it())!==r&&(u=at())!==r?o=l=[l,u]:(fs=o,o=r),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?(vs=e,e=Ne(t,n)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Ns(){var e,t,a,n,i,o,l,u;return e=fs,(t=zs())!==r?(45===s.charCodeAt(fs)?(a=h,fs++):(a=r,0===ms&&Ss(X)),a===r&&(a=yt()),a===r&&(a=null),(n=Qs())!==r?(45===s.charCodeAt(fs)?(i=h,fs++):(i=r,0===ms&&Ss(X)),i!==r&&(o=at())!==r?(45===s.charCodeAt(fs)?(l=h,fs++):(l=r,0===ms&&Ss(X)),l!==r&&(u=at())!==r?(vs=e,e=Ze(t,n,o,u)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Zs(){var e,s,t,a,n,i;if(e=fs,(s=zs())!==r){if(t=[],(a=it())!==r)for(;a!==r;)t.push(a),a=it();else t=r;if(t===r){if(t=[],(a=ot())!==r)for(;a!==r;)t.push(a),a=ot();else t=r;if(t===r){if(t=[],(a=ut())!==r)for(;a!==r;)t.push(a),a=ut();else t=r;if(t===r){if(t=fs,a=[],(n=lt())!==r)for(;n!==r;)a.push(n),n=lt();else a=r;a!==r?(n=fs,ms++,i=nt(),ms--,i!==r?(fs=n,n=void 0):n=r,n!==r?t=a=[a,n]:(fs=t,t=r)):(fs=t,t=r),t===r&&(t=bt())}}}t!==r?((a=tt())===r&&(a=at()),a!==r?(vs=e,e=qe(s,a)):(fs=e,e=r)):(fs=e,e=r)}else fs=e,e=r;return e}function qs(){var e,s,t;return e=fs,rt()!==r&&(s=Qs())!==r?(pt()===r&&null,(t=zs())!==r?(vs=e,e=Oe(s,t)):(fs=e,e=r)):(fs=e,e=r),e}function Os(){var e,s,t,a;return e=fs,rt()!==r&&(s=Qs())!==r&&ut()!==r&&(t=Qs())!==r?(pt()===r&&null,(a=zs())!==r?(vs=e,e=Le(s,t,a)):(fs=e,e=r)):(fs=e,e=r),e}function Ls(){var e,s,t;return e=fs,(s=qs())!==r?(lt()===r&&null,nt()!==r&&(t=at())!==r?(vs=e,e=De(s,t)):(fs=e,e=r)):(fs=e,e=r),e}function Ds(){var e,t,a,n;return e=fs,(t=Qs())!==r?(s.substr(fs,2)===x?(a=x,fs+=2):(a=r,0===ms&&Ss(Y)),a===r&&(s.substr(fs,2)===f?(a=f,fs+=2):(a=r,0===ms&&Ss(ee)),a===r&&(s.substr(fs,2)===v?(a=v,fs+=2):(a=r,0===ms&&Ss(se)))),a!==r&&rt()!==r?(pt()===r&&null,(n=zs())!==r?(vs=e,e=Fe(t,n)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Fs(){var e,s,t;return e=fs,(s=Ds())!==r?(lt()===r&&null,nt()!==r&&(t=at())!==r?(vs=e,e=He(s,t)):(fs=e,e=r)):(fs=e,e=r),e}function Hs(){var e,t,a,n;return e=fs,31===s.charCodeAt(fs)?(t=c,fs++):(t=r,0===ms&&Ss(B)),t!==r&&(a=ft())!==r?(s.substr(fs,3)===d?(n=d,fs+=3):(n=r,0===ms&&Ss(te)),n!==r?(vs=e,e=Ge(a)):(fs=e,e=r)):(fs=e,e=r),e}function Gs(){var e,s,t;return e=fs,(s=Hs())!==r?(lt()===r&&null,nt()!==r&&(t=at())!==r?(vs=e,e=Be(s,t)):(fs=e,e=r)):(fs=e,e=r),e}function Bs(){var e,s,t;return e=fs,rt()!==r&&(s=Qs())!==r&&(t=ct())!==r?(vs=e,e=We(s,t)):(fs=e,e=r),e}function Ws(){var e,t,a,n,i,o,l;return e=fs,nt()===r&&null,(t=Qs())!==r?(a=fs,ms++,n=fs,46===s.charCodeAt(fs)?(i=_,fs++):(i=r,0===ms&&Ss(V)),i!==r&&(o=nt())!==r&&(l=at())!==r?n=i=[i,o,l]:(fs=n,n=r),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(n=fs,(i=it())===r&&(i=null),(o=nt())!==r?n=i=[i,o]:(fs=n,n=r),n===r&&(n=it()),n!==r?((i=tt())===r&&(i=at()),i!==r?(vs=e,e=Ue(t,i)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Us(){var e,s,t,a,n,i,o;return e=fs,(s=Qs())!==r&&ot()!==r?((t=tt())===r&&(t=at()),t!==r?(a=fs,ms++,n=fs,(i=it())!==r&&(o=at())!==r?n=i=[i,o]:(fs=n,n=r),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(vs=e,e=Qe(s,t)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Qs(){var e,s;return e=fs,rt()===r&&null,(s=xt())!==r?(vs=e,e=Ve(s)):(fs=e,e=r),e}function Vs(){var e,t,a,n,i,o;return e=fs,(t=Ms())===r&&(t=Ks())===r&&(t=Js())===r&&(t=Zs())===r&&(t=Ws())===r&&(t=Us())===r&&(t=xt())===r&&(t=Qs())===r&&(t=at()),t!==r?(bt(),s.substr(fs,2)===b?(a=b,fs+=2):(a=r,0===ms&&Ss(ae)),a!==r?(n=function(){var e,t,a,n,i,o,l,u,c;e=fs,t=bt(),46===s.charCodeAt(fs)?(a=_,fs++):(a=r,0===ms&&Ss(V));a!==r?(n=fs,ms++,i=fs,o=bt(),46===s.charCodeAt(fs)?(l=_,fs++):(l=r,0===ms&&Ss(V)),l!==r?(u=bt(),46===s.charCodeAt(fs)?(c=_,fs++):(c=r,0===ms&&Ss(V)),c!==r?i=o=[o,l,u,c]:(fs=i,i=r)):(fs=i,i=r),ms--,i===r?n=void 0:(fs=n,n=r),n!==r?e=t=[t,a,n]:(fs=e,e=r)):(fs=e,e=r);return e}(),n===r&&(n=null),i=fs,ms++,o=s.charAt(fs),K.test(o)?fs++:(o=r,0===ms&&Ss(re)),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?(vs=e,e=Xe(t)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function Xs(){var e,s,t;return e=fs,(s=xt())!==r&&(t=ct())!==r?(vs=e,e=Ye(s,t)):(fs=e,e=r),e}function Ys(){var e,t,a,n;return e=fs,31===s.charCodeAt(fs)?(t=c,fs++):(t=r,0===ms&&Ss(B)),t!==r&&(a=ft())!==r?(s.substr(fs,3)===y?(n=y,fs+=3):(n=r,0===ms&&Ss(ne)),n!==r?(vs=e,e=es(a)):(fs=e,e=r)):(fs=e,e=r),e}function et(){var e,t,a,n,i;return e=fs,t=function(){var e,t,a,n;return e=fs,31===s.charCodeAt(fs)?(t=c,fs++):(t=r,0===ms&&Ss(B)),t!==r&&(a=ft())!==r?(s.substr(fs,3)===m?(n=m,fs+=3):(n=r,0===ms&&Ss(ie)),n!==r?(vs=e,e=ss(a)):(fs=e,e=r)):(fs=e,e=r),e}(),t!==r?(s.substr(fs,2)===k?(a=k,fs+=2):(a=r,0===ms&&Ss(oe)),a!==r?(n=fs,ms++,i=s.charAt(fs),T.test(i)?fs++:(i=r,0===ms&&Ss(le)),ms--,i===r?n=void 0:(fs=n,n=r),n!==r?(vs=e,e=ts(t)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function st(){var e,t,a,n;return e=fs,(t=et())!==r?(46===s.charCodeAt(fs)?(a=_,fs++):(a=r,0===ms&&Ss(V)),a!==r&&(n=xt())!==r?(vs=e,e=as(t,n)):(fs=e,e=r)):(fs=e,e=r),e}function tt(){var e,t,a,n,i,o;return e=fs,nt()===r&&null,(t=xt())!==r?(bt(),a=fs,ms++,s.substr(fs,2)===b?(n=b,fs+=2):(n=r,0===ms&&Ss(ae)),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(n=s.charAt(fs),N.test(n)?fs++:(n=r,0===ms&&Ss(ue)),n!==r?(i=fs,ms++,o=s.charAt(fs),K.test(o)?fs++:(o=r,0===ms&&Ss(re)),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?(vs=e,e=rs(t)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r)):(fs=e,e=r),e}function at(){var e,s;return e=fs,nt()===r&&null,(s=xt())!==r?(vs=e,e=ns(s)):(fs=e,e=r),e}function rt(){var e,t;return e=fs,bt(),s.substr(fs,9)===A?(t=A,fs+=9):(t=r,0===ms&&Ss(ce)),t===r&&(s.substr(fs,9)===$?(t=$,fs+=9):(t=r,0===ms&&Ss(pe)),t===r&&(s.substr(fs,5)===E?(t=E,fs+=5):(t=r,0===ms&&Ss(ge)))),t!==r?(bt(),vs=e,e=is()):(fs=e,e=r),e}function nt(){var e,t,a,n;return e=fs,bt(),s.substr(fs,5)===S?(t=S,fs+=5):(t=r,0===ms&&Ss(_e)),t!==r?(a=fs,ms++,n=s.charAt(fs),K.test(n)?fs++:(n=r,0===ms&&Ss(re)),ms--,n===r?a=void 0:(fs=a,a=r),a!==r?(n=bt(),vs=e,e=os()):(fs=e,e=r)):(fs=e,e=r),e}function it(){var e,t,a,n,i,o,l,u,c,p;if(e=fs,t=bt(),a=[],58===s.charCodeAt(fs)?(n=":",fs++):(n=r,0===ms&&Ss(he)),n!==r)for(;n!==r;)a.push(n),58===s.charCodeAt(fs)?(n=":",fs++):(n=r,0===ms&&Ss(he));else a=r;return a===r&&(a=fs,46===s.charCodeAt(fs)?(n=_,fs++):(n=r,0===ms&&Ss(V)),n!==r?(i=fs,ms++,o=fs,l=bt(),46===s.charCodeAt(fs)?(u=_,fs++):(u=r,0===ms&&Ss(V)),u!==r?(c=bt(),46===s.charCodeAt(fs)?(p=_,fs++):(p=r,0===ms&&Ss(V)),p!==r?o=l=[l,u,c,p]:(fs=o,o=r)):(fs=o,o=r),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?a=n=[n,i]:(fs=a,a=r)):(fs=a,a=r)),a!==r?e=t=[t,a,n=bt()]:(fs=e,e=r),e}function ot(){var e,t,a;return e=fs,t=bt(),a=s.charAt(fs),Z.test(a)?fs++:(a=r,0===ms&&Ss(xe)),a!==r?e=t=[t,a,bt()]:(fs=e,e=r),e===r&&(e=yt()),e}function lt(){var e,t,a,n,i,o,l,u,c,p;if(e=fs,t=[],a=s.charAt(fs),q.test(a)?fs++:(a=r,0===ms&&Ss(fe)),a===r&&(a=fs,46===s.charCodeAt(fs)?(n=_,fs++):(n=r,0===ms&&Ss(V)),n!==r?(i=fs,ms++,o=fs,l=bt(),46===s.charCodeAt(fs)?(u=_,fs++):(u=r,0===ms&&Ss(V)),u!==r?(c=bt(),46===s.charCodeAt(fs)?(p=_,fs++):(p=r,0===ms&&Ss(V)),p!==r?o=l=[l,u,c,p]:(fs=o,o=r)):(fs=o,o=r),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?a=n=[n,i]:(fs=a,a=r)):(fs=a,a=r),a===r&&(105===s.charCodeAt(fs)?(a=j,fs++):(a=r,0===ms&&Ss(ve)),a===r&&(a=yt()))),a!==r)for(;a!==r;)t.push(a),a=s.charAt(fs),q.test(a)?fs++:(a=r,0===ms&&Ss(fe)),a===r&&(a=fs,46===s.charCodeAt(fs)?(n=_,fs++):(n=r,0===ms&&Ss(V)),n!==r?(i=fs,ms++,o=fs,l=bt(),46===s.charCodeAt(fs)?(u=_,fs++):(u=r,0===ms&&Ss(V)),u!==r?(c=bt(),46===s.charCodeAt(fs)?(p=_,fs++):(p=r,0===ms&&Ss(V)),p!==r?o=l=[l,u,c,p]:(fs=o,o=r)):(fs=o,o=r),ms--,o===r?i=void 0:(fs=i,i=r),i!==r?a=n=[n,i]:(fs=a,a=r)):(fs=a,a=r),a===r&&(105===s.charCodeAt(fs)?(a=j,fs++):(a=r,0===ms&&Ss(ve)),a===r&&(a=yt())));else t=r;return t!==r&&(vs=e,t=ls()),e=t}function ut(){var e,t,a,n,i;if(e=fs,t=bt(),a=[],n=fs,i=s.charAt(fs),O.test(i)?fs++:(i=r,0===ms&&Ss(de)),i!==r?n=i=[i,bt()]:(fs=n,n=r),n===r&&(n=fs,45===s.charCodeAt(fs)?(i=h,fs++):(i=r,0===ms&&Ss(X)),i!==r?n=i=[i,bt()]:(fs=n,n=r)),n!==r)for(;n!==r;)a.push(n),n=fs,i=s.charAt(fs),O.test(i)?fs++:(i=r,0===ms&&Ss(de)),i!==r?n=i=[i,bt()]:(fs=n,n=r),n===r&&(n=fs,45===s.charCodeAt(fs)?(i=h,fs++):(i=r,0===ms&&Ss(X)),i!==r?n=i=[i,bt()]:(fs=n,n=r));else a=r;return a!==r?e=t=[t,a]:(fs=e,e=r),e}function ct(){var e,t,a;return e=fs,(t=it())===r&&(t=lt()),t===r&&(t=null),s.substr(fs,5)===w?(a=w,fs+=5):(a=r,0===ms&&Ss(be)),a!==r?(vs=e,e=us(a)):(fs=e,e=r),e}function pt(){var e,t,a,n,i,o,l,u,c,p;return e=fs,t=bt(),s.substr(fs,4)===P?(a=P,fs+=4):(a=r,0===ms&&Ss(ye)),a===r&&(s.substr(fs,2)===R?(a=R,fs+=2):(a=r,0===ms&&Ss(me)),a===r&&(s.substr(fs,2)===I?(a=I,fs+=2):(a=r,0===ms&&Ss(ke)))),a!==r?(n=bt(),i=fs,s.substr(fs,3)===z?(o=z,fs+=3):(o=r,0===ms&&Ss(Ae)),o!==r?(l=bt(),s.substr(fs,4)===J?(u=J,fs+=4):(u=r,0===ms&&Ss($e)),u!==r?(c=bt(),s.substr(fs,2)===R?(p=R,fs+=2):(p=r,0===ms&&Ss(me)),p!==r?i=o=[o,l,u,c,p,bt()]:(fs=i,i=r)):(fs=i,i=r)):(fs=i,i=r),i===r&&(i=null),e=t=[t,a,n,i]):(fs=e,e=r),e}function gt(){var e,t,a,n,i,o,l,u;if(e=fs,bt(),t=s.charAt(fs),L.test(t)?fs++:(t=r,0===ms&&Ss(Ee)),t!==r){if(bt(),a=fs,(n=ht())!==r){for(i=[],o=fs,(l=lt())!==r&&(u=ht())!==r?o=l=[l,u]:(fs=o,o=r);o!==r;)i.push(o),o=fs,(l=lt())!==r&&(u=ht())!==r?o=l=[l,u]:(fs=o,o=r);a=n=[n,i]}else fs=a,a=r;a!==r?(n=bt(),i=s.charAt(fs),D.test(i)?fs++:(i=r,0===ms&&Ss(Se)),i!==r?(vs=e,e=cs(a)):(fs=e,e=r)):(fs=e,e=r)}else fs=e,e=r;return e}function _t(){var e,t,a,n,i,o,l,u;if(e=fs,bt(),t=fs,44===s.charCodeAt(fs)?(a=g,fs++):(a=r,0===ms&&Ss(Q)),a!==r?t=a=[a,n=bt()]:(fs=t,t=r),t===r&&(t=null),a=fs,(n=ht())!==r){for(i=[],o=fs,(l=lt())!==r&&(u=ht())!==r?o=l=[l,u]:(fs=o,o=r);o!==r;)i.push(o),o=fs,(l=lt())!==r&&(u=ht())!==r?o=l=[l,u]:(fs=o,o=r);a=n=[n,i]}else fs=a,a=r;return a!==r?(vs=e,e=ps(a)):(fs=e,e=r),e}function ht(){var e,t,a,n;return e=fs,30===s.charCodeAt(fs)?(t=C,fs++):(t=r,0===ms&&Ss(je)),t!==r&&(a=ft())!==r?(30===s.charCodeAt(fs)?(n=C,fs++):(n=r,0===ms&&Ss(je)),n!==r?(vs=e,e=gs(a)):(fs=e,e=r)):(fs=e,e=r),e}function xt(){var e;return(e=/^[0-9]{1,3}(?!\d|,000)/.exec(s.substr(fs)))?(vs=fs,fs+=e[0].length,{type:"integer",value:parseInt(e[0],10),indices:[vs,fs-1]}):r}function ft(){var e,t,a;if(e=fs,t=[],a=s.charAt(fs),T.test(a)?fs++:(a=r,0===ms&&Ss(le)),a!==r)for(;a!==r;)t.push(a),a=s.charAt(fs),T.test(a)?fs++:(a=r,0===ms&&Ss(le));else t=r;return t!==r&&(vs=e,t=_s(t)),e=t}function vt(){var e,t,a;if(e=fs,t=[],a=s.charAt(fs),F.test(a)?fs++:(a=r,0===ms&&Ss(we)),a!==r)for(;a!==r;)t.push(a),a=s.charAt(fs),F.test(a)?fs++:(a=r,0===ms&&Ss(we));else t=r;return t!==r&&(vs=e,t=hs(t)),e=t}function dt(){var e,t;return e=fs,t=s.charAt(fs),L.test(t)?fs++:(t=r,0===ms&&Ss(Ee)),t!==r&&(vs=e,t=xs(t)),e=t}function bt(){var e;return(e=yt())===r&&(e=null),e}function yt(){var e;return(e=/^[\s\xa0*]+/.exec(s.substr(fs)))?(fs+=e[0].length,[]):r}if("punctuation_strategy"in t&&"eu"===t.punctuation_strategy&&(it=function(){var e,t,a;e=fs,t=bt(),44===s.charCodeAt(fs)?(a=g,fs++):(a=r,0===ms&&Ss(Q));a!==r?e=t=[t,a,bt()]:(fs=e,e=r);return e},q=/^[;\/:&\-\u2013\u2014~]/),a=o(),t.peg$library)return{peg$result:a,peg$currPos:fs,peg$FAILED:r,peg$maxFailExpected:ys,peg$maxFailPos:bs};if(a!==r&&fs===s.length)return a;throw a!==r&&fs<s.length&&Ss({type:"end"}),js(ys,bs<s.length?s.charAt(bs):null,bs<s.length?Es(bs,bs+1):Es(bs,bs))}}}();
|
package/dist/ht-bcv-parser.js
CHANGED
|
@@ -569,6 +569,7 @@ class bcv_parser {
|
|
|
569
569
|
if (entity.passages == null) {
|
|
570
570
|
continue;
|
|
571
571
|
}
|
|
572
|
+
// Do not reparse semicolon segments here; preserve original context and sequence behavior.
|
|
572
573
|
if (((entity.type === "b") && (this.options.book_alone_strategy === "ignore")) || ((entity.type === "b_range") && (this.options.book_range_strategy === "ignore")) || (entity.type === "context")) {
|
|
573
574
|
continue;
|
|
574
575
|
}
|
|
@@ -618,10 +619,9 @@ class bcv_parser {
|
|
|
618
619
|
passage.absolute_indices = entity.absolute_indices;
|
|
619
620
|
}
|
|
620
621
|
if ((this.options.consecutive_combination_strategy === 'separate-chapters') && (passage.start.c !== passage.end.c)) {
|
|
621
|
-
const osises_by_chapter = this.get_osises_by_chapter({ osis: "", start: passage.start, end: passage.end }, translation_alias);
|
|
622
622
|
osises.push({
|
|
623
623
|
osis: passage.valid.valid ? this.to_osis(passage.start, passage.end, translation_alias) : "",
|
|
624
|
-
osises:
|
|
624
|
+
osises: this.get_osises_by_chapter({ osis: "", start: passage.start, end: passage.end }, translation_alias),
|
|
625
625
|
type: passage.type,
|
|
626
626
|
indices: passage.absolute_indices,
|
|
627
627
|
translations,
|
|
@@ -673,6 +673,50 @@ class bcv_parser {
|
|
|
673
673
|
// Add the OSIS string and some data to the array.
|
|
674
674
|
}
|
|
675
675
|
else {
|
|
676
|
+
if ((this.options.consecutive_combination_strategy === "separate-chapters") && (entity.type === "sequence")) {
|
|
677
|
+
const groups = this.group_osises_by_semicolon(osises);
|
|
678
|
+
if (groups.length > 1) {
|
|
679
|
+
for (const group of Array.from(groups)) {
|
|
680
|
+
if (group.length === 0) {
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
683
|
+
if (group.length > 1) {
|
|
684
|
+
for (osis of Array.from(group)) {
|
|
685
|
+
if (osis.osis.length === 0) {
|
|
686
|
+
continue;
|
|
687
|
+
}
|
|
688
|
+
const entry = { osis: osis.osis, indices: osis.indices, translations, entity_id, entities: [osis] };
|
|
689
|
+
if (osis.osises != null) {
|
|
690
|
+
entry.osises = osis.osises;
|
|
691
|
+
}
|
|
692
|
+
out.push(entry);
|
|
693
|
+
}
|
|
694
|
+
continue;
|
|
695
|
+
}
|
|
696
|
+
const group_last_i = group.length - 1;
|
|
697
|
+
const indices = [group[0].indices[0], group[group_last_i].indices[1]];
|
|
698
|
+
if ((group[group_last_i].enclosed_indices != null) && (group[group_last_i].enclosed_indices[1] >= 0)) {
|
|
699
|
+
indices[1] = group[group_last_i].enclosed_indices[1];
|
|
700
|
+
}
|
|
701
|
+
const strings = [];
|
|
702
|
+
let osises_by_chapter = [];
|
|
703
|
+
for (osis of Array.from(group)) {
|
|
704
|
+
if (osis.osis.length > 0) {
|
|
705
|
+
strings.push(osis.osis);
|
|
706
|
+
}
|
|
707
|
+
if (osis.osises != null) {
|
|
708
|
+
osises_by_chapter = osises_by_chapter.concat(osis.osises);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
const out_entry = { osis: strings.join(","), indices, translations, entity_id, entities: group };
|
|
712
|
+
if (osises_by_chapter.length > 0) {
|
|
713
|
+
out_entry.osises = osises_by_chapter;
|
|
714
|
+
}
|
|
715
|
+
out.push(out_entry);
|
|
716
|
+
}
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
676
720
|
var osis;
|
|
677
721
|
var strings = [];
|
|
678
722
|
var last_i = osises.length - 1;
|
|
@@ -688,15 +732,9 @@ class bcv_parser {
|
|
|
688
732
|
let osises_by_chapter = [];
|
|
689
733
|
if (this.options.consecutive_combination_strategy === "separate-chapters") {
|
|
690
734
|
for (osis of Array.from(osises)) {
|
|
691
|
-
if (osis.osis.length === 0) {
|
|
692
|
-
continue;
|
|
693
|
-
}
|
|
694
735
|
if (osis.osises != null) {
|
|
695
736
|
osises_by_chapter = osises_by_chapter.concat(osis.osises);
|
|
696
737
|
}
|
|
697
|
-
else {
|
|
698
|
-
osises_by_chapter = osises_by_chapter.concat(this.get_osises_by_chapter(osis, translation_alias));
|
|
699
|
-
}
|
|
700
738
|
}
|
|
701
739
|
}
|
|
702
740
|
const out_entry = { osis: strings.join(","), indices: entity.absolute_indices, translations, entity_id, entities: osises };
|
|
@@ -784,14 +822,14 @@ class bcv_parser {
|
|
|
784
822
|
return out;
|
|
785
823
|
}
|
|
786
824
|
get_osises_by_chapter(passage, translation) {
|
|
787
|
-
if ((passage == null) || (passage.start == null) || (passage.end == null)
|
|
825
|
+
if ((passage == null) || (passage.start == null) || (passage.end == null)) {
|
|
788
826
|
return [];
|
|
789
827
|
}
|
|
790
828
|
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] : [];
|
|
829
|
+
return (passage.osis != null) && (passage.osis.length > 0) ? [passage.osis] : [];
|
|
792
830
|
}
|
|
793
831
|
if ((passage.start.b !== passage.end.b) || (passage.start.c === passage.end.c)) {
|
|
794
|
-
return passage.osis.length > 0 ? [passage.osis] : [];
|
|
832
|
+
return (passage.osis != null) && (passage.osis.length > 0) ? [passage.osis] : [];
|
|
795
833
|
}
|
|
796
834
|
const out = [];
|
|
797
835
|
for (let c = passage.start.c, end = passage.end.c, asc = passage.start.c <= end; asc ? c <= end : c >= end; asc ? c++ : c--) {
|
|
@@ -813,6 +851,42 @@ class bcv_parser {
|
|
|
813
851
|
}
|
|
814
852
|
return out;
|
|
815
853
|
}
|
|
854
|
+
get_separator_between(prev_indices, next_indices) {
|
|
855
|
+
if ((this.s == null) || (prev_indices == null) || (next_indices == null)) {
|
|
856
|
+
return "";
|
|
857
|
+
}
|
|
858
|
+
const start = prev_indices[1];
|
|
859
|
+
const end = next_indices[0];
|
|
860
|
+
if (end <= start) {
|
|
861
|
+
return "";
|
|
862
|
+
}
|
|
863
|
+
return this.s.slice(start, end);
|
|
864
|
+
}
|
|
865
|
+
has_semicolon_separator(prev_osis, next_osis) {
|
|
866
|
+
const between = this.get_separator_between(prev_osis.indices, next_osis.indices);
|
|
867
|
+
return /[;;]/.test(between);
|
|
868
|
+
}
|
|
869
|
+
group_osises_by_semicolon(osises) {
|
|
870
|
+
const out = [];
|
|
871
|
+
let current = [];
|
|
872
|
+
for (const osis of Array.from(osises)) {
|
|
873
|
+
if (current.length === 0) {
|
|
874
|
+
current.push(osis);
|
|
875
|
+
continue;
|
|
876
|
+
}
|
|
877
|
+
if (this.has_semicolon_separator(current[current.length - 1], osis)) {
|
|
878
|
+
out.push(current);
|
|
879
|
+
current = [osis];
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
current.push(osis);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
if (current.length > 0) {
|
|
886
|
+
out.push(current);
|
|
887
|
+
}
|
|
888
|
+
return out;
|
|
889
|
+
}
|
|
816
890
|
// 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.
|
|
817
891
|
fix_ps151(start, end, translation) {
|
|
818
892
|
// Ps151 doesn't necessarily get promoted into the translation chapter list because during the string parsing, we treat it as `Ps` rather than `Ps151`.
|
|
@@ -857,6 +931,11 @@ class bcv_parser {
|
|
|
857
931
|
if (osis.osis.length > 0) {
|
|
858
932
|
var prev_i = out.length - 1;
|
|
859
933
|
var is_enclosed_last = false;
|
|
934
|
+
if ((prev_i >= 0) && this.has_semicolon_separator(out[prev_i], osis)) {
|
|
935
|
+
out.push(osis);
|
|
936
|
+
prev = { b: osis.end.b, c: osis.end.c, v: osis.end.v };
|
|
937
|
+
continue;
|
|
938
|
+
}
|
|
860
939
|
// Record the start index of the enclosed sequence for use in future iterations.
|
|
861
940
|
if (osis.enclosed_indices[0] !== enclosed_sequence_start) {
|
|
862
941
|
enclosed_sequence_start = osis.enclosed_indices[0];
|