@bicharts/chart-host 0.6.11 → 0.6.13

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/README.md CHANGED
@@ -178,12 +178,17 @@ basemap — load or provide geometry first.
178
178
  ## D3 plugins
179
179
 
180
180
  Some charts call `d3.sankey()`, `d3.hexbin()` or the voronoi family. Those are separate packages
181
- that **attach onto the d3 object** — install them and augment the *same* d3 you pass in:
181
+ that **attach onto the d3 object** — install them and pass the host *one* d3 that carries them.
182
+ `import * as d3` is a module namespace, which is frozen, so assigning a plugin onto it throws;
183
+ `assembleD3` builds a plain copy instead:
182
184
 
183
185
  ```js
184
- import * as d3 from "d3";
186
+ import * as d3base from "d3";
185
187
  import { sankey, sankeyLinkHorizontal } from "d3-sankey";
186
- Object.assign(d3, { sankey, sankeyLinkHorizontal });
188
+ import { assembleD3 } from "@bicharts/chart-host";
189
+
190
+ const d3 = assembleD3(d3base, { sankey, sankeyLinkHorizontal });
191
+ createChartHost(el, { code, data, d3 });
187
192
  ```
188
193
 
189
194
  The integration contract returned by `generate_chart` names exactly which ones *your* chart
@@ -37,20 +37,20 @@ var require_papaparse_min = __commonJS({
37
37
  let e4 = this._config.newline;
38
38
  e4 || (r2 = this._config.quoteChar || '"', e4 = this._handle.guessLineEndings(t, r2)), t = [...t.split(e4).slice(i2)].join(e4);
39
39
  }
40
- this.isFirstChunk && q4(this._config.beforeFirstChunk) && void 0 !== (r2 = this._config.beforeFirstChunk(t)) && (t = r2), this.isFirstChunk = false, this._halted = false;
40
+ this.isFirstChunk && q3(this._config.beforeFirstChunk) && void 0 !== (r2 = this._config.beforeFirstChunk(t)) && (t = r2), this.isFirstChunk = false, this._halted = false;
41
41
  var i2 = this._partialLine + t, r2 = (this._partialLine = "", this._handle.parse(i2, this._baseIndex, !this._finished));
42
42
  if (!this._handle.paused() && !this._handle.aborted()) {
43
43
  t = r2.meta.cursor, i2 = (this._finished || (this._partialLine = i2.substring(t - this._baseIndex), this._baseIndex = t), r2 && r2.data && (this._rowCount += r2.data.length), this._finished || this._config.preview && this._rowCount >= this._config.preview);
44
44
  if (a4) n.postMessage({ results: r2, workerId: v3.WORKER_ID, finished: i2 });
45
- else if (q4(this._config.chunk) && !e2) {
45
+ else if (q3(this._config.chunk) && !e2) {
46
46
  if (this._config.chunk(r2, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = true);
47
47
  this._completeResults = r2 = void 0;
48
48
  }
49
- return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(r2.data), this._completeResults.errors = this._completeResults.errors.concat(r2.errors), this._completeResults.meta = r2.meta), this._completed || !i2 || !q4(this._config.complete) || r2 && r2.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), i2 || r2 && r2.meta.paused || this._nextChunk(), r2;
49
+ return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(r2.data), this._completeResults.errors = this._completeResults.errors.concat(r2.errors), this._completeResults.meta = r2.meta), this._completed || !i2 || !q3(this._config.complete) || r2 && r2.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), i2 || r2 && r2.meta.paused || this._nextChunk(), r2;
50
50
  }
51
51
  this._halted = true;
52
52
  }, this._sendError = function(e2) {
53
- q4(this._config.error) ? this._config.error(e2) : a4 && this._config.error && n.postMessage({ workerId: v3.WORKER_ID, error: e2, finished: false });
53
+ q3(this._config.error) ? this._config.error(e2) : a4 && this._config.error && n.postMessage({ workerId: v3.WORKER_ID, error: e2, finished: false });
54
54
  };
55
55
  }
