decord/source/1286__isNativeReflectConstruct.js

156 lines
4.1 KiB
JavaScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 1286
// Function ID: 1287
// Name: _isNativeReflectConstruct
// Dependencies: [41, 42, 93, 95, 98, 1278]
// Exports: formatToAst
// Module 1286 (_isNativeReflectConstruct)
2026-08-24 06:08:38 +00:00
import _isNativeReflectConstruct2 from "_isNativeReflectConstruct" /* 1278 */;
import closure_1 from "_classCallCheck" /* 41 */;
import _createClass from "_createClass" /* 42 */;
import closure_2 from "_possibleConstructorReturn" /* 93 */;
import closure_3 from "_getPrototypeOf" /* 95 */;
import _inherits from "_inherits" /* 98 */;
2026-07-29 08:29:29 +00:00
function _isNativeReflectConstruct() {
try {
const _Boolean = Boolean;
const call = valueOf.call;
const _Reflect = Reflect;
const _Boolean2 = Boolean;
if (typeof call === "unknown") {
let callResult = valueOf();
} else {
callResult = call(constructResult);
}
2026-08-24 06:08:38 +00:00
closure_0 = !callResult;
_isNativeReflectConstruct = function _isNativeReflectConstruct() {
2026-07-29 08:29:29 +00:00
return closure_0;
2026-08-24 06:08:38 +00:00
};
2026-07-29 08:29:29 +00:00
return _isNativeReflectConstruct();
} catch (err) {
}
}
2026-08-04 21:03:28 +00:00
function formatToAst(str) {
if (typeof str === "string") {
2026-07-29 08:29:29 +00:00
const obj = { type: null, content: null };
obj[0] = AstBuilder.Text;
2026-08-04 21:03:28 +00:00
obj[1] = str;
2026-07-29 08:29:29 +00:00
const items = [obj];
let bindFormatValuesResult = items;
} else {
const self = this;
2026-08-04 21:03:28 +00:00
bindFormatValuesResult = this.bindFormatValues(closure_6, str, arg1);
2026-07-29 08:29:29 +00:00
}
return bindFormatValuesResult;
}
let obj = {};
const AstBuilder = obj;
obj.Text = "text";
obj.Strong = "strong";
obj.Emphasis = "em";
obj.Strikethrough = "s";
obj.Code = "inlineCode";
obj.Link = "link";
obj.Paragraph = "paragraph";
let closure_5 = {
$b(content) {
return { type: AstBuilder.Strong, content };
},
$i(content) {
return { type: AstBuilder.Emphasis, content };
},
$del(content) {
return { type: AstBuilder.Strikethrough, content };
},
$code(content) {
return { type: AstBuilder.Code, content };
},
$link(content) {
[tmp] = arg2;
return { type: AstBuilder.Link, target: tmp, content };
},
$p(content) {
return { type: AstBuilder.Paragraph, content };
}
};
class AstBuilder {
constructor() {
self = this;
2026-08-24 06:08:38 +00:00
tmp = closure_1(this, AstBuilder);
tmp2 = closure_3;
obj = closure_3(AstBuilder);
tmp3 = closure_2;
2026-07-29 08:29:29 +00:00
if (_isNativeReflectConstruct()) {
tmp7 = globalThis;
_Reflect = Reflect;
tmp8 = arguments;
constructResult = Reflect.construct(obj, arguments, tmp2(self).constructor);
} else {
tmp4 = arguments;
tmp5 = arguments;
constructResult = obj(...arguments);
}
tmp3Result = tmp3(self, constructResult);
tmp3Result.result = [];
return tmp3Result;
}
}
2026-08-24 06:08:38 +00:00
_inherits(AstBuilder, _isNativeReflectConstruct2.FormatBuilder);
2026-07-29 08:29:29 +00:00
obj = {
key: "pushRichTextTag",
value: function pushRichTextTag(formatting) {
if (formatting in closure_5) {
const self = this;
const tmp4 = tmp[formatting](arg1, "", arg2);
const _Array = Array;
const result = this.result;
const push = result.push;
if (Array.isArray(tmp4)) {
const items = [];
HermesBuiltin.arraySpread(tmp4, 0);
HermesBuiltin.apply(items, result);
} else {
push(tmp4);
}
} else {
const _HermesInternal = HermesInternal;
throw "" + formatting + " is not a known rich text formatting tag";
}
tmp = closure_5;
}
};
let items = [
obj,
{
key: "pushLiteralText",
value: function pushLiteralText(content) {
if (null != this.result[this.result.length - 1]) {
if (tmp.type === AstBuilder.Text) {
tmp.content = tmp.content + content;
}
}
const result = this.result;
result.push({ type: AstBuilder.Text, content });
}
},
{
key: "pushObject",
value: function pushObject(arg0) {
const result = this.result;
result.push(arg0);
}
},
{
key: "finish",
value: function finish() {
return this.result;
}
}
];
const _moduleResult = _createClass(AstBuilder, items);
export { formatToAst };
export const RichTextNodeType = obj;
export const astFormatter = { format: formatToAst, builder: _moduleResult };