@poe-platform/safe-js 0.1.463 → 0.1.464
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/safe-js/chunks/{chunk-NYT6Z4RI.js → chunk-N45AVH5W.js} +242 -11
- package/dist/safe-js/chunks/{chunk-NYT6Z4RI.js.map → chunk-N45AVH5W.js.map} +4 -4
- package/dist/safe-js/chunks/{chunk-KCQ7OJWN.js → chunk-RYXS4V74.js} +2 -2
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/dist/safe-js/interp/intl-segmenter.d.ts +28 -0
- package/dist/safe-js/snapshot/guest-heap.d.ts +11 -0
- package/package.json +2 -2
- /package/dist/safe-js/chunks/{chunk-KCQ7OJWN.js.map → chunk-RYXS4V74.js.map} +0 -0
|
@@ -6288,11 +6288,11 @@ function assertBareImportSpecifier(specifier) {
|
|
|
6288
6288
|
}
|
|
6289
6289
|
}
|
|
6290
6290
|
function hasInvalidImportPathDots(value) {
|
|
6291
|
-
const
|
|
6292
|
-
if (
|
|
6291
|
+
const segments2 = value.split(".");
|
|
6292
|
+
if (segments2.some((segment) => segment.length === 0)) {
|
|
6293
6293
|
return true;
|
|
6294
6294
|
}
|
|
6295
|
-
return
|
|
6295
|
+
return segments2.length > 1 && ["js", "mjs", "cjs", "ts", "mts", "cts", "json"].includes(segments2.at(-1) ?? "");
|
|
6296
6296
|
}
|
|
6297
6297
|
function hasProtocolPrefix(value) {
|
|
6298
6298
|
const colonIndex = value.indexOf(":");
|
|
@@ -9036,6 +9036,48 @@ function nextStringIterator(value, budget) {
|
|
|
9036
9036
|
return { value: entry, done: false };
|
|
9037
9037
|
}
|
|
9038
9038
|
|
|
9039
|
+
// packages/safe-js/src/interp/intl-segmenter.ts
|
|
9040
|
+
var NativeSegmenter = Intl.Segmenter;
|
|
9041
|
+
var nativeSegment = NativeSegmenter.prototype.segment;
|
|
9042
|
+
var nativeResolvedOptions = NativeSegmenter.prototype.resolvedOptions;
|
|
9043
|
+
var nativeContaining = Object.getPrototypeOf(new NativeSegmenter("en").segment("")).containing;
|
|
9044
|
+
var segmenters = /* @__PURE__ */ new WeakMap();
|
|
9045
|
+
var segments = /* @__PURE__ */ new WeakMap();
|
|
9046
|
+
function createSandboxSegmenter(locales2, options) {
|
|
9047
|
+
const native = new NativeSegmenter(locales2, options);
|
|
9048
|
+
const value = /* @__PURE__ */ Object.create(null);
|
|
9049
|
+
segmenters.set(value, { native, options: Reflect.apply(nativeResolvedOptions, native, []) });
|
|
9050
|
+
return value;
|
|
9051
|
+
}
|
|
9052
|
+
function isSandboxSegmenter(value) {
|
|
9053
|
+
return typeof value === "object" && value !== null && segmenters.has(value);
|
|
9054
|
+
}
|
|
9055
|
+
function segmenterState(value) {
|
|
9056
|
+
if (!isSandboxSegmenter(value)) throw new TypeError("Intl.Segmenter requires a Segmenter receiver.");
|
|
9057
|
+
return segmenters.get(value);
|
|
9058
|
+
}
|
|
9059
|
+
function createSandboxSegments(state) {
|
|
9060
|
+
const native = Reflect.apply(nativeSegment, segmenterState(state.segmenter).native, [state.input]);
|
|
9061
|
+
const value = /* @__PURE__ */ Object.create(null);
|
|
9062
|
+
segments.set(value, { ...state, native });
|
|
9063
|
+
return value;
|
|
9064
|
+
}
|
|
9065
|
+
function isSandboxSegments(value) {
|
|
9066
|
+
return typeof value === "object" && value !== null && segments.has(value);
|
|
9067
|
+
}
|
|
9068
|
+
function segmentState(value, iterator) {
|
|
9069
|
+
if (!isSandboxSegments(value) || iterator !== void 0 && segments.get(value).index !== void 0 !== iterator)
|
|
9070
|
+
throw new TypeError(iterator ? "Segment iterator requires a segment iterator receiver." : "Segments method requires a Segments receiver.");
|
|
9071
|
+
return segments.get(value);
|
|
9072
|
+
}
|
|
9073
|
+
function containingSegment(value, index, iterator, budget) {
|
|
9074
|
+
const state = segmentState(value, iterator);
|
|
9075
|
+
budget.visitNode(state.input.length + 1);
|
|
9076
|
+
const result = Reflect.apply(nativeContaining, state.native, [index]);
|
|
9077
|
+
if (iterator && result !== void 0) state.index = result.index + result.segment.length;
|
|
9078
|
+
return result === void 0 ? void 0 : { ...result };
|
|
9079
|
+
}
|
|
9080
|
+
|
|
9039
9081
|
// packages/safe-js/src/interp/iterator-wrapper.ts
|
|
9040
9082
|
var iteratorWrapperStates = /* @__PURE__ */ new WeakMap();
|
|
9041
9083
|
|
|
@@ -19808,7 +19850,7 @@ import { types as types7 } from "node:util";
|
|
|
19808
19850
|
|
|
19809
19851
|
// packages/safe-js/src/interp/intl-collator.ts
|
|
19810
19852
|
var NativeCollator = Intl.Collator;
|
|
19811
|
-
var
|
|
19853
|
+
var nativeResolvedOptions2 = NativeCollator.prototype.resolvedOptions;
|
|
19812
19854
|
var nativeCompare = Object.getOwnPropertyDescriptor(NativeCollator.prototype, "compare").get;
|
|
19813
19855
|
var states5 = /* @__PURE__ */ new WeakMap();
|
|
19814
19856
|
var optionTypes = [
|
|
@@ -19847,7 +19889,7 @@ async function readCollatorOptions(input, budget, context, invalid) {
|
|
|
19847
19889
|
function createSandboxCollator(locales2, options) {
|
|
19848
19890
|
const native = new NativeCollator(locales2, options);
|
|
19849
19891
|
const value = /* @__PURE__ */ Object.create(null);
|
|
19850
|
-
states5.set(value, { native, options: Reflect.apply(
|
|
19892
|
+
states5.set(value, { native, options: Reflect.apply(nativeResolvedOptions2, native, []) });
|
|
19851
19893
|
return value;
|
|
19852
19894
|
}
|
|
19853
19895
|
function isSandboxCollator(value) {
|
|
@@ -28652,7 +28694,7 @@ async function buildLocaleTag(input, optionsInput, budget, context) {
|
|
|
28652
28694
|
}
|
|
28653
28695
|
const updated = Object.values(base).filter((value) => value !== void 0).join("-") + canonical.slice(native.baseName.length);
|
|
28654
28696
|
const extension = unicodeKeywords(updated);
|
|
28655
|
-
const
|
|
28697
|
+
const optionTypes7 = [
|
|
28656
28698
|
["calendar", "ca", "unicodeType"],
|
|
28657
28699
|
["collation", "co", "unicodeType"],
|
|
28658
28700
|
["firstDayOfWeek", "fw", "unicodeType"],
|
|
@@ -28661,7 +28703,7 @@ async function buildLocaleTag(input, optionsInput, budget, context) {
|
|
|
28661
28703
|
["numeric", "kn", "boolean"],
|
|
28662
28704
|
["numberingSystem", "nu", "unicodeType"]
|
|
28663
28705
|
];
|
|
28664
|
-
for (const [key, extensionKey, type] of
|
|
28706
|
+
for (const [key, extensionKey, type] of optionTypes7) {
|
|
28665
28707
|
let value = await readIntlProperty(options, key, budget, context);
|
|
28666
28708
|
if (value === void 0) continue;
|
|
28667
28709
|
if (key === "firstDayOfWeek") {
|
|
@@ -29175,6 +29217,17 @@ function captureGuestHeapNode(value, encode) {
|
|
|
29175
29217
|
}
|
|
29176
29218
|
if (isSandboxLocale(value)) return { kind: "guest-locale", tag: localeTag(value), state: captureObjectState(value, encode) };
|
|
29177
29219
|
if (isSandboxListFormat(value)) return { kind: "guest-listformat", options: { ...listFormatState(value).options }, state: captureObjectState(value, encode) };
|
|
29220
|
+
if (isSandboxSegmenter(value)) return { kind: "guest-segmenter", options: { ...segmenterState(value).options }, state: captureObjectState(value, encode) };
|
|
29221
|
+
if (isSandboxSegments(value)) {
|
|
29222
|
+
const state2 = segmentState(value);
|
|
29223
|
+
return {
|
|
29224
|
+
kind: "guest-segments",
|
|
29225
|
+
segmenter: encode(state2.segmenter),
|
|
29226
|
+
input: state2.input,
|
|
29227
|
+
...state2.index === void 0 ? {} : { index: state2.index },
|
|
29228
|
+
state: captureObjectState(value, encode)
|
|
29229
|
+
};
|
|
29230
|
+
}
|
|
29178
29231
|
if (isSandboxRelativeTimeFormat(value)) return { kind: "guest-relativetimeformat", options: { ...relativeTimeFormatState(value).options }, state: captureObjectState(value, encode) };
|
|
29179
29232
|
if (isSandboxDisplayNames(value)) return { kind: "guest-displaynames", options: { ...displayNamesState(value).options }, state: captureObjectState(value, encode) };
|
|
29180
29233
|
if (isSandboxPluralRules(value)) {
|
|
@@ -34238,6 +34291,154 @@ function createPluralRulesConstructor(budget) {
|
|
|
34238
34291
|
return constructor;
|
|
34239
34292
|
}
|
|
34240
34293
|
|
|
34294
|
+
// packages/safe-js/src/interp/globals/intl-segmenter.ts
|
|
34295
|
+
var supportedLocalesOf9 = Intl.Segmenter.supportedLocalesOf;
|
|
34296
|
+
var optionTypes6 = [
|
|
34297
|
+
["localeMatcher", ["lookup", "best fit"]],
|
|
34298
|
+
["granularity", ["grapheme", "word", "sentence"]]
|
|
34299
|
+
];
|
|
34300
|
+
function createSegmenterConstructor(budget) {
|
|
34301
|
+
const prototype = createIntrinsicObject();
|
|
34302
|
+
const segmentsPrototype = createIntrinsicObject();
|
|
34303
|
+
const iteratorPrototype = createIntrinsicObject();
|
|
34304
|
+
setSandboxPrototype(iteratorPrototype, resolveIntrinsicIdentity(budget, '["%IteratorPrototype%"]'));
|
|
34305
|
+
const constructor = createSandboxClosure({
|
|
34306
|
+
guest: true,
|
|
34307
|
+
sandbox: true,
|
|
34308
|
+
name: "Segmenter",
|
|
34309
|
+
length: 0,
|
|
34310
|
+
call: () => {
|
|
34311
|
+
throw new TypeError("Constructor Segmenter requires 'new'.");
|
|
34312
|
+
},
|
|
34313
|
+
construct: async ([input, options], context) => {
|
|
34314
|
+
const target = context?.newTarget;
|
|
34315
|
+
const selected = target === void 0 || target === constructor ? prototype : context?.getProperty !== void 0 ? await context.getProperty(target, "prototype") : await readPropertyDescriptor(getSandboxPropertyDescriptor(target, "prototype", budget) ?? { value: void 0 }, target, context);
|
|
34316
|
+
let locales2 = [];
|
|
34317
|
+
const converted = /* @__PURE__ */ Object.create(null);
|
|
34318
|
+
const release = retainValues(budget, () => [selected, locales2, converted]);
|
|
34319
|
+
try {
|
|
34320
|
+
locales2 = await canonicalizeGuestLocales(input, budget, context);
|
|
34321
|
+
const source = intlOptionsObject(options, budget);
|
|
34322
|
+
for (const [key, type] of optionTypes6) {
|
|
34323
|
+
const raw = await readIntlProperty(source, key, budget, context);
|
|
34324
|
+
if (raw !== void 0) converted[key] = await convertIntlOption(raw, key, type, budget, context);
|
|
34325
|
+
}
|
|
34326
|
+
const value = createSandboxSegmenter(locales2, converted);
|
|
34327
|
+
setSandboxPrototype(value, typeof selected === "object" && selected !== null ? selected : prototype, budget);
|
|
34328
|
+
return allocateProducedSandboxValue(value, budget);
|
|
34329
|
+
} finally {
|
|
34330
|
+
release();
|
|
34331
|
+
}
|
|
34332
|
+
}
|
|
34333
|
+
});
|
|
34334
|
+
const properties = materializeFunctionProperties(constructor);
|
|
34335
|
+
Object.defineProperty(properties, "prototype", { value: prototype, writable: false, configurable: false });
|
|
34336
|
+
Object.defineProperty(properties, "supportedLocalesOf", { value: createSandboxClosure({
|
|
34337
|
+
guest: true,
|
|
34338
|
+
sandbox: true,
|
|
34339
|
+
name: "supportedLocalesOf",
|
|
34340
|
+
length: 1,
|
|
34341
|
+
call: async ([input, options], context) => {
|
|
34342
|
+
const locales2 = await canonicalizeGuestLocales(input, budget, context);
|
|
34343
|
+
const release = retainValues(budget, () => [locales2]);
|
|
34344
|
+
try {
|
|
34345
|
+
const source = intlOptionsObject(options, budget);
|
|
34346
|
+
const raw = await readIntlProperty(source, "localeMatcher", budget, context);
|
|
34347
|
+
const matcher = raw === void 0 ? void 0 : await convertIntlOption(raw, "localeMatcher", ["lookup", "best fit"], budget, context);
|
|
34348
|
+
return allocateProducedSandboxValue(supportedLocalesOf9(locales2, { localeMatcher: matcher }), budget);
|
|
34349
|
+
} finally {
|
|
34350
|
+
release();
|
|
34351
|
+
}
|
|
34352
|
+
}
|
|
34353
|
+
}), writable: true, configurable: true });
|
|
34354
|
+
Object.defineProperties(prototype, {
|
|
34355
|
+
constructor: { value: constructor, writable: true, configurable: true },
|
|
34356
|
+
[Symbol.toStringTag]: { value: "Intl.Segmenter", configurable: true },
|
|
34357
|
+
resolvedOptions: { value: createSandboxClosure({
|
|
34358
|
+
guest: true,
|
|
34359
|
+
sandbox: true,
|
|
34360
|
+
name: "resolvedOptions",
|
|
34361
|
+
length: 0,
|
|
34362
|
+
call: (_args, context) => allocateProducedSandboxValue({ ...segmenterState(context?.thisValue).options }, budget)
|
|
34363
|
+
}), writable: true, configurable: true },
|
|
34364
|
+
segment: { value: createSandboxClosure({
|
|
34365
|
+
guest: true,
|
|
34366
|
+
sandbox: true,
|
|
34367
|
+
name: "segment",
|
|
34368
|
+
length: 1,
|
|
34369
|
+
call: async ([input], context) => {
|
|
34370
|
+
const receiver = context?.thisValue;
|
|
34371
|
+
segmenterState(receiver);
|
|
34372
|
+
const release = retainValues(budget, () => [receiver, input]);
|
|
34373
|
+
try {
|
|
34374
|
+
const text = await sandboxString(input, budget, context);
|
|
34375
|
+
budget.visitNode(text.length);
|
|
34376
|
+
const value = createSandboxSegments({ segmenter: receiver, input: text });
|
|
34377
|
+
setSandboxPrototype(value, segmentsPrototype, budget);
|
|
34378
|
+
return allocateProducedSandboxValue(value, budget);
|
|
34379
|
+
} finally {
|
|
34380
|
+
release();
|
|
34381
|
+
}
|
|
34382
|
+
}
|
|
34383
|
+
}), writable: true, configurable: true }
|
|
34384
|
+
});
|
|
34385
|
+
const containing = createSandboxClosure({
|
|
34386
|
+
guest: true,
|
|
34387
|
+
sandbox: true,
|
|
34388
|
+
name: "containing",
|
|
34389
|
+
length: 1,
|
|
34390
|
+
call: async ([input], context) => {
|
|
34391
|
+
const receiver = context?.thisValue;
|
|
34392
|
+
segmentState(receiver, false);
|
|
34393
|
+
const release = retainValues(budget, () => [receiver, input]);
|
|
34394
|
+
try {
|
|
34395
|
+
const number = await sandboxNumber(input, budget, context);
|
|
34396
|
+
const index = Number.isNaN(number) ? 0 : Math.trunc(number);
|
|
34397
|
+
return allocateProducedSandboxValue(containingSegment(receiver, index, false, budget), budget);
|
|
34398
|
+
} finally {
|
|
34399
|
+
release();
|
|
34400
|
+
}
|
|
34401
|
+
}
|
|
34402
|
+
});
|
|
34403
|
+
const iterate = createSandboxClosure({
|
|
34404
|
+
guest: true,
|
|
34405
|
+
sandbox: true,
|
|
34406
|
+
name: "[Symbol.iterator]",
|
|
34407
|
+
length: 0,
|
|
34408
|
+
call: (_args, context) => {
|
|
34409
|
+
const state = segmentState(context?.thisValue, false);
|
|
34410
|
+
budget.visitNode(state.input.length);
|
|
34411
|
+
const value = createSandboxSegments({ segmenter: state.segmenter, input: state.input, index: 0 });
|
|
34412
|
+
setSandboxPrototype(value, iteratorPrototype, budget);
|
|
34413
|
+
return allocateProducedSandboxValue(value, budget);
|
|
34414
|
+
}
|
|
34415
|
+
});
|
|
34416
|
+
const next = createSandboxClosure({
|
|
34417
|
+
guest: true,
|
|
34418
|
+
sandbox: true,
|
|
34419
|
+
name: "next",
|
|
34420
|
+
length: 0,
|
|
34421
|
+
call: (_args, context) => {
|
|
34422
|
+
const receiver = context?.thisValue;
|
|
34423
|
+
const state = segmentState(receiver, true);
|
|
34424
|
+
const value = containingSegment(receiver, state.index, true, budget);
|
|
34425
|
+
return allocateProducedSandboxValue({ value, done: value === void 0 }, budget);
|
|
34426
|
+
}
|
|
34427
|
+
});
|
|
34428
|
+
Object.defineProperties(segmentsPrototype, {
|
|
34429
|
+
containing: { value: containing, writable: true, configurable: true },
|
|
34430
|
+
[Symbol.iterator]: { value: iterate, writable: true, configurable: true }
|
|
34431
|
+
});
|
|
34432
|
+
Object.defineProperties(iteratorPrototype, {
|
|
34433
|
+
next: { value: next, writable: true, configurable: true },
|
|
34434
|
+
[Symbol.toStringTag]: { value: "Segmenter String Iterator", configurable: true }
|
|
34435
|
+
});
|
|
34436
|
+
registerBuiltinIdentities(budget, { "%IntlSegmentsPrototype%": segmentsPrototype, "%IntlSegmentIteratorPrototype%": iteratorPrototype });
|
|
34437
|
+
for (const closure of [containing, iterate, next]) registerIntrinsicFunction(budget, closure);
|
|
34438
|
+
for (const value of [segmentsPrototype, iteratorPrototype]) registerIntrinsicObject(budget, value);
|
|
34439
|
+
return constructor;
|
|
34440
|
+
}
|
|
34441
|
+
|
|
34241
34442
|
// packages/safe-js/src/interp/globals/intl.ts
|
|
34242
34443
|
var supportedValuesOf = Intl.supportedValuesOf;
|
|
34243
34444
|
function createIntlGlobal(budget, now) {
|
|
@@ -34258,6 +34459,7 @@ function createIntlGlobal(budget, now) {
|
|
|
34258
34459
|
const displayNames = createDisplayNamesConstructor(budget);
|
|
34259
34460
|
const dateTimeFormat = createDateTimeFormatConstructor(budget, now);
|
|
34260
34461
|
const pluralRules = createPluralRulesConstructor(budget);
|
|
34462
|
+
const segmenter = createSegmenterConstructor(budget);
|
|
34261
34463
|
Object.defineProperty(intl, "Locale", { value: locale, writable: true, configurable: true });
|
|
34262
34464
|
Object.defineProperty(intl, "Collator", { value: collator, writable: true, configurable: true });
|
|
34263
34465
|
Object.defineProperty(intl, "NumberFormat", { value: numberFormat, writable: true, configurable: true });
|
|
@@ -34266,13 +34468,14 @@ function createIntlGlobal(budget, now) {
|
|
|
34266
34468
|
Object.defineProperty(intl, "DisplayNames", { value: displayNames, writable: true, configurable: true });
|
|
34267
34469
|
Object.defineProperty(intl, "DateTimeFormat", { value: dateTimeFormat, writable: true, configurable: true });
|
|
34268
34470
|
Object.defineProperty(intl, "PluralRules", { value: pluralRules, writable: true, configurable: true });
|
|
34471
|
+
Object.defineProperty(intl, "Segmenter", { value: segmenter, writable: true, configurable: true });
|
|
34269
34472
|
for (const [name, call] of Object.entries(methods3)) {
|
|
34270
34473
|
const closure = createSandboxClosure({ guest: true, sandbox: true, name, length: 1, call });
|
|
34271
34474
|
Object.defineProperty(intl, name, { value: closure, writable: true, configurable: true });
|
|
34272
34475
|
}
|
|
34273
34476
|
Object.defineProperty(intl, Symbol.toStringTag, { value: "Intl", configurable: true });
|
|
34274
34477
|
registerBuiltinIdentities(budget, { Intl: intl });
|
|
34275
|
-
for (const constructor of [locale, collator, numberFormat, listFormat, relativeTimeFormat, displayNames, dateTimeFormat, pluralRules]) {
|
|
34478
|
+
for (const constructor of [locale, collator, numberFormat, listFormat, relativeTimeFormat, displayNames, dateTimeFormat, pluralRules, segmenter]) {
|
|
34276
34479
|
const prototype = constructor.properties.prototype;
|
|
34277
34480
|
for (const owner of [prototype, constructor.properties])
|
|
34278
34481
|
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(owner)))
|
|
@@ -34390,7 +34593,7 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
34390
34593
|
createRawJson(node.text);
|
|
34391
34594
|
return true;
|
|
34392
34595
|
}
|
|
34393
|
-
if (!["module-function", "async-generator-driver", "async-generator-handler", "async-function-driver", "async-function-handler", "thenable-state", "thenable-resolver", "construction-environment", "capability-executor", "promise-aggregate", "aggregate-entry", "aggregate-handler", "intrinsic", "bound-function", "promise-resolver", "pending-promise", "promise-reaction", "promise-adoption", "adoption-resolver", "guest-function", "guest-class", "guest-generator", "scope-frame", "guest-object", "guest-array", "guest-boxed", "guest-date", "guest-locale", "guest-listformat", "guest-pluralrules", "guest-displaynames", "guest-relativetimeformat", "guest-datetimeformat", "guest-numberformat", "guest-collator", "guest-regex", "guest-promise", "array-iterator", "string-iterator", "async-disposable-stack", "async-cleanup", "async-cleanup-handler", "disposable-stack", "iterator-wrapper", "iterator-helper", "guest-collection-iterator", "guest-regexp-iterator", "map", "set"].includes(String(node.kind))) return false;
|
|
34596
|
+
if (!["guest-segmenter", "guest-segments", "module-function", "async-generator-driver", "async-generator-handler", "async-function-driver", "async-function-handler", "thenable-state", "thenable-resolver", "construction-environment", "capability-executor", "promise-aggregate", "aggregate-entry", "aggregate-handler", "intrinsic", "bound-function", "promise-resolver", "pending-promise", "promise-reaction", "promise-adoption", "adoption-resolver", "guest-function", "guest-class", "guest-generator", "scope-frame", "guest-object", "guest-array", "guest-boxed", "guest-date", "guest-locale", "guest-listformat", "guest-pluralrules", "guest-displaynames", "guest-relativetimeformat", "guest-datetimeformat", "guest-numberformat", "guest-collator", "guest-regex", "guest-promise", "array-iterator", "string-iterator", "async-disposable-stack", "async-cleanup", "async-cleanup-handler", "disposable-stack", "iterator-wrapper", "iterator-helper", "guest-collection-iterator", "guest-regexp-iterator", "map", "set"].includes(String(node.kind))) return false;
|
|
34394
34597
|
const reference = (value, kinds) => {
|
|
34395
34598
|
const ref = record2(value);
|
|
34396
34599
|
fields(ref, ["kind", "id"]);
|
|
@@ -34698,6 +34901,28 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
34698
34901
|
const restored = listFormatState(createSandboxListFormat(options.locale, options)).options;
|
|
34699
34902
|
if (names.some((key) => options[key] !== restored[key])) throw new TypeError("Invalid resolved ListFormat options.");
|
|
34700
34903
|
state(node.state);
|
|
34904
|
+
} else if (node.kind === "guest-segmenter") {
|
|
34905
|
+
fields(node, ["kind", "options", "state"]);
|
|
34906
|
+
const options = record2(node.options);
|
|
34907
|
+
fields(options, ["locale", "granularity"]);
|
|
34908
|
+
if (typeof options.locale !== "string" || typeof options.granularity !== "string") throw new TypeError("Invalid Segmenter options.");
|
|
34909
|
+
const restored = segmenterState(createSandboxSegmenter(options.locale, options)).options;
|
|
34910
|
+
if (options.locale !== restored.locale || options.granularity !== restored.granularity) throw new TypeError("Invalid resolved Segmenter options.");
|
|
34911
|
+
state(node.state);
|
|
34912
|
+
} else if (node.kind === "guest-segments") {
|
|
34913
|
+
fields(node, ["kind", "segmenter", "input", "state"], ["index"]);
|
|
34914
|
+
const segmenter = reference(node.segmenter, ["guest-segmenter"]);
|
|
34915
|
+
if (typeof node.input !== "string") throw new TypeError("Invalid segments input.");
|
|
34916
|
+
if (node.index !== void 0) {
|
|
34917
|
+
if (!Number.isSafeInteger(node.index) || node.index < 0 || node.index > node.input.length)
|
|
34918
|
+
throw new TypeError("Invalid segment iterator index.");
|
|
34919
|
+
const options = record2(segmenter.options);
|
|
34920
|
+
const owner = createSandboxSegmenter(options.locale, options);
|
|
34921
|
+
const value = createSandboxSegments({ segmenter: owner, input: node.input });
|
|
34922
|
+
if (node.index < node.input.length && segmentState(value).native.containing(node.index)?.index !== node.index)
|
|
34923
|
+
throw new TypeError("Invalid segment iterator boundary.");
|
|
34924
|
+
}
|
|
34925
|
+
state(node.state);
|
|
34701
34926
|
} else if (node.kind === "guest-pluralrules") {
|
|
34702
34927
|
fields(node, ["kind", "options", "state"]);
|
|
34703
34928
|
const options = record2(node.options);
|
|
@@ -38283,7 +38508,7 @@ var structuredCloneErrorNames = ["Error", "EvalError", "RangeError", "ReferenceE
|
|
|
38283
38508
|
function* cloneStructuredGraph(value, state, budget, depth = 0) {
|
|
38284
38509
|
assertSandboxDataDepth(depth);
|
|
38285
38510
|
budget.visitNode();
|
|
38286
|
-
if (typeof value === "symbol" || isSandboxModuleNamespace(value) || isSandboxClosure(value) || isSandboxPromise(value) || isSandboxGenerator(value) || isSandboxCollectionIterator(value) || isSandboxRegExpIterator(value) || isSandboxArrayIterator(value) || isSandboxStringIterator(value) || isSandboxArguments(value))
|
|
38511
|
+
if (typeof value === "symbol" || isSandboxModuleNamespace(value) || isSandboxClosure(value) || isSandboxPromise(value) || isSandboxGenerator(value) || isSandboxCollectionIterator(value) || isSandboxRegExpIterator(value) || isSandboxArrayIterator(value) || isSandboxStringIterator(value) || isSandboxArguments(value) || isSandboxSegmenter(value) || isSandboxSegments(value))
|
|
38287
38512
|
throw new DOMException("Value cannot be structured cloned.", "DataCloneError");
|
|
38288
38513
|
if (typeof value !== "object" || value === null) return allocateProducedSandboxValue(value, budget);
|
|
38289
38514
|
if (iteratorHelperStates.has(value) || iteratorWrapperStates.has(value))
|
|
@@ -38558,6 +38783,12 @@ function measureSandboxData(values, options = {}) {
|
|
|
38558
38783
|
}
|
|
38559
38784
|
if (isSandboxArrayIterator(value)) visit(arrayIteratorState(value).source, depth + 1);
|
|
38560
38785
|
if (isSandboxStringIterator(value)) visit(stringIteratorState(value).input, depth + 1);
|
|
38786
|
+
if (isSandboxSegmenter(value)) visit(segmenterState(value).options, depth + 1);
|
|
38787
|
+
if (isSandboxSegments(value)) {
|
|
38788
|
+
const state = segmentState(value);
|
|
38789
|
+
visit(state.segmenter, depth + 1);
|
|
38790
|
+
visit(state.input, depth + 1);
|
|
38791
|
+
}
|
|
38561
38792
|
if (isSandboxRegExpIterator(value)) {
|
|
38562
38793
|
const state = regexpIteratorState(value);
|
|
38563
38794
|
visit(state.matcher, depth + 1);
|
|
@@ -56481,4 +56712,4 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
56481
56712
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
56482
56713
|
|
|
56483
56714
|
*/
|
|
56484
|
-
//# sourceMappingURL=chunk-
|
|
56715
|
+
//# sourceMappingURL=chunk-N45AVH5W.js.map
|