@uwdata/vgplot 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vgplot.js CHANGED
@@ -12819,8 +12819,7 @@ var castInteger = (expr) => cast(expr, "INTEGER");
12819
12819
 
12820
12820
  // ../sql/src/datetime.js
12821
12821
  var epoch_ms = (expr) => {
12822
- const d = asColumn(expr);
12823
- return sql`(1000 * (epoch(${d}) - second(${d})) + millisecond(${d}))::DOUBLE`;
12822
+ return sql`epoch_ms(${asColumn(expr)})`;
12824
12823
  };
12825
12824
  var dateMonth = (expr) => {
12826
12825
  const d = asColumn(expr);
@@ -13241,6 +13240,89 @@ function isDoubleQuoted(s2) {
13241
13240
  return s2[0] === '"' && s2[s2.length - 1] === '"';
13242
13241
  }
13243
13242
 
13243
+ // ../sql/src/scales.js
13244
+ var identity = (x4) => x4;
13245
+ function scaleLinear() {
13246
+ return {
13247
+ apply: identity,
13248
+ invert: identity,
13249
+ sqlApply: asColumn,
13250
+ sqlInvert: identity
13251
+ };
13252
+ }
13253
+ function scaleLog({ base } = {}) {
13254
+ if (base == null || base === Math.E) {
13255
+ return {
13256
+ apply: Math.log,
13257
+ invert: Math.exp,
13258
+ sqlApply: (c4) => sql`LN(${asColumn(c4)})`,
13259
+ sqlInvert: (c4) => sql`EXP(${c4})`
13260
+ };
13261
+ } else if (base === 10) {
13262
+ return {
13263
+ apply: Math.log10,
13264
+ invert: (x4) => Math.pow(10, x4),
13265
+ sqlApply: (c4) => sql`LOG(${asColumn(c4)})`,
13266
+ sqlInvert: (c4) => sql`POW(10, ${c4})`
13267
+ };
13268
+ } else {
13269
+ const b2 = +base;
13270
+ return {
13271
+ apply: (x4) => Math.log(x4) / Math.log(b2),
13272
+ invert: (x4) => Math.pow(b2, x4),
13273
+ sqlApply: (c4) => sql`LN(${asColumn(c4)}) / LN(${b2})`,
13274
+ sqlInvert: (c4) => sql`POW(${b2}, ${c4})`
13275
+ };
13276
+ }
13277
+ }
13278
+ function scaleSymlog({ constant: constant2 = 1 } = {}) {
13279
+ const _2 = +constant2;
13280
+ return {
13281
+ apply: (x4) => Math.sign(x4) * Math.log1p(Math.abs(x4)),
13282
+ invert: (x4) => Math.sign(x4) * Math.exp(Math.abs(x4) - _2),
13283
+ sqlApply: (c4) => (c4 = asColumn(c4), sql`SIGN(${c4}) * LN(${_2} + ABS(${c4}))`),
13284
+ sqlInvert: (c4) => sql`SIGN(${c4}) * (EXP(ABS(${c4})) - ${_2})`
13285
+ };
13286
+ }
13287
+ function scaleSqrt() {
13288
+ return {
13289
+ apply: (x4) => Math.sign(x4) * Math.sqrt(Math.abs(x4)),
13290
+ invert: (x4) => Math.sign(x4) * x4 * x4,
13291
+ sqlApply: (c4) => (c4 = asColumn(c4), sql`SIGN(${c4}) * SQRT(ABS(${c4}))`),
13292
+ sqlInvert: (c4) => sql`SIGN(${c4}) * (${c4}) ** 2`
13293
+ };
13294
+ }
13295
+ function scalePow({ exponent = 1 } = {}) {
13296
+ const e = +exponent;
13297
+ return {
13298
+ apply: (x4) => Math.sign(x4) * Math.pow(Math.abs(x4), e),
13299
+ invert: (x4) => Math.sign(x4) * Math.pow(Math.abs(x4), 1 / e),
13300
+ sqlApply: (c4) => (c4 = asColumn(c4), sql`SIGN(${c4}) * POW(ABS(${c4}), ${e})`),
13301
+ sqlInvert: (c4) => sql`SIGN(${c4}) * POW(ABS(${c4}), 1/${e})`
13302
+ };
13303
+ }
13304
+ function scaleTime() {
13305
+ return {
13306
+ apply: (x4) => +x4,
13307
+ invert: (x4) => new Date(x4),
13308
+ sqlApply: (c4) => c4 instanceof Date ? +c4 : epoch_ms(asColumn(c4)),
13309
+ sqlInvert: identity
13310
+ };
13311
+ }
13312
+ var scales = {
13313
+ linear: scaleLinear,
13314
+ log: scaleLog,
13315
+ symlog: scaleSymlog,
13316
+ sqrt: scaleSqrt,
13317
+ pow: scalePow,
13318
+ time: scaleTime,
13319
+ utc: scaleTime
13320
+ };
13321
+ function scaleTransform(options) {
13322
+ const scale3 = scales[options.type];
13323
+ return scale3 ? { ...options, ...scale3(options) } : null;
13324
+ }
13325
+
13244
13326
  // ../sql/src/load/create.js
13245
13327
  function create(name2, query, {
13246
13328
  replace = false,
@@ -13482,7 +13564,6 @@ function fnv_mix(a3) {
13482
13564
  }
13483
13565
 
13484
13566
  // ../core/src/DataCubeIndexer.js
13485
- var identity = (x4) => x4;
13486
13567
  var DataCubeIndexer = class {
13487
13568
  /**
13488
13569
  *
@@ -13575,10 +13656,10 @@ function getActiveView(clause) {
13575
13656
  let columns = clause.predicate?.columns;
13576
13657
  if (!schema || !columns)
13577
13658
  return null;
13578
- const { type: type2, scales, pixelSize = 1 } = schema;
13659
+ const { type: type2, scales: scales2, pixelSize = 1 } = schema;
13579
13660
  let predicate;
13580
- if (type2 === "interval" && scales) {
13581
- const bins2 = scales.map((s2) => binInterval(s2, pixelSize));
13661
+ if (type2 === "interval" && scales2) {
13662
+ const bins2 = scales2.map((s2) => binInterval(s2, pixelSize));
13582
13663
  if (bins2.some((b2) => b2 == null))
13583
13664
  return null;
13584
13665
  if (bins2.length === 1) {
@@ -13591,7 +13672,7 @@ function getActiveView(clause) {
13591
13672
  );
13592
13673
  }
13593
13674
  } else if (type2 === "point") {
13594
- predicate = identity;
13675
+ predicate = (x4) => x4;
13595
13676
  columns = Object.fromEntries(columns.map((col) => [col.toString(), col]));
13596
13677
  } else {
13597
13678
  return null;
@@ -13599,39 +13680,15 @@ function getActiveView(clause) {
13599
13680
  return { source, columns, predicate };
13600
13681
  }
13601
13682
  function binInterval(scale3, pixelSize) {
13602
- const { type: type2, domain, range: range3 } = scale3;
13603
- let lift, toSql;
13604
- switch (type2) {
13605
- case "linear":
13606
- lift = identity;
13607
- toSql = asColumn;
13608
- break;
13609
- case "log":
13610
- lift = Math.log;
13611
- toSql = (c4) => sql`LN(${asColumn(c4)})`;
13612
- break;
13613
- case "symlog":
13614
- lift = (x4) => Math.sign(x4) * Math.log1p(Math.abs(x4));
13615
- toSql = (c4) => (c4 = asColumn(c4), sql`SIGN(${c4}) * LN(1 + ABS(${c4}))`);
13616
- break;
13617
- case "sqrt":
13618
- lift = Math.sqrt;
13619
- toSql = (c4) => sql`SQRT(${asColumn(c4)})`;
13620
- break;
13621
- case "utc":
13622
- case "time":
13623
- lift = (x4) => +x4;
13624
- toSql = (c4) => c4 instanceof Date ? +c4 : epoch_ms(asColumn(c4));
13625
- break;
13683
+ const { apply: apply2, sqlApply } = scaleTransform(scale3);
13684
+ if (apply2) {
13685
+ const { domain, range: range3 } = scale3;
13686
+ const lo = apply2(Math.min(...domain));
13687
+ const hi = apply2(Math.max(...domain));
13688
+ const a3 = Math.abs(range3[1] - range3[0]) / (hi - lo) / pixelSize;
13689
+ const s2 = pixelSize === 1 ? "" : `${pixelSize}::INTEGER * `;
13690
+ return (value) => sql`${s2}FLOOR(${a3}::DOUBLE * (${sqlApply(value)} - ${lo}::DOUBLE))::INTEGER`;
13626
13691
  }
13627
- return lift ? binFunction(domain, range3, pixelSize, lift, toSql) : null;
13628
- }
13629
- function binFunction(domain, range3, pixelSize, lift, toSql) {
13630
- const lo = lift(Math.min(domain[0], domain[1]));
13631
- const hi = lift(Math.max(domain[0], domain[1]));
13632
- const a3 = Math.abs(lift(range3[1]) - lift(range3[0])) / (hi - lo) / pixelSize;
13633
- const s2 = pixelSize === 1 ? "" : `${pixelSize}::INTEGER * `;
13634
- return (value) => sql`${s2}FLOOR(${a3}::DOUBLE * (${toSql(value)} - ${lo}::DOUBLE))::INTEGER`;
13635
13692
  }
13636
13693
  var NO_INDEX = { from: NaN };
13637
13694
  function getIndexColumns(client) {
@@ -15585,8 +15642,11 @@ __export(api_exports, {
15585
15642
  centroidX: () => centroidX,
15586
15643
  centroidY: () => centroidY,
15587
15644
  circle: () => circle2,
15645
+ colorBase: () => colorBase,
15588
15646
  colorClamp: () => colorClamp,
15647
+ colorConstant: () => colorConstant2,
15589
15648
  colorDomain: () => colorDomain,
15649
+ colorExponent: () => colorExponent,
15590
15650
  colorInterpolate: () => colorInterpolate,
15591
15651
  colorLabel: () => colorLabel,
15592
15652
  colorLegend: () => colorLegend,
@@ -15595,8 +15655,8 @@ __export(api_exports, {
15595
15655
  colorPivot: () => colorPivot,
15596
15656
  colorRange: () => colorRange,
15597
15657
  colorReverse: () => colorReverse,
15598
- colorScale: () => colorScale,
15599
- colorScheme: () => colorScheme,
15658
+ colorScale: () => colorScale2,
15659
+ colorScheme: () => colorScheme2,
15600
15660
  colorSymmetric: () => colorSymmetric,
15601
15661
  colorTickFormat: () => colorTickFormat,
15602
15662
  colorZero: () => colorZero,
@@ -15630,6 +15690,7 @@ __export(api_exports, {
15630
15690
  facetMarginLeft: () => facetMarginLeft,
15631
15691
  facetMarginRight: () => facetMarginRight,
15632
15692
  facetMarginTop: () => facetMarginTop,
15693
+ first: () => first,
15633
15694
  first_value: () => first_value,
15634
15695
  frame: () => frame3,
15635
15696
  from: () => from,
@@ -15698,6 +15759,7 @@ __export(api_exports, {
15698
15759
  gt: () => gt,
15699
15760
  gte: () => gte,
15700
15761
  hconcat: () => hconcat,
15762
+ heatmap: () => heatmap,
15701
15763
  height: () => height,
15702
15764
  hexagon: () => hexagon2,
15703
15765
  hexbin: () => hexbin2,
@@ -15722,8 +15784,11 @@ __export(api_exports, {
15722
15784
  last: () => last,
15723
15785
  last_value: () => last_value,
15724
15786
  lead: () => lead,
15787
+ lengthBase: () => lengthBase,
15725
15788
  lengthClamp: () => lengthClamp,
15789
+ lengthConstant: () => lengthConstant,
15726
15790
  lengthDomain: () => lengthDomain,
15791
+ lengthExponent: () => lengthExponent,
15727
15792
  lengthNice: () => lengthNice,
15728
15793
  lengthRange: () => lengthRange,
15729
15794
  lengthScale: () => lengthScale,
@@ -15760,8 +15825,11 @@ __export(api_exports, {
15760
15825
  not: () => not,
15761
15826
  nth_value: () => nth_value,
15762
15827
  ntile: () => ntile,
15828
+ opacityBase: () => opacityBase,
15763
15829
  opacityClamp: () => opacityClamp,
15830
+ opacityConstant: () => opacityConstant,
15764
15831
  opacityDomain: () => opacityDomain,
15832
+ opacityExponent: () => opacityExponent,
15765
15833
  opacityLabel: () => opacityLabel,
15766
15834
  opacityLegend: () => opacityLegend,
15767
15835
  opacityNice: () => opacityNice,
@@ -15793,14 +15861,17 @@ __export(api_exports, {
15793
15861
  projectionRotate: () => projectionRotate,
15794
15862
  projectionType: () => projectionType,
15795
15863
  quantile: () => quantile,
15864
+ rBase: () => rBase,
15796
15865
  rClamp: () => rClamp,
15866
+ rConstant: () => rConstant,
15797
15867
  rDomain: () => rDomain,
15868
+ rExponent: () => rExponent,
15798
15869
  rNice: () => rNice,
15799
15870
  rRange: () => rRange,
15800
15871
  rScale: () => rScale,
15801
15872
  rZero: () => rZero,
15802
15873
  rank: () => rank,
15803
- raster: () => raster3,
15874
+ raster: () => raster2,
15804
15875
  rasterTile: () => rasterTile,
15805
15876
  rect: () => rect2,
15806
15877
  rectX: () => rectX2,
@@ -15846,8 +15917,11 @@ __export(api_exports, {
15846
15917
  xAriaDescription: () => xAriaDescription,
15847
15918
  xAriaLabel: () => xAriaLabel,
15848
15919
  xAxis: () => xAxis,
15920
+ xBase: () => xBase,
15849
15921
  xClamp: () => xClamp,
15922
+ xConstant: () => xConstant,
15850
15923
  xDomain: () => xDomain,
15924
+ xExponent: () => xExponent,
15851
15925
  xFontVariant: () => xFontVariant,
15852
15926
  xGrid: () => xGrid,
15853
15927
  xInset: () => xInset,
@@ -15877,8 +15951,11 @@ __export(api_exports, {
15877
15951
  yAriaDescription: () => yAriaDescription,
15878
15952
  yAriaLabel: () => yAriaLabel,
15879
15953
  yAxis: () => yAxis,
15954
+ yBase: () => yBase,
15880
15955
  yClamp: () => yClamp,
15956
+ yConstant: () => yConstant,
15881
15957
  yDomain: () => yDomain,
15958
+ yExponent: () => yExponent,
15882
15959
  yFontVariant: () => yFontVariant,
15883
15960
  yGrid: () => yGrid,
15884
15961
  yInset: () => yInset,
@@ -30437,10 +30514,10 @@ function createChannels(channels, data) {
30437
30514
  Object.entries(channels).map(([name2, channel]) => [name2, createChannel(data, channel, name2)])
30438
30515
  );
30439
30516
  }
30440
- function valueObject(channels, scales) {
30517
+ function valueObject(channels, scales2) {
30441
30518
  const values2 = Object.fromEntries(
30442
30519
  Object.entries(channels).map(([name2, { scale: scaleName, value }]) => {
30443
- const scale3 = scaleName == null ? null : scales[scaleName];
30520
+ const scale3 = scaleName == null ? null : scales2[scaleName];
30444
30521
  return [name2, scale3 == null ? value : map2(value, scale3)];
30445
30522
  })
30446
30523
  );
@@ -31242,14 +31319,14 @@ function projectionAspectRatio(projection3) {
31242
31319
  }
31243
31320
  return defaultAspectRatio;
31244
31321
  }
31245
- function applyPosition(channels, scales, { projection: projection3 }) {
31322
+ function applyPosition(channels, scales2, { projection: projection3 }) {
31246
31323
  const { x: x4, y: y4 } = channels;
31247
31324
  let position3 = {};
31248
31325
  if (x4)
31249
31326
  position3.x = x4;
31250
31327
  if (y4)
31251
31328
  position3.y = y4;
31252
- position3 = valueObject(position3, scales);
31329
+ position3 = valueObject(position3, scales2);
31253
31330
  if (projection3 && x4?.scale === "x" && y4?.scale === "y")
31254
31331
  project("x", "y", position3, projection3);
31255
31332
  if (x4)
@@ -31987,7 +32064,7 @@ function createScales(channelsByScale, {
31987
32064
  facet: { label: facetLabel2 = globalLabel } = {},
31988
32065
  ...options
31989
32066
  } = {}) {
31990
- const scales = {};
32067
+ const scales2 = {};
31991
32068
  for (const [key, channels] of channelsByScale) {
31992
32069
  const scaleOptions = options[key];
31993
32070
  const scale3 = createScale(key, channels, {
@@ -32030,17 +32107,17 @@ function createScales(channelsByScale, {
32030
32107
  scale3.insetTop = +insetTop;
32031
32108
  scale3.insetBottom = +insetBottom;
32032
32109
  }
32033
- scales[key] = scale3;
32110
+ scales2[key] = scale3;
32034
32111
  }
32035
32112
  }
32036
- return scales;
32113
+ return scales2;
32037
32114
  }
32038
32115
  function createScaleFunctions(descriptors) {
32039
- const scales = {};
32040
- const scaleFunctions = { scales };
32116
+ const scales2 = {};
32117
+ const scaleFunctions = { scales: scales2 };
32041
32118
  for (const [key, descriptor] of Object.entries(descriptors)) {
32042
32119
  const { scale: scale3, type: type2, interval: interval2, label: label2 } = descriptor;
32043
- scales[key] = exposeScale(descriptor);
32120
+ scales2[key] = exposeScale(descriptor);
32044
32121
  scaleFunctions[key] = scale3;
32045
32122
  scale3.type = type2;
32046
32123
  if (interval2 != null)
@@ -32050,14 +32127,14 @@ function createScaleFunctions(descriptors) {
32050
32127
  }
32051
32128
  return scaleFunctions;
32052
32129
  }
32053
- function autoScaleRange(scales, dimensions) {
32054
- const { x: x4, y: y4, fx, fy } = scales;
32130
+ function autoScaleRange(scales2, dimensions) {
32131
+ const { x: x4, y: y4, fx, fy } = scales2;
32055
32132
  const superdimensions = fx || fy ? outerDimensions(dimensions) : dimensions;
32056
32133
  if (fx)
32057
32134
  autoScaleRangeX(fx, superdimensions);
32058
32135
  if (fy)
32059
32136
  autoScaleRangeY(fy, superdimensions);
32060
- const subdimensions = fx || fy ? innerDimensions(scales, dimensions) : dimensions;
32137
+ const subdimensions = fx || fy ? innerDimensions(scales2, dimensions) : dimensions;
32061
32138
  if (x4)
32062
32139
  autoScaleRangeX(x4, subdimensions);
32063
32140
  if (y4)
@@ -32400,11 +32477,11 @@ function scale2(options = {}) {
32400
32477
  throw new Error("invalid scale definition; no scale found");
32401
32478
  return scale3;
32402
32479
  }
32403
- function exposeScales(scales) {
32480
+ function exposeScales(scales2) {
32404
32481
  return (key) => {
32405
32482
  if (!registry.has(key = `${key}`))
32406
32483
  throw new Error(`unknown scale: ${key}`);
32407
- return scales[key];
32484
+ return scales2[key];
32408
32485
  };
32409
32486
  }
32410
32487
  function exposeScale({ scale: scale3, type: type2, domain, range: range3, interpolate, interval: interval2, transform: transform3, percent, pivot }) {
@@ -32444,7 +32521,7 @@ function exposeScale({ scale: scale3, type: type2, domain, range: range3, interp
32444
32521
  }
32445
32522
 
32446
32523
  // ../../node_modules/@observablehq/plot/src/dimensions.js
32447
- function createDimensions(scales, marks2, options = {}) {
32524
+ function createDimensions(scales2, marks2, options = {}) {
32448
32525
  let marginTopDefault = 0.5 - offset, marginRightDefault = 0.5 + offset, marginBottomDefault = 0.5 + offset, marginLeftDefault = 0.5 - offset;
32449
32526
  for (const { marginTop: marginTop3, marginRight: marginRight3, marginBottom: marginBottom3, marginLeft: marginLeft3 } of marks2) {
32450
32527
  if (marginTop3 > marginTopDefault)
@@ -32469,7 +32546,7 @@ function createDimensions(scales, marks2, options = {}) {
32469
32546
  marginLeft2 = +marginLeft2;
32470
32547
  let {
32471
32548
  width: width2 = 640,
32472
- height: height2 = autoHeight(scales, options, {
32549
+ height: height2 = autoHeight(scales2, options, {
32473
32550
  width: width2,
32474
32551
  marginTopDefault,
32475
32552
  marginRightDefault,
@@ -32487,7 +32564,7 @@ function createDimensions(scales, marks2, options = {}) {
32487
32564
  marginBottom: marginBottom2,
32488
32565
  marginLeft: marginLeft2
32489
32566
  };
32490
- if (scales.fx || scales.fy) {
32567
+ if (scales2.fx || scales2.fy) {
32491
32568
  let {
32492
32569
  margin: facetMargin2,
32493
32570
  marginTop: facetMarginTop2 = facetMargin2 !== void 0 ? facetMargin2 : marginTop2,
@@ -32833,8 +32910,8 @@ var Mark = class {
32833
32910
  }
32834
32911
  }
32835
32912
  }
32836
- scale(channels, scales, context) {
32837
- const values2 = valueObject(channels, scales);
32913
+ scale(channels, scales2, context) {
32914
+ const values2 = valueObject(channels, scales2);
32838
32915
  if (context.projection)
32839
32916
  this.project(channels, values2, context);
32840
32917
  return values2;
@@ -32892,7 +32969,7 @@ function pointerK(kx2, ky2, { x: x4, y: y4, px, py, maxRadius = 40, channels, re
32892
32969
  // Unlike other composed transforms, the render transform must be the
32893
32970
  // outermost render function because it will re-render dynamically in
32894
32971
  // response to pointer events.
32895
- render: composeRender(function(index2, scales, values2, dimensions, context, next) {
32972
+ render: composeRender(function(index2, scales2, values2, dimensions, context, next) {
32896
32973
  context = { ...context, pointerSticky: false };
32897
32974
  const svg = context.ownerSVGElement;
32898
32975
  const { data } = context.getMarkState(this);
@@ -32900,7 +32977,7 @@ function pointerK(kx2, ky2, { x: x4, y: y4, px, py, maxRadius = 40, channels, re
32900
32977
  if (!state)
32901
32978
  states.set(svg, state = { sticky: false, roots: [], renders: [] });
32902
32979
  let renderIndex = state.renders.push(render2) - 1;
32903
- const { x: x5, y: y5, fx, fy } = scales;
32980
+ const { x: x5, y: y5, fx, fy } = scales2;
32904
32981
  let tx = fx ? fx(index2.fx) - dimensions.marginLeft : 0;
32905
32982
  let ty = fy ? fy(index2.fy) - dimensions.marginTop : 0;
32906
32983
  if (x5?.bandwidth)
@@ -32956,7 +33033,7 @@ function pointerK(kx2, ky2, { x: x4, y: y4, px, py, maxRadius = 40, channels, re
32956
33033
  const I2 = i == null ? [] : [i];
32957
33034
  if (faceted)
32958
33035
  I2.fx = index2.fx, I2.fy = index2.fy, I2.fi = index2.fi;
32959
- const r = next(I2, scales, values2, dimensions, context);
33036
+ const r = next(I2, scales2, values2, dimensions, context);
32960
33037
  if (g2) {
32961
33038
  if (faceted) {
32962
33039
  const p2 = g2.parentNode;
@@ -33328,8 +33405,8 @@ var RuleX = class extends Mark {
33328
33405
  this.insetBottom = number5(insetBottom);
33329
33406
  markers(this, options);
33330
33407
  }
33331
- render(index2, scales, channels, dimensions, context) {
33332
- const { x: x4, y: y4 } = scales;
33408
+ render(index2, scales2, channels, dimensions, context) {
33409
+ const { x: x4, y: y4 } = scales2;
33333
33410
  const { x: X3, y1: Y13, y2: Y24 } = channels;
33334
33411
  const { width: width2, height: height2, marginTop: marginTop2, marginRight: marginRight2, marginLeft: marginLeft2, marginBottom: marginBottom2 } = dimensions;
33335
33412
  const { insetTop, insetBottom } = this;
@@ -33358,8 +33435,8 @@ var RuleY = class extends Mark {
33358
33435
  this.insetLeft = number5(insetLeft);
33359
33436
  markers(this, options);
33360
33437
  }
33361
- render(index2, scales, channels, dimensions, context) {
33362
- const { x: x4, y: y4 } = scales;
33438
+ render(index2, scales2, channels, dimensions, context) {
33439
+ const { x: x4, y: y4 } = scales2;
33363
33440
  const { y: Y3, x1: X13, x2: X24 } = channels;
33364
33441
  const { width: width2, height: height2, marginTop: marginTop2, marginRight: marginRight2, marginLeft: marginLeft2, marginBottom: marginBottom2 } = dimensions;
33365
33442
  const { insetLeft, insetRight } = this;
@@ -33481,8 +33558,8 @@ var Text = class extends Mark {
33481
33558
  this.splitLines = splitter2(this);
33482
33559
  this.clipLine = clipper(this);
33483
33560
  }
33484
- render(index2, scales, channels, dimensions, context) {
33485
- const { x: x4, y: y4 } = scales;
33561
+ render(index2, scales2, channels, dimensions, context) {
33562
+ const { x: x4, y: y4 } = scales2;
33486
33563
  const { x: X3, y: Y3, rotate: R2, text: T, title: TL, fontSize: FS } = channels;
33487
33564
  const { rotate } = this;
33488
33565
  const [cx, cy] = applyFrameAnchor(this, dimensions);
@@ -33905,8 +33982,8 @@ var Vector2 = class extends Mark {
33905
33982
  this.anchor = keyword(anchor, "anchor", ["start", "middle", "end"]);
33906
33983
  this.frameAnchor = maybeFrameAnchor(frameAnchor);
33907
33984
  }
33908
- render(index2, scales, channels, dimensions, context) {
33909
- const { x: x4, y: y4 } = scales;
33985
+ render(index2, scales2, channels, dimensions, context) {
33986
+ const { x: x4, y: y4 } = scales2;
33910
33987
  const { x: X3, y: Y3, length: L2, rotate: A5 } = channels;
33911
33988
  const { length: length4, rotate, anchor, shape, r } = this;
33912
33989
  const [cx, cy] = applyFrameAnchor(this, dimensions);
@@ -34058,8 +34135,8 @@ function axisKy(k3, anchor, data, {
34058
34135
  }) : null,
34059
34136
  !isNoneish(fill) && label2 !== null ? text(
34060
34137
  [],
34061
- labelOptions({ fill, fillOpacity, ...options }, function(data2, facets, channels, scales, dimensions) {
34062
- const scale3 = scales[k3];
34138
+ labelOptions({ fill, fillOpacity, ...options }, function(data2, facets, channels, scales2, dimensions) {
34139
+ const scale3 = scales2[k3];
34063
34140
  const { marginTop: marginTop3, marginRight: marginRight3, marginBottom: marginBottom3, marginLeft: marginLeft3 } = k3 === "y" && dimensions.inset || dimensions;
34064
34141
  const cla = labelAnchor ?? (scale3.bandwidth ? "center" : "top");
34065
34142
  const clo = labelOffset ?? (anchor === "right" ? marginRight3 : marginLeft3) - 3;
@@ -34148,8 +34225,8 @@ function axisKx(k3, anchor, data, {
34148
34225
  }) : null,
34149
34226
  !isNoneish(fill) && label2 !== null ? text(
34150
34227
  [],
34151
- labelOptions({ fill, fillOpacity, ...options }, function(data2, facets, channels, scales, dimensions) {
34152
- const scale3 = scales[k3];
34228
+ labelOptions({ fill, fillOpacity, ...options }, function(data2, facets, channels, scales2, dimensions) {
34229
+ const scale3 = scales2[k3];
34153
34230
  const { marginTop: marginTop3, marginRight: marginRight3, marginBottom: marginBottom3, marginLeft: marginLeft3 } = k3 === "x" && dimensions.inset || dimensions;
34154
34231
  const cla = labelAnchor ?? (scale3.bandwidth ? "center" : "right");
34155
34232
  const clo = labelOffset ?? (anchor === "top" ? marginTop3 : marginBottom3) - 3;
@@ -34393,9 +34470,9 @@ function labelOptions({
34393
34470
  }
34394
34471
  function axisMark(mark2, k3, anchor, ariaLabel, data, options, initialize) {
34395
34472
  let channels;
34396
- function axisInitializer(data2, facets, _channels, scales, dimensions, context) {
34473
+ function axisInitializer(data2, facets, _channels, scales2, dimensions, context) {
34397
34474
  const initializeFacets = data2 == null && (k3 === "fx" || k3 === "fy");
34398
- const { [k3]: scale3 } = scales;
34475
+ const { [k3]: scale3 } = scales2;
34399
34476
  if (!scale3)
34400
34477
  throw new Error(`missing scale: ${k3}`);
34401
34478
  const domain = scale3.domain();
@@ -34682,13 +34759,13 @@ function legend(options = {}) {
34682
34759
  }
34683
34760
  throw new Error("unknown legend type; no scale found");
34684
34761
  }
34685
- function exposeLegends(scales, context, defaults23 = {}) {
34762
+ function exposeLegends(scales2, context, defaults23 = {}) {
34686
34763
  return (key, options) => {
34687
34764
  if (!legendRegistry.has(key))
34688
34765
  throw new Error(`unknown legend type: ${key}`);
34689
- if (!(key in scales))
34766
+ if (!(key in scales2))
34690
34767
  return;
34691
- return legendRegistry.get(key)(scales[key], legendOptions(context, defaults23[key], options), (key2) => scales[key2]);
34768
+ return legendRegistry.get(key)(scales2[key], legendOptions(context, defaults23[key], options), (key2) => scales2[key2]);
34692
34769
  };
34693
34770
  }
34694
34771
  function legendOptions({ className, ...context }, { label: label2, ticks: ticks2, tickFormat: tickFormat2 } = {}, options) {
@@ -34721,12 +34798,12 @@ function interpolateOpacity(color3) {
34721
34798
  const { r, g: g2, b: b2 } = rgb(color3) || rgb(0, 0, 0);
34722
34799
  return (t) => `rgba(${r},${g2},${b2},${t})`;
34723
34800
  }
34724
- function createLegends(scales, context, options) {
34801
+ function createLegends(scales2, context, options) {
34725
34802
  const legends = [];
34726
34803
  for (const [key, value] of legendRegistry) {
34727
34804
  const o = options[key];
34728
- if (o?.legend && key in scales) {
34729
- const legend3 = value(scales[key], legendOptions(context, scales[key], o), (key2) => scales[key2]);
34805
+ if (o?.legend && key in scales2) {
34806
+ const legend3 = value(scales2[key], legendOptions(context, scales2[key], o), (key2) => scales2[key2]);
34730
34807
  if (legend3 != null)
34731
34808
  legends.push(legend3);
34732
34809
  }
@@ -34769,7 +34846,7 @@ var Frame = class extends Mark {
34769
34846
  this.rx = number5(rx);
34770
34847
  this.ry = number5(ry);
34771
34848
  }
34772
- render(index2, scales, channels, dimensions, context) {
34849
+ render(index2, scales2, channels, dimensions, context) {
34773
34850
  const { marginTop: marginTop2, marginRight: marginRight2, marginBottom: marginBottom2, marginLeft: marginLeft2, width: width2, height: height2 } = dimensions;
34774
34851
  const { anchor, insetTop, insetRight, insetBottom, insetLeft, rx, ry } = this;
34775
34852
  const x12 = marginLeft2 + insetLeft;
@@ -34864,9 +34941,9 @@ var Tip = class extends Mark {
34864
34941
  this.clipLine = clipper(this);
34865
34942
  this.format = { ...format3 };
34866
34943
  }
34867
- render(index2, scales, values2, dimensions, context) {
34944
+ render(index2, scales2, values2, dimensions, context) {
34868
34945
  const mark2 = this;
34869
- const { x: x4, y: y4, fx, fy } = scales;
34946
+ const { x: x4, y: y4, fx, fy } = scales2;
34870
34947
  const { ownerSVGElement: svg, document: document2 } = context;
34871
34948
  const { anchor, monospace, lineHeight, lineWidth } = this;
34872
34949
  const { textPadding: r, pointerSize: m2, pathFilter } = this;
@@ -34884,7 +34961,7 @@ var Tip = class extends Mark {
34884
34961
  sources = values2.channels;
34885
34962
  format3 = formatTitle;
34886
34963
  } else {
34887
- sources = getSourceChannels.call(this, values2, scales);
34964
+ sources = getSourceChannels.call(this, values2, scales2);
34888
34965
  format3 = formatChannels;
34889
34966
  }
34890
34967
  const g2 = create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyIndirectTextStyles, this).call(applyTransform, this, { x: X3 && x4, y: Y3 && y4 }).call(
@@ -34894,7 +34971,7 @@ var Tip = class extends Mark {
34894
34971
  this.setAttribute("fill", "currentColor");
34895
34972
  this.setAttribute("fill-opacity", 1);
34896
34973
  this.setAttribute("stroke", "none");
34897
- const lines = format3.call(mark2, i, index2, sources, scales, values2);
34974
+ const lines = format3.call(mark2, i, index2, sources, scales2, values2);
34898
34975
  if (typeof lines === "string") {
34899
34976
  for (const line3 of mark2.splitLines(lines)) {
34900
34977
  renderLine(that, { value: mark2.clipLine(line3) });
@@ -35032,7 +35109,7 @@ function getPath(anchor, m2, r, width2, height2) {
35032
35109
  return `M0,0l${m2 / 2},${-m2 / 2}v${m2 / 2 - h2 / 2}h${w}v${h2}h${-w}v${m2 / 2 - h2 / 2}z`;
35033
35110
  }
35034
35111
  }
35035
- function getSourceChannels({ channels }, scales) {
35112
+ function getSourceChannels({ channels }, scales2) {
35036
35113
  const sources = {};
35037
35114
  let format3 = this.format;
35038
35115
  format3 = maybeExpandPairedFormat(format3, channels, "x");
@@ -35058,18 +35135,18 @@ function getSourceChannels({ channels }, scales) {
35058
35135
  sources[key] = source;
35059
35136
  }
35060
35137
  if (this.facet) {
35061
- if (scales.fx && !("fx" in format3))
35138
+ if (scales2.fx && !("fx" in format3))
35062
35139
  sources.fx = true;
35063
- if (scales.fy && !("fy" in format3))
35140
+ if (scales2.fy && !("fy" in format3))
35064
35141
  sources.fy = true;
35065
35142
  }
35066
35143
  for (const key in sources) {
35067
35144
  const format4 = this.format[key];
35068
35145
  if (typeof format4 === "string") {
35069
- const value = sources[key]?.value ?? scales[key]?.domain() ?? [];
35146
+ const value = sources[key]?.value ?? scales2[key]?.domain() ?? [];
35070
35147
  this.format[key] = (isTemporal(value) ? utcFormat : format)(format4);
35071
35148
  } else if (format4 === void 0 || format4 === true) {
35072
- const scale3 = scales[key];
35149
+ const scale3 = scales2[key];
35073
35150
  this.format[key] = scale3?.bandwidth ? inferTickFormat(scale3, scale3.domain()) : formatDefault;
35074
35151
  }
35075
35152
  }
@@ -35090,11 +35167,11 @@ function maybeExpandPairedFormat(format3, channels, key) {
35090
35167
  function formatTitle(i, index2, { title }) {
35091
35168
  return formatDefault(title.value[i], i);
35092
35169
  }
35093
- function* formatChannels(i, index2, channels, scales, values2) {
35170
+ function* formatChannels(i, index2, channels, scales2, values2) {
35094
35171
  for (const key in channels) {
35095
35172
  if (key === "fx" || key === "fy") {
35096
35173
  yield {
35097
- label: formatLabel(scales, channels, key),
35174
+ label: formatLabel(scales2, channels, key),
35098
35175
  value: this.format[key](index2[key], i)
35099
35176
  };
35100
35177
  continue;
@@ -35106,12 +35183,12 @@ function* formatChannels(i, index2, channels, scales, values2) {
35106
35183
  const channel = channels[key];
35107
35184
  if (key === "x2" && "x1" in channels) {
35108
35185
  yield {
35109
- label: formatPairLabel(scales, channels, "x"),
35186
+ label: formatPairLabel(scales2, channels, "x"),
35110
35187
  value: formatPair(this.format.x2, channels.x1, channel, i)
35111
35188
  };
35112
35189
  } else if (key === "y2" && "y1" in channels) {
35113
35190
  yield {
35114
- label: formatPairLabel(scales, channels, "y"),
35191
+ label: formatPairLabel(scales2, channels, "y"),
35115
35192
  value: formatPair(this.format.y2, channels.y1, channel, i)
35116
35193
  };
35117
35194
  } else {
@@ -35120,7 +35197,7 @@ function* formatChannels(i, index2, channels, scales, values2) {
35120
35197
  if (!defined(value) && scale3 == null)
35121
35198
  continue;
35122
35199
  yield {
35123
- label: formatLabel(scales, channels, key),
35200
+ label: formatLabel(scales2, channels, key),
35124
35201
  value: this.format[key](value, i),
35125
35202
  color: scale3 === "color" ? values2[key][i] : null,
35126
35203
  opacity: scale3 === "opacity" ? values2[key][i] : null
@@ -35131,14 +35208,14 @@ function* formatChannels(i, index2, channels, scales, values2) {
35131
35208
  function formatPair(formatValue, c1, c22, i) {
35132
35209
  return c22.hint?.length ? `${formatValue(c22.value[i] - c1.value[i], i)}` : `${formatValue(c1.value[i], i)}\u2013${formatValue(c22.value[i], i)}`;
35133
35210
  }
35134
- function formatPairLabel(scales, channels, key) {
35135
- const l1 = formatLabel(scales, channels, `${key}1`, key);
35136
- const l2 = formatLabel(scales, channels, `${key}2`, key);
35211
+ function formatPairLabel(scales2, channels, key) {
35212
+ const l1 = formatLabel(scales2, channels, `${key}1`, key);
35213
+ const l2 = formatLabel(scales2, channels, `${key}2`, key);
35137
35214
  return l1 === l2 ? l1 : `${l1}\u2013${l2}`;
35138
35215
  }
35139
- function formatLabel(scales, channels, key, defaultLabel = key) {
35216
+ function formatLabel(scales2, channels, key, defaultLabel = key) {
35140
35217
  const channel = channels[key];
35141
- const scale3 = scales[channel?.scale ?? key];
35218
+ const scale3 = scales2[channel?.scale ?? key];
35142
35219
  return String(scale3?.label ?? channel?.label ?? defaultLabel);
35143
35220
  }
35144
35221
 
@@ -35213,10 +35290,10 @@ function plot(options = {}) {
35213
35290
  const scaleDescriptors = createScales(addScaleChannels(channelsByScale, stateByMark, options), options);
35214
35291
  const dimensions = createDimensions(scaleDescriptors, marks2, options);
35215
35292
  autoScaleRange(scaleDescriptors, dimensions);
35216
- const scales = createScaleFunctions(scaleDescriptors);
35217
- const { fx, fy } = scales;
35293
+ const scales2 = createScaleFunctions(scaleDescriptors);
35294
+ const { fx, fy } = scales2;
35218
35295
  const subdimensions = fx || fy ? innerDimensions(scaleDescriptors, dimensions) : dimensions;
35219
- const superdimensions = fx || fy ? actualDimensions(scales, dimensions) : dimensions;
35296
+ const superdimensions = fx || fy ? actualDimensions(scales2, dimensions) : dimensions;
35220
35297
  const context = createContext(options);
35221
35298
  const document2 = context.document;
35222
35299
  const svg = creator_default("svg").call(document2.documentElement);
@@ -35242,7 +35319,7 @@ function plot(options = {}) {
35242
35319
  for (const [mark2, state] of stateByMark) {
35243
35320
  if (mark2.initializer != null) {
35244
35321
  const dimensions2 = mark2.facet === "super" ? superdimensions : subdimensions;
35245
- const update2 = mark2.initializer(state.data, state.facets, state.channels, scales, dimensions2, context);
35322
+ const update2 = mark2.initializer(state.data, state.facets, state.channels, scales2, dimensions2, context);
35246
35323
  if (update2.data !== void 0) {
35247
35324
  state.data = update2.data;
35248
35325
  }
@@ -35272,8 +35349,8 @@ function plot(options = {}) {
35272
35349
  const newScaleDescriptors = inheritScaleLabels(createScales(newChannelsByScale, options), scaleDescriptors);
35273
35350
  const { scales: newExposedScales, ...newScales } = createScaleFunctions(newScaleDescriptors);
35274
35351
  Object.assign(scaleDescriptors, newScaleDescriptors);
35275
- Object.assign(scales, newScales);
35276
- Object.assign(scales.scales, newExposedScales);
35352
+ Object.assign(scales2, newScales);
35353
+ Object.assign(scales2.scales, newExposedScales);
35277
35354
  }
35278
35355
  let facetDomains, facetTranslate;
35279
35356
  if (facets !== void 0) {
@@ -35282,7 +35359,7 @@ function plot(options = {}) {
35282
35359
  facetTranslate = facetTranslator(fx, fy, dimensions);
35283
35360
  }
35284
35361
  for (const [mark2, state] of stateByMark) {
35285
- state.values = mark2.scale(state.channels, scales, context);
35362
+ state.values = mark2.scale(state.channels, scales2, context);
35286
35363
  }
35287
35364
  const { width: width2, height: height2 } = dimensions;
35288
35365
  select_default2(svg).attr("class", className).attr("fill", "currentColor").attr("font-family", "system-ui, sans-serif").attr("font-size", 10).attr("text-anchor", "middle").attr("width", width2).attr("height", height2).attr("viewBox", `0 0 ${width2} ${height2}`).attr("aria-label", ariaLabel).attr("aria-description", ariaDescription).call(
@@ -35313,7 +35390,7 @@ function plot(options = {}) {
35313
35390
  if (index2.length === 0)
35314
35391
  continue;
35315
35392
  }
35316
- const node = mark2.render(index2, scales, values2, superdimensions, context);
35393
+ const node = mark2.render(index2, scales2, values2, superdimensions, context);
35317
35394
  if (node == null)
35318
35395
  continue;
35319
35396
  svg.appendChild(node);
@@ -35333,7 +35410,7 @@ function plot(options = {}) {
35333
35410
  index2 = subarray(index2);
35334
35411
  index2.fx = f2.x, index2.fy = f2.y, index2.fi = f2.i;
35335
35412
  }
35336
- const node = mark2.render(index2, scales, values2, subdimensions, context);
35413
+ const node = mark2.render(index2, scales2, values2, subdimensions, context);
35337
35414
  if (node == null)
35338
35415
  continue;
35339
35416
  (g2 ??= select_default2(svg).append("g")).append(() => node).datum(f2);
@@ -35361,7 +35438,7 @@ function plot(options = {}) {
35361
35438
  if (caption != null)
35362
35439
  figure.append(createFigcaption(document2, caption));
35363
35440
  }
35364
- figure.scale = exposeScales(scales.scales);
35441
+ figure.scale = exposeScales(scales2.scales);
35365
35442
  figure.legend = exposeLegends(scaleDescriptors, context, options);
35366
35443
  figure.projection = context.projection;
35367
35444
  const w = consumeWarnings();
@@ -35508,7 +35585,7 @@ function maybeMarkFacet(mark2, topFacetState, options) {
35508
35585
  }
35509
35586
  }
35510
35587
  function derive(mark2, options = {}) {
35511
- return initializer({ ...options, x: null, y: null }, (data, facets, channels, scales, dimensions, context) => {
35588
+ return initializer({ ...options, x: null, y: null }, (data, facets, channels, scales2, dimensions, context) => {
35512
35589
  return context.getMarkState(mark2);
35513
35590
  });
35514
35591
  }
@@ -35683,10 +35760,10 @@ function hasPositionChannel(k3, marks2) {
35683
35760
  }
35684
35761
  return false;
35685
35762
  }
35686
- function inheritScaleLabels(newScales, scales) {
35763
+ function inheritScaleLabels(newScales, scales2) {
35687
35764
  for (const key in newScales) {
35688
35765
  const newScale = newScales[key];
35689
- const scale3 = scales[key];
35766
+ const scale3 = scales2[key];
35690
35767
  if (newScale.label === void 0 && scale3) {
35691
35768
  newScale.label = scale3.label;
35692
35769
  }
@@ -36574,9 +36651,9 @@ var Area = class extends Mark {
36574
36651
  filter(index2) {
36575
36652
  return index2;
36576
36653
  }
36577
- render(index2, scales, channels, dimensions, context) {
36654
+ render(index2, scales2, channels, dimensions, context) {
36578
36655
  const { x1: X13, y1: Y13, x2: X24 = X13, y2: Y24 = Y13 } = channels;
36579
- return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales, 0, 0).call(
36656
+ return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales2, 0, 0).call(
36580
36657
  (g2) => g2.selectAll().data(groupIndex(index2, [X13, Y13, X24, Y24], this, channels)).enter().append("path").call(applyDirectStyles, this).call(applyGroupedChannelStyles, this, channels).attr(
36581
36658
  "d",
36582
36659
  area_default3().curve(this.curve).defined((i) => i >= 0).x0((i) => X13[i]).y0((i) => Y13[i]).x1((i) => X24[i]).y1((i) => Y24[i])
@@ -36627,10 +36704,10 @@ var Link = class extends Mark {
36627
36704
  super.project(channels, values2, context);
36628
36705
  }
36629
36706
  }
36630
- render(index2, scales, channels, dimensions, context) {
36707
+ render(index2, scales2, channels, dimensions, context) {
36631
36708
  const { x1: X13, y1: Y13, x2: X24 = X13, y2: Y24 = Y13 } = channels;
36632
36709
  const { curve } = this;
36633
- return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales).call(
36710
+ return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales2).call(
36634
36711
  (g2) => g2.selectAll().data(index2).enter().append("path").call(applyDirectStyles, this).attr(
36635
36712
  "d",
36636
36713
  curve === curveAuto && context.projection ? sphereLink(context.projection, X13, Y13, X24, Y24) : (i) => {
@@ -36725,13 +36802,13 @@ var Arrow = class extends Mark {
36725
36802
  this.insetEnd = +insetEnd;
36726
36803
  this.sweep = maybeSweep(sweep);
36727
36804
  }
36728
- render(index2, scales, channels, dimensions, context) {
36805
+ render(index2, scales2, channels, dimensions, context) {
36729
36806
  const { x1: X13, y1: Y13, x2: X24 = X13, y2: Y24 = Y13, SW } = channels;
36730
36807
  const { strokeWidth, bend, headAngle, headLength, insetStart, insetEnd } = this;
36731
36808
  const sw = SW ? (i) => SW[i] : constant(strokeWidth === void 0 ? 1 : strokeWidth);
36732
36809
  const wingAngle = headAngle * radians3 / 2;
36733
36810
  const wingScale = headLength / 1.5;
36734
- return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales).call(
36811
+ return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales2).call(
36735
36812
  (g2) => g2.selectAll().data(index2).enter().append("path").call(applyDirectStyles, this).attr("d", (i) => {
36736
36813
  let x12 = X13[i], y12 = Y13[i], x22 = X24[i], y22 = Y24[i];
36737
36814
  const lineLength = Math.hypot(x22 - x12, y22 - y12);
@@ -36820,17 +36897,17 @@ var AbstractBar = class extends Mark {
36820
36897
  this.rx = impliedString(rx, "auto");
36821
36898
  this.ry = impliedString(ry, "auto");
36822
36899
  }
36823
- render(index2, scales, channels, dimensions, context) {
36900
+ render(index2, scales2, channels, dimensions, context) {
36824
36901
  const { rx, ry } = this;
36825
- return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(this._transform, this, scales).call(
36826
- (g2) => g2.selectAll().data(index2).enter().append("rect").call(applyDirectStyles, this).attr("x", this._x(scales, channels, dimensions)).attr("width", this._width(scales, channels, dimensions)).attr("y", this._y(scales, channels, dimensions)).attr("height", this._height(scales, channels, dimensions)).call(applyAttr, "rx", rx).call(applyAttr, "ry", ry).call(applyChannelStyles, this, channels)
36902
+ return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(this._transform, this, scales2).call(
36903
+ (g2) => g2.selectAll().data(index2).enter().append("rect").call(applyDirectStyles, this).attr("x", this._x(scales2, channels, dimensions)).attr("width", this._width(scales2, channels, dimensions)).attr("y", this._y(scales2, channels, dimensions)).attr("height", this._height(scales2, channels, dimensions)).call(applyAttr, "rx", rx).call(applyAttr, "ry", ry).call(applyChannelStyles, this, channels)
36827
36904
  ).node();
36828
36905
  }
36829
- _x(scales, { x: X3 }, { marginLeft: marginLeft2 }) {
36906
+ _x(scales2, { x: X3 }, { marginLeft: marginLeft2 }) {
36830
36907
  const { insetLeft } = this;
36831
36908
  return X3 ? (i) => X3[i] + insetLeft : marginLeft2 + insetLeft;
36832
36909
  }
36833
- _y(scales, { y: Y3 }, { marginTop: marginTop2 }) {
36910
+ _y(scales2, { y: Y3 }, { marginTop: marginTop2 }) {
36834
36911
  const { insetTop } = this;
36835
36912
  return Y3 ? (i) => Y3[i] + insetTop : marginTop2 + insetTop;
36836
36913
  }
@@ -36988,8 +37065,8 @@ var Dot = class extends Mark {
36988
37065
  };
36989
37066
  }
36990
37067
  }
36991
- render(index2, scales, channels, dimensions, context) {
36992
- const { x: x4, y: y4 } = scales;
37068
+ render(index2, scales2, channels, dimensions, context) {
37069
+ const { x: x4, y: y4 } = scales2;
36993
37070
  const { x: X3, y: Y3, r: R2, rotate: A5, symbol: S2 } = channels;
36994
37071
  const { r, rotate, symbol: symbol2 } = this;
36995
37072
  const [cx, cy] = applyFrameAnchor(this, dimensions);
@@ -37083,10 +37160,10 @@ var Line = class extends Mark {
37083
37160
  super.project(channels, values2, context);
37084
37161
  }
37085
37162
  }
37086
- render(index2, scales, channels, dimensions, context) {
37163
+ render(index2, scales2, channels, dimensions, context) {
37087
37164
  const { x: X3, y: Y3 } = channels;
37088
37165
  const { curve } = this;
37089
- return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales).call(
37166
+ return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales2).call(
37090
37167
  (g2) => g2.selectAll().data(groupIndex(index2, [X3, Y3], this, channels)).enter().append("path").call(applyDirectStyles, this).call(applyGroupedChannelStyles, this, channels).call(applyGroupedMarkers, this, channels, context).attr(
37091
37168
  "d",
37092
37169
  curve === curveAuto && context.projection ? sphereLine(context.projection, X3, Y3) : line_default2().curve(curve).defined((i) => i >= 0).x((i) => X3[i]).y((i) => Y3[i])
@@ -37160,8 +37237,8 @@ var Rect = class extends Mark {
37160
37237
  this.rx = impliedString(rx, "auto");
37161
37238
  this.ry = impliedString(ry, "auto");
37162
37239
  }
37163
- render(index2, scales, channels, dimensions, context) {
37164
- const { x: x4, y: y4 } = scales;
37240
+ render(index2, scales2, channels, dimensions, context) {
37241
+ const { x: x4, y: y4 } = scales2;
37165
37242
  const { x1: X13, y1: Y13, x2: X24, y2: Y24 } = channels;
37166
37243
  const { marginTop: marginTop2, marginRight: marginRight2, marginBottom: marginBottom2, marginLeft: marginLeft2, width: width2, height: height2 } = dimensions;
37167
37244
  const { projection: projection3 } = context;
@@ -37937,9 +38014,9 @@ var AbstractTick = class extends Mark {
37937
38014
  super(data, channels, options, defaults15);
37938
38015
  markers(this, options);
37939
38016
  }
37940
- render(index2, scales, channels, dimensions, context) {
37941
- return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(this._transform, this, scales).call(
37942
- (g2) => g2.selectAll().data(index2).enter().append("line").call(applyDirectStyles, this).attr("x1", this._x1(scales, channels, dimensions)).attr("x2", this._x2(scales, channels, dimensions)).attr("y1", this._y1(scales, channels, dimensions)).attr("y2", this._y2(scales, channels, dimensions)).call(applyChannelStyles, this, channels).call(applyMarkers, this, channels, context)
38017
+ render(index2, scales2, channels, dimensions, context) {
38018
+ return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(this._transform, this, scales2).call(
38019
+ (g2) => g2.selectAll().data(index2).enter().append("line").call(applyDirectStyles, this).attr("x1", this._x1(scales2, channels, dimensions)).attr("x2", this._x2(scales2, channels, dimensions)).attr("y1", this._y1(scales2, channels, dimensions)).attr("y2", this._y2(scales2, channels, dimensions)).call(applyChannelStyles, this, channels).call(applyMarkers, this, channels, context)
37943
38020
  ).node();
37944
38021
  }
37945
38022
  };
@@ -37960,10 +38037,10 @@ var TickX = class extends AbstractTick {
37960
38037
  _transform(selection2, mark2, { x: x4 }) {
37961
38038
  selection2.call(applyTransform, mark2, { x: x4 }, offset, 0);
37962
38039
  }
37963
- _x1(scales, { x: X3 }) {
38040
+ _x1(scales2, { x: X3 }) {
37964
38041
  return (i) => X3[i];
37965
38042
  }
37966
- _x2(scales, { x: X3 }) {
38043
+ _x2(scales2, { x: X3 }) {
37967
38044
  return (i) => X3[i];
37968
38045
  }
37969
38046
  _y1({ y: y4 }, { y: Y3 }, { marginTop: marginTop2 }) {
@@ -38000,10 +38077,10 @@ var TickY = class extends AbstractTick {
38000
38077
  const { insetRight } = this;
38001
38078
  return X3 && x4 ? (i) => X3[i] + x4.bandwidth() - insetRight : width2 - marginRight2 - insetRight;
38002
38079
  }
38003
- _y1(scales, { y: Y3 }) {
38080
+ _y1(scales2, { y: Y3 }) {
38004
38081
  return (i) => Y3[i];
38005
38082
  }
38006
- _y2(scales, { y: Y3 }) {
38083
+ _y2(scales2, { y: Y3 }) {
38007
38084
  return (i) => Y3[i];
38008
38085
  }
38009
38086
  };
@@ -38163,11 +38240,11 @@ var Raster = class extends AbstractRaster {
38163
38240
  this.imageRendering = impliedString(imageRendering, "auto");
38164
38241
  }
38165
38242
  // Ignore the color scale, so the fill channel is returned unscaled.
38166
- scale(channels, { color: color3, ...scales }, context) {
38167
- return super.scale(channels, scales, context);
38243
+ scale(channels, { color: color3, ...scales2 }, context) {
38244
+ return super.scale(channels, scales2, context);
38168
38245
  }
38169
- render(index2, scales, values2, dimensions, context) {
38170
- const color3 = scales[values2.channels.fill?.scale] ?? ((x4) => x4);
38246
+ render(index2, scales2, values2, dimensions, context) {
38247
+ const color3 = scales2[values2.channels.fill?.scale] ?? ((x4) => x4);
38171
38248
  const { x: X3, y: Y3 } = values2;
38172
38249
  const { document: document2 } = context;
38173
38250
  const [x12, y12, x22, y22] = renderBounds(values2, dimensions, context);
@@ -38216,7 +38293,7 @@ var Raster = class extends AbstractRaster {
38216
38293
  if (this.blur > 0)
38217
38294
  blurImage(image3, this.blur);
38218
38295
  context2d.putImageData(image3, 0, 0);
38219
- return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales).call(
38296
+ return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales2).call(
38220
38297
  (g3) => g3.append("image").attr("transform", `translate(${x12},${y12}) scale(${Math.sign(x22 - x12)},${Math.sign(y22 - y12)})`).attr("width", Math.abs(dx)).attr("height", Math.abs(dy)).attr("preserveAspectRatio", "none").call(applyAttr, "image-rendering", this.imageRendering).call(applyDirectStyles, this).attr("xlink:href", canvas.toDataURL())
38221
38298
  ).node();
38222
38299
  }
@@ -38248,7 +38325,7 @@ function renderBounds({ x1: x12, y1: y12, x2: x22, y2: y22 }, dimensions, { proj
38248
38325
  y22 && projection3 == null ? y22[0] : height2 - marginBottom2
38249
38326
  ];
38250
38327
  }
38251
- function rasterBounds({ x1: x12, y1: y12, x2: x22, y2: y22 }, scales, dimensions, context) {
38328
+ function rasterBounds({ x1: x12, y1: y12, x2: x22, y2: y22 }, scales2, dimensions, context) {
38252
38329
  const channels = {};
38253
38330
  if (x12)
38254
38331
  channels.x1 = x12;
@@ -38258,19 +38335,19 @@ function rasterBounds({ x1: x12, y1: y12, x2: x22, y2: y22 }, scales, dimensions
38258
38335
  channels.x2 = x22;
38259
38336
  if (y22)
38260
38337
  channels.y2 = y22;
38261
- return renderBounds(valueObject(channels, scales), dimensions, context);
38338
+ return renderBounds(valueObject(channels, scales2), dimensions, context);
38262
38339
  }
38263
38340
  function sampler(name2, options = {}) {
38264
38341
  const { [name2]: value } = options;
38265
38342
  if (typeof value !== "function")
38266
38343
  throw new Error(`invalid ${name2}: not a function`);
38267
- return initializer({ ...options, [name2]: void 0 }, function(data, facets, channels, scales, dimensions, context) {
38268
- const { x: x4, y: y4 } = scales;
38344
+ return initializer({ ...options, [name2]: void 0 }, function(data, facets, channels, scales2, dimensions, context) {
38345
+ const { x: x4, y: y4 } = scales2;
38269
38346
  if (!x4)
38270
38347
  throw new Error("missing scale: x");
38271
38348
  if (!y4)
38272
38349
  throw new Error("missing scale: y");
38273
- const [x12, y12, x22, y22] = rasterBounds(channels, scales, dimensions, context);
38350
+ const [x12, y12, x22, y22] = rasterBounds(channels, scales2, dimensions, context);
38274
38351
  const dx = x22 - x12;
38275
38352
  const dy = y22 - y12;
38276
38353
  const { pixelSize: k3 } = this;
@@ -38580,18 +38657,18 @@ var Contour = class extends AbstractRaster {
38580
38657
  filter(index2, { x: x4, y: y4, value, ...channels }, values2) {
38581
38658
  return super.filter(index2, channels, values2);
38582
38659
  }
38583
- render(index2, scales, channels, dimensions, context) {
38660
+ render(index2, scales2, channels, dimensions, context) {
38584
38661
  const { geometry: G } = channels;
38585
38662
  const path2 = path_default();
38586
- return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales).call((g2) => {
38663
+ return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales2).call((g2) => {
38587
38664
  g2.selectAll().data(index2).enter().append("path").call(applyDirectStyles, this).attr("d", (i) => path2(G[i])).call(applyChannelStyles, this, channels);
38588
38665
  }).node();
38589
38666
  }
38590
38667
  };
38591
38668
  function contourGeometry({ thresholds, interval: interval2, ...options }) {
38592
38669
  thresholds = maybeThresholds(thresholds, interval2, thresholdSturges);
38593
- return initializer(options, function(data, facets, channels, scales, dimensions, context) {
38594
- const [x12, y12, x22, y22] = rasterBounds(channels, scales, dimensions, context);
38670
+ return initializer(options, function(data, facets, channels, scales2, dimensions, context) {
38671
+ const [x12, y12, x22, y22] = rasterBounds(channels, scales2, dimensions, context);
38595
38672
  const dx = x22 - x12;
38596
38673
  const dy = y22 - y12;
38597
38674
  const { pixelSize: k3, width: w = Math.round(Math.abs(dx) / k3), height: h2 = Math.round(Math.abs(dy) / k3) } = this;
@@ -38600,7 +38677,7 @@ function contourGeometry({ thresholds, interval: interval2, ...options }) {
38600
38677
  const V2 = channels.value.value;
38601
38678
  const VV = [];
38602
38679
  if (this.interpolate) {
38603
- const { x: X3, y: Y3 } = applyPosition(channels, scales, context);
38680
+ const { x: X3, y: Y3 } = applyPosition(channels, scales2, context);
38604
38681
  const IX = map2(X3, (x4) => (x4 - x12) * kx2, Float64Array);
38605
38682
  const IY = map2(Y3, (y4) => (y4 - y12) * ky2, Float64Array);
38606
38683
  const ichannels = [channels.x, channels.y, channels.value];
@@ -38811,8 +38888,8 @@ var DelaunayLink = class extends Mark {
38811
38888
  this.curve = maybeCurve(curve, tension);
38812
38889
  markers(this, options);
38813
38890
  }
38814
- render(index2, scales, channels, dimensions, context) {
38815
- const { x: x4, y: y4 } = scales;
38891
+ render(index2, scales2, channels, dimensions, context) {
38892
+ const { x: x4, y: y4 } = scales2;
38816
38893
  const { x: X3, y: Y3, z: Z3 } = channels;
38817
38894
  const { curve } = this;
38818
38895
  const [cx, cy] = applyFrameAnchor(this, dimensions);
@@ -38878,8 +38955,8 @@ var AbstractDelaunayMark = class extends Mark {
38878
38955
  defaults23
38879
38956
  );
38880
38957
  }
38881
- render(index2, scales, channels, dimensions, context) {
38882
- const { x: x4, y: y4 } = scales;
38958
+ render(index2, scales2, channels, dimensions, context) {
38959
+ const { x: x4, y: y4 } = scales2;
38883
38960
  const { x: X3, y: Y3, z: Z3 } = channels;
38884
38961
  const [cx, cy] = applyFrameAnchor(this, dimensions);
38885
38962
  const xi = X3 ? (i) => X3[i] : constant(cx);
@@ -38925,8 +39002,8 @@ var Voronoi2 = class extends Mark {
38925
39002
  voronoiDefaults
38926
39003
  );
38927
39004
  }
38928
- render(index2, scales, channels, dimensions, context) {
38929
- const { x: x4, y: y4 } = scales;
39005
+ render(index2, scales2, channels, dimensions, context) {
39006
+ const { x: x4, y: y4 } = scales2;
38930
39007
  const { x: X3, y: Y3, z: Z3 } = channels;
38931
39008
  const [cx, cy] = applyFrameAnchor(this, dimensions);
38932
39009
  const xi = X3 ? (i) => X3[i] : constant(cx);
@@ -39006,7 +39083,7 @@ var Density = class extends Mark {
39006
39083
  filter(index2) {
39007
39084
  return index2;
39008
39085
  }
39009
- render(index2, scales, channels, dimensions, context) {
39086
+ render(index2, scales2, channels, dimensions, context) {
39010
39087
  const { contours } = channels;
39011
39088
  const path2 = path_default();
39012
39089
  return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, {}).call(
@@ -39024,13 +39101,13 @@ function densityInitializer(options, fillDensity, strokeDensity) {
39024
39101
  let { bandwidth, thresholds } = options;
39025
39102
  bandwidth = bandwidth === void 0 ? 20 : +bandwidth;
39026
39103
  thresholds = thresholds === void 0 ? 20 : typeof thresholds?.[Symbol.iterator] === "function" ? coerceNumbers(thresholds) : +thresholds;
39027
- return initializer(options, function(data, facets, channels, scales, dimensions, context) {
39104
+ return initializer(options, function(data, facets, channels, scales2, dimensions, context) {
39028
39105
  const W2 = channels.weight ? coerceNumbers(channels.weight.value) : null;
39029
39106
  const Z3 = channels.z?.value;
39030
39107
  const { z: z2 } = this;
39031
39108
  const [cx, cy] = applyFrameAnchor(this, dimensions);
39032
39109
  const { width: width2, height: height2 } = dimensions;
39033
- const { x: X3, y: Y3 } = applyPosition(channels, scales, context);
39110
+ const { x: X3, y: Y3 } = applyPosition(channels, scales2, context);
39034
39111
  const newChannels = Object.fromEntries(
39035
39112
  Object.entries(channels).filter(([key]) => !dropChannels.has(key)).map(([key, channel]) => [key, { ...channel, value: [] }])
39036
39113
  );
@@ -39190,14 +39267,14 @@ function memo(v3) {
39190
39267
  return { transform: (data) => V2 || (V2 = valueof(data, value)), label: label2 };
39191
39268
  }
39192
39269
  function clipDifferenceY(positive2) {
39193
- return (index2, scales, channels, dimensions, context, next) => {
39270
+ return (index2, scales2, channels, dimensions, context, next) => {
39194
39271
  const { x1: x12, x2: x22 } = channels;
39195
39272
  const { height: height2 } = dimensions;
39196
39273
  const y12 = new Float32Array(x12.length);
39197
39274
  const y22 = new Float32Array(x22.length);
39198
- (positive2 === inferScaleOrder(scales.y) < 0 ? y12 : y22).fill(height2);
39199
- const oc = next(index2, scales, { ...channels, x2: x12, y2: y22 }, dimensions, context);
39200
- const og = next(index2, scales, { ...channels, x1: x22, y1: y12 }, dimensions, context);
39275
+ (positive2 === inferScaleOrder(scales2.y) < 0 ? y12 : y22).fill(height2);
39276
+ const oc = next(index2, scales2, { ...channels, x2: x12, y2: y22 }, dimensions, context);
39277
+ const og = next(index2, scales2, { ...channels, x1: x22, y1: y12 }, dimensions, context);
39201
39278
  const c4 = oc.querySelector("g") ?? oc;
39202
39279
  const g2 = og.querySelector("g") ?? og;
39203
39280
  for (let i = 0; c4.firstChild; i += 2) {
@@ -39235,15 +39312,15 @@ var Geo = class extends Mark {
39235
39312
  );
39236
39313
  this.r = cr;
39237
39314
  }
39238
- render(index2, scales, channels, dimensions, context) {
39315
+ render(index2, scales2, channels, dimensions, context) {
39239
39316
  const { geometry: G, r: R2 } = channels;
39240
- const path2 = path_default(context.projection ?? scaleProjection2(scales));
39317
+ const path2 = path_default(context.projection ?? scaleProjection2(scales2));
39241
39318
  const { r } = this;
39242
39319
  if (negative(r))
39243
39320
  index2 = [];
39244
39321
  else if (r !== void 0)
39245
39322
  path2.pointRadius(r);
39246
- return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales).call((g2) => {
39323
+ return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales2).call((g2) => {
39247
39324
  g2.selectAll().data(index2).enter().append("path").call(applyDirectStyles, this).attr("d", R2 ? (i) => path2.pointRadius(R2[i])(G[i]) : (i) => path2(G[i])).call(applyChannelStyles, this, channels);
39248
39325
  }).node();
39249
39326
  }
@@ -39300,13 +39377,13 @@ function hexbin(outputs = { fill: "count" }, { binWidth, ...options } = {}) {
39300
39377
  options.symbol = "hexagon";
39301
39378
  if (options.r === void 0 && !hasOutput(outputs, "r"))
39302
39379
  options.r = binWidth / 2;
39303
- return initializer(options, (data, facets, channels, scales, _2, context) => {
39380
+ return initializer(options, (data, facets, channels, scales2, _2, context) => {
39304
39381
  let { x: X3, y: Y3, z: Z3, fill: F2, stroke: S2, symbol: Q2 } = channels;
39305
39382
  if (X3 === void 0)
39306
39383
  throw new Error("missing channel: x");
39307
39384
  if (Y3 === void 0)
39308
39385
  throw new Error("missing channel: y");
39309
- ({ x: X3, y: Y3 } = applyPosition(channels, scales, context));
39386
+ ({ x: X3, y: Y3 } = applyPosition(channels, scales2, context));
39310
39387
  Z3 = Z3 ? Z3.value : valueof(data, z2);
39311
39388
  F2 = F2?.value;
39312
39389
  S2 = S2?.value;
@@ -39348,8 +39425,8 @@ function hexbin(outputs = { fill: "count" }, { binWidth, ...options } = {}) {
39348
39425
  const sx = channels.x.scale;
39349
39426
  const sy = channels.y.scale;
39350
39427
  const binChannels = {
39351
- x: { value: BX, source: scales[sx] ? { value: map2(BX, scales[sx].invert), scale: sx } : null },
39352
- y: { value: BY, source: scales[sy] ? { value: map2(BY, scales[sy].invert), scale: sy } : null },
39428
+ x: { value: BX, source: scales2[sx] ? { value: map2(BX, scales2[sx].invert), scale: sx } : null },
39429
+ y: { value: BY, source: scales2[sy] ? { value: map2(BY, scales2[sy].invert), scale: sy } : null },
39353
39430
  ...Z3 && { z: { value: GZ } },
39354
39431
  ...F2 && { fill: { value: GF, scale: "auto" } },
39355
39432
  ...S2 && { stroke: { value: GS, scale: "auto" } },
@@ -39408,7 +39485,7 @@ var Hexgrid = class extends Mark {
39408
39485
  super(singleton, void 0, { clip, ...options }, defaults20);
39409
39486
  this.binWidth = number5(binWidth);
39410
39487
  }
39411
- render(index2, scales, channels, dimensions, context) {
39488
+ render(index2, scales2, channels, dimensions, context) {
39412
39489
  const { binWidth } = this;
39413
39490
  const { marginTop: marginTop2, marginRight: marginRight2, marginBottom: marginBottom2, marginLeft: marginLeft2, width: width2, height: height2 } = dimensions;
39414
39491
  const x06 = marginLeft2 - ox, x12 = width2 - marginRight2 - ox, y06 = marginTop2 - oy, y12 = height2 - marginBottom2 - oy, rx = binWidth / 2, ry = rx * sqrt4_3, hy = ry / 2, wx = rx * 2, wy = ry * 1.5, i0 = Math.floor(x06 / wx), i1 = Math.ceil(x12 / wx), j0 = Math.floor((y06 + hy) / wy), j1 = Math.ceil((y12 - hy) / wy) + 1, path2 = `m0,${round(-ry)}l${round(rx)},${round(hy)}v${round(ry)}l${round(-rx)},${round(hy)}`;
@@ -39480,8 +39557,8 @@ var Image = class extends Mark {
39480
39557
  this.frameAnchor = maybeFrameAnchor(frameAnchor);
39481
39558
  this.imageRendering = impliedString(imageRendering, "auto");
39482
39559
  }
39483
- render(index2, scales, channels, dimensions, context) {
39484
- const { x: x4, y: y4 } = scales;
39560
+ render(index2, scales2, channels, dimensions, context) {
39561
+ const { x: x4, y: y4 } = scales2;
39485
39562
  const { x: X3, y: Y3, width: W2, height: H2, r: R2, rotate: A5, src: S2 } = channels;
39486
39563
  const { r, width: width2, height: height2, rotate } = this;
39487
39564
  const [cx, cy] = applyFrameAnchor(this, dimensions);
@@ -39651,10 +39728,10 @@ var LinearRegression = class extends Mark {
39651
39728
  if (!(this.precision > 0))
39652
39729
  throw new Error(`invalid precision: ${precision}`);
39653
39730
  }
39654
- render(index2, scales, channels, dimensions, context) {
39731
+ render(index2, scales2, channels, dimensions, context) {
39655
39732
  const { x: X3, y: Y3, z: Z3 } = channels;
39656
39733
  const { ci } = this;
39657
- return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales).call(
39734
+ return create3("svg:g", context).call(applyIndirectStyles, this, dimensions, context).call(applyTransform, this, scales2).call(
39658
39735
  (g2) => g2.selectAll().data(Z3 ? groupZ2(index2, Z3, this.z) : [index2]).enter().call(
39659
39736
  (enter) => enter.append("path").attr("fill", "none").call(applyDirectStyles, this).call(applyGroupedChannelStyles, this, { ...channels, fill: null, fillOpacity: null }).attr("d", (I2) => this._renderLine(I2, X3, Y3)).call(
39660
39737
  ci && !isNone(this.fill) ? (path2) => path2.select(pathBefore).attr("stroke", "none").call(applyDirectStyles, this).call(applyGroupedChannelStyles, this, {
@@ -40166,7 +40243,7 @@ function cluster(data, options) {
40166
40243
 
40167
40244
  // ../../node_modules/@observablehq/plot/src/transforms/centroid.js
40168
40245
  function centroid2({ geometry = identity7, ...options } = {}) {
40169
- return initializer({ ...options, x: null, y: null }, (data, facets, channels, scales, dimensions, { projection: projection3 }) => {
40246
+ return initializer({ ...options, x: null, y: null }, (data, facets, channels, scales2, dimensions, { projection: projection3 }) => {
40170
40247
  const G = valueof(data, geometry);
40171
40248
  const n = G.length;
40172
40249
  const X3 = new Float64Array(n);
@@ -40256,14 +40333,14 @@ function dodge(y4, x4, anchor, padding2, r, options) {
40256
40333
  if (sort3 === void 0 && reverse3 === void 0)
40257
40334
  options.sort = { channel: "-r" };
40258
40335
  }
40259
- return initializer(options, function(data, facets, channels, scales, dimensions, context) {
40336
+ return initializer(options, function(data, facets, channels, scales2, dimensions, context) {
40260
40337
  let { [x4]: X3, r: R2 } = channels;
40261
40338
  if (!channels[x4])
40262
40339
  throw new Error(`missing channel: ${x4}`);
40263
- ({ [x4]: X3 } = applyPosition(channels, scales, context));
40340
+ ({ [x4]: X3 } = applyPosition(channels, scales2, context));
40264
40341
  const cr = R2 ? void 0 : r !== void 0 ? number5(r) : this.r !== void 0 ? this.r : 3;
40265
40342
  if (R2)
40266
- R2 = valueof(R2.value, scales[R2.scale] || identity7, Float64Array);
40343
+ R2 = valueof(R2.value, scales2[R2.scale] || identity7, Float64Array);
40267
40344
  let [ky2, ty] = anchor(dimensions);
40268
40345
  const compare = ky2 ? compareAscending : compareSymmetric;
40269
40346
  const Y3 = new Float64Array(X3.length);
@@ -40593,6 +40670,9 @@ var attributeMap = /* @__PURE__ */ new Map([
40593
40670
  ["xAriaDescription", "x.ariaDescription"],
40594
40671
  ["xReverse", "x.reverse"],
40595
40672
  ["xZero", "x.zero"],
40673
+ ["xBase", "x.base"],
40674
+ ["xExponent", "x.exponent"],
40675
+ ["xConstant", "x.constant"],
40596
40676
  ["yScale", "y.type"],
40597
40677
  ["yDomain", "y.domain"],
40598
40678
  ["yRange", "y.range"],
@@ -40623,6 +40703,9 @@ var attributeMap = /* @__PURE__ */ new Map([
40623
40703
  ["yAriaDescription", "y.ariaDescription"],
40624
40704
  ["yReverse", "y.reverse"],
40625
40705
  ["yZero", "y.zero"],
40706
+ ["yBase", "y.base"],
40707
+ ["yExponent", "y.exponent"],
40708
+ ["yConstant", "y.constant"],
40626
40709
  ["facetMargin", "facet.margin"],
40627
40710
  ["facetMarginTop", "facet.marginTop"],
40628
40711
  ["facetMarginBottom", "facet.marginBottom"],
@@ -40698,6 +40781,9 @@ var attributeMap = /* @__PURE__ */ new Map([
40698
40781
  ["colorReverse", "color.reverse"],
40699
40782
  ["colorZero", "color.zero"],
40700
40783
  ["colorTickFormat", "color.tickFormat"],
40784
+ ["colorBase", "color.base"],
40785
+ ["colorExponent", "color.exponent"],
40786
+ ["colorConstant", "color.constant"],
40701
40787
  ["opacityScale", "opacity.type"],
40702
40788
  ["opacityDomain", "opacity.domain"],
40703
40789
  ["opacityRange", "opacity.range"],
@@ -40707,18 +40793,27 @@ var attributeMap = /* @__PURE__ */ new Map([
40707
40793
  ["opacityReverse", "opacity.reverse"],
40708
40794
  ["opacityZero", "opacity.zero"],
40709
40795
  ["opacityTickFormat", "opacity.tickFormat"],
40796
+ ["opacityBase", "opacity.base"],
40797
+ ["opacityExponent", "opacity.exponent"],
40798
+ ["opacityConstant", "opacity.constant"],
40710
40799
  ["rScale", "r.type"],
40711
40800
  ["rDomain", "r.domain"],
40712
40801
  ["rRange", "r.range"],
40713
40802
  ["rClamp", "r.clamp"],
40714
40803
  ["rNice", "r.nice"],
40715
40804
  ["rZero", "r.zero"],
40805
+ ["rBase", "r.base"],
40806
+ ["rExponent", "r.exponent"],
40807
+ ["rConstant", "r.constant"],
40716
40808
  ["lengthScale", "length.type"],
40717
40809
  ["lengthDomain", "length.domain"],
40718
40810
  ["lengthRange", "length.range"],
40719
40811
  ["lengthClamp", "length.clamp"],
40720
40812
  ["lengthNice", "length.nice"],
40721
40813
  ["lengthZero", "length.zero"],
40814
+ ["lengthBase", "length.base"],
40815
+ ["lengthExponent", "length.exponent"],
40816
+ ["lengthConstant", "length.constant"],
40722
40817
  ["projectionType", "projection.type"],
40723
40818
  ["projectionParallels", "projection.parallels"],
40724
40819
  ["projectionPrecision", "projection.precision"],
@@ -41075,14 +41170,26 @@ function isSymbol2(value) {
41075
41170
  return symbols2.has(`${value}`.toLowerCase());
41076
41171
  }
41077
41172
 
41078
- // ../plot/src/marks/util/is-arrow-table.js
41173
+ // ../plot/src/marks/util/arrow.js
41174
+ var INTEGER = 2;
41175
+ var FLOAT = 3;
41176
+ var DECIMAL = 7;
41177
+ var TIMESTAMP = 10;
41079
41178
  function isArrowTable(values2) {
41080
41179
  return typeof values2?.getChild === "function";
41081
41180
  }
41181
+ function convertArrow(type2) {
41182
+ const { typeId } = type2;
41183
+ if (typeId === TIMESTAMP) {
41184
+ return (v3) => v3 == null ? v3 : new Date(v3);
41185
+ }
41186
+ if (typeId === INTEGER && type2.bitWidth >= 64) {
41187
+ return (v3) => v3 == null ? v3 : Number(v3);
41188
+ }
41189
+ return (v3) => v3;
41190
+ }
41082
41191
 
41083
41192
  // ../plot/src/marks/util/to-data-array.js
41084
- var INTEGER = 2;
41085
- var TIMESTAMP = 10;
41086
41193
  function toDataArray(data) {
41087
41194
  return isArrowTable(data) ? arrowToObjects(data) : data;
41088
41195
  }
@@ -41097,7 +41204,7 @@ function arrowToObjects(data) {
41097
41204
  for (let j2 = 0; j2 < numCols; ++j2) {
41098
41205
  const child = batch.getChildAt(j2);
41099
41206
  const { name: name2, type: type2 } = schema.fields[j2];
41100
- const valueOf = convert(type2);
41207
+ const valueOf = convertArrow(type2);
41101
41208
  for (let o = k3, i = 0; i < numRows; ++i, ++o) {
41102
41209
  objects[o][name2] = valueOf(child.get(i));
41103
41210
  }
@@ -41106,16 +41213,6 @@ function arrowToObjects(data) {
41106
41213
  }
41107
41214
  return objects;
41108
41215
  }
41109
- function convert(type2) {
41110
- const { typeId } = type2;
41111
- if (typeId === TIMESTAMP) {
41112
- return (v3) => v3 == null ? v3 : new Date(v3);
41113
- }
41114
- if (typeId === INTEGER && type2.bitWidth >= 64) {
41115
- return (v3) => v3 == null ? v3 : Number(v3);
41116
- }
41117
- return (v3) => v3;
41118
- }
41119
41216
 
41120
41217
  // ../plot/src/marks/Mark.js
41121
41218
  var isColorChannel = (channel) => channel === "stroke" || channel === "fill";
@@ -41292,19 +41389,43 @@ function markQuery(channels, table3, skip = []) {
41292
41389
  return q2;
41293
41390
  }
41294
41391
 
41295
- // ../plot/src/marks/util/bin-field.js
41296
- function binField(mark2, channel, expr) {
41297
- if (!mark2.stats)
41298
- return field2;
41392
+ // ../plot/src/marks/util/channel-scale.js
41393
+ function channelScale(mark2, channel) {
41394
+ const { plot: plot3 } = mark2;
41395
+ let scaleType = plot3.getAttribute(`${channel}Scale`);
41396
+ if (!scaleType) {
41397
+ const { field: field2 } = mark2.channelField(channel, `${channel}1`, `${channel}2`);
41398
+ const { type: type2 } = mark2.stats[field2.column];
41399
+ scaleType = type2 === "date" ? "time" : "linear";
41400
+ }
41401
+ const options = { type: scaleType };
41402
+ switch (scaleType) {
41403
+ case "log":
41404
+ options.base = plot3.getAttribute(`${channel}Base`) ?? 10;
41405
+ break;
41406
+ case "pow":
41407
+ options.exponent = plot3.getAttribute(`${channel}Exponent`) ?? 1;
41408
+ break;
41409
+ case "symlog":
41410
+ options.constant = plot3.getAttribute(`${channel}Constant`) ?? 1;
41411
+ break;
41412
+ }
41413
+ return scaleTransform(options);
41414
+ }
41415
+
41416
+ // ../plot/src/marks/util/bin-expr.js
41417
+ function binExpr(mark2, channel, n, extent4, pad3 = 1, expr) {
41299
41418
  const { field: field2 } = mark2.channelField(channel);
41300
- const { type: type2 } = mark2.stats[field2.column];
41301
41419
  expr = expr ?? field2;
41302
- return type2 === "date" ? epoch_ms(expr) : expr;
41303
- }
41304
- function bin1d(x4, x06, x12, n, reverse3 = false, pad3 = 1) {
41305
- const d = (n - pad3) / (x12 - x06);
41306
- const f2 = d !== 1 ? ` * ${d}::DOUBLE` : "";
41307
- return reverse3 ? sql`(${+x12} - ${x4}::DOUBLE)${f2}` : sql`(${x4}::DOUBLE - ${+x06})${f2}`;
41420
+ const { type: type2, apply: apply2, sqlApply } = channelScale(mark2, channel);
41421
+ const reverse3 = !!mark2.plot.getAttribute(`${channel}Reverse`);
41422
+ const [lo, hi] = extent4.map((v4) => apply2(v4));
41423
+ const v3 = sqlApply(expr);
41424
+ const f2 = type2 === "time" || type2 === "utc" ? v3 : expr;
41425
+ const d = hi === lo ? 0 : (n - pad3) / (hi - lo);
41426
+ const s2 = d !== 1 ? ` * ${d}::DOUBLE` : "";
41427
+ const bin3 = reverse3 ? sql`(${hi} - ${v3}::DOUBLE)${s2}` : sql`(${v3}::DOUBLE - ${lo})${s2}`;
41428
+ return [bin3, f2];
41308
41429
  }
41309
41430
 
41310
41431
  // ../plot/src/marks/util/extent.js
@@ -41360,7 +41481,7 @@ function filteredExtent(filter3, column3) {
41360
41481
  var ConnectedMark = class extends Mark2 {
41361
41482
  constructor(type2, source, encodings) {
41362
41483
  const dim = type2.endsWith("X") ? "y" : type2.endsWith("Y") ? "x" : null;
41363
- const req = { [dim]: ["count", "min", "max"] };
41484
+ const req = { [dim]: ["min", "max"] };
41364
41485
  super(type2, source, encodings, req);
41365
41486
  this.dim = dim;
41366
41487
  }
@@ -41368,27 +41489,29 @@ var ConnectedMark = class extends Mark2 {
41368
41489
  const { plot: plot3, dim, source, stats } = this;
41369
41490
  const { optimize = true } = source.options || {};
41370
41491
  const q2 = super.query(filter3);
41371
- if (optimize && dim) {
41372
- const { field: field2, as } = this.channelField(dim);
41492
+ if (!dim)
41493
+ return q2;
41494
+ const ortho = dim === "x" ? "y" : "x";
41495
+ const value = this.channelField(ortho)?.as;
41496
+ const { field: field2, as } = this.channelField(dim);
41497
+ const { type: type2 } = stats[field2.column];
41498
+ const isContinuous = type2 === "date" || type2 === "number";
41499
+ if (optimize && isContinuous && value) {
41373
41500
  const { column: column3 } = field2;
41374
- const { count: count4, max: max4, min: min5 } = stats[column3];
41501
+ const { max: max4, min: min5 } = stats[column3];
41375
41502
  const size = dim === "x" ? plot3.innerWidth() : plot3.innerHeight();
41376
41503
  const [lo, hi] = filteredExtent(filter3, column3) || [min5, max4];
41377
- const scale3 = (hi - lo) / (max4 - min5);
41378
- if (count4 * scale3 > size * 4) {
41379
- const dd = binField(this, dim, as);
41380
- const val = this.channelField(dim === "x" ? "y" : "x").as;
41381
- const cols = q2.select().map((c4) => c4.as).filter((c4) => c4 !== as && c4 !== val);
41382
- return m4(q2, dd, as, val, lo, hi, size, cols);
41383
- }
41384
- q2.orderby(as);
41504
+ const [expr] = binExpr(this, dim, size, [lo, hi], 1, as);
41505
+ const cols = q2.select().map((c4) => c4.as).filter((c4) => c4 !== as && c4 !== value);
41506
+ return m4(q2, expr, as, value, cols);
41507
+ } else {
41508
+ return q2.orderby(field2);
41385
41509
  }
41386
- return q2;
41387
41510
  }
41388
41511
  };
41389
- function m4(input3, bx, x4, y4, lo, hi, width2, cols = []) {
41390
- const bins2 = sql`FLOOR(${width2 / (hi - lo)}::DOUBLE * (${bx} - ${+lo}::DOUBLE))::INTEGER`;
41391
- const q2 = (sel) => Query.from(input3).select(sel).groupby(bins2, cols);
41512
+ function m4(input3, bin3, x4, y4, cols = []) {
41513
+ const pixel = sql`FLOOR(${bin3})::INTEGER`;
41514
+ const q2 = (sel) => Query.from(input3).select(sel).groupby(pixel, cols);
41392
41515
  return Query.union(
41393
41516
  q2([{ [x4]: min(x4), [y4]: argmin(y4, x4) }, ...cols]),
41394
41517
  q2([{ [x4]: max(x4), [y4]: argmax(y4, x4) }, ...cols]),
@@ -41397,6 +41520,120 @@ function m4(input3, bx, x4, y4, lo, hi, width2, cols = []) {
41397
41520
  ).orderby(cols, x4);
41398
41521
  }
41399
41522
 
41523
+ // ../plot/src/marks/util/grid.js
41524
+ function arrayType(values2, name2 = "density") {
41525
+ if (isArrowTable(values2)) {
41526
+ const type2 = values2.getChild(name2).type;
41527
+ switch (type2.typeId) {
41528
+ case INTEGER:
41529
+ case FLOAT:
41530
+ case DECIMAL:
41531
+ return Float64Array;
41532
+ default:
41533
+ return Array;
41534
+ }
41535
+ } else {
41536
+ return typeof values2[0][name2] === "number" ? Float64Array : Array;
41537
+ }
41538
+ }
41539
+ function grid1d(n, values2) {
41540
+ const Type3 = arrayType(values2);
41541
+ return valuesToGrid(new Type3(n), values2);
41542
+ }
41543
+ function grid2d(m2, n, values2, aggr, groupby = []) {
41544
+ if (groupby.length) {
41545
+ return groupedValuesToGrids(m2 * n, values2, aggr, groupby);
41546
+ } else {
41547
+ const cell3 = {};
41548
+ aggr.forEach((name2) => {
41549
+ const Type3 = arrayType(values2, name2);
41550
+ cell3[name2] = valuesToGrid(new Type3(m2 * n), values2, name2);
41551
+ });
41552
+ return [cell3];
41553
+ }
41554
+ }
41555
+ function valuesToGrid(grid2, values2, name2 = "density") {
41556
+ if (isArrowTable(values2)) {
41557
+ const numRows = values2.numRows;
41558
+ if (numRows === 0)
41559
+ return grid2;
41560
+ const index2 = values2.getChild("index").toArray();
41561
+ const value = values2.getChild(name2).toArray();
41562
+ for (let row = 0; row < numRows; ++row) {
41563
+ grid2[index2[row]] = value[row];
41564
+ }
41565
+ } else {
41566
+ for (const row of values2) {
41567
+ grid2[row.index] = row[name2];
41568
+ }
41569
+ }
41570
+ return grid2;
41571
+ }
41572
+ function groupedValuesToGrids(size, values2, aggr, groupby) {
41573
+ const Types = aggr.map((name2) => arrayType(values2, name2));
41574
+ const numAggr = aggr.length;
41575
+ const cellMap = {};
41576
+ const getCell = (key) => {
41577
+ let cell3 = cellMap[key];
41578
+ if (!cell3) {
41579
+ cell3 = cellMap[key] = {};
41580
+ groupby.forEach((name2, i) => cell3[name2] = key[i]);
41581
+ aggr.forEach((name2, i) => cell3[name2] = new Types[i](size));
41582
+ }
41583
+ return cell3;
41584
+ };
41585
+ if (isArrowTable(values2)) {
41586
+ const numRows = values2.numRows;
41587
+ if (numRows === 0)
41588
+ return [];
41589
+ const index2 = values2.getChild("index").toArray();
41590
+ const value = aggr.map((name2) => values2.getChild(name2).toArray());
41591
+ const groups2 = groupby.map((name2) => values2.getChild(name2));
41592
+ for (let row = 0; row < numRows; ++row) {
41593
+ const key = groups2.map((vec2) => vec2.get(row));
41594
+ const cell3 = getCell(key);
41595
+ for (let i = 0; i < numAggr; ++i) {
41596
+ cell3[aggr[i]][index2[row]] = value[i][row];
41597
+ }
41598
+ }
41599
+ } else {
41600
+ for (const row of values2) {
41601
+ const key = groupby.map((col) => row[col]);
41602
+ const cell3 = getCell(key);
41603
+ for (let i = 0; i < numAggr; ++i) {
41604
+ cell3[aggr[i]][row.index] = row[aggr[i]];
41605
+ }
41606
+ }
41607
+ }
41608
+ return Object.values(cellMap);
41609
+ }
41610
+ function gridDomainContinuous(grids, prop) {
41611
+ let lo = 0, hi = 0;
41612
+ grids.forEach((cell3) => {
41613
+ const grid2 = cell3[prop];
41614
+ const n = grid2.length;
41615
+ for (let i = 0; i < n; ++i) {
41616
+ const v3 = grid2[i];
41617
+ if (v3 < lo)
41618
+ lo = v3;
41619
+ if (v3 > hi)
41620
+ hi = v3;
41621
+ }
41622
+ });
41623
+ return lo === 0 && hi === 0 ? [0, 1] : [lo, hi];
41624
+ }
41625
+ function gridDomainDiscrete(grids, prop) {
41626
+ const values2 = new InternSet();
41627
+ grids.forEach((cell3) => {
41628
+ const grid2 = cell3[prop];
41629
+ const n = grid2.length;
41630
+ for (let i = 0; i < n; ++i) {
41631
+ values2.add(grid2[i]);
41632
+ }
41633
+ });
41634
+ return Array.from(values2).sort(ascending);
41635
+ }
41636
+
41400
41637
  // ../plot/src/marks/util/handle-param.js
41401
41638
  function handleParam(client, key, param, update2) {
41402
41639
  if (isParam(param)) {
@@ -41581,64 +41818,17 @@ function dericheInitZeroPad(dest, src, N2, stride, b2, p2, a3, q2, sum5, h2) {
41581
41818
  return;
41582
41819
  }
41583
41820
 
41584
- // ../plot/src/marks/util/grid.js
41585
- function grid1d(n, values2) {
41586
- return valuesToGrid(new Float64Array(n), values2);
41587
- }
41588
- function grid2d(m2, n, values2, groupby = []) {
41589
- return groupby.length ? Object.values(groupedValuesToGrids(m2 * n, values2, groupby)) : [{ grid: valuesToGrid(new Float64Array(m2 * n), values2) }];
41590
- }
41591
- function valuesToGrid(grid2, values2) {
41592
- if (isArrowTable(values2)) {
41593
- const numRows = values2.numRows;
41594
- if (numRows === 0)
41595
- return grid2;
41596
- const index2 = values2.getChild("index").toArray();
41597
- const value = values2.getChild("value").toArray();
41598
- for (let row = 0; row < numRows; ++row) {
41599
- grid2[index2[row]] = value[row];
41600
- }
41601
- } else {
41602
- for (const row of values2) {
41603
- grid2[row.index] = row.value;
41604
- }
41605
- }
41606
- return grid2;
41607
- }
41608
- function groupedValuesToGrids(size, values2, groupby) {
41609
- const grids = {};
41610
- const getGrid = (key) => {
41611
- const cell3 = grids[key] || (grids[key] = { key, grid: new Float64Array(size) });
41612
- return cell3.grid;
41613
- };
41614
- if (isArrowTable(values2)) {
41615
- const numRows = values2.numRows;
41616
- if (numRows === 0)
41617
- return grids;
41618
- const index2 = values2.getChild("index").toArray();
41619
- const value = values2.getChild("value").toArray();
41620
- const groups2 = groupby.map((name2) => values2.getChild(name2));
41621
- for (let row = 0; row < numRows; ++row) {
41622
- const key = groups2.map((vec2) => vec2.get(row));
41623
- getGrid(key)[index2[row]] = value[row];
41624
- }
41625
- } else {
41626
- for (const row of values2) {
41627
- const key = groupby.map((col) => row[col]);
41628
- getGrid(key)[row.index] = row.value;
41629
- }
41630
- }
41631
- return grids;
41632
- }
41633
-
41634
41821
  // ../plot/src/marks/Grid2DMark.js
41822
+ var DENSITY = "density";
41635
41823
  var Grid2DMark = class extends Mark2 {
41636
41824
  constructor(type2, source, options) {
41637
41825
  const {
41638
- bandwidth = 20,
41639
- binType = "linear",
41640
- binWidth = 2,
41641
- binPad = 1,
41826
+ bandwidth = 0,
41827
+ interpolate = "none",
41828
+ pixelSize = 1,
41829
+ pad: pad3 = 1,
41830
+ width: width2,
41831
+ height: height2,
41642
41832
  ...channels
41643
41833
  } = options;
41644
41834
  const densityMap = createDensityMap(channels);
@@ -41647,9 +41837,11 @@ var Grid2DMark = class extends Mark2 {
41647
41837
  handleParam(this, "bandwidth", bandwidth, () => {
41648
41838
  return this.grids ? this.convolve().update() : null;
41649
41839
  });
41650
- handleParam(this, "binWidth", binWidth);
41651
- handleParam(this, "binType", binType);
41652
- handleParam(this, "binPad", binPad);
41840
+ handleParam(this, "pixelSize", pixelSize);
41841
+ handleParam(this, "interpolate", interpolate);
41842
+ handleParam(this, "pad", pad3);
41843
+ handleParam(this, "width", width2);
41844
+ handleParam(this, "height", height2);
41653
41845
  }
41654
41846
  setPlot(plot3, index2) {
41655
41847
  const update2 = () => {
@@ -41666,64 +41858,80 @@ var Grid2DMark = class extends Mark2 {
41666
41858
  return xdom && ydom && !xdom[Transient] && !ydom[Transient];
41667
41859
  }
41668
41860
  query(filter3 = []) {
41669
- const { plot: plot3, binType, binPad, channels, densityMap, source } = this;
41861
+ const { interpolate, pad: pad3, channels, densityMap, source } = this;
41670
41862
  const [x06, x12] = this.extentX = extentX(this, filter3);
41671
41863
  const [y06, y12] = this.extentY = extentY(this, filter3);
41672
41864
  const [nx, ny] = this.bins = this.binDimensions(this);
41673
- const bx = binField(this, "x");
41674
- const by = binField(this, "y");
41675
- const rx = !!plot3.getAttribute("xReverse");
41676
- const ry = !!plot3.getAttribute("yReverse");
41677
- const x4 = bin1d2(bx, x06, x12, nx, rx, this.binPad);
41678
- const y4 = bin1d2(by, y06, y12, ny, ry, this.binPad);
41679
- const bounds = binPad ? [isBetween(bx, [x06, x12]), isBetween(by, [y06, y12])] : [lte(x06, bx), lt(bx, x12), lte(y06, by), lt(by, y12)];
41865
+ const [x4, bx] = binExpr(this, "x", nx, [x06, x12], pad3);
41866
+ const [y4, by] = binExpr(this, "y", ny, [y06, y12], pad3);
41867
+ const bounds = pad3 ? [isBetween(bx, [+x06, +x12]), isBetween(by, [+y06, +y12])] : [lte(+x06, bx), lt(bx, +x12), lte(+y06, by), lt(by, +y12)];
41680
41868
  const q2 = Query.from(source.table).where(filter3.concat(bounds));
41681
41869
  const groupby = this.groupby = [];
41682
- let agg2 = count();
41870
+ const aggrMap = {};
41683
41871
  for (const c4 of channels) {
41684
41872
  if (Object.hasOwn(c4, "field")) {
41685
41873
  const { as, channel, field: field2 } = c4;
41686
41874
  if (field2.aggregate) {
41687
- agg2 = field2;
41875
+ aggrMap[channel] = field2;
41688
41876
  densityMap[channel] = true;
41689
41877
  } else if (channel === "weight") {
41690
- agg2 = sum2(field2);
41878
+ aggrMap[DENSITY] = sum2(field2);
41691
41879
  } else if (channel !== "x" && channel !== "y") {
41692
41880
  q2.select({ [as]: field2 });
41693
41881
  groupby.push(as);
41694
41882
  }
41695
41883
  }
41696
41884
  }
41697
- return binType === "linear" ? binLinear2d(q2, x4, y4, agg2, nx, groupby) : bin2d(q2, x4, y4, agg2, nx, groupby);
41885
+ const aggr = this.aggr = Object.keys(aggrMap);
41886
+ if (aggrMap.density && aggr.length > 1) {
41887
+ throw new Error("Weight option can not be used with custom aggregates.");
41888
+ }
41889
+ if (!aggr.length) {
41890
+ aggr.push(DENSITY);
41891
+ aggrMap.density = count();
41892
+ }
41893
+ if (interpolate === "linear") {
41894
+ if (aggr.length > 1) {
41895
+ throw new Error("Linear binning not applicable to multiple aggregates.");
41896
+ }
41897
+ if (!aggrMap.density) {
41898
+ throw new Error("Linear binning not applicable to custom aggregates.");
41899
+ }
41900
+ return binLinear2d(q2, x4, y4, aggrMap[DENSITY], nx, groupby);
41901
+ } else {
41902
+ return bin2d(q2, x4, y4, aggrMap, nx, groupby);
41903
+ }
41698
41904
  }
41699
41905
  binDimensions() {
41700
- const { plot: plot3, binWidth } = this;
41906
+ const { plot: plot3, pixelSize, width: width2, height: height2 } = this;
41701
41907
  return [
41702
- Math.round(plot3.innerWidth() / binWidth),
41703
- Math.round(plot3.innerHeight() / binWidth)
41908
+ width2 ?? Math.round(plot3.innerWidth() / pixelSize),
41909
+ height2 ?? Math.round(plot3.innerHeight() / pixelSize)
41704
41910
  ];
41705
41911
  }
41706
41912
  queryResult(data) {
41707
41913
  const [nx, ny] = this.bins;
41708
- this.grids = grid2d(nx, ny, data, this.groupby);
41914
+ this.grids = grid2d(nx, ny, data, this.aggr, this.groupby);
41709
41915
  return this.convolve();
41710
41916
  }
41711
41917
  convolve() {
41712
- const { bandwidth, bins: bins2, grids, plot: plot3 } = this;
41713
- if (bandwidth <= 0) {
41714
- this.kde = this.grids.map(({ key, grid: grid2 }) => {
41715
- return grid2.key = key, grid2;
41716
- });
41717
- } else {
41918
+ const { aggr, bandwidth, bins: bins2, grids, plot: plot3 } = this;
41919
+ this.kde = this.grids;
41920
+ if (bandwidth > 0) {
41921
+ const gridProp = aggr.length === 1 ? aggr[0] : aggr.includes(DENSITY) ? DENSITY : null;
41922
+ if (!gridProp) {
41923
+ console.warn("No compatible grid found for smoothing.");
41924
+ return this;
41925
+ }
41718
41926
  const w = plot3.innerWidth();
41719
41927
  const h2 = plot3.innerHeight();
41720
41928
  const [nx, ny] = bins2;
41721
- const neg = grids.some(({ grid: grid2 }) => grid2.some((v3) => v3 < 0));
41929
+ const neg = grids.some((cell3) => cell3[gridProp].some((v3) => v3 < 0));
41722
41930
  const configX = dericheConfig(bandwidth * (nx - 1) / w, neg);
41723
41931
  const configY = dericheConfig(bandwidth * (ny - 1) / h2, neg);
41724
- this.kde = this.grids.map(({ key, grid: grid2 }) => {
41725
- const k3 = dericheConv2d(configX, configY, grid2, bins2);
41726
- return k3.key = key, k3;
41932
+ this.kde = this.grids.map((grid2) => {
41933
+ const density3 = dericheConv2d(configX, configY, grid2[gridProp], bins2);
41934
+ return { ...grid2, [gridProp]: density3 };
41727
41935
  });
41728
41936
  }
41729
41937
  return this;
@@ -41742,19 +41950,14 @@ function createDensityMap(channels) {
41742
41950
  }
41743
41951
  return densityMap;
41744
41952
  }
41745
- function bin1d2(x4, x06, x12, n, reverse3, pad3) {
41746
- const d = (n - pad3) / (x12 - x06);
41747
- const f2 = d !== 1 ? ` * ${d}::DOUBLE` : "";
41748
- return reverse3 ? sql`(${x12} - ${x4}::DOUBLE)${f2}` : sql`(${x4}::DOUBLE - ${x06})${f2}`;
41749
- }
41750
- function bin2d(q2, xp, yp, value, xn, groupby) {
41953
+ function bin2d(q2, xp, yp, aggs, xn, groupby) {
41751
41954
  return q2.select({
41752
41955
  index: sql`FLOOR(${xp})::INTEGER + FLOOR(${yp})::INTEGER * ${xn}`,
41753
- value
41956
+ ...aggs
41754
41957
  }).groupby("index", groupby);
41755
41958
  }
41756
- function binLinear2d(q2, xp, yp, value, xn, groupby) {
41757
- const w = value.column ? `* ${value.column}` : "";
41959
+ function binLinear2d(q2, xp, yp, density3, xn, groupby) {
41960
+ const w = density3?.column ? `* ${density3.column}` : "";
41758
41961
  const subq = (i, w2) => q2.clone().select({ xp, yp, i, w: w2 });
41759
41962
  const a3 = subq(
41760
41963
  sql`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${xn}`,
@@ -41772,14 +41975,19 @@ function binLinear2d(q2, xp, yp, value, xn, groupby) {
41772
41975
  sql`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${xn}`,
41773
41976
  sql`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${w}`
41774
41977
  );
41775
- return Query.from(Query.unionAll(a3, b2, c4, d)).select({ index: "i", value: sum2("w") }, groupby).groupby("index", groupby).having(gt("value", 0));
41978
+ return Query.from(Query.unionAll(a3, b2, c4, d)).select({ index: "i", density: sum2("w") }, groupby).groupby("index", groupby).having(neq("density", 0));
41776
41979
  }
41777
41980
 
41778
41981
  // ../plot/src/marks/ContourMark.js
41779
41982
  var ContourMark = class extends Grid2DMark {
41780
41983
  constructor(source, options) {
41781
41984
  const { thresholds = 10, ...channels } = options;
41782
- super("geo", source, channels);
41985
+ super("geo", source, {
41986
+ bandwidth: 20,
41987
+ interpolate: "linear",
41988
+ pixelSize: 2,
41989
+ ...channels
41990
+ });
41783
41991
  handleParam(this, "thresholds", thresholds, () => {
41784
41992
  return this.grids ? this.contours().update() : null;
41785
41993
  });
@@ -41788,11 +41996,11 @@ var ContourMark = class extends Grid2DMark {
41788
41996
  return super.convolve().contours();
41789
41997
  }
41790
41998
  contours() {
41791
- const { bins: bins2, densityMap, kde, thresholds, groupby, plot: plot3 } = this;
41999
+ const { bins: bins2, densityMap, kde, thresholds, plot: plot3 } = this;
41792
42000
  let tz = thresholds;
41793
42001
  if (!Array.isArray(tz)) {
41794
- const scale3 = max2(kde.map((k3) => max2(k3)));
41795
- tz = Array.from({ length: tz - 1 }, (_2, i) => scale3 * (i + 1) / tz);
42002
+ const [, hi] = gridDomainContinuous(kde, "density");
42003
+ tz = Array.from({ length: tz - 1 }, (_2, i) => hi * (i + 1) / tz);
41796
42004
  }
41797
42005
  if (densityMap.fill || densityMap.stroke) {
41798
42006
  if (this.plot.getAttribute("colorScale") !== "log") {
@@ -41809,11 +42017,11 @@ var ContourMark = class extends Grid2DMark {
41809
42017
  const x4 = (v3) => xo + v3 * sx;
41810
42018
  const y4 = (v3) => yo + v3 * sy;
41811
42019
  const contour3 = contours_default().size(bins2);
41812
- this.data = kde.flatMap((k3) => tz.map((t) => {
41813
- const c4 = transform2(contour3.contour(k3, t), x4, y4);
41814
- groupby.forEach((name2, i) => c4[name2] = k3.key[i]);
41815
- c4.density = t;
41816
- return c4;
42020
+ this.data = kde.flatMap((cell3) => tz.map((t) => {
42021
+ return Object.assign(
42022
+ transform2(contour3.contour(cell3.density, t), x4, y4),
42023
+ { ...cell3, density: t }
42024
+ );
41817
42025
  }));
41818
42026
  return this;
41819
42027
  }
@@ -41849,23 +42057,95 @@ function transform2(geometry, x4, y4) {
41849
42057
  }
41850
42058
 
41851
42059
  // ../plot/src/marks/util/raster.js
41852
- function raster2(grid2, data, w, h2, scale3, scheme28) {
41853
- const n = (scheme28.length >> 2) - 1;
41854
- for (let j2 = 0, k3 = 0; j2 < h2; ++j2) {
41855
- for (let i = 0, row = (h2 - j2 - 1) * w; i < w; ++i, k3 += 4) {
41856
- const c4 = n * scale3(grid2[i + row]) << 2;
41857
- data[k3 + 0] = scheme28[c4 + 0];
41858
- data[k3 + 1] = scheme28[c4 + 1];
41859
- data[k3 + 2] = scheme28[c4 + 2];
41860
- data[k3 + 3] = scheme28[c4 + 3];
41861
- }
42060
+ function createCanvas(w, h2) {
42061
+ if (typeof document !== "undefined") {
42062
+ const c4 = document.createElement("canvas");
42063
+ c4.setAttribute("width", w);
42064
+ c4.setAttribute("height", h2);
42065
+ return c4;
41862
42066
  }
42067
+ throw new Error("Can not create a canvas instance.");
42068
+ }
42069
+ function alphaConstant(v3 = 1) {
42070
+ const a3 = 255 * v3 | 0;
42071
+ return (data, w, h2) => {
42072
+ for (let j2 = 0, k3 = 0; j2 < h2; ++j2) {
42073
+ for (let i = 0; i < w; ++i, k3 += 4) {
42074
+ data[k3 + 3] = a3;
42075
+ }
42076
+ }
42077
+ };
42078
+ }
42079
+ function alphaScheme(scale3) {
42080
+ const { apply: apply2 } = scale3;
42081
+ return (data, w, h2, grid2) => {
42082
+ for (let j2 = 0, k3 = 0; j2 < h2; ++j2) {
42083
+ for (let i = 0, row = (h2 - j2 - 1) * w; i < w; ++i, k3 += 4) {
42084
+ data[k3 + 3] = 255 * apply2(grid2[i + row]) | 0;
42085
+ }
42086
+ }
42087
+ };
42088
+ }
42089
+ function colorConstant(v3 = {}) {
42090
+ const { r = 0, g: g2 = 0, b: b2 = 0, opacity: opacity2 = 1 } = typeof v3 === "string" ? rgb(v3) : v3;
42091
+ const c4 = new Uint8ClampedArray([r, g2, b2, 255 * opacity2 | 0]);
42092
+ return (data, w, h2) => {
42093
+ for (let j2 = 0, k3 = 0; j2 < h2; ++j2) {
42094
+ for (let i = 0; i < w; ++i, k3 += 4) {
42095
+ data[k3 + 0] = c4[0];
42096
+ data[k3 + 1] = c4[1];
42097
+ data[k3 + 2] = c4[2];
42098
+ data[k3 + 3] = c4[3];
42099
+ }
42100
+ }
42101
+ };
41863
42102
  }
41864
- function palette(size, interp) {
42103
+ function colorCategory(scale3) {
42104
+ const { domain, range: range3 } = scale3;
42105
+ const idx = /* @__PURE__ */ Object.create(null);
42106
+ const p2 = new Uint8ClampedArray(4 * domain.length);
42107
+ const n = domain.length - 1;
42108
+ const m2 = range3.length;
42109
+ for (let i = 0; i <= n; ++i) {
42110
+ const v3 = range3[i % m2];
42111
+ const { r, g: g2, b: b2, opacity: opacity2 = 1 } = typeof v3 === "string" ? rgb(v3) : v3;
42112
+ const k3 = i << 2;
42113
+ p2[k3 + 0] = r;
42114
+ p2[k3 + 1] = g2;
42115
+ p2[k3 + 2] = b2;
42116
+ p2[k3 + 3] = 255 * opacity2 | 0;
42117
+ idx[domain[i]] = k3;
42118
+ }
42119
+ return (data, w, h2, grid2) => {
42120
+ if (grid2.map) {
42121
+ for (let j2 = 0, k3 = 0; j2 < h2; ++j2) {
42122
+ for (let i = 0, row = (h2 - j2 - 1) * w; i < w; ++i, k3 += 4) {
42123
+ const c4 = idx[grid2[i + row]];
42124
+ data[k3 + 0] = p2[c4 + 0];
42125
+ data[k3 + 1] = p2[c4 + 1];
42126
+ data[k3 + 2] = p2[c4 + 2];
42127
+ data[k3 + 3] = p2[c4 + 3];
42128
+ }
42129
+ }
42130
+ } else {
42131
+ const c4 = idx[grid2];
42132
+ for (let j2 = 0, k3 = 0; j2 < h2; ++j2) {
42133
+ for (let i = 0; i < w; ++i, k3 += 4) {
42134
+ data[k3 + 0] = p2[c4 + 0];
42135
+ data[k3 + 1] = p2[c4 + 1];
42136
+ data[k3 + 2] = p2[c4 + 2];
42137
+ data[k3 + 3] = p2[c4 + 3];
42138
+ }
42139
+ }
42140
+ }
42141
+ };
42142
+ }
42143
+ function colorScheme(size, scale3, frac) {
42144
+ const { interpolate } = scale3;
41865
42145
  const p2 = new Uint8ClampedArray(4 * size);
41866
42146
  const n = size - 1;
41867
42147
  for (let i = 0; i <= n; ++i) {
41868
- const v3 = interp(i / n);
42148
+ const v3 = interpolate(i / n);
41869
42149
  const { r, g: g2, b: b2, opacity: opacity2 = 1 } = typeof v3 === "string" ? rgb(v3) : v3;
41870
42150
  const k3 = i << 2;
41871
42151
  p2[k3 + 0] = r;
@@ -41873,20 +42153,17 @@ function palette(size, interp) {
41873
42153
  p2[k3 + 2] = b2;
41874
42154
  p2[k3 + 3] = 255 * opacity2 | 0;
41875
42155
  }
41876
- return p2;
41877
- }
41878
- function createCanvas(w, h2) {
41879
- if (typeof document !== "undefined") {
41880
- const c4 = document.createElement("canvas");
41881
- c4.setAttribute("width", w);
41882
- c4.setAttribute("height", h2);
41883
- return c4;
41884
- }
41885
- throw new Error("Can not create a canvas instance.");
41886
- }
41887
- function opacityMap(color3 = "black") {
41888
- const { r, g: g2, b: b2 } = rgb(color3);
41889
- return (opacity2) => ({ r, g: g2, b: b2, opacity: opacity2 });
42156
+ return (data, w, h2, grid2) => {
42157
+ for (let j2 = 0, k3 = 0; j2 < h2; ++j2) {
42158
+ for (let i = 0, row = (h2 - j2 - 1) * w; i < w; ++i, k3 += 4) {
42159
+ const c4 = n * frac(grid2[i + row]) << 2;
42160
+ data[k3 + 0] = p2[c4 + 0];
42161
+ data[k3 + 1] = p2[c4 + 1];
42162
+ data[k3 + 2] = p2[c4 + 2];
42163
+ data[k3 + 3] = p2[c4 + 3];
42164
+ }
42165
+ }
42166
+ };
41890
42167
  }
41891
42168
 
41892
42169
  // ../plot/src/marks/RasterMark.js
@@ -41906,15 +42183,13 @@ var RasterMark = class extends Grid2DMark {
41906
42183
  return super.convolve().rasterize();
41907
42184
  }
41908
42185
  rasterize() {
41909
- const { bins: bins2, kde, groupby } = this;
42186
+ const { bins: bins2, kde } = this;
41910
42187
  const [w, h2] = bins2;
41911
42188
  const { canvas, ctx, img } = imageData(this, w, h2);
41912
- const s2 = imageScale(this);
41913
- const idx = groupby.indexOf(this.channelField("fill")?.as);
41914
- const domain = idx < 0 ? [] : kde.map(({ key }) => key[idx]);
41915
- this.data = kde.map((grid2) => {
41916
- const palette2 = imagePalette(this, domain, grid2.key?.[idx]);
41917
- raster2(grid2, img.data, w, h2, s2, palette2);
42189
+ const { alpha, alphaProp, color: color3, colorProp } = rasterEncoding(this);
42190
+ this.data = kde.map((cell3) => {
42191
+ color3?.(img.data, w, h2, cell3[colorProp]);
42192
+ alpha?.(img.data, w, h2, cell3[alphaProp]);
41918
42193
  ctx.putImageData(img, 0, 0);
41919
42194
  return { src: canvas.toDataURL() };
41920
42195
  });
@@ -41933,6 +42208,128 @@ var RasterMark = class extends Grid2DMark {
41933
42208
  return [{ type: type2, data, options }];
41934
42209
  }
41935
42210
  };
42211
+ var HeatmapMark = class extends RasterMark {
42212
+ constructor(source, options) {
42213
+ super(source, {
42214
+ bandwidth: 20,
42215
+ interpolate: "linear",
42216
+ pixelSize: 2,
42217
+ ...options
42218
+ });
42219
+ }
42220
+ };
42221
+ function rasterEncoding(mark2) {
42222
+ const { aggr, densityMap, groupby, plot: plot3 } = mark2;
42223
+ const hasDensity = aggr.includes(DENSITY);
42224
+ const hasFillOpacity = aggr.includes("fillOpacity");
42225
+ const fillEntry = mark2.channel("fill");
42226
+ const opacEntry = mark2.channel("fillOpacity");
42227
+ if (aggr.length > 2 || hasDensity && hasFillOpacity) {
42228
+ throw new Error("Invalid raster encodings. Try dropping an aggregate?");
42229
+ }
42230
+ if (groupby.includes(opacEntry?.as)) {
42231
+ throw new Error("Raster fillOpacity must be an aggregate or constant.");
42232
+ }
42233
+ const fill = densityMap.fill || aggr.includes("fill") ? "grid" : groupby.includes(fillEntry?.as) ? "group" : isColor2(fillEntry?.value) ? fillEntry.value : hasDensity && plot3.getAttribute("colorScheme") ? "grid" : void 0;
42234
+ const opac = densityMap.fillOpacity || aggr.includes("fillOpacity") ? "grid" : typeof opacEntry?.value === "number" ? opacEntry.value : hasDensity && fill !== "grid" ? "grid" : void 0;
42235
+ if (fill !== "grid" && opac !== "grid") {
42236
+ throw new Error("Raster mark missing density values.");
42237
+ }
42238
+ const colorProp = fillEntry?.as ?? (fill === "grid" ? DENSITY : null);
42239
+ const alphaProp = opacEntry?.as ?? (opac === "grid" ? DENSITY : null);
42240
+ const color3 = fill !== "grid" && fill !== "group" ? colorConstant(fill) : colorScale(mark2, colorProp);
42241
+ const alpha = opac !== "grid" ? alphaConstant(opac) : alphaScale(mark2, alphaProp);
42242
+ return { alphaProp, colorProp, alpha, color: color3 };
42243
+ }
42244
+ function alphaScale(mark2, prop) {
42245
+ const { plot: plot3, kde: grids } = mark2;
42246
+ const domainAttr = plot3.getAttribute("opacityDomain");
42247
+ const domainFixed = domainAttr === Fixed;
42248
+ const domainTransient = domainAttr?.[Transient];
42249
+ const domain = !domainFixed && !domainTransient && domainAttr || gridDomainContinuous(grids, prop);
42250
+ if (domainFixed || domainTransient) {
42251
+ if (domainTransient)
42252
+ domain[Transient] = true;
42253
+ plot3.setAttribute("colorDomain", domain);
42254
+ }
42255
+ const s2 = scale2({
42256
+ opacity: {
42257
+ type: plot3.getAttribute("opacityScale"),
42258
+ domain,
42259
+ clamp: plot3.getAttribute("opacityClamp"),
42260
+ nice: plot3.getAttribute("opacityNice"),
42261
+ reverse: plot3.getAttribute("opacityReverse"),
42262
+ zero: plot3.getAttribute("opacityZero"),
42263
+ base: plot3.getAttribute("opacityBase"),
42264
+ exponent: plot3.getAttribute("opacityExponent"),
42265
+ constant: plot3.getAttribute("opacityConstant")
42266
+ }
42267
+ });
42268
+ return alphaScheme(s2);
42269
+ }
42270
+ function colorScale(mark2, prop) {
42271
+ const { plot: plot3, kde: grids } = mark2;
42272
+ const flat = !grids[0][prop]?.map;
42273
+ const discrete = flat || Array.isArray(grids[0][prop]);
42274
+ const domainAttr = plot3.getAttribute("colorDomain");
42275
+ const domainFixed = domainAttr === Fixed;
42276
+ const domainTransient = domainAttr?.[Transient];
42277
+ const domain = !domainFixed && !domainTransient && domainAttr || (flat ? grids.map((cell3) => cell3[prop]).sort(ascending) : discrete ? gridDomainDiscrete(grids, prop) : gridDomainContinuous(grids, prop));
42278
+ if (domainFixed || domainTransient) {
42279
+ if (domainTransient)
42280
+ domain[Transient] = true;
42281
+ plot3.setAttribute("colorDomain", domain);
42282
+ }
42283
+ const s2 = scale2({
42284
+ color: {
42285
+ type: plot3.getAttribute("colorScale"),
42286
+ domain,
42287
+ range: plot3.getAttribute("colorRange"),
42288
+ clamp: plot3.getAttribute("colorClamp"),
42289
+ n: plot3.getAttribute("colorN"),
42290
+ nice: plot3.getAttribute("colorNice"),
42291
+ reverse: plot3.getAttribute("colorReverse"),
42292
+ scheme: plot3.getAttribute("colorScheme"),
42293
+ interpolate: plot3.getAttribute("colorInterpolate"),
42294
+ pivot: plot3.getAttribute("colorPivot"),
42295
+ symmetric: plot3.getAttribute("colorSymmetric"),
42296
+ zero: plot3.getAttribute("colorZero"),
42297
+ base: plot3.getAttribute("colorBase"),
42298
+ exponent: plot3.getAttribute("colorExponent"),
42299
+ constant: plot3.getAttribute("colorConstant")
42300
+ }
42301
+ });
42302
+ if (discrete) {
42303
+ return colorCategory(s2);
42304
+ } else {
42305
+ const frac = scale2({
42306
+ x: {
42307
+ type: inferScaleType2(s2.type),
42308
+ domain: s2.domain,
42309
+ reverse: s2.reverse,
42310
+ range: [0, 1],
42311
+ clamp: s2.clamp,
42312
+ base: s2.base,
42313
+ exponent: s2.exponent,
42314
+ constant: s2.constant
42315
+ }
42316
+ });
42317
+ return colorScheme(1024, s2, frac.apply);
42318
+ }
42319
+ }
42320
+ function inferScaleType2(type2) {
42321
+ if (type2.endsWith("symlog"))
42322
+ return "symlog";
42323
+ if (type2.endsWith("log"))
42324
+ return "log";
42325
+ if (type2.endsWith("pow"))
42326
+ return "pow";
42327
+ if (type2.endsWith("sqrt"))
42328
+ return "sqrt";
42329
+ if (type2 === "diverging")
42330
+ return "linear";
42331
+ return type2;
42332
+ }
41936
42333
  function imageData(mark2, w, h2) {
41937
42334
  if (!mark2.image || mark2.image.w !== w || mark2.image.h !== h2) {
41938
42335
  const canvas = createCanvas(w, h2);
@@ -41942,71 +42339,21 @@ function imageData(mark2, w, h2) {
41942
42339
  }
41943
42340
  return mark2.image;
41944
42341
  }
41945
- function imageScale(mark2) {
41946
- const { densityMap, kde, plot: plot3 } = mark2;
41947
- let domain = densityMap.fill && plot3.getAttribute("colorDomain");
41948
- if (!domain) {
41949
- let lo = 0, hi = 0;
41950
- kde.forEach((grid2) => {
41951
- for (const v3 of grid2) {
41952
- if (v3 < lo)
41953
- lo = v3;
41954
- if (v3 > hi)
41955
- hi = v3;
41956
- }
41957
- });
41958
- domain = lo === 0 && hi === 0 ? [0, 1] : [lo, hi];
41959
- }
41960
- const type2 = plot3.getAttribute("colorScale");
41961
- return scale2({ x: { type: type2, domain, range: [0, 1] } }).apply;
41962
- }
41963
- function imagePalette(mark2, domain, value, steps = 1024) {
41964
- const { densityMap, plot: plot3 } = mark2;
41965
- const scheme28 = plot3.getAttribute("colorScheme");
41966
- const fill = mark2.channel("fill");
41967
- let color3 = isColor2(fill?.value) ? fill.value : void 0;
41968
- if (densityMap.fill || scheme28 && !color3) {
41969
- if (scheme28) {
41970
- try {
41971
- return palette(
41972
- steps,
41973
- scale2({ color: { scheme: scheme28, domain: [0, 1] } }).interpolate
41974
- );
41975
- } catch (err) {
41976
- console.warn(err);
41977
- }
41978
- }
41979
- } else if (domain.length) {
41980
- const range3 = plot3.getAttribute("colorRange");
41981
- const spec = {
41982
- domain,
41983
- range: range3,
41984
- scheme: scheme28 || (range3 ? void 0 : "tableau10")
41985
- };
41986
- color3 = scale2({ color: spec }).apply(value);
41987
- }
41988
- return palette(steps, opacityMap(color3));
41989
- }
41990
42342
 
41991
42343
  // ../plot/src/marks/DenseLineMark.js
41992
42344
  var DenseLineMark = class extends RasterMark {
41993
42345
  constructor(source, options) {
41994
42346
  const { normalize: normalize4 = true, ...rest } = options;
41995
- super(source, { bandwidth: 0, ...rest });
42347
+ super(source, rest);
41996
42348
  handleParam(this, "normalize", normalize4);
41997
42349
  }
41998
42350
  query(filter3 = []) {
41999
- const { plot: plot3, channels, normalize: normalize4, source } = this;
42000
- const [x06, x12] = extentX(this, filter3);
42001
- const [y06, y12] = extentY(this, filter3);
42351
+ const { channels, normalize: normalize4, source, binPad } = this;
42002
42352
  const [nx, ny] = this.bins = this.binDimensions(this);
42003
- const bx = binField(this, "x");
42004
- const by = binField(this, "y");
42005
- const rx = !!plot3.getAttribute("xReverse");
42006
- const ry = !!plot3.getAttribute("yReverse");
42007
- const x4 = bin1d(bx, x06, x12, nx, rx, this.binPad);
42008
- const y4 = bin1d(by, y06, y12, ny, ry, this.binPad);
42353
+ const [x4] = binExpr(this, "x", nx, extentX(this, filter3), binPad);
42354
+ const [y4] = binExpr(this, "y", ny, extentY(this, filter3), binPad);
42009
42355
  const q2 = Query.from(source.table).where(stripXY(this, filter3));
42356
+ this.aggr = ["density"];
42010
42357
  const groupby = this.groupby = [];
42011
42358
  const z2 = [];
42012
42359
  for (const c4 of channels) {
@@ -42053,7 +42400,7 @@ function lineDensity(q2, x4, y4, z2, xn, yn, groupby = [], normalize4 = true) {
42053
42400
  ));
42054
42401
  const num = Query.select({ x: sql`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))` }).from("pairs");
42055
42402
  const indices = Query.select({ i: sql`UNNEST(range((${num})))::INTEGER` });
42056
- const raster4 = Query.unionAll(
42403
+ const raster3 = Query.unionAll(
42057
42404
  Query.select(groups2, {
42058
42405
  x: sql`x0 + i`,
42059
42406
  y: sql`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`
@@ -42070,10 +42417,10 @@ function lineDensity(q2, x4, y4, z2, xn, yn, groupby = [], normalize4 = true) {
42070
42417
  "x",
42071
42418
  "y",
42072
42419
  normalize4 ? { w: sql`1.0 / COUNT(*) OVER (PARTITION BY ${pointPart})` } : null
42073
- ).where(and(isBetween("x", [0, xn]), isBetween("y", [0, yn])));
42074
- return Query.with({ pairs: pairs2, indices, raster: raster4, points: points2 }).from("points").select(groupby, {
42420
+ ).where(and(isBetween("x", [0, xn], true), isBetween("y", [0, yn], true)));
42421
+ return Query.with({ pairs: pairs2, indices, raster: raster3, points: points2 }).from("points").select(groupby, {
42075
42422
  index: sql`x + y * ${xn}::INTEGER`,
42076
- value: normalize4 ? sum2("w") : count()
42423
+ density: normalize4 ? sum2("w") : count()
42077
42424
  }).groupby("index", groupby);
42078
42425
  }
42079
42426
 
@@ -42098,13 +42445,11 @@ var Density1DMark = class extends Mark2 {
42098
42445
  if (this.hasOwnData())
42099
42446
  throw new Error("Density1DMark requires a data source");
42100
42447
  const { bins: bins2, channels, dim, source: { table: table3 } } = this;
42101
- const [lo, hi] = this.extent = (dim === "x" ? extentX : extentY)(this, filter3);
42102
- const bx = binField(this, dim);
42103
- return binLinear1d(
42104
- markQuery(channels, table3, [dim]).where(filter3.concat(isBetween(bx, [lo, hi]))),
42105
- bin1d(bx, lo, hi, bins2),
42106
- this.channelField("weight") ? "weight" : null
42107
- );
42448
+ const extent4 = this.extent = (dim === "x" ? extentX : extentY)(this, filter3);
42449
+ const [x4, bx] = binExpr(this, dim, bins2, extent4);
42450
+ const q2 = markQuery(channels, table3, [dim]).where(filter3.concat(isBetween(bx, extent4)));
42451
+ const v3 = this.channelField("weight") ? "weight" : null;
42452
+ return binLinear1d(q2, x4, v3);
42108
42453
  }
42109
42454
  queryResult(data) {
42110
42455
  this.grid = grid1d(this.bins, data);
@@ -42139,8 +42484,8 @@ var Density1DMark = class extends Mark2 {
42139
42484
  return [{ type: type2, data, options }];
42140
42485
  }
42141
42486
  };
42142
- function binLinear1d(q2, p2, value) {
42143
- const w = value ? `* ${value}` : "";
42487
+ function binLinear1d(q2, p2, density3) {
42488
+ const w = density3 ? `* ${density3}` : "";
42144
42489
  const u4 = q2.clone().select({
42145
42490
  p: p2,
42146
42491
  i: sql`FLOOR(p)::INTEGER`,
@@ -42151,37 +42496,45 @@ function binLinear1d(q2, p2, value) {
42151
42496
  i: sql`FLOOR(p)::INTEGER + 1`,
42152
42497
  w: sql`(p - FLOOR(p))${w}`
42153
42498
  });
42154
- return Query.from(Query.unionAll(u4, v3)).select({ index: "i", value: sum2("w") }).groupby("index").having(gt("value", 0));
42499
+ return Query.from(Query.unionAll(u4, v3)).select({ index: "i", density: sum2("w") }).groupby("index").having(gt("density", 0));
42155
42500
  }
42156
42501
 
42157
42502
  // ../plot/src/marks/Density2DMark.js
42158
42503
  var Density2DMark = class extends Grid2DMark {
42159
42504
  constructor(source, options) {
42160
- const { type: type2 = "dot", binsX, binsY, ...channels } = options;
42161
- channels.binPad = channels.binPad ?? 0;
42162
- super(type2, source, channels);
42163
- handleParam(this, "binsX", binsX);
42164
- handleParam(this, "binsY", binsY);
42505
+ const { type: type2 = "dot", ...channels } = options;
42506
+ super(type2, source, {
42507
+ bandwidth: 20,
42508
+ interpolate: "linear",
42509
+ pad: 0,
42510
+ pixelSize: 2,
42511
+ ...channels
42512
+ });
42165
42513
  }
42166
42514
  convolve() {
42167
42515
  super.convolve();
42168
- const { bins: bins2, binPad, extentX: extentX2, extentY: extentY2 } = this;
42516
+ const { bins: bins2, pad: pad3, extentX: extentX2, extentY: extentY2 } = this;
42169
42517
  const [nx, ny] = bins2;
42170
- const [x06, x12] = extentX2;
42171
- const [y06, y12] = extentY2;
42172
- const deltaX = (x12 - x06) / (nx - binPad);
42173
- const deltaY = (y12 - y06) / (ny - binPad);
42174
- const offset2 = binPad ? 0 : 0.5;
42175
- this.data = points(this.kde, bins2, x06, y06, deltaX, deltaY, offset2);
42518
+ const scaleX = channelScale(this, "x");
42519
+ const scaleY = channelScale(this, "y");
42520
+ const [x06, x12] = extentX2.map((v3) => scaleX.apply(v3));
42521
+ const [y06, y12] = extentY2.map((v3) => scaleY.apply(v3));
42522
+ const deltaX = (x12 - x06) / (nx - pad3);
42523
+ const deltaY = (y12 - y06) / (ny - pad3);
42524
+ const offset2 = pad3 ? 0 : 0.5;
42525
+ this.data = points(
42526
+ this.kde,
42527
+ bins2,
42528
+ x06,
42529
+ y06,
42530
+ deltaX,
42531
+ deltaY,
42532
+ scaleX.invert,
42533
+ scaleY.invert,
42534
+ offset2
42535
+ );
42176
42536
  return this;
42177
42537
  }
42178
- binDimensions() {
42179
- const { plot: plot3, binWidth, binsX, binsY } = this;
42180
- return [
42181
- binsX ?? Math.round(plot3.innerWidth() / binWidth),
42182
- binsY ?? Math.round(plot3.innerHeight() / binWidth)
42183
- ];
42184
- }
42185
42538
  plotSpecs() {
42186
42539
  const { type: type2, channels, densityMap, data } = this;
42187
42540
  const options = {};
@@ -42197,16 +42550,18 @@ var Density2DMark = class extends Grid2DMark {
42197
42550
  return [{ type: type2, data, options }];
42198
42551
  }
42199
42552
  };
42200
- function points(kde, bins2, x06, y06, deltaX, deltaY, offset2) {
42553
+ function points(kde, bins2, x06, y06, deltaX, deltaY, invertX, invertY, offset2) {
42201
42554
  const scale3 = 1 / (deltaX * deltaY);
42202
42555
  const [nx, ny] = bins2;
42203
42556
  const data = [];
42204
- for (const grid2 of kde) {
42557
+ for (const cell3 of kde) {
42558
+ const grid2 = cell3.density;
42205
42559
  for (let k3 = 0, j2 = 0; j2 < ny; ++j2) {
42206
42560
  for (let i = 0; i < nx; ++i, ++k3) {
42207
42561
  data.push({
42208
- x: x06 + (i + offset2) * deltaX,
42209
- y: y06 + (j2 + offset2) * deltaY,
42562
+ ...cell3,
42563
+ x: invertX(x06 + (i + offset2) * deltaX),
42564
+ y: invertY(y06 + (j2 + offset2) * deltaY),
42210
42565
  density: grid2[k3] * scale3
42211
42566
  });
42212
42567
  }
@@ -42324,34 +42679,48 @@ var RasterTileMark = class extends Grid2DMark {
42324
42679
  return null;
42325
42680
  }
42326
42681
  tileQuery(extent4) {
42327
- const { plot: plot3, binType, binPad, channels, densityMap, source } = this;
42682
+ const { binType, binPad, channels, densityMap, source } = this;
42328
42683
  const [[x06, x12], [y06, y12]] = extent4;
42329
42684
  const [nx, ny] = this.bins;
42330
- const bx = binField(this, "x");
42331
- const by = binField(this, "y");
42332
- const rx = !!plot3.getAttribute("xReverse");
42333
- const ry = !!plot3.getAttribute("yReverse");
42334
- const x4 = bin1d3(bx, x06, x12, nx, rx, binPad);
42335
- const y4 = bin1d3(by, y06, y12, ny, ry, binPad);
42336
- const bounds = binPad ? [isBetween(bx, [x06, x12]), isBetween(by, [y06, y12])] : [lte(x06, bx), lt(bx, x12), lte(y06, by), lt(by, y12)];
42685
+ const [x4, bx] = binExpr(this, "x", nx, [x06, x12], binPad);
42686
+ const [y4, by] = binExpr(this, "y", ny, [y06, y12], binPad);
42687
+ const bounds = binPad ? [isBetween(bx, [+x06, +x12]), isBetween(by, [+y06, +y12])] : [lte(+x06, bx), lt(bx, +x12), lte(+y06, by), lt(by, +y12)];
42337
42688
  const q2 = Query.from(source.table).where(bounds);
42338
42689
  const groupby = this.groupby = [];
42339
- let agg2 = count();
42690
+ const aggrMap = {};
42340
42691
  for (const c4 of channels) {
42341
42692
  if (Object.hasOwn(c4, "field")) {
42342
- const { channel, field: field2 } = c4;
42693
+ const { as, channel, field: field2 } = c4;
42343
42694
  if (field2.aggregate) {
42344
- agg2 = field2;
42695
+ aggrMap[channel] = field2;
42345
42696
  densityMap[channel] = true;
42346
42697
  } else if (channel === "weight") {
42347
- agg2 = sum2(field2);
42698
+ aggrMap.density = sum2(field2);
42348
42699
  } else if (channel !== "x" && channel !== "y") {
42349
- q2.select({ [channel]: field2 });
42350
- groupby.push(channel);
42700
+ q2.select({ [as]: field2 });
42701
+ groupby.push(as);
42351
42702
  }
42352
42703
  }
42353
42704
  }
42354
- return binType === "linear" ? binLinear2d2(q2, x4, y4, agg2, nx, groupby) : bin2d2(q2, x4, y4, agg2, nx, groupby);
42705
+ const aggr = this.aggr = Object.keys(aggrMap);
42706
+ if (aggrMap.density && aggr.length > 1) {
42707
+ throw new Error("Weight option can not be used with custom aggregates.");
42708
+ }
42709
+ if (!aggr.length) {
42710
+ aggr.push("density");
42711
+ aggrMap.density = count();
42712
+ }
42713
+ if (binType === "linear") {
42714
+ if (aggr.length > 1) {
42715
+ throw new Error("Linear binning not applicable to multiple aggregates.");
42716
+ }
42717
+ if (!aggrMap.density) {
42718
+ throw new Error("Linear binning not applicable to custom aggregates.");
42719
+ }
42720
+ return binLinear2d2(q2, x4, y4, aggrMap.density, nx, groupby);
42721
+ } else {
42722
+ return bin2d2(q2, x4, y4, aggrMap, nx, groupby);
42723
+ }
42355
42724
  }
42356
42725
  async requestTiles() {
42357
42726
  const mc = coordinator();
@@ -42401,22 +42770,20 @@ var RasterTileMark = class extends Grid2DMark {
42401
42770
  ([i, j2]) => mc.prefetch(this.tileQuery(tileExtent(i, j2)))
42402
42771
  );
42403
42772
  const tiles = await Promise.all(queries);
42404
- this.grids = [{ grid: processTiles(m2, n, xx, yy, coords, tiles) }];
42773
+ this.grids = [{ density: processTiles(m2, n, xx, yy, coords, tiles) }];
42405
42774
  this.convolve().update();
42406
42775
  }
42407
42776
  convolve() {
42408
42777
  return super.convolve().rasterize();
42409
42778
  }
42410
42779
  rasterize() {
42411
- const { bins: bins2, kde, groupby } = this;
42780
+ const { bins: bins2, kde } = this;
42412
42781
  const [w, h2] = bins2;
42413
42782
  const { canvas, ctx, img } = imageData2(this, w, h2);
42414
- const s2 = imageScale2(this);
42415
- const idx = groupby.indexOf(this.channelField("fill")?.as);
42416
- const domain = idx < 0 ? [] : kde.map(({ key }) => key[idx]);
42417
- this.data = kde.map((grid2) => {
42418
- const palette2 = imagePalette2(this, domain, grid2.key?.[idx]);
42419
- raster2(grid2, img.data, w, h2, s2, palette2);
42783
+ const { alpha, alphaProp, color: color3, colorProp } = rasterEncoding(this);
42784
+ this.data = kde.map((cell3) => {
42785
+ color3?.(img.data, w, h2, cell3[colorProp]);
42786
+ alpha?.(img.data, w, h2, cell3[alphaProp]);
42420
42787
  ctx.putImageData(img, 0, 0);
42421
42788
  return { src: canvas.toDataURL() };
42422
42789
  });
@@ -42450,7 +42817,7 @@ function copy3(m2, n, grid2, values2, tx, ty) {
42450
42817
  if (num === 0)
42451
42818
  return;
42452
42819
  const index2 = values2.getChild("index").toArray();
42453
- const value = values2.getChild("value").toArray();
42820
+ const value = values2.getChild("density").toArray();
42454
42821
  for (let row = 0; row < num; ++row) {
42455
42822
  const idx = index2[row];
42456
42823
  const i = tx + idx % m2;
@@ -42469,60 +42836,10 @@ function imageData2(mark2, w, h2) {
42469
42836
  }
42470
42837
  return mark2.image;
42471
42838
  }
42472
- function imageScale2(mark2) {
42473
- const { densityMap, kde, plot: plot3 } = mark2;
42474
- let domain = densityMap.fill && plot3.getAttribute("colorDomain");
42475
- if (!domain) {
42476
- let lo = 0, hi = 0;
42477
- kde.forEach((grid2) => {
42478
- for (const v3 of grid2) {
42479
- if (v3 < lo)
42480
- lo = v3;
42481
- if (v3 > hi)
42482
- hi = v3;
42483
- }
42484
- });
42485
- domain = lo === 0 && hi === 0 ? [0, 1] : [lo, hi];
42486
- }
42487
- const type2 = plot3.getAttribute("colorScale");
42488
- return scale2({ x: { type: type2, domain, range: [0, 1] } }).apply;
42489
- }
42490
- function imagePalette2(mark2, domain, value, steps = 1024) {
42491
- const { densityMap, plot: plot3 } = mark2;
42492
- const scheme28 = plot3.getAttribute("colorScheme");
42493
- const fill = mark2.channel("fill");
42494
- let color3 = isColor2(fill?.value) ? fill.value : void 0;
42495
- if (densityMap.fill || scheme28 && !color3) {
42496
- if (scheme28) {
42497
- try {
42498
- return palette(
42499
- steps,
42500
- scale2({ color: { scheme: scheme28, domain: [0, 1] } }).interpolate
42501
- );
42502
- } catch (err) {
42503
- console.warn(err);
42504
- }
42505
- }
42506
- } else if (domain.length) {
42507
- const range3 = plot3.getAttribute("colorRange");
42508
- const spec = {
42509
- domain,
42510
- range: range3,
42511
- scheme: scheme28 || (range3 ? void 0 : "tableau10")
42512
- };
42513
- color3 = scale2({ color: spec }).apply(value);
42514
- }
42515
- return palette(steps, opacityMap(color3));
42516
- }
42517
- function bin1d3(x4, x06, x12, n, reverse3, pad3) {
42518
- const d = (n - pad3) / (x12 - x06);
42519
- const f2 = d !== 1 ? ` * ${d}::DOUBLE` : "";
42520
- return reverse3 ? sql`(${x12} - ${x4}::DOUBLE)${f2}` : sql`(${x4}::DOUBLE - ${x06})${f2}`;
42521
- }
42522
- function bin2d2(q2, xp, yp, value, xn, groupby) {
42839
+ function bin2d2(q2, xp, yp, aggs, xn, groupby) {
42523
42840
  return q2.select({
42524
42841
  index: sql`FLOOR(${xp})::INTEGER + FLOOR(${yp})::INTEGER * ${xn}`,
42525
- value
42842
+ ...aggs
42526
42843
  }).groupby("index", groupby);
42527
42844
  }
42528
42845
  function binLinear2d2(q2, xp, yp, value, xn, groupby) {
@@ -42544,7 +42861,7 @@ function binLinear2d2(q2, xp, yp, value, xn, groupby) {
42544
42861
  sql`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${xn}`,
42545
42862
  sql`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${w}`
42546
42863
  );
42547
- return Query.from(Query.unionAll(a3, b2, c4, d)).select({ index: "i", value: sum2("w") }, groupby).groupby("index", groupby).having(neq("value", 0));
42864
+ return Query.from(Query.unionAll(a3, b2, c4, d)).select({ index: "i", density: sum2("w") }, groupby).groupby("index", groupby).having(neq("density", 0));
42548
42865
  }
42549
42866
  function tileFloor(value) {
42550
42867
  const floored = Math.floor(value);
@@ -43375,28 +43692,24 @@ function findMark({ marks: marks2 }, channel) {
43375
43692
  }
43376
43693
 
43377
43694
  // ../plot/src/transforms/bin.js
43378
- var EXTENT = [
43379
- "rectY-x",
43380
- "rectX-y",
43381
- "rect-x",
43382
- "rect-y"
43383
- ];
43384
- function hasExtent(channel, type2) {
43385
- return EXTENT.includes(`${type2}-${channel}`);
43386
- }
43695
+ var EXTENT = /* @__PURE__ */ new Set(["rectY-x", "rectX-y", "rect-x", "rect-y"]);
43387
43696
  function bin2(field2, options = { steps: 25 }) {
43388
43697
  const fn = (mark2, channel) => {
43389
- return hasExtent(channel, mark2.type) ? {
43390
- [`${channel}1`]: binField2(mark2, field2, options),
43391
- [`${channel}2`]: binField2(mark2, field2, { ...options, offset: 1 })
43392
- } : {
43393
- [channel]: binField2(mark2, field2, options)
43394
- };
43698
+ if (EXTENT.has(`${mark2.type}-${channel}`)) {
43699
+ return {
43700
+ [`${channel}1`]: binField(mark2, channel, field2, options),
43701
+ [`${channel}2`]: binField(mark2, channel, field2, { ...options, offset: 1 })
43702
+ };
43703
+ } else {
43704
+ return {
43705
+ [channel]: binField(mark2, channel, field2, options)
43706
+ };
43707
+ }
43395
43708
  };
43396
43709
  fn[Transform] = true;
43397
43710
  return fn;
43398
43711
  }
43399
- function binField2(mark2, column3, options) {
43712
+ function binField(mark2, channel, column3, options) {
43400
43713
  return {
43401
43714
  column: column3,
43402
43715
  label: column3,
@@ -43410,13 +43723,15 @@ function binField2(mark2, column3, options) {
43410
43723
  return column3;
43411
43724
  },
43412
43725
  toString() {
43726
+ const { apply: apply2, sqlApply, sqlInvert } = channelScale(mark2, channel);
43413
43727
  const { min: min5, max: max4 } = mark2.stats[column3];
43414
- const b2 = bins(min5, max4, options);
43415
- const col = asColumn(column3);
43728
+ const b2 = bins(apply2(min5), apply2(max4), options);
43729
+ const col = sqlApply(column3);
43416
43730
  const base = b2.min === 0 ? col : `(${col} - ${b2.min})`;
43417
43731
  const alpha = `${(b2.max - b2.min) / b2.steps}::DOUBLE`;
43418
43732
  const off = options.offset ? `${options.offset} + ` : "";
43419
- return `${b2.min} + ${alpha} * (${off}FLOOR(${base} / ${alpha})::INTEGER)`;
43733
+ const expr = `${b2.min} + ${alpha} * (${off}FLOOR(${base} / ${alpha}))`;
43734
+ return `${sqlInvert(expr)}`;
43420
43735
  }
43421
43736
  };
43422
43737
  }
@@ -44013,8 +44328,11 @@ __export(attributes_exports, {
44013
44328
  align: () => align,
44014
44329
  aspectRatio: () => aspectRatio,
44015
44330
  axis: () => axis2,
44331
+ colorBase: () => colorBase,
44016
44332
  colorClamp: () => colorClamp,
44333
+ colorConstant: () => colorConstant2,
44017
44334
  colorDomain: () => colorDomain,
44335
+ colorExponent: () => colorExponent,
44018
44336
  colorInterpolate: () => colorInterpolate,
44019
44337
  colorLabel: () => colorLabel,
44020
44338
  colorN: () => colorN,
@@ -44022,8 +44340,8 @@ __export(attributes_exports, {
44022
44340
  colorPivot: () => colorPivot,
44023
44341
  colorRange: () => colorRange,
44024
44342
  colorReverse: () => colorReverse,
44025
- colorScale: () => colorScale,
44026
- colorScheme: () => colorScheme,
44343
+ colorScale: () => colorScale2,
44344
+ colorScheme: () => colorScheme2,
44027
44345
  colorSymmetric: () => colorSymmetric,
44028
44346
  colorTickFormat: () => colorTickFormat,
44029
44347
  colorZero: () => colorZero,
@@ -44092,8 +44410,11 @@ __export(attributes_exports, {
44092
44410
  height: () => height,
44093
44411
  inset: () => inset,
44094
44412
  label: () => label,
44413
+ lengthBase: () => lengthBase,
44095
44414
  lengthClamp: () => lengthClamp,
44415
+ lengthConstant: () => lengthConstant,
44096
44416
  lengthDomain: () => lengthDomain,
44417
+ lengthExponent: () => lengthExponent,
44097
44418
  lengthNice: () => lengthNice,
44098
44419
  lengthRange: () => lengthRange,
44099
44420
  lengthScale: () => lengthScale,
@@ -44105,8 +44426,11 @@ __export(attributes_exports, {
44105
44426
  marginTop: () => marginTop,
44106
44427
  margins: () => margins,
44107
44428
  name: () => name,
44429
+ opacityBase: () => opacityBase,
44108
44430
  opacityClamp: () => opacityClamp,
44431
+ opacityConstant: () => opacityConstant,
44109
44432
  opacityDomain: () => opacityDomain,
44433
+ opacityExponent: () => opacityExponent,
44110
44434
  opacityLabel: () => opacityLabel,
44111
44435
  opacityNice: () => opacityNice,
44112
44436
  opacityRange: () => opacityRange,
@@ -44126,8 +44450,11 @@ __export(attributes_exports, {
44126
44450
  projectionPrecision: () => projectionPrecision,
44127
44451
  projectionRotate: () => projectionRotate,
44128
44452
  projectionType: () => projectionType,
44453
+ rBase: () => rBase,
44129
44454
  rClamp: () => rClamp,
44455
+ rConstant: () => rConstant,
44130
44456
  rDomain: () => rDomain,
44457
+ rExponent: () => rExponent,
44131
44458
  rNice: () => rNice,
44132
44459
  rRange: () => rRange,
44133
44460
  rScale: () => rScale,
@@ -44139,8 +44466,11 @@ __export(attributes_exports, {
44139
44466
  xAriaDescription: () => xAriaDescription,
44140
44467
  xAriaLabel: () => xAriaLabel,
44141
44468
  xAxis: () => xAxis,
44469
+ xBase: () => xBase,
44142
44470
  xClamp: () => xClamp,
44471
+ xConstant: () => xConstant,
44143
44472
  xDomain: () => xDomain,
44473
+ xExponent: () => xExponent,
44144
44474
  xFontVariant: () => xFontVariant,
44145
44475
  xGrid: () => xGrid,
44146
44476
  xInset: () => xInset,
@@ -44170,8 +44500,11 @@ __export(attributes_exports, {
44170
44500
  yAriaDescription: () => yAriaDescription,
44171
44501
  yAriaLabel: () => yAriaLabel,
44172
44502
  yAxis: () => yAxis,
44503
+ yBase: () => yBase,
44173
44504
  yClamp: () => yClamp,
44505
+ yConstant: () => yConstant,
44174
44506
  yDomain: () => yDomain,
44507
+ yExponent: () => yExponent,
44175
44508
  yFontVariant: () => yFontVariant,
44176
44509
  yGrid: () => yGrid,
44177
44510
  yInset: () => yInset,
@@ -44330,6 +44663,9 @@ var xAriaLabel = attrf("xAriaLabel");
44330
44663
  var xAriaDescription = attrf("xAriaDescription");
44331
44664
  var xReverse = attrf("xReverse");
44332
44665
  var xZero = attrf("xZero");
44666
+ var xBase = attrf("xBase");
44667
+ var xExponent = attrf("xExponent");
44668
+ var xConstant = attrf("xConstant");
44333
44669
  var yScale = attrf("yScale");
44334
44670
  var yDomain = attrf("yDomain");
44335
44671
  var yRange = attrf("yRange");
@@ -44360,6 +44696,9 @@ var yAriaLabel = attrf("yAriaLabel");
44360
44696
  var yAriaDescription = attrf("yAriaDescription");
44361
44697
  var yReverse = attrf("yReverse");
44362
44698
  var yZero = attrf("yZero");
44699
+ var yBase = attrf("yBase");
44700
+ var yExponent = attrf("yExponent");
44701
+ var yConstant = attrf("yConstant");
44363
44702
  var facetMargin = attrf("facetMargin");
44364
44703
  var facetMarginTop = attrf("facetMarginTop");
44365
44704
  var facetMarginBottom = attrf("facetMarginBottom");
@@ -44421,13 +44760,13 @@ var fyFontVariant = attrf("fyFontVariant");
44421
44760
  var fyAriaLabel = attrf("fyAriaLabel");
44422
44761
  var fyAriaDescription = attrf("fyAriaDescription");
44423
44762
  var fyReverse = attrf("fyReverse");
44424
- var colorScale = attrf("colorScale");
44763
+ var colorScale2 = attrf("colorScale");
44425
44764
  var colorDomain = attrf("colorDomain");
44426
44765
  var colorRange = attrf("colorRange");
44427
44766
  var colorClamp = attrf("colorClamp");
44428
44767
  var colorN = attrf("colorN");
44429
44768
  var colorNice = attrf("colorNice");
44430
- var colorScheme = attrf("colorScheme");
44769
+ var colorScheme2 = attrf("colorScheme");
44431
44770
  var colorInterpolate = attrf("colorInterpolate");
44432
44771
  var colorPivot = attrf("colorPivot");
44433
44772
  var colorSymmetric = attrf("colorSymmetric");
@@ -44435,6 +44774,9 @@ var colorLabel = attrf("colorLabel");
44435
44774
  var colorReverse = attrf("colorReverse");
44436
44775
  var colorZero = attrf("colorZero");
44437
44776
  var colorTickFormat = attrf("colorTickFormat");
44777
+ var colorBase = attrf("colorBase");
44778
+ var colorExponent = attrf("colorExponent");
44779
+ var colorConstant2 = attrf("colorConstant");
44438
44780
  var opacityScale = attrf("opacityScale");
44439
44781
  var opacityDomain = attrf("opacityDomain");
44440
44782
  var opacityRange = attrf("opacityRange");
@@ -44444,18 +44786,27 @@ var opacityLabel = attrf("opacityLabel");
44444
44786
  var opacityReverse = attrf("opacityReverse");
44445
44787
  var opacityZero = attrf("opacityZero");
44446
44788
  var opacityTickFormat = attrf("opacityTickFormat");
44789
+ var opacityBase = attrf("opacityBase");
44790
+ var opacityExponent = attrf("opacityExponent");
44791
+ var opacityConstant = attrf("opacityConstant");
44447
44792
  var rScale = attrf("rScale");
44448
44793
  var rDomain = attrf("rDomain");
44449
44794
  var rRange = attrf("rRange");
44450
44795
  var rClamp = attrf("rClamp");
44451
44796
  var rNice = attrf("rNice");
44452
44797
  var rZero = attrf("rZero");
44798
+ var rBase = attrf("rBase");
44799
+ var rExponent = attrf("rExponent");
44800
+ var rConstant = attrf("rConstant");
44453
44801
  var lengthScale = attrf("lengthScale");
44454
44802
  var lengthDomain = attrf("lengthDomain");
44455
44803
  var lengthRange = attrf("lengthRange");
44456
44804
  var lengthClamp = attrf("lengthClamp");
44457
44805
  var lengthNice = attrf("lengthNice");
44458
44806
  var lengthZero = attrf("lengthZero");
44807
+ var lengthBase = attrf("lengthBase");
44808
+ var lengthExponent = attrf("lengthExponent");
44809
+ var lengthConstant = attrf("lengthConstant");
44459
44810
  var projectionType = attrf("projectionType");
44460
44811
  var projectionParallels = attrf("projectionParallels");
44461
44812
  var projectionPrecision = attrf("projectionPrecision");
@@ -44507,6 +44858,7 @@ __export(marks_exports, {
44507
44858
  gridFy: () => gridFy2,
44508
44859
  gridX: () => gridX2,
44509
44860
  gridY: () => gridY2,
44861
+ heatmap: () => heatmap,
44510
44862
  hexagon: () => hexagon2,
44511
44863
  hexbin: () => hexbin2,
44512
44864
  hexgrid: () => hexgrid2,
@@ -44516,7 +44868,7 @@ __export(marks_exports, {
44516
44868
  lineX: () => lineX2,
44517
44869
  lineY: () => lineY2,
44518
44870
  link: () => link3,
44519
- raster: () => raster3,
44871
+ raster: () => raster2,
44520
44872
  rasterTile: () => rasterTile,
44521
44873
  rect: () => rect2,
44522
44874
  rectX: () => rectX2,
@@ -44605,7 +44957,8 @@ var densityY = (...args) => explicitType(Density1DMark, "areaY", ...args);
44605
44957
  var density2 = (...args) => implicitType(Density2DMark, ...args);
44606
44958
  var denseLine = (...args) => implicitType(DenseLineMark, ...args);
44607
44959
  var contour2 = (...args) => implicitType(ContourMark, ...args);
44608
- var raster3 = (...args) => implicitType(RasterMark, ...args);
44960
+ var heatmap = (...args) => implicitType(HeatmapMark, ...args);
44961
+ var raster2 = (...args) => implicitType(RasterMark, ...args);
44609
44962
  var rasterTile = (...args) => implicitType(RasterTileMark, ...args);
44610
44963
  var hexbin2 = (...args) => implicitType(HexbinMark, ...args);
44611
44964
  var hexgrid2 = (...args) => mark("hexgrid", ...args);
@@ -44804,8 +45157,11 @@ export {
44804
45157
  centroidX,
44805
45158
  centroidY,
44806
45159
  circle2 as circle,
45160
+ colorBase,
44807
45161
  colorClamp,
45162
+ colorConstant2 as colorConstant,
44808
45163
  colorDomain,
45164
+ colorExponent,
44809
45165
  colorInterpolate,
44810
45166
  colorLabel,
44811
45167
  colorLegend,
@@ -44814,8 +45170,8 @@ export {
44814
45170
  colorPivot,
44815
45171
  colorRange,
44816
45172
  colorReverse,
44817
- colorScale,
44818
- colorScheme,
45173
+ colorScale2 as colorScale,
45174
+ colorScheme2 as colorScheme,
44819
45175
  colorSymmetric,
44820
45176
  colorTickFormat,
44821
45177
  colorZero,
@@ -44851,6 +45207,7 @@ export {
44851
45207
  facetMarginLeft,
44852
45208
  facetMarginRight,
44853
45209
  facetMarginTop,
45210
+ first,
44854
45211
  first_value,
44855
45212
  frame3 as frame,
44856
45213
  from,
@@ -44919,6 +45276,7 @@ export {
44919
45276
  gt,
44920
45277
  gte,
44921
45278
  hconcat,
45279
+ heatmap,
44922
45280
  height,
44923
45281
  hexagon2 as hexagon,
44924
45282
  hexbin2 as hexbin,
@@ -44945,8 +45303,11 @@ export {
44945
45303
  last_value,
44946
45304
  lead,
44947
45305
  legends_exports as legendDirectives,
45306
+ lengthBase,
44948
45307
  lengthClamp,
45308
+ lengthConstant,
44949
45309
  lengthDomain,
45310
+ lengthExponent,
44950
45311
  lengthNice,
44951
45312
  lengthRange,
44952
45313
  lengthScale,
@@ -44985,8 +45346,11 @@ export {
44985
45346
  not,
44986
45347
  nth_value,
44987
45348
  ntile,
45349
+ opacityBase,
44988
45350
  opacityClamp,
45351
+ opacityConstant,
44989
45352
  opacityDomain,
45353
+ opacityExponent,
44990
45354
  opacityLabel,
44991
45355
  opacityLegend,
44992
45356
  opacityNice,
@@ -45018,14 +45382,17 @@ export {
45018
45382
  projectionRotate,
45019
45383
  projectionType,
45020
45384
  quantile,
45385
+ rBase,
45021
45386
  rClamp,
45387
+ rConstant,
45022
45388
  rDomain,
45389
+ rExponent,
45023
45390
  rNice,
45024
45391
  rRange,
45025
45392
  rScale,
45026
45393
  rZero,
45027
45394
  rank,
45028
- raster3 as raster,
45395
+ raster2 as raster,
45029
45396
  rasterTile,
45030
45397
  rect2 as rect,
45031
45398
  rectX2 as rectX,
@@ -45075,8 +45442,11 @@ export {
45075
45442
  xAriaDescription,
45076
45443
  xAriaLabel,
45077
45444
  xAxis,
45445
+ xBase,
45078
45446
  xClamp,
45447
+ xConstant,
45079
45448
  xDomain,
45449
+ xExponent,
45080
45450
  xFontVariant,
45081
45451
  xGrid,
45082
45452
  xInset,
@@ -45106,8 +45476,11 @@ export {
45106
45476
  yAriaDescription,
45107
45477
  yAriaLabel,
45108
45478
  yAxis,
45479
+ yBase,
45109
45480
  yClamp,
45481
+ yConstant,
45110
45482
  yDomain,
45483
+ yExponent,
45111
45484
  yFontVariant,
45112
45485
  yGrid,
45113
45486
  yInset,