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