diff --git a/assets/index-80a16350.js b/assets/index-95a3f757.js similarity index 98% rename from assets/index-80a16350.js rename to assets/index-95a3f757.js index fc180a1..d0c3142 100644 --- a/assets/index-80a16350.js +++ b/assets/index-95a3f757.js @@ -72,4 +72,4 @@ Error generating stack: `+o.message+` */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",i=0;i{var i;const o=(i=l.target.files)==null?void 0:i.item(0);if((o==null?void 0:o.type)==="text/plain"){const a=new FileReader;a.readAsText(o),n(o.name),a.onload=()=>{e(a.result)}}}}}function Vg(e){const{fileName:t,handleFileChange:n}=Hg(e.callback);return _.jsxs(_.Fragment,{children:[_.jsx("label",{htmlFor:"file-upload",className:"block text-gray-700 text-sm font-bold mb-2",children:"Text"}),_.jsxs("div",{className:"relative mb-3",children:[_.jsx("input",{id:"file-upload",type:"file",onChange:n,accept:".txt",className:"opacity-0 absolute z-0 w-full h-full",required:e.useFileUpload}),_.jsxs("div",{className:"bg-white rounded-md border border-gray-400 px-4 py-2 flex items-center justify-between",children:[_.jsx("span",{className:"text-gray-700",children:t||"Choose a file"}),_.jsx("button",{type:"button",className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline hover:cursor-pointer",children:"Browse"})]})]})]})}const up="/Text2Book/assets/loader-025122ea.svg";function sp(e){return _.jsxs(_.Fragment,{children:[_.jsx("label",{htmlFor:e.id,className:"block text-gray-700 text-sm font-bold mb-2",children:"Text"}),_.jsx("textarea",{id:e.id,placeholder:e.placeholder,className:"w-full min-h-[58px] h-72 border rounded-md py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:ring focus:border-blue-300",value:e.value,onChange:t=>e.setter(t.target.value),required:e.required})]})}function Wg(e){const t=()=>e.loading?_.jsx("div",{className:"flex justify-center text-white",children:_.jsx("img",{className:"h-5 w-5 mr-3",src:up})}):"Generate";return _.jsxs("form",{onSubmit:e.handleSubmit,children:[_.jsxs("div",{className:lo("flex flex-wrap mb-4",{hidden:e.outputFormat==="text"}),children:[_.jsx("div",{className:"w-full sm:w-1/2 px-2",children:_.jsx(Aa,{label:"Author",id:"author",placeholder:"Lewis Carroll",value:e.author,setter:e.setAuthor,maxLength:50,required:e.outputFormat==="commands"})}),_.jsx("div",{className:"w-full sm:w-1/2 px-2",children:_.jsx(Aa,{label:"Title",id:"title",placeholder:"Alice in Wonderland",value:e.title,setter:e.setTitle,maxLength:15,required:e.outputFormat==="commands"})})]}),_.jsxs("div",{className:"mb-4",children:[_.jsx("div",{className:lo({hidden:e.inputFormat==="text"}),children:_.jsx(Vg,{label:"Text",callback:n=>e.setText(n),useFileUpload:e.inputFormat==="file"})}),_.jsx("div",{className:lo({hidden:e.inputFormat==="file"}),children:_.jsx(sp,{label:"Text",id:"text",placeholder:"Once upon a time, there was a girl...",value:e.text,setter:e.setText,required:e.inputFormat==="text"})})]}),_.jsx("button",{type:"submit",className:"w-full h-10 bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline",children:_.jsx(t,{})})]})}function Qg(e){const{inputFormat:t,setInputFormat:n,outputFormat:r,setOutputFormat:l,text:o,setText:i,appendIndex:a,setAppendIndex:u,appendIndexFormat:s,setAppendIndexFormat:c,author:m,setAuthor:p,title:g,setTitle:x,loading:S,handleSubmit:E}=ip(e.showResults);return _.jsxs(_.Fragment,{children:[_.jsx($g,{inputFormat:t,setInputFormat:n,outputFormat:r,setOutputFormat:l,appendIndex:a,setAppendIndex:u,appendIndexFormat:s,setAppendIndexFormat:c}),_.jsx("hr",{className:"mb-4 mt-4"}),_.jsx(Wg,{inputFormat:t,setInputFormat:n,outputFormat:r,setOutputFormat:l,text:o,setText:i,author:m,setAuthor:p,title:g,setTitle:x,loading:S,handleSubmit:E})]})}const Kg="/Text2Book/assets/copy-icon-c3cc64a5.png",Yg="_blink_6oukz_1",Tc={blink:Yg};function Gg(e){const[t,n]=R.useState(0),[r,l]=R.useState([]),o={blink:t};R.useEffect(()=>{m()},[e]);const i=(p,g,x)=>{ce("Copied!",{className:"font-bold text-green-600"});const S=p.target.closest(".listitem");S&&S.classList.remove("noblink"),u(g),n(1),navigator.clipboard.writeText(x)},a=p=>{n(0);const g=p.target.closest(".listitem");g&&g.classList.add("noblink")},u=p=>l([...r,p]),s=p=>l(g=>g.filter(x=>x!==p)),c=p=>r.includes(p),m=()=>l([]);return{blinkProps:o,onAnimationEnd:a,copyAndNotify:i,addCopiedRow:u,removeCopiedRow:s,checkRowIsCopied:c,clearCheckedRows:m}}function Xg(e){const{onAnimationEnd:t,copyAndNotify:n,blinkProps:r,removeCopiedRow:l,checkRowIsCopied:o}=Gg(e.results);return e.results.map((i,a)=>_.jsxs("li",{className:`flex rounded border overflow-hidden h-12 mb-1 listitem noblink ${Tc.blink} ${Tc.noblink}`,...r,onAnimationEnd:t,children:[_.jsx("button",{onClick:u=>n(u,a,i),className:"w-12 bg-gray-300 h-full p-2 border-right group",children:_.jsx("img",{className:"p-1 group-hover:opacity-70 transition",src:Kg})}),_.jsx("input",{className:"w-full p-2 opacity-80 font-mono h-full outline-none",type:"text",value:i,readOnly:!0}),_.jsx("div",{className:"text-xl p-2 bg-gray-300 select-none",children:a+1}),o(a)&&_.jsx("div",{className:"text-xl p-2 bg-green-300 hover:bg-red-300 select-none cursor-pointer",onClick:()=>l(a),children:"✓"})]},a))}class h{constructor(t,n){li(this,"_char");li(this,"_dots");this._char=t,this._dots=n}set letter(t){this._char=t}get letter(){return this._char}set dots(t){this._dots=t}get dots(){return this._dots}}function Jg(){return[new h("À",6),new h("Á",6),new h("Â",6),new h("È",6),new h("Ê",6),new h("Ë",6),new h("Í",4),new h("Ó",6),new h("Ô",6),new h("Õ",6),new h("Ú",6),new h("ß",6),new h("ã",6),new h("õ",6),new h("ğ",6),new h("İ",4),new h("ı",4),new h("Œ",6),new h("œ",7),new h("Ş",6),new h("ş",6),new h("Ŵ",6),new h("ŵ",6),new h("ž",6),new h("ȇ",6),new h("!",2),new h('"',5),new h("#",6),new h("$",6),new h("%",6),new h("&",6),new h("'",3),new h("(",5),new h(")",5),new h("*",5),new h("+",6),new h(",",2),new h("-",6),new h(".",2),new h("/",6),new h("0",6),new h("1",6),new h("2",6),new h("3",6),new h("4",6),new h("5",6),new h("6",6),new h("7",6),new h("8",6),new h("9",6),new h(":",2),new h(";",2),new h("<",5),new h("=",6),new h(">",5),new h("?",6),new h("@",7),new h("A",6),new h("B",6),new h("C",6),new h("D",6),new h("E",6),new h("F",6),new h("G",6),new h("H",6),new h("I",4),new h("J",6),new h("K",6),new h("L",6),new h("M",6),new h("N",6),new h("O",6),new h("P",6),new h("Q",6),new h("R",6),new h("S",6),new h("T",6),new h("U",6),new h("V",6),new h("W",6),new h("X",6),new h("Y",6),new h("Z",6),new h("[",4),new h("]",4),new h("^",6),new h("_",6),new h("`",3),new h("a",6),new h("b",6),new h("c",6),new h("d",6),new h("e",6),new h("f",5),new h("g",6),new h("h",6),new h("i",2),new h("j",6),new h("k",5),new h("l",3),new h("m",6),new h("n",6),new h("o",6),new h("p",6),new h("q",6),new h("r",6),new h("s",6),new h("t",4),new h("u",6),new h("v",6),new h("w",6),new h("x",6),new h("y",6),new h("z",6),new h("‘",3),new h("’",3),new h("{",5),new h("|",2),new h("}",5),new h("~",7),new h("–",7),new h("Ç",6),new h("ü",6),new h("é",6),new h("â",6),new h("ä",6),new h("à",6),new h("å",6),new h("ç",6),new h("ê",6),new h("ë",6),new h("è",6),new h("ï",4),new h("î",6),new h("ì",3),new h("Ä",6),new h("Å",6),new h("É",6),new h("æ",6),new h("Æ",6),new h("ô",6),new h("ö",6),new h("ò",6),new h("û",6),new h("ù",6),new h("ÿ",6),new h("Ö",6),new h("Ü",6),new h("ø",6),new h("£",6),new h("Ø",6),new h("×",4),new h("ƒ",6),new h("á",6),new h("í",3),new h("ó",6),new h("ú",6),new h("ñ",6),new h("Ñ",6),new h("ª",6),new h("º",6),new h("¿",6),new h("®",7),new h("¬",6),new h("½",6),new h("¼",6),new h("¡",2),new h("«",6),new h("»",6),new h("░",8),new h("▒",9),new h("▓",9),new h("│",6),new h("┤",6),new h("╡",6),new h("╢",8),new h("╖",8),new h("╕",6),new h("╣",8),new h("║",8),new h("╗",8),new h("╝",8),new h("╜",8),new h("╛",6),new h("┐",6),new h("└",9),new h("┴",9),new h("┬",9),new h("├",9),new h("─",9),new h("┼",9),new h("╞",9),new h("╟",9),new h("╚",9),new h("╔",9),new h("╩",9),new h("╦",9),new h("╠",9),new h("═",9),new h("╬",9),new h("╧",9),new h("╨",9),new h("╤",9),new h("╥",9),new h("╙",9),new h("╘",9),new h("╒",9),new h("╓",9),new h("╫",9),new h("╪",9),new h("┘",6),new h("┌",9),new h("█",9),new h("▄",9),new h("▌",5),new h("▐",9),new h("▀",9),new h("α",8),new h("β",7),new h("Γ",7),new h("π",8),new h("Σ",7),new h("σ",8),new h("μ",8),new h("τ",8),new h("Φ",7),new h("Θ",8),new h("Ω",8),new h("δ",7),new h("∞",9),new h("∅",9),new h("∈",6),new h("∩",7),new h("≡",7),new h("±",7),new h("≥",7),new h("≤",7),new h("⌠",9),new h("⌡",6),new h("÷",7),new h("≈",8),new h("°",7),new h("∙",6),new h("·",6),new h("√",9),new h("ⁿ",7),new h("²",6),new h("■",7),new h(" ",4),new h(` `,0)]}function Zg(e,t,n){let r="",l=0;const o=()=>r.replace(/"/g,'\\\\"').replace(/'/g,"\\'").trim().replace(/\n/g,"\\\\n"),i=e.map(u=>{if(r+=u,l++,l==14){r=o();const s=`'{"text":"${r}"}'`;return r="",l=0,s}else return null}).filter(u=>u!==null);if(r.length>0){r=o();const u=`'{"text":"${r}"}'`;i.push(u)}const a={id:"minecraft:written_book",author:t,title:n,pages:i};return`/give @p ${a.id}{pages:[${a.pages.toString()}], title: "${a.title}", author: "${a.author}"}`}function qg(e,t,n,r,l){const o=[],i=[...e];let a=0,u=0;for(let s=0;s<=e.length;s++)if(a++,a==1400||s==e.length){const c={lines:i.splice(0,a),author:t,title:(()=>{const p=n,g=r?l?l.replace("n",u.toString()):" [n]".replace("n",u.toString()):"";return`${p}${g}`})()},m=Zg(c.lines,c.author,c.title);a=0,u++,o.push(m)}return o}function bg(e){let t="",n=0;const r=e.map(l=>{if(t+=l,n++,n==14){t=t.trim();const o=t;return t="",n=0,o}else return null}).filter(l=>l!==null);if(t.length>0){t=t.trim();const l=t;r.push(l)}return r.toString()}function e0(e){const t=[],n=[...e];let r=0;for(let l=0;l<=e.length;l++)if(r++,r==14||l==e.length){const o={lines:n.splice(0,r)},i=bg(o.lines);r=0,t.push(i)}return t.filter(l=>l!="")}function t0(e,t,n,r,l,o){const i=r0(e);return r==="text"?e0(i):qg(i,t,n,l,o)}function n0(e){const t=[],n=Jg(),r=114;let l=0,o="";for(let i=0;iu.letter==e.charAt(i));if(!a){e=e.substring(0,i)+e.substring(i+1),i--;continue}l+=a.dots,o=e.substring(0,i+1),l>r&&(o=o.substring(0,o.length-1),t.push({word:o,value:l}),e=e.substring(i),l=0,i=-1)}return t.push({word:e,value:l}),t}function r0(e){let t=[],n=[],r=0;const l=[],o=e.replace(/ +\n/g,` `).split(/(\s)/g);for(let i=0;i114)&&(r=n[a].value,l.push(t.join("")),t=[]),t.push(n[a].word)}return l.push(t.join("").trim()),l.filter(i=>i!="")}function cp(){const[e,t]=R.useState([]),[n,r]=R.useState(0);return{results:e,allowedProps:{fadein:n},showResults:(i,a,u,s,c,m)=>{t(t0(i,a,u,s,c,m)),r(1)},setFadeIn:r}}function l0(){const{results:e,showResults:t,allowedProps:n,setFadeIn:r}=cp();return _.jsxs(_.Fragment,{children:[_.jsx(Qg,{showResults:t}),_.jsx("div",{className:"mt-3",children:_.jsx("ol",{className:`list-decimal ${Mg.fadein}`,onAnimationEnd:()=>r(0),...n,children:_.jsx(Xg,{results:e})})})]})}function o0(e){const t=()=>e.loading?_.jsx("div",{className:"flex justify-center text-white",children:_.jsx("img",{className:"h-5 w-5 mr-3",src:up})}):"Generate";return _.jsxs("form",{onSubmit:e.handleSubmit,children:[_.jsx("div",{className:"mb-4",children:_.jsx("div",{className:lo({hidden:e.inputFormat==="file"}),children:_.jsx(sp,{label:"Text",id:"text",placeholder:"Once upon a time, there was a girl...",value:e.text,setter:e.setText,required:e.inputFormat==="text"})})}),_.jsx("button",{type:"submit",className:"w-full h-10 bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline",children:_.jsx(t,{})})]})}function i0(e){const{text:t,setText:n,setOutputFormat:r,loading:l,handleSubmit:o}=ip(e.showResults);return r("text"),_.jsx(_.Fragment,{children:_.jsx(o0,{inputFormat:"text",text:t,setText:n,loading:l,handleSubmit:o})})}var dp={exports:{}};(function(e,t){(function(n,r){r()})(yn,function(){function n(s,c){return typeof c>"u"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(s.type)?new Blob(["\uFEFF",s],{type:s.type}):s}function r(s,c,m){var p=new XMLHttpRequest;p.open("GET",s),p.responseType="blob",p.onload=function(){u(p.response,c,m)},p.onerror=function(){console.error("could not download file")},p.send()}function l(s){var c=new XMLHttpRequest;c.open("HEAD",s,!1);try{c.send()}catch{}return 200<=c.status&&299>=c.status}function o(s){try{s.dispatchEvent(new MouseEvent("click"))}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),s.dispatchEvent(c)}}var i=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof yn=="object"&&yn.global===yn?yn:void 0,a=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),u=i.saveAs||(typeof window!="object"||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(s,c,m){var p=i.URL||i.webkitURL,g=document.createElement("a");c=c||s.name||"download",g.download=c,g.rel="noopener",typeof s=="string"?(g.href=s,g.origin===location.origin?o(g):l(g.href)?r(s,c,m):o(g,g.target="_blank")):(g.href=p.createObjectURL(s),setTimeout(function(){p.revokeObjectURL(g.href)},4e4),setTimeout(function(){o(g)},0))}:"msSaveOrOpenBlob"in navigator?function(s,c,m){if(c=c||s.name||"download",typeof s!="string")navigator.msSaveOrOpenBlob(n(s,m),c);else if(l(s))r(s,c,m);else{var p=document.createElement("a");p.href=s,p.target="_blank",setTimeout(function(){o(p)})}}:function(s,c,m,p){if(p=p||open("","_blank"),p&&(p.document.title=p.document.body.innerText="downloading..."),typeof s=="string")return r(s,c,m);var g=s.type==="application/octet-stream",x=/constructor/i.test(i.HTMLElement)||i.safari,S=/CriOS\/[\d]+/.test(navigator.userAgent);if((S||g&&x||a)&&typeof FileReader<"u"){var E=new FileReader;E.onloadend=function(){var v=E.result;v=S?v:v.replace(/^data:[^;]*;/,"data:attachment/file;"),p?p.location.href=v:location=v,p=null},E.readAsDataURL(s)}else{var d=i.URL||i.webkitURL,f=d.createObjectURL(s);p?p.location=f:location.href=f,p=null,setTimeout(function(){d.revokeObjectURL(f)},4e4)}});i.saveAs=u.saveAs=u,e.exports=u})})(dp);var a0=dp.exports;function u0(e){R.useEffect(()=>{const t=new Blob([new TextEncoder().encode(JSON.stringify(e))],{type:"application/json;charset=utf-8"});e.length>0&&a0.saveAs(t,"text2book.json")},[JSON.stringify(e)])}function s0(){const{results:e,showResults:t}=cp();return u0(e),_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"text-red-600 bg-gray-200 rounded mb-2 p-2",children:['OBS: This is a debugging page used for validating the output of this app. Clicking the "Generate" button will download a JSON file which is used as an input parameter when running tests. For more info, please have a look at the'," ",_.jsx("a",{href:"https://github.com/TheWilley/Text2Book/blob/master/test/testing.md",className:"underline",children:"testing methodology"})," ","or"," ",_.jsx("a",{href:"https://thewilley.github.io/Text2Book",className:"underline",children:"go home again"}),"."]}),_.jsx(i0,{showResults:t})]})}const c0=()=>_.jsx("div",{className:"flex h-[calc(100vh-4rem)] items-center justify-center",children:_.jsxs("div",{children:[_.jsx("h1",{className:"text-3xl",children:" 404 - This page does not exist"}),_.jsxs("div",{className:"text-md mt-2",children:["Were you looking for the"," ",_.jsx("a",{href:"/",className:"underline text-blue-500",children:"home"})," ","or"," ",_.jsx("a",{href:"/#debug",className:"underline text-blue-500",children:"debug"})," ","page?"]})]})}),d0=pg(Ma(_.jsxs(no,{path:"/",element:_.jsx(Dg,{}),errorElement:_.jsx(c0,{}),children:[_.jsx(no,{index:!0,element:_.jsx(l0,{})}),_.jsx(no,{path:"/debug",element:_.jsx(s0,{})})]})));function f0(){return _.jsx(Eg,{router:d0})}Ii.createRoot(document.getElementById("root")).render(_.jsx(ne.StrictMode,{children:_.jsx(f0,{})})); +`||n[a].word!=" "&&r>114)&&(r=n[a].value,l.push(t.join("")),t=[]),t.push(n[a].word)}return l.push(t.join("").trim()),l.filter(i=>i!="")}function cp(){const[e,t]=R.useState([]),[n,r]=R.useState(0);return{results:e,allowedProps:{fadein:n},showResults:(i,a,u,s,c,m)=>{t(t0(i,a,u,s,c,m)),r(1)},setFadeIn:r}}function l0(){const{results:e,showResults:t,allowedProps:n,setFadeIn:r}=cp();return _.jsxs(_.Fragment,{children:[_.jsx(Qg,{showResults:t}),_.jsx("div",{className:"mt-3",children:_.jsx("ol",{className:`list-decimal ${Mg.fadein}`,onAnimationEnd:()=>r(0),...n,children:_.jsx(Xg,{results:e})})})]})}function o0(e){const t=()=>e.loading?_.jsx("div",{className:"flex justify-center text-white",children:_.jsx("img",{className:"h-5 w-5 mr-3",src:up})}):"Generate";return _.jsxs("form",{onSubmit:e.handleSubmit,children:[_.jsx("div",{className:"mb-4",children:_.jsx("div",{className:lo({hidden:e.inputFormat==="file"}),children:_.jsx(sp,{label:"Text",id:"text",placeholder:"Once upon a time, there was a girl...",value:e.text,setter:e.setText,required:e.inputFormat==="text"})})}),_.jsx("button",{type:"submit",className:"w-full h-10 bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline",children:_.jsx(t,{})})]})}function i0(e){const{text:t,setText:n,setOutputFormat:r,loading:l,handleSubmit:o}=ip(e.showResults);return R.useEffect(()=>{r("text")},[]),_.jsx(_.Fragment,{children:_.jsx(o0,{inputFormat:"text",text:t,setText:n,loading:l,handleSubmit:o})})}var dp={exports:{}};(function(e,t){(function(n,r){r()})(yn,function(){function n(s,c){return typeof c>"u"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(s.type)?new Blob(["\uFEFF",s],{type:s.type}):s}function r(s,c,m){var p=new XMLHttpRequest;p.open("GET",s),p.responseType="blob",p.onload=function(){u(p.response,c,m)},p.onerror=function(){console.error("could not download file")},p.send()}function l(s){var c=new XMLHttpRequest;c.open("HEAD",s,!1);try{c.send()}catch{}return 200<=c.status&&299>=c.status}function o(s){try{s.dispatchEvent(new MouseEvent("click"))}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),s.dispatchEvent(c)}}var i=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof yn=="object"&&yn.global===yn?yn:void 0,a=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),u=i.saveAs||(typeof window!="object"||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(s,c,m){var p=i.URL||i.webkitURL,g=document.createElement("a");c=c||s.name||"download",g.download=c,g.rel="noopener",typeof s=="string"?(g.href=s,g.origin===location.origin?o(g):l(g.href)?r(s,c,m):o(g,g.target="_blank")):(g.href=p.createObjectURL(s),setTimeout(function(){p.revokeObjectURL(g.href)},4e4),setTimeout(function(){o(g)},0))}:"msSaveOrOpenBlob"in navigator?function(s,c,m){if(c=c||s.name||"download",typeof s!="string")navigator.msSaveOrOpenBlob(n(s,m),c);else if(l(s))r(s,c,m);else{var p=document.createElement("a");p.href=s,p.target="_blank",setTimeout(function(){o(p)})}}:function(s,c,m,p){if(p=p||open("","_blank"),p&&(p.document.title=p.document.body.innerText="downloading..."),typeof s=="string")return r(s,c,m);var g=s.type==="application/octet-stream",x=/constructor/i.test(i.HTMLElement)||i.safari,S=/CriOS\/[\d]+/.test(navigator.userAgent);if((S||g&&x||a)&&typeof FileReader<"u"){var E=new FileReader;E.onloadend=function(){var v=E.result;v=S?v:v.replace(/^data:[^;]*;/,"data:attachment/file;"),p?p.location.href=v:location=v,p=null},E.readAsDataURL(s)}else{var d=i.URL||i.webkitURL,f=d.createObjectURL(s);p?p.location=f:location.href=f,p=null,setTimeout(function(){d.revokeObjectURL(f)},4e4)}});i.saveAs=u.saveAs=u,e.exports=u})})(dp);var a0=dp.exports;function u0(e){R.useEffect(()=>{const t=new Blob([new TextEncoder().encode(JSON.stringify(e))],{type:"application/json;charset=utf-8"});e.length>0&&a0.saveAs(t,"text2book.json")},[JSON.stringify(e)])}function s0(){const{results:e,showResults:t}=cp();return u0(e),_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"text-red-600 bg-gray-200 rounded mb-2 p-2",children:['OBS: This is a debugging page used for validating the output of this app. Clicking the "Generate" button will download a JSON file which is used as an input parameter when running tests. For more info, please have a look at the'," ",_.jsx("a",{href:"https://github.com/TheWilley/Text2Book/blob/master/test/testing.md",className:"underline",children:"testing methodology"})," ","or"," ",_.jsx("a",{href:"https://thewilley.github.io/Text2Book",className:"underline",children:"go home again"}),"."]}),_.jsx(i0,{showResults:t})]})}const c0=()=>_.jsx("div",{className:"flex h-[calc(100vh-4rem)] items-center justify-center",children:_.jsxs("div",{children:[_.jsx("h1",{className:"text-3xl",children:" 404 - This page does not exist"}),_.jsxs("div",{className:"text-md mt-2",children:["Were you looking for the"," ",_.jsx("a",{href:"/",className:"underline text-blue-500",children:"home"})," ","or"," ",_.jsx("a",{href:"/#debug",className:"underline text-blue-500",children:"debug"})," ","page?"]})]})}),d0=pg(Ma(_.jsxs(no,{path:"/",element:_.jsx(Dg,{}),errorElement:_.jsx(c0,{}),children:[_.jsx(no,{index:!0,element:_.jsx(l0,{})}),_.jsx(no,{path:"/debug",element:_.jsx(s0,{})})]})));function f0(){return _.jsx(Eg,{router:d0})}Ii.createRoot(document.getElementById("root")).render(_.jsx(ne.StrictMode,{children:_.jsx(f0,{})})); diff --git a/index.html b/index.html index dc01a10..3f9cfdf 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Text2Book - +