@pretextbook/import 0.0.1

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.
Files changed (40) hide show
  1. package/README.md +121 -0
  2. package/dist/import-mode-CSZlmUxw.cjs +66 -0
  3. package/dist/import-mode-iBDd9oQY.js +3862 -0
  4. package/dist/import.css +1 -0
  5. package/dist/index.cjs +3 -0
  6. package/dist/index.d.ts +14 -0
  7. package/dist/index.js +164 -0
  8. package/dist/lib/clean/clean-latex.d.ts +6 -0
  9. package/dist/lib/clean/latex-clean.d.ts +10 -0
  10. package/dist/lib/clean/latex-data.d.ts +38 -0
  11. package/dist/lib/clean/latex-preamble.d.ts +27 -0
  12. package/dist/lib/clean/latex-scan.d.ts +11 -0
  13. package/dist/lib/clean/latex-utils.d.ts +4 -0
  14. package/dist/lib/clean/pretext-includes.d.ts +7 -0
  15. package/dist/lib/clean/warnings.d.ts +13 -0
  16. package/dist/lib/convert.d.ts +16 -0
  17. package/dist/lib/detect-source-format.d.ts +4 -0
  18. package/dist/lib/import-mode.d.ts +13 -0
  19. package/dist/lib/layout/build-project-files.d.ts +17 -0
  20. package/dist/lib/layout/document-kind.d.ts +2 -0
  21. package/dist/lib/layout/index.d.ts +4 -0
  22. package/dist/lib/layout/shared.d.ts +12 -0
  23. package/dist/lib/layout/templates.d.ts +8 -0
  24. package/dist/lib/layout/xml-scan.d.ts +13 -0
  25. package/dist/lib/pool/division-pool.d.ts +34 -0
  26. package/dist/lib/pool/index.d.ts +3 -0
  27. package/dist/lib/pool/serialize-files.d.ts +19 -0
  28. package/dist/lib/pool/serialize-plus.d.ts +10 -0
  29. package/dist/lib/types.d.ts +124 -0
  30. package/dist/lib/upload.d.ts +10 -0
  31. package/dist/react/import-source-form.d.ts +20 -0
  32. package/dist/react/import-upload-panel.d.ts +21 -0
  33. package/dist/react/import-wizard.d.ts +15 -0
  34. package/dist/react/index.d.ts +6 -0
  35. package/dist/react.cjs +6 -0
  36. package/dist/react.js +735 -0
  37. package/index.cjs +1 -0
  38. package/index.d.ts +1 -0
  39. package/index.js +1 -0
  40. package/package.json +63 -0
@@ -0,0 +1 @@
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-200:oklch(88.5% .062 18.334);--color-red-800:oklch(44.4% .177 26.899);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-green-700:oklch(52.7% .154 150.069);--color-blue-50:oklch(97% .014 254.604);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.collapse{visibility:collapse}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing) * 0)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.h-8{height:calc(var(--spacing) * 8)}.max-h-72{max-height:calc(var(--spacing) * 72)}.w-8{width:calc(var(--spacing) * 8)}.w-full{width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-700{border-color:var(--color-blue-700)}.border-red-200{border-color:var(--color-red-200)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-300{border-color:var(--color-slate-300)}.border-t-transparent{border-top-color:#0000}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-700{background-color:var(--color-blue-700)}.bg-red-50{background-color:var(--color-red-50)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-white{background-color:var(--color-white)}.p-4{padding:calc(var(--spacing) * 4)}.p-10{padding:calc(var(--spacing) * 10)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-16{padding-block:calc(var(--spacing) * 16)}.pt-1{padding-top:calc(var(--spacing) * 1)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-green-700{color:var(--color-green-700)}.text-red-800{color:var(--color-red-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-slate-400:hover{border-color:var(--color-slate-400)}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-200:hover{background-color:var(--color-slate-200)}.hover\:text-slate-900:hover{color:var(--color-slate-900)}}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}
package/dist/index.cjs ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./import-mode-CSZlmUxw.cjs");function x(){const t=globalThis.crypto;return t?.randomUUID?t.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const a=Math.random()*16|0;return(n==="x"?a:a&3|8).toString(16)})}function R(t){return{title:t.title,docinfo:t.docinfo,documentType:t.documentKind,divisions:t.divisions.map(n=>({id:x(),ref:n.xmlId,source:n.content,sourceFormat:n.sourceFormat,isRoot:n.isRoot})),assets:t.assets.map(n=>({id:x(),ref:n.ref,kind:"file",fileName:n.fileName,data:n.data}))}}const P={mainSourcePath:"source/main.ptx",publicationPath:"publication/publication.ptx",projectFilePath:"project.ptx",docinfoPath:"source/docinfo.ptx"};function f(t){return e.findAnyElement(t,"pretext")?t:`<pretext>
2
+ ${t}
3
+ </pretext>`}function h(t,n,a){const o=new Map,i=[],s=`${n}-`;return t.forEach((l,c)=>{const d=l.attributes["xml:id"];let u;if(d){const m=e.slugify(d);u=m.startsWith(s)?m:`${s}${m}`}else u=`${s}${e.padIndex(c+1,t.length)}`,a.push({action:"anomaly",severity:"info",kind:"structure",category:"missing_xml_id",macro:l.name,occurrences:1,message:`<${l.name}> at position ${c+1} has no xml:id; using \`${u}\` as filename.`});const p=o.get(u)??0;o.set(u,p+1);const r=p===0?u:`${u}-${p+1}`;i.push({span:l,slug:r,filename:`${r}.ptx`})}),i}function M(t,n,a,o){const i=e.findTopLevelElements(t,"section");if(i.length===0)return t;const l=h(i,"sec",o).map(c=>{const d=`source/${n}/${c.filename}`;return a[d]=e.withProlog(c.span.outer),{start:c.span.start,end:c.span.end,replacement:`<xi:include href="${n}/${c.filename}"/>`}});return e.spliceReplacements(t,l)}function S(t,n,a){const o=e.findAnyElement(t,"book");if(!o)return a.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."}),g(t,n);const i={},s=e.findTopLevelElements(o.inner,"chapter");let l=o.inner;if(n.splitChapters&&s.length>0){const p=h(s,"ch",a).map(r=>{let m=r.span.outer;if(n.splitSections){const F=r.span.inner,T=M(F,r.slug,i,a);m=r.span.outer.slice(0,r.span.startTagEnd-r.span.start)+T+r.span.outer.slice(r.span.contentEnd-r.span.start)}const b=`source/${r.filename}`;return i[b]=e.withProlog(m),{start:r.span.start,end:r.span.end,replacement:`<xi:include href="${r.filename}"/>`}});l=e.spliceReplacements(o.inner,p)}const c=t.slice(o.start,o.startTagEnd)+l+t.slice(o.contentEnd,o.end),d=t.slice(0,o.start)+c+t.slice(o.end);return i[n.mainSourcePath]=e.withProlog(e.ensureXIncludeNamespace(f(d.trim()))),i}function g(t,n,a){const o={};return o[n.mainSourcePath]=e.withProlog(f(t.trim())),o}function v(t,n={}){const a=[],o=n.documentKind??e.detectDocumentKind(t),i={splitChapters:n.splitChapters??o==="book",splitSections:n.splitSections??!1,mainSourcePath:n.mainSourcePath??P.mainSourcePath,publicationPath:n.publicationPath??P.publicationPath,projectFilePath:n.projectFilePath??P.projectFilePath,docinfoPath:n.docinfoPath??P.docinfoPath},s=o==="book"?S(t,i,a):g(t,i);return s[i.projectFilePath]=e.renderProjectPtx({mainSource:i.mainSourcePath,publication:i.publicationPath}),s[i.publicationPath]=e.renderPublicationPtx(),{files:s,documentKind:o,warnings:a}}exports.LATEX_FORMAT_MARKERS=e.LATEX_FORMAT_MARKERS;exports.MARKDOWN_FORMAT_MARKERS=e.MARKDOWN_FORMAT_MARKERS;exports.assetsForImportMode=e.assetsForImportMode;exports.buildDivisionPool=e.buildDivisionPool;exports.cleanLatex=e.cleanLatex;exports.convertLatexToPretext=e.convertLatexToPretext;exports.convertMarkdownToPretext=e.convertMarkdownToPretext;exports.convertSourceToPretext=e.convertSourceToPretext;exports.detectDocumentKind=e.detectDocumentKind;exports.detectSourceFormat=e.detectSourceFormat;exports.divisionChildRefs=e.divisionChildRefs;exports.expandPretextIncludes=e.expandPretextIncludes;exports.filesForImportMode=e.filesForImportMode;exports.formatWarningLine=e.formatWarningLine;exports.getConversionErrorMessage=e.getConversionErrorMessage;exports.handleImportUploadFile=e.handleImportUploadFile;exports.importProjectFromFiles=e.importProjectFromFiles;exports.normalizePretextSource=e.normalizePretextSource;exports.renderProjectPtx=e.renderProjectPtx;exports.renderPublicationPtx=e.renderPublicationPtx;exports.sanitizeRef=e.sanitizeRef;exports.serializeProjectToFiles=e.serializeProjectToFiles;exports.buildPretextProjectFiles=v;exports.serializeProjectToPlusPayload=R;
@@ -0,0 +1,14 @@
1
+ export { detectSourceFormat, LATEX_FORMAT_MARKERS, MARKDOWN_FORMAT_MARKERS, } from './lib/detect-source-format';
2
+ export { convertLatexToPretext, convertMarkdownToPretext, normalizePretextSource, convertSourceToPretext, getConversionErrorMessage, } from './lib/convert';
3
+ export type { LatexConversionResult, MarkdownConversionResult, } from './lib/convert';
4
+ export { importProjectFromFiles, handleImportUploadFile, type ImportProjectOptions, } from './lib/upload';
5
+ export { filesForImportMode, assetsForImportMode, formatWarningLine, type ImportMode, } from './lib/import-mode';
6
+ export { cleanLatex } from './lib/clean/clean-latex';
7
+ export type { CleanLatexResult } from './lib/clean/clean-latex';
8
+ export { expandPretextIncludes } from './lib/clean/pretext-includes';
9
+ export type { CleaningWarning, CleaningSeverity, CleaningAction, } from './lib/clean/warnings';
10
+ export { buildPretextProjectFiles, detectDocumentKind, renderProjectPtx, renderPublicationPtx, } from './lib/layout';
11
+ export type { BuildProjectFilesOptions, BuildProjectFilesResult, DocumentKind, } from './lib/layout';
12
+ export { buildDivisionPool, sanitizeRef, serializeProjectToFiles, serializeProjectToPlusPayload, divisionChildRefs, } from './lib/pool';
13
+ export type { BuildDivisionPoolOptions, BuildDivisionPoolResult, SerializeProjectFilesOptions, SerializedProjectFiles, } from './lib/pool';
14
+ export type { SourceFormat, ConversionContext, ConvertedPretextResult, UploadStatusType, UploadStatusMessage, UploadSourceType, ImportedProject, ImportedDivision, ImportedDivisionType, ImportedAsset, PlusProjectPayload, PlusDivisionRecord, PlusAssetRecord, ImportedProjectResult, ImportedProjectSuccess, ImportedProjectError, } from './lib/types';
package/dist/index.js ADDED
@@ -0,0 +1,164 @@
1
+ import { d as T, r as E, a as R, f as P, b as h, w as f, s as g, e as v, c as M, p as j } from "./import-mode-iBDd9oQY.js";
2
+ import { L, M as U, g as z, h as O, i as N, j as W, k as B, l as X, m as q, n as G, o as H, q as J, t as Q, u as V, v as Y, x as Z, y as tt, z as et, A as nt } from "./import-mode-iBDd9oQY.js";
3
+ function x() {
4
+ const t = globalThis.crypto;
5
+ return t?.randomUUID ? t.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
6
+ const s = Math.random() * 16 | 0;
7
+ return (e === "x" ? s : s & 3 | 8).toString(16);
8
+ });
9
+ }
10
+ function C(t) {
11
+ return {
12
+ title: t.title,
13
+ docinfo: t.docinfo,
14
+ documentType: t.documentKind,
15
+ divisions: t.divisions.map((e) => ({
16
+ id: x(),
17
+ ref: e.xmlId,
18
+ source: e.content,
19
+ sourceFormat: e.sourceFormat,
20
+ isRoot: e.isRoot
21
+ })),
22
+ assets: t.assets.map((e) => ({
23
+ id: x(),
24
+ ref: e.ref,
25
+ kind: "file",
26
+ fileName: e.fileName,
27
+ data: e.data
28
+ }))
29
+ };
30
+ }
31
+ const p = {
32
+ mainSourcePath: "source/main.ptx",
33
+ publicationPath: "publication/publication.ptx",
34
+ projectFilePath: "project.ptx",
35
+ docinfoPath: "source/docinfo.ptx"
36
+ };
37
+ function b(t) {
38
+ return P(t, "pretext") ? t : `<pretext>
39
+ ${t}
40
+ </pretext>`;
41
+ }
42
+ function F(t, e, s) {
43
+ const n = /* @__PURE__ */ new Map(), a = [], i = `${e}-`;
44
+ return t.forEach((c, r) => {
45
+ const u = c.attributes["xml:id"];
46
+ let l;
47
+ if (u) {
48
+ const m = M(u);
49
+ l = m.startsWith(i) ? m : `${i}${m}`;
50
+ } else
51
+ l = `${i}${j(r + 1, t.length)}`, s.push({
52
+ action: "anomaly",
53
+ severity: "info",
54
+ kind: "structure",
55
+ category: "missing_xml_id",
56
+ macro: c.name,
57
+ occurrences: 1,
58
+ message: `<${c.name}> at position ${r + 1} has no xml:id; using \`${l}\` as filename.`
59
+ });
60
+ const d = n.get(l) ?? 0;
61
+ n.set(l, d + 1);
62
+ const o = d === 0 ? l : `${l}-${d + 1}`;
63
+ a.push({
64
+ span: c,
65
+ slug: o,
66
+ filename: `${o}.ptx`
67
+ });
68
+ }), a;
69
+ }
70
+ function I(t, e, s, n) {
71
+ const a = h(t, "section");
72
+ if (a.length === 0)
73
+ return t;
74
+ const c = F(a, "sec", n).map((r) => {
75
+ const u = `source/${e}/${r.filename}`;
76
+ return s[u] = f(r.span.outer), {
77
+ start: r.span.start,
78
+ end: r.span.end,
79
+ replacement: `<xi:include href="${e}/${r.filename}"/>`
80
+ };
81
+ });
82
+ return g(t, c);
83
+ }
84
+ function w(t, e, s) {
85
+ const n = P(t, "book");
86
+ if (!n)
87
+ return s.push({
88
+ action: "anomaly",
89
+ severity: "warning",
90
+ kind: "structure",
91
+ category: "missing_root",
92
+ macro: "book",
93
+ occurrences: 1,
94
+ message: "Document was treated as a book but no <book> element found; emitting as a single file."
95
+ }), $(t, e);
96
+ const a = {}, i = h(n.inner, "chapter");
97
+ let c = n.inner;
98
+ if (e.splitChapters && i.length > 0) {
99
+ const d = F(i, "ch", s).map((o) => {
100
+ let m = o.span.outer;
101
+ if (e.splitSections) {
102
+ const y = o.span.inner, S = I(y, o.slug, a, s);
103
+ m = o.span.outer.slice(0, o.span.startTagEnd - o.span.start) + S + o.span.outer.slice(o.span.contentEnd - o.span.start);
104
+ }
105
+ const k = `source/${o.filename}`;
106
+ return a[k] = f(m), {
107
+ start: o.span.start,
108
+ end: o.span.end,
109
+ replacement: `<xi:include href="${o.filename}"/>`
110
+ };
111
+ });
112
+ c = g(n.inner, d);
113
+ }
114
+ const r = t.slice(n.start, n.startTagEnd) + c + t.slice(n.contentEnd, n.end), u = t.slice(0, n.start) + r + t.slice(n.end);
115
+ return a[e.mainSourcePath] = f(
116
+ v(b(u.trim()))
117
+ ), a;
118
+ }
119
+ function $(t, e, s) {
120
+ const n = {};
121
+ return n[e.mainSourcePath] = f(
122
+ b(t.trim())
123
+ ), n;
124
+ }
125
+ function D(t, e = {}) {
126
+ const s = [], n = e.documentKind ?? T(t), a = {
127
+ splitChapters: e.splitChapters ?? n === "book",
128
+ splitSections: e.splitSections ?? !1,
129
+ mainSourcePath: e.mainSourcePath ?? p.mainSourcePath,
130
+ publicationPath: e.publicationPath ?? p.publicationPath,
131
+ projectFilePath: e.projectFilePath ?? p.projectFilePath,
132
+ docinfoPath: e.docinfoPath ?? p.docinfoPath
133
+ }, i = n === "book" ? w(t, a, s) : $(t, a);
134
+ return i[a.projectFilePath] = E({
135
+ mainSource: a.mainSourcePath,
136
+ publication: a.publicationPath
137
+ }), i[a.publicationPath] = R(), { files: i, documentKind: n, warnings: s };
138
+ }
139
+ export {
140
+ L as LATEX_FORMAT_MARKERS,
141
+ U as MARKDOWN_FORMAT_MARKERS,
142
+ z as assetsForImportMode,
143
+ O as buildDivisionPool,
144
+ D as buildPretextProjectFiles,
145
+ N as cleanLatex,
146
+ W as convertLatexToPretext,
147
+ B as convertMarkdownToPretext,
148
+ X as convertSourceToPretext,
149
+ T as detectDocumentKind,
150
+ q as detectSourceFormat,
151
+ G as divisionChildRefs,
152
+ H as expandPretextIncludes,
153
+ J as filesForImportMode,
154
+ Q as formatWarningLine,
155
+ V as getConversionErrorMessage,
156
+ Y as handleImportUploadFile,
157
+ Z as importProjectFromFiles,
158
+ tt as normalizePretextSource,
159
+ E as renderProjectPtx,
160
+ R as renderPublicationPtx,
161
+ et as sanitizeRef,
162
+ nt as serializeProjectToFiles,
163
+ C as serializeProjectToPlusPayload
164
+ };
@@ -0,0 +1,6 @@
1
+ import { CleaningWarning } from './warnings';
2
+ export interface CleanLatexResult {
3
+ output: string;
4
+ warnings: CleaningWarning[];
5
+ }
6
+ export declare function cleanLatex(source: string): CleanLatexResult;
@@ -0,0 +1,10 @@
1
+ import { MacroReplaceGroup } from './latex-data';
2
+ import { CleaningWarning } from './warnings';
3
+ export declare function fixPlainTeX(input: string, group: MacroReplaceGroup): {
4
+ output: string;
5
+ warnings: CleaningWarning[];
6
+ };
7
+ export declare function specialPreprocess(input: string): {
8
+ output: string;
9
+ warnings: CleaningWarning[];
10
+ };
@@ -0,0 +1,38 @@
1
+ export type ErrorKind = "unused" | "presentation" | "accessibility" | "mistake" | "archaic" | "publisher" | "other";
2
+ export interface MacroGroup {
3
+ kind: string;
4
+ category: string;
5
+ macros: string[];
6
+ }
7
+ export interface MacroReplaceGroup {
8
+ kind: string;
9
+ category: string;
10
+ pairs: Array<{
11
+ from: string;
12
+ to: string;
13
+ }>;
14
+ }
15
+ export interface MacroWithArityGroup {
16
+ kind: string;
17
+ category: string;
18
+ macros: Array<{
19
+ name: string;
20
+ arity: number;
21
+ }>;
22
+ }
23
+ export interface EnvironmentGroup {
24
+ kind: string;
25
+ category: string;
26
+ environments: string[];
27
+ }
28
+ export declare const badPlainTeX: MacroGroup[];
29
+ export declare const badPlainTeXdirectives: MacroReplaceGroup;
30
+ export declare const specialBadMacros: MacroGroup[];
31
+ export declare const badEverywhereMacros: MacroGroup[];
32
+ export declare const badEverywhereMacrosLine: MacroGroup[];
33
+ export declare const publisherOptions: MacroGroup[];
34
+ export declare const eliminateAndSave: MacroGroup[];
35
+ export declare const badEverywhereMacrosPlus: MacroWithArityGroup[];
36
+ export declare const badBodyEnvironments: EnvironmentGroup[];
37
+ export declare const typeOfError: Record<string, string>;
38
+ export declare const alternatives: Record<string, Array<[string, string]>>;
@@ -0,0 +1,27 @@
1
+ export interface PreambleInfo {
2
+ /** Argument of \documentclass{...}, e.g. "book" or "article". Defaults to "article". */
3
+ documentClass: string;
4
+ /** Inner content of \title{...}, or empty string. */
5
+ title: string;
6
+ /** Inner content of \author{...}, or empty string. */
7
+ author: string;
8
+ /** Collected \newcommand / \renewcommand / \DeclareMathOperator definitions. */
9
+ macros: string;
10
+ }
11
+ export declare function splitLatexAtDocument(source: string): {
12
+ preamble: string;
13
+ body: string;
14
+ };
15
+ /**
16
+ * Extracts the mandatory argument of a LaTeX command, e.g. `\title{...}`.
17
+ * Skips an optional `[...]` argument if present.
18
+ * Returns the inner content (without surrounding braces), or "".
19
+ */
20
+ export declare function extractLatexField(source: string, cmdName: string): string;
21
+ /**
22
+ * Collects LaTeX macro definition lines from `preamble`, including multi-line
23
+ * definitions (tracks brace depth to know when a definition is complete).
24
+ * Returns the collected definitions joined with newlines.
25
+ */
26
+ export declare function extractMacros(preamble: string): string;
27
+ export declare function extractPreambleInfo(preamble: string): PreambleInfo;
@@ -0,0 +1,11 @@
1
+ import { CleaningWarning } from './warnings';
2
+ export interface PreambleBodyBiblio {
3
+ preamble: string;
4
+ body: string;
5
+ bibliography: string;
6
+ }
7
+ export declare function separatePieces(input: string): PreambleBodyBiblio;
8
+ export declare function scanForAnomalies(source: string): {
9
+ output: string;
10
+ warnings: CleaningWarning[];
11
+ };
@@ -0,0 +1,4 @@
1
+ export declare function deleteComments(input: string): string;
2
+ export declare function makeXMLSafe(input: string): string;
3
+ export declare function trimJunk(input: string): string;
4
+ export declare function firstBracketedString(text: string, depth?: number, lbrack?: string, rbrack?: string): [string, string];
@@ -0,0 +1,7 @@
1
+ export interface PretextIncludeExpansion {
2
+ expandedText: string;
3
+ expandedCount: number;
4
+ missingIncludes: string[];
5
+ }
6
+ export declare function expandPretextIncludes(mainContent: string, baseFile: string, files: Record<string, string>, maxDepth?: number): PretextIncludeExpansion;
7
+ export declare function findLikelyMainPretextPath(files: Record<string, string>): string | null;
@@ -0,0 +1,13 @@
1
+ export type CleaningSeverity = "info" | "warning" | "error";
2
+ export type CleaningAction = "delete" | "replace" | "rewrite" | "save" | "anomaly";
3
+ export interface CleaningWarning {
4
+ action: CleaningAction;
5
+ severity: CleaningSeverity;
6
+ kind: string;
7
+ category: string;
8
+ macro: string;
9
+ occurrences: number;
10
+ replacement?: string;
11
+ message?: string;
12
+ examples?: string[];
13
+ }
@@ -0,0 +1,16 @@
1
+ import { CleaningWarning } from './clean/warnings';
2
+ import { ConvertedPretextResult, SourceFormat } from './types';
3
+ export declare function normalizePretextSource(pretextSource: string): string;
4
+ export interface LatexConversionResult {
5
+ pretext: string;
6
+ cleanedLatex: string;
7
+ warnings: CleaningWarning[];
8
+ }
9
+ export declare function convertLatexToPretext(latexSource: string): LatexConversionResult;
10
+ export interface MarkdownConversionResult {
11
+ pretext: string;
12
+ cleanedMarkdown: string;
13
+ }
14
+ export declare function convertMarkdownToPretext(markdownSource: string): MarkdownConversionResult;
15
+ export declare function getConversionErrorMessage(error: unknown): string;
16
+ export declare function convertSourceToPretext(source: string, sourceFormat?: SourceFormat): ConvertedPretextResult;
@@ -0,0 +1,4 @@
1
+ import { SourceFormat } from './types';
2
+ export declare const LATEX_FORMAT_MARKERS: string[];
3
+ export declare const MARKDOWN_FORMAT_MARKERS: string[];
4
+ export declare function detectSourceFormat(source: string): SourceFormat;
@@ -0,0 +1,13 @@
1
+ import { CleaningWarning } from './clean/warnings';
2
+ import { ImportedProjectSuccess } from './types';
3
+ /** Which of the result's alternatives the user chose to import. */
4
+ export type ImportMode = "converted" | "native";
5
+ /** The text files a host should write for the chosen mode. */
6
+ export declare function filesForImportMode(result: ImportedProjectSuccess, mode: ImportMode): Record<string, string>;
7
+ /** The binary assets a host should write for the chosen mode. */
8
+ export declare function assetsForImportMode(result: ImportedProjectSuccess, mode: ImportMode): Record<string, Uint8Array>;
9
+ /**
10
+ * One-line human-readable rendering of a cleaning warning, for plain-text
11
+ * surfaces (VS Code's output channel, logs).
12
+ */
13
+ export declare function formatWarningLine(warning: CleaningWarning): string;
@@ -0,0 +1,17 @@
1
+ import { CleaningWarning } from '../clean/warnings';
2
+ import { DocumentKind } from './document-kind';
3
+ export interface BuildProjectFilesOptions {
4
+ documentKind?: DocumentKind;
5
+ splitChapters?: boolean;
6
+ splitSections?: boolean;
7
+ mainSourcePath?: string;
8
+ publicationPath?: string;
9
+ projectFilePath?: string;
10
+ docinfoPath?: string;
11
+ }
12
+ export interface BuildProjectFilesResult {
13
+ files: Record<string, string>;
14
+ documentKind: DocumentKind;
15
+ warnings: CleaningWarning[];
16
+ }
17
+ export declare function buildPretextProjectFiles(pretextSource: string, options?: BuildProjectFilesOptions): BuildProjectFilesResult;
@@ -0,0 +1,2 @@
1
+ export type DocumentKind = "article" | "book";
2
+ export declare function detectDocumentKind(pretextSource: string): DocumentKind;
@@ -0,0 +1,4 @@
1
+ export { buildPretextProjectFiles, type BuildProjectFilesOptions, type BuildProjectFilesResult, } from './build-project-files';
2
+ export { detectDocumentKind, type DocumentKind } from './document-kind';
3
+ export { renderProjectPtx, renderPublicationPtx, renderXmlProlog, } from './templates';
4
+ export { findTopLevelElements, findFirstElement, type XmlElementSpan, } from './xml-scan';
@@ -0,0 +1,12 @@
1
+ export declare const XI_NAMESPACE = "http://www.w3.org/2001/XInclude";
2
+ export declare function slugify(input: string): string;
3
+ export declare function padIndex(index: number, total: number): string;
4
+ /** Replace each [start, end) span of `source` with its replacement string. */
5
+ export declare function spliceReplacements(source: string, replacements: Array<{
6
+ start: number;
7
+ end: number;
8
+ replacement: string;
9
+ }>): string;
10
+ /** Add `xmlns:xi` to the first root-like element that lacks it. */
11
+ export declare function ensureXIncludeNamespace(content: string): string;
12
+ export declare function withProlog(content: string): string;
@@ -0,0 +1,8 @@
1
+ export interface ProjectTemplateOptions {
2
+ mainSource: string;
3
+ publication: string;
4
+ outputBase?: string;
5
+ }
6
+ export declare function renderProjectPtx(options: ProjectTemplateOptions): string;
7
+ export declare function renderPublicationPtx(): string;
8
+ export declare function renderXmlProlog(): string;
@@ -0,0 +1,13 @@
1
+ export interface XmlElementSpan {
2
+ name: string;
3
+ start: number;
4
+ startTagEnd: number;
5
+ contentEnd: number;
6
+ end: number;
7
+ inner: string;
8
+ outer: string;
9
+ attributes: Record<string, string>;
10
+ }
11
+ export declare function findTopLevelElements(source: string, name: string): XmlElementSpan[];
12
+ export declare function findFirstElement(source: string, name: string): XmlElementSpan | null;
13
+ export declare function findAnyElement(source: string, name: string): XmlElementSpan | null;
@@ -0,0 +1,34 @@
1
+ import { CleaningWarning } from '../clean/warnings';
2
+ import { DocumentKind } from '../layout/document-kind';
3
+ import { ImportedProject } from '../types';
4
+ export interface BuildDivisionPoolOptions {
5
+ documentKind?: DocumentKind;
6
+ splitChapters?: boolean;
7
+ splitSections?: boolean;
8
+ /** Binary assets keyed by their original (input) path. */
9
+ assets?: Record<string, Uint8Array>;
10
+ }
11
+ export interface BuildDivisionPoolResult {
12
+ project: ImportedProject;
13
+ warnings: CleaningWarning[];
14
+ }
15
+ /**
16
+ * Coerce a string into a REF_REGEX-safe ref: invalid characters collapse to
17
+ * `-`, leading characters that can't start a ref are stripped. Returns `""`
18
+ * when nothing valid remains.
19
+ */
20
+ export declare function sanitizeRef(raw: string): string;
21
+ /**
22
+ * Parse a converted PreTeXt document
23
+ * (`<pretext><docinfo>…</docinfo><book|article>…`) into the division pool.
24
+ *
25
+ * - `docinfo` and the document `<title>` become project-level fields (the
26
+ * plus data model); the file-tree serializer re-inlines them.
27
+ * - With `splitChapters` (default for books), each `<chapter>` becomes its
28
+ * own division, replaced in the root by `<plus:chapter ref="…"/>`;
29
+ * `splitSections` does the same for `<section>`s within each chapter.
30
+ * - Every division's wrapper element carries `xml:id` equal to its ref;
31
+ * missing ids are generated (`ch-01`, …), invalid/duplicate ids are
32
+ * sanitized with a warning.
33
+ */
34
+ export declare function buildDivisionPool(pretextSource: string, options?: BuildDivisionPoolOptions): BuildDivisionPoolResult;
@@ -0,0 +1,3 @@
1
+ export { buildDivisionPool, sanitizeRef, type BuildDivisionPoolOptions, type BuildDivisionPoolResult, } from './division-pool';
2
+ export { serializeProjectToFiles, divisionChildRefs, type SerializeProjectFilesOptions, type SerializedProjectFiles, } from './serialize-files';
3
+ export { serializeProjectToPlusPayload } from './serialize-plus';
@@ -0,0 +1,19 @@
1
+ import { ImportedProject } from '../types';
2
+ export interface SerializeProjectFilesOptions {
3
+ mainSourcePath?: string;
4
+ publicationPath?: string;
5
+ projectFilePath?: string;
6
+ /** When false, only source files are emitted (no project/publication). */
7
+ includeScaffold?: boolean;
8
+ }
9
+ export interface SerializedProjectFiles {
10
+ files: Record<string, string>;
11
+ }
12
+ /** The refs of a division's direct children, in document order. */
13
+ export declare function divisionChildRefs(content: string): string[];
14
+ /**
15
+ * Serialize the division pool to a project file tree. Binary assets are not
16
+ * included — they are carried separately on `ImportedProject.assets` and
17
+ * routed by the caller (paths differ per host).
18
+ */
19
+ export declare function serializeProjectToFiles(project: ImportedProject, options?: SerializeProjectFilesOptions): SerializedProjectFiles;
@@ -0,0 +1,10 @@
1
+ import { ImportedProject, PlusProjectPayload } from '../types';
2
+ /**
3
+ * Serialize the division pool to a pretext-plus project payload.
4
+ *
5
+ * The host page maps this onto the Rails endpoints (snake_case
6
+ * `divisions_attributes` / `assets_attributes`, multipart for asset bytes);
7
+ * note that `docinfo` currently requires a follow-up PATCH after create —
8
+ * see SPEC §4.3 for the endpoint mapping and known gaps.
9
+ */
10
+ export declare function serializeProjectToPlusPayload(project: ImportedProject): PlusProjectPayload;
@@ -0,0 +1,124 @@
1
+ import { CleaningWarning } from './clean/warnings';
2
+ import { DocumentKind } from './layout/document-kind';
3
+ export type SourceFormat = "latex" | "markdown" | "pretext";
4
+ export interface ConversionContext {
5
+ sourceFormat: SourceFormat;
6
+ detectedSourceFormat: SourceFormat;
7
+ }
8
+ export interface ConvertedPretextSuccess extends ConversionContext {
9
+ pretextSource: string;
10
+ warnings: CleaningWarning[];
11
+ cleanedNativeSource?: string;
12
+ }
13
+ export interface ConvertedPretextError extends ConversionContext {
14
+ pretextError: string;
15
+ warnings: CleaningWarning[];
16
+ }
17
+ export type ConvertedPretextResult = ConvertedPretextSuccess | ConvertedPretextError;
18
+ export type UploadStatusType = "loading" | "success" | "error";
19
+ export type UploadSourceType = "tex" | "markdown" | "pretext" | "zip" | "tar.gz";
20
+ export interface UploadStatusMessage {
21
+ type: UploadStatusType;
22
+ message: string;
23
+ }
24
+ /**
25
+ * The PreTeXt element type of an imported division. Values match the XML tag
26
+ * name. Only the types the import pipeline currently emits are listed; the
27
+ * pretext-plus editor accepts many more.
28
+ */
29
+ export type ImportedDivisionType = "book" | "article" | "chapter" | "section";
30
+ /**
31
+ * One division record in the intermediate model (SPEC §4.1): a flat pool of
32
+ * divisions whose hierarchy is expressed by `<plus:TYPE ref="…"/>`
33
+ * placeholders inside parent `content` — the same storage model as
34
+ * pretext-plus. The file-tree serializer rewrites placeholders to
35
+ * `<xi:include>`; the plus payload passes them through unchanged.
36
+ */
37
+ export interface ImportedDivision {
38
+ /** The division's `xml:id`; unique within the pool (and vs. asset refs). */
39
+ xmlId: string;
40
+ type: ImportedDivisionType;
41
+ /** Plain-text title (from the division's `<title>`). */
42
+ title: string;
43
+ sourceFormat: SourceFormat;
44
+ /**
45
+ * Full division source including the wrapper element, with direct-child
46
+ * divisions replaced by `<plus:TYPE ref="…"/>` placeholders.
47
+ */
48
+ content: string;
49
+ isRoot: boolean;
50
+ }
51
+ /** A binary asset carried by ref, mirroring pretext-plus's Asset model. */
52
+ export interface ImportedAsset {
53
+ /** Unique among divisions + assets; REF_REGEX-safe. */
54
+ ref: string;
55
+ /** Original basename (used for display / upload filename). */
56
+ fileName: string;
57
+ data: Uint8Array;
58
+ }
59
+ /**
60
+ * The host-independent intermediate model of an imported project
61
+ * (SPEC §4.1). Serialize with `serializeProjectToFiles` (VS Code file tree)
62
+ * or `serializeProjectToPlusPayload` (pretext-plus).
63
+ */
64
+ export interface ImportedProject {
65
+ title: string;
66
+ /** Full `<docinfo>…</docinfo>` element, or `""`. Kept out of division content. */
67
+ docinfo: string;
68
+ documentKind: DocumentKind;
69
+ /** Exactly one division has `isRoot: true`. */
70
+ divisions: ImportedDivision[];
71
+ assets: ImportedAsset[];
72
+ }
73
+ /** One division row of the pretext-plus create/update payload (SPEC §4.3). */
74
+ export interface PlusDivisionRecord {
75
+ /** Client-minted UUID; Rails inserts it as the record's primary key. */
76
+ id: string;
77
+ /** The division's `xml:id` (Rails column `ref`). */
78
+ ref: string;
79
+ source: string;
80
+ sourceFormat: SourceFormat;
81
+ isRoot: boolean;
82
+ }
83
+ /** One asset row of the pretext-plus payload; bytes attach as `file`. */
84
+ export interface PlusAssetRecord {
85
+ id: string;
86
+ ref: string;
87
+ kind: "file";
88
+ /** → `short_description` and the multipart upload filename. */
89
+ fileName: string;
90
+ data: Uint8Array;
91
+ }
92
+ /**
93
+ * Direct camelCase mirror of what pretext-plus's `ProjectsController`
94
+ * permits (`divisions_attributes` / `assets_attributes`) — see SPEC §4.3.
95
+ */
96
+ export interface PlusProjectPayload {
97
+ title: string;
98
+ docinfo: string;
99
+ documentType: DocumentKind;
100
+ divisions: PlusDivisionRecord[];
101
+ assets: PlusAssetRecord[];
102
+ }
103
+ export interface ImportedProjectSuccess extends ConversionContext {
104
+ pretextSource: string;
105
+ sourcePath: string;
106
+ sourceName: string;
107
+ sourceType: UploadSourceType;
108
+ documentKind: DocumentKind;
109
+ /** Intermediate model of the imported project (SPEC §4.1). */
110
+ project: ImportedProject;
111
+ files: Record<string, string>;
112
+ assets: Record<string, Uint8Array>;
113
+ outputFiles: Record<string, string>;
114
+ outputAssets: Record<string, Uint8Array>;
115
+ nativeOutputFiles?: Record<string, string>;
116
+ statusMessages: UploadStatusMessage[];
117
+ warnings: CleaningWarning[];
118
+ }
119
+ export interface ImportedProjectError {
120
+ pretextError: string;
121
+ statusMessages: UploadStatusMessage[];
122
+ warnings: CleaningWarning[];
123
+ }
124
+ export type ImportedProjectResult = ImportedProjectSuccess | ImportedProjectError;