1import{parseSqliteToTables as c}from"./sqliteParser-D406xhIa.js";import{stripExtension as f,replaceExtension as h,formatCount as b,previewFrom as g,textBlob as p}from"./util-CkZ8KZK2.js";import{outputDelimiterFrom as w,serializeTable as d}from"./csvShared-8k83eY5V.js";import{ndjsonToTable as v}from"./jsonFlatten-BvwKgkrC.js";import"./vite-preload-ckwbz45p.js";import"./vendor-papaparse-Btpkh8vH.js";import"./cjs-helpers-D6-XlEtG.js";import"./detectTableRegion-B60ufQHb.js";import"./jsonRelaxed-DdfPn7XG.js";function x(e,t){const n=e[0];if(!t||t===n.name)return{table:n};const o=e.find(r=>r.name===t);return o?{table:o}:{table:n,warning:`The table "${t}" has no rows, so "${n.name}" was converted instead.`}}const S=async e=>{if(!e.file)throw new Error("Pick a SQLite database file to convert.");e.ctx.onProgress("Opening the databaseâ¦");const t=await c(e.file);if(t.length===0)throw new Error("Every table in that database is empty, so there is nothing to convert.");const{table:n,warning:o}=x(t,e.sheet);e.ctx.onProgress(`Converting "${n.name}"â¦`);const{columns:r,rows:s,warnings:i}=v(n.jsonl),a=w(e.options),m=d(r,s,a.char);return o&&i.unshift(o),{status:"ok",output:{filename:t.length>1?`${f(e.filename)||"data"}-${n.name}.${a.extension}`:h(e.filename,a.extension),blob:p(m,a.extension==="tsv"?"text/tab-separated-values":"text/csv"),text:m,copyKind:"csv",preview:g(r,s,20),summary:[`${b(s.length)} row${s.length===1?"":"s"}`,`from "${n.name}"`],warnings:[...a.warnings,...i],...t.length>1?{discovered:{kind:"sheets",sheets:t.map(l=>l.name),selected:n.name}}:{}}}};export{x as chooseTable,S as default};
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.