@bicharts/chart-host 0.5.73 → 0.5.75

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.
@@ -26,36 +26,36 @@ var require_papaparse_min = __commonJS({
26
26
  function P2(e) {
27
27
  return 65279 === e.charCodeAt(0) ? e.slice(1) : e;
28
28
  }
29
- function u2(e) {
29
+ function u4(e) {
30
30
  this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, function(e2) {
31
31
  var t = b2(e2);
32
32
  t.chunkSize = parseInt(t.chunkSize), e2.step || e2.chunk || (t.chunkSize = null);
33
- this._handle = new i(t), (this._handle.streamer = this)._config = t;
33
+ this._handle = new i2(t), (this._handle.streamer = this)._config = t;
34
34
  }.call(this, e), this.parseChunk = function(t, e2) {
35
- var i2 = parseInt(this._config.skipFirstNLines) || 0;
36
- if (this.isFirstChunk && 0 < i2) {
35
+ var i4 = parseInt(this._config.skipFirstNLines) || 0;
36
+ if (this.isFirstChunk && 0 < i4) {
37
37
  let e4 = this._config.newline;
38
- e4 || (r2 = this._config.quoteChar || '"', e4 = this._handle.guessLineEndings(t, r2)), t = [...t.split(e4).slice(i2)].join(e4);
38
+ e4 || (r2 = this._config.quoteChar || '"', e4 = this._handle.guessLineEndings(t, r2)), t = [...t.split(e4).slice(i4)].join(e4);
39
39
  }
40
- this.isFirstChunk && q3(this._config.beforeFirstChunk) && void 0 !== (r2 = this._config.beforeFirstChunk(t)) && (t = r2), this.isFirstChunk = false, this._halted = false;
41
- var i2 = this._partialLine + t, r2 = (this._partialLine = "", this._handle.parse(i2, this._baseIndex, !this._finished));
40
+ this.isFirstChunk && q2(this._config.beforeFirstChunk) && void 0 !== (r2 = this._config.beforeFirstChunk(t)) && (t = r2), this.isFirstChunk = false, this._halted = false;
41
+ var i4 = this._partialLine + t, r2 = (this._partialLine = "", this._handle.parse(i4, this._baseIndex, !this._finished));
42
42
  if (!this._handle.paused() && !this._handle.aborted()) {
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
- if (a2) n.postMessage({ results: r2, workerId: v2.WORKER_ID, finished: i2 });
45
- else if (q3(this._config.chunk) && !e2) {
43
+ t = r2.meta.cursor, i4 = (this._finished || (this._partialLine = i4.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
+ if (a2) n.postMessage({ results: r2, workerId: v2.WORKER_ID, finished: i4 });
45
+ else if (q2(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 || !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;
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 || !i4 || !q2(this._config.complete) || r2 && r2.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), i4 || r2 && r2.meta.paused || this._nextChunk(), r2;
50
50
  }
51
51
  this._halted = true;
52
52
  }, this._sendError = function(e2) {
53
- q3(this._config.error) ? this._config.error(e2) : a2 && this._config.error && n.postMessage({ workerId: v2.WORKER_ID, error: e2, finished: false });
53
+ q2(this._config.error) ? this._config.error(e2) : a2 && this._config.error && n.postMessage({ workerId: v2.WORKER_ID, error: e2, finished: false });
54
54
  };
55
55
  }
56
56
  function f(e) {
57
57
  var r2;
58
- (e = e || {}).chunkSize || (e.chunkSize = v2.RemoteChunkSize), u2.call(this, e), this._nextChunk = s ? function() {
58
+ (e = e || {}).chunkSize || (e.chunkSize = v2.RemoteChunkSize), u4.call(this, e), this._nextChunk = s ? function() {
59
59
  this._readChunk(), this._chunkLoaded();
60
60
  } : function() {
61
61
  this._readChunk();
@@ -68,8 +68,8 @@ var require_papaparse_min = __commonJS({
68
68
  var e2, t = this._config.downloadRequestHeaders;
69
69
  for (e2 in t) r2.setRequestHeader(e2, t[e2]);
70
70
  }
71
- var i2;
72
- this._config.chunkSize && (i2 = this._start + this._config.chunkSize - 1, r2.setRequestHeader("Range", "bytes=" + this._start + "-" + i2));
71
+ var i4;
72
+ this._config.chunkSize && (i4 = this._start + this._config.chunkSize - 1, r2.setRequestHeader("Range", "bytes=" + this._start + "-" + i4));
73
73
  try {
74
74
  r2.send(this._config.downloadRequestBody);
75
75
  } catch (e4) {
@@ -84,47 +84,47 @@ var require_papaparse_min = __commonJS({
84
84
  this._sendError(new Error(e2));
85
85
  };
86
86
  }
87
- function l(e) {
88
- (e = e || {}).chunkSize || (e.chunkSize = v2.LocalChunkSize), u2.call(this, e);
89
- var i2, r2, n2 = "undefined" != typeof FileReader;
87
+ function l2(e) {
88
+ (e = e || {}).chunkSize || (e.chunkSize = v2.LocalChunkSize), u4.call(this, e);
89
+ var i4, r2, n2 = "undefined" != typeof FileReader;
90
90
  this.stream = function(e2) {
91
- this._input = e2, r2 = e2.slice || e2.webkitSlice || e2.mozSlice, n2 ? ((i2 = new FileReader()).onload = y2(this._chunkLoaded, this), i2.onerror = y2(this._chunkError, this)) : i2 = new FileReaderSync(), this._nextChunk();
91
+ this._input = e2, r2 = e2.slice || e2.webkitSlice || e2.mozSlice, n2 ? ((i4 = new FileReader()).onload = y2(this._chunkLoaded, this), i4.onerror = y2(this._chunkError, this)) : i4 = new FileReaderSync(), this._nextChunk();
92
92
  }, this._nextChunk = function() {
93
93
  this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
94
94
  }, this._readChunk = function() {
95
- var e2 = this._input, t = (this._config.chunkSize && (t = Math.min(this._start + this._config.chunkSize, this._input.size), e2 = r2.call(e2, this._start, t)), i2.readAsText(e2, this._config.encoding));
95
+ var e2 = this._input, t = (this._config.chunkSize && (t = Math.min(this._start + this._config.chunkSize, this._input.size), e2 = r2.call(e2, this._start, t)), i4.readAsText(e2, this._config.encoding));
96
96
  n2 || this._chunkLoaded({ target: { result: t } });
97
97
  }, this._chunkLoaded = function(e2) {
98
98
  this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e2.target.result);
99
99
  }, this._chunkError = function() {
100
- this._sendError(i2.error);
100
+ this._sendError(i4.error);
101
101
  };
102
102
  }
103
103
  function c(e) {
104
- var i2;
105
- u2.call(this, e = e || {}), this.stream = function(e2) {
106
- return i2 = e2, this._nextChunk();
104
+ var i4;
105
+ u4.call(this, e = e || {}), this.stream = function(e2) {
106
+ return i4 = e2, this._nextChunk();
107
107
  }, this._nextChunk = function() {
108
108
  var e2, t;
109
- if (!this._finished) return e2 = this._config.chunkSize, i2 = e2 ? (t = i2.substring(0, e2), i2.substring(e2)) : (t = i2, ""), this._finished = !i2, this.parseChunk(t);
109
+ if (!this._finished) return e2 = this._config.chunkSize, i4 = e2 ? (t = i4.substring(0, e2), i4.substring(e2)) : (t = i4, ""), this._finished = !i4, this.parseChunk(t);
110
110
  };
111
111
  }
112
112
  function p2(e) {
113
- u2.call(this, e = e || {});
114
- var t = [], i2 = true, r2 = false;
113
+ u4.call(this, e = e || {});
114
+ var t = [], i4 = true, r2 = false;
115
115
  this.pause = function() {
116
- u2.prototype.pause.apply(this, arguments), this._input.pause();
116
+ u4.prototype.pause.apply(this, arguments), this._input.pause();
117
117
  }, this.resume = function() {
118
- u2.prototype.resume.apply(this, arguments), this._input.resume();
118
+ u4.prototype.resume.apply(this, arguments), this._input.resume();
119
119
  }, this.stream = function(e2) {
120
120
  this._input = e2, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
121
121
  }, this._checkIsFinished = function() {
122
122
  r2 && 1 === t.length && (this._finished = true);
123
123
  }, this._nextChunk = function() {
124
- this._checkIsFinished(), t.length ? this.parseChunk(t.shift()) : i2 = true;
124
+ this._checkIsFinished(), t.length ? this.parseChunk(t.shift()) : i4 = true;
125
125
  }, this._streamData = y2(function(e2) {
126
126
  try {
127
- t.push("string" == typeof e2 ? e2 : e2.toString(this._config.encoding)), i2 && (i2 = false, this._checkIsFinished(), this.parseChunk(t.shift()));
127
+ t.push("string" == typeof e2 ? e2 : e2.toString(this._config.encoding)), i4 && (i4 = false, this._checkIsFinished(), this.parseChunk(t.shift()));
128
128
  } catch (e4) {
129
129
  this._streamError(e4);
130
130
  }
@@ -136,8 +136,8 @@ var require_papaparse_min = __commonJS({
136
136
  this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
137
137
  }, this);
138
138
  }
139
- function i(m4) {
140
- var n2, s2, a4, t, o4 = Math.pow(2, 53), h3 = -o4, u4 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, d2 = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, i2 = this, r2 = 0, f2 = 0, l2 = false, e = false, c2 = [], p4 = { data: [], errors: [], meta: {} };
139
+ function i2(m4) {
140
+ var n2, s2, a4, t, o4 = Math.pow(2, 53), h3 = -o4, u5 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, d2 = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, i4 = this, r2 = 0, f2 = 0, l3 = false, e = false, c2 = [], p4 = { data: [], errors: [], meta: {} };
141
141
  function y4(e2) {
142
142
  return "greedy" === m4.skipEmptyLines ? "" === e2.join("").trim() : 1 === e2.length && 0 === e2[0].length;
143
143
  }
@@ -146,7 +146,7 @@ var require_papaparse_min = __commonJS({
146
146
  return !y4(e4);
147
147
  })), _3()) {
148
148
  let t4 = function(e4, t5) {
149
- e4 = P2(e4), q3(m4.transformHeader) && (e4 = m4.transformHeader(e4, t5)), c2.push(e4);
149
+ e4 = P2(e4), q2(m4.transformHeader) && (e4 = m4.transformHeader(e4, t5)), c2.push(e4);
150
150
  };
151
151
  var t2 = t4;
152
152
  if (p4) if (Array.isArray(p4.data[0])) {
@@ -154,57 +154,57 @@ var require_papaparse_min = __commonJS({
154
154
  p4.data.splice(0, 1);
155
155
  } else p4.data.forEach(t4);
156
156
  }
157
- function i4(e4, t4) {
158
- for (var i5 = m4.header ? {} : [], r5 = 0; r5 < e4.length; r5++) {
157
+ function i5(e4, t4) {
158
+ for (var i6 = m4.header ? {} : [], r5 = 0; r5 < e4.length; r5++) {
159
159
  var n4 = r5, s4 = e4[r5], s4 = ((e5, t5) => ((e6) => (m4.dynamicTypingFunction && void 0 === m4.dynamicTyping[e6] && (m4.dynamicTyping[e6] = m4.dynamicTypingFunction(e6)), true === (m4.dynamicTyping[e6] || m4.dynamicTyping)))(e5) ? "true" === t5 || "TRUE" === t5 || "false" !== t5 && "FALSE" !== t5 && (((e6) => {
160
- if (u4.test(e6)) {
160
+ if (u5.test(e6)) {
161
161
  e6 = parseFloat(e6);
162
162
  if (h3 < e6 && e6 < o4) return 1;
163
163
  }
164
164
  })(t5) ? parseFloat(t5) : d2.test(t5) ? new Date(t5) : "" === t5 ? null : t5) : t5)(n4 = m4.header ? r5 >= c2.length ? "__parsed_extra" : c2[r5] : n4, s4 = m4.transform ? m4.transform(s4, n4) : s4);
165
- "__parsed_extra" === n4 ? (i5[n4] = i5[n4] || [], i5[n4].push(s4)) : i5[n4] = s4;
165
+ "__parsed_extra" === n4 ? (i6[n4] = i6[n4] || [], i6[n4].push(s4)) : i6[n4] = s4;
166
166
  }
167
- return m4.header && (r5 > c2.length ? k2("FieldMismatch", "TooManyFields", "Too many fields: expected " + c2.length + " fields but parsed " + r5, f2 + t4) : r5 < c2.length && k2("FieldMismatch", "TooFewFields", "Too few fields: expected " + c2.length + " fields but parsed " + r5, f2 + t4)), i5;
167
+ return m4.header && (r5 > c2.length ? k2("FieldMismatch", "TooManyFields", "Too many fields: expected " + c2.length + " fields but parsed " + r5, f2 + t4) : r5 < c2.length && k2("FieldMismatch", "TooFewFields", "Too few fields: expected " + c2.length + " fields but parsed " + r5, f2 + t4)), i6;
168
168
  }
169
169
  var r4;
170
- p4 && (m4.header || m4.dynamicTyping || m4.transform) && (r4 = 1, !p4.data.length || Array.isArray(p4.data[0]) ? (p4.data = p4.data.map(i4), r4 = p4.data.length) : p4.data = i4(p4.data, 0), m4.header && p4.meta && (p4.meta.fields = c2), f2 += r4);
170
+ p4 && (m4.header || m4.dynamicTyping || m4.transform) && (r4 = 1, !p4.data.length || Array.isArray(p4.data[0]) ? (p4.data = p4.data.map(i5), r4 = p4.data.length) : p4.data = i5(p4.data, 0), m4.header && p4.meta && (p4.meta.fields = c2), f2 += r4);
171
171
  }
172
172
  function _3() {
173
173
  return m4.header && 0 === c2.length;
174
174
  }
175
- function k2(e2, t2, i4, r4) {
176
- e2 = { type: e2, code: t2, message: i4 };
175
+ function k2(e2, t2, i5, r4) {
176
+ e2 = { type: e2, code: t2, message: i5 };
177
177
  void 0 !== r4 && (e2.row = r4), p4.errors.push(e2);
178
178
  }
179
- q3(m4.step) && (t = m4.step, m4.step = function(e2) {
180
- p4 = e2, _3() ? g2() : (g2(), 0 !== p4.data.length && (r2 += e2.data.length, m4.preview && r2 > m4.preview ? s2.abort() : (p4.data = p4.data[0], t(p4, i2))));
181
- }), this.parse = function(e2, t2, i4) {
182
- var r4 = m4.quoteChar || '"', r4 = (m4.newline || (m4.newline = this.guessLineEndings(e2, r4)), a4 = false, m4.delimiter ? q3(m4.delimiter) && (m4.delimiter = m4.delimiter(e2), p4.meta.delimiter = m4.delimiter) : ((r4 = ((e4, t4, i5, r5, n4) => {
179
+ q2(m4.step) && (t = m4.step, m4.step = function(e2) {
180
+ p4 = e2, _3() ? g2() : (g2(), 0 !== p4.data.length && (r2 += e2.data.length, m4.preview && r2 > m4.preview ? s2.abort() : (p4.data = p4.data[0], t(p4, i4))));
181
+ }), this.parse = function(e2, t2, i5) {
182
+ var r4 = m4.quoteChar || '"', r4 = (m4.newline || (m4.newline = this.guessLineEndings(e2, r4)), a4 = false, m4.delimiter ? q2(m4.delimiter) && (m4.delimiter = m4.delimiter(e2), p4.meta.delimiter = m4.delimiter) : ((r4 = ((e4, t4, i6, r5, n4) => {
183
183
  var s4, a5, o5, h4;
184
184
  n4 = n4 || [",", " ", "|", ";", v2.RECORD_SEP, v2.UNIT_SEP];
185
- for (var u5 = 0; u5 < n4.length; u5++) {
186
- for (var d3, f4 = n4[u5], l3 = 0, c4 = 0, p5 = 0, g3 = (o5 = void 0, new E4({ comments: r5, delimiter: f4, newline: t4, preview: 10 }).parse(e4)), _4 = 0; _4 < g3.data.length; _4++) i5 && y4(g3.data[_4]) ? p5++ : (d3 = g3.data[_4].length, c4 += d3, void 0 === o5 ? o5 = d3 : 0 < d3 && (l3 += Math.abs(d3 - o5), o5 = d3));
187
- 0 < g3.data.length && (c4 /= g3.data.length - p5), (void 0 === a5 || l3 <= a5) && (void 0 === h4 || h4 < c4) && 1.99 < c4 && (a5 = l3, s4 = f4, h4 = c4);
185
+ for (var u6 = 0; u6 < n4.length; u6++) {
186
+ for (var d3, f4 = n4[u6], l4 = 0, c4 = 0, p5 = 0, g3 = (o5 = void 0, new E4({ comments: r5, delimiter: f4, newline: t4, preview: 10 }).parse(e4)), _4 = 0; _4 < g3.data.length; _4++) i6 && y4(g3.data[_4]) ? p5++ : (d3 = g3.data[_4].length, c4 += d3, void 0 === o5 ? o5 = d3 : 0 < d3 && (l4 += Math.abs(d3 - o5), o5 = d3));
187
+ 0 < g3.data.length && (c4 /= g3.data.length - p5), (void 0 === a5 || l4 <= a5) && (void 0 === h4 || h4 < c4) && 1.99 < c4 && (a5 = l4, s4 = f4, h4 = c4);
188
188
  }
189
189
  return { successful: !!(m4.delimiter = s4), bestDelimiter: s4 };
190
190
  })(e2, m4.newline, m4.skipEmptyLines, m4.comments, m4.delimitersToGuess)).successful ? m4.delimiter = r4.bestDelimiter : (a4 = true, m4.delimiter = v2.DefaultDelimiter), p4.meta.delimiter = m4.delimiter), b2(m4));
191
- return m4.preview && m4.header && r4.preview++, n2 = e2, s2 = new E4(r4), p4 = s2.parse(n2, t2, i4), g2(), l2 ? { meta: { paused: true } } : p4 || { meta: { paused: false } };
191
+ return m4.preview && m4.header && r4.preview++, n2 = e2, s2 = new E4(r4), p4 = s2.parse(n2, t2, i5), g2(), l3 ? { meta: { paused: true } } : p4 || { meta: { paused: false } };
192
192
  }, this.paused = function() {
193
- return l2;
193
+ return l3;
194
194
  }, this.pause = function() {
195
- l2 = true, s2.abort(), n2 = q3(m4.chunk) ? "" : n2.substring(s2.getCharIndex());
195
+ l3 = true, s2.abort(), n2 = q2(m4.chunk) ? "" : n2.substring(s2.getCharIndex());
196
196
  }, this.resume = function() {
197
- i2.streamer._halted ? (l2 = false, i2.streamer.parseChunk(n2, true)) : setTimeout(i2.resume, 3);
197
+ i4.streamer._halted ? (l3 = false, i4.streamer.parseChunk(n2, true)) : setTimeout(i4.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, q3(m4.complete) && m4.complete(p4), n2 = "";
201
+ e = true, s2.abort(), p4.meta.aborted = true, q2(m4.complete) && m4.complete(p4), n2 = "";
202
202
  }, this.guessLineEndings = function(e2, t2) {
203
203
  e2 = e2.substring(0, 1048576);
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;
205
- if (1 === i4.length || e2) return "\n";
206
- for (var r4 = 0, n4 = 0; n4 < i4.length; n4++) "\n" === i4[n4][0] && r4++;
207
- return r4 >= i4.length / 2 ? "\r\n" : "\r";
204
+ var t2 = new RegExp(U3(t2) + "([^]*?)" + U3(t2), "gm"), i5 = (e2 = e2.replace(t2, "")).split("\r"), t2 = e2.split("\n"), e2 = 1 < t2.length && t2[0].length < i5[0].length;
205
+ if (1 === i5.length || e2) return "\n";
206
+ for (var r4 = 0, n4 = 0; n4 < i5.length; n4++) "\n" === i5[n4][0] && r4++;
207
+ return r4 >= i5.length / 2 ? "\r\n" : "\r";
208
208
  };
209
209
  }
210
210
  function U3(e) {
@@ -215,13 +215,13 @@ var require_papaparse_min = __commonJS({
215
215
  if (void 0 !== C2.escapeChar && (j2 = C2.escapeChar), ("string" != typeof S || -1 < v2.BAD_DELIMITERS.indexOf(S)) && (S = ","), x2 === S) throw new Error("Comment character same as delimiter");
216
216
  true === x2 ? x2 = "#" : ("string" != typeof x2 || -1 < v2.BAD_DELIMITERS.indexOf(x2)) && (x2 = false), "\n" !== O2 && "\r" !== O2 && "\r\n" !== O2 && (O2 = "\n");
217
217
  var z3 = 0, M2 = false;
218
- this.parse = function(i2, t, r2) {
219
- if ("string" != typeof i2) throw new Error("Input must be a string");
220
- var n2 = i2.length, e = S.length, s2 = O2.length, a4 = x2.length, o4 = q3(I2), h3 = [], u4 = [], d2 = [], f2 = z3 = 0;
221
- if (!i2) return w();
222
- if (T2 || false !== T2 && -1 === i2.indexOf(F3)) {
223
- for (var l2 = i2.split(O2), c2 = 0; c2 < l2.length; c2++) {
224
- if (d2 = l2[c2], z3 += d2.length, c2 !== l2.length - 1) z3 += O2.length;
218
+ this.parse = function(i4, t, r2) {
219
+ if ("string" != typeof i4) throw new Error("Input must be a string");
220
+ var n2 = i4.length, e = S.length, s2 = O2.length, a4 = x2.length, o4 = q2(I2), h3 = [], u5 = [], d2 = [], f2 = z3 = 0;
221
+ if (!i4) return w();
222
+ if (T2 || false !== T2 && -1 === i4.indexOf(F3)) {
223
+ for (var l3 = i4.split(O2), c2 = 0; c2 < l3.length; c2++) {
224
+ if (d2 = l3[c2], z3 += d2.length, c2 !== l3.length - 1) z3 += O2.length;
225
225
  else if (r2) return w();
226
226
  if (!x2 || d2.substring(0, a4) !== x2) {
227
227
  if (o4) {
@@ -232,33 +232,33 @@ var require_papaparse_min = __commonJS({
232
232
  }
233
233
  return w();
234
234
  }
235
- for (var p4 = i2.indexOf(S, z3), g2 = i2.indexOf(O2, z3), _3 = new RegExp(U3(j2) + U3(F3), "g"), m4 = i2.indexOf(F3, z3); ; ) if (i2[z3] === F3) for (m4 = z3, z3++; ; ) {
236
- if (-1 === (m4 = i2.indexOf(F3, m4 + 1))) return r2 || u4.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h3.length, index: z3 }), E5();
237
- if (m4 === n2 - 1) return E5(i2.substring(z3, m4).replace(_3, F3));
238
- if (F3 === j2 && i2[m4 + 1] === j2) m4++;
239
- else if (F3 === j2 || 0 === m4 || i2[m4 - 1] !== j2) {
240
- -1 !== p4 && p4 < m4 + 1 && (p4 = i2.indexOf(S, m4 + 1));
241
- var y4 = v3(-1 === (g2 = -1 !== g2 && g2 < m4 + 1 ? i2.indexOf(O2, m4 + 1) : g2) ? p4 : Math.min(p4, g2));
242
- if (i2.substr(m4 + 1 + y4, e) === S) {
243
- d2.push(i2.substring(z3, m4).replace(_3, F3)), i2[z3 = m4 + 1 + y4 + e] !== F3 && (m4 = i2.indexOf(F3, z3)), p4 = i2.indexOf(S, z3), g2 = i2.indexOf(O2, z3);
235
+ for (var p4 = i4.indexOf(S, z3), g2 = i4.indexOf(O2, z3), _3 = new RegExp(U3(j2) + U3(F3), "g"), m4 = i4.indexOf(F3, z3); ; ) if (i4[z3] === F3) for (m4 = z3, z3++; ; ) {
236
+ if (-1 === (m4 = i4.indexOf(F3, m4 + 1))) return r2 || u5.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h3.length, index: z3 }), E5();
237
+ if (m4 === n2 - 1) return E5(i4.substring(z3, m4).replace(_3, F3));
238
+ if (F3 === j2 && i4[m4 + 1] === j2) m4++;
239
+ else if (F3 === j2 || 0 === m4 || i4[m4 - 1] !== j2) {
240
+ -1 !== p4 && p4 < m4 + 1 && (p4 = i4.indexOf(S, m4 + 1));
241
+ var y4 = v3(-1 === (g2 = -1 !== g2 && g2 < m4 + 1 ? i4.indexOf(O2, m4 + 1) : g2) ? p4 : Math.min(p4, g2));
242
+ if (i4.substr(m4 + 1 + y4, e) === S) {
243
+ d2.push(i4.substring(z3, m4).replace(_3, F3)), i4[z3 = m4 + 1 + y4 + e] !== F3 && (m4 = i4.indexOf(F3, z3)), p4 = i4.indexOf(S, z3), g2 = i4.indexOf(O2, z3);
244
244
  break;
245
245
  }
246
246
  y4 = v3(g2);
247
- if (i2.substring(m4 + 1 + y4, m4 + 1 + y4 + s2) === O2) {
248
- if (d2.push(i2.substring(z3, m4).replace(_3, F3)), b4(m4 + 1 + y4 + s2), p4 = i2.indexOf(S, z3), m4 = i2.indexOf(F3, z3), o4 && (R(), M2)) return w();
247
+ if (i4.substring(m4 + 1 + y4, m4 + 1 + y4 + s2) === O2) {
248
+ if (d2.push(i4.substring(z3, m4).replace(_3, F3)), b4(m4 + 1 + y4 + s2), p4 = i4.indexOf(S, z3), m4 = i4.indexOf(F3, z3), o4 && (R(), M2)) return w();
249
249
  if (A2 && h3.length >= A2) return w(true);
250
250
  break;
251
251
  }
252
- u4.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: h3.length, index: z3 }), m4++;
252
+ u5.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: h3.length, index: z3 }), m4++;
253
253
  }
254
254
  }
255
- else if (x2 && 0 === d2.length && i2.substring(z3, z3 + a4) === x2) {
255
+ else if (x2 && 0 === d2.length && i4.substring(z3, z3 + a4) === x2) {
256
256
  if (-1 === g2) return w();
257
- z3 = g2 + s2, g2 = i2.indexOf(O2, z3), p4 = i2.indexOf(S, z3);
258
- } else if (-1 !== p4 && (p4 < g2 || -1 === g2)) d2.push(i2.substring(z3, p4)), z3 = p4 + e, p4 = i2.indexOf(S, z3);
257
+ z3 = g2 + s2, g2 = i4.indexOf(O2, z3), p4 = i4.indexOf(S, z3);
258
+ } else if (-1 !== p4 && (p4 < g2 || -1 === g2)) d2.push(i4.substring(z3, p4)), z3 = p4 + e, p4 = i4.indexOf(S, z3);
259
259
  else {
260
260
  if (-1 === g2) break;
261
- if (d2.push(i2.substring(z3, g2)), b4(g2 + s2), o4 && (R(), M2)) return w();
261
+ if (d2.push(i4.substring(z3, g2)), b4(g2 + s2), o4 && (R(), M2)) return w();
262
262
  if (A2 && h3.length >= A2) return w(true);
263
263
  }
264
264
  return E5();
@@ -267,33 +267,33 @@ var require_papaparse_min = __commonJS({
267
267
  }
268
268
  function v3(e2) {
269
269
  var t2 = 0;
270
- return t2 = -1 !== e2 && (e2 = i2.substring(m4 + 1, e2)) && "" === e2.trim() ? e2.length : t2;
270
+ return t2 = -1 !== e2 && (e2 = i4.substring(m4 + 1, e2)) && "" === e2.trim() ? e2.length : t2;
271
271
  }
272
272
  function E5(e2) {
273
- return r2 || (void 0 === e2 && (e2 = i2.substring(z3)), d2.push(e2), z3 = n2, k2(d2), o4 && R()), w();
273
+ return r2 || (void 0 === e2 && (e2 = i4.substring(z3)), d2.push(e2), z3 = n2, k2(d2), o4 && R()), w();
274
274
  }
275
275
  function b4(e2) {
276
- z3 = e2, k2(d2), d2 = [], g2 = i2.indexOf(O2, z3);
276
+ z3 = e2, k2(d2), d2 = [], g2 = i4.indexOf(O2, z3);
277
277
  }
278
278
  function w(e2) {
279
279
  if (C2.header && !t && h3.length && !L2) {
280
280
  var s4 = h3[0], a5 = /* @__PURE__ */ Object.create(null), o5 = new Set(s4);
281
281
  let n4 = false;
282
282
  for (let r4 = 0; r4 < s4.length; r4++) {
283
- let i4 = P2(s4[r4]);
284
- if (a5[i4 = q3(C2.transformHeader) ? C2.transformHeader(i4, r4) : i4]) {
285
- let e4, t2 = a5[i4];
286
- for (; e4 = i4 + "_" + t2, t2++, o5.has(e4); ) ;
287
- o5.add(e4), s4[r4] = e4, a5[i4]++, n4 = true, (D3 = null === D3 ? {} : D3)[e4] = i4;
288
- } else a5[i4] = 1, s4[r4] = i4;
289
- o5.add(i4);
283
+ let i5 = P2(s4[r4]);
284
+ if (a5[i5 = q2(C2.transformHeader) ? C2.transformHeader(i5, r4) : i5]) {
285
+ let e4, t2 = a5[i5];
286
+ for (; e4 = i5 + "_" + t2, t2++, o5.has(e4); ) ;
287
+ o5.add(e4), s4[r4] = e4, a5[i5]++, n4 = true, (D3 = null === D3 ? {} : D3)[e4] = i5;
288
+ } else a5[i5] = 1, s4[r4] = i5;
289
+ o5.add(i5);
290
290
  }
291
291
  n4 && console.warn("Duplicate headers found and renamed."), L2 = true;
292
292
  }
293
- return { data: h3, errors: u4, meta: { delimiter: S, linebreak: O2, aborted: M2, truncated: !!e2, cursor: f2 + (t || 0), renamedHeaders: D3 } };
293
+ return { data: h3, errors: u5, meta: { delimiter: S, linebreak: O2, aborted: M2, truncated: !!e2, cursor: f2 + (t || 0), renamedHeaders: D3 } };
294
294
  }
295
295
  function R() {
296
- I2(w()), h3 = [], u4 = [];
296
+ I2(w()), h3 = [], u5 = [];
297
297
  }
298
298
  }, this.abort = function() {
299
299
  M2 = true;
@@ -302,57 +302,57 @@ var require_papaparse_min = __commonJS({
302
302
  };
303
303
  }
304
304
  function g(e) {
305
- var t = e.data, i2 = o2[t.workerId], r2 = false;
306
- if (t.error) i2.userError(t.error, t.file);
305
+ var t = e.data, i4 = o2[t.workerId], r2 = false;
306
+ if (t.error) i4.userError(t.error, t.file);
307
307
  else if (t.results && t.results.data) {
308
308
  var n2 = { abort: function() {
309
309
  r2 = true, _2(t.workerId, { data: [], errors: [], meta: { aborted: true } });
310
310
  }, pause: m2, resume: m2 };
311
- if (q3(i2.userStep)) {
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++) ;
311
+ if (q2(i4.userStep)) {
312
+ for (var s2 = 0; s2 < t.results.data.length && (i4.userStep({ data: t.results.data[s2], errors: t.results.errors, meta: t.results.meta }, n2), !r2); s2++) ;
313
313
  delete t.results;
314
- } else q3(i2.userChunk) && (i2.userChunk(t.results, n2, t.file), delete t.results);
314
+ } else q2(i4.userChunk) && (i4.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
- var i2 = o2[e];
320
- q3(i2.userComplete) && i2.userComplete(t), i2.terminate(), delete o2[e];
319
+ var i4 = o2[e];
320
+ q2(i4.userComplete) && i4.userComplete(t), i4.terminate(), delete o2[e];
321
321
  }
322
322
  function m2() {
323
323
  throw new Error("Not implemented.");
324
324
  }
325
325
  function b2(e) {
326
326
  if ("object" != typeof e || null === e) return e;
327
- var t, i2 = Array.isArray(e) ? [] : {};
328
- for (t in e) i2[t] = b2(e[t]);
329
- return i2;
327
+ var t, i4 = Array.isArray(e) ? [] : {};
328
+ for (t in e) i4[t] = b2(e[t]);
329
+ return i4;
330
330
  }
331
331
  function y2(e, t) {
332
332
  return function() {
333
333
  e.apply(t, arguments);
334
334
  };
335
335
  }
336
- function q3(e) {
336
+ function q2(e) {
337
337
  return "function" == typeof e;
338
338
  }
339
339
  return v2.parse = function(e, t) {
340
- var i2 = (t = t || {}).dynamicTyping || false;
341
- q3(i2) && (t.dynamicTypingFunction = i2, i2 = {});
342
- if (t.dynamicTyping = i2, t.transform = !!q3(t.transform) && t.transform, !t.worker || !v2.WORKERS_SUPPORTED) return i2 = null, v2.NODE_STREAM_INPUT, "string" == typeof e ? (e = P2(e), i2 = new (t.download ? f : c)(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
- (i2 = (() => {
340
+ var i4 = (t = t || {}).dynamicTyping || false;
341
+ q2(i4) && (t.dynamicTypingFunction = i4, i4 = {});
342
+ if (t.dynamicTyping = i4, t.transform = !!q2(t.transform) && t.transform, !t.worker || !v2.WORKERS_SUPPORTED) return i4 = null, v2.NODE_STREAM_INPUT, "string" == typeof e ? (e = P2(e), i4 = new (t.download ? f : c)(t)) : true === e.readable && q2(e.read) && q2(e.on) ? i4 = new p2(t) : (n.File && e instanceof File || e instanceof Object) && (i4 = new l2(t)), i4.stream(e);
343
+ (i4 = (() => {
344
344
  var e2;
345
345
  return !!v2.WORKERS_SUPPORTED && (e2 = (() => {
346
346
  var e4 = n.URL || n.webkitURL || null, t2 = r.toString();
347
347
  return v2.BLOB_URL || (v2.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 = g, e2.id = h2++, o2[e2.id] = e2);
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 });
349
+ })()).userStep = t.step, i4.userChunk = t.chunk, i4.userComplete = t.complete, i4.userError = t.error, t.step = q2(t.step), t.chunk = q2(t.chunk), t.complete = q2(t.complete), t.error = q2(t.error), delete t.worker, i4.postMessage({ input: e, config: t, workerId: i4.id });
350
350
  }, v2.unparse = function(e, t) {
351
- var s2 = false, _3 = true, m4 = ",", y4 = "\r\n", a4 = '"', o4 = a4 + a4, i2 = false, r2 = null, h3 = false, u4 = ((() => {
351
+ var s2 = false, _3 = true, m4 = ",", y4 = "\r\n", a4 = '"', o4 = a4 + a4, i4 = false, r2 = null, h3 = false, u5 = ((() => {
352
352
  if ("object" == typeof t) {
353
353
  if ("string" != typeof t.delimiter || v2.BAD_DELIMITERS.filter(function(e2) {
354
354
  return -1 !== t.delimiter.indexOf(e2);
355
- }).length || (m4 = t.delimiter), "boolean" != typeof t.quotes && "function" != typeof t.quotes && !Array.isArray(t.quotes) || (s2 = t.quotes), "boolean" != typeof t.skipEmptyLines && "string" != typeof t.skipEmptyLines || (i2 = t.skipEmptyLines), "string" == typeof t.newline && (y4 = t.newline), "string" == typeof t.quoteChar && (a4 = t.quoteChar, o4 = a4 + a4), "boolean" == typeof t.header && (_3 = t.header), Array.isArray(t.columns)) {
355
+ }).length || (m4 = t.delimiter), "boolean" != typeof t.quotes && "function" != typeof t.quotes && !Array.isArray(t.quotes) || (s2 = t.quotes), "boolean" != typeof t.skipEmptyLines && "string" != typeof t.skipEmptyLines || (i4 = t.skipEmptyLines), "string" == typeof t.newline && (y4 = t.newline), "string" == typeof t.quoteChar && (a4 = t.quoteChar, o4 = a4 + a4), "boolean" == typeof t.header && (_3 = t.header), Array.isArray(t.columns)) {
356
356
  if (0 === t.columns.length) throw new Error("Option columns is empty");
357
357
  r2 = t.columns;
358
358
  }
@@ -361,75 +361,75 @@ var require_papaparse_min = __commonJS({
361
361
  })(), new RegExp(U3(a4), "g"));
362
362
  "string" == typeof e && (e = JSON.parse(e));
363
363
  if (Array.isArray(e)) {
364
- if (!e.length || Array.isArray(e[0])) return n2(null, e, i2);
365
- if ("object" == typeof e[0]) return n2(r2 || Object.keys(e[0]), e, i2);
366
- } else if ("object" == typeof e) return "string" == typeof e.data && (e.data = JSON.parse(e.data)), Array.isArray(e.data) && (e.fields || (e.fields = e.meta && e.meta.fields || r2), e.fields || (e.fields = Array.isArray(e.data[0]) ? e.fields : "object" == typeof e.data[0] ? Object.keys(e.data[0]) : []), Array.isArray(e.data[0]) || "object" == typeof e.data[0] || (e.data = [e.data])), n2(e.fields || [], e.data || [], i2);
364
+ if (!e.length || Array.isArray(e[0])) return n2(null, e, i4);
365
+ if ("object" == typeof e[0]) return n2(r2 || Object.keys(e[0]), e, i4);
366
+ } else if ("object" == typeof e) return "string" == typeof e.data && (e.data = JSON.parse(e.data)), Array.isArray(e.data) && (e.fields || (e.fields = e.meta && e.meta.fields || r2), e.fields || (e.fields = Array.isArray(e.data[0]) ? e.fields : "object" == typeof e.data[0] ? Object.keys(e.data[0]) : []), Array.isArray(e.data[0]) || "object" == typeof e.data[0] || (e.data = [e.data])), n2(e.fields || [], e.data || [], i4);
367
367
  throw new Error("Unable to serialize unrecognized input");
368
- function n2(e2, t2, i4) {
368
+ function n2(e2, t2, i5) {
369
369
  var r4 = "", n4 = ("string" == typeof e2 && (e2 = JSON.parse(e2)), "string" == typeof t2 && (t2 = JSON.parse(t2)), Array.isArray(e2) && 0 < e2.length), s4 = !Array.isArray(t2[0]);
370
370
  if (n4 && _3) {
371
371
  for (var a5 = 0; a5 < e2.length; a5++) 0 < a5 && (r4 += m4), r4 += k2(e2[a5], a5);
372
372
  0 < t2.length && (r4 += y4);
373
373
  }
374
374
  for (var o5 = 0; o5 < t2.length; o5++) {
375
- var h4 = (n4 ? e2 : t2[o5]).length, u5 = false, d2 = n4 ? 0 === Object.keys(t2[o5]).length : 0 === t2[o5].length;
376
- if (i4 && !n4 && (u5 = "greedy" === i4 ? "" === t2[o5].join("").trim() : 1 === t2[o5].length && 0 === t2[o5][0].length), "greedy" === i4 && n4) {
377
- for (var f2 = [], l2 = 0; l2 < h4; l2++) {
378
- var c2 = s4 ? e2[l2] : l2;
375
+ var h4 = (n4 ? e2 : t2[o5]).length, u6 = false, d2 = n4 ? 0 === Object.keys(t2[o5]).length : 0 === t2[o5].length;
376
+ if (i5 && !n4 && (u6 = "greedy" === i5 ? "" === t2[o5].join("").trim() : 1 === t2[o5].length && 0 === t2[o5][0].length), "greedy" === i5 && n4) {
377
+ for (var f2 = [], l3 = 0; l3 < h4; l3++) {
378
+ var c2 = s4 ? e2[l3] : l3;
379
379
  f2.push(t2[o5][c2]);
380
380
  }
381
- u5 = "" === f2.join("").trim();
381
+ u6 = "" === f2.join("").trim();
382
382
  }
383
- if (!u5) {
383
+ if (!u6) {
384
384
  for (var p4 = 0; p4 < h4; p4++) {
385
385
  0 < p4 && !d2 && (r4 += m4);
386
386
  var g2 = n4 && s4 ? e2[p4] : p4;
387
387
  r4 += k2(t2[o5][g2], p4);
388
388
  }
389
- o5 < t2.length - 1 && (!i4 || 0 < h4 && !d2) && (r4 += y4);
389
+ o5 < t2.length - 1 && (!i5 || 0 < h4 && !d2) && (r4 += y4);
390
390
  }
391
391
  }
392
392
  return r4;
393
393
  }
394
394
  function k2(e2, t2) {
395
- var i4, r4, n4;
396
- return null == e2 ? "" : e2.constructor === Date ? JSON.stringify(e2).slice(1, 25) : (n4 = false, h3 && "string" == typeof e2 && h3.test(e2) && (e2 = "'" + e2, n4 = true), r4 = (i4 = e2.toString()).replace(u4, o4), (n4 = n4 || true === s2 || "function" == typeof s2 && s2(e2, t2) || Array.isArray(s2) && s2[t2] || ((e4, t4) => {
397
- for (var i5 = 0; i5 < t4.length; i5++) if (-1 < e4.indexOf(t4[i5])) return true;
395
+ var i5, r4, n4;
396
+ return null == e2 ? "" : e2.constructor === Date ? JSON.stringify(e2).slice(1, 25) : (n4 = false, h3 && "string" == typeof e2 && h3.test(e2) && (e2 = "'" + e2, n4 = true), r4 = (i5 = e2.toString()).replace(u5, o4), (n4 = n4 || true === s2 || "function" == typeof s2 && s2(e2, t2) || Array.isArray(s2) && s2[t2] || ((e4, t4) => {
397
+ for (var i6 = 0; i6 < t4.length; i6++) if (-1 < e4.indexOf(t4[i6])) return true;
398
398
  return false;
399
- })(r4, v2.BAD_DELIMITERS) || -1 < r4.indexOf(m4) || -1 < i4.indexOf(a4) || " " === r4.charAt(0) || " " === r4.charAt(r4.length - 1)) ? a4 + r4 + a4 : r4);
399
+ })(r4, v2.BAD_DELIMITERS) || -1 < r4.indexOf(m4) || -1 < i5.indexOf(a4) || " " === r4.charAt(0) || " " === r4.charAt(r4.length - 1)) ? a4 + r4 + a4 : r4);
400
400
  }
401
- }, v2.RECORD_SEP = String.fromCharCode(30), v2.UNIT_SEP = String.fromCharCode(31), v2.BYTE_ORDER_MARK = "\uFEFF", v2.BAD_DELIMITERS = ["\r", "\n", '"', v2.BYTE_ORDER_MARK], v2.WORKERS_SUPPORTED = !s && !!n.Worker, v2.NODE_STREAM_INPUT = 1, v2.LocalChunkSize = 10485760, v2.RemoteChunkSize = 5242880, v2.DefaultDelimiter = ",", v2.Parser = E4, v2.ParserHandle = i, v2.NetworkStreamer = f, v2.FileStreamer = l, v2.StringStreamer = c, v2.ReadableStreamStreamer = p2, n.jQuery && ((d = n.jQuery).fn.parse = function(o4) {
402
- var i2 = o4.config || {}, h3 = [];
401
+ }, v2.RECORD_SEP = String.fromCharCode(30), v2.UNIT_SEP = String.fromCharCode(31), v2.BYTE_ORDER_MARK = "\uFEFF", v2.BAD_DELIMITERS = ["\r", "\n", '"', v2.BYTE_ORDER_MARK], v2.WORKERS_SUPPORTED = !s && !!n.Worker, v2.NODE_STREAM_INPUT = 1, v2.LocalChunkSize = 10485760, v2.RemoteChunkSize = 5242880, v2.DefaultDelimiter = ",", v2.Parser = E4, v2.ParserHandle = i2, v2.NetworkStreamer = f, v2.FileStreamer = l2, v2.StringStreamer = c, v2.ReadableStreamStreamer = p2, n.jQuery && ((d = n.jQuery).fn.parse = function(o4) {
402
+ var i4 = o4.config || {}, h3 = [];
403
403
  return this.each(function(e2) {
404
404
  if (!("INPUT" === d(this).prop("tagName").toUpperCase() && "file" === d(this).attr("type").toLowerCase() && n.FileReader) || !this.files || 0 === this.files.length) return true;
405
- for (var t = 0; t < this.files.length; t++) h3.push({ file: this.files[t], inputElem: this, instanceConfig: d.extend({}, i2) });
405
+ for (var t = 0; t < this.files.length; t++) h3.push({ file: this.files[t], inputElem: this, instanceConfig: d.extend({}, i4) });
406
406
  }), e(), this;
407
407
  function e() {
408
- if (0 === h3.length) q3(o4.complete) && o4.complete();
408
+ if (0 === h3.length) q2(o4.complete) && o4.complete();
409
409
  else {
410
- var e2, t, i4, r2, n2 = h3[0];
411
- if (q3(o4.before)) {
410
+ var e2, t, i5, r2, n2 = h3[0];
411
+ if (q2(o4.before)) {
412
412
  var s2 = o4.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 (q3(o4.error) && o4.error({ name: e2 }, t, i4, r2));
415
- if ("skip" === s2.action) return void u4();
414
+ if ("abort" === s2.action) return e2 = "AbortError", t = n2.file, i5 = n2.inputElem, r2 = s2.reason, void (q2(o4.error) && o4.error({ name: e2 }, t, i5, r2));
415
+ if ("skip" === s2.action) return void u5();
416
416
  "object" == typeof s2.config && (n2.instanceConfig = d.extend(n2.instanceConfig, s2.config));
417
- } else if ("skip" === s2) return void u4();
417
+ } else if ("skip" === s2) return void u5();
418
418
  }
419
419
  var a4 = n2.instanceConfig.complete;
420
420
  n2.instanceConfig.complete = function(e4) {
421
- q3(a4) && a4(e4, n2.file, n2.inputElem), u4();
421
+ q2(a4) && a4(e4, n2.file, n2.inputElem), u5();
422
422
  }, v2.parse(n2.file, n2.instanceConfig);
423
423
  }
424
424
  }
425
- function u4() {
425
+ function u5() {
426
426
  h3.splice(0, 1), e();
427
427
  }
428
428
  }), a2 && (n.onmessage = function(e) {
429
429
  e = e.data;
430
430
  void 0 === v2.WORKER_ID && e && (v2.WORKER_ID = e.workerId);
431
431
  "string" == typeof e.input ? n.postMessage({ workerId: v2.WORKER_ID, results: v2.parse(e.input, e.config), finished: true }) : (n.File && e.input instanceof File || e.input instanceof Object) && (e = v2.parse(e.input, e.config)) && n.postMessage({ workerId: v2.WORKER_ID, results: e, finished: true });
432
- }), (f.prototype = Object.create(u2.prototype)).constructor = f, (l.prototype = Object.create(u2.prototype)).constructor = l, (c.prototype = Object.create(c.prototype)).constructor = c, (p2.prototype = Object.create(u2.prototype)).constructor = p2, v2;
432
+ }), (f.prototype = Object.create(u4.prototype)).constructor = f, (l2.prototype = Object.create(u4.prototype)).constructor = l2, (c.prototype = Object.create(c.prototype)).constructor = c, (p2.prototype = Object.create(u4.prototype)).constructor = p2, v2;
433
433
  });
434
434
  }
435
435
  });
@@ -729,21 +729,21 @@ function j() {
729
729
  } catch {
730
730
  continue;
731
731
  }
732
- for (let [i, r] of N) {
732
+ for (let [i2, r] of N) {
733
733
  let a2;
734
734
  try {
735
- a2 = o2.of(i);
735
+ a2 = o2.of(i2);
736
736
  } catch {
737
737
  a2 = void 0;
738
738
  }
739
- if (!a2 || a2 === i) continue;
739
+ if (!a2 || a2 === i2) continue;
740
740
  let s = u(a2);
741
741
  s && !n.has(s) && n.set(s, r);
742
742
  }
743
743
  }
744
744
  for (let [t, o2] of Object.entries(Q)) {
745
- let i = u(t);
746
- i && n.set(i, o2);
745
+ let i2 = u(t);
746
+ i2 && n.set(i2, o2);
747
747
  }
748
748
  return b = n, n;
749
749
  }
@@ -778,20 +778,20 @@ var t3 = { US: "washington", CA: "ottawa", MX: "mexico city", GB: "london", FR:
778
778
  var U = null;
779
779
  function y() {
780
780
  if (U) return U;
781
- let n = /* @__PURE__ */ new Map(), e = P, t = (o2, i, r) => {
781
+ let n = /* @__PURE__ */ new Map(), e = P, t = (o2, i2, r) => {
782
782
  if (!o2) return;
783
783
  let a2 = n.get(o2);
784
- a2 ? a2.some((s) => s.row === i) || a2.push({ row: i, primary: r }) : n.set(o2, [{ row: i, primary: r }]);
784
+ a2 ? a2.some((s) => s.row === i2) || a2.push({ row: i2, primary: r }) : n.set(o2, [{ row: i2, primary: r }]);
785
785
  };
786
786
  for (let o2 of e.split(",")) {
787
- let i = o2.split("|");
788
- if (i.length < 7) continue;
789
- let r = { a1: i[1], cc: i[2], lon: +i[3], lat: +i[4], pop: +i[5], kinds: i[6] || "N" };
790
- i.length > 8 && i[8] && (r.tags = i[8].split(";").filter(Boolean));
787
+ let i2 = o2.split("|");
788
+ if (i2.length < 7) continue;
789
+ let r = { a1: i2[1], cc: i2[2], lon: +i2[3], lat: +i2[4], pop: +i2[5], kinds: i2[6] || "N" };
790
+ i2.length > 8 && i2[8] && (r.tags = i2[8].split(";").filter(Boolean));
791
791
  let a2 = t3[r.cc];
792
- if (a2 && u(i[0]) === a2 && (r.tags || (r.tags = []), r.tags.includes("capital") || r.tags.push("capital")), t(u(i[0]), r, true), i.length > 7 && i[7]) for (let s of i[7].split(";")) t(u(s), r, false);
792
+ if (a2 && u(i2[0]) === a2 && (r.tags || (r.tags = []), r.tags.includes("capital") || r.tags.push("capital")), t(u(i2[0]), r, true), i2.length > 7 && i2[7]) for (let s of i2[7].split(";")) t(u(s), r, false);
793
793
  }
794
- for (let o2 of n.values()) o2.sort((i, r) => r.row.pop - i.row.pop);
794
+ for (let o2 of n.values()) o2.sort((i2, r) => r.row.pop - i2.row.pop);
795
795
  return U = n, n;
796
796
  }
797
797
  var e3 = 200;
@@ -802,17 +802,17 @@ function i3() {
802
802
  for (let [e, t] of y()) {
803
803
  if (!e.endsWith(" city")) continue;
804
804
  let o2 = e.slice(0, -5);
805
- !o2 || y().get(o2)?.some((i) => i.primary) || t[0].row.pop < e3 || n.set(o2, t);
805
+ !o2 || y().get(o2)?.some((i2) => i2.primary) || t[0].row.pop < e3 || n.set(o2, t);
806
806
  }
807
807
  return L = n, n;
808
808
  }
809
809
  function O(n) {
810
810
  if (!n) return;
811
811
  let e = y().get(n);
812
- if (e?.some((i) => i.primary)) return e;
812
+ if (e?.some((i2) => i2.primary)) return e;
813
813
  let t = i3().get(n);
814
814
  if (!t) return e;
815
- let o2 = t.map((i) => ({ row: i.row, primary: true }));
815
+ let o2 = t.map((i2) => ({ row: i2.row, primary: true }));
816
816
  return e ? [...o2, ...e] : o2;
817
817
  }
818
818
  var I = null;
@@ -825,10 +825,10 @@ function o3() {
825
825
  }
826
826
  let e = /* @__PURE__ */ new Map();
827
827
  for (let t of y().values()) for (let o2 of t) {
828
- let i = T(o2.row.cc);
829
- if (!i) continue;
830
- let r = e.get(i);
831
- (r === void 0 || o2.row.pop > r) && (e.set(i, o2.row.pop), n.set(i, { lon: o2.row.lon, lat: o2.row.lat }));
828
+ let i2 = T(o2.row.cc);
829
+ if (!i2) continue;
830
+ let r = e.get(i2);
831
+ (r === void 0 || o2.row.pop > r) && (e.set(i2, o2.row.pop), n.set(i2, { lon: o2.row.lon, lat: o2.row.lat }));
832
832
  }
833
833
  return I = n, n;
834
834
  }
@@ -841,8 +841,8 @@ function D() {
841
841
  if (t.length < 5) continue;
842
842
  let o2 = { key: t[0], cc: t[1], name: t[2], lon: +t[3], lat: +t[4] };
843
843
  n.set(u(o2.key), o2);
844
- let i = u(o2.name);
845
- i === "mexico" && o2.cc === "MX" ? (n.set("estado de mexico", o2), n.set("edomex", o2)) : n.set(i, o2);
844
+ let i2 = u(o2.name);
845
+ i2 === "mexico" && o2.cc === "MX" ? (n.set("estado de mexico", o2), n.set("edomex", o2)) : n.set(i2, o2);
846
846
  }
847
847
  return B = n, n;
848
848
  }
@@ -898,16 +898,16 @@ function A3(n) {
898
898
  if (isFinite(a2) && isFinite(s) && a2 >= -90 && a2 <= 90 && s >= -180 && s <= 180) if (a2 === 0 && s === 0) e = { lat: 0, lon: 0, precision: "latlon" };
899
899
  else return { lat: a2, lon: s, precision: "latlon" };
900
900
  }
901
- let i = E(n.country), r = Y(n.state);
902
- if (r && i && c3(r) !== i && (r = null), n.city !== void 0 && n.city !== null) {
901
+ let i2 = E(n.country), r = Y(n.state);
902
+ if (r && i2 && c3(r) !== i2 && (r = null), n.city !== void 0 && n.city !== null) {
903
903
  let a2 = u(String(n.city)), s = O(a2), f = s ? F(s, n.mapKind) : null;
904
904
  if (f && f.length) {
905
905
  let d = n.state === void 0 || n.state === null ? "" : String(n.state).trim(), R = d ? u(d) : "", g = d ? Y(d) : null, S = [], m2 = -1;
906
906
  for (let c of f) {
907
- let l = c.row, A2 = 0;
908
- if (d && l.a1 !== "") if (g && l.a1 === g || u(l.a1) === R) A2++;
907
+ let l2 = c.row, A2 = 0;
908
+ if (d && l2.a1 !== "") if (g && l2.a1 === g || u(l2.a1) === R) A2++;
909
909
  else continue;
910
- if (i) if (T(l.cc) === i) A2++;
910
+ if (i2) if (T(l2.cc) === i2) A2++;
911
911
  else continue;
912
912
  A2 > m2 ? (m2 = A2, S = [c]) : A2 === m2 && S.push(c);
913
913
  }
@@ -921,7 +921,7 @@ function A3(n) {
921
921
  if (p2.size > 1) return { ambiguous: true, matches: p2.size };
922
922
  }
923
923
  }
924
- if (!i || r3.has(i)) for (let a2 of Z(n.zip)) {
924
+ if (!i2 || r3.has(i2)) for (let a2 of Z(n.zip)) {
925
925
  let s = a3().get(a2);
926
926
  if (s) return { lat: s.lat, lon: s.lon, precision: "zip3" };
927
927
  }
@@ -929,8 +929,8 @@ function A3(n) {
929
929
  let a2 = D().get(u(r));
930
930
  if (a2) return { lat: a2.lat, lon: a2.lon, precision: "state" };
931
931
  }
932
- if (i && (n.mapKind !== "north-america" || s3.has(i))) {
933
- let a2 = o3().get(i);
932
+ if (i2 && (n.mapKind !== "north-america" || s3.has(i2))) {
933
+ let a2 = o3().get(i2);
934
934
  if (a2) return { lat: a2.lat, lon: a2.lon, precision: "country" };
935
935
  }
936
936
  return e;
@@ -938,26 +938,26 @@ function A3(n) {
938
938
  var G = { latlon: 0, city: 1, zip3: 2, state: 3, country: 4 };
939
939
  var x = 8;
940
940
  function y3(n, e) {
941
- let t = new Array(n.length), o2 = new Array(n.length), i = new Array(n.length), r = /* @__PURE__ */ new Set(), a2 = [], s = /* @__PURE__ */ new Set(), f = [], d = /* @__PURE__ */ new Set(), R = [], g = { latlon: 0, city: 0, zip3: 0, state: 0, country: 0 }, S = 0, m2 = 0, p2 = null;
942
- for (let l = 0; l < n.length; ++l) {
943
- let A2 = n[l], C2 = A3({ ...A2, mapKind: e });
941
+ let t = new Array(n.length), o2 = new Array(n.length), i2 = new Array(n.length), r = /* @__PURE__ */ new Set(), a2 = [], s = /* @__PURE__ */ new Set(), f = [], d = /* @__PURE__ */ new Set(), R = [], g = { latlon: 0, city: 0, zip3: 0, state: 0, country: 0 }, S = 0, m2 = 0, p2 = null;
942
+ for (let l2 = 0; l2 < n.length; ++l2) {
943
+ let A2 = n[l2], C2 = A3({ ...A2, mapKind: e });
944
944
  if (S3(C2)) {
945
- t[l] = null, o2[l] = null, i[l] = null, m2++;
945
+ t[l2] = null, o2[l2] = null, i2[l2] = null, m2++;
946
946
  let M2 = K(A2);
947
947
  M2 && !d.has(M2.toLowerCase()) && (d.add(M2.toLowerCase()), R.length < x && R.push(M2));
948
948
  } else if (C2) {
949
- if (t[l] = C2.lat, o2[l] = C2.lon, i[l] = C2.precision, S++, g[C2.precision]++, (p2 === null || G[C2.precision] > G[p2]) && (p2 = C2.precision), G[C2.precision] > G.city) {
949
+ if (t[l2] = C2.lat, o2[l2] = C2.lon, i2[l2] = C2.precision, S++, g[C2.precision]++, (p2 === null || G[C2.precision] > G[p2]) && (p2 = C2.precision), G[C2.precision] > G.city) {
950
950
  let M2 = K(A2);
951
951
  M2 && !s.has(M2.toLowerCase()) && (s.add(M2.toLowerCase()), f.length < x && f.push(M2));
952
952
  }
953
953
  } else {
954
- t[l] = null, o2[l] = null, i[l] = null;
954
+ t[l2] = null, o2[l2] = null, i2[l2] = null;
955
955
  let M2 = K(A2);
956
956
  M2 && !r.has(M2.toLowerCase()) && (r.add(M2.toLowerCase()), a2.push(M2));
957
957
  }
958
958
  }
959
- let c = !n3() && n.some((l) => l.city !== null && l.city !== void 0 && String(l.city).trim() !== "");
960
- return { lat: t, lon: o2, precisions: i, precision: p2, precisionCounts: g, coarseExamples: f, unmatched: a2, ambiguousRows: m2, ambiguousExamples: R, matchedRows: S, totalRows: n.length, ...c ? { cityTableMissing: true } : {} };
959
+ let c = !n3() && n.some((l2) => l2.city !== null && l2.city !== void 0 && String(l2.city).trim() !== "");
960
+ return { lat: t, lon: o2, precisions: i2, precision: p2, precisionCounts: g, coarseExamples: f, unmatched: a2, ambiguousRows: m2, ambiguousExamples: R, matchedRows: S, totalRows: n.length, ...c ? { cityTableMissing: true } : {} };
961
961
  }
962
962
  function K(n) {
963
963
  let e = [n.city, n.state, n.zip, n.country].filter((t) => t != null && String(t).trim() !== "").map((t) => String(t).trim()).join(", ");
@@ -982,11 +982,11 @@ var rn = new Set(on.map((n) => n[0]));
982
982
  var pn = { "Ala.": "AL", "Alab.": "AL", "Ariz.": "AZ", "Ark.": "AR", "Calif.": "CA", "Cal.": "CA", "Colo.": "CO", "Col.": "CO", "Conn.": "CT", "Del.": "DE", "Fla.": "FL", "Flor.": "FL", "Ga.": "GA", "Ill.": "IL", "Ind.": "IN", "Kan.": "KS", "Kans.": "KS", "Ky.": "KY", "La.": "LA", "Md.": "MD", "Mass.": "MA", "Mich.": "MI", "Minn.": "MN", "Miss.": "MS", "Mo.": "MO", "Mont.": "MT", "Neb.": "NE", "Nebr.": "NE", "Nev.": "NV", "N.H.": "NH", "N.J.": "NJ", "N.M.": "NM", "N.Mex.": "NM", "N. Mex.": "NM", "N.Y.": "NY", "N.C.": "NC", "N.D.": "ND", "N.Dak.": "ND", "N. Dak.": "ND", "Okla.": "OK", "Ore.": "OR", "Oreg.": "OR", "Pa.": "PA", "Penn.": "PA", "Penna.": "PA", "R.I.": "RI", "S.C.": "SC", "S.D.": "SD", "S.Dak.": "SD", "S. Dak.": "SD", "Tenn.": "TN", "Tex.": "TX", "Vt.": "VT", "Va.": "VA", "Wash.": "WA", "W.Va.": "WV", "W. Va.": "WV", "Wis.": "WI", "Wisc.": "WI", "Wyo.": "WY", "D.C.": "DC", "Wash. D.C.": "DC", "Wash., D.C.": "DC", "P.R.": "PR", "V.I.": "VI" };
983
983
  var an = (() => {
984
984
  let n = /* @__PURE__ */ new Map();
985
- for (let [o2, i] of on) n.set(m(i), o2);
985
+ for (let [o2, i2] of on) n.set(m(i2), o2);
986
986
  n.set(m("Washington DC"), "DC"), n.set(m("Washington D.C."), "DC"), n.set(m("US Virgin Islands"), "VI");
987
- for (let [o2, i] of Object.entries(pn)) {
987
+ for (let [o2, i2] of Object.entries(pn)) {
988
988
  let r = m(o2);
989
- r && !n.has(r) && n.set(r, i);
989
+ r && !n.has(r) && n.set(r, i2);
990
990
  }
991
991
  return n;
992
992
  })();
@@ -1000,27 +1000,27 @@ function m(n) {
1000
1000
  var sn = /* @__PURE__ */ new Set(["zip", "zipcode", "postal", "postcode", "plz"]);
1001
1001
  function p(n, o2) {
1002
1002
  if (!n) return false;
1003
- for (let i of o(n)) if (o2.has(i)) return true;
1003
+ for (let i2 of o(n)) if (o2.has(i2)) return true;
1004
1004
  return false;
1005
1005
  }
1006
1006
  function hn(n, o2) {
1007
1007
  if (n == null) return null;
1008
- let i = String(n).trim();
1009
- if (i.length === 0) return null;
1008
+ let i2 = String(n).trim();
1009
+ if (i2.length === 0) return null;
1010
1010
  switch (o2) {
1011
1011
  case "country-iso3":
1012
1012
  case "country-iso2":
1013
1013
  case "country-name":
1014
- return E(i);
1014
+ return E(i2);
1015
1015
  case "us-state-code":
1016
1016
  case "us-state-name": {
1017
- let r = un(i);
1018
- return rn.has(r) ? r : an.get(m(i)) ?? null;
1017
+ let r = un(i2);
1018
+ return rn.has(r) ? r : an.get(m(i2)) ?? null;
1019
1019
  }
1020
1020
  case "us-zip5":
1021
- return M3(i);
1021
+ return M3(i2);
1022
1022
  case "us-county-fips":
1023
- return /^\d{5}$/.test(i) && cn.has(i.slice(0, 2)) ? i : null;
1023
+ return /^\d{5}$/.test(i2) && cn.has(i2.slice(0, 2)) ? i2 : null;
1024
1024
  default:
1025
1025
  return null;
1026
1026
  }
@@ -1040,10 +1040,10 @@ function Rn(n) {
1040
1040
  }
1041
1041
  }
1042
1042
  function wn(n, o2) {
1043
- let i = new Array(n.length), r = /* @__PURE__ */ new Set(), A2 = [], y2 = 0;
1043
+ let i2 = new Array(n.length), r = /* @__PURE__ */ new Set(), A2 = [], y2 = 0;
1044
1044
  for (let S = 0; S < n.length; ++S) {
1045
1045
  let O2 = hn(n[S], o2);
1046
- if (i[S] = O2, O2 !== null) y2++;
1046
+ if (i2[S] = O2, O2 !== null) y2++;
1047
1047
  else {
1048
1048
  let C2 = n[S];
1049
1049
  if (C2 != null) {
@@ -1055,22 +1055,22 @@ function wn(n, o2) {
1055
1055
  }
1056
1056
  }
1057
1057
  }
1058
- return { iso: i, unmatched: A2, matchedRows: y2, totalRows: n.length };
1058
+ return { iso: i2, unmatched: A2, matchedRows: y2, totalRows: n.length };
1059
1059
  }
1060
1060
 
1061
- // ../shape-core/dist/chunk-7AU3Y5FJ.mjs
1061
+ // ../shape-core/dist/chunk-75LGS6NJ.mjs
1062
1062
  var import_papaparse = __toESM(require_papaparse_min(), 1);
1063
1063
  /*! @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. */
1064
1064
  var pt = { "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" };
1065
- var X2 = (() => {
1065
+ var $2 = (() => {
1066
1066
  let n = /* @__PURE__ */ new Map();
1067
1067
  for (let t of Object.keys(pt)) for (let e of pt[t].split(/\s+/)) e && n.set(e, t);
1068
1068
  return n;
1069
1069
  })();
1070
1070
  function Dt(n) {
1071
1071
  for (let [t, e] of n) {
1072
- let s = X2.get(t);
1073
- s && !X2.has(e) && X2.set(e, s);
1072
+ let s = $2.get(t);
1073
+ s && !$2.has(e) && $2.set(e, s);
1074
1074
  }
1075
1075
  }
1076
1076
  Dt(N);
@@ -1095,7 +1095,9 @@ function zt(n) {
1095
1095
  return t.length === 0 ? "" : t.replace(Wt, " ");
1096
1096
  }
1097
1097
  function Ct(n, t) {
1098
- return t ? n.test(zt(t)) || n.test(_t(t)) : false;
1098
+ if (!t) return false;
1099
+ let e = _t(t);
1100
+ return n.test(zt(t)) || n.test(e) || n.test(o(e).join(" "));
1099
1101
  }
1100
1102
  function Mt(n) {
1101
1103
  return Ct(Vt, n);
@@ -1136,10 +1138,10 @@ function Rt(n) {
1136
1138
  return ["sum", "average", "median", "min", "max", "count", "distinctcount", "first"];
1137
1139
  }
1138
1140
  }
1139
- function ye(n) {
1141
+ function _e(n) {
1140
1142
  return Rt(n)[0];
1141
1143
  }
1142
- function Se(n, t) {
1144
+ function Ce(n, t) {
1143
1145
  if (t !== "sum" && t !== "count") return false;
1144
1146
  if (t === "count") return true;
1145
1147
  let e = Tt(n);
@@ -1164,7 +1166,7 @@ function A(r) {
1164
1166
  }
1165
1167
  function C(r) {
1166
1168
  let e = A(r);
1167
- if (e.length === 0 || $2(r) < 95) return false;
1169
+ if (e.length === 0 || $3(r) < 95) return false;
1168
1170
  let n = e.filter((c) => E2(c) && !Y(c)).length, s = e.filter((c) => !E2(c) && !!Y(c)).length;
1169
1171
  return n >= 1 && n >= s;
1170
1172
  }
@@ -1173,7 +1175,7 @@ function W2(r, e) {
1173
1175
  let n = E(r);
1174
1176
  return n ? e === "world" ? true : s3.has(n) : false;
1175
1177
  }
1176
- function $2(r) {
1178
+ function $3(r) {
1177
1179
  let e = A(r);
1178
1180
  if (e.length === 0) return 0;
1179
1181
  let n = 0;
@@ -1224,71 +1226,71 @@ function Jt(r, e) {
1224
1226
  return n;
1225
1227
  }
1226
1228
  function Qt(r, e, n, s, c) {
1227
- let P2 = [], u2 = [], o2 = {}, v2 = {}, k2 = new Set(r), l = (t) => e.map((i) => i[t]);
1229
+ let P2 = [], u4 = [], o2 = {}, v2 = {}, k2 = new Set(r), l2 = (t) => e.map((i2) => i2[t]);
1228
1230
  for (let t of ["city", "country"]) {
1229
- let i = n?.[t];
1230
- i && k2.has(i) && (o2[t] = i);
1231
+ let i2 = n?.[t];
1232
+ i2 && k2.has(i2) && (o2[t] = i2);
1231
1233
  }
1232
- let X3 = new Set(c ?? r);
1234
+ let X2 = new Set(c ?? r);
1233
1235
  for (let t of ["lat", "lon"]) {
1234
- let i = n?.[t];
1235
- i && X3.has(i) && (o2[t] = i);
1236
+ let i2 = n?.[t];
1237
+ i2 && X2.has(i2) && (o2[t] = i2);
1236
1238
  }
1237
1239
  let p2 = n?.zip;
1238
1240
  if (p2 && k2.has(p2)) {
1239
- let t = l(p2), i = D2(t);
1240
- i < 95 ? u2.push(`zip=${p2} (only ${i}% of values read as ZIPs)`) : Z2(t, p2) ? o2.zip = p2 : u2.push(`zip=${p2} (all values are 3-4 digits with nothing to say they are postal)`);
1241
+ let t = l2(p2), i2 = D2(t);
1242
+ i2 < 95 ? u4.push(`zip=${p2} (only ${i2}% of values read as ZIPs)`) : Z2(t, p2) ? o2.zip = p2 : u4.push(`zip=${p2} (all values are 3-4 digits with nothing to say they are postal)`);
1241
1243
  }
1242
1244
  let g = n?.state;
1243
1245
  if (g && k2.has(g)) {
1244
- let t = l(g), i = A(t);
1245
- i.length > 0 && i.every((a2) => W2(a2, s)) ? u2.push(`state=${g} (every value is "CA", which is both Canada and California)`) : C(t) ? (u2.push(`state=${g} (every value is a country, not a state)`), o2.country || (o2.country = g)) : M(t) < 95 ? u2.push(`state=${g} (only ${M(t)}% of values are states/provinces)`) : o2.state = g;
1246
+ let t = l2(g), i2 = A(t);
1247
+ i2.length > 0 && i2.every((a2) => W2(a2, s)) ? u4.push(`state=${g} (every value is "CA", which is both Canada and California)`) : C(t) ? (u4.push(`state=${g} (every value is a country, not a state)`), o2.country || (o2.country = g)) : M(t) < 95 ? u4.push(`state=${g} (only ${M(t)}% of values are states/provinces)`) : o2.state = g;
1246
1248
  }
1247
1249
  let d = new Set(Object.values(o2).filter(Boolean)), x2 = r.filter((t) => !d.has(t) && !t.startsWith("__"));
1248
1250
  if (!o2.state) {
1249
1251
  let t = null;
1250
- for (let i of x2) {
1251
- let a2 = l(i);
1252
+ for (let i2 of x2) {
1253
+ let a2 = l2(i2);
1252
1254
  if (C(a2)) continue;
1253
1255
  let f = M(a2);
1254
1256
  if (f < 95) continue;
1255
1257
  let N2 = G2(a2, (S) => !!Y(S)), Y2 = G2(a2, (S) => !!Y(S) && !W2(S, s));
1256
- N2 < z2 && Y2 < 1 || (!t || f > t.pct) && (t = { name: i, pct: f });
1258
+ N2 < z2 && Y2 < 1 || (!t || f > t.pct) && (t = { name: i2, pct: f });
1257
1259
  }
1258
1260
  t && (o2.state = t.name, d.add(t.name), P2.push(`state=${t.name} (${t.pct}% states/provinces)`));
1259
1261
  }
1260
1262
  if (!o2.zip) for (let t of x2) {
1261
1263
  if (d.has(t)) continue;
1262
- let i = l(t), a2 = D2(i);
1263
- if (!(a2 < 95) && Z2(i, t) && !(Jt(i, (f) => Z(f).length > 0) < z2)) {
1264
+ let i2 = l2(t), a2 = D2(i2);
1265
+ if (!(a2 < 95) && Z2(i2, t) && !(Jt(i2, (f) => Z(f).length > 0) < z2)) {
1264
1266
  o2.zip = t, d.add(t), P2.push(`zip=${t} (${a2}% ZIP codes)`);
1265
1267
  break;
1266
1268
  }
1267
1269
  }
1268
1270
  let h2 = o2.country;
1269
- if (!h2 || !C(l(h2))) {
1271
+ if (!h2 || !C(l2(h2))) {
1270
1272
  let t = null;
1271
- for (let i of x2) {
1272
- if (d.has(i) || !C(l(i))) continue;
1273
- let a2 = $2(l(i));
1274
- (!t || a2 > t.pct) && (t = { name: i, pct: a2 });
1273
+ for (let i2 of x2) {
1274
+ if (d.has(i2) || !C(l2(i2))) continue;
1275
+ let a2 = $3(l2(i2));
1276
+ (!t || a2 > t.pct) && (t = { name: i2, pct: a2 });
1275
1277
  }
1276
- t && (h2 && (u2.push(`country=${h2} (only ${$2(l(h2))}% of values are country identifiers; using ${t.name} instead)`), v2.country = h2), o2.country = t.name, d.add(t.name), P2.push(`country=${t.name}`));
1278
+ t && (h2 && (u4.push(`country=${h2} (only ${$3(l2(h2))}% of values are country identifiers; using ${t.name} instead)`), v2.country = h2), o2.country = t.name, d.add(t.name), P2.push(`country=${t.name}`));
1277
1279
  }
1278
1280
  if (!o2.city) {
1279
1281
  let t = null;
1280
- for (let i of x2) {
1281
- if (d.has(i)) continue;
1282
- let a2 = l(i), f = Yt(a2, s);
1283
- f < m3 || G2(a2, (N2) => p3(N2, s)) < z2 || (!t || f > t.pct) && (t = { name: i, pct: f });
1282
+ for (let i2 of x2) {
1283
+ if (d.has(i2)) continue;
1284
+ let a2 = l2(i2), f = Yt(a2, s);
1285
+ f < m3 || G2(a2, (N2) => p3(N2, s)) < z2 || (!t || f > t.pct) && (t = { name: i2, pct: f });
1284
1286
  }
1285
1287
  t && (o2.city = t.name, P2.push(`city=${t.name} (${t.pct}% known cities)`));
1286
1288
  }
1287
- let B2 = o2.country ? l(o2.country) : [], _2 = !!o2.country && C(B2), j2 = _2 ? new Set(B2.map((t) => E(t == null ? null : String(t))).filter(Boolean)).size : 0, K2 = _2 && j2 >= 2, L2 = !!(o2.lat && o2.lon) && e.some((t) => {
1288
- let i = +String(t[o2.lat] ?? "").trim(), a2 = +String(t[o2.lon] ?? "").trim();
1289
- return isFinite(i) && isFinite(a2) && i >= -90 && i <= 90 && a2 >= -180 && a2 <= 180 && String(t[o2.lat] ?? "").trim() !== "" && String(t[o2.lon] ?? "").trim() !== "";
1289
+ let B2 = o2.country ? l2(o2.country) : [], _2 = !!o2.country && C(B2), j2 = _2 ? new Set(B2.map((t) => E(t == null ? null : String(t))).filter(Boolean)).size : 0, K2 = _2 && j2 >= 2, L2 = !!(o2.lat && o2.lon) && e.some((t) => {
1290
+ let i2 = +String(t[o2.lat] ?? "").trim(), a2 = +String(t[o2.lon] ?? "").trim();
1291
+ return isFinite(i2) && isFinite(a2) && i2 >= -90 && i2 <= 90 && a2 >= -180 && a2 <= 180 && String(t[o2.lat] ?? "").trim() !== "" && String(t[o2.lon] ?? "").trim() !== "";
1290
1292
  });
1291
- return o2.lat && o2.lon && !L2 && u2.push(`lat/lon=${o2.lat}/${o2.lon} (no row holds a usable coordinate pair)`), o2.country && !K2 && !(o2.city || o2.state || o2.zip || L2) && u2.push(_2 ? `country=${o2.country} (every row resolves to the same country - nothing to place apart)` : `country=${o2.country} (values are not country identifiers)`), { bind: !!(o2.city || o2.state || o2.zip || K2 || L2) ? o2 : null, backfilled: P2, refused: u2, ...Object.keys(v2).length ? { labelFallback: v2 } : {} };
1293
+ return o2.lat && o2.lon && !L2 && u4.push(`lat/lon=${o2.lat}/${o2.lon} (no row holds a usable coordinate pair)`), o2.country && !K2 && !(o2.city || o2.state || o2.zip || L2) && u4.push(_2 ? `country=${o2.country} (every row resolves to the same country - nothing to place apart)` : `country=${o2.country} (values are not country identifiers)`), { bind: !!(o2.city || o2.state || o2.zip || K2 || L2) ? o2 : null, backfilled: P2, refused: u4, ...Object.keys(v2).length ? { labelFallback: v2 } : {} };
1292
1294
  }
1293
1295
 
1294
1296
  // src/payload.ts
@@ -1454,8 +1456,8 @@ function createMarkResolver(env) {
1454
1456
  if (!m2) return Number.MAX_VALUE;
1455
1457
  let best = Number.MAX_VALUE;
1456
1458
  const N2 = 64;
1457
- for (let i = 0; i <= N2; i++) {
1458
- const pt2 = el.getPointAtLength(L2 * i / N2);
1459
+ for (let i2 = 0; i2 <= N2; i2++) {
1460
+ const pt2 = el.getPointAtLength(L2 * i2 / N2);
1459
1461
  const dx = m2.a * pt2.x + m2.c * pt2.y + m2.e - x2;
1460
1462
  const dy = m2.b * pt2.x + m2.d * pt2.y + m2.f - y2;
1461
1463
  const d = dx * dx + dy * dy;
@@ -1675,12 +1677,12 @@ function censusMarks(container) {
1675
1677
  return EMPTY;
1676
1678
  }
1677
1679
  }
1678
- function isBlankRender(i) {
1679
- if (i.contractUntagged) return false;
1680
- if (i.animated) return false;
1681
- if (i.authoredNoDataText) return false;
1682
- if (!(i.rows > 0)) return false;
1683
- return i.markCount === 0;
1680
+ function isBlankRender(i2) {
1681
+ if (i2.contractUntagged) return false;
1682
+ if (i2.animated) return false;
1683
+ if (i2.authoredNoDataText) return false;
1684
+ if (!(i2.rows > 0)) return false;
1685
+ return i2.markCount === 0;
1684
1686
  }
1685
1687
  function blankRenderFlag(lang, cause) {
1686
1688
  const clean = (s) => String(s || "unknown").toLowerCase().replace(/[^a-z0-9-]+/g, "-");
@@ -1825,8 +1827,8 @@ function svgInkReach(svg) {
1825
1827
  if (!(box.width > 0) || !(box.height > 0)) return null;
1826
1828
  const els = svg.querySelectorAll(FIT_CONTENT_SELECTOR);
1827
1829
  let right = -Infinity, bottom = -Infinity, seen = 0;
1828
- for (let i = 0; i < els.length && seen < FIT_WALK_CAP; i++) {
1829
- const r = els[i].getBoundingClientRect();
1830
+ for (let i2 = 0; i2 < els.length && seen < FIT_WALK_CAP; i2++) {
1831
+ const r = els[i2].getBoundingClientRect();
1830
1832
  if (r.width <= 0 && r.height <= 0) continue;
1831
1833
  if (isPhantomBox(r.width, r.height, box.width, box.height)) continue;
1832
1834
  seen++;
@@ -1844,8 +1846,8 @@ function measureContainerBoxes(c, inkOf) {
1844
1846
  if (!c || !c.children) return boxes;
1845
1847
  const view = c.ownerDocument && c.ownerDocument.defaultView || globalThis;
1846
1848
  const cRect = c.getBoundingClientRect();
1847
- for (let i = 0; i < c.children.length; i++) {
1848
- const el = c.children[i];
1849
+ for (let i2 = 0; i2 < c.children.length; i2++) {
1850
+ const el = c.children[i2];
1849
1851
  let floating = false;
1850
1852
  try {
1851
1853
  const cs = view.getComputedStyle(el);
@@ -1910,8 +1912,8 @@ function fitRenderedChart(container, opts = {}) {
1910
1912
  if (!container) return result;
1911
1913
  try {
1912
1914
  let svg = null;
1913
- for (let i = 0; i < container.children.length && !svg; i++) {
1914
- const el = container.children[i];
1915
+ for (let i2 = 0; i2 < container.children.length && !svg; i2++) {
1916
+ const el = container.children[i2];
1915
1917
  if (el.tagName && el.tagName.toLowerCase() === "svg") svg = el;
1916
1918
  }
1917
1919
  if (!svg) svg = container.querySelector("svg");
@@ -1972,6 +1974,267 @@ function fitRenderedChart(container, opts = {}) {
1972
1974
  return result;
1973
1975
  }
1974
1976
 
1977
+ // src/labelContrast.ts
1978
+ function parseRGBA(c) {
1979
+ if (typeof c !== "string") return null;
1980
+ const s = c.trim();
1981
+ const m2 = s.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*(?:,\s*([\d.]+)\s*)?\)$/i);
1982
+ if (m2) return [parseFloat(m2[1]), parseFloat(m2[2]), parseFloat(m2[3]), m2[4] !== void 0 ? parseFloat(m2[4]) : 1];
1983
+ let h2 = s.replace(/^#/, "");
1984
+ if (h2.length === 3) h2 = h2.split("").map((ch) => ch + ch).join("");
1985
+ if (h2.length === 6 && /^[0-9a-fA-F]{6}$/.test(h2)) {
1986
+ return [parseInt(h2.slice(0, 2), 16), parseInt(h2.slice(2, 4), 16), parseInt(h2.slice(4, 6), 16), 1];
1987
+ }
1988
+ return null;
1989
+ }
1990
+ var DARK_TEXT = "#111111";
1991
+ var LIGHT_TEXT = "#ffffff";
1992
+ var MIN_CONTRAST = 3;
1993
+ var WHITE_TEXT_BG_LUM = 0.5;
1994
+ var PILL_MIN_ALPHA = 0.05;
1995
+ var PILL_OPAQUE_ALPHA = 0.85;
1996
+ var PAGE_MATCH_TOLERANCE = 2;
1997
+ function isPillBackdropAlpha(a2) {
1998
+ return a2 >= PILL_MIN_ALPHA && a2 < PILL_OPAQUE_ALPHA;
1999
+ }
2000
+ var PILL_MIN_COVERAGE = 0.6;
2001
+ function pillBacksGlyph(overlapArea, glyphArea) {
2002
+ if (!(glyphArea > 0) || !isFinite(overlapArea) || overlapArea <= 0) return false;
2003
+ return overlapArea / glyphArea >= PILL_MIN_COVERAGE;
2004
+ }
2005
+ var BACKING_MAJORITY = 0.5;
2006
+ function backingHoldsGlyph(backedArea, glyphArea) {
2007
+ if (!(glyphArea > 0) || !isFinite(backedArea) || backedArea <= 0) return false;
2008
+ return backedArea / glyphArea >= BACKING_MAJORITY;
2009
+ }
2010
+ function cellSuppressesNormalize(cellClass) {
2011
+ return typeof cellClass === "string" && /(^|\s)lch-deck-panel(\s|$)/.test(cellClass);
2012
+ }
2013
+ var NAMED = {
2014
+ white: [255, 255, 255, 1],
2015
+ black: [0, 0, 0, 1],
2016
+ none: [0, 0, 0, 0],
2017
+ transparent: [0, 0, 0, 0]
2018
+ };
2019
+ function toRGBA(c) {
2020
+ if (typeof c !== "string") return null;
2021
+ const k2 = c.trim().toLowerCase();
2022
+ if (k2 in NAMED) return NAMED[k2];
2023
+ return parseRGBA(c);
2024
+ }
2025
+ function compositeOver(fg, bg) {
2026
+ const a2 = Math.max(0, Math.min(1, fg[3]));
2027
+ return [
2028
+ Math.round(fg[0] * a2 + bg[0] * (1 - a2)),
2029
+ Math.round(fg[1] * a2 + bg[1] * (1 - a2)),
2030
+ Math.round(fg[2] * a2 + bg[2] * (1 - a2))
2031
+ ];
2032
+ }
2033
+ function relativeLuminance(rgb) {
2034
+ const lin = rgb.map((v2) => {
2035
+ const s = v2 / 255;
2036
+ return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
2037
+ });
2038
+ return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2];
2039
+ }
2040
+ function contrastRatio(l1, l2) {
2041
+ const hi = Math.max(l1, l2);
2042
+ const lo = Math.min(l1, l2);
2043
+ return (hi + 0.05) / (lo + 0.05);
2044
+ }
2045
+ function decideLabelColor(textColor, fill, fillOpacity, pageBg, minContrast = MIN_CONTRAST, normalize = false) {
2046
+ const fillRGBA = toRGBA(fill);
2047
+ if (!fillRGBA) return { fix: false, color: "", reason: "fill-unparsed" };
2048
+ const pageRGBA = toRGBA(pageBg) || [255, 255, 255, 1];
2049
+ const pageRGB = [pageRGBA[0], pageRGBA[1], pageRGBA[2]];
2050
+ const effFill = [fillRGBA[0], fillRGBA[1], fillRGBA[2], fillRGBA[3] * clamp01(fillOpacity)];
2051
+ const bgRGB = compositeOver(effFill, pageRGB);
2052
+ const bgLum = relativeLuminance(bgRGB);
2053
+ const bgIsPage = Math.abs(bgRGB[0] - pageRGB[0]) <= PAGE_MATCH_TOLERANCE && Math.abs(bgRGB[1] - pageRGB[1]) <= PAGE_MATCH_TOLERANCE && Math.abs(bgRGB[2] - pageRGB[2]) <= PAGE_MATCH_TOLERANCE;
2054
+ const effNormalize = normalize && !bgIsPage;
2055
+ const textRGBA = toRGBA(textColor);
2056
+ if (!effNormalize && textRGBA) {
2057
+ const txtRGB = compositeOver(textRGBA, bgRGB);
2058
+ const cur = contrastRatio(relativeLuminance(txtRGB), bgLum);
2059
+ if (cur >= minContrast) return { fix: false, color: "", reason: "ok" };
2060
+ }
2061
+ const darkC = contrastRatio(relativeLuminance(hexToRGB(DARK_TEXT)), bgLum);
2062
+ const lightC = contrastRatio(relativeLuminance(hexToRGB(LIGHT_TEXT)), bgLum);
2063
+ let useLight = bgLum <= WHITE_TEXT_BG_LUM;
2064
+ if (useLight && lightC < minContrast && darkC >= minContrast) useLight = false;
2065
+ if (!useLight && darkC < minContrast && lightC >= minContrast) useLight = true;
2066
+ return useLight ? { fix: true, color: LIGHT_TEXT, reason: "fixed-light" } : { fix: true, color: DARK_TEXT, reason: "fixed-dark" };
2067
+ }
2068
+ var GLYPH_SAMPLE_N = 3;
2069
+ function glyphSampleGrid(box, n = GLYPH_SAMPLE_N) {
2070
+ const out = [];
2071
+ if (!box || !(box.width > 0) || !(box.height > 0) || !(n >= 1)) return out;
2072
+ const k2 = Math.floor(n);
2073
+ for (let i2 = 0; i2 < k2; i2++) {
2074
+ for (let j2 = 0; j2 < k2; j2++) {
2075
+ out.push({
2076
+ x: box.left + box.width * (i2 + 0.5) / k2,
2077
+ y: box.top + box.height * (j2 + 0.5) / k2
2078
+ });
2079
+ }
2080
+ }
2081
+ return out;
2082
+ }
2083
+ function clamp01(v2) {
2084
+ if (typeof v2 !== "number" || !isFinite(v2)) return 1;
2085
+ return Math.max(0, Math.min(1, v2));
2086
+ }
2087
+ function hexToRGB(hex) {
2088
+ const p2 = toRGBA(hex);
2089
+ return [p2[0], p2[1], p2[2]];
2090
+ }
2091
+
2092
+ // src/labelContrastDom.ts
2093
+ var LABEL_CONTRAST_DONE_ATTR = "data-lch-contrast";
2094
+ var LABEL_CONTRAST_CAP = 2e3;
2095
+ var EMPTY3 = { rects: 0, scanned: 0, fixed: 0, pillsBoosted: 0, offFill: 0, pageMajority: 0 };
2096
+ function backedSamples(el, pts) {
2097
+ try {
2098
+ const ge = el;
2099
+ if (typeof ge.isPointInFill !== "function" || typeof ge.getScreenCTM !== "function") return null;
2100
+ const m2 = ge.getScreenCTM();
2101
+ const svg = ge.ownerSVGElement;
2102
+ if (!m2 || !svg || typeof svg.createSVGPoint !== "function") return null;
2103
+ if (pts.length === 0) return null;
2104
+ const inv = m2.inverse();
2105
+ const hit = [];
2106
+ for (let i2 = 0; i2 < pts.length; i2++) {
2107
+ const p2 = svg.createSVGPoint();
2108
+ p2.x = pts[i2].x;
2109
+ p2.y = pts[i2].y;
2110
+ hit.push(ge.isPointInFill(p2.matrixTransform(inv)));
2111
+ }
2112
+ return hit;
2113
+ } catch {
2114
+ return null;
2115
+ }
2116
+ }
2117
+ function applyLabelContrast(container, opts = {}) {
2118
+ const report = { ...EMPTY3 };
2119
+ if (!container) {
2120
+ report.skipped = "no-container";
2121
+ return report;
2122
+ }
2123
+ const CAP = opts.cap ?? LABEL_CONTRAST_CAP;
2124
+ const pageBg = opts.pageBg || "#ffffff";
2125
+ try {
2126
+ const rects = [];
2127
+ let ord = 0;
2128
+ const pushShape = (el) => {
2129
+ const tag = el.tagName.toLowerCase();
2130
+ if (tag !== "rect" && tag !== "path") return;
2131
+ const r = el.getBoundingClientRect();
2132
+ if (r.width <= 0 || r.height <= 0) return;
2133
+ let fill = el.getAttribute("fill") || "";
2134
+ const win2 = container.ownerDocument?.defaultView;
2135
+ if ((!fill || fill === "none") && win2 && typeof win2.getComputedStyle === "function") {
2136
+ fill = win2.getComputedStyle(el).fill || "";
2137
+ }
2138
+ if (!fill || fill === "none") return;
2139
+ const opAttr = el.getAttribute("fill-opacity");
2140
+ const op = opAttr === null ? 1 : parseFloat(opAttr);
2141
+ rects.push({ r, fill, op: isFinite(op) ? op : 1, area: r.width * r.height, el, ord: ord++ });
2142
+ };
2143
+ const shapeEls = container.querySelectorAll("rect, path");
2144
+ if (shapeEls.length === 0) {
2145
+ report.skipped = "no-shapes";
2146
+ return report;
2147
+ }
2148
+ if (shapeEls.length > CAP) {
2149
+ report.skipped = "too-many-shapes";
2150
+ return report;
2151
+ }
2152
+ for (let i2 = 0; i2 < shapeEls.length; i2++) pushShape(shapeEls[i2]);
2153
+ if (rects.length === 0) {
2154
+ report.skipped = "no-shapes";
2155
+ return report;
2156
+ }
2157
+ report.rects = rects.length;
2158
+ const pageRGBA = toRGBA(pageBg) || [255, 255, 255, 1];
2159
+ const pageRGB = [pageRGBA[0], pageRGBA[1], pageRGBA[2]];
2160
+ const effAlpha = (mk) => {
2161
+ const c = toRGBA(mk.fill);
2162
+ return (c ? c[3] : 1) * mk.op;
2163
+ };
2164
+ const texts = container.querySelectorAll("text");
2165
+ if (texts.length > CAP) {
2166
+ report.skipped = "too-many-texts";
2167
+ return report;
2168
+ }
2169
+ const win = container.ownerDocument?.defaultView;
2170
+ for (let t = 0; t < texts.length; t++) {
2171
+ const tx = texts[t];
2172
+ if (tx.getAttribute(LABEL_CONTRAST_DONE_ATTR) === "1") continue;
2173
+ const tr = tx.getBoundingClientRect();
2174
+ if (tr.width <= 0 || tr.height <= 0) continue;
2175
+ const ovArea = (r) => Math.max(0, Math.min(r.right, tr.right) - Math.max(r.left, tr.left)) * Math.max(0, Math.min(r.bottom, tr.bottom) - Math.max(r.top, tr.top));
2176
+ const glyphArea = tr.width * tr.height;
2177
+ const boxed = rects.map((mk) => ({ mk, ov: ovArea(mk.r) })).filter((x2) => x2.ov > 0);
2178
+ const pts = glyphSampleGrid({ left: tr.left, top: tr.top, width: tr.width, height: tr.height });
2179
+ const painted = pts.map(() => false);
2180
+ let unmeasured = 0;
2181
+ const under = boxed.map((x2) => {
2182
+ const mask = backedSamples(x2.mk.el, pts);
2183
+ if (mask === null) {
2184
+ unmeasured++;
2185
+ return x2;
2186
+ }
2187
+ let inside = 0;
2188
+ const paints = effAlpha(x2.mk) >= PILL_MIN_ALPHA;
2189
+ for (let i2 = 0; i2 < mask.length; i2++) {
2190
+ if (!mask[i2]) continue;
2191
+ inside++;
2192
+ if (paints) painted[i2] = true;
2193
+ }
2194
+ return { mk: x2.mk, ov: glyphArea * (inside / mask.length) };
2195
+ }).filter((x2) => x2.ov > 0);
2196
+ if (under.length === 0 && boxed.length > 0) report.offFill++;
2197
+ if (under.length === 0) continue;
2198
+ if (unmeasured === 0 && pts.length > 0) {
2199
+ let held = 0;
2200
+ for (let i2 = 0; i2 < painted.length; i2++) if (painted[i2]) held++;
2201
+ if (!backingHoldsGlyph(glyphArea * (held / pts.length), glyphArea)) {
2202
+ report.pageMajority++;
2203
+ continue;
2204
+ }
2205
+ }
2206
+ report.scanned++;
2207
+ const opaqueUnder = under.filter((x2) => effAlpha(x2.mk) >= PILL_OPAQUE_ALPHA);
2208
+ const cellEntry = (opaqueUnder.length ? opaqueUnder : under).reduce((a2, b2) => b2.ov > a2.ov || b2.ov === a2.ov && b2.mk.ord > a2.mk.ord ? b2 : a2);
2209
+ const cell = cellEntry.mk;
2210
+ const pill = under.find((x2) => x2.mk !== cell && isPillBackdropAlpha(effAlpha(x2.mk)) && x2.mk.ord > cell.ord && pillBacksGlyph(x2.ov, glyphArea))?.mk;
2211
+ const cellRGBA = toRGBA(cell.fill);
2212
+ let bgRGB = cellRGBA ? compositeOver([cellRGBA[0], cellRGBA[1], cellRGBA[2], cellRGBA[3] * cell.op], pageRGB) : pageRGB;
2213
+ if (pill) {
2214
+ const pr = toRGBA(pill.fill);
2215
+ if (pr) {
2216
+ bgRGB = compositeOver([pr[0], pr[1], pr[2], 0.9], bgRGB);
2217
+ pill.el.setAttribute("fill", `rgb(${pr[0]}, ${pr[1]}, ${pr[2]})`);
2218
+ pill.el.setAttribute("fill-opacity", "0.9");
2219
+ report.pillsBoosted++;
2220
+ }
2221
+ }
2222
+ const cur = tx.getAttribute("fill") || (win && typeof win.getComputedStyle === "function" ? win.getComputedStyle(tx).fill : "");
2223
+ const normalize = !cellSuppressesNormalize(cell.el.getAttribute("class"));
2224
+ const d = decideLabelColor(cur, `rgb(${bgRGB[0]}, ${bgRGB[1]}, ${bgRGB[2]})`, 1, pageBg, MIN_CONTRAST, normalize);
2225
+ if (d.fix) {
2226
+ tx.setAttribute("fill", d.color);
2227
+ report.fixed++;
2228
+ }
2229
+ if (pill || d.fix) tx.setAttribute(LABEL_CONTRAST_DONE_ATTR, "1");
2230
+ }
2231
+ return report;
2232
+ } catch {
2233
+ report.skipped = "error";
2234
+ return report;
2235
+ }
2236
+ }
2237
+
1975
2238
  // src/host.ts
1976
2239
  function sessionViewStateProvider(container) {
1977
2240
  const holder = container;
@@ -2234,6 +2497,7 @@ function createChartHost(container, config) {
2234
2497
  container.classList?.add(HOST_CONTAINER_CLASS);
2235
2498
  ensureAffordanceStyles();
2236
2499
  const fitOpts = config.fit ?? true;
2500
+ const labelContrastOpts = config.labelContrast ?? true;
2237
2501
  const stopAnim = () => {
2238
2502
  const s = container[CONTAINER_SLOT_ANIM_STOP];
2239
2503
  if (typeof s === "function") {
@@ -2273,6 +2537,18 @@ function createChartHost(container, config) {
2273
2537
  } catch (err) {
2274
2538
  throw explainRenderFailure(err, d3);
2275
2539
  }
2540
+ if (labelContrastOpts !== false) {
2541
+ try {
2542
+ const lc = labelContrastOpts === true ? {} : { ...labelContrastOpts };
2543
+ if (!lc.pageBg) {
2544
+ const bg = resolved.backgroundColor ?? resolved.themeBg;
2545
+ if (typeof bg === "string" && bg) lc.pageBg = bg;
2546
+ }
2547
+ const r = applyLabelContrast(container, lc);
2548
+ config.onLabelContrast?.(r);
2549
+ } catch {
2550
+ }
2551
+ }
2276
2552
  ensureCrossfilterHitTargets(container, doc);
2277
2553
  paintSelection();
2278
2554
  try {
@@ -2407,8 +2683,8 @@ export {
2407
2683
  L3,
2408
2684
  Tt,
2409
2685
  Rt,
2410
- ye,
2411
- Se,
2686
+ _e,
2687
+ Ce,
2412
2688
  buildRenderPayload,
2413
2689
  createMarkResolver,
2414
2690
  ensureCrossfilterHitTargets,
@@ -2432,6 +2708,29 @@ export {
2432
2708
  measureContainerBoxes,
2433
2709
  fitReadingFor,
2434
2710
  fitRenderedChart,
2711
+ DARK_TEXT,
2712
+ LIGHT_TEXT,
2713
+ MIN_CONTRAST,
2714
+ WHITE_TEXT_BG_LUM,
2715
+ PILL_MIN_ALPHA,
2716
+ PILL_OPAQUE_ALPHA,
2717
+ PAGE_MATCH_TOLERANCE,
2718
+ isPillBackdropAlpha,
2719
+ PILL_MIN_COVERAGE,
2720
+ pillBacksGlyph,
2721
+ BACKING_MAJORITY,
2722
+ backingHoldsGlyph,
2723
+ cellSuppressesNormalize,
2724
+ toRGBA,
2725
+ compositeOver,
2726
+ relativeLuminance,
2727
+ contrastRatio,
2728
+ decideLabelColor,
2729
+ GLYPH_SAMPLE_N,
2730
+ glyphSampleGrid,
2731
+ LABEL_CONTRAST_DONE_ATTR,
2732
+ LABEL_CONTRAST_CAP,
2733
+ applyLabelContrast,
2435
2734
  sessionViewStateProvider,
2436
2735
  noopViewStateProvider,
2437
2736
  requiredD3Plugins,