@pretextbook/import 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ "use strict";const h=require("./upload-BnRj1gU1.cjs");function d(e,t){const n=e.length===0?[]:e.split(`
2
+ `),o=t.length===0?[]:t.split(`
3
+ `);if(n.length+o.length>j)return[...n.map((c,f)=>({op:"remove",text:c,beforeLine:f+1})),...o.map((c,f)=>({op:"add",text:c,afterLine:f+1}))];const r=Array.from({length:n.length+1},()=>new Array(o.length+1).fill(0));for(let c=n.length-1;c>=0;c--)for(let f=o.length-1;f>=0;f--)r[c][f]=n[c]===o[f]?r[c+1][f+1]+1:Math.max(r[c+1][f],r[c][f+1]);const a=[];let i=0,s=0;for(;i<n.length&&s<o.length;)n[i]===o[s]?(a.push({op:"keep",text:n[i],beforeLine:i+1,afterLine:s+1}),i++,s++):r[i+1][s]>=r[i][s+1]?(a.push({op:"remove",text:n[i],beforeLine:i+1}),i++):(a.push({op:"add",text:o[s],afterLine:s+1}),s++);for(;i<n.length;)a.push({op:"remove",text:n[i],beforeLine:++i});for(;s<o.length;)a.push({op:"add",text:o[s],afterLine:++s});return a}const j=2e4;function m(e){let t=0,n=0;for(const o of e)o.op==="add"?t++:o.op==="remove"&&n++;return{added:t,removed:n}}function g(e,t=2){const n=e.map((i,s)=>i.op==="keep"?-1:s).filter(i=>i>=0);if(n.length===0)return[];const o=[];let r=Math.max(0,n[0]-t),a=Math.min(e.length-1,n[0]+t);for(const i of n.slice(1)){if(i-t<=a+1){a=Math.min(e.length-1,i+t);continue}o.push({lines:e.slice(r,a+1)}),r=Math.max(0,i-t),a=Math.min(e.length-1,i+t)}return o.push({lines:e.slice(r,a+1)}),o}function k(e,t=e.splitLevel){if(e.cleanChunks.length===0)return[];const n=h.mergeChunksAtLevel(e.cleanChunks,t),o=A(n),{pathByRef:r}=h.serializeProjectToFiles(e.project,{mainSourcePath:e.projectLayout.mainSourcePath,publicationPath:e.projectLayout.publicationPath,projectFilePath:e.projectLayout.projectFilePath,includeScaffold:!e.projectLayout.preserved}),a=[];for(const i of e.project.divisions){const s=r[i.xmlId];if(!s)continue;const c=i.isRoot?n.find(p=>p.kind==="preamble"||p.kind==="lead"):o.get(i.title);if(!c)continue;const f=d(c.before,c.after);a.push({path:s,title:i.title,before:c.before,after:c.after,stats:m(f),hunks:g(f),fixCount:c.fixes.length})}return a.sort((i,s)=>i.path.localeCompare(s.path))}function A(e){const t=new Map;for(const o of e)o.kind!=="division"||!o.title||t.set(o.title,t.has(o.title)?null:o);const n=new Map;for(const[o,r]of t)r&&n.set(o,r);return n}const v="converted";function M(e){return e.nativeOutputFiles!==void 0}function C(e,t=v){return t==="native"&&!M(e)?"converted":t}function T(e,t){return t==="native"?e.nativeProject??e.project:e.project}function y(e,t){return t==="converted"?e.outputFiles:e.nativeOutputFiles??e.files}function P(e,t){return t==="converted"?e.outputAssets:e.assets}function S(e){const t=e.action==="replace"||e.action==="rewrite"?`replaced with \`${e.replacement}\``:e.message??e.action,n=e.occurrences>1?` (x${e.occurrences})`:"";return`[${e.severity}] ${e.macro}: ${t}${n}`}const E=[".tex",".md",".markdown",".ptx",".xml",".zip",".gz",".tar.gz",".tgz"];function l(e){return e.acceptExtensions??E}function F(e,t){const n=e.toLowerCase();return t.some(o=>n.endsWith(o))}function u(e,t){return F(t,l(e))}function L(e){const t=new Set,n=[];for(const o of e)for(const r of l(o))t.has(r)||(t.add(r),n.push(r));return n}function x(e){for(let t=1;t<e.length;t++){const n=e.slice(0,t);if(l(e[t]).some(r=>n.some(a=>l(a).includes(r))))return e[t]}}function I(e,t){return e.find(n=>u(n,t))}function b(e,t){const n=I(e,t),o=x(e);if(!(!n||!o||o.id===n.id))return u(o,t)?o:void 0}function _(e,t){return`Cannot import ${e}: no converter reads that file type. Supported types are ${L(t).join(", ")}.`}exports.DEFAULT_ACCEPT_EXTENSIONS=E;exports.DEFAULT_IMPORT_MODE=v;exports.allAcceptExtensions=L;exports.alternateEngine=x;exports.alternateFor=b;exports.assetsForImportMode=P;exports.diffHunks=g;exports.diffLines=d;exports.diffStats=m;exports.engineAccepts=u;exports.engineExtensions=l;exports.fileChangesForImport=k;exports.filesForImportMode=y;exports.formatWarningLine=S;exports.hasNativeImportMode=M;exports.matchesExtension=F;exports.projectForImportMode=T;exports.resolveImportMode=C;exports.routeEngine=I;exports.unsupportedFileMessage=_;
@@ -0,0 +1,179 @@
1
+ import { a1 as h, ak as d } from "./upload-H_OCZBBn.js";
2
+ function m(e, t) {
3
+ const n = e.length === 0 ? [] : e.split(`
4
+ `), o = t.length === 0 ? [] : t.split(`
5
+ `);
6
+ if (n.length + o.length > v)
7
+ return [
8
+ ...n.map(
9
+ (a, f) => ({ op: "remove", text: a, beforeLine: f + 1 })
10
+ ),
11
+ ...o.map((a, f) => ({ op: "add", text: a, afterLine: f + 1 }))
12
+ ];
13
+ const r = Array.from(
14
+ { length: n.length + 1 },
15
+ () => new Array(o.length + 1).fill(0)
16
+ );
17
+ for (let a = n.length - 1; a >= 0; a--)
18
+ for (let f = o.length - 1; f >= 0; f--)
19
+ r[a][f] = n[a] === o[f] ? r[a + 1][f + 1] + 1 : Math.max(r[a + 1][f], r[a][f + 1]);
20
+ const c = [];
21
+ let i = 0, s = 0;
22
+ for (; i < n.length && s < o.length; )
23
+ n[i] === o[s] ? (c.push({
24
+ op: "keep",
25
+ text: n[i],
26
+ beforeLine: i + 1,
27
+ afterLine: s + 1
28
+ }), i++, s++) : r[i + 1][s] >= r[i][s + 1] ? (c.push({ op: "remove", text: n[i], beforeLine: i + 1 }), i++) : (c.push({ op: "add", text: o[s], afterLine: s + 1 }), s++);
29
+ for (; i < n.length; )
30
+ c.push({ op: "remove", text: n[i], beforeLine: ++i });
31
+ for (; s < o.length; ) c.push({ op: "add", text: o[s], afterLine: ++s });
32
+ return c;
33
+ }
34
+ const v = 2e4;
35
+ function g(e) {
36
+ let t = 0, n = 0;
37
+ for (const o of e)
38
+ o.op === "add" ? t++ : o.op === "remove" && n++;
39
+ return { added: t, removed: n };
40
+ }
41
+ function L(e, t = 2) {
42
+ const n = e.map((i, s) => i.op === "keep" ? -1 : s).filter((i) => i >= 0);
43
+ if (n.length === 0) return [];
44
+ const o = [];
45
+ let r = Math.max(0, n[0] - t), c = Math.min(e.length - 1, n[0] + t);
46
+ for (const i of n.slice(1)) {
47
+ if (i - t <= c + 1) {
48
+ c = Math.min(e.length - 1, i + t);
49
+ continue;
50
+ }
51
+ o.push({ lines: e.slice(r, c + 1) }), r = Math.max(0, i - t), c = Math.min(e.length - 1, i + t);
52
+ }
53
+ return o.push({ lines: e.slice(r, c + 1) }), o;
54
+ }
55
+ function A(e, t = e.splitLevel) {
56
+ if (e.cleanChunks.length === 0) return [];
57
+ const n = h(e.cleanChunks, t), o = x(n), { pathByRef: r } = d(e.project, {
58
+ mainSourcePath: e.projectLayout.mainSourcePath,
59
+ publicationPath: e.projectLayout.publicationPath,
60
+ projectFilePath: e.projectLayout.projectFilePath,
61
+ includeScaffold: !e.projectLayout.preserved
62
+ }), c = [];
63
+ for (const i of e.project.divisions) {
64
+ const s = r[i.xmlId];
65
+ if (!s) continue;
66
+ const a = i.isRoot ? n.find((u) => u.kind === "preamble" || u.kind === "lead") : o.get(i.title);
67
+ if (!a) continue;
68
+ const f = m(a.before, a.after);
69
+ c.push({
70
+ path: s,
71
+ title: i.title,
72
+ before: a.before,
73
+ after: a.after,
74
+ stats: g(f),
75
+ hunks: L(f),
76
+ fixCount: a.fixes.length
77
+ });
78
+ }
79
+ return c.sort((i, s) => i.path.localeCompare(s.path));
80
+ }
81
+ function x(e) {
82
+ const t = /* @__PURE__ */ new Map();
83
+ for (const o of e)
84
+ o.kind !== "division" || !o.title || t.set(o.title, t.has(o.title) ? null : o);
85
+ const n = /* @__PURE__ */ new Map();
86
+ for (const [o, r] of t)
87
+ r && n.set(o, r);
88
+ return n;
89
+ }
90
+ const j = "converted";
91
+ function k(e) {
92
+ return e.nativeOutputFiles !== void 0;
93
+ }
94
+ function C(e, t = j) {
95
+ return t === "native" && !k(e) ? "converted" : t;
96
+ }
97
+ function P(e, t) {
98
+ return t === "native" ? e.nativeProject ?? e.project : e.project;
99
+ }
100
+ function S(e, t) {
101
+ return t === "converted" ? e.outputFiles : e.nativeOutputFiles ?? e.files;
102
+ }
103
+ function T(e, t) {
104
+ return t === "converted" ? e.outputAssets : e.assets;
105
+ }
106
+ function $(e) {
107
+ const t = e.action === "replace" || e.action === "rewrite" ? `replaced with \`${e.replacement}\`` : e.message ?? e.action, n = e.occurrences > 1 ? ` (x${e.occurrences})` : "";
108
+ return `[${e.severity}] ${e.macro}: ${t}${n}`;
109
+ }
110
+ const M = [
111
+ ".tex",
112
+ ".md",
113
+ ".markdown",
114
+ ".ptx",
115
+ ".xml",
116
+ ".zip",
117
+ ".gz",
118
+ ".tar.gz",
119
+ ".tgz"
120
+ ];
121
+ function l(e) {
122
+ return e.acceptExtensions ?? M;
123
+ }
124
+ function F(e, t) {
125
+ const n = e.toLowerCase();
126
+ return t.some((o) => n.endsWith(o));
127
+ }
128
+ function p(e, t) {
129
+ return F(t, l(e));
130
+ }
131
+ function E(e) {
132
+ const t = /* @__PURE__ */ new Set(), n = [];
133
+ for (const o of e)
134
+ for (const r of l(o))
135
+ t.has(r) || (t.add(r), n.push(r));
136
+ return n;
137
+ }
138
+ function b(e) {
139
+ for (let t = 1; t < e.length; t++) {
140
+ const n = e.slice(0, t);
141
+ if (l(e[t]).some(
142
+ (r) => n.some((c) => l(c).includes(r))
143
+ ))
144
+ return e[t];
145
+ }
146
+ }
147
+ function y(e, t) {
148
+ return e.find((n) => p(n, t));
149
+ }
150
+ function _(e, t) {
151
+ const n = y(e, t), o = b(e);
152
+ if (!(!n || !o || o.id === n.id))
153
+ return p(o, t) ? o : void 0;
154
+ }
155
+ function z(e, t) {
156
+ return `Cannot import ${e}: no converter reads that file type. Supported types are ${E(t).join(", ")}.`;
157
+ }
158
+ export {
159
+ M as D,
160
+ j as a,
161
+ E as b,
162
+ b as c,
163
+ _ as d,
164
+ T as e,
165
+ L as f,
166
+ m as g,
167
+ g as h,
168
+ p as i,
169
+ l as j,
170
+ A as k,
171
+ S as l,
172
+ $ as m,
173
+ k as n,
174
+ F as o,
175
+ P as p,
176
+ y as q,
177
+ C as r,
178
+ z as u
179
+ };
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./upload-BnRj1gU1.cjs"),h=require("./import-mode-CV7gCDzF.cjs"),ee=/\$(?![\s$])([^$\n]{1,200})\$/;function te(e){const n=ee.exec(e);if(!n)return!1;const r=n[1];return/[\\^_{}]/.test(r)||/^[A-Za-z]'?$/.test(r.trim())}const ne=[{pattern:/\\(?:begin|end)\{[a-zA-Z*]+\}/,weight:3},{pattern:/\\\[[\s\S]*?\\\]|\$\$[\s\S]*?\$\$/,weight:3},{pattern:/\\[a-zA-Z]+\s*\{/,weight:2},{pattern:/\\\([\s\S]*?\\\)/,weight:2},{pattern:/\\[a-zA-Z]+\b/,weight:1},{pattern:/\\(?:label|ref|eqref|cite)\b/,weight:2}],re=[{pattern:/^#{1,6}\s+\S/m,weight:3},{pattern:/^\s*```/m,weight:3},{pattern:/^\s*[-*+]\s+\S/m,weight:2},{pattern:/^\s*\d+[.)]\s+\S/m,weight:2},{pattern:/\*\*[^\s*][^*]*\*\*/,weight:2},{pattern:/\[[^\]\n]+\]\([^)\s]+\)/,weight:2},{pattern:/^\s*>\s+\S/m,weight:2},{pattern:/(?:^|\s)_[^_\s][^_\n]*_(?:\s|[.,;:!?]|$)/,weight:1},{pattern:/`[^`\n]+`/,weight:1}],oe=2;function D(e,n){return n.reduce((r,{pattern:o,weight:i})=>r+(o.test(e)?i:0),0)}function O(e){return{latex:D(e,ne)+(te(e)?2:0),markdown:D(e,re)}}function ie(e){const n=e.trim();if(!n||n.startsWith("<"))return;const{latex:r,markdown:o}=O(n);if(!(Math.max(r,o)<oe))return r>=o?"latex":"markdown"}const se={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",pdf:"application/pdf",eps:"application/postscript",ps:"application/postscript",bmp:"image/bmp",tiff:"image/tiff",tif:"image/tiff",webp:"image/webp",ico:"image/vnd.microsoft.icon"};function ae(e){const n=e.split(".").pop()?.toLowerCase()??"";return se[n]??"application/octet-stream"}const S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ce(e){const n=e.length,r=[];for(let o=0;o<n;o+=3){const i=e[o],a=o+1<n,s=o+2<n,c=a?e[o+1]:0,l=s?e[o+2]:0;r.push(S[i>>2]),r.push(S[(i&3)<<4|c>>4]),r.push(a?S[(c&15)<<2|l>>6]:"="),r.push(s?S[l&63]:"=")}return r.join("")}function y(e){return{ref:e.ref,fileName:e.fileName,contentType:ae(e.fileName),data:ce(e.data)}}function $(e){return{ref:e.xmlId,source:e.content,sourceFormat:e.sourceFormat,isRoot:e.isRoot}}function N(e){return{title:e.title,docinfo:e.docinfo,documentKind:e.documentKind,divisions:e.divisions.map($),assets:e.assets.map(y)}}function le(e){return{ref:e.ref,kind:"file",title:e.fileName,short_description:e.fileName,file:{filename:e.fileName,content_type:e.contentType,data:e.data}}}function k(e){return{title:e.title,docinfo:e.docinfo,document_type:e.documentKind,divisions_attributes:e.divisions.map(n=>({ref:n.ref,source:n.source,source_format:n.sourceFormat,is_root:n.isRoot})),assets_attributes:e.assets.map(le)}}function de(e){return k(N(e))}function ue(e,n){const{root:r,entries:o}=t.insertEntries(e,n),i=new Set(o.map(s=>s.xmlId)),a=e.divisions.filter(s=>!i.has(s.xmlId)&&!(n.unwrapRoot&&s.xmlId===r.xmlId));return{divisions:[...o,...a].map($),assets:e.assets.map(y),placeholders:o.map(s=>`<plus:${s.type} ref="${s.xmlId}"/>`)}}const R=/<(\/?)p(?=[\s>/])/g;function pe(e){let n=0;R.lastIndex=0;let r;for(;(r=R.exec(e))!==null;)n+=r[1]?-1:1;return n>0}const me=new RegExp(`<(${t.PRETEXT_DIVISION_TAGS.join("|")})(?=[\\s>/])`);function j(e){return me.exec(e)?.[1]}function X(e,n,r){return e.split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./upload-BnRj1gU1.cjs"),p=require("./engine-routing-08ynicii.cjs"),ee=/\$(?![\s$])([^$\n]{1,200})\$/;function te(e){const n=ee.exec(e);if(!n)return!1;const r=n[1];return/[\\^_{}]/.test(r)||/^[A-Za-z]'?$/.test(r.trim())}const ne=[{pattern:/\\(?:begin|end)\{[a-zA-Z*]+\}/,weight:3},{pattern:/\\\[[\s\S]*?\\\]|\$\$[\s\S]*?\$\$/,weight:3},{pattern:/\\[a-zA-Z]+\s*\{/,weight:2},{pattern:/\\\([\s\S]*?\\\)/,weight:2},{pattern:/\\[a-zA-Z]+\b/,weight:1},{pattern:/\\(?:label|ref|eqref|cite)\b/,weight:2}],re=[{pattern:/^#{1,6}\s+\S/m,weight:3},{pattern:/^\s*```/m,weight:3},{pattern:/^\s*[-*+]\s+\S/m,weight:2},{pattern:/^\s*\d+[.)]\s+\S/m,weight:2},{pattern:/\*\*[^\s*][^*]*\*\*/,weight:2},{pattern:/\[[^\]\n]+\]\([^)\s]+\)/,weight:2},{pattern:/^\s*>\s+\S/m,weight:2},{pattern:/(?:^|\s)_[^_\s][^_\n]*_(?:\s|[.,;:!?]|$)/,weight:1},{pattern:/`[^`\n]+`/,weight:1}],oe=2;function D(e,n){return n.reduce((r,{pattern:o,weight:i})=>r+(o.test(e)?i:0),0)}function O(e){return{latex:D(e,ne)+(te(e)?2:0),markdown:D(e,re)}}function ie(e){const n=e.trim();if(!n||n.startsWith("<"))return;const{latex:r,markdown:o}=O(n);if(!(Math.max(r,o)<oe))return r>=o?"latex":"markdown"}const se={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",pdf:"application/pdf",eps:"application/postscript",ps:"application/postscript",bmp:"image/bmp",tiff:"image/tiff",tif:"image/tiff",webp:"image/webp",ico:"image/vnd.microsoft.icon"};function ae(e){const n=e.split(".").pop()?.toLowerCase()??"";return se[n]??"application/octet-stream"}const S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ce(e){const n=e.length,r=[];for(let o=0;o<n;o+=3){const i=e[o],a=o+1<n,s=o+2<n,c=a?e[o+1]:0,l=s?e[o+2]:0;r.push(S[i>>2]),r.push(S[(i&3)<<4|c>>4]),r.push(a?S[(c&15)<<2|l>>6]:"="),r.push(s?S[l&63]:"=")}return r.join("")}function y(e){return{ref:e.ref,fileName:e.fileName,contentType:ae(e.fileName),data:ce(e.data)}}function N(e){return{ref:e.xmlId,source:e.content,sourceFormat:e.sourceFormat,isRoot:e.isRoot}}function $(e){return{title:e.title,docinfo:e.docinfo,documentKind:e.documentKind,divisions:e.divisions.map(N),assets:e.assets.map(y)}}function le(e){return{ref:e.ref,kind:"file",title:e.fileName,short_description:e.fileName,file:{filename:e.fileName,content_type:e.contentType,data:e.data}}}function k(e){return{title:e.title,docinfo:e.docinfo,document_type:e.documentKind,divisions_attributes:e.divisions.map(n=>({ref:n.ref,source:n.source,source_format:n.sourceFormat,is_root:n.isRoot})),assets_attributes:e.assets.map(le)}}function de(e){return k($(e))}function ue(e,n){const{root:r,entries:o}=t.insertEntries(e,n),i=new Set(o.map(s=>s.xmlId)),a=e.divisions.filter(s=>!i.has(s.xmlId)&&!(n.unwrapRoot&&s.xmlId===r.xmlId));return{divisions:[...o,...a].map(N),assets:e.assets.map(y),placeholders:o.map(s=>`<plus:${s.type} ref="${s.xmlId}"/>`)}}const R=/<(\/?)p(?=[\s>/])/g;function pe(e){let n=0;R.lastIndex=0;let r;for(;(r=R.exec(e))!==null;)n+=r[1]?-1:1;return n>0}const me=new RegExp(`<(${t.PRETEXT_DIVISION_TAGS.join("|")})(?=[\\s>/])`);function j(e){return me.exec(e)?.[1]}function X(e,n,r){return e.split(`
2
2
  `).map((o,i)=>i===0&&r?o:o&&n+o).join(`
3
3
  `)}function fe(e,n){let r=e.trim(),o;if(n.inline){const i=r.replace(/^<p>\s*([\s\S]*?)\s*<\/p>$/,"$1");r=i!==r?i:r.replace(/^<p>/,"");const a=j(r);a&&(o=`Pasted content produced a <${a}>, which cannot sit inside a <p>. It was inserted as-is — move it out of the paragraph to make the document valid.`)}return n.baseIndent&&(r=X(r,n.baseIndent,n.midLine)),{markup:r,warning:o}}const v={mainSourcePath:"source/main.ptx",publicationPath:"publication/publication.ptx",projectFilePath:"project.ptx",docinfoPath:"source/docinfo.ptx"};function z(e){return t.findAnyElement(e,"pretext")?e:`<pretext>
4
4
  ${e}
5
- </pretext>`}function U(e,n,r){const o=new Map,i=[],a=`${n}-`;return e.forEach((s,c)=>{const l=s.attributes["xml:id"];let d;if(l){const f=t.slugify(l);d=f.startsWith(a)?f:`${a}${f}`}else d=`${a}${t.padIndex(c+1,e.length)}`,r.push({action:"anomaly",severity:"info",kind:"structure",category:"missing_xml_id",macro:s.name,occurrences:1,message:`<${s.name}> at position ${c+1} has no xml:id; using \`${d}\` as filename.`});const p=o.get(d)??0;o.set(d,p+1);const u=p===0?d:`${d}-${p+1}`;i.push({span:s,slug:u,filename:`${u}.ptx`})}),i}function he(e,n,r,o){const i=t.findTopLevelElements(e,"section");if(i.length===0)return e;const s=U(i,"sec",o).map(c=>{const l=`source/${n}/${c.filename}`;return r[l]=t.withProlog(c.span.outer),{start:c.span.start,end:c.span.end,replacement:`<xi:include href="${n}/${c.filename}"/>`}});return t.spliceReplacements(e,s)}function ge(e,n,r){const o=t.findAnyElement(e,"book");if(!o)return r.push({action:"anomaly",severity:"warning",kind:"structure",category:"missing_root",macro:"book",occurrences:1,message:"Document was treated as a book but no <book> element found; emitting as a single file."}),W(e,n);const i={},a=t.findTopLevelElements(o.inner,"chapter");let s=o.inner;if(n.splitChapters&&a.length>0){const p=U(a,"ch",r).map(u=>{let f=u.span.outer;if(n.splitSections){const m=u.span.inner,g=he(m,u.slug,i,r);f=u.span.outer.slice(0,u.span.startTagEnd-u.span.start)+g+u.span.outer.slice(u.span.contentEnd-u.span.start)}const T=`source/${u.filename}`;return i[T]=t.withProlog(f),{start:u.span.start,end:u.span.end,replacement:`<xi:include href="${u.filename}"/>`}});s=t.spliceReplacements(o.inner,p)}const c=e.slice(o.start,o.startTagEnd)+s+e.slice(o.contentEnd,o.end),l=e.slice(0,o.start)+c+e.slice(o.end);return i[n.mainSourcePath]=t.withProlog(t.ensureXIncludeNamespace(z(l.trim()))),i}function W(e,n,r){const o={};return o[n.mainSourcePath]=t.withProlog(z(e.trim())),o}function Te(e,n={}){const r=[],o=n.documentKind??t.detectDocumentKind(e),i={splitChapters:n.splitChapters??o==="book",splitSections:n.splitSections??!1,mainSourcePath:n.mainSourcePath??v.mainSourcePath,publicationPath:n.publicationPath??v.publicationPath,projectFilePath:n.projectFilePath??v.projectFilePath,docinfoPath:n.docinfoPath??v.docinfoPath},a=o==="book"?ge(e,i,r):W(e,i);return a[i.projectFilePath]=t.renderProjectPtx({mainSource:i.mainSourcePath,publication:i.publicationPath}),a[i.publicationPath]=t.renderPublicationPtx(),{files:a,documentKind:o,warnings:r}}class K extends Error{constructor(){super("Import cancelled."),this.name="ConversionCancelledError"}}let Pe=0;function G(e,n,r={}){const o=`convert-${Pe++}`,i=e(),{assets:a={},...s}=r;let c;const l=new Promise((p,u)=>{let f=!1;const T=m=>{f||(f=!0,i.terminate(),m())};c=()=>T(()=>u(new K)),i.addEventListener("message",m=>{const g=m.data;if(!(!g||g.requestId!==o)){if(g.type==="result"){T(()=>p(g.result));return}T(()=>u(new Error(g.message)))}}),i.addEventListener("error",m=>{const g=typeof m=="object"&&m&&"message"in m?String(m.message):"The import worker failed to start.";T(()=>u(new Error(g)))})}),d=[...new Set(Object.values(a).map(p=>p.buffer).filter(p=>p instanceof ArrayBuffer))];return i.postMessage({type:"convert",requestId:o,files:n,assets:a,options:s},d),{result:l,cancel:()=>c?.()}}function xe(e){const{createWorker:n,id:r="worker",label:o="Built-in converter",description:i="Create a new project starting with LaTeX, Markdown, or PreTeXt files.",acceptExtensions:a}=e;let s=null;const c=async(l,d)=>{s?.cancel(),s=G(n,l,d);try{return await s.result}finally{s=null}};return{id:r,label:o,description:i,acceptExtensions:a,prepare:async l=>{const{files:d,assets:p}=await t.extractUpload(l);return{fileName:l.name,files:d,assets:p,analysis:t.analyzeImportSources(d)}},convertPrepared:(l,d)=>c(l.files,{...d,assets:l.assets}),convertFile:async(l,d)=>{const{files:p,assets:u}=await t.extractUpload(l);return c(p,{...d,assets:u})},cancel:()=>{s?.cancel(),s=null}}}const B={".docx":"docx",".odt":"odt",".epub":"epub",".tex":"latex",".ltx":"latex",".md":"markdown",".markdown":"markdown",".html":"html",".htm":"html",".rst":"rst",".org":"org",".ipynb":"ipynb",".typ":"typst",".xml":"docbook",".textile":"textile"},Ee=new Set(["docx","odt","epub"]),w=[".docx",".odt",".epub",".html",".htm",".rst",".org",".ipynb",".typ",".textile",".tex",".ltx",".md",".markdown"];function _(e){const n=e.lastIndexOf(".");return n<=0?"":e.slice(n).toLowerCase()}function H(e){return B[_(e)]}function V(e){const{convertToPretext:n,id:r="pandoc",label:o="Pandoc",description:i="Convert Word, OpenOffice, EPUB, HTML, reStructuredText, and more.",acceptExtensions:a=w}=e;return{id:r,label:o,description:i,acceptExtensions:a,convertFile:async(s,c)=>{const l=await n(s,c);if(!l.trim())throw new Error(`Pandoc produced no output for ${s.name}. The file may be empty or in an unexpected format.`);const d=t.importProjectFromFiles({"source.ptx":l},{documentKind:c.documentKind,splitChapters:c.splitChapters,splitSections:c.splitSections,splitLevel:c.splitLevel});return"pretextError"in d||(d.sourceName=s.name,d.sourcePath=s.name),d}}}const q=3e4;function Y(e){const n=/<pre>([\s\S]*?)<\/pre>/i.exec(e);return(n?n[1]:e).replace(/<[^>]+>/g,"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&").trim()}function Z(e,n,r){const o=Ie(Y(n)),i=o?` (${C(o)})`:"";switch(e){case 400:return`The pandoc server will not convert ${r}${i}.${E(r)}`;case 401:case 403:return`The pandoc server rejected this site's credentials, so ${r} was never converted. Nothing is wrong with your file — this is a configuration problem with the service, and worth reporting.${E(r)}`;case 404:return`The pandoc conversion service could not be found at the address this site is configured to use. Nothing is wrong with your file — this is a configuration problem worth reporting.${E(r)}`;case 413:return`${r} is too large for the pandoc server to accept. Splitting it into chapters and importing them one at a time should get through.`;case 422:return`Pandoc could not read ${r}${i}. The file may be damaged, or may use features pandoc does not support.`;case 503:return`The pandoc server is running without its PreTeXt writer, so it cannot convert anything right now. Nothing is wrong with your file — this is a problem with the service, and worth reporting.${E(r)}`;case 504:return`Converting ${r} took longer than the pandoc server allows. Splitting it into chapters and importing them one at a time usually works.`;default:{const a=o?`(HTTP ${e}: ${C(o)})`:`(HTTP ${e})`;return`The pandoc server could not convert ${r} ${a}.${E(r)}`}}}const M=300;function Ie(e){return e.replace(/\s+/g," ").trim()}function C(e){return e.length<=M?e:`${e.slice(0,M).trimEnd()}…`}const Se=new Set([".tex",".ltx",".md",".markdown"]);function E(e){return Se.has(_(e))?" You can import this file with the built-in converter instead.":""}function ve(e){const{url:n,token:r,headers:o,credentials:i,standalone:a=!0,from:s,timeoutMs:c=q,fetchImpl:l,id:d="pandoc-remote",label:p="Pandoc (server)",description:u="Convert Word, OpenOffice, EPUB, HTML, reStructuredText, and more — no local install needed.",acceptExtensions:f=w}=e;return V({convertToPretext:async(m,g)=>{const F=l??globalThis.fetch;if(typeof F!="function")throw new Error("This environment has no fetch; pass fetchImpl to createRemotePandocEngine.");const A=s??H(m.name);if(!A)throw new Error(`Pandoc cannot determine a format for ${m.name}. Supported extensions: ${f.join(", ")}.`);const P=new FormData;r&&P.set("token",r),P.set("file",m,m.name),P.set("from",A),a&&P.set("standalone","yes");const L=new AbortController,J=setTimeout(()=>L.abort(),c);let I;try{I=await F(n,{method:"POST",body:P,headers:o,credentials:i,signal:L.signal})}catch(x){if(x instanceof Error&&x.name==="AbortError")throw new Error(`Pandoc conversion of ${m.name} timed out after ${Math.round(c/1e3)}s.`);const Q=x instanceof Error?x.message:String(x);throw new Error(`Could not reach the pandoc server: ${Q}`)}finally{clearTimeout(J)}const b=await I.text();if(!I.ok)throw new Error(Z(I.status,b,m.name));return b},id:d,label:p,description:u,acceptExtensions:f})}exports.CLEAN_RULES=t.CLEAN_RULES;exports.DIVISION_LADDER=t.DIVISION_LADDER;exports.LADDER_OVERFLOW_TAG=t.LADDER_OVERFLOW_TAG;exports.LATEX_DIVISION_COMMANDS=t.LATEX_DIVISION_COMMANDS;exports.LATEX_FORMAT_MARKERS=t.LATEX_FORMAT_MARKERS;exports.MARKDOWN_FORMAT_MARKERS=t.MARKDOWN_FORMAT_MARKERS;exports.MAX_SUGGESTED_SPLIT_LEVEL=t.MAX_SUGGESTED_SPLIT_LEVEL;exports.PRETEXT_DIVISION_TAGS=t.PRETEXT_DIVISION_TAGS;exports.PRETEXT_ROOT_TAGS=t.PRETEXT_ROOT_TAGS;exports.PROJECT_DESTINATION=t.PROJECT_DESTINATION;exports.analyzeImportSources=t.analyzeImportSources;exports.applyLatexFixes=t.applyLatexFixes;exports.attachLatexRoots=t.attachLatexRoots;exports.attachMarkdownRoots=t.attachMarkdownRoots;exports.buildDivisionPool=t.buildDivisionPool;exports.buildNativeDivisionPool=t.buildNativeDivisionPool;exports.carryOverProjectFiles=t.carryOverProjectFiles;exports.cleanLatex=t.cleanLatex;exports.cleanLatexInChunks=t.cleanLatexInChunks;exports.cleanLatexText=t.cleanLatexText;exports.convertLatexToPretext=t.convertLatexToPretext;exports.convertMarkdownToPretext=t.convertMarkdownToPretext;exports.convertSourceToPretext=t.convertSourceToPretext;exports.dedupeXmlIds=t.dedupeXmlIds;exports.defaultAttachLevel=t.defaultAttachLevel;exports.defaultManifestTarget=t.defaultManifestTarget;exports.detectDocumentKind=t.detectDocumentKind;exports.detectSourceFormat=t.detectSourceFormat;exports.divisionChildRefs=t.divisionChildRefs;exports.divisionsAtLevel=t.divisionsAtLevel;exports.expandPretextIncludes=t.expandPretextIncludes;exports.extractUpload=t.extractUpload;exports.filePrefixForDivision=t.filePrefixForDivision;exports.findLatexFixes=t.findLatexFixes;exports.findLatexHeaders=t.findLatexHeaders;exports.findProjectManifest=t.findProjectManifest;exports.fixesToWarnings=t.fixesToWarnings;exports.getConversionErrorMessage=t.getConversionErrorMessage;exports.getLatexCleanDiagnostics=t.getLatexCleanDiagnostics;exports.handleImportUploadFile=t.handleImportUploadFile;exports.importProjectFromFiles=t.importProjectFromFiles;exports.isDivisionTag=t.isDivisionTag;exports.ladderDepth=t.ladderDepth;exports.latexDivisionHierarchy=t.latexDivisionHierarchy;exports.latexFixesToCodeActions=t.latexFixesToCodeActions;exports.mergeChunksAtLevel=t.mergeChunksAtLevel;exports.normalizePretextSource=t.normalizePretextSource;exports.outlineDivisions=t.outlineDivisions;exports.parseLatexDivisions=t.parseLatexDivisions;exports.parseProjectManifest=t.parseProjectManifest;exports.prepareInsertSource=t.prepareInsertSource;exports.pruneDivisions=t.pruneDivisions;exports.rebuildImport=t.rebuildImport;exports.relayoutImport=t.relayoutImport;exports.renderProjectPtx=t.renderProjectPtx;exports.renderProjectPtxFromManifest=t.renderProjectPtxFromManifest;exports.renderPublicationPtx=t.renderPublicationPtx;exports.reselectImport=t.reselectImport;exports.resolveImportSplitLevel=t.resolveImportSplitLevel;exports.resolveSplitLevel=t.resolveSplitLevel;exports.retargetFragment=t.retargetFragment;exports.retargetFragmentToDepth=t.retargetFragmentToDepth;exports.retargetImport=t.retargetImport;exports.sanitizeRef=t.sanitizeRef;exports.serializeForDestination=t.serializeForDestination;exports.serializeInsertFiles=t.serializeInsertFiles;exports.serializeProjectToFiles=t.serializeProjectToFiles;exports.shiftLadderTag=t.shiftLadderTag;exports.suggestSplitLevel=t.suggestSplitLevel;exports.DEFAULT_IMPORT_MODE=h.DEFAULT_IMPORT_MODE;exports.assetsForImportMode=h.assetsForImportMode;exports.diffHunks=h.diffHunks;exports.diffLines=h.diffLines;exports.diffStats=h.diffStats;exports.fileChangesForImport=h.fileChangesForImport;exports.filesForImportMode=h.filesForImportMode;exports.formatWarningLine=h.formatWarningLine;exports.hasNativeImportMode=h.hasNativeImportMode;exports.projectForImportMode=h.projectForImportMode;exports.resolveImportMode=h.resolveImportMode;exports.ConversionCancelledError=K;exports.DEFAULT_REMOTE_PANDOC_TIMEOUT_MS=q;exports.PANDOC_ACCEPT_EXTENSIONS=w;exports.PANDOC_BINARY_FORMATS=Ee;exports.PANDOC_EXTENSION_FORMATS=B;exports.buildPretextProjectFiles=Te;exports.createPandocEngine=V;exports.createRemotePandocEngine=ve;exports.createWorkerEngine=xe;exports.describeRemotePandocFailure=Z;exports.detectSnippetFormat=ie;exports.extractPandocErrorDetail=Y;exports.fileExtension=_;exports.firstDivisionTag=j;exports.isInlineContext=pe;exports.pandocFormatForFileName=H;exports.placeConvertedMarkup=fe;exports.recordsToPlusPayload=k;exports.reindentForContext=X;exports.runConversionInWorker=G;exports.scoreSnippetFormats=O;exports.serializeInsertToRecords=ue;exports.serializeProjectToPlusPayload=de;exports.serializeProjectToRecords=N;
5
+ </pretext>`}function U(e,n,r){const o=new Map,i=[],a=`${n}-`;return e.forEach((s,c)=>{const l=s.attributes["xml:id"];let d;if(l){const h=t.slugify(l);d=h.startsWith(a)?h:`${a}${h}`}else d=`${a}${t.padIndex(c+1,e.length)}`,r.push({action:"anomaly",severity:"info",kind:"structure",category:"missing_xml_id",macro:s.name,occurrences:1,message:`<${s.name}> at position ${c+1} has no xml:id; using \`${d}\` as filename.`});const m=o.get(d)??0;o.set(d,m+1);const u=m===0?d:`${d}-${m+1}`;i.push({span:s,slug:u,filename:`${u}.ptx`})}),i}function he(e,n,r,o){const i=t.findTopLevelElements(e,"section");if(i.length===0)return e;const s=U(i,"sec",o).map(c=>{const l=`source/${n}/${c.filename}`;return r[l]=t.withProlog(c.span.outer),{start:c.span.start,end:c.span.end,replacement:`<xi:include href="${n}/${c.filename}"/>`}});return t.spliceReplacements(e,s)}function ge(e,n,r){const o=t.findAnyElement(e,"book");if(!o)return r.push({action:"anomaly",severity:"warning",kind:"structure",category:"missing_root",macro:"book",occurrences:1,message:"Document was treated as a book but no <book> element found; emitting as a single file."}),W(e,n);const i={},a=t.findTopLevelElements(o.inner,"chapter");let s=o.inner;if(n.splitChapters&&a.length>0){const m=U(a,"ch",r).map(u=>{let h=u.span.outer;if(n.splitSections){const f=u.span.inner,g=he(f,u.slug,i,r);h=u.span.outer.slice(0,u.span.startTagEnd-u.span.start)+g+u.span.outer.slice(u.span.contentEnd-u.span.start)}const T=`source/${u.filename}`;return i[T]=t.withProlog(h),{start:u.span.start,end:u.span.end,replacement:`<xi:include href="${u.filename}"/>`}});s=t.spliceReplacements(o.inner,m)}const c=e.slice(o.start,o.startTagEnd)+s+e.slice(o.contentEnd,o.end),l=e.slice(0,o.start)+c+e.slice(o.end);return i[n.mainSourcePath]=t.withProlog(t.ensureXIncludeNamespace(z(l.trim()))),i}function W(e,n,r){const o={};return o[n.mainSourcePath]=t.withProlog(z(e.trim())),o}function Te(e,n={}){const r=[],o=n.documentKind??t.detectDocumentKind(e),i={splitChapters:n.splitChapters??o==="book",splitSections:n.splitSections??!1,mainSourcePath:n.mainSourcePath??v.mainSourcePath,publicationPath:n.publicationPath??v.publicationPath,projectFilePath:n.projectFilePath??v.projectFilePath,docinfoPath:n.docinfoPath??v.docinfoPath},a=o==="book"?ge(e,i,r):W(e,i);return a[i.projectFilePath]=t.renderProjectPtx({mainSource:i.mainSourcePath,publication:i.publicationPath}),a[i.publicationPath]=t.renderPublicationPtx(),{files:a,documentKind:o,warnings:r}}class K extends Error{constructor(){super("Import cancelled."),this.name="ConversionCancelledError"}}let Pe=0;function G(e,n,r={}){const o=`convert-${Pe++}`,i=e(),{assets:a={},...s}=r;let c;const l=new Promise((m,u)=>{let h=!1;const T=f=>{h||(h=!0,i.terminate(),f())};c=()=>T(()=>u(new K)),i.addEventListener("message",f=>{const g=f.data;if(!(!g||g.requestId!==o)){if(g.type==="result"){T(()=>m(g.result));return}T(()=>u(new Error(g.message)))}}),i.addEventListener("error",f=>{const g=typeof f=="object"&&f&&"message"in f?String(f.message):"The import worker failed to start.";T(()=>u(new Error(g)))})}),d=[...new Set(Object.values(a).map(m=>m.buffer).filter(m=>m instanceof ArrayBuffer))];return i.postMessage({type:"convert",requestId:o,files:n,assets:a,options:s},d),{result:l,cancel:()=>c?.()}}function Ee(e){const{createWorker:n,id:r="worker",label:o="Built-in converter",description:i="Create a new project starting with LaTeX, Markdown, or PreTeXt files.",acceptExtensions:a}=e;let s=null;const c=async(l,d)=>{s?.cancel(),s=G(n,l,d);try{return await s.result}finally{s=null}};return{id:r,label:o,description:i,acceptExtensions:a,prepare:async l=>{const{files:d,assets:m}=await t.extractUpload(l);return{fileName:l.name,files:d,assets:m,analysis:t.analyzeImportSources(d)}},convertPrepared:(l,d)=>c(l.files,{...d,assets:l.assets}),convertFile:async(l,d)=>{const{files:m,assets:u}=await t.extractUpload(l);return c(m,{...d,assets:u})},cancel:()=>{s?.cancel(),s=null}}}const B={".docx":"docx",".odt":"odt",".epub":"epub",".tex":"latex",".ltx":"latex",".md":"markdown",".markdown":"markdown",".html":"html",".htm":"html",".rst":"rst",".org":"org",".ipynb":"ipynb",".typ":"typst",".xml":"docbook",".textile":"textile"},xe=new Set(["docx","odt","epub"]),w=[".docx",".odt",".epub",".html",".htm",".rst",".org",".ipynb",".typ",".textile",".tex",".ltx",".md",".markdown"];function A(e){const n=e.lastIndexOf(".");return n<=0?"":e.slice(n).toLowerCase()}function H(e){return B[A(e)]}function V(e){const{convertToPretext:n,id:r="pandoc",label:o="Pandoc",description:i="Convert Word, OpenOffice, EPUB, HTML, reStructuredText, and more.",acceptExtensions:a=w}=e;return{id:r,label:o,description:i,acceptExtensions:a,convertFile:async(s,c)=>{const l=await n(s,c);if(!l.trim())throw new Error(`Pandoc produced no output for ${s.name}. The file may be empty or in an unexpected format.`);const d=t.importProjectFromFiles({"source.ptx":l},{documentKind:c.documentKind,splitChapters:c.splitChapters,splitSections:c.splitSections,splitLevel:c.splitLevel});return"pretextError"in d||(d.sourceName=s.name,d.sourcePath=s.name),d}}}const q=3e4;function Y(e){const n=/<pre>([\s\S]*?)<\/pre>/i.exec(e);return(n?n[1]:e).replace(/<[^>]+>/g,"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&").trim()}function Z(e,n,r){const o=Ie(Y(n)),i=o?` (${M(o)})`:"";switch(e){case 400:return`The pandoc server will not convert ${r}${i}.${x(r)}`;case 401:case 403:return`The pandoc server rejected this site's credentials, so ${r} was never converted. Nothing is wrong with your file — this is a configuration problem with the service, and worth reporting.${x(r)}`;case 404:return`The pandoc conversion service could not be found at the address this site is configured to use. Nothing is wrong with your file — this is a configuration problem worth reporting.${x(r)}`;case 413:return`${r} is too large for the pandoc server to accept. Splitting it into chapters and importing them one at a time should get through.`;case 422:return`Pandoc could not read ${r}${i}. The file may be damaged, or may use features pandoc does not support.`;case 503:return`The pandoc server is running without its PreTeXt writer, so it cannot convert anything right now. Nothing is wrong with your file — this is a problem with the service, and worth reporting.${x(r)}`;case 504:return`Converting ${r} took longer than the pandoc server allows. Splitting it into chapters and importing them one at a time usually works.`;default:{const a=o?`(HTTP ${e}: ${M(o)})`:`(HTTP ${e})`;return`The pandoc server could not convert ${r} ${a}.${x(r)}`}}}const C=300;function Ie(e){return e.replace(/\s+/g," ").trim()}function M(e){return e.length<=C?e:`${e.slice(0,C).trimEnd()}…`}const Se=new Set([".tex",".ltx",".md",".markdown"]);function x(e){return Se.has(A(e))?" You can import this file with the built-in converter instead.":""}function ve(e){const{url:n,token:r,headers:o,credentials:i,standalone:a=!0,from:s,timeoutMs:c=q,fetchImpl:l,id:d="pandoc-remote",label:m="Pandoc (server)",description:u="Convert Word, OpenOffice, EPUB, HTML, reStructuredText, and more — no local install needed.",acceptExtensions:h=w}=e;return V({convertToPretext:async(f,g)=>{const _=l??globalThis.fetch;if(typeof _!="function")throw new Error("This environment has no fetch; pass fetchImpl to createRemotePandocEngine.");const F=s??H(f.name);if(!F)throw new Error(`Pandoc cannot determine a format for ${f.name}. Supported extensions: ${h.join(", ")}.`);const P=new FormData;r&&P.set("token",r),P.set("file",f,f.name),P.set("from",F),a&&P.set("standalone","yes");const L=new AbortController,J=setTimeout(()=>L.abort(),c);let I;try{I=await _(n,{method:"POST",body:P,headers:o,credentials:i,signal:L.signal})}catch(E){if(E instanceof Error&&E.name==="AbortError")throw new Error(`Pandoc conversion of ${f.name} timed out after ${Math.round(c/1e3)}s.`);const Q=E instanceof Error?E.message:String(E);throw new Error(`Could not reach the pandoc server: ${Q}`)}finally{clearTimeout(J)}const b=await I.text();if(!I.ok)throw new Error(Z(I.status,b,f.name));return b},id:d,label:m,description:u,acceptExtensions:h})}exports.CLEAN_RULES=t.CLEAN_RULES;exports.DIVISION_LADDER=t.DIVISION_LADDER;exports.LADDER_OVERFLOW_TAG=t.LADDER_OVERFLOW_TAG;exports.LATEX_DIVISION_COMMANDS=t.LATEX_DIVISION_COMMANDS;exports.LATEX_FORMAT_MARKERS=t.LATEX_FORMAT_MARKERS;exports.MARKDOWN_FORMAT_MARKERS=t.MARKDOWN_FORMAT_MARKERS;exports.MAX_SUGGESTED_SPLIT_LEVEL=t.MAX_SUGGESTED_SPLIT_LEVEL;exports.PRETEXT_DIVISION_TAGS=t.PRETEXT_DIVISION_TAGS;exports.PRETEXT_ROOT_TAGS=t.PRETEXT_ROOT_TAGS;exports.PROJECT_DESTINATION=t.PROJECT_DESTINATION;exports.analyzeImportSources=t.analyzeImportSources;exports.applyLatexFixes=t.applyLatexFixes;exports.attachLatexRoots=t.attachLatexRoots;exports.attachMarkdownRoots=t.attachMarkdownRoots;exports.buildDivisionPool=t.buildDivisionPool;exports.buildNativeDivisionPool=t.buildNativeDivisionPool;exports.carryOverProjectFiles=t.carryOverProjectFiles;exports.cleanLatex=t.cleanLatex;exports.cleanLatexInChunks=t.cleanLatexInChunks;exports.cleanLatexText=t.cleanLatexText;exports.convertLatexToPretext=t.convertLatexToPretext;exports.convertMarkdownToPretext=t.convertMarkdownToPretext;exports.convertSourceToPretext=t.convertSourceToPretext;exports.dedupeXmlIds=t.dedupeXmlIds;exports.defaultAttachLevel=t.defaultAttachLevel;exports.defaultManifestTarget=t.defaultManifestTarget;exports.detectDocumentKind=t.detectDocumentKind;exports.detectSourceFormat=t.detectSourceFormat;exports.divisionChildRefs=t.divisionChildRefs;exports.divisionsAtLevel=t.divisionsAtLevel;exports.expandPretextIncludes=t.expandPretextIncludes;exports.extractUpload=t.extractUpload;exports.filePrefixForDivision=t.filePrefixForDivision;exports.findLatexFixes=t.findLatexFixes;exports.findLatexHeaders=t.findLatexHeaders;exports.findProjectManifest=t.findProjectManifest;exports.fixesToWarnings=t.fixesToWarnings;exports.getConversionErrorMessage=t.getConversionErrorMessage;exports.getLatexCleanDiagnostics=t.getLatexCleanDiagnostics;exports.handleImportUploadFile=t.handleImportUploadFile;exports.importProjectFromFiles=t.importProjectFromFiles;exports.isDivisionTag=t.isDivisionTag;exports.ladderDepth=t.ladderDepth;exports.latexDivisionHierarchy=t.latexDivisionHierarchy;exports.latexFixesToCodeActions=t.latexFixesToCodeActions;exports.mergeChunksAtLevel=t.mergeChunksAtLevel;exports.normalizePretextSource=t.normalizePretextSource;exports.outlineDivisions=t.outlineDivisions;exports.parseLatexDivisions=t.parseLatexDivisions;exports.parseProjectManifest=t.parseProjectManifest;exports.prepareInsertSource=t.prepareInsertSource;exports.pruneDivisions=t.pruneDivisions;exports.rebuildImport=t.rebuildImport;exports.relayoutImport=t.relayoutImport;exports.renderProjectPtx=t.renderProjectPtx;exports.renderProjectPtxFromManifest=t.renderProjectPtxFromManifest;exports.renderPublicationPtx=t.renderPublicationPtx;exports.reselectImport=t.reselectImport;exports.resolveImportSplitLevel=t.resolveImportSplitLevel;exports.resolveSplitLevel=t.resolveSplitLevel;exports.retargetFragment=t.retargetFragment;exports.retargetFragmentToDepth=t.retargetFragmentToDepth;exports.retargetImport=t.retargetImport;exports.sanitizeRef=t.sanitizeRef;exports.serializeForDestination=t.serializeForDestination;exports.serializeInsertFiles=t.serializeInsertFiles;exports.serializeProjectToFiles=t.serializeProjectToFiles;exports.shiftLadderTag=t.shiftLadderTag;exports.suggestSplitLevel=t.suggestSplitLevel;exports.DEFAULT_ACCEPT_EXTENSIONS=p.DEFAULT_ACCEPT_EXTENSIONS;exports.DEFAULT_IMPORT_MODE=p.DEFAULT_IMPORT_MODE;exports.allAcceptExtensions=p.allAcceptExtensions;exports.alternateEngine=p.alternateEngine;exports.alternateFor=p.alternateFor;exports.assetsForImportMode=p.assetsForImportMode;exports.diffHunks=p.diffHunks;exports.diffLines=p.diffLines;exports.diffStats=p.diffStats;exports.engineAccepts=p.engineAccepts;exports.engineExtensions=p.engineExtensions;exports.fileChangesForImport=p.fileChangesForImport;exports.filesForImportMode=p.filesForImportMode;exports.formatWarningLine=p.formatWarningLine;exports.hasNativeImportMode=p.hasNativeImportMode;exports.matchesExtension=p.matchesExtension;exports.projectForImportMode=p.projectForImportMode;exports.resolveImportMode=p.resolveImportMode;exports.routeEngine=p.routeEngine;exports.unsupportedFileMessage=p.unsupportedFileMessage;exports.ConversionCancelledError=K;exports.DEFAULT_REMOTE_PANDOC_TIMEOUT_MS=q;exports.PANDOC_ACCEPT_EXTENSIONS=w;exports.PANDOC_BINARY_FORMATS=xe;exports.PANDOC_EXTENSION_FORMATS=B;exports.buildPretextProjectFiles=Te;exports.createPandocEngine=V;exports.createRemotePandocEngine=ve;exports.createWorkerEngine=Ee;exports.describeRemotePandocFailure=Z;exports.detectSnippetFormat=ie;exports.extractPandocErrorDetail=Y;exports.fileExtension=A;exports.firstDivisionTag=j;exports.isInlineContext=pe;exports.pandocFormatForFileName=H;exports.placeConvertedMarkup=fe;exports.recordsToPlusPayload=k;exports.reindentForContext=X;exports.runConversionInWorker=G;exports.scoreSnippetFormats=O;exports.serializeInsertToRecords=ue;exports.serializeProjectToPlusPayload=de;exports.serializeProjectToRecords=$;
package/dist/index.d.ts CHANGED
@@ -30,3 +30,4 @@ export type { SourceFormat, ProjectLayout, ConversionContext, ConvertedPretextRe
30
30
  export { createWorkerEngine, runConversionInWorker, ConversionCancelledError, type ConversionWorker, type WorkerEngineOptions, type RunningConversion, } from './worker/worker-engine';
31
31
  export type { WorkerRequest, WorkerResponse, ConvertRequest, ResultResponse, ErrorResponse, } from './worker/protocol';
32
32
  export { PANDOC_ACCEPT_EXTENSIONS, PANDOC_BINARY_FORMATS, PANDOC_EXTENSION_FORMATS, fileExtension, pandocFormatForFileName, createPandocEngine, createRemotePandocEngine, describeRemotePandocFailure, extractPandocErrorDetail, DEFAULT_REMOTE_PANDOC_TIMEOUT_MS, type PandocInputFormat, type PandocBridge, type PandocEngineOptions, type RemotePandocEngineOptions, } from './lib/pandoc';
33
+ export { DEFAULT_ACCEPT_EXTENSIONS, allAcceptExtensions, alternateEngine, alternateFor, engineAccepts, engineExtensions, matchesExtension, routeEngine, unsupportedFileMessage, type RoutableEngine, } from './lib/engine-routing';