@truto/truto-jsonata 1.0.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 +7 -0
- package/dist/main.cjs +1411 -0
- package/dist/main.cjs.map +1 -0
- package/dist/module.js +1402 -0
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +72 -0
package/dist/main.cjs
ADDED
|
@@ -0,0 +1,1411 @@
|
|
|
1
|
+
var $dxT2C$jsonata = require("jsonata");
|
|
2
|
+
var $dxT2C$lodashes = require("lodash-es");
|
|
3
|
+
var $dxT2C$luxon = require("luxon");
|
|
4
|
+
var $dxT2C$marked = require("marked");
|
|
5
|
+
var $dxT2C$dicecoefficient = require("dice-coefficient");
|
|
6
|
+
var $dxT2C$mixmarkiodomino = require("@mixmark-io/domino");
|
|
7
|
+
var $dxT2C$turndown = require("turndown");
|
|
8
|
+
var $dxT2C$turndownplugingfm = require("turndown-plugin-gfm");
|
|
9
|
+
var $dxT2C$crypto = require("crypto");
|
|
10
|
+
var $dxT2C$xmljs = require("xml-js");
|
|
11
|
+
var $dxT2C$json2md = require("json2md");
|
|
12
|
+
var $dxT2C$mime = require("mime");
|
|
13
|
+
var $dxT2C$honoutilsencode = require("hono/utils/encode");
|
|
14
|
+
|
|
15
|
+
function $parcel$interopDefault(a) {
|
|
16
|
+
return a && a.__esModule ? a.default : a;
|
|
17
|
+
}
|
|
18
|
+
function $parcel$defineInteropFlag(a) {
|
|
19
|
+
Object.defineProperty(a, '__esModule', {value: true, configurable: true});
|
|
20
|
+
}
|
|
21
|
+
function $parcel$export(e, n, v, s) {
|
|
22
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
$parcel$defineInteropFlag(module.exports);
|
|
26
|
+
|
|
27
|
+
$parcel$export(module.exports, "default", () => $20dd7fc7127fd575$export$2e2bcd8739ae039);
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const $cc0827b1147b8d10$var$isString = (value)=>typeof value === "string" || value instanceof String;
|
|
31
|
+
const $cc0827b1147b8d10$var$isNumber = (value)=>typeof value === "number";
|
|
32
|
+
const $cc0827b1147b8d10$var$isArray = (value)=>Array.isArray(value);
|
|
33
|
+
const $cc0827b1147b8d10$var$isPlainObject = (value)=>{
|
|
34
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
35
|
+
};
|
|
36
|
+
function $cc0827b1147b8d10$var$mapValues(originalValue, mapping, lowerCase = false, defaultValue = null) {
|
|
37
|
+
if ((originalValue === null || originalValue === undefined) && defaultValue !== null) return defaultValue;
|
|
38
|
+
if (mapping === null || mapping === undefined) return originalValue;
|
|
39
|
+
let newMapping = {};
|
|
40
|
+
if (!lowerCase) Object.entries(mapping).forEach(([key, value])=>{
|
|
41
|
+
newMapping[key.toLowerCase()] = value;
|
|
42
|
+
});
|
|
43
|
+
else newMapping = {
|
|
44
|
+
...mapping
|
|
45
|
+
};
|
|
46
|
+
if ($cc0827b1147b8d10$var$isString(originalValue) || $cc0827b1147b8d10$var$isNumber(originalValue)) {
|
|
47
|
+
const val = newMapping[originalValue.toString().toLowerCase()];
|
|
48
|
+
if (val === null || val === undefined) return originalValue;
|
|
49
|
+
if (val === false) return val;
|
|
50
|
+
return val;
|
|
51
|
+
}
|
|
52
|
+
if ($cc0827b1147b8d10$var$isArray(originalValue)) return originalValue.map((value)=>$cc0827b1147b8d10$var$mapValues(value, newMapping, true));
|
|
53
|
+
if ($cc0827b1147b8d10$var$isPlainObject(originalValue)) {
|
|
54
|
+
const result = {};
|
|
55
|
+
Object.entries(originalValue).forEach(([key, value])=>{
|
|
56
|
+
result[key] = $cc0827b1147b8d10$var$mapValues(value, newMapping, true);
|
|
57
|
+
});
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
return originalValue;
|
|
61
|
+
}
|
|
62
|
+
var $cc0827b1147b8d10$export$2e2bcd8739ae039 = $cc0827b1147b8d10$var$mapValues;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
const $f3c3a16d1adbba55$var$operatorMapping = {
|
|
66
|
+
eq: "=",
|
|
67
|
+
ne: "<>",
|
|
68
|
+
gt: ">",
|
|
69
|
+
gte: ">=",
|
|
70
|
+
lt: "<",
|
|
71
|
+
lte: "<=",
|
|
72
|
+
in: "in",
|
|
73
|
+
nin: "not in",
|
|
74
|
+
like: "like"
|
|
75
|
+
};
|
|
76
|
+
const $f3c3a16d1adbba55$var$convertToDataType = (value, key, dataType, useDoubleQuotes = false, noQuotes = false, noQuotesForDate = false, escapeSingleQuotes = false)=>{
|
|
77
|
+
const dataTypeKey = dataType[key];
|
|
78
|
+
if (value === undefined || value === null) return value;
|
|
79
|
+
if (dataTypeKey === "string") {
|
|
80
|
+
if (noQuotes) return value;
|
|
81
|
+
else if (useDoubleQuotes) return `"${value}"`;
|
|
82
|
+
else if (escapeSingleQuotes) return `'${value.replace(/'/g, "\\'")}'`;
|
|
83
|
+
else return `'${value}'`;
|
|
84
|
+
}
|
|
85
|
+
if (dataTypeKey === "dotnetdate") return `DateTime(${(0, $dxT2C$luxon.DateTime).fromISO(value).toFormat("yyyy,MM,dd")})`;
|
|
86
|
+
if (typeof dataTypeKey === "object") {
|
|
87
|
+
const val = (0, $cc0827b1147b8d10$export$2e2bcd8739ae039)(value, dataType[key]);
|
|
88
|
+
if (typeof val === "string" || val instanceof String) return noQuotes ? val : useDoubleQuotes ? `"${val}"` : `'${val}'`;
|
|
89
|
+
return val;
|
|
90
|
+
}
|
|
91
|
+
if (dataTypeKey && dataTypeKey.startsWith("date")) {
|
|
92
|
+
const format = dataTypeKey.split("|")[1];
|
|
93
|
+
const date = format ? (0, $dxT2C$luxon.DateTime).fromISO(value).toFormat(format) : (0, $dxT2C$luxon.DateTime).fromISO(value).toISO();
|
|
94
|
+
return noQuotes || noQuotesForDate ? date : useDoubleQuotes ? `"${date}"` : `'${date}'`;
|
|
95
|
+
}
|
|
96
|
+
return value;
|
|
97
|
+
};
|
|
98
|
+
function $f3c3a16d1adbba55$var$getSqlString({ key: key , operator: operator , value: value , useSpace: useSpace = false }) {
|
|
99
|
+
const space = useSpace ? " " : "";
|
|
100
|
+
return `${key}${space}${operator}${space}${value}`;
|
|
101
|
+
}
|
|
102
|
+
function $f3c3a16d1adbba55$var$convertQueryToSql(query, keysToMap = [], mapping = {}, dataTypes = {}, customOperatorMapping = {}, options = {}) {
|
|
103
|
+
const conjunction = options.conjunction || "AND";
|
|
104
|
+
const statement = [];
|
|
105
|
+
const keys = !keysToMap.length ? Object.keys(query) : keysToMap;
|
|
106
|
+
for (const key of keys){
|
|
107
|
+
if (key === "or") {
|
|
108
|
+
const orPart = $f3c3a16d1adbba55$var$convertQueryToSql(query[key], keys, mapping, dataTypes, customOperatorMapping, options);
|
|
109
|
+
statement.push("(" + orPart + ")");
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const comparison = query[key];
|
|
113
|
+
let operators = [
|
|
114
|
+
"eq"
|
|
115
|
+
];
|
|
116
|
+
if (Array.isArray(comparison)) operators = [
|
|
117
|
+
"in"
|
|
118
|
+
];
|
|
119
|
+
else if (typeof comparison === "object") operators = Object.keys(comparison);
|
|
120
|
+
const sqlKey = mapping[key] || key;
|
|
121
|
+
for (const operator of operators){
|
|
122
|
+
const comparator = customOperatorMapping[operator] || $f3c3a16d1adbba55$var$operatorMapping[operator];
|
|
123
|
+
if (operator !== "in" && operator !== "nin" && comparator) {
|
|
124
|
+
const value = typeof comparison === "object" ? comparison[operator] : comparison;
|
|
125
|
+
const valueToInsert = $f3c3a16d1adbba55$var$convertToDataType(value, key, dataTypes, options.useDoubleQuotes, options.noQuotes, options.noQuotesForDate, options.escapeSingleQuotes);
|
|
126
|
+
if (valueToInsert !== undefined && valueToInsert !== null) statement.push($f3c3a16d1adbba55$var$getSqlString({
|
|
127
|
+
key: sqlKey,
|
|
128
|
+
operator: comparator,
|
|
129
|
+
value: valueToInsert,
|
|
130
|
+
useSpace: !options.noSpaceBetweenOperator
|
|
131
|
+
}));
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (operator === "in" || operator === "nin") {
|
|
135
|
+
const value = Array.isArray(comparison) ? comparison : comparison[operator];
|
|
136
|
+
if (options.useOrForIn) {
|
|
137
|
+
const orStatement = [];
|
|
138
|
+
const eqOperator = customOperatorMapping["eq"] || $f3c3a16d1adbba55$var$operatorMapping["eq"];
|
|
139
|
+
for (const v of value){
|
|
140
|
+
const valueToInsert = $f3c3a16d1adbba55$var$convertToDataType(v, key, dataTypes, options.useDoubleQuotes, options.noQuotes, options.noQuotesForDate, options.escapeSingleQuotes);
|
|
141
|
+
if (valueToInsert !== undefined && valueToInsert !== null) orStatement.push($f3c3a16d1adbba55$var$getSqlString({
|
|
142
|
+
key: sqlKey,
|
|
143
|
+
operator: eqOperator,
|
|
144
|
+
value: valueToInsert,
|
|
145
|
+
useSpace: !options.noSpaceBetweenOperator
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
statement.push("(" + orStatement.join(" OR ") + ")");
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
statement.push($f3c3a16d1adbba55$var$getSqlString({
|
|
152
|
+
key: sqlKey,
|
|
153
|
+
operator: comparator,
|
|
154
|
+
value: `(${value.map((v)=>{
|
|
155
|
+
return $f3c3a16d1adbba55$var$convertToDataType(v, key, dataTypes, options.useDoubleQuotes, options.noQuotes, options.noQuotesForDate, options.escapeSingleQuotes);
|
|
156
|
+
}).join(",")})`,
|
|
157
|
+
useSpace: !options.noSpaceBetweenOperator
|
|
158
|
+
}));
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
throw new Error(`Unknown operator: ${operator}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (options.groupComparisonInBrackets && statement.length) return statement.reduce((acc, condition)=>`(${acc} ${conjunction} ${condition})`);
|
|
165
|
+
return statement.join(` ${conjunction} `);
|
|
166
|
+
}
|
|
167
|
+
var $f3c3a16d1adbba55$export$2e2bcd8739ae039 = $f3c3a16d1adbba55$var$convertQueryToSql;
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
const $233848446ca33fe6$var$insertBetween = (arr, value)=>{
|
|
175
|
+
return (0, $dxT2C$lodashes.flatMap)(arr, (item, index)=>{
|
|
176
|
+
return index === arr.length - 1 ? [
|
|
177
|
+
item
|
|
178
|
+
] : [
|
|
179
|
+
item,
|
|
180
|
+
...(0, $dxT2C$lodashes.castArray)(value)
|
|
181
|
+
];
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
var $233848446ca33fe6$export$2e2bcd8739ae039 = $233848446ca33fe6$var$insertBetween;
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
function $5a7cb266718aeaae$var$decodeHtmlEntities(encodedString) {
|
|
188
|
+
const htmlEntities = {
|
|
189
|
+
"&": "&",
|
|
190
|
+
"<": "<",
|
|
191
|
+
">": ">",
|
|
192
|
+
""": '"',
|
|
193
|
+
"'": "'",
|
|
194
|
+
"/": "/",
|
|
195
|
+
"\": "\\",
|
|
196
|
+
"`": "`",
|
|
197
|
+
"=": "="
|
|
198
|
+
};
|
|
199
|
+
return encodedString.replace(/&|<|>|"|'|/|\|`|=/g, (match)=>htmlEntities[match]);
|
|
200
|
+
}
|
|
201
|
+
var $5a7cb266718aeaae$export$2e2bcd8739ae039 = $5a7cb266718aeaae$var$decodeHtmlEntities;
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
const $90c566adb85cb52e$var$parseMarkedTokenToGoogleDocsRequest = (tokens, acc = {
|
|
205
|
+
counter: 1,
|
|
206
|
+
offset: 0,
|
|
207
|
+
inserts: [],
|
|
208
|
+
formats: []
|
|
209
|
+
}, context = {
|
|
210
|
+
level: 0
|
|
211
|
+
})=>{
|
|
212
|
+
return (0, $dxT2C$lodashes.reduce)(tokens, (acc, token)=>{
|
|
213
|
+
if (token.type === "hr") {
|
|
214
|
+
acc.inserts.push({
|
|
215
|
+
insertText: {
|
|
216
|
+
text: "\n\n",
|
|
217
|
+
location: {
|
|
218
|
+
index: acc.counter
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
acc.counter += 2;
|
|
223
|
+
return acc;
|
|
224
|
+
}
|
|
225
|
+
if (token.type === "space") {
|
|
226
|
+
const textToAdd = token.raw || "\n";
|
|
227
|
+
acc.inserts.push({
|
|
228
|
+
insertText: {
|
|
229
|
+
text: textToAdd,
|
|
230
|
+
location: {
|
|
231
|
+
index: acc.counter
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
acc.counter += textToAdd.length;
|
|
236
|
+
return acc;
|
|
237
|
+
}
|
|
238
|
+
if (token.type === "image") {
|
|
239
|
+
acc.inserts.push({
|
|
240
|
+
insertInlineImage: {
|
|
241
|
+
uri: token.href,
|
|
242
|
+
location: {
|
|
243
|
+
index: acc.counter
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
acc.counter += 1;
|
|
248
|
+
return acc;
|
|
249
|
+
}
|
|
250
|
+
if (token.type === "table") {
|
|
251
|
+
acc.inserts.push({
|
|
252
|
+
insertTable: {
|
|
253
|
+
columns: token.header.length,
|
|
254
|
+
rows: token.rows.length + 1,
|
|
255
|
+
location: {
|
|
256
|
+
index: acc.counter
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
acc.counter += 4;
|
|
261
|
+
(0, $dxT2C$lodashes.each)([
|
|
262
|
+
token.header,
|
|
263
|
+
...token.rows
|
|
264
|
+
], (rowItems, index, arr)=>{
|
|
265
|
+
(0, $dxT2C$lodashes.each)(rowItems, (item)=>{
|
|
266
|
+
$90c566adb85cb52e$var$parseMarkedTokenToGoogleDocsRequest([
|
|
267
|
+
item
|
|
268
|
+
], acc, context);
|
|
269
|
+
acc.counter += 2;
|
|
270
|
+
});
|
|
271
|
+
if (index === arr.length - 1) return;
|
|
272
|
+
acc.counter += 1;
|
|
273
|
+
});
|
|
274
|
+
acc.inserts.push({
|
|
275
|
+
insertText: {
|
|
276
|
+
text: "\n",
|
|
277
|
+
location: {
|
|
278
|
+
index: acc.counter
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
acc.counter += 1;
|
|
283
|
+
return acc;
|
|
284
|
+
}
|
|
285
|
+
const childTokens = (0, $dxT2C$lodashes.get)(token, "tokens");
|
|
286
|
+
if (!(0, $dxT2C$lodashes.isEmpty)(childTokens)) {
|
|
287
|
+
const start = acc.counter;
|
|
288
|
+
if (token.type === "list_item") {
|
|
289
|
+
if (context.level > 1) {
|
|
290
|
+
acc.inserts.push({
|
|
291
|
+
insertText: {
|
|
292
|
+
text: " ".repeat(context.level - 1),
|
|
293
|
+
location: {
|
|
294
|
+
index: acc.counter
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
acc.offset += context.level - 1;
|
|
299
|
+
acc.counter += context.level - 1;
|
|
300
|
+
}
|
|
301
|
+
$90c566adb85cb52e$var$parseMarkedTokenToGoogleDocsRequest((0, $233848446ca33fe6$export$2e2bcd8739ae039)(childTokens, [
|
|
302
|
+
{
|
|
303
|
+
type: "space",
|
|
304
|
+
raw: "\n"
|
|
305
|
+
}
|
|
306
|
+
]), acc, context);
|
|
307
|
+
} else $90c566adb85cb52e$var$parseMarkedTokenToGoogleDocsRequest(childTokens, acc, context);
|
|
308
|
+
const end = acc.counter;
|
|
309
|
+
if (token.type === "heading") {
|
|
310
|
+
acc.formats.push({
|
|
311
|
+
updateParagraphStyle: {
|
|
312
|
+
paragraphStyle: {
|
|
313
|
+
namedStyleType: `HEADING_${token.depth}`
|
|
314
|
+
},
|
|
315
|
+
fields: "*",
|
|
316
|
+
range: {
|
|
317
|
+
startIndex: start - acc.offset,
|
|
318
|
+
endIndex: end - acc.offset
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
acc.inserts.push({
|
|
323
|
+
insertText: {
|
|
324
|
+
text: "\n",
|
|
325
|
+
location: {
|
|
326
|
+
index: acc.counter
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
acc.counter += 1;
|
|
331
|
+
}
|
|
332
|
+
if (token.type === "em") acc.formats.push({
|
|
333
|
+
updateTextStyle: {
|
|
334
|
+
textStyle: {
|
|
335
|
+
italic: true
|
|
336
|
+
},
|
|
337
|
+
fields: "*",
|
|
338
|
+
range: {
|
|
339
|
+
startIndex: start - acc.offset,
|
|
340
|
+
endIndex: end - acc.offset
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
if (token.type === "strong") acc.formats.push({
|
|
345
|
+
updateTextStyle: {
|
|
346
|
+
textStyle: {
|
|
347
|
+
bold: true
|
|
348
|
+
},
|
|
349
|
+
fields: "*",
|
|
350
|
+
range: {
|
|
351
|
+
startIndex: start - acc.offset,
|
|
352
|
+
endIndex: end - acc.offset
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
if (token.type === "link") acc.formats.push({
|
|
357
|
+
updateTextStyle: {
|
|
358
|
+
textStyle: {
|
|
359
|
+
link: {
|
|
360
|
+
url: token.href
|
|
361
|
+
},
|
|
362
|
+
underline: true,
|
|
363
|
+
foregroundColor: {
|
|
364
|
+
color: {
|
|
365
|
+
rgbColor: {
|
|
366
|
+
red: 0.1,
|
|
367
|
+
green: 0.33,
|
|
368
|
+
blue: 0.8
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
fields: "*",
|
|
374
|
+
range: {
|
|
375
|
+
startIndex: start - acc.offset,
|
|
376
|
+
endIndex: end - acc.offset
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
return acc;
|
|
381
|
+
}
|
|
382
|
+
const childItems = (0, $dxT2C$lodashes.get)(token, "items");
|
|
383
|
+
if (!(0, $dxT2C$lodashes.isEmpty)(childItems)) {
|
|
384
|
+
const start = acc.counter;
|
|
385
|
+
$90c566adb85cb52e$var$parseMarkedTokenToGoogleDocsRequest((0, $233848446ca33fe6$export$2e2bcd8739ae039)(childItems, [
|
|
386
|
+
{
|
|
387
|
+
type: "space",
|
|
388
|
+
raw: "\n"
|
|
389
|
+
}
|
|
390
|
+
]), acc, {
|
|
391
|
+
level: context.level + 1
|
|
392
|
+
});
|
|
393
|
+
const end = acc.counter;
|
|
394
|
+
if (!context.level && token.type === "list") acc.formats = (0, $dxT2C$lodashes.concat)({
|
|
395
|
+
createParagraphBullets: {
|
|
396
|
+
range: {
|
|
397
|
+
startIndex: start,
|
|
398
|
+
endIndex: end
|
|
399
|
+
},
|
|
400
|
+
bulletPreset: token.ordered ? "NUMBERED_DECIMAL_ALPHA_ROMAN" : "BULLET_DISC_CIRCLE_SQUARE"
|
|
401
|
+
}
|
|
402
|
+
}, acc.formats);
|
|
403
|
+
return acc;
|
|
404
|
+
}
|
|
405
|
+
const text = (0, $dxT2C$lodashes.get)(token, "text");
|
|
406
|
+
if (!text) return acc;
|
|
407
|
+
const textToInsert = (0, $5a7cb266718aeaae$export$2e2bcd8739ae039)(text);
|
|
408
|
+
acc.inserts.push({
|
|
409
|
+
insertText: {
|
|
410
|
+
text: textToInsert,
|
|
411
|
+
location: {
|
|
412
|
+
index: acc.counter
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
acc.counter += textToInsert.length;
|
|
417
|
+
return acc;
|
|
418
|
+
}, acc);
|
|
419
|
+
};
|
|
420
|
+
const $90c566adb85cb52e$var$convertMarkdownToGoogleDocs = (text, currentCounter = 1)=>{
|
|
421
|
+
const tokens = (0, $dxT2C$marked.Lexer).lex(text);
|
|
422
|
+
const parsedTokens = $90c566adb85cb52e$var$parseMarkedTokenToGoogleDocsRequest(tokens, {
|
|
423
|
+
counter: currentCounter,
|
|
424
|
+
formats: [],
|
|
425
|
+
inserts: [],
|
|
426
|
+
offset: 0
|
|
427
|
+
});
|
|
428
|
+
const formats = parsedTokens.formats;
|
|
429
|
+
const mergedFormats = (0, $dxT2C$lodashes.reduce)(formats, (acc, format)=>{
|
|
430
|
+
const range = (0, $dxT2C$lodashes.get)(format, "updateTextStyle.range");
|
|
431
|
+
if (!range) acc.push(format);
|
|
432
|
+
else {
|
|
433
|
+
const existingFormat = (0, $dxT2C$lodashes.find)(acc, (f)=>{
|
|
434
|
+
const r = (0, $dxT2C$lodashes.get)(f, "updateTextStyle.range");
|
|
435
|
+
return (0, $dxT2C$lodashes.isEqual)(r, range);
|
|
436
|
+
});
|
|
437
|
+
if (existingFormat) existingFormat.updateTextStyle.textStyle = {
|
|
438
|
+
...existingFormat.updateTextStyle.textStyle,
|
|
439
|
+
...format.updateTextStyle.textStyle
|
|
440
|
+
};
|
|
441
|
+
else acc.push(format);
|
|
442
|
+
}
|
|
443
|
+
return acc;
|
|
444
|
+
}, []);
|
|
445
|
+
return {
|
|
446
|
+
requests: [
|
|
447
|
+
...parsedTokens.inserts,
|
|
448
|
+
...mergedFormats
|
|
449
|
+
]
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
var $90c566adb85cb52e$export$2e2bcd8739ae039 = $90c566adb85cb52e$var$convertMarkdownToGoogleDocs;
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
const $bc8e7b2fdb012b3a$var$parseMarkedTokenToNotionRequest = (tokens, acc = [])=>{
|
|
459
|
+
return (0, $dxT2C$lodashes.reduce)(tokens, (acc, token)=>{
|
|
460
|
+
const childTokens = token.type === "blockquote" ? (0, $dxT2C$lodashes.get)(token, "tokens[0].tokens") : (0, $dxT2C$lodashes.get)(token, "tokens");
|
|
461
|
+
let childData = [];
|
|
462
|
+
if (childTokens) childData = $bc8e7b2fdb012b3a$var$parseMarkedTokenToNotionRequest(childTokens);
|
|
463
|
+
if (token.type === "hr") {
|
|
464
|
+
acc.push({
|
|
465
|
+
type: "divider",
|
|
466
|
+
divider: {}
|
|
467
|
+
});
|
|
468
|
+
return acc;
|
|
469
|
+
}
|
|
470
|
+
if (token.type === "space") {
|
|
471
|
+
acc.push({
|
|
472
|
+
type: "paragraph",
|
|
473
|
+
paragraph: {
|
|
474
|
+
rich_text: [
|
|
475
|
+
{
|
|
476
|
+
type: "text",
|
|
477
|
+
text: {
|
|
478
|
+
content: "\n"
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
return acc;
|
|
485
|
+
}
|
|
486
|
+
if (token.type === "image") {
|
|
487
|
+
acc.push({
|
|
488
|
+
type: "image",
|
|
489
|
+
image: {
|
|
490
|
+
type: "external",
|
|
491
|
+
external: {
|
|
492
|
+
url: token.href
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
return acc;
|
|
497
|
+
}
|
|
498
|
+
if (token.type === "paragraph") {
|
|
499
|
+
const groupedChildData = (0, $dxT2C$lodashes.groupBy)(childData, (x)=>x.type === "image" ? "image" : "other");
|
|
500
|
+
if (!(0, $dxT2C$lodashes.isEmpty)(groupedChildData.other)) acc.push({
|
|
501
|
+
type: "paragraph",
|
|
502
|
+
paragraph: {
|
|
503
|
+
rich_text: groupedChildData.other
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
if (!(0, $dxT2C$lodashes.isEmpty)(groupedChildData.image)) acc = (0, $dxT2C$lodashes.concat)(acc, groupedChildData.image);
|
|
507
|
+
return acc;
|
|
508
|
+
}
|
|
509
|
+
if (token.type === "heading") {
|
|
510
|
+
acc.push({
|
|
511
|
+
type: `heading_${token.depth}`,
|
|
512
|
+
[`heading_${token.depth}`]: {
|
|
513
|
+
rich_text: childData
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
return acc;
|
|
517
|
+
}
|
|
518
|
+
if (token.type === "code") {
|
|
519
|
+
acc.push({
|
|
520
|
+
type: "code",
|
|
521
|
+
code: {
|
|
522
|
+
rich_text: [
|
|
523
|
+
{
|
|
524
|
+
type: "text",
|
|
525
|
+
text: {
|
|
526
|
+
content: token.text
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
],
|
|
530
|
+
language: token.lang || "plain text"
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
return acc;
|
|
534
|
+
}
|
|
535
|
+
if (token.type === "table") {
|
|
536
|
+
const table = {
|
|
537
|
+
type: "table",
|
|
538
|
+
table: {
|
|
539
|
+
table_width: token.header.length,
|
|
540
|
+
has_column_header: true,
|
|
541
|
+
has_row_header: false,
|
|
542
|
+
children: []
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
const headerChildren = $bc8e7b2fdb012b3a$var$parseMarkedTokenToNotionRequest(token.header);
|
|
546
|
+
table.table.children.push({
|
|
547
|
+
type: "table_row",
|
|
548
|
+
table_row: {
|
|
549
|
+
cells: headerChildren.map((x)=>[
|
|
550
|
+
x
|
|
551
|
+
])
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
(0, $dxT2C$lodashes.each)(token.rows, (row)=>{
|
|
555
|
+
const rowChildren = (0, $dxT2C$lodashes.map)(row, (rowCell)=>$bc8e7b2fdb012b3a$var$parseMarkedTokenToNotionRequest([
|
|
556
|
+
rowCell
|
|
557
|
+
]));
|
|
558
|
+
table.table.children.push({
|
|
559
|
+
type: "table_row",
|
|
560
|
+
table_row: {
|
|
561
|
+
cells: rowChildren.map((x)=>x)
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
acc.push(table);
|
|
566
|
+
return acc;
|
|
567
|
+
}
|
|
568
|
+
if (token.type === "list") {
|
|
569
|
+
const listType = token.items[0].task ? "to_do" : token.ordered ? "numbered_list_item" : "bulleted_list_item";
|
|
570
|
+
(0, $dxT2C$lodashes.each)(token.items, (item)=>{
|
|
571
|
+
const itemChildren = $bc8e7b2fdb012b3a$var$parseMarkedTokenToNotionRequest(item.tokens);
|
|
572
|
+
const groupedItemChildren = (0, $dxT2C$lodashes.groupBy)(itemChildren, (x)=>x.type === "text" ? "other" : "list");
|
|
573
|
+
acc.push({
|
|
574
|
+
type: listType,
|
|
575
|
+
[listType]: {
|
|
576
|
+
rich_text: groupedItemChildren.other,
|
|
577
|
+
children: groupedItemChildren.list,
|
|
578
|
+
...listType === "to_do" ? {
|
|
579
|
+
checked: item.checked
|
|
580
|
+
} : {}
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
if (token.type === "em") {
|
|
586
|
+
(0, $dxT2C$lodashes.each)(childData, (child)=>{
|
|
587
|
+
(0, $dxT2C$lodashes.set)(child, [
|
|
588
|
+
"annotations",
|
|
589
|
+
"italic"
|
|
590
|
+
], true);
|
|
591
|
+
});
|
|
592
|
+
acc = (0, $dxT2C$lodashes.concat)(acc, childData);
|
|
593
|
+
return acc;
|
|
594
|
+
}
|
|
595
|
+
if (token.type === "strong") {
|
|
596
|
+
(0, $dxT2C$lodashes.each)(childData, (child)=>{
|
|
597
|
+
(0, $dxT2C$lodashes.set)(child, [
|
|
598
|
+
"annotations",
|
|
599
|
+
"bold"
|
|
600
|
+
], true);
|
|
601
|
+
});
|
|
602
|
+
acc = (0, $dxT2C$lodashes.concat)(acc, childData);
|
|
603
|
+
return acc;
|
|
604
|
+
}
|
|
605
|
+
if (token.type === "link") {
|
|
606
|
+
(0, $dxT2C$lodashes.each)(childData, (child)=>{
|
|
607
|
+
if (child.text) (0, $dxT2C$lodashes.set)(child, [
|
|
608
|
+
"text",
|
|
609
|
+
"link",
|
|
610
|
+
"url"
|
|
611
|
+
], token.href);
|
|
612
|
+
});
|
|
613
|
+
acc = (0, $dxT2C$lodashes.concat)(acc, childData);
|
|
614
|
+
return acc;
|
|
615
|
+
}
|
|
616
|
+
if (token.type === "blockquote") {
|
|
617
|
+
acc.push({
|
|
618
|
+
type: "callout",
|
|
619
|
+
callout: {
|
|
620
|
+
rich_text: childData
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
return acc;
|
|
624
|
+
}
|
|
625
|
+
if (!(0, $dxT2C$lodashes.isEmpty)(childData)) {
|
|
626
|
+
acc = (0, $dxT2C$lodashes.concat)(acc, childData);
|
|
627
|
+
return acc;
|
|
628
|
+
}
|
|
629
|
+
const text = (0, $dxT2C$lodashes.get)(token, "text");
|
|
630
|
+
if (!text) return acc;
|
|
631
|
+
const textToInsert = (0, $5a7cb266718aeaae$export$2e2bcd8739ae039)(text);
|
|
632
|
+
acc.push({
|
|
633
|
+
type: "text",
|
|
634
|
+
text: {
|
|
635
|
+
content: textToInsert
|
|
636
|
+
},
|
|
637
|
+
...token.type === "codespan" ? {
|
|
638
|
+
annotations: {
|
|
639
|
+
code: true
|
|
640
|
+
}
|
|
641
|
+
} : {}
|
|
642
|
+
});
|
|
643
|
+
return acc;
|
|
644
|
+
}, acc);
|
|
645
|
+
};
|
|
646
|
+
const $bc8e7b2fdb012b3a$var$convertMarkdownToNotion = (text)=>{
|
|
647
|
+
const tokens = (0, $dxT2C$marked.Lexer).lex(text);
|
|
648
|
+
const parsedTokens = $bc8e7b2fdb012b3a$var$parseMarkedTokenToNotionRequest(tokens);
|
|
649
|
+
return {
|
|
650
|
+
children: parsedTokens
|
|
651
|
+
};
|
|
652
|
+
};
|
|
653
|
+
var $bc8e7b2fdb012b3a$export$2e2bcd8739ae039 = $bc8e7b2fdb012b3a$var$convertMarkdownToNotion;
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
const $15b9b26a1f4728d9$var$parseMarkedTokenToSlackRequest = (tokens, acc = [])=>{
|
|
659
|
+
return (0, $dxT2C$lodashes.reduce)(tokens, (acc, token)=>{
|
|
660
|
+
if (token.type === "hr") {
|
|
661
|
+
acc.push({
|
|
662
|
+
type: "divider"
|
|
663
|
+
});
|
|
664
|
+
return acc;
|
|
665
|
+
}
|
|
666
|
+
if (token.type === "space") {
|
|
667
|
+
acc.push({
|
|
668
|
+
type: "section",
|
|
669
|
+
text: {
|
|
670
|
+
type: "mrkdwn",
|
|
671
|
+
text: "\n"
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
return acc;
|
|
675
|
+
}
|
|
676
|
+
if (token.type === "image") {
|
|
677
|
+
acc.push({
|
|
678
|
+
type: "image",
|
|
679
|
+
image_url: token.href,
|
|
680
|
+
alt_text: token.text
|
|
681
|
+
});
|
|
682
|
+
return acc;
|
|
683
|
+
}
|
|
684
|
+
if (token.type === "paragraph" || token.type === "text") {
|
|
685
|
+
const childTokens = (0, $dxT2C$lodashes.get)(token, "tokens");
|
|
686
|
+
let childData = [];
|
|
687
|
+
if (childTokens) childData = $15b9b26a1f4728d9$var$parseMarkedTokenToSlackRequest(childTokens);
|
|
688
|
+
else {
|
|
689
|
+
acc.push(token.raw);
|
|
690
|
+
return acc;
|
|
691
|
+
}
|
|
692
|
+
const childDataGroupedByType = (0, $dxT2C$lodashes.groupBy)(childData, (x)=>(0, $dxT2C$lodashes.isString)(x) ? "text" : "block");
|
|
693
|
+
if (!(0, $dxT2C$lodashes.isEmpty)(childDataGroupedByType.text)) acc.push({
|
|
694
|
+
type: "section",
|
|
695
|
+
text: {
|
|
696
|
+
type: "mrkdwn",
|
|
697
|
+
text: (0, $dxT2C$lodashes.join)(childDataGroupedByType.text, "")
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
if (!(0, $dxT2C$lodashes.isEmpty)(childDataGroupedByType.block)) acc = (0, $dxT2C$lodashes.concat)(acc, childDataGroupedByType.block);
|
|
701
|
+
return acc;
|
|
702
|
+
}
|
|
703
|
+
if (token.type === "heading") {
|
|
704
|
+
acc.push({
|
|
705
|
+
type: "header",
|
|
706
|
+
text: {
|
|
707
|
+
type: "plain_text",
|
|
708
|
+
text: token.text,
|
|
709
|
+
emoji: true
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
return acc;
|
|
713
|
+
}
|
|
714
|
+
if (token.type === "list") {
|
|
715
|
+
const items = (0, $dxT2C$lodashes.map)(token.items, (item)=>{
|
|
716
|
+
const childTokens = (0, $dxT2C$lodashes.get)(item, "tokens");
|
|
717
|
+
let childData = [];
|
|
718
|
+
if (childTokens) childData = $15b9b26a1f4728d9$var$parseMarkedTokenToSlackRequest(childTokens);
|
|
719
|
+
return childData;
|
|
720
|
+
});
|
|
721
|
+
const listString = (0, $dxT2C$lodashes.join)((0, $dxT2C$lodashes.filter)((0, $dxT2C$lodashes.flattenDeep)(items), (x)=>!!(0, $dxT2C$lodashes.get)(x, "text.text")).map((x, index)=>`${token.ordered ? `${index + 1}.` : "•"} ${(0, $dxT2C$lodashes.get)(x, "text.text")}`), "\n");
|
|
722
|
+
acc.push({
|
|
723
|
+
type: "section",
|
|
724
|
+
text: {
|
|
725
|
+
type: "mrkdwn",
|
|
726
|
+
text: listString
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
return acc;
|
|
730
|
+
}
|
|
731
|
+
if (token.type === "strong") {
|
|
732
|
+
acc.push(`*${token.text}*`);
|
|
733
|
+
return acc;
|
|
734
|
+
}
|
|
735
|
+
if (token.type === "link") {
|
|
736
|
+
acc.push(`<${token.href}|${token.text}>`);
|
|
737
|
+
return acc;
|
|
738
|
+
}
|
|
739
|
+
if (token.type === "blockquote") {
|
|
740
|
+
acc.push({
|
|
741
|
+
type: "section",
|
|
742
|
+
text: {
|
|
743
|
+
type: "mrkdwn",
|
|
744
|
+
text: token.raw
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
return acc;
|
|
748
|
+
}
|
|
749
|
+
if (token.type === "code") {
|
|
750
|
+
acc.push({
|
|
751
|
+
type: "section",
|
|
752
|
+
text: {
|
|
753
|
+
type: "mrkdwn",
|
|
754
|
+
text: token.raw
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
return acc;
|
|
758
|
+
}
|
|
759
|
+
acc.push(token.raw);
|
|
760
|
+
return acc;
|
|
761
|
+
}, acc);
|
|
762
|
+
};
|
|
763
|
+
const $15b9b26a1f4728d9$var$convertMarkdownToSlack = (text)=>{
|
|
764
|
+
const tokens = (0, $dxT2C$marked.Lexer).lex(text);
|
|
765
|
+
const parsedTokens = $15b9b26a1f4728d9$var$parseMarkedTokenToSlackRequest(tokens);
|
|
766
|
+
return (0, $dxT2C$lodashes.filter)(parsedTokens, (x)=>!(0, $dxT2C$lodashes.isString)(x));
|
|
767
|
+
};
|
|
768
|
+
var $15b9b26a1f4728d9$export$2e2bcd8739ae039 = $15b9b26a1f4728d9$var$convertMarkdownToSlack;
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
function $06ecced17a74bf4a$var$getNormalizedString(value) {
|
|
774
|
+
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
775
|
+
}
|
|
776
|
+
function $06ecced17a74bf4a$var$mostSimilar(value, possibleValues, threshold = 0.8) {
|
|
777
|
+
const normalizedValue = $06ecced17a74bf4a$var$getNormalizedString(value);
|
|
778
|
+
const result = (0, $dxT2C$lodashes.reduce)(possibleValues, (acc, possibleValue)=>{
|
|
779
|
+
const normalizedPossibleValue = $06ecced17a74bf4a$var$getNormalizedString(possibleValue);
|
|
780
|
+
const similarity = (0, $dxT2C$dicecoefficient.diceCoefficient)(normalizedValue, normalizedPossibleValue);
|
|
781
|
+
if (similarity > acc.similarity) return {
|
|
782
|
+
similarity: similarity,
|
|
783
|
+
value: possibleValue
|
|
784
|
+
};
|
|
785
|
+
return acc;
|
|
786
|
+
}, {
|
|
787
|
+
similarity: 0,
|
|
788
|
+
value: ""
|
|
789
|
+
});
|
|
790
|
+
return result.similarity >= threshold ? result.value : value;
|
|
791
|
+
}
|
|
792
|
+
var $06ecced17a74bf4a$export$2e2bcd8739ae039 = $06ecced17a74bf4a$var$mostSimilar;
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
function $0a764cc1e9fed37c$export$96d07f33920abf3e(array, idKey = "id", parentIdKey = "parent_id", sequenceKey = "sequence") {
|
|
797
|
+
// Step 1: Create a Map for quick lookup of nodes by their id
|
|
798
|
+
const nodeMap = new Map();
|
|
799
|
+
// Populate the map
|
|
800
|
+
array.forEach((node)=>{
|
|
801
|
+
nodeMap.set((0, $dxT2C$lodashes.get)(node, idKey), {
|
|
802
|
+
...node,
|
|
803
|
+
children: []
|
|
804
|
+
});
|
|
805
|
+
});
|
|
806
|
+
// Step 2: Create an array to hold the root nodes
|
|
807
|
+
const rootNodes = [];
|
|
808
|
+
// Step 3: Organize the nodes into a tree structure
|
|
809
|
+
array.forEach((node)=>{
|
|
810
|
+
const parentId = (0, $dxT2C$lodashes.get)(node, parentIdKey);
|
|
811
|
+
const nodeId = (0, $dxT2C$lodashes.get)(node, idKey);
|
|
812
|
+
if (parentId && nodeMap.has(parentId)) // If the parent exists, add the current node as a child
|
|
813
|
+
nodeMap.get(parentId)?.children?.push(nodeMap.get(nodeId));
|
|
814
|
+
else // Treat it as a root node if the parent doesn't exist or it's null
|
|
815
|
+
rootNodes.push(nodeMap.get(nodeId));
|
|
816
|
+
});
|
|
817
|
+
// Step 4: Recursive function to sort nodes and their children
|
|
818
|
+
function sortTree(nodes) {
|
|
819
|
+
// Sort nodes using lodash by sequence
|
|
820
|
+
const sortedNodes = (0, $dxT2C$lodashes.sortBy)(nodes, sequenceKey);
|
|
821
|
+
sortedNodes.forEach((node)=>{
|
|
822
|
+
if (node.children && node.children.length > 0) node.children = sortTree(node.children);
|
|
823
|
+
});
|
|
824
|
+
return sortedNodes;
|
|
825
|
+
}
|
|
826
|
+
// Step 5: Sort the root nodes and recursively sort their children
|
|
827
|
+
const sortedTree = sortTree(rootNodes);
|
|
828
|
+
// Step 6: Flatten the sorted tree into an array (keeping the parent-child structure)
|
|
829
|
+
function flattenTree(nodes) {
|
|
830
|
+
return nodes.reduce((acc, node)=>{
|
|
831
|
+
acc.push((0, $dxT2C$lodashes.omit)(node, "children")) // Push the current node without 'children'
|
|
832
|
+
;
|
|
833
|
+
if (node.children && node.children.length > 0) acc.push(...flattenTree(node.children)) // Recursively flatten children
|
|
834
|
+
;
|
|
835
|
+
return acc;
|
|
836
|
+
}, []);
|
|
837
|
+
}
|
|
838
|
+
return flattenTree(sortedTree);
|
|
839
|
+
}
|
|
840
|
+
var $0a764cc1e9fed37c$export$2e2bcd8739ae039 = $0a764cc1e9fed37c$export$96d07f33920abf3e;
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
// @ts-ignore
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
const $59b0e4ac45b59e5b$var$convertHtmlToMarkdown = (html)=>{
|
|
848
|
+
const htmlDoc = (0, $dxT2C$mixmarkiodomino.createDocument)(html);
|
|
849
|
+
const turndownService = new (0, ($parcel$interopDefault($dxT2C$turndown)))();
|
|
850
|
+
turndownService.use((0, $dxT2C$turndownplugingfm.gfm));
|
|
851
|
+
return turndownService.turndown(htmlDoc);
|
|
852
|
+
};
|
|
853
|
+
var $59b0e4ac45b59e5b$export$2e2bcd8739ae039 = $59b0e4ac45b59e5b$var$convertHtmlToMarkdown;
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
function $c9ed3be7896125da$export$2e2bcd8739ae039(buffer, urlSafe = false) {
|
|
857
|
+
let binary = "";
|
|
858
|
+
const bytes = new Uint8Array(buffer);
|
|
859
|
+
const len = bytes.byteLength;
|
|
860
|
+
for(let i = 0; i < len; i++)binary += String.fromCharCode(bytes[i]);
|
|
861
|
+
if (urlSafe) return btoa(binary).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
862
|
+
return btoa(binary);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
const $1cf667e257c1904d$var$digest = async (text, algorithm = "SHA-256", stringType = "hex")=>{
|
|
868
|
+
const encoder = new TextEncoder();
|
|
869
|
+
const data = encoder.encode(text);
|
|
870
|
+
const hashBuffer = await (0, $dxT2C$crypto.webcrypto).subtle.digest(algorithm, data);
|
|
871
|
+
if (stringType === "hex") {
|
|
872
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
873
|
+
return hashArray.map((b)=>b.toString(16).padStart(2, "0")).join("");
|
|
874
|
+
} else if (stringType === "base64") return (0, $c9ed3be7896125da$export$2e2bcd8739ae039)(hashBuffer);
|
|
875
|
+
else if (stringType === "base64-urlSafe") return (0, $c9ed3be7896125da$export$2e2bcd8739ae039)(hashBuffer, true);
|
|
876
|
+
};
|
|
877
|
+
var $1cf667e257c1904d$export$2e2bcd8739ae039 = $1cf667e257c1904d$var$digest;
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
const $6c8155c4308ceae8$var$formatPlainText = (x)=>{
|
|
882
|
+
if (x) {
|
|
883
|
+
if (x.href) return `[${x.plain_text}](${x.href.startsWith("/") ? `https://www.notion.so${x.href}` : x.href})`;
|
|
884
|
+
const isBold = x.annotations?.bold;
|
|
885
|
+
const isItalic = x.annotations?.italic;
|
|
886
|
+
const isStrikethrough = x.annotations?.strikethrough;
|
|
887
|
+
const isUnderline = x.annotations?.underline;
|
|
888
|
+
const isCode = x.annotations?.code;
|
|
889
|
+
let textToReturn = x.plain_text;
|
|
890
|
+
if (isCode) textToReturn = `\`${textToReturn}\``;
|
|
891
|
+
if (isBold) textToReturn = `**${textToReturn}**`;
|
|
892
|
+
if (isItalic) textToReturn = `_${textToReturn}_`;
|
|
893
|
+
if (isUnderline) textToReturn = `_${textToReturn}_`;
|
|
894
|
+
if (isStrikethrough) textToReturn = `~~${textToReturn}~~`;
|
|
895
|
+
return textToReturn;
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
const $6c8155c4308ceae8$var$convertNotionToMd = function(block, level = 1) {
|
|
899
|
+
const n = "\n\n";
|
|
900
|
+
const data = block[block.type];
|
|
901
|
+
const plainText = data.rich_text ? data.rich_text.map($6c8155c4308ceae8$var$formatPlainText) : [];
|
|
902
|
+
// @ts-ignore
|
|
903
|
+
const caption = data.caption ? data.caption.map((x)=>x?.plain_text) : [];
|
|
904
|
+
let childData = "";
|
|
905
|
+
switch(block.type){
|
|
906
|
+
case "bookmark":
|
|
907
|
+
return `[${data.url}](data.url)${n}`;
|
|
908
|
+
case "bulleted_list_item":
|
|
909
|
+
childData = (0, $dxT2C$lodashes.map)(block.children, (child)=>$6c8155c4308ceae8$var$convertNotionToMd(child, level + 1)).join((0, $dxT2C$lodashes.repeat)(" ", level));
|
|
910
|
+
return `- ${plainText.join("")}\n` + (childData ? `${(0, $dxT2C$lodashes.repeat)(" ", level)}${childData}` : "");
|
|
911
|
+
case "numbered_list_item":
|
|
912
|
+
childData = (0, $dxT2C$lodashes.map)(block.children, (child)=>$6c8155c4308ceae8$var$convertNotionToMd(child, level + 1)).join((0, $dxT2C$lodashes.repeat)(" ", level));
|
|
913
|
+
return `${block.number}. ${plainText.join("")}\n` + (childData ? `${(0, $dxT2C$lodashes.repeat)(" ", level)}${childData}` : "");
|
|
914
|
+
case "quote":
|
|
915
|
+
case "callout":
|
|
916
|
+
return `> ${plainText.join("")}${n}`;
|
|
917
|
+
case "code":
|
|
918
|
+
return `\`\`\`${data.language}\n${plainText}\n\`\`\`${n}`;
|
|
919
|
+
case "divider":
|
|
920
|
+
return `---${n}`;
|
|
921
|
+
case "embed":
|
|
922
|
+
return `[${caption.length ? caption : "Embed"}](${data.url})${n}`;
|
|
923
|
+
case "equation":
|
|
924
|
+
return data.expression;
|
|
925
|
+
case "paragraph":
|
|
926
|
+
return plainText.join("") + n;
|
|
927
|
+
case "video":
|
|
928
|
+
case "pdf":
|
|
929
|
+
case "file":
|
|
930
|
+
return `[${caption.length ? caption : "File"}](${data.file ? data.file.url : data.external ? data.external.url : ""})${n}`;
|
|
931
|
+
case "heading_1":
|
|
932
|
+
return `# ${plainText.join("")}${n}`;
|
|
933
|
+
case "heading_2":
|
|
934
|
+
return `## ${plainText.join("")}${n}`;
|
|
935
|
+
case "heading_3":
|
|
936
|
+
return `### ${plainText.join("")}${n}`;
|
|
937
|
+
case "heading_4":
|
|
938
|
+
return `#### ${plainText.join("")}${n}`;
|
|
939
|
+
case "heading_5":
|
|
940
|
+
return `##### ${plainText.join("")}${n}`;
|
|
941
|
+
case "heading_6":
|
|
942
|
+
return `###### ${plainText.join("")}${n}`;
|
|
943
|
+
case "image":
|
|
944
|
+
return `${n}`;
|
|
945
|
+
case "table":
|
|
946
|
+
if (block.children) {
|
|
947
|
+
const firstChild = block.children[0];
|
|
948
|
+
const remainingChildren = block.children.slice(1);
|
|
949
|
+
const header = `| ${firstChild.table_row.cells.map((x)=>x.map((y)=>$6c8155c4308ceae8$var$formatPlainText(y)).join("")).join(" | ")} |\n`;
|
|
950
|
+
const divider = `|${(0, $dxT2C$lodashes.repeat)("---|", data.table_width)}\n`;
|
|
951
|
+
const rows = remainingChildren.map((row)=>{
|
|
952
|
+
return `| ${row.table_row.cells.map((x)=>x.map((y)=>$6c8155c4308ceae8$var$formatPlainText(y)).join("")).join(" | ")} |`;
|
|
953
|
+
}).join("\n");
|
|
954
|
+
return `${header}${divider}${rows}${n}`;
|
|
955
|
+
}
|
|
956
|
+
return `Table as CSV\n`;
|
|
957
|
+
case "table_row":
|
|
958
|
+
return `| ${data.cells.map((x)=>x.map((y)=>$6c8155c4308ceae8$var$formatPlainText(y)).join("")).join(" | ")} |\n`;
|
|
959
|
+
case "to_do":
|
|
960
|
+
childData = (0, $dxT2C$lodashes.map)(block.children, (child)=>$6c8155c4308ceae8$var$convertNotionToMd(child, level + 1)).join((0, $dxT2C$lodashes.repeat)(" ", level));
|
|
961
|
+
return `- [${data.checked ? "X" : " "}] ${plainText.join("")}\n` + (childData ? `${(0, $dxT2C$lodashes.repeat)(" ", level)}${childData}` : "");
|
|
962
|
+
default:
|
|
963
|
+
childData = (0, $dxT2C$lodashes.map)(block.children, (child)=>$6c8155c4308ceae8$var$convertNotionToMd(child)).join("");
|
|
964
|
+
return plainText.join("") + n + childData;
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
const $6c8155c4308ceae8$var$resolveChildren = function(block, blocks) {
|
|
968
|
+
if (!block.has_children) return block;
|
|
969
|
+
const children = blocks.filter((x)=>x.parent_id === block.id);
|
|
970
|
+
return {
|
|
971
|
+
...block,
|
|
972
|
+
children: children.map((child)=>$6c8155c4308ceae8$var$resolveChildren(child, blocks))
|
|
973
|
+
};
|
|
974
|
+
};
|
|
975
|
+
const $6c8155c4308ceae8$var$numberOrderedLists = function(blocks) {
|
|
976
|
+
let number = 0;
|
|
977
|
+
return blocks.map((block)=>{
|
|
978
|
+
if (block.type !== "numbered_list_item") {
|
|
979
|
+
number = 0;
|
|
980
|
+
return block;
|
|
981
|
+
} else {
|
|
982
|
+
if (block.children) block.children = $6c8155c4308ceae8$var$numberOrderedLists(block.children);
|
|
983
|
+
return {
|
|
984
|
+
...block,
|
|
985
|
+
number: ++number
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
};
|
|
990
|
+
const $6c8155c4308ceae8$var$insertNewLinesBetweenLists = function(blocks) {
|
|
991
|
+
const listBlocks = [
|
|
992
|
+
"to_do",
|
|
993
|
+
"numbered_list_item",
|
|
994
|
+
"bulleted_list_item"
|
|
995
|
+
];
|
|
996
|
+
return (0, $dxT2C$lodashes.flatten)(blocks.map((block, index)=>{
|
|
997
|
+
const nextBlock = blocks[index + 1];
|
|
998
|
+
const nextBlockType = nextBlock?.type;
|
|
999
|
+
if (listBlocks.includes(block.type) && !listBlocks.includes(nextBlockType)) return [
|
|
1000
|
+
block,
|
|
1001
|
+
{
|
|
1002
|
+
type: "paragraph",
|
|
1003
|
+
paragraph: {
|
|
1004
|
+
rich_text: [],
|
|
1005
|
+
color: "default"
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
];
|
|
1009
|
+
return block;
|
|
1010
|
+
}));
|
|
1011
|
+
};
|
|
1012
|
+
const $6c8155c4308ceae8$var$convertNotionToMarkdown = function(blocks) {
|
|
1013
|
+
const arrayBlocks = $6c8155c4308ceae8$var$insertNewLinesBetweenLists((0, $dxT2C$lodashes.castArray)(blocks));
|
|
1014
|
+
const parentBlocks = (0, $dxT2C$lodashes.reject)(arrayBlocks, (block)=>block.parent?.type === "block_id");
|
|
1015
|
+
const blocksWithChildren = $6c8155c4308ceae8$var$numberOrderedLists(parentBlocks.map((block)=>{
|
|
1016
|
+
return $6c8155c4308ceae8$var$resolveChildren(block, arrayBlocks);
|
|
1017
|
+
}));
|
|
1018
|
+
return blocksWithChildren.map((block)=>$6c8155c4308ceae8$var$convertNotionToMd(block)).join("");
|
|
1019
|
+
};
|
|
1020
|
+
var $6c8155c4308ceae8$export$2e2bcd8739ae039 = $6c8155c4308ceae8$var$convertNotionToMarkdown;
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
const $256af523deaf5315$var$sign = async (text, algorithm = "SHA-256", secret, outputFormat = "hex")=>{
|
|
1026
|
+
const key = await (0, $dxT2C$crypto.webcrypto).subtle.importKey("raw", new TextEncoder().encode(secret), {
|
|
1027
|
+
name: "HMAC",
|
|
1028
|
+
hash: algorithm
|
|
1029
|
+
}, false, [
|
|
1030
|
+
"sign"
|
|
1031
|
+
]);
|
|
1032
|
+
const encoder = new TextEncoder();
|
|
1033
|
+
const data = encoder.encode(text);
|
|
1034
|
+
const hashBuffer = await (0, $dxT2C$crypto.webcrypto).subtle.sign("HMAC", key, data);
|
|
1035
|
+
if (outputFormat === "hex") {
|
|
1036
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
1037
|
+
return hashArray.map((b)=>b.toString(16).padStart(2, "0")).join("");
|
|
1038
|
+
} else if (outputFormat === "base64") return (0, $c9ed3be7896125da$export$2e2bcd8739ae039)(hashBuffer);
|
|
1039
|
+
else if (outputFormat === "base64-urlSafe") return (0, $c9ed3be7896125da$export$2e2bcd8739ae039)(hashBuffer, true);
|
|
1040
|
+
};
|
|
1041
|
+
var $256af523deaf5315$export$2e2bcd8739ae039 = $256af523deaf5315$var$sign;
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
function $d08a44d57b1bb13e$export$2e2bcd8739ae039(xml, options = {
|
|
1046
|
+
compact: true,
|
|
1047
|
+
spaces: 4
|
|
1048
|
+
}) {
|
|
1049
|
+
return (0, $dxT2C$xmljs.xml2js)(xml, options);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
function $c7a445cfc49817c1$export$2e2bcd8739ae039(json, options = {
|
|
1055
|
+
compact: true,
|
|
1056
|
+
spaces: 4
|
|
1057
|
+
}) {
|
|
1058
|
+
return (0, $dxT2C$xmljs.js2xml)(json, options);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
function $bab42b5e4be720d3$var$dtFromIso(arg) {
|
|
1064
|
+
return (0, $dxT2C$luxon.DateTime).fromISO(arg);
|
|
1065
|
+
}
|
|
1066
|
+
var $bab42b5e4be720d3$export$2e2bcd8739ae039 = $bab42b5e4be720d3$var$dtFromIso;
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
function $c089c9056f650e50$var$dtFromFormat(date, format) {
|
|
1071
|
+
if (format === "RFC2822") return (0, $dxT2C$luxon.DateTime).fromRFC2822(date);
|
|
1072
|
+
if (format === "ISO") return (0, $dxT2C$luxon.DateTime).fromISO(date);
|
|
1073
|
+
if (format === "fromSeconds") return (0, $dxT2C$luxon.DateTime).fromSeconds(parseInt(date));
|
|
1074
|
+
return (0, $dxT2C$luxon.DateTime).fromFormat(date, format);
|
|
1075
|
+
}
|
|
1076
|
+
var $c089c9056f650e50$export$2e2bcd8739ae039 = $c089c9056f650e50$var$dtFromFormat;
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
function $253e55ffe387de34$var$removeEmpty(arg) {
|
|
1080
|
+
return arg.length ? arg : undefined;
|
|
1081
|
+
}
|
|
1082
|
+
var $253e55ffe387de34$export$2e2bcd8739ae039 = $253e55ffe387de34$var$removeEmpty;
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
function $f819b04a492e6732$var$removeEmptyItems(arg) {
|
|
1086
|
+
if (!Array.isArray(arg)) return arg;
|
|
1087
|
+
return arg.filter((item)=>{
|
|
1088
|
+
if (item && typeof item === "object") return Object.keys(item).length > 0;
|
|
1089
|
+
return item;
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
var $f819b04a492e6732$export$2e2bcd8739ae039 = $f819b04a492e6732$var$removeEmptyItems;
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
function $4eadef396bf1c54e$var$convertNotionToMd(block) {
|
|
1097
|
+
const data = block[block.type];
|
|
1098
|
+
const plainText = data.rich_text ? data.rich_text.map((x)=>{
|
|
1099
|
+
if (x) {
|
|
1100
|
+
if (x.href) return `[${x.plain_text}](${x.href.startsWith("/") ? `https://www.notion.so${x.href}` : x.href})`;
|
|
1101
|
+
return x.plain_text;
|
|
1102
|
+
}
|
|
1103
|
+
}) : [];
|
|
1104
|
+
// @ts-ignore
|
|
1105
|
+
const caption = data.caption ? data.caption.map((x)=>x?.plain_text) : [];
|
|
1106
|
+
switch(block.type){
|
|
1107
|
+
case "bookmark":
|
|
1108
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1109
|
+
link: {
|
|
1110
|
+
title: data.url,
|
|
1111
|
+
source: data.url
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
case "bulleted_list_item":
|
|
1115
|
+
return `${(0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1116
|
+
ul: plainText
|
|
1117
|
+
}).trim()} \n`;
|
|
1118
|
+
case "numbered_list_item":
|
|
1119
|
+
return `${(0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1120
|
+
ol: plainText
|
|
1121
|
+
}).trim()} \n`;
|
|
1122
|
+
case "quote":
|
|
1123
|
+
case "callout":
|
|
1124
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1125
|
+
blockquote: plainText
|
|
1126
|
+
});
|
|
1127
|
+
case "code":
|
|
1128
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1129
|
+
code: {
|
|
1130
|
+
language: data.language,
|
|
1131
|
+
content: plainText
|
|
1132
|
+
}
|
|
1133
|
+
});
|
|
1134
|
+
case "divider":
|
|
1135
|
+
return "--- \n";
|
|
1136
|
+
case "embed":
|
|
1137
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1138
|
+
link: {
|
|
1139
|
+
title: caption.length ? caption : "Embed",
|
|
1140
|
+
source: data.url
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
case "equation":
|
|
1144
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1145
|
+
p: data.expression
|
|
1146
|
+
});
|
|
1147
|
+
case "paragraph":
|
|
1148
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1149
|
+
p: plainText.join("")
|
|
1150
|
+
});
|
|
1151
|
+
case "video":
|
|
1152
|
+
case "pdf":
|
|
1153
|
+
case "file":
|
|
1154
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1155
|
+
link: {
|
|
1156
|
+
title: caption.length ? caption : "File",
|
|
1157
|
+
source: data.file ? data.file.url : data.external ? data.external.url : ""
|
|
1158
|
+
}
|
|
1159
|
+
});
|
|
1160
|
+
case "heading_1":
|
|
1161
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1162
|
+
h1: plainText
|
|
1163
|
+
});
|
|
1164
|
+
case "heading_2":
|
|
1165
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1166
|
+
h2: plainText
|
|
1167
|
+
});
|
|
1168
|
+
case "heading_3":
|
|
1169
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1170
|
+
h3: plainText
|
|
1171
|
+
});
|
|
1172
|
+
case "heading_4":
|
|
1173
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1174
|
+
h4: plainText
|
|
1175
|
+
});
|
|
1176
|
+
case "heading_5":
|
|
1177
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1178
|
+
h5: plainText
|
|
1179
|
+
});
|
|
1180
|
+
case "heading_6":
|
|
1181
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1182
|
+
h6: plainText
|
|
1183
|
+
});
|
|
1184
|
+
case "image":
|
|
1185
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1186
|
+
img: {
|
|
1187
|
+
title: caption.length ? caption : "Image",
|
|
1188
|
+
// @ts-ignore
|
|
1189
|
+
alt: caption.length ? caption : "Image",
|
|
1190
|
+
source: data.file ? data.file.url : data.external ? data.external.url : ""
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
case "table":
|
|
1194
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1195
|
+
p: "Tabular values as CSV"
|
|
1196
|
+
});
|
|
1197
|
+
case "table_row":
|
|
1198
|
+
// @ts-ignore
|
|
1199
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1200
|
+
p: data.cells.map((x)=>x[0]?.plain_text).join(",")
|
|
1201
|
+
});
|
|
1202
|
+
case "to_do":
|
|
1203
|
+
return `- [${data.checked ? "X" : " "}] ${plainText.join("")}\n`;
|
|
1204
|
+
default:
|
|
1205
|
+
return (0, ($parcel$interopDefault($dxT2C$json2md)))({
|
|
1206
|
+
p: plainText.join("")
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
var $4eadef396bf1c54e$export$2e2bcd8739ae039 = $4eadef396bf1c54e$var$convertNotionToMd;
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
function $2bc8364dc45b0cc5$var$parseUrl(url) {
|
|
1214
|
+
return new URL(url);
|
|
1215
|
+
}
|
|
1216
|
+
var $2bc8364dc45b0cc5$export$2e2bcd8739ae039 = $2bc8364dc45b0cc5$var$parseUrl;
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
function $491a3e93ed46e445$var$jsonParse(str) {
|
|
1220
|
+
try {
|
|
1221
|
+
return JSON.parse(str);
|
|
1222
|
+
} catch (e) {
|
|
1223
|
+
return null;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
var $491a3e93ed46e445$export$2e2bcd8739ae039 = $491a3e93ed46e445$var$jsonParse;
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
function $cff411daa1ea9f52$var$getMimeType(extensionType) {
|
|
1231
|
+
try {
|
|
1232
|
+
return (0, ($parcel$interopDefault($dxT2C$mime))).getType(extensionType);
|
|
1233
|
+
} catch (e) {
|
|
1234
|
+
return null;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
var $cff411daa1ea9f52$export$2e2bcd8739ae039 = $cff411daa1ea9f52$var$getMimeType;
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
function $b3c3220fc07098c9$var$uuid() {
|
|
1241
|
+
return crypto.randomUUID();
|
|
1242
|
+
}
|
|
1243
|
+
var $b3c3220fc07098c9$export$2e2bcd8739ae039 = $b3c3220fc07098c9$var$uuid;
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
function $1b5edce2fe329e3e$var$base64encode(arg) {
|
|
1248
|
+
return (0, $dxT2C$honoutilsencode.encodeBase64)(new TextEncoder().encode(arg));
|
|
1249
|
+
}
|
|
1250
|
+
var $1b5edce2fe329e3e$export$2e2bcd8739ae039 = $1b5edce2fe329e3e$var$base64encode;
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
var $ca838bf406ad8d65$exports = {};
|
|
1255
|
+
$ca838bf406ad8d65$exports = JSON.parse('{"AED":{"code":"AED","number":"784","digits":2,"currency":"UAE Dirham","countries":["United Arab Emirates (The)"]},"AFN":{"code":"AFN","number":"971","digits":2,"currency":"Afghani","countries":["Afghanistan"]},"ALL":{"code":"ALL","number":"008","digits":2,"currency":"Lek","countries":["Albania"]},"AMD":{"code":"AMD","number":"051","digits":2,"currency":"Armenian Dram","countries":["Armenia"]},"ANG":{"code":"ANG","number":"532","digits":2,"currency":"Netherlands Antillean Guilder","countries":["Cura\xe7ao","Sint Maarten (Dutch Part)"]},"AOA":{"code":"AOA","number":"973","digits":2,"currency":"Kwanza","countries":["Angola"]},"ARS":{"code":"ARS","number":"032","digits":2,"currency":"Argentine Peso","countries":["Argentina"]},"AUD":{"code":"AUD","number":"036","digits":2,"currency":"Australian Dollar","countries":["Australia","Christmas Island","Cocos (Keeling) Islands (The)","Heard Island and Mcdonald Islands","Kiribati","Nauru","Norfolk Island","Tuvalu"]},"AWG":{"code":"AWG","number":"533","digits":2,"currency":"Aruban Florin","countries":["Aruba"]},"AZN":{"code":"AZN","number":"944","digits":2,"currency":"Azerbaijan Manat","countries":["Azerbaijan"]},"BAM":{"code":"BAM","number":"977","digits":2,"currency":"Convertible Mark","countries":["Bosnia and Herzegovina"]},"BBD":{"code":"BBD","number":"052","digits":2,"currency":"Barbados Dollar","countries":["Barbados"]},"BDT":{"code":"BDT","number":"050","digits":2,"currency":"Taka","countries":["Bangladesh"]},"BGN":{"code":"BGN","number":"975","digits":2,"currency":"Bulgarian Lev","countries":["Bulgaria"]},"BHD":{"code":"BHD","number":"048","digits":3,"currency":"Bahraini Dinar","countries":["Bahrain"]},"BIF":{"code":"BIF","number":"108","digits":0,"currency":"Burundi Franc","countries":["Burundi"]},"BMD":{"code":"BMD","number":"060","digits":2,"currency":"Bermudian Dollar","countries":["Bermuda"]},"BND":{"code":"BND","number":"096","digits":2,"currency":"Brunei Dollar","countries":["Brunei Darussalam"]},"BOB":{"code":"BOB","number":"068","digits":2,"currency":"Boliviano","countries":["Bolivia (Plurinational State Of)"]},"BOV":{"code":"BOV","number":"984","digits":2,"currency":"Mvdol","countries":["Bolivia (Plurinational State Of)"]},"BRL":{"code":"BRL","number":"986","digits":2,"currency":"Brazilian Real","countries":["Brazil"]},"BSD":{"code":"BSD","number":"044","digits":2,"currency":"Bahamian Dollar","countries":["Bahamas (The)"]},"BTN":{"code":"BTN","number":"064","digits":2,"currency":"Ngultrum","countries":["Bhutan"]},"BWP":{"code":"BWP","number":"072","digits":2,"currency":"Pula","countries":["Botswana"]},"BYN":{"code":"BYN","number":"933","digits":2,"currency":"Belarusian Ruble","countries":["Belarus"]},"BZD":{"code":"BZD","number":"084","digits":2,"currency":"Belize Dollar","countries":["Belize"]},"CAD":{"code":"CAD","number":"124","digits":2,"currency":"Canadian Dollar","countries":["Canada"]},"CDF":{"code":"CDF","number":"976","digits":2,"currency":"Congolese Franc","countries":["Congo (The Democratic Republic of The)"]},"CHE":{"code":"CHE","number":"947","digits":2,"currency":"WIR Euro","countries":["Switzerland"]},"CHF":{"code":"CHF","number":"756","digits":2,"currency":"Swiss Franc","countries":["Liechtenstein","Switzerland"]},"CHW":{"code":"CHW","number":"948","digits":2,"currency":"WIR Franc","countries":["Switzerland"]},"CLF":{"code":"CLF","number":"990","digits":4,"currency":"Unidad de Fomento","countries":["Chile"]},"CLP":{"code":"CLP","number":"152","digits":0,"currency":"Chilean Peso","countries":["Chile"]},"CNY":{"code":"CNY","number":"156","digits":2,"currency":"Yuan Renminbi","countries":["China"]},"COP":{"code":"COP","number":"170","digits":2,"currency":"Colombian Peso","countries":["Colombia"]},"COU":{"code":"COU","number":"970","digits":2,"currency":"Unidad de Valor Real","countries":["Colombia"]},"CRC":{"code":"CRC","number":"188","digits":2,"currency":"Costa Rican Colon","countries":["Costa Rica"]},"CUC":{"code":"CUC","number":"931","digits":2,"currency":"Peso Convertible","countries":["Cuba"]},"CUP":{"code":"CUP","number":"192","digits":2,"currency":"Cuban Peso","countries":["Cuba"]},"CVE":{"code":"CVE","number":"132","digits":2,"currency":"Cabo Verde Escudo","countries":["Cabo Verde"]},"CZK":{"code":"CZK","number":"203","digits":2,"currency":"Czech Koruna","countries":["Czechia"]},"DJF":{"code":"DJF","number":"262","digits":0,"currency":"Djibouti Franc","countries":["Djibouti"]},"DKK":{"code":"DKK","number":"208","digits":2,"currency":"Danish Krone","countries":["Denmark","Faroe Islands (The)","Greenland"]},"DOP":{"code":"DOP","number":"214","digits":2,"currency":"Dominican Peso","countries":["Dominican Republic (The)"]},"DZD":{"code":"DZD","number":"012","digits":2,"currency":"Algerian Dinar","countries":["Algeria"]},"EGP":{"code":"EGP","number":"818","digits":2,"currency":"Egyptian Pound","countries":["Egypt"]},"ERN":{"code":"ERN","number":"232","digits":2,"currency":"Nakfa","countries":["Eritrea"]},"ETB":{"code":"ETB","number":"230","digits":2,"currency":"Ethiopian Birr","countries":["Ethiopia"]},"EUR":{"code":"EUR","number":"978","digits":2,"currency":"Euro","countries":["\xc5land Islands","Andorra","Austria","Belgium","Cyprus","Estonia","European Union","Finland","France","French Guiana","French Southern Territories (The)","Germany","Greece","Guadeloupe","Holy See (The)","Ireland","Italy","Latvia","Lithuania","Luxembourg","Malta","Martinique","Mayotte","Monaco","Montenegro","Netherlands (The)","Portugal","R\xe9union","Saint Barth\xe9lemy","Saint Martin (French Part)","Saint Pierre and Miquelon","San Marino","Slovakia","Slovenia","Spain"]},"FJD":{"code":"FJD","number":"242","digits":2,"currency":"Fiji Dollar","countries":["Fiji"]},"FKP":{"code":"FKP","number":"238","digits":2,"currency":"Falkland Islands Pound","countries":["Falkland Islands (The) [Malvinas]"]},"GBP":{"code":"GBP","number":"826","digits":2,"currency":"Pound Sterling","countries":["Guernsey","Isle of Man","Jersey","United Kingdom of Great Britain and Northern Ireland (The)"]},"GEL":{"code":"GEL","number":"981","digits":2,"currency":"Lari","countries":["Georgia"]},"GHS":{"code":"GHS","number":"936","digits":2,"currency":"Ghana Cedi","countries":["Ghana"]},"GIP":{"code":"GIP","number":"292","digits":2,"currency":"Gibraltar Pound","countries":["Gibraltar"]},"GMD":{"code":"GMD","number":"270","digits":2,"currency":"Dalasi","countries":["Gambia (The)"]},"GNF":{"code":"GNF","number":"324","digits":0,"currency":"Guinean Franc","countries":["Guinea"]},"GTQ":{"code":"GTQ","number":"320","digits":2,"currency":"Quetzal","countries":["Guatemala"]},"GYD":{"code":"GYD","number":"328","digits":2,"currency":"Guyana Dollar","countries":["Guyana"]},"HKD":{"code":"HKD","number":"344","digits":2,"currency":"Hong Kong Dollar","countries":["Hong Kong"]},"HNL":{"code":"HNL","number":"340","digits":2,"currency":"Lempira","countries":["Honduras"]},"HRK":{"code":"HRK","number":"191","digits":2,"currency":"Kuna","countries":["Croatia"]},"HTG":{"code":"HTG","number":"332","digits":2,"currency":"Gourde","countries":["Haiti"]},"HUF":{"code":"HUF","number":"348","digits":2,"currency":"Forint","countries":["Hungary"]},"IDR":{"code":"IDR","number":"360","digits":2,"currency":"Rupiah","countries":["Indonesia"]},"ILS":{"code":"ILS","number":"376","digits":2,"currency":"New Israeli Sheqel","countries":["Israel"]},"INR":{"code":"INR","number":"356","digits":2,"currency":"Indian Rupee","countries":["Bhutan","India"]},"IQD":{"code":"IQD","number":"368","digits":3,"currency":"Iraqi Dinar","countries":["Iraq"]},"IRR":{"code":"IRR","number":"364","digits":2,"currency":"Iranian Rial","countries":["Iran (Islamic Republic Of)"]},"ISK":{"code":"ISK","number":"352","digits":0,"currency":"Iceland Krona","countries":["Iceland"]},"JMD":{"code":"JMD","number":"388","digits":2,"currency":"Jamaican Dollar","countries":["Jamaica"]},"JOD":{"code":"JOD","number":"400","digits":3,"currency":"Jordanian Dinar","countries":["Jordan"]},"JPY":{"code":"JPY","number":"392","digits":0,"currency":"Yen","countries":["Japan"]},"KES":{"code":"KES","number":"404","digits":2,"currency":"Kenyan Shilling","countries":["Kenya"]},"KGS":{"code":"KGS","number":"417","digits":2,"currency":"Som","countries":["Kyrgyzstan"]},"KHR":{"code":"KHR","number":"116","digits":2,"currency":"Riel","countries":["Cambodia"]},"KMF":{"code":"KMF","number":"174","digits":0,"currency":"Comorian Franc ","countries":["Comoros (The)"]},"KPW":{"code":"KPW","number":"408","digits":2,"currency":"North Korean Won","countries":["Korea (The Democratic People’s Republic Of)"]},"KRW":{"code":"KRW","number":"410","digits":0,"currency":"Won","countries":["Korea (The Republic Of)"]},"KWD":{"code":"KWD","number":"414","digits":3,"currency":"Kuwaiti Dinar","countries":["Kuwait"]},"KYD":{"code":"KYD","number":"136","digits":2,"currency":"Cayman Islands Dollar","countries":["Cayman Islands (The)"]},"KZT":{"code":"KZT","number":"398","digits":2,"currency":"Tenge","countries":["Kazakhstan"]},"LAK":{"code":"LAK","number":"418","digits":2,"currency":"Lao Kip","countries":["Lao People’s Democratic Republic (The)"]},"LBP":{"code":"LBP","number":"422","digits":2,"currency":"Lebanese Pound","countries":["Lebanon"]},"LKR":{"code":"LKR","number":"144","digits":2,"currency":"Sri Lanka Rupee","countries":["Sri Lanka"]},"LRD":{"code":"LRD","number":"430","digits":2,"currency":"Liberian Dollar","countries":["Liberia"]},"LSL":{"code":"LSL","number":"426","digits":2,"currency":"Loti","countries":["Lesotho"]},"LYD":{"code":"LYD","number":"434","digits":3,"currency":"Libyan Dinar","countries":["Libya"]},"MAD":{"code":"MAD","number":"504","digits":2,"currency":"Moroccan Dirham","countries":["Morocco","Western Sahara"]},"MDL":{"code":"MDL","number":"498","digits":2,"currency":"Moldovan Leu","countries":["Moldova (The Republic Of)"]},"MGA":{"code":"MGA","number":"969","digits":2,"currency":"Malagasy Ariary","countries":["Madagascar"]},"MKD":{"code":"MKD","number":"807","digits":2,"currency":"Denar","countries":["Macedonia (The Former Yugoslav Republic Of)"]},"MMK":{"code":"MMK","number":"104","digits":2,"currency":"Kyat","countries":["Myanmar"]},"MNT":{"code":"MNT","number":"496","digits":2,"currency":"Tugrik","countries":["Mongolia"]},"MOP":{"code":"MOP","number":"446","digits":2,"currency":"Pataca","countries":["Macao"]},"MRU":{"code":"MRU","number":"929","digits":2,"currency":"Ouguiya","countries":["Mauritania"]},"MUR":{"code":"MUR","number":"480","digits":2,"currency":"Mauritius Rupee","countries":["Mauritius"]},"MVR":{"code":"MVR","number":"462","digits":2,"currency":"Rufiyaa","countries":["Maldives"]},"MWK":{"code":"MWK","number":"454","digits":2,"currency":"Malawi Kwacha","countries":["Malawi"]},"MXN":{"code":"MXN","number":"484","digits":2,"currency":"Mexican Peso","countries":["Mexico"]},"MXV":{"code":"MXV","number":"979","digits":2,"currency":"Mexican Unidad de Inversion (UDI)","countries":["Mexico"]},"MYR":{"code":"MYR","number":"458","digits":2,"currency":"Malaysian Ringgit","countries":["Malaysia"]},"MZN":{"code":"MZN","number":"943","digits":2,"currency":"Mozambique Metical","countries":["Mozambique"]},"NAD":{"code":"NAD","number":"516","digits":2,"currency":"Namibia Dollar","countries":["Namibia"]},"NGN":{"code":"NGN","number":"566","digits":2,"currency":"Naira","countries":["Nigeria"]},"NIO":{"code":"NIO","number":"558","digits":2,"currency":"Cordoba Oro","countries":["Nicaragua"]},"NOK":{"code":"NOK","number":"578","digits":2,"currency":"Norwegian Krone","countries":["Bouvet Island","Norway","Svalbard and Jan Mayen"]},"NPR":{"code":"NPR","number":"524","digits":2,"currency":"Nepalese Rupee","countries":["Nepal"]},"NZD":{"code":"NZD","number":"554","digits":2,"currency":"New Zealand Dollar","countries":["Cook Islands (The)","New Zealand","Niue","Pitcairn","Tokelau"]},"OMR":{"code":"OMR","number":"512","digits":3,"currency":"Rial Omani","countries":["Oman"]},"PAB":{"code":"PAB","number":"590","digits":2,"currency":"Balboa","countries":["Panama"]},"PEN":{"code":"PEN","number":"604","digits":2,"currency":"Sol","countries":["Peru"]},"PGK":{"code":"PGK","number":"598","digits":2,"currency":"Kina","countries":["Papua New Guinea"]},"PHP":{"code":"PHP","number":"608","digits":2,"currency":"Philippine Peso","countries":["Philippines (The)"]},"PKR":{"code":"PKR","number":"586","digits":2,"currency":"Pakistan Rupee","countries":["Pakistan"]},"PLN":{"code":"PLN","number":"985","digits":2,"currency":"Zloty","countries":["Poland"]},"PYG":{"code":"PYG","number":"600","digits":0,"currency":"Guarani","countries":["Paraguay"]},"QAR":{"code":"QAR","number":"634","digits":2,"currency":"Qatari Rial","countries":["Qatar"]},"RON":{"code":"RON","number":"946","digits":2,"currency":"Romanian Leu","countries":["Romania"]},"RSD":{"code":"RSD","number":"941","digits":2,"currency":"Serbian Dinar","countries":["Serbia"]},"RUB":{"code":"RUB","number":"643","digits":2,"currency":"Russian Ruble","countries":["Russian Federation (The)"]},"RWF":{"code":"RWF","number":"646","digits":0,"currency":"Rwanda Franc","countries":["Rwanda"]},"SAR":{"code":"SAR","number":"682","digits":2,"currency":"Saudi Riyal","countries":["Saudi Arabia"]},"SBD":{"code":"SBD","number":"090","digits":2,"currency":"Solomon Islands Dollar","countries":["Solomon Islands"]},"SCR":{"code":"SCR","number":"690","digits":2,"currency":"Seychelles Rupee","countries":["Seychelles"]},"SDG":{"code":"SDG","number":"938","digits":2,"currency":"Sudanese Pound","countries":["Sudan (The)"]},"SEK":{"code":"SEK","number":"752","digits":2,"currency":"Swedish Krona","countries":["Sweden"]},"SGD":{"code":"SGD","number":"702","digits":2,"currency":"Singapore Dollar","countries":["Singapore"]},"SHP":{"code":"SHP","number":"654","digits":2,"currency":"Saint Helena Pound","countries":["Saint Helena, Ascension and Tristan Da Cunha"]},"SLL":{"code":"SLL","number":"694","digits":2,"currency":"Leone","countries":["Sierra Leone"]},"SOS":{"code":"SOS","number":"706","digits":2,"currency":"Somali Shilling","countries":["Somalia"]},"SRD":{"code":"SRD","number":"968","digits":2,"currency":"Surinam Dollar","countries":["Suriname"]},"SSP":{"code":"SSP","number":"728","digits":2,"currency":"South Sudanese Pound","countries":["South Sudan"]},"STN":{"code":"STN","number":"930","digits":2,"currency":"Dobra","countries":["Sao Tome and Principe"]},"SVC":{"code":"SVC","number":"222","digits":2,"currency":"El Salvador Colon","countries":["El Salvador"]},"SYP":{"code":"SYP","number":"760","digits":2,"currency":"Syrian Pound","countries":["Syrian Arab Republic"]},"SZL":{"code":"SZL","number":"748","digits":2,"currency":"Lilangeni","countries":["Eswatini"]},"THB":{"code":"THB","number":"764","digits":2,"currency":"Baht","countries":["Thailand"]},"TJS":{"code":"TJS","number":"972","digits":2,"currency":"Somoni","countries":["Tajikistan"]},"TMT":{"code":"TMT","number":"934","digits":2,"currency":"Turkmenistan New Manat","countries":["Turkmenistan"]},"TND":{"code":"TND","number":"788","digits":3,"currency":"Tunisian Dinar","countries":["Tunisia"]},"TOP":{"code":"TOP","number":"776","digits":2,"currency":"Pa’anga","countries":["Tonga"]},"TRY":{"code":"TRY","number":"949","digits":2,"currency":"Turkish Lira","countries":["Turkey"]},"TTD":{"code":"TTD","number":"780","digits":2,"currency":"Trinidad and Tobago Dollar","countries":["Trinidad and Tobago"]},"TWD":{"code":"TWD","number":"901","digits":2,"currency":"New Taiwan Dollar","countries":["Taiwan (Province of China)"]},"TZS":{"code":"TZS","number":"834","digits":2,"currency":"Tanzanian Shilling","countries":["Tanzania, United Republic Of"]},"UAH":{"code":"UAH","number":"980","digits":2,"currency":"Hryvnia","countries":["Ukraine"]},"UGX":{"code":"UGX","number":"800","digits":0,"currency":"Uganda Shilling","countries":["Uganda"]},"USD":{"code":"USD","number":"840","digits":2,"currency":"US Dollar","countries":["American Samoa","Bonaire, Sint Eustatius and Saba","British Indian Ocean Territory (The)","Ecuador","El Salvador","Guam","Haiti","Marshall Islands (The)","Micronesia (Federated States Of)","Northern Mariana Islands (The)","Palau","Panama","Puerto Rico","Timor-Leste","Turks and Caicos Islands (The)","United States Minor Outlying Islands (The)","United States of America (The)","Virgin Islands (British)","Virgin Islands (U.S.)"]},"USN":{"code":"USN","number":"997","digits":2,"currency":"US Dollar (Next day)","countries":["United States of America (The)"]},"UYI":{"code":"UYI","number":"940","digits":0,"currency":"Uruguay Peso en Unidades Indexadas (UI)","countries":["Uruguay"]},"UYU":{"code":"UYU","number":"858","digits":2,"currency":"Peso Uruguayo","countries":["Uruguay"]},"UYW":{"code":"UYW","number":"927","digits":4,"currency":"Unidad Previsional","countries":["Uruguay"]},"UZS":{"code":"UZS","number":"860","digits":2,"currency":"Uzbekistan Sum","countries":["Uzbekistan"]},"VES":{"code":"VES","number":"928","digits":2,"currency":"Bol\xedvar Soberano","countries":["Venezuela (Bolivarian Republic Of)"]},"VND":{"code":"VND","number":"704","digits":0,"currency":"Dong","countries":["Viet Nam"]},"VUV":{"code":"VUV","number":"548","digits":0,"currency":"Vatu","countries":["Vanuatu"]},"WST":{"code":"WST","number":"882","digits":2,"currency":"Tala","countries":["Samoa"]},"XAF":{"code":"XAF","number":"950","digits":0,"currency":"CFA Franc BEAC","countries":["Cameroon","Central African Republic (The)","Chad","Congo (The)","Equatorial Guinea","Gabon"]},"XAG":{"code":"XAG","number":"961","digits":0,"currency":"Silver","countries":["Zz11_silver"]},"XAU":{"code":"XAU","number":"959","digits":0,"currency":"Gold","countries":["Zz08_gold"]},"XBA":{"code":"XBA","number":"955","digits":0,"currency":"Bond Markets Unit European Composite Unit (EURCO)","countries":["Zz01_bond Markets Unit European_eurco"]},"XBB":{"code":"XBB","number":"956","digits":0,"currency":"Bond Markets Unit European Monetary Unit (E.M.U.-6)","countries":["Zz02_bond Markets Unit European_emu-6"]},"XBC":{"code":"XBC","number":"957","digits":0,"currency":"Bond Markets Unit European Unit of Account 9 (E.U.A.-9)","countries":["Zz03_bond Markets Unit European_eua-9"]},"XBD":{"code":"XBD","number":"958","digits":0,"currency":"Bond Markets Unit European Unit of Account 17 (E.U.A.-17)","countries":["Zz04_bond Markets Unit European_eua-17"]},"XCD":{"code":"XCD","number":"951","digits":2,"currency":"East Caribbean Dollar","countries":["Anguilla","Antigua and Barbuda","Dominica","Grenada","Montserrat","Saint Kitts and Nevis","Saint Lucia","Saint Vincent and the Grenadines"]},"XDR":{"code":"XDR","number":"960","digits":0,"currency":"SDR (Special Drawing Right)","countries":["International Monetary Fund (Imf) "]},"XOF":{"code":"XOF","number":"952","digits":0,"currency":"CFA Franc BCEAO","countries":["Benin","Burkina Faso","C\xf4te d\'Ivoire","Guinea-Bissau","Mali","Niger (The)","Senegal","Togo"]},"XPD":{"code":"XPD","number":"964","digits":0,"currency":"Palladium","countries":["Zz09_palladium"]},"XPF":{"code":"XPF","number":"953","digits":0,"currency":"CFP Franc","countries":["French Polynesia","New Caledonia","Wallis and Futuna"]},"XPT":{"code":"XPT","number":"962","digits":0,"currency":"Platinum","countries":["Zz10_platinum"]},"XSU":{"code":"XSU","number":"994","digits":0,"currency":"Sucre","countries":["Sistema Unitario De Compensacion Regional De Pagos"]},"XTS":{"code":"XTS","number":"963","digits":0,"currency":"Codes specifically reserved for testing purposes","countries":["Zz06_testing_code"]},"XUA":{"code":"XUA","number":"965","digits":0,"currency":"ADB Unit of Account","countries":["Member Countries of the African Development Bank Group"]},"XXX":{"code":"XXX","number":"999","digits":0,"currency":"The codes assigned for transactions where no currency is involved","countries":["Zz07_no_currency"]},"YER":{"code":"YER","number":"886","digits":2,"currency":"Yemeni Rial","countries":["Yemen"]},"ZAR":{"code":"ZAR","number":"710","digits":2,"currency":"Rand","countries":["Lesotho","Namibia","South Africa"]},"ZMW":{"code":"ZMW","number":"967","digits":2,"currency":"Zambian Kwacha","countries":["Zambia"]},"ZWL":{"code":"ZWL","number":"932","digits":2,"currency":"Zimbabwe Dollar","countries":["Zimbabwe"]}}');
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
function $17f6ad04ec182cbf$var$convertCurrencyToSubunit(arg, currencyCode) {
|
|
1259
|
+
if ((0, $dxT2C$lodashes.isNil)(arg)) return arg;
|
|
1260
|
+
// @ts-ignore
|
|
1261
|
+
if ((0, (/*@__PURE__*/$parcel$interopDefault($ca838bf406ad8d65$exports)))[currencyCode]) {
|
|
1262
|
+
const amount = parseFloat(arg);
|
|
1263
|
+
// @ts-ignore
|
|
1264
|
+
const subunit = (0, (/*@__PURE__*/$parcel$interopDefault($ca838bf406ad8d65$exports)))[currencyCode].digits;
|
|
1265
|
+
return Math.floor(amount * Math.pow(10, subunit));
|
|
1266
|
+
}
|
|
1267
|
+
return arg;
|
|
1268
|
+
}
|
|
1269
|
+
var $17f6ad04ec182cbf$export$2e2bcd8739ae039 = $17f6ad04ec182cbf$var$convertCurrencyToSubunit;
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
function $9c8dd912df011d47$var$convertCurrencyFromSubunit(arg, currencyCode) {
|
|
1275
|
+
if ((0, $dxT2C$lodashes.isNil)(arg)) return arg;
|
|
1276
|
+
// @ts-ignore
|
|
1277
|
+
if ((0, (/*@__PURE__*/$parcel$interopDefault($ca838bf406ad8d65$exports)))[currencyCode]) {
|
|
1278
|
+
const amount = parseFloat(arg);
|
|
1279
|
+
// @ts-ignore
|
|
1280
|
+
const subunit = (0, (/*@__PURE__*/$parcel$interopDefault($ca838bf406ad8d65$exports)))[currencyCode].digits;
|
|
1281
|
+
return (amount / Math.pow(10, subunit)).toFixed(subunit);
|
|
1282
|
+
}
|
|
1283
|
+
return arg;
|
|
1284
|
+
}
|
|
1285
|
+
var $9c8dd912df011d47$export$2e2bcd8739ae039 = $9c8dd912df011d47$var$convertCurrencyFromSubunit;
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
function $61d34cb0b1d98121$var$firstNonEmpty(...args) {
|
|
1289
|
+
for (const arg of args){
|
|
1290
|
+
if (arg !== undefined && arg !== null) return arg;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
var $61d34cb0b1d98121$export$2e2bcd8739ae039 = $61d34cb0b1d98121$var$firstNonEmpty;
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
async function $5e0a134878b8be39$var$getArrayBuffer(file) {
|
|
1297
|
+
return file ? await file.arrayBuffer() : undefined;
|
|
1298
|
+
}
|
|
1299
|
+
var $5e0a134878b8be39$export$2e2bcd8739ae039 = $5e0a134878b8be39$var$getArrayBuffer;
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
function $5e0c34680d37ee90$var$blob(content, options) {
|
|
1304
|
+
return new Blob((0, $dxT2C$lodashes.castArray)(content || ""), options);
|
|
1305
|
+
}
|
|
1306
|
+
var $5e0c34680d37ee90$export$2e2bcd8739ae039 = $5e0c34680d37ee90$var$blob;
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
function $9cdb7c76a5e196f3$var$zipSqlResponse(columns, data, key) {
|
|
1310
|
+
// @ts-ignore
|
|
1311
|
+
const columnKeys = columns.map((col)=>col[key]);
|
|
1312
|
+
// @ts-ignore
|
|
1313
|
+
return data.map((row)=>{
|
|
1314
|
+
const obj = {};
|
|
1315
|
+
for(let i = 0; i < columnKeys.length; i++)// @ts-ignore
|
|
1316
|
+
obj[columnKeys[i]] = row[i];
|
|
1317
|
+
return obj;
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
var $9cdb7c76a5e196f3$export$2e2bcd8739ae039 = $9cdb7c76a5e196f3$var$zipSqlResponse;
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
function $77081a2d6d46cd50$var$base64decode(arg) {
|
|
1325
|
+
return new TextDecoder("utf-8").decode((0, $dxT2C$honoutilsencode.decodeBase64)(arg));
|
|
1326
|
+
}
|
|
1327
|
+
var $77081a2d6d46cd50$export$2e2bcd8739ae039 = $77081a2d6d46cd50$var$base64decode;
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
function $af351c41b7fd6f79$export$2e2bcd8739ae039(expression) {
|
|
1332
|
+
expression.registerFunction("dtFromIso", (0, $bab42b5e4be720d3$export$2e2bcd8739ae039));
|
|
1333
|
+
expression.registerFunction("base64decode", (0, $77081a2d6d46cd50$export$2e2bcd8739ae039));
|
|
1334
|
+
expression.registerFunction("base64encode", (0, $1b5edce2fe329e3e$export$2e2bcd8739ae039));
|
|
1335
|
+
expression.registerFunction("dtFromFormat", (0, $c089c9056f650e50$export$2e2bcd8739ae039));
|
|
1336
|
+
expression.registerFunction("removeEmpty", (0, $253e55ffe387de34$export$2e2bcd8739ae039));
|
|
1337
|
+
expression.registerFunction("removeEmptyItems", (0, $f819b04a492e6732$export$2e2bcd8739ae039));
|
|
1338
|
+
expression.registerFunction("convertCurrencyToSubunit", (0, $17f6ad04ec182cbf$export$2e2bcd8739ae039));
|
|
1339
|
+
expression.registerFunction("convertCurrencyFromSubunit", (0, $9c8dd912df011d47$export$2e2bcd8739ae039));
|
|
1340
|
+
expression.registerFunction("convertQueryToSql", (0, $f3c3a16d1adbba55$export$2e2bcd8739ae039));
|
|
1341
|
+
expression.registerFunction("mapValues", (0, $cc0827b1147b8d10$export$2e2bcd8739ae039));
|
|
1342
|
+
expression.registerFunction("zipSqlResponse", (0, $9cdb7c76a5e196f3$export$2e2bcd8739ae039));
|
|
1343
|
+
expression.registerFunction("firstNonEmpty", (0, $61d34cb0b1d98121$export$2e2bcd8739ae039));
|
|
1344
|
+
expression.registerFunction("convertNotionToMd", (0, $4eadef396bf1c54e$export$2e2bcd8739ae039));
|
|
1345
|
+
expression.registerFunction("convertNotionToMarkdown", (0, $6c8155c4308ceae8$export$2e2bcd8739ae039));
|
|
1346
|
+
expression.registerFunction("convertMarkdownToGoogleDocs", (0, $90c566adb85cb52e$export$2e2bcd8739ae039));
|
|
1347
|
+
expression.registerFunction("convertMarkdownToNotion", (0, $bc8e7b2fdb012b3a$export$2e2bcd8739ae039));
|
|
1348
|
+
expression.registerFunction("convertMarkdownToSlack", (0, $15b9b26a1f4728d9$export$2e2bcd8739ae039));
|
|
1349
|
+
expression.registerFunction("parseUrl", (0, $2bc8364dc45b0cc5$export$2e2bcd8739ae039));
|
|
1350
|
+
expression.registerFunction("difference", function(arr1, arr2) {
|
|
1351
|
+
return (0, $dxT2C$lodashes.difference)(arr1, arr2);
|
|
1352
|
+
});
|
|
1353
|
+
expression.registerFunction("jsonParse", (0, $491a3e93ed46e445$export$2e2bcd8739ae039));
|
|
1354
|
+
expression.registerFunction("getMimeType", (0, $cff411daa1ea9f52$export$2e2bcd8739ae039));
|
|
1355
|
+
expression.registerFunction("uuid", (0, $b3c3220fc07098c9$export$2e2bcd8739ae039));
|
|
1356
|
+
expression.registerFunction("getArrayBuffer", (0, $5e0a134878b8be39$export$2e2bcd8739ae039));
|
|
1357
|
+
expression.registerFunction("mostSimilar", (0, $06ecced17a74bf4a$export$2e2bcd8739ae039));
|
|
1358
|
+
expression.registerFunction("sortNodes", (0, $0a764cc1e9fed37c$export$2e2bcd8739ae039));
|
|
1359
|
+
expression.registerFunction("blob", (0, $5e0c34680d37ee90$export$2e2bcd8739ae039));
|
|
1360
|
+
expression.registerFunction("convertHtmlToMarkdown", (0, $59b0e4ac45b59e5b$export$2e2bcd8739ae039));
|
|
1361
|
+
expression.registerFunction("digest", (0, $1cf667e257c1904d$export$2e2bcd8739ae039));
|
|
1362
|
+
expression.registerFunction("sign", (0, $256af523deaf5315$export$2e2bcd8739ae039));
|
|
1363
|
+
expression.registerFunction("xmlToJs", (0, $d08a44d57b1bb13e$export$2e2bcd8739ae039));
|
|
1364
|
+
expression.registerFunction("jsToXml", (0, $c7a445cfc49817c1$export$2e2bcd8739ae039));
|
|
1365
|
+
expression.registerFunction("groupBy", function(array, key) {
|
|
1366
|
+
return (0, $dxT2C$lodashes.groupBy)((0, $dxT2C$lodashes.castArray)(array), key);
|
|
1367
|
+
});
|
|
1368
|
+
expression.registerFunction("keyBy", function(array, key) {
|
|
1369
|
+
return (0, $dxT2C$lodashes.keyBy)((0, $dxT2C$lodashes.castArray)(array), key);
|
|
1370
|
+
});
|
|
1371
|
+
expression.registerFunction("pick", function(obj, keys) {
|
|
1372
|
+
return (0, $dxT2C$lodashes.pick)(obj, keys);
|
|
1373
|
+
});
|
|
1374
|
+
expression.registerFunction("omit", function(obj, keys) {
|
|
1375
|
+
return (0, $dxT2C$lodashes.omit)(obj, keys);
|
|
1376
|
+
});
|
|
1377
|
+
expression.registerFunction("compact", function(arr) {
|
|
1378
|
+
return (0, $dxT2C$lodashes.compact)((0, $dxT2C$lodashes.castArray)(arr));
|
|
1379
|
+
});
|
|
1380
|
+
expression.registerFunction("join", function(arr, separator) {
|
|
1381
|
+
return (0, $dxT2C$lodashes.join)((0, $dxT2C$lodashes.castArray)(arr), separator);
|
|
1382
|
+
});
|
|
1383
|
+
expression.registerFunction("orderBy", function(arr, attr, order) {
|
|
1384
|
+
return (0, $dxT2C$lodashes.orderBy)((0, $dxT2C$lodashes.castArray)(arr), attr, order);
|
|
1385
|
+
});
|
|
1386
|
+
expression.registerFunction("find", function(arr, attr) {
|
|
1387
|
+
return (0, $dxT2C$lodashes.find)((0, $dxT2C$lodashes.castArray)(arr), attr);
|
|
1388
|
+
});
|
|
1389
|
+
expression.registerFunction("lofilter", function(arr, attr) {
|
|
1390
|
+
return (0, $dxT2C$lodashes.filter)((0, $dxT2C$lodashes.castArray)(arr), attr);
|
|
1391
|
+
});
|
|
1392
|
+
expression.registerFunction("values", function(obj) {
|
|
1393
|
+
return (0, $dxT2C$lodashes.values)(obj);
|
|
1394
|
+
});
|
|
1395
|
+
expression.registerFunction("wrap", function(value, wrapper, endWrapper) {
|
|
1396
|
+
return (0, $dxT2C$lodashes.join)([
|
|
1397
|
+
wrapper,
|
|
1398
|
+
value,
|
|
1399
|
+
endWrapper || wrapper
|
|
1400
|
+
], "");
|
|
1401
|
+
});
|
|
1402
|
+
return expression;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
function $20dd7fc7127fd575$export$2e2bcd8739ae039(expression) {
|
|
1407
|
+
return (0, $af351c41b7fd6f79$export$2e2bcd8739ae039)((0, ($parcel$interopDefault($dxT2C$jsonata)))(expression));
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
//# sourceMappingURL=main.cjs.map
|