babel-plugin-react-compiler 19.0.0-beta-37ed2a7-20241206 → 19.0.0-beta-b2e8e9c-20241220

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.
Files changed (2) hide show
  1. package/dist/index.js +1238 -2103
  2. package/package.json +1 -3
package/dist/index.js CHANGED
@@ -12895,13 +12895,13 @@ function requireAncestry$1() {
12895
12895
  var inference$1 = {};
12896
12896
  var inferers$1 = {};
12897
12897
  var infererReference$1 = {};
12898
- var util$7 = {};
12898
+ var util$6 = {};
12899
12899
  var hasRequiredUtil$1;
12900
12900
  function requireUtil$1() {
12901
- if (hasRequiredUtil$1) return util$7;
12901
+ if (hasRequiredUtil$1) return util$6;
12902
12902
  hasRequiredUtil$1 = 1;
12903
- Object.defineProperty(util$7, '__esModule', {value: true});
12904
- util$7.createUnionType = createUnionType;
12903
+ Object.defineProperty(util$6, '__esModule', {value: true});
12904
+ util$6.createUnionType = createUnionType;
12905
12905
  var _t = t$d;
12906
12906
  const {
12907
12907
  createFlowUnionType: createFlowUnionType,
@@ -12924,7 +12924,7 @@ function requireUtil$1() {
12924
12924
  }
12925
12925
  }
12926
12926
  }
12927
- return util$7;
12927
+ return util$6;
12928
12928
  }
12929
12929
  var hasRequiredInfererReference$1;
12930
12930
  function requireInfererReference$1() {
@@ -50740,7 +50740,7 @@ function requireLib$g() {
50740
50740
  })(lib$d);
50741
50741
  return lib$d;
50742
50742
  }
50743
- var chalk$2 = {exports: {}};
50743
+ var chalk$1 = {exports: {}};
50744
50744
  var escapeStringRegexp$1;
50745
50745
  var hasRequiredEscapeStringRegexp$1;
50746
50746
  function requireEscapeStringRegexp$1() {
@@ -50755,14 +50755,14 @@ function requireEscapeStringRegexp$1() {
50755
50755
  };
50756
50756
  return escapeStringRegexp$1;
50757
50757
  }
