@getodk/xforms-engine 0.11.0 → 0.13.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/client/TextRange.d.ts +0 -9
- package/dist/index.js +265 -146
- package/dist/index.js.map +1 -1
- package/dist/instance/RankControl.d.ts +3 -2
- package/dist/instance/SelectControl.d.ts +3 -2
- package/dist/parse/body/control/ItemsetDefinition.d.ts +1 -1
- package/dist/parse/expression/BindComputationExpression.d.ts +1 -1
- package/dist/parse/expression/ItemsetNodesetExpression.d.ts +1 -2
- package/dist/parse/expression/TextChunkExpression.d.ts +9 -7
- package/dist/parse/expression/abstract/DependentExpression.d.ts +1 -15
- package/dist/parse/model/ModelDefinition.d.ts +6 -1
- package/dist/parse/model/generateItextChunks.d.ts +5 -0
- package/dist/parse/xpath/semantic-analysis.d.ts +1 -0
- package/dist/solid.js +249 -116
- package/dist/solid.js.map +1 -1
- package/package.json +16 -16
- package/src/client/TextRange.ts +0 -9
- package/src/instance/RankControl.ts +8 -2
- package/src/instance/SelectControl.ts +8 -2
- package/src/lib/reactivity/text/createTextRange.ts +30 -30
- package/src/parse/body/control/ItemsetDefinition.ts +2 -2
- package/src/parse/expression/BindComputationExpression.ts +2 -7
- package/src/parse/expression/ItemsetNodesetExpression.ts +2 -3
- package/src/parse/expression/ItemsetValueExpression.ts +1 -1
- package/src/parse/expression/RepeatCountControlExpression.ts +4 -4
- package/src/parse/expression/TextChunkExpression.ts +25 -35
- package/src/parse/expression/abstract/DependentExpression.ts +2 -38
- package/src/parse/model/ModelDefinition.ts +13 -0
- package/src/parse/model/generateItextChunks.ts +61 -0
- package/src/parse/text/ItemsetLabelDefinition.ts +4 -4
- package/src/parse/text/MessageDefinition.ts +4 -4
- package/src/parse/text/abstract/TextElementDefinition.ts +6 -7
- package/src/parse/xpath/semantic-analysis.ts +37 -8
package/dist/index.js
CHANGED
|
@@ -65,14 +65,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
65
65
|
owner = Owner,
|
|
66
66
|
unowned = fn.length === 0,
|
|
67
67
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
68
|
-
root = unowned
|
|
69
|
-
|
|
70
|
-
:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
owner: current
|
|
75
|
-
},
|
|
68
|
+
root = unowned ? UNOWNED : {
|
|
69
|
+
owned: null,
|
|
70
|
+
cleanups: null,
|
|
71
|
+
context: current ? current.context : null,
|
|
72
|
+
owner: current
|
|
73
|
+
},
|
|
76
74
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
77
75
|
Owner = root;
|
|
78
76
|
Listener = null;
|
|
@@ -161,8 +159,7 @@ function runWithOwner(o, fn) {
|
|
|
161
159
|
}
|
|
162
160
|
function readSignal() {
|
|
163
161
|
if (this.sources && (this.state)) {
|
|
164
|
-
if ((this.state) === STALE) updateComputation(this);
|
|
165
|
-
else {
|
|
162
|
+
if ((this.state) === STALE) updateComputation(this);else {
|
|
166
163
|
const updates = Updates;
|
|
167
164
|
Updates = null;
|
|
168
165
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -189,8 +186,7 @@ function readSignal() {
|
|
|
189
186
|
return this.value;
|
|
190
187
|
}
|
|
191
188
|
function writeSignal(node, value, isComp) {
|
|
192
|
-
let current =
|
|
193
|
-
node.value;
|
|
189
|
+
let current = node.value;
|
|
194
190
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
195
191
|
node.value = value;
|
|
196
192
|
if (node.observers && node.observers.length) {
|
|
@@ -200,15 +196,14 @@ function writeSignal(node, value, isComp) {
|
|
|
200
196
|
const TransitionRunning = Transition && Transition.running;
|
|
201
197
|
if (TransitionRunning && Transition.disposed.has(o)) ;
|
|
202
198
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
203
|
-
if (o.pure) Updates.push(o);
|
|
204
|
-
else Effects.push(o);
|
|
199
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
205
200
|
if (o.observers) markDownstream(o);
|
|
206
201
|
}
|
|
207
202
|
if (!TransitionRunning) o.state = STALE;
|
|
208
203
|
}
|
|
209
204
|
if (Updates.length > 10e5) {
|
|
210
205
|
Updates = [];
|
|
211
|
-
if (IS_DEV);
|
|
206
|
+
if (IS_DEV) ;
|
|
212
207
|
throw new Error();
|
|
213
208
|
}
|
|
214
209
|
}, false);
|
|
@@ -220,11 +215,7 @@ function updateComputation(node) {
|
|
|
220
215
|
if (!node.fn) return;
|
|
221
216
|
cleanNode(node);
|
|
222
217
|
const time = ExecCount;
|
|
223
|
-
runComputation(
|
|
224
|
-
node,
|
|
225
|
-
node.value,
|
|
226
|
-
time
|
|
227
|
-
);
|
|
218
|
+
runComputation(node, node.value, time);
|
|
228
219
|
}
|
|
229
220
|
function runComputation(node, value, time) {
|
|
230
221
|
let nextValue;
|
|
@@ -268,11 +259,9 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
268
259
|
context: Owner ? Owner.context : null,
|
|
269
260
|
pure
|
|
270
261
|
};
|
|
271
|
-
if (Owner === null);
|
|
272
|
-
else if (Owner !== UNOWNED) {
|
|
262
|
+
if (Owner === null) ;else if (Owner !== UNOWNED) {
|
|
273
263
|
{
|
|
274
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
275
|
-
else Owner.owned.push(c);
|
|
264
|
+
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
276
265
|
}
|
|
277
266
|
}
|
|
278
267
|
return c;
|
|
@@ -301,8 +290,7 @@ function runUpdates(fn, init) {
|
|
|
301
290
|
if (Updates) return fn();
|
|
302
291
|
let wait = false;
|
|
303
292
|
if (!init) Updates = [];
|
|
304
|
-
if (Effects) wait = true;
|
|
305
|
-
else Effects = [];
|
|
293
|
+
if (Effects) wait = true;else Effects = [];
|
|
306
294
|
ExecCount++;
|
|
307
295
|
try {
|
|
308
296
|
const res = fn();
|
|
@@ -334,8 +322,7 @@ function lookUpstream(node, ignore) {
|
|
|
334
322
|
if (source.sources) {
|
|
335
323
|
const state = source.state;
|
|
336
324
|
if (state === STALE) {
|
|
337
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
338
|
-
runTop(source);
|
|
325
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
339
326
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
340
327
|
}
|
|
341
328
|
}
|
|
@@ -345,8 +332,7 @@ function markDownstream(node) {
|
|
|
345
332
|
const o = node.observers[i];
|
|
346
333
|
if (!o.state) {
|
|
347
334
|
o.state = PENDING;
|
|
348
|
-
if (o.pure) Updates.push(o);
|
|
349
|
-
else Effects.push(o);
|
|
335
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
350
336
|
o.observers && markDownstream(o);
|
|
351
337
|
}
|
|
352
338
|
}
|
|
@@ -710,7 +696,11 @@ function getAugmentedNamespace(n) {
|
|
|
710
696
|
var f = n.default;
|
|
711
697
|
if (typeof f == "function") {
|
|
712
698
|
var a = function a () {
|
|
713
|
-
|
|
699
|
+
var isInstance = false;
|
|
700
|
+
try {
|
|
701
|
+
isInstance = this instanceof a;
|
|
702
|
+
} catch {}
|
|
703
|
+
if (isInstance) {
|
|
714
704
|
return Reflect.construct(f, arguments, this.constructor);
|
|
715
705
|
}
|
|
716
706
|
return f.apply(this, arguments);
|
|
@@ -4530,7 +4520,7 @@ function epochMilliToIso$1(e, n = 0, t = 0) {
|
|
|
4530
4520
|
return zipProps$1(Tr$1, [r.getUTCFullYear(), r.getUTCMonth() + 1, r.getUTCDate() + o, r.getUTCHours(), r.getUTCMinutes(), r.getUTCSeconds(), r.getUTCMilliseconds(), n, t]);
|
|
4531
4521
|
}
|
|
4532
4522
|
function hashIntlFormatParts$1(e, n) {
|
|
4533
|
-
if (n < -
|
|
4523
|
+
if (n < -Pr$1) {
|
|
4534
4524
|
throw new RangeError(Io$1);
|
|
4535
4525
|
}
|
|
4536
4526
|
const t = e.formatToParts(n),
|
|
@@ -5214,7 +5204,7 @@ function getSingleInstantFor$1(e, n, t = 0, o = e.I(n)) {
|
|
|
5214
5204
|
}
|
|
5215
5205
|
const r = isoToEpochNano$1(n),
|
|
5216
5206
|
i = ((e, n) => {
|
|
5217
|
-
const t = e.R(moveBigNano$1(n, -
|
|
5207
|
+
const t = e.R(moveBigNano$1(n, -Uo$1));
|
|
5218
5208
|
return (e => {
|
|
5219
5209
|
if (e > Uo$1) {
|
|
5220
5210
|
throw new RangeError(go$1);
|
|
@@ -5230,7 +5220,7 @@ function getStartOfDayInstantFor$1(e, n) {
|
|
|
5230
5220
|
if (t.length) {
|
|
5231
5221
|
return t[0];
|
|
5232
5222
|
}
|
|
5233
|
-
const o = moveBigNano$1(isoToEpochNano$1(n), -
|
|
5223
|
+
const o = moveBigNano$1(isoToEpochNano$1(n), -Uo$1);
|
|
5234
5224
|
return e.O(o, 1);
|
|
5235
5225
|
}
|
|
5236
5226
|
function Ye$1(e, n, t) {
|
|
@@ -5452,7 +5442,7 @@ function computeDurationSign$1(e, n = p$1) {
|
|
|
5452
5442
|
}
|
|
5453
5443
|
function checkDurationUnits$1(e) {
|
|
5454
5444
|
for (const n of dr$1) {
|
|
5455
|
-
clampEntity$1(n, e[n], -
|
|
5445
|
+
clampEntity$1(n, e[n], -di$1, di$1, 1);
|
|
5456
5446
|
}
|
|
5457
5447
|
return checkDurationTimeUnit$1(bigNanoToNumber$1(durationFieldsToBigNano$1(e), Ro$1)), e;
|
|
5458
5448
|
}
|
|
@@ -6111,7 +6101,7 @@ function createIntlYearDataCache$1(e) {
|
|
|
6111
6101
|
r += 400 * ko$1;
|
|
6112
6102
|
} while ((o = e(r)).year <= t);
|
|
6113
6103
|
do {
|
|
6114
|
-
if (r += (1 - o.day) * ko$1, o.year === t && (a.push(r), s.push(o.o)), r -= ko$1, ++i > 100 || r < -
|
|
6104
|
+
if (r += (1 - o.day) * ko$1, o.year === t && (a.push(r), s.push(o.o)), r -= ko$1, ++i > 100 || r < -Pr$1) {
|
|
6115
6105
|
throw new RangeError(fo$1);
|
|
6116
6106
|
}
|
|
6117
6107
|
} while ((o = e(r)).year >= t);
|
|
@@ -6904,7 +6894,7 @@ const expectedInteger$1 = (e, n) => `Non-integer ${e}: ${n}`,
|
|
|
6904
6894
|
vr$1 = 1e8,
|
|
6905
6895
|
Pr$1 = vr$1 * ko$1,
|
|
6906
6896
|
Er$1 = [vr$1, 0],
|
|
6907
|
-
Sr$1 = [-
|
|
6897
|
+
Sr$1 = [-vr$1, 0],
|
|
6908
6898
|
Fr$1 = 275760,
|
|
6909
6899
|
wr$1 = -271821,
|
|
6910
6900
|
en$1 = Intl.DateTimeFormat,
|
|
@@ -11291,7 +11281,9 @@ const dateTimeFromString = (timeZone, value) => {
|
|
|
11291
11281
|
}
|
|
11292
11282
|
return Xn$1.PlainDateTime.from(value).toZonedDateTime(timeZone);
|
|
11293
11283
|
};
|
|
11294
|
-
const toNanoseconds = (milliseconds) =>
|
|
11284
|
+
const toNanoseconds = (milliseconds) => {
|
|
11285
|
+
return BigInt(Math.round(milliseconds)) * MILLISECOND_NANOSECONDS;
|
|
11286
|
+
};
|
|
11295
11287
|
const dateTimeFromNumber = (timeZone, milliseconds) => {
|
|
11296
11288
|
if (Number.isNaN(milliseconds)) {
|
|
11297
11289
|
return null;
|
|
@@ -11584,7 +11576,45 @@ const nodeSet = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
11584
11576
|
itext
|
|
11585
11577
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
11586
11578
|
|
|
11587
|
-
const
|
|
11579
|
+
const choiceName = new StringFunction(
|
|
11580
|
+
"choice-name",
|
|
11581
|
+
[
|
|
11582
|
+
{ arityType: "required", typeHint: "string" },
|
|
11583
|
+
{ arityType: "required", typeHint: "string" }
|
|
11584
|
+
],
|
|
11585
|
+
(context, [nodeExpression, valueExpression]) => {
|
|
11586
|
+
const node = nodeExpression.evaluate(context).toString();
|
|
11587
|
+
const value = valueExpression.evaluate(context).toString();
|
|
11588
|
+
const [contextNode] = context.contextNodes;
|
|
11589
|
+
const { domProvider } = context;
|
|
11590
|
+
let nodes;
|
|
11591
|
+
if (contextNode && domProvider.isElement(contextNode)) {
|
|
11592
|
+
nodes = context.evaluator.evaluateNodes(value, { contextNode });
|
|
11593
|
+
} else {
|
|
11594
|
+
nodes = context.evaluator.evaluateNodes(value);
|
|
11595
|
+
}
|
|
11596
|
+
const firstNode = nodes?.[0];
|
|
11597
|
+
if (!firstNode) {
|
|
11598
|
+
return "";
|
|
11599
|
+
}
|
|
11600
|
+
if (!("getChoiceName" in firstNode)) {
|
|
11601
|
+
throw new Error(
|
|
11602
|
+
`Evaluating 'jr:choice-name' on element '${value}' which has no possible choices.`
|
|
11603
|
+
);
|
|
11604
|
+
}
|
|
11605
|
+
return firstNode.getChoiceName(node) ?? "";
|
|
11606
|
+
}
|
|
11607
|
+
);
|
|
11608
|
+
|
|
11609
|
+
const select$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
11610
|
+
__proto__: null,
|
|
11611
|
+
choiceName
|
|
11612
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
11613
|
+
|
|
11614
|
+
const jr$2 = new FunctionLibrary(JAVAROSA_NAMESPACE_URI, [
|
|
11615
|
+
...Object.values(nodeSet),
|
|
11616
|
+
...Object.values(select$1)
|
|
11617
|
+
]);
|
|
11588
11618
|
|
|
11589
11619
|
const booleanFromString = new BooleanFunction(
|
|
11590
11620
|
"boolean-from-string",
|
|
@@ -19015,6 +19045,10 @@ const hex = /*#__PURE__*/_mergeNamespaces({
|
|
|
19015
19045
|
default: encHex
|
|
19016
19046
|
}, [encHexExports]);
|
|
19017
19047
|
|
|
19048
|
+
const base64Decode$1 = (base64Input) => {
|
|
19049
|
+
return new TextDecoder().decode(Uint8Array.from(atob(base64Input), (m) => m.charCodeAt(0)));
|
|
19050
|
+
};
|
|
19051
|
+
|
|
19018
19052
|
const toStrings = (context, expressions) => {
|
|
19019
19053
|
return expressions.flatMap((arg) => {
|
|
19020
19054
|
const result = arg.evaluate(context);
|
|
@@ -19026,6 +19060,17 @@ const toStrings = (context, expressions) => {
|
|
|
19026
19060
|
});
|
|
19027
19061
|
};
|
|
19028
19062
|
|
|
19063
|
+
const base64Decode = new StringFunction(
|
|
19064
|
+
"base64-decode",
|
|
19065
|
+
[{ arityType: "required", typeHint: "string" }],
|
|
19066
|
+
(context, [base64Expression]) => {
|
|
19067
|
+
try {
|
|
19068
|
+
return base64Decode$1(base64Expression.evaluate(context).toString());
|
|
19069
|
+
} catch {
|
|
19070
|
+
return "";
|
|
19071
|
+
}
|
|
19072
|
+
}
|
|
19073
|
+
);
|
|
19029
19074
|
const coalesce = new StringFunction(
|
|
19030
19075
|
"coalesce",
|
|
19031
19076
|
[
|
|
@@ -19115,6 +19160,23 @@ const join = new StringFunction(
|
|
|
19115
19160
|
return strings.join(glue);
|
|
19116
19161
|
}
|
|
19117
19162
|
);
|
|
19163
|
+
const pulldata = new StringFunction(
|
|
19164
|
+
"pulldata",
|
|
19165
|
+
[
|
|
19166
|
+
{ arityType: "required", typeHint: "string" },
|
|
19167
|
+
{ arityType: "required", typeHint: "string" },
|
|
19168
|
+
{ arityType: "required", typeHint: "string" },
|
|
19169
|
+
{ arityType: "required", typeHint: "string" }
|
|
19170
|
+
],
|
|
19171
|
+
(context, [instanceExpression, desiredElementExpression, queryElementExpression, queryExpression]) => {
|
|
19172
|
+
const instanceId = instanceExpression.evaluate(context).toString();
|
|
19173
|
+
const desiredElement = desiredElementExpression.evaluate(context).toString();
|
|
19174
|
+
const queryElement = queryElementExpression.evaluate(context).toString();
|
|
19175
|
+
const query = queryExpression.evaluate(context).toString();
|
|
19176
|
+
const expr = `instance('${instanceId}')/root/item[${queryElement}='${query}']/${desiredElement}`;
|
|
19177
|
+
return context.evaluator.evaluateString(expr);
|
|
19178
|
+
}
|
|
19179
|
+
);
|
|
19118
19180
|
const regex = new BooleanFunction(
|
|
19119
19181
|
"regex",
|
|
19120
19182
|
[
|
|
@@ -19193,11 +19255,13 @@ const uuid = new StringFunction(
|
|
|
19193
19255
|
|
|
19194
19256
|
const string = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
19195
19257
|
__proto__: null,
|
|
19258
|
+
base64Decode,
|
|
19196
19259
|
coalesce,
|
|
19197
19260
|
concat,
|
|
19198
19261
|
digest,
|
|
19199
19262
|
endsWith,
|
|
19200
19263
|
join,
|
|
19264
|
+
pulldata,
|
|
19201
19265
|
regex,
|
|
19202
19266
|
substr,
|
|
19203
19267
|
uuid
|
|
@@ -19911,18 +19975,32 @@ const isTranslationFunctionCall = (syntaxNode) => {
|
|
|
19911
19975
|
ANY_ARGUMENT_TYPE
|
|
19912
19976
|
]);
|
|
19913
19977
|
};
|
|
19914
|
-
const
|
|
19978
|
+
const findFunctionPrincipalExpressionNode = (expression) => {
|
|
19915
19979
|
let result;
|
|
19916
19980
|
try {
|
|
19917
19981
|
result = expressionParser.parse(expression);
|
|
19918
19982
|
} catch {
|
|
19919
|
-
return
|
|
19983
|
+
return null;
|
|
19920
19984
|
}
|
|
19921
19985
|
const functionCallNode = findTypedPrincipalExpressionNode(["function_call"], result.rootNode);
|
|
19922
19986
|
if (functionCallNode == null) {
|
|
19923
|
-
return
|
|
19987
|
+
return null;
|
|
19988
|
+
}
|
|
19989
|
+
return functionCallNode;
|
|
19990
|
+
};
|
|
19991
|
+
const getTranslationExpression = (expression) => {
|
|
19992
|
+
const functionCallNode = findFunctionPrincipalExpressionNode(expression);
|
|
19993
|
+
if (!functionCallNode) {
|
|
19994
|
+
return null;
|
|
19995
|
+
}
|
|
19996
|
+
if (!isTranslationFunctionCall(functionCallNode)) {
|
|
19997
|
+
return null;
|
|
19998
|
+
}
|
|
19999
|
+
const arg = functionCallNode.children.find((child) => child.type === "argument");
|
|
20000
|
+
if (!arg) {
|
|
20001
|
+
return null;
|
|
19924
20002
|
}
|
|
19925
|
-
return
|
|
20003
|
+
return arg.text;
|
|
19926
20004
|
};
|
|
19927
20005
|
const isCurrentFunctionCall = (syntaxNode) => {
|
|
19928
20006
|
return isCallToLocalNamedFunction(syntaxNode, "current") && hasCallSignature(syntaxNode, []);
|
|
@@ -20042,7 +20120,7 @@ const evaluatorMethodsByResultType = {
|
|
|
20042
20120
|
string: "evaluateString"
|
|
20043
20121
|
};
|
|
20044
20122
|
class DependentExpression {
|
|
20045
|
-
constructor(
|
|
20123
|
+
constructor(resultType, expression) {
|
|
20046
20124
|
this.resultType = resultType;
|
|
20047
20125
|
this.expression = expression;
|
|
20048
20126
|
if (resultType === "boolean" && isConstantTruthyExpression(expression)) {
|
|
@@ -20056,16 +20134,6 @@ class DependentExpression {
|
|
|
20056
20134
|
this.constantExpression = null;
|
|
20057
20135
|
}
|
|
20058
20136
|
this.evaluatorMethod = evaluatorMethodsByResultType[resultType];
|
|
20059
|
-
const {
|
|
20060
|
-
semanticDependencies = {
|
|
20061
|
-
translations: false
|
|
20062
|
-
}
|
|
20063
|
-
} = options;
|
|
20064
|
-
const isTranslated = semanticDependencies.translations && isTranslationExpression(expression);
|
|
20065
|
-
if (isTranslated) {
|
|
20066
|
-
this.isTranslated = true;
|
|
20067
|
-
context.isTranslated = true;
|
|
20068
|
-
}
|
|
20069
20137
|
}
|
|
20070
20138
|
isTranslated = false;
|
|
20071
20139
|
evaluatorMethod;
|
|
@@ -20089,33 +20157,32 @@ class TextChunkExpression extends DependentExpression {
|
|
|
20089
20157
|
source;
|
|
20090
20158
|
// Set for the literal source, blank otherwise
|
|
20091
20159
|
stringValue;
|
|
20092
|
-
|
|
20093
|
-
|
|
20094
|
-
|
|
20095
|
-
|
|
20096
|
-
},
|
|
20097
|
-
ignoreContextReference: true
|
|
20098
|
-
});
|
|
20160
|
+
resourceType;
|
|
20161
|
+
constructor(resultType, expression, source, literalValue = "", options = {}) {
|
|
20162
|
+
super(resultType, expression);
|
|
20163
|
+
this.resourceType = options.type ?? null;
|
|
20099
20164
|
this.source = source;
|
|
20100
20165
|
this.stringValue = literalValue;
|
|
20101
20166
|
}
|
|
20102
|
-
static fromLiteral(
|
|
20103
|
-
return new TextChunkExpression(
|
|
20167
|
+
static fromLiteral(stringValue) {
|
|
20168
|
+
return new TextChunkExpression("string", "null", "literal", stringValue);
|
|
20104
20169
|
}
|
|
20105
|
-
static fromReference(
|
|
20106
|
-
return new TextChunkExpression(
|
|
20170
|
+
static fromReference(ref) {
|
|
20171
|
+
return new TextChunkExpression("string", ref, "reference");
|
|
20107
20172
|
}
|
|
20108
|
-
static fromOutput(
|
|
20173
|
+
static fromOutput(element) {
|
|
20109
20174
|
if (!isOutputElement(element)) {
|
|
20110
20175
|
return null;
|
|
20111
20176
|
}
|
|
20112
|
-
return new TextChunkExpression(
|
|
20177
|
+
return new TextChunkExpression("string", element.getAttribute("value"), "output");
|
|
20113
20178
|
}
|
|
20114
|
-
static
|
|
20115
|
-
|
|
20116
|
-
|
|
20117
|
-
|
|
20118
|
-
|
|
20179
|
+
static fromResource(url, type) {
|
|
20180
|
+
return new TextChunkExpression("string", "null", "literal", url, { type });
|
|
20181
|
+
}
|
|
20182
|
+
static fromTranslation(maybeExpression) {
|
|
20183
|
+
const translationExpression = getTranslationExpression(maybeExpression);
|
|
20184
|
+
if (translationExpression) {
|
|
20185
|
+
return new TextChunkExpression("nodes", translationExpression, "translation");
|
|
20119
20186
|
}
|
|
20120
20187
|
return null;
|
|
20121
20188
|
}
|
|
@@ -20362,24 +20429,23 @@ class TextElementDefinition extends TextRangeDefinition {
|
|
|
20362
20429
|
chunks;
|
|
20363
20430
|
constructor(form, owner, sourceNode) {
|
|
20364
20431
|
super(form, owner, sourceNode);
|
|
20365
|
-
const context = this;
|
|
20366
20432
|
const refExpression = parseNodesetReference(owner, sourceNode, "ref");
|
|
20367
20433
|
if (refExpression == null) {
|
|
20368
20434
|
this.chunks = Array.from(sourceNode.childNodes).flatMap((childNode) => {
|
|
20369
20435
|
if (isElementNode(childNode)) {
|
|
20370
|
-
return TextChunkExpression.fromOutput(
|
|
20436
|
+
return TextChunkExpression.fromOutput(childNode) ?? [];
|
|
20371
20437
|
}
|
|
20372
20438
|
if (isTextNode(childNode)) {
|
|
20373
|
-
return TextChunkExpression.fromLiteral(
|
|
20439
|
+
return TextChunkExpression.fromLiteral(childNode.data);
|
|
20374
20440
|
}
|
|
20375
20441
|
return [];
|
|
20376
20442
|
});
|
|
20377
20443
|
} else {
|
|
20378
|
-
const
|
|
20379
|
-
if (
|
|
20380
|
-
this.chunks = [
|
|
20444
|
+
const translationChunk = TextChunkExpression.fromTranslation(refExpression);
|
|
20445
|
+
if (translationChunk) {
|
|
20446
|
+
this.chunks = [translationChunk];
|
|
20381
20447
|
} else {
|
|
20382
|
-
this.chunks = [TextChunkExpression.fromReference(
|
|
20448
|
+
this.chunks = [TextChunkExpression.fromReference(refExpression)];
|
|
20383
20449
|
}
|
|
20384
20450
|
}
|
|
20385
20451
|
}
|
|
@@ -20604,14 +20670,14 @@ class RangeControlDefinition extends ControlDefinition {
|
|
|
20604
20670
|
}
|
|
20605
20671
|
|
|
20606
20672
|
class ItemsetNodesetExpression extends DependentExpression {
|
|
20607
|
-
constructor(
|
|
20608
|
-
super(
|
|
20673
|
+
constructor(nodesetExpression) {
|
|
20674
|
+
super("nodes", nodesetExpression);
|
|
20609
20675
|
}
|
|
20610
20676
|
}
|
|
20611
20677
|
|
|
20612
20678
|
class ItemsetValueExpression extends DependentExpression {
|
|
20613
20679
|
constructor(itemset, expression) {
|
|
20614
|
-
super(
|
|
20680
|
+
super("string", expression);
|
|
20615
20681
|
this.itemset = itemset;
|
|
20616
20682
|
}
|
|
20617
20683
|
}
|
|
@@ -20632,11 +20698,11 @@ class ItemsetLabelDefinition extends TextRangeDefinition {
|
|
|
20632
20698
|
if (refExpression == null) {
|
|
20633
20699
|
throw new Error("<itemset><label> missing ref attribute");
|
|
20634
20700
|
}
|
|
20635
|
-
const
|
|
20636
|
-
if (
|
|
20637
|
-
this.chunks = [
|
|
20701
|
+
const translationChunk = TextChunkExpression.fromTranslation(refExpression);
|
|
20702
|
+
if (translationChunk) {
|
|
20703
|
+
this.chunks = [translationChunk];
|
|
20638
20704
|
} else {
|
|
20639
|
-
this.chunks = [TextChunkExpression.fromReference(
|
|
20705
|
+
this.chunks = [TextChunkExpression.fromReference(refExpression)];
|
|
20640
20706
|
}
|
|
20641
20707
|
}
|
|
20642
20708
|
}
|
|
@@ -20646,7 +20712,7 @@ class ItemsetDefinition extends BodyElementDefinition {
|
|
|
20646
20712
|
super(form, parent, element);
|
|
20647
20713
|
this.parent = parent;
|
|
20648
20714
|
const nodesetExpression = parseNodesetReference(parent, element, "nodeset");
|
|
20649
|
-
this.nodes = new ItemsetNodesetExpression(
|
|
20715
|
+
this.nodes = new ItemsetNodesetExpression(nodesetExpression);
|
|
20650
20716
|
this.reference = nodesetExpression;
|
|
20651
20717
|
const valueElement = getValueElement(element);
|
|
20652
20718
|
if (valueElement == null) {
|
|
@@ -21465,6 +21531,64 @@ const parseStaticDocumentFromDOMSubtree = (subtreeRootElement, options = {}) =>
|
|
|
21465
21531
|
});
|
|
21466
21532
|
};
|
|
21467
21533
|
|
|
21534
|
+
const JR_RESOURCE_URL_PROTOCOL = "jr:";
|
|
21535
|
+
const ALL_RESOURCE_TYPES = ["image", "audio", "video"];
|
|
21536
|
+
const isResourceType = (string) => {
|
|
21537
|
+
return ALL_RESOURCE_TYPES.includes(string);
|
|
21538
|
+
};
|
|
21539
|
+
class JRResourceURL extends URL {
|
|
21540
|
+
static create(category, fileName) {
|
|
21541
|
+
return new this(`jr://${category}/${fileName}`);
|
|
21542
|
+
}
|
|
21543
|
+
static from(url) {
|
|
21544
|
+
return new this(url);
|
|
21545
|
+
}
|
|
21546
|
+
static isJRResourceReference(reference) {
|
|
21547
|
+
return reference?.startsWith(JR_RESOURCE_URL_PROTOCOL) ?? false;
|
|
21548
|
+
}
|
|
21549
|
+
constructor(url) {
|
|
21550
|
+
super(url);
|
|
21551
|
+
}
|
|
21552
|
+
}
|
|
21553
|
+
|
|
21554
|
+
const generateChunk = (node) => {
|
|
21555
|
+
if (isElementNode(node)) {
|
|
21556
|
+
return TextChunkExpression.fromOutput(node);
|
|
21557
|
+
}
|
|
21558
|
+
if (isTextNode(node)) {
|
|
21559
|
+
const formAttribute = node.parentElement.getAttribute("form");
|
|
21560
|
+
if (isResourceType(formAttribute)) {
|
|
21561
|
+
return TextChunkExpression.fromResource(node.data, formAttribute);
|
|
21562
|
+
}
|
|
21563
|
+
return TextChunkExpression.fromLiteral(node.data);
|
|
21564
|
+
}
|
|
21565
|
+
return null;
|
|
21566
|
+
};
|
|
21567
|
+
const generateChunksForValues = (valueElement) => {
|
|
21568
|
+
return Array.from(valueElement.childNodes).map((node) => generateChunk(node)).filter((chunk) => chunk !== null);
|
|
21569
|
+
};
|
|
21570
|
+
const generateChunksForTranslation = (textElement) => {
|
|
21571
|
+
return Array.from(textElement.childNodes).flatMap(
|
|
21572
|
+
(valueElement) => generateChunksForValues(valueElement)
|
|
21573
|
+
);
|
|
21574
|
+
};
|
|
21575
|
+
const generateChunksForLanguage = (translationElement) => {
|
|
21576
|
+
return new Map(
|
|
21577
|
+
Array.from(translationElement.children).map((textElement) => {
|
|
21578
|
+
const itextId = textElement.getAttribute("id");
|
|
21579
|
+
return [itextId, generateChunksForTranslation(textElement)];
|
|
21580
|
+
})
|
|
21581
|
+
);
|
|
21582
|
+
};
|
|
21583
|
+
const generateItextChunks = (translationElements) => {
|
|
21584
|
+
return new Map(
|
|
21585
|
+
translationElements.map((translationElement) => {
|
|
21586
|
+
const lang = translationElement.getAttribute("lang");
|
|
21587
|
+
return [lang, generateChunksForLanguage(translationElement)];
|
|
21588
|
+
})
|
|
21589
|
+
);
|
|
21590
|
+
};
|
|
21591
|
+
|
|
21468
21592
|
const assertItextTranslationsDefinitionEntry = ([
|
|
21469
21593
|
key,
|
|
21470
21594
|
root
|
|
@@ -21511,8 +21635,7 @@ const bindComputationResultTypes = {
|
|
|
21511
21635
|
saveIncomplete: "boolean"
|
|
21512
21636
|
};
|
|
21513
21637
|
class BindComputationExpression extends DependentExpression {
|
|
21514
|
-
constructor(
|
|
21515
|
-
const ignoreContextReference = computation === "constraint";
|
|
21638
|
+
constructor(computation, expression) {
|
|
21516
21639
|
let isDefaultExpression;
|
|
21517
21640
|
let resolvedExpression;
|
|
21518
21641
|
if (expression == null) {
|
|
@@ -21525,9 +21648,7 @@ class BindComputationExpression extends DependentExpression {
|
|
|
21525
21648
|
isDefaultExpression = false;
|
|
21526
21649
|
resolvedExpression = expression;
|
|
21527
21650
|
}
|
|
21528
|
-
super(
|
|
21529
|
-
ignoreContextReference
|
|
21530
|
-
});
|
|
21651
|
+
super(bindComputationResultTypes[computation], resolvedExpression);
|
|
21531
21652
|
this.computation = computation;
|
|
21532
21653
|
this.isDefaultExpression = isDefaultExpression;
|
|
21533
21654
|
}
|
|
@@ -21536,7 +21657,7 @@ class BindComputationExpression extends DependentExpression {
|
|
|
21536
21657
|
if (expression == null) {
|
|
21537
21658
|
return null;
|
|
21538
21659
|
}
|
|
21539
|
-
return new this(
|
|
21660
|
+
return new this(computation, expression);
|
|
21540
21661
|
}
|
|
21541
21662
|
isDefaultExpression;
|
|
21542
21663
|
}
|
|
@@ -21545,11 +21666,11 @@ class MessageDefinition extends TextRangeDefinition {
|
|
|
21545
21666
|
constructor(bind, role, message) {
|
|
21546
21667
|
super(bind.form, bind, null);
|
|
21547
21668
|
this.role = role;
|
|
21548
|
-
const
|
|
21549
|
-
if (
|
|
21550
|
-
this.chunks = [
|
|
21669
|
+
const translationChunk = TextChunkExpression.fromTranslation(message);
|
|
21670
|
+
if (translationChunk) {
|
|
21671
|
+
this.chunks = [translationChunk];
|
|
21551
21672
|
} else {
|
|
21552
|
-
this.chunks = [TextChunkExpression.fromLiteral(
|
|
21673
|
+
this.chunks = [TextChunkExpression.fromLiteral(message)];
|
|
21553
21674
|
}
|
|
21554
21675
|
}
|
|
21555
21676
|
static from(bind, type) {
|
|
@@ -22647,7 +22768,7 @@ function epochMilliToIso(e, n = 0, t = 0) {
|
|
|
22647
22768
|
}
|
|
22648
22769
|
|
|
22649
22770
|
function hashIntlFormatParts(e, n) {
|
|
22650
|
-
if (n < -
|
|
22771
|
+
if (n < -Pr) {
|
|
22651
22772
|
throw new RangeError(Io);
|
|
22652
22773
|
}
|
|
22653
22774
|
const t = e.formatToParts(n), o = {};
|
|
@@ -23347,7 +23468,7 @@ function getSingleInstantFor(e, n, t = 0, o = e.I(n)) {
|
|
|
23347
23468
|
return o[3 === t ? 1 : 0];
|
|
23348
23469
|
}
|
|
23349
23470
|
const r = isoToEpochNano(n), i = ((e, n) => {
|
|
23350
|
-
const t = e.R(moveBigNano(n, -
|
|
23471
|
+
const t = e.R(moveBigNano(n, -Uo));
|
|
23351
23472
|
return (e => {
|
|
23352
23473
|
if (e > Uo) {
|
|
23353
23474
|
throw new RangeError(go);
|
|
@@ -23363,7 +23484,7 @@ function getStartOfDayInstantFor(e, n) {
|
|
|
23363
23484
|
if (t.length) {
|
|
23364
23485
|
return t[0];
|
|
23365
23486
|
}
|
|
23366
|
-
const o = moveBigNano(isoToEpochNano(n), -
|
|
23487
|
+
const o = moveBigNano(isoToEpochNano(n), -Uo);
|
|
23367
23488
|
return e.O(o, 1);
|
|
23368
23489
|
}
|
|
23369
23490
|
|
|
@@ -23594,7 +23715,7 @@ function computeDurationSign(e, n = p) {
|
|
|
23594
23715
|
|
|
23595
23716
|
function checkDurationUnits(e) {
|
|
23596
23717
|
for (const n of dr) {
|
|
23597
|
-
clampEntity(n, e[n], -
|
|
23718
|
+
clampEntity(n, e[n], -di, di, 1);
|
|
23598
23719
|
}
|
|
23599
23720
|
return checkDurationTimeUnit(bigNanoToNumber(durationFieldsToBigNano(e), Ro)), e;
|
|
23600
23721
|
}
|
|
@@ -24288,7 +24409,7 @@ function createIntlYearDataCache(e) {
|
|
|
24288
24409
|
r += 400 * ko;
|
|
24289
24410
|
} while ((o = e(r)).year <= t);
|
|
24290
24411
|
do {
|
|
24291
|
-
if (r += (1 - o.day) * ko, o.year === t && (a.push(r), s.push(o.o)), r -= ko, ++i > 100 || r < -
|
|
24412
|
+
if (r += (1 - o.day) * ko, o.year === t && (a.push(r), s.push(o.o)), r -= ko, ++i > 100 || r < -Pr) {
|
|
24292
24413
|
throw new RangeError(fo);
|
|
24293
24414
|
}
|
|
24294
24415
|
} while ((o = e(r)).year >= t);
|
|
@@ -24969,7 +25090,7 @@ const expectedInteger = (e, n) => `Non-integer ${e}: ${n}`, expectedPositive = (
|
|
|
24969
25090
|
chinese: 13,
|
|
24970
25091
|
dangi: 13,
|
|
24971
25092
|
hebrew: -6
|
|
24972
|
-
}, m = /*@__PURE__*/ Pt(requireType, "string"), D = /*@__PURE__*/ Pt(requireType, "boolean"), cr = /*@__PURE__*/ Pt(requireType, "number"), p = /*@__PURE__*/ Bo.map((e => e + "s")), ur = /*@__PURE__*/ sortStrings(p), fr = /*@__PURE__*/ p.slice(0, 6), lr = /*@__PURE__*/ p.slice(6), dr = /*@__PURE__*/ lr.slice(1), mr = /*@__PURE__*/ Fo(p), pr = /*@__PURE__*/ wo(p, 0), hr = /*@__PURE__*/ wo(fr, 0), gr = /*@__PURE__*/ Pt(zeroOutProps, p), w = [ "isoNanosecond", "isoMicrosecond", "isoMillisecond", "isoSecond", "isoMinute", "isoHour" ], Dr = [ "isoDay", "isoMonth", "isoYear" ], Tr = /*@__PURE__*/ w.concat(Dr), Ir = /*@__PURE__*/ sortStrings(Dr), Mr = /*@__PURE__*/ sortStrings(w), Nr = /*@__PURE__*/ sortStrings(Tr), Nt = /*@__PURE__*/ wo(Mr, 0), yr = /*@__PURE__*/ Pt(zeroOutProps, Tr), vr = 1e8, Pr = vr * ko, Er = [ vr, 0 ], Sr = [ -
|
|
25093
|
+
}, m = /*@__PURE__*/ Pt(requireType, "string"), D = /*@__PURE__*/ Pt(requireType, "boolean"), cr = /*@__PURE__*/ Pt(requireType, "number"), p = /*@__PURE__*/ Bo.map((e => e + "s")), ur = /*@__PURE__*/ sortStrings(p), fr = /*@__PURE__*/ p.slice(0, 6), lr = /*@__PURE__*/ p.slice(6), dr = /*@__PURE__*/ lr.slice(1), mr = /*@__PURE__*/ Fo(p), pr = /*@__PURE__*/ wo(p, 0), hr = /*@__PURE__*/ wo(fr, 0), gr = /*@__PURE__*/ Pt(zeroOutProps, p), w = [ "isoNanosecond", "isoMicrosecond", "isoMillisecond", "isoSecond", "isoMinute", "isoHour" ], Dr = [ "isoDay", "isoMonth", "isoYear" ], Tr = /*@__PURE__*/ w.concat(Dr), Ir = /*@__PURE__*/ sortStrings(Dr), Mr = /*@__PURE__*/ sortStrings(w), Nr = /*@__PURE__*/ sortStrings(Tr), Nt = /*@__PURE__*/ wo(Mr, 0), yr = /*@__PURE__*/ Pt(zeroOutProps, Tr), vr = 1e8, Pr = vr * ko, Er = [ vr, 0 ], Sr = [ -vr, 0 ], Fr = 275760, wr = -271821, en = Intl.DateTimeFormat, br = "en-GB", Or = 1970, Br = 1972, kr = 12, Cr = /*@__PURE__*/ isoArgsToEpochMilli(1868, 9, 8), Yr = /*@__PURE__*/ on(computeJapaneseEraParts, WeakMap), Rr = "smallestUnit", Zr = "unit", zr = "roundingIncrement", Ur = "fractionalSecondDigits", Ar = "relativeTo", qr = "direction", Wr = {
|
|
24973
25094
|
constrain: 0,
|
|
24974
25095
|
reject: 1
|
|
24975
25096
|
}, jr = /*@__PURE__*/ Object.keys(Wr), Lr = {
|
|
@@ -26417,16 +26538,16 @@ class RepeatCountControlExpression extends DependentExpression {
|
|
|
26417
26538
|
static from(bodyElement, initialCount) {
|
|
26418
26539
|
const { countExpression, noAddRemoveExpression } = bodyElement;
|
|
26419
26540
|
if (countExpression != null) {
|
|
26420
|
-
return new this(
|
|
26541
|
+
return new this(countExpression);
|
|
26421
26542
|
}
|
|
26422
26543
|
if (noAddRemoveExpression != null && isConstantTruthyExpression(noAddRemoveExpression)) {
|
|
26423
26544
|
const fixedCountExpression = String(Math.max(initialCount, 1));
|
|
26424
|
-
return new this(
|
|
26545
|
+
return new this(fixedCountExpression);
|
|
26425
26546
|
}
|
|
26426
26547
|
return null;
|
|
26427
26548
|
}
|
|
26428
|
-
constructor(
|
|
26429
|
-
super(
|
|
26549
|
+
constructor(expression) {
|
|
26550
|
+
super("number", expression);
|
|
26430
26551
|
}
|
|
26431
26552
|
}
|
|
26432
26553
|
|
|
@@ -26693,12 +26814,14 @@ class ModelDefinition {
|
|
|
26693
26814
|
this.root = new RootDefinition(form, this, submission, form.body.classes);
|
|
26694
26815
|
this.nodes = nodeDefinitionMap(this.root);
|
|
26695
26816
|
this.itextTranslations = ItextTranslationsDefinition.from(form.xformDOM);
|
|
26817
|
+
this.itextChunks = generateItextChunks(form.xformDOM.itextTranslationElements);
|
|
26696
26818
|
}
|
|
26697
26819
|
binds;
|
|
26698
26820
|
root;
|
|
26699
26821
|
nodes;
|
|
26700
26822
|
instance;
|
|
26701
26823
|
itextTranslations;
|
|
26824
|
+
itextChunks;
|
|
26702
26825
|
getNodeDefinition(nodeset) {
|
|
26703
26826
|
const definition = this.nodes.get(nodeset);
|
|
26704
26827
|
if (definition == null) {
|
|
@@ -26717,6 +26840,10 @@ class ModelDefinition {
|
|
|
26717
26840
|
const { form, ...rest } = this;
|
|
26718
26841
|
return rest;
|
|
26719
26842
|
}
|
|
26843
|
+
getTranslationChunks(itextId, activeLanguage) {
|
|
26844
|
+
const languageMap = this.itextChunks.get(activeLanguage.language);
|
|
26845
|
+
return languageMap?.get(itextId) ?? [];
|
|
26846
|
+
}
|
|
26720
26847
|
}
|
|
26721
26848
|
|
|
26722
26849
|
class XFormDefinition {
|
|
@@ -26742,22 +26869,6 @@ class XFormDefinition {
|
|
|
26742
26869
|
model;
|
|
26743
26870
|
}
|
|
26744
26871
|
|
|
26745
|
-
const JR_RESOURCE_URL_PROTOCOL = "jr:";
|
|
26746
|
-
class JRResourceURL extends URL {
|
|
26747
|
-
static create(category, fileName) {
|
|
26748
|
-
return new this(`jr://${category}/${fileName}`);
|
|
26749
|
-
}
|
|
26750
|
-
static from(url) {
|
|
26751
|
-
return new this(url);
|
|
26752
|
-
}
|
|
26753
|
-
static isJRResourceReference(reference) {
|
|
26754
|
-
return reference?.startsWith(JR_RESOURCE_URL_PROTOCOL) ?? false;
|
|
26755
|
-
}
|
|
26756
|
-
constructor(url) {
|
|
26757
|
-
super(url);
|
|
26758
|
-
}
|
|
26759
|
-
}
|
|
26760
|
-
|
|
26761
26872
|
const assertSecondaryInstanceDefinition = ({ root }) => {
|
|
26762
26873
|
const id = root.getAttributeValue("id");
|
|
26763
26874
|
if (id == null) {
|
|
@@ -26805,7 +26916,7 @@ var papaparse_min$1 = {exports: {}};
|
|
|
26805
26916
|
|
|
26806
26917
|
/* @license
|
|
26807
26918
|
Papa Parse
|
|
26808
|
-
v5.5.
|
|
26919
|
+
v5.5.3
|
|
26809
26920
|
https://github.com/mholt/PapaParse
|
|
26810
26921
|
License: MIT
|
|
26811
26922
|
*/
|
|
@@ -26817,7 +26928,7 @@ function requirePapaparse_min () {
|
|
|
26817
26928
|
if (hasRequiredPapaparse_min) return papaparse_min$1.exports;
|
|
26818
26929
|
hasRequiredPapaparse_min = 1;
|
|
26819
26930
|
(function (module, exports) {
|
|
26820
|
-
((e,t)=>{module.exports=t();})(papaparse_min,function r(){var n="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n?n:{};var d,s=!n.document&&!!n.postMessage,a=n.IS_PAPA_WORKER||false,o={},h=0,v={};function u(e){this._handle=null,this._finished=false,this._completed=false,this._halted=false,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=true,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=w(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null);this._handle=new i(t),(this._handle.streamer=this)._config=t;}.call(this,e),this.parseChunk=function(t,e){var i=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<i){let e=this._config.newline;e||(r=this._config.quoteChar||'"',e=this._handle.guessLineEndings(t,r)),t=[...t.split(e).slice(i)].join(e);}this.isFirstChunk&&U(this._config.beforeFirstChunk)&&void 0!==(r=this._config.beforeFirstChunk(t))&&(t=r),this.isFirstChunk=false,this._halted=false;var i=this._partialLine+t,r=(this._partialLine="",this._handle.parse(i,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){t=r.meta.cursor,i=(this._finished||(this._partialLine=i.substring(t-this._baseIndex),this._baseIndex=t),r&&r.data&&(this._rowCount+=r.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview);if(a)n.postMessage({results:r,workerId:v.WORKER_ID,finished:i});else if(U(this._config.chunk)&&!e){if(this._config.chunk(r,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=true);this._completeResults=r=void 0;}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(r.data),this._completeResults.errors=this._completeResults.errors.concat(r.errors),this._completeResults.meta=r.meta),this._completed||!i||!U(this._config.complete)||r&&r.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=true),i||r&&r.meta.paused||this._nextChunk(),r}this._halted=true;},this._sendError=function(e){U(this._config.error)?this._config.error(e):a&&this._config.error&&n.postMessage({workerId:v.WORKER_ID,error:e,finished:false});};}function f(e){var r;(e=e||{}).chunkSize||(e.chunkSize=v.RemoteChunkSize),u.call(this,e),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded();}:function(){this._readChunk();},this.stream=function(e){this._input=e,this._nextChunk();},this._readChunk=function(){if(this._finished)this._chunkLoaded();else {if(r=new XMLHttpRequest,this._config.withCredentials&&(r.withCredentials=this._config.withCredentials),s||(r.onload=y(this._chunkLoaded,this),r.onerror=y(this._chunkError,this)),r.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var e,t=this._config.downloadRequestHeaders;for(e in t)r.setRequestHeader(e,t[e]);}var i;this._config.chunkSize&&(i=this._start+this._config.chunkSize-1,r.setRequestHeader("Range","bytes="+this._start+"-"+i));try{r.send(this._config.downloadRequestBody);}catch(e){this._chunkError(e.message);}s&&0===r.status&&this._chunkError();}},this._chunkLoaded=function(){4===r.readyState&&(r.status<200||400<=r.status?this._chunkError():(this._start+=this._config.chunkSize||r.responseText.length,this._finished=!this._config.chunkSize||this._start>=(e=>null!==(e=e.getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1)(r),this.parseChunk(r.responseText)));},this._chunkError=function(e){e=r.statusText||e;this._sendError(new Error(e));};}function l(e){(e=e||{}).chunkSize||(e.chunkSize=v.LocalChunkSize),u.call(this,e);var i,r,n="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((i=new FileReader).onload=y(this._chunkLoaded,this),i.onerror=y(this._chunkError,this)):i=new FileReaderSync,this._nextChunk();},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk();},this._readChunk=function(){var e=this._input,t=(this._config.chunkSize&&(t=Math.min(this._start+this._config.chunkSize,this._input.size),e=r.call(e,this._start,t)),i.readAsText(e,this._config.encoding));n||this._chunkLoaded({target:{result:t}});},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result);},this._chunkError=function(){this._sendError(i.error);};}function c(e){var i;u.call(this,e=e||{}),this.stream=function(e){return i=e,this._nextChunk()},this._nextChunk=function(){var e,t;if(!this._finished)return e=this._config.chunkSize,i=e?(t=i.substring(0,e),i.substring(e)):(t=i,""),this._finished=!i,this.parseChunk(t)};}function p(e){u.call(this,e=e||{});var t=[],i=true,r=false;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause();},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume();},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError);},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=true);},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):i=true;},this._streamData=y(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(t.shift()));}catch(e){this._streamError(e);}},this),this._streamError=y(function(e){this._streamCleanUp(),this._sendError(e);},this),this._streamEnd=y(function(){this._streamCleanUp(),r=true,this._streamData("");},this),this._streamCleanUp=y(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError);},this);}function i(m){var n,s,a,t,o=Math.pow(2,53),h=-o,u=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,d=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,i=this,r=0,f=0,l=false,e=false,c=[],p={data:[],errors:[],meta:{}};function y(e){return "greedy"===m.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function g(){if(p&&a&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+v.DefaultDelimiter+"'"),a=false),m.skipEmptyLines&&(p.data=p.data.filter(function(e){return !y(e)})),_()){if(p)if(Array.isArray(p.data[0])){for(var e=0;_()&&e<p.data.length;e++)p.data[e].forEach(t);p.data.splice(0,1);}else p.data.forEach(t);function t(e,t){U(m.transformHeader)&&(e=m.transformHeader(e,t)),c.push(e);}}function i(e,t){for(var i=m.header?{}:[],r=0;r<e.length;r++){var n=r,s=e[r],s=((e,t)=>(e=>(m.dynamicTypingFunction&&void 0===m.dynamicTyping[e]&&(m.dynamicTyping[e]=m.dynamicTypingFunction(e)),true===(m.dynamicTyping[e]||m.dynamicTyping)))(e)?"true"===t||"TRUE"===t||"false"!==t&&"FALSE"!==t&&((e=>{if(u.test(e)){e=parseFloat(e);if(h<e&&e<o)return 1}})(t)?parseFloat(t):d.test(t)?new Date(t):""===t?null:t):t)(n=m.header?r>=c.length?"__parsed_extra":c[r]:n,s=m.transform?m.transform(s,n):s);"__parsed_extra"===n?(i[n]=i[n]||[],i[n].push(s)):i[n]=s;}return m.header&&(r>c.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+c.length+" fields but parsed "+r,f+t):r<c.length&&k("FieldMismatch","TooFewFields","Too few fields: expected "+c.length+" fields but parsed "+r,f+t)),i}var r;p&&(m.header||m.dynamicTyping||m.transform)&&(r=1,!p.data.length||Array.isArray(p.data[0])?(p.data=p.data.map(i),r=p.data.length):p.data=i(p.data,0),m.header&&p.meta&&(p.meta.fields=c),f+=r);}function _(){return m.header&&0===c.length}function k(e,t,i,r){e={type:e,code:t,message:i};void 0!==r&&(e.row=r),p.errors.push(e);}U(m.step)&&(t=m.step,m.step=function(e){p=e,_()?g():(g(),0!==p.data.length&&(r+=e.data.length,m.preview&&r>m.preview?s.abort():(p.data=p.data[0],t(p,i))));}),this.parse=function(e,t,i){var r=m.quoteChar||'"',r=(m.newline||(m.newline=this.guessLineEndings(e,r)),a=false,m.delimiter?U(m.delimiter)&&(m.delimiter=m.delimiter(e),p.meta.delimiter=m.delimiter):((r=((e,t,i,r,n)=>{var s,a,o,h;n=n||[",","\t","|",";",v.RECORD_SEP,v.UNIT_SEP];for(var u=0;u<n.length;u++){for(var d,f=n[u],l=0,c=0,p=0,g=(o=void 0,new E({comments:r,delimiter:f,newline:t,preview:10}).parse(e)),_=0;_<g.data.length;_++)i&&y(g.data[_])?p++:(d=g.data[_].length,c+=d,void 0===o?o=d:0<d&&(l+=Math.abs(d-o),o=d));0<g.data.length&&(c/=g.data.length-p),(void 0===a||l<=a)&&(void 0===h||h<c)&&1.99<c&&(a=l,s=f,h=c);}return {successful:!!(m.delimiter=s),bestDelimiter:s}})(e,m.newline,m.skipEmptyLines,m.comments,m.delimitersToGuess)).successful?m.delimiter=r.bestDelimiter:(a=true,m.delimiter=v.DefaultDelimiter),p.meta.delimiter=m.delimiter),w(m));return m.preview&&m.header&&r.preview++,n=e,s=new E(r),p=s.parse(n,t,i),g(),l?{meta:{paused:true}}:p||{meta:{paused:false}}},this.paused=function(){return l},this.pause=function(){l=true,s.abort(),n=U(m.chunk)?"":n.substring(s.getCharIndex());},this.resume=function(){i.streamer._halted?(l=false,i.streamer.parseChunk(n,true)):setTimeout(i.resume,3);},this.aborted=function(){return e},this.abort=function(){e=true,s.abort(),p.meta.aborted=true,U(m.complete)&&m.complete(p),n="";},this.guessLineEndings=function(e,t){e=e.substring(0,1048576);var t=new RegExp(P(t)+"([^]*?)"+P(t),"gm"),i=(e=e.replace(t,"")).split("\r"),t=e.split("\n"),e=1<t.length&&t[0].length<i[0].length;if(1===i.length||e)return "\n";for(var r=0,n=0;n<i.length;n++)"\n"===i[n][0]&&r++;return r>=i.length/2?"\r\n":"\r"};}function P(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E(C){var S=(C=C||{}).delimiter,O=C.newline,x=C.comments,I=C.step,A=C.preview,T=C.fastMode,D=null,L=false,F=null==C.quoteChar?'"':C.quoteChar,j=F;if(void 0!==C.escapeChar&&(j=C.escapeChar),("string"!=typeof S||-1<v.BAD_DELIMITERS.indexOf(S))&&(S=","),x===S)throw new Error("Comment character same as delimiter");true===x?x="#":("string"!=typeof x||-1<v.BAD_DELIMITERS.indexOf(x))&&(x=false),"\n"!==O&&"\r"!==O&&"\r\n"!==O&&(O="\n");var z=0,M=false;this.parse=function(i,t,r){if("string"!=typeof i)throw new Error("Input must be a string");var n=i.length,e=S.length,s=O.length,a=x.length,o=U(I),h=[],u=[],d=[],f=z=0;if(!i)return b();if(T||false!==T&&-1===i.indexOf(F)){for(var l=i.split(O),c=0;c<l.length;c++){if(d=l[c],z+=d.length,c!==l.length-1)z+=O.length;else if(r)return b();if(!x||d.substring(0,a)!==x){if(o){if(h=[],k(d.split(S)),R(),M)return b()}else k(d.split(S));if(A&&A<=c)return h=h.slice(0,A),b(true)}}return b()}for(var p=i.indexOf(S,z),g=i.indexOf(O,z),_=new RegExp(P(j)+P(F),"g"),m=i.indexOf(F,z);;)if(i[z]===F)for(m=z,z++;;){if(-1===(m=i.indexOf(F,m+1)))return r||u.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:h.length,index:z}),E();if(m===n-1)return E(i.substring(z,m).replace(_,F));if(F===j&&i[m+1]===j)m++;else if(F===j||0===m||i[m-1]!==j){ -1!==p&&p<m+1&&(p=i.indexOf(S,m+1));var y=v(-1===(g=-1!==g&&g<m+1?i.indexOf(O,m+1):g)?p:Math.min(p,g));if(i.substr(m+1+y,e)===S){d.push(i.substring(z,m).replace(_,F)),i[z=m+1+y+e]!==F&&(m=i.indexOf(F,z)),p=i.indexOf(S,z),g=i.indexOf(O,z);break}y=v(g);if(i.substring(m+1+y,m+1+y+s)===O){if(d.push(i.substring(z,m).replace(_,F)),w(m+1+y+s),p=i.indexOf(S,z),m=i.indexOf(F,z),o&&(R(),M))return b();if(A&&h.length>=A)return b(true);break}u.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:h.length,index:z}),m++;}}else if(x&&0===d.length&&i.substring(z,z+a)===x){if(-1===g)return b();z=g+s,g=i.indexOf(O,z),p=i.indexOf(S,z);}else if(-1!==p&&(p<g||-1===g))d.push(i.substring(z,p)),z=p+e,p=i.indexOf(S,z);else {if(-1===g)break;if(d.push(i.substring(z,g)),w(g+s),o&&(R(),M))return b();if(A&&h.length>=A)return b(true)}return E();function k(e){h.push(e),f=z;}function v(e){var t=0;return t=-1!==e&&(e=i.substring(m+1,e))&&""===e.trim()?e.length:t}function E(e){return r||(void 0===e&&(e=i.substring(z)),d.push(e),z=n,k(d),o&&R()),b()}function w(e){z=e,k(d),d=[],g=i.indexOf(O,z);}function b(e){if(C.header&&!t&&h.length&&!L){var s=h[0],a={},o=new Set(s);let n=false;for(let r=0;r<s.length;r++){let i=s[r];if(a[i=U(C.transformHeader)?C.transformHeader(i,r):i]){let e,t=a[i];for(;e=i+"_"+t,t++,o.has(e););o.add(e),s[r]=e,a[i]++,n=true,(D=null===D?{}:D)[e]=i;}else a[i]=1,s[r]=i;o.add(i);}n&&console.warn("Duplicate headers found and renamed."),L=true;}return {data:h,errors:u,meta:{delimiter:S,linebreak:O,aborted:M,truncated:!!e,cursor:f+(t||0),renamedHeaders:D}}}function R(){I(b()),h=[],u=[];}},this.abort=function(){M=true;},this.getCharIndex=function(){return z};}function g(e){var t=e.data,i=o[t.workerId],r=false;if(t.error)i.userError(t.error,t.file);else if(t.results&&t.results.data){var n={abort:function(){r=true,_(t.workerId,{data:[],errors:[],meta:{aborted:true}});},pause:m,resume:m};if(U(i.userStep)){for(var s=0;s<t.results.data.length&&(i.userStep({data:t.results.data[s],errors:t.results.errors,meta:t.results.meta},n),!r);s++);delete t.results;}else U(i.userChunk)&&(i.userChunk(t.results,n,t.file),delete t.results);}t.finished&&!r&&_(t.workerId,t.results);}function _(e,t){var i=o[e];U(i.userComplete)&&i.userComplete(t),i.terminate(),delete o[e];}function m(){throw new Error("Not implemented.")}function w(e){if("object"!=typeof e||null===e)return e;var t,i=Array.isArray(e)?[]:{};for(t in e)i[t]=w(e[t]);return i}function y(e,t){return function(){e.apply(t,arguments);}}function U(e){return "function"==typeof e}return v.parse=function(e,t){var i=(t=t||{}).dynamicTyping||false;U(i)&&(t.dynamicTypingFunction=i,i={});if(t.dynamicTyping=i,t.transform=!!U(t.transform)&&t.transform,!t.worker||!v.WORKERS_SUPPORTED)return i=null,v.NODE_STREAM_INPUT,"string"==typeof e?(e=(e=>65279!==e.charCodeAt(0)?e:e.slice(1))(e),i=new(t.download?f:c)(t)):true===e.readable&&U(e.read)&&U(e.on)?i=new p(t):(n.File&&e instanceof File||e instanceof Object)&&(i=new l(t)),i.stream(e);(i=(()=>{var e;return !!v.WORKERS_SUPPORTED&&(e=(()=>{var e=n.URL||n.webkitURL||null,t=r.toString();return v.BLOB_URL||(v.BLOB_URL=e.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",t,")();"],{type:"text/javascript"})))})(),(e=new n.Worker(e)).onmessage=g,e.id=h++,o[e.id]=e)})()).userStep=t.step,i.userChunk=t.chunk,i.userComplete=t.complete,i.userError=t.error,t.step=U(t.step),t.chunk=U(t.chunk),t.complete=U(t.complete),t.error=U(t.error),delete t.worker,i.postMessage({input:e,config:t,workerId:i.id});},v.unparse=function(e,t){var n=false,_=true,m=",",y="\r\n",s='"',a=s+s,i=false,r=null,o=false,h=((()=>{if("object"==typeof t){if("string"!=typeof t.delimiter||v.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(m=t.delimiter),"boolean"!=typeof t.quotes&&"function"!=typeof t.quotes&&!Array.isArray(t.quotes)||(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(i=t.skipEmptyLines),"string"==typeof t.newline&&(y=t.newline),"string"==typeof t.quoteChar&&(s=t.quoteChar),"boolean"==typeof t.header&&(_=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");r=t.columns;} void 0!==t.escapeChar&&(a=t.escapeChar+s),t.escapeFormulae instanceof RegExp?o=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(o=/^[=+\-@\t\r].*$/);}})(),new RegExp(P(s),"g"));"string"==typeof e&&(e=JSON.parse(e));if(Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return u(null,e,i);if("object"==typeof e[0])return u(r||Object.keys(e[0]),e,i)}else if("object"==typeof e)return "string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||r),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),u(e.fields||[],e.data||[],i);throw new Error("Unable to serialize unrecognized input");function u(e,t,i){var r="",n=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0<e.length),s=!Array.isArray(t[0]);if(n&&_){for(var a=0;a<e.length;a++)0<a&&(r+=m),r+=k(e[a],a);0<t.length&&(r+=y);}for(var o=0;o<t.length;o++){var h=(n?e:t[o]).length,u=false,d=n?0===Object.keys(t[o]).length:0===t[o].length;if(i&&!n&&(u="greedy"===i?""===t[o].join("").trim():1===t[o].length&&0===t[o][0].length),"greedy"===i&&n){for(var f=[],l=0;l<h;l++){var c=s?e[l]:l;f.push(t[o][c]);}u=""===f.join("").trim();}if(!u){for(var p=0;p<h;p++){0<p&&!d&&(r+=m);var g=n&&s?e[p]:p;r+=k(t[o][g],p);}o<t.length-1&&(!i||0<h&&!d)&&(r+=y);}}return r}function k(e,t){var i,r;return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(r=false,o&&"string"==typeof e&&o.test(e)&&(e="'"+e,r=true),i=e.toString().replace(h,a),(r=r||true===n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||((e,t)=>{for(var i=0;i<t.length;i++)if(-1<e.indexOf(t[i]))return true;return false})(i,v.BAD_DELIMITERS)||-1<i.indexOf(m)||" "===i.charAt(0)||" "===i.charAt(i.length-1))?s+i+s:i)}},v.RECORD_SEP=String.fromCharCode(30),v.UNIT_SEP=String.fromCharCode(31),v.BYTE_ORDER_MARK="\ufeff",v.BAD_DELIMITERS=["\r","\n",'"',v.BYTE_ORDER_MARK],v.WORKERS_SUPPORTED=!s&&!!n.Worker,v.NODE_STREAM_INPUT=1,v.LocalChunkSize=10485760,v.RemoteChunkSize=5242880,v.DefaultDelimiter=",",v.Parser=E,v.ParserHandle=i,v.NetworkStreamer=f,v.FileStreamer=l,v.StringStreamer=c,v.ReadableStreamStreamer=p,n.jQuery&&((d=n.jQuery).fn.parse=function(o){var i=o.config||{},h=[];return this.each(function(e){if(!("INPUT"===d(this).prop("tagName").toUpperCase()&&"file"===d(this).attr("type").toLowerCase()&&n.FileReader)||!this.files||0===this.files.length)return true;for(var t=0;t<this.files.length;t++)h.push({file:this.files[t],inputElem:this,instanceConfig:d.extend({},i)});}),e(),this;function e(){if(0===h.length)U(o.complete)&&o.complete();else {var e,t,i,r,n=h[0];if(U(o.before)){var s=o.before(n.file,n.inputElem);if("object"==typeof s){if("abort"===s.action)return e="AbortError",t=n.file,i=n.inputElem,r=s.reason,void(U(o.error)&&o.error({name:e},t,i,r));if("skip"===s.action)return void u();"object"==typeof s.config&&(n.instanceConfig=d.extend(n.instanceConfig,s.config));}else if("skip"===s)return void u()}var a=n.instanceConfig.complete;n.instanceConfig.complete=function(e){U(a)&&a(e,n.file,n.inputElem),u();},v.parse(n.file,n.instanceConfig);}}function u(){h.splice(0,1),e();}}),a&&(n.onmessage=function(e){e=e.data;void 0===v.WORKER_ID&&e&&(v.WORKER_ID=e.workerId);"string"==typeof e.input?n.postMessage({workerId:v.WORKER_ID,results:v.parse(e.input,e.config),finished:true}):(n.File&&e.input instanceof File||e.input instanceof Object)&&(e=v.parse(e.input,e.config))&&n.postMessage({workerId:v.WORKER_ID,results:e,finished:true});}),(f.prototype=Object.create(u.prototype)).constructor=f,(l.prototype=Object.create(u.prototype)).constructor=l,(c.prototype=Object.create(c.prototype)).constructor=c,(p.prototype=Object.create(u.prototype)).constructor=p,v});
|
|
26931
|
+
((e,t)=>{module.exports=t();})(papaparse_min,function r(){var n="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n?n:{};var d,s=!n.document&&!!n.postMessage,a=n.IS_PAPA_WORKER||false,o={},h=0,v={};function u(e){this._handle=null,this._finished=false,this._completed=false,this._halted=false,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=true,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null);this._handle=new i(t),(this._handle.streamer=this)._config=t;}.call(this,e),this.parseChunk=function(t,e){var i=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<i){let e=this._config.newline;e||(r=this._config.quoteChar||'"',e=this._handle.guessLineEndings(t,r)),t=[...t.split(e).slice(i)].join(e);}this.isFirstChunk&&U(this._config.beforeFirstChunk)&&void 0!==(r=this._config.beforeFirstChunk(t))&&(t=r),this.isFirstChunk=false,this._halted=false;var i=this._partialLine+t,r=(this._partialLine="",this._handle.parse(i,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){t=r.meta.cursor,i=(this._finished||(this._partialLine=i.substring(t-this._baseIndex),this._baseIndex=t),r&&r.data&&(this._rowCount+=r.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview);if(a)n.postMessage({results:r,workerId:v.WORKER_ID,finished:i});else if(U(this._config.chunk)&&!e){if(this._config.chunk(r,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=true);this._completeResults=r=void 0;}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(r.data),this._completeResults.errors=this._completeResults.errors.concat(r.errors),this._completeResults.meta=r.meta),this._completed||!i||!U(this._config.complete)||r&&r.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=true),i||r&&r.meta.paused||this._nextChunk(),r}this._halted=true;},this._sendError=function(e){U(this._config.error)?this._config.error(e):a&&this._config.error&&n.postMessage({workerId:v.WORKER_ID,error:e,finished:false});};}function f(e){var r;(e=e||{}).chunkSize||(e.chunkSize=v.RemoteChunkSize),u.call(this,e),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded();}:function(){this._readChunk();},this.stream=function(e){this._input=e,this._nextChunk();},this._readChunk=function(){if(this._finished)this._chunkLoaded();else {if(r=new XMLHttpRequest,this._config.withCredentials&&(r.withCredentials=this._config.withCredentials),s||(r.onload=y(this._chunkLoaded,this),r.onerror=y(this._chunkError,this)),r.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var e,t=this._config.downloadRequestHeaders;for(e in t)r.setRequestHeader(e,t[e]);}var i;this._config.chunkSize&&(i=this._start+this._config.chunkSize-1,r.setRequestHeader("Range","bytes="+this._start+"-"+i));try{r.send(this._config.downloadRequestBody);}catch(e){this._chunkError(e.message);}s&&0===r.status&&this._chunkError();}},this._chunkLoaded=function(){4===r.readyState&&(r.status<200||400<=r.status?this._chunkError():(this._start+=this._config.chunkSize||r.responseText.length,this._finished=!this._config.chunkSize||this._start>=(e=>null!==(e=e.getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1)(r),this.parseChunk(r.responseText)));},this._chunkError=function(e){e=r.statusText||e;this._sendError(new Error(e));};}function l(e){(e=e||{}).chunkSize||(e.chunkSize=v.LocalChunkSize),u.call(this,e);var i,r,n="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((i=new FileReader).onload=y(this._chunkLoaded,this),i.onerror=y(this._chunkError,this)):i=new FileReaderSync,this._nextChunk();},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk();},this._readChunk=function(){var e=this._input,t=(this._config.chunkSize&&(t=Math.min(this._start+this._config.chunkSize,this._input.size),e=r.call(e,this._start,t)),i.readAsText(e,this._config.encoding));n||this._chunkLoaded({target:{result:t}});},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result);},this._chunkError=function(){this._sendError(i.error);};}function c(e){var i;u.call(this,e=e||{}),this.stream=function(e){return i=e,this._nextChunk()},this._nextChunk=function(){var e,t;if(!this._finished)return e=this._config.chunkSize,i=e?(t=i.substring(0,e),i.substring(e)):(t=i,""),this._finished=!i,this.parseChunk(t)};}function p(e){u.call(this,e=e||{});var t=[],i=true,r=false;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause();},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume();},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError);},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=true);},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):i=true;},this._streamData=y(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(t.shift()));}catch(e){this._streamError(e);}},this),this._streamError=y(function(e){this._streamCleanUp(),this._sendError(e);},this),this._streamEnd=y(function(){this._streamCleanUp(),r=true,this._streamData("");},this),this._streamCleanUp=y(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError);},this);}function i(m){var n,s,a,t,o=Math.pow(2,53),h=-o,u=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,d=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,i=this,r=0,f=0,l=false,e=false,c=[],p={data:[],errors:[],meta:{}};function y(e){return "greedy"===m.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function g(){if(p&&a&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+v.DefaultDelimiter+"'"),a=false),m.skipEmptyLines&&(p.data=p.data.filter(function(e){return !y(e)})),_()){if(p)if(Array.isArray(p.data[0])){for(var e=0;_()&&e<p.data.length;e++)p.data[e].forEach(t);p.data.splice(0,1);}else p.data.forEach(t);function t(e,t){U(m.transformHeader)&&(e=m.transformHeader(e,t)),c.push(e);}}function i(e,t){for(var i=m.header?{}:[],r=0;r<e.length;r++){var n=r,s=e[r],s=((e,t)=>(e=>(m.dynamicTypingFunction&&void 0===m.dynamicTyping[e]&&(m.dynamicTyping[e]=m.dynamicTypingFunction(e)),true===(m.dynamicTyping[e]||m.dynamicTyping)))(e)?"true"===t||"TRUE"===t||"false"!==t&&"FALSE"!==t&&((e=>{if(u.test(e)){e=parseFloat(e);if(h<e&&e<o)return 1}})(t)?parseFloat(t):d.test(t)?new Date(t):""===t?null:t):t)(n=m.header?r>=c.length?"__parsed_extra":c[r]:n,s=m.transform?m.transform(s,n):s);"__parsed_extra"===n?(i[n]=i[n]||[],i[n].push(s)):i[n]=s;}return m.header&&(r>c.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+c.length+" fields but parsed "+r,f+t):r<c.length&&k("FieldMismatch","TooFewFields","Too few fields: expected "+c.length+" fields but parsed "+r,f+t)),i}var r;p&&(m.header||m.dynamicTyping||m.transform)&&(r=1,!p.data.length||Array.isArray(p.data[0])?(p.data=p.data.map(i),r=p.data.length):p.data=i(p.data,0),m.header&&p.meta&&(p.meta.fields=c),f+=r);}function _(){return m.header&&0===c.length}function k(e,t,i,r){e={type:e,code:t,message:i};void 0!==r&&(e.row=r),p.errors.push(e);}U(m.step)&&(t=m.step,m.step=function(e){p=e,_()?g():(g(),0!==p.data.length&&(r+=e.data.length,m.preview&&r>m.preview?s.abort():(p.data=p.data[0],t(p,i))));}),this.parse=function(e,t,i){var r=m.quoteChar||'"',r=(m.newline||(m.newline=this.guessLineEndings(e,r)),a=false,m.delimiter?U(m.delimiter)&&(m.delimiter=m.delimiter(e),p.meta.delimiter=m.delimiter):((r=((e,t,i,r,n)=>{var s,a,o,h;n=n||[",","\t","|",";",v.RECORD_SEP,v.UNIT_SEP];for(var u=0;u<n.length;u++){for(var d,f=n[u],l=0,c=0,p=0,g=(o=void 0,new E({comments:r,delimiter:f,newline:t,preview:10}).parse(e)),_=0;_<g.data.length;_++)i&&y(g.data[_])?p++:(d=g.data[_].length,c+=d,void 0===o?o=d:0<d&&(l+=Math.abs(d-o),o=d));0<g.data.length&&(c/=g.data.length-p),(void 0===a||l<=a)&&(void 0===h||h<c)&&1.99<c&&(a=l,s=f,h=c);}return {successful:!!(m.delimiter=s),bestDelimiter:s}})(e,m.newline,m.skipEmptyLines,m.comments,m.delimitersToGuess)).successful?m.delimiter=r.bestDelimiter:(a=true,m.delimiter=v.DefaultDelimiter),p.meta.delimiter=m.delimiter),b(m));return m.preview&&m.header&&r.preview++,n=e,s=new E(r),p=s.parse(n,t,i),g(),l?{meta:{paused:true}}:p||{meta:{paused:false}}},this.paused=function(){return l},this.pause=function(){l=true,s.abort(),n=U(m.chunk)?"":n.substring(s.getCharIndex());},this.resume=function(){i.streamer._halted?(l=false,i.streamer.parseChunk(n,true)):setTimeout(i.resume,3);},this.aborted=function(){return e},this.abort=function(){e=true,s.abort(),p.meta.aborted=true,U(m.complete)&&m.complete(p),n="";},this.guessLineEndings=function(e,t){e=e.substring(0,1048576);var t=new RegExp(P(t)+"([^]*?)"+P(t),"gm"),i=(e=e.replace(t,"")).split("\r"),t=e.split("\n"),e=1<t.length&&t[0].length<i[0].length;if(1===i.length||e)return "\n";for(var r=0,n=0;n<i.length;n++)"\n"===i[n][0]&&r++;return r>=i.length/2?"\r\n":"\r"};}function P(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E(C){var S=(C=C||{}).delimiter,O=C.newline,x=C.comments,I=C.step,A=C.preview,T=C.fastMode,D=null,L=false,F=null==C.quoteChar?'"':C.quoteChar,j=F;if(void 0!==C.escapeChar&&(j=C.escapeChar),("string"!=typeof S||-1<v.BAD_DELIMITERS.indexOf(S))&&(S=","),x===S)throw new Error("Comment character same as delimiter");true===x?x="#":("string"!=typeof x||-1<v.BAD_DELIMITERS.indexOf(x))&&(x=false),"\n"!==O&&"\r"!==O&&"\r\n"!==O&&(O="\n");var z=0,M=false;this.parse=function(i,t,r){if("string"!=typeof i)throw new Error("Input must be a string");var n=i.length,e=S.length,s=O.length,a=x.length,o=U(I),h=[],u=[],d=[],f=z=0;if(!i)return w();if(T||false!==T&&-1===i.indexOf(F)){for(var l=i.split(O),c=0;c<l.length;c++){if(d=l[c],z+=d.length,c!==l.length-1)z+=O.length;else if(r)return w();if(!x||d.substring(0,a)!==x){if(o){if(h=[],k(d.split(S)),R(),M)return w()}else k(d.split(S));if(A&&A<=c)return h=h.slice(0,A),w(true)}}return w()}for(var p=i.indexOf(S,z),g=i.indexOf(O,z),_=new RegExp(P(j)+P(F),"g"),m=i.indexOf(F,z);;)if(i[z]===F)for(m=z,z++;;){if(-1===(m=i.indexOf(F,m+1)))return r||u.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:h.length,index:z}),E();if(m===n-1)return E(i.substring(z,m).replace(_,F));if(F===j&&i[m+1]===j)m++;else if(F===j||0===m||i[m-1]!==j){ -1!==p&&p<m+1&&(p=i.indexOf(S,m+1));var y=v(-1===(g=-1!==g&&g<m+1?i.indexOf(O,m+1):g)?p:Math.min(p,g));if(i.substr(m+1+y,e)===S){d.push(i.substring(z,m).replace(_,F)),i[z=m+1+y+e]!==F&&(m=i.indexOf(F,z)),p=i.indexOf(S,z),g=i.indexOf(O,z);break}y=v(g);if(i.substring(m+1+y,m+1+y+s)===O){if(d.push(i.substring(z,m).replace(_,F)),b(m+1+y+s),p=i.indexOf(S,z),m=i.indexOf(F,z),o&&(R(),M))return w();if(A&&h.length>=A)return w(true);break}u.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:h.length,index:z}),m++;}}else if(x&&0===d.length&&i.substring(z,z+a)===x){if(-1===g)return w();z=g+s,g=i.indexOf(O,z),p=i.indexOf(S,z);}else if(-1!==p&&(p<g||-1===g))d.push(i.substring(z,p)),z=p+e,p=i.indexOf(S,z);else {if(-1===g)break;if(d.push(i.substring(z,g)),b(g+s),o&&(R(),M))return w();if(A&&h.length>=A)return w(true)}return E();function k(e){h.push(e),f=z;}function v(e){var t=0;return t=-1!==e&&(e=i.substring(m+1,e))&&""===e.trim()?e.length:t}function E(e){return r||(void 0===e&&(e=i.substring(z)),d.push(e),z=n,k(d),o&&R()),w()}function b(e){z=e,k(d),d=[],g=i.indexOf(O,z);}function w(e){if(C.header&&!t&&h.length&&!L){var s=h[0],a=Object.create(null),o=new Set(s);let n=false;for(let r=0;r<s.length;r++){let i=s[r];if(a[i=U(C.transformHeader)?C.transformHeader(i,r):i]){let e,t=a[i];for(;e=i+"_"+t,t++,o.has(e););o.add(e),s[r]=e,a[i]++,n=true,(D=null===D?{}:D)[e]=i;}else a[i]=1,s[r]=i;o.add(i);}n&&console.warn("Duplicate headers found and renamed."),L=true;}return {data:h,errors:u,meta:{delimiter:S,linebreak:O,aborted:M,truncated:!!e,cursor:f+(t||0),renamedHeaders:D}}}function R(){I(w()),h=[],u=[];}},this.abort=function(){M=true;},this.getCharIndex=function(){return z};}function g(e){var t=e.data,i=o[t.workerId],r=false;if(t.error)i.userError(t.error,t.file);else if(t.results&&t.results.data){var n={abort:function(){r=true,_(t.workerId,{data:[],errors:[],meta:{aborted:true}});},pause:m,resume:m};if(U(i.userStep)){for(var s=0;s<t.results.data.length&&(i.userStep({data:t.results.data[s],errors:t.results.errors,meta:t.results.meta},n),!r);s++);delete t.results;}else U(i.userChunk)&&(i.userChunk(t.results,n,t.file),delete t.results);}t.finished&&!r&&_(t.workerId,t.results);}function _(e,t){var i=o[e];U(i.userComplete)&&i.userComplete(t),i.terminate(),delete o[e];}function m(){throw new Error("Not implemented.")}function b(e){if("object"!=typeof e||null===e)return e;var t,i=Array.isArray(e)?[]:{};for(t in e)i[t]=b(e[t]);return i}function y(e,t){return function(){e.apply(t,arguments);}}function U(e){return "function"==typeof e}return v.parse=function(e,t){var i=(t=t||{}).dynamicTyping||false;U(i)&&(t.dynamicTypingFunction=i,i={});if(t.dynamicTyping=i,t.transform=!!U(t.transform)&&t.transform,!t.worker||!v.WORKERS_SUPPORTED)return i=null,v.NODE_STREAM_INPUT,"string"==typeof e?(e=(e=>65279!==e.charCodeAt(0)?e:e.slice(1))(e),i=new(t.download?f:c)(t)):true===e.readable&&U(e.read)&&U(e.on)?i=new p(t):(n.File&&e instanceof File||e instanceof Object)&&(i=new l(t)),i.stream(e);(i=(()=>{var e;return !!v.WORKERS_SUPPORTED&&(e=(()=>{var e=n.URL||n.webkitURL||null,t=r.toString();return v.BLOB_URL||(v.BLOB_URL=e.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",t,")();"],{type:"text/javascript"})))})(),(e=new n.Worker(e)).onmessage=g,e.id=h++,o[e.id]=e)})()).userStep=t.step,i.userChunk=t.chunk,i.userComplete=t.complete,i.userError=t.error,t.step=U(t.step),t.chunk=U(t.chunk),t.complete=U(t.complete),t.error=U(t.error),delete t.worker,i.postMessage({input:e,config:t,workerId:i.id});},v.unparse=function(e,t){var n=false,_=true,m=",",y="\r\n",s='"',a=s+s,i=false,r=null,o=false,h=((()=>{if("object"==typeof t){if("string"!=typeof t.delimiter||v.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(m=t.delimiter),"boolean"!=typeof t.quotes&&"function"!=typeof t.quotes&&!Array.isArray(t.quotes)||(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(i=t.skipEmptyLines),"string"==typeof t.newline&&(y=t.newline),"string"==typeof t.quoteChar&&(s=t.quoteChar),"boolean"==typeof t.header&&(_=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");r=t.columns;} void 0!==t.escapeChar&&(a=t.escapeChar+s),t.escapeFormulae instanceof RegExp?o=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(o=/^[=+\-@\t\r].*$/);}})(),new RegExp(P(s),"g"));"string"==typeof e&&(e=JSON.parse(e));if(Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return u(null,e,i);if("object"==typeof e[0])return u(r||Object.keys(e[0]),e,i)}else if("object"==typeof e)return "string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||r),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),u(e.fields||[],e.data||[],i);throw new Error("Unable to serialize unrecognized input");function u(e,t,i){var r="",n=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0<e.length),s=!Array.isArray(t[0]);if(n&&_){for(var a=0;a<e.length;a++)0<a&&(r+=m),r+=k(e[a],a);0<t.length&&(r+=y);}for(var o=0;o<t.length;o++){var h=(n?e:t[o]).length,u=false,d=n?0===Object.keys(t[o]).length:0===t[o].length;if(i&&!n&&(u="greedy"===i?""===t[o].join("").trim():1===t[o].length&&0===t[o][0].length),"greedy"===i&&n){for(var f=[],l=0;l<h;l++){var c=s?e[l]:l;f.push(t[o][c]);}u=""===f.join("").trim();}if(!u){for(var p=0;p<h;p++){0<p&&!d&&(r+=m);var g=n&&s?e[p]:p;r+=k(t[o][g],p);}o<t.length-1&&(!i||0<h&&!d)&&(r+=y);}}return r}function k(e,t){var i,r;return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(r=false,o&&"string"==typeof e&&o.test(e)&&(e="'"+e,r=true),i=e.toString().replace(h,a),(r=r||true===n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||((e,t)=>{for(var i=0;i<t.length;i++)if(-1<e.indexOf(t[i]))return true;return false})(i,v.BAD_DELIMITERS)||-1<i.indexOf(m)||" "===i.charAt(0)||" "===i.charAt(i.length-1))?s+i+s:i)}},v.RECORD_SEP=String.fromCharCode(30),v.UNIT_SEP=String.fromCharCode(31),v.BYTE_ORDER_MARK="\ufeff",v.BAD_DELIMITERS=["\r","\n",'"',v.BYTE_ORDER_MARK],v.WORKERS_SUPPORTED=!s&&!!n.Worker,v.NODE_STREAM_INPUT=1,v.LocalChunkSize=10485760,v.RemoteChunkSize=5242880,v.DefaultDelimiter=",",v.Parser=E,v.ParserHandle=i,v.NetworkStreamer=f,v.FileStreamer=l,v.StringStreamer=c,v.ReadableStreamStreamer=p,n.jQuery&&((d=n.jQuery).fn.parse=function(o){var i=o.config||{},h=[];return this.each(function(e){if(!("INPUT"===d(this).prop("tagName").toUpperCase()&&"file"===d(this).attr("type").toLowerCase()&&n.FileReader)||!this.files||0===this.files.length)return true;for(var t=0;t<this.files.length;t++)h.push({file:this.files[t],inputElem:this,instanceConfig:d.extend({},i)});}),e(),this;function e(){if(0===h.length)U(o.complete)&&o.complete();else {var e,t,i,r,n=h[0];if(U(o.before)){var s=o.before(n.file,n.inputElem);if("object"==typeof s){if("abort"===s.action)return e="AbortError",t=n.file,i=n.inputElem,r=s.reason,void(U(o.error)&&o.error({name:e},t,i,r));if("skip"===s.action)return void u();"object"==typeof s.config&&(n.instanceConfig=d.extend(n.instanceConfig,s.config));}else if("skip"===s)return void u()}var a=n.instanceConfig.complete;n.instanceConfig.complete=function(e){U(a)&&a(e,n.file,n.inputElem),u();},v.parse(n.file,n.instanceConfig);}}function u(){h.splice(0,1),e();}}),a&&(n.onmessage=function(e){e=e.data;void 0===v.WORKER_ID&&e&&(v.WORKER_ID=e.workerId);"string"==typeof e.input?n.postMessage({workerId:v.WORKER_ID,results:v.parse(e.input,e.config),finished:true}):(n.File&&e.input instanceof File||e.input instanceof Object)&&(e=v.parse(e.input,e.config))&&n.postMessage({workerId:v.WORKER_ID,results:e,finished:true});}),(f.prototype=Object.create(u.prototype)).constructor=f,(l.prototype=Object.create(u.prototype)).constructor=l,(c.prototype=Object.create(c.prototype)).constructor=c,(p.prototype=Object.create(u.prototype)).constructor=p,v});
|
|
26821
26932
|
} (papaparse_min$1));
|
|
26822
26933
|
return papaparse_min$1.exports;
|
|
26823
26934
|
}
|
|
@@ -29462,42 +29573,42 @@ class TextRange {
|
|
|
29462
29573
|
}
|
|
29463
29574
|
}
|
|
29464
29575
|
|
|
29465
|
-
const createTextChunks = (context,
|
|
29576
|
+
const createTextChunks = (context, definition) => {
|
|
29466
29577
|
return createMemo(() => {
|
|
29467
29578
|
const chunks = [];
|
|
29468
29579
|
const mediaSources = {};
|
|
29580
|
+
let chunkExpressions;
|
|
29581
|
+
if (definition.chunks[0]?.source === "translation") {
|
|
29582
|
+
const itextId = context.evaluator.evaluateString(definition.chunks[0].toString(), {
|
|
29583
|
+
contextNode: context.contextNode
|
|
29584
|
+
});
|
|
29585
|
+
chunkExpressions = definition.form.model.getTranslationChunks(
|
|
29586
|
+
itextId,
|
|
29587
|
+
context.getActiveLanguage()
|
|
29588
|
+
);
|
|
29589
|
+
} else {
|
|
29590
|
+
chunkExpressions = definition.chunks;
|
|
29591
|
+
}
|
|
29469
29592
|
chunkExpressions.forEach((chunkExpression) => {
|
|
29593
|
+
if (chunkExpression.resourceType) {
|
|
29594
|
+
mediaSources[chunkExpression.resourceType] = JRResourceURL.from(
|
|
29595
|
+
chunkExpression.stringValue
|
|
29596
|
+
);
|
|
29597
|
+
return;
|
|
29598
|
+
}
|
|
29470
29599
|
if (chunkExpression.source === "literal") {
|
|
29471
29600
|
chunks.push(new TextChunk(context, chunkExpression.source, chunkExpression.stringValue));
|
|
29472
29601
|
return;
|
|
29473
29602
|
}
|
|
29474
29603
|
const computed = createComputedExpression(context, chunkExpression)();
|
|
29475
|
-
|
|
29476
|
-
chunks.push(new TextChunk(context, chunkExpression.source, computed));
|
|
29477
|
-
return;
|
|
29478
|
-
} else {
|
|
29479
|
-
computed.forEach((itextForm) => {
|
|
29480
|
-
if (isEngineXPathElement(itextForm) && itextForm instanceof StaticElement) {
|
|
29481
|
-
const formAttribute = itextForm.getAttributeValue("form");
|
|
29482
|
-
if (!formAttribute) {
|
|
29483
|
-
const defaultFormValue = itextForm.getXPathValue();
|
|
29484
|
-
chunks.push(new TextChunk(context, chunkExpression.source, defaultFormValue));
|
|
29485
|
-
} else if (["image", "video", "audio"].includes(formAttribute)) {
|
|
29486
|
-
const formValue = itextForm.getXPathValue();
|
|
29487
|
-
if (JRResourceURL.isJRResourceReference(formValue)) {
|
|
29488
|
-
mediaSources[formAttribute] = JRResourceURL.from(formValue);
|
|
29489
|
-
}
|
|
29490
|
-
}
|
|
29491
|
-
}
|
|
29492
|
-
});
|
|
29493
|
-
}
|
|
29604
|
+
chunks.push(new TextChunk(context, chunkExpression.source, computed));
|
|
29494
29605
|
});
|
|
29495
29606
|
return { chunks, mediaSources };
|
|
29496
29607
|
});
|
|
29497
29608
|
};
|
|
29498
29609
|
const createTextRange = (context, role, definition) => {
|
|
29499
29610
|
return context.scope.runTask(() => {
|
|
29500
|
-
const textChunks = createTextChunks(context, definition
|
|
29611
|
+
const textChunks = createTextChunks(context, definition);
|
|
29501
29612
|
return createMemo(() => {
|
|
29502
29613
|
const chunks = textChunks();
|
|
29503
29614
|
return new TextRange("form", role, chunks.chunks, chunks.mediaSources);
|
|
@@ -30376,6 +30487,10 @@ class RankControl extends ValueNode {
|
|
|
30376
30487
|
this.setValueState(valuesInOrder);
|
|
30377
30488
|
return this.root;
|
|
30378
30489
|
}
|
|
30490
|
+
getChoiceName(value) {
|
|
30491
|
+
const option = this.mapOptionsByValue().get(value);
|
|
30492
|
+
return option?.label?.asString ?? null;
|
|
30493
|
+
}
|
|
30379
30494
|
}
|
|
30380
30495
|
|
|
30381
30496
|
const insertAtIndex = (currentValues, insertionIndex, newValues) => {
|
|
@@ -30940,6 +31055,10 @@ class SelectControl extends ValueNode {
|
|
|
30940
31055
|
this.setValueState(effectiveValues);
|
|
30941
31056
|
return this.root;
|
|
30942
31057
|
}
|
|
31058
|
+
getChoiceName(value) {
|
|
31059
|
+
const option = this.mapOptionsByValue().get(value);
|
|
31060
|
+
return option?.label?.asString ?? null;
|
|
31061
|
+
}
|
|
30943
31062
|
}
|
|
30944
31063
|
|
|
30945
31064
|
class Subtree extends DescendantNode {
|