opencrush 0.3.16 → 0.3.18
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/index.js +150 -157
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35591,7 +35591,7 @@ function kt(e2, t2, r2, o2, n2, a2) {
|
|
|
35591
35591
|
g2 = e3;
|
|
35592
35592
|
}));
|
|
35593
35593
|
let E2 = Promise.resolve(void 0);
|
|
35594
|
-
return u(((P2,
|
|
35594
|
+
return u(((P2, W3) => {
|
|
35595
35595
|
let k2;
|
|
35596
35596
|
function O2() {
|
|
35597
35597
|
if (w2) return;
|
|
@@ -35642,7 +35642,7 @@ function kt(e2, t2, r2, o2, n2, a2) {
|
|
|
35642
35642
|
z2(void 0, e3, t3);
|
|
35643
35643
|
}
|
|
35644
35644
|
function F2(e3, t3) {
|
|
35645
|
-
return S2 = true, l2.releaseLock(), i2.releaseLock(), void 0 !== a2 && a2.removeEventListener("abort", k2), e3 ?
|
|
35645
|
+
return S2 = true, l2.releaseLock(), i2.releaseLock(), void 0 !== a2 && a2.removeEventListener("abort", k2), e3 ? W3(t3) : P2(void 0), null;
|
|
35646
35646
|
}
|
|
35647
35647
|
w2 || (b(i2.closed, B2, A2), b(l2.closed, (function() {
|
|
35648
35648
|
return S2 || (R2 = "closed"), null;
|
|
@@ -140337,9 +140337,9 @@ var init_esm_GWSBNV3N = __esm({
|
|
|
140337
140337
|
function Q2() {
|
|
140338
140338
|
if (F2) return O2;
|
|
140339
140339
|
F2 = 1;
|
|
140340
|
-
const e2 = 2147483647, s2 = 36, c2 = 1, o2 = 26, t2 = 38, d2 = 700, z2 = 72, y2 = 128, g2 = "-", P2 = /^xn--/, V2 = /[^\0-\x7F]/, G2 = /[\x2E\u3002\uFF0E\uFF61]/g,
|
|
140340
|
+
const e2 = 2147483647, s2 = 36, c2 = 1, o2 = 26, t2 = 38, d2 = 700, z2 = 72, y2 = 128, g2 = "-", P2 = /^xn--/, V2 = /[^\0-\x7F]/, G2 = /[\x2E\u3002\uFF0E\uFF61]/g, W3 = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" }, C2 = s2 - c2, h2 = Math.floor, I2 = String.fromCharCode;
|
|
140341
140341
|
function v2(a2) {
|
|
140342
|
-
throw new RangeError(
|
|
140342
|
+
throw new RangeError(W3[a2]);
|
|
140343
140343
|
}
|
|
140344
140344
|
function U2(a2, i2) {
|
|
140345
140345
|
const m2 = [];
|
|
@@ -140448,7 +140448,7 @@ var init_esm_GWSBNV3N = __esm({
|
|
|
140448
140448
|
}
|
|
140449
140449
|
return null;
|
|
140450
140450
|
};
|
|
140451
|
-
var
|
|
140451
|
+
var H3 = { DOMAIN_TOO_SHORT: "Domain name too short.", DOMAIN_TOO_LONG: "Domain name too long. It should be no more than 255 chars.", LABEL_STARTS_WITH_DASH: "Domain name label can not start with a dash.", LABEL_ENDS_WITH_DASH: "Domain name label can not end with a dash.", LABEL_TOO_LONG: "Domain name label should be at most 63 chars long.", LABEL_TOO_SHORT: "Domain name label should be at least 1 character long.", LABEL_INVALID_CHARS: "Domain name label can only contain alphanumeric characters or dashes." };
|
|
140452
140452
|
var oa = (e2) => {
|
|
140453
140453
|
const s2 = A2.toASCII(e2);
|
|
140454
140454
|
if (s2.length < 1) return "DOMAIN_TOO_SHORT";
|
|
@@ -140468,7 +140468,7 @@ var init_esm_GWSBNV3N = __esm({
|
|
|
140468
140468
|
let s2 = e2.slice(0).toLowerCase();
|
|
140469
140469
|
s2.charAt(s2.length - 1) === "." && (s2 = s2.slice(0, s2.length - 1));
|
|
140470
140470
|
const c2 = oa(s2);
|
|
140471
|
-
if (c2) return { input: e2, error: { message:
|
|
140471
|
+
if (c2) return { input: e2, error: { message: H3[c2], code: c2 } };
|
|
140472
140472
|
const o2 = { input: e2, tld: null, sld: null, domain: null, subdomain: null, listed: false }, t2 = s2.split(".");
|
|
140473
140473
|
if (t2[t2.length - 1] === "local") return o2;
|
|
140474
140474
|
const d2 = () => (/xn--/.test(s2) && (o2.domain && (o2.domain = A2.toASCII(o2.domain)), o2.subdomain && (o2.subdomain = A2.toASCII(o2.subdomain))), o2), z2 = aa(s2);
|
|
@@ -140484,7 +140484,7 @@ var init_esm_GWSBNV3N = __esm({
|
|
|
140484
140484
|
};
|
|
140485
140485
|
var sa = { parse: _3, get: N2, isValid: R2 };
|
|
140486
140486
|
exports2.default = sa;
|
|
140487
|
-
exports2.errorCodes =
|
|
140487
|
+
exports2.errorCodes = H3;
|
|
140488
140488
|
exports2.get = N2;
|
|
140489
140489
|
exports2.isValid = R2;
|
|
140490
140490
|
exports2.parse = _3;
|
|
@@ -184186,7 +184186,7 @@ var require_dist4 = __commonJS({
|
|
|
184186
184186
|
})(e3)) in t3 ? Object.defineProperty(t3, e3, { value: r22, enumerable: true, configurable: true, writable: true }) : t3[e3] = r22, t3;
|
|
184187
184187
|
}
|
|
184188
184188
|
__name(u2, "u");
|
|
184189
|
-
var l2, f2, s2, y2 = r2(425), p2 = y2.AggregateError, g2 = y2.AggregateErrorPrototype, v2 = y2.Array, h2 = y2.ArrayBuffer, d2 = y2.ArrayBufferPrototype, b2 = y2.ArrayIsArray, m2 = y2.ArrayPrototype, S2 = y2.ArrayPrototypeFilter, P2 = y2.ArrayPrototypeForEach, x2 = y2.ArrayPrototypeIncludes, w2 = y2.ArrayPrototypeIndexOf, A2 = y2.ArrayPrototypeJoin, O2 = y2.ArrayPrototypeMap, _3 = y2.ArrayPrototypePop, j2 = y2.ArrayPrototypePush, E2 = y2.ArrayPrototypePushApply, k2 = y2.ArrayPrototypeSlice, I2 = y2.ArrayPrototypeSort, R2 = y2.ArrayPrototypeSplice, L2 = y2.ArrayPrototypeUnshift, T2 = y2.BigIntPrototypeValueOf, B2 = y2.Boolean, z2 = y2.BooleanPrototype, M2 = y2.BooleanPrototypeValueOf, C2 = y2.DataView, D2 = y2.DataViewPrototype, N2 = y2.Date, F2 = y2.DatePrototype,
|
|
184189
|
+
var l2, f2, s2, y2 = r2(425), p2 = y2.AggregateError, g2 = y2.AggregateErrorPrototype, v2 = y2.Array, h2 = y2.ArrayBuffer, d2 = y2.ArrayBufferPrototype, b2 = y2.ArrayIsArray, m2 = y2.ArrayPrototype, S2 = y2.ArrayPrototypeFilter, P2 = y2.ArrayPrototypeForEach, x2 = y2.ArrayPrototypeIncludes, w2 = y2.ArrayPrototypeIndexOf, A2 = y2.ArrayPrototypeJoin, O2 = y2.ArrayPrototypeMap, _3 = y2.ArrayPrototypePop, j2 = y2.ArrayPrototypePush, E2 = y2.ArrayPrototypePushApply, k2 = y2.ArrayPrototypeSlice, I2 = y2.ArrayPrototypeSort, R2 = y2.ArrayPrototypeSplice, L2 = y2.ArrayPrototypeUnshift, T2 = y2.BigIntPrototypeValueOf, B2 = y2.Boolean, z2 = y2.BooleanPrototype, M2 = y2.BooleanPrototypeValueOf, C2 = y2.DataView, D2 = y2.DataViewPrototype, N2 = y2.Date, F2 = y2.DatePrototype, W3 = y2.DatePrototypeGetTime, H3 = y2.DatePrototypeToISOString, U2 = y2.DatePrototypeToString, G2 = y2.Error, V2 = y2.ErrorPrototype, Z2 = y2.ErrorPrototypeToString, $2 = y2.Function, Y2 = y2.FunctionPrototype, q2 = y2.FunctionPrototypeBind, J2 = y2.FunctionPrototypeCall, K2 = y2.FunctionPrototypeSymbolHasInstance, Q2 = y2.FunctionPrototypeToString, X2 = y2.JSONStringify, tt2 = y2.Map, et2 = y2.MapPrototype, rt2 = y2.MapPrototypeEntries, nt2 = y2.MapPrototypeGetSize, ot2 = y2.MathFloor, at2 = y2.MathMax, it2 = y2.MathMin, ct2 = y2.MathRound, ut2 = y2.MathSqrt, lt2 = y2.MathTrunc, ft2 = y2.Number, st2 = y2.NumberIsFinite, yt2 = y2.NumberIsNaN, pt2 = y2.NumberParseFloat, gt2 = y2.NumberParseInt, vt2 = y2.NumberPrototype, ht2 = y2.NumberPrototypeToString, dt2 = y2.NumberPrototypeValueOf, bt2 = y2.Object, mt2 = y2.ObjectAssign, St2 = y2.ObjectDefineProperty, Pt2 = y2.ObjectGetOwnPropertyDescriptor, xt2 = y2.ObjectGetOwnPropertyNames, wt2 = y2.ObjectGetOwnPropertySymbols, At2 = y2.ObjectGetPrototypeOf, Ot2 = y2.ObjectIs, _t2 = y2.ObjectKeys, jt2 = y2.ObjectPrototype, Et2 = y2.ObjectPrototypeHasOwnProperty, kt2 = y2.ObjectPrototypePropertyIsEnumerable, It2 = y2.ObjectSeal, Rt2 = y2.ObjectSetPrototypeOf, Lt2 = y2.Promise, Tt2 = y2.PromisePrototype, Bt2 = y2.RangeError, zt2 = y2.RangeErrorPrototype, Mt2 = y2.ReflectApply, Ct2 = y2.ReflectOwnKeys, Dt2 = y2.RegExp, Nt2 = y2.RegExpPrototype, Ft2 = y2.RegExpPrototypeExec, Wt2 = y2.RegExpPrototypeSymbolReplace, Ht2 = y2.RegExpPrototypeSymbolSplit, Ut2 = y2.RegExpPrototypeToString, Gt2 = y2.SafeMap, Vt2 = y2.SafeSet, Zt2 = y2.SafeStringIterator, $t2 = y2.Set, Yt2 = y2.SetPrototype, qt2 = y2.SetPrototypeGetSize, Jt2 = y2.SetPrototypeValues, Kt2 = y2.String, Qt2 = y2.StringPrototype, Xt2 = y2.StringPrototypeCharCodeAt, te2 = y2.StringPrototypeCodePointAt, ee2 = y2.StringPrototypeEndsWith, re2 = y2.StringPrototypeIncludes, ne2 = y2.StringPrototypeIndexOf, oe2 = y2.StringPrototypeLastIndexOf, ae2 = y2.StringPrototypeNormalize, ie2 = y2.StringPrototypePadEnd, ce2 = y2.StringPrototypePadStart, ue2 = y2.StringPrototypeRepeat, le2 = y2.StringPrototypeReplace, fe2 = y2.StringPrototypeReplaceAll, se2 = y2.StringPrototypeSlice, ye2 = y2.StringPrototypeSplit, pe2 = y2.StringPrototypeStartsWith, ge2 = y2.StringPrototypeToLowerCase, ve2 = y2.StringPrototypeTrim, he2 = y2.StringPrototypeValueOf, de2 = y2.SymbolIterator, be2 = y2.SymbolPrototypeToString, me2 = y2.SymbolPrototypeValueOf, Se2 = y2.SymbolToPrimitive, Pe2 = y2.SymbolToStringTag, xe2 = y2.TypeError, we2 = y2.TypeErrorPrototype, Ae2 = y2.TypedArray, Oe2 = y2.TypedArrayPrototype, _e2 = y2.TypedArrayPrototypeGetLength, je2 = y2.TypedArrayPrototypeGetSymbolToStringTag, Ee2 = y2.Uint8Array, ke2 = y2.WeakMap, Ie2 = y2.WeakMapPrototype, Re2 = y2.WeakSet, Le2 = y2.WeakSetPrototype, Te2 = y2.globalThis, Be2 = y2.internalBinding, ze2 = y2.uncurryThis, Me2 = r2(153), Ce2 = Me2.constants, De2 = Ce2.ALL_PROPERTIES, Ne2 = Ce2.ONLY_ENUMERABLE, Fe2 = Ce2.kPending, We2 = Ce2.kRejected, He2 = Me2.getOwnNonIndexProperties, Ue2 = Me2.getPromiseDetails, Ge2 = Me2.getProxyDetails, Ve2 = Me2.previewEntries, Ze2 = Me2.getConstructorName, $e2 = Me2.getExternalValue, Ye2 = Me2.Proxy, qe2 = r2(923), Je2 = qe2.customInspectSymbol, Ke2 = qe2.isError, Qe2 = qe2.join, Xe2 = qe2.removeColors, tr2 = r2(924).isStackOverflowError, er2 = r2(617), rr2 = er2.isAsyncFunction, nr2 = er2.isGeneratorFunction, or2 = er2.isAnyArrayBuffer, ar2 = er2.isArrayBuffer, ir2 = er2.isArgumentsObject, cr2 = er2.isBoxedPrimitive, ur2 = er2.isDataView, lr2 = er2.isExternal, fr2 = er2.isMap, sr2 = er2.isMapIterator, yr2 = er2.isModuleNamespaceObject, pr2 = er2.isNativeError, gr2 = er2.isPromise, vr2 = er2.isSet, hr2 = er2.isSetIterator, dr2 = er2.isWeakMap, br2 = er2.isWeakSet, mr2 = er2.isRegExp, Sr2 = er2.isDate, Pr = er2.isTypedArray, xr = er2.isStringObject, wr2 = er2.isNumberObject, Ar = er2.isBooleanObject, Or2 = er2.isBigIntObject, _r2 = r2(229), jr = r2(705).BuiltinModule, Er = r2(116), kr = Er.validateObject, Ir = Er.validateString, Rr2 = Er.kValidateObjectAllowArray;
|
|
184190
184190
|
function Lr(t3) {
|
|
184191
184191
|
return (f2 = f2 || r2(802)).pathToFileURL(t3).href;
|
|
184192
184192
|
}
|
|
@@ -184475,7 +184475,7 @@ var require_dist4 = __commonJS({
|
|
|
184475
184475
|
var V22 = sn(u3, l3, "RegExp");
|
|
184476
184476
|
if ("RegExp " !== V22 && (v33 = "".concat(V22).concat(v33)), 0 === i3.length && void 0 === c22 || n22 > t4.depth && null !== t4.depth) return t4.stylize(v33, "regexp");
|
|
184477
184477
|
} else if (Sr2(e4)) {
|
|
184478
|
-
v33 = yt2(
|
|
184478
|
+
v33 = yt2(W3(e4)) ? U2(e4) : H3(e4);
|
|
184479
184479
|
var Z22 = sn(u3, l3, "Date");
|
|
184480
184480
|
if ("Date " !== Z22 && (v33 = "".concat(Z22).concat(v33)), 0 === i3.length && void 0 === c22) return t4.stylize(v33, "date");
|
|
184481
184481
|
} else if (Ke2(e4)) {
|
|
@@ -185712,7 +185712,7 @@ var require_dist4 = __commonJS({
|
|
|
185712
185712
|
var e3 = t3.name, r22 = t3.original;
|
|
185713
185713
|
P2[e3] = r22, z2(r22, P2, e3), z2(r22.prototype, P2, "".concat(e3, "Prototype"));
|
|
185714
185714
|
}), P2.IteratorPrototype = Reflect.getPrototypeOf(P2.ArrayIteratorPrototype);
|
|
185715
|
-
var M2 = P2.ArrayPrototypeForEach, C2 = P2.FinalizationRegistry, D2 = P2.FunctionPrototypeCall, N2 = P2.Map, F2 = P2.ObjectFreeze,
|
|
185715
|
+
var M2 = P2.ArrayPrototypeForEach, C2 = P2.FinalizationRegistry, D2 = P2.FunctionPrototypeCall, N2 = P2.Map, F2 = P2.ObjectFreeze, W3 = P2.ObjectSetPrototypeOf, H3 = P2.RegExp, U2 = P2.Set, G2 = P2.SymbolIterator, V2 = P2.WeakMap, Z2 = P2.WeakRef, $2 = P2.WeakSet, Y2 = /* @__PURE__ */ __name(function(t3, e3) {
|
|
185716
185716
|
var r22 = (function() {
|
|
185717
185717
|
return f2(/* @__PURE__ */ __name(function e4(r3) {
|
|
185718
185718
|
u2(this, e4), this._iterator = t3(r3);
|
|
@@ -185722,7 +185722,7 @@ var require_dist4 = __commonJS({
|
|
|
185722
185722
|
return this;
|
|
185723
185723
|
}, "value") }]);
|
|
185724
185724
|
})();
|
|
185725
|
-
return
|
|
185725
|
+
return W3(r22.prototype, null), F2(r22.prototype), F2(r22), r22;
|
|
185726
185726
|
}, "Y");
|
|
185727
185727
|
P2.SafeArrayIterator = Y2(P2.ArrayPrototypeSymbolIterator, P2.ArrayIteratorPrototypeNext), P2.SafeStringIterator = Y2(P2.StringPrototypeSymbolIterator, P2.StringIteratorPrototypeNext);
|
|
185728
185728
|
var q2 = /* @__PURE__ */ __name(function(t3, e3) {
|
|
@@ -185747,7 +185747,7 @@ var require_dist4 = __commonJS({
|
|
|
185747
185747
|
}
|
|
185748
185748
|
});
|
|
185749
185749
|
} else q2(t3.prototype, e3.prototype);
|
|
185750
|
-
return q2(t3, e3),
|
|
185750
|
+
return q2(t3, e3), W3(e3.prototype, null), F2(e3.prototype), F2(e3), e3;
|
|
185751
185751
|
}, "J");
|
|
185752
185752
|
P2.makeSafe = J2, P2.SafeMap = J2(N2, (function(t3) {
|
|
185753
185753
|
function e3(t4) {
|
|
@@ -185793,8 +185793,8 @@ var require_dist4 = __commonJS({
|
|
|
185793
185793
|
if ("config" === t3) return { hasIntl: false };
|
|
185794
185794
|
throw new Error('unknown module: "'.concat(t3, '"'));
|
|
185795
185795
|
}, P2._stringPrototypeReplaceAll = function(t3, e3, r22) {
|
|
185796
|
-
return "[object regexp]" === Object.prototype.toString.call(e3).toLowerCase() ? t3.replace(e3, r22) : t3.replace(new
|
|
185797
|
-
}, P2.StringPrototypeReplaceAll = P2.StringPrototypeReplaceAll || P2._stringPrototypeReplaceAll,
|
|
185796
|
+
return "[object regexp]" === Object.prototype.toString.call(e3).toLowerCase() ? t3.replace(e3, r22) : t3.replace(new H3(e3, "g"), r22);
|
|
185797
|
+
}, P2.StringPrototypeReplaceAll = P2.StringPrototypeReplaceAll || P2._stringPrototypeReplaceAll, W3(P2, null), F2(P2), t22.exports = P2;
|
|
185798
185798
|
}, 569: (t22, e22, r2) => {
|
|
185799
185799
|
function n2(t3) {
|
|
185800
185800
|
return n2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t4) {
|
|
@@ -186070,7 +186070,7 @@ var require_dist4 = __commonJS({
|
|
|
186070
186070
|
}, l2(t3, e3);
|
|
186071
186071
|
}
|
|
186072
186072
|
__name(l2, "l");
|
|
186073
|
-
var f2, s2, y2 = r2(425), p2 = y2.ArrayIsArray, g2 = y2.ArrayPrototypeIncludes, v2 = y2.ArrayPrototypeIndexOf, h2 = y2.ArrayPrototypeJoin, d2 = y2.ArrayPrototypePush, b2 = y2.ArrayPrototypeSlice, m2 = y2.ArrayPrototypeSplice, S2 = y2.Error, P2 = y2.ErrorCaptureStackTrace, x2 = y2.JSONStringify, w2 = y2.ObjectDefineProperty, A2 = y2.ReflectApply, O2 = y2.RegExpPrototypeExec, _3 = y2.SafeMap, j2 = y2.SafeWeakMap, E2 = y2.String, k2 = y2.StringPrototypeEndsWith, I2 = y2.StringPrototypeIncludes, R2 = y2.StringPrototypeIndexOf, L2 = y2.StringPrototypeSlice, T2 = y2.StringPrototypeToLowerCase, B2 = y2.Symbol, z2 = y2.TypeError, M2 = B2("kIsNodeError"), C2 = new _3(), D2 = {}, N2 = /^[A-Z][a-zA-Z0-9]*$/, F2 = ["string", "function", "number", "object", "Function", "Object", "boolean", "bigint", "symbol"],
|
|
186073
|
+
var f2, s2, y2 = r2(425), p2 = y2.ArrayIsArray, g2 = y2.ArrayPrototypeIncludes, v2 = y2.ArrayPrototypeIndexOf, h2 = y2.ArrayPrototypeJoin, d2 = y2.ArrayPrototypePush, b2 = y2.ArrayPrototypeSlice, m2 = y2.ArrayPrototypeSplice, S2 = y2.Error, P2 = y2.ErrorCaptureStackTrace, x2 = y2.JSONStringify, w2 = y2.ObjectDefineProperty, A2 = y2.ReflectApply, O2 = y2.RegExpPrototypeExec, _3 = y2.SafeMap, j2 = y2.SafeWeakMap, E2 = y2.String, k2 = y2.StringPrototypeEndsWith, I2 = y2.StringPrototypeIncludes, R2 = y2.StringPrototypeIndexOf, L2 = y2.StringPrototypeSlice, T2 = y2.StringPrototypeToLowerCase, B2 = y2.Symbol, z2 = y2.TypeError, M2 = B2("kIsNodeError"), C2 = new _3(), D2 = {}, N2 = /^[A-Z][a-zA-Z0-9]*$/, F2 = ["string", "function", "number", "object", "Function", "Object", "boolean", "bigint", "symbol"], W3 = new j2(), H3 = r2(229), U2 = null;
|
|
186074
186074
|
function G2(t3, e3) {
|
|
186075
186075
|
var r22 = (function(t4) {
|
|
186076
186076
|
function r3() {
|
|
@@ -186110,7 +186110,7 @@ var require_dist4 = __commonJS({
|
|
|
186110
186110
|
__name(V2, "V");
|
|
186111
186111
|
function Z2(t3, e3, r22) {
|
|
186112
186112
|
var n22 = C2.get(t3);
|
|
186113
|
-
if ("function" == typeof n22) return
|
|
186113
|
+
if ("function" == typeof n22) return H3(n22.length <= e3.length, "Code: ".concat(t3, "; The provided arguments length (").concat(e3.length, ") does not ") + "match the required ones (".concat(n22.length, ").")), A2(n22, r22, e3);
|
|
186114
186114
|
}
|
|
186115
186115
|
__name(Z2, "Z");
|
|
186116
186116
|
var $2 = B2("kEnhanceStackBeforeInspector");
|
|
@@ -186172,11 +186172,11 @@ var require_dist4 = __commonJS({
|
|
|
186172
186172
|
s2 = t4.message, f2 = t4.name;
|
|
186173
186173
|
}
|
|
186174
186174
|
return t3 && t3.name === f2 && t3.message === s2;
|
|
186175
|
-
}, "isStackOverflowError"), kEnhanceStackBeforeInspector: $2, kIsNodeError: M2, overrideStackTrace:
|
|
186175
|
+
}, "isStackOverflowError"), kEnhanceStackBeforeInspector: $2, kIsNodeError: M2, overrideStackTrace: W3 }, V2("ERR_INTERNAL_ASSERTION", function(t3) {
|
|
186176
186176
|
var e3 = "This is caused by either a bug in Node.js or incorrect usage of Node.js internals.\nPlease open an issue with this stack trace at https://github.com/nodejs/node/issues\n";
|
|
186177
186177
|
return void 0 === t3 ? e3 : "".concat(t3, "\n").concat(e3);
|
|
186178
186178
|
}, S2), V2("ERR_INVALID_ARG_TYPE", function(t3, e3, r22) {
|
|
186179
|
-
|
|
186179
|
+
H3("string" == typeof t3, "'name' must be a string"), p2(e3) || (e3 = [e3]);
|
|
186180
186180
|
var o22 = "The ";
|
|
186181
186181
|
if (k2(t3, " argument")) o22 += "".concat(t3, " ");
|
|
186182
186182
|
else {
|
|
@@ -186224,7 +186224,7 @@ var require_dist4 = __commonJS({
|
|
|
186224
186224
|
try {
|
|
186225
186225
|
for (f22.s(); !(i22 = f22.n()).done; ) {
|
|
186226
186226
|
var s22 = i22.value;
|
|
186227
|
-
|
|
186227
|
+
H3("string" == typeof s22, "All expected entries have to be of type string"), g2(F2, s22) ? d2(c22, T2(s22)) : null !== O2(N2, s22) ? d2(u22, s22) : (H3("object" !== s22, 'The value "object" should be written as "Object"'), d2(l22, s22));
|
|
186228
186228
|
}
|
|
186229
186229
|
} catch (t4) {
|
|
186230
186230
|
f22.e(t4);
|
|
@@ -199719,10 +199719,10 @@ var require_cjs7 = __commonJS({
|
|
|
199719
199719
|
return "[object Set]" === m22(e3);
|
|
199720
199720
|
}
|
|
199721
199721
|
__name(N2, "N");
|
|
199722
|
-
function
|
|
199722
|
+
function W3(e3) {
|
|
199723
199723
|
return "[object WeakMap]" === m22(e3);
|
|
199724
199724
|
}
|
|
199725
|
-
__name(
|
|
199725
|
+
__name(W3, "W");
|
|
199726
199726
|
function $2(e3) {
|
|
199727
199727
|
return "[object WeakSet]" === m22(e3);
|
|
199728
199728
|
}
|
|
@@ -199751,10 +199751,10 @@ var require_cjs7 = __commonJS({
|
|
|
199751
199751
|
return "undefined" != typeof SharedArrayBuffer && (J2.working ? J2(e3) : e3 instanceof SharedArrayBuffer);
|
|
199752
199752
|
}
|
|
199753
199753
|
__name(_3, "_");
|
|
199754
|
-
function
|
|
199754
|
+
function H3(e3) {
|
|
199755
199755
|
return O2(e3, h22);
|
|
199756
199756
|
}
|
|
199757
|
-
__name(
|
|
199757
|
+
__name(H3, "H");
|
|
199758
199758
|
function Z2(e3) {
|
|
199759
199759
|
return O2(e3, j2);
|
|
199760
199760
|
}
|
|
@@ -199779,8 +199779,8 @@ var require_cjs7 = __commonJS({
|
|
|
199779
199779
|
return "undefined" != typeof Map && (T22.working ? T22(e3) : e3 instanceof Map);
|
|
199780
199780
|
}, N2.working = "undefined" != typeof Set && N2(/* @__PURE__ */ new Set()), o$2.isSet = function(e3) {
|
|
199781
199781
|
return "undefined" != typeof Set && (N2.working ? N2(e3) : e3 instanceof Set);
|
|
199782
|
-
},
|
|
199783
|
-
return "undefined" != typeof WeakMap && (
|
|
199782
|
+
}, W3.working = "undefined" != typeof WeakMap && W3(/* @__PURE__ */ new WeakMap()), o$2.isWeakMap = function(e3) {
|
|
199783
|
+
return "undefined" != typeof WeakMap && (W3.working ? W3(e3) : e3 instanceof WeakMap);
|
|
199784
199784
|
}, $2.working = "undefined" != typeof WeakSet && $2(/* @__PURE__ */ new WeakSet()), o$2.isWeakSet = function(e3) {
|
|
199785
199785
|
return $2(e3);
|
|
199786
199786
|
}, C2.working = "undefined" != typeof ArrayBuffer && C2(new ArrayBuffer()), o$2.isArrayBuffer = V2, G2.working = "undefined" != typeof ArrayBuffer && "undefined" != typeof DataView && G2(new DataView(new ArrayBuffer(1), 0, 1)), o$2.isDataView = R2, J2.working = "undefined" != typeof SharedArrayBuffer && J2(new SharedArrayBuffer()), o$2.isSharedArrayBuffer = _3, o$2.isAsyncFunction = function(e3) {
|
|
@@ -199793,8 +199793,8 @@ var require_cjs7 = __commonJS({
|
|
|
199793
199793
|
return "[object Generator]" === m22(e3);
|
|
199794
199794
|
}, o$2.isWebAssemblyCompiledModule = function(e3) {
|
|
199795
199795
|
return "[object WebAssembly.Module]" === m22(e3);
|
|
199796
|
-
}, o$2.isNumberObject =
|
|
199797
|
-
return
|
|
199796
|
+
}, o$2.isNumberObject = H3, o$2.isStringObject = Z2, o$2.isBooleanObject = q2, o$2.isBigIntObject = K2, o$2.isSymbolObject = L2, o$2.isBoxedPrimitive = function(e3) {
|
|
199797
|
+
return H3(e3) || Z2(e3) || q2(e3) || K2(e3) || L2(e3);
|
|
199798
199798
|
}, o$2.isAnyArrayBuffer = function(e3) {
|
|
199799
199799
|
return l$1 && (V2(e3) || _3(e3));
|
|
199800
199800
|
}, ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(e3) {
|
|
@@ -245570,7 +245570,7 @@ async function runSetupWizard() {
|
|
|
245570
245570
|
`) + source_default.cyan(" npx opencrush@latest start\n\n") + source_default.white(`Edit ${pro.their} personality:
|
|
245571
245571
|
`) + source_default.cyan(` characters/${characterName}/SOUL.md
|
|
245572
245572
|
|
|
245573
|
-
`) + (setupMode === "quick" ? source_default.gray("Unlock voice/browser/Twitter: run setup again \u2192 Full setup\n\n") : "") + source_default.gray("https://github.com/
|
|
245573
|
+
`) + (setupMode === "quick" ? source_default.gray("Unlock voice/browser/Twitter: run setup again \u2192 Full setup\n\n") : "") + source_default.gray("https://github.com/heloraai/Opencrush"),
|
|
245574
245574
|
{ padding: 1, margin: 1, borderStyle: "round", borderColor: "magenta" }
|
|
245575
245575
|
));
|
|
245576
245576
|
const { startNow } = await esm_default12.prompt([{
|
|
@@ -245611,7 +245611,7 @@ __export(card_exports, {
|
|
|
245611
245611
|
generateCard: () => generateCard
|
|
245612
245612
|
});
|
|
245613
245613
|
function parseIdentity(identityPath) {
|
|
245614
|
-
var _a3, _b2, _c, _d
|
|
245614
|
+
var _a3, _b2, _c, _d;
|
|
245615
245615
|
const raw = (0, import_fs18.readFileSync)(identityPath, "utf-8");
|
|
245616
245616
|
const { content } = (0, import_gray_matter3.default)(raw);
|
|
245617
245617
|
const nameMatch = content.match(/^#\s+(.+)$/m);
|
|
@@ -245622,159 +245622,122 @@ function parseIdentity(identityPath) {
|
|
|
245622
245622
|
const locationRaw = ((_b2 = fromMatch == null ? void 0 : fromMatch[1]) == null ? void 0 : _b2.trim()) ?? "";
|
|
245623
245623
|
const location = locationRaw.replace(/\s*\(.*\)/, "").split(" \u2014 ")[0].split(" - ")[0].trim();
|
|
245624
245624
|
const cleanLocation = location.length > 40 || location.toLowerCase().startsWith("says ") ? "" : location;
|
|
245625
|
+
const jobMatch = content.match(/\*\*Job:\*\*\s*(.+)/i);
|
|
245626
|
+
const jobRaw = ((_c = jobMatch == null ? void 0 : jobMatch[1]) == null ? void 0 : _c.trim()) ?? "";
|
|
245627
|
+
const job = jobRaw.split(/[—–\.\+]/).map((s2) => s2.trim()).filter(Boolean)[0] ?? "";
|
|
245625
245628
|
const hobbiesMatch = content.match(/\*\*Hobbies:\*\*\s*(.+)/i);
|
|
245626
245629
|
const hobbiesRaw = (hobbiesMatch == null ? void 0 : hobbiesMatch[1]) ?? "";
|
|
245627
|
-
const tags = splitRespectingParens(hobbiesRaw).map((t2) => t2.trim()).filter(Boolean).map((t2) => t2.length >
|
|
245630
|
+
const tags = splitRespectingParens(hobbiesRaw).map((t2) => t2.trim()).filter(Boolean).map((t2) => t2.length > 30 ? t2.split(/[,(]/)[0].trim() : t2).filter((t2) => t2.length > 1).slice(0, 5);
|
|
245631
|
+
let vibe = "";
|
|
245628
245632
|
const soulPath = identityPath.replace("IDENTITY.md", "SOUL.md");
|
|
245629
|
-
let description = "";
|
|
245630
245633
|
if ((0, import_fs18.existsSync)(soulPath)) {
|
|
245631
245634
|
const soul = (0, import_fs18.readFileSync)(soulPath, "utf-8");
|
|
245632
|
-
const
|
|
245633
|
-
if (
|
|
245634
|
-
description = ((_c = vibeLine.trim().split(".")[0]) == null ? void 0 : _c.trim()) ?? "";
|
|
245635
|
-
}
|
|
245635
|
+
const line = soul.split("\n").find((l2) => l2.trim() && !l2.startsWith("#") && !l2.startsWith("-"));
|
|
245636
|
+
if (line) vibe = ((_d = line.trim().split(".")[0]) == null ? void 0 : _d.trim()) ?? "";
|
|
245636
245637
|
}
|
|
245637
|
-
|
|
245638
|
-
const bgMatch = content.match(/## (?:Background|Appearance)\s*\n+(.+)/i);
|
|
245639
|
-
description = ((_e2 = (_d = bgMatch == null ? void 0 : bgMatch[1]) == null ? void 0 : _d.trim().split(".")[0]) == null ? void 0 : _e2.trim()) ?? "";
|
|
245640
|
-
}
|
|
245641
|
-
const { data: meta } = (0, import_gray_matter3.default)(raw);
|
|
245642
|
-
const gender = meta.gender ?? "female";
|
|
245643
|
-
return { name, age, location: cleanLocation, tags, description, gender };
|
|
245638
|
+
return { name, age, location: cleanLocation, job, tags, vibe };
|
|
245644
245639
|
}
|
|
245645
245640
|
function splitRespectingParens(str2) {
|
|
245646
245641
|
const result = [];
|
|
245647
|
-
let depth = 0;
|
|
245648
|
-
let current = "";
|
|
245642
|
+
let depth = 0, current = "";
|
|
245649
245643
|
for (const ch of str2) {
|
|
245650
245644
|
if (ch === "(") depth++;
|
|
245651
245645
|
else if (ch === ")") depth--;
|
|
245652
245646
|
if (ch === "," && depth === 0) {
|
|
245653
245647
|
result.push(current);
|
|
245654
245648
|
current = "";
|
|
245655
|
-
} else
|
|
245656
|
-
current += ch;
|
|
245657
|
-
}
|
|
245649
|
+
} else current += ch;
|
|
245658
245650
|
}
|
|
245659
245651
|
if (current) result.push(current);
|
|
245660
245652
|
return result;
|
|
245661
245653
|
}
|
|
245662
|
-
|
|
245663
|
-
|
|
245664
|
-
const sharp = (await import("sharp")).default;
|
|
245665
|
-
const { data, info } = await sharp(imagePath).resize(1, 1, { fit: "cover" }).raw().toBuffer({ resolveWithObject: true });
|
|
245666
|
-
const r2 = data[0], g2 = data[1], b2 = data[2];
|
|
245667
|
-
const darken = (v2, f2) => Math.round(v2 * f2);
|
|
245668
|
-
const from2 = `rgb(${darken(r2, 0.25)}, ${darken(g2, 0.25)}, ${darken(b2, 0.25)})`;
|
|
245669
|
-
const to = `rgb(${darken(r2, 0.12)}, ${darken(g2, 0.12)}, ${darken(b2, 0.12)})`;
|
|
245670
|
-
return { from: from2, to };
|
|
245671
|
-
} catch {
|
|
245672
|
-
return { from: "#1a1a2e", to: "#0f0f1a" };
|
|
245673
|
-
}
|
|
245674
|
-
}
|
|
245675
|
-
function pickGradient(name) {
|
|
245676
|
-
const gradients = [
|
|
245677
|
-
{ from: "#1a1a2e", to: "#0f0f1a" },
|
|
245678
|
-
// deep navy
|
|
245679
|
-
{ from: "#2d1b3d", to: "#150d1e" },
|
|
245680
|
-
// purple-dark
|
|
245681
|
-
{ from: "#1b2d2d", to: "#0a1414" },
|
|
245682
|
-
// teal-dark
|
|
245683
|
-
{ from: "#2d1b1b", to: "#140d0d" },
|
|
245684
|
-
// warm dark
|
|
245685
|
-
{ from: "#1a1a30", to: "#0d0d18" },
|
|
245686
|
-
// midnight
|
|
245687
|
-
{ from: "#2d241b", to: "#14120d" }
|
|
245688
|
-
// amber dark
|
|
245689
|
-
];
|
|
245690
|
-
const hash = name.split("").reduce((acc, ch) => acc + ch.charCodeAt(0), 0);
|
|
245691
|
-
return gradients[hash % gradients.length];
|
|
245654
|
+
function escapeXml(str2) {
|
|
245655
|
+
return str2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
245692
245656
|
}
|
|
245693
|
-
function
|
|
245657
|
+
function buildTextOverlay(data, bgR = 20, bgG = 20, bgB = 30) {
|
|
245694
245658
|
const S2 = SCALE;
|
|
245695
|
-
const textX =
|
|
245696
|
-
const
|
|
245697
|
-
const
|
|
245698
|
-
const
|
|
245699
|
-
const
|
|
245700
|
-
const
|
|
245701
|
-
const
|
|
245659
|
+
const textX = 56 * S2;
|
|
245660
|
+
const panelW = 520 * S2;
|
|
245661
|
+
const availW = panelW - textX - 30 * S2;
|
|
245662
|
+
const meta = [data.age, data.location].filter(Boolean).join(" \xB7 ");
|
|
245663
|
+
const lineCount = 1 + (meta ? 1 : 0) + (data.job ? 1 : 0) + 1 + (data.tags.length > 0 ? 1 : 0) + (data.vibe ? 1 : 0);
|
|
245664
|
+
const blockH = lineCount * 32 * S2;
|
|
245665
|
+
const startY = Math.max(50 * S2, Math.round((H2 - blockH) / 2) - 20 * S2);
|
|
245666
|
+
let y2 = startY;
|
|
245667
|
+
const nameY = y2;
|
|
245668
|
+
y2 += 50 * S2;
|
|
245669
|
+
const metaY = y2;
|
|
245670
|
+
if (meta) y2 += 32 * S2;
|
|
245671
|
+
const jobY = y2;
|
|
245672
|
+
if (data.job) y2 += 30 * S2;
|
|
245673
|
+
y2 += 12 * S2;
|
|
245674
|
+
const tagStartY = y2;
|
|
245702
245675
|
let inlineTags = "";
|
|
245703
245676
|
let offsetX = textX;
|
|
245704
245677
|
let rowY = tagStartY;
|
|
245705
|
-
const
|
|
245706
|
-
const maxRows = 2;
|
|
245678
|
+
const rowH = 28 * S2;
|
|
245707
245679
|
let currentRow = 1;
|
|
245680
|
+
const maxRows = 2;
|
|
245681
|
+
const charW = 6.2 * S2;
|
|
245682
|
+
const padW = 16 * S2;
|
|
245708
245683
|
for (const tag of data.tags) {
|
|
245709
|
-
const
|
|
245710
|
-
const
|
|
245711
|
-
|
|
245684
|
+
const maxChars = Math.floor((availW - padW) / charW);
|
|
245685
|
+
const label = tag.length > maxChars ? tag.slice(0, maxChars - 1) + "\u2026" : tag;
|
|
245686
|
+
const w2 = Math.ceil(label.length * charW + padW);
|
|
245687
|
+
if (offsetX + w2 > textX + availW) {
|
|
245712
245688
|
if (currentRow >= maxRows) break;
|
|
245713
245689
|
currentRow++;
|
|
245714
245690
|
offsetX = textX;
|
|
245715
|
-
rowY +=
|
|
245691
|
+
rowY += rowH;
|
|
245716
245692
|
}
|
|
245717
|
-
const bubbleH = 22 * S2;
|
|
245718
|
-
const bubbleR = 11 * S2;
|
|
245719
245693
|
inlineTags += `
|
|
245720
|
-
<rect x="${offsetX}" y="${rowY - 13 * S2}" width="${w2}" height="${
|
|
245721
|
-
<text x="${offsetX +
|
|
245694
|
+
<rect x="${offsetX}" y="${rowY - 13 * S2}" width="${w2}" height="${24 * S2}" rx="${12 * S2}" fill="rgba(255,255,255,0.12)" />
|
|
245695
|
+
<text x="${offsetX + 8 * S2}" y="${rowY + 3 * S2}" font-family="system-ui, -apple-system, sans-serif" font-size="${11 * S2}" fill="#ddd">${escapeXml(label)}</text>
|
|
245722
245696
|
`;
|
|
245723
245697
|
offsetX += w2 + 6 * S2;
|
|
245724
245698
|
}
|
|
245725
|
-
const
|
|
245726
|
-
const
|
|
245727
|
-
|
|
245699
|
+
const vibeY = tagStartY + currentRow * rowH + 20 * S2;
|
|
245700
|
+
const jobMax = Math.floor(availW / (7 * S2));
|
|
245701
|
+
const vibeMax = Math.floor(availW / (6.5 * S2));
|
|
245702
|
+
const jobText = data.job.length > jobMax ? data.job.slice(0, jobMax - 1) + "\u2026" : data.job;
|
|
245703
|
+
const vibeText = data.vibe.length > vibeMax ? data.vibe.slice(0, vibeMax - 1) + "\u2026" : data.vibe;
|
|
245704
|
+
return `<svg width="${panelW}" height="${H2}" xmlns="http://www.w3.org/2000/svg">
|
|
245705
|
+
<!-- Panel background using sampled color -->
|
|
245728
245706
|
<defs>
|
|
245729
|
-
<linearGradient id="
|
|
245730
|
-
<stop offset="0%" stop-color="${
|
|
245731
|
-
<stop offset="100%" stop-color="${
|
|
245707
|
+
<linearGradient id="panel" x1="0" y1="0" x2="1" y2="0">
|
|
245708
|
+
<stop offset="0%" stop-color="rgba(${bgR},${bgG},${bgB},0.92)" />
|
|
245709
|
+
<stop offset="100%" stop-color="rgba(${bgR},${bgG},${bgB},0.80)" />
|
|
245732
245710
|
</linearGradient>
|
|
245733
|
-
<clipPath id="circle">
|
|
245734
|
-
<circle cx="${PORTRAIT_X + PORTRAIT_SIZE / 2}" cy="${PORTRAIT_Y + PORTRAIT_SIZE / 2}" r="${PORTRAIT_SIZE / 2}" />
|
|
245735
|
-
</clipPath>
|
|
245736
245711
|
</defs>
|
|
245737
|
-
|
|
245738
|
-
<rect width="${WIDTH}" height="${HEIGHT}" fill="url(#bg)" />
|
|
245739
|
-
|
|
245740
|
-
<!-- Portrait ring -->
|
|
245741
|
-
<circle cx="${PORTRAIT_X + PORTRAIT_SIZE / 2}" cy="${PORTRAIT_Y + PORTRAIT_SIZE / 2}" r="${PORTRAIT_SIZE / 2 + 2 * S2}" fill="none" stroke="rgba(255,255,255,0.10)" stroke-width="${2 * S2}" />
|
|
245712
|
+
<rect width="${panelW}" height="${H2}" fill="url(#panel)" />
|
|
245742
245713
|
|
|
245743
245714
|
<!-- Name -->
|
|
245744
245715
|
<text x="${textX}" y="${nameY}" font-family="system-ui, -apple-system, sans-serif" font-size="${42 * S2}" font-weight="bold" fill="white">${escapeXml(data.name)}</text>
|
|
245745
245716
|
|
|
245746
|
-
<!--
|
|
245747
|
-
${
|
|
245717
|
+
<!-- Meta -->
|
|
245718
|
+
${meta ? `<text x="${textX}" y="${metaY}" font-family="system-ui, -apple-system, sans-serif" font-size="${16 * S2}" fill="rgba(255,255,255,0.7)">${escapeXml(meta)}</text>` : ""}
|
|
245719
|
+
|
|
245720
|
+
<!-- Job -->
|
|
245721
|
+
${data.job ? `<text x="${textX}" y="${jobY}" font-family="system-ui, -apple-system, sans-serif" font-size="${13 * S2}" fill="rgba(255,255,255,0.5)">${escapeXml(jobText)}</text>` : ""}
|
|
245748
245722
|
|
|
245749
245723
|
<!-- Tags -->
|
|
245750
245724
|
${inlineTags}
|
|
245751
245725
|
|
|
245752
|
-
<!--
|
|
245753
|
-
${data.
|
|
245726
|
+
<!-- Vibe -->
|
|
245727
|
+
${data.vibe ? `<text x="${textX}" y="${vibeY}" font-family="system-ui, -apple-system, sans-serif" font-size="${13 * S2}" fill="rgba(255,255,255,0.55)" font-style="italic">${escapeXml(vibeText)}</text>` : ""}
|
|
245754
245728
|
|
|
245755
|
-
<!-- Bottom
|
|
245756
|
-
<
|
|
245757
|
-
<text x="${
|
|
245758
|
-
<text x="${WIDTH - 36 * S2}" y="${HEIGHT - 14 * S2}" font-family="system-ui, -apple-system, sans-serif" font-size="${11 * S2}" fill="#666" text-anchor="end">github.com/Hollandchirs/Opencrush</text>
|
|
245729
|
+
<!-- Bottom branding -->
|
|
245730
|
+
<text x="${textX}" y="${H2 - 28 * S2}" font-family="system-ui, -apple-system, sans-serif" font-size="${14 * S2}" font-weight="bold" fill="#ff69b4">Opencrush</text>
|
|
245731
|
+
<text x="${panelW - 30 * S2}" y="${H2 - 28 * S2}" font-family="system-ui, -apple-system, sans-serif" font-size="${10 * S2}" fill="rgba(255,255,255,0.3)" text-anchor="end">github.com/heloraai/Opencrush</text>
|
|
245759
245732
|
</svg>`;
|
|
245760
245733
|
}
|
|
245761
|
-
function escapeXml(str2) {
|
|
245762
|
-
return str2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
245763
|
-
}
|
|
245764
|
-
function truncate(str2, max) {
|
|
245765
|
-
return str2.length > max ? str2.slice(0, max - 1) + "\u2026" : str2;
|
|
245766
|
-
}
|
|
245767
245734
|
async function generateCard(characterName) {
|
|
245768
245735
|
const sharp = (await import("sharp")).default;
|
|
245769
245736
|
const { ROOT_DIR: ROOT_DIR3 } = await Promise.resolve().then(() => (init_paths(), paths_exports));
|
|
245770
245737
|
const charDir = (0, import_path12.join)(ROOT_DIR3, "characters", characterName);
|
|
245771
|
-
if (!(0, import_fs18.existsSync)(charDir)) {
|
|
245772
|
-
throw new Error(`Character "${characterName}" not found in characters/`);
|
|
245773
|
-
}
|
|
245738
|
+
if (!(0, import_fs18.existsSync)(charDir)) throw new Error(`Character "${characterName}" not found in characters/`);
|
|
245774
245739
|
const identityPath = (0, import_path12.join)(charDir, "IDENTITY.md");
|
|
245775
|
-
if (!(0, import_fs18.existsSync)(identityPath)) {
|
|
245776
|
-
throw new Error(`Missing IDENTITY.md for character "${characterName}"`);
|
|
245777
|
-
}
|
|
245740
|
+
if (!(0, import_fs18.existsSync)(identityPath)) throw new Error(`Missing IDENTITY.md for character "${characterName}"`);
|
|
245778
245741
|
const data = parseIdentity(identityPath);
|
|
245779
245742
|
const imageExts = [".jpeg", ".jpg", ".png", ".webp"];
|
|
245780
245743
|
let refImagePath;
|
|
@@ -245785,34 +245748,67 @@ async function generateCard(characterName) {
|
|
|
245785
245748
|
break;
|
|
245786
245749
|
}
|
|
245787
245750
|
}
|
|
245788
|
-
|
|
245789
|
-
|
|
245790
|
-
|
|
245791
|
-
|
|
245792
|
-
|
|
245793
|
-
|
|
245794
|
-
|
|
245795
|
-
|
|
245796
|
-
|
|
245797
|
-
|
|
245798
|
-
|
|
245799
|
-
|
|
245800
|
-
|
|
245801
|
-
|
|
245802
|
-
|
|
245803
|
-
|
|
245804
|
-
|
|
245805
|
-
|
|
245806
|
-
|
|
245751
|
+
if (!refImagePath) {
|
|
245752
|
+
return generateFallbackCard(charDir, characterName, data);
|
|
245753
|
+
}
|
|
245754
|
+
const { data: colorData } = await sharp(refImagePath).resize(1, 1, { fit: "cover" }).raw().toBuffer({ resolveWithObject: true });
|
|
245755
|
+
const [cr2, cg, cb] = [colorData[0], colorData[1], colorData[2]];
|
|
245756
|
+
const bgR = Math.round(cr2 * 0.18), bgG = Math.round(cg * 0.18), bgB = Math.round(cb * 0.18);
|
|
245757
|
+
const bgSolid = await sharp({
|
|
245758
|
+
create: { width: W2, height: H2, channels: 3, background: { r: bgR, g: bgG, b: bgB } }
|
|
245759
|
+
}).png().toBuffer();
|
|
245760
|
+
const portraitH = H2;
|
|
245761
|
+
const portraitW = Math.round(portraitH * 4 / 5);
|
|
245762
|
+
const portrait = await sharp(refImagePath).resize(portraitW, portraitH, { fit: "cover", position: "top" }).png().toBuffer();
|
|
245763
|
+
const fadeMask = Buffer.from(
|
|
245764
|
+
`<svg width="${portraitW}" height="${portraitH}">
|
|
245765
|
+
<defs>
|
|
245766
|
+
<linearGradient id="fade" x1="0" y1="0" x2="1" y2="0">
|
|
245767
|
+
<stop offset="0%" stop-color="white" />
|
|
245768
|
+
<stop offset="65%" stop-color="white" />
|
|
245769
|
+
<stop offset="100%" stop-color="black" />
|
|
245770
|
+
</linearGradient>
|
|
245771
|
+
</defs>
|
|
245772
|
+
<rect width="${portraitW}" height="${portraitH}" fill="url(#fade)" />
|
|
245773
|
+
</svg>`
|
|
245774
|
+
);
|
|
245775
|
+
const maskedPortrait = await sharp(portrait).composite([{ input: fadeMask, blend: "dest-in" }]).png().toBuffer();
|
|
245776
|
+
const panelW = Math.round(520 * SCALE);
|
|
245777
|
+
const textSvg = buildTextOverlay(data, bgR, bgG, bgB);
|
|
245778
|
+
const textPanel = await sharp(Buffer.from(textSvg)).resize(panelW, H2).png().toBuffer();
|
|
245779
|
+
const card = sharp(bgSolid).composite([
|
|
245780
|
+
{ input: maskedPortrait, left: 0, top: 0 },
|
|
245781
|
+
{ input: textPanel, left: W2 - panelW, top: 0 }
|
|
245782
|
+
]);
|
|
245783
|
+
const outputPath = (0, import_path12.join)(charDir, "card.png");
|
|
245784
|
+
await card.png({ quality: 95 }).toFile(outputPath);
|
|
245785
|
+
console.log(source_default.green(`
|
|
245786
|
+
Card generated: characters/${characterName}/card.png`));
|
|
245787
|
+
console.log(source_default.gray(` ${W2}x${H2} PNG
|
|
245788
|
+
`));
|
|
245789
|
+
return outputPath;
|
|
245790
|
+
}
|
|
245791
|
+
async function generateFallbackCard(charDir, characterName, data) {
|
|
245792
|
+
const sharp = (await import("sharp")).default;
|
|
245793
|
+
const S2 = SCALE;
|
|
245794
|
+
const gradient = `<svg width="${W2}" height="${H2}">
|
|
245795
|
+
<defs><linearGradient id="bg" x1="0" y1="0" x2="0.5" y2="1">
|
|
245796
|
+
<stop offset="0%" stop-color="#1a1a2e" /><stop offset="100%" stop-color="#16213e" />
|
|
245797
|
+
</linearGradient></defs>
|
|
245798
|
+
<rect width="${W2}" height="${H2}" fill="url(#bg)" />
|
|
245799
|
+
<text x="${W2 / 2}" y="${H2 / 2 - 20 * S2}" font-family="system-ui" font-size="${48 * S2}" font-weight="bold" fill="white" text-anchor="middle">${escapeXml(data.name)}</text>
|
|
245800
|
+
<text x="${W2 / 2}" y="${H2 / 2 + 30 * S2}" font-family="system-ui" font-size="${16 * S2}" fill="#999" text-anchor="middle">${escapeXml([data.age, data.location, data.job].filter(Boolean).join(" \xB7 "))}</text>
|
|
245801
|
+
<text x="${36 * S2}" y="${H2 - 20 * S2}" font-family="system-ui" font-size="${14 * S2}" font-weight="bold" fill="#ff69b4">Opencrush</text>
|
|
245802
|
+
</svg>`;
|
|
245807
245803
|
const outputPath = (0, import_path12.join)(charDir, "card.png");
|
|
245808
|
-
await
|
|
245804
|
+
await sharp(Buffer.from(gradient)).resize(W2, H2).png().toFile(outputPath);
|
|
245809
245805
|
console.log(source_default.green(`
|
|
245810
245806
|
Card generated: characters/${characterName}/card.png`));
|
|
245811
|
-
console.log(source_default.gray(` ${
|
|
245807
|
+
console.log(source_default.gray(` ${W2}x${H2} PNG (no reference image)
|
|
245812
245808
|
`));
|
|
245813
245809
|
return outputPath;
|
|
245814
245810
|
}
|
|
245815
|
-
var import_fs18, import_path12, import_gray_matter3, SCALE,
|
|
245811
|
+
var import_fs18, import_path12, import_gray_matter3, SCALE, W2, H2;
|
|
245816
245812
|
var init_card = __esm({
|
|
245817
245813
|
"src/card.ts"() {
|
|
245818
245814
|
import_fs18 = require("fs");
|
|
@@ -245820,11 +245816,8 @@ var init_card = __esm({
|
|
|
245820
245816
|
import_gray_matter3 = __toESM(require_gray_matter());
|
|
245821
245817
|
init_source();
|
|
245822
245818
|
SCALE = 2;
|
|
245823
|
-
|
|
245824
|
-
|
|
245825
|
-
PORTRAIT_SIZE = 260 * SCALE;
|
|
245826
|
-
PORTRAIT_X = 80 * SCALE;
|
|
245827
|
-
PORTRAIT_Y = Math.round((HEIGHT - PORTRAIT_SIZE) / 2) - 10 * SCALE;
|
|
245819
|
+
W2 = 1200 * SCALE;
|
|
245820
|
+
H2 = 630 * SCALE;
|
|
245828
245821
|
}
|
|
245829
245822
|
});
|
|
245830
245823
|
|
|
@@ -246234,7 +246227,7 @@ async function main2() {
|
|
|
246234
246227
|
${source_default.gray(ROOT_DIR + "/characters/")} Your companion's blueprint files
|
|
246235
246228
|
|
|
246236
246229
|
${source_default.bold("Documentation:")}
|
|
246237
|
-
${source_default.gray("https://github.com/
|
|
246230
|
+
${source_default.gray("https://github.com/heloraai/Opencrush")}
|
|
246238
246231
|
`);
|
|
246239
246232
|
break;
|
|
246240
246233
|
}
|