56
56
  function f4(e) {
@@ -146,7 +146,7 @@ var require_papaparse_min = __commonJS({
146
146
  return !y6(e4);
147
147
  })), _3()) {
148
148
  let t4 = function(e4, t5) {
149
- e4 = P4(e4), q4(m2.transformHeader) && (e4 = m2.transformHeader(e4, t5)), c4.push(e4);
149
+ e4 = P4(e4), q3(m2.transformHeader) && (e4 = m2.transformHeader(e4, t5)), c4.push(e4);
150
150
  };
151
151
  var t2 = t4;
152
152
  if (p4) if (Array.isArray(p4.data[0])) {
@@ -176,10 +176,10 @@ var require_papaparse_min = __commonJS({
176
176
  e2 = { type: e2, code: t2, message: i4 };
177
177
  void 0 !== r4 && (e2.row = r4), p4.errors.push(e2);
178
178
  }
179
- q4(m2.step) && (t = m2.step, m2.step = function(e2) {
179
+ q3(m2.step) && (t = m2.step, m2.step = function(e2) {
180
180
  p4 = e2, _3() ? g4() : (g4(), 0 !== p4.data.length && (r2 += e2.data.length, m2.preview && r2 > m2.preview ? s2.abort() : (p4.data = p4.data[0], t(p4, i2))));
181
181
  }), this.parse = function(e2, t2, i4) {
182
- var r4 = m2.quoteChar || '"', r4 = (m2.newline || (m2.newline = this.guessLineEndings(e2, r4)), a5 = false, m2.delimiter ? q4(m2.delimiter) && (m2.delimiter = m2.delimiter(e2), p4.meta.delimiter = m2.delimiter) : ((r4 = ((e4, t4, i5, r5, n4) => {
182
+ var r4 = m2.quoteChar || '"', r4 = (m2.newline || (m2.newline = this.guessLineEndings(e2, r4)), a5 = false, m2.delimiter ? q3(m2.delimiter) && (m2.delimiter = m2.delimiter(e2), p4.meta.delimiter = m2.delimiter) : ((r4 = ((e4, t4, i5, r5, n4) => {
183
183
  var s4, a6, o4, h5;
184
184
  n4 = n4 || [",", " ", "|", ";", v3.RECORD_SEP, v3.UNIT_SEP];
185
185
  for (var u5 = 0; u5 < n4.length; u5++) {
@@ -192,13 +192,13 @@ var require_papaparse_min = __commonJS({
192
192
  }, this.paused = function() {
193
193
  return l2;
194
194
  }, this.pause = function() {
195
- l2 = true, s2.abort(), n2 = q4(m2.chunk) ? "" : n2.substring(s2.getCharIndex());
195
+ l2 = true, s2.abort(), n2 = q3(m2.chunk) ? "" : n2.substring(s2.getCharIndex());
196
196
  }, this.resume = function() {
197
197
  i2.streamer._halted ? (l2 = false, i2.streamer.parseChunk(n2, true)) : setTimeout(i2.resume, 3);
198
198
  }, this.aborted = function() {
199
199
  return e;
200
200
  }, this.abort = function() {
201
- e = true, s2.abort(), p4.meta.aborted = true, q4(m2.complete) && m2.complete(p4), n2 = "";
201
+ e = true, s2.abort(), p4.meta.aborted = true, q3(m2.complete) && m2.complete(p4), n2 = "";
202
202
  }, this.guessLineEndings = function(e2, t2) {
203
203
  e2 = e2.substring(0, 1048576);
204
204
  var t2 = new RegExp(U3(t2) + "([^]*?)" + U3(t2), "gm"), i4 = (e2 = e2.replace(t2, "")).split("\r"), t2 = e2.split("\n"), e2 = 1 < t2.length && t2[0].length < i4[0].length;
@@ -211,13 +211,13 @@ var require_papaparse_min = __commonJS({
211
211
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
212
212
  }
213
213
  function E5(C2) {
214
- var S = (C2 = C2 || {}).delimiter, O3 = C2.newline, x2 = C2.comments, I4 = C2.step, A2 = C2.preview, T4 = C2.fastMode, D3 = null, L2 = false, F3 = null == C2.quoteChar ? '"' : C2.quoteChar, j2 = F3;
215
- if (void 0 !== C2.escapeChar && (j2 = C2.escapeChar), ("string" != typeof S || -1 < v3.BAD_DELIMITERS.indexOf(S)) && (S = ","), x2 === S) throw new Error("Comment character same as delimiter");
214
+ var S = (C2 = C2 || {}).delimiter, O3 = C2.newline, x2 = C2.comments, I4 = C2.step, A2 = C2.preview, T4 = C2.fastMode, D3 = null, L2 = false, F3 = null == C2.quoteChar ? '"' : C2.quoteChar, j3 = F3;
215
+ if (void 0 !== C2.escapeChar && (j3 = C2.escapeChar), ("string" != typeof S || -1 < v3.BAD_DELIMITERS.indexOf(S)) && (S = ","), x2 === S) throw new Error("Comment character same as delimiter");
216
216
  true === x2 ? x2 = "#" : ("string" != typeof x2 || -1 < v3.BAD_DELIMITERS.indexOf(x2)) && (x2 = false), "\n" !== O3 && "\r" !== O3 && "\r\n" !== O3 && (O3 = "\n");
217
217
  var z4 = 0, M2 = false;
218
218
  this.parse = function(i2, t, r2) {
219
219
  if ("string" != typeof i2) throw new Error("Input must be a string");
220
- var n2 = i2.length, e = S.length, s2 = O3.length, a5 = x2.length, o2 = q4(I4), h4 = [], u4 = [], d3 = [], f5 = z4 = 0;
220
+ var n2 = i2.length, e = S.length, s2 = O3.length, a5 = x2.length, o2 = q3(I4), h4 = [], u4 = [], d3 = [], f5 = z4 = 0;
221
221
  if (!i2) return w3();
222
222
  if (T4 || false !== T4 && -1 === i2.indexOf(F3)) {
223
223
  for (var l2 = i2.split(O3), c4 = 0; c4 < l2.length; c4++) {
@@ -232,11 +232,11 @@ var require_papaparse_min = __commonJS({
232
232
  }
233
233
  return w3();
234
234
  }
235
- for (var p4 = i2.indexOf(S, z4), g4 = i2.indexOf(O3, z4), _3 = new RegExp(U3(j2) + U3(F3), "g"), m2 = i2.indexOf(F3, z4); ; ) if (i2[z4] === F3) for (m2 = z4, z4++; ; ) {
235
+ for (var p4 = i2.indexOf(S, z4), g4 = i2.indexOf(O3, z4), _3 = new RegExp(U3(j3) + U3(F3), "g"), m2 = i2.indexOf(F3, z4); ; ) if (i2[z4] === F3) for (m2 = z4, z4++; ; ) {
236
236
  if (-1 === (m2 = i2.indexOf(F3, m2 + 1))) return r2 || u4.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h4.length, index: z4 }), E6();
237
237
  if (m2 === n2 - 1) return E6(i2.substring(z4, m2).replace(_3, F3));
238
- if (F3 === j2 && i2[m2 + 1] === j2) m2++;
239
- else if (F3 === j2 || 0 === m2 || i2[m2 - 1] !== j2) {
238
+ if (F3 === j3 && i2[m2 + 1] === j3) m2++;
239
+ else if (F3 === j3 || 0 === m2 || i2[m2 - 1] !== j3) {
240
240
  -1 !== p4 && p4 < m2 + 1 && (p4 = i2.indexOf(S, m2 + 1));
241
241
  var y6 = v4(-1 === (g4 = -1 !== g4 && g4 < m2 + 1 ? i2.indexOf(O3, m2 + 1) : g4) ? p4 : Math.min(p4, g4));
242
242
  if (i2.substr(m2 + 1 + y6, e) === S) {
@@ -281,7 +281,7 @@ var require_papaparse_min = __commonJS({
281
281
  let n4 = false;
282
282
  for (let r4 = 0; r4 < s4.length; r4++) {
283
283
  let i4 = P4(s4[r4]);
284
- if (a6[i4 = q4(C2.transformHeader) ? C2.transformHeader(i4, r4) : i4]) {
284
+ if (a6[i4 = q3(C2.transformHeader) ? C2.transformHeader(i4, r4) : i4]) {
285
285
  let e4, t2 = a6[i4];
286
286
  for (; e4 = i4 + "_" + t2, t2++, o4.has(e4); ) ;
287
287
  o4.add(e4), s4[r4] = e4, a6[i4]++, n4 = true, (D3 = null === D3 ? {} : D3)[e4] = i4;
@@ -308,16 +308,16 @@ var require_papaparse_min = __commonJS({
308
308
  var n2 = { abort: function() {
309
309
  r2 = true, _2(t.workerId, { data: [], errors: [], meta: { aborted: true } });
310
310
  }, pause: m, resume: m };
311
- if (q4(i2.userStep)) {
311
+ if (q3(i2.userStep)) {
312
312
  for (var s2 = 0; s2 < t.results.data.length && (i2.userStep({ data: t.results.data[s2], errors: t.results.errors, meta: t.results.meta }, n2), !r2); s2++) ;
313
313
  delete t.results;
314
- } else q4(i2.userChunk) && (i2.userChunk(t.results, n2, t.file), delete t.results);
314
+ } else q3(i2.userChunk) && (i2.userChunk(t.results, n2, t.file), delete t.results);
315
315
  }
316
316
  t.finished && !r2 && _2(t.workerId, t.results);
317
317
  }
318
318
  function _2(e, t) {
319
319
  var i2 = o[e];
320
- q4(i2.userComplete) && i2.userComplete(t), i2.terminate(), delete o[e];
320
+ q3(i2.userComplete) && i2.userComplete(t), i2.terminate(), delete o[e];
321
321
  }
322
322
  function m() {
323
323
  throw new Error("Not implemented.");
@@ -333,20 +333,20 @@ var require_papaparse_min = __commonJS({
333
333
  e.apply(t, arguments);
334
334
  };
335
335
  }
336
- function q4(e) {
336
+ function q3(e) {
337
337
  return "function" == typeof e;
338
338
  }
339
339
  return v3.parse = function(e, t) {
340
340
  var i2 = (t = t || {}).dynamicTyping || false;
341
- q4(i2) && (t.dynamicTypingFunction = i2, i2 = {});
342
- if (t.dynamicTyping = i2, t.transform = !!q4(t.transform) && t.transform, !t.worker || !v3.WORKERS_SUPPORTED) return i2 = null, v3.NODE_STREAM_INPUT, "string" == typeof e ? (e = P4(e), i2 = new (t.download ? f4 : c2)(t)) : true === e.readable && q4(e.read) && q4(e.on) ? i2 = new p2(t) : (n.File && e instanceof File || e instanceof Object) && (i2 = new l(t)), i2.stream(e);
341
+ q3(i2) && (t.dynamicTypingFunction = i2, i2 = {});
342
+ if (t.dynamicTyping = i2, t.transform = !!q3(t.transform) && t.transform, !t.worker || !v3.WORKERS_SUPPORTED) return i2 = null, v3.NODE_STREAM_INPUT, "string" == typeof e ? (e = P4(e), i2 = new (t.download ? f4 : c2)(t)) : true === e.readable && q3(e.read) && q3(e.on) ? i2 = new p2(t) : (n.File && e instanceof File || e instanceof Object) && (i2 = new l(t)), i2.stream(e);
343
343
  (i2 = (() => {
344
344
  var e2;
345
345
  return !!v3.WORKERS_SUPPORTED && (e2 = (() => {
346
346
  var e4 = n.URL || n.webkitURL || null, t2 = r.toString();
347
347
  return v3.BLOB_URL || (v3.BLOB_URL = e4.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", "(", t2, ")();"], { type: "text/javascript" })));
348
348
  })(), (e2 = new n.Worker(e2)).onmessage = g3, e2.id = h3++, o[e2.id] = e2);
349
- })()).userStep = t.step, i2.userChunk = t.chunk, i2.userComplete = t.complete, i2.userError = t.error, t.step = q4(t.step), t.chunk = q4(t.chunk), t.complete = q4(t.complete), t.error = q4(t.error), delete t.worker, i2.postMessage({ input: e, config: t, workerId: i2.id });
349
+ })()).userStep = t.step, i2.userChunk = t.chunk, i2.userComplete = t.complete, i2.userError = t.error, t.step = q3(t.step), t.chunk = q3(t.chunk), t.complete = q3(t.complete), t.error = q3(t.error), delete t.worker, i2.postMessage({ input: e, config: t, workerId: i2.id });
350
350
  }, v3.unparse = function(e, t) {
351
351
  var s2 = false, _3 = true, m2 = ",", y6 = "\r\n", a5 = '"', o2 = a5 + a5, i2 = false, r2 = null, h4 = false, u4 = ((() => {
352
352
  if ("object" == typeof t) {
@@ -405,20 +405,20 @@ var require_papaparse_min = __commonJS({
405
405
  for (var t = 0; t < this.files.length; t++) h4.push({ file: this.files[t], inputElem: this, instanceConfig: d2.extend({}, i2) });
406
406
  }), e(), this;
407
407
  function e() {
408
- if (0 === h4.length) q4(o2.complete) && o2.complete();
408
+ if (0 === h4.length) q3(o2.complete) && o2.complete();
409
409
  else {
410
410
  var e2, t, i4, r2, n2 = h4[0];
411
- if (q4(o2.before)) {
411
+ if (q3(o2.before)) {
412
412
  var s2 = o2.before(n2.file, n2.inputElem);
413
413
  if ("object" == typeof s2) {
414
- if ("abort" === s2.action) return e2 = "AbortError", t = n2.file, i4 = n2.inputElem, r2 = s2.reason, void (q4(o2.error) && o2.error({ name: e2 }, t, i4, r2));
414
+ if ("abort" === s2.action) return e2 = "AbortError", t = n2.file, i4 = n2.inputElem, r2 = s2.reason, void (q3(o2.error) && o2.error({ name: e2 }, t, i4, r2));
415
415
  if ("skip" === s2.action) return void u4();
416
416
  "object" == typeof s2.config && (n2.instanceConfig = d2.extend(n2.instanceConfig, s2.config));
417
417
  } else if ("skip" === s2) return void u4();
418
418
  }
419
419
  var a5 = n2.instanceConfig.complete;
420
420
  n2.instanceConfig.complete = function(e4) {
421
- q4(a5) && a5(e4, n2.file, n2.inputElem), u4();
421
+ q3(a5) && a5(e4, n2.file, n2.inputElem), u4();
422
422
  }, v3.parse(n2.file, n2.instanceConfig);
423
423
  }
424
424
  }
@@ -509,10 +509,10 @@ function f(t) {
509
509
  }
510
510
  function rgbToLab(r, g3, b4) {
511
511
  const R2 = linearise(r), G3 = linearise(g3), B4 = linearise(b4);
512
- const X5 = 0.4124564 * R2 + 0.3575761 * G3 + 0.1804375 * B4;
512
+ const X4 = 0.4124564 * R2 + 0.3575761 * G3 + 0.1804375 * B4;
513
513
  const Y4 = 0.2126729 * R2 + 0.7151522 * G3 + 0.072175 * B4;
514
514
  const Z4 = 0.0193339 * R2 + 0.119192 * G3 + 0.9503041 * B4;
515
- const fx = f(X5 / Xn), fy = f(Y4 / Yn), fz = f(Z4 / Zn);
515
+ const fx = f(X4 / Xn), fy = f(Y4 / Yn), fz = f(Z4 / Zn);
516
516
  return { L: 116 * fy - 16, a: 500 * (fx - fy), b: 200 * (fy - fz) };
517
517
  }
518
518
  function hexToLab(hex2) {
@@ -567,13 +567,13 @@ function labToHex(lab) {
567
567
  return t32 > EPS ? t32 : (116 * t - 16) / KAPPA;
568
568
  };
569
569
  const fy = (lab.L + 16) / 116, fx = fy + lab.a / 500, fz = fy - lab.b / 200;
570
- const X5 = Xn * finv(fx);
570
+ const X4 = Xn * finv(fx);
571
571
  const Y4 = Yn * (lab.L > KAPPA * EPS ? fy * fy * fy : lab.L / KAPPA);
572
572
  const Z4 = Zn * finv(fz);
573
573
  const lin = [
574
- 3.2404542 * X5 - 1.5371385 * Y4 - 0.4985314 * Z4,
575
- -0.969266 * X5 + 1.8760108 * Y4 + 0.041556 * Z4,
576
- 0.0556434 * X5 - 0.2040259 * Y4 + 1.0572252 * Z4
574
+ 3.2404542 * X4 - 1.5371385 * Y4 - 0.4985314 * Z4,
575
+ -0.969266 * X4 + 1.8760108 * Y4 + 0.041556 * Z4,
576
+ 0.0556434 * X4 - 0.2040259 * Y4 + 1.0572252 * Z4
577
577
  ];
578
578
  return "#" + lin.map((v3) => {
579
579
  const c2 = Math.max(0, Math.min(1, v3));
@@ -678,14 +678,14 @@ function censusColourSpread(container, doc) {
678
678
  const d2 = cs.map(() => new Array(cs.length).fill(0));
679
679
  let span = 0, lo = 0, hi = 1;
680
680
  for (let i = 0; i < cs.length; i++) {
681
- for (let j2 = i + 1; j2 < cs.length; j2++) {
682
- const v3 = deltaE2000(cs[i], cs[j2]);
683
- d2[i][j2] = v3;
684
- d2[j2][i] = v3;
681
+ for (let j3 = i + 1; j3 < cs.length; j3++) {
682
+ const v3 = deltaE2000(cs[i], cs[j3]);
683
+ d2[i][j3] = v3;
684
+ d2[j3][i] = v3;
685
685
  if (v3 > span) {
686
686
  span = v3;
687
687
  lo = i;
688
- hi = j2;
688
+ hi = j3;
689
689
  }
690
690
  }
691
691
  }
@@ -700,8 +700,8 @@ function censusColourSpread(container, doc) {
700
700
  let crowd = 0;
701
701
  for (let i = 0; i < cs.length; i++) {
702
702
  let n = 0;
703
- for (let j2 = 0; j2 < cs.length; j2++) {
704
- if (i === j2 || d2[i][j2] <= SAME_SHADE_DELTA_E) n += top[j2].n;
703
+ for (let j3 = 0; j3 < cs.length; j3++) {
704
+ if (i === j3 || d2[i][j3] <= SAME_SHADE_DELTA_E) n += top[j3].n;
705
705
  }
706
706
  if (n > crowd) crowd = n;
707
707
  }
@@ -1478,19 +1478,19 @@ function Wt(n, s) {
1478
1478
  return { iso: i, unmatched: M2, matchedRows: h3, totalRows: n.length };
1479
1479
  }
1480
1480
 
1481
- // ../shape-core/dist/chunk-WG6XYZLU.mjs
1481
+ // ../shape-core/dist/chunk-ZVHCLXKO.mjs
1482
1482
  var import_papaparse = __toESM(require_papaparse_min(), 1);
1483
1483
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
1484
1484
  var ve = { "north-america": "AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI", "south-america": "AR BO BR CL CO EC FK GF GY PE PY SR UY VE", europe: "AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA", africa: "AO BF BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW KE KM LR LS LY MA MG ML MR MU MW MZ NA NE NG RE RW SC SD SH SL SN SO SS ST SZ TD TG TN TZ UG YT ZA ZM ZW", asia: "AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IO IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MV MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE", oceania: "AS AU CK FJ FM GU KI MH MP NC NF NR NU NZ PF PG PN PW SB TK TO TV UM VU WF WS", antarctica: "AQ BV GS HM TF" };
1485
- var q3 = (() => {
1485
+ var J3 = (() => {
1486
1486
  let t = /* @__PURE__ */ new Map();
1487
1487
  for (let e of Object.keys(ve)) for (let n of ve[e].split(/\s+/)) n && t.set(n, e);
1488
1488
  return t;
1489
1489
  })();
1490
1490
  function at2(t) {
1491
1491
  for (let [e, n] of t) {
1492
- let r = q3.get(e);
1493
- r && !q3.has(n) && q3.set(n, r);
1492
+ let r = J3.get(e);
1493
+ r && !J3.has(n) && J3.set(n, r);
1494
1494
  }
1495
1495
  }
1496
1496
  at2(N);
@@ -1498,7 +1498,7 @@ var gt = ["rate", "ratio", "pct", "percent", "percentage", "rating", "share", "s
1498
1498
  var pt = ["pct", "percent", "percentage", "rate", "ratio", "rating", "share", "score", "index", "nps", "csat", "margin", "yield", "coverage", "utilization", "utilisation", "gpa", "percentile", "quantile", "bmi", "density", "pressure", "humidity", "velocity", "efficiency", "occupancy", "latency", "throughput", "bandwidth", "iops", "ppm", "ppb", "dpmo", "bps"];
1499
1499
  var ht = ["latitude", "longitude"];
1500
1500
  var bt = ["latitude", "longitude"];
1501
- function X3(t) {
1501
+ function j2(t) {
1502
1502
  return f2(t);
1503
1503
  }
1504
1504
  var de = ["somme de", "suma de", "soma de", "summe von", "som van", "somma di", "summa av", "sum av", "sum af", "soucet z", "suma z", "totaal van", "total de", "toplam", "osszeg", "nombre de", "recuento de", "contagem de", "anzahl von", "aantal van", "conteggio di", "antal av", "lukumaara", "pocet z"];
@@ -1511,11 +1511,11 @@ var _t = new RegExp("\\b(" + gt.join("|") + ")\\b|(" + pt.join("|") + ")$", "i")
1511
1511
  var At = new RegExp("\\b(" + ht.join("|") + ")\\b|(" + bt.join("|") + ")$", "i");
1512
1512
  function Fe(t) {
1513
1513
  if (!t) return "";
1514
- let e = String(t), n = ke.exec(X3(e));
1514
+ let e = String(t), n = ke.exec(j2(e));
1515
1515
  return (n ? e.slice(n[0].length) : e).trim();
1516
1516
  }
1517
1517
  function Ct(t) {
1518
- return !!t && ke.test(X3(String(t)));
1518
+ return !!t && ke.test(j2(String(t)));
1519
1519
  }
1520
1520
  var Mt2 = ["count (distinct)", "count distinct", "distinct count", "standard deviation", "average", "variance", "median", "product", "stddev", "std dev", "count", "sum", "avg", "min", "minimum", "max", "maximum", "var"];
1521
1521
  var Oe = new RegExp("^\\s*(" + [...Mt2].sort((t, e) => e.length - t.length).map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+")).join("|") + ")\\s+of\\s+", "i");
@@ -1528,7 +1528,7 @@ function Rt(t) {
1528
1528
  function ze(t, e) {
1529
1529
  if (!e) return false;
1530
1530
  let n = Fe(e);
1531
- return t.test(X3(Rt(e))) || t.test(X3(n)) || t.test(X3(d(n).join(" ")));
1531
+ return t.test(j2(Rt(e))) || t.test(j2(n)) || t.test(j2(d(n).join(" ")));
1532
1532
  }
1533
1533
  function $e(t) {
1534
1534
  return ze(At, t);
@@ -1602,7 +1602,7 @@ function T3(n) {
1602
1602
  let t = e.filter((c2) => K3(c2) && !Y(c2)).length, i = e.filter((c2) => !K3(c2) && !!Y(c2)).length;
1603
1603
  return t >= 1 && t >= i;
1604
1604
  }
1605
- function X4(n, e) {
1605
+ function X3(n, e) {
1606
1606
  if (!Y(n)) return false;
1607
1607
  let t = E(n);
1608
1608
  return t ? e === "world" ? true : s3.has(t) : false;
@@ -1676,7 +1676,7 @@ function tt2(n, e, t, i, c2) {
1676
1676
  let g3 = t?.state;
1677
1677
  if (g3 && x2.has(g3)) {
1678
1678
  let o = d2(g3), u2 = M(o);
1679
- u2.length > 0 && u2.every((m) => X4(m, i)) ? s.push(`state=${g3} (every value is "CA", which is both Canada and California)`) : T3(o) ? (s.push(`state=${g3} (every value is a country, not a state)`), r.country || (r.country = g3)) : E4(o) < 95 ? s.push(`state=${g3} (only ${E4(o)}% of values are states/provinces)`) : r.state = g3;
1679
+ u2.length > 0 && u2.every((m) => X3(m, i)) ? s.push(`state=${g3} (every value is "CA", which is both Canada and California)`) : T3(o) ? (s.push(`state=${g3} (every value is a country, not a state)`), r.country || (r.country = g3)) : E4(o) < 95 ? s.push(`state=${g3} (only ${E4(o)}% of values are states/provinces)`) : r.state = g3;
1680
1680
  }
1681
1681
  let S = new Set(Object.values(r).filter(Boolean)), A2 = n.filter((o) => !S.has(o) && !o.startsWith("__"));
1682
1682
  if (!r.state) {
@@ -1686,7 +1686,7 @@ function tt2(n, e, t, i, c2) {
1686
1686
  if (T3(m)) continue;
1687
1687
  let p2 = E4(m);
1688
1688
  if (p2 < 95) continue;
1689
- let O3 = B3(m, (N3) => !!Y(N3)), se = B3(m, (N3) => !!Y(N3) && !X4(N3, i));
1689
+ let O3 = B3(m, (N3) => !!Y(N3)), se = B3(m, (N3) => !!Y(N3) && !X3(N3, i));
1690
1690
  O3 < z3 && se < 1 || (!o || p2 > o.pct) && (o = { name: u2, pct: p2 });
1691
1691
  }
1692
1692
  o && (r.state = o.name, S.add(o.name), a4.push(`state=${o.name} (${o.pct}% states/provinces)`));
@@ -1928,10 +1928,10 @@ function stripJsComments(code) {
1928
1928
  continue;
1929
1929
  }
1930
1930
  if (ch === "/" && next === "/") {
1931
- let j2 = i + 2;
1932
- while (j2 < n && src[j2] !== "\n" && src[j2] !== "\r") j2++;
1931
+ let j3 = i + 2;
1932
+ while (j3 < n && src[j3] !== "\n" && src[j3] !== "\r") j3++;
1933
1933
  out += " ";
1934
- i = j2;
1934
+ i = j3;
1935
1935
  wordOpen = false;
1936
1936
  continue;
1937
1937
  }
@@ -1945,10 +1945,10 @@ function stripJsComments(code) {
1945
1945
  continue;
1946
1946
  }
1947
1947
  if (ch === "'" || ch === '"') {
1948
- let j2 = i + 1;
1949
- while (j2 < n && src[j2] !== ch && src[j2] !== "\n") j2 += src[j2] === "\\" ? 2 : 1;
1950
- out += src.slice(i, Math.min(j2 + 1, n));
1951
- i = j2 + 1;
1948
+ let j3 = i + 1;
1949
+ while (j3 < n && src[j3] !== ch && src[j3] !== "\n") j3 += src[j3] === "\\" ? 2 : 1;
1950
+ out += src.slice(i, Math.min(j3 + 1, n));
1951
+ i = j3 + 1;
1952
1952
  prevSig = ch;
1953
1953
  prevWord = "";
1954
1954
  wordOpen = false;
@@ -1962,23 +1962,23 @@ function stripJsComments(code) {
1962
1962
  continue;
1963
1963
  }
1964
1964
  if (ch === "/" && regexMayFollow()) {
1965
- let j2 = i + 1, inClass = false;
1966
- while (j2 < n && src[j2] !== "\n") {
1967
- const c2 = src[j2];
1965
+ let j3 = i + 1, inClass = false;
1966
+ while (j3 < n && src[j3] !== "\n") {
1967
+ const c2 = src[j3];
1968
1968
  if (c2 === "\\") {
1969
- j2 += 2;
1969
+ j3 += 2;
1970
1970
  continue;
1971
1971
  }
1972
1972
  if (c2 === "[") inClass = true;
1973
1973
  else if (c2 === "]") inClass = false;
1974
1974
  else if (c2 === "/" && !inClass) break;
1975
- j2++;
1975
+ j3++;
1976
1976
  }
1977
- if (j2 < n && src[j2] === "/") {
1978
- j2++;
1979
- while (j2 < n && /[A-Za-z]/.test(src[j2])) j2++;
1980
- out += src.slice(i, j2);
1981
- i = j2;
1977
+ if (j3 < n && src[j3] === "/") {
1978
+ j3++;
1979
+ while (j3 < n && /[A-Za-z]/.test(src[j3])) j3++;
1980
+ out += src.slice(i, j3);
1981
+ i = j3;
1982
1982
  prevSig = "/";
1983
1983
  prevWord = "";
1984
1984
  wordOpen = false;
@@ -2394,10 +2394,10 @@ function robustLine(v3, pos) {
2394
2394
  for (let i = 0; i < n; i += step) idx.push(i);
2395
2395
  const slopes = [];
2396
2396
  for (let p2 = 0; p2 < idx.length; p2++) {
2397
- for (let q4 = p2 + 1; q4 < idx.length; q4++) {
2398
- const dv = v3[idx[q4]] - v3[idx[p2]];
2397
+ for (let q3 = p2 + 1; q3 < idx.length; q3++) {
2398
+ const dv = v3[idx[q3]] - v3[idx[p2]];
2399
2399
  if (Math.abs(dv) < 1e-12) continue;
2400
- slopes.push((pos[idx[q4]] - pos[idx[p2]]) / dv);
2400
+ slopes.push((pos[idx[q3]] - pos[idx[p2]]) / dv);
2401
2401
  }
2402
2402
  }
2403
2403
  if (slopes.length < 3) return null;
@@ -2463,8 +2463,8 @@ function censusValuePlacement(container, data) {
2463
2463
  const fit = 1 - ssRes / ssTot;
2464
2464
  if (fit >= VALUE_AXIS_MIN_FIT && (!best || fit > best.fit)) {
2465
2465
  const full = new Array(dots.length).fill(NaN);
2466
- keep.forEach((k3, j2) => {
2467
- full[k3] = res[j2];
2466
+ keep.forEach((k3, j3) => {
2467
+ full[k3] = res[j3];
2468
2468
  });
2469
2469
  best = { col: c2, axis, fit, res: full, log };
2470
2470
  }
@@ -3103,10 +3103,10 @@ function glyphSampleGrid(box, n = GLYPH_SAMPLE_N) {
3103
3103
  if (!box || !(box.width > 0) || !(box.height > 0) || !(n >= 1)) return out;
3104
3104
  const k3 = Math.floor(n);
3105
3105
  for (let i = 0; i < k3; i++) {
3106
- for (let j2 = 0; j2 < k3; j2++) {
3106
+ for (let j3 = 0; j3 < k3; j3++) {
3107
3107
  out.push({
3108
3108
  x: box.left + box.width * (i + 0.5) / k3,
3109
- y: box.top + box.height * (j2 + 0.5) / k3
3109
+ y: box.top + box.height * (j3 + 0.5) / k3
3110
3110
  });
3111
3111
  }
3112
3112
  }
@@ -3384,7 +3384,7 @@ function explainRenderFailure(err, d3) {
3384
3384
  }
3385
3385
  if (typeof d3?.mermaid?.render !== "function" && /\bmermaid\b/i.test(msg)) {
3386
3386
  return new Error(
3387
- "[@bicharts/chart-host] this chart draws its diagram with Mermaid, which it reaches as d3.mermaid.render(...), and the d3 you passed has no mermaid on it \u2014 this host did not load the library. A host supplies it exactly the way the other plugins are supplied: attach it onto the SAME d3 instance you hand to createChartHost \u2014 npm install mermaid then import mermaid from 'mermaid'; Object.assign(d3, { mermaid }); Original error: " + msg
3387
+ "[@bicharts/chart-host] this chart draws its diagram with Mermaid, which it reaches as d3.mermaid.render(...), and the d3 you passed has no mermaid on it \u2014 this host did not load the library. A host supplies it exactly the way the other plugins are supplied: hand createChartHost ONE d3 that carries it, the SAME d3 every chart gets \u2014 npm install mermaid then import * as d3base from 'd3'; import mermaid from 'mermaid'; import { assembleD3 } from '@bicharts/chart-host'; const d3 = assembleD3(d3base, { mermaid }); (an ES-module d3 namespace is frozen, so assigning onto it throws) Original error: " + msg
3388
3388
  );
3389
3389
  }
3390
3390
  const m = /d3\.(\w+) is not a function|(\w+) is not a function/.exec(msg);
@@ -3392,7 +3392,7 @@ function explainRenderFailure(err, d3) {
3392
3392
  const pkg = D3_PLUGIN_PACKAGES[name];
3393
3393
  if (pkg) {
3394
3394
  return new Error(
3395
- `[@bicharts/chart-host] this chart calls d3.${name}(), which comes from the separate "${pkg}" package and is not attached to the d3 you passed. Install it and augment the SAME d3 instance: npm install ${pkg} then import { ${name} } from "${pkg}"; Object.assign(d3, { ${name} }); Original error: ` + msg
3395
+ `[@bicharts/chart-host] this chart calls d3.${name}(), which comes from the separate "${pkg}" package and is not attached to the d3 you passed. Install it and hand the host ONE d3 that carries it, the SAME d3 every chart gets: npm install ${pkg} then import * as d3base from "d3"; import { ${name} } from "${pkg}"; import { assembleD3 } from "@bicharts/chart-host"; const d3 = assembleD3(d3base, { ${name} }); (an ES-module d3 namespace is frozen, so assigning onto it throws) Original error: ` + msg
3396
3396
  );
3397
3397
  }
3398
3398
  return err;
@@ -3857,7 +3857,7 @@ function toPayloadRows(rowMap, sourceRowIdxs) {
3857
3857
  }
3858
3858
  var sameRows = (a4, b4) => {
3859
3859
  if (a4.length !== b4.length) return false;
3860
- const x2 = a4.slice().sort((p2, q4) => p2 - q4), y5 = b4.slice().sort((p2, q4) => p2 - q4);
3860
+ const x2 = a4.slice().sort((p2, q3) => p2 - q3), y5 = b4.slice().sort((p2, q3) => p2 - q3);
3861
3861
  return x2.every((v3, i) => v3 === y5[i]);
3862
3862
  };
3863
3863
  function syncMemberSelection(host, selection, id, highlight, incoming, rowMap) {
package/dist/index.mjs CHANGED
@@ -140,7 +140,7 @@ import {
140
140
  unpinScrolledAxis,
141
141
  valuePlacementFlag,
142
142
  withoutViewOnlyKeys
143
- } from "./chunk-N5M4X7ON.mjs";
143
+ } from "./chunk-Z5LQVIBL.mjs";
144
144
  import "./chunk-A2GMXZP7.mjs";
145
145
  import "./chunk-GHODWOAL.mjs";
146
146
 
package/dist/react.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  loadGeo,
8
8
  syncMemberSelection,
9
9
  toSourceRows
10
- } from "./chunk-N5M4X7ON.mjs";
10
+ } from "./chunk-Z5LQVIBL.mjs";
11
11
  import "./chunk-A2GMXZP7.mjs";
12
12
  import "./chunk-GHODWOAL.mjs";
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.6.11",
3
+ "version": "0.6.13",
4
4
  "description": "Run a BIC-generated D3 chart in any web host: compiles the generated render() function, applies the shared option defaults, resolves mark clicks (through tooltip overlays), owns the selection affordance, and translates row indices between cross-filtered charts. The same contract the BIC Power BI visual implements, minus Power BI. React bindings at @bicharts/chart-host/react.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",