@tamagui/babel-plugin-fully-specified 1.111.4 → 1.111.5
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/cjs/index.js +74 -75
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.js +73 -74
- package/dist/esm/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -18,63 +17,43 @@ __export(src_exports, {
|
|
|
18
17
|
default: () => FullySpecified
|
|
19
18
|
});
|
|
20
19
|
module.exports = __toCommonJS(src_exports);
|
|
21
|
-
var import_node_fs = require("node:fs"), import_node_path = require("node:path")
|
|
20
|
+
var import_node_fs = require("node:fs"), import_node_path = require("node:path");
|
|
21
|
+
const DEFAULT_OPTIONS = {
|
|
22
22
|
ensureFileExists: !0,
|
|
23
23
|
esExtensionDefault: ".mjs",
|
|
24
|
-
tryExtensions: [
|
|
25
|
-
|
|
26
|
-
],
|
|
27
|
-
esExtensions: [
|
|
28
|
-
".mjs"
|
|
29
|
-
]
|
|
24
|
+
tryExtensions: [".js"],
|
|
25
|
+
esExtensions: [".mjs"]
|
|
30
26
|
};
|
|
31
27
|
function FullySpecified(api, rawOptions) {
|
|
32
28
|
api.assertVersion(7);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
options
|
|
44
|
-
});
|
|
45
|
-
fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
|
|
29
|
+
const options = { ...DEFAULT_OPTIONS, ...rawOptions }, importDeclarationVisitor = (path, state) => {
|
|
30
|
+
const filePath = state.file.opts.filename;
|
|
31
|
+
if (!filePath) return;
|
|
32
|
+
const { node } = path;
|
|
33
|
+
if (node.importKind === "type") return;
|
|
34
|
+
const originalModuleSpecifier = node.source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
35
|
+
originalModuleSpecifier,
|
|
36
|
+
{
|
|
37
|
+
filePath,
|
|
38
|
+
options
|
|
46
39
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}, importVisitor = function(path, state) {
|
|
64
|
-
var filePath = state.file.opts.filename;
|
|
65
|
-
if (filePath) {
|
|
66
|
-
var parent = path.parent;
|
|
67
|
-
if (parent.type === "CallExpression") {
|
|
68
|
-
var firstArgOfImportCall = parent.arguments[0];
|
|
69
|
-
if (firstArgOfImportCall.type === "StringLiteral") {
|
|
70
|
-
var originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
71
|
-
filePath,
|
|
72
|
-
options
|
|
73
|
-
});
|
|
74
|
-
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
75
|
-
}
|
|
40
|
+
);
|
|
41
|
+
fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
|
|
42
|
+
}, exportDeclarationVisitor = (path, state) => {
|
|
43
|
+
const filePath = state.file.opts.filename;
|
|
44
|
+
if (!filePath) return;
|
|
45
|
+
const { node } = path;
|
|
46
|
+
if (node.exportKind === "type") return;
|
|
47
|
+
const source = node.source;
|
|
48
|
+
if (!source) return;
|
|
49
|
+
const originalModuleSpecifier = source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
50
|
+
originalModuleSpecifier,
|
|
51
|
+
{
|
|
52
|
+
filePath,
|
|
53
|
+
options
|
|
76
54
|
}
|
|
77
|
-
|
|
55
|
+
);
|
|
56
|
+
fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
|
|
78
57
|
};
|
|
79
58
|
return {
|
|
80
59
|
name: "babel-plugin-fully-specified",
|
|
@@ -82,12 +61,32 @@ function FullySpecified(api, rawOptions) {
|
|
|
82
61
|
ImportDeclaration: importDeclarationVisitor,
|
|
83
62
|
ExportNamedDeclaration: exportDeclarationVisitor,
|
|
84
63
|
ExportAllDeclaration: exportDeclarationVisitor,
|
|
85
|
-
Import:
|
|
64
|
+
Import: (path, state) => {
|
|
65
|
+
const filePath = state.file.opts.filename;
|
|
66
|
+
if (!filePath) return;
|
|
67
|
+
const parent = path.parent;
|
|
68
|
+
if (parent.type !== "CallExpression")
|
|
69
|
+
return;
|
|
70
|
+
const firstArgOfImportCall = parent.arguments[0];
|
|
71
|
+
if (firstArgOfImportCall.type !== "StringLiteral")
|
|
72
|
+
return;
|
|
73
|
+
const originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
74
|
+
originalModuleSpecifier,
|
|
75
|
+
{
|
|
76
|
+
filePath,
|
|
77
|
+
options
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
81
|
+
}
|
|
86
82
|
}
|
|
87
83
|
};
|
|
88
84
|
}
|
|
89
|
-
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier,
|
|
90
|
-
|
|
85
|
+
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
86
|
+
filePath,
|
|
87
|
+
options
|
|
88
|
+
}) {
|
|
89
|
+
const fileExt = (0, import_node_path.extname)(filePath), fileDir = (0, import_node_path.dirname)(filePath), isDirectory = isLocalDirectory((0, import_node_path.resolve)(fileDir, originalModuleSpecifier)), currentModuleExtension = (0, import_node_path.extname)(originalModuleSpecifier), { tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = options, targetModule = evaluateTargetModule({
|
|
91
90
|
moduleSpecifier: originalModuleSpecifier,
|
|
92
91
|
filenameDirectory: fileDir,
|
|
93
92
|
filenameExtension: fileExt,
|
|
@@ -103,30 +102,30 @@ function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, param) {
|
|
|
103
102
|
function isLocalDirectory(absoluteDirectory) {
|
|
104
103
|
return (0, import_node_fs.existsSync)(absoluteDirectory) && (0, import_node_fs.lstatSync)(absoluteDirectory).isDirectory();
|
|
105
104
|
}
|
|
106
|
-
function evaluateTargetModule(
|
|
107
|
-
|
|
105
|
+
function evaluateTargetModule({
|
|
106
|
+
moduleSpecifier,
|
|
107
|
+
currentModuleExtension,
|
|
108
|
+
isDirectory,
|
|
109
|
+
filenameDirectory,
|
|
110
|
+
filenameExtension,
|
|
111
|
+
tryExtensions,
|
|
112
|
+
esExtensions,
|
|
113
|
+
esExtensionDefault,
|
|
114
|
+
ensureFileExists
|
|
115
|
+
}) {
|
|
108
116
|
if (currentModuleExtension && !esExtensions.includes(currentModuleExtension))
|
|
109
117
|
return !1;
|
|
110
|
-
isDirectory && !(0, import_node_fs.existsSync)(
|
|
111
|
-
|
|
118
|
+
isDirectory && !(0, import_node_fs.existsSync)(
|
|
119
|
+
(0, import_node_path.resolve)(
|
|
120
|
+
filenameDirectory,
|
|
121
|
+
currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault
|
|
122
|
+
)
|
|
123
|
+
) && (moduleSpecifier = `${moduleSpecifier}/index`);
|
|
124
|
+
const targetFile = (0, import_node_path.resolve)(filenameDirectory, moduleSpecifier);
|
|
112
125
|
if (ensureFileExists) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
var extension = _step.value;
|
|
117
|
-
if ((0, import_node_fs.existsSync)(targetFile + extension))
|
|
118
|
-
return moduleSpecifier + esExtensionDefault;
|
|
119
|
-
}
|
|
120
|
-
} catch (err) {
|
|
121
|
-
_didIteratorError = !0, _iteratorError = err;
|
|
122
|
-
} finally {
|
|
123
|
-
try {
|
|
124
|
-
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
125
|
-
} finally {
|
|
126
|
-
if (_didIteratorError)
|
|
127
|
-
throw _iteratorError;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
126
|
+
for (const extension of tryExtensions)
|
|
127
|
+
if ((0, import_node_fs.existsSync)(targetFile + extension))
|
|
128
|
+
return moduleSpecifier + esExtensionDefault;
|
|
130
129
|
} else return esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault;
|
|
131
130
|
return !1;
|
|
132
131
|
}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": [
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoD,oBACpD,mBAA0C;AAmB1C,MAAM,kBAAkB;AAAA,EACtB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,eAAe,CAAC,KAAK;AAAA,EACrB,cAAc,CAAC,MAAM;AACvB;AAEe,SAAR,eACL,KACA,YACW;AACX,MAAI,cAAc,CAAC;AAEnB,QAAM,UAAU,EAAE,GAAG,iBAAiB,GAAG,WAAW,GAG9C,2BAA2B,CAC/B,MACA,UACG;AACH,UAAM,WAAW,MAAM,KAAK,KAAK;AACjC,QAAI,CAAC,SAAU;AAEf,UAAM,EAAE,KAAK,IAAI;AACjB,QAAI,KAAK,eAAe,OAAQ;AAEhC,UAAM,0BAA0B,KAAK,OAAO,OACtC,gCAAg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AAI,SAExE,eAAe,qBAAqB;AAAA,IACxC,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAI,iBAAiB,KACZ,OAGF;AACT;AAEA,SAAS,iBAAiB,mBAA2B;AACnD,aAAO,2BAAW,iBAAiB,SAAK,0BAAU,iBAAiB,EAAE,YAAY;AACnF;AAEA,SAAS,qBAAqB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,MAAI,0BAA0B,CAAC,aAAa,SAAS,sBAAsB;AACzE,WAAO;AAGT,EACE,eACA,KAAC;AAAA,QACC;AAAA,MACE;AAAA,MACA,yBAAyB,kBAAkB,kBAAkB;AAAA,IAC/D;AAAA,EACF,MAEA,kBAAkB,GAAG,eAAe;AAGtC,QAAM,iBAAa,0BAAQ,mBAAmB,eAAe;AAE7D,MAAI;AACF,eAAW,aAAa;AACtB,cAAI,2BAAW,aAAa,SAAS;AACnC,eAAO,kBAAkB;AAAA,QAGxB,QAAI,aAAa,SAAS,iBAAiB,GACzC,kBAAkB;AAK3B,SAAO;AACT;",
|
|
5
|
+
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,62 +1,41 @@
|
|
|
1
1
|
import { existsSync, lstatSync } from "node:fs";
|
|
2
2
|
import { resolve, extname, dirname } from "node:path";
|
|
3
|
-
|
|
3
|
+
const DEFAULT_OPTIONS = {
|
|
4
4
|
ensureFileExists: !0,
|
|
5
5
|
esExtensionDefault: ".mjs",
|
|
6
|
-
tryExtensions: [
|
|
7
|
-
|
|
8
|
-
],
|
|
9
|
-
esExtensions: [
|
|
10
|
-
".mjs"
|
|
11
|
-
]
|
|
6
|
+
tryExtensions: [".js"],
|
|
7
|
+
esExtensions: [".mjs"]
|
|
12
8
|
};
|
|
13
9
|
function FullySpecified(api, rawOptions) {
|
|
14
10
|
api.assertVersion(7);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
options
|
|
26
|
-
});
|
|
27
|
-
fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
|
|
11
|
+
const options = { ...DEFAULT_OPTIONS, ...rawOptions }, importDeclarationVisitor = (path, state) => {
|
|
12
|
+
const filePath = state.file.opts.filename;
|
|
13
|
+
if (!filePath) return;
|
|
14
|
+
const { node } = path;
|
|
15
|
+
if (node.importKind === "type") return;
|
|
16
|
+
const originalModuleSpecifier = node.source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
17
|
+
originalModuleSpecifier,
|
|
18
|
+
{
|
|
19
|
+
filePath,
|
|
20
|
+
options
|
|
28
21
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}, importVisitor = function(path, state) {
|
|
46
|
-
var filePath = state.file.opts.filename;
|
|
47
|
-
if (filePath) {
|
|
48
|
-
var parent = path.parent;
|
|
49
|
-
if (parent.type === "CallExpression") {
|
|
50
|
-
var firstArgOfImportCall = parent.arguments[0];
|
|
51
|
-
if (firstArgOfImportCall.type === "StringLiteral") {
|
|
52
|
-
var originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
53
|
-
filePath,
|
|
54
|
-
options
|
|
55
|
-
});
|
|
56
|
-
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
57
|
-
}
|
|
22
|
+
);
|
|
23
|
+
fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
|
|
24
|
+
}, exportDeclarationVisitor = (path, state) => {
|
|
25
|
+
const filePath = state.file.opts.filename;
|
|
26
|
+
if (!filePath) return;
|
|
27
|
+
const { node } = path;
|
|
28
|
+
if (node.exportKind === "type") return;
|
|
29
|
+
const source = node.source;
|
|
30
|
+
if (!source) return;
|
|
31
|
+
const originalModuleSpecifier = source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
32
|
+
originalModuleSpecifier,
|
|
33
|
+
{
|
|
34
|
+
filePath,
|
|
35
|
+
options
|
|
58
36
|
}
|
|
59
|
-
|
|
37
|
+
);
|
|
38
|
+
fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
|
|
60
39
|
};
|
|
61
40
|
return {
|
|
62
41
|
name: "babel-plugin-fully-specified",
|
|
@@ -64,12 +43,32 @@ function FullySpecified(api, rawOptions) {
|
|
|
64
43
|
ImportDeclaration: importDeclarationVisitor,
|
|
65
44
|
ExportNamedDeclaration: exportDeclarationVisitor,
|
|
66
45
|
ExportAllDeclaration: exportDeclarationVisitor,
|
|
67
|
-
Import:
|
|
46
|
+
Import: (path, state) => {
|
|
47
|
+
const filePath = state.file.opts.filename;
|
|
48
|
+
if (!filePath) return;
|
|
49
|
+
const parent = path.parent;
|
|
50
|
+
if (parent.type !== "CallExpression")
|
|
51
|
+
return;
|
|
52
|
+
const firstArgOfImportCall = parent.arguments[0];
|
|
53
|
+
if (firstArgOfImportCall.type !== "StringLiteral")
|
|
54
|
+
return;
|
|
55
|
+
const originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
56
|
+
originalModuleSpecifier,
|
|
57
|
+
{
|
|
58
|
+
filePath,
|
|
59
|
+
options
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
63
|
+
}
|
|
68
64
|
}
|
|
69
65
|
};
|
|
70
66
|
}
|
|
71
|
-
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier,
|
|
72
|
-
|
|
67
|
+
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
68
|
+
filePath,
|
|
69
|
+
options
|
|
70
|
+
}) {
|
|
71
|
+
const fileExt = extname(filePath), fileDir = dirname(filePath), isDirectory = isLocalDirectory(resolve(fileDir, originalModuleSpecifier)), currentModuleExtension = extname(originalModuleSpecifier), { tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = options, targetModule = evaluateTargetModule({
|
|
73
72
|
moduleSpecifier: originalModuleSpecifier,
|
|
74
73
|
filenameDirectory: fileDir,
|
|
75
74
|
filenameExtension: fileExt,
|
|
@@ -85,30 +84,30 @@ function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, param) {
|
|
|
85
84
|
function isLocalDirectory(absoluteDirectory) {
|
|
86
85
|
return existsSync(absoluteDirectory) && lstatSync(absoluteDirectory).isDirectory();
|
|
87
86
|
}
|
|
88
|
-
function evaluateTargetModule(
|
|
89
|
-
|
|
87
|
+
function evaluateTargetModule({
|
|
88
|
+
moduleSpecifier,
|
|
89
|
+
currentModuleExtension,
|
|
90
|
+
isDirectory,
|
|
91
|
+
filenameDirectory,
|
|
92
|
+
filenameExtension,
|
|
93
|
+
tryExtensions,
|
|
94
|
+
esExtensions,
|
|
95
|
+
esExtensionDefault,
|
|
96
|
+
ensureFileExists
|
|
97
|
+
}) {
|
|
90
98
|
if (currentModuleExtension && !esExtensions.includes(currentModuleExtension))
|
|
91
99
|
return !1;
|
|
92
|
-
isDirectory && !existsSync(
|
|
93
|
-
|
|
100
|
+
isDirectory && !existsSync(
|
|
101
|
+
resolve(
|
|
102
|
+
filenameDirectory,
|
|
103
|
+
currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault
|
|
104
|
+
)
|
|
105
|
+
) && (moduleSpecifier = `${moduleSpecifier}/index`);
|
|
106
|
+
const targetFile = resolve(filenameDirectory, moduleSpecifier);
|
|
94
107
|
if (ensureFileExists) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var extension = _step.value;
|
|
99
|
-
if (existsSync(targetFile + extension))
|
|
100
|
-
return moduleSpecifier + esExtensionDefault;
|
|
101
|
-
}
|
|
102
|
-
} catch (err) {
|
|
103
|
-
_didIteratorError = !0, _iteratorError = err;
|
|
104
|
-
} finally {
|
|
105
|
-
try {
|
|
106
|
-
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
107
|
-
} finally {
|
|
108
|
-
if (_didIteratorError)
|
|
109
|
-
throw _iteratorError;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
108
|
+
for (const extension of tryExtensions)
|
|
109
|
+
if (existsSync(targetFile + extension))
|
|
110
|
+
return moduleSpecifier + esExtensionDefault;
|
|
112
111
|
} else return esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault;
|
|
113
112
|
return !1;
|
|
114
113
|
}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": [
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"mappings": "AAAA,SAAS,YAA0B,iBAAiB;AACpD,SAAS,SAAS,SAAS,eAAe;AAmB1C,MAAM,kBAAkB;AAAA,EACtB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,eAAe,CAAC,KAAK;AAAA,EACrB,cAAc,CAAC,MAAM;AACvB;AAEe,SAAR,eACL,KACA,YACW;AACX,MAAI,cAAc,CAAC;AAEnB,QAAM,UAAU,EAAE,GAAG,iBAAiB,GAAG,WAAW,GAG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