Add <%br= %> jqhtml syntax docs, class override detection, npm update
Document event handler placement and model fetch clarification 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2
node_modules/@babel/traverse/lib/scope/binding.js.map
generated
vendored
2
node_modules/@babel/traverse/lib/scope/binding.js.map
generated
vendored
File diff suppressed because one or more lines are too long
239
node_modules/@babel/traverse/lib/scope/index.js
generated
vendored
239
node_modules/@babel/traverse/lib/scope/index.js
generated
vendored
@@ -53,8 +53,6 @@ const {
|
||||
toIdentifier,
|
||||
variableDeclaration,
|
||||
variableDeclarator,
|
||||
isRecordExpression,
|
||||
isTupleExpression,
|
||||
isObjectProperty,
|
||||
isTopicReference,
|
||||
isMetaProperty,
|
||||
@@ -180,19 +178,15 @@ function gatherNodeParts(node, parts) {
|
||||
}
|
||||
}
|
||||
function resetScope(scope) {
|
||||
{
|
||||
scope.references = Object.create(null);
|
||||
scope.uids = Object.create(null);
|
||||
}
|
||||
scope.references = Object.create(null);
|
||||
scope.uids = Object.create(null);
|
||||
scope.bindings = Object.create(null);
|
||||
scope.globals = Object.create(null);
|
||||
}
|
||||
function isAnonymousFunctionExpression(path) {
|
||||
return path.isFunctionExpression() && !path.node.id || path.isArrowFunctionExpression();
|
||||
}
|
||||
{
|
||||
var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
|
||||
}
|
||||
var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
|
||||
const collectorVisitor = {
|
||||
ForStatement(path) {
|
||||
const declar = path.get("init");
|
||||
@@ -335,22 +329,20 @@ class Scope {
|
||||
this.path = path;
|
||||
this.labels = new Map();
|
||||
this.inited = false;
|
||||
{
|
||||
Object.defineProperties(this, {
|
||||
references: {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: Object.create(null)
|
||||
},
|
||||
uids: {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: Object.create(null)
|
||||
}
|
||||
});
|
||||
}
|
||||
Object.defineProperties(this, {
|
||||
references: {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: Object.create(null)
|
||||
},
|
||||
uids: {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: Object.create(null)
|
||||
}
|
||||
});
|
||||
}
|
||||
get parent() {
|
||||
var _parent;
|
||||
@@ -391,10 +383,8 @@ class Scope {
|
||||
i++;
|
||||
} while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid));
|
||||
const program = this.getProgramParent();
|
||||
{
|
||||
program.references[uid] = true;
|
||||
program.uids[uid] = true;
|
||||
}
|
||||
program.references[uid] = true;
|
||||
program.uids[uid] = true;
|
||||
return uid;
|
||||
}
|
||||
generateUidBasedOnNode(node, defaultName) {
|
||||
@@ -448,9 +438,7 @@ class Scope {
|
||||
if (binding) {
|
||||
newName || (newName = this.generateUidIdentifier(oldName).name);
|
||||
const renamer = new _renamer.default(binding, oldName, newName);
|
||||
{
|
||||
renamer.rename(arguments[2]);
|
||||
}
|
||||
renamer.rename(arguments[2]);
|
||||
}
|
||||
}
|
||||
dump() {
|
||||
@@ -534,9 +522,7 @@ class Scope {
|
||||
const parent = this.getProgramParent();
|
||||
const ids = path.getOuterBindingIdentifiers(true);
|
||||
for (const name of Object.keys(ids)) {
|
||||
{
|
||||
parent.references[name] = true;
|
||||
}
|
||||
parent.references[name] = true;
|
||||
for (const id of ids[name]) {
|
||||
const local = this.getOwnBinding(name);
|
||||
if (local) {
|
||||
@@ -560,13 +546,11 @@ class Scope {
|
||||
this.globals[node.name] = node;
|
||||
}
|
||||
hasUid(name) {
|
||||
{
|
||||
let scope = this;
|
||||
do {
|
||||
if (scope.uids[name]) return true;
|
||||
} while (scope = scope.parent);
|
||||
return false;
|
||||
}
|
||||
let scope = this;
|
||||
do {
|
||||
if (scope.uids[name]) return true;
|
||||
} while (scope = scope.parent);
|
||||
return false;
|
||||
}
|
||||
hasGlobal(name) {
|
||||
let scope = this;
|
||||
@@ -576,9 +560,7 @@ class Scope {
|
||||
return false;
|
||||
}
|
||||
hasReference(name) {
|
||||
{
|
||||
return !!this.getProgramParent().references[name];
|
||||
}
|
||||
return !!this.getProgramParent().references[name];
|
||||
}
|
||||
isPure(node, constantsOnly) {
|
||||
if (isIdentifier(node)) {
|
||||
@@ -604,12 +586,12 @@ class Scope {
|
||||
return true;
|
||||
} else if (isBinary(node)) {
|
||||
return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
|
||||
} else if (isArrayExpression(node) || isTupleExpression(node)) {
|
||||
} else if (isArrayExpression(node) || (node == null ? void 0 : node.type) === "TupleExpression") {
|
||||
for (const elem of node.elements) {
|
||||
if (elem !== null && !this.isPure(elem, constantsOnly)) return false;
|
||||
}
|
||||
return true;
|
||||
} else if (isObjectExpression(node) || isRecordExpression(node)) {
|
||||
} else if (isObjectExpression(node) || (node == null ? void 0 : node.type) === "RecordExpression") {
|
||||
for (const prop of node.properties) {
|
||||
if (!this.isPure(prop, constantsOnly)) return false;
|
||||
}
|
||||
@@ -681,7 +663,6 @@ class Scope {
|
||||
}
|
||||
crawl() {
|
||||
const path = this.path;
|
||||
;
|
||||
resetScope(this);
|
||||
this.data = Object.create(null);
|
||||
let scope = this;
|
||||
@@ -711,9 +692,7 @@ class Scope {
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
path.traverse(scopeVisitor, state);
|
||||
}
|
||||
path.traverse(scopeVisitor, state);
|
||||
this.crawling = false;
|
||||
for (const path of state.assignments) {
|
||||
const ids = path.getAssignmentIdentifiers();
|
||||
@@ -901,14 +880,12 @@ class Scope {
|
||||
removeBinding(name) {
|
||||
var _this$getBinding3;
|
||||
(_this$getBinding3 = this.getBinding(name)) == null || _this$getBinding3.scope.removeOwnBinding(name);
|
||||
{
|
||||
let scope = this;
|
||||
do {
|
||||
if (scope.uids[name]) {
|
||||
scope.uids[name] = false;
|
||||
}
|
||||
} while (scope = scope.parent);
|
||||
}
|
||||
let scope = this;
|
||||
do {
|
||||
if (scope.uids[name]) {
|
||||
scope.uids[name] = false;
|
||||
}
|
||||
} while (scope = scope.parent);
|
||||
}
|
||||
hoistVariables(emit = id => this.push({
|
||||
id
|
||||
@@ -962,82 +939,80 @@ class Scope {
|
||||
exports.default = Scope;
|
||||
Scope.globals = [...globalsBuiltinLower, ...globalsBuiltinUpper];
|
||||
Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];
|
||||
{
|
||||
Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) {
|
||||
if (map[oldName]) {
|
||||
map[newName] = value;
|
||||
map[oldName] = null;
|
||||
}
|
||||
};
|
||||
Scope.prototype.traverse = function (node, opts, state) {
|
||||
(0, _index.default)(node, opts, this, state, this.path);
|
||||
};
|
||||
Scope.prototype._generateUid = function _generateUid(name, i) {
|
||||
let id = name;
|
||||
if (i > 1) id += i;
|
||||
return `_${id}`;
|
||||
};
|
||||
Scope.prototype.toArray = function toArray(node, i, arrayLikeIsIterable) {
|
||||
if (isIdentifier(node)) {
|
||||
const binding = this.getBinding(node.name);
|
||||
if (binding != null && binding.constant && binding.path.isGenericType("Array")) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
if (isArrayExpression(node)) {
|
||||
Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) {
|
||||
if (map[oldName]) {
|
||||
map[newName] = value;
|
||||
map[oldName] = null;
|
||||
}
|
||||
};
|
||||
Scope.prototype.traverse = function (node, opts, state) {
|
||||
(0, _index.default)(node, opts, this, state, this.path);
|
||||
};
|
||||
Scope.prototype._generateUid = function _generateUid(name, i) {
|
||||
let id = name;
|
||||
if (i > 1) id += i;
|
||||
return `_${id}`;
|
||||
};
|
||||
Scope.prototype.toArray = function toArray(node, i, arrayLikeIsIterable) {
|
||||
if (isIdentifier(node)) {
|
||||
const binding = this.getBinding(node.name);
|
||||
if (binding != null && binding.constant && binding.path.isGenericType("Array")) {
|
||||
return node;
|
||||
}
|
||||
if (isIdentifier(node, {
|
||||
name: "arguments"
|
||||
})) {
|
||||
return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]);
|
||||
}
|
||||
let helperName;
|
||||
const args = [node];
|
||||
if (i === true) {
|
||||
helperName = "toConsumableArray";
|
||||
} else if (typeof i === "number") {
|
||||
args.push(numericLiteral(i));
|
||||
helperName = "slicedToArray";
|
||||
} else {
|
||||
helperName = "toArray";
|
||||
}
|
||||
if (arrayLikeIsIterable) {
|
||||
args.unshift(this.path.hub.addHelper(helperName));
|
||||
helperName = "maybeArrayLike";
|
||||
}
|
||||
return callExpression(this.path.hub.addHelper(helperName), args);
|
||||
};
|
||||
Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(...kinds) {
|
||||
const ids = Object.create(null);
|
||||
for (const kind of kinds) {
|
||||
let scope = this;
|
||||
do {
|
||||
for (const name of Object.keys(scope.bindings)) {
|
||||
const binding = scope.bindings[name];
|
||||
if (binding.kind === kind) ids[name] = binding;
|
||||
}
|
||||
scope = scope.parent;
|
||||
} while (scope);
|
||||
}
|
||||
return ids;
|
||||
};
|
||||
Object.defineProperties(Scope.prototype, {
|
||||
parentBlock: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this.path.parent;
|
||||
}
|
||||
},
|
||||
hub: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this.path.hub;
|
||||
}
|
||||
if (isArrayExpression(node)) {
|
||||
return node;
|
||||
}
|
||||
if (isIdentifier(node, {
|
||||
name: "arguments"
|
||||
})) {
|
||||
return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]);
|
||||
}
|
||||
let helperName;
|
||||
const args = [node];
|
||||
if (i === true) {
|
||||
helperName = "toConsumableArray";
|
||||
} else if (typeof i === "number") {
|
||||
args.push(numericLiteral(i));
|
||||
helperName = "slicedToArray";
|
||||
} else {
|
||||
helperName = "toArray";
|
||||
}
|
||||
if (arrayLikeIsIterable) {
|
||||
args.unshift(this.path.hub.addHelper(helperName));
|
||||
helperName = "maybeArrayLike";
|
||||
}
|
||||
return callExpression(this.path.hub.addHelper(helperName), args);
|
||||
};
|
||||
Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(...kinds) {
|
||||
const ids = Object.create(null);
|
||||
for (const kind of kinds) {
|
||||
let scope = this;
|
||||
do {
|
||||
for (const name of Object.keys(scope.bindings)) {
|
||||
const binding = scope.bindings[name];
|
||||
if (binding.kind === kind) ids[name] = binding;
|
||||
}
|
||||
scope = scope.parent;
|
||||
} while (scope);
|
||||
}
|
||||
return ids;
|
||||
};
|
||||
Object.defineProperties(Scope.prototype, {
|
||||
parentBlock: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this.path.parent;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
hub: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this.path.hub;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
2
node_modules/@babel/traverse/lib/scope/index.js.map
generated
vendored
2
node_modules/@babel/traverse/lib/scope/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
6
node_modules/@babel/traverse/lib/scope/lib/renamer.js
generated
vendored
6
node_modules/@babel/traverse/lib/scope/lib/renamer.js
generated
vendored
@@ -40,11 +40,9 @@ const renameVisitor = {
|
||||
name
|
||||
} = node.key;
|
||||
if (node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier) {
|
||||
var _node$extra;
|
||||
node.shorthand = false;
|
||||
{
|
||||
var _node$extra;
|
||||
if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false;
|
||||
}
|
||||
if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false;
|
||||
}
|
||||
},
|
||||
"AssignmentExpression|Declaration|VariableDeclarator"(path, state) {
|
||||
|
||||
2
node_modules/@babel/traverse/lib/scope/lib/renamer.js.map
generated
vendored
2
node_modules/@babel/traverse/lib/scope/lib/renamer.js.map
generated
vendored
File diff suppressed because one or more lines are too long
20
node_modules/@babel/traverse/lib/scope/traverseForScope.js
generated
vendored
20
node_modules/@babel/traverse/lib/scope/traverseForScope.js
generated
vendored
@@ -29,18 +29,11 @@ function traverseForScope(path, visitors, state) {
|
||||
listKey,
|
||||
key
|
||||
});
|
||||
_context.setScope.call(path);
|
||||
_context._forceSetScope.call(path);
|
||||
const visitor = exploded[node.type];
|
||||
if (visitor) {
|
||||
if (visitor.enter) {
|
||||
for (const visit of visitor.enter) {
|
||||
visit.call(state, path, state);
|
||||
}
|
||||
}
|
||||
if (visitor.exit) {
|
||||
for (const visit of visitor.exit) {
|
||||
visit.call(state, path, state);
|
||||
}
|
||||
if (visitor != null && visitor.enter) {
|
||||
for (const visit of visitor.enter) {
|
||||
visit.call(state, path, state);
|
||||
}
|
||||
}
|
||||
if (path.shouldSkip) {
|
||||
@@ -62,6 +55,11 @@ function traverseForScope(path, visitors, state) {
|
||||
_traverse(path, node, prop, node, key, null);
|
||||
}
|
||||
}
|
||||
if (visitor != null && visitor.exit) {
|
||||
for (const visit of visitor.exit) {
|
||||
visit.call(state, path, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
node_modules/@babel/traverse/lib/scope/traverseForScope.js.map
generated
vendored
2
node_modules/@babel/traverse/lib/scope/traverseForScope.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"names":["_t","require","_index","_visitors","_context","VISITOR_KEYS","traverseForScope","path","visitors","state","exploded","explode","enter","exit","Error","_traverse","parentPath","parent","node","container","key","listKey","hub","inPath","NodePath","get","setScope","call","visitor","type","visit","shouldSkip","keys","length","prop","Array","isArray","i","value"],"sources":["../../src/scope/traverseForScope.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { HubInterface, Visitor } from \"../index.ts\";\nimport { NodePath } from \"../index.ts\";\nimport { explode } from \"../visitors.ts\";\nimport { setScope } from \"../path/context.ts\";\n\nexport default function traverseForScope(\n path: NodePath,\n visitors: Visitor,\n state: any,\n) {\n const exploded = explode(visitors);\n\n if (exploded.enter || exploded.exit) {\n throw new Error(\"Should not be used with enter/exit visitors.\");\n }\n\n _traverse(\n path.parentPath,\n path.parent,\n path.node,\n path.container!,\n path.key!,\n path.listKey,\n path.hub,\n path,\n );\n\n function _traverse(\n parentPath: NodePath,\n parent: t.Node,\n node: t.Node,\n container: t.Node | t.Node[],\n key: string | number,\n listKey: string | null | undefined,\n hub?: HubInterface,\n inPath?: NodePath,\n ) {\n if (!node) {\n return;\n }\n\n const path =\n inPath ||\n NodePath.get({\n hub,\n parentPath,\n parent,\n container,\n listKey,\n key,\n });\n\n setScope.call(path);\n\n const visitor = exploded[node.type];\n if (visitor) {\n if (visitor.enter) {\n for (const visit of visitor.enter) {\n visit.call(state, path, state);\n }\n }\n if (visitor.exit) {\n for (const visit of visitor.exit) {\n visit.call(state, path, state);\n }\n }\n }\n if (path.shouldSkip) {\n return;\n }\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys?.length) {\n return;\n }\n\n for (const key of keys) {\n // @ts-expect-error key must present in node\n const prop = node[key];\n if (!prop) continue;\n if (Array.isArray(prop)) {\n for (let i = 0; i < prop.length; i++) {\n const value = prop[i];\n _traverse(path, node, value, prop, i, key);\n }\n } else {\n _traverse(path, node, prop, node, key, null);\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAA8C;EALrCI;AAAY,IAAAL,EAAA;AAON,SAASM,gBAAgBA,CACtCC,IAAc,EACdC,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F,IAAI,CAACwB,UAAU,EAAE;MACnB;IACF;IAEA,MAAMC,IAAI,GAAG3B,YAAY,CAACa,IAAI,CAACW,IAAI,CAAC;IACpC,IAAI,EAACG,IAAI,YAAJA,IAAI,CAAEC,MAAM,GAAE;MACjB;IACF;IAEA,KAAK,MAAMb,GAAG,IAAIY,IAAI,EAAE;MAEtB,MAAME,IAAI,GAAGhB,IAAI,CAACE,GAAG,CAAC;MACtB,IAAI,CAACc,IAAI,EAAE;MACX,IAAIC,KAAK,CAACC,OAAO,CAACF,IAAI,CAAC,EAAE;QACvB,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,IAAI,CAACD,MAAM,EAAEI,CAAC,EAAE,EAAE;UACpC,MAAMC,KAAK,GAAGJ,IAAI,CAACG,CAAC,CAAC;UACrBtB,SAAS,CAACR,IAAI,EAAEW,IAAI,EAAEoB,KAAK,EAAEJ,IAAI,EAAEG,CAAC,EAAEjB,GAAG,CAAC;QAC5C;MACF,CAAC,MAAM;QACLL,SAAS,CAACR,IAAI,EAAEW,IAAI,EAAEgB,IAAI,EAAEhB,IAAI,EAAEE,GAAG,EAAE,IAAI,CAAC;MAC9C;IACF;EACF;AACF","ignoreList":[]}
|
||||
{"version":3,"names":["_t","require","_index","_visitors","_context","VISITOR_KEYS","traverseForScope","path","visitors","state","exploded","explode","enter","exit","Error","_traverse","parentPath","parent","node","container","key","listKey","hub","inPath","NodePath","get","_forceSetScope","call","visitor","type","visit","shouldSkip","keys","length","prop","Array","isArray","i","value"],"sources":["../../src/scope/traverseForScope.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { HubInterface, Visitor } from \"../index.ts\";\nimport { NodePath } from \"../index.ts\";\nimport { explode } from \"../visitors.ts\";\nimport { _forceSetScope } from \"../path/context.ts\";\n\nexport default function traverseForScope(\n path: NodePath,\n visitors: Visitor,\n state: any,\n) {\n const exploded = explode(visitors);\n\n if (exploded.enter || exploded.exit) {\n throw new Error(\"Should not be used with enter/exit visitors.\");\n }\n\n _traverse(\n path.parentPath,\n path.parent,\n path.node,\n path.container!,\n path.key!,\n path.listKey,\n path.hub,\n path,\n );\n\n function _traverse(\n parentPath: NodePath,\n parent: t.Node,\n node: t.Node,\n container: t.Node | t.Node[],\n key: string | number,\n listKey: string | null | undefined,\n hub?: HubInterface,\n inPath?: NodePath,\n ) {\n if (!node) {\n return;\n }\n\n const path =\n inPath ||\n NodePath.get({\n hub,\n parentPath,\n parent,\n container,\n listKey,\n key,\n });\n\n _forceSetScope.call(path);\n\n const visitor = exploded[node.type];\n if (visitor?.enter) {\n for (const visit of visitor.enter) {\n visit.call(state, path, state);\n }\n }\n\n if (path.shouldSkip) {\n return;\n }\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys?.length) {\n return;\n }\n\n for (const key of keys) {\n // @ts-expect-error key must present in node\n const prop = node[key];\n if (!prop) continue;\n if (Array.isArray(prop)) {\n for (let i = 0; i < prop.length; i++) {\n const value = prop[i];\n _traverse(path, node, value, prop, i, key);\n }\n } else {\n _traverse(path, node, prop, node, key, null);\n }\n }\n\n if (visitor?.exit) {\n for (const visit of visitor.exit) {\n visit.call(state, path, state);\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAAoD;EAL3CI;AAAY,IAAAL,EAAA;AAON,SAASM,gBAAgBA,CACtCC,IAAc,EACdC,QAAiB,EACjBC,KAAU,EACV;EACA,MAAMC,QAAQ,GAAG,IAAAC,iBAAO,EAACH,QAAQ,CAAC;EAElC,IAAIE,QAAQ,CAACE,KAAK,IAAIF,QAAQ,CAACG,IAAI,EAAE;IACnC,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;EACjE;EAEAC,SAAS,CACPR,IAAI,CAACS,UAAU,EACfT,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