@poe-platform/safe-js 0.1.180 → 0.1.182

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.
@@ -10658,8 +10658,10 @@ function callStringMethodBody(value, methodName, args, budget, parent, context)
10658
10658
  return budget.allocateString(result + value.slice(spanStart));
10659
10659
  }
10660
10660
  const regex = args[0];
10661
- if (methodName === "match" && isSandboxRegex(regex) && getSandboxPropertyDescriptor(regex, "exec", budget) !== void 0)
10662
- return callCustomRegexMatch(value, regex, budget, context);
10661
+ if (methodName === "search" && isSandboxRegex(regex) && getSandboxPropertyDescriptor(regex, "exec", budget) !== void 0)
10662
+ return callCustomRegexSearch(value, regex, budget, context);
10663
+ if (methodName === "match" && isSandboxRegex(regex) && ["exec", "flags", ...Object.keys(regexFlagProperties)].some((key) => getSandboxPropertyDescriptor(regex, key, budget) !== void 0))
10664
+ return callObservableRegexMatch(value, regex, budget, context);
10663
10665
  if (isSandboxRegex(regex) && (methodName === "matchAll" || methodName === "match" && !regex.flags.includes("g") && regex.lastIndex !== null && typeof regex.lastIndex === "object")) {
10664
10666
  return callStringRegexCursor(value, methodName, regex, budget, parent, context);
10665
10667
  }
@@ -11007,7 +11009,23 @@ async function callStringPattern(value, methodName, pattern, budget, parent, con
11007
11009
  operation.release();
11008
11010
  }
11009
11011
  }
11010
- async function callCustomRegexMatch(value, regex, budget, context) {
11012
+ async function callCustomRegexSearch(value, regex, budget, context) {
11013
+ const previousIndex = regex.lastIndex;
11014
+ let result;
11015
+ const release = retainValues(budget, () => [value, regex, previousIndex, result]);
11016
+ try {
11017
+ if (!Object.is(previousIndex, 0)) regex.lastIndex = 0;
11018
+ result = await regexExec(regex, value, budget, context);
11019
+ if (!Object.is(regex.lastIndex, previousIndex)) regex.lastIndex = previousIndex;
11020
+ if (result === null) return -1;
11021
+ if (context?.getProperty !== void 0) return await context.getProperty(result, "index");
11022
+ const descriptor = getSandboxPropertyDescriptor(result, "index", budget);
11023
+ return descriptor === void 0 ? void 0 : await readPropertyDescriptor(descriptor, result, context);
11024
+ } finally {
11025
+ release();
11026
+ }
11027
+ }
11028
+ async function callObservableRegexMatch(value, regex, budget, context) {
11011
11029
  const matches = [];
11012
11030
  let result;
11013
11031
  let matched;
@@ -36549,4 +36567,4 @@ export {
36549
36567
  FileSnapshotBackend,
36550
36568
  run
36551
36569
  };
36552
- //# sourceMappingURL=chunk-V2ZFZP6Y.js.map
36570
+ //# sourceMappingURL=chunk-A6KP64IV.js.map