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