50758
- var ansiStyles$3 = {exports: {}};
50759
- var conversions$4 = {exports: {}};
50760
- var colorName$2;
50761
- var hasRequiredColorName$1;
50762
- function requireColorName$1() {
50763
- if (hasRequiredColorName$1) return colorName$2;
50764
- hasRequiredColorName$1 = 1;
50765
- colorName$2 = {
50758
+ var ansiStyles$1 = {exports: {}};
50759
+ var conversions$3 = {exports: {}};
50760
+ var colorName$1;
50761
+ var hasRequiredColorName;
50762
+ function requireColorName() {
50763
+ if (hasRequiredColorName) return colorName$1;
50764
+ hasRequiredColorName = 1;
50765
+ colorName$1 = {
50766
50766
  aliceblue: [240, 248, 255],
50767
50767
  antiquewhite: [250, 235, 215],
50768
50768
  aqua: [0, 255, 255],
@@ -50912,20 +50912,20 @@ function requireColorName$1() {
50912
50912
  yellow: [255, 255, 0],
50913
50913
  yellowgreen: [154, 205, 50],
50914
50914
  };
50915
- return colorName$2;
50915
+ return colorName$1;
50916
50916
  }
50917
- var hasRequiredConversions$1;
50918
- function requireConversions$1() {
50919
- if (hasRequiredConversions$1) return conversions$4.exports;
50920
- hasRequiredConversions$1 = 1;
50921
- var cssKeywords = requireColorName$1();
50917
+ var hasRequiredConversions;
50918
+ function requireConversions() {
50919
+ if (hasRequiredConversions) return conversions$3.exports;
50920
+ hasRequiredConversions = 1;
50921
+ var cssKeywords = requireColorName();
50922
50922
  var reverseKeywords = {};
50923
50923
  for (var key in cssKeywords) {
50924
50924
  if (cssKeywords.hasOwnProperty(key)) {
50925
50925
  reverseKeywords[cssKeywords[key]] = key;
50926
50926
  }
50927
50927
  }
50928
- var convert = (conversions$4.exports = {
50928
+ var convert = (conversions$3.exports = {
50929
50929
  rgb: {channels: 3, labels: 'rgb'},
50930
50930
  hsl: {channels: 3, labels: 'hsl'},
50931
50931
  hsv: {channels: 3, labels: 'hsv'},
@@ -51647,14 +51647,14 @@ function requireConversions$1() {
51647
51647
  var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
51648
51648
  return [(val / 255) * 100];
51649
51649
  };
51650
- return conversions$4.exports;
51651
- }
51652
- var route$3;
51653
- var hasRequiredRoute$1;
51654
- function requireRoute$1() {
51655
- if (hasRequiredRoute$1) return route$3;
51656
- hasRequiredRoute$1 = 1;
51657
- var conversions = requireConversions$1();
51650
+ return conversions$3.exports;
51651
+ }
51652
+ var route$2;
51653
+ var hasRequiredRoute;
51654
+ function requireRoute() {
51655
+ if (hasRequiredRoute) return route$2;
51656
+ hasRequiredRoute = 1;
51657
+ var conversions = requireConversions();
51658
51658
  function buildGraph() {
51659
51659
  var graph = {};
51660
51660
  var models = Object.keys(conversions);
@@ -51699,7 +51699,7 @@ function requireRoute$1() {
51699
51699
  fn.conversion = path;
51700
51700
  return fn;
51701
51701
  }
51702
- route$3 = function (fromModel) {
51702
+ route$2 = function (fromModel) {
51703
51703
  var graph = deriveBFS(fromModel);
51704
51704
  var conversion = {};
51705
51705
  var models = Object.keys(graph);
@@ -51713,15 +51713,15 @@ function requireRoute$1() {
51713
51713
  }
51714
51714
  return conversion;
51715
51715
  };
51716
- return route$3;
51717
- }
51718
- var colorConvert$2;
51719
- var hasRequiredColorConvert$1;
51720
- function requireColorConvert$1() {
51721
- if (hasRequiredColorConvert$1) return colorConvert$2;
51722
- hasRequiredColorConvert$1 = 1;
51723
- var conversions = requireConversions$1();
51724
- var route = requireRoute$1();
51716
+ return route$2;
51717
+ }
51718
+ var colorConvert$1;
51719
+ var hasRequiredColorConvert;
51720
+ function requireColorConvert() {
51721
+ if (hasRequiredColorConvert) return colorConvert$1;
51722
+ hasRequiredColorConvert = 1;
51723
+ var conversions = requireConversions();
51724
+ var route = requireRoute();
51725
51725
  var convert = {};
51726
51726
  var models = Object.keys(conversions);
51727
51727
  function wrapRaw(fn) {
@@ -51776,16 +51776,16 @@ function requireColorConvert$1() {
51776
51776
  convert[fromModel][toModel].raw = wrapRaw(fn);
51777
51777
  });
51778
51778
  });
51779
- colorConvert$2 = convert;
51780
- return colorConvert$2;
51779
+ colorConvert$1 = convert;
51780
+ return colorConvert$1;
51781
51781
  }
51782
- ansiStyles$3.exports;
51782
+ ansiStyles$1.exports;
51783
51783
  var hasRequiredAnsiStyles;
51784
51784
  function requireAnsiStyles() {
51785
- if (hasRequiredAnsiStyles) return ansiStyles$3.exports;
51785
+ if (hasRequiredAnsiStyles) return ansiStyles$1.exports;
51786
51786
  hasRequiredAnsiStyles = 1;
51787
51787
  (function (module) {
51788
- const colorConvert = requireColorConvert$1();
51788
+ const colorConvert = requireColorConvert();
51789
51789
  const wrapAnsi16 = (fn, offset) =>
51790
51790
  function () {
51791
51791
  const code = fn.apply(colorConvert, arguments);
@@ -51906,27 +51906,27 @@ function requireAnsiStyles() {
51906
51906
  enumerable: true,
51907
51907
  get: assembleStyles,
51908
51908
  });
51909
- })(ansiStyles$3);
51910
- return ansiStyles$3.exports;
51909
+ })(ansiStyles$1);
51910
+ return ansiStyles$1.exports;
51911
51911
  }
51912
- var hasFlag$3;
51912
+ var hasFlag$1;
51913
51913
  var hasRequiredHasFlag$1;
51914
51914
  function requireHasFlag$1() {
51915
- if (hasRequiredHasFlag$1) return hasFlag$3;
51915
+ if (hasRequiredHasFlag$1) return hasFlag$1;
51916
51916
  hasRequiredHasFlag$1 = 1;
51917
- hasFlag$3 = (flag, argv) => {
51917
+ hasFlag$1 = (flag, argv) => {
51918
51918
  argv = argv || process.argv;
51919
51919
  const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
51920
51920
  const pos = argv.indexOf(prefix + flag);
51921
51921
  const terminatorPos = argv.indexOf('--');
51922
51922
  return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
51923
51923
  };
51924
- return hasFlag$3;
51924
+ return hasFlag$1;
51925
51925
  }
51926
- var supportsColor_1$2;
51926
+ var supportsColor_1$1;
51927
51927
  var hasRequiredSupportsColor$1;
51928
51928
  function requireSupportsColor$1() {
51929
- if (hasRequiredSupportsColor$1) return supportsColor_1$2;
51929
+ if (hasRequiredSupportsColor$1) return supportsColor_1$1;
51930
51930
  hasRequiredSupportsColor$1 = 1;
51931
51931
  const os = require$$0$3;
51932
51932
  const hasFlag = requireHasFlag$1();
@@ -52037,18 +52037,18 @@ function requireSupportsColor$1() {
52037
52037
  const level = supportsColor(stream);
52038
52038
  return translateLevel(level);
52039
52039
  }
52040
- supportsColor_1$2 = {
52040
+ supportsColor_1$1 = {
52041
52041
  supportsColor: getSupportLevel,
52042
52042
  stdout: getSupportLevel(process.stdout),
52043
52043
  stderr: getSupportLevel(process.stderr),
52044
52044
  };
52045
- return supportsColor_1$2;
52045
+ return supportsColor_1$1;
52046
52046
  }
52047
- var templates$2;
52048
- var hasRequiredTemplates$2;
52049
- function requireTemplates$2() {
52050
- if (hasRequiredTemplates$2) return templates$2;
52051
- hasRequiredTemplates$2 = 1;
52047
+ var templates$1;
52048
+ var hasRequiredTemplates$1;
52049
+ function requireTemplates$1() {
52050
+ if (hasRequiredTemplates$1) return templates$1;
52051
+ hasRequiredTemplates$1 = 1;
52052
52052
  const TEMPLATE_REGEX =
52053
52053
  /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
52054
52054
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
@@ -52130,7 +52130,7 @@ function requireTemplates$2() {
52130
52130
  }
52131
52131
  return current;
52132
52132
  }
52133
- templates$2 = (chalk, tmp) => {
52133
+ templates$1 = (chalk, tmp) => {
52134
52134
  const styles = [];
52135
52135
  const chunks = [];
52136
52136
  let chunk = [];
@@ -52160,17 +52160,17 @@ function requireTemplates$2() {
52160
52160
  }
52161
52161
  return chunks.join('');
52162
52162
  };
52163
- return templates$2;
52163
+ return templates$1;
52164
52164
  }
52165
52165
  var hasRequiredChalk$1;
52166
52166
  function requireChalk$1() {
52167
- if (hasRequiredChalk$1) return chalk$2.exports;
52167
+ if (hasRequiredChalk$1) return chalk$1.exports;
52168
52168
  hasRequiredChalk$1 = 1;
52169
52169
  (function (module) {
52170
52170
  const escapeStringRegexp = requireEscapeStringRegexp$1();
52171
52171
  const ansiStyles = requireAnsiStyles();
52172
52172
  const stdoutColor = requireSupportsColor$1().stdout;
52173
- const template = requireTemplates$2();
52173
+ const template = requireTemplates$1();
52174
52174
  const isSimpleWindowsTerm =
52175
52175
  process.platform === 'win32' &&
52176
52176
  !(process.env.TERM || '').toLowerCase().startsWith('xterm');
@@ -52358,8 +52358,8 @@ function requireChalk$1() {
52358
52358
  module.exports = Chalk();
52359
52359
  module.exports.supportsColor = stdoutColor;
52360
52360
  module.exports.default = module.exports;
52361
- })(chalk$2);
52362
- return chalk$2.exports;
52361
+ })(chalk$1);
52362
+ return chalk$1.exports;
52363
52363
  }
52364
52364
  var hasRequiredLib$f;
52365
52365
  function requireLib$f() {
@@ -65086,7 +65086,7 @@ function requireLib$9() {
65086
65086
  })(lib$7);
65087
65087
  return lib$7;
65088
65088
  }
65089
- var chalk$1 = {exports: {}};
65089
+ var chalk = {exports: {}};
65090
65090
  var escapeStringRegexp;
65091
65091
  var hasRequiredEscapeStringRegexp;
65092
65092
  function requireEscapeStringRegexp() {
@@ -65101,9 +65101,9 @@ function requireEscapeStringRegexp() {
65101
65101
  };
65102
65102
  return escapeStringRegexp;
65103
65103
  }
65104
- var ansiStyles$2 = {exports: {}};
65105
- var conversions$3 = {exports: {}};
65106
- var colorName$1 = {
65104
+ var ansiStyles = {exports: {}};
65105
+ var conversions$2 = {exports: {}};
65106
+ var colorName = {
65107
65107
  aliceblue: [240, 248, 255],
65108
65108
  antiquewhite: [250, 235, 215],
65109
65109
  aqua: [0, 255, 255],
@@ -65253,14 +65253,14 @@ var colorName$1 = {
65253
65253
  yellow: [255, 255, 0],
65254
65254
  yellowgreen: [154, 205, 50],
65255
65255
  };
65256
- var cssKeywords = colorName$1;
65256
+ var cssKeywords = colorName;
65257
65257
  var reverseKeywords = {};
65258
65258
  for (var key$1 in cssKeywords) {
65259
65259
  if (cssKeywords.hasOwnProperty(key$1)) {
65260
65260
  reverseKeywords[cssKeywords[key$1]] = key$1;
65261
65261
  }
65262
65262
  }
65263
- var convert$1 = (conversions$3.exports = {
65263
+ var convert$1 = (conversions$2.exports = {
65264
65264
  rgb: {channels: 3, labels: 'rgb'},
65265
65265
  hsl: {channels: 3, labels: 'hsl'},
65266
65266
  hsv: {channels: 3, labels: 'hsv'},
@@ -65978,11 +65978,11 @@ convert$1.rgb.gray = function (rgb) {
65978
65978
  var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
65979
65979
  return [(val / 255) * 100];
65980
65980
  };
65981
- var conversionsExports = conversions$3.exports;
65982
- var conversions$2 = conversionsExports;
65981
+ var conversionsExports = conversions$2.exports;
65982
+ var conversions$1 = conversionsExports;
65983
65983
  function buildGraph() {
65984
65984
  var graph = {};
65985
- var models = Object.keys(conversions$2);
65985
+ var models = Object.keys(conversions$1);
65986
65986
  for (var len = models.length, i = 0; i < len; i++) {
65987
65987
  graph[models[i]] = {distance: -1, parent: null};
65988
65988
  }
@@ -65994,7 +65994,7 @@ function deriveBFS(fromModel) {
65994
65994
  graph[fromModel].distance = 0;
65995
65995
  while (queue.length) {
65996
65996
  var current = queue.pop();
65997
- var adjacents = Object.keys(conversions$2[current]);
65997
+ var adjacents = Object.keys(conversions$1[current]);
65998
65998
  for (var len = adjacents.length, i = 0; i < len; i++) {
65999
65999
  var adjacent = adjacents[i];
66000
66000
  var node = graph[adjacent];
@@ -66014,17 +66014,17 @@ function link(from, to) {
66014
66014
  }
66015
66015
  function wrapConversion(toModel, graph) {
66016
66016
  var path = [graph[toModel].parent, toModel];
66017
- var fn = conversions$2[graph[toModel].parent][toModel];
66017
+ var fn = conversions$1[graph[toModel].parent][toModel];
66018
66018
  var cur = graph[toModel].parent;
66019
66019
  while (graph[cur].parent) {
66020
66020
  path.unshift(graph[cur].parent);
66021
- fn = link(conversions$2[graph[cur].parent][cur], fn);
66021
+ fn = link(conversions$1[graph[cur].parent][cur], fn);
66022
66022
  cur = graph[cur].parent;
66023
66023
  }
66024
66024
  fn.conversion = path;
66025
66025
  return fn;
66026
66026
  }
66027
- var route$2 = function (fromModel) {
66027
+ var route$1 = function (fromModel) {
66028
66028
  var graph = deriveBFS(fromModel);
66029
66029
  var conversion = {};
66030
66030
  var models = Object.keys(graph);
@@ -66038,10 +66038,10 @@ var route$2 = function (fromModel) {
66038
66038
  }
66039
66039
  return conversion;
66040
66040
  };
66041
- var conversions$1 = conversionsExports;
66042
- var route$1 = route$2;
66041
+ var conversions = conversionsExports;
66042
+ var route = route$1;
66043
66043
  var convert = {};
66044
- var models = Object.keys(conversions$1);
66044
+ var models = Object.keys(conversions);
66045
66045
  function wrapRaw(fn) {
66046
66046
  var wrappedFn = function (args) {
66047
66047
  if (args === undefined || args === null) {
@@ -66081,12 +66081,12 @@ function wrapRounded(fn) {
66081
66081
  models.forEach(function (fromModel) {
66082
66082
  convert[fromModel] = {};
66083
66083
  Object.defineProperty(convert[fromModel], 'channels', {
66084
- value: conversions$1[fromModel].channels,
66084
+ value: conversions[fromModel].channels,
66085
66085
  });
66086
66086
  Object.defineProperty(convert[fromModel], 'labels', {
66087
- value: conversions$1[fromModel].labels,
66087
+ value: conversions[fromModel].labels,
66088
66088
  });
66089
- var routes = route$1(fromModel);
66089
+ var routes = route(fromModel);
66090
66090
  var routeModels = Object.keys(routes);
66091
66091
  routeModels.forEach(function (toModel) {
66092
66092
  var fn = routes[toModel];
@@ -66094,23 +66094,23 @@ models.forEach(function (fromModel) {
66094
66094
  convert[fromModel][toModel].raw = wrapRaw(fn);
66095
66095
  });
66096
66096
  });
66097
- var colorConvert$1 = convert;
66098
- ansiStyles$2.exports;
66097
+ var colorConvert = convert;
66098
+ ansiStyles.exports;
66099
66099
  (function (module) {
66100
- const colorConvert = colorConvert$1;
66100
+ const colorConvert$1 = colorConvert;
66101
66101
  const wrapAnsi16 = (fn, offset) =>
66102
66102
  function () {
66103
- const code = fn.apply(colorConvert, arguments);
66103
+ const code = fn.apply(colorConvert$1, arguments);
66104
66104
  return `[${code + offset}m`;
66105
66105
  };
66106
66106
  const wrapAnsi256 = (fn, offset) =>
66107
66107
  function () {
66108
- const code = fn.apply(colorConvert, arguments);
66108
+ const code = fn.apply(colorConvert$1, arguments);
66109
66109
  return `[${38 + offset};5;${code}m`;
66110
66110
  };
66111
66111
  const wrapAnsi16m = (fn, offset) =>
66112
66112
  function () {
66113
- const rgb = fn.apply(colorConvert, arguments);
66113
+ const rgb = fn.apply(colorConvert$1, arguments);
66114
66114
  return `[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
66115
66115
  };
66116
66116
  function assembleStyles() {
@@ -66188,11 +66188,11 @@ ansiStyles$2.exports;
66188
66188
  styles.bgColor.ansi = {ansi: wrapAnsi16(ansi2ansi, 10)};
66189
66189
  styles.bgColor.ansi256 = {ansi256: wrapAnsi256(ansi2ansi, 10)};
66190
66190
  styles.bgColor.ansi16m = {rgb: wrapAnsi16m(rgb2rgb, 10)};
66191
- for (let key of Object.keys(colorConvert)) {
66192
- if (typeof colorConvert[key] !== 'object') {
66191
+ for (let key of Object.keys(colorConvert$1)) {
66192
+ if (typeof colorConvert$1[key] !== 'object') {
66193
66193
  continue;
66194
66194
  }
66195
- const suite = colorConvert[key];
66195
+ const suite = colorConvert$1[key];
66196
66196
  if (key === 'ansi16') {
66197
66197
  key = 'ansi';
66198
66198
  }
@@ -66215,26 +66215,26 @@ ansiStyles$2.exports;
66215
66215
  enumerable: true,
66216
66216
  get: assembleStyles,
66217
66217
  });
66218
- })(ansiStyles$2);
66219
- var ansiStylesExports$1 = ansiStyles$2.exports;
66220
- var hasFlag$2;
66218
+ })(ansiStyles);
66219
+ var ansiStylesExports = ansiStyles.exports;
66220
+ var hasFlag;
66221
66221
  var hasRequiredHasFlag;
66222
66222
  function requireHasFlag() {
66223
- if (hasRequiredHasFlag) return hasFlag$2;
66223
+ if (hasRequiredHasFlag) return hasFlag;
66224
66224
  hasRequiredHasFlag = 1;
66225
- hasFlag$2 = (flag, argv) => {
66225
+ hasFlag = (flag, argv) => {
66226
66226
  argv = argv || process.argv;
66227
66227
  const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
66228
66228
  const pos = argv.indexOf(prefix + flag);
66229
66229
  const terminatorPos = argv.indexOf('--');
66230
66230
  return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
66231
66231
  };
66232
- return hasFlag$2;
66232
+ return hasFlag;
66233
66233
  }
66234
- var supportsColor_1$1;
66234
+ var supportsColor_1;
66235
66235
  var hasRequiredSupportsColor;
66236
66236
  function requireSupportsColor() {
66237
- if (hasRequiredSupportsColor) return supportsColor_1$1;
66237
+ if (hasRequiredSupportsColor) return supportsColor_1;
66238
66238
  hasRequiredSupportsColor = 1;
66239
66239
  const os = require$$0$3;
66240
66240
  const hasFlag = requireHasFlag();
@@ -66345,18 +66345,18 @@ function requireSupportsColor() {
66345
66345
  const level = supportsColor(stream);
66346
66346
  return translateLevel(level);
66347
66347
  }
66348
- supportsColor_1$1 = {
66348
+ supportsColor_1 = {
66349
66349
  supportsColor: getSupportLevel,
66350
66350
  stdout: getSupportLevel(process.stdout),
66351
66351
  stderr: getSupportLevel(process.stderr),
66352
66352
  };
66353
- return supportsColor_1$1;
66353
+ return supportsColor_1;
66354
66354
  }
66355
- var templates$1;
66356
- var hasRequiredTemplates$1;
66357
- function requireTemplates$1() {
66358
- if (hasRequiredTemplates$1) return templates$1;
66359
- hasRequiredTemplates$1 = 1;
66355
+ var templates;
66356
+ var hasRequiredTemplates;
66357
+ function requireTemplates() {
66358
+ if (hasRequiredTemplates) return templates;
66359
+ hasRequiredTemplates = 1;
66360
66360
  const TEMPLATE_REGEX =
66361
66361
  /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
66362
66362
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
@@ -66438,7 +66438,7 @@ function requireTemplates$1() {
66438
66438
  }
66439
66439
  return current;
66440
66440
  }
66441
- templates$1 = (chalk, tmp) => {
66441
+ templates = (chalk, tmp) => {
66442
66442
  const styles = [];
66443
66443
  const chunks = [];
66444
66444
  let chunk = [];
@@ -66468,17 +66468,17 @@ function requireTemplates$1() {
66468
66468
  }
66469
66469
  return chunks.join('');
66470
66470
  };
66471
- return templates$1;
66471
+ return templates;
66472
66472
  }
66473
66473
  var hasRequiredChalk;
66474
66474
  function requireChalk() {
66475
- if (hasRequiredChalk) return chalk$1.exports;
66475
+ if (hasRequiredChalk) return chalk.exports;
66476
66476
  hasRequiredChalk = 1;
66477
66477
  (function (module) {
66478
66478
  const escapeStringRegexp = requireEscapeStringRegexp();
66479
- const ansiStyles = ansiStylesExports$1;
66479
+ const ansiStyles = ansiStylesExports;
66480
66480
  const stdoutColor = requireSupportsColor().stdout;
66481
- const template = requireTemplates$1();
66481
+ const template = requireTemplates();
66482
66482
  const isSimpleWindowsTerm =
66483
66483
  process.platform === 'win32' &&
66484
66484
  !(process.env.TERM || '').toLowerCase().startsWith('xterm');
@@ -66666,8 +66666,8 @@ function requireChalk() {
66666
66666
  module.exports = Chalk();
66667
66667
  module.exports.supportsColor = stdoutColor;
66668
66668
  module.exports.default = module.exports;
66669
- })(chalk$1);
66670
- return chalk$1.exports;
66669
+ })(chalk);
66670
+ return chalk.exports;
66671
66671
  }
66672
66672
  var hasRequiredLib$8;
66673
66673
  function requireLib$8() {
@@ -107002,10 +107002,10 @@ function requireBase64Vlq() {
107002
107002
  };
107003
107003
  return base64Vlq;
107004
107004
  }
107005
- var util$6 = {};
107005
+ var util$5 = {};
107006
107006
  var hasRequiredUtil;
107007
107007
  function requireUtil() {
107008
- if (hasRequiredUtil) return util$6;
107008
+ if (hasRequiredUtil) return util$5;
107009
107009
  hasRequiredUtil = 1;
107010
107010
  (function (exports) {
107011
107011
  function getArg(aArgs, aName, aDefaultValue) {
@@ -107293,8 +107293,8 @@ function requireUtil() {
107293
107293
  }
107294
107294
  exports.compareByGeneratedPositionsInflated =
107295
107295
  compareByGeneratedPositionsInflated;
107296
- })(util$6);
107297
- return util$6;
107296
+ })(util$5);
107297
+ return util$5;
107298
107298
  }
107299
107299
  var arraySet = {};
107300
107300
  var hasRequiredArraySet;
@@ -113645,7 +113645,7 @@ var unicode = {
113645
113645
  ID_Start: ID_Start,
113646
113646
  ID_Continue: ID_Continue,
113647
113647
  };
113648
- var util$5 = {
113648
+ var util$4 = {
113649
113649
  isSpaceSeparator(c) {
113650
113650
  return typeof c === 'string' && unicode.Space_Separator.test(c);
113651
113651
  },
@@ -113804,7 +113804,7 @@ const lexStates = {
113804
113804
  read$1();
113805
113805
  return newToken('eof');
113806
113806
  }
113807
- if (util$5.isSpaceSeparator(c)) {
113807
+ if (util$4.isSpaceSeparator(c)) {
113808
113808
  read$1();
113809
113809
  return;
113810
113810
  }
@@ -113936,7 +113936,7 @@ const lexStates = {
113936
113936
  case '_':
113937
113937
  break;
113938
113938
  default:
113939
- if (!util$5.isIdStartChar(u)) {
113939
+ if (!util$4.isIdStartChar(u)) {
113940
113940
  throw invalidIdentifier();
113941
113941
  }
113942
113942
  break;
@@ -113957,7 +113957,7 @@ const lexStates = {
113957
113957
  lexState = 'identifierNameEscape';
113958
113958
  return;
113959
113959
  }
113960
- if (util$5.isIdContinueChar(c)) {
113960
+ if (util$4.isIdContinueChar(c)) {
113961
113961
  buffer$2 += read$1();
113962
113962
  return;
113963
113963
  }
@@ -113976,7 +113976,7 @@ const lexStates = {
113976
113976
  case '‍':
113977
113977
  break;
113978
113978
  default:
113979
- if (!util$5.isIdContinueChar(u)) {
113979
+ if (!util$4.isIdContinueChar(u)) {
113980
113980
  throw invalidIdentifier();
113981
113981
  }
113982
113982
  break;
@@ -114048,14 +114048,14 @@ const lexStates = {
114048
114048
  lexState = 'decimalExponent';
114049
114049
  return;
114050
114050
  }
114051
- if (util$5.isDigit(c)) {
114051
+ if (util$4.isDigit(c)) {
114052
114052
  buffer$2 += read$1();
114053
114053
  return;
114054
114054
  }
114055
114055
  return newToken('numeric', sign * Number(buffer$2));
114056
114056
  },
114057
114057
  decimalPointLeading() {
114058
- if (util$5.isDigit(c)) {
114058
+ if (util$4.isDigit(c)) {
114059
114059
  buffer$2 += read$1();
114060
114060
  lexState = 'decimalFraction';
114061
114061
  return;
@@ -114070,7 +114070,7 @@ const lexStates = {
114070
114070
  lexState = 'decimalExponent';
114071
114071
  return;
114072
114072
  }
114073
- if (util$5.isDigit(c)) {
114073
+ if (util$4.isDigit(c)) {
114074
114074
  buffer$2 += read$1();
114075
114075
  lexState = 'decimalFraction';
114076
114076
  return;
@@ -114085,7 +114085,7 @@ const lexStates = {
114085
114085
  lexState = 'decimalExponent';
114086
114086
  return;
114087
114087
  }
114088
- if (util$5.isDigit(c)) {
114088
+ if (util$4.isDigit(c)) {
114089
114089
  buffer$2 += read$1();
114090
114090
  return;
114091
114091
  }
@@ -114099,7 +114099,7 @@ const lexStates = {
114099
114099
  lexState = 'decimalExponentSign';
114100
114100
  return;
114101
114101
  }
114102
- if (util$5.isDigit(c)) {
114102
+ if (util$4.isDigit(c)) {
114103
114103
  buffer$2 += read$1();
114104
114104
  lexState = 'decimalExponentInteger';
114105
114105
  return;
@@ -114107,7 +114107,7 @@ const lexStates = {
114107
114107
  throw invalidChar(read$1());
114108
114108
  },
114109
114109
  decimalExponentSign() {
114110
- if (util$5.isDigit(c)) {
114110
+ if (util$4.isDigit(c)) {
114111
114111
  buffer$2 += read$1();
114112
114112
  lexState = 'decimalExponentInteger';
114113
114113
  return;
@@ -114115,14 +114115,14 @@ const lexStates = {
114115
114115
  throw invalidChar(read$1());
114116
114116
  },
114117
114117
  decimalExponentInteger() {
114118
- if (util$5.isDigit(c)) {
114118
+ if (util$4.isDigit(c)) {
114119
114119
  buffer$2 += read$1();
114120
114120
  return;
114121
114121
  }
114122
114122
  return newToken('numeric', sign * Number(buffer$2));
114123
114123
  },
114124
114124
  hexadecimal() {
114125
- if (util$5.isHexDigit(c)) {
114125
+ if (util$4.isHexDigit(c)) {
114126
114126
  buffer$2 += read$1();
114127
114127
  lexState = 'hexadecimalInteger';
114128
114128
  return;
@@ -114130,7 +114130,7 @@ const lexStates = {
114130
114130
  throw invalidChar(read$1());
114131
114131
  },
114132
114132
  hexadecimalInteger() {
114133
- if (util$5.isHexDigit(c)) {
114133
+ if (util$4.isHexDigit(c)) {
114134
114134
  buffer$2 += read$1();
114135
114135
  return;
114136
114136
  }
@@ -114195,7 +114195,7 @@ const lexStates = {
114195
114195
  lexState = 'string';
114196
114196
  return;
114197
114197
  }
114198
- if (util$5.isIdStartChar(c)) {
114198
+ if (util$4.isIdStartChar(c)) {
114199
114199
  buffer$2 += read$1();
114200
114200
  lexState = 'identifierName';
114201
114201
  return;
@@ -114272,7 +114272,7 @@ function escape() {
114272
114272
  return '\v';
114273
114273
  case '0':
114274
114274
  read$1();
114275
- if (util$5.isDigit(peek())) {
114275
+ if (util$4.isDigit(peek())) {
114276
114276
  throw invalidChar(read$1());
114277
114277
  }
114278
114278
  return '\0';
@@ -114311,12 +114311,12 @@ function escape() {
114311
114311
  function hexEscape() {
114312
114312
  let buffer = '';
114313
114313
  let c = peek();
114314
- if (!util$5.isHexDigit(c)) {
114314
+ if (!util$4.isHexDigit(c)) {
114315
114315
  throw invalidChar(read$1());
114316
114316
  }
114317
114317
  buffer += read$1();
114318
114318
  c = peek();
114319
- if (!util$5.isHexDigit(c)) {
114319
+ if (!util$4.isHexDigit(c)) {
114320
114320
  throw invalidChar(read$1());
114321
114321
  }
114322
114322
  buffer += read$1();
@@ -114327,7 +114327,7 @@ function unicodeEscape() {
114327
114327
  let count = 4;
114328
114328
  while (count-- > 0) {
114329
114329
  const c = peek();
114330
- if (!util$5.isHexDigit(c)) {
114330
+ if (!util$4.isHexDigit(c)) {
114331
114331
  throw invalidChar(read$1());
114332
114332
  }
114333
114333
  buffer += read$1();
@@ -114635,7 +114635,7 @@ var stringify = function stringify(value, replacer, space) {
114635
114635
  product += c;
114636
114636
  continue;
114637
114637
  case '\0':
114638
- if (util$5.isDigit(value[i + 1])) {
114638
+ if (util$4.isDigit(value[i + 1])) {
114639
114639
  product += '\\x00';
114640
114640
  continue;
114641
114641
  }
@@ -114703,11 +114703,11 @@ var stringify = function stringify(value, replacer, space) {
114703
114703
  return quoteString(key);
114704
114704
  }
114705
114705
  const firstChar = String.fromCodePoint(key.codePointAt(0));
114706
- if (!util$5.isIdStartChar(firstChar)) {
114706
+ if (!util$4.isIdStartChar(firstChar)) {
114707
114707
  return quoteString(key);
114708
114708
  }
114709
114709
  for (let i = firstChar.length; i < key.length; i++) {
114710
- if (!util$5.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
114710
+ if (!util$4.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
114711
114711
  return quoteString(key);
114712
114712
  }
114713
114713
  }
@@ -115014,7 +115014,7 @@ var inspector$1 = '>= 8';
115014
115014
  var _linklist$1 = '< 8';
115015
115015
  var module$2 = true;
115016
115016
  var net$1 = true;
115017
- var os$2 = true;
115017
+ var os$1 = true;
115018
115018
  var path$1 = true;
115019
115019
  var perf_hooks$1 = '>= 8.5';
115020
115020
  var process$3 = '>= 1';
@@ -115038,9 +115038,9 @@ var _tls_legacy$1 = '>= 0.11.3 && < 10';
115038
115038
  var _tls_wrap$1 = '>= 0.11.3';
115039
115039
  var tls$1 = true;
115040
115040
  var trace_events$1 = '>= 10';
115041
- var tty$2 = true;
115041
+ var tty$1 = true;
115042
115042
  var url$1 = true;
115043
- var util$4 = true;
115043
+ var util$3 = true;
115044
115044
  var v8$1 = '>= 1';
115045
115045
  var vm$1 = true;
115046
115046
  var wasi$1 = '>= 13.4 && < 13.5';
@@ -115113,7 +115113,7 @@ var require$$1 = {
115113
115113
  'node-inspect/lib/_inspect': '>= 7.6 && < 12',
115114
115114
  'node-inspect/lib/internal/inspect_client': '>= 7.6 && < 12',
115115
115115
  'node-inspect/lib/internal/inspect_repl': '>= 7.6 && < 12',
115116
- os: os$2,
115116
+ os: os$1,
115117
115117
  'node:os': ['>= 14.18 && < 15', '>= 16'],
115118
115118
  path: path$1,
115119
115119
  'node:path': ['>= 14.18 && < 15', '>= 16'],
@@ -115174,11 +115174,11 @@ var require$$1 = {
115174
115174
  'node:tls': ['>= 14.18 && < 15', '>= 16'],
115175
115175
  trace_events: trace_events$1,
115176
115176
  'node:trace_events': ['>= 14.18 && < 15', '>= 16'],
115177
- tty: tty$2,
115177
+ tty: tty$1,
115178
115178
  'node:tty': ['>= 14.18 && < 15', '>= 16'],
115179
115179
  url: url$1,
115180
115180
  'node:url': ['>= 14.18 && < 15', '>= 16'],
115181
- util: util$4,
115181
+ util: util$3,
115182
115182
  'node:util': ['>= 14.18 && < 15', '>= 16'],
115183
115183
  'util/types': '>= 15.3',
115184
115184
  'node:util/types': '>= 16',
@@ -115613,7 +115613,7 @@ var inspector = '>= 8';
115613
115613
  var _linklist = '< 8';
115614
115614
  var module$1 = true;
115615
115615
  var net = true;
115616
- var os$1 = true;
115616
+ var os = true;
115617
115617
  var path = true;
115618
115618
  var perf_hooks = '>= 8.5';
115619
115619
  var process$2 = '>= 1';
@@ -115637,9 +115637,9 @@ var _tls_legacy = '>= 0.11.3 && < 10';
115637
115637
  var _tls_wrap = '>= 0.11.3';
115638
115638
  var tls = true;
115639
115639
  var trace_events = '>= 10';
115640
- var tty$1 = true;
115640
+ var tty = true;
115641
115641
  var url = true;
115642
- var util$3 = true;
115642
+ var util$2 = true;
115643
115643
  var v8 = '>= 1';
115644
115644
  var vm = true;
115645
115645
  var wasi = '>= 13.4 && < 13.5';
@@ -115712,7 +115712,7 @@ var require$$0 = {
115712
115712
  'node-inspect/lib/_inspect': '>= 7.6 && < 12',
115713
115713
  'node-inspect/lib/internal/inspect_client': '>= 7.6 && < 12',
115714
115714
  'node-inspect/lib/internal/inspect_repl': '>= 7.6 && < 12',
115715
- os: os$1,
115715
+ os: os,
115716
115716
  'node:os': ['>= 14.18 && < 15', '>= 16'],
115717
115717
  path: path,
115718
115718
  'node:path': ['>= 14.18 && < 15', '>= 16'],
@@ -115773,11 +115773,11 @@ var require$$0 = {
115773
115773
  'node:tls': ['>= 14.18 && < 15', '>= 16'],
115774
115774
  trace_events: trace_events,
115775
115775
  'node:trace_events': ['>= 14.18 && < 15', '>= 16'],
115776
- tty: tty$1,
115776
+ tty: tty,
115777
115777
  'node:tty': ['>= 14.18 && < 15', '>= 16'],
115778
115778
  url: url,
115779
115779
  'node:url': ['>= 14.18 && < 15', '>= 16'],
115780
- util: util$3,
115780
+ util: util$2,
115781
115781
  'node:util': ['>= 14.18 && < 15', '>= 16'],
115782
115782
  'util/types': '>= 15.3',
115783
115783
  'node:util/types': '>= 16',
@@ -117063,9 +117063,9 @@ function requireItem() {
117063
117063
  }
117064
117064
  var config = {};
117065
117065
  var full = {};
117066
- var util$2 = {};
117067
- Object.defineProperty(util$2, '__esModule', {value: true});
117068
- util$2.mergeOptions = mergeOptions;
117066
+ var util$1 = {};
117067
+ Object.defineProperty(util$1, '__esModule', {value: true});
117068
+ util$1.mergeOptions = mergeOptions;
117069
117069
  function mergeOptions(target, source) {
117070
117070
  for (const k of Object.keys(source)) {
117071
117071
  if (k === 'parserOpts' && source.parserOpts) {
@@ -118223,7 +118223,7 @@ function requirePartial() {
118223
118223
  return data;
118224
118224
  }
118225
118225
  var _plugin = _interopRequireDefault(plugin$7);
118226
- var _util = util$2;
118226
+ var _util = util$1;
118227
118227
  var _item = requireItem();
118228
118228
  var _configChain = requireConfigChain();
118229
118229
  var _environment = environment;
@@ -118360,7 +118360,7 @@ function requireFull() {
118360
118360
  hasRequiredFull = 1;
118361
118361
  Object.defineProperty(full, '__esModule', {value: true});
118362
118362
  full.default = loadFullConfig;
118363
- var _util = util$2;
118363
+ var _util = util$1;
118364
118364
  var context = _interopRequireWildcard(requireLib());
118365
118365
  var _plugin = _interopRequireDefault(plugin$7);
118366
118366
  var _item = requireItem();
@@ -121963,7 +121963,7 @@ function phiTypeEquals(tA, tB) {
121963
121963
  }
121964
121964
  return false;
121965
121965
  }
121966
- var util$1;
121966
+ var util;
121967
121967
  (function (util) {
121968
121968
  util.assertEqual = val => val;
121969
121969
  function assertIs(_arg) {}
@@ -122028,12 +122028,12 @@ var util$1;
122028
122028
  }
122029
122029
  return value;
122030
122030
  };
122031
- })(util$1 || (util$1 = {}));
122031
+ })(util || (util = {}));
122032
122032
  var objectUtil;
122033
122033
  (function (objectUtil) {
122034
122034
  objectUtil.mergeShapes = (first, second) => ({...first, ...second});
122035
122035
  })(objectUtil || (objectUtil = {}));
122036
- const ZodParsedType = util$1.arrayToEnum([
122036
+ const ZodParsedType = util.arrayToEnum([
122037
122037
  'string',
122038
122038
  'nan',
122039
122039
  'number',
@@ -122101,7 +122101,7 @@ const getParsedType = data => {
122101
122101
  return ZodParsedType.unknown;
122102
122102
  }
122103
122103
  };
122104
- const ZodIssueCode = util$1.arrayToEnum([
122104
+ const ZodIssueCode = util.arrayToEnum([
122105
122105
  'invalid_type',
122106
122106
  'invalid_literal',
122107
122107
  'custom',
@@ -122187,7 +122187,7 @@ class ZodError extends Error {
122187
122187
  return this.message;
122188
122188
  }
122189
122189
  get message() {
122190
- return JSON.stringify(this.issues, util$1.jsonStringifyReplacer, 2);
122190
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
122191
122191
  }
122192
122192
  get isEmpty() {
122193
122193
  return this.issues.length === 0;
@@ -122224,19 +122224,19 @@ const errorMap = (issue, _ctx) => {
122224
122224
  }
122225
122225
  break;
122226
122226
  case ZodIssueCode.invalid_literal:
122227
- message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util$1.jsonStringifyReplacer)}`;
122227
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
122228
122228
  break;
122229
122229
  case ZodIssueCode.unrecognized_keys:
122230
- message = `Unrecognized key(s) in object: ${util$1.joinValues(issue.keys, ', ')}`;
122230
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ', ')}`;
122231
122231
  break;
122232
122232
  case ZodIssueCode.invalid_union:
122233
122233
  message = `Invalid input`;
122234
122234
  break;
122235
122235
  case ZodIssueCode.invalid_union_discriminator:
122236
- message = `Invalid discriminator value. Expected ${util$1.joinValues(issue.options)}`;
122236
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
122237
122237
  break;
122238
122238
  case ZodIssueCode.invalid_enum_value:
122239
- message = `Invalid enum value. Expected ${util$1.joinValues(issue.options)}, received '${issue.received}'`;
122239
+ message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
122240
122240
  break;
122241
122241
  case ZodIssueCode.invalid_arguments:
122242
122242
  message = `Invalid function arguments`;
@@ -122259,7 +122259,7 @@ const errorMap = (issue, _ctx) => {
122259
122259
  } else if ('endsWith' in issue.validation) {
122260
122260
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
122261
122261
  } else {
122262
- util$1.assertNever(issue.validation);
122262
+ util.assertNever(issue.validation);
122263
122263
  }
122264
122264
  } else if (issue.validation !== 'regex') {
122265
122265
  message = `Invalid ${issue.validation}`;
@@ -122305,7 +122305,7 @@ const errorMap = (issue, _ctx) => {
122305
122305
  break;
122306
122306
  default:
122307
122307
  message = _ctx.defaultError;
122308
- util$1.assertNever(issue);
122308
+ util.assertNever(issue);
122309
122309
  }
122310
122310
  return {message: message};
122311
122311
  };
@@ -123012,7 +123012,7 @@ class ZodString extends ZodType {
123012
123012
  status.dirty();
123013
123013
  }
123014
123014
  } else {
123015
- util$1.assertNever(check);
123015
+ util.assertNever(check);
123016
123016
  }
123017
123017
  }
123018
123018
  return {status: status.value, value: input.data};
@@ -123248,7 +123248,7 @@ class ZodNumber extends ZodType {
123248
123248
  const status = new ParseStatus();
123249
123249
  for (const check of this._def.checks) {
123250
123250
  if (check.kind === 'int') {
123251
- if (!util$1.isInteger(input.data)) {
123251
+ if (!util.isInteger(input.data)) {
123252
123252
  ctx = this._getOrReturnCtx(input, ctx);
123253
123253
  addIssueToContext(ctx, {
123254
123254
  code: ZodIssueCode.invalid_type,
@@ -123310,7 +123310,7 @@ class ZodNumber extends ZodType {
123310
123310
  status.dirty();
123311
123311
  }
123312
123312
  } else {
123313
- util$1.assertNever(check);
123313
+ util.assertNever(check);
123314
123314
  }
123315
123315
  }
123316
123316
  return {status: status.value, value: input.data};
@@ -123427,7 +123427,7 @@ class ZodNumber extends ZodType {
123427
123427
  return !!this._def.checks.find(
123428
123428
  ch =>
123429
123429
  ch.kind === 'int' ||
123430
- (ch.kind === 'multipleOf' && util$1.isInteger(ch.value))
123430
+ (ch.kind === 'multipleOf' && util.isInteger(ch.value))
123431
123431
  );
123432
123432
  }
123433
123433
  get isFinite() {
@@ -123521,7 +123521,7 @@ class ZodBigInt extends ZodType {
123521
123521
  status.dirty();
123522
123522
  }
123523
123523
  } else {
123524
- util$1.assertNever(check);
123524
+ util.assertNever(check);
123525
123525
  }
123526
123526
  }
123527
123527
  return {status: status.value, value: input.data};
@@ -123701,7 +123701,7 @@ class ZodDate extends ZodType {
123701
123701
  status.dirty();
123702
123702
  }
123703
123703
  } else {
123704
- util$1.assertNever(check);
123704
+ util.assertNever(check);
123705
123705
  }
123706
123706
  }
123707
123707
  return {status: status.value, value: new Date(input.data.getTime())};
@@ -124004,7 +124004,7 @@ class ZodObject extends ZodType {
124004
124004
  _getCached() {
124005
124005
  if (this._cached !== null) return this._cached;
124006
124006
  const shape = this._def.shape();
124007
- const keys = util$1.objectKeys(shape);
124007
+ const keys = util.objectKeys(shape);
124008
124008
  return (this._cached = {shape: shape, keys: keys});
124009
124009
  }
124010
124010
  _parse(input) {
@@ -124160,7 +124160,7 @@ class ZodObject extends ZodType {
124160
124160
  }
124161
124161
  pick(mask) {
124162
124162
  const shape = {};
124163
- util$1.objectKeys(mask).forEach(key => {
124163
+ util.objectKeys(mask).forEach(key => {
124164
124164
  if (mask[key] && this.shape[key]) {
124165
124165
  shape[key] = this.shape[key];
124166
124166
  }
@@ -124169,7 +124169,7 @@ class ZodObject extends ZodType {
124169
124169
  }
124170
124170
  omit(mask) {
124171
124171
  const shape = {};
124172
- util$1.objectKeys(this.shape).forEach(key => {
124172
+ util.objectKeys(this.shape).forEach(key => {
124173
124173
  if (!mask[key]) {
124174
124174
  shape[key] = this.shape[key];
124175
124175
  }
@@ -124181,7 +124181,7 @@ class ZodObject extends ZodType {
124181
124181
  }
124182
124182
  partial(mask) {
124183
124183
  const newShape = {};
124184
- util$1.objectKeys(this.shape).forEach(key => {
124184
+ util.objectKeys(this.shape).forEach(key => {
124185
124185
  const fieldSchema = this.shape[key];
124186
124186
  if (mask && !mask[key]) {
124187
124187
  newShape[key] = fieldSchema;
@@ -124193,7 +124193,7 @@ class ZodObject extends ZodType {
124193
124193
  }
124194
124194
  required(mask) {
124195
124195
  const newShape = {};
124196
- util$1.objectKeys(this.shape).forEach(key => {
124196
+ util.objectKeys(this.shape).forEach(key => {
124197
124197
  if (mask && !mask[key]) {
124198
124198
  newShape[key] = this.shape[key];
124199
124199
  } else {
@@ -124208,7 +124208,7 @@ class ZodObject extends ZodType {
124208
124208
  return new ZodObject({...this._def, shape: () => newShape});
124209
124209
  }
124210
124210
  keyof() {
124211
- return createZodEnum(util$1.objectKeys(this.shape));
124211
+ return createZodEnum(util.objectKeys(this.shape));
124212
124212
  }
124213
124213
  }
124214
124214
  ZodObject.create = (shape, params) =>
@@ -124414,8 +124414,8 @@ function mergeValues$1(a, b) {
124414
124414
  if (a === b) {
124415
124415
  return {valid: true, data: a};
124416
124416
  } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
124417
- const bKeys = util$1.objectKeys(b);
124418
- const sharedKeys = util$1
124417
+ const bKeys = util.objectKeys(b);
124418
+ const sharedKeys = util
124419
124419
  .objectKeys(a)
124420
124420
  .filter(key => bKeys.indexOf(key) !== -1);
124421
124421
  const newObj = {...a, ...b};
@@ -124945,7 +124945,7 @@ class ZodEnum extends ZodType {
124945
124945
  const ctx = this._getOrReturnCtx(input);
124946
124946
  const expectedValues = this._def.values;
124947
124947
  addIssueToContext(ctx, {
124948
- expected: util$1.joinValues(expectedValues),
124948
+ expected: util.joinValues(expectedValues),
124949
124949
  received: ctx.parsedType,
124950
124950
  code: ZodIssueCode.invalid_type,
124951
124951
  });
@@ -124997,22 +124997,22 @@ class ZodEnum extends ZodType {
124997
124997
  ZodEnum.create = createZodEnum;
124998
124998
  class ZodNativeEnum extends ZodType {
124999
124999
  _parse(input) {
125000
- const nativeEnumValues = util$1.getValidEnumValues(this._def.values);
125000
+ const nativeEnumValues = util.getValidEnumValues(this._def.values);
125001
125001
  const ctx = this._getOrReturnCtx(input);
125002
125002
  if (
125003
125003
  ctx.parsedType !== ZodParsedType.string &&
125004
125004
  ctx.parsedType !== ZodParsedType.number
125005
125005
  ) {
125006
- const expectedValues = util$1.objectValues(nativeEnumValues);
125006
+ const expectedValues = util.objectValues(nativeEnumValues);
125007
125007
  addIssueToContext(ctx, {
125008
- expected: util$1.joinValues(expectedValues),
125008
+ expected: util.joinValues(expectedValues),
125009
125009
  received: ctx.parsedType,
125010
125010
  code: ZodIssueCode.invalid_type,
125011
125011
  });
125012
125012
  return INVALID;
125013
125013
  }
125014
125014
  if (nativeEnumValues.indexOf(input.data) === -1) {
125015
- const expectedValues = util$1.objectValues(nativeEnumValues);
125015
+ const expectedValues = util.objectValues(nativeEnumValues);
125016
125016
  addIssueToContext(ctx, {
125017
125017
  received: ctx.data,
125018
125018
  code: ZodIssueCode.invalid_enum_value,
@@ -125178,7 +125178,7 @@ class ZodEffects extends ZodType {
125178
125178
  });
125179
125179
  }
125180
125180
  }
125181
- util$1.assertNever(effect);
125181
+ util.assertNever(effect);
125182
125182
  }
125183
125183
  }
125184
125184
  ZodEffects.create = (schema, effect, params) =>
@@ -125531,7 +125531,7 @@ var z = Object.freeze({
125531
125531
  isValid: isValid,
125532
125532
  isAsync: isAsync,
125533
125533
  get util() {
125534
- return util$1;
125534
+ return util;
125535
125535
  },
125536
125536
  get objectUtil() {
125537
125537
  return objectUtil;
@@ -125850,6 +125850,9 @@ function isPrimitiveType(id) {
125850
125850
  function isArrayType(id) {
125851
125851
  return id.type.kind === 'Object' && id.type.shapeId === 'BuiltInArray';
125852
125852
  }
125853
+ function isPropsType(id) {
125854
+ return id.type.kind === 'Object' && id.type.shapeId === 'BuiltInProps';
125855
+ }
125853
125856
  function isRefValueType(id) {
125854
125857
  return id.type.kind === 'Object' && id.type.shapeId === 'BuiltInRefValue';
125855
125858
  }
@@ -127067,6 +127070,13 @@ function printSourceLocation(loc) {
127067
127070
  return `${loc.start.line}:${loc.start.column}:${loc.end.line}:${loc.end.column}`;
127068
127071
  }
127069
127072
  }
127073
+ function printSourceLocationLine(loc) {
127074
+ if (typeof loc === 'symbol') {
127075
+ return 'generated';
127076
+ } else {
127077
+ return `${loc.start.line}:${loc.end.line}`;
127078
+ }
127079
+ }
127070
127080
  function getFunctionName$1(instrValue, defaultValue) {
127071
127081
  var _a;
127072
127082
  switch (instrValue.kind) {
@@ -129291,6 +129301,7 @@ const BuiltInDispatchId = 'BuiltInDispatch';
129291
129301
  const BuiltInUseContextHookId = 'BuiltInUseContextHook';
129292
129302
  const BuiltInUseTransitionId = 'BuiltInUseTransition';
129293
129303
  const BuiltInStartTransitionId = 'BuiltInStartTransition';
129304
+ const BuiltInFireId = 'BuiltInFire';
129294
129305
  const BUILTIN_SHAPES = new Map();
129295
129306
  addObject(BUILTIN_SHAPES, BuiltInPropsId, [
129296
129307
  ['ref', {kind: 'Object', shapeId: BuiltInUseRefId}],
@@ -129921,9 +129932,7 @@ function lowerStatement(builder, stmtPath, label = null) {
129921
129932
  _26,
129922
129933
  _27,
129923
129934
  _28,
129924
- _29,
129925
- _30,
129926
- _31;
129935
+ _29;
129927
129936
  const stmtNode = stmtPath.node;
129928
129937
  switch (stmtNode.type) {
129929
129938
  case 'ThrowStatement': {
@@ -130765,6 +130774,12 @@ function lowerStatement(builder, stmtPath, label = null) {
130765
130774
  ? _14
130766
130775
  : GeneratedSource;
130767
130776
  let test;
130777
+ const advanceIterator = lowerValueToTemporary(builder, {
130778
+ kind: 'IteratorNext',
130779
+ loc: leftLoc,
130780
+ iterator: Object.assign({}, iterator),
130781
+ collection: Object.assign({}, value),
130782
+ });
130768
130783
  if (left.isVariableDeclaration()) {
130769
130784
  const declarations = left.get('declarations');
130770
130785
  CompilerError.invariant(declarations.length === 1, {
@@ -130774,12 +130789,6 @@ function lowerStatement(builder, stmtPath, label = null) {
130774
130789
  suggestions: null,
130775
130790
  });
130776
130791
  const id = declarations[0].get('id');
130777
- const advanceIterator = lowerValueToTemporary(builder, {
130778
- kind: 'IteratorNext',
130779
- loc: leftLoc,
130780
- iterator: Object.assign({}, iterator),
130781
- collection: Object.assign({}, value),
130782
- });
130783
130792
  const assign = lowerAssignment(
130784
130793
  builder,
130785
130794
  leftLoc,
@@ -130790,13 +130799,19 @@ function lowerStatement(builder, stmtPath, label = null) {
130790
130799
  );
130791
130800
  test = lowerValueToTemporary(builder, assign);
130792
130801
  } else {
130793
- builder.errors.push({
130794
- reason: `(BuildHIR::lowerStatement) Handle ${left.type} inits in ForOfStatement`,
130795
- severity: exports.ErrorSeverity.Todo,
130796
- loc: (_16 = left.node.loc) !== null && _16 !== void 0 ? _16 : null,
130797
- suggestions: null,
130802
+ CompilerError.invariant(left.isLVal(), {
130803
+ loc: leftLoc,
130804
+ reason: 'Expected ForOf init to be a variable declaration or lval',
130798
130805
  });
130799
- return;
130806
+ const assign = lowerAssignment(
130807
+ builder,
130808
+ leftLoc,
130809
+ InstructionKind.Reassign,
130810
+ left,
130811
+ advanceIterator,
130812
+ 'Assignment'
130813
+ );
130814
+ test = lowerValueToTemporary(builder, assign);
130800
130815
  }
130801
130816
  builder.terminateWithContinuation(
130802
130817
  {
@@ -130806,8 +130821,8 @@ function lowerStatement(builder, stmtPath, label = null) {
130806
130821
  consequent: loopBlock,
130807
130822
  alternate: continuationBlock.id,
130808
130823
  loc:
130809
- (_17 = stmt.node.loc) !== null && _17 !== void 0
130810
- ? _17
130824
+ (_16 = stmt.node.loc) !== null && _16 !== void 0
130825
+ ? _16
130811
130826
  : GeneratedSource,
130812
130827
  fallthrough: continuationBlock.id,
130813
130828
  },
@@ -130837,8 +130852,8 @@ function lowerStatement(builder, stmtPath, label = null) {
130837
130852
  })
130838
130853
  );
130839
130854
  const loc =
130840
- (_18 = stmt.node.loc) !== null && _18 !== void 0
130841
- ? _18
130855
+ (_17 = stmt.node.loc) !== null && _17 !== void 0
130856
+ ? _17
130842
130857
  : GeneratedSource;
130843
130858
  const value = lowerExpressionToTemporary(builder, stmt.get('right'));
130844
130859
  builder.terminateWithContinuation(
@@ -130854,24 +130869,24 @@ function lowerStatement(builder, stmtPath, label = null) {
130854
130869
  );
130855
130870
  const left = stmt.get('left');
130856
130871
  const leftLoc =
130857
- (_19 = left.node.loc) !== null && _19 !== void 0
130858
- ? _19
130872
+ (_18 = left.node.loc) !== null && _18 !== void 0
130873
+ ? _18
130859
130874
  : GeneratedSource;
130860
130875
  let test;
130876
+ const nextPropertyTemp = lowerValueToTemporary(builder, {
130877
+ kind: 'NextPropertyOf',
130878
+ loc: leftLoc,
130879
+ value: value,
130880
+ });
130861
130881
  if (left.isVariableDeclaration()) {
130862
130882
  const declarations = left.get('declarations');
130863
130883
  CompilerError.invariant(declarations.length === 1, {
130864
130884
  reason: `Expected only one declaration in the init of a ForInStatement, got ${declarations.length}`,
130865
130885
  description: null,
130866
- loc: (_20 = left.node.loc) !== null && _20 !== void 0 ? _20 : null,
130886
+ loc: (_19 = left.node.loc) !== null && _19 !== void 0 ? _19 : null,
130867
130887
  suggestions: null,
130868
130888
  });
130869
130889
  const id = declarations[0].get('id');
130870
- const nextPropertyTemp = lowerValueToTemporary(builder, {
130871
- kind: 'NextPropertyOf',
130872
- loc: leftLoc,
130873
- value: value,
130874
- });
130875
130890
  const assign = lowerAssignment(
130876
130891
  builder,
130877
130892
  leftLoc,
@@ -130882,13 +130897,19 @@ function lowerStatement(builder, stmtPath, label = null) {
130882
130897
  );
130883
130898
  test = lowerValueToTemporary(builder, assign);
130884
130899
  } else {
130885
- builder.errors.push({
130886
- reason: `(BuildHIR::lowerStatement) Handle ${left.type} inits in ForInStatement`,
130887
- severity: exports.ErrorSeverity.Todo,
130888
- loc: (_21 = left.node.loc) !== null && _21 !== void 0 ? _21 : null,
130889
- suggestions: null,
130900
+ CompilerError.invariant(left.isLVal(), {
130901
+ loc: leftLoc,
130902
+ reason: 'Expected ForIn init to be a variable declaration or lval',
130890
130903
  });
130891
- return;
130904
+ const assign = lowerAssignment(
130905
+ builder,
130906
+ leftLoc,
130907
+ InstructionKind.Reassign,
130908
+ left,
130909
+ nextPropertyTemp,
130910
+ 'Assignment'
130911
+ );
130912
+ test = lowerValueToTemporary(builder, assign);
130892
130913
  }
130893
130914
  builder.terminateWithContinuation(
130894
130915
  {
@@ -130899,8 +130920,8 @@ function lowerStatement(builder, stmtPath, label = null) {
130899
130920
  alternate: continuationBlock.id,
130900
130921
  fallthrough: continuationBlock.id,
130901
130922
  loc:
130902
- (_22 = stmt.node.loc) !== null && _22 !== void 0
130903
- ? _22
130923
+ (_20 = stmt.node.loc) !== null && _20 !== void 0
130924
+ ? _20
130904
130925
  : GeneratedSource,
130905
130926
  },
130906
130927
  continuationBlock
@@ -130910,8 +130931,8 @@ function lowerStatement(builder, stmtPath, label = null) {
130910
130931
  case 'DebuggerStatement': {
130911
130932
  const stmt = stmtPath;
130912
130933
  const loc =
130913
- (_23 = stmt.node.loc) !== null && _23 !== void 0
130914
- ? _23
130934
+ (_21 = stmt.node.loc) !== null && _21 !== void 0
130935
+ ? _21
130915
130936
  : GeneratedSource;
130916
130937
  builder.push({
130917
130938
  id: makeInstructionId(0),
@@ -130932,7 +130953,7 @@ function lowerStatement(builder, stmtPath, label = null) {
130932
130953
  builder.errors.push({
130933
130954
  reason: `(BuildHIR::lowerStatement) Handle TryStatement without a catch clause`,
130934
130955
  severity: exports.ErrorSeverity.Todo,
130935
- loc: (_24 = stmt.node.loc) !== null && _24 !== void 0 ? _24 : null,
130956
+ loc: (_22 = stmt.node.loc) !== null && _22 !== void 0 ? _22 : null,
130936
130957
  suggestions: null,
130937
130958
  });
130938
130959
  return;
@@ -130941,7 +130962,7 @@ function lowerStatement(builder, stmtPath, label = null) {
130941
130962
  builder.errors.push({
130942
130963
  reason: `(BuildHIR::lowerStatement) Handle TryStatement with a finalizer ('finally') clause`,
130943
130964
  severity: exports.ErrorSeverity.Todo,
130944
- loc: (_25 = stmt.node.loc) !== null && _25 !== void 0 ? _25 : null,
130965
+ loc: (_23 = stmt.node.loc) !== null && _23 !== void 0 ? _23 : null,
130945
130966
  suggestions: null,
130946
130967
  });
130947
130968
  }
@@ -130951,15 +130972,15 @@ function lowerStatement(builder, stmtPath, label = null) {
130951
130972
  const place = {
130952
130973
  kind: 'Identifier',
130953
130974
  identifier: builder.makeTemporary(
130954
- (_26 = handlerBindingPath.node.loc) !== null && _26 !== void 0
130955
- ? _26
130975
+ (_24 = handlerBindingPath.node.loc) !== null && _24 !== void 0
130976
+ ? _24
130956
130977
  : GeneratedSource
130957
130978
  ),
130958
130979
  effect: exports.Effect.Unknown,
130959
130980
  reactive: false,
130960
130981
  loc:
130961
- (_27 = handlerBindingPath.node.loc) !== null && _27 !== void 0
130962
- ? _27
130982
+ (_25 = handlerBindingPath.node.loc) !== null && _25 !== void 0
130983
+ ? _25
130963
130984
  : GeneratedSource,
130964
130985
  };
130965
130986
  promoteTemporary(place.identifier);
@@ -130971,8 +130992,8 @@ function lowerStatement(builder, stmtPath, label = null) {
130971
130992
  },
130972
130993
  type: null,
130973
130994
  loc:
130974
- (_28 = handlerBindingPath.node.loc) !== null && _28 !== void 0
130975
- ? _28
130995
+ (_26 = handlerBindingPath.node.loc) !== null && _26 !== void 0
130996
+ ? _26
130976
130997
  : GeneratedSource,
130977
130998
  });
130978
130999
  handlerBinding = {path: handlerBindingPath, place: place};
@@ -131032,8 +131053,8 @@ function lowerStatement(builder, stmtPath, label = null) {
131032
131053
  fallthrough: continuationBlock.id,
131033
131054
  id: makeInstructionId(0),
131034
131055
  loc:
131035
- (_29 = stmt.node.loc) !== null && _29 !== void 0
131036
- ? _29
131056
+ (_27 = stmt.node.loc) !== null && _27 !== void 0
131057
+ ? _27
131037
131058
  : GeneratedSource,
131038
131059
  },
131039
131060
  continuationBlock
@@ -131073,14 +131094,14 @@ function lowerStatement(builder, stmtPath, label = null) {
131073
131094
  builder.errors.push({
131074
131095
  reason: `(BuildHIR::lowerStatement) Handle ${stmtPath.type} statements`,
131075
131096
  severity: exports.ErrorSeverity.Todo,
131076
- loc: (_30 = stmtPath.node.loc) !== null && _30 !== void 0 ? _30 : null,
131097
+ loc: (_28 = stmtPath.node.loc) !== null && _28 !== void 0 ? _28 : null,
131077
131098
  suggestions: null,
131078
131099
  });
131079
131100
  lowerValueToTemporary(builder, {
131080
131101
  kind: 'UnsupportedNode',
131081
131102
  loc:
131082
- (_31 = stmtPath.node.loc) !== null && _31 !== void 0
131083
- ? _31
131103
+ (_29 = stmtPath.node.loc) !== null && _29 !== void 0
131104
+ ? _29
131084
131105
  : GeneratedSource,
131085
131106
  node: stmtPath.node,
131086
131107
  });
@@ -134192,7 +134213,7 @@ var ansiRegex = options => {
134192
134213
  Object.defineProperty(ConvertAnsi, '__esModule', {value: true});
134193
134214
  ConvertAnsi.default = ConvertAnsi.serialize = ConvertAnsi.test = void 0;
134194
134215
  var _ansiRegex = _interopRequireDefault$2(ansiRegex);
134195
- var _ansiStyles$1 = _interopRequireDefault$2(ansiStylesExports$1);
134216
+ var _ansiStyles$1 = _interopRequireDefault$2(ansiStylesExports);
134196
134217
  function _interopRequireDefault$2(obj) {
134197
134218
  return obj && obj.__esModule ? obj : {default: obj};
134198
134219
  }
@@ -135249,7 +135270,7 @@ ReactTestComponent.test = test;
135249
135270
  const plugin = {serialize: serialize, test: test};
135250
135271
  var _default = plugin;
135251
135272
  ReactTestComponent.default = _default;
135252
- var _ansiStyles = _interopRequireDefault(ansiStylesExports$1);
135273
+ var _ansiStyles = _interopRequireDefault(ansiStylesExports);
135253
135274
  var _collections = collections;
135254
135275
  var _AsymmetricMatcher = _interopRequireDefault(AsymmetricMatcher);
135255
135276
  var _ConvertAnsi = _interopRequireDefault(ConvertAnsi);
@@ -136001,6 +136022,21 @@ const UNTYPED_GLOBALS = new Set([
136001
136022
  'decodeURIComponent',
136002
136023
  ]);
136003
136024
  const TYPED_GLOBALS = [
136025
+ [
136026
+ 'Object',
136027
+ addObject(DEFAULT_SHAPES, 'Object', [
136028
+ [
136029
+ 'keys',
136030
+ addFunction(DEFAULT_SHAPES, [], {
136031
+ positionalParams: [exports.Effect.Read],
136032
+ restParam: null,
136033
+ returnType: {kind: 'Object', shapeId: BuiltInArrayId},
136034
+ calleeEffect: exports.Effect.Read,
136035
+ returnValueKind: exports.ValueKind.Mutable,
136036
+ }),
136037
+ ],
136038
+ ]),
136039
+ ],
136004
136040
  [
136005
136041
  'Array',
136006
136042
  addObject(DEFAULT_SHAPES, 'Array', [
@@ -136358,6 +136394,21 @@ const REACT_APIS = [
136358
136394
  BuiltInUseOperatorId
136359
136395
  ),
136360
136396
  ],
136397
+ [
136398
+ 'fire',
136399
+ addFunction(
136400
+ DEFAULT_SHAPES,
136401
+ [],
136402
+ {
136403
+ positionalParams: [],
136404
+ restParam: null,
136405
+ returnType: {kind: 'Primitive'},
136406
+ calleeEffect: exports.Effect.Read,
136407
+ returnValueKind: exports.ValueKind.Frozen,
136408
+ },
136409
+ BuiltInFireId
136410
+ ),
136411
+ ],
136361
136412
  ];
136362
136413
  TYPED_GLOBALS.push(
136363
136414
  [
@@ -136707,7 +136758,7 @@ const EnvironmentConfigSchema = z.object({
136707
136758
  customHooks: z.map(z.string(), HookSchema).default(new Map()),
136708
136759
  moduleTypeProvider: z.nullable(z.function().args(z.string())).default(null),
136709
136760
  customMacros: z.nullable(z.array(MacroSchema)).default(null),
136710
- enableResetCacheOnSourceFileChanges: z.boolean().default(false),
136761
+ enableResetCacheOnSourceFileChanges: z.nullable(z.boolean()).default(null),
136711
136762
  enablePreserveExistingMemoizationGuarantees: z.boolean().default(false),
136712
136763
  validatePreserveExistingMemoizationGuarantees: z.boolean().default(true),
136713
136764
  enablePreserveExistingManualUseMemo: z.boolean().default(false),
@@ -136715,6 +136766,7 @@ const EnvironmentConfigSchema = z.object({
136715
136766
  enableUseTypeAnnotations: z.boolean().default(false),
136716
136767
  enableFunctionDependencyRewrite: z.boolean().default(true),
136717
136768
  enableOptionalDependencies: z.boolean().default(true),
136769
+ enableFire: z.boolean().default(false),
136718
136770
  inferEffectDependencies: z
136719
136771
  .nullable(
136720
136772
  z.array(
@@ -136835,7 +136887,10 @@ function parseConfigPragmaForTests(pragma) {
136835
136887
  }
136836
136888
  continue;
136837
136889
  }
136838
- if (typeof defaultConfig[key] !== 'boolean') {
136890
+ if (
136891
+ key !== 'enableResetCacheOnSourceFileChanges' &&
136892
+ typeof defaultConfig[key] !== 'boolean'
136893
+ ) {
136839
136894
  continue;
136840
136895
  }
136841
136896
  if (val === undefined || val === 'true') {
@@ -136846,6 +136901,9 @@ function parseConfigPragmaForTests(pragma) {
136846
136901
  }
136847
136902
  const config = EnvironmentConfigSchema.safeParse(maybeConfig);
136848
136903
  if (config.success) {
136904
+ if (config.data.enableResetCacheOnSourceFileChanges == null) {
136905
+ config.data.enableResetCacheOnSourceFileChanges = false;
136906
+ }
136849
136907
  return config.data;
136850
136908
  }
136851
136909
  CompilerError.invariant(false, {
@@ -136897,6 +136955,7 @@ class Environment {
136897
136955
  'f'
136898
136956
  );
136899
136957
  this.hasLoweredContextAccess = false;
136958
+ this.hasFireRewrite = false;
136900
136959
  if (
136901
136960
  config.disableMemoizationForDebugging &&
136902
136961
  config.enableChangeDetectionForDebugging != null
@@ -137583,1634 +137642,8 @@ class DisjointSet {
137583
137642
  }
137584
137643
  }
137585
137644
  _DisjointSet_entries = new WeakMap();
137586
- var ansiStyles$1 = {exports: {}};
137587
- var colorName;
137588
- var hasRequiredColorName;
137589
- function requireColorName() {
137590
- if (hasRequiredColorName) return colorName;
137591
- hasRequiredColorName = 1;
137592
- colorName = {
137593
- aliceblue: [240, 248, 255],
137594
- antiquewhite: [250, 235, 215],
137595
- aqua: [0, 255, 255],
137596
- aquamarine: [127, 255, 212],
137597
- azure: [240, 255, 255],
137598
- beige: [245, 245, 220],
137599
- bisque: [255, 228, 196],
137600
- black: [0, 0, 0],
137601
- blanchedalmond: [255, 235, 205],
137602
- blue: [0, 0, 255],
137603
- blueviolet: [138, 43, 226],
137604
- brown: [165, 42, 42],
137605
- burlywood: [222, 184, 135],
137606
- cadetblue: [95, 158, 160],
137607
- chartreuse: [127, 255, 0],
137608
- chocolate: [210, 105, 30],
137609
- coral: [255, 127, 80],
137610
- cornflowerblue: [100, 149, 237],
137611
- cornsilk: [255, 248, 220],
137612
- crimson: [220, 20, 60],
137613
- cyan: [0, 255, 255],
137614
- darkblue: [0, 0, 139],
137615
- darkcyan: [0, 139, 139],
137616
- darkgoldenrod: [184, 134, 11],
137617
- darkgray: [169, 169, 169],
137618
- darkgreen: [0, 100, 0],
137619
- darkgrey: [169, 169, 169],
137620
- darkkhaki: [189, 183, 107],
137621
- darkmagenta: [139, 0, 139],
137622
- darkolivegreen: [85, 107, 47],
137623
- darkorange: [255, 140, 0],
137624
- darkorchid: [153, 50, 204],
137625
- darkred: [139, 0, 0],
137626
- darksalmon: [233, 150, 122],
137627
- darkseagreen: [143, 188, 143],
137628
- darkslateblue: [72, 61, 139],
137629
- darkslategray: [47, 79, 79],
137630
- darkslategrey: [47, 79, 79],
137631
- darkturquoise: [0, 206, 209],
137632
- darkviolet: [148, 0, 211],
137633
- deeppink: [255, 20, 147],
137634
- deepskyblue: [0, 191, 255],
137635
- dimgray: [105, 105, 105],
137636
- dimgrey: [105, 105, 105],
137637
- dodgerblue: [30, 144, 255],
137638
- firebrick: [178, 34, 34],
137639
- floralwhite: [255, 250, 240],
137640
- forestgreen: [34, 139, 34],
137641
- fuchsia: [255, 0, 255],
137642
- gainsboro: [220, 220, 220],
137643
- ghostwhite: [248, 248, 255],
137644
- gold: [255, 215, 0],
137645
- goldenrod: [218, 165, 32],
137646
- gray: [128, 128, 128],
137647
- green: [0, 128, 0],
137648
- greenyellow: [173, 255, 47],
137649
- grey: [128, 128, 128],
137650
- honeydew: [240, 255, 240],
137651
- hotpink: [255, 105, 180],
137652
- indianred: [205, 92, 92],
137653
- indigo: [75, 0, 130],
137654
- ivory: [255, 255, 240],
137655
- khaki: [240, 230, 140],
137656
- lavender: [230, 230, 250],
137657
- lavenderblush: [255, 240, 245],
137658
- lawngreen: [124, 252, 0],
137659
- lemonchiffon: [255, 250, 205],
137660
- lightblue: [173, 216, 230],
137661
- lightcoral: [240, 128, 128],
137662
- lightcyan: [224, 255, 255],
137663
- lightgoldenrodyellow: [250, 250, 210],
137664
- lightgray: [211, 211, 211],
137665
- lightgreen: [144, 238, 144],
137666
- lightgrey: [211, 211, 211],
137667
- lightpink: [255, 182, 193],
137668
- lightsalmon: [255, 160, 122],
137669
- lightseagreen: [32, 178, 170],
137670
- lightskyblue: [135, 206, 250],
137671
- lightslategray: [119, 136, 153],
137672
- lightslategrey: [119, 136, 153],
137673
- lightsteelblue: [176, 196, 222],
137674
- lightyellow: [255, 255, 224],
137675
- lime: [0, 255, 0],
137676
- limegreen: [50, 205, 50],
137677
- linen: [250, 240, 230],
137678
- magenta: [255, 0, 255],
137679
- maroon: [128, 0, 0],
137680
- mediumaquamarine: [102, 205, 170],
137681
- mediumblue: [0, 0, 205],
137682
- mediumorchid: [186, 85, 211],
137683
- mediumpurple: [147, 112, 219],
137684
- mediumseagreen: [60, 179, 113],
137685
- mediumslateblue: [123, 104, 238],
137686
- mediumspringgreen: [0, 250, 154],
137687
- mediumturquoise: [72, 209, 204],
137688
- mediumvioletred: [199, 21, 133],
137689
- midnightblue: [25, 25, 112],
137690
- mintcream: [245, 255, 250],
137691
- mistyrose: [255, 228, 225],
137692
- moccasin: [255, 228, 181],
137693
- navajowhite: [255, 222, 173],
137694
- navy: [0, 0, 128],
137695
- oldlace: [253, 245, 230],
137696
- olive: [128, 128, 0],
137697
- olivedrab: [107, 142, 35],
137698
- orange: [255, 165, 0],
137699
- orangered: [255, 69, 0],
137700
- orchid: [218, 112, 214],
137701
- palegoldenrod: [238, 232, 170],
137702
- palegreen: [152, 251, 152],
137703
- paleturquoise: [175, 238, 238],
137704
- palevioletred: [219, 112, 147],
137705
- papayawhip: [255, 239, 213],
137706
- peachpuff: [255, 218, 185],
137707
- peru: [205, 133, 63],
137708
- pink: [255, 192, 203],
137709
- plum: [221, 160, 221],
137710
- powderblue: [176, 224, 230],
137711
- purple: [128, 0, 128],
137712
- rebeccapurple: [102, 51, 153],
137713
- red: [255, 0, 0],
137714
- rosybrown: [188, 143, 143],
137715
- royalblue: [65, 105, 225],
137716
- saddlebrown: [139, 69, 19],
137717
- salmon: [250, 128, 114],
137718
- sandybrown: [244, 164, 96],
137719
- seagreen: [46, 139, 87],
137720
- seashell: [255, 245, 238],
137721
- sienna: [160, 82, 45],
137722
- silver: [192, 192, 192],
137723
- skyblue: [135, 206, 235],
137724
- slateblue: [106, 90, 205],
137725
- slategray: [112, 128, 144],
137726
- slategrey: [112, 128, 144],
137727
- snow: [255, 250, 250],
137728
- springgreen: [0, 255, 127],
137729
- steelblue: [70, 130, 180],
137730
- tan: [210, 180, 140],
137731
- teal: [0, 128, 128],
137732
- thistle: [216, 191, 216],
137733
- tomato: [255, 99, 71],
137734
- turquoise: [64, 224, 208],
137735
- violet: [238, 130, 238],
137736
- wheat: [245, 222, 179],
137737
- white: [255, 255, 255],
137738
- whitesmoke: [245, 245, 245],
137739
- yellow: [255, 255, 0],
137740
- yellowgreen: [154, 205, 50],
137741
- };
137742
- return colorName;
137743
- }
137744
- var conversions;
137745
- var hasRequiredConversions;
137746
- function requireConversions() {
137747
- if (hasRequiredConversions) return conversions;
137748
- hasRequiredConversions = 1;
137749
- const cssKeywords = requireColorName();
137750
- const reverseKeywords = {};
137751
- for (const key of Object.keys(cssKeywords)) {
137752
- reverseKeywords[cssKeywords[key]] = key;
137753
- }
137754
- const convert = {
137755
- rgb: {channels: 3, labels: 'rgb'},
137756
- hsl: {channels: 3, labels: 'hsl'},
137757
- hsv: {channels: 3, labels: 'hsv'},
137758
- hwb: {channels: 3, labels: 'hwb'},
137759
- cmyk: {channels: 4, labels: 'cmyk'},
137760
- xyz: {channels: 3, labels: 'xyz'},
137761
- lab: {channels: 3, labels: 'lab'},
137762
- lch: {channels: 3, labels: 'lch'},
137763
- hex: {channels: 1, labels: ['hex']},
137764
- keyword: {channels: 1, labels: ['keyword']},
137765
- ansi16: {channels: 1, labels: ['ansi16']},
137766
- ansi256: {channels: 1, labels: ['ansi256']},
137767
- hcg: {channels: 3, labels: ['h', 'c', 'g']},
137768
- apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
137769
- gray: {channels: 1, labels: ['gray']},
137770
- };
137771
- conversions = convert;
137772
- for (const model of Object.keys(convert)) {
137773
- if (!('channels' in convert[model])) {
137774
- throw new Error('missing channels property: ' + model);
137775
- }
137776
- if (!('labels' in convert[model])) {
137777
- throw new Error('missing channel labels property: ' + model);
137778
- }
137779
- if (convert[model].labels.length !== convert[model].channels) {
137780
- throw new Error('channel and label counts mismatch: ' + model);
137781
- }
137782
- const {channels: channels, labels: labels} = convert[model];
137783
- delete convert[model].channels;
137784
- delete convert[model].labels;
137785
- Object.defineProperty(convert[model], 'channels', {value: channels});
137786
- Object.defineProperty(convert[model], 'labels', {value: labels});
137787
- }
137788
- convert.rgb.hsl = function (rgb) {
137789
- const r = rgb[0] / 255;
137790
- const g = rgb[1] / 255;
137791
- const b = rgb[2] / 255;
137792
- const min = Math.min(r, g, b);
137793
- const max = Math.max(r, g, b);
137794
- const delta = max - min;
137795
- let h;
137796
- let s;
137797
- if (max === min) {
137798
- h = 0;
137799
- } else if (r === max) {
137800
- h = (g - b) / delta;
137801
- } else if (g === max) {
137802
- h = 2 + (b - r) / delta;
137803
- } else if (b === max) {
137804
- h = 4 + (r - g) / delta;
137805
- }
137806
- h = Math.min(h * 60, 360);
137807
- if (h < 0) {
137808
- h += 360;
137809
- }
137810
- const l = (min + max) / 2;
137811
- if (max === min) {
137812
- s = 0;
137813
- } else if (l <= 0.5) {
137814
- s = delta / (max + min);
137815
- } else {
137816
- s = delta / (2 - max - min);
137817
- }
137818
- return [h, s * 100, l * 100];
137819
- };
137820
- convert.rgb.hsv = function (rgb) {
137821
- let rdif;
137822
- let gdif;
137823
- let bdif;
137824
- let h;
137825
- let s;
137826
- const r = rgb[0] / 255;
137827
- const g = rgb[1] / 255;
137828
- const b = rgb[2] / 255;
137829
- const v = Math.max(r, g, b);
137830
- const diff = v - Math.min(r, g, b);
137831
- const diffc = function (c) {
137832
- return (v - c) / 6 / diff + 1 / 2;
137833
- };
137834
- if (diff === 0) {
137835
- h = 0;
137836
- s = 0;
137837
- } else {
137838
- s = diff / v;
137839
- rdif = diffc(r);
137840
- gdif = diffc(g);
137841
- bdif = diffc(b);
137842
- if (r === v) {
137843
- h = bdif - gdif;
137844
- } else if (g === v) {
137845
- h = 1 / 3 + rdif - bdif;
137846
- } else if (b === v) {
137847
- h = 2 / 3 + gdif - rdif;
137848
- }
137849
- if (h < 0) {
137850
- h += 1;
137851
- } else if (h > 1) {
137852
- h -= 1;
137853
- }
137854
- }
137855
- return [h * 360, s * 100, v * 100];
137856
- };
137857
- convert.rgb.hwb = function (rgb) {
137858
- const r = rgb[0];
137859
- const g = rgb[1];
137860
- let b = rgb[2];
137861
- const h = convert.rgb.hsl(rgb)[0];
137862
- const w = (1 / 255) * Math.min(r, Math.min(g, b));
137863
- b = 1 - (1 / 255) * Math.max(r, Math.max(g, b));
137864
- return [h, w * 100, b * 100];
137865
- };
137866
- convert.rgb.cmyk = function (rgb) {
137867
- const r = rgb[0] / 255;
137868
- const g = rgb[1] / 255;
137869
- const b = rgb[2] / 255;
137870
- const k = Math.min(1 - r, 1 - g, 1 - b);
137871
- const c = (1 - r - k) / (1 - k) || 0;
137872
- const m = (1 - g - k) / (1 - k) || 0;
137873
- const y = (1 - b - k) / (1 - k) || 0;
137874
- return [c * 100, m * 100, y * 100, k * 100];
137875
- };
137876
- function comparativeDistance(x, y) {
137877
- return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
137878
- }
137879
- convert.rgb.keyword = function (rgb) {
137880
- const reversed = reverseKeywords[rgb];
137881
- if (reversed) {
137882
- return reversed;
137883
- }
137884
- let currentClosestDistance = Infinity;
137885
- let currentClosestKeyword;
137886
- for (const keyword of Object.keys(cssKeywords)) {
137887
- const value = cssKeywords[keyword];
137888
- const distance = comparativeDistance(rgb, value);
137889
- if (distance < currentClosestDistance) {
137890
- currentClosestDistance = distance;
137891
- currentClosestKeyword = keyword;
137892
- }
137893
- }
137894
- return currentClosestKeyword;
137895
- };
137896
- convert.keyword.rgb = function (keyword) {
137897
- return cssKeywords[keyword];
137898
- };
137899
- convert.rgb.xyz = function (rgb) {
137900
- let r = rgb[0] / 255;
137901
- let g = rgb[1] / 255;
137902
- let b = rgb[2] / 255;
137903
- r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
137904
- g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
137905
- b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
137906
- const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
137907
- const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
137908
- const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
137909
- return [x * 100, y * 100, z * 100];
137910
- };
137911
- convert.rgb.lab = function (rgb) {
137912
- const xyz = convert.rgb.xyz(rgb);
137913
- let x = xyz[0];
137914
- let y = xyz[1];
137915
- let z = xyz[2];
137916
- x /= 95.047;
137917
- y /= 100;
137918
- z /= 108.883;
137919
- x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
137920
- y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
137921
- z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
137922
- const l = 116 * y - 16;
137923
- const a = 500 * (x - y);
137924
- const b = 200 * (y - z);
137925
- return [l, a, b];
137926
- };
137927
- convert.hsl.rgb = function (hsl) {
137928
- const h = hsl[0] / 360;
137929
- const s = hsl[1] / 100;
137930
- const l = hsl[2] / 100;
137931
- let t2;
137932
- let t3;
137933
- let val;
137934
- if (s === 0) {
137935
- val = l * 255;
137936
- return [val, val, val];
137937
- }
137938
- if (l < 0.5) {
137939
- t2 = l * (1 + s);
137940
- } else {
137941
- t2 = l + s - l * s;
137942
- }
137943
- const t1 = 2 * l - t2;
137944
- const rgb = [0, 0, 0];
137945
- for (let i = 0; i < 3; i++) {
137946
- t3 = h + (1 / 3) * -(i - 1);
137947
- if (t3 < 0) {
137948
- t3++;
137949
- }
137950
- if (t3 > 1) {
137951
- t3--;
137952
- }
137953
- if (6 * t3 < 1) {
137954
- val = t1 + (t2 - t1) * 6 * t3;
137955
- } else if (2 * t3 < 1) {
137956
- val = t2;
137957
- } else if (3 * t3 < 2) {
137958
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
137959
- } else {
137960
- val = t1;
137961
- }
137962
- rgb[i] = val * 255;
137963
- }
137964
- return rgb;
137965
- };
137966
- convert.hsl.hsv = function (hsl) {
137967
- const h = hsl[0];
137968
- let s = hsl[1] / 100;
137969
- let l = hsl[2] / 100;
137970
- let smin = s;
137971
- const lmin = Math.max(l, 0.01);
137972
- l *= 2;
137973
- s *= l <= 1 ? l : 2 - l;
137974
- smin *= lmin <= 1 ? lmin : 2 - lmin;
137975
- const v = (l + s) / 2;
137976
- const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
137977
- return [h, sv * 100, v * 100];
137978
- };
137979
- convert.hsv.rgb = function (hsv) {
137980
- const h = hsv[0] / 60;
137981
- const s = hsv[1] / 100;
137982
- let v = hsv[2] / 100;
137983
- const hi = Math.floor(h) % 6;
137984
- const f = h - Math.floor(h);
137985
- const p = 255 * v * (1 - s);
137986
- const q = 255 * v * (1 - s * f);
137987
- const t = 255 * v * (1 - s * (1 - f));
137988
- v *= 255;
137989
- switch (hi) {
137990
- case 0:
137991
- return [v, t, p];
137992
- case 1:
137993
- return [q, v, p];
137994
- case 2:
137995
- return [p, v, t];
137996
- case 3:
137997
- return [p, q, v];
137998
- case 4:
137999
- return [t, p, v];
138000
- case 5:
138001
- return [v, p, q];
138002
- }
138003
- };
138004
- convert.hsv.hsl = function (hsv) {
138005
- const h = hsv[0];
138006
- const s = hsv[1] / 100;
138007
- const v = hsv[2] / 100;
138008
- const vmin = Math.max(v, 0.01);
138009
- let sl;
138010
- let l;
138011
- l = (2 - s) * v;
138012
- const lmin = (2 - s) * vmin;
138013
- sl = s * vmin;
138014
- sl /= lmin <= 1 ? lmin : 2 - lmin;
138015
- sl = sl || 0;
138016
- l /= 2;
138017
- return [h, sl * 100, l * 100];
138018
- };
138019
- convert.hwb.rgb = function (hwb) {
138020
- const h = hwb[0] / 360;
138021
- let wh = hwb[1] / 100;
138022
- let bl = hwb[2] / 100;
138023
- const ratio = wh + bl;
138024
- let f;
138025
- if (ratio > 1) {
138026
- wh /= ratio;
138027
- bl /= ratio;
138028
- }
138029
- const i = Math.floor(6 * h);
138030
- const v = 1 - bl;
138031
- f = 6 * h - i;
138032
- if ((i & 1) !== 0) {
138033
- f = 1 - f;
138034
- }
138035
- const n = wh + f * (v - wh);
138036
- let r;
138037
- let g;
138038
- let b;
138039
- switch (i) {
138040
- default:
138041
- case 6:
138042
- case 0:
138043
- r = v;
138044
- g = n;
138045
- b = wh;
138046
- break;
138047
- case 1:
138048
- r = n;
138049
- g = v;
138050
- b = wh;
138051
- break;
138052
- case 2:
138053
- r = wh;
138054
- g = v;
138055
- b = n;
138056
- break;
138057
- case 3:
138058
- r = wh;
138059
- g = n;
138060
- b = v;
138061
- break;
138062
- case 4:
138063
- r = n;
138064
- g = wh;
138065
- b = v;
138066
- break;
138067
- case 5:
138068
- r = v;
138069
- g = wh;
138070
- b = n;
138071
- break;
138072
- }
138073
- return [r * 255, g * 255, b * 255];
138074
- };
138075
- convert.cmyk.rgb = function (cmyk) {
138076
- const c = cmyk[0] / 100;
138077
- const m = cmyk[1] / 100;
138078
- const y = cmyk[2] / 100;
138079
- const k = cmyk[3] / 100;
138080
- const r = 1 - Math.min(1, c * (1 - k) + k);
138081
- const g = 1 - Math.min(1, m * (1 - k) + k);
138082
- const b = 1 - Math.min(1, y * (1 - k) + k);
138083
- return [r * 255, g * 255, b * 255];
138084
- };
138085
- convert.xyz.rgb = function (xyz) {
138086
- const x = xyz[0] / 100;
138087
- const y = xyz[1] / 100;
138088
- const z = xyz[2] / 100;
138089
- let r;
138090
- let g;
138091
- let b;
138092
- r = x * 3.2406 + y * -1.5372 + z * -0.4986;
138093
- g = x * -0.9689 + y * 1.8758 + z * 0.0415;
138094
- b = x * 0.0557 + y * -0.204 + z * 1.057;
138095
- r = r > 0.0031308 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
138096
- g = g > 0.0031308 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
138097
- b = b > 0.0031308 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
138098
- r = Math.min(Math.max(0, r), 1);
138099
- g = Math.min(Math.max(0, g), 1);
138100
- b = Math.min(Math.max(0, b), 1);
138101
- return [r * 255, g * 255, b * 255];
138102
- };
138103
- convert.xyz.lab = function (xyz) {
138104
- let x = xyz[0];
138105
- let y = xyz[1];
138106
- let z = xyz[2];
138107
- x /= 95.047;
138108
- y /= 100;
138109
- z /= 108.883;
138110
- x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
138111
- y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
138112
- z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
138113
- const l = 116 * y - 16;
138114
- const a = 500 * (x - y);
138115
- const b = 200 * (y - z);
138116
- return [l, a, b];
138117
- };
138118
- convert.lab.xyz = function (lab) {
138119
- const l = lab[0];
138120
- const a = lab[1];
138121
- const b = lab[2];
138122
- let x;
138123
- let y;
138124
- let z;
138125
- y = (l + 16) / 116;
138126
- x = a / 500 + y;
138127
- z = y - b / 200;
138128
- const y2 = y ** 3;
138129
- const x2 = x ** 3;
138130
- const z2 = z ** 3;
138131
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
138132
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
138133
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
138134
- x *= 95.047;
138135
- y *= 100;
138136
- z *= 108.883;
138137
- return [x, y, z];
138138
- };
138139
- convert.lab.lch = function (lab) {
138140
- const l = lab[0];
138141
- const a = lab[1];
138142
- const b = lab[2];
138143
- let h;
138144
- const hr = Math.atan2(b, a);
138145
- h = (hr * 360) / 2 / Math.PI;
138146
- if (h < 0) {
138147
- h += 360;
138148
- }
138149
- const c = Math.sqrt(a * a + b * b);
138150
- return [l, c, h];
138151
- };
138152
- convert.lch.lab = function (lch) {
138153
- const l = lch[0];
138154
- const c = lch[1];
138155
- const h = lch[2];
138156
- const hr = (h / 360) * 2 * Math.PI;
138157
- const a = c * Math.cos(hr);
138158
- const b = c * Math.sin(hr);
138159
- return [l, a, b];
138160
- };
138161
- convert.rgb.ansi16 = function (args, saturation = null) {
138162
- const [r, g, b] = args;
138163
- let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
138164
- value = Math.round(value / 50);
138165
- if (value === 0) {
138166
- return 30;
138167
- }
138168
- let ansi =
138169
- 30 +
138170
- ((Math.round(b / 255) << 2) |
138171
- (Math.round(g / 255) << 1) |
138172
- Math.round(r / 255));
138173
- if (value === 2) {
138174
- ansi += 60;
138175
- }
138176
- return ansi;
138177
- };
138178
- convert.hsv.ansi16 = function (args) {
138179
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
138180
- };
138181
- convert.rgb.ansi256 = function (args) {
138182
- const r = args[0];
138183
- const g = args[1];
138184
- const b = args[2];
138185
- if (r === g && g === b) {
138186
- if (r < 8) {
138187
- return 16;
138188
- }
138189
- if (r > 248) {
138190
- return 231;
138191
- }
138192
- return Math.round(((r - 8) / 247) * 24) + 232;
138193
- }
138194
- const ansi =
138195
- 16 +
138196
- 36 * Math.round((r / 255) * 5) +
138197
- 6 * Math.round((g / 255) * 5) +
138198
- Math.round((b / 255) * 5);
138199
- return ansi;
138200
- };
138201
- convert.ansi16.rgb = function (args) {
138202
- let color = args % 10;
138203
- if (color === 0 || color === 7) {
138204
- if (args > 50) {
138205
- color += 3.5;
138206
- }
138207
- color = (color / 10.5) * 255;
138208
- return [color, color, color];
138209
- }
138210
- const mult = (~~(args > 50) + 1) * 0.5;
138211
- const r = (color & 1) * mult * 255;
138212
- const g = ((color >> 1) & 1) * mult * 255;
138213
- const b = ((color >> 2) & 1) * mult * 255;
138214
- return [r, g, b];
138215
- };
138216
- convert.ansi256.rgb = function (args) {
138217
- if (args >= 232) {
138218
- const c = (args - 232) * 10 + 8;
138219
- return [c, c, c];
138220
- }
138221
- args -= 16;
138222
- let rem;
138223
- const r = (Math.floor(args / 36) / 5) * 255;
138224
- const g = (Math.floor((rem = args % 36) / 6) / 5) * 255;
138225
- const b = ((rem % 6) / 5) * 255;
138226
- return [r, g, b];
138227
- };
138228
- convert.rgb.hex = function (args) {
138229
- const integer =
138230
- ((Math.round(args[0]) & 255) << 16) +
138231
- ((Math.round(args[1]) & 255) << 8) +
138232
- (Math.round(args[2]) & 255);
138233
- const string = integer.toString(16).toUpperCase();
138234
- return '000000'.substring(string.length) + string;
138235
- };
138236
- convert.hex.rgb = function (args) {
138237
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
138238
- if (!match) {
138239
- return [0, 0, 0];
138240
- }
138241
- let colorString = match[0];
138242
- if (match[0].length === 3) {
138243
- colorString = colorString
138244
- .split('')
138245
- .map(char => char + char)
138246
- .join('');
138247
- }
138248
- const integer = parseInt(colorString, 16);
138249
- const r = (integer >> 16) & 255;
138250
- const g = (integer >> 8) & 255;
138251
- const b = integer & 255;
138252
- return [r, g, b];
138253
- };
138254
- convert.rgb.hcg = function (rgb) {
138255
- const r = rgb[0] / 255;
138256
- const g = rgb[1] / 255;
138257
- const b = rgb[2] / 255;
138258
- const max = Math.max(Math.max(r, g), b);
138259
- const min = Math.min(Math.min(r, g), b);
138260
- const chroma = max - min;
138261
- let grayscale;
138262
- let hue;
138263
- if (chroma < 1) {
138264
- grayscale = min / (1 - chroma);
138265
- } else {
138266
- grayscale = 0;
138267
- }
138268
- if (chroma <= 0) {
138269
- hue = 0;
138270
- } else if (max === r) {
138271
- hue = ((g - b) / chroma) % 6;
138272
- } else if (max === g) {
138273
- hue = 2 + (b - r) / chroma;
138274
- } else {
138275
- hue = 4 + (r - g) / chroma;
138276
- }
138277
- hue /= 6;
138278
- hue %= 1;
138279
- return [hue * 360, chroma * 100, grayscale * 100];
138280
- };
138281
- convert.hsl.hcg = function (hsl) {
138282
- const s = hsl[1] / 100;
138283
- const l = hsl[2] / 100;
138284
- const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
138285
- let f = 0;
138286
- if (c < 1) {
138287
- f = (l - 0.5 * c) / (1 - c);
138288
- }
138289
- return [hsl[0], c * 100, f * 100];
138290
- };
138291
- convert.hsv.hcg = function (hsv) {
138292
- const s = hsv[1] / 100;
138293
- const v = hsv[2] / 100;
138294
- const c = s * v;
138295
- let f = 0;
138296
- if (c < 1) {
138297
- f = (v - c) / (1 - c);
138298
- }
138299
- return [hsv[0], c * 100, f * 100];
138300
- };
138301
- convert.hcg.rgb = function (hcg) {
138302
- const h = hcg[0] / 360;
138303
- const c = hcg[1] / 100;
138304
- const g = hcg[2] / 100;
138305
- if (c === 0) {
138306
- return [g * 255, g * 255, g * 255];
138307
- }
138308
- const pure = [0, 0, 0];
138309
- const hi = (h % 1) * 6;
138310
- const v = hi % 1;
138311
- const w = 1 - v;
138312
- let mg = 0;
138313
- switch (Math.floor(hi)) {
138314
- case 0:
138315
- pure[0] = 1;
138316
- pure[1] = v;
138317
- pure[2] = 0;
138318
- break;
138319
- case 1:
138320
- pure[0] = w;
138321
- pure[1] = 1;
138322
- pure[2] = 0;
138323
- break;
138324
- case 2:
138325
- pure[0] = 0;
138326
- pure[1] = 1;
138327
- pure[2] = v;
138328
- break;
138329
- case 3:
138330
- pure[0] = 0;
138331
- pure[1] = w;
138332
- pure[2] = 1;
138333
- break;
138334
- case 4:
138335
- pure[0] = v;
138336
- pure[1] = 0;
138337
- pure[2] = 1;
138338
- break;
138339
- default:
138340
- pure[0] = 1;
138341
- pure[1] = 0;
138342
- pure[2] = w;
138343
- }
138344
- mg = (1 - c) * g;
138345
- return [
138346
- (c * pure[0] + mg) * 255,
138347
- (c * pure[1] + mg) * 255,
138348
- (c * pure[2] + mg) * 255,
138349
- ];
138350
- };
138351
- convert.hcg.hsv = function (hcg) {
138352
- const c = hcg[1] / 100;
138353
- const g = hcg[2] / 100;
138354
- const v = c + g * (1 - c);
138355
- let f = 0;
138356
- if (v > 0) {
138357
- f = c / v;
138358
- }
138359
- return [hcg[0], f * 100, v * 100];
138360
- };
138361
- convert.hcg.hsl = function (hcg) {
138362
- const c = hcg[1] / 100;
138363
- const g = hcg[2] / 100;
138364
- const l = g * (1 - c) + 0.5 * c;
138365
- let s = 0;
138366
- if (l > 0 && l < 0.5) {
138367
- s = c / (2 * l);
138368
- } else if (l >= 0.5 && l < 1) {
138369
- s = c / (2 * (1 - l));
138370
- }
138371
- return [hcg[0], s * 100, l * 100];
138372
- };
138373
- convert.hcg.hwb = function (hcg) {
138374
- const c = hcg[1] / 100;
138375
- const g = hcg[2] / 100;
138376
- const v = c + g * (1 - c);
138377
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
138378
- };
138379
- convert.hwb.hcg = function (hwb) {
138380
- const w = hwb[1] / 100;
138381
- const b = hwb[2] / 100;
138382
- const v = 1 - b;
138383
- const c = v - w;
138384
- let g = 0;
138385
- if (c < 1) {
138386
- g = (v - c) / (1 - c);
138387
- }
138388
- return [hwb[0], c * 100, g * 100];
138389
- };
138390
- convert.apple.rgb = function (apple) {
138391
- return [
138392
- (apple[0] / 65535) * 255,
138393
- (apple[1] / 65535) * 255,
138394
- (apple[2] / 65535) * 255,
138395
- ];
138396
- };
138397
- convert.rgb.apple = function (rgb) {
138398
- return [
138399
- (rgb[0] / 255) * 65535,
138400
- (rgb[1] / 255) * 65535,
138401
- (rgb[2] / 255) * 65535,
138402
- ];
138403
- };
138404
- convert.gray.rgb = function (args) {
138405
- return [
138406
- (args[0] / 100) * 255,
138407
- (args[0] / 100) * 255,
138408
- (args[0] / 100) * 255,
138409
- ];
138410
- };
138411
- convert.gray.hsl = function (args) {
138412
- return [0, 0, args[0]];
138413
- };
138414
- convert.gray.hsv = convert.gray.hsl;
138415
- convert.gray.hwb = function (gray) {
138416
- return [0, 100, gray[0]];
138417
- };
138418
- convert.gray.cmyk = function (gray) {
138419
- return [0, 0, 0, gray[0]];
138420
- };
138421
- convert.gray.lab = function (gray) {
138422
- return [gray[0], 0, 0];
138423
- };
138424
- convert.gray.hex = function (gray) {
138425
- const val = Math.round((gray[0] / 100) * 255) & 255;
138426
- const integer = (val << 16) + (val << 8) + val;
138427
- const string = integer.toString(16).toUpperCase();
138428
- return '000000'.substring(string.length) + string;
138429
- };
138430
- convert.rgb.gray = function (rgb) {
138431
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
138432
- return [(val / 255) * 100];
138433
- };
138434
- return conversions;
138435
- }
138436
- var route;
138437
- var hasRequiredRoute;
138438
- function requireRoute() {
138439
- if (hasRequiredRoute) return route;
138440
- hasRequiredRoute = 1;
138441
- const conversions = requireConversions();
138442
- function buildGraph() {
138443
- const graph = {};
138444
- const models = Object.keys(conversions);
138445
- for (let len = models.length, i = 0; i < len; i++) {
138446
- graph[models[i]] = {distance: -1, parent: null};
138447
- }
138448
- return graph;
138449
- }
138450
- function deriveBFS(fromModel) {
138451
- const graph = buildGraph();
138452
- const queue = [fromModel];
138453
- graph[fromModel].distance = 0;
138454
- while (queue.length) {
138455
- const current = queue.pop();
138456
- const adjacents = Object.keys(conversions[current]);
138457
- for (let len = adjacents.length, i = 0; i < len; i++) {
138458
- const adjacent = adjacents[i];
138459
- const node = graph[adjacent];
138460
- if (node.distance === -1) {
138461
- node.distance = graph[current].distance + 1;
138462
- node.parent = current;
138463
- queue.unshift(adjacent);
138464
- }
138465
- }
138466
- }
138467
- return graph;
138468
- }
138469
- function link(from, to) {
138470
- return function (args) {
138471
- return to(from(args));
138472
- };
138473
- }
138474
- function wrapConversion(toModel, graph) {
138475
- const path = [graph[toModel].parent, toModel];
138476
- let fn = conversions[graph[toModel].parent][toModel];
138477
- let cur = graph[toModel].parent;
138478
- while (graph[cur].parent) {
138479
- path.unshift(graph[cur].parent);
138480
- fn = link(conversions[graph[cur].parent][cur], fn);
138481
- cur = graph[cur].parent;
138482
- }
138483
- fn.conversion = path;
138484
- return fn;
138485
- }
138486
- route = function (fromModel) {
138487
- const graph = deriveBFS(fromModel);
138488
- const conversion = {};
138489
- const models = Object.keys(graph);
138490
- for (let len = models.length, i = 0; i < len; i++) {
138491
- const toModel = models[i];
138492
- const node = graph[toModel];
138493
- if (node.parent === null) {
138494
- continue;
138495
- }
138496
- conversion[toModel] = wrapConversion(toModel, graph);
138497
- }
138498
- return conversion;
138499
- };
138500
- return route;
138501
- }
138502
- var colorConvert;
138503
- var hasRequiredColorConvert;
138504
- function requireColorConvert() {
138505
- if (hasRequiredColorConvert) return colorConvert;
138506
- hasRequiredColorConvert = 1;
138507
- const conversions = requireConversions();
138508
- const route = requireRoute();
138509
- const convert = {};
138510
- const models = Object.keys(conversions);
138511
- function wrapRaw(fn) {
138512
- const wrappedFn = function (...args) {
138513
- const arg0 = args[0];
138514
- if (arg0 === undefined || arg0 === null) {
138515
- return arg0;
138516
- }
138517
- if (arg0.length > 1) {
138518
- args = arg0;
138519
- }
138520
- return fn(args);
138521
- };
138522
- if ('conversion' in fn) {
138523
- wrappedFn.conversion = fn.conversion;
138524
- }
138525
- return wrappedFn;
138526
- }
138527
- function wrapRounded(fn) {
138528
- const wrappedFn = function (...args) {
138529
- const arg0 = args[0];
138530
- if (arg0 === undefined || arg0 === null) {
138531
- return arg0;
138532
- }
138533
- if (arg0.length > 1) {
138534
- args = arg0;
138535
- }
138536
- const result = fn(args);
138537
- if (typeof result === 'object') {
138538
- for (let len = result.length, i = 0; i < len; i++) {
138539
- result[i] = Math.round(result[i]);
138540
- }
138541
- }
138542
- return result;
138543
- };
138544
- if ('conversion' in fn) {
138545
- wrappedFn.conversion = fn.conversion;
138546
- }
138547
- return wrappedFn;
138548
- }
138549
- models.forEach(fromModel => {
138550
- convert[fromModel] = {};
138551
- Object.defineProperty(convert[fromModel], 'channels', {
138552
- value: conversions[fromModel].channels,
138553
- });
138554
- Object.defineProperty(convert[fromModel], 'labels', {
138555
- value: conversions[fromModel].labels,
138556
- });
138557
- const routes = route(fromModel);
138558
- const routeModels = Object.keys(routes);
138559
- routeModels.forEach(toModel => {
138560
- const fn = routes[toModel];
138561
- convert[fromModel][toModel] = wrapRounded(fn);
138562
- convert[fromModel][toModel].raw = wrapRaw(fn);
138563
- });
138564
- });
138565
- colorConvert = convert;
138566
- return colorConvert;
138567
- }
138568
- ansiStyles$1.exports;
138569
- (function (module) {
138570
- const wrapAnsi16 =
138571
- (fn, offset) =>
138572
- (...args) => {
138573
- const code = fn(...args);
138574
- return `[${code + offset}m`;
138575
- };
138576
- const wrapAnsi256 =
138577
- (fn, offset) =>
138578
- (...args) => {
138579
- const code = fn(...args);
138580
- return `[${38 + offset};5;${code}m`;
138581
- };
138582
- const wrapAnsi16m =
138583
- (fn, offset) =>
138584
- (...args) => {
138585
- const rgb = fn(...args);
138586
- return `[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
138587
- };
138588
- const ansi2ansi = n => n;
138589
- const rgb2rgb = (r, g, b) => [r, g, b];
138590
- const setLazyProperty = (object, property, get) => {
138591
- Object.defineProperty(object, property, {
138592
- get: () => {
138593
- const value = get();
138594
- Object.defineProperty(object, property, {
138595
- value: value,
138596
- enumerable: true,
138597
- configurable: true,
138598
- });
138599
- return value;
138600
- },
138601
- enumerable: true,
138602
- configurable: true,
138603
- });
138604
- };
138605
- let colorConvert;
138606
- const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
138607
- if (colorConvert === undefined) {
138608
- colorConvert = requireColorConvert();
138609
- }
138610
- const offset = isBackground ? 10 : 0;
138611
- const styles = {};
138612
- for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
138613
- const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
138614
- if (sourceSpace === targetSpace) {
138615
- styles[name] = wrap(identity, offset);
138616
- } else if (typeof suite === 'object') {
138617
- styles[name] = wrap(suite[targetSpace], offset);
138618
- }
138619
- }
138620
- return styles;
138621
- };
138622
- function assembleStyles() {
138623
- const codes = new Map();
138624
- const styles = {
138625
- modifier: {
138626
- reset: [0, 0],
138627
- bold: [1, 22],
138628
- dim: [2, 22],
138629
- italic: [3, 23],
138630
- underline: [4, 24],
138631
- inverse: [7, 27],
138632
- hidden: [8, 28],
138633
- strikethrough: [9, 29],
138634
- },
138635
- color: {
138636
- black: [30, 39],
138637
- red: [31, 39],
138638
- green: [32, 39],
138639
- yellow: [33, 39],
138640
- blue: [34, 39],
138641
- magenta: [35, 39],
138642
- cyan: [36, 39],
138643
- white: [37, 39],
138644
- blackBright: [90, 39],
138645
- redBright: [91, 39],
138646
- greenBright: [92, 39],
138647
- yellowBright: [93, 39],
138648
- blueBright: [94, 39],
138649
- magentaBright: [95, 39],
138650
- cyanBright: [96, 39],
138651
- whiteBright: [97, 39],
138652
- },
138653
- bgColor: {
138654
- bgBlack: [40, 49],
138655
- bgRed: [41, 49],
138656
- bgGreen: [42, 49],
138657
- bgYellow: [43, 49],
138658
- bgBlue: [44, 49],
138659
- bgMagenta: [45, 49],
138660
- bgCyan: [46, 49],
138661
- bgWhite: [47, 49],
138662
- bgBlackBright: [100, 49],
138663
- bgRedBright: [101, 49],
138664
- bgGreenBright: [102, 49],
138665
- bgYellowBright: [103, 49],
138666
- bgBlueBright: [104, 49],
138667
- bgMagentaBright: [105, 49],
138668
- bgCyanBright: [106, 49],
138669
- bgWhiteBright: [107, 49],
138670
- },
138671
- };
138672
- styles.color.gray = styles.color.blackBright;
138673
- styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
138674
- styles.color.grey = styles.color.blackBright;
138675
- styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
138676
- for (const [groupName, group] of Object.entries(styles)) {
138677
- for (const [styleName, style] of Object.entries(group)) {
138678
- styles[styleName] = {open: `[${style[0]}m`, close: `[${style[1]}m`};
138679
- group[styleName] = styles[styleName];
138680
- codes.set(style[0], style[1]);
138681
- }
138682
- Object.defineProperty(styles, groupName, {
138683
- value: group,
138684
- enumerable: false,
138685
- });
138686
- }
138687
- Object.defineProperty(styles, 'codes', {value: codes, enumerable: false});
138688
- styles.color.close = '';
138689
- styles.bgColor.close = '';
138690
- setLazyProperty(styles.color, 'ansi', () =>
138691
- makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)
138692
- );
138693
- setLazyProperty(styles.color, 'ansi256', () =>
138694
- makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)
138695
- );
138696
- setLazyProperty(styles.color, 'ansi16m', () =>
138697
- makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)
138698
- );
138699
- setLazyProperty(styles.bgColor, 'ansi', () =>
138700
- makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)
138701
- );
138702
- setLazyProperty(styles.bgColor, 'ansi256', () =>
138703
- makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)
138704
- );
138705
- setLazyProperty(styles.bgColor, 'ansi16m', () =>
138706
- makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)
138707
- );
138708
- return styles;
138709
- }
138710
- Object.defineProperty(module, 'exports', {
138711
- enumerable: true,
138712
- get: assembleStyles,
138713
- });
138714
- })(ansiStyles$1);
138715
- var ansiStylesExports = ansiStyles$1.exports;
138716
- var hasFlag$1 = (flag, argv = process.argv) => {
138717
- const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
138718
- const position = argv.indexOf(prefix + flag);
138719
- const terminatorPosition = argv.indexOf('--');
138720
- return (
138721
- position !== -1 &&
138722
- (terminatorPosition === -1 || position < terminatorPosition)
138723
- );
138724
- };
138725
- const os = require$$0$3;
138726
- const tty = require$$0$2;
138727
- const hasFlag = hasFlag$1;
138728
- const {env: env} = process;
138729
- let forceColor;
138730
- if (
138731
- hasFlag('no-color') ||
138732
- hasFlag('no-colors') ||
138733
- hasFlag('color=false') ||
138734
- hasFlag('color=never')
138735
- ) {
138736
- forceColor = 0;
138737
- } else if (
138738
- hasFlag('color') ||
138739
- hasFlag('colors') ||
138740
- hasFlag('color=true') ||
138741
- hasFlag('color=always')
138742
- ) {
138743
- forceColor = 1;
138744
- }
138745
- if ('FORCE_COLOR' in env) {
138746
- if (env.FORCE_COLOR === 'true') {
138747
- forceColor = 1;
138748
- } else if (env.FORCE_COLOR === 'false') {
138749
- forceColor = 0;
138750
- } else {
138751
- forceColor =
138752
- env.FORCE_COLOR.length === 0
138753
- ? 1
138754
- : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
138755
- }
138756
- }
138757
- function translateLevel(level) {
138758
- if (level === 0) {
138759
- return false;
138760
- }
138761
- return {level: level, hasBasic: true, has256: level >= 2, has16m: level >= 3};
138762
- }
138763
- function supportsColor(haveStream, streamIsTTY) {
138764
- if (forceColor === 0) {
138765
- return 0;
138766
- }
138767
- if (
138768
- hasFlag('color=16m') ||
138769
- hasFlag('color=full') ||
138770
- hasFlag('color=truecolor')
138771
- ) {
138772
- return 3;
138773
- }
138774
- if (hasFlag('color=256')) {
138775
- return 2;
138776
- }
138777
- if (haveStream && !streamIsTTY && forceColor === undefined) {
138778
- return 0;
138779
- }
138780
- const min = forceColor || 0;
138781
- if (env.TERM === 'dumb') {
138782
- return min;
138783
- }
138784
- if (process.platform === 'win32') {
138785
- const osRelease = os.release().split('.');
138786
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
138787
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
138788
- }
138789
- return 1;
138790
- }
138791
- if ('CI' in env) {
138792
- if (
138793
- [
138794
- 'TRAVIS',
138795
- 'CIRCLECI',
138796
- 'APPVEYOR',
138797
- 'GITLAB_CI',
138798
- 'GITHUB_ACTIONS',
138799
- 'BUILDKITE',
138800
- ].some(sign => sign in env) ||
138801
- env.CI_NAME === 'codeship'
138802
- ) {
138803
- return 1;
138804
- }
138805
- return min;
138806
- }
138807
- if ('TEAMCITY_VERSION' in env) {
138808
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
138809
- }
138810
- if (env.COLORTERM === 'truecolor') {
138811
- return 3;
138812
- }
138813
- if ('TERM_PROGRAM' in env) {
138814
- const version = parseInt(
138815
- (env.TERM_PROGRAM_VERSION || '').split('.')[0],
138816
- 10
138817
- );
138818
- switch (env.TERM_PROGRAM) {
138819
- case 'iTerm.app':
138820
- return version >= 3 ? 3 : 2;
138821
- case 'Apple_Terminal':
138822
- return 2;
138823
- }
138824
- }
138825
- if (/-256(color)?$/i.test(env.TERM)) {
138826
- return 2;
138827
- }
138828
- if (
138829
- /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)
138830
- ) {
138831
- return 1;
138832
- }
138833
- if ('COLORTERM' in env) {
138834
- return 1;
138835
- }
138836
- return min;
138837
- }
138838
- function getSupportLevel(stream) {
138839
- const level = supportsColor(stream, stream && stream.isTTY);
138840
- return translateLevel(level);
138841
- }
138842
- var supportsColor_1 = {
138843
- supportsColor: getSupportLevel,
138844
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
138845
- stderr: translateLevel(supportsColor(true, tty.isatty(2))),
138846
- };
138847
- const stringReplaceAll$1 = (string, substring, replacer) => {
138848
- let index = string.indexOf(substring);
138849
- if (index === -1) {
138850
- return string;
138851
- }
138852
- const substringLength = substring.length;
138853
- let endIndex = 0;
138854
- let returnValue = '';
138855
- do {
138856
- returnValue +=
138857
- string.substr(endIndex, index - endIndex) + substring + replacer;
138858
- endIndex = index + substringLength;
138859
- index = string.indexOf(substring, endIndex);
138860
- } while (index !== -1);
138861
- returnValue += string.substr(endIndex);
138862
- return returnValue;
138863
- };
138864
- const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
138865
- let endIndex = 0;
138866
- let returnValue = '';
138867
- do {
138868
- const gotCR = string[index - 1] === '\r';
138869
- returnValue +=
138870
- string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) +
138871
- prefix +
138872
- (gotCR ? '\r\n' : '\n') +
138873
- postfix;
138874
- endIndex = index + 1;
138875
- index = string.indexOf('\n', endIndex);
138876
- } while (index !== -1);
138877
- returnValue += string.substr(endIndex);
138878
- return returnValue;
138879
- };
138880
- var util = {
138881
- stringReplaceAll: stringReplaceAll$1,
138882
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1,
138883
- };
138884
- var templates;
138885
- var hasRequiredTemplates;
138886
- function requireTemplates() {
138887
- if (hasRequiredTemplates) return templates;
138888
- hasRequiredTemplates = 1;
138889
- const TEMPLATE_REGEX =
138890
- /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
138891
- const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
138892
- const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
138893
- const ESCAPE_REGEX =
138894
- /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
138895
- const ESCAPES = new Map([
138896
- ['n', '\n'],
138897
- ['r', '\r'],
138898
- ['t', '\t'],
138899
- ['b', '\b'],
138900
- ['f', '\f'],
138901
- ['v', '\v'],
138902
- ['0', '\0'],
138903
- ['\\', '\\'],
138904
- ['e', ''],
138905
- ['a', ''],
138906
- ]);
138907
- function unescape(c) {
138908
- const u = c[0] === 'u';
138909
- const bracket = c[1] === '{';
138910
- if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
138911
- return String.fromCharCode(parseInt(c.slice(1), 16));
138912
- }
138913
- if (u && bracket) {
138914
- return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
138915
- }
138916
- return ESCAPES.get(c) || c;
138917
- }
138918
- function parseArguments(name, arguments_) {
138919
- const results = [];
138920
- const chunks = arguments_.trim().split(/\s*,\s*/g);
138921
- let matches;
138922
- for (const chunk of chunks) {
138923
- const number = Number(chunk);
138924
- if (!Number.isNaN(number)) {
138925
- results.push(number);
138926
- } else if ((matches = chunk.match(STRING_REGEX))) {
138927
- results.push(
138928
- matches[2].replace(ESCAPE_REGEX, (m, escape, character) =>
138929
- escape ? unescape(escape) : character
138930
- )
138931
- );
138932
- } else {
138933
- throw new Error(
138934
- `Invalid Chalk template style argument: ${chunk} (in style '${name}')`
138935
- );
138936
- }
138937
- }
138938
- return results;
138939
- }
138940
- function parseStyle(style) {
138941
- STYLE_REGEX.lastIndex = 0;
138942
- const results = [];
138943
- let matches;
138944
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
138945
- const name = matches[1];
138946
- if (matches[2]) {
138947
- const args = parseArguments(name, matches[2]);
138948
- results.push([name].concat(args));
138949
- } else {
138950
- results.push([name]);
138951
- }
138952
- }
138953
- return results;
138954
- }
138955
- function buildStyle(chalk, styles) {
138956
- const enabled = {};
138957
- for (const layer of styles) {
138958
- for (const style of layer.styles) {
138959
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
138960
- }
138961
- }
138962
- let current = chalk;
138963
- for (const [styleName, styles] of Object.entries(enabled)) {
138964
- if (!Array.isArray(styles)) {
138965
- continue;
138966
- }
138967
- if (!(styleName in current)) {
138968
- throw new Error(`Unknown Chalk style: ${styleName}`);
138969
- }
138970
- current =
138971
- styles.length > 0 ? current[styleName](...styles) : current[styleName];
138972
- }
138973
- return current;
138974
- }
138975
- templates = (chalk, temporary) => {
138976
- const styles = [];
138977
- const chunks = [];
138978
- let chunk = [];
138979
- temporary.replace(
138980
- TEMPLATE_REGEX,
138981
- (m, escapeCharacter, inverse, style, close, character) => {
138982
- if (escapeCharacter) {
138983
- chunk.push(unescape(escapeCharacter));
138984
- } else if (style) {
138985
- const string = chunk.join('');
138986
- chunk = [];
138987
- chunks.push(
138988
- styles.length === 0 ? string : buildStyle(chalk, styles)(string)
138989
- );
138990
- styles.push({inverse: inverse, styles: parseStyle(style)});
138991
- } else if (close) {
138992
- if (styles.length === 0) {
138993
- throw new Error('Found extraneous } in Chalk template literal');
138994
- }
138995
- chunks.push(buildStyle(chalk, styles)(chunk.join('')));
138996
- chunk = [];
138997
- styles.pop();
138998
- } else {
138999
- chunk.push(character);
139000
- }
139001
- }
139002
- );
139003
- chunks.push(chunk.join(''));
139004
- if (styles.length > 0) {
139005
- const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
139006
- throw new Error(errMessage);
139007
- }
139008
- return chunks.join('');
139009
- };
139010
- return templates;
139011
- }
139012
- const ansiStyles = ansiStylesExports;
139013
- const {stdout: stdoutColor, stderr: stderrColor} = supportsColor_1;
139014
- const {
139015
- stringReplaceAll: stringReplaceAll,
139016
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex,
139017
- } = util;
139018
- const {isArray: isArray} = Array;
139019
- const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
139020
- const styles = Object.create(null);
139021
- const applyOptions = (object, options = {}) => {
139022
- if (
139023
- options.level &&
139024
- !(
139025
- Number.isInteger(options.level) &&
139026
- options.level >= 0 &&
139027
- options.level <= 3
139028
- )
139029
- ) {
139030
- throw new Error('The `level` option should be an integer from 0 to 3');
139031
- }
139032
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
139033
- object.level = options.level === undefined ? colorLevel : options.level;
139034
- };
139035
- class ChalkClass {
139036
- constructor(options) {
139037
- return chalkFactory(options);
139038
- }
139039
- }
139040
- const chalkFactory = options => {
139041
- const chalk = {};
139042
- applyOptions(chalk, options);
139043
- chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
139044
- Object.setPrototypeOf(chalk, Chalk.prototype);
139045
- Object.setPrototypeOf(chalk.template, chalk);
139046
- chalk.template.constructor = () => {
139047
- throw new Error(
139048
- '`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'
139049
- );
139050
- };
139051
- chalk.template.Instance = ChalkClass;
139052
- return chalk.template;
139053
- };
139054
- function Chalk(options) {
139055
- return chalkFactory(options);
139056
- }
139057
- for (const [styleName, style] of Object.entries(ansiStyles)) {
139058
- styles[styleName] = {
139059
- get() {
139060
- const builder = createBuilder(
139061
- this,
139062
- createStyler(style.open, style.close, this._styler),
139063
- this._isEmpty
139064
- );
139065
- Object.defineProperty(this, styleName, {value: builder});
139066
- return builder;
139067
- },
139068
- };
139069
- }
139070
- styles.visible = {
139071
- get() {
139072
- const builder = createBuilder(this, this._styler, true);
139073
- Object.defineProperty(this, 'visible', {value: builder});
139074
- return builder;
139075
- },
139076
- };
139077
- const usedModels = [
139078
- 'rgb',
139079
- 'hex',
139080
- 'keyword',
139081
- 'hsl',
139082
- 'hsv',
139083
- 'hwb',
139084
- 'ansi',
139085
- 'ansi256',
139086
- ];
139087
- for (const model of usedModels) {
139088
- styles[model] = {
139089
- get() {
139090
- const {level: level} = this;
139091
- return function (...arguments_) {
139092
- const styler = createStyler(
139093
- ansiStyles.color[levelMapping[level]][model](...arguments_),
139094
- ansiStyles.color.close,
139095
- this._styler
139096
- );
139097
- return createBuilder(this, styler, this._isEmpty);
139098
- };
139099
- },
139100
- };
139101
- }
139102
- for (const model of usedModels) {
139103
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
139104
- styles[bgModel] = {
139105
- get() {
139106
- const {level: level} = this;
139107
- return function (...arguments_) {
139108
- const styler = createStyler(
139109
- ansiStyles.bgColor[levelMapping[level]][model](...arguments_),
139110
- ansiStyles.bgColor.close,
139111
- this._styler
139112
- );
139113
- return createBuilder(this, styler, this._isEmpty);
139114
- };
139115
- },
139116
- };
139117
- }
139118
- const proto = Object.defineProperties(() => {}, {
139119
- ...styles,
139120
- level: {
139121
- enumerable: true,
139122
- get() {
139123
- return this._generator.level;
139124
- },
139125
- set(level) {
139126
- this._generator.level = level;
139127
- },
139128
- },
139129
- });
139130
- const createStyler = (open, close, parent) => {
139131
- let openAll;
139132
- let closeAll;
139133
- if (parent === undefined) {
139134
- openAll = open;
139135
- closeAll = close;
139136
- } else {
139137
- openAll = parent.openAll + open;
139138
- closeAll = close + parent.closeAll;
139139
- }
139140
- return {
139141
- open: open,
139142
- close: close,
139143
- openAll: openAll,
139144
- closeAll: closeAll,
139145
- parent: parent,
139146
- };
139147
- };
139148
- const createBuilder = (self, _styler, _isEmpty) => {
139149
- const builder = (...arguments_) => {
139150
- if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
139151
- return applyStyle(builder, chalkTag(builder, ...arguments_));
139152
- }
139153
- return applyStyle(
139154
- builder,
139155
- arguments_.length === 1 ? '' + arguments_[0] : arguments_.join(' ')
139156
- );
139157
- };
139158
- Object.setPrototypeOf(builder, proto);
139159
- builder._generator = self;
139160
- builder._styler = _styler;
139161
- builder._isEmpty = _isEmpty;
139162
- return builder;
139163
- };
139164
- const applyStyle = (self, string) => {
139165
- if (self.level <= 0 || !string) {
139166
- return self._isEmpty ? '' : string;
139167
- }
139168
- let styler = self._styler;
139169
- if (styler === undefined) {
139170
- return string;
139171
- }
139172
- const {openAll: openAll, closeAll: closeAll} = styler;
139173
- if (string.indexOf('') !== -1) {
139174
- while (styler !== undefined) {
139175
- string = stringReplaceAll(string, styler.close, styler.open);
139176
- styler = styler.parent;
139177
- }
139178
- }
139179
- const lfIndex = string.indexOf('\n');
139180
- if (lfIndex !== -1) {
139181
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
139182
- }
139183
- return openAll + string + closeAll;
139184
- };
139185
- let template;
139186
- const chalkTag = (chalk, ...strings) => {
139187
- const [firstString] = strings;
139188
- if (!isArray(firstString) || !isArray(firstString.raw)) {
139189
- return strings.join(' ');
139190
- }
139191
- const arguments_ = strings.slice(1);
139192
- const parts = [firstString.raw[0]];
139193
- for (let i = 1; i < firstString.length; i++) {
139194
- parts.push(
139195
- String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
139196
- String(firstString.raw[i])
139197
- );
139198
- }
139199
- if (template === undefined) {
139200
- template = requireTemplates();
139201
- }
139202
- return template(chalk, parts.join(''));
139203
- };
139204
- Object.defineProperties(Chalk.prototype, styles);
139205
- const chalk = Chalk();
139206
- chalk.supportsColor = stdoutColor;
139207
- chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0});
139208
- chalk.stderr.supportsColor = stderrColor;
139209
- function logDebug(step, value) {}
139210
- function logCodegenFunction(step, fn) {}
139211
- function logHIRFunction(step, fn) {}
139212
- function logReactiveFunction(step, fn) {}
139213
137645
  function inferReactiveScopeVariables(fn) {
137646
+ var _a, _b;
139214
137647
  const scopeIdentifiers = findDisjointMutableValues(fn);
139215
137648
  const scopes = new Map();
139216
137649
  scopeIdentifiers.forEach((identifier, groupIdentifier) => {
@@ -139259,6 +137692,16 @@ function inferReactiveScopeVariables(fn) {
139259
137692
  maxInstruction === 0 ||
139260
137693
  scope.range.end > maxInstruction + 1
139261
137694
  ) {
137695
+ (_b =
137696
+ (_a = fn.env.logger) === null || _a === void 0
137697
+ ? void 0
137698
+ : _a.debugLogIRs) === null || _b === void 0
137699
+ ? void 0
137700
+ : _b.call(_a, {
137701
+ kind: 'hir',
137702
+ name: 'InferReactiveScopeVariables (invalid scope)',
137703
+ value: fn,
137704
+ });
139262
137705
  CompilerError.invariant(false, {
139263
137706
  reason: `Invalid mutable range for scope`,
139264
137707
  loc: GeneratedSource,
@@ -141722,15 +140165,14 @@ function createPropsProperties(
141722
140165
  let refProperty;
141723
140166
  let keyProperty;
141724
140167
  const props = [];
141725
- const jsxAttributesWithoutKeyAndRef = propAttributes.filter(
141726
- p => p.kind === 'JsxAttribute' && p.name !== 'key' && p.name !== 'ref'
140168
+ const jsxAttributesWithoutKey = propAttributes.filter(
140169
+ p => p.kind === 'JsxAttribute' && p.name !== 'key'
141727
140170
  );
141728
140171
  const jsxSpreadAttributes = propAttributes.filter(
141729
140172
  p => p.kind === 'JsxSpreadAttribute'
141730
140173
  );
141731
140174
  const spreadPropsOnly =
141732
- jsxAttributesWithoutKeyAndRef.length === 0 &&
141733
- jsxSpreadAttributes.length === 1;
140175
+ jsxAttributesWithoutKey.length === 0 && jsxSpreadAttributes.length === 1;
141734
140176
  propAttributes.forEach(prop => {
141735
140177
  switch (prop.kind) {
141736
140178
  case 'JsxAttribute': {
@@ -142597,7 +141039,7 @@ var _Context_nextScheduleId,
142597
141039
  _Context_catchHandlers,
142598
141040
  _Context_controlFlowStack;
142599
141041
  function buildReactiveFunction(fn) {
142600
- const cx = new Context$2(fn.body);
141042
+ const cx = new Context$3(fn.body);
142601
141043
  const driver = new Driver(cx);
142602
141044
  const body = driver.traverseBlock(cx.block(fn.body.entry));
142603
141045
  return {
@@ -143645,7 +142087,7 @@ class Driver {
143645
142087
  };
143646
142088
  }
143647
142089
  }
143648
- let Context$2 = class Context {
142090
+ let Context$3 = class Context {
143649
142091
  constructor(ir) {
143650
142092
  _Context_nextScheduleId.set(this, 0);
143651
142093
  this.emitted = new Set();
@@ -144033,7 +142475,7 @@ function codegenFunction(
144033
142475
  {uniqueIdentifiers: uniqueIdentifiers, fbtOperands: fbtOperands}
144034
142476
  ) {
144035
142477
  var _a, _b, _c;
144036
- const cx = new Context$1(
142478
+ const cx = new Context$2(
144037
142479
  fn.env,
144038
142480
  (_a = fn.id) !== null && _a !== void 0 ? _a : '[[ anonymous ]]',
144039
142481
  uniqueIdentifiers,
@@ -144198,7 +142640,7 @@ function codegenFunction(
144198
142640
  pruneHoistedContexts(reactiveFunction);
144199
142641
  const identifiers = renameVariables(reactiveFunction);
144200
142642
  const codegen = codegenReactiveFunction(
144201
- new Context$1(
142643
+ new Context$2(
144202
142644
  cx.env,
144203
142645
  (_c = reactiveFunction.id) !== null && _c !== void 0
144204
142646
  ? _c
@@ -144256,6 +142698,7 @@ function codegenReactiveFunction(cx, fn) {
144256
142698
  prunedMemoValues: countMemoBlockVisitor.prunedMemoValues,
144257
142699
  outlined: [],
144258
142700
  hasLoweredContextAccess: fn.env.hasLoweredContextAccess,
142701
+ hasFireRewrite: fn.env.hasFireRewrite,
144259
142702
  });
144260
142703
  }
144261
142704
  class CountMemoBlockVisitor extends ReactiveFunctionVisitor {
@@ -144285,7 +142728,7 @@ function convertParameter(param) {
144285
142728
  return t__namespace.restElement(convertIdentifier(param.place.identifier));
144286
142729
  }
144287
142730
  }
144288
- let Context$1 = class Context {
142731
+ let Context$2 = class Context {
144289
142732
  constructor(env, fnName, uniqueIdentifiers, fbtOperands, temporaries = null) {
144290
142733
  _Context_nextCacheIndex.set(this, 0);
144291
142734
  _Context_declarations$1.set(this, new Set());
@@ -145203,19 +143646,6 @@ function codegenInstructionNullable(cx, instr) {
145203
143646
  }
145204
143647
  function codegenForInit(cx, init) {
145205
143648
  if (init.kind === 'SequenceExpression') {
145206
- for (const instr of init.instructions) {
145207
- if (instr.value.kind === 'DeclareContext') {
145208
- CompilerError.throwTodo({
145209
- reason: `Support for loops where the index variable is a context variable`,
145210
- loc: instr.loc,
145211
- description:
145212
- instr.value.lvalue.place.identifier.name != null
145213
- ? `\`${instr.value.lvalue.place.identifier.name.value}\` is a context variable`
145214
- : null,
145215
- suggestions: null,
145216
- });
145217
- }
145218
- }
145219
143649
  const body = codegenBlock(
145220
143650
  cx,
145221
143651
  init.instructions.map(instruction => ({
@@ -145226,20 +143656,37 @@ function codegenForInit(cx, init) {
145226
143656
  const declarators = [];
145227
143657
  let kind = 'const';
145228
143658
  body.forEach(instr => {
145229
- CompilerError.invariant(
145230
- instr.type === 'VariableDeclaration' &&
145231
- (instr.kind === 'let' || instr.kind === 'const'),
145232
- {
145233
- reason: 'Expected a variable declaration',
145234
- loc: init.loc,
145235
- description: `Got ${instr.type}`,
145236
- suggestions: null,
143659
+ var _a;
143660
+ let top = undefined;
143661
+ if (
143662
+ instr.type === 'ExpressionStatement' &&
143663
+ instr.expression.type === 'AssignmentExpression' &&
143664
+ instr.expression.operator === '=' &&
143665
+ instr.expression.left.type === 'Identifier' &&
143666
+ ((_a = top = declarators.at(-1)) === null || _a === void 0
143667
+ ? void 0
143668
+ : _a.id.type) === 'Identifier' &&
143669
+ (top === null || top === void 0 ? void 0 : top.id.name) ===
143670
+ instr.expression.left.name &&
143671
+ (top === null || top === void 0 ? void 0 : top.init) == null
143672
+ ) {
143673
+ top.init = instr.expression.right;
143674
+ } else {
143675
+ CompilerError.invariant(
143676
+ instr.type === 'VariableDeclaration' &&
143677
+ (instr.kind === 'let' || instr.kind === 'const'),
143678
+ {
143679
+ reason: 'Expected a variable declaration',
143680
+ loc: init.loc,
143681
+ description: `Got ${instr.type}`,
143682
+ suggestions: null,
143683
+ }
143684
+ );
143685
+ if (instr.kind === 'let') {
143686
+ kind = 'let';
145237
143687
  }
145238
- );
145239
- if (instr.kind === 'let') {
145240
- kind = 'let';
143688
+ declarators.push(...instr.declarations);
145241
143689
  }
145242
- declarators.push(...instr.declarations);
145243
143690
  });
145244
143691
  CompilerError.invariant(declarators.length > 0, {
145245
143692
  reason: 'Expected a variable declaration',
@@ -145616,7 +144063,7 @@ function codegenInstructionValue(cx, instrValue) {
145616
144063
  pruneUnusedLabels(reactiveFunction);
145617
144064
  pruneUnusedLValues(reactiveFunction);
145618
144065
  const fn = codegenReactiveFunction(
145619
- new Context$1(
144066
+ new Context$2(
145620
144067
  cx.env,
145621
144068
  (_e = reactiveFunction.id) !== null && _e !== void 0
145622
144069
  ? _e
@@ -145815,7 +144262,7 @@ function codegenInstructionValue(cx, instrValue) {
145815
144262
  pruneUnusedLValues(reactiveFunction);
145816
144263
  pruneHoistedContexts(reactiveFunction);
145817
144264
  const fn = codegenReactiveFunction(
145818
- new Context$1(
144265
+ new Context$2(
145819
144266
  cx.env,
145820
144267
  (_g = reactiveFunction.id) !== null && _g !== void 0
145821
144268
  ? _g
@@ -146412,7 +144859,7 @@ function mergeReactiveScopesThatInvalidateTogether(fn) {
146412
144859
  visitReactiveFunction(fn, lastUsageVisitor, undefined);
146413
144860
  visitReactiveFunction(fn, new Transform$4(lastUsageVisitor.lastUsage), null);
146414
144861
  }
146415
- function log$1(msg) {}
144862
+ function log(msg) {}
146416
144863
  class FindLastUsageVisitor extends ReactiveFunctionVisitor {
146417
144864
  constructor() {
146418
144865
  super(...arguments);
@@ -146465,7 +144912,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146465
144912
  switch (instr.kind) {
146466
144913
  case 'terminal': {
146467
144914
  if (current !== null) {
146468
- log$1(
144915
+ log(
146469
144916
  `Reset scope @${current.block.scope.id} from terminal [${instr.terminal.id}]`
146470
144917
  );
146471
144918
  reset();
@@ -146474,7 +144921,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146474
144921
  }
146475
144922
  case 'pruned-scope': {
146476
144923
  if (current !== null) {
146477
- log$1(
144924
+ log(
146478
144925
  `Reset scope @${current.block.scope.id} from pruned scope @${instr.scope.id}`
146479
144926
  );
146480
144927
  reset();
@@ -146510,7 +144957,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146510
144957
  current.lvalues.add(lvalue.identifier.declarationId);
146511
144958
  }
146512
144959
  } else {
146513
- log$1(
144960
+ log(
146514
144961
  `Reset scope @${current.block.scope.id} from StoreLocal in [${instr.instruction.id}]`
146515
144962
  );
146516
144963
  reset();
@@ -146520,7 +144967,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146520
144967
  }
146521
144968
  default: {
146522
144969
  if (current !== null) {
146523
- log$1(
144970
+ log(
146524
144971
  `Reset scope @${current.block.scope.id} from instruction [${instr.instruction.id}]`
146525
144972
  );
146526
144973
  reset();
@@ -146539,7 +144986,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146539
144986
  this.lastUsage
146540
144987
  )
146541
144988
  ) {
146542
- log$1(
144989
+ log(
146543
144990
  `Can merge scope @${current.block.scope.id} with @${instr.scope.id}`
146544
144991
  );
146545
144992
  current.block.scope.range.end = makeInstructionId(
@@ -146552,14 +144999,14 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146552
144999
  current.to = i + 1;
146553
145000
  current.lvalues.clear();
146554
145001
  if (!scopeIsEligibleForMerging(instr)) {
146555
- log$1(
145002
+ log(
146556
145003
  ` but scope @${instr.scope.id} doesnt guaranteed invalidate so it cannot merge further`
146557
145004
  );
146558
145005
  reset();
146559
145006
  }
146560
145007
  } else {
146561
145008
  if (current !== null) {
146562
- log$1(
145009
+ log(
146563
145010
  `Reset scope @${current.block.scope.id}, not mergeable with subsequent scope @${instr.scope.id}`
146564
145011
  );
146565
145012
  reset();
@@ -146567,7 +145014,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146567
145014
  if (scopeIsEligibleForMerging(instr)) {
146568
145015
  current = {block: instr, from: i, to: i + 1, lvalues: new Set()};
146569
145016
  } else {
146570
- log$1(
145017
+ log(
146571
145018
  `scope @${instr.scope.id} doesnt guaranteed invalidate so it cannot merge further`
146572
145019
  );
146573
145020
  }
@@ -146586,9 +145033,9 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146586
145033
  reset();
146587
145034
  }
146588
145035
  if (merged.length) {
146589
- log$1(`merged ${merged.length} scopes:`);
145036
+ log(`merged ${merged.length} scopes:`);
146590
145037
  for (const entry of merged) {
146591
- log$1(
145038
+ log(
146592
145039
  printReactiveScopeSummary(entry.block.scope) +
146593
145040
  ` from=${entry.from} to=${entry.to}`
146594
145041
  );
@@ -146643,7 +145090,7 @@ function areLValuesLastUsedByScope(scope, lvalues, lastUsage) {
146643
145090
  for (const lvalue of lvalues) {
146644
145091
  const lastUsedAt = lastUsage.get(lvalue);
146645
145092
  if (lastUsedAt >= scope.range.end) {
146646
- log$1(` lvalue ${lvalue} used after scope @${scope.id}, cannot merge`);
145093
+ log(` lvalue ${lvalue} used after scope @${scope.id}, cannot merge`);
146647
145094
  return false;
146648
145095
  }
146649
145096
  }
@@ -146684,8 +145131,8 @@ function canMergeScopes(current, next) {
146684
145131
  ) {
146685
145132
  return true;
146686
145133
  }
146687
- log$1(` ${printReactiveScopeSummary(current.scope)}`);
146688
- log$1(` ${printReactiveScopeSummary(next.scope)}`);
145134
+ log(` ${printReactiveScopeSummary(current.scope)}`);
145135
+ log(` ${printReactiveScopeSummary(next.scope)}`);
146689
145136
  return false;
146690
145137
  }
146691
145138
  function isAlwaysInvalidatingType(type) {
@@ -150789,6 +149236,7 @@ function analyseFunctions(func) {
150789
149236
  }
150790
149237
  }
150791
149238
  function lower(func) {
149239
+ var _a, _b;
150792
149240
  analyseFunctions(func);
150793
149241
  inferReferenceEffects(func, {isFunctionExpression: true});
150794
149242
  deadCodeElimination(func);
@@ -150796,6 +149244,12 @@ function lower(func) {
150796
149244
  rewriteInstructionKindsBasedOnReassignment(func);
150797
149245
  inferReactiveScopeVariables(func);
150798
149246
  inferMutableContextVariables(func);
149247
+ (_b =
149248
+ (_a = func.env.logger) === null || _a === void 0
149249
+ ? void 0
149250
+ : _a.debugLogIRs) === null || _b === void 0
149251
+ ? void 0
149252
+ : _b.call(_a, {kind: 'hir', name: 'AnalyseFunction (inner)', value: func});
150799
149253
  }
150800
149254
  function infer(loweredFunc, state, context) {
150801
149255
  const mutations = new Map();
@@ -153862,7 +152316,7 @@ function joinRefAccessTypes(...types) {
153862
152316
  );
153863
152317
  }
153864
152318
  function validateNoRefAccessInRenderImpl(fn, env) {
153865
- var _a, _b, _c, _d, _e, _f, _g, _h;
152319
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
153866
152320
  let returnValues = [];
153867
152321
  let place;
153868
152322
  for (const param of fn.params) {
@@ -153935,31 +152389,41 @@ function validateNoRefAccessInRenderImpl(fn, env) {
153935
152389
  );
153936
152390
  break;
153937
152391
  }
153938
- case 'LoadContext':
153939
- case 'LoadLocal': {
152392
+ case 'TypeCastExpression': {
153940
152393
  env.set(
153941
152394
  instr.lvalue.identifier.id,
153942
- (_a = env.get(instr.value.place.identifier.id)) !== null &&
152395
+ (_a = env.get(instr.value.value.identifier.id)) !== null &&
153943
152396
  _a !== void 0
153944
152397
  ? _a
153945
152398
  : refTypeOfType(instr.lvalue)
153946
152399
  );
153947
152400
  break;
153948
152401
  }
153949
- case 'StoreContext':
153950
- case 'StoreLocal': {
152402
+ case 'LoadContext':
152403
+ case 'LoadLocal': {
153951
152404
  env.set(
153952
- instr.value.lvalue.place.identifier.id,
153953
- (_b = env.get(instr.value.value.identifier.id)) !== null &&
152405
+ instr.lvalue.identifier.id,
152406
+ (_b = env.get(instr.value.place.identifier.id)) !== null &&
153954
152407
  _b !== void 0
153955
152408
  ? _b
153956
- : refTypeOfType(instr.value.lvalue.place)
152409
+ : refTypeOfType(instr.lvalue)
153957
152410
  );
152411
+ break;
152412
+ }
152413
+ case 'StoreContext':
152414
+ case 'StoreLocal': {
153958
152415
  env.set(
153959
- instr.lvalue.identifier.id,
152416
+ instr.value.lvalue.place.identifier.id,
153960
152417
  (_c = env.get(instr.value.value.identifier.id)) !== null &&
153961
152418
  _c !== void 0
153962
152419
  ? _c
152420
+ : refTypeOfType(instr.value.lvalue.place)
152421
+ );
152422
+ env.set(
152423
+ instr.lvalue.identifier.id,
152424
+ (_d = env.get(instr.value.value.identifier.id)) !== null &&
152425
+ _d !== void 0
152426
+ ? _d
153963
152427
  : refTypeOfType(instr.lvalue)
153964
152428
  );
153965
152429
  break;
@@ -154056,8 +152520,8 @@ function validateNoRefAccessInRenderImpl(fn, env) {
154056
152520
  for (const operand of eachInstructionValueOperand(instr.value)) {
154057
152521
  validateNoDirectRefValueAccess(errors, operand, env);
154058
152522
  types.push(
154059
- (_d = env.get(operand.identifier.id)) !== null && _d !== void 0
154060
- ? _d
152523
+ (_e = env.get(operand.identifier.id)) !== null && _e !== void 0
152524
+ ? _e
154061
152525
  : {kind: 'None'}
154062
152526
  );
154063
152527
  }
@@ -154164,16 +152628,16 @@ function validateNoRefAccessInRenderImpl(fn, env) {
154164
152628
  }
154165
152629
  if (
154166
152630
  isUseRefType(instr.lvalue.identifier) &&
154167
- ((_e = env.get(instr.lvalue.identifier.id)) === null || _e === void 0
152631
+ ((_f = env.get(instr.lvalue.identifier.id)) === null || _f === void 0
154168
152632
  ? void 0
154169
- : _e.kind) !== 'Ref'
152633
+ : _f.kind) !== 'Ref'
154170
152634
  ) {
154171
152635
  env.set(
154172
152636
  instr.lvalue.identifier.id,
154173
152637
  joinRefAccessTypes(
154174
- (_f = env.get(instr.lvalue.identifier.id)) !== null &&
154175
- _f !== void 0
154176
- ? _f
152638
+ (_g = env.get(instr.lvalue.identifier.id)) !== null &&
152639
+ _g !== void 0
152640
+ ? _g
154177
152641
  : {kind: 'None'},
154178
152642
  {kind: 'Ref', refId: nextRefId()}
154179
152643
  )
@@ -154181,16 +152645,16 @@ function validateNoRefAccessInRenderImpl(fn, env) {
154181
152645
  }
154182
152646
  if (
154183
152647
  isRefValueType(instr.lvalue.identifier) &&
154184
- ((_g = env.get(instr.lvalue.identifier.id)) === null || _g === void 0
152648
+ ((_h = env.get(instr.lvalue.identifier.id)) === null || _h === void 0
154185
152649
  ? void 0
154186
- : _g.kind) !== 'RefValue'
152650
+ : _h.kind) !== 'RefValue'
154187
152651
  ) {
154188
152652
  env.set(
154189
152653
  instr.lvalue.identifier.id,
154190
152654
  joinRefAccessTypes(
154191
- (_h = env.get(instr.lvalue.identifier.id)) !== null &&
154192
- _h !== void 0
154193
- ? _h
152655
+ (_j = env.get(instr.lvalue.identifier.id)) !== null &&
152656
+ _j !== void 0
152657
+ ? _j
154194
152658
  : {kind: 'None'},
154195
152659
  {kind: 'RefValue', loc: instr.loc}
154196
152660
  )
@@ -156355,6 +154819,8 @@ var _Context_instances,
156355
154819
  _Context_dependencies,
156356
154820
  _Context_temporaries,
156357
154821
  _Context_temporariesUsedOutsideScope,
154822
+ _Context_processedInstrsInOptional,
154823
+ _Context_innerFnContext,
156358
154824
  _Context_checkValidDependency,
156359
154825
  _Context_isScopeActive;
156360
154826
  function propagateScopeDependenciesHIR(fn) {
@@ -156464,24 +154930,43 @@ function collectTemporariesSidemap(fn, usedOutsideDeclaringScope) {
156464
154930
  fn,
156465
154931
  usedOutsideDeclaringScope,
156466
154932
  temporaries,
156467
- false
154933
+ null
156468
154934
  );
156469
154935
  return temporaries;
156470
154936
  }
154937
+ function isLoadContextMutable(instrValue, id) {
154938
+ if (instrValue.kind === 'LoadContext') {
154939
+ CompilerError.invariant(instrValue.place.identifier.scope != null, {
154940
+ reason:
154941
+ '[PropagateScopeDependencies] Expected all context variables to be assigned a scope',
154942
+ loc: instrValue.loc,
154943
+ });
154944
+ return id >= instrValue.place.identifier.scope.range.end;
154945
+ }
154946
+ return false;
154947
+ }
156471
154948
  function collectTemporariesSidemapImpl(
156472
154949
  fn,
156473
154950
  usedOutsideDeclaringScope,
156474
154951
  temporaries,
156475
- isInnerFn
154952
+ innerFnContext
156476
154953
  ) {
156477
154954
  for (const [_, block] of fn.body.blocks) {
156478
- for (const instr of block.instructions) {
156479
- const {value: value, lvalue: lvalue} = instr;
154955
+ for (const {
154956
+ value: value,
154957
+ lvalue: lvalue,
154958
+ id: origInstrId,
154959
+ } of block.instructions) {
154960
+ const instrId =
154961
+ innerFnContext != null ? innerFnContext.instrId : origInstrId;
156480
154962
  const usedOutside = usedOutsideDeclaringScope.has(
156481
154963
  lvalue.identifier.declarationId
156482
154964
  );
156483
154965
  if (value.kind === 'PropertyLoad' && !usedOutside) {
156484
- if (!isInnerFn || temporaries.has(value.object.identifier.id)) {
154966
+ if (
154967
+ innerFnContext == null ||
154968
+ temporaries.has(value.object.identifier.id)
154969
+ ) {
156485
154970
  const property = getProperty(
156486
154971
  value.object,
156487
154972
  value.property,
@@ -156491,13 +154976,13 @@ function collectTemporariesSidemapImpl(
156491
154976
  temporaries.set(lvalue.identifier.id, property);
156492
154977
  }
156493
154978
  } else if (
156494
- value.kind === 'LoadLocal' &&
154979
+ (value.kind === 'LoadLocal' || isLoadContextMutable(value, instrId)) &&
156495
154980
  lvalue.identifier.name == null &&
156496
154981
  value.place.identifier.name !== null &&
156497
154982
  !usedOutside
156498
154983
  ) {
156499
154984
  if (
156500
- !isInnerFn ||
154985
+ innerFnContext == null ||
156501
154986
  fn.context.some(
156502
154987
  context => context.identifier.id === value.place.identifier.id
156503
154988
  )
@@ -156515,7 +155000,9 @@ function collectTemporariesSidemapImpl(
156515
155000
  value.loweredFunc.func,
156516
155001
  usedOutsideDeclaringScope,
156517
155002
  temporaries,
156518
- true
155003
+ innerFnContext !== null && innerFnContext !== void 0
155004
+ ? innerFnContext
155005
+ : {instrId: instrId}
156519
155006
  );
156520
155007
  }
156521
155008
  }
@@ -156540,8 +155027,12 @@ function getProperty(object, propertyName, optional, temporaries) {
156540
155027
  }
156541
155028
  return property;
156542
155029
  }
156543
- class Context {
156544
- constructor(temporariesUsedOutsideScope, temporaries) {
155030
+ let Context$1 = class Context {
155031
+ constructor(
155032
+ temporariesUsedOutsideScope,
155033
+ temporaries,
155034
+ processedInstrsInOptional
155035
+ ) {
156545
155036
  _Context_instances.add(this);
156546
155037
  _Context_declarations.set(this, new Map());
156547
155038
  _Context_reassignments.set(this, new Map());
@@ -156550,7 +155041,8 @@ class Context {
156550
155041
  this.deps = new Map();
156551
155042
  _Context_temporaries.set(this, void 0);
156552
155043
  _Context_temporariesUsedOutsideScope.set(this, void 0);
156553
- this.inInnerFn = false;
155044
+ _Context_processedInstrsInOptional.set(this, void 0);
155045
+ _Context_innerFnContext.set(this, null);
156554
155046
  __classPrivateFieldSet(
156555
155047
  this,
156556
155048
  _Context_temporariesUsedOutsideScope,
@@ -156558,6 +155050,12 @@ class Context {
156558
155050
  'f'
156559
155051
  );
156560
155052
  __classPrivateFieldSet(this, _Context_temporaries, temporaries, 'f');
155053
+ __classPrivateFieldSet(
155054
+ this,
155055
+ _Context_processedInstrsInOptional,
155056
+ processedInstrsInOptional,
155057
+ 'f'
155058
+ );
156561
155059
  }
156562
155060
  enterScope(scope) {
156563
155061
  __classPrivateFieldSet(
@@ -156626,7 +155124,8 @@ class Context {
156626
155124
  ).has(place.identifier.declarationId);
156627
155125
  }
156628
155126
  declare(identifier, decl) {
156629
- if (this.inInnerFn) return;
155127
+ if (__classPrivateFieldGet(this, _Context_innerFnContext, 'f') != null)
155128
+ return;
156630
155129
  if (
156631
155130
  !__classPrivateFieldGet(this, _Context_declarations, 'f').has(
156632
155131
  identifier.declarationId
@@ -156737,13 +155236,46 @@ class Context {
156737
155236
  currentScope.reassignments.add(place.identifier);
156738
155237
  }
156739
155238
  }
156740
- }
155239
+ enterInnerFn(innerFn, cb) {
155240
+ var _a;
155241
+ const prevContext = __classPrivateFieldGet(
155242
+ this,
155243
+ _Context_innerFnContext,
155244
+ 'f'
155245
+ );
155246
+ __classPrivateFieldSet(
155247
+ this,
155248
+ _Context_innerFnContext,
155249
+ (_a = __classPrivateFieldGet(this, _Context_innerFnContext, 'f')) !==
155250
+ null && _a !== void 0
155251
+ ? _a
155252
+ : {outerInstrId: innerFn.id},
155253
+ 'f'
155254
+ );
155255
+ const result = cb();
155256
+ __classPrivateFieldSet(this, _Context_innerFnContext, prevContext, 'f');
155257
+ return result;
155258
+ }
155259
+ isDeferredDependency(instr) {
155260
+ return (
155261
+ __classPrivateFieldGet(this, _Context_processedInstrsInOptional, 'f').has(
155262
+ instr.value
155263
+ ) ||
155264
+ (instr.kind === HIRValue.Instruction &&
155265
+ __classPrivateFieldGet(this, _Context_temporaries, 'f').has(
155266
+ instr.value.lvalue.identifier.id
155267
+ ))
155268
+ );
155269
+ }
155270
+ };
156741
155271
  (_Context_declarations = new WeakMap()),
156742
155272
  (_Context_reassignments = new WeakMap()),
156743
155273
  (_Context_scopes = new WeakMap()),
156744
155274
  (_Context_dependencies = new WeakMap()),
156745
155275
  (_Context_temporaries = new WeakMap()),
156746
155276
  (_Context_temporariesUsedOutsideScope = new WeakMap()),
155277
+ (_Context_processedInstrsInOptional = new WeakMap()),
155278
+ (_Context_innerFnContext = new WeakMap()),
156747
155279
  (_Context_instances = new WeakSet()),
156748
155280
  (_Context_checkValidDependency = function _Context_checkValidDependency(
156749
155281
  maybeDependency
@@ -156779,20 +155311,21 @@ class Context {
156779
155311
  state => state === scope
156780
155312
  );
156781
155313
  });
155314
+ var HIRValue;
155315
+ (function (HIRValue) {
155316
+ HIRValue[(HIRValue['Instruction'] = 1)] = 'Instruction';
155317
+ HIRValue[(HIRValue['Terminal'] = 2)] = 'Terminal';
155318
+ })(HIRValue || (HIRValue = {}));
156782
155319
  function handleInstruction(instr, context) {
156783
155320
  const {id: id, value: value, lvalue: lvalue} = instr;
156784
- if (value.kind === 'LoadLocal') {
156785
- if (
156786
- value.place.identifier.name === null ||
156787
- lvalue.identifier.name !== null ||
156788
- context.isUsedOutsideDeclaringScope(lvalue)
156789
- ) {
156790
- context.visitOperand(value.place);
156791
- }
156792
- } else if (value.kind === 'PropertyLoad') {
156793
- if (context.isUsedOutsideDeclaringScope(lvalue)) {
156794
- context.visitProperty(value.object, value.property, false);
156795
- }
155321
+ context.declare(lvalue.identifier, {id: id, scope: context.currentScope});
155322
+ if (
155323
+ context.isDeferredDependency({kind: HIRValue.Instruction, value: instr})
155324
+ ) {
155325
+ return;
155326
+ }
155327
+ if (value.kind === 'PropertyLoad') {
155328
+ context.visitProperty(value.object, value.property, false);
156796
155329
  } else if (value.kind === 'StoreLocal') {
156797
155330
  context.visitOperand(value.value);
156798
155331
  if (value.lvalue.kind === InstructionKind.Reassign) {
@@ -156820,7 +155353,6 @@ function handleInstruction(instr, context) {
156820
155353
  context.visitOperand(operand);
156821
155354
  }
156822
155355
  }
156823
- context.declare(lvalue.identifier, {id: id, scope: context.currentScope});
156824
155356
  }
156825
155357
  function collectDependencies(
156826
155358
  fn,
@@ -156828,7 +155360,11 @@ function collectDependencies(
156828
155360
  temporaries,
156829
155361
  processedInstrsInOptional
156830
155362
  ) {
156831
- const context = new Context(usedOutsideDeclaringScope, temporaries);
155363
+ const context = new Context$1(
155364
+ usedOutsideDeclaringScope,
155365
+ temporaries,
155366
+ processedInstrsInOptional
155367
+ );
156832
155368
  for (const param of fn.params) {
156833
155369
  if (param.kind === 'Identifier') {
156834
155370
  context.declare(param.identifier, {
@@ -156878,15 +155414,20 @@ function collectDependencies(
156878
155414
  id: instr.id,
156879
155415
  scope: context.currentScope,
156880
155416
  });
156881
- const wasInInnerFn = context.inInnerFn;
156882
- context.inInnerFn = true;
156883
- handleFunction(instr.value.loweredFunc.func);
156884
- context.inInnerFn = wasInInnerFn;
156885
- } else if (!processedInstrsInOptional.has(instr)) {
155417
+ const innerFn = instr.value.loweredFunc.func;
155418
+ context.enterInnerFn(instr, () => {
155419
+ handleFunction(innerFn);
155420
+ });
155421
+ } else {
156886
155422
  handleInstruction(instr, context);
156887
155423
  }
156888
155424
  }
156889
- if (!processedInstrsInOptional.has(block.terminal)) {
155425
+ if (
155426
+ !context.isDeferredDependency({
155427
+ kind: HIRValue.Terminal,
155428
+ value: block.terminal,
155429
+ })
155430
+ ) {
156890
155431
  for (const place of eachTerminalOperand(block.terminal)) {
156891
155432
  context.visitOperand(place);
156892
155433
  }
@@ -157256,7 +155797,641 @@ function emitDestructureProps(env, propsObj, oldToNewProps) {
157256
155797
  };
157257
155798
  return destructurePropsInstr;
157258
155799
  }
157259
- function* run(
155800
+ function optimizePropsMethodCalls(fn) {
155801
+ for (const [, block] of fn.body.blocks) {
155802
+ for (let i = 0; i < block.instructions.length; i++) {
155803
+ const instr = block.instructions[i];
155804
+ if (
155805
+ instr.value.kind === 'MethodCall' &&
155806
+ isPropsType(instr.value.receiver.identifier)
155807
+ ) {
155808
+ instr.value = {
155809
+ kind: 'CallExpression',
155810
+ callee: instr.value.property,
155811
+ args: instr.value.args,
155812
+ loc: instr.value.loc,
155813
+ };
155814
+ }
155815
+ }
155816
+ }
155817
+ }
155818
+ var _Context_env,
155819
+ _Context_errors,
155820
+ _Context_callExpressions,
155821
+ _Context_functionExpressions,
155822
+ _Context_loadLocals,
155823
+ _Context_fireCalleesToFireFunctions,
155824
+ _Context_calleesWithInsertedFire,
155825
+ _Context_capturedCalleeIdentifierIds,
155826
+ _Context_inUseEffectLambda,
155827
+ _Context_loadGlobalInstructionIds,
155828
+ _Context_arrayExpressions;
155829
+ const CANNOT_COMPILE_FIRE = 'Cannot compile `fire`';
155830
+ function transformFire(fn) {
155831
+ const context = new Context(fn.env);
155832
+ replaceFireFunctions(fn, context);
155833
+ if (!context.hasErrors()) {
155834
+ ensureNoMoreFireUses(fn, context);
155835
+ }
155836
+ context.throwIfErrorsFound();
155837
+ }
155838
+ function replaceFireFunctions(fn, context) {
155839
+ let hasRewrite = false;
155840
+ for (const [, block] of fn.body.blocks) {
155841
+ const rewriteInstrs = new Map();
155842
+ const deleteInstrs = new Set();
155843
+ for (const instr of block.instructions) {
155844
+ const {value: value, lvalue: lvalue} = instr;
155845
+ if (
155846
+ value.kind === 'CallExpression' &&
155847
+ isUseEffectHookType(value.callee.identifier) &&
155848
+ value.args.length > 0 &&
155849
+ value.args[0].kind === 'Identifier'
155850
+ ) {
155851
+ const lambda = context.getFunctionExpression(
155852
+ value.args[0].identifier.id
155853
+ );
155854
+ if (lambda != null) {
155855
+ const capturedCallees =
155856
+ visitFunctionExpressionAndPropagateFireDependencies(
155857
+ lambda,
155858
+ context,
155859
+ true
155860
+ );
155861
+ const newInstrs = [];
155862
+ for (const [
155863
+ fireCalleePlace,
155864
+ fireCalleeInfo,
155865
+ ] of capturedCallees.entries()) {
155866
+ if (!context.hasCalleeWithInsertedFire(fireCalleePlace)) {
155867
+ context.addCalleeWithInsertedFire(fireCalleePlace);
155868
+ const loadUseFireInstr = makeLoadUseFireInstruction(fn.env);
155869
+ const loadFireCalleeInstr = makeLoadFireCalleeInstruction(
155870
+ fn.env,
155871
+ fireCalleeInfo.capturedCalleeIdentifier
155872
+ );
155873
+ const callUseFireInstr = makeCallUseFireInstruction(
155874
+ fn.env,
155875
+ loadUseFireInstr.lvalue,
155876
+ loadFireCalleeInstr.lvalue
155877
+ );
155878
+ const storeUseFireInstr = makeStoreUseFireInstruction(
155879
+ fn.env,
155880
+ callUseFireInstr.lvalue,
155881
+ fireCalleeInfo.fireFunctionBinding
155882
+ );
155883
+ newInstrs.push(
155884
+ loadUseFireInstr,
155885
+ loadFireCalleeInstr,
155886
+ callUseFireInstr,
155887
+ storeUseFireInstr
155888
+ );
155889
+ const loadUseEffectInstrId = context.getLoadGlobalInstrId(
155890
+ value.callee.identifier.id
155891
+ );
155892
+ if (loadUseEffectInstrId == null) {
155893
+ context.pushError({
155894
+ loc: value.loc,
155895
+ description: null,
155896
+ severity: exports.ErrorSeverity.Invariant,
155897
+ reason: '[InsertFire] No LoadGlobal found for useEffect call',
155898
+ suggestions: null,
155899
+ });
155900
+ continue;
155901
+ }
155902
+ rewriteInstrs.set(loadUseEffectInstrId, newInstrs);
155903
+ }
155904
+ }
155905
+ ensureNoRemainingCalleeCaptures(
155906
+ lambda.loweredFunc.func,
155907
+ context,
155908
+ capturedCallees
155909
+ );
155910
+ if (
155911
+ value.args.length > 1 &&
155912
+ value.args[1] != null &&
155913
+ value.args[1].kind === 'Identifier'
155914
+ ) {
155915
+ const depArray = value.args[1];
155916
+ const depArrayExpression = context.getArrayExpression(
155917
+ depArray.identifier.id
155918
+ );
155919
+ if (depArrayExpression != null) {
155920
+ for (const dependency of depArrayExpression.elements) {
155921
+ if (dependency.kind === 'Identifier') {
155922
+ const loadOfDependency = context.getLoadLocalInstr(
155923
+ dependency.identifier.id
155924
+ );
155925
+ if (loadOfDependency != null) {
155926
+ const replacedDepArrayItem = capturedCallees.get(
155927
+ loadOfDependency.place.identifier.id
155928
+ );
155929
+ if (replacedDepArrayItem != null) {
155930
+ loadOfDependency.place =
155931
+ replacedDepArrayItem.fireFunctionBinding;
155932
+ }
155933
+ }
155934
+ }
155935
+ }
155936
+ } else {
155937
+ context.pushError({
155938
+ loc: value.args[1].loc,
155939
+ description:
155940
+ 'You must use an array literal for an effect dependency array when that effect uses `fire()`',
155941
+ severity: exports.ErrorSeverity.Invariant,
155942
+ reason: CANNOT_COMPILE_FIRE,
155943
+ suggestions: null,
155944
+ });
155945
+ }
155946
+ } else if (value.args.length > 1 && value.args[1].kind === 'Spread') {
155947
+ context.pushError({
155948
+ loc: value.args[1].place.loc,
155949
+ description:
155950
+ 'You must use an array literal for an effect dependency array when that effect uses `fire()`',
155951
+ severity: exports.ErrorSeverity.Invariant,
155952
+ reason: CANNOT_COMPILE_FIRE,
155953
+ suggestions: null,
155954
+ });
155955
+ }
155956
+ }
155957
+ } else if (
155958
+ value.kind === 'CallExpression' &&
155959
+ value.callee.identifier.type.kind === 'Function' &&
155960
+ value.callee.identifier.type.shapeId === BuiltInFireId &&
155961
+ context.inUseEffectLambda()
155962
+ ) {
155963
+ if (value.args.length === 1 && value.args[0].kind === 'Identifier') {
155964
+ const callExpr = context.getCallExpression(
155965
+ value.args[0].identifier.id
155966
+ );
155967
+ if (callExpr != null) {
155968
+ const calleeId = callExpr.callee.identifier.id;
155969
+ const loadLocal = context.getLoadLocalInstr(calleeId);
155970
+ if (loadLocal == null) {
155971
+ context.pushError({
155972
+ loc: value.loc,
155973
+ description: null,
155974
+ severity: exports.ErrorSeverity.Invariant,
155975
+ reason:
155976
+ '[InsertFire] No loadLocal found for fire call argument',
155977
+ suggestions: null,
155978
+ });
155979
+ continue;
155980
+ }
155981
+ const fireFunctionBinding =
155982
+ context.getOrGenerateFireFunctionBinding(
155983
+ loadLocal.place,
155984
+ value.loc
155985
+ );
155986
+ loadLocal.place = Object.assign({}, fireFunctionBinding);
155987
+ deleteInstrs.add(instr.id);
155988
+ } else {
155989
+ context.pushError({
155990
+ loc: value.loc,
155991
+ description:
155992
+ '`fire()` can only receive a function call such as `fire(fn(a,b)). Method calls and other expressions are not allowed',
155993
+ severity: exports.ErrorSeverity.InvalidReact,
155994
+ reason: CANNOT_COMPILE_FIRE,
155995
+ suggestions: null,
155996
+ });
155997
+ }
155998
+ } else {
155999
+ let description =
156000
+ 'fire() can only take in a single call expression as an argument';
156001
+ if (value.args.length === 0) {
156002
+ description += ' but received none';
156003
+ } else if (value.args.length > 1) {
156004
+ description += ' but received multiple arguments';
156005
+ } else if (value.args[0].kind === 'Spread') {
156006
+ description += ' but received a spread argument';
156007
+ }
156008
+ context.pushError({
156009
+ loc: value.loc,
156010
+ description: description,
156011
+ severity: exports.ErrorSeverity.InvalidReact,
156012
+ reason: CANNOT_COMPILE_FIRE,
156013
+ suggestions: null,
156014
+ });
156015
+ }
156016
+ } else if (value.kind === 'CallExpression') {
156017
+ context.addCallExpression(lvalue.identifier.id, value);
156018
+ } else if (
156019
+ value.kind === 'FunctionExpression' &&
156020
+ context.inUseEffectLambda()
156021
+ ) {
156022
+ visitFunctionExpressionAndPropagateFireDependencies(
156023
+ value,
156024
+ context,
156025
+ false
156026
+ );
156027
+ } else if (value.kind === 'FunctionExpression') {
156028
+ context.addFunctionExpression(lvalue.identifier.id, value);
156029
+ } else if (value.kind === 'LoadLocal') {
156030
+ context.addLoadLocalInstr(lvalue.identifier.id, value);
156031
+ } else if (
156032
+ value.kind === 'LoadGlobal' &&
156033
+ value.binding.kind === 'ImportSpecifier' &&
156034
+ value.binding.module === 'react' &&
156035
+ value.binding.imported === 'fire' &&
156036
+ context.inUseEffectLambda()
156037
+ ) {
156038
+ deleteInstrs.add(instr.id);
156039
+ } else if (value.kind === 'LoadGlobal') {
156040
+ context.addLoadGlobalInstrId(lvalue.identifier.id, instr.id);
156041
+ } else if (value.kind === 'ArrayExpression') {
156042
+ context.addArrayExpression(lvalue.identifier.id, value);
156043
+ }
156044
+ }
156045
+ block.instructions = rewriteInstructions(rewriteInstrs, block.instructions);
156046
+ block.instructions = deleteInstructions(deleteInstrs, block.instructions);
156047
+ if (rewriteInstrs.size > 0 || deleteInstrs.size > 0) {
156048
+ hasRewrite = true;
156049
+ fn.env.hasFireRewrite = true;
156050
+ }
156051
+ }
156052
+ if (hasRewrite) {
156053
+ markInstructionIds(fn.body);
156054
+ }
156055
+ }
156056
+ function visitFunctionExpressionAndPropagateFireDependencies(
156057
+ fnExpr,
156058
+ context,
156059
+ enteringUseEffect
156060
+ ) {
156061
+ let withScope = enteringUseEffect
156062
+ ? context.withUseEffectLambdaScope.bind(context)
156063
+ : context.withFunctionScope.bind(context);
156064
+ const calleesCapturedByFnExpression = withScope(() =>
156065
+ replaceFireFunctions(fnExpr.loweredFunc.func, context)
156066
+ );
156067
+ const loadLocalsToDepLoads = new Map();
156068
+ for (const dep of fnExpr.loweredFunc.dependencies) {
156069
+ const loadLocal = context.getLoadLocalInstr(dep.identifier.id);
156070
+ if (loadLocal != null) {
156071
+ loadLocalsToDepLoads.set(loadLocal.place.identifier.id, loadLocal);
156072
+ }
156073
+ }
156074
+ const replacedCallees = new Map();
156075
+ for (const [
156076
+ calleeIdentifierId,
156077
+ loadedFireFunctionBindingPlace,
156078
+ ] of calleesCapturedByFnExpression.entries()) {
156079
+ const loadLocal = loadLocalsToDepLoads.get(calleeIdentifierId);
156080
+ if (loadLocal == null) {
156081
+ context.pushError({
156082
+ loc: fnExpr.loc,
156083
+ description: null,
156084
+ severity: exports.ErrorSeverity.Invariant,
156085
+ reason:
156086
+ '[InsertFire] No loadLocal found for fire call argument for lambda',
156087
+ suggestions: null,
156088
+ });
156089
+ continue;
156090
+ }
156091
+ const oldPlaceId = loadLocal.place.identifier.id;
156092
+ loadLocal.place = Object.assign(
156093
+ {},
156094
+ loadedFireFunctionBindingPlace.fireFunctionBinding
156095
+ );
156096
+ replacedCallees.set(
156097
+ oldPlaceId,
156098
+ loadedFireFunctionBindingPlace.fireFunctionBinding
156099
+ );
156100
+ }
156101
+ for (
156102
+ let contextIdx = 0;
156103
+ contextIdx < fnExpr.loweredFunc.func.context.length;
156104
+ contextIdx++
156105
+ ) {
156106
+ const contextItem = fnExpr.loweredFunc.func.context[contextIdx];
156107
+ const replacedCallee = replacedCallees.get(contextItem.identifier.id);
156108
+ if (replacedCallee != null) {
156109
+ fnExpr.loweredFunc.func.context[contextIdx] = replacedCallee;
156110
+ }
156111
+ }
156112
+ context.mergeCalleesFromInnerScope(calleesCapturedByFnExpression);
156113
+ return calleesCapturedByFnExpression;
156114
+ }
156115
+ function* eachReachablePlace(fn) {
156116
+ for (const [, block] of fn.body.blocks) {
156117
+ for (const instr of block.instructions) {
156118
+ if (
156119
+ instr.value.kind === 'FunctionExpression' ||
156120
+ instr.value.kind === 'ObjectMethod'
156121
+ ) {
156122
+ yield* eachReachablePlace(instr.value.loweredFunc.func);
156123
+ } else {
156124
+ yield* eachInstructionOperand(instr);
156125
+ }
156126
+ }
156127
+ }
156128
+ }
156129
+ function ensureNoRemainingCalleeCaptures(fn, context, capturedCallees) {
156130
+ var _a;
156131
+ for (const place of eachReachablePlace(fn)) {
156132
+ const calleeInfo = capturedCallees.get(place.identifier.id);
156133
+ if (calleeInfo != null) {
156134
+ const calleeName =
156135
+ ((_a = calleeInfo.capturedCalleeIdentifier.name) === null ||
156136
+ _a === void 0
156137
+ ? void 0
156138
+ : _a.kind) === 'named'
156139
+ ? calleeInfo.capturedCalleeIdentifier.name.value
156140
+ : '<unknown>';
156141
+ context.pushError({
156142
+ loc: place.loc,
156143
+ description: `All uses of ${calleeName} must be either used with a fire() call in this effect or not used with a fire() call at all. ${calleeName} was used with fire() on line ${printSourceLocationLine(calleeInfo.fireLoc)} in this effect`,
156144
+ severity: exports.ErrorSeverity.InvalidReact,
156145
+ reason: CANNOT_COMPILE_FIRE,
156146
+ suggestions: null,
156147
+ });
156148
+ }
156149
+ }
156150
+ }
156151
+ function ensureNoMoreFireUses(fn, context) {
156152
+ for (const place of eachReachablePlace(fn)) {
156153
+ if (
156154
+ place.identifier.type.kind === 'Function' &&
156155
+ place.identifier.type.shapeId === BuiltInFireId
156156
+ ) {
156157
+ context.pushError({
156158
+ loc: place.identifier.loc,
156159
+ description: 'Cannot use `fire` outside of a useEffect function',
156160
+ severity: exports.ErrorSeverity.Invariant,
156161
+ reason: CANNOT_COMPILE_FIRE,
156162
+ suggestions: null,
156163
+ });
156164
+ }
156165
+ }
156166
+ }
156167
+ function makeLoadUseFireInstruction(env) {
156168
+ const useFirePlace = createTemporaryPlace(env, GeneratedSource);
156169
+ useFirePlace.effect = exports.Effect.Read;
156170
+ useFirePlace.identifier.type = DefaultNonmutatingHook;
156171
+ const instrValue = {
156172
+ kind: 'LoadGlobal',
156173
+ binding: {
156174
+ kind: 'ImportSpecifier',
156175
+ name: 'useFire',
156176
+ module: 'react',
156177
+ imported: 'useFire',
156178
+ },
156179
+ loc: GeneratedSource,
156180
+ };
156181
+ return {
156182
+ id: makeInstructionId(0),
156183
+ value: instrValue,
156184
+ lvalue: Object.assign({}, useFirePlace),
156185
+ loc: GeneratedSource,
156186
+ };
156187
+ }
156188
+ function makeLoadFireCalleeInstruction(env, fireCalleeIdentifier) {
156189
+ const loadedFireCallee = createTemporaryPlace(env, GeneratedSource);
156190
+ const fireCallee = {
156191
+ kind: 'Identifier',
156192
+ identifier: fireCalleeIdentifier,
156193
+ reactive: false,
156194
+ effect: exports.Effect.Unknown,
156195
+ loc: fireCalleeIdentifier.loc,
156196
+ };
156197
+ return {
156198
+ id: makeInstructionId(0),
156199
+ value: {
156200
+ kind: 'LoadLocal',
156201
+ loc: GeneratedSource,
156202
+ place: Object.assign({}, fireCallee),
156203
+ },
156204
+ lvalue: Object.assign({}, loadedFireCallee),
156205
+ loc: GeneratedSource,
156206
+ };
156207
+ }
156208
+ function makeCallUseFireInstruction(env, useFirePlace, argPlace) {
156209
+ const useFireCallResultPlace = createTemporaryPlace(env, GeneratedSource);
156210
+ useFireCallResultPlace.effect = exports.Effect.Read;
156211
+ const useFireCall = {
156212
+ kind: 'CallExpression',
156213
+ callee: Object.assign({}, useFirePlace),
156214
+ args: [argPlace],
156215
+ loc: GeneratedSource,
156216
+ };
156217
+ return {
156218
+ id: makeInstructionId(0),
156219
+ value: useFireCall,
156220
+ lvalue: Object.assign({}, useFireCallResultPlace),
156221
+ loc: GeneratedSource,
156222
+ };
156223
+ }
156224
+ function makeStoreUseFireInstruction(
156225
+ env,
156226
+ useFireCallResultPlace,
156227
+ fireFunctionBindingPlace
156228
+ ) {
156229
+ promoteTemporary(fireFunctionBindingPlace.identifier);
156230
+ const fireFunctionBindingLValuePlace = createTemporaryPlace(
156231
+ env,
156232
+ GeneratedSource
156233
+ );
156234
+ return {
156235
+ id: makeInstructionId(0),
156236
+ value: {
156237
+ kind: 'StoreLocal',
156238
+ lvalue: {
156239
+ kind: InstructionKind.Const,
156240
+ place: Object.assign({}, fireFunctionBindingPlace),
156241
+ },
156242
+ value: Object.assign({}, useFireCallResultPlace),
156243
+ type: null,
156244
+ loc: GeneratedSource,
156245
+ },
156246
+ lvalue: fireFunctionBindingLValuePlace,
156247
+ loc: GeneratedSource,
156248
+ };
156249
+ }
156250
+ class Context {
156251
+ constructor(env) {
156252
+ _Context_env.set(this, void 0);
156253
+ _Context_errors.set(this, new CompilerError());
156254
+ _Context_callExpressions.set(this, new Map());
156255
+ _Context_functionExpressions.set(this, new Map());
156256
+ _Context_loadLocals.set(this, new Map());
156257
+ _Context_fireCalleesToFireFunctions.set(this, new Map());
156258
+ _Context_calleesWithInsertedFire.set(this, new Set());
156259
+ _Context_capturedCalleeIdentifierIds.set(this, new Map());
156260
+ _Context_inUseEffectLambda.set(this, false);
156261
+ _Context_loadGlobalInstructionIds.set(this, new Map());
156262
+ _Context_arrayExpressions.set(this, new Map());
156263
+ __classPrivateFieldSet(this, _Context_env, env, 'f');
156264
+ }
156265
+ pushError(error) {
156266
+ __classPrivateFieldGet(this, _Context_errors, 'f').push(error);
156267
+ }
156268
+ withFunctionScope(fn) {
156269
+ fn();
156270
+ return __classPrivateFieldGet(
156271
+ this,
156272
+ _Context_capturedCalleeIdentifierIds,
156273
+ 'f'
156274
+ );
156275
+ }
156276
+ withUseEffectLambdaScope(fn) {
156277
+ const capturedCalleeIdentifierIds = __classPrivateFieldGet(
156278
+ this,
156279
+ _Context_capturedCalleeIdentifierIds,
156280
+ 'f'
156281
+ );
156282
+ const inUseEffectLambda = __classPrivateFieldGet(
156283
+ this,
156284
+ _Context_inUseEffectLambda,
156285
+ 'f'
156286
+ );
156287
+ __classPrivateFieldSet(
156288
+ this,
156289
+ _Context_capturedCalleeIdentifierIds,
156290
+ new Map(),
156291
+ 'f'
156292
+ );
156293
+ __classPrivateFieldSet(this, _Context_inUseEffectLambda, true, 'f');
156294
+ const resultCapturedCalleeIdentifierIds = this.withFunctionScope(fn);
156295
+ __classPrivateFieldSet(
156296
+ this,
156297
+ _Context_capturedCalleeIdentifierIds,
156298
+ capturedCalleeIdentifierIds,
156299
+ 'f'
156300
+ );
156301
+ __classPrivateFieldSet(
156302
+ this,
156303
+ _Context_inUseEffectLambda,
156304
+ inUseEffectLambda,
156305
+ 'f'
156306
+ );
156307
+ return resultCapturedCalleeIdentifierIds;
156308
+ }
156309
+ addCallExpression(id, callExpr) {
156310
+ __classPrivateFieldGet(this, _Context_callExpressions, 'f').set(
156311
+ id,
156312
+ callExpr
156313
+ );
156314
+ }
156315
+ getCallExpression(id) {
156316
+ return __classPrivateFieldGet(this, _Context_callExpressions, 'f').get(id);
156317
+ }
156318
+ addLoadLocalInstr(id, loadLocal) {
156319
+ __classPrivateFieldGet(this, _Context_loadLocals, 'f').set(id, loadLocal);
156320
+ }
156321
+ getLoadLocalInstr(id) {
156322
+ return __classPrivateFieldGet(this, _Context_loadLocals, 'f').get(id);
156323
+ }
156324
+ getOrGenerateFireFunctionBinding(callee, fireLoc) {
156325
+ const fireFunctionBinding = getOrInsertWith(
156326
+ __classPrivateFieldGet(this, _Context_fireCalleesToFireFunctions, 'f'),
156327
+ callee.identifier.id,
156328
+ () =>
156329
+ createTemporaryPlace(
156330
+ __classPrivateFieldGet(this, _Context_env, 'f'),
156331
+ GeneratedSource
156332
+ )
156333
+ );
156334
+ __classPrivateFieldGet(this, _Context_capturedCalleeIdentifierIds, 'f').set(
156335
+ callee.identifier.id,
156336
+ {
156337
+ fireFunctionBinding: fireFunctionBinding,
156338
+ capturedCalleeIdentifier: callee.identifier,
156339
+ fireLoc: fireLoc,
156340
+ }
156341
+ );
156342
+ return fireFunctionBinding;
156343
+ }
156344
+ mergeCalleesFromInnerScope(innerCallees) {
156345
+ for (const [id, calleeInfo] of innerCallees.entries()) {
156346
+ __classPrivateFieldGet(
156347
+ this,
156348
+ _Context_capturedCalleeIdentifierIds,
156349
+ 'f'
156350
+ ).set(id, calleeInfo);
156351
+ }
156352
+ }
156353
+ addCalleeWithInsertedFire(id) {
156354
+ __classPrivateFieldGet(this, _Context_calleesWithInsertedFire, 'f').add(id);
156355
+ }
156356
+ hasCalleeWithInsertedFire(id) {
156357
+ return __classPrivateFieldGet(
156358
+ this,
156359
+ _Context_calleesWithInsertedFire,
156360
+ 'f'
156361
+ ).has(id);
156362
+ }
156363
+ inUseEffectLambda() {
156364
+ return __classPrivateFieldGet(this, _Context_inUseEffectLambda, 'f');
156365
+ }
156366
+ addFunctionExpression(id, fn) {
156367
+ __classPrivateFieldGet(this, _Context_functionExpressions, 'f').set(id, fn);
156368
+ }
156369
+ getFunctionExpression(id) {
156370
+ return __classPrivateFieldGet(this, _Context_functionExpressions, 'f').get(
156371
+ id
156372
+ );
156373
+ }
156374
+ addLoadGlobalInstrId(id, instrId) {
156375
+ __classPrivateFieldGet(this, _Context_loadGlobalInstructionIds, 'f').set(
156376
+ id,
156377
+ instrId
156378
+ );
156379
+ }
156380
+ getLoadGlobalInstrId(id) {
156381
+ return __classPrivateFieldGet(
156382
+ this,
156383
+ _Context_loadGlobalInstructionIds,
156384
+ 'f'
156385
+ ).get(id);
156386
+ }
156387
+ addArrayExpression(id, array) {
156388
+ __classPrivateFieldGet(this, _Context_arrayExpressions, 'f').set(id, array);
156389
+ }
156390
+ getArrayExpression(id) {
156391
+ return __classPrivateFieldGet(this, _Context_arrayExpressions, 'f').get(id);
156392
+ }
156393
+ hasErrors() {
156394
+ return __classPrivateFieldGet(this, _Context_errors, 'f').hasErrors();
156395
+ }
156396
+ throwIfErrorsFound() {
156397
+ if (this.hasErrors())
156398
+ throw __classPrivateFieldGet(this, _Context_errors, 'f');
156399
+ }
156400
+ }
156401
+ (_Context_env = new WeakMap()),
156402
+ (_Context_errors = new WeakMap()),
156403
+ (_Context_callExpressions = new WeakMap()),
156404
+ (_Context_functionExpressions = new WeakMap()),
156405
+ (_Context_loadLocals = new WeakMap()),
156406
+ (_Context_fireCalleesToFireFunctions = new WeakMap()),
156407
+ (_Context_calleesWithInsertedFire = new WeakMap()),
156408
+ (_Context_capturedCalleeIdentifierIds = new WeakMap()),
156409
+ (_Context_inUseEffectLambda = new WeakMap()),
156410
+ (_Context_loadGlobalInstructionIds = new WeakMap()),
156411
+ (_Context_arrayExpressions = new WeakMap());
156412
+ function deleteInstructions(deleteInstrs, instructions) {
156413
+ if (deleteInstrs.size > 0) {
156414
+ const newInstrs = instructions.filter(instr => !deleteInstrs.has(instr.id));
156415
+ return newInstrs;
156416
+ }
156417
+ return instructions;
156418
+ }
156419
+ function rewriteInstructions(rewriteInstrs, instructions) {
156420
+ if (rewriteInstrs.size > 0) {
156421
+ const newInstrs = [];
156422
+ for (const instr of instructions) {
156423
+ const newInstrsAtId = rewriteInstrs.get(instr.id);
156424
+ if (newInstrsAtId != null) {
156425
+ newInstrs.push(...newInstrsAtId, instr);
156426
+ } else {
156427
+ newInstrs.push(instr);
156428
+ }
156429
+ }
156430
+ return newInstrs;
156431
+ }
156432
+ return instructions;
156433
+ }
156434
+ function run(
157260
156435
  func,
157261
156436
  config,
157262
156437
  fnType,
@@ -157265,6 +156440,7 @@ function* run(
157265
156440
  filename,
157266
156441
  code
157267
156442
  ) {
156443
+ var _a, _b;
157268
156444
  const contextIdentifiers = findContextIdentifiers(func);
157269
156445
  const env = new Environment(
157270
156446
  func.scope,
@@ -157276,19 +156452,30 @@ function* run(
157276
156452
  code,
157277
156453
  useMemoCacheIdentifier
157278
156454
  );
157279
- yield log({
157280
- kind: 'debug',
157281
- name: 'EnvironmentConfig',
157282
- value: prettyFormat$1(env.config),
157283
- });
157284
- const ast = yield* runWithEnvironment(func, env);
157285
- return ast;
156455
+ (_b =
156456
+ (_a = env.logger) === null || _a === void 0 ? void 0 : _a.debugLogIRs) ===
156457
+ null || _b === void 0
156458
+ ? void 0
156459
+ : _b.call(_a, {
156460
+ kind: 'debug',
156461
+ name: 'EnvironmentConfig',
156462
+ value: prettyFormat$1(env.config),
156463
+ });
156464
+ return runWithEnvironment(func, env);
157286
156465
  }
157287
- function* runWithEnvironment(func, env) {
156466
+ function runWithEnvironment(func, env) {
156467
+ const log = value => {
156468
+ var _a, _b;
156469
+ (_b =
156470
+ (_a = env.logger) === null || _a === void 0 ? void 0 : _a.debugLogIRs) ===
156471
+ null || _b === void 0
156472
+ ? void 0
156473
+ : _b.call(_a, value);
156474
+ };
157288
156475
  const hir = lower$1(func, env).unwrap();
157289
- yield log({kind: 'hir', name: 'HIR', value: hir});
156476
+ log({kind: 'hir', name: 'HIR', value: hir});
157290
156477
  pruneMaybeThrows(hir);
157291
- yield log({kind: 'hir', name: 'PruneMaybeThrows', value: hir});
156478
+ log({kind: 'hir', name: 'PruneMaybeThrows', value: hir});
157292
156479
  validateContextVariableLValues(hir);
157293
156480
  validateUseMemo(hir);
157294
156481
  if (
@@ -157297,51 +156484,57 @@ function* runWithEnvironment(func, env) {
157297
156484
  !env.config.enableChangeDetectionForDebugging
157298
156485
  ) {
157299
156486
  dropManualMemoization(hir);
157300
- yield log({kind: 'hir', name: 'DropManualMemoization', value: hir});
156487
+ log({kind: 'hir', name: 'DropManualMemoization', value: hir});
157301
156488
  }
157302
156489
  inlineImmediatelyInvokedFunctionExpressions(hir);
157303
- yield log({
156490
+ log({
157304
156491
  kind: 'hir',
157305
156492
  name: 'InlineImmediatelyInvokedFunctionExpressions',
157306
156493
  value: hir,
157307
156494
  });
157308
156495
  mergeConsecutiveBlocks(hir);
157309
- yield log({kind: 'hir', name: 'MergeConsecutiveBlocks', value: hir});
156496
+ log({kind: 'hir', name: 'MergeConsecutiveBlocks', value: hir});
157310
156497
  assertConsistentIdentifiers(hir);
157311
156498
  assertTerminalSuccessorsExist(hir);
157312
156499
  enterSSA(hir);
157313
- yield log({kind: 'hir', name: 'SSA', value: hir});
156500
+ log({kind: 'hir', name: 'SSA', value: hir});
157314
156501
  eliminateRedundantPhi(hir);
157315
- yield log({kind: 'hir', name: 'EliminateRedundantPhi', value: hir});
156502
+ log({kind: 'hir', name: 'EliminateRedundantPhi', value: hir});
157316
156503
  assertConsistentIdentifiers(hir);
157317
156504
  constantPropagation(hir);
157318
- yield log({kind: 'hir', name: 'ConstantPropagation', value: hir});
156505
+ log({kind: 'hir', name: 'ConstantPropagation', value: hir});
157319
156506
  inferTypes(hir);
157320
- yield log({kind: 'hir', name: 'InferTypes', value: hir});
156507
+ log({kind: 'hir', name: 'InferTypes', value: hir});
157321
156508
  if (env.config.validateHooksUsage) {
157322
156509
  validateHooksUsage(hir);
157323
156510
  }
156511
+ if (env.config.enableFire) {
156512
+ transformFire(hir);
156513
+ log({kind: 'hir', name: 'TransformFire', value: hir});
156514
+ }
157324
156515
  if (env.config.validateNoCapitalizedCalls) {
157325
156516
  validateNoCapitalizedCalls(hir);
157326
156517
  }
157327
156518
  if (env.config.lowerContextAccess) {
157328
156519
  lowerContextAccess(hir, env.config.lowerContextAccess);
157329
156520
  }
156521
+ optimizePropsMethodCalls(hir);
156522
+ log({kind: 'hir', name: 'OptimizePropsMethodCalls', value: hir});
157330
156523
  analyseFunctions(hir);
157331
- yield log({kind: 'hir', name: 'AnalyseFunctions', value: hir});
156524
+ log({kind: 'hir', name: 'AnalyseFunctions', value: hir});
157332
156525
  inferReferenceEffects(hir);
157333
- yield log({kind: 'hir', name: 'InferReferenceEffects', value: hir});
156526
+ log({kind: 'hir', name: 'InferReferenceEffects', value: hir});
157334
156527
  validateLocalsNotReassignedAfterRender(hir);
157335
156528
  deadCodeElimination(hir);
157336
- yield log({kind: 'hir', name: 'DeadCodeElimination', value: hir});
156529
+ log({kind: 'hir', name: 'DeadCodeElimination', value: hir});
157337
156530
  if (env.config.enableInstructionReordering) {
157338
156531
  instructionReordering(hir);
157339
- yield log({kind: 'hir', name: 'InstructionReordering', value: hir});
156532
+ log({kind: 'hir', name: 'InstructionReordering', value: hir});
157340
156533
  }
157341
156534
  pruneMaybeThrows(hir);
157342
- yield log({kind: 'hir', name: 'PruneMaybeThrows', value: hir});
156535
+ log({kind: 'hir', name: 'PruneMaybeThrows', value: hir});
157343
156536
  inferMutableRanges(hir);
157344
- yield log({kind: 'hir', name: 'InferMutableRanges', value: hir});
156537
+ log({kind: 'hir', name: 'InferMutableRanges', value: hir});
157345
156538
  if (env.config.assertValidMutableRanges) {
157346
156539
  assertValidMutableRanges(hir);
157347
156540
  }
@@ -157358,157 +156551,125 @@ function* runWithEnvironment(func, env) {
157358
156551
  validateNoJSXInTryStatement(hir);
157359
156552
  }
157360
156553
  inferReactivePlaces(hir);
157361
- yield log({kind: 'hir', name: 'InferReactivePlaces', value: hir});
156554
+ log({kind: 'hir', name: 'InferReactivePlaces', value: hir});
157362
156555
  rewriteInstructionKindsBasedOnReassignment(hir);
157363
- yield log({
156556
+ log({
157364
156557
  kind: 'hir',
157365
156558
  name: 'RewriteInstructionKindsBasedOnReassignment',
157366
156559
  value: hir,
157367
156560
  });
157368
156561
  propagatePhiTypes(hir);
157369
- yield log({kind: 'hir', name: 'PropagatePhiTypes', value: hir});
156562
+ log({kind: 'hir', name: 'PropagatePhiTypes', value: hir});
157370
156563
  inferReactiveScopeVariables(hir);
157371
- yield log({kind: 'hir', name: 'InferReactiveScopeVariables', value: hir});
156564
+ log({kind: 'hir', name: 'InferReactiveScopeVariables', value: hir});
157372
156565
  const fbtOperands = memoizeFbtAndMacroOperandsInSameScope(hir);
157373
- yield log({
157374
- kind: 'hir',
157375
- name: 'MemoizeFbtAndMacroOperandsInSameScope',
157376
- value: hir,
157377
- });
156566
+ log({kind: 'hir', name: 'MemoizeFbtAndMacroOperandsInSameScope', value: hir});
157378
156567
  if (env.config.enableJsxOutlining) {
157379
156568
  outlineJSX(hir);
157380
156569
  }
157381
156570
  if (env.config.enableFunctionOutlining) {
157382
156571
  outlineFunctions(hir, fbtOperands);
157383
- yield log({kind: 'hir', name: 'OutlineFunctions', value: hir});
156572
+ log({kind: 'hir', name: 'OutlineFunctions', value: hir});
157384
156573
  }
157385
156574
  alignMethodCallScopes(hir);
157386
- yield log({kind: 'hir', name: 'AlignMethodCallScopes', value: hir});
156575
+ log({kind: 'hir', name: 'AlignMethodCallScopes', value: hir});
157387
156576
  alignObjectMethodScopes(hir);
157388
- yield log({kind: 'hir', name: 'AlignObjectMethodScopes', value: hir});
156577
+ log({kind: 'hir', name: 'AlignObjectMethodScopes', value: hir});
157389
156578
  pruneUnusedLabelsHIR(hir);
157390
- yield log({kind: 'hir', name: 'PruneUnusedLabelsHIR', value: hir});
156579
+ log({kind: 'hir', name: 'PruneUnusedLabelsHIR', value: hir});
157391
156580
  alignReactiveScopesToBlockScopesHIR(hir);
157392
- yield log({
157393
- kind: 'hir',
157394
- name: 'AlignReactiveScopesToBlockScopesHIR',
157395
- value: hir,
157396
- });
156581
+ log({kind: 'hir', name: 'AlignReactiveScopesToBlockScopesHIR', value: hir});
157397
156582
  mergeOverlappingReactiveScopesHIR(hir);
157398
- yield log({
157399
- kind: 'hir',
157400
- name: 'MergeOverlappingReactiveScopesHIR',
157401
- value: hir,
157402
- });
156583
+ log({kind: 'hir', name: 'MergeOverlappingReactiveScopesHIR', value: hir});
157403
156584
  assertValidBlockNesting(hir);
157404
156585
  buildReactiveScopeTerminalsHIR(hir);
157405
- yield log({kind: 'hir', name: 'BuildReactiveScopeTerminalsHIR', value: hir});
156586
+ log({kind: 'hir', name: 'BuildReactiveScopeTerminalsHIR', value: hir});
157406
156587
  assertValidBlockNesting(hir);
157407
156588
  flattenReactiveLoopsHIR(hir);
157408
- yield log({kind: 'hir', name: 'FlattenReactiveLoopsHIR', value: hir});
156589
+ log({kind: 'hir', name: 'FlattenReactiveLoopsHIR', value: hir});
157409
156590
  flattenScopesWithHooksOrUseHIR(hir);
157410
- yield log({kind: 'hir', name: 'FlattenScopesWithHooksOrUseHIR', value: hir});
156591
+ log({kind: 'hir', name: 'FlattenScopesWithHooksOrUseHIR', value: hir});
157411
156592
  assertTerminalSuccessorsExist(hir);
157412
156593
  assertTerminalPredsExist(hir);
157413
156594
  propagateScopeDependenciesHIR(hir);
157414
- yield log({kind: 'hir', name: 'PropagateScopeDependenciesHIR', value: hir});
156595
+ log({kind: 'hir', name: 'PropagateScopeDependenciesHIR', value: hir});
157415
156596
  if (env.config.inferEffectDependencies) {
157416
156597
  inferEffectDependencies(hir);
157417
156598
  }
157418
156599
  if (env.config.inlineJsxTransform) {
157419
156600
  inlineJsxTransform(hir, env.config.inlineJsxTransform);
157420
- yield log({kind: 'hir', name: 'inlineJsxTransform', value: hir});
156601
+ log({kind: 'hir', name: 'inlineJsxTransform', value: hir});
157421
156602
  }
157422
156603
  const reactiveFunction = buildReactiveFunction(hir);
157423
- yield log({
156604
+ log({
157424
156605
  kind: 'reactive',
157425
156606
  name: 'BuildReactiveFunction',
157426
156607
  value: reactiveFunction,
157427
156608
  });
157428
156609
  assertWellFormedBreakTargets(reactiveFunction);
157429
156610
  pruneUnusedLabels(reactiveFunction);
157430
- yield log({
157431
- kind: 'reactive',
157432
- name: 'PruneUnusedLabels',
157433
- value: reactiveFunction,
157434
- });
156611
+ log({kind: 'reactive', name: 'PruneUnusedLabels', value: reactiveFunction});
157435
156612
  assertScopeInstructionsWithinScopes(reactiveFunction);
157436
156613
  pruneNonEscapingScopes(reactiveFunction);
157437
- yield log({
156614
+ log({
157438
156615
  kind: 'reactive',
157439
156616
  name: 'PruneNonEscapingScopes',
157440
156617
  value: reactiveFunction,
157441
156618
  });
157442
156619
  pruneNonReactiveDependencies(reactiveFunction);
157443
- yield log({
156620
+ log({
157444
156621
  kind: 'reactive',
157445
156622
  name: 'PruneNonReactiveDependencies',
157446
156623
  value: reactiveFunction,
157447
156624
  });
157448
156625
  pruneUnusedScopes(reactiveFunction);
157449
- yield log({
157450
- kind: 'reactive',
157451
- name: 'PruneUnusedScopes',
157452
- value: reactiveFunction,
157453
- });
156626
+ log({kind: 'reactive', name: 'PruneUnusedScopes', value: reactiveFunction});
157454
156627
  mergeReactiveScopesThatInvalidateTogether(reactiveFunction);
157455
- yield log({
156628
+ log({
157456
156629
  kind: 'reactive',
157457
156630
  name: 'MergeReactiveScopesThatInvalidateTogether',
157458
156631
  value: reactiveFunction,
157459
156632
  });
157460
156633
  pruneAlwaysInvalidatingScopes(reactiveFunction);
157461
- yield log({
156634
+ log({
157462
156635
  kind: 'reactive',
157463
156636
  name: 'PruneAlwaysInvalidatingScopes',
157464
156637
  value: reactiveFunction,
157465
156638
  });
157466
156639
  if (env.config.enableChangeDetectionForDebugging != null) {
157467
156640
  pruneInitializationDependencies(reactiveFunction);
157468
- yield log({
156641
+ log({
157469
156642
  kind: 'reactive',
157470
156643
  name: 'PruneInitializationDependencies',
157471
156644
  value: reactiveFunction,
157472
156645
  });
157473
156646
  }
157474
156647
  propagateEarlyReturns(reactiveFunction);
157475
- yield log({
156648
+ log({
157476
156649
  kind: 'reactive',
157477
156650
  name: 'PropagateEarlyReturns',
157478
156651
  value: reactiveFunction,
157479
156652
  });
157480
156653
  pruneUnusedLValues(reactiveFunction);
157481
- yield log({
157482
- kind: 'reactive',
157483
- name: 'PruneUnusedLValues',
157484
- value: reactiveFunction,
157485
- });
156654
+ log({kind: 'reactive', name: 'PruneUnusedLValues', value: reactiveFunction});
157486
156655
  promoteUsedTemporaries(reactiveFunction);
157487
- yield log({
156656
+ log({
157488
156657
  kind: 'reactive',
157489
156658
  name: 'PromoteUsedTemporaries',
157490
156659
  value: reactiveFunction,
157491
156660
  });
157492
156661
  extractScopeDeclarationsFromDestructuring(reactiveFunction);
157493
- yield log({
156662
+ log({
157494
156663
  kind: 'reactive',
157495
156664
  name: 'ExtractScopeDeclarationsFromDestructuring',
157496
156665
  value: reactiveFunction,
157497
156666
  });
157498
156667
  stabilizeBlockIds(reactiveFunction);
157499
- yield log({
157500
- kind: 'reactive',
157501
- name: 'StabilizeBlockIds',
157502
- value: reactiveFunction,
157503
- });
156668
+ log({kind: 'reactive', name: 'StabilizeBlockIds', value: reactiveFunction});
157504
156669
  const uniqueIdentifiers = renameVariables(reactiveFunction);
157505
- yield log({
157506
- kind: 'reactive',
157507
- name: 'RenameVariables',
157508
- value: reactiveFunction,
157509
- });
156670
+ log({kind: 'reactive', name: 'RenameVariables', value: reactiveFunction});
157510
156671
  pruneHoistedContexts(reactiveFunction);
157511
- yield log({
156672
+ log({
157512
156673
  kind: 'reactive',
157513
156674
  name: 'PruneHoistedContexts',
157514
156675
  value: reactiveFunction,
@@ -157526,9 +156687,9 @@ function* runWithEnvironment(func, env) {
157526
156687
  uniqueIdentifiers: uniqueIdentifiers,
157527
156688
  fbtOperands: fbtOperands,
157528
156689
  }).unwrap();
157529
- yield log({kind: 'ast', name: 'Codegen', value: ast});
156690
+ log({kind: 'ast', name: 'Codegen', value: ast});
157530
156691
  for (const outlined of ast.outlined) {
157531
- yield log({kind: 'ast', name: 'Codegen (outlined)', value: outlined.fn});
156692
+ log({kind: 'ast', name: 'Codegen (outlined)', value: outlined.fn});
157532
156693
  }
157533
156694
  if (env.config.throwUnknownException__testonly) {
157534
156695
  throw new Error('unexpected error');
@@ -157544,7 +156705,7 @@ function compileFn(
157544
156705
  filename,
157545
156706
  code
157546
156707
  ) {
157547
- let generator = run(
156708
+ return run(
157548
156709
  func,
157549
156710
  config,
157550
156711
  fnType,
@@ -157553,40 +156714,6 @@ function compileFn(
157553
156714
  filename,
157554
156715
  code
157555
156716
  );
157556
- while (true) {
157557
- const next = generator.next();
157558
- if (next.done) {
157559
- return next.value;
157560
- }
157561
- }
157562
- }
157563
- function log(value) {
157564
- switch (value.kind) {
157565
- case 'ast': {
157566
- logCodegenFunction(value.name, value.value);
157567
- break;
157568
- }
157569
- case 'hir': {
157570
- logHIRFunction(value.name, value.value);
157571
- break;
157572
- }
157573
- case 'reactive': {
157574
- logReactiveFunction(value.name, value.value);
157575
- break;
157576
- }
157577
- case 'debug': {
157578
- logDebug(value.name, value.value);
157579
- break;
157580
- }
157581
- default: {
157582
- assertExhaustive(value, 'Unexpected compilation kind');
157583
- }
157584
- }
157585
- return value;
157586
- }
157587
- function* runPlayground(func, config, fnType) {
157588
- const ast = yield* run(func, config, fnType, '_c', null, null, null);
157589
- return ast;
157590
156717
  }
157591
156718
  function isComponentDeclaration(node) {
157592
156719
  return Object.prototype.hasOwnProperty.call(node, '__componentDeclaration');
@@ -158136,6 +157263,13 @@ function compileProgram(program, pass) {
158136
157263
  if (environment.enableChangeDetectionForDebugging != null) {
158137
157264
  externalFunctions.push(environment.enableChangeDetectionForDebugging);
158138
157265
  }
157266
+ const hasFireRewrite = compiledFns.some(c => c.compiledFn.hasFireRewrite);
157267
+ if (environment.enableFire && hasFireRewrite) {
157268
+ externalFunctions.push({
157269
+ source: getReactCompilerRuntimeModule(pass.opts),
157270
+ importSpecifierName: 'useFire',
157271
+ });
157272
+ }
158139
157273
  } catch (err) {
158140
157274
  handleError(err, pass, null);
158141
157275
  return;
@@ -158605,7 +157739,10 @@ function BabelPluginReactCompiler(_babel) {
158605
157739
  ) {
158606
157740
  opts = injectReanimatedFlag(opts);
158607
157741
  }
158608
- if (isDev) {
157742
+ if (
157743
+ opts.environment.enableResetCacheOnSourceFileChanges !== false &&
157744
+ isDev
157745
+ ) {
158609
157746
  opts = Object.assign(Object.assign({}, opts), {
158610
157747
  environment: Object.assign(Object.assign({}, opts.environment), {
158611
157748
  enableResetCacheOnSourceFileChanges: true,
@@ -158668,7 +157805,5 @@ exports.parseConfigPragmaForTests = parseConfigPragmaForTests;
158668
157805
  exports.parsePluginOptions = parsePluginOptions;
158669
157806
  exports.printHIR = printHIR;
158670
157807
  exports.printReactiveFunction = printReactiveFunction;
158671
- exports.run = run;
158672
157808
  exports.runBabelPluginReactCompiler = runBabelPluginReactCompiler;
158673
- exports.runPlayground = runPlayground;
158674
157809
  exports.validateEnvironmentConfig = validateEnvironmentConfig;