PageSourceSearch

https://kingjamesbiblereader.com/assets/exportBiblePdf-C8hRsk10.js

js kingjamesbiblereader.com collected 2026-10-02 01:35:16 UTC 23,787 bytes, 6 lines download raw bytes

1import{E as Me}from"./jspdf.es.min-CFcvHOBu.js";import{D as Be,p as ne,ap as Se,aK as we}from"./index-DwOsqt_4.js";import{m as Re}from"./bibleApi-COTrrsw1.js";import{t as $e}from"./nativeDownload-ruPHFkyf.js";const Ae=[{id:"serif",label:"Serif",pdf:"times",css:"'Times New Roman', Georgia, serif",rtf:"Times New Roman"},{id:"sans",label:"Sans-serif",pdf:"helvetica",css:"Arial, Helvetica, sans-serif",rtf:"Arial"},{id:"mono",label:"Monospace",pdf:"courier",css:"'Courier New', monospace",rtf:"Courier New"},{id:"cursive",label:"Cursive",pdf:"times",css:"'Segoe Script', 'Brush Script MT', 'Comic Sans MS', cursive",rtf:"Segoe Script",embed:{family:"DancingScript",normal:"https://cdn.jsdelivr.net/fontsource/fonts/dancing-script@latest/latin-400-normal.ttf",bold:"https://cdn.jsdelivr.net/fontsource/fonts/dancing-script@latest/latin-700-normal.ttf"}},{id:"legible",label:"High-legibility",pdf:"helvetica",css:"'Atkinson Hyperlegible', 'Verdana', 'Tahoma', sans-serif",rtf:"Atkinson Hyperlegible",embed:{family:"AtkinsonHyperlegible",normal:"https://cdn.jsdelivr.net/fontsource/fonts/atkinson-hyperlegible@latest/latin-400-normal.ttf",bold:"https://cdn.jsdelivr.net/fontsource/fonts/atkinson-hyperlegible@latest/latin-700-normal.ttf",italic:"https://cdn.jsdelivr.net/fontsource/fonts/atkinson-hyperlegible@latest/latin-400-italic.ttf"}}],qe="serif";function ye(n){return Ae.find(s=>
1s.id===n)||Ae[0]}function We(n){const s=new Uint8Array(n);let r="";const u=32768;for(let R=0;R<s.length;R+=u)r+=String.fromCharCode.apply(null,s.subarray(R,R+u));return btoa(r)}async function ve(n){const s=await fetch(n);if(!s.ok)throw new Error(`Font fetch failed: ${n} (${s.status})`);const r=await s.arrayBuffer();return We(r)}async function Le(n,s){const r=s==null?void 0:s.embed;if(!r)return(s==null?void 0:s.pdf)||"times";const{family:u}=r,R=[{style:"normal",url:r.normal},{style:"bold",url:r.bold},{style:"italic",url:r.italic}].filter(k=>k.url);try{let k=!1;for(const y of R){const W=await ve(y.url),P=`${u}-${y.style}.ttf`;n.addFileToVFS(P,W),n.addFont(P,u,y.style),y.style==="normal"&&(k=!0)}if(!k)return s.pdf||"times";const Y=R.some(y=>y.style==="bold"),V=R.some(y=>y.style==="italic");return Y||n.addFont(`${u}-normal.ttf`,u,"bold"),V||n.addFont(`${u}-normal.ttf`,u,"italic"),u}catch(k){return console.error("Font embedding failed, using fallback:",k),s.pdf||"times"}}const Fe=[{t:"THE",size:14},{t:"HOLY BIBLE",size:34,bold:!0},{t:"CONTAINING THE",size:12},{t:"OLD AND NEW TESTAMENTS",size:14},{t:"TRANSLATED OUT OF THE ORIGINAL TONGUES: AND WITH THE FORMER TRANSLATIONS DILIGENTLY COMPARED AND REVISED, BY HIS MAJESTY'S SPECIAL COMMAND",size:10,gap:18},{t:"APPOINTED TO BE READ IN CHURCHES",size:10,gap:18},{t:"AUTHORISED KING JAMES BIBLE",size:13,gap:18}],ue=[{t:"THE",size:14},{t:"NEW TESTAMENT",size:30,bold:!0},{t:"OF OUR LORD AND SAVIOUR JESUS CHRIST",size:12},{t:"TRANSLATED OUT OF THE ORIGINAL GREEK: AND WITH THE FORMER TRANSLATIONS DILIGENTLY COMPARED AND REVISED, BY HIS MAJESTY'S SPECIAL COMMAND",size:10,gap:18},{t:"APPOINTED TO BE READ IN CHURCHES",size:10,gap:18}];function Ne(n=""){return Re(String(n)).replace(/^<<[^>]*>>\s*/,"").replace(/\u2019/g,"'").replace(/\u2018/g,"'").replace(/\u201C/g,'"').replace(/\u201D/g,'"').replace(/\s*made\s+in\s+australia\.?\s*/gi," ").replace(/\s{2,}/g," ").trim()}function de(n=""){return n.includes("¶")||n.includes("�")}function Oe(n=""){return String(n).replace(/\s*[\u00B6\uFFFD]?\s*THE END\.?\s*$/i,"").replace(/\s*[\u00B6\uFFFD]?\s*END OF THE PROPHETS\.?\s*$/i,"").trim()}function be(n){let s=Ne(n);s=s.replace(/(\w)[\u00B6\uFFFD](\w)/g,"$1'$2"),s=s.replace(/[\u00B6\uFFFD]\s*/g,"¶ ");const r=s.split(/\[([^\]]+)\]/g),u=[];return r.forEach((R,k)=>{R&&u.push({text:R,italic:k%2===1})}),u}function he(n,s){let r=Ne(n);return r=r.replace(/(\w)[\u00B6\uFFFD](\w)/g,"$1'$2"),r=r.replace(/[\u00B6\uFFFD]\s*/g,"¶ "),s||(r=r.replace(/\[([^\]]+)\]/g,"$1")),r.trim()}function ee(n=""){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ze(n,s,r,u,R="times",k=ne){n.setFont(R,"bold");let Y=1,V=u;const y=c=>{V+c>r-u&&(Y+=1,V=u),V+=c},W=26,P=13,J=u+16,_=s-u;y(34);let t=null;return k.forEach(c=>{if(c.testament!==t&&(t=c.testament,y(15),y(28)),y(15),c.chapters>1){let E=J,f=0;for(let j=1;j<=c.chapters;j++)E+W>_&&(y(P),E=J),E+=W,f=P;y(f+4)}}),Y}async function Ie(n,s,r){var Ce;const{twoColumn:u,paragraph:R,subscripts:k,colophons:Y,shortNames:V,scope:y="whole",coverPage:W=!0,toc:P=!0}=n,J=e=>V?e.shortName:e.name,_=y==="old"?ne.filter(e=>e.testament==="old"):y==="new"?ne.filter(e=>e.testament==="new"):ne,t=new Me({unit:"pt",format:"a4"}),c=ye(n.font);c.embed&&r(3,`Loading ${c.label} font…`);const E=await Le(t,c),f=t.internal.pageSize.getWidth(),j=t.internal.pageSize.getHeight(),N=40,l=18,ce=f-N*2,oe=(f-N*2-l)/2,b=9,H=16,X=e=>e.twoColumnEnabled&&!e.forceSingleCol,$=e=>X(e)?oe:ce,D=e=>N+(X(e)&&e.col===1?oe+l:0),i=e=>e.runningHead?N+H:N,p=e=>e.col===0&&e.y===i(e);function O(e){!e.runningHead||e.dry||(t.setFont(E,"normal"),t.setFontSize(9),t.text(e.runningHead,f/2,N-6,{align:"center",baseline:"top"}))}function m(e){e.dry?e.virtualPage=(e.virtualPage||1)+1:t.addPage(),e.col=0,e.y=i(e),e.usedCol2OnPage=!1,e.lastPageStartMarker=e.verseSeq||0,!e.dry&&e.splitMarker!=null&&!e.forceSingleCol&&e.lastPageStartMarker===e.splitMarker&&(e.forceSingleCol=!0),O(e)}function M(e,a=b+4){e.y+a<=j-N||(X(e)&&e.col===0?(e.col=1,e.y=i(e),e.usedCol2OnPage=!0):m(e))}function d(e,a){e.runningHead="",p(e)||m(e),e.y=j/4,a.forEach(g=>{t.setFont(E,g.bold?"bold":"normal"),t.setFontSize(g.size),t.splitTextToSize(g.t,f-N*2).forEach(v=>{t.text(v,f/2,e.y,{align:"center",baseline:"top"}),e.y+=g.size+6}),e.y+=g.gap||10}),m(e)}function z(e,a,{size:g=b,indentFirst:I=0}={}){t.setFontSize(g);const v=()=>(t.setFont(E,"normal"),t.getTextWidth(" ")),T=[];
1if(a.forEach(w=>{w.text.split(/(\s+)/).filter(F=>F.length).forEach(F=>{/^\s+$/.test(F)||T.push({w:F,italic:w.italic})})}),!T.length){e.y+=g+3.5;return}M(e,g+4);const x=D(e),L=$(e),K=L-I,h=[];let A=[],o=0;T.forEach(w=>{t.setFont(E,w.italic?"italic":"normal");const F=t.getTextWidth(w.w),U=h.length===0?K:L,Z=(A.length?v():0)+F;A.length&&o+Z>U&&(h.push(A),A=[],o=0),A.push(w),o+=(A.length>1?v():0)+F}),A.length&&h.push(A);const S=4;for(;h.length>1&&h[h.length-1].length<S&&h[h.length-2].length>1;)h[h.length-1].unshift(h[h.length-2].pop());h.forEach((w,F)=>{F===0?t.setFont(E,w[0].italic?"italic":"normal"):M(e,g+4);let U=(F===0?x:D(e))+(F===0?I:0);w.forEach((Z,re)=>{re>0&&(t.setFont(E,"normal"),U+=v()),t.setFont(E,Z.italic?"italic":"normal"),e.dry||t.text(Z.w,U,e.y,{baseline:"top"}),U+=t.getTextWidth(Z.w)}),e.y+=g+3.5})}function q(e,a,{size:g=b,font:I="italic",gapAfter:v=4}={}){t.setFont(E,I),t.setFontSize(g),t.splitTextToSize(a,$(e)).forEach(x=>{M(e,g+4),e.dry||t.text(x,D(e)+$(e)/2,e.y,{align:"center",baseline:"top"}),e.y+=g+3.5}),e.y+=v}function te(e,a,{size:g=b,gapAfter:I=4}={}){t.setFontSize(g);const v=be(a),T=()=>(t.setFont(E,"normal"),t.getTextWidth(" ")),x=[];v.forEach(o=>{o.text.split(/(\s+)/).filter(S=>S.length).forEach(S=>{/^\s+$/.test(S)||x.push({w:S,italic:o.italic})})});const L=[];let K=[],h=0;x.forEach(o=>{t.setFont(E,o.italic?"italic":"normal");const S=t.getTextWidth(o.w),w=(K.length?T():0)+S;K.length&&h+w>$(e)&&(L.push({words:K,width:h}),K=[],h=0),K.push(o),h+=(K.length>1?T():0)+S}),K.length&&L.push({words:K,width:h});const A=4;for(;L.length>1&&L[L.length-1].words.length<A&&L[L.length-2].words.length>1;){const o=L[L.length-2],S=L[L.length-1],w=o.words.pop();t.setFont(E,w.italic?"italic":"normal");const F=t.getTextWidth(w.w),U=T();o.width-=F+U,S.words.unshift(w),S.width+=F+U}L.forEach(o=>{M(e,g+4);let S=D(e)+($(e)-o.width)/2;o.words.forEach((w,F)=>{F>0&&(t.setFont(E,"normal"),S+=T()),t.setFont(E,w.italic?"italic":"normal"),e.dry||t.text(w.w,S,e.y,{baseline:"top"}),S+=t.getTextWidth(w.w)}),e.y+=g+3.5}),e.y+=I}function ae(e,a,g,{onChapterStart:I}={}){t.setFont(E,"bold"),t.setFontSize(15),t.splitTextToSize(J(a),$(e)).forEach(T=>{e.dry||t.text(T,D(e)+$(e)/2,e.y,{align:"center",baseline:"top"}),e.y+=18}),e.y+=8,e.runningHead=J(a);for(let T=1;T<=a.chapters;T++){let x=g[T]||[];if(!x.length)continue;const L=a.apiName==="Malachi"&&T===a.chapters,K=a.apiName==="Revelation"&&T===a.chapters;if(L||K){const o=x[x.length-1];x=[...x.slice(0,-1),{...o,text:Oe(o.text)}]}const h=(T>1?12:0)+11+22+(b+3.5)*3+8;if(M(e,h),T>1&&!p(e)&&(e.y+=12),I&&I(T,e),t.setFont(E,"bold"),t.setFontSize(11),e.dry||t.text(`Chapter ${T}`,D(e)+$(e)/2,e.y,{align:"center",baseline:"top"}),e.y+=22,k){const o=Se[`${a.apiName}:${T}`];o&&te(e,o,{size:8})}const A=(o,S)=>{o.heading&&(S||(e.y+=8),q(e,o.heading,{size:10,font:"bold",gapAfter:6}))};if(R){let o=[];const S=()=>{o.length&&(z(e,o,{indentFirst:12}),e.y+=3),o=[]};x.forEach((w,F)=>{e.verseSeq=(e.verseSeq||0)+1,w.heading?(S(),A(w,F===0)):F>0&&de(w.text)&&(S(),e.y+=6,M(e,(b+3.5)*2+6)),o.push({text:`${w.verse} `,italic:!1}),o.push(...be(w.text)),o.push({text:"  ",italic:!1})}),S()}else x.forEach((o,S)=>{e.verseSeq=(e.verseSeq||0)+1,o.heading?A(o,S===0):S>0&&de(o.text)&&(e.y+=6,M(e,(b+3.5)*2+6)),z(e,[{text:`${o.verse} `,italic:!1},...be(o.text)]),e.y+=1});if(Y){const o=we[`${a.apiName}:${T}`];o&&(e.y+=3,te(e,"¶ "+Ne(o).replace(/^¶\s*/,""),{size:8}))}}a.apiName==="Malachi"&&(e.y+=10,q(e,y==="old"?"THE END.":"THE END OF THE PROPHETS.",{size:11,font:"bold",gapAfter:6})),a.apiName==="Revelation"&&(e.y+=10,q(e,"THE END.",{size:12,font:"bold",gapAfter:6}))}const C=new Map;u&&_.forEach(e=>{if(e.chapters<=1)return;const a=s[e.apiName]||{},g={col:0,y:N,runningHead:"",forceSingleCol:!1,twoColumnEnabled:!0,dry:!0,virtualPage:1,usedCol2OnPage:!1,verseSeq:0};ae(g,e,a,{}),g.usedCol2OnPage||C.set(e.apiName,g.lastPageStartMarker||0)});const B={col:0,y:N,runningHead:"",forceSingleCol:!1,twoColumnEnabled:u,dry:!1,splitMarker:null,verseSeq:0};let G=0,se=0;const le=t.internal.getNumberOfPages();W&&(y==="new"?(G=le,d(B,ue)):(se=le,d(B,Fe)));const fe=_.length,Pe=P?ze(t,f,j,N,E,_):0,He=P?t.internal.getNumberOfPages():0;for(let e=0;e<Pe-1;e++)t.addPage();B.runningHead="",B.col=0,B.y=P?j:N;const Q=[];for(let e=0;e<fe;e++){const a=_[e],g=s[a.apiName]||{};B.forceSingleCol=a.chapters===1,B.splitMarker=C.has(a.apiName)?C.get(a.apiName):null,B.verseSeq=0,W&&a.apiName==="Matthew"&&y==="whole"&&(G=t.internal.getNumberOfPages(),d(B,ue)),B.runningHead="",p(B)||m(B);const I=t.internal.getNumberOfPages(),v=[];Q.push({book:a,page:I,chapters:v}),ae(B,a,g,{onChapterStart:T=>
1v.push({ch:T,page:t.internal.getNumberOfPages()})}),Q[Q.length-1].endPage=t.internal.getNumberOfPages(),r(Math.round((e+1)/fe*90)+5,`Adding ${a.shortName}… (${e+1}/${fe})`),await new Promise(T=>setTimeout(T,0))}if(Q.forEach(({book:e,page:a,endPage:g})=>{const I=g-a+1;for(let v=a;v<=g;v++){const T=v-a+1;t.setPage(v),t.setFont(E,"normal"),t.setFontSize(8),t.text(`${T} of ${I}`,f/2,j-N+14,{align:"center",baseline:"top"})}}),(Ce=t.outline)!=null&&Ce.add){se&&t.outline.add(null,"Cover Page",{pageNumber:se}),P&&t.outline.add(null,"Contents",{pageNumber:He});let e=null,a=null;const g=Q.find(T=>T.book.testament==="old"),I=Q.find(T=>T.book.testament==="new");g&&(e=t.outline.add(null,"THE OLD TESTAMENT",{pageNumber:g.page})),I&&(a=t.outline.add(null,"THE NEW TESTAMENT",{pageNumber:G||I.page})),Q.forEach(({book:T,page:x})=>{const L=T.testament==="old"?e:a;t.outline.add(L,T.shortName,{pageNumber:x})});const v=Q.length?Q[Q.length-1].endPage:t.internal.getNumberOfPages();t.outline.add(null,"The End",{pageNumber:v})}if(P){r(96,"Building contents…"),B.runningHead="";let e=He;t.setPage(e);let a=N;const g=h=>{a+h>j-N&&(e+=1,t.setPage(e),a=N)},I=(h,A)=>{g(28),a+=8,t.setFont(E,"bold"),t.setFontSize(13);const o=t.getTextWidth(h);t.textWithLink(h,(f-o)/2,a,{pageNumber:A}),a+=20},v=(h,A,o)=>{g(16),t.setFont(E,"bold"),t.setFontSize(10.5);const S=`${o}.  ${J(h)}`,w=`${h.chapters} ch.`,F=N+6,U=f-N;t.textWithLink(S,F,a,{pageNumber:A}),t.text(w,U,a,{align:"right"});const Z=t.getTextWidth(S),re=t.getTextWidth(w),pe=F+Z+6,me=U-re-6;if(me>pe){t.setFont(E,"normal");const Te=t.getTextWidth("."),De=Math.floor((me-pe)/Te);De>0&&t.text(".".repeat(De),pe,a)}a+=15},T=h=>{const S=N+16,w=f-N;t.setFont(E,"normal"),t.setFontSize(9),g(13);let F=S;h.forEach(({ch:U,page:Z})=>{F+26>w&&(F=S,a+=13,g(13)),t.textWithLink(String(U),F,a,{pageNumber:Z}),F+=26}),a+=17},x=(h,A)=>{g(16),t.setFont(E,"bold"),t.setFontSize(10.5);const o=`•  ${h}`,S=String(A),w=N+6,F=f-N;t.textWithLink(o,w,a,{pageNumber:A}),t.text(S,F,a,{align:"right"});const U=t.getTextWidth(o),Z=t.getTextWidth(S),re=w+U+6,pe=F-Z-6;if(pe>re){t.setFont(E,"normal");const me=t.getTextWidth("."),Te=Math.floor((pe-re)/me);Te>0&&t.text(".".repeat(Te),re,a)}a+=15};t.setFont(E,"bold"),t.setFontSize(20),t.text("CONTENTS",f/2,a,{align:"center",baseline:"top"}),a+=34;let L=null,K=1;Q.forEach(({book:h,page:A,chapters:o})=>{h.testament!==L&&(L=h.testament,h.testament==="old"&&se&&x("Cover Page",se),h.testament==="new"&&G&&x("The New Testament",G),I(h.testament==="old"?"THE OLD TESTAMENT":"THE NEW TESTAMENT",A)),v(h,A,K++),o.length>1&&T(o)})}r(98,"Finalising PDF…"),await $e(t.output("blob"),Ee(n,"pdf"))}async function xe(n,s,r,u){const{twoColumn:R,paragraph:k,subscripts:Y,colophons:V,shortNames:y,scope:W="whole",coverPage:P=!0,toc:J=!0}=n,_=i=>y?i.shortName:i.name,t=W==="old"?ne.filter(i=>i.testament==="old"):W==="new"?ne.filter(i=>i.testament==="new"):ne,c=u==="docx",E=u==="txt",f=[],j=[];let N=0;const l=(i,p="body",O=null,m=!1)=>{if(c){const M=O?`<a name="${O}"></a>`:"",d=m?"page-break-inside:avoid;page-break-after:avoid;":"";p==="title-main"?f.push(`<p style="text-align:center;font-size:26pt;font-weight:bold;margin:6px 0">${M}${ee(i)}</p>`):p==="title-line"?f.push(`<p style="text-align:center;font-size:13pt;margin:4px 0">${M}${ee(i)}</p>`):p==="center-italic"?f.push(`<p style="text-align:center">${oe(i)}</p>`):f.push(`<p style="${d}">${oe(i)}</p>`)}else f.push(i)},ce=i=>"bk_"+i.abbr;function oe(i){return he(i,!0).split(/(\[[^\]]+\])/g).map(O=>{const m=O.match(/^\[([^\]]+)\]$/);return m?`<i>${ee(m[1])}</i>`:ee(O)}).join("")}c&&f.push('<div class="SectionFront">'),P&&(c&&f.push('<a name="cover_page"></a>'),(W==="new"?ue:Fe).forEach((i,p)=>l(i.t,p===1?"title-main":"title-line")),l(""),c&&J&&f.push('<br style="page-break-after:always" />'));const b=t.length,H=W==="new"?"new":"old";if(J)if(c){f.push('<p style="text-align:center;font-size:20pt;font-weight:bold;margin:6px 0">CONTENTS</p>');let i=null,p=1;t.forEach(O=>{O.testament!==i&&(i=O.testament,P&&O.testament===H&&f.push('<p style="margin:1px 0 1px 28px;text-indent:-10px"><a href="#cover_page">&bull;&nbsp;Cover Page</a></p>'),P&&O.testament==="new"&&W==="whole"&&f.push('<p style="margin:1px 0 1px 28px;text-indent:-10px"><a href="#nt_title">&bull;&nbsp;The New Testament</a></p>'),f.push(`<p style="margin:8px 0 2px"><b>${O.testament==="old"?"THE OLD TESTAMENT":"THE NEW TESTAMENT"}</b></p>`)),f.push(`<p style="margin:1px 0 1px 28px;text-indent:-20px"><a href="#${ce(O)}">${p++}.&nbsp;&nbsp;${ee(_(O))}</a></p>`)})}else{l("CONTENTS"),l("");let i=null,p=1;t.forEach(O=>{O.testament!==i&&(i=O.testament,l(""),P&&O.testament===H&&(l("  • C
1over Page"),l("")),P&&O.testament==="new"&&W==="whole"&&(l("• The New Testament"),l("")),l(O.testament==="old"?"THE OLD TESTAMENT":"THE NEW TESTAMENT")),l(""),l(`  ${p++}. ${_(O)}`),l("")}),l(""),l("")}let X=null;for(let i=0;i<b;i++){const p=t[i],O=s[p.apiName]||{};if(P&&p.apiName==="Matthew"&&W==="whole"&&(c&&(f.push('<br style="page-break-before:always" /><a name="nt_title"></a>'),f.push('<h1 style="text-align:center">THE NEW TESTAMENT</h1>'),X="new"),ue.forEach((d,z)=>l(d.t,z===1?"title-main":"title-line")),l("")),c){N+=1;const d=`Section${N}`,z=`h${N}`;j.push(`<div style="mso-element:header" id="${z}"><p class=MsoHeader style="text-align:center"><i>${ee(_(p))}</i></p></div>`);let q="";if(p.testament!==X){X=p.testament;const ae=p.testament==="old"?"THE OLD TESTAMENT":"THE NEW TESTAMENT";q=`<h1 style="text-align:center">${ee(ae)}</h1>`}let te="";if(n.twoColumn&&i>0){N+=1;const ae=`Section${N}`;j.push(`<div style="mso-element:header" id="h${N}"><p class=MsoHeader style="text-align:center"><i>${ee(_(t[i-1]))}</i></p></div>`),te=`<div class="${ae}"></div>`}f.push("</div>"+te+`<div class="${d}" style="page-break-before:always">${q}<a name="${ce(p)}"></a><h2 style="text-align:center">${ee(_(p))}</h2>`)}else i===0||P&&p.apiName==="Matthew"&&W==="whole"||(l(""),l(""),l("")),l(_(p),"h1",ce(p));for(let d=1;d<=p.chapters;d++){let z=O[d]||[];if(!z.length)continue;const q=p.apiName==="Malachi"&&d===p.chapters,te=p.apiName==="Revelation"&&d===p.chapters;if(q||te){const C=z[z.length-1];z=[...z.slice(0,-1),{...C,text:Oe(C.text)}]}if(c?f.push(`<p style="text-align:center;margin-top:18px"><b>Chapter ${d}</b></p>`):(l(""),l(""),l(`Chapter ${d}`),l("")),Y){const C=Se[`${p.apiName}:${d}`];C&&l("¶ "+he(C,c?!0:E).replace(/^¶\s*/,""),"center-italic")}const ae=(C,B)=>{C.heading&&(c?f.push(`<p style="text-align:center;margin-top:${B?8:14}px"><b>${ee(C.heading)}</b></p>`):(B||l(""),l(C.heading),l("")))};if(k){let C="",B=!1,G=!1;const se=()=>{C.trim()&&(B&&!c&&l(""),G&&c?f.push('<p style="margin:0;line-height:6pt">&nbsp;</p>'):G&&!c&&l(""),l(C.trim(),"body",null,G),B=!0),G=!1,C=""};z.forEach((le,fe)=>{le.heading?(se(),ae(le,fe===0)):fe>0&&de(le.text)&&(se(),G=!0),C+=`${le.verse} ${he(le.text,E)}  `}),se()}else z.forEach((C,B)=>{const G=B>0&&de(C.text);C.heading?ae(C,B===0):G&&(c?f.push('<p style="margin:0;line-height:6pt">&nbsp;</p>'):l("")),l(`${C.verse} ${he(C.text,E)}`,"body",null,G)});if(V){const C=we[`${p.apiName}:${d}`];C&&(c||l(""),l("¶ "+he(C,c?!0:E).replace(/^¶\s*/,""),"center-italic"),c||(l(""),l("")))}}const m=p.apiName==="Malachi",M=p.apiName==="Revelation";if(m){const d=W==="old"?"THE END.":"THE END OF THE PROPHETS.";c?(f.push(`<p style="text-align:center;margin-top:14px"><b>${d}</b></p>`),f.push('<br style="page-break-after:always" />')):(l(""),l(""),l(d),l(""),l(""))}M&&(c?f.push('<p style="text-align:center;margin-top:14px"><b>THE END.</b></p>'):(l(""),l(""),l("THE END."),l(""))),r(Math.round((i+1)/b*90)+5,`Adding ${p.shortName}… (${i+1}/${b})`),await new Promise(d=>setTimeout(d,0))}r(98,"Saving file…");let $,D;if(c){if(f.push("<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"),n.twoColumn){N+=1;const d=`Section${N}`;j.push(`<div style="mso-element:header" id="h${N}"><p class=MsoHeader style="text-align:center"><i>${ee(_(t[t.length-1]))}</i></p></div>`),f.push(`</div><div class="${d}"></div>`)}else f.push("</div>");const i=n.twoColumn?"columns:2;column-gap:24px;":"";let p=`@page SectionFront { mso-header-margin:0.5in; ${i} } div.SectionFront { ${n.twoColumn?"-webkit-column-count:2;column-count:2;column-gap:24px;":""} }`;for(let d=1;d<=N;d++)p+=`@page Section${d} { mso-title-page:yes; mso-header: url("#h${d}") h${d}; mso-header-margin:0.5in; ${i} } div.Section${d} { ${n.twoColumn?"-webkit-column-count:2;column-count:2;column-gap:24px;":""} }`;const O=`${f.join(`
2`)}
3${j.join(`
4`)}`,m=ye(n.font).css,M=`<!DOCTYPE html><html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="utf-8"><title>KJB</title><style>${p} p.MsoHeader{margin:0;}</style></head><body style="font-family:${m};font-size:11pt;">${O}</body></html>`;
4$=new Blob(["\uFEFF",M],{type:"application/msword"}),D=Ee(n,"doc")}else $=new Blob(["\uFEFF",f.join(`\r
5`)],{type:"text/plain;charset=utf-8"}),D=Ee(n,"txt");await $e($,D)}function ie(n=""){let s="";for(const r of String(n)){const u=r.codePointAt(0);r==="\\"||r==="{"||r==="}"?s+="\\"+r:u===182?s+="\\u182?":u>127?s+=`\\u${u>32767?u-65536:u}?`:s+=r}return s}function ge(n){let s=Ne(n);return s=s.replace(/(\w)[\u00B6\uFFFD](\w)/g,"$1'$2"),s=s.replace(/[\u00B6\uFFFD]\s*/g,"¶ "),s=s.replace(/\]\s*\[/g," "),s.split(/\[([^\]]+)\]/g).map((u,R)=>R%2===1?`{\\i ${ie(u)}}`:ie(u)).join("")}async function ke(n,s,r){const{twoColumn:u,paragraph:R,subscripts:k,colophons:Y,shortNames:V,scope:y="whole",coverPage:W=!0,toc:P=!0}=n,J=b=>V?b.shortName:b.name,_=y==="old"?ne.filter(b=>b.testament==="old"):y==="new"?ne.filter(b=>b.testament==="new"):ne,t=[],c=(b,{center:H=!1,bold:X=!1,size:$=22,sb:D=0,sa:i=80,keepNext:p=!1}={})=>t.push(`{\\pard${H?"\\qc":"\\ql"}${p?"\\keepn":""}\\sb${D}\\sa${i}\\fs${$}${X?"\\b":""} ${b}${X?"\\b0":""}\\par}`),E=(b=200)=>t.push(`{\\pard\\sa${b}\\par}`),f=b=>`\\titlepg{\\headerf \\pard\\par}{\\header \\pard\\qc\\fs18\\i ${ie(b)}\\i0\\par}`;if((W||P)&&t.push("\\sectdFRONT "),W&&(E(1800),(y==="new"?ue:Fe).forEach((b,H)=>c(ie(b.t),{center:!0,bold:!!b.bold,size:H===1?64:26,sb:H===1?120:60,sa:H===1?200:120})),P&&t.push("\\page ")),P){c("CONTENTS",{center:!0,bold:!0,size:34,sa:240});const b=y==="new"?"new":"old",H=i=>t.push(`{\\pard\\fi-180\\li360\\sa40\\fs20 \\bullet\\tab ${ie(i)}\\par}`),X=(i,p)=>t.push(`{\\pard\\fi-240\\li360\\sa40\\fs20 ${p}.\\tab ${ie(i)}\\par}`);let $=null,D=1;_.forEach(i=>{i.testament!==$&&($=i.testament,W&&i.testament===b&&H("Cover Page"),c(i.testament==="old"?"THE OLD TESTAMENT":"THE NEW TESTAMENT",{bold:!0,size:26,sb:160,sa:80})),X(J(i),D++)})}const j=_.length;for(let b=0;b<j;b++){const H=_[b],X=s[H.apiName]||{};W&&H.apiName==="Matthew"&&y==="whole"&&(t.push("\\sect \\sectdFRONT\\titlepg{\\headerf \\pard\\par}{\\header \\pard\\par} "),E(1800),ue.forEach(($,D)=>c(ie($.t),{center:!0,bold:!!$.bold,size:D===1?56:24,sb:D===1?120:60,sa:D===1?200:120}))),t.push("\\sect "),t.push(`\\sectd\\headery720 ${f(J(H))}`),c(ie(J(H)),{center:!0,bold:!0,size:32,sb:120,sa:160});for(let $=1;$<=H.chapters;$++){let D=X[$]||[];if(!D.length)continue;const i=H.apiName==="Malachi"&&$===H.chapters,p=H.apiName==="Revelation"&&$===H.chapters;if(i||p){const m=D[D.length-1];D=[...D.slice(0,-1),{...m,text:Oe(m.text)}]}if(c(`Chapter ${$}`,{center:!0,bold:!0,size:22,sb:240,sa:120}),k){const m=Se[`${H.apiName}:${$}`];m&&c(`\\i0\\u182? ${ge(m).replace(/^\\u182\?\s*/,"")}`,{center:!0,size:18})}const O=(m,M)=>{m.heading&&c(ie(m.heading),{center:!0,bold:!0,size:20,sb:M?80:160,sa:80})};if(R){let m="",M=0,d=!1;const z=()=>{m.trim()&&c(m.trim(),{sb:M,keepNext:d}),m="",M=0,d=!1};D.forEach((q,te)=>{q.heading?(z(),O(q,te===0)):te>0&&de(q.text)&&(z(),M=120,d=!0),m+=`{\\b ${q.verse}} ${ge(q.text)}  `}),z()}else D.forEach((m,M)=>{if(m.heading){O(m,M===0),c(`{\\b ${m.verse}} ${ge(m.text)}`);return}const d=M>0&&de(m.text),z=d?120:0;c(`{\\b ${m.verse}} ${ge(m.text)}`,{sb:z,keepNext:d})});if(Y){const m=we[`${H.apiName}:${$}`];m&&c(`\\i0\\u182? ${ge(m).replace(/^\\u182\?\s*/,"")}`,{center:!0,size:18})}}H.apiName==="Malachi"&&c(y==="old"?"THE END.":"THE END OF THE PROPHETS.",{center:!0,bold:!0,size:24}),H.apiName==="Revelation"&&c("THE END.",{center:!0,bold:!0,size:26}),u&&t.push("\\sect \\sectd\\sbknone\\BALANCECOLS "),r(Math.round((b+1)/j*90)+5,`Adding ${H.shortName}… (${b+1}/${j})`),await new Promise($=>setTimeout($,0))}r(98,"Saving file…");const N=u?"\\cols2\\colsx360":"",l=t.join(`
6`).replace(/\\sectdFRONT/g,"\0FRONT\0").replace(/\\BALANCECOLS/g,N).replace(/\\sectd/g,`\\sectd${N}`).replace(/\u0000FRONT\u0000/g,"\\sectd"),oe=`{\\rtf1\\ansi\\deff0\\fet0{\\fonttbl{\\f0 ${ye(n.font).rtf};}}\\f0\\fs20 ${l}}`;await $e(new Blob([oe],{type:"application/rtf"}),Ee(n,"rtf"))}function Ee(n,s){const r=n.scope==="old"?"OldTestament":n.scope==="new"?"NewTestament":"Bible",u=n.twoColumn?"2col":"1col",R=n.paragraph?"paragraph":"line",k=n.shortNames?"short-names":"full-names",Y=[n.subscripts?"subscripts":null,n.colophons?"colophons":null].filter(
6Boolean).join("-");return`KJB-${r}-${u}-${R}-${k}${Y?"-"+Y:""}.${s}`}async function Ge(n,s=()=>{}){s(2,"Loading Bible text…");const r=await Be(),u=n.format||"pdf";u==="pdf"?await Ie(n,r,s):u==="rtf"?await ke(n,r,s):await xe(n,r,s,u),s(100,"Done!")}export{qe as D,Ge as e,de as h,Oe as s,be as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.