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