@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/dist/module.js ADDED
@@ -0,0 +1,1402 @@
1
+ import $hgUW1$jsonata from "jsonata";
2
+ import {difference as $hgUW1$difference, groupBy as $hgUW1$groupBy, castArray as $hgUW1$castArray, keyBy as $hgUW1$keyBy, pick as $hgUW1$pick, omit as $hgUW1$omit, compact as $hgUW1$compact, join as $hgUW1$join, orderBy as $hgUW1$orderBy, find as $hgUW1$find, filter as $hgUW1$filter, values as $hgUW1$values, reduce as $hgUW1$reduce, each as $hgUW1$each, get as $hgUW1$get, isEmpty as $hgUW1$isEmpty, concat as $hgUW1$concat, isEqual as $hgUW1$isEqual, flatMap as $hgUW1$flatMap, map as $hgUW1$map, set as $hgUW1$set, isString as $hgUW1$isString, flattenDeep as $hgUW1$flattenDeep, sortBy as $hgUW1$sortBy, repeat as $hgUW1$repeat, flatten as $hgUW1$flatten, reject as $hgUW1$reject, isNil as $hgUW1$isNil} from "lodash-es";
3
+ import {DateTime as $hgUW1$DateTime} from "luxon";
4
+ import {Lexer as $hgUW1$Lexer} from "marked";
5
+ import {diceCoefficient as $hgUW1$diceCoefficient} from "dice-coefficient";
6
+ import {createDocument as $hgUW1$createDocument} from "@mixmark-io/domino";
7
+ import $hgUW1$turndown from "turndown";
8
+ import {gfm as $hgUW1$gfm} from "turndown-plugin-gfm";
9
+ import {webcrypto as $hgUW1$webcrypto} from "crypto";
10
+ import {xml2js as $hgUW1$xml2js, js2xml as $hgUW1$js2xml} from "xml-js";
11
+ import $hgUW1$json2md from "json2md";
12
+ import $hgUW1$mime from "mime";
13
+ import {encodeBase64 as $hgUW1$encodeBase64, decodeBase64 as $hgUW1$decodeBase64} from "hono/utils/encode";
14
+
15
+ function $parcel$interopDefault(a) {
16
+ return a && a.__esModule ? a.default : a;
17
+ }
18
+
19
+
20
+ const $3f537ea33f4958b3$var$isString = (value)=>typeof value === "string" || value instanceof String;
21
+ const $3f537ea33f4958b3$var$isNumber = (value)=>typeof value === "number";
22
+ const $3f537ea33f4958b3$var$isArray = (value)=>Array.isArray(value);
23
+ const $3f537ea33f4958b3$var$isPlainObject = (value)=>{
24
+ return value !== null && typeof value === "object" && !Array.isArray(value);
25
+ };
26
+ function $3f537ea33f4958b3$var$mapValues(originalValue, mapping, lowerCase = false, defaultValue = null) {
27
+ if ((originalValue === null || originalValue === undefined) && defaultValue !== null) return defaultValue;
28
+ if (mapping === null || mapping === undefined) return originalValue;
29
+ let newMapping = {};
30
+ if (!lowerCase) Object.entries(mapping).forEach(([key, value])=>{
31
+ newMapping[key.toLowerCase()] = value;
32
+ });
33
+ else newMapping = {
34
+ ...mapping
35
+ };
36
+ if ($3f537ea33f4958b3$var$isString(originalValue) || $3f537ea33f4958b3$var$isNumber(originalValue)) {
37
+ const val = newMapping[originalValue.toString().toLowerCase()];
38
+ if (val === null || val === undefined) return originalValue;
39
+ if (val === false) return val;
40
+ return val;
41
+ }
42
+ if ($3f537ea33f4958b3$var$isArray(originalValue)) return originalValue.map((value)=>$3f537ea33f4958b3$var$mapValues(value, newMapping, true));
43
+ if ($3f537ea33f4958b3$var$isPlainObject(originalValue)) {
44
+ const result = {};
45
+ Object.entries(originalValue).forEach(([key, value])=>{
46
+ result[key] = $3f537ea33f4958b3$var$mapValues(value, newMapping, true);
47
+ });
48
+ return result;
49
+ }
50
+ return originalValue;
51
+ }
52
+ var $3f537ea33f4958b3$export$2e2bcd8739ae039 = $3f537ea33f4958b3$var$mapValues;
53
+
54
+
55
+ const $fc14921d7413e598$var$operatorMapping = {
56
+ eq: "=",
57
+ ne: "<>",
58
+ gt: ">",
59
+ gte: ">=",
60
+ lt: "<",
61
+ lte: "<=",
62
+ in: "in",
63
+ nin: "not in",
64
+ like: "like"
65
+ };
66
+ const $fc14921d7413e598$var$convertToDataType = (value, key, dataType, useDoubleQuotes = false, noQuotes = false, noQuotesForDate = false, escapeSingleQuotes = false)=>{
67
+ const dataTypeKey = dataType[key];
68
+ if (value === undefined || value === null) return value;
69
+ if (dataTypeKey === "string") {
70
+ if (noQuotes) return value;
71
+ else if (useDoubleQuotes) return `"${value}"`;
72
+ else if (escapeSingleQuotes) return `'${value.replace(/'/g, "\\'")}'`;
73
+ else return `'${value}'`;
74
+ }
75
+ if (dataTypeKey === "dotnetdate") return `DateTime(${(0, $hgUW1$DateTime).fromISO(value).toFormat("yyyy,MM,dd")})`;
76
+ if (typeof dataTypeKey === "object") {
77
+ const val = (0, $3f537ea33f4958b3$export$2e2bcd8739ae039)(value, dataType[key]);
78
+ if (typeof val === "string" || val instanceof String) return noQuotes ? val : useDoubleQuotes ? `"${val}"` : `'${val}'`;
79
+ return val;
80
+ }
81
+ if (dataTypeKey && dataTypeKey.startsWith("date")) {
82
+ const format = dataTypeKey.split("|")[1];
83
+ const date = format ? (0, $hgUW1$DateTime).fromISO(value).toFormat(format) : (0, $hgUW1$DateTime).fromISO(value).toISO();
84
+ return noQuotes || noQuotesForDate ? date : useDoubleQuotes ? `"${date}"` : `'${date}'`;
85
+ }
86
+ return value;
87
+ };
88
+ function $fc14921d7413e598$var$getSqlString({ key: key , operator: operator , value: value , useSpace: useSpace = false }) {
89
+ const space = useSpace ? " " : "";
90
+ return `${key}${space}${operator}${space}${value}`;
91
+ }
92
+ function $fc14921d7413e598$var$convertQueryToSql(query, keysToMap = [], mapping = {}, dataTypes = {}, customOperatorMapping = {}, options = {}) {
93
+ const conjunction = options.conjunction || "AND";
94
+ const statement = [];
95
+ const keys = !keysToMap.length ? Object.keys(query) : keysToMap;
96
+ for (const key of keys){
97
+ if (key === "or") {
98
+ const orPart = $fc14921d7413e598$var$convertQueryToSql(query[key], keys, mapping, dataTypes, customOperatorMapping, options);
99
+ statement.push("(" + orPart + ")");
100
+ continue;
101
+ }
102
+ const comparison = query[key];
103
+ let operators = [
104
+ "eq"
105
+ ];
106
+ if (Array.isArray(comparison)) operators = [
107
+ "in"
108
+ ];
109
+ else if (typeof comparison === "object") operators = Object.keys(comparison);
110
+ const sqlKey = mapping[key] || key;
111
+ for (const operator of operators){
112
+ const comparator = customOperatorMapping[operator] || $fc14921d7413e598$var$operatorMapping[operator];
113
+ if (operator !== "in" && operator !== "nin" && comparator) {
114
+ const value = typeof comparison === "object" ? comparison[operator] : comparison;
115
+ const valueToInsert = $fc14921d7413e598$var$convertToDataType(value, key, dataTypes, options.useDoubleQuotes, options.noQuotes, options.noQuotesForDate, options.escapeSingleQuotes);
116
+ if (valueToInsert !== undefined && valueToInsert !== null) statement.push($fc14921d7413e598$var$getSqlString({
117
+ key: sqlKey,
118
+ operator: comparator,
119
+ value: valueToInsert,
120
+ useSpace: !options.noSpaceBetweenOperator
121
+ }));
122
+ continue;
123
+ }
124
+ if (operator === "in" || operator === "nin") {
125
+ const value = Array.isArray(comparison) ? comparison : comparison[operator];
126
+ if (options.useOrForIn) {
127
+ const orStatement = [];
128
+ const eqOperator = customOperatorMapping["eq"] || $fc14921d7413e598$var$operatorMapping["eq"];
129
+ for (const v of value){
130
+ const valueToInsert = $fc14921d7413e598$var$convertToDataType(v, key, dataTypes, options.useDoubleQuotes, options.noQuotes, options.noQuotesForDate, options.escapeSingleQuotes);
131
+ if (valueToInsert !== undefined && valueToInsert !== null) orStatement.push($fc14921d7413e598$var$getSqlString({
132
+ key: sqlKey,
133
+ operator: eqOperator,
134
+ value: valueToInsert,
135
+ useSpace: !options.noSpaceBetweenOperator
136
+ }));
137
+ }
138
+ statement.push("(" + orStatement.join(" OR ") + ")");
139
+ continue;
140
+ }
141
+ statement.push($fc14921d7413e598$var$getSqlString({
142
+ key: sqlKey,
143
+ operator: comparator,
144
+ value: `(${value.map((v)=>{
145
+ return $fc14921d7413e598$var$convertToDataType(v, key, dataTypes, options.useDoubleQuotes, options.noQuotes, options.noQuotesForDate, options.escapeSingleQuotes);
146
+ }).join(",")})`,
147
+ useSpace: !options.noSpaceBetweenOperator
148
+ }));
149
+ continue;
150
+ }
151
+ throw new Error(`Unknown operator: ${operator}`);
152
+ }
153
+ }
154
+ if (options.groupComparisonInBrackets && statement.length) return statement.reduce((acc, condition)=>`(${acc} ${conjunction} ${condition})`);
155
+ return statement.join(` ${conjunction} `);
156
+ }
157
+ var $fc14921d7413e598$export$2e2bcd8739ae039 = $fc14921d7413e598$var$convertQueryToSql;
158
+
159
+
160
+
161
+
162
+
163
+
164
+ const $8f5fb75395ee9099$var$insertBetween = (arr, value)=>{
165
+ return (0, $hgUW1$flatMap)(arr, (item, index)=>{
166
+ return index === arr.length - 1 ? [
167
+ item
168
+ ] : [
169
+ item,
170
+ ...(0, $hgUW1$castArray)(value)
171
+ ];
172
+ });
173
+ };
174
+ var $8f5fb75395ee9099$export$2e2bcd8739ae039 = $8f5fb75395ee9099$var$insertBetween;
175
+
176
+
177
+ function $e8d3ca61f6a67481$var$decodeHtmlEntities(encodedString) {
178
+ const htmlEntities = {
179
+ "&amp;": "&",
180
+ "&lt;": "<",
181
+ "&gt;": ">",
182
+ "&quot;": '"',
183
+ "&#39;": "'",
184
+ "&#x2F;": "/",
185
+ "&#x5C;": "\\",
186
+ "&#x60;": "`",
187
+ "&#x3D;": "="
188
+ };
189
+ return encodedString.replace(/&amp;|&lt;|&gt;|&quot;|&#39;|&#x2F;|&#x5C;|&#x60;|&#x3D;/g, (match)=>htmlEntities[match]);
190
+ }
191
+ var $e8d3ca61f6a67481$export$2e2bcd8739ae039 = $e8d3ca61f6a67481$var$decodeHtmlEntities;
192
+
193
+
194
+ const $1856284278f92c61$var$parseMarkedTokenToGoogleDocsRequest = (tokens, acc = {
195
+ counter: 1,
196
+ offset: 0,
197
+ inserts: [],
198
+ formats: []
199
+ }, context = {
200
+ level: 0
201
+ })=>{
202
+ return (0, $hgUW1$reduce)(tokens, (acc, token)=>{
203
+ if (token.type === "hr") {
204
+ acc.inserts.push({
205
+ insertText: {
206
+ text: "\n\n",
207
+ location: {
208
+ index: acc.counter
209
+ }
210
+ }
211
+ });
212
+ acc.counter += 2;
213
+ return acc;
214
+ }
215
+ if (token.type === "space") {
216
+ const textToAdd = token.raw || "\n";
217
+ acc.inserts.push({
218
+ insertText: {
219
+ text: textToAdd,
220
+ location: {
221
+ index: acc.counter
222
+ }
223
+ }
224
+ });
225
+ acc.counter += textToAdd.length;
226
+ return acc;
227
+ }
228
+ if (token.type === "image") {
229
+ acc.inserts.push({
230
+ insertInlineImage: {
231
+ uri: token.href,
232
+ location: {
233
+ index: acc.counter
234
+ }
235
+ }
236
+ });
237
+ acc.counter += 1;
238
+ return acc;
239
+ }
240
+ if (token.type === "table") {
241
+ acc.inserts.push({
242
+ insertTable: {
243
+ columns: token.header.length,
244
+ rows: token.rows.length + 1,
245
+ location: {
246
+ index: acc.counter
247
+ }
248
+ }
249
+ });
250
+ acc.counter += 4;
251
+ (0, $hgUW1$each)([
252
+ token.header,
253
+ ...token.rows
254
+ ], (rowItems, index, arr)=>{
255
+ (0, $hgUW1$each)(rowItems, (item)=>{
256
+ $1856284278f92c61$var$parseMarkedTokenToGoogleDocsRequest([
257
+ item
258
+ ], acc, context);
259
+ acc.counter += 2;
260
+ });
261
+ if (index === arr.length - 1) return;
262
+ acc.counter += 1;
263
+ });
264
+ acc.inserts.push({
265
+ insertText: {
266
+ text: "\n",
267
+ location: {
268
+ index: acc.counter
269
+ }
270
+ }
271
+ });
272
+ acc.counter += 1;
273
+ return acc;
274
+ }
275
+ const childTokens = (0, $hgUW1$get)(token, "tokens");
276
+ if (!(0, $hgUW1$isEmpty)(childTokens)) {
277
+ const start = acc.counter;
278
+ if (token.type === "list_item") {
279
+ if (context.level > 1) {
280
+ acc.inserts.push({
281
+ insertText: {
282
+ text: " ".repeat(context.level - 1),
283
+ location: {
284
+ index: acc.counter
285
+ }
286
+ }
287
+ });
288
+ acc.offset += context.level - 1;
289
+ acc.counter += context.level - 1;
290
+ }
291
+ $1856284278f92c61$var$parseMarkedTokenToGoogleDocsRequest((0, $8f5fb75395ee9099$export$2e2bcd8739ae039)(childTokens, [
292
+ {
293
+ type: "space",
294
+ raw: "\n"
295
+ }
296
+ ]), acc, context);
297
+ } else $1856284278f92c61$var$parseMarkedTokenToGoogleDocsRequest(childTokens, acc, context);
298
+ const end = acc.counter;
299
+ if (token.type === "heading") {
300
+ acc.formats.push({
301
+ updateParagraphStyle: {
302
+ paragraphStyle: {
303
+ namedStyleType: `HEADING_${token.depth}`
304
+ },
305
+ fields: "*",
306
+ range: {
307
+ startIndex: start - acc.offset,
308
+ endIndex: end - acc.offset
309
+ }
310
+ }
311
+ });
312
+ acc.inserts.push({
313
+ insertText: {
314
+ text: "\n",
315
+ location: {
316
+ index: acc.counter
317
+ }
318
+ }
319
+ });
320
+ acc.counter += 1;
321
+ }
322
+ if (token.type === "em") acc.formats.push({
323
+ updateTextStyle: {
324
+ textStyle: {
325
+ italic: true
326
+ },
327
+ fields: "*",
328
+ range: {
329
+ startIndex: start - acc.offset,
330
+ endIndex: end - acc.offset
331
+ }
332
+ }
333
+ });
334
+ if (token.type === "strong") acc.formats.push({
335
+ updateTextStyle: {
336
+ textStyle: {
337
+ bold: true
338
+ },
339
+ fields: "*",
340
+ range: {
341
+ startIndex: start - acc.offset,
342
+ endIndex: end - acc.offset
343
+ }
344
+ }
345
+ });
346
+ if (token.type === "link") acc.formats.push({
347
+ updateTextStyle: {
348
+ textStyle: {
349
+ link: {
350
+ url: token.href
351
+ },
352
+ underline: true,
353
+ foregroundColor: {
354
+ color: {
355
+ rgbColor: {
356
+ red: 0.1,
357
+ green: 0.33,
358
+ blue: 0.8
359
+ }
360
+ }
361
+ }
362
+ },
363
+ fields: "*",
364
+ range: {
365
+ startIndex: start - acc.offset,
366
+ endIndex: end - acc.offset
367
+ }
368
+ }
369
+ });
370
+ return acc;
371
+ }
372
+ const childItems = (0, $hgUW1$get)(token, "items");
373
+ if (!(0, $hgUW1$isEmpty)(childItems)) {
374
+ const start = acc.counter;
375
+ $1856284278f92c61$var$parseMarkedTokenToGoogleDocsRequest((0, $8f5fb75395ee9099$export$2e2bcd8739ae039)(childItems, [
376
+ {
377
+ type: "space",
378
+ raw: "\n"
379
+ }
380
+ ]), acc, {
381
+ level: context.level + 1
382
+ });
383
+ const end = acc.counter;
384
+ if (!context.level && token.type === "list") acc.formats = (0, $hgUW1$concat)({
385
+ createParagraphBullets: {
386
+ range: {
387
+ startIndex: start,
388
+ endIndex: end
389
+ },
390
+ bulletPreset: token.ordered ? "NUMBERED_DECIMAL_ALPHA_ROMAN" : "BULLET_DISC_CIRCLE_SQUARE"
391
+ }
392
+ }, acc.formats);
393
+ return acc;
394
+ }
395
+ const text = (0, $hgUW1$get)(token, "text");
396
+ if (!text) return acc;
397
+ const textToInsert = (0, $e8d3ca61f6a67481$export$2e2bcd8739ae039)(text);
398
+ acc.inserts.push({
399
+ insertText: {
400
+ text: textToInsert,
401
+ location: {
402
+ index: acc.counter
403
+ }
404
+ }
405
+ });
406
+ acc.counter += textToInsert.length;
407
+ return acc;
408
+ }, acc);
409
+ };
410
+ const $1856284278f92c61$var$convertMarkdownToGoogleDocs = (text, currentCounter = 1)=>{
411
+ const tokens = (0, $hgUW1$Lexer).lex(text);
412
+ const parsedTokens = $1856284278f92c61$var$parseMarkedTokenToGoogleDocsRequest(tokens, {
413
+ counter: currentCounter,
414
+ formats: [],
415
+ inserts: [],
416
+ offset: 0
417
+ });
418
+ const formats = parsedTokens.formats;
419
+ const mergedFormats = (0, $hgUW1$reduce)(formats, (acc, format)=>{
420
+ const range = (0, $hgUW1$get)(format, "updateTextStyle.range");
421
+ if (!range) acc.push(format);
422
+ else {
423
+ const existingFormat = (0, $hgUW1$find)(acc, (f)=>{
424
+ const r = (0, $hgUW1$get)(f, "updateTextStyle.range");
425
+ return (0, $hgUW1$isEqual)(r, range);
426
+ });
427
+ if (existingFormat) existingFormat.updateTextStyle.textStyle = {
428
+ ...existingFormat.updateTextStyle.textStyle,
429
+ ...format.updateTextStyle.textStyle
430
+ };
431
+ else acc.push(format);
432
+ }
433
+ return acc;
434
+ }, []);
435
+ return {
436
+ requests: [
437
+ ...parsedTokens.inserts,
438
+ ...mergedFormats
439
+ ]
440
+ };
441
+ };
442
+ var $1856284278f92c61$export$2e2bcd8739ae039 = $1856284278f92c61$var$convertMarkdownToGoogleDocs;
443
+
444
+
445
+
446
+
447
+
448
+ const $d584c575eabd606d$var$parseMarkedTokenToNotionRequest = (tokens, acc = [])=>{
449
+ return (0, $hgUW1$reduce)(tokens, (acc, token)=>{
450
+ const childTokens = token.type === "blockquote" ? (0, $hgUW1$get)(token, "tokens[0].tokens") : (0, $hgUW1$get)(token, "tokens");
451
+ let childData = [];
452
+ if (childTokens) childData = $d584c575eabd606d$var$parseMarkedTokenToNotionRequest(childTokens);
453
+ if (token.type === "hr") {
454
+ acc.push({
455
+ type: "divider",
456
+ divider: {}
457
+ });
458
+ return acc;
459
+ }
460
+ if (token.type === "space") {
461
+ acc.push({
462
+ type: "paragraph",
463
+ paragraph: {
464
+ rich_text: [
465
+ {
466
+ type: "text",
467
+ text: {
468
+ content: "\n"
469
+ }
470
+ }
471
+ ]
472
+ }
473
+ });
474
+ return acc;
475
+ }
476
+ if (token.type === "image") {
477
+ acc.push({
478
+ type: "image",
479
+ image: {
480
+ type: "external",
481
+ external: {
482
+ url: token.href
483
+ }
484
+ }
485
+ });
486
+ return acc;
487
+ }
488
+ if (token.type === "paragraph") {
489
+ const groupedChildData = (0, $hgUW1$groupBy)(childData, (x)=>x.type === "image" ? "image" : "other");
490
+ if (!(0, $hgUW1$isEmpty)(groupedChildData.other)) acc.push({
491
+ type: "paragraph",
492
+ paragraph: {
493
+ rich_text: groupedChildData.other
494
+ }
495
+ });
496
+ if (!(0, $hgUW1$isEmpty)(groupedChildData.image)) acc = (0, $hgUW1$concat)(acc, groupedChildData.image);
497
+ return acc;
498
+ }
499
+ if (token.type === "heading") {
500
+ acc.push({
501
+ type: `heading_${token.depth}`,
502
+ [`heading_${token.depth}`]: {
503
+ rich_text: childData
504
+ }
505
+ });
506
+ return acc;
507
+ }
508
+ if (token.type === "code") {
509
+ acc.push({
510
+ type: "code",
511
+ code: {
512
+ rich_text: [
513
+ {
514
+ type: "text",
515
+ text: {
516
+ content: token.text
517
+ }
518
+ }
519
+ ],
520
+ language: token.lang || "plain text"
521
+ }
522
+ });
523
+ return acc;
524
+ }
525
+ if (token.type === "table") {
526
+ const table = {
527
+ type: "table",
528
+ table: {
529
+ table_width: token.header.length,
530
+ has_column_header: true,
531
+ has_row_header: false,
532
+ children: []
533
+ }
534
+ };
535
+ const headerChildren = $d584c575eabd606d$var$parseMarkedTokenToNotionRequest(token.header);
536
+ table.table.children.push({
537
+ type: "table_row",
538
+ table_row: {
539
+ cells: headerChildren.map((x)=>[
540
+ x
541
+ ])
542
+ }
543
+ });
544
+ (0, $hgUW1$each)(token.rows, (row)=>{
545
+ const rowChildren = (0, $hgUW1$map)(row, (rowCell)=>$d584c575eabd606d$var$parseMarkedTokenToNotionRequest([
546
+ rowCell
547
+ ]));
548
+ table.table.children.push({
549
+ type: "table_row",
550
+ table_row: {
551
+ cells: rowChildren.map((x)=>x)
552
+ }
553
+ });
554
+ });
555
+ acc.push(table);
556
+ return acc;
557
+ }
558
+ if (token.type === "list") {
559
+ const listType = token.items[0].task ? "to_do" : token.ordered ? "numbered_list_item" : "bulleted_list_item";
560
+ (0, $hgUW1$each)(token.items, (item)=>{
561
+ const itemChildren = $d584c575eabd606d$var$parseMarkedTokenToNotionRequest(item.tokens);
562
+ const groupedItemChildren = (0, $hgUW1$groupBy)(itemChildren, (x)=>x.type === "text" ? "other" : "list");
563
+ acc.push({
564
+ type: listType,
565
+ [listType]: {
566
+ rich_text: groupedItemChildren.other,
567
+ children: groupedItemChildren.list,
568
+ ...listType === "to_do" ? {
569
+ checked: item.checked
570
+ } : {}
571
+ }
572
+ });
573
+ });
574
+ }
575
+ if (token.type === "em") {
576
+ (0, $hgUW1$each)(childData, (child)=>{
577
+ (0, $hgUW1$set)(child, [
578
+ "annotations",
579
+ "italic"
580
+ ], true);
581
+ });
582
+ acc = (0, $hgUW1$concat)(acc, childData);
583
+ return acc;
584
+ }
585
+ if (token.type === "strong") {
586
+ (0, $hgUW1$each)(childData, (child)=>{
587
+ (0, $hgUW1$set)(child, [
588
+ "annotations",
589
+ "bold"
590
+ ], true);
591
+ });
592
+ acc = (0, $hgUW1$concat)(acc, childData);
593
+ return acc;
594
+ }
595
+ if (token.type === "link") {
596
+ (0, $hgUW1$each)(childData, (child)=>{
597
+ if (child.text) (0, $hgUW1$set)(child, [
598
+ "text",
599
+ "link",
600
+ "url"
601
+ ], token.href);
602
+ });
603
+ acc = (0, $hgUW1$concat)(acc, childData);
604
+ return acc;
605
+ }
606
+ if (token.type === "blockquote") {
607
+ acc.push({
608
+ type: "callout",
609
+ callout: {
610
+ rich_text: childData
611
+ }
612
+ });
613
+ return acc;
614
+ }
615
+ if (!(0, $hgUW1$isEmpty)(childData)) {
616
+ acc = (0, $hgUW1$concat)(acc, childData);
617
+ return acc;
618
+ }
619
+ const text = (0, $hgUW1$get)(token, "text");
620
+ if (!text) return acc;
621
+ const textToInsert = (0, $e8d3ca61f6a67481$export$2e2bcd8739ae039)(text);
622
+ acc.push({
623
+ type: "text",
624
+ text: {
625
+ content: textToInsert
626
+ },
627
+ ...token.type === "codespan" ? {
628
+ annotations: {
629
+ code: true
630
+ }
631
+ } : {}
632
+ });
633
+ return acc;
634
+ }, acc);
635
+ };
636
+ const $d584c575eabd606d$var$convertMarkdownToNotion = (text)=>{
637
+ const tokens = (0, $hgUW1$Lexer).lex(text);
638
+ const parsedTokens = $d584c575eabd606d$var$parseMarkedTokenToNotionRequest(tokens);
639
+ return {
640
+ children: parsedTokens
641
+ };
642
+ };
643
+ var $d584c575eabd606d$export$2e2bcd8739ae039 = $d584c575eabd606d$var$convertMarkdownToNotion;
644
+
645
+
646
+
647
+
648
+ const $0367d1505684d547$var$parseMarkedTokenToSlackRequest = (tokens, acc = [])=>{
649
+ return (0, $hgUW1$reduce)(tokens, (acc, token)=>{
650
+ if (token.type === "hr") {
651
+ acc.push({
652
+ type: "divider"
653
+ });
654
+ return acc;
655
+ }
656
+ if (token.type === "space") {
657
+ acc.push({
658
+ type: "section",
659
+ text: {
660
+ type: "mrkdwn",
661
+ text: "\n"
662
+ }
663
+ });
664
+ return acc;
665
+ }
666
+ if (token.type === "image") {
667
+ acc.push({
668
+ type: "image",
669
+ image_url: token.href,
670
+ alt_text: token.text
671
+ });
672
+ return acc;
673
+ }
674
+ if (token.type === "paragraph" || token.type === "text") {
675
+ const childTokens = (0, $hgUW1$get)(token, "tokens");
676
+ let childData = [];
677
+ if (childTokens) childData = $0367d1505684d547$var$parseMarkedTokenToSlackRequest(childTokens);
678
+ else {
679
+ acc.push(token.raw);
680
+ return acc;
681
+ }
682
+ const childDataGroupedByType = (0, $hgUW1$groupBy)(childData, (x)=>(0, $hgUW1$isString)(x) ? "text" : "block");
683
+ if (!(0, $hgUW1$isEmpty)(childDataGroupedByType.text)) acc.push({
684
+ type: "section",
685
+ text: {
686
+ type: "mrkdwn",
687
+ text: (0, $hgUW1$join)(childDataGroupedByType.text, "")
688
+ }
689
+ });
690
+ if (!(0, $hgUW1$isEmpty)(childDataGroupedByType.block)) acc = (0, $hgUW1$concat)(acc, childDataGroupedByType.block);
691
+ return acc;
692
+ }
693
+ if (token.type === "heading") {
694
+ acc.push({
695
+ type: "header",
696
+ text: {
697
+ type: "plain_text",
698
+ text: token.text,
699
+ emoji: true
700
+ }
701
+ });
702
+ return acc;
703
+ }
704
+ if (token.type === "list") {
705
+ const items = (0, $hgUW1$map)(token.items, (item)=>{
706
+ const childTokens = (0, $hgUW1$get)(item, "tokens");
707
+ let childData = [];
708
+ if (childTokens) childData = $0367d1505684d547$var$parseMarkedTokenToSlackRequest(childTokens);
709
+ return childData;
710
+ });
711
+ const listString = (0, $hgUW1$join)((0, $hgUW1$filter)((0, $hgUW1$flattenDeep)(items), (x)=>!!(0, $hgUW1$get)(x, "text.text")).map((x, index)=>`${token.ordered ? `${index + 1}.` : "•"} ${(0, $hgUW1$get)(x, "text.text")}`), "\n");
712
+ acc.push({
713
+ type: "section",
714
+ text: {
715
+ type: "mrkdwn",
716
+ text: listString
717
+ }
718
+ });
719
+ return acc;
720
+ }
721
+ if (token.type === "strong") {
722
+ acc.push(`*${token.text}*`);
723
+ return acc;
724
+ }
725
+ if (token.type === "link") {
726
+ acc.push(`<${token.href}|${token.text}>`);
727
+ return acc;
728
+ }
729
+ if (token.type === "blockquote") {
730
+ acc.push({
731
+ type: "section",
732
+ text: {
733
+ type: "mrkdwn",
734
+ text: token.raw
735
+ }
736
+ });
737
+ return acc;
738
+ }
739
+ if (token.type === "code") {
740
+ acc.push({
741
+ type: "section",
742
+ text: {
743
+ type: "mrkdwn",
744
+ text: token.raw
745
+ }
746
+ });
747
+ return acc;
748
+ }
749
+ acc.push(token.raw);
750
+ return acc;
751
+ }, acc);
752
+ };
753
+ const $0367d1505684d547$var$convertMarkdownToSlack = (text)=>{
754
+ const tokens = (0, $hgUW1$Lexer).lex(text);
755
+ const parsedTokens = $0367d1505684d547$var$parseMarkedTokenToSlackRequest(tokens);
756
+ return (0, $hgUW1$filter)(parsedTokens, (x)=>!(0, $hgUW1$isString)(x));
757
+ };
758
+ var $0367d1505684d547$export$2e2bcd8739ae039 = $0367d1505684d547$var$convertMarkdownToSlack;
759
+
760
+
761
+
762
+
763
+ function $d107fdfa34579e76$var$getNormalizedString(value) {
764
+ return value.toLowerCase().replace(/[^a-z0-9]/g, "");
765
+ }
766
+ function $d107fdfa34579e76$var$mostSimilar(value, possibleValues, threshold = 0.8) {
767
+ const normalizedValue = $d107fdfa34579e76$var$getNormalizedString(value);
768
+ const result = (0, $hgUW1$reduce)(possibleValues, (acc, possibleValue)=>{
769
+ const normalizedPossibleValue = $d107fdfa34579e76$var$getNormalizedString(possibleValue);
770
+ const similarity = (0, $hgUW1$diceCoefficient)(normalizedValue, normalizedPossibleValue);
771
+ if (similarity > acc.similarity) return {
772
+ similarity: similarity,
773
+ value: possibleValue
774
+ };
775
+ return acc;
776
+ }, {
777
+ similarity: 0,
778
+ value: ""
779
+ });
780
+ return result.similarity >= threshold ? result.value : value;
781
+ }
782
+ var $d107fdfa34579e76$export$2e2bcd8739ae039 = $d107fdfa34579e76$var$mostSimilar;
783
+
784
+
785
+
786
+ function $5c5e048cce648ad9$export$96d07f33920abf3e(array, idKey = "id", parentIdKey = "parent_id", sequenceKey = "sequence") {
787
+ // Step 1: Create a Map for quick lookup of nodes by their id
788
+ const nodeMap = new Map();
789
+ // Populate the map
790
+ array.forEach((node)=>{
791
+ nodeMap.set((0, $hgUW1$get)(node, idKey), {
792
+ ...node,
793
+ children: []
794
+ });
795
+ });
796
+ // Step 2: Create an array to hold the root nodes
797
+ const rootNodes = [];
798
+ // Step 3: Organize the nodes into a tree structure
799
+ array.forEach((node)=>{
800
+ const parentId = (0, $hgUW1$get)(node, parentIdKey);
801
+ const nodeId = (0, $hgUW1$get)(node, idKey);
802
+ if (parentId && nodeMap.has(parentId)) // If the parent exists, add the current node as a child
803
+ nodeMap.get(parentId)?.children?.push(nodeMap.get(nodeId));
804
+ else // Treat it as a root node if the parent doesn't exist or it's null
805
+ rootNodes.push(nodeMap.get(nodeId));
806
+ });
807
+ // Step 4: Recursive function to sort nodes and their children
808
+ function sortTree(nodes) {
809
+ // Sort nodes using lodash by sequence
810
+ const sortedNodes = (0, $hgUW1$sortBy)(nodes, sequenceKey);
811
+ sortedNodes.forEach((node)=>{
812
+ if (node.children && node.children.length > 0) node.children = sortTree(node.children);
813
+ });
814
+ return sortedNodes;
815
+ }
816
+ // Step 5: Sort the root nodes and recursively sort their children
817
+ const sortedTree = sortTree(rootNodes);
818
+ // Step 6: Flatten the sorted tree into an array (keeping the parent-child structure)
819
+ function flattenTree(nodes) {
820
+ return nodes.reduce((acc, node)=>{
821
+ acc.push((0, $hgUW1$omit)(node, "children")) // Push the current node without 'children'
822
+ ;
823
+ if (node.children && node.children.length > 0) acc.push(...flattenTree(node.children)) // Recursively flatten children
824
+ ;
825
+ return acc;
826
+ }, []);
827
+ }
828
+ return flattenTree(sortedTree);
829
+ }
830
+ var $5c5e048cce648ad9$export$2e2bcd8739ae039 = $5c5e048cce648ad9$export$96d07f33920abf3e;
831
+
832
+
833
+ // @ts-ignore
834
+
835
+
836
+
837
+ const $466433da5b17336d$var$convertHtmlToMarkdown = (html)=>{
838
+ const htmlDoc = (0, $hgUW1$createDocument)(html);
839
+ const turndownService = new (0, $hgUW1$turndown)();
840
+ turndownService.use((0, $hgUW1$gfm));
841
+ return turndownService.turndown(htmlDoc);
842
+ };
843
+ var $466433da5b17336d$export$2e2bcd8739ae039 = $466433da5b17336d$var$convertHtmlToMarkdown;
844
+
845
+
846
+ function $6910bb94876d8cd6$export$2e2bcd8739ae039(buffer, urlSafe = false) {
847
+ let binary = "";
848
+ const bytes = new Uint8Array(buffer);
849
+ const len = bytes.byteLength;
850
+ for(let i = 0; i < len; i++)binary += String.fromCharCode(bytes[i]);
851
+ if (urlSafe) return btoa(binary).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
852
+ return btoa(binary);
853
+ }
854
+
855
+
856
+
857
+ const $07f7ad31d6a8cbdd$var$digest = async (text, algorithm = "SHA-256", stringType = "hex")=>{
858
+ const encoder = new TextEncoder();
859
+ const data = encoder.encode(text);
860
+ const hashBuffer = await (0, $hgUW1$webcrypto).subtle.digest(algorithm, data);
861
+ if (stringType === "hex") {
862
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
863
+ return hashArray.map((b)=>b.toString(16).padStart(2, "0")).join("");
864
+ } else if (stringType === "base64") return (0, $6910bb94876d8cd6$export$2e2bcd8739ae039)(hashBuffer);
865
+ else if (stringType === "base64-urlSafe") return (0, $6910bb94876d8cd6$export$2e2bcd8739ae039)(hashBuffer, true);
866
+ };
867
+ var $07f7ad31d6a8cbdd$export$2e2bcd8739ae039 = $07f7ad31d6a8cbdd$var$digest;
868
+
869
+
870
+
871
+ const $1d16c841f49064ff$var$formatPlainText = (x)=>{
872
+ if (x) {
873
+ if (x.href) return `[${x.plain_text}](${x.href.startsWith("/") ? `https://www.notion.so${x.href}` : x.href})`;
874
+ const isBold = x.annotations?.bold;
875
+ const isItalic = x.annotations?.italic;
876
+ const isStrikethrough = x.annotations?.strikethrough;
877
+ const isUnderline = x.annotations?.underline;
878
+ const isCode = x.annotations?.code;
879
+ let textToReturn = x.plain_text;
880
+ if (isCode) textToReturn = `\`${textToReturn}\``;
881
+ if (isBold) textToReturn = `**${textToReturn}**`;
882
+ if (isItalic) textToReturn = `_${textToReturn}_`;
883
+ if (isUnderline) textToReturn = `_${textToReturn}_`;
884
+ if (isStrikethrough) textToReturn = `~~${textToReturn}~~`;
885
+ return textToReturn;
886
+ }
887
+ };
888
+ const $1d16c841f49064ff$var$convertNotionToMd = function(block, level = 1) {
889
+ const n = "\n\n";
890
+ const data = block[block.type];
891
+ const plainText = data.rich_text ? data.rich_text.map($1d16c841f49064ff$var$formatPlainText) : [];
892
+ // @ts-ignore
893
+ const caption = data.caption ? data.caption.map((x)=>x?.plain_text) : [];
894
+ let childData = "";
895
+ switch(block.type){
896
+ case "bookmark":
897
+ return `[${data.url}](data.url)${n}`;
898
+ case "bulleted_list_item":
899
+ childData = (0, $hgUW1$map)(block.children, (child)=>$1d16c841f49064ff$var$convertNotionToMd(child, level + 1)).join((0, $hgUW1$repeat)(" ", level));
900
+ return `- ${plainText.join("")}\n` + (childData ? `${(0, $hgUW1$repeat)(" ", level)}${childData}` : "");
901
+ case "numbered_list_item":
902
+ childData = (0, $hgUW1$map)(block.children, (child)=>$1d16c841f49064ff$var$convertNotionToMd(child, level + 1)).join((0, $hgUW1$repeat)(" ", level));
903
+ return `${block.number}. ${plainText.join("")}\n` + (childData ? `${(0, $hgUW1$repeat)(" ", level)}${childData}` : "");
904
+ case "quote":
905
+ case "callout":
906
+ return `> ${plainText.join("")}${n}`;
907
+ case "code":
908
+ return `\`\`\`${data.language}\n${plainText}\n\`\`\`${n}`;
909
+ case "divider":
910
+ return `---${n}`;
911
+ case "embed":
912
+ return `[${caption.length ? caption : "Embed"}](${data.url})${n}`;
913
+ case "equation":
914
+ return data.expression;
915
+ case "paragraph":
916
+ return plainText.join("") + n;
917
+ case "video":
918
+ case "pdf":
919
+ case "file":
920
+ return `[${caption.length ? caption : "File"}](${data.file ? data.file.url : data.external ? data.external.url : ""})${n}`;
921
+ case "heading_1":
922
+ return `# ${plainText.join("")}${n}`;
923
+ case "heading_2":
924
+ return `## ${plainText.join("")}${n}`;
925
+ case "heading_3":
926
+ return `### ${plainText.join("")}${n}`;
927
+ case "heading_4":
928
+ return `#### ${plainText.join("")}${n}`;
929
+ case "heading_5":
930
+ return `##### ${plainText.join("")}${n}`;
931
+ case "heading_6":
932
+ return `###### ${plainText.join("")}${n}`;
933
+ case "image":
934
+ return `![${caption.length ? caption : "Image"}](${data.file ? data.file.url : data.external ? data.external.url : ""})${n}`;
935
+ case "table":
936
+ if (block.children) {
937
+ const firstChild = block.children[0];
938
+ const remainingChildren = block.children.slice(1);
939
+ const header = `| ${firstChild.table_row.cells.map((x)=>x.map((y)=>$1d16c841f49064ff$var$formatPlainText(y)).join("")).join(" | ")} |\n`;
940
+ const divider = `|${(0, $hgUW1$repeat)("---|", data.table_width)}\n`;
941
+ const rows = remainingChildren.map((row)=>{
942
+ return `| ${row.table_row.cells.map((x)=>x.map((y)=>$1d16c841f49064ff$var$formatPlainText(y)).join("")).join(" | ")} |`;
943
+ }).join("\n");
944
+ return `${header}${divider}${rows}${n}`;
945
+ }
946
+ return `Table as CSV\n`;
947
+ case "table_row":
948
+ return `| ${data.cells.map((x)=>x.map((y)=>$1d16c841f49064ff$var$formatPlainText(y)).join("")).join(" | ")} |\n`;
949
+ case "to_do":
950
+ childData = (0, $hgUW1$map)(block.children, (child)=>$1d16c841f49064ff$var$convertNotionToMd(child, level + 1)).join((0, $hgUW1$repeat)(" ", level));
951
+ return `- [${data.checked ? "X" : " "}] ${plainText.join("")}\n` + (childData ? `${(0, $hgUW1$repeat)(" ", level)}${childData}` : "");
952
+ default:
953
+ childData = (0, $hgUW1$map)(block.children, (child)=>$1d16c841f49064ff$var$convertNotionToMd(child)).join("");
954
+ return plainText.join("") + n + childData;
955
+ }
956
+ };
957
+ const $1d16c841f49064ff$var$resolveChildren = function(block, blocks) {
958
+ if (!block.has_children) return block;
959
+ const children = blocks.filter((x)=>x.parent_id === block.id);
960
+ return {
961
+ ...block,
962
+ children: children.map((child)=>$1d16c841f49064ff$var$resolveChildren(child, blocks))
963
+ };
964
+ };
965
+ const $1d16c841f49064ff$var$numberOrderedLists = function(blocks) {
966
+ let number = 0;
967
+ return blocks.map((block)=>{
968
+ if (block.type !== "numbered_list_item") {
969
+ number = 0;
970
+ return block;
971
+ } else {
972
+ if (block.children) block.children = $1d16c841f49064ff$var$numberOrderedLists(block.children);
973
+ return {
974
+ ...block,
975
+ number: ++number
976
+ };
977
+ }
978
+ });
979
+ };
980
+ const $1d16c841f49064ff$var$insertNewLinesBetweenLists = function(blocks) {
981
+ const listBlocks = [
982
+ "to_do",
983
+ "numbered_list_item",
984
+ "bulleted_list_item"
985
+ ];
986
+ return (0, $hgUW1$flatten)(blocks.map((block, index)=>{
987
+ const nextBlock = blocks[index + 1];
988
+ const nextBlockType = nextBlock?.type;
989
+ if (listBlocks.includes(block.type) && !listBlocks.includes(nextBlockType)) return [
990
+ block,
991
+ {
992
+ type: "paragraph",
993
+ paragraph: {
994
+ rich_text: [],
995
+ color: "default"
996
+ }
997
+ }
998
+ ];
999
+ return block;
1000
+ }));
1001
+ };
1002
+ const $1d16c841f49064ff$var$convertNotionToMarkdown = function(blocks) {
1003
+ const arrayBlocks = $1d16c841f49064ff$var$insertNewLinesBetweenLists((0, $hgUW1$castArray)(blocks));
1004
+ const parentBlocks = (0, $hgUW1$reject)(arrayBlocks, (block)=>block.parent?.type === "block_id");
1005
+ const blocksWithChildren = $1d16c841f49064ff$var$numberOrderedLists(parentBlocks.map((block)=>{
1006
+ return $1d16c841f49064ff$var$resolveChildren(block, arrayBlocks);
1007
+ }));
1008
+ return blocksWithChildren.map((block)=>$1d16c841f49064ff$var$convertNotionToMd(block)).join("");
1009
+ };
1010
+ var $1d16c841f49064ff$export$2e2bcd8739ae039 = $1d16c841f49064ff$var$convertNotionToMarkdown;
1011
+
1012
+
1013
+
1014
+
1015
+ const $9e0fe82470a4aa3f$var$sign = async (text, algorithm = "SHA-256", secret, outputFormat = "hex")=>{
1016
+ const key = await (0, $hgUW1$webcrypto).subtle.importKey("raw", new TextEncoder().encode(secret), {
1017
+ name: "HMAC",
1018
+ hash: algorithm
1019
+ }, false, [
1020
+ "sign"
1021
+ ]);
1022
+ const encoder = new TextEncoder();
1023
+ const data = encoder.encode(text);
1024
+ const hashBuffer = await (0, $hgUW1$webcrypto).subtle.sign("HMAC", key, data);
1025
+ if (outputFormat === "hex") {
1026
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
1027
+ return hashArray.map((b)=>b.toString(16).padStart(2, "0")).join("");
1028
+ } else if (outputFormat === "base64") return (0, $6910bb94876d8cd6$export$2e2bcd8739ae039)(hashBuffer);
1029
+ else if (outputFormat === "base64-urlSafe") return (0, $6910bb94876d8cd6$export$2e2bcd8739ae039)(hashBuffer, true);
1030
+ };
1031
+ var $9e0fe82470a4aa3f$export$2e2bcd8739ae039 = $9e0fe82470a4aa3f$var$sign;
1032
+
1033
+
1034
+
1035
+ function $482257986df2ffd5$export$2e2bcd8739ae039(xml, options = {
1036
+ compact: true,
1037
+ spaces: 4
1038
+ }) {
1039
+ return (0, $hgUW1$xml2js)(xml, options);
1040
+ }
1041
+
1042
+
1043
+
1044
+ function $9e1852c032fb5537$export$2e2bcd8739ae039(json, options = {
1045
+ compact: true,
1046
+ spaces: 4
1047
+ }) {
1048
+ return (0, $hgUW1$js2xml)(json, options);
1049
+ }
1050
+
1051
+
1052
+
1053
+ function $9e00534fc92334a4$var$dtFromIso(arg) {
1054
+ return (0, $hgUW1$DateTime).fromISO(arg);
1055
+ }
1056
+ var $9e00534fc92334a4$export$2e2bcd8739ae039 = $9e00534fc92334a4$var$dtFromIso;
1057
+
1058
+
1059
+
1060
+ function $3743337fe5a7810d$var$dtFromFormat(date, format) {
1061
+ if (format === "RFC2822") return (0, $hgUW1$DateTime).fromRFC2822(date);
1062
+ if (format === "ISO") return (0, $hgUW1$DateTime).fromISO(date);
1063
+ if (format === "fromSeconds") return (0, $hgUW1$DateTime).fromSeconds(parseInt(date));
1064
+ return (0, $hgUW1$DateTime).fromFormat(date, format);
1065
+ }
1066
+ var $3743337fe5a7810d$export$2e2bcd8739ae039 = $3743337fe5a7810d$var$dtFromFormat;
1067
+
1068
+
1069
+ function $cf3780e9a046523d$var$removeEmpty(arg) {
1070
+ return arg.length ? arg : undefined;
1071
+ }
1072
+ var $cf3780e9a046523d$export$2e2bcd8739ae039 = $cf3780e9a046523d$var$removeEmpty;
1073
+
1074
+
1075
+ function $e02d045b7bd2be36$var$removeEmptyItems(arg) {
1076
+ if (!Array.isArray(arg)) return arg;
1077
+ return arg.filter((item)=>{
1078
+ if (item && typeof item === "object") return Object.keys(item).length > 0;
1079
+ return item;
1080
+ });
1081
+ }
1082
+ var $e02d045b7bd2be36$export$2e2bcd8739ae039 = $e02d045b7bd2be36$var$removeEmptyItems;
1083
+
1084
+
1085
+
1086
+ function $4ade430d0ba3db35$var$convertNotionToMd(block) {
1087
+ const data = block[block.type];
1088
+ const plainText = data.rich_text ? data.rich_text.map((x)=>{
1089
+ if (x) {
1090
+ if (x.href) return `[${x.plain_text}](${x.href.startsWith("/") ? `https://www.notion.so${x.href}` : x.href})`;
1091
+ return x.plain_text;
1092
+ }
1093
+ }) : [];
1094
+ // @ts-ignore
1095
+ const caption = data.caption ? data.caption.map((x)=>x?.plain_text) : [];
1096
+ switch(block.type){
1097
+ case "bookmark":
1098
+ return (0, $hgUW1$json2md)({
1099
+ link: {
1100
+ title: data.url,
1101
+ source: data.url
1102
+ }
1103
+ });
1104
+ case "bulleted_list_item":
1105
+ return `${(0, $hgUW1$json2md)({
1106
+ ul: plainText
1107
+ }).trim()} \n`;
1108
+ case "numbered_list_item":
1109
+ return `${(0, $hgUW1$json2md)({
1110
+ ol: plainText
1111
+ }).trim()} \n`;
1112
+ case "quote":
1113
+ case "callout":
1114
+ return (0, $hgUW1$json2md)({
1115
+ blockquote: plainText
1116
+ });
1117
+ case "code":
1118
+ return (0, $hgUW1$json2md)({
1119
+ code: {
1120
+ language: data.language,
1121
+ content: plainText
1122
+ }
1123
+ });
1124
+ case "divider":
1125
+ return "--- \n";
1126
+ case "embed":
1127
+ return (0, $hgUW1$json2md)({
1128
+ link: {
1129
+ title: caption.length ? caption : "Embed",
1130
+ source: data.url
1131
+ }
1132
+ });
1133
+ case "equation":
1134
+ return (0, $hgUW1$json2md)({
1135
+ p: data.expression
1136
+ });
1137
+ case "paragraph":
1138
+ return (0, $hgUW1$json2md)({
1139
+ p: plainText.join("")
1140
+ });
1141
+ case "video":
1142
+ case "pdf":
1143
+ case "file":
1144
+ return (0, $hgUW1$json2md)({
1145
+ link: {
1146
+ title: caption.length ? caption : "File",
1147
+ source: data.file ? data.file.url : data.external ? data.external.url : ""
1148
+ }
1149
+ });
1150
+ case "heading_1":
1151
+ return (0, $hgUW1$json2md)({
1152
+ h1: plainText
1153
+ });
1154
+ case "heading_2":
1155
+ return (0, $hgUW1$json2md)({
1156
+ h2: plainText
1157
+ });
1158
+ case "heading_3":
1159
+ return (0, $hgUW1$json2md)({
1160
+ h3: plainText
1161
+ });
1162
+ case "heading_4":
1163
+ return (0, $hgUW1$json2md)({
1164
+ h4: plainText
1165
+ });
1166
+ case "heading_5":
1167
+ return (0, $hgUW1$json2md)({
1168
+ h5: plainText
1169
+ });
1170
+ case "heading_6":
1171
+ return (0, $hgUW1$json2md)({
1172
+ h6: plainText
1173
+ });
1174
+ case "image":
1175
+ return (0, $hgUW1$json2md)({
1176
+ img: {
1177
+ title: caption.length ? caption : "Image",
1178
+ // @ts-ignore
1179
+ alt: caption.length ? caption : "Image",
1180
+ source: data.file ? data.file.url : data.external ? data.external.url : ""
1181
+ }
1182
+ });
1183
+ case "table":
1184
+ return (0, $hgUW1$json2md)({
1185
+ p: "Tabular values as CSV"
1186
+ });
1187
+ case "table_row":
1188
+ // @ts-ignore
1189
+ return (0, $hgUW1$json2md)({
1190
+ p: data.cells.map((x)=>x[0]?.plain_text).join(",")
1191
+ });
1192
+ case "to_do":
1193
+ return `- [${data.checked ? "X" : " "}] ${plainText.join("")}\n`;
1194
+ default:
1195
+ return (0, $hgUW1$json2md)({
1196
+ p: plainText.join("")
1197
+ });
1198
+ }
1199
+ }
1200
+ var $4ade430d0ba3db35$export$2e2bcd8739ae039 = $4ade430d0ba3db35$var$convertNotionToMd;
1201
+
1202
+
1203
+ function $8996cf564bd5286d$var$parseUrl(url) {
1204
+ return new URL(url);
1205
+ }
1206
+ var $8996cf564bd5286d$export$2e2bcd8739ae039 = $8996cf564bd5286d$var$parseUrl;
1207
+
1208
+
1209
+ function $e87fc11b786b144f$var$jsonParse(str) {
1210
+ try {
1211
+ return JSON.parse(str);
1212
+ } catch (e) {
1213
+ return null;
1214
+ }
1215
+ }
1216
+ var $e87fc11b786b144f$export$2e2bcd8739ae039 = $e87fc11b786b144f$var$jsonParse;
1217
+
1218
+
1219
+
1220
+ function $f670a05bcaa730d6$var$getMimeType(extensionType) {
1221
+ try {
1222
+ return (0, $hgUW1$mime).getType(extensionType);
1223
+ } catch (e) {
1224
+ return null;
1225
+ }
1226
+ }
1227
+ var $f670a05bcaa730d6$export$2e2bcd8739ae039 = $f670a05bcaa730d6$var$getMimeType;
1228
+
1229
+
1230
+ function $ca02bede6666d5aa$var$uuid() {
1231
+ return crypto.randomUUID();
1232
+ }
1233
+ var $ca02bede6666d5aa$export$2e2bcd8739ae039 = $ca02bede6666d5aa$var$uuid;
1234
+
1235
+
1236
+
1237
+ function $2da5caa79c6bb797$var$base64encode(arg) {
1238
+ return (0, $hgUW1$encodeBase64)(new TextEncoder().encode(arg));
1239
+ }
1240
+ var $2da5caa79c6bb797$export$2e2bcd8739ae039 = $2da5caa79c6bb797$var$base64encode;
1241
+
1242
+
1243
+
1244
+ var $ad2900c1e2019dbb$exports = {};
1245
+ $ad2900c1e2019dbb$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"]}}');
1246
+
1247
+
1248
+ function $6cca9779ca107e6f$var$convertCurrencyToSubunit(arg, currencyCode) {
1249
+ if ((0, $hgUW1$isNil)(arg)) return arg;
1250
+ // @ts-ignore
1251
+ if ((0, (/*@__PURE__*/$parcel$interopDefault($ad2900c1e2019dbb$exports)))[currencyCode]) {
1252
+ const amount = parseFloat(arg);
1253
+ // @ts-ignore
1254
+ const subunit = (0, (/*@__PURE__*/$parcel$interopDefault($ad2900c1e2019dbb$exports)))[currencyCode].digits;
1255
+ return Math.floor(amount * Math.pow(10, subunit));
1256
+ }
1257
+ return arg;
1258
+ }
1259
+ var $6cca9779ca107e6f$export$2e2bcd8739ae039 = $6cca9779ca107e6f$var$convertCurrencyToSubunit;
1260
+
1261
+
1262
+
1263
+
1264
+ function $310d644057fb9b3e$var$convertCurrencyFromSubunit(arg, currencyCode) {
1265
+ if ((0, $hgUW1$isNil)(arg)) return arg;
1266
+ // @ts-ignore
1267
+ if ((0, (/*@__PURE__*/$parcel$interopDefault($ad2900c1e2019dbb$exports)))[currencyCode]) {
1268
+ const amount = parseFloat(arg);
1269
+ // @ts-ignore
1270
+ const subunit = (0, (/*@__PURE__*/$parcel$interopDefault($ad2900c1e2019dbb$exports)))[currencyCode].digits;
1271
+ return (amount / Math.pow(10, subunit)).toFixed(subunit);
1272
+ }
1273
+ return arg;
1274
+ }
1275
+ var $310d644057fb9b3e$export$2e2bcd8739ae039 = $310d644057fb9b3e$var$convertCurrencyFromSubunit;
1276
+
1277
+
1278
+ function $153d9abb3c74da4b$var$firstNonEmpty(...args) {
1279
+ for (const arg of args){
1280
+ if (arg !== undefined && arg !== null) return arg;
1281
+ }
1282
+ }
1283
+ var $153d9abb3c74da4b$export$2e2bcd8739ae039 = $153d9abb3c74da4b$var$firstNonEmpty;
1284
+
1285
+
1286
+ async function $3e0a662faddb5a62$var$getArrayBuffer(file) {
1287
+ return file ? await file.arrayBuffer() : undefined;
1288
+ }
1289
+ var $3e0a662faddb5a62$export$2e2bcd8739ae039 = $3e0a662faddb5a62$var$getArrayBuffer;
1290
+
1291
+
1292
+
1293
+ function $a55f44f6811a2712$var$blob(content, options) {
1294
+ return new Blob((0, $hgUW1$castArray)(content || ""), options);
1295
+ }
1296
+ var $a55f44f6811a2712$export$2e2bcd8739ae039 = $a55f44f6811a2712$var$blob;
1297
+
1298
+
1299
+ function $62b3599fcbf0b10c$var$zipSqlResponse(columns, data, key) {
1300
+ // @ts-ignore
1301
+ const columnKeys = columns.map((col)=>col[key]);
1302
+ // @ts-ignore
1303
+ return data.map((row)=>{
1304
+ const obj = {};
1305
+ for(let i = 0; i < columnKeys.length; i++)// @ts-ignore
1306
+ obj[columnKeys[i]] = row[i];
1307
+ return obj;
1308
+ });
1309
+ }
1310
+ var $62b3599fcbf0b10c$export$2e2bcd8739ae039 = $62b3599fcbf0b10c$var$zipSqlResponse;
1311
+
1312
+
1313
+
1314
+ function $52da679a67e0b066$var$base64decode(arg) {
1315
+ return new TextDecoder("utf-8").decode((0, $hgUW1$decodeBase64)(arg));
1316
+ }
1317
+ var $52da679a67e0b066$export$2e2bcd8739ae039 = $52da679a67e0b066$var$base64decode;
1318
+
1319
+
1320
+
1321
+ function $3e1c03caddb74419$export$2e2bcd8739ae039(expression) {
1322
+ expression.registerFunction("dtFromIso", (0, $9e00534fc92334a4$export$2e2bcd8739ae039));
1323
+ expression.registerFunction("base64decode", (0, $52da679a67e0b066$export$2e2bcd8739ae039));
1324
+ expression.registerFunction("base64encode", (0, $2da5caa79c6bb797$export$2e2bcd8739ae039));
1325
+ expression.registerFunction("dtFromFormat", (0, $3743337fe5a7810d$export$2e2bcd8739ae039));
1326
+ expression.registerFunction("removeEmpty", (0, $cf3780e9a046523d$export$2e2bcd8739ae039));
1327
+ expression.registerFunction("removeEmptyItems", (0, $e02d045b7bd2be36$export$2e2bcd8739ae039));
1328
+ expression.registerFunction("convertCurrencyToSubunit", (0, $6cca9779ca107e6f$export$2e2bcd8739ae039));
1329
+ expression.registerFunction("convertCurrencyFromSubunit", (0, $310d644057fb9b3e$export$2e2bcd8739ae039));
1330
+ expression.registerFunction("convertQueryToSql", (0, $fc14921d7413e598$export$2e2bcd8739ae039));
1331
+ expression.registerFunction("mapValues", (0, $3f537ea33f4958b3$export$2e2bcd8739ae039));
1332
+ expression.registerFunction("zipSqlResponse", (0, $62b3599fcbf0b10c$export$2e2bcd8739ae039));
1333
+ expression.registerFunction("firstNonEmpty", (0, $153d9abb3c74da4b$export$2e2bcd8739ae039));
1334
+ expression.registerFunction("convertNotionToMd", (0, $4ade430d0ba3db35$export$2e2bcd8739ae039));
1335
+ expression.registerFunction("convertNotionToMarkdown", (0, $1d16c841f49064ff$export$2e2bcd8739ae039));
1336
+ expression.registerFunction("convertMarkdownToGoogleDocs", (0, $1856284278f92c61$export$2e2bcd8739ae039));
1337
+ expression.registerFunction("convertMarkdownToNotion", (0, $d584c575eabd606d$export$2e2bcd8739ae039));
1338
+ expression.registerFunction("convertMarkdownToSlack", (0, $0367d1505684d547$export$2e2bcd8739ae039));
1339
+ expression.registerFunction("parseUrl", (0, $8996cf564bd5286d$export$2e2bcd8739ae039));
1340
+ expression.registerFunction("difference", function(arr1, arr2) {
1341
+ return (0, $hgUW1$difference)(arr1, arr2);
1342
+ });
1343
+ expression.registerFunction("jsonParse", (0, $e87fc11b786b144f$export$2e2bcd8739ae039));
1344
+ expression.registerFunction("getMimeType", (0, $f670a05bcaa730d6$export$2e2bcd8739ae039));
1345
+ expression.registerFunction("uuid", (0, $ca02bede6666d5aa$export$2e2bcd8739ae039));
1346
+ expression.registerFunction("getArrayBuffer", (0, $3e0a662faddb5a62$export$2e2bcd8739ae039));
1347
+ expression.registerFunction("mostSimilar", (0, $d107fdfa34579e76$export$2e2bcd8739ae039));
1348
+ expression.registerFunction("sortNodes", (0, $5c5e048cce648ad9$export$2e2bcd8739ae039));
1349
+ expression.registerFunction("blob", (0, $a55f44f6811a2712$export$2e2bcd8739ae039));
1350
+ expression.registerFunction("convertHtmlToMarkdown", (0, $466433da5b17336d$export$2e2bcd8739ae039));
1351
+ expression.registerFunction("digest", (0, $07f7ad31d6a8cbdd$export$2e2bcd8739ae039));
1352
+ expression.registerFunction("sign", (0, $9e0fe82470a4aa3f$export$2e2bcd8739ae039));
1353
+ expression.registerFunction("xmlToJs", (0, $482257986df2ffd5$export$2e2bcd8739ae039));
1354
+ expression.registerFunction("jsToXml", (0, $9e1852c032fb5537$export$2e2bcd8739ae039));
1355
+ expression.registerFunction("groupBy", function(array, key) {
1356
+ return (0, $hgUW1$groupBy)((0, $hgUW1$castArray)(array), key);
1357
+ });
1358
+ expression.registerFunction("keyBy", function(array, key) {
1359
+ return (0, $hgUW1$keyBy)((0, $hgUW1$castArray)(array), key);
1360
+ });
1361
+ expression.registerFunction("pick", function(obj, keys) {
1362
+ return (0, $hgUW1$pick)(obj, keys);
1363
+ });
1364
+ expression.registerFunction("omit", function(obj, keys) {
1365
+ return (0, $hgUW1$omit)(obj, keys);
1366
+ });
1367
+ expression.registerFunction("compact", function(arr) {
1368
+ return (0, $hgUW1$compact)((0, $hgUW1$castArray)(arr));
1369
+ });
1370
+ expression.registerFunction("join", function(arr, separator) {
1371
+ return (0, $hgUW1$join)((0, $hgUW1$castArray)(arr), separator);
1372
+ });
1373
+ expression.registerFunction("orderBy", function(arr, attr, order) {
1374
+ return (0, $hgUW1$orderBy)((0, $hgUW1$castArray)(arr), attr, order);
1375
+ });
1376
+ expression.registerFunction("find", function(arr, attr) {
1377
+ return (0, $hgUW1$find)((0, $hgUW1$castArray)(arr), attr);
1378
+ });
1379
+ expression.registerFunction("lofilter", function(arr, attr) {
1380
+ return (0, $hgUW1$filter)((0, $hgUW1$castArray)(arr), attr);
1381
+ });
1382
+ expression.registerFunction("values", function(obj) {
1383
+ return (0, $hgUW1$values)(obj);
1384
+ });
1385
+ expression.registerFunction("wrap", function(value, wrapper, endWrapper) {
1386
+ return (0, $hgUW1$join)([
1387
+ wrapper,
1388
+ value,
1389
+ endWrapper || wrapper
1390
+ ], "");
1391
+ });
1392
+ return expression;
1393
+ }
1394
+
1395
+
1396
+ function $149c1bd638913645$export$2e2bcd8739ae039(expression) {
1397
+ return (0, $3e1c03caddb74419$export$2e2bcd8739ae039)((0, $hgUW1$jsonata)(expression));
1398
+ }
1399
+
1400
+
1401
+ export {$149c1bd638913645$export$2e2bcd8739ae039 as default};
1402
+ //# sourceMappingURL=module.js.map