@pretextbook/import 0.6.0 → 0.8.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.
package/dist/react.js CHANGED
@@ -1,149 +1,150 @@
1
- import ve, { useRef as he, useState as g, useMemo as re } from "react";
2
- import { Z as be, a7 as Ne, O as ye, R as ue, h as Ee, _ as Te, N as we, j as ge, E as ke, A as Se } from "./import-mode-C0KIll3S.js";
3
- var ie = { exports: {} }, te = {};
4
- var me;
5
- function Pe() {
6
- if (me) return te;
7
- me = 1;
8
- var l = /* @__PURE__ */ Symbol.for("react.transitional.element"), m = /* @__PURE__ */ Symbol.for("react.fragment");
9
- function f(j, h, c) {
1
+ import Te, { useState as h, useRef as ue, useEffect as ke, useMemo as ae } from "react";
2
+ import { S as Ne, $ as Se, j as Pe, T as Ce, g as Re, h as ye, E as _e, A as Ae } from "./upload-BmErkg8I.js";
3
+ import { f as Fe, e as he } from "./import-mode-BCGuSwkM.js";
4
+ var de = { exports: {} }, re = {};
5
+ var be;
6
+ function Oe() {
7
+ if (be) return re;
8
+ be = 1;
9
+ var s = /* @__PURE__ */ Symbol.for("react.transitional.element"), d = /* @__PURE__ */ Symbol.for("react.fragment");
10
+ function x(b, g, c) {
10
11
  var v = null;
11
- if (c !== void 0 && (v = "" + c), h.key !== void 0 && (v = "" + h.key), "key" in h) {
12
+ if (c !== void 0 && (v = "" + c), g.key !== void 0 && (v = "" + g.key), "key" in g) {
12
13
  c = {};
13
- for (var N in h)
14
- N !== "key" && (c[N] = h[N]);
15
- } else c = h;
16
- return h = c.ref, {
17
- $$typeof: l,
18
- type: j,
14
+ for (var N in g)
15
+ N !== "key" && (c[N] = g[N]);
16
+ } else c = g;
17
+ return g = c.ref, {
18
+ $$typeof: s,
19
+ type: b,
19
20
  key: v,
20
- ref: h !== void 0 ? h : null,
21
+ ref: g !== void 0 ? g : null,
21
22
  props: c
22
23
  };
23
24
  }
24
- return te.Fragment = m, te.jsx = f, te.jsxs = f, te;
25
+ return re.Fragment = d, re.jsx = x, re.jsxs = x, re;
25
26
  }
26
27
  var se = {};
27
- var xe;
28
- function _e() {
29
- return xe || (xe = 1, process.env.NODE_ENV !== "production" && (function() {
30
- function l(t) {
28
+ var ge;
29
+ function Le() {
30
+ return ge || (ge = 1, process.env.NODE_ENV !== "production" && (function() {
31
+ function s(t) {
31
32
  if (t == null) return null;
32
33
  if (typeof t == "function")
33
- return t.$$typeof === M ? null : t.displayName || t.name || null;
34
+ return t.$$typeof === Y ? null : t.displayName || t.name || null;
34
35
  if (typeof t == "string") return t;
35
36
  switch (t) {
36
- case D:
37
+ case L:
37
38
  return "Fragment";
38
- case K:
39
+ case W:
39
40
  return "Profiler";
40
41
  case P:
41
42
  return "StrictMode";
42
- case ae:
43
+ case ne:
43
44
  return "Suspense";
44
- case de:
45
+ case me:
45
46
  return "SuspenseList";
46
- case ne:
47
+ case le:
47
48
  return "Activity";
48
49
  }
49
50
  if (typeof t == "object")
50
51
  switch (typeof t.tag == "number" && console.error(
51
52
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
52
53
  ), t.$$typeof) {
53
- case R:
54
+ case A:
54
55
  return "Portal";
55
56
  case S:
56
57
  return t.displayName || "Context";
57
- case d:
58
+ case p:
58
59
  return (t._context.displayName || "Context") + ".Consumer";
59
- case A:
60
- var r = t.render;
61
- return t = t.displayName, t || (t = r.displayName || r.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
62
- case J:
63
- return r = t.displayName || null, r !== null ? r : l(t.type) || "Memo";
64
- case V:
65
- r = t._payload, t = t._init;
60
+ case F:
61
+ var a = t.render;
62
+ return t = t.displayName, t || (t = a.displayName || a.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
63
+ case H:
64
+ return a = t.displayName || null, a !== null ? a : s(t.type) || "Memo";
65
+ case z:
66
+ a = t._payload, t = t._init;
66
67
  try {
67
- return l(t(r));
68
+ return s(t(a));
68
69
  } catch {
69
70
  }
70
71
  }
71
72
  return null;
72
73
  }
73
- function m(t) {
74
+ function d(t) {
74
75
  return "" + t;
75
76
  }
76
- function f(t) {
77
+ function x(t) {
77
78
  try {
78
- m(t);
79
- var r = !1;
79
+ d(t);
80
+ var a = !1;
80
81
  } catch {
81
- r = !0;
82
+ a = !0;
82
83
  }
83
- if (r) {
84
- r = console;
85
- var u = r.error, b = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
86
- return u.call(
87
- r,
84
+ if (a) {
85
+ a = console;
86
+ var m = a.error, u = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
87
+ return m.call(
88
+ a,
88
89
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
89
- b
90
- ), m(t);
90
+ u
91
+ ), d(t);
91
92
  }
92
93
  }
93
- function j(t) {
94
- if (t === D) return "<>";
95
- if (typeof t == "object" && t !== null && t.$$typeof === V)
94
+ function b(t) {
95
+ if (t === L) return "<>";
96
+ if (typeof t == "object" && t !== null && t.$$typeof === z)
96
97
  return "<...>";
97
98
  try {
98
- var r = l(t);
99
- return r ? "<" + r + ">" : "<...>";
99
+ var a = s(t);
100
+ return a ? "<" + a + ">" : "<...>";
100
101
  } catch {
101
102
  return "<...>";
102
103
  }
103
104
  }
104
- function h() {
105
- var t = G.A;
105
+ function g() {
106
+ var t = K.A;
106
107
  return t === null ? null : t.getOwner();
107
108
  }
108
109
  function c() {
109
110
  return Error("react-stack-top-frame");
110
111
  }
111
112
  function v(t) {
112
- if (H.call(t, "key")) {
113
- var r = Object.getOwnPropertyDescriptor(t, "key").get;
114
- if (r && r.isReactWarning) return !1;
113
+ if (Z.call(t, "key")) {
114
+ var a = Object.getOwnPropertyDescriptor(t, "key").get;
115
+ if (a && a.isReactWarning) return !1;
115
116
  }
116
117
  return t.key !== void 0;
117
118
  }
118
- function N(t, r) {
119
- function u() {
120
- I || (I = !0, console.error(
119
+ function N(t, a) {
120
+ function m() {
121
+ D || (D = !0, console.error(
121
122
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
122
- r
123
+ a
123
124
  ));
124
125
  }
125
- u.isReactWarning = !0, Object.defineProperty(t, "key", {
126
- get: u,
126
+ m.isReactWarning = !0, Object.defineProperty(t, "key", {
127
+ get: m,
127
128
  configurable: !0
128
129
  });
129
130
  }
130
- function x() {
131
- var t = l(this.type);
132
- return C[t] || (C[t] = !0, console.error(
131
+ function f() {
132
+ var t = s(this.type);
133
+ return q[t] || (q[t] = !0, console.error(
133
134
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
134
135
  )), t = this.props.ref, t !== void 0 ? t : null;
135
136
  }
136
- function O(t, r, u, b, Y, B) {
137
- var p = u.ref;
137
+ function _(t, a, m, u, $, V) {
138
+ var j = m.ref;
138
139
  return t = {
139
140
  $$typeof: k,
140
141
  type: t,
141
- key: r,
142
- props: u,
143
- _owner: b
144
- }, (p !== void 0 ? p : null) !== null ? Object.defineProperty(t, "ref", {
142
+ key: a,
143
+ props: m,
144
+ _owner: u
145
+ }, (j !== void 0 ? j : null) !== null ? Object.defineProperty(t, "ref", {
145
146
  enumerable: !1,
146
- get: x
147
+ get: f
147
148
  }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
148
149
  configurable: !1,
149
150
  enumerable: !1,
@@ -158,109 +159,150 @@ function _e() {
158
159
  configurable: !1,
159
160
  enumerable: !1,
160
161
  writable: !0,
161
- value: Y
162
+ value: $
162
163
  }), Object.defineProperty(t, "_debugTask", {
163
164
  configurable: !1,
164
165
  enumerable: !1,
165
166
  writable: !0,
166
- value: B
167
+ value: V
167
168
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
168
169
  }
169
- function E(t, r, u, b, Y, B) {
170
- var p = r.children;
171
- if (p !== void 0)
172
- if (b)
173
- if (Z(p)) {
174
- for (b = 0; b < p.length; b++)
175
- _(p[b]);
176
- Object.freeze && Object.freeze(p);
170
+ function w(t, a, m, u, $, V) {
171
+ var j = a.children;
172
+ if (j !== void 0)
173
+ if (u)
174
+ if (Q(j)) {
175
+ for (u = 0; u < j.length; u++)
176
+ R(j[u]);
177
+ Object.freeze && Object.freeze(j);
177
178
  } else
178
179
  console.error(
179
180
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
180
181
  );
181
- else _(p);
182
- if (H.call(r, "key")) {
183
- p = l(t);
184
- var F = Object.keys(r).filter(function(s) {
185
- return s !== "key";
182
+ else R(j);
183
+ if (Z.call(a, "key")) {
184
+ j = s(t);
185
+ var M = Object.keys(a).filter(function(te) {
186
+ return te !== "key";
186
187
  });
187
- b = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", U[p + b] || (F = 0 < F.length ? "{" + F.join(": ..., ") + ": ...}" : "{}", console.error(
188
+ u = 0 < M.length ? "{key: someKey, " + M.join(": ..., ") + ": ...}" : "{key: someKey}", C[j + u] || (M = 0 < M.length ? "{" + M.join(": ..., ") + ": ...}" : "{}", console.error(
188
189
  `A props object containing a "key" prop is being spread into JSX:
189
190
  let props = %s;
190
191
  <%s {...props} />
191
192
  React keys must be passed directly to JSX without using spread:
192
193
  let props = %s;
193
194
  <%s key={someKey} {...props} />`,
194
- b,
195
- p,
196
- F,
197
- p
198
- ), U[p + b] = !0);
195
+ u,
196
+ j,
197
+ M,
198
+ j
199
+ ), C[j + u] = !0);
199
200
  }
200
- if (p = null, u !== void 0 && (f(u), p = "" + u), v(r) && (f(r.key), p = "" + r.key), "key" in r) {
201
- u = {};
202
- for (var ee in r)
203
- ee !== "key" && (u[ee] = r[ee]);
204
- } else u = r;
205
- return p && N(
206
- u,
201
+ if (j = null, m !== void 0 && (x(m), j = "" + m), v(a) && (x(a.key), j = "" + a.key), "key" in a) {
202
+ m = {};
203
+ for (var G in a)
204
+ G !== "key" && (m[G] = a[G]);
205
+ } else m = a;
206
+ return j && N(
207
+ m,
207
208
  typeof t == "function" ? t.displayName || t.name || "Unknown" : t
208
- ), O(
209
+ ), _(
209
210
  t,
210
- p,
211
- u,
212
- h(),
213
- Y,
214
- B
211
+ j,
212
+ m,
213
+ g(),
214
+ $,
215
+ V
215
216
  );
216
217
  }
217
- function _(t) {
218
- L(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === V && (t._payload.status === "fulfilled" ? L(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
218
+ function R(t) {
219
+ O(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === z && (t._payload.status === "fulfilled" ? O(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
219
220
  }
220
- function L(t) {
221
+ function O(t) {
221
222
  return typeof t == "object" && t !== null && t.$$typeof === k;
222
223
  }
223
- var T = ve, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), R = /* @__PURE__ */ Symbol.for("react.portal"), D = /* @__PURE__ */ Symbol.for("react.fragment"), P = /* @__PURE__ */ Symbol.for("react.strict_mode"), K = /* @__PURE__ */ Symbol.for("react.profiler"), d = /* @__PURE__ */ Symbol.for("react.consumer"), S = /* @__PURE__ */ Symbol.for("react.context"), A = /* @__PURE__ */ Symbol.for("react.forward_ref"), ae = /* @__PURE__ */ Symbol.for("react.suspense"), de = /* @__PURE__ */ Symbol.for("react.suspense_list"), J = /* @__PURE__ */ Symbol.for("react.memo"), V = /* @__PURE__ */ Symbol.for("react.lazy"), ne = /* @__PURE__ */ Symbol.for("react.activity"), M = /* @__PURE__ */ Symbol.for("react.client.reference"), G = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, H = Object.prototype.hasOwnProperty, Z = Array.isArray, X = console.createTask ? console.createTask : function() {
224
+ var E = Te, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), A = /* @__PURE__ */ Symbol.for("react.portal"), L = /* @__PURE__ */ Symbol.for("react.fragment"), P = /* @__PURE__ */ Symbol.for("react.strict_mode"), W = /* @__PURE__ */ Symbol.for("react.profiler"), p = /* @__PURE__ */ Symbol.for("react.consumer"), S = /* @__PURE__ */ Symbol.for("react.context"), F = /* @__PURE__ */ Symbol.for("react.forward_ref"), ne = /* @__PURE__ */ Symbol.for("react.suspense"), me = /* @__PURE__ */ Symbol.for("react.suspense_list"), H = /* @__PURE__ */ Symbol.for("react.memo"), z = /* @__PURE__ */ Symbol.for("react.lazy"), le = /* @__PURE__ */ Symbol.for("react.activity"), Y = /* @__PURE__ */ Symbol.for("react.client.reference"), K = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Z = Object.prototype.hasOwnProperty, Q = Array.isArray, U = console.createTask ? console.createTask : function() {
224
225
  return null;
225
226
  };
226
- T = {
227
+ E = {
227
228
  react_stack_bottom_frame: function(t) {
228
229
  return t();
229
230
  }
230
231
  };
231
- var I, C = {}, Q = T.react_stack_bottom_frame.bind(
232
- T,
232
+ var D, q = {}, ee = E.react_stack_bottom_frame.bind(
233
+ E,
233
234
  c
234
- )(), z = X(j(c)), U = {};
235
- se.Fragment = D, se.jsx = function(t, r, u) {
236
- var b = 1e4 > G.recentlyCreatedOwnerStacks++;
237
- return E(
235
+ )(), I = U(b(c)), C = {};
236
+ se.Fragment = L, se.jsx = function(t, a, m) {
237
+ var u = 1e4 > K.recentlyCreatedOwnerStacks++;
238
+ return w(
238
239
  t,
239
- r,
240
- u,
240
+ a,
241
+ m,
241
242
  !1,
242
- b ? Error("react-stack-top-frame") : Q,
243
- b ? X(j(t)) : z
243
+ u ? Error("react-stack-top-frame") : ee,
244
+ u ? U(b(t)) : I
244
245
  );
245
- }, se.jsxs = function(t, r, u) {
246
- var b = 1e4 > G.recentlyCreatedOwnerStacks++;
247
- return E(
246
+ }, se.jsxs = function(t, a, m) {
247
+ var u = 1e4 > K.recentlyCreatedOwnerStacks++;
248
+ return w(
248
249
  t,
249
- r,
250
- u,
250
+ a,
251
+ m,
251
252
  !0,
252
- b ? Error("react-stack-top-frame") : Q,
253
- b ? X(j(t)) : z
253
+ u ? Error("react-stack-top-frame") : ee,
254
+ u ? U(b(t)) : I
254
255
  );
255
256
  };
256
257
  })()), se;
257
258
  }
258
- var pe;
259
- function Re() {
260
- return pe || (pe = 1, process.env.NODE_ENV === "production" ? ie.exports = Pe() : ie.exports = _e()), ie.exports;
259
+ var je;
260
+ function De() {
261
+ return je || (je = 1, process.env.NODE_ENV === "production" ? de.exports = Oe() : de.exports = Le()), de.exports;
262
+ }
263
+ var e = De();
264
+ function Ie() {
265
+ const [s, d] = h(0), x = ue(Date.now());
266
+ return ke(() => {
267
+ const b = setInterval(() => {
268
+ d(Math.floor((Date.now() - x.current) / 1e3));
269
+ }, 1e3);
270
+ return () => clearInterval(b);
271
+ }, []), s;
272
+ }
273
+ function $e(s) {
274
+ return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
275
+ }
276
+ function Me({
277
+ message: s = "Processing your file…",
278
+ onCancel: d
279
+ }) {
280
+ const x = Ie();
281
+ return /* @__PURE__ */ e.jsxs(
282
+ "div",
283
+ {
284
+ className: "flex flex-col items-center justify-center gap-3 py-16 text-slate-600",
285
+ role: "status",
286
+ "aria-live": "polite",
287
+ children: [
288
+ /* @__PURE__ */ e.jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-2 border-blue-700 border-t-transparent" }),
289
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm", children: s }),
290
+ /* @__PURE__ */ e.jsx("p", { className: "text-xs tabular-nums text-slate-500", children: $e(x) }),
291
+ x >= 10 ? /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-xs text-slate-500", children: "Large documents can take a while. You can keep working in other tabs." }) : null,
292
+ d ? /* @__PURE__ */ e.jsx(
293
+ "button",
294
+ {
295
+ type: "button",
296
+ onClick: d,
297
+ className: "mt-2 rounded border border-slate-300 px-3 py-1.5 text-xs font-medium text-slate-700 hover:bg-slate-50",
298
+ children: "Cancel"
299
+ }
300
+ ) : null
301
+ ]
302
+ }
303
+ );
261
304
  }
262
- var e = Re();
263
- const je = [
305
+ const we = [
264
306
  ".tex",
265
307
  ".md",
266
308
  ".markdown",
@@ -270,125 +312,149 @@ const je = [
270
312
  ".gz",
271
313
  ".tar.gz",
272
314
  ".tgz"
273
- ], Ce = {
315
+ ], Xe = {
274
316
  id: "builtin",
275
317
  label: "Built-in converter",
276
318
  description: "Create a new project starting with LaTeX, Markdown, or PreTeXt files.",
277
- acceptExtensions: je,
278
- convertFile: be,
279
- prepare: async (l) => {
280
- const { files: m, assets: f } = await we(l);
319
+ acceptExtensions: we,
320
+ convertFile: Ne,
321
+ prepare: async (s) => {
322
+ const { files: d, assets: x } = await Re(s);
281
323
  return {
282
- fileName: l.name,
283
- files: m,
284
- assets: f,
285
- analysis: ge(m)
324
+ fileName: s.name,
325
+ files: d,
326
+ assets: x,
327
+ analysis: ye(d)
286
328
  };
287
329
  },
288
- convertPrepared: (l, m) => Te(l.files, {
289
- ...m,
290
- assets: l.assets
330
+ convertPrepared: (s, d) => Ce(s.files, {
331
+ ...d,
332
+ assets: s.assets
291
333
  })
292
- }, fe = {
334
+ };
335
+ function xe() {
336
+ return new Promise((s) => {
337
+ if (typeof requestAnimationFrame != "function") {
338
+ setTimeout(s, 0);
339
+ return;
340
+ }
341
+ requestAnimationFrame(() => setTimeout(s, 0));
342
+ });
343
+ }
344
+ const ve = {
293
345
  pretext: "PreTeXt",
294
346
  latex: "LaTeX",
295
347
  markdown: "Markdown"
296
348
  };
297
- function Ae(l) {
298
- const m = l.reason === "manifest-target" ? `project.ptx target “${l.targetName}”` : l.reason === "latex-root" ? "LaTeX document" : l.reason === "pretext-root" ? "PreTeXt document" : l.reason === "markdown-root" ? "Markdown document" : "possible document";
299
- return l.title ? `${l.title} — ${m}` : m;
349
+ function ze(s) {
350
+ const d = s.reason === "manifest-target" ? `project.ptx target “${s.targetName}”` : s.reason === "latex-root" ? "LaTeX document" : s.reason === "pretext-root" ? "PreTeXt document" : s.reason === "markdown-root" ? "Markdown document" : "possible document";
351
+ return s.title ? `${s.title} — ${d}` : d;
300
352
  }
301
- function Fe(l) {
302
- return l.candidates.filter(
303
- (f) => f.reason === "manifest-target"
304
- ).length > 1 ? !0 : l.manifest && l.primary?.reason === "manifest-target" ? !1 : l.formats.length > 1 || l.candidates.length > 1 || l.extraRoots.length > 0;
353
+ function Ye(s) {
354
+ return s.candidates.filter(
355
+ (x) => x.reason === "manifest-target"
356
+ ).length > 1 ? !0 : s.manifest && s.primary?.reason === "manifest-target" ? !1 : s.formats.length > 1 || s.candidates.length > 1 || s.extraRoots.length > 0;
305
357
  }
306
- function Me({
307
- onConfirm: l,
308
- onCancel: m,
309
- importOptions: f,
310
- defaultDocumentKind: j = "auto",
311
- engines: h
358
+ function Ge({
359
+ onConfirm: s,
360
+ onCancel: d,
361
+ importOptions: x,
362
+ defaultDocumentKind: b = "auto",
363
+ engines: g
312
364
  }) {
313
- const c = h && h.length > 0 ? h : [Ce], v = he(null), [N, x] = g({ name: "upload" }), [O, E] = g(!1), [_, L] = g(j), [T, k] = g(null), [R, D] = g(/* @__PURE__ */ new Set()), [P, K] = g(c[0].id), [d, S] = g("converted"), [A, ae] = g(!1), [de, J] = g(/* @__PURE__ */ new Set()), [V, ne] = g(null), [M, G] = g(
365
+ const c = g && g.length > 0 ? g : [Xe], v = ue(null), [N, f] = h({ name: "upload" }), [_, w] = h(!1), [R, O] = h(b), [E, k] = h(null), [A, L] = h(/* @__PURE__ */ new Set()), [P, W] = h(c[0].id), [p, S] = h("converted"), [F, ne] = h(!1), [me, H] = h(/* @__PURE__ */ new Set()), [z, le] = h(null), [Y, K] = h(
314
366
  "auto"
315
- ), [H, Z] = g(null), [X, I] = g({}), C = c.find((s) => s.id === P) ?? c[0], Q = C.acceptExtensions ?? je, z = N.name === "review" ? N.result : null, U = re(
316
- () => z && T !== null ? Ne(z, T) : z,
317
- [z, T]
318
- ), t = re(
367
+ ), [Z, Q] = h(null), [U, D] = h({}), [q, ee] = h(!1), I = ue(!1), C = c.find((r) => r.id === P) ?? c[0], t = C.acceptExtensions ?? we, a = N.name === "review" ? N.result : null, m = ae(
368
+ () => a && E !== null ? Se(a, E) : a,
369
+ [a, E]
370
+ ), u = ae(
319
371
  () => new Map(
320
- U ? ye(U).map((s) => [s.path, s]) : []
372
+ m ? Fe(m).map((r) => [r.path, r]) : []
321
373
  ),
322
- [U]
323
- ), r = () => f ?? {
324
- documentKind: _ === "auto" ? void 0 : _
325
- }, u = (s) => ge(s.files, {
326
- sourceFormat: M === "auto" ? void 0 : M,
327
- mainFile: H ?? void 0
328
- }), b = (s) => {
329
- x({ name: "processing" });
374
+ [m]
375
+ ), $ = () => x ?? {
376
+ documentKind: R === "auto" ? void 0 : R
377
+ }, V = (r) => ye(r.files, {
378
+ sourceFormat: Y === "auto" ? void 0 : Y,
379
+ mainFile: Z ?? void 0
380
+ }), j = (r) => {
381
+ I.current = !0, C.cancel?.(), f(
382
+ r ? { name: "sources", prepared: r } : { name: "upload" }
383
+ );
384
+ }, M = async (r) => {
385
+ I.current = !1, f({ name: "processing" }), await xe();
330
386
  try {
331
- const n = u(s).extraRoots.map((i) => ({
387
+ const l = V(r).extraRoots.map((i) => ({
332
388
  path: i.path,
333
- include: X[i.path]?.include ?? !0,
334
- level: X[i.path]?.level
335
- })), y = C.convertPrepared(s, {
336
- ...r(),
337
- sourceFormat: M === "auto" ? void 0 : M,
338
- mainFile: H ?? void 0,
339
- attachRoots: n
389
+ include: U[i.path]?.include ?? !0,
390
+ level: U[i.path]?.level
391
+ })), y = await C.convertPrepared(r, {
392
+ ...$(),
393
+ sourceFormat: Y === "auto" ? void 0 : Y,
394
+ mainFile: Z ?? void 0,
395
+ attachRoots: l
340
396
  });
341
- "pretextError" in y ? x({ name: "error", message: y.pretextError }) : x({ name: "review", result: y });
397
+ "pretextError" in y ? f({ name: "error", message: y.pretextError }) : f({ name: "review", result: y });
342
398
  } catch (o) {
343
- x({
399
+ if (I.current)
400
+ return;
401
+ f({
344
402
  name: "error",
345
403
  message: o instanceof Error ? o.message : "An unexpected error occurred."
346
404
  });
347
405
  }
348
- }, Y = async (s) => {
349
- x({ name: "processing" });
406
+ }, G = async (r) => {
407
+ I.current = !1, f({ name: "processing" }), await xe();
350
408
  try {
351
409
  if (C.prepare && C.convertPrepared) {
352
- const n = await C.prepare(s);
353
- if (ne(n), G("auto"), Z(null), I({}), Fe(n.analysis)) {
354
- x({ name: "sources", prepared: n });
410
+ const l = await C.prepare(r);
411
+ if (le(l), K("auto"), Q(null), D({}), Ye(l.analysis)) {
412
+ f({ name: "sources", prepared: l });
355
413
  return;
356
414
  }
357
- const y = C.convertPrepared(n, r());
358
- x(
415
+ await xe();
416
+ const y = await C.convertPrepared(
417
+ l,
418
+ $()
419
+ );
420
+ f(
359
421
  "pretextError" in y ? { name: "error", message: y.pretextError } : { name: "review", result: y }
360
422
  );
361
423
  return;
362
424
  }
363
- const o = await C.convertFile(s, r());
364
- "pretextError" in o ? x({ name: "error", message: o.pretextError }) : x({ name: "review", result: o });
425
+ const o = await C.convertFile(r, $());
426
+ "pretextError" in o ? f({ name: "error", message: o.pretextError }) : f({ name: "review", result: o });
365
427
  } catch (o) {
366
- x({
428
+ if (I.current)
429
+ return;
430
+ f({
367
431
  name: "error",
368
432
  message: o instanceof Error ? o.message : "An unexpected error occurred."
369
433
  });
370
434
  }
371
- }, B = () => {
372
- x({ name: "upload" }), S("converted"), ae(!1), J(/* @__PURE__ */ new Set()), D(/* @__PURE__ */ new Set()), k(null), ne(null);
435
+ }, te = () => {
436
+ f({ name: "upload" }), S("converted"), ne(!1), H(/* @__PURE__ */ new Set()), L(/* @__PURE__ */ new Set()), k(null), le(null);
373
437
  };
374
- function p(s, o) {
375
- return [...s].sort((n, y) => n === o ? -1 : y === o ? 1 : n.localeCompare(y));
438
+ function pe(r, o) {
439
+ return [...r].sort((l, y) => l === o ? -1 : y === o ? 1 : l.localeCompare(y));
376
440
  }
377
- function F(s, o) {
378
- const n = ue(s, o), y = o === "converted" ? s.projectLayout.mainSourcePath : s.sourcePath, i = p(Object.keys(n), y)[0];
379
- J(i ? /* @__PURE__ */ new Set([i]) : /* @__PURE__ */ new Set());
441
+ function fe(r, o) {
442
+ const l = he(r, o), y = o === "converted" ? r.projectLayout.mainSourcePath : r.sourcePath, i = pe(Object.keys(l), y)[0];
443
+ H(i ? /* @__PURE__ */ new Set([i]) : /* @__PURE__ */ new Set());
380
444
  }
381
- function ee(s) {
382
- J((o) => {
383
- const n = new Set(o);
384
- return n.has(s) ? n.delete(s) : n.add(s), n;
445
+ function Ee(r) {
446
+ H((o) => {
447
+ const l = new Set(o);
448
+ return l.has(r) ? l.delete(r) : l.add(r), l;
385
449
  });
386
450
  }
387
451
  if (N.name === "processing")
388
- return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-slate-600", children: [
389
- /* @__PURE__ */ e.jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-2 border-blue-700 border-t-transparent" }),
390
- /* @__PURE__ */ e.jsx("p", { className: "text-sm", children: "Processing your file…" })
391
- ] });
452
+ return /* @__PURE__ */ e.jsx(
453
+ Me,
454
+ {
455
+ onCancel: C.cancel ? () => j(z) : void 0
456
+ }
457
+ );
392
458
  if (N.name === "error")
393
459
  return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
394
460
  /* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-800", children: [
@@ -399,32 +465,32 @@ function Me({
399
465
  "button",
400
466
  {
401
467
  type: "button",
402
- onClick: B,
468
+ onClick: te,
403
469
  className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
404
470
  children: "Try Another File"
405
471
  }
406
472
  ) })
407
473
  ] });
408
474
  if (N.name === "sources") {
409
- const s = N.prepared, o = u(s), n = o.manifest, y = o.primary?.path ?? "";
475
+ const r = N.prepared, o = V(r), l = o.manifest, y = o.primary?.path ?? "";
410
476
  return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
411
477
  /* @__PURE__ */ e.jsxs("div", { children: [
412
478
  /* @__PURE__ */ e.jsx("h3", { className: "text-sm font-semibold text-slate-700", children: "Choose what to import" }),
413
479
  /* @__PURE__ */ e.jsxs("p", { className: "mt-1 text-sm text-slate-500", children: [
414
- s.fileName,
480
+ r.fileName,
415
481
  " contains more than one possible starting point."
416
482
  ] })
417
483
  ] }),
418
- n ? /* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-blue-200 bg-blue-50 p-4 text-sm text-blue-900", children: [
484
+ l ? /* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-blue-200 bg-blue-50 p-4 text-sm text-blue-900", children: [
419
485
  /* @__PURE__ */ e.jsxs("p", { className: "font-medium", children: [
420
486
  "Found ",
421
- n.manifestPath,
487
+ l.manifestPath,
422
488
  " — an existing PreTeXt project."
423
489
  ] }),
424
490
  /* @__PURE__ */ e.jsxs("p", { className: "mt-1 text-blue-800", children: [
425
491
  "Its publication file, assets, and directory layout will be kept as they are. Targets:",
426
492
  " ",
427
- n.targets.map((i) => i.name).join(", "),
493
+ l.targets.map((i) => i.name).join(", "),
428
494
  "."
429
495
  ] })
430
496
  ] }) : null,
@@ -433,17 +499,17 @@ function Me({
433
499
  /* @__PURE__ */ e.jsxs(
434
500
  "select",
435
501
  {
436
- value: M,
502
+ value: Y,
437
503
  onChange: (i) => {
438
- G(i.currentTarget.value), Z(null), I({});
504
+ K(i.currentTarget.value), Q(null), D({});
439
505
  },
440
506
  className: "rounded border border-slate-300 px-2 py-1 text-sm",
441
507
  children: [
442
508
  /* @__PURE__ */ e.jsxs("option", { value: "auto", children: [
443
509
  "Auto detect",
444
- o.primary ? ` (${fe[o.primary.format]})` : ""
510
+ o.primary ? ` (${ve[o.primary.format]})` : ""
445
511
  ] }),
446
- o.formats.map((i) => /* @__PURE__ */ e.jsx("option", { value: i, children: fe[i] }, i))
512
+ o.formats.map((i) => /* @__PURE__ */ e.jsx("option", { value: i, children: ve[i] }, i))
447
513
  ]
448
514
  }
449
515
  )
@@ -463,14 +529,14 @@ function Me({
463
529
  value: i.path,
464
530
  checked: y === i.path,
465
531
  onChange: () => {
466
- Z(i.path), I({});
532
+ Q(i.path), D({});
467
533
  },
468
534
  className: "mt-0.5"
469
535
  }
470
536
  ),
471
537
  /* @__PURE__ */ e.jsxs("span", { children: [
472
538
  /* @__PURE__ */ e.jsx("span", { className: "font-mono text-xs text-slate-900", children: i.path }),
473
- /* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children: Ae(i) })
539
+ /* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children: ze(i) })
474
540
  ] })
475
541
  ]
476
542
  },
@@ -481,7 +547,7 @@ function Me({
481
547
  /* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Other documents" }),
482
548
  /* @__PURE__ */ e.jsx("p", { className: "mt-1 text-sm text-slate-500", children: "These files also stand on their own. Attach them to the main document, or leave them out." }),
483
549
  /* @__PURE__ */ e.jsx("div", { className: "mt-3 flex flex-col gap-2", children: o.extraRoots.map((i) => {
484
- const q = X[i.path], le = q?.include ?? !0;
550
+ const J = U[i.path], oe = J?.include ?? !0;
485
551
  return /* @__PURE__ */ e.jsxs(
486
552
  "div",
487
553
  {
@@ -492,12 +558,12 @@ function Me({
492
558
  "input",
493
559
  {
494
560
  type: "checkbox",
495
- checked: le,
496
- onChange: ($) => I((W) => ({
497
- ...W,
561
+ checked: oe,
562
+ onChange: (X) => D((B) => ({
563
+ ...B,
498
564
  [i.path]: {
499
- ...W[i.path],
500
- include: $.currentTarget.checked
565
+ ...B[i.path],
566
+ include: X.currentTarget.checked
501
567
  }
502
568
  }))
503
569
  }
@@ -513,13 +579,13 @@ function Me({
513
579
  /* @__PURE__ */ e.jsxs(
514
580
  "select",
515
581
  {
516
- value: q?.level ?? "auto",
517
- disabled: !le,
518
- onChange: ($) => I((W) => ({
519
- ...W,
582
+ value: J?.level ?? "auto",
583
+ disabled: !oe,
584
+ onChange: (X) => D((B) => ({
585
+ ...B,
520
586
  [i.path]: {
521
- include: W[i.path]?.include ?? !0,
522
- level: $.currentTarget.value === "auto" ? void 0 : $.currentTarget.value
587
+ include: B[i.path]?.include ?? !0,
588
+ level: X.currentTarget.value === "auto" ? void 0 : X.currentTarget.value
523
589
  }
524
590
  })),
525
591
  className: "rounded border border-slate-300 px-2 py-1 text-sm disabled:opacity-50",
@@ -542,7 +608,7 @@ function Me({
542
608
  "button",
543
609
  {
544
610
  type: "button",
545
- onClick: B,
611
+ onClick: te,
546
612
  className: "px-4 py-2 text-sm text-slate-600 hover:text-slate-900",
547
613
  children: "Start Over"
548
614
  }
@@ -551,7 +617,7 @@ function Me({
551
617
  "button",
552
618
  {
553
619
  type: "button",
554
- onClick: () => b(s),
620
+ onClick: () => M(r),
555
621
  className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
556
622
  children: "Continue"
557
623
  }
@@ -560,53 +626,53 @@ function Me({
560
626
  ] });
561
627
  }
562
628
  if (N.name === "review") {
563
- let s = function(a) {
564
- S(a), A && F(n, a);
565
- }, o = function(a) {
566
- D((w) => {
567
- const ce = new Set(w);
568
- return ce.has(a) ? ce.delete(a) : ce.add(a), ce;
629
+ let r = function(n) {
630
+ S(n), F && fe(l, n);
631
+ }, o = function(n) {
632
+ L((T) => {
633
+ const ie = new Set(T);
634
+ return ie.has(n) ? ie.delete(n) : ie.add(n), ie;
569
635
  });
570
636
  };
571
- const n = U ?? N.result, y = n.splitLevel, i = n.detectedSourceFormat === "latex", q = n.warnings.length, le = Object.keys(n.outputFiles).length, $ = ue(n, d), W = d === "converted" ? n.projectLayout.mainSourcePath : n.sourcePath, oe = p(
572
- Object.keys($),
573
- W
637
+ const l = m ?? N.result, y = l.splitLevel, i = l.detectedSourceFormat === "latex", J = l.warnings.length, oe = Object.keys(l.outputFiles).length, X = he(l, p), B = p === "converted" ? l.projectLayout.mainSourcePath : l.sourcePath, ce = pe(
638
+ Object.keys(X),
639
+ B
574
640
  );
575
641
  return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
576
642
  /* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border border-slate-200 bg-slate-50 p-4", children: [
577
643
  /* @__PURE__ */ e.jsx("h3", { className: "mb-3 text-sm font-semibold text-slate-700", children: "Import Summary" }),
578
644
  /* @__PURE__ */ e.jsxs("dl", { className: "grid grid-cols-2 gap-x-6 gap-y-2 text-sm", children: [
579
645
  /* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Source" }),
580
- /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: n.sourceName }),
646
+ /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: l.sourceName }),
581
647
  /* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Detected format" }),
582
- /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children: n.detectedSourceFormat }),
648
+ /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children: l.detectedSourceFormat }),
583
649
  /* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Document kind" }),
584
- /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children: n.documentKind }),
650
+ /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900 capitalize", children: l.documentKind }),
585
651
  /* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Output files" }),
586
- /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: le }),
587
- n.projectLayout.preserved ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
652
+ /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: oe }),
653
+ l.projectLayout.preserved ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
588
654
  /* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Existing project" }),
589
655
  /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: "Kept publication file, assets, and layout" })
590
656
  ] }) : null,
591
- n.attachedRoots.length > 0 ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
657
+ l.attachedRoots.length > 0 ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
592
658
  /* @__PURE__ */ e.jsx("dt", { className: "text-slate-500", children: "Attached" }),
593
- /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: n.attachedRoots.map((a) => `${a.title} (${a.level})`).join(", ") })
659
+ /* @__PURE__ */ e.jsx("dd", { className: "font-medium text-slate-900", children: l.attachedRoots.map((n) => `${n.title} (${n.level})`).join(", ") })
594
660
  ] }) : null
595
661
  ] })
596
662
  ] }),
597
- q > 0 ? /* @__PURE__ */ e.jsxs("details", { className: "rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm", children: [
663
+ J > 0 ? /* @__PURE__ */ e.jsxs("details", { className: "rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm", children: [
598
664
  /* @__PURE__ */ e.jsxs("summary", { className: "cursor-pointer font-semibold text-amber-800", children: [
599
- q,
665
+ J,
600
666
  " conversion",
601
667
  " ",
602
- q === 1 ? "warning" : "warnings"
668
+ J === 1 ? "warning" : "warnings"
603
669
  ] }),
604
- /* @__PURE__ */ e.jsx("ul", { className: "mt-3 space-y-1.5 text-amber-700", children: n.warnings.map((a, w) => /* @__PURE__ */ e.jsxs("li", { children: [
605
- /* @__PURE__ */ e.jsx("code", { className: "rounded bg-amber-100 px-1 py-0.5 text-xs", children: a.macro }),
670
+ /* @__PURE__ */ e.jsx("ul", { className: "mt-3 space-y-1.5 text-amber-700", children: l.warnings.map((n, T) => /* @__PURE__ */ e.jsxs("li", { children: [
671
+ /* @__PURE__ */ e.jsx("code", { className: "rounded bg-amber-100 px-1 py-0.5 text-xs", children: n.macro }),
606
672
  " — ",
607
- a.action === "replace" || a.action === "rewrite" ? `replaced with \`${a.replacement}\`` : a.message ?? a.action,
608
- a.occurrences > 1 ? ` (×${a.occurrences})` : null
609
- ] }, w)) })
673
+ n.action === "replace" || n.action === "rewrite" ? `replaced with \`${n.replacement}\`` : n.message ?? n.action,
674
+ n.occurrences > 1 ? ` (×${n.occurrences})` : null
675
+ ] }, T)) })
610
676
  ] }) : /* @__PURE__ */ e.jsx("p", { className: "text-sm text-green-700", children: "No conversion warnings." }),
611
677
  i ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
612
678
  /* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Import mode" }),
@@ -618,8 +684,8 @@ function Me({
618
684
  type: "radio",
619
685
  name: "import-mode",
620
686
  value: "converted",
621
- checked: d === "converted",
622
- onChange: () => s("converted"),
687
+ checked: p === "converted",
688
+ onChange: () => r("converted"),
623
689
  className: "mt-0.5"
624
690
  }
625
691
  ),
@@ -635,8 +701,8 @@ function Me({
635
701
  type: "radio",
636
702
  name: "import-mode",
637
703
  value: "native",
638
- checked: d === "native",
639
- onChange: () => s("native"),
704
+ checked: p === "native",
705
+ onChange: () => r("native"),
640
706
  className: "mt-0.5"
641
707
  }
642
708
  ),
@@ -647,40 +713,40 @@ function Me({
647
713
  ] })
648
714
  ] })
649
715
  ] }) : null,
650
- !f && n.cleanChunks.length > 0 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
716
+ !x && l.cleanChunks.length > 0 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
651
717
  /* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Split into files" }),
652
718
  /* @__PURE__ */ e.jsxs("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: [
653
719
  Array.from(
654
- { length: Ee + 1 },
655
- (a, w) => /* @__PURE__ */ e.jsx(
720
+ { length: Pe + 1 },
721
+ (n, T) => /* @__PURE__ */ e.jsx(
656
722
  "button",
657
723
  {
658
724
  type: "button",
659
- onClick: () => k(w),
660
- "aria-pressed": y === w,
661
- className: y === w ? "rounded bg-blue-700 px-3 py-1 text-sm font-medium text-white" : "rounded border border-slate-300 px-3 py-1 text-sm text-slate-700 hover:bg-slate-50",
662
- children: w === 0 ? "One file" : `${w} level${w === 1 ? "" : "s"}`
725
+ onClick: () => k(T),
726
+ "aria-pressed": y === T,
727
+ className: y === T ? "rounded bg-blue-700 px-3 py-1 text-sm font-medium text-white" : "rounded border border-slate-300 px-3 py-1 text-sm text-slate-700 hover:bg-slate-50",
728
+ children: T === 0 ? "One file" : `${T} level${T === 1 ? "" : "s"}`
663
729
  },
664
- w
730
+ T
665
731
  )
666
732
  ),
667
733
  /* @__PURE__ */ e.jsxs("span", { className: "ml-2 text-sm text-slate-500", children: [
668
- oe.length,
734
+ ce.length,
669
735
  " file",
670
- oe.length === 1 ? "" : "s"
736
+ ce.length === 1 ? "" : "s"
671
737
  ] })
672
738
  ] }),
673
- /* @__PURE__ */ e.jsx("ul", { className: "mt-3 max-h-48 overflow-auto font-mono text-xs text-slate-600", children: oe.map((a) => /* @__PURE__ */ e.jsxs("li", { className: "truncate py-0.5", children: [
674
- a,
675
- t.get(a)?.fixCount ? /* @__PURE__ */ e.jsxs("span", { className: "ml-2 text-amber-700", children: [
676
- t.get(a).fixCount,
739
+ /* @__PURE__ */ e.jsx("ul", { className: "mt-3 max-h-48 overflow-auto font-mono text-xs text-slate-600", children: ce.map((n) => /* @__PURE__ */ e.jsxs("li", { className: "truncate py-0.5", children: [
740
+ n,
741
+ u.get(n)?.fixCount ? /* @__PURE__ */ e.jsxs("span", { className: "ml-2 text-amber-700", children: [
742
+ u.get(n).fixCount,
677
743
  " change",
678
- t.get(a).fixCount === 1 ? "" : "s"
744
+ u.get(n).fixCount === 1 ? "" : "s"
679
745
  ] }) : null
680
- ] }, a)) })
746
+ ] }, n)) })
681
747
  ] }) : null,
682
- A ? /* @__PURE__ */ e.jsx("div", { className: "overflow-hidden rounded-lg border border-slate-200 text-sm", children: oe.map((a) => {
683
- const w = de.has(a);
748
+ F ? /* @__PURE__ */ e.jsx("div", { className: "overflow-hidden rounded-lg border border-slate-200 text-sm", children: ce.map((n) => {
749
+ const T = me.has(n);
684
750
  return /* @__PURE__ */ e.jsxs(
685
751
  "div",
686
752
  {
@@ -690,42 +756,42 @@ function Me({
690
756
  "button",
691
757
  {
692
758
  type: "button",
693
- onClick: () => ee(a),
759
+ onClick: () => Ee(n),
694
760
  className: "flex w-full items-center gap-2 bg-slate-100 px-4 py-2 text-left font-mono text-xs text-slate-700 hover:bg-slate-200",
695
761
  children: [
696
- /* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-slate-400", children: w ? "▾" : "▸" }),
697
- /* @__PURE__ */ e.jsx("span", { className: "flex-1 truncate", children: a }),
762
+ /* @__PURE__ */ e.jsx("span", { className: "shrink-0 text-slate-400", children: T ? "▾" : "▸" }),
763
+ /* @__PURE__ */ e.jsx("span", { className: "flex-1 truncate", children: n }),
698
764
  /* @__PURE__ */ e.jsxs("span", { className: "shrink-0 text-slate-400", children: [
699
- ($[a].length / 1024).toFixed(1),
765
+ (X[n].length / 1024).toFixed(1),
700
766
  " KB"
701
767
  ] })
702
768
  ]
703
769
  }
704
770
  ),
705
- w ? /* @__PURE__ */ e.jsxs("div", { className: "bg-white", children: [
706
- t.get(a)?.hunks.length ? /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 border-b border-slate-200 px-4 py-2", children: [
771
+ T ? /* @__PURE__ */ e.jsxs("div", { className: "bg-white", children: [
772
+ u.get(n)?.hunks.length ? /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 border-b border-slate-200 px-4 py-2", children: [
707
773
  /* @__PURE__ */ e.jsx(
708
774
  "button",
709
775
  {
710
776
  type: "button",
711
- onClick: () => o(a),
777
+ onClick: () => o(n),
712
778
  className: "rounded border border-slate-300 px-2 py-0.5 text-xs text-slate-700 hover:bg-slate-50",
713
- children: R.has(a) ? "Show converted file" : "Show what changed"
779
+ children: A.has(n) ? "Show converted file" : "Show what changed"
714
780
  }
715
781
  ),
716
782
  /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-slate-500", children: [
717
783
  "+",
718
- t.get(a).stats.added,
784
+ u.get(n).stats.added,
719
785
  " −",
720
- t.get(a).stats.removed,
786
+ u.get(n).stats.removed,
721
787
  " in the LaTeX source"
722
788
  ] })
723
789
  ] }) : null,
724
- R.has(a) && t.has(a) ? /* @__PURE__ */ e.jsx(Oe, { hunks: t.get(a).hunks }) : /* @__PURE__ */ e.jsx("pre", { className: "m-0 max-h-72 overflow-auto p-4 font-mono text-xs leading-relaxed text-slate-800", children: $[a] })
790
+ A.has(n) && u.has(n) ? /* @__PURE__ */ e.jsx(Ue, { hunks: u.get(n).hunks }) : /* @__PURE__ */ e.jsx("pre", { className: "m-0 max-h-72 overflow-auto p-4 font-mono text-xs leading-relaxed text-slate-800", children: X[n] })
725
791
  ] }) : null
726
792
  ]
727
793
  },
728
- a
794
+ n
729
795
  );
730
796
  }) }) : null,
731
797
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-3 pt-1", children: [
@@ -733,17 +799,17 @@ function Me({
733
799
  "button",
734
800
  {
735
801
  type: "button",
736
- onClick: m ?? B,
802
+ onClick: d ?? te,
737
803
  className: "px-4 py-2 text-sm text-slate-600 hover:text-slate-900",
738
- children: m ? "Cancel" : "Start Over"
804
+ children: d ? "Cancel" : "Start Over"
739
805
  }
740
806
  ),
741
807
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
742
- V ? /* @__PURE__ */ e.jsx(
808
+ z ? /* @__PURE__ */ e.jsx(
743
809
  "button",
744
810
  {
745
811
  type: "button",
746
- onClick: () => x({ name: "sources", prepared: V }),
812
+ onClick: () => f({ name: "sources", prepared: z }),
747
813
  className: "rounded border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",
748
814
  children: "Change Sources"
749
815
  }
@@ -753,19 +819,30 @@ function Me({
753
819
  {
754
820
  type: "button",
755
821
  onClick: () => {
756
- A || F(n, d), ae((a) => !a);
822
+ F || fe(l, p), ne((n) => !n);
757
823
  },
758
824
  className: "rounded border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",
759
- children: A ? "Hide Preview" : "Preview"
825
+ children: F ? "Hide Preview" : "Preview"
760
826
  }
761
827
  ),
762
- /* @__PURE__ */ e.jsx(
828
+ /* @__PURE__ */ e.jsxs(
763
829
  "button",
764
830
  {
765
831
  type: "button",
766
- onClick: () => l(n, d),
767
- className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
768
- children: "Confirm Import"
832
+ disabled: q,
833
+ onClick: async () => {
834
+ ee(!0);
835
+ try {
836
+ await s(l, p);
837
+ } finally {
838
+ ee(!1);
839
+ }
840
+ },
841
+ className: "flex items-center gap-2 rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600 disabled:opacity-60",
842
+ children: [
843
+ q ? /* @__PURE__ */ e.jsx("span", { className: "h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent" }) : null,
844
+ q ? "Importing…" : "Confirm Import"
845
+ ]
769
846
  }
770
847
  )
771
848
  ] })
@@ -775,7 +852,7 @@ function Me({
775
852
  return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4", children: [
776
853
  c.length > 1 ? /* @__PURE__ */ e.jsxs("fieldset", { className: "rounded-lg border border-slate-200 p-4", children: [
777
854
  /* @__PURE__ */ e.jsx("legend", { className: "px-1 text-sm font-semibold text-slate-700", children: "Converter" }),
778
- /* @__PURE__ */ e.jsx("div", { className: "mt-2 flex flex-col gap-3", children: c.map((s) => /* @__PURE__ */ e.jsxs(
855
+ /* @__PURE__ */ e.jsx("div", { className: "mt-2 flex flex-col gap-3", children: c.map((r) => /* @__PURE__ */ e.jsxs(
779
856
  "label",
780
857
  {
781
858
  className: "flex cursor-pointer items-start gap-3 text-sm",
@@ -785,29 +862,29 @@ function Me({
785
862
  {
786
863
  type: "radio",
787
864
  name: "import-engine",
788
- value: s.id,
789
- checked: P === s.id,
790
- onChange: () => K(s.id),
865
+ value: r.id,
866
+ checked: P === r.id,
867
+ onChange: () => W(r.id),
791
868
  className: "mt-0.5"
792
869
  }
793
870
  ),
794
871
  /* @__PURE__ */ e.jsxs("span", { children: [
795
- /* @__PURE__ */ e.jsx("span", { className: "font-medium text-slate-900", children: s.label }),
796
- s.description ? /* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children: s.description }) : null
872
+ /* @__PURE__ */ e.jsx("span", { className: "font-medium text-slate-900", children: r.label }),
873
+ r.description ? /* @__PURE__ */ e.jsx("span", { className: "block text-slate-500", children: r.description }) : null
797
874
  ] })
798
875
  ]
799
876
  },
800
- s.id
877
+ r.id
801
878
  )) })
802
879
  ] }) : null,
803
- f ? null : /* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-4 text-sm", children: /* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-2 text-slate-700", children: [
880
+ x ? null : /* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-4 text-sm", children: /* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-2 text-slate-700", children: [
804
881
  /* @__PURE__ */ e.jsx("span", { className: "text-slate-500", children: "Document kind" }),
805
882
  /* @__PURE__ */ e.jsxs(
806
883
  "select",
807
884
  {
808
- value: _,
809
- onChange: (s) => L(
810
- s.currentTarget.value
885
+ value: R,
886
+ onChange: (r) => O(
887
+ r.currentTarget.value
811
888
  ),
812
889
  className: "rounded border border-slate-300 px-2 py-1 text-sm",
813
890
  children: [
@@ -823,26 +900,26 @@ function Me({
823
900
  {
824
901
  role: "button",
825
902
  tabIndex: 0,
826
- onKeyDown: (s) => s.key === "Enter" && v.current?.click(),
903
+ onKeyDown: (r) => r.key === "Enter" && v.current?.click(),
827
904
  onClick: () => v.current?.click(),
828
- onDragOver: (s) => {
829
- s.preventDefault(), E(!0);
905
+ onDragOver: (r) => {
906
+ r.preventDefault(), w(!0);
830
907
  },
831
- onDragLeave: () => E(!1),
832
- onDrop: (s) => {
833
- s.preventDefault(), E(!1);
834
- const o = s.dataTransfer.files?.[0];
835
- o && Y(o);
908
+ onDragLeave: () => w(!1),
909
+ onDrop: (r) => {
910
+ r.preventDefault(), w(!1);
911
+ const o = r.dataTransfer.files?.[0];
912
+ o && G(o);
836
913
  },
837
- className: `flex cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed p-10 text-center transition-colors ${O ? "border-blue-500 bg-blue-50" : "border-slate-300 bg-slate-50 hover:border-slate-400"}`,
914
+ className: `flex cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed p-10 text-center transition-colors ${_ ? "border-blue-500 bg-blue-50" : "border-slate-300 bg-slate-50 hover:border-slate-400"}`,
838
915
  children: [
839
916
  /* @__PURE__ */ e.jsx("p", { className: "text-slate-600", children: "Drop a file here, or click to select." }),
840
917
  /* @__PURE__ */ e.jsx(
841
918
  "button",
842
919
  {
843
920
  type: "button",
844
- onClick: (s) => {
845
- s.stopPropagation(), v.current?.click();
921
+ onClick: (r) => {
922
+ r.stopPropagation(), v.current?.click();
846
923
  },
847
924
  className: "rounded bg-blue-700 px-4 py-2 text-sm font-medium text-white hover:bg-blue-600",
848
925
  children: "Select File"
@@ -850,7 +927,7 @@ function Me({
850
927
  ),
851
928
  /* @__PURE__ */ e.jsxs("p", { className: "text-xs text-slate-400", children: [
852
929
  "Supports ",
853
- Q.join(", ")
930
+ t.join(", ")
854
931
  ] }),
855
932
  /* @__PURE__ */ e.jsx(
856
933
  "input",
@@ -858,10 +935,10 @@ function Me({
858
935
  ref: v,
859
936
  type: "file",
860
937
  hidden: !0,
861
- accept: Q.join(","),
862
- onChange: (s) => {
863
- const o = s.currentTarget.files?.[0];
864
- o && Y(o), s.currentTarget.value = "";
938
+ accept: t.join(","),
939
+ onChange: (r) => {
940
+ const o = r.currentTarget.files?.[0];
941
+ o && G(o), r.currentTarget.value = "";
865
942
  }
866
943
  }
867
944
  )
@@ -870,23 +947,23 @@ function Me({
870
947
  )
871
948
  ] });
872
949
  }
873
- function Oe({ hunks: l }) {
874
- return l.length === 0 ? /* @__PURE__ */ e.jsx("p", { className: "m-0 px-4 py-3 text-xs text-slate-500", children: "Nothing was changed in this file." }) : /* @__PURE__ */ e.jsx("div", { className: "max-h-72 overflow-auto bg-white font-mono text-xs leading-relaxed", children: l.map((m, f) => /* @__PURE__ */ e.jsxs("div", { className: "border-b border-slate-100 last:border-b-0", children: [
875
- f > 0 ? /* @__PURE__ */ e.jsx("div", { className: "bg-slate-50 px-4 py-1 text-slate-400", children: "⋯" }) : null,
876
- m.lines.map((j, h) => /* @__PURE__ */ e.jsxs(
950
+ function Ue({ hunks: s }) {
951
+ return s.length === 0 ? /* @__PURE__ */ e.jsx("p", { className: "m-0 px-4 py-3 text-xs text-slate-500", children: "Nothing was changed in this file." }) : /* @__PURE__ */ e.jsx("div", { className: "max-h-72 overflow-auto bg-white font-mono text-xs leading-relaxed", children: s.map((d, x) => /* @__PURE__ */ e.jsxs("div", { className: "border-b border-slate-100 last:border-b-0", children: [
952
+ x > 0 ? /* @__PURE__ */ e.jsx("div", { className: "bg-slate-50 px-4 py-1 text-slate-400", children: "⋯" }) : null,
953
+ d.lines.map((b, g) => /* @__PURE__ */ e.jsxs(
877
954
  "div",
878
955
  {
879
- className: j.op === "add" ? "bg-green-50 px-4 text-green-900" : j.op === "remove" ? "bg-red-50 px-4 text-red-900" : "px-4 text-slate-600",
956
+ className: b.op === "add" ? "bg-green-50 px-4 text-green-900" : b.op === "remove" ? "bg-red-50 px-4 text-red-900" : "px-4 text-slate-600",
880
957
  children: [
881
- /* @__PURE__ */ e.jsx("span", { className: "mr-2 select-none text-slate-400", children: j.op === "add" ? "+" : j.op === "remove" ? "−" : " " }),
882
- j.text || " "
958
+ /* @__PURE__ */ e.jsx("span", { className: "mr-2 select-none text-slate-400", children: b.op === "add" ? "+" : b.op === "remove" ? "−" : " " }),
959
+ b.text || " "
883
960
  ]
884
961
  },
885
- h
962
+ g
886
963
  ))
887
- ] }, f)) });
964
+ ] }, x)) });
888
965
  }
889
- const Le = {
966
+ const Be = {
890
967
  title: "Import Source Content",
891
968
  description: "Paste LaTeX, Markdown, or PreTeXt source to convert into PreTeXt.",
892
969
  sourceLabel: "Source",
@@ -897,37 +974,37 @@ const Le = {
897
974
  successPrefix: "Ready",
898
975
  errorPrefix: "Error"
899
976
  };
900
- function Xe({
901
- initialSource: l = "",
902
- initialSourceFormat: m,
903
- labels: f,
904
- disabled: j = !1,
905
- onImport: h
977
+ function Je({
978
+ initialSource: s = "",
979
+ initialSourceFormat: d,
980
+ labels: x,
981
+ disabled: b = !1,
982
+ onImport: g
906
983
  }) {
907
- const c = re(
908
- () => ({ ...Le, ...f ?? {} }),
909
- [f]
910
- ), [v, N] = g(l), [x, O] = g(
911
- m ?? "auto"
912
- ), [E, _] = g(
984
+ const c = ae(
985
+ () => ({ ...Be, ...x ?? {} }),
986
+ [x]
987
+ ), [v, N] = h(s), [f, _] = h(
988
+ d ?? "auto"
989
+ ), [w, R] = h(
913
990
  null
914
- ), L = re(
915
- () => ke(v),
991
+ ), O = ae(
992
+ () => _e(v),
916
993
  [v]
917
- ), T = j || !v.trim();
994
+ ), E = b || !v.trim();
918
995
  return /* @__PURE__ */ e.jsx(
919
996
  "form",
920
997
  {
921
998
  onSubmit: (k) => {
922
999
  k.preventDefault();
923
- const R = Se(
1000
+ const A = Ae(
924
1001
  v,
925
- x === "auto" ? void 0 : x
1002
+ f === "auto" ? void 0 : f
926
1003
  );
927
- _(R), h(R);
1004
+ R(A), g(A);
928
1005
  },
929
1006
  "aria-label": "Import source form",
930
- children: /* @__PURE__ */ e.jsxs("fieldset", { disabled: j, children: [
1007
+ children: /* @__PURE__ */ e.jsxs("fieldset", { disabled: b, children: [
931
1008
  /* @__PURE__ */ e.jsx("legend", { children: c.title }),
932
1009
  /* @__PURE__ */ e.jsx("p", { children: c.description }),
933
1010
  /* @__PURE__ */ e.jsxs("label", { children: [
@@ -947,8 +1024,8 @@ function Xe({
947
1024
  /* @__PURE__ */ e.jsxs(
948
1025
  "select",
949
1026
  {
950
- value: x,
951
- onChange: (k) => O(
1027
+ value: f,
1028
+ onChange: (k) => _(
952
1029
  k.currentTarget.value
953
1030
  ),
954
1031
  children: [
@@ -963,24 +1040,24 @@ function Xe({
963
1040
  /* @__PURE__ */ e.jsxs("p", { children: [
964
1041
  c.detectedFormatPrefix,
965
1042
  ": ",
966
- /* @__PURE__ */ e.jsx("strong", { children: L })
1043
+ /* @__PURE__ */ e.jsx("strong", { children: O })
967
1044
  ] }),
968
- /* @__PURE__ */ e.jsx("button", { type: "submit", disabled: T, children: c.convertButton }),
969
- E ? "pretextError" in E ? /* @__PURE__ */ e.jsxs("p", { role: "alert", children: [
1045
+ /* @__PURE__ */ e.jsx("button", { type: "submit", disabled: E, children: c.convertButton }),
1046
+ w ? "pretextError" in w ? /* @__PURE__ */ e.jsxs("p", { role: "alert", children: [
970
1047
  c.errorPrefix,
971
1048
  ": ",
972
- E.pretextError
1049
+ w.pretextError
973
1050
  ] }) : /* @__PURE__ */ e.jsxs("p", { children: [
974
1051
  c.successPrefix,
975
1052
  ": ",
976
- E.pretextSource.length,
1053
+ w.pretextSource.length,
977
1054
  " characters of PreTeXt generated."
978
1055
  ] }) : null
979
1056
  ] })
980
1057
  }
981
1058
  );
982
1059
  }
983
- const De = {
1060
+ const We = {
984
1061
  title: "Upload Source File",
985
1062
  hint: "Supports .tex, .md, .ptx, .xml, .zip, and .tar.gz files.",
986
1063
  selectButton: "Select File",
@@ -988,43 +1065,43 @@ const De = {
988
1065
  documentKindLabel: "Document kind",
989
1066
  splitSectionsLabel: "Split each chapter into sections"
990
1067
  };
991
- function ze({
992
- labels: l,
993
- disabled: m = !1,
994
- defaultDocumentKind: f = "auto",
995
- importOptions: j,
996
- onImport: h
1068
+ function He({
1069
+ labels: s,
1070
+ disabled: d = !1,
1071
+ defaultDocumentKind: x = "auto",
1072
+ importOptions: b,
1073
+ onImport: g
997
1074
  }) {
998
- const c = re(
999
- () => ({ ...De, ...l ?? {} }),
1000
- [l]
1001
- ), v = he(null), [N, x] = g(!1), [O, E] = g(!1), [_, L] = g(
1075
+ const c = ae(
1076
+ () => ({ ...We, ...s ?? {} }),
1077
+ [s]
1078
+ ), v = ue(null), [N, f] = h(!1), [_, w] = h(!1), [R, O] = h(
1002
1079
  []
1003
- ), [T, k] = g(f), [R, D] = g(!1), P = m || O, K = async (d) => {
1004
- E(!0);
1080
+ ), [E, k] = h(x), [A, L] = h(!1), P = d || _, W = async (p) => {
1081
+ w(!0);
1005
1082
  try {
1006
- const A = await be(d, j ?? {
1007
- documentKind: T === "auto" ? void 0 : T,
1008
- splitSections: R
1083
+ const F = await Ne(p, b ?? {
1084
+ documentKind: E === "auto" ? void 0 : E,
1085
+ splitSections: A
1009
1086
  });
1010
- L(A.statusMessages), h(A);
1087
+ O(F.statusMessages), g(F);
1011
1088
  } finally {
1012
- E(!1);
1089
+ w(!1);
1013
1090
  }
1014
1091
  };
1015
1092
  return /* @__PURE__ */ e.jsxs("section", { "aria-label": "Import upload panel", children: [
1016
1093
  /* @__PURE__ */ e.jsx("h3", { children: c.title }),
1017
1094
  /* @__PURE__ */ e.jsx("p", { children: c.hint }),
1018
- j ? null : /* @__PURE__ */ e.jsxs("div", { className: "import-options", children: [
1095
+ b ? null : /* @__PURE__ */ e.jsxs("div", { className: "import-options", children: [
1019
1096
  /* @__PURE__ */ e.jsxs("label", { children: [
1020
1097
  c.documentKindLabel,
1021
1098
  /* @__PURE__ */ e.jsxs(
1022
1099
  "select",
1023
1100
  {
1024
- value: T,
1101
+ value: E,
1025
1102
  disabled: P,
1026
- onChange: (d) => k(
1027
- d.currentTarget.value
1103
+ onChange: (p) => k(
1104
+ p.currentTarget.value
1028
1105
  ),
1029
1106
  children: [
1030
1107
  /* @__PURE__ */ e.jsx("option", { value: "auto", children: "Auto detect" }),
@@ -1039,9 +1116,9 @@ function ze({
1039
1116
  "input",
1040
1117
  {
1041
1118
  type: "checkbox",
1042
- checked: R,
1119
+ checked: A,
1043
1120
  disabled: P,
1044
- onChange: (d) => D(d.currentTarget.checked)
1121
+ onChange: (p) => L(p.currentTarget.checked)
1045
1122
  }
1046
1123
  ),
1047
1124
  c.splitSectionsLabel
@@ -1050,25 +1127,35 @@ function ze({
1050
1127
  /* @__PURE__ */ e.jsxs(
1051
1128
  "div",
1052
1129
  {
1053
- onDragOver: (d) => {
1054
- d.preventDefault(), P || x(!0);
1130
+ onDragOver: (p) => {
1131
+ p.preventDefault(), P || f(!0);
1055
1132
  },
1056
- onDragLeave: () => x(!1),
1057
- onDrop: (d) => {
1058
- if (d.preventDefault(), x(!1), P)
1133
+ onDragLeave: () => f(!1),
1134
+ onDrop: (p) => {
1135
+ if (p.preventDefault(), f(!1), P)
1059
1136
  return;
1060
- const S = d.dataTransfer.files?.[0];
1061
- S && K(S);
1137
+ const S = p.dataTransfer.files?.[0];
1138
+ S && W(S);
1062
1139
  },
1063
1140
  children: [
1064
1141
  /* @__PURE__ */ e.jsx("p", { children: c.dropHint }),
1065
- /* @__PURE__ */ e.jsx(
1142
+ /* @__PURE__ */ e.jsxs(
1066
1143
  "button",
1067
1144
  {
1068
1145
  type: "button",
1069
1146
  disabled: P,
1070
1147
  onClick: () => v.current?.click(),
1071
- children: O ? "Processing..." : c.selectButton
1148
+ className: "inline-flex items-center gap-2",
1149
+ children: [
1150
+ _ ? /* @__PURE__ */ e.jsx(
1151
+ "span",
1152
+ {
1153
+ className: "h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent",
1154
+ "aria-hidden": "true"
1155
+ }
1156
+ ) : null,
1157
+ _ ? "Processing…" : c.selectButton
1158
+ ]
1072
1159
  }
1073
1160
  ),
1074
1161
  /* @__PURE__ */ e.jsx(
@@ -1079,21 +1166,23 @@ function ze({
1079
1166
  hidden: !0,
1080
1167
  disabled: P,
1081
1168
  accept: ".tex,.md,.markdown,.ptx,.xml,.zip,.gz,.tar.gz,.tgz",
1082
- onChange: (d) => {
1083
- const S = d.currentTarget.files?.[0];
1084
- S && K(S), d.currentTarget.value = "";
1169
+ onChange: (p) => {
1170
+ const S = p.currentTarget.files?.[0];
1171
+ S && W(S), p.currentTarget.value = "";
1085
1172
  }
1086
1173
  }
1087
1174
  )
1088
1175
  ]
1089
1176
  }
1090
1177
  ),
1091
- _.length > 0 ? /* @__PURE__ */ e.jsx("ul", { "aria-live": "polite", children: _.map((d, S) => /* @__PURE__ */ e.jsx("li", { children: d.message }, `${d.type}-${S}`)) }) : null,
1178
+ _ ? /* @__PURE__ */ e.jsx("p", { role: "status", "aria-live": "polite", children: "Converting your file — this can take a while for a long document." }) : null,
1179
+ R.length > 0 ? /* @__PURE__ */ e.jsx("ul", { "aria-live": "polite", children: R.map((p, S) => /* @__PURE__ */ e.jsx("li", { children: p.message }, `${p.type}-${S}`)) }) : null,
1092
1180
  N && !P ? /* @__PURE__ */ e.jsx("p", { children: "Release to upload the file." }) : null
1093
1181
  ] });
1094
1182
  }
1095
1183
  export {
1096
- Xe as ImportSourceForm,
1097
- ze as ImportUploadPanel,
1098
- Me as ImportWizard
1184
+ Je as ImportSourceForm,
1185
+ He as ImportUploadPanel,
1186
+ Ge as ImportWizard,
1187
+ Me as ProcessingPanel
1099
1188
